heyio 4.0.7 → 4.1.0
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 +963 -352
- package/dist/daemon/index.js +45586 -44316
- package/dist/web/assets/{index-Bp8h1aTr.js → index-C6WVcVgK.js} +45 -45
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
|
@@ -398,22 +398,22 @@ 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
|
|
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 Kf={SQUAD_CREATED:"squad.created",SQUAD_DELETED:"squad.deleted",SQUAD_UPDATED:"squad.updated",INSTANCE_CREATED:"instance.created",INSTANCE_STARTED:"instance.started",INSTANCE_COMPLETED:"instance.completed",INSTANCE_FAILED:"instance.failed",INSTANCE_CANCELLED:"instance.cancelled",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"},CB=10,jB=1e3,NB=3e4,PB=["chat","inbox","activity"];function qP(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function RB(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:PB})),S&&console.info("WebSocket reconnected")},k.onmessage=S=>{var A,C,T,O,N,R,$,K;try{const z=RB(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>=CB){o("disconnected");return}const S=Math.min(jB*2**d.current,NB);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 IB({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 $B(){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
|
-
`);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+=`
|
|
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 MB({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 DB({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 LB({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 zB(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 BB=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 UB 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 qB{constructor(e,{headers:r={},customFetch:n,region:i=tx.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=BB(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return zB(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 UB(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),FB=[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 HB(t,e,r,n){return!(!n||r>=KP||!GP.includes(t)||!FB.includes(e))}var WB=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(HB(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
|
|
|
405
405
|
Caused by: ${(w=f==null?void 0:f.name)!==null&&w!==void 0?w:"Error"}: ${S}`,A&&(u+=` (${A})`),f!=null&&f.stack&&(u+=`
|
|
406
|
-
${f.stack}`)}else{var x;u=(x=o==null?void 0:o.stack)!==null&&x!==void 0?x:""}const k=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(p="",d="Request was aborted (timeout or manual cancellation)",k>this.urlLengthLimit&&(d+=`. Note: Your request URL is ${k} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((f==null?void 0:f.name)==="HeadersOverflowError"||(f==null?void 0:f.code)==="UND_ERR_HEADERS_OVERFLOW")&&(p="",d="HTTP headers exceeded server limits (typically 16KB)",k>this.urlLengthLimit&&(d+=`. Your request URL is ${k} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(c=o==null?void 0:o.name)!==null&&c!==void 0?c:"FetchError"}: ${o==null?void 0:o.message}`,details:u,hint:d,code:p},data:null,count:null,status:0,statusText:""}})),a.then(t,e)}async processResponse(t){var e=this;let r=null,n=null,i=null,a=t.status,o=t.statusText;if(t.ok){var c,u;if(e.method!=="HEAD"){var d;const m=await t.text();if(m!=="")if(e.headers.get("Accept")==="text/csv")n=m;else if(e.headers.get("Accept")&&(!((d=e.headers.get("Accept"))===null||d===void 0)&&d.includes("application/vnd.pgrst.plan+text")))n=m;else try{n=JSON.parse(m)}catch{if(r={message:m},n=null,e.shouldThrowOnError)throw new lE({message:m,details:"",hint:"",code:""})}}const p=(c=e.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),f=(u=t.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),e.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,a=406,o="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const p=await t.text();try{r=JSON.parse(p),Array.isArray(r)&&t.status===404&&(n=[],r=null,a=200,o="OK")}catch{t.status===404&&p===""?(a=204,o="No Content"):r={message:p}}if(r&&e.shouldThrowOnError)throw new lE(r)}return{success:r===null,error:r,data:n,count:i,status:a,statusText:o}}returns(){return this}overrideTypes(){return this}},GB=class extends KB{select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:i=n}={}){const a=i?`${i}.order`:"order",o=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const i=typeof n>"u"?"offset":`${n}.offset`,a=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(a,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:i=!1,format:a="text"}={}){var o;const c=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),u=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${u}"; options=${c};`),a==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const uE=new RegExp("[,()]");var Cs=class extends GB{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&uE.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&uE.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let i="";n==="plain"?i="pl":n==="phrase"?i="ph":n==="websearch"&&(i="w");const a=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${i}fts${a}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},VB=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:i=8e3,retry:a}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=i,this.retry=a}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:n}=e??{},i=r?"HEAD":"GET";let a=!1;const o=(t??"*").split("").map(d=>/\s/.test(d)&&!a?"":(d==='"'&&(a=!a),d)).join(""),{url:c,headers:u}=this.cloneRequestState();return c.searchParams.set("select",o),n&&u.append("Prefer",`count=${n}`),new Cs({method:i,url:c,headers:u,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const i="POST",{url:a,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);a.searchParams.set("columns",u.join(","))}}return new Cs({method:i,url:a,headers:o,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:i=!0}={}){var a;const o="POST",{url:c,headers:u}=this.cloneRequestState();if(u.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&c.searchParams.set("on_conflict",e),n&&u.append("Prefer",`count=${n}`),i||u.append("Prefer","missing=default"),Array.isArray(t)){const d=t.reduce((p,f)=>p.concat(Object.keys(f)),[]);if(d.length>0){const p=[...new Set(d)].map(f=>`"${f}"`);c.searchParams.set("columns",p.join(","))}}return new Cs({method:o,url:c,headers:u,schema:this.schema,body:t,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const n="PATCH",{url:i,headers:a}=this.cloneRequestState();return e&&a.append("Prefer",`count=${e}`),new Cs({method:n,url:i,headers:a,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Cs({method:r,url:n,headers:i,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Fc(t){"@babel/helpers - typeof";return Fc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fc(t)}function XB(t,e){if(Fc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Fc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function YB(t){var e=XB(t,"string");return Fc(e)=="symbol"?e:e+""}function JB(t,e,r){return(e=YB(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dE(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 of(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?dE(Object(r),!0).forEach(function(n){JB(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var ZB=class VP{constructor(e,{headers:r={},schema:n,fetch:i,timeout:a,urlLengthLimit:o=8e3,retry:c}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const u=i??globalThis.fetch;a!==void 0&&a>0?this.fetch=(d,p)=>{const f=new AbortController,m=setTimeout(()=>f.abort(),a),v=p==null?void 0:p.signal;if(v){if(v.aborted)return clearTimeout(m),u(d,p);const b=()=>{clearTimeout(m),f.abort()};return v.addEventListener("abort",b,{once:!0}),u(d,of(of({},p),{},{signal:f.signal})).finally(()=>{clearTimeout(m),v.removeEventListener("abort",b)})}return u(d,of(of({},p),{},{signal:f.signal})).finally(()=>clearTimeout(m))}:this.fetch=u,this.retry=c}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new VB(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new VP(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:n=!1,get:i=!1,count:a}={}){var o;let c;const u=new URL(`${this.url}/rpc/${e}`);let d;const p=v=>v!==null&&typeof v=="object"&&(!Array.isArray(v)||v.some(p)),f=n&&Object.values(r).some(p);f?(c="POST",d=r):n||i?(c=n?"HEAD":"GET",Object.entries(r).filter(([v,b])=>b!==void 0).map(([v,b])=>[v,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([v,b])=>{u.searchParams.append(v,b)})):(c="POST",d=r);const m=new Headers(this.headers);return f?m.set("Prefer",a?`count=${a},return=minimal`:"return=minimal"):a&&m.set("Prefer",`count=${a}`),new Cs({method:c,url:u,headers:m,schema:this.schemaName,body:d,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class QB{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const i=globalThis.process;if(i){const a=i.versions;if(a&&a.node){const o=a.node,c=parseInt(o.replace(/^v/,"").split(".")[0]);return c>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${c} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${c} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
406
|
+
${f.stack}`)}else{var x;u=(x=o==null?void 0:o.stack)!==null&&x!==void 0?x:""}const k=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(p="",d="Request was aborted (timeout or manual cancellation)",k>this.urlLengthLimit&&(d+=`. Note: Your request URL is ${k} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((f==null?void 0:f.name)==="HeadersOverflowError"||(f==null?void 0:f.code)==="UND_ERR_HEADERS_OVERFLOW")&&(p="",d="HTTP headers exceeded server limits (typically 16KB)",k>this.urlLengthLimit&&(d+=`. Your request URL is ${k} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(c=o==null?void 0:o.name)!==null&&c!==void 0?c:"FetchError"}: ${o==null?void 0:o.message}`,details:u,hint:d,code:p},data:null,count:null,status:0,statusText:""}})),a.then(t,e)}async processResponse(t){var e=this;let r=null,n=null,i=null,a=t.status,o=t.statusText;if(t.ok){var c,u;if(e.method!=="HEAD"){var d;const m=await t.text();if(m!=="")if(e.headers.get("Accept")==="text/csv")n=m;else if(e.headers.get("Accept")&&(!((d=e.headers.get("Accept"))===null||d===void 0)&&d.includes("application/vnd.pgrst.plan+text")))n=m;else try{n=JSON.parse(m)}catch{if(r={message:m},n=null,e.shouldThrowOnError)throw new lE({message:m,details:"",hint:"",code:""})}}const p=(c=e.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),f=(u=t.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),e.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,a=406,o="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const p=await t.text();try{r=JSON.parse(p),Array.isArray(r)&&t.status===404&&(n=[],r=null,a=200,o="OK")}catch{t.status===404&&p===""?(a=204,o="No Content"):r={message:p}}if(r&&e.shouldThrowOnError)throw new lE(r)}return{success:r===null,error:r,data:n,count:i,status:a,statusText:o}}returns(){return this}overrideTypes(){return this}},KB=class extends WB{select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:i=n}={}){const a=i?`${i}.order`:"order",o=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const i=typeof n>"u"?"offset":`${n}.offset`,a=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(a,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:i=!1,format:a="text"}={}){var o;const c=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,i?"wal":null].filter(Boolean).join("|"),u=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${u}"; options=${c};`),a==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const uE=new RegExp("[,()]");var Cs=class extends KB{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&uE.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&uE.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let i="";n==="plain"?i="pl":n==="phrase"?i="ph":n==="websearch"&&(i="w");const a=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${i}fts${a}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},GB=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:i=8e3,retry:a}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=i,this.retry=a}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:n}=e??{},i=r?"HEAD":"GET";let a=!1;const o=(t??"*").split("").map(d=>/\s/.test(d)&&!a?"":(d==='"'&&(a=!a),d)).join(""),{url:c,headers:u}=this.cloneRequestState();return c.searchParams.set("select",o),n&&u.append("Prefer",`count=${n}`),new Cs({method:i,url:c,headers:u,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const i="POST",{url:a,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);a.searchParams.set("columns",u.join(","))}}return new Cs({method:i,url:a,headers:o,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:i=!0}={}){var a;const o="POST",{url:c,headers:u}=this.cloneRequestState();if(u.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&c.searchParams.set("on_conflict",e),n&&u.append("Prefer",`count=${n}`),i||u.append("Prefer","missing=default"),Array.isArray(t)){const d=t.reduce((p,f)=>p.concat(Object.keys(f)),[]);if(d.length>0){const p=[...new Set(d)].map(f=>`"${f}"`);c.searchParams.set("columns",p.join(","))}}return new Cs({method:o,url:c,headers:u,schema:this.schema,body:t,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const n="PATCH",{url:i,headers:a}=this.cloneRequestState();return e&&a.append("Prefer",`count=${e}`),new Cs({method:n,url:i,headers:a,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Cs({method:r,url:n,headers:i,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Fc(t){"@babel/helpers - typeof";return Fc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fc(t)}function VB(t,e){if(Fc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Fc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function XB(t){var e=VB(t,"string");return Fc(e)=="symbol"?e:e+""}function YB(t,e,r){return(e=XB(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dE(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 of(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?dE(Object(r),!0).forEach(function(n){YB(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var JB=class VP{constructor(e,{headers:r={},schema:n,fetch:i,timeout:a,urlLengthLimit:o=8e3,retry:c}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const u=i??globalThis.fetch;a!==void 0&&a>0?this.fetch=(d,p)=>{const f=new AbortController,m=setTimeout(()=>f.abort(),a),v=p==null?void 0:p.signal;if(v){if(v.aborted)return clearTimeout(m),u(d,p);const b=()=>{clearTimeout(m),f.abort()};return v.addEventListener("abort",b,{once:!0}),u(d,of(of({},p),{},{signal:f.signal})).finally(()=>{clearTimeout(m),v.removeEventListener("abort",b)})}return u(d,of(of({},p),{},{signal:f.signal})).finally(()=>clearTimeout(m))}:this.fetch=u,this.retry=c}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new GB(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new VP(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:n=!1,get:i=!1,count:a}={}){var o;let c;const u=new URL(`${this.url}/rpc/${e}`);let d;const p=v=>v!==null&&typeof v=="object"&&(!Array.isArray(v)||v.some(p)),f=n&&Object.values(r).some(p);f?(c="POST",d=r):n||i?(c=n?"HEAD":"GET",Object.entries(r).filter(([v,b])=>b!==void 0).map(([v,b])=>[v,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([v,b])=>{u.searchParams.append(v,b)})):(c="POST",d=r);const m=new Headers(this.headers);return f?m.set("Prefer",a?`count=${a},return=minimal`:"return=minimal"):a&&m.set("Prefer",`count=${a}`),new Cs({method:c,url:u,headers:m,schema:this.schemaName,body:d,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class ZB{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const i=globalThis.process;if(i){const a=i.versions;if(a&&a.node){const o=a.node,c=parseInt(o.replace(/^v/,"").split(".")[0]);return c>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${c} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${c} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
407
407
|
import ws from "ws"
|
|
408
408
|
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
|
|
409
409
|
|
|
410
|
-
Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const e8="2.107.0",t8=`realtime-js/${e8}`,r8="1.0.0",XP="2.0.0",n8=XP,i8=1e4,a8=100,Na={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},YP={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},rx={connecting:"connecting",closing:"closing",closed:"closed"};class o8{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const i=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(e){var r,n;const i=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,n){var i,a;const o=e.topic,c=(i=e.ref)!==null&&i!==void 0?i:"",u=(a=e.join_ref)!==null&&a!==void 0?a:"",d=e.payload.event,p=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},f=Object.keys(p).length===0?"":JSON.stringify(p);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`ref length ${c.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`userEvent length ${d.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`metadata length ${f.length} exceeds maximum of 255`);const m=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+c.length+o.length+d.length+f.length,v=new ArrayBuffer(this.HEADER_LENGTH+m);let b=new DataView(v),w=0;b.setUint8(w++,this.KINDS.userBroadcastPush),b.setUint8(w++,u.length),b.setUint8(w++,c.length),b.setUint8(w++,o.length),b.setUint8(w++,d.length),b.setUint8(w++,f.length),b.setUint8(w++,r),Array.from(u,k=>b.setUint8(w++,k.charCodeAt(0))),Array.from(c,k=>b.setUint8(w++,k.charCodeAt(0))),Array.from(o,k=>b.setUint8(w++,k.charCodeAt(0))),Array.from(d,k=>b.setUint8(w++,k.charCodeAt(0))),Array.from(f,k=>b.setUint8(w++,k.charCodeAt(0)));var x=new Uint8Array(v.byteLength+n.byteLength);return x.set(new Uint8Array(v),0),x.set(new Uint8Array(n),v.byteLength),x.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[i,a,o,c,u]=n;return r({join_ref:i,ref:a,topic:o,event:c,payload:u})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,i)}}_decodeUserBroadcast(e,r,n){const i=r.getUint8(1),a=r.getUint8(2),o=r.getUint8(3),c=r.getUint8(4);let u=this.HEADER_LENGTH+4;const d=n.decode(e.slice(u,u+i));u=u+i;const p=n.decode(e.slice(u,u+a));u=u+a;const f=n.decode(e.slice(u,u+o));u=u+o;const m=e.slice(u,e.byteLength),v=c===this.JSON_ENCODING?JSON.parse(n.decode(m)):m,b={type:this.BROADCAST_EVENT,event:p,payload:v};return o>0&&(b.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:d,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}var Ot;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Ot||(Ot={}));const fE=(t,e,r={})=>{var n;const i=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((a,o)=>(a[o]=s8(o,t,e,i),a),{}):{}},s8=(t,e,r,n)=>{const i=e.find(c=>c.name===t),a=i==null?void 0:i.type,o=r[t];return a&&!n.includes(a)?JP(a,o):nx(o)},JP=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return d8(e,r)}switch(t){case Ot.bool:return l8(e);case Ot.float4:case Ot.float8:case Ot.int2:case Ot.int4:case Ot.int8:case Ot.numeric:case Ot.oid:return c8(e);case Ot.json:case Ot.jsonb:return u8(e);case Ot.timestamp:return f8(e);case Ot.abstime:case Ot.date:case Ot.daterange:case Ot.int4range:case Ot.int8range:case Ot.money:case Ot.reltime:case Ot.text:case Ot.time:case Ot.timestamptz:case Ot.timetz:case Ot.tsrange:case Ot.tstzrange:return nx(e);default:return nx(e)}},nx=t=>t,l8=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},c8=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},u8=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},d8=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let a;const o=t.slice(1,r);try{a=JSON.parse("["+o+"]")}catch{a=o?o.split(","):[]}return a.map(c=>JP(e,c))}return t},f8=t=>typeof t=="string"?t.replace(" ","T"):t,ZP=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var Rc=t=>typeof t=="function"?t:function(){return t},h8=typeof self<"u"?self:null,js=typeof window<"u"?window:null,vi=h8||js||globalThis,p8="2.0.0",m8=1e4,g8=1e3,bi={connecting:0,open:1,closing:2,closed:3},Xr={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ui={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ix={longpoll:"longpoll",websocket:"websocket"},y8={complete:4},ax="base64url.bearer.phx.",sf=class{constructor(t,e,r,n){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},QP=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},v8=class{constructor(t,e,r){this.state=Xr.closed,this.topic=t,this.params=Rc(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new sf(this,Ui.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new QP(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=Xr.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Xr.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Xr.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=Xr.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new sf(this,Ui.leave,Rc({}),this.timeout).send(),this.state=Xr.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ui.reply,(n,i)=>{this.trigger(this.replyEventName(i),n)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Xr.closed,this.bindings=[]}onClose(t){this.on(Ui.close,t)}onError(t){return this.on(Ui.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e>"u"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new sf(this,t,function(){return e},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Xr.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ui.close,"leave")},r=new sf(this,Ui.leave,Rc({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,n){return this.topic!==t?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Xr.joining,this.joinPush.resend(t))}trigger(t,e,r,n){let i=this.onMessage(t,e,r,n);if(e&&!i)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let a=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,r));for(let o=0;o<a.length;o++)a[o].callback(i,r,n||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===Xr.closed}isErrored(){return this.state===Xr.errored}isJoined(){return this.state===Xr.joined}isJoining(){return this.state===Xr.joining}isLeaving(){return this.state===Xr.leaving}},Vf=class{static request(t,e,r,n,i,a,o){if(vi.XDomainRequest){let c=new vi.XDomainRequest;return this.xdomainRequest(c,t,e,n,i,a,o)}else if(vi.XMLHttpRequest){let c=new vi.XMLHttpRequest;return this.xhrRequest(c,t,e,r,n,i,a,o)}else{if(vi.fetch&&vi.AbortController)return this.fetchRequest(t,e,r,n,i,a,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,n,i,a,o){let c={method:t,headers:r,body:n},u=null;return i&&(u=new AbortController,setTimeout(()=>u.abort(),i),c.signal=u.signal),vi.fetch(e,c).then(d=>d.text()).then(d=>this.parseJSON(d)).then(d=>o&&o(d)).catch(d=>{d.name==="AbortError"&&a?a():o&&o(null)}),u}static xdomainRequest(t,e,r,n,i,a,o){return t.timeout=i,t.open(e,r),t.onload=()=>{let c=this.parseJSON(t.responseText);o&&o(c)},a&&(t.ontimeout=a),t.onprogress=()=>{},t.send(n),t}static xhrRequest(t,e,r,n,i,a,o,c){t.open(e,r,!0),t.timeout=a;for(let[u,d]of Object.entries(n))t.setRequestHeader(u,d);return t.onerror=()=>c&&c(null),t.onreadystatechange=()=>{if(t.readyState===y8.complete&&c){let u=this.parseJSON(t.responseText);c(u)}},o&&(t.ontimeout=o),t.send(i),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let i=e?`${e}[${n}]`:n,a=t[n];typeof a=="object"?r.push(this.serialize(a,i)):r.push(encodeURIComponent(i)+"="+encodeURIComponent(a))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},b8=t=>{let e="",r=new Uint8Array(t),n=r.byteLength;for(let i=0;i<n;i++)e+=String.fromCharCode(r[i]);return btoa(e)},bs=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(ax)&&(this.authToken=atob(e[1].slice(ax.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=bi.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ix.websocket),"$1/"+ix.longpoll)}endpointURL(){return Vf.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=bi.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===bi.open||this.readyState===bi.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:n,messages:i}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:i.forEach(a=>{setTimeout(()=>this.onmessage({data:a}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=bi.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(t){typeof t!="string"&&(t=b8(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
|
|
411
|
-
`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,r){for(let i of this.reqs)i.abort();this.readyState=bi.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(t,e,r,n,i){let a,o=()=>{this.reqs.delete(a),n()};a=Vf.request(t,this.endpointURL(),e,r,this.timeout,o,c=>{this.reqs.delete(a),this.isActive()&&i(c)}),this.reqs.add(a)}},x8=class Ac{constructor(e,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,i=>{let{onJoin:a,onLeave:o,onSync:c}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Ac.syncState(this.state,i,a,o),this.pendingDiffs.forEach(u=>{this.state=Ac.syncDiff(this.state,u,a,o)}),this.pendingDiffs=[],c()}),this.channel.on(n.diff,i=>{let{onJoin:a,onLeave:o,onSync:c}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=Ac.syncDiff(this.state,i,a,o),c())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Ac.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,n,i){let a=this.clone(e),o={},c={};return this.map(a,(u,d)=>{r[u]||(c[u]=d)}),this.map(r,(u,d)=>{let p=a[u];if(p){let f=d.metas.map(w=>w.phx_ref),m=p.metas.map(w=>w.phx_ref),v=d.metas.filter(w=>m.indexOf(w.phx_ref)<0),b=p.metas.filter(w=>f.indexOf(w.phx_ref)<0);v.length>0&&(o[u]=d,o[u].metas=v),b.length>0&&(c[u]=this.clone(p),c[u].metas=b)}else o[u]=d}),this.syncDiff(a,{joins:o,leaves:c},n,i)}static syncDiff(e,r,n,i){let{joins:a,leaves:o}=this.clone(r);return n||(n=function(){}),i||(i=function(){}),this.map(a,(c,u)=>{let d=e[c];if(e[c]=this.clone(u),d){let p=e[c].metas.map(m=>m.phx_ref),f=d.metas.filter(m=>p.indexOf(m.phx_ref)<0);e[c].metas.unshift(...f)}n(c,d,u)}),this.map(o,(c,u)=>{let d=e[c];if(!d)return;let p=u.metas.map(f=>f.phx_ref);d.metas=d.metas.filter(f=>p.indexOf(f.phx_ref)<0),i(c,d,u),d.metas.length===0&&delete e[c]}),e}static list(e,r){return r||(r=function(n,i){return i}),this.map(e,(n,i)=>r(n,i))}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static clone(e){return JSON.parse(JSON.stringify(e))}},lf={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,n,i,a,o]=JSON.parse(t);return e({join_ref:r,ref:n,topic:i,event:a,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:n,topic:i,payload:a}=t,o=this.META_LENGTH+e.length+r.length+i.length+n.length,c=new ArrayBuffer(this.HEADER_LENGTH+o),u=new DataView(c),d=0;u.setUint8(d++,this.KINDS.push),u.setUint8(d++,e.length),u.setUint8(d++,r.length),u.setUint8(d++,i.length),u.setUint8(d++,n.length),Array.from(e,f=>u.setUint8(d++,f.charCodeAt(0))),Array.from(r,f=>u.setUint8(d++,f.charCodeAt(0))),Array.from(i,f=>u.setUint8(d++,f.charCodeAt(0))),Array.from(n,f=>u.setUint8(d++,f.charCodeAt(0)));var p=new Uint8Array(c.byteLength+a.byteLength);return p.set(new Uint8Array(c),0),p.set(new Uint8Array(a),c.byteLength),p.buffer},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,n);case this.KINDS.reply:return this.decodeReply(t,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,n)}},decodePush(t,e,r){let n=e.getUint8(1),i=e.getUint8(2),a=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,c=r.decode(t.slice(o,o+n));o=o+n;let u=r.decode(t.slice(o,o+i));o=o+i;let d=r.decode(t.slice(o,o+a));o=o+a;let p=t.slice(o,t.byteLength);return{join_ref:c,ref:null,topic:u,event:d,payload:p}},decodeReply(t,e,r){let n=e.getUint8(1),i=e.getUint8(2),a=e.getUint8(3),o=e.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,u=r.decode(t.slice(c,c+n));c=c+n;let d=r.decode(t.slice(c,c+i));c=c+i;let p=r.decode(t.slice(c,c+a));c=c+a;let f=r.decode(t.slice(c,c+o));c=c+o;let m=t.slice(c,t.byteLength),v={status:f,response:m};return{join_ref:u,ref:d,topic:p,event:Ui.reply,payload:v}},decodeBroadcast(t,e,r){let n=e.getUint8(1),i=e.getUint8(2),a=this.HEADER_LENGTH+2,o=r.decode(t.slice(a,a+n));a=a+n;let c=r.decode(t.slice(a,a+i));a=a+i;let u=t.slice(a,t.byteLength);return{join_ref:null,ref:null,topic:o,event:c,payload:u}}},w8=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||m8,this.transport=e.transport||vi.WebSocket||bs,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=vi&&vi.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=lf.encode.bind(lf),this.defaultDecoder=lf.decode.bind(lf),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==bs?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;js&&js.addEventListener&&(js.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),n=this.connectClock)}),js.addEventListener("pageshow",i=>{n===this.connectClock&&(n=null,this.connect())}),js.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=i=>e.rejoinAfterMs?e.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>e.reconnectAfterMs?e.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(i,a,o)=>{console.log(`${i}: ${a}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=Rc(e.params||{}),this.endPoint=`${t}/${ix.websocket}`,this.vsn=e.vsn||p8,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new QP(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return bs}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Vf.appendParams(Vf.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Rc(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==bs?this.connectWithFallback(bs,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(i=>{i.ref===e&&(this.off([n]),t(Date.now()-r))});return!0}transportName(t){switch(t){case bs:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${ax}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,i,a,o=this.transportName(t),c=u=>{this.log("transport",`falling back to ${o}...`,u),this.off([i,a]),n=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return c("memorized");this.fallbackTimer=setTimeout(c,e),a=this.onError(u=>{this.log("transport","error",u),n&&!r&&(clearTimeout(this.fallbackTimer),c(u))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let u=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${u}`,"true"),this.log("transport",`established ${u} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(c,e),this.ping(u=>{this.log("transport","connected to primary after",u),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),g8,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const n=this.conn;this.waitForBufferDone(n,()=>{e?n.close(e,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===bi.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Ui.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case bi.connecting:return"connecting";case bi.open:return"open";case bi.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new v8(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:n,ref:i,join_ref:a}=t;this.log("push",`${e} ${r} (${a}, ${i})`,n)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:n,payload:i,ref:a,join_ref:o}=e;if(a&&a===this.pendingHeartbeatRef){const c=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(i.status==="ok"?"ok":"error",c)}catch(u){this.log("error","error in heartbeat callback",u)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${r} ${n} ${a&&"("+a+")"||""}`.trim(),i);for(let c=0;c<this.channels.length;c++){const u=this.channels[c];u.isMember(r,n,i,o)&&u.trigger(n,i,a,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,n])=>{try{n(...e)}catch(i){this.log("error",`error in ${t} callback`,i)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class Ic{constructor(e,r){const n=S8(r);this.presence=new x8(e.getChannel(),n),this.presence.onJoin((i,a,o)=>{const c=Ic.onJoinPayload(i,a,o);e.getChannel().trigger("presence",c)}),this.presence.onLeave((i,a,o)=>{const c=Ic.onLeavePayload(i,a,o);e.getChannel().trigger("presence",c)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Ic.transformState(this.presence.state)}static transformState(e){return e=_8(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const i=e[n];return r[n]=If(i),r},{})}static onJoinPayload(e,r,n){const i=hE(r),a=If(n);return{event:"join",key:e,currentPresences:i,newPresences:a}}static onLeavePayload(e,r,n){const i=hE(r),a=If(n);return{event:"leave",key:e,currentPresences:i,leftPresences:a}}}function If(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function _8(t){return JSON.parse(JSON.stringify(t))}function S8(t){return(t==null?void 0:t.events)&&{events:t.events}}function hE(t){return t!=null&&t.metas?If(t):[]}var pE;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(pE||(pE={}));class k8{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Ic(this.channel.channelAdapter,r)}}function E8(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;if(typeof e.code=="number"){const r=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${r}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class A8{constructor(e,r,n){const i=O8(n);this.channel=e.getSocket().channel(r,i),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,n){let i;try{i=this.channel.push(e,r,n)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>a8){const a=this.channel.pushBuffer.shift();a.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${a.event}`,a.payload())}return i}updateJoinPayload(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}canPush(){return this.socket.isConnected()&&this.state===Na.joined}isJoined(){return this.state===Na.joined}isJoining(){return this.state===Na.joining}isClosed(){return this.state===Na.closed}isLeaving(){return this.state===Na.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function O8(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var mE;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(mE||(mE={}));var Ps;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Ps||(Ps={}));var qi;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(qi||(qi={}));class $c{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},n){var i,a;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new A8(this.socket.socketAdapter,e,this.params),this.presence=new k8(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=ZP(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((a=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||a===void 0)&&a.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,r=this.timeout){var n,i,a;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:c,private:u}}=this.params,d=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(v=>v.filter))!==null&&i!==void 0?i:[],p=!!this.bindings[Ps.PRESENCE]&&this.bindings[Ps.PRESENCE].length>0||((a=this.params.config.presence)===null||a===void 0?void 0:a.enabled)===!0,f={},m={broadcast:o,presence:Object.assign(Object.assign({},c),{enabled:p}),postgres_changes:d,private:u};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(v=>{e==null||e(qi.CHANNEL_ERROR,E8(v))}),this._onClose(()=>e==null?void 0:e(qi.CLOSED)),this.updateJoinPayload(Object.assign({config:m},f)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:v})=>{if(this.socket._isManualToken()||this.socket.setAuth(),v===void 0){e==null||e(qi.SUBSCRIBED);return}this._updatePostgresBindings(v,e)}).receive("error",v=>{this.state=Na.errored;const b=Object.values(v).join(", ")||"error";e==null||e(qi.CHANNEL_ERROR,new Error(b,{cause:v}))}).receive("timeout",()=>{e==null||e(qi.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var n;const i=this.bindings.postgres_changes,a=(n=i==null?void 0:i.length)!==null&&n!==void 0?n:0,o=[];for(let c=0;c<a;c++){const u=i[c],{filter:{event:d,schema:p,table:f,filter:m}}=u,v=e&&e[c];if(v&&v.event===d&&$c.isFilterValueEqual(v.schema,p)&&$c.isFilterValueEqual(v.table,f)&&$c.isFilterValueEqual(v.filter,m))o.push(Object.assign(Object.assign({},u),{id:v.id}));else{this.unsubscribe(),this.state=Na.errored,r==null||r(qi.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=Na.errored&&r&&r(qi.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){const i=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),a=e===Ps.PRESENCE||e===Ps.POSTGRES_CHANGES;if(i&&a)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,n)}async httpSend(e,r,n={}){var i;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const a=r instanceof ArrayBuffer||ArrayBuffer.isView(r),o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":a?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c=new URL(this.broadcastEndpointURL);c.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&c.searchParams.set("private","true");const u={method:"POST",headers:o,body:a?r:JSON.stringify(r)},d=await this._fetchWithTimeout(c.toString(),u,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);if(d.status===202)return{success:!0};let p=d.statusText;try{const f=await d.json();p=f.error||f.message||p}catch{}return Promise.reject(new Error(p))}async send(e,r={}){var n,i;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:a,payload:o}=e,c={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(c.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:c,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:o,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=d.body)===null||i===void 0?void 0:i.cancel()),d.ok?"ok":"error"}catch(d){return d instanceof Error&&d.name==="AbortError"?"timed out":"error"}}else return new Promise(a=>{var o,c,u;const d=this.channelAdapter.push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(c=(o=this.params)===null||o===void 0?void 0:o.config)===null||c===void 0?void 0:c.broadcast)===null||u===void 0)&&u.ack)&&a("ok"),d.receive("ok",()=>a("ok")),d.receive("error",()=>a("error")),d.receive("timeout",()=>a("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,r,n){const i=new AbortController,a=setTimeout(()=>i.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(a),o}_on(e,r,n){const i=e.toLocaleLowerCase(),a=this.channelAdapter.on(e,n),o={type:i,filter:r,callback:n,ref:a};return this.bindings[i]?this.bindings[i].push(o):this.bindings[i]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,n)=>{var i,a,o,c,u,d,p;const f=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(f,n))return!1;const m=(i=this.bindings[f])===null||i===void 0?void 0:i.find(v=>v.ref===e.ref);if(!m)return!0;if(["broadcast","presence","postgres_changes"].includes(f))if("id"in m){const v=m.id,b=(a=m.filter)===null||a===void 0?void 0:a.event;return v&&((o=r.ids)===null||o===void 0?void 0:o.includes(v))&&(b==="*"||(b==null?void 0:b.toLocaleLowerCase())===((c=r.data)===null||c===void 0?void 0:c.type.toLocaleLowerCase()))}else{const v=(d=(u=m==null?void 0:m.filter)===null||u===void 0?void 0:u.event)===null||d===void 0?void 0:d.toLocaleLowerCase();return v==="*"||v===((p=r==null?void 0:r.event)===null||p===void 0?void 0:p.toLocaleLowerCase())}else return m.type.toLocaleLowerCase()===f})}_notThisChannelEvent(e,r){const{close:n,error:i,leave:a,join:o}=YP;return r&&[n,i,a,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,n)=>{if(typeof r=="object"&&"ids"in r){const i=r.data,{schema:a,table:o,commit_timestamp:c,type:u,errors:d}=i;return Object.assign(Object.assign({},{schema:a,table:o,commit_timestamp:c,eventType:u,new:{},old:{},errors:d}),this._getPayloadRecords(i))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const n of e.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=fE(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=fE(e.columns,e.old_record)),r}}class T8{constructor(e,r){this.socket=new w8(e,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,n,i=1e4){return new Promise(a=>{setTimeout(()=>a("timeout"),i),this.socket.disconnect(()=>{e(),a("ok")},r,n)})}push(e){this.socket.push(e)}log(e,r,n){this.socket.log(e,r,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==rx.connecting}isDisconnecting(){return this.socket.connectionState()==rx.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const gE={HEARTBEAT_INTERVAL:25e3},C8=[1e3,2e3,5e3,1e4],j8=1e4;function N8(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var r;return(r=Array.from(t.keys())[e])!==null&&r!==void 0?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function P8(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return N8()}const R8=`
|
|
410
|
+
Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const QB="2.107.0",e8=`realtime-js/${QB}`,t8="1.0.0",XP="2.0.0",r8=XP,n8=1e4,i8=100,Na={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},YP={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},rx={connecting:"connecting",closing:"closing",closed:"closed"};class a8{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const i=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(e){var r,n;const i=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,n){var i,a;const o=e.topic,c=(i=e.ref)!==null&&i!==void 0?i:"",u=(a=e.join_ref)!==null&&a!==void 0?a:"",d=e.payload.event,p=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},f=Object.keys(p).length===0?"":JSON.stringify(p);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`ref length ${c.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`userEvent length ${d.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`metadata length ${f.length} exceeds maximum of 255`);const m=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+c.length+o.length+d.length+f.length,v=new ArrayBuffer(this.HEADER_LENGTH+m);let b=new DataView(v),w=0;b.setUint8(w++,this.KINDS.userBroadcastPush),b.setUint8(w++,u.length),b.setUint8(w++,c.length),b.setUint8(w++,o.length),b.setUint8(w++,d.length),b.setUint8(w++,f.length),b.setUint8(w++,r),Array.from(u,k=>b.setUint8(w++,k.charCodeAt(0))),Array.from(c,k=>b.setUint8(w++,k.charCodeAt(0))),Array.from(o,k=>b.setUint8(w++,k.charCodeAt(0))),Array.from(d,k=>b.setUint8(w++,k.charCodeAt(0))),Array.from(f,k=>b.setUint8(w++,k.charCodeAt(0)));var x=new Uint8Array(v.byteLength+n.byteLength);return x.set(new Uint8Array(v),0),x.set(new Uint8Array(n),v.byteLength),x.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[i,a,o,c,u]=n;return r({join_ref:i,ref:a,topic:o,event:c,payload:u})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,i)}}_decodeUserBroadcast(e,r,n){const i=r.getUint8(1),a=r.getUint8(2),o=r.getUint8(3),c=r.getUint8(4);let u=this.HEADER_LENGTH+4;const d=n.decode(e.slice(u,u+i));u=u+i;const p=n.decode(e.slice(u,u+a));u=u+a;const f=n.decode(e.slice(u,u+o));u=u+o;const m=e.slice(u,e.byteLength),v=c===this.JSON_ENCODING?JSON.parse(n.decode(m)):m,b={type:this.BROADCAST_EVENT,event:p,payload:v};return o>0&&(b.meta=JSON.parse(f)),{join_ref:null,ref:null,topic:d,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}var Ot;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Ot||(Ot={}));const fE=(t,e,r={})=>{var n;const i=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((a,o)=>(a[o]=o8(o,t,e,i),a),{}):{}},o8=(t,e,r,n)=>{const i=e.find(c=>c.name===t),a=i==null?void 0:i.type,o=r[t];return a&&!n.includes(a)?JP(a,o):nx(o)},JP=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return u8(e,r)}switch(t){case Ot.bool:return s8(e);case Ot.float4:case Ot.float8:case Ot.int2:case Ot.int4:case Ot.int8:case Ot.numeric:case Ot.oid:return l8(e);case Ot.json:case Ot.jsonb:return c8(e);case Ot.timestamp:return d8(e);case Ot.abstime:case Ot.date:case Ot.daterange:case Ot.int4range:case Ot.int8range:case Ot.money:case Ot.reltime:case Ot.text:case Ot.time:case Ot.timestamptz:case Ot.timetz:case Ot.tsrange:case Ot.tstzrange:return nx(e);default:return nx(e)}},nx=t=>t,s8=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},l8=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},c8=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},u8=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let a;const o=t.slice(1,r);try{a=JSON.parse("["+o+"]")}catch{a=o?o.split(","):[]}return a.map(c=>JP(e,c))}return t},d8=t=>typeof t=="string"?t.replace(" ","T"):t,ZP=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var Rc=t=>typeof t=="function"?t:function(){return t},f8=typeof self<"u"?self:null,js=typeof window<"u"?window:null,vi=f8||js||globalThis,h8="2.0.0",p8=1e4,m8=1e3,bi={connecting:0,open:1,closing:2,closed:3},Xr={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ui={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ix={longpoll:"longpoll",websocket:"websocket"},g8={complete:4},ax="base64url.bearer.phx.",sf=class{constructor(t,e,r,n){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},QP=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},y8=class{constructor(t,e,r){this.state=Xr.closed,this.topic=t,this.params=Rc(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new sf(this,Ui.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new QP(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=Xr.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Xr.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=Xr.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=Xr.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new sf(this,Ui.leave,Rc({}),this.timeout).send(),this.state=Xr.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ui.reply,(n,i)=>{this.trigger(this.replyEventName(i),n)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Xr.closed,this.bindings=[]}onClose(t){this.on(Ui.close,t)}onError(t){return this.on(Ui.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e>"u"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new sf(this,t,function(){return e},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Xr.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ui.close,"leave")},r=new sf(this,Ui.leave,Rc({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,n){return this.topic!==t?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Xr.joining,this.joinPush.resend(t))}trigger(t,e,r,n){let i=this.onMessage(t,e,r,n);if(e&&!i)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let a=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,r));for(let o=0;o<a.length;o++)a[o].callback(i,r,n||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===Xr.closed}isErrored(){return this.state===Xr.errored}isJoined(){return this.state===Xr.joined}isJoining(){return this.state===Xr.joining}isLeaving(){return this.state===Xr.leaving}},Vf=class{static request(t,e,r,n,i,a,o){if(vi.XDomainRequest){let c=new vi.XDomainRequest;return this.xdomainRequest(c,t,e,n,i,a,o)}else if(vi.XMLHttpRequest){let c=new vi.XMLHttpRequest;return this.xhrRequest(c,t,e,r,n,i,a,o)}else{if(vi.fetch&&vi.AbortController)return this.fetchRequest(t,e,r,n,i,a,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,n,i,a,o){let c={method:t,headers:r,body:n},u=null;return i&&(u=new AbortController,setTimeout(()=>u.abort(),i),c.signal=u.signal),vi.fetch(e,c).then(d=>d.text()).then(d=>this.parseJSON(d)).then(d=>o&&o(d)).catch(d=>{d.name==="AbortError"&&a?a():o&&o(null)}),u}static xdomainRequest(t,e,r,n,i,a,o){return t.timeout=i,t.open(e,r),t.onload=()=>{let c=this.parseJSON(t.responseText);o&&o(c)},a&&(t.ontimeout=a),t.onprogress=()=>{},t.send(n),t}static xhrRequest(t,e,r,n,i,a,o,c){t.open(e,r,!0),t.timeout=a;for(let[u,d]of Object.entries(n))t.setRequestHeader(u,d);return t.onerror=()=>c&&c(null),t.onreadystatechange=()=>{if(t.readyState===g8.complete&&c){let u=this.parseJSON(t.responseText);c(u)}},o&&(t.ontimeout=o),t.send(i),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let i=e?`${e}[${n}]`:n,a=t[n];typeof a=="object"?r.push(this.serialize(a,i)):r.push(encodeURIComponent(i)+"="+encodeURIComponent(a))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},v8=t=>{let e="",r=new Uint8Array(t),n=r.byteLength;for(let i=0;i<n;i++)e+=String.fromCharCode(r[i]);return btoa(e)},bs=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(ax)&&(this.authToken=atob(e[1].slice(ax.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=bi.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ix.websocket),"$1/"+ix.longpoll)}endpointURL(){return Vf.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=bi.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===bi.open||this.readyState===bi.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:n,messages:i}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:i.forEach(a=>{setTimeout(()=>this.onmessage({data:a}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=bi.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(t){typeof t!="string"&&(t=v8(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
|
|
411
|
+
`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,r){for(let i of this.reqs)i.abort();this.readyState=bi.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(t,e,r,n,i){let a,o=()=>{this.reqs.delete(a),n()};a=Vf.request(t,this.endpointURL(),e,r,this.timeout,o,c=>{this.reqs.delete(a),this.isActive()&&i(c)}),this.reqs.add(a)}},b8=class Ac{constructor(e,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,i=>{let{onJoin:a,onLeave:o,onSync:c}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Ac.syncState(this.state,i,a,o),this.pendingDiffs.forEach(u=>{this.state=Ac.syncDiff(this.state,u,a,o)}),this.pendingDiffs=[],c()}),this.channel.on(n.diff,i=>{let{onJoin:a,onLeave:o,onSync:c}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=Ac.syncDiff(this.state,i,a,o),c())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Ac.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,n,i){let a=this.clone(e),o={},c={};return this.map(a,(u,d)=>{r[u]||(c[u]=d)}),this.map(r,(u,d)=>{let p=a[u];if(p){let f=d.metas.map(w=>w.phx_ref),m=p.metas.map(w=>w.phx_ref),v=d.metas.filter(w=>m.indexOf(w.phx_ref)<0),b=p.metas.filter(w=>f.indexOf(w.phx_ref)<0);v.length>0&&(o[u]=d,o[u].metas=v),b.length>0&&(c[u]=this.clone(p),c[u].metas=b)}else o[u]=d}),this.syncDiff(a,{joins:o,leaves:c},n,i)}static syncDiff(e,r,n,i){let{joins:a,leaves:o}=this.clone(r);return n||(n=function(){}),i||(i=function(){}),this.map(a,(c,u)=>{let d=e[c];if(e[c]=this.clone(u),d){let p=e[c].metas.map(m=>m.phx_ref),f=d.metas.filter(m=>p.indexOf(m.phx_ref)<0);e[c].metas.unshift(...f)}n(c,d,u)}),this.map(o,(c,u)=>{let d=e[c];if(!d)return;let p=u.metas.map(f=>f.phx_ref);d.metas=d.metas.filter(f=>p.indexOf(f.phx_ref)<0),i(c,d,u),d.metas.length===0&&delete e[c]}),e}static list(e,r){return r||(r=function(n,i){return i}),this.map(e,(n,i)=>r(n,i))}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static clone(e){return JSON.parse(JSON.stringify(e))}},lf={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,n,i,a,o]=JSON.parse(t);return e({join_ref:r,ref:n,topic:i,event:a,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:n,topic:i,payload:a}=t,o=this.META_LENGTH+e.length+r.length+i.length+n.length,c=new ArrayBuffer(this.HEADER_LENGTH+o),u=new DataView(c),d=0;u.setUint8(d++,this.KINDS.push),u.setUint8(d++,e.length),u.setUint8(d++,r.length),u.setUint8(d++,i.length),u.setUint8(d++,n.length),Array.from(e,f=>u.setUint8(d++,f.charCodeAt(0))),Array.from(r,f=>u.setUint8(d++,f.charCodeAt(0))),Array.from(i,f=>u.setUint8(d++,f.charCodeAt(0))),Array.from(n,f=>u.setUint8(d++,f.charCodeAt(0)));var p=new Uint8Array(c.byteLength+a.byteLength);return p.set(new Uint8Array(c),0),p.set(new Uint8Array(a),c.byteLength),p.buffer},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,n);case this.KINDS.reply:return this.decodeReply(t,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,n)}},decodePush(t,e,r){let n=e.getUint8(1),i=e.getUint8(2),a=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,c=r.decode(t.slice(o,o+n));o=o+n;let u=r.decode(t.slice(o,o+i));o=o+i;let d=r.decode(t.slice(o,o+a));o=o+a;let p=t.slice(o,t.byteLength);return{join_ref:c,ref:null,topic:u,event:d,payload:p}},decodeReply(t,e,r){let n=e.getUint8(1),i=e.getUint8(2),a=e.getUint8(3),o=e.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,u=r.decode(t.slice(c,c+n));c=c+n;let d=r.decode(t.slice(c,c+i));c=c+i;let p=r.decode(t.slice(c,c+a));c=c+a;let f=r.decode(t.slice(c,c+o));c=c+o;let m=t.slice(c,t.byteLength),v={status:f,response:m};return{join_ref:u,ref:d,topic:p,event:Ui.reply,payload:v}},decodeBroadcast(t,e,r){let n=e.getUint8(1),i=e.getUint8(2),a=this.HEADER_LENGTH+2,o=r.decode(t.slice(a,a+n));a=a+n;let c=r.decode(t.slice(a,a+i));a=a+i;let u=t.slice(a,t.byteLength);return{join_ref:null,ref:null,topic:o,event:c,payload:u}}},x8=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||p8,this.transport=e.transport||vi.WebSocket||bs,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=vi&&vi.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=lf.encode.bind(lf),this.defaultDecoder=lf.decode.bind(lf),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==bs?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;js&&js.addEventListener&&(js.addEventListener("pagehide",i=>{this.conn&&(this.disconnect(),n=this.connectClock)}),js.addEventListener("pageshow",i=>{n===this.connectClock&&(n=null,this.connect())}),js.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=i=>e.rejoinAfterMs?e.rejoinAfterMs(i):[1e3,2e3,5e3][i-1]||1e4,this.reconnectAfterMs=i=>e.reconnectAfterMs?e.reconnectAfterMs(i):[10,50,100,150,200,250,500,1e3,2e3][i-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(i,a,o)=>{console.log(`${i}: ${a}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=Rc(e.params||{}),this.endPoint=`${t}/${ix.websocket}`,this.vsn=e.vsn||h8,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new QP(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return bs}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Vf.appendParams(Vf.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Rc(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==bs?this.connectWithFallback(bs,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(i=>{i.ref===e&&(this.off([n]),t(Date.now()-r))});return!0}transportName(t){switch(t){case bs:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${ax}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,i,a,o=this.transportName(t),c=u=>{this.log("transport",`falling back to ${o}...`,u),this.off([i,a]),n=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return c("memorized");this.fallbackTimer=setTimeout(c,e),a=this.onError(u=>{this.log("transport","error",u),n&&!r&&(clearTimeout(this.fallbackTimer),c(u))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let u=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${u}`,"true"),this.log("transport",`established ${u} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(c,e),this.ping(u=>{this.log("transport","connected to primary after",u),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),m8,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const n=this.conn;this.waitForBufferDone(n,()=>{e?n.close(e,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===bi.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Ui.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case bi.connecting:return"connecting";case bi.open:return"open";case bi.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new y8(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:n,ref:i,join_ref:a}=t;this.log("push",`${e} ${r} (${a}, ${i})`,n)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:n,payload:i,ref:a,join_ref:o}=e;if(a&&a===this.pendingHeartbeatRef){const c=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(i.status==="ok"?"ok":"error",c)}catch(u){this.log("error","error in heartbeat callback",u)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${r} ${n} ${a&&"("+a+")"||""}`.trim(),i);for(let c=0;c<this.channels.length;c++){const u=this.channels[c];u.isMember(r,n,i,o)&&u.trigger(n,i,a,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,n])=>{try{n(...e)}catch(i){this.log("error",`error in ${t} callback`,i)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class Ic{constructor(e,r){const n=_8(r);this.presence=new b8(e.getChannel(),n),this.presence.onJoin((i,a,o)=>{const c=Ic.onJoinPayload(i,a,o);e.getChannel().trigger("presence",c)}),this.presence.onLeave((i,a,o)=>{const c=Ic.onLeavePayload(i,a,o);e.getChannel().trigger("presence",c)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Ic.transformState(this.presence.state)}static transformState(e){return e=w8(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const i=e[n];return r[n]=If(i),r},{})}static onJoinPayload(e,r,n){const i=hE(r),a=If(n);return{event:"join",key:e,currentPresences:i,newPresences:a}}static onLeavePayload(e,r,n){const i=hE(r),a=If(n);return{event:"leave",key:e,currentPresences:i,leftPresences:a}}}function If(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function w8(t){return JSON.parse(JSON.stringify(t))}function _8(t){return(t==null?void 0:t.events)&&{events:t.events}}function hE(t){return t!=null&&t.metas?If(t):[]}var pE;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(pE||(pE={}));class S8{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Ic(this.channel.channelAdapter,r)}}function k8(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;if(typeof e.code=="number"){const r=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${r}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class E8{constructor(e,r,n){const i=A8(n);this.channel=e.getSocket().channel(r,i),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,n){let i;try{i=this.channel.push(e,r,n)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>i8){const a=this.channel.pushBuffer.shift();a.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${a.event}`,a.payload())}return i}updateJoinPayload(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}canPush(){return this.socket.isConnected()&&this.state===Na.joined}isJoined(){return this.state===Na.joined}isJoining(){return this.state===Na.joining}isClosed(){return this.state===Na.closed}isLeaving(){return this.state===Na.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function A8(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var mE;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(mE||(mE={}));var Ps;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Ps||(Ps={}));var qi;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(qi||(qi={}));class $c{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},n){var i,a;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new E8(this.socket.socketAdapter,e,this.params),this.presence=new S8(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=ZP(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((a=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||a===void 0)&&a.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,r=this.timeout){var n,i,a;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:c,private:u}}=this.params,d=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(v=>v.filter))!==null&&i!==void 0?i:[],p=!!this.bindings[Ps.PRESENCE]&&this.bindings[Ps.PRESENCE].length>0||((a=this.params.config.presence)===null||a===void 0?void 0:a.enabled)===!0,f={},m={broadcast:o,presence:Object.assign(Object.assign({},c),{enabled:p}),postgres_changes:d,private:u};this.socket.accessTokenValue&&(f.access_token=this.socket.accessTokenValue),this._onError(v=>{e==null||e(qi.CHANNEL_ERROR,k8(v))}),this._onClose(()=>e==null?void 0:e(qi.CLOSED)),this.updateJoinPayload(Object.assign({config:m},f)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:v})=>{if(this.socket._isManualToken()||this.socket.setAuth(),v===void 0){e==null||e(qi.SUBSCRIBED);return}this._updatePostgresBindings(v,e)}).receive("error",v=>{this.state=Na.errored;const b=Object.values(v).join(", ")||"error";e==null||e(qi.CHANNEL_ERROR,new Error(b,{cause:v}))}).receive("timeout",()=>{e==null||e(qi.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var n;const i=this.bindings.postgres_changes,a=(n=i==null?void 0:i.length)!==null&&n!==void 0?n:0,o=[];for(let c=0;c<a;c++){const u=i[c],{filter:{event:d,schema:p,table:f,filter:m}}=u,v=e&&e[c];if(v&&v.event===d&&$c.isFilterValueEqual(v.schema,p)&&$c.isFilterValueEqual(v.table,f)&&$c.isFilterValueEqual(v.filter,m))o.push(Object.assign(Object.assign({},u),{id:v.id}));else{this.unsubscribe(),this.state=Na.errored,r==null||r(qi.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=Na.errored&&r&&r(qi.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){const i=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),a=e===Ps.PRESENCE||e===Ps.POSTGRES_CHANGES;if(i&&a)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,n)}async httpSend(e,r,n={}){var i;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const a=r instanceof ArrayBuffer||ArrayBuffer.isView(r),o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":a?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c=new URL(this.broadcastEndpointURL);c.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(e)}`,this.private&&c.searchParams.set("private","true");const u={method:"POST",headers:o,body:a?r:JSON.stringify(r)},d=await this._fetchWithTimeout(c.toString(),u,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);if(d.status===202)return{success:!0};let p=d.statusText;try{const f=await d.json();p=f.error||f.message||p}catch{}return Promise.reject(new Error(p))}async send(e,r={}){var n,i;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:a,payload:o}=e,c={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(c.Authorization=`Bearer ${this.socket.accessTokenValue}`);const u={method:"POST",headers:c,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:o,private:this.private}]})};try{const d=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=d.body)===null||i===void 0?void 0:i.cancel()),d.ok?"ok":"error"}catch(d){return d instanceof Error&&d.name==="AbortError"?"timed out":"error"}}else return new Promise(a=>{var o,c,u;const d=this.channelAdapter.push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(c=(o=this.params)===null||o===void 0?void 0:o.config)===null||c===void 0?void 0:c.broadcast)===null||u===void 0)&&u.ack)&&a("ok"),d.receive("ok",()=>a("ok")),d.receive("error",()=>a("error")),d.receive("timeout",()=>a("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,r,n){const i=new AbortController,a=setTimeout(()=>i.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(a),o}_on(e,r,n){const i=e.toLocaleLowerCase(),a=this.channelAdapter.on(e,n),o={type:i,filter:r,callback:n,ref:a};return this.bindings[i]?this.bindings[i].push(o):this.bindings[i]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,n)=>{var i,a,o,c,u,d,p;const f=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(f,n))return!1;const m=(i=this.bindings[f])===null||i===void 0?void 0:i.find(v=>v.ref===e.ref);if(!m)return!0;if(["broadcast","presence","postgres_changes"].includes(f))if("id"in m){const v=m.id,b=(a=m.filter)===null||a===void 0?void 0:a.event;return v&&((o=r.ids)===null||o===void 0?void 0:o.includes(v))&&(b==="*"||(b==null?void 0:b.toLocaleLowerCase())===((c=r.data)===null||c===void 0?void 0:c.type.toLocaleLowerCase()))}else{const v=(d=(u=m==null?void 0:m.filter)===null||u===void 0?void 0:u.event)===null||d===void 0?void 0:d.toLocaleLowerCase();return v==="*"||v===((p=r==null?void 0:r.event)===null||p===void 0?void 0:p.toLocaleLowerCase())}else return m.type.toLocaleLowerCase()===f})}_notThisChannelEvent(e,r){const{close:n,error:i,leave:a,join:o}=YP;return r&&[n,i,a,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,n)=>{if(typeof r=="object"&&"ids"in r){const i=r.data,{schema:a,table:o,commit_timestamp:c,type:u,errors:d}=i;return Object.assign(Object.assign({},{schema:a,table:o,commit_timestamp:c,eventType:u,new:{},old:{},errors:d}),this._getPayloadRecords(i))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const n of e.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=fE(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=fE(e.columns,e.old_record)),r}}class O8{constructor(e,r){this.socket=new x8(e,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,n,i=1e4){return new Promise(a=>{setTimeout(()=>a("timeout"),i),this.socket.disconnect(()=>{e(),a("ok")},r,n)})}push(e){this.socket.push(e)}log(e,r,n){this.socket.log(e,r,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==rx.connecting}isDisconnecting(){return this.socket.connectionState()==rx.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const gE={HEARTBEAT_INTERVAL:25e3},T8=[1e3,2e3,5e3,1e4],C8=1e4;function j8(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var r;return(r=Array.from(t.keys())[e])!==null&&r!==void 0?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function N8(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return j8()}const P8=`
|
|
412
412
|
addEventListener("message", (e) => {
|
|
413
413
|
if (e.data.event === "start") {
|
|
414
414
|
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
415
415
|
}
|
|
416
|
-
});`;class
|
|
416
|
+
});`;class R8{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,r){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new a8,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=a=>a?(...o)=>a(...o):(...o)=>fetch(...o),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const i=this._initializeOptions(r);this.socketAdapter=new O8(e,i),this.httpEndpoint=ZP(e),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const r=e.message;throw r.includes("Node.js")?new Error(`${r}
|
|
417
417
|
|
|
418
418
|
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
419
419
|
|
|
@@ -426,8 +426,8 @@ Option 2: Install and provide the "ws" package:
|
|
|
426
426
|
const client = new RealtimeClient(url, {
|
|
427
427
|
...options,
|
|
428
428
|
transport: ws
|
|
429
|
-
})`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return r==="ok"&&e.teardown(),r}async removeAllChannels(){const e=this.channels.map(async n=>{const i=await n.unsubscribe();return n.teardown(),i}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,n){this.socketAdapter.log(e,r,n)}connectionState(){return this.socketAdapter.connectionState()||rx.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const n=`realtime:${e}`,i=this.getChannels().find(a=>a.topic===n);if(i)return i;{const a=new $c(`realtime:${e}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(a),a}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(i=>{const a={access_token:r,version:t8};r&&i.updateJoinPayload(a),i.joinedOnce&&i.channelAdapter.isJoined()&&i.channelAdapter.push(YP.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,n)=>{r=="sent"&&this._setAuthSafely(),e&&e(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([R8],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(e){var r,n,i,a,o,c,u,d,p,f,m,v;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=e==null?void 0:e.accessToken)!==null&&n!==void 0?n:null;const b={};b.timeout=(i=e==null?void 0:e.timeout)!==null&&i!==void 0?i:i8,b.heartbeatIntervalMs=(a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:gE.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((c=e==null?void 0:e.heartbeatIntervalMs)!==null&&c!==void 0?c:gE.HEARTBEAT_INTERVAL),b.transport=(u=e==null?void 0:e.transport)!==null&&u!==void 0?u:QB.getWebSocketConstructor(),b.params=e==null?void 0:e.params,b.logger=e==null?void 0:e.logger,b.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),b.sessionStorage=(d=e==null?void 0:e.sessionStorage)!==null&&d!==void 0?d:P8(),b.reconnectAfterMs=(p=e==null?void 0:e.reconnectAfterMs)!==null&&p!==void 0?p:(S=>C8[S-1]||j8);let w,x;const k=(f=e==null?void 0:e.vsn)!==null&&f!==void 0?f:n8;switch(k){case r8:w=(S,A)=>A(JSON.stringify(S)),x=(S,A)=>A(JSON.parse(S));break;case XP:w=this.serializer.encode.bind(this.serializer),x=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${b.vsn}`)}if(b.vsn=k,b.encode=(m=e==null?void 0:e.encode)!==null&&m!==void 0?m:w,b.decode=(v=e==null?void 0:e.decode)!==null&&v!==void 0?v:x,b.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,b.params=Object.assign(Object.assign({},b.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,b.autoSendHeartbeat=!this.worker}return b}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Hc=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function $8(t,e,r){const n=new URL(e,t);if(r)for(const[i,a]of Object.entries(r))a!==void 0&&n.searchParams.set(i,a);return n.toString()}async function M8(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function D8(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:i,body:a,headers:o}){const c=$8(t.baseUrl,n,i),u=await M8(t.auth),d=await e(c,{method:r,headers:{...a?{"Content-Type":"application/json"}:{},...u,...o},body:a?JSON.stringify(a):void 0}),p=await d.text(),f=(d.headers.get("content-type")||"").includes("application/json"),m=f&&p?JSON.parse(p):p;if(!d.ok){const v=f?m:void 0,b=v==null?void 0:v.error;throw new Hc((b==null?void 0:b.message)??`Request failed with status ${d.status}`,{status:d.status,icebergType:b==null?void 0:b.type,icebergCode:b==null?void 0:b.code,details:v})}return{status:d.status,headers:d.headers,data:m}}}}function cf(t){return t.join("")}var L8=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:cf(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${cf(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${cf(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${cf(t.namespace)}`}),!0}catch(e){if(e instanceof Hc&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof Hc&&r.status===409)return;throw r}}};function xs(t){return t.join("")}var z8=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof Hc&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof Hc&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},B8=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=D8({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new L8(this.client,e),this.tableOps=new z8(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function Wc(t){"@babel/helpers - typeof";return Wc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wc(t)}function U8(t,e){if(Wc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Wc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function q8(t){var e=U8(t,"string");return Wc(e)=="symbol"?e:e+""}function F8(t,e,r){return(e=q8(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yE(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 Be(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yE(Object(r),!0).forEach(function(n){F8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var fp=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function hp(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var ox=class extends fp{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return Be({},super.toJSON())}},eR=class extends fp{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Xf(t,e,r){const n=Be({},t),i=e.toLowerCase();for(const a of Object.keys(n))a.toLowerCase()===i&&delete n[a];return n[i]=r,n}function H8(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const W8=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),K8=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},sx=t=>{if(Array.isArray(t))return t.map(r=>sx(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const i=r.replace(/([-_][a-z])/gi,a=>a.toUpperCase().replace(/[-_]/g,""));e[i]=sx(n)}),e},G8=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),vE=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const r=e.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(t)},V8=async(t,e,r,n)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const i=t;let a=parseInt(String(i.status),10);Number.isFinite(a)||(a=500),i.json().then(o=>{const c=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||a+"";e(new ox(vE(o),a,c,n))}).catch(()=>{const o=a+"";e(new ox(i.statusText||`HTTP ${a} error`,a,o,n))})}else e(new eR(vE(t),t,n))},X8=(t,e,r,n)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return Be(Be({},i),r);if(K8(n)){var a;const o=(e==null?void 0:e.headers)||{};let c;for(const[u,d]of Object.entries(o))u.toLowerCase()==="content-type"&&(c=d);i.headers=Xf(o,"Content-Type",(a=c)!==null&&a!==void 0?a:"application/json"),i.body=JSON.stringify(n)}else i.body=n;return e!=null&&e.duplex&&(i.duplex=e.duplex),Be(Be({},i),r)};async function hc(t,e,r,n,i,a,o){return new Promise((c,u)=>{t(r,X8(e,n,i,a)).then(d=>{if(!d.ok)throw d;if(n!=null&&n.noResolveJson)return d;if(o==="vectors"){const p=d.headers.get("content-type");if(d.headers.get("content-length")==="0"||d.status===204)return{};if(!p||!p.includes("application/json"))return{}}return d.json()}).then(d=>c(d)).catch(d=>V8(d,u,n,o))})}function tR(t="storage"){return{get:async(e,r,n,i)=>hc(e,"GET",r,n,i,void 0,t),post:async(e,r,n,i,a)=>hc(e,"POST",r,i,a,n,t),put:async(e,r,n,i,a)=>hc(e,"PUT",r,i,a,n,t),head:async(e,r,n,i)=>hc(e,"HEAD",r,Be(Be({},n),{},{noResolveJson:!0}),i,void 0,t),remove:async(e,r,n,i,a)=>hc(e,"DELETE",r,i,a,n,t)}}const Y8=tR("storage"),{get:Kc,post:Fn,put:lx,head:J8,remove:o1}=Y8,cn=tR("vectors");var bl=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=H8(e),this.fetch=W8(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Xf(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(hp(r))return{data:null,error:r};throw r}}};let rR;rR=Symbol.toStringTag;var Z8=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[rR]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(hp(e))return{data:null,error:e};throw e}}};let nR;nR=Symbol.toStringTag;var Q8=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[nR]="BlobDownloadBuilder",this.promise=null}asStream(){return new Z8(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(hp(e))return{data:null,error:e};throw e}}};const e6={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},bE={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var t6=class extends bl{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var i=this;return i.handleOperation(async()=>{let a;const o=Be(Be({},bE),n);let c=Be(Be({},i.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const u=o.metadata;if(typeof Blob<"u"&&r instanceof Blob?(a=new FormData,a.append("cacheControl",o.cacheControl),u&&a.append("metadata",i.encodeMetadata(u)),a.append("",r)):typeof FormData<"u"&&r instanceof FormData?(a=r,a.has("cacheControl")||a.append("cacheControl",o.cacheControl),u&&!a.has("metadata")&&a.append("metadata",i.encodeMetadata(u))):(a=r,c["cache-control"]=`max-age=${o.cacheControl}`,c["content-type"]=o.contentType,u&&(c["x-metadata"]=i.toBase64(i.encodeMetadata(u))),(typeof ReadableStream<"u"&&a instanceof ReadableStream||a&&typeof a=="object"&&"pipe"in a&&typeof a.pipe=="function")&&!o.duplex&&(o.duplex="half")),n!=null&&n.headers)for(const[m,v]of Object.entries(n.headers))c=Xf(c,m,v);const d=i._removeEmptyFolders(e),p=i._getFinalPath(d),f=await(t=="PUT"?lx:Fn)(i.fetch,`${i.url}/object/${p}`,a,Be({headers:c},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:d,id:f.Id,fullPath:f.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var i=this;const a=i._removeEmptyFolders(t),o=i._getFinalPath(a),c=new URL(i.url+`/object/upload/sign/${o}`);return c.searchParams.set("token",e),i.handleOperation(async()=>{let u;const d=Be(Be({},bE),n);let p=Be(Be({},i.headers),{"x-upsert":String(d.upsert)});const f=d.metadata;if(typeof Blob<"u"&&r instanceof Blob?(u=new FormData,u.append("cacheControl",d.cacheControl),f&&u.append("metadata",i.encodeMetadata(f)),u.append("",r)):typeof FormData<"u"&&r instanceof FormData?(u=r,u.has("cacheControl")||u.append("cacheControl",d.cacheControl),f&&!u.has("metadata")&&u.append("metadata",i.encodeMetadata(f))):(u=r,p["cache-control"]=`max-age=${d.cacheControl}`,p["content-type"]=d.contentType,f&&(p["x-metadata"]=i.toBase64(i.encodeMetadata(f))),(typeof ReadableStream<"u"&&u instanceof ReadableStream||u&&typeof u=="object"&&"pipe"in u&&typeof u.pipe=="function")&&!d.duplex&&(d.duplex="half")),n!=null&&n.headers)for(const[m,v]of Object.entries(n.headers))p=Xf(p,m,v);return{path:a,fullPath:(await lx(i.fetch,c.toString(),u,Be({headers:p},d!=null&&d.duplex?{duplex:d.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const i=Be({},r.headers);e!=null&&e.upsert&&(i["x-upsert"]="true");const a=await Fn(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(r.url+a.url),c=o.searchParams.get("token");if(!c)throw new fp("No token returned by API");return{signedUrl:o.toString(),path:t,token:c}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await Fn(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await Fn(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let i=n._getFinalPath(t);const a=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await Fn(n.fetch,`${n.url}/object/sign/${i}`,Be({expiresIn:e},a?{transform:r.transform}:{}),{headers:n.headers});const c=new URLSearchParams;r!=null&&r.download&&c.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&c.set("cacheNonce",String(r.cacheNonce));const u=c.toString();return{signedUrl:encodeURI(`${n.url}${o.signedURL}${u?`&${u}`:""}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const i=await Fn(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),a=new URLSearchParams;r!=null&&r.download&&a.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));const o=a.toString();return i.map(c=>Be(Be({},c),{},{signedUrl:c.signedURL?encodeURI(`${n.url}${c.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,r){const n=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",i=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(i,e.transform),(e==null?void 0:e.cacheNonce)!=null&&i.set("cacheNonce",String(e.cacheNonce));const a=i.toString(),o=this._getFinalPath(t),c=()=>Kc(this.fetch,`${this.url}/${n}/${o}${a?`?${a}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Q8(c,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>sx(await Kc(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await J8(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(hp(i)){var n;const a=i instanceof ox?i.status:i instanceof eR?(n=i.originalError)===null||n===void 0?void 0:n.status:void 0;if(a!==void 0&&[400,404].includes(a))return{data:!1,error:i}}throw i}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=new URLSearchParams;e!=null&&e.download&&n.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const i=n.toString(),a=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${r}`)+(i?`?${i}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await o1(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const i=Be(Be(Be({},e6),e),{},{prefix:t||""});return await Fn(n.fetch,`${n.url}/object/list/${n.bucketId}`,i,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=Be({},t);return await Fn(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const r6="2.107.0",Mu={"X-Client-Info":`storage-js/${r6}`};var n6=class extends bl{constructor(t,e={},r,n){const i=new URL(t);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase."));const a=i.href.replace(/\/$/,""),o=Be(Be({},Mu),e);super(a,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Kc(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Kc(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await Fn(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await lx(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Fn(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await o1(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},i6=class extends bl{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=Be(Be({},Mu),e);super(n,i,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Fn(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),i=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Kc(e.fetch,i,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await o1(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!G8(t))throw new fp("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new B8({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(i,a){const o=i[a];return typeof o!="function"?o:async(...c)=>{try{return{data:await o.apply(i,c),error:null}}catch(u){if(n)throw u;return{data:null,error:u}}}}})}},a6=class extends bl{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=Be(Be({},Mu),{},{"Content-Type":"application/json"},e);super(n,i,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await cn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await cn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},o6=class extends bl{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=Be(Be({},Mu),{},{"Content-Type":"application/json"},e);super(n,i,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},s6=class extends bl{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=Be(Be({},Mu),{},{"Content-Type":"application/json"},e);super(n,i,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},l6=class extends s6{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new c6(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},c6=class extends a6{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new u6(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},u6=class extends o6{constructor(t,e,r,n,i){super(t,e,i),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},d6=class extends n6{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new t6(this.url,this.headers,t,this.fetch)}get vectors(){return new l6(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new i6(this.url+"/iceberg",this.headers,this.fetch)}};const iR="2.107.0",Ca=30*1e3,Oc=3,Dg=Oc*Ca,f6="http://localhost:9999",h6="supabase.auth.token",p6={"X-Client-Info":`gotrue-js/${iR}`},cx="X-Supabase-Api-Version",aR={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},m6=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,g6=600*1e3;class Gc extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function be(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class y6 extends Gc{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function v6(t){return be(t)&&t.name==="AuthApiError"}class Xn extends Gc{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class Ei extends Gc{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}}class mr extends Ei{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function uf(t){return be(t)&&t.name==="AuthSessionMissingError"}class ws extends Ei{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class df extends Ei{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class ff extends Ei{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function b6(t){return be(t)&&t.name==="AuthImplicitGrantRedirectError"}class xE extends Ei{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class x6 extends Ei{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class ux extends Ei{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Lg(t){return be(t)&&t.name==="AuthRetryableFetchError"}class wE extends Ei{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}function w6(t){return be(t)&&t.name==="AuthRefreshDiscardedError"}class _E extends Ei{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Yf extends Ei{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Jf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),SE=`
|
|
430
|
-
\r=`.split(""),_6=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<SE.length;e+=1)t[SE[e].charCodeAt(0)]=-2;for(let e=0;e<Jf.length;e+=1)t[Jf[e].charCodeAt(0)]=e;return t})();function kE(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Jf[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Jf[n]),e.queuedBits-=6}}function oR(t,e,r){const n=_6[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function EE(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},a=o=>{E6(o,n,r)};for(let o=0;o<t.length;o+=1)oR(t.charCodeAt(o),i,a);return e.join("")}function S6(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function k6(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const i=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|i)+65536,r+=1}S6(n,e)}}function E6(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function Ds(t){const e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)oR(t.charCodeAt(i),r,n);return new Uint8Array(e)}function A6(t){const e=[];return k6(t,r=>e.push(r)),new Uint8Array(e)}function ko(t){const e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};return t.forEach(i=>kE(i,r,n)),kE(null,r,n),e.join("")}function O6(t){return Math.round(Date.now()/1e3)+t}function T6(){return Symbol("auth-callback")}const Tr=()=>typeof window<"u"&&typeof document<"u",yo={tested:!1,writable:!1},sR=()=>{if(!Tr())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(yo.tested)return yo.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),yo.tested=!0,yo.writable=!0}catch{yo.tested=!0,yo.writable=!1}return yo.writable};function C6(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((i,a)=>{e[a]=i})}catch{}return r.searchParams.forEach((n,i)=>{e[i]=n}),e}const lR=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),j6=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Ns=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Di=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},nr=async(t,e)=>{await t.removeItem(e)};class pp{constructor(){this.promise=new pp.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}pp.promiseConstructor=Promise;function hf(t){const e=t.split(".");if(e.length!==3)throw new Yf("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!m6.test(e[n]))throw new Yf("JWT not in base64url format");return{header:JSON.parse(EE(e[0])),payload:JSON.parse(EE(e[1])),signature:Ds(e[2]),raw:{header:e[0],payload:e[1]}}}async function N6(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function P6(t,e){return new Promise((n,i)=>{(async()=>{for(let a=0;a<1/0;a++)try{const o=await t(a);if(!e(a,null,o)){n(o);return}}catch(o){if(!e(a,o)){i(o);return}}})()})}function R6(t){return("0"+t.toString(16)).substr(-2)}function I6(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let i="";for(let a=0;a<56;a++)i+=r.charAt(Math.floor(Math.random()*n));return i}return crypto.getRandomValues(e),Array.from(e,R6).join("")}async function $6(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),i=new Uint8Array(n);return Array.from(i).map(a=>String.fromCharCode(a)).join("")}async function M6(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await $6(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function _s(t,e,r=!1){const n=I6();let i=n;r&&(i+="/recovery"),await Ns(t,`${e}-code-verifier`,i);const a=await M6(n);return[a,n===a?"plain":"s256"]}const D6=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function L6(t){const e=t.headers.get(cx);if(!e||!e.match(D6))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function z6(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function B6(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const U6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Li(t){if(!U6.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function qn(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function zg(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function q6(t,e){return new Proxy(t,{get:(r,n,i)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const a=n.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="Symbol(util.inspect.custom)"||a==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,i)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,i)}})}function AE(t){return JSON.parse(JSON.stringify(t))}const xo=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},F6=[502,503,504,520,521,522,523,524,530];async function OE(t){var e;if(!j6(t))throw new ux(xo(t),0);if(F6.includes(t.status))throw new ux(xo(t),t.status);let r;try{r=await t.json()}catch(a){throw new Xn(xo(a),a)}let n;const i=L6(t);if(i&&i.getTime()>=aR["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new _E(xo(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new mr}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((a,o)=>a&&typeof o=="string",!0))throw new _E(xo(r),t.status,r.weak_password.reasons);throw new y6(xo(r),t.status||500,n)}const H6=(t,e,r,n)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),r))};async function Ne(t,e,r,n){var i;const a=Object.assign({},n==null?void 0:n.headers);a[cx]||(a[cx]=aR["2024-01-01"].name),n!=null&&n.jwt&&(a.Authorization=`Bearer ${n.jwt}`);const o=(i=n==null?void 0:n.query)!==null&&i!==void 0?i:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const c=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",u=await W6(t,e,r+c,{headers:a,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(u):{data:Object.assign({},u),error:null}}async function W6(t,e,r,n,i,a){const o=H6(e,n,i,a);let c;try{c=await t(r,Object.assign({},o))}catch(u){throw console.error(u),new ux(xo(u),0)}if(c.ok||await OE(c),n!=null&&n.noResolveJson)return c;try{return await c.json()}catch(u){await OE(u)}}function En(t){var e;let r=null;V6(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=O6(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:n},error:null}}function TE(t){const e=En(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Pa(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function K6(t){return{data:t,error:null}}function G6(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:a}=t,o=dp(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:a},u=Object.assign({},o);return{data:{properties:c,user:u},error:null}}function CE(t){return t}function V6(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Bg=["global","local","others"];class X6{constructor({url:e="",headers:r={},fetch:n,experimental:i}){this.url=e,this.headers=r,this.fetch=lR(n),this.experimental=i??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,r=Bg[0]){if(Bg.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Bg.join(", ")}`);try{return await Ne(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(be(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await Ne(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Pa})}catch(n){if(be(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=dp(e,["options"]),i=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(i.new_email=n==null?void 0:n.newEmail,delete i.newEmail),await Ne(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:G6,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(be(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await Ne(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Pa})}catch(r){if(be(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,i,a,o,c,u;try{const d={nextPage:null,lastPage:0,total:0},p=await Ne(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(a=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""},xform:CE});if(p.error)throw p.error;const f=await p.json(),m=(o=p.headers.get("x-total-count"))!==null&&o!==void 0?o:0,v=(u=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(b=>{const w=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(b.split(";")[1].split("=")[1]);d[`${x}Page`]=w}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(be(d))return{data:{users:[]},error:d};throw d}}async getUserById(e){Li(e);try{return await Ne(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Pa})}catch(r){if(be(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Li(e);try{return await Ne(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Pa})}catch(n){if(be(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Li(e);try{return await Ne(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Pa})}catch(n){if(be(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Li(e.userId);try{const{data:r,error:n}=await Ne(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:r,error:n}}catch(r){if(be(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Li(e.userId),Li(e.id);try{return{data:await Ne(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(be(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,i,a,o,c,u;try{const d={nextPage:null,lastPage:0,total:0},p=await Ne(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(a=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""},xform:CE});if(p.error)throw p.error;const f=await p.json(),m=(o=p.headers.get("x-total-count"))!==null&&o!==void 0?o:0,v=(u=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(b=>{const w=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(b.split(";")[1].split("=")[1]);d[`${x}Page`]=w}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(be(d))return{data:{clients:[]},error:d};throw d}}async _createOAuthClient(e){try{return await Ne(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await Ne(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await Ne(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(be(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await Ne(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(be(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await Ne(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await Ne(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var i;return{data:{providers:(i=n==null?void 0:n.providers)!==null&&i!==void 0?i:[]},error:null}}})}catch(r){if(be(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await Ne(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{return await Ne(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{return await Ne(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(be(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{return await Ne(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(be(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){qn(this.experimental),Li(e.userId);try{return await Ne(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){qn(this.experimental),Li(e.userId),Li(e.passkeyId);try{return await Ne(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(be(r))return{data:null,error:r};throw r}}}function jE(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}globalThis&&sR()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class Y6 extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}function J6(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function cR(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Z6(t){return parseInt(t,16)}function Q6(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function eU(t){var e;const{chainId:r,domain:n,expirationTime:i,issuedAt:a=new Date,nonce:o,notBefore:c,requestId:u,resources:d,scheme:p,uri:f,version:m}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!f)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(m!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
|
|
429
|
+
})`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return r==="ok"&&e.teardown(),r}async removeAllChannels(){const e=this.channels.map(async n=>{const i=await n.unsubscribe();return n.teardown(),i}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,n){this.socketAdapter.log(e,r,n)}connectionState(){return this.socketAdapter.connectionState()||rx.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const n=`realtime:${e}`,i=this.getChannels().find(a=>a.topic===n);if(i)return i;{const a=new $c(`realtime:${e}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(a),a}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(i=>{const a={access_token:r,version:e8};r&&i.updateJoinPayload(a),i.joinedOnce&&i.channelAdapter.isJoined()&&i.channelAdapter.push(YP.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,n)=>{r=="sent"&&this._setAuthSafely(),e&&e(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([P8],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(e){var r,n,i,a,o,c,u,d,p,f,m,v;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=e==null?void 0:e.accessToken)!==null&&n!==void 0?n:null;const b={};b.timeout=(i=e==null?void 0:e.timeout)!==null&&i!==void 0?i:n8,b.heartbeatIntervalMs=(a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:gE.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((c=e==null?void 0:e.heartbeatIntervalMs)!==null&&c!==void 0?c:gE.HEARTBEAT_INTERVAL),b.transport=(u=e==null?void 0:e.transport)!==null&&u!==void 0?u:ZB.getWebSocketConstructor(),b.params=e==null?void 0:e.params,b.logger=e==null?void 0:e.logger,b.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),b.sessionStorage=(d=e==null?void 0:e.sessionStorage)!==null&&d!==void 0?d:N8(),b.reconnectAfterMs=(p=e==null?void 0:e.reconnectAfterMs)!==null&&p!==void 0?p:(S=>T8[S-1]||C8);let w,x;const k=(f=e==null?void 0:e.vsn)!==null&&f!==void 0?f:r8;switch(k){case t8:w=(S,A)=>A(JSON.stringify(S)),x=(S,A)=>A(JSON.parse(S));break;case XP:w=this.serializer.encode.bind(this.serializer),x=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${b.vsn}`)}if(b.vsn=k,b.encode=(m=e==null?void 0:e.encode)!==null&&m!==void 0?m:w,b.decode=(v=e==null?void 0:e.decode)!==null&&v!==void 0?v:x,b.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,b.params=Object.assign(Object.assign({},b.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,b.autoSendHeartbeat=!this.worker}return b}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Hc=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function I8(t,e,r){const n=new URL(e,t);if(r)for(const[i,a]of Object.entries(r))a!==void 0&&n.searchParams.set(i,a);return n.toString()}async function $8(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function M8(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:i,body:a,headers:o}){const c=I8(t.baseUrl,n,i),u=await $8(t.auth),d=await e(c,{method:r,headers:{...a?{"Content-Type":"application/json"}:{},...u,...o},body:a?JSON.stringify(a):void 0}),p=await d.text(),f=(d.headers.get("content-type")||"").includes("application/json"),m=f&&p?JSON.parse(p):p;if(!d.ok){const v=f?m:void 0,b=v==null?void 0:v.error;throw new Hc((b==null?void 0:b.message)??`Request failed with status ${d.status}`,{status:d.status,icebergType:b==null?void 0:b.type,icebergCode:b==null?void 0:b.code,details:v})}return{status:d.status,headers:d.headers,data:m}}}}function cf(t){return t.join("")}var D8=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:cf(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${cf(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${cf(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${cf(t.namespace)}`}),!0}catch(e){if(e instanceof Hc&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof Hc&&r.status===409)return;throw r}}};function xs(t){return t.join("")}var L8=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${xs(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof Hc&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof Hc&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},z8=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=M8({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new D8(this.client,e),this.tableOps=new L8(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function Wc(t){"@babel/helpers - typeof";return Wc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wc(t)}function B8(t,e){if(Wc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Wc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function U8(t){var e=B8(t,"string");return Wc(e)=="symbol"?e:e+""}function q8(t,e,r){return(e=U8(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yE(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 Be(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yE(Object(r),!0).forEach(function(n){q8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var fp=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function hp(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var ox=class extends fp{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return Be({},super.toJSON())}},eR=class extends fp{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Xf(t,e,r){const n=Be({},t),i=e.toLowerCase();for(const a of Object.keys(n))a.toLowerCase()===i&&delete n[a];return n[i]=r,n}function F8(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const H8=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),W8=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},sx=t=>{if(Array.isArray(t))return t.map(r=>sx(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const i=r.replace(/([-_][a-z])/gi,a=>a.toUpperCase().replace(/[-_]/g,""));e[i]=sx(n)}),e},K8=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),vE=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const r=e.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(t)},G8=async(t,e,r,n)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const i=t;let a=parseInt(String(i.status),10);Number.isFinite(a)||(a=500),i.json().then(o=>{const c=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||a+"";e(new ox(vE(o),a,c,n))}).catch(()=>{const o=a+"";e(new ox(i.statusText||`HTTP ${a} error`,a,o,n))})}else e(new eR(vE(t),t,n))},V8=(t,e,r,n)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return Be(Be({},i),r);if(W8(n)){var a;const o=(e==null?void 0:e.headers)||{};let c;for(const[u,d]of Object.entries(o))u.toLowerCase()==="content-type"&&(c=d);i.headers=Xf(o,"Content-Type",(a=c)!==null&&a!==void 0?a:"application/json"),i.body=JSON.stringify(n)}else i.body=n;return e!=null&&e.duplex&&(i.duplex=e.duplex),Be(Be({},i),r)};async function hc(t,e,r,n,i,a,o){return new Promise((c,u)=>{t(r,V8(e,n,i,a)).then(d=>{if(!d.ok)throw d;if(n!=null&&n.noResolveJson)return d;if(o==="vectors"){const p=d.headers.get("content-type");if(d.headers.get("content-length")==="0"||d.status===204)return{};if(!p||!p.includes("application/json"))return{}}return d.json()}).then(d=>c(d)).catch(d=>G8(d,u,n,o))})}function tR(t="storage"){return{get:async(e,r,n,i)=>hc(e,"GET",r,n,i,void 0,t),post:async(e,r,n,i,a)=>hc(e,"POST",r,i,a,n,t),put:async(e,r,n,i,a)=>hc(e,"PUT",r,i,a,n,t),head:async(e,r,n,i)=>hc(e,"HEAD",r,Be(Be({},n),{},{noResolveJson:!0}),i,void 0,t),remove:async(e,r,n,i,a)=>hc(e,"DELETE",r,i,a,n,t)}}const X8=tR("storage"),{get:Kc,post:Fn,put:lx,head:Y8,remove:o1}=X8,cn=tR("vectors");var bl=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=F8(e),this.fetch=H8(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Xf(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(hp(r))return{data:null,error:r};throw r}}};let rR;rR=Symbol.toStringTag;var J8=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[rR]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(hp(e))return{data:null,error:e};throw e}}};let nR;nR=Symbol.toStringTag;var Z8=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[nR]="BlobDownloadBuilder",this.promise=null}asStream(){return new J8(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(hp(e))return{data:null,error:e};throw e}}};const Q8={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},bE={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var e6=class extends bl{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var i=this;return i.handleOperation(async()=>{let a;const o=Be(Be({},bE),n);let c=Be(Be({},i.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const u=o.metadata;if(typeof Blob<"u"&&r instanceof Blob?(a=new FormData,a.append("cacheControl",o.cacheControl),u&&a.append("metadata",i.encodeMetadata(u)),a.append("",r)):typeof FormData<"u"&&r instanceof FormData?(a=r,a.has("cacheControl")||a.append("cacheControl",o.cacheControl),u&&!a.has("metadata")&&a.append("metadata",i.encodeMetadata(u))):(a=r,c["cache-control"]=`max-age=${o.cacheControl}`,c["content-type"]=o.contentType,u&&(c["x-metadata"]=i.toBase64(i.encodeMetadata(u))),(typeof ReadableStream<"u"&&a instanceof ReadableStream||a&&typeof a=="object"&&"pipe"in a&&typeof a.pipe=="function")&&!o.duplex&&(o.duplex="half")),n!=null&&n.headers)for(const[m,v]of Object.entries(n.headers))c=Xf(c,m,v);const d=i._removeEmptyFolders(e),p=i._getFinalPath(d),f=await(t=="PUT"?lx:Fn)(i.fetch,`${i.url}/object/${p}`,a,Be({headers:c},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:d,id:f.Id,fullPath:f.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var i=this;const a=i._removeEmptyFolders(t),o=i._getFinalPath(a),c=new URL(i.url+`/object/upload/sign/${o}`);return c.searchParams.set("token",e),i.handleOperation(async()=>{let u;const d=Be(Be({},bE),n);let p=Be(Be({},i.headers),{"x-upsert":String(d.upsert)});const f=d.metadata;if(typeof Blob<"u"&&r instanceof Blob?(u=new FormData,u.append("cacheControl",d.cacheControl),f&&u.append("metadata",i.encodeMetadata(f)),u.append("",r)):typeof FormData<"u"&&r instanceof FormData?(u=r,u.has("cacheControl")||u.append("cacheControl",d.cacheControl),f&&!u.has("metadata")&&u.append("metadata",i.encodeMetadata(f))):(u=r,p["cache-control"]=`max-age=${d.cacheControl}`,p["content-type"]=d.contentType,f&&(p["x-metadata"]=i.toBase64(i.encodeMetadata(f))),(typeof ReadableStream<"u"&&u instanceof ReadableStream||u&&typeof u=="object"&&"pipe"in u&&typeof u.pipe=="function")&&!d.duplex&&(d.duplex="half")),n!=null&&n.headers)for(const[m,v]of Object.entries(n.headers))p=Xf(p,m,v);return{path:a,fullPath:(await lx(i.fetch,c.toString(),u,Be({headers:p},d!=null&&d.duplex?{duplex:d.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const i=Be({},r.headers);e!=null&&e.upsert&&(i["x-upsert"]="true");const a=await Fn(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(r.url+a.url),c=o.searchParams.get("token");if(!c)throw new fp("No token returned by API");return{signedUrl:o.toString(),path:t,token:c}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await Fn(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await Fn(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let i=n._getFinalPath(t);const a=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await Fn(n.fetch,`${n.url}/object/sign/${i}`,Be({expiresIn:e},a?{transform:r.transform}:{}),{headers:n.headers});const c=new URLSearchParams;r!=null&&r.download&&c.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&c.set("cacheNonce",String(r.cacheNonce));const u=c.toString();return{signedUrl:encodeURI(`${n.url}${o.signedURL}${u?`&${u}`:""}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const i=await Fn(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),a=new URLSearchParams;r!=null&&r.download&&a.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));const o=a.toString();return i.map(c=>Be(Be({},c),{},{signedUrl:c.signedURL?encodeURI(`${n.url}${c.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,r){const n=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",i=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(i,e.transform),(e==null?void 0:e.cacheNonce)!=null&&i.set("cacheNonce",String(e.cacheNonce));const a=i.toString(),o=this._getFinalPath(t),c=()=>Kc(this.fetch,`${this.url}/${n}/${o}${a?`?${a}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Z8(c,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>sx(await Kc(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Y8(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(i){if(e.shouldThrowOnError)throw i;if(hp(i)){var n;const a=i instanceof ox?i.status:i instanceof eR?(n=i.originalError)===null||n===void 0?void 0:n.status:void 0;if(a!==void 0&&[400,404].includes(a))return{data:!1,error:i}}throw i}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=new URLSearchParams;e!=null&&e.download&&n.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const i=n.toString(),a=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${r}`)+(i?`?${i}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await o1(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const i=Be(Be(Be({},Q8),e),{},{prefix:t||""});return await Fn(n.fetch,`${n.url}/object/list/${n.bucketId}`,i,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=Be({},t);return await Fn(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const t6="2.107.0",Mu={"X-Client-Info":`storage-js/${t6}`};var r6=class extends bl{constructor(t,e={},r,n){const i=new URL(t);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase."));const a=i.href.replace(/\/$/,""),o=Be(Be({},Mu),e);super(a,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Kc(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Kc(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await Fn(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await lx(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Fn(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await o1(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},n6=class extends bl{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=Be(Be({},Mu),e);super(n,i,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Fn(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),i=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Kc(e.fetch,i,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await o1(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!K8(t))throw new fp("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new z8({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(i,a){const o=i[a];return typeof o!="function"?o:async(...c)=>{try{return{data:await o.apply(i,c),error:null}}catch(u){if(n)throw u;return{data:null,error:u}}}}})}},i6=class extends bl{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=Be(Be({},Mu),{},{"Content-Type":"application/json"},e);super(n,i,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await cn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await cn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},a6=class extends bl{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=Be(Be({},Mu),{},{"Content-Type":"application/json"},e);super(n,i,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},o6=class extends bl{constructor(t,e={},r){const n=t.replace(/\/$/,""),i=Be(Be({},Mu),{},{"Content-Type":"application/json"},e);super(n,i,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await cn.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},s6=class extends o6{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new l6(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},l6=class extends i6{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new c6(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},c6=class extends a6{constructor(t,e,r,n,i){super(t,e,i),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,Be(Be({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},u6=class extends r6{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new e6(this.url,this.headers,t,this.fetch)}get vectors(){return new s6(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new n6(this.url+"/iceberg",this.headers,this.fetch)}};const iR="2.107.0",Ca=30*1e3,Oc=3,Dg=Oc*Ca,d6="http://localhost:9999",f6="supabase.auth.token",h6={"X-Client-Info":`gotrue-js/${iR}`},cx="X-Supabase-Api-Version",aR={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},p6=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,m6=600*1e3;class Gc extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function be(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class g6 extends Gc{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function y6(t){return be(t)&&t.name==="AuthApiError"}class Xn extends Gc{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class Ei extends Gc{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}}class mr extends Ei{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function uf(t){return be(t)&&t.name==="AuthSessionMissingError"}class ws extends Ei{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class df extends Ei{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class ff extends Ei{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function v6(t){return be(t)&&t.name==="AuthImplicitGrantRedirectError"}class xE extends Ei{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class b6 extends Ei{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class ux extends Ei{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Lg(t){return be(t)&&t.name==="AuthRetryableFetchError"}class wE extends Ei{constructor(e="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(e,"AuthRefreshDiscardedError",409,void 0)}}function x6(t){return be(t)&&t.name==="AuthRefreshDiscardedError"}class _E extends Ei{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Yf extends Ei{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Jf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),SE=`
|
|
430
|
+
\r=`.split(""),w6=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<SE.length;e+=1)t[SE[e].charCodeAt(0)]=-2;for(let e=0;e<Jf.length;e+=1)t[Jf[e].charCodeAt(0)]=e;return t})();function kE(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Jf[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Jf[n]),e.queuedBits-=6}}function oR(t,e,r){const n=w6[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function EE(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},a=o=>{k6(o,n,r)};for(let o=0;o<t.length;o+=1)oR(t.charCodeAt(o),i,a);return e.join("")}function _6(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function S6(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const i=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|i)+65536,r+=1}_6(n,e)}}function k6(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function Ds(t){const e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)oR(t.charCodeAt(i),r,n);return new Uint8Array(e)}function E6(t){const e=[];return S6(t,r=>e.push(r)),new Uint8Array(e)}function ko(t){const e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};return t.forEach(i=>kE(i,r,n)),kE(null,r,n),e.join("")}function A6(t){return Math.round(Date.now()/1e3)+t}function O6(){return Symbol("auth-callback")}const Tr=()=>typeof window<"u"&&typeof document<"u",yo={tested:!1,writable:!1},sR=()=>{if(!Tr())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(yo.tested)return yo.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),yo.tested=!0,yo.writable=!0}catch{yo.tested=!0,yo.writable=!1}return yo.writable};function T6(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((i,a)=>{e[a]=i})}catch{}return r.searchParams.forEach((n,i)=>{e[i]=n}),e}const lR=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),C6=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Ns=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},Di=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},nr=async(t,e)=>{await t.removeItem(e)};class pp{constructor(){this.promise=new pp.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}pp.promiseConstructor=Promise;function hf(t){const e=t.split(".");if(e.length!==3)throw new Yf("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!p6.test(e[n]))throw new Yf("JWT not in base64url format");return{header:JSON.parse(EE(e[0])),payload:JSON.parse(EE(e[1])),signature:Ds(e[2]),raw:{header:e[0],payload:e[1]}}}async function j6(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function N6(t,e){return new Promise((n,i)=>{(async()=>{for(let a=0;a<1/0;a++)try{const o=await t(a);if(!e(a,null,o)){n(o);return}}catch(o){if(!e(a,o)){i(o);return}}})()})}function P6(t){return("0"+t.toString(16)).substr(-2)}function R6(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let i="";for(let a=0;a<56;a++)i+=r.charAt(Math.floor(Math.random()*n));return i}return crypto.getRandomValues(e),Array.from(e,P6).join("")}async function I6(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),i=new Uint8Array(n);return Array.from(i).map(a=>String.fromCharCode(a)).join("")}async function $6(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await I6(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function _s(t,e,r=!1){const n=R6();let i=n;r&&(i+="/recovery"),await Ns(t,`${e}-code-verifier`,i);const a=await $6(n);return[a,n===a?"plain":"s256"]}const M6=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function D6(t){const e=t.headers.get(cx);if(!e||!e.match(M6))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function L6(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function z6(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const B6=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Li(t){if(!B6.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function qn(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function zg(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function U6(t,e){return new Proxy(t,{get:(r,n,i)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const a=n.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="Symbol(util.inspect.custom)"||a==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,i)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,i)}})}function AE(t){return JSON.parse(JSON.stringify(t))}const xo=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},q6=[502,503,504,520,521,522,523,524,530];async function OE(t){var e;if(!C6(t))throw new ux(xo(t),0);if(q6.includes(t.status))throw new ux(xo(t),t.status);let r;try{r=await t.json()}catch(a){throw new Xn(xo(a),a)}let n;const i=D6(t);if(i&&i.getTime()>=aR["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new _E(xo(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new mr}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((a,o)=>a&&typeof o=="string",!0))throw new _E(xo(r),t.status,r.weak_password.reasons);throw new g6(xo(r),t.status||500,n)}const F6=(t,e,r,n)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),r))};async function Ne(t,e,r,n){var i;const a=Object.assign({},n==null?void 0:n.headers);a[cx]||(a[cx]=aR["2024-01-01"].name),n!=null&&n.jwt&&(a.Authorization=`Bearer ${n.jwt}`);const o=(i=n==null?void 0:n.query)!==null&&i!==void 0?i:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const c=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",u=await H6(t,e,r+c,{headers:a,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(u):{data:Object.assign({},u),error:null}}async function H6(t,e,r,n,i,a){const o=F6(e,n,i,a);let c;try{c=await t(r,Object.assign({},o))}catch(u){throw console.error(u),new ux(xo(u),0)}if(c.ok||await OE(c),n!=null&&n.noResolveJson)return c;try{return await c.json()}catch(u){await OE(u)}}function En(t){var e;let r=null;G6(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=A6(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:n},error:null}}function TE(t){const e=En(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Pa(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function W6(t){return{data:t,error:null}}function K6(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:a}=t,o=dp(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:a},u=Object.assign({},o);return{data:{properties:c,user:u},error:null}}function CE(t){return t}function G6(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Bg=["global","local","others"];class V6{constructor({url:e="",headers:r={},fetch:n,experimental:i}){this.url=e,this.headers=r,this.fetch=lR(n),this.experimental=i??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,r=Bg[0]){if(Bg.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Bg.join(", ")}`);try{return await Ne(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(be(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await Ne(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Pa})}catch(n){if(be(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=dp(e,["options"]),i=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(i.new_email=n==null?void 0:n.newEmail,delete i.newEmail),await Ne(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:K6,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(be(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await Ne(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Pa})}catch(r){if(be(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,i,a,o,c,u;try{const d={nextPage:null,lastPage:0,total:0},p=await Ne(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(a=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""},xform:CE});if(p.error)throw p.error;const f=await p.json(),m=(o=p.headers.get("x-total-count"))!==null&&o!==void 0?o:0,v=(u=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(b=>{const w=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(b.split(";")[1].split("=")[1]);d[`${x}Page`]=w}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(be(d))return{data:{users:[]},error:d};throw d}}async getUserById(e){Li(e);try{return await Ne(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Pa})}catch(r){if(be(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Li(e);try{return await Ne(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:Pa})}catch(n){if(be(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Li(e);try{return await Ne(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:Pa})}catch(n){if(be(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Li(e.userId);try{const{data:r,error:n}=await Ne(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:r,error:n}}catch(r){if(be(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Li(e.userId),Li(e.id);try{return{data:await Ne(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(be(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,i,a,o,c,u;try{const d={nextPage:null,lastPage:0,total:0},p=await Ne(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(a=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""},xform:CE});if(p.error)throw p.error;const f=await p.json(),m=(o=p.headers.get("x-total-count"))!==null&&o!==void 0?o:0,v=(u=(c=p.headers.get("link"))===null||c===void 0?void 0:c.split(","))!==null&&u!==void 0?u:[];return v.length>0&&(v.forEach(b=>{const w=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(b.split(";")[1].split("=")[1]);d[`${x}Page`]=w}),d.total=parseInt(m)),{data:Object.assign(Object.assign({},f),d),error:null}}catch(d){if(be(d))return{data:{clients:[]},error:d};throw d}}async _createOAuthClient(e){try{return await Ne(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await Ne(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await Ne(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(be(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await Ne(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(be(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await Ne(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await Ne(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var i;return{data:{providers:(i=n==null?void 0:n.providers)!==null&&i!==void 0?i:[]},error:null}}})}catch(r){if(be(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await Ne(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{return await Ne(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{return await Ne(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(be(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{return await Ne(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(be(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){qn(this.experimental),Li(e.userId);try{return await Ne(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(be(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){qn(this.experimental),Li(e.userId),Li(e.passkeyId);try{return await Ne(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(be(r))return{data:null,error:r};throw r}}}function jE(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}globalThis&&sR()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class X6 extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}function Y6(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function cR(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function J6(t){return parseInt(t,16)}function Z6(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function Q6(t){var e;const{chainId:r,domain:n,expirationTime:i,issuedAt:a=new Date,nonce:o,notBefore:c,requestId:u,resources:d,scheme:p,uri:f,version:m}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!f)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(m!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${m}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
|
|
431
431
|
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const v=cR(t.address),b=p?`${p}://${n}`:n,w=t.statement?`${t.statement}
|
|
432
432
|
`:"",x=`${b} wants you to sign in with your Ethereum account:
|
|
433
433
|
${v}
|
|
@@ -442,11 +442,11 @@ Not Before: ${c.toISOString()}`),u&&(k+=`
|
|
|
442
442
|
Request ID: ${u}`),d){let S=`
|
|
443
443
|
Resources:`;for(const A of d){if(!A||typeof A!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${A}`);S+=`
|
|
444
444
|
- ${A}`}k+=S}return`${x}
|
|
445
|
-
${k}`}class Zt extends Error{constructor({message:e,code:r,cause:n,name:i}){var a;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(a=i??(n instanceof Error?n.name:void 0))!==null&&a!==void 0?a:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Zf extends Zt{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function tU({error:t,options:e}){var r,n,i;const{publicKey:a}=e;if(!a)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Zt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=a.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Zt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=a.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Zt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=a.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Zt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Zt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Zt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return a.pubKeyCredParams.filter(c=>c.type==="public-key").length===0?new Zt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Zt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(uR(o)){if(a.rp.id!==o)return new Zt({message:`The RP ID "${a.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Zt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new Zt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Zt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Zt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function rU({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Zt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Zt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(uR(n)){if(r.rpId!==n)return new Zt({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Zt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Zt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Zt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class nU{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const dx=new nU;function NE(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,i=dp(t,["challenge","user","excludeCredentials"]),a=Ds(e).buffer,o=Object.assign(Object.assign({},r),{id:Ds(r.id).buffer}),c=Object.assign(Object.assign({},i),{challenge:a,user:o});if(n&&n.length>0){c.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const d=n[u];c.excludeCredentials[u]=Object.assign(Object.assign({},d),{id:Ds(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return c}function PE(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=dp(t,["challenge","allowCredentials"]),i=Ds(e).buffer,a=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){a.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const c=r[o];a.allowCredentials[o]=Object.assign(Object.assign({},c),{id:Ds(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function RE(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:ko(new Uint8Array(t.response.attestationObject)),clientDataJSON:ko(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function IE(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:ko(new Uint8Array(i.authenticatorData)),clientDataJSON:ko(new Uint8Array(i.clientDataJSON)),signature:ko(new Uint8Array(i.signature)),userHandle:i.userHandle?ko(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function uR(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function Qf(){var t,e;return!!(Tr()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function dR(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Zf("Browser returned unexpected credential type",e)}:{data:null,error:new Zf("Empty credential response",e)}}catch(e){return{data:null,error:tU({error:e,options:t})}}}async function fR(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Zf("Browser returned unexpected credential type",e)}:{data:null,error:new Zf("Empty credential response",e)}}catch(e){return{data:null,error:rU({error:e,options:t})}}}const iU={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},aU={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function eh(...t){const e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),n={};for(const i of t)if(i)for(const a in i){const o=i[a];if(o!==void 0)if(Array.isArray(o))n[a]=o;else if(r(o))n[a]=o;else if(e(o)){const c=n[a];e(c)?n[a]=eh(c,o):n[a]=eh(o)}else n[a]=o}return n}function oU(t,e){return eh(iU,t,e||{})}function sU(t,e){return eh(aU,t,e||{})}class lU{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:i},a){var o;try{const{data:c,error:u}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!c)return{data:null,error:u};const d=i??dx.createNewAbortSignal();if(c.webauthn.type==="create"){const{user:p}=c.webauthn.credential_options.publicKey;if(!p.name){const f=n;if(f)p.name=`${p.id}:${f}`;else{const v=(await this.client.getUser()).data.user,b=((o=v==null?void 0:v.user_metadata)===null||o===void 0?void 0:o.name)||(v==null?void 0:v.email)||(v==null?void 0:v.id)||"User";p.name=`${p.id}:${b}`}}p.displayName||(p.displayName=p.name)}switch(c.webauthn.type){case"create":{const p=oU(c.webauthn.credential_options.publicKey,a==null?void 0:a.create),{data:f,error:m}=await dR({publicKey:p,signal:d});return f?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:f}},error:null}:{data:null,error:m}}case"request":{const p=sU(c.webauthn.credential_options.publicKey,a==null?void 0:a.request),{data:f,error:m}=await fR(Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:p,signal:d}));return f?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:f}},error:null}:{data:null,error:m}}}}catch(c){return be(c)?{data:null,error:c}:{data:null,error:new Xn("Unexpected error in challenge",c)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},a){if(!r)return{data:null,error:new Gc("rpId is required for WebAuthn authentication")};try{if(!Qf())return{data:null,error:new Xn("Browser does not support WebAuthn",null)};const{data:o,error:c}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:i},{request:a});if(!o)return{data:null,error:c};const{webauthn:u}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(o){return be(o)?{data:null,error:o}:{data:null,error:new Xn("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},a){if(!r)return{data:null,error:new Gc("rpId is required for WebAuthn registration")};try{if(!Qf())return{data:null,error:new Xn("Browser does not support WebAuthn",null)};const{data:o,error:c}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(p=>{var f;return(f=p.data)===null||f===void 0?void 0:f.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===e&&m.status!=="unverified")}).then(p=>p?this.client.mfa.unenroll({factorId:p==null?void 0:p.id}):void 0),{data:null,error:c};const{data:u,error:d}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:i},{create:a});return u?this._verify({factorId:o.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:d}}catch(o){return be(o)?{data:null,error:o}:{data:null,error:new Xn("Unexpected error in register",o)}}}}J6();const cU={url:f6,storageKey:h6,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:p6,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},Ss={};class Vc{get jwks(){var e,r;return(r=(e=Ss[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Ss[this.storageKey]=Object.assign(Object.assign({},Ss[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Ss[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ss[this.storageKey]=Object.assign(Object.assign({},Ss[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const a=Object.assign(Object.assign({},cU),e);if(this.storageKey=a.storageKey,this.instanceID=(r=Vc.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Vc.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&Tr()){const o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.experimental=(n=a.experimental)!==null&&n!==void 0?n:{},this.admin=new X6({url:a.url,headers:a.headers,fetch:a.fetch,experimental:this.experimental}),this.url=a.url,this.headers=a.headers,this.fetch=lR(a.fetch),this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,this.lockAcquireTimeout=a.lockAcquireTimeout,a.lock!=null&&(this.lock=a.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new lU(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:sR()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=jE(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=jE(this.memoryStorage)),Tr()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(c){this._debug("#broadcastChannel","error",c)}})}a.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${iR}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if(Tr()&&(r=C6(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Tr()&&this.detectSessionInUrl&&n!=="none"){const{data:i,error:a}=await this._getSessionFromURL(r,n);if(a){if(this._debug("#_initialize()","error detecting session from URL",a),b6(a)){const u=(e=a.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:a}}return{error:a}}const{session:o,redirectType:c}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",c),await this._saveSession(o),setTimeout(async()=>{c==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return be(r)?this._returnResult({error:r}):this._returnResult({error:new Xn("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,i;try{const a=await Ne(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:En}),{data:o,error:c}=a;if(c||!o)return this._returnResult({data:{user:null,session:null},error:c});const u=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:d,session:u},error:null})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signUp(e){var r,n,i;try{let a;if("email"in e){const{email:p,password:f,options:m}=e;let v=null,b=null;this.flowType==="pkce"&&([v,b]=await _s(this.storage,this.storageKey)),a=await Ne(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:p,password:f,data:(r=m==null?void 0:m.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:v,code_challenge_method:b},xform:En})}else if("phone"in e){const{phone:p,password:f,options:m}=e;a=await Ne(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:p,password:f,data:(n=m==null?void 0:m.data)!==null&&n!==void 0?n:{},channel:(i=m==null?void 0:m.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:En})}else throw new df("You must provide either an email or phone number and a password");const{data:o,error:c}=a;if(c||!o)return await nr(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:c});const u=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:d,session:u},error:null})}catch(a){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithPassword(e){try{let r;if("email"in e){const{email:a,password:o,options:c}=e;r=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:o,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}},xform:TE})}else if("phone"in e){const{phone:a,password:o,options:c}=e;r=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:o,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}},xform:TE})}else throw new df("You must provide either an email or phone number and a password");const{data:n,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!n||!n.session||!n.user){const a=new ws;return this._returnResult({data:{user:null,session:null},error:a})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(r){if(be(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,i,a;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(a=e.options)===null||a===void 0?void 0:a.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,i,a,o,c,u,d,p,f,m;let v,b;if("message"in e)v=e.message,b=e.signature;else{const{chain:w,wallet:x,statement:k,options:S}=e;let A;if(Tr())if(typeof x=="object")A=x;else{const $=window;if("ethereum"in $&&typeof $.ethereum=="object"&&"request"in $.ethereum&&typeof $.ethereum.request=="function")A=$.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof x!="object"||!(S!=null&&S.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");A=x}const C=new URL((r=S==null?void 0:S.url)!==null&&r!==void 0?r:window.location.href),T=await A.request({method:"eth_requestAccounts"}).then($=>$).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!T||T.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const O=cR(T[0]);let N=(n=S==null?void 0:S.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!N){const $=await A.request({method:"eth_chainId"});N=Z6($)}const R={domain:C.host,address:O,statement:k,uri:C.href,version:"1",chainId:N,nonce:(i=S==null?void 0:S.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(a=S==null?void 0:S.signInWithEthereum)===null||a===void 0?void 0:a.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(c=S==null?void 0:S.signInWithEthereum)===null||c===void 0?void 0:c.expirationTime,notBefore:(u=S==null?void 0:S.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(d=S==null?void 0:S.signInWithEthereum)===null||d===void 0?void 0:d.requestId,resources:(p=S==null?void 0:S.signInWithEthereum)===null||p===void 0?void 0:p.resources};v=eU(R),b=await A.request({method:"personal_sign",params:[Q6(v),O]})}try{const{data:w,error:x}=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:v,signature:b},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(m=e.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:En});if(x)throw x;if(!w||!w.session||!w.user){const k=new ws;return this._returnResult({data:{user:null,session:null},error:k})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:x})}catch(w){if(be(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async signInWithSolana(e){var r,n,i,a,o,c,u,d,p,f,m,v;let b,w;if("message"in e)b=e.message,w=e.signature;else{const{chain:x,wallet:k,statement:S,options:A}=e;let C;if(Tr())if(typeof k=="object")C=k;else{const O=window;if("solana"in O&&typeof O.solana=="object"&&("signIn"in O.solana&&typeof O.solana.signIn=="function"||"signMessage"in O.solana&&typeof O.solana.signMessage=="function"))C=O.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");C=k}const T=new URL((r=A==null?void 0:A.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in C&&C.signIn){const O=await C.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},A==null?void 0:A.signInWithSolana),{version:"1",domain:T.host,uri:T.href}),S?{statement:S}:null));let N;if(Array.isArray(O)&&O[0]&&typeof O[0]=="object")N=O[0];else if(O&&typeof O=="object"&&"signedMessage"in O&&"signature"in O)N=O;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in N&&"signature"in N&&(typeof N.signedMessage=="string"||N.signedMessage instanceof Uint8Array)&&N.signature instanceof Uint8Array)b=typeof N.signedMessage=="string"?N.signedMessage:new TextDecoder().decode(N.signedMessage),w=N.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in C)||typeof C.signMessage!="function"||!("publicKey"in C)||typeof C!="object"||!C.publicKey||!("toBase58"in C.publicKey)||typeof C.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${T.host} wants you to sign in with your Solana account:`,C.publicKey.toBase58(),...S?["",S,""]:[""],"Version: 1",`URI: ${T.href}`,`Issued At: ${(i=(n=A==null?void 0:A.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((a=A==null?void 0:A.signInWithSolana)===null||a===void 0)&&a.notBefore?[`Not Before: ${A.signInWithSolana.notBefore}`]:[],...!((o=A==null?void 0:A.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${A.signInWithSolana.expirationTime}`]:[],...!((c=A==null?void 0:A.signInWithSolana)===null||c===void 0)&&c.chainId?[`Chain ID: ${A.signInWithSolana.chainId}`]:[],...!((u=A==null?void 0:A.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${A.signInWithSolana.nonce}`]:[],...!((d=A==null?void 0:A.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${A.signInWithSolana.requestId}`]:[],...!((f=(p=A==null?void 0:A.signInWithSolana)===null||p===void 0?void 0:p.resources)===null||f===void 0)&&f.length?["Resources",...A.signInWithSolana.resources.map(N=>`- ${N}`)]:[]].join(`
|
|
446
|
-
`);const O=await C.signMessage(new TextEncoder().encode(b),"utf8");if(!O||!(O instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");w=O}}try{const{data:x,error:k}=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:ko(w)},!((m=e.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(v=e.options)===null||v===void 0?void 0:v.captchaToken}}:null),xform:En});if(k)throw k;if(!x||!x.session||!x.user){const S=new ws;return this._returnResult({data:{user:null,session:null},error:S})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:k})}catch(x){if(be(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async _exchangeCodeForSession(e){const r=await Di(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new x6;const{data:a,error:o}=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:En});if(await nr(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!a||!a.session||!a.user){const c=new ws;return this._returnResult({data:{user:null,session:null,redirectType:null},error:c})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers(i==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",a.session)),this._returnResult({data:Object.assign(Object.assign({},a),{redirectType:i??null}),error:o})}catch(a){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null,redirectType:null},error:a});throw a}}async signInWithIdToken(e){try{const{options:r,provider:n,token:i,access_token:a,nonce:o}=e,c=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:a,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:En}),{data:u,error:d}=c;if(d)return this._returnResult({data:{user:null,session:null},error:d});if(!u||!u.session||!u.user){const p=new ws;return this._returnResult({data:{user:null,session:null},error:p})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:d})}catch(r){if(be(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,i,a,o;try{if("email"in e){const{email:c,options:u}=e;let d=null,p=null;this.flowType==="pkce"&&([d,p]=await _s(this.storage,this.storageKey));const{error:f}=await Ne(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:c,data:(r=u==null?void 0:u.data)!==null&&r!==void 0?r:{},create_user:(n=u==null?void 0:u.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:d,code_challenge_method:p},redirectTo:u==null?void 0:u.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in e){const{phone:c,options:u}=e,{data:d,error:p}=await Ne(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:c,data:(i=u==null?void 0:u.data)!==null&&i!==void 0?i:{},create_user:(a=u==null?void 0:u.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},channel:(o=u==null?void 0:u.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:p})}throw new df("You must provide either an email or phone number.")}catch(c){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async verifyOtp(e){var r,n;try{let i,a;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,a=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:c}=await Ne(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:a}}),redirectTo:i,xform:En});if(c)throw c;if(!o)throw new Error("An error occurred on token verification.");const u=o.session,d=o.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:d,session:u},error:null})}catch(i){if(be(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i,a,o;try{let c=null,u=null;this.flowType==="pkce"&&([c,u]=await _s(this.storage,this.storageKey));const d=await Ne(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:c,code_challenge_method:u}),headers:this.headers,xform:K6});return!((a=d.data)===null||a===void 0)&&a.url&&Tr()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(d.data.url),this._returnResult(d)}catch(c){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(c))return this._returnResult({data:null,error:c});throw c}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new mr;const{error:i}=await Ne(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if(be(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:i,options:a}=e,{error:o}=await Ne(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},redirectTo:a==null?void 0:a.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){const{phone:n,type:i,options:a}=e,{data:o,error:c}=await Ne(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:c})}throw new df("You must provide either an email or phone number and a type")}catch(r){if(be(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await Di(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<Dg:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await Di(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=zg()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=q6(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:i,error:a}=await this._callRefreshToken(e.refresh_token);return a?this._returnResult({data:{session:null},error:a}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let r;return this.lock!=null?r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):r=await this._getUser(),r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await Ne(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Pa}):await this._useSession(async r=>{var n,i,a;const{data:o,error:c}=r;if(c)throw c;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new mr}:await Ne(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&a!==void 0?a:void 0,xform:Pa})})}catch(r){if(be(r))return uf(r)&&(await this._removeSession(),await nr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r)):await this._updateUser(e,r)}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:i,error:a}=n;if(a)throw a;if(!i.session)throw new mr;const o=i.session;let c=null,u=null;this.flowType==="pkce"&&e.email!=null&&([c,u]=await _s(this.storage,this.storageKey));const{data:d,error:p}=await Ne(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:c,code_challenge_method:u}),jwt:o.access_token,xform:Pa});if(p)throw p;return o.user=d.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new mr;const r=Date.now()/1e3;let n=r,i=!0,a=null;const{payload:o}=hf(e.access_token);if(o.exp&&(n=o.exp,i=n<=r),i){const{data:c,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c)return{data:{user:null,session:null},error:null};a=c}else{const{data:c,error:u}=await this._getUser(e.access_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});a={access_token:e.access_token,refresh_token:e.refresh_token,user:c.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return this._returnResult({data:{user:a.user,session:a},error:null})}catch(r){if(be(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:o,error:c}=r;if(c)throw c;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new mr;const{data:i,error:a}=await this._callRefreshToken(e.refresh_token);return a?this._returnResult({data:{user:null,session:null},error:a}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(be(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!Tr())throw new ff("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ff(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new xE("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ff("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new xE("No code detected.");const{data:A,error:C}=await this._exchangeCodeForSession(e.code);if(C)throw C;const T=new URL(window.location.href);return T.searchParams.delete("code"),window.history.replaceState(window.history.state,"",T.toString()),{data:{session:A.session,redirectType:(n=A.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:i,provider_refresh_token:a,access_token:o,refresh_token:c,expires_in:u,expires_at:d,token_type:p}=e;if(!o||!u||!c||!p)throw new ff("No session defined in URL");const f=Math.round(Date.now()/1e3),m=parseInt(u);let v=f+m;d&&(v=parseInt(d));const b=v-f;b*1e3<=Ca&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${b}s, should have been closer to ${m}s`);const w=v-m;f-w>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",w,v,f):f-w<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",w,v,f);const{data:x,error:k}=await this._getUser(o);if(k)throw k;const S={provider_token:i,provider_refresh_token:a,access_token:o,expires_in:m,expires_at:v,refresh_token:c,token_type:p,user:x.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:S,redirectType:e.type},error:null})}catch(i){if(be(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const r=await Di(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:i,error:a}=r;if(a&&!uf(a))return this._returnResult({error:a});const o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:c}=await this.admin.signOut(o,e);if(c&&!(v6(c)&&(c.status===404||c.status===401||c.status===403)||uf(c)))return this._returnResult({error:c})}return e!=="others"&&(await this._removeSession(),await nr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=T6(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)}):await this._emitInitialSession(r)))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,i;try{const{data:{session:a},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",e,"session",a)}catch(a){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",a),uf(a)?console.warn(a):console.error(a)}})}async resetPasswordForEmail(e,r={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await _s(this.storage,this.storageKey,!0));try{return await Ne(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(a){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:null,error:a});throw a}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,error:i}=await this._useSession(async a=>{var o,c,u,d,p;const{data:f,error:m}=a;if(m)throw m;const v=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(c=e.options)===null||c===void 0?void 0:c.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await Ne(this.fetch,"GET",v,{headers:this.headers,jwt:(p=(d=f.session)===null||d===void 0?void 0:d.access_token)!==null&&p!==void 0?p:void 0})});if(i)throw i;return Tr()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(be(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:i,data:{session:a}}=r;if(i)throw i;const{options:o,provider:c,token:u,access_token:d,nonce:p}=e,f=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=a==null?void 0:a.access_token)!==null&&n!==void 0?n:void 0,body:{provider:c,id_token:u,access_token:d,nonce:p,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:En}),{data:m,error:v}=f;return v?this._returnResult({data:{user:null,session:null},error:v}):!m||!m.session||!m.user?this._returnResult({data:{user:null,session:null},error:new ws}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:v}))}catch(i){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,i;const{data:a,error:o}=r;if(o)throw o;return await Ne(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r="#_refreshAccessToken()";this._debug(r,"begin");try{const n=Date.now();return await P6(async i=>(i>0&&await N6(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await Ne(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:En})),(i,a)=>{const o=200*Math.pow(2,i);return a&&Lg(a)&&Date.now()+o-n<Ca})}catch(n){if(this._debug(r,"error",n),be(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),Tr()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const i=await Di(this.storage,this.storageKey);if(i&&this.userStorage){let o=await Di(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await Ns(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:zg()}else if(i&&!i.user&&!i.user){const o=await Di(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(i.user=o.user,await nr(this.storage,this.storageKey+"-user"),await Ns(this.storage,this.storageKey,i)):i.user=zg()}if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}const a=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Dg;if(this._debug(n,`session has${a?"":" not"} expired with margin of ${Dg}s`),a){if(this.autoRefreshToken&&i.refresh_token){const{error:o}=await this._callRefreshToken(i.refresh_token);o&&(w6(o)?this._debug(n,"refresh discarded by commit guard",o):(console.error(o),Lg(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession())))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:c}=await this._getUser(i.access_token);!c&&(o!=null&&o.user)?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new mr;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i="#_callRefreshToken()";this._debug(i,"begin");try{this.refreshingDeferred=new pp;const a=await Di(this.storage,this.storageKey),{data:o,error:c}=await this._refreshAccessToken(e);if(c)throw c;if(!o.session)throw new mr;const u=await Di(this.storage,this.storageKey);if(a!==null&&(u===null||u.refresh_token!==a.refresh_token)){this._debug(i,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:u?"replaced":"cleared"});const m={data:null,error:new wE};return this.refreshingDeferred.resolve(m),m}const p=this._sessionRemovalEpoch;if(await this._saveSession(o.session),this._sessionRemovalEpoch!==p){this._debug(i,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await nr(this.storage,this.storageKey),this.userStorage&&await nr(this.userStorage,this.storageKey+"-user");const m={data:null,error:new wE};return this.refreshingDeferred.resolve(m),m}await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const f={data:o.session,error:null};return this.refreshingDeferred.resolve(f),f}catch(a){if(this._debug(i,"error",a),be(a)){const o={data:null,error:a};return Lg(a)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(a),a}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,r,n=!0){const i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const a=[],o=Array.from(this.stateChangeEmitters.values()).map(async c=>{try{await c.callback(e,r)}catch(u){a.push(u)}});if(await Promise.all(o),a.length>0){for(let c=0;c<a.length;c+=1)console.error(a[c]);throw a[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await nr(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await Ns(this.userStorage,this.storageKey+"-user",{user:r.user});const i=Object.assign({},r);delete i.user;const a=AE(i);await Ns(this.storage,this.storageKey,a)}else{const i=AE(r);await Ns(this.storage,this.storageKey,i)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await nr(this.storage,this.storageKey),await nr(this.storage,this.storageKey+"-code-verifier"),await nr(this.storage,this.storageKey+"-user"),this.userStorage&&await nr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Tr()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Ca);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(e=this.broadcastChannel)===null||e===void 0||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((n.expires_at*1e3-e)/Ca);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Ca}ms, refresh threshold is ${Oc} ticks`),i<=Oc&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof Y6)this._debug("auto refresh token tick lock not available");else throw e}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const e=Date.now();try{await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((n.expires_at*1e3-e)/Ca);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Ca}ms, refresh threshold is ${Oc} ticks`),i<=Oc&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Tr()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;if(this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(r,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const i=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[a,o]=await _s(this.storage,this.storageKey),c=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(c.toString())}if(n!=null&&n.queryParams){const a=new URLSearchParams(n.queryParams);i.push(a.toString())}return n!=null&&n.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:i,error:a}=r;return a?this._returnResult({data:null,error:a}):await Ne(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,i;const{data:a,error:o}=r;if(o)return this._returnResult({data:null,error:o});const c=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:u,error:d}=await Ne(this.fetch,"POST",`${this.url}/factors`,{body:c,headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token});return d?this._returnResult({data:null,error:d}):(e.factorType==="totp"&&u.type==="totp"&&(!((i=u==null?void 0:u.totp)===null||i===void 0)&&i.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){const r=async()=>{try{return await this._useSession(async n=>{var i;const{data:a,error:o}=n;if(o)return this._returnResult({data:null,error:o});const c=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?RE(e.webauthn.credential_response):IE(e.webauthn.credential_response)})}:{code:e.code}),{data:u,error:d}=await Ne(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:c,headers:this.headers,jwt:(i=a==null?void 0:a.session)===null||i===void 0?void 0:i.access_token});return d?this._returnResult({data:null,error:d}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+u.expires_in},u)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",u),this._returnResult({data:u,error:d}))})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challenge(e){const r=async()=>{try{return await this._useSession(async n=>{var i;const{data:a,error:o}=n;if(o)return this._returnResult({data:null,error:o});const c=await Ne(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(i=a==null?void 0:a.session)===null||i===void 0?void 0:i.access_token});if(c.error)return c;const{data:u}=c;if(u.type!=="webauthn")return{data:u,error:null};switch(u.webauthn.type){case"create":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:NE(u.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:PE(u.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const i={all:[],phone:[],totp:[],webauthn:[]};for(const a of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])i.all.push(a),a.status==="verified"&&i[a.factor_type].push(a);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,i,a;if(e)try{const{payload:v}=hf(e);let b=null;v.aal&&(b=v.aal);let w=b;const{data:{user:x},error:k}=await this.getUser(e);if(k)return this._returnResult({data:null,error:k});((n=(r=x==null?void 0:x.factors)===null||r===void 0?void 0:r.filter(C=>C.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(w="aal2");const A=v.amr||[];return{data:{currentLevel:b,nextLevel:w,currentAuthenticationMethods:A},error:null}}catch(v){if(be(v))return this._returnResult({data:null,error:v});throw v}const{data:{session:o},error:c}=await this.getSession();if(c)return this._returnResult({data:null,error:c});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:u}=hf(o.access_token);let d=null;u.aal&&(d=u.aal);let p=d;((a=(i=o.user.factors)===null||i===void 0?void 0:i.filter(v=>v.status==="verified"))!==null&&a!==void 0?a:[]).length>0&&(p="aal2");const m=u.amr||[];return{data:{currentLevel:d,nextLevel:p,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await Ne(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new mr})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:i},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new mr});const o=await Ne(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:c=>({data:c,error:null})});return o.data&&o.data.redirect_url&&Tr()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:i},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new mr});const o=await Ne(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:c=>({data:c,error:null})});return o.data&&o.data.redirect_url&&Tr()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await Ne(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new mr})})}catch(e){if(be(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?(await Ne(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new mr})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(c=>c.kid===e);if(n)return n;const i=Date.now();if(n=this.jwks.keys.find(c=>c.kid===e),n&&this.jwks_cached_at+g6>i)return n;const{data:a,error:o}=await Ne(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!a.keys||a.keys.length===0||(this.jwks=a,this.jwks_cached_at=i,n=a.keys.find(c=>c.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:v,error:b}=await this.getSession();if(b||!v.session)return this._returnResult({data:null,error:b});n=v.session.access_token}const{header:i,payload:a,signature:o,raw:{header:c,payload:u}}=hf(n);if(!(r!=null&&r.allowExpired))try{z6(a.exp)}catch(v){throw new Yf(v instanceof Error?v.message:"JWT validation failed")}const d=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!d){const{error:v}=await this.getUser(n);if(v)throw v;return{data:{claims:a,header:i,signature:o},error:null}}const p=B6(i.alg),f=await crypto.subtle.importKey("jwk",d,p,!0,["verify"]);if(!await crypto.subtle.verify(p,f,o,A6(`${c}.${u}`)))throw new Yf("Invalid JWT signature");return{data:{claims:a,header:i,signature:o},error:null}}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,i;qn(this.experimental);try{if(!Qf())return this._returnResult({data:null,error:new Xn("Browser does not support WebAuthn",null)});const{data:a,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}});if(o||!a)return this._returnResult({data:null,error:o});const c=PE(a.options),u=(i=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&i!==void 0?i:dx.createNewAbortSignal(),{data:d,error:p}=await fR({publicKey:c,signal:u});if(p||!d)return this._returnResult({data:null,error:p??new Xn("WebAuthn ceremony failed",null)});const f=IE(d);return this._verifyPasskeyAuthentication({challengeId:a.challenge_id,credential:f})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async registerPasskey(e){var r,n;qn(this.experimental);try{if(!Qf())return this._returnResult({data:null,error:new Xn("Browser does not support WebAuthn",null)});const{data:i,error:a}=await this._startPasskeyRegistration();if(a||!i)return this._returnResult({data:null,error:a});const o=NE(i.options),c=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:dx.createNewAbortSignal(),{data:u,error:d}=await dR({publicKey:o,signal:c});if(d||!u)return this._returnResult({data:null,error:d??new Xn("WebAuthn ceremony failed",null)});const p=RE(u);return this._verifyPasskeyRegistration({challengeId:i.challenge_id,credential:p})}catch(i){if(be(i))return this._returnResult({data:null,error:i});throw i}}async _startPasskeyRegistration(){qn(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new mr});const{data:i,error:a}=await Ne(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(e){if(be(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){qn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new mr});const{data:a,error:o}=await Ne(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;qn(this.experimental);try{const{data:n,error:i}=await Ne(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){qn(this.experimental);try{const{data:r,error:n}=await Ne(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:En});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){qn(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new mr});const{data:i,error:a}=await Ne(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(e){if(be(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){qn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new mr});const{data:a,error:o}=await Ne(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){qn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new mr});const{error:a}=await Ne(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return a?this._returnResult({data:null,error:a}):this._returnResult({data:null,error:null})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}}Vc.nextInstanceID={};const uU=Vc,dU="2.107.0";let Tc="",th;if(typeof Deno<"u"){var Ug;Tc="deno",th=(Ug=Deno.version)===null||Ug===void 0?void 0:Ug.deno}else if(typeof document<"u")Tc="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")Tc="react-native";else{var qg;Tc="node",th=typeof process<"u"?(qg=process.version)===null||qg===void 0?void 0:qg.replace(/^v/,""):void 0}const hR=[`runtime=${Tc}`];th&&hR.push(`runtime-version=${th}`);const fU={"X-Client-Info":`supabase-js/${dU}; ${hR.join("; ")}`},hU={headers:fU},pU={schema:"public"},mU={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},gU={},yU={enabled:!1,respectSamplingDecision:!0};function vU(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,[])).next())})}let Fg=null;const bU="@opentelemetry/api";function xU(){return Fg===null&&(Fg=import(bU).catch(()=>null)),Fg}function wU(){return vU(this,void 0,void 0,function*(){try{const t=yield xU();if(!t||!t.propagation||!t.context)return null;const e={};t.propagation.inject(t.context.active(),e);const r=e.traceparent;return r?{traceparent:r,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function _U(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,n,i,a]=e;if(r.length!==2||n.length!==32||i.length!==16||a.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(n)||!o.test(i)||!o.test(a)||n==="00000000000000000000000000000000"||i==="0000000000000000"?null:{version:r,traceId:n,parentId:i,traceFlags:a,isSampled:(parseInt(a,16)&1)===1}}function SU(t,e){if(!t||!e||e.length===0)return!1;let r;if(t instanceof URL)r=t;else try{r=new URL(t)}catch{return!1}for(const n of e)try{if(typeof n=="string"){if(kU(r.hostname,n))return!0}else if(n instanceof RegExp){if(n.test(r.hostname))return!0}else if(typeof n=="function"&&n(r))return!0}catch{continue}return!1}function kU(t,e){if(e===t)return!0;if(e.startsWith("*.")){const r=e.slice(2);if(t.endsWith(r)&&(t===r||t.endsWith("."+r)))return!0}return!1}function EU(t){const e=[];try{const r=new URL(t);e.push(r.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function Xc(t){"@babel/helpers - typeof";return Xc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xc(t)}function AU(t,e){if(Xc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Xc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function OU(t){var e=AU(t,"string");return Xc(e)=="symbol"?e:e+""}function TU(t,e,r){return(e=OU(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $E(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 Ht(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?$E(Object(r),!0).forEach(function(n){TU(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$E(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const CU=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),jU=()=>Headers,NU=(t,e,r,n,i)=>{const a=CU(n),o=jU(),c=(i==null?void 0:i.enabled)===!0,u=(i==null?void 0:i.respectSamplingDecision)!==!1,d=c?EU(e):null;return async(p,f)=>{var m;const v=(m=await r())!==null&&m!==void 0?m:t;let b=new o(f==null?void 0:f.headers);if(b.has("apikey")||b.set("apikey",t),b.has("Authorization")||b.set("Authorization",`Bearer ${v}`),d){const w=await PU(p,d,u);w&&(w.traceparent&&!b.has("traceparent")&&b.set("traceparent",w.traceparent),w.tracestate&&!b.has("tracestate")&&b.set("tracestate",w.tracestate),w.baggage&&!b.has("baggage")&&b.set("baggage",w.baggage))}return a(p,Ht(Ht({},f),{},{headers:b}))}};async function PU(t,e,r){if(!SU(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=await wU();if(!n||!n.traceparent)return null;if(r){const i=_U(n.traceparent);if(i&&!i.isSampled)return null}return n}function ME(t){return typeof t=="boolean"?{enabled:t}:t}function RU(t){return t.endsWith("/")?t:t+"/"}function IU(t,e){var r,n,i,a,o,c;const{db:u,auth:d,realtime:p,global:f}=t,{db:m,auth:v,realtime:b,global:w}=e,x=ME(t.tracePropagation),k=ME(e.tracePropagation),S={db:Ht(Ht({},m),u),auth:Ht(Ht({},v),d),realtime:Ht(Ht({},b),p),storage:{},global:Ht(Ht(Ht({},w),f),{},{headers:Ht(Ht({},(r=w==null?void 0:w.headers)!==null&&r!==void 0?r:{}),(n=f==null?void 0:f.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(i=(a=x==null?void 0:x.enabled)!==null&&a!==void 0?a:k==null?void 0:k.enabled)!==null&&i!==void 0?i:!1,respectSamplingDecision:(o=(c=x==null?void 0:x.respectSamplingDecision)!==null&&c!==void 0?c:k==null?void 0:k.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?S.accessToken=t.accessToken:delete S.accessToken,S}function $U(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(RU(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var MU=class extends uU{constructor(t){super(t)}},DU=class{constructor(t,e,r){var n,i;this.supabaseUrl=t,this.supabaseKey=e;const a=$U(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const o=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:pU,realtime:gU,auth:Ht(Ht({},mU),{},{storageKey:o}),global:hU,tracePropagation:yU},u=IU(r??{},c);if(this.settings=u,this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(i=u.global.headers)!==null&&i!==void 0?i:{},u.accessToken)this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(p,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}});else{var d;this.auth=this._initSupabaseAuthClient((d=u.auth)!==null&&d!==void 0?d:{},this.headers,u.global.fetch)}this.fetch=NU(e,t,this._getAccessToken.bind(this),u.global.fetch,u.tracePropagation),this.realtime=this._initRealtimeClient(Ht({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},u.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(p=>this.realtime.setAuth(p)).catch(p=>console.warn("Failed to set initial Realtime auth token:",p)),this.rest=new ZB(new URL("rest/v1",a).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch,timeout:u.db.timeout,urlLengthLimit:u.db.urlLengthLimit}),this.storage=new d6(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new FB(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,storageKey:a,flowType:o,lock:c,debug:u,throwOnError:d,experimental:p,lockAcquireTimeout:f,skipAutoInitialize:m},v,b){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new MU({url:this.authUrl.href,headers:Ht(Ht({},w),v),storageKey:a,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,flowType:o,lock:c,debug:u,throwOnError:d,experimental:p,fetch:b,lockAcquireTimeout:f,skipAutoInitialize:m,hasCustomAuthorizationHeader:Object.keys(this.headers).some(x=>x.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new I8(this.realtimeUrl.href,Ht(Ht({},t),{},{params:Ht(Ht({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const LU=(t,e,r)=>new DU(t,e,r);function zU(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}zU()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const pR=j.createContext({session:null,supabase:null,loading:!0,signIn:async()=>({error:"Not initialized"}),signOut:async()=>{}});function mp(){return j.useContext(pR)}function BU({children:t}){const[e,r]=j.useState(null),[n,i]=j.useState(null),[a,o]=j.useState(!0),c=j.useRef(null);j.useEffect(()=>{W4(()=>{var f;return((f=c.current)==null?void 0:f.access_token)??null})},[]);const u=j.useRef(null);j.useEffect(()=>{K4(async()=>{const f=u.current;if(!f)return null;const{data:m,error:v}=await f.auth.refreshSession();return v||!m.session?null:(c.current=m.session,i(m.session),m.session.access_token)})},[]),j.useEffect(()=>{fetch("/api/auth/config").then(f=>f.json()).then(f=>{if(f.supabaseUrl&&f.supabaseAnonKey){const m=LU(f.supabaseUrl,f.supabaseAnonKey);r(m),u.current=m,m.auth.getSession().then(({data:b})=>{c.current=b.session,i(b.session),o(!1)});const{data:{subscription:v}}=m.auth.onAuthStateChange((b,w)=>{c.current=w,i(w)});return()=>v.unsubscribe()}o(!1)}).catch(()=>{o(!1)})},[]);async function d(f,m){if(!e)return{error:"Supabase not configured"};const{error:v}=await e.auth.signInWithPassword({email:f,password:m});return{error:(v==null?void 0:v.message)??null}}async function p(){e&&(await e.auth.signOut(),c.current=null,i(null))}return y.jsx(pR.Provider,{value:{session:n,supabase:e,loading:a,signIn:d,signOut:p},children:t})}function mR(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=mR(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function ot(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=mR(t))&&(n&&(n+=" "),n+=e);return n}const UU=(t,e)=>{const r=new Array(t.length+e.length);for(let n=0;n<t.length;n++)r[n]=t[n];for(let n=0;n<e.length;n++)r[t.length+n]=e[n];return r},qU=(t,e)=>({classGroupId:t,validator:e}),gR=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),rh="-",DE=[],FU="arbitrary..",HU=t=>{const e=KU(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return WU(o);const c=o.split(rh),u=c[0]===""&&c.length>1?1:0;return yR(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=n[o],d=r[o];return u?d?UU(d,u):u:d||DE}return r[o]||DE}}},yR=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const i=t[e],a=r.nextPart.get(i);if(a){const d=yR(t,e+1,a);if(d)return d}const o=r.validators;if(o===null)return;const c=e===0?t.join(rh):t.slice(e).join(rh),u=o.length;for(let d=0;d<u;d++){const p=o[d];if(p.validator(c))return p.classGroupId}},WU=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?FU+n:void 0})(),KU=t=>{const{theme:e,classGroups:r}=t;return GU(r,e)},GU=(t,e)=>{const r=gR();for(const n in t){const i=t[n];s1(i,r,n,e)}return r},s1=(t,e,r,n)=>{const i=t.length;for(let a=0;a<i;a++){const o=t[a];VU(o,e,r,n)}},VU=(t,e,r,n)=>{if(typeof t=="string"){XU(t,e,r);return}if(typeof t=="function"){YU(t,e,r,n);return}JU(t,e,r,n)},XU=(t,e,r)=>{const n=t===""?e:vR(e,t);n.classGroupId=r},YU=(t,e,r,n)=>{if(ZU(t)){s1(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(qU(r,t))},JU=(t,e,r,n)=>{const i=Object.entries(t),a=i.length;for(let o=0;o<a;o++){const[c,u]=i[o];s1(u,vR(e,c),r,n)}},vR=(t,e)=>{let r=t;const n=e.split(rh),i=n.length;for(let a=0;a<i;a++){const o=n[a];let c=r.nextPart.get(o);c||(c=gR(),r.nextPart.set(o,c)),r=c}return r},ZU=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,QU=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null);const i=(a,o)=>{r[a]=o,e++,e>t&&(e=0,n=r,r=Object.create(null))};return{get(a){let o=r[a];if(o!==void 0)return o;if((o=n[a])!==void 0)return i(a,o),o},set(a,o){a in r?r[a]=o:i(a,o)}}},fx="!",LE=":",eq=[],zE=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),tq=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=i=>{const a=[];let o=0,c=0,u=0,d;const p=i.length;for(let w=0;w<p;w++){const x=i[w];if(o===0&&c===0){if(x===LE){a.push(i.slice(u,w)),u=w+1;continue}if(x==="/"){d=w;continue}}x==="["?o++:x==="]"?o--:x==="("?c++:x===")"&&c--}const f=a.length===0?i:i.slice(u);let m=f,v=!1;f.endsWith(fx)?(m=f.slice(0,-1),v=!0):f.startsWith(fx)&&(m=f.slice(1),v=!0);const b=d&&d>u?d-u:void 0;return zE(a,v,m,b)};if(e){const i=e+LE,a=n;n=o=>o.startsWith(i)?a(o.slice(i.length)):zE(eq,!1,o,void 0,!0)}if(r){const i=n;n=a=>r({className:a,parseClassName:i})}return n},rq=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let a=0;a<r.length;a++){const o=r[a],c=o[0]==="[",u=e.has(o);c||u?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},nq=t=>({cache:QU(t.cacheSize),parseClassName:tq(t),sortModifiers:rq(t),postfixLookupClassGroupIds:iq(t),...HU(t)}),iq=t=>{const e=Object.create(null),r=t.postfixLookupClassGroups;if(r)for(let n=0;n<r.length;n++)e[r[n]]=!0;return e},aq=/\s+/,oq=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=e,c=[],u=t.trim().split(aq);let d="";for(let p=u.length-1;p>=0;p-=1){const f=u[p],{isExternal:m,modifiers:v,hasImportantModifier:b,baseClassName:w,maybePostfixModifierPosition:x}=r(f);if(m){d=f+(d.length>0?" "+d:d);continue}let k=!!x,S;if(k){const N=w.substring(0,x);S=n(N);const R=S&&o[S]?n(w):void 0;R&&R!==S&&(S=R,k=!1)}else S=n(w);if(!S){if(!k){d=f+(d.length>0?" "+d:d);continue}if(S=n(w),!S){d=f+(d.length>0?" "+d:d);continue}k=!1}const A=v.length===0?"":v.length===1?v[0]:a(v).join(":"),C=b?A+fx:A,T=C+S;if(c.indexOf(T)>-1)continue;c.push(T);const O=i(S,k);for(let N=0;N<O.length;++N){const R=O[N];c.push(C+R)}d=f+(d.length>0?" "+d:d)}return d},sq=(...t)=>{let e=0,r,n,i="";for(;e<t.length;)(r=t[e++])&&(n=bR(r))&&(i&&(i+=" "),i+=n);return i},bR=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=bR(t[n]))&&(r&&(r+=" "),r+=e);return r},lq=(t,...e)=>{let r,n,i,a;const o=u=>{const d=e.reduce((p,f)=>f(p),t());return r=nq(d),n=r.cache.get,i=r.cache.set,a=c,c(u)},c=u=>{const d=n(u);if(d)return d;const p=oq(u,r);return i(u,p),p};return a=o,(...u)=>a(sq(...u))},cq=[],ir=t=>{const e=r=>r[t]||cq;return e.isThemeGetter=!0,e},xR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wR=/^\((?:(\w[\w-]*):)?(.+)\)$/i,uq=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,dq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fq=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,hq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ta=t=>uq.test(t),Ye=t=>!!t&&!Number.isNaN(Number(t)),gi=t=>!!t&&Number.isInteger(Number(t)),Hg=t=>t.endsWith("%")&&Ye(t.slice(0,-1)),zi=t=>dq.test(t),_R=()=>!0,gq=t=>fq.test(t)&&!hq.test(t),l1=()=>!1,yq=t=>pq.test(t),vq=t=>mq.test(t),bq=t=>!ke(t)&&!Oe(t),xq=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),wq=t=>Ha(t,ER,l1),ke=t=>xR.test(t),vo=t=>Ha(t,AR,gq),BE=t=>Ha(t,Cq,Ye),_q=t=>Ha(t,TR,_R),Sq=t=>Ha(t,OR,l1),UE=t=>Ha(t,SR,l1),kq=t=>Ha(t,kR,vq),pf=t=>Ha(t,CR,yq),Oe=t=>wR.test(t),pc=t=>zo(t,AR),Eq=t=>zo(t,OR),qE=t=>zo(t,SR),Aq=t=>zo(t,ER),Oq=t=>zo(t,kR),mf=t=>zo(t,CR,!0),Tq=t=>zo(t,TR,!0),Ha=(t,e,r)=>{const n=xR.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},zo=(t,e,r=!1)=>{const n=wR.exec(t);return n?n[1]?e(n[1]):r:!1},SR=t=>t==="position"||t==="percentage",kR=t=>t==="image"||t==="url",ER=t=>t==="length"||t==="size"||t==="bg-size",AR=t=>t==="length",Cq=t=>t==="number",OR=t=>t==="family-name",TR=t=>t==="number"||t==="weight",CR=t=>t==="shadow",jq=()=>{const t=ir("color"),e=ir("font"),r=ir("text"),n=ir("font-weight"),i=ir("tracking"),a=ir("leading"),o=ir("breakpoint"),c=ir("container"),u=ir("spacing"),d=ir("radius"),p=ir("shadow"),f=ir("inset-shadow"),m=ir("text-shadow"),v=ir("drop-shadow"),b=ir("blur"),w=ir("perspective"),x=ir("aspect"),k=ir("ease"),S=ir("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...C(),Oe,ke],O=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],R=()=>[Oe,ke,u],$=()=>[Ta,"full","auto",...R()],K=()=>[gi,"none","subgrid",Oe,ke],z=()=>["auto",{span:["full",gi,Oe,ke]},gi,Oe,ke],U=()=>[gi,"auto",Oe,ke],F=()=>["auto","min","max","fr",Oe,ke],X=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...R()],Z=()=>[Ta,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],W=()=>[Ta,"screen","full","dvw","lvw","svw","min","max","fit",...R()],Q=()=>[Ta,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],L=()=>[t,Oe,ke],I=()=>[...C(),qE,UE,{position:[Oe,ke]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ee=()=>["auto","cover","contain",Aq,wq,{size:[Oe,ke]}],le=()=>[Hg,pc,vo],fe=()=>["","none","full",d,Oe,ke],ve=()=>["",Ye,pc,vo],qe=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Ye,Hg,qE,UE],Se=()=>["","none",b,Oe,ke],Me=()=>["none",Ye,Oe,ke],oe=()=>["none",Ye,Oe,ke],rt=()=>[Ye,Oe,ke],Fe=()=>[Ta,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[zi],breakpoint:[zi],color:[_R],container:[zi],"drop-shadow":[zi],ease:["in","out","in-out"],font:[bq],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[zi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[zi],shadow:[zi],spacing:["px",Ye],text:[zi],"text-shadow":[zi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ta,ke,Oe,x]}],container:["container"],"container-type":[{"@container":["","normal","size",Oe,ke]}],"container-named":[xq],columns:[{columns:[Ye,ke,Oe,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{"inset-s":$(),start:$()}],end:[{"inset-e":$(),end:$()}],"inset-bs":[{"inset-bs":$()}],"inset-be":[{"inset-be":$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[gi,"auto",Oe,ke]}],basis:[{basis:[Ta,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ye,Ta,"auto","initial","none",ke]}],grow:[{grow:["",Ye,Oe,ke]}],shrink:[{shrink:["",Ye,Oe,ke]}],order:[{order:[gi,"first","last","none",Oe,ke]}],"grid-cols":[{"grid-cols":K()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":K()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...X(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...X()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":X()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mbs:[{mbs:G()}],mbe:[{mbe:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...Q()]}],"min-block-size":[{"min-block":["auto",...Q()]}],"max-block-size":[{"max-block":["none",...Q()]}],w:[{w:[c,"screen",...Z()]}],"min-w":[{"min-w":[c,"screen","none",...Z()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,pc,vo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Tq,_q]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Hg,ke]}],"font-family":[{font:[Eq,Sq,e]}],"font-features":[{"font-features":[ke]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Oe,ke]}],"line-clamp":[{"line-clamp":[Ye,"none",Oe,BE]}],leading:[{leading:[a,...R()]}],"list-image":[{"list-image":["none",Oe,ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Oe,ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...qe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ye,"from-font","auto",Oe,vo]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[Ye,"auto",Oe,ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[gi,Oe,ke]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Oe,ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Oe,ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gi,Oe,ke],radial:["",Oe,ke],conic:[gi,Oe,ke]},Oq,kq]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:ve()}],"border-w-x":[{"border-x":ve()}],"border-w-y":[{"border-y":ve()}],"border-w-s":[{"border-s":ve()}],"border-w-e":[{"border-e":ve()}],"border-w-bs":[{"border-bs":ve()}],"border-w-be":[{"border-be":ve()}],"border-w-t":[{"border-t":ve()}],"border-w-r":[{"border-r":ve()}],"border-w-b":[{"border-b":ve()}],"border-w-l":[{"border-l":ve()}],"divide-x":[{"divide-x":ve()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ve()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...qe(),"hidden","none"]}],"divide-style":[{divide:[...qe(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...qe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ye,Oe,ke]}],"outline-w":[{outline:["",Ye,pc,vo]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",p,mf,pf]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",f,mf,pf]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:ve()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[Ye,vo]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":ve()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",m,mf,pf]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[Ye,Oe,ke]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ye]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[Oe,ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[Ye]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Oe,ke]}],filter:[{filter:["","none",Oe,ke]}],blur:[{blur:Se()}],brightness:[{brightness:[Ye,Oe,ke]}],contrast:[{contrast:[Ye,Oe,ke]}],"drop-shadow":[{"drop-shadow":["","none",v,mf,pf]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",Ye,Oe,ke]}],"hue-rotate":[{"hue-rotate":[Ye,Oe,ke]}],invert:[{invert:["",Ye,Oe,ke]}],saturate:[{saturate:[Ye,Oe,ke]}],sepia:[{sepia:["",Ye,Oe,ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Oe,ke]}],"backdrop-blur":[{"backdrop-blur":Se()}],"backdrop-brightness":[{"backdrop-brightness":[Ye,Oe,ke]}],"backdrop-contrast":[{"backdrop-contrast":[Ye,Oe,ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ye,Oe,ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ye,Oe,ke]}],"backdrop-invert":[{"backdrop-invert":["",Ye,Oe,ke]}],"backdrop-opacity":[{"backdrop-opacity":[Ye,Oe,ke]}],"backdrop-saturate":[{"backdrop-saturate":[Ye,Oe,ke]}],"backdrop-sepia":[{"backdrop-sepia":["",Ye,Oe,ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Oe,ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ye,"initial",Oe,ke]}],ease:[{ease:["linear","initial",k,Oe,ke]}],delay:[{delay:[Ye,Oe,ke]}],animate:[{animate:["none",S,Oe,ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Oe,ke]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Me()}],"rotate-x":[{"rotate-x":Me()}],"rotate-y":[{"rotate-y":Me()}],"rotate-z":[{"rotate-z":Me()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:rt()}],"skew-x":[{"skew-x":rt()}],"skew-y":[{"skew-y":rt()}],transform:[{transform:[Oe,ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Fe()}],"translate-x":[{"translate-x":Fe()}],"translate-y":[{"translate-y":Fe()}],"translate-z":[{"translate-z":Fe()}],"translate-none":["translate-none"],zoom:[{zoom:[gi,Oe,ke]}],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Oe,ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":L()}],"scrollbar-track-color":[{"scrollbar-track":L()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Oe,ke]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[Ye,pc,vo,BE]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Nq=lq(jq);function Cc(...t){return Nq(ot(t))}const Pq=[{to:"/squads",icon:i1,label:"Squads"},{to:"/skills",icon:ex,label:"Skills"},{to:"/schedules",icon:yz,label:"Schedules"},{to:"/wiki",icon:PP,label:"Wiki"},{to:"/usage",icon:bz,label:"Usage"}],Rq=[{to:"/",icon:r1,label:"Chat"},{to:"/feed",icon:Qb,label:"Inbox"},{to:"/settings",icon:pB,label:"Settings"}];function FE({to:t,icon:e,label:r,collapsed:n,badge:i}){return y.jsxs(tP,{to:t,end:t==="/",title:n?r:void 0,className:({isActive:a})=>Cc("w-full flex items-center gap-2.5 px-2 py-2 rounded-xl text-[11px] font-mono transition-colors cursor-pointer relative",n?"justify-center":"",a?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04]"),style:({isActive:a})=>a?{background:"rgba(228,58,156,0.1)"}:void 0,children:[y.jsx(e,{className:"w-3.5 h-3.5 flex-shrink-0"}),!n&&r,i!=null&&i>0&&y.jsx("span",{className:"absolute top-1 right-1 min-w-[14px] h-[14px] flex items-center justify-center rounded-full bg-[#E43A9C] text-[9px] text-white font-mono px-1",children:i>99?"99+":i})]})}function Iq(){const[t,e]=j.useState(!1),[r]=j.useState(CB),[n,i]=j.useState(0),{supabase:a}=mp();return j.useEffect(()=>{let o=!0;const c=()=>{Ge.get("/inbox?limit=200").then(d=>{if(!o)return;const p=d.entries??[];i(p.filter(f=>f.status==="pending").length)}).catch(()=>{})};c();const u=setInterval(c,3e4);return()=>{o=!1,clearInterval(u)}},[]),y.jsxs("div",{className:"flex h-screen overflow-hidden bg-background relative",children:[y.jsxs("div",{className:Cc("flex-shrink-0 flex flex-col border-r border-white/[0.06] bg-[#181818] transition-all duration-200",t?"w-[52px]":"w-[210px]"),children:[y.jsx("div",{className:Cc("h-[52px] flex items-center border-b border-white/[0.06] flex-shrink-0",t?"justify-center px-3":"justify-between pl-4 pr-3"),children:t?y.jsx(Ia,{height:26}):y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx(Ia,{height:26}),y.jsx("span",{className:"text-2xl text-white tracking-wider leading-none",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"IO"})]})}),y.jsx("nav",{className:"flex-1 py-2 px-1.5 space-y-0.5 overflow-y-auto",children:Pq.map(o=>y.jsx(FE,{collapsed:t,...o},o.to))}),y.jsxs("div",{className:"flex-shrink-0 border-t border-white/[0.06]",children:[y.jsx("div",{className:"py-1.5 px-1.5 space-y-0.5",children:Rq.map(o=>y.jsx(FE,{collapsed:t,badge:o.to==="/feed"?n:void 0,...o},o.to))}),y.jsxs("div",{className:"border-t border-white/[0.05] py-1.5 px-1.5 space-y-0.5",children:[y.jsxs("a",{href:`https://github.com/michaeljolley/io/releases/tag/v${r}`,target:"_blank",rel:"noreferrer",title:"GitHub",className:Cc("flex items-center gap-2.5 px-2 py-2 rounded-xl text-[11px] font-mono text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04] transition-colors cursor-pointer",t&&"justify-center"),children:[y.jsx(t1,{className:"w-3.5 h-3.5 flex-shrink-0"}),!t&&y.jsxs("span",{className:"text-zinc-700",children:["v",r]})]}),y.jsx("button",{type:"button",onClick:()=>e(!t),title:t?"Expand sidebar":"Collapse sidebar",className:Cc("w-full flex items-center gap-2.5 px-2 py-2 rounded-xl text-[11px] font-mono text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04] transition-colors cursor-pointer",t&&"justify-center"),children:t?y.jsx(Zw,{className:"w-3.5 h-3.5 flex-shrink-0"}):y.jsx(vl,{className:"w-3.5 h-3.5 flex-shrink-0"})})]})]})]}),y.jsxs("div",{className:"flex flex-col flex-1 min-w-0 overflow-hidden",children:[y.jsxs("div",{className:"h-[52px] flex-shrink-0 flex items-center justify-between px-4 border-b border-white/[0.06] bg-[#181818]",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(DB,{status:"connected"}),y.jsx("span",{className:"text-[11px] font-mono text-green-400",children:"connected"})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(TB,{}),a&&y.jsx("button",{type:"button",onClick:()=>a.auth.signOut(),className:"p-2 rounded-xl hover:bg-white/[0.05] text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",title:"Sign out",children:y.jsx(Xz,{className:"w-3.5 h-3.5"})})]})]}),y.jsxs("main",{className:"flex-1 overflow-hidden flex flex-col min-h-0 relative",children:[y.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",style:{zIndex:0},children:[y.jsx("div",{className:"orb orb-pink"}),y.jsx("div",{className:"orb orb-gray"})]}),y.jsx(TL,{})]})]})]})}function $q(){const{session:t}=mp(),e=Fa(),{messages:r,streaming:n,isStreaming:i,isThinking:a,sendChatMessage:o,stopStreaming:c,addUserMessage:u,uploadAttachment:d}=WP(),[p,f]=j.useState(""),[m,v]=j.useState(null),[b,w]=j.useState(null),x=j.useRef(null),k=j.useRef(null),S=j.useRef(null);j.useLayoutEffect(()=>{const O=x.current;O&&(O.scrollTop=O.scrollHeight)});async function A(){const O=p.trim();if(!O&&!m||i||a)return;const N=crypto.randomUUID(),R=m==null?void 0:m.name,$=[O,R?`Attachment: ${R}`:""].filter(Boolean).join(`
|
|
445
|
+
${k}`}class Zt extends Error{constructor({message:e,code:r,cause:n,name:i}){var a;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(a=i??(n instanceof Error?n.name:void 0))!==null&&a!==void 0?a:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Zf extends Zt{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function eU({error:t,options:e}){var r,n,i;const{publicKey:a}=e;if(!a)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Zt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=a.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Zt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=a.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Zt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=a.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Zt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Zt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Zt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return a.pubKeyCredParams.filter(c=>c.type==="public-key").length===0?new Zt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Zt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(uR(o)){if(a.rp.id!==o)return new Zt({message:`The RP ID "${a.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Zt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new Zt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Zt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Zt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function tU({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Zt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Zt({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(uR(n)){if(r.rpId!==n)return new Zt({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Zt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Zt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Zt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class rU{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const dx=new rU;function NE(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,i=dp(t,["challenge","user","excludeCredentials"]),a=Ds(e).buffer,o=Object.assign(Object.assign({},r),{id:Ds(r.id).buffer}),c=Object.assign(Object.assign({},i),{challenge:a,user:o});if(n&&n.length>0){c.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const d=n[u];c.excludeCredentials[u]=Object.assign(Object.assign({},d),{id:Ds(d.id).buffer,type:d.type||"public-key",transports:d.transports})}}return c}function PE(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=dp(t,["challenge","allowCredentials"]),i=Ds(e).buffer,a=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){a.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const c=r[o];a.allowCredentials[o]=Object.assign(Object.assign({},c),{id:Ds(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function RE(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:ko(new Uint8Array(t.response.attestationObject)),clientDataJSON:ko(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function IE(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:ko(new Uint8Array(i.authenticatorData)),clientDataJSON:ko(new Uint8Array(i.clientDataJSON)),signature:ko(new Uint8Array(i.signature)),userHandle:i.userHandle?ko(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function uR(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function Qf(){var t,e;return!!(Tr()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function dR(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Zf("Browser returned unexpected credential type",e)}:{data:null,error:new Zf("Empty credential response",e)}}catch(e){return{data:null,error:eU({error:e,options:t})}}}async function fR(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Zf("Browser returned unexpected credential type",e)}:{data:null,error:new Zf("Empty credential response",e)}}catch(e){return{data:null,error:tU({error:e,options:t})}}}const nU={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},iU={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function eh(...t){const e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),n={};for(const i of t)if(i)for(const a in i){const o=i[a];if(o!==void 0)if(Array.isArray(o))n[a]=o;else if(r(o))n[a]=o;else if(e(o)){const c=n[a];e(c)?n[a]=eh(c,o):n[a]=eh(o)}else n[a]=o}return n}function aU(t,e){return eh(nU,t,e||{})}function oU(t,e){return eh(iU,t,e||{})}class sU{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:i},a){var o;try{const{data:c,error:u}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!c)return{data:null,error:u};const d=i??dx.createNewAbortSignal();if(c.webauthn.type==="create"){const{user:p}=c.webauthn.credential_options.publicKey;if(!p.name){const f=n;if(f)p.name=`${p.id}:${f}`;else{const v=(await this.client.getUser()).data.user,b=((o=v==null?void 0:v.user_metadata)===null||o===void 0?void 0:o.name)||(v==null?void 0:v.email)||(v==null?void 0:v.id)||"User";p.name=`${p.id}:${b}`}}p.displayName||(p.displayName=p.name)}switch(c.webauthn.type){case"create":{const p=aU(c.webauthn.credential_options.publicKey,a==null?void 0:a.create),{data:f,error:m}=await dR({publicKey:p,signal:d});return f?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:f}},error:null}:{data:null,error:m}}case"request":{const p=oU(c.webauthn.credential_options.publicKey,a==null?void 0:a.request),{data:f,error:m}=await fR(Object.assign(Object.assign({},c.webauthn.credential_options),{publicKey:p,signal:d}));return f?{data:{factorId:e,challengeId:c.id,webauthn:{type:c.webauthn.type,credential_response:f}},error:null}:{data:null,error:m}}}}catch(c){return be(c)?{data:null,error:c}:{data:null,error:new Xn("Unexpected error in challenge",c)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},a){if(!r)return{data:null,error:new Gc("rpId is required for WebAuthn authentication")};try{if(!Qf())return{data:null,error:new Xn("Browser does not support WebAuthn",null)};const{data:o,error:c}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:i},{request:a});if(!o)return{data:null,error:c};const{webauthn:u}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(o){return be(o)?{data:null,error:o}:{data:null,error:new Xn("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},a){if(!r)return{data:null,error:new Gc("rpId is required for WebAuthn registration")};try{if(!Qf())return{data:null,error:new Xn("Browser does not support WebAuthn",null)};const{data:o,error:c}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(p=>{var f;return(f=p.data)===null||f===void 0?void 0:f.all.find(m=>m.factor_type==="webauthn"&&m.friendly_name===e&&m.status!=="unverified")}).then(p=>p?this.client.mfa.unenroll({factorId:p==null?void 0:p.id}):void 0),{data:null,error:c};const{data:u,error:d}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:i},{create:a});return u?this._verify({factorId:o.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:d}}catch(o){return be(o)?{data:null,error:o}:{data:null,error:new Xn("Unexpected error in register",o)}}}}Y6();const lU={url:d6,storageKey:f6,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h6,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},Ss={};class Vc{get jwks(){var e,r;return(r=(e=Ss[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Ss[this.storageKey]=Object.assign(Object.assign({},Ss[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Ss[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ss[this.storageKey]=Object.assign(Object.assign({},Ss[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const a=Object.assign(Object.assign({},lU),e);if(this.storageKey=a.storageKey,this.instanceID=(r=Vc.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Vc.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&Tr()){const o=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.experimental=(n=a.experimental)!==null&&n!==void 0?n:{},this.admin=new V6({url:a.url,headers:a.headers,fetch:a.fetch,experimental:this.experimental}),this.url=a.url,this.headers=a.headers,this.fetch=lR(a.fetch),this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,this.lockAcquireTimeout=a.lockAcquireTimeout,a.lock!=null&&(this.lock=a.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new sU(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:sR()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=jE(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=jE(this.memoryStorage)),Tr()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(c){this._debug("#broadcastChannel","error",c)}})}a.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${iR}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if(Tr()&&(r=T6(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Tr()&&this.detectSessionInUrl&&n!=="none"){const{data:i,error:a}=await this._getSessionFromURL(r,n);if(a){if(this._debug("#_initialize()","error detecting session from URL",a),v6(a)){const u=(e=a.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:a}}return{error:a}}const{session:o,redirectType:c}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",c),await this._saveSession(o),setTimeout(async()=>{c==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return be(r)?this._returnResult({error:r}):this._returnResult({error:new Xn("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,i;try{const a=await Ne(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:En}),{data:o,error:c}=a;if(c||!o)return this._returnResult({data:{user:null,session:null},error:c});const u=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:d,session:u},error:null})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signUp(e){var r,n,i;try{let a;if("email"in e){const{email:p,password:f,options:m}=e;let v=null,b=null;this.flowType==="pkce"&&([v,b]=await _s(this.storage,this.storageKey)),a=await Ne(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:m==null?void 0:m.emailRedirectTo,body:{email:p,password:f,data:(r=m==null?void 0:m.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken},code_challenge:v,code_challenge_method:b},xform:En})}else if("phone"in e){const{phone:p,password:f,options:m}=e;a=await Ne(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:p,password:f,data:(n=m==null?void 0:m.data)!==null&&n!==void 0?n:{},channel:(i=m==null?void 0:m.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:m==null?void 0:m.captchaToken}},xform:En})}else throw new df("You must provide either an email or phone number and a password");const{data:o,error:c}=a;if(c||!o)return await nr(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:c});const u=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:d,session:u},error:null})}catch(a){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithPassword(e){try{let r;if("email"in e){const{email:a,password:o,options:c}=e;r=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:o,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}},xform:TE})}else if("phone"in e){const{phone:a,password:o,options:c}=e;r=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:o,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken}},xform:TE})}else throw new df("You must provide either an email or phone number and a password");const{data:n,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!n||!n.session||!n.user){const a=new ws;return this._returnResult({data:{user:null,session:null},error:a})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(r){if(be(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,i,a;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(a=e.options)===null||a===void 0?void 0:a.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,i,a,o,c,u,d,p,f,m;let v,b;if("message"in e)v=e.message,b=e.signature;else{const{chain:w,wallet:x,statement:k,options:S}=e;let A;if(Tr())if(typeof x=="object")A=x;else{const $=window;if("ethereum"in $&&typeof $.ethereum=="object"&&"request"in $.ethereum&&typeof $.ethereum.request=="function")A=$.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof x!="object"||!(S!=null&&S.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");A=x}const C=new URL((r=S==null?void 0:S.url)!==null&&r!==void 0?r:window.location.href),T=await A.request({method:"eth_requestAccounts"}).then($=>$).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!T||T.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const O=cR(T[0]);let N=(n=S==null?void 0:S.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!N){const $=await A.request({method:"eth_chainId"});N=J6($)}const R={domain:C.host,address:O,statement:k,uri:C.href,version:"1",chainId:N,nonce:(i=S==null?void 0:S.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(a=S==null?void 0:S.signInWithEthereum)===null||a===void 0?void 0:a.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(c=S==null?void 0:S.signInWithEthereum)===null||c===void 0?void 0:c.expirationTime,notBefore:(u=S==null?void 0:S.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(d=S==null?void 0:S.signInWithEthereum)===null||d===void 0?void 0:d.requestId,resources:(p=S==null?void 0:S.signInWithEthereum)===null||p===void 0?void 0:p.resources};v=Q6(R),b=await A.request({method:"personal_sign",params:[Z6(v),O]})}try{const{data:w,error:x}=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:v,signature:b},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(m=e.options)===null||m===void 0?void 0:m.captchaToken}}:null),xform:En});if(x)throw x;if(!w||!w.session||!w.user){const k=new ws;return this._returnResult({data:{user:null,session:null},error:k})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:x})}catch(w){if(be(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async signInWithSolana(e){var r,n,i,a,o,c,u,d,p,f,m,v;let b,w;if("message"in e)b=e.message,w=e.signature;else{const{chain:x,wallet:k,statement:S,options:A}=e;let C;if(Tr())if(typeof k=="object")C=k;else{const O=window;if("solana"in O&&typeof O.solana=="object"&&("signIn"in O.solana&&typeof O.solana.signIn=="function"||"signMessage"in O.solana&&typeof O.solana.signMessage=="function"))C=O.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");C=k}const T=new URL((r=A==null?void 0:A.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in C&&C.signIn){const O=await C.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},A==null?void 0:A.signInWithSolana),{version:"1",domain:T.host,uri:T.href}),S?{statement:S}:null));let N;if(Array.isArray(O)&&O[0]&&typeof O[0]=="object")N=O[0];else if(O&&typeof O=="object"&&"signedMessage"in O&&"signature"in O)N=O;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in N&&"signature"in N&&(typeof N.signedMessage=="string"||N.signedMessage instanceof Uint8Array)&&N.signature instanceof Uint8Array)b=typeof N.signedMessage=="string"?N.signedMessage:new TextDecoder().decode(N.signedMessage),w=N.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in C)||typeof C.signMessage!="function"||!("publicKey"in C)||typeof C!="object"||!C.publicKey||!("toBase58"in C.publicKey)||typeof C.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${T.host} wants you to sign in with your Solana account:`,C.publicKey.toBase58(),...S?["",S,""]:[""],"Version: 1",`URI: ${T.href}`,`Issued At: ${(i=(n=A==null?void 0:A.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((a=A==null?void 0:A.signInWithSolana)===null||a===void 0)&&a.notBefore?[`Not Before: ${A.signInWithSolana.notBefore}`]:[],...!((o=A==null?void 0:A.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${A.signInWithSolana.expirationTime}`]:[],...!((c=A==null?void 0:A.signInWithSolana)===null||c===void 0)&&c.chainId?[`Chain ID: ${A.signInWithSolana.chainId}`]:[],...!((u=A==null?void 0:A.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${A.signInWithSolana.nonce}`]:[],...!((d=A==null?void 0:A.signInWithSolana)===null||d===void 0)&&d.requestId?[`Request ID: ${A.signInWithSolana.requestId}`]:[],...!((f=(p=A==null?void 0:A.signInWithSolana)===null||p===void 0?void 0:p.resources)===null||f===void 0)&&f.length?["Resources",...A.signInWithSolana.resources.map(N=>`- ${N}`)]:[]].join(`
|
|
446
|
+
`);const O=await C.signMessage(new TextEncoder().encode(b),"utf8");if(!O||!(O instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");w=O}}try{const{data:x,error:k}=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:ko(w)},!((m=e.options)===null||m===void 0)&&m.captchaToken?{gotrue_meta_security:{captcha_token:(v=e.options)===null||v===void 0?void 0:v.captchaToken}}:null),xform:En});if(k)throw k;if(!x||!x.session||!x.user){const S=new ws;return this._returnResult({data:{user:null,session:null},error:S})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:k})}catch(x){if(be(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async _exchangeCodeForSession(e){const r=await Di(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new b6;const{data:a,error:o}=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:En});if(await nr(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!a||!a.session||!a.user){const c=new ws;return this._returnResult({data:{user:null,session:null,redirectType:null},error:c})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers(i==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",a.session)),this._returnResult({data:Object.assign(Object.assign({},a),{redirectType:i??null}),error:o})}catch(a){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null,redirectType:null},error:a});throw a}}async signInWithIdToken(e){try{const{options:r,provider:n,token:i,access_token:a,nonce:o}=e,c=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:a,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:En}),{data:u,error:d}=c;if(d)return this._returnResult({data:{user:null,session:null},error:d});if(!u||!u.session||!u.user){const p=new ws;return this._returnResult({data:{user:null,session:null},error:p})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:d})}catch(r){if(be(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,i,a,o;try{if("email"in e){const{email:c,options:u}=e;let d=null,p=null;this.flowType==="pkce"&&([d,p]=await _s(this.storage,this.storageKey));const{error:f}=await Ne(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:c,data:(r=u==null?void 0:u.data)!==null&&r!==void 0?r:{},create_user:(n=u==null?void 0:u.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:d,code_challenge_method:p},redirectTo:u==null?void 0:u.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in e){const{phone:c,options:u}=e,{data:d,error:p}=await Ne(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:c,data:(i=u==null?void 0:u.data)!==null&&i!==void 0?i:{},create_user:(a=u==null?void 0:u.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},channel:(o=u==null?void 0:u.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:p})}throw new df("You must provide either an email or phone number.")}catch(c){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async verifyOtp(e){var r,n;try{let i,a;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,a=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:c}=await Ne(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:a}}),redirectTo:i,xform:En});if(c)throw c;if(!o)throw new Error("An error occurred on token verification.");const u=o.session,d=o.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:d,session:u},error:null})}catch(i){if(be(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i,a,o;try{let c=null,u=null;this.flowType==="pkce"&&([c,u]=await _s(this.storage,this.storageKey));const d=await Ne(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:c,code_challenge_method:u}),headers:this.headers,xform:W6});return!((a=d.data)===null||a===void 0)&&a.url&&Tr()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(d.data.url),this._returnResult(d)}catch(c){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(c))return this._returnResult({data:null,error:c});throw c}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new mr;const{error:i}=await Ne(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if(be(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:i,options:a}=e,{error:o}=await Ne(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},redirectTo:a==null?void 0:a.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){const{phone:n,type:i,options:a}=e,{data:o,error:c}=await Ne(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:c})}throw new df("You must provide either an email or phone number and a type")}catch(r){if(be(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await Di(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<Dg:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await Di(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=zg()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=U6(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:i,error:a}=await this._callRefreshToken(e.refresh_token);return a?this._returnResult({data:{session:null},error:a}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;let r;return this.lock!=null?r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):r=await this._getUser(),r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await Ne(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Pa}):await this._useSession(async r=>{var n,i,a;const{data:o,error:c}=r;if(c)throw c;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new mr}:await Ne(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&a!==void 0?a:void 0,xform:Pa})})}catch(r){if(be(r))return uf(r)&&(await this._removeSession(),await nr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r)):await this._updateUser(e,r)}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:i,error:a}=n;if(a)throw a;if(!i.session)throw new mr;const o=i.session;let c=null,u=null;this.flowType==="pkce"&&e.email!=null&&([c,u]=await _s(this.storage,this.storageKey));const{data:d,error:p}=await Ne(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:c,code_challenge_method:u}),jwt:o.access_token,xform:Pa});if(p)throw p;return o.user=d.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new mr;const r=Date.now()/1e3;let n=r,i=!0,a=null;const{payload:o}=hf(e.access_token);if(o.exp&&(n=o.exp,i=n<=r),i){const{data:c,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c)return{data:{user:null,session:null},error:null};a=c}else{const{data:c,error:u}=await this._getUser(e.access_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});a={access_token:e.access_token,refresh_token:e.refresh_token,user:c.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return this._returnResult({data:{user:a.user,session:a},error:null})}catch(r){if(be(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:o,error:c}=r;if(c)throw c;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new mr;const{data:i,error:a}=await this._callRefreshToken(e.refresh_token);return a?this._returnResult({data:{user:null,session:null},error:a}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(be(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!Tr())throw new ff("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ff(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new xE("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ff("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new xE("No code detected.");const{data:A,error:C}=await this._exchangeCodeForSession(e.code);if(C)throw C;const T=new URL(window.location.href);return T.searchParams.delete("code"),window.history.replaceState(window.history.state,"",T.toString()),{data:{session:A.session,redirectType:(n=A.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:i,provider_refresh_token:a,access_token:o,refresh_token:c,expires_in:u,expires_at:d,token_type:p}=e;if(!o||!u||!c||!p)throw new ff("No session defined in URL");const f=Math.round(Date.now()/1e3),m=parseInt(u);let v=f+m;d&&(v=parseInt(d));const b=v-f;b*1e3<=Ca&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${b}s, should have been closer to ${m}s`);const w=v-m;f-w>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",w,v,f):f-w<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",w,v,f);const{data:x,error:k}=await this._getUser(o);if(k)throw k;const S={provider_token:i,provider_refresh_token:a,access_token:o,expires_in:m,expires_at:v,refresh_token:c,token_type:p,user:x.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:S,redirectType:e.type},error:null})}catch(i){if(be(i))return this._returnResult({data:{session:null,redirectType:null},error:i});throw i}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const r=await Di(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:i,error:a}=r;if(a&&!uf(a))return this._returnResult({error:a});const o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:c}=await this.admin.signOut(o,e);if(c&&!(y6(c)&&(c.status===404||c.status===401||c.status===403)||uf(c)))return this._returnResult({error:c})}return e!=="others"&&(await this._removeSession(),await nr(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=O6(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)}):await this._emitInitialSession(r)))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,i;try{const{data:{session:a},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",e,"session",a)}catch(a){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",a),uf(a)?console.warn(a):console.error(a)}})}async resetPasswordForEmail(e,r={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await _s(this.storage,this.storageKey,!0));try{return await Ne(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(a){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:null,error:a});throw a}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,error:i}=await this._useSession(async a=>{var o,c,u,d,p;const{data:f,error:m}=a;if(m)throw m;const v=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(c=e.options)===null||c===void 0?void 0:c.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await Ne(this.fetch,"GET",v,{headers:this.headers,jwt:(p=(d=f.session)===null||d===void 0?void 0:d.access_token)!==null&&p!==void 0?p:void 0})});if(i)throw i;return Tr()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(be(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:i,data:{session:a}}=r;if(i)throw i;const{options:o,provider:c,token:u,access_token:d,nonce:p}=e,f=await Ne(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=a==null?void 0:a.access_token)!==null&&n!==void 0?n:void 0,body:{provider:c,id_token:u,access_token:d,nonce:p,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:En}),{data:m,error:v}=f;return v?this._returnResult({data:{user:null,session:null},error:v}):!m||!m.session||!m.user?this._returnResult({data:{user:null,session:null},error:new ws}):(m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("USER_UPDATED",m.session)),this._returnResult({data:m,error:v}))}catch(i){if(await nr(this.storage,`${this.storageKey}-code-verifier`),be(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,i;const{data:a,error:o}=r;if(o)throw o;return await Ne(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r="#_refreshAccessToken()";this._debug(r,"begin");try{const n=Date.now();return await N6(async i=>(i>0&&await j6(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await Ne(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:En})),(i,a)=>{const o=200*Math.pow(2,i);return a&&Lg(a)&&Date.now()+o-n<Ca})}catch(n){if(this._debug(r,"error",n),be(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),Tr()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const i=await Di(this.storage,this.storageKey);if(i&&this.userStorage){let o=await Di(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await Ns(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:zg()}else if(i&&!i.user&&!i.user){const o=await Di(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(i.user=o.user,await nr(this.storage,this.storageKey+"-user"),await Ns(this.storage,this.storageKey,i)):i.user=zg()}if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}const a=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Dg;if(this._debug(n,`session has${a?"":" not"} expired with margin of ${Dg}s`),a){if(this.autoRefreshToken&&i.refresh_token){const{error:o}=await this._callRefreshToken(i.refresh_token);o&&(x6(o)?this._debug(n,"refresh discarded by commit guard",o):(console.error(o),Lg(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession())))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:c}=await this._getUser(i.access_token);!c&&(o!=null&&o.user)?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new mr;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i="#_callRefreshToken()";this._debug(i,"begin");try{this.refreshingDeferred=new pp;const a=await Di(this.storage,this.storageKey),{data:o,error:c}=await this._refreshAccessToken(e);if(c)throw c;if(!o.session)throw new mr;const u=await Di(this.storage,this.storageKey);if(a!==null&&(u===null||u.refresh_token!==a.refresh_token)){this._debug(i,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:u?"replaced":"cleared"});const m={data:null,error:new wE};return this.refreshingDeferred.resolve(m),m}const p=this._sessionRemovalEpoch;if(await this._saveSession(o.session),this._sessionRemovalEpoch!==p){this._debug(i,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await nr(this.storage,this.storageKey),this.userStorage&&await nr(this.userStorage,this.storageKey+"-user");const m={data:null,error:new wE};return this.refreshingDeferred.resolve(m),m}await this._notifyAllSubscribers("TOKEN_REFRESHED",o.session);const f={data:o.session,error:null};return this.refreshingDeferred.resolve(f),f}catch(a){if(this._debug(i,"error",a),be(a)){const o={data:null,error:a};return Lg(a)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(a),a}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,r,n=!0){const i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const a=[],o=Array.from(this.stateChangeEmitters.values()).map(async c=>{try{await c.callback(e,r)}catch(u){a.push(u)}});if(await Promise.all(o),a.length>0){for(let c=0;c<a.length;c+=1)console.error(a[c]);throw a[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await nr(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await Ns(this.userStorage,this.storageKey+"-user",{user:r.user});const i=Object.assign({},r);delete i.user;const a=AE(i);await Ns(this.storage,this.storageKey,a)}else{const i=AE(r);await Ns(this.storage,this.storageKey,i)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await nr(this.storage,this.storageKey),await nr(this.storage,this.storageKey+"-code-verifier"),await nr(this.storage,this.storageKey+"-user"),this.userStorage&&await nr(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Tr()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Ca);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(e=this.broadcastChannel)===null||e===void 0||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((n.expires_at*1e3-e)/Ca);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Ca}ms, refresh threshold is ${Oc} ticks`),i<=Oc&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof X6)this._debug("auto refresh token tick lock not available");else throw e}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const e=Date.now();try{await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((n.expires_at*1e3-e)/Ca);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Ca}ms, refresh threshold is ${Oc} ticks`),i<=Oc&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Tr()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;if(this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(r,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const i=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[a,o]=await _s(this.storage,this.storageKey),c=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(c.toString())}if(n!=null&&n.queryParams){const a=new URLSearchParams(n.queryParams);i.push(a.toString())}return n!=null&&n.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:i,error:a}=r;return a?this._returnResult({data:null,error:a}):await Ne(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,i;const{data:a,error:o}=r;if(o)return this._returnResult({data:null,error:o});const c=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:u,error:d}=await Ne(this.fetch,"POST",`${this.url}/factors`,{body:c,headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token});return d?this._returnResult({data:null,error:d}):(e.factorType==="totp"&&u.type==="totp"&&(!((i=u==null?void 0:u.totp)===null||i===void 0)&&i.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){const r=async()=>{try{return await this._useSession(async n=>{var i;const{data:a,error:o}=n;if(o)return this._returnResult({data:null,error:o});const c=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?RE(e.webauthn.credential_response):IE(e.webauthn.credential_response)})}:{code:e.code}),{data:u,error:d}=await Ne(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:c,headers:this.headers,jwt:(i=a==null?void 0:a.session)===null||i===void 0?void 0:i.access_token});return d?this._returnResult({data:null,error:d}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+u.expires_in},u)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",u),this._returnResult({data:u,error:d}))})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challenge(e){const r=async()=>{try{return await this._useSession(async n=>{var i;const{data:a,error:o}=n;if(o)return this._returnResult({data:null,error:o});const c=await Ne(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(i=a==null?void 0:a.session)===null||i===void 0?void 0:i.access_token});if(c.error)return c;const{data:u}=c;if(u.type!=="webauthn")return{data:u,error:null};switch(u.webauthn.type){case"create":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:NE(u.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},u),{webauthn:Object.assign(Object.assign({},u.webauthn),{credential_options:Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:PE(u.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const i={all:[],phone:[],totp:[],webauthn:[]};for(const a of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])i.all.push(a),a.status==="verified"&&i[a.factor_type].push(a);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,i,a;if(e)try{const{payload:v}=hf(e);let b=null;v.aal&&(b=v.aal);let w=b;const{data:{user:x},error:k}=await this.getUser(e);if(k)return this._returnResult({data:null,error:k});((n=(r=x==null?void 0:x.factors)===null||r===void 0?void 0:r.filter(C=>C.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(w="aal2");const A=v.amr||[];return{data:{currentLevel:b,nextLevel:w,currentAuthenticationMethods:A},error:null}}catch(v){if(be(v))return this._returnResult({data:null,error:v});throw v}const{data:{session:o},error:c}=await this.getSession();if(c)return this._returnResult({data:null,error:c});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:u}=hf(o.access_token);let d=null;u.aal&&(d=u.aal);let p=d;((a=(i=o.user.factors)===null||i===void 0?void 0:i.filter(v=>v.status==="verified"))!==null&&a!==void 0?a:[]).length>0&&(p="aal2");const m=u.amr||[];return{data:{currentLevel:d,nextLevel:p,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await Ne(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new mr})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:i},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new mr});const o=await Ne(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:c=>({data:c,error:null})});return o.data&&o.data.redirect_url&&Tr()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:i},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!i)return this._returnResult({data:null,error:new mr});const o=await Ne(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:c=>({data:c,error:null})});return o.data&&o.data.redirect_url&&Tr()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await Ne(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new mr})})}catch(e){if(be(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?(await Ne(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new mr})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(c=>c.kid===e);if(n)return n;const i=Date.now();if(n=this.jwks.keys.find(c=>c.kid===e),n&&this.jwks_cached_at+m6>i)return n;const{data:a,error:o}=await Ne(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!a.keys||a.keys.length===0||(this.jwks=a,this.jwks_cached_at=i,n=a.keys.find(c=>c.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:v,error:b}=await this.getSession();if(b||!v.session)return this._returnResult({data:null,error:b});n=v.session.access_token}const{header:i,payload:a,signature:o,raw:{header:c,payload:u}}=hf(n);if(!(r!=null&&r.allowExpired))try{L6(a.exp)}catch(v){throw new Yf(v instanceof Error?v.message:"JWT validation failed")}const d=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!d){const{error:v}=await this.getUser(n);if(v)throw v;return{data:{claims:a,header:i,signature:o},error:null}}const p=z6(i.alg),f=await crypto.subtle.importKey("jwk",d,p,!0,["verify"]);if(!await crypto.subtle.verify(p,f,o,E6(`${c}.${u}`)))throw new Yf("Invalid JWT signature");return{data:{claims:a,header:i,signature:o},error:null}}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,i;qn(this.experimental);try{if(!Qf())return this._returnResult({data:null,error:new Xn("Browser does not support WebAuthn",null)});const{data:a,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}});if(o||!a)return this._returnResult({data:null,error:o});const c=PE(a.options),u=(i=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&i!==void 0?i:dx.createNewAbortSignal(),{data:d,error:p}=await fR({publicKey:c,signal:u});if(p||!d)return this._returnResult({data:null,error:p??new Xn("WebAuthn ceremony failed",null)});const f=IE(d);return this._verifyPasskeyAuthentication({challengeId:a.challenge_id,credential:f})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async registerPasskey(e){var r,n;qn(this.experimental);try{if(!Qf())return this._returnResult({data:null,error:new Xn("Browser does not support WebAuthn",null)});const{data:i,error:a}=await this._startPasskeyRegistration();if(a||!i)return this._returnResult({data:null,error:a});const o=NE(i.options),c=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:dx.createNewAbortSignal(),{data:u,error:d}=await dR({publicKey:o,signal:c});if(d||!u)return this._returnResult({data:null,error:d??new Xn("WebAuthn ceremony failed",null)});const p=RE(u);return this._verifyPasskeyRegistration({challengeId:i.challenge_id,credential:p})}catch(i){if(be(i))return this._returnResult({data:null,error:i});throw i}}async _startPasskeyRegistration(){qn(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new mr});const{data:i,error:a}=await Ne(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(e){if(be(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){qn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new mr});const{data:a,error:o}=await Ne(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;qn(this.experimental);try{const{data:n,error:i}=await Ne(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})}catch(n){if(be(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){qn(this.experimental);try{const{data:r,error:n}=await Ne(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:En});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){qn(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new mr});const{data:i,error:a}=await Ne(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(e){if(be(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){qn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new mr});const{data:a,error:o}=await Ne(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){qn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new mr});const{error:a}=await Ne(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return a?this._returnResult({data:null,error:a}):this._returnResult({data:null,error:null})})}catch(r){if(be(r))return this._returnResult({data:null,error:r});throw r}}}Vc.nextInstanceID={};const cU=Vc,uU="2.107.0";let Tc="",th;if(typeof Deno<"u"){var Ug;Tc="deno",th=(Ug=Deno.version)===null||Ug===void 0?void 0:Ug.deno}else if(typeof document<"u")Tc="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")Tc="react-native";else{var qg;Tc="node",th=typeof process<"u"?(qg=process.version)===null||qg===void 0?void 0:qg.replace(/^v/,""):void 0}const hR=[`runtime=${Tc}`];th&&hR.push(`runtime-version=${th}`);const dU={"X-Client-Info":`supabase-js/${uU}; ${hR.join("; ")}`},fU={headers:dU},hU={schema:"public"},pU={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},mU={},gU={enabled:!1,respectSamplingDecision:!0};function yU(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,[])).next())})}let Fg=null;const vU="@opentelemetry/api";function bU(){return Fg===null&&(Fg=import(vU).catch(()=>null)),Fg}function xU(){return yU(this,void 0,void 0,function*(){try{const t=yield bU();if(!t||!t.propagation||!t.context)return null;const e={};t.propagation.inject(t.context.active(),e);const r=e.traceparent;return r?{traceparent:r,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function wU(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,n,i,a]=e;if(r.length!==2||n.length!==32||i.length!==16||a.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(n)||!o.test(i)||!o.test(a)||n==="00000000000000000000000000000000"||i==="0000000000000000"?null:{version:r,traceId:n,parentId:i,traceFlags:a,isSampled:(parseInt(a,16)&1)===1}}function _U(t,e){if(!t||!e||e.length===0)return!1;let r;if(t instanceof URL)r=t;else try{r=new URL(t)}catch{return!1}for(const n of e)try{if(typeof n=="string"){if(SU(r.hostname,n))return!0}else if(n instanceof RegExp){if(n.test(r.hostname))return!0}else if(typeof n=="function"&&n(r))return!0}catch{continue}return!1}function SU(t,e){if(e===t)return!0;if(e.startsWith("*.")){const r=e.slice(2);if(t.endsWith(r)&&(t===r||t.endsWith("."+r)))return!0}return!1}function kU(t){const e=[];try{const r=new URL(t);e.push(r.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function Xc(t){"@babel/helpers - typeof";return Xc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xc(t)}function EU(t,e){if(Xc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Xc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function AU(t){var e=EU(t,"string");return Xc(e)=="symbol"?e:e+""}function OU(t,e,r){return(e=AU(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $E(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 Ht(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?$E(Object(r),!0).forEach(function(n){OU(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$E(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const TU=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),CU=()=>Headers,jU=(t,e,r,n,i)=>{const a=TU(n),o=CU(),c=(i==null?void 0:i.enabled)===!0,u=(i==null?void 0:i.respectSamplingDecision)!==!1,d=c?kU(e):null;return async(p,f)=>{var m;const v=(m=await r())!==null&&m!==void 0?m:t;let b=new o(f==null?void 0:f.headers);if(b.has("apikey")||b.set("apikey",t),b.has("Authorization")||b.set("Authorization",`Bearer ${v}`),d){const w=await NU(p,d,u);w&&(w.traceparent&&!b.has("traceparent")&&b.set("traceparent",w.traceparent),w.tracestate&&!b.has("tracestate")&&b.set("tracestate",w.tracestate),w.baggage&&!b.has("baggage")&&b.set("baggage",w.baggage))}return a(p,Ht(Ht({},f),{},{headers:b}))}};async function NU(t,e,r){if(!_U(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=await xU();if(!n||!n.traceparent)return null;if(r){const i=wU(n.traceparent);if(i&&!i.isSampled)return null}return n}function ME(t){return typeof t=="boolean"?{enabled:t}:t}function PU(t){return t.endsWith("/")?t:t+"/"}function RU(t,e){var r,n,i,a,o,c;const{db:u,auth:d,realtime:p,global:f}=t,{db:m,auth:v,realtime:b,global:w}=e,x=ME(t.tracePropagation),k=ME(e.tracePropagation),S={db:Ht(Ht({},m),u),auth:Ht(Ht({},v),d),realtime:Ht(Ht({},b),p),storage:{},global:Ht(Ht(Ht({},w),f),{},{headers:Ht(Ht({},(r=w==null?void 0:w.headers)!==null&&r!==void 0?r:{}),(n=f==null?void 0:f.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(i=(a=x==null?void 0:x.enabled)!==null&&a!==void 0?a:k==null?void 0:k.enabled)!==null&&i!==void 0?i:!1,respectSamplingDecision:(o=(c=x==null?void 0:x.respectSamplingDecision)!==null&&c!==void 0?c:k==null?void 0:k.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?S.accessToken=t.accessToken:delete S.accessToken,S}function IU(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(PU(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var $U=class extends cU{constructor(t){super(t)}},MU=class{constructor(t,e,r){var n,i;this.supabaseUrl=t,this.supabaseKey=e;const a=IU(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const o=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:hU,realtime:mU,auth:Ht(Ht({},pU),{},{storageKey:o}),global:fU,tracePropagation:gU},u=RU(r??{},c);if(this.settings=u,this.storageKey=(n=u.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(i=u.global.headers)!==null&&i!==void 0?i:{},u.accessToken)this.accessToken=u.accessToken,this.auth=new Proxy({},{get:(p,f)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(f)} is not possible`)}});else{var d;this.auth=this._initSupabaseAuthClient((d=u.auth)!==null&&d!==void 0?d:{},this.headers,u.global.fetch)}this.fetch=jU(e,t,this._getAccessToken.bind(this),u.global.fetch,u.tracePropagation),this.realtime=this._initRealtimeClient(Ht({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},u.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(p=>this.realtime.setAuth(p)).catch(p=>console.warn("Failed to set initial Realtime auth token:",p)),this.rest=new JB(new URL("rest/v1",a).href,{headers:this.headers,schema:u.db.schema,fetch:this.fetch,timeout:u.db.timeout,urlLengthLimit:u.db.urlLengthLimit}),this.storage=new u6(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),u.accessToken||this._listenForAuthEvents()}get functions(){return new qB(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,storageKey:a,flowType:o,lock:c,debug:u,throwOnError:d,experimental:p,lockAcquireTimeout:f,skipAutoInitialize:m},v,b){const w={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new $U({url:this.authUrl.href,headers:Ht(Ht({},w),v),storageKey:a,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:i,flowType:o,lock:c,debug:u,throwOnError:d,experimental:p,fetch:b,lockAcquireTimeout:f,skipAutoInitialize:m,hasCustomAuthorizationHeader:Object.keys(this.headers).some(x=>x.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new R8(this.realtimeUrl.href,Ht(Ht({},t),{},{params:Ht(Ht({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const DU=(t,e,r)=>new MU(t,e,r);function LU(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}LU()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const pR=j.createContext({session:null,supabase:null,loading:!0,signIn:async()=>({error:"Not initialized"}),signOut:async()=>{}});function mp(){return j.useContext(pR)}function zU({children:t}){const[e,r]=j.useState(null),[n,i]=j.useState(null),[a,o]=j.useState(!0),c=j.useRef(null);j.useEffect(()=>{W4(()=>{var f;return((f=c.current)==null?void 0:f.access_token)??null})},[]);const u=j.useRef(null);j.useEffect(()=>{K4(async()=>{const f=u.current;if(!f)return null;const{data:m,error:v}=await f.auth.refreshSession();return v||!m.session?null:(c.current=m.session,i(m.session),m.session.access_token)})},[]),j.useEffect(()=>{fetch("/api/auth/config").then(f=>f.json()).then(f=>{if(f.supabaseUrl&&f.supabaseAnonKey){const m=DU(f.supabaseUrl,f.supabaseAnonKey);r(m),u.current=m,m.auth.getSession().then(({data:b})=>{c.current=b.session,i(b.session),o(!1)});const{data:{subscription:v}}=m.auth.onAuthStateChange((b,w)=>{c.current=w,i(w)});return()=>v.unsubscribe()}o(!1)}).catch(()=>{o(!1)})},[]);async function d(f,m){if(!e)return{error:"Supabase not configured"};const{error:v}=await e.auth.signInWithPassword({email:f,password:m});return{error:(v==null?void 0:v.message)??null}}async function p(){e&&(await e.auth.signOut(),c.current=null,i(null))}return y.jsx(pR.Provider,{value:{session:n,supabase:e,loading:a,signIn:d,signOut:p},children:t})}function mR(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=mR(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function ot(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=mR(t))&&(n&&(n+=" "),n+=e);return n}const BU=(t,e)=>{const r=new Array(t.length+e.length);for(let n=0;n<t.length;n++)r[n]=t[n];for(let n=0;n<e.length;n++)r[t.length+n]=e[n];return r},UU=(t,e)=>({classGroupId:t,validator:e}),gR=(t=new Map,e=null,r)=>({nextPart:t,validators:e,classGroupId:r}),rh="-",DE=[],qU="arbitrary..",FU=t=>{const e=WU(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return HU(o);const c=o.split(rh),u=c[0]===""&&c.length>1?1:0;return yR(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=n[o],d=r[o];return u?d?BU(d,u):u:d||DE}return r[o]||DE}}},yR=(t,e,r)=>{if(t.length-e===0)return r.classGroupId;const i=t[e],a=r.nextPart.get(i);if(a){const d=yR(t,e+1,a);if(d)return d}const o=r.validators;if(o===null)return;const c=e===0?t.join(rh):t.slice(e).join(rh),u=o.length;for(let d=0;d<u;d++){const p=o[d];if(p.validator(c))return p.classGroupId}},HU=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),r=e.indexOf(":"),n=e.slice(0,r);return n?qU+n:void 0})(),WU=t=>{const{theme:e,classGroups:r}=t;return KU(r,e)},KU=(t,e)=>{const r=gR();for(const n in t){const i=t[n];s1(i,r,n,e)}return r},s1=(t,e,r,n)=>{const i=t.length;for(let a=0;a<i;a++){const o=t[a];GU(o,e,r,n)}},GU=(t,e,r,n)=>{if(typeof t=="string"){VU(t,e,r);return}if(typeof t=="function"){XU(t,e,r,n);return}YU(t,e,r,n)},VU=(t,e,r)=>{const n=t===""?e:vR(e,t);n.classGroupId=r},XU=(t,e,r,n)=>{if(JU(t)){s1(t(n),e,r,n);return}e.validators===null&&(e.validators=[]),e.validators.push(UU(r,t))},YU=(t,e,r,n)=>{const i=Object.entries(t),a=i.length;for(let o=0;o<a;o++){const[c,u]=i[o];s1(u,vR(e,c),r,n)}},vR=(t,e)=>{let r=t;const n=e.split(rh),i=n.length;for(let a=0;a<i;a++){const o=n[a];let c=r.nextPart.get(o);c||(c=gR(),r.nextPart.set(o,c)),r=c}return r},JU=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,ZU=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,r=Object.create(null),n=Object.create(null);const i=(a,o)=>{r[a]=o,e++,e>t&&(e=0,n=r,r=Object.create(null))};return{get(a){let o=r[a];if(o!==void 0)return o;if((o=n[a])!==void 0)return i(a,o),o},set(a,o){a in r?r[a]=o:i(a,o)}}},fx="!",LE=":",QU=[],zE=(t,e,r,n,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:r,maybePostfixModifierPosition:n,isExternal:i}),eq=t=>{const{prefix:e,experimentalParseClassName:r}=t;let n=i=>{const a=[];let o=0,c=0,u=0,d;const p=i.length;for(let w=0;w<p;w++){const x=i[w];if(o===0&&c===0){if(x===LE){a.push(i.slice(u,w)),u=w+1;continue}if(x==="/"){d=w;continue}}x==="["?o++:x==="]"?o--:x==="("?c++:x===")"&&c--}const f=a.length===0?i:i.slice(u);let m=f,v=!1;f.endsWith(fx)?(m=f.slice(0,-1),v=!0):f.startsWith(fx)&&(m=f.slice(1),v=!0);const b=d&&d>u?d-u:void 0;return zE(a,v,m,b)};if(e){const i=e+LE,a=n;n=o=>o.startsWith(i)?a(o.slice(i.length)):zE(QU,!1,o,void 0,!0)}if(r){const i=n;n=a=>r({className:a,parseClassName:i})}return n},tq=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((r,n)=>{e.set(r,1e6+n)}),r=>{const n=[];let i=[];for(let a=0;a<r.length;a++){const o=r[a],c=o[0]==="[",u=e.has(o);c||u?(i.length>0&&(i.sort(),n.push(...i),i=[]),n.push(o)):i.push(o)}return i.length>0&&(i.sort(),n.push(...i)),n}},rq=t=>({cache:ZU(t.cacheSize),parseClassName:eq(t),sortModifiers:tq(t),postfixLookupClassGroupIds:nq(t),...FU(t)}),nq=t=>{const e=Object.create(null),r=t.postfixLookupClassGroups;if(r)for(let n=0;n<r.length;n++)e[r[n]]=!0;return e},iq=/\s+/,aq=(t,e)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=e,c=[],u=t.trim().split(iq);let d="";for(let p=u.length-1;p>=0;p-=1){const f=u[p],{isExternal:m,modifiers:v,hasImportantModifier:b,baseClassName:w,maybePostfixModifierPosition:x}=r(f);if(m){d=f+(d.length>0?" "+d:d);continue}let k=!!x,S;if(k){const N=w.substring(0,x);S=n(N);const R=S&&o[S]?n(w):void 0;R&&R!==S&&(S=R,k=!1)}else S=n(w);if(!S){if(!k){d=f+(d.length>0?" "+d:d);continue}if(S=n(w),!S){d=f+(d.length>0?" "+d:d);continue}k=!1}const A=v.length===0?"":v.length===1?v[0]:a(v).join(":"),C=b?A+fx:A,T=C+S;if(c.indexOf(T)>-1)continue;c.push(T);const O=i(S,k);for(let N=0;N<O.length;++N){const R=O[N];c.push(C+R)}d=f+(d.length>0?" "+d:d)}return d},oq=(...t)=>{let e=0,r,n,i="";for(;e<t.length;)(r=t[e++])&&(n=bR(r))&&(i&&(i+=" "),i+=n);return i},bR=t=>{if(typeof t=="string")return t;let e,r="";for(let n=0;n<t.length;n++)t[n]&&(e=bR(t[n]))&&(r&&(r+=" "),r+=e);return r},sq=(t,...e)=>{let r,n,i,a;const o=u=>{const d=e.reduce((p,f)=>f(p),t());return r=rq(d),n=r.cache.get,i=r.cache.set,a=c,c(u)},c=u=>{const d=n(u);if(d)return d;const p=aq(u,r);return i(u,p),p};return a=o,(...u)=>a(oq(...u))},lq=[],ir=t=>{const e=r=>r[t]||lq;return e.isThemeGetter=!0,e},xR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wR=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cq=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,uq=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dq=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,fq=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hq=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pq=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ta=t=>cq.test(t),Ye=t=>!!t&&!Number.isNaN(Number(t)),gi=t=>!!t&&Number.isInteger(Number(t)),Hg=t=>t.endsWith("%")&&Ye(t.slice(0,-1)),zi=t=>uq.test(t),_R=()=>!0,mq=t=>dq.test(t)&&!fq.test(t),l1=()=>!1,gq=t=>hq.test(t),yq=t=>pq.test(t),vq=t=>!ke(t)&&!Oe(t),bq=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),xq=t=>Ha(t,ER,l1),ke=t=>xR.test(t),vo=t=>Ha(t,AR,mq),BE=t=>Ha(t,Tq,Ye),wq=t=>Ha(t,TR,_R),_q=t=>Ha(t,OR,l1),UE=t=>Ha(t,SR,l1),Sq=t=>Ha(t,kR,yq),pf=t=>Ha(t,CR,gq),Oe=t=>wR.test(t),pc=t=>zo(t,AR),kq=t=>zo(t,OR),qE=t=>zo(t,SR),Eq=t=>zo(t,ER),Aq=t=>zo(t,kR),mf=t=>zo(t,CR,!0),Oq=t=>zo(t,TR,!0),Ha=(t,e,r)=>{const n=xR.exec(t);return n?n[1]?e(n[1]):r(n[2]):!1},zo=(t,e,r=!1)=>{const n=wR.exec(t);return n?n[1]?e(n[1]):r:!1},SR=t=>t==="position"||t==="percentage",kR=t=>t==="image"||t==="url",ER=t=>t==="length"||t==="size"||t==="bg-size",AR=t=>t==="length",Tq=t=>t==="number",OR=t=>t==="family-name",TR=t=>t==="number"||t==="weight",CR=t=>t==="shadow",Cq=()=>{const t=ir("color"),e=ir("font"),r=ir("text"),n=ir("font-weight"),i=ir("tracking"),a=ir("leading"),o=ir("breakpoint"),c=ir("container"),u=ir("spacing"),d=ir("radius"),p=ir("shadow"),f=ir("inset-shadow"),m=ir("text-shadow"),v=ir("drop-shadow"),b=ir("blur"),w=ir("perspective"),x=ir("aspect"),k=ir("ease"),S=ir("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...C(),Oe,ke],O=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],R=()=>[Oe,ke,u],$=()=>[Ta,"full","auto",...R()],K=()=>[gi,"none","subgrid",Oe,ke],z=()=>["auto",{span:["full",gi,Oe,ke]},gi,Oe,ke],U=()=>[gi,"auto",Oe,ke],F=()=>["auto","min","max","fr",Oe,ke],X=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...R()],Z=()=>[Ta,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],W=()=>[Ta,"screen","full","dvw","lvw","svw","min","max","fit",...R()],Q=()=>[Ta,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],L=()=>[t,Oe,ke],I=()=>[...C(),qE,UE,{position:[Oe,ke]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ee=()=>["auto","cover","contain",Eq,xq,{size:[Oe,ke]}],le=()=>[Hg,pc,vo],fe=()=>["","none","full",d,Oe,ke],ve=()=>["",Ye,pc,vo],qe=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Ye,Hg,qE,UE],Se=()=>["","none",b,Oe,ke],Me=()=>["none",Ye,Oe,ke],oe=()=>["none",Ye,Oe,ke],rt=()=>[Ye,Oe,ke],Fe=()=>[Ta,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[zi],breakpoint:[zi],color:[_R],container:[zi],"drop-shadow":[zi],ease:["in","out","in-out"],font:[vq],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[zi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[zi],shadow:[zi],spacing:["px",Ye],text:[zi],"text-shadow":[zi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ta,ke,Oe,x]}],container:["container"],"container-type":[{"@container":["","normal","size",Oe,ke]}],"container-named":[bq],columns:[{columns:[Ye,ke,Oe,c]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{"inset-s":$(),start:$()}],end:[{"inset-e":$(),end:$()}],"inset-bs":[{"inset-bs":$()}],"inset-be":[{"inset-be":$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],visibility:["visible","invisible","collapse"],z:[{z:[gi,"auto",Oe,ke]}],basis:[{basis:[Ta,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ye,Ta,"auto","initial","none",ke]}],grow:[{grow:["",Ye,Oe,ke]}],shrink:[{shrink:["",Ye,Oe,ke]}],order:[{order:[gi,"first","last","none",Oe,ke]}],"grid-cols":[{"grid-cols":K()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":K()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...X(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...X()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":X()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mbs:[{mbs:G()}],mbe:[{mbe:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...Q()]}],"min-block-size":[{"min-block":["auto",...Q()]}],"max-block-size":[{"max-block":["none",...Q()]}],w:[{w:[c,"screen",...Z()]}],"min-w":[{"min-w":[c,"screen","none",...Z()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,pc,vo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Oq,wq]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Hg,ke]}],"font-family":[{font:[kq,_q,e]}],"font-features":[{"font-features":[ke]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Oe,ke]}],"line-clamp":[{"line-clamp":[Ye,"none",Oe,BE]}],leading:[{leading:[a,...R()]}],"list-image":[{"list-image":["none",Oe,ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Oe,ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...qe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ye,"from-font","auto",Oe,vo]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[Ye,"auto",Oe,ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[gi,Oe,ke]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Oe,ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Oe,ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gi,Oe,ke],radial:["",Oe,ke],conic:[gi,Oe,ke]},Aq,Sq]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:ve()}],"border-w-x":[{"border-x":ve()}],"border-w-y":[{"border-y":ve()}],"border-w-s":[{"border-s":ve()}],"border-w-e":[{"border-e":ve()}],"border-w-bs":[{"border-bs":ve()}],"border-w-be":[{"border-be":ve()}],"border-w-t":[{"border-t":ve()}],"border-w-r":[{"border-r":ve()}],"border-w-b":[{"border-b":ve()}],"border-w-l":[{"border-l":ve()}],"divide-x":[{"divide-x":ve()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ve()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...qe(),"hidden","none"]}],"divide-style":[{divide:[...qe(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...qe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ye,Oe,ke]}],"outline-w":[{outline:["",Ye,pc,vo]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",p,mf,pf]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",f,mf,pf]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:ve()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[Ye,vo]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":ve()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",m,mf,pf]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[Ye,Oe,ke]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ye]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[Oe,ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[Ye]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Oe,ke]}],filter:[{filter:["","none",Oe,ke]}],blur:[{blur:Se()}],brightness:[{brightness:[Ye,Oe,ke]}],contrast:[{contrast:[Ye,Oe,ke]}],"drop-shadow":[{"drop-shadow":["","none",v,mf,pf]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",Ye,Oe,ke]}],"hue-rotate":[{"hue-rotate":[Ye,Oe,ke]}],invert:[{invert:["",Ye,Oe,ke]}],saturate:[{saturate:[Ye,Oe,ke]}],sepia:[{sepia:["",Ye,Oe,ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Oe,ke]}],"backdrop-blur":[{"backdrop-blur":Se()}],"backdrop-brightness":[{"backdrop-brightness":[Ye,Oe,ke]}],"backdrop-contrast":[{"backdrop-contrast":[Ye,Oe,ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ye,Oe,ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ye,Oe,ke]}],"backdrop-invert":[{"backdrop-invert":["",Ye,Oe,ke]}],"backdrop-opacity":[{"backdrop-opacity":[Ye,Oe,ke]}],"backdrop-saturate":[{"backdrop-saturate":[Ye,Oe,ke]}],"backdrop-sepia":[{"backdrop-sepia":["",Ye,Oe,ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Oe,ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ye,"initial",Oe,ke]}],ease:[{ease:["linear","initial",k,Oe,ke]}],delay:[{delay:[Ye,Oe,ke]}],animate:[{animate:["none",S,Oe,ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Oe,ke]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Me()}],"rotate-x":[{"rotate-x":Me()}],"rotate-y":[{"rotate-y":Me()}],"rotate-z":[{"rotate-z":Me()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:rt()}],"skew-x":[{"skew-x":rt()}],"skew-y":[{"skew-y":rt()}],transform:[{transform:[Oe,ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Fe()}],"translate-x":[{"translate-x":Fe()}],"translate-y":[{"translate-y":Fe()}],"translate-z":[{"translate-z":Fe()}],"translate-none":["translate-none"],zoom:[{zoom:[gi,Oe,ke]}],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Oe,ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":L()}],"scrollbar-track-color":[{"scrollbar-track":L()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Oe,ke]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[Ye,pc,vo,BE]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},jq=sq(Cq);function Cc(...t){return jq(ot(t))}const Nq=[{to:"/squads",icon:i1,label:"Squads"},{to:"/skills",icon:ex,label:"Skills"},{to:"/schedules",icon:yz,label:"Schedules"},{to:"/wiki",icon:PP,label:"Wiki"},{to:"/usage",icon:bz,label:"Usage"}],Pq=[{to:"/",icon:r1,label:"Chat"},{to:"/feed",icon:Qb,label:"Inbox"},{to:"/settings",icon:pB,label:"Settings"}];function FE({to:t,icon:e,label:r,collapsed:n,badge:i}){return y.jsxs(tP,{to:t,end:t==="/",title:n?r:void 0,className:({isActive:a})=>Cc("w-full flex items-center gap-2.5 px-2 py-2 rounded-xl text-[11px] font-mono transition-colors cursor-pointer relative",n?"justify-center":"",a?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04]"),style:({isActive:a})=>a?{background:"rgba(228,58,156,0.1)"}:void 0,children:[y.jsx(e,{className:"w-3.5 h-3.5 flex-shrink-0"}),!n&&r,i!=null&&i>0&&y.jsx("span",{className:"absolute top-1 right-1 min-w-[14px] h-[14px] flex items-center justify-center rounded-full bg-[#E43A9C] text-[9px] text-white font-mono px-1",children:i>99?"99+":i})]})}function Rq(){const[t,e]=j.useState(!1),[r,n]=j.useState(""),[i,a]=j.useState(0),{supabase:o}=mp();return j.useEffect(()=>{Ge.get("/version").then(c=>n(c.version)).catch(()=>n("unknown"))},[]),j.useEffect(()=>{let c=!0;const u=()=>{Ge.get("/inbox?limit=200").then(p=>{if(!c)return;const f=p.entries??[];a(f.filter(m=>m.status==="pending").length)}).catch(()=>{})};u();const d=setInterval(u,3e4);return()=>{c=!1,clearInterval(d)}},[]),y.jsxs("div",{className:"flex h-screen overflow-hidden bg-background relative",children:[y.jsxs("div",{className:Cc("flex-shrink-0 flex flex-col border-r border-white/[0.06] bg-[#181818] transition-all duration-200",t?"w-[52px]":"w-[210px]"),children:[y.jsx("div",{className:Cc("h-[52px] flex items-center border-b border-white/[0.06] flex-shrink-0",t?"justify-center px-3":"justify-between pl-4 pr-3"),children:t?y.jsx(Ia,{height:26}):y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx(Ia,{height:26}),y.jsx("span",{className:"text-2xl text-white tracking-wider leading-none",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"IO"})]})}),y.jsx("nav",{className:"flex-1 py-2 px-1.5 space-y-0.5 overflow-y-auto",children:Nq.map(c=>y.jsx(FE,{collapsed:t,...c},c.to))}),y.jsxs("div",{className:"flex-shrink-0 border-t border-white/[0.06]",children:[y.jsx("div",{className:"py-1.5 px-1.5 space-y-0.5",children:Pq.map(c=>y.jsx(FE,{collapsed:t,badge:c.to==="/feed"?i:void 0,...c},c.to))}),y.jsxs("div",{className:"border-t border-white/[0.05] py-1.5 px-1.5 space-y-0.5",children:[y.jsxs("a",{href:`https://github.com/michaeljolley/io/releases/tag/v${r}`,target:"_blank",rel:"noreferrer",title:"GitHub",className:Cc("flex items-center gap-2.5 px-2 py-2 rounded-xl text-[11px] font-mono text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04] transition-colors cursor-pointer",t&&"justify-center"),children:[y.jsx(t1,{className:"w-3.5 h-3.5 flex-shrink-0"}),!t&&y.jsxs("span",{className:"text-zinc-700",children:["v",r]})]}),y.jsx("button",{type:"button",onClick:()=>e(!t),title:t?"Expand sidebar":"Collapse sidebar",className:Cc("w-full flex items-center gap-2.5 px-2 py-2 rounded-xl text-[11px] font-mono text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04] transition-colors cursor-pointer",t&&"justify-center"),children:t?y.jsx(Zw,{className:"w-3.5 h-3.5 flex-shrink-0"}):y.jsx(vl,{className:"w-3.5 h-3.5 flex-shrink-0"})})]})]})]}),y.jsxs("div",{className:"flex flex-col flex-1 min-w-0 overflow-hidden",children:[y.jsxs("div",{className:"h-[52px] flex-shrink-0 flex items-center justify-between px-4 border-b border-white/[0.06] bg-[#181818]",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(MB,{status:"connected"}),y.jsx("span",{className:"text-[11px] font-mono text-green-400",children:"connected"})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(TB,{}),o&&y.jsx("button",{type:"button",onClick:()=>o.auth.signOut(),className:"p-2 rounded-xl hover:bg-white/[0.05] text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",title:"Sign out",children:y.jsx(Xz,{className:"w-3.5 h-3.5"})})]})]}),y.jsxs("main",{className:"flex-1 overflow-hidden flex flex-col min-h-0 relative",children:[y.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",style:{zIndex:0},children:[y.jsx("div",{className:"orb orb-pink"}),y.jsx("div",{className:"orb orb-gray"})]}),y.jsx(TL,{})]})]})]})}function Iq(){const{session:t}=mp(),e=Fa(),{messages:r,streaming:n,isStreaming:i,isThinking:a,sendChatMessage:o,stopStreaming:c,addUserMessage:u,uploadAttachment:d}=WP(),[p,f]=j.useState(""),[m,v]=j.useState(null),[b,w]=j.useState(null),x=j.useRef(null),k=j.useRef(null),S=j.useRef(null);j.useLayoutEffect(()=>{const O=x.current;O&&(O.scrollTop=O.scrollHeight)});async function A(){const O=p.trim();if(!O&&!m||i||a)return;const N=crypto.randomUUID(),R=m==null?void 0:m.name,$=[O,R?`Attachment: ${R}`:""].filter(Boolean).join(`
|
|
447
447
|
|
|
448
|
-
`);u({id:N,role:"user",content:O,timestamp:new Date().toISOString(),attachmentName:R}),f(""),v(null),S.current&&(S.current.value=""),k.current&&(k.current.style.height="auto");try{m&&await d(m,N),await o($)}catch{}}function C(O){O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),A())}function T(O){f(O.target.value),k.current&&(k.current.style.height="auto",k.current.style.height=`${Math.min(k.current.scrollHeight,160)}px`)}return y.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[y.jsxs("div",{ref:x,className:"flex-1 overflow-y-auto px-5 py-5 space-y-5",children:[r.map(O=>{var N,R;return y.jsxs("div",{className:`flex gap-3 ${O.role==="user"?"flex-row-reverse":""}`,children:[y.jsx("div",{className:`flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center text-[10px] font-mono mt-0.5 ${O.role==="user"?"border border-[#E43A9C]/30 text-[#E43A9C]":"bg-[#282828] border border-white/[0.07] text-zinc-500"}`,style:O.role==="user"?{background:"rgba(228,58,156,0.12)"}:void 0,children:O.role==="user"?((R=(N=t==null?void 0:t.user)==null?void 0:N.email)==null?void 0:R.charAt(0).toUpperCase())??"U":y.jsx(Ia,{height:12})}),y.jsxs("div",{className:`flex flex-col gap-1.5 max-w-[72%] ${O.role==="user"?"items-end":"items-start"}`,children:[O.toolCall&&y.jsxs("button",{type:"button",onClick:()=>w(b===O.id?null:O.id),className:"w-full text-left border border-white/[0.07] bg-[#1e1e1e] rounded-xl px-3 py-2 flex items-center gap-2 hover:border-[#E43A9C]/25 transition-colors",children:[y.jsx(qf,{className:"w-3 h-3 text-[#E43A9C] flex-shrink-0"}),y.jsx("span",{className:"text-[11px] font-mono text-zinc-400 flex-1",children:O.toolCall.name}),y.jsx(Pt,{variant:O.toolCall.status==="done"?"success":O.toolCall.status==="error"?"error":"warning",children:O.toolCall.status}),y.jsx(wz,{className:`w-3 h-3 text-zinc-600 transition-transform flex-shrink-0 ${b===O.id?"rotate-180":""}`})]}),O.toolCall&&b===O.id&&y.jsx("div",{className:"w-full bg-[#181818] border border-white/[0.06] rounded-xl px-3 py-2",children:y.jsx("p",{className:"text-[11px] font-mono text-zinc-500",children:O.toolCall.result})}),O.attachmentName&&y.jsx("div",{className:"rounded-xl border border-white/[0.08] bg-[#1e1e1e] px-3 py-2 text-[11px] font-mono text-zinc-400",children:O.attachmentName}),O.content&&y.jsx("div",{className:`rounded-2xl px-4 py-2.5 text-sm leading-relaxed ${O.role==="user"?"text-white rounded-tr-sm":"bg-[#222222] border border-white/[0.07] text-zinc-200 rounded-tl-sm"}`,style:O.role==="user"?{background:"linear-gradient(135deg, #D83333 0%, #C0285E 100%)"}:void 0,children:O.role==="user"?y.jsx("p",{className:"whitespace-pre-wrap",children:O.content}):y.jsx("div",{className:"prose-io",dangerouslySetInnerHTML:{__html:it.parse(O.content)}})}),y.jsx("span",{className:"text-[11px] text-zinc-700 font-mono px-0.5",children:lp(O.timestamp,e)})]})]},O.id)}),a&&y.jsxs("div",{className:"flex gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center bg-[#282828] border border-white/[0.07] mt-0.5",children:y.jsx(Ia,{height:12})}),y.jsx("div",{className:"bg-[#222222] border border-white/[0.07] rounded-2xl rounded-tl-sm px-4 py-3 flex items-center gap-1.5",children:[0,120,240].map(O=>y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#E43A9C] animate-bounce",style:{animationDelay:`${O}ms`}},O))})]}),i&&n&&y.jsxs("div",{className:"flex gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center bg-[#282828] border border-white/[0.07] mt-0.5",children:y.jsx(Ia,{height:12})}),y.jsx("div",{className:"bg-[#222222] border border-white/[0.07] rounded-2xl rounded-tl-sm px-4 py-2.5 max-w-[72%]",children:y.jsx("div",{className:"prose-io text-sm",dangerouslySetInnerHTML:{__html:it.parse(n)}})})]}),i&&!n&&y.jsxs("div",{className:"flex gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center bg-[#282828] border border-white/[0.07] mt-0.5",children:y.jsx(Ia,{height:12})}),y.jsx("div",{className:"bg-[#222222] border border-white/[0.07] rounded-2xl rounded-tl-sm px-4 py-3 flex items-center gap-1.5",children:[0,120,240].map(O=>y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#E43A9C] animate-bounce",style:{animationDelay:`${O}ms`}},O))})]})]}),y.jsxs("div",{className:"border-t border-white/[0.06] p-4 flex-shrink-0",children:[y.jsxs("div",{className:"bg-[#1e1e1e] border border-white/[0.08] rounded-2xl overflow-hidden transition-colors focus-within:border-[#E43A9C]/30",children:[y.jsx("input",{ref:S,type:"file",className:"hidden",onChange:O=>{var N;return v(((N=O.target.files)==null?void 0:N[0])??null)}}),m&&y.jsxs("div",{className:"px-4 pt-3 text-[11px] font-mono text-zinc-400",children:["Attached: ",m.name]}),y.jsx("textarea",{ref:k,value:p,onChange:T,onKeyDown:C,placeholder:"Message IO…",rows:1,className:"w-full bg-transparent px-4 pt-3 pb-1 text-sm text-zinc-200 placeholder:text-zinc-700 resize-none focus:outline-none",style:{minHeight:"42px",maxHeight:"160px",fontFamily:"Inter, sans-serif"}}),y.jsxs("div",{className:"flex items-center justify-between px-3 pb-2.5",children:[y.jsx("button",{type:"button",onClick:()=>{var O;return(O=S.current)==null?void 0:O.click()},className:"p-1.5 rounded-lg hover:bg-white/[0.05] text-zinc-700 hover:text-zinc-400 transition-colors",children:y.jsx(DP,{className:"w-4 h-4"})}),y.jsx("div",{className:"flex items-center gap-2",children:i?y.jsxs("button",{type:"button",onClick:()=>c(),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-zinc-800 hover:bg-zinc-700 text-[11px] font-mono text-zinc-300 transition-colors",children:[y.jsx(up,{className:"w-3 h-3"})," Stop"]}):y.jsx("button",{type:"button",onClick:A,disabled:!p.trim()&&!m||a,className:"p-2 rounded-xl text-white disabled:opacity-30 disabled:cursor-not-allowed transition-opacity hover:opacity-90",style:{background:"linear-gradient(135deg, #D83333, #E43A9C)"},children:y.jsx(zP,{className:"w-3.5 h-3.5"})})})]})]}),y.jsx("p",{className:"text-center text-[11px] text-zinc-800 font-mono mt-2",children:"IO may make mistakes. Verify important outputs."})]})]})}const HE=["#38bdf8","#a78bfa","#34d399","#f59e0b","#f87171","#E43A9C"];function Mq(t){let e=0;for(let r=0;r<t.length;r++)e=t.charCodeAt(r)+((e<<5)-e);return HE[Math.abs(e)%HE.length]}function WE({name:t,color:e}){const r=t.toLowerCase(),n=e??(r==="orchestrator"||r==="io"?"#71717a":Mq(t));return y.jsx("span",{className:"inline-flex items-center px-1.5 py-px rounded text-[10px] font-mono border",style:{background:`${n}15`,color:n,borderColor:`${n}30`},children:t})}function mc(t){return t.status==="pending"}function Dq(){const[t,e]=j.useState([]),[r,n]=j.useState(null),[i,a]=j.useState(new Set),[o,c]=j.useState("all"),u=Fa();j.useEffect(()=>{Ge.get("/inbox").then(A=>e(A.entries??[])).catch(()=>{})},[]);const d=t.filter(mc).length,p=o==="unread"?t.filter(mc):t,f=p.length>0&&p.every(A=>i.has(A.id)),m=i.size>0;function v(A){m||(n(A),mc(A)&&(Ge.put(`/inbox/${A.id}/read`,{}).catch(()=>{}),e(C=>C.map(T=>T.id===A.id?{...T,status:"read"}:T))))}function b(A,C){A.stopPropagation(),a(T=>{const O=new Set(T);return O.has(C)?O.delete(C):O.add(C),O})}function w(){a(f?new Set:new Set(p.map(A=>A.id)))}function x(){const A=Array.from(i);Promise.allSettled(A.map(C=>Ge.put(`/inbox/${C}/read`,{}))),e(C=>C.map(T=>i.has(T.id)?{...T,status:"read"}:T)),a(new Set)}function k(){const A=Array.from(i);Promise.allSettled(A.map(C=>Ge.delete(`/inbox/${C}`))),e(C=>C.filter(T=>!i.has(T.id))),r&&i.has(r.id)&&n(null),a(new Set)}function S(A){Ge.delete(`/inbox/${A}`).catch(()=>{}),e(C=>C.filter(T=>T.id!==A)),(r==null?void 0:r.id)===A&&n(null)}return y.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[y.jsxs("div",{className:"w-72 flex-shrink-0 border-r border-white/[0.06] flex flex-col overflow-hidden",children:[y.jsxs("div",{className:"px-4 py-3 border-b border-white/[0.06] flex-shrink-0 space-y-2",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"text-lg tracking-wide text-zinc-200",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Inbox"}),d>0&&y.jsxs(Pt,{variant:"default",children:[d," unread"]})]}),y.jsx("div",{className:"flex gap-1",children:["all","unread"].map(A=>y.jsx("button",{type:"button",onClick:()=>{c(A),a(new Set)},className:`flex-1 py-1 text-[11px] font-mono rounded-lg transition-colors cursor-pointer ${o===A?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300"}`,style:o===A?{background:"rgba(228,58,156,0.12)"}:void 0,children:A},A))})]}),m&&y.jsxs("div",{className:"px-3 py-2 border-b border-white/[0.06] flex items-center gap-1.5 flex-shrink-0",style:{background:"rgba(228,58,156,0.06)"},children:[y.jsxs("span",{className:"text-[10px] font-mono text-zinc-500 flex-1",children:[i.size," selected"]}),y.jsxs("button",{type:"button",onClick:x,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-mono text-zinc-400 hover:text-zinc-200 hover:bg-white/[0.06] transition-colors cursor-pointer",children:[y.jsx(Zb,{className:"w-3 h-3"}),"Mark read"]}),y.jsxs("button",{type:"button",onClick:k,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-mono text-red-400 hover:text-red-300 hover:bg-red-500/10 transition-colors cursor-pointer",children:[y.jsx(Da,{className:"w-3 h-3"}),"Delete"]})]}),p.length>0&&y.jsxs("div",{className:"px-4 py-1.5 border-b border-white/[0.04] flex items-center gap-2 flex-shrink-0",children:[y.jsx("button",{type:"button",onClick:w,className:`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors cursor-pointer ${f?"border-[#E43A9C] bg-[#E43A9C]":"border-white/20 hover:border-white/40"}`,children:f&&y.jsx("svg",{className:"w-2 h-2 text-white",fill:"none",viewBox:"0 0 8 8","aria-hidden":"true",children:y.jsx("path",{d:"M1 4l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700",children:"Select all"})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto",children:[p.map(A=>{const C=i.has(A.id),T=(r==null?void 0:r.id)===A.id&&!m;return y.jsxs("div",{onClick:()=>v(A),onKeyDown:O=>O.key==="Enter"&&v(A),className:`flex items-start gap-2.5 px-3 py-3 border-b border-white/[0.04] cursor-pointer transition-colors ${T?"border-l-2 border-l-[#E43A9C] pl-2.5":"hover:bg-white/[0.025]"} ${C?"bg-[#E43A9C]/5":""}`,style:T?{background:"rgba(228,58,156,0.05)"}:void 0,children:[y.jsx("button",{type:"button",onClick:O=>b(O,A.id),className:`mt-0.5 w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors cursor-pointer ${C?"border-[#E43A9C] bg-[#E43A9C]":"border-white/20 hover:border-white/50"}`,children:C&&y.jsx("svg",{className:"w-2 h-2 text-white",fill:"none",viewBox:"0 0 8 8","aria-hidden":"true",children:y.jsx("path",{d:"M1 4l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[mc(A)&&y.jsx("div",{className:"w-1 h-1 rounded-full bg-[#E43A9C] flex-shrink-0"}),y.jsx(WE,{name:A.squadName??(A.squadId?A.squadId.slice(0,8):"Orchestrator"),color:A.squadColor})]}),y.jsx("p",{className:`text-[11px] truncate ${mc(A)?"text-zinc-200":"text-zinc-500"}`,children:A.title}),y.jsx("p",{className:"text-[10px] text-zinc-700 font-mono mt-1",children:Fs(A.createdAt,u)})]})]},A.id)}),p.length===0&&y.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[y.jsx(Qb,{size:32,className:"text-zinc-800 mb-2"}),y.jsx("p",{className:"text-[11px] font-mono text-zinc-700",children:o==="unread"?"All caught up":"No items yet"})]})]})]}),y.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:r&&!m?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"px-6 py-4 border-b border-white/[0.06] flex items-start justify-between flex-shrink-0",children:[y.jsxs("div",{className:"flex-1 min-w-0 mr-4",children:[y.jsx(WE,{name:r.squadName??(r.squadId?r.squadId.slice(0,8):"Orchestrator"),color:r.squadColor}),y.jsx("h3",{className:"text-sm font-mono text-zinc-100 mt-1.5",children:r.title}),y.jsx("p",{className:"text-[11px] text-zinc-700 font-mono mt-0.5",children:Fs(r.createdAt,u)})]}),y.jsxs("button",{type:"button",onClick:()=>S(r.id),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",children:[y.jsx(Da,{className:"w-3 h-3"}),"Delete"]})]}),y.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:y.jsx($u,{content:r.content})})]}):m?y.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 text-center px-8",children:[y.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center border border-[#E43A9C]/20",style:{background:"rgba(228,58,156,0.08)"},children:y.jsx(Qb,{className:"w-4 h-4 text-[#E43A9C]"})}),y.jsxs("div",{children:[y.jsxs("p",{className:"text-sm font-mono text-zinc-300",children:[i.size," message",i.size!==1?"s":""," selected"]}),y.jsx("p",{className:"text-[11px] text-zinc-600 mt-1",children:"Use the actions above to mark as read or delete"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("button",{type:"button",onClick:x,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-zinc-300 border border-white/[0.1] hover:bg-white/[0.05] transition-colors cursor-pointer",children:[y.jsx(Zb,{className:"w-3 h-3"}),"Mark read"]}),y.jsxs("button",{type:"button",onClick:k,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-red-400 border border-red-500/20 hover:bg-red-500/10 transition-colors cursor-pointer",children:[y.jsx(Da,{className:"w-3 h-3"}),"Delete selected"]})]})]}):y.jsx("div",{className:"flex-1 flex items-center justify-center text-zinc-700 font-mono text-xs",children:"Select an item to read"})})]})}function Lq(){const{signIn:t}=mp(),[e,r]=j.useState(""),[n,i]=j.useState(""),[a,o]=j.useState(null),[c,u]=j.useState(!1);async function d(p){p.preventDefault(),o(null),u(!0);const{error:f}=await t(e,n);f&&o(f),u(!1)}return y.jsxs("div",{className:"min-h-screen bg-[#161616] flex items-center justify-center relative overflow-hidden",children:[y.jsx("div",{className:"absolute inset-0 opacity-[0.04]",style:{backgroundImage:"radial-gradient(circle, #E43A9C 1px, transparent 1px)",backgroundSize:"32px 32px"}}),y.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-[60%] w-[400px] h-[300px] rounded-full blur-3xl pointer-events-none",style:{background:"radial-gradient(ellipse, rgba(228,58,156,0.12) 0%, transparent 70%)"}}),y.jsxs("div",{className:"relative z-10 w-full max-w-[360px] mx-4",children:[y.jsxs("div",{className:"flex flex-col items-center mb-8 gap-3",children:[y.jsx(Ia,{height:52}),y.jsx("div",{className:"text-center",children:y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 tracking-widest uppercase mt-1",children:"personal ai orchestrator"})})]}),y.jsxs("form",{onSubmit:d,className:"glass-card border border-white/[0.07] rounded-2xl p-6 space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{htmlFor:"login-email",className:"text-[11px] font-mono text-zinc-500 block",children:"Email"}),y.jsx("input",{id:"login-email",type:"email",value:e,onChange:p=>r(p.target.value),required:!0,className:"w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2.5 text-sm text-zinc-200 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/15 transition-colors"})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{htmlFor:"login-password",className:"text-[11px] font-mono text-zinc-500 block",children:"Password"}),y.jsx("input",{id:"login-password",type:"password",value:n,onChange:p=>i(p.target.value),required:!0,placeholder:"••••••••",className:"w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2.5 text-sm text-zinc-200 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/15 transition-colors"})]}),a&&y.jsx("p",{className:"text-[11px] font-mono text-red-400",children:a}),y.jsx("button",{type:"submit",disabled:c,className:"w-full text-white font-mono text-sm rounded-xl py-3 mt-1 transition-opacity hover:opacity-90 disabled:opacity-50 flex items-center justify-center gap-2",style:{background:"linear-gradient(135deg, #D83333 0%, #E43A9C 55%, #F041FF 100%)"},children:c?y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Authenticating…"]}):"Sign In"})]}),y.jsx("p",{className:"text-center text-[11px] text-zinc-700 font-mono mt-4",children:"Secured by Supabase Auth"})]})]})}const jR="w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/10 transition-colors",Ls="bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/10 transition-colors";function Fi({label:t,hint:e,align:r="center",children:n}){const i=r==="start"?"flex-1 min-w-0":"flex-1 flex justify-end items-center";return y.jsxs("div",{className:`glass-card border border-white/[0.07] rounded-2xl px-4 py-3.5 flex gap-4 ${r==="start"?"items-start":"items-center"}`,children:[y.jsxs("div",{className:"w-[140px] shrink-0",children:[y.jsx("span",{className:"text-[11px] font-mono text-zinc-400",children:t}),e&&y.jsxs("span",{className:"text-[10px] font-mono text-zinc-700 ml-1.5",children:["(",e,")"]})]}),y.jsx("div",{className:i,children:n})]})}function zq({onSave:t,onCancel:e,squads:r}){var b;const[n,i]=j.useState("io"),[a,o]=j.useState(((b=r[0])==null?void 0:b.id)??""),[c,u]=j.useState(""),[d,p]=j.useState(""),[f,m]=j.useState(""),v=()=>{!d.trim()||!f.trim()||!c.trim()||t({name:c.trim(),targetType:n==="io"?"orchestrator":"squad",targetId:n==="squad"?a:void 0,cron:d.trim(),prompt:f.trim()})};return y.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center p-6",style:{background:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)"},children:y.jsxs("div",{className:"glass-card border border-white/[0.09] rounded-2xl w-full max-w-lg shadow-2xl flex flex-col",style:{maxHeight:"90vh"},children:[y.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-white/[0.06] flex-shrink-0",children:[y.jsx("h3",{className:"text-lg tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"New Schedule"}),y.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded-lg text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.06] transition-colors cursor-pointer",children:y.jsx(UP,{className:"w-4 h-4"})})]}),y.jsxs("div",{className:"overflow-y-auto flex-1 px-5 py-4 space-y-2",children:[y.jsx(Fi,{label:"Name",children:y.jsx("input",{value:c,onChange:w=>u(w.target.value),placeholder:"Daily triage",className:`${Ls} w-48`})}),y.jsx(Fi,{label:"Type",children:y.jsx("div",{className:"flex gap-2",children:["io","squad"].map(w=>y.jsx("button",{type:"button",onClick:()=>i(w),className:`px-4 py-1.5 rounded-xl text-[11px] font-mono capitalize transition-colors border cursor-pointer ${n===w?"text-[#E43A9C] border-[#E43A9C]/30":"text-zinc-500 border-white/[0.08] hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:n===w?{background:"rgba(228,58,156,0.08)"}:void 0,children:w==="io"?"IO":"Squad"},w))})}),n==="squad"&&y.jsx(Fi,{label:"Squad",children:y.jsx("select",{value:a,onChange:w=>o(w.target.value),className:`${Ls} w-48`,children:r.map(w=>y.jsx("option",{value:w.id,style:{background:"#1a1a1a",color:"#d4d4d8"},children:w.name},w.id))})}),y.jsx(Fi,{label:"Cron Expression",children:y.jsx("input",{value:d,onChange:w=>p(w.target.value),placeholder:"0 9 * * 1-5",className:`${Ls} w-40`})}),y.jsx(Fi,{label:"Prompt",hint:"supports Markdown",align:"start",children:y.jsx("textarea",{value:f,onChange:w=>m(w.target.value),placeholder:"Describe what IO or the squad should do when this schedule fires.",rows:8,className:`${jR} resize-none leading-relaxed`})})]}),y.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3.5 border-t border-white/[0.06] flex-shrink-0",children:[y.jsx(wi,{onClick:e,children:"Cancel"}),y.jsxs(Ba,{onClick:v,className:"px-4 py-1.5",children:[y.jsx(cp,{className:"w-3 h-3"}),"Create Schedule"]})]})]})})}function Bq({sched:t,squads:e,onSave:r,onBack:n}){var b,w;const[i,a]=j.useState(t.name),[o,c]=j.useState(t.cron),[u,d]=j.useState(t.prompt),[p,f]=j.useState(t.targetId??((b=e[0])==null?void 0:b.id)??""),m=()=>{!o.trim()||!u.trim()||!i.trim()||r({name:i.trim(),cron:o.trim(),prompt:u.trim(),targetId:t.targetType==="squad"?p:void 0})},v=t.targetType==="orchestrator"?"IO Schedule":`Squad — ${((w=e.find(x=>x.id===t.targetId))==null?void 0:w.name)??"Unknown"}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6 max-w-3xl",children:[y.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[y.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 text-[11px] font-mono text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:[y.jsx(vl,{className:"w-3.5 h-3.5"}),"Schedules"]}),y.jsx("span",{className:"text-zinc-700 text-[11px]",children:"/"}),y.jsx("span",{className:"text-[11px] font-mono text-zinc-400",children:"Edit"})]}),y.jsxs("div",{className:"flex items-start justify-between mb-6",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Edit Schedule"}),y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mt-0.5",children:v})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(wi,{onClick:n,children:"Cancel"}),y.jsxs(Ba,{onClick:m,className:"px-4 py-1.5",children:[y.jsx(cp,{className:"w-3 h-3"}),"Save Changes"]})]})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsx(Fi,{label:"Name",children:y.jsx("input",{value:i,onChange:x=>a(x.target.value),placeholder:"Schedule name",className:`${Ls} w-48`})}),t.targetType==="squad"&&y.jsx(Fi,{label:"Squad",children:y.jsx("select",{value:p,onChange:x=>f(x.target.value),className:`${Ls} w-48`,children:e.map(x=>y.jsx("option",{value:x.id,style:{background:"#1a1a1a",color:"#d4d4d8"},children:x.name},x.id))})}),y.jsx(Fi,{label:"Cron Expression",children:y.jsx("input",{value:o,onChange:x=>c(x.target.value),placeholder:"0 9 * * 1-5",className:`${Ls} w-40`})}),y.jsx(Fi,{label:"Prompt",hint:"supports Markdown",align:"start",children:y.jsxs("div",{className:"space-y-1.5",children:[y.jsx("textarea",{value:u,onChange:x=>d(x.target.value),placeholder:"Describe what IO or the squad should do when this schedule fires.",className:`${jR} leading-relaxed resize-y`,style:{minHeight:"360px"}}),y.jsx("p",{className:"text-[10px] font-mono text-zinc-700",children:"Tip: use # headings and - lists to structure multi-step instructions."})]})})]})]})}function Uq(){const[t,e]=j.useState("squad"),[r,n]=j.useState([]),[i,a]=j.useState([]),[o,c]=j.useState(!1),[u,d]=j.useState(null),p=Fa();j.useEffect(()=>{f(),m()},[]);function f(){Ge.get("/schedules").then(R=>n(R.schedules)).catch(()=>{})}function m(){Ge.get("/squads").then(R=>a(R.squads)).catch(()=>{})}const v=r.filter(R=>R.targetType==="squad"),b=r.filter(R=>R.targetType==="orchestrator"),w=t==="squad"?v:b;async function x(R){try{await Ge.post("/schedules",R),Qe.success("Schedule created"),c(!1),f()}catch($){Qe.error($ instanceof Error?$.message:"Failed to create")}}async function k(R){if(u)try{await Ge.patch(`/schedules/${u.id}`,R),Qe.success("Schedule saved"),d(null),f()}catch{Qe.error("Failed to save schedule")}}const[S,A]=j.useState(null);async function C(R,$){A(R);try{await Ge.patch(`/schedules/${R}`,{enabled:!$}),Qe.success($?"Schedule paused":"Schedule resumed"),f()}catch{Qe.error("Failed to toggle schedule")}finally{A(null)}}async function T(R){A(R);try{await Ge.post(`/schedules/${R}/run`,{}),Qe.success("Schedule triggered")}catch{Qe.error("Failed to trigger schedule")}finally{A(null)}}async function O(R){A(R);try{await Ge.delete(`/schedules/${R}`),Qe.success("Schedule deleted"),f()}catch{Qe.error("Failed to delete")}finally{A(null)}}if(u)return y.jsx(Bq,{sched:u,squads:i,onSave:k,onBack:()=>d(null)});const N=t==="squad"?["Squad","Name","Cron","Next Run","Status",""]:["Name","Cron","Next Run","Status",""];return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o&&y.jsx(zq,{onSave:x,onCancel:()=>c(!1),squads:i}),y.jsxs("div",{className:"flex items-center justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Schedules"}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:[r.filter(R=>R.enabled).length," active ·"," ",r.filter(R=>!R.enabled).length," paused"]})]}),y.jsxs(Ba,{onClick:()=>c(!0),className:"px-3 py-1.5",children:[y.jsx(n1,{className:"w-3.5 h-3.5"}),"Add Schedule"]})]}),y.jsx("div",{className:"flex gap-1 mb-4",children:[["squad","Squad Schedules"],["io","IO Schedules"]].map(([R,$])=>y.jsx("button",{type:"button",onClick:()=>e(R),className:`px-4 py-2 text-[11px] font-mono rounded-xl transition-colors cursor-pointer ${t===R?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:t===R?{background:"rgba(228,58,156,0.12)"}:void 0,children:$},R))}),y.jsx("div",{className:"overflow-x-auto rounded-2xl border border-white/[0.07] glass-card",children:w.length===0?y.jsx("div",{className:"px-4 py-12 text-center text-zinc-600 font-mono text-sm",children:"No schedules for this category"}):y.jsxs("table",{className:"w-full text-[11px] font-mono min-w-[640px]",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06]",style:{background:"rgba(20,20,20,0.6)"},children:N.map(R=>y.jsx("th",{className:"text-left px-4 py-2.5 text-zinc-600 font-medium",children:R},R))})}),y.jsx("tbody",{children:w.map(R=>{var $,K;return y.jsxs("tr",{className:`border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors ${R.enabled?"":"opacity-50"}`,children:[t==="squad"?y.jsx("td",{className:"px-4 py-3",children:y.jsx(LB,{name:(($=i.find(z=>z.id===R.targetId))==null?void 0:$.name)??"Unknown",color:(K=i.find(z=>z.id===R.targetId))==null?void 0:K.color})}):null,y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:R.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600 text-[10px]",children:R.cron}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(Qw,{className:"w-3 h-3"}),R.enabled&&R.nextRun?Fs(R.nextRun,p):"—"]})}),y.jsx("td",{className:"px-4 py-3",children:y.jsx(Pt,{variant:R.enabled?"success":"muted",children:R.enabled?"active":"paused"})}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:`flex items-center gap-1 ${S===R.id?"opacity-50 pointer-events-none":""}`,children:[y.jsxs(wi,{onClick:()=>T(R.id),children:[y.jsx(oB,{className:"w-3 h-3"}),"Run now"]}),y.jsx(zB,{onClick:()=>C(R.id,R.enabled),children:R.enabled?y.jsxs(y.Fragment,{children:[y.jsx(tB,{className:"w-3 h-3"}),"Pause"]}):y.jsxs(y.Fragment,{children:[y.jsx(qf,{className:"w-3 h-3"}),"Resume"]})}),y.jsxs(wi,{onClick:()=>d(R),children:[y.jsx(nB,{className:"w-3 h-3"}),"Edit"]}),y.jsxs(Gf,{onClick:()=>O(R.id),children:[y.jsx(Da,{className:"w-3 h-3"}),"Delete"]})]})})]},R.id)})})]})})]})}const qq=[{id:"general",label:"General"},{id:"telegram",label:"Telegram"},{id:"auth",label:"Auth"}],Bo="rounded-xl border border-white/[0.07] bg-white/[0.04] px-3 py-2 text-sm font-mono text-zinc-300 outline-none focus:border-[#E43A9C]/50",KE=`${Bo} w-[72px]`,Fq=`${Bo} w-[100px]`,GE=`${Bo} w-[200px]`,VE=`${Bo} w-[320px]`,Hq=`${Bo} w-[140px] appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%2371717a%22%20d%3D%22M3%204.5L6%208l3-3.5H3z%22%2F%3E%3C%2Fsvg%3E')] bg-[position:right_10px_center] bg-no-repeat pr-8`;function Wq(){const[t,e]=j.useState(null),[r,n]=j.useState("general");j.useEffect(()=>{Ge.get("/config").then(o=>e(o.config)).catch(()=>{})},[]);function i(o){t&&e({...t,...o})}async function a(){if(t)try{const{dataDir:o,...c}=t;await Ge.patch("/config",c),Qe.success("Settings saved")}catch{Qe.error("Failed to save settings")}}return t?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsxs("div",{className:"max-w-3xl",children:[y.jsx("h2",{className:"mb-6 text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Settings"}),y.jsx("div",{className:"mb-6 flex gap-6 border-b border-white/[0.07]",children:qq.map(o=>y.jsx("button",{type:"button",onClick:()=>n(o.id),className:`-mb-px border-b-2 px-1 pb-3 text-[11px] font-mono transition-colors ${r===o.id?"border-[#E43A9C] text-[#E43A9C]":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:o.label},o.id))}),y.jsxs("div",{className:"glass-card rounded-2xl border border-white/[0.07] p-5",children:[r==="general"&&y.jsxs(y.Fragment,{children:[y.jsx(Bn,{label:"Log Level",children:y.jsx("select",{value:t.logLevel,onChange:o=>i({logLevel:o.target.value}),className:Hq,children:["trace","debug","info","warn","error","fatal"].map(o=>y.jsx("option",{value:o,children:o},o))})}),y.jsx(Bn,{label:"Default Model",children:y.jsx("input",{type:"text",value:t.defaultModel,onChange:o=>i({defaultModel:o.target.value}),className:GE})}),y.jsx(Bn,{label:"Timezone",children:y.jsx("select",{value:t.timezone,onChange:o=>i({timezone:o.target.value}),className:`${Bo} w-[200px] appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%2371717a%22%20d%3D%22M3%204.5L6%208l3-3.5H3z%22%2F%3E%3C%2Fsvg%3E')] bg-[position:right_10px_center] bg-no-repeat pr-8`,children:Q4.map(o=>y.jsx("option",{value:o.value,children:o.label},o.value))})}),y.jsx(Bn,{label:"Max Instances",children:y.jsx("input",{type:"number",value:t.maxInstancesPerSquad,onChange:o=>i({maxInstancesPerSquad:Number(o.target.value)}),className:KE,min:1,max:10})}),y.jsx(Bn,{label:"API Port",children:y.jsx("input",{type:"number",value:t.apiPort,onChange:o=>i({apiPort:Number(o.target.value)}),className:KE})}),y.jsx(Bn,{label:"Pricing Refresh (hrs)",children:y.jsx("input",{type:"number",value:t.pricing.refreshIntervalHours,onChange:o=>i({pricing:{refreshIntervalHours:Number(o.target.value)}}),className:Fq,min:1})}),y.jsx(Bn,{label:"Data Dir",children:y.jsx("input",{type:"text",value:t.dataDir,readOnly:!0,className:`${VE} cursor-default text-zinc-500`})})]}),r==="telegram"&&y.jsxs(y.Fragment,{children:[y.jsx(Bn,{label:"Bot Token",children:y.jsx(XE,{value:t.telegram.botToken??"",onChange:o=>i({telegram:{...t.telegram,botToken:o||null}}),size:"lg"})}),y.jsx(Bn,{label:"Allowed Chat IDs",children:y.jsx("input",{type:"text",value:t.telegram.allowedChatIds.join(", "),onChange:o=>i({telegram:{...t.telegram,allowedChatIds:o.target.value.split(",").map(c=>Number(c.trim())).filter(c=>!Number.isNaN(c))}}),className:GE})})]}),r==="auth"&&y.jsxs(y.Fragment,{children:[y.jsx(Bn,{label:"Project URL",children:y.jsx("input",{type:"text",value:t.supabase.projectUrl??"",onChange:o=>i({supabase:{...t.supabase,projectUrl:o.target.value||null}}),className:VE})}),y.jsx(Bn,{label:"Anon Key",children:y.jsx(XE,{value:t.supabase.anonKey??"",onChange:o=>i({supabase:{...t.supabase,anonKey:o||null}}),size:"lg"})})]}),y.jsx("div",{className:"flex justify-end pt-6",children:y.jsx(Ba,{onClick:a,className:"px-4 py-2.5",children:"Save Settings"})})]})]})}):y.jsx("div",{className:"flex h-full items-center justify-center text-zinc-600",children:"Loading..."})}function Bn({label:t,children:e}){return y.jsxs("div",{className:"flex items-center justify-between gap-6 border-b border-white/[0.07] py-3",children:[y.jsx("span",{className:"text-[11px] font-mono text-zinc-400 shrink-0",children:t}),y.jsx("div",{className:"flex justify-end",children:e})]})}function XE({value:t,onChange:e,size:r="lg"}){const[n,i]=j.useState(!1),a=r==="lg"?"w-[320px]":"w-[200px]";return y.jsxs("div",{className:"relative",children:[y.jsx("input",{type:n?"text":"password",value:t,onChange:o=>e(o.target.value),className:`${Bo} ${a} pr-9`}),y.jsx("button",{type:"button",onClick:()=>i(o=>!o),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-zinc-600 transition-colors hover:text-zinc-400","aria-label":n?"Hide value":"Show value",children:n?y.jsx(Iz,{size:14}):y.jsx(Zb,{size:14})})]})}function gf(t){return"url"in t&&t.url?t.url:t.name}const Kq=[{id:"installed",label:"Installed"},{id:"awesome-copilot",label:"Awesome Copilot"},{id:"skillssh",label:"skills.sh"}];function YE(t){return t==="awesome-copilot"?"Awesome Copilot":"skills.sh"}function JE(t){return t?t>=1e6?`${(t/1e6).toFixed(1).replace(/\.0$/,"")}M installs`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}K installs`:`${t} installs`:null}function Gq(t){const e=t.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);if(!e)return{frontMatter:{},body:t};const r=e[1]??"",n=e[2]??"",i={};let a="",o=null;for(const c of r.split(`
|
|
449
|
-
`)){const u=c.match(/^(\w[\w-]*)\s*:\s*(.*)$/);if(u){a&&o&&(i[a]=o,o=null),a=u[1]??"";const d=(u[2]??"").trim();d===""||d==="[]"?o=[]:d.startsWith("[")&&d.endsWith("]")?i[a]=d.slice(1,-1).split(",").map(p=>p.trim().replace(/^["']|["']$/g,"")):i[a]=d.replace(/^["']|["']$/g,"")}else c.match(/^\s+-\s+(.+)/)&&a&&(o||(o=[]),o.push(c.replace(/^\s+-\s+/,"").trim()))}return a&&o&&(i[a]=o),{frontMatter:i,body:n}}const ZE=["name","description","version","author","license","argument_hint","argument-hint","use_when","use-when","enhancements","metadata","tags"];function Vq({content:t}){const{frontMatter:e,body:r}=Gq(t),n=ZE.filter(o=>e[o]!==void 0),i=Object.keys(e).filter(o=>!ZE.includes(o)),a=[...n,...i];return y.jsxs("div",{children:[a.length>0&&y.jsxs("div",{className:"border-b border-white/[0.05] pb-4 mb-4",children:[y.jsx("p",{className:"text-[10px] font-mono text-zinc-700 uppercase tracking-wider mb-3",children:"Front Matter"}),y.jsx("div",{className:"space-y-2",children:a.map(o=>{const c=e[o];return c==null||Array.isArray(c)&&c.length===0?null:y.jsxs("div",{className:"flex gap-3 items-start",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 w-28 flex-shrink-0 pt-0.5",children:o}),y.jsx("div",{className:"flex-1 min-w-0",children:Array.isArray(c)?y.jsx("div",{className:"flex flex-wrap gap-1",children:c.map(u=>y.jsx(Pt,{variant:"muted",children:u},`${o}-${u}`))}):typeof c=="object"?y.jsx("div",{className:"space-y-0.5",children:Object.entries(c).map(([u,d])=>y.jsxs("p",{className:"text-[11px] font-mono text-zinc-400",children:[y.jsxs("span",{className:"text-zinc-600",children:[u,":"]})," ",d]},u))}):o==="use_when"||o==="use-when"?y.jsx("p",{className:"text-[11px] text-zinc-300 leading-relaxed",children:c}):o==="argument_hint"||o==="argument-hint"?y.jsx("code",{className:"text-[11px] font-mono text-[#E43A9C] bg-[#2d1a24] px-1.5 py-0.5 rounded",children:c}):y.jsx("span",{className:"text-[11px] font-mono text-zinc-300",children:c})})]},o)})})]}),r.trim()&&y.jsxs("div",{children:[y.jsx("p",{className:"text-[10px] font-mono text-zinc-700 uppercase tracking-wider mb-3",children:"Body"}),y.jsx($u,{content:r})]})]})}function Xq(){const[t,e]=j.useState("installed"),[r,n]=j.useState([]),[i,a]=j.useState([]),[o,c]=j.useState(null),[u,d]=j.useState(null),[p,f]=j.useState(""),[m,v]=j.useState(!1),[b,w]=j.useState(!1),[x,k]=j.useState(!1),[S,A]=j.useState(""),[C,T]=j.useState(null),[O,N]=j.useState(null),R=j.useCallback(async()=>{try{const I=await Ge.get("/skills"),q=new Set(I.skills.map(ee=>(ee.name||"").toLowerCase()));n(I.skills),a(ee=>ee.map(le=>({...le,installed:q.has((le.name||"").toLowerCase())})))}catch(I){Qe.error(I instanceof Error?I.message:"Failed to load skills")}},[]),$=j.useCallback(async I=>{w(!0);try{const q=await Ge.get(`/skills/${encodeURIComponent(I)}`);d(q),A(q.content)}catch(q){Qe.error(q instanceof Error?q.message:"Failed to load skill"),d(null)}finally{w(!1)}},[]);j.useEffect(()=>{R()},[R]),j.useEffect(()=>{if(t==="installed"){N(null);return}const I=p.trim();if(t==="skillssh"&&!I){a([]),N(null),v(!1);return}let q=!1;v(!0);const ee=window.setTimeout(async()=>{try{const le=await Ge.get(`/skills/discover?source=${t}&q=${encodeURIComponent(I)}`);if(q)return;a(le.skills),N(null)}catch(le){if(q)return;a([]),N(le instanceof Error?le.message:"Discovery failed")}finally{q||v(!1)}},250);return()=>{q=!0,window.clearTimeout(ee)}},[p,t]);const K=j.useMemo(()=>{const I=p.trim().toLowerCase();return I?r.filter(q=>[q.name,q.description,q.preview].some(ee=>ee==null?void 0:ee.toLowerCase().includes(I))):r},[r,p]),z=t==="installed"?K:i,U=K.find(I=>I.name===o)??null,F=i.find(I=>gf(I)===o)??null,X=(U==null?void 0:U.name)??(F==null?void 0:F.name)??null;j.useEffect(()=>{if(k(!1),!z.length){c(null),t!=="installed"&&d(null);return}if(!o||!z.some(I=>gf(I)===o)){const I=z[0];I&&c(gf(I))}},[o,t,z]),j.useEffect(()=>{if(t!=="installed"||!X){d(null);return}$(X)},[$,X,t]);async function Y(I){if(!I.url&&!I.registrySource){Qe.error("Install source is not available for this skill yet");return}T(I.name);try{await Ge.post("/skills/install",{name:I.name,source:I.source,url:I.url,registrySource:I.registrySource,skillId:I.skillId}),Qe.success(`Installed ${I.title||I.name}`),await R(),a(q=>q.map(ee=>ee.name===I.name?{...ee,installed:!0}:ee))}catch(q){Qe.error(q instanceof Error?q.message:"Install failed")}finally{T(null)}}async function G(I){T(I);try{await Ge.delete(`/skills/${encodeURIComponent(I)}`),Qe.success(`Removed ${I}`),await R(),a(q=>q.map(ee=>ee.name===I?{...ee,installed:!1}:ee))}catch(q){Qe.error(q instanceof Error?q.message:"Failed to remove skill")}finally{T(null)}}async function Z(){if(u){T(u.name);try{await Ge.put(`/skills/${encodeURIComponent(u.name)}`,{content:S}),Qe.success(`Updated ${u.name}`),k(!1),await Promise.all([R(),$(u.name)])}catch(I){Qe.error(I instanceof Error?I.message:"Failed to save skill")}finally{T(null)}}}const W=!!(U!=null&&U.activatedForOrchestrator),Q=C===(u==null?void 0:u.name),L=C===(F==null?void 0:F.name);return y.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[y.jsxs("div",{className:"w-64 flex-shrink-0 border-r border-white/[0.06] flex flex-col overflow-hidden",children:[y.jsxs("div",{className:"px-2.5 pt-2.5 pb-2 flex-shrink-0 border-b border-white/[0.06] space-y-2",children:[y.jsxs("div",{className:"relative",children:[y.jsx(LP,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-zinc-700"}),y.jsx("input",{type:"text",value:p,onChange:I=>f(I.target.value),placeholder:"Search skills…",className:"w-full bg-[#181818] border border-white/[0.06] rounded-xl pl-7 pr-2 py-1.5 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/30 transition-colors"})]}),y.jsx("div",{className:"flex flex-col gap-0.5",children:Kq.map(I=>y.jsxs("button",{type:"button",onClick:()=>e(I.id),className:`w-full text-left px-2.5 py-1.5 rounded-lg text-[11px] font-mono transition-colors flex items-center justify-between cursor-pointer ${t===I.id?"text-[#E43A9C]":"text-zinc-500 hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:t===I.id?{background:"rgba(228,58,156,0.10)"}:void 0,children:[y.jsx("span",{children:I.label}),I.id==="installed"&&y.jsx("span",{className:"text-[10px] text-zinc-600",children:r.length})]},I.id))})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto py-1.5",children:[m&&t!=="installed"?y.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-white/[0.08] bg-white/[0.03] px-3 py-3 font-mono text-[11px] text-zinc-500",children:[y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"})," Searching registry..."]}):null,z.map(I=>{const q=gf(I),ee=o===q,le=I.description||("preview"in I?I.preview:"No description available.");return y.jsxs("button",{type:"button",onClick:()=>{k(!1),c(q)},className:`w-full text-left px-3 py-2.5 border-b border-white/[0.03] transition-colors cursor-pointer ${ee?"border-l-2 border-l-[#E43A9C] bg-[#E43A9C]/5":"hover:bg-white/[0.03]"}`,children:[y.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[y.jsx("span",{className:"truncate font-mono text-[11px] text-zinc-200",children:I.name}),"installed"in I&&I.installed?y.jsx(Pt,{variant:"success",children:"installed"}):null]}),y.jsx("p",{className:"line-clamp-2 font-mono text-[10px] leading-relaxed text-zinc-600",children:le})]},`${t}:${q}`)}),!m&&z.length===0?y.jsx("div",{className:"px-4 py-8",children:y.jsx("p",{className:"font-mono text-[11px] leading-relaxed text-zinc-500",children:O||(t==="skillssh"&&!p.trim()?"Start typing to search the skills.sh registry.":p.trim()?"No skills match your search.":"No skills available in this source.")})}):null]})]}),y.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-5",children:t==="installed"&&U?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4 border-b border-white/[0.06] pb-5",children:[y.jsxs("div",{className:"flex min-w-0 gap-4",children:[y.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-[#E43A9C]/12 text-[#E43A9C]",children:y.jsx(ex,{className:"h-6 w-6"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate text-[34px] uppercase tracking-[0.08em] text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:U.name}),y.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[y.jsx(Pt,{variant:"success",children:"installed"}),W?y.jsx(Pt,{variant:"warning",children:"active"}):y.jsx(Pt,{variant:"muted",children:"inactive"}),y.jsx(Pt,{variant:"muted",children:"local skill"})]}),y.jsxs("div",{className:"mt-3 space-y-1 font-mono text-[11px] text-zinc-500",children:[y.jsxs("p",{children:["path: ",U.filePath]}),y.jsxs("p",{children:["orchestrator: ",W?"enabled":"disabled"]})]})]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[x?y.jsxs(Ba,{onClick:Z,disabled:Q||S===(u==null?void 0:u.content),className:"px-3 py-2",children:[Q?y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"}):y.jsx(Ff,{className:"h-3.5 w-3.5"}),"Save"]}):y.jsxs(wi,{onClick:()=>k(!0),className:"px-3 py-2",children:[y.jsx(Ff,{className:"h-3.5 w-3.5"})," Edit"]}),y.jsxs(Gf,{onClick:()=>G(U.name),className:"px-3 py-2",children:[Q?y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"}):y.jsx(Da,{className:"h-3.5 w-3.5"}),"Remove"]})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:b&&!u?y.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px] text-zinc-500",children:[y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"})," Loading skill..."]}):x?y.jsxs("div",{className:"space-y-3",children:[y.jsx("textarea",{value:S,onChange:I=>A(I.target.value),className:"min-h-[440px] w-full rounded-2xl border border-white/[0.08] bg-black/30 p-4 font-mono text-[12px] leading-6 text-zinc-200 outline-none transition-colors focus:border-[#E43A9C]/50"}),y.jsxs("div",{className:"flex items-center justify-between font-mono text-[11px] text-zinc-500",children:[y.jsx("span",{children:"Editing raw SKILL.md"}),y.jsx(wi,{onClick:()=>{k(!1),A((u==null?void 0:u.content)??"")},className:"px-3 py-2",children:"Cancel"})]})]}):u?y.jsx(Vq,{content:u.content}):y.jsx("p",{className:"font-mono text-[11px] text-zinc-500",children:"Select an installed skill to inspect it."})})]}):t!=="installed"&&F?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4 border-b border-white/[0.06] pb-5",children:[y.jsxs("div",{className:"flex min-w-0 gap-4",children:[y.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-[#E43A9C]/12 text-[#E43A9C]",children:y.jsx(gB,{className:"h-6 w-6"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate text-[34px] uppercase tracking-[0.08em] text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:F.title||F.name}),y.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[y.jsx(Pt,{variant:F.installed?"success":"default",children:F.installed?"installed":"available"}),y.jsx(Pt,{variant:"muted",children:YE(F.source)}),JE(F.installs)?y.jsx(Pt,{variant:"info",children:JE(F.installs)}):null]}),y.jsxs("div",{className:"mt-3 space-y-1 font-mono text-[11px] text-zinc-500",children:[y.jsxs("p",{children:["registry: ",YE(F.source)]}),F.registrySource?y.jsxs("p",{children:["source: ",F.registrySource]}):null,F.url?y.jsxs("p",{children:["url: ",F.url]}):null]})]})]}),y.jsx("div",{className:"flex items-center gap-2",children:F.installed?y.jsx(wi,{onClick:()=>{e("installed"),c(F.name)},className:"px-3 py-2",children:"Open installed"}):y.jsxs(Ba,{onClick:()=>Y(F),disabled:L||!F.url&&!F.registrySource,className:"px-3 py-2",children:[L?y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"}):y.jsx(Nz,{className:"h-3.5 w-3.5"}),"Install"]})})]}),y.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[y.jsx("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.02] p-5",children:y.jsx("p",{className:"font-mono text-[12px] leading-7 text-zinc-300",children:F.description||"No registry description is available for this skill yet."})}),y.jsx("div",{className:"mt-4 rounded-2xl border border-dashed border-white/[0.08] bg-black/20 p-4 font-mono text-[11px] leading-6 text-zinc-500",children:"Install will fetch the skill definition from the selected registry source and add it to your local skills library."})]})]}):y.jsx("div",{className:"flex h-full items-center justify-center rounded-2xl border border-dashed border-white/[0.08] bg-white/[0.02] p-8 text-center",children:y.jsxs("div",{children:[y.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-[#E43A9C]/12 text-[#E43A9C]",children:y.jsx(ex,{className:"h-6 w-6"})}),y.jsx("h3",{className:"text-[28px] uppercase tracking-[0.08em] text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Select a Skill"}),y.jsx("p",{className:"mt-2 font-mono text-[11px] leading-relaxed text-zinc-500",children:"Choose a skill from the left panel to inspect details, install registry entries, or edit local definitions."})]})})})]})}function $f(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return`hsl(${(e%360+360)%360}, 70%, 65%)`}function yf(){const{name:t,instanceId:e,role:r}=hL();return t&&r?y.jsx(n9,{squadName:t,role:r}):t&&e?y.jsx(r9,{squadName:t,instanceId:e}):t?y.jsx(Zq,{name:t}):y.jsx(Yq,{})}function Yq(){const[t,e]=j.useState([]),[r,n]=j.useState(null),i=gl();return j.useEffect(()=>{Promise.all([Ge.get("/squads"),Ge.get("/config")]).then(([a,o])=>{e(a.squads),n(o.config.maxInstancesPerSquad)}).catch(()=>{})},[]),y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsx("div",{className:"mb-6",children:y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Squads"}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:[t.length," squads · ",t.reduce((a,o)=>a+(o.activeInstances||0),0)," ","active instances"]})]})}),y.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:[t.map(a=>{var c;const o=a.color||"#38bdf8";return y.jsxs("button",{type:"button",onClick:()=>i(`/squads/${a.name}`),className:"text-left rounded-2xl p-5 transition-all group cursor-pointer",style:{border:`1px solid ${o}30`,background:`${o}08`,backdropFilter:"blur(20px)"},onMouseEnter:u=>{u.currentTarget.style.borderColor=`${o}70`,u.currentTarget.style.background=`${o}12`},onMouseLeave:u=>{u.currentTarget.style.borderColor=`${o}30`,u.currentTarget.style.background=`${o}08`},children:[y.jsxs("div",{className:"flex items-start justify-between mb-1",children:[y.jsx("h3",{className:"text-sm font-mono transition-colors",style:{color:o},children:a.name}),y.jsx(Pt,{variant:Ms(a.status),children:a.status})]}),y.jsxs("div",{className:"flex items-center justify-between mb-3",children:[y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono",children:((c=a.config)==null?void 0:c.prMode)??"draft-pr"}),y.jsxs("span",{className:"text-[11px] text-zinc-600 font-mono flex items-center gap-1",children:[y.jsx(Tz,{className:"w-3 h-3"}),a.activeInstances,"/",r??(a.totalInstances||a.memberCount)]})]}),a.repoUrl&&y.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-zinc-700 font-mono mb-4",children:[y.jsx(t1,{className:"w-3 h-3 flex-shrink-0"}),y.jsx("span",{className:"truncate",children:a.repoUrl.replace("https://github.com/","")})]}),a.recentActivity&&a.recentActivity.length>0&&y.jsxs("div",{className:"border-t pt-3",style:{borderColor:`${o}15`},children:[y.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider mb-2",style:{color:`${o}80`},children:"Recent Work"}),y.jsx("ul",{className:"space-y-1.5",children:a.recentActivity.map(u=>{const d={className:"w-3.5 h-3.5 flex-shrink-0 mt-px"},p=Jq(u.status,d),f=u.objective?u.objective.length>60?`${u.objective.slice(0,60)}…`:u.objective:u.issueRef||"Instance";return y.jsxs("li",{className:"flex items-start gap-1.5 text-[11px] font-mono text-zinc-600",children:[p,y.jsx("span",{className:"truncate",children:f})]},u.id)})})]})]},a.id)}),t.length===0&&y.jsxs("div",{className:"col-span-full text-center py-12 text-zinc-600",children:[y.jsx(i1,{size:48,className:"mx-auto mb-3 opacity-30"}),y.jsx("p",{className:"text-[11px] font-mono",children:"No squads hired yet. Ask IO to hire a squad for a project."})]})]})]})}function Jq(t,e){const r=t.toLowerCase();return r.includes("complete")||r.includes("success")||r.includes("done")?y.jsx(RP,{...e,style:{color:"#34d399"}}):r.includes("warning")||r.includes("review")?y.jsx(wB,{...e,style:{color:"#fbbf24"}}):r.includes("error")||r.includes("fail")?y.jsx(IP,{...e,style:{color:"#f87171"}}):r.includes("working")||r.includes("progress")||r.includes("running")?y.jsx(MP,{...e,style:{color:"#E43A9C"}}):y.jsx(Wz,{...e,style:{color:"#60a5fa"}})}function Hs(t,e){const r="w-4 h-4",n={color:e},i=t.toLowerCase();return i.includes("lead")||i.includes("pm")||i.includes("technical")?y.jsx(e1,{className:r,style:n}):i.includes("qa")||i.includes("test")?y.jsx(mz,{className:r,style:n}):i.includes("scribe")?y.jsx(uB,{className:r,style:n}):y.jsx(qc,{className:r,style:n})}function Zq({name:t}){var k;const[e,r]=j.useState(null),[n,i]=j.useState("agents"),[a,o]=j.useState([]),[c,u]=j.useState(0),[d,p]=j.useState(null),[f,m]=j.useState([]),v=gl(),b=Fa();j.useEffect(()=>{Ge.get(`/squads/${t}`).then(r).catch(()=>{})},[t]),j.useEffect(()=>{n==="history"&&Ge.get(`/squads/${t}/history`).then(S=>{o(S.items),u(S.total)}).catch(()=>{}),n==="schedules"&&e&&Ge.get(`/schedules?targetId=${e.squad.id}`).then(S=>m(S.schedules)).catch(()=>{})},[n,t,e]);const w=S=>{Ge.get(`/squads/${t}/history/${S.id}`).then(p).catch(()=>Qe.error("Failed to load activity detail"))};if(!e)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600",children:"Loading..."});const x=e.squad.color||"#38bdf8";return d?y.jsx(Qq,{activity:d,squadColor:x,squadName:e.squad.name,onBack:()=>p(null)}):y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${x}06`},children:[y.jsxs("button",{type:"button",onClick:()=>v("/squads"),className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," All Squads"]}),y.jsxs("div",{className:"flex items-start justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-3xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:x},children:e.squad.name}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono",children:[((k=e.squad.config)==null?void 0:k.prMode)??"draft-pr"," · ",e.squad.autonomyTier||"standard"," ","autonomy"]}),e.squad.repoUrl&&y.jsxs("a",{href:e.squad.repoUrl,target:"_blank",rel:"noreferrer",className:"text-[11px] font-mono text-[#E43A9C] hover:text-[#F041FF] flex items-center gap-1 mt-1 transition-colors",children:[y.jsx(t1,{className:"w-3 h-3"}),e.squad.repoUrl.replace("https://github.com/","")]})]}),y.jsx(Pt,{variant:Ms(e.squad.status),children:e.squad.status})]}),y.jsx("div",{className:"flex gap-0 mb-5 border-b border-white/[0.06]",children:["agents","instances","schedules","history"].map(S=>y.jsx("button",{type:"button",onClick:()=>i(S),className:`px-4 py-2 text-[11px] font-mono capitalize transition-colors border-b-2 -mb-px ${n===S?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:S},S))}),n==="agents"&&y.jsx("div",{className:"space-y-2",children:e.members.map(S=>y.jsxs("button",{type:"button",onClick:()=>v(`/squads/${t}/agents/${S.roleName||S.role}`),className:"w-full glass-card border border-white/[0.07] rounded-2xl p-4 flex items-center gap-3 hover:bg-white/[0.03] transition-colors cursor-pointer text-left",children:[y.jsx("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center flex-shrink-0",style:{border:`1px solid ${x}30`,background:`${x}12`},children:Hs(S.roleName||S.role,x)}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-sm font-mono text-zinc-200",children:S.displayName}),y.jsx(Pt,{variant:Ms(S.status),children:S.status})]}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:S.role}),S.currentTask&&y.jsx("p",{className:"text-xs text-zinc-500 mt-1 truncate",children:S.currentTask})]})]},S.id))}),n==="instances"&&y.jsx("div",{className:"space-y-2",children:e.instances.length===0?y.jsx("div",{className:"text-center py-16 text-zinc-700 font-mono text-sm",children:"No active instances"}):e.instances.map(S=>y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4 flex items-center gap-4",children:[y.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-2 text-[11px] font-mono",children:[y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"ID"}),y.jsx("p",{className:"text-zinc-300 mt-0.5 truncate",children:S.id.slice(0,8)})]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"Branch"}),y.jsx("p",{className:"text-zinc-300 mt-0.5 truncate",children:S.branch||"—"})]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"Status"}),y.jsx("p",{className:"text-zinc-300 mt-0.5",children:y.jsx(Pt,{variant:Ms(S.status),children:S.status})})]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"Tasks"}),y.jsxs("p",{className:"text-zinc-300 mt-0.5",children:[S.tasksComplete,"/",S.taskCount]})]})]}),y.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[y.jsx("button",{type:"button",onClick:()=>v(`/squads/${t}/instances/${S.id}`),title:"View instance agents",className:"p-2 rounded-xl hover:bg-white/[0.06] transition-colors cursor-pointer",style:{color:x},children:y.jsx(qf,{className:"w-4 h-4"})}),y.jsx("button",{type:"button",onClick:async()=>{try{await Ge.post(`/squads/${t}/instances/${S.id}/cancel`),Qe.success("Instance cancelled")}catch{Qe.error("Failed to cancel instance")}},title:"Stop instance",className:"p-2 rounded-xl hover:bg-red-500/10 text-zinc-600 hover:text-red-400 transition-colors cursor-pointer",children:y.jsx(up,{className:"w-4 h-4"})})]})]},S.id))}),n==="schedules"&&y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:f.length===0?y.jsx("div",{className:"text-center py-16 text-zinc-700 font-mono text-sm",children:"No schedules for this squad"}):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]",style:{background:"rgba(20,20,20,0.6)"},children:["Schedule","Next Run","Status"].map(S=>y.jsx("th",{className:"text-left px-4 py-2.5 text-zinc-600 font-medium",children:S},S))})}),y.jsx("tbody",{children:f.map(S=>y.jsxs("tr",{className:`border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors ${S.enabled?"":"opacity-50"}`,children:[y.jsxs("td",{className:"px-4 py-3",children:[y.jsx("div",{className:"text-zinc-300",children:S.name||S.prompt}),y.jsx("div",{className:"text-zinc-700 text-[10px] mt-0.5",children:S.cron})]}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(Qw,{className:"w-3 h-3"}),S.enabled&&S.nextRun?Fs(S.nextRun,b):"—"]})}),y.jsx("td",{className:"px-4 py-3",children:y.jsx(Pt,{variant:S.enabled?"success":"muted",children:S.enabled?"active":"paused"})})]},S.id))})]})}),n==="history"&&y.jsxs("div",{className:"space-y-2",children:[a.length===0?y.jsx("div",{className:"text-center py-16 text-zinc-700 font-mono text-sm",children:"No history yet"}):a.map(S=>y.jsxs("button",{type:"button",onClick:()=>w(S),className:"w-full glass-card border border-white/[0.07] rounded-2xl px-4 py-3.5 flex items-center gap-3 hover:bg-white/[0.03] transition-colors cursor-pointer text-left",children:[y.jsx("div",{className:"flex-shrink-0",children:S.status==="completed"?y.jsx(RP,{className:"w-4 h-4",style:{color:"#34d399"}}):y.jsx(IP,{className:"w-4 h-4",style:{color:"#f87171"}})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("p",{className:"text-[12px] text-zinc-300 font-mono truncate",children:S.title}),y.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[y.jsx("span",{className:"text-[10px] text-zinc-700 font-mono",children:Fs(S.completedAt||S.createdAt,b)}),y.jsxs("span",{className:"text-[10px] text-zinc-700 font-mono flex items-center gap-1",children:[y.jsx(qf,{className:"w-2.5 h-2.5"}),S.duration||"—"]}),y.jsxs("span",{className:"text-[10px] text-zinc-700 font-mono flex items-center gap-1",children:[y.jsx(qc,{className:"w-2.5 h-2.5"}),S.agentCount," agent",S.agentCount!==1?"s":""]})]})]}),y.jsx(Pt,{variant:S.status==="completed"?"success":"error",children:S.status})]},S.id)),a.length<c&&y.jsx("button",{type:"button",onClick:()=>{Ge.get(`/squads/${t}/history?offset=${a.length}`).then(S=>{o(A=>[...A,...S.items])}).catch(()=>{})},className:"w-full text-center py-3 text-[11px] font-mono text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:"Load more"})]})]})}function Qq({activity:t,squadColor:e,squadName:r,onBack:n}){const i=Fa(),[a,o]=j.useState(new Set),c=j.useMemo(()=>{const v={};for(const b of t.agentEntries)v[b.agentId]=$f(b.agentName);return v},[t]),u={thought:{label:"Thinking",icon:r1},tool_call:{label:"Tool Call",icon:BP},tool_result:{label:"Tool Result",icon:$P},message:{label:"Message",icon:qc},decision:{label:"Decision",icon:e1}},d={label:"Message",icon:qc},p=v=>u[v]??d,f=v=>{o(b=>{const w=new Set(b);return w.has(v)?w.delete(v):w.add(v),w})},m=j.useMemo(()=>{const v=t.agentEntries.flatMap(b=>b.events.map(w=>({ev:w,entry:b})));return v.sort((b,w)=>b.ev.timestamp.localeCompare(w.ev.timestamp)),a.size>0?v.filter(({entry:b})=>a.has(b.agentId)):v},[t,a]);return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${e}06`},children:[y.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors cursor-pointer",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," Back to ",r]}),y.jsxs("div",{className:"flex items-start justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:e},children:t.title}),y.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[y.jsx("span",{className:"text-[11px] text-zinc-600 font-mono",children:Fs(t.completedAt||t.createdAt,i)}),y.jsxs("span",{className:"text-[11px] text-zinc-700 font-mono flex items-center gap-1",children:[y.jsx(Qw,{className:"w-3 h-3"}),t.duration||"—"]})]})]}),y.jsx(Pt,{variant:t.status==="completed"?"success":"error",children:t.status})]}),y.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[t.agentEntries.map(v=>{const b=c[v.agentId],w=a.has(v.agentId),k=!(a.size>0)||w;return y.jsxs("button",{type:"button",onClick:()=>f(v.agentId),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl border transition-all cursor-pointer",style:{borderColor:k?`${b}30`:"rgba(255,255,255,0.05)",background:k?`${b}10`:"transparent",opacity:k?1:.4},children:[Hs(v.roleType||v.role,b),y.jsx("span",{className:"text-[11px] font-mono",style:{color:k?b:"#71717a"},children:v.agentName}),y.jsxs("span",{className:"text-[10px] font-mono text-zinc-500",children:["— ",v.role]})]},v.agentId)}),a.size>0&&y.jsx("button",{type:"button",onClick:()=>o(new Set),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-xl border border-white/[0.1] text-[11px] font-mono text-zinc-400 hover:text-zinc-200 transition-colors cursor-pointer",children:"Show all"})]}),y.jsxs("div",{className:"relative pl-10",children:[y.jsx("div",{className:"absolute left-[15px] top-0 bottom-0 w-px bg-white/[0.06]"}),y.jsx("div",{className:"space-y-3",children:m.map(({ev:v,entry:b})=>{const w=c[b.agentId],{label:x,icon:k}=p(v.kind),S=v.kind==="tool_call"||v.kind==="tool_result";return y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute -left-10 top-3 w-[30px] h-[30px] rounded-full flex items-center justify-center",style:{background:`${w}15`,border:`1px solid ${w}35`},children:y.jsx(k,{className:"w-3.5 h-3.5",style:{color:w}})}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-4 py-3",children:[y.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.jsxs("div",{className:"flex items-center gap-1",children:[Hs(b.roleType||b.role,w),y.jsx("span",{className:"text-[10px] font-mono",style:{color:w},children:b.agentName})]}),y.jsx("span",{className:"text-zinc-700 text-[10px]",children:"·"}),y.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-zinc-500",children:x}),v.label&&y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 border border-white/[0.08] rounded px-1.5 py-px bg-white/[0.03]",children:v.label}),v.status==="error"&&y.jsx(Pt,{variant:"error",children:"failed"}),v.status==="ok"&&v.kind==="tool_result"&&y.jsx(Pt,{variant:"success",children:"ok"})]}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 flex-shrink-0 ml-2",children:lp(v.timestamp,i)})]}),S?y.jsx("pre",{className:"text-[11px] font-mono text-zinc-400 whitespace-pre-wrap leading-relaxed overflow-x-auto rounded-lg p-2 mt-1 bg-black/20",children:v.content}):y.jsx($u,{content:v.content,className:"text-[12px] [&_pre]:text-[10px]"})]})]},v.id)})})]})]})}const e9={thought:{label:"Thinking",icon:r1,color:"#a78bfa",bg:"rgba(167,139,250,0.1)"},tool_call:{label:"Tool Call",icon:BP,color:"#38bdf8",bg:"rgba(56,189,248,0.1)"},tool_result:{label:"Tool Result",icon:$P,color:"#34d399",bg:"rgba(52,211,153,0.1)"},message:{label:"Message",icon:qc,color:"#E43A9C",bg:"rgba(228,58,156,0.15)"},decision:{label:"Decision",icon:e1,color:"#fbbf24",bg:"rgba(251,191,36,0.1)"},meeting:{label:"Meeting",icon:i1,color:"#818cf8",bg:"rgba(129,140,248,0.1)"}};function t9(t){const e=t.toLowerCase();return e.includes("meeting")?"meeting":e.includes("tool_call")||e.includes("tool-call")?"tool_call":e.includes("tool_result")||e.includes("tool-result")?"tool_result":e.includes("thought")||e.includes("thinking")||e.includes("reason")?"thought":e.includes("decision")?"decision":"message"}function r9({squadName:t,instanceId:e}){const[r,n]=j.useState(null),[i,a]=j.useState([]),[o,c]=j.useState(null),[u,d]=j.useState("running"),[p,f]=j.useState(0),m=gl(),v=Fa(),b=j.useRef(null),w=j.useRef(null),x=j.useRef(!0),k=j.useCallback(()=>{const $=b.current;if(!$)return;const K=100;x.current=$.scrollHeight-$.scrollTop-$.clientHeight<K,x.current&&f(0)},[]);if(j.useEffect(()=>{Ge.get(`/squads/${t}/instances/${e}`).then($=>{n($),d($.instance.status)}).catch(()=>{Qe.error("Failed to load instance")})},[t,e]),FP({onEvent:$=>{if(!$.event)return;const K=$.event;if((K.type==="instance:completed"||K.type==="instance:failed"||K.type==="instance.completed"||K.type==="instance.failed")&&K.instanceId===e){d(K.type==="instance:completed"||K.type==="instance.completed"?"completed":"failed");return}if((K.type.startsWith("agent:")||K.type.startsWith("agent."))&&K.instanceId===e){const z=K.data,U=(z==null?void 0:z.tool)||null,F=typeof(z==null?void 0:z.success)=="boolean"?z.success:null;let X="";if(U&&(z!=null&&z.arguments)){const G=z.arguments;if(typeof G=="string")X=G;else if(typeof G=="object"&&G!==null){const Z=G;Z.command?X=String(Z.command):X=JSON.stringify(G,null,2)}}else z!=null&&z.result?X=String(z.result):z!=null&&z.error?X=String(z.error):X=(z==null?void 0:z.content)||"";try{const G=JSON.parse(X);typeof G=="object"&&G!==null&&(X=G.message??G.content??G.response??G.decision??JSON.stringify(G,null,2))}catch{}const Y={id:K.id,agent:K.agentRole||(z==null?void 0:z.agentRole)||"unknown",type:K.type.replace(/^agent[:.]/,""),content:X,toolName:U,success:F,model:K.model||(z==null?void 0:z.model)||null,tokensUsed:null,timestamp:K.timestamp};a(G=>[...G,Y]),x.current?setTimeout(()=>{var G;return(G=w.current)==null?void 0:G.scrollIntoView({behavior:"smooth"})},50):f(G=>G+1)}}}),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600",children:"Loading..."});const S=r.squadColor||"#38bdf8",A=[...r.activity,...i],C=Array.from(new Map(A.map($=>[$.id,$])).values());C.sort(($,K)=>$.timestamp.localeCompare(K.timestamp));const T=o?C.filter($=>$.agent===o):C,O=[...new Set(C.map($=>$.agent))],N={};for(const $ of O)N[$]=$f($);const R=u==="running"||u==="working"||u==="meeting"||u==="planning";return y.jsxs("div",{ref:b,onScroll:k,className:"flex-1 overflow-y-auto p-6",style:{background:`${S}06`},children:[y.jsxs("button",{type:"button",onClick:()=>m(`/squads/${t}`),className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," Back to ",t]}),y.jsxs("div",{className:"flex items-start justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:S},children:"Instance"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:r.instance.id.slice(0,8)}),r.instance.branch&&y.jsx("p",{className:"text-[11px] text-zinc-700 font-mono mt-0.5",children:r.instance.branch})]}),y.jsx(Pt,{variant:Ms(u),children:u})]}),y.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.members.map($=>{const K=$.roleName||$.role,z=N[K]||$f(K),U=o===K;return y.jsxs("button",{type:"button",onClick:()=>c(U?null:K),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl border transition-all cursor-pointer",style:{borderColor:U?z:`${z}30`,background:U?`${z}25`:`${z}10`,opacity:o&&!U?.5:1},children:[Hs(K,z),y.jsx("span",{className:"text-[11px] font-mono",style:{color:z},children:$.displayName}),y.jsx(Pt,{variant:Ms($.status),children:$.status}),$.status==="working"&&y.jsx("button",{type:"button",onClick:async F=>{F.stopPropagation();try{await Ge.post(`/squads/${t}/instances/${e}/cancel`),Qe.success("Instance cancelled")}catch{Qe.error("Failed to cancel instance")}},title:"Cancel instance",className:"ml-1 p-1 rounded-lg hover:bg-red-500/10 text-zinc-600 hover:text-red-400 transition-colors cursor-pointer",children:y.jsx(up,{className:"w-3 h-3"})})]},$.id)}),o&&y.jsx("button",{type:"button",onClick:()=>c(null),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-xl border border-white/[0.1] text-[11px] font-mono text-zinc-400 hover:text-zinc-200 transition-colors cursor-pointer",children:"Show all"})]}),y.jsxs("div",{className:"relative pl-10",children:[y.jsx("div",{className:"absolute left-[15px] top-0 bottom-0 w-px bg-white/[0.06]"}),y.jsxs("div",{className:"space-y-3",children:[T.length===0&&y.jsx("div",{className:"text-center py-12 text-zinc-700 font-mono text-sm",children:"No activity recorded yet"}),T.map($=>{const K=t9($.type),z=e9[K],U=z.icon,F=N[$.agent]||$f($.agent),X=K==="tool_call"||K==="tool_result",Y=$.type.toLowerCase().includes("error")||$.type.toLowerCase().includes("fail");return y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute -left-10 top-3 w-[30px] h-[30px] rounded-full flex items-center justify-center",style:{background:`${F}15`,border:`1px solid ${F}35`},children:y.jsx(U,{className:"w-3.5 h-3.5",style:{color:F}})}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-4 py-3",children:[y.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.jsxs("div",{className:"flex items-center gap-1",children:[Hs($.agent,F),y.jsx("span",{className:"text-[10px] font-mono",style:{color:F},children:$.agent})]}),y.jsx("span",{className:"text-zinc-700 text-[10px]",children:"·"}),y.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-zinc-500",children:z.label}),$.toolName&&y.jsx("span",{className:"text-[10px] font-mono text-sky-400 border border-sky-400/20 rounded px-1.5 py-px bg-sky-400/[0.06]",children:$.toolName}),$.model&&y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 border border-white/[0.08] rounded px-1.5 py-px bg-white/[0.03]",children:$.model}),$.success===!0&&y.jsx("span",{className:"text-[10px] font-mono text-emerald-400 border border-emerald-400/20 rounded px-1.5 py-px bg-emerald-400/[0.08]",children:"success"}),$.success===!1&&y.jsx("span",{className:"text-[10px] font-mono text-red-400 border border-red-400/20 rounded px-1.5 py-px bg-red-400/[0.08]",children:"failed"}),Y&&$.success===null&&y.jsx(Pt,{variant:"error",children:"failed"})]}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 flex-shrink-0 ml-2",children:lp($.timestamp,v)})]}),X?y.jsx("pre",{className:"text-[11px] font-mono text-zinc-400 whitespace-pre-wrap leading-relaxed overflow-x-auto rounded-lg p-2 mt-1 bg-black/20",children:$.content}):y.jsx($u,{content:$.content,className:"text-[12px] [&_pre]:text-[10px]"})]})]},$.id)}),R&&y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute -left-10 top-3 w-[30px] h-[30px] rounded-full flex items-center justify-center",style:{background:`${S}15`,border:`1px solid ${S}40`},children:y.jsx(MP,{className:"w-3.5 h-3.5 animate-spin",style:{color:S}})}),y.jsx("div",{className:"glass-card border rounded-2xl px-4 py-3",style:{borderColor:`${S}20`},children:y.jsx("span",{className:"text-[11px] font-mono",style:{color:S},children:"Working…"})})]})]})]}),y.jsx("div",{ref:w}),p>0&&y.jsxs("button",{type:"button",onClick:()=>{var $;($=w.current)==null||$.scrollIntoView({behavior:"smooth"}),f(0)},className:"fixed bottom-6 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-4 py-2 rounded-full border border-white/[0.1] bg-zinc-900/90 backdrop-blur-sm text-[11px] font-mono text-zinc-300 hover:text-white shadow-lg transition-all cursor-pointer z-50",children:[y.jsx(cz,{className:"w-3.5 h-3.5"}),p," new event",p!==1?"s":""]})]})}function n9({squadName:t,role:e}){const r=gl(),[n,i]=j.useState(null),[a,o]=j.useState(""),[c,u]=j.useState(!1),[d,p]=j.useState(""),[f,m]=j.useState(!1),[v,b]=j.useState("#38bdf8");j.useEffect(()=>{Ge.get(`/squads/${t}`).then(x=>{b(x.squad.color||"#38bdf8");const k=x.members.find(S=>S.roleName===e||S.role===e);k&&i(k)}).catch(()=>{}),Ge.get(`/squads/${t}/members/${e}/skill`).then(x=>{o(x.content)}).catch(()=>{})},[t,e]);const w=async()=>{m(!0);try{await Ge.put(`/squads/${t}/members/${e}/skill`,{content:d}),o(d),u(!1),Qe.success("Skill file saved")}catch{Qe.error("Failed to save skill file")}finally{m(!1)}};return n?y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${v}06`},children:[y.jsxs("button",{type:"button",onClick:()=>r(`/squads/${t}`),className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors cursor-pointer",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," Back to ",t]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5 mb-5",children:[y.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[y.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center",style:{border:`1px solid ${v}30`,background:`${v}12`},children:Hs(n.roleName,v)}),y.jsxs("div",{children:[y.jsx("h2",{className:"text-xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:v},children:n.displayName}),y.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[y.jsx("span",{className:"text-[11px] font-mono text-zinc-500",children:n.roleName}),n.veto&&y.jsx("span",{className:"text-[10px] font-mono text-amber-400 border border-amber-400/20 rounded px-1.5 py-px bg-amber-400/[0.06]",children:"veto"})]})]})]}),n.tools.length>0&&y.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:n.tools.map(x=>y.jsx("span",{className:"text-[10px] font-mono text-zinc-500 border border-white/[0.08] rounded px-1.5 py-px bg-white/[0.03]",children:x},x))})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsxs("div",{className:"flex items-center justify-between mb-4",children:[y.jsx("h3",{className:"text-sm font-mono text-zinc-300",children:"Skill File"}),c?y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("button",{type:"button",onClick:()=>u(!1),className:"px-3 py-1.5 rounded-lg text-[11px] font-mono text-zinc-500 hover:text-zinc-300 border border-white/[0.1] transition-colors cursor-pointer",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:w,disabled:f,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-emerald-400 border border-emerald-400/30 hover:bg-emerald-400/10 transition-colors cursor-pointer disabled:opacity-50",children:[y.jsx(cp,{className:"w-3 h-3"})," ",f?"Saving...":"Save"]})]}):y.jsxs("button",{type:"button",onClick:()=>{p(a),u(!0)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-zinc-400 hover:text-zinc-200 border border-white/[0.1] hover:border-white/[0.2] transition-colors cursor-pointer",children:[y.jsx(Ff,{className:"w-3 h-3"})," Edit"]})]}),c?y.jsx("textarea",{value:d,onChange:x=>p(x.target.value),className:"w-full h-[500px] bg-black/30 border border-white/[0.08] rounded-xl p-4 text-[12px] font-mono text-zinc-300 resize-y focus:outline-none focus:border-white/[0.2] leading-relaxed",spellCheck:!1}):a?y.jsx($u,{content:a,className:"text-[12px] [&_pre]:text-[11px]"}):y.jsx("p",{className:"text-zinc-700 text-[12px] font-mono py-8 text-center",children:"No skill file configured for this agent"})]})]}):y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600",children:"Loading..."})}var Wg,QE;function Qr(){if(QE)return Wg;QE=1;var t=Array.isArray;return Wg=t,Wg}var Kg,eA;function NR(){if(eA)return Kg;eA=1;var t=typeof ef=="object"&&ef&&ef.Object===Object&&ef;return Kg=t,Kg}var Gg,tA;function Ai(){if(tA)return Gg;tA=1;var t=NR(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Gg=r,Gg}var Vg,rA;function Du(){if(rA)return Vg;rA=1;var t=Ai(),e=t.Symbol;return Vg=e,Vg}var Xg,nA;function i9(){if(nA)return Xg;nA=1;var t=Du(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function a(o){var c=r.call(o,i),u=o[i];try{o[i]=void 0;var d=!0}catch{}var p=n.call(o);return d&&(c?o[i]=u:delete o[i]),p}return Xg=a,Xg}var Yg,iA;function a9(){if(iA)return Yg;iA=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return Yg=r,Yg}var Jg,aA;function ra(){if(aA)return Jg;aA=1;var t=Du(),e=i9(),r=a9(),n="[object Null]",i="[object Undefined]",a=t?t.toStringTag:void 0;function o(c){return c==null?c===void 0?i:n:a&&a in Object(c)?e(c):r(c)}return Jg=o,Jg}var Zg,oA;function na(){if(oA)return Zg;oA=1;function t(e){return e!=null&&typeof e=="object"}return Zg=t,Zg}var Qg,sA;function xl(){if(sA)return Qg;sA=1;var t=ra(),e=na(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Qg=n,Qg}var ey,lA;function c1(){if(lA)return ey;lA=1;var t=Qr(),e=xl(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(t(a))return!1;var c=typeof a;return c=="number"||c=="symbol"||c=="boolean"||a==null||e(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return ey=i,ey}var ty,cA;function Wa(){if(cA)return ty;cA=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return ty=t,ty}var ry,uA;function u1(){if(uA)return ry;uA=1;var t=ra(),e=Wa(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(c){if(!e(c))return!1;var u=t(c);return u==n||u==i||u==r||u==a}return ry=o,ry}var ny,dA;function o9(){if(dA)return ny;dA=1;var t=Ai(),e=t["__core-js_shared__"];return ny=e,ny}var iy,fA;function s9(){if(fA)return iy;fA=1;var t=o9(),e=(function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!e&&e in n}return iy=r,iy}var ay,hA;function PR(){if(hA)return ay;hA=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return ay=r,ay}var oy,pA;function l9(){if(pA)return oy;pA=1;var t=u1(),e=s9(),r=Wa(),n=PR(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,c=Object.prototype,u=o.toString,d=c.hasOwnProperty,p=RegExp("^"+u.call(d).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(m){if(!r(m)||e(m))return!1;var v=t(m)?p:a;return v.test(n(m))}return oy=f,oy}var sy,mA;function c9(){if(mA)return sy;mA=1;function t(e,r){return e==null?void 0:e[r]}return sy=t,sy}var ly,gA;function Uo(){if(gA)return ly;gA=1;var t=l9(),e=c9();function r(n,i){var a=e(n,i);return t(a)?a:void 0}return ly=r,ly}var cy,yA;function gp(){if(yA)return cy;yA=1;var t=Uo(),e=t(Object,"create");return cy=e,cy}var uy,vA;function u9(){if(vA)return uy;vA=1;var t=gp();function e(){this.__data__=t?t(null):{},this.size=0}return uy=e,uy}var dy,bA;function d9(){if(bA)return dy;bA=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return dy=t,dy}var fy,xA;function f9(){if(xA)return fy;xA=1;var t=gp(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(t){var c=o[a];return c===e?void 0:c}return n.call(o,a)?o[a]:void 0}return fy=i,fy}var hy,wA;function h9(){if(wA)return hy;wA=1;var t=gp(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var a=this.__data__;return t?a[i]!==void 0:r.call(a,i)}return hy=n,hy}var py,_A;function p9(){if(_A)return py;_A=1;var t=gp(),e="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=t&&i===void 0?e:i,this}return py=r,py}var my,SA;function m9(){if(SA)return my;SA=1;var t=u9(),e=d9(),r=f9(),n=h9(),i=p9();function a(o){var c=-1,u=o==null?0:o.length;for(this.clear();++c<u;){var d=o[c];this.set(d[0],d[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,my=a,my}var gy,kA;function g9(){if(kA)return gy;kA=1;function t(){this.__data__=[],this.size=0}return gy=t,gy}var yy,EA;function d1(){if(EA)return yy;EA=1;function t(e,r){return e===r||e!==e&&r!==r}return yy=t,yy}var vy,AA;function yp(){if(AA)return vy;AA=1;var t=d1();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return vy=e,vy}var by,OA;function y9(){if(OA)return by;OA=1;var t=yp(),e=Array.prototype,r=e.splice;function n(i){var a=this.__data__,o=t(a,i);if(o<0)return!1;var c=a.length-1;return o==c?a.pop():r.call(a,o,1),--this.size,!0}return by=n,by}var xy,TA;function v9(){if(TA)return xy;TA=1;var t=yp();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return xy=e,xy}var wy,CA;function b9(){if(CA)return wy;CA=1;var t=yp();function e(r){return t(this.__data__,r)>-1}return wy=e,wy}var _y,jA;function x9(){if(jA)return _y;jA=1;var t=yp();function e(r,n){var i=this.__data__,a=t(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return _y=e,_y}var Sy,NA;function vp(){if(NA)return Sy;NA=1;var t=g9(),e=y9(),r=v9(),n=b9(),i=x9();function a(o){var c=-1,u=o==null?0:o.length;for(this.clear();++c<u;){var d=o[c];this.set(d[0],d[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Sy=a,Sy}var ky,PA;function f1(){if(PA)return ky;PA=1;var t=Uo(),e=Ai(),r=t(e,"Map");return ky=r,ky}var Ey,RA;function w9(){if(RA)return Ey;RA=1;var t=m9(),e=vp(),r=f1();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return Ey=n,Ey}var Ay,IA;function _9(){if(IA)return Ay;IA=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Ay=t,Ay}var Oy,$A;function bp(){if($A)return Oy;$A=1;var t=_9();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Oy=e,Oy}var Ty,MA;function S9(){if(MA)return Ty;MA=1;var t=bp();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return Ty=e,Ty}var Cy,DA;function k9(){if(DA)return Cy;DA=1;var t=bp();function e(r){return t(this,r).get(r)}return Cy=e,Cy}var jy,LA;function E9(){if(LA)return jy;LA=1;var t=bp();function e(r){return t(this,r).has(r)}return jy=e,jy}var Ny,zA;function A9(){if(zA)return Ny;zA=1;var t=bp();function e(r,n){var i=t(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Ny=e,Ny}var Py,BA;function h1(){if(BA)return Py;BA=1;var t=w9(),e=S9(),r=k9(),n=E9(),i=A9();function a(o){var c=-1,u=o==null?0:o.length;for(this.clear();++c<u;){var d=o[c];this.set(d[0],d[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Py=a,Py}var Ry,UA;function RR(){if(UA)return Ry;UA=1;var t=h1(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var o=arguments,c=i?i.apply(this,o):o[0],u=a.cache;if(u.has(c))return u.get(c);var d=n.apply(this,o);return a.cache=u.set(c,d)||u,d};return a.cache=new(r.Cache||t),a}return r.Cache=t,Ry=r,Ry}var Iy,qA;function O9(){if(qA)return Iy;qA=1;var t=RR(),e=500;function r(n){var i=t(n,function(o){return a.size===e&&a.clear(),o}),a=i.cache;return i}return Iy=r,Iy}var $y,FA;function T9(){if(FA)return $y;FA=1;var t=O9(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(o,c,u,d){a.push(u?d.replace(r,"$1"):c||o)}),a});return $y=n,$y}var My,HA;function p1(){if(HA)return My;HA=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=r(e[n],n,e);return a}return My=t,My}var Dy,WA;function C9(){if(WA)return Dy;WA=1;var t=Du(),e=p1(),r=Qr(),n=xl(),i=t?t.prototype:void 0,a=i?i.toString:void 0;function o(c){if(typeof c=="string")return c;if(r(c))return e(c,o)+"";if(n(c))return a?a.call(c):"";var u=c+"";return u=="0"&&1/c==-1/0?"-0":u}return Dy=o,Dy}var Ly,KA;function IR(){if(KA)return Ly;KA=1;var t=C9();function e(r){return r==null?"":t(r)}return Ly=e,Ly}var zy,GA;function $R(){if(GA)return zy;GA=1;var t=Qr(),e=c1(),r=T9(),n=IR();function i(a,o){return t(a)?a:e(a,o)?[a]:r(n(a))}return zy=i,zy}var By,VA;function xp(){if(VA)return By;VA=1;var t=xl();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return By=e,By}var Uy,XA;function m1(){if(XA)return Uy;XA=1;var t=$R(),e=xp();function r(n,i){i=t(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[e(i[a++])];return a&&a==o?n:void 0}return Uy=r,Uy}var qy,YA;function MR(){if(YA)return qy;YA=1;var t=m1();function e(r,n,i){var a=r==null?void 0:t(r,n);return a===void 0?i:a}return qy=e,qy}var j9=MR();const On=vt(j9);var Fy,JA;function N9(){if(JA)return Fy;JA=1;function t(e){return e==null}return Fy=t,Fy}var P9=N9();const tt=vt(P9);var Hy,ZA;function R9(){if(ZA)return Hy;ZA=1;var t=ra(),e=Qr(),r=na(),n="[object String]";function i(a){return typeof a=="string"||!e(a)&&r(a)&&t(a)==n}return Hy=i,Hy}var I9=R9();const Ro=vt(I9);var $9=u1();const Je=vt($9);var M9=Wa();const wl=vt(M9);var Wy={exports:{}},pt={};/**
|
|
448
|
+
`);u({id:N,role:"user",content:O,timestamp:new Date().toISOString(),attachmentName:R}),f(""),v(null),S.current&&(S.current.value=""),k.current&&(k.current.style.height="auto");try{m&&await d(m,N),await o($)}catch{}}function C(O){O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),A())}function T(O){f(O.target.value),k.current&&(k.current.style.height="auto",k.current.style.height=`${Math.min(k.current.scrollHeight,160)}px`)}return y.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[y.jsxs("div",{ref:x,className:"flex-1 overflow-y-auto px-5 py-5 space-y-5",children:[r.map(O=>{var N,R;return y.jsxs("div",{className:`flex gap-3 ${O.role==="user"?"flex-row-reverse":""}`,children:[y.jsx("div",{className:`flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center text-[10px] font-mono mt-0.5 ${O.role==="user"?"border border-[#E43A9C]/30 text-[#E43A9C]":"bg-[#282828] border border-white/[0.07] text-zinc-500"}`,style:O.role==="user"?{background:"rgba(228,58,156,0.12)"}:void 0,children:O.role==="user"?((R=(N=t==null?void 0:t.user)==null?void 0:N.email)==null?void 0:R.charAt(0).toUpperCase())??"U":y.jsx(Ia,{height:12})}),y.jsxs("div",{className:`flex flex-col gap-1.5 max-w-[72%] ${O.role==="user"?"items-end":"items-start"}`,children:[O.toolCall&&y.jsxs("button",{type:"button",onClick:()=>w(b===O.id?null:O.id),className:"w-full text-left border border-white/[0.07] bg-[#1e1e1e] rounded-xl px-3 py-2 flex items-center gap-2 hover:border-[#E43A9C]/25 transition-colors",children:[y.jsx(qf,{className:"w-3 h-3 text-[#E43A9C] flex-shrink-0"}),y.jsx("span",{className:"text-[11px] font-mono text-zinc-400 flex-1",children:O.toolCall.name}),y.jsx(Pt,{variant:O.toolCall.status==="done"?"success":O.toolCall.status==="error"?"error":"warning",children:O.toolCall.status}),y.jsx(wz,{className:`w-3 h-3 text-zinc-600 transition-transform flex-shrink-0 ${b===O.id?"rotate-180":""}`})]}),O.toolCall&&b===O.id&&y.jsx("div",{className:"w-full bg-[#181818] border border-white/[0.06] rounded-xl px-3 py-2",children:y.jsx("p",{className:"text-[11px] font-mono text-zinc-500",children:O.toolCall.result})}),O.attachmentName&&y.jsx("div",{className:"rounded-xl border border-white/[0.08] bg-[#1e1e1e] px-3 py-2 text-[11px] font-mono text-zinc-400",children:O.attachmentName}),O.content&&y.jsx("div",{className:`rounded-2xl px-4 py-2.5 text-sm leading-relaxed ${O.role==="user"?"text-white rounded-tr-sm":"bg-[#222222] border border-white/[0.07] text-zinc-200 rounded-tl-sm"}`,style:O.role==="user"?{background:"linear-gradient(135deg, #D83333 0%, #C0285E 100%)"}:void 0,children:O.role==="user"?y.jsx("p",{className:"whitespace-pre-wrap",children:O.content}):y.jsx("div",{className:"prose-io",dangerouslySetInnerHTML:{__html:it.parse(O.content)}})}),y.jsx("span",{className:"text-[11px] text-zinc-700 font-mono px-0.5",children:lp(O.timestamp,e)})]})]},O.id)}),a&&y.jsxs("div",{className:"flex gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center bg-[#282828] border border-white/[0.07] mt-0.5",children:y.jsx(Ia,{height:12})}),y.jsx("div",{className:"bg-[#222222] border border-white/[0.07] rounded-2xl rounded-tl-sm px-4 py-3 flex items-center gap-1.5",children:[0,120,240].map(O=>y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#E43A9C] animate-bounce",style:{animationDelay:`${O}ms`}},O))})]}),i&&n&&y.jsxs("div",{className:"flex gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center bg-[#282828] border border-white/[0.07] mt-0.5",children:y.jsx(Ia,{height:12})}),y.jsx("div",{className:"bg-[#222222] border border-white/[0.07] rounded-2xl rounded-tl-sm px-4 py-2.5 max-w-[72%]",children:y.jsx("div",{className:"prose-io text-sm",dangerouslySetInnerHTML:{__html:it.parse(n)}})})]}),i&&!n&&y.jsxs("div",{className:"flex gap-3",children:[y.jsx("div",{className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center bg-[#282828] border border-white/[0.07] mt-0.5",children:y.jsx(Ia,{height:12})}),y.jsx("div",{className:"bg-[#222222] border border-white/[0.07] rounded-2xl rounded-tl-sm px-4 py-3 flex items-center gap-1.5",children:[0,120,240].map(O=>y.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#E43A9C] animate-bounce",style:{animationDelay:`${O}ms`}},O))})]})]}),y.jsxs("div",{className:"border-t border-white/[0.06] p-4 flex-shrink-0",children:[y.jsxs("div",{className:"bg-[#1e1e1e] border border-white/[0.08] rounded-2xl overflow-hidden transition-colors focus-within:border-[#E43A9C]/30",children:[y.jsx("input",{ref:S,type:"file",className:"hidden",onChange:O=>{var N;return v(((N=O.target.files)==null?void 0:N[0])??null)}}),m&&y.jsxs("div",{className:"px-4 pt-3 text-[11px] font-mono text-zinc-400",children:["Attached: ",m.name]}),y.jsx("textarea",{ref:k,value:p,onChange:T,onKeyDown:C,placeholder:"Message IO…",rows:1,className:"w-full bg-transparent px-4 pt-3 pb-1 text-sm text-zinc-200 placeholder:text-zinc-700 resize-none focus:outline-none",style:{minHeight:"42px",maxHeight:"160px",fontFamily:"Inter, sans-serif"}}),y.jsxs("div",{className:"flex items-center justify-between px-3 pb-2.5",children:[y.jsx("button",{type:"button",onClick:()=>{var O;return(O=S.current)==null?void 0:O.click()},className:"p-1.5 rounded-lg hover:bg-white/[0.05] text-zinc-700 hover:text-zinc-400 transition-colors",children:y.jsx(DP,{className:"w-4 h-4"})}),y.jsx("div",{className:"flex items-center gap-2",children:i?y.jsxs("button",{type:"button",onClick:()=>c(),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-zinc-800 hover:bg-zinc-700 text-[11px] font-mono text-zinc-300 transition-colors",children:[y.jsx(up,{className:"w-3 h-3"})," Stop"]}):y.jsx("button",{type:"button",onClick:A,disabled:!p.trim()&&!m||a,className:"p-2 rounded-xl text-white disabled:opacity-30 disabled:cursor-not-allowed transition-opacity hover:opacity-90",style:{background:"linear-gradient(135deg, #D83333, #E43A9C)"},children:y.jsx(zP,{className:"w-3.5 h-3.5"})})})]})]}),y.jsx("p",{className:"text-center text-[11px] text-zinc-800 font-mono mt-2",children:"IO may make mistakes. Verify important outputs."})]})]})}const HE=["#38bdf8","#a78bfa","#34d399","#f59e0b","#f87171","#E43A9C"];function $q(t){let e=0;for(let r=0;r<t.length;r++)e=t.charCodeAt(r)+((e<<5)-e);return HE[Math.abs(e)%HE.length]}function WE({name:t,color:e}){const r=t.toLowerCase(),n=e??(r==="orchestrator"||r==="io"?"#71717a":$q(t));return y.jsx("span",{className:"inline-flex items-center px-1.5 py-px rounded text-[10px] font-mono border",style:{background:`${n}15`,color:n,borderColor:`${n}30`},children:t})}function mc(t){return t.status==="pending"}function Mq(){const[t,e]=j.useState([]),[r,n]=j.useState(null),[i,a]=j.useState(new Set),[o,c]=j.useState("all"),u=Fa();j.useEffect(()=>{Ge.get("/inbox").then(A=>e(A.entries??[])).catch(()=>{})},[]);const d=t.filter(mc).length,p=o==="unread"?t.filter(mc):t,f=p.length>0&&p.every(A=>i.has(A.id)),m=i.size>0;function v(A){m||(n(A),mc(A)&&(Ge.put(`/inbox/${A.id}/read`,{}).catch(()=>{}),e(C=>C.map(T=>T.id===A.id?{...T,status:"read"}:T))))}function b(A,C){A.stopPropagation(),a(T=>{const O=new Set(T);return O.has(C)?O.delete(C):O.add(C),O})}function w(){a(f?new Set:new Set(p.map(A=>A.id)))}function x(){const A=Array.from(i);Promise.allSettled(A.map(C=>Ge.put(`/inbox/${C}/read`,{}))),e(C=>C.map(T=>i.has(T.id)?{...T,status:"read"}:T)),a(new Set)}function k(){const A=Array.from(i);Promise.allSettled(A.map(C=>Ge.delete(`/inbox/${C}`))),e(C=>C.filter(T=>!i.has(T.id))),r&&i.has(r.id)&&n(null),a(new Set)}function S(A){Ge.delete(`/inbox/${A}`).catch(()=>{}),e(C=>C.filter(T=>T.id!==A)),(r==null?void 0:r.id)===A&&n(null)}return y.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[y.jsxs("div",{className:"w-72 flex-shrink-0 border-r border-white/[0.06] flex flex-col overflow-hidden",children:[y.jsxs("div",{className:"px-4 py-3 border-b border-white/[0.06] flex-shrink-0 space-y-2",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"text-lg tracking-wide text-zinc-200",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Inbox"}),d>0&&y.jsxs(Pt,{variant:"default",children:[d," unread"]})]}),y.jsx("div",{className:"flex gap-1",children:["all","unread"].map(A=>y.jsx("button",{type:"button",onClick:()=>{c(A),a(new Set)},className:`flex-1 py-1 text-[11px] font-mono rounded-lg transition-colors cursor-pointer ${o===A?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300"}`,style:o===A?{background:"rgba(228,58,156,0.12)"}:void 0,children:A},A))})]}),m&&y.jsxs("div",{className:"px-3 py-2 border-b border-white/[0.06] flex items-center gap-1.5 flex-shrink-0",style:{background:"rgba(228,58,156,0.06)"},children:[y.jsxs("span",{className:"text-[10px] font-mono text-zinc-500 flex-1",children:[i.size," selected"]}),y.jsxs("button",{type:"button",onClick:x,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-mono text-zinc-400 hover:text-zinc-200 hover:bg-white/[0.06] transition-colors cursor-pointer",children:[y.jsx(Zb,{className:"w-3 h-3"}),"Mark read"]}),y.jsxs("button",{type:"button",onClick:k,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-[10px] font-mono text-red-400 hover:text-red-300 hover:bg-red-500/10 transition-colors cursor-pointer",children:[y.jsx(Da,{className:"w-3 h-3"}),"Delete"]})]}),p.length>0&&y.jsxs("div",{className:"px-4 py-1.5 border-b border-white/[0.04] flex items-center gap-2 flex-shrink-0",children:[y.jsx("button",{type:"button",onClick:w,className:`w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors cursor-pointer ${f?"border-[#E43A9C] bg-[#E43A9C]":"border-white/20 hover:border-white/40"}`,children:f&&y.jsx("svg",{className:"w-2 h-2 text-white",fill:"none",viewBox:"0 0 8 8","aria-hidden":"true",children:y.jsx("path",{d:"M1 4l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700",children:"Select all"})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto",children:[p.map(A=>{const C=i.has(A.id),T=(r==null?void 0:r.id)===A.id&&!m;return y.jsxs("div",{onClick:()=>v(A),onKeyDown:O=>O.key==="Enter"&&v(A),className:`flex items-start gap-2.5 px-3 py-3 border-b border-white/[0.04] cursor-pointer transition-colors ${T?"border-l-2 border-l-[#E43A9C] pl-2.5":"hover:bg-white/[0.025]"} ${C?"bg-[#E43A9C]/5":""}`,style:T?{background:"rgba(228,58,156,0.05)"}:void 0,children:[y.jsx("button",{type:"button",onClick:O=>b(O,A.id),className:`mt-0.5 w-3.5 h-3.5 rounded border flex items-center justify-center flex-shrink-0 transition-colors cursor-pointer ${C?"border-[#E43A9C] bg-[#E43A9C]":"border-white/20 hover:border-white/50"}`,children:C&&y.jsx("svg",{className:"w-2 h-2 text-white",fill:"none",viewBox:"0 0 8 8","aria-hidden":"true",children:y.jsx("path",{d:"M1 4l2 2 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[mc(A)&&y.jsx("div",{className:"w-1 h-1 rounded-full bg-[#E43A9C] flex-shrink-0"}),y.jsx(WE,{name:A.squadName??(A.squadId?A.squadId.slice(0,8):"Orchestrator"),color:A.squadColor})]}),y.jsx("p",{className:`text-[11px] truncate ${mc(A)?"text-zinc-200":"text-zinc-500"}`,children:A.title}),y.jsx("p",{className:"text-[10px] text-zinc-700 font-mono mt-1",children:Fs(A.createdAt,u)})]})]},A.id)}),p.length===0&&y.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[y.jsx(Qb,{size:32,className:"text-zinc-800 mb-2"}),y.jsx("p",{className:"text-[11px] font-mono text-zinc-700",children:o==="unread"?"All caught up":"No items yet"})]})]})]}),y.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:r&&!m?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"px-6 py-4 border-b border-white/[0.06] flex items-start justify-between flex-shrink-0",children:[y.jsxs("div",{className:"flex-1 min-w-0 mr-4",children:[y.jsx(WE,{name:r.squadName??(r.squadId?r.squadId.slice(0,8):"Orchestrator"),color:r.squadColor}),y.jsx("h3",{className:"text-sm font-mono text-zinc-100 mt-1.5",children:r.title}),y.jsx("p",{className:"text-[11px] text-zinc-700 font-mono mt-0.5",children:Fs(r.createdAt,u)})]}),y.jsxs("button",{type:"button",onClick:()=>S(r.id),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",children:[y.jsx(Da,{className:"w-3 h-3"}),"Delete"]})]}),y.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:y.jsx($u,{content:r.content})})]}):m?y.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 text-center px-8",children:[y.jsx("div",{className:"w-10 h-10 rounded-2xl flex items-center justify-center border border-[#E43A9C]/20",style:{background:"rgba(228,58,156,0.08)"},children:y.jsx(Qb,{className:"w-4 h-4 text-[#E43A9C]"})}),y.jsxs("div",{children:[y.jsxs("p",{className:"text-sm font-mono text-zinc-300",children:[i.size," message",i.size!==1?"s":""," selected"]}),y.jsx("p",{className:"text-[11px] text-zinc-600 mt-1",children:"Use the actions above to mark as read or delete"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsxs("button",{type:"button",onClick:x,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-zinc-300 border border-white/[0.1] hover:bg-white/[0.05] transition-colors cursor-pointer",children:[y.jsx(Zb,{className:"w-3 h-3"}),"Mark read"]}),y.jsxs("button",{type:"button",onClick:k,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-red-400 border border-red-500/20 hover:bg-red-500/10 transition-colors cursor-pointer",children:[y.jsx(Da,{className:"w-3 h-3"}),"Delete selected"]})]})]}):y.jsx("div",{className:"flex-1 flex items-center justify-center text-zinc-700 font-mono text-xs",children:"Select an item to read"})})]})}function Dq(){const{signIn:t}=mp(),[e,r]=j.useState(""),[n,i]=j.useState(""),[a,o]=j.useState(null),[c,u]=j.useState(!1);async function d(p){p.preventDefault(),o(null),u(!0);const{error:f}=await t(e,n);f&&o(f),u(!1)}return y.jsxs("div",{className:"min-h-screen bg-[#161616] flex items-center justify-center relative overflow-hidden",children:[y.jsx("div",{className:"absolute inset-0 opacity-[0.04]",style:{backgroundImage:"radial-gradient(circle, #E43A9C 1px, transparent 1px)",backgroundSize:"32px 32px"}}),y.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-[60%] w-[400px] h-[300px] rounded-full blur-3xl pointer-events-none",style:{background:"radial-gradient(ellipse, rgba(228,58,156,0.12) 0%, transparent 70%)"}}),y.jsxs("div",{className:"relative z-10 w-full max-w-[360px] mx-4",children:[y.jsxs("div",{className:"flex flex-col items-center mb-8 gap-3",children:[y.jsx(Ia,{height:52}),y.jsx("div",{className:"text-center",children:y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 tracking-widest uppercase mt-1",children:"personal ai orchestrator"})})]}),y.jsxs("form",{onSubmit:d,className:"glass-card border border-white/[0.07] rounded-2xl p-6 space-y-4",children:[y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{htmlFor:"login-email",className:"text-[11px] font-mono text-zinc-500 block",children:"Email"}),y.jsx("input",{id:"login-email",type:"email",value:e,onChange:p=>r(p.target.value),required:!0,className:"w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2.5 text-sm text-zinc-200 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/15 transition-colors"})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{htmlFor:"login-password",className:"text-[11px] font-mono text-zinc-500 block",children:"Password"}),y.jsx("input",{id:"login-password",type:"password",value:n,onChange:p=>i(p.target.value),required:!0,placeholder:"••••••••",className:"w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2.5 text-sm text-zinc-200 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/15 transition-colors"})]}),a&&y.jsx("p",{className:"text-[11px] font-mono text-red-400",children:a}),y.jsx("button",{type:"submit",disabled:c,className:"w-full text-white font-mono text-sm rounded-xl py-3 mt-1 transition-opacity hover:opacity-90 disabled:opacity-50 flex items-center justify-center gap-2",style:{background:"linear-gradient(135deg, #D83333 0%, #E43A9C 55%, #F041FF 100%)"},children:c?y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Authenticating…"]}):"Sign In"})]}),y.jsx("p",{className:"text-center text-[11px] text-zinc-700 font-mono mt-4",children:"Secured by Supabase Auth"})]})]})}const jR="w-full bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/10 transition-colors",Ls="bg-[#161616] border border-white/[0.08] rounded-xl px-3 py-2 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/40 focus:ring-1 focus:ring-[#E43A9C]/10 transition-colors";function Fi({label:t,hint:e,align:r="center",children:n}){const i=r==="start"?"flex-1 min-w-0":"flex-1 flex justify-end items-center";return y.jsxs("div",{className:`glass-card border border-white/[0.07] rounded-2xl px-4 py-3.5 flex gap-4 ${r==="start"?"items-start":"items-center"}`,children:[y.jsxs("div",{className:"w-[140px] shrink-0",children:[y.jsx("span",{className:"text-[11px] font-mono text-zinc-400",children:t}),e&&y.jsxs("span",{className:"text-[10px] font-mono text-zinc-700 ml-1.5",children:["(",e,")"]})]}),y.jsx("div",{className:i,children:n})]})}function Lq({onSave:t,onCancel:e,squads:r}){var b;const[n,i]=j.useState("io"),[a,o]=j.useState(((b=r[0])==null?void 0:b.id)??""),[c,u]=j.useState(""),[d,p]=j.useState(""),[f,m]=j.useState(""),v=()=>{!d.trim()||!f.trim()||!c.trim()||t({name:c.trim(),targetType:n==="io"?"orchestrator":"squad",targetId:n==="squad"?a:void 0,cron:d.trim(),prompt:f.trim()})};return y.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center p-6",style:{background:"rgba(0,0,0,0.55)",backdropFilter:"blur(4px)"},children:y.jsxs("div",{className:"glass-card border border-white/[0.09] rounded-2xl w-full max-w-lg shadow-2xl flex flex-col",style:{maxHeight:"90vh"},children:[y.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-white/[0.06] flex-shrink-0",children:[y.jsx("h3",{className:"text-lg tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"New Schedule"}),y.jsx("button",{type:"button",onClick:e,className:"p-1.5 rounded-lg text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.06] transition-colors cursor-pointer",children:y.jsx(UP,{className:"w-4 h-4"})})]}),y.jsxs("div",{className:"overflow-y-auto flex-1 px-5 py-4 space-y-2",children:[y.jsx(Fi,{label:"Name",children:y.jsx("input",{value:c,onChange:w=>u(w.target.value),placeholder:"Daily triage",className:`${Ls} w-48`})}),y.jsx(Fi,{label:"Type",children:y.jsx("div",{className:"flex gap-2",children:["io","squad"].map(w=>y.jsx("button",{type:"button",onClick:()=>i(w),className:`px-4 py-1.5 rounded-xl text-[11px] font-mono capitalize transition-colors border cursor-pointer ${n===w?"text-[#E43A9C] border-[#E43A9C]/30":"text-zinc-500 border-white/[0.08] hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:n===w?{background:"rgba(228,58,156,0.08)"}:void 0,children:w==="io"?"IO":"Squad"},w))})}),n==="squad"&&y.jsx(Fi,{label:"Squad",children:y.jsx("select",{value:a,onChange:w=>o(w.target.value),className:`${Ls} w-48`,children:r.map(w=>y.jsx("option",{value:w.id,style:{background:"#1a1a1a",color:"#d4d4d8"},children:w.name},w.id))})}),y.jsx(Fi,{label:"Cron Expression",children:y.jsx("input",{value:d,onChange:w=>p(w.target.value),placeholder:"0 9 * * 1-5",className:`${Ls} w-40`})}),y.jsx(Fi,{label:"Prompt",hint:"supports Markdown",align:"start",children:y.jsx("textarea",{value:f,onChange:w=>m(w.target.value),placeholder:"Describe what IO or the squad should do when this schedule fires.",rows:8,className:`${jR} resize-none leading-relaxed`})})]}),y.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3.5 border-t border-white/[0.06] flex-shrink-0",children:[y.jsx(wi,{onClick:e,children:"Cancel"}),y.jsxs(Ba,{onClick:v,className:"px-4 py-1.5",children:[y.jsx(cp,{className:"w-3 h-3"}),"Create Schedule"]})]})]})})}function zq({sched:t,squads:e,onSave:r,onBack:n}){var b,w;const[i,a]=j.useState(t.name),[o,c]=j.useState(t.cron),[u,d]=j.useState(t.prompt),[p,f]=j.useState(t.targetId??((b=e[0])==null?void 0:b.id)??""),m=()=>{!o.trim()||!u.trim()||!i.trim()||r({name:i.trim(),cron:o.trim(),prompt:u.trim(),targetId:t.targetType==="squad"?p:void 0})},v=t.targetType==="orchestrator"?"IO Schedule":`Squad — ${((w=e.find(x=>x.id===t.targetId))==null?void 0:w.name)??"Unknown"}`;return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6 max-w-3xl",children:[y.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[y.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 text-[11px] font-mono text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:[y.jsx(vl,{className:"w-3.5 h-3.5"}),"Schedules"]}),y.jsx("span",{className:"text-zinc-700 text-[11px]",children:"/"}),y.jsx("span",{className:"text-[11px] font-mono text-zinc-400",children:"Edit"})]}),y.jsxs("div",{className:"flex items-start justify-between mb-6",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Edit Schedule"}),y.jsx("p",{className:"text-[11px] font-mono text-zinc-600 mt-0.5",children:v})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx(wi,{onClick:n,children:"Cancel"}),y.jsxs(Ba,{onClick:m,className:"px-4 py-1.5",children:[y.jsx(cp,{className:"w-3 h-3"}),"Save Changes"]})]})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsx(Fi,{label:"Name",children:y.jsx("input",{value:i,onChange:x=>a(x.target.value),placeholder:"Schedule name",className:`${Ls} w-48`})}),t.targetType==="squad"&&y.jsx(Fi,{label:"Squad",children:y.jsx("select",{value:p,onChange:x=>f(x.target.value),className:`${Ls} w-48`,children:e.map(x=>y.jsx("option",{value:x.id,style:{background:"#1a1a1a",color:"#d4d4d8"},children:x.name},x.id))})}),y.jsx(Fi,{label:"Cron Expression",children:y.jsx("input",{value:o,onChange:x=>c(x.target.value),placeholder:"0 9 * * 1-5",className:`${Ls} w-40`})}),y.jsx(Fi,{label:"Prompt",hint:"supports Markdown",align:"start",children:y.jsxs("div",{className:"space-y-1.5",children:[y.jsx("textarea",{value:u,onChange:x=>d(x.target.value),placeholder:"Describe what IO or the squad should do when this schedule fires.",className:`${jR} leading-relaxed resize-y`,style:{minHeight:"360px"}}),y.jsx("p",{className:"text-[10px] font-mono text-zinc-700",children:"Tip: use # headings and - lists to structure multi-step instructions."})]})})]})]})}function Bq(){const[t,e]=j.useState("squad"),[r,n]=j.useState([]),[i,a]=j.useState([]),[o,c]=j.useState(!1),[u,d]=j.useState(null),p=Fa();j.useEffect(()=>{f(),m()},[]);function f(){Ge.get("/schedules").then(R=>n(R.schedules)).catch(()=>{})}function m(){Ge.get("/squads").then(R=>a(R.squads)).catch(()=>{})}const v=r.filter(R=>R.targetType==="squad"),b=r.filter(R=>R.targetType==="orchestrator"),w=t==="squad"?v:b;async function x(R){try{await Ge.post("/schedules",R),Qe.success("Schedule created"),c(!1),f()}catch($){Qe.error($ instanceof Error?$.message:"Failed to create")}}async function k(R){if(u)try{await Ge.patch(`/schedules/${u.id}`,R),Qe.success("Schedule saved"),d(null),f()}catch{Qe.error("Failed to save schedule")}}const[S,A]=j.useState(null);async function C(R,$){A(R);try{await Ge.patch(`/schedules/${R}`,{enabled:!$}),Qe.success($?"Schedule paused":"Schedule resumed"),f()}catch{Qe.error("Failed to toggle schedule")}finally{A(null)}}async function T(R){A(R);try{await Ge.post(`/schedules/${R}/run`,{}),Qe.success("Schedule triggered")}catch{Qe.error("Failed to trigger schedule")}finally{A(null)}}async function O(R){A(R);try{await Ge.delete(`/schedules/${R}`),Qe.success("Schedule deleted"),f()}catch{Qe.error("Failed to delete")}finally{A(null)}}if(u)return y.jsx(zq,{sched:u,squads:i,onSave:k,onBack:()=>d(null)});const N=t==="squad"?["Squad","Name","Cron","Next Run","Status",""]:["Name","Cron","Next Run","Status",""];return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o&&y.jsx(Lq,{onSave:x,onCancel:()=>c(!1),squads:i}),y.jsxs("div",{className:"flex items-center justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Schedules"}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:[r.filter(R=>R.enabled).length," active ·"," ",r.filter(R=>!R.enabled).length," paused"]})]}),y.jsxs(Ba,{onClick:()=>c(!0),className:"px-3 py-1.5",children:[y.jsx(n1,{className:"w-3.5 h-3.5"}),"Add Schedule"]})]}),y.jsx("div",{className:"flex gap-1 mb-4",children:[["squad","Squad Schedules"],["io","IO Schedules"]].map(([R,$])=>y.jsx("button",{type:"button",onClick:()=>e(R),className:`px-4 py-2 text-[11px] font-mono rounded-xl transition-colors cursor-pointer ${t===R?"text-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:t===R?{background:"rgba(228,58,156,0.12)"}:void 0,children:$},R))}),y.jsx("div",{className:"overflow-x-auto rounded-2xl border border-white/[0.07] glass-card",children:w.length===0?y.jsx("div",{className:"px-4 py-12 text-center text-zinc-600 font-mono text-sm",children:"No schedules for this category"}):y.jsxs("table",{className:"w-full text-[11px] font-mono min-w-[640px]",children:[y.jsx("thead",{children:y.jsx("tr",{className:"border-b border-white/[0.06]",style:{background:"rgba(20,20,20,0.6)"},children:N.map(R=>y.jsx("th",{className:"text-left px-4 py-2.5 text-zinc-600 font-medium",children:R},R))})}),y.jsx("tbody",{children:w.map(R=>{var $,K;return y.jsxs("tr",{className:`border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors ${R.enabled?"":"opacity-50"}`,children:[t==="squad"?y.jsx("td",{className:"px-4 py-3",children:y.jsx(DB,{name:(($=i.find(z=>z.id===R.targetId))==null?void 0:$.name)??"Unknown",color:(K=i.find(z=>z.id===R.targetId))==null?void 0:K.color})}):null,y.jsx("td",{className:"px-4 py-3 text-zinc-300",children:R.name}),y.jsx("td",{className:"px-4 py-3 text-zinc-600 text-[10px]",children:R.cron}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(Qw,{className:"w-3 h-3"}),R.enabled&&R.nextRun?Fs(R.nextRun,p):"—"]})}),y.jsx("td",{className:"px-4 py-3",children:y.jsx(Pt,{variant:R.enabled?"success":"muted",children:R.enabled?"active":"paused"})}),y.jsx("td",{className:"px-4 py-3",children:y.jsxs("div",{className:`flex items-center gap-1 ${S===R.id?"opacity-50 pointer-events-none":""}`,children:[y.jsxs(wi,{onClick:()=>T(R.id),children:[y.jsx(oB,{className:"w-3 h-3"}),"Run now"]}),y.jsx(LB,{onClick:()=>C(R.id,R.enabled),children:R.enabled?y.jsxs(y.Fragment,{children:[y.jsx(tB,{className:"w-3 h-3"}),"Pause"]}):y.jsxs(y.Fragment,{children:[y.jsx(qf,{className:"w-3 h-3"}),"Resume"]})}),y.jsxs(wi,{onClick:()=>d(R),children:[y.jsx(nB,{className:"w-3 h-3"}),"Edit"]}),y.jsxs(Gf,{onClick:()=>O(R.id),children:[y.jsx(Da,{className:"w-3 h-3"}),"Delete"]})]})})]},R.id)})})]})})]})}const Uq=[{id:"general",label:"General"},{id:"telegram",label:"Telegram"},{id:"auth",label:"Auth"}],Bo="rounded-xl border border-white/[0.07] bg-white/[0.04] px-3 py-2 text-sm font-mono text-zinc-300 outline-none focus:border-[#E43A9C]/50",KE=`${Bo} w-[72px]`,qq=`${Bo} w-[100px]`,GE=`${Bo} w-[200px]`,VE=`${Bo} w-[320px]`,Fq=`${Bo} w-[140px] appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%2371717a%22%20d%3D%22M3%204.5L6%208l3-3.5H3z%22%2F%3E%3C%2Fsvg%3E')] bg-[position:right_10px_center] bg-no-repeat pr-8`;function Hq(){const[t,e]=j.useState(null),[r,n]=j.useState("general");j.useEffect(()=>{Ge.get("/config").then(o=>e(o.config)).catch(()=>{})},[]);function i(o){t&&e({...t,...o})}async function a(){if(t)try{const{dataDir:o,...c}=t;await Ge.patch("/config",c),Qe.success("Settings saved")}catch{Qe.error("Failed to save settings")}}return t?y.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y.jsxs("div",{className:"max-w-3xl",children:[y.jsx("h2",{className:"mb-6 text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Settings"}),y.jsx("div",{className:"mb-6 flex gap-6 border-b border-white/[0.07]",children:Uq.map(o=>y.jsx("button",{type:"button",onClick:()=>n(o.id),className:`-mb-px border-b-2 px-1 pb-3 text-[11px] font-mono transition-colors ${r===o.id?"border-[#E43A9C] text-[#E43A9C]":"border-transparent text-zinc-500 hover:text-zinc-300"}`,children:o.label},o.id))}),y.jsxs("div",{className:"glass-card rounded-2xl border border-white/[0.07] p-5",children:[r==="general"&&y.jsxs(y.Fragment,{children:[y.jsx(Bn,{label:"Log Level",children:y.jsx("select",{value:t.logLevel,onChange:o=>i({logLevel:o.target.value}),className:Fq,children:["trace","debug","info","warn","error","fatal"].map(o=>y.jsx("option",{value:o,children:o},o))})}),y.jsx(Bn,{label:"Default Model",children:y.jsx("input",{type:"text",value:t.defaultModel,onChange:o=>i({defaultModel:o.target.value}),className:GE})}),y.jsx(Bn,{label:"Timezone",children:y.jsx("select",{value:t.timezone,onChange:o=>i({timezone:o.target.value}),className:`${Bo} w-[200px] appearance-none bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%2371717a%22%20d%3D%22M3%204.5L6%208l3-3.5H3z%22%2F%3E%3C%2Fsvg%3E')] bg-[position:right_10px_center] bg-no-repeat pr-8`,children:Q4.map(o=>y.jsx("option",{value:o.value,children:o.label},o.value))})}),y.jsx(Bn,{label:"Max Instances",children:y.jsx("input",{type:"number",value:t.maxInstancesPerSquad,onChange:o=>i({maxInstancesPerSquad:Number(o.target.value)}),className:KE,min:1,max:10})}),y.jsx(Bn,{label:"API Port",children:y.jsx("input",{type:"number",value:t.apiPort,onChange:o=>i({apiPort:Number(o.target.value)}),className:KE})}),y.jsx(Bn,{label:"Pricing Refresh (hrs)",children:y.jsx("input",{type:"number",value:t.pricing.refreshIntervalHours,onChange:o=>i({pricing:{refreshIntervalHours:Number(o.target.value)}}),className:qq,min:1})}),y.jsx(Bn,{label:"Data Dir",children:y.jsx("input",{type:"text",value:t.dataDir,readOnly:!0,className:`${VE} cursor-default text-zinc-500`})})]}),r==="telegram"&&y.jsxs(y.Fragment,{children:[y.jsx(Bn,{label:"Bot Token",children:y.jsx(XE,{value:t.telegram.botToken??"",onChange:o=>i({telegram:{...t.telegram,botToken:o||null}}),size:"lg"})}),y.jsx(Bn,{label:"Allowed Chat IDs",children:y.jsx("input",{type:"text",value:t.telegram.allowedChatIds.join(", "),onChange:o=>i({telegram:{...t.telegram,allowedChatIds:o.target.value.split(",").map(c=>Number(c.trim())).filter(c=>!Number.isNaN(c))}}),className:GE})})]}),r==="auth"&&y.jsxs(y.Fragment,{children:[y.jsx(Bn,{label:"Project URL",children:y.jsx("input",{type:"text",value:t.supabase.projectUrl??"",onChange:o=>i({supabase:{...t.supabase,projectUrl:o.target.value||null}}),className:VE})}),y.jsx(Bn,{label:"Anon Key",children:y.jsx(XE,{value:t.supabase.anonKey??"",onChange:o=>i({supabase:{...t.supabase,anonKey:o||null}}),size:"lg"})})]}),y.jsx("div",{className:"flex justify-end pt-6",children:y.jsx(Ba,{onClick:a,className:"px-4 py-2.5",children:"Save Settings"})})]})]})}):y.jsx("div",{className:"flex h-full items-center justify-center text-zinc-600",children:"Loading..."})}function Bn({label:t,children:e}){return y.jsxs("div",{className:"flex items-center justify-between gap-6 border-b border-white/[0.07] py-3",children:[y.jsx("span",{className:"text-[11px] font-mono text-zinc-400 shrink-0",children:t}),y.jsx("div",{className:"flex justify-end",children:e})]})}function XE({value:t,onChange:e,size:r="lg"}){const[n,i]=j.useState(!1),a=r==="lg"?"w-[320px]":"w-[200px]";return y.jsxs("div",{className:"relative",children:[y.jsx("input",{type:n?"text":"password",value:t,onChange:o=>e(o.target.value),className:`${Bo} ${a} pr-9`}),y.jsx("button",{type:"button",onClick:()=>i(o=>!o),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-zinc-600 transition-colors hover:text-zinc-400","aria-label":n?"Hide value":"Show value",children:n?y.jsx(Iz,{size:14}):y.jsx(Zb,{size:14})})]})}function gf(t){return"url"in t&&t.url?t.url:t.name}const Wq=[{id:"installed",label:"Installed"},{id:"awesome-copilot",label:"Awesome Copilot"},{id:"skillssh",label:"skills.sh"}];function YE(t){return t==="awesome-copilot"?"Awesome Copilot":"skills.sh"}function JE(t){return t?t>=1e6?`${(t/1e6).toFixed(1).replace(/\.0$/,"")}M installs`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}K installs`:`${t} installs`:null}function Kq(t){return t.slice(1,-1).split(",").map(e=>e.trim().replace(/^["']|["']$/g,""))}function Gq(t){const e={};let r="",n=null;for(const i of t.split(`
|
|
449
|
+
`)){const a=i.match(/^(\w[\w-]*)\s*:\s*(.*)$/);if(a){r&&n&&(e[r]=n,n=null),r=a[1]??"";const o=(a[2]??"").trim();o===""||o==="[]"?n=[]:o.startsWith("[")&&o.endsWith("]")?e[r]=Kq(o):e[r]=o.replace(/^["']|["']$/g,"")}else i.match(/^\s+-\s+(.+)/)&&r&&(n||(n=[]),n.push(i.replace(/^\s+-\s+/,"").trim()))}return r&&n&&(e[r]=n),e}function Vq(t){const e=t.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);return e?{frontMatter:Gq(e[1]??""),body:e[2]??""}:{frontMatter:{},body:t}}const ZE=["name","description","version","author","license","argument_hint","argument-hint","use_when","use-when","enhancements","metadata","tags"];function Xq({content:t}){const{frontMatter:e,body:r}=Vq(t),n=ZE.filter(o=>e[o]!==void 0),i=Object.keys(e).filter(o=>!ZE.includes(o)),a=[...n,...i];return y.jsxs("div",{children:[a.length>0&&y.jsxs("div",{className:"border-b border-white/[0.05] pb-4 mb-4",children:[y.jsx("p",{className:"text-[10px] font-mono text-zinc-700 uppercase tracking-wider mb-3",children:"Front Matter"}),y.jsx("div",{className:"space-y-2",children:a.map(o=>{const c=e[o];return c==null||Array.isArray(c)&&c.length===0?null:y.jsxs("div",{className:"flex gap-3 items-start",children:[y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 w-28 flex-shrink-0 pt-0.5",children:o}),y.jsx("div",{className:"flex-1 min-w-0",children:Array.isArray(c)?y.jsx("div",{className:"flex flex-wrap gap-1",children:c.map(u=>y.jsx(Pt,{variant:"muted",children:u},`${o}-${u}`))}):typeof c=="object"?y.jsx("div",{className:"space-y-0.5",children:Object.entries(c).map(([u,d])=>y.jsxs("p",{className:"text-[11px] font-mono text-zinc-400",children:[y.jsxs("span",{className:"text-zinc-600",children:[u,":"]})," ",d]},u))}):o==="use_when"||o==="use-when"?y.jsx("p",{className:"text-[11px] text-zinc-300 leading-relaxed",children:c}):o==="argument_hint"||o==="argument-hint"?y.jsx("code",{className:"text-[11px] font-mono text-[#E43A9C] bg-[#2d1a24] px-1.5 py-0.5 rounded",children:c}):y.jsx("span",{className:"text-[11px] font-mono text-zinc-300",children:c})})]},o)})})]}),r.trim()&&y.jsxs("div",{children:[y.jsx("p",{className:"text-[10px] font-mono text-zinc-700 uppercase tracking-wider mb-3",children:"Body"}),y.jsx($u,{content:r})]})]})}function Yq(){const[t,e]=j.useState("installed"),[r,n]=j.useState([]),[i,a]=j.useState([]),[o,c]=j.useState(null),[u,d]=j.useState(null),[p,f]=j.useState(""),[m,v]=j.useState(!1),[b,w]=j.useState(!1),[x,k]=j.useState(!1),[S,A]=j.useState(""),[C,T]=j.useState(null),[O,N]=j.useState(null),R=j.useCallback(async()=>{try{const I=await Ge.get("/skills"),q=new Set(I.skills.map(ee=>(ee.name||"").toLowerCase()));n(I.skills),a(ee=>ee.map(le=>({...le,installed:q.has((le.name||"").toLowerCase())})))}catch(I){Qe.error(I instanceof Error?I.message:"Failed to load skills")}},[]),$=j.useCallback(async I=>{w(!0);try{const q=await Ge.get(`/skills/${encodeURIComponent(I)}`);d(q),A(q.content)}catch(q){Qe.error(q instanceof Error?q.message:"Failed to load skill"),d(null)}finally{w(!1)}},[]);j.useEffect(()=>{R()},[R]),j.useEffect(()=>{if(t==="installed"){N(null);return}const I=p.trim();if(t==="skillssh"&&!I){a([]),N(null),v(!1);return}let q=!1;v(!0);const ee=window.setTimeout(async()=>{try{const le=await Ge.get(`/skills/discover?source=${t}&q=${encodeURIComponent(I)}`);if(q)return;a(le.skills),N(null)}catch(le){if(q)return;a([]),N(le instanceof Error?le.message:"Discovery failed")}finally{q||v(!1)}},250);return()=>{q=!0,window.clearTimeout(ee)}},[p,t]);const K=j.useMemo(()=>{const I=p.trim().toLowerCase();return I?r.filter(q=>[q.name,q.description,q.preview].some(ee=>ee==null?void 0:ee.toLowerCase().includes(I))):r},[r,p]),z=t==="installed"?K:i,U=K.find(I=>I.name===o)??null,F=i.find(I=>gf(I)===o)??null,X=(U==null?void 0:U.name)??(F==null?void 0:F.name)??null;j.useEffect(()=>{if(k(!1),!z.length){c(null),t!=="installed"&&d(null);return}if(!o||!z.some(I=>gf(I)===o)){const I=z[0];I&&c(gf(I))}},[o,t,z]),j.useEffect(()=>{if(t!=="installed"||!X){d(null);return}$(X)},[$,X,t]);async function Y(I){if(!I.url&&!I.registrySource){Qe.error("Install source is not available for this skill yet");return}T(I.name);try{await Ge.post("/skills/install",{name:I.name,source:I.source,url:I.url,registrySource:I.registrySource,skillId:I.skillId}),Qe.success(`Installed ${I.title||I.name}`),await R(),a(q=>q.map(ee=>ee.name===I.name?{...ee,installed:!0}:ee))}catch(q){Qe.error(q instanceof Error?q.message:"Install failed")}finally{T(null)}}async function G(I){T(I);try{await Ge.delete(`/skills/${encodeURIComponent(I)}`),Qe.success(`Removed ${I}`),await R(),a(q=>q.map(ee=>ee.name===I?{...ee,installed:!1}:ee))}catch(q){Qe.error(q instanceof Error?q.message:"Failed to remove skill")}finally{T(null)}}async function Z(){if(u){T(u.name);try{await Ge.put(`/skills/${encodeURIComponent(u.name)}`,{content:S}),Qe.success(`Updated ${u.name}`),k(!1),await Promise.all([R(),$(u.name)])}catch(I){Qe.error(I instanceof Error?I.message:"Failed to save skill")}finally{T(null)}}}const W=!!(U!=null&&U.activatedForOrchestrator),Q=C===(u==null?void 0:u.name),L=C===(F==null?void 0:F.name);return y.jsxs("div",{className:"flex flex-1 min-h-0 overflow-hidden",children:[y.jsxs("div",{className:"w-64 flex-shrink-0 border-r border-white/[0.06] flex flex-col overflow-hidden",children:[y.jsxs("div",{className:"px-2.5 pt-2.5 pb-2 flex-shrink-0 border-b border-white/[0.06] space-y-2",children:[y.jsxs("div",{className:"relative",children:[y.jsx(LP,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3 w-3 -translate-y-1/2 text-zinc-700"}),y.jsx("input",{type:"text",value:p,onChange:I=>f(I.target.value),placeholder:"Search skills…",className:"w-full bg-[#181818] border border-white/[0.06] rounded-xl pl-7 pr-2 py-1.5 text-[11px] text-zinc-300 font-mono placeholder:text-zinc-700 focus:outline-none focus:border-[#E43A9C]/30 transition-colors"})]}),y.jsx("div",{className:"flex flex-col gap-0.5",children:Wq.map(I=>y.jsxs("button",{type:"button",onClick:()=>e(I.id),className:`w-full text-left px-2.5 py-1.5 rounded-lg text-[11px] font-mono transition-colors flex items-center justify-between cursor-pointer ${t===I.id?"text-[#E43A9C]":"text-zinc-500 hover:text-zinc-300 hover:bg-white/[0.04]"}`,style:t===I.id?{background:"rgba(228,58,156,0.10)"}:void 0,children:[y.jsx("span",{children:I.label}),I.id==="installed"&&y.jsx("span",{className:"text-[10px] text-zinc-600",children:r.length})]},I.id))})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto py-1.5",children:[m&&t!=="installed"?y.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-white/[0.08] bg-white/[0.03] px-3 py-3 font-mono text-[11px] text-zinc-500",children:[y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"})," Searching registry..."]}):null,z.map(I=>{const q=gf(I),ee=o===q,le=I.description||("preview"in I?I.preview:"No description available.");return y.jsxs("button",{type:"button",onClick:()=>{k(!1),c(q)},className:`w-full text-left px-3 py-2.5 border-b border-white/[0.03] transition-colors cursor-pointer ${ee?"border-l-2 border-l-[#E43A9C] bg-[#E43A9C]/5":"hover:bg-white/[0.03]"}`,children:[y.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[y.jsx("span",{className:"truncate font-mono text-[11px] text-zinc-200",children:I.name}),"installed"in I&&I.installed?y.jsx(Pt,{variant:"success",children:"installed"}):null]}),y.jsx("p",{className:"line-clamp-2 font-mono text-[10px] leading-relaxed text-zinc-600",children:le})]},`${t}:${q}`)}),!m&&z.length===0?y.jsx("div",{className:"px-4 py-8",children:y.jsx("p",{className:"font-mono text-[11px] leading-relaxed text-zinc-500",children:O||(t==="skillssh"&&!p.trim()?"Start typing to search the skills.sh registry.":p.trim()?"No skills match your search.":"No skills available in this source.")})}):null]})]}),y.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-5",children:t==="installed"&&U?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4 border-b border-white/[0.06] pb-5",children:[y.jsxs("div",{className:"flex min-w-0 gap-4",children:[y.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-[#E43A9C]/12 text-[#E43A9C]",children:y.jsx(ex,{className:"h-6 w-6"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate text-[34px] uppercase tracking-[0.08em] text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:U.name}),y.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[y.jsx(Pt,{variant:"success",children:"installed"}),W?y.jsx(Pt,{variant:"warning",children:"active"}):y.jsx(Pt,{variant:"muted",children:"inactive"}),y.jsx(Pt,{variant:"muted",children:"local skill"})]}),y.jsxs("div",{className:"mt-3 space-y-1 font-mono text-[11px] text-zinc-500",children:[y.jsxs("p",{children:["path: ",U.filePath]}),y.jsxs("p",{children:["orchestrator: ",W?"enabled":"disabled"]})]})]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[x?y.jsxs(Ba,{onClick:Z,disabled:Q||S===(u==null?void 0:u.content),className:"px-3 py-2",children:[Q?y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"}):y.jsx(Ff,{className:"h-3.5 w-3.5"}),"Save"]}):y.jsxs(wi,{onClick:()=>k(!0),className:"px-3 py-2",children:[y.jsx(Ff,{className:"h-3.5 w-3.5"})," Edit"]}),y.jsxs(Gf,{onClick:()=>G(U.name),className:"px-3 py-2",children:[Q?y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"}):y.jsx(Da,{className:"h-3.5 w-3.5"}),"Remove"]})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:b&&!u?y.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px] text-zinc-500",children:[y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"})," Loading skill..."]}):x?y.jsxs("div",{className:"space-y-3",children:[y.jsx("textarea",{value:S,onChange:I=>A(I.target.value),className:"min-h-[440px] w-full rounded-2xl border border-white/[0.08] bg-black/30 p-4 font-mono text-[12px] leading-6 text-zinc-200 outline-none transition-colors focus:border-[#E43A9C]/50"}),y.jsxs("div",{className:"flex items-center justify-between font-mono text-[11px] text-zinc-500",children:[y.jsx("span",{children:"Editing raw SKILL.md"}),y.jsx(wi,{onClick:()=>{k(!1),A((u==null?void 0:u.content)??"")},className:"px-3 py-2",children:"Cancel"})]})]}):u?y.jsx(Xq,{content:u.content}):y.jsx("p",{className:"font-mono text-[11px] text-zinc-500",children:"Select an installed skill to inspect it."})})]}):t!=="installed"&&F?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4 border-b border-white/[0.06] pb-5",children:[y.jsxs("div",{className:"flex min-w-0 gap-4",children:[y.jsx("div",{className:"flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-[#E43A9C]/12 text-[#E43A9C]",children:y.jsx(gB,{className:"h-6 w-6"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h3",{className:"truncate text-[34px] uppercase tracking-[0.08em] text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:F.title||F.name}),y.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[y.jsx(Pt,{variant:F.installed?"success":"default",children:F.installed?"installed":"available"}),y.jsx(Pt,{variant:"muted",children:YE(F.source)}),JE(F.installs)?y.jsx(Pt,{variant:"info",children:JE(F.installs)}):null]}),y.jsxs("div",{className:"mt-3 space-y-1 font-mono text-[11px] text-zinc-500",children:[y.jsxs("p",{children:["registry: ",YE(F.source)]}),F.registrySource?y.jsxs("p",{children:["source: ",F.registrySource]}):null,F.url?y.jsxs("p",{children:["url: ",F.url]}):null]})]})]}),y.jsx("div",{className:"flex items-center gap-2",children:F.installed?y.jsx(wi,{onClick:()=>{e("installed"),c(F.name)},className:"px-3 py-2",children:"Open installed"}):y.jsxs(Ba,{onClick:()=>Y(F),disabled:L||!F.url&&!F.registrySource,className:"px-3 py-2",children:[L?y.jsx(Ts,{className:"h-3.5 w-3.5 animate-spin"}):y.jsx(Nz,{className:"h-3.5 w-3.5"}),"Install"]})})]}),y.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto pr-1",children:[y.jsx("div",{className:"rounded-2xl border border-white/[0.06] bg-white/[0.02] p-5",children:y.jsx("p",{className:"font-mono text-[12px] leading-7 text-zinc-300",children:F.description||"No registry description is available for this skill yet."})}),y.jsx("div",{className:"mt-4 rounded-2xl border border-dashed border-white/[0.08] bg-black/20 p-4 font-mono text-[11px] leading-6 text-zinc-500",children:"Install will fetch the skill definition from the selected registry source and add it to your local skills library."})]})]}):y.jsx("div",{className:"flex h-full items-center justify-center rounded-2xl border border-dashed border-white/[0.08] bg-white/[0.02] p-8 text-center",children:y.jsxs("div",{children:[y.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-[#E43A9C]/12 text-[#E43A9C]",children:y.jsx(ex,{className:"h-6 w-6"})}),y.jsx("h3",{className:"text-[28px] uppercase tracking-[0.08em] text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Select a Skill"}),y.jsx("p",{className:"mt-2 font-mono text-[11px] leading-relaxed text-zinc-500",children:"Choose a skill from the left panel to inspect details, install registry entries, or edit local definitions."})]})})})]})}function $f(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return`hsl(${(e%360+360)%360}, 70%, 65%)`}function yf(){const{name:t,instanceId:e,role:r}=hL();return t&&r?y.jsx(i9,{squadName:t,role:r}):t&&e?y.jsx(n9,{squadName:t,instanceId:e}):t?y.jsx(Qq,{name:t}):y.jsx(Jq,{})}function Jq(){const[t,e]=j.useState([]),[r,n]=j.useState(null),i=gl();return j.useEffect(()=>{Promise.all([Ge.get("/squads"),Ge.get("/config")]).then(([a,o])=>{e(a.squads),n(o.config.maxInstancesPerSquad)}).catch(()=>{})},[]),y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[y.jsx("div",{className:"mb-6",children:y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide text-zinc-100",style:{fontFamily:"'Bebas Neue', sans-serif"},children:"Squads"}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:[t.length," squads · ",t.reduce((a,o)=>a+(o.activeInstances||0),0)," ","active instances"]})]})}),y.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3",children:[t.map(a=>{var c;const o=a.color||"#38bdf8";return y.jsxs("button",{type:"button",onClick:()=>i(`/squads/${a.name}`),className:"text-left rounded-2xl p-5 transition-all group cursor-pointer",style:{border:`1px solid ${o}30`,background:`${o}08`,backdropFilter:"blur(20px)"},onMouseEnter:u=>{u.currentTarget.style.borderColor=`${o}70`,u.currentTarget.style.background=`${o}12`},onMouseLeave:u=>{u.currentTarget.style.borderColor=`${o}30`,u.currentTarget.style.background=`${o}08`},children:[y.jsxs("div",{className:"flex items-start justify-between mb-1",children:[y.jsx("h3",{className:"text-sm font-mono transition-colors",style:{color:o},children:a.name}),y.jsx(Pt,{variant:Ms(a.status),children:a.status})]}),y.jsxs("div",{className:"flex items-center justify-between mb-3",children:[y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono",children:((c=a.config)==null?void 0:c.prMode)??"draft-pr"}),y.jsxs("span",{className:"text-[11px] text-zinc-600 font-mono flex items-center gap-1",children:[y.jsx(Tz,{className:"w-3 h-3"}),a.activeInstances,"/",r??(a.totalInstances||a.memberCount)]})]}),a.repoUrl&&y.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-zinc-700 font-mono mb-4",children:[y.jsx(t1,{className:"w-3 h-3 flex-shrink-0"}),y.jsx("span",{className:"truncate",children:a.repoUrl.replace("https://github.com/","")})]}),a.recentActivity&&a.recentActivity.length>0&&y.jsxs("div",{className:"border-t pt-3",style:{borderColor:`${o}15`},children:[y.jsx("p",{className:"text-[10px] font-mono uppercase tracking-wider mb-2",style:{color:`${o}80`},children:"Recent Work"}),y.jsx("ul",{className:"space-y-1.5",children:a.recentActivity.map(u=>{const d={className:"w-3.5 h-3.5 flex-shrink-0 mt-px"},p=Zq(u.status,d),f=u.objective?u.objective.length>60?`${u.objective.slice(0,60)}…`:u.objective:u.issueRef||"Instance";return y.jsxs("li",{className:"flex items-start gap-1.5 text-[11px] font-mono text-zinc-600",children:[p,y.jsx("span",{className:"truncate",children:f})]},u.id)})})]})]},a.id)}),t.length===0&&y.jsxs("div",{className:"col-span-full text-center py-12 text-zinc-600",children:[y.jsx(i1,{size:48,className:"mx-auto mb-3 opacity-30"}),y.jsx("p",{className:"text-[11px] font-mono",children:"No squads hired yet. Ask IO to hire a squad for a project."})]})]})]})}function Zq(t,e){const r=t.toLowerCase();return r.includes("complete")||r.includes("success")||r.includes("done")?y.jsx(RP,{...e,style:{color:"#34d399"}}):r.includes("warning")||r.includes("review")?y.jsx(wB,{...e,style:{color:"#fbbf24"}}):r.includes("error")||r.includes("fail")?y.jsx(IP,{...e,style:{color:"#f87171"}}):r.includes("working")||r.includes("progress")||r.includes("running")?y.jsx(MP,{...e,style:{color:"#E43A9C"}}):y.jsx(Wz,{...e,style:{color:"#60a5fa"}})}function Hs(t,e){const r="w-4 h-4",n={color:e},i=t.toLowerCase();return i.includes("lead")||i.includes("pm")||i.includes("technical")?y.jsx(e1,{className:r,style:n}):i.includes("qa")||i.includes("test")?y.jsx(mz,{className:r,style:n}):i.includes("scribe")?y.jsx(uB,{className:r,style:n}):y.jsx(qc,{className:r,style:n})}function Qq({name:t}){var k;const[e,r]=j.useState(null),[n,i]=j.useState("agents"),[a,o]=j.useState([]),[c,u]=j.useState(0),[d,p]=j.useState(null),[f,m]=j.useState([]),v=gl(),b=Fa();j.useEffect(()=>{Ge.get(`/squads/${t}`).then(r).catch(()=>{})},[t]),j.useEffect(()=>{n==="history"&&Ge.get(`/squads/${t}/history`).then(S=>{o(S.items),u(S.total)}).catch(()=>{}),n==="schedules"&&e&&Ge.get(`/schedules?targetId=${e.squad.id}`).then(S=>m(S.schedules)).catch(()=>{})},[n,t,e]);const w=S=>{Ge.get(`/squads/${t}/history/${S.id}`).then(p).catch(()=>Qe.error("Failed to load activity detail"))};if(!e)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600",children:"Loading..."});const x=e.squad.color||"#38bdf8";return d?y.jsx(e9,{activity:d,squadColor:x,squadName:e.squad.name,onBack:()=>p(null)}):y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${x}06`},children:[y.jsxs("button",{type:"button",onClick:()=>v("/squads"),className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," All Squads"]}),y.jsxs("div",{className:"flex items-start justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-3xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:x},children:e.squad.name}),y.jsxs("p",{className:"text-[11px] text-zinc-600 font-mono",children:[((k=e.squad.config)==null?void 0:k.prMode)??"draft-pr"," · ",e.squad.autonomyTier||"standard"," ","autonomy"]}),e.squad.repoUrl&&y.jsxs("a",{href:e.squad.repoUrl,target:"_blank",rel:"noreferrer",className:"text-[11px] font-mono text-[#E43A9C] hover:text-[#F041FF] flex items-center gap-1 mt-1 transition-colors",children:[y.jsx(t1,{className:"w-3 h-3"}),e.squad.repoUrl.replace("https://github.com/","")]})]}),y.jsx(Pt,{variant:Ms(e.squad.status),children:e.squad.status})]}),y.jsx("div",{className:"flex gap-0 mb-5 border-b border-white/[0.06]",children:["agents","instances","schedules","history"].map(S=>y.jsx("button",{type:"button",onClick:()=>i(S),className:`px-4 py-2 text-[11px] font-mono capitalize transition-colors border-b-2 -mb-px ${n===S?"text-[#E43A9C] border-[#E43A9C]":"text-zinc-600 hover:text-zinc-300 border-transparent"}`,children:S},S))}),n==="agents"&&y.jsx("div",{className:"space-y-2",children:e.members.map(S=>y.jsxs("button",{type:"button",onClick:()=>v(`/squads/${t}/agents/${S.roleName||S.role}`),className:"w-full glass-card border border-white/[0.07] rounded-2xl p-4 flex items-center gap-3 hover:bg-white/[0.03] transition-colors cursor-pointer text-left",children:[y.jsx("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center flex-shrink-0",style:{border:`1px solid ${x}30`,background:`${x}12`},children:Hs(S.roleName||S.role,x)}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-sm font-mono text-zinc-200",children:S.displayName}),y.jsx(Pt,{variant:Ms(S.status),children:S.status})]}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:S.role}),S.currentTask&&y.jsx("p",{className:"text-xs text-zinc-500 mt-1 truncate",children:S.currentTask})]})]},S.id))}),n==="instances"&&y.jsx("div",{className:"space-y-2",children:e.instances.length===0?y.jsx("div",{className:"text-center py-16 text-zinc-700 font-mono text-sm",children:"No active instances"}):e.instances.map(S=>y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-4 flex items-center gap-4",children:[y.jsxs("div",{className:"flex-1 grid grid-cols-2 gap-2 text-[11px] font-mono",children:[y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"ID"}),y.jsx("p",{className:"text-zinc-300 mt-0.5 truncate",children:S.id.slice(0,8)})]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"Branch"}),y.jsx("p",{className:"text-zinc-300 mt-0.5 truncate",children:S.branch||"—"})]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"Status"}),y.jsx("p",{className:"text-zinc-300 mt-0.5",children:y.jsx(Pt,{variant:Ms(S.status),children:S.status})})]}),y.jsxs("div",{children:[y.jsx("span",{className:"text-zinc-700",children:"Tasks"}),y.jsxs("p",{className:"text-zinc-300 mt-0.5",children:[S.tasksComplete,"/",S.taskCount]})]})]}),y.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[y.jsx("button",{type:"button",onClick:()=>v(`/squads/${t}/instances/${S.id}`),title:"View instance agents",className:"p-2 rounded-xl hover:bg-white/[0.06] transition-colors cursor-pointer",style:{color:x},children:y.jsx(qf,{className:"w-4 h-4"})}),y.jsx("button",{type:"button",onClick:async()=>{try{await Ge.post(`/squads/${t}/instances/${S.id}/cancel`),Qe.success("Instance cancelled")}catch{Qe.error("Failed to cancel instance")}},title:"Stop instance",className:"p-2 rounded-xl hover:bg-red-500/10 text-zinc-600 hover:text-red-400 transition-colors cursor-pointer",children:y.jsx(up,{className:"w-4 h-4"})})]})]},S.id))}),n==="schedules"&&y.jsx("div",{className:"overflow-auto rounded-2xl border border-white/[0.07] glass-card",children:f.length===0?y.jsx("div",{className:"text-center py-16 text-zinc-700 font-mono text-sm",children:"No schedules for this squad"}):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]",style:{background:"rgba(20,20,20,0.6)"},children:["Schedule","Next Run","Status"].map(S=>y.jsx("th",{className:"text-left px-4 py-2.5 text-zinc-600 font-medium",children:S},S))})}),y.jsx("tbody",{children:f.map(S=>y.jsxs("tr",{className:`border-b border-white/[0.04] hover:bg-white/[0.015] transition-colors ${S.enabled?"":"opacity-50"}`,children:[y.jsxs("td",{className:"px-4 py-3",children:[y.jsx("div",{className:"text-zinc-300",children:S.name||S.prompt}),y.jsx("div",{className:"text-zinc-700 text-[10px] mt-0.5",children:S.cron})]}),y.jsx("td",{className:"px-4 py-3 text-zinc-600",children:y.jsxs("span",{className:"flex items-center gap-1",children:[y.jsx(Qw,{className:"w-3 h-3"}),S.enabled&&S.nextRun?Fs(S.nextRun,b):"—"]})}),y.jsx("td",{className:"px-4 py-3",children:y.jsx(Pt,{variant:S.enabled?"success":"muted",children:S.enabled?"active":"paused"})})]},S.id))})]})}),n==="history"&&y.jsxs("div",{className:"space-y-2",children:[a.length===0?y.jsx("div",{className:"text-center py-16 text-zinc-700 font-mono text-sm",children:"No history yet"}):a.map(S=>y.jsxs("button",{type:"button",onClick:()=>w(S),className:"w-full glass-card border border-white/[0.07] rounded-2xl px-4 py-3.5 flex items-center gap-3 hover:bg-white/[0.03] transition-colors cursor-pointer text-left",children:[y.jsx("div",{className:"flex-shrink-0",children:S.status==="completed"?y.jsx(RP,{className:"w-4 h-4",style:{color:"#34d399"}}):y.jsx(IP,{className:"w-4 h-4",style:{color:"#f87171"}})}),y.jsxs("div",{className:"flex-1 min-w-0",children:[y.jsx("p",{className:"text-[12px] text-zinc-300 font-mono truncate",children:S.title}),y.jsxs("div",{className:"flex items-center gap-3 mt-0.5",children:[y.jsx("span",{className:"text-[10px] text-zinc-700 font-mono",children:Fs(S.completedAt||S.createdAt,b)}),y.jsxs("span",{className:"text-[10px] text-zinc-700 font-mono flex items-center gap-1",children:[y.jsx(qf,{className:"w-2.5 h-2.5"}),S.duration||"—"]}),y.jsxs("span",{className:"text-[10px] text-zinc-700 font-mono flex items-center gap-1",children:[y.jsx(qc,{className:"w-2.5 h-2.5"}),S.agentCount," agent",S.agentCount!==1?"s":""]})]})]}),y.jsx(Pt,{variant:S.status==="completed"?"success":"error",children:S.status})]},S.id)),a.length<c&&y.jsx("button",{type:"button",onClick:()=>{Ge.get(`/squads/${t}/history?offset=${a.length}`).then(S=>{o(A=>[...A,...S.items])}).catch(()=>{})},className:"w-full text-center py-3 text-[11px] font-mono text-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:"Load more"})]})]})}function e9({activity:t,squadColor:e,squadName:r,onBack:n}){const i=Fa(),[a,o]=j.useState(new Set),c=j.useMemo(()=>{const v={};for(const b of t.agentEntries)v[b.agentId]=$f(b.agentName);return v},[t]),u={thought:{label:"Thinking",icon:r1},tool_call:{label:"Tool Call",icon:BP},tool_result:{label:"Tool Result",icon:$P},message:{label:"Message",icon:qc},decision:{label:"Decision",icon:e1}},d={label:"Message",icon:qc},p=v=>u[v]??d,f=v=>{o(b=>{const w=new Set(b);return w.has(v)?w.delete(v):w.add(v),w})},m=j.useMemo(()=>{const v=t.agentEntries.flatMap(b=>b.events.map(w=>({ev:w,entry:b})));return v.sort((b,w)=>b.ev.timestamp.localeCompare(w.ev.timestamp)),a.size>0?v.filter(({entry:b})=>a.has(b.agentId)):v},[t,a]);return y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${e}06`},children:[y.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors cursor-pointer",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," Back to ",r]}),y.jsxs("div",{className:"flex items-start justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:e},children:t.title}),y.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[y.jsx("span",{className:"text-[11px] text-zinc-600 font-mono",children:Fs(t.completedAt||t.createdAt,i)}),y.jsxs("span",{className:"text-[11px] text-zinc-700 font-mono flex items-center gap-1",children:[y.jsx(Qw,{className:"w-3 h-3"}),t.duration||"—"]})]})]}),y.jsx(Pt,{variant:t.status==="completed"?"success":"error",children:t.status})]}),y.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[t.agentEntries.map(v=>{const b=c[v.agentId],w=a.has(v.agentId),k=!(a.size>0)||w;return y.jsxs("button",{type:"button",onClick:()=>f(v.agentId),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl border transition-all cursor-pointer",style:{borderColor:k?`${b}30`:"rgba(255,255,255,0.05)",background:k?`${b}10`:"transparent",opacity:k?1:.4},children:[Hs(v.roleType||v.role,b),y.jsx("span",{className:"text-[11px] font-mono",style:{color:k?b:"#71717a"},children:v.agentName}),y.jsxs("span",{className:"text-[10px] font-mono text-zinc-500",children:["— ",v.role]})]},v.agentId)}),a.size>0&&y.jsx("button",{type:"button",onClick:()=>o(new Set),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-xl border border-white/[0.1] text-[11px] font-mono text-zinc-400 hover:text-zinc-200 transition-colors cursor-pointer",children:"Show all"})]}),y.jsxs("div",{className:"relative pl-10",children:[y.jsx("div",{className:"absolute left-[15px] top-0 bottom-0 w-px bg-white/[0.06]"}),y.jsx("div",{className:"space-y-3",children:m.map(({ev:v,entry:b})=>{const w=c[b.agentId],{label:x,icon:k}=p(v.kind),S=v.kind==="tool_call"||v.kind==="tool_result";return y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute -left-10 top-3 w-[30px] h-[30px] rounded-full flex items-center justify-center",style:{background:`${w}15`,border:`1px solid ${w}35`},children:y.jsx(k,{className:"w-3.5 h-3.5",style:{color:w}})}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-4 py-3",children:[y.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.jsxs("div",{className:"flex items-center gap-1",children:[Hs(b.roleType||b.role,w),y.jsx("span",{className:"text-[10px] font-mono",style:{color:w},children:b.agentName})]}),y.jsx("span",{className:"text-zinc-700 text-[10px]",children:"·"}),y.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-zinc-500",children:x}),v.label&&y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 border border-white/[0.08] rounded px-1.5 py-px bg-white/[0.03]",children:v.label}),v.status==="error"&&y.jsx(Pt,{variant:"error",children:"failed"}),v.status==="ok"&&v.kind==="tool_result"&&y.jsx(Pt,{variant:"success",children:"ok"})]}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 flex-shrink-0 ml-2",children:lp(v.timestamp,i)})]}),S?y.jsx("pre",{className:"text-[11px] font-mono text-zinc-400 whitespace-pre-wrap leading-relaxed overflow-x-auto rounded-lg p-2 mt-1 bg-black/20",children:v.content}):y.jsx($u,{content:v.content,className:"text-[12px] [&_pre]:text-[10px]"})]})]},v.id)})})]})]})}const t9={thought:{label:"Thinking",icon:r1,color:"#a78bfa",bg:"rgba(167,139,250,0.1)"},tool_call:{label:"Tool Call",icon:BP,color:"#38bdf8",bg:"rgba(56,189,248,0.1)"},tool_result:{label:"Tool Result",icon:$P,color:"#34d399",bg:"rgba(52,211,153,0.1)"},message:{label:"Message",icon:qc,color:"#E43A9C",bg:"rgba(228,58,156,0.15)"},decision:{label:"Decision",icon:e1,color:"#fbbf24",bg:"rgba(251,191,36,0.1)"},meeting:{label:"Meeting",icon:i1,color:"#818cf8",bg:"rgba(129,140,248,0.1)"}};function r9(t){const e=t.toLowerCase();return e.includes("meeting")?"meeting":e.includes("tool_call")||e.includes("tool-call")?"tool_call":e.includes("tool_result")||e.includes("tool-result")?"tool_result":e.includes("thought")||e.includes("thinking")||e.includes("reason")?"thought":e.includes("decision")?"decision":"message"}function n9({squadName:t,instanceId:e}){const[r,n]=j.useState(null),[i,a]=j.useState([]),[o,c]=j.useState(null),[u,d]=j.useState("running"),[p,f]=j.useState(0),m=gl(),v=Fa(),b=j.useRef(null),w=j.useRef(null),x=j.useRef(!0),k=j.useCallback(()=>{const $=b.current;if(!$)return;const K=100;x.current=$.scrollHeight-$.scrollTop-$.clientHeight<K,x.current&&f(0)},[]);if(j.useEffect(()=>{Ge.get(`/squads/${t}/instances/${e}`).then($=>{n($),d($.instance.status)}).catch(()=>{Qe.error("Failed to load instance")})},[t,e]),FP({onEvent:$=>{if(!$.event)return;const K=$.event;if((K.type==="instance:completed"||K.type==="instance:failed"||K.type==="instance.completed"||K.type==="instance.failed")&&K.instanceId===e){d(K.type==="instance:completed"||K.type==="instance.completed"?"completed":"failed");return}if((K.type.startsWith("agent:")||K.type.startsWith("agent."))&&K.instanceId===e){const z=K.data,U=(z==null?void 0:z.tool)||null,F=typeof(z==null?void 0:z.success)=="boolean"?z.success:null;let X="";if(U&&(z!=null&&z.arguments)){const G=z.arguments;if(typeof G=="string")X=G;else if(typeof G=="object"&&G!==null){const Z=G;Z.command?X=String(Z.command):X=JSON.stringify(G,null,2)}}else z!=null&&z.result?X=String(z.result):z!=null&&z.error?X=String(z.error):X=(z==null?void 0:z.content)||"";try{const G=JSON.parse(X);typeof G=="object"&&G!==null&&(X=G.message??G.content??G.response??G.decision??JSON.stringify(G,null,2))}catch{}const Y={id:K.id,agent:K.agentRole||(z==null?void 0:z.agentRole)||"unknown",type:K.type.replace(/^agent[:.]/,""),content:X,toolName:U,success:F,model:K.model||(z==null?void 0:z.model)||null,tokensUsed:null,timestamp:K.timestamp};a(G=>[...G,Y]),x.current?setTimeout(()=>{var G;return(G=w.current)==null?void 0:G.scrollIntoView({behavior:"smooth"})},50):f(G=>G+1)}}}),!r)return y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600",children:"Loading..."});const S=r.squadColor||"#38bdf8",A=[...r.activity,...i],C=Array.from(new Map(A.map($=>[$.id,$])).values());C.sort(($,K)=>$.timestamp.localeCompare(K.timestamp));const T=o?C.filter($=>$.agent===o):C,O=[...new Set(C.map($=>$.agent))],N={};for(const $ of O)N[$]=$f($);const R=u==="running"||u==="working"||u==="meeting"||u==="planning";return y.jsxs("div",{ref:b,onScroll:k,className:"flex-1 overflow-y-auto p-6",style:{background:`${S}06`},children:[y.jsxs("button",{type:"button",onClick:()=>m(`/squads/${t}`),className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," Back to ",t]}),y.jsxs("div",{className:"flex items-start justify-between mb-5",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"text-2xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:S},children:"Instance"}),y.jsx("p",{className:"text-[11px] text-zinc-600 font-mono mt-0.5",children:r.instance.id.slice(0,8)}),r.instance.branch&&y.jsx("p",{className:"text-[11px] text-zinc-700 font-mono mt-0.5",children:r.instance.branch})]}),y.jsx(Pt,{variant:Ms(u),children:u})]}),y.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.members.map($=>{const K=$.roleName||$.role,z=N[K]||$f(K),U=o===K;return y.jsxs("button",{type:"button",onClick:()=>c(U?null:K),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl border transition-all cursor-pointer",style:{borderColor:U?z:`${z}30`,background:U?`${z}25`:`${z}10`,opacity:o&&!U?.5:1},children:[Hs(K,z),y.jsx("span",{className:"text-[11px] font-mono",style:{color:z},children:$.displayName}),y.jsx(Pt,{variant:Ms($.status),children:$.status}),$.status==="working"&&y.jsx("button",{type:"button",onClick:async F=>{F.stopPropagation();try{await Ge.post(`/squads/${t}/instances/${e}/cancel`),Qe.success("Instance cancelled")}catch{Qe.error("Failed to cancel instance")}},title:"Cancel instance",className:"ml-1 p-1 rounded-lg hover:bg-red-500/10 text-zinc-600 hover:text-red-400 transition-colors cursor-pointer",children:y.jsx(up,{className:"w-3 h-3"})})]},$.id)}),o&&y.jsx("button",{type:"button",onClick:()=>c(null),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-xl border border-white/[0.1] text-[11px] font-mono text-zinc-400 hover:text-zinc-200 transition-colors cursor-pointer",children:"Show all"})]}),y.jsxs("div",{className:"relative pl-10",children:[y.jsx("div",{className:"absolute left-[15px] top-0 bottom-0 w-px bg-white/[0.06]"}),y.jsxs("div",{className:"space-y-3",children:[T.length===0&&y.jsx("div",{className:"text-center py-12 text-zinc-700 font-mono text-sm",children:"No activity recorded yet"}),T.map($=>{const K=r9($.type),z=t9[K],U=z.icon,F=N[$.agent]||$f($.agent),X=K==="tool_call"||K==="tool_result",Y=$.type.toLowerCase().includes("error")||$.type.toLowerCase().includes("fail");return y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute -left-10 top-3 w-[30px] h-[30px] rounded-full flex items-center justify-center",style:{background:`${F}15`,border:`1px solid ${F}35`},children:y.jsx(U,{className:"w-3.5 h-3.5",style:{color:F}})}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl px-4 py-3",children:[y.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[y.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.jsxs("div",{className:"flex items-center gap-1",children:[Hs($.agent,F),y.jsx("span",{className:"text-[10px] font-mono",style:{color:F},children:$.agent})]}),y.jsx("span",{className:"text-zinc-700 text-[10px]",children:"·"}),y.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wider text-zinc-500",children:z.label}),$.toolName&&y.jsx("span",{className:"text-[10px] font-mono text-sky-400 border border-sky-400/20 rounded px-1.5 py-px bg-sky-400/[0.06]",children:$.toolName}),$.model&&y.jsx("span",{className:"text-[10px] font-mono text-zinc-600 border border-white/[0.08] rounded px-1.5 py-px bg-white/[0.03]",children:$.model}),$.success===!0&&y.jsx("span",{className:"text-[10px] font-mono text-emerald-400 border border-emerald-400/20 rounded px-1.5 py-px bg-emerald-400/[0.08]",children:"success"}),$.success===!1&&y.jsx("span",{className:"text-[10px] font-mono text-red-400 border border-red-400/20 rounded px-1.5 py-px bg-red-400/[0.08]",children:"failed"}),Y&&$.success===null&&y.jsx(Pt,{variant:"error",children:"failed"})]}),y.jsx("span",{className:"text-[10px] font-mono text-zinc-700 flex-shrink-0 ml-2",children:lp($.timestamp,v)})]}),X?y.jsx("pre",{className:"text-[11px] font-mono text-zinc-400 whitespace-pre-wrap leading-relaxed overflow-x-auto rounded-lg p-2 mt-1 bg-black/20",children:$.content}):y.jsx($u,{content:$.content,className:"text-[12px] [&_pre]:text-[10px]"})]})]},$.id)}),R&&y.jsxs("div",{className:"relative",children:[y.jsx("div",{className:"absolute -left-10 top-3 w-[30px] h-[30px] rounded-full flex items-center justify-center",style:{background:`${S}15`,border:`1px solid ${S}40`},children:y.jsx(MP,{className:"w-3.5 h-3.5 animate-spin",style:{color:S}})}),y.jsx("div",{className:"glass-card border rounded-2xl px-4 py-3",style:{borderColor:`${S}20`},children:y.jsx("span",{className:"text-[11px] font-mono",style:{color:S},children:"Working…"})})]})]})]}),y.jsx("div",{ref:w}),p>0&&y.jsxs("button",{type:"button",onClick:()=>{var $;($=w.current)==null||$.scrollIntoView({behavior:"smooth"}),f(0)},className:"fixed bottom-6 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-4 py-2 rounded-full border border-white/[0.1] bg-zinc-900/90 backdrop-blur-sm text-[11px] font-mono text-zinc-300 hover:text-white shadow-lg transition-all cursor-pointer z-50",children:[y.jsx(cz,{className:"w-3.5 h-3.5"}),p," new event",p!==1?"s":""]})]})}function i9({squadName:t,role:e}){const r=gl(),[n,i]=j.useState(null),[a,o]=j.useState(""),[c,u]=j.useState(!1),[d,p]=j.useState(""),[f,m]=j.useState(!1),[v,b]=j.useState("#38bdf8");j.useEffect(()=>{Ge.get(`/squads/${t}`).then(x=>{b(x.squad.color||"#38bdf8");const k=x.members.find(S=>S.roleName===e||S.role===e);k&&i(k)}).catch(()=>{}),Ge.get(`/squads/${t}/members/${e}/skill`).then(x=>{o(x.content)}).catch(()=>{})},[t,e]);const w=async()=>{m(!0);try{await Ge.put(`/squads/${t}/members/${e}/skill`,{content:d}),o(d),u(!1),Qe.success("Skill file saved")}catch{Qe.error("Failed to save skill file")}finally{m(!1)}};return n?y.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:`${v}06`},children:[y.jsxs("button",{type:"button",onClick:()=>r(`/squads/${t}`),className:"flex items-center gap-1.5 text-[11px] text-zinc-600 hover:text-zinc-300 font-mono mb-5 transition-colors cursor-pointer",children:[y.jsx(vl,{className:"w-3.5 h-3.5"})," Back to ",t]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5 mb-5",children:[y.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[y.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center",style:{border:`1px solid ${v}30`,background:`${v}12`},children:Hs(n.roleName,v)}),y.jsxs("div",{children:[y.jsx("h2",{className:"text-xl tracking-wide",style:{fontFamily:"'Bebas Neue', sans-serif",color:v},children:n.displayName}),y.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[y.jsx("span",{className:"text-[11px] font-mono text-zinc-500",children:n.roleName}),n.veto&&y.jsx("span",{className:"text-[10px] font-mono text-amber-400 border border-amber-400/20 rounded px-1.5 py-px bg-amber-400/[0.06]",children:"veto"})]})]})]}),n.tools.length>0&&y.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:n.tools.map(x=>y.jsx("span",{className:"text-[10px] font-mono text-zinc-500 border border-white/[0.08] rounded px-1.5 py-px bg-white/[0.03]",children:x},x))})]}),y.jsxs("div",{className:"glass-card border border-white/[0.07] rounded-2xl p-5",children:[y.jsxs("div",{className:"flex items-center justify-between mb-4",children:[y.jsx("h3",{className:"text-sm font-mono text-zinc-300",children:"Skill File"}),c?y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("button",{type:"button",onClick:()=>u(!1),className:"px-3 py-1.5 rounded-lg text-[11px] font-mono text-zinc-500 hover:text-zinc-300 border border-white/[0.1] transition-colors cursor-pointer",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:w,disabled:f,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-emerald-400 border border-emerald-400/30 hover:bg-emerald-400/10 transition-colors cursor-pointer disabled:opacity-50",children:[y.jsx(cp,{className:"w-3 h-3"})," ",f?"Saving...":"Save"]})]}):y.jsxs("button",{type:"button",onClick:()=>{p(a),u(!0)},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[11px] font-mono text-zinc-400 hover:text-zinc-200 border border-white/[0.1] hover:border-white/[0.2] transition-colors cursor-pointer",children:[y.jsx(Ff,{className:"w-3 h-3"})," Edit"]})]}),c?y.jsx("textarea",{value:d,onChange:x=>p(x.target.value),className:"w-full h-[500px] bg-black/30 border border-white/[0.08] rounded-xl p-4 text-[12px] font-mono text-zinc-300 resize-y focus:outline-none focus:border-white/[0.2] leading-relaxed",spellCheck:!1}):a?y.jsx($u,{content:a,className:"text-[12px] [&_pre]:text-[11px]"}):y.jsx("p",{className:"text-zinc-700 text-[12px] font-mono py-8 text-center",children:"No skill file configured for this agent"})]})]}):y.jsx("div",{className:"h-full flex items-center justify-center text-zinc-600",children:"Loading..."})}var Wg,QE;function Qr(){if(QE)return Wg;QE=1;var t=Array.isArray;return Wg=t,Wg}var Kg,eA;function NR(){if(eA)return Kg;eA=1;var t=typeof ef=="object"&&ef&&ef.Object===Object&&ef;return Kg=t,Kg}var Gg,tA;function Ai(){if(tA)return Gg;tA=1;var t=NR(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Gg=r,Gg}var Vg,rA;function Du(){if(rA)return Vg;rA=1;var t=Ai(),e=t.Symbol;return Vg=e,Vg}var Xg,nA;function a9(){if(nA)return Xg;nA=1;var t=Du(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;function a(o){var c=r.call(o,i),u=o[i];try{o[i]=void 0;var d=!0}catch{}var p=n.call(o);return d&&(c?o[i]=u:delete o[i]),p}return Xg=a,Xg}var Yg,iA;function o9(){if(iA)return Yg;iA=1;var t=Object.prototype,e=t.toString;function r(n){return e.call(n)}return Yg=r,Yg}var Jg,aA;function ra(){if(aA)return Jg;aA=1;var t=Du(),e=a9(),r=o9(),n="[object Null]",i="[object Undefined]",a=t?t.toStringTag:void 0;function o(c){return c==null?c===void 0?i:n:a&&a in Object(c)?e(c):r(c)}return Jg=o,Jg}var Zg,oA;function na(){if(oA)return Zg;oA=1;function t(e){return e!=null&&typeof e=="object"}return Zg=t,Zg}var Qg,sA;function xl(){if(sA)return Qg;sA=1;var t=ra(),e=na(),r="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&t(i)==r}return Qg=n,Qg}var ey,lA;function c1(){if(lA)return ey;lA=1;var t=Qr(),e=xl(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(t(a))return!1;var c=typeof a;return c=="number"||c=="symbol"||c=="boolean"||a==null||e(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return ey=i,ey}var ty,cA;function Wa(){if(cA)return ty;cA=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return ty=t,ty}var ry,uA;function u1(){if(uA)return ry;uA=1;var t=ra(),e=Wa(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(c){if(!e(c))return!1;var u=t(c);return u==n||u==i||u==r||u==a}return ry=o,ry}var ny,dA;function s9(){if(dA)return ny;dA=1;var t=Ai(),e=t["__core-js_shared__"];return ny=e,ny}var iy,fA;function l9(){if(fA)return iy;fA=1;var t=s9(),e=(function(){var n=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!e&&e in n}return iy=r,iy}var ay,hA;function PR(){if(hA)return ay;hA=1;var t=Function.prototype,e=t.toString;function r(n){if(n!=null){try{return e.call(n)}catch{}try{return n+""}catch{}}return""}return ay=r,ay}var oy,pA;function c9(){if(pA)return oy;pA=1;var t=u1(),e=l9(),r=Wa(),n=PR(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,c=Object.prototype,u=o.toString,d=c.hasOwnProperty,p=RegExp("^"+u.call(d).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(m){if(!r(m)||e(m))return!1;var v=t(m)?p:a;return v.test(n(m))}return oy=f,oy}var sy,mA;function u9(){if(mA)return sy;mA=1;function t(e,r){return e==null?void 0:e[r]}return sy=t,sy}var ly,gA;function Uo(){if(gA)return ly;gA=1;var t=c9(),e=u9();function r(n,i){var a=e(n,i);return t(a)?a:void 0}return ly=r,ly}var cy,yA;function gp(){if(yA)return cy;yA=1;var t=Uo(),e=t(Object,"create");return cy=e,cy}var uy,vA;function d9(){if(vA)return uy;vA=1;var t=gp();function e(){this.__data__=t?t(null):{},this.size=0}return uy=e,uy}var dy,bA;function f9(){if(bA)return dy;bA=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return dy=t,dy}var fy,xA;function h9(){if(xA)return fy;xA=1;var t=gp(),e="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(t){var c=o[a];return c===e?void 0:c}return n.call(o,a)?o[a]:void 0}return fy=i,fy}var hy,wA;function p9(){if(wA)return hy;wA=1;var t=gp(),e=Object.prototype,r=e.hasOwnProperty;function n(i){var a=this.__data__;return t?a[i]!==void 0:r.call(a,i)}return hy=n,hy}var py,_A;function m9(){if(_A)return py;_A=1;var t=gp(),e="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=t&&i===void 0?e:i,this}return py=r,py}var my,SA;function g9(){if(SA)return my;SA=1;var t=d9(),e=f9(),r=h9(),n=p9(),i=m9();function a(o){var c=-1,u=o==null?0:o.length;for(this.clear();++c<u;){var d=o[c];this.set(d[0],d[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,my=a,my}var gy,kA;function y9(){if(kA)return gy;kA=1;function t(){this.__data__=[],this.size=0}return gy=t,gy}var yy,EA;function d1(){if(EA)return yy;EA=1;function t(e,r){return e===r||e!==e&&r!==r}return yy=t,yy}var vy,AA;function yp(){if(AA)return vy;AA=1;var t=d1();function e(r,n){for(var i=r.length;i--;)if(t(r[i][0],n))return i;return-1}return vy=e,vy}var by,OA;function v9(){if(OA)return by;OA=1;var t=yp(),e=Array.prototype,r=e.splice;function n(i){var a=this.__data__,o=t(a,i);if(o<0)return!1;var c=a.length-1;return o==c?a.pop():r.call(a,o,1),--this.size,!0}return by=n,by}var xy,TA;function b9(){if(TA)return xy;TA=1;var t=yp();function e(r){var n=this.__data__,i=t(n,r);return i<0?void 0:n[i][1]}return xy=e,xy}var wy,CA;function x9(){if(CA)return wy;CA=1;var t=yp();function e(r){return t(this.__data__,r)>-1}return wy=e,wy}var _y,jA;function w9(){if(jA)return _y;jA=1;var t=yp();function e(r,n){var i=this.__data__,a=t(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return _y=e,_y}var Sy,NA;function vp(){if(NA)return Sy;NA=1;var t=y9(),e=v9(),r=b9(),n=x9(),i=w9();function a(o){var c=-1,u=o==null?0:o.length;for(this.clear();++c<u;){var d=o[c];this.set(d[0],d[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Sy=a,Sy}var ky,PA;function f1(){if(PA)return ky;PA=1;var t=Uo(),e=Ai(),r=t(e,"Map");return ky=r,ky}var Ey,RA;function _9(){if(RA)return Ey;RA=1;var t=g9(),e=vp(),r=f1();function n(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return Ey=n,Ey}var Ay,IA;function S9(){if(IA)return Ay;IA=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Ay=t,Ay}var Oy,$A;function bp(){if($A)return Oy;$A=1;var t=S9();function e(r,n){var i=r.__data__;return t(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Oy=e,Oy}var Ty,MA;function k9(){if(MA)return Ty;MA=1;var t=bp();function e(r){var n=t(this,r).delete(r);return this.size-=n?1:0,n}return Ty=e,Ty}var Cy,DA;function E9(){if(DA)return Cy;DA=1;var t=bp();function e(r){return t(this,r).get(r)}return Cy=e,Cy}var jy,LA;function A9(){if(LA)return jy;LA=1;var t=bp();function e(r){return t(this,r).has(r)}return jy=e,jy}var Ny,zA;function O9(){if(zA)return Ny;zA=1;var t=bp();function e(r,n){var i=t(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Ny=e,Ny}var Py,BA;function h1(){if(BA)return Py;BA=1;var t=_9(),e=k9(),r=E9(),n=A9(),i=O9();function a(o){var c=-1,u=o==null?0:o.length;for(this.clear();++c<u;){var d=o[c];this.set(d[0],d[1])}}return a.prototype.clear=t,a.prototype.delete=e,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Py=a,Py}var Ry,UA;function RR(){if(UA)return Ry;UA=1;var t=h1(),e="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(e);var a=function(){var o=arguments,c=i?i.apply(this,o):o[0],u=a.cache;if(u.has(c))return u.get(c);var d=n.apply(this,o);return a.cache=u.set(c,d)||u,d};return a.cache=new(r.Cache||t),a}return r.Cache=t,Ry=r,Ry}var Iy,qA;function T9(){if(qA)return Iy;qA=1;var t=RR(),e=500;function r(n){var i=t(n,function(o){return a.size===e&&a.clear(),o}),a=i.cache;return i}return Iy=r,Iy}var $y,FA;function C9(){if(FA)return $y;FA=1;var t=T9(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=t(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(e,function(o,c,u,d){a.push(u?d.replace(r,"$1"):c||o)}),a});return $y=n,$y}var My,HA;function p1(){if(HA)return My;HA=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=Array(i);++n<i;)a[n]=r(e[n],n,e);return a}return My=t,My}var Dy,WA;function j9(){if(WA)return Dy;WA=1;var t=Du(),e=p1(),r=Qr(),n=xl(),i=t?t.prototype:void 0,a=i?i.toString:void 0;function o(c){if(typeof c=="string")return c;if(r(c))return e(c,o)+"";if(n(c))return a?a.call(c):"";var u=c+"";return u=="0"&&1/c==-1/0?"-0":u}return Dy=o,Dy}var Ly,KA;function IR(){if(KA)return Ly;KA=1;var t=j9();function e(r){return r==null?"":t(r)}return Ly=e,Ly}var zy,GA;function $R(){if(GA)return zy;GA=1;var t=Qr(),e=c1(),r=C9(),n=IR();function i(a,o){return t(a)?a:e(a,o)?[a]:r(n(a))}return zy=i,zy}var By,VA;function xp(){if(VA)return By;VA=1;var t=xl();function e(r){if(typeof r=="string"||t(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return By=e,By}var Uy,XA;function m1(){if(XA)return Uy;XA=1;var t=$R(),e=xp();function r(n,i){i=t(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[e(i[a++])];return a&&a==o?n:void 0}return Uy=r,Uy}var qy,YA;function MR(){if(YA)return qy;YA=1;var t=m1();function e(r,n,i){var a=r==null?void 0:t(r,n);return a===void 0?i:a}return qy=e,qy}var N9=MR();const On=vt(N9);var Fy,JA;function P9(){if(JA)return Fy;JA=1;function t(e){return e==null}return Fy=t,Fy}var R9=P9();const tt=vt(R9);var Hy,ZA;function I9(){if(ZA)return Hy;ZA=1;var t=ra(),e=Qr(),r=na(),n="[object String]";function i(a){return typeof a=="string"||!e(a)&&r(a)&&t(a)==n}return Hy=i,Hy}var $9=I9();const Ro=vt($9);var M9=u1();const Je=vt(M9);var D9=Wa();const wl=vt(D9);var Wy={exports:{}},pt={};/**
|
|
450
450
|
* @license React
|
|
451
451
|
* react-is.production.min.js
|
|
452
452
|
*
|
|
@@ -454,34 +454,34 @@ ${k}`}class Zt extends Error{constructor({message:e,code:r,cause:n,name:i}){var
|
|
|
454
454
|
*
|
|
455
455
|
* This source code is licensed under the MIT license found in the
|
|
456
456
|
* LICENSE file in the root directory of this source tree.
|
|
457
|
-
*/var QA;function D9(){if(QA)return pt;QA=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function w(x){if(typeof x=="object"&&x!==null){var k=x.$$typeof;switch(k){case t:switch(x=x.type,x){case r:case i:case n:case d:case p:return x;default:switch(x=x&&x.$$typeof,x){case c:case o:case u:case m:case f:case a:return x;default:return k}}case e:return k}}}return pt.ContextConsumer=o,pt.ContextProvider=a,pt.Element=t,pt.ForwardRef=u,pt.Fragment=r,pt.Lazy=m,pt.Memo=f,pt.Portal=e,pt.Profiler=i,pt.StrictMode=n,pt.Suspense=d,pt.SuspenseList=p,pt.isAsyncMode=function(){return!1},pt.isConcurrentMode=function(){return!1},pt.isContextConsumer=function(x){return w(x)===o},pt.isContextProvider=function(x){return w(x)===a},pt.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},pt.isForwardRef=function(x){return w(x)===u},pt.isFragment=function(x){return w(x)===r},pt.isLazy=function(x){return w(x)===m},pt.isMemo=function(x){return w(x)===f},pt.isPortal=function(x){return w(x)===e},pt.isProfiler=function(x){return w(x)===i},pt.isStrictMode=function(x){return w(x)===n},pt.isSuspense=function(x){return w(x)===d},pt.isSuspenseList=function(x){return w(x)===p},pt.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===i||x===n||x===d||x===p||x===v||typeof x=="object"&&x!==null&&(x.$$typeof===m||x.$$typeof===f||x.$$typeof===a||x.$$typeof===o||x.$$typeof===u||x.$$typeof===b||x.getModuleId!==void 0)},pt.typeOf=w,pt}var eO;function L9(){return eO||(eO=1,Wy.exports=D9()),Wy.exports}var z9=L9(),Ky,tO;function DR(){if(tO)return Ky;tO=1;var t=ra(),e=na(),r="[object Number]";function n(i){return typeof i=="number"||e(i)&&t(i)==r}return Ky=n,Ky}var Gy,rO;function B9(){if(rO)return Gy;rO=1;var t=DR();function e(r){return t(r)&&r!=+r}return Gy=e,Gy}var U9=B9();const Lu=vt(U9);var q9=DR();const F9=vt(q9);var Jn=function(e){return e===0?0:e>0?1:-1},Eo=function(e){return Ro(e)&&e.indexOf("%")===e.length-1},ge=function(e){return F9(e)&&!Lu(e)},H9=function(e){return tt(e)},sr=function(e){return ge(e)||Ro(e)},W9=0,zu=function(e){var r=++W9;return"".concat(e||"").concat(r)},Io=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ge(e)&&!Ro(e))return n;var a;if(Eo(e)){var o=e.indexOf("%");a=r*parseFloat(e.slice(0,o))/100}else a=+e;return Lu(a)&&(a=n),i&&a>r&&(a=r),a},Ra=function(e){if(!e)return null;var r=Object.keys(e);return r&&r.length?e[r[0]]:null},K9=function(e){if(!Array.isArray(e))return!1;for(var r=e.length,n={},i=0;i<r;i++)if(!n[e[i]])n[e[i]]=!0;else return!0;return!1},Vn=function(e,r){return ge(e)&&ge(r)?function(n){return e+n*(r-e)}:function(){return r}};function nh(t,e,r){return!t||!t.length?null:t.find(function(n){return n&&(typeof e=="function"?e(n):On(n,e))===r})}var G9=function(e,r){return ge(e)&&ge(r)?e-r:Ro(e)&&Ro(r)?e.localeCompare(r):e instanceof Date&&r instanceof Date?e.getTime()-r.getTime():String(e).localeCompare(String(r))};function zs(t,e){for(var r in t)if({}.hasOwnProperty.call(t,r)&&(!{}.hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if({}.hasOwnProperty.call(e,n)&&!{}.hasOwnProperty.call(t,n))return!1;return!0}function hx(t){"@babel/helpers - typeof";return hx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hx(t)}var V9=["viewBox","children"],X9=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],nO=["points","pathLength"],Vy={svg:V9,polygon:nO,polyline:nO},g1=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],ih=function(e,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(j.isValidElement(e)&&(n=e.props),!wl(n))return null;var i={};return Object.keys(n).forEach(function(a){g1.includes(a)&&(i[a]=r||function(o){return n[a](n,o)})}),i},Y9=function(e,r,n){return function(i){return e(r,n,i),null}},ah=function(e,r,n){if(!wl(e)||hx(e)!=="object")return null;var i=null;return Object.keys(e).forEach(function(a){var o=e[a];g1.includes(a)&&typeof o=="function"&&(i||(i={}),i[a]=Y9(o,r,n))}),i},J9=["children"],Z9=["children"];function iO(t,e){if(t==null)return{};var r=Q9(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Q9(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function px(t){"@babel/helpers - typeof";return px=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},px(t)}var aO={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Gi=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},oO=null,Xy=null,y1=function t(e){if(e===oO&&Array.isArray(Xy))return Xy;var r=[];return j.Children.forEach(e,function(n){tt(n)||(z9.isFragment(n)?r=r.concat(t(n.props.children)):r.push(n))}),Xy=r,oO=e,r};function Tn(t,e){var r=[],n=[];return Array.isArray(e)?n=e.map(function(i){return Gi(i)}):n=[Gi(e)],y1(t).forEach(function(i){var a=On(i,"type.displayName")||On(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function sn(t,e){var r=Tn(t,e);return r&&r[0]}var sO=function(e){if(!e||!e.props)return!1;var r=e.props,n=r.width,i=r.height;return!(!ge(n)||n<=0||!ge(i)||i<=0)},eF=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],tF=function(e){return e&&e.type&&Ro(e.type)&&eF.indexOf(e.type)>=0},rF=function(e){return e&&px(e)==="object"&&"clipDot"in e},nF=function(e,r,n,i){var a,o=(a=Vy==null?void 0:Vy[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!Je(e)&&(i&&o.includes(r)||X9.includes(r))||n&&g1.includes(r)},at=function(e,r,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(j.isValidElement(e)&&(i=e.props),!wl(i))return null;var a={};return Object.keys(i).forEach(function(o){var c;nF((c=i)===null||c===void 0?void 0:c[o],o,r,n)&&(a[o]=i[o])}),a},mx=function t(e,r){if(e===r)return!0;var n=j.Children.count(e);if(n!==j.Children.count(r))return!1;if(n===0)return!0;if(n===1)return lO(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var i=0;i<n;i++){var a=e[i],o=r[i];if(Array.isArray(a)||Array.isArray(o)){if(!t(a,o))return!1}else if(!lO(a,o))return!1}return!0},lO=function(e,r){if(tt(e)&&tt(r))return!0;if(!tt(e)&&!tt(r)){var n=e.props||{},i=n.children,a=iO(n,J9),o=r.props||{},c=o.children,u=iO(o,Z9);return i&&c?zs(a,u)&&mx(i,c):!i&&!c?zs(a,u):!1}return!1},cO=function(e,r){var n=[],i={};return y1(e).forEach(function(a,o){if(tF(a))n.push(a);else if(a){var c=Gi(a.type),u=r[c]||{},d=u.handler,p=u.once;if(d&&(!p||!i[c])){var f=d(a,c,o);n.push(f),i[c]=!0}}}),n},iF=function(e){var r=e&&e.type;return r&&aO[r]?aO[r]:null},aF=function(e,r){return y1(r).indexOf(e)},oF=["children","width","height","viewBox","className","style","title","desc"];function gx(){return gx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gx.apply(this,arguments)}function sF(t,e){if(t==null)return{};var r=lF(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function lF(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function yx(t){var e=t.children,r=t.width,n=t.height,i=t.viewBox,a=t.className,o=t.style,c=t.title,u=t.desc,d=sF(t,oF),p=i||{width:r,height:n,x:0,y:0},f=ot("recharts-surface",a);return M.createElement("svg",gx({},at(d,!0,"svg"),{className:f,width:r,height:n,style:o,viewBox:"".concat(p.x," ").concat(p.y," ").concat(p.width," ").concat(p.height)}),M.createElement("title",null,c),M.createElement("desc",null,u),e)}var cF=["children","className"];function vx(){return vx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},vx.apply(this,arguments)}function uF(t,e){if(t==null)return{};var r=dF(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function dF(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var Xt=M.forwardRef(function(t,e){var r=t.children,n=t.className,i=uF(t,cF),a=ot("recharts-layer",n);return M.createElement("g",vx({className:a},at(i,!0),{ref:e}),r)}),Vi=function(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a]},Yy,uO;function fF(){if(uO)return Yy;uO=1;function t(e,r,n){var i=-1,a=e.length;r<0&&(r=-r>a?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i<a;)o[i]=e[i+r];return o}return Yy=t,Yy}var Jy,dO;function hF(){if(dO)return Jy;dO=1;var t=fF();function e(r,n,i){var a=r.length;return i=i===void 0?a:i,!n&&i>=a?r:t(r,n,i)}return Jy=e,Jy}var Zy,fO;function LR(){if(fO)return Zy;fO=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",c=RegExp("["+o+t+i+a+"]");function u(d){return c.test(d)}return Zy=u,Zy}var Qy,hO;function pF(){if(hO)return Qy;hO=1;function t(e){return e.split("")}return Qy=t,Qy}var ev,pO;function mF(){if(pO)return ev;pO=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,a="\\ufe0e\\ufe0f",o="["+t+"]",c="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",d="(?:"+c+"|"+u+")",p="[^"+t+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",b=d+"?",w="["+a+"]?",x="(?:"+v+"(?:"+[p,f,m].join("|")+")"+w+b+")*",k=w+b+x,S="(?:"+[p+c+"?",c,f,m,o].join("|")+")",A=RegExp(u+"(?="+u+")|"+S+k,"g");function C(T){return T.match(A)||[]}return ev=C,ev}var tv,mO;function gF(){if(mO)return tv;mO=1;var t=pF(),e=LR(),r=mF();function n(i){return e(i)?r(i):t(i)}return tv=n,tv}var rv,gO;function yF(){if(gO)return rv;gO=1;var t=hF(),e=LR(),r=gF(),n=IR();function i(a){return function(o){o=n(o);var c=e(o)?r(o):void 0,u=c?c[0]:o.charAt(0),d=c?t(c,1).join(""):o.slice(1);return u[a]()+d}}return rv=i,rv}var nv,yO;function vF(){if(yO)return nv;yO=1;var t=yF(),e=t("toUpperCase");return nv=e,nv}var bF=vF();const wp=vt(bF);function Tt(t){return function(){return t}}const zR=Math.cos,oh=Math.sin,ri=Math.sqrt,sh=Math.PI,_p=2*sh,bx=Math.PI,xx=2*bx,wo=1e-6,xF=xx-wo;function BR(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function wF(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return BR;const r=10**e;return function(n){this._+=n[0];for(let i=1,a=n.length;i<a;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class _F{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?BR:wF(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,i){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,r,n,i,a,o){this._append`C${+e},${+r},${+n},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(e,r,n,i,a){if(e=+e,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,c=this._y1,u=n-e,d=i-r,p=o-e,f=c-r,m=p*p+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(m>wo)if(!(Math.abs(f*u-d*p)>wo)||!a)this._append`L${this._x1=e},${this._y1=r}`;else{let v=n-o,b=i-c,w=u*u+d*d,x=v*v+b*b,k=Math.sqrt(w),S=Math.sqrt(m),A=a*Math.tan((bx-Math.acos((w+m-x)/(2*k*S)))/2),C=A/S,T=A/k;Math.abs(C-1)>wo&&this._append`L${e+C*p},${r+C*f}`,this._append`A${a},${a},0,0,${+(f*v>p*b)},${this._x1=e+T*u},${this._y1=r+T*d}`}}arc(e,r,n,i,a,o){if(e=+e,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let c=n*Math.cos(i),u=n*Math.sin(i),d=e+c,p=r+u,f=1^o,m=o?i-a:a-i;this._x1===null?this._append`M${d},${p}`:(Math.abs(this._x1-d)>wo||Math.abs(this._y1-p)>wo)&&this._append`L${d},${p}`,n&&(m<0&&(m=m%xx+xx),m>xF?this._append`A${n},${n},0,1,${f},${e-c},${r-u}A${n},${n},0,1,${f},${this._x1=d},${this._y1=p}`:m>wo&&this._append`A${n},${n},0,${+(m>=bx)},${f},${this._x1=e+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function v1(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new _F(e)}function b1(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function UR(t){this._context=t}UR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Sp(t){return new UR(t)}function qR(t){return t[0]}function FR(t){return t[1]}function HR(t,e){var r=Tt(!0),n=null,i=Sp,a=null,o=v1(c);t=typeof t=="function"?t:t===void 0?qR:Tt(t),e=typeof e=="function"?e:e===void 0?FR:Tt(e);function c(u){var d,p=(u=b1(u)).length,f,m=!1,v;for(n==null&&(a=i(v=o())),d=0;d<=p;++d)!(d<p&&r(f=u[d],d,u))===m&&((m=!m)?a.lineStart():a.lineEnd()),m&&a.point(+t(f,d,u),+e(f,d,u));if(v)return a=null,v+""||null}return c.x=function(u){return arguments.length?(t=typeof u=="function"?u:Tt(+u),c):t},c.y=function(u){return arguments.length?(e=typeof u=="function"?u:Tt(+u),c):e},c.defined=function(u){return arguments.length?(r=typeof u=="function"?u:Tt(!!u),c):r},c.curve=function(u){return arguments.length?(i=u,n!=null&&(a=i(n)),c):i},c.context=function(u){return arguments.length?(u==null?n=a=null:a=i(n=u),c):n},c}function vf(t,e,r){var n=null,i=Tt(!0),a=null,o=Sp,c=null,u=v1(d);t=typeof t=="function"?t:t===void 0?qR:Tt(+t),e=typeof e=="function"?e:Tt(e===void 0?0:+e),r=typeof r=="function"?r:r===void 0?FR:Tt(+r);function d(f){var m,v,b,w=(f=b1(f)).length,x,k=!1,S,A=new Array(w),C=new Array(w);for(a==null&&(c=o(S=u())),m=0;m<=w;++m){if(!(m<w&&i(x=f[m],m,f))===k)if(k=!k)v=m,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),b=m-1;b>=v;--b)c.point(A[b],C[b]);c.lineEnd(),c.areaEnd()}k&&(A[m]=+t(x,m,f),C[m]=+e(x,m,f),c.point(n?+n(x,m,f):A[m],r?+r(x,m,f):C[m]))}if(S)return c=null,S+""||null}function p(){return HR().defined(i).curve(o).context(a)}return d.x=function(f){return arguments.length?(t=typeof f=="function"?f:Tt(+f),n=null,d):t},d.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Tt(+f),d):t},d.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Tt(+f),d):n},d.y=function(f){return arguments.length?(e=typeof f=="function"?f:Tt(+f),r=null,d):e},d.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Tt(+f),d):e},d.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Tt(+f),d):r},d.lineX0=d.lineY0=function(){return p().x(t).y(e)},d.lineY1=function(){return p().x(t).y(r)},d.lineX1=function(){return p().x(n).y(e)},d.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Tt(!!f),d):i},d.curve=function(f){return arguments.length?(o=f,a!=null&&(c=o(a)),d):o},d.context=function(f){return arguments.length?(f==null?a=c=null:c=o(a=f),d):a},d}class WR{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function SF(t){return new WR(t,!0)}function kF(t){return new WR(t,!1)}const x1={draw(t,e){const r=ri(e/sh);t.moveTo(r,0),t.arc(0,0,r,0,_p)}},EF={draw(t,e){const r=ri(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},KR=ri(1/3),AF=KR*2,OF={draw(t,e){const r=ri(e/AF),n=r*KR;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},TF={draw(t,e){const r=ri(e),n=-r/2;t.rect(n,n,r,r)}},CF=.8908130915292852,GR=oh(sh/10)/oh(7*sh/10),jF=oh(_p/10)*GR,NF=-zR(_p/10)*GR,PF={draw(t,e){const r=ri(e*CF),n=jF*r,i=NF*r;t.moveTo(0,-r),t.lineTo(n,i);for(let a=1;a<5;++a){const o=_p*a/5,c=zR(o),u=oh(o);t.lineTo(u*r,-c*r),t.lineTo(c*n-u*i,u*n+c*i)}t.closePath()}},iv=ri(3),RF={draw(t,e){const r=-ri(e/(iv*3));t.moveTo(0,r*2),t.lineTo(-iv*r,-r),t.lineTo(iv*r,-r),t.closePath()}},_n=-.5,Sn=ri(3)/2,wx=1/ri(12),IF=(wx/2+1)*3,$F={draw(t,e){const r=ri(e/IF),n=r/2,i=r*wx,a=n,o=r*wx+r,c=-a,u=o;t.moveTo(n,i),t.lineTo(a,o),t.lineTo(c,u),t.lineTo(_n*n-Sn*i,Sn*n+_n*i),t.lineTo(_n*a-Sn*o,Sn*a+_n*o),t.lineTo(_n*c-Sn*u,Sn*c+_n*u),t.lineTo(_n*n+Sn*i,_n*i-Sn*n),t.lineTo(_n*a+Sn*o,_n*o-Sn*a),t.lineTo(_n*c+Sn*u,_n*u-Sn*c),t.closePath()}};function MF(t,e){let r=null,n=v1(i);t=typeof t=="function"?t:Tt(t||x1),e=typeof e=="function"?e:Tt(e===void 0?64:+e);function i(){let a;if(r||(r=a=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(t=typeof a=="function"?a:Tt(a),i):t},i.size=function(a){return arguments.length?(e=typeof a=="function"?a:Tt(+a),i):e},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function lh(){}function ch(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function VR(t){this._context=t}VR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ch(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ch(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function DF(t){return new VR(t)}function XR(t){this._context=t}XR.prototype={areaStart:lh,areaEnd:lh,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ch(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function LF(t){return new XR(t)}function YR(t){this._context=t}YR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:ch(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function zF(t){return new YR(t)}function JR(t){this._context=t}JR.prototype={areaStart:lh,areaEnd:lh,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function BF(t){return new JR(t)}function vO(t){return t<0?-1:1}function bO(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),c=(a*i+o*n)/(n+i);return(vO(a)+vO(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(c))||0}function xO(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function av(t,e,r){var n=t._x0,i=t._y0,a=t._x1,o=t._y1,c=(a-n)/3;t._context.bezierCurveTo(n+c,i+c*e,a-c,o-c*r,a,o)}function uh(t){this._context=t}uh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:av(this,this._t0,xO(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,av(this,xO(this,r=bO(this,t,e)),r);break;default:av(this,this._t0,r=bO(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function ZR(t){this._context=new QR(t)}(ZR.prototype=Object.create(uh.prototype)).point=function(t,e){uh.prototype.point.call(this,e,t)};function QR(t){this._context=t}QR.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,a){this._context.bezierCurveTo(e,t,n,r,a,i)}};function UF(t){return new uh(t)}function qF(t){return new ZR(t)}function eI(t){this._context=t}eI.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=wO(t),i=wO(e),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],t[o],e[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function wO(t){var e,r=t.length-1,n,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,a[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/a[e-1],a[e]-=n,o[e]-=n*o[e-1];for(i[r-1]=o[r-1]/a[r-1],e=r-2;e>=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}function FF(t){return new eI(t)}function kp(t,e){this._context=t,this._t=e}kp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function HF(t){return new kp(t,.5)}function WF(t){return new kp(t,0)}function KF(t){return new kp(t,1)}function Ws(t,e){if((o=t.length)>1)for(var r=1,n,i,a=t[e[0]],o,c=a.length;r<o;++r)for(i=a,a=t[e[r]],n=0;n<c;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function _x(t){for(var e=t.length,r=new Array(e);--e>=0;)r[e]=e;return r}function GF(t,e){return t[e]}function VF(t){const e=[];return e.key=t,e}function XF(){var t=Tt([]),e=_x,r=Ws,n=GF;function i(a){var o=Array.from(t.apply(this,arguments),VF),c,u=o.length,d=-1,p;for(const f of a)for(c=0,++d;c<u;++c)(o[c][d]=[0,+n(f,o[c].key,d,a)]).data=f;for(c=0,p=b1(e(o));c<u;++c)o[p[c]].index=c;return r(o,p),o}return i.keys=function(a){return arguments.length?(t=typeof a=="function"?a:Tt(Array.from(a)),i):t},i.value=function(a){return arguments.length?(n=typeof a=="function"?a:Tt(+a),i):n},i.order=function(a){return arguments.length?(e=a==null?_x:typeof a=="function"?a:Tt(Array.from(a)),i):e},i.offset=function(a){return arguments.length?(r=a??Ws,i):r},i}function YF(t,e){if((n=t.length)>0){for(var r,n,i=0,a=t[0].length,o;i<a;++i){for(o=r=0;r<n;++r)o+=t[r][i][1]||0;if(o)for(r=0;r<n;++r)t[r][i][1]/=o}Ws(t,e)}}function JF(t,e){if((i=t.length)>0){for(var r=0,n=t[e[0]],i,a=n.length;r<a;++r){for(var o=0,c=0;o<i;++o)c+=t[o][r][1]||0;n[r][1]+=n[r][0]=-c/2}Ws(t,e)}}function ZF(t,e){if(!(!((o=t.length)>0)||!((a=(i=t[e[0]]).length)>0))){for(var r=0,n=1,i,a,o;n<a;++n){for(var c=0,u=0,d=0;c<o;++c){for(var p=t[e[c]],f=p[n][1]||0,m=p[n-1][1]||0,v=(f-m)/2,b=0;b<c;++b){var w=t[e[b]],x=w[n][1]||0,k=w[n-1][1]||0;v+=x-k}u+=f,d+=v*f}i[n-1][1]+=i[n-1][0]=r,u&&(r-=d/u)}i[n-1][1]+=i[n-1][0]=r,Ws(t,e)}}function Yc(t){"@babel/helpers - typeof";return Yc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yc(t)}var QF=["type","size","sizeType"];function Sx(){return Sx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Sx.apply(this,arguments)}function _O(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 SO(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_O(Object(r),!0).forEach(function(n){e7(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_O(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function e7(t,e,r){return e=t7(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function t7(t){var e=r7(t,"string");return Yc(e)=="symbol"?e:e+""}function r7(t,e){if(Yc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Yc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function n7(t,e){if(t==null)return{};var r=i7(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function i7(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var tI={symbolCircle:x1,symbolCross:EF,symbolDiamond:OF,symbolSquare:TF,symbolStar:PF,symbolTriangle:RF,symbolWye:$F},a7=Math.PI/180,o7=function(e){var r="symbol".concat(wp(e));return tI[r]||x1},s7=function(e,r,n){if(r==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*a7;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},l7=function(e,r){tI["symbol".concat(wp(e))]=r},w1=function(e){var r=e.type,n=r===void 0?"circle":r,i=e.size,a=i===void 0?64:i,o=e.sizeType,c=o===void 0?"area":o,u=n7(e,QF),d=SO(SO({},u),{},{type:n,size:a,sizeType:c}),p=function(){var x=o7(n),k=MF().type(x).size(s7(a,c,n));return k()},f=d.className,m=d.cx,v=d.cy,b=at(d,!0);return m===+m&&v===+v&&a===+a?M.createElement("path",Sx({},b,{className:ot("recharts-symbols",f),transform:"translate(".concat(m,", ").concat(v,")"),d:p()})):null};w1.registerSymbol=l7;function Ks(t){"@babel/helpers - typeof";return Ks=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ks(t)}function kx(){return kx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kx.apply(this,arguments)}function kO(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 c7(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?kO(Object(r),!0).forEach(function(n){Jc(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function u7(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d7(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,nI(n.key),n)}}function f7(t,e,r){return e&&d7(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function h7(t,e,r){return e=dh(e),p7(t,rI()?Reflect.construct(e,r||[],dh(t).constructor):e.apply(t,r))}function p7(t,e){if(e&&(Ks(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m7(t)}function m7(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rI(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rI=function(){return!!t})()}function dh(t){return dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},dh(t)}function g7(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ex(t,e)}function Ex(t,e){return Ex=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ex(t,e)}function Jc(t,e,r){return e=nI(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nI(t){var e=y7(t,"string");return Ks(e)=="symbol"?e:e+""}function y7(t,e){if(Ks(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ks(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var kn=32,_1=(function(t){function e(){return u7(this,e),h7(this,e,arguments)}return g7(e,t),f7(e,[{key:"renderIcon",value:function(n){var i=this.props.inactiveColor,a=kn/2,o=kn/6,c=kn/3,u=n.inactive?i:n.color;if(n.type==="plainline")return M.createElement("line",{strokeWidth:4,fill:"none",stroke:u,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:a,x2:kn,y2:a,className:"recharts-legend-icon"});if(n.type==="line")return M.createElement("path",{strokeWidth:4,fill:"none",stroke:u,d:"M0,".concat(a,"h").concat(c,`
|
|
457
|
+
*/var QA;function L9(){if(QA)return pt;QA=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function w(x){if(typeof x=="object"&&x!==null){var k=x.$$typeof;switch(k){case t:switch(x=x.type,x){case r:case i:case n:case d:case p:return x;default:switch(x=x&&x.$$typeof,x){case c:case o:case u:case m:case f:case a:return x;default:return k}}case e:return k}}}return pt.ContextConsumer=o,pt.ContextProvider=a,pt.Element=t,pt.ForwardRef=u,pt.Fragment=r,pt.Lazy=m,pt.Memo=f,pt.Portal=e,pt.Profiler=i,pt.StrictMode=n,pt.Suspense=d,pt.SuspenseList=p,pt.isAsyncMode=function(){return!1},pt.isConcurrentMode=function(){return!1},pt.isContextConsumer=function(x){return w(x)===o},pt.isContextProvider=function(x){return w(x)===a},pt.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},pt.isForwardRef=function(x){return w(x)===u},pt.isFragment=function(x){return w(x)===r},pt.isLazy=function(x){return w(x)===m},pt.isMemo=function(x){return w(x)===f},pt.isPortal=function(x){return w(x)===e},pt.isProfiler=function(x){return w(x)===i},pt.isStrictMode=function(x){return w(x)===n},pt.isSuspense=function(x){return w(x)===d},pt.isSuspenseList=function(x){return w(x)===p},pt.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===i||x===n||x===d||x===p||x===v||typeof x=="object"&&x!==null&&(x.$$typeof===m||x.$$typeof===f||x.$$typeof===a||x.$$typeof===o||x.$$typeof===u||x.$$typeof===b||x.getModuleId!==void 0)},pt.typeOf=w,pt}var eO;function z9(){return eO||(eO=1,Wy.exports=L9()),Wy.exports}var B9=z9(),Ky,tO;function DR(){if(tO)return Ky;tO=1;var t=ra(),e=na(),r="[object Number]";function n(i){return typeof i=="number"||e(i)&&t(i)==r}return Ky=n,Ky}var Gy,rO;function U9(){if(rO)return Gy;rO=1;var t=DR();function e(r){return t(r)&&r!=+r}return Gy=e,Gy}var q9=U9();const Lu=vt(q9);var F9=DR();const H9=vt(F9);var Jn=function(e){return e===0?0:e>0?1:-1},Eo=function(e){return Ro(e)&&e.indexOf("%")===e.length-1},ge=function(e){return H9(e)&&!Lu(e)},W9=function(e){return tt(e)},sr=function(e){return ge(e)||Ro(e)},K9=0,zu=function(e){var r=++K9;return"".concat(e||"").concat(r)},Io=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ge(e)&&!Ro(e))return n;var a;if(Eo(e)){var o=e.indexOf("%");a=r*parseFloat(e.slice(0,o))/100}else a=+e;return Lu(a)&&(a=n),i&&a>r&&(a=r),a},Ra=function(e){if(!e)return null;var r=Object.keys(e);return r&&r.length?e[r[0]]:null},G9=function(e){if(!Array.isArray(e))return!1;for(var r=e.length,n={},i=0;i<r;i++)if(!n[e[i]])n[e[i]]=!0;else return!0;return!1},Vn=function(e,r){return ge(e)&&ge(r)?function(n){return e+n*(r-e)}:function(){return r}};function nh(t,e,r){return!t||!t.length?null:t.find(function(n){return n&&(typeof e=="function"?e(n):On(n,e))===r})}var V9=function(e,r){return ge(e)&&ge(r)?e-r:Ro(e)&&Ro(r)?e.localeCompare(r):e instanceof Date&&r instanceof Date?e.getTime()-r.getTime():String(e).localeCompare(String(r))};function zs(t,e){for(var r in t)if({}.hasOwnProperty.call(t,r)&&(!{}.hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if({}.hasOwnProperty.call(e,n)&&!{}.hasOwnProperty.call(t,n))return!1;return!0}function hx(t){"@babel/helpers - typeof";return hx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hx(t)}var X9=["viewBox","children"],Y9=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],nO=["points","pathLength"],Vy={svg:X9,polygon:nO,polyline:nO},g1=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],ih=function(e,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(j.isValidElement(e)&&(n=e.props),!wl(n))return null;var i={};return Object.keys(n).forEach(function(a){g1.includes(a)&&(i[a]=r||function(o){return n[a](n,o)})}),i},J9=function(e,r,n){return function(i){return e(r,n,i),null}},ah=function(e,r,n){if(!wl(e)||hx(e)!=="object")return null;var i=null;return Object.keys(e).forEach(function(a){var o=e[a];g1.includes(a)&&typeof o=="function"&&(i||(i={}),i[a]=J9(o,r,n))}),i},Z9=["children"],Q9=["children"];function iO(t,e){if(t==null)return{};var r=eF(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function eF(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function px(t){"@babel/helpers - typeof";return px=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},px(t)}var aO={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Gi=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},oO=null,Xy=null,y1=function t(e){if(e===oO&&Array.isArray(Xy))return Xy;var r=[];return j.Children.forEach(e,function(n){tt(n)||(B9.isFragment(n)?r=r.concat(t(n.props.children)):r.push(n))}),Xy=r,oO=e,r};function Tn(t,e){var r=[],n=[];return Array.isArray(e)?n=e.map(function(i){return Gi(i)}):n=[Gi(e)],y1(t).forEach(function(i){var a=On(i,"type.displayName")||On(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function sn(t,e){var r=Tn(t,e);return r&&r[0]}var sO=function(e){if(!e||!e.props)return!1;var r=e.props,n=r.width,i=r.height;return!(!ge(n)||n<=0||!ge(i)||i<=0)},tF=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],rF=function(e){return e&&e.type&&Ro(e.type)&&tF.indexOf(e.type)>=0},nF=function(e){return e&&px(e)==="object"&&"clipDot"in e},iF=function(e,r,n,i){var a,o=(a=Vy==null?void 0:Vy[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!Je(e)&&(i&&o.includes(r)||Y9.includes(r))||n&&g1.includes(r)},at=function(e,r,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(j.isValidElement(e)&&(i=e.props),!wl(i))return null;var a={};return Object.keys(i).forEach(function(o){var c;iF((c=i)===null||c===void 0?void 0:c[o],o,r,n)&&(a[o]=i[o])}),a},mx=function t(e,r){if(e===r)return!0;var n=j.Children.count(e);if(n!==j.Children.count(r))return!1;if(n===0)return!0;if(n===1)return lO(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var i=0;i<n;i++){var a=e[i],o=r[i];if(Array.isArray(a)||Array.isArray(o)){if(!t(a,o))return!1}else if(!lO(a,o))return!1}return!0},lO=function(e,r){if(tt(e)&&tt(r))return!0;if(!tt(e)&&!tt(r)){var n=e.props||{},i=n.children,a=iO(n,Z9),o=r.props||{},c=o.children,u=iO(o,Q9);return i&&c?zs(a,u)&&mx(i,c):!i&&!c?zs(a,u):!1}return!1},cO=function(e,r){var n=[],i={};return y1(e).forEach(function(a,o){if(rF(a))n.push(a);else if(a){var c=Gi(a.type),u=r[c]||{},d=u.handler,p=u.once;if(d&&(!p||!i[c])){var f=d(a,c,o);n.push(f),i[c]=!0}}}),n},aF=function(e){var r=e&&e.type;return r&&aO[r]?aO[r]:null},oF=function(e,r){return y1(r).indexOf(e)},sF=["children","width","height","viewBox","className","style","title","desc"];function gx(){return gx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},gx.apply(this,arguments)}function lF(t,e){if(t==null)return{};var r=cF(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function cF(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function yx(t){var e=t.children,r=t.width,n=t.height,i=t.viewBox,a=t.className,o=t.style,c=t.title,u=t.desc,d=lF(t,sF),p=i||{width:r,height:n,x:0,y:0},f=ot("recharts-surface",a);return M.createElement("svg",gx({},at(d,!0,"svg"),{className:f,width:r,height:n,style:o,viewBox:"".concat(p.x," ").concat(p.y," ").concat(p.width," ").concat(p.height)}),M.createElement("title",null,c),M.createElement("desc",null,u),e)}var uF=["children","className"];function vx(){return vx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},vx.apply(this,arguments)}function dF(t,e){if(t==null)return{};var r=fF(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function fF(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var Xt=M.forwardRef(function(t,e){var r=t.children,n=t.className,i=dF(t,uF),a=ot("recharts-layer",n);return M.createElement("g",vx({className:a},at(i,!0),{ref:e}),r)}),Vi=function(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a]},Yy,uO;function hF(){if(uO)return Yy;uO=1;function t(e,r,n){var i=-1,a=e.length;r<0&&(r=-r>a?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i<a;)o[i]=e[i+r];return o}return Yy=t,Yy}var Jy,dO;function pF(){if(dO)return Jy;dO=1;var t=hF();function e(r,n,i){var a=r.length;return i=i===void 0?a:i,!n&&i>=a?r:t(r,n,i)}return Jy=e,Jy}var Zy,fO;function LR(){if(fO)return Zy;fO=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",c=RegExp("["+o+t+i+a+"]");function u(d){return c.test(d)}return Zy=u,Zy}var Qy,hO;function mF(){if(hO)return Qy;hO=1;function t(e){return e.split("")}return Qy=t,Qy}var ev,pO;function gF(){if(pO)return ev;pO=1;var t="\\ud800-\\udfff",e="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=e+r+n,a="\\ufe0e\\ufe0f",o="["+t+"]",c="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",d="(?:"+c+"|"+u+")",p="[^"+t+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",m="[\\ud800-\\udbff][\\udc00-\\udfff]",v="\\u200d",b=d+"?",w="["+a+"]?",x="(?:"+v+"(?:"+[p,f,m].join("|")+")"+w+b+")*",k=w+b+x,S="(?:"+[p+c+"?",c,f,m,o].join("|")+")",A=RegExp(u+"(?="+u+")|"+S+k,"g");function C(T){return T.match(A)||[]}return ev=C,ev}var tv,mO;function yF(){if(mO)return tv;mO=1;var t=mF(),e=LR(),r=gF();function n(i){return e(i)?r(i):t(i)}return tv=n,tv}var rv,gO;function vF(){if(gO)return rv;gO=1;var t=pF(),e=LR(),r=yF(),n=IR();function i(a){return function(o){o=n(o);var c=e(o)?r(o):void 0,u=c?c[0]:o.charAt(0),d=c?t(c,1).join(""):o.slice(1);return u[a]()+d}}return rv=i,rv}var nv,yO;function bF(){if(yO)return nv;yO=1;var t=vF(),e=t("toUpperCase");return nv=e,nv}var xF=bF();const wp=vt(xF);function Tt(t){return function(){return t}}const zR=Math.cos,oh=Math.sin,ri=Math.sqrt,sh=Math.PI,_p=2*sh,bx=Math.PI,xx=2*bx,wo=1e-6,wF=xx-wo;function BR(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=arguments[e]+t[e]}function _F(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return BR;const r=10**e;return function(n){this._+=n[0];for(let i=1,a=n.length;i<a;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}class SF{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?BR:_F(e)}moveTo(e,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,r){this._append`L${this._x1=+e},${this._y1=+r}`}quadraticCurveTo(e,r,n,i){this._append`Q${+e},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(e,r,n,i,a,o){this._append`C${+e},${+r},${+n},${+i},${this._x1=+a},${this._y1=+o}`}arcTo(e,r,n,i,a){if(e=+e,r=+r,n=+n,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let o=this._x1,c=this._y1,u=n-e,d=i-r,p=o-e,f=c-r,m=p*p+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=r}`;else if(m>wo)if(!(Math.abs(f*u-d*p)>wo)||!a)this._append`L${this._x1=e},${this._y1=r}`;else{let v=n-o,b=i-c,w=u*u+d*d,x=v*v+b*b,k=Math.sqrt(w),S=Math.sqrt(m),A=a*Math.tan((bx-Math.acos((w+m-x)/(2*k*S)))/2),C=A/S,T=A/k;Math.abs(C-1)>wo&&this._append`L${e+C*p},${r+C*f}`,this._append`A${a},${a},0,0,${+(f*v>p*b)},${this._x1=e+T*u},${this._y1=r+T*d}`}}arc(e,r,n,i,a,o){if(e=+e,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let c=n*Math.cos(i),u=n*Math.sin(i),d=e+c,p=r+u,f=1^o,m=o?i-a:a-i;this._x1===null?this._append`M${d},${p}`:(Math.abs(this._x1-d)>wo||Math.abs(this._y1-p)>wo)&&this._append`L${d},${p}`,n&&(m<0&&(m=m%xx+xx),m>wF?this._append`A${n},${n},0,1,${f},${e-c},${r-u}A${n},${n},0,1,${f},${this._x1=d},${this._y1=p}`:m>wo&&this._append`A${n},${n},0,${+(m>=bx)},${f},${this._x1=e+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(e,r,n,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function v1(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(r==null)e=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);e=n}return t},()=>new SF(e)}function b1(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function UR(t){this._context=t}UR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Sp(t){return new UR(t)}function qR(t){return t[0]}function FR(t){return t[1]}function HR(t,e){var r=Tt(!0),n=null,i=Sp,a=null,o=v1(c);t=typeof t=="function"?t:t===void 0?qR:Tt(t),e=typeof e=="function"?e:e===void 0?FR:Tt(e);function c(u){var d,p=(u=b1(u)).length,f,m=!1,v;for(n==null&&(a=i(v=o())),d=0;d<=p;++d)!(d<p&&r(f=u[d],d,u))===m&&((m=!m)?a.lineStart():a.lineEnd()),m&&a.point(+t(f,d,u),+e(f,d,u));if(v)return a=null,v+""||null}return c.x=function(u){return arguments.length?(t=typeof u=="function"?u:Tt(+u),c):t},c.y=function(u){return arguments.length?(e=typeof u=="function"?u:Tt(+u),c):e},c.defined=function(u){return arguments.length?(r=typeof u=="function"?u:Tt(!!u),c):r},c.curve=function(u){return arguments.length?(i=u,n!=null&&(a=i(n)),c):i},c.context=function(u){return arguments.length?(u==null?n=a=null:a=i(n=u),c):n},c}function vf(t,e,r){var n=null,i=Tt(!0),a=null,o=Sp,c=null,u=v1(d);t=typeof t=="function"?t:t===void 0?qR:Tt(+t),e=typeof e=="function"?e:Tt(e===void 0?0:+e),r=typeof r=="function"?r:r===void 0?FR:Tt(+r);function d(f){var m,v,b,w=(f=b1(f)).length,x,k=!1,S,A=new Array(w),C=new Array(w);for(a==null&&(c=o(S=u())),m=0;m<=w;++m){if(!(m<w&&i(x=f[m],m,f))===k)if(k=!k)v=m,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),b=m-1;b>=v;--b)c.point(A[b],C[b]);c.lineEnd(),c.areaEnd()}k&&(A[m]=+t(x,m,f),C[m]=+e(x,m,f),c.point(n?+n(x,m,f):A[m],r?+r(x,m,f):C[m]))}if(S)return c=null,S+""||null}function p(){return HR().defined(i).curve(o).context(a)}return d.x=function(f){return arguments.length?(t=typeof f=="function"?f:Tt(+f),n=null,d):t},d.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Tt(+f),d):t},d.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Tt(+f),d):n},d.y=function(f){return arguments.length?(e=typeof f=="function"?f:Tt(+f),r=null,d):e},d.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Tt(+f),d):e},d.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Tt(+f),d):r},d.lineX0=d.lineY0=function(){return p().x(t).y(e)},d.lineY1=function(){return p().x(t).y(r)},d.lineX1=function(){return p().x(n).y(e)},d.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Tt(!!f),d):i},d.curve=function(f){return arguments.length?(o=f,a!=null&&(c=o(a)),d):o},d.context=function(f){return arguments.length?(f==null?a=c=null:c=o(a=f),d):a},d}class WR{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}function kF(t){return new WR(t,!0)}function EF(t){return new WR(t,!1)}const x1={draw(t,e){const r=ri(e/sh);t.moveTo(r,0),t.arc(0,0,r,0,_p)}},AF={draw(t,e){const r=ri(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},KR=ri(1/3),OF=KR*2,TF={draw(t,e){const r=ri(e/OF),n=r*KR;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},CF={draw(t,e){const r=ri(e),n=-r/2;t.rect(n,n,r,r)}},jF=.8908130915292852,GR=oh(sh/10)/oh(7*sh/10),NF=oh(_p/10)*GR,PF=-zR(_p/10)*GR,RF={draw(t,e){const r=ri(e*jF),n=NF*r,i=PF*r;t.moveTo(0,-r),t.lineTo(n,i);for(let a=1;a<5;++a){const o=_p*a/5,c=zR(o),u=oh(o);t.lineTo(u*r,-c*r),t.lineTo(c*n-u*i,u*n+c*i)}t.closePath()}},iv=ri(3),IF={draw(t,e){const r=-ri(e/(iv*3));t.moveTo(0,r*2),t.lineTo(-iv*r,-r),t.lineTo(iv*r,-r),t.closePath()}},_n=-.5,Sn=ri(3)/2,wx=1/ri(12),$F=(wx/2+1)*3,MF={draw(t,e){const r=ri(e/$F),n=r/2,i=r*wx,a=n,o=r*wx+r,c=-a,u=o;t.moveTo(n,i),t.lineTo(a,o),t.lineTo(c,u),t.lineTo(_n*n-Sn*i,Sn*n+_n*i),t.lineTo(_n*a-Sn*o,Sn*a+_n*o),t.lineTo(_n*c-Sn*u,Sn*c+_n*u),t.lineTo(_n*n+Sn*i,_n*i-Sn*n),t.lineTo(_n*a+Sn*o,_n*o-Sn*a),t.lineTo(_n*c+Sn*u,_n*u-Sn*c),t.closePath()}};function DF(t,e){let r=null,n=v1(i);t=typeof t=="function"?t:Tt(t||x1),e=typeof e=="function"?e:Tt(e===void 0?64:+e);function i(){let a;if(r||(r=a=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(t=typeof a=="function"?a:Tt(a),i):t},i.size=function(a){return arguments.length?(e=typeof a=="function"?a:Tt(+a),i):e},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function lh(){}function ch(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function VR(t){this._context=t}VR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ch(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ch(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function LF(t){return new VR(t)}function XR(t){this._context=t}XR.prototype={areaStart:lh,areaEnd:lh,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ch(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function zF(t){return new XR(t)}function YR(t){this._context=t}YR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:ch(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function BF(t){return new YR(t)}function JR(t){this._context=t}JR.prototype={areaStart:lh,areaEnd:lh,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function UF(t){return new JR(t)}function vO(t){return t<0?-1:1}function bO(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),o=(r-t._y1)/(i||n<0&&-0),c=(a*i+o*n)/(n+i);return(vO(a)+vO(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(c))||0}function xO(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function av(t,e,r){var n=t._x0,i=t._y0,a=t._x1,o=t._y1,c=(a-n)/3;t._context.bezierCurveTo(n+c,i+c*e,a-c,o-c*r,a,o)}function uh(t){this._context=t}uh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:av(this,this._t0,xO(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,av(this,xO(this,r=bO(this,t,e)),r);break;default:av(this,this._t0,r=bO(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function ZR(t){this._context=new QR(t)}(ZR.prototype=Object.create(uh.prototype)).point=function(t,e){uh.prototype.point.call(this,e,t)};function QR(t){this._context=t}QR.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,a){this._context.bezierCurveTo(e,t,n,r,a,i)}};function qF(t){return new uh(t)}function FF(t){return new ZR(t)}function eI(t){this._context=t}eI.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=wO(t),i=wO(e),a=0,o=1;o<r;++a,++o)this._context.bezierCurveTo(n[0][a],i[0][a],n[1][a],i[1][a],t[o],e[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function wO(t){var e,r=t.length-1,n,i=new Array(r),a=new Array(r),o=new Array(r);for(i[0]=0,a[0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,a[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,a[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/a[e-1],a[e]-=n,o[e]-=n*o[e-1];for(i[r-1]=o[r-1]/a[r-1],e=r-2;e>=0;--e)i[e]=(o[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)a[e]=2*t[e+1]-i[e+1];return[i,a]}function HF(t){return new eI(t)}function kp(t,e){this._context=t,this._t=e}kp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function WF(t){return new kp(t,.5)}function KF(t){return new kp(t,0)}function GF(t){return new kp(t,1)}function Ws(t,e){if((o=t.length)>1)for(var r=1,n,i,a=t[e[0]],o,c=a.length;r<o;++r)for(i=a,a=t[e[r]],n=0;n<c;++n)a[n][1]+=a[n][0]=isNaN(i[n][1])?i[n][0]:i[n][1]}function _x(t){for(var e=t.length,r=new Array(e);--e>=0;)r[e]=e;return r}function VF(t,e){return t[e]}function XF(t){const e=[];return e.key=t,e}function YF(){var t=Tt([]),e=_x,r=Ws,n=VF;function i(a){var o=Array.from(t.apply(this,arguments),XF),c,u=o.length,d=-1,p;for(const f of a)for(c=0,++d;c<u;++c)(o[c][d]=[0,+n(f,o[c].key,d,a)]).data=f;for(c=0,p=b1(e(o));c<u;++c)o[p[c]].index=c;return r(o,p),o}return i.keys=function(a){return arguments.length?(t=typeof a=="function"?a:Tt(Array.from(a)),i):t},i.value=function(a){return arguments.length?(n=typeof a=="function"?a:Tt(+a),i):n},i.order=function(a){return arguments.length?(e=a==null?_x:typeof a=="function"?a:Tt(Array.from(a)),i):e},i.offset=function(a){return arguments.length?(r=a??Ws,i):r},i}function JF(t,e){if((n=t.length)>0){for(var r,n,i=0,a=t[0].length,o;i<a;++i){for(o=r=0;r<n;++r)o+=t[r][i][1]||0;if(o)for(r=0;r<n;++r)t[r][i][1]/=o}Ws(t,e)}}function ZF(t,e){if((i=t.length)>0){for(var r=0,n=t[e[0]],i,a=n.length;r<a;++r){for(var o=0,c=0;o<i;++o)c+=t[o][r][1]||0;n[r][1]+=n[r][0]=-c/2}Ws(t,e)}}function QF(t,e){if(!(!((o=t.length)>0)||!((a=(i=t[e[0]]).length)>0))){for(var r=0,n=1,i,a,o;n<a;++n){for(var c=0,u=0,d=0;c<o;++c){for(var p=t[e[c]],f=p[n][1]||0,m=p[n-1][1]||0,v=(f-m)/2,b=0;b<c;++b){var w=t[e[b]],x=w[n][1]||0,k=w[n-1][1]||0;v+=x-k}u+=f,d+=v*f}i[n-1][1]+=i[n-1][0]=r,u&&(r-=d/u)}i[n-1][1]+=i[n-1][0]=r,Ws(t,e)}}function Yc(t){"@babel/helpers - typeof";return Yc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yc(t)}var e7=["type","size","sizeType"];function Sx(){return Sx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Sx.apply(this,arguments)}function _O(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 SO(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_O(Object(r),!0).forEach(function(n){t7(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_O(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function t7(t,e,r){return e=r7(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function r7(t){var e=n7(t,"string");return Yc(e)=="symbol"?e:e+""}function n7(t,e){if(Yc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Yc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function i7(t,e){if(t==null)return{};var r=a7(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function a7(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var tI={symbolCircle:x1,symbolCross:AF,symbolDiamond:TF,symbolSquare:CF,symbolStar:RF,symbolTriangle:IF,symbolWye:MF},o7=Math.PI/180,s7=function(e){var r="symbol".concat(wp(e));return tI[r]||x1},l7=function(e,r,n){if(r==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*o7;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},c7=function(e,r){tI["symbol".concat(wp(e))]=r},w1=function(e){var r=e.type,n=r===void 0?"circle":r,i=e.size,a=i===void 0?64:i,o=e.sizeType,c=o===void 0?"area":o,u=i7(e,e7),d=SO(SO({},u),{},{type:n,size:a,sizeType:c}),p=function(){var x=s7(n),k=DF().type(x).size(l7(a,c,n));return k()},f=d.className,m=d.cx,v=d.cy,b=at(d,!0);return m===+m&&v===+v&&a===+a?M.createElement("path",Sx({},b,{className:ot("recharts-symbols",f),transform:"translate(".concat(m,", ").concat(v,")"),d:p()})):null};w1.registerSymbol=c7;function Ks(t){"@babel/helpers - typeof";return Ks=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ks(t)}function kx(){return kx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},kx.apply(this,arguments)}function kO(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 u7(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?kO(Object(r),!0).forEach(function(n){Jc(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function d7(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function f7(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,nI(n.key),n)}}function h7(t,e,r){return e&&f7(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function p7(t,e,r){return e=dh(e),m7(t,rI()?Reflect.construct(e,r||[],dh(t).constructor):e.apply(t,r))}function m7(t,e){if(e&&(Ks(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return g7(t)}function g7(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rI(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rI=function(){return!!t})()}function dh(t){return dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},dh(t)}function y7(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ex(t,e)}function Ex(t,e){return Ex=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ex(t,e)}function Jc(t,e,r){return e=nI(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nI(t){var e=v7(t,"string");return Ks(e)=="symbol"?e:e+""}function v7(t,e){if(Ks(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ks(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var kn=32,_1=(function(t){function e(){return d7(this,e),p7(this,e,arguments)}return y7(e,t),h7(e,[{key:"renderIcon",value:function(n){var i=this.props.inactiveColor,a=kn/2,o=kn/6,c=kn/3,u=n.inactive?i:n.color;if(n.type==="plainline")return M.createElement("line",{strokeWidth:4,fill:"none",stroke:u,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:a,x2:kn,y2:a,className:"recharts-legend-icon"});if(n.type==="line")return M.createElement("path",{strokeWidth:4,fill:"none",stroke:u,d:"M0,".concat(a,"h").concat(c,`
|
|
458
458
|
A`).concat(o,",").concat(o,",0,1,1,").concat(2*c,",").concat(a,`
|
|
459
459
|
H`).concat(kn,"M").concat(2*c,",").concat(a,`
|
|
460
|
-
A`).concat(o,",").concat(o,",0,1,1,").concat(c,",").concat(a),className:"recharts-legend-icon"});if(n.type==="rect")return M.createElement("path",{stroke:"none",fill:u,d:"M0,".concat(kn/8,"h").concat(kn,"v").concat(kn*3/4,"h").concat(-kn,"z"),className:"recharts-legend-icon"});if(M.isValidElement(n.legendIcon)){var d=c7({},n);return delete d.legendIcon,M.cloneElement(n.legendIcon,d)}return M.createElement(w1,{fill:u,cx:a,cy:a,size:kn,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,i=this.props,a=i.payload,o=i.iconSize,c=i.layout,u=i.formatter,d=i.inactiveColor,p={x:0,y:0,width:kn,height:kn},f={display:c==="horizontal"?"inline-block":"block",marginRight:10},m={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(v,b){var w=v.formatter||u,x=ot(Jc(Jc({"recharts-legend-item":!0},"legend-item-".concat(b),!0),"inactive",v.inactive));if(v.type==="none")return null;var k=Je(v.value)?null:v.value;Vi(!Je(v.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var S=v.inactive?d:v.color;return M.createElement("li",kx({className:x,style:f,key:"legend-item-".concat(b)},ah(n.props,v,b)),M.createElement(yx,{width:o,height:o,viewBox:p,style:m},n.renderIcon(v)),M.createElement("span",{className:"recharts-legend-item-text",style:{color:S}},w?w(k,v,b):k))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var c={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return M.createElement("ul",{className:"recharts-default-legend",style:c},this.renderItems())}}])})(j.PureComponent);Jc(_1,"displayName","Legend");Jc(_1,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var ov,EO;function v7(){if(EO)return ov;EO=1;var t=vp();function e(){this.__data__=new t,this.size=0}return ov=e,ov}var sv,AO;function b7(){if(AO)return sv;AO=1;function t(e){var r=this.__data__,n=r.delete(e);return this.size=r.size,n}return sv=t,sv}var lv,OO;function x7(){if(OO)return lv;OO=1;function t(e){return this.__data__.get(e)}return lv=t,lv}var cv,TO;function w7(){if(TO)return cv;TO=1;function t(e){return this.__data__.has(e)}return cv=t,cv}var uv,CO;function _7(){if(CO)return uv;CO=1;var t=vp(),e=f1(),r=h1(),n=200;function i(a,o){var c=this.__data__;if(c instanceof t){var u=c.__data__;if(!e||u.length<n-1)return u.push([a,o]),this.size=++c.size,this;c=this.__data__=new r(u)}return c.set(a,o),this.size=c.size,this}return uv=i,uv}var dv,jO;function iI(){if(jO)return dv;jO=1;var t=vp(),e=v7(),r=b7(),n=x7(),i=w7(),a=_7();function o(c){var u=this.__data__=new t(c);this.size=u.size}return o.prototype.clear=e,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=i,o.prototype.set=a,dv=o,dv}var fv,NO;function S7(){if(NO)return fv;NO=1;var t="__lodash_hash_undefined__";function e(r){return this.__data__.set(r,t),this}return fv=e,fv}var hv,PO;function k7(){if(PO)return hv;PO=1;function t(e){return this.__data__.has(e)}return hv=t,hv}var pv,RO;function aI(){if(RO)return pv;RO=1;var t=h1(),e=S7(),r=k7();function n(i){var a=-1,o=i==null?0:i.length;for(this.__data__=new t;++a<o;)this.add(i[a])}return n.prototype.add=n.prototype.push=e,n.prototype.has=r,pv=n,pv}var mv,IO;function oI(){if(IO)return mv;IO=1;function t(e,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(e[n],n,e))return!0;return!1}return mv=t,mv}var gv,$O;function sI(){if($O)return gv;$O=1;function t(e,r){return e.has(r)}return gv=t,gv}var yv,MO;function lI(){if(MO)return yv;MO=1;var t=aI(),e=oI(),r=sI(),n=1,i=2;function a(o,c,u,d,p,f){var m=u&n,v=o.length,b=c.length;if(v!=b&&!(m&&b>v))return!1;var w=f.get(o),x=f.get(c);if(w&&x)return w==c&&x==o;var k=-1,S=!0,A=u&i?new t:void 0;for(f.set(o,c),f.set(c,o);++k<v;){var C=o[k],T=c[k];if(d)var O=m?d(T,C,k,c,o,f):d(C,T,k,o,c,f);if(O!==void 0){if(O)continue;S=!1;break}if(A){if(!e(c,function(N,R){if(!r(A,R)&&(C===N||p(C,N,u,d,f)))return A.push(R)})){S=!1;break}}else if(!(C===T||p(C,T,u,d,f))){S=!1;break}}return f.delete(o),f.delete(c),S}return yv=a,yv}var vv,DO;function E7(){if(DO)return vv;DO=1;var t=Ai(),e=t.Uint8Array;return vv=e,vv}var bv,LO;function A7(){if(LO)return bv;LO=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(i,a){n[++r]=[a,i]}),n}return bv=t,bv}var xv,zO;function S1(){if(zO)return xv;zO=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(i){n[++r]=i}),n}return xv=t,xv}var wv,BO;function O7(){if(BO)return wv;BO=1;var t=Du(),e=E7(),r=d1(),n=lI(),i=A7(),a=S1(),o=1,c=2,u="[object Boolean]",d="[object Date]",p="[object Error]",f="[object Map]",m="[object Number]",v="[object RegExp]",b="[object Set]",w="[object String]",x="[object Symbol]",k="[object ArrayBuffer]",S="[object DataView]",A=t?t.prototype:void 0,C=A?A.valueOf:void 0;function T(O,N,R,$,K,z,U){switch(R){case S:if(O.byteLength!=N.byteLength||O.byteOffset!=N.byteOffset)return!1;O=O.buffer,N=N.buffer;case k:return!(O.byteLength!=N.byteLength||!z(new e(O),new e(N)));case u:case d:case m:return r(+O,+N);case p:return O.name==N.name&&O.message==N.message;case v:case w:return O==N+"";case f:var F=i;case b:var X=$&o;if(F||(F=a),O.size!=N.size&&!X)return!1;var Y=U.get(O);if(Y)return Y==N;$|=c,U.set(O,N);var G=n(F(O),F(N),$,K,z,U);return U.delete(O),G;case x:if(C)return C.call(O)==C.call(N)}return!1}return wv=T,wv}var _v,UO;function cI(){if(UO)return _v;UO=1;function t(e,r){for(var n=-1,i=r.length,a=e.length;++n<i;)e[a+n]=r[n];return e}return _v=t,_v}var Sv,qO;function T7(){if(qO)return Sv;qO=1;var t=cI(),e=Qr();function r(n,i,a){var o=i(n);return e(n)?o:t(o,a(n))}return Sv=r,Sv}var kv,FO;function C7(){if(FO)return kv;FO=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=0,o=[];++n<i;){var c=e[n];r(c,n,e)&&(o[a++]=c)}return o}return kv=t,kv}var Ev,HO;function j7(){if(HO)return Ev;HO=1;function t(){return[]}return Ev=t,Ev}var Av,WO;function N7(){if(WO)return Av;WO=1;var t=C7(),e=j7(),r=Object.prototype,n=r.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(o){return o==null?[]:(o=Object(o),t(i(o),function(c){return n.call(o,c)}))}:e;return Av=a,Av}var Ov,KO;function P7(){if(KO)return Ov;KO=1;function t(e,r){for(var n=-1,i=Array(e);++n<e;)i[n]=r(n);return i}return Ov=t,Ov}var Tv,GO;function R7(){if(GO)return Tv;GO=1;var t=ra(),e=na(),r="[object Arguments]";function n(i){return e(i)&&t(i)==r}return Tv=n,Tv}var Cv,VO;function k1(){if(VO)return Cv;VO=1;var t=R7(),e=na(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,a=t((function(){return arguments})())?t:function(o){return e(o)&&n.call(o,"callee")&&!i.call(o,"callee")};return Cv=a,Cv}var jc={exports:{}},jv,XO;function I7(){if(XO)return jv;XO=1;function t(){return!1}return jv=t,jv}jc.exports;var YO;function uI(){return YO||(YO=1,(function(t,e){var r=Ai(),n=I7(),i=e&&!e.nodeType&&e,a=i&&!0&&t&&!t.nodeType&&t,o=a&&a.exports===i,c=o?r.Buffer:void 0,u=c?c.isBuffer:void 0,d=u||n;t.exports=d})(jc,jc.exports)),jc.exports}var Nv,JO;function E1(){if(JO)return Nv;JO=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(n,i){var a=typeof n;return i=i??t,!!i&&(a=="number"||a!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return Nv=r,Nv}var Pv,ZO;function A1(){if(ZO)return Pv;ZO=1;var t=9007199254740991;function e(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=t}return Pv=e,Pv}var Rv,QO;function $7(){if(QO)return Rv;QO=1;var t=ra(),e=A1(),r=na(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",c="[object Error]",u="[object Function]",d="[object Map]",p="[object Number]",f="[object Object]",m="[object RegExp]",v="[object Set]",b="[object String]",w="[object WeakMap]",x="[object ArrayBuffer]",k="[object DataView]",S="[object Float32Array]",A="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",O="[object Int32Array]",N="[object Uint8Array]",R="[object Uint8ClampedArray]",$="[object Uint16Array]",K="[object Uint32Array]",z={};z[S]=z[A]=z[C]=z[T]=z[O]=z[N]=z[R]=z[$]=z[K]=!0,z[n]=z[i]=z[x]=z[a]=z[k]=z[o]=z[c]=z[u]=z[d]=z[p]=z[f]=z[m]=z[v]=z[b]=z[w]=!1;function U(F){return r(F)&&e(F.length)&&!!z[t(F)]}return Rv=U,Rv}var Iv,eT;function dI(){if(eT)return Iv;eT=1;function t(e){return function(r){return e(r)}}return Iv=t,Iv}var Nc={exports:{}};Nc.exports;var tT;function M7(){return tT||(tT=1,(function(t,e){var r=NR(),n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,a=i&&i.exports===n,o=a&&r.process,c=(function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}})();t.exports=c})(Nc,Nc.exports)),Nc.exports}var $v,rT;function fI(){if(rT)return $v;rT=1;var t=$7(),e=dI(),r=M7(),n=r&&r.isTypedArray,i=n?e(n):t;return $v=i,$v}var Mv,nT;function D7(){if(nT)return Mv;nT=1;var t=P7(),e=k1(),r=Qr(),n=uI(),i=E1(),a=fI(),o=Object.prototype,c=o.hasOwnProperty;function u(d,p){var f=r(d),m=!f&&e(d),v=!f&&!m&&n(d),b=!f&&!m&&!v&&a(d),w=f||m||v||b,x=w?t(d.length,String):[],k=x.length;for(var S in d)(p||c.call(d,S))&&!(w&&(S=="length"||v&&(S=="offset"||S=="parent")||b&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||i(S,k)))&&x.push(S);return x}return Mv=u,Mv}var Dv,iT;function L7(){if(iT)return Dv;iT=1;var t=Object.prototype;function e(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||t;return r===i}return Dv=e,Dv}var Lv,aT;function hI(){if(aT)return Lv;aT=1;function t(e,r){return function(n){return e(r(n))}}return Lv=t,Lv}var zv,oT;function z7(){if(oT)return zv;oT=1;var t=hI(),e=t(Object.keys,Object);return zv=e,zv}var Bv,sT;function B7(){if(sT)return Bv;sT=1;var t=L7(),e=z7(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!t(a))return e(a);var o=[];for(var c in Object(a))n.call(a,c)&&c!="constructor"&&o.push(c);return o}return Bv=i,Bv}var Uv,lT;function Bu(){if(lT)return Uv;lT=1;var t=u1(),e=A1();function r(n){return n!=null&&e(n.length)&&!t(n)}return Uv=r,Uv}var qv,cT;function Ep(){if(cT)return qv;cT=1;var t=D7(),e=B7(),r=Bu();function n(i){return r(i)?t(i):e(i)}return qv=n,qv}var Fv,uT;function U7(){if(uT)return Fv;uT=1;var t=T7(),e=N7(),r=Ep();function n(i){return t(i,r,e)}return Fv=n,Fv}var Hv,dT;function q7(){if(dT)return Hv;dT=1;var t=U7(),e=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,c,u,d,p){var f=c&e,m=t(a),v=m.length,b=t(o),w=b.length;if(v!=w&&!f)return!1;for(var x=v;x--;){var k=m[x];if(!(f?k in o:n.call(o,k)))return!1}var S=p.get(a),A=p.get(o);if(S&&A)return S==o&&A==a;var C=!0;p.set(a,o),p.set(o,a);for(var T=f;++x<v;){k=m[x];var O=a[k],N=o[k];if(u)var R=f?u(N,O,k,o,a,p):u(O,N,k,a,o,p);if(!(R===void 0?O===N||d(O,N,c,u,p):R)){C=!1;break}T||(T=k=="constructor")}if(C&&!T){var $=a.constructor,K=o.constructor;$!=K&&"constructor"in a&&"constructor"in o&&!(typeof $=="function"&&$ instanceof $&&typeof K=="function"&&K instanceof K)&&(C=!1)}return p.delete(a),p.delete(o),C}return Hv=i,Hv}var Wv,fT;function F7(){if(fT)return Wv;fT=1;var t=Uo(),e=Ai(),r=t(e,"DataView");return Wv=r,Wv}var Kv,hT;function H7(){if(hT)return Kv;hT=1;var t=Uo(),e=Ai(),r=t(e,"Promise");return Kv=r,Kv}var Gv,pT;function pI(){if(pT)return Gv;pT=1;var t=Uo(),e=Ai(),r=t(e,"Set");return Gv=r,Gv}var Vv,mT;function W7(){if(mT)return Vv;mT=1;var t=Uo(),e=Ai(),r=t(e,"WeakMap");return Vv=r,Vv}var Xv,gT;function K7(){if(gT)return Xv;gT=1;var t=F7(),e=f1(),r=H7(),n=pI(),i=W7(),a=ra(),o=PR(),c="[object Map]",u="[object Object]",d="[object Promise]",p="[object Set]",f="[object WeakMap]",m="[object DataView]",v=o(t),b=o(e),w=o(r),x=o(n),k=o(i),S=a;return(t&&S(new t(new ArrayBuffer(1)))!=m||e&&S(new e)!=c||r&&S(r.resolve())!=d||n&&S(new n)!=p||i&&S(new i)!=f)&&(S=function(A){var C=a(A),T=C==u?A.constructor:void 0,O=T?o(T):"";if(O)switch(O){case v:return m;case b:return c;case w:return d;case x:return p;case k:return f}return C}),Xv=S,Xv}var Yv,yT;function G7(){if(yT)return Yv;yT=1;var t=iI(),e=lI(),r=O7(),n=q7(),i=K7(),a=Qr(),o=uI(),c=fI(),u=1,d="[object Arguments]",p="[object Array]",f="[object Object]",m=Object.prototype,v=m.hasOwnProperty;function b(w,x,k,S,A,C){var T=a(w),O=a(x),N=T?p:i(w),R=O?p:i(x);N=N==d?f:N,R=R==d?f:R;var $=N==f,K=R==f,z=N==R;if(z&&o(w)){if(!o(x))return!1;T=!0,$=!1}if(z&&!$)return C||(C=new t),T||c(w)?e(w,x,k,S,A,C):r(w,x,N,k,S,A,C);if(!(k&u)){var U=$&&v.call(w,"__wrapped__"),F=K&&v.call(x,"__wrapped__");if(U||F){var X=U?w.value():w,Y=F?x.value():x;return C||(C=new t),A(X,Y,k,S,C)}}return z?(C||(C=new t),n(w,x,k,S,A,C)):!1}return Yv=b,Yv}var Jv,vT;function O1(){if(vT)return Jv;vT=1;var t=G7(),e=na();function r(n,i,a,o,c){return n===i?!0:n==null||i==null||!e(n)&&!e(i)?n!==n&&i!==i:t(n,i,a,o,r,c)}return Jv=r,Jv}var Zv,bT;function V7(){if(bT)return Zv;bT=1;var t=iI(),e=O1(),r=1,n=2;function i(a,o,c,u){var d=c.length,p=d,f=!u;if(a==null)return!p;for(a=Object(a);d--;){var m=c[d];if(f&&m[2]?m[1]!==a[m[0]]:!(m[0]in a))return!1}for(;++d<p;){m=c[d];var v=m[0],b=a[v],w=m[1];if(f&&m[2]){if(b===void 0&&!(v in a))return!1}else{var x=new t;if(u)var k=u(b,w,v,a,o,x);if(!(k===void 0?e(w,b,r|n,u,x):k))return!1}}return!0}return Zv=i,Zv}var Qv,xT;function mI(){if(xT)return Qv;xT=1;var t=Wa();function e(r){return r===r&&!t(r)}return Qv=e,Qv}var e0,wT;function X7(){if(wT)return e0;wT=1;var t=mI(),e=Ep();function r(n){for(var i=e(n),a=i.length;a--;){var o=i[a],c=n[o];i[a]=[o,c,t(c)]}return i}return e0=r,e0}var t0,_T;function gI(){if(_T)return t0;_T=1;function t(e,r){return function(n){return n==null?!1:n[e]===r&&(r!==void 0||e in Object(n))}}return t0=t,t0}var r0,ST;function Y7(){if(ST)return r0;ST=1;var t=V7(),e=X7(),r=gI();function n(i){var a=e(i);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(o){return o===i||t(o,i,a)}}return r0=n,r0}var n0,kT;function J7(){if(kT)return n0;kT=1;function t(e,r){return e!=null&&r in Object(e)}return n0=t,n0}var i0,ET;function Z7(){if(ET)return i0;ET=1;var t=$R(),e=k1(),r=Qr(),n=E1(),i=A1(),a=xp();function o(c,u,d){u=t(u,c);for(var p=-1,f=u.length,m=!1;++p<f;){var v=a(u[p]);if(!(m=c!=null&&d(c,v)))break;c=c[v]}return m||++p!=f?m:(f=c==null?0:c.length,!!f&&i(f)&&n(v,f)&&(r(c)||e(c)))}return i0=o,i0}var a0,AT;function Q7(){if(AT)return a0;AT=1;var t=J7(),e=Z7();function r(n,i){return n!=null&&e(n,i,t)}return a0=r,a0}var o0,OT;function eH(){if(OT)return o0;OT=1;var t=O1(),e=MR(),r=Q7(),n=c1(),i=mI(),a=gI(),o=xp(),c=1,u=2;function d(p,f){return n(p)&&i(f)?a(o(p),f):function(m){var v=e(m,p);return v===void 0&&v===f?r(m,p):t(f,v,c|u)}}return o0=d,o0}var s0,TT;function _l(){if(TT)return s0;TT=1;function t(e){return e}return s0=t,s0}var l0,CT;function tH(){if(CT)return l0;CT=1;function t(e){return function(r){return r==null?void 0:r[e]}}return l0=t,l0}var c0,jT;function rH(){if(jT)return c0;jT=1;var t=m1();function e(r){return function(n){return t(n,r)}}return c0=e,c0}var u0,NT;function nH(){if(NT)return u0;NT=1;var t=tH(),e=rH(),r=c1(),n=xp();function i(a){return r(a)?t(n(a)):e(a)}return u0=i,u0}var d0,PT;function Ka(){if(PT)return d0;PT=1;var t=Y7(),e=eH(),r=_l(),n=Qr(),i=nH();function a(o){return typeof o=="function"?o:o==null?r:typeof o=="object"?n(o)?e(o[0],o[1]):t(o):i(o)}return d0=a,d0}var f0,RT;function yI(){if(RT)return f0;RT=1;function t(e,r,n,i){for(var a=e.length,o=n+(i?1:-1);i?o--:++o<a;)if(r(e[o],o,e))return o;return-1}return f0=t,f0}var h0,IT;function iH(){if(IT)return h0;IT=1;function t(e){return e!==e}return h0=t,h0}var p0,$T;function aH(){if($T)return p0;$T=1;function t(e,r,n){for(var i=n-1,a=e.length;++i<a;)if(e[i]===r)return i;return-1}return p0=t,p0}var m0,MT;function oH(){if(MT)return m0;MT=1;var t=yI(),e=iH(),r=aH();function n(i,a,o){return a===a?r(i,a,o):t(i,e,o)}return m0=n,m0}var g0,DT;function sH(){if(DT)return g0;DT=1;var t=oH();function e(r,n){var i=r==null?0:r.length;return!!i&&t(r,n,0)>-1}return g0=e,g0}var y0,LT;function lH(){if(LT)return y0;LT=1;function t(e,r,n){for(var i=-1,a=e==null?0:e.length;++i<a;)if(n(r,e[i]))return!0;return!1}return y0=t,y0}var v0,zT;function cH(){if(zT)return v0;zT=1;function t(){}return v0=t,v0}var b0,BT;function uH(){if(BT)return b0;BT=1;var t=pI(),e=cH(),r=S1(),n=1/0,i=t&&1/r(new t([,-0]))[1]==n?function(a){return new t(a)}:e;return b0=i,b0}var x0,UT;function dH(){if(UT)return x0;UT=1;var t=aI(),e=sH(),r=lH(),n=sI(),i=uH(),a=S1(),o=200;function c(u,d,p){var f=-1,m=e,v=u.length,b=!0,w=[],x=w;if(p)b=!1,m=r;else if(v>=o){var k=d?null:i(u);if(k)return a(k);b=!1,m=n,x=new t}else x=d?[]:w;e:for(;++f<v;){var S=u[f],A=d?d(S):S;if(S=p||S!==0?S:0,b&&A===A){for(var C=x.length;C--;)if(x[C]===A)continue e;d&&x.push(A),w.push(S)}else m(x,A,p)||(x!==w&&x.push(A),w.push(S))}return w}return x0=c,x0}var w0,qT;function fH(){if(qT)return w0;qT=1;var t=Ka(),e=dH();function r(n,i){return n&&n.length?e(n,t(i,2)):[]}return w0=r,w0}var hH=fH();const FT=vt(hH);function vI(t,e,r){return e===!0?FT(t,r):Je(e)?FT(t,e):t}function Gs(t){"@babel/helpers - typeof";return Gs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gs(t)}var pH=["ref"];function HT(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 Bi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?HT(Object(r),!0).forEach(function(n){Ap(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):HT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function mH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function WT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xI(n.key),n)}}function gH(t,e,r){return e&&WT(t.prototype,e),r&&WT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function yH(t,e,r){return e=fh(e),vH(t,bI()?Reflect.construct(e,r||[],fh(t).constructor):e.apply(t,r))}function vH(t,e){if(e&&(Gs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bH(t)}function bH(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bI(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bI=function(){return!!t})()}function fh(t){return fh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fh(t)}function xH(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ax(t,e)}function Ax(t,e){return Ax=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ax(t,e)}function Ap(t,e,r){return e=xI(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xI(t){var e=wH(t,"string");return Gs(e)=="symbol"?e:e+""}function wH(t,e){if(Gs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Gs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function _H(t,e){if(t==null)return{};var r=SH(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function SH(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function kH(t){return t.value}function EH(t,e){if(M.isValidElement(t))return M.cloneElement(t,e);if(typeof t=="function")return M.createElement(t,e);e.ref;var r=_H(e,pH);return M.createElement(_1,r)}var KT=1,Bs=(function(t){function e(){var r;mH(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=yH(this,e,[].concat(i)),Ap(r,"lastBoundingBox",{width:-1,height:-1}),r}return xH(e,t),gH(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>KT||Math.abs(i.height-this.lastBoundingBox.height)>KT)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Bi({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,c=i.verticalAlign,u=i.margin,d=i.chartWidth,p=i.chartHeight,f,m;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var v=this.getBBoxSnapshot();f={left:((d||0)-v.width)/2}}else f=o==="right"?{right:u&&u.right||0}:{left:u&&u.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(c==="middle"){var b=this.getBBoxSnapshot();m={top:((p||0)-b.height)/2}}else m=c==="bottom"?{bottom:u&&u.bottom||0}:{top:u&&u.top||0};return Bi(Bi({},f),m)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,c=i.height,u=i.wrapperStyle,d=i.payloadUniqBy,p=i.payload,f=Bi(Bi({position:"absolute",width:o||"auto",height:c||"auto"},this.getDefaultPosition(u)),u);return M.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(v){n.wrapperNode=v}},EH(a,Bi(Bi({},this.props),{},{payload:vI(p,d,kH)})))}}],[{key:"getWithHeight",value:function(n,i){var a=Bi(Bi({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&ge(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(j.PureComponent);Ap(Bs,"displayName","Legend");Ap(Bs,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var _0,GT;function AH(){if(GT)return _0;GT=1;var t=Du(),e=k1(),r=Qr(),n=t?t.isConcatSpreadable:void 0;function i(a){return r(a)||e(a)||!!(n&&a&&a[n])}return _0=i,_0}var S0,VT;function wI(){if(VT)return S0;VT=1;var t=cI(),e=AH();function r(n,i,a,o,c){var u=-1,d=n.length;for(a||(a=e),c||(c=[]);++u<d;){var p=n[u];i>0&&a(p)?i>1?r(p,i-1,a,o,c):t(c,p):o||(c[c.length]=p)}return c}return S0=r,S0}var k0,XT;function OH(){if(XT)return k0;XT=1;function t(e){return function(r,n,i){for(var a=-1,o=Object(r),c=i(r),u=c.length;u--;){var d=c[e?u:++a];if(n(o[d],d,o)===!1)break}return r}}return k0=t,k0}var E0,YT;function TH(){if(YT)return E0;YT=1;var t=OH(),e=t();return E0=e,E0}var A0,JT;function _I(){if(JT)return A0;JT=1;var t=TH(),e=Ep();function r(n,i){return n&&t(n,i,e)}return A0=r,A0}var O0,ZT;function CH(){if(ZT)return O0;ZT=1;var t=Bu();function e(r,n){return function(i,a){if(i==null)return i;if(!t(i))return r(i,a);for(var o=i.length,c=n?o:-1,u=Object(i);(n?c--:++c<o)&&a(u[c],c,u)!==!1;);return i}}return O0=e,O0}var T0,QT;function T1(){if(QT)return T0;QT=1;var t=_I(),e=CH(),r=e(t);return T0=r,T0}var C0,eC;function SI(){if(eC)return C0;eC=1;var t=T1(),e=Bu();function r(n,i){var a=-1,o=e(n)?Array(n.length):[];return t(n,function(c,u,d){o[++a]=i(c,u,d)}),o}return C0=r,C0}var j0,tC;function jH(){if(tC)return j0;tC=1;function t(e,r){var n=e.length;for(e.sort(r);n--;)e[n]=e[n].value;return e}return j0=t,j0}var N0,rC;function NH(){if(rC)return N0;rC=1;var t=xl();function e(r,n){if(r!==n){var i=r!==void 0,a=r===null,o=r===r,c=t(r),u=n!==void 0,d=n===null,p=n===n,f=t(n);if(!d&&!f&&!c&&r>n||c&&u&&p&&!d&&!f||a&&u&&p||!i&&p||!o)return 1;if(!a&&!c&&!f&&r<n||f&&i&&o&&!a&&!c||d&&i&&o||!u&&o||!p)return-1}return 0}return N0=e,N0}var P0,nC;function PH(){if(nC)return P0;nC=1;var t=NH();function e(r,n,i){for(var a=-1,o=r.criteria,c=n.criteria,u=o.length,d=i.length;++a<u;){var p=t(o[a],c[a]);if(p){if(a>=d)return p;var f=i[a];return p*(f=="desc"?-1:1)}}return r.index-n.index}return P0=e,P0}var R0,iC;function RH(){if(iC)return R0;iC=1;var t=p1(),e=m1(),r=Ka(),n=SI(),i=jH(),a=dI(),o=PH(),c=_l(),u=Qr();function d(p,f,m){f.length?f=t(f,function(w){return u(w)?function(x){return e(x,w.length===1?w[0]:w)}:w}):f=[c];var v=-1;f=t(f,a(r));var b=n(p,function(w,x,k){var S=t(f,function(A){return A(w)});return{criteria:S,index:++v,value:w}});return i(b,function(w,x){return o(w,x,m)})}return R0=d,R0}var I0,aC;function IH(){if(aC)return I0;aC=1;function t(e,r,n){switch(n.length){case 0:return e.call(r);case 1:return e.call(r,n[0]);case 2:return e.call(r,n[0],n[1]);case 3:return e.call(r,n[0],n[1],n[2])}return e.apply(r,n)}return I0=t,I0}var $0,oC;function $H(){if(oC)return $0;oC=1;var t=IH(),e=Math.max;function r(n,i,a){return i=e(i===void 0?n.length-1:i,0),function(){for(var o=arguments,c=-1,u=e(o.length-i,0),d=Array(u);++c<u;)d[c]=o[i+c];c=-1;for(var p=Array(i+1);++c<i;)p[c]=o[c];return p[i]=a(d),t(n,this,p)}}return $0=r,$0}var M0,sC;function MH(){if(sC)return M0;sC=1;function t(e){return function(){return e}}return M0=t,M0}var D0,lC;function kI(){if(lC)return D0;lC=1;var t=Uo(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return D0=e,D0}var L0,cC;function DH(){if(cC)return L0;cC=1;var t=MH(),e=kI(),r=_l(),n=e?function(i,a){return e(i,"toString",{configurable:!0,enumerable:!1,value:t(a),writable:!0})}:r;return L0=n,L0}var z0,uC;function LH(){if(uC)return z0;uC=1;var t=800,e=16,r=Date.now;function n(i){var a=0,o=0;return function(){var c=r(),u=e-(c-o);if(o=c,u>0){if(++a>=t)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return z0=n,z0}var B0,dC;function zH(){if(dC)return B0;dC=1;var t=DH(),e=LH(),r=e(t);return B0=r,B0}var U0,fC;function BH(){if(fC)return U0;fC=1;var t=_l(),e=$H(),r=zH();function n(i,a){return r(e(i,a,t),i+"")}return U0=n,U0}var q0,hC;function Op(){if(hC)return q0;hC=1;var t=d1(),e=Bu(),r=E1(),n=Wa();function i(a,o,c){if(!n(c))return!1;var u=typeof o;return(u=="number"?e(c)&&r(o,c.length):u=="string"&&o in c)?t(c[o],a):!1}return q0=i,q0}var F0,pC;function UH(){if(pC)return F0;pC=1;var t=wI(),e=RH(),r=BH(),n=Op(),i=r(function(a,o){if(a==null)return[];var c=o.length;return c>1&&n(a,o[0],o[1])?o=[]:c>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),e(a,t(o,1),[])});return F0=i,F0}var qH=UH();const C1=vt(qH);function Zc(t){"@babel/helpers - typeof";return Zc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zc(t)}function Ox(){return Ox=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ox.apply(this,arguments)}function FH(t,e){return GH(t)||KH(t,e)||WH(t,e)||HH()}function HH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
461
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WH(t,e){if(t){if(typeof t=="string")return mC(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 mC(t,e)}}function mC(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 KH(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function GH(t){if(Array.isArray(t))return t}function gC(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 H0(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gC(Object(r),!0).forEach(function(n){VH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function VH(t,e,r){return e=XH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function XH(t){var e=YH(t,"string");return Zc(e)=="symbol"?e:e+""}function YH(t,e){if(Zc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Zc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function JH(t){return Array.isArray(t)&&sr(t[0])&&sr(t[1])?t.join(" ~ "):t}var ZH=function(e){var r=e.separator,n=r===void 0?" : ":r,i=e.contentStyle,a=i===void 0?{}:i,o=e.itemStyle,c=o===void 0?{}:o,u=e.labelStyle,d=u===void 0?{}:u,p=e.payload,f=e.formatter,m=e.itemSorter,v=e.wrapperClassName,b=e.labelClassName,w=e.label,x=e.labelFormatter,k=e.accessibilityLayer,S=k===void 0?!1:k,A=function(){if(p&&p.length){var U={padding:0,margin:0},F=(m?C1(p,m):p).map(function(X,Y){if(X.type==="none")return null;var G=H0({display:"block",paddingTop:4,paddingBottom:4,color:X.color||"#000"},c),Z=X.formatter||f||JH,W=X.value,Q=X.name,L=W,I=Q;if(Z&&L!=null&&I!=null){var q=Z(W,Q,X,Y,p);if(Array.isArray(q)){var ee=FH(q,2);L=ee[0],I=ee[1]}else L=q}return M.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(Y),style:G},sr(I)?M.createElement("span",{className:"recharts-tooltip-item-name"},I):null,sr(I)?M.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,M.createElement("span",{className:"recharts-tooltip-item-value"},L),M.createElement("span",{className:"recharts-tooltip-item-unit"},X.unit||""))});return M.createElement("ul",{className:"recharts-tooltip-item-list",style:U},F)}return null},C=H0({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),T=H0({margin:0},d),O=!tt(w),N=O?w:"",R=ot("recharts-default-tooltip",v),$=ot("recharts-tooltip-label",b);O&&x&&p!==void 0&&p!==null&&(N=x(w,p));var K=S?{role:"status","aria-live":"assertive"}:{};return M.createElement("div",Ox({className:R,style:C},K),M.createElement("p",{className:$,style:T},M.isValidElement(N)?N:"".concat(N)),A())};function Qc(t){"@babel/helpers - typeof";return Qc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qc(t)}function bf(t,e,r){return e=QH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function QH(t){var e=eW(t,"string");return Qc(e)=="symbol"?e:e+""}function eW(t,e){if(Qc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Qc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gc="recharts-tooltip-wrapper",tW={visibility:"hidden"};function rW(t){var e=t.coordinate,r=t.translateX,n=t.translateY;return ot(gc,bf(bf(bf(bf({},"".concat(gc,"-right"),ge(r)&&e&&ge(e.x)&&r>=e.x),"".concat(gc,"-left"),ge(r)&&e&&ge(e.x)&&r<e.x),"".concat(gc,"-bottom"),ge(n)&&e&&ge(e.y)&&n>=e.y),"".concat(gc,"-top"),ge(n)&&e&&ge(e.y)&&n<e.y))}function yC(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.key,i=t.offsetTopLeft,a=t.position,o=t.reverseDirection,c=t.tooltipDimension,u=t.viewBox,d=t.viewBoxDimension;if(a&&ge(a[n]))return a[n];var p=r[n]-c-i,f=r[n]+i;if(e[n])return o[n]?p:f;if(o[n]){var m=p,v=u[n];return m<v?Math.max(f,u[n]):Math.max(p,u[n])}var b=f+c,w=u[n]+d;return b>w?Math.max(p,u[n]):Math.max(f,u[n])}function nW(t){var e=t.translateX,r=t.translateY,n=t.useTranslate3d;return{transform:n?"translate3d(".concat(e,"px, ").concat(r,"px, 0)"):"translate(".concat(e,"px, ").concat(r,"px)")}}function iW(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.offsetTopLeft,i=t.position,a=t.reverseDirection,o=t.tooltipBox,c=t.useTranslate3d,u=t.viewBox,d,p,f;return o.height>0&&o.width>0&&r?(p=yC({allowEscapeViewBox:e,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:u,viewBoxDimension:u.width}),f=yC({allowEscapeViewBox:e,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:u,viewBoxDimension:u.height}),d=nW({translateX:p,translateY:f,useTranslate3d:c})):d=tW,{cssProperties:d,cssClasses:rW({translateX:p,translateY:f,coordinate:r})}}function Vs(t){"@babel/helpers - typeof";return Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vs(t)}function vC(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 bC(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vC(Object(r),!0).forEach(function(n){Cx(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function aW(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function oW(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,AI(n.key),n)}}function sW(t,e,r){return e&&oW(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function lW(t,e,r){return e=hh(e),cW(t,EI()?Reflect.construct(e,r||[],hh(t).constructor):e.apply(t,r))}function cW(t,e){if(e&&(Vs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uW(t)}function uW(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function EI(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(EI=function(){return!!t})()}function hh(t){return hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},hh(t)}function dW(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tx(t,e)}function Tx(t,e){return Tx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Tx(t,e)}function Cx(t,e,r){return e=AI(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function AI(t){var e=fW(t,"string");return Vs(e)=="symbol"?e:e+""}function fW(t,e){if(Vs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Vs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var xC=1,hW=(function(t){function e(){var r;aW(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=lW(this,e,[].concat(i)),Cx(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),Cx(r,"handleKeyDown",function(o){if(o.key==="Escape"){var c,u,d,p;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(c=(u=r.props.coordinate)===null||u===void 0?void 0:u.x)!==null&&c!==void 0?c:0,y:(d=(p=r.props.coordinate)===null||p===void 0?void 0:p.y)!==null&&d!==void 0?d:0}})}}),r}return dW(e,t),sW(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>xC||Math.abs(n.height-this.state.lastBoundingBox.height)>xC)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,c=i.animationDuration,u=i.animationEasing,d=i.children,p=i.coordinate,f=i.hasPayload,m=i.isAnimationActive,v=i.offset,b=i.position,w=i.reverseDirection,x=i.useTranslate3d,k=i.viewBox,S=i.wrapperStyle,A=iW({allowEscapeViewBox:o,coordinate:p,offsetTopLeft:v,position:b,reverseDirection:w,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:k}),C=A.cssClasses,T=A.cssProperties,O=bC(bC({transition:m&&a?"transform ".concat(c,"ms ").concat(u):void 0},T),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&f?"visible":"hidden",position:"absolute",top:0,left:0},S);return M.createElement("div",{tabIndex:-1,className:C,style:O,ref:function(R){n.wrapperNode=R}},d)}}])})(j.PureComponent),pW=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Sl={isSsr:pW()};function Xs(t){"@babel/helpers - typeof";return Xs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xs(t)}function wC(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 _C(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wC(Object(r),!0).forEach(function(n){j1(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function mW(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gW(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,TI(n.key),n)}}function yW(t,e,r){return e&&gW(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function vW(t,e,r){return e=ph(e),bW(t,OI()?Reflect.construct(e,r||[],ph(t).constructor):e.apply(t,r))}function bW(t,e){if(e&&(Xs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xW(t)}function xW(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OI(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OI=function(){return!!t})()}function ph(t){return ph=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ph(t)}function wW(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jx(t,e)}function jx(t,e){return jx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},jx(t,e)}function j1(t,e,r){return e=TI(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function TI(t){var e=_W(t,"string");return Xs(e)=="symbol"?e:e+""}function _W(t,e){if(Xs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Xs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function SW(t){return t.dataKey}function kW(t,e){return M.isValidElement(t)?M.cloneElement(t,e):typeof t=="function"?M.createElement(t,e):M.createElement(ZH,e)}var ln=(function(t){function e(){return mW(this,e),vW(this,e,arguments)}return wW(e,t),yW(e,[{key:"render",value:function(){var n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,c=i.animationDuration,u=i.animationEasing,d=i.content,p=i.coordinate,f=i.filterNull,m=i.isAnimationActive,v=i.offset,b=i.payload,w=i.payloadUniqBy,x=i.position,k=i.reverseDirection,S=i.useTranslate3d,A=i.viewBox,C=i.wrapperStyle,T=b??[];f&&T.length&&(T=vI(b.filter(function(N){return N.value!=null&&(N.hide!==!0||n.props.includeHidden)}),w,SW));var O=T.length>0;return M.createElement(hW,{allowEscapeViewBox:o,animationDuration:c,animationEasing:u,isAnimationActive:m,active:a,coordinate:p,hasPayload:O,offset:v,position:x,reverseDirection:k,useTranslate3d:S,viewBox:A,wrapperStyle:C},kW(d,_C(_C({},this.props),{},{payload:T})))}}])})(j.PureComponent);j1(ln,"displayName","Tooltip");j1(ln,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Sl.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var W0,SC;function EW(){if(SC)return W0;SC=1;var t=Ai(),e=function(){return t.Date.now()};return W0=e,W0}var K0,kC;function AW(){if(kC)return K0;kC=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return K0=e,K0}var G0,EC;function OW(){if(EC)return G0;EC=1;var t=AW(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return G0=r,G0}var V0,AC;function CI(){if(AC)return V0;AC=1;var t=OW(),e=Wa(),r=xl(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,c=parseInt;function u(d){if(typeof d=="number")return d;if(r(d))return n;if(e(d)){var p=typeof d.valueOf=="function"?d.valueOf():d;d=e(p)?p+"":p}if(typeof d!="string")return d===0?d:+d;d=t(d);var f=a.test(d);return f||o.test(d)?c(d.slice(2),f?2:8):i.test(d)?n:+d}return V0=u,V0}var X0,OC;function TW(){if(OC)return X0;OC=1;var t=Wa(),e=EW(),r=CI(),n="Expected a function",i=Math.max,a=Math.min;function o(c,u,d){var p,f,m,v,b,w,x=0,k=!1,S=!1,A=!0;if(typeof c!="function")throw new TypeError(n);u=r(u)||0,t(d)&&(k=!!d.leading,S="maxWait"in d,m=S?i(r(d.maxWait)||0,u):m,A="trailing"in d?!!d.trailing:A);function C(F){var X=p,Y=f;return p=f=void 0,x=F,v=c.apply(Y,X),v}function T(F){return x=F,b=setTimeout(R,u),k?C(F):v}function O(F){var X=F-w,Y=F-x,G=u-X;return S?a(G,m-Y):G}function N(F){var X=F-w,Y=F-x;return w===void 0||X>=u||X<0||S&&Y>=m}function R(){var F=e();if(N(F))return $(F);b=setTimeout(R,O(F))}function $(F){return b=void 0,A&&p?C(F):(p=f=void 0,v)}function K(){b!==void 0&&clearTimeout(b),x=0,p=w=f=b=void 0}function z(){return b===void 0?v:$(e())}function U(){var F=e(),X=N(F);if(p=arguments,f=this,w=F,X){if(b===void 0)return T(w);if(S)return clearTimeout(b),b=setTimeout(R,u),C(w)}return b===void 0&&(b=setTimeout(R,u)),v}return U.cancel=K,U.flush=z,U}return X0=o,X0}var Y0,TC;function CW(){if(TC)return Y0;TC=1;var t=TW(),e=Wa(),r="Expected a function";function n(i,a,o){var c=!0,u=!0;if(typeof i!="function")throw new TypeError(r);return e(o)&&(c="leading"in o?!!o.leading:c,u="trailing"in o?!!o.trailing:u),t(i,a,{leading:c,maxWait:a,trailing:u})}return Y0=n,Y0}var jW=CW();const jI=vt(jW);function eu(t){"@babel/helpers - typeof";return eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eu(t)}function CC(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 xf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?CC(Object(r),!0).forEach(function(n){NW(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function NW(t,e,r){return e=PW(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function PW(t){var e=RW(t,"string");return eu(e)=="symbol"?e:e+""}function RW(t,e){if(eu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(eu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function IW(t,e){return LW(t)||DW(t,e)||MW(t,e)||$W()}function $W(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
462
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
460
|
+
A`).concat(o,",").concat(o,",0,1,1,").concat(c,",").concat(a),className:"recharts-legend-icon"});if(n.type==="rect")return M.createElement("path",{stroke:"none",fill:u,d:"M0,".concat(kn/8,"h").concat(kn,"v").concat(kn*3/4,"h").concat(-kn,"z"),className:"recharts-legend-icon"});if(M.isValidElement(n.legendIcon)){var d=u7({},n);return delete d.legendIcon,M.cloneElement(n.legendIcon,d)}return M.createElement(w1,{fill:u,cx:a,cy:a,size:kn,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,i=this.props,a=i.payload,o=i.iconSize,c=i.layout,u=i.formatter,d=i.inactiveColor,p={x:0,y:0,width:kn,height:kn},f={display:c==="horizontal"?"inline-block":"block",marginRight:10},m={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(v,b){var w=v.formatter||u,x=ot(Jc(Jc({"recharts-legend-item":!0},"legend-item-".concat(b),!0),"inactive",v.inactive));if(v.type==="none")return null;var k=Je(v.value)?null:v.value;Vi(!Je(v.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var S=v.inactive?d:v.color;return M.createElement("li",kx({className:x,style:f,key:"legend-item-".concat(b)},ah(n.props,v,b)),M.createElement(yx,{width:o,height:o,viewBox:p,style:m},n.renderIcon(v)),M.createElement("span",{className:"recharts-legend-item-text",style:{color:S}},w?w(k,v,b):k))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var c={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return M.createElement("ul",{className:"recharts-default-legend",style:c},this.renderItems())}}])})(j.PureComponent);Jc(_1,"displayName","Legend");Jc(_1,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var ov,EO;function b7(){if(EO)return ov;EO=1;var t=vp();function e(){this.__data__=new t,this.size=0}return ov=e,ov}var sv,AO;function x7(){if(AO)return sv;AO=1;function t(e){var r=this.__data__,n=r.delete(e);return this.size=r.size,n}return sv=t,sv}var lv,OO;function w7(){if(OO)return lv;OO=1;function t(e){return this.__data__.get(e)}return lv=t,lv}var cv,TO;function _7(){if(TO)return cv;TO=1;function t(e){return this.__data__.has(e)}return cv=t,cv}var uv,CO;function S7(){if(CO)return uv;CO=1;var t=vp(),e=f1(),r=h1(),n=200;function i(a,o){var c=this.__data__;if(c instanceof t){var u=c.__data__;if(!e||u.length<n-1)return u.push([a,o]),this.size=++c.size,this;c=this.__data__=new r(u)}return c.set(a,o),this.size=c.size,this}return uv=i,uv}var dv,jO;function iI(){if(jO)return dv;jO=1;var t=vp(),e=b7(),r=x7(),n=w7(),i=_7(),a=S7();function o(c){var u=this.__data__=new t(c);this.size=u.size}return o.prototype.clear=e,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=i,o.prototype.set=a,dv=o,dv}var fv,NO;function k7(){if(NO)return fv;NO=1;var t="__lodash_hash_undefined__";function e(r){return this.__data__.set(r,t),this}return fv=e,fv}var hv,PO;function E7(){if(PO)return hv;PO=1;function t(e){return this.__data__.has(e)}return hv=t,hv}var pv,RO;function aI(){if(RO)return pv;RO=1;var t=h1(),e=k7(),r=E7();function n(i){var a=-1,o=i==null?0:i.length;for(this.__data__=new t;++a<o;)this.add(i[a])}return n.prototype.add=n.prototype.push=e,n.prototype.has=r,pv=n,pv}var mv,IO;function oI(){if(IO)return mv;IO=1;function t(e,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(e[n],n,e))return!0;return!1}return mv=t,mv}var gv,$O;function sI(){if($O)return gv;$O=1;function t(e,r){return e.has(r)}return gv=t,gv}var yv,MO;function lI(){if(MO)return yv;MO=1;var t=aI(),e=oI(),r=sI(),n=1,i=2;function a(o,c,u,d,p,f){var m=u&n,v=o.length,b=c.length;if(v!=b&&!(m&&b>v))return!1;var w=f.get(o),x=f.get(c);if(w&&x)return w==c&&x==o;var k=-1,S=!0,A=u&i?new t:void 0;for(f.set(o,c),f.set(c,o);++k<v;){var C=o[k],T=c[k];if(d)var O=m?d(T,C,k,c,o,f):d(C,T,k,o,c,f);if(O!==void 0){if(O)continue;S=!1;break}if(A){if(!e(c,function(N,R){if(!r(A,R)&&(C===N||p(C,N,u,d,f)))return A.push(R)})){S=!1;break}}else if(!(C===T||p(C,T,u,d,f))){S=!1;break}}return f.delete(o),f.delete(c),S}return yv=a,yv}var vv,DO;function A7(){if(DO)return vv;DO=1;var t=Ai(),e=t.Uint8Array;return vv=e,vv}var bv,LO;function O7(){if(LO)return bv;LO=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(i,a){n[++r]=[a,i]}),n}return bv=t,bv}var xv,zO;function S1(){if(zO)return xv;zO=1;function t(e){var r=-1,n=Array(e.size);return e.forEach(function(i){n[++r]=i}),n}return xv=t,xv}var wv,BO;function T7(){if(BO)return wv;BO=1;var t=Du(),e=A7(),r=d1(),n=lI(),i=O7(),a=S1(),o=1,c=2,u="[object Boolean]",d="[object Date]",p="[object Error]",f="[object Map]",m="[object Number]",v="[object RegExp]",b="[object Set]",w="[object String]",x="[object Symbol]",k="[object ArrayBuffer]",S="[object DataView]",A=t?t.prototype:void 0,C=A?A.valueOf:void 0;function T(O,N,R,$,K,z,U){switch(R){case S:if(O.byteLength!=N.byteLength||O.byteOffset!=N.byteOffset)return!1;O=O.buffer,N=N.buffer;case k:return!(O.byteLength!=N.byteLength||!z(new e(O),new e(N)));case u:case d:case m:return r(+O,+N);case p:return O.name==N.name&&O.message==N.message;case v:case w:return O==N+"";case f:var F=i;case b:var X=$&o;if(F||(F=a),O.size!=N.size&&!X)return!1;var Y=U.get(O);if(Y)return Y==N;$|=c,U.set(O,N);var G=n(F(O),F(N),$,K,z,U);return U.delete(O),G;case x:if(C)return C.call(O)==C.call(N)}return!1}return wv=T,wv}var _v,UO;function cI(){if(UO)return _v;UO=1;function t(e,r){for(var n=-1,i=r.length,a=e.length;++n<i;)e[a+n]=r[n];return e}return _v=t,_v}var Sv,qO;function C7(){if(qO)return Sv;qO=1;var t=cI(),e=Qr();function r(n,i,a){var o=i(n);return e(n)?o:t(o,a(n))}return Sv=r,Sv}var kv,FO;function j7(){if(FO)return kv;FO=1;function t(e,r){for(var n=-1,i=e==null?0:e.length,a=0,o=[];++n<i;){var c=e[n];r(c,n,e)&&(o[a++]=c)}return o}return kv=t,kv}var Ev,HO;function N7(){if(HO)return Ev;HO=1;function t(){return[]}return Ev=t,Ev}var Av,WO;function P7(){if(WO)return Av;WO=1;var t=j7(),e=N7(),r=Object.prototype,n=r.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(o){return o==null?[]:(o=Object(o),t(i(o),function(c){return n.call(o,c)}))}:e;return Av=a,Av}var Ov,KO;function R7(){if(KO)return Ov;KO=1;function t(e,r){for(var n=-1,i=Array(e);++n<e;)i[n]=r(n);return i}return Ov=t,Ov}var Tv,GO;function I7(){if(GO)return Tv;GO=1;var t=ra(),e=na(),r="[object Arguments]";function n(i){return e(i)&&t(i)==r}return Tv=n,Tv}var Cv,VO;function k1(){if(VO)return Cv;VO=1;var t=I7(),e=na(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,a=t((function(){return arguments})())?t:function(o){return e(o)&&n.call(o,"callee")&&!i.call(o,"callee")};return Cv=a,Cv}var jc={exports:{}},jv,XO;function $7(){if(XO)return jv;XO=1;function t(){return!1}return jv=t,jv}jc.exports;var YO;function uI(){return YO||(YO=1,(function(t,e){var r=Ai(),n=$7(),i=e&&!e.nodeType&&e,a=i&&!0&&t&&!t.nodeType&&t,o=a&&a.exports===i,c=o?r.Buffer:void 0,u=c?c.isBuffer:void 0,d=u||n;t.exports=d})(jc,jc.exports)),jc.exports}var Nv,JO;function E1(){if(JO)return Nv;JO=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(n,i){var a=typeof n;return i=i??t,!!i&&(a=="number"||a!="symbol"&&e.test(n))&&n>-1&&n%1==0&&n<i}return Nv=r,Nv}var Pv,ZO;function A1(){if(ZO)return Pv;ZO=1;var t=9007199254740991;function e(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=t}return Pv=e,Pv}var Rv,QO;function M7(){if(QO)return Rv;QO=1;var t=ra(),e=A1(),r=na(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",c="[object Error]",u="[object Function]",d="[object Map]",p="[object Number]",f="[object Object]",m="[object RegExp]",v="[object Set]",b="[object String]",w="[object WeakMap]",x="[object ArrayBuffer]",k="[object DataView]",S="[object Float32Array]",A="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",O="[object Int32Array]",N="[object Uint8Array]",R="[object Uint8ClampedArray]",$="[object Uint16Array]",K="[object Uint32Array]",z={};z[S]=z[A]=z[C]=z[T]=z[O]=z[N]=z[R]=z[$]=z[K]=!0,z[n]=z[i]=z[x]=z[a]=z[k]=z[o]=z[c]=z[u]=z[d]=z[p]=z[f]=z[m]=z[v]=z[b]=z[w]=!1;function U(F){return r(F)&&e(F.length)&&!!z[t(F)]}return Rv=U,Rv}var Iv,eT;function dI(){if(eT)return Iv;eT=1;function t(e){return function(r){return e(r)}}return Iv=t,Iv}var Nc={exports:{}};Nc.exports;var tT;function D7(){return tT||(tT=1,(function(t,e){var r=NR(),n=e&&!e.nodeType&&e,i=n&&!0&&t&&!t.nodeType&&t,a=i&&i.exports===n,o=a&&r.process,c=(function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}})();t.exports=c})(Nc,Nc.exports)),Nc.exports}var $v,rT;function fI(){if(rT)return $v;rT=1;var t=M7(),e=dI(),r=D7(),n=r&&r.isTypedArray,i=n?e(n):t;return $v=i,$v}var Mv,nT;function L7(){if(nT)return Mv;nT=1;var t=R7(),e=k1(),r=Qr(),n=uI(),i=E1(),a=fI(),o=Object.prototype,c=o.hasOwnProperty;function u(d,p){var f=r(d),m=!f&&e(d),v=!f&&!m&&n(d),b=!f&&!m&&!v&&a(d),w=f||m||v||b,x=w?t(d.length,String):[],k=x.length;for(var S in d)(p||c.call(d,S))&&!(w&&(S=="length"||v&&(S=="offset"||S=="parent")||b&&(S=="buffer"||S=="byteLength"||S=="byteOffset")||i(S,k)))&&x.push(S);return x}return Mv=u,Mv}var Dv,iT;function z7(){if(iT)return Dv;iT=1;var t=Object.prototype;function e(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||t;return r===i}return Dv=e,Dv}var Lv,aT;function hI(){if(aT)return Lv;aT=1;function t(e,r){return function(n){return e(r(n))}}return Lv=t,Lv}var zv,oT;function B7(){if(oT)return zv;oT=1;var t=hI(),e=t(Object.keys,Object);return zv=e,zv}var Bv,sT;function U7(){if(sT)return Bv;sT=1;var t=z7(),e=B7(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!t(a))return e(a);var o=[];for(var c in Object(a))n.call(a,c)&&c!="constructor"&&o.push(c);return o}return Bv=i,Bv}var Uv,lT;function Bu(){if(lT)return Uv;lT=1;var t=u1(),e=A1();function r(n){return n!=null&&e(n.length)&&!t(n)}return Uv=r,Uv}var qv,cT;function Ep(){if(cT)return qv;cT=1;var t=L7(),e=U7(),r=Bu();function n(i){return r(i)?t(i):e(i)}return qv=n,qv}var Fv,uT;function q7(){if(uT)return Fv;uT=1;var t=C7(),e=P7(),r=Ep();function n(i){return t(i,r,e)}return Fv=n,Fv}var Hv,dT;function F7(){if(dT)return Hv;dT=1;var t=q7(),e=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,c,u,d,p){var f=c&e,m=t(a),v=m.length,b=t(o),w=b.length;if(v!=w&&!f)return!1;for(var x=v;x--;){var k=m[x];if(!(f?k in o:n.call(o,k)))return!1}var S=p.get(a),A=p.get(o);if(S&&A)return S==o&&A==a;var C=!0;p.set(a,o),p.set(o,a);for(var T=f;++x<v;){k=m[x];var O=a[k],N=o[k];if(u)var R=f?u(N,O,k,o,a,p):u(O,N,k,a,o,p);if(!(R===void 0?O===N||d(O,N,c,u,p):R)){C=!1;break}T||(T=k=="constructor")}if(C&&!T){var $=a.constructor,K=o.constructor;$!=K&&"constructor"in a&&"constructor"in o&&!(typeof $=="function"&&$ instanceof $&&typeof K=="function"&&K instanceof K)&&(C=!1)}return p.delete(a),p.delete(o),C}return Hv=i,Hv}var Wv,fT;function H7(){if(fT)return Wv;fT=1;var t=Uo(),e=Ai(),r=t(e,"DataView");return Wv=r,Wv}var Kv,hT;function W7(){if(hT)return Kv;hT=1;var t=Uo(),e=Ai(),r=t(e,"Promise");return Kv=r,Kv}var Gv,pT;function pI(){if(pT)return Gv;pT=1;var t=Uo(),e=Ai(),r=t(e,"Set");return Gv=r,Gv}var Vv,mT;function K7(){if(mT)return Vv;mT=1;var t=Uo(),e=Ai(),r=t(e,"WeakMap");return Vv=r,Vv}var Xv,gT;function G7(){if(gT)return Xv;gT=1;var t=H7(),e=f1(),r=W7(),n=pI(),i=K7(),a=ra(),o=PR(),c="[object Map]",u="[object Object]",d="[object Promise]",p="[object Set]",f="[object WeakMap]",m="[object DataView]",v=o(t),b=o(e),w=o(r),x=o(n),k=o(i),S=a;return(t&&S(new t(new ArrayBuffer(1)))!=m||e&&S(new e)!=c||r&&S(r.resolve())!=d||n&&S(new n)!=p||i&&S(new i)!=f)&&(S=function(A){var C=a(A),T=C==u?A.constructor:void 0,O=T?o(T):"";if(O)switch(O){case v:return m;case b:return c;case w:return d;case x:return p;case k:return f}return C}),Xv=S,Xv}var Yv,yT;function V7(){if(yT)return Yv;yT=1;var t=iI(),e=lI(),r=T7(),n=F7(),i=G7(),a=Qr(),o=uI(),c=fI(),u=1,d="[object Arguments]",p="[object Array]",f="[object Object]",m=Object.prototype,v=m.hasOwnProperty;function b(w,x,k,S,A,C){var T=a(w),O=a(x),N=T?p:i(w),R=O?p:i(x);N=N==d?f:N,R=R==d?f:R;var $=N==f,K=R==f,z=N==R;if(z&&o(w)){if(!o(x))return!1;T=!0,$=!1}if(z&&!$)return C||(C=new t),T||c(w)?e(w,x,k,S,A,C):r(w,x,N,k,S,A,C);if(!(k&u)){var U=$&&v.call(w,"__wrapped__"),F=K&&v.call(x,"__wrapped__");if(U||F){var X=U?w.value():w,Y=F?x.value():x;return C||(C=new t),A(X,Y,k,S,C)}}return z?(C||(C=new t),n(w,x,k,S,A,C)):!1}return Yv=b,Yv}var Jv,vT;function O1(){if(vT)return Jv;vT=1;var t=V7(),e=na();function r(n,i,a,o,c){return n===i?!0:n==null||i==null||!e(n)&&!e(i)?n!==n&&i!==i:t(n,i,a,o,r,c)}return Jv=r,Jv}var Zv,bT;function X7(){if(bT)return Zv;bT=1;var t=iI(),e=O1(),r=1,n=2;function i(a,o,c,u){var d=c.length,p=d,f=!u;if(a==null)return!p;for(a=Object(a);d--;){var m=c[d];if(f&&m[2]?m[1]!==a[m[0]]:!(m[0]in a))return!1}for(;++d<p;){m=c[d];var v=m[0],b=a[v],w=m[1];if(f&&m[2]){if(b===void 0&&!(v in a))return!1}else{var x=new t;if(u)var k=u(b,w,v,a,o,x);if(!(k===void 0?e(w,b,r|n,u,x):k))return!1}}return!0}return Zv=i,Zv}var Qv,xT;function mI(){if(xT)return Qv;xT=1;var t=Wa();function e(r){return r===r&&!t(r)}return Qv=e,Qv}var e0,wT;function Y7(){if(wT)return e0;wT=1;var t=mI(),e=Ep();function r(n){for(var i=e(n),a=i.length;a--;){var o=i[a],c=n[o];i[a]=[o,c,t(c)]}return i}return e0=r,e0}var t0,_T;function gI(){if(_T)return t0;_T=1;function t(e,r){return function(n){return n==null?!1:n[e]===r&&(r!==void 0||e in Object(n))}}return t0=t,t0}var r0,ST;function J7(){if(ST)return r0;ST=1;var t=X7(),e=Y7(),r=gI();function n(i){var a=e(i);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(o){return o===i||t(o,i,a)}}return r0=n,r0}var n0,kT;function Z7(){if(kT)return n0;kT=1;function t(e,r){return e!=null&&r in Object(e)}return n0=t,n0}var i0,ET;function Q7(){if(ET)return i0;ET=1;var t=$R(),e=k1(),r=Qr(),n=E1(),i=A1(),a=xp();function o(c,u,d){u=t(u,c);for(var p=-1,f=u.length,m=!1;++p<f;){var v=a(u[p]);if(!(m=c!=null&&d(c,v)))break;c=c[v]}return m||++p!=f?m:(f=c==null?0:c.length,!!f&&i(f)&&n(v,f)&&(r(c)||e(c)))}return i0=o,i0}var a0,AT;function eH(){if(AT)return a0;AT=1;var t=Z7(),e=Q7();function r(n,i){return n!=null&&e(n,i,t)}return a0=r,a0}var o0,OT;function tH(){if(OT)return o0;OT=1;var t=O1(),e=MR(),r=eH(),n=c1(),i=mI(),a=gI(),o=xp(),c=1,u=2;function d(p,f){return n(p)&&i(f)?a(o(p),f):function(m){var v=e(m,p);return v===void 0&&v===f?r(m,p):t(f,v,c|u)}}return o0=d,o0}var s0,TT;function _l(){if(TT)return s0;TT=1;function t(e){return e}return s0=t,s0}var l0,CT;function rH(){if(CT)return l0;CT=1;function t(e){return function(r){return r==null?void 0:r[e]}}return l0=t,l0}var c0,jT;function nH(){if(jT)return c0;jT=1;var t=m1();function e(r){return function(n){return t(n,r)}}return c0=e,c0}var u0,NT;function iH(){if(NT)return u0;NT=1;var t=rH(),e=nH(),r=c1(),n=xp();function i(a){return r(a)?t(n(a)):e(a)}return u0=i,u0}var d0,PT;function Ka(){if(PT)return d0;PT=1;var t=J7(),e=tH(),r=_l(),n=Qr(),i=iH();function a(o){return typeof o=="function"?o:o==null?r:typeof o=="object"?n(o)?e(o[0],o[1]):t(o):i(o)}return d0=a,d0}var f0,RT;function yI(){if(RT)return f0;RT=1;function t(e,r,n,i){for(var a=e.length,o=n+(i?1:-1);i?o--:++o<a;)if(r(e[o],o,e))return o;return-1}return f0=t,f0}var h0,IT;function aH(){if(IT)return h0;IT=1;function t(e){return e!==e}return h0=t,h0}var p0,$T;function oH(){if($T)return p0;$T=1;function t(e,r,n){for(var i=n-1,a=e.length;++i<a;)if(e[i]===r)return i;return-1}return p0=t,p0}var m0,MT;function sH(){if(MT)return m0;MT=1;var t=yI(),e=aH(),r=oH();function n(i,a,o){return a===a?r(i,a,o):t(i,e,o)}return m0=n,m0}var g0,DT;function lH(){if(DT)return g0;DT=1;var t=sH();function e(r,n){var i=r==null?0:r.length;return!!i&&t(r,n,0)>-1}return g0=e,g0}var y0,LT;function cH(){if(LT)return y0;LT=1;function t(e,r,n){for(var i=-1,a=e==null?0:e.length;++i<a;)if(n(r,e[i]))return!0;return!1}return y0=t,y0}var v0,zT;function uH(){if(zT)return v0;zT=1;function t(){}return v0=t,v0}var b0,BT;function dH(){if(BT)return b0;BT=1;var t=pI(),e=uH(),r=S1(),n=1/0,i=t&&1/r(new t([,-0]))[1]==n?function(a){return new t(a)}:e;return b0=i,b0}var x0,UT;function fH(){if(UT)return x0;UT=1;var t=aI(),e=lH(),r=cH(),n=sI(),i=dH(),a=S1(),o=200;function c(u,d,p){var f=-1,m=e,v=u.length,b=!0,w=[],x=w;if(p)b=!1,m=r;else if(v>=o){var k=d?null:i(u);if(k)return a(k);b=!1,m=n,x=new t}else x=d?[]:w;e:for(;++f<v;){var S=u[f],A=d?d(S):S;if(S=p||S!==0?S:0,b&&A===A){for(var C=x.length;C--;)if(x[C]===A)continue e;d&&x.push(A),w.push(S)}else m(x,A,p)||(x!==w&&x.push(A),w.push(S))}return w}return x0=c,x0}var w0,qT;function hH(){if(qT)return w0;qT=1;var t=Ka(),e=fH();function r(n,i){return n&&n.length?e(n,t(i,2)):[]}return w0=r,w0}var pH=hH();const FT=vt(pH);function vI(t,e,r){return e===!0?FT(t,r):Je(e)?FT(t,e):t}function Gs(t){"@babel/helpers - typeof";return Gs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gs(t)}var mH=["ref"];function HT(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 Bi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?HT(Object(r),!0).forEach(function(n){Ap(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):HT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function WT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xI(n.key),n)}}function yH(t,e,r){return e&&WT(t.prototype,e),r&&WT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function vH(t,e,r){return e=fh(e),bH(t,bI()?Reflect.construct(e,r||[],fh(t).constructor):e.apply(t,r))}function bH(t,e){if(e&&(Gs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xH(t)}function xH(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bI(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bI=function(){return!!t})()}function fh(t){return fh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fh(t)}function wH(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ax(t,e)}function Ax(t,e){return Ax=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ax(t,e)}function Ap(t,e,r){return e=xI(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xI(t){var e=_H(t,"string");return Gs(e)=="symbol"?e:e+""}function _H(t,e){if(Gs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Gs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function SH(t,e){if(t==null)return{};var r=kH(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function kH(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function EH(t){return t.value}function AH(t,e){if(M.isValidElement(t))return M.cloneElement(t,e);if(typeof t=="function")return M.createElement(t,e);e.ref;var r=SH(e,mH);return M.createElement(_1,r)}var KT=1,Bs=(function(t){function e(){var r;gH(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=vH(this,e,[].concat(i)),Ap(r,"lastBoundingBox",{width:-1,height:-1}),r}return wH(e,t),yH(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>KT||Math.abs(i.height-this.lastBoundingBox.height)>KT)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Bi({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,c=i.verticalAlign,u=i.margin,d=i.chartWidth,p=i.chartHeight,f,m;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var v=this.getBBoxSnapshot();f={left:((d||0)-v.width)/2}}else f=o==="right"?{right:u&&u.right||0}:{left:u&&u.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(c==="middle"){var b=this.getBBoxSnapshot();m={top:((p||0)-b.height)/2}}else m=c==="bottom"?{bottom:u&&u.bottom||0}:{top:u&&u.top||0};return Bi(Bi({},f),m)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,c=i.height,u=i.wrapperStyle,d=i.payloadUniqBy,p=i.payload,f=Bi(Bi({position:"absolute",width:o||"auto",height:c||"auto"},this.getDefaultPosition(u)),u);return M.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(v){n.wrapperNode=v}},AH(a,Bi(Bi({},this.props),{},{payload:vI(p,d,EH)})))}}],[{key:"getWithHeight",value:function(n,i){var a=Bi(Bi({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&ge(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(j.PureComponent);Ap(Bs,"displayName","Legend");Ap(Bs,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var _0,GT;function OH(){if(GT)return _0;GT=1;var t=Du(),e=k1(),r=Qr(),n=t?t.isConcatSpreadable:void 0;function i(a){return r(a)||e(a)||!!(n&&a&&a[n])}return _0=i,_0}var S0,VT;function wI(){if(VT)return S0;VT=1;var t=cI(),e=OH();function r(n,i,a,o,c){var u=-1,d=n.length;for(a||(a=e),c||(c=[]);++u<d;){var p=n[u];i>0&&a(p)?i>1?r(p,i-1,a,o,c):t(c,p):o||(c[c.length]=p)}return c}return S0=r,S0}var k0,XT;function TH(){if(XT)return k0;XT=1;function t(e){return function(r,n,i){for(var a=-1,o=Object(r),c=i(r),u=c.length;u--;){var d=c[e?u:++a];if(n(o[d],d,o)===!1)break}return r}}return k0=t,k0}var E0,YT;function CH(){if(YT)return E0;YT=1;var t=TH(),e=t();return E0=e,E0}var A0,JT;function _I(){if(JT)return A0;JT=1;var t=CH(),e=Ep();function r(n,i){return n&&t(n,i,e)}return A0=r,A0}var O0,ZT;function jH(){if(ZT)return O0;ZT=1;var t=Bu();function e(r,n){return function(i,a){if(i==null)return i;if(!t(i))return r(i,a);for(var o=i.length,c=n?o:-1,u=Object(i);(n?c--:++c<o)&&a(u[c],c,u)!==!1;);return i}}return O0=e,O0}var T0,QT;function T1(){if(QT)return T0;QT=1;var t=_I(),e=jH(),r=e(t);return T0=r,T0}var C0,eC;function SI(){if(eC)return C0;eC=1;var t=T1(),e=Bu();function r(n,i){var a=-1,o=e(n)?Array(n.length):[];return t(n,function(c,u,d){o[++a]=i(c,u,d)}),o}return C0=r,C0}var j0,tC;function NH(){if(tC)return j0;tC=1;function t(e,r){var n=e.length;for(e.sort(r);n--;)e[n]=e[n].value;return e}return j0=t,j0}var N0,rC;function PH(){if(rC)return N0;rC=1;var t=xl();function e(r,n){if(r!==n){var i=r!==void 0,a=r===null,o=r===r,c=t(r),u=n!==void 0,d=n===null,p=n===n,f=t(n);if(!d&&!f&&!c&&r>n||c&&u&&p&&!d&&!f||a&&u&&p||!i&&p||!o)return 1;if(!a&&!c&&!f&&r<n||f&&i&&o&&!a&&!c||d&&i&&o||!u&&o||!p)return-1}return 0}return N0=e,N0}var P0,nC;function RH(){if(nC)return P0;nC=1;var t=PH();function e(r,n,i){for(var a=-1,o=r.criteria,c=n.criteria,u=o.length,d=i.length;++a<u;){var p=t(o[a],c[a]);if(p){if(a>=d)return p;var f=i[a];return p*(f=="desc"?-1:1)}}return r.index-n.index}return P0=e,P0}var R0,iC;function IH(){if(iC)return R0;iC=1;var t=p1(),e=m1(),r=Ka(),n=SI(),i=NH(),a=dI(),o=RH(),c=_l(),u=Qr();function d(p,f,m){f.length?f=t(f,function(w){return u(w)?function(x){return e(x,w.length===1?w[0]:w)}:w}):f=[c];var v=-1;f=t(f,a(r));var b=n(p,function(w,x,k){var S=t(f,function(A){return A(w)});return{criteria:S,index:++v,value:w}});return i(b,function(w,x){return o(w,x,m)})}return R0=d,R0}var I0,aC;function $H(){if(aC)return I0;aC=1;function t(e,r,n){switch(n.length){case 0:return e.call(r);case 1:return e.call(r,n[0]);case 2:return e.call(r,n[0],n[1]);case 3:return e.call(r,n[0],n[1],n[2])}return e.apply(r,n)}return I0=t,I0}var $0,oC;function MH(){if(oC)return $0;oC=1;var t=$H(),e=Math.max;function r(n,i,a){return i=e(i===void 0?n.length-1:i,0),function(){for(var o=arguments,c=-1,u=e(o.length-i,0),d=Array(u);++c<u;)d[c]=o[i+c];c=-1;for(var p=Array(i+1);++c<i;)p[c]=o[c];return p[i]=a(d),t(n,this,p)}}return $0=r,$0}var M0,sC;function DH(){if(sC)return M0;sC=1;function t(e){return function(){return e}}return M0=t,M0}var D0,lC;function kI(){if(lC)return D0;lC=1;var t=Uo(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return D0=e,D0}var L0,cC;function LH(){if(cC)return L0;cC=1;var t=DH(),e=kI(),r=_l(),n=e?function(i,a){return e(i,"toString",{configurable:!0,enumerable:!1,value:t(a),writable:!0})}:r;return L0=n,L0}var z0,uC;function zH(){if(uC)return z0;uC=1;var t=800,e=16,r=Date.now;function n(i){var a=0,o=0;return function(){var c=r(),u=e-(c-o);if(o=c,u>0){if(++a>=t)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return z0=n,z0}var B0,dC;function BH(){if(dC)return B0;dC=1;var t=LH(),e=zH(),r=e(t);return B0=r,B0}var U0,fC;function UH(){if(fC)return U0;fC=1;var t=_l(),e=MH(),r=BH();function n(i,a){return r(e(i,a,t),i+"")}return U0=n,U0}var q0,hC;function Op(){if(hC)return q0;hC=1;var t=d1(),e=Bu(),r=E1(),n=Wa();function i(a,o,c){if(!n(c))return!1;var u=typeof o;return(u=="number"?e(c)&&r(o,c.length):u=="string"&&o in c)?t(c[o],a):!1}return q0=i,q0}var F0,pC;function qH(){if(pC)return F0;pC=1;var t=wI(),e=IH(),r=UH(),n=Op(),i=r(function(a,o){if(a==null)return[];var c=o.length;return c>1&&n(a,o[0],o[1])?o=[]:c>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),e(a,t(o,1),[])});return F0=i,F0}var FH=qH();const C1=vt(FH);function Zc(t){"@babel/helpers - typeof";return Zc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zc(t)}function Ox(){return Ox=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ox.apply(this,arguments)}function HH(t,e){return VH(t)||GH(t,e)||KH(t,e)||WH()}function WH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
461
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KH(t,e){if(t){if(typeof t=="string")return mC(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 mC(t,e)}}function mC(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 GH(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function VH(t){if(Array.isArray(t))return t}function gC(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 H0(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gC(Object(r),!0).forEach(function(n){XH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function XH(t,e,r){return e=YH(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function YH(t){var e=JH(t,"string");return Zc(e)=="symbol"?e:e+""}function JH(t,e){if(Zc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Zc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ZH(t){return Array.isArray(t)&&sr(t[0])&&sr(t[1])?t.join(" ~ "):t}var QH=function(e){var r=e.separator,n=r===void 0?" : ":r,i=e.contentStyle,a=i===void 0?{}:i,o=e.itemStyle,c=o===void 0?{}:o,u=e.labelStyle,d=u===void 0?{}:u,p=e.payload,f=e.formatter,m=e.itemSorter,v=e.wrapperClassName,b=e.labelClassName,w=e.label,x=e.labelFormatter,k=e.accessibilityLayer,S=k===void 0?!1:k,A=function(){if(p&&p.length){var U={padding:0,margin:0},F=(m?C1(p,m):p).map(function(X,Y){if(X.type==="none")return null;var G=H0({display:"block",paddingTop:4,paddingBottom:4,color:X.color||"#000"},c),Z=X.formatter||f||ZH,W=X.value,Q=X.name,L=W,I=Q;if(Z&&L!=null&&I!=null){var q=Z(W,Q,X,Y,p);if(Array.isArray(q)){var ee=HH(q,2);L=ee[0],I=ee[1]}else L=q}return M.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(Y),style:G},sr(I)?M.createElement("span",{className:"recharts-tooltip-item-name"},I):null,sr(I)?M.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,M.createElement("span",{className:"recharts-tooltip-item-value"},L),M.createElement("span",{className:"recharts-tooltip-item-unit"},X.unit||""))});return M.createElement("ul",{className:"recharts-tooltip-item-list",style:U},F)}return null},C=H0({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},a),T=H0({margin:0},d),O=!tt(w),N=O?w:"",R=ot("recharts-default-tooltip",v),$=ot("recharts-tooltip-label",b);O&&x&&p!==void 0&&p!==null&&(N=x(w,p));var K=S?{role:"status","aria-live":"assertive"}:{};return M.createElement("div",Ox({className:R,style:C},K),M.createElement("p",{className:$,style:T},M.isValidElement(N)?N:"".concat(N)),A())};function Qc(t){"@babel/helpers - typeof";return Qc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qc(t)}function bf(t,e,r){return e=eW(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eW(t){var e=tW(t,"string");return Qc(e)=="symbol"?e:e+""}function tW(t,e){if(Qc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Qc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gc="recharts-tooltip-wrapper",rW={visibility:"hidden"};function nW(t){var e=t.coordinate,r=t.translateX,n=t.translateY;return ot(gc,bf(bf(bf(bf({},"".concat(gc,"-right"),ge(r)&&e&&ge(e.x)&&r>=e.x),"".concat(gc,"-left"),ge(r)&&e&&ge(e.x)&&r<e.x),"".concat(gc,"-bottom"),ge(n)&&e&&ge(e.y)&&n>=e.y),"".concat(gc,"-top"),ge(n)&&e&&ge(e.y)&&n<e.y))}function yC(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.key,i=t.offsetTopLeft,a=t.position,o=t.reverseDirection,c=t.tooltipDimension,u=t.viewBox,d=t.viewBoxDimension;if(a&&ge(a[n]))return a[n];var p=r[n]-c-i,f=r[n]+i;if(e[n])return o[n]?p:f;if(o[n]){var m=p,v=u[n];return m<v?Math.max(f,u[n]):Math.max(p,u[n])}var b=f+c,w=u[n]+d;return b>w?Math.max(p,u[n]):Math.max(f,u[n])}function iW(t){var e=t.translateX,r=t.translateY,n=t.useTranslate3d;return{transform:n?"translate3d(".concat(e,"px, ").concat(r,"px, 0)"):"translate(".concat(e,"px, ").concat(r,"px)")}}function aW(t){var e=t.allowEscapeViewBox,r=t.coordinate,n=t.offsetTopLeft,i=t.position,a=t.reverseDirection,o=t.tooltipBox,c=t.useTranslate3d,u=t.viewBox,d,p,f;return o.height>0&&o.width>0&&r?(p=yC({allowEscapeViewBox:e,coordinate:r,key:"x",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:u,viewBoxDimension:u.width}),f=yC({allowEscapeViewBox:e,coordinate:r,key:"y",offsetTopLeft:n,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:u,viewBoxDimension:u.height}),d=iW({translateX:p,translateY:f,useTranslate3d:c})):d=rW,{cssProperties:d,cssClasses:nW({translateX:p,translateY:f,coordinate:r})}}function Vs(t){"@babel/helpers - typeof";return Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vs(t)}function vC(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 bC(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vC(Object(r),!0).forEach(function(n){Cx(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function oW(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sW(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,AI(n.key),n)}}function lW(t,e,r){return e&&sW(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function cW(t,e,r){return e=hh(e),uW(t,EI()?Reflect.construct(e,r||[],hh(t).constructor):e.apply(t,r))}function uW(t,e){if(e&&(Vs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dW(t)}function dW(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function EI(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(EI=function(){return!!t})()}function hh(t){return hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},hh(t)}function fW(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tx(t,e)}function Tx(t,e){return Tx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Tx(t,e)}function Cx(t,e,r){return e=AI(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function AI(t){var e=hW(t,"string");return Vs(e)=="symbol"?e:e+""}function hW(t,e){if(Vs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Vs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var xC=1,pW=(function(t){function e(){var r;oW(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=cW(this,e,[].concat(i)),Cx(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),Cx(r,"handleKeyDown",function(o){if(o.key==="Escape"){var c,u,d,p;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(c=(u=r.props.coordinate)===null||u===void 0?void 0:u.x)!==null&&c!==void 0?c:0,y:(d=(p=r.props.coordinate)===null||p===void 0?void 0:p.y)!==null&&d!==void 0?d:0}})}}),r}return fW(e,t),lW(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();(Math.abs(n.width-this.state.lastBoundingBox.width)>xC||Math.abs(n.height-this.state.lastBoundingBox.height)>xC)&&this.setState({lastBoundingBox:{width:n.width,height:n.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var n,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,c=i.animationDuration,u=i.animationEasing,d=i.children,p=i.coordinate,f=i.hasPayload,m=i.isAnimationActive,v=i.offset,b=i.position,w=i.reverseDirection,x=i.useTranslate3d,k=i.viewBox,S=i.wrapperStyle,A=aW({allowEscapeViewBox:o,coordinate:p,offsetTopLeft:v,position:b,reverseDirection:w,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:k}),C=A.cssClasses,T=A.cssProperties,O=bC(bC({transition:m&&a?"transform ".concat(c,"ms ").concat(u):void 0},T),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&f?"visible":"hidden",position:"absolute",top:0,left:0},S);return M.createElement("div",{tabIndex:-1,className:C,style:O,ref:function(R){n.wrapperNode=R}},d)}}])})(j.PureComponent),mW=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Sl={isSsr:mW()};function Xs(t){"@babel/helpers - typeof";return Xs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xs(t)}function wC(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 _C(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wC(Object(r),!0).forEach(function(n){j1(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gW(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yW(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,TI(n.key),n)}}function vW(t,e,r){return e&&yW(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function bW(t,e,r){return e=ph(e),xW(t,OI()?Reflect.construct(e,r||[],ph(t).constructor):e.apply(t,r))}function xW(t,e){if(e&&(Xs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wW(t)}function wW(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OI(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OI=function(){return!!t})()}function ph(t){return ph=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ph(t)}function _W(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jx(t,e)}function jx(t,e){return jx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},jx(t,e)}function j1(t,e,r){return e=TI(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function TI(t){var e=SW(t,"string");return Xs(e)=="symbol"?e:e+""}function SW(t,e){if(Xs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Xs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function kW(t){return t.dataKey}function EW(t,e){return M.isValidElement(t)?M.cloneElement(t,e):typeof t=="function"?M.createElement(t,e):M.createElement(QH,e)}var ln=(function(t){function e(){return gW(this,e),bW(this,e,arguments)}return _W(e,t),vW(e,[{key:"render",value:function(){var n=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,c=i.animationDuration,u=i.animationEasing,d=i.content,p=i.coordinate,f=i.filterNull,m=i.isAnimationActive,v=i.offset,b=i.payload,w=i.payloadUniqBy,x=i.position,k=i.reverseDirection,S=i.useTranslate3d,A=i.viewBox,C=i.wrapperStyle,T=b??[];f&&T.length&&(T=vI(b.filter(function(N){return N.value!=null&&(N.hide!==!0||n.props.includeHidden)}),w,kW));var O=T.length>0;return M.createElement(pW,{allowEscapeViewBox:o,animationDuration:c,animationEasing:u,isAnimationActive:m,active:a,coordinate:p,hasPayload:O,offset:v,position:x,reverseDirection:k,useTranslate3d:S,viewBox:A,wrapperStyle:C},EW(d,_C(_C({},this.props),{},{payload:T})))}}])})(j.PureComponent);j1(ln,"displayName","Tooltip");j1(ln,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Sl.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var W0,SC;function AW(){if(SC)return W0;SC=1;var t=Ai(),e=function(){return t.Date.now()};return W0=e,W0}var K0,kC;function OW(){if(kC)return K0;kC=1;var t=/\s/;function e(r){for(var n=r.length;n--&&t.test(r.charAt(n)););return n}return K0=e,K0}var G0,EC;function TW(){if(EC)return G0;EC=1;var t=OW(),e=/^\s+/;function r(n){return n&&n.slice(0,t(n)+1).replace(e,"")}return G0=r,G0}var V0,AC;function CI(){if(AC)return V0;AC=1;var t=TW(),e=Wa(),r=xl(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,c=parseInt;function u(d){if(typeof d=="number")return d;if(r(d))return n;if(e(d)){var p=typeof d.valueOf=="function"?d.valueOf():d;d=e(p)?p+"":p}if(typeof d!="string")return d===0?d:+d;d=t(d);var f=a.test(d);return f||o.test(d)?c(d.slice(2),f?2:8):i.test(d)?n:+d}return V0=u,V0}var X0,OC;function CW(){if(OC)return X0;OC=1;var t=Wa(),e=AW(),r=CI(),n="Expected a function",i=Math.max,a=Math.min;function o(c,u,d){var p,f,m,v,b,w,x=0,k=!1,S=!1,A=!0;if(typeof c!="function")throw new TypeError(n);u=r(u)||0,t(d)&&(k=!!d.leading,S="maxWait"in d,m=S?i(r(d.maxWait)||0,u):m,A="trailing"in d?!!d.trailing:A);function C(F){var X=p,Y=f;return p=f=void 0,x=F,v=c.apply(Y,X),v}function T(F){return x=F,b=setTimeout(R,u),k?C(F):v}function O(F){var X=F-w,Y=F-x,G=u-X;return S?a(G,m-Y):G}function N(F){var X=F-w,Y=F-x;return w===void 0||X>=u||X<0||S&&Y>=m}function R(){var F=e();if(N(F))return $(F);b=setTimeout(R,O(F))}function $(F){return b=void 0,A&&p?C(F):(p=f=void 0,v)}function K(){b!==void 0&&clearTimeout(b),x=0,p=w=f=b=void 0}function z(){return b===void 0?v:$(e())}function U(){var F=e(),X=N(F);if(p=arguments,f=this,w=F,X){if(b===void 0)return T(w);if(S)return clearTimeout(b),b=setTimeout(R,u),C(w)}return b===void 0&&(b=setTimeout(R,u)),v}return U.cancel=K,U.flush=z,U}return X0=o,X0}var Y0,TC;function jW(){if(TC)return Y0;TC=1;var t=CW(),e=Wa(),r="Expected a function";function n(i,a,o){var c=!0,u=!0;if(typeof i!="function")throw new TypeError(r);return e(o)&&(c="leading"in o?!!o.leading:c,u="trailing"in o?!!o.trailing:u),t(i,a,{leading:c,maxWait:a,trailing:u})}return Y0=n,Y0}var NW=jW();const jI=vt(NW);function eu(t){"@babel/helpers - typeof";return eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eu(t)}function CC(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 xf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?CC(Object(r),!0).forEach(function(n){PW(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function PW(t,e,r){return e=RW(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function RW(t){var e=IW(t,"string");return eu(e)=="symbol"?e:e+""}function IW(t,e){if(eu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(eu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $W(t,e){return zW(t)||LW(t,e)||DW(t,e)||MW()}function MW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
462
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DW(t,e){if(t){if(typeof t=="string")return jC(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 jC(t,e)}}function jC(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 LW(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function zW(t){if(Array.isArray(t))return t}var mh=j.forwardRef(function(t,e){var r=t.aspect,n=t.initialDimension,i=n===void 0?{width:-1,height:-1}:n,a=t.width,o=a===void 0?"100%":a,c=t.height,u=c===void 0?"100%":c,d=t.minWidth,p=d===void 0?0:d,f=t.minHeight,m=t.maxHeight,v=t.children,b=t.debounce,w=b===void 0?0:b,x=t.id,k=t.className,S=t.onResize,A=t.style,C=A===void 0?{}:A,T=j.useRef(null),O=j.useRef();O.current=S,j.useImperativeHandle(e,function(){return Object.defineProperty(T.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),T.current},configurable:!0})});var N=j.useState({containerWidth:i.width,containerHeight:i.height}),R=$W(N,2),$=R[0],K=R[1],z=j.useCallback(function(F,X){K(function(Y){var G=Math.round(F),Z=Math.round(X);return Y.containerWidth===G&&Y.containerHeight===Z?Y:{containerWidth:G,containerHeight:Z}})},[]);j.useEffect(function(){var F=function(Q){var L,I=Q[0].contentRect,q=I.width,ee=I.height;z(q,ee),(L=O.current)===null||L===void 0||L.call(O,q,ee)};w>0&&(F=jI(F,w,{trailing:!0,leading:!1}));var X=new ResizeObserver(F),Y=T.current.getBoundingClientRect(),G=Y.width,Z=Y.height;return z(G,Z),X.observe(T.current),function(){X.disconnect()}},[z,w]);var U=j.useMemo(function(){var F=$.containerWidth,X=$.containerHeight;if(F<0||X<0)return null;Vi(Eo(o)||Eo(u),`The width(%s) and height(%s) are both fixed numbers,
|
|
463
463
|
maybe you don't need to use a ResponsiveContainer.`,o,u),Vi(!r||r>0,"The aspect(%s) must be greater than zero.",r);var Y=Eo(o)?F:o,G=Eo(u)?X:u;r&&r>0&&(Y?G=Y/r:G&&(Y=G*r),m&&G>m&&(G=m)),Vi(Y>0||G>0,`The width(%s) and height(%s) of chart should be greater than 0,
|
|
464
464
|
please check the style of container, or the props width(%s) and height(%s),
|
|
465
465
|
or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
|
|
466
|
-
height and width.`,Y,G,o,u,p,f,r);var Z=!Array.isArray(v)&&Gi(v.type).endsWith("Chart");return M.Children.map(v,function(W){return M.isValidElement(W)?j.cloneElement(W,xf({width:Y,height:G},Z?{style:xf({height:"100%",width:"100%",maxHeight:G,maxWidth:Y},W.props.style)}:{})):W})},[r,v,u,m,f,p,$,o]);return M.createElement("div",{id:x?"".concat(x):void 0,className:ot("recharts-responsive-container",k),style:xf(xf({},C),{},{width:o,height:u,minWidth:p,minHeight:f,maxHeight:m}),ref:T},U)}),NI=function(e){return null};NI.displayName="Cell";function tu(t){"@babel/helpers - typeof";return tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tu(t)}function NC(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 Nx(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?NC(Object(r),!0).forEach(function(n){
|
|
467
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
468
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dK(t,e){if(t){if(typeof t=="string")return BC(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 BC(t,e)}}function BC(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 fK(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function hK(t){if(Array.isArray(t))return t}var II=/[ \f\n\r\t\v\u2028\u2029]+/,$I=function(e){var r=e.children,n=e.breakAll,i=e.style;try{var a=[];tt(r)||(n?a=r.toString().split(""):a=r.toString().split(II));var o=a.map(function(u){return{word:u,width:Mc(u,i).width}}),c=n?0:Mc(" ",i).width;return{wordsWithComputedWidth:o,spaceWidth:c}}catch{return null}},pK=function(e,r,n,i,a){var o=e.maxLines,c=e.children,u=e.style,d=e.breakAll,p=ge(o),f=c,m=function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return Y.reduce(function(G,Z){var W=Z.word,Q=Z.width,L=G[G.length-1];if(L&&(i==null||a||L.width+Q+n<Number(i)))L.words.push(W),L.width+=Q+n;else{var I={words:[W],width:Q};G.push(I)}return G},[])},v=m(r),b=function(Y){return Y.reduce(function(G,Z){return G.width>Z.width?G:Z})};if(!p)return v;for(var w="…",x=function(Y){var G=f.slice(0,Y),Z=$I({breakAll:d,style:u,children:G+w}).wordsWithComputedWidth,W=m(Z),Q=W.length>o||b(W).width>Number(i);return[Q,W]},k=0,S=f.length-1,A=0,C;k<=S&&A<=f.length-1;){var T=Math.floor((k+S)/2),O=T-1,N=x(O),R=zC(N,2),$=R[0],K=R[1],z=x(T),U=zC(z,1),F=U[0];if(!$&&!F&&(k=T+1),$&&F&&(S=T-1),!$&&F){C=K;break}A++}return C||v},UC=function(e){var r=tt(e)?[]:e.toString().split(II);return[{words:r}]},mK=function(e){var r=e.width,n=e.scaleToFit,i=e.children,a=e.style,o=e.breakAll,c=e.maxLines;if((r||n)&&!Sl.isSsr){var u,d,p=$I({breakAll:o,children:i,style:a});if(p){var f=p.wordsWithComputedWidth,m=p.spaceWidth;u=f,d=m}else return UC(i);return pK({breakAll:o,children:i,maxLines:c,style:a},u,d,r,n)}return UC(i)},qC="#808080",yh=function(e){var r=e.x,n=r===void 0?0:r,i=e.y,a=i===void 0?0:i,o=e.lineHeight,c=o===void 0?"1em":o,u=e.capHeight,d=u===void 0?"0.71em":u,p=e.scaleToFit,f=p===void 0?!1:p,m=e.textAnchor,v=m===void 0?"start":m,b=e.verticalAnchor,w=b===void 0?"end":b,x=e.fill,k=x===void 0?qC:x,S=LC(e,sK),A=j.useMemo(function(){return mK({breakAll:S.breakAll,children:S.children,maxLines:S.maxLines,scaleToFit:f,style:S.style,width:S.width})},[S.breakAll,S.children,S.maxLines,f,S.style,S.width]),C=S.dx,T=S.dy,O=S.angle,N=S.className,R=S.breakAll,$=LC(S,lK);if(!sr(n)||!sr(a))return null;var K=n+(ge(C)?C:0),z=a+(ge(T)?T:0),U;switch(w){case"start":U=J0("calc(".concat(d,")"));break;case"middle":U=J0("calc(".concat((A.length-1)/2," * -").concat(c," + (").concat(d," / 2))"));break;default:U=J0("calc(".concat(A.length-1," * -").concat(c,")"));break}var F=[];if(f){var X=A[0].width,Y=S.width;F.push("scale(".concat((ge(Y)?Y/X:1)/X,")"))}return O&&F.push("rotate(".concat(O,", ").concat(K,", ").concat(z,")")),F.length&&($.transform=F.join(" ")),M.createElement("text",Px({},at($,!0),{x:K,y:z,className:ot("recharts-text",N),textAnchor:v,fill:k.includes("url")?qC:k}),A.map(function(G,Z){var W=G.words.join(R?"":" ");return M.createElement("tspan",{x:K,dy:Z===0?U:c,key:"".concat(W,"-").concat(Z)},W)}))};function La(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function gK(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function N1(t){let e,r,n;t.length!==2?(e=La,r=(c,u)=>La(t(c),u),n=(c,u)=>t(c)-u):(e=t===La||t===gK?t:yK,r=t,n=t);function i(c,u,d=0,p=c.length){if(d<p){if(e(u,u)!==0)return p;do{const f=d+p>>>1;r(c[f],u)<0?d=f+1:p=f}while(d<p)}return d}function a(c,u,d=0,p=c.length){if(d<p){if(e(u,u)!==0)return p;do{const f=d+p>>>1;r(c[f],u)<=0?d=f+1:p=f}while(d<p)}return d}function o(c,u,d=0,p=c.length){const f=i(c,u,d,p-1);return f>d&&n(c[f-1],u)>-n(c[f],u)?f-1:f}return{left:i,center:o,right:a}}function yK(){return 0}function MI(t){return t===null?NaN:+t}function*vK(t,e){for(let r of t)r!=null&&(r=+r)>=r&&(yield r)}const bK=N1(La),Uu=bK.right;N1(MI).center;class FC extends Map{constructor(e,r=_K){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(const[n,i]of e)this.set(n,i)}get(e){return super.get(HC(this,e))}has(e){return super.has(HC(this,e))}set(e,r){return super.set(xK(this,e),r)}delete(e){return super.delete(wK(this,e))}}function HC({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):r}function xK({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function wK({_intern:t,_key:e},r){const n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function _K(t){return t!==null&&typeof t=="object"?t.valueOf():t}function SK(t=La){if(t===La)return DI;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||n===0?n:(t(r,r)===0)-(t(e,e)===0)}}function DI(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const kK=Math.sqrt(50),EK=Math.sqrt(10),AK=Math.sqrt(2);function vh(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=kK?10:a>=EK?5:a>=AK?2:1;let c,u,d;return i<0?(d=Math.pow(10,-i)/o,c=Math.round(t*d),u=Math.round(e*d),c/d<t&&++c,u/d>e&&--u,d=-d):(d=Math.pow(10,i)*o,c=Math.round(t/d),u=Math.round(e/d),c*d<t&&++c,u*d>e&&--u),u<c&&.5<=r&&r<2?vh(t,e,r*2):[c,u,d]}function Rx(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];const n=e<t,[i,a,o]=n?vh(e,t,r):vh(t,e,r);if(!(a>=i))return[];const c=a-i+1,u=new Array(c);if(n)if(o<0)for(let d=0;d<c;++d)u[d]=(a-d)/-o;else for(let d=0;d<c;++d)u[d]=(a-d)*o;else if(o<0)for(let d=0;d<c;++d)u[d]=(i+d)/-o;else for(let d=0;d<c;++d)u[d]=(i+d)*o;return u}function Ix(t,e,r){return e=+e,t=+t,r=+r,vh(t,e,r)[2]}function $x(t,e,r){e=+e,t=+t,r=+r;const n=e<t,i=n?Ix(e,t,r):Ix(t,e,r);return(n?-1:1)*(i<0?1/-i:i)}function WC(t,e){let r;for(const n of t)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function KC(t,e){let r;for(const n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function LI(t,e,r=0,n=1/0,i){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(i=i===void 0?DI:SK(i);n>r;){if(n-r>600){const u=n-r+1,d=e-r+1,p=Math.log(u),f=.5*Math.exp(2*p/3),m=.5*Math.sqrt(p*f*(u-f)/u)*(d-u/2<0?-1:1),v=Math.max(r,Math.floor(e-d*f/u+m)),b=Math.min(n,Math.floor(e+(u-d)*f/u+m));LI(t,e,v,b,i)}const a=t[e];let o=r,c=n;for(yc(t,r,e),i(t[n],a)>0&&yc(t,r,n);o<c;){for(yc(t,o,c),++o,--c;i(t[o],a)<0;)++o;for(;i(t[c],a)>0;)--c}i(t[r],a)===0?yc(t,r,c):(++c,yc(t,c,n)),c<=e&&(r=c+1),e<=c&&(n=c-1)}return t}function yc(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function OK(t,e,r){if(t=Float64Array.from(vK(t)),!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return KC(t);if(e>=1)return WC(t);var n,i=(n-1)*e,a=Math.floor(i),o=WC(LI(t,a).subarray(0,a+1)),c=KC(t.subarray(a+1));return o+(c-o)*(i-a)}}function TK(t,e,r=MI){if(!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t),c=+r(t[a+1],a+1,t);return o+(c-o)*(i-a)}}function CK(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((e-t)/r))|0,a=new Array(i);++n<i;)a[n]=t+n*r;return a}function Nn(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function ia(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const Mx=Symbol("implicit");function P1(){var t=new FC,e=[],r=[],n=Mx;function i(a){let o=t.get(a);if(o===void 0){if(n!==Mx)return n;t.set(a,o=e.push(a)-1)}return r[o%r.length]}return i.domain=function(a){if(!arguments.length)return e.slice();e=[],t=new FC;for(const o of a)t.has(o)||t.set(o,e.push(o)-1);return i},i.range=function(a){return arguments.length?(r=Array.from(a),i):r.slice()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return P1(e,r).unknown(n)},Nn.apply(i,arguments),i}function nu(){var t=P1().unknown(void 0),e=t.domain,r=t.range,n=0,i=1,a,o,c=!1,u=0,d=0,p=.5;delete t.unknown;function f(){var m=e().length,v=i<n,b=v?i:n,w=v?n:i;a=(w-b)/Math.max(1,m-u+d*2),c&&(a=Math.floor(a)),b+=(w-b-a*(m-u))*p,o=a*(1-u),c&&(b=Math.round(b),o=Math.round(o));var x=CK(m).map(function(k){return b+a*k});return r(v?x.reverse():x)}return t.domain=function(m){return arguments.length?(e(m),f()):e()},t.range=function(m){return arguments.length?([n,i]=m,n=+n,i=+i,f()):[n,i]},t.rangeRound=function(m){return[n,i]=m,n=+n,i=+i,c=!0,f()},t.bandwidth=function(){return o},t.step=function(){return a},t.round=function(m){return arguments.length?(c=!!m,f()):c},t.padding=function(m){return arguments.length?(u=Math.min(1,d=+m),f()):u},t.paddingInner=function(m){return arguments.length?(u=Math.min(1,m),f()):u},t.paddingOuter=function(m){return arguments.length?(d=+m,f()):d},t.align=function(m){return arguments.length?(p=Math.max(0,Math.min(1,m)),f()):p},t.copy=function(){return nu(e(),[n,i]).round(c).paddingInner(u).paddingOuter(d).align(p)},Nn.apply(f(),arguments)}function zI(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return zI(e())},t}function Dc(){return zI(nu.apply(null,arguments).paddingInner(1))}function R1(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function BI(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function qu(){}var iu=.7,bh=1/iu,Us="\\s*([+-]?\\d+)\\s*",au="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_i="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",jK=/^#([0-9a-f]{3,8})$/,NK=new RegExp(`^rgb\\(${Us},${Us},${Us}\\)$`),PK=new RegExp(`^rgb\\(${_i},${_i},${_i}\\)$`),RK=new RegExp(`^rgba\\(${Us},${Us},${Us},${au}\\)$`),IK=new RegExp(`^rgba\\(${_i},${_i},${_i},${au}\\)$`),$K=new RegExp(`^hsl\\(${au},${_i},${_i}\\)$`),MK=new RegExp(`^hsla\\(${au},${_i},${_i},${au}\\)$`),GC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};R1(qu,ou,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:VC,formatHex:VC,formatHex8:DK,formatHsl:LK,formatRgb:XC,toString:XC});function VC(){return this.rgb().formatHex()}function DK(){return this.rgb().formatHex8()}function LK(){return UI(this).formatHsl()}function XC(){return this.rgb().formatRgb()}function ou(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=jK.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?YC(e):r===3?new Zr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?_f(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?_f(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=NK.exec(t))?new Zr(e[1],e[2],e[3],1):(e=PK.exec(t))?new Zr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=RK.exec(t))?_f(e[1],e[2],e[3],e[4]):(e=IK.exec(t))?_f(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=$K.exec(t))?QC(e[1],e[2]/100,e[3]/100,1):(e=MK.exec(t))?QC(e[1],e[2]/100,e[3]/100,e[4]):GC.hasOwnProperty(t)?YC(GC[t]):t==="transparent"?new Zr(NaN,NaN,NaN,0):null}function YC(t){return new Zr(t>>16&255,t>>8&255,t&255,1)}function _f(t,e,r,n){return n<=0&&(t=e=r=NaN),new Zr(t,e,r,n)}function zK(t){return t instanceof qu||(t=ou(t)),t?(t=t.rgb(),new Zr(t.r,t.g,t.b,t.opacity)):new Zr}function Dx(t,e,r,n){return arguments.length===1?zK(t):new Zr(t,e,r,n??1)}function Zr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}R1(Zr,Dx,BI(qu,{brighter(t){return t=t==null?bh:Math.pow(bh,t),new Zr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?iu:Math.pow(iu,t),new Zr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zr(jo(this.r),jo(this.g),jo(this.b),xh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:JC,formatHex:JC,formatHex8:BK,formatRgb:ZC,toString:ZC}));function JC(){return`#${Ao(this.r)}${Ao(this.g)}${Ao(this.b)}`}function BK(){return`#${Ao(this.r)}${Ao(this.g)}${Ao(this.b)}${Ao((isNaN(this.opacity)?1:this.opacity)*255)}`}function ZC(){const t=xh(this.opacity);return`${t===1?"rgb(":"rgba("}${jo(this.r)}, ${jo(this.g)}, ${jo(this.b)}${t===1?")":`, ${t})`}`}function xh(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function jo(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ao(t){return t=jo(t),(t<16?"0":"")+t.toString(16)}function QC(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Yn(t,e,r,n)}function UI(t){if(t instanceof Yn)return new Yn(t.h,t.s,t.l,t.opacity);if(t instanceof qu||(t=ou(t)),!t)return new Yn;if(t instanceof Yn)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),a=Math.max(e,r,n),o=NaN,c=a-i,u=(a+i)/2;return c?(e===a?o=(r-n)/c+(r<n)*6:r===a?o=(n-e)/c+2:o=(e-r)/c+4,c/=u<.5?a+i:2-a-i,o*=60):c=u>0&&u<1?0:o,new Yn(o,c,u,t.opacity)}function UK(t,e,r,n){return arguments.length===1?UI(t):new Yn(t,e,r,n??1)}function Yn(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}R1(Yn,UK,BI(qu,{brighter(t){return t=t==null?bh:Math.pow(bh,t),new Yn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?iu:Math.pow(iu,t),new Yn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Zr(Z0(t>=240?t-240:t+120,i,n),Z0(t,i,n),Z0(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Yn(ej(this.h),Sf(this.s),Sf(this.l),xh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=xh(this.opacity);return`${t===1?"hsl(":"hsla("}${ej(this.h)}, ${Sf(this.s)*100}%, ${Sf(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ej(t){return t=(t||0)%360,t<0?t+360:t}function Sf(t){return Math.max(0,Math.min(1,t||0))}function Z0(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const I1=t=>()=>t;function qK(t,e){return function(r){return t+r*e}}function FK(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function HK(t){return(t=+t)==1?qI:function(e,r){return r-e?FK(e,r,t):I1(isNaN(e)?r:e)}}function qI(t,e){var r=e-t;return r?qK(t,r):I1(isNaN(t)?e:t)}const tj=(function t(e){var r=HK(e);function n(i,a){var o=r((i=Dx(i)).r,(a=Dx(a)).r),c=r(i.g,a.g),u=r(i.b,a.b),d=qI(i.opacity,a.opacity);return function(p){return i.r=o(p),i.g=c(p),i.b=u(p),i.opacity=d(p),i+""}}return n.gamma=t,n})(1);function WK(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),i;return function(a){for(i=0;i<r;++i)n[i]=t[i]*(1-a)+e[i]*a;return n}}function KK(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function GK(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,i=new Array(n),a=new Array(r),o;for(o=0;o<n;++o)i[o]=kl(t[o],e[o]);for(;o<r;++o)a[o]=e[o];return function(c){for(o=0;o<n;++o)a[o]=i[o](c);return a}}function VK(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function wh(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function XK(t,e){var r={},n={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?r[i]=kl(t[i],e[i]):n[i]=e[i];return function(a){for(i in r)n[i]=r[i](a);return n}}var Lx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Q0=new RegExp(Lx.source,"g");function YK(t){return function(){return t}}function JK(t){return function(e){return t(e)+""}}function ZK(t,e){var r=Lx.lastIndex=Q0.lastIndex=0,n,i,a,o=-1,c=[],u=[];for(t=t+"",e=e+"";(n=Lx.exec(t))&&(i=Q0.exec(e));)(a=i.index)>r&&(a=e.slice(r,a),c[o]?c[o]+=a:c[++o]=a),(n=n[0])===(i=i[0])?c[o]?c[o]+=i:c[++o]=i:(c[++o]=null,u.push({i:o,x:wh(n,i)})),r=Q0.lastIndex;return r<e.length&&(a=e.slice(r),c[o]?c[o]+=a:c[++o]=a),c.length<2?u[0]?JK(u[0].x):YK(e):(e=u.length,function(d){for(var p=0,f;p<e;++p)c[(f=u[p]).i]=f.x(d);return c.join("")})}function kl(t,e){var r=typeof e,n;return e==null||r==="boolean"?I1(e):(r==="number"?wh:r==="string"?(n=ou(e))?(e=n,tj):ZK:e instanceof ou?tj:e instanceof Date?VK:KK(e)?WK:Array.isArray(e)?GK:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?XK:wh)(t,e)}function $1(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}function QK(t,e){e===void 0&&(e=t,t=kl);for(var r=0,n=e.length-1,i=e[0],a=new Array(n<0?0:n);r<n;)a[r]=t(i,i=e[++r]);return function(o){var c=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return a[c](o-c)}}function eG(t){return function(){return t}}function _h(t){return+t}var rj=[0,1];function Br(t){return t}function zx(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:eG(isNaN(e)?NaN:.5)}function tG(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function rG(t,e,r){var n=t[0],i=t[1],a=e[0],o=e[1];return i<n?(n=zx(i,n),a=r(o,a)):(n=zx(n,i),a=r(a,o)),function(c){return a(n(c))}}function nG(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),a=new Array(n),o=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<n;)i[o]=zx(t[o],t[o+1]),a[o]=r(e[o],e[o+1]);return function(c){var u=Uu(t,c,1,n)-1;return a[u](i[u](c))}}function Fu(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Tp(){var t=rj,e=rj,r=kl,n,i,a,o=Br,c,u,d;function p(){var m=Math.min(t.length,e.length);return o!==Br&&(o=tG(t[0],t[m-1])),c=m>2?nG:rG,u=d=null,f}function f(m){return m==null||isNaN(m=+m)?a:(u||(u=c(t.map(n),e,r)))(n(o(m)))}return f.invert=function(m){return o(i((d||(d=c(e,t.map(n),wh)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,_h),p()):t.slice()},f.range=function(m){return arguments.length?(e=Array.from(m),p()):e.slice()},f.rangeRound=function(m){return e=Array.from(m),r=$1,p()},f.clamp=function(m){return arguments.length?(o=m?!0:Br,p()):o!==Br},f.interpolate=function(m){return arguments.length?(r=m,p()):r},f.unknown=function(m){return arguments.length?(a=m,f):a},function(m,v){return n=m,i=v,p()}}function M1(){return Tp()(Br,Br)}function iG(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Sh(t,e){if(!isFinite(t)||t===0)return null;var r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function Ys(t){return t=Sh(Math.abs(t)),t?t[1]:NaN}function aG(t,e){return function(r,n){for(var i=r.length,a=[],o=0,c=t[0],u=0;i>0&&c>0&&(u+c+1>n&&(c=Math.max(1,n-u)),a.push(r.substring(i-=c,i+c)),!((u+=c+1)>n));)c=t[o=(o+1)%t.length];return a.reverse().join(e)}}function oG(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var sG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function su(t){if(!(e=sG.exec(t)))throw new Error("invalid format: "+t);var e;return new D1({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}su.prototype=D1.prototype;function D1(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}D1.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function lG(t){e:for(var e=t.length,r=1,n=-1,i;r<e;++r)switch(t[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+t[r])break e;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var kh;function cG(t,e){var r=Sh(t,e);if(!r)return kh=void 0,t.toPrecision(e);var n=r[0],i=r[1],a=i-(kh=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Sh(t,Math.max(0,e+a-1))[0]}function nj(t,e){var r=Sh(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const ij={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:iG,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>nj(t*100,e),r:nj,s:cG,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function aj(t){return t}var oj=Array.prototype.map,sj=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function uG(t){var e=t.grouping===void 0||t.thousands===void 0?aj:aG(oj.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?aj:oG(oj.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",c=t.minus===void 0?"−":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function d(f,m){f=su(f);var v=f.fill,b=f.align,w=f.sign,x=f.symbol,k=f.zero,S=f.width,A=f.comma,C=f.precision,T=f.trim,O=f.type;O==="n"?(A=!0,O="g"):ij[O]||(C===void 0&&(C=12),T=!0,O="g"),(k||v==="0"&&b==="=")&&(k=!0,v="0",b="=");var N=(m&&m.prefix!==void 0?m.prefix:"")+(x==="$"?r:x==="#"&&/[boxX]/.test(O)?"0"+O.toLowerCase():""),R=(x==="$"?n:/[%p]/.test(O)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),$=ij[O],K=/[defgprs%]/.test(O);C=C===void 0?6:/[gprs]/.test(O)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function z(U){var F=N,X=R,Y,G,Z;if(O==="c")X=$(U)+X,U="";else{U=+U;var W=U<0||1/U<0;if(U=isNaN(U)?u:$(Math.abs(U),C),T&&(U=lG(U)),W&&+U==0&&w!=="+"&&(W=!1),F=(W?w==="("?w:c:w==="-"||w==="("?"":w)+F,X=(O==="s"&&!isNaN(U)&&kh!==void 0?sj[8+kh/3]:"")+X+(W&&w==="("?")":""),K){for(Y=-1,G=U.length;++Y<G;)if(Z=U.charCodeAt(Y),48>Z||Z>57){X=(Z===46?i+U.slice(Y+1):U.slice(Y))+X,U=U.slice(0,Y);break}}}A&&!k&&(U=e(U,1/0));var Q=F.length+U.length+X.length,L=Q<S?new Array(S-Q+1).join(v):"";switch(A&&k&&(U=e(L+U,L.length?S-X.length:1/0),L=""),b){case"<":U=F+U+X+L;break;case"=":U=F+L+U+X;break;case"^":U=L.slice(0,Q=L.length>>1)+F+U+X+L.slice(Q);break;default:U=L+F+U+X;break}return a(U)}return z.toString=function(){return f+""},z}function p(f,m){var v=Math.max(-8,Math.min(8,Math.floor(Ys(m)/3)))*3,b=Math.pow(10,-v),w=d((f=su(f),f.type="f",f),{suffix:sj[8+v/3]});return function(x){return w(b*x)}}return{format:d,formatPrefix:p}}var kf,L1,FI;dG({thousands:",",grouping:[3],currency:["$",""]});function dG(t){return kf=uG(t),L1=kf.format,FI=kf.formatPrefix,kf}function fG(t){return Math.max(0,-Ys(Math.abs(t)))}function hG(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ys(e)/3)))*3-Ys(Math.abs(t)))}function pG(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ys(e)-Ys(t))+1}function HI(t,e,r,n){var i=$x(t,e,r),a;switch(n=su(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(a=hG(i,o))&&(n.precision=a),FI(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=pG(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=fG(i))&&(n.precision=a-(n.type==="%")*2);break}}return L1(n)}function Ga(t){var e=t.domain;return t.ticks=function(r){var n=e();return Rx(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var i=e();return HI(i[0],i[i.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,a=n.length-1,o=n[i],c=n[a],u,d,p=10;for(c<o&&(d=o,o=c,c=d,d=i,i=a,a=d);p-- >0;){if(d=Ix(o,c,r),d===u)return n[i]=o,n[a]=c,e(n);if(d>0)o=Math.floor(o/d)*d,c=Math.ceil(c/d)*d;else if(d<0)o=Math.ceil(o*d)/d,c=Math.floor(c*d)/d;else break;u=d}return t},t}function Eh(){var t=M1();return t.copy=function(){return Fu(t,Eh())},Nn.apply(t,arguments),Ga(t)}function WI(t){var e;function r(n){return n==null||isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=Array.from(n,_h),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return WI(t).unknown(e)},t=arguments.length?Array.from(t,_h):[0,1],Ga(r)}function KI(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],a=t[n],o;return a<i&&(o=r,r=n,n=o,o=i,i=a,a=o),t[r]=e.floor(i),t[n]=e.ceil(a),t}function lj(t){return Math.log(t)}function cj(t){return Math.exp(t)}function mG(t){return-Math.log(-t)}function gG(t){return-Math.exp(-t)}function yG(t){return isFinite(t)?+("1e"+t):t<0?0:t}function vG(t){return t===10?yG:t===Math.E?Math.exp:e=>Math.pow(t,e)}function bG(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function uj(t){return(e,r)=>-t(-e,r)}function z1(t){const e=t(lj,cj),r=e.domain;let n=10,i,a;function o(){return i=bG(n),a=vG(n),r()[0]<0?(i=uj(i),a=uj(a),t(mG,gG)):t(lj,cj),e}return e.base=function(c){return arguments.length?(n=+c,o()):n},e.domain=function(c){return arguments.length?(r(c),o()):r()},e.ticks=c=>{const u=r();let d=u[0],p=u[u.length-1];const f=p<d;f&&([d,p]=[p,d]);let m=i(d),v=i(p),b,w;const x=c==null?10:+c;let k=[];if(!(n%1)&&v-m<x){if(m=Math.floor(m),v=Math.ceil(v),d>0){for(;m<=v;++m)for(b=1;b<n;++b)if(w=m<0?b/a(-m):b*a(m),!(w<d)){if(w>p)break;k.push(w)}}else for(;m<=v;++m)for(b=n-1;b>=1;--b)if(w=m>0?b/a(-m):b*a(m),!(w<d)){if(w>p)break;k.push(w)}k.length*2<x&&(k=Rx(d,p,x))}else k=Rx(m,v,Math.min(v-m,x)).map(a);return f?k.reverse():k},e.tickFormat=(c,u)=>{if(c==null&&(c=10),u==null&&(u=n===10?"s":","),typeof u!="function"&&(!(n%1)&&(u=su(u)).precision==null&&(u.trim=!0),u=L1(u)),c===1/0)return u;const d=Math.max(1,n*c/e.ticks().length);return p=>{let f=p/a(Math.round(i(p)));return f*n<n-.5&&(f*=n),f<=d?u(p):""}},e.nice=()=>r(KI(r(),{floor:c=>a(Math.floor(i(c))),ceil:c=>a(Math.ceil(i(c)))})),e}function GI(){const t=z1(Tp()).domain([1,10]);return t.copy=()=>Fu(t,GI()).base(t.base()),Nn.apply(t,arguments),t}function dj(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function fj(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function B1(t){var e=1,r=t(dj(e),fj(e));return r.constant=function(n){return arguments.length?t(dj(e=+n),fj(e)):e},Ga(r)}function VI(){var t=B1(Tp());return t.copy=function(){return Fu(t,VI()).constant(t.constant())},Nn.apply(t,arguments)}function hj(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function xG(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function wG(t){return t<0?-t*t:t*t}function U1(t){var e=t(Br,Br),r=1;function n(){return r===1?t(Br,Br):r===.5?t(xG,wG):t(hj(r),hj(1/r))}return e.exponent=function(i){return arguments.length?(r=+i,n()):r},Ga(e)}function q1(){var t=U1(Tp());return t.copy=function(){return Fu(t,q1()).exponent(t.exponent())},Nn.apply(t,arguments),t}function _G(){return q1.apply(null,arguments).exponent(.5)}function pj(t){return Math.sign(t)*t*t}function SG(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function XI(){var t=M1(),e=[0,1],r=!1,n;function i(a){var o=SG(t(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return t.invert(pj(a))},i.domain=function(a){return arguments.length?(t.domain(a),i):t.domain()},i.range=function(a){return arguments.length?(t.range((e=Array.from(a,_h)).map(pj)),i):e.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(t.clamp(a),i):t.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return XI(t.domain(),e).round(r).clamp(t.clamp()).unknown(n)},Nn.apply(i,arguments),Ga(i)}function YI(){var t=[],e=[],r=[],n;function i(){var o=0,c=Math.max(1,e.length);for(r=new Array(c-1);++o<c;)r[o-1]=TK(t,o/c);return a}function a(o){return o==null||isNaN(o=+o)?n:e[Uu(r,o)]}return a.invertExtent=function(o){var c=e.indexOf(o);return c<0?[NaN,NaN]:[c>0?r[c-1]:t[0],c<r.length?r[c]:t[t.length-1]]},a.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let c of o)c!=null&&!isNaN(c=+c)&&t.push(c);return t.sort(La),i()},a.range=function(o){return arguments.length?(e=Array.from(o),i()):e.slice()},a.unknown=function(o){return arguments.length?(n=o,a):n},a.quantiles=function(){return r.slice()},a.copy=function(){return YI().domain(t).range(e).unknown(n)},Nn.apply(a,arguments)}function JI(){var t=0,e=1,r=1,n=[.5],i=[0,1],a;function o(u){return u!=null&&u<=u?i[Uu(n,u,0,r)]:a}function c(){var u=-1;for(n=new Array(r);++u<r;)n[u]=((u+1)*e-(u-r)*t)/(r+1);return o}return o.domain=function(u){return arguments.length?([t,e]=u,t=+t,e=+e,c()):[t,e]},o.range=function(u){return arguments.length?(r=(i=Array.from(u)).length-1,c()):i.slice()},o.invertExtent=function(u){var d=i.indexOf(u);return d<0?[NaN,NaN]:d<1?[t,n[0]]:d>=r?[n[r-1],e]:[n[d-1],n[d]]},o.unknown=function(u){return arguments.length&&(a=u),o},o.thresholds=function(){return n.slice()},o.copy=function(){return JI().domain([t,e]).range(i).unknown(a)},Nn.apply(Ga(o),arguments)}function ZI(){var t=[.5],e=[0,1],r,n=1;function i(a){return a!=null&&a<=a?e[Uu(t,a,0,n)]:r}return i.domain=function(a){return arguments.length?(t=Array.from(a),n=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(a){return arguments.length?(e=Array.from(a),n=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(a){var o=e.indexOf(a);return[t[o-1],t[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return ZI().domain(t).range(e).unknown(r)},Nn.apply(i,arguments)}const eb=new Date,tb=new Date;function lr(t,e,r,n){function i(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(t(a=new Date(+a)),a),i.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),i.round=a=>{const o=i(a),c=i.ceil(a);return a-o<c-a?o:c},i.offset=(a,o)=>(e(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,c)=>{const u=[];if(a=i.ceil(a),c=c==null?1:Math.floor(c),!(a<o)||!(c>0))return u;let d;do u.push(d=new Date(+a)),e(a,c),t(a);while(d<a&&a<o);return u},i.filter=a=>lr(o=>{if(o>=o)for(;t(o),!a(o);)o.setTime(o-1)},(o,c)=>{if(o>=o)if(c<0)for(;++c<=0;)for(;e(o,-1),!a(o););else for(;--c>=0;)for(;e(o,1),!a(o););}),r&&(i.count=(a,o)=>(eb.setTime(+a),tb.setTime(+o),t(eb),t(tb),Math.floor(r(eb,tb))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const Ah=lr(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Ah.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?lr(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):Ah);Ah.range;const Hi=1e3,An=Hi*60,Wi=An*60,Ji=Wi*24,F1=Ji*7,mj=Ji*30,rb=Ji*365,Oo=lr(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Hi)},(t,e)=>(e-t)/Hi,t=>t.getUTCSeconds());Oo.range;const H1=lr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Hi)},(t,e)=>{t.setTime(+t+e*An)},(t,e)=>(e-t)/An,t=>t.getMinutes());H1.range;const W1=lr(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*An)},(t,e)=>(e-t)/An,t=>t.getUTCMinutes());W1.range;const K1=lr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Hi-t.getMinutes()*An)},(t,e)=>{t.setTime(+t+e*Wi)},(t,e)=>(e-t)/Wi,t=>t.getHours());K1.range;const G1=lr(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Wi)},(t,e)=>(e-t)/Wi,t=>t.getUTCHours());G1.range;const Hu=lr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*An)/Ji,t=>t.getDate()-1);Hu.range;const Cp=lr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Ji,t=>t.getUTCDate()-1);Cp.range;const QI=lr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Ji,t=>Math.floor(t/Ji));QI.range;function qo(t){return lr(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*An)/F1)}const jp=qo(0),Oh=qo(1),kG=qo(2),EG=qo(3),Js=qo(4),AG=qo(5),OG=qo(6);jp.range;Oh.range;kG.range;EG.range;Js.range;AG.range;OG.range;function Fo(t){return lr(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/F1)}const Np=Fo(0),Th=Fo(1),TG=Fo(2),CG=Fo(3),Zs=Fo(4),jG=Fo(5),NG=Fo(6);Np.range;Th.range;TG.range;CG.range;Zs.range;jG.range;NG.range;const V1=lr(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());V1.range;const X1=lr(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());X1.range;const Zi=lr(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Zi.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:lr(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});Zi.range;const Qi=lr(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Qi.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:lr(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});Qi.range;function e$(t,e,r,n,i,a){const o=[[Oo,1,Hi],[Oo,5,5*Hi],[Oo,15,15*Hi],[Oo,30,30*Hi],[a,1,An],[a,5,5*An],[a,15,15*An],[a,30,30*An],[i,1,Wi],[i,3,3*Wi],[i,6,6*Wi],[i,12,12*Wi],[n,1,Ji],[n,2,2*Ji],[r,1,F1],[e,1,mj],[e,3,3*mj],[t,1,rb]];function c(d,p,f){const m=p<d;m&&([d,p]=[p,d]);const v=f&&typeof f.range=="function"?f:u(d,p,f),b=v?v.range(d,+p+1):[];return m?b.reverse():b}function u(d,p,f){const m=Math.abs(p-d)/f,v=N1(([,,x])=>x).right(o,m);if(v===o.length)return t.every($x(d/rb,p/rb,f));if(v===0)return Ah.every(Math.max($x(d,p,f),1));const[b,w]=o[m/o[v-1][2]<o[v][2]/m?v-1:v];return b.every(w)}return[c,u]}const[PG,RG]=e$(Qi,X1,Np,QI,G1,W1),[IG,$G]=e$(Zi,V1,jp,Hu,K1,H1);function nb(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function ib(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function vc(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function MG(t){var e=t.dateTime,r=t.date,n=t.time,i=t.periods,a=t.days,o=t.shortDays,c=t.months,u=t.shortMonths,d=bc(i),p=xc(i),f=bc(a),m=xc(a),v=bc(o),b=xc(o),w=bc(c),x=xc(c),k=bc(u),S=xc(u),A={a:Z,A:W,b:Q,B:L,c:null,d:wj,e:wj,f:aV,g:mV,G:yV,H:rV,I:nV,j:iV,L:t$,m:oV,M:sV,p:I,q,Q:kj,s:Ej,S:lV,u:cV,U:uV,V:dV,w:fV,W:hV,x:null,X:null,y:pV,Y:gV,Z:vV,"%":Sj},C={a:ee,A:le,b:fe,B:ve,c:null,d:_j,e:_j,f:_V,g:PV,G:IV,H:bV,I:xV,j:wV,L:n$,m:SV,M:kV,p:qe,q:xe,Q:kj,s:Ej,S:EV,u:AV,U:OV,V:TV,w:CV,W:jV,x:null,X:null,y:NV,Y:RV,Z:$V,"%":Sj},T={a:K,A:z,b:U,B:F,c:X,d:bj,e:bj,f:ZG,g:vj,G:yj,H:xj,I:xj,j:VG,L:JG,m:GG,M:XG,p:$,q:KG,Q:eV,s:tV,S:YG,u:UG,U:qG,V:FG,w:BG,W:HG,x:Y,X:G,y:vj,Y:yj,Z:WG,"%":QG};A.x=O(r,A),A.X=O(n,A),A.c=O(e,A),C.x=O(r,C),C.X=O(n,C),C.c=O(e,C);function O(ae,Se){return function(Me){var oe=[],rt=-1,Fe=0,kt=ae.length,wt,Et,_r;for(Me instanceof Date||(Me=new Date(+Me));++rt<kt;)ae.charCodeAt(rt)===37&&(oe.push(ae.slice(Fe,rt)),(Et=gj[wt=ae.charAt(++rt)])!=null?wt=ae.charAt(++rt):Et=wt==="e"?" ":"0",(_r=Se[wt])&&(wt=_r(Me,Et)),oe.push(wt),Fe=rt+1);return oe.push(ae.slice(Fe,rt)),oe.join("")}}function N(ae,Se){return function(Me){var oe=vc(1900,void 0,1),rt=R(oe,ae,Me+="",0),Fe,kt;if(rt!=Me.length)return null;if("Q"in oe)return new Date(oe.Q);if("s"in oe)return new Date(oe.s*1e3+("L"in oe?oe.L:0));if(Se&&!("Z"in oe)&&(oe.Z=0),"p"in oe&&(oe.H=oe.H%12+oe.p*12),oe.m===void 0&&(oe.m="q"in oe?oe.q:0),"V"in oe){if(oe.V<1||oe.V>53)return null;"w"in oe||(oe.w=1),"Z"in oe?(Fe=ib(vc(oe.y,0,1)),kt=Fe.getUTCDay(),Fe=kt>4||kt===0?Th.ceil(Fe):Th(Fe),Fe=Cp.offset(Fe,(oe.V-1)*7),oe.y=Fe.getUTCFullYear(),oe.m=Fe.getUTCMonth(),oe.d=Fe.getUTCDate()+(oe.w+6)%7):(Fe=nb(vc(oe.y,0,1)),kt=Fe.getDay(),Fe=kt>4||kt===0?Oh.ceil(Fe):Oh(Fe),Fe=Hu.offset(Fe,(oe.V-1)*7),oe.y=Fe.getFullYear(),oe.m=Fe.getMonth(),oe.d=Fe.getDate()+(oe.w+6)%7)}else("W"in oe||"U"in oe)&&("w"in oe||(oe.w="u"in oe?oe.u%7:"W"in oe?1:0),kt="Z"in oe?ib(vc(oe.y,0,1)).getUTCDay():nb(vc(oe.y,0,1)).getDay(),oe.m=0,oe.d="W"in oe?(oe.w+6)%7+oe.W*7-(kt+5)%7:oe.w+oe.U*7-(kt+6)%7);return"Z"in oe?(oe.H+=oe.Z/100|0,oe.M+=oe.Z%100,ib(oe)):nb(oe)}}function R(ae,Se,Me,oe){for(var rt=0,Fe=Se.length,kt=Me.length,wt,Et;rt<Fe;){if(oe>=kt)return-1;if(wt=Se.charCodeAt(rt++),wt===37){if(wt=Se.charAt(rt++),Et=T[wt in gj?Se.charAt(rt++):wt],!Et||(oe=Et(ae,Me,oe))<0)return-1}else if(wt!=Me.charCodeAt(oe++))return-1}return oe}function $(ae,Se,Me){var oe=d.exec(Se.slice(Me));return oe?(ae.p=p.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function K(ae,Se,Me){var oe=v.exec(Se.slice(Me));return oe?(ae.w=b.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function z(ae,Se,Me){var oe=f.exec(Se.slice(Me));return oe?(ae.w=m.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function U(ae,Se,Me){var oe=k.exec(Se.slice(Me));return oe?(ae.m=S.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function F(ae,Se,Me){var oe=w.exec(Se.slice(Me));return oe?(ae.m=x.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function X(ae,Se,Me){return R(ae,e,Se,Me)}function Y(ae,Se,Me){return R(ae,r,Se,Me)}function G(ae,Se,Me){return R(ae,n,Se,Me)}function Z(ae){return o[ae.getDay()]}function W(ae){return a[ae.getDay()]}function Q(ae){return u[ae.getMonth()]}function L(ae){return c[ae.getMonth()]}function I(ae){return i[+(ae.getHours()>=12)]}function q(ae){return 1+~~(ae.getMonth()/3)}function ee(ae){return o[ae.getUTCDay()]}function le(ae){return a[ae.getUTCDay()]}function fe(ae){return u[ae.getUTCMonth()]}function ve(ae){return c[ae.getUTCMonth()]}function qe(ae){return i[+(ae.getUTCHours()>=12)]}function xe(ae){return 1+~~(ae.getUTCMonth()/3)}return{format:function(ae){var Se=O(ae+="",A);return Se.toString=function(){return ae},Se},parse:function(ae){var Se=N(ae+="",!1);return Se.toString=function(){return ae},Se},utcFormat:function(ae){var Se=O(ae+="",C);return Se.toString=function(){return ae},Se},utcParse:function(ae){var Se=N(ae+="",!0);return Se.toString=function(){return ae},Se}}}var gj={"-":"",_:" ",0:"0"},yr=/^\s*\d+/,DG=/^%/,LG=/[\\^$*+?|[\]().{}]/g;function ft(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a<r?new Array(r-a+1).join(e)+i:i)}function zG(t){return t.replace(LG,"\\$&")}function bc(t){return new RegExp("^(?:"+t.map(zG).join("|")+")","i")}function xc(t){return new Map(t.map((e,r)=>[e.toLowerCase(),r]))}function BG(t,e,r){var n=yr.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function UG(t,e,r){var n=yr.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function qG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function FG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function HG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function yj(t,e,r){var n=yr.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function vj(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function WG(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function KG(t,e,r){var n=yr.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function GG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function bj(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function VG(t,e,r){var n=yr.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function xj(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function XG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function YG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function JG(t,e,r){var n=yr.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ZG(t,e,r){var n=yr.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function QG(t,e,r){var n=DG.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function eV(t,e,r){var n=yr.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function tV(t,e,r){var n=yr.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function wj(t,e){return ft(t.getDate(),e,2)}function rV(t,e){return ft(t.getHours(),e,2)}function nV(t,e){return ft(t.getHours()%12||12,e,2)}function iV(t,e){return ft(1+Hu.count(Zi(t),t),e,3)}function t$(t,e){return ft(t.getMilliseconds(),e,3)}function aV(t,e){return t$(t,e)+"000"}function oV(t,e){return ft(t.getMonth()+1,e,2)}function sV(t,e){return ft(t.getMinutes(),e,2)}function lV(t,e){return ft(t.getSeconds(),e,2)}function cV(t){var e=t.getDay();return e===0?7:e}function uV(t,e){return ft(jp.count(Zi(t)-1,t),e,2)}function r$(t){var e=t.getDay();return e>=4||e===0?Js(t):Js.ceil(t)}function dV(t,e){return t=r$(t),ft(Js.count(Zi(t),t)+(Zi(t).getDay()===4),e,2)}function fV(t){return t.getDay()}function hV(t,e){return ft(Oh.count(Zi(t)-1,t),e,2)}function pV(t,e){return ft(t.getFullYear()%100,e,2)}function mV(t,e){return t=r$(t),ft(t.getFullYear()%100,e,2)}function gV(t,e){return ft(t.getFullYear()%1e4,e,4)}function yV(t,e){var r=t.getDay();return t=r>=4||r===0?Js(t):Js.ceil(t),ft(t.getFullYear()%1e4,e,4)}function vV(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ft(e/60|0,"0",2)+ft(e%60,"0",2)}function _j(t,e){return ft(t.getUTCDate(),e,2)}function bV(t,e){return ft(t.getUTCHours(),e,2)}function xV(t,e){return ft(t.getUTCHours()%12||12,e,2)}function wV(t,e){return ft(1+Cp.count(Qi(t),t),e,3)}function n$(t,e){return ft(t.getUTCMilliseconds(),e,3)}function _V(t,e){return n$(t,e)+"000"}function SV(t,e){return ft(t.getUTCMonth()+1,e,2)}function kV(t,e){return ft(t.getUTCMinutes(),e,2)}function EV(t,e){return ft(t.getUTCSeconds(),e,2)}function AV(t){var e=t.getUTCDay();return e===0?7:e}function OV(t,e){return ft(Np.count(Qi(t)-1,t),e,2)}function i$(t){var e=t.getUTCDay();return e>=4||e===0?Zs(t):Zs.ceil(t)}function TV(t,e){return t=i$(t),ft(Zs.count(Qi(t),t)+(Qi(t).getUTCDay()===4),e,2)}function CV(t){return t.getUTCDay()}function jV(t,e){return ft(Th.count(Qi(t)-1,t),e,2)}function NV(t,e){return ft(t.getUTCFullYear()%100,e,2)}function PV(t,e){return t=i$(t),ft(t.getUTCFullYear()%100,e,2)}function RV(t,e){return ft(t.getUTCFullYear()%1e4,e,4)}function IV(t,e){var r=t.getUTCDay();return t=r>=4||r===0?Zs(t):Zs.ceil(t),ft(t.getUTCFullYear()%1e4,e,4)}function $V(){return"+0000"}function Sj(){return"%"}function kj(t){return+t}function Ej(t){return Math.floor(+t/1e3)}var Es,a$,o$;MV({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function MV(t){return Es=MG(t),a$=Es.format,Es.parse,o$=Es.utcFormat,Es.utcParse,Es}function DV(t){return new Date(t)}function LV(t){return t instanceof Date?+t:+new Date(+t)}function Y1(t,e,r,n,i,a,o,c,u,d){var p=M1(),f=p.invert,m=p.domain,v=d(".%L"),b=d(":%S"),w=d("%I:%M"),x=d("%I %p"),k=d("%a %d"),S=d("%b %d"),A=d("%B"),C=d("%Y");function T(O){return(u(O)<O?v:c(O)<O?b:o(O)<O?w:a(O)<O?x:n(O)<O?i(O)<O?k:S:r(O)<O?A:C)(O)}return p.invert=function(O){return new Date(f(O))},p.domain=function(O){return arguments.length?m(Array.from(O,LV)):m().map(DV)},p.ticks=function(O){var N=m();return t(N[0],N[N.length-1],O??10)},p.tickFormat=function(O,N){return N==null?T:d(N)},p.nice=function(O){var N=m();return(!O||typeof O.range!="function")&&(O=e(N[0],N[N.length-1],O??10)),O?m(KI(N,O)):p},p.copy=function(){return Fu(p,Y1(t,e,r,n,i,a,o,c,u,d))},p}function zV(){return Nn.apply(Y1(IG,$G,Zi,V1,jp,Hu,K1,H1,Oo,a$).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function BV(){return Nn.apply(Y1(PG,RG,Qi,X1,Np,Cp,G1,W1,Oo,o$).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Pp(){var t=0,e=1,r,n,i,a,o=Br,c=!1,u;function d(f){return f==null||isNaN(f=+f)?u:o(i===0?.5:(f=(a(f)-r)*i,c?Math.max(0,Math.min(1,f)):f))}d.domain=function(f){return arguments.length?([t,e]=f,r=a(t=+t),n=a(e=+e),i=r===n?0:1/(n-r),d):[t,e]},d.clamp=function(f){return arguments.length?(c=!!f,d):c},d.interpolator=function(f){return arguments.length?(o=f,d):o};function p(f){return function(m){var v,b;return arguments.length?([v,b]=m,o=f(v,b),d):[o(0),o(1)]}}return d.range=p(kl),d.rangeRound=p($1),d.unknown=function(f){return arguments.length?(u=f,d):u},function(f){return a=f,r=f(t),n=f(e),i=r===n?0:1/(n-r),d}}function Va(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function s$(){var t=Ga(Pp()(Br));return t.copy=function(){return Va(t,s$())},ia.apply(t,arguments)}function l$(){var t=z1(Pp()).domain([1,10]);return t.copy=function(){return Va(t,l$()).base(t.base())},ia.apply(t,arguments)}function c$(){var t=B1(Pp());return t.copy=function(){return Va(t,c$()).constant(t.constant())},ia.apply(t,arguments)}function J1(){var t=U1(Pp());return t.copy=function(){return Va(t,J1()).exponent(t.exponent())},ia.apply(t,arguments)}function UV(){return J1.apply(null,arguments).exponent(.5)}function u$(){var t=[],e=Br;function r(n){if(n!=null&&!isNaN(n=+n))return e((Uu(t,n,1)-1)/(t.length-1))}return r.domain=function(n){if(!arguments.length)return t.slice();t=[];for(let i of n)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(La),r},r.interpolator=function(n){return arguments.length?(e=n,r):e},r.range=function(){return t.map((n,i)=>e(i/(t.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>OK(t,a/n))},r.copy=function(){return u$(e).domain(t)},ia.apply(r,arguments)}function Rp(){var t=0,e=.5,r=1,n=1,i,a,o,c,u,d=Br,p,f=!1,m;function v(w){return isNaN(w=+w)?m:(w=.5+((w=+p(w))-a)*(n*w<n*a?c:u),d(f?Math.max(0,Math.min(1,w)):w))}v.domain=function(w){return arguments.length?([t,e,r]=w,i=p(t=+t),a=p(e=+e),o=p(r=+r),c=i===a?0:.5/(a-i),u=a===o?0:.5/(o-a),n=a<i?-1:1,v):[t,e,r]},v.clamp=function(w){return arguments.length?(f=!!w,v):f},v.interpolator=function(w){return arguments.length?(d=w,v):d};function b(w){return function(x){var k,S,A;return arguments.length?([k,S,A]=x,d=QK(w,[k,S,A]),v):[d(0),d(.5),d(1)]}}return v.range=b(kl),v.rangeRound=b($1),v.unknown=function(w){return arguments.length?(m=w,v):m},function(w){return p=w,i=w(t),a=w(e),o=w(r),c=i===a?0:.5/(a-i),u=a===o?0:.5/(o-a),n=a<i?-1:1,v}}function d$(){var t=Ga(Rp()(Br));return t.copy=function(){return Va(t,d$())},ia.apply(t,arguments)}function f$(){var t=z1(Rp()).domain([.1,1,10]);return t.copy=function(){return Va(t,f$()).base(t.base())},ia.apply(t,arguments)}function h$(){var t=B1(Rp());return t.copy=function(){return Va(t,h$()).constant(t.constant())},ia.apply(t,arguments)}function Z1(){var t=U1(Rp());return t.copy=function(){return Va(t,Z1()).exponent(t.exponent())},ia.apply(t,arguments)}function qV(){return Z1.apply(null,arguments).exponent(.5)}const Aj=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:nu,scaleDiverging:d$,scaleDivergingLog:f$,scaleDivergingPow:Z1,scaleDivergingSqrt:qV,scaleDivergingSymlog:h$,scaleIdentity:WI,scaleImplicit:Mx,scaleLinear:Eh,scaleLog:GI,scaleOrdinal:P1,scalePoint:Dc,scalePow:q1,scaleQuantile:YI,scaleQuantize:JI,scaleRadial:XI,scaleSequential:s$,scaleSequentialLog:l$,scaleSequentialPow:J1,scaleSequentialQuantile:u$,scaleSequentialSqrt:UV,scaleSequentialSymlog:c$,scaleSqrt:_G,scaleSymlog:VI,scaleThreshold:ZI,scaleTime:zV,scaleUtc:BV,tickFormat:HI},Symbol.toStringTag,{value:"Module"}));var ab,Oj;function p$(){if(Oj)return ab;Oj=1;var t=xl();function e(r,n,i){for(var a=-1,o=r.length;++a<o;){var c=r[a],u=n(c);if(u!=null&&(d===void 0?u===u&&!t(u):i(u,d)))var d=u,p=c}return p}return ab=e,ab}var ob,Tj;function FV(){if(Tj)return ob;Tj=1;function t(e,r){return e>r}return ob=t,ob}var sb,Cj;function HV(){if(Cj)return sb;Cj=1;var t=p$(),e=FV(),r=_l();function n(i){return i&&i.length?t(i,r,e):void 0}return sb=n,sb}var WV=HV();const Ip=vt(WV);var lb,jj;function KV(){if(jj)return lb;jj=1;function t(e,r){return e<r}return lb=t,lb}var cb,Nj;function GV(){if(Nj)return cb;Nj=1;var t=p$(),e=KV(),r=_l();function n(i){return i&&i.length?t(i,r,e):void 0}return cb=n,cb}var VV=GV();const $p=vt(VV);var ub,Pj;function XV(){if(Pj)return ub;Pj=1;var t=p1(),e=Ka(),r=SI(),n=Qr();function i(a,o){var c=n(a)?t:r;return c(a,e(o,3))}return ub=i,ub}var db,Rj;function YV(){if(Rj)return db;Rj=1;var t=wI(),e=XV();function r(n,i){return t(e(n,i),1)}return db=r,db}var JV=YV();const ZV=vt(JV);var fb,Ij;function QV(){if(Ij)return fb;Ij=1;var t=O1();function e(r,n){return t(r,n)}return fb=e,fb}var eX=QV();const Mp=vt(eX);var El=1e9,tX={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},e_,$t=!0,Cn="[DecimalError] ",No=Cn+"Invalid argument: ",Q1=Cn+"Exponent out of range: ",Al=Math.floor,_o=Math.pow,rX=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,un,gr=1e7,Nt=7,m$=9007199254740991,Ch=Al(m$/Nt),Te={};Te.absoluteValue=Te.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};Te.comparedTo=Te.cmp=function(t){var e,r,n,i,a=this;if(t=new a.constructor(t),a.s!==t.s)return a.s||-t.s;if(a.e!==t.e)return a.e>t.e^a.s<0?1:-1;for(n=a.d.length,i=t.d.length,e=0,r=n<i?n:i;e<r;++e)if(a.d[e]!==t.d[e])return a.d[e]>t.d[e]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};Te.decimalPlaces=Te.dp=function(){var t=this,e=t.d.length-1,r=(e-t.e)*Nt;if(e=t.d[e],e)for(;e%10==0;e/=10)r--;return r<0?0:r};Te.dividedBy=Te.div=function(t){return Xi(this,new this.constructor(t))};Te.dividedToIntegerBy=Te.idiv=function(t){var e=this,r=e.constructor;return St(Xi(e,new r(t),0,1),r.precision)};Te.equals=Te.eq=function(t){return!this.cmp(t)};Te.exponent=function(){return er(this)};Te.greaterThan=Te.gt=function(t){return this.cmp(t)>0};Te.greaterThanOrEqualTo=Te.gte=function(t){return this.cmp(t)>=0};Te.isInteger=Te.isint=function(){return this.e>this.d.length-2};Te.isNegative=Te.isneg=function(){return this.s<0};Te.isPositive=Te.ispos=function(){return this.s>0};Te.isZero=function(){return this.s===0};Te.lessThan=Te.lt=function(t){return this.cmp(t)<0};Te.lessThanOrEqualTo=Te.lte=function(t){return this.cmp(t)<1};Te.logarithm=Te.log=function(t){var e,r=this,n=r.constructor,i=n.precision,a=i+5;if(t===void 0)t=new n(10);else if(t=new n(t),t.s<1||t.eq(un))throw Error(Cn+"NaN");if(r.s<1)throw Error(Cn+(r.s?"NaN":"-Infinity"));return r.eq(un)?new n(0):($t=!1,e=Xi(lu(r,a),lu(t,a),a),$t=!0,St(e,i))};Te.minus=Te.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?v$(e,t):g$(e,(t.s=-t.s,t))};Te.modulo=Te.mod=function(t){var e,r=this,n=r.constructor,i=n.precision;if(t=new n(t),!t.s)throw Error(Cn+"NaN");return r.s?($t=!1,e=Xi(r,t,0,1).times(t),$t=!0,r.minus(e)):St(new n(r),i)};Te.naturalExponential=Te.exp=function(){return y$(this)};Te.naturalLogarithm=Te.ln=function(){return lu(this)};Te.negated=Te.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Te.plus=Te.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?g$(e,t):v$(e,(t.s=-t.s,t))};Te.precision=Te.sd=function(t){var e,r,n,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(No+t);if(e=er(i)+1,n=i.d.length-1,r=n*Nt+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return t&&e>r?e:r};Te.squareRoot=Te.sqrt=function(){var t,e,r,n,i,a,o,c=this,u=c.constructor;if(c.s<1){if(!c.s)return new u(0);throw Error(Cn+"NaN")}for(t=er(c),$t=!1,i=Math.sqrt(+c),i==0||i==1/0?(e=xi(c.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Al((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),n=new u(e)):n=new u(i.toString()),r=u.precision,i=o=r+3;;)if(a=n,n=a.plus(Xi(c,a,o+2)).times(.5),xi(a.d).slice(0,o)===(e=xi(n.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(St(a,r+1,0),a.times(a).eq(c)){n=a;break}}else if(e!="9999")break;o+=4}return $t=!0,St(n,r)};Te.times=Te.mul=function(t){var e,r,n,i,a,o,c,u,d,p=this,f=p.constructor,m=p.d,v=(t=new f(t)).d;if(!p.s||!t.s)return new f(0);for(t.s*=p.s,r=p.e+t.e,u=m.length,d=v.length,u<d&&(a=m,m=v,v=a,o=u,u=d,d=o),a=[],o=u+d,n=o;n--;)a.push(0);for(n=d;--n>=0;){for(e=0,i=u+n;i>n;)c=a[i]+v[n]*m[i-n-1]+e,a[i--]=c%gr|0,e=c/gr|0;a[i]=(a[i]+e)%gr|0}for(;!a[--o];)a.pop();return e?++r:a.shift(),t.d=a,t.e=r,$t?St(t,f.precision):t};Te.toDecimalPlaces=Te.todp=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(ki(t,0,El),e===void 0?e=n.rounding:ki(e,0,8),St(r,t+er(r)+1,e))};Te.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=$o(n,!0):(ki(t,0,El),e===void 0?e=i.rounding:ki(e,0,8),n=St(new i(n),t+1,e),r=$o(n,!0,t+1)),r};Te.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?$o(i):(ki(t,0,El),e===void 0?e=a.rounding:ki(e,0,8),n=St(new a(i),t+er(i)+1,e),r=$o(n.abs(),!1,t+er(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};Te.toInteger=Te.toint=function(){var t=this,e=t.constructor;return St(new e(t),er(t)+1,e.rounding)};Te.toNumber=function(){return+this};Te.toPower=Te.pow=function(t){var e,r,n,i,a,o,c=this,u=c.constructor,d=12,p=+(t=new u(t));if(!t.s)return new u(un);if(c=new u(c),!c.s){if(t.s<1)throw Error(Cn+"Infinity");return c}if(c.eq(un))return c;if(n=u.precision,t.eq(un))return St(c,n);if(e=t.e,r=t.d.length-1,o=e>=r,a=c.s,o){if((r=p<0?-p:p)<=m$){for(i=new u(un),e=Math.ceil(n/Nt+4),$t=!1;r%2&&(i=i.times(c),Mj(i.d,e)),r=Al(r/2),r!==0;)c=c.times(c),Mj(c.d,e);return $t=!0,t.s<0?new u(un).div(i):St(i,n)}}else if(a<0)throw Error(Cn+"NaN");return a=a<0&&t.d[Math.max(e,r)]&1?-1:1,c.s=1,$t=!1,i=t.times(lu(c,n+d)),$t=!0,i=y$(i),i.s=a,i};Te.toPrecision=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?(r=er(i),n=$o(i,r<=a.toExpNeg||r>=a.toExpPos)):(ki(t,1,El),e===void 0?e=a.rounding:ki(e,0,8),i=St(new a(i),t,e),r=er(i),n=$o(i,t<=r||r<=a.toExpNeg,t)),n};Te.toSignificantDigits=Te.tosd=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(ki(t,1,El),e===void 0?e=n.rounding:ki(e,0,8)),St(new n(r),t,e)};Te.toString=Te.valueOf=Te.val=Te.toJSON=Te[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=er(t),r=t.constructor;return $o(t,e<=r.toExpNeg||e>=r.toExpPos)};function g$(t,e){var r,n,i,a,o,c,u,d,p=t.constructor,f=p.precision;if(!t.s||!e.s)return e.s||(e=new p(t)),$t?St(e,f):e;if(u=t.d,d=e.d,o=t.e,i=e.e,u=u.slice(),a=o-i,a){for(a<0?(n=u,a=-a,c=d.length):(n=d,i=o,c=u.length),o=Math.ceil(f/Nt),c=o>c?o+1:c+1,a>c&&(a=c,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(c=u.length,a=d.length,c-a<0&&(a=c,n=d,d=u,u=n),r=0;a;)r=(u[--a]=u[a]+d[a]+r)/gr|0,u[a]%=gr;for(r&&(u.unshift(r),++i),c=u.length;u[--c]==0;)u.pop();return e.d=u,e.e=i,$t?St(e,f):e}function ki(t,e,r){if(t!==~~t||t<e||t>r)throw Error(No+t)}function xi(t){var e,r,n,i=t.length-1,a="",o=t[0];if(i>0){for(a+=o,e=1;e<i;e++)n=t[e]+"",r=Nt-n.length,r&&(a+=ja(r)),a+=n;o=t[e],n=o+"",r=Nt-n.length,r&&(a+=ja(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}var Xi=(function(){function t(n,i){var a,o=0,c=n.length;for(n=n.slice();c--;)a=n[c]*i+o,n[c]=a%gr|0,o=a/gr|0;return o&&n.unshift(o),n}function e(n,i,a,o){var c,u;if(a!=o)u=a>o?1:-1;else for(c=u=0;c<a;c++)if(n[c]!=i[c]){u=n[c]>i[c]?1:-1;break}return u}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]<i[a]?1:0,n[a]=o*gr+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,o){var c,u,d,p,f,m,v,b,w,x,k,S,A,C,T,O,N,R,$=n.constructor,K=n.s==i.s?1:-1,z=n.d,U=i.d;if(!n.s)return new $(n);if(!i.s)throw Error(Cn+"Division by zero");for(u=n.e-i.e,N=U.length,T=z.length,v=new $(K),b=v.d=[],d=0;U[d]==(z[d]||0);)++d;if(U[d]>(z[d]||0)&&--u,a==null?S=a=$.precision:o?S=a+(er(n)-er(i))+1:S=a,S<0)return new $(0);if(S=S/Nt+2|0,d=0,N==1)for(p=0,U=U[0],S++;(d<T||p)&&S--;d++)A=p*gr+(z[d]||0),b[d]=A/U|0,p=A%U|0;else{for(p=gr/(U[0]+1)|0,p>1&&(U=t(U,p),z=t(z,p),N=U.length,T=z.length),C=N,w=z.slice(0,N),x=w.length;x<N;)w[x++]=0;R=U.slice(),R.unshift(0),O=U[0],U[1]>=gr/2&&++O;do p=0,c=e(U,w,N,x),c<0?(k=w[0],N!=x&&(k=k*gr+(w[1]||0)),p=k/O|0,p>1?(p>=gr&&(p=gr-1),f=t(U,p),m=f.length,x=w.length,c=e(f,w,m,x),c==1&&(p--,r(f,N<m?R:U,m))):(p==0&&(c=p=1),f=U.slice()),m=f.length,m<x&&f.unshift(0),r(w,f,x),c==-1&&(x=w.length,c=e(U,w,N,x),c<1&&(p++,r(w,N<x?R:U,x))),x=w.length):c===0&&(p++,w=[0]),b[d++]=p,c&&w[0]?w[x++]=z[C]||0:(w=[z[C]],x=1);while((C++<T||w[0]!==void 0)&&S--)}return b[0]||b.shift(),v.e=u,St(v,o?a+er(v)+1:a)}})();function y$(t,e){var r,n,i,a,o,c,u=0,d=0,p=t.constructor,f=p.precision;if(er(t)>16)throw Error(Q1+er(t));if(!t.s)return new p(un);for($t=!1,c=f,o=new p(.03125);t.abs().gte(.1);)t=t.times(o),d+=5;for(n=Math.log(_o(2,d))/Math.LN10*2+5|0,c+=n,r=i=a=new p(un),p.precision=c;;){if(i=St(i.times(t),c),r=r.times(++u),o=a.plus(Xi(i,r,c)),xi(o.d).slice(0,c)===xi(a.d).slice(0,c)){for(;d--;)a=St(a.times(a),c);return p.precision=f,e==null?($t=!0,St(a,f)):a}a=o}}function er(t){for(var e=t.e*Nt,r=t.d[0];r>=10;r/=10)e++;return e}function hb(t,e,r){if(e>t.LN10.sd())throw $t=!0,r&&(t.precision=r),Error(Cn+"LN10 precision limit exceeded");return St(new t(t.LN10),e)}function ja(t){for(var e="";t--;)e+="0";return e}function lu(t,e){var r,n,i,a,o,c,u,d,p,f=1,m=10,v=t,b=v.d,w=v.constructor,x=w.precision;if(v.s<1)throw Error(Cn+(v.s?"NaN":"-Infinity"));if(v.eq(un))return new w(0);if(e==null?($t=!1,d=x):d=e,v.eq(10))return e==null&&($t=!0),hb(w,d);if(d+=m,w.precision=d,r=xi(b),n=r.charAt(0),a=er(v),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)v=v.times(t),r=xi(v.d),n=r.charAt(0),f++;a=er(v),n>1?(v=new w("0."+r),a++):v=new w(n+"."+r.slice(1))}else return u=hb(w,d+2,x).times(a+""),v=lu(new w(n+"."+r.slice(1)),d-m).plus(u),w.precision=x,e==null?($t=!0,St(v,x)):v;for(c=o=v=Xi(v.minus(un),v.plus(un),d),p=St(v.times(v),d),i=3;;){if(o=St(o.times(p),d),u=c.plus(Xi(o,new w(i),d)),xi(u.d).slice(0,d)===xi(c.d).slice(0,d))return c=c.times(2),a!==0&&(c=c.plus(hb(w,d+2,x).times(a+""))),c=Xi(c,new w(f),d),w.precision=x,e==null?($t=!0,St(c,x)):c;c=u,i+=2}}function $j(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;)++n;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(n,i),e){if(i-=n,r=r-n-1,t.e=Al(r/Nt),t.d=[],n=(r+1)%Nt,r<0&&(n+=Nt),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=Nt;n<i;)t.d.push(+e.slice(n,n+=Nt));e=e.slice(n),n=Nt-e.length}else n-=i;for(;n--;)e+="0";if(t.d.push(+e),$t&&(t.e>Ch||t.e<-Ch))throw Error(Q1+r)}else t.s=0,t.e=0,t.d=[0];return t}function St(t,e,r){var n,i,a,o,c,u,d,p,f=t.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(n=e-o,n<0)n+=Nt,i=e,d=f[p=0];else{if(p=Math.ceil((n+1)/Nt),a=f.length,p>=a)return t;for(d=a=f[p],o=1;a>=10;a/=10)o++;n%=Nt,i=n-Nt+o}if(r!==void 0&&(a=_o(10,o-i-1),c=d/a%10|0,u=e<0||f[p+1]!==void 0||d%a,u=r<4?(c||u)&&(r==0||r==(t.s<0?3:2)):c>5||c==5&&(r==4||u||r==6&&(n>0?i>0?d/_o(10,o-i):0:f[p-1])%10&1||r==(t.s<0?8:7))),e<1||!f[0])return u?(a=er(t),f.length=1,e=e-a-1,f[0]=_o(10,(Nt-e%Nt)%Nt),t.e=Al(-e/Nt)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(n==0?(f.length=p,a=1,p--):(f.length=p+1,a=_o(10,Nt-n),f[p]=i>0?(d/_o(10,o-i)%_o(10,i)|0)*a:0),u)for(;;)if(p==0){(f[0]+=a)==gr&&(f[0]=1,++t.e);break}else{if(f[p]+=a,f[p]!=gr)break;f[p--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if($t&&(t.e>Ch||t.e<-Ch))throw Error(Q1+er(t));return t}function v$(t,e){var r,n,i,a,o,c,u,d,p,f,m=t.constructor,v=m.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new m(t),$t?St(e,v):e;if(u=t.d,f=e.d,n=e.e,d=t.e,u=u.slice(),o=d-n,o){for(p=o<0,p?(r=u,o=-o,c=f.length):(r=f,n=d,c=u.length),i=Math.max(Math.ceil(v/Nt),c)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=u.length,c=f.length,p=i<c,p&&(c=i),i=0;i<c;i++)if(u[i]!=f[i]){p=u[i]<f[i];break}o=0}for(p&&(r=u,u=f,f=r,e.s=-e.s),c=u.length,i=f.length-c;i>0;--i)u[c++]=0;for(i=f.length;i>o;){if(u[--i]<f[i]){for(a=i;a&&u[--a]===0;)u[a]=gr-1;--u[a],u[i]+=gr}u[i]-=f[i]}for(;u[--c]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(e.d=u,e.e=n,$t?St(e,v):e):new m(0)}function $o(t,e,r){var n,i=er(t),a=xi(t.d),o=a.length;return e?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+ja(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+ja(-i-1)+a,r&&(n=r-o)>0&&(a+=ja(n))):i>=o?(a+=ja(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+ja(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=ja(n))),t.s<0?"-"+a:a}function Mj(t,e){if(t.length>e)return t.length=e,!0}function b$(t){var e,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(No+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return $j(o,a.toString())}else if(typeof a!="string")throw Error(No+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,rX.test(a))$j(o,a);else throw Error(No+a)}if(i.prototype=Te,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=b$,i.config=i.set=nX,t===void 0&&(t={}),t)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function nX(t){if(!t||typeof t!="object")throw Error(Cn+"Object expected");var e,r,n,i=["precision",1,El,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<i.length;e+=3)if((n=t[r=i[e]])!==void 0)if(Al(n)===n&&n>=i[e+1]&&n<=i[e+2])this[r]=n;else throw Error(No+r+": "+n);if((n=t[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(No+r+": "+n);return this}var e_=b$(tX);un=new e_(1);const xt=e_;function iX(t){return lX(t)||sX(t)||oX(t)||aX()}function aX(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
469
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
470
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
471
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S$(t,e){if(t){if(typeof t=="string")return Hx(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 Hx(t,e)}}function Hx(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
|
|
472
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
473
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YX(t,e){if(t){if(typeof t=="string")return Kx(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 Kx(t,e)}}function JX(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ZX(t){if(Array.isArray(t))return Kx(t)}function Kx(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 Uj(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 Wt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Uj(Object(r),!0).forEach(function(n){qs(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Uj(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qs(t,e,r){return e=QX(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function QX(t){var e=eY(t,"string");return du(e)=="symbol"?e:e+""}function eY(t,e){if(du(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(du(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dn(t,e,r){return tt(t)||tt(e)?r:sr(e)?On(t,e,r):Je(e)?e(t):r}function Lc(t,e,r,n){var i=ZV(t,function(c){return dn(c,e)});if(r==="number"){var a=i.filter(function(c){return ge(c)||parseFloat(c)});return a.length?[$p(a),Ip(a)]:[1/0,-1/0]}var o=n?i.filter(function(c){return!tt(c)}):i;return o.map(function(c){return sr(c)||c instanceof Date?c:""})}var tY=function(e){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,c=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(c<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var u=a.range,d=0;d<c;d++){var p=d>0?i[d-1].coordinate:i[c-1].coordinate,f=i[d].coordinate,m=d>=c-1?i[0].coordinate:i[d+1].coordinate,v=void 0;if(Jn(f-p)!==Jn(m-f)){var b=[];if(Jn(m-f)===Jn(u[1]-u[0])){v=m;var w=f+u[1]-u[0];b[0]=Math.min(w,(w+p)/2),b[1]=Math.max(w,(w+p)/2)}else{v=p;var x=m+u[1]-u[0];b[0]=Math.min(f,(x+f)/2),b[1]=Math.max(f,(x+f)/2)}var k=[Math.min(f,(v+f)/2),Math.max(f,(v+f)/2)];if(e>k[0]&&e<=k[1]||e>=b[0]&&e<=b[1]){o=i[d].index;break}}else{var S=Math.min(p,m),A=Math.max(p,m);if(e>(S+f)/2&&e<=(A+f)/2){o=i[d].index;break}}}else for(var C=0;C<c;C++)if(C===0&&e<=(n[C].coordinate+n[C+1].coordinate)/2||C>0&&C<c-1&&e>(n[C].coordinate+n[C-1].coordinate)/2&&e<=(n[C].coordinate+n[C+1].coordinate)/2||C===c-1&&e>(n[C].coordinate+n[C-1].coordinate)/2){o=n[C].index;break}return o},t_=function(e){var r,n=e,i=n.type.displayName,a=(r=e.type)!==null&&r!==void 0&&r.defaultProps?Wt(Wt({},e.type.defaultProps),e.props):e.props,o=a.stroke,c=a.fill,u;switch(i){case"Line":u=o;break;case"Area":case"Radar":u=o&&o!=="none"?o:c;break;default:u=c;break}return u},rY=function(e){var r=e.barSize,n=e.totalSize,i=e.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},c=Object.keys(a),u=0,d=c.length;u<d;u++)for(var p=a[c[u]].stackGroups,f=Object.keys(p),m=0,v=f.length;m<v;m++){var b=p[f[m]],w=b.items,x=b.cateAxisId,k=w.filter(function(N){return Gi(N.type).indexOf("Bar")>=0});if(k&&k.length){var S=k[0].type.defaultProps,A=S!==void 0?Wt(Wt({},S),k[0].props):k[0].props,C=A.barSize,T=A[x];o[T]||(o[T]=[]);var O=tt(C)?r:C;o[T].push({item:k[0],stackList:k.slice(1),barSize:tt(O)?void 0:Io(O,n,0)})}}return o},nY=function(e){var r=e.barGap,n=e.barCategoryGap,i=e.bandSize,a=e.sizeList,o=a===void 0?[]:a,c=e.maxBarSize,u=o.length;if(u<1)return null;var d=Io(r,i,0,!0),p,f=[];if(o[0].barSize===+o[0].barSize){var m=!1,v=i/u,b=o.reduce(function(C,T){return C+T.barSize||0},0);b+=(u-1)*d,b>=i&&(b-=(u-1)*d,d=0),b>=i&&v>0&&(m=!0,v*=.9,b=u*v);var w=(i-b)/2>>0,x={offset:w-d,size:0};p=o.reduce(function(C,T){var O={item:T.item,position:{offset:x.offset+x.size+d,size:m?v:T.barSize}},N=[].concat(Bj(C),[O]);return x=N[N.length-1].position,T.stackList&&T.stackList.length&&T.stackList.forEach(function(R){N.push({item:R,position:x})}),N},f)}else{var k=Io(n,i,0,!0);i-2*k-(u-1)*d<=0&&(d=0);var S=(i-2*k-(u-1)*d)/u;S>1&&(S>>=0);var A=c===+c?Math.min(S,c):S;p=o.reduce(function(C,T,O){var N=[].concat(Bj(C),[{item:T.item,position:{offset:k+(S+d)*O+(S-A)/2,size:A}}]);return T.stackList&&T.stackList.length&&T.stackList.forEach(function(R){N.push({item:R,position:N[N.length-1].position})}),N},f)}return p},iY=function(e,r,n,i){var a=n.children,o=n.width,c=n.margin,u=o-(c.left||0)-(c.right||0),d=j$({children:a,legendWidth:u});if(d){var p=i||{},f=p.width,m=p.height,v=d.align,b=d.verticalAlign,w=d.layout;if((w==="vertical"||w==="horizontal"&&b==="middle")&&v!=="center"&&ge(e[v]))return Wt(Wt({},e),{},qs({},v,e[v]+(f||0)));if((w==="horizontal"||w==="vertical"&&v==="center")&&b!=="middle"&&ge(e[b]))return Wt(Wt({},e),{},qs({},b,e[b]+(m||0)))}return e},aY=function(e,r,n){return tt(r)?!0:e==="horizontal"?r==="yAxis":e==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},N$=function(e,r,n,i,a){var o=r.props.children,c=Tn(o,Wu).filter(function(d){return aY(i,a,d.props.direction)});if(c&&c.length){var u=c.map(function(d){return d.props.dataKey});return e.reduce(function(d,p){var f=dn(p,n);if(tt(f))return d;var m=Array.isArray(f)?[$p(f),Ip(f)]:[f,f],v=u.reduce(function(b,w){var x=dn(p,w,0),k=m[0]-Math.abs(Array.isArray(x)?x[0]:x),S=m[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(k,b[0]),Math.max(S,b[1])]},[1/0,-1/0]);return[Math.min(v[0],d[0]),Math.max(v[1],d[1])]},[1/0,-1/0])}return null},oY=function(e,r,n,i,a){var o=r.map(function(c){return N$(e,c,n,a,i)}).filter(function(c){return!tt(c)});return o&&o.length?o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]):null},P$=function(e,r,n,i,a){var o=r.map(function(u){var d=u.props.dataKey;return n==="number"&&d&&N$(e,u,d,i)||Lc(e,d,n,a)});if(n==="number")return o.reduce(function(u,d){return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]);var c={};return o.reduce(function(u,d){for(var p=0,f=d.length;p<f;p++)c[d[p]]||(c[d[p]]=!0,u.push(d[p]));return u},[])},R$=function(e,r){return e==="horizontal"&&r==="xAxis"||e==="vertical"&&r==="yAxis"||e==="centric"&&r==="angleAxis"||e==="radial"&&r==="radiusAxis"},I$=function(e,r,n,i){if(i)return e.map(function(u){return u.coordinate});var a,o,c=e.map(function(u){return u.coordinate===r&&(a=!0),u.coordinate===n&&(o=!0),u.coordinate});return a||c.push(r),o||c.push(n),c},Ki=function(e,r,n){if(!e)return null;var i=e.scale,a=e.duplicateDomain,o=e.type,c=e.range,u=e.realScaleType==="scaleBand"?i.bandwidth()/2:2,d=(r||n)&&o==="category"&&i.bandwidth?i.bandwidth()/u:0;if(d=e.axisType==="angleAxis"&&(c==null?void 0:c.length)>=2?Jn(c[0]-c[1])*2*d:d,r&&(e.ticks||e.niceTicks)){var p=(e.ticks||e.niceTicks).map(function(f){var m=a?a.indexOf(f):f;return{coordinate:i(m)+d,value:f,offset:d}});return p.filter(function(f){return!Lu(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,m){return{coordinate:i(f)+d,value:f,index:m,offset:d}}):i.ticks&&!n?i.ticks(e.tickCount).map(function(f){return{coordinate:i(f)+d,value:f,offset:d}}):i.domain().map(function(f,m){return{coordinate:i(f)+d,value:a?a[f]:f,index:m,offset:d}})},pb=new WeakMap,Ef=function(e,r){if(typeof r!="function")return e;pb.has(e)||pb.set(e,new WeakMap);var n=pb.get(e);if(n.has(r))return n.get(r);var i=function(){e.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},sY=function(e,r,n){var i=e.scale,a=e.type,o=e.layout,c=e.axisType;if(i==="auto")return o==="radial"&&c==="radiusAxis"?{scale:nu(),realScaleType:"band"}:o==="radial"&&c==="angleAxis"?{scale:Eh(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Dc(),realScaleType:"point"}:a==="category"?{scale:nu(),realScaleType:"band"}:{scale:Eh(),realScaleType:"linear"};if(Ro(i)){var u="scale".concat(wp(i));return{scale:(Aj[u]||Dc)(),realScaleType:Aj[u]?u:"point"}}return Je(i)?{scale:i}:{scale:Dc(),realScaleType:"point"}},qj=1e-4,lY=function(e){var r=e.domain();if(!(!r||r.length<=2)){var n=r.length,i=e.range(),a=Math.min(i[0],i[1])-qj,o=Math.max(i[0],i[1])+qj,c=e(r[0]),u=e(r[n-1]);(c<a||c>o||u<a||u>o)&&e.domain([r[0],r[n-1]])}},cY=function(e,r){if(!e)return null;for(var n=0,i=e.length;n<i;n++)if(e[n].item===r)return e[n].position;return null},uY=function(e,r){if(!r||r.length!==2||!ge(r[0])||!ge(r[1]))return e;var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]),a=[e[0],e[1]];return(!ge(e[0])||e[0]<n)&&(a[0]=n),(!ge(e[1])||e[1]>i)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]<n&&(a[1]=n),a},dY=function(e){var r=e.length;if(!(r<=0))for(var n=0,i=e[0].length;n<i;++n)for(var a=0,o=0,c=0;c<r;++c){var u=Lu(e[c][n][1])?e[c][n][0]:e[c][n][1];u>=0?(e[c][n][0]=a,e[c][n][1]=a+u,a=e[c][n][1]):(e[c][n][0]=o,e[c][n][1]=o+u,o=e[c][n][1])}},fY=function(e){var r=e.length;if(!(r<=0))for(var n=0,i=e[0].length;n<i;++n)for(var a=0,o=0;o<r;++o){var c=Lu(e[o][n][1])?e[o][n][0]:e[o][n][1];c>=0?(e[o][n][0]=a,e[o][n][1]=a+c,a=e[o][n][1]):(e[o][n][0]=0,e[o][n][1]=0)}},hY={sign:dY,expand:YF,none:Ws,silhouette:JF,wiggle:ZF,positive:fY},pY=function(e,r,n){var i=r.map(function(c){return c.props.dataKey}),a=hY[n],o=XF().keys(i).value(function(c,u){return+dn(c,u,0)}).order(_x).offset(a);return o(e)},mY=function(e,r,n,i,a,o){if(!e)return null;var c=o?r.reverse():r,u={},d=c.reduce(function(f,m){var v,b=(v=m.type)!==null&&v!==void 0&&v.defaultProps?Wt(Wt({},m.type.defaultProps),m.props):m.props,w=b.stackId,x=b.hide;if(x)return f;var k=b[n],S=f[k]||{hasStack:!1,stackGroups:{}};if(sr(w)){var A=S.stackGroups[w]||{numericAxisId:n,cateAxisId:i,items:[]};A.items.push(m),S.hasStack=!0,S.stackGroups[w]=A}else S.stackGroups[zu("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[m]};return Wt(Wt({},f),{},qs({},k,S))},u),p={};return Object.keys(d).reduce(function(f,m){var v=d[m];if(v.hasStack){var b={};v.stackGroups=Object.keys(v.stackGroups).reduce(function(w,x){var k=v.stackGroups[x];return Wt(Wt({},w),{},qs({},x,{numericAxisId:n,cateAxisId:i,items:k.items,stackedData:pY(e,k.items,a)}))},b)}return Wt(Wt({},f),{},qs({},m,v))},p)},gY=function(e,r){var n=r.realScaleType,i=r.type,a=r.tickCount,o=r.originalDomain,c=r.allowDecimals,u=n||r.scale;if(u!=="auto"&&u!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var d=e.domain();if(!d.length)return null;var p=OX(d,a,c);return e.domain([$p(p),Ip(p)]),{niceTicks:p}}if(a&&i==="number"){var f=e.domain(),m=TX(f,a,c);return{niceTicks:m}}return null};function Fj(t){var e=t.axis,r=t.ticks,n=t.bandSize,i=t.entry,a=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!tt(i[e.dataKey])){var c=nh(r,"value",i[e.dataKey]);if(c)return c.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var u=dn(i,tt(o)?e.dataKey:o);return tt(u)?null:e.scale(u)}var Hj=function(e){var r=e.axis,n=e.ticks,i=e.offset,a=e.bandSize,o=e.entry,c=e.index;if(r.type==="category")return n[c]?n[c].coordinate+i:null;var u=dn(o,r.dataKey,r.domain[c]);return tt(u)?null:r.scale(u)-a/2+i},yY=function(e){var r=e.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return i<=0&&a>=0?0:a<0?a:i}return n[0]},vY=function(e,r){var n,i=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Wt(Wt({},e.type.defaultProps),e.props):e.props,a=i.stackId;if(sr(a)){var o=r[a];if(o){var c=o.items.indexOf(e);return c>=0?o.stackedData[c]:null}}return null},bY=function(e){return e.reduce(function(r,n){return[$p(n.concat([r[0]]).filter(ge)),Ip(n.concat([r[1]]).filter(ge))]},[1/0,-1/0])},$$=function(e,r,n){return Object.keys(e).reduce(function(i,a){var o=e[a],c=o.stackedData,u=c.reduce(function(d,p){var f=bY(p.slice(r,n+1));return[Math.min(d[0],f[0]),Math.max(d[1],f[1])]},[1/0,-1/0]);return[Math.min(u[0],i[0]),Math.max(u[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},Wj=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Kj=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Gx=function(e,r,n){if(Je(e))return e(r,n);if(!Array.isArray(e))return r;var i=[];if(ge(e[0]))i[0]=n?e[0]:Math.min(e[0],r[0]);else if(Wj.test(e[0])){var a=+Wj.exec(e[0])[1];i[0]=r[0]-a}else Je(e[0])?i[0]=e[0](r[0]):i[0]=r[0];if(ge(e[1]))i[1]=n?e[1]:Math.max(e[1],r[1]);else if(Kj.test(e[1])){var o=+Kj.exec(e[1])[1];i[1]=r[1]+o}else Je(e[1])?i[1]=e[1](r[1]):i[1]=r[1];return i},Ph=function(e,r,n){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!n||i>0)return i}if(e&&r&&r.length>=2){for(var a=C1(r,function(f){return f.coordinate}),o=1/0,c=1,u=a.length;c<u;c++){var d=a[c],p=a[c-1];o=Math.min((d.coordinate||0)-(p.coordinate||0),o)}return o===1/0?0:o}return n?void 0:0},Gj=function(e,r,n){return!e||!e.length||Mp(e,On(n,"type.defaultProps.domain"))?r:e},M$=function(e,r){var n=e.type.defaultProps?Wt(Wt({},e.type.defaultProps),e.props):e.props,i=n.dataKey,a=n.name,o=n.unit,c=n.formatter,u=n.tooltipType,d=n.chartType,p=n.hide;return Wt(Wt({},at(e,!1)),{},{dataKey:i,unit:o,formatter:c,name:a||i,color:t_(e),value:dn(r,i),type:u,payload:r,chartType:d,hide:p})};function fu(t){"@babel/helpers - typeof";return fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fu(t)}function Vj(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 Xj(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Vj(Object(r),!0).forEach(function(n){xY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Vj(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function xY(t,e,r){return e=wY(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wY(t){var e=_Y(t,"string");return fu(e)=="symbol"?e:e+""}function _Y(t,e){if(fu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(fu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Rh=Math.PI/180,SY=function(e){return e*180/Math.PI},wr=function(e,r,n,i){return{x:e+Math.cos(-Rh*i)*n,y:r+Math.sin(-Rh*i)*n}},kY=function(e,r){var n=e.x,i=e.y,a=r.x,o=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(i-o,2))},EY=function(e,r){var n=e.x,i=e.y,a=r.cx,o=r.cy,c=kY({x:n,y:i},{x:a,y:o});if(c<=0)return{radius:c};var u=(n-a)/c,d=Math.acos(u);return i>o&&(d=2*Math.PI-d),{radius:c,angle:SY(d),angleInRadian:d}},AY=function(e){var r=e.startAngle,n=e.endAngle,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return{startAngle:r-o*360,endAngle:n-o*360}},OY=function(e,r){var n=r.startAngle,i=r.endAngle,a=Math.floor(n/360),o=Math.floor(i/360),c=Math.min(a,o);return e+c*360},Yj=function(e,r){var n=e.x,i=e.y,a=EY({x:n,y:i},r),o=a.radius,c=a.angle,u=r.innerRadius,d=r.outerRadius;if(o<u||o>d)return!1;if(o===0)return!0;var p=AY(r),f=p.startAngle,m=p.endAngle,v=c,b;if(f<=m){for(;v>m;)v-=360;for(;v<f;)v+=360;b=v>=f&&v<=m}else{for(;v>f;)v-=360;for(;v<m;)v+=360;b=v>=m&&v<=f}return b?Xj(Xj({},r),{},{radius:o,angle:OY(v,r)}):null};function hu(t){"@babel/helpers - typeof";return hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hu(t)}var TY=["offset"];function CY(t){return RY(t)||PY(t)||NY(t)||jY()}function jY(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
474
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
466
|
+
height and width.`,Y,G,o,u,p,f,r);var Z=!Array.isArray(v)&&Gi(v.type).endsWith("Chart");return M.Children.map(v,function(W){return M.isValidElement(W)?j.cloneElement(W,xf({width:Y,height:G},Z?{style:xf({height:"100%",width:"100%",maxHeight:G,maxWidth:Y},W.props.style)}:{})):W})},[r,v,u,m,f,p,$,o]);return M.createElement("div",{id:x?"".concat(x):void 0,className:ot("recharts-responsive-container",k),style:xf(xf({},C),{},{width:o,height:u,minWidth:p,minHeight:f,maxHeight:m}),ref:T},U)}),NI=function(e){return null};NI.displayName="Cell";function tu(t){"@babel/helpers - typeof";return tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tu(t)}function NC(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 Nx(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?NC(Object(r),!0).forEach(function(n){BW(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):NC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function BW(t,e,r){return e=UW(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function UW(t){var e=qW(t,"string");return tu(e)=="symbol"?e:e+""}function qW(t,e){if(tu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(tu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ks={widthCache:{},cacheCount:0},FW=2e3,HW={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},PC="recharts_measurement_span";function WW(t){var e=Nx({},t);return Object.keys(e).forEach(function(r){e[r]||delete e[r]}),e}var Mc=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Sl.isSsr)return{width:0,height:0};var n=WW(r),i=JSON.stringify({text:e,copyStyle:n});if(ks.widthCache[i])return ks.widthCache[i];try{var a=document.getElementById(PC);a||(a=document.createElement("span"),a.setAttribute("id",PC),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=Nx(Nx({},HW),n);Object.assign(a.style,o),a.textContent="".concat(e);var c=a.getBoundingClientRect(),u={width:c.width,height:c.height};return ks.widthCache[i]=u,++ks.cacheCount>FW&&(ks.cacheCount=0,ks.widthCache={}),u}catch{return{width:0,height:0}}},KW=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function ru(t){"@babel/helpers - typeof";return ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ru(t)}function gh(t,e){return YW(t)||XW(t,e)||VW(t,e)||GW()}function GW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
467
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VW(t,e){if(t){if(typeof t=="string")return RC(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 RC(t,e)}}function RC(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 XW(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function YW(t){if(Array.isArray(t))return t}function JW(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function IC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,QW(n.key),n)}}function ZW(t,e,r){return e&&IC(t.prototype,e),r&&IC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function QW(t){var e=eK(t,"string");return ru(e)=="symbol"?e:e+""}function eK(t,e){if(ru(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ru(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var $C=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,MC=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,tK=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,rK=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,PI={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},nK=Object.keys(PI),Rs="NaN";function iK(t,e){return t*PI[e]}var wf=(function(){function t(e,r){JW(this,t),this.num=e,this.unit=r,this.num=e,this.unit=r,Number.isNaN(e)&&(this.unit=""),r!==""&&!tK.test(r)&&(this.num=NaN,this.unit=""),nK.includes(r)&&(this.num=iK(e,r),this.unit="px")}return ZW(t,[{key:"add",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num+r.num,this.unit)}},{key:"subtract",value:function(r){return this.unit!==r.unit?new t(NaN,""):new t(this.num-r.num,this.unit)}},{key:"multiply",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num*r.num,this.unit||r.unit)}},{key:"divide",value:function(r){return this.unit!==""&&r.unit!==""&&this.unit!==r.unit?new t(NaN,""):new t(this.num/r.num,this.unit||r.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(r){var n,i=(n=rK.exec(r))!==null&&n!==void 0?n:[],a=gh(i,3),o=a[1],c=a[2];return new t(parseFloat(o),c??"")}}])})();function RI(t){if(t.includes(Rs))return Rs;for(var e=t;e.includes("*")||e.includes("/");){var r,n=(r=$C.exec(e))!==null&&r!==void 0?r:[],i=gh(n,4),a=i[1],o=i[2],c=i[3],u=wf.parse(a??""),d=wf.parse(c??""),p=o==="*"?u.multiply(d):u.divide(d);if(p.isNaN())return Rs;e=e.replace($C,p.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var f,m=(f=MC.exec(e))!==null&&f!==void 0?f:[],v=gh(m,4),b=v[1],w=v[2],x=v[3],k=wf.parse(b??""),S=wf.parse(x??""),A=w==="+"?k.add(S):k.subtract(S);if(A.isNaN())return Rs;e=e.replace(MC,A.toString())}return e}var DC=/\(([^()]*)\)/;function aK(t){for(var e=t;e.includes("(");){var r=DC.exec(e),n=gh(r,2),i=n[1];e=e.replace(DC,RI(i))}return e}function oK(t){var e=t.replace(/\s+/g,"");return e=aK(e),e=RI(e),e}function sK(t){try{return oK(t)}catch{return Rs}}function J0(t){var e=sK(t.slice(5,-1));return e===Rs?"":e}var lK=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],cK=["dx","dy","angle","className","breakAll"];function Px(){return Px=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Px.apply(this,arguments)}function LC(t,e){if(t==null)return{};var r=uK(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function uK(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function zC(t,e){return pK(t)||hK(t,e)||fK(t,e)||dK()}function dK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
468
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fK(t,e){if(t){if(typeof t=="string")return BC(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 BC(t,e)}}function BC(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 hK(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function pK(t){if(Array.isArray(t))return t}var II=/[ \f\n\r\t\v\u2028\u2029]+/,$I=function(e){var r=e.children,n=e.breakAll,i=e.style;try{var a=[];tt(r)||(n?a=r.toString().split(""):a=r.toString().split(II));var o=a.map(function(u){return{word:u,width:Mc(u,i).width}}),c=n?0:Mc(" ",i).width;return{wordsWithComputedWidth:o,spaceWidth:c}}catch{return null}},mK=function(e,r,n,i,a){var o=e.maxLines,c=e.children,u=e.style,d=e.breakAll,p=ge(o),f=c,m=function(){var Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return Y.reduce(function(G,Z){var W=Z.word,Q=Z.width,L=G[G.length-1];if(L&&(i==null||a||L.width+Q+n<Number(i)))L.words.push(W),L.width+=Q+n;else{var I={words:[W],width:Q};G.push(I)}return G},[])},v=m(r),b=function(Y){return Y.reduce(function(G,Z){return G.width>Z.width?G:Z})};if(!p)return v;for(var w="…",x=function(Y){var G=f.slice(0,Y),Z=$I({breakAll:d,style:u,children:G+w}).wordsWithComputedWidth,W=m(Z),Q=W.length>o||b(W).width>Number(i);return[Q,W]},k=0,S=f.length-1,A=0,C;k<=S&&A<=f.length-1;){var T=Math.floor((k+S)/2),O=T-1,N=x(O),R=zC(N,2),$=R[0],K=R[1],z=x(T),U=zC(z,1),F=U[0];if(!$&&!F&&(k=T+1),$&&F&&(S=T-1),!$&&F){C=K;break}A++}return C||v},UC=function(e){var r=tt(e)?[]:e.toString().split(II);return[{words:r}]},gK=function(e){var r=e.width,n=e.scaleToFit,i=e.children,a=e.style,o=e.breakAll,c=e.maxLines;if((r||n)&&!Sl.isSsr){var u,d,p=$I({breakAll:o,children:i,style:a});if(p){var f=p.wordsWithComputedWidth,m=p.spaceWidth;u=f,d=m}else return UC(i);return mK({breakAll:o,children:i,maxLines:c,style:a},u,d,r,n)}return UC(i)},qC="#808080",yh=function(e){var r=e.x,n=r===void 0?0:r,i=e.y,a=i===void 0?0:i,o=e.lineHeight,c=o===void 0?"1em":o,u=e.capHeight,d=u===void 0?"0.71em":u,p=e.scaleToFit,f=p===void 0?!1:p,m=e.textAnchor,v=m===void 0?"start":m,b=e.verticalAnchor,w=b===void 0?"end":b,x=e.fill,k=x===void 0?qC:x,S=LC(e,lK),A=j.useMemo(function(){return gK({breakAll:S.breakAll,children:S.children,maxLines:S.maxLines,scaleToFit:f,style:S.style,width:S.width})},[S.breakAll,S.children,S.maxLines,f,S.style,S.width]),C=S.dx,T=S.dy,O=S.angle,N=S.className,R=S.breakAll,$=LC(S,cK);if(!sr(n)||!sr(a))return null;var K=n+(ge(C)?C:0),z=a+(ge(T)?T:0),U;switch(w){case"start":U=J0("calc(".concat(d,")"));break;case"middle":U=J0("calc(".concat((A.length-1)/2," * -").concat(c," + (").concat(d," / 2))"));break;default:U=J0("calc(".concat(A.length-1," * -").concat(c,")"));break}var F=[];if(f){var X=A[0].width,Y=S.width;F.push("scale(".concat((ge(Y)?Y/X:1)/X,")"))}return O&&F.push("rotate(".concat(O,", ").concat(K,", ").concat(z,")")),F.length&&($.transform=F.join(" ")),M.createElement("text",Px({},at($,!0),{x:K,y:z,className:ot("recharts-text",N),textAnchor:v,fill:k.includes("url")?qC:k}),A.map(function(G,Z){var W=G.words.join(R?"":" ");return M.createElement("tspan",{x:K,dy:Z===0?U:c,key:"".concat(W,"-").concat(Z)},W)}))};function La(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function yK(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function N1(t){let e,r,n;t.length!==2?(e=La,r=(c,u)=>La(t(c),u),n=(c,u)=>t(c)-u):(e=t===La||t===yK?t:vK,r=t,n=t);function i(c,u,d=0,p=c.length){if(d<p){if(e(u,u)!==0)return p;do{const f=d+p>>>1;r(c[f],u)<0?d=f+1:p=f}while(d<p)}return d}function a(c,u,d=0,p=c.length){if(d<p){if(e(u,u)!==0)return p;do{const f=d+p>>>1;r(c[f],u)<=0?d=f+1:p=f}while(d<p)}return d}function o(c,u,d=0,p=c.length){const f=i(c,u,d,p-1);return f>d&&n(c[f-1],u)>-n(c[f],u)?f-1:f}return{left:i,center:o,right:a}}function vK(){return 0}function MI(t){return t===null?NaN:+t}function*bK(t,e){for(let r of t)r!=null&&(r=+r)>=r&&(yield r)}const xK=N1(La),Uu=xK.right;N1(MI).center;class FC extends Map{constructor(e,r=SK){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(const[n,i]of e)this.set(n,i)}get(e){return super.get(HC(this,e))}has(e){return super.has(HC(this,e))}set(e,r){return super.set(wK(this,e),r)}delete(e){return super.delete(_K(this,e))}}function HC({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):r}function wK({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function _K({_intern:t,_key:e},r){const n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function SK(t){return t!==null&&typeof t=="object"?t.valueOf():t}function kK(t=La){if(t===La)return DI;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||n===0?n:(t(r,r)===0)-(t(e,e)===0)}}function DI(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const EK=Math.sqrt(50),AK=Math.sqrt(10),OK=Math.sqrt(2);function vh(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),a=n/Math.pow(10,i),o=a>=EK?10:a>=AK?5:a>=OK?2:1;let c,u,d;return i<0?(d=Math.pow(10,-i)/o,c=Math.round(t*d),u=Math.round(e*d),c/d<t&&++c,u/d>e&&--u,d=-d):(d=Math.pow(10,i)*o,c=Math.round(t/d),u=Math.round(e/d),c*d<t&&++c,u*d>e&&--u),u<c&&.5<=r&&r<2?vh(t,e,r*2):[c,u,d]}function Rx(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];const n=e<t,[i,a,o]=n?vh(e,t,r):vh(t,e,r);if(!(a>=i))return[];const c=a-i+1,u=new Array(c);if(n)if(o<0)for(let d=0;d<c;++d)u[d]=(a-d)/-o;else for(let d=0;d<c;++d)u[d]=(a-d)*o;else if(o<0)for(let d=0;d<c;++d)u[d]=(i+d)/-o;else for(let d=0;d<c;++d)u[d]=(i+d)*o;return u}function Ix(t,e,r){return e=+e,t=+t,r=+r,vh(t,e,r)[2]}function $x(t,e,r){e=+e,t=+t,r=+r;const n=e<t,i=n?Ix(e,t,r):Ix(t,e,r);return(n?-1:1)*(i<0?1/-i:i)}function WC(t,e){let r;for(const n of t)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function KC(t,e){let r;for(const n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function LI(t,e,r=0,n=1/0,i){if(e=Math.floor(e),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(t.length-1,n)),!(r<=e&&e<=n))return t;for(i=i===void 0?DI:kK(i);n>r;){if(n-r>600){const u=n-r+1,d=e-r+1,p=Math.log(u),f=.5*Math.exp(2*p/3),m=.5*Math.sqrt(p*f*(u-f)/u)*(d-u/2<0?-1:1),v=Math.max(r,Math.floor(e-d*f/u+m)),b=Math.min(n,Math.floor(e+(u-d)*f/u+m));LI(t,e,v,b,i)}const a=t[e];let o=r,c=n;for(yc(t,r,e),i(t[n],a)>0&&yc(t,r,n);o<c;){for(yc(t,o,c),++o,--c;i(t[o],a)<0;)++o;for(;i(t[c],a)>0;)--c}i(t[r],a)===0?yc(t,r,c):(++c,yc(t,c,n)),c<=e&&(r=c+1),e<=c&&(n=c-1)}return t}function yc(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function TK(t,e,r){if(t=Float64Array.from(bK(t)),!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return KC(t);if(e>=1)return WC(t);var n,i=(n-1)*e,a=Math.floor(i),o=WC(LI(t,a).subarray(0,a+1)),c=KC(t.subarray(a+1));return o+(c-o)*(i-a)}}function CK(t,e,r=MI){if(!(!(n=t.length)||isNaN(e=+e))){if(e<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t),c=+r(t[a+1],a+1,t);return o+(c-o)*(i-a)}}function jK(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((e-t)/r))|0,a=new Array(i);++n<i;)a[n]=t+n*r;return a}function Nn(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function ia(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const Mx=Symbol("implicit");function P1(){var t=new FC,e=[],r=[],n=Mx;function i(a){let o=t.get(a);if(o===void 0){if(n!==Mx)return n;t.set(a,o=e.push(a)-1)}return r[o%r.length]}return i.domain=function(a){if(!arguments.length)return e.slice();e=[],t=new FC;for(const o of a)t.has(o)||t.set(o,e.push(o)-1);return i},i.range=function(a){return arguments.length?(r=Array.from(a),i):r.slice()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return P1(e,r).unknown(n)},Nn.apply(i,arguments),i}function nu(){var t=P1().unknown(void 0),e=t.domain,r=t.range,n=0,i=1,a,o,c=!1,u=0,d=0,p=.5;delete t.unknown;function f(){var m=e().length,v=i<n,b=v?i:n,w=v?n:i;a=(w-b)/Math.max(1,m-u+d*2),c&&(a=Math.floor(a)),b+=(w-b-a*(m-u))*p,o=a*(1-u),c&&(b=Math.round(b),o=Math.round(o));var x=jK(m).map(function(k){return b+a*k});return r(v?x.reverse():x)}return t.domain=function(m){return arguments.length?(e(m),f()):e()},t.range=function(m){return arguments.length?([n,i]=m,n=+n,i=+i,f()):[n,i]},t.rangeRound=function(m){return[n,i]=m,n=+n,i=+i,c=!0,f()},t.bandwidth=function(){return o},t.step=function(){return a},t.round=function(m){return arguments.length?(c=!!m,f()):c},t.padding=function(m){return arguments.length?(u=Math.min(1,d=+m),f()):u},t.paddingInner=function(m){return arguments.length?(u=Math.min(1,m),f()):u},t.paddingOuter=function(m){return arguments.length?(d=+m,f()):d},t.align=function(m){return arguments.length?(p=Math.max(0,Math.min(1,m)),f()):p},t.copy=function(){return nu(e(),[n,i]).round(c).paddingInner(u).paddingOuter(d).align(p)},Nn.apply(f(),arguments)}function zI(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return zI(e())},t}function Dc(){return zI(nu.apply(null,arguments).paddingInner(1))}function R1(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function BI(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function qu(){}var iu=.7,bh=1/iu,Us="\\s*([+-]?\\d+)\\s*",au="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_i="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",NK=/^#([0-9a-f]{3,8})$/,PK=new RegExp(`^rgb\\(${Us},${Us},${Us}\\)$`),RK=new RegExp(`^rgb\\(${_i},${_i},${_i}\\)$`),IK=new RegExp(`^rgba\\(${Us},${Us},${Us},${au}\\)$`),$K=new RegExp(`^rgba\\(${_i},${_i},${_i},${au}\\)$`),MK=new RegExp(`^hsl\\(${au},${_i},${_i}\\)$`),DK=new RegExp(`^hsla\\(${au},${_i},${_i},${au}\\)$`),GC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};R1(qu,ou,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:VC,formatHex:VC,formatHex8:LK,formatHsl:zK,formatRgb:XC,toString:XC});function VC(){return this.rgb().formatHex()}function LK(){return this.rgb().formatHex8()}function zK(){return UI(this).formatHsl()}function XC(){return this.rgb().formatRgb()}function ou(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=NK.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?YC(e):r===3?new Zr(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?_f(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?_f(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=PK.exec(t))?new Zr(e[1],e[2],e[3],1):(e=RK.exec(t))?new Zr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=IK.exec(t))?_f(e[1],e[2],e[3],e[4]):(e=$K.exec(t))?_f(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=MK.exec(t))?QC(e[1],e[2]/100,e[3]/100,1):(e=DK.exec(t))?QC(e[1],e[2]/100,e[3]/100,e[4]):GC.hasOwnProperty(t)?YC(GC[t]):t==="transparent"?new Zr(NaN,NaN,NaN,0):null}function YC(t){return new Zr(t>>16&255,t>>8&255,t&255,1)}function _f(t,e,r,n){return n<=0&&(t=e=r=NaN),new Zr(t,e,r,n)}function BK(t){return t instanceof qu||(t=ou(t)),t?(t=t.rgb(),new Zr(t.r,t.g,t.b,t.opacity)):new Zr}function Dx(t,e,r,n){return arguments.length===1?BK(t):new Zr(t,e,r,n??1)}function Zr(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}R1(Zr,Dx,BI(qu,{brighter(t){return t=t==null?bh:Math.pow(bh,t),new Zr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?iu:Math.pow(iu,t),new Zr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zr(jo(this.r),jo(this.g),jo(this.b),xh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:JC,formatHex:JC,formatHex8:UK,formatRgb:ZC,toString:ZC}));function JC(){return`#${Ao(this.r)}${Ao(this.g)}${Ao(this.b)}`}function UK(){return`#${Ao(this.r)}${Ao(this.g)}${Ao(this.b)}${Ao((isNaN(this.opacity)?1:this.opacity)*255)}`}function ZC(){const t=xh(this.opacity);return`${t===1?"rgb(":"rgba("}${jo(this.r)}, ${jo(this.g)}, ${jo(this.b)}${t===1?")":`, ${t})`}`}function xh(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function jo(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ao(t){return t=jo(t),(t<16?"0":"")+t.toString(16)}function QC(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Yn(t,e,r,n)}function UI(t){if(t instanceof Yn)return new Yn(t.h,t.s,t.l,t.opacity);if(t instanceof qu||(t=ou(t)),!t)return new Yn;if(t instanceof Yn)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),a=Math.max(e,r,n),o=NaN,c=a-i,u=(a+i)/2;return c?(e===a?o=(r-n)/c+(r<n)*6:r===a?o=(n-e)/c+2:o=(e-r)/c+4,c/=u<.5?a+i:2-a-i,o*=60):c=u>0&&u<1?0:o,new Yn(o,c,u,t.opacity)}function qK(t,e,r,n){return arguments.length===1?UI(t):new Yn(t,e,r,n??1)}function Yn(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}R1(Yn,qK,BI(qu,{brighter(t){return t=t==null?bh:Math.pow(bh,t),new Yn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?iu:Math.pow(iu,t),new Yn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Zr(Z0(t>=240?t-240:t+120,i,n),Z0(t,i,n),Z0(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Yn(ej(this.h),Sf(this.s),Sf(this.l),xh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=xh(this.opacity);return`${t===1?"hsl(":"hsla("}${ej(this.h)}, ${Sf(this.s)*100}%, ${Sf(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ej(t){return t=(t||0)%360,t<0?t+360:t}function Sf(t){return Math.max(0,Math.min(1,t||0))}function Z0(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const I1=t=>()=>t;function FK(t,e){return function(r){return t+r*e}}function HK(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function WK(t){return(t=+t)==1?qI:function(e,r){return r-e?HK(e,r,t):I1(isNaN(e)?r:e)}}function qI(t,e){var r=e-t;return r?FK(t,r):I1(isNaN(t)?e:t)}const tj=(function t(e){var r=WK(e);function n(i,a){var o=r((i=Dx(i)).r,(a=Dx(a)).r),c=r(i.g,a.g),u=r(i.b,a.b),d=qI(i.opacity,a.opacity);return function(p){return i.r=o(p),i.g=c(p),i.b=u(p),i.opacity=d(p),i+""}}return n.gamma=t,n})(1);function KK(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),i;return function(a){for(i=0;i<r;++i)n[i]=t[i]*(1-a)+e[i]*a;return n}}function GK(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function VK(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,i=new Array(n),a=new Array(r),o;for(o=0;o<n;++o)i[o]=kl(t[o],e[o]);for(;o<r;++o)a[o]=e[o];return function(c){for(o=0;o<n;++o)a[o]=i[o](c);return a}}function XK(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function wh(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function YK(t,e){var r={},n={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?r[i]=kl(t[i],e[i]):n[i]=e[i];return function(a){for(i in r)n[i]=r[i](a);return n}}var Lx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Q0=new RegExp(Lx.source,"g");function JK(t){return function(){return t}}function ZK(t){return function(e){return t(e)+""}}function QK(t,e){var r=Lx.lastIndex=Q0.lastIndex=0,n,i,a,o=-1,c=[],u=[];for(t=t+"",e=e+"";(n=Lx.exec(t))&&(i=Q0.exec(e));)(a=i.index)>r&&(a=e.slice(r,a),c[o]?c[o]+=a:c[++o]=a),(n=n[0])===(i=i[0])?c[o]?c[o]+=i:c[++o]=i:(c[++o]=null,u.push({i:o,x:wh(n,i)})),r=Q0.lastIndex;return r<e.length&&(a=e.slice(r),c[o]?c[o]+=a:c[++o]=a),c.length<2?u[0]?ZK(u[0].x):JK(e):(e=u.length,function(d){for(var p=0,f;p<e;++p)c[(f=u[p]).i]=f.x(d);return c.join("")})}function kl(t,e){var r=typeof e,n;return e==null||r==="boolean"?I1(e):(r==="number"?wh:r==="string"?(n=ou(e))?(e=n,tj):QK:e instanceof ou?tj:e instanceof Date?XK:GK(e)?KK:Array.isArray(e)?VK:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?YK:wh)(t,e)}function $1(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}function eG(t,e){e===void 0&&(e=t,t=kl);for(var r=0,n=e.length-1,i=e[0],a=new Array(n<0?0:n);r<n;)a[r]=t(i,i=e[++r]);return function(o){var c=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return a[c](o-c)}}function tG(t){return function(){return t}}function _h(t){return+t}var rj=[0,1];function Br(t){return t}function zx(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:tG(isNaN(e)?NaN:.5)}function rG(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function nG(t,e,r){var n=t[0],i=t[1],a=e[0],o=e[1];return i<n?(n=zx(i,n),a=r(o,a)):(n=zx(n,i),a=r(a,o)),function(c){return a(n(c))}}function iG(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),a=new Array(n),o=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<n;)i[o]=zx(t[o],t[o+1]),a[o]=r(e[o],e[o+1]);return function(c){var u=Uu(t,c,1,n)-1;return a[u](i[u](c))}}function Fu(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Tp(){var t=rj,e=rj,r=kl,n,i,a,o=Br,c,u,d;function p(){var m=Math.min(t.length,e.length);return o!==Br&&(o=rG(t[0],t[m-1])),c=m>2?iG:nG,u=d=null,f}function f(m){return m==null||isNaN(m=+m)?a:(u||(u=c(t.map(n),e,r)))(n(o(m)))}return f.invert=function(m){return o(i((d||(d=c(e,t.map(n),wh)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,_h),p()):t.slice()},f.range=function(m){return arguments.length?(e=Array.from(m),p()):e.slice()},f.rangeRound=function(m){return e=Array.from(m),r=$1,p()},f.clamp=function(m){return arguments.length?(o=m?!0:Br,p()):o!==Br},f.interpolate=function(m){return arguments.length?(r=m,p()):r},f.unknown=function(m){return arguments.length?(a=m,f):a},function(m,v){return n=m,i=v,p()}}function M1(){return Tp()(Br,Br)}function aG(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Sh(t,e){if(!isFinite(t)||t===0)return null;var r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function Ys(t){return t=Sh(Math.abs(t)),t?t[1]:NaN}function oG(t,e){return function(r,n){for(var i=r.length,a=[],o=0,c=t[0],u=0;i>0&&c>0&&(u+c+1>n&&(c=Math.max(1,n-u)),a.push(r.substring(i-=c,i+c)),!((u+=c+1)>n));)c=t[o=(o+1)%t.length];return a.reverse().join(e)}}function sG(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var lG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function su(t){if(!(e=lG.exec(t)))throw new Error("invalid format: "+t);var e;return new D1({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}su.prototype=D1.prototype;function D1(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}D1.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function cG(t){e:for(var e=t.length,r=1,n=-1,i;r<e;++r)switch(t[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+t[r])break e;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var kh;function uG(t,e){var r=Sh(t,e);if(!r)return kh=void 0,t.toPrecision(e);var n=r[0],i=r[1],a=i-(kh=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=n.length;return a===o?n:a>o?n+new Array(a-o+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Sh(t,Math.max(0,e+a-1))[0]}function nj(t,e){var r=Sh(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const ij={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:aG,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>nj(t*100,e),r:nj,s:uG,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function aj(t){return t}var oj=Array.prototype.map,sj=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function dG(t){var e=t.grouping===void 0||t.thousands===void 0?aj:oG(oj.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?aj:sG(oj.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",c=t.minus===void 0?"−":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function d(f,m){f=su(f);var v=f.fill,b=f.align,w=f.sign,x=f.symbol,k=f.zero,S=f.width,A=f.comma,C=f.precision,T=f.trim,O=f.type;O==="n"?(A=!0,O="g"):ij[O]||(C===void 0&&(C=12),T=!0,O="g"),(k||v==="0"&&b==="=")&&(k=!0,v="0",b="=");var N=(m&&m.prefix!==void 0?m.prefix:"")+(x==="$"?r:x==="#"&&/[boxX]/.test(O)?"0"+O.toLowerCase():""),R=(x==="$"?n:/[%p]/.test(O)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),$=ij[O],K=/[defgprs%]/.test(O);C=C===void 0?6:/[gprs]/.test(O)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function z(U){var F=N,X=R,Y,G,Z;if(O==="c")X=$(U)+X,U="";else{U=+U;var W=U<0||1/U<0;if(U=isNaN(U)?u:$(Math.abs(U),C),T&&(U=cG(U)),W&&+U==0&&w!=="+"&&(W=!1),F=(W?w==="("?w:c:w==="-"||w==="("?"":w)+F,X=(O==="s"&&!isNaN(U)&&kh!==void 0?sj[8+kh/3]:"")+X+(W&&w==="("?")":""),K){for(Y=-1,G=U.length;++Y<G;)if(Z=U.charCodeAt(Y),48>Z||Z>57){X=(Z===46?i+U.slice(Y+1):U.slice(Y))+X,U=U.slice(0,Y);break}}}A&&!k&&(U=e(U,1/0));var Q=F.length+U.length+X.length,L=Q<S?new Array(S-Q+1).join(v):"";switch(A&&k&&(U=e(L+U,L.length?S-X.length:1/0),L=""),b){case"<":U=F+U+X+L;break;case"=":U=F+L+U+X;break;case"^":U=L.slice(0,Q=L.length>>1)+F+U+X+L.slice(Q);break;default:U=L+F+U+X;break}return a(U)}return z.toString=function(){return f+""},z}function p(f,m){var v=Math.max(-8,Math.min(8,Math.floor(Ys(m)/3)))*3,b=Math.pow(10,-v),w=d((f=su(f),f.type="f",f),{suffix:sj[8+v/3]});return function(x){return w(b*x)}}return{format:d,formatPrefix:p}}var kf,L1,FI;fG({thousands:",",grouping:[3],currency:["$",""]});function fG(t){return kf=dG(t),L1=kf.format,FI=kf.formatPrefix,kf}function hG(t){return Math.max(0,-Ys(Math.abs(t)))}function pG(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ys(e)/3)))*3-Ys(Math.abs(t)))}function mG(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ys(e)-Ys(t))+1}function HI(t,e,r,n){var i=$x(t,e,r),a;switch(n=su(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(a=pG(i,o))&&(n.precision=a),FI(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=mG(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=hG(i))&&(n.precision=a-(n.type==="%")*2);break}}return L1(n)}function Ga(t){var e=t.domain;return t.ticks=function(r){var n=e();return Rx(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var i=e();return HI(i[0],i[i.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,a=n.length-1,o=n[i],c=n[a],u,d,p=10;for(c<o&&(d=o,o=c,c=d,d=i,i=a,a=d);p-- >0;){if(d=Ix(o,c,r),d===u)return n[i]=o,n[a]=c,e(n);if(d>0)o=Math.floor(o/d)*d,c=Math.ceil(c/d)*d;else if(d<0)o=Math.ceil(o*d)/d,c=Math.floor(c*d)/d;else break;u=d}return t},t}function Eh(){var t=M1();return t.copy=function(){return Fu(t,Eh())},Nn.apply(t,arguments),Ga(t)}function WI(t){var e;function r(n){return n==null||isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=Array.from(n,_h),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return WI(t).unknown(e)},t=arguments.length?Array.from(t,_h):[0,1],Ga(r)}function KI(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],a=t[n],o;return a<i&&(o=r,r=n,n=o,o=i,i=a,a=o),t[r]=e.floor(i),t[n]=e.ceil(a),t}function lj(t){return Math.log(t)}function cj(t){return Math.exp(t)}function gG(t){return-Math.log(-t)}function yG(t){return-Math.exp(-t)}function vG(t){return isFinite(t)?+("1e"+t):t<0?0:t}function bG(t){return t===10?vG:t===Math.E?Math.exp:e=>Math.pow(t,e)}function xG(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function uj(t){return(e,r)=>-t(-e,r)}function z1(t){const e=t(lj,cj),r=e.domain;let n=10,i,a;function o(){return i=xG(n),a=bG(n),r()[0]<0?(i=uj(i),a=uj(a),t(gG,yG)):t(lj,cj),e}return e.base=function(c){return arguments.length?(n=+c,o()):n},e.domain=function(c){return arguments.length?(r(c),o()):r()},e.ticks=c=>{const u=r();let d=u[0],p=u[u.length-1];const f=p<d;f&&([d,p]=[p,d]);let m=i(d),v=i(p),b,w;const x=c==null?10:+c;let k=[];if(!(n%1)&&v-m<x){if(m=Math.floor(m),v=Math.ceil(v),d>0){for(;m<=v;++m)for(b=1;b<n;++b)if(w=m<0?b/a(-m):b*a(m),!(w<d)){if(w>p)break;k.push(w)}}else for(;m<=v;++m)for(b=n-1;b>=1;--b)if(w=m>0?b/a(-m):b*a(m),!(w<d)){if(w>p)break;k.push(w)}k.length*2<x&&(k=Rx(d,p,x))}else k=Rx(m,v,Math.min(v-m,x)).map(a);return f?k.reverse():k},e.tickFormat=(c,u)=>{if(c==null&&(c=10),u==null&&(u=n===10?"s":","),typeof u!="function"&&(!(n%1)&&(u=su(u)).precision==null&&(u.trim=!0),u=L1(u)),c===1/0)return u;const d=Math.max(1,n*c/e.ticks().length);return p=>{let f=p/a(Math.round(i(p)));return f*n<n-.5&&(f*=n),f<=d?u(p):""}},e.nice=()=>r(KI(r(),{floor:c=>a(Math.floor(i(c))),ceil:c=>a(Math.ceil(i(c)))})),e}function GI(){const t=z1(Tp()).domain([1,10]);return t.copy=()=>Fu(t,GI()).base(t.base()),Nn.apply(t,arguments),t}function dj(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function fj(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function B1(t){var e=1,r=t(dj(e),fj(e));return r.constant=function(n){return arguments.length?t(dj(e=+n),fj(e)):e},Ga(r)}function VI(){var t=B1(Tp());return t.copy=function(){return Fu(t,VI()).constant(t.constant())},Nn.apply(t,arguments)}function hj(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function wG(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function _G(t){return t<0?-t*t:t*t}function U1(t){var e=t(Br,Br),r=1;function n(){return r===1?t(Br,Br):r===.5?t(wG,_G):t(hj(r),hj(1/r))}return e.exponent=function(i){return arguments.length?(r=+i,n()):r},Ga(e)}function q1(){var t=U1(Tp());return t.copy=function(){return Fu(t,q1()).exponent(t.exponent())},Nn.apply(t,arguments),t}function SG(){return q1.apply(null,arguments).exponent(.5)}function pj(t){return Math.sign(t)*t*t}function kG(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function XI(){var t=M1(),e=[0,1],r=!1,n;function i(a){var o=kG(t(a));return isNaN(o)?n:r?Math.round(o):o}return i.invert=function(a){return t.invert(pj(a))},i.domain=function(a){return arguments.length?(t.domain(a),i):t.domain()},i.range=function(a){return arguments.length?(t.range((e=Array.from(a,_h)).map(pj)),i):e.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(t.clamp(a),i):t.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return XI(t.domain(),e).round(r).clamp(t.clamp()).unknown(n)},Nn.apply(i,arguments),Ga(i)}function YI(){var t=[],e=[],r=[],n;function i(){var o=0,c=Math.max(1,e.length);for(r=new Array(c-1);++o<c;)r[o-1]=CK(t,o/c);return a}function a(o){return o==null||isNaN(o=+o)?n:e[Uu(r,o)]}return a.invertExtent=function(o){var c=e.indexOf(o);return c<0?[NaN,NaN]:[c>0?r[c-1]:t[0],c<r.length?r[c]:t[t.length-1]]},a.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let c of o)c!=null&&!isNaN(c=+c)&&t.push(c);return t.sort(La),i()},a.range=function(o){return arguments.length?(e=Array.from(o),i()):e.slice()},a.unknown=function(o){return arguments.length?(n=o,a):n},a.quantiles=function(){return r.slice()},a.copy=function(){return YI().domain(t).range(e).unknown(n)},Nn.apply(a,arguments)}function JI(){var t=0,e=1,r=1,n=[.5],i=[0,1],a;function o(u){return u!=null&&u<=u?i[Uu(n,u,0,r)]:a}function c(){var u=-1;for(n=new Array(r);++u<r;)n[u]=((u+1)*e-(u-r)*t)/(r+1);return o}return o.domain=function(u){return arguments.length?([t,e]=u,t=+t,e=+e,c()):[t,e]},o.range=function(u){return arguments.length?(r=(i=Array.from(u)).length-1,c()):i.slice()},o.invertExtent=function(u){var d=i.indexOf(u);return d<0?[NaN,NaN]:d<1?[t,n[0]]:d>=r?[n[r-1],e]:[n[d-1],n[d]]},o.unknown=function(u){return arguments.length&&(a=u),o},o.thresholds=function(){return n.slice()},o.copy=function(){return JI().domain([t,e]).range(i).unknown(a)},Nn.apply(Ga(o),arguments)}function ZI(){var t=[.5],e=[0,1],r,n=1;function i(a){return a!=null&&a<=a?e[Uu(t,a,0,n)]:r}return i.domain=function(a){return arguments.length?(t=Array.from(a),n=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(a){return arguments.length?(e=Array.from(a),n=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(a){var o=e.indexOf(a);return[t[o-1],t[o]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return ZI().domain(t).range(e).unknown(r)},Nn.apply(i,arguments)}const eb=new Date,tb=new Date;function lr(t,e,r,n){function i(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(t(a=new Date(+a)),a),i.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),i.round=a=>{const o=i(a),c=i.ceil(a);return a-o<c-a?o:c},i.offset=(a,o)=>(e(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,c)=>{const u=[];if(a=i.ceil(a),c=c==null?1:Math.floor(c),!(a<o)||!(c>0))return u;let d;do u.push(d=new Date(+a)),e(a,c),t(a);while(d<a&&a<o);return u},i.filter=a=>lr(o=>{if(o>=o)for(;t(o),!a(o);)o.setTime(o-1)},(o,c)=>{if(o>=o)if(c<0)for(;++c<=0;)for(;e(o,-1),!a(o););else for(;--c>=0;)for(;e(o,1),!a(o););}),r&&(i.count=(a,o)=>(eb.setTime(+a),tb.setTime(+o),t(eb),t(tb),Math.floor(r(eb,tb))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?o=>n(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const Ah=lr(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Ah.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?lr(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):Ah);Ah.range;const Hi=1e3,An=Hi*60,Wi=An*60,Ji=Wi*24,F1=Ji*7,mj=Ji*30,rb=Ji*365,Oo=lr(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Hi)},(t,e)=>(e-t)/Hi,t=>t.getUTCSeconds());Oo.range;const H1=lr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Hi)},(t,e)=>{t.setTime(+t+e*An)},(t,e)=>(e-t)/An,t=>t.getMinutes());H1.range;const W1=lr(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*An)},(t,e)=>(e-t)/An,t=>t.getUTCMinutes());W1.range;const K1=lr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Hi-t.getMinutes()*An)},(t,e)=>{t.setTime(+t+e*Wi)},(t,e)=>(e-t)/Wi,t=>t.getHours());K1.range;const G1=lr(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Wi)},(t,e)=>(e-t)/Wi,t=>t.getUTCHours());G1.range;const Hu=lr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*An)/Ji,t=>t.getDate()-1);Hu.range;const Cp=lr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Ji,t=>t.getUTCDate()-1);Cp.range;const QI=lr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Ji,t=>Math.floor(t/Ji));QI.range;function qo(t){return lr(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*An)/F1)}const jp=qo(0),Oh=qo(1),EG=qo(2),AG=qo(3),Js=qo(4),OG=qo(5),TG=qo(6);jp.range;Oh.range;EG.range;AG.range;Js.range;OG.range;TG.range;function Fo(t){return lr(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/F1)}const Np=Fo(0),Th=Fo(1),CG=Fo(2),jG=Fo(3),Zs=Fo(4),NG=Fo(5),PG=Fo(6);Np.range;Th.range;CG.range;jG.range;Zs.range;NG.range;PG.range;const V1=lr(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());V1.range;const X1=lr(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());X1.range;const Zi=lr(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Zi.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:lr(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});Zi.range;const Qi=lr(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Qi.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:lr(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});Qi.range;function e$(t,e,r,n,i,a){const o=[[Oo,1,Hi],[Oo,5,5*Hi],[Oo,15,15*Hi],[Oo,30,30*Hi],[a,1,An],[a,5,5*An],[a,15,15*An],[a,30,30*An],[i,1,Wi],[i,3,3*Wi],[i,6,6*Wi],[i,12,12*Wi],[n,1,Ji],[n,2,2*Ji],[r,1,F1],[e,1,mj],[e,3,3*mj],[t,1,rb]];function c(d,p,f){const m=p<d;m&&([d,p]=[p,d]);const v=f&&typeof f.range=="function"?f:u(d,p,f),b=v?v.range(d,+p+1):[];return m?b.reverse():b}function u(d,p,f){const m=Math.abs(p-d)/f,v=N1(([,,x])=>x).right(o,m);if(v===o.length)return t.every($x(d/rb,p/rb,f));if(v===0)return Ah.every(Math.max($x(d,p,f),1));const[b,w]=o[m/o[v-1][2]<o[v][2]/m?v-1:v];return b.every(w)}return[c,u]}const[RG,IG]=e$(Qi,X1,Np,QI,G1,W1),[$G,MG]=e$(Zi,V1,jp,Hu,K1,H1);function nb(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function ib(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function vc(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function DG(t){var e=t.dateTime,r=t.date,n=t.time,i=t.periods,a=t.days,o=t.shortDays,c=t.months,u=t.shortMonths,d=bc(i),p=xc(i),f=bc(a),m=xc(a),v=bc(o),b=xc(o),w=bc(c),x=xc(c),k=bc(u),S=xc(u),A={a:Z,A:W,b:Q,B:L,c:null,d:wj,e:wj,f:oV,g:gV,G:vV,H:nV,I:iV,j:aV,L:t$,m:sV,M:lV,p:I,q,Q:kj,s:Ej,S:cV,u:uV,U:dV,V:fV,w:hV,W:pV,x:null,X:null,y:mV,Y:yV,Z:bV,"%":Sj},C={a:ee,A:le,b:fe,B:ve,c:null,d:_j,e:_j,f:SV,g:RV,G:$V,H:xV,I:wV,j:_V,L:n$,m:kV,M:EV,p:qe,q:xe,Q:kj,s:Ej,S:AV,u:OV,U:TV,V:CV,w:jV,W:NV,x:null,X:null,y:PV,Y:IV,Z:MV,"%":Sj},T={a:K,A:z,b:U,B:F,c:X,d:bj,e:bj,f:QG,g:vj,G:yj,H:xj,I:xj,j:XG,L:ZG,m:VG,M:YG,p:$,q:GG,Q:tV,s:rV,S:JG,u:qG,U:FG,V:HG,w:UG,W:WG,x:Y,X:G,y:vj,Y:yj,Z:KG,"%":eV};A.x=O(r,A),A.X=O(n,A),A.c=O(e,A),C.x=O(r,C),C.X=O(n,C),C.c=O(e,C);function O(ae,Se){return function(Me){var oe=[],rt=-1,Fe=0,kt=ae.length,wt,Et,_r;for(Me instanceof Date||(Me=new Date(+Me));++rt<kt;)ae.charCodeAt(rt)===37&&(oe.push(ae.slice(Fe,rt)),(Et=gj[wt=ae.charAt(++rt)])!=null?wt=ae.charAt(++rt):Et=wt==="e"?" ":"0",(_r=Se[wt])&&(wt=_r(Me,Et)),oe.push(wt),Fe=rt+1);return oe.push(ae.slice(Fe,rt)),oe.join("")}}function N(ae,Se){return function(Me){var oe=vc(1900,void 0,1),rt=R(oe,ae,Me+="",0),Fe,kt;if(rt!=Me.length)return null;if("Q"in oe)return new Date(oe.Q);if("s"in oe)return new Date(oe.s*1e3+("L"in oe?oe.L:0));if(Se&&!("Z"in oe)&&(oe.Z=0),"p"in oe&&(oe.H=oe.H%12+oe.p*12),oe.m===void 0&&(oe.m="q"in oe?oe.q:0),"V"in oe){if(oe.V<1||oe.V>53)return null;"w"in oe||(oe.w=1),"Z"in oe?(Fe=ib(vc(oe.y,0,1)),kt=Fe.getUTCDay(),Fe=kt>4||kt===0?Th.ceil(Fe):Th(Fe),Fe=Cp.offset(Fe,(oe.V-1)*7),oe.y=Fe.getUTCFullYear(),oe.m=Fe.getUTCMonth(),oe.d=Fe.getUTCDate()+(oe.w+6)%7):(Fe=nb(vc(oe.y,0,1)),kt=Fe.getDay(),Fe=kt>4||kt===0?Oh.ceil(Fe):Oh(Fe),Fe=Hu.offset(Fe,(oe.V-1)*7),oe.y=Fe.getFullYear(),oe.m=Fe.getMonth(),oe.d=Fe.getDate()+(oe.w+6)%7)}else("W"in oe||"U"in oe)&&("w"in oe||(oe.w="u"in oe?oe.u%7:"W"in oe?1:0),kt="Z"in oe?ib(vc(oe.y,0,1)).getUTCDay():nb(vc(oe.y,0,1)).getDay(),oe.m=0,oe.d="W"in oe?(oe.w+6)%7+oe.W*7-(kt+5)%7:oe.w+oe.U*7-(kt+6)%7);return"Z"in oe?(oe.H+=oe.Z/100|0,oe.M+=oe.Z%100,ib(oe)):nb(oe)}}function R(ae,Se,Me,oe){for(var rt=0,Fe=Se.length,kt=Me.length,wt,Et;rt<Fe;){if(oe>=kt)return-1;if(wt=Se.charCodeAt(rt++),wt===37){if(wt=Se.charAt(rt++),Et=T[wt in gj?Se.charAt(rt++):wt],!Et||(oe=Et(ae,Me,oe))<0)return-1}else if(wt!=Me.charCodeAt(oe++))return-1}return oe}function $(ae,Se,Me){var oe=d.exec(Se.slice(Me));return oe?(ae.p=p.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function K(ae,Se,Me){var oe=v.exec(Se.slice(Me));return oe?(ae.w=b.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function z(ae,Se,Me){var oe=f.exec(Se.slice(Me));return oe?(ae.w=m.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function U(ae,Se,Me){var oe=k.exec(Se.slice(Me));return oe?(ae.m=S.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function F(ae,Se,Me){var oe=w.exec(Se.slice(Me));return oe?(ae.m=x.get(oe[0].toLowerCase()),Me+oe[0].length):-1}function X(ae,Se,Me){return R(ae,e,Se,Me)}function Y(ae,Se,Me){return R(ae,r,Se,Me)}function G(ae,Se,Me){return R(ae,n,Se,Me)}function Z(ae){return o[ae.getDay()]}function W(ae){return a[ae.getDay()]}function Q(ae){return u[ae.getMonth()]}function L(ae){return c[ae.getMonth()]}function I(ae){return i[+(ae.getHours()>=12)]}function q(ae){return 1+~~(ae.getMonth()/3)}function ee(ae){return o[ae.getUTCDay()]}function le(ae){return a[ae.getUTCDay()]}function fe(ae){return u[ae.getUTCMonth()]}function ve(ae){return c[ae.getUTCMonth()]}function qe(ae){return i[+(ae.getUTCHours()>=12)]}function xe(ae){return 1+~~(ae.getUTCMonth()/3)}return{format:function(ae){var Se=O(ae+="",A);return Se.toString=function(){return ae},Se},parse:function(ae){var Se=N(ae+="",!1);return Se.toString=function(){return ae},Se},utcFormat:function(ae){var Se=O(ae+="",C);return Se.toString=function(){return ae},Se},utcParse:function(ae){var Se=N(ae+="",!0);return Se.toString=function(){return ae},Se}}}var gj={"-":"",_:" ",0:"0"},yr=/^\s*\d+/,LG=/^%/,zG=/[\\^$*+?|[\]().{}]/g;function ft(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a<r?new Array(r-a+1).join(e)+i:i)}function BG(t){return t.replace(zG,"\\$&")}function bc(t){return new RegExp("^(?:"+t.map(BG).join("|")+")","i")}function xc(t){return new Map(t.map((e,r)=>[e.toLowerCase(),r]))}function UG(t,e,r){var n=yr.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function qG(t,e,r){var n=yr.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function FG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function HG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function WG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function yj(t,e,r){var n=yr.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function vj(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function KG(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function GG(t,e,r){var n=yr.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function VG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function bj(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function XG(t,e,r){var n=yr.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function xj(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function YG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function JG(t,e,r){var n=yr.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function ZG(t,e,r){var n=yr.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function QG(t,e,r){var n=yr.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function eV(t,e,r){var n=LG.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function tV(t,e,r){var n=yr.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function rV(t,e,r){var n=yr.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function wj(t,e){return ft(t.getDate(),e,2)}function nV(t,e){return ft(t.getHours(),e,2)}function iV(t,e){return ft(t.getHours()%12||12,e,2)}function aV(t,e){return ft(1+Hu.count(Zi(t),t),e,3)}function t$(t,e){return ft(t.getMilliseconds(),e,3)}function oV(t,e){return t$(t,e)+"000"}function sV(t,e){return ft(t.getMonth()+1,e,2)}function lV(t,e){return ft(t.getMinutes(),e,2)}function cV(t,e){return ft(t.getSeconds(),e,2)}function uV(t){var e=t.getDay();return e===0?7:e}function dV(t,e){return ft(jp.count(Zi(t)-1,t),e,2)}function r$(t){var e=t.getDay();return e>=4||e===0?Js(t):Js.ceil(t)}function fV(t,e){return t=r$(t),ft(Js.count(Zi(t),t)+(Zi(t).getDay()===4),e,2)}function hV(t){return t.getDay()}function pV(t,e){return ft(Oh.count(Zi(t)-1,t),e,2)}function mV(t,e){return ft(t.getFullYear()%100,e,2)}function gV(t,e){return t=r$(t),ft(t.getFullYear()%100,e,2)}function yV(t,e){return ft(t.getFullYear()%1e4,e,4)}function vV(t,e){var r=t.getDay();return t=r>=4||r===0?Js(t):Js.ceil(t),ft(t.getFullYear()%1e4,e,4)}function bV(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ft(e/60|0,"0",2)+ft(e%60,"0",2)}function _j(t,e){return ft(t.getUTCDate(),e,2)}function xV(t,e){return ft(t.getUTCHours(),e,2)}function wV(t,e){return ft(t.getUTCHours()%12||12,e,2)}function _V(t,e){return ft(1+Cp.count(Qi(t),t),e,3)}function n$(t,e){return ft(t.getUTCMilliseconds(),e,3)}function SV(t,e){return n$(t,e)+"000"}function kV(t,e){return ft(t.getUTCMonth()+1,e,2)}function EV(t,e){return ft(t.getUTCMinutes(),e,2)}function AV(t,e){return ft(t.getUTCSeconds(),e,2)}function OV(t){var e=t.getUTCDay();return e===0?7:e}function TV(t,e){return ft(Np.count(Qi(t)-1,t),e,2)}function i$(t){var e=t.getUTCDay();return e>=4||e===0?Zs(t):Zs.ceil(t)}function CV(t,e){return t=i$(t),ft(Zs.count(Qi(t),t)+(Qi(t).getUTCDay()===4),e,2)}function jV(t){return t.getUTCDay()}function NV(t,e){return ft(Th.count(Qi(t)-1,t),e,2)}function PV(t,e){return ft(t.getUTCFullYear()%100,e,2)}function RV(t,e){return t=i$(t),ft(t.getUTCFullYear()%100,e,2)}function IV(t,e){return ft(t.getUTCFullYear()%1e4,e,4)}function $V(t,e){var r=t.getUTCDay();return t=r>=4||r===0?Zs(t):Zs.ceil(t),ft(t.getUTCFullYear()%1e4,e,4)}function MV(){return"+0000"}function Sj(){return"%"}function kj(t){return+t}function Ej(t){return Math.floor(+t/1e3)}var Es,a$,o$;DV({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function DV(t){return Es=DG(t),a$=Es.format,Es.parse,o$=Es.utcFormat,Es.utcParse,Es}function LV(t){return new Date(t)}function zV(t){return t instanceof Date?+t:+new Date(+t)}function Y1(t,e,r,n,i,a,o,c,u,d){var p=M1(),f=p.invert,m=p.domain,v=d(".%L"),b=d(":%S"),w=d("%I:%M"),x=d("%I %p"),k=d("%a %d"),S=d("%b %d"),A=d("%B"),C=d("%Y");function T(O){return(u(O)<O?v:c(O)<O?b:o(O)<O?w:a(O)<O?x:n(O)<O?i(O)<O?k:S:r(O)<O?A:C)(O)}return p.invert=function(O){return new Date(f(O))},p.domain=function(O){return arguments.length?m(Array.from(O,zV)):m().map(LV)},p.ticks=function(O){var N=m();return t(N[0],N[N.length-1],O??10)},p.tickFormat=function(O,N){return N==null?T:d(N)},p.nice=function(O){var N=m();return(!O||typeof O.range!="function")&&(O=e(N[0],N[N.length-1],O??10)),O?m(KI(N,O)):p},p.copy=function(){return Fu(p,Y1(t,e,r,n,i,a,o,c,u,d))},p}function BV(){return Nn.apply(Y1($G,MG,Zi,V1,jp,Hu,K1,H1,Oo,a$).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function UV(){return Nn.apply(Y1(RG,IG,Qi,X1,Np,Cp,G1,W1,Oo,o$).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Pp(){var t=0,e=1,r,n,i,a,o=Br,c=!1,u;function d(f){return f==null||isNaN(f=+f)?u:o(i===0?.5:(f=(a(f)-r)*i,c?Math.max(0,Math.min(1,f)):f))}d.domain=function(f){return arguments.length?([t,e]=f,r=a(t=+t),n=a(e=+e),i=r===n?0:1/(n-r),d):[t,e]},d.clamp=function(f){return arguments.length?(c=!!f,d):c},d.interpolator=function(f){return arguments.length?(o=f,d):o};function p(f){return function(m){var v,b;return arguments.length?([v,b]=m,o=f(v,b),d):[o(0),o(1)]}}return d.range=p(kl),d.rangeRound=p($1),d.unknown=function(f){return arguments.length?(u=f,d):u},function(f){return a=f,r=f(t),n=f(e),i=r===n?0:1/(n-r),d}}function Va(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function s$(){var t=Ga(Pp()(Br));return t.copy=function(){return Va(t,s$())},ia.apply(t,arguments)}function l$(){var t=z1(Pp()).domain([1,10]);return t.copy=function(){return Va(t,l$()).base(t.base())},ia.apply(t,arguments)}function c$(){var t=B1(Pp());return t.copy=function(){return Va(t,c$()).constant(t.constant())},ia.apply(t,arguments)}function J1(){var t=U1(Pp());return t.copy=function(){return Va(t,J1()).exponent(t.exponent())},ia.apply(t,arguments)}function qV(){return J1.apply(null,arguments).exponent(.5)}function u$(){var t=[],e=Br;function r(n){if(n!=null&&!isNaN(n=+n))return e((Uu(t,n,1)-1)/(t.length-1))}return r.domain=function(n){if(!arguments.length)return t.slice();t=[];for(let i of n)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(La),r},r.interpolator=function(n){return arguments.length?(e=n,r):e},r.range=function(){return t.map((n,i)=>e(i/(t.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>TK(t,a/n))},r.copy=function(){return u$(e).domain(t)},ia.apply(r,arguments)}function Rp(){var t=0,e=.5,r=1,n=1,i,a,o,c,u,d=Br,p,f=!1,m;function v(w){return isNaN(w=+w)?m:(w=.5+((w=+p(w))-a)*(n*w<n*a?c:u),d(f?Math.max(0,Math.min(1,w)):w))}v.domain=function(w){return arguments.length?([t,e,r]=w,i=p(t=+t),a=p(e=+e),o=p(r=+r),c=i===a?0:.5/(a-i),u=a===o?0:.5/(o-a),n=a<i?-1:1,v):[t,e,r]},v.clamp=function(w){return arguments.length?(f=!!w,v):f},v.interpolator=function(w){return arguments.length?(d=w,v):d};function b(w){return function(x){var k,S,A;return arguments.length?([k,S,A]=x,d=eG(w,[k,S,A]),v):[d(0),d(.5),d(1)]}}return v.range=b(kl),v.rangeRound=b($1),v.unknown=function(w){return arguments.length?(m=w,v):m},function(w){return p=w,i=w(t),a=w(e),o=w(r),c=i===a?0:.5/(a-i),u=a===o?0:.5/(o-a),n=a<i?-1:1,v}}function d$(){var t=Ga(Rp()(Br));return t.copy=function(){return Va(t,d$())},ia.apply(t,arguments)}function f$(){var t=z1(Rp()).domain([.1,1,10]);return t.copy=function(){return Va(t,f$()).base(t.base())},ia.apply(t,arguments)}function h$(){var t=B1(Rp());return t.copy=function(){return Va(t,h$()).constant(t.constant())},ia.apply(t,arguments)}function Z1(){var t=U1(Rp());return t.copy=function(){return Va(t,Z1()).exponent(t.exponent())},ia.apply(t,arguments)}function FV(){return Z1.apply(null,arguments).exponent(.5)}const Aj=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:nu,scaleDiverging:d$,scaleDivergingLog:f$,scaleDivergingPow:Z1,scaleDivergingSqrt:FV,scaleDivergingSymlog:h$,scaleIdentity:WI,scaleImplicit:Mx,scaleLinear:Eh,scaleLog:GI,scaleOrdinal:P1,scalePoint:Dc,scalePow:q1,scaleQuantile:YI,scaleQuantize:JI,scaleRadial:XI,scaleSequential:s$,scaleSequentialLog:l$,scaleSequentialPow:J1,scaleSequentialQuantile:u$,scaleSequentialSqrt:qV,scaleSequentialSymlog:c$,scaleSqrt:SG,scaleSymlog:VI,scaleThreshold:ZI,scaleTime:BV,scaleUtc:UV,tickFormat:HI},Symbol.toStringTag,{value:"Module"}));var ab,Oj;function p$(){if(Oj)return ab;Oj=1;var t=xl();function e(r,n,i){for(var a=-1,o=r.length;++a<o;){var c=r[a],u=n(c);if(u!=null&&(d===void 0?u===u&&!t(u):i(u,d)))var d=u,p=c}return p}return ab=e,ab}var ob,Tj;function HV(){if(Tj)return ob;Tj=1;function t(e,r){return e>r}return ob=t,ob}var sb,Cj;function WV(){if(Cj)return sb;Cj=1;var t=p$(),e=HV(),r=_l();function n(i){return i&&i.length?t(i,r,e):void 0}return sb=n,sb}var KV=WV();const Ip=vt(KV);var lb,jj;function GV(){if(jj)return lb;jj=1;function t(e,r){return e<r}return lb=t,lb}var cb,Nj;function VV(){if(Nj)return cb;Nj=1;var t=p$(),e=GV(),r=_l();function n(i){return i&&i.length?t(i,r,e):void 0}return cb=n,cb}var XV=VV();const $p=vt(XV);var ub,Pj;function YV(){if(Pj)return ub;Pj=1;var t=p1(),e=Ka(),r=SI(),n=Qr();function i(a,o){var c=n(a)?t:r;return c(a,e(o,3))}return ub=i,ub}var db,Rj;function JV(){if(Rj)return db;Rj=1;var t=wI(),e=YV();function r(n,i){return t(e(n,i),1)}return db=r,db}var ZV=JV();const QV=vt(ZV);var fb,Ij;function eX(){if(Ij)return fb;Ij=1;var t=O1();function e(r,n){return t(r,n)}return fb=e,fb}var tX=eX();const Mp=vt(tX);var El=1e9,rX={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},e_,$t=!0,Cn="[DecimalError] ",No=Cn+"Invalid argument: ",Q1=Cn+"Exponent out of range: ",Al=Math.floor,_o=Math.pow,nX=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,un,gr=1e7,Nt=7,m$=9007199254740991,Ch=Al(m$/Nt),Te={};Te.absoluteValue=Te.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};Te.comparedTo=Te.cmp=function(t){var e,r,n,i,a=this;if(t=new a.constructor(t),a.s!==t.s)return a.s||-t.s;if(a.e!==t.e)return a.e>t.e^a.s<0?1:-1;for(n=a.d.length,i=t.d.length,e=0,r=n<i?n:i;e<r;++e)if(a.d[e]!==t.d[e])return a.d[e]>t.d[e]^a.s<0?1:-1;return n===i?0:n>i^a.s<0?1:-1};Te.decimalPlaces=Te.dp=function(){var t=this,e=t.d.length-1,r=(e-t.e)*Nt;if(e=t.d[e],e)for(;e%10==0;e/=10)r--;return r<0?0:r};Te.dividedBy=Te.div=function(t){return Xi(this,new this.constructor(t))};Te.dividedToIntegerBy=Te.idiv=function(t){var e=this,r=e.constructor;return St(Xi(e,new r(t),0,1),r.precision)};Te.equals=Te.eq=function(t){return!this.cmp(t)};Te.exponent=function(){return er(this)};Te.greaterThan=Te.gt=function(t){return this.cmp(t)>0};Te.greaterThanOrEqualTo=Te.gte=function(t){return this.cmp(t)>=0};Te.isInteger=Te.isint=function(){return this.e>this.d.length-2};Te.isNegative=Te.isneg=function(){return this.s<0};Te.isPositive=Te.ispos=function(){return this.s>0};Te.isZero=function(){return this.s===0};Te.lessThan=Te.lt=function(t){return this.cmp(t)<0};Te.lessThanOrEqualTo=Te.lte=function(t){return this.cmp(t)<1};Te.logarithm=Te.log=function(t){var e,r=this,n=r.constructor,i=n.precision,a=i+5;if(t===void 0)t=new n(10);else if(t=new n(t),t.s<1||t.eq(un))throw Error(Cn+"NaN");if(r.s<1)throw Error(Cn+(r.s?"NaN":"-Infinity"));return r.eq(un)?new n(0):($t=!1,e=Xi(lu(r,a),lu(t,a),a),$t=!0,St(e,i))};Te.minus=Te.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?v$(e,t):g$(e,(t.s=-t.s,t))};Te.modulo=Te.mod=function(t){var e,r=this,n=r.constructor,i=n.precision;if(t=new n(t),!t.s)throw Error(Cn+"NaN");return r.s?($t=!1,e=Xi(r,t,0,1).times(t),$t=!0,r.minus(e)):St(new n(r),i)};Te.naturalExponential=Te.exp=function(){return y$(this)};Te.naturalLogarithm=Te.ln=function(){return lu(this)};Te.negated=Te.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Te.plus=Te.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?g$(e,t):v$(e,(t.s=-t.s,t))};Te.precision=Te.sd=function(t){var e,r,n,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(No+t);if(e=er(i)+1,n=i.d.length-1,r=n*Nt+1,n=i.d[n],n){for(;n%10==0;n/=10)r--;for(n=i.d[0];n>=10;n/=10)r++}return t&&e>r?e:r};Te.squareRoot=Te.sqrt=function(){var t,e,r,n,i,a,o,c=this,u=c.constructor;if(c.s<1){if(!c.s)return new u(0);throw Error(Cn+"NaN")}for(t=er(c),$t=!1,i=Math.sqrt(+c),i==0||i==1/0?(e=xi(c.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Al((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),n=new u(e)):n=new u(i.toString()),r=u.precision,i=o=r+3;;)if(a=n,n=a.plus(Xi(c,a,o+2)).times(.5),xi(a.d).slice(0,o)===(e=xi(n.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(St(a,r+1,0),a.times(a).eq(c)){n=a;break}}else if(e!="9999")break;o+=4}return $t=!0,St(n,r)};Te.times=Te.mul=function(t){var e,r,n,i,a,o,c,u,d,p=this,f=p.constructor,m=p.d,v=(t=new f(t)).d;if(!p.s||!t.s)return new f(0);for(t.s*=p.s,r=p.e+t.e,u=m.length,d=v.length,u<d&&(a=m,m=v,v=a,o=u,u=d,d=o),a=[],o=u+d,n=o;n--;)a.push(0);for(n=d;--n>=0;){for(e=0,i=u+n;i>n;)c=a[i]+v[n]*m[i-n-1]+e,a[i--]=c%gr|0,e=c/gr|0;a[i]=(a[i]+e)%gr|0}for(;!a[--o];)a.pop();return e?++r:a.shift(),t.d=a,t.e=r,$t?St(t,f.precision):t};Te.toDecimalPlaces=Te.todp=function(t,e){var r=this,n=r.constructor;return r=new n(r),t===void 0?r:(ki(t,0,El),e===void 0?e=n.rounding:ki(e,0,8),St(r,t+er(r)+1,e))};Te.toExponential=function(t,e){var r,n=this,i=n.constructor;return t===void 0?r=$o(n,!0):(ki(t,0,El),e===void 0?e=i.rounding:ki(e,0,8),n=St(new i(n),t+1,e),r=$o(n,!0,t+1)),r};Te.toFixed=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?$o(i):(ki(t,0,El),e===void 0?e=a.rounding:ki(e,0,8),n=St(new a(i),t+er(i)+1,e),r=$o(n.abs(),!1,t+er(n)+1),i.isneg()&&!i.isZero()?"-"+r:r)};Te.toInteger=Te.toint=function(){var t=this,e=t.constructor;return St(new e(t),er(t)+1,e.rounding)};Te.toNumber=function(){return+this};Te.toPower=Te.pow=function(t){var e,r,n,i,a,o,c=this,u=c.constructor,d=12,p=+(t=new u(t));if(!t.s)return new u(un);if(c=new u(c),!c.s){if(t.s<1)throw Error(Cn+"Infinity");return c}if(c.eq(un))return c;if(n=u.precision,t.eq(un))return St(c,n);if(e=t.e,r=t.d.length-1,o=e>=r,a=c.s,o){if((r=p<0?-p:p)<=m$){for(i=new u(un),e=Math.ceil(n/Nt+4),$t=!1;r%2&&(i=i.times(c),Mj(i.d,e)),r=Al(r/2),r!==0;)c=c.times(c),Mj(c.d,e);return $t=!0,t.s<0?new u(un).div(i):St(i,n)}}else if(a<0)throw Error(Cn+"NaN");return a=a<0&&t.d[Math.max(e,r)]&1?-1:1,c.s=1,$t=!1,i=t.times(lu(c,n+d)),$t=!0,i=y$(i),i.s=a,i};Te.toPrecision=function(t,e){var r,n,i=this,a=i.constructor;return t===void 0?(r=er(i),n=$o(i,r<=a.toExpNeg||r>=a.toExpPos)):(ki(t,1,El),e===void 0?e=a.rounding:ki(e,0,8),i=St(new a(i),t,e),r=er(i),n=$o(i,t<=r||r<=a.toExpNeg,t)),n};Te.toSignificantDigits=Te.tosd=function(t,e){var r=this,n=r.constructor;return t===void 0?(t=n.precision,e=n.rounding):(ki(t,1,El),e===void 0?e=n.rounding:ki(e,0,8)),St(new n(r),t,e)};Te.toString=Te.valueOf=Te.val=Te.toJSON=Te[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=er(t),r=t.constructor;return $o(t,e<=r.toExpNeg||e>=r.toExpPos)};function g$(t,e){var r,n,i,a,o,c,u,d,p=t.constructor,f=p.precision;if(!t.s||!e.s)return e.s||(e=new p(t)),$t?St(e,f):e;if(u=t.d,d=e.d,o=t.e,i=e.e,u=u.slice(),a=o-i,a){for(a<0?(n=u,a=-a,c=d.length):(n=d,i=o,c=u.length),o=Math.ceil(f/Nt),c=o>c?o+1:c+1,a>c&&(a=c,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(c=u.length,a=d.length,c-a<0&&(a=c,n=d,d=u,u=n),r=0;a;)r=(u[--a]=u[a]+d[a]+r)/gr|0,u[a]%=gr;for(r&&(u.unshift(r),++i),c=u.length;u[--c]==0;)u.pop();return e.d=u,e.e=i,$t?St(e,f):e}function ki(t,e,r){if(t!==~~t||t<e||t>r)throw Error(No+t)}function xi(t){var e,r,n,i=t.length-1,a="",o=t[0];if(i>0){for(a+=o,e=1;e<i;e++)n=t[e]+"",r=Nt-n.length,r&&(a+=ja(r)),a+=n;o=t[e],n=o+"",r=Nt-n.length,r&&(a+=ja(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return a+o}var Xi=(function(){function t(n,i){var a,o=0,c=n.length;for(n=n.slice();c--;)a=n[c]*i+o,n[c]=a%gr|0,o=a/gr|0;return o&&n.unshift(o),n}function e(n,i,a,o){var c,u;if(a!=o)u=a>o?1:-1;else for(c=u=0;c<a;c++)if(n[c]!=i[c]){u=n[c]>i[c]?1:-1;break}return u}function r(n,i,a){for(var o=0;a--;)n[a]-=o,o=n[a]<i[a]?1:0,n[a]=o*gr+n[a]-i[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,i,a,o){var c,u,d,p,f,m,v,b,w,x,k,S,A,C,T,O,N,R,$=n.constructor,K=n.s==i.s?1:-1,z=n.d,U=i.d;if(!n.s)return new $(n);if(!i.s)throw Error(Cn+"Division by zero");for(u=n.e-i.e,N=U.length,T=z.length,v=new $(K),b=v.d=[],d=0;U[d]==(z[d]||0);)++d;if(U[d]>(z[d]||0)&&--u,a==null?S=a=$.precision:o?S=a+(er(n)-er(i))+1:S=a,S<0)return new $(0);if(S=S/Nt+2|0,d=0,N==1)for(p=0,U=U[0],S++;(d<T||p)&&S--;d++)A=p*gr+(z[d]||0),b[d]=A/U|0,p=A%U|0;else{for(p=gr/(U[0]+1)|0,p>1&&(U=t(U,p),z=t(z,p),N=U.length,T=z.length),C=N,w=z.slice(0,N),x=w.length;x<N;)w[x++]=0;R=U.slice(),R.unshift(0),O=U[0],U[1]>=gr/2&&++O;do p=0,c=e(U,w,N,x),c<0?(k=w[0],N!=x&&(k=k*gr+(w[1]||0)),p=k/O|0,p>1?(p>=gr&&(p=gr-1),f=t(U,p),m=f.length,x=w.length,c=e(f,w,m,x),c==1&&(p--,r(f,N<m?R:U,m))):(p==0&&(c=p=1),f=U.slice()),m=f.length,m<x&&f.unshift(0),r(w,f,x),c==-1&&(x=w.length,c=e(U,w,N,x),c<1&&(p++,r(w,N<x?R:U,x))),x=w.length):c===0&&(p++,w=[0]),b[d++]=p,c&&w[0]?w[x++]=z[C]||0:(w=[z[C]],x=1);while((C++<T||w[0]!==void 0)&&S--)}return b[0]||b.shift(),v.e=u,St(v,o?a+er(v)+1:a)}})();function y$(t,e){var r,n,i,a,o,c,u=0,d=0,p=t.constructor,f=p.precision;if(er(t)>16)throw Error(Q1+er(t));if(!t.s)return new p(un);for($t=!1,c=f,o=new p(.03125);t.abs().gte(.1);)t=t.times(o),d+=5;for(n=Math.log(_o(2,d))/Math.LN10*2+5|0,c+=n,r=i=a=new p(un),p.precision=c;;){if(i=St(i.times(t),c),r=r.times(++u),o=a.plus(Xi(i,r,c)),xi(o.d).slice(0,c)===xi(a.d).slice(0,c)){for(;d--;)a=St(a.times(a),c);return p.precision=f,e==null?($t=!0,St(a,f)):a}a=o}}function er(t){for(var e=t.e*Nt,r=t.d[0];r>=10;r/=10)e++;return e}function hb(t,e,r){if(e>t.LN10.sd())throw $t=!0,r&&(t.precision=r),Error(Cn+"LN10 precision limit exceeded");return St(new t(t.LN10),e)}function ja(t){for(var e="";t--;)e+="0";return e}function lu(t,e){var r,n,i,a,o,c,u,d,p,f=1,m=10,v=t,b=v.d,w=v.constructor,x=w.precision;if(v.s<1)throw Error(Cn+(v.s?"NaN":"-Infinity"));if(v.eq(un))return new w(0);if(e==null?($t=!1,d=x):d=e,v.eq(10))return e==null&&($t=!0),hb(w,d);if(d+=m,w.precision=d,r=xi(b),n=r.charAt(0),a=er(v),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)v=v.times(t),r=xi(v.d),n=r.charAt(0),f++;a=er(v),n>1?(v=new w("0."+r),a++):v=new w(n+"."+r.slice(1))}else return u=hb(w,d+2,x).times(a+""),v=lu(new w(n+"."+r.slice(1)),d-m).plus(u),w.precision=x,e==null?($t=!0,St(v,x)):v;for(c=o=v=Xi(v.minus(un),v.plus(un),d),p=St(v.times(v),d),i=3;;){if(o=St(o.times(p),d),u=c.plus(Xi(o,new w(i),d)),xi(u.d).slice(0,d)===xi(c.d).slice(0,d))return c=c.times(2),a!==0&&(c=c.plus(hb(w,d+2,x).times(a+""))),c=Xi(c,new w(f),d),w.precision=x,e==null?($t=!0,St(c,x)):c;c=u,i+=2}}function $j(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;e.charCodeAt(n)===48;)++n;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(n,i),e){if(i-=n,r=r-n-1,t.e=Al(r/Nt),t.d=[],n=(r+1)%Nt,r<0&&(n+=Nt),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=Nt;n<i;)t.d.push(+e.slice(n,n+=Nt));e=e.slice(n),n=Nt-e.length}else n-=i;for(;n--;)e+="0";if(t.d.push(+e),$t&&(t.e>Ch||t.e<-Ch))throw Error(Q1+r)}else t.s=0,t.e=0,t.d=[0];return t}function St(t,e,r){var n,i,a,o,c,u,d,p,f=t.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(n=e-o,n<0)n+=Nt,i=e,d=f[p=0];else{if(p=Math.ceil((n+1)/Nt),a=f.length,p>=a)return t;for(d=a=f[p],o=1;a>=10;a/=10)o++;n%=Nt,i=n-Nt+o}if(r!==void 0&&(a=_o(10,o-i-1),c=d/a%10|0,u=e<0||f[p+1]!==void 0||d%a,u=r<4?(c||u)&&(r==0||r==(t.s<0?3:2)):c>5||c==5&&(r==4||u||r==6&&(n>0?i>0?d/_o(10,o-i):0:f[p-1])%10&1||r==(t.s<0?8:7))),e<1||!f[0])return u?(a=er(t),f.length=1,e=e-a-1,f[0]=_o(10,(Nt-e%Nt)%Nt),t.e=Al(-e/Nt)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(n==0?(f.length=p,a=1,p--):(f.length=p+1,a=_o(10,Nt-n),f[p]=i>0?(d/_o(10,o-i)%_o(10,i)|0)*a:0),u)for(;;)if(p==0){(f[0]+=a)==gr&&(f[0]=1,++t.e);break}else{if(f[p]+=a,f[p]!=gr)break;f[p--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if($t&&(t.e>Ch||t.e<-Ch))throw Error(Q1+er(t));return t}function v$(t,e){var r,n,i,a,o,c,u,d,p,f,m=t.constructor,v=m.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new m(t),$t?St(e,v):e;if(u=t.d,f=e.d,n=e.e,d=t.e,u=u.slice(),o=d-n,o){for(p=o<0,p?(r=u,o=-o,c=f.length):(r=f,n=d,c=u.length),i=Math.max(Math.ceil(v/Nt),c)+2,o>i&&(o=i,r.length=1),r.reverse(),i=o;i--;)r.push(0);r.reverse()}else{for(i=u.length,c=f.length,p=i<c,p&&(c=i),i=0;i<c;i++)if(u[i]!=f[i]){p=u[i]<f[i];break}o=0}for(p&&(r=u,u=f,f=r,e.s=-e.s),c=u.length,i=f.length-c;i>0;--i)u[c++]=0;for(i=f.length;i>o;){if(u[--i]<f[i]){for(a=i;a&&u[--a]===0;)u[a]=gr-1;--u[a],u[i]+=gr}u[i]-=f[i]}for(;u[--c]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(e.d=u,e.e=n,$t?St(e,v):e):new m(0)}function $o(t,e,r){var n,i=er(t),a=xi(t.d),o=a.length;return e?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+ja(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+ja(-i-1)+a,r&&(n=r-o)>0&&(a+=ja(n))):i>=o?(a+=ja(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+ja(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=ja(n))),t.s<0?"-"+a:a}function Mj(t,e){if(t.length>e)return t.length=e,!0}function b$(t){var e,r,n;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(No+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return $j(o,a.toString())}else if(typeof a!="string")throw Error(No+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,nX.test(a))$j(o,a);else throw Error(No+a)}if(i.prototype=Te,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=b$,i.config=i.set=iX,t===void 0&&(t={}),t)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<n.length;)t.hasOwnProperty(r=n[e++])||(t[r]=this[r]);return i.config(t),i}function iX(t){if(!t||typeof t!="object")throw Error(Cn+"Object expected");var e,r,n,i=["precision",1,El,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<i.length;e+=3)if((n=t[r=i[e]])!==void 0)if(Al(n)===n&&n>=i[e+1]&&n<=i[e+2])this[r]=n;else throw Error(No+r+": "+n);if((n=t[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(No+r+": "+n);return this}var e_=b$(rX);un=new e_(1);const xt=e_;function aX(t){return cX(t)||lX(t)||sX(t)||oX()}function oX(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
469
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sX(t,e){if(t){if(typeof t=="string")return Bx(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 Bx(t,e)}}function lX(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function cX(t){if(Array.isArray(t))return Bx(t)}function Bx(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}var uX=function(e){return e},x$={},w$=function(e){return e===x$},Dj=function(e){return function r(){return arguments.length===0||arguments.length===1&&w$(arguments.length<=0?void 0:arguments[0])?r:e.apply(void 0,arguments)}},dX=function t(e,r){return e===1?r:Dj(function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=i.filter(function(c){return c!==x$}).length;return o>=e?r.apply(void 0,i):t(e-o,Dj(function(){for(var c=arguments.length,u=new Array(c),d=0;d<c;d++)u[d]=arguments[d];var p=i.map(function(f){return w$(f)?u.shift():f});return r.apply(void 0,aX(p).concat(u))}))})},Dp=function(e){return dX(e.length,e)},Ux=function(e,r){for(var n=[],i=e;i<r;++i)n[i-e]=i;return n},fX=Dp(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(r){return e[r]}).map(t)}),hX=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];if(!r.length)return uX;var i=r.reverse(),a=i[0],o=i.slice(1);return function(){return o.reduce(function(c,u){return u(c)},a.apply(void 0,arguments))}},qx=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},_$=function(e){var r=null,n=null;return function(){for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return r&&a.every(function(c,u){return c===r[u]})||(r=a,n=e.apply(void 0,a)),n}};function pX(t){var e;return t===0?e=1:e=Math.floor(new xt(t).abs().log(10).toNumber())+1,e}function mX(t,e,r){for(var n=new xt(t),i=0,a=[];n.lt(e)&&i<1e5;)a.push(n.toNumber()),n=n.add(r),i++;return a}var gX=Dp(function(t,e,r){var n=+t,i=+e;return n+r*(i-n)}),yX=Dp(function(t,e,r){var n=e-+t;return n=n||1/0,(r-t)/n}),vX=Dp(function(t,e,r){var n=e-+t;return n=n||1/0,Math.max(0,Math.min(1,(r-t)/n))});const Lp={rangeStep:mX,getDigitCount:pX,interpolateNumber:gX,uninterpolateNumber:yX,uninterpolateTruncation:vX};function Fx(t){return wX(t)||xX(t)||S$(t)||bX()}function bX(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
470
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xX(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function wX(t){if(Array.isArray(t))return Hx(t)}function cu(t,e){return kX(t)||SX(t,e)||S$(t,e)||_X()}function _X(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
471
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S$(t,e){if(t){if(typeof t=="string")return Hx(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 Hx(t,e)}}function Hx(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 SX(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var r=[],n=!0,i=!1,a=void 0;try{for(var o=t[Symbol.iterator](),c;!(n=(c=o.next()).done)&&(r.push(c.value),!(e&&r.length===e));n=!0);}catch(u){i=!0,a=u}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw a}}return r}}function kX(t){if(Array.isArray(t))return t}function k$(t){var e=cu(t,2),r=e[0],n=e[1],i=r,a=n;return r>n&&(i=n,a=r),[i,a]}function E$(t,e,r){if(t.lte(0))return new xt(0);var n=Lp.getDigitCount(t.toNumber()),i=new xt(10).pow(n),a=t.div(i),o=n!==1?.05:.1,c=new xt(Math.ceil(a.div(o).toNumber())).add(r).mul(o),u=c.mul(i);return e?u:new xt(Math.ceil(u))}function EX(t,e,r){var n=1,i=new xt(t);if(!i.isint()&&r){var a=Math.abs(t);a<1?(n=new xt(10).pow(Lp.getDigitCount(t)-1),i=new xt(Math.floor(i.div(n).toNumber())).mul(n)):a>1&&(i=new xt(Math.floor(t)))}else t===0?i=new xt(Math.floor((e-1)/2)):r||(i=new xt(Math.floor(t)));var o=Math.floor((e-1)/2),c=hX(fX(function(u){return i.add(new xt(u-o).mul(n)).toNumber()}),Ux);return c(0,e)}function A$(t,e,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(r-1)))return{step:new xt(0),tickMin:new xt(0),tickMax:new xt(0)};var a=E$(new xt(e).sub(t).div(r-1),n,i),o;t<=0&&e>=0?o=new xt(0):(o=new xt(t).add(e).div(2),o=o.sub(new xt(o).mod(a)));var c=Math.ceil(o.sub(t).div(a).toNumber()),u=Math.ceil(new xt(e).sub(o).div(a).toNumber()),d=c+u+1;return d>r?A$(t,e,r,n,i+1):(d<r&&(u=e>0?u+(r-d):u,c=e>0?c:c+(r-d)),{step:a,tickMin:o.sub(new xt(c).mul(a)),tickMax:o.add(new xt(u).mul(a))})}function AX(t){var e=cu(t,2),r=e[0],n=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),c=k$([r,n]),u=cu(c,2),d=u[0],p=u[1];if(d===-1/0||p===1/0){var f=p===1/0?[d].concat(Fx(Ux(0,i-1).map(function(){return 1/0}))):[].concat(Fx(Ux(0,i-1).map(function(){return-1/0})),[p]);return r>n?qx(f):f}if(d===p)return EX(d,i,a);var m=A$(d,p,o,a),v=m.step,b=m.tickMin,w=m.tickMax,x=Lp.rangeStep(b,w.add(new xt(.1).mul(v)),v);return r>n?qx(x):x}function OX(t,e){var r=cu(t,2),n=r[0],i=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=k$([n,i]),c=cu(o,2),u=c[0],d=c[1];if(u===-1/0||d===1/0)return[n,i];if(u===d)return[u];var p=Math.max(e,2),f=E$(new xt(d).sub(u).div(p-1),a,0),m=[].concat(Fx(Lp.rangeStep(new xt(u),new xt(d).sub(new xt(.99).mul(f)),f)),[d]);return n>i?qx(m):m}var TX=_$(AX),CX=_$(OX),jX="Invariant failed";function Mo(t,e){throw new Error(jX)}var NX=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Qs(t){"@babel/helpers - typeof";return Qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qs(t)}function jh(){return jh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},jh.apply(this,arguments)}function PX(t,e){return MX(t)||$X(t,e)||IX(t,e)||RX()}function RX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
472
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IX(t,e){if(t){if(typeof t=="string")return Lj(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 Lj(t,e)}}function Lj(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 $X(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function MX(t){if(Array.isArray(t))return t}function DX(t,e){if(t==null)return{};var r=LX(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function LX(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function zX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BX(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,C$(n.key),n)}}function UX(t,e,r){return e&&BX(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function qX(t,e,r){return e=Nh(e),FX(t,O$()?Reflect.construct(e,r||[],Nh(t).constructor):e.apply(t,r))}function FX(t,e){if(e&&(Qs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return HX(t)}function HX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function O$(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(O$=function(){return!!t})()}function Nh(t){return Nh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Nh(t)}function WX(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wx(t,e)}function Wx(t,e){return Wx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Wx(t,e)}function T$(t,e,r){return e=C$(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function C$(t){var e=KX(t,"string");return Qs(e)=="symbol"?e:e+""}function KX(t,e){if(Qs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Qs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Wu=(function(t){function e(){return zX(this,e),qX(this,e,arguments)}return WX(e,t),UX(e,[{key:"render",value:function(){var n=this.props,i=n.offset,a=n.layout,o=n.width,c=n.dataKey,u=n.data,d=n.dataPointFormatter,p=n.xAxis,f=n.yAxis,m=DX(n,NX),v=at(m,!1);this.props.direction==="x"&&p.type!=="number"&&Mo();var b=u.map(function(w){var x=d(w,c),k=x.x,S=x.y,A=x.value,C=x.errorVal;if(!C)return null;var T=[],O,N;if(Array.isArray(C)){var R=PX(C,2);O=R[0],N=R[1]}else O=N=C;if(a==="vertical"){var $=p.scale,K=S+i,z=K+o,U=K-o,F=$(A-O),X=$(A+N);T.push({x1:X,y1:z,x2:X,y2:U}),T.push({x1:F,y1:K,x2:X,y2:K}),T.push({x1:F,y1:z,x2:F,y2:U})}else if(a==="horizontal"){var Y=f.scale,G=k+i,Z=G-o,W=G+o,Q=Y(A-O),L=Y(A+N);T.push({x1:Z,y1:L,x2:W,y2:L}),T.push({x1:G,y1:Q,x2:G,y2:L}),T.push({x1:Z,y1:Q,x2:W,y2:Q})}return M.createElement(Xt,jh({className:"recharts-errorBar",key:"bar-".concat(T.map(function(I){return"".concat(I.x1,"-").concat(I.x2,"-").concat(I.y1,"-").concat(I.y2)}))},v),T.map(function(I){return M.createElement("line",jh({},I,{key:"line-".concat(I.x1,"-").concat(I.x2,"-").concat(I.y1,"-").concat(I.y2)}))}))});return M.createElement(Xt,{className:"recharts-errorBars"},b)}}])})(M.Component);T$(Wu,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});T$(Wu,"displayName","ErrorBar");function uu(t){"@babel/helpers - typeof";return uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uu(t)}function zj(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 bo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zj(Object(r),!0).forEach(function(n){GX(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zj(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function GX(t,e,r){return e=VX(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function VX(t){var e=XX(t,"string");return uu(e)=="symbol"?e:e+""}function XX(t,e){if(uu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(uu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var j$=function(e){var r=e.children,n=e.formattedGraphicalItems,i=e.legendWidth,a=e.legendContent,o=sn(r,Bs);if(!o)return null;var c=Bs.defaultProps,u=c!==void 0?bo(bo({},c),o.props):{},d;return o.props&&o.props.payload?d=o.props&&o.props.payload:a==="children"?d=(n||[]).reduce(function(p,f){var m=f.item,v=f.props,b=v.sectors||v.data||[];return p.concat(b.map(function(w){return{type:o.props.iconType||m.props.legendType,value:w.name,color:w.fill,payload:w}}))},[]):d=(n||[]).map(function(p){var f=p.item,m=f.type.defaultProps,v=m!==void 0?bo(bo({},m),f.props):{},b=v.dataKey,w=v.name,x=v.legendType,k=v.hide;return{inactive:k,dataKey:b,type:u.iconType||x||"square",color:t_(f),value:w||b,payload:v}}),bo(bo(bo({},u),Bs.getWithHeight(o,i)),{},{payload:d,item:o})};function du(t){"@babel/helpers - typeof";return du=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},du(t)}function Bj(t){return QX(t)||ZX(t)||JX(t)||YX()}function YX(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
473
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JX(t,e){if(t){if(typeof t=="string")return Kx(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 Kx(t,e)}}function ZX(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function QX(t){if(Array.isArray(t))return Kx(t)}function Kx(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 Uj(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 Wt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Uj(Object(r),!0).forEach(function(n){qs(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Uj(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qs(t,e,r){return e=eY(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eY(t){var e=tY(t,"string");return du(e)=="symbol"?e:e+""}function tY(t,e){if(du(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(du(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dn(t,e,r){return tt(t)||tt(e)?r:sr(e)?On(t,e,r):Je(e)?e(t):r}function Lc(t,e,r,n){var i=QV(t,function(c){return dn(c,e)});if(r==="number"){var a=i.filter(function(c){return ge(c)||parseFloat(c)});return a.length?[$p(a),Ip(a)]:[1/0,-1/0]}var o=n?i.filter(function(c){return!tt(c)}):i;return o.map(function(c){return sr(c)||c instanceof Date?c:""})}var rY=function(e){var r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,c=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0;if(c<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var u=a.range,d=0;d<c;d++){var p=d>0?i[d-1].coordinate:i[c-1].coordinate,f=i[d].coordinate,m=d>=c-1?i[0].coordinate:i[d+1].coordinate,v=void 0;if(Jn(f-p)!==Jn(m-f)){var b=[];if(Jn(m-f)===Jn(u[1]-u[0])){v=m;var w=f+u[1]-u[0];b[0]=Math.min(w,(w+p)/2),b[1]=Math.max(w,(w+p)/2)}else{v=p;var x=m+u[1]-u[0];b[0]=Math.min(f,(x+f)/2),b[1]=Math.max(f,(x+f)/2)}var k=[Math.min(f,(v+f)/2),Math.max(f,(v+f)/2)];if(e>k[0]&&e<=k[1]||e>=b[0]&&e<=b[1]){o=i[d].index;break}}else{var S=Math.min(p,m),A=Math.max(p,m);if(e>(S+f)/2&&e<=(A+f)/2){o=i[d].index;break}}}else for(var C=0;C<c;C++)if(C===0&&e<=(n[C].coordinate+n[C+1].coordinate)/2||C>0&&C<c-1&&e>(n[C].coordinate+n[C-1].coordinate)/2&&e<=(n[C].coordinate+n[C+1].coordinate)/2||C===c-1&&e>(n[C].coordinate+n[C-1].coordinate)/2){o=n[C].index;break}return o},t_=function(e){var r,n=e,i=n.type.displayName,a=(r=e.type)!==null&&r!==void 0&&r.defaultProps?Wt(Wt({},e.type.defaultProps),e.props):e.props,o=a.stroke,c=a.fill,u;switch(i){case"Line":u=o;break;case"Area":case"Radar":u=o&&o!=="none"?o:c;break;default:u=c;break}return u},nY=function(e){var r=e.barSize,n=e.totalSize,i=e.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},c=Object.keys(a),u=0,d=c.length;u<d;u++)for(var p=a[c[u]].stackGroups,f=Object.keys(p),m=0,v=f.length;m<v;m++){var b=p[f[m]],w=b.items,x=b.cateAxisId,k=w.filter(function(N){return Gi(N.type).indexOf("Bar")>=0});if(k&&k.length){var S=k[0].type.defaultProps,A=S!==void 0?Wt(Wt({},S),k[0].props):k[0].props,C=A.barSize,T=A[x];o[T]||(o[T]=[]);var O=tt(C)?r:C;o[T].push({item:k[0],stackList:k.slice(1),barSize:tt(O)?void 0:Io(O,n,0)})}}return o},iY=function(e){var r=e.barGap,n=e.barCategoryGap,i=e.bandSize,a=e.sizeList,o=a===void 0?[]:a,c=e.maxBarSize,u=o.length;if(u<1)return null;var d=Io(r,i,0,!0),p,f=[];if(o[0].barSize===+o[0].barSize){var m=!1,v=i/u,b=o.reduce(function(C,T){return C+T.barSize||0},0);b+=(u-1)*d,b>=i&&(b-=(u-1)*d,d=0),b>=i&&v>0&&(m=!0,v*=.9,b=u*v);var w=(i-b)/2>>0,x={offset:w-d,size:0};p=o.reduce(function(C,T){var O={item:T.item,position:{offset:x.offset+x.size+d,size:m?v:T.barSize}},N=[].concat(Bj(C),[O]);return x=N[N.length-1].position,T.stackList&&T.stackList.length&&T.stackList.forEach(function(R){N.push({item:R,position:x})}),N},f)}else{var k=Io(n,i,0,!0);i-2*k-(u-1)*d<=0&&(d=0);var S=(i-2*k-(u-1)*d)/u;S>1&&(S>>=0);var A=c===+c?Math.min(S,c):S;p=o.reduce(function(C,T,O){var N=[].concat(Bj(C),[{item:T.item,position:{offset:k+(S+d)*O+(S-A)/2,size:A}}]);return T.stackList&&T.stackList.length&&T.stackList.forEach(function(R){N.push({item:R,position:N[N.length-1].position})}),N},f)}return p},aY=function(e,r,n,i){var a=n.children,o=n.width,c=n.margin,u=o-(c.left||0)-(c.right||0),d=j$({children:a,legendWidth:u});if(d){var p=i||{},f=p.width,m=p.height,v=d.align,b=d.verticalAlign,w=d.layout;if((w==="vertical"||w==="horizontal"&&b==="middle")&&v!=="center"&&ge(e[v]))return Wt(Wt({},e),{},qs({},v,e[v]+(f||0)));if((w==="horizontal"||w==="vertical"&&v==="center")&&b!=="middle"&&ge(e[b]))return Wt(Wt({},e),{},qs({},b,e[b]+(m||0)))}return e},oY=function(e,r,n){return tt(r)?!0:e==="horizontal"?r==="yAxis":e==="vertical"||n==="x"?r==="xAxis":n==="y"?r==="yAxis":!0},N$=function(e,r,n,i,a){var o=r.props.children,c=Tn(o,Wu).filter(function(d){return oY(i,a,d.props.direction)});if(c&&c.length){var u=c.map(function(d){return d.props.dataKey});return e.reduce(function(d,p){var f=dn(p,n);if(tt(f))return d;var m=Array.isArray(f)?[$p(f),Ip(f)]:[f,f],v=u.reduce(function(b,w){var x=dn(p,w,0),k=m[0]-Math.abs(Array.isArray(x)?x[0]:x),S=m[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(k,b[0]),Math.max(S,b[1])]},[1/0,-1/0]);return[Math.min(v[0],d[0]),Math.max(v[1],d[1])]},[1/0,-1/0])}return null},sY=function(e,r,n,i,a){var o=r.map(function(c){return N$(e,c,n,a,i)}).filter(function(c){return!tt(c)});return o&&o.length?o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]):null},P$=function(e,r,n,i,a){var o=r.map(function(u){var d=u.props.dataKey;return n==="number"&&d&&N$(e,u,d,i)||Lc(e,d,n,a)});if(n==="number")return o.reduce(function(u,d){return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]);var c={};return o.reduce(function(u,d){for(var p=0,f=d.length;p<f;p++)c[d[p]]||(c[d[p]]=!0,u.push(d[p]));return u},[])},R$=function(e,r){return e==="horizontal"&&r==="xAxis"||e==="vertical"&&r==="yAxis"||e==="centric"&&r==="angleAxis"||e==="radial"&&r==="radiusAxis"},I$=function(e,r,n,i){if(i)return e.map(function(u){return u.coordinate});var a,o,c=e.map(function(u){return u.coordinate===r&&(a=!0),u.coordinate===n&&(o=!0),u.coordinate});return a||c.push(r),o||c.push(n),c},Ki=function(e,r,n){if(!e)return null;var i=e.scale,a=e.duplicateDomain,o=e.type,c=e.range,u=e.realScaleType==="scaleBand"?i.bandwidth()/2:2,d=(r||n)&&o==="category"&&i.bandwidth?i.bandwidth()/u:0;if(d=e.axisType==="angleAxis"&&(c==null?void 0:c.length)>=2?Jn(c[0]-c[1])*2*d:d,r&&(e.ticks||e.niceTicks)){var p=(e.ticks||e.niceTicks).map(function(f){var m=a?a.indexOf(f):f;return{coordinate:i(m)+d,value:f,offset:d}});return p.filter(function(f){return!Lu(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,m){return{coordinate:i(f)+d,value:f,index:m,offset:d}}):i.ticks&&!n?i.ticks(e.tickCount).map(function(f){return{coordinate:i(f)+d,value:f,offset:d}}):i.domain().map(function(f,m){return{coordinate:i(f)+d,value:a?a[f]:f,index:m,offset:d}})},pb=new WeakMap,Ef=function(e,r){if(typeof r!="function")return e;pb.has(e)||pb.set(e,new WeakMap);var n=pb.get(e);if(n.has(r))return n.get(r);var i=function(){e.apply(void 0,arguments),r.apply(void 0,arguments)};return n.set(r,i),i},lY=function(e,r,n){var i=e.scale,a=e.type,o=e.layout,c=e.axisType;if(i==="auto")return o==="radial"&&c==="radiusAxis"?{scale:nu(),realScaleType:"band"}:o==="radial"&&c==="angleAxis"?{scale:Eh(),realScaleType:"linear"}:a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!n)?{scale:Dc(),realScaleType:"point"}:a==="category"?{scale:nu(),realScaleType:"band"}:{scale:Eh(),realScaleType:"linear"};if(Ro(i)){var u="scale".concat(wp(i));return{scale:(Aj[u]||Dc)(),realScaleType:Aj[u]?u:"point"}}return Je(i)?{scale:i}:{scale:Dc(),realScaleType:"point"}},qj=1e-4,cY=function(e){var r=e.domain();if(!(!r||r.length<=2)){var n=r.length,i=e.range(),a=Math.min(i[0],i[1])-qj,o=Math.max(i[0],i[1])+qj,c=e(r[0]),u=e(r[n-1]);(c<a||c>o||u<a||u>o)&&e.domain([r[0],r[n-1]])}},uY=function(e,r){if(!e)return null;for(var n=0,i=e.length;n<i;n++)if(e[n].item===r)return e[n].position;return null},dY=function(e,r){if(!r||r.length!==2||!ge(r[0])||!ge(r[1]))return e;var n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]),a=[e[0],e[1]];return(!ge(e[0])||e[0]<n)&&(a[0]=n),(!ge(e[1])||e[1]>i)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]<n&&(a[1]=n),a},fY=function(e){var r=e.length;if(!(r<=0))for(var n=0,i=e[0].length;n<i;++n)for(var a=0,o=0,c=0;c<r;++c){var u=Lu(e[c][n][1])?e[c][n][0]:e[c][n][1];u>=0?(e[c][n][0]=a,e[c][n][1]=a+u,a=e[c][n][1]):(e[c][n][0]=o,e[c][n][1]=o+u,o=e[c][n][1])}},hY=function(e){var r=e.length;if(!(r<=0))for(var n=0,i=e[0].length;n<i;++n)for(var a=0,o=0;o<r;++o){var c=Lu(e[o][n][1])?e[o][n][0]:e[o][n][1];c>=0?(e[o][n][0]=a,e[o][n][1]=a+c,a=e[o][n][1]):(e[o][n][0]=0,e[o][n][1]=0)}},pY={sign:fY,expand:JF,none:Ws,silhouette:ZF,wiggle:QF,positive:hY},mY=function(e,r,n){var i=r.map(function(c){return c.props.dataKey}),a=pY[n],o=YF().keys(i).value(function(c,u){return+dn(c,u,0)}).order(_x).offset(a);return o(e)},gY=function(e,r,n,i,a,o){if(!e)return null;var c=o?r.reverse():r,u={},d=c.reduce(function(f,m){var v,b=(v=m.type)!==null&&v!==void 0&&v.defaultProps?Wt(Wt({},m.type.defaultProps),m.props):m.props,w=b.stackId,x=b.hide;if(x)return f;var k=b[n],S=f[k]||{hasStack:!1,stackGroups:{}};if(sr(w)){var A=S.stackGroups[w]||{numericAxisId:n,cateAxisId:i,items:[]};A.items.push(m),S.hasStack=!0,S.stackGroups[w]=A}else S.stackGroups[zu("_stackId_")]={numericAxisId:n,cateAxisId:i,items:[m]};return Wt(Wt({},f),{},qs({},k,S))},u),p={};return Object.keys(d).reduce(function(f,m){var v=d[m];if(v.hasStack){var b={};v.stackGroups=Object.keys(v.stackGroups).reduce(function(w,x){var k=v.stackGroups[x];return Wt(Wt({},w),{},qs({},x,{numericAxisId:n,cateAxisId:i,items:k.items,stackedData:mY(e,k.items,a)}))},b)}return Wt(Wt({},f),{},qs({},m,v))},p)},yY=function(e,r){var n=r.realScaleType,i=r.type,a=r.tickCount,o=r.originalDomain,c=r.allowDecimals,u=n||r.scale;if(u!=="auto"&&u!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var d=e.domain();if(!d.length)return null;var p=TX(d,a,c);return e.domain([$p(p),Ip(p)]),{niceTicks:p}}if(a&&i==="number"){var f=e.domain(),m=CX(f,a,c);return{niceTicks:m}}return null};function Fj(t){var e=t.axis,r=t.ticks,n=t.bandSize,i=t.entry,a=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!tt(i[e.dataKey])){var c=nh(r,"value",i[e.dataKey]);if(c)return c.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var u=dn(i,tt(o)?e.dataKey:o);return tt(u)?null:e.scale(u)}var Hj=function(e){var r=e.axis,n=e.ticks,i=e.offset,a=e.bandSize,o=e.entry,c=e.index;if(r.type==="category")return n[c]?n[c].coordinate+i:null;var u=dn(o,r.dataKey,r.domain[c]);return tt(u)?null:r.scale(u)-a/2+i},vY=function(e){var r=e.numericAxis,n=r.scale.domain();if(r.type==="number"){var i=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return i<=0&&a>=0?0:a<0?a:i}return n[0]},bY=function(e,r){var n,i=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Wt(Wt({},e.type.defaultProps),e.props):e.props,a=i.stackId;if(sr(a)){var o=r[a];if(o){var c=o.items.indexOf(e);return c>=0?o.stackedData[c]:null}}return null},xY=function(e){return e.reduce(function(r,n){return[$p(n.concat([r[0]]).filter(ge)),Ip(n.concat([r[1]]).filter(ge))]},[1/0,-1/0])},$$=function(e,r,n){return Object.keys(e).reduce(function(i,a){var o=e[a],c=o.stackedData,u=c.reduce(function(d,p){var f=xY(p.slice(r,n+1));return[Math.min(d[0],f[0]),Math.max(d[1],f[1])]},[1/0,-1/0]);return[Math.min(u[0],i[0]),Math.max(u[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},Wj=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Kj=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Gx=function(e,r,n){if(Je(e))return e(r,n);if(!Array.isArray(e))return r;var i=[];if(ge(e[0]))i[0]=n?e[0]:Math.min(e[0],r[0]);else if(Wj.test(e[0])){var a=+Wj.exec(e[0])[1];i[0]=r[0]-a}else Je(e[0])?i[0]=e[0](r[0]):i[0]=r[0];if(ge(e[1]))i[1]=n?e[1]:Math.max(e[1],r[1]);else if(Kj.test(e[1])){var o=+Kj.exec(e[1])[1];i[1]=r[1]+o}else Je(e[1])?i[1]=e[1](r[1]):i[1]=r[1];return i},Ph=function(e,r,n){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!n||i>0)return i}if(e&&r&&r.length>=2){for(var a=C1(r,function(f){return f.coordinate}),o=1/0,c=1,u=a.length;c<u;c++){var d=a[c],p=a[c-1];o=Math.min((d.coordinate||0)-(p.coordinate||0),o)}return o===1/0?0:o}return n?void 0:0},Gj=function(e,r,n){return!e||!e.length||Mp(e,On(n,"type.defaultProps.domain"))?r:e},M$=function(e,r){var n=e.type.defaultProps?Wt(Wt({},e.type.defaultProps),e.props):e.props,i=n.dataKey,a=n.name,o=n.unit,c=n.formatter,u=n.tooltipType,d=n.chartType,p=n.hide;return Wt(Wt({},at(e,!1)),{},{dataKey:i,unit:o,formatter:c,name:a||i,color:t_(e),value:dn(r,i),type:u,payload:r,chartType:d,hide:p})};function fu(t){"@babel/helpers - typeof";return fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fu(t)}function Vj(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 Xj(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Vj(Object(r),!0).forEach(function(n){wY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Vj(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function wY(t,e,r){return e=_Y(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _Y(t){var e=SY(t,"string");return fu(e)=="symbol"?e:e+""}function SY(t,e){if(fu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(fu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Rh=Math.PI/180,kY=function(e){return e*180/Math.PI},wr=function(e,r,n,i){return{x:e+Math.cos(-Rh*i)*n,y:r+Math.sin(-Rh*i)*n}},EY=function(e,r){var n=e.x,i=e.y,a=r.x,o=r.y;return Math.sqrt(Math.pow(n-a,2)+Math.pow(i-o,2))},AY=function(e,r){var n=e.x,i=e.y,a=r.cx,o=r.cy,c=EY({x:n,y:i},{x:a,y:o});if(c<=0)return{radius:c};var u=(n-a)/c,d=Math.acos(u);return i>o&&(d=2*Math.PI-d),{radius:c,angle:kY(d),angleInRadian:d}},OY=function(e){var r=e.startAngle,n=e.endAngle,i=Math.floor(r/360),a=Math.floor(n/360),o=Math.min(i,a);return{startAngle:r-o*360,endAngle:n-o*360}},TY=function(e,r){var n=r.startAngle,i=r.endAngle,a=Math.floor(n/360),o=Math.floor(i/360),c=Math.min(a,o);return e+c*360},Yj=function(e,r){var n=e.x,i=e.y,a=AY({x:n,y:i},r),o=a.radius,c=a.angle,u=r.innerRadius,d=r.outerRadius;if(o<u||o>d)return!1;if(o===0)return!0;var p=OY(r),f=p.startAngle,m=p.endAngle,v=c,b;if(f<=m){for(;v>m;)v-=360;for(;v<f;)v+=360;b=v>=f&&v<=m}else{for(;v>f;)v-=360;for(;v<m;)v+=360;b=v>=m&&v<=f}return b?Xj(Xj({},r),{},{radius:o,angle:TY(v,r)}):null};function hu(t){"@babel/helpers - typeof";return hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hu(t)}var CY=["offset"];function jY(t){return IY(t)||RY(t)||PY(t)||NY()}function NY(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
474
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PY(t,e){if(t){if(typeof t=="string")return Vx(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 Vx(t,e)}}function RY(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function IY(t){if(Array.isArray(t))return Vx(t)}function Vx(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 $Y(t,e){if(t==null)return{};var r=MY(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function MY(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Jj(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 or(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Jj(Object(r),!0).forEach(function(n){DY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Jj(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function DY(t,e,r){return e=LY(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function LY(t){var e=zY(t,"string");return hu(e)=="symbol"?e:e+""}function zY(t,e){if(hu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(hu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pu(){return pu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},pu.apply(this,arguments)}var BY=function(e){var r=e.value,n=e.formatter,i=tt(e.children)?r:e.children;return Je(n)?n(i):i},UY=function(e,r){var n=Jn(r-e),i=Math.min(Math.abs(r-e),360);return n*i},qY=function(e,r,n){var i=e.position,a=e.viewBox,o=e.offset,c=e.className,u=a,d=u.cx,p=u.cy,f=u.innerRadius,m=u.outerRadius,v=u.startAngle,b=u.endAngle,w=u.clockWise,x=(f+m)/2,k=UY(v,b),S=k>=0?1:-1,A,C;i==="insideStart"?(A=v+S*o,C=w):i==="insideEnd"?(A=b-S*o,C=!w):i==="end"&&(A=b+S*o,C=w),C=k<=0?C:!C;var T=wr(d,p,x,A),O=wr(d,p,x,A+(C?1:-1)*359),N="M".concat(T.x,",").concat(T.y,`
|
|
475
475
|
A`).concat(x,",").concat(x,",0,1,").concat(C?0:1,`,
|
|
476
|
-
`).concat(O.x,",").concat(O.y),R=tt(e.id)?zu("recharts-radial-line-"):e.id;return M.createElement("text",pu({},n,{dominantBaseline:"central",className:ot("recharts-radial-bar-label",c)}),M.createElement("defs",null,M.createElement("path",{id:R,d:N})),M.createElement("textPath",{xlinkHref:"#".concat(R)},r))},
|
|
477
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
476
|
+
`).concat(O.x,",").concat(O.y),R=tt(e.id)?zu("recharts-radial-line-"):e.id;return M.createElement("text",pu({},n,{dominantBaseline:"central",className:ot("recharts-radial-bar-label",c)}),M.createElement("defs",null,M.createElement("path",{id:R,d:N})),M.createElement("textPath",{xlinkHref:"#".concat(R)},r))},FY=function(e){var r=e.viewBox,n=e.offset,i=e.position,a=r,o=a.cx,c=a.cy,u=a.innerRadius,d=a.outerRadius,p=a.startAngle,f=a.endAngle,m=(p+f)/2;if(i==="outside"){var v=wr(o,c,d+n,m),b=v.x,w=v.y;return{x:b,y:w,textAnchor:b>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:c,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:c,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:c,textAnchor:"middle",verticalAnchor:"end"};var x=(u+d)/2,k=wr(o,c,x,m),S=k.x,A=k.y;return{x:S,y:A,textAnchor:"middle",verticalAnchor:"middle"}},HY=function(e){var r=e.viewBox,n=e.parentViewBox,i=e.offset,a=e.position,o=r,c=o.x,u=o.y,d=o.width,p=o.height,f=p>=0?1:-1,m=f*i,v=f>0?"end":"start",b=f>0?"start":"end",w=d>=0?1:-1,x=w*i,k=w>0?"end":"start",S=w>0?"start":"end";if(a==="top"){var A={x:c+d/2,y:u-f*i,textAnchor:"middle",verticalAnchor:v};return or(or({},A),n?{height:Math.max(u-n.y,0),width:d}:{})}if(a==="bottom"){var C={x:c+d/2,y:u+p+m,textAnchor:"middle",verticalAnchor:b};return or(or({},C),n?{height:Math.max(n.y+n.height-(u+p),0),width:d}:{})}if(a==="left"){var T={x:c-x,y:u+p/2,textAnchor:k,verticalAnchor:"middle"};return or(or({},T),n?{width:Math.max(T.x-n.x,0),height:p}:{})}if(a==="right"){var O={x:c+d+x,y:u+p/2,textAnchor:S,verticalAnchor:"middle"};return or(or({},O),n?{width:Math.max(n.x+n.width-O.x,0),height:p}:{})}var N=n?{width:d,height:p}:{};return a==="insideLeft"?or({x:c+x,y:u+p/2,textAnchor:S,verticalAnchor:"middle"},N):a==="insideRight"?or({x:c+d-x,y:u+p/2,textAnchor:k,verticalAnchor:"middle"},N):a==="insideTop"?or({x:c+d/2,y:u+m,textAnchor:"middle",verticalAnchor:b},N):a==="insideBottom"?or({x:c+d/2,y:u+p-m,textAnchor:"middle",verticalAnchor:v},N):a==="insideTopLeft"?or({x:c+x,y:u+m,textAnchor:S,verticalAnchor:b},N):a==="insideTopRight"?or({x:c+d-x,y:u+m,textAnchor:k,verticalAnchor:b},N):a==="insideBottomLeft"?or({x:c+x,y:u+p-m,textAnchor:S,verticalAnchor:v},N):a==="insideBottomRight"?or({x:c+d-x,y:u+p-m,textAnchor:k,verticalAnchor:v},N):wl(a)&&(ge(a.x)||Eo(a.x))&&(ge(a.y)||Eo(a.y))?or({x:c+Io(a.x,d),y:u+Io(a.y,p),textAnchor:"end",verticalAnchor:"end"},N):or({x:c+d/2,y:u+p/2,textAnchor:"middle",verticalAnchor:"middle"},N)},WY=function(e){return"cx"in e&&ge(e.cx)};function jr(t){var e=t.offset,r=e===void 0?5:e,n=$Y(t,CY),i=or({offset:r},n),a=i.viewBox,o=i.position,c=i.value,u=i.children,d=i.content,p=i.className,f=p===void 0?"":p,m=i.textBreakAll;if(!a||tt(c)&&tt(u)&&!j.isValidElement(d)&&!Je(d))return null;if(j.isValidElement(d))return j.cloneElement(d,i);var v;if(Je(d)){if(v=j.createElement(d,i),j.isValidElement(v))return v}else v=BY(i);var b=WY(a),w=at(i,!0);if(b&&(o==="insideStart"||o==="insideEnd"||o==="end"))return qY(i,v,w);var x=b?FY(i):HY(i);return M.createElement(yh,pu({className:ot("recharts-label",f)},w,x,{breakAll:m}),v)}jr.displayName="Label";var D$=function(e){var r=e.cx,n=e.cy,i=e.angle,a=e.startAngle,o=e.endAngle,c=e.r,u=e.radius,d=e.innerRadius,p=e.outerRadius,f=e.x,m=e.y,v=e.top,b=e.left,w=e.width,x=e.height,k=e.clockWise,S=e.labelViewBox;if(S)return S;if(ge(w)&&ge(x)){if(ge(f)&&ge(m))return{x:f,y:m,width:w,height:x};if(ge(v)&&ge(b))return{x:v,y:b,width:w,height:x}}return ge(f)&&ge(m)?{x:f,y:m,width:0,height:0}:ge(r)&&ge(n)?{cx:r,cy:n,startAngle:a||i||0,endAngle:o||i||0,innerRadius:d||0,outerRadius:p||u||c||0,clockWise:k}:e.viewBox?e.viewBox:{}},KY=function(e,r){return e?e===!0?M.createElement(jr,{key:"label-implicit",viewBox:r}):sr(e)?M.createElement(jr,{key:"label-implicit",viewBox:r,value:e}):j.isValidElement(e)?e.type===jr?j.cloneElement(e,{key:"label-implicit",viewBox:r}):M.createElement(jr,{key:"label-implicit",content:e,viewBox:r}):Je(e)?M.createElement(jr,{key:"label-implicit",content:e,viewBox:r}):wl(e)?M.createElement(jr,pu({viewBox:r},e,{key:"label-implicit"})):null:null},GY=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var i=e.children,a=D$(e),o=Tn(i,jr).map(function(u,d){return j.cloneElement(u,{viewBox:r||a,key:"label-".concat(d)})});if(!n)return o;var c=KY(e.label,r||a);return[c].concat(jY(o))};jr.parseViewBox=D$;jr.renderCallByParent=GY;var mb,Zj;function VY(){if(Zj)return mb;Zj=1;function t(e){var r=e==null?0:e.length;return r?e[r-1]:void 0}return mb=t,mb}var XY=VY();const YY=vt(XY);function mu(t){"@babel/helpers - typeof";return mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mu(t)}var JY=["valueAccessor"],ZY=["data","dataKey","clockWise","id","textBreakAll"];function QY(t){return nJ(t)||rJ(t)||tJ(t)||eJ()}function eJ(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
477
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tJ(t,e){if(t){if(typeof t=="string")return Xx(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 Xx(t,e)}}function rJ(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function nJ(t){if(Array.isArray(t))return Xx(t)}function Xx(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 Ih(){return Ih=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ih.apply(this,arguments)}function Qj(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 e2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Qj(Object(r),!0).forEach(function(n){iJ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qj(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function iJ(t,e,r){return e=aJ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function aJ(t){var e=oJ(t,"string");return mu(e)=="symbol"?e:e+""}function oJ(t,e){if(mu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(mu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function t2(t,e){if(t==null)return{};var r=sJ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function sJ(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var lJ=function(e){return Array.isArray(e.value)?YY(e.value):e.value};function za(t){var e=t.valueAccessor,r=e===void 0?lJ:e,n=t2(t,JY),i=n.data,a=n.dataKey,o=n.clockWise,c=n.id,u=n.textBreakAll,d=t2(n,ZY);return!i||!i.length?null:M.createElement(Xt,{className:"recharts-label-list"},i.map(function(p,f){var m=tt(a)?r(p,f):dn(p&&p.payload,a),v=tt(c)?{}:{id:"".concat(c,"-").concat(f)};return M.createElement(jr,Ih({},at(p,!0),d,v,{parentViewBox:p.parentViewBox,value:m,textBreakAll:u,viewBox:jr.parseViewBox(tt(o)?p:e2(e2({},p),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}za.displayName="LabelList";function cJ(t,e){return t?t===!0?M.createElement(za,{key:"labelList-implicit",data:e}):M.isValidElement(t)||Je(t)?M.createElement(za,{key:"labelList-implicit",data:e,content:t}):wl(t)?M.createElement(za,Ih({data:e},t,{key:"labelList-implicit"})):null:null}function uJ(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var n=t.children,i=Tn(n,za).map(function(o,c){return j.cloneElement(o,{data:e,key:"labelList-".concat(c)})});if(!r)return i;var a=cJ(t.label,e);return[a].concat(QY(i))}za.renderCallByParent=uJ;function gu(t){"@babel/helpers - typeof";return gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gu(t)}function Yx(){return Yx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Yx.apply(this,arguments)}function r2(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 n2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?r2(Object(r),!0).forEach(function(n){dJ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):r2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function dJ(t,e,r){return e=fJ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fJ(t){var e=hJ(t,"string");return gu(e)=="symbol"?e:e+""}function hJ(t,e){if(gu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(gu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pJ=function(e,r){var n=Jn(r-e),i=Math.min(Math.abs(r-e),359.999);return n*i},Af=function(e){var r=e.cx,n=e.cy,i=e.radius,a=e.angle,o=e.sign,c=e.isExternal,u=e.cornerRadius,d=e.cornerIsExternal,p=u*(c?1:-1)+i,f=Math.asin(u/p)/Rh,m=d?a:a+o*f,v=wr(r,n,p,m),b=wr(r,n,i,m),w=d?a-o*f:a,x=wr(r,n,p*Math.cos(f*Rh),w);return{center:v,circleTangency:b,lineTangency:x,theta:f}},L$=function(e){var r=e.cx,n=e.cy,i=e.innerRadius,a=e.outerRadius,o=e.startAngle,c=e.endAngle,u=pJ(o,c),d=o+u,p=wr(r,n,a,o),f=wr(r,n,a,d),m="M ".concat(p.x,",").concat(p.y,`
|
|
478
478
|
A `).concat(a,",").concat(a,`,0,
|
|
479
479
|
`).concat(+(Math.abs(u)>180),",").concat(+(o>d),`,
|
|
480
480
|
`).concat(f.x,",").concat(f.y,`
|
|
481
481
|
`);if(i>0){var v=wr(r,n,i,o),b=wr(r,n,i,d);m+="L ".concat(b.x,",").concat(b.y,`
|
|
482
482
|
A `).concat(i,",").concat(i,`,0,
|
|
483
483
|
`).concat(+(Math.abs(u)>180),",").concat(+(o<=d),`,
|
|
484
|
-
`).concat(v.x,",").concat(v.y," Z")}else m+="L ".concat(r,",").concat(n," Z");return m},
|
|
484
|
+
`).concat(v.x,",").concat(v.y," Z")}else m+="L ".concat(r,",").concat(n," Z");return m},mJ=function(e){var r=e.cx,n=e.cy,i=e.innerRadius,a=e.outerRadius,o=e.cornerRadius,c=e.forceCornerRadius,u=e.cornerIsExternal,d=e.startAngle,p=e.endAngle,f=Jn(p-d),m=Af({cx:r,cy:n,radius:a,angle:d,sign:f,cornerRadius:o,cornerIsExternal:u}),v=m.circleTangency,b=m.lineTangency,w=m.theta,x=Af({cx:r,cy:n,radius:a,angle:p,sign:-f,cornerRadius:o,cornerIsExternal:u}),k=x.circleTangency,S=x.lineTangency,A=x.theta,C=u?Math.abs(d-p):Math.abs(d-p)-w-A;if(C<0)return c?"M ".concat(b.x,",").concat(b.y,`
|
|
485
485
|
a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
|
|
486
486
|
a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
|
|
487
487
|
`):L$({cx:r,cy:n,innerRadius:i,outerRadius:a,startAngle:d,endAngle:p});var T="M ".concat(b.x,",").concat(b.y,`
|
|
@@ -491,14 +491,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
491
491
|
`);if(i>0){var O=Af({cx:r,cy:n,radius:i,angle:d,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:u}),N=O.circleTangency,R=O.lineTangency,$=O.theta,K=Af({cx:r,cy:n,radius:i,angle:p,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:u}),z=K.circleTangency,U=K.lineTangency,F=K.theta,X=u?Math.abs(d-p):Math.abs(d-p)-$-F;if(X<0&&o===0)return"".concat(T,"L").concat(r,",").concat(n,"Z");T+="L".concat(U.x,",").concat(U.y,`
|
|
492
492
|
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(z.x,",").concat(z.y,`
|
|
493
493
|
A`).concat(i,",").concat(i,",0,").concat(+(X>180),",").concat(+(f>0),",").concat(N.x,",").concat(N.y,`
|
|
494
|
-
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(R.x,",").concat(R.y,"Z")}else T+="L".concat(r,",").concat(n,"Z");return T},mJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},z$=function(e){var r=n2(n2({},mJ),e),n=r.cx,i=r.cy,a=r.innerRadius,o=r.outerRadius,c=r.cornerRadius,u=r.forceCornerRadius,d=r.cornerIsExternal,p=r.startAngle,f=r.endAngle,m=r.className;if(o<a||p===f)return null;var v=ot("recharts-sector",m),b=o-a,w=Io(c,b,0,!0),x;return w>0&&Math.abs(p-f)<360?x=pJ({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(w,b/2),forceCornerRadius:u,cornerIsExternal:d,startAngle:p,endAngle:f}):x=L$({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:p,endAngle:f}),M.createElement("path",Yx({},at(r,!0),{className:v,d:x,role:"img"}))};function yu(t){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yu(t)}function Jx(){return Jx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Jx.apply(this,arguments)}function i2(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 a2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?i2(Object(r),!0).forEach(function(n){gJ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gJ(t,e,r){return e=yJ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yJ(t){var e=vJ(t,"string");return yu(e)=="symbol"?e:e+""}function vJ(t,e){if(yu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(yu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var o2={curveBasisClosed:LF,curveBasisOpen:zF,curveBasis:DF,curveBumpX:SF,curveBumpY:kF,curveLinearClosed:BF,curveLinear:Sp,curveMonotoneX:UF,curveMonotoneY:qF,curveNatural:FF,curveStep:HF,curveStepAfter:KF,curveStepBefore:WF},Of=function(e){return e.x===+e.x&&e.y===+e.y},wc=function(e){return e.x},_c=function(e){return e.y},bJ=function(e,r){if(Je(e))return e;var n="curve".concat(wp(e));return(n==="curveMonotone"||n==="curveBump")&&r?o2["".concat(n).concat(r==="vertical"?"Y":"X")]:o2[n]||Sp},xJ=function(e){var r=e.type,n=r===void 0?"linear":r,i=e.points,a=i===void 0?[]:i,o=e.baseLine,c=e.layout,u=e.connectNulls,d=u===void 0?!1:u,p=bJ(n,c),f=d?a.filter(function(w){return Of(w)}):a,m;if(Array.isArray(o)){var v=d?o.filter(function(w){return Of(w)}):o,b=f.map(function(w,x){return a2(a2({},w),{},{base:v[x]})});return c==="vertical"?m=vf().y(_c).x1(wc).x0(function(w){return w.base.x}):m=vf().x(wc).y1(_c).y0(function(w){return w.base.y}),m.defined(Of).curve(p),m(b)}return c==="vertical"&&ge(o)?m=vf().y(_c).x1(wc).x0(o):ge(o)?m=vf().x(wc).y1(_c).y0(o):m=HR().x(wc).y(_c),m.defined(Of).curve(p),m(f)},Zx=function(e){var r=e.className,n=e.points,i=e.path,a=e.pathRef;if((!n||!n.length)&&!i)return null;var o=n&&n.length?xJ(e):i;return j.createElement("path",Jx({},at(e,!1),ih(e),{className:ot("recharts-curve",r),d:o,ref:a}))},gb={exports:{}},yb,s2;function wJ(){if(s2)return yb;s2=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return yb=t,yb}var vb,l2;function _J(){if(l2)return vb;l2=1;var t=wJ();function e(){}function r(){}return r.resetWarningCache=e,vb=function(){function n(o,c,u,d,p,f){if(f!==t){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}n.isRequired=n;function i(){return n}var a={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:i,element:n,elementType:n,instanceOf:i,node:n,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:r,resetWarningCache:e};return a.PropTypes=a,a},vb}var c2;function SJ(){return c2||(c2=1,gb.exports=_J()()),gb.exports}var kJ=SJ();const mt=vt(kJ),{getOwnPropertyNames:EJ,getOwnPropertySymbols:AJ}=Object,{hasOwnProperty:OJ}=Object.prototype;function bb(t,e){return function(n,i,a){return t(n,i,a)&&e(n,i,a)}}function Tf(t){return function(r,n,i){if(!r||!n||typeof r!="object"||typeof n!="object")return t(r,n,i);const{cache:a}=i,o=a.get(r),c=a.get(n);if(o&&c)return o===n&&c===r;a.set(r,n),a.set(n,r);const u=t(r,n,i);return a.delete(r),a.delete(n),u}}function TJ(t){return t!=null?t[Symbol.toStringTag]:void 0}function u2(t){return EJ(t).concat(AJ(t))}const CJ=Object.hasOwn||((t,e)=>OJ.call(t,e));function Ho(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const jJ="__v",NJ="__o",PJ="_owner",{getOwnPropertyDescriptor:d2,keys:f2}=Object;function RJ(t,e){return t.byteLength===e.byteLength&&$h(new Uint8Array(t),new Uint8Array(e))}function IJ(t,e,r){let n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function $J(t,e){return t.byteLength===e.byteLength&&$h(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function MJ(t,e){return Ho(t.getTime(),e.getTime())}function DJ(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function LJ(t,e){return t===e}function h2(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),a=t.entries();let o,c,u=0;for(;(o=a.next())&&!o.done;){const d=e.entries();let p=!1,f=0;for(;(c=d.next())&&!c.done;){if(i[f]){f++;continue}const m=o.value,v=c.value;if(r.equals(m[0],v[0],u,f,t,e,r)&&r.equals(m[1],v[1],m[0],v[0],t,e,r)){p=i[f]=!0;break}f++}if(!p)return!1;u++}return!0}const zJ=Ho;function BJ(t,e,r){const n=f2(t);let i=n.length;if(f2(e).length!==i)return!1;for(;i-- >0;)if(!B$(t,e,r,n[i]))return!1;return!0}function Sc(t,e,r){const n=u2(t);let i=n.length;if(u2(e).length!==i)return!1;let a,o,c;for(;i-- >0;)if(a=n[i],!B$(t,e,r,a)||(o=d2(t,a),c=d2(e,a),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function UJ(t,e){return Ho(t.valueOf(),e.valueOf())}function qJ(t,e){return t.source===e.source&&t.flags===e.flags}function p2(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),a=t.values();let o,c;for(;(o=a.next())&&!o.done;){const u=e.values();let d=!1,p=0;for(;(c=u.next())&&!c.done;){if(!i[p]&&r.equals(o.value,c.value,o.value,c.value,t,e,r)){d=i[p]=!0;break}p++}if(!d)return!1}return!0}function $h(t,e){let r=t.byteLength;if(e.byteLength!==r||t.byteOffset!==e.byteOffset)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function FJ(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function B$(t,e,r,n){return(n===PJ||n===NJ||n===jJ)&&(t.$$typeof||e.$$typeof)?!0:CJ(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}const HJ="[object ArrayBuffer]",WJ="[object Arguments]",KJ="[object Boolean]",GJ="[object DataView]",VJ="[object Date]",XJ="[object Error]",YJ="[object Map]",JJ="[object Number]",ZJ="[object Object]",QJ="[object RegExp]",eZ="[object Set]",tZ="[object String]",rZ={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},nZ="[object URL]",iZ=Object.prototype.toString;function aZ({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:d,areRegExpsEqual:p,areSetsEqual:f,areTypedArraysEqual:m,areUrlsEqual:v,unknownTagComparators:b}){return function(x,k,S){if(x===k)return!0;if(x==null||k==null)return!1;const A=typeof x;if(A!==typeof k)return!1;if(A!=="object")return A==="number"?c(x,k,S):A==="function"?a(x,k,S):!1;const C=x.constructor;if(C!==k.constructor)return!1;if(C===Object)return u(x,k,S);if(Array.isArray(x))return e(x,k,S);if(C===Date)return n(x,k,S);if(C===RegExp)return p(x,k,S);if(C===Map)return o(x,k,S);if(C===Set)return f(x,k,S);const T=iZ.call(x);if(T===VJ)return n(x,k,S);if(T===QJ)return p(x,k,S);if(T===YJ)return o(x,k,S);if(T===eZ)return f(x,k,S);if(T===ZJ)return typeof x.then!="function"&&typeof k.then!="function"&&u(x,k,S);if(T===nZ)return v(x,k,S);if(T===XJ)return i(x,k,S);if(T===WJ)return u(x,k,S);if(rZ[T])return m(x,k,S);if(T===HJ)return t(x,k,S);if(T===GJ)return r(x,k,S);if(T===KJ||T===JJ||T===tZ)return d(x,k,S);if(b){let O=b[T];if(!O){const N=TJ(x);N&&(O=b[N])}if(O)return O(x,k,S)}return!1}}function oZ({circular:t,createCustomConfig:e,strict:r}){let n={areArrayBuffersEqual:RJ,areArraysEqual:r?Sc:IJ,areDataViewsEqual:$J,areDatesEqual:MJ,areErrorsEqual:DJ,areFunctionsEqual:LJ,areMapsEqual:r?bb(h2,Sc):h2,areNumbersEqual:zJ,areObjectsEqual:r?Sc:BJ,arePrimitiveWrappersEqual:UJ,areRegExpsEqual:qJ,areSetsEqual:r?bb(p2,Sc):p2,areTypedArraysEqual:r?bb($h,Sc):$h,areUrlsEqual:FJ,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),t){const i=Tf(n.areArraysEqual),a=Tf(n.areMapsEqual),o=Tf(n.areObjectsEqual),c=Tf(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return n}function sZ(t){return function(e,r,n,i,a,o,c){return t(e,r,c)}}function lZ({circular:t,comparator:e,createState:r,equals:n,strict:i}){if(r)return function(c,u){const{cache:d=t?new WeakMap:void 0,meta:p}=r();return e(c,u,{cache:d,equals:n,meta:p,strict:i})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};const a={cache:void 0,equals:n,meta:void 0,strict:i};return function(c,u){return e(c,u,a)}}const cZ=Xa();Xa({strict:!0});Xa({circular:!0});Xa({circular:!0,strict:!0});Xa({createInternalComparator:()=>Ho});Xa({strict:!0,createInternalComparator:()=>Ho});Xa({circular:!0,createInternalComparator:()=>Ho});Xa({circular:!0,createInternalComparator:()=>Ho,strict:!0});function Xa(t={}){const{circular:e=!1,createInternalComparator:r,createState:n,strict:i=!1}=t,a=oZ(t),o=aZ(a),c=r?r(o):sZ(o);return lZ({circular:e,comparator:o,createState:n,equals:c,strict:i})}function uZ(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function m2(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(a){r<0&&(r=a),a-r>e?(t(a),r=-1):uZ(i)};requestAnimationFrame(n)}function Qx(t){"@babel/helpers - typeof";return Qx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qx(t)}function dZ(t){return mZ(t)||pZ(t)||hZ(t)||fZ()}function fZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
495
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
496
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
497
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q$(t,e){if(t){if(typeof t=="string")return ew(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 ew(t,e)}}function
|
|
498
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
499
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function W$(t,e){if(t){if(typeof t=="string")return rw(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 rw(t,e)}}function rw(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
|
|
500
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
501
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
494
|
+
A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(R.x,",").concat(R.y,"Z")}else T+="L".concat(r,",").concat(n,"Z");return T},gJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},z$=function(e){var r=n2(n2({},gJ),e),n=r.cx,i=r.cy,a=r.innerRadius,o=r.outerRadius,c=r.cornerRadius,u=r.forceCornerRadius,d=r.cornerIsExternal,p=r.startAngle,f=r.endAngle,m=r.className;if(o<a||p===f)return null;var v=ot("recharts-sector",m),b=o-a,w=Io(c,b,0,!0),x;return w>0&&Math.abs(p-f)<360?x=mJ({cx:n,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(w,b/2),forceCornerRadius:u,cornerIsExternal:d,startAngle:p,endAngle:f}):x=L$({cx:n,cy:i,innerRadius:a,outerRadius:o,startAngle:p,endAngle:f}),M.createElement("path",Yx({},at(r,!0),{className:v,d:x,role:"img"}))};function yu(t){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yu(t)}function Jx(){return Jx=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Jx.apply(this,arguments)}function i2(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 a2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?i2(Object(r),!0).forEach(function(n){yJ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yJ(t,e,r){return e=vJ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vJ(t){var e=bJ(t,"string");return yu(e)=="symbol"?e:e+""}function bJ(t,e){if(yu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(yu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var o2={curveBasisClosed:zF,curveBasisOpen:BF,curveBasis:LF,curveBumpX:kF,curveBumpY:EF,curveLinearClosed:UF,curveLinear:Sp,curveMonotoneX:qF,curveMonotoneY:FF,curveNatural:HF,curveStep:WF,curveStepAfter:GF,curveStepBefore:KF},Of=function(e){return e.x===+e.x&&e.y===+e.y},wc=function(e){return e.x},_c=function(e){return e.y},xJ=function(e,r){if(Je(e))return e;var n="curve".concat(wp(e));return(n==="curveMonotone"||n==="curveBump")&&r?o2["".concat(n).concat(r==="vertical"?"Y":"X")]:o2[n]||Sp},wJ=function(e){var r=e.type,n=r===void 0?"linear":r,i=e.points,a=i===void 0?[]:i,o=e.baseLine,c=e.layout,u=e.connectNulls,d=u===void 0?!1:u,p=xJ(n,c),f=d?a.filter(function(w){return Of(w)}):a,m;if(Array.isArray(o)){var v=d?o.filter(function(w){return Of(w)}):o,b=f.map(function(w,x){return a2(a2({},w),{},{base:v[x]})});return c==="vertical"?m=vf().y(_c).x1(wc).x0(function(w){return w.base.x}):m=vf().x(wc).y1(_c).y0(function(w){return w.base.y}),m.defined(Of).curve(p),m(b)}return c==="vertical"&&ge(o)?m=vf().y(_c).x1(wc).x0(o):ge(o)?m=vf().x(wc).y1(_c).y0(o):m=HR().x(wc).y(_c),m.defined(Of).curve(p),m(f)},Zx=function(e){var r=e.className,n=e.points,i=e.path,a=e.pathRef;if((!n||!n.length)&&!i)return null;var o=n&&n.length?wJ(e):i;return j.createElement("path",Jx({},at(e,!1),ih(e),{className:ot("recharts-curve",r),d:o,ref:a}))},gb={exports:{}},yb,s2;function _J(){if(s2)return yb;s2=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return yb=t,yb}var vb,l2;function SJ(){if(l2)return vb;l2=1;var t=_J();function e(){}function r(){}return r.resetWarningCache=e,vb=function(){function n(o,c,u,d,p,f){if(f!==t){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}n.isRequired=n;function i(){return n}var a={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:i,element:n,elementType:n,instanceOf:i,node:n,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:r,resetWarningCache:e};return a.PropTypes=a,a},vb}var c2;function kJ(){return c2||(c2=1,gb.exports=SJ()()),gb.exports}var EJ=kJ();const mt=vt(EJ),{getOwnPropertyNames:AJ,getOwnPropertySymbols:OJ}=Object,{hasOwnProperty:TJ}=Object.prototype;function bb(t,e){return function(n,i,a){return t(n,i,a)&&e(n,i,a)}}function Tf(t){return function(r,n,i){if(!r||!n||typeof r!="object"||typeof n!="object")return t(r,n,i);const{cache:a}=i,o=a.get(r),c=a.get(n);if(o&&c)return o===n&&c===r;a.set(r,n),a.set(n,r);const u=t(r,n,i);return a.delete(r),a.delete(n),u}}function CJ(t){return t!=null?t[Symbol.toStringTag]:void 0}function u2(t){return AJ(t).concat(OJ(t))}const jJ=Object.hasOwn||((t,e)=>TJ.call(t,e));function Ho(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const NJ="__v",PJ="__o",RJ="_owner",{getOwnPropertyDescriptor:d2,keys:f2}=Object;function IJ(t,e){return t.byteLength===e.byteLength&&$h(new Uint8Array(t),new Uint8Array(e))}function $J(t,e,r){let n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function MJ(t,e){return t.byteLength===e.byteLength&&$h(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function DJ(t,e){return Ho(t.getTime(),e.getTime())}function LJ(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function zJ(t,e){return t===e}function h2(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),a=t.entries();let o,c,u=0;for(;(o=a.next())&&!o.done;){const d=e.entries();let p=!1,f=0;for(;(c=d.next())&&!c.done;){if(i[f]){f++;continue}const m=o.value,v=c.value;if(r.equals(m[0],v[0],u,f,t,e,r)&&r.equals(m[1],v[1],m[0],v[0],t,e,r)){p=i[f]=!0;break}f++}if(!p)return!1;u++}return!0}const BJ=Ho;function UJ(t,e,r){const n=f2(t);let i=n.length;if(f2(e).length!==i)return!1;for(;i-- >0;)if(!B$(t,e,r,n[i]))return!1;return!0}function Sc(t,e,r){const n=u2(t);let i=n.length;if(u2(e).length!==i)return!1;let a,o,c;for(;i-- >0;)if(a=n[i],!B$(t,e,r,a)||(o=d2(t,a),c=d2(e,a),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function qJ(t,e){return Ho(t.valueOf(),e.valueOf())}function FJ(t,e){return t.source===e.source&&t.flags===e.flags}function p2(t,e,r){const n=t.size;if(n!==e.size)return!1;if(!n)return!0;const i=new Array(n),a=t.values();let o,c;for(;(o=a.next())&&!o.done;){const u=e.values();let d=!1,p=0;for(;(c=u.next())&&!c.done;){if(!i[p]&&r.equals(o.value,c.value,o.value,c.value,t,e,r)){d=i[p]=!0;break}p++}if(!d)return!1}return!0}function $h(t,e){let r=t.byteLength;if(e.byteLength!==r||t.byteOffset!==e.byteOffset)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function HJ(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function B$(t,e,r,n){return(n===RJ||n===PJ||n===NJ)&&(t.$$typeof||e.$$typeof)?!0:jJ(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}const WJ="[object ArrayBuffer]",KJ="[object Arguments]",GJ="[object Boolean]",VJ="[object DataView]",XJ="[object Date]",YJ="[object Error]",JJ="[object Map]",ZJ="[object Number]",QJ="[object Object]",eZ="[object RegExp]",tZ="[object Set]",rZ="[object String]",nZ={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},iZ="[object URL]",aZ=Object.prototype.toString;function oZ({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:r,areDatesEqual:n,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:d,areRegExpsEqual:p,areSetsEqual:f,areTypedArraysEqual:m,areUrlsEqual:v,unknownTagComparators:b}){return function(x,k,S){if(x===k)return!0;if(x==null||k==null)return!1;const A=typeof x;if(A!==typeof k)return!1;if(A!=="object")return A==="number"?c(x,k,S):A==="function"?a(x,k,S):!1;const C=x.constructor;if(C!==k.constructor)return!1;if(C===Object)return u(x,k,S);if(Array.isArray(x))return e(x,k,S);if(C===Date)return n(x,k,S);if(C===RegExp)return p(x,k,S);if(C===Map)return o(x,k,S);if(C===Set)return f(x,k,S);const T=aZ.call(x);if(T===XJ)return n(x,k,S);if(T===eZ)return p(x,k,S);if(T===JJ)return o(x,k,S);if(T===tZ)return f(x,k,S);if(T===QJ)return typeof x.then!="function"&&typeof k.then!="function"&&u(x,k,S);if(T===iZ)return v(x,k,S);if(T===YJ)return i(x,k,S);if(T===KJ)return u(x,k,S);if(nZ[T])return m(x,k,S);if(T===WJ)return t(x,k,S);if(T===VJ)return r(x,k,S);if(T===GJ||T===ZJ||T===rZ)return d(x,k,S);if(b){let O=b[T];if(!O){const N=CJ(x);N&&(O=b[N])}if(O)return O(x,k,S)}return!1}}function sZ({circular:t,createCustomConfig:e,strict:r}){let n={areArrayBuffersEqual:IJ,areArraysEqual:r?Sc:$J,areDataViewsEqual:MJ,areDatesEqual:DJ,areErrorsEqual:LJ,areFunctionsEqual:zJ,areMapsEqual:r?bb(h2,Sc):h2,areNumbersEqual:BJ,areObjectsEqual:r?Sc:UJ,arePrimitiveWrappersEqual:qJ,areRegExpsEqual:FJ,areSetsEqual:r?bb(p2,Sc):p2,areTypedArraysEqual:r?bb($h,Sc):$h,areUrlsEqual:HJ,unknownTagComparators:void 0};if(e&&(n=Object.assign({},n,e(n))),t){const i=Tf(n.areArraysEqual),a=Tf(n.areMapsEqual),o=Tf(n.areObjectsEqual),c=Tf(n.areSetsEqual);n=Object.assign({},n,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:c})}return n}function lZ(t){return function(e,r,n,i,a,o,c){return t(e,r,c)}}function cZ({circular:t,comparator:e,createState:r,equals:n,strict:i}){if(r)return function(c,u){const{cache:d=t?new WeakMap:void 0,meta:p}=r();return e(c,u,{cache:d,equals:n,meta:p,strict:i})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:n,meta:void 0,strict:i})};const a={cache:void 0,equals:n,meta:void 0,strict:i};return function(c,u){return e(c,u,a)}}const uZ=Xa();Xa({strict:!0});Xa({circular:!0});Xa({circular:!0,strict:!0});Xa({createInternalComparator:()=>Ho});Xa({strict:!0,createInternalComparator:()=>Ho});Xa({circular:!0,createInternalComparator:()=>Ho});Xa({circular:!0,createInternalComparator:()=>Ho,strict:!0});function Xa(t={}){const{circular:e=!1,createInternalComparator:r,createState:n,strict:i=!1}=t,a=sZ(t),o=oZ(a),c=r?r(o):lZ(o);return cZ({circular:e,comparator:o,createState:n,equals:c,strict:i})}function dZ(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function m2(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function i(a){r<0&&(r=a),a-r>e?(t(a),r=-1):dZ(i)};requestAnimationFrame(n)}function Qx(t){"@babel/helpers - typeof";return Qx=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qx(t)}function fZ(t){return gZ(t)||mZ(t)||pZ(t)||hZ()}function hZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
495
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pZ(t,e){if(t){if(typeof t=="string")return g2(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 g2(t,e)}}function g2(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 mZ(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function gZ(t){if(Array.isArray(t))return t}function yZ(){var t={},e=function(){return null},r=!1,n=function i(a){if(!r){if(Array.isArray(a)){if(!a.length)return;var o=a,c=fZ(o),u=c[0],d=c.slice(1);if(typeof u=="number"){m2(i.bind(null,d),u);return}i(u),m2(i.bind(null,d));return}Qx(a)==="object"&&(t=a,e(t)),typeof a=="function"&&a()}};return{stop:function(){r=!0},start:function(a){r=!1,n(a)},subscribe:function(a){return e=a,function(){e=function(){return null}}}}}function vu(t){"@babel/helpers - typeof";return vu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vu(t)}function y2(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 v2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?y2(Object(r),!0).forEach(function(n){U$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function U$(t,e,r){return e=vZ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vZ(t){var e=bZ(t,"string");return vu(e)==="symbol"?e:String(e)}function bZ(t,e){if(vu(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(vu(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var xZ=function(e,r){return[Object.keys(e),Object.keys(r)].reduce(function(n,i){return n.filter(function(a){return i.includes(a)})})},wZ=function(e){return e},_Z=function(e){return e.replace(/([A-Z])/g,function(r){return"-".concat(r.toLowerCase())})},zc=function(e,r){return Object.keys(r).reduce(function(n,i){return v2(v2({},n),{},U$({},i,e(i,r[i])))},{})},b2=function(e,r,n){return e.map(function(i){return"".concat(_Z(i)," ").concat(r,"ms ").concat(n)}).join(",")};function SZ(t,e){return AZ(t)||EZ(t,e)||q$(t,e)||kZ()}function kZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
496
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EZ(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function AZ(t){if(Array.isArray(t))return t}function OZ(t){return jZ(t)||CZ(t)||q$(t)||TZ()}function TZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
497
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function q$(t,e){if(t){if(typeof t=="string")return ew(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 ew(t,e)}}function CZ(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function jZ(t){if(Array.isArray(t))return ew(t)}function ew(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}var Mh=1e-4,F$=function(e,r){return[0,3*e,3*r-6*e,3*e-3*r+1]},H$=function(e,r){return e.map(function(n,i){return n*Math.pow(r,i)}).reduce(function(n,i){return n+i})},x2=function(e,r){return function(n){var i=F$(e,r);return H$(i,n)}},NZ=function(e,r){return function(n){var i=F$(e,r),a=[].concat(OZ(i.map(function(o,c){return o*c}).slice(1)),[0]);return H$(a,n)}},w2=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0],a=r[1],o=r[2],c=r[3];if(r.length===1)switch(r[0]){case"linear":i=0,a=0,o=1,c=1;break;case"ease":i=.25,a=.1,o=.25,c=1;break;case"ease-in":i=.42,a=0,o=1,c=1;break;case"ease-out":i=.42,a=0,o=.58,c=1;break;case"ease-in-out":i=0,a=0,o=.58,c=1;break;default:{var u=r[0].split("(");if(u[0]==="cubic-bezier"&&u[1].split(")")[0].split(",").length===4){var d=u[1].split(")")[0].split(",").map(function(x){return parseFloat(x)}),p=SZ(d,4);i=p[0],a=p[1],o=p[2],c=p[3]}}}var f=x2(i,o),m=x2(a,c),v=NZ(i,o),b=function(k){return k>1?1:k<0?0:k},w=function(k){for(var S=k>1?1:k,A=S,C=0;C<8;++C){var T=f(A)-S,O=v(A);if(Math.abs(T-S)<Mh||O<Mh)return m(A);A=b(A-T/O)}return m(A)};return w.isStepper=!1,w},PZ=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.stiff,n=r===void 0?100:r,i=e.damping,a=i===void 0?8:i,o=e.dt,c=o===void 0?17:o,u=function(p,f,m){var v=-(p-f)*n,b=m*a,w=m+(v-b)*c/1e3,x=m*c/1e3+p;return Math.abs(x-f)<Mh&&Math.abs(w)<Mh?[f,0]:[x,w]};return u.isStepper=!0,u.dt=c,u},RZ=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0];if(typeof i=="string")switch(i){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return w2(i);case"spring":return PZ();default:if(i.split("(")[0]==="cubic-bezier")return w2(i)}return typeof i=="function"?i:null};function bu(t){"@babel/helpers - typeof";return bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bu(t)}function _2(t){return MZ(t)||$Z(t)||W$(t)||IZ()}function IZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
498
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $Z(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function MZ(t){if(Array.isArray(t))return rw(t)}function S2(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 xr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?S2(Object(r),!0).forEach(function(n){tw(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):S2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function tw(t,e,r){return e=DZ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function DZ(t){var e=LZ(t,"string");return bu(e)==="symbol"?e:String(e)}function LZ(t,e){if(bu(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(bu(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zZ(t,e){return qZ(t)||UZ(t,e)||W$(t,e)||BZ()}function BZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
499
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function W$(t,e){if(t){if(typeof t=="string")return rw(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 rw(t,e)}}function rw(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 UZ(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function qZ(t){if(Array.isArray(t))return t}var Dh=function(e,r,n){return e+(r-e)*n},nw=function(e){var r=e.from,n=e.to;return r!==n},FZ=function t(e,r,n){var i=zc(function(a,o){if(nw(o)){var c=e(o.from,o.to,o.velocity),u=zZ(c,2),d=u[0],p=u[1];return xr(xr({},o),{},{from:d,velocity:p})}return o},r);return n<1?zc(function(a,o){return nw(o)?xr(xr({},o),{},{velocity:Dh(o.velocity,i[a].velocity,n),from:Dh(o.from,i[a].from,n)}):o},r):t(e,i,n-1)};const HZ=(function(t,e,r,n,i){var a=xZ(t,e),o=a.reduce(function(x,k){return xr(xr({},x),{},tw({},k,[t[k],e[k]]))},{}),c=a.reduce(function(x,k){return xr(xr({},x),{},tw({},k,{from:t[k],velocity:0,to:e[k]}))},{}),u=-1,d,p,f=function(){return null},m=function(){return zc(function(k,S){return S.from},c)},v=function(){return!Object.values(c).filter(nw).length},b=function(k){d||(d=k);var S=k-d,A=S/r.dt;c=FZ(r,c,A),i(xr(xr(xr({},t),e),m())),d=k,v()||(u=requestAnimationFrame(f))},w=function(k){p||(p=k);var S=(k-p)/n,A=zc(function(T,O){return Dh.apply(void 0,_2(O).concat([r(S)]))},o);if(i(xr(xr(xr({},t),e),A)),S<1)u=requestAnimationFrame(f);else{var C=zc(function(T,O){return Dh.apply(void 0,_2(O).concat([r(1)]))},o);i(xr(xr(xr({},t),e),C))}};return f=r.isStepper?b:w,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(u)}}});function el(t){"@babel/helpers - typeof";return el=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},el(t)}var WZ=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function KZ(t,e){if(t==null)return{};var r=GZ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function GZ(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function xb(t){return JZ(t)||YZ(t)||XZ(t)||VZ()}function VZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
500
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function XZ(t,e){if(t){if(typeof t=="string")return iw(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 iw(t,e)}}function YZ(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function JZ(t){if(Array.isArray(t))return iw(t)}function iw(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 k2(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 Un(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?k2(Object(r),!0).forEach(function(n){Pc(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):k2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Pc(t,e,r){return e=K$(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ZZ(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function QZ(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,K$(n.key),n)}}function eQ(t,e,r){return e&&QZ(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function K$(t){var e=tQ(t,"string");return el(e)==="symbol"?e:String(e)}function tQ(t,e){if(el(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(el(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rQ(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&aw(t,e)}function aw(t,e){return aw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},aw(t,e)}function nQ(t){var e=iQ();return function(){var n=Lh(t),i;if(e){var a=Lh(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return ow(this,i)}}function ow(t,e){if(e&&(el(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sw(t)}function sw(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function iQ(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Lh(t){return Lh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Lh(t)}var ea=(function(t){rQ(r,t);var e=nQ(r);function r(n,i){var a;ZZ(this,r),a=e.call(this,n,i);var o=a.props,c=o.isActive,u=o.attributeName,d=o.from,p=o.to,f=o.steps,m=o.children,v=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(sw(a)),a.changeStyle=a.changeStyle.bind(sw(a)),!c||v<=0)return a.state={style:{}},typeof m=="function"&&(a.state={style:p}),ow(a);if(f&&f.length)a.state={style:f[0].style};else if(d){if(typeof m=="function")return a.state={style:d},ow(a);a.state={style:u?Pc({},u,d):d}}else a.state={style:{}};return a}return eQ(r,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,c=a.canBegin,u=a.attributeName,d=a.shouldReAnimate,p=a.to,f=a.from,m=this.state.style;if(c){if(!o){var v={style:u?Pc({},u,p):p};this.state&&m&&(u&&m[u]!==p||!u&&m!==p)&&this.setState(v);return}if(!(uZ(i.to,p)&&i.canBegin&&i.isActive)){var b=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var w=b||d?f:i.to;if(this.state&&m){var x={style:u?Pc({},u,w):w};(u&&m[u]!==w||!u&&m!==w)&&this.setState(x)}this.runAnimation(Un(Un({},this.props),{},{from:w,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var a=this,o=i.from,c=i.to,u=i.duration,d=i.easing,p=i.begin,f=i.onAnimationEnd,m=i.onAnimationStart,v=HZ(o,c,RZ(d),u,this.changeStyle),b=function(){a.stopJSAnimation=v()};this.manager.start([m,p,b,u,f])}},{key:"runStepAnimation",value:function(i){var a=this,o=i.steps,c=i.begin,u=i.onAnimationStart,d=o[0],p=d.style,f=d.duration,m=f===void 0?0:f,v=function(w,x,k){if(k===0)return w;var S=x.duration,A=x.easing,C=A===void 0?"ease":A,T=x.style,O=x.properties,N=x.onAnimationEnd,R=k>0?o[k-1]:x,$=O||Object.keys(T);if(typeof C=="function"||C==="spring")return[].concat(xb(w),[a.runJSAnimation.bind(a,{from:R.style,to:T,duration:S,easing:C}),S]);var K=b2($,S,C),z=Un(Un(Un({},R.style),T),{},{transition:K});return[].concat(xb(w),[z,S,N]).filter(wZ)};return this.manager.start([u].concat(xb(o.reduce(v,[p,Math.max(m,c)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=yZ());var a=i.begin,o=i.duration,c=i.attributeName,u=i.to,d=i.easing,p=i.onAnimationStart,f=i.onAnimationEnd,m=i.steps,v=i.children,b=this.manager;if(this.unSubscribe=b.subscribe(this.handleStyleChange),typeof d=="function"||typeof v=="function"||d==="spring"){this.runJSAnimation(i);return}if(m.length>1){this.runStepAnimation(i);return}var w=c?Pc({},c,u):u,x=b2(Object.keys(w),o,d);b.start([p,a,Un(Un({},w),{},{transition:x}),o,f])}},{key:"render",value:function(){var i=this.props,a=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var c=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var u=KZ(i,WZ),d=j.Children.count(a),p=this.state.style;if(typeof a=="function")return a(p);if(!c||d===0||o<=0)return a;var f=function(v){var b=v.props,w=b.style,x=w===void 0?{}:w,k=b.className,S=j.cloneElement(v,Un(Un({},u),{},{style:Un(Un({},x),p),className:k}));return S};return d===1?f(j.Children.only(a)):M.createElement("div",null,j.Children.map(a,function(m){return f(m)}))}}]),r})(j.PureComponent);ea.displayName="Animate";ea.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};ea.propTypes={from:mt.oneOfType([mt.object,mt.string]),to:mt.oneOfType([mt.object,mt.string]),attributeName:mt.string,duration:mt.number,begin:mt.number,easing:mt.oneOfType([mt.string,mt.func]),steps:mt.arrayOf(mt.shape({duration:mt.number.isRequired,style:mt.object.isRequired,easing:mt.oneOfType([mt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),mt.func]),properties:mt.arrayOf("string"),onAnimationEnd:mt.func})),children:mt.oneOfType([mt.node,mt.func]),isActive:mt.bool,canBegin:mt.bool,onAnimationEnd:mt.func,shouldReAnimate:mt.bool,onAnimationStart:mt.func,onAnimationReStart:mt.func};function xu(t){"@babel/helpers - typeof";return xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xu(t)}function zh(){return zh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},zh.apply(this,arguments)}function aQ(t,e){return cQ(t)||lQ(t,e)||sQ(t,e)||oQ()}function oQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
501
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sQ(t,e){if(t){if(typeof t=="string")return E2(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 E2(t,e)}}function E2(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 lQ(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function cQ(t){if(Array.isArray(t))return t}function A2(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 O2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?A2(Object(r),!0).forEach(function(n){uQ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function uQ(t,e,r){return e=dQ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dQ(t){var e=fQ(t,"string");return xu(e)=="symbol"?e:e+""}function fQ(t,e){if(xu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(xu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var T2=function(e,r,n,i,a){var o=Math.min(Math.abs(n)/2,Math.abs(i)/2),c=i>=0?1:-1,u=n>=0?1:-1,d=i>=0&&n>=0||i<0&&n<0?1:0,p;if(o>0&&a instanceof Array){for(var f=[0,0,0,0],m=0,v=4;m<v;m++)f[m]=a[m]>o?o:a[m];p="M".concat(e,",").concat(r+c*f[0]),f[0]>0&&(p+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(d,",").concat(e+u*f[0],",").concat(r)),p+="L ".concat(e+n-u*f[1],",").concat(r),f[1]>0&&(p+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(d,`,
|
|
502
502
|
`).concat(e+n,",").concat(r+c*f[1])),p+="L ".concat(e+n,",").concat(r+i-c*f[2]),f[2]>0&&(p+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(d,`,
|
|
503
503
|
`).concat(e+n-u*f[2],",").concat(r+i)),p+="L ".concat(e+u*f[3],",").concat(r+i),f[3]>0&&(p+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(d,`,
|
|
504
504
|
`).concat(e,",").concat(r+i-c*f[3])),p+="Z"}else if(o>0&&a===+a&&a>0){var b=Math.min(o,a);p="M ".concat(e,",").concat(r+c*b,`
|
|
@@ -508,13 +508,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
508
508
|
L `).concat(e+n,",").concat(r+i-c*b,`
|
|
509
509
|
A `).concat(b,",").concat(b,",0,0,").concat(d,",").concat(e+n-u*b,",").concat(r+i,`
|
|
510
510
|
L `).concat(e+u*b,",").concat(r+i,`
|
|
511
|
-
A `).concat(b,",").concat(b,",0,0,").concat(d,",").concat(e,",").concat(r+i-c*b," Z")}else p="M ".concat(e,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return p},
|
|
512
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PQ(t,e){if(t){if(typeof t=="string")return R2(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 R2(t,e)}}function R2(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 RQ(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function IQ(t){if(Array.isArray(t))return t}function I2(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 $2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?I2(Object(r),!0).forEach(function(n){$Q(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function $Q(t,e,r){return e=MQ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function MQ(t){var e=DQ(t,"string");return _u(e)=="symbol"?e:e+""}function DQ(t,e){if(_u(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(_u(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var M2=function(e,r,n,i,a){var o=n-i,c;return c="M ".concat(e,",").concat(r),c+="L ".concat(e+n,",").concat(r),c+="L ".concat(e+n-o/2,",").concat(r+a),c+="L ".concat(e+n-o/2-i,",").concat(r+a),c+="L ".concat(e,",").concat(r," Z"),c},LQ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},zQ=function(e){var r=$2($2({},LQ),e),n=j.useRef(),i=j.useState(-1),a=jQ(i,2),o=a[0],c=a[1];j.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var A=n.current.getTotalLength();A&&c(A)}catch{}},[]);var u=r.x,d=r.y,p=r.upperWidth,f=r.lowerWidth,m=r.height,v=r.className,b=r.animationEasing,w=r.animationDuration,x=r.animationBegin,k=r.isUpdateAnimationActive;if(u!==+u||d!==+d||p!==+p||f!==+f||m!==+m||p===0&&f===0||m===0)return null;var S=ot("recharts-trapezoid",v);return k?M.createElement(ea,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:m,x:u,y:d},to:{upperWidth:p,lowerWidth:f,height:m,x:u,y:d},duration:w,animationEasing:b,isActive:k},function(A){var C=A.upperWidth,T=A.lowerWidth,O=A.height,N=A.x,R=A.y;return M.createElement(ea,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:w,easing:b},M.createElement("path",Bh({},at(r,!0),{className:S,d:M2(N,R,C,T,O),ref:n})))}):M.createElement("g",null,M.createElement("path",Bh({},at(r,!0),{className:S,d:M2(u,d,p,f,m)})))},BQ=["option","shapeType","propTransformer","activeClassName","isActive"];function Su(t){"@babel/helpers - typeof";return Su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Su(t)}function UQ(t,e){if(t==null)return{};var r=qQ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function qQ(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function D2(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 Uh(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?D2(Object(r),!0).forEach(function(n){FQ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):D2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function FQ(t,e,r){return e=HQ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function HQ(t){var e=WQ(t,"string");return Su(e)=="symbol"?e:e+""}function WQ(t,e){if(Su(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Su(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function KQ(t,e){return Uh(Uh({},e),t)}function GQ(t,e){return t==="symbols"}function L2(t){var e=t.shapeType,r=t.elementProps;switch(e){case"rectangle":return M.createElement(r_,r);case"trapezoid":return M.createElement(zQ,r);case"sector":return M.createElement(z$,r);case"symbols":if(GQ(e))return M.createElement(w1,r);break;default:return null}}function VQ(t){return j.isValidElement(t)?t.props:t}function XQ(t){var e=t.option,r=t.shapeType,n=t.propTransformer,i=n===void 0?KQ:n,a=t.activeClassName,o=a===void 0?"recharts-active-shape":a,c=t.isActive,u=UQ(t,BQ),d;if(j.isValidElement(e))d=j.cloneElement(e,Uh(Uh({},u),VQ(e)));else if(Je(e))d=e(u);else if(AQ(e)&&!CQ(e)){var p=i(e,u);d=M.createElement(L2,{shapeType:r,elementProps:p})}else{var f=u;d=M.createElement(L2,{shapeType:r,elementProps:f})}return c?M.createElement(Xt,{className:o},d):d}function zp(t,e){return e!=null&&"trapezoids"in t.props}function Bp(t,e){return e!=null&&"sectors"in t.props}function ku(t,e){return e!=null&&"points"in t.props}function YQ(t,e){var r,n,i=t.x===(e==null||(r=e.labelViewBox)===null||r===void 0?void 0:r.x)||t.x===e.x,a=t.y===(e==null||(n=e.labelViewBox)===null||n===void 0?void 0:n.y)||t.y===e.y;return i&&a}function JQ(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function ZQ(t,e){var r=t.x===e.x,n=t.y===e.y,i=t.z===e.z;return r&&n&&i}function QQ(t,e){var r;return zp(t,e)?r=YQ:Bp(t,e)?r=JQ:ku(t,e)&&(r=ZQ),r}function eee(t,e){var r;return zp(t,e)?r="trapezoids":Bp(t,e)?r="sectors":ku(t,e)&&(r="points"),r}function tee(t,e){if(zp(t,e)){var r;return(r=e.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(Bp(t,e)){var n;return(n=e.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return ku(t,e)?e.payload:{}}function ree(t){var e=t.activeTooltipItem,r=t.graphicalItem,n=t.itemData,i=eee(r,e),a=tee(r,e),o=n.filter(function(u,d){var p=Mp(a,u),f=r.props[i].filter(function(b){var w=QQ(r,e);return w(b,e)}),m=r.props[i].indexOf(f[f.length-1]),v=d===m;return p&&v}),c=n.indexOf(o[o.length-1]);return c}var kb,z2;function nee(){if(z2)return kb;z2=1;var t=Math.ceil,e=Math.max;function r(n,i,a,o){for(var c=-1,u=e(t((i-n)/(a||1)),0),d=Array(u);u--;)d[o?u:++c]=n,n+=a;return d}return kb=r,kb}var Eb,B2;function G$(){if(B2)return Eb;B2=1;var t=CI(),e=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=t(i),i===e||i===-e){var a=i<0?-1:1;return a*r}return i===i?i:0}return Eb=n,Eb}var Ab,U2;function iee(){if(U2)return Ab;U2=1;var t=nee(),e=Op(),r=G$();function n(i){return function(a,o,c){return c&&typeof c!="number"&&e(a,o,c)&&(o=c=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),c=c===void 0?a<o?1:-1:r(c),t(a,o,c,i)}}return Ab=n,Ab}var Ob,q2;function aee(){if(q2)return Ob;q2=1;var t=iee(),e=t();return Ob=e,Ob}var oee=aee();const qh=vt(oee);function Eu(t){"@babel/helpers - typeof";return Eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Eu(t)}function F2(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 H2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?F2(Object(r),!0).forEach(function(n){V$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function V$(t,e,r){return e=see(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function see(t){var e=lee(t,"string");return Eu(e)=="symbol"?e:e+""}function lee(t,e){if(Eu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Eu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var cee=["Webkit","Moz","O","ms"],uee=function(e,r){var n=e.replace(/(\w)/,function(a){return a.toUpperCase()}),i=cee.reduce(function(a,o){return H2(H2({},a),{},V$({},o+n,r))},{});return i[e]=r,i};function tl(t){"@babel/helpers - typeof";return tl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tl(t)}function Fh(){return Fh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Fh.apply(this,arguments)}function W2(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 Tb(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?W2(Object(r),!0).forEach(function(n){on(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):W2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function dee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function K2(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Y$(n.key),n)}}function fee(t,e,r){return e&&K2(t.prototype,e),r&&K2(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function hee(t,e,r){return e=Hh(e),pee(t,X$()?Reflect.construct(e,r||[],Hh(t).constructor):e.apply(t,r))}function pee(t,e){if(e&&(tl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mee(t)}function mee(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function X$(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(X$=function(){return!!t})()}function Hh(t){return Hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hh(t)}function gee(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uw(t,e)}function uw(t,e){return uw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},uw(t,e)}function on(t,e,r){return e=Y$(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Y$(t){var e=yee(t,"string");return tl(e)=="symbol"?e:e+""}function yee(t,e){if(tl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(tl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var vee=function(e){var r=e.data,n=e.startIndex,i=e.endIndex,a=e.x,o=e.width,c=e.travellerWidth;if(!r||!r.length)return{};var u=r.length,d=Dc().domain(qh(0,u)).range([a,a+o-c]),p=d.domain().map(function(f){return d(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:d(n),endX:d(i),scale:d,scaleValues:p}},G2=function(e){return e.changedTouches&&!!e.changedTouches.length},rl=(function(t){function e(r){var n;return dee(this,e),n=hee(this,e,[r]),on(n,"handleDrag",function(i){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(i):n.state.isSlideMoving&&n.handleSlideDrag(i)}),on(n,"handleTouchMove",function(i){i.changedTouches!=null&&i.changedTouches.length>0&&n.handleDrag(i.changedTouches[0])}),on(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,a=i.endIndex,o=i.onDragEnd,c=i.startIndex;o==null||o({endIndex:a,startIndex:c})}),n.detachDragEndListener()}),on(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),on(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),on(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),on(n,"handleSlideDragStart",function(i){var a=G2(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return gee(e,t),fee(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,a=n.endX,o=this.state.scaleValues,c=this.props,u=c.gap,d=c.data,p=d.length-1,f=Math.min(i,a),m=Math.max(i,a),v=e.getIndexInRange(o,f),b=e.getIndexInRange(o,m);return{startIndex:v-v%u,endIndex:b===p?p:b-b%u}}},{key:"getTextOfTick",value:function(n){var i=this.props,a=i.data,o=i.tickFormatter,c=i.dataKey,u=dn(a[n],c,n);return Je(o)?o(u,n):u}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var i=this.state,a=i.slideMoveStartX,o=i.startX,c=i.endX,u=this.props,d=u.x,p=u.width,f=u.travellerWidth,m=u.startIndex,v=u.endIndex,b=u.onChange,w=n.pageX-a;w>0?w=Math.min(w,d+p-f-c,d+p-f-o):w<0&&(w=Math.max(w,d-o,d-c));var x=this.getIndex({startX:o+w,endX:c+w});(x.startIndex!==m||x.endIndex!==v)&&b&&b(x),this.setState({startX:o+w,endX:c+w,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var a=G2(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,c=i.endX,u=i.startX,d=this.state[o],p=this.props,f=p.x,m=p.width,v=p.travellerWidth,b=p.onChange,w=p.gap,x=p.data,k={startX:this.state.startX,endX:this.state.endX},S=n.pageX-a;S>0?S=Math.min(S,f+m-v-d):S<0&&(S=Math.max(S,f-d)),k[o]=d+S;var A=this.getIndex(k),C=A.startIndex,T=A.endIndex,O=function(){var R=x.length-1;return o==="startX"&&(c>u?C%w===0:T%w===0)||c<u&&T===R||o==="endX"&&(c>u?T%w===0:C%w===0)||c>u&&T===R};this.setState(on(on({},o,d+S),"brushMoveStartX",n.pageX),function(){b&&O()&&b(A)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var a=this,o=this.state,c=o.scaleValues,u=o.startX,d=o.endX,p=this.state[i],f=c.indexOf(p);if(f!==-1){var m=f+n;if(!(m===-1||m>=c.length)){var v=c[m];i==="startX"&&v>=d||i==="endX"&&v<=u||this.setState(on({},i,v),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,c=n.height,u=n.fill,d=n.stroke;return M.createElement("rect",{stroke:d,fill:u,x:i,y:a,width:o,height:c})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,c=n.height,u=n.data,d=n.children,p=n.padding,f=j.Children.only(d);return f?M.cloneElement(f,{x:i,y:a,width:o,height:c,margin:p,compact:!0,data:u}):null}},{key:"renderTravellerLayer",value:function(n,i){var a,o,c=this,u=this.props,d=u.y,p=u.travellerWidth,f=u.height,m=u.traveller,v=u.ariaLabel,b=u.data,w=u.startIndex,x=u.endIndex,k=Math.max(n,this.props.x),S=Tb(Tb({},at(this.props,!1)),{},{x:k,y:d,width:p,height:f}),A=v||"Min value: ".concat((a=b[w])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=b[x])===null||o===void 0?void 0:o.name);return M.createElement(Xt,{tabIndex:0,role:"slider","aria-label":A,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(T){["ArrowLeft","ArrowRight"].includes(T.key)&&(T.preventDefault(),T.stopPropagation(),c.handleTravellerMoveKeyboard(T.key==="ArrowRight"?1:-1,i))},onFocus:function(){c.setState({isTravellerFocused:!0})},onBlur:function(){c.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(m,S))}},{key:"renderSlide",value:function(n,i){var a=this.props,o=a.y,c=a.height,u=a.stroke,d=a.travellerWidth,p=Math.min(n,i)+d,f=Math.max(Math.abs(i-n)-d,0);return M.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:u,fillOpacity:.2,x:p,y:o,width:f,height:c})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,a=n.endIndex,o=n.y,c=n.height,u=n.travellerWidth,d=n.stroke,p=this.state,f=p.startX,m=p.endX,v=5,b={pointerEvents:"none",fill:d};return M.createElement(Xt,{className:"recharts-brush-texts"},M.createElement(yh,Fh({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,m)-v,y:o+c/2},b),this.getTextOfTick(i)),M.createElement(yh,Fh({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,m)+u+v,y:o+c/2},b),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,i=n.data,a=n.className,o=n.children,c=n.x,u=n.y,d=n.width,p=n.height,f=n.alwaysShowText,m=this.state,v=m.startX,b=m.endX,w=m.isTextActive,x=m.isSlideMoving,k=m.isTravellerMoving,S=m.isTravellerFocused;if(!i||!i.length||!ge(c)||!ge(u)||!ge(d)||!ge(p)||d<=0||p<=0)return null;var A=ot("recharts-brush",a),C=M.Children.count(o)===1,T=uee("userSelect","none");return M.createElement(Xt,{className:A,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:T},this.renderBackground(),C&&this.renderPanorama(),this.renderSlide(v,b),this.renderTravellerLayer(v,"startX"),this.renderTravellerLayer(b,"endX"),(w||x||k||S||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,a=n.y,o=n.width,c=n.height,u=n.stroke,d=Math.floor(a+c/2)-1;return M.createElement(M.Fragment,null,M.createElement("rect",{x:i,y:a,width:o,height:c,fill:u,stroke:"none"}),M.createElement("line",{x1:i+1,y1:d,x2:i+o-1,y2:d,fill:"none",stroke:"#fff"}),M.createElement("line",{x1:i+1,y1:d+2,x2:i+o-1,y2:d+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var a;return M.isValidElement(n)?a=M.cloneElement(n,i):Je(n)?a=n(i):a=e.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(n,i){var a=n.data,o=n.width,c=n.x,u=n.travellerWidth,d=n.updateId,p=n.startIndex,f=n.endIndex;if(a!==i.prevData||d!==i.prevUpdateId)return Tb({prevData:a,prevTravellerWidth:u,prevUpdateId:d,prevX:c,prevWidth:o},a&&a.length?vee({data:a,width:o,x:c,travellerWidth:u,startIndex:p,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||c!==i.prevX||u!==i.prevTravellerWidth)){i.scale.range([c,c+o-u]);var m=i.scale.domain().map(function(v){return i.scale(v)});return{prevData:a,prevTravellerWidth:u,prevUpdateId:d,prevX:c,prevWidth:o,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:m}}return null}},{key:"getIndexInRange",value:function(n,i){for(var a=n.length,o=0,c=a-1;c-o>1;){var u=Math.floor((o+c)/2);n[u]>i?c=u:o=u}return i>=n[c]?c:o}}])})(j.PureComponent);on(rl,"displayName","Brush");on(rl,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Cb,V2;function bee(){if(V2)return Cb;V2=1;var t=T1();function e(r,n){var i;return t(r,function(a,o,c){return i=n(a,o,c),!i}),!!i}return Cb=e,Cb}var jb,X2;function xee(){if(X2)return jb;X2=1;var t=oI(),e=Ka(),r=bee(),n=Qr(),i=Op();function a(o,c,u){var d=n(o)?t:r;return u&&i(o,c,u)&&(c=void 0),d(o,e(c,3))}return jb=a,jb}var wee=xee();const _ee=vt(wee);var Si=function(e,r){var n=e.alwaysShow,i=e.ifOverflow;return n&&(i="extendDomain"),i===r},Nb,Y2;function See(){if(Y2)return Nb;Y2=1;var t=kI();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return Nb=e,Nb}var Pb,J2;function kee(){if(J2)return Pb;J2=1;var t=See(),e=_I(),r=Ka();function n(i,a){var o={};return a=r(a,3),e(i,function(c,u,d){t(o,u,a(c,u,d))}),o}return Pb=n,Pb}var Eee=kee();const Aee=vt(Eee);var Rb,Z2;function Oee(){if(Z2)return Rb;Z2=1;function t(e,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(!r(e[n],n,e))return!1;return!0}return Rb=t,Rb}var Ib,Q2;function Tee(){if(Q2)return Ib;Q2=1;var t=T1();function e(r,n){var i=!0;return t(r,function(a,o,c){return i=!!n(a,o,c),i}),i}return Ib=e,Ib}var $b,eN;function Cee(){if(eN)return $b;eN=1;var t=Oee(),e=Tee(),r=Ka(),n=Qr(),i=Op();function a(o,c,u){var d=n(o)?t:e;return u&&i(o,c,u)&&(c=void 0),d(o,r(c,3))}return $b=a,$b}var jee=Cee();const J$=vt(jee);var Nee=["x","y"];function Au(t){"@babel/helpers - typeof";return Au=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Au(t)}function dw(){return dw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},dw.apply(this,arguments)}function tN(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 kc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?tN(Object(r),!0).forEach(function(n){Pee(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Pee(t,e,r){return e=Ree(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ree(t){var e=Iee(t,"string");return Au(e)=="symbol"?e:e+""}function Iee(t,e){if(Au(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Au(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $ee(t,e){if(t==null)return{};var r=Mee(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Mee(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Dee(t,e){var r=t.x,n=t.y,i=$ee(t,Nee),a="".concat(r),o=parseInt(a,10),c="".concat(n),u=parseInt(c,10),d="".concat(e.height||i.height),p=parseInt(d,10),f="".concat(e.width||i.width),m=parseInt(f,10);return kc(kc(kc(kc(kc({},e),i),o?{x:o}:{}),u?{y:u}:{}),{},{height:p,width:m,name:e.name,radius:e.radius})}function rN(t){return M.createElement(XQ,dw({shapeType:"rectangle",propTransformer:Dee,activeClassName:"recharts-active-bar"},t))}var Lee=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof e=="number")return e;var a=ge(n)||H9(n);return a?e(n,i):(a||Mo(),r)}},zee=["value","background"],Z$;function nl(t){"@babel/helpers - typeof";return nl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nl(t)}function Bee(t,e){if(t==null)return{};var r=Uee(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Uee(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Wh(){return Wh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Wh.apply(this,arguments)}function nN(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 Jt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nN(Object(r),!0).forEach(function(n){$a(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iN(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,eM(n.key),n)}}function Fee(t,e,r){return e&&iN(t.prototype,e),r&&iN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Hee(t,e,r){return e=Kh(e),Wee(t,Q$()?Reflect.construct(e,r||[],Kh(t).constructor):e.apply(t,r))}function Wee(t,e){if(e&&(nl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Kee(t)}function Kee(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Q$(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Q$=function(){return!!t})()}function Kh(t){return Kh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Kh(t)}function Gee(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fw(t,e)}function fw(t,e){return fw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},fw(t,e)}function $a(t,e,r){return e=eM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eM(t){var e=Vee(t,"string");return nl(e)=="symbol"?e:e+""}function Vee(t,e){if(nl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(nl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var ta=(function(t){function e(){var r;qee(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=Hee(this,e,[].concat(i)),$a(r,"state",{isAnimationFinished:!1}),$a(r,"id",zu("recharts-bar-")),$a(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),o&&o()}),$a(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),o&&o()}),r}return Gee(e,t),Fee(e,[{key:"renderRectanglesStatically",value:function(n){var i=this,a=this.props,o=a.shape,c=a.dataKey,u=a.activeIndex,d=a.activeBar,p=at(this.props,!1);return n&&n.map(function(f,m){var v=m===u,b=v?d:o,w=Jt(Jt(Jt({},p),f),{},{isActive:v,option:b,index:m,dataKey:c,onAnimationStart:i.handleAnimationStart,onAnimationEnd:i.handleAnimationEnd});return M.createElement(Xt,Wh({className:"recharts-bar-rectangle"},ah(i.props,f,m),{key:"rectangle-".concat(f==null?void 0:f.x,"-").concat(f==null?void 0:f.y,"-").concat(f==null?void 0:f.value,"-").concat(m)}),M.createElement(rN,w))})}},{key:"renderRectanglesWithAnimation",value:function(){var n=this,i=this.props,a=i.data,o=i.layout,c=i.isAnimationActive,u=i.animationBegin,d=i.animationDuration,p=i.animationEasing,f=i.animationId,m=this.state.prevData;return M.createElement(ea,{begin:u,duration:d,isActive:c,easing:p,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(v){var b=v.t,w=a.map(function(x,k){var S=m&&m[k];if(S){var A=Vn(S.x,x.x),C=Vn(S.y,x.y),T=Vn(S.width,x.width),O=Vn(S.height,x.height);return Jt(Jt({},x),{},{x:A(b),y:C(b),width:T(b),height:O(b)})}if(o==="horizontal"){var N=Vn(0,x.height),R=N(b);return Jt(Jt({},x),{},{y:x.y+x.height-R,height:R})}var $=Vn(0,x.width),K=$(b);return Jt(Jt({},x),{},{width:K})});return M.createElement(Xt,null,n.renderRectanglesStatically(w))})}},{key:"renderRectangles",value:function(){var n=this.props,i=n.data,a=n.isAnimationActive,o=this.state.prevData;return a&&i&&i.length&&(!o||!Mp(o,i))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(i)}},{key:"renderBackground",value:function(){var n=this,i=this.props,a=i.data,o=i.dataKey,c=i.activeIndex,u=at(this.props.background,!1);return a.map(function(d,p){d.value;var f=d.background,m=Bee(d,zee);if(!f)return null;var v=Jt(Jt(Jt(Jt(Jt({},m),{},{fill:"#eee"},f),u),ah(n.props,d,p)),{},{onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd,dataKey:o,index:p,className:"recharts-bar-background-rectangle"});return M.createElement(rN,Wh({key:"background-bar-".concat(p),option:n.props.background,isActive:p===c},v))})}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.data,c=a.xAxis,u=a.yAxis,d=a.layout,p=a.children,f=Tn(p,Wu);if(!f)return null;var m=d==="vertical"?o[0].height/2:o[0].width/2,v=function(x,k){var S=Array.isArray(x.value)?x.value[1]:x.value;return{x:x.x,y:x.y,value:S,errorVal:dn(x,k)}},b={clipPath:n?"url(#clipPath-".concat(i,")"):null};return M.createElement(Xt,b,f.map(function(w){return M.cloneElement(w,{key:"error-bar-".concat(i,"-").concat(w.props.dataKey),data:o,xAxis:c,yAxis:u,layout:d,offset:m,dataPointFormatter:v})}))}},{key:"render",value:function(){var n=this.props,i=n.hide,a=n.data,o=n.className,c=n.xAxis,u=n.yAxis,d=n.left,p=n.top,f=n.width,m=n.height,v=n.isAnimationActive,b=n.background,w=n.id;if(i||!a||!a.length)return null;var x=this.state.isAnimationFinished,k=ot("recharts-bar",o),S=c&&c.allowDataOverflow,A=u&&u.allowDataOverflow,C=S||A,T=tt(w)?this.id:w;return M.createElement(Xt,{className:k},S||A?M.createElement("defs",null,M.createElement("clipPath",{id:"clipPath-".concat(T)},M.createElement("rect",{x:S?d:d-f/2,y:A?p:p-m/2,width:S?f:f*2,height:A?m:m*2}))):null,M.createElement(Xt,{className:"recharts-bar-rectangles",clipPath:C?"url(#clipPath-".concat(T,")"):null},b?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(C,T),(!v||x)&&za.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curData:n.data,prevData:i.curData}:n.data!==i.curData?{curData:n.data}:null}}])})(j.PureComponent);Z$=ta;$a(ta,"displayName","Bar");$a(ta,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Sl.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});$a(ta,"getComposedData",function(t){var e=t.props,r=t.item,n=t.barPosition,i=t.bandSize,a=t.xAxis,o=t.yAxis,c=t.xAxisTicks,u=t.yAxisTicks,d=t.stackedData,p=t.dataStartIndex,f=t.displayedData,m=t.offset,v=cY(n,r);if(!v)return null;var b=e.layout,w=r.type.defaultProps,x=w!==void 0?Jt(Jt({},w),r.props):r.props,k=x.dataKey,S=x.children,A=x.minPointSize,C=b==="horizontal"?o:a,T=d?C.scale.domain():null,O=yY({numericAxis:C}),N=Tn(S,NI),R=f.map(function($,K){var z,U,F,X,Y,G;d?z=uY(d[p+K],T):(z=dn($,k),Array.isArray(z)||(z=[O,z]));var Z=Lee(A,Z$.defaultProps.minPointSize)(z[1],K);if(b==="horizontal"){var W,Q=[o.scale(z[0]),o.scale(z[1])],L=Q[0],I=Q[1];U=Hj({axis:a,ticks:c,bandSize:i,offset:v.offset,entry:$,index:K}),F=(W=I??L)!==null&&W!==void 0?W:void 0,X=v.size;var q=L-I;if(Y=Number.isNaN(q)?0:q,G={x:U,y:o.y,width:X,height:o.height},Math.abs(Z)>0&&Math.abs(Y)<Math.abs(Z)){var ee=Jn(Y||Z)*(Math.abs(Z)-Math.abs(Y));F-=ee,Y+=ee}}else{var le=[a.scale(z[0]),a.scale(z[1])],fe=le[0],ve=le[1];if(U=fe,F=Hj({axis:o,ticks:u,bandSize:i,offset:v.offset,entry:$,index:K}),X=ve-fe,Y=v.size,G={x:a.x,y:F,width:a.width,height:Y},Math.abs(Z)>0&&Math.abs(X)<Math.abs(Z)){var qe=Jn(X||Z)*(Math.abs(Z)-Math.abs(X));X+=qe}}return Jt(Jt(Jt({},$),{},{x:U,y:F,width:X,height:Y,value:d?z:z[1],payload:$,background:G},N&&N[K]&&N[K].props),{},{tooltipPayload:[M$(r,$)],tooltipPosition:{x:U+X/2,y:F+Y/2}})});return Jt({data:R,layout:b},m)});function Ou(t){"@babel/helpers - typeof";return Ou=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ou(t)}function Xee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function aN(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tM(n.key),n)}}function Yee(t,e,r){return e&&aN(t.prototype,e),r&&aN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function oN(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 Hn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?oN(Object(r),!0).forEach(function(n){Up(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):oN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Up(t,e,r){return e=tM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function tM(t){var e=Jee(t,"string");return Ou(e)=="symbol"?e:e+""}function Jee(t,e){if(Ou(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ou(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var rM=function(e,r,n,i,a){var o=e.width,c=e.height,u=e.layout,d=e.children,p=Object.keys(r),f={left:n.left,leftMirror:n.left,right:o-n.right,rightMirror:o-n.right,top:n.top,topMirror:n.top,bottom:c-n.bottom,bottomMirror:c-n.bottom},m=!!sn(d,ta);return p.reduce(function(v,b){var w=r[b],x=w.orientation,k=w.domain,S=w.padding,A=S===void 0?{}:S,C=w.mirror,T=w.reversed,O="".concat(x).concat(C?"Mirror":""),N,R,$,K,z;if(w.type==="number"&&(w.padding==="gap"||w.padding==="no-gap")){var U=k[1]-k[0],F=1/0,X=w.categoricalDomain.sort(G9);if(X.forEach(function(le,fe){fe>0&&(F=Math.min((le||0)-(X[fe-1]||0),F))}),Number.isFinite(F)){var Y=F/U,G=w.layout==="vertical"?n.height:n.width;if(w.padding==="gap"&&(N=Y*G/2),w.padding==="no-gap"){var Z=Io(e.barCategoryGap,Y*G),W=Y*G/2;N=W-Z-(W-Z)/G*Z}}}i==="xAxis"?R=[n.left+(A.left||0)+(N||0),n.left+n.width-(A.right||0)-(N||0)]:i==="yAxis"?R=u==="horizontal"?[n.top+n.height-(A.bottom||0),n.top+(A.top||0)]:[n.top+(A.top||0)+(N||0),n.top+n.height-(A.bottom||0)-(N||0)]:R=w.range,T&&(R=[R[1],R[0]]);var Q=sY(w,a,m),L=Q.scale,I=Q.realScaleType;L.domain(k).range(R),lY(L);var q=gY(L,Hn(Hn({},w),{},{realScaleType:I}));i==="xAxis"?(z=x==="top"&&!C||x==="bottom"&&C,$=n.left,K=f[O]-z*w.height):i==="yAxis"&&(z=x==="left"&&!C||x==="right"&&C,$=f[O]-z*w.width,K=n.top);var ee=Hn(Hn(Hn({},w),q),{},{realScaleType:I,x:$,y:K,scale:L,width:i==="xAxis"?n.width:w.width,height:i==="yAxis"?n.height:w.height});return ee.bandSize=Ph(ee,q),!w.hide&&i==="xAxis"?f[O]+=(z?-1:1)*ee.height:w.hide||(f[O]+=(z?-1:1)*ee.width),Hn(Hn({},v),{},Up({},b,ee))},{})},nM=function(e,r){var n=e.x,i=e.y,a=r.x,o=r.y;return{x:Math.min(n,a),y:Math.min(i,o),width:Math.abs(a-n),height:Math.abs(o-i)}},Zee=function(e){var r=e.x1,n=e.y1,i=e.x2,a=e.y2;return nM({x:r,y:n},{x:i,y:a})},iM=(function(){function t(e){Xee(this,t),this.scale=e}return Yee(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var c=this.bandwidth?this.bandwidth():0;return this.scale(r)+c}default:return this.scale(r)}if(i){var u=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+u}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],a=n[n.length-1];return i<=a?r>=i&&r<=a:r>=a&&r<=i}}],[{key:"create",value:function(r){return new t(r)}}])})();Up(iM,"EPS",1e-4);var i_=function(e){var r=Object.keys(e).reduce(function(n,i){return Hn(Hn({},n),{},Up({},i,iM.create(e[i])))},{});return Hn(Hn({},r),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,c=a.position;return Aee(i,function(u,d){return r[d].apply(u,{bandAware:o,position:c})})},isInRange:function(i){return J$(i,function(a,o){return r[o].isInRange(a)})}})};function Qee(t){return(t%180+180)%180}var ete=function(e){var r=e.width,n=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=Qee(i),o=a*Math.PI/180,c=Math.atan(n/r),u=o>c&&o<Math.PI-c?n/Math.sin(o):r/Math.cos(o);return Math.abs(u)},Mb,sN;function tte(){if(sN)return Mb;sN=1;var t=Ka(),e=Bu(),r=Ep();function n(i){return function(a,o,c){var u=Object(a);if(!e(a)){var d=t(o,3);a=r(a),o=function(f){return d(u[f],f,u)}}var p=i(a,o,c);return p>-1?u[d?a[p]:p]:void 0}}return Mb=n,Mb}var Db,lN;function rte(){if(lN)return Db;lN=1;var t=G$();function e(r){var n=t(r),i=n%1;return n===n?i?n-i:n:0}return Db=e,Db}var Lb,cN;function nte(){if(cN)return Lb;cN=1;var t=yI(),e=Ka(),r=rte(),n=Math.max;function i(a,o,c){var u=a==null?0:a.length;if(!u)return-1;var d=c==null?0:r(c);return d<0&&(d=n(u+d,0)),t(a,e(o,3),d)}return Lb=i,Lb}var zb,uN;function ite(){if(uN)return zb;uN=1;var t=tte(),e=nte(),r=t(e);return zb=r,zb}var ate=ite();const ote=vt(ate);var ste=RR();const lte=vt(ste);var cte=lte(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),a_=j.createContext(void 0),o_=j.createContext(void 0),aM=j.createContext(void 0),oM=j.createContext({}),sM=j.createContext(void 0),lM=j.createContext(0),cM=j.createContext(0),dN=function(e){var r=e.state,n=r.xAxisMap,i=r.yAxisMap,a=r.offset,o=e.clipPathId,c=e.children,u=e.width,d=e.height,p=cte(a);return M.createElement(a_.Provider,{value:n},M.createElement(o_.Provider,{value:i},M.createElement(oM.Provider,{value:a},M.createElement(aM.Provider,{value:p},M.createElement(sM.Provider,{value:o},M.createElement(lM.Provider,{value:d},M.createElement(cM.Provider,{value:u},c)))))))},ute=function(){return j.useContext(sM)},uM=function(e){var r=j.useContext(a_);r==null&&Mo();var n=r[e];return n==null&&Mo(),n},dte=function(){var e=j.useContext(a_);return Ra(e)},fte=function(){var e=j.useContext(o_),r=ote(e,function(n){return J$(n.domain,Number.isFinite)});return r||Ra(e)},dM=function(e){var r=j.useContext(o_);r==null&&Mo();var n=r[e];return n==null&&Mo(),n},hte=function(){var e=j.useContext(aM);return e},pte=function(){return j.useContext(oM)},s_=function(){return j.useContext(cM)},l_=function(){return j.useContext(lM)};function il(t){"@babel/helpers - typeof";return il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},il(t)}function mte(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gte(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hM(n.key),n)}}function yte(t,e,r){return e&>e(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function vte(t,e,r){return e=Gh(e),bte(t,fM()?Reflect.construct(e,r||[],Gh(t).constructor):e.apply(t,r))}function bte(t,e){if(e&&(il(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xte(t)}function xte(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function fM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(fM=function(){return!!t})()}function Gh(t){return Gh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Gh(t)}function wte(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hw(t,e)}function hw(t,e){return hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},hw(t,e)}function fN(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 hN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?fN(Object(r),!0).forEach(function(n){c_(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function c_(t,e,r){return e=hM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hM(t){var e=_te(t,"string");return il(e)=="symbol"?e:e+""}function _te(t,e){if(il(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(il(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Ste(t,e){return Ote(t)||Ate(t,e)||Ete(t,e)||kte()}function kte(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
513
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ete(t,e){if(t){if(typeof t=="string")return pN(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 pN(t,e)}}function pN(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 Ate(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function Ote(t){if(Array.isArray(t))return t}function pw(){return pw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},pw.apply(this,arguments)}var Tte=function(e,r){var n;return M.isValidElement(e)?n=M.cloneElement(e,r):Je(e)?n=e(r):n=M.createElement("line",pw({},r,{className:"recharts-reference-line-line"})),n},Cte=function(e,r,n,i,a,o,c,u,d){var p=a.x,f=a.y,m=a.width,v=a.height;if(n){var b=d.y,w=e.y.apply(b,{position:o});if(Si(d,"discard")&&!e.y.isInRange(w))return null;var x=[{x:p+m,y:w},{x:p,y:w}];return u==="left"?x.reverse():x}if(r){var k=d.x,S=e.x.apply(k,{position:o});if(Si(d,"discard")&&!e.x.isInRange(S))return null;var A=[{x:S,y:f+v},{x:S,y:f}];return c==="top"?A.reverse():A}if(i){var C=d.segment,T=C.map(function(O){return e.apply(O,{position:o})});return Si(d,"discard")&&_ee(T,function(O){return!e.isInRange(O)})?null:T}return null};function jte(t){var e=t.x,r=t.y,n=t.segment,i=t.xAxisId,a=t.yAxisId,o=t.shape,c=t.className,u=t.alwaysShow,d=ute(),p=uM(i),f=dM(a),m=hte();if(!d||!m)return null;Vi(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var v=i_({x:p.scale,y:f.scale}),b=sr(e),w=sr(r),x=n&&n.length===2,k=Cte(v,b,w,x,m,t.position,p.orientation,f.orientation,t);if(!k)return null;var S=Ste(k,2),A=S[0],C=A.x,T=A.y,O=S[1],N=O.x,R=O.y,$=Si(t,"hidden")?"url(#".concat(d,")"):void 0,K=hN(hN({clipPath:$},at(t,!0)),{},{x1:C,y1:T,x2:N,y2:R});return M.createElement(Xt,{className:ot("recharts-reference-line",c)},Tte(o,K),jr.renderCallByParent(t,Zee({x1:C,y1:T,x2:N,y2:R})))}var u_=(function(t){function e(){return mte(this,e),vte(this,e,arguments)}return wte(e,t),yte(e,[{key:"render",value:function(){return M.createElement(jte,this.props)}}])})(M.Component);c_(u_,"displayName","ReferenceLine");c_(u_,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function mw(){return mw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},mw.apply(this,arguments)}function al(t){"@babel/helpers - typeof";return al=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},al(t)}function mN(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 gN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?mN(Object(r),!0).forEach(function(n){qp(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Nte(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pte(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mM(n.key),n)}}function Rte(t,e,r){return e&&Pte(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ite(t,e,r){return e=Vh(e),$te(t,pM()?Reflect.construct(e,r||[],Vh(t).constructor):e.apply(t,r))}function $te(t,e){if(e&&(al(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mte(t)}function Mte(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pM=function(){return!!t})()}function Vh(t){return Vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vh(t)}function Dte(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gw(t,e)}function gw(t,e){return gw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},gw(t,e)}function qp(t,e,r){return e=mM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mM(t){var e=Lte(t,"string");return al(e)=="symbol"?e:e+""}function Lte(t,e){if(al(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(al(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var zte=function(e){var r=e.x,n=e.y,i=e.xAxis,a=e.yAxis,o=i_({x:i.scale,y:a.scale}),c=o.apply({x:r,y:n},{bandAware:!0});return Si(e,"discard")&&!o.isInRange(c)?null:c},Fp=(function(t){function e(){return Nte(this,e),Ite(this,e,arguments)}return Dte(e,t),Rte(e,[{key:"render",value:function(){var n=this.props,i=n.x,a=n.y,o=n.r,c=n.alwaysShow,u=n.clipPathId,d=sr(i),p=sr(a);if(Vi(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!d||!p)return null;var f=zte(this.props);if(!f)return null;var m=f.x,v=f.y,b=this.props,w=b.shape,x=b.className,k=Si(this.props,"hidden")?"url(#".concat(u,")"):void 0,S=gN(gN({clipPath:k},at(this.props,!0)),{},{cx:m,cy:v});return M.createElement(Xt,{className:ot("recharts-reference-dot",x)},e.renderDot(w,S),jr.renderCallByParent(this.props,{x:m-o,y:v-o,width:2*o,height:2*o}))}}])})(M.Component);qp(Fp,"displayName","ReferenceDot");qp(Fp,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});qp(Fp,"renderDot",function(t,e){var r;return M.isValidElement(t)?r=M.cloneElement(t,e):Je(t)?r=t(e):r=M.createElement(n_,mw({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),r});function yw(){return yw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},yw.apply(this,arguments)}function ol(t){"@babel/helpers - typeof";return ol=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ol(t)}function yN(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 vN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yN(Object(r),!0).forEach(function(n){Hp(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Bte(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ute(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yM(n.key),n)}}function qte(t,e,r){return e&&Ute(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Fte(t,e,r){return e=Xh(e),Hte(t,gM()?Reflect.construct(e,r||[],Xh(t).constructor):e.apply(t,r))}function Hte(t,e){if(e&&(ol(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Wte(t)}function Wte(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function gM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gM=function(){return!!t})()}function Xh(t){return Xh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Xh(t)}function Kte(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vw(t,e)}function vw(t,e){return vw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},vw(t,e)}function Hp(t,e,r){return e=yM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yM(t){var e=Gte(t,"string");return ol(e)=="symbol"?e:e+""}function Gte(t,e){if(ol(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ol(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Vte=function(e,r,n,i,a){var o=a.x1,c=a.x2,u=a.y1,d=a.y2,p=a.xAxis,f=a.yAxis;if(!p||!f)return null;var m=i_({x:p.scale,y:f.scale}),v={x:e?m.x.apply(o,{position:"start"}):m.x.rangeMin,y:n?m.y.apply(u,{position:"start"}):m.y.rangeMin},b={x:r?m.x.apply(c,{position:"end"}):m.x.rangeMax,y:i?m.y.apply(d,{position:"end"}):m.y.rangeMax};return Si(a,"discard")&&(!m.isInRange(v)||!m.isInRange(b))?null:nM(v,b)},Wp=(function(t){function e(){return Bte(this,e),Fte(this,e,arguments)}return Kte(e,t),qte(e,[{key:"render",value:function(){var n=this.props,i=n.x1,a=n.x2,o=n.y1,c=n.y2,u=n.className,d=n.alwaysShow,p=n.clipPathId;Vi(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=sr(i),m=sr(a),v=sr(o),b=sr(c),w=this.props.shape;if(!f&&!m&&!v&&!b&&!w)return null;var x=Vte(f,m,v,b,this.props);if(!x&&!w)return null;var k=Si(this.props,"hidden")?"url(#".concat(p,")"):void 0;return M.createElement(Xt,{className:ot("recharts-reference-area",u)},e.renderRect(w,vN(vN({clipPath:k},at(this.props,!0)),x)),jr.renderCallByParent(this.props,x))}}])})(M.Component);Hp(Wp,"displayName","ReferenceArea");Hp(Wp,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});Hp(Wp,"renderRect",function(t,e){var r;return M.isValidElement(t)?r=M.cloneElement(t,e):Je(t)?r=t(e):r=M.createElement(r_,yw({},e,{className:"recharts-reference-area-rect"})),r});function vM(t,e,r){if(e<1)return[];if(e===1&&r===void 0)return t;for(var n=[],i=0;i<t.length;i+=e)n.push(t[i]);return n}function Xte(t,e,r){var n={width:t.width+e.width,height:t.height+e.height};return ete(n,r)}function Yte(t,e,r){var n=r==="width",i=t.x,a=t.y,o=t.width,c=t.height;return e===1?{start:n?i:a,end:n?i+o:a+c}:{start:n?i+o:a+c,end:n?i:a}}function Yh(t,e,r,n,i){if(t*e<t*n||t*e>t*i)return!1;var a=r();return t*(e-t*a/2-n)>=0&&t*(e+t*a/2-i)<=0}function Jte(t,e){return vM(t,e+1)}function Zte(t,e,r,n,i){for(var a=(n||[]).slice(),o=e.start,c=e.end,u=0,d=1,p=o,f=function(){var b=n==null?void 0:n[u];if(b===void 0)return{v:vM(n,d)};var w=u,x,k=function(){return x===void 0&&(x=r(b,w)),x},S=b.coordinate,A=u===0||Yh(t,S,k,p,c);A||(u=0,p=o,d+=1),A&&(p=S+t*(k()/2+i),u+=d)},m;d<=a.length;)if(m=f(),m)return m.v;return[]}function Tu(t){"@babel/helpers - typeof";return Tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tu(t)}function bN(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 Cr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bN(Object(r),!0).forEach(function(n){Qte(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Qte(t,e,r){return e=ere(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ere(t){var e=tre(t,"string");return Tu(e)=="symbol"?e:e+""}function tre(t,e){if(Tu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Tu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rre(t,e,r,n,i){for(var a=(n||[]).slice(),o=a.length,c=e.start,u=e.end,d=function(m){var v=a[m],b,w=function(){return b===void 0&&(b=r(v,m)),b};if(m===o-1){var x=t*(v.coordinate+t*w()/2-u);a[m]=v=Cr(Cr({},v),{},{tickCoord:x>0?v.coordinate-x*t:v.coordinate})}else a[m]=v=Cr(Cr({},v),{},{tickCoord:v.coordinate});var k=Yh(t,v.tickCoord,w,c,u);k&&(u=v.tickCoord-t*(w()/2+i),a[m]=Cr(Cr({},v),{},{isShow:!0}))},p=o-1;p>=0;p--)d(p);return a}function nre(t,e,r,n,i,a){var o=(n||[]).slice(),c=o.length,u=e.start,d=e.end;if(a){var p=n[c-1],f=r(p,c-1),m=t*(p.coordinate+t*f/2-d);o[c-1]=p=Cr(Cr({},p),{},{tickCoord:m>0?p.coordinate-m*t:p.coordinate});var v=Yh(t,p.tickCoord,function(){return f},u,d);v&&(d=p.tickCoord-t*(f/2+i),o[c-1]=Cr(Cr({},p),{},{isShow:!0}))}for(var b=a?c-1:c,w=function(S){var A=o[S],C,T=function(){return C===void 0&&(C=r(A,S)),C};if(S===0){var O=t*(A.coordinate-t*T()/2-u);o[S]=A=Cr(Cr({},A),{},{tickCoord:O<0?A.coordinate-O*t:A.coordinate})}else o[S]=A=Cr(Cr({},A),{},{tickCoord:A.coordinate});var N=Yh(t,A.tickCoord,T,u,d);N&&(u=A.tickCoord+t*(T()/2+i),o[S]=Cr(Cr({},A),{},{isShow:!0}))},x=0;x<b;x++)w(x);return o}function d_(t,e,r){var n=t.tick,i=t.ticks,a=t.viewBox,o=t.minTickGap,c=t.orientation,u=t.interval,d=t.tickFormatter,p=t.unit,f=t.angle;if(!i||!i.length||!n)return[];if(ge(u)||Sl.isSsr)return Jte(i,typeof u=="number"&&ge(u)?u:0);var m=[],v=c==="top"||c==="bottom"?"width":"height",b=p&&v==="width"?Mc(p,{fontSize:e,letterSpacing:r}):{width:0,height:0},w=function(A,C){var T=Je(d)?d(A.value,C):A.value;return v==="width"?Xte(Mc(T,{fontSize:e,letterSpacing:r}),b,f):Mc(T,{fontSize:e,letterSpacing:r})[v]},x=i.length>=2?Jn(i[1].coordinate-i[0].coordinate):1,k=Yte(a,x,v);return u==="equidistantPreserveStart"?Zte(x,k,w,i,o):(u==="preserveStart"||u==="preserveStartEnd"?m=nre(x,k,w,i,o,u==="preserveStartEnd"):m=rre(x,k,w,i,o),m.filter(function(S){return S.isShow}))}var ire=["viewBox"],are=["viewBox"],ore=["ticks"];function sl(t){"@babel/helpers - typeof";return sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sl(t)}function Is(){return Is=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Is.apply(this,arguments)}function xN(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 ar(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xN(Object(r),!0).forEach(function(n){f_(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Bb(t,e){if(t==null)return{};var r=sre(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function sre(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function lre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wN(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xM(n.key),n)}}function cre(t,e,r){return e&&wN(t.prototype,e),r&&wN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ure(t,e,r){return e=Jh(e),dre(t,bM()?Reflect.construct(e,r||[],Jh(t).constructor):e.apply(t,r))}function dre(t,e){if(e&&(sl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fre(t)}function fre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bM=function(){return!!t})()}function Jh(t){return Jh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Jh(t)}function hre(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bw(t,e)}function bw(t,e){return bw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},bw(t,e)}function f_(t,e,r){return e=xM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xM(t){var e=pre(t,"string");return sl(e)=="symbol"?e:e+""}function pre(t,e){if(sl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(sl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Ol=(function(t){function e(r){var n;return lre(this,e),n=ure(this,e,[r]),n.state={fontSize:"",letterSpacing:""},n}return hre(e,t),cre(e,[{key:"shouldComponentUpdate",value:function(n,i){var a=n.viewBox,o=Bb(n,ire),c=this.props,u=c.viewBox,d=Bb(c,are);return!zs(a,u)||!zs(o,d)||!zs(i,this.state)}},{key:"componentDidMount",value:function(){var n=this.layerReference;if(n){var i=n.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];i&&this.setState({fontSize:window.getComputedStyle(i).fontSize,letterSpacing:window.getComputedStyle(i).letterSpacing})}}},{key:"getTickLineCoord",value:function(n){var i=this.props,a=i.x,o=i.y,c=i.width,u=i.height,d=i.orientation,p=i.tickSize,f=i.mirror,m=i.tickMargin,v,b,w,x,k,S,A=f?-1:1,C=n.tickSize||p,T=ge(n.tickCoord)?n.tickCoord:n.coordinate;switch(d){case"top":v=b=n.coordinate,x=o+ +!f*u,w=x-A*C,S=w-A*m,k=T;break;case"left":w=x=n.coordinate,b=a+ +!f*c,v=b-A*C,k=v-A*m,S=T;break;case"right":w=x=n.coordinate,b=a+ +f*c,v=b+A*C,k=v+A*m,S=T;break;default:v=b=n.coordinate,x=o+ +f*u,w=x+A*C,S=w+A*m,k=T;break}return{line:{x1:v,y1:w,x2:b,y2:x},tick:{x:k,y:S}}}},{key:"getTickTextAnchor",value:function(){var n=this.props,i=n.orientation,a=n.mirror,o;switch(i){case"left":o=a?"start":"end";break;case"right":o=a?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var n=this.props,i=n.orientation,a=n.mirror,o="end";switch(i){case"left":case"right":o="middle";break;case"top":o=a?"start":"end";break;default:o=a?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,c=n.height,u=n.orientation,d=n.mirror,p=n.axisLine,f=ar(ar(ar({},at(this.props,!1)),at(p,!1)),{},{fill:"none"});if(u==="top"||u==="bottom"){var m=+(u==="top"&&!d||u==="bottom"&&d);f=ar(ar({},f),{},{x1:i,y1:a+m*c,x2:i+o,y2:a+m*c})}else{var v=+(u==="left"&&!d||u==="right"&&d);f=ar(ar({},f),{},{x1:i+v*o,y1:a,x2:i+v*o,y2:a+c})}return M.createElement("line",Is({},f,{className:ot("recharts-cartesian-axis-line",On(p,"className"))}))}},{key:"renderTicks",value:function(n,i,a){var o=this,c=this.props,u=c.tickLine,d=c.stroke,p=c.tick,f=c.tickFormatter,m=c.unit,v=d_(ar(ar({},this.props),{},{ticks:n}),i,a),b=this.getTickTextAnchor(),w=this.getTickVerticalAnchor(),x=at(this.props,!1),k=at(p,!1),S=ar(ar({},x),{},{fill:"none"},at(u,!1)),A=v.map(function(C,T){var O=o.getTickLineCoord(C),N=O.line,R=O.tick,$=ar(ar(ar(ar({textAnchor:b,verticalAnchor:w},x),{},{stroke:"none",fill:d},k),R),{},{index:T,payload:C,visibleTicksCount:v.length,tickFormatter:f});return M.createElement(Xt,Is({className:"recharts-cartesian-axis-tick",key:"tick-".concat(C.value,"-").concat(C.coordinate,"-").concat(C.tickCoord)},ah(o.props,C,T)),u&&M.createElement("line",Is({},S,N,{className:ot("recharts-cartesian-axis-tick-line",On(u,"className"))})),p&&e.renderTickItem(p,$,"".concat(Je(f)?f(C.value,T):C.value).concat(m||"")))});return M.createElement("g",{className:"recharts-cartesian-axis-ticks"},A)}},{key:"render",value:function(){var n=this,i=this.props,a=i.axisLine,o=i.width,c=i.height,u=i.ticksGenerator,d=i.className,p=i.hide;if(p)return null;var f=this.props,m=f.ticks,v=Bb(f,ore),b=m;return Je(u)&&(b=m&&m.length>0?u(this.props):u(v)),o<=0||c<=0||!b||!b.length?null:M.createElement(Xt,{className:ot("recharts-cartesian-axis",d),ref:function(x){n.layerReference=x}},a&&this.renderAxisLine(),this.renderTicks(b,this.state.fontSize,this.state.letterSpacing),jr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,a){var o,c=ot(i.className,"recharts-cartesian-axis-tick-value");return M.isValidElement(n)?o=M.cloneElement(n,ar(ar({},i),{},{className:c})):Je(n)?o=n(ar(ar({},i),{},{className:c})):o=M.createElement(yh,Is({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])})(j.Component);f_(Ol,"displayName","CartesianAxis");f_(Ol,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var mre=["x1","y1","x2","y2","key"],gre=["offset"];function Do(t){"@babel/helpers - typeof";return Do=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Do(t)}function _N(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 Nr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_N(Object(r),!0).forEach(function(n){yre(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_N(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yre(t,e,r){return e=vre(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vre(t){var e=bre(t,"string");return Do(e)=="symbol"?e:e+""}function bre(t,e){if(Do(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Do(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function To(){return To=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},To.apply(this,arguments)}function SN(t,e){if(t==null)return{};var r=xre(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function xre(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var wre=function(e){var r=e.fill;if(!r||r==="none")return null;var n=e.fillOpacity,i=e.x,a=e.y,o=e.width,c=e.height,u=e.ry;return M.createElement("rect",{x:i,y:a,ry:u,width:o,height:c,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function wM(t,e){var r;if(M.isValidElement(t))r=M.cloneElement(t,e);else if(Je(t))r=t(e);else{var n=e.x1,i=e.y1,a=e.x2,o=e.y2,c=e.key,u=SN(e,mre),d=at(u,!1);d.offset;var p=SN(d,gre);r=M.createElement("line",To({},p,{x1:n,y1:i,x2:a,y2:o,fill:"none",key:c}))}return r}function _re(t){var e=t.x,r=t.width,n=t.horizontal,i=n===void 0?!0:n,a=t.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(c,u){var d=Nr(Nr({},t),{},{x1:e,y1:c,x2:e+r,y2:c,key:"line-".concat(u),index:u});return wM(i,d)});return M.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Sre(t){var e=t.y,r=t.height,n=t.vertical,i=n===void 0?!0:n,a=t.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(c,u){var d=Nr(Nr({},t),{},{x1:c,y1:e,x2:c,y2:e+r,key:"line-".concat(u),index:u});return wM(i,d)});return M.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function kre(t){var e=t.horizontalFill,r=t.fillOpacity,n=t.x,i=t.y,a=t.width,o=t.height,c=t.horizontalPoints,u=t.horizontal,d=u===void 0?!0:u;if(!d||!e||!e.length)return null;var p=c.map(function(m){return Math.round(m+i-i)}).sort(function(m,v){return m-v});i!==p[0]&&p.unshift(0);var f=p.map(function(m,v){var b=!p[v+1],w=b?i+o-m:p[v+1]-m;if(w<=0)return null;var x=v%e.length;return M.createElement("rect",{key:"react-".concat(v),y:m,x:n,height:w,width:a,stroke:"none",fill:e[x],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return M.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Ere(t){var e=t.vertical,r=e===void 0?!0:e,n=t.verticalFill,i=t.fillOpacity,a=t.x,o=t.y,c=t.width,u=t.height,d=t.verticalPoints;if(!r||!n||!n.length)return null;var p=d.map(function(m){return Math.round(m+a-a)}).sort(function(m,v){return m-v});a!==p[0]&&p.unshift(0);var f=p.map(function(m,v){var b=!p[v+1],w=b?a+c-m:p[v+1]-m;if(w<=0)return null;var x=v%n.length;return M.createElement("rect",{key:"react-".concat(v),x:m,y:o,width:w,height:u,stroke:"none",fill:n[x],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return M.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Are=function(e,r){var n=e.xAxis,i=e.width,a=e.height,o=e.offset;return I$(d_(Nr(Nr(Nr({},Ol.defaultProps),n),{},{ticks:Ki(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,r)},Ore=function(e,r){var n=e.yAxis,i=e.width,a=e.height,o=e.offset;return I$(d_(Nr(Nr(Nr({},Ol.defaultProps),n),{},{ticks:Ki(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,r)},As={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Cu(t){var e,r,n,i,a,o,c=s_(),u=l_(),d=pte(),p=Nr(Nr({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:As.stroke,fill:(r=t.fill)!==null&&r!==void 0?r:As.fill,horizontal:(n=t.horizontal)!==null&&n!==void 0?n:As.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:As.horizontalFill,vertical:(a=t.vertical)!==null&&a!==void 0?a:As.vertical,verticalFill:(o=t.verticalFill)!==null&&o!==void 0?o:As.verticalFill,x:ge(t.x)?t.x:d.left,y:ge(t.y)?t.y:d.top,width:ge(t.width)?t.width:d.width,height:ge(t.height)?t.height:d.height}),f=p.x,m=p.y,v=p.width,b=p.height,w=p.syncWithTicks,x=p.horizontalValues,k=p.verticalValues,S=dte(),A=fte();if(!ge(v)||v<=0||!ge(b)||b<=0||!ge(f)||f!==+f||!ge(m)||m!==+m)return null;var C=p.verticalCoordinatesGenerator||Are,T=p.horizontalCoordinatesGenerator||Ore,O=p.horizontalPoints,N=p.verticalPoints;if((!O||!O.length)&&Je(T)){var R=x&&x.length,$=T({yAxis:A?Nr(Nr({},A),{},{ticks:R?x:A.ticks}):void 0,width:c,height:u,offset:d},R?!0:w);Vi(Array.isArray($),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Do($),"]")),Array.isArray($)&&(O=$)}if((!N||!N.length)&&Je(C)){var K=k&&k.length,z=C({xAxis:S?Nr(Nr({},S),{},{ticks:K?k:S.ticks}):void 0,width:c,height:u,offset:d},K?!0:w);Vi(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Do(z),"]")),Array.isArray(z)&&(N=z)}return M.createElement("g",{className:"recharts-cartesian-grid"},M.createElement(wre,{fill:p.fill,fillOpacity:p.fillOpacity,x:p.x,y:p.y,width:p.width,height:p.height,ry:p.ry}),M.createElement(_re,To({},p,{offset:d,horizontalPoints:O,xAxis:S,yAxis:A})),M.createElement(Sre,To({},p,{offset:d,verticalPoints:N,xAxis:S,yAxis:A})),M.createElement(kre,To({},p,{horizontalPoints:O})),M.createElement(Ere,To({},p,{verticalPoints:N})))}Cu.displayName="CartesianGrid";var Tre=["type","layout","connectNulls","ref"],Cre=["key"];function ll(t){"@babel/helpers - typeof";return ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ll(t)}function kN(t,e){if(t==null)return{};var r=jre(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function jre(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Bc(){return Bc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Bc.apply(this,arguments)}function EN(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 an(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?EN(Object(r),!0).forEach(function(n){Wn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):EN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Os(t){return Ire(t)||Rre(t)||Pre(t)||Nre()}function Nre(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
514
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pre(t,e){if(t){if(typeof t=="string")return xw(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 xw(t,e)}}function Rre(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ire(t){if(Array.isArray(t))return xw(t)}function xw(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 $re(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AN(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,SM(n.key),n)}}function Mre(t,e,r){return e&&AN(t.prototype,e),r&&AN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Dre(t,e,r){return e=Zh(e),Lre(t,_M()?Reflect.construct(e,r||[],Zh(t).constructor):e.apply(t,r))}function Lre(t,e){if(e&&(ll(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zre(t)}function zre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _M(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_M=function(){return!!t})()}function Zh(t){return Zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Zh(t)}function Bre(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ww(t,e)}function ww(t,e){return ww=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ww(t,e)}function Wn(t,e,r){return e=SM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function SM(t){var e=Ure(t,"string");return ll(e)=="symbol"?e:e+""}function Ure(t,e){if(ll(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ll(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Ku=(function(t){function e(){var r;$re(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=Dre(this,e,[].concat(i)),Wn(r,"state",{isAnimationFinished:!0,totalLength:0}),Wn(r,"generateSimpleStrokeDasharray",function(o,c){return"".concat(c,"px ").concat(o-c,"px")}),Wn(r,"getStrokeDasharray",function(o,c,u){var d=u.reduce(function(k,S){return k+S});if(!d)return r.generateSimpleStrokeDasharray(c,o);for(var p=Math.floor(o/d),f=o%d,m=c-o,v=[],b=0,w=0;b<u.length;w+=u[b],++b)if(w+u[b]>f){v=[].concat(Os(u.slice(0,b)),[f-w]);break}var x=v.length%2===0?[0,m]:[m];return[].concat(Os(e.repeat(u,p)),Os(v),x).map(function(k){return"".concat(k,"px")}).join(", ")}),Wn(r,"id",zu("recharts-line-")),Wn(r,"pathRef",function(o){r.mainCurve=o}),Wn(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Wn(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Bre(e,t),Mre(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,c=a.xAxis,u=a.yAxis,d=a.layout,p=a.children,f=Tn(p,Wu);if(!f)return null;var m=function(w,x){return{x:w.x,y:w.y,value:w.value,errorVal:dn(w.payload,x)}},v={clipPath:n?"url(#clipPath-".concat(i,")"):null};return M.createElement(Xt,v,f.map(function(b){return M.cloneElement(b,{key:"bar-".concat(b.props.dataKey),data:o,xAxis:c,yAxis:u,layout:d,dataPointFormatter:m})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var c=this.props,u=c.dot,d=c.points,p=c.dataKey,f=at(this.props,!1),m=at(u,!0),v=d.map(function(w,x){var k=an(an(an({key:"dot-".concat(x),r:3},f),m),{},{index:x,cx:w.x,cy:w.y,value:w.value,dataKey:p,payload:w.payload,points:d});return e.renderDotItem(u,k)}),b={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return M.createElement(Xt,Bc({className:"recharts-line-dots",key:"dots"},b),v)}},{key:"renderCurveStatically",value:function(n,i,a,o){var c=this.props,u=c.type,d=c.layout,p=c.connectNulls;c.ref;var f=kN(c,Tre),m=an(an(an({},at(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:u,layout:d,connectNulls:p});return M.createElement(Zx,Bc({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,c=o.points,u=o.strokeDasharray,d=o.isAnimationActive,p=o.animationBegin,f=o.animationDuration,m=o.animationEasing,v=o.animationId,b=o.animateNewValues,w=o.width,x=o.height,k=this.state,S=k.prevPoints,A=k.totalLength;return M.createElement(ea,{begin:p,duration:f,isActive:d,easing:m,from:{t:0},to:{t:1},key:"line-".concat(v),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(C){var T=C.t;if(S){var O=S.length/c.length,N=c.map(function(U,F){var X=Math.floor(F*O);if(S[X]){var Y=S[X],G=Vn(Y.x,U.x),Z=Vn(Y.y,U.y);return an(an({},U),{},{x:G(T),y:Z(T)})}if(b){var W=Vn(w*2,U.x),Q=Vn(x/2,U.y);return an(an({},U),{},{x:W(T),y:Q(T)})}return an(an({},U),{},{x:U.x,y:U.y})});return a.renderCurveStatically(N,n,i)}var R=Vn(0,A),$=R(T),K;if(u){var z="".concat(u).split(/[,\s]+/gim).map(function(U){return parseFloat(U)});K=a.getStrokeDasharray($,A,z)}else K=a.generateSimpleStrokeDasharray(A,$);return a.renderCurveStatically(c,n,i,{strokeDasharray:K})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,c=a.isAnimationActive,u=this.state,d=u.prevPoints,p=u.totalLength;return c&&o&&o.length&&(!d&&p>0||!Mp(d,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,c=i.points,u=i.className,d=i.xAxis,p=i.yAxis,f=i.top,m=i.left,v=i.width,b=i.height,w=i.isAnimationActive,x=i.id;if(a||!c||!c.length)return null;var k=this.state.isAnimationFinished,S=c.length===1,A=ot("recharts-line",u),C=d&&d.allowDataOverflow,T=p&&p.allowDataOverflow,O=C||T,N=tt(x)?this.id:x,R=(n=at(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},$=R.r,K=$===void 0?3:$,z=R.strokeWidth,U=z===void 0?2:z,F=rF(o)?o:{},X=F.clipDot,Y=X===void 0?!0:X,G=K*2+U;return M.createElement(Xt,{className:A},C||T?M.createElement("defs",null,M.createElement("clipPath",{id:"clipPath-".concat(N)},M.createElement("rect",{x:C?m:m-v/2,y:T?f:f-b/2,width:C?v:v*2,height:T?b:b*2})),!Y&&M.createElement("clipPath",{id:"clipPath-dots-".concat(N)},M.createElement("rect",{x:m-G/2,y:f-G/2,width:v+G,height:b+G}))):null,!S&&this.renderCurve(O,N),this.renderErrorBar(O,N),(S||o)&&this.renderDots(O,Y,N),(!w||k)&&za.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(Os(n),[0]):n,o=[],c=0;c<i;++c)o=[].concat(Os(o),Os(a));return o}},{key:"renderDotItem",value:function(n,i){var a;if(M.isValidElement(n))a=M.cloneElement(n,i);else if(Je(n))a=n(i);else{var o=i.key,c=kN(i,Cre),u=ot("recharts-line-dot",typeof n!="boolean"?n.className:"");a=M.createElement(n_,Bc({key:o},c,{className:u}))}return a}}])})(j.PureComponent);Wn(Ku,"displayName","Line");Wn(Ku,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Sl.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Wn(Ku,"getComposedData",function(t){var e=t.props,r=t.xAxis,n=t.yAxis,i=t.xAxisTicks,a=t.yAxisTicks,o=t.dataKey,c=t.bandSize,u=t.displayedData,d=t.offset,p=e.layout,f=u.map(function(m,v){var b=dn(m,o);return p==="horizontal"?{x:Fj({axis:r,ticks:i,bandSize:c,entry:m,index:v}),y:tt(b)?null:n.scale(b),value:b,payload:m}:{x:tt(b)?null:r.scale(b),y:Fj({axis:n,ticks:a,bandSize:c,entry:m,index:v}),value:b,payload:m}});return an({points:f,layout:p},d)});function cl(t){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cl(t)}function qre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fre(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,AM(n.key),n)}}function Hre(t,e,r){return e&&Fre(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wre(t,e,r){return e=Qh(e),Kre(t,kM()?Reflect.construct(e,r||[],Qh(t).constructor):e.apply(t,r))}function Kre(t,e){if(e&&(cl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gre(t)}function Gre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kM=function(){return!!t})()}function Qh(t){return Qh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Qh(t)}function Vre(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_w(t,e)}function _w(t,e){return _w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},_w(t,e)}function EM(t,e,r){return e=AM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function AM(t){var e=Xre(t,"string");return cl(e)=="symbol"?e:e+""}function Xre(t,e){if(cl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(cl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Sw(){return Sw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Sw.apply(this,arguments)}function Yre(t){var e=t.xAxisId,r=s_(),n=l_(),i=uM(e);return i==null?null:j.createElement(Ol,Sw({},i,{className:ot("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return Ki(o,!0)}}))}var Ua=(function(t){function e(){return qre(this,e),Wre(this,e,arguments)}return Vre(e,t),Hre(e,[{key:"render",value:function(){return j.createElement(Yre,this.props)}}])})(j.Component);EM(Ua,"displayName","XAxis");EM(Ua,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function ul(t){"@babel/helpers - typeof";return ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ul(t)}function Jre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zre(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,CM(n.key),n)}}function Qre(t,e,r){return e&&Zre(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ene(t,e,r){return e=ep(e),tne(t,OM()?Reflect.construct(e,r||[],ep(t).constructor):e.apply(t,r))}function tne(t,e){if(e&&(ul(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rne(t)}function rne(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OM=function(){return!!t})()}function ep(t){return ep=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ep(t)}function nne(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&kw(t,e)}function kw(t,e){return kw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},kw(t,e)}function TM(t,e,r){return e=CM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function CM(t){var e=ine(t,"string");return ul(e)=="symbol"?e:e+""}function ine(t,e){if(ul(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ul(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Ew(){return Ew=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ew.apply(this,arguments)}var ane=function(e){var r=e.yAxisId,n=s_(),i=l_(),a=dM(r);return a==null?null:j.createElement(Ol,Ew({},a,{className:ot("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:i},ticksGenerator:function(c){return Ki(c,!0)}}))},qa=(function(t){function e(){return Jre(this,e),ene(this,e,arguments)}return nne(e,t),Qre(e,[{key:"render",value:function(){return j.createElement(ane,this.props)}}])})(j.Component);TM(qa,"displayName","YAxis");TM(qa,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function ON(t){return cne(t)||lne(t)||sne(t)||one()}function one(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
515
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sne(t,e){if(t){if(typeof t=="string")return Aw(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 Aw(t,e)}}function lne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function cne(t){if(Array.isArray(t))return Aw(t)}function Aw(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}var Ow=function(e,r,n,i,a){var o=Tn(e,u_),c=Tn(e,Fp),u=[].concat(ON(o),ON(c)),d=Tn(e,Wp),p="".concat(i,"Id"),f=i[0],m=r;if(u.length&&(m=u.reduce(function(w,x){if(x.props[p]===n&&Si(x.props,"extendDomain")&&ge(x.props[f])){var k=x.props[f];return[Math.min(w[0],k),Math.max(w[1],k)]}return w},m)),d.length){var v="".concat(f,"1"),b="".concat(f,"2");m=d.reduce(function(w,x){if(x.props[p]===n&&Si(x.props,"extendDomain")&&ge(x.props[v])&&ge(x.props[b])){var k=x.props[v],S=x.props[b];return[Math.min(w[0],k,S),Math.max(w[1],k,S)]}return w},m)}return a&&a.length&&(m=a.reduce(function(w,x){return ge(x)?[Math.min(w[0],x),Math.max(w[1],x)]:w},m)),m},Ub={exports:{}},TN;function une(){return TN||(TN=1,(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,d,p){this.fn=u,this.context=d,this.once=p||!1}function a(u,d,p,f,m){if(typeof p!="function")throw new TypeError("The listener must be a function");var v=new i(p,f||u,m),b=r?r+d:d;return u._events[b]?u._events[b].fn?u._events[b]=[u._events[b],v]:u._events[b].push(v):(u._events[b]=v,u._eventsCount++),u}function o(u,d){--u._eventsCount===0?u._events=new n:delete u._events[d]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var d=[],p,f;if(this._eventsCount===0)return d;for(f in p=this._events)e.call(p,f)&&d.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(p)):d},c.prototype.listeners=function(d){var p=r?r+d:d,f=this._events[p];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,v=f.length,b=new Array(v);m<v;m++)b[m]=f[m].fn;return b},c.prototype.listenerCount=function(d){var p=r?r+d:d,f=this._events[p];return f?f.fn?1:f.length:0},c.prototype.emit=function(d,p,f,m,v,b){var w=r?r+d:d;if(!this._events[w])return!1;var x=this._events[w],k=arguments.length,S,A;if(x.fn){switch(x.once&&this.removeListener(d,x.fn,void 0,!0),k){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,p),!0;case 3:return x.fn.call(x.context,p,f),!0;case 4:return x.fn.call(x.context,p,f,m),!0;case 5:return x.fn.call(x.context,p,f,m,v),!0;case 6:return x.fn.call(x.context,p,f,m,v,b),!0}for(A=1,S=new Array(k-1);A<k;A++)S[A-1]=arguments[A];x.fn.apply(x.context,S)}else{var C=x.length,T;for(A=0;A<C;A++)switch(x[A].once&&this.removeListener(d,x[A].fn,void 0,!0),k){case 1:x[A].fn.call(x[A].context);break;case 2:x[A].fn.call(x[A].context,p);break;case 3:x[A].fn.call(x[A].context,p,f);break;case 4:x[A].fn.call(x[A].context,p,f,m);break;default:if(!S)for(T=1,S=new Array(k-1);T<k;T++)S[T-1]=arguments[T];x[A].fn.apply(x[A].context,S)}}return!0},c.prototype.on=function(d,p,f){return a(this,d,p,f,!1)},c.prototype.once=function(d,p,f){return a(this,d,p,f,!0)},c.prototype.removeListener=function(d,p,f,m){var v=r?r+d:d;if(!this._events[v])return this;if(!p)return o(this,v),this;var b=this._events[v];if(b.fn)b.fn===p&&(!m||b.once)&&(!f||b.context===f)&&o(this,v);else{for(var w=0,x=[],k=b.length;w<k;w++)(b[w].fn!==p||m&&!b[w].once||f&&b[w].context!==f)&&x.push(b[w]);x.length?this._events[v]=x.length===1?x[0]:x:o(this,v)}return this},c.prototype.removeAllListeners=function(d){var p;return d?(p=r?r+d:d,this._events[p]&&o(this,p)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t.exports=c})(Ub)),Ub.exports}var dne=une();const fne=vt(dne);var qb=new fne,Fb="recharts.syncMouseEvents";function ju(t){"@babel/helpers - typeof";return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ju(t)}function hne(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,jM(n.key),n)}}function mne(t,e,r){return e&&pne(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Hb(t,e,r){return e=jM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jM(t){var e=gne(t,"string");return ju(e)=="symbol"?e:e+""}function gne(t,e){if(ju(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ju(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var yne=(function(){function t(){hne(this,t),Hb(this,"activeIndex",0),Hb(this,"coordinateList",[]),Hb(this,"layout","horizontal")}return mne(t,[{key:"setDetails",value:function(r){var n,i=r.coordinateList,a=i===void 0?null:i,o=r.container,c=o===void 0?null:o,u=r.layout,d=u===void 0?null:u,p=r.offset,f=p===void 0?null:p,m=r.mouseHandlerCallback,v=m===void 0?null:m;this.coordinateList=(n=a??this.coordinateList)!==null&&n!==void 0?n:[],this.container=c??this.container,this.layout=d??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=v??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),a=i.x,o=i.y,c=i.height,u=this.coordinateList[this.activeIndex].coordinate,d=((r=window)===null||r===void 0?void 0:r.scrollX)||0,p=((n=window)===null||n===void 0?void 0:n.scrollY)||0,f=a+u+d,m=o+this.offset.top+c/2+p;this.mouseHandlerCallback({pageX:f,pageY:m})}}}])})();function vne(t,e,r){if(r==="number"&&e===!0&&Array.isArray(t)){var n=t==null?void 0:t[0],i=t==null?void 0:t[1];if(n&&i&&ge(n)&&ge(i))return!0}return!1}function bne(t,e,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:r.left+.5,y:t==="horizontal"?r.top+.5:e.y-i,width:t==="horizontal"?n:r.width-1,height:t==="horizontal"?r.height-1:n}}function NM(t){var e=t.cx,r=t.cy,n=t.radius,i=t.startAngle,a=t.endAngle,o=wr(e,r,n,i),c=wr(e,r,n,a);return{points:[o,c],cx:e,cy:r,radius:n,startAngle:i,endAngle:a}}function xne(t,e,r){var n,i,a,o;if(t==="horizontal")n=e.x,a=n,i=r.top,o=r.top+r.height;else if(t==="vertical")i=e.y,o=i,n=r.left,a=r.left+r.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var c=e.cx,u=e.cy,d=e.innerRadius,p=e.outerRadius,f=e.angle,m=wr(c,u,d,f),v=wr(c,u,p,f);n=m.x,i=m.y,a=v.x,o=v.y}else return NM(e);return[{x:n,y:i},{x:a,y:o}]}function Nu(t){"@babel/helpers - typeof";return Nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nu(t)}function CN(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 Cf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?CN(Object(r),!0).forEach(function(n){wne(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function wne(t,e,r){return e=_ne(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _ne(t){var e=Sne(t,"string");return Nu(e)=="symbol"?e:e+""}function Sne(t,e){if(Nu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Nu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kne(t){var e,r,n=t.element,i=t.tooltipEventType,a=t.isActive,o=t.activeCoordinate,c=t.activePayload,u=t.offset,d=t.activeTooltipIndex,p=t.tooltipAxisBandSize,f=t.layout,m=t.chartName,v=(e=n.props.cursor)!==null&&e!==void 0?e:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!v||!a||!o||m!=="ScatterChart"&&i!=="axis")return null;var b,w=Zx;if(m==="ScatterChart")b=o,w=_Q;else if(m==="BarChart")b=bne(f,o,u,p),w=r_;else if(f==="radial"){var x=NM(o),k=x.cx,S=x.cy,A=x.radius,C=x.startAngle,T=x.endAngle;b={cx:k,cy:S,startAngle:C,endAngle:T,innerRadius:A,outerRadius:A},w=z$}else b={points:xne(f,o,u)},w=Zx;var O=Cf(Cf(Cf(Cf({stroke:"#ccc",pointerEvents:"none"},u),b),at(v,!1)),{},{payload:c,payloadIndex:d,className:ot("recharts-tooltip-cursor",v.className)});return j.isValidElement(v)?j.cloneElement(v,O):j.createElement(w,O)}var Ene=["item"],Ane=["children","className","width","height","style","compact","title","desc"];function dl(t){"@babel/helpers - typeof";return dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dl(t)}function $s(){return $s=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},$s.apply(this,arguments)}function jN(t,e){return Cne(t)||Tne(t,e)||RM(t,e)||One()}function One(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
516
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
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 ee,le=o in q.props?q.props[o]:(ee=q.type.defaultProps)===null||ee===void 0?void 0:ee[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,ee){return q.indexOf(ee)>=0?q:[].concat(fl(q),[ee])},[]))}else if(S==="category")T?U=U.filter(function(q){return q!==""&&!tt(q)}):U=Gj(Z,U,w).reduce(function(q,ee){return q.indexOf(ee)>=0||ee===""||tt(ee)?q:[].concat(fl(q),[ee])},[]);else if(S==="number"){var Q=oY(K,i.filter(function(q){var ee,le,fe=o in q.props?q.props[o]:(ee=q.type.defaultProps)===null||ee===void 0?void 0:ee[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 ee=o in q.props?q.props[o]:q.type.defaultProps[o],le="hide"in q.props?q.props.hide:q.type.defaultProps.hide;return ee===$&&(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,ee=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:ee,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,ee){var le="".concat(ee.axisType,"Map");return ie(ie({},q),{},ze({},le,Vne(A,ie(ie({},ee),{},{graphicalItems:Y,stackGroups:ee.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),ee=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:ee,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,ee=q.activeDot,le=q.hide,fe=q.activeBar,ve=q.activeShape,qe=!!(!le&&U&&Z&&(ee||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,ee=I&&(Q=(L=I.props)===null||L===void 0?void 0:L.endIndex)!==null&&Q!==void 0?Q:z,le=q!==K||ee!==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:ee}),k)),{},{prevChildren:C,dataStartIndex:q,dataEndIndex:ee})}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 ee=L(q.children);if(ee)return ee}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}
|
|
511
|
+
A `).concat(b,",").concat(b,",0,0,").concat(d,",").concat(e,",").concat(r+i-c*b," Z")}else p="M ".concat(e,",").concat(r," h ").concat(n," v ").concat(i," h ").concat(-n," Z");return p},hQ=function(e,r){if(!e||!r)return!1;var n=e.x,i=e.y,a=r.x,o=r.y,c=r.width,u=r.height;if(Math.abs(c)>0&&Math.abs(u)>0){var d=Math.min(a,a+c),p=Math.max(a,a+c),f=Math.min(o,o+u),m=Math.max(o,o+u);return n>=d&&n<=p&&i>=f&&i<=m}return!1},pQ={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},r_=function(e){var r=O2(O2({},pQ),e),n=j.useRef(),i=j.useState(-1),a=aQ(i,2),o=a[0],c=a[1];j.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var C=n.current.getTotalLength();C&&c(C)}catch{}},[]);var u=r.x,d=r.y,p=r.width,f=r.height,m=r.radius,v=r.className,b=r.animationEasing,w=r.animationDuration,x=r.animationBegin,k=r.isAnimationActive,S=r.isUpdateAnimationActive;if(u!==+u||d!==+d||p!==+p||f!==+f||p===0||f===0)return null;var A=ot("recharts-rectangle",v);return S?M.createElement(ea,{canBegin:o>0,from:{width:p,height:f,x:u,y:d},to:{width:p,height:f,x:u,y:d},duration:w,animationEasing:b,isActive:S},function(C){var T=C.width,O=C.height,N=C.x,R=C.y;return M.createElement(ea,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:w,isActive:k,easing:b},M.createElement("path",zh({},at(r,!0),{className:A,d:T2(N,R,T,O,m),ref:n})))}):M.createElement("path",zh({},at(r,!0),{className:A,d:T2(u,d,p,f,m)}))};function lw(){return lw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},lw.apply(this,arguments)}var n_=function(e){var r=e.cx,n=e.cy,i=e.r,a=e.className,o=ot("recharts-dot",a);return r===+r&&n===+n&&i===+i?j.createElement("circle",lw({},at(e,!1),ih(e),{className:o,cx:r,cy:n,r:i})):null};function wu(t){"@babel/helpers - typeof";return wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wu(t)}var mQ=["x","y","top","left","width","height","className"];function cw(){return cw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},cw.apply(this,arguments)}function C2(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 gQ(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?C2(Object(r),!0).forEach(function(n){yQ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yQ(t,e,r){return e=vQ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vQ(t){var e=bQ(t,"string");return wu(e)=="symbol"?e:e+""}function bQ(t,e){if(wu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(wu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xQ(t,e){if(t==null)return{};var r=wQ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function wQ(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var _Q=function(e,r,n,i,a,o){return"M".concat(e,",").concat(a,"v").concat(i,"M").concat(o,",").concat(r,"h").concat(n)},SQ=function(e){var r=e.x,n=r===void 0?0:r,i=e.y,a=i===void 0?0:i,o=e.top,c=o===void 0?0:o,u=e.left,d=u===void 0?0:u,p=e.width,f=p===void 0?0:p,m=e.height,v=m===void 0?0:m,b=e.className,w=xQ(e,mQ),x=gQ({x:n,y:a,top:c,left:d,width:f,height:v},w);return!ge(n)||!ge(a)||!ge(f)||!ge(v)||!ge(c)||!ge(d)?null:M.createElement("path",cw({},at(x,!0),{className:ot("recharts-cross",b),d:_Q(n,a,f,v,c,d)}))},wb,j2;function kQ(){if(j2)return wb;j2=1;var t=hI(),e=t(Object.getPrototypeOf,Object);return wb=e,wb}var _b,N2;function EQ(){if(N2)return _b;N2=1;var t=ra(),e=kQ(),r=na(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,c=a.hasOwnProperty,u=o.call(Object);function d(p){if(!r(p)||t(p)!=n)return!1;var f=e(p);if(f===null)return!0;var m=c.call(f,"constructor")&&f.constructor;return typeof m=="function"&&m instanceof m&&o.call(m)==u}return _b=d,_b}var AQ=EQ();const OQ=vt(AQ);var Sb,P2;function TQ(){if(P2)return Sb;P2=1;var t=ra(),e=na(),r="[object Boolean]";function n(i){return i===!0||i===!1||e(i)&&t(i)==r}return Sb=n,Sb}var CQ=TQ();const jQ=vt(CQ);function _u(t){"@babel/helpers - typeof";return _u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_u(t)}function Bh(){return Bh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Bh.apply(this,arguments)}function NQ(t,e){return $Q(t)||IQ(t,e)||RQ(t,e)||PQ()}function PQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
512
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RQ(t,e){if(t){if(typeof t=="string")return R2(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 R2(t,e)}}function R2(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 IQ(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function $Q(t){if(Array.isArray(t))return t}function I2(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 $2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?I2(Object(r),!0).forEach(function(n){MQ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function MQ(t,e,r){return e=DQ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function DQ(t){var e=LQ(t,"string");return _u(e)=="symbol"?e:e+""}function LQ(t,e){if(_u(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(_u(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var M2=function(e,r,n,i,a){var o=n-i,c;return c="M ".concat(e,",").concat(r),c+="L ".concat(e+n,",").concat(r),c+="L ".concat(e+n-o/2,",").concat(r+a),c+="L ".concat(e+n-o/2-i,",").concat(r+a),c+="L ".concat(e,",").concat(r," Z"),c},zQ={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},BQ=function(e){var r=$2($2({},zQ),e),n=j.useRef(),i=j.useState(-1),a=NQ(i,2),o=a[0],c=a[1];j.useEffect(function(){if(n.current&&n.current.getTotalLength)try{var A=n.current.getTotalLength();A&&c(A)}catch{}},[]);var u=r.x,d=r.y,p=r.upperWidth,f=r.lowerWidth,m=r.height,v=r.className,b=r.animationEasing,w=r.animationDuration,x=r.animationBegin,k=r.isUpdateAnimationActive;if(u!==+u||d!==+d||p!==+p||f!==+f||m!==+m||p===0&&f===0||m===0)return null;var S=ot("recharts-trapezoid",v);return k?M.createElement(ea,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:m,x:u,y:d},to:{upperWidth:p,lowerWidth:f,height:m,x:u,y:d},duration:w,animationEasing:b,isActive:k},function(A){var C=A.upperWidth,T=A.lowerWidth,O=A.height,N=A.x,R=A.y;return M.createElement(ea,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:w,easing:b},M.createElement("path",Bh({},at(r,!0),{className:S,d:M2(N,R,C,T,O),ref:n})))}):M.createElement("g",null,M.createElement("path",Bh({},at(r,!0),{className:S,d:M2(u,d,p,f,m)})))},UQ=["option","shapeType","propTransformer","activeClassName","isActive"];function Su(t){"@babel/helpers - typeof";return Su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Su(t)}function qQ(t,e){if(t==null)return{};var r=FQ(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function FQ(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function D2(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 Uh(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?D2(Object(r),!0).forEach(function(n){HQ(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):D2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function HQ(t,e,r){return e=WQ(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function WQ(t){var e=KQ(t,"string");return Su(e)=="symbol"?e:e+""}function KQ(t,e){if(Su(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Su(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function GQ(t,e){return Uh(Uh({},e),t)}function VQ(t,e){return t==="symbols"}function L2(t){var e=t.shapeType,r=t.elementProps;switch(e){case"rectangle":return M.createElement(r_,r);case"trapezoid":return M.createElement(BQ,r);case"sector":return M.createElement(z$,r);case"symbols":if(VQ(e))return M.createElement(w1,r);break;default:return null}}function XQ(t){return j.isValidElement(t)?t.props:t}function YQ(t){var e=t.option,r=t.shapeType,n=t.propTransformer,i=n===void 0?GQ:n,a=t.activeClassName,o=a===void 0?"recharts-active-shape":a,c=t.isActive,u=qQ(t,UQ),d;if(j.isValidElement(e))d=j.cloneElement(e,Uh(Uh({},u),XQ(e)));else if(Je(e))d=e(u);else if(OQ(e)&&!jQ(e)){var p=i(e,u);d=M.createElement(L2,{shapeType:r,elementProps:p})}else{var f=u;d=M.createElement(L2,{shapeType:r,elementProps:f})}return c?M.createElement(Xt,{className:o},d):d}function zp(t,e){return e!=null&&"trapezoids"in t.props}function Bp(t,e){return e!=null&&"sectors"in t.props}function ku(t,e){return e!=null&&"points"in t.props}function JQ(t,e){var r,n,i=t.x===(e==null||(r=e.labelViewBox)===null||r===void 0?void 0:r.x)||t.x===e.x,a=t.y===(e==null||(n=e.labelViewBox)===null||n===void 0?void 0:n.y)||t.y===e.y;return i&&a}function ZQ(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function QQ(t,e){var r=t.x===e.x,n=t.y===e.y,i=t.z===e.z;return r&&n&&i}function eee(t,e){var r;return zp(t,e)?r=JQ:Bp(t,e)?r=ZQ:ku(t,e)&&(r=QQ),r}function tee(t,e){var r;return zp(t,e)?r="trapezoids":Bp(t,e)?r="sectors":ku(t,e)&&(r="points"),r}function ree(t,e){if(zp(t,e)){var r;return(r=e.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if(Bp(t,e)){var n;return(n=e.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return ku(t,e)?e.payload:{}}function nee(t){var e=t.activeTooltipItem,r=t.graphicalItem,n=t.itemData,i=tee(r,e),a=ree(r,e),o=n.filter(function(u,d){var p=Mp(a,u),f=r.props[i].filter(function(b){var w=eee(r,e);return w(b,e)}),m=r.props[i].indexOf(f[f.length-1]),v=d===m;return p&&v}),c=n.indexOf(o[o.length-1]);return c}var kb,z2;function iee(){if(z2)return kb;z2=1;var t=Math.ceil,e=Math.max;function r(n,i,a,o){for(var c=-1,u=e(t((i-n)/(a||1)),0),d=Array(u);u--;)d[o?u:++c]=n,n+=a;return d}return kb=r,kb}var Eb,B2;function G$(){if(B2)return Eb;B2=1;var t=CI(),e=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=t(i),i===e||i===-e){var a=i<0?-1:1;return a*r}return i===i?i:0}return Eb=n,Eb}var Ab,U2;function aee(){if(U2)return Ab;U2=1;var t=iee(),e=Op(),r=G$();function n(i){return function(a,o,c){return c&&typeof c!="number"&&e(a,o,c)&&(o=c=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),c=c===void 0?a<o?1:-1:r(c),t(a,o,c,i)}}return Ab=n,Ab}var Ob,q2;function oee(){if(q2)return Ob;q2=1;var t=aee(),e=t();return Ob=e,Ob}var see=oee();const qh=vt(see);function Eu(t){"@babel/helpers - typeof";return Eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Eu(t)}function F2(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 H2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?F2(Object(r),!0).forEach(function(n){V$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function V$(t,e,r){return e=lee(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lee(t){var e=cee(t,"string");return Eu(e)=="symbol"?e:e+""}function cee(t,e){if(Eu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Eu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var uee=["Webkit","Moz","O","ms"],dee=function(e,r){var n=e.replace(/(\w)/,function(a){return a.toUpperCase()}),i=uee.reduce(function(a,o){return H2(H2({},a),{},V$({},o+n,r))},{});return i[e]=r,i};function tl(t){"@babel/helpers - typeof";return tl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tl(t)}function Fh(){return Fh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Fh.apply(this,arguments)}function W2(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 Tb(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?W2(Object(r),!0).forEach(function(n){on(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):W2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function fee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function K2(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Y$(n.key),n)}}function hee(t,e,r){return e&&K2(t.prototype,e),r&&K2(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function pee(t,e,r){return e=Hh(e),mee(t,X$()?Reflect.construct(e,r||[],Hh(t).constructor):e.apply(t,r))}function mee(t,e){if(e&&(tl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gee(t)}function gee(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function X$(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(X$=function(){return!!t})()}function Hh(t){return Hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hh(t)}function yee(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uw(t,e)}function uw(t,e){return uw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},uw(t,e)}function on(t,e,r){return e=Y$(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Y$(t){var e=vee(t,"string");return tl(e)=="symbol"?e:e+""}function vee(t,e){if(tl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(tl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var bee=function(e){var r=e.data,n=e.startIndex,i=e.endIndex,a=e.x,o=e.width,c=e.travellerWidth;if(!r||!r.length)return{};var u=r.length,d=Dc().domain(qh(0,u)).range([a,a+o-c]),p=d.domain().map(function(f){return d(f)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:d(n),endX:d(i),scale:d,scaleValues:p}},G2=function(e){return e.changedTouches&&!!e.changedTouches.length},rl=(function(t){function e(r){var n;return fee(this,e),n=pee(this,e,[r]),on(n,"handleDrag",function(i){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(i):n.state.isSlideMoving&&n.handleSlideDrag(i)}),on(n,"handleTouchMove",function(i){i.changedTouches!=null&&i.changedTouches.length>0&&n.handleDrag(i.changedTouches[0])}),on(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=n.props,a=i.endIndex,o=i.onDragEnd,c=i.startIndex;o==null||o({endIndex:a,startIndex:c})}),n.detachDragEndListener()}),on(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),on(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),on(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),on(n,"handleSlideDragStart",function(i){var a=G2(i)?i.changedTouches[0]:i;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return yee(e,t),hee(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(n){var i=n.startX,a=n.endX,o=this.state.scaleValues,c=this.props,u=c.gap,d=c.data,p=d.length-1,f=Math.min(i,a),m=Math.max(i,a),v=e.getIndexInRange(o,f),b=e.getIndexInRange(o,m);return{startIndex:v-v%u,endIndex:b===p?p:b-b%u}}},{key:"getTextOfTick",value:function(n){var i=this.props,a=i.data,o=i.tickFormatter,c=i.dataKey,u=dn(a[n],c,n);return Je(o)?o(u,n):u}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(n){var i=this.state,a=i.slideMoveStartX,o=i.startX,c=i.endX,u=this.props,d=u.x,p=u.width,f=u.travellerWidth,m=u.startIndex,v=u.endIndex,b=u.onChange,w=n.pageX-a;w>0?w=Math.min(w,d+p-f-c,d+p-f-o):w<0&&(w=Math.max(w,d-o,d-c));var x=this.getIndex({startX:o+w,endX:c+w});(x.startIndex!==m||x.endIndex!==v)&&b&&b(x),this.setState({startX:o+w,endX:c+w,slideMoveStartX:n.pageX})}},{key:"handleTravellerDragStart",value:function(n,i){var a=G2(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:n,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(n){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,c=i.endX,u=i.startX,d=this.state[o],p=this.props,f=p.x,m=p.width,v=p.travellerWidth,b=p.onChange,w=p.gap,x=p.data,k={startX:this.state.startX,endX:this.state.endX},S=n.pageX-a;S>0?S=Math.min(S,f+m-v-d):S<0&&(S=Math.max(S,f-d)),k[o]=d+S;var A=this.getIndex(k),C=A.startIndex,T=A.endIndex,O=function(){var R=x.length-1;return o==="startX"&&(c>u?C%w===0:T%w===0)||c<u&&T===R||o==="endX"&&(c>u?T%w===0:C%w===0)||c>u&&T===R};this.setState(on(on({},o,d+S),"brushMoveStartX",n.pageX),function(){b&&O()&&b(A)})}},{key:"handleTravellerMoveKeyboard",value:function(n,i){var a=this,o=this.state,c=o.scaleValues,u=o.startX,d=o.endX,p=this.state[i],f=c.indexOf(p);if(f!==-1){var m=f+n;if(!(m===-1||m>=c.length)){var v=c[m];i==="startX"&&v>=d||i==="endX"&&v<=u||this.setState(on({},i,v),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,c=n.height,u=n.fill,d=n.stroke;return M.createElement("rect",{stroke:d,fill:u,x:i,y:a,width:o,height:c})}},{key:"renderPanorama",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,c=n.height,u=n.data,d=n.children,p=n.padding,f=j.Children.only(d);return f?M.cloneElement(f,{x:i,y:a,width:o,height:c,margin:p,compact:!0,data:u}):null}},{key:"renderTravellerLayer",value:function(n,i){var a,o,c=this,u=this.props,d=u.y,p=u.travellerWidth,f=u.height,m=u.traveller,v=u.ariaLabel,b=u.data,w=u.startIndex,x=u.endIndex,k=Math.max(n,this.props.x),S=Tb(Tb({},at(this.props,!1)),{},{x:k,y:d,width:p,height:f}),A=v||"Min value: ".concat((a=b[w])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=b[x])===null||o===void 0?void 0:o.name);return M.createElement(Xt,{tabIndex:0,role:"slider","aria-label":A,"aria-valuenow":n,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(T){["ArrowLeft","ArrowRight"].includes(T.key)&&(T.preventDefault(),T.stopPropagation(),c.handleTravellerMoveKeyboard(T.key==="ArrowRight"?1:-1,i))},onFocus:function(){c.setState({isTravellerFocused:!0})},onBlur:function(){c.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(m,S))}},{key:"renderSlide",value:function(n,i){var a=this.props,o=a.y,c=a.height,u=a.stroke,d=a.travellerWidth,p=Math.min(n,i)+d,f=Math.max(Math.abs(i-n)-d,0);return M.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:u,fillOpacity:.2,x:p,y:o,width:f,height:c})}},{key:"renderText",value:function(){var n=this.props,i=n.startIndex,a=n.endIndex,o=n.y,c=n.height,u=n.travellerWidth,d=n.stroke,p=this.state,f=p.startX,m=p.endX,v=5,b={pointerEvents:"none",fill:d};return M.createElement(Xt,{className:"recharts-brush-texts"},M.createElement(yh,Fh({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,m)-v,y:o+c/2},b),this.getTextOfTick(i)),M.createElement(yh,Fh({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,m)+u+v,y:o+c/2},b),this.getTextOfTick(a)))}},{key:"render",value:function(){var n=this.props,i=n.data,a=n.className,o=n.children,c=n.x,u=n.y,d=n.width,p=n.height,f=n.alwaysShowText,m=this.state,v=m.startX,b=m.endX,w=m.isTextActive,x=m.isSlideMoving,k=m.isTravellerMoving,S=m.isTravellerFocused;if(!i||!i.length||!ge(c)||!ge(u)||!ge(d)||!ge(p)||d<=0||p<=0)return null;var A=ot("recharts-brush",a),C=M.Children.count(o)===1,T=dee("userSelect","none");return M.createElement(Xt,{className:A,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:T},this.renderBackground(),C&&this.renderPanorama(),this.renderSlide(v,b),this.renderTravellerLayer(v,"startX"),this.renderTravellerLayer(b,"endX"),(w||x||k||S||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(n){var i=n.x,a=n.y,o=n.width,c=n.height,u=n.stroke,d=Math.floor(a+c/2)-1;return M.createElement(M.Fragment,null,M.createElement("rect",{x:i,y:a,width:o,height:c,fill:u,stroke:"none"}),M.createElement("line",{x1:i+1,y1:d,x2:i+o-1,y2:d,fill:"none",stroke:"#fff"}),M.createElement("line",{x1:i+1,y1:d+2,x2:i+o-1,y2:d+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(n,i){var a;return M.isValidElement(n)?a=M.cloneElement(n,i):Je(n)?a=n(i):a=e.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(n,i){var a=n.data,o=n.width,c=n.x,u=n.travellerWidth,d=n.updateId,p=n.startIndex,f=n.endIndex;if(a!==i.prevData||d!==i.prevUpdateId)return Tb({prevData:a,prevTravellerWidth:u,prevUpdateId:d,prevX:c,prevWidth:o},a&&a.length?bee({data:a,width:o,x:c,travellerWidth:u,startIndex:p,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||c!==i.prevX||u!==i.prevTravellerWidth)){i.scale.range([c,c+o-u]);var m=i.scale.domain().map(function(v){return i.scale(v)});return{prevData:a,prevTravellerWidth:u,prevUpdateId:d,prevX:c,prevWidth:o,startX:i.scale(n.startIndex),endX:i.scale(n.endIndex),scaleValues:m}}return null}},{key:"getIndexInRange",value:function(n,i){for(var a=n.length,o=0,c=a-1;c-o>1;){var u=Math.floor((o+c)/2);n[u]>i?c=u:o=u}return i>=n[c]?c:o}}])})(j.PureComponent);on(rl,"displayName","Brush");on(rl,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Cb,V2;function xee(){if(V2)return Cb;V2=1;var t=T1();function e(r,n){var i;return t(r,function(a,o,c){return i=n(a,o,c),!i}),!!i}return Cb=e,Cb}var jb,X2;function wee(){if(X2)return jb;X2=1;var t=oI(),e=Ka(),r=xee(),n=Qr(),i=Op();function a(o,c,u){var d=n(o)?t:r;return u&&i(o,c,u)&&(c=void 0),d(o,e(c,3))}return jb=a,jb}var _ee=wee();const See=vt(_ee);var Si=function(e,r){var n=e.alwaysShow,i=e.ifOverflow;return n&&(i="extendDomain"),i===r},Nb,Y2;function kee(){if(Y2)return Nb;Y2=1;var t=kI();function e(r,n,i){n=="__proto__"&&t?t(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return Nb=e,Nb}var Pb,J2;function Eee(){if(J2)return Pb;J2=1;var t=kee(),e=_I(),r=Ka();function n(i,a){var o={};return a=r(a,3),e(i,function(c,u,d){t(o,u,a(c,u,d))}),o}return Pb=n,Pb}var Aee=Eee();const Oee=vt(Aee);var Rb,Z2;function Tee(){if(Z2)return Rb;Z2=1;function t(e,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(!r(e[n],n,e))return!1;return!0}return Rb=t,Rb}var Ib,Q2;function Cee(){if(Q2)return Ib;Q2=1;var t=T1();function e(r,n){var i=!0;return t(r,function(a,o,c){return i=!!n(a,o,c),i}),i}return Ib=e,Ib}var $b,eN;function jee(){if(eN)return $b;eN=1;var t=Tee(),e=Cee(),r=Ka(),n=Qr(),i=Op();function a(o,c,u){var d=n(o)?t:e;return u&&i(o,c,u)&&(c=void 0),d(o,r(c,3))}return $b=a,$b}var Nee=jee();const J$=vt(Nee);var Pee=["x","y"];function Au(t){"@babel/helpers - typeof";return Au=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Au(t)}function dw(){return dw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},dw.apply(this,arguments)}function tN(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 kc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?tN(Object(r),!0).forEach(function(n){Ree(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ree(t,e,r){return e=Iee(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Iee(t){var e=$ee(t,"string");return Au(e)=="symbol"?e:e+""}function $ee(t,e){if(Au(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Au(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Mee(t,e){if(t==null)return{};var r=Dee(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Dee(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Lee(t,e){var r=t.x,n=t.y,i=Mee(t,Pee),a="".concat(r),o=parseInt(a,10),c="".concat(n),u=parseInt(c,10),d="".concat(e.height||i.height),p=parseInt(d,10),f="".concat(e.width||i.width),m=parseInt(f,10);return kc(kc(kc(kc(kc({},e),i),o?{x:o}:{}),u?{y:u}:{}),{},{height:p,width:m,name:e.name,radius:e.radius})}function rN(t){return M.createElement(YQ,dw({shapeType:"rectangle",propTransformer:Lee,activeClassName:"recharts-active-bar"},t))}var zee=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,i){if(typeof e=="number")return e;var a=ge(n)||W9(n);return a?e(n,i):(a||Mo(),r)}},Bee=["value","background"],Z$;function nl(t){"@babel/helpers - typeof";return nl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nl(t)}function Uee(t,e){if(t==null)return{};var r=qee(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function qee(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Wh(){return Wh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Wh.apply(this,arguments)}function nN(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 Jt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nN(Object(r),!0).forEach(function(n){$a(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Fee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iN(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,eM(n.key),n)}}function Hee(t,e,r){return e&&iN(t.prototype,e),r&&iN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wee(t,e,r){return e=Kh(e),Kee(t,Q$()?Reflect.construct(e,r||[],Kh(t).constructor):e.apply(t,r))}function Kee(t,e){if(e&&(nl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gee(t)}function Gee(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Q$(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Q$=function(){return!!t})()}function Kh(t){return Kh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Kh(t)}function Vee(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fw(t,e)}function fw(t,e){return fw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},fw(t,e)}function $a(t,e,r){return e=eM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eM(t){var e=Xee(t,"string");return nl(e)=="symbol"?e:e+""}function Xee(t,e){if(nl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(nl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var ta=(function(t){function e(){var r;Fee(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=Wee(this,e,[].concat(i)),$a(r,"state",{isAnimationFinished:!1}),$a(r,"id",zu("recharts-bar-")),$a(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),o&&o()}),$a(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),o&&o()}),r}return Vee(e,t),Hee(e,[{key:"renderRectanglesStatically",value:function(n){var i=this,a=this.props,o=a.shape,c=a.dataKey,u=a.activeIndex,d=a.activeBar,p=at(this.props,!1);return n&&n.map(function(f,m){var v=m===u,b=v?d:o,w=Jt(Jt(Jt({},p),f),{},{isActive:v,option:b,index:m,dataKey:c,onAnimationStart:i.handleAnimationStart,onAnimationEnd:i.handleAnimationEnd});return M.createElement(Xt,Wh({className:"recharts-bar-rectangle"},ah(i.props,f,m),{key:"rectangle-".concat(f==null?void 0:f.x,"-").concat(f==null?void 0:f.y,"-").concat(f==null?void 0:f.value,"-").concat(m)}),M.createElement(rN,w))})}},{key:"renderRectanglesWithAnimation",value:function(){var n=this,i=this.props,a=i.data,o=i.layout,c=i.isAnimationActive,u=i.animationBegin,d=i.animationDuration,p=i.animationEasing,f=i.animationId,m=this.state.prevData;return M.createElement(ea,{begin:u,duration:d,isActive:c,easing:p,from:{t:0},to:{t:1},key:"bar-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(v){var b=v.t,w=a.map(function(x,k){var S=m&&m[k];if(S){var A=Vn(S.x,x.x),C=Vn(S.y,x.y),T=Vn(S.width,x.width),O=Vn(S.height,x.height);return Jt(Jt({},x),{},{x:A(b),y:C(b),width:T(b),height:O(b)})}if(o==="horizontal"){var N=Vn(0,x.height),R=N(b);return Jt(Jt({},x),{},{y:x.y+x.height-R,height:R})}var $=Vn(0,x.width),K=$(b);return Jt(Jt({},x),{},{width:K})});return M.createElement(Xt,null,n.renderRectanglesStatically(w))})}},{key:"renderRectangles",value:function(){var n=this.props,i=n.data,a=n.isAnimationActive,o=this.state.prevData;return a&&i&&i.length&&(!o||!Mp(o,i))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(i)}},{key:"renderBackground",value:function(){var n=this,i=this.props,a=i.data,o=i.dataKey,c=i.activeIndex,u=at(this.props.background,!1);return a.map(function(d,p){d.value;var f=d.background,m=Uee(d,Bee);if(!f)return null;var v=Jt(Jt(Jt(Jt(Jt({},m),{},{fill:"#eee"},f),u),ah(n.props,d,p)),{},{onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd,dataKey:o,index:p,className:"recharts-bar-background-rectangle"});return M.createElement(rN,Wh({key:"background-bar-".concat(p),option:n.props.background,isActive:p===c},v))})}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.data,c=a.xAxis,u=a.yAxis,d=a.layout,p=a.children,f=Tn(p,Wu);if(!f)return null;var m=d==="vertical"?o[0].height/2:o[0].width/2,v=function(x,k){var S=Array.isArray(x.value)?x.value[1]:x.value;return{x:x.x,y:x.y,value:S,errorVal:dn(x,k)}},b={clipPath:n?"url(#clipPath-".concat(i,")"):null};return M.createElement(Xt,b,f.map(function(w){return M.cloneElement(w,{key:"error-bar-".concat(i,"-").concat(w.props.dataKey),data:o,xAxis:c,yAxis:u,layout:d,offset:m,dataPointFormatter:v})}))}},{key:"render",value:function(){var n=this.props,i=n.hide,a=n.data,o=n.className,c=n.xAxis,u=n.yAxis,d=n.left,p=n.top,f=n.width,m=n.height,v=n.isAnimationActive,b=n.background,w=n.id;if(i||!a||!a.length)return null;var x=this.state.isAnimationFinished,k=ot("recharts-bar",o),S=c&&c.allowDataOverflow,A=u&&u.allowDataOverflow,C=S||A,T=tt(w)?this.id:w;return M.createElement(Xt,{className:k},S||A?M.createElement("defs",null,M.createElement("clipPath",{id:"clipPath-".concat(T)},M.createElement("rect",{x:S?d:d-f/2,y:A?p:p-m/2,width:S?f:f*2,height:A?m:m*2}))):null,M.createElement(Xt,{className:"recharts-bar-rectangles",clipPath:C?"url(#clipPath-".concat(T,")"):null},b?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(C,T),(!v||x)&&za.renderCallByParent(this.props,a))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curData:n.data,prevData:i.curData}:n.data!==i.curData?{curData:n.data}:null}}])})(j.PureComponent);Z$=ta;$a(ta,"displayName","Bar");$a(ta,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Sl.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});$a(ta,"getComposedData",function(t){var e=t.props,r=t.item,n=t.barPosition,i=t.bandSize,a=t.xAxis,o=t.yAxis,c=t.xAxisTicks,u=t.yAxisTicks,d=t.stackedData,p=t.dataStartIndex,f=t.displayedData,m=t.offset,v=uY(n,r);if(!v)return null;var b=e.layout,w=r.type.defaultProps,x=w!==void 0?Jt(Jt({},w),r.props):r.props,k=x.dataKey,S=x.children,A=x.minPointSize,C=b==="horizontal"?o:a,T=d?C.scale.domain():null,O=vY({numericAxis:C}),N=Tn(S,NI),R=f.map(function($,K){var z,U,F,X,Y,G;d?z=dY(d[p+K],T):(z=dn($,k),Array.isArray(z)||(z=[O,z]));var Z=zee(A,Z$.defaultProps.minPointSize)(z[1],K);if(b==="horizontal"){var W,Q=[o.scale(z[0]),o.scale(z[1])],L=Q[0],I=Q[1];U=Hj({axis:a,ticks:c,bandSize:i,offset:v.offset,entry:$,index:K}),F=(W=I??L)!==null&&W!==void 0?W:void 0,X=v.size;var q=L-I;if(Y=Number.isNaN(q)?0:q,G={x:U,y:o.y,width:X,height:o.height},Math.abs(Z)>0&&Math.abs(Y)<Math.abs(Z)){var ee=Jn(Y||Z)*(Math.abs(Z)-Math.abs(Y));F-=ee,Y+=ee}}else{var le=[a.scale(z[0]),a.scale(z[1])],fe=le[0],ve=le[1];if(U=fe,F=Hj({axis:o,ticks:u,bandSize:i,offset:v.offset,entry:$,index:K}),X=ve-fe,Y=v.size,G={x:a.x,y:F,width:a.width,height:Y},Math.abs(Z)>0&&Math.abs(X)<Math.abs(Z)){var qe=Jn(X||Z)*(Math.abs(Z)-Math.abs(X));X+=qe}}return Jt(Jt(Jt({},$),{},{x:U,y:F,width:X,height:Y,value:d?z:z[1],payload:$,background:G},N&&N[K]&&N[K].props),{},{tooltipPayload:[M$(r,$)],tooltipPosition:{x:U+X/2,y:F+Y/2}})});return Jt({data:R,layout:b},m)});function Ou(t){"@babel/helpers - typeof";return Ou=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ou(t)}function Yee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function aN(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tM(n.key),n)}}function Jee(t,e,r){return e&&aN(t.prototype,e),r&&aN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function oN(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 Hn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?oN(Object(r),!0).forEach(function(n){Up(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):oN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Up(t,e,r){return e=tM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function tM(t){var e=Zee(t,"string");return Ou(e)=="symbol"?e:e+""}function Zee(t,e){if(Ou(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Ou(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var rM=function(e,r,n,i,a){var o=e.width,c=e.height,u=e.layout,d=e.children,p=Object.keys(r),f={left:n.left,leftMirror:n.left,right:o-n.right,rightMirror:o-n.right,top:n.top,topMirror:n.top,bottom:c-n.bottom,bottomMirror:c-n.bottom},m=!!sn(d,ta);return p.reduce(function(v,b){var w=r[b],x=w.orientation,k=w.domain,S=w.padding,A=S===void 0?{}:S,C=w.mirror,T=w.reversed,O="".concat(x).concat(C?"Mirror":""),N,R,$,K,z;if(w.type==="number"&&(w.padding==="gap"||w.padding==="no-gap")){var U=k[1]-k[0],F=1/0,X=w.categoricalDomain.sort(V9);if(X.forEach(function(le,fe){fe>0&&(F=Math.min((le||0)-(X[fe-1]||0),F))}),Number.isFinite(F)){var Y=F/U,G=w.layout==="vertical"?n.height:n.width;if(w.padding==="gap"&&(N=Y*G/2),w.padding==="no-gap"){var Z=Io(e.barCategoryGap,Y*G),W=Y*G/2;N=W-Z-(W-Z)/G*Z}}}i==="xAxis"?R=[n.left+(A.left||0)+(N||0),n.left+n.width-(A.right||0)-(N||0)]:i==="yAxis"?R=u==="horizontal"?[n.top+n.height-(A.bottom||0),n.top+(A.top||0)]:[n.top+(A.top||0)+(N||0),n.top+n.height-(A.bottom||0)-(N||0)]:R=w.range,T&&(R=[R[1],R[0]]);var Q=lY(w,a,m),L=Q.scale,I=Q.realScaleType;L.domain(k).range(R),cY(L);var q=yY(L,Hn(Hn({},w),{},{realScaleType:I}));i==="xAxis"?(z=x==="top"&&!C||x==="bottom"&&C,$=n.left,K=f[O]-z*w.height):i==="yAxis"&&(z=x==="left"&&!C||x==="right"&&C,$=f[O]-z*w.width,K=n.top);var ee=Hn(Hn(Hn({},w),q),{},{realScaleType:I,x:$,y:K,scale:L,width:i==="xAxis"?n.width:w.width,height:i==="yAxis"?n.height:w.height});return ee.bandSize=Ph(ee,q),!w.hide&&i==="xAxis"?f[O]+=(z?-1:1)*ee.height:w.hide||(f[O]+=(z?-1:1)*ee.width),Hn(Hn({},v),{},Up({},b,ee))},{})},nM=function(e,r){var n=e.x,i=e.y,a=r.x,o=r.y;return{x:Math.min(n,a),y:Math.min(i,o),width:Math.abs(a-n),height:Math.abs(o-i)}},Qee=function(e){var r=e.x1,n=e.y1,i=e.x2,a=e.y2;return nM({x:r,y:n},{x:i,y:a})},iM=(function(){function t(e){Yee(this,t),this.scale=e}return Jee(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.bandAware,a=n.position;if(r!==void 0){if(a)switch(a){case"start":return this.scale(r);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+o}case"end":{var c=this.bandwidth?this.bandwidth():0;return this.scale(r)+c}default:return this.scale(r)}if(i){var u=this.bandwidth?this.bandwidth()/2:0;return this.scale(r)+u}return this.scale(r)}}},{key:"isInRange",value:function(r){var n=this.range(),i=n[0],a=n[n.length-1];return i<=a?r>=i&&r<=a:r>=a&&r<=i}}],[{key:"create",value:function(r){return new t(r)}}])})();Up(iM,"EPS",1e-4);var i_=function(e){var r=Object.keys(e).reduce(function(n,i){return Hn(Hn({},n),{},Up({},i,iM.create(e[i])))},{});return Hn(Hn({},r),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,c=a.position;return Oee(i,function(u,d){return r[d].apply(u,{bandAware:o,position:c})})},isInRange:function(i){return J$(i,function(a,o){return r[o].isInRange(a)})}})};function ete(t){return(t%180+180)%180}var tte=function(e){var r=e.width,n=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=ete(i),o=a*Math.PI/180,c=Math.atan(n/r),u=o>c&&o<Math.PI-c?n/Math.sin(o):r/Math.cos(o);return Math.abs(u)},Mb,sN;function rte(){if(sN)return Mb;sN=1;var t=Ka(),e=Bu(),r=Ep();function n(i){return function(a,o,c){var u=Object(a);if(!e(a)){var d=t(o,3);a=r(a),o=function(f){return d(u[f],f,u)}}var p=i(a,o,c);return p>-1?u[d?a[p]:p]:void 0}}return Mb=n,Mb}var Db,lN;function nte(){if(lN)return Db;lN=1;var t=G$();function e(r){var n=t(r),i=n%1;return n===n?i?n-i:n:0}return Db=e,Db}var Lb,cN;function ite(){if(cN)return Lb;cN=1;var t=yI(),e=Ka(),r=nte(),n=Math.max;function i(a,o,c){var u=a==null?0:a.length;if(!u)return-1;var d=c==null?0:r(c);return d<0&&(d=n(u+d,0)),t(a,e(o,3),d)}return Lb=i,Lb}var zb,uN;function ate(){if(uN)return zb;uN=1;var t=rte(),e=ite(),r=t(e);return zb=r,zb}var ote=ate();const ste=vt(ote);var lte=RR();const cte=vt(lte);var ute=cte(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),a_=j.createContext(void 0),o_=j.createContext(void 0),aM=j.createContext(void 0),oM=j.createContext({}),sM=j.createContext(void 0),lM=j.createContext(0),cM=j.createContext(0),dN=function(e){var r=e.state,n=r.xAxisMap,i=r.yAxisMap,a=r.offset,o=e.clipPathId,c=e.children,u=e.width,d=e.height,p=ute(a);return M.createElement(a_.Provider,{value:n},M.createElement(o_.Provider,{value:i},M.createElement(oM.Provider,{value:a},M.createElement(aM.Provider,{value:p},M.createElement(sM.Provider,{value:o},M.createElement(lM.Provider,{value:d},M.createElement(cM.Provider,{value:u},c)))))))},dte=function(){return j.useContext(sM)},uM=function(e){var r=j.useContext(a_);r==null&&Mo();var n=r[e];return n==null&&Mo(),n},fte=function(){var e=j.useContext(a_);return Ra(e)},hte=function(){var e=j.useContext(o_),r=ste(e,function(n){return J$(n.domain,Number.isFinite)});return r||Ra(e)},dM=function(e){var r=j.useContext(o_);r==null&&Mo();var n=r[e];return n==null&&Mo(),n},pte=function(){var e=j.useContext(aM);return e},mte=function(){return j.useContext(oM)},s_=function(){return j.useContext(cM)},l_=function(){return j.useContext(lM)};function il(t){"@babel/helpers - typeof";return il=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},il(t)}function gte(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yte(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hM(n.key),n)}}function vte(t,e,r){return e&&yte(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function bte(t,e,r){return e=Gh(e),xte(t,fM()?Reflect.construct(e,r||[],Gh(t).constructor):e.apply(t,r))}function xte(t,e){if(e&&(il(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wte(t)}function wte(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function fM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(fM=function(){return!!t})()}function Gh(t){return Gh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Gh(t)}function _te(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hw(t,e)}function hw(t,e){return hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},hw(t,e)}function fN(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 hN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?fN(Object(r),!0).forEach(function(n){c_(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function c_(t,e,r){return e=hM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hM(t){var e=Ste(t,"string");return il(e)=="symbol"?e:e+""}function Ste(t,e){if(il(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(il(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function kte(t,e){return Tte(t)||Ote(t,e)||Ate(t,e)||Ete()}function Ete(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
513
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ate(t,e){if(t){if(typeof t=="string")return pN(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 pN(t,e)}}function pN(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 Ote(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function Tte(t){if(Array.isArray(t))return t}function pw(){return pw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},pw.apply(this,arguments)}var Cte=function(e,r){var n;return M.isValidElement(e)?n=M.cloneElement(e,r):Je(e)?n=e(r):n=M.createElement("line",pw({},r,{className:"recharts-reference-line-line"})),n},jte=function(e,r,n,i,a,o,c,u,d){var p=a.x,f=a.y,m=a.width,v=a.height;if(n){var b=d.y,w=e.y.apply(b,{position:o});if(Si(d,"discard")&&!e.y.isInRange(w))return null;var x=[{x:p+m,y:w},{x:p,y:w}];return u==="left"?x.reverse():x}if(r){var k=d.x,S=e.x.apply(k,{position:o});if(Si(d,"discard")&&!e.x.isInRange(S))return null;var A=[{x:S,y:f+v},{x:S,y:f}];return c==="top"?A.reverse():A}if(i){var C=d.segment,T=C.map(function(O){return e.apply(O,{position:o})});return Si(d,"discard")&&See(T,function(O){return!e.isInRange(O)})?null:T}return null};function Nte(t){var e=t.x,r=t.y,n=t.segment,i=t.xAxisId,a=t.yAxisId,o=t.shape,c=t.className,u=t.alwaysShow,d=dte(),p=uM(i),f=dM(a),m=pte();if(!d||!m)return null;Vi(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var v=i_({x:p.scale,y:f.scale}),b=sr(e),w=sr(r),x=n&&n.length===2,k=jte(v,b,w,x,m,t.position,p.orientation,f.orientation,t);if(!k)return null;var S=kte(k,2),A=S[0],C=A.x,T=A.y,O=S[1],N=O.x,R=O.y,$=Si(t,"hidden")?"url(#".concat(d,")"):void 0,K=hN(hN({clipPath:$},at(t,!0)),{},{x1:C,y1:T,x2:N,y2:R});return M.createElement(Xt,{className:ot("recharts-reference-line",c)},Cte(o,K),jr.renderCallByParent(t,Qee({x1:C,y1:T,x2:N,y2:R})))}var u_=(function(t){function e(){return gte(this,e),bte(this,e,arguments)}return _te(e,t),vte(e,[{key:"render",value:function(){return M.createElement(Nte,this.props)}}])})(M.Component);c_(u_,"displayName","ReferenceLine");c_(u_,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function mw(){return mw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},mw.apply(this,arguments)}function al(t){"@babel/helpers - typeof";return al=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},al(t)}function mN(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 gN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?mN(Object(r),!0).forEach(function(n){qp(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Pte(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Rte(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mM(n.key),n)}}function Ite(t,e,r){return e&&Rte(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function $te(t,e,r){return e=Vh(e),Mte(t,pM()?Reflect.construct(e,r||[],Vh(t).constructor):e.apply(t,r))}function Mte(t,e){if(e&&(al(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Dte(t)}function Dte(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pM=function(){return!!t})()}function Vh(t){return Vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vh(t)}function Lte(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gw(t,e)}function gw(t,e){return gw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},gw(t,e)}function qp(t,e,r){return e=mM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mM(t){var e=zte(t,"string");return al(e)=="symbol"?e:e+""}function zte(t,e){if(al(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(al(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Bte=function(e){var r=e.x,n=e.y,i=e.xAxis,a=e.yAxis,o=i_({x:i.scale,y:a.scale}),c=o.apply({x:r,y:n},{bandAware:!0});return Si(e,"discard")&&!o.isInRange(c)?null:c},Fp=(function(t){function e(){return Pte(this,e),$te(this,e,arguments)}return Lte(e,t),Ite(e,[{key:"render",value:function(){var n=this.props,i=n.x,a=n.y,o=n.r,c=n.alwaysShow,u=n.clipPathId,d=sr(i),p=sr(a);if(Vi(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!d||!p)return null;var f=Bte(this.props);if(!f)return null;var m=f.x,v=f.y,b=this.props,w=b.shape,x=b.className,k=Si(this.props,"hidden")?"url(#".concat(u,")"):void 0,S=gN(gN({clipPath:k},at(this.props,!0)),{},{cx:m,cy:v});return M.createElement(Xt,{className:ot("recharts-reference-dot",x)},e.renderDot(w,S),jr.renderCallByParent(this.props,{x:m-o,y:v-o,width:2*o,height:2*o}))}}])})(M.Component);qp(Fp,"displayName","ReferenceDot");qp(Fp,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});qp(Fp,"renderDot",function(t,e){var r;return M.isValidElement(t)?r=M.cloneElement(t,e):Je(t)?r=t(e):r=M.createElement(n_,mw({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),r});function yw(){return yw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},yw.apply(this,arguments)}function ol(t){"@babel/helpers - typeof";return ol=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ol(t)}function yN(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 vN(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yN(Object(r),!0).forEach(function(n){Hp(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ute(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qte(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yM(n.key),n)}}function Fte(t,e,r){return e&&qte(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Hte(t,e,r){return e=Xh(e),Wte(t,gM()?Reflect.construct(e,r||[],Xh(t).constructor):e.apply(t,r))}function Wte(t,e){if(e&&(ol(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Kte(t)}function Kte(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function gM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gM=function(){return!!t})()}function Xh(t){return Xh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Xh(t)}function Gte(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vw(t,e)}function vw(t,e){return vw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},vw(t,e)}function Hp(t,e,r){return e=yM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yM(t){var e=Vte(t,"string");return ol(e)=="symbol"?e:e+""}function Vte(t,e){if(ol(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ol(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Xte=function(e,r,n,i,a){var o=a.x1,c=a.x2,u=a.y1,d=a.y2,p=a.xAxis,f=a.yAxis;if(!p||!f)return null;var m=i_({x:p.scale,y:f.scale}),v={x:e?m.x.apply(o,{position:"start"}):m.x.rangeMin,y:n?m.y.apply(u,{position:"start"}):m.y.rangeMin},b={x:r?m.x.apply(c,{position:"end"}):m.x.rangeMax,y:i?m.y.apply(d,{position:"end"}):m.y.rangeMax};return Si(a,"discard")&&(!m.isInRange(v)||!m.isInRange(b))?null:nM(v,b)},Wp=(function(t){function e(){return Ute(this,e),Hte(this,e,arguments)}return Gte(e,t),Fte(e,[{key:"render",value:function(){var n=this.props,i=n.x1,a=n.x2,o=n.y1,c=n.y2,u=n.className,d=n.alwaysShow,p=n.clipPathId;Vi(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=sr(i),m=sr(a),v=sr(o),b=sr(c),w=this.props.shape;if(!f&&!m&&!v&&!b&&!w)return null;var x=Xte(f,m,v,b,this.props);if(!x&&!w)return null;var k=Si(this.props,"hidden")?"url(#".concat(p,")"):void 0;return M.createElement(Xt,{className:ot("recharts-reference-area",u)},e.renderRect(w,vN(vN({clipPath:k},at(this.props,!0)),x)),jr.renderCallByParent(this.props,x))}}])})(M.Component);Hp(Wp,"displayName","ReferenceArea");Hp(Wp,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});Hp(Wp,"renderRect",function(t,e){var r;return M.isValidElement(t)?r=M.cloneElement(t,e):Je(t)?r=t(e):r=M.createElement(r_,yw({},e,{className:"recharts-reference-area-rect"})),r});function vM(t,e,r){if(e<1)return[];if(e===1&&r===void 0)return t;for(var n=[],i=0;i<t.length;i+=e)n.push(t[i]);return n}function Yte(t,e,r){var n={width:t.width+e.width,height:t.height+e.height};return tte(n,r)}function Jte(t,e,r){var n=r==="width",i=t.x,a=t.y,o=t.width,c=t.height;return e===1?{start:n?i:a,end:n?i+o:a+c}:{start:n?i+o:a+c,end:n?i:a}}function Yh(t,e,r,n,i){if(t*e<t*n||t*e>t*i)return!1;var a=r();return t*(e-t*a/2-n)>=0&&t*(e+t*a/2-i)<=0}function Zte(t,e){return vM(t,e+1)}function Qte(t,e,r,n,i){for(var a=(n||[]).slice(),o=e.start,c=e.end,u=0,d=1,p=o,f=function(){var b=n==null?void 0:n[u];if(b===void 0)return{v:vM(n,d)};var w=u,x,k=function(){return x===void 0&&(x=r(b,w)),x},S=b.coordinate,A=u===0||Yh(t,S,k,p,c);A||(u=0,p=o,d+=1),A&&(p=S+t*(k()/2+i),u+=d)},m;d<=a.length;)if(m=f(),m)return m.v;return[]}function Tu(t){"@babel/helpers - typeof";return Tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Tu(t)}function bN(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 Cr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bN(Object(r),!0).forEach(function(n){ere(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ere(t,e,r){return e=tre(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function tre(t){var e=rre(t,"string");return Tu(e)=="symbol"?e:e+""}function rre(t,e){if(Tu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Tu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nre(t,e,r,n,i){for(var a=(n||[]).slice(),o=a.length,c=e.start,u=e.end,d=function(m){var v=a[m],b,w=function(){return b===void 0&&(b=r(v,m)),b};if(m===o-1){var x=t*(v.coordinate+t*w()/2-u);a[m]=v=Cr(Cr({},v),{},{tickCoord:x>0?v.coordinate-x*t:v.coordinate})}else a[m]=v=Cr(Cr({},v),{},{tickCoord:v.coordinate});var k=Yh(t,v.tickCoord,w,c,u);k&&(u=v.tickCoord-t*(w()/2+i),a[m]=Cr(Cr({},v),{},{isShow:!0}))},p=o-1;p>=0;p--)d(p);return a}function ire(t,e,r,n,i,a){var o=(n||[]).slice(),c=o.length,u=e.start,d=e.end;if(a){var p=n[c-1],f=r(p,c-1),m=t*(p.coordinate+t*f/2-d);o[c-1]=p=Cr(Cr({},p),{},{tickCoord:m>0?p.coordinate-m*t:p.coordinate});var v=Yh(t,p.tickCoord,function(){return f},u,d);v&&(d=p.tickCoord-t*(f/2+i),o[c-1]=Cr(Cr({},p),{},{isShow:!0}))}for(var b=a?c-1:c,w=function(S){var A=o[S],C,T=function(){return C===void 0&&(C=r(A,S)),C};if(S===0){var O=t*(A.coordinate-t*T()/2-u);o[S]=A=Cr(Cr({},A),{},{tickCoord:O<0?A.coordinate-O*t:A.coordinate})}else o[S]=A=Cr(Cr({},A),{},{tickCoord:A.coordinate});var N=Yh(t,A.tickCoord,T,u,d);N&&(u=A.tickCoord+t*(T()/2+i),o[S]=Cr(Cr({},A),{},{isShow:!0}))},x=0;x<b;x++)w(x);return o}function d_(t,e,r){var n=t.tick,i=t.ticks,a=t.viewBox,o=t.minTickGap,c=t.orientation,u=t.interval,d=t.tickFormatter,p=t.unit,f=t.angle;if(!i||!i.length||!n)return[];if(ge(u)||Sl.isSsr)return Zte(i,typeof u=="number"&&ge(u)?u:0);var m=[],v=c==="top"||c==="bottom"?"width":"height",b=p&&v==="width"?Mc(p,{fontSize:e,letterSpacing:r}):{width:0,height:0},w=function(A,C){var T=Je(d)?d(A.value,C):A.value;return v==="width"?Yte(Mc(T,{fontSize:e,letterSpacing:r}),b,f):Mc(T,{fontSize:e,letterSpacing:r})[v]},x=i.length>=2?Jn(i[1].coordinate-i[0].coordinate):1,k=Jte(a,x,v);return u==="equidistantPreserveStart"?Qte(x,k,w,i,o):(u==="preserveStart"||u==="preserveStartEnd"?m=ire(x,k,w,i,o,u==="preserveStartEnd"):m=nre(x,k,w,i,o),m.filter(function(S){return S.isShow}))}var are=["viewBox"],ore=["viewBox"],sre=["ticks"];function sl(t){"@babel/helpers - typeof";return sl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sl(t)}function Is(){return Is=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Is.apply(this,arguments)}function xN(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 ar(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xN(Object(r),!0).forEach(function(n){f_(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Bb(t,e){if(t==null)return{};var r=lre(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function lre(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function cre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wN(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,xM(n.key),n)}}function ure(t,e,r){return e&&wN(t.prototype,e),r&&wN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function dre(t,e,r){return e=Jh(e),fre(t,bM()?Reflect.construct(e,r||[],Jh(t).constructor):e.apply(t,r))}function fre(t,e){if(e&&(sl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hre(t)}function hre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bM=function(){return!!t})()}function Jh(t){return Jh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Jh(t)}function pre(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bw(t,e)}function bw(t,e){return bw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},bw(t,e)}function f_(t,e,r){return e=xM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xM(t){var e=mre(t,"string");return sl(e)=="symbol"?e:e+""}function mre(t,e){if(sl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(sl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Ol=(function(t){function e(r){var n;return cre(this,e),n=dre(this,e,[r]),n.state={fontSize:"",letterSpacing:""},n}return pre(e,t),ure(e,[{key:"shouldComponentUpdate",value:function(n,i){var a=n.viewBox,o=Bb(n,are),c=this.props,u=c.viewBox,d=Bb(c,ore);return!zs(a,u)||!zs(o,d)||!zs(i,this.state)}},{key:"componentDidMount",value:function(){var n=this.layerReference;if(n){var i=n.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];i&&this.setState({fontSize:window.getComputedStyle(i).fontSize,letterSpacing:window.getComputedStyle(i).letterSpacing})}}},{key:"getTickLineCoord",value:function(n){var i=this.props,a=i.x,o=i.y,c=i.width,u=i.height,d=i.orientation,p=i.tickSize,f=i.mirror,m=i.tickMargin,v,b,w,x,k,S,A=f?-1:1,C=n.tickSize||p,T=ge(n.tickCoord)?n.tickCoord:n.coordinate;switch(d){case"top":v=b=n.coordinate,x=o+ +!f*u,w=x-A*C,S=w-A*m,k=T;break;case"left":w=x=n.coordinate,b=a+ +!f*c,v=b-A*C,k=v-A*m,S=T;break;case"right":w=x=n.coordinate,b=a+ +f*c,v=b+A*C,k=v+A*m,S=T;break;default:v=b=n.coordinate,x=o+ +f*u,w=x+A*C,S=w+A*m,k=T;break}return{line:{x1:v,y1:w,x2:b,y2:x},tick:{x:k,y:S}}}},{key:"getTickTextAnchor",value:function(){var n=this.props,i=n.orientation,a=n.mirror,o;switch(i){case"left":o=a?"start":"end";break;case"right":o=a?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var n=this.props,i=n.orientation,a=n.mirror,o="end";switch(i){case"left":case"right":o="middle";break;case"top":o=a?"start":"end";break;default:o=a?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var n=this.props,i=n.x,a=n.y,o=n.width,c=n.height,u=n.orientation,d=n.mirror,p=n.axisLine,f=ar(ar(ar({},at(this.props,!1)),at(p,!1)),{},{fill:"none"});if(u==="top"||u==="bottom"){var m=+(u==="top"&&!d||u==="bottom"&&d);f=ar(ar({},f),{},{x1:i,y1:a+m*c,x2:i+o,y2:a+m*c})}else{var v=+(u==="left"&&!d||u==="right"&&d);f=ar(ar({},f),{},{x1:i+v*o,y1:a,x2:i+v*o,y2:a+c})}return M.createElement("line",Is({},f,{className:ot("recharts-cartesian-axis-line",On(p,"className"))}))}},{key:"renderTicks",value:function(n,i,a){var o=this,c=this.props,u=c.tickLine,d=c.stroke,p=c.tick,f=c.tickFormatter,m=c.unit,v=d_(ar(ar({},this.props),{},{ticks:n}),i,a),b=this.getTickTextAnchor(),w=this.getTickVerticalAnchor(),x=at(this.props,!1),k=at(p,!1),S=ar(ar({},x),{},{fill:"none"},at(u,!1)),A=v.map(function(C,T){var O=o.getTickLineCoord(C),N=O.line,R=O.tick,$=ar(ar(ar(ar({textAnchor:b,verticalAnchor:w},x),{},{stroke:"none",fill:d},k),R),{},{index:T,payload:C,visibleTicksCount:v.length,tickFormatter:f});return M.createElement(Xt,Is({className:"recharts-cartesian-axis-tick",key:"tick-".concat(C.value,"-").concat(C.coordinate,"-").concat(C.tickCoord)},ah(o.props,C,T)),u&&M.createElement("line",Is({},S,N,{className:ot("recharts-cartesian-axis-tick-line",On(u,"className"))})),p&&e.renderTickItem(p,$,"".concat(Je(f)?f(C.value,T):C.value).concat(m||"")))});return M.createElement("g",{className:"recharts-cartesian-axis-ticks"},A)}},{key:"render",value:function(){var n=this,i=this.props,a=i.axisLine,o=i.width,c=i.height,u=i.ticksGenerator,d=i.className,p=i.hide;if(p)return null;var f=this.props,m=f.ticks,v=Bb(f,sre),b=m;return Je(u)&&(b=m&&m.length>0?u(this.props):u(v)),o<=0||c<=0||!b||!b.length?null:M.createElement(Xt,{className:ot("recharts-cartesian-axis",d),ref:function(x){n.layerReference=x}},a&&this.renderAxisLine(),this.renderTicks(b,this.state.fontSize,this.state.letterSpacing),jr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(n,i,a){var o,c=ot(i.className,"recharts-cartesian-axis-tick-value");return M.isValidElement(n)?o=M.cloneElement(n,ar(ar({},i),{},{className:c})):Je(n)?o=n(ar(ar({},i),{},{className:c})):o=M.createElement(yh,Is({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])})(j.Component);f_(Ol,"displayName","CartesianAxis");f_(Ol,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var gre=["x1","y1","x2","y2","key"],yre=["offset"];function Do(t){"@babel/helpers - typeof";return Do=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Do(t)}function _N(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 Nr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_N(Object(r),!0).forEach(function(n){vre(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_N(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function vre(t,e,r){return e=bre(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bre(t){var e=xre(t,"string");return Do(e)=="symbol"?e:e+""}function xre(t,e){if(Do(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Do(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function To(){return To=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},To.apply(this,arguments)}function SN(t,e){if(t==null)return{};var r=wre(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function wre(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}var _re=function(e){var r=e.fill;if(!r||r==="none")return null;var n=e.fillOpacity,i=e.x,a=e.y,o=e.width,c=e.height,u=e.ry;return M.createElement("rect",{x:i,y:a,ry:u,width:o,height:c,stroke:"none",fill:r,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function wM(t,e){var r;if(M.isValidElement(t))r=M.cloneElement(t,e);else if(Je(t))r=t(e);else{var n=e.x1,i=e.y1,a=e.x2,o=e.y2,c=e.key,u=SN(e,gre),d=at(u,!1);d.offset;var p=SN(d,yre);r=M.createElement("line",To({},p,{x1:n,y1:i,x2:a,y2:o,fill:"none",key:c}))}return r}function Sre(t){var e=t.x,r=t.width,n=t.horizontal,i=n===void 0?!0:n,a=t.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(c,u){var d=Nr(Nr({},t),{},{x1:e,y1:c,x2:e+r,y2:c,key:"line-".concat(u),index:u});return wM(i,d)});return M.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function kre(t){var e=t.y,r=t.height,n=t.vertical,i=n===void 0?!0:n,a=t.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(c,u){var d=Nr(Nr({},t),{},{x1:c,y1:e,x2:c,y2:e+r,key:"line-".concat(u),index:u});return wM(i,d)});return M.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Ere(t){var e=t.horizontalFill,r=t.fillOpacity,n=t.x,i=t.y,a=t.width,o=t.height,c=t.horizontalPoints,u=t.horizontal,d=u===void 0?!0:u;if(!d||!e||!e.length)return null;var p=c.map(function(m){return Math.round(m+i-i)}).sort(function(m,v){return m-v});i!==p[0]&&p.unshift(0);var f=p.map(function(m,v){var b=!p[v+1],w=b?i+o-m:p[v+1]-m;if(w<=0)return null;var x=v%e.length;return M.createElement("rect",{key:"react-".concat(v),y:m,x:n,height:w,width:a,stroke:"none",fill:e[x],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return M.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Are(t){var e=t.vertical,r=e===void 0?!0:e,n=t.verticalFill,i=t.fillOpacity,a=t.x,o=t.y,c=t.width,u=t.height,d=t.verticalPoints;if(!r||!n||!n.length)return null;var p=d.map(function(m){return Math.round(m+a-a)}).sort(function(m,v){return m-v});a!==p[0]&&p.unshift(0);var f=p.map(function(m,v){var b=!p[v+1],w=b?a+c-m:p[v+1]-m;if(w<=0)return null;var x=v%n.length;return M.createElement("rect",{key:"react-".concat(v),x:m,y:o,width:w,height:u,stroke:"none",fill:n[x],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return M.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Ore=function(e,r){var n=e.xAxis,i=e.width,a=e.height,o=e.offset;return I$(d_(Nr(Nr(Nr({},Ol.defaultProps),n),{},{ticks:Ki(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,r)},Tre=function(e,r){var n=e.yAxis,i=e.width,a=e.height,o=e.offset;return I$(d_(Nr(Nr(Nr({},Ol.defaultProps),n),{},{ticks:Ki(n,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,r)},As={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Cu(t){var e,r,n,i,a,o,c=s_(),u=l_(),d=mte(),p=Nr(Nr({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:As.stroke,fill:(r=t.fill)!==null&&r!==void 0?r:As.fill,horizontal:(n=t.horizontal)!==null&&n!==void 0?n:As.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:As.horizontalFill,vertical:(a=t.vertical)!==null&&a!==void 0?a:As.vertical,verticalFill:(o=t.verticalFill)!==null&&o!==void 0?o:As.verticalFill,x:ge(t.x)?t.x:d.left,y:ge(t.y)?t.y:d.top,width:ge(t.width)?t.width:d.width,height:ge(t.height)?t.height:d.height}),f=p.x,m=p.y,v=p.width,b=p.height,w=p.syncWithTicks,x=p.horizontalValues,k=p.verticalValues,S=fte(),A=hte();if(!ge(v)||v<=0||!ge(b)||b<=0||!ge(f)||f!==+f||!ge(m)||m!==+m)return null;var C=p.verticalCoordinatesGenerator||Ore,T=p.horizontalCoordinatesGenerator||Tre,O=p.horizontalPoints,N=p.verticalPoints;if((!O||!O.length)&&Je(T)){var R=x&&x.length,$=T({yAxis:A?Nr(Nr({},A),{},{ticks:R?x:A.ticks}):void 0,width:c,height:u,offset:d},R?!0:w);Vi(Array.isArray($),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Do($),"]")),Array.isArray($)&&(O=$)}if((!N||!N.length)&&Je(C)){var K=k&&k.length,z=C({xAxis:S?Nr(Nr({},S),{},{ticks:K?k:S.ticks}):void 0,width:c,height:u,offset:d},K?!0:w);Vi(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Do(z),"]")),Array.isArray(z)&&(N=z)}return M.createElement("g",{className:"recharts-cartesian-grid"},M.createElement(_re,{fill:p.fill,fillOpacity:p.fillOpacity,x:p.x,y:p.y,width:p.width,height:p.height,ry:p.ry}),M.createElement(Sre,To({},p,{offset:d,horizontalPoints:O,xAxis:S,yAxis:A})),M.createElement(kre,To({},p,{offset:d,verticalPoints:N,xAxis:S,yAxis:A})),M.createElement(Ere,To({},p,{horizontalPoints:O})),M.createElement(Are,To({},p,{verticalPoints:N})))}Cu.displayName="CartesianGrid";var Cre=["type","layout","connectNulls","ref"],jre=["key"];function ll(t){"@babel/helpers - typeof";return ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ll(t)}function kN(t,e){if(t==null)return{};var r=Nre(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Nre(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Bc(){return Bc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Bc.apply(this,arguments)}function EN(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 an(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?EN(Object(r),!0).forEach(function(n){Wn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):EN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Os(t){return $re(t)||Ire(t)||Rre(t)||Pre()}function Pre(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
514
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rre(t,e){if(t){if(typeof t=="string")return xw(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 xw(t,e)}}function Ire(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function $re(t){if(Array.isArray(t))return xw(t)}function xw(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 Mre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AN(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,SM(n.key),n)}}function Dre(t,e,r){return e&&AN(t.prototype,e),r&&AN(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Lre(t,e,r){return e=Zh(e),zre(t,_M()?Reflect.construct(e,r||[],Zh(t).constructor):e.apply(t,r))}function zre(t,e){if(e&&(ll(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bre(t)}function Bre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _M(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_M=function(){return!!t})()}function Zh(t){return Zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Zh(t)}function Ure(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ww(t,e)}function ww(t,e){return ww=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ww(t,e)}function Wn(t,e,r){return e=SM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function SM(t){var e=qre(t,"string");return ll(e)=="symbol"?e:e+""}function qre(t,e){if(ll(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ll(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Ku=(function(t){function e(){var r;Mre(this,e);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return r=Lre(this,e,[].concat(i)),Wn(r,"state",{isAnimationFinished:!0,totalLength:0}),Wn(r,"generateSimpleStrokeDasharray",function(o,c){return"".concat(c,"px ").concat(o-c,"px")}),Wn(r,"getStrokeDasharray",function(o,c,u){var d=u.reduce(function(k,S){return k+S});if(!d)return r.generateSimpleStrokeDasharray(c,o);for(var p=Math.floor(o/d),f=o%d,m=c-o,v=[],b=0,w=0;b<u.length;w+=u[b],++b)if(w+u[b]>f){v=[].concat(Os(u.slice(0,b)),[f-w]);break}var x=v.length%2===0?[0,m]:[m];return[].concat(Os(e.repeat(u,p)),Os(v),x).map(function(k){return"".concat(k,"px")}).join(", ")}),Wn(r,"id",zu("recharts-line-")),Wn(r,"pathRef",function(o){r.mainCurve=o}),Wn(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Wn(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Ure(e,t),Dre(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();this.setState({totalLength:n})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var n=this.getTotalLength();n!==this.state.totalLength&&this.setState({totalLength:n})}}},{key:"getTotalLength",value:function(){var n=this.mainCurve;try{return n&&n.getTotalLength&&n.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(n,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var a=this.props,o=a.points,c=a.xAxis,u=a.yAxis,d=a.layout,p=a.children,f=Tn(p,Wu);if(!f)return null;var m=function(w,x){return{x:w.x,y:w.y,value:w.value,errorVal:dn(w.payload,x)}},v={clipPath:n?"url(#clipPath-".concat(i,")"):null};return M.createElement(Xt,v,f.map(function(b){return M.cloneElement(b,{key:"bar-".concat(b.props.dataKey),data:o,xAxis:c,yAxis:u,layout:d,dataPointFormatter:m})}))}},{key:"renderDots",value:function(n,i,a){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var c=this.props,u=c.dot,d=c.points,p=c.dataKey,f=at(this.props,!1),m=at(u,!0),v=d.map(function(w,x){var k=an(an(an({key:"dot-".concat(x),r:3},f),m),{},{index:x,cx:w.x,cy:w.y,value:w.value,dataKey:p,payload:w.payload,points:d});return e.renderDotItem(u,k)}),b={clipPath:n?"url(#clipPath-".concat(i?"":"dots-").concat(a,")"):null};return M.createElement(Xt,Bc({className:"recharts-line-dots",key:"dots"},b),v)}},{key:"renderCurveStatically",value:function(n,i,a,o){var c=this.props,u=c.type,d=c.layout,p=c.connectNulls;c.ref;var f=kN(c,Cre),m=an(an(an({},at(f,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(a,")"):null,points:n},o),{},{type:u,layout:d,connectNulls:p});return M.createElement(Zx,Bc({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(n,i){var a=this,o=this.props,c=o.points,u=o.strokeDasharray,d=o.isAnimationActive,p=o.animationBegin,f=o.animationDuration,m=o.animationEasing,v=o.animationId,b=o.animateNewValues,w=o.width,x=o.height,k=this.state,S=k.prevPoints,A=k.totalLength;return M.createElement(ea,{begin:p,duration:f,isActive:d,easing:m,from:{t:0},to:{t:1},key:"line-".concat(v),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(C){var T=C.t;if(S){var O=S.length/c.length,N=c.map(function(U,F){var X=Math.floor(F*O);if(S[X]){var Y=S[X],G=Vn(Y.x,U.x),Z=Vn(Y.y,U.y);return an(an({},U),{},{x:G(T),y:Z(T)})}if(b){var W=Vn(w*2,U.x),Q=Vn(x/2,U.y);return an(an({},U),{},{x:W(T),y:Q(T)})}return an(an({},U),{},{x:U.x,y:U.y})});return a.renderCurveStatically(N,n,i)}var R=Vn(0,A),$=R(T),K;if(u){var z="".concat(u).split(/[,\s]+/gim).map(function(U){return parseFloat(U)});K=a.getStrokeDasharray($,A,z)}else K=a.generateSimpleStrokeDasharray(A,$);return a.renderCurveStatically(c,n,i,{strokeDasharray:K})})}},{key:"renderCurve",value:function(n,i){var a=this.props,o=a.points,c=a.isAnimationActive,u=this.state,d=u.prevPoints,p=u.totalLength;return c&&o&&o.length&&(!d&&p>0||!Mp(d,o))?this.renderCurveWithAnimation(n,i):this.renderCurveStatically(o,n,i)}},{key:"render",value:function(){var n,i=this.props,a=i.hide,o=i.dot,c=i.points,u=i.className,d=i.xAxis,p=i.yAxis,f=i.top,m=i.left,v=i.width,b=i.height,w=i.isAnimationActive,x=i.id;if(a||!c||!c.length)return null;var k=this.state.isAnimationFinished,S=c.length===1,A=ot("recharts-line",u),C=d&&d.allowDataOverflow,T=p&&p.allowDataOverflow,O=C||T,N=tt(x)?this.id:x,R=(n=at(o,!1))!==null&&n!==void 0?n:{r:3,strokeWidth:2},$=R.r,K=$===void 0?3:$,z=R.strokeWidth,U=z===void 0?2:z,F=nF(o)?o:{},X=F.clipDot,Y=X===void 0?!0:X,G=K*2+U;return M.createElement(Xt,{className:A},C||T?M.createElement("defs",null,M.createElement("clipPath",{id:"clipPath-".concat(N)},M.createElement("rect",{x:C?m:m-v/2,y:T?f:f-b/2,width:C?v:v*2,height:T?b:b*2})),!Y&&M.createElement("clipPath",{id:"clipPath-dots-".concat(N)},M.createElement("rect",{x:m-G/2,y:f-G/2,width:v+G,height:b+G}))):null,!S&&this.renderCurve(O,N),this.renderErrorBar(O,N),(S||o)&&this.renderDots(O,Y,N),(!w||k)&&za.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(n,i){return n.animationId!==i.prevAnimationId?{prevAnimationId:n.animationId,curPoints:n.points,prevPoints:i.curPoints}:n.points!==i.curPoints?{curPoints:n.points}:null}},{key:"repeat",value:function(n,i){for(var a=n.length%2!==0?[].concat(Os(n),[0]):n,o=[],c=0;c<i;++c)o=[].concat(Os(o),Os(a));return o}},{key:"renderDotItem",value:function(n,i){var a;if(M.isValidElement(n))a=M.cloneElement(n,i);else if(Je(n))a=n(i);else{var o=i.key,c=kN(i,jre),u=ot("recharts-line-dot",typeof n!="boolean"?n.className:"");a=M.createElement(n_,Bc({key:o},c,{className:u}))}return a}}])})(j.PureComponent);Wn(Ku,"displayName","Line");Wn(Ku,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Sl.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Wn(Ku,"getComposedData",function(t){var e=t.props,r=t.xAxis,n=t.yAxis,i=t.xAxisTicks,a=t.yAxisTicks,o=t.dataKey,c=t.bandSize,u=t.displayedData,d=t.offset,p=e.layout,f=u.map(function(m,v){var b=dn(m,o);return p==="horizontal"?{x:Fj({axis:r,ticks:i,bandSize:c,entry:m,index:v}),y:tt(b)?null:n.scale(b),value:b,payload:m}:{x:tt(b)?null:r.scale(b),y:Fj({axis:n,ticks:a,bandSize:c,entry:m,index:v}),value:b,payload:m}});return an({points:f,layout:p},d)});function cl(t){"@babel/helpers - typeof";return cl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cl(t)}function Fre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hre(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,AM(n.key),n)}}function Wre(t,e,r){return e&&Hre(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Kre(t,e,r){return e=Qh(e),Gre(t,kM()?Reflect.construct(e,r||[],Qh(t).constructor):e.apply(t,r))}function Gre(t,e){if(e&&(cl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Vre(t)}function Vre(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kM=function(){return!!t})()}function Qh(t){return Qh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Qh(t)}function Xre(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_w(t,e)}function _w(t,e){return _w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},_w(t,e)}function EM(t,e,r){return e=AM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function AM(t){var e=Yre(t,"string");return cl(e)=="symbol"?e:e+""}function Yre(t,e){if(cl(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(cl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Sw(){return Sw=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Sw.apply(this,arguments)}function Jre(t){var e=t.xAxisId,r=s_(),n=l_(),i=uM(e);return i==null?null:j.createElement(Ol,Sw({},i,{className:ot("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(o){return Ki(o,!0)}}))}var Ua=(function(t){function e(){return Fre(this,e),Kre(this,e,arguments)}return Xre(e,t),Wre(e,[{key:"render",value:function(){return j.createElement(Jre,this.props)}}])})(j.Component);EM(Ua,"displayName","XAxis");EM(Ua,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function ul(t){"@babel/helpers - typeof";return ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ul(t)}function Zre(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qre(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,CM(n.key),n)}}function ene(t,e,r){return e&&Qre(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function tne(t,e,r){return e=ep(e),rne(t,OM()?Reflect.construct(e,r||[],ep(t).constructor):e.apply(t,r))}function rne(t,e){if(e&&(ul(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nne(t)}function nne(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OM=function(){return!!t})()}function ep(t){return ep=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ep(t)}function ine(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&kw(t,e)}function kw(t,e){return kw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},kw(t,e)}function TM(t,e,r){return e=CM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function CM(t){var e=ane(t,"string");return ul(e)=="symbol"?e:e+""}function ane(t,e){if(ul(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ul(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Ew(){return Ew=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Ew.apply(this,arguments)}var one=function(e){var r=e.yAxisId,n=s_(),i=l_(),a=dM(r);return a==null?null:j.createElement(Ol,Ew({},a,{className:ot("recharts-".concat(a.axisType," ").concat(a.axisType),a.className),viewBox:{x:0,y:0,width:n,height:i},ticksGenerator:function(c){return Ki(c,!0)}}))},qa=(function(t){function e(){return Zre(this,e),tne(this,e,arguments)}return ine(e,t),ene(e,[{key:"render",value:function(){return j.createElement(one,this.props)}}])})(j.Component);TM(qa,"displayName","YAxis");TM(qa,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function ON(t){return une(t)||cne(t)||lne(t)||sne()}function sne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
515
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lne(t,e){if(t){if(typeof t=="string")return Aw(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 Aw(t,e)}}function cne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function une(t){if(Array.isArray(t))return Aw(t)}function Aw(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}var Ow=function(e,r,n,i,a){var o=Tn(e,u_),c=Tn(e,Fp),u=[].concat(ON(o),ON(c)),d=Tn(e,Wp),p="".concat(i,"Id"),f=i[0],m=r;if(u.length&&(m=u.reduce(function(w,x){if(x.props[p]===n&&Si(x.props,"extendDomain")&&ge(x.props[f])){var k=x.props[f];return[Math.min(w[0],k),Math.max(w[1],k)]}return w},m)),d.length){var v="".concat(f,"1"),b="".concat(f,"2");m=d.reduce(function(w,x){if(x.props[p]===n&&Si(x.props,"extendDomain")&&ge(x.props[v])&&ge(x.props[b])){var k=x.props[v],S=x.props[b];return[Math.min(w[0],k,S),Math.max(w[1],k,S)]}return w},m)}return a&&a.length&&(m=a.reduce(function(w,x){return ge(x)?[Math.min(w[0],x),Math.max(w[1],x)]:w},m)),m},Ub={exports:{}},TN;function dne(){return TN||(TN=1,(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(u,d,p){this.fn=u,this.context=d,this.once=p||!1}function a(u,d,p,f,m){if(typeof p!="function")throw new TypeError("The listener must be a function");var v=new i(p,f||u,m),b=r?r+d:d;return u._events[b]?u._events[b].fn?u._events[b]=[u._events[b],v]:u._events[b].push(v):(u._events[b]=v,u._eventsCount++),u}function o(u,d){--u._eventsCount===0?u._events=new n:delete u._events[d]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var d=[],p,f;if(this._eventsCount===0)return d;for(f in p=this._events)e.call(p,f)&&d.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(p)):d},c.prototype.listeners=function(d){var p=r?r+d:d,f=this._events[p];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,v=f.length,b=new Array(v);m<v;m++)b[m]=f[m].fn;return b},c.prototype.listenerCount=function(d){var p=r?r+d:d,f=this._events[p];return f?f.fn?1:f.length:0},c.prototype.emit=function(d,p,f,m,v,b){var w=r?r+d:d;if(!this._events[w])return!1;var x=this._events[w],k=arguments.length,S,A;if(x.fn){switch(x.once&&this.removeListener(d,x.fn,void 0,!0),k){case 1:return x.fn.call(x.context),!0;case 2:return x.fn.call(x.context,p),!0;case 3:return x.fn.call(x.context,p,f),!0;case 4:return x.fn.call(x.context,p,f,m),!0;case 5:return x.fn.call(x.context,p,f,m,v),!0;case 6:return x.fn.call(x.context,p,f,m,v,b),!0}for(A=1,S=new Array(k-1);A<k;A++)S[A-1]=arguments[A];x.fn.apply(x.context,S)}else{var C=x.length,T;for(A=0;A<C;A++)switch(x[A].once&&this.removeListener(d,x[A].fn,void 0,!0),k){case 1:x[A].fn.call(x[A].context);break;case 2:x[A].fn.call(x[A].context,p);break;case 3:x[A].fn.call(x[A].context,p,f);break;case 4:x[A].fn.call(x[A].context,p,f,m);break;default:if(!S)for(T=1,S=new Array(k-1);T<k;T++)S[T-1]=arguments[T];x[A].fn.apply(x[A].context,S)}}return!0},c.prototype.on=function(d,p,f){return a(this,d,p,f,!1)},c.prototype.once=function(d,p,f){return a(this,d,p,f,!0)},c.prototype.removeListener=function(d,p,f,m){var v=r?r+d:d;if(!this._events[v])return this;if(!p)return o(this,v),this;var b=this._events[v];if(b.fn)b.fn===p&&(!m||b.once)&&(!f||b.context===f)&&o(this,v);else{for(var w=0,x=[],k=b.length;w<k;w++)(b[w].fn!==p||m&&!b[w].once||f&&b[w].context!==f)&&x.push(b[w]);x.length?this._events[v]=x.length===1?x[0]:x:o(this,v)}return this},c.prototype.removeAllListeners=function(d){var p;return d?(p=r?r+d:d,this._events[p]&&o(this,p)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t.exports=c})(Ub)),Ub.exports}var fne=dne();const hne=vt(fne);var qb=new hne,Fb="recharts.syncMouseEvents";function ju(t){"@babel/helpers - typeof";return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ju(t)}function pne(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,jM(n.key),n)}}function gne(t,e,r){return e&&mne(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Hb(t,e,r){return e=jM(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jM(t){var e=yne(t,"string");return ju(e)=="symbol"?e:e+""}function yne(t,e){if(ju(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(ju(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var vne=(function(){function t(){pne(this,t),Hb(this,"activeIndex",0),Hb(this,"coordinateList",[]),Hb(this,"layout","horizontal")}return gne(t,[{key:"setDetails",value:function(r){var n,i=r.coordinateList,a=i===void 0?null:i,o=r.container,c=o===void 0?null:o,u=r.layout,d=u===void 0?null:u,p=r.offset,f=p===void 0?null:p,m=r.mouseHandlerCallback,v=m===void 0?null:m;this.coordinateList=(n=a??this.coordinateList)!==null&&n!==void 0?n:[],this.container=c??this.container,this.layout=d??this.layout,this.offset=f??this.offset,this.mouseHandlerCallback=v??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(r){if(this.coordinateList.length!==0)switch(r.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(r){this.activeIndex=r}},{key:"spoofMouse",value:function(){var r,n;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var i=this.container.getBoundingClientRect(),a=i.x,o=i.y,c=i.height,u=this.coordinateList[this.activeIndex].coordinate,d=((r=window)===null||r===void 0?void 0:r.scrollX)||0,p=((n=window)===null||n===void 0?void 0:n.scrollY)||0,f=a+u+d,m=o+this.offset.top+c/2+p;this.mouseHandlerCallback({pageX:f,pageY:m})}}}])})();function bne(t,e,r){if(r==="number"&&e===!0&&Array.isArray(t)){var n=t==null?void 0:t[0],i=t==null?void 0:t[1];if(n&&i&&ge(n)&&ge(i))return!0}return!1}function xne(t,e,r,n){var i=n/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:r.left+.5,y:t==="horizontal"?r.top+.5:e.y-i,width:t==="horizontal"?n:r.width-1,height:t==="horizontal"?r.height-1:n}}function NM(t){var e=t.cx,r=t.cy,n=t.radius,i=t.startAngle,a=t.endAngle,o=wr(e,r,n,i),c=wr(e,r,n,a);return{points:[o,c],cx:e,cy:r,radius:n,startAngle:i,endAngle:a}}function wne(t,e,r){var n,i,a,o;if(t==="horizontal")n=e.x,a=n,i=r.top,o=r.top+r.height;else if(t==="vertical")i=e.y,o=i,n=r.left,a=r.left+r.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var c=e.cx,u=e.cy,d=e.innerRadius,p=e.outerRadius,f=e.angle,m=wr(c,u,d,f),v=wr(c,u,p,f);n=m.x,i=m.y,a=v.x,o=v.y}else return NM(e);return[{x:n,y:i},{x:a,y:o}]}function Nu(t){"@babel/helpers - typeof";return Nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nu(t)}function CN(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 Cf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?CN(Object(r),!0).forEach(function(n){_ne(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CN(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function _ne(t,e,r){return e=Sne(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sne(t){var e=kne(t,"string");return Nu(e)=="symbol"?e:e+""}function kne(t,e){if(Nu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Nu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ene(t){var e,r,n=t.element,i=t.tooltipEventType,a=t.isActive,o=t.activeCoordinate,c=t.activePayload,u=t.offset,d=t.activeTooltipIndex,p=t.tooltipAxisBandSize,f=t.layout,m=t.chartName,v=(e=n.props.cursor)!==null&&e!==void 0?e:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!v||!a||!o||m!=="ScatterChart"&&i!=="axis")return null;var b,w=Zx;if(m==="ScatterChart")b=o,w=SQ;else if(m==="BarChart")b=xne(f,o,u,p),w=r_;else if(f==="radial"){var x=NM(o),k=x.cx,S=x.cy,A=x.radius,C=x.startAngle,T=x.endAngle;b={cx:k,cy:S,startAngle:C,endAngle:T,innerRadius:A,outerRadius:A},w=z$}else b={points:wne(f,o,u)},w=Zx;var O=Cf(Cf(Cf(Cf({stroke:"#ccc",pointerEvents:"none"},u),b),at(v,!1)),{},{payload:c,payloadIndex:d,className:ot("recharts-tooltip-cursor",v.className)});return j.isValidElement(v)?j.cloneElement(v,O):j.createElement(w,O)}var Ane=["item"],One=["children","className","width","height","style","compact","title","desc"];function dl(t){"@babel/helpers - typeof";return dl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dl(t)}function $s(){return $s=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},$s.apply(this,arguments)}function jN(t,e){return jne(t)||Cne(t,e)||RM(t,e)||Tne()}function Tne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
516
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cne(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,a,o,c=[],u=!0,d=!1;try{if(a=(r=r.call(t)).next,e!==0)for(;!(u=(n=a.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(p){d=!0,i=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw i}}return c}}function jne(t){if(Array.isArray(t))return t}function NN(t,e){if(t==null)return{};var r=Nne(t,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Nne(t,e){if(t==null)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}function Pne(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Rne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,IM(n.key),n)}}function Ine(t,e,r){return e&&Rne(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function $ne(t,e,r){return e=tp(e),Mne(t,PM()?Reflect.construct(e,r||[],tp(t).constructor):e.apply(t,r))}function Mne(t,e){if(e&&(dl(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Dne(t)}function Dne(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PM(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PM=function(){return!!t})()}function tp(t){return tp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},tp(t)}function Lne(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tw(t,e)}function Tw(t,e){return Tw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Tw(t,e)}function fl(t){return Une(t)||Bne(t)||RM(t)||zne()}function zne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
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 Bne(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Une(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=qne(t,"string");return dl(e)=="symbol"?e:e+""}function qne(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 Fne={xAxis:["bottom","top"],yAxis:["left","right"]},Hne={width:"100%",height:"100%"},$M={x:0,y:0};function jf(t){return t}var Wne=function(e,r){return r==="horizontal"?e.x:r==="vertical"?e.y:r==="centric"?e.angle:e.radius},Kne=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=Wne(a,n),c=e.orderedTooltipTicks,u=e.tooltipAxis,d=e.tooltipTicks,p=rY(o,c,d,u);if(p>=0&&d){var f=d[p]&&d[p].value,m=jw(e,r,p,f),v=Kne(n,c,p,a);return{activeTooltipIndex:p,activeLabel:f,activePayload:m,activeCoordinate:v}}return null},Gne=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 ee,le=o in q.props?q.props[o]:(ee=q.type.defaultProps)===null||ee===void 0?void 0:ee[o];return le===$}),dataStartIndex:u,dataEndIndex:d}),z=K.length,U,F,X;bne(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=G9(U);T&&W?(F=U,U=qh(0,z)):T||(U=Gj(Z,U,w).reduce(function(q,ee){return q.indexOf(ee)>=0?q:[].concat(fl(q),[ee])},[]))}else if(S==="category")T?U=U.filter(function(q){return q!==""&&!tt(q)}):U=Gj(Z,U,w).reduce(function(q,ee){return q.indexOf(ee)>=0||ee===""||tt(ee)?q:[].concat(fl(q),[ee])},[]);else if(S==="number"){var Q=sY(K,i.filter(function(q){var ee,le,fe=o in q.props?q.props[o]:(ee=q.type.defaultProps)===null||ee===void 0?void 0:ee[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 ee=o in q.props?q.props[o]:q.type.defaultProps[o],le="hide"in q.props?q.props.hide:q.type.defaultProps.hide;return ee===$&&(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})))},{})},Vne=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(Fne,"".concat(a,".").concat(w%2),null),domain:T,originalDomain:C,isCategorical:b,layout:p})))}return x},{})},Xne=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=Gne(e,{axes:m,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d}):o&&o.length&&(v=Vne(e,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:u,dataEndIndex:d})),v},Yne=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}},Jne=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"}},Zne=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=aY(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)})},Qne=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=Jne(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,ee=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&&bY(Q,C[fe].stackGroups),oe=Gi(Q.type).indexOf("Bar")>=0,rt=Ph(ae,Se),Fe=[],kt=Z&&nY({barSize:$,stackGroups:C,totalSize:Qne(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=iY({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:ee,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:oF(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=gY(K,Y,"".concat(F,"Id"),"".concat(X,"Id"),$,z),Z=u.reduce(function(q,ee){var le="".concat(ee.axisType,"Map");return ie(ie({},q),{},ze({},le,Xne(A,ie(ie({},ee),{},{graphicalItems:Y,stackGroups:ee.axisType===F&&G,dataStartIndex:C,dataEndIndex:T}))))},{}),W=Zne(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=Yne(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 Pne(this,k),T=$ne(this,k,[S]),ze(T,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ze(T,"accessibilityManager",new vne),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=aF(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),ee=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:ee,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(Ene,{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,Ane);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,ee=q.activeDot,le=q.hide,fe=q.activeBar,ve=q.activeShape,qe=!!(!le&&U&&Z&&(ee||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 Lne(k,x),Ine(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=KW(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 hQ(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=nee({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,One),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:Hne}),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,ee=I&&(Q=(L=I.props)===null||L===void 0?void 0:L.endIndex)!==null&&Q!==void 0?Q:z,le=q!==K||ee!==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:ee}),k)),{},{prevChildren:C,dataStartIndex:q,dataEndIndex:ee})}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},eie=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 tie={summary:"Summary","by squad":"By Squad","by agent":"By Agent",io:"IO",timeline:"Timeline"};function rie({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:tie[n]??n},n))})}function nie({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 iie({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 aie({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 oie({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 sie({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(eie,{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 lie(){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(rie,{tabs:o,active:t,onChange:u=>e(u)}),t==="summary"&&y.jsx(nie,{records:r.records,totals:r.totals}),t==="by squad"&&y.jsx(iie,{records:r.records}),t==="by agent"&&y.jsx(aie,{records:r.records}),t==="io"&&y.jsx(oie,{records:r.records}),t==="timeline"&&y.jsx(sie,{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 cie(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 uie(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 die(){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(()=>cie(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 uie(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 ee=L(q.children);if(ee)return ee}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.title||I.path.split("/").pop()||I.path,path:I.path,title:I.title,isDir:I.isDir})))}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
|
-
`,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
|
|
520
|
-
//# sourceMappingURL=index-
|
|
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 fie({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(Dq,{}):y.jsx(y.Fragment,{children:t})}function hie(){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(Rq,{}),children:[y.jsx(Yr,{index:!0,element:y.jsx(Iq,{})}),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(Mq,{})}),y.jsx(Yr,{path:"skills",element:y.jsx(Yq,{})}),y.jsx(Yr,{path:"schedules",element:y.jsx(Bq,{})}),y.jsx(Yr,{path:"wiki",element:y.jsx(die,{})}),y.jsx(Yr,{path:"settings",element:y.jsx(Hq,{})}),y.jsx(Yr,{path:"usage",element:y.jsx(lie,{})}),y.jsx(Yr,{path:"*",element:y.jsx(OL,{to:"/",replace:!0})})]})}),!e&&y.jsx($B,{})]})}function pie(){return y.jsx(zU,{children:y.jsx(fie,{children:y.jsx(Z4,{children:y.jsx(IB,{children:y.jsx(hie,{})})})})})}OD.createRoot(document.getElementById("root")).render(y.jsx(j.StrictMode,{children:y.jsxs(e5,{children:[y.jsx(pie,{}),y.jsx(D5,{theme:"dark",position:"bottom-right"})]})}));
|
|
520
|
+
//# sourceMappingURL=index-C6WVcVgK.js.map
|