@maudecode/kanvil 0.5.0 → 0.5.1
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/apps/server/dist/{auth-Cs_whzgk.mjs → auth-Bm6cIseE.mjs} +16 -10
- package/apps/server/dist/client.mjs +10 -9
- package/apps/server/dist/{config-DKuNQY5b.mjs → config-CrJuk5mY.mjs} +1 -1
- package/apps/server/dist/index.mjs +4 -4
- package/apps/server/dist/migrate.mjs +1 -1
- package/apps/server/dist/recover.mjs +3 -3
- package/apps/server/dist/{src-DptOUNRd.mjs → src-D80LNZKP.mjs} +5 -2
- package/apps/web/dist/assets/{CompositeItem-CXqewtEL.js → CompositeItem-Tueq2VKR.js} +1 -1
- package/apps/web/dist/assets/{Trans-B1rRlWca.js → Trans-BgU0eWAX.js} +1 -1
- package/apps/web/dist/assets/admin-settings-Ckis3XJG.js +1 -0
- package/apps/web/dist/assets/{archive-restore-76sStk8K.js → archive-restore-CSpoH6mS.js} +1 -1
- package/apps/web/dist/assets/{az-B7OgHoaE.js → az-DUcDY8Bp.js} +1 -1
- package/apps/web/dist/assets/{corner-left-up-PD-73Nae.js → corner-left-up-C3OGlXIB.js} +1 -1
- package/apps/web/dist/assets/{de-B-bv38Q0.js → de-89C1V8Ut.js} +1 -1
- package/apps/web/dist/assets/{default-bQFGTwIp.js → default-Dnep8Yat.js} +1 -1
- package/apps/web/dist/assets/{delivery-settings-BvMeOsCS.js → delivery-settings-cMldZ9K7.js} +1 -1
- package/apps/web/dist/assets/{el-BQHQHQgX.js → el-D6CICkhi.js} +1 -1
- package/apps/web/dist/assets/{ellipsis-GF1HwTDb.js → ellipsis-lJJU8zB7.js} +1 -1
- package/apps/web/dist/assets/{es-f5Xr8ldr.js → es-B20Izib2.js} +1 -1
- package/apps/web/dist/assets/{forms-BlEL8C_P.js → forms--87R7VQW.js} +1 -1
- package/apps/web/dist/assets/{fr-DSR0htnl.js → fr-DVlGnGsu.js} +1 -1
- package/apps/web/dist/assets/{hi-BaAJEWuW.js → hi-D1F5Pi_I.js} +1 -1
- package/apps/web/dist/assets/{highlight-DXT2xgt8.js → highlight-ygDJPvRy.js} +1 -1
- package/apps/web/dist/assets/{id-kxogWcip.js → id-LESXKW7G.js} +1 -1
- package/apps/web/dist/assets/index-Bn-MADyj.css +2 -0
- package/apps/web/dist/assets/index-Ds3IHeIi.js +17 -0
- package/apps/web/dist/assets/{invitations-BPik3J_G.js → invitations-C5WbdDUQ.js} +1 -1
- package/apps/web/dist/assets/{it-C_qk40U6.js → it-CgRGAs6u.js} +1 -1
- package/apps/web/dist/assets/{item-TCHuZNK6.js → item-BD1Poxfs.js} +1 -1
- package/apps/web/dist/assets/{ja-Dn5h64V9.js → ja-B7arhzgX.js} +1 -1
- package/apps/web/dist/assets/{ko-CjaoEPuG.js → ko-Ro_UonyA.js} +1 -1
- package/apps/web/dist/assets/{label-settings-DZTorNDm.js → label-settings-BaikCfal.js} +1 -1
- package/apps/web/dist/assets/{markdown-blocks-BQLO-H_7.js → markdown-blocks-toSPlHSc.js} +1 -1
- package/apps/web/dist/assets/{member-directory-Dx_jQYfI.js → member-directory-BjUy1KuK.js} +1 -1
- package/apps/web/dist/assets/{mk-jLeGD50T.js → mk-DR3kmrIp.js} +1 -1
- package/apps/web/dist/assets/{nl-AVtC5ygT.js → nl-D3uRJJLT.js} +1 -1
- package/apps/web/dist/assets/{pl-Dup1h_Y1.js → pl-CtzDOLdV.js} +1 -1
- package/apps/web/dist/assets/{project-lifecycle-n1ZZbYfu.js → project-lifecycle-BBHcRi6p.js} +1 -1
- package/apps/web/dist/assets/project-settings-BaYuxYjg.js +1 -0
- package/apps/web/dist/assets/{pt-BR-Cm04EWM-.js → pt-BR-FarXHHuf.js} +1 -1
- package/apps/web/dist/assets/{public-project-BivDjU_a.js → public-project-DGf3nkg2.js} +1 -1
- package/apps/web/dist/assets/{rotate-ccw-CSaKhZYt.js → rotate-ccw-Byx7O3RH.js} +1 -1
- package/apps/web/dist/assets/{ru-IeycXsyE.js → ru-DHMEVxvB.js} +1 -1
- package/apps/web/dist/assets/{search-Ble6WSEU.js → search-DwsPEC4E.js} +35 -35
- package/apps/web/dist/assets/{send-BLMZ8gQ0.js → send-DlGV2XQS.js} +1 -1
- package/apps/web/dist/assets/settings-C_sN8Y1h.js +1 -0
- package/apps/web/dist/assets/{sliders-horizontal-Db6kRvuw.js → sliders-horizontal-CEHGGft_.js} +1 -1
- package/apps/web/dist/assets/{switch-BeX-0Fwq.js → switch-B_rsZYBf.js} +1 -1
- package/apps/web/dist/assets/{table-UJp5S9yy.js → table-2AEfwytk.js} +1 -1
- package/apps/web/dist/assets/{ticket-detail-C24opfNW.js → ticket-detail-C2l8nwF-.js} +2 -2
- package/apps/web/dist/assets/ticket-editor-B0UB98HS.js +2 -0
- package/apps/web/dist/assets/ticket-list-D_MHudj1.js +6 -0
- package/apps/web/dist/assets/{ticket-list-controls-fYBottFC.js → ticket-list-controls-jKg4i-NA.js} +1 -1
- package/apps/web/dist/assets/{tr-DtT_dKUK.js → tr-CjdSDu0z.js} +1 -1
- package/apps/web/dist/assets/{uk-CsbeHSS6.js → uk-C8od6u_H.js} +1 -1
- package/apps/web/dist/assets/{upload-DUEg04Nj.js → upload-BeTAGU_W.js} +1 -1
- package/apps/web/dist/assets/{useQueries-5lW2C5Sb.js → useQueries-BtRgTciJ.js} +1 -1
- package/apps/web/dist/assets/{vi-rkf1BOLx.js → vi-BwdBtgfS.js} +1 -1
- package/apps/web/dist/assets/{visual-editor-DkFLjouD.js → visual-editor-CzB_qwvB.js} +3 -3
- package/apps/web/dist/assets/{workspace-settings-Bcsp-VoJ.js → workspace-settings-DOr9j8X1.js} +1 -1
- package/apps/web/dist/assets/{zh-CN-Xo-QId5w.js → zh-CN-DM-UoFmL.js} +1 -1
- package/apps/web/dist/assets/{zh-TW-DEnTqjbn.js → zh-TW-q2nrwFjt.js} +1 -1
- package/apps/web/dist/index.html +8 -8
- package/docs/api.md +3 -1
- package/docs/cli.md +1 -1
- package/package.json +1 -1
- package/apps/web/dist/assets/admin-settings-DE3MfBFE.js +0 -1
- package/apps/web/dist/assets/index-CYVrs22O.js +0 -17
- package/apps/web/dist/assets/index-DyQNFS69.css +0 -2
- package/apps/web/dist/assets/project-settings-B_Ih5kiz.js +0 -1
- package/apps/web/dist/assets/settings-CH48qQK2.js +0 -1
- package/apps/web/dist/assets/ticket-editor--d_bG9C1.js +0 -2
- package/apps/web/dist/assets/ticket-list-DRbZWYHf.js +0 -5
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/visual-editor-DkFLjouD.js","assets/rolldown-runtime-COiEfhsA.js","assets/default-bQFGTwIp.js","assets/core-jXc03Sty.js","assets/en-EnSRisMz.js","assets/preload-helper-BLdHbfdN.js","assets/search-Ble6WSEU.js","assets/toDate-B3HYxwtT.js","assets/forms-BlEL8C_P.js","assets/index-CYVrs22O.js","assets/item-TCHuZNK6.js","assets/Trans-B1rRlWca.js","assets/CompositeItem-CXqewtEL.js","assets/en-US-DKYSujv3.js","assets/index-DyQNFS69.css","assets/highlight-DXT2xgt8.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{An as t,Cn as n,F as r,I as i,L as a,Lt as o,Mn as s,Mt as c,Nn as l,On as u,U as d,at as f,i as p,mn as m,o as h,r as g}from"./default-bQFGTwIp.js";import{A as ee,Aa as _,Ai as v,D as y,Fa as b,Fi as te,Ga as x,Ha as S,Hi as C,I as ne,Ia as w,J as T,Ji as E,K as D,M as O,Mi as k,N as A,Ni as j,O as M,Oa as N,P,Pt as F,Q as re,Ra as I,Tt as ie,V as ae,X as oe,Xn as se,Y as L,Z as ce,Zi as R,_t as le,aa as ue,at as de,ct as fe,di as z,ea as B,fr as pe,gt as me,hr as he,ht as ge,it as V,ji as _e,k as ve,ka as H,ki as U,lt as W,mr as ye,mt as be,nr as xe,nt as G,or as K,ot as Se,pi as Ce,pr as we,pt as Te,q,qa as J,ut as Ee,vt as Y,w as De,wo as Oe,za as ke,zi as Ae}from"./search-Ble6WSEU.js";import{t as je}from"./preload-helper-BLdHbfdN.js";import{a as Me,d as Ne,g as Pe,i as Fe,n as Ie,o as Le,r as Re,s as ze,t as Be}from"./item-TCHuZNK6.js";import{i as Ve,n as He,r as Ue}from"./CompositeItem-CXqewtEL.js";import{t as We}from"./corner-left-up-PD-73Nae.js";import{t as Ge}from"./rotate-ccw-CSaKhZYt.js";import{t as Ke}from"./sliders-horizontal-Db6kRvuw.js";import{t as qe}from"./upload-DUEg04Nj.js";import{r as Je,t as X}from"./forms-BlEL8C_P.js";import{At as Ye,Ct as Xe,J as Ze,Ot as Qe,Z as $e,_ as et,bt as tt,d as nt,dn as rt,dt as it,et as at,g as ot,gt as st,h as ct,hn as lt,it as ut,jt as dt,kt as ft,ln as pt,m as mt,mn as ht,nn as gt,tt as Z,un as _t}from"./index-CYVrs22O.js";import{t as vt}from"./switch-BeX-0Fwq.js";var yt={name:`bold`,size:24,node:[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]};yt.node;var bt=x(yt),xt={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};xt.node;var St=x(xt),Ct={name:`heading`,size:24,node:[[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M6 20V4`,key:`1w1bmo`}],[`path`,{d:`M18 20V4`,key:`o2hl4u`}]]};Ct.node;var wt=x(Ct),Tt={name:`italic`,size:24,node:[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]};Tt.node;var Et=x(Tt),Dt={name:`link`,size:24,node:[[`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`}]]};Dt.node;var Ot=x(Dt),kt={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};kt.node;var At=x(kt),jt={name:`list`,size:24,node:[[`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`}]]};jt.node;var Mt=x(jt),Nt={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};Nt.node;var Pt=x(Nt),Ft={name:`paperclip`,size:24,node:[[`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`}]]};Ft.node;var It=x(Ft),Lt={name:`square-code`,size:24,node:[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]],aliases:[`code-square`]};Lt.node;var Rt=x(Lt),Q=e(l(),1),$=g(),zt=(0,Q.lazy)(()=>je(()=>import(`./visual-editor-DkFLjouD.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),Bt={heading:wt,bold:bt,italic:Et,link:Ot,bullets:Mt,numbers:At,tasks:_t,code:Rt};function Vt(e,t){let n=/(?:^|[\s([{])@([^\s@[\]()]{0,40})$/.exec(e.slice(0,t));return n?.[1]===void 0?null:{from:t-n[1].length-1,query:n[1]}}var Ht=(e,t)=>e.filter(e=>`${e.name} ${e.email}`.toLowerCase().includes(t.toLowerCase())).slice(0,8),Ut=e=>({key:e.userId,content:(0,$.jsx)(ue,{name:e.name,email:e.email,image:e.image})}),Wt=e=>f(e.name,e.userId);function Gt(e){let[t,n]=(0,Q.useState)(``),r=e.includes(t)?t:e[0];return{active:r,setHighlight:n,handleKey:(t,i,a)=>{if(!r||t.isComposing)return!1;let o={ArrowDown:1,ArrowUp:-1}[t.key];if(!o&&![`Enter`,`Tab`,`Escape`].includes(t.key))return!1;t.preventDefault();let s=e.indexOf(r);return o?n(e[(s+o+e.length)%e.length]??``):t.key===`Escape`?a():i(r),!0}}}function Kt({id:e,label:t,open:n,anchor:r,options:i,active:a,onHighlight:o,onChoose:s,onDismiss:c}){return(0,$.jsx)(A,{open:n,onOpenChange:e=>{e||c()},children:(0,$.jsx)(P,{anchor:r,align:`start`,initialFocus:!1,finalFocus:!1,className:`w-[min(20rem,calc(100vw-2rem))] p-1`,children:(0,$.jsx)(`div`,{role:`listbox`,id:e,"aria-label":t,children:i.map(t=>(0,$.jsx)(`div`,{role:`option`,id:`${e}-${t.key}`,"aria-selected":t.key===a,"data-selected":t.key===a||void 0,className:O,onMouseDown:e=>e.preventDefault(),onPointerMove:()=>o(t.key),onClick:()=>s(t.key),children:t.content},t.key))})})})}function qt(e,t,n){let[r,i]=(0,Q.useState)(0),a=(0,Q.useRef)(null),o=async e=>{if(t&&e.length){i(t=>t+e.length);for(let r of e)try{n(U(await t(r)))}catch(e){Ee(e)}finally{i(e=>e-1)}}},s=(0,$.jsx)(`input`,{ref:a,type:`file`,multiple:!0,hidden:!0,"aria-label":m(`detail.markdown.insertFileInto`,{label:e}),onChange:e=>{let t=[...e.target.files??[]];e.target.value=``,o(t)}});return{uploading:r>0,send:o,pick:()=>a.current?.click(),input:s}}function Jt({label:e,flush:t,onApply:n,pressed:r,upload:i,children:a}){return(0,$.jsxs)(we,{align:`block-start`,role:`toolbar`,"aria-label":m(`detail.markdown.formatting`,{label:e}),className:H(`gap-0.5 overflow-x-auto border-b py-1 pl-1 text-foreground [scrollbar-width:none] max-md:gap-0 max-md:px-0`,t&&`px-0`),onKeyDown:e=>{let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.findIndex(e=>e===document.activeElement),r={ArrowRight:1,ArrowLeft:-1}[e.key],i=e.key===`Home`?t[0]:e.key===`End`?t.at(-1):r&&t.at((n+r)%t.length);i&&(e.preventDefault(),i.focus())},children:[k.map((e,t)=>{let i=_e[e],a=Bt[e];return(0,$.jsx)(T,{label:i.label,...`shortcut`in i?{shortcut:i.shortcut}:{},...r?{"aria-pressed":r(e)}:{},size:`icon-sm`,tabIndex:t===0?0:-1,className:`text-muted-foreground hover:text-foreground aria-pressed:bg-muted aria-pressed:text-foreground`,onClick:()=>n(e),children:(0,$.jsx)(a,{})},e)}),i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{label:i.uploading?m(`detail.resource.uploading`):m(`detail.markdown.insertFile`),size:`icon-sm`,tabIndex:-1,disabled:i.uploading,className:`text-muted-foreground hover:text-foreground`,onClick:i.pick,children:i.uploading?(0,$.jsx)(le,{}):(0,$.jsx)(It,{})}),i.input]}),a]})}function Yt(e){return e?.files.length?[...e.files]:[]}function Xt({label:e,value:t,onChange:n,placeholder:r,rows:i=5,variant:a=`compact`,maxLength:o=1e5,required:s=!1,footer:c,mentions:l,onUpload:u}){let d=(0,Q.useId)(),f=(0,Q.useRef)(null),[p,h]=Xe(tt.editor),[g,ee]=(0,Q.useState)(!1),[_,y]=(0,Q.useState)(!1),b=g?`preview`:p===`visual`&&!_?`visual`:`write`,te=J({...C.query(`list_members`,{projectId:l??``}),enabled:!!l}),[x,S]=(0,Q.useState)(0),[ne,w]=(0,Q.useState)(null),T=l?Vt(t,x):null,E=Ht(te.data??[],T?.query??``),D=Gt(E.map(e=>e.userId)),O=!!T&&T.from!==ne&&E.length>0,k=`${d}-mentions`,A=e=>{let t=f.current;t&&(t.focus(),t.setSelectionRange(e.from,e.to),document.execCommand(`insertText`,!1,e.text)||(t.setRangeText(e.text),n(t.value)),t.setSelectionRange(e.start,e.end),S(e.end))},M=e=>{let t=f.current;t&&A(v(t.value,t.selectionStart,t.selectionEnd,e))},N=e=>{let t=E.find(t=>t.userId===e);if(!T||!t)return;let n=`${Wt(t)} `,r=T.from+n.length;A({from:T.from,to:x,text:n,start:r,end:r})},P=qt(e,u,e=>{let t=f.current;if(!t)return;let n=t.selectionEnd+e.length;A({from:t.selectionStart,to:t.selectionEnd,text:e,start:n,end:n})}),F=(e,t)=>{let n=u?Yt(t):[];n.length&&(e.preventDefault(),P.send(n))},re=(0,Q.useCallback)(()=>y(!0),[]),I=a===`document`?`rounded-none border-0 bg-transparent dark:bg-transparent has-[[data-slot=input-group-control]:focus-visible]:ring-0`:void 0,ie=c&&(0,$.jsx)(we,{align:`block-end`,className:`justify-end border-t py-2`,children:c});return(0,$.jsx)(xe,{className:H(`mb-6 [&_[data-slot=tabs-list]]:shrink-0 [&_[data-slot=tabs-trigger]]:text-xs`,a===`compact`&&`[&_textarea]:field-sizing-fixed [&_textarea]:max-h-[28rem] [&_.ProseMirror]:max-h-[28rem] [&_.ProseMirror]:overflow-y-auto`,a===`document`&&`border-t pt-5 has-[[data-slot=input-group-control]:focus]:border-t-primary has-[[data-slot=input-group-control]:focus]:[&_[data-slot=field-label]]:text-primary`),"data-variant":a,"aria-label":m(`detail.markdown.editor`,{label:e}),children:(0,$.jsxs)(mt,{value:b,onValueChange:e=>{ee(e===`preview`),(e===`write`||e===`visual`)&&(h(e),y(!1))},children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(K,{htmlFor:d,children:e}),(0,$.jsxs)(ot,{"aria-label":m(`detail.markdown.editor`,{label:e}),variant:`line`,children:[(0,$.jsx)(et,{value:`write`,children:m(`detail.markdown.write`)}),(0,$.jsx)(et,{value:`visual`,children:m(`detail.markdown.visual`)}),(0,$.jsx)(et,{value:`preview`,children:m(`detail.markdown.preview`)})]})]}),(0,$.jsxs)(ct,{value:`write`,children:[_&&p===`visual`&&(0,$.jsx)(`p`,{role:`status`,className:`mb-2 text-xs text-muted-foreground`,children:m(`detail.markdown.unsupported`)}),(0,$.jsxs)(pe,{className:I,children:[(0,$.jsx)(Jt,{label:e,flush:a===`document`,onApply:M,...u?{upload:P}:{}}),(0,$.jsx)(ye,{ref:f,id:d,className:a===`document`?`field-sizing-content max-h-none resize-y px-1 py-3 text-base md:text-base leading-7 caret-primary`:void 0,style:a===`document`?{minHeight:`${i}lh`}:void 0,value:t,onChange:e=>{S(e.target.selectionStart),n(e.target.value)},onSelect:e=>S(e.currentTarget.selectionStart),onPaste:e=>F(e,e.clipboardData),onDragOver:e=>{u&&e.dataTransfer.types.includes(`Files`)&&e.preventDefault()},onDrop:e=>F(e,e.dataTransfer),...l&&{"aria-autocomplete":`list`,"aria-controls":O?k:void 0,"aria-activedescendant":O&&D.active?`${k}-${D.active}`:void 0},onKeyDown:e=>{if(O&&D.handleKey(e.nativeEvent,N,()=>w(T.from))){e.stopPropagation();return}let t=j(e);!t||t===`link`&&e.currentTarget.selectionStart===e.currentTarget.selectionEnd||(e.preventDefault(),e.stopPropagation(),M(t))},placeholder:r,rows:i,maxLength:o,required:s}),l&&(0,$.jsx)(Kt,{id:k,label:m(`detail.markdown.mention`),open:O,anchor:f,options:E.map(Ut),active:D.active,onHighlight:D.setHighlight,onChoose:N,onDismiss:()=>{T&&w(T.from)}}),ie]})]}),(0,$.jsx)(ct,{value:`visual`,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(oe,{}),children:(0,$.jsx)(zt,{id:d,label:e,value:t,onChange:n,placeholder:r??``,rows:i,maxLength:o,flush:a===`document`,groupClassName:I,footer:ie,...l?{members:te.data??[]}:{},...u?{onUpload:u}:{},onUnsupported:re})})}),(0,$.jsxs)(ct,{value:`preview`,children:[(0,$.jsx)(`div`,{className:H(`min-h-28 rounded-lg border bg-muted/20 p-4`,a===`document`&&`rounded-none border-0 bg-transparent px-1 py-3 text-base leading-7`),children:t?(0,$.jsx)(ce,{children:t}):(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:m(`detail.markdown.nothingToPreview`)})}),c&&(0,$.jsx)(`div`,{className:`mt-2 flex justify-end`,children:c})]})]})})}function Zt({projectId:e,label:t,value:n,onChange:r,exclude:i=[],allowClear:a=!0,variant:o=`field`,placeholder:c=m(`ticket.picker.placeholder`)}){let l=(0,Q.useId)(),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(``),h=J({...C.query(`list_tickets`,{projectId:e,q:f,archived:`include`,limit:30}),enabled:u}),g=J({...C.query(`get_ticket`,{projectId:e,ticketId:n??``}),enabled:!!n&&s().safeParse(n).success}),_=h.data?.items.filter(e=>!i.includes(e.id))??[],v=g.data?.ticket??h.data?.items.find(e=>e.id===n),b=(0,$.jsxs)(A,{open:u,onOpenChange:e=>{d(e),e&&p(``)},children:[(0,$.jsxs)(ne,{id:l,render:(0,$.jsx)(z,{variant:o===`pill`?`ghost`:`outline`,size:o===`pill`?`sm`:`default`,role:`combobox`,"aria-label":t,className:o===`pill`?`h-7 max-w-64 min-w-0 border border-transparent px-2 font-normal hover:border-border`:`h-auto min-h-8 w-full justify-between whitespace-normal text-left font-normal`}),children:[o===`pill`&&(0,$.jsx)(We,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:o===`pill`?`min-w-0 truncate`:`min-w-0 break-words`,children:v?o===`pill`?v.key:`${v.key} · ${v.title}`:n?m(`ticket.picker.loading`):c}),o!==`pill`&&(0,$.jsx)(Ve,{className:`ml-2 size-3.5 shrink-0 text-muted-foreground`})]}),(0,$.jsx)(P,{align:`start`,className:`w-[min(420px,var(--available-width))] p-0`,children:(0,$.jsxs)(De,{shouldFilter:!1,children:[(0,$.jsx)(M,{"aria-label":m(`ticket.picker.searchLabel`,{label:t}),placeholder:m(`ticket.picker.searchPlaceholder`),value:f,onValueChange:p}),(0,$.jsxs)(ee,{children:[a&&(0,$.jsx)(y,{children:(0,$.jsxs)(ve,{value:`none`,onSelect:()=>{r(null),d(!1)},children:[m(`ticket.picker.noParent`),!n&&(0,$.jsx)(S,{className:`ml-auto`})]})}),h.isPending?(0,$.jsx)(`div`,{role:`status`,className:`px-4 py-6 text-sm text-muted-foreground`,children:m(`ticket.picker.searching`)}):_.length?(0,$.jsx)(y,{children:_.map(e=>(0,$.jsxs)(ve,{value:e.id,className:`items-start py-2`,onSelect:()=>{r(e.id),d(!1)},children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`mb-1 block font-mono text-[11px] text-muted-foreground`,children:e.key}),(0,$.jsx)(`span`,{dir:`auto`,className:`block break-words whitespace-normal`,children:e.title})]}),n===e.id&&(0,$.jsx)(S,{className:`ml-auto shrink-0`})]},e.id))}):(0,$.jsx)(`div`,{role:`status`,className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:m(`ticket.picker.empty`)}),(0,$.jsx)(D,{error:h.error})]})]})})]});return o===`pill`?(0,$.jsxs)($.Fragment,{children:[b,(0,$.jsx)(D,{error:g.error})]}):(0,$.jsxs)(xe,{className:fe,children:[(0,$.jsx)(K,{htmlFor:l,children:t}),b,(0,$.jsx)(D,{error:g.error})]})}var Qt=Ce(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function $t({className:e,orientation:t,...n}){return(0,$.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:H(Qt({orientation:t}),e),...n})}function en({icon:e,href:t,label:n,download:r=!1,compact:i=!1,badges:a,details:o,meta:s,metaId:c,actions:l}){return(0,$.jsxs)(Be,{role:`listitem`,size:i?`xs`:`default`,className:H(`rounded-none border-x-0 border-t-0 border-b-border px-0 animate-in fade-in-0 duration-200 last:border-b-0`,!i&&`items-start py-4`),children:[(0,$.jsx)(Le,{variant:i?`default`:`icon`,children:e}),(0,$.jsxs)(Re,{className:H(`min-w-0`,i?`gap-0`:`gap-1.5`),children:[(0,$.jsxs)(ze,{className:H(`line-clamp-none max-w-full wrap-anywhere`,i&&`text-xs font-normal`),children:[(0,$.jsxs)(`a`,{href:t,"aria-describedby":c,...r?{download:!0,className:`hover:text-primary`}:{target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-primary hover:underline`},children:[n,!r&&(0,$.jsx)(lt,{className:`size-3 shrink-0`,"aria-hidden":`true`})]}),a]}),o,s&&(0,$.jsx)(Fe,{id:c,className:H(`m-0`,i?`text-[11px]`:`text-xs`),children:s})]}),l&&(0,$.jsx)(Ie,{children:l})]})}function tn(e){if(e.size>1e7)throw Error(m(`detail.attachment.tooLarge`))}var nn=async e=>({name:e.name,contentType:e.type||`application/octet-stream`,data:await te(e)});function rn(e,t){let n=R(`upload_attachment`),r=R(`stage_upload`);return async i=>{tn(i);let a=await nn(i),o=`ticketId`in t?await n.mutateAsync({projectId:e,ticketId:t.ticketId,...a}):await r.mutateAsync({projectId:e,...a});return`onStaged`in t&&t.onStaged(o.id),{url:h(e,o.id),name:o.name,contentType:o.contentType}}}function an({ticket:e}){let t=J(C.query(`list_attachments`,{projectId:e.projectId,ticketId:e.id})),n=R(`upload_attachment`),r=R(`delete_attachment`),i=B(e.projectId),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1);async function f(t){if(t.length){s(void 0),d(!0);try{t.forEach(tn);for(let r of t)await n.mutateAsync({projectId:e.projectId,ticketId:e.id,...await nn(r)});N.success(m(`detail.attachment.attached`,{count:t.length}))}catch(e){s(e)}finally{d(!1)}}}return(0,$.jsxs)(`section`,{onDragOver:e=>{i.canWrite&&(e.preventDefault(),l(!0))},onDragLeave:()=>l(!1),onDrop:e=>{e.preventDefault(),l(!1),i.canWrite&&f(Array.from(e.dataTransfer.files))},className:H(`rounded-lg transition-colors`,c&&`bg-primary/5 ring-2 ring-primary/40 ring-offset-4 ring-offset-background`),children:[(0,$.jsx)(V,{compact:!0,title:m(`detail.attachment.heading`),action:i.canWrite&&(0,$.jsx)(T,{label:m(u?`detail.resource.uploading`:`detail.attachment.attach`),size:`icon-sm`,disabled:u,onClick:()=>a.current?.click(),children:u?(0,$.jsx)(le,{}):(0,$.jsx)(qe,{})})}),!t.isPending&&!t.data?.length&&(0,$.jsx)(`p`,{className:`mb-0 text-xs text-muted-foreground`,children:i.canWrite?m(`detail.attachment.emptyWritable`):m(`detail.attachment.empty`)}),(0,$.jsx)(Me,{className:`gap-0`,children:t.data?.map(t=>(0,$.jsx)(en,{compact:!0,download:!0,icon:(0,$.jsx)(ht,{className:`size-4 text-muted-foreground`}),href:h(e.projectId,t.id),label:t.name,meta:W(t.size),metaId:`attachment-size-${t.id}`,actions:i.canWrite&&(0,$.jsx)(ae,{label:m(`detail.attachment.remove`),icon:(0,$.jsx)(He,{}),description:m(`detail.resource.removeConfirm`,{name:t.name}),onConfirm:()=>r.mutateAsync({projectId:e.projectId,attachmentId:t.id})})},t.id))}),(0,$.jsx)(he,{ref:a,type:`file`,multiple:!0,className:`hidden`,"aria-label":m(`detail.attachment.fileInput`),disabled:u,onChange:e=>{let t=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,f(t)}}),(0,$.jsx)(D,{error:o??t.error??r.error})]})}var on={passed:ke,failed:w,pending:b,reported:I};function sn({ticket:e}){let t=B(e.projectId),n=J(C.query(`list_evidence`,{projectId:e.projectId,ticketId:e.id})),o=R(`add_evidence`),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)();return(0,$.jsxs)(`section`,{children:[(0,$.jsx)(V,{title:m(`detail.section.evidence`),description:m(`detail.evidence.description`),action:t.canWrite&&(0,$.jsx)(T,{label:m(`detail.evidence.add`),onClick:()=>{o.reset(),u(void 0),c(!0)},children:(0,$.jsx)(Pe,{})})}),!n.isPending&&!n.data?.length&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m(`detail.evidence.empty`)}),(0,$.jsx)(Me,{className:`gap-0`,children:n.data?.map(t=>{let n=on[t.outcome]??I;return(0,$.jsx)(en,{icon:(0,$.jsx)(n,{className:H(t.outcome===`passed`&&`text-[var(--success)]`,t.outcome===`failed`&&`text-destructive`)}),href:t.url,label:t.title,badges:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{variant:`outline`,className:`ml-2`,children:i[t.kind]}),(0,$.jsx)(Y,{variant:`outline`,className:H(`ml-1`,t.outcome===`passed`&&`text-[var(--success)]`,t.outcome===`failed`&&`text-destructive`),"data-outcome":t.outcome,children:a[t.outcome]})]}),details:(0,$.jsxs)($.Fragment,{children:[t.commit&&(0,$.jsx)(`code`,{className:`w-fit rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] break-all`,children:t.commit}),t.note&&(0,$.jsx)(ce,{children:t.note})]}),meta:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ae,{projectId:e.projectId,actorId:t.actorId}),` ·`,` `,(0,$.jsx)(G,{value:t.createdAt})]})},t.id)})}),(0,$.jsx)(re,{title:m(`detail.evidence.add`),open:s,onOpenChange:c,busy:o.isPending,children:(0,$.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let n=new FormData(t.currentTarget);o.mutateAsync({projectId:e.projectId,ticketId:e.id,kind:r.shape.kind.parse(n.get(`kind`)),title:X(n,`title`),url:X(n,`url`),commit:X(n,`commit`)||null,outcome:r.shape.outcome.parse(n.get(`outcome`)),note:X(n,`note`)}).then(()=>{c(!1),N.success(m(`detail.evidence.added`))}).catch(u)},children:[(0,$.jsx)(L,{label:m(`detail.field.title`),name:`title`,required:!0,maxLength:200}),(0,$.jsx)(L,{label:m(`detail.field.url`),name:`url`,type:`url`,required:!0}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-5 sm:grid-cols-2`,children:[(0,$.jsx)(de,{label:m(`detail.evidence.kindLabel`),name:`kind`,children:r.shape.kind.options.map(e=>(0,$.jsx)(F,{value:e,children:i[e]},e))}),(0,$.jsx)(de,{label:m(`detail.evidence.outcomeLabel`),name:`outcome`,children:r.shape.outcome.unwrap().options.map(e=>(0,$.jsx)(F,{value:e,children:a[e]},e))})]}),(0,$.jsx)(L,{label:m(`detail.evidence.commit`),name:`commit`,pattern:`[a-fA-F0-9]{40,64}`}),(0,$.jsx)(Se,{label:m(`detail.evidence.note`),name:`note`,maxLength:2e4}),(0,$.jsx)(q,{error:l??o.error,pending:o.isPending,submitLabel:m(`detail.evidence.add`),onCancel:()=>c(!1)})]})}),(0,$.jsx)(D,{error:n.error})]})}var cn=[`open`,`closed`,`merged`,`draft`,`active`,`deleted`];function ln({remoteKind:e,remoteState:t,provider:n}){if(!t)return m(`detail.link.stateUnknown`);let r=cn.find(e=>e===t),i=r?m(`detail.link.remoteState.${r}`):t.charAt(0).toUpperCase()+t.slice(1);return e?m(`detail.link.remote`,{kind:c(e,n),state:i}):i}function un({ticket:e}){let t=B(e.projectId),n=J(C.query(`list_resources`,{projectId:e.projectId,ticketId:e.id})),r=R(`add_resource`),i=R(`update_resource`),a=R(`delete_resource`),[s,c]=(0,Q.useState)(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(),p=r.isPending||i.isPending,h=e=>{f(void 0),c(e),u(!0)};return(0,$.jsxs)(`section`,{"aria-label":m(`detail.link.heading`),children:[(0,$.jsx)(V,{compact:!0,title:m(`detail.link.heading`),action:t.canWrite&&(0,$.jsx)(T,{label:m(`detail.link.add`),size:`icon-sm`,onClick:()=>h(),children:(0,$.jsx)(Pe,{})})}),!n.isPending&&!n.data?.length&&(0,$.jsx)(`p`,{className:`mb-0 text-xs text-muted-foreground`,children:m(`detail.link.empty`)}),(0,$.jsx)(Me,{className:`gap-0`,children:n.data?.map(n=>(0,$.jsx)(en,{compact:!0,icon:(0,$.jsx)(rt,{className:`size-4 text-muted-foreground`}),href:n.url,label:n.title||n.url,meta:n.provider?(0,$.jsxs)(`span`,{className:`inline-flex flex-wrap gap-1`,children:[(0,$.jsx)(Y,{variant:`outline`,children:n.provider}),(0,$.jsx)(Y,{variant:`outline`,className:n.remoteState?void 0:`text-muted-foreground`,children:ln(n)})]}):n.title&&o(n.url),actions:t.canWrite&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{size:`icon-sm`,label:m(`detail.link.edit`),onClick:()=>h(n),children:(0,$.jsx)(Ue,{})}),(0,$.jsx)(ae,{label:m(`detail.link.remove`),icon:(0,$.jsx)(He,{}),description:m(`detail.resource.removeConfirm`,{name:n.title||n.url}),onConfirm:()=>a.mutateAsync({projectId:e.projectId,resourceId:n.id,expectedVersion:n.version})})]})},n.id))}),(0,$.jsx)(re,{title:m(s?`detail.link.edit`:`detail.link.add`),open:l,onOpenChange:u,busy:p,children:(0,$.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let n=new FormData(t.currentTarget),a={url:X(n,`url`),title:X(n,`title`)};f(void 0),(s?i.mutateAsync({projectId:e.projectId,resourceId:s.id,expectedVersion:s.version,...a}):r.mutateAsync({projectId:e.projectId,ticketId:e.id,...a})).then(()=>u(!1)).catch(f)},children:[(0,$.jsx)(L,{label:m(`detail.field.url`),name:`url`,type:`url`,required:!0,autoFocus:!0,defaultValue:s?.url}),(0,$.jsx)(L,{label:m(`detail.field.title`),name:`title`,maxLength:200,defaultValue:s?.title}),(0,$.jsx)(q,{error:d,pending:p,submitLabel:m(s?`detail.link.save`:`detail.link.add`),onCancel:()=>u(!1)})]})}),(0,$.jsx)(D,{error:n.error})]})}function dn({ticket:e}){let[t,n]=(0,Q.useState)(0),r=J(C.query(`list_activity`,{projectId:e.projectId,ticketId:e.id,offset:t}));return(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{children:m(`detail.section.activity`)}),(0,$.jsx)(D,{error:r.error}),(0,$.jsx)(`ol`,{className:`m-0 list-none p-0`,children:r.data?.items.map(t=>(0,$.jsxs)(`li`,{className:`relative flex flex-col gap-0.5 border-l py-2.5 pl-5 text-xs before:absolute before:top-4 before:-left-[3px] before:size-[5px] before:rounded-full before:bg-muted-foreground/50`,children:[(0,$.jsx)(`span`,{children:d(t)}),(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,$.jsx)(Ae,{projectId:e.projectId,actorId:t.actorId}),` ·`,` `,(0,$.jsx)(G,{value:t.createdAt})]})]},t.id))}),((r.data?.total??0)>50||t>0)&&(0,$.jsxs)($t,{className:`mt-5 justify-end`,children:[(0,$.jsx)(z,{size:`sm`,disabled:!t,onClick:()=>n(Math.max(0,t-50)),children:m(`detail.activity.previous`)}),(0,$.jsx)(z,{size:`sm`,disabled:t+50>=(r.data?.total??0),onClick:()=>n(t+50),children:m(`detail.activity.next`)})]})]})}var fn=`h-7 max-w-64 min-w-0 border border-transparent px-2 font-normal hover:border-border aria-pressed:border-border aria-pressed:bg-muted`;function pn({projectId:e,ticket:r,initial:i,onSaved:a}){let o=Te(),s=`kanvil:${E().id}:draft:${e}:${r?.id??`new:${i?.parentId??``}`}`,[c,l]=(0,Q.useState)(()=>{let e=ft(r);return i?{...e,fields:{...e.fields,...i}}:e}),[d,f]=(0,Q.useState)(()=>{try{let e=dt.safeParse(JSON.parse(localStorage.getItem(s)??`null`));if(e.success)return e.data}catch{}return c}),h=(0,Q.useRef)(d);function g(e){h.current=e,f(e)}let ee=`kanvil:composer-expanded`,[v,y]=(0,Q.useState)(()=>{try{return localStorage.getItem(ee)===`1`}catch{return!1}});function b(){y(e=>{try{localStorage.setItem(ee,e?`0`:`1`)}catch{}return!e})}let[te,x]=(0,Q.useState)(()=>!!d.fields.acceptanceCriteria),[S,w]=(0,Q.useState)(),[T,O]=(0,Q.useState)(),[k,j]=(0,Q.useState)(!1),[M,F]=(0,Q.useState)(!1),[re,I]=(0,Q.useState)(),ae=R(`create_ticket`),oe=R(`update_ticket`),ce=R(`discard_upload`),ue=Oe(),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(!1),B=(0,Q.useRef)(0),[pe,he]=(0,Q.useState)(!1);function V(e){g(e),I(void 0);try{localStorage.setItem(s,JSON.stringify(e)),O(void 0),j(!0)}catch{O(Error(m(`detail.editor.storageUnavailable`))),j(!1)}}function _e(){try{localStorage.removeItem(s)}catch{}ve(h.current.uploads),g(c),j(!1)}function ve(e){for(let t of e)ce.mutateAsync({projectId:K,uploadId:t}).catch(()=>{})}let U=e=>V({...h.current,fields:{...h.current.fields,...e}}),W=(e,t)=>U({[e]:t}),ye=(e,t)=>W(`customFields`,{...h.current.fields.customFields,[e]:t});async function xe(t){let n=++B.current;V({...h.current,projectId:t===e?void 0:t,fields:{...h.current.fields,parentId:null,stateId:null,customFields:{}}}),he(!0);let r=[];try{r=await ue.ensureQueryData(C.query(`list_members`,{projectId:t}))}finally{if(n===B.current){let e=h.current,{assigneeId:t}=e.fields;t&&!r.some(e=>e.userId===t)&&V({...e,fields:{...e.fields,assigneeId:null}}),he(!1)}}}let G=d.fields,K=d.projectId??e,Ce=!!r&&d.version!==r.version,we=JSON.stringify(d.fields)!==JSON.stringify(c.fields)||d.projectId!==c.projectId,q=ae.isPending||oe.isPending,J=q||Ce||pe,Y=G.automationReady||G.scopes.length>0||!!G.holdReason,De=rn(K,r?{ticketId:r.id}:{onStaged:e=>V({...h.current,uploads:[...h.current.uploads,e]})});async function ke(t){if(t.preventDefault(),J||fe.current)return;let n=Ye(G),i=d.uploads.filter(e=>G.description.includes(e)||G.acceptanceCriteria.includes(e));fe.current=!0,o?.(!0);try{let t=r?await oe.mutateAsync({projectId:e,ticketId:r.id,expectedVersion:d.version??r.version,changes:n}):await ae.mutateAsync({projectId:K,...n,uploads:i}).catch(e=>{throw Ae(e),e});r||ve(d.uploads.filter(e=>!i.includes(e)));try{localStorage.removeItem(s)}catch{}if(r||!M)return N.success(m(r?`detail.editor.saved`:`detail.editor.created`,{key:t.key})),a(t);let o=h.current.fields,c=e=>o[e]===G[e]?``:o[e],u={...h.current,uploads:h.current.uploads.filter(e=>!d.uploads.includes(e)),fields:{...o,title:c(`title`),description:c(`description`),acceptanceCriteria:c(`acceptanceCriteria`)}};l({...u,fields:{...u.fields,title:``,description:``,acceptanceCriteria:``}}),u.fields.title||u.fields.description||u.fields.acceptanceCriteria?V(u):(g(u),j(!1)),x(!!u.fields.acceptanceCriteria),I(t.key),de.current?.focus()}finally{fe.current=!1,o?.(!1)}}function Ae(e){let r=e instanceof p&&u({uploads:n(t())}).safeParse(e.details).data?.uploads;r&&V({...h.current,uploads:h.current.uploads.filter(e=>!r.includes(e))})}let je=q||d.uploads.length>0,Me=(0,$.jsxs)(`div`,{className:`-mt-3 flex flex-wrap items-center gap-1`,"aria-label":m(`detail.editor.properties`),children:[!r&&(0,$.jsx)($e,{value:K,disabled:je,onChange:e=>void xe(e).catch(Ee)}),(0,$.jsx)(Z,{property:`status`,projectId:K,value:it(G),onChange:e=>U(ut(e))}),(0,$.jsx)(Z,{property:`priority`,projectId:K,value:G.priority,onChange:e=>W(`priority`,e)}),(0,$.jsx)(Z,{property:`assignee`,projectId:K,value:G.assigneeId,onChange:e=>W(`assigneeId`,e)}),(0,$.jsx)(Z,{property:`kind`,projectId:K,value:G.kind,onChange:e=>W(`kind`,e)}),(0,$.jsx)(Z,{property:`difficulty`,projectId:K,value:G.difficulty,onChange:e=>W(`difficulty`,e)}),(0,$.jsx)(at,{value:G.labels,onChange:e=>W(`labels`,e)}),(0,$.jsx)(st,{variant:`pill`,value:G,onChange:U}),(0,$.jsx)(Ze,{variant:`pill`,projectId:K,values:G.customFields,isNew:!r,onChange:ye}),(0,$.jsx)(Zt,{variant:`pill`,label:m(`detail.field.parentTicket`),placeholder:m(`detail.field.parent`),projectId:K,value:G.parentId,onChange:e=>W(`parentId`,e),exclude:r?[r.id]:[]}),(0,$.jsxs)(nt,{size:`sm`,className:H(fn,`gap-1.5`),pressed:G.automationReady,onPressedChange:e=>W(`automationReady`,e),"aria-label":m(`detail.editor.readyForAgents`),title:m(`detail.editor.readyForAgentsHelp`),children:[(0,$.jsx)(St,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),G.automationReady?m(`detail.editor.readyForAgents`):m(`detail.editor.agents`)]}),(0,$.jsxs)(A,{children:[(0,$.jsx)(ne,{render:(0,$.jsx)(z,{variant:`ghost`,size:`icon-sm`,className:H(`size-7 border border-transparent hover:border-border`,Y&&`text-primary`),"aria-label":m(`detail.editor.moreProperties`)}),children:(0,$.jsx)(Ke,{className:`size-3.5`})}),(0,$.jsxs)(P,{align:`start`,className:`w-[min(24rem,calc(100vw-2rem))] p-4`,children:[(0,$.jsx)(Qe,{label:m(`detail.field.scopes`),kind:`scope`,value:G.scopes,onChange:e=>W(`scopes`,e)}),(0,$.jsx)(L,{label:m(`detail.field.holdReason`),value:G.holdReason??``,maxLength:2e3,placeholder:m(`detail.editor.holdPlaceholder`),onChange:e=>W(`holdReason`,e.target.value||null)}),(0,$.jsx)(`p`,{className:`mb-0 text-xs text-muted-foreground`,children:m(`detail.editor.claimsNote`)})]})]})]}),Pe=(0,$.jsxs)(`form`,{onSubmit:e=>{w(void 0),ke(e).catch(w)},onKeyDown:Je,className:`ticket-composer flex min-h-0 flex-1 flex-col`,"data-expanded":v,children:[(0,$.jsx)(z,{variant:`ghost`,size:`icon-sm`,className:`absolute top-2 right-11 hidden sm:inline-flex`,"aria-label":m(v?`detail.editor.restoreSize`:`detail.editor.expand`),"aria-pressed":v,disabled:q,onClick:b,children:v?(0,$.jsx)(Pt,{}):(0,$.jsx)(pt,{})}),(0,$.jsxs)(`div`,{className:H(`min-h-0 flex-1 overflow-y-auto overscroll-contain`,v&&`lg:grid lg:grid-cols-[minmax(0,1fr)_320px] lg:items-start`),children:[(0,$.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-4 px-5 py-5 sm:px-8`,children:[Ce&&(0,$.jsxs)(be,{className:`w-auto`,children:[(0,$.jsx)(gt,{}),(0,$.jsx)(me,{children:m(`detail.editor.staleTitle`)}),(0,$.jsxs)(ge,{children:[m(`detail.editor.staleDescription`,{version:d.version}),(0,$.jsx)(z,{size:`sm`,className:`mt-2`,onClick:()=>V(ft(r)),children:m(`detail.editor.discardAndReload`)})]})]}),(0,$.jsx)(D,{error:S??ae.error??oe.error??T}),(0,$.jsx)(`div`,{className:`[&_[data-slot=field-label]]:sr-only`,children:(0,$.jsx)(Se,{label:m(`detail.field.title`),rows:1,value:G.title,onChange:e=>W(`title`,e.target.value),required:!0,maxLength:500,autoFocus:!0,ref:de,placeholder:m(`detail.editor.titlePlaceholder`),className:`field-sizing-content min-h-10 resize-none border-0 bg-transparent px-0 py-1 text-xl! font-semibold leading-snug shadow-none caret-primary focus-visible:ring-0 dark:bg-transparent`})}),!v&&Me,(0,$.jsx)(Xt,{label:m(`detail.field.description`),value:G.description,onChange:e=>W(`description`,e),rows:8,variant:`document`,placeholder:m(`detail.editor.descriptionPlaceholder`),onUpload:De}),te?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Xt,{label:m(`detail.field.acceptanceCriteria`),value:G.acceptanceCriteria,onChange:e=>W(`acceptanceCriteria`,e),rows:4,variant:`document`,maxLength:5e4,placeholder:m(`detail.editor.criteriaPlaceholder`),onUpload:De}),!G.acceptanceCriteria&&(0,$.jsx)(z,{variant:`ghost`,size:`icon-xs`,className:`absolute top-5 right-24 text-muted-foreground`,"aria-label":m(`detail.editor.removeCriteria`),onClick:()=>x(!1),children:(0,$.jsx)(_,{})})]}):(0,$.jsxs)(z,{variant:`ghost`,size:`sm`,className:`w-fit text-muted-foreground`,onClick:()=>x(!0),children:[(0,$.jsx)(_t,{}),m(`detail.editor.addCriteria`)]})]}),v&&(0,$.jsxs)(`aside`,{className:`border-t bg-muted/20 p-5 lg:sticky lg:top-0 lg:min-h-full lg:border-t-0 lg:border-l`,"aria-label":m(`detail.editor.properties`),children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[!r&&(0,$.jsx)($e,{variant:`row`,value:K,disabled:je,onChange:e=>void xe(e).catch(Ee)}),(0,$.jsx)(Z,{variant:`row`,property:`status`,projectId:K,value:it(G),onChange:e=>U(ut(e))}),(0,$.jsx)(Z,{variant:`row`,property:`priority`,projectId:K,value:G.priority,onChange:e=>W(`priority`,e)}),(0,$.jsx)(Z,{variant:`row`,property:`assignee`,projectId:K,value:G.assigneeId,onChange:e=>W(`assigneeId`,e)}),(0,$.jsx)(Z,{variant:`row`,property:`kind`,projectId:K,value:G.kind,onChange:e=>W(`kind`,e)}),(0,$.jsx)(Z,{variant:`row`,property:`difficulty`,projectId:K,value:G.difficulty,onChange:e=>W(`difficulty`,e)}),(0,$.jsx)(st,{variant:`row`,value:G,onChange:U}),(0,$.jsx)(Ze,{variant:`row`,projectId:K,values:G.customFields,isNew:!r,onChange:ye}),(0,$.jsxs)(`div`,{className:`grid grid-cols-[80px_minmax(0,1fr)] items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m(`detail.editor.agents`)}),(0,$.jsxs)(nt,{size:`sm`,className:H(fn,`h-7 justify-start gap-1.5`),pressed:G.automationReady,onPressedChange:e=>W(`automationReady`,e),"aria-label":m(`detail.editor.readyForAgents`),children:[(0,$.jsx)(St,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),G.automationReady?m(`detail.editor.readyForAgents`):m(`detail.editor.notReady`)]})]})]}),(0,$.jsxs)(`div`,{className:`mt-6 border-t pt-5`,children:[(0,$.jsx)(Qe,{label:m(`detail.field.labels`),value:G.labels,onChange:e=>W(`labels`,e)}),(0,$.jsx)(Zt,{label:m(`detail.field.parentTicket`),projectId:K,value:G.parentId,onChange:e=>W(`parentId`,e),exclude:r?[r.id]:[]}),(0,$.jsx)(Qe,{label:m(`detail.field.scopes`),kind:`scope`,value:G.scopes,onChange:e=>W(`scopes`,e)}),(0,$.jsx)(L,{label:m(`detail.field.holdReason`),value:G.holdReason??``,maxLength:2e3,placeholder:m(`detail.editor.holdPlaceholder`),onChange:e=>W(`holdReason`,e.target.value||null)})]})]})]}),(0,$.jsxs)(`footer`,{className:`z-10 flex shrink-0 flex-wrap items-center justify-between gap-3 border-t bg-muted/40 px-5 py-3`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,role:`status`,children:[re?m(`detail.editor.created`,{key:re}):k?m(`detail.editor.savedLocally`):T?m(`detail.editor.notSavedLocally`):``,we&&!Ce&&(0,$.jsxs)(z,{variant:`ghost`,size:`xs`,disabled:q,onClick:_e,children:[(0,$.jsx)(Ge,{}),m(`detail.editor.discardDraft`)]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!r&&(0,$.jsxs)(`label`,{className:`mr-2 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(vt,{size:`sm`,checked:M,disabled:q,onCheckedChange:F}),m(`detail.editor.createMore`)]}),(0,$.jsx)(ie,{render:(0,$.jsx)(z,{disabled:q}),children:m(`common.action.cancel`)}),(0,$.jsxs)(z,{type:`submit`,variant:`default`,disabled:J,children:[q?(0,$.jsx)(le,{}):null,m(q?`common.state.saving`:r?`detail.editor.save`:`detail.editor.create`),!q&&(0,$.jsx)(se,{"aria-hidden":`true`,className:`ml-1 hidden border-transparent bg-primary-foreground/20 text-primary-foreground shadow-none sm:inline-flex`,children:`⌘↵`})]})]})]})]});return(0,$.jsx)(Ne,{projectId:K,children:Pe})}export{pn as TicketEditor,It as _,rn as a,Jt as c,Yt as d,Bt as f,Gt as g,qt as h,un as i,Xt as l,Ut as m,an as n,$t as o,Ht as p,sn as r,Zt as s,dn as t,Kt as u};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{Kt as t,Nn as n,S as r,Zt as i,an as a,c as o,f as s,j as c,mn as l,nn as u,qt as d,r as f}from"./default-bQFGTwIp.js";import{Aa as p,B as m,F as h,G as g,Ga as _,Hi as v,I as y,J as b,Ji as ee,K as te,N as ne,Oa as re,P as ie,Pi as x,Q as ae,Ua as oe,V as se,Va as ce,W as le,Wa as ue,X as de,Y as fe,Zi as pe,_t as me,a as he,di as S,dt as ge,ea as _e,g as C,ka as w,l as ve,lr as ye,m as be,nt as T,o as xe,q as Se,qa as Ce,st as we,ta as Te,ut as Ee,wo as De}from"./search-Ble6WSEU.js";import{t as Oe}from"./useQueries-5lW2C5Sb.js";import{g as ke,p as Ae,u as je}from"./item-TCHuZNK6.js";import{t as E}from"./archive-restore-76sStk8K.js";import{r as Me,t as Ne}from"./Trans-B1rRlWca.js";import{n as Pe}from"./project-lifecycle-n1ZZbYfu.js";import{n as Fe}from"./CompositeItem-CXqewtEL.js";import{n as Ie}from"./ticket-list-controls-fYBottFC.js";import{t as Le}from"./ellipsis-GF1HwTDb.js";import{_ as D,d as Re,m as O,p as ze,r as Be}from"./en-US-DKYSujv3.js";import{$ as Ve,B as He,Bt as k,C as Ue,Ct as We,F as Ge,Ft as Ke,G as qe,Gt as Je,H as Ye,Ht as Xe,It as A,K as Ze,Kt as Qe,L as $e,Lt as et,Mt as tt,Nt as nt,P as rt,Pt as it,Rt as at,St as ot,U as st,V as ct,W as lt,Wt as ut,X as j,Y as dt,_n as ft,a as pt,at as mt,b as ht,bn as gt,bt as M,ct as N,dt as _t,et as vt,ft as yt,gn as bt,ht as xt,it as St,j as Ct,lt as wt,mt as Tt,on as Et,ot as Dt,pt as Ot,q as kt,qt as P,rt as At,st as jt,tt as Mt,ut as Nt,w as Pt,wt as Ft,xt as It,yt as Lt,z as Rt,zt}from"./index-CYVrs22O.js";import{a as Bt,i as Vt,n as Ht,o as Ut,r as Wt,t as Gt}from"./table-UJp5S9yy.js";import{TicketEditor as Kt}from"./ticket-editor--d_bG9C1.js";var qt={name:`bookmark-plus`,size:24,node:[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M15 10H9`,key:`o6yqo3`}],[`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`}]]};qt.node;var Jt=_(qt),Yt={name:`list-todo`,size:24,node:[[`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`}]]};Yt.node;var Xt=_(Yt),Zt={name:`notebook-tabs`,size:24,node:[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M15 2v20`,key:`dcj49h`}],[`path`,{d:`M15 7h5`,key:`1xj5lc`}],[`path`,{d:`M15 12h5`,key:`w5shd9`}],[`path`,{d:`M15 17h5`,key:`1qaofu`}]]};Zt.node;var Qt=_(Zt);function F(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=$t(e);if(n.length!==$t(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function $t(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var I=e(n(),1);function en(e){return L(e)||typeof e==`function`||tn(e)}function L(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function tn(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function nn(e,t){return e==null?null:en(e)?I.createElement(e,t):e}function rn(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?nn(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:nn(n.cell,t.getContext())}return`header`in e&&e.header?nn(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?nn(e.footer.column.columnDef.footer,e.footer.getContext()):null}function an(e){let t=Je(e.source,e.selector,{compare:F});return typeof e.children==`function`?e.children(t):e.children}function on(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function sn(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return(!a||!i(o,t))&&(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function cn(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{(!n||!t(r,e))&&i(e)})}}function ln(){return sn({createAtom:P,batch:Qe})}function un(e,t){return typeof e==`function`?e(t):e}function R(e){if(Array.isArray(e))return e.map(R);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?z():{},r=Object.keys(e);for(let t=0;t<r.length;t++){let i=r[t];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,value:R(e[i]),writable:!0})}return n}return e}function dn(e,t){let n=Object.keys(t),r=e;for(let e=0;e<n.length;e++){let i=n[e];!i.startsWith(`_memo_`)&&i!==`_cellsCache`&&(r[i]=t[i])}return e}function z(){return Object.create(null)}function B(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function V(e,t){return n=>{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>un(n,e))}}function fn(e){if(typeof e!=`object`||!e)return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function pn(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var H=3;function mn(e,t){return U(e,t,H)}function U(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!fn(e)||!fn(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;let r=pn(e),i=pn(t);if(r.length!==i.length)return!1;let a=e,o=t;for(let e=0;e<r.length;e++){let i=r[e];if(!Object.prototype.propertyIsEnumerable.call(t,i)||!U(a[i],o[i],n-1))return!1}return!0}function W(e,t,n,r=mn){let i=`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`,a=e.options[i];a&&a(e=>{let t=un(n,e);return r(e,t)?e:t})}function hn(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}var gn=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e<l.length;e++)if(l[e]!==o[e]){u=!0;break}}return n?.(u),u&&(o=l,a?.(),s=e(...l??[]),r?.(s)),s}};function _n(e){let t=!1;return()=>{t?e():t=!0}}function vn({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o={onAfterUpdate:r?()=>{let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))}:void 0};return gn({...a,...o})}function yn(e,t=`_`){let[n,r]=e.replace(t,` `).split(` `);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function G(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=yn(r);t[n]=a?vn({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function K(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=yn(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=vn({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function q(e,t,n,...r){return e[t]?.(...r)??n(e,...r)}function bn(e){return e.row.getValue(e.column.id)}function xn(e){return e.getValue()??e.table.options.renderFallbackValue}function Sn(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var Cn={assignCellPrototype:(e,t)=>{K(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>bn(e)},cell_renderValue:{fn:e=>xn(e)},cell_getContext:{fn:e=>Sn(e),memoDeps:e=>[e]}})}};function J(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignColumnPrototype?.(e._columnPrototype,e)}return e._columnPrototype}function wn(e,t,n,r){let i={...e.getDefaultColumnDef(),...t},a=i.accessorKey,o=a===void 0?void 0:String(a),s=i.id??o?.replaceAll(`.`,`_`)??(typeof i.header==`string`?i.header:void 0),c;if(i.accessorFn)c=i.accessorFn;else if(a!==void 0){if(typeof a==`string`&&a.includes(`.`)){let e=a.split(`.`);c=t=>{let n=t;for(let t=0;t<e.length;t++){let r=e[t];n=n?.[r]}return n}}else c=e=>e[i.accessorKey]}if(!s)throw Error();let l=J(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;e<d.length;e++)d[e](u);return u}function Tn(e){return e.getIsVisible?.()??!0}function En(e){return e.getVisibleLeafColumns?.()??e.getAllLeafColumns()}function Dn(e,t){let n=e,r=t;return n.getOrderColumnsFn?.()(r)??n._orderGroupedColumns?.(r)??t}function On(e,t,n,r){return e._orderByColumnPinning?.(t,n,r)??t}function Y(e,t){return e.getPinnedVisibleLeafColumns?.(t)??(t&&t!==`center`?[]:En(e))}function kn(e,t){return e._expandRows?.(t)??t}function An(e){e.autoResetExpanded?.()}function jn(e){e.autoResetPageIndex?.()}function Mn(e){e.autoResetSorting?.()}function Nn(e){e.autoResetCellSelection?.()}function Pn(e){return[e,...e.columns.flatMap(e=>e.getFlatColumns())]}function Fn(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return Dn(e.table,t)}return[e]}function In(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function Ln(e,t,n,r=0){let i=Array(t.length);for(let a=0;a<t.length;a++){if(!(a in t))continue;let o=t[a],s=wn(e,o,r,n),c=o;s.columns=c.columns?Ln(e,c.columns,s,r+1):[],i[a]=s}return i}function Rn(e){return Ln(e,e.options.columns)}function zn(e){return e.getAllColumns().flatMap(e=>e.getFlatColumns())}function Bn(e){let t=z(),n=e.getAllFlatColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function Vn(e){return Dn(e,e.getAllColumns().flatMap(e=>e.getLeafColumns()))}function Hn(e){let t=z(),n=e.getAllLeafColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function Un(e,t){return e.getAllFlatColumnsById()[t]}var Wn={assignColumnPrototype:(e,t)=>{K(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>Pn(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>Fn(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{G(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>In(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>Rn(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>zn(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>Bn(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>Vn(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>Hn(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>Un(e,t)}})}};function X(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignHeaderPrototype?.(e._headerPrototype,e)}return e._headerPrototype}function Gn(e,t,n){let r=X(e),i=Object.create(r);i.colSpan=0,i.column=t,i.depth=n.depth,i.headerGroup=null,i.id=n.id??t.id,i.index=n.index,i.isPlaceholder=!!n.isPlaceholder,i.placeholderId=n.placeholderId,i.rowSpan=0,i.subHeaders=[];let a=e._headerInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function Kn(e,t=1){let n=t;for(let r=0;r<e.length;r++){let i=e[r];Tn(i)&&i.columns.length&&(n=Math.max(n,Kn(i.columns,t+1)))}return n}function qn(e,t){return e?`${e}_${t}`:String(t)}function Jn(e,t,n,r){let i=e??``;return t&&(i=i?`${i}_${t}`:String(t)),n&&(i=i?`${i}_${n}`:n),r&&(i=i?`${i}_${r}`:r),i}function Yn(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function Xn(e,t,n,r,i,a){let o={depth:t,id:qn(r,t),headers:[]},s=[];for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i],c=s[s.length-1],l=a.column.depth===o.depth,u,d=!1;if(l&&a.column.parent?u=a.column.parent:(u=a.column,d=!0),c&&c.column===u)c.subHeaders.push(a);else{let e=Gn(n,u,{id:Jn(r,t,u.id,a.id),isPlaceholder:d,placeholderId:d?String(Yn(s,u)):void 0,depth:t,index:s.length});e.subHeaders.push(a),s.push(e)}o.headers.push(a),a.headerGroup=o}for(let e=0;e<a.length;e++)a[e](o);i.push(o),t>0&&Xn(s,t-1,n,r,i,a)}function Zn(e){for(let t=0;t<e.length;t++){let n=e[t];if(!Tn(n.column))continue;let r=0;if(n.subHeaders.length){Zn(n.subHeaders);for(let e=0;e<n.subHeaders.length;e++){let t=n.subHeaders[e];Tn(t.column)&&(r+=t.colSpan)}}else r=1;if(n.colSpan=r,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let e=1,t=n.subHeaders[0];for(;t;)t.rowSpan=0,e++,t=t.subHeaders.length===1&&t.subHeaders[0].column===n.column?t.subHeaders[0]:void 0;n.rowSpan=e}else n.rowSpan=1}}function Qn(e,t,n,r){let i=Kn(e),a=[],o=n._headerGroupInstanceInitFns,s=Array(t.length);for(let e=0;e<t.length;e++)e in t&&(s[e]=Gn(n,t[e],{depth:i,index:e}));return Xn(s,i-1,n,r,a,o),a.reverse(),Zn(a[0]?.headers??[]),a}function $n(e,t){for(let n=0;n<e.subHeaders.length;n++)$n(e.subHeaders[n],t);t.push(e)}function er(e){let t=[];return $n(e,t),t}function tr(e){return{column:e.column,header:e,table:e.column.table}}function nr(e){return Qn(e.getAllColumns(),On(e,En(e),e=>e.id),e)}function rr(e){return[...e.getHeaderGroups()].reverse()}function ir(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e<t.length;e++){let r=t[e].headers;for(let e=0;e<r.length;e++)n.push(r[e])}return n}function ar(e){let t=e.getHeaderGroups()[0]?.headers??[],n=[];for(let e=0;e<t.length;e++){let r=t[e].getLeafHeaders();for(let e=0;e<r.length;e++)n.push(r[e])}return n}var or={assignHeaderPrototype:(e,t)=>{K(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>er(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>tr(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{G(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>nr(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>rr(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>ir(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>ar(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function sr(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignRowPrototype?.(e._rowPrototype,e)}return e._rowPrototype}var cr=(e,t,n,r,i,a,o)=>{let s=sr(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=z(),c._valuesCache=z(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;e<l.length;e++)l[e](c);return c};function lr(){return e=>vn({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>dr(e,e.options.data),onAfterUpdate:_n(()=>{An(e),jn(e),Mn(e),Nn(e)})})}function ur(e,t,n,r=0,i){let a=[];for(let o=0;o<n.length;o++){let s=n[o],c=cr(e,e.getRowId(s,o,i),s,o,r,void 0,i?.id);t.flatRows.push(c),t.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(s,o),c.originalSubRows?.length&&(c.subRows=ur(e,t,c.originalSubRows,r+1,c)))}return a}function dr(e,t){let n={rows:[],flatRows:[],rowsById:z()};return n.rows=ur(e,n,t),n}function fr(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??lr()(e)),e._rowModels.coreRowModel()}function pr(e){return e.getCoreRowModel()}function mr(e){return e._rowModels.filteredRowModel||(e._rowModels.filteredRowModel=e.options.features.filteredRowModel?.(e)),e.options.manualFiltering||!e._rowModels.filteredRowModel?e.getPreFilteredRowModel():e._rowModels.filteredRowModel()}function hr(e){return e.getFilteredRowModel()}function gr(e){return e._rowModels.groupedRowModel||(e._rowModels.groupedRowModel=e.options.features.groupedRowModel?.(e)),e.options.manualGrouping||!e._rowModels.groupedRowModel?e.getPreGroupedRowModel():e._rowModels.groupedRowModel()}function _r(e){return e.getGroupedRowModel()}function vr(e){return e._rowModels.sortedRowModel||(e._rowModels.sortedRowModel=e.options.features.sortedRowModel?.(e)),e.options.manualSorting||!e._rowModels.sortedRowModel?e.getPreSortedRowModel():e._rowModels.sortedRowModel()}function yr(e){return e.getSortedRowModel()}function br(e){return e._rowModels.expandedRowModel||(e._rowModels.expandedRowModel=e.options.features.expandedRowModel?.(e)),e.options.manualExpanding||!e._rowModels.expandedRowModel?e.getPreExpandedRowModel():e._rowModels.expandedRowModel()}function xr(e){return e.getExpandedRowModel()}function Sr(e){return e._rowModels.paginatedRowModel||(e._rowModels.paginatedRowModel=e.options.features.paginatedRowModel?.(e)),e.options.manualPagination||!e._rowModels.paginatedRowModel?e.getPrePaginatedRowModel():e._rowModels.paginatedRowModel()}function Cr(e){return e.getPaginatedRowModel()}var wr={constructTableAPIs:e=>{G(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>fr(e)},table_getPreFilteredRowModel:{fn:()=>pr(e)},table_getFilteredRowModel:{fn:()=>mr(e)},table_getPreGroupedRowModel:{fn:()=>hr(e)},table_getGroupedRowModel:{fn:()=>gr(e)},table_getPreSortedRowModel:{fn:()=>_r(e)},table_getSortedRowModel:{fn:()=>vr(e)},table_getPreExpandedRowModel:{fn:()=>yr(e)},table_getExpandedRowModel:{fn:()=>br(e)},table_getPrePaginatedRowModel:{fn:()=>xr(e)},table_getPaginatedRowModel:{fn:()=>Sr(e)},table_getRowModel:{fn:()=>Cr(e)}})}};function Tr(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignCellPrototype?.(e._cellPrototype,e)}return e._cellPrototype}function Er(e,t,n){let r=Tr(n),i=Object.create(r);i.column=e,i.id=`${t.id}_${e.id}`,i.row=t;let a=n._cellInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function Dr(e){let t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function Or(e){let t=e.getPrePaginatedRowModel(),n=e.options.paginateExpandedRows===!1?kn(e,t).rows:t.rows;for(let e=0;e<n.length;e++)n[e]._displayIndexCache=e;return n}function kr(e,t){if(B(e._valuesCache,t))return e._valuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return e._valuesCache[t]=n.accessorFn(e.original,e.index),e._valuesCache[t]}function Ar(e,t){if(B(e._uniqueValuesCache,t))return e._uniqueValuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return n.columnDef.getUniqueValues?(e._uniqueValuesCache[t]=n.columnDef.getUniqueValues(e.original,e.index),e._uniqueValuesCache[t]):(e._uniqueValuesCache[t]=[e.getValue(t)],e._uniqueValuesCache[t])}function jr(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function Mr(e){return hn(e.subRows,e=>e.subRows)}function Nr(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e<t.length;e++)n=Math.max(n,t[e].depth);return n}function Pr(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function Fr(e){let t=[],n=e;for(;;){let e=n.getParentRow();if(!e)break;t.push(e),n=e}return t.reverse()}function Ir(e){let t=e.table.getAllLeafColumns(),n=e._cellsCache;n||=e._cellsCache=new WeakMap;let r=Array(t.length);for(let i=0;i<t.length;i++){let a=t[i],o=n.get(a);o||(o=Er(a,e,e.table),n.set(a,o)),r[i]=o}return r}function Lr(e){let t=z(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];t[r.column.id]=r}return t}function Rr(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function zr(e,t,n){let r=(n?e.getPrePaginatedRowModel():e.getRowModel()).rowsById[t];if(!r&&(r=e.getCoreRowModel().rowsById[t],!r))throw Error();return r}var Br={assignRowPrototype:(e,t)=>{K(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>Dr(e)},row_getAllCellsByColumnId:{fn:e=>Lr(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>Ir(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>Mr(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>Pr(e)},row_getParentRows:{fn:e=>Fr(e)},row_getUniqueValues:{fn:(e,t)=>Ar(e,t)},row_getValue:{fn:(e,t)=>kr(e,t)},row_renderValue:{fn:(e,t)=>jr(e,t)}})},constructTableAPIs:e=>{G(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>Or(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>Rr(t,e,n,r)},table_getRow:{fn:(t,n)=>zr(e,t,n)},table_getMaxSubRowDepth:{fn:()=>Nr(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function Vr(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function Hr(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{Vr(e,t,n),e._reactivity.commit?.()})}function Ur(e){let t=R(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];e.baseAtoms[i].set(t[i])}});let n=Object.values(e._features);for(let t=0;t<n.length;t++)n[t].resetTableInstanceData?.(e)}function Wr(e,t){let{features:n,atoms:r,initialState:i}=e.options;if(!e.options.mergeOptions)return{...e.options,...t,features:n,atoms:r,initialState:i};let a=e.options.mergeOptions(e.options,t),o={...Object.getOwnPropertyDescriptors(a)};return Object.defineProperties(Object.create(Object.getPrototypeOf(a)),{...o,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:r,enumerable:!0,configurable:!0,writable:!0},initialState:{value:i,enumerable:!0,configurable:!0,writable:!0}})}function Gr(e,t,n){let r=Wr(e,un(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&Hr(e,r.state??null)}var Kr={coreCellsFeature:Cn,coreColumnsFeature:Wn,coreHeadersFeature:or,coreRowModelsFeature:wr,coreRowsFeature:Br,coreTablesFeature:{constructTableAPIs:e=>{G(`coreTablesFeature`,e,{table_reset:{fn:()=>Ur(e)},table_setOptions:{fn:t=>Gr(e,t)}})}}};function qr(e){return e}function Jr(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),R(t)}function Yr(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:c,filterFns:l,filterMeta:u,filteredRowModel:d,groupedRowModel:f,paginatedRowModel:p,sortFns:m,sortedRowModel:h,tableMeta:g,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...Kr,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:l,sortFns:m},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=Jr(v._features,v.options.initialState);let ee=Object.keys(v.initialState);for(let e=0;e<ee.length;e++){let n=ee[e];v.baseAtoms[n]=t.createWritableAtom(v.initialState[n],{debugName:`table/baseAtoms/${n}`}),v.atoms[n]=t.createReadonlyAtom(()=>{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&B(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}Vr(v),v.store=on(t.createReadonlyAtom(()=>{let e={};for(let t=0;t<ee.length;t++){let n=ee[t];e[n]=v.atoms[n].get()}return e},{compare:F,debugName:`table/store`}));for(let e=0;e<y.length;e++){let t=y[e];t.initTableInstanceData?.(v),t.initCellInstanceData&&v._cellInstanceInitFns.push(t.initCellInstanceData.bind(t)),t.initColumnInstanceData&&v._columnInstanceInitFns.push(t.initColumnInstanceData.bind(t)),t.initHeaderGroupInstanceData&&v._headerGroupInstanceInitFns.push(t.initHeaderGroupInstanceData.bind(t)),t.initHeaderInstanceData&&v._headerInstanceInitFns.push(t.initHeaderInstanceData.bind(t)),t.initRowInstanceData&&v._rowInstanceInitFns.push(t.initRowInstanceData.bind(t)),t.constructTableAPIs?.(v)}return v}function Xr(){return z()}function Zr(){return{size:150,minSize:20,maxSize:2**53-1}}function Qr(e){let t=Zr(),n=e.table.atoms.columnSizing?.get(),r=n&&B(n,e.id)?n[e.id]:void 0;return Math.min(Math.max(e.columnDef.minSize??t.minSize,r??e.columnDef.size??t.size),e.columnDef.maxSize??t.maxSize)}function $r(e){let t=z(),n=z(),r=Array(e.length),i=0;for(let n=0;n<e.length;n++){let a=e[n],o=q(a,`getSize`,Qr);r[n]=o,t[a.id]=i,i+=o}let a=0;for(let t=e.length-1;t>=0;t--)n[e[t].id]=a,a+=r[t];return{starts:t,afters:n}}function ei(e){return{all:$r(Y(e)),center:$r(Y(e,`center`)),start:$r(Y(e,`start`)),end:$r(Y(e,`end`))}}function ti(e){return e===`start`?`start`:e===`end`?`end`:e===`center`?`center`:`all`}function ni(e,t){return q(e.table,`getColumnOffsets`,ei)[ti(t)].starts[e.id]??0}function ri(e,t){return q(e.table,`getColumnOffsets`,ei)[ti(t)].afters[e.id]??0}function ii(e){ci(e.table,t=>{let n=z(),r=Object.keys(t);for(let i=0;i<r.length;i++){let a=r[i];a!==e.id&&(n[a]=t[a])}return n})}function ai(e){if(!e.subHeaders.length)return Qr(e.column);let t=0;for(let n=0;n<e.subHeaders.length;n++)t+=ai(e.subHeaders[n]);return t}function oi(e){return ai(e)}function si(e){if(e.index>0){let t=e.headerGroup?.headers[e.index-1];if(t)return q(t,`getStart`,si)+q(t,`getSize`,oi)}return 0}function ci(e,t){e.options.onColumnSizingChange?.(t)}function li(e,t){ci(e,t?z():Object.assign(z(),R(e.initialState.columnSizing??{})))}function ui(e){let t=0;for(let n=0;n<e.length;n++)t+=q(e[n],`getSize`,Qr);return t}function di(e){return e.getHeaderGroups()[0]?.headers.reduce((e,t)=>e+oi(t),0)??0}function fi(e){return ui(Y(e,`start`))}function pi(e){return ui(Y(e,`center`))}function mi(e){return ui(Y(e,`end`))}function hi(){return{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}}function gi(e){return(e.columnDef.enableResizing??!0)&&(e.table.options.enableColumnResizing??!0)}function _i(e){return e.table.atoms.columnResizing?.get()?.isResizingColumn===e.id}function vi(e,t){let n=e.table.getColumn(e.column.id),r=gi(n);return i=>{if(!r||Ci(i)&&i.touches.length>1)return;let a=oi(e),o=e.getLeafHeaders().map(e=>[e.column.id,Qr(e.column)]),s=Ci(i)?Math.round(i.touches[0].clientX):i.clientX,c=z(),l=(e,t)=>{if(typeof t!=`number`)return;let r=n.table,i=r.options.columnResizeMode===`onChange`||e===`end`;r._reactivity.batch(()=>{yi(r,e=>{let n=r.options.columnResizeDirection===`rtl`?-1:1,a=(t-(e.startOffset??0))*n,o=e.startSize??0,s=Math.max(o>0?a/o:0,-.999999);if(i){let t=e.columnSizingStart;for(let e=0;e<t.length;e++){let n=t[e],r=n[1];c[n[0]]=Math.round(Math.max(r>0?r+r*s:a/t.length,0)*100)/100}}return{...e,deltaOffset:a,deltaPercentage:s}}),i&&ci(r,e=>Object.assign(z(),e,c))})},u=null,d=!1,f,p=()=>{d?(d=!1,l(`move`,f),u=requestAnimationFrame(p)):u=null},m=e=>{f=e,typeof requestAnimationFrame==`function`?u===null?(l(`move`,e),u=requestAnimationFrame(p)):d=!0:l(`move`,e)},h=e=>{u!==null&&(cancelAnimationFrame(u),u=null,d=!1),n.table._reactivity.batch(()=>{l(`end`,e??f),yi(n.table,e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))})},g=t||(typeof document<`u`?document:null),_={moveHandler:e=>m(e.clientX),upHandler:e=>{g?.removeEventListener(`mousemove`,_.moveHandler),g?.removeEventListener(`mouseup`,_.upHandler),h(e.clientX)}},v={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),m(e.touches[0].clientX),!1),upHandler:e=>{y(),e.cancelable&&(e.preventDefault(),e.stopPropagation()),h(e.touches[0]?.clientX)},cancelHandler:()=>{y(),h()}},y=()=>{g?.removeEventListener(`touchmove`,v.moveHandler),g?.removeEventListener(`touchend`,v.upHandler),g?.removeEventListener(`touchcancel`,v.cancelHandler)},b=Si()?{passive:!1}:!1;Ci(i)?(g?.addEventListener(`touchmove`,v.moveHandler,b),g?.addEventListener(`touchend`,v.upHandler,b),g?.addEventListener(`touchcancel`,v.cancelHandler,b)):(g?.addEventListener(`mousemove`,_.moveHandler,b),g?.addEventListener(`mouseup`,_.upHandler,b)),yi(n.table,e=>({...e,startOffset:s,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:o,isResizingColumn:n.id}))}}function yi(e,t){e.options.onColumnResizingChange?.(t)}function bi(e,t){yi(e,t?hi():R(e.initialState.columnResizing??hi()))}var xi=null;function Si(){if(typeof xi==`boolean`)return xi;let e=!1;try{let t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener(`test`,n,t),window.removeEventListener(`test`,n)}catch{e=!1}return xi=e,xi}function Ci(e){return e.type===`touchstart`}var wi={getInitialState:e=>({columnResizing:hi(),...e}),getDefaultTableOptions:e=>({columnResizeMode:`onEnd`,columnResizeDirection:`ltr`,onColumnResizingChange:V(`columnResizing`,e)}),assignColumnPrototype:(e,t)=>{K(`columnResizingFeature`,e,t,{column_getCanResize:{fn:e=>gi(e)},column_getIsResizing:{fn:e=>_i(e)}})},assignHeaderPrototype:(e,t)=>{K(`columnResizingFeature`,e,t,{header_getResizeHandler:{fn:(e,t)=>vi(e,t)}})},constructTableAPIs:e=>{G(`columnResizingFeature`,e,{table_setColumnResizing:{fn:t=>yi(e,t)},table_resetHeaderSizeInfo:{fn:t=>bi(e,t)}})}},Ti={getInitialState:e=>({columnSizing:Xr(),...e}),getDefaultColumnDef:()=>Zr(),getDefaultTableOptions:e=>({onColumnSizingChange:V(`columnSizing`,e)}),assignColumnPrototype:(e,t)=>{K(`columnSizingFeature`,e,t,{column_getSize:{fn:e=>Qr(e),memoDeps:e=>[t.options.columns,t.atoms.columnSizing?.get()?.[e.id]]},column_getStart:{fn:(e,t)=>ni(e,t)},column_getAfter:{fn:(e,t)=>ri(e,t)},column_resetSize:{fn:e=>ii(e)}})},assignHeaderPrototype:(e,t)=>{K(`columnSizingFeature`,e,t,{header_getSize:{fn:e=>oi(e),memoDeps:e=>[t.options.columns,e.column.columns.length>0?t.atoms.columnSizing?.get():t.atoms.columnSizing?.get()?.[e.column.id]]},header_getStart:{fn:e=>si(e),memoDeps:()=>[t.options.columns,t.atoms.columnSizing?.get(),t.atoms.columnOrder?.get(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get(),t.atoms.grouping?.get(),t.options.groupedColumnMode]}})},constructTableAPIs:e=>{G(`columnSizingFeature`,e,{table_getColumnOffsets:{fn:()=>ei(e),memoDeps:()=>[e.options.columns,e.atoms.columnSizing?.get(),e.atoms.columnOrder?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.atoms.grouping?.get(),e.options.groupedColumnMode]},table_setColumnSizing:{fn:t=>ci(e,t)},table_resetColumnSizing:{fn:t=>li(e,t)},table_getTotalSize:{fn:()=>di(e),memoDeps:()=>[e.atoms.columnSizing?.get(),e.getHeaderGroups()]},table_getStartTotalSize:{fn:()=>fi(e),memoDeps:()=>[e.atoms.columnSizing?.get(),e.getHeaderGroups()]},table_getCenterTotalSize:{fn:()=>pi(e),memoDeps:()=>[e.atoms.columnSizing?.get(),e.getHeaderGroups()]},table_getEndTotalSize:{fn:()=>mi(e),memoDeps:()=>[e.atoms.columnSizing?.get(),e.getHeaderGroups()]}})}};function Ei(){return z()}function Di(e,t){Oi(e)&&Pi(e.table,n=>{let r=Object.assign(z(),n),i=t??!q(e,`getIsVisible`,Z),a=e.getLeafColumns();for(let e=0;e<a.length;e++){let t=a[e];Oi(t)&&(r[t.id]=i)}return r})}function Z(e){let t=e.table.atoms.columnVisibility?.get();if(!t)return!0;let n=e.columns;return n.length?n.some(e=>q(e,`getIsVisible`,Z)):(B(t,e.id)?t[e.id]:void 0)??!0}function Oi(e){return(e.columnDef.enableHiding??!0)&&(e.table.options.enableHiding??!0)}function ki(e){return t=>{Di(e,t.target.checked)}}function Ai(e){let t=e.getAllCells(),n=[];for(let e=0;e<t.length;e++){let r=t[e];q(r.column,`getIsVisible`,Z)&&n.push(r)}return On(e.table,n,e=>e.column.id,()=>q(e,`getVisibleCellsByColumnId`,ji))}function ji(e){let t=z(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];q(r.column,`getIsVisible`,Z)&&(t[r.column.id]=r)}return t}function Mi(e){return e.getAllFlatColumns().filter(e=>q(e,`getIsVisible`,Z))}function Ni(e){return e.getAllLeafColumns().filter(e=>q(e,`getIsVisible`,Z))}function Pi(e,t){W(e,`columnVisibility`,t)}function Fi(e,t){Pi(e,t?z():Object.assign(z(),R(e.initialState.columnVisibility??{})))}function Ii(e,t){t??=!Li(e);let n=z(),r=e.getAllLeafColumns();for(let e=0;e<r.length;e++){let i=r[e];n[i.id]=t||!Oi(i)}Pi(e,n)}function Li(e){return!e.getAllLeafColumns().some(e=>!q(e,`getIsVisible`,Z))}function Ri(e){return e.getAllLeafColumns().some(e=>q(e,`getIsVisible`,Z))}function zi(e){return t=>{Ii(e,t.target.checked)}}var Bi={getInitialState:e=>({columnVisibility:Ei(),...e}),getDefaultTableOptions:e=>({onColumnVisibilityChange:V(`columnVisibility`,e)}),assignColumnPrototype:(e,t)=>{K(`columnVisibilityFeature`,e,t,{column_getIsVisible:{fn:e=>Z(e),memoDeps:e=>[t.options.columns,t.atoms.columnVisibility?.get(),e.columns]},column_getCanHide:{fn:e=>Oi(e)},column_getToggleVisibilityHandler:{fn:e=>ki(e)},column_toggleVisibility:{fn:(e,t)=>Di(e,t)}})},assignRowPrototype:(e,t)=>{K(`columnVisibilityFeature`,e,t,{row_getVisibleCells:{fn:e=>Ai(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get()]},row_getVisibleCellsByColumnId:{fn:e=>ji(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnVisibility?.get()]}})},constructTableAPIs:e=>{G(`columnVisibilityFeature`,e,{table_getVisibleFlatColumns:{fn:()=>Mi(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getVisibleLeafColumns:{fn:()=>Ni(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_setColumnVisibility:{fn:t=>Pi(e,t)},table_resetColumnVisibility:{fn:t=>Fi(e,t)},table_toggleAllColumnsVisible:{fn:t=>Ii(e,t)},table_getIsAllColumnsVisible:{fn:()=>Li(e)},table_getIsSomeColumnsVisible:{fn:()=>Ri(e)},table_getToggleAllColumnsVisibilityHandler:{fn:()=>zi(e)}})}};function Vi(){return z()}function Hi(e,t){e.options.onRowSelectionChange?.(t)}function Ui(e,t){e._lastSelectedRowId=null,Hi(e,t?z():Object.assign(z(),R(e.initialState.rowSelection??{})))}function Wi(e,t,n){e._lastSelectedRowId=null,Hi(e,r=>{if(t=t===void 0?!q(e,`getIsAllRowsSelected`,Zi):t,n?.deselectAll&&!t)return z();let i=Object.assign(z(),r),a=e.getPreGroupedRowModel().flatRows;if(t){let e=new Map;a.forEach(t=>{fa(t,e)&&(i[t.id]=!0)})}else a.forEach(e=>{Q(e)&&delete i[e.id]});return i})}function Gi(e,t,n){e._lastSelectedRowId=null,Hi(e,r=>{let i=t===void 0?!q(e,`getIsAllPageRowsSelected`,Qi):t;if(n?.deselectAll&&!i)return z();let a=Object.assign(z(),r);return e.getRowModel().rows.forEach(t=>{da(a,t.id,i,!0,e,!0)}),a})}function Ki(e){return e.getCoreRowModel()}function qi(e){let t=e.getCoreRowModel();return q(e,`getIsSomeRowsSelected`,$i)?ha(t,e):{rows:[],flatRows:[],rowsById:z()}}function Ji(e){let t=e.getFilteredRowModel();return q(e,`getIsSomeRowsSelected`,$i)?ha(t,e):{rows:[],flatRows:[],rowsById:z()}}function Yi(e){let t=e.getSortedRowModel();return q(e,`getIsSomeRowsSelected`,$i)?ha(t,e):{rows:[],flatRows:[],rowsById:z()}}function Xi(e){return Object.keys(e.atoms.rowSelection?.get()??{})}function Zi(e){let t=e.getFilteredRowModel().flatRows,n=e.atoms.rowSelection?.get()??{},r=!!(t.length&&Object.keys(n).length);if(r){let e=new Map;t.some(t=>!ga(t,n)&&fa(t,e))&&(r=!1)}return r}function Qi(e){let t=e.getPaginatedRowModel().flatRows,n=e.atoms.rowSelection?.get()??{},r=new Map,i=!1;for(let e=0;e<t.length;e++){let a=t[e];if(ga(a,n))!i&&fa(a,r)&&(i=!0);else if(fa(a,r))return!1}return i}function $i(e){return q(e,`getSelectedRowIds`,Xi).length>0}function ea(e){return e.getPaginatedRowModel().flatRows.filter(e=>Q(e)).some(e=>ia(e)||q(e,`getIsSomeSelected`,aa))}function ta(e){return t=>{Wi(e,t.target.checked)}}function na(e){return t=>{Gi(e,t.target.checked)}}function ra(e,t,n){let r=ia(e);Hi(e.table,i=>{t=t===void 0?!r:t;let a=Object.assign(z(),i);return da(a,e.id,t,(n?.selectChildren??!0)&&ca(e),e.table),!t&&n?.deselectParents&&pa(a,e),a})}function ia(e){return ga(e,e.table.atoms.rowSelection?.get()??{})}function aa(e){return _a(e)===`some`}function oa(e){return _a(e)===`all`}function Q(e){let t=e.table.options;return typeof t.enableRowSelection==`function`?t.enableRowSelection(e):t.enableRowSelection??!0}function sa(e){let t=e.table.options;return typeof t.enableSubRowSelection==`function`?t.enableSubRowSelection(e):t.enableSubRowSelection??!0}function ca(e){let t=e.table.options;return typeof t.enableMultiRowSelection==`function`?t.enableMultiRowSelection(e):t.enableMultiRowSelection??!0}function la(e,t){let n=Q(e);return r=>{if(!n)return;let i=r,a=e.table,o=i.target.checked,s=a._lastSelectedRowId;(!(a.options.enableRowRangeSelection!==!1&&s!==null&&ca(e)&&(a.options.isRowRangeSelectionEvent?.(r)??!1))||!ua(e,s,o,t))&&ra(e,o,t),a._lastSelectedRowId=e.id}}function ua(e,t,n,r){let i=r?.selectChildren??!0,a=e.table,o=a.getRowsInDisplayOrder(),s=a.getPrePaginatedRowModel().rowsById[t]??a.getCoreRowModel().rowsById[t];if(!s)return!1;let c=s.getDisplayIndex(),l=e.getDisplayIndex(),u=o[c],d=o[l];if(c<0||l<0||c>=o.length||l>=o.length||u?.id!==s.id||d?.id!==e.id||!ca(s)||!ca(e))return!1;let f=Math.min(c,l),p=Math.max(c,l);return Hi(a,e=>{let t=Object.assign(z(),e);for(let e=f;e<=p;e++){let s=o[e];Q(s)&&ca(s)&&(da(t,s.id,n,i,a),!n&&r?.deselectParents&&pa(t,s))}return t}),!0}function da(e,t,n,r,i,a){let o=i.getRow(t,!0);n?(ca(o)||Object.keys(e).forEach(t=>delete e[t]),Q(o)&&(e[t]=!0)):(!a||Q(o))&&delete e[t],r&&o.subRows.length&&sa(o)&&o.subRows.forEach(t=>da(e,t.id,n,r,i,a))}function fa(e,t){if(!Q(e))return!1;let n=e.table;if(n.options.enableSubRowSelection===!0)return!0;let r=e.parentId;if(r===void 0)return!0;let i=t.get(r);if(i!==void 0)return i;let a=n.getCoreRowModel().rowsById,o=[],s=!0,c=r;for(;c!==void 0;){let e=t.get(c);if(e!==void 0){s=e;break}o.push(c);let r=a[c]??n.getRow(c,!0);if(!sa(r)){s=!1;break}c=r.parentId}return o.forEach(e=>t.set(e,s)),s}function pa(e,t){let n=t.table.getCoreRowModel().rowsById,r=t.parentId;for(;r!==void 0;)delete e[r],r=(n[r]??t.table.getRow(r,!0)).parentId}function ma(e,t,n,r){let i=[];for(let a=0;a<e.length;a++){let o=e[a],s=ga(o,t);if(s&&(n.push(o),r[o.id]=o),o.subRows.length){let e=ma(o.subRows,t,n,r);if(s){let t=Object.create(Object.getPrototypeOf(o));dn(t,o),t.subRows=e,i.push(t)}}else s&&i.push(o)}return i}function ha(e,t){let n=[],r=z(),i=t.atoms.rowSelection?.get()??{};return{rows:ma(e.rows,i,n,r),flatRows:n,rowsById:r}}function ga(e,t){return!!(B(t,e.id)&&t[e.id])}function _a(e){if(!e.subRows.length)return!1;let t=e.table.atoms.rowSelection?.get()??{},n=!1,r=!0,i=!1;for(let a=0;a<e.subRows.length;a++){let o=e.subRows[a];if(n&&!r)break;if(Q(o)&&(i=!0,ga(o,t)?n=!0:r=!1),o.subRows.length){let e=_a(o);e===`all`?(n=!0,i=!0):e===`some`?(n=!0,r=!1,i=!0):r=!1}}return i?r?`all`:n?`some`:!1:!1}var va={initTableInstanceData:e=>{e._lastSelectedRowId=null},resetTableInstanceData:e=>{e._lastSelectedRowId=null},getInitialState:e=>({rowSelection:Vi(),...e}),getDefaultTableOptions:e=>({onRowSelectionChange:V(`rowSelection`,e),enableRowSelection:!0,enableMultiRowSelection:!0,enableRowRangeSelection:!0,enableSubRowSelection:!0,isRowRangeSelectionEvent:e=>{let t=e;return!!(t.shiftKey||t.nativeEvent?.shiftKey)}}),assignRowPrototype:(e,t)=>{K(`rowSelectionFeature`,e,t,{row_toggleSelected:{fn:(e,t,n)=>ra(e,t,n)},row_getIsSelected:{fn:e=>ia(e)},row_getIsSomeSelected:{fn:e=>aa(e),memoDeps:e=>[e.subRows,e.table.atoms.rowSelection?.get(),e.table.options.enableRowSelection]},row_getIsAllSubRowsSelected:{fn:e=>oa(e),memoDeps:e=>[e.subRows,e.table.atoms.rowSelection?.get(),e.table.options.enableRowSelection]},row_getCanSelect:{fn:e=>Q(e)},row_getCanSelectSubRows:{fn:e=>sa(e)},row_getCanMultiSelect:{fn:e=>ca(e)},row_getToggleSelectedHandler:{fn:(e,t)=>la(e,t)}})},constructTableAPIs:e=>{G(`rowSelectionFeature`,e,{table_setRowSelection:{fn:t=>Hi(e,t)},table_resetRowSelection:{fn:t=>Ui(e,t)},table_toggleAllRowsSelected:{fn:(t,n)=>Wi(e,t,n)},table_toggleAllPageRowsSelected:{fn:(t,n)=>Gi(e,t,n)},table_getPreSelectedRowModel:{fn:()=>Ki(e)},table_getSelectedRowModel:{fn:()=>qi(e),memoDeps:()=>[e.atoms.rowSelection?.get(),e.getCoreRowModel()]},table_getFilteredSelectedRowModel:{fn:()=>Ji(e),memoDeps:()=>[e.atoms.rowSelection?.get(),e.getFilteredRowModel()]},table_getGroupedSelectedRowModel:{fn:()=>Yi(e),memoDeps:()=>[e.atoms.rowSelection?.get(),e.getSortedRowModel()]},table_getSelectedRowIds:{fn:()=>Xi(e),memoDeps:()=>[e.atoms.rowSelection?.get()]},table_getIsAllRowsSelected:{fn:()=>Zi(e),memoDeps:()=>[e.atoms.rowSelection?.get(),e.getFilteredRowModel(),e.options.enableRowSelection,e.options.enableSubRowSelection]},table_getIsAllPageRowsSelected:{fn:()=>Qi(e),memoDeps:()=>[e.atoms.rowSelection?.get(),e.getPaginatedRowModel(),e.options.enableRowSelection,e.options.enableSubRowSelection]},table_getIsSomeRowsSelected:{fn:()=>$i(e),memoDeps:()=>[e.atoms.rowSelection?.get()]},table_getIsSomePageRowsSelected:{fn:()=>ea(e),memoDeps:()=>[e.atoms.rowSelection?.get(),e.getPaginatedRowModel(),e.options.enableRowSelection]},table_getToggleAllRowsSelectedHandler:{fn:()=>ta(e)},table_getToggleAllPageRowsSelectedHandler:{fn:()=>na(e)}})}},ya=typeof window>`u`?I.useEffect:I.useLayoutEffect;function ba(e,t){let[{table:n,rootSource:r}]=(0,I.useState)(()=>{let t=Yr({...e,features:{coreReactivityFeature:ln(),...e.features}});return t.Subscribe=(e=>an({...e,source:e.source??t.store})),t.FlexRender=rn,{table:t,rootSource:cn(t.store,F)}}),i=n;Gr(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=Je(r,t,{compare:F});return ya(()=>{r.markCommitted(o),Hr(i,a??null,F)}),(0,I.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}var $=f();function xa(e,t){let[n,...r]=e.map(t),i=JSON.stringify(n);return{value:n,mixed:r.some(e=>JSON.stringify(e)!==i)}}var Sa=`max-sm:hidden`,Ca=100;function wa({selected:e,total:n,collection:r,onClear:i}){let a=pe(`bulk_update_tickets`),o=pe(`bulk_delete_tickets`),s=De(),[c,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(null),m=e[0]?.projectId,h=_e(m??``,!!m),g=yt(m);if(!m)return null;let _=e.map(e=>({ticketId:e.id,expectedVersion:e.version}));async function v(e){u(!0);try{await e()}catch(e){throw await s.invalidateQueries({queryKey:[`kanvil`]}),e}finally{u(!1)}}let ee=e=>v(async()=>{for(let t=0;t<_.length;t+=Ca)await a.mutateAsync({projectId:m,tickets:_.slice(t,t+Ca),changes:e}).catch(e=>{throw t&&re.warning(l(`ticket.selection.partlyApplied`,{done:t,count:_.length})),e})});function te(t,n){c||ee(t).then(()=>{re.success(l(`ticket.selection.applied`,{label:n,count:e.length})),i()}).catch(Ee)}let x=e.every(e=>e.status===`backlog`&&!e.archived),ae=e.every(e=>e.archived),oe=xa(e,e=>e.labels.toSorted()),ce=xa(e,e=>e.dueAt);return(0,$.jsx)(`div`,{className:`pointer-events-none fixed right-4 bottom-4 z-40 w-[100cqw] max-w-none md:right-10`,children:(0,$.jsxs)(`div`,{className:`pointer-events-auto mx-auto flex w-fit max-w-full flex-wrap items-center justify-center gap-1 rounded-xl border bg-popover p-1.5 text-popover-foreground shadow-lg animate-in fade-in-0 slide-in-from-bottom-4 duration-200`,role:`region`,"aria-label":l(`ticket.selection.region`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 pr-1`,children:[(0,$.jsx)(b,{label:l(`ticket.selection.clear`),size:`icon-sm`,disabled:c,onClick:i,children:(0,$.jsx)(p,{})}),(0,$.jsx)(`span`,{className:`text-xs font-medium whitespace-nowrap tabular-nums`,role:`status`,children:e.length===n?l(`ticket.selection.selected`,{count:e.length}):(0,$.jsx)(Ne,{i18nKey:`ticket.selection.selectedOf`,count:e.length,values:{total:n},components:{wide:(0,$.jsx)(`span`,{className:Sa})}})}),c&&(0,$.jsx)(me,{className:`size-3.5`})]}),(0,$.jsx)(ye,{orientation:`vertical`,className:`hidden h-5! sm:block`}),wt.map(t=>{let n=Dt[t],{value:r,mixed:i}=xa(e,e=>N(e,t));return(0,$.jsxs)(Mt,{property:t,projectId:m,value:r,mixed:i,disabled:c,align:`end`,onChange:e=>te(mt(t,e),jt[t]),children:[(0,$.jsx)(n,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:Sa,children:jt[t]})]},t)}),(0,$.jsx)(vt,{replace:!0,value:oe.value,mixed:oe.mixed,disabled:c,textClassName:Sa,onChange:e=>te({labels:e},l(`ticket.tags.labels`))}),(0,$.jsx)(xt,{variant:`pill`,label:l(`ticket.date.due`),placeholder:ce.mixed?l(`ticket.selection.mixedDue`):l(`ticket.date.due`),value:!ce.mixed&&ce.value?new Date(ce.value):null,mixed:ce.mixed,disabled:c,textClassName:Sa,onChange:e=>te({dueAt:e?Lt(e):null},l(`ticket.date.due`))}),!!g.data?.length&&(0,$.jsxs)(ne,{children:[(0,$.jsxs)(y,{disabled:c,render:(0,$.jsx)(S,{variant:`ghost`,size:`sm`,className:`h-7 px-2`,"aria-label":l(`ticket.selection.fields`)}),children:[(0,$.jsx)(Et,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:Sa,children:l(`ticket.selection.fields`)})]}),(0,$.jsx)(ie,{align:`end`,className:`w-[min(22rem,calc(100vw-2rem))] gap-1 p-2`,children:g.data.map(t=>{let{value:n,mixed:r}=xa(e,e=>e.customFields[t.id]??null);return(0,$.jsx)(dt,{variant:`row`,field:t,value:n,mixed:r,disabled:c,align:`end`,onChange:e=>te({customFields:{[t.id]:e}},t.name)},t.id)})})]}),(0,$.jsx)(ye,{orientation:`vertical`,className:`hidden h-5! sm:block`}),(0,$.jsxs)(He,{children:[(0,$.jsx)(kt,{render:(0,$.jsx)(b,{label:l(`ticket.selection.more`),disabled:c}),children:(0,$.jsx)(Le,{})}),(0,$.jsxs)(ct,{align:`end`,className:`w-52`,children:[x&&(0,$.jsxs)(st,{onClick:()=>te({status:`todo`},t.todo),children:[(0,$.jsx)(Xt,{}),l(`ticket.selection.moveTo`,{status:t.todo})]}),ae?(0,$.jsxs)(st,{onClick:()=>te({archived:!1},l(`ticket.selection.restoreChange`)),children:[(0,$.jsx)(E,{}),l(`ticket.selection.restore`)]}):(0,$.jsxs)(st,{onClick:()=>f(`archive`),children:[(0,$.jsx)(Me,{}),l(`ticket.selection.archive`)]}),h.canDelete&&(0,$.jsxs)(st,{variant:`destructive`,disabled:e.length>Ca,onClick:()=>f(`delete`),children:[(0,$.jsx)(Fe,{}),e.length>Ca?l(`ticket.selection.deleteLimit`,{limit:Ca}):l(`ticket.selection.delete`)]})]})]}),(0,$.jsx)(se,{label:l(`ticket.selection.archive`),trigger:!1,open:d===`archive`,onOpenChange:e=>f(e?`archive`:null),description:l(`ticket.selection.archiveConfirm`,{count:e.length,collection:r}),onConfirm:async()=>{await ee({archived:!0}),i()}}),(0,$.jsx)(se,{danger:!0,label:l(`ticket.selection.delete`),trigger:!1,open:d===`delete`,onOpenChange:e=>f(e?`delete`:null),description:l(`ticket.selection.deleteConfirm`,{count:e.length,collection:r}),onConfirm:()=>v(async()=>{await o.mutateAsync({projectId:m,tickets:_}),re.success(l(`ticket.selection.deleted`,{count:e.length})),i()})})]})})}var Ta=42,Ea=14,Da=3;function Oa(e,t,n){if(e===`calendar`)return{from:D(A(t),{weekStartsOn:n}),to:k(O(Ke(et(t),{weekStartsOn:n})),1)};let r=D(t,{weekStartsOn:n});return{from:r,to:k(r,Ta)}}var ka=(e,t,n)=>e===`calendar`?zt(t,n):k(t,n*Ea);function Aa(e){let t=e.startAt??e.dueAt,n=e.dueAt??e.startAt;return t&&n?{start:O(new Date(t)),end:O(new Date(n))}:null}var ja=()=>u({dateStyle:`full`}),Ma=()=>u({dateStyle:`medium`}),Na=()=>u({month:`long`,year:`numeric`}),Pa=()=>u({weekday:`long`}),Fa=()=>u({weekday:`short`}),Ia=()=>u({weekday:`narrow`}),La=()=>u({month:`short`}),Ra=e=>e+2,za=({start:e,end:t})=>e.getTime()===t.getTime()?Ma().format(e):l(`ticket.schedule.range`,{from:Ma().format(e),to:Ma().format(t)});function Ba({layout:e,tickets:t,anchor:n,range:r,onAnchor:i}){let[a]=(0,I.useState)(tt),o=t.flatMap(e=>{let t=Aa(e);return t&&t.end>=r.from&&t.start<r.to?[{ticket:e,...t}]:[]}).toSorted((e,t)=>e.start.getTime()-t.start.getTime()||e.ticket.number-t.ticket.number),s=k(r.to,-1),c=e===`calendar`?Na().format(n):l(`ticket.schedule.range`,{from:Ma().format(r.from),to:Ma().format(s)}),u=e===`calendar`;return(0,$.jsxs)(`section`,{"aria-label":l(u?`ticket.schedule.calendar`:`ticket.schedule.timeline`),className:`@container flex min-h-0 flex-1 flex-col animate-in fade-in-0`,children:[(0,$.jsxs)(`div`,{className:`flex min-h-11 items-center gap-1 py-1`,children:[(0,$.jsx)(`h2`,{className:`m-0 mr-auto text-sm font-medium`,"aria-live":`polite`,children:c}),(0,$.jsx)(S,{variant:`ghost`,size:`sm`,onClick:()=>i(null),children:l(`ticket.schedule.today`)}),(0,$.jsx)(b,{label:l(u?`ticket.schedule.previousMonth`:`ticket.schedule.previousWeeks`),onClick:()=>i(ka(e,n,-1)),children:(0,$.jsx)(ft,{})}),(0,$.jsx)(b,{label:l(u?`ticket.schedule.nextMonth`:`ticket.schedule.nextWeeks`),onClick:()=>i(ka(e,n,1)),children:(0,$.jsx)(bt,{})})]}),u?(0,$.jsx)(Ha,{spans:o,anchor:n,range:r,title:c,today:a}):o.length?(0,$.jsx)(Wa,{spans:o,range:r,today:a}):(0,$.jsx)(g,{title:l(`ticket.schedule.emptyWeeks`)})]})}function Va({ticket:e,wrap:t=!1}){return(0,$.jsxs)(ht,{projectId:e.projectId,ticketId:e.id,className:w(`flex min-w-0 items-baseline gap-1.5 rounded-sm px-1 text-[11.5px] leading-5 hover:bg-muted`,!t&&`truncate`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:w(`size-1.5 shrink-0 rounded-full bg-current`,t?`mt-[7px] self-start`:`self-center`,ge(e.status))}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-[10.5px] text-muted-foreground`,children:e.key}),(0,$.jsx)(`span`,{dir:`auto`,className:w(`min-w-0`,t?`wrap-anywhere`:`truncate`),children:e.title})]})}function Ha({spans:e,anchor:t,range:n,title:r,today:i}){let a=Array.from({length:ze(n.to,n.from)},(e,t)=>k(n.from,t)),o=Array.from({length:a.length/7},(e,t)=>a.slice(t*7,t*7+7));return(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto overscroll-contain pb-4`,children:(0,$.jsxs)(`table`,{className:`w-full table-fixed border-collapse`,"aria-label":l(`ticket.schedule.monthTickets`,{title:r}),children:[(0,$.jsx)(`thead`,{className:`sticky top-0 z-10 bg-background`,children:(0,$.jsx)(`tr`,{children:(o[0]??[]).map(e=>(0,$.jsx)(`th`,{scope:`col`,className:`h-8 px-2 text-left text-[10.5px] font-medium tracking-[0.08em] text-muted-foreground uppercase`,children:(0,$.jsxs)(`abbr`,{title:Pa().format(e),className:`no-underline`,children:[(0,$.jsx)(`span`,{className:`@max-[600px]:hidden`,children:Fa().format(e)}),(0,$.jsx)(`span`,{className:`@min-[601px]:hidden`,children:Ia().format(e)})]})},e.getDay()))})}),(0,$.jsx)(`tbody`,{children:o.map(n=>(0,$.jsx)(`tr`,{children:n.map(n=>(0,$.jsx)(Ua,{day:n,outside:!it(n,t),today:at(n,i),spans:e.filter(e=>e.start<=n&&n<=e.end)},n.toISOString()))},n[0]?.toISOString()))})]})})}function Ua({day:e,outside:t,today:n,spans:r}){let i=r.length-Da,a=ja().format(e);return(0,$.jsxs)(`td`,{className:w(`h-28 border border-border p-1 align-top @max-[600px]:h-16`,t&&`bg-muted/40 text-muted-foreground`),children:[(0,$.jsx)(`time`,{dateTime:Be(e,`yyyy-MM-dd`),"aria-label":a,"aria-current":n?`date`:void 0,className:w(`mb-0.5 grid size-6 place-items-center rounded-full text-xs tabular-nums`,n&&`bg-primary font-medium text-primary-foreground`),children:e.getDate()}),r.length>0&&(0,$.jsx)(`ul`,{className:`m-0 grid list-none gap-px p-0 @max-[600px]:hidden`,children:r.slice(0,Da).map(({ticket:e})=>(0,$.jsx)(`li`,{className:`min-w-0`,children:(0,$.jsx)(Va,{ticket:e})},e.id))}),r.length>0&&(0,$.jsxs)(ne,{children:[(0,$.jsxs)(y,{render:(0,$.jsx)(S,{variant:`ghost`,size:`sm`,"aria-label":l(`ticket.schedule.showDay`,{count:r.length,day:a}),className:w(`h-6 px-1 text-[11px] text-muted-foreground`,i<=0&&`@min-[601px]:hidden`)}),children:[(0,$.jsx)(`span`,{className:`@max-[600px]:hidden`,children:l(`ticket.schedule.more`,{count:i})}),(0,$.jsx)(`span`,{className:`@min-[601px]:hidden`,children:r.length})]}),(0,$.jsxs)(ie,{align:`start`,className:`w-[min(20rem,calc(100vw-2rem))] gap-2 p-3`,children:[(0,$.jsx)(h,{className:`text-xs font-medium`,children:a}),(0,$.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:r.map(({ticket:e})=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Va,{ticket:e,wrap:!0})},e.id))})]})]})]})}function Wa({spans:e,range:t,today:n}){let r=ze(t.to,t.from),i=Array.from({length:r},(e,n)=>k(t.from,n)),a=ze(n,t.from);return(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto overscroll-contain pb-4`,children:(0,$.jsxs)(`div`,{className:`grid min-w-max [--rail:18rem] @max-[600px]:[--rail:9rem]`,style:{gridTemplateColumns:`var(--rail) repeat(${r}, 2rem)`},children:[(0,$.jsxs)(`div`,{"aria-hidden":`true`,className:`sticky top-0 z-20 col-span-full grid grid-cols-subgrid`,children:[(0,$.jsx)(`div`,{className:`sticky left-0 z-10 flex items-end border-b bg-background px-3 pb-1 text-[10.5px] font-medium tracking-[0.08em] text-muted-foreground uppercase`,children:l(`ticket.schedule.ticketColumn`)}),i.map((e,t)=>(0,$.jsxs)(`div`,{className:w(`flex flex-col items-center border-b bg-background pt-1 pb-1 text-[10.5px] leading-4 tabular-nums text-muted-foreground`,t===a&&`text-primary`),children:[(0,$.jsx)(`span`,{className:`h-4 font-medium text-foreground`,children:t===0||e.getDate()===1?La().format(e):``}),(0,$.jsx)(`span`,{children:Ia().format(e)}),(0,$.jsx)(`span`,{className:w(`grid size-5 place-items-center rounded-full`,t===a&&`bg-primary text-primary-foreground`),children:e.getDate()})]},e.toISOString()))]}),(0,$.jsx)(`ul`,{"aria-label":l(`ticket.schedule.scheduledTickets`),className:`col-span-full m-0 grid list-none grid-cols-subgrid p-0`,children:e.map(e=>{let n=Math.max(0,ze(e.start,t.from)),i=Math.min(r-1,ze(e.end,t.from));return(0,$.jsxs)(`li`,{className:`col-span-full grid grid-cols-subgrid border-b`,children:[(0,$.jsxs)(`div`,{className:`sticky left-0 z-10 row-start-1 bg-background px-2 py-1.5 [grid-column:1]`,children:[(0,$.jsx)(Va,{ticket:e.ticket,wrap:!0}),(0,$.jsxs)(`span`,{className:`sr-only`,children:[`, `,za(e)]})]}),a>=0&&a<r&&(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`row-start-1 bg-primary/8`,style:{gridColumn:Ra(a)}}),(0,$.jsx)(`div`,{"aria-hidden":`true`,title:za(e),className:w(`row-start-1 mx-0.5 h-5 self-center rounded-md border border-current/60 bg-current/25`,ge(e.ticket.status),e.start<t.from&&`ml-0 rounded-l-none border-l-0`,e.end>=t.to&&`mr-0 rounded-r-none border-r-0`),style:{gridColumn:`${Ra(n)} / ${Ra(i)+1}`}})]},e.ticket.id)})})]})})}var Ga=qr({columnSizingFeature:Ti,columnResizingFeature:wi,rowSelectionFeature:va,columnVisibilityFeature:Bi}),Ka=100;function qa({section:e,collapsed:t,onToggle:n,selection:r}){return(0,$.jsxs)(`div`,{className:`flex items-center`,children:[r&&(0,$.jsx)(`div`,{className:`flex w-11 shrink-0 justify-center pl-3 @max-[850px]:w-8 @max-[850px]:justify-start @max-[850px]:pl-0`,children:(0,$.jsx)(m,{label:l(`ticket.list.selectSection`,{section:e.label}),className:`sr-checkbox`,...r})}),(0,$.jsxs)(S,{variant:`ghost`,className:`flex-1 justify-start gap-2 rounded-none px-3`,"aria-label":l(t?`ticket.list.expandSection`:`ticket.list.collapseSection`,{section:e.label}),"aria-expanded":!t,onClick:n,children:[(0,$.jsx)(ce,{className:w(`size-3 transition-transform duration-200`,t&&`-rotate-90`)}),e.heading,(0,$.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.total})]})]})}var Ja=[[`overdue`,0],[`today`,864e5],[`week`,6048e5],[`later`,1/0]],Ya=e=>e===`later`?l(`ticket.list.later`):c[e];function Xa(e,t){if(!e.dueAt)return`none`;let n=new Date(e.dueAt).getTime()-t;return Ja.find(([,e])=>n<e)?.[0]??`later`}function Za({ticket:e,property:t,value:n,iconOnly:r=!1}){let i=_e(e.projectId),{change:a,pending:o}=Ot(e);return i.canWrite?(0,$.jsx)(Mt,{variant:`cell`,property:t,value:n,projectId:e.projectId,iconOnly:r,disabled:o,onChange:e=>void a({[t]:e})}):(0,$.jsx)(Ve,{...At(t,n),projectId:e.projectId,iconOnly:r})}var Qa=()=>[{id:`select`,size:44,enableResizing:!1,enableHiding:!1,header:({table:e})=>(0,$.jsx)(m,{label:l(`ticket.list.selectAll`),className:`sr-checkbox`,checked:e.getIsAllRowsSelected(),indeterminate:e.getIsSomeRowsSelected()&&!e.getIsAllRowsSelected(),onCheckedChange:t=>e.toggleAllRowsSelected(t)}),cell:({row:e})=>(0,$.jsx)(m,{label:l(`ticket.list.selectTicket`,{key:e.original.key}),className:`sr-checkbox`,checked:e.getIsSelected(),onCheckedChange:t=>e.toggleSelected(t)})},{accessorKey:`key`,header:C.key,size:100,minSize:90},{accessorKey:`title`,header:l(`ticket.list.title`),size:400,enableHiding:!1,minSize:200,cell:({row:e})=>(0,$.jsx)(Xe,{dir:`auto`,className:`ticket-title block text-[13px] leading-5 font-normal whitespace-normal wrap-anywhere text-foreground hover:text-primary`,to:`/projects/$projectId/tickets/$ticketId`,params:{projectId:e.original.projectId,ticketId:e.original.id},children:e.original.title})},...[`labels`,`scopes`].map(e=>({accessorKey:e,header:C[e],size:140,minSize:120,cell:({row:t})=>(0,$.jsx)(je,{tags:t.original[e],label:l(e===`labels`?`ticket.tags.labels`:`ticket.tags.scopes`),variant:e===`labels`?`secondary`:`outline`})})),{accessorKey:`status`,header:C.status,size:115,minSize:105,cell:({row:e})=>(0,$.jsx)(Za,{ticket:e.original,property:`status`,value:_t(e.original)})},{accessorKey:`priority`,header:C.priority,size:96,minSize:64,cell:({row:e})=>(0,$.jsx)(Za,{ticket:e.original,property:`priority`,value:e.original.priority,iconOnly:!0})},{accessorKey:`difficulty`,header:C.difficulty,size:106,minSize:85,cell:({row:e})=>(0,$.jsx)(Za,{ticket:e.original,property:`difficulty`,value:e.original.difficulty})},{accessorKey:`kind`,header:C.kind,size:110,cell:({row:e})=>(0,$.jsx)(Za,{ticket:e.original,property:`kind`,value:e.original.kind})},{accessorKey:`assigneeId`,header:C.assigneeId,size:160,cell:({row:e})=>(0,$.jsx)(Za,{ticket:e.original,property:`assignee`,value:e.original.assigneeId})},{accessorKey:`startAt`,header:C.startAt,size:100,minSize:90,cell:({row:e})=>(0,$.jsx)(le,{value:e.original.startAt,open:!1})},{accessorKey:`dueAt`,header:C.dueAt,size:100,minSize:90,cell:({row:e})=>(0,$.jsx)(le,{value:e.original.dueAt,open:!s.some(t=>t===e.original.status)})}],$a=()=>[`createdAt`,`updatedAt`].map(e=>({accessorKey:e,header:C[e],size:130,cell:({row:t})=>(0,$.jsx)(T,{value:t.original[e],className:`text-muted-foreground`})}));function eo({ticket:e,field:t}){let n=_e(e.projectId),{change:r,pending:i}=Ot(e),a=e.customFields[t.id];return n.canWrite?(0,$.jsx)(dt,{variant:`cell`,field:t,value:a,disabled:i,onChange:e=>void r({customFields:{[t.id]:e}})}):a===void 0?null:(0,$.jsx)(j,{field:t,value:a})}var to=e=>({id:he(e.id),header:()=>(0,$.jsx)(`span`,{className:`block truncate px-3 text-[10.5px] font-medium tracking-[0.08em] text-muted-foreground uppercase`,children:e.name}),size:140,minSize:90,cell:({row:t})=>(0,$.jsx)(eo,{ticket:t.original,field:e})}),no={key:`number`,title:`title`,labels:`labels`,status:`status`,priority:`priority`,difficulty:`difficulty`,kind:`kind`,assigneeId:`assignee`,startAt:`start`,dueAt:`due`,createdAt:`created`,updatedAt:`updated`},ro=(e,t)=>t===(t.includes(`:`)?_t(e):e.status),io=()=>({id:`all`,label:l(`ticket.list.all`),heading:null,has:()=>!0}),ao=()=>[{id:`planned`,label:l(`ticket.list.planned`),heading:(0,$.jsx)(`span`,{className:`text-xs`,children:l(`ticket.list.planned`)}),status:`backlog`,archived:`exclude`,has:e=>!e.archived&&e.status===`backlog`},{id:`archived`,label:l(`ticket.list.archived`),heading:(0,$.jsx)(`span`,{className:`text-xs`,children:l(`ticket.list.archived`)}),archived:`only`,has:e=>e.archived}],oo=`a, button, input, label, [role=checkbox], [role=combobox], [role=menu]`,so=`ticket-row cursor-pointer data-[fresh=true]:animate-row-in data-[selected=true]:bg-primary/5 data-[active=true]:bg-muted/60`,co=`data-[density=comfortable]:[&_[data-priority]_svg]:size-5! data-[density=comfortable]:[&_[data-slot=badge]]:h-6 data-[density=comfortable]:[&_[data-slot=badge]]:px-2 data-[density=comfortable]:[&_[data-slot=badge]]:text-xs data-[density=comfortable]:[&_.status]:text-sm data-[density=comfortable]:[&_[data-slot=checkbox]]:size-5 data-[density=comfortable]:[&_.ticket-title]:text-[15px] data-[density=comfortable]:[&_.ticket-title]:leading-6`,lo=`min-w-full table-fixed @min-[1051px]:w-(--table-width)`;function uo({leaves:e}){return(0,$.jsx)(`colgroup`,{children:e.map(e=>(0,$.jsx)(`col`,{"data-column":e.id,style:{width:e.getSize()}},e.id))})}function fo({scope:e,search:n,onSearch:s}){let{peek:c,peekProject:u,period:f,...p}=n,h=`project`in e?e.project:void 0,_=_e(h?.id??``,!!h),y=!!h&&_.canWrite,ne=Te(),ie=ee(),le=ut(),[me]=We(M.grouping),[ge]=We(M.workGrouping),[C]=We(M.layout),[ye]=We(M.backgrounds),T=`project`in e&&!!e.planning,je=!!h&&!T&&C===`board`,E=h&&!T&&(C===`calendar`||C===`timeline`)?C:void 0,[Me]=We(M.weekStart),Ne=f?nt(f):void 0,Le=Ne&&Re(Ne)?Ne:tt(),D=E?Oa(E,Le,Ft[Me]):void 0,O=T?`planning`:je?`status`:E?`none`:h?me:ge,[ze]=We(M.labelDisplay),[k]=We(M.density),[Ke,Je]=We(M.columns),A=JSON.stringify({...p,offset:0,grouping:O,range:D}),[Qe,et]=(0,I.useState)({filterKey:A,pages:{}}),[it,at]=(0,I.useState)(()=>new Set),[j,dt]=(0,I.useState)(),ft=Qe.filterKey===A?Qe.pages:{},ht=Tt(h?.id??``),N=ht.data??[],vt=!!h&&O===`status`&&ht.isPending,bt=O===`planning`?ao().filter(e=>!e.status||ve(p,`status`,e.status)):vt?[]:O===`status`&&h&&N.length?N.filter(e=>ve(p,`status`,e.category)).map(e=>({id:e.id,label:e.name,heading:(0,$.jsx)(Ve,{property:`status`,value:Nt(e),projectId:h.id}),status:e.category,stateId:e.id,has:t=>t.stateId===e.id})):O===`status`?d.filter(e=>ve(p,`status`,e)).map(e=>({id:e,label:t[e],heading:(0,$.jsx)(we,{property:`status`,value:e}),status:e,has:t=>t.status===e})):[io()],xt=bt.flatMap(e=>Array.from({length:ft[e.id]??1},(t,n)=>({entry:e,offset:n*Ka}))),wt=Oe({queries:xt.map(({entry:t,offset:n})=>h?v.query(`list_tickets`,{projectId:h.id,...p,...t.status?{status:t.status,statusNot:void 0}:{},...t.stateId?{stateId:t.stateId}:{},...D?{scheduledFrom:D.from.toISOString(),scheduledTo:D.to.toISOString(),sort:`start`,order:`asc`}:{},archived:t.archived??p.archived,offset:n,limit:Ka}):v.query(`list_my_work`,{workspaceId:`workspaceId`in e?e.workspaceId:void 0,q:p.q,sort:p.sort,order:p.order,offset:n,limit:Ka}))}),Et=bt.map(e=>({entry:e,data:{items:xt.flatMap((t,n)=>t.entry.id===e.id?wt[n]?.data?.items??[]:[]),total:wt[xt.findIndex(t=>t.entry.id===e.id)]?.data?.total??0}})),Dt=Object.fromEntries(Et.map(e=>[e.entry.id,Math.max(1,Math.ceil(e.data.total/Ka))])),Ot=bt.some(e=>(ft[e.id]??1)<(Dt[e.id]??1));Ot&&et({filterKey:A,pages:Dt});let P=new Map;for(let e of Et)for(let t of e.data?.items??[]){let e=P.get(t.id);(!e||t.version>e.version)&&P.set(t.id,t)}let At=j&&P.get(j.id);j?.status&&At&&P.set(At.id,{...At,...mt(`status`,j.status)});let jt=vt||Ot||wt.some(e=>e.isPending),Mt=[...P.keys()].join(`
|
|
2
|
-
`),[Lt,zt]=(0,I.useState)({filterKey:A,ids:null,fresh:new Set});if(Lt.filterKey!==A)zt({filterKey:A,ids:null,fresh:new Set});else if(Lt.ids===null)jt||zt({filterKey:A,ids:Mt,fresh:new Set});else if(Lt.ids!==Mt){let e=new Set(Lt.ids.split(`
|
|
3
|
-
`));zt({filterKey:A,ids:Mt,fresh:new Set([...P.keys()].filter(t=>!e.has(t)))})}let qt=j?.anchor?Ge([...P.values()],j.id,j.anchor,!!j.below):[...P.values()],Yt=Et.reduce((e,t)=>e+(t.data?.total??0),0),[Xt,Zt]=(0,I.useState)(()=>Date.now());(0,I.useEffect)(()=>{let e=window.setInterval(()=>{O===`due`&&Zt(Date.now())},6e4);return()=>window.clearInterval(e)},[O]);let F=O===`project`?[...new Set(qt.map(e=>e.projectId))].map(e=>({id:e,owner:ne.data?.find(t=>t.id===e)})).toSorted((e,t)=>(e.owner?.name??``).localeCompare(t.owner?.name??``)).map(({id:e,owner:t})=>({id:e,label:t?.name??l(`ticket.project.label`),heading:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-xs`,children:[t&&(0,$.jsx)(Ae,{project:t,className:`size-4`}),(0,$.jsx)(`span`,{dir:t?`auto`:void 0,className:`truncate`,children:t?.name??l(`ticket.project.label`)})]}),total:qt.filter(t=>t.projectId===e).length,has:t=>t.projectId===e})):O===`due`?[...Ja.map(([e])=>e),`none`].flatMap(e=>{let t=qt.filter(t=>Xa(t,Xt)===e).length,n=Ya(e);return t?[{id:e,label:n,heading:(0,$.jsx)(`span`,{className:`text-xs`,children:n}),total:t,has:t=>Xa(t,Xt)===e}]:[]}):Et.flatMap(({entry:{id:e,label:t,heading:n,has:r},data:i})=>i.total>0||je?[{id:e,label:t,heading:n,has:r,total:i.total}]:[]),$t=O!==`none`,en=e=>$t&&!je&&it.has(e),L={isPending:jt,error:wt.find(e=>e.error)?.error,data:{items:qt.filter(e=>!F.some(t=>en(t.id)&&t.has(e))),total:Yt}},tn=Ce({...v.query(`list_views`,{projectId:h?.id??``}),enabled:!!h}),nn=pe(`save_view`),rn=pe(`delete_view`),[an,on]=(0,I.useState)(!1),[sn,cn]=(0,I.useState)(``),[ln,un]=(0,I.useState)(!1),[R,dn]=(0,I.useState)(null),z=xe(p),B=z===xe({}),V=tn.data?.find(e=>xe(e.filters)===z),fn=V?.name??l(B?`ticket.list.allTickets`:`ticket.list.customView`),pn=yt(h?.id),H=ba({features:Ga,columns:[...Qa(),...(pn.data??[]).map(to),...$a()],data:L.data?.items??[],getRowId:e=>e.id,columnResizeMode:`onChange`,enableRowSelection:y,state:{columnVisibility:{...Object.fromEntries((pn.data??[]).map(e=>[he(e.id),!1])),...Ke,title:!0,select:y}},onColumnVisibilityChange:e=>Je(typeof e==`function`?e(Ke):e)}),mn=H.getSelectedRowModel().rows.map(e=>e.original),U=e=>H.getRowModel().rows.filter(t=>e.has(t.original)),W=F.flatMap(e=>en(e.id)?[]:U(e).map(e=>e.id)),hn=W.join(`
|
|
4
|
-
`),gn=e=>{let t=U(e),n=t.filter(e=>e.getIsSelected()).length;return{checked:n>0&&n===t.length,indeterminate:n>0&&n<t.length,disabled:!t.length,onCheckedChange:e=>H.setRowSelection(n=>{let r={...n};for(let n of t)e?r[n.id]=!0:delete r[n.id];return r})}},_n=$t?a(F.flatMap(e=>{let t=mn.filter(e.has).length;return t?[l(`ticket.list.sectionCount`,{n:t,section:e.label})]:[]})):``,vn=h&&(T?l(`ticket.list.planning`,{project:h.name}):h.name),yn=vn?_n?l(`ticket.list.collection`,{source:vn,sections:_n}):vn:``;(0,I.useEffect)(()=>{!jt&&h&&$e(h.id,hn?hn.split(`
|
|
5
|
-
`):[])},[jt,h,hn]);let[G,K]=(0,I.useState)(c??null),[q,bn]=(0,I.useState)(c);c&&c!==q&&(bn(c),K(c));let xn=Pt(),Sn=e=>{K(e),xn?.open({ticketId:e,projectId:h?.id??P.get(e)?.projectId})};Ue(W,Sn,()=>q?document.querySelector(`.ticket-row[data-id="${CSS.escape(q)}"] .ticket-title`):null),(0,I.useEffect)(()=>{G&&document.querySelector(`.ticket-row[data-id="${CSS.escape(G)}"]`)?.scrollIntoView({block:`nearest`})},[G]);let Cn=e=>{if(!W.length)return;let t=G?W.indexOf(G):-1,n=t<0?e>0?0:W.length-1:Math.min(W.length-1,Math.max(0,t+e));K(W[n]??null)},J={enabled:!an&&!c&&!E},wn={...J,guard:e=>!(e.target instanceof Element&&e.target.closest(oo)&&!e.target.closest(`.ticket-row[data-active=true]`))};x(`j`,()=>Cn(1),J),x(`ArrowDown`,()=>Cn(1),wn),x(`k`,()=>Cn(-1),J),x(`ArrowUp`,()=>Cn(-1),wn),x(`Enter`,()=>{let e=G?P.get(G):void 0;e&&le({to:`/projects/$projectId/tickets/$ticketId`,params:{projectId:e.projectId,ticketId:e.id}})},wn),x(` `,()=>{G&&P.has(G)&&Sn(G)},{...J,guard:e=>{let t=e.target instanceof Element&&e.target.closest(oo);return!t||t.matches(`.ticket-row[data-active=true] .ticket-title`)}}),x(`x`,()=>{G&&y&&H.getRowModel().rowsById[G]?.toggleSelected()},J);let Tn=e=>{G&&document.querySelector(`.ticket-row[data-id="${CSS.escape(G)}"] [data-column="${e}"] [role=combobox]`)?.click()};x(`s`,()=>Tn(`status`),J),x(`p`,()=>Tn(`priority`),J),x(`a`,()=>Tn(`assigneeId`),J);let En=e=>{H.resetRowSelection(),at(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Dn=e=>{H.resetRowSelection(),et({filterKey:JSON.stringify({...e,offset:0,grouping:O,range:D}),pages:{}}),s({...e,period:f})};x(`c`,()=>{y&&on(!0)},{enabled:!an});let On=p.sort===`manual`,Y=y&&On,kn=(p.order??r[p.sort])===`desc`,An=pe(`move_ticket`),jn=De(),[Mn,Nn]=(0,I.useState)(``),Pn=(0,I.useRef)(!1),Fn=(0,I.useRef)(Promise.resolve()),In=(0,I.useRef)(new Map),Ln=e=>{let{status:n,stateId:r}=St(e);return N.find(e=>e.id===r)?.name??t[n]},Rn=(e,{anchor:t,below:n=!1,status:r})=>{let i=r&&!ro(e,r)?r:void 0,a=t?P.get(t):void 0;if(!a&&!i)return;let o={id:e.id,below:n,...a?{anchor:a.id}:{},...i?{status:i}:{}};dt(o);let s={key:e.key,neighbor:a?.key,status:i&&Ln(i)};Nn(l(a?i?n?`ticket.list.movedToBelow`:`ticket.list.movedToAbove`:n?`ticket.list.movedBelow`:`ticket.list.movedAbove`:i?`ticket.list.movedTo`:`ticket.list.moved`,s));let c=n!==kn;Fn.current=Fn.current.then(async()=>{let t=await An.mutateAsync({projectId:e.projectId,ticketId:e.id,expectedVersion:Math.max(e.version,In.current.get(e.id)??0),...a?c?{after:a.id}:{before:a.id}:{},...i?mt(`status`,i):{}});In.current.set(t.id,t.version)}).catch(e=>{jn.invalidateQueries({queryKey:[`kanvil`]}),Ee(e)}).finally(()=>dt(e=>e===o?void 0:e))},zn=e=>F.find(t=>t.has(e)),Bn=(e,t)=>{if(t===`previous`||t===`next`){let n=N.length?N.map(Nt):[...d],r=n[n.indexOf(N.length?_t(e):e.status)+(t===`next`?1:-1)];if(!r)return;let i=zn({...e,...mt(`status`,r)}),a=On&&i?U(i).find(t=>t.id!==e.id)?.id:void 0;return{status:r,...a?{anchor:a}:{}}}let n=zn(e);return Y&&n?rt(U(n).map(e=>e.id),e.id,t):void 0},Vn=(e,t)=>{Pn.current=!0,Rn(e,t)},Hn=e=>h?y:o(ne.data?.find(t=>t.id===e.projectId)??{role:null}).includes(`ticket.write`),Un=e=>{let t=G?P.get(G):void 0,n=t&&Hn(t)&&Bn(t,e);t&&n&&Vn(t,n)},Wn=e=>Rt.filter(e=>On||e===`previous`||e===`next`).map(t=>{let n=Bn(e,t);return{command:t,run:n&&(()=>Vn(e,n))}});x(`ArrowUp`,()=>Un(`up`),{...J,alt:!0,shift:!1}),x(`ArrowDown`,()=>Un(`down`),{...J,alt:!0,shift:!1}),x(`ArrowUp`,()=>Un(`top`),{...J,alt:!0,shift:!0}),x(`ArrowDown`,()=>Un(`bottom`),{...J,alt:!0,shift:!0}),x(`[`,()=>Un(`previous`),J),x(`]`,()=>Un(`next`),J),(0,I.useEffect)(()=>{Pn.current&&G&&hn.includes(G)&&(Pn.current=!1,document.querySelector(`.ticket-row[data-id="${CSS.escape(G)}"]`)?.scrollIntoView({block:`nearest`}))},[hn,G]);let X=pt((e,t,n)=>{let r=P.get(e),i=P.get(t);r&&i&&Rn(r,{anchor:t,below:n,...O===`status`&&{status:_t(i)}})}),Gn=e=>{let t=X.dragging?P.get(X.dragging):void 0;return On&&(O===`status`||!t||e.has(t))},[Kn,qn]=(0,I.useState)(null),Jn=e=>{let t=X.dragging?P.get(X.dragging):void 0,n=N.find(t=>t.id===e.id),r=n?Nt(n):d.find(t=>t===e.id);X.end(),qn(null);let i=On?U(e).findLast(e=>e.id!==t?.id)?.id:void 0;t&&r&&Rn(t,{status:r,...i?{anchor:i,below:!0}:{}})},Yn=(e,t)=>{t.defaultPrevented||t.target instanceof Node&&t.currentTarget.contains(t.target)&&(t.target instanceof Element&&t.target.closest(oo)||window.getSelection()?.toString()||le({to:`/projects/$projectId/tickets/$ticketId`,params:{projectId:e.projectId,ticketId:e.id}}))},Xn=!L.error&&L.data.total===0&&(0,$.jsx)(g,{title:!B||p.q?l(`ticket.list.emptyFiltered`):l(T?`ticket.list.emptyPlanning`:h?`ticket.list.emptyProject`:`ticket.list.emptyWork`),children:B?y&&(0,$.jsxs)(S,{variant:`default`,onClick:()=>on(!0),children:[(0,$.jsx)(ke,{}),l(`ticket.list.createFirst`)]}):(0,$.jsx)(S,{onClick:()=>Dn(be.parse({})),children:l(`ticket.filter.clear`)})});return(0,$.jsxs)($.Fragment,{children:[h?.background&&ye===`show`&&(0,$.jsx)(`img`,{src:h.background,alt:``,"aria-hidden":`true`,className:`project-background pointer-events-none absolute inset-0 -z-10 size-full object-cover opacity-15 mask-[linear-gradient(to_bottom,black,transparent_90%)] dark:opacity-20`}),h&&(0,$.jsx)(Pe,{project:h}),(0,$.jsx)(Ie,{projectId:h?.id,archivedFilter:!T,search:p,onSearch:Dn,view:h?T?(0,$.jsxs)(S,{variant:`ghost`,size:`sm`,className:`text-muted-foreground`,render:(0,$.jsx)(Xe,{to:`/projects/$projectId`,params:{projectId:h.id}}),children:[(0,$.jsx)(gt,{}),l(`ticket.list.activeWork`)]}):(0,$.jsxs)(He,{children:[(0,$.jsxs)(kt,{render:(0,$.jsx)(S,{variant:`ghost`,"aria-label":l(`ticket.list.views`),title:fn,className:`max-w-full min-w-0 justify-start`}),children:[(0,$.jsx)(`span`,{className:`truncate`,children:fn}),(0,$.jsx)(ce,{className:`size-3 shrink-0`})]}),(0,$.jsxs)(ct,{align:`start`,className:`max-h-[70dvh] w-60 overflow-y-auto`,children:[(0,$.jsx)(Ye,{children:(0,$.jsx)(lt,{value:V?.id??(B?`all`:`custom`),onValueChange:e=>{let t=tn.data?.find(t=>t.id===e);e===`all`?Dn(be.parse({})):t&&Dn({...t.filters,offset:0})},children:[{id:`all`,name:l(`ticket.list.allTickets`)},...tn.data??[]].map(e=>(0,$.jsx)(qe,{value:e.id,closeOnClick:!0,children:e.name},e.id))})}),(0,$.jsx)(Ze,{}),(0,$.jsxs)(Ye,{children:[y&&!E&&(0,$.jsx)(st,{onClick:()=>H.toggleAllRowsSelected(!H.getIsAllRowsSelected()),children:H.getIsAllRowsSelected()?l(`ticket.selection.clear`):l(`ticket.list.selectAll`)}),(0,$.jsxs)(st,{onClick:()=>un(!0),children:[(0,$.jsx)(Jt,{}),l(`ticket.list.saveCurrentView`)]}),V&&(0,$.jsxs)(st,{onClick:()=>dn(V),children:[(0,$.jsx)(Fe,{}),l(`ticket.list.deleteView`,{name:V.name})]})]})]})]}):null,actions:h&&(0,$.jsxs)($.Fragment,{children:[!T&&(0,$.jsx)(b,{label:l(`ticket.list.planningLink`),render:(0,$.jsx)(Xe,{to:`/projects/$projectId/planning`,params:{projectId:h.id}}),children:(0,$.jsx)(Qt,{})}),(0,$.jsx)(b,{label:l(`ticket.menu.newTicket`),title:l(`ticket.list.newTicketShortcut`,{shortcut:`C`}),variant:`default`,disabled:!y,onClick:()=>on(!0),children:(0,$.jsx)(ke,{})})]}),onReset:()=>{It(ie.id,ot),Dn({...p,sort:`priority`,order:void 0,offset:0})}}),(0,$.jsx)(ae,{title:l(`ticket.list.saveView`),open:ln,onOpenChange:un,busy:nn.isPending,children:(0,$.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),h&&nn.mutateAsync({projectId:h.id,name:sn,filters:i.parse(Object.fromEntries(Object.entries(p).filter(([e])=>e!==`offset`)))}).then(()=>{un(!1),cn(``),re.success(l(`ticket.list.viewSaved`))}).catch(()=>{})},children:[(0,$.jsx)(fe,{label:l(`ticket.list.viewName`),required:!0,maxLength:80,value:sn,onChange:e=>cn(e.target.value)}),(0,$.jsx)(Se,{error:nn.error,pending:nn.isPending,submitLabel:l(`ticket.list.saveView`),onCancel:()=>un(!1)})]})}),R&&(0,$.jsx)(se,{label:l(`ticket.list.deleteView`,{name:R.name}),description:l(`ticket.list.deleteViewConfirm`,{name:R.name}),trigger:!1,open:!0,onOpenChange:e=>{e||dn(null)},onConfirm:async()=>{h&&await rn.mutateAsync({projectId:h.id,viewId:R.id}),dn(null)}}),(0,$.jsx)(te,{error:L.error??rn.error}),y&&mn.length>0&&(0,$.jsx)(wa,{selected:mn,total:W.length,collection:yn,onClear:()=>H.resetRowSelection()}),L.isPending?(0,$.jsx)(de,{}):L.error?(0,$.jsx)(S,{disabled:wt.some(e=>e.isFetching),onClick:()=>{for(let e of wt)e.error&&e.refetch()},children:l(`ticket.list.retry`)}):je?(0,$.jsx)(`div`,{role:`region`,"aria-label":l(`ticket.list.board`),className:w(`ticket-board relative min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain`,co),"data-density":k,"data-label-display":ze,children:Xn||(0,$.jsx)(`div`,{className:`flex min-h-full w-max gap-5 pb-4`,children:F.map(e=>(0,$.jsxs)(`section`,{"aria-label":l(`ticket.list.sectionTickets`,{section:e.label}),"data-status":e.id,"data-drop":Kn===e.id||void 0,className:`flex w-[min(19rem,calc(100vw-3.5rem))] shrink-0 flex-col transition-colors data-[drop=true]:bg-primary/5`,onDragOver:t=>{X.dragging&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,qn(e.id))},onDragLeave:t=>{(!(t.relatedTarget instanceof Node)||!t.currentTarget.contains(t.relatedTarget))&&qn(t=>t===e.id?null:t)},onDrop:t=>{t.preventDefault(),Jn(e)},children:[(0,$.jsxs)(`h2`,{className:`sticky top-0 z-10 mb-0 flex h-9 items-center gap-2 border-b bg-background px-2 text-xs font-normal`,children:[y&&(0,$.jsx)(m,{label:l(`ticket.list.selectSection`,{section:e.label}),className:`sr-checkbox`,...gn(e)}),e.heading,(0,$.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:e.total})]}),(0,$.jsx)(`ul`,{className:`m-0 flex flex-1 list-none flex-col p-0`,children:U(e).map(t=>{let n=t.getVisibleCells(),r=e=>n.find(t=>t.column.id===e),i=r(`select`),a=r(`key`),o=r(`title`);return(0,$.jsx)(Ct,{ticket:t.original,onPreview:()=>Sn(t.id),moves:Hn(t.original)?()=>Wn(t.original):void 0,children:(0,$.jsxs)(`li`,{className:w(so,`flex flex-col gap-1.5 border-b px-2 py-2.5 transition-colors hover:bg-muted/40 data-[active=true]:shadow-[inset_2px_0_0_var(--primary)] data-[dragging=true]:opacity-50 data-[drop=after]:shadow-[inset_0_-2px_0_var(--primary)] data-[drop=before]:shadow-[inset_0_2px_0_var(--primary)] in-data-[density=comfortable]:gap-2.5 in-data-[density=comfortable]:py-4`),"data-id":t.id,"data-selected":t.getIsSelected(),"data-active":G===t.id||void 0,"data-fresh":Lt.fresh.has(t.id)||void 0,...X.item(t.id,{draggable:y,accepts:Gn(e)}),onDragEnd:()=>{X.end(),qn(null)},onClick:e=>Yn(t.original,e),children:[(0,$.jsxs)(`div`,{className:`flex min-h-6 items-center gap-2`,children:[i&&(0,$.jsx)(H.FlexRender,{cell:i}),a&&(0,$.jsx)(`span`,{"data-column":`key`,className:`font-mono text-[11px] text-muted-foreground`,children:(0,$.jsx)(H.FlexRender,{cell:a})}),(0,$.jsx)(`span`,{"data-column":`status`,className:`ml-auto`,children:(0,$.jsx)(Za,{ticket:t.original,property:`status`,value:_t(t.original),iconOnly:!0})})]}),o&&(0,$.jsx)(H.FlexRender,{cell:o}),(0,$.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs empty:hidden`,children:n.filter(e=>![`select`,`key`,`title`,`status`].includes(e.column.id)).map(e=>(0,$.jsx)(`span`,{"data-column":e.column.id,className:`min-w-0 max-w-full empty:hidden`,children:(0,$.jsx)(H.FlexRender,{cell:e})},e.id))})]})},t.id)})})]},e.id))})}):E&&D?(0,$.jsx)(Ba,{layout:E,tickets:qt,anchor:Le,range:D,onAnchor:e=>s({...n,period:e?Be(e,`yyyy-MM-dd`):void 0})}):(0,$.jsxs)(`div`,{className:`table-scroll min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain [&_[data-slot=table-container]]:overflow-visible`,children:[(0,$.jsxs)(`div`,{role:`table`,"aria-label":l(`ticket.list.tickets`),className:w(`ticket-table`,co,`data-[density=comfortable]:[&_td]:text-sm data-[density=comfortable]:[&_td_svg]:size-4 data-[density=comfortable]:[&_td[data-column=key]]:text-xs`),"data-density":k,"data-label-display":ze,style:{"--table-width":`${H.getTotalSize()}px`},children:[(0,$.jsx)(`div`,{className:`sticky top-0 z-20 bg-background`,children:(0,$.jsxs)(Gt,{role:`presentation`,className:lo,children:[(0,$.jsx)(uo,{leaves:H.getVisibleLeafColumns()}),(0,$.jsx)(Bt,{role:`rowgroup`,children:H.getHeaderGroups().map(e=>(0,$.jsx)(Ut,{role:`row`,className:`hover:bg-transparent`,children:e.headers.map(e=>{let t=no[e.column.id],n=t!==void 0&&p.sort===t,i=n?p.order??r[t]:void 0;return(0,$.jsxs)(Vt,{role:`columnheader`,scope:`col`,"data-column":e.column.id,"aria-sort":i===`asc`?`ascending`:i===`desc`?`descending`:void 0,className:w(`relative h-8 overflow-hidden bg-transparent px-3 text-[10.5px] font-medium tracking-[0.08em] text-ellipsis text-muted-foreground uppercase`,t&&`p-0`),style:{width:e.getSize()},children:[t?(0,$.jsxs)(S,{variant:`ghost`,title:typeof e.column.columnDef.header==`string`?e.column.columnDef.header:void 0,className:w(`h-8 w-full justify-start gap-1 rounded-none pr-2 pl-3 text-[10.5px] font-medium tracking-[0.08em] text-muted-foreground uppercase hover:text-foreground`,n&&`text-foreground`),onClick:()=>Dn({...p,sort:t,order:n?i===`asc`?`desc`:`asc`:void 0,offset:0}),children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,$.jsx)(H.FlexRender,{header:e})}),i===`asc`&&(0,$.jsx)(oe,{className:`size-3 shrink-0`}),i===`desc`&&(0,$.jsx)(ue,{className:`size-3 shrink-0`})]}):(0,$.jsx)(H.FlexRender,{header:e}),e.column.getCanResize()&&(0,$.jsx)(S,{variant:`ghost`,className:`resizer absolute top-2 right-0 bottom-2 h-auto w-2 min-w-0 cursor-col-resize touch-none rounded-none border-r bg-transparent p-0 hover:border-primary hover:bg-transparent`,"aria-label":l(`ticket.list.resizeColumn`,{column:pn.data?.find(t=>he(t.id)===e.id)?.name??e.id}),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),onKeyDown:t=>{(t.key===`ArrowLeft`||t.key===`ArrowRight`)&&(t.preventDefault(),H.setColumnSizing(n=>({...n,[e.column.id]:Math.max(e.column.columnDef.minSize??60,e.column.getSize()+(t.key===`ArrowRight`?20:-20))})))}})]},e.id)})},e.id))})]})}),F.map(e=>(0,$.jsxs)(Gt,{role:`presentation`,className:lo,children:[(0,$.jsx)(uo,{leaves:H.getVisibleLeafColumns()}),(0,$.jsxs)(Ht,{role:`rowgroup`,"aria-label":$t?l(`ticket.list.sectionTickets`,{section:e.label}):l(`ticket.list.tickets`),children:[$t&&(0,$.jsx)(Ut,{className:`ticket-status-heading hover:bg-transparent`,"data-status":O===`status`?e.id:void 0,children:(0,$.jsx)(Vt,{scope:`rowgroup`,className:`sticky top-8 z-10 border-b bg-[color-mix(in_oklab,var(--muted)_50%,var(--background))] p-0`,colSpan:H.getAllLeafColumns().filter(e=>e.getIsVisible()).length,children:(0,$.jsx)(qa,{section:e,collapsed:it.has(e.id),onToggle:()=>En(e.id),selection:y?gn(e):void 0})})}),!en(e.id)&&U(e).map(t=>(0,$.jsx)(Ct,{ticket:t.original,onPreview:()=>Sn(t.id),moves:Hn(t.original)?()=>Wn(t.original):void 0,children:(0,$.jsx)(Ut,{className:w(so,`data-[active=true]:[&>td:first-child]:shadow-[inset_2px_0_0_var(--primary)] data-[dragging=true]:opacity-50 data-[drop=after]:[&>td]:shadow-[inset_0_-2px_0_var(--primary)] data-[drop=before]:[&>td]:shadow-[inset_0_2px_0_var(--primary)]`),role:`row`,"data-id":t.id,"data-selected":t.getIsSelected(),"data-active":G===t.id||void 0,"data-fresh":Lt.fresh.has(t.id)||void 0,...X.item(t.id,{draggable:Y,accepts:Gn(e)}),onClick:e=>Yn(t.original,e),children:t.getVisibleCells().map(e=>(0,$.jsx)(Wt,{className:w(`px-3 py-2 align-middle text-xs whitespace-normal in-data-[density=comfortable]:py-4`,e.column.id===`key`&&`font-mono text-[11px] text-muted-foreground`),role:`cell`,"data-column":e.column.id,"data-label":typeof e.column.columnDef.header==`string`?e.column.columnDef.header:void 0,children:(0,$.jsx)(H.FlexRender,{cell:e})},e.id))})},t.id))]})]},e.id))]}),Xn]}),!L.isPending&&!L.error&&(0,$.jsx)(`footer`,{className:`shrink-0 py-2 text-xs text-muted-foreground`,children:l(E?`ticket.list.scheduledCount`:`ticket.list.count`,{count:L.data.total})}),(0,$.jsx)(`span`,{role:`status`,className:`sr-only`,children:Mn}),(0,$.jsx)(ae,{size:`composer`,title:l(`ticket.menu.newTicket`),open:an,onOpenChange:on,children:an&&h&&(0,$.jsx)(Kt,{projectId:h.id,onSaved:()=>on(!1)})})]})}export{fo as TicketList};
|