@prisma/studio-core 0.0.0-dev.202503280212 → 0.0.0-dev.202503281209

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/ui/index.cjs CHANGED
@@ -1 +1,163 @@
1
- "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},u=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of d(e))!s.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(a=c(e,o))||a.enumerable});return t};var k=t=>u(i({},"__esModule",{value:!0}),t);var b={};h(b,{default:()=>n});module.exports=k(b);var l=require("react/jsx-runtime");function n(){return(0,l.jsx)("h1",{className:"tw-preflight ps:p-10",children:"Hello, world!"})}
1
+ "use strict";var Ua=Object.create;var Re=Object.defineProperty;var Ha=Object.getOwnPropertyDescriptor;var Oa=Object.getOwnPropertyNames;var Na=Object.getPrototypeOf,Ea=Object.prototype.hasOwnProperty;var Ga=(e,a)=>{for(var t in a)Re(e,t,{get:a[t],enumerable:!0})},Qe=(e,a,t,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of Oa(a))!Ea.call(e,l)&&l!==t&&Re(e,l,{get:()=>a[l],enumerable:!(o=Ha(a,l))||o.enumerable});return e};var A=(e,a,t)=>(t=e!=null?Ua(Na(e)):{},Qe(a||!e||!e.__esModule?Re(t,"default",{value:e,enumerable:!0}):t,e)),za=e=>Qe(Re({},"__esModule",{value:!0}),e);var Ct={};Ga(Ct,{Studio:()=>Je});module.exports=za(Ct);var gu=require("../index-KSZNOSSS.css");var Fa=require("nuqs/adapters/react"),v=A(require("react"),1);var $e=require("@radix-ui/react-slot"),Ye=require("nuqs");var _e=require("clsx"),je=require("tailwind-merge");function u(...e){return(0,je.twMerge)((0,_e.clsx)(e))}var U=require("react/jsx-runtime"),te=()=>{let{setCurrentTable:e,currentTable:a,favoriteTableIds:t,tables:o}=Me(),[l,m]=(0,Ye.useQueryState)("tableId"),r=async f=>{await m(f);let C=o.find(S=>S.id===f);C&&e(C)};return(0,U.jsxs)("div",{className:"ps-flex ps-flex-col ps-w-64 ps-gap-4 ps-shrink-0",children:[(0,U.jsx)(te.Block,{label:"Tables",children:o.map(f=>(0,U.jsx)(te.Item,{isActive:a?.id===f.id,onClick:C=>{C.preventDefault(),r(f.id)},className:`ps-px-2 ps-py-1 ps-cursor-pointer ps-rounded ${a?.id===f.id?"ps-bg-primary ps-text-white":"ps-hover:ps-bg-gray-100"}`,children:f.name},f.id))}),t.size>0&&(0,U.jsx)(te.Block,{label:"Favourites",children:o.filter(f=>t.has(f.id)).map(f=>(0,U.jsx)(te.Item,{isActive:a?.id===f.id,onClick:C=>{C.preventDefault(),r(f.id)},children:f.name},f.id))})]})},Va=({className:e,label:a,children:t,...o})=>(0,U.jsxs)("div",{className:u("ps-rounded-lg ps-border ps-bg-card ps-text-card-foreground ps-shadow-xs",e),...o,children:[(0,U.jsx)("div",{className:"ps-pt-4 ps-pb-2 ps-px-4",children:(0,U.jsx)("h2",{className:"ps-text-sm ps-font-medium",children:a})}),(0,U.jsx)("nav",{"aria-label":a,className:"ps-flex ps-flex-col ps-gap-px ps-pb-3",children:t})]}),Wa=({className:e,asChild:a=!1,isActive:t,size:o,...l})=>(0,U.jsx)(a?$e.Slot:"button",{"data-sidebar":"menu-button","data-size":o,"data-active":t,className:u("ps-py-1.5 ps-px-4 ps-text-sm ps-font-medium ps-flex ps-gap-2 ps-items-center ps-border ps-border-transparent ps-bg-transparent ps-hover:bg-muted/50",e),...l});te.Block=Va;te.Item=Wa;var ea=te;var ae=require("@dnd-kit/core"),fe=require("@dnd-kit/sortable"),Da=require("@dnd-kit/utilities"),W=require("@tanstack/react-table"),N=require("react");var X=A(require("react"),1);var z=require("react/jsx-runtime"),Be=X.forwardRef(({className:e,...a},t)=>(0,z.jsx)("div",{className:"ps-relative ps-w-full ps-overflow-auto ps-flex ps-items-start ps-h-full",children:(0,z.jsx)("table",{ref:t,className:u("ps-w-full ps-caption-bottom ps-text-sm table-fixed",e),...a})}));Be.displayName="Table";var Fe=X.forwardRef(({className:e,...a},t)=>(0,z.jsx)("thead",{ref:t,className:u("[&_tr]:ps-border-b",e),...a}));Fe.displayName="TableHeader";var qe=X.forwardRef(({className:e,...a},t)=>(0,z.jsx)("tbody",{ref:t,className:u("[&_tr:last-child]:ps-border-0",e),...a}));qe.displayName="TableBody";var Xa=X.forwardRef(({className:e,...a},t)=>(0,z.jsx)("tfoot",{ref:t,className:u("ps-border-t ps-bg-muted/50 ps-font-medium [&>tr]:last:ps-border-b-0",e),...a}));Xa.displayName="TableFooter";var ne=X.forwardRef(({className:e,...a},t)=>(0,z.jsx)("tr",{ref:t,className:u("ps-border-b ps-transition-colors hover:ps-bg-muted/50 data-[state=selected]:ps-bg-muted",e),...a}));ne.displayName="TableRow";var ve=X.forwardRef(({className:e,...a},t)=>(0,z.jsx)("th",{ref:t,className:u("ps-h-10 ps-px-2 ps-text-left ps-align-middle ps-font-medium ps-text-muted-foreground [&:has([role=checkbox])]:ps-pr-0 [&>[role=checkbox]]:ps-translate-y-[2px]",e),...a}));ve.displayName="TableHead";var ce=X.forwardRef(({className:e,...a},t)=>(0,z.jsx)("td",{ref:t,className:u("ps-p-2 ps-align-middle [&:has([role=checkbox])]:ps-pr-0 [&>[role=checkbox]]:ps-translate-y-[2px]",e),...a}));ce.displayName="TableCell";var Ka=X.forwardRef(({className:e,...a},t)=>(0,z.jsx)("caption",{ref:t,className:u("ps-mt-4 ps-text-sm ps-text-muted-foreground",e),...a}));Ka.displayName="TableCaption";var na=require("@uiw/codemirror-theme-tokyo-night"),ca=A(require("@uiw/react-codemirror"),1);var K=A(require("@radix-ui/react-popover"),1),y=A(require("react"),1);var se=require("react/jsx-runtime"),aa=y.createContext(null),Ue=({children:e,...a})=>{let[t,o]=y.useState(!1);return(0,se.jsx)(aa.Provider,{value:{open:t,setOpen:o},children:(0,se.jsx)(K.Root,{open:t,onOpenChange:o,...a,children:e})})};Ue.displayName="PopoverCell";var He=y.forwardRef(({children:e,onDoubleClick:a,className:t,...o},l)=>{let m=y.useContext(aa),[r,f]=y.useState(!1),C=y.useRef(null);return y.useEffect(()=>{let R=ie=>{let O=ie.target;C.current&&!C.current.contains(O)&&(console.log("Outside click - removing focus"),f(!1))};return document.addEventListener("click",R),()=>document.removeEventListener("click",R)},[]),(0,se.jsx)(K.Trigger,{ref:R=>{typeof l=="function"?l(R):l&&(l.current=R),C.current=R},onClick:R=>{R.preventDefault(),console.log("Click handler - setting focus to true"),f(!0)},onDoubleClick:R=>{R.preventDefault(),m?.setOpen(!0),a?.()},"data-focus":r.toString(),className:u("w-full h-full cursor-pointer",t),...o,children:e})});He.displayName="PopoverCellTrigger";var Oe=y.forwardRef(({className:e,align:a="center",sideOffset:t=4,...o},l)=>(0,se.jsx)(K.Portal,{children:(0,se.jsx)(K.Content,{ref:l,align:a,sideOffset:t,className:u("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));Oe.displayName=K.Content.displayName;var De=require("react");var ta=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ye=(...e)=>e.filter((a,t,o)=>!!a&&o.indexOf(a)===t).join(" ");var pe=require("react");var oa={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var la=(0,pe.forwardRef)(({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:l="",children:m,iconNode:r,...f},C)=>(0,pe.createElement)("svg",{ref:C,...oa,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:ye("lucide",l),...f},[...r.map(([S,b])=>(0,pe.createElement)(S,b)),...Array.isArray(m)?m:[m]]));var L=(e,a)=>{let t=(0,De.forwardRef)(({className:o,...l},m)=>(0,De.createElement)(la,{ref:m,iconNode:a,className:ye(`lucide-${ta(e)}`,o),...l}));return t.displayName=`${e}`,t};var $=L("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);var me=L("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);var Z=L("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var re=L("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var Le=L("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var J=L("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var xe=L("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var Ie=L("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);var Ce=L("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var oe=L("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var ge=L("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var Y=L("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);var he=L("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);var Se=L("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);var Pe=L("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var sa=require("react");var i=A(require("@radix-ui/react-context-menu"),1);var Q=A(require("react"),1);var w=require("react/jsx-runtime"),ua=i.Root,da=i.Trigger;var Za=Q.forwardRef(({className:e,inset:a,children:t,...o},l)=>(0,w.jsxs)(i.SubTrigger,{ref:l,className:u("ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[state=open]:ps-bg-accent data-[state=open]:ps-text-accent-foreground",a&&"ps-pl-8",e),...o,children:[t,(0,w.jsx)(J,{className:"ps-ml-auto ps-h-4 ps-w-4"})]}));Za.displayName=i.SubTrigger.displayName;var Ja=Q.forwardRef(({className:e,...a},t)=>(0,w.jsx)(i.SubContent,{ref:t,className:u("ps-z-50 ps-min-w-[8rem] ps-overflow-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-lg data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-context-menu-content-transform-origin]",e),...a}));Ja.displayName=i.SubContent.displayName;var Ne=Q.forwardRef(({className:e,...a},t)=>(0,w.jsx)(i.Portal,{children:(0,w.jsx)(i.Content,{ref:t,className:u("ps-z-50 ps-max-h-[--radix-context-menu-content-available-height] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-md data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-context-menu-content-transform-origin]",e),...a})}));Ne.displayName=i.Content.displayName;var Ee=Q.forwardRef(({className:e,inset:a,...t},o)=>(0,w.jsx)(i.Item,{ref:o,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",a&&"ps-pl-8",e),...t}));Ee.displayName=i.Item.displayName;var Qa=Q.forwardRef(({className:e,children:a,checked:t,...o},l)=>(0,w.jsxs)(i.CheckboxItem,{ref:l,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),checked:t,...o,children:[(0,w.jsx)("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,w.jsx)(i.ItemIndicator,{children:(0,w.jsx)(Z,{className:"ps-h-4 ps-w-4"})})}),a]}));Qa.displayName=i.CheckboxItem.displayName;var _a=Q.forwardRef(({className:e,children:a,...t},o)=>(0,w.jsxs)(i.RadioItem,{ref:o,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[(0,w.jsx)("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,w.jsx)(i.ItemIndicator,{children:(0,w.jsx)(oe,{className:"ps-h-4 ps-w-4 ps-fill-current"})})}),a]}));_a.displayName=i.RadioItem.displayName;var ja=Q.forwardRef(({className:e,inset:a,...t},o)=>(0,w.jsx)(i.Label,{ref:o,className:u("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold ps-text-foreground",a&&"ps-pl-8",e),...t}));ja.displayName=i.Label.displayName;var $a=Q.forwardRef(({className:e,...a},t)=>(0,w.jsx)(i.Separator,{ref:t,className:u("ps--mx-1 ps-my-1 ps-h-px ps-bg-border",e),...a}));$a.displayName=i.Separator.displayName;var Ya=({className:e,...a})=>(0,w.jsx)("span",{className:u("ps-ml-auto ps-text-xs ps-tracking-widest ps-text-muted-foreground",e),...a});Ya.displayName="ContextMenuShortcut";var le=require("react/jsx-runtime"),Ge=e=>{if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(e==null)return"";if((0,sa.isValidElement)(e)){let a=e.props;return e.type&&typeof e.type=="function"&&e.type.name==="RevealText"?a.text||"":e.type&&typeof e.type=="function"&&e.type.name==="NullValue"?"NULL":a.children?Ge(a.children):""}return Array.isArray(e)?e.map(Ge).join(""):""},ra=({children:e})=>(0,le.jsxs)(ua,{children:[(0,le.jsx)(da,{className:"ps-block ps-w-full ps-p-[var(--studio-cell-spacing)]",children:e}),(0,le.jsx)(Ne,{children:(0,le.jsxs)(Ee,{onClick:()=>{let a=Ge(e);navigator.clipboard.writeText(a).catch(t=>{console.error("Failed to copy to clipboard:",t)})},className:"ps-flex ps-items-center ps-gap-2",children:[(0,le.jsx)(ge,{size:12}),"Copy"]})})]});var ia=require("react/jsx-runtime");function fa(){return(0,ia.jsx)("code",{className:"ps-text-gray-500",children:"NULL"})}var _=require("react/jsx-runtime");function pa({cell:e,getPinningStyles:a,dataType:t,isRelational:o,relatesTo:l,relationField:m}){let r=e.getValue(),f=r==null,C=S=>{if(S==null)return"NULL";if(typeof S=="object")try{return JSON.stringify(S,null,2)}catch(b){return console.error("Error stringifying value:",b),String(S)}return String(S)};return(0,_.jsxs)(Ue,{children:[(0,_.jsx)(He,{asChild:!0,children:(0,_.jsx)(ce,{...a(e.column),"data-cell-type":"data","data-type":t.toLowerCase(),"data-relational":o?"true":void 0,"data-relates-to":l,"data-relation-field":m,className:u(a(e.column).className,"ps-p-0",e.column.getIsPinned()&&"ps-sticky"),children:(0,_.jsx)(ra,{children:f?(0,_.jsx)(fa,{}):C(r)})})}),(0,_.jsx)(Oe,{align:"start",alignOffset:0,sideOffset:0,className:"ps-min-w-(--radix-popover-trigger-width) ps-rounded-none ps-bg-muted ps-p-0",children:(0,_.jsx)(ca.default,{value:C(r),theme:na.tokyoNight,height:"100px",basicSetup:{lineNumbers:!0,foldGutter:!1,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!1},onChange:S=>{console.log("New value:",S)}})})]},e.id)}var La=require("react/jsx-runtime");function ma({cell:e,getPinningStyles:a,dataType:t}){let o={cell:e,getPinningStyles:a},l=e.column.columnDef.meta,m={...o,isRelational:l?.isRelational,relatesTo:l?.relatesTo,relationField:l?.relationField};return(0,La.jsx)(pa,{...m,dataType:t||"STRING"})}var Pa=require("@tanstack/react-table");var xa=require("@radix-ui/react-slot"),Ia=require("class-variance-authority"),Ca=A(require("react"),1);var ga=require("react/jsx-runtime"),et=(0,Ia.cva)("ps-inline-flex ps-items-center ps-justify-center ps-gap-2 ps-whitespace-nowrap ps-rounded-md ps-text-sm ps-font-medium ps-transition-colors focus-visible:ps-outline-none focus-visible:ps-ring-1 focus-visible:ps-ring-ring disabled:ps-pointer-events-none disabled:ps-opacity-50 [&_svg]:ps-pointer-events-none [&_svg]:ps-size-4 [&_svg]:ps-shrink-0",{variants:{variant:{default:"ps-bg-primary ps-text-primary-foreground ps-shadow hover:ps-bg-primary/90",destructive:"ps-bg-destructive ps-text-destructive-foreground ps-shadow-sm hover:ps-bg-destructive/90",outline:"ps-border ps-border-input ps-bg-background ps-shadow-sm hover:ps-bg-accent hover:ps-text-accent-foreground",secondary:"ps-bg-secondary ps-text-secondary-foreground ps-shadow-sm hover:ps-bg-secondary/80",ghost:"hover:ps-bg-accent hover:ps-text-accent-foreground",link:"ps-text-primary ps-underline-offset-4 hover:ps-underline"},size:{default:"ps-h-9 ps-px-4 ps-py-2",sm:"ps-h-8 ps-rounded-md ps-px-3 ps-text-xs",lg:"ps-h-10 ps-rounded-md ps-px-8",icon:"ps-h-9 ps-w-9"}},defaultVariants:{variant:"default",size:"default"}}),V=Ca.forwardRef(({className:e,variant:a,size:t,asChild:o=!1,...l},m)=>(0,ga.jsx)(o?xa.Slot:"button",{className:u(et({variant:a,size:t,className:e})),ref:m,...l}));V.displayName="Button";var n=A(require("@radix-ui/react-dropdown-menu"),1);var j=A(require("react"),1);var k=require("react/jsx-runtime"),ha=n.Root,Sa=n.Trigger;var at=j.forwardRef(({className:e,inset:a,children:t,...o},l)=>(0,k.jsxs)(n.SubTrigger,{ref:l,className:u("ps-flex ps-cursor-default ps-select-none ps-items-center ps-gap-2 ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent data-[state=open]:ps-bg-accent [&_svg]:ps-pointer-events-none [&_svg]:ps-size-4 [&_svg]:ps-shrink-0",a&&"ps-pl-8",e),...o,children:[t,(0,k.jsx)(J,{className:"ps-ml-auto"})]}));at.displayName=n.SubTrigger.displayName;var tt=j.forwardRef(({className:e,...a},t)=>(0,k.jsx)(n.SubContent,{ref:t,className:u("ps-z-50 ps-min-w-[8rem] ps-overflow-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-lg data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-dropdown-menu-content-transform-origin]",e),...a}));tt.displayName=n.SubContent.displayName;var ze=j.forwardRef(({className:e,sideOffset:a=4,...t},o)=>(0,k.jsx)(n.Portal,{children:(0,k.jsx)(n.Content,{ref:o,sideOffset:a,className:u("ps-z-50 ps-max-h-[var(--radix-dropdown-menu-content-available-height)] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-md","data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-dropdown-menu-content-transform-origin]",e),...t})}));ze.displayName=n.Content.displayName;var Te=j.forwardRef(({className:e,inset:a,...t},o)=>(0,k.jsx)(n.Item,{ref:o,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-gap-2 ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50 [&>svg]:ps-size-4 [&>svg]:ps-shrink-0",a&&"ps-pl-8",e),...t}));Te.displayName=n.Item.displayName;var ot=j.forwardRef(({className:e,children:a,checked:t,...o},l)=>(0,k.jsxs)(n.CheckboxItem,{ref:l,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),checked:t,...o,children:[(0,k.jsx)("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,k.jsx)(n.ItemIndicator,{children:(0,k.jsx)(Z,{className:"ps-h-4 ps-w-4"})})}),a]}));ot.displayName=n.CheckboxItem.displayName;var lt=j.forwardRef(({className:e,children:a,...t},o)=>(0,k.jsxs)(n.RadioItem,{ref:o,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[(0,k.jsx)("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,k.jsx)(n.ItemIndicator,{children:(0,k.jsx)(oe,{className:"ps-h-2 ps-w-2 ps-fill-current"})})}),a]}));lt.displayName=n.RadioItem.displayName;var ut=j.forwardRef(({className:e,inset:a,...t},o)=>(0,k.jsx)(n.Label,{ref:o,className:u("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold",a&&"ps-pl-8",e),...t}));ut.displayName=n.Label.displayName;var dt=j.forwardRef(({className:e,...a},t)=>(0,k.jsx)(n.Separator,{ref:t,className:u("ps--mx-1 ps-my-1 ps-h-px ps-bg-muted",e),...a}));dt.displayName=n.Separator.displayName;var st=({className:e,...a})=>(0,k.jsx)("span",{className:u("ps-ml-auto ps-text-xs ps-tracking-widest ps-opacity-60",e),...a});st.displayName="DropdownMenuShortcut";var x=require("react/jsx-runtime");function Ve({header:e}){let a=e.column.columnDef.meta,t=a?.dataType,o=a?.isRelational;return(0,x.jsxs)("div",{className:"ps-flex ps-items-center ps-justify-between ps-w-full ps-h-full",children:[(0,x.jsxs)("div",{className:"ps-flex-1 ps-flex ps-items-center ps-justify-between",children:[o&&(0,x.jsx)(he,{size:14,className:"text-blue-700"}),(0,x.jsxs)("div",{className:"ps-align-text-bottom ps-leading-none ps-h-[20px]",children:[(0,x.jsx)("span",{className:"ps-inline-block ps-text-foreground ps-font-bold ps-text-sm",children:e.isPlaceholder?null:(0,Pa.flexRender)(e.column.columnDef.header,e.getContext())}),t&&t!=="NONE"&&(0,x.jsx)("span",{className:"ps-inline-block ps-ml-2 ps-text-xs ps-font-mono ps-text-muted-foreground/70 ps-lowercase",children:t})]}),(0,x.jsx)("span",{className:"ps-flex ps-items-center ps-gap-1",children:e.column.getCanPin()&&e.column.id!=="select"&&(0,x.jsxs)(ha,{children:[(0,x.jsx)(Sa,{asChild:!0,children:(0,x.jsx)(V,{variant:"ghost",size:"icon",children:(0,x.jsx)(Y,{size:16})})}),(0,x.jsxs)(ze,{children:[e.column.getCanSort()&&(0,x.jsx)(Te,{onClick:()=>e.column.toggleSorting(e.column.getIsSorted()==="asc"),children:(0,x.jsxs)("span",{className:"ps-flex ps-items-center ps-gap-2",children:[e.column.getIsSorted()==="asc"?(0,x.jsx)($,{size:16}):(0,x.jsx)(me,{size:16}),e.column.getIsSorted()==="asc"?"Sort descending":"Sort ascending"]})}),(0,x.jsx)(Te,{onClick:()=>e.column.pin(e.column.getIsPinned()?!1:"left"),children:e.column.getIsPinned()?(0,x.jsxs)("span",{className:"ps-flex ps-items-center ps-gap-2",children:[(0,x.jsx)(Se,{size:16}),"Unpin column"]}):(0,x.jsxs)("span",{className:"ps-flex ps-items-center ps-gap-2",children:[(0,x.jsx)(Pe,{size:16}),"Pin column"]})})]})]})})]}),e.column.getCanResize()&&(0,x.jsx)("button",{type:"button",tabIndex:0,onMouseDown:l=>{l.stopPropagation(),e.getResizeHandler()(l)},onTouchStart:l=>{l.stopPropagation(),e.getResizeHandler()(l)},onClick:l=>l.stopPropagation(),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),l.stopPropagation(),e.getResizeHandler()(l))},className:u("ps-absolute ps-right-0 ps-top-0 ps-h-full ps-w-3 ps-cursor-col-resize","ps-select-none ps-touch-none ps-transition-colors ps-group","ps-border-0 ps-bg-transparent",e.column.getIsResizing()&&"ps-bg-gray-300","before:ps-absolute before:ps-right-[3px] before:ps-top-1/2 before:ps--translate-y-1/2","after:ps-absolute after:ps-right-[7px] after:ps-top-1/2 after:ps--translate-y-1/2","before:ps-w-[2px] before:ps-h-0 before:ps-bg-gray-400 before:ps-rounded-full before:ps-opacity-0","after:ps-w-[2px] after:ps-h-0 after:ps-bg-gray-400 after:ps-rounded-full after:ps-opacity-0","before:ps-transition-all before:ps-duration-200","after:ps-transition-all after:ps-duration-200","group-hover:before:ps-opacity-100","group-hover:after:ps-opacity-100","group-hover:before:ps-h-4","group-hover:after:ps-h-4","group-active:ps-bg-transparent group-active:before:ps-bg-white group-active:after:ps-bg-white",e.column.getIsResizing()&&"before:ps-opacity-100"),"aria-label":"Resize column"})]})}var wa=A(require("react"),1);var ka=require("react/jsx-runtime"),We=wa.forwardRef(({className:e,type:a,...t},o)=>(0,ka.jsx)("input",{type:a,className:u("ps-flex ps-h-9 ps-w-full ps-rounded-md ps-border ps-border-input ps-bg-transparent ps-px-3 ps-py-1 ps-text-base ps-shadow-sm ps-transition-colors file:ps-border-0 file:ps-bg-transparent file:ps-text-sm file:ps-font-medium file:ps-text-foreground placeholder:ps-text-muted-foreground focus-visible:ps-outline-none focus-visible:ps-ring-1 focus-visible:ps-ring-ring disabled:ps-cursor-not-allowed disabled:ps-opacity-50 md:ps-text-sm",e),ref:o,...t}));We.displayName="Input";var c=A(require("@radix-ui/react-select"),1);var ee=A(require("react"),1);var h=require("react/jsx-runtime"),ba=c.Root;var Ra=c.Value,Xe=ee.forwardRef(({className:e,children:a,...t},o)=>(0,h.jsxs)(c.Trigger,{ref:o,className:u("ps-flex ps-h-9 ps-w-full ps-items-center ps-justify-between ps-whitespace-nowrap ps-rounded-md ps-border ps-border-input ps-bg-transparent ps-px-3 ps-py-2 ps-text-sm ps-shadow-sm ps-ring-offset-background data-[placeholder]:ps-text-muted-foreground focus:ps-outline-none focus:ps-ring-1 focus:ps-ring-ring disabled:ps-cursor-not-allowed disabled:ps-opacity-50 [&>span]:ps-line-clamp-1",e),...t,children:[a,(0,h.jsx)(c.Icon,{asChild:!0,children:(0,h.jsx)(re,{className:"ps-h-4 ps-w-4 ps-opacity-50"})})]}));Xe.displayName=c.Trigger.displayName;var Ma=ee.forwardRef(({className:e,...a},t)=>(0,h.jsx)(c.ScrollUpButton,{ref:t,className:u("ps-flex ps-cursor-default ps-items-center ps-justify-center ps-py-1",e),...a,children:(0,h.jsx)(xe,{className:"ps-h-4 ps-w-4"})}));Ma.displayName=c.ScrollUpButton.displayName;var va=ee.forwardRef(({className:e,...a},t)=>(0,h.jsx)(c.ScrollDownButton,{ref:t,className:u("ps-flex ps-cursor-default ps-items-center ps-justify-center ps-py-1",e),...a,children:(0,h.jsx)(re,{className:"ps-h-4 ps-w-4"})}));va.displayName=c.ScrollDownButton.displayName;var Ke=ee.forwardRef(({className:e,children:a,position:t="popper",...o},l)=>(0,h.jsx)(c.Portal,{children:(0,h.jsxs)(c.Content,{ref:l,className:u("ps-relative ps-z-50 ps-max-h-[--radix-select-content-available-height] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-text-popover-foreground ps-shadow-md data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-select-content-transform-origin]",t==="popper"&&"data-[side=bottom]:ps-translate-y-1 data-[side=left]:ps--translate-x-1 data-[side=right]:ps-translate-x-1 data-[side=top]:ps--translate-y-1",e),position:t,...o,children:[(0,h.jsx)(Ma,{}),(0,h.jsx)(c.Viewport,{className:u("ps-p-1",t==="popper"&&"ps-h-[var(--radix-select-trigger-height)] ps-w-full ps-min-w-[var(--radix-select-trigger-width)]"),children:a}),(0,h.jsx)(va,{})]})}));Ke.displayName=c.Content.displayName;var rt=ee.forwardRef(({className:e,...a},t)=>(0,h.jsx)(c.Label,{ref:t,className:u("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold",e),...a}));rt.displayName=c.Label.displayName;var Ze=ee.forwardRef(({className:e,children:a,...t},o)=>(0,h.jsxs)(c.Item,{ref:o,className:u("ps-relative ps-flex ps-w-full ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-2 ps-pr-8 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[(0,h.jsx)("span",{className:"ps-absolute ps-right-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,h.jsx)(c.ItemIndicator,{children:(0,h.jsx)(Z,{className:"ps-h-4 ps-w-4"})})}),(0,h.jsx)(c.ItemText,{children:a})]}));Ze.displayName=c.Item.displayName;var ft=ee.forwardRef(({className:e,...a},t)=>(0,h.jsx)(c.Separator,{ref:t,className:u("ps--mx-1 ps-my-1 ps-h-px ps-bg-muted",e),...a}));ft.displayName=c.Separator.displayName;var I=require("react/jsx-runtime"),it=[10,20,50,100];function ya({table:e,variant:a="basic",className:t}){let{pageSize:o,pageIndex:l}=e.getState().pagination,m=e.getPageCount();return(0,I.jsx)("div",{className:u("ps-flex ps-items-center ps-justify-between ps-space-x-2 ps-py-4 ps-px-4",t),children:a==="basic"?(0,I.jsxs)("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[(0,I.jsx)(V,{variant:"outline",size:"sm",className:"ps-h-9",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:"Previous"}),(0,I.jsx)(V,{variant:"outline",size:"sm",className:"ps-h-9",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:"Next"})]}):(0,I.jsxs)("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[(0,I.jsxs)("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[(0,I.jsx)(V,{variant:"outline",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:(0,I.jsx)(Ie,{className:"ps-w-4 ps-h-4"})}),(0,I.jsx)(V,{variant:"outline",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:(0,I.jsx)(Le,{className:"ps-w-4 ps-h-4"})}),(0,I.jsxs)("div",{className:"ps-flex ps-items-center ps-gap-1 ps-text-xs ps-font-medium",children:["Page",(0,I.jsx)(We,{type:"number",min:1,max:m,value:l+1,className:"ps-w-12",onChange:r=>{let f=r.target.value?Number(r.target.value)-1:0;e.setPageIndex(f)}}),(0,I.jsxs)("span",{className:"ps-shrink-0 ps-w-max",children:["of ",m]})]}),(0,I.jsx)(V,{variant:"outline",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:(0,I.jsx)(J,{className:"ps-w-4 ps-h-4"})}),(0,I.jsx)(V,{variant:"outline",onClick:()=>e.setPageIndex(m-1),disabled:!e.getCanNextPage(),children:(0,I.jsx)(Ce,{className:"ps-w-4 ps-h-4"})})]}),(0,I.jsxs)(ba,{value:o.toString(),onValueChange:r=>e.setPageSize(Number(r)),children:[(0,I.jsx)(Xe,{children:(0,I.jsx)(Ra,{})}),(0,I.jsx)(Ke,{children:it.map(r=>(0,I.jsxs)(Ze,{value:r.toString(),children:[r," per page"]},r))})]})]})})}var we=e=>{let a=e.getIsPinned(),t=a==="left"&&e.getIsLastColumn("left"),o=a==="right"&&e.getIsFirstColumn("right");return{className:u("ps-overflow-hidden ps-whitespace-nowrap ps-text-ellipsis",a&&["ps-sticky ps-bg-background ps-shadow-[1px_0_0_0_hsl(var(--border))]",a==="left"?"ps-left-0":"ps-right-0","ps-z-20"],!a&&"ps-relative ps-z-10",t&&"ps-shadow-[1px_0_0_0_hsl(var(--border))]",o&&"ps-shadow-[-1px_0_0_0_hsl(var(--border))]"),style:{width:e.getSize(),left:a==="left"?`${e.getStart("left")}px`:void 0,right:a==="right"?`${e.getAfter("right")}px`:void 0}}};var p=require("react/jsx-runtime"),nt=({_table:e})=>{let{currentTable:a,isLoaded:t}=Me();return t?(0,p.jsx)("div",{className:"ps-flex ps-items-center ps-justify-between ps-w-full ps-gap-2",children:(0,p.jsx)("div",{className:"ps-flex ps-items-center ps-gap-2",children:(0,p.jsx)("span",{className:"ps-flex ps-items-center ps-gap-2",children:(0,p.jsx)("h1",{className:"ps-text-sm ps-font-medium",children:a?.name})})})}):null},ct=({header:e,children:a,getPinningStyles:t})=>{let{attributes:o,listeners:l,transform:m,transition:r,setNodeRef:f,isDragging:C,isOver:S}=(0,fe.useSortable)({id:e.id}),b=e.column.columnDef.meta,R={transform:Da.CSS.Transform.toString(m),transition:r,...t(e.column).style,cursor:"grab",touchAction:"none"};return(0,p.jsxs)(ve,{ref:f,...o,...l,style:R,"data-relational":b?.isRelational?"true":void 0,"data-relates-to":b?.relatesTo,"data-relation-field":b?.relationField,className:u("ps-group",t(e.column).className,C&&"ps-opacity-50",S&&"ps-bg-gray-100","ps-select-none ps-touch-none ps-relative",e.column.getIsPinned()&&"ps-sticky"),children:[a,S&&(0,p.jsx)("div",{className:"ps-absolute ps-inset-0 ps-border-2 ps-border-primary ps-rounded-sm ps-pointer-events-none"})]})};function Ta({data:e=[],columns:a}){console.log("Data received in StudioGrid:",e);let[t,o]=(0,N.useState)([]),[l,m]=(0,N.useState)([]),[r,f]=(0,N.useState)({}),[C,S]=(0,N.useState)({left:[],right:[]}),[b,R]=(0,N.useState)([]),[ie,O]=(0,N.useState)("");(0,N.useEffect)(()=>{if(a&&a.length>0){let g=a.map(q=>q.id);if(b.length===0){R(g);return}let d=[...b],P=d.filter(q=>!a.some(G=>G.id===q));P.forEach(q=>{let G=d.indexOf(q);G!==-1&&d.splice(G,1)});let T=g.filter(q=>!d.includes(q));T.length>0&&d.push(...T),(P.length>0||T.length>0)&&R(d)}},[a,b]);let D=(0,ae.useSensor)(ae.MouseSensor,{activationConstraint:{distance:10}}),B=(0,ae.useSensors)(D),F=g=>{let{active:d,over:P}=g;if(P&&d.id!==P.id){let T=M.getColumn(d.id),q=M.getColumn(P.id);if(!T||!q)return;let G=T.getIsPinned(),de=q.getIsPinned();if(G!==de)return;let ke=b.indexOf(d.id),be=b.indexOf(P.id);if(ke===-1||be===-1)return;let Ae=[...b];Ae.splice(ke,1),Ae.splice(be,0,d.id),R(Ae)}},E=(0,N.useMemo)(()=>{if(!a||a.length===0)return console.log("No columns configuration available"),[];let g=(d,P)=>{if(d==null)return"";switch(P){case"TIMESTAMP":return d?new Date(d).toLocaleString():"";case"UUID":case"STRING":return String(d);default:return String(d)}};return a.map(d=>({accessorKey:d.id,header:()=>(0,p.jsx)("div",{className:"ps-font-medium",children:d.id}),cell:({getValue:P})=>g(P(),d.type),meta:{dataType:d.type,isRelational:d.isRelational,relatesTo:d.relatesTo,relationField:d.relationField}}))},[a]),M=(0,W.useReactTable)({data:e||[],defaultColumn:{size:200,minSize:50,maxSize:500},columns:E,getCoreRowModel:(0,W.getCoreRowModel)(),onSortingChange:o,getSortedRowModel:(0,W.getSortedRowModel)(),getPaginationRowModel:(0,W.getPaginationRowModel)(),getFilteredRowModel:(0,W.getFilteredRowModel)(),onColumnFiltersChange:m,enableColumnResizing:!0,columnResizeMode:"onChange",onColumnSizingChange:f,enableColumnPinning:!0,onColumnPinningChange:S,onGlobalFilterChange:O,globalFilterFn:(g,d,P)=>{let T=g.getValue(d);return T==null?!1:String(T).toLowerCase().includes(String(P).toLowerCase())},state:{sorting:t,columnFilters:l,columnSizing:r,columnPinning:C,columnOrder:b,globalFilter:ie}});return!e||e.length===0?(0,p.jsxs)("div",{className:"ps-p-4 ps-border ps-rounded-md ps-w-full",children:[(0,p.jsx)("p",{className:"ps-text-lg ps-font-semibold",children:"No data available."}),(0,p.jsx)("p",{className:"ps-text-sm ps-text-gray-500",children:e?"Data array is empty.":"Data is undefined."})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"ps-bg-studio-header-background ps-flex ps-w-full ps-p-2 ps-py-3 ps-border-b",children:(0,p.jsx)(nt,{_table:M})}),(0,p.jsx)("div",{"data-studio":"content",className:"ps-flex-1 ps-w-0 ps-h-0 ps-min-w-full",children:(0,p.jsxs)("div",{className:"ps-flex ps-flex-col ps-w-full ps-h-full ps-overflow-scroll",children:[(0,p.jsx)(ae.DndContext,{sensors:B,onDragEnd:F,children:(0,p.jsxs)(Be,{children:[(0,p.jsx)(Fe,{children:M.getHeaderGroups().map(g=>(0,p.jsx)(ne,{className:u("ps-relative",M.getLeftLeafHeaders().some(d=>d.column.getIsPinned()==="left")&&`ps-pl-[${M.getLeftLeafHeaders().filter(d=>d.column.getIsPinned()==="left").reduce((d,P)=>d+P.getSize(),0)}px]`),children:(0,p.jsx)(fe.SortableContext,{items:g.headers.map(d=>d.id),strategy:fe.horizontalListSortingStrategy,children:g.headers.map(d=>d.column.id==="select"?(0,p.jsx)(ve,{className:u("ps-px-[var(--studio-cell-spacing)]",we(d.column).className,d.column.getIsPinned()&&"ps-sticky"),style:we(d.column).style,"data-cell-type":"select",children:(0,p.jsx)(Ve,{header:d})},d.id):(0,p.jsx)(ct,{header:d,table:M,getPinningStyles:we,children:(0,p.jsx)(Ve,{header:d})},d.id))})},g.id))}),(0,p.jsx)(qe,{children:M.getRowModel().rows?.length?M.getRowModel().rows.map(g=>(0,p.jsx)(ne,{className:u("ps-bg-table-row ps-odd:bg-table-row-odd ps-group"),children:g.getVisibleCells().map(d=>(0,p.jsx)(ma,{cell:d,getPinningStyles:we,dataType:a.find(P=>P.id===d.column.id)?.type},d.id))},g.id)):(0,p.jsx)(ne,{children:(0,p.jsx)(ce,{colSpan:a.length,className:"ps-h-24 ps-text-center",children:"No results."})})})]})}),(0,p.jsx)(ya,{table:M,variant:"numeric"})]})})]})}var ue=require("react"),Ba=require("react/jsx-runtime"),pt={theme:"system",setTheme:()=>null},mt=(0,ue.createContext)(pt);function Aa({children:e,defaultTheme:a="system",storageKey:t="vite-ui-theme",...o}){let[l,m]=(0,ue.useState)(()=>localStorage.getItem(t)||a);(0,ue.useEffect)(()=>{let f=window.document.documentElement;if(f.classList.remove("light","dark"),l==="system"){let C=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(C);return}f.classList.add(l)},[l]);let r={theme:l,setTheme:f=>{localStorage.setItem(t,f),m(f)}};return(0,Ba.jsx)(mt.Provider,{...o,value:r,children:e})}var H=require("react/jsx-runtime"),qa=(0,v.createContext)(void 0),Me=()=>{let e=(0,v.useContext)(qa);if(!e)throw new Error("useStudio must be used within a Studio.Provider");return e},Lt={integer:"INTEGER",varchar:"VARCHAR",text:"TEXT",enum:"STRING",boolean:"BOOLEAN"};function xt(e,a){return{id:e,accessorKey:e,header:e.charAt(0).toUpperCase()+e.slice(1),type:Lt[a.dataType.name]||"STRING",nullable:a.nullable,isKey:a.partOfPk}}var It=({adapter:e})=>{let[a,t]=(0,v.useState)([]),[o,l]=(0,v.useState)(null),[m,r]=(0,v.useState)(!1),[f,C]=(0,v.useState)([]),[S,b]=(0,v.useState)([]),R=v.default.useMemo(()=>new Set(a.filter(O=>O.isFavorite).map(O=>O.id)),[a]),ie=O=>{t(D=>D.map(B=>B.id===O?{...B,isFavorite:!B.isFavorite}:B))};return(0,v.useEffect)(()=>{(async()=>{try{let[D,B]=await e.introspect();if(D||!B?.schemas){console.error("Error fetching schema:",D);return}let F=Object.entries(B.schemas).flatMap(([E,M])=>Object.entries(M.tables).map(([g])=>({id:`${E}.${g}`,name:g.charAt(0).toUpperCase()+g.slice(1),schema:E,isFavorite:!1})));t(F),!o&&F.length>0&&F[0]&&l(F[0])}catch(D){console.error("Error fetching tables:",D)}})()},[e,o]),(0,v.useEffect)(()=>{(async()=>{if(!o?.id){r(!0);return}try{r(!1);let[D,B]=await e.introspect();if(D||!B?.schemas){console.error("Error fetching schema:",D),r(!0);return}let[F,E]=o.id.split(".");if(!F||!E){console.error("Invalid table ID format:",o.id),r(!0);return}let M=B.schemas[F];if(!M){console.error(`Schema ${F} not found`),r(!0);return}let g=M.tables[E];if(!g){console.error(`Table ${E} not found in schema ${F}`),r(!0);return}let d=Object.entries(g.columns).map(([G,de])=>xt(G,de));b(d);let[P,T]=await e.query({schema:F,table:E,filters:[],sortings:[]});if(P||!T){console.error(`Failed to fetch data for table ${E}:`,P),r(!0);return}let q=T.rows.map(G=>{let de={};return Object.entries(G).forEach(([ke,be])=>{de[ke]=be.value}),de});C(q),r(!0)}catch(D){console.error("Error fetching table data:",D),r(!0)}})()},[e,o]),e?!m&&a.length===0?(0,H.jsx)("div",{children:"Loading available tables..."}):m&&a.length===0?(0,H.jsx)("div",{children:"No tables found in the database."}):(0,H.jsx)(Aa,{children:(0,H.jsx)(Fa.NuqsAdapter,{children:(0,H.jsx)(qa.Provider,{value:{adapter:e,currentTable:o,isLoaded:m,tables:a,favoriteTableIds:R,setCurrentTable:l,toggleFavorite:ie},children:(0,H.jsxs)("div",{className:"ps-flex ps-gap-4 ps-w-full ps-rounded-sm ps-bg-background ps-p-4 ps-relative",children:[(0,H.jsx)(ea,{}),(0,H.jsx)("div",{className:"ps-flex ps-w-full ps-flex-col ps-border ps-rounded-lg",children:(0,H.jsx)(Ta,{columns:S,data:f})})]})})})}):(console.error("No adapter provided to Studio component"),(0,H.jsx)("div",{children:"Error: No adapter provided"}))},Je=It;0&&(module.exports={Studio});
2
+ /*! Bundled license information:
3
+
4
+ lucide-react/dist/esm/shared/src/utils.js:
5
+ (**
6
+ * @license lucide-react v0.427.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ *)
11
+
12
+ lucide-react/dist/esm/defaultAttributes.js:
13
+ (**
14
+ * @license lucide-react v0.427.0 - ISC
15
+ *
16
+ * This source code is licensed under the ISC license.
17
+ * See the LICENSE file in the root directory of this source tree.
18
+ *)
19
+
20
+ lucide-react/dist/esm/Icon.js:
21
+ (**
22
+ * @license lucide-react v0.427.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ *)
27
+
28
+ lucide-react/dist/esm/createLucideIcon.js:
29
+ (**
30
+ * @license lucide-react v0.427.0 - ISC
31
+ *
32
+ * This source code is licensed under the ISC license.
33
+ * See the LICENSE file in the root directory of this source tree.
34
+ *)
35
+
36
+ lucide-react/dist/esm/icons/arrow-down-wide-narrow.js:
37
+ (**
38
+ * @license lucide-react v0.427.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ *)
43
+
44
+ lucide-react/dist/esm/icons/arrow-up-wide-narrow.js:
45
+ (**
46
+ * @license lucide-react v0.427.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ *)
51
+
52
+ lucide-react/dist/esm/icons/check.js:
53
+ (**
54
+ * @license lucide-react v0.427.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ *)
59
+
60
+ lucide-react/dist/esm/icons/chevron-down.js:
61
+ (**
62
+ * @license lucide-react v0.427.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ *)
67
+
68
+ lucide-react/dist/esm/icons/chevron-left.js:
69
+ (**
70
+ * @license lucide-react v0.427.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ *)
75
+
76
+ lucide-react/dist/esm/icons/chevron-right.js:
77
+ (**
78
+ * @license lucide-react v0.427.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ *)
83
+
84
+ lucide-react/dist/esm/icons/chevron-up.js:
85
+ (**
86
+ * @license lucide-react v0.427.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ *)
91
+
92
+ lucide-react/dist/esm/icons/chevrons-left.js:
93
+ (**
94
+ * @license lucide-react v0.427.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ *)
99
+
100
+ lucide-react/dist/esm/icons/chevrons-right.js:
101
+ (**
102
+ * @license lucide-react v0.427.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ *)
107
+
108
+ lucide-react/dist/esm/icons/circle.js:
109
+ (**
110
+ * @license lucide-react v0.427.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ *)
115
+
116
+ lucide-react/dist/esm/icons/copy.js:
117
+ (**
118
+ * @license lucide-react v0.427.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ *)
123
+
124
+ lucide-react/dist/esm/icons/ellipsis.js:
125
+ (**
126
+ * @license lucide-react v0.427.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ *)
131
+
132
+ lucide-react/dist/esm/icons/link.js:
133
+ (**
134
+ * @license lucide-react v0.427.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ *)
139
+
140
+ lucide-react/dist/esm/icons/pin-off.js:
141
+ (**
142
+ * @license lucide-react v0.427.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ *)
147
+
148
+ lucide-react/dist/esm/icons/pin.js:
149
+ (**
150
+ * @license lucide-react v0.427.0 - ISC
151
+ *
152
+ * This source code is licensed under the ISC license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ *)
155
+
156
+ lucide-react/dist/esm/lucide-react.js:
157
+ (**
158
+ * @license lucide-react v0.427.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ *)
163
+ */
@@ -1,5 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+ import { A as Adapter } from '../Adapter-C2FVF4Hg.cjs';
1
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
 
3
- declare function HelloWorld(): react_jsx_runtime.JSX.Element;
5
+ interface StudioProps$1 {
6
+ adapter: Adapter;
7
+ children?: ReactNode;
8
+ }
4
9
 
5
- export = HelloWorld;
10
+ /**
11
+ * Studio component props
12
+ */
13
+ interface StudioProps {
14
+ adapter: Adapter;
15
+ }
16
+ /**
17
+ * Main Studio component that provides database visualization and management
18
+ * @param adapter - Implementation of the Adapter interface for database operations
19
+ */
20
+ declare const Studio: ({ adapter }: StudioProps) => react_jsx_runtime.JSX.Element;
21
+
22
+ export { Studio, type StudioProps$1 as StudioProps };
@@ -1,5 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+ import { A as Adapter } from '../Adapter-C2FVF4Hg.js';
1
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
 
3
- declare function HelloWorld(): react_jsx_runtime.JSX.Element;
5
+ interface StudioProps$1 {
6
+ adapter: Adapter;
7
+ children?: ReactNode;
8
+ }
4
9
 
5
- export { HelloWorld as default };
10
+ /**
11
+ * Studio component props
12
+ */
13
+ interface StudioProps {
14
+ adapter: Adapter;
15
+ }
16
+ /**
17
+ * Main Studio component that provides database visualization and management
18
+ * @param adapter - Implementation of the Adapter interface for database operations
19
+ */
20
+ declare const Studio: ({ adapter }: StudioProps) => react_jsx_runtime.JSX.Element;
21
+
22
+ export { Studio, type StudioProps$1 as StudioProps };
package/dist/ui/index.js CHANGED
@@ -1 +1,163 @@
1
- import"../chunk-2FW6TKD6.js";import{jsx as t}from"react/jsx-runtime";function e(){return t("h1",{className:"tw-preflight ps:p-10",children:"Hello, world!"})}export{e as default};
1
+ import"../chunk-2FW6TKD6.js";import"../index-KSZNOSSS.css";import{NuqsAdapter as Dt}from"nuqs/adapters/react";import Tt,{createContext as At,useContext as Bt,useEffect as Ia,useState as ge}from"react";import{Slot as Pa}from"@radix-ui/react-slot";import{useQueryState as wa}from"nuqs";import{clsx as ha}from"clsx";import{twMerge as Sa}from"tailwind-merge";function l(...e){return Sa(ha(e))}import{jsx as K,jsxs as Ze}from"react/jsx-runtime";var j=()=>{let{setCurrentTable:e,currentTable:a,favoriteTableIds:t,tables:o}=Pe(),[u,p]=wa("tableId"),r=async f=>{await p(f);let x=o.find(C=>C.id===f);x&&e(x)};return Ze("div",{className:"ps-flex ps-flex-col ps-w-64 ps-gap-4 ps-shrink-0",children:[K(j.Block,{label:"Tables",children:o.map(f=>K(j.Item,{isActive:a?.id===f.id,onClick:x=>{x.preventDefault(),r(f.id)},className:`ps-px-2 ps-py-1 ps-cursor-pointer ps-rounded ${a?.id===f.id?"ps-bg-primary ps-text-white":"ps-hover:ps-bg-gray-100"}`,children:f.name},f.id))}),t.size>0&&K(j.Block,{label:"Favourites",children:o.filter(f=>t.has(f.id)).map(f=>K(j.Item,{isActive:a?.id===f.id,onClick:x=>{x.preventDefault(),r(f.id)},children:f.name},f.id))})]})},ka=({className:e,label:a,children:t,...o})=>Ze("div",{className:l("ps-rounded-lg ps-border ps-bg-card ps-text-card-foreground ps-shadow-xs",e),...o,children:[K("div",{className:"ps-pt-4 ps-pb-2 ps-px-4",children:K("h2",{className:"ps-text-sm ps-font-medium",children:a})}),K("nav",{"aria-label":a,className:"ps-flex ps-flex-col ps-gap-px ps-pb-3",children:t})]}),ba=({className:e,asChild:a=!1,isActive:t,size:o,...u})=>K(a?Pa:"button",{"data-sidebar":"menu-button","data-size":o,"data-active":t,className:l("ps-py-1.5 ps-px-4 ps-text-sm ps-font-medium ps-flex ps-gap-2 ps-items-center ps-border ps-border-transparent ps-bg-transparent ps-hover:bg-muted/50",e),...u});j.Block=ka;j.Item=ba;var Ke=j;import{DndContext as dt,MouseSensor as st,useSensor as rt,useSensors as ft}from"@dnd-kit/core";import{horizontalListSortingStrategy as it,SortableContext as nt,useSortable as ct}from"@dnd-kit/sortable";import{CSS as pt}from"@dnd-kit/utilities";import{getCoreRowModel as mt,getFilteredRowModel as Lt,getPaginationRowModel as xt,getSortedRowModel as It,useReactTable as Ct}from"@tanstack/react-table";import{useEffect as gt,useMemo as ht,useState as oe}from"react";import*as N from"react";import{jsx as O}from"react/jsx-runtime";var Me=N.forwardRef(({className:e,...a},t)=>O("div",{className:"ps-relative ps-w-full ps-overflow-auto ps-flex ps-items-start ps-h-full",children:O("table",{ref:t,className:l("ps-w-full ps-caption-bottom ps-text-sm table-fixed",e),...a})}));Me.displayName="Table";var ve=N.forwardRef(({className:e,...a},t)=>O("thead",{ref:t,className:l("[&_tr]:ps-border-b",e),...a}));ve.displayName="TableHeader";var ye=N.forwardRef(({className:e,...a},t)=>O("tbody",{ref:t,className:l("[&_tr:last-child]:ps-border-0",e),...a}));ye.displayName="TableBody";var Ra=N.forwardRef(({className:e,...a},t)=>O("tfoot",{ref:t,className:l("ps-border-t ps-bg-muted/50 ps-font-medium [&>tr]:last:ps-border-b-0",e),...a}));Ra.displayName="TableFooter";var ue=N.forwardRef(({className:e,...a},t)=>O("tr",{ref:t,className:l("ps-border-b ps-transition-colors hover:ps-bg-muted/50 data-[state=selected]:ps-bg-muted",e),...a}));ue.displayName="TableRow";var we=N.forwardRef(({className:e,...a},t)=>O("th",{ref:t,className:l("ps-h-10 ps-px-2 ps-text-left ps-align-middle ps-font-medium ps-text-muted-foreground [&:has([role=checkbox])]:ps-pr-0 [&>[role=checkbox]]:ps-translate-y-[2px]",e),...a}));we.displayName="TableHead";var de=N.forwardRef(({className:e,...a},t)=>O("td",{ref:t,className:l("ps-p-2 ps-align-middle [&:has([role=checkbox])]:ps-pr-0 [&>[role=checkbox]]:ps-translate-y-[2px]",e),...a}));de.displayName="TableCell";var Ma=N.forwardRef(({className:e,...a},t)=>O("caption",{ref:t,className:l("ps-mt-4 ps-text-sm ps-text-muted-foreground",e),...a}));Ma.displayName="TableCaption";import{tokyoNight as Ea}from"@uiw/codemirror-theme-tokyo-night";import Ga from"@uiw/react-codemirror";import*as E from"@radix-ui/react-popover";import*as b from"react";import{jsx as se}from"react/jsx-runtime";var Je=b.createContext(null),De=({children:e,...a})=>{let[t,o]=b.useState(!1);return se(Je.Provider,{value:{open:t,setOpen:o},children:se(E.Root,{open:t,onOpenChange:o,...a,children:e})})};De.displayName="PopoverCell";var Te=b.forwardRef(({children:e,onDoubleClick:a,className:t,...o},u)=>{let p=b.useContext(Je),[r,f]=b.useState(!1),x=b.useRef(null);return b.useEffect(()=>{let S=le=>{let F=le.target;x.current&&!x.current.contains(F)&&(console.log("Outside click - removing focus"),f(!1))};return document.addEventListener("click",S),()=>document.removeEventListener("click",S)},[]),se(E.Trigger,{ref:S=>{typeof u=="function"?u(S):u&&(u.current=S),x.current=S},onClick:S=>{S.preventDefault(),console.log("Click handler - setting focus to true"),f(!0)},onDoubleClick:S=>{S.preventDefault(),p?.setOpen(!0),a?.()},"data-focus":r.toString(),className:l("w-full h-full cursor-pointer",t),...o,children:e})});Te.displayName="PopoverCellTrigger";var Ae=b.forwardRef(({className:e,align:a="center",sideOffset:t=4,...o},u)=>se(E.Portal,{children:se(E.Content,{ref:u,align:a,sideOffset:t,className:l("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));Ae.displayName=E.Content.displayName;import{forwardRef as ya,createElement as Da}from"react";var Qe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ke=(...e)=>e.filter((a,t,o)=>!!a&&o.indexOf(a)===t).join(" ");import{forwardRef as va,createElement as je}from"react";var _e={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var $e=va(({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:u="",children:p,iconNode:r,...f},x)=>je("svg",{ref:x,..._e,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:ke("lucide",u),...f},[...r.map(([C,h])=>je(C,h)),...Array.isArray(p)?p:[p]]));var m=(e,a)=>{let t=ya(({className:o,...u},p)=>Da($e,{ref:p,iconNode:a,className:ke(`lucide-${Qe(e)}`,o),...u}));return t.displayName=`${e}`,t};var Z=m("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);var re=m("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);var G=m("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var ae=m("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var fe=m("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var z=m("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var ie=m("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var ne=m("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);var ce=m("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var $=m("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var pe=m("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var J=m("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);var me=m("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);var Le=m("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);var xe=m("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);import{isValidElement as Oa}from"react";import*as i from"@radix-ui/react-context-menu";import*as V from"react";import{jsx as R,jsxs as qe}from"react/jsx-runtime";var Ye=i.Root,ea=i.Trigger;var Ta=V.forwardRef(({className:e,inset:a,children:t,...o},u)=>qe(i.SubTrigger,{ref:u,className:l("ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[state=open]:ps-bg-accent data-[state=open]:ps-text-accent-foreground",a&&"ps-pl-8",e),...o,children:[t,R(z,{className:"ps-ml-auto ps-h-4 ps-w-4"})]}));Ta.displayName=i.SubTrigger.displayName;var Aa=V.forwardRef(({className:e,...a},t)=>R(i.SubContent,{ref:t,className:l("ps-z-50 ps-min-w-[8rem] ps-overflow-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-lg data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-context-menu-content-transform-origin]",e),...a}));Aa.displayName=i.SubContent.displayName;var Be=V.forwardRef(({className:e,...a},t)=>R(i.Portal,{children:R(i.Content,{ref:t,className:l("ps-z-50 ps-max-h-[--radix-context-menu-content-available-height] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-md data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-context-menu-content-transform-origin]",e),...a})}));Be.displayName=i.Content.displayName;var Fe=V.forwardRef(({className:e,inset:a,...t},o)=>R(i.Item,{ref:o,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",a&&"ps-pl-8",e),...t}));Fe.displayName=i.Item.displayName;var Ba=V.forwardRef(({className:e,children:a,checked:t,...o},u)=>qe(i.CheckboxItem,{ref:u,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),checked:t,...o,children:[R("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:R(i.ItemIndicator,{children:R(G,{className:"ps-h-4 ps-w-4"})})}),a]}));Ba.displayName=i.CheckboxItem.displayName;var Fa=V.forwardRef(({className:e,children:a,...t},o)=>qe(i.RadioItem,{ref:o,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[R("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:R(i.ItemIndicator,{children:R($,{className:"ps-h-4 ps-w-4 ps-fill-current"})})}),a]}));Fa.displayName=i.RadioItem.displayName;var qa=V.forwardRef(({className:e,inset:a,...t},o)=>R(i.Label,{ref:o,className:l("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold ps-text-foreground",a&&"ps-pl-8",e),...t}));qa.displayName=i.Label.displayName;var Ua=V.forwardRef(({className:e,...a},t)=>R(i.Separator,{ref:t,className:l("ps--mx-1 ps-my-1 ps-h-px ps-bg-border",e),...a}));Ua.displayName=i.Separator.displayName;var Ha=({className:e,...a})=>R("span",{className:l("ps-ml-auto ps-text-xs ps-tracking-widest ps-text-muted-foreground",e),...a});Ha.displayName="ContextMenuShortcut";import{jsx as Ue,jsxs as aa}from"react/jsx-runtime";var He=e=>{if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(e==null)return"";if(Oa(e)){let a=e.props;return e.type&&typeof e.type=="function"&&e.type.name==="RevealText"?a.text||"":e.type&&typeof e.type=="function"&&e.type.name==="NullValue"?"NULL":a.children?He(a.children):""}return Array.isArray(e)?e.map(He).join(""):""},ta=({children:e})=>aa(Ye,{children:[Ue(ea,{className:"ps-block ps-w-full ps-p-[var(--studio-cell-spacing)]",children:e}),Ue(Be,{children:aa(Fe,{onClick:()=>{let a=He(e);navigator.clipboard.writeText(a).catch(t=>{console.error("Failed to copy to clipboard:",t)})},className:"ps-flex ps-items-center ps-gap-2",children:[Ue(pe,{size:12}),"Copy"]})})]});import{jsx as Na}from"react/jsx-runtime";function oa(){return Na("code",{className:"ps-text-gray-500",children:"NULL"})}import{jsx as te,jsxs as za}from"react/jsx-runtime";function la({cell:e,getPinningStyles:a,dataType:t,isRelational:o,relatesTo:u,relationField:p}){let r=e.getValue(),f=r==null,x=C=>{if(C==null)return"NULL";if(typeof C=="object")try{return JSON.stringify(C,null,2)}catch(h){return console.error("Error stringifying value:",h),String(C)}return String(C)};return za(De,{children:[te(Te,{asChild:!0,children:te(de,{...a(e.column),"data-cell-type":"data","data-type":t.toLowerCase(),"data-relational":o?"true":void 0,"data-relates-to":u,"data-relation-field":p,className:l(a(e.column).className,"ps-p-0",e.column.getIsPinned()&&"ps-sticky"),children:te(ta,{children:f?te(oa,{}):x(r)})})}),te(Ae,{align:"start",alignOffset:0,sideOffset:0,className:"ps-min-w-(--radix-popover-trigger-width) ps-rounded-none ps-bg-muted ps-p-0",children:te(Ga,{value:x(r),theme:Ea,height:"100px",basicSetup:{lineNumbers:!0,foldGutter:!1,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!1},onChange:C=>{console.log("New value:",C)}})})]},e.id)}import{jsx as Va}from"react/jsx-runtime";function ua({cell:e,getPinningStyles:a,dataType:t}){let o={cell:e,getPinningStyles:a},u=e.column.columnDef.meta,p={...o,isRelational:u?.isRelational,relatesTo:u?.relatesTo,relationField:u?.relationField};return Va(la,{...p,dataType:t||"STRING"})}import{flexRender as at}from"@tanstack/react-table";import{Slot as Wa}from"@radix-ui/react-slot";import{cva as Xa}from"class-variance-authority";import*as da from"react";import{jsx as Za}from"react/jsx-runtime";var Ka=Xa("ps-inline-flex ps-items-center ps-justify-center ps-gap-2 ps-whitespace-nowrap ps-rounded-md ps-text-sm ps-font-medium ps-transition-colors focus-visible:ps-outline-none focus-visible:ps-ring-1 focus-visible:ps-ring-ring disabled:ps-pointer-events-none disabled:ps-opacity-50 [&_svg]:ps-pointer-events-none [&_svg]:ps-size-4 [&_svg]:ps-shrink-0",{variants:{variant:{default:"ps-bg-primary ps-text-primary-foreground ps-shadow hover:ps-bg-primary/90",destructive:"ps-bg-destructive ps-text-destructive-foreground ps-shadow-sm hover:ps-bg-destructive/90",outline:"ps-border ps-border-input ps-bg-background ps-shadow-sm hover:ps-bg-accent hover:ps-text-accent-foreground",secondary:"ps-bg-secondary ps-text-secondary-foreground ps-shadow-sm hover:ps-bg-secondary/80",ghost:"hover:ps-bg-accent hover:ps-text-accent-foreground",link:"ps-text-primary ps-underline-offset-4 hover:ps-underline"},size:{default:"ps-h-9 ps-px-4 ps-py-2",sm:"ps-h-8 ps-rounded-md ps-px-3 ps-text-xs",lg:"ps-h-10 ps-rounded-md ps-px-8",icon:"ps-h-9 ps-w-9"}},defaultVariants:{variant:"default",size:"default"}}),H=da.forwardRef(({className:e,variant:a,size:t,asChild:o=!1,...u},p)=>Za(o?Wa:"button",{className:l(Ka({variant:a,size:t,className:e})),ref:p,...u}));H.displayName="Button";import*as n from"@radix-ui/react-dropdown-menu";import*as W from"react";import{jsx as M,jsxs as Ne}from"react/jsx-runtime";var sa=n.Root,ra=n.Trigger;var Ja=W.forwardRef(({className:e,inset:a,children:t,...o},u)=>Ne(n.SubTrigger,{ref:u,className:l("ps-flex ps-cursor-default ps-select-none ps-items-center ps-gap-2 ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent data-[state=open]:ps-bg-accent [&_svg]:ps-pointer-events-none [&_svg]:ps-size-4 [&_svg]:ps-shrink-0",a&&"ps-pl-8",e),...o,children:[t,M(z,{className:"ps-ml-auto"})]}));Ja.displayName=n.SubTrigger.displayName;var Qa=W.forwardRef(({className:e,...a},t)=>M(n.SubContent,{ref:t,className:l("ps-z-50 ps-min-w-[8rem] ps-overflow-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-lg data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-dropdown-menu-content-transform-origin]",e),...a}));Qa.displayName=n.SubContent.displayName;var Oe=W.forwardRef(({className:e,sideOffset:a=4,...t},o)=>M(n.Portal,{children:M(n.Content,{ref:o,sideOffset:a,className:l("ps-z-50 ps-max-h-[var(--radix-dropdown-menu-content-available-height)] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-md","data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-dropdown-menu-content-transform-origin]",e),...t})}));Oe.displayName=n.Content.displayName;var be=W.forwardRef(({className:e,inset:a,...t},o)=>M(n.Item,{ref:o,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-gap-2 ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50 [&>svg]:ps-size-4 [&>svg]:ps-shrink-0",a&&"ps-pl-8",e),...t}));be.displayName=n.Item.displayName;var _a=W.forwardRef(({className:e,children:a,checked:t,...o},u)=>Ne(n.CheckboxItem,{ref:u,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),checked:t,...o,children:[M("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:M(n.ItemIndicator,{children:M(G,{className:"ps-h-4 ps-w-4"})})}),a]}));_a.displayName=n.CheckboxItem.displayName;var ja=W.forwardRef(({className:e,children:a,...t},o)=>Ne(n.RadioItem,{ref:o,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[M("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:M(n.ItemIndicator,{children:M($,{className:"ps-h-2 ps-w-2 ps-fill-current"})})}),a]}));ja.displayName=n.RadioItem.displayName;var $a=W.forwardRef(({className:e,inset:a,...t},o)=>M(n.Label,{ref:o,className:l("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold",a&&"ps-pl-8",e),...t}));$a.displayName=n.Label.displayName;var Ya=W.forwardRef(({className:e,...a},t)=>M(n.Separator,{ref:t,className:l("ps--mx-1 ps-my-1 ps-h-px ps-bg-muted",e),...a}));Ya.displayName=n.Separator.displayName;var et=({className:e,...a})=>M("span",{className:l("ps-ml-auto ps-text-xs ps-tracking-widest ps-opacity-60",e),...a});et.displayName="DropdownMenuShortcut";import{jsx as v,jsxs as Q}from"react/jsx-runtime";function Ee({header:e}){let a=e.column.columnDef.meta,t=a?.dataType,o=a?.isRelational;return Q("div",{className:"ps-flex ps-items-center ps-justify-between ps-w-full ps-h-full",children:[Q("div",{className:"ps-flex-1 ps-flex ps-items-center ps-justify-between",children:[o&&v(me,{size:14,className:"text-blue-700"}),Q("div",{className:"ps-align-text-bottom ps-leading-none ps-h-[20px]",children:[v("span",{className:"ps-inline-block ps-text-foreground ps-font-bold ps-text-sm",children:e.isPlaceholder?null:at(e.column.columnDef.header,e.getContext())}),t&&t!=="NONE"&&v("span",{className:"ps-inline-block ps-ml-2 ps-text-xs ps-font-mono ps-text-muted-foreground/70 ps-lowercase",children:t})]}),v("span",{className:"ps-flex ps-items-center ps-gap-1",children:e.column.getCanPin()&&e.column.id!=="select"&&Q(sa,{children:[v(ra,{asChild:!0,children:v(H,{variant:"ghost",size:"icon",children:v(J,{size:16})})}),Q(Oe,{children:[e.column.getCanSort()&&v(be,{onClick:()=>e.column.toggleSorting(e.column.getIsSorted()==="asc"),children:Q("span",{className:"ps-flex ps-items-center ps-gap-2",children:[e.column.getIsSorted()==="asc"?v(Z,{size:16}):v(re,{size:16}),e.column.getIsSorted()==="asc"?"Sort descending":"Sort ascending"]})}),v(be,{onClick:()=>e.column.pin(e.column.getIsPinned()?!1:"left"),children:e.column.getIsPinned()?Q("span",{className:"ps-flex ps-items-center ps-gap-2",children:[v(Le,{size:16}),"Unpin column"]}):Q("span",{className:"ps-flex ps-items-center ps-gap-2",children:[v(xe,{size:16}),"Pin column"]})})]})]})})]}),e.column.getCanResize()&&v("button",{type:"button",tabIndex:0,onMouseDown:u=>{u.stopPropagation(),e.getResizeHandler()(u)},onTouchStart:u=>{u.stopPropagation(),e.getResizeHandler()(u)},onClick:u=>u.stopPropagation(),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),e.getResizeHandler()(u))},className:l("ps-absolute ps-right-0 ps-top-0 ps-h-full ps-w-3 ps-cursor-col-resize","ps-select-none ps-touch-none ps-transition-colors ps-group","ps-border-0 ps-bg-transparent",e.column.getIsResizing()&&"ps-bg-gray-300","before:ps-absolute before:ps-right-[3px] before:ps-top-1/2 before:ps--translate-y-1/2","after:ps-absolute after:ps-right-[7px] after:ps-top-1/2 after:ps--translate-y-1/2","before:ps-w-[2px] before:ps-h-0 before:ps-bg-gray-400 before:ps-rounded-full before:ps-opacity-0","after:ps-w-[2px] after:ps-h-0 after:ps-bg-gray-400 after:ps-rounded-full after:ps-opacity-0","before:ps-transition-all before:ps-duration-200","after:ps-transition-all after:ps-duration-200","group-hover:before:ps-opacity-100","group-hover:after:ps-opacity-100","group-hover:before:ps-h-4","group-hover:after:ps-h-4","group-active:ps-bg-transparent group-active:before:ps-bg-white group-active:after:ps-bg-white",e.column.getIsResizing()&&"before:ps-opacity-100"),"aria-label":"Resize column"})]})}import*as fa from"react";import{jsx as tt}from"react/jsx-runtime";var Ge=fa.forwardRef(({className:e,type:a,...t},o)=>tt("input",{type:a,className:l("ps-flex ps-h-9 ps-w-full ps-rounded-md ps-border ps-border-input ps-bg-transparent ps-px-3 ps-py-1 ps-text-base ps-shadow-sm ps-transition-colors file:ps-border-0 file:ps-bg-transparent file:ps-text-sm file:ps-font-medium file:ps-text-foreground placeholder:ps-text-muted-foreground focus-visible:ps-outline-none focus-visible:ps-ring-1 focus-visible:ps-ring-ring disabled:ps-cursor-not-allowed disabled:ps-opacity-50 md:ps-text-sm",e),ref:o,...t}));Ge.displayName="Input";import*as c from"@radix-ui/react-select";import*as _ from"react";import{jsx as P,jsxs as Xe}from"react/jsx-runtime";var ia=c.Root;var na=c.Value,ze=_.forwardRef(({className:e,children:a,...t},o)=>Xe(c.Trigger,{ref:o,className:l("ps-flex ps-h-9 ps-w-full ps-items-center ps-justify-between ps-whitespace-nowrap ps-rounded-md ps-border ps-border-input ps-bg-transparent ps-px-3 ps-py-2 ps-text-sm ps-shadow-sm ps-ring-offset-background data-[placeholder]:ps-text-muted-foreground focus:ps-outline-none focus:ps-ring-1 focus:ps-ring-ring disabled:ps-cursor-not-allowed disabled:ps-opacity-50 [&>span]:ps-line-clamp-1",e),...t,children:[a,P(c.Icon,{asChild:!0,children:P(ae,{className:"ps-h-4 ps-w-4 ps-opacity-50"})})]}));ze.displayName=c.Trigger.displayName;var ca=_.forwardRef(({className:e,...a},t)=>P(c.ScrollUpButton,{ref:t,className:l("ps-flex ps-cursor-default ps-items-center ps-justify-center ps-py-1",e),...a,children:P(ie,{className:"ps-h-4 ps-w-4"})}));ca.displayName=c.ScrollUpButton.displayName;var pa=_.forwardRef(({className:e,...a},t)=>P(c.ScrollDownButton,{ref:t,className:l("ps-flex ps-cursor-default ps-items-center ps-justify-center ps-py-1",e),...a,children:P(ae,{className:"ps-h-4 ps-w-4"})}));pa.displayName=c.ScrollDownButton.displayName;var Ve=_.forwardRef(({className:e,children:a,position:t="popper",...o},u)=>P(c.Portal,{children:Xe(c.Content,{ref:u,className:l("ps-relative ps-z-50 ps-max-h-[--radix-select-content-available-height] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-text-popover-foreground ps-shadow-md data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-select-content-transform-origin]",t==="popper"&&"data-[side=bottom]:ps-translate-y-1 data-[side=left]:ps--translate-x-1 data-[side=right]:ps-translate-x-1 data-[side=top]:ps--translate-y-1",e),position:t,...o,children:[P(ca,{}),P(c.Viewport,{className:l("ps-p-1",t==="popper"&&"ps-h-[var(--radix-select-trigger-height)] ps-w-full ps-min-w-[var(--radix-select-trigger-width)]"),children:a}),P(pa,{})]})}));Ve.displayName=c.Content.displayName;var ot=_.forwardRef(({className:e,...a},t)=>P(c.Label,{ref:t,className:l("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold",e),...a}));ot.displayName=c.Label.displayName;var We=_.forwardRef(({className:e,children:a,...t},o)=>Xe(c.Item,{ref:o,className:l("ps-relative ps-flex ps-w-full ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-2 ps-pr-8 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[P("span",{className:"ps-absolute ps-right-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:P(c.ItemIndicator,{children:P(G,{className:"ps-h-4 ps-w-4"})})}),P(c.ItemText,{children:a})]}));We.displayName=c.Item.displayName;var lt=_.forwardRef(({className:e,...a},t)=>P(c.Separator,{ref:t,className:l("ps--mx-1 ps-my-1 ps-h-px ps-bg-muted",e),...a}));lt.displayName=c.Separator.displayName;import{jsx as k,jsxs as Y}from"react/jsx-runtime";var ut=[10,20,50,100];function ma({table:e,variant:a="basic",className:t}){let{pageSize:o,pageIndex:u}=e.getState().pagination,p=e.getPageCount();return k("div",{className:l("ps-flex ps-items-center ps-justify-between ps-space-x-2 ps-py-4 ps-px-4",t),children:a==="basic"?Y("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[k(H,{variant:"outline",size:"sm",className:"ps-h-9",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:"Previous"}),k(H,{variant:"outline",size:"sm",className:"ps-h-9",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:"Next"})]}):Y("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[Y("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[k(H,{variant:"outline",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:k(ne,{className:"ps-w-4 ps-h-4"})}),k(H,{variant:"outline",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:k(fe,{className:"ps-w-4 ps-h-4"})}),Y("div",{className:"ps-flex ps-items-center ps-gap-1 ps-text-xs ps-font-medium",children:["Page",k(Ge,{type:"number",min:1,max:p,value:u+1,className:"ps-w-12",onChange:r=>{let f=r.target.value?Number(r.target.value)-1:0;e.setPageIndex(f)}}),Y("span",{className:"ps-shrink-0 ps-w-max",children:["of ",p]})]}),k(H,{variant:"outline",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:k(z,{className:"ps-w-4 ps-h-4"})}),k(H,{variant:"outline",onClick:()=>e.setPageIndex(p-1),disabled:!e.getCanNextPage(),children:k(ce,{className:"ps-w-4 ps-h-4"})})]}),Y(ia,{value:o.toString(),onValueChange:r=>e.setPageSize(Number(r)),children:[k(ze,{children:k(na,{})}),k(Ve,{children:ut.map(r=>Y(We,{value:r.toString(),children:[r," per page"]},r))})]})]})})}var Ie=e=>{let a=e.getIsPinned(),t=a==="left"&&e.getIsLastColumn("left"),o=a==="right"&&e.getIsFirstColumn("right");return{className:l("ps-overflow-hidden ps-whitespace-nowrap ps-text-ellipsis",a&&["ps-sticky ps-bg-background ps-shadow-[1px_0_0_0_hsl(var(--border))]",a==="left"?"ps-left-0":"ps-right-0","ps-z-20"],!a&&"ps-relative ps-z-10",t&&"ps-shadow-[1px_0_0_0_hsl(var(--border))]",o&&"ps-shadow-[-1px_0_0_0_hsl(var(--border))]"),style:{width:e.getSize(),left:a==="left"?`${e.getStart("left")}px`:void 0,right:a==="right"?`${e.getAfter("right")}px`:void 0}}};import{Fragment as wt,jsx as L,jsxs as Ce}from"react/jsx-runtime";var St=({_table:e})=>{let{currentTable:a,isLoaded:t}=Pe();return t?L("div",{className:"ps-flex ps-items-center ps-justify-between ps-w-full ps-gap-2",children:L("div",{className:"ps-flex ps-items-center ps-gap-2",children:L("span",{className:"ps-flex ps-items-center ps-gap-2",children:L("h1",{className:"ps-text-sm ps-font-medium",children:a?.name})})})}):null},Pt=({header:e,children:a,getPinningStyles:t})=>{let{attributes:o,listeners:u,transform:p,transition:r,setNodeRef:f,isDragging:x,isOver:C}=ct({id:e.id}),h=e.column.columnDef.meta,S={transform:pt.Transform.toString(p),transition:r,...t(e.column).style,cursor:"grab",touchAction:"none"};return Ce(we,{ref:f,...o,...u,style:S,"data-relational":h?.isRelational?"true":void 0,"data-relates-to":h?.relatesTo,"data-relation-field":h?.relationField,className:l("ps-group",t(e.column).className,x&&"ps-opacity-50",C&&"ps-bg-gray-100","ps-select-none ps-touch-none ps-relative",e.column.getIsPinned()&&"ps-sticky"),children:[a,C&&L("div",{className:"ps-absolute ps-inset-0 ps-border-2 ps-border-primary ps-rounded-sm ps-pointer-events-none"})]})};function La({data:e=[],columns:a}){console.log("Data received in StudioGrid:",e);let[t,o]=oe([]),[u,p]=oe([]),[r,f]=oe({}),[x,C]=oe({left:[],right:[]}),[h,S]=oe([]),[le,F]=oe("");gt(()=>{if(a&&a.length>0){let I=a.map(B=>B.id);if(h.length===0){S(I);return}let d=[...h],g=d.filter(B=>!a.some(U=>U.id===B));g.forEach(B=>{let U=d.indexOf(B);U!==-1&&d.splice(U,1)});let D=I.filter(B=>!d.includes(B));D.length>0&&d.push(...D),(g.length>0||D.length>0)&&S(d)}},[a,h]);let y=rt(st,{activationConstraint:{distance:10}}),T=ft(y),A=I=>{let{active:d,over:g}=I;if(g&&d.id!==g.id){let D=w.getColumn(d.id),B=w.getColumn(g.id);if(!D||!B)return;let U=D.getIsPinned(),ee=B.getIsPinned();if(U!==ee)return;let he=h.indexOf(d.id),Se=h.indexOf(g.id);if(he===-1||Se===-1)return;let Re=[...h];Re.splice(he,1),Re.splice(Se,0,d.id),S(Re)}},q=ht(()=>{if(!a||a.length===0)return console.log("No columns configuration available"),[];let I=(d,g)=>{if(d==null)return"";switch(g){case"TIMESTAMP":return d?new Date(d).toLocaleString():"";case"UUID":case"STRING":return String(d);default:return String(d)}};return a.map(d=>({accessorKey:d.id,header:()=>L("div",{className:"ps-font-medium",children:d.id}),cell:({getValue:g})=>I(g(),d.type),meta:{dataType:d.type,isRelational:d.isRelational,relatesTo:d.relatesTo,relationField:d.relationField}}))},[a]),w=Ct({data:e||[],defaultColumn:{size:200,minSize:50,maxSize:500},columns:q,getCoreRowModel:mt(),onSortingChange:o,getSortedRowModel:It(),getPaginationRowModel:xt(),getFilteredRowModel:Lt(),onColumnFiltersChange:p,enableColumnResizing:!0,columnResizeMode:"onChange",onColumnSizingChange:f,enableColumnPinning:!0,onColumnPinningChange:C,onGlobalFilterChange:F,globalFilterFn:(I,d,g)=>{let D=I.getValue(d);return D==null?!1:String(D).toLowerCase().includes(String(g).toLowerCase())},state:{sorting:t,columnFilters:u,columnSizing:r,columnPinning:x,columnOrder:h,globalFilter:le}});return!e||e.length===0?Ce("div",{className:"ps-p-4 ps-border ps-rounded-md ps-w-full",children:[L("p",{className:"ps-text-lg ps-font-semibold",children:"No data available."}),L("p",{className:"ps-text-sm ps-text-gray-500",children:e?"Data array is empty.":"Data is undefined."})]}):Ce(wt,{children:[L("div",{className:"ps-bg-studio-header-background ps-flex ps-w-full ps-p-2 ps-py-3 ps-border-b",children:L(St,{_table:w})}),L("div",{"data-studio":"content",className:"ps-flex-1 ps-w-0 ps-h-0 ps-min-w-full",children:Ce("div",{className:"ps-flex ps-flex-col ps-w-full ps-h-full ps-overflow-scroll",children:[L(dt,{sensors:T,onDragEnd:A,children:Ce(Me,{children:[L(ve,{children:w.getHeaderGroups().map(I=>L(ue,{className:l("ps-relative",w.getLeftLeafHeaders().some(d=>d.column.getIsPinned()==="left")&&`ps-pl-[${w.getLeftLeafHeaders().filter(d=>d.column.getIsPinned()==="left").reduce((d,g)=>d+g.getSize(),0)}px]`),children:L(nt,{items:I.headers.map(d=>d.id),strategy:it,children:I.headers.map(d=>d.column.id==="select"?L(we,{className:l("ps-px-[var(--studio-cell-spacing)]",Ie(d.column).className,d.column.getIsPinned()&&"ps-sticky"),style:Ie(d.column).style,"data-cell-type":"select",children:L(Ee,{header:d})},d.id):L(Pt,{header:d,table:w,getPinningStyles:Ie,children:L(Ee,{header:d})},d.id))})},I.id))}),L(ye,{children:w.getRowModel().rows?.length?w.getRowModel().rows.map(I=>L(ue,{className:l("ps-bg-table-row ps-odd:bg-table-row-odd ps-group"),children:I.getVisibleCells().map(d=>L(ua,{cell:d,getPinningStyles:Ie,dataType:a.find(g=>g.id===d.column.id)?.type},d.id))},I.id)):L(ue,{children:L(de,{colSpan:a.length,className:"ps-h-24 ps-text-center",children:"No results."})})})]})}),L(ma,{table:w,variant:"numeric"})]})})]})}import{createContext as kt,useContext as dd,useEffect as bt,useState as Rt}from"react";import{jsx as yt}from"react/jsx-runtime";var Mt={theme:"system",setTheme:()=>null},vt=kt(Mt);function xa({children:e,defaultTheme:a="system",storageKey:t="vite-ui-theme",...o}){let[u,p]=Rt(()=>localStorage.getItem(t)||a);bt(()=>{let f=window.document.documentElement;if(f.classList.remove("light","dark"),u==="system"){let x=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(x);return}f.classList.add(u)},[u]);let r={theme:u,setTheme:f=>{localStorage.setItem(t,f),p(f)}};return yt(vt.Provider,{...o,value:r,children:e})}import{jsx as X,jsxs as Ht}from"react/jsx-runtime";var Ca=At(void 0),Pe=()=>{let e=Bt(Ca);if(!e)throw new Error("useStudio must be used within a Studio.Provider");return e},Ft={integer:"INTEGER",varchar:"VARCHAR",text:"TEXT",enum:"STRING",boolean:"BOOLEAN"};function qt(e,a){return{id:e,accessorKey:e,header:e.charAt(0).toUpperCase()+e.slice(1),type:Ft[a.dataType.name]||"STRING",nullable:a.nullable,isKey:a.partOfPk}}var Ut=({adapter:e})=>{let[a,t]=ge([]),[o,u]=ge(null),[p,r]=ge(!1),[f,x]=ge([]),[C,h]=ge([]),S=Tt.useMemo(()=>new Set(a.filter(F=>F.isFavorite).map(F=>F.id)),[a]),le=F=>{t(y=>y.map(T=>T.id===F?{...T,isFavorite:!T.isFavorite}:T))};return Ia(()=>{(async()=>{try{let[y,T]=await e.introspect();if(y||!T?.schemas){console.error("Error fetching schema:",y);return}let A=Object.entries(T.schemas).flatMap(([q,w])=>Object.entries(w.tables).map(([I])=>({id:`${q}.${I}`,name:I.charAt(0).toUpperCase()+I.slice(1),schema:q,isFavorite:!1})));t(A),!o&&A.length>0&&A[0]&&u(A[0])}catch(y){console.error("Error fetching tables:",y)}})()},[e,o]),Ia(()=>{(async()=>{if(!o?.id){r(!0);return}try{r(!1);let[y,T]=await e.introspect();if(y||!T?.schemas){console.error("Error fetching schema:",y),r(!0);return}let[A,q]=o.id.split(".");if(!A||!q){console.error("Invalid table ID format:",o.id),r(!0);return}let w=T.schemas[A];if(!w){console.error(`Schema ${A} not found`),r(!0);return}let I=w.tables[q];if(!I){console.error(`Table ${q} not found in schema ${A}`),r(!0);return}let d=Object.entries(I.columns).map(([U,ee])=>qt(U,ee));h(d);let[g,D]=await e.query({schema:A,table:q,filters:[],sortings:[]});if(g||!D){console.error(`Failed to fetch data for table ${q}:`,g),r(!0);return}let B=D.rows.map(U=>{let ee={};return Object.entries(U).forEach(([he,Se])=>{ee[he]=Se.value}),ee});x(B),r(!0)}catch(y){console.error("Error fetching table data:",y),r(!0)}})()},[e,o]),e?!p&&a.length===0?X("div",{children:"Loading available tables..."}):p&&a.length===0?X("div",{children:"No tables found in the database."}):X(xa,{children:X(Dt,{children:X(Ca.Provider,{value:{adapter:e,currentTable:o,isLoaded:p,tables:a,favoriteTableIds:S,setCurrentTable:u,toggleFavorite:le},children:Ht("div",{className:"ps-flex ps-gap-4 ps-w-full ps-rounded-sm ps-bg-background ps-p-4 ps-relative",children:[X(Ke,{}),X("div",{className:"ps-flex ps-w-full ps-flex-col ps-border ps-rounded-lg",children:X(La,{columns:C,data:f})})]})})})}):(console.error("No adapter provided to Studio component"),X("div",{children:"Error: No adapter provided"}))},ga=Ut;export{ga as Studio};
2
+ /*! Bundled license information:
3
+
4
+ lucide-react/dist/esm/shared/src/utils.js:
5
+ (**
6
+ * @license lucide-react v0.427.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ *)
11
+
12
+ lucide-react/dist/esm/defaultAttributes.js:
13
+ (**
14
+ * @license lucide-react v0.427.0 - ISC
15
+ *
16
+ * This source code is licensed under the ISC license.
17
+ * See the LICENSE file in the root directory of this source tree.
18
+ *)
19
+
20
+ lucide-react/dist/esm/Icon.js:
21
+ (**
22
+ * @license lucide-react v0.427.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ *)
27
+
28
+ lucide-react/dist/esm/createLucideIcon.js:
29
+ (**
30
+ * @license lucide-react v0.427.0 - ISC
31
+ *
32
+ * This source code is licensed under the ISC license.
33
+ * See the LICENSE file in the root directory of this source tree.
34
+ *)
35
+
36
+ lucide-react/dist/esm/icons/arrow-down-wide-narrow.js:
37
+ (**
38
+ * @license lucide-react v0.427.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ *)
43
+
44
+ lucide-react/dist/esm/icons/arrow-up-wide-narrow.js:
45
+ (**
46
+ * @license lucide-react v0.427.0 - ISC
47
+ *
48
+ * This source code is licensed under the ISC license.
49
+ * See the LICENSE file in the root directory of this source tree.
50
+ *)
51
+
52
+ lucide-react/dist/esm/icons/check.js:
53
+ (**
54
+ * @license lucide-react v0.427.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ *)
59
+
60
+ lucide-react/dist/esm/icons/chevron-down.js:
61
+ (**
62
+ * @license lucide-react v0.427.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ *)
67
+
68
+ lucide-react/dist/esm/icons/chevron-left.js:
69
+ (**
70
+ * @license lucide-react v0.427.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ *)
75
+
76
+ lucide-react/dist/esm/icons/chevron-right.js:
77
+ (**
78
+ * @license lucide-react v0.427.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ *)
83
+
84
+ lucide-react/dist/esm/icons/chevron-up.js:
85
+ (**
86
+ * @license lucide-react v0.427.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ *)
91
+
92
+ lucide-react/dist/esm/icons/chevrons-left.js:
93
+ (**
94
+ * @license lucide-react v0.427.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ *)
99
+
100
+ lucide-react/dist/esm/icons/chevrons-right.js:
101
+ (**
102
+ * @license lucide-react v0.427.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ *)
107
+
108
+ lucide-react/dist/esm/icons/circle.js:
109
+ (**
110
+ * @license lucide-react v0.427.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ *)
115
+
116
+ lucide-react/dist/esm/icons/copy.js:
117
+ (**
118
+ * @license lucide-react v0.427.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ *)
123
+
124
+ lucide-react/dist/esm/icons/ellipsis.js:
125
+ (**
126
+ * @license lucide-react v0.427.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ *)
131
+
132
+ lucide-react/dist/esm/icons/link.js:
133
+ (**
134
+ * @license lucide-react v0.427.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ *)
139
+
140
+ lucide-react/dist/esm/icons/pin-off.js:
141
+ (**
142
+ * @license lucide-react v0.427.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ *)
147
+
148
+ lucide-react/dist/esm/icons/pin.js:
149
+ (**
150
+ * @license lucide-react v0.427.0 - ISC
151
+ *
152
+ * This source code is licensed under the ISC license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ *)
155
+
156
+ lucide-react/dist/esm/lucide-react.js:
157
+ (**
158
+ * @license lucide-react v0.427.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ *)
163
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/studio-core",
3
- "version": "0.0.0-dev.202503280212",
3
+ "version": "0.0.0-dev.202503281209",
4
4
  "description": "Modular Prisma Studio components",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -54,7 +54,8 @@
54
54
  "types": "./dist/ui/index.d.cts",
55
55
  "default": "./dist/ui/index.cjs"
56
56
  }
57
- }
57
+ },
58
+ "./ui/index.css": "./dist/ui/index.css"
58
59
  },
59
60
  "keywords": [],
60
61
  "author": "",
@@ -64,13 +65,13 @@
64
65
  "@electric-sql/pglite": "0.2.17",
65
66
  "@prisma/client": "6.5.0",
66
67
  "@prisma/generator": "6.6.0-integration-push-xmzqvqxpztks.1",
67
- "@tailwindcss/postcss": "4.0.14",
68
+ "@types/node": "22.3.0",
69
+ "@types/react": "^19.0.12",
70
+ "@types/react-dom": "^19.0.4",
68
71
  "kysely": "0.27.4",
69
- "postcss": "8.4.41",
72
+ "lucide-react": "0.427.0",
70
73
  "std-env": "3.8.1",
71
- "tailwind-merge": "2.5.2",
72
- "tailwindcss": "4.0.14",
73
- "tailwindcss-animate": "1.0.7",
74
+ "tailwindcss": "3.4.17",
74
75
  "tsup": "8.0.2",
75
76
  "tsx": "4.17.0",
76
77
  "typescript": "5.5.4",
@@ -82,10 +83,35 @@
82
83
  "peerDependencies": {
83
84
  "@prisma/client": "6.5.0",
84
85
  "@types/react": "18.3.3",
85
- "react": "18.3.0-canary-a870b2d54-20240314"
86
+ "react": "18.3.0",
87
+ "react-dom": "18.3.0"
88
+ },
89
+ "dependencies": {
90
+ "@dnd-kit/core": "6.3.1",
91
+ "@dnd-kit/sortable": "10.0.0",
92
+ "@dnd-kit/utilities": "3.2.2",
93
+ "@radix-ui/react-checkbox": "1.1.4",
94
+ "@radix-ui/react-context-menu": "2.2.6",
95
+ "@radix-ui/react-dialog": "1.1.6",
96
+ "@radix-ui/react-dropdown-menu": "2.1.6",
97
+ "@radix-ui/react-popover": "1.1.6",
98
+ "@radix-ui/react-select": "2.1.6",
99
+ "@radix-ui/react-slot": "1.1.2",
100
+ "@tanstack/react-table": "8.20.1",
101
+ "@uiw/codemirror-theme-tokyo-night": "4.23.10",
102
+ "@uiw/react-codemirror": "4.23.10",
103
+ "autoprefixer": "10.4.21",
104
+ "class-variance-authority": "0.7.0",
105
+ "clsx": "2.1.1",
106
+ "nuqs": "2.4.1",
107
+ "postcss": "8.4.41",
108
+ "tailwind-merge": "2.5.2",
109
+ "tailwindcss-animate": "1.0.7",
110
+ "zod": "3.24.2"
86
111
  },
87
112
  "scripts": {
88
113
  "build": "tsup",
114
+ "dev": "tsup --watch",
89
115
  "check:exports": "attw --pack . --profile node16",
90
116
  "typecheck": "tsc",
91
117
  "lint": "eslint --fix .",