react-semaphor 0.0.690 → 0.0.692

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.
@@ -1,4 +1,4 @@
1
- "use strict";const e=require("react/jsx-runtime"),s=require("./index-W0Unjlcm.js"),I=require("react"),ia=require("react-dom");function ca(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const js=ca(I);/**
1
+ "use strict";const e=require("react/jsx-runtime"),s=require("./index-BtGrr_Zj.js"),I=require("react"),ia=require("react-dom");function ca(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const js=ca(I);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -294,7 +294,7 @@ ${y.joinType} JOIN ${O.name}
294
294
  ON ${F}`}),N},isValidConfiguration:()=>!(!a.baseEntity.name||a.joins.some(y=>!y.source.name||!y.target.name)||a.joins.some(y=>y.joinKeyGroups.some(O=>O.keys.length===0))||a.joins.some(y=>y.joinKeyGroups.some(O=>O.keys.some(w=>!w.source.name||!w.target.name||!w.operator))))}}function Zn({joinPlan:t,availableDataSources:n,onSave:a,onRemove:r,onCancel:l}){const{setCardConfig:o}=s.useEditorActions();s.useEditorStore(w=>w.card.config);const{columnGroups:i}=s.useColumns(),{joinPlan:c,expandedJoins:d,setJoinPlan:u,addJoin:m,removeJoin:h,updateJoin:x,moveJoinUp:g,moveJoinDown:b,toggleJoinExpansion:p,getAvailableSourceEntities:v,getAvailableTargetEntities:j,addJoinKeyGroup:S,updateGroupOperator:M,removeJoinKeyGroup:E,addJoinKey:C,updateJoinKey:D,removeJoinKey:f,generateSQLPreview:N,isValidConfiguration:y}=Xn({initialJoinPlan:t,availableDataSources:n}),O=w=>{const F=i.find(k=>k.entityName===w);return(F==null?void 0:F.columns)||[]};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{children:"Base Entity (FROM clause)"}),e.jsxs(s.Select,{value:c.baseEntity.name,onValueChange:w=>{const F=n.find(k=>k.name===w);u({...c,baseEntity:{connectionId:(F==null?void 0:F.connectionId)||"",connectionType:(F==null?void 0:F.connectionType)||"none",type:(F==null?void 0:F.type)||"table",name:w,database:F==null?void 0:F.database,schema:F==null?void 0:F.schema}})},children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Select base entity..."})}),e.jsx(s.SelectContent,{children:n.map(w=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:w.name,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:w.type}),w.name,e.jsx(s.Badge,{variant:"outline",className:"text-xs text-green-600",children:"BASE"})]})},w.name))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This entity will be used as the base table in the FROM clause of the SQL query."})]}),e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsx("div",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Join SQL Preview"}),e.jsx("code",{className:"block whitespace-pre-wrap break-all text-xs",children:N()})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(s.Label,{children:["Joins Configuration (",c.joins.length,")"]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(s.Button,{variant:"outline",size:"sm",onClick:m,children:[e.jsx(s.Plus,{className:"mr-1 h-4 w-4"}),"Add Join"]})})]}),c.joins.length===0?e.jsx("div",{className:"rounded-lg border border-dashed py-8 text-center text-muted-foreground",children:e.jsx("p",{children:"No joins configured. Add a join to connect multiple data sources."})}):e.jsx("div",{className:"max-h-[300px] space-y-4 overflow-y-auto",children:c.joins.map(w=>{const F=n.find(A=>A.name===w.source.name),k=n.find(A=>A.name===w.target.name),T=d.has(w.id);return e.jsxs(s.Card,{className:"border",children:[e.jsx(s.CardHeader,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Badge,{children:w.sequence}),e.jsxs(s.CardTitle,{className:"text-sm",children:["Join ",w.sequence,F&&k&&e.jsxs("span",{className:"ml-2 font-normal text-gray-600",children:["(",F.name," → ",k.name,")"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>g(w.id),disabled:w.sequence===1,children:e.jsx(s.ArrowUp,{className:"h-4 w-4"})}),e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>b(w.id),disabled:w.sequence===c.joins.length,children:e.jsx(s.ArrowDown,{className:"h-4 w-4"})}),e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>p(w.id),children:T?e.jsx(s.ChevronUp,{className:"h-4 w-4"}):e.jsx(s.ChevronDown,{className:"h-4 w-4"})}),e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>h(w.id),children:e.jsx(s.X,{className:"h-4 w-4"})})]})]})}),T&&e.jsxs(s.CardContent,{className:"space-y-4 pb-6",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{children:"Source"}),e.jsxs(s.Select,{value:w.source.name,onValueChange:A=>{const R=n.find(L=>L.name===A);x(w.id,{source:{connectionId:(R==null?void 0:R.connectionId)||"",connectionType:(R==null?void 0:R.connectionType)||"none",type:(R==null?void 0:R.type)||"table",name:A,database:R==null?void 0:R.database,schema:R==null?void 0:R.schema}})},children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Select source..."})}),e.jsx(s.SelectContent,{children:v(w.id).map(A=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:A.name,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:A.type}),A.name]})},A.name))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{children:"Join Type"}),e.jsxs(s.Select,{value:w.joinType,onValueChange:A=>x(w.id,{joinType:A}),children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{})}),e.jsxs(s.SelectContent,{children:[e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"INNER",children:"INNER JOIN"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"LEFT",children:"LEFT JOIN"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"RIGHT",children:"RIGHT JOIN"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"FULL",children:"FULL JOIN"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{children:"Target"}),e.jsxs(s.Select,{value:w.target.name,onValueChange:A=>{const R=n.find(L=>L.name===A);x(w.id,{target:{connectionId:(R==null?void 0:R.connectionId)||"",connectionType:(R==null?void 0:R.connectionType)||"none",type:(R==null?void 0:R.type)||"table",name:A,database:R==null?void 0:R.database,schema:R==null?void 0:R.schema}})},disabled:!w.source.name,children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Select target..."})}),e.jsx(s.SelectContent,{children:w.source.name?j(w.source.name).map(A=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:A.name,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:A.type}),A.name,A.name===w.source.name&&e.jsx(s.Badge,{variant:"outline",className:"text-xs text-yellow-600",children:"(Self-join)"})]})},A.name)):[]})]})]})]}),w.source.name&&w.target.name&&F&&k&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(s.Label,{children:"Join Conditions"}),e.jsxs(s.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>S(w.id),children:[e.jsx(s.Plus,{className:"mr-1 h-3 w-3"})," Add Condition Group"]})]}),w.joinKeyGroups.length===0?e.jsx("div",{className:"rounded-md border p-3 text-center text-sm text-gray-500",children:"No join conditions defined. Add condition groups to specify how data sources should be joined."}):e.jsx("div",{className:"space-y-4",children:w.joinKeyGroups.map((A,R)=>e.jsxs("div",{className:"space-y-3 rounded-md border p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(s.Label,{children:["Group ",R+1]}),R>0&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-gray-100 px-2 py-1",children:[e.jsx(s.Label,{className:"text-xs font-normal",children:"Join with:"}),e.jsx("span",{className:"text-sm font-medium",children:"OR"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(s.Select,{value:A.operator,onValueChange:L=>M(w.id,R,L),children:[e.jsx(s.SelectTrigger,{className:"w-[100px]",children:e.jsx(s.SelectValue,{})}),e.jsxs(s.SelectContent,{children:[e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"AND",children:"AND"}),e.jsx(s.SelectItem,{value:"OR",children:"OR"})]})]}),e.jsx(s.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(w.id,R),children:e.jsx(s.Trash2,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"space-y-2",children:[A.keys.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-center text-sm text-gray-500",children:"No conditions in this group. Add conditions to specify join criteria."}):e.jsx("div",{className:"space-y-2",children:A.keys.map((L,B)=>e.jsxs("div",{className:"flex flex-col items-start gap-2 rounded-md border p-2 sm:flex-row sm:items-center",children:[B>0&&e.jsx("div",{className:"self-center rounded-md bg-gray-100 px-2 py-1 text-xs font-medium",children:A.operator}),e.jsx("div",{className:"mb-2 w-full sm:mb-0 sm:flex-1",children:e.jsxs(s.Select,{value:L.source.name,onValueChange:P=>D(w.id,R,B,"sourceColumnName",P),children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Source column"})}),e.jsx(s.SelectContent,{children:O(w.source.name).map(P=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:P.name,children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("span",{children:P.name}),e.jsx(s.Badge,{variant:"outline",className:"ml-2 text-xs",children:P.dataType})]})},P.name))})]})}),e.jsx("div",{className:"mb-2 w-full sm:mb-0 sm:w-20",children:e.jsxs(s.Select,{value:L.operator,onValueChange:P=>D(w.id,R,B,"operator",P),children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{})}),e.jsxs(s.SelectContent,{children:[e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"=",children:"="}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"<",children:"<"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:">",children:">"}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:"<=",children:"<="}),e.jsx(s.SelectItem,{className:"hover:bg-muted",value:">=",children:">="})]})]})}),e.jsx("div",{className:"mb-2 w-full sm:mb-0 sm:flex-1",children:e.jsxs(s.Select,{value:L.target.name,onValueChange:P=>D(w.id,R,B,"targetColumnName",P),children:[e.jsx(s.SelectTrigger,{children:e.jsx(s.SelectValue,{placeholder:"Target column"})}),e.jsx(s.SelectContent,{children:O(w.target.name).map(P=>e.jsx(s.SelectItem,{className:"hover:bg-muted",value:P.name,children:e.jsxs("div",{className:"flex w-full items-center justify-between hover:bg-muted",children:[e.jsx("span",{children:P.name}),e.jsx(s.Badge,{variant:"outline",className:"ml-2 text-xs",children:P.dataType})]})},P.name))})]})}),e.jsx(s.Button,{type:"button",variant:"ghost",size:"sm",className:"self-center",onClick:()=>f(w.id,R,B),children:e.jsx(s.X,{className:"size-3.5"})})]},L.id||B))}),e.jsxs(s.Button,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>C(w.id,R),children:[e.jsx(s.Plus,{className:"mr-1 h-3 w-3"})," Add Condition"]})]})]},A.id))})]})]})]},w.id)})})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[e.jsx(s.Button,{variant:"outline",onClick:()=>{r(),l()},children:"Remove All"}),e.jsx(s.Button,{variant:"outline",onClick:l,children:"Cancel"}),e.jsx(s.Button,{onClick:()=>a(c),disabled:!y(),children:"Save"})]})]})}function Gs({children:t,open:n,onOpenChange:a,joinPlan:r,availableDataSources:l,onRemove:o,onSave:i,onCancel:c}){return e.jsxs(s.Dialog,{open:n,onOpenChange:a,children:[e.jsxs(s.DialogContent,{className:"max-w-4xl",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Join Configuration"}),e.jsx(s.DialogDescription,{children:"Configure the join between the two entities to combine the fields."})]}),e.jsx(Zn,{joinPlan:r,availableDataSources:l,onSave:i,onCancel:c,onRemove:o})]}),t]})}function er({joins:t,baseEntityId:n,availableDataSources:a,generateSQLPreview:r}){return e.jsxs("div",{className:"divide-y divide-border",children:[t.length>0&&e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"mb-3 text-left font-semibold",children:"Join Chain"}),e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:(()=>{const l=[...t].sort((i,c)=>i.sequence-c.sequence),o=a.find(i=>i.name===n);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1 rounded-md border bg-muted px-2 py-1",children:[e.jsx(s.Badge,{variant:"secondary",className:"text-xs",children:o==null?void 0:o.type}),e.jsx("span",{className:"text-xs font-medium",children:o==null?void 0:o.name}),e.jsx(s.Badge,{variant:"outline",className:"text-xs text-green-600",children:"BASE"})]}),l.map(i=>{const c=a.find(d=>d.name===i.target.name);return e.jsxs("div",{className:"flex items-center",children:[e.jsxs("div",{className:"mx-1 flex items-center gap-1",children:[e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:i.joinType}),e.jsx("span",{className:"text-muted-foreground",children:"→"})]}),e.jsxs("div",{className:"flex items-center gap-1 rounded-md border bg-muted px-2 py-1",children:[e.jsx(s.Badge,{variant:"secondary",className:"text-xs",children:c==null?void 0:c.type}),e.jsx("span",{className:"text-xs font-medium",children:c==null?void 0:c.name})]})]},i.id)})]})})()})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("h3",{className:"mb-3 text-left text-sm font-medium",children:["Configured Joins (",t.length,")"]}),e.jsx("div",{className:"space-y-2",children:[...t].sort((l,o)=>l.sequence-o.sequence).map((l,o)=>{const i=a.find(d=>d.name===l.source.name),c=a.find(d=>d.name===l.target.name);return e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted p-2 text-left",children:[e.jsx(s.Badge,{variant:"secondary",className:"shrink-0 text-xs",children:o+1}),e.jsx(s.Badge,{variant:"outline",className:"shrink-0 text-xs",children:l.joinType}),e.jsxs("span",{className:"text-xs font-medium",children:[i==null?void 0:i.name," → ",c==null?void 0:c.name]}),e.jsxs(s.Badge,{variant:"outline",className:"ml-auto text-xs",children:[l.joinKeyGroups.reduce((d,u)=>d+u.keys.length,0)," ","condition",l.joinKeyGroups.reduce((d,u)=>d+u.keys.length,0)>1?"s":""]})]},l.id)})})]}),e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"mb-3 text-left text-sm font-medium",children:"SQL Query"}),e.jsx("div",{className:"overflow-x-auto rounded-md border bg-muted p-3",children:e.jsx("pre",{className:"whitespace-pre-wrap break-all text-left font-mono text-xs text-muted-foreground",children:r()})})]})]})}function sr(){var m,h;const t=s.useEditorStore(x=>x.card),n=s.useEditorStore(x=>x.actions.updateCardConfig),a=((m=t==null?void 0:t.config)==null?void 0:m.joinPlan)||{baseEntity:{type:"table",name:"",database:"",schema:"",connectionId:"",connectionType:"none",dialect:"none"},joins:[]},[r,l]=I.useState(!1),o=((h=t==null?void 0:t.dataSource)==null?void 0:h.selectedEntities)||[],i=x=>{n(t.id,{...t==null?void 0:t.config,joinPlan:x}),l(!1)},c=()=>{n(t.id,{...t==null?void 0:t.config,joinPlan:void 0})},d=()=>{l(!1)},u=()=>{const x=[...a.joins].sort((p,v)=>p.sequence-v.sequence),g=a.baseEntity;if(!g.name)return"SELECT * FROM table -- Please select a base entity";let b=`SELECT *
295
295
  FROM ${g.name}`;return x.forEach(p=>{const v=o.find(M=>M.name===p.target.name);if(!v)return;const j=p.joinKeyGroups.filter(M=>M.keys&&M.keys.length>0).map(M=>{const E=M.keys.filter(C=>{var D,f,N,y;return((D=C.source)==null?void 0:D.name)&&((f=C.target)==null?void 0:f.name)&&((N=C.source)==null?void 0:N.entityName)&&((y=C.target)==null?void 0:y.entityName)}).map(C=>`${C.source.entityName}.${C.source.name} ${C.operator} ${C.target.entityName}.${C.target.name}`);return E.length>1?`(${E.join(` ${M.operator} `)})`:E[0]}).filter(Boolean),S=j.length>1?j.join(" OR "):j[0]||"condition_here";b+=`
296
296
  ${p.joinType} JOIN ${v.name}
297
- ON ${S}`}),b};return o.length<2?null:e.jsx(e.Fragment,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[a.joins.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-6 text-xs font-semibold",onClick:()=>l(!0),children:[e.jsx(s.Link,{className:s.cn("mr-1 h-3 w-3",{"text-blue-500":a.joins.length>0,"text-gray-500":a.joins.length===0})}),"Join",a.joins.length>1?"s":""," (",a.joins.length,")"]})}),e.jsx(s.TooltipContent,{side:"right",className:"max-w-md overflow-hidden p-0",children:e.jsx(er,{joins:a.joins,baseEntityId:a.baseEntity.name,availableDataSources:o,generateSQLPreview:u})})]})}),e.jsx(Gs,{open:r,onOpenChange:l,joinPlan:a,availableDataSources:o,onSave:i,onCancel:d,onRemove:c,children:e.jsx("div",{})})]}),a.joins.length===0&&e.jsx(Gs,{open:r,onOpenChange:l,joinPlan:a,availableDataSources:o,onSave:i,onCancel:d,onRemove:c,children:e.jsxs(s.Button,{onClick:()=>l(!0),variant:"outline",size:"sm",className:"w-full",children:[e.jsx(s.Link,{className:"mr-3 size-4"}),"Configure Joins"]})})]})})})}function tr({open:t,onOpenChange:n}){const[a,r]=I.useState([]),{updateDataSource:l}=s.useEditorActions(),o=s.useDashboardStore(p=>p.dashboard.aiContext),i=(o==null?void 0:o.selectedEntities)||[];I.useEffect(()=>{t&&r([])},[t]);const c=p=>{r(v=>v.some(S=>S.name===p.name&&S.type===p.type)?v.filter(S=>!(S.name===p.name&&S.type===p.type)):[...v,p])},d=()=>{r([...i])},u=()=>{r([])},m=()=>{if(a.length===0)return;const p=a[0],v=p.connectionId||"",j=p.connectionType||"",M=a.some(C=>C.type==="dataset")?"semanticDomain":"database";l({connectionId:v,connectionType:j,mode:M,selectedEntities:a}),n(!1)},h=p=>{switch(p.type){case"table":return e.jsx(s.Table,{className:"h-4 w-4"});case"view":return e.jsx(Wa,{className:"h-4 w-4"});case"model":return e.jsx(ya,{className:"h-4 w-4"});case"dataset":return e.jsx(s.Database,{className:"h-4 w-4"});case"file":case"url":case"upload":return e.jsx(s.FileText,{className:"h-4 w-4"});default:return e.jsx(s.Database,{className:"h-4 w-4"})}},x=p=>"label"in p&&p.label?p.label:p.name,g=p=>{if("description"in p&&p.description)return p.description;const v=[];return p.database&&v.push(p.database),p.schema&&v.push(p.schema),p.name&&v.push(p.name),v.join(".")},b=p=>a.some(v=>v.name===p.name&&v.type===p.type);return i.length===0?e.jsx(s.Dialog,{open:t,onOpenChange:n,children:e.jsxs(s.DialogContent,{className:"max-w-md",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"No Data Available"}),e.jsx(s.DialogDescription,{children:"No entities are currently available in the AI context. Please add some data sources to the dashboard first."})]}),e.jsx(s.DialogFooter,{children:e.jsx(s.Button,{onClick:()=>n(!1),children:"Close"})})]})}):e.jsx(s.Dialog,{open:t,onOpenChange:n,children:e.jsxs(s.DialogContent,{className:"flex max-w-2xl flex-col",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Select Data to Analyze"}),e.jsx(s.DialogDescription,{children:"Choose entities from the dashboard's context"})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{variant:"outline",size:"sm",onClick:d,disabled:a.length===i.length,children:"Select All"}),e.jsx(s.Button,{variant:"outline",size:"sm",onClick:u,disabled:a.length===0,children:"Clear All"})]}),e.jsxs(s.Badge,{variant:"secondary",children:[a.length," of ",i.length," selected"]})]}),e.jsx(s.Separator,{}),e.jsx(s.ScrollArea,{className:"h-64",children:e.jsx("div",{className:"space-y-2",children:i.map((p,v)=>e.jsxs("div",{className:s.cn("flex items-center gap-3 rounded-lg border p-3 transition-colors hover:bg-muted/50",b(p)&&"border-primary bg-primary/5"),children:[e.jsx(s.Checkbox,{checked:b(p),onCheckedChange:()=>c(p)}),e.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:h(p)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:x(p)}),e.jsx("div",{className:"truncate text-sm text-muted-foreground",children:g(p)})]}),e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:p.type})]},`${p.type}-${p.name}-${v}`))})})]}),e.jsx(s.DialogFooter,{children:e.jsx("div",{className:"flex w-full justify-between",children:e.jsxs("div",{className:"flex grow justify-end gap-2",children:[e.jsx(s.Button,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),e.jsxs(s.Button,{onClick:m,disabled:a.length===0,children:["Select"," ",a.length>0?`(${a.length})`:""]})]})})})]})})}function ar({entity:t,title:n,maxDetails:a=10}){const l=s.getEntityDetails(t).slice(0,a),o=l.find(c=>c.label==="Description"),i=l.filter(c=>c.label==="Description"?!1:!["Connection","Database","Schema"].includes(c.label));return e.jsx(s.TooltipContent,{side:"top",className:"ml-5 max-w-xs",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:n||s.getDisplayName(t)}),o&&e.jsxs("div",{className:"border-t border-border pt-2",children:[e.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"Description:"}),e.jsx("div",{className:"text-xs leading-relaxed",children:o.value})]}),i.length>0&&e.jsx("div",{className:"space-y-0.5",children:i.map((c,d)=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{className:"mr-2 text-muted-foreground",children:[c.label,":"]}),e.jsx("span",{className:"font-mono",children:c.value})]},d))})]})})}function nr({entities:t}){return e.jsx(s.TooltipContent,{side:"top",className:"ml-5 max-w-xs",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:[t.length," more entities"]}),e.jsx("div",{className:"space-y-1",children:t.map((n,a)=>{const r=s.getEntityDetails(n),l=r.find(i=>i.label==="Description"),o=r.filter(i=>i.label==="Description"?!1:!["Connection","Database","Schema"].includes(i.label)).slice(0,3);return e.jsxs("div",{className:"border-b border-border pb-1 last:border-b-0",children:[e.jsx("div",{className:"text-xs font-medium",children:s.getDisplayName(n)}),l&&e.jsxs("div",{className:"mb-1 mt-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Description:"}),e.jsx("div",{className:"text-xs leading-relaxed",children:l.value})]}),o.length>0&&e.jsx("div",{className:"mt-1 space-y-0.5",children:o.map((i,c)=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{className:"mr-2 text-muted-foreground",children:[i.label,":"]}),e.jsx("span",{className:"font-mono",children:i.value})]},c))})]},`remaining-${n.type}-${n.name}-${a}`)})})]})})}function Et(){const t=s.useEditorStore(i=>i.card.dataSource),{setSelectedConnectionId:n,setSelectedDatabaseName:a,setSelectedSchemaName:r,setSelectedTableName:l,setSelectedDatamodelId:o}=s.useEditorActions();I.useEffect(()=>{var g;if(!t)return;const{tableName:i,schemaName:c,databaseName:d,connectionId:u}=Ts(t),m=(g=t.selectedEntities)==null?void 0:g[0],x=(m==null?void 0:m.type)==="model"&&"id"in m?m.id:"";n(u||""),a(d||""),r(c||""),l(i||""),o(x)},[t,n,a,r,l,o])}function It({isVisible:t}){const n=s.useEditorStore(x=>x.isDevMode);Et();const[a,r]=I.useState(!1),[l,o]=I.useState(!1),[i,c]=I.useState(!0),d=s.useEditorStore(x=>x.card.dataSource);s.useCurrentUserInfo();const{updateDataSource:u}=s.useEditorActions(),m={connectionId:"",connectionType:"",mode:"database",selectedEntities:[]},h={...m,...d,selectedEntities:(d==null?void 0:d.selectedEntities)||[]};return e.jsxs("div",{className:s.cn("flex flex-col overflow-hidden bg-background transition-all duration-300 ease-in-out",{"w-[325px]":t,"w-0":!t}),children:[e.jsxs("div",{children:[e.jsx("div",{className:"p-4 px-6 pb-2",children:e.jsxs(s.Button,{className:"w-full bg-muted/50",variant:"outline",onClick:()=>r(!0),children:[e.jsx(s.Database,{className:"mr-2 h-3.5 w-3.5"}),"Add Data"]})}),e.jsxs("div",{className:"relative px-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center px-6",children:e.jsx("div",{className:"w-full border-t border-border"})}),e.jsx("div",{className:"relative flex justify-center",children:e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>c(!i),className:"size-6 bg-background p-1 py-1 hover:bg-accent",children:i?e.jsx(s.ChevronUp,{className:"h-3.5 w-3.5"}):e.jsx(s.ChevronDown,{className:"h-3.5 w-3.5"})})})]}),e.jsxs("div",{className:`overflow-hidden px-6 ${i?"max-h-96 space-y-4":"max-h-0 py-0 opacity-0"}`,children:[h.selectedEntities.length>0&&e.jsx(s.TooltipProvider,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.selectedEntities.slice(0,3).map((x,g)=>e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"secondary",className:"group relative cursor-pointer pr-6 text-xs transition-colors hover:border-red-200 hover:bg-red-50 dark:hover:border-red-800 dark:hover:bg-red-950",children:[s.getDisplayName(x),e.jsx("button",{onClick:b=>{b.stopPropagation();const p=h.selectedEntities.filter(v=>!(v.name===x.name&&v.type===x.type));u({...m,...d,selectedEntities:p})},className:"absolute right-1 top-1/2 -translate-y-1/2 rounded-full p-0.5 hover:bg-red-100",children:e.jsx(s.X,{className:"h-2.5 w-2.5 group-hover:text-red-500"})})]})}),e.jsx(ar,{entity:x})]},`${x.type}-${x.name}-${g}`)),h.selectedEntities.length>3&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"outline",className:"text-xs",children:["+",h.selectedEntities.length-3," more"]})}),e.jsx(nr,{entities:h.selectedEntities.slice(3)})]})]})}),!n&&e.jsx(sr,{})]})]}),e.jsx(kt,{}),e.jsx(s.DataSourceDialog,{incomingSelectedEntities:(d==null?void 0:d.selectedEntities)||[],dialogMode:"dataSource",open:a,onOpenChange:r,dataSource:h}),e.jsx(tr,{open:l,onOpenChange:o})]})}function At({error:t,errorSql:n,onSendFeedback:a,className:r,showFeedbackButton:l=!0}){const[o,i]=I.useState(!1);return e.jsx("div",{className:s.cn("rounded-lg border border-destructive/30 bg-destructive/5 p-4",r),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(s.CircleAlert,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-destructive"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:"Query Error"}),e.jsxs("div",{className:"relative rounded-md bg-background/60 p-3",children:[e.jsx(s.CopyButton,{text:t,className:"absolute right-2 top-2 h-6 w-6 z-10"}),e.jsx("div",{className:"max-h-40 overflow-auto pr-10",children:e.jsx("p",{className:"font-mono text-xs text-foreground/80 break-all",children:t})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&e.jsx(s.Collapsible,{open:o,onOpenChange:i,children:e.jsx(s.CollapsibleTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"outline",size:"sm",className:"h-8",children:o?e.jsxs(e.Fragment,{children:[e.jsx(s.ChevronUp,{className:"mr-1.5 h-3.5 w-3.5"}),"Hide Details"]}):e.jsxs(e.Fragment,{children:[e.jsx(s.ChevronDown,{className:"mr-1.5 h-3.5 w-3.5"}),"Show Details"]})})})}),l&&a&&e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-8",onClick:a,children:[e.jsx(s.MessageSquareWarning,{className:"mr-1.5 h-3.5 w-3.5"}),"Send Feedback"]})]}),n&&e.jsx(s.Collapsible,{open:o,onOpenChange:i,children:e.jsx(s.CollapsibleContent,{className:"space-y-2",children:e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Error SQL Query"}),e.jsx(s.CopyButton,{text:n,className:"h-6 w-6"})]}),e.jsx("div",{className:"rounded-md bg-background/60 p-2 max-h-80 overflow-auto",children:e.jsx(s.CodeHighlighter,{code:n,language:"sql"})})]})})})]})]})})}function Mt({sql:t,error:n,errorSql:a,onDebugWithAssistant:r}){const l=s.useEditorStore(u=>u.isDevMode),{setIsDevMode:o,setCardSql:i,setRunSql:c}=s.useEditorActions();function d(){o(!l),i(t),setTimeout(()=>{c(!0)},100)}return e.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxs("div",{className:"flex grow flex-col space-y-3",children:[e.jsxs(s.ScrollArea,{className:"max-h-[250px] min-h-0 overflow-scroll text-xs leading-relaxed text-foreground/80",children:[n&&e.jsx(At,{error:n,errorSql:a,showFeedbackButton:!1}),!n&&t&&e.jsx("div",{className:"flex flex-col space-y-1.5",children:e.jsx("div",{className:"",children:e.jsx(s.CodeHighlighter,{code:t,language:"sql"})})})]}),!l&&t&&!n&&e.jsxs(s.Button,{onClick:d,variant:"secondary",size:"sm",children:[e.jsx(Ca,{className:"mr-2 h-4 w-4"}),"View in SQL Editor"]}),n&&r&&e.jsxs(s.Button,{onClick:r,size:"sm",variant:"outline",children:[e.jsx(Ea,{className:"mr-2 h-4 w-4"}),"Debug with Assistant"]})]})})}function Lt({sql:t,error:n,errorSql:a,onDebugWithAssistant:r}){return e.jsxs(s.HoverCard,{openDelay:n?0:500,children:[e.jsx(s.HoverCardTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"link",className:"h-5 p-0",children:n?e.jsx(ja,{className:"h-4 w-4 text-red-500"}):e.jsx(s.Info,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(s.HoverCardContent,{align:"start",className:"flex w-[700px]",children:e.jsx(Mt,{errorSql:a,sql:t,error:n,onDebugWithAssistant:r})})]})}function rr(t){return s.GenIcon({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"},child:[]}]})(t)}function Rt(t){const{theme:n}=s.useTheme(),a=s.useDashboardStore(p=>p.theme),r=s.useEditorStore(p=>p.frame),l=s.useEditorStore(p=>p.card),o=s.useEditorStore(p=>p.activeTabCardId),i=s.Le(),{refetch:c}=s.useDashboardCardQuery(l),{updateCardTab:d,setRunSql:u}=s.useEditorActions(),m=I.useRef(),h=I.useRef({}),x=r.cards.find(p=>p.id===o),g=I.useCallback(()=>{let p="";return t==="python"&&(p=(x==null?void 0:x.python)||s.PYTHON_DEFAULT_CODE),t==="sql"&&(p=(x==null?void 0:x.sql)||""),p},[t,x]);I.useEffect(()=>{if(o&&l.id&&l.id!==o){if(m.current&&i){const p=m.current.getModel();p&&(h.current[l.id]=p);let v=h.current[o];if(!v){const j=g();v=i.editor.createModel(j,t),h.current[o]=v}m.current.setModel(v)}d(o,l),u(!0)}},[o,l,d,i,u,t,g]),I.useEffect(()=>{if(!i)return;const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",v=a==="system"?p:a;i.editor.defineTheme("default",{base:v==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":v==="light"?"#ffffff":s.hslStringToHex("240 10% 10%")}}),i.editor.setTheme("default")},[n,a,i]),I.useEffect(()=>{const p=m.current;p&&i&&l&&p.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,function(){return c(),!1})},[i,c,l]);function b(p,v){if(m.current=p,!h.current[l.id]){const j=p.getModel(),S=g();h.current[l.id]=j||(v==null?void 0:v.editor.createModel(S,t))||p.getModel()}p.setModel(h.current[l.id])}return{handleEditorDidMount:b}}function lr(){const t=s.useEditorStore(i=>i.card.sql),n=s.useEditorStore(i=>i.sqlGen),{setCardSql:a,setSqlGen:r}=s.useEditorActions(),{handleEditorDidMount:l}=Rt("sql");function o(i){a(i),s.isObjectEmpty(n)||r({})}return e.jsxs("div",{className:"relative h-full w-full",children:[!t&&e.jsx("div",{className:"pointer-events-none absolute left-[65px] top-3 z-10 font-mono text-sm text-muted-foreground",children:"Write your SQL here"}),e.jsx(s.Ft,{theme:"default",className:"pt-3",onChange:o,value:t||"",options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:13,renderLineHighlight:"none"},defaultLanguage:"sql",onMount:l})]})}function or(){const t=s.useEditorStore(l=>l.card.python),{setCardPython:n}=s.useEditorActions(),{handleEditorDidMount:a}=Rt("python");function r(l){n(l)}return e.jsx(s.Ft,{className:"pt-3",theme:"default",onChange:r,value:t||s.PYTHON_DEFAULT_CODE,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:13,renderLineHighlight:"none"},defaultLanguage:"python",onMount:a})}function ir({jsonString:t}){return e.jsx(s.Ft,{theme:"default",defaultLanguage:"json",className:"mt-1 min-h-[220px]",value:t,options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})}function cr(){const t=s.useQueryClient(),{isConsoleMode:n}=s.useDashboardPreferences(),[a,r]=I.useState(!1),[l,o]=I.useState(!1);s.useEditorStore(V=>V.frame);const i=s.useEditorStore(V=>V.card);s.useEditorStore(V=>V.isShowingVisual),s.useEditorStore(V=>V.selectedConnectionId),s.useEditorStore(V=>V.tempQueryData),s.useEditorStore(V=>V.selectedDatabaseName),s.useEditorStore(V=>V.selectedDatamodelId),s.useEditorStore(V=>V.selectedSchemaName);const c=s.useEditorStore(V=>V.showAIDialog);s.useEditorStore(V=>V.selectedTableName);const d=s.useEditorStore(V=>{var J;return(J=V==null?void 0:V.card)==null?void 0:J.sql}),u=s.useEditorStore(V=>{var J;return(J=V==null?void 0:V.card)==null?void 0:J.python}),{cardFilterValues:m}=s.useCardFilterValues((i==null?void 0:i.id)??""),{setCardCustomCfg:h,setQueryResultColumns:x,setCardSql:g,setTempQueryData:b,setPythonStdOut:p,setCardPreferences:v,setCardType:j,setCardPython:S,runAssistant:M,setShowAIDialog:E}=s.useEditorActions();s.useEditorStore(V=>V.onSave),s.useEditorStore(V=>V.onClose),s.useEditorStore(V=>V.actions.setSqlGen);const C=s.useEditorStore(V=>V.runSql),D=s.useEditorStore(V=>V.actions.setRunSql),f=s.useEditorStore(V=>V.actions.setIsSqlRunning),{data:N,isLoading:y,isFetching:O,isSuccess:w,isError:F,error:k,errorSql:T,queryKey:A,refetch:R,errorMessage:L}=s.useDashboardCardQuery(i);I.useEffect(()=>{if(N&&(N.rowLimitExceeded&&s.ue.error("Row limit (10,000) exceeded. Refine your query.",{position:"top-center",richColors:!0}),p((N==null?void 0:N.output)||""),N.records.length>0)){const{dimensionKeys:V}=s.getKeys(N.records);x(V)}},[N,x,p]),I.useEffect(()=>{(y||O)&&f(!0),(F||w)&&f(!1),F&&(x([]),p(""))},[y,O,N,p,F,w,f,x,k]),I.useEffect(()=>{C&&(t.getQueryData(A)||R(),D(!1))},[C,R,D,A,t]);async function B(){const V=`Can you help me debug this query?
297
+ ON ${S}`}),b};return o.length<2?null:e.jsx(e.Fragment,{children:e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[a.joins.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-6 text-xs font-semibold",onClick:()=>l(!0),children:[e.jsx(s.Link,{className:s.cn("mr-1 h-3 w-3",{"text-blue-500":a.joins.length>0,"text-gray-500":a.joins.length===0})}),"Join",a.joins.length>1?"s":""," (",a.joins.length,")"]})}),e.jsx(s.TooltipContent,{side:"right",className:"max-w-md overflow-hidden p-0",children:e.jsx(er,{joins:a.joins,baseEntityId:a.baseEntity.name,availableDataSources:o,generateSQLPreview:u})})]})}),e.jsx(Gs,{open:r,onOpenChange:l,joinPlan:a,availableDataSources:o,onSave:i,onCancel:d,onRemove:c,children:e.jsx("div",{})})]}),a.joins.length===0&&e.jsx(Gs,{open:r,onOpenChange:l,joinPlan:a,availableDataSources:o,onSave:i,onCancel:d,onRemove:c,children:e.jsxs(s.Button,{onClick:()=>l(!0),variant:"outline",size:"sm",className:"w-full",children:[e.jsx(s.Link,{className:"mr-3 size-4"}),"Configure Joins"]})})]})})})}function tr({open:t,onOpenChange:n}){const[a,r]=I.useState([]),{updateDataSource:l}=s.useEditorActions(),o=s.useDashboardStore(p=>p.dashboard.aiContext),i=(o==null?void 0:o.selectedEntities)||[];I.useEffect(()=>{t&&r([])},[t]);const c=p=>{r(v=>v.some(S=>S.name===p.name&&S.type===p.type)?v.filter(S=>!(S.name===p.name&&S.type===p.type)):[...v,p])},d=()=>{r([...i])},u=()=>{r([])},m=()=>{if(a.length===0)return;const p=a[0],v=p.connectionId||"",j=p.connectionType||"",M=a.some(C=>C.type==="dataset")?"semanticDomain":"database";l({connectionId:v,connectionType:j,mode:M,selectedEntities:a}),n(!1)},h=p=>{switch(p.type){case"table":return e.jsx(s.Table,{className:"h-4 w-4"});case"view":return e.jsx(Wa,{className:"h-4 w-4"});case"model":return e.jsx(ya,{className:"h-4 w-4"});case"dataset":return e.jsx(s.Database,{className:"h-4 w-4"});case"file":case"url":case"upload":return e.jsx(s.FileText,{className:"h-4 w-4"});default:return e.jsx(s.Database,{className:"h-4 w-4"})}},x=p=>"label"in p&&p.label?p.label:p.name,g=p=>{if("description"in p&&p.description)return p.description;const v=[];return p.database&&v.push(p.database),p.schema&&v.push(p.schema),p.name&&v.push(p.name),v.join(".")},b=p=>a.some(v=>v.name===p.name&&v.type===p.type);return i.length===0?e.jsx(s.Dialog,{open:t,onOpenChange:n,children:e.jsxs(s.DialogContent,{className:"max-w-md",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"No Data Available"}),e.jsx(s.DialogDescription,{children:"No entities are currently available in the AI context. Please add some data sources to the dashboard first."})]}),e.jsx(s.DialogFooter,{children:e.jsx(s.Button,{onClick:()=>n(!1),children:"Close"})})]})}):e.jsx(s.Dialog,{open:t,onOpenChange:n,children:e.jsxs(s.DialogContent,{className:"flex max-w-2xl flex-col",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Select Data to Analyze"}),e.jsx(s.DialogDescription,{children:"Choose entities from the dashboard's context"})]}),e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{variant:"outline",size:"sm",onClick:d,disabled:a.length===i.length,children:"Select All"}),e.jsx(s.Button,{variant:"outline",size:"sm",onClick:u,disabled:a.length===0,children:"Clear All"})]}),e.jsxs(s.Badge,{variant:"secondary",children:[a.length," of ",i.length," selected"]})]}),e.jsx(s.Separator,{}),e.jsx(s.ScrollArea,{className:"h-64",children:e.jsx("div",{className:"space-y-2",children:i.map((p,v)=>e.jsxs("div",{className:s.cn("flex items-center gap-3 rounded-lg border p-3 transition-colors hover:bg-muted/50",b(p)&&"border-primary bg-primary/5"),children:[e.jsx(s.Checkbox,{checked:b(p),onCheckedChange:()=>c(p)}),e.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:h(p)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:x(p)}),e.jsx("div",{className:"truncate text-sm text-muted-foreground",children:g(p)})]}),e.jsx(s.Badge,{variant:"outline",className:"text-xs",children:p.type})]},`${p.type}-${p.name}-${v}`))})})]}),e.jsx(s.DialogFooter,{children:e.jsx("div",{className:"flex w-full justify-between",children:e.jsxs("div",{className:"flex grow justify-end gap-2",children:[e.jsx(s.Button,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),e.jsxs(s.Button,{onClick:m,disabled:a.length===0,children:["Select"," ",a.length>0?`(${a.length})`:""]})]})})})]})})}function ar({entity:t,title:n,maxDetails:a=10}){const l=s.getEntityDetails(t).slice(0,a),o=l.find(c=>c.label==="Description"),i=l.filter(c=>c.label==="Description"?!1:!["Connection","Database","Schema"].includes(c.label));return e.jsx(s.TooltipContent,{side:"top",className:"ml-5 max-w-xs",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:n||s.getDisplayName(t)}),o&&e.jsxs("div",{className:"border-t border-border pt-2",children:[e.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"Description:"}),e.jsx("div",{className:"text-xs leading-relaxed",children:o.value})]}),i.length>0&&e.jsx("div",{className:"space-y-0.5",children:i.map((c,d)=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{className:"mr-2 text-muted-foreground",children:[c.label,":"]}),e.jsx("span",{className:"font-mono",children:c.value})]},d))})]})})}function nr({entities:t}){return e.jsx(s.TooltipContent,{side:"top",className:"ml-5 max-w-xs",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-sm font-medium",children:[t.length," more entities"]}),e.jsx("div",{className:"space-y-1",children:t.map((n,a)=>{const r=s.getEntityDetails(n),l=r.find(i=>i.label==="Description"),o=r.filter(i=>i.label==="Description"?!1:!["Connection","Database","Schema"].includes(i.label)).slice(0,3);return e.jsxs("div",{className:"border-b border-border pb-1 last:border-b-0",children:[e.jsx("div",{className:"text-xs font-medium",children:s.getDisplayName(n)}),l&&e.jsxs("div",{className:"mb-1 mt-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Description:"}),e.jsx("div",{className:"text-xs leading-relaxed",children:l.value})]}),o.length>0&&e.jsx("div",{className:"mt-1 space-y-0.5",children:o.map((i,c)=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsxs("span",{className:"mr-2 text-muted-foreground",children:[i.label,":"]}),e.jsx("span",{className:"font-mono",children:i.value})]},c))})]},`remaining-${n.type}-${n.name}-${a}`)})})]})})}function Et(){const t=s.useEditorStore(i=>i.card.dataSource),{setSelectedConnectionId:n,setSelectedDatabaseName:a,setSelectedSchemaName:r,setSelectedTableName:l,setSelectedDatamodelId:o}=s.useEditorActions();I.useEffect(()=>{var g;if(!t)return;const{tableName:i,schemaName:c,databaseName:d,connectionId:u}=Ts(t),m=(g=t.selectedEntities)==null?void 0:g[0],x=(m==null?void 0:m.type)==="model"&&"id"in m?m.id:"";n(u||""),a(d||""),r(c||""),l(i||""),o(x)},[t,n,a,r,l,o])}function It({isVisible:t}){const n=s.useEditorStore(x=>x.isDevMode);Et();const[a,r]=I.useState(!1),[l,o]=I.useState(!1),[i,c]=I.useState(!0),d=s.useEditorStore(x=>x.card.dataSource);s.useCurrentUserInfo();const{updateDataSource:u}=s.useEditorActions(),m={connectionId:"",connectionType:"",mode:"database",selectedEntities:[]},h={...m,...d,selectedEntities:(d==null?void 0:d.selectedEntities)||[]};return e.jsxs("div",{className:s.cn("flex flex-col overflow-hidden bg-background transition-all duration-300 ease-in-out",{"w-[325px]":t,"w-0":!t}),children:[e.jsxs("div",{children:[e.jsx("div",{className:"p-4 px-6 pb-2",children:e.jsxs(s.Button,{className:"w-full bg-muted/50",variant:"outline",onClick:()=>r(!0),children:[e.jsx(s.Database,{className:"mr-2 h-3.5 w-3.5"}),"Choose Dataset"]})}),e.jsxs("div",{className:"relative px-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center px-6",children:e.jsx("div",{className:"w-full border-t border-border"})}),e.jsx("div",{className:"relative flex justify-center",children:e.jsx(s.Button,{variant:"ghost",size:"sm",onClick:()=>c(!i),className:"size-6 bg-background p-1 py-1 hover:bg-accent",children:i?e.jsx(s.ChevronUp,{className:"h-3.5 w-3.5"}):e.jsx(s.ChevronDown,{className:"h-3.5 w-3.5"})})})]}),e.jsxs("div",{className:`overflow-hidden px-6 ${i?"max-h-96 space-y-4":"max-h-0 py-0 opacity-0"}`,children:[h.selectedEntities.length>0&&e.jsx(s.TooltipProvider,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.selectedEntities.slice(0,3).map((x,g)=>e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"secondary",className:"group relative cursor-pointer pr-6 text-xs transition-colors hover:border-red-200 hover:bg-red-50 dark:hover:border-red-800 dark:hover:bg-red-950",children:[s.getDisplayName(x),e.jsx("button",{onClick:b=>{b.stopPropagation();const p=h.selectedEntities.filter(v=>!(v.name===x.name&&v.type===x.type));u({...m,...d,selectedEntities:p})},className:"absolute right-1 top-1/2 -translate-y-1/2 rounded-full p-0.5 hover:bg-red-100",children:e.jsx(s.X,{className:"h-2.5 w-2.5 group-hover:text-red-500"})})]})}),e.jsx(ar,{entity:x})]},`${x.type}-${x.name}-${g}`)),h.selectedEntities.length>3&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(s.Badge,{variant:"outline",className:"text-xs",children:["+",h.selectedEntities.length-3," more"]})}),e.jsx(nr,{entities:h.selectedEntities.slice(3)})]})]})}),!n&&e.jsx(sr,{})]})]}),e.jsx(kt,{}),e.jsx(s.DataSourceDialog,{incomingSelectedEntities:(d==null?void 0:d.selectedEntities)||[],dialogMode:"dataSource",open:a,onOpenChange:r,dataSource:h}),e.jsx(tr,{open:l,onOpenChange:o})]})}function At({error:t,errorSql:n,onSendFeedback:a,className:r,showFeedbackButton:l=!0}){const[o,i]=I.useState(!1);return e.jsx("div",{className:s.cn("rounded-lg border border-destructive/30 bg-destructive/5 p-4",r),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(s.CircleAlert,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-destructive"}),e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:"Query Error"}),e.jsxs("div",{className:"relative rounded-md bg-background/60 p-3",children:[e.jsx(s.CopyButton,{text:t,className:"absolute right-2 top-2 h-6 w-6 z-10"}),e.jsx("div",{className:"max-h-40 overflow-auto pr-10",children:e.jsx("p",{className:"font-mono text-xs text-foreground/80 break-all",children:t})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n&&e.jsx(s.Collapsible,{open:o,onOpenChange:i,children:e.jsx(s.CollapsibleTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"outline",size:"sm",className:"h-8",children:o?e.jsxs(e.Fragment,{children:[e.jsx(s.ChevronUp,{className:"mr-1.5 h-3.5 w-3.5"}),"Hide Details"]}):e.jsxs(e.Fragment,{children:[e.jsx(s.ChevronDown,{className:"mr-1.5 h-3.5 w-3.5"}),"Show Details"]})})})}),l&&a&&e.jsxs(s.Button,{variant:"outline",size:"sm",className:"h-8",onClick:a,children:[e.jsx(s.MessageSquareWarning,{className:"mr-1.5 h-3.5 w-3.5"}),"Send Feedback"]})]}),n&&e.jsx(s.Collapsible,{open:o,onOpenChange:i,children:e.jsx(s.CollapsibleContent,{className:"space-y-2",children:e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Error SQL Query"}),e.jsx(s.CopyButton,{text:n,className:"h-6 w-6"})]}),e.jsx("div",{className:"rounded-md bg-background/60 p-2 max-h-80 overflow-auto",children:e.jsx(s.CodeHighlighter,{code:n,language:"sql"})})]})})})]})]})})}function Mt({sql:t,error:n,errorSql:a,onDebugWithAssistant:r}){const l=s.useEditorStore(u=>u.isDevMode),{setIsDevMode:o,setCardSql:i,setRunSql:c}=s.useEditorActions();function d(){o(!l),i(t),setTimeout(()=>{c(!0)},100)}return e.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxs("div",{className:"flex grow flex-col space-y-3",children:[e.jsxs(s.ScrollArea,{className:"max-h-[250px] min-h-0 overflow-scroll text-xs leading-relaxed text-foreground/80",children:[n&&e.jsx(At,{error:n,errorSql:a,showFeedbackButton:!1}),!n&&t&&e.jsx("div",{className:"flex flex-col space-y-1.5",children:e.jsx("div",{className:"",children:e.jsx(s.CodeHighlighter,{code:t,language:"sql"})})})]}),!l&&t&&!n&&e.jsxs(s.Button,{onClick:d,variant:"secondary",size:"sm",children:[e.jsx(Ca,{className:"mr-2 h-4 w-4"}),"View in SQL Editor"]}),n&&r&&e.jsxs(s.Button,{onClick:r,size:"sm",variant:"outline",children:[e.jsx(Ea,{className:"mr-2 h-4 w-4"}),"Debug with Assistant"]})]})})}function Lt({sql:t,error:n,errorSql:a,onDebugWithAssistant:r}){return e.jsxs(s.HoverCard,{openDelay:n?0:500,children:[e.jsx(s.HoverCardTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"link",className:"h-5 p-0",children:n?e.jsx(ja,{className:"h-4 w-4 text-red-500"}):e.jsx(s.Info,{className:"h-4 w-4 text-muted-foreground"})})}),e.jsx(s.HoverCardContent,{align:"start",className:"flex w-[700px]",children:e.jsx(Mt,{errorSql:a,sql:t,error:n,onDebugWithAssistant:r})})]})}function rr(t){return s.GenIcon({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z"},child:[]}]})(t)}function Rt(t){const{theme:n}=s.useTheme(),a=s.useDashboardStore(p=>p.theme),r=s.useEditorStore(p=>p.frame),l=s.useEditorStore(p=>p.card),o=s.useEditorStore(p=>p.activeTabCardId),i=s.Le(),{refetch:c}=s.useDashboardCardQuery(l),{updateCardTab:d,setRunSql:u}=s.useEditorActions(),m=I.useRef(),h=I.useRef({}),x=r.cards.find(p=>p.id===o),g=I.useCallback(()=>{let p="";return t==="python"&&(p=(x==null?void 0:x.python)||s.PYTHON_DEFAULT_CODE),t==="sql"&&(p=(x==null?void 0:x.sql)||""),p},[t,x]);I.useEffect(()=>{if(o&&l.id&&l.id!==o){if(m.current&&i){const p=m.current.getModel();p&&(h.current[l.id]=p);let v=h.current[o];if(!v){const j=g();v=i.editor.createModel(j,t),h.current[o]=v}m.current.setModel(v)}d(o,l),u(!0)}},[o,l,d,i,u,t,g]),I.useEffect(()=>{if(!i)return;const p=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",v=a==="system"?p:a;i.editor.defineTheme("default",{base:v==="light"?"vs":"vs-dark",inherit:!0,rules:[],colors:{"editor.background":v==="light"?"#ffffff":s.hslStringToHex("240 10% 10%")}}),i.editor.setTheme("default")},[n,a,i]),I.useEffect(()=>{const p=m.current;p&&i&&l&&p.addCommand(i.KeyMod.Shift|i.KeyCode.Enter,function(){return c(),!1})},[i,c,l]);function b(p,v){if(m.current=p,!h.current[l.id]){const j=p.getModel(),S=g();h.current[l.id]=j||(v==null?void 0:v.editor.createModel(S,t))||p.getModel()}p.setModel(h.current[l.id])}return{handleEditorDidMount:b}}function lr(){const t=s.useEditorStore(i=>i.card.sql),n=s.useEditorStore(i=>i.sqlGen),{setCardSql:a,setSqlGen:r}=s.useEditorActions(),{handleEditorDidMount:l}=Rt("sql");function o(i){a(i),s.isObjectEmpty(n)||r({})}return e.jsxs("div",{className:"relative h-full w-full",children:[!t&&e.jsx("div",{className:"pointer-events-none absolute left-[65px] top-3 z-10 font-mono text-sm text-muted-foreground",children:"Write your SQL here"}),e.jsx(s.Ft,{theme:"default",className:"pt-3",onChange:o,value:t||"",options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:13,renderLineHighlight:"none"},defaultLanguage:"sql",onMount:l})]})}function or(){const t=s.useEditorStore(l=>l.card.python),{setCardPython:n}=s.useEditorActions(),{handleEditorDidMount:a}=Rt("python");function r(l){n(l)}return e.jsx(s.Ft,{className:"pt-3",theme:"default",onChange:r,value:t||s.PYTHON_DEFAULT_CODE,options:{minimap:{enabled:!1},wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:13,renderLineHighlight:"none"},defaultLanguage:"python",onMount:a})}function ir({jsonString:t}){return e.jsx(s.Ft,{theme:"default",defaultLanguage:"json",className:"mt-1 min-h-[220px]",value:t,options:{readOnly:!0,minimap:{enabled:!1},lineNumbers:"off",glyphMargin:!1,wordWrap:"on",scrollbar:{verticalScrollbarSize:0,horizontalScrollbarSize:0},fontSize:12,renderLineHighlight:"none"}})}function cr(){const t=s.useQueryClient(),{isConsoleMode:n}=s.useDashboardPreferences(),[a,r]=I.useState(!1),[l,o]=I.useState(!1);s.useEditorStore(V=>V.frame);const i=s.useEditorStore(V=>V.card);s.useEditorStore(V=>V.isShowingVisual),s.useEditorStore(V=>V.selectedConnectionId),s.useEditorStore(V=>V.tempQueryData),s.useEditorStore(V=>V.selectedDatabaseName),s.useEditorStore(V=>V.selectedDatamodelId),s.useEditorStore(V=>V.selectedSchemaName);const c=s.useEditorStore(V=>V.showAIDialog);s.useEditorStore(V=>V.selectedTableName);const d=s.useEditorStore(V=>{var J;return(J=V==null?void 0:V.card)==null?void 0:J.sql}),u=s.useEditorStore(V=>{var J;return(J=V==null?void 0:V.card)==null?void 0:J.python}),{cardFilterValues:m}=s.useCardFilterValues((i==null?void 0:i.id)??""),{setCardCustomCfg:h,setQueryResultColumns:x,setCardSql:g,setTempQueryData:b,setPythonStdOut:p,setCardPreferences:v,setCardType:j,setCardPython:S,runAssistant:M,setShowAIDialog:E}=s.useEditorActions();s.useEditorStore(V=>V.onSave),s.useEditorStore(V=>V.onClose),s.useEditorStore(V=>V.actions.setSqlGen);const C=s.useEditorStore(V=>V.runSql),D=s.useEditorStore(V=>V.actions.setRunSql),f=s.useEditorStore(V=>V.actions.setIsSqlRunning),{data:N,isLoading:y,isFetching:O,isSuccess:w,isError:F,error:k,errorSql:T,queryKey:A,refetch:R,errorMessage:L}=s.useDashboardCardQuery(i);I.useEffect(()=>{if(N&&(N.rowLimitExceeded&&s.ue.error("Row limit (10,000) exceeded. Refine your query.",{position:"top-center",richColors:!0}),p((N==null?void 0:N.output)||""),N.records.length>0)){const{dimensionKeys:V}=s.getKeys(N.records);x(V)}},[N,x,p]),I.useEffect(()=>{(y||O)&&f(!0),(F||w)&&f(!1),F&&(x([]),p(""))},[y,O,N,p,F,w,f,x,k]),I.useEffect(()=>{C&&(t.getQueryData(A)||R(),D(!1))},[C,R,D,A,t]);async function B(){const V=`Can you help me debug this query?
298
298
 
299
299
  Error:
300
300
 
@@ -1,5 +1,5 @@
1
1
  import { jsxs as a, jsx as e, Fragment as W } from "react/jsx-runtime";
2
- import { c as oe, a1 as fs, u as H, a2 as kt, a3 as Dt, B as _, a4 as Tt, a5 as Ke, a6 as gs, _ as pt, a7 as Je, a8 as nt, a9 as Ql, aa as $e, ab as st, ac as lt, ad as rt, ae as ft, af as U, ag as Oe, ah as Mt, I as ye, ai as vs, aj as ia, ak as $i, al as Cl, am as xs, f as Y, an as ys, ao as Yi, ap as Zl, aq as qi, ar as Ki, as as ba, at as me, w as wl, au as Wi, av as Ji, aw as oa, ax as je, ay as de, az as De, aA as wt, aB as Ve, aC as Aa, aD as ua, aE as Ea, aF as Hi, aG as ma, aH as It, aI as Qe, aJ as Ze, aK as qa, aL as tt, aM as Ee, aN as He, aO as Ns, aP as pn, aQ as Ca, aR as Ht, aS as ha, aT as bs, aU as Cs, aV as Qi, aW as Ka, aX as ws, aY as Ss, aZ as ks, a_ as Ds, R as Lt, a$ as Xl, b0 as Zi, b1 as Ts, b2 as Wa, b3 as Ms, b4 as Is, b5 as Oa, b6 as Ra, b7 as Fa, b8 as As, b9 as Dn, ba as Es, bb as er, bc as tr, bd as Os, be as fe, bf as ge, bg as ve, bh as xe, bi as ae, bj as ar, bk as nr, bl as Xi, bm as eo, bn as _t, bo as to, bp as ao, bq as Vt, br as Bt, bs as ze, bt as dt, bu as bt, $ as O, bv as At, bw as Tn, bx as Mn, by as Rs, bz as no, bA as mt, bB as Ba, bC as Qt, bD as fn, bE as sr, bF as lr, bG as so, bH as Fs, bI as Ps, bJ as Ls, bK as zs, bL as _s, bM as Vs, bN as Bs, bO as Us, bP as cn, bQ as In, bR as Ja, a0 as le, bS as lo, bT as St, bU as ro, o as pa, bV as rr, bW as We, bX as io, bY as js, bZ as gn, b_ as Gs, b$ as dn, c0 as Ha, c1 as $s, c2 as oo, c3 as co, c4 as uo, c5 as mo, c6 as ho, v as po, c7 as vn, c8 as ir, c9 as fo, ca as go, cb as as, cc as vo, cd as un, ce as mn, cf as na, cg as xo, x as or, W as Zt, ch as Ua, ci as Yt, cj as yo, A as wa, z as qt, G as Kt, ck as ns, y as Ot, cl as An, Q as Sl, K as cr, J as dr, T as No, cm as kl, cn as Pa, co as La, cp as Qa, cq as ot, cr as Za, cs as bo, ct as xn, cu as Jt, cv as ur, cw as En, cx as Ys, cy as ht, cz as Te, cA as Me, cB as Ie, cC as Sa, cD as qs, cE as Ks, cF as Xa, g as Xt, cG as Dl, cH as Co, cI as ss, cJ as mr, cK as Ws, cL as hr, cM as ja, cN as Tl, cO as wo, cP as So, cQ as ko, cR as pr, cS as Do, cT as To, cU as fr, cV as Mo, cW as On, cX as Io, cY as Ao, cZ as ls, c_ as Rt, c$ as qe, d0 as Ft, d1 as Eo, d2 as Oo, d3 as Rn, d4 as Ro, d5 as Js, d6 as Fo, d7 as gr, d8 as Hs, d9 as Po, da as vr, db as hn, dc as xr, dd as Lo, de as zo, df as _o, dg as Qs, dh as Vo, di as Bo, dj as Ml, dk as Uo, E as en, b as Zs, dl as jo, dm as Go, dn as $o, dp as Xs, dq as Yo, dr as qo, ds as Ko, dt as yr, du as el, dv as Nr, dw as br, dx as Cr, dy as wr, dz as Sr, dA as tl, dB as al, dC as kr, dD as Dr, dE as Tr, dF as nl, dG as Fn, dH as Pn, dI as Wo, P as Ut, e as jt, dJ as Jo, dK as aa, dL as Ho, dM as Qo, dN as Zo, dO as Xo, dP as ec, dQ as tc, dR as Mr, dS as ut, dT as Ga, dU as yn, dV as Wt, h as ea, dW as ac, dX as nc, dY as sc, dZ as lc, d_ as rc, d$ as Ir, e0 as ic, i as Ln, j as zn, k as _n, l as Vn, m as ya, n as tn, e1 as oc, e2 as ct, e3 as nn, e4 as Il, e5 as cc, e6 as Al, e7 as dc, e8 as uc, e9 as mc, ea as hc, eb as sl, ec as ll, ed as zt, ee as pc, ef as Bn, eg as Ar, eh as fc, ei as gc, ej as El, ek as vc, el as xc, em as yc, en as Nc, eo as bc, O as Ol, ep as Rl, eq as Cc, er as wc, es as Er, et as Sc, eu as Or, ev as kc, ew as Dc, ex as Tc, ey as Mc, ez as Ic, eA as Ac, eB as Ec, eC as Oc, eD as Rc, eE as Fc, eF as Pc, eG as Lc, eH as zc, eI as _c, eJ as Vc, eK as Bc, eL as Rr, eM as qn, eN as rl, eO as Uc, eP as jc, eQ as Gc, eR as ka, eS as $c, eT as Fr, eU as rs, eV as Yc, eW as qc, eX as Kc, eY as is, eZ as os, e_ as Nn, e$ as Pr, f0 as ca, f1 as Da, f2 as Wc, f3 as Jc, f4 as Hc, f5 as Qc, f6 as Zc, f7 as Xc, f8 as ed, f9 as td, fa as ad, fb as Kn, fc as nd, fd as sd, fe as ld, F as Lr, ff as rd, fg as id, fh as od, fi as zr, fj as _r, fk as cd, fl as Vr, fm as dd, fn as ud, fo as md, fp as hd, fq as pd, S as fd, fr as gd, U as vd, fs as xd, C as yd } from "./index--nYl92ic.js";
2
+ import { c as oe, a1 as fs, u as H, a2 as kt, a3 as Dt, B as _, a4 as Tt, a5 as Ke, a6 as gs, _ as pt, a7 as Je, a8 as nt, a9 as Ql, aa as $e, ab as st, ac as lt, ad as rt, ae as ft, af as U, ag as Oe, ah as Mt, I as ye, ai as vs, aj as ia, ak as $i, al as Cl, am as xs, f as Y, an as ys, ao as Yi, ap as Zl, aq as qi, ar as Ki, as as ba, at as me, w as wl, au as Wi, av as Ji, aw as oa, ax as je, ay as de, az as De, aA as wt, aB as Ve, aC as Aa, aD as ua, aE as Ea, aF as Hi, aG as ma, aH as It, aI as Qe, aJ as Ze, aK as qa, aL as tt, aM as Ee, aN as He, aO as Ns, aP as pn, aQ as Ca, aR as Ht, aS as ha, aT as bs, aU as Cs, aV as Qi, aW as Ka, aX as ws, aY as Ss, aZ as ks, a_ as Ds, R as Lt, a$ as Xl, b0 as Zi, b1 as Ts, b2 as Wa, b3 as Ms, b4 as Is, b5 as Oa, b6 as Ra, b7 as Fa, b8 as As, b9 as Dn, ba as Es, bb as er, bc as tr, bd as Os, be as fe, bf as ge, bg as ve, bh as xe, bi as ae, bj as ar, bk as nr, bl as Xi, bm as eo, bn as _t, bo as to, bp as ao, bq as Vt, br as Bt, bs as ze, bt as dt, bu as bt, $ as O, bv as At, bw as Tn, bx as Mn, by as Rs, bz as no, bA as mt, bB as Ba, bC as Qt, bD as fn, bE as sr, bF as lr, bG as so, bH as Fs, bI as Ps, bJ as Ls, bK as zs, bL as _s, bM as Vs, bN as Bs, bO as Us, bP as cn, bQ as In, bR as Ja, a0 as le, bS as lo, bT as St, bU as ro, o as pa, bV as rr, bW as We, bX as io, bY as js, bZ as gn, b_ as Gs, b$ as dn, c0 as Ha, c1 as $s, c2 as oo, c3 as co, c4 as uo, c5 as mo, c6 as ho, v as po, c7 as vn, c8 as ir, c9 as fo, ca as go, cb as as, cc as vo, cd as un, ce as mn, cf as na, cg as xo, x as or, W as Zt, ch as Ua, ci as Yt, cj as yo, A as wa, z as qt, G as Kt, ck as ns, y as Ot, cl as An, Q as Sl, K as cr, J as dr, T as No, cm as kl, cn as Pa, co as La, cp as Qa, cq as ot, cr as Za, cs as bo, ct as xn, cu as Jt, cv as ur, cw as En, cx as Ys, cy as ht, cz as Te, cA as Me, cB as Ie, cC as Sa, cD as qs, cE as Ks, cF as Xa, g as Xt, cG as Dl, cH as Co, cI as ss, cJ as mr, cK as Ws, cL as hr, cM as ja, cN as Tl, cO as wo, cP as So, cQ as ko, cR as pr, cS as Do, cT as To, cU as fr, cV as Mo, cW as On, cX as Io, cY as Ao, cZ as ls, c_ as Rt, c$ as qe, d0 as Ft, d1 as Eo, d2 as Oo, d3 as Rn, d4 as Ro, d5 as Js, d6 as Fo, d7 as gr, d8 as Hs, d9 as Po, da as vr, db as hn, dc as xr, dd as Lo, de as zo, df as _o, dg as Qs, dh as Vo, di as Bo, dj as Ml, dk as Uo, E as en, b as Zs, dl as jo, dm as Go, dn as $o, dp as Xs, dq as Yo, dr as qo, ds as Ko, dt as yr, du as el, dv as Nr, dw as br, dx as Cr, dy as wr, dz as Sr, dA as tl, dB as al, dC as kr, dD as Dr, dE as Tr, dF as nl, dG as Fn, dH as Pn, dI as Wo, P as Ut, e as jt, dJ as Jo, dK as aa, dL as Ho, dM as Qo, dN as Zo, dO as Xo, dP as ec, dQ as tc, dR as Mr, dS as ut, dT as Ga, dU as yn, dV as Wt, h as ea, dW as ac, dX as nc, dY as sc, dZ as lc, d_ as rc, d$ as Ir, e0 as ic, i as Ln, j as zn, k as _n, l as Vn, m as ya, n as tn, e1 as oc, e2 as ct, e3 as nn, e4 as Il, e5 as cc, e6 as Al, e7 as dc, e8 as uc, e9 as mc, ea as hc, eb as sl, ec as ll, ed as zt, ee as pc, ef as Bn, eg as Ar, eh as fc, ei as gc, ej as El, ek as vc, el as xc, em as yc, en as Nc, eo as bc, O as Ol, ep as Rl, eq as Cc, er as wc, es as Er, et as Sc, eu as Or, ev as kc, ew as Dc, ex as Tc, ey as Mc, ez as Ic, eA as Ac, eB as Ec, eC as Oc, eD as Rc, eE as Fc, eF as Pc, eG as Lc, eH as zc, eI as _c, eJ as Vc, eK as Bc, eL as Rr, eM as qn, eN as rl, eO as Uc, eP as jc, eQ as Gc, eR as ka, eS as $c, eT as Fr, eU as rs, eV as Yc, eW as qc, eX as Kc, eY as is, eZ as os, e_ as Nn, e$ as Pr, f0 as ca, f1 as Da, f2 as Wc, f3 as Jc, f4 as Hc, f5 as Qc, f6 as Zc, f7 as Xc, f8 as ed, f9 as td, fa as ad, fb as Kn, fc as nd, fd as sd, fe as ld, F as Lr, ff as rd, fg as id, fh as od, fi as zr, fj as _r, fk as cd, fl as Vr, fm as dd, fn as ud, fo as md, fp as hd, fq as pd, S as fd, fr as gd, U as vd, fs as xd, C as yd } from "./index-DYPVnruI.js";
3
3
  import * as cs from "react";
4
4
  import Ge, { useState as V, useRef as xt, useEffect as be, useMemo as _e, useCallback as we, useContext as il, Suspense as Br } from "react";
5
5
  import { createPortal as Nd } from "react-dom";
@@ -8775,7 +8775,7 @@ function hi({
8775
8775
  onClick: () => l(!0),
8776
8776
  children: [
8777
8777
  /* @__PURE__ */ e(Jt, { className: "mr-2 h-3.5 w-3.5" }),
8778
- "Add Data"
8778
+ "Choose Dataset"
8779
8779
  ]
8780
8780
  }
8781
8781
  ) }),