@khaos-systems/helm 0.1.14 → 0.2.2

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.
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MtAvatar-DvtEpPF_.cjs"),f=require("react"),_e=require("react-dom");function Oe(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(i,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return i.default=t,Object.freeze(i)}const W=Oe(f);const Le=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Te=e.createLucideIcon("arrow-left",Le);const Be=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z",key:"oz39mx"}]],se=e.createLucideIcon("bookmark",Be);const Pe=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],ne=e.createLucideIcon("bug",Pe);const qe=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],$e=e.createLucideIcon("calendar-days",qe);const Ge=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],We=e.createLucideIcon("circle-check-big",Ge);const He=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ee=e.createLucideIcon("circle",He);const Ue=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],H=e.createLucideIcon("columns-3",Ue);const Xe=[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]],Ke=e.createLucideIcon("diamond-plus",Xe);const Qe=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ie=e.createLucideIcon("file-text",Qe);const Ye=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],U=e.createLucideIcon("layers",Ye);const Je=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Ze=e.createLucideIcon("layout-grid",Je);const et=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],re=e.createLucideIcon("list-todo",et);const tt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],st=e.createLucideIcon("list",tt);const nt=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],it=e.createLucideIcon("paperclip",nt);const rt=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ot=e.createLucideIcon("settings",rt);const lt=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],at=e.createLucideIcon("share-2",lt);const ut=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],oe=e.createLucideIcon("sparkles",ut);const ct=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]],dt=e.createLucideIcon("square-kanban",ct);const xt=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],mt=e.createLucideIcon("star",xt);const ht=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],pt=e.createLucideIcon("table-2",ht);const ft=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],gt=e.createLucideIcon("users",ft),ge=f.createContext(null);function q(){const t=f.useContext(ge);if(!t)throw new Error("useMtCollection must be used inside MtCollection");return t}function jt(t){const i=String(t??"").toLowerCase();return i.includes("list")?"list":i.includes("table")?"table":i.includes("grid")?"grid":i.includes("board")||i.includes("kanban")?"board":i.includes("gantt")||i.includes("timeline")?"calendar":"circle"}function yt(t,i,s=16){const n={size:s},r=t??jt(i);return{circle:e.jsxRuntimeExports.jsx(ee,{...n}),list:e.jsxRuntimeExports.jsx(st,{...n}),table:e.jsxRuntimeExports.jsx(pt,{...n}),grid:e.jsxRuntimeExports.jsx(Ze,{...n}),board:e.jsxRuntimeExports.jsx(dt,{...n}),columns:e.jsxRuntimeExports.jsx(H,{...n}),calendar:e.jsxRuntimeExports.jsx($e,{...n}),star:e.jsxRuntimeExports.jsx(mt,{...n})}[r]??e.jsxRuntimeExports.jsx(ee,{...n})}function ce({iconId:t,layoutName:i,size:s=16}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:yt(t,i,s)})}function je(){const{views:t,currentView:i,setCurrentView:s,entries:n,addView:r,deleteView:o,openViewSettings:a,hasCurrentViewUnsavedChanges:l,saveCurrentViewAsDefault:c,revertCurrentViewToDefault:m}=q(),[h,j]=f.useState(!1),[d,y]=f.useState(!1),[w,E]=f.useState(t[0]?.layout?.name??""),k=f.useRef(null),v=f.useRef(t.length+1),M=f.useMemo(()=>{const p=new Set,x=[];return t.forEach(S=>{const I=S.layout?.name??"Layout";p.has(I)||(p.add(I),x.push({id:I,name:I,templateView:S}))}),x},[t]),u=i?.layout.ToolbarActions,b=q(),R=()=>{b.setShowViewSettings(!b.showViewSettings)},C=(i?.settings??{}).quickFilters??{},D=p=>{if(!p||typeof p!="object")return"";const x=p.status;return typeof x=="string"||typeof x=="number"?String(x):""},L=p=>{if(!p||typeof p!="object")return"";const x=p.assignee;if(typeof x=="string"||typeof x=="number")return String(x);if(x&&typeof x=="object"&&"name"in x){const S=x.name;if(typeof S=="string")return S}return""},A=p=>{i&&s({...i,settings:{...i.settings??{},quickFilters:{...C,...p}}})},_=Array.from(new Set(n.map(p=>D(p)).filter(Boolean))).sort(),B=Array.from(new Set(n.map(p=>L(p)).filter(Boolean))).sort(),V=(C.status?.length??0)>0,G=(C.assignee?.length??0)>0;f.useEffect(()=>{(!w||!M.some(p=>p.id===w))&&E(M[0]?.id??"")},[w,M]);const Y=p=>{const S=M.find(Z=>Z.id===p)?.templateView??i??t[0];if(!S)return;const I=S.layout?.name??"View",z=t.filter(Z=>Z.name.startsWith(I)).length,Fe=z>0?`${I} ${z+1}`:I;r({id:`view-${v.current++}`,name:Fe,icon:S.icon,layout:S.layout,groupBy:null,settings:{},renderEntry:S.renderEntry}),y(!1)};f.useEffect(()=>{h&&k.current?.focus()},[h]);const J=p=>{const x=t.find(z=>z.id===p);if(!x)return;const S=t.filter(z=>z.name.startsWith(x.name)).length,I=S>0?`${x.name} ${S+1}`:`${x.name} copy`;r({...x,id:`view-${v.current++}`,name:I})};return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b border-[#2A2A2A] h-11 px-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5",children:[t.length>1&&t.map(p=>e.jsxRuntimeExports.jsx(e.WithContextMenu,{getContextMenuItems:()=>[{label:"Rename",onSelect:()=>{s(p),a("root",{focusViewNameEditor:!0})}},{label:"Edit view",onSelect:()=>{s(p),a("root")}},{label:"",separator:!0},{label:"Delete view",disabled:t.length<=1,onSelect:()=>{o(p.id)}},{label:"Duplicate view",onSelect:()=>J(p.id)},{label:"Copy link to view",disabled:!0}],children:({openMenu:x})=>e.jsxRuntimeExports.jsxs(e.MtButton,{variant:"ghost",selected:p.id===i?.id,className:"h-auto min-h-0 items-center gap-2 border border-transparent px-2 py-1 text-sm text-text-muted hover:text-text-primary data-[selected]:border-[#8D8D8D] data-[selected]:text-text-primary",onClick:S=>{if(p.id===i?.id){x(S);return}s(p)},onContextMenu:S=>{s(p),x(S)},children:[e.jsxRuntimeExports.jsx(ce,{iconId:p.icon,layoutName:p.layout?.name}),e.jsxRuntimeExports.jsx("span",{children:p.name})]})},p.id)),e.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"}),e.jsxRuntimeExports.jsx(e.MtPopover,{open:d,onOpenChange:y,content:e.jsxRuntimeExports.jsxs("div",{className:"w-80 flex flex-col gap-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm text-text-primary",children:"Add view"}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2",children:M.map(p=>e.jsxRuntimeExports.jsx(e.MtButton,{variant:"ghost",selected:w===p.id,onClick:()=>{E(p.id),Y(p.id)},className:"h-auto min-h-0 w-full justify-start rounded border border-[#2A2A2A] px-2 py-2 text-left transition-colors data-[selected]:border-[#8D8D8D] data-[selected]:bg-surface-popover hover:bg-surface-popover",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxRuntimeExports.jsx("div",{className:"w-9 h-9 rounded border border-[#2A2A2A] bg-[#1A1A1A] flex items-center justify-center text-xs text-text-primary",children:p.templateView.icon?e.jsxRuntimeExports.jsx(ce,{iconId:p.templateView.icon,layoutName:p.templateView.layout?.name}):e.jsxRuntimeExports.jsx(ee,{size:16})}),e.jsxRuntimeExports.jsxs("div",{className:"min-w-0",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm text-text-primary truncate",children:p.name}),e.jsxRuntimeExports.jsx("div",{className:"text-xs text-text-muted truncate",children:"Create from layout"})]})]})},p.id))})]}),children:e.jsxRuntimeExports.jsx(e.MtPopover.Trigger,{children:e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",children:e.jsxRuntimeExports.jsx(Ke,{size:16,stroke:"#8D8D8D"})})})})]}),e.jsxRuntimeExports.jsx("div",{className:"flex-1"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1.5",children:[l?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtButton,{variant:"accent",onClick:c,children:"Save view"}),e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:m,children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})})]}),e.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"})]}):null,u?e.jsxRuntimeExports.jsx(u,{}):null,e.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(We,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:V?"accent":"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsxs("div",{className:"w-44 p-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>A({status:[]}),children:"All statuses"}),_.map(p=>e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>{const x=C.status??[],S=x.includes(p)?x.filter(I=>I!==p):[...x,p];A({status:S})},children:p},p))]})}),V?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>A({status:[]}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(gt,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:G?"accent":"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsxs("div",{className:"w-44 p-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>A({assignee:[]}),children:"All assignees"}),B.map(p=>e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>{const x=C.assignee??[],S=x.includes(p)?x.filter(I=>I!==p):[...x,p];A({assignee:S})},children:p},p))]})}),G?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>A({assignee:[]}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>j(p=>!p),children:e.jsxRuntimeExports.jsx(e.Search,{size:16,stroke:"#8D8D8D"})}),h?e.jsxRuntimeExports.jsx("input",{ref:k,value:C.search??"",onChange:p=>A({search:p.target.value}),onKeyDown:p=>{p.key==="Escape"&&j(!1)},placeholder:"Search entries...",className:"w-56 rounded border border-[#2A2A2A] bg-transparent px-2 py-1 text-sm outline-none transition-all"}):null]}),e.jsxRuntimeExports.jsx("div",{className:"border-r border-[#2A2A2A] h-6"}),e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:R,children:e.jsxRuntimeExports.jsx(ot,{size:16,stroke:"#8D8D8D"})}),e.jsxRuntimeExports.jsx(e.MtButton,{onClick:()=>{},variant:"accent",children:"+ Add"})]})]})}function Et({value:t,cases:i}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:i[t]??null})}const ye=f.createContext(null);function Ee(t){if(!f.isValidElement(t))return!1;const i=t.props;return typeof i.id=="string"&&typeof i.title=="string"}function O({children:t}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t})}function vt(t){const i={};return f.Children.forEach(t,s=>{if(!Ee(s))return;const n=s.props;i[n.id]=s}),i}function ve({children:t,initialPageId:i="root",onClose:s}){const n=f.useMemo(()=>vt(t),[t]),[r,o]=f.useState([i]);f.useEffect(()=>{o([i])},[i]);const a=r[r.length-1]??i,l=n[a],c=l?.props?.title??"View Settings",m=f.useCallback(d=>{n[d]&&o(y=>[...y,d])},[n]),h=f.useCallback(()=>{o(d=>d.length>1?d.slice(0,-1):d)},[]),j=r.length>1;return e.jsxRuntimeExports.jsx(ye.Provider,{value:{openPage:m,goBack:h},children:e.jsxRuntimeExports.jsxs(e.MtStack,{children:[e.jsxRuntimeExports.jsxs(e.MtStack,{row:!0,justify:"between",className:`p-2 pr-3 gap-2 border-b text-text-primary border-[#2A2A2A] ${j?"":"pl-3"}`,children:[e.jsxRuntimeExports.jsxs(e.MtStack,{row:!0,className:"text-text-primary",gap:2,children:[j?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:h,children:e.jsxRuntimeExports.jsx(Te,{size:16,stroke:"#8D8D8D"})}):null,e.jsxRuntimeExports.jsx("span",{className:"text-sm text-text-primary",children:c})]}),e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:s,children:e.jsxRuntimeExports.jsx(e.X,{size:16,stroke:"#8D8D8D"})})]}),e.jsxRuntimeExports.jsx(Et,{value:a,cases:{[a]:l}})]})})}function F({title:t,children:i}){return e.jsxRuntimeExports.jsxs(e.MtStack,{gap:1,className:"py-2 border-b border-border-default",children:[t&&e.jsxRuntimeExports.jsx("small",{className:"px-2",children:t}),i]})}function N({icon:t,label:i,trailing:s,onClick:n,disabled:r,active:o,submenu:a}){const l=f.useContext(ye);return e.jsxRuntimeExports.jsxs(e.MtButton,{variant:"ghost",className:"flex row items-center justify-between w-full",onClick:()=>{n?.(),a&&l?.openPage(a)},disabled:r,selected:o,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center gap-3",children:[t,i]}),s?e.jsxRuntimeExports.jsx("div",{className:"flex flex-row items-center gap-3 text-text-muted",children:s}):null]})}function be(){const t=q(),i=t?.properties??[],s=t?.currentView??null,n=f.useRef(null),r=i.map(d=>d.id),o=s?.settings?.visiblePropertyIds??r,a=s?.layout.SettingsMenu;f.useEffect(()=>{t?.focusViewNameEditor&&(n.current?.focus(),n.current?.select())},[t?.focusViewNameEditor]);const l=d=>{!t||!s||t.setCurrentView({...s,settings:{...s.settings??{},...d}})},c=s&&t&&a?a({currentView:s,properties:i,viewSettings:{...s.settings??{},visiblePropertyIds:o},setViewSettings:d=>l(d),setCurrentView:t.setCurrentView}):null,m=[],h=[],j=d=>{f.Children.forEach(d,y=>{if(Ee(y)){h.push(y);return}if(f.isValidElement(y)){if(y.type===f.Fragment){j(y.props.children);return}m.push(y)}})};return c&&j(c),e.jsxRuntimeExports.jsxs(ve,{initialPageId:t?.viewSettingsPageId??"root",onClose:()=>{t?.setShowViewSettings(!1),t?.setViewSettingsPageId("root"),t?.setFocusViewNameEditor(!1)},children:[e.jsxRuntimeExports.jsxs(O,{id:"root",title:"View Settings",children:[e.jsxRuntimeExports.jsx(F,{title:"View",children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtInput,{ref:n,value:s?.name??"",onChange:d=>{!t||!s||t.setCurrentView({...s,name:d.target.value})},placeholder:"View name",className:"w-full px-2!",variant:"ghost"})})}),m,e.jsxRuntimeExports.jsxs(F,{children:[e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(it,{size:14}),label:"Copy link to view",disabled:!0}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(at,{size:14}),label:"Shareing & Permissions",disabled:!0})]})]}),h]})}ve.Page=O;function P(t){return{name:t.name,icon:t.icon,groupBy:t.groupBy??null,settings:t.settings}}function bt(t,i){return!t||!i?!1:t.name===i.name&&t.icon===i.icon&&(t.groupBy??null)===(i.groupBy??null)&&JSON.stringify(t.settings??{})===JSON.stringify(i.settings??{})}function Rt({entries:t,views:i,properties:s=[{id:"id",label:"ID"}],toolbar:n,renderEntry:r,showViewSettings:o=!1,viewSettings:a=e.jsxRuntimeExports.jsx(be,{}),className:l}){const[c,m]=f.useState(i),[h,j]=f.useState(s),[d,y]=f.useState(o),[w,E]=f.useState("root"),[k,v]=f.useState(!1),[M,u]=f.useState(i[0]?.id??null),[b,R]=f.useState(Object.fromEntries(i.map(x=>[x.id,P(x)])));f.useEffect(()=>{m(i),R(Object.fromEntries(i.map(x=>[x.id,P(x)]))),u(x=>i.some(S=>S.id===x)?x:i[0]?.id??null)},[i]),f.useEffect(()=>{j(s)},[s]);const g=c.find(x=>x.id===M)??null,C=x=>{if(!x){u(null);return}m(S=>S.map(I=>I.id===x.id?{...I,...x}:I)),u(x.id)},D=x=>{m(S=>[...S,x]),R(S=>({...S,[x.id]:P(x)})),u(x.id)},L=(x,S)=>{m(I=>I.map(z=>z.id===x?{...z,...S}:z))},A=x=>{m(S=>{const I=S.filter(z=>z.id!==x);return I.length===0?(u(null),S):(M===x&&u(I[0]?.id??null),I)}),R(S=>{const I={...S};return delete I[x],I})},_=(()=>{if(!g)return!1;const x=P(g),S=b[g.id];return S?!bt(x,S):!1})(),B=()=>{g&&R(x=>({...x,[g.id]:P(g)}))},V=()=>{if(!g)return;const x=b[g.id];x&&L(g.id,{name:x.name,icon:x.icon,groupBy:x.groupBy,settings:x.settings})},G=(x="root",S)=>{E(x),v(!!S?.focusViewNameEditor),y(!0)},Y=()=>s.map(x=>x.id),J={visiblePropertyIds:g?.settings?.visiblePropertyIds??Y(),...g?.settings??{}},p=!!(d&&g&&a);return e.jsxRuntimeExports.jsx(ge.Provider,{value:{entries:t,views:c,currentView:g,setCurrentView:C,addView:D,updateView:L,deleteView:A,hasCurrentViewUnsavedChanges:_,saveCurrentViewAsDefault:B,revertCurrentViewToDefault:V,showViewSettings:d,setShowViewSettings:y,viewSettingsPageId:w,setViewSettingsPageId:E,focusViewNameEditor:k,setFocusViewNameEditor:v,openViewSettings:G,properties:h,setProperties:j},children:e.jsxRuntimeExports.jsxs("div",{className:`h-full min-h-0 flex flex-col border border-[#2A2A2A] bg-[#111111] rounded ${l}`,children:[n===void 0&&e.jsxRuntimeExports.jsx(je,{}),n!=null&&f.isValidElement(n)&&f.cloneElement(n),e.jsxRuntimeExports.jsxs("div",{className:"flex-1 min-h-0 flex flex-row overflow-hidden",children:[e.jsxRuntimeExports.jsx("div",{className:"flex-1 min-w-0 min-h-0",children:g?e.jsxRuntimeExports.jsx(g.layout,{entries:t,groupBy:g.groupBy,properties:h,viewSettings:J,renderEntry:g.renderEntry??r}):e.jsxRuntimeExports.jsx("div",{children:"No view selected"})}),e.jsxRuntimeExports.jsx("div",{className:`shrink-0 overflow-hidden transition-[width,opacity,transform] duration-200 ease-out ${p?"border-l border-[#2A2A2A] opacity-100 translate-x-0":"border-l-0 opacity-0 translate-x-1"}`,style:{width:p?"18.75rem":"0rem"},children:p?a:null})]})]})})}function T(t,i,s){let n=s.initialDeps??[],r,o=!0;function a(){var l,c,m;let h;s.key&&((l=s.debug)!=null&&l.call(s))&&(h=Date.now());const j=t();if(!(j.length!==n.length||j.some((w,E)=>n[E]!==w)))return r;n=j;let y;if(s.key&&((c=s.debug)!=null&&c.call(s))&&(y=Date.now()),r=i(...j),s.key&&((m=s.debug)!=null&&m.call(s))){const w=Math.round((Date.now()-h)*100)/100,E=Math.round((Date.now()-y)*100)/100,k=E/16,v=(M,u)=>{for(M=String(M);M.length<u;)M=" "+M;return M};console.info(`%c⏱ ${v(E,5)} /${v(w,5)} ms`,`
2
+ font-size: .6rem;
3
+ font-weight: bold;
4
+ color: hsl(${Math.max(0,Math.min(120-120*k,120))}deg 100% 31%);`,s?.key)}return s?.onChange&&!(o&&s.skipInitialOnChange)&&s.onChange(r),o=!1,r}return a.updateDeps=l=>{n=l},a}function de(t,i){if(t===void 0)throw new Error("Unexpected undefined");return t}const St=(t,i)=>Math.abs(t-i)<1.01,wt=(t,i,s)=>{let n;return function(...r){t.clearTimeout(n),n=t.setTimeout(()=>i.apply(this,r),s)}},xe=t=>{const{offsetWidth:i,offsetHeight:s}=t;return{width:i,height:s}},Mt=t=>t,kt=t=>{const i=Math.max(t.startIndex-t.overscan,0),s=Math.min(t.endIndex+t.overscan,t.count-1),n=[];for(let r=i;r<=s;r++)n.push(r);return n},Ct=(t,i)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;const r=a=>{const{width:l,height:c}=a;i({width:Math.round(l),height:Math.round(c)})};if(r(xe(s)),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const m=c.borderBoxSize[0];if(m){r({width:m.inlineSize,height:m.blockSize});return}}r(xe(s))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return o.observe(s,{box:"border-box"}),()=>{o.unobserve(s)}},me={passive:!0},he=typeof window>"u"?!0:"onscrollend"in window,It=(t,i)=>{const s=t.scrollElement;if(!s)return;const n=t.targetWindow;if(!n)return;let r=0;const o=t.options.useScrollendEvent&&he?()=>{}:wt(n,()=>{i(r,!1)},t.options.isScrollingResetDelay),a=h=>()=>{const{horizontal:j,isRtl:d}=t.options;r=j?s.scrollLeft*(d&&-1||1):s.scrollTop,o(),i(r,h)},l=a(!0),c=a(!1);s.addEventListener("scroll",l,me);const m=t.options.useScrollendEvent&&he;return m&&s.addEventListener("scrollend",c,me),()=>{s.removeEventListener("scroll",l),m&&s.removeEventListener("scrollend",c)}},Nt=(t,i,s)=>{if(i?.borderBoxSize){const n=i.borderBoxSize[0];if(n)return Math.round(n[s.options.horizontal?"inlineSize":"blockSize"])}return t[s.options.horizontal?"offsetWidth":"offsetHeight"]},Dt=(t,{adjustments:i=0,behavior:s},n)=>{var r,o;const a=t+i;(o=(r=n.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[n.options.horizontal?"left":"top"]:a,behavior:s})};class Vt{constructor(i){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var s,n,r;return((r=(n=(s=this.targetWindow)==null?void 0:s.performance)==null?void 0:n.now)==null?void 0:r.call(n))??Date.now()},this.observer=(()=>{let s=null;const n=()=>s||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:s=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{const a=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),s=null},observe:r=>{var o;return(o=n())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=n())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=s=>{Object.entries(s).forEach(([n,r])=>{typeof r>"u"&&delete s[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Mt,rangeExtractor:kt,onChange:()=>{},measureElement:Nt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...s}},this.notify=s=>{var n,r;(r=(n=this.options).onChange)==null||r.call(n,this,s)},this.maybeNotify=T(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),s=>{this.notify(s)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(s=>s()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var s;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((s=this.scrollElement)==null?void 0:s.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(s,n)=>{const r=new Map,o=new Map;for(let a=n-1;a>=0;a--){const l=s[a];if(r.has(l.lane))continue;const c=o.get(l.lane);if(c==null||l.end>c.end?o.set(l.lane,l):l.end<c.end&&r.set(l.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=T(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(s,n,r,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:s,paddingStart:n,scrollMargin:r,getItemKey:o,enabled:a,lanes:l}),{key:!1}),this.getMeasurements=T(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:s,paddingStart:n,scrollMargin:r,getItemKey:o,enabled:a,lanes:l},c)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>s)for(const d of this.laneAssignments.keys())d>=s&&this.laneAssignments.delete(d);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const m=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===s&&(this.lanesSettling=!1);const h=this.measurementsCache.slice(0,m),j=new Array(l).fill(void 0);for(let d=0;d<m;d++){const y=h[d];y&&(j[y.lane]=d)}for(let d=m;d<s;d++){const y=o(d),w=this.laneAssignments.get(d);let E,k;if(w!==void 0&&this.options.lanes>1){E=w;const b=j[E],R=b!==void 0?h[b]:void 0;k=R?R.end+this.options.gap:n+r}else{const b=this.options.lanes===1?h[d-1]:this.getFurthestMeasurement(h,d);k=b?b.end+this.options.gap:n+r,E=b?b.lane:d%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(d,E)}const v=c.get(y),M=typeof v=="number"?v:this.options.estimateSize(d),u=k+M;h[d]={index:d,start:k,size:M,end:u,key:y,lane:E},j[E]=d}return this.measurementsCache=h,h},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=T(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(s,n,r,o)=>this.range=s.length>0&&n>0?At({measurements:s,outerSize:n,scrollOffset:r,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=T(()=>{let s=null,n=null;const r=this.calculateRange();return r&&(s=r.startIndex,n=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,s,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,s,n]},(s,n,r,o,a)=>o===null||a===null?[]:s({startIndex:o,endIndex:a,overscan:n,count:r}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=s=>{const n=this.options.indexAttribute,r=s.getAttribute(n);return r?parseInt(r,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=s=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(r!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,r-o),l=Math.min(this.options.count-1,r+o);return s>=a&&s<=l}return!0},this._measureElement=(s,n)=>{if(!s.isConnected){this.observer.unobserve(s);return}const r=this.indexFromElement(s),o=this.measurementsCache[r];if(!o)return;const a=o.key,l=this.elementsCache.get(a);l!==s&&(l&&this.observer.unobserve(l),this.observer.observe(s),this.elementsCache.set(a,s)),this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(s,n,this))},this.resizeItem=(s,n)=>{var r;const o=this.measurementsCache[s];if(!o)return;const a=this.itemSizeCache.get(o.key)??o.size,l=n-a;l!==0&&(((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,l,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",l),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,n)),this.notify(!1))},this.measureElement=s=>{if(!s){this.elementsCache.forEach((n,r)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(r))});return}this._measureElement(s,void 0)},this.getVirtualItems=T(()=>[this.getVirtualIndexes(),this.getMeasurements()],(s,n)=>{const r=[];for(let o=0,a=s.length;o<a;o++){const l=s[o],c=n[l];r.push(c)}return r},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=s=>{const n=this.getMeasurements();if(n.length!==0)return de(n[Re(0,n.length-1,r=>de(n[r]).start,s)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const s=this.scrollElement.document.documentElement;return this.options.horizontal?s.scrollWidth-this.scrollElement.innerWidth:s.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(s,n,r=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),a=this.getScrollOffset();n==="auto"&&(n=s>=a+o?"end":"start"),n==="center"?s+=(r-o)/2:n==="end"&&(s-=o);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,s),0)},this.getOffsetForIndex=(s,n="auto")=>{s=Math.max(0,Math.min(s,this.options.count-1));const r=this.getSize(),o=this.getScrollOffset(),a=this.measurementsCache[s];if(!a)return;if(n==="auto")if(a.end>=o+r-this.options.scrollPaddingEnd)n="end";else if(a.start<=o+this.options.scrollPaddingStart)n="start";else return[o,n];if(n==="end"&&s===this.options.count-1)return[this.getMaxScrollOffset(),n];const l=n==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,n,a.size),n]},this.scrollToOffset=(s,{align:n="start",behavior:r="auto"}={})=>{const o=this.getOffsetForAlignment(s,n),a=this.now();this.scrollState={index:null,align:n,behavior:r,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(s,{align:n="auto",behavior:r="auto"}={})=>{s=Math.max(0,Math.min(s,this.options.count-1));const o=this.getOffsetForIndex(s,n);if(!o)return;const[a,l]=o,c=this.now();this.scrollState={index:s,align:l,behavior:r,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(s,{behavior:n="auto"}={})=>{const r=this.getScrollOffset()+s,o=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:o,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var s;const n=this.getMeasurements();let r;if(n.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((s=n[n.length-1])==null?void 0:s.end)??0;else{const o=Array(this.options.lanes).fill(null);let a=n.length-1;for(;a>=0&&o.some(l=>l===null);){const l=n[a];o[l.lane]===null&&(o[l.lane]=l.end),a--}r=Math.max(...o.filter(l=>l!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(s,{adjustments:n,behavior:r})=>{this.options.scrollToFn(s,{behavior:r,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(i)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,r=n?n[0]:this.scrollState.lastTargetOffset,o=1,a=r!==this.scrollState.lastTargetOffset;if(!a&&St(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=r,this.scrollState.behavior="auto",this._scrollToOffset(r,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Re=(t,i,s,n)=>{for(;t<=i;){const r=(t+i)/2|0,o=s(r);if(o<n)t=r+1;else if(o>n)i=r-1;else return r}return t>0?t-1:0};function At({measurements:t,outerSize:i,scrollOffset:s,lanes:n}){const r=t.length-1,o=c=>t[c].start;if(t.length<=n)return{startIndex:0,endIndex:r};let a=Re(0,r,o,s),l=a;if(n===1)for(;l<r&&t[l].end<s+i;)l++;else if(n>1){const c=Array(n).fill(0);for(;l<r&&c.some(h=>h<s+i);){const h=t[l];c[h.lane]=h.end,l++}const m=Array(n).fill(s+i);for(;a>=0&&m.some(h=>h>=s);){const h=t[a];m[h.lane]=h.start,a--}a=Math.max(0,a-a%n),l=Math.min(r,l+(n-1-l%n))}return{startIndex:a,endIndex:l}}const pe=typeof document<"u"?W.useLayoutEffect:W.useEffect;function zt({useFlushSync:t=!0,...i}){const s=W.useReducer(()=>({}),{})[1],n={...i,onChange:(o,a)=>{var l;t&&a?_e.flushSync(s):s(),(l=i.onChange)==null||l.call(i,o,a)}},[r]=W.useState(()=>new Vt(n));return r.setOptions(n),pe(()=>r._didMount(),[]),pe(()=>r._willUpdate()),r}function Ft(t){return zt({observeElementRect:Ct,observeElementOffset:It,scrollToFn:Dt,...t})}function le(t){return"type"in t&&t.type==="group"}function fe(t){return t==null?!1:typeof t=="string"?t.trim().length>0:typeof t=="number"||typeof t=="boolean"}function X(t){return String(t?.identifier??t?.key??t?.id??"")}function K(t){return typeof t?.summary=="string"?t.summary:typeof t?.title=="string"?t.title:typeof t?.name=="string"?t.name:""}function _t(t){return typeof t?.priority=="string"?t.priority:""}function Ot(t){return typeof t?.assignee=="string"?t.assignee:typeof t?.assignee?.name=="string"?t.assignee.name:""}function Se(t,i){if(!i)return t;if(le(i))return t.filter(l=>Bt(l,i));const s=i,n=String(s.query??"").trim().toLowerCase(),r=s.status??[],o=s.priority??[],a=s.assignee??[];return!n&&r.length===0&&o.length===0&&a.length===0?t:t.filter(l=>{const c=String(l?.status??""),m=String(l?.priority??""),h=String(l?.assignee??"");if(r.length>0&&!r.includes(c)||o.length>0&&!o.includes(m)||a.length>0&&!a.includes(h))return!1;if(!n)return!0;const j=X(l).toLowerCase(),d=K(l).toLowerCase();return j.includes(n)||d.includes(n)})}function Lt(t,i){if(i==="id")return X(t);if(i==="summary")return K(t);const s=t?.[i];if(s!=null)return String(s)}function Tt(t,i){const s=Lt(t,i.field),n=String(s??"").toLowerCase(),r=String(i.value??"").toLowerCase();switch(i.operator){case"is":return n===r;case"is_not":return n!==r;case"contains":return n.includes(r);case"is_empty":return!s;case"is_not_empty":return!!s;default:return!0}}function we(t,i){if(i.type==="rule")return Tt(t,i);if(i.children.length===0)return!0;const s=i.children.map(n=>we(t,n));return i.conjunction==="AND"?s.every(Boolean):s.some(Boolean)}function Bt(t,i){return we(t,i)}function Q(){return{type:"group",conjunction:"AND",children:[{type:"rule",field:"summary",operator:"contains",value:""}]}}function Me(t){if(!t)return 0;if(!le(t))return(t.status?.length??0)+(t.priority?.length??0)+(t.assignee?.length??0)+(t.query?1:0);const i=s=>s.type==="rule"?1:s.children.reduce((n,r)=>n+i(r),0);return i(t)}function ke(t){if(!t)return!1;if(!le(t))return fe(t.query)||(t.status?.length??0)>0||(t.priority?.length??0)>0||(t.assignee?.length??0)>0;const i=s=>s.type==="group"?s.children.some(n=>i(n)):s.operator==="is_empty"||s.operator==="is_not_empty"?!0:fe(s.value);return i(t)}function Ce(t,i,s="updated"){const n=[...t],r={high:3,medium:2,low:1},o={backlog:1,open:2,"in progress":3,done:4},a=(l,c,m)=>{if(m==="priority"){const w=r[String(l?.priority??"").toLowerCase()]??0;return(r[String(c?.priority??"").toLowerCase()]??0)-w}if(m==="status"){const w=o[String(l?.status??"").toLowerCase()]??0;return(o[String(c?.status??"").toLowerCase()]??0)-w}const h=m==="updated"?l?.updatedAt??l?.updated??l?.id:l?.[m],j=m==="updated"?c?.updatedAt??c?.updated??c?.id:c?.[m],d=Number(h),y=Number(j);return!Number.isNaN(d)&&!Number.isNaN(y)?y-d:String(j??"").localeCompare(String(h??""),void 0,{numeric:!0,sensitivity:"base"})};return n.sort((l,c)=>{if(i&&i.length>0){for(const m of i){const h=a(l,c,m.property);if(h!==0)return m.direction==="desc"?h:-h}return 0}return a(l,c,s)}),n}function Ie(t,i){if(!i)return t;const s=i.status??[],n=i.assignee??[],r=String(i.search??"").trim().toLowerCase();return s.length===0&&n.length===0&&!r?t:t.filter(o=>{const a=String(o?.status??""),l=String(o?.assignee??"");if(s.length>0&&!s.includes(a)||n.length>0&&!n.includes(l))return!1;if(!r)return!0;const c=X(o).toLowerCase(),m=K(o).toLowerCase();return c.includes(r)||m.includes(r)})}const Pt=[{value:"low",label:"Low",icon:e.jsxRuntimeExports.jsx(e.MtLowIcon,{})},{value:"medium",label:"Medium",icon:e.jsxRuntimeExports.jsx(e.MtMediumIcon,{})},{value:"high",label:"High",icon:e.jsxRuntimeExports.jsx(e.MtHighIcon,{})}],qt=[{value:"backlog",label:"Backlog",icon:e.jsxRuntimeExports.jsx(e.MtBacklogIcon,{})},{value:"open",label:"Open",icon:e.jsxRuntimeExports.jsx(e.MtOpenIcon,{})},{value:"in progress",label:"In Progress",icon:e.jsxRuntimeExports.jsx(e.MtInProgressIcon,{})},{value:"done",label:"Done",icon:e.jsxRuntimeExports.jsx(e.MtCheckIcon,{})}],$t=[{value:"user story",label:"User story",icon:e.jsxRuntimeExports.jsx(se,{size:14,stroke:"#60A5FA"})},{value:"bug",label:"Bug",icon:e.jsxRuntimeExports.jsx(ne,{size:14,stroke:"#EF4444"})},{value:"docs",label:"Docs",icon:e.jsxRuntimeExports.jsx(ie,{size:14,stroke:"#A78BFA"})},{value:"feature",label:"Feature",icon:e.jsxRuntimeExports.jsx(oe,{size:14,stroke:"#F59E0B"})},{value:"task",label:"Task",icon:e.jsxRuntimeExports.jsx(re,{size:14,stroke:"#22C55E"})}];function Gt({value:t,onChange:i}){return e.jsxRuntimeExports.jsx(e.MtSelect,{kind:"icon",variant:"ghost",placeholder:"?",value:t,onValueChange:i,options:Pt})}const Ne=Gt;function De({value:t,onChange:i}){return e.jsxRuntimeExports.jsx(e.MtSelect,{kind:"icon",variant:"ghost",placeholder:"?",value:t,onValueChange:i,options:qt})}function Ve({value:t,onChange:i}){return e.jsxRuntimeExports.jsx(e.MtSelect,{kind:"icon",variant:"ghost",placeholder:"?",value:t,onValueChange:i,options:$t})}function Ae({value:t,onChange:i,placeholder:s="Summary..."}){return e.jsxRuntimeExports.jsx("input",{value:t,onChange:n=>i(n.target.value),placeholder:s,className:"w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-sm text-text-primary outline-none focus:border-[#2A2A2A]"})}function Wt({entry:t,visiblePropertySet:i,onSummaryChange:s,onPriorityChange:n,onStatusChange:r,onIssueTypeChange:o}){const a=t?.id?String(t.id):"",l=t?.name?String(t.name):t?.title?String(t.title):"",c=t?.status?String(t.status):t?.state?String(t.state):"",m=t?.priority?String(t.priority):void 0,h=t?.assignee?String(t.assignee):"",j=t?.summary?String(t.summary):"",d=String(t?.entryType??t?.issueType??t?.type??"user story").toLowerCase(),y=!!t?.selected,[w,E]=f.useState(j),[k,v]=f.useState(m),[M,u]=f.useState(c),[b,R]=f.useState(d);f.useEffect(()=>{E(j),v(m),u(c),R(d)},[j,m,c,d]);const g=i.has("id"),C=i.has("name")||i.has("title"),D=i.has("status")||i.has("state"),L=i.has("type")||i.has("entryType")||i.has("issueType"),A=i.has("priority"),_=i.has("assignee"),B=(()=>{switch(d){case"bug":return ne;case"docs":case"documentation":return ie;case"feature":return oe;case"task":return re;default:return se}})();return e.jsxRuntimeExports.jsxs("div",{className:"group flex items-center gap-2 px-4 border-b border-[#2A2A2A] h-[44px] bg-[#141414] text-sm",children:[e.jsxRuntimeExports.jsx("div",{className:`${y?"opacity-100":"opacity-0 group-hover:opacity-100"} transition-opacity`,children:e.jsxRuntimeExports.jsx(e.MtCheckbox,{checked:y})}),A?e.jsxRuntimeExports.jsx(Ne,{value:k,onChange:V=>{v(V),n?.(V)}}):null,L?e.jsxRuntimeExports.jsx(Ve,{value:b,onChange:V=>{R(V),o?.(V)}}):null,g?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1 text-text-primary min-w-0",children:[L?null:e.jsxRuntimeExports.jsx(B,{size:14,stroke:"#608a23"}),e.jsxRuntimeExports.jsx("span",{className:"truncate",children:a})]}):null,D?e.jsxRuntimeExports.jsx(De,{value:M,onChange:V=>{u(V),r?.(V)}}):null,C?e.jsxRuntimeExports.jsx("span",{className:"text-text-primary truncate max-w-40",children:l||"—"}):null,e.jsxRuntimeExports.jsx("div",{className:"flex-1 min-w-0",children:e.jsxRuntimeExports.jsx(Ae,{value:w,onChange:V=>{E(V),s?.(V)}})}),_?e.jsxRuntimeExports.jsx(e.MtAvatar,{name:h,size:"xs"}):null]})}const Ht=["summary"];function $(t){return Array.from(new Set([...t,...Ht]))}function ze(t){const i=[...t],s=n=>i.some(r=>r.id===n);return s("summary")||i.unshift({id:"summary",label:"Summary"}),!s("type")&&!s("entryType")&&!s("issueType")&&i.push({id:"type",label:"Type"}),i}function Ut({label:t,count:i}){return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between px-6 border-b border-border-default h-11 bg-[#111111] text-sm",children:[e.jsxRuntimeExports.jsx("span",{className:"text-text-primary",children:t}),e.jsxRuntimeExports.jsx("span",{className:"text-text-muted",children:i})]})}const Xt=44;function Kt(t,i){if(!i)return t.map(r=>({type:"entry",key:`entry-${r.id}`,entry:r}));const s=new Map;t.forEach(r=>{const o=r?.[i],a=o==null||o===""?"Ungrouped":String(o),l=s.get(a);if(l){l.push(r);return}s.set(a,[r])});const n=[];return s.forEach((r,o)=>{n.push({type:"group",key:`group-${i}-${o}`,label:o,count:r.length}),r.forEach(a=>{n.push({type:"entry",key:`entry-${a.id}`,entry:a})})}),n}const ae=t=>{const i=f.useMemo(()=>t.properties&&t.properties.length>0?t.properties:[{id:"id",label:"ID"}],[t.properties]),[s,n]=f.useState({}),r=f.useMemo(()=>t.entries.map(M=>{const u=String(M?.id??""),b=s[u];return b?{...M,...b}:M}),[t.entries,s]),o=f.useMemo(()=>$(t.viewSettings?.visiblePropertyIds??i.map(M=>M.id)),[t.viewSettings?.visiblePropertyIds,i]),a=f.useMemo(()=>new Set(o),[o]),l=t.renderEntry,c=f.useRef(null),m=f.useMemo(()=>t.viewSettings?.filter??{},[t.viewSettings?.filter]),h=f.useMemo(()=>t.viewSettings?.quickFilters??{},[t.viewSettings?.quickFilters]),j=f.useMemo(()=>t.viewSettings?.sortRules??[],[t.viewSettings?.sortRules]),d=typeof t.viewSettings?.sortBy=="string"?t.viewSettings.sortBy:"updated",y=f.useMemo(()=>Se(r,m),[r,m]),w=f.useMemo(()=>Ie(y,h),[y,h]),E=f.useMemo(()=>Ce(w,j,d),[w,j,d]),k=f.useMemo(()=>Kt(E,t.groupBy),[E,t.groupBy]),v=Ft({count:k.length,getScrollElement:()=>c.current,overscan:5,estimateSize:()=>Xt});return e.jsxRuntimeExports.jsx("div",{id:"scroll-container",ref:c,className:"h-full min-h-0 overflow-y-auto",children:e.jsxRuntimeExports.jsx("div",{className:"relative",style:{height:v.getTotalSize()},children:v.getVirtualItems().map(M=>{const u=k[M.index];return u?e.jsxRuntimeExports.jsx("div",{className:"absolute top-0 left-0 w-full",style:{transform:`translateY(${M.start}px)`},children:u.type==="group"?e.jsxRuntimeExports.jsx(Ut,{label:u.label,count:u.count}):l?e.jsxRuntimeExports.jsx(l,{entry:u.entry}):e.jsxRuntimeExports.jsx(Wt,{entry:u.entry,visiblePropertySet:a,onSummaryChange:b=>{const R=String(u.entry?.id??"");n(g=>({...g,[R]:{...g[R]??{},summary:b}}))},onPriorityChange:b=>{const R=String(u.entry?.id??"");n(g=>({...g,[R]:{...g[R]??{},priority:b}}))},onStatusChange:b=>{const R=String(u.entry?.id??"");n(g=>({...g,[R]:{...g[R]??{},status:b,state:b}}))},onIssueTypeChange:b=>{const R=String(u.entry?.id??"");n(g=>({...g,[R]:{...g[R]??{},type:b,entryType:b,issueType:b}}))}})},u.key):null})})})};function Qt({currentView:t,properties:i,viewSettings:s,setViewSettings:n,setCurrentView:r}){const o=s.filter??{},a=ze(i),l=$(s.visiblePropertyIds??a.map(u=>u.id)),c=new Set(l),m=i.filter(u=>u.groupable),h=t.groupBy??null,j=h?i.find(u=>u.id===h)?.label??h:"None",d=s.sortRules??[],y=[{value:"updated",label:"Updated"},{value:"priority",label:"Priority"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"summary",label:"Summary"}],w=d.length>0?y.find(u=>u.value===d[0].property)?.label??d[0].property:"None",E=Me(o),k=[{value:"summary",label:"Summary"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"assignee",label:"Assignee"},{value:"id",label:"ID"}],v=[{value:"is",label:"is",requiresValue:!0},{value:"is_not",label:"is not",requiresValue:!0},{value:"contains",label:"contains",requiresValue:!0},{value:"is_empty",label:"is empty",requiresValue:!1},{value:"is_not_empty",label:"is not empty",requiresValue:!1}],M="type"in o&&o.type==="group"?o:Q();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(F,{title:"View options",children:[e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(e.ListFilter,{size:14}),label:"Filter",submenu:"filter",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[E>0?`${E} active`:"None",e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(H,{size:14}),label:"Properties",submenu:"properties",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[l.length,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(U,{size:14}),label:"Group",submenu:"group",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[j,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(e.ArrowUpDown,{size:14}),label:"Sort",submenu:"sort",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[w,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})})]}),e.jsxRuntimeExports.jsx(O,{id:"filter",title:"Filter",children:e.jsxRuntimeExports.jsx(F,{children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtFilterDropdown,{title:"Filter",value:M,onChange:u=>n({filter:u}),fields:k,operators:v,variant:"ghost"})})})}),e.jsxRuntimeExports.jsx(O,{id:"properties",title:"Properties",children:e.jsxRuntimeExports.jsx(F,{title:"Visible columns",children:a.map(u=>e.jsxRuntimeExports.jsx(N,{label:u.label,active:c.has(u.id),disabled:u.id==="summary",trailing:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:c.has(u.id)?"Visible":"Hidden"}),onClick:()=>{if(u.id==="summary")return;const b=c.has(u.id),R=b?l.filter(g=>g!==u.id):[...l,u.id];n({visiblePropertyIds:$(R)}),b&&t.groupBy===u.id&&r({...t,groupBy:null})}},u.id))})}),e.jsxRuntimeExports.jsx(O,{id:"group",title:"Group",children:e.jsxRuntimeExports.jsxs(F,{title:"Group by",children:[e.jsxRuntimeExports.jsx(N,{label:"None",active:h===null,onClick:()=>{r({...t,groupBy:null})}}),m.length>0?m.map(u=>e.jsxRuntimeExports.jsx(N,{label:u.label,active:t.groupBy===u.id,onClick:()=>{r({...t,groupBy:u.id})}},u.id)):e.jsxRuntimeExports.jsx(N,{label:"No groupable properties",disabled:!0})]})}),e.jsxRuntimeExports.jsx(O,{id:"sort",title:"Sort",children:e.jsxRuntimeExports.jsx(F,{children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtSortDropdown,{title:"Sort",value:d,onChange:u=>n({sortRules:u}),fields:y,variant:"ghost"})})})})]})}ae.SettingsMenu=Qt;function Yt(){const t=q(),i=t.currentView,s=t.properties;if(!i)return null;const n=i.settings??{},r=n.sortRules??[],o=ze(s),a=$(n.visiblePropertyIds??o.map(v=>v.id)),l=s.filter(v=>v.groupable),c=t.setCurrentView,m=v=>{c({...i,settings:{...i.settings??{},...v}})},h=[{value:"summary",label:"Summary"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"assignee",label:"Assignee"},{value:"id",label:"ID"}],j=[{value:"is",label:"is",requiresValue:!0},{value:"is_not",label:"is not",requiresValue:!0},{value:"contains",label:"contains",requiresValue:!0},{value:"is_empty",label:"is empty",requiresValue:!1},{value:"is_not_empty",label:"is not empty",requiresValue:!1}],d=[{value:"updated",label:"Updated"},{value:"priority",label:"Priority"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"summary",label:"Summary"}],y=n.filter&&typeof n.filter=="object"&&"type"in n.filter?n.filter:Q(),w=!!i.groupBy,E=r.length>0,k=ke(n.filter);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(U,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:w?"accent":"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsxs("div",{className:"w-56 p-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>c({...i,groupBy:null}),children:"None"}),l.map(v=>e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>c({...i,groupBy:v.id}),children:v.label},v.id))]})}),w?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>c({...i,groupBy:null}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtSortDropdown,{title:"Sort",kind:"icon",variant:E?"accent":"ghost",showCaret:!1,value:r,onChange:v=>m({sortRules:v}),fields:d}),E?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>m({sortRules:[]}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtFilterDropdown,{title:"Filter",kind:"icon",variant:k?"accent":"ghost",showCaret:!1,value:y,onChange:v=>m({filter:v}),fields:h,operators:j}),k?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>m({filter:void 0}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(H,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsx("div",{className:"w-56 p-1",children:o.map(v=>{const M=a.includes(v.id),u=M?a.filter(b=>b!==v.id):[...a,v.id];return e.jsxRuntimeExports.jsx(e.MtDropdownItem,{disabled:v.id==="summary",onSelect:()=>{v.id!=="summary"&&m({visiblePropertyIds:$(u)})},children:e.jsxRuntimeExports.jsxs("span",{className:"flex items-center justify-between w-full",children:[e.jsxRuntimeExports.jsx("span",{children:v.label}),e.jsxRuntimeExports.jsx("span",{className:"text-text-muted text-xs",children:M?"Visible":"Hidden"})]})},v.id)})})})]})}ae.ToolbarActions=Yt;function Jt({entry:t}){return e.jsxRuntimeExports.jsx("div",{className:"flex items-center px-6 border-b border-[#2A2A2A] h-11 bg-[#141414]",children:t.id})}const Zt=t=>{const i=t.renderEntry??Jt;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{children:"Grid Layout"}),t.entries.map(s=>e.jsxRuntimeExports.jsx(i,{entry:s},s.id))]})};function es({entry:t}){return e.jsxRuntimeExports.jsx("div",{className:"flex items-center px-6 border-b border-[#2A2A2A] h-11 bg-[#141414]",children:t.id})}const ts=t=>{const i=t.renderEntry??es;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{children:"Table Layout"}),t.entries.map(s=>e.jsxRuntimeExports.jsx(i,{entry:s},s.id))]})},ss=["summary"];function te(t){return Array.from(new Set([...t,...ss]))}function ns(t){const i=[...t],s=n=>i.some(r=>r.id===n);return s("summary")||i.unshift({id:"summary",label:"Summary"}),!s("type")&&!s("entryType")&&!s("issueType")&&i.push({id:"type",label:"Type"}),i}function is({entry:t,onSummaryChange:i,onPriorityChange:s,onStatusChange:n,onIssueTypeChange:r,visiblePropertySet:o}){const a=X(t),l=_t(t),c=t?.status?String(t.status):t?.state?String(t.state):"",m=Ot(t),h=K(t),j=String(t?.entryType??t?.issueType??t?.type??"user story").toLowerCase(),d=o.has("summary"),y=o.has("id"),w=o.has("status")||o.has("state"),E=o.has("type")||o.has("entryType")||o.has("issueType"),k=o.has("priority"),v=o.has("assignee"),M=y||E||w||k||v,u=(()=>{switch(j){case"bug":return ne;case"docs":case"documentation":return ie;case"feature":return oe;case"task":return re;default:return se}})();return e.jsxRuntimeExports.jsxs("div",{className:"rounded border border-[#2A2A2A] bg-[#141414] p-3 text-sm",children:[d?e.jsxRuntimeExports.jsx(Ae,{value:h,onChange:i}):null,M?e.jsxRuntimeExports.jsxs("div",{className:"flex row justify-between items-center px-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex row gap-2 items-center min-w-0",children:[E?e.jsxRuntimeExports.jsx(Ve,{value:j,onChange:r}):null,y?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[E?null:e.jsxRuntimeExports.jsx(u,{size:14,stroke:"#608a23"}),e.jsxRuntimeExports.jsx("div",{className:"text-xs text-text-primary",children:a})]}):null,w?e.jsxRuntimeExports.jsx(De,{value:c,onChange:n}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-primary",children:[k?e.jsxRuntimeExports.jsx(Ne,{value:l,onChange:s}):null,v?e.jsxRuntimeExports.jsx(e.MtAvatar,{name:String(m??""),size:"xs"}):null]})]}):null]})}function rs(t,i){if(!i)return[{key:"all",label:"All",entries:t}];const s=new Map;return t.forEach(n=>{const r=n?.[i],o=r==null||r===""?"Ungrouped":String(r);s.has(o)||s.set(o,[]),s.get(o).push(n)}),Array.from(s.entries()).map(([n,r])=>({key:`${i}-${n}`,label:n,entries:r}))}const ue=t=>{const i=t.renderEntry,s=f.useMemo(()=>t.properties&&t.properties.length>0?t.properties:[{id:"id",label:"ID"}],[t.properties]),n=f.useMemo(()=>te(t.viewSettings?.visiblePropertyIds??s.map(R=>R.id)),[t.viewSettings?.visiblePropertyIds,s]),r=f.useMemo(()=>new Set(n),[n]),[o,a]=f.useState(t.entries),[l,c]=f.useState(null),[m,h]=f.useState(null);f.useEffect(()=>{a(t.entries)},[t.entries]);const j=t.groupBy??"status",d=typeof t.viewSettings?.sortBy=="string"?t.viewSettings.sortBy:"updated",y=f.useMemo(()=>t.viewSettings?.quickFilters??{},[t.viewSettings?.quickFilters]),w=t.viewSettings?.sortRules??[],E=f.useMemo(()=>t.viewSettings?.filter??{},[t.viewSettings?.filter]),k=f.useMemo(()=>Se(o,E),[o,E]),v=f.useMemo(()=>Ie(k,y),[k,y]),M=Ce(v,w,d),u=rs(M,j),b=(R,g)=>{a(C=>C.map(D=>String(D?.id)===R?{...D,...g}:D))};return e.jsxRuntimeExports.jsx("div",{className:"h-full min-h-0 overflow-auto p-3",children:e.jsxRuntimeExports.jsx("div",{className:"flex min-w-max gap-3",children:u.map(R=>e.jsxRuntimeExports.jsxs("div",{onDragEnter:g=>{g.preventDefault(),h(R.key)},onDragOver:g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"},onDragLeave:()=>{m===R.key&&h(null)},onDrop:g=>{g.preventDefault();const C=g.dataTransfer.getData("text/plain")||l;C&&(a(D=>{if(!D.find(_=>String(_?.id)===C)||!j)return D;const A=R.label==="Ungrouped"?null:R.label;return D.map(_=>String(_?.id)===C?{..._,[j]:A}:_)}),h(null),c(null))},className:`w-72 min-w-72 rounded border bg-[#111111] ${m===R.key?"border-border-default":"border-[#2A2A2A]"}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between border-b border-border-default px-3 py-2 text-sm",children:[e.jsxRuntimeExports.jsx("span",{className:"text-text-primary",children:R.label}),e.jsxRuntimeExports.jsx("span",{className:"text-text-muted",children:R.entries.length})]}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2 p-2",children:R.entries.map(g=>e.jsxRuntimeExports.jsx("div",{draggable:!0,onDragStart:C=>{const D=String(g?.id);c(D),C.dataTransfer.setData("text/plain",D),C.dataTransfer.effectAllowed="move"},onDragEnd:()=>{c(null),h(null)},className:`cursor-grab active:cursor-grabbing ${l&&String(g?.id)===l?"opacity-50":""}`,children:i?e.jsxRuntimeExports.jsx(i,{entry:g}):e.jsxRuntimeExports.jsx(is,{entry:g,visiblePropertySet:r,onSummaryChange:C=>{b(String(g?.id),{summary:C})},onPriorityChange:C=>{b(String(g?.id),{priority:C})},onStatusChange:C=>{b(String(g?.id),{status:C})},onIssueTypeChange:C=>{b(String(g?.id),{entryType:C,type:C,issueType:C})}})},g.id))})]},R.key))})})};function os({currentView:t,properties:i,viewSettings:s,setViewSettings:n,setCurrentView:r}){const o=i.filter(u=>u.groupable),a=ns(i),l=te(s.visiblePropertyIds??a.map(u=>u.id)),c=new Set(l),m=t.groupBy??"status",h=m?i.find(u=>u.id===m)?.label??m:"None",j=s.filter??{},d=Me(j),y=s.sortRules??[],w=[{value:"updated",label:"Updated"},{value:"priority",label:"Priority"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"summary",label:"Summary"}],E=y.length>0?w.find(u=>u.value===y[0].property)?.label??y[0].property:"None",k=[{value:"summary",label:"Summary"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"assignee",label:"Assignee"},{value:"id",label:"ID"}],v=[{value:"is",label:"is",requiresValue:!0},{value:"is_not",label:"is not",requiresValue:!0},{value:"contains",label:"contains",requiresValue:!0},{value:"is_empty",label:"is empty",requiresValue:!1},{value:"is_not_empty",label:"is not empty",requiresValue:!1}],M="type"in j&&j.type==="group"?j:Q();return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(F,{title:"View options",children:[e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(e.ListFilter,{size:14}),label:"Filter",submenu:"filter",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d>0?`${d} active`:"None",e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(H,{size:14}),label:"Properties",submenu:"properties",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[l.length,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(U,{size:14}),label:"Group",submenu:"group",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[h,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})}),e.jsxRuntimeExports.jsx(N,{icon:e.jsxRuntimeExports.jsx(e.ArrowUpDown,{size:14}),label:"Sort",submenu:"sort",trailing:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[E,e.jsxRuntimeExports.jsx(e.ChevronRight,{size:14})]})})]}),e.jsxRuntimeExports.jsx(O,{id:"properties",title:"Properties",children:e.jsxRuntimeExports.jsx(F,{title:"Visible columns",children:a.map(u=>e.jsxRuntimeExports.jsx(N,{label:u.label,active:c.has(u.id),disabled:u.id==="summary",trailing:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:c.has(u.id)?"Visible":"Hidden"}),onClick:()=>{if(u.id==="summary")return;const b=c.has(u.id),R=b?l.filter(g=>g!==u.id):[...l,u.id];n({visiblePropertyIds:te(R)}),b&&t.groupBy===u.id&&r({...t,groupBy:null})}},u.id))})}),e.jsxRuntimeExports.jsx(O,{id:"filter",title:"Filter",children:e.jsxRuntimeExports.jsx(F,{children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtFilterDropdown,{title:"Filter",value:M,onChange:u=>{r({...t,settings:{...t.settings??{},filter:u}})},fields:k,operators:v,variant:"ghost"})})})}),e.jsxRuntimeExports.jsx(O,{id:"group",title:"Group",children:e.jsxRuntimeExports.jsx(F,{title:"Group by",children:o.length>0?o.map(u=>e.jsxRuntimeExports.jsx(N,{label:u.label,active:t.groupBy===u.id,onClick:()=>{r({...t,groupBy:u.id})}},u.id)):e.jsxRuntimeExports.jsx(N,{label:"No groupable properties",disabled:!0})})}),e.jsxRuntimeExports.jsx(O,{id:"sort",title:"Sort",children:e.jsxRuntimeExports.jsx(F,{children:e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx(e.MtSortDropdown,{title:"Sort",value:y,onChange:u=>{n({sortRules:u})},fields:w,variant:"ghost"})})})})]})}ue.SettingsMenu=os;function ls(){const t=q(),i=t.currentView,s=t.properties;if(!i)return null;const n=i.settings??{},r=n.sortRules??[],o=s.filter(E=>E.groupable),a=[{value:"summary",label:"Summary"},{value:"status",label:"Status"},{value:"priority",label:"Priority"},{value:"assignee",label:"Assignee"},{value:"id",label:"ID"}],l=[{value:"is",label:"is",requiresValue:!0},{value:"is_not",label:"is not",requiresValue:!0},{value:"contains",label:"contains",requiresValue:!0},{value:"is_empty",label:"is empty",requiresValue:!1},{value:"is_not_empty",label:"is not empty",requiresValue:!1}],c=[{value:"updated",label:"Updated"},{value:"priority",label:"Priority"},{value:"status",label:"Status"},{value:"assignee",label:"Assignee"},{value:"summary",label:"Summary"}],m=n.filter&&typeof n.filter=="object"&&"type"in n.filter?n.filter:Q(),h=!!i.groupBy,j=r.length>0,d=ke(n.filter),y=t.setCurrentView,w=E=>{y({...i,settings:{...i.settings??{},...E}})};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdown,{title:e.jsxRuntimeExports.jsx(U,{size:16,stroke:"#8D8D8D"}),kind:"icon",variant:h?"accent":"ghost",showCaret:!1,children:e.jsxRuntimeExports.jsxs("div",{className:"w-56 p-1",children:[e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>y({...i,groupBy:null}),children:"None"}),o.map(E=>e.jsxRuntimeExports.jsx(e.MtDropdownItem,{onSelect:()=>y({...i,groupBy:E.id}),children:E.label},E.id))]})}),h?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>y({...i,groupBy:null}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtSortDropdown,{title:"Sort",kind:"icon",variant:j?"accent":"ghost",showCaret:!1,value:r,onChange:E=>w({sortRules:E}),fields:c}),j?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>w({sortRules:[]}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxRuntimeExports.jsx(e.MtFilterDropdown,{title:"Filter",kind:"icon",variant:d?"accent":"ghost",showCaret:!1,value:m,onChange:E=>w({filter:E}),fields:a,operators:l}),d?e.jsxRuntimeExports.jsx(e.MtButton,{kind:"icon",variant:"ghost",onClick:()=>w({filter:void 0}),children:e.jsxRuntimeExports.jsx(e.X,{size:14,stroke:"#8D8D8D"})}):null]})]})}ue.ToolbarActions=ls;function as({entry:t}){return e.jsxRuntimeExports.jsx("div",{className:"flex items-center px-6 border-b border-[#2A2A2A] h-11 bg-[#141414]",children:t.id})}const us=t=>{const i=t.renderEntry??as;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h1",{children:"Gantt Layout"}),t.entries.map(s=>e.jsxRuntimeExports.jsx(i,{entry:s},s.id))]})};exports.MtCollection=Rt;exports.MtCollectionBoardLayout=ue;exports.MtCollectionGanttLayout=us;exports.MtCollectionGridLayout=Zt;exports.MtCollectionListLayout=ae;exports.MtCollectionTableLayout=ts;exports.MtCollectionToolbar=je;exports.MtCollectionViewSettings=be;
@@ -0,0 +1 @@
1
+ export * from './components/matter/experimental/collection';