syntaur 0.65.0 → 0.66.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/.claude-plugin/plugin.json +1 -1
- package/dashboard/dist/assets/{_basePickBy-CrrGp7iQ.js → _basePickBy-CE2CIvur.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-CR-L9Z4l.js → _baseUniq-BznLQqID.js} +1 -1
- package/dashboard/dist/assets/{arc-Bplhanol.js → arc-B6JqtWve.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-hcuAyqPz.js → architectureDiagram-2XIMDMQ5-P8UCT3rj.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-BkGOQX1p.js → blockDiagram-WCTKOSBZ-C1ATZKSf.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-CyhVhe9Z.js → c4Diagram-IC4MRINW-AvN1yayQ.js} +1 -1
- package/dashboard/dist/assets/channel-IZujZyS6.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-DWT4Kb7h.js → chunk-4BX2VUAB-CyYz6mlJ.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-DabzdGiV.js → chunk-55IACEB6-QyOF7ox_.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-9u9EbTn2.js → chunk-FMBD7UC4-DVTHM99U.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-qNUjUgoq.js → chunk-JSJVCQXG-DQfxaQtT.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-Iw8btz_i.js → chunk-KX2RTZJC-4R1oobH6.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-DuWW63Ax.js → chunk-NQ4KR5QH-D8H_7yNS.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-CquL_I3V.js → chunk-QZHKN3VN-DLxDUSuo.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-CmAQtVO_.js → chunk-WL4C6EOR-CWuFDkVp.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-ChnJofe3.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-ChnJofe3.js +1 -0
- package/dashboard/dist/assets/clone-JjIbzsqJ.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-D_vWs01G.js → cose-bilkent-S5V4N54A-D23Dy_Za.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-DRSd99h1.js → dagre-KLK3FWXG-CaKBk8eh.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-CYIlPZb0.js → diagram-E7M64L7V-BAPQPki-.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-D1Mk78S1.js → diagram-IFDJBPK2-Cla6qyvn.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-cK1mot2F.js → diagram-P4PSJMXO-DnTZq_y6.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-CKAce3P6.js → erDiagram-INFDFZHY-yc1_7ebn.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-B8UyrAbG.js → flowDiagram-PKNHOUZH-CMt2tF6O.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-DFlWro9k.js → ganttDiagram-A5KZAMGK-CXiK-5Gp.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-CfvsGSZk.js → gitGraphDiagram-K3NZZRJ6-B4PbW06T.js} +1 -1
- package/dashboard/dist/assets/{graph-DTnszQr1.js → graph-CjdFy-q-.js} +1 -1
- package/dashboard/dist/assets/{index-BukhcQ51.js → index-COOcebN7.js} +2 -2
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-B4CQ1F6_.js → infoDiagram-LFFYTUFH-BeOWVt7p.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-BJf9J-fu.js → ishikawaDiagram-PHBUUO56-LE7swZOH.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-CDt3Ieap.js → journeyDiagram-4ABVD52K-DG9-sksf.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-DvenMiPw.js → kanban-definition-K7BYSVSG-7CKAw6eI.js} +1 -1
- package/dashboard/dist/assets/{layout-B_3cS6Wx.js → layout-CHChKPuz.js} +1 -1
- package/dashboard/dist/assets/{linear-VVB-1jRr.js → linear-BWSj4au4.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-BR4E6mM3.js → mermaid.core-CAwQaPqG.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-BSMVANTC.js → mindmap-definition-YRQLILUH-CtZWMkVN.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-Bc1KLLbU.js → pieDiagram-SKSYHLDU-CstCoaK7.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-DCxPDJLj.js → quadrantDiagram-337W2JSQ-DD8zRtaB.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-CIR7dfaq.js → requirementDiagram-Z7DCOOCP-BWpKIK3b.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-BSmLrby0.js → sankeyDiagram-WA2Y5GQK-08gqQtFM.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-D8SKlaHf.js → sequenceDiagram-2WXFIKYE-DsfIDBUH.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-P-weHmzQ.js → stateDiagram-RAJIS63D-Dqzfk_yy.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-D542UPiR.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-AWMvjwea.js → timeline-definition-YZTLITO2-DgH_p9jR.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-ByTswXsP.js → treemap-KZPCXAKY-7XKqMhq9.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-FhcL4LCg.js → vennDiagram-LZ73GAT5-BFtNLBWM.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-Aql6py8q.js → xychartDiagram-JWTSCODW-CQPevMNl.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/dashboard/server.js +90 -20
- package/dist/dashboard/server.js.map +1 -1
- package/dist/db/leases-db.d.ts +4 -3
- package/dist/db/leases-db.js +6 -4
- package/dist/db/leases-db.js.map +1 -1
- package/dist/index.js +148 -27
- package/dist/index.js.map +1 -1
- package/dist/launch/index.js +20 -7
- package/dist/launch/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
- package/platforms/codex/.codex-plugin/plugin.json +1 -1
- package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
- package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
- package/dashboard/dist/assets/channel-DKDXpYJX.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-U7OD7LGq.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-U7OD7LGq.js +0 -1
- package/dashboard/dist/assets/clone-CZUxWIoY.js +0 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-DgvK3I0Y.js +0 -1
|
@@ -543,7 +543,7 @@ Please change the parent <Route path="${j}"> to <Route path="${j==="/"?"*":`${j}
|
|
|
543
543
|
*
|
|
544
544
|
* This source code is licensed under the ISC license.
|
|
545
545
|
* See the LICENSE file in the root directory of this source tree.
|
|
546
|
-
*/const Pd=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function b2(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=b2(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function OO(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=b2(e))&&(r&&(r+=" "),r+=t);return r}const Kv="-",FO=e=>{const t=BO(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const l=a.split(Kv);return l[0]===""&&l.length!==1&&l.shift(),v2(l,t)||zO(a)},getConflictingClassGroupIds:(a,l)=>{const u=n[a]||[];return l&&r[a]?[...u,...r[a]]:u}}},v2=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?v2(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Kv);return(a=t.validators.find(({validator:l})=>l(i)))==null?void 0:a.classGroupId},E1=/^\[(.+)\]$/,zO=e=>{if(E1.test(e)){const t=E1.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},BO=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return HO(Object.entries(e.classGroups),n).forEach(([i,a])=>{wb(a,r,i,t)}),r},wb=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:T1(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(UO(o)){wb(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,a])=>{wb(a,T1(t,i),n,r)})})},T1=(e,t)=>{let n=e;return t.split(Kv).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},UO=e=>e.isThemeGetter,HO=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,l])=>[t+a,l])):i);return[n,o]}):e,VO=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;if((a=r.get(i))!==void 0)return o(i,a),a},set(i,a){n.has(i)?n.set(i,a):o(i,a)}}},w2="!",WO=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,a=l=>{const u=[];let f=0,p=0,h;for(let b=0;b<l.length;b++){let j=l[b];if(f===0){if(j===o&&(r||l.slice(b,b+i)===t)){u.push(l.slice(p,b)),p=b+i;continue}if(j==="/"){h=b;continue}}j==="["?f++:j==="]"&&f--}const g=u.length===0?l:l.substring(p),y=g.startsWith(w2),k=y?g.substring(1):g,v=h&&h>p?h-p:void 0;return{modifiers:u,hasImportantModifier:y,baseClassName:k,maybePostfixModifierPosition:v}};return n?l=>n({className:l,parseClassName:a}):a},qO=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},KO=e=>({cache:VO(e.cacheSize),parseClassName:WO(e),...FO(e)}),GO=/\s+/,YO=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],a=e.trim().split(GO);let l="";for(let u=a.length-1;u>=0;u-=1){const f=a[u],{modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}=n(f);let k=!!y,v=r(k?g.substring(0,y):g);if(!v){if(!k){l=f+(l.length>0?" "+l:l);continue}if(v=r(g),!v){l=f+(l.length>0?" "+l:l);continue}k=!1}const b=qO(p).join(":"),j=h?b+w2:b,N=j+v;if(i.includes(N))continue;i.push(N);const S=o(v,k);for(let C=0;C<S.length;++C){const D=S[C];i.push(j+D)}l=f+(l.length>0?" "+l:l)}return l};function XO(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=j2(t))&&(r&&(r+=" "),r+=n);return r}const j2=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=j2(e[r]))&&(n&&(n+=" "),n+=t);return n};function QO(e,...t){let n,r,o,i=a;function a(u){const f=t.reduce((p,h)=>h(p),e());return n=KO(f),r=n.cache.get,o=n.cache.set,i=l,l(u)}function l(u){const f=r(u);if(f)return f;const p=YO(u,n);return o(u,p),p}return function(){return i(XO.apply(null,arguments))}}const Jt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},k2=/^\[(?:([a-z-]+):)?(.+)\]$/i,JO=/^\d+\/\d+$/,ZO=new Set(["px","full","screen"]),e4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,t4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,n4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,r4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,s4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,yo=e=>Ll(e)||ZO.has(e)||JO.test(e),ai=e=>yc(e,"length",f4),Ll=e=>!!e&&!Number.isNaN(Number(e)),Zx=e=>yc(e,"number",Ll),hu=e=>!!e&&Number.isInteger(Number(e)),o4=e=>e.endsWith("%")&&Ll(e.slice(0,-1)),jt=e=>k2.test(e),li=e=>e4.test(e),i4=new Set(["length","size","percentage"]),a4=e=>yc(e,i4,S2),l4=e=>yc(e,"position",S2),c4=new Set(["image","url"]),u4=e=>yc(e,c4,h4),d4=e=>yc(e,"",p4),mu=()=>!0,yc=(e,t,n)=>{const r=k2.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},f4=e=>t4.test(e)&&!n4.test(e),S2=()=>!1,p4=e=>r4.test(e),h4=e=>s4.test(e),m4=()=>{const e=Jt("colors"),t=Jt("spacing"),n=Jt("blur"),r=Jt("brightness"),o=Jt("borderColor"),i=Jt("borderRadius"),a=Jt("borderSpacing"),l=Jt("borderWidth"),u=Jt("contrast"),f=Jt("grayscale"),p=Jt("hueRotate"),h=Jt("invert"),g=Jt("gap"),y=Jt("gradientColorStops"),k=Jt("gradientColorStopPositions"),v=Jt("inset"),b=Jt("margin"),j=Jt("opacity"),N=Jt("padding"),S=Jt("saturate"),C=Jt("scale"),D=Jt("sepia"),T=Jt("skew"),R=Jt("space"),$=Jt("translate"),P=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto",jt,t],V=()=>[jt,t],U=()=>["",yo,ai],I=()=>["auto",Ll,jt],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",jt],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>[Ll,jt];return{cacheSize:500,separator:":",theme:{colors:[mu],spacing:[yo,ai],blur:["none","",li,jt],brightness:z(),borderColor:[e],borderRadius:["none","","full",li,jt],borderSpacing:V(),borderWidth:U(),contrast:z(),grayscale:H(),hueRotate:z(),invert:H(),gap:V(),gradientColorStops:[e],gradientColorStopPositions:[o4,ai],inset:_(),margin:_(),opacity:z(),padding:V(),saturate:z(),scale:z(),sepia:H(),skew:z(),space:V(),translate:V()},classGroups:{aspect:[{aspect:["auto","square","video",jt]}],container:["container"],columns:[{columns:[li]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),jt]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",hu,jt]}],basis:[{basis:_()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",jt]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",hu,jt]}],"grid-cols":[{"grid-cols":[mu]}],"col-start-end":[{col:["auto",{span:["full",hu,jt]},jt]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[mu]}],"row-start-end":[{row:["auto",{span:[hu,jt]},jt]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",jt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",jt]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...O()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...O(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...O(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",jt,t]}],"min-w":[{"min-w":[jt,t,"min","max","fit"]}],"max-w":[{"max-w":[jt,t,"none","full","min","max","fit","prose",{screen:[li]},li]}],h:[{h:[jt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[jt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[jt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[jt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",li,ai]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Zx]}],"font-family":[{font:[mu]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",jt]}],"line-clamp":[{"line-clamp":["none",Ll,Zx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",yo,jt]}],"list-image":[{"list-image":["none",jt]}],"list-style-type":[{list:["none","disc","decimal",jt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",yo,ai]}],"underline-offset":[{"underline-offset":["auto",yo,jt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",jt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",jt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),l4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",a4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},u4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-to-pos":[{to:[k]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[j]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[j]}],"divide-style":[{divide:B()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...B()]}],"outline-offset":[{"outline-offset":[yo,jt]}],"outline-w":[{outline:[yo,ai]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[yo,ai]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",li,d4]}],"shadow-color":[{shadow:[mu]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",li,jt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[h]}],saturate:[{saturate:[S]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",jt]}],duration:[{duration:z()}],ease:[{ease:["linear","in","out","in-out",jt]}],delay:[{delay:z()}],animate:[{animate:["none","spin","ping","pulse","bounce",jt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[hu,jt]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",jt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",jt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",jt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[yo,ai,Zx]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},g4=QO(m4);function je(...e){return g4(OO(e))}function Yn(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Nr(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function N2(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Gv(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Yv(e){if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=Math.floor((Date.now()-t.getTime())/1e3);if(n<60)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Xl(e){return e.toLocaleString("en-US")}function Ql(e){if(!Number.isFinite(e))return"$0.00";const t=e!==0&&Math.abs(e)<1?4:2;return e.toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:t})}function x4(e){if(!e)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return e;const[,n,r,o]=t,i=new Date(Number(n),Number(r)-1,Number(o));return Number.isNaN(i.getTime())?e:i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function bn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function C2(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function E2(e){let t=C2(e);const n=t.match(/^\/w\/[^/]+(\/.*)?$/);return n&&(t=n[1]||"/"),t==="/"?"/":t.startsWith("/archive")?"/archive":t.startsWith("/projects")?/^\/projects\/[^/]+\/assignments\//.test(t)?"/assignments":"/projects":t.startsWith("/assignments")?"/assignments":t.startsWith("/servers")?"/servers":t.startsWith("/inventories")?"/inventories":t.startsWith("/schedules")?"/schedules":t.startsWith("/usage")?"/usage":t.startsWith("/agent-sessions")?"/agent-sessions":t.startsWith("/playbooks")?"/playbooks":t.startsWith("/memories")?"/memories":t.startsWith("/resources")?"/resources":t.startsWith("/todos")?"/todos":t.startsWith("/views")?"/views":t.startsWith("/help")?"/help":t.startsWith("/settings")?"/settings":t.startsWith("/workflow")?"/workflow":t.startsWith("/inbox")?"/inbox":null}function T2(e,t){return E2(e)===t}function R2(e){let n=C2(e).split("/").filter(Boolean);const r=[];let o="Overview",i=null,a="";if(n[0]==="w"&&n[1]&&(a=`/w/${n[1]}`,r.push({label:bn(n[1]),path:`${a}/projects`}),n=n.slice(2)),n.length===0)return{title:o,breadcrumbs:r,projectSlug:i};if(n[0]==="projects"){if(r.push({label:"Projects",path:`${a}/projects`}),o="Projects",n[1]&&(i=n[1],r.push({label:bn(n[1]),path:`${a}/projects/${n[1]}`}),o=bn(n[1])),n[2]==="edit")o="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")o="Create Assignment";else if(n[2]==="assignments"&&n[3])r.push({label:bn(n[3]),path:`${a}/projects/${n[1]}/assignments/${n[3]}`}),o=bn(n[3]),n[4]==="edit"?o="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?o="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?o="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?o="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(o="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const l=n[2]==="memories"?"Memories":"Resources",u=n[2]==="memories"?"/memories":"/resources";r.push({label:l,path:u}),r.push({label:bn(n[3]),path:`${a}/projects/${n[1]}/${n[2]}/${n[3]}`}),o=bn(n[3]),n[4]==="edit"&&(o=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(o="Servers",r.push({label:"Servers",path:`${a}/servers`})):n[0]==="inventories"?(o="Inventories",r.push({label:"Inventories",path:`${a}/inventories`})):n[0]==="schedules"?(o="Schedules",r.push({label:"Schedules",path:`${a}/schedules`})):n[0]==="usage"?(o="Usage",r.push({label:"Usage",path:`${a}/usage`})):n[0]==="agent-sessions"?(o="Agent Sessions",r.push({label:"Agent Sessions",path:`${a}/agent-sessions`})):n[0]==="assignments"?(o="Assignments",r.push({label:"Assignments",path:`${a}/assignments`})):n[0]==="archive"?(o="Archive",r.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(r.push({label:"Playbooks",path:"/playbooks"}),o="Playbooks",n[1]==="create"?o="Create Playbook":n[1]&&n[2]==="edit"?(r.push({label:bn(n[1]),path:`/playbooks/${n[1]}`}),o="Edit Playbook"):n[1]&&(r.push({label:bn(n[1]),path:`/playbooks/${n[1]}`}),o=bn(n[1]))):n[0]==="memories"?(r.push({label:"Memories",path:"/memories"}),o="Memories",n[1]==="new"&&(o="New Memory")):n[0]==="resources"?(r.push({label:"Resources",path:"/resources"}),o="Resources",n[1]==="new"&&(o="New Resource")):n[0]==="todos"?(o="Todos",r.push({label:"Todos",path:`${a}/todos`})):n[0]==="views"?(o="Saved Views",r.push({label:"Saved Views",path:`${a}/views`}),n[1]&&(o="View")):n[0]==="help"?(o="Help",r.push({label:"Help",path:"/help"})):n[0]==="settings"?(o="Settings",r.push({label:"Settings",path:"/settings"})):n[0]==="workflow"?(o="Workflow",r.push({label:"Workflow",path:"/workflow"})):n[0]==="create"&&n[1]==="project"&&(o="Create Project",r.push({label:"Create Project",path:`${a}/create/project`}));return{title:o,breadcrumbs:r,projectSlug:i}}function A2({item:e,onNavigate:t}){const n=rr(),r=e.icon,o=T2(n.pathname,e.to)&&!n.pathname.startsWith("/w/");return s.jsxs(De,{to:e.to,onClick:t,className:je("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition",o?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[s.jsx(r,{className:"h-4 w-4"}),s.jsx("span",{children:e.label}),e.badge&&e.badge>0?s.jsx("span",{className:je("ml-auto inline-flex min-w-[1.25rem] items-center justify-center rounded-full px-1.5 py-0.5 text-[11px] font-semibold",o?"bg-background/20 text-background":"bg-foreground text-background"),children:e.badge}):null]})}function R1({items:e,onNavigate:t}){return s.jsx("nav",{className:"space-y-1",children:e.map(n=>s.jsx(A2,{item:n,onNavigate:t},n.to))})}function y4({label:e,items:t,collapsed:n,onToggle:r,containsActive:o,onNavigate:i}){const a=n&&o;return s.jsxs("div",{children:[s.jsxs("button",{type:"button",onClick:r,"aria-expanded":!n,className:je("flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition",a?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"),children:[s.jsx(cr,{className:je("h-3 w-3 transition-transform",n&&"-rotate-90")}),e]}),n?null:s.jsx("nav",{className:"space-y-1",children:t.map(l=>s.jsx(A2,{item:l,onNavigate:i},l.to))})]})}const P2=[{slug:"default",label:"Syntaur",description:"Brand purple, warm yellow, coral & teal accents.",swatches:{primary:"oklch(70% 0.18 290)",secondary:"oklch(80% 0.14 75)",coral:"oklch(72% 0.17 15)",teal:"oklch(72% 0.14 185)",amber:"oklch(82% 0.16 75)"}},{slug:"ocean",label:"Midnight",description:"Deep indigo-blue with cyan accents. Inspired by One Dark Pro.",swatches:{primary:"oklch(70% 0.16 240)",secondary:"oklch(78% 0.13 200)",coral:"oklch(72% 0.18 350)",teal:"oklch(78% 0.14 195)",amber:"oklch(84% 0.15 90)"}},{slug:"forest",label:"Verdant",description:"Saturated emerald and pine on a dark olive base.",swatches:{primary:"oklch(72% 0.17 145)",secondary:"oklch(80% 0.13 110)",coral:"oklch(72% 0.17 25)",teal:"oklch(75% 0.13 175)",amber:"oklch(82% 0.16 95)"}},{slug:"sunset",label:"Ember",description:"Warm sepia surfaces with copper and amber accents.",swatches:{primary:"oklch(72% 0.18 35)",secondary:"oklch(80% 0.16 60)",coral:"oklch(72% 0.19 15)",teal:"oklch(72% 0.12 180)",amber:"oklch(86% 0.17 70)"}}],b4=P2.map(e=>e.slug),lh="default";function _2(e){return typeof e=="string"&&b4.includes(e)}const D2={preset:lh,custom:!1};let Du=null,ll=null;function Xv(e){if(!e||typeof e!="object")return D2;const t=e;return{preset:_2(t.preset)?t.preset:lh,custom:t.custom===!0}}function v4(){return Du?Promise.resolve(Du):ll||(ll=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Xv(e);return Du=t,ll=null,t}).catch(()=>(ll=null,D2)),ll)}async function w4(e){const t=await fetch("/api/config/theme",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({preset:e})});if(!t.ok){const r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));throw new Error(r.error??"Failed to save theme")}const n=Xv(await t.json());return Du=n,n}async function j4(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Xv(await e.json());return Du=t,t}const jb="syntaur-theme",Dp="syntaur-preset",$2=m.createContext(null);function kb(){try{const e=window.localStorage.getItem(jb);return e==="light"||e==="dark"?e:null}catch{return null}}function I2(){try{const e=window.localStorage.getItem(Dp);return _2(e)?e:lh}catch{return lh}}function L2(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function M2(e){document.documentElement.classList.toggle("dark",e==="dark")}function O2(e){document.documentElement.dataset.theme=e}function k4(){typeof document>"u"||(M2(kb()??L2()),O2(I2()))}function S4({children:e}){const[t,n]=m.useState(()=>kb()),[r,o]=m.useState(()=>kb()??L2()),[i,a]=m.useState(()=>I2());m.useEffect(()=>{M2(r)},[r]),m.useEffect(()=>{O2(i)},[i]),m.useEffect(()=>{let p=!1;return v4().then(h=>{if(!p&&h.preset!==i){a(h.preset);try{window.localStorage.setItem(Dp,h.preset)}catch{}}}),()=>{p=!0}},[]),m.useEffect(()=>{if(!window.matchMedia)return;const p=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{t||o(p.matches?"dark":"light")};return h(),p.addEventListener("change",h),()=>{p.removeEventListener("change",h)}},[t]);async function l(p){a(p);try{window.localStorage.setItem(Dp,p)}catch{}await w4(p)}async function u(){const p=await j4();a(p.preset);try{window.localStorage.setItem(Dp,p.preset)}catch{}}const f={resolvedTheme:r,explicitTheme:t,setTheme:p=>{window.localStorage.setItem(jb,p),n(p),o(p)},toggleTheme:()=>{const p=r==="dark"?"light":"dark";window.localStorage.setItem(jb,p),n(p),o(p)},preset:i,setPreset:l,resetPreset:u};return s.jsx($2.Provider,{value:f,children:e})}function Qv(){const e=m.useContext($2);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const N4=2e3,$u=new Set;let ps=null,ia=null,$p=!1,ch="closed";const Sb=new Set;function Ru(e){if(ch!==e){ch=e;for(const t of Sb)t(e)}}function A1(){return ch}function C4(e){return Sb.add(e),()=>{Sb.delete(e)}}function E4(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}let T4=E4;function R4(){ia&&clearTimeout(ia),ia=setTimeout(()=>{ia=null,F2()},N4)}function F2(){if(ps&&(ps.readyState===WebSocket.OPEN||ps.readyState===WebSocket.CONNECTING))return;$p=!1,ch==="closed"&&Ru("connecting");const e=new WebSocket(T4());ps=e,e.onopen=()=>{ps===e&&Ru("open")},e.onmessage=t=>{if(ps===e)try{const n=JSON.parse(t.data);for(const r of $u)r(n)}catch{}},e.onclose=()=>{if(ps===e){if(ps=null,$p||$u.size===0){$p=!1,Ru("closed");return}Ru("reconnecting"),R4()}},e.onerror=()=>{e.close()}}function A4(e){return $u.add(e),F2(),()=>{$u.delete(e),$u.size===0&&(ia&&(clearTimeout(ia),ia=null),ps&&($p=!0,ps.close(),ps=null),Ru("closed"))}}function Ei(e){const t=m.useRef(e);t.current=e,m.useEffect(()=>A4(o=>t.current(o)),[])}const sm=["7d","30d","90d","all","custom"],z2="30d",P4=/^\d{4}-\d{2}-\d{2}$/,_d=["project","workspace","model","tool"],_4={"7d":7,"30d":30,"90d":90};function Iu(e){if(typeof e!="string"||!P4.test(e))return!1;const[t,n,r]=e.split("-").map(Number);if(n<1||n>12||r<1||r>31)return!1;const o=new Date(Date.UTC(t,n-1,r));return o.getUTCFullYear()===t&&o.getUTCMonth()===n-1&&o.getUTCDate()===r}function P1(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${r}`}function D4(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function $4(e,t=new Date){const n=e.window??z2;if(n==="all")return{};if(n==="custom"){const o={};return e.since&&(o.since=e.since),e.until&&(o.until=e.until),o}const r=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return{since:P1(D4(r,-(_4[n]-1))),until:P1(r)}}function I4(e){const t=[];if(!e||typeof e!="object"||Array.isArray(e))return{ok:!1,errors:["filters must be an object"]};const n=e;n.window!==void 0&&!sm.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const r of["since","until"])n[r]!==void 0&&!Iu(n[r])&&t.push(`invalid ${r}: ${String(n[r])} (expected YYYY-MM-DD)`);for(const r of _d)n[r]!==void 0&&(typeof n[r]!="string"||n[r].length===0)&&t.push(`invalid ${r}: must be a non-empty string`);return Iu(n.since)&&Iu(n.until)&&n.since>n.until&&t.push("since must be on or before until"),{ok:t.length===0,errors:t}}function Dd(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;typeof n.window=="string"&&sm.includes(n.window)&&(t.window=n.window),Iu(n.since)&&(t.since=n.since),Iu(n.until)&&(t.until=n.until);for(const r of _d)typeof n[r]=="string"&&n[r].length>0&&(t[r]=n[r]);return t.window!=="custom"&&(delete t.since,delete t.until),t}function Nb(e){const t=Dd(e),n=new URLSearchParams;t.window&&n.set("window",t.window),t.window==="custom"&&(t.since&&n.set("since",t.since),t.until&&n.set("until",t.until));for(const r of _d)t[r]&&n.set(r,t[r]);return n}function L4(e){const t={};for(const n of["window","since","until",..._d]){const r=e.get(n);r!==null&&(t[n]=r)}return Dd(t)}function B2(e,t=new Date){const n=Dd(e),{since:r,until:o}=$4(n,t),i=new URLSearchParams;r&&i.set("since",r),o&&i.set("until",o);for(const a of _d)n[a]&&i.set(a,n[a]);return i}const M4={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function _1(e){const t=Dd(e),n=t.window??z2,r=[];return r.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:M4[n]),t.workspace&&r.push(`workspace: ${t.workspace}`),t.project&&r.push(`project: ${t.project}`),t.model&&r.push(`model: ${t.model}`),t.tool&&r.push(`tool: ${t.tool}`),r.join(" · ")}function tn(e,t,n=!0,r=!1){const[o,i]=m.useState(null),[a,l]=m.useState(!0),[u,f]=m.useState(null),[p,h]=m.useState(0),g=n?e:null,y=m.useCallback(()=>{h(v=>v+1)},[]),k=m.useRef(g);return r&&k.current!==g&&(k.current=g,i(null),f(null)),m.useEffect(()=>{if(!g){l(!1),i(null);return}let v=!1;return l(!0),f(null),fetch(g).then(async b=>{if(!b.ok){const j=await b.json().catch(()=>null);throw new Error((j==null?void 0:j.error)||`HTTP ${b.status}`)}return b.json()}).then(b=>{v||(i(b),l(!1))}).catch(b=>{v||(f(b.message),l(!1))}),()=>{v=!0}},[g,p]),Ei(v=>{!t||!g||((v.type==="project-updated"||v.type==="assignment-updated")&&y(),v.type==="servers-updated"&&t==="servers"&&y(),v.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&y(),v.type==="playbooks-updated"&&t==="playbooks"&&y(),v.type==="leases-updated"&&t==="inventories"&&y())}),{data:o,loading:a,error:u,refetch:y}}function to(e=!0){return tn("/api/projects","projects",e)}function Ea(){return tn("/api/workspaces","projects")}function mn(){const{workspace:e}=qt();return e?`/w/${e}`:""}function O4(e={}){const t=new URLSearchParams;typeof e.staleLimit=="number"&&Number.isFinite(e.staleLimit)&&t.set("staleLimit",String(e.staleLimit)),typeof e.staleOffset=="number"&&Number.isFinite(e.staleOffset)&&t.set("staleOffset",String(e.staleOffset));const n=t.toString(),r=n?`/api/overview?${n}`:"/api/overview";return tn(r,"overview")}function om(e=!0){return tn("/api/assignments","assignments",e)}function F4(e=!0){return tn("/api/archived","assignments",e)}function U2(){return tn("/api/help")}function H2(e){const t=e?`/api/projects/${e}`:null;return tn(t,"project")}function z4(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return tn(n,"assignment")}function B4(e){const t=e?`/api/assignments/${e}`:null;return tn(t,"assignment")}function V2(e){return tn(e)}function Jv(e=!0){return tn("/api/servers","servers",e)}function W2(){return tn("/api/leases","inventories")}function im(){return tn("/api/agent-sessions","agent-sessions")}function U4(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return tn(n,"agent-sessions")}function H4(e){const t=e?`/api/assignments/${e}/sessions`:null;return tn(t,"agent-sessions")}function V4(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return tn(n,void 0,!0,!0)}function W4(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return tn(t,void 0,!0,!0)}function Zv(e=!0){return tn("/api/playbooks","playbooks",e)}function q4(e){const t=B2(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return tn(n,void 0,!0,!0)}function q2(e=!0){return tn("/api/usage/facets",void 0,e)}function K4(e){const t=e?`/api/playbooks/${e}`:null;return tn(t,"playbooks")}function G4(){return tn("/api/memories","project")}function Y4(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return tn(n,"project")}function X4(){return tn("/api/resources","project")}function Q4(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return tn(n,"project")}const am=["new-workspace","new-project","new-todo","new-assignment"];function J4(e){return typeof e=="string"&&am.includes(e)}const Z4=["mod+k","mod+shift+k","?","escape","enter","shift+t","g","g o","g m","g a","g t","g s","g !","g ,","j","k","o","a","e","/","r","p","h","d","s","[","]"],e5=["mod","ctrl","alt","shift"];function wr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(wr).filter(l=>l.length>0).join(" ");const n=t.split("+").map(l=>l.trim()).filter(l=>l.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const r=n[n.length-1].toLowerCase(),o=n.slice(0,-1).map(l=>l.toLowerCase()),i=new Set,a=[];for(const l of e5)o.includes(l)&&!i.has(l)&&(a.push(l),i.add(l));for(const l of o)i.has(l)||(a.push(l),i.add(l));return[...a,r].join("+")}function t5(e){const t=wr(e);return t?Z4.includes(t):!1}const n5={"new-workspace":wr("Mod+Shift+Alt+w"),"new-project":wr("Mod+Shift+Alt+p"),"new-todo":wr("Mod+Shift+Alt+t"),"new-assignment":wr("Mod+Shift+Alt+a")};function r5(e){const t={...n5};for(const n of am){const r=e[n];typeof r=="string"&&r.length>0&&(t[n]=r)}return t}function sa(){if(typeof navigator>"u")return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)||/Mac OS X/.test(t)}function s5(e){const t=e.split("+").map(o=>o.trim()),n=t[t.length-1]??"",r=new Set(t.slice(0,-1).map(o=>o.toLowerCase()));return{key:n.toLowerCase(),mod:r.has("mod"),shift:r.has("shift"),alt:r.has("alt"),ctrl:r.has("ctrl")}}function np(e,t){const n=s5(t);if(e.key.toLowerCase()!==n.key)return!1;const o=sa()?e.metaKey:e.ctrlKey;return!(n.mod&&!o||!n.mod&&!n.ctrl&&o||n.ctrl&&!e.ctrlKey||n.shift&&!e.shiftKey||!n.shift&&!(n.key.length===1&&!/^[a-z0-9]$/.test(n.key))&&e.shiftKey||n.alt&&!e.altKey||!n.alt&&e.altKey)}function K2(e){const t=[],n=sa()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const r=e.key;let o;r===" "||r==="Spacebar"?o="space":(r.length,o=r.toLowerCase());const i=o.length===1&&/^[a-z0-9]$/.test(o);e.shiftKey&&i&&t.push("shift");const a=[...t,o].join("+");return wr(a)}function Qs(e){return e.split("+").map(n=>{const r=n.toLowerCase();return r==="mod"?sa()?"⌘":"Ctrl":r==="shift"?sa()?"⇧":"Shift":r==="alt"?sa()?"⌥":"Alt":r==="ctrl"?sa()?"⌃":"Ctrl":r==="enter"?"↵":r==="escape"?"Esc":r==="arrowup"?"↑":r==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(sa()?"":"+")}function o5(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),Ei(u=>{u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function G2(e=!0){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch("/api/todos");if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[]);return m.useEffect(()=>{if(!e){o(!1);return}l()},[l,e]),Ei(u=>{e&&u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}async function ew(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}`,{description:t,tags:n})}async function Y2(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/complete`,{summary:"Completed."})}async function X2(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/block`,{reason:n})}async function Q2(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/start`,{session:n})}async function J2(e,t){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{})}async function Z2(e,t){await i5(`/api/todos/${encodeURIComponent(e)}/${t}`)}async function eT(e,t,n){const r=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}function tw(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function tT(e,t,n){for(const r of n){const o=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(r.name||"file"),"x-attachment-mime":r.type||"application/octet-stream"},body:r});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function nT(e,t,n){const r=await fetch(tw(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function Ti(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.text().catch(()=>"");let o=null;try{o=r?JSON.parse(r):null}catch{}const i=(o==null?void 0:o.error)||r||`HTTP ${n.status}`,a=new Error(i);throw a.status=n.status,a}return n.json().catch(()=>({}))}async function i5(e){const t=await fetch(e,{method:"DELETE"});if(!t.ok){const n=await t.text().catch(()=>"");let r=null;try{r=n?JSON.parse(n):null}catch{}const o=(r==null?void 0:r.error)||n||`HTTP ${t.status}`,i=new Error(o);throw i.status=t.status,i}}async function a5(e,t){return await Ti(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function l5(e){return await Ti("/api/todos/promote-bulk",e)}async function c5(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const lm=["assignment","project","todo","server","playbook"],fa={defaultScope:"all",aliases:{a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},externalIds:!0},rT=["kind","status","tag","tags","assignee","type","project","externalid","jira","title","search"],Cb="all",sT=/^[a-z][a-z0-9]*$/;function nw(e){return typeof e=="string"&&lm.includes(e)}function u5(e){return e==="all"||nw(e)}function d5(e){if(!e||typeof e!="object")return p5();const t=e,n=u5(t.defaultScope)?t.defaultScope:fa.defaultScope,r=typeof t.externalIds=="boolean"?t.externalIds:fa.externalIds;let o;if(t.aliases&&typeof t.aliases=="object"){o={};for(const[i,a]of Object.entries(t.aliases))sT.test(i)&&i!==Cb&&!rT.includes(i)&&nw(a)&&(o[i]=a)}else o={...fa.aliases};return{defaultScope:n,aliases:o,externalIds:r}}function f5(e){if(!e||typeof e!="object")return{ok:!1,errors:["aliases must be an object"]};const t=[];for(const[n,r]of Object.entries(e))sT.test(n)||t.push(`alias key "${n}" must be lowercase and match [a-z][a-z0-9]*`),n===Cb&&t.push(`alias key "${Cb}" is reserved (the "search everything" escape)`),rT.includes(n)&&t.push(`alias key "${n}" collides with the reserved field name "${n}"`),nw(r)||t.push(`alias "${n}" must map to one of: ${lm.join(", ")}`);return t.length===0?{ok:!0}:{ok:!1,errors:t}}function p5(){return{defaultScope:fa.defaultScope,aliases:{...fa.aliases},externalIds:fa.externalIds}}const rw={search:fa,custom:!1};let El=null,cl=null,uh=0;const Eb=new Set;function oT(e){El=e;for(const t of Eb)t(e)}function sw(e){if(!e||typeof e!="object")return rw;const t=e;return{search:d5(t.search),custom:t.custom===!0}}function h5(){if(El)return Promise.resolve(El);if(cl)return cl;const e=++uh;return cl=fetch("/api/config/search").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{cl=null;const n=sw(t);return e!==uh?El??n:(El=n,n)}).catch(()=>(cl=null,rw)),cl}function ow(){const[e,t]=m.useState(()=>El??rw);return m.useEffect(()=>{let n=!1;return h5().then(r=>{n||t(r)}),Eb.add(t),()=>{n=!0,Eb.delete(t)}},[]),e}async function m5(e){var r;++uh;const t=await fetch("/api/config/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const o=await t.json().catch(()=>null);throw new Error(((r=o==null?void 0:o.errors)==null?void 0:r.join("; "))??(o==null?void 0:o.error)??`HTTP ${t.status}`)}const n=sw(await t.json());return oT(n),n}async function g5(){++uh;const e=await fetch("/api/config/search",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=sw(await e.json());return oT(t),t}const x5=new Set(["/projects","/assignments","/servers","/todos"]);function Ip(e,t){return x5.has(e)?`${t}${e}`:e}const y5=[{id:"page-overview",title:"Overview",basePath:"/",keywords:["home","dashboard"]},{id:"page-projects",title:"Projects",basePath:"/projects",keywords:[]},{id:"page-assignments",title:"Assignments",basePath:"/assignments",keywords:[]},{id:"page-todos",title:"Todos",basePath:"/todos",keywords:["tasks"]},{id:"page-servers",title:"Servers",basePath:"/servers",keywords:["sessions"]},{id:"page-playbooks",title:"Playbooks",basePath:"/playbooks",keywords:[]},{id:"page-memories",title:"Memories",basePath:"/memories",keywords:["knowledge","learnings"]},{id:"page-resources",title:"Resources",basePath:"/resources",keywords:["knowledge","reference"]},{id:"page-workflow",title:"Workflow",basePath:"/workflow",keywords:["statuses","transitions","derive","facts"]},{id:"page-settings",title:"Settings",basePath:"/settings",keywords:[]},{id:"page-help",title:"Help",basePath:"/help",keywords:["shortcuts"]}];function b5(e){if(!(e!=null&&e.length))return[];const t=[];for(const n of e)n.id&&(t.push(n.id),n.system&&t.push(`${n.system}:${n.id}`));return t}function v5(e){const t=[],n=e.externalIds!==!1,r=i=>n?b5(i):[],o=i=>n?i:void 0;for(const i of y5)t.push({type:"page",id:i.id,title:i.title,keywords:[...i.keywords],route:Ip(i.basePath,e.wsPrefix)});for(const i of e.projects??[]){const a=i.workspace?`/w/${i.workspace}`:"";t.push({type:"project",id:`project-${i.slug}`,title:i.title,subtitle:i.slug,keywords:[...i.tags??[],...r(i.externalIds)],route:`${a}/projects/${i.slug}`,tags:i.tags,project:i.slug,externalIds:o(i.externalIds)}),t.push({type:"todo",id:`project-todos-${i.slug}`,title:`${i.title} todos`,subtitle:`${i.slug} · project`,keywords:[...i.tags??[],"project","todos"],route:`${a}/projects/${i.slug}?tab=todos`})}for(const i of e.assignments??[]){const a=i.projectWorkspace?`/w/${i.projectWorkspace}`:"";t.push({type:"assignment",id:i.projectSlug===null?`assignment-standalone-${i.id}`:`assignment-${i.projectSlug}-${i.slug}`,title:i.title,subtitle:`${i.projectTitle} · ${i.status}`,keywords:[i.projectSlug??"standalone",i.assignee??"",...r(i.externalIds)].filter(l=>!!l),route:i.projectSlug===null?`/assignments/${i.id}`:`${a}/projects/${i.projectSlug}/assignments/${i.slug}`,status:i.status,tags:i.tags,assignee:i.assignee,assignmentType:i.type,project:i.projectSlug,externalIds:o(i.externalIds)})}for(const i of e.playbooks??[])t.push({type:"playbook",id:`playbook-${i.slug}`,title:i.name,subtitle:i.description,keywords:i.tags,route:`/playbooks/${i.slug}`,tags:i.tags});for(const i of e.servers??[])t.push({type:"server",id:`server-${i.name}`,title:i.name,subtitle:i.alive?"alive":"dead",route:`${Ip("/servers",e.wsPrefix)}#server-${encodeURIComponent(i.name)}`});for(const i of e.todos??[]){const a=i.workspace&&i.workspace!=="_ungrouped"?`/w/${i.workspace}`:e.wsPrefix,l=Ip("/todos",a);t.push({type:"todo",id:`todo-${i.id}`,title:i.description,subtitle:i.status,keywords:i.tags,route:`${l}?focus=${encodeURIComponent(i.id)}`,status:i.status,tags:i.tags})}return t}function w5(e){return!e.standalone&&!!e.projectWorkspace&&e.fileKind!=="memory"&&e.fileKind!=="resource"?`/w/${e.projectWorkspace}`:""}function j5(e){return e.map((t,n)=>({type:"content",id:`content-${t.path}-${n}`,title:`${t.assignmentSlug??t.itemSlug??""} › ${t.section??t.fileKind}`,subtitle:t.projectSlug??(t.standalone?"standalone":void 0),route:`${w5(t)}${t.route}`,project:t.projectSlug,snippet:t.snippet,snippetMatches:t.matches}))}function Ir(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Lp(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function k5(e,t,n){const r=t?"disable":"enable",o=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${r}`,{method:"POST"});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error||`Failed to ${r} playbook`)}n()}async function ey(e,t){const n=await fetch(`/api/todos/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Failed to create todo (HTTP ${n.status})`)}}async function D1(){const e=await fetch("/api/workspaces");if(!e.ok)throw new Error(`Failed to load workspaces (HTTP ${e.status})`);const t=await e.json();return{workspaces:Array.isArray(t.workspaces)?t.workspaces:[],hasUngrouped:t.hasUngrouped===!0}}async function $1(){const e=await fetch("/api/projects");if(!e.ok)throw new Error(`Failed to load projects (HTTP ${e.status})`);const t=await e.json();return Array.isArray(t)?t:[]}async function ty(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to load template (HTTP ${t.status})`);const n=await t.json();if(!n.content)throw new Error("Template returned no content");return n.content}function Xi(e,t,n){const r=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!r)return`---
|
|
546
|
+
*/const Pd=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function b2(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=b2(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function OO(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=b2(e))&&(r&&(r+=" "),r+=t);return r}const Kv="-",FO=e=>{const t=BO(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const l=a.split(Kv);return l[0]===""&&l.length!==1&&l.shift(),v2(l,t)||zO(a)},getConflictingClassGroupIds:(a,l)=>{const u=n[a]||[];return l&&r[a]?[...u,...r[a]]:u}}},v2=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?v2(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Kv);return(a=t.validators.find(({validator:l})=>l(i)))==null?void 0:a.classGroupId},E1=/^\[(.+)\]$/,zO=e=>{if(E1.test(e)){const t=E1.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},BO=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return HO(Object.entries(e.classGroups),n).forEach(([i,a])=>{wb(a,r,i,t)}),r},wb=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:T1(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(UO(o)){wb(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,a])=>{wb(a,T1(t,i),n,r)})})},T1=(e,t)=>{let n=e;return t.split(Kv).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},UO=e=>e.isThemeGetter,HO=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,l])=>[t+a,l])):i);return[n,o]}):e,VO=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;if((a=r.get(i))!==void 0)return o(i,a),a},set(i,a){n.has(i)?n.set(i,a):o(i,a)}}},w2="!",WO=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,a=l=>{const u=[];let f=0,p=0,h;for(let b=0;b<l.length;b++){let j=l[b];if(f===0){if(j===o&&(r||l.slice(b,b+i)===t)){u.push(l.slice(p,b)),p=b+i;continue}if(j==="/"){h=b;continue}}j==="["?f++:j==="]"&&f--}const g=u.length===0?l:l.substring(p),y=g.startsWith(w2),k=y?g.substring(1):g,v=h&&h>p?h-p:void 0;return{modifiers:u,hasImportantModifier:y,baseClassName:k,maybePostfixModifierPosition:v}};return n?l=>n({className:l,parseClassName:a}):a},qO=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},KO=e=>({cache:VO(e.cacheSize),parseClassName:WO(e),...FO(e)}),GO=/\s+/,YO=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],a=e.trim().split(GO);let l="";for(let u=a.length-1;u>=0;u-=1){const f=a[u],{modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}=n(f);let k=!!y,v=r(k?g.substring(0,y):g);if(!v){if(!k){l=f+(l.length>0?" "+l:l);continue}if(v=r(g),!v){l=f+(l.length>0?" "+l:l);continue}k=!1}const b=qO(p).join(":"),j=h?b+w2:b,N=j+v;if(i.includes(N))continue;i.push(N);const S=o(v,k);for(let C=0;C<S.length;++C){const D=S[C];i.push(j+D)}l=f+(l.length>0?" "+l:l)}return l};function XO(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=j2(t))&&(r&&(r+=" "),r+=n);return r}const j2=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=j2(e[r]))&&(n&&(n+=" "),n+=t);return n};function QO(e,...t){let n,r,o,i=a;function a(u){const f=t.reduce((p,h)=>h(p),e());return n=KO(f),r=n.cache.get,o=n.cache.set,i=l,l(u)}function l(u){const f=r(u);if(f)return f;const p=YO(u,n);return o(u,p),p}return function(){return i(XO.apply(null,arguments))}}const Jt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},k2=/^\[(?:([a-z-]+):)?(.+)\]$/i,JO=/^\d+\/\d+$/,ZO=new Set(["px","full","screen"]),e4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,t4=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,n4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,r4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,s4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,yo=e=>Ll(e)||ZO.has(e)||JO.test(e),ai=e=>yc(e,"length",f4),Ll=e=>!!e&&!Number.isNaN(Number(e)),Zx=e=>yc(e,"number",Ll),hu=e=>!!e&&Number.isInteger(Number(e)),o4=e=>e.endsWith("%")&&Ll(e.slice(0,-1)),jt=e=>k2.test(e),li=e=>e4.test(e),i4=new Set(["length","size","percentage"]),a4=e=>yc(e,i4,S2),l4=e=>yc(e,"position",S2),c4=new Set(["image","url"]),u4=e=>yc(e,c4,h4),d4=e=>yc(e,"",p4),mu=()=>!0,yc=(e,t,n)=>{const r=k2.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},f4=e=>t4.test(e)&&!n4.test(e),S2=()=>!1,p4=e=>r4.test(e),h4=e=>s4.test(e),m4=()=>{const e=Jt("colors"),t=Jt("spacing"),n=Jt("blur"),r=Jt("brightness"),o=Jt("borderColor"),i=Jt("borderRadius"),a=Jt("borderSpacing"),l=Jt("borderWidth"),u=Jt("contrast"),f=Jt("grayscale"),p=Jt("hueRotate"),h=Jt("invert"),g=Jt("gap"),y=Jt("gradientColorStops"),k=Jt("gradientColorStopPositions"),v=Jt("inset"),b=Jt("margin"),j=Jt("opacity"),N=Jt("padding"),S=Jt("saturate"),C=Jt("scale"),D=Jt("sepia"),T=Jt("skew"),R=Jt("space"),$=Jt("translate"),P=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto",jt,t],V=()=>[jt,t],U=()=>["",yo,ai],I=()=>["auto",Ll,jt],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>["start","end","center","between","around","evenly","stretch"],H=()=>["","0",jt],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>[Ll,jt];return{cacheSize:500,separator:":",theme:{colors:[mu],spacing:[yo,ai],blur:["none","",li,jt],brightness:z(),borderColor:[e],borderRadius:["none","","full",li,jt],borderSpacing:V(),borderWidth:U(),contrast:z(),grayscale:H(),hueRotate:z(),invert:H(),gap:V(),gradientColorStops:[e],gradientColorStopPositions:[o4,ai],inset:_(),margin:_(),opacity:z(),padding:V(),saturate:z(),scale:z(),sepia:H(),skew:z(),space:V(),translate:V()},classGroups:{aspect:[{aspect:["auto","square","video",jt]}],container:["container"],columns:[{columns:[li]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),jt]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",hu,jt]}],basis:[{basis:_()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",jt]}],grow:[{grow:H()}],shrink:[{shrink:H()}],order:[{order:["first","last","none",hu,jt]}],"grid-cols":[{"grid-cols":[mu]}],"col-start-end":[{col:["auto",{span:["full",hu,jt]},jt]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[mu]}],"row-start-end":[{row:["auto",{span:[hu,jt]},jt]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",jt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",jt]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...O()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...O(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...O(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",jt,t]}],"min-w":[{"min-w":[jt,t,"min","max","fit"]}],"max-w":[{"max-w":[jt,t,"none","full","min","max","fit","prose",{screen:[li]},li]}],h:[{h:[jt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[jt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[jt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[jt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",li,ai]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Zx]}],"font-family":[{font:[mu]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",jt]}],"line-clamp":[{"line-clamp":["none",Ll,Zx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",yo,jt]}],"list-image":[{"list-image":["none",jt]}],"list-style-type":[{list:["none","disc","decimal",jt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",yo,ai]}],"underline-offset":[{"underline-offset":["auto",yo,jt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",jt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",jt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),l4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",a4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},u4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-to-pos":[{to:[k]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[j]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[j]}],"divide-style":[{divide:B()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...B()]}],"outline-offset":[{"outline-offset":[yo,jt]}],"outline-w":[{outline:[yo,ai]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[yo,ai]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",li,d4]}],"shadow-color":[{shadow:[mu]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",li,jt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[h]}],saturate:[{saturate:[S]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",jt]}],duration:[{duration:z()}],ease:[{ease:["linear","in","out","in-out",jt]}],delay:[{delay:z()}],animate:[{animate:["none","spin","ping","pulse","bounce",jt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[hu,jt]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",jt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",jt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",jt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[yo,ai,Zx]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},g4=QO(m4);function je(...e){return g4(OO(e))}function Yn(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Nr(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function N2(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Gv(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Yv(e){if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=Math.floor((Date.now()-t.getTime())/1e3);if(n<60)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Xl(e){return e.toLocaleString("en-US")}function Ql(e){if(!Number.isFinite(e))return"$0.00";const t=e!==0&&Math.abs(e)<1?4:2;return e.toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:t})}function x4(e){if(!e)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return e;const[,n,r,o]=t,i=new Date(Number(n),Number(r)-1,Number(o));return Number.isNaN(i.getTime())?e:i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function bn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function C2(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function E2(e){let t=C2(e);const n=t.match(/^\/w\/[^/]+(\/.*)?$/);return n&&(t=n[1]||"/"),t==="/"?"/":t.startsWith("/archive")?"/archive":t.startsWith("/projects")?/^\/projects\/[^/]+\/assignments\//.test(t)?"/assignments":"/projects":t.startsWith("/assignments")?"/assignments":t.startsWith("/servers")?"/servers":t.startsWith("/inventories")?"/inventories":t.startsWith("/schedules")?"/schedules":t.startsWith("/usage")?"/usage":t.startsWith("/agent-sessions")?"/agent-sessions":t.startsWith("/playbooks")?"/playbooks":t.startsWith("/memories")?"/memories":t.startsWith("/resources")?"/resources":t.startsWith("/todos")?"/todos":t.startsWith("/views")?"/views":t.startsWith("/help")?"/help":t.startsWith("/settings")?"/settings":t.startsWith("/workflow")?"/workflow":t.startsWith("/inbox")?"/inbox":null}function T2(e,t){return E2(e)===t}function R2(e){let n=C2(e).split("/").filter(Boolean);const r=[];let o="Overview",i=null,a="";if(n[0]==="w"&&n[1]&&(a=`/w/${n[1]}`,r.push({label:bn(n[1]),path:`${a}/projects`}),n=n.slice(2)),n.length===0)return{title:o,breadcrumbs:r,projectSlug:i};if(n[0]==="projects"){if(r.push({label:"Projects",path:`${a}/projects`}),o="Projects",n[1]&&(i=n[1],r.push({label:bn(n[1]),path:`${a}/projects/${n[1]}`}),o=bn(n[1])),n[2]==="edit")o="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")o="Create Assignment";else if(n[2]==="assignments"&&n[3])r.push({label:bn(n[3]),path:`${a}/projects/${n[1]}/assignments/${n[3]}`}),o=bn(n[3]),n[4]==="edit"?o="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?o="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?o="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?o="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(o="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const l=n[2]==="memories"?"Memories":"Resources",u=n[2]==="memories"?"/memories":"/resources";r.push({label:l,path:u}),r.push({label:bn(n[3]),path:`${a}/projects/${n[1]}/${n[2]}/${n[3]}`}),o=bn(n[3]),n[4]==="edit"&&(o=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(o="Servers",r.push({label:"Servers",path:`${a}/servers`})):n[0]==="inventories"?(o="Inventories",r.push({label:"Inventories",path:`${a}/inventories`})):n[0]==="schedules"?(o="Schedules",r.push({label:"Schedules",path:`${a}/schedules`})):n[0]==="usage"?(o="Usage",r.push({label:"Usage",path:`${a}/usage`})):n[0]==="agent-sessions"?(o="Agent Sessions",r.push({label:"Agent Sessions",path:`${a}/agent-sessions`})):n[0]==="assignments"?(o="Assignments",r.push({label:"Assignments",path:`${a}/assignments`})):n[0]==="archive"?(o="Archive",r.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(r.push({label:"Playbooks",path:"/playbooks"}),o="Playbooks",n[1]==="create"?o="Create Playbook":n[1]&&n[2]==="edit"?(r.push({label:bn(n[1]),path:`/playbooks/${n[1]}`}),o="Edit Playbook"):n[1]&&(r.push({label:bn(n[1]),path:`/playbooks/${n[1]}`}),o=bn(n[1]))):n[0]==="memories"?(r.push({label:"Memories",path:"/memories"}),o="Memories",n[1]==="new"&&(o="New Memory")):n[0]==="resources"?(r.push({label:"Resources",path:"/resources"}),o="Resources",n[1]==="new"&&(o="New Resource")):n[0]==="todos"?(o="Todos",r.push({label:"Todos",path:`${a}/todos`})):n[0]==="views"?(o="Saved Views",r.push({label:"Saved Views",path:`${a}/views`}),n[1]&&(o="View")):n[0]==="help"?(o="Help",r.push({label:"Help",path:"/help"})):n[0]==="settings"?(o="Settings",r.push({label:"Settings",path:"/settings"})):n[0]==="workflow"?(o="Workflow",r.push({label:"Workflow",path:"/workflow"})):n[0]==="create"&&n[1]==="project"&&(o="Create Project",r.push({label:"Create Project",path:`${a}/create/project`}));return{title:o,breadcrumbs:r,projectSlug:i}}function A2({item:e,onNavigate:t}){const n=rr(),r=e.icon,o=T2(n.pathname,e.to)&&!n.pathname.startsWith("/w/");return s.jsxs(De,{to:e.to,onClick:t,className:je("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition",o?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[s.jsx(r,{className:"h-4 w-4"}),s.jsx("span",{children:e.label}),e.badge&&e.badge>0?s.jsx("span",{className:je("ml-auto inline-flex min-w-[1.25rem] items-center justify-center rounded-full px-1.5 py-0.5 text-[11px] font-semibold",o?"bg-background/20 text-background":"bg-foreground text-background"),children:e.badge}):null]})}function R1({items:e,onNavigate:t}){return s.jsx("nav",{className:"space-y-1",children:e.map(n=>s.jsx(A2,{item:n,onNavigate:t},n.to))})}function y4({label:e,items:t,collapsed:n,onToggle:r,containsActive:o,onNavigate:i}){const a=n&&o;return s.jsxs("div",{children:[s.jsxs("button",{type:"button",onClick:r,"aria-expanded":!n,className:je("flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition",a?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"),children:[s.jsx(cr,{className:je("h-3 w-3 transition-transform",n&&"-rotate-90")}),e]}),n?null:s.jsx("nav",{className:"space-y-1",children:t.map(l=>s.jsx(A2,{item:l,onNavigate:i},l.to))})]})}const P2=[{slug:"default",label:"Syntaur",description:"Brand purple, warm yellow, coral & teal accents.",swatches:{primary:"oklch(70% 0.18 290)",secondary:"oklch(80% 0.14 75)",coral:"oklch(72% 0.17 15)",teal:"oklch(72% 0.14 185)",amber:"oklch(82% 0.16 75)"}},{slug:"ocean",label:"Midnight",description:"Deep indigo-blue with cyan accents. Inspired by One Dark Pro.",swatches:{primary:"oklch(70% 0.16 240)",secondary:"oklch(78% 0.13 200)",coral:"oklch(72% 0.18 350)",teal:"oklch(78% 0.14 195)",amber:"oklch(84% 0.15 90)"}},{slug:"forest",label:"Verdant",description:"Saturated emerald and pine on a dark olive base.",swatches:{primary:"oklch(72% 0.17 145)",secondary:"oklch(80% 0.13 110)",coral:"oklch(72% 0.17 25)",teal:"oklch(75% 0.13 175)",amber:"oklch(82% 0.16 95)"}},{slug:"sunset",label:"Ember",description:"Warm sepia surfaces with copper and amber accents.",swatches:{primary:"oklch(72% 0.18 35)",secondary:"oklch(80% 0.16 60)",coral:"oklch(72% 0.19 15)",teal:"oklch(72% 0.12 180)",amber:"oklch(86% 0.17 70)"}}],b4=P2.map(e=>e.slug),lh="default";function _2(e){return typeof e=="string"&&b4.includes(e)}const D2={preset:lh,custom:!1};let Du=null,ll=null;function Xv(e){if(!e||typeof e!="object")return D2;const t=e;return{preset:_2(t.preset)?t.preset:lh,custom:t.custom===!0}}function v4(){return Du?Promise.resolve(Du):ll||(ll=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Xv(e);return Du=t,ll=null,t}).catch(()=>(ll=null,D2)),ll)}async function w4(e){const t=await fetch("/api/config/theme",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({preset:e})});if(!t.ok){const r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));throw new Error(r.error??"Failed to save theme")}const n=Xv(await t.json());return Du=n,n}async function j4(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Xv(await e.json());return Du=t,t}const jb="syntaur-theme",Dp="syntaur-preset",$2=m.createContext(null);function kb(){try{const e=window.localStorage.getItem(jb);return e==="light"||e==="dark"?e:null}catch{return null}}function I2(){try{const e=window.localStorage.getItem(Dp);return _2(e)?e:lh}catch{return lh}}function L2(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function M2(e){document.documentElement.classList.toggle("dark",e==="dark")}function O2(e){document.documentElement.dataset.theme=e}function k4(){typeof document>"u"||(M2(kb()??L2()),O2(I2()))}function S4({children:e}){const[t,n]=m.useState(()=>kb()),[r,o]=m.useState(()=>kb()??L2()),[i,a]=m.useState(()=>I2());m.useEffect(()=>{M2(r)},[r]),m.useEffect(()=>{O2(i)},[i]),m.useEffect(()=>{let p=!1;return v4().then(h=>{if(!p&&h.preset!==i){a(h.preset);try{window.localStorage.setItem(Dp,h.preset)}catch{}}}),()=>{p=!0}},[]),m.useEffect(()=>{if(!window.matchMedia)return;const p=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{t||o(p.matches?"dark":"light")};return h(),p.addEventListener("change",h),()=>{p.removeEventListener("change",h)}},[t]);async function l(p){a(p);try{window.localStorage.setItem(Dp,p)}catch{}await w4(p)}async function u(){const p=await j4();a(p.preset);try{window.localStorage.setItem(Dp,p.preset)}catch{}}const f={resolvedTheme:r,explicitTheme:t,setTheme:p=>{window.localStorage.setItem(jb,p),n(p),o(p)},toggleTheme:()=>{const p=r==="dark"?"light":"dark";window.localStorage.setItem(jb,p),n(p),o(p)},preset:i,setPreset:l,resetPreset:u};return s.jsx($2.Provider,{value:f,children:e})}function Qv(){const e=m.useContext($2);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const N4=2e3,$u=new Set;let ps=null,ia=null,$p=!1,ch="closed";const Sb=new Set;function Ru(e){if(ch!==e){ch=e;for(const t of Sb)t(e)}}function A1(){return ch}function C4(e){return Sb.add(e),()=>{Sb.delete(e)}}function E4(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}let T4=E4;function R4(){ia&&clearTimeout(ia),ia=setTimeout(()=>{ia=null,F2()},N4)}function F2(){if(ps&&(ps.readyState===WebSocket.OPEN||ps.readyState===WebSocket.CONNECTING))return;$p=!1,ch==="closed"&&Ru("connecting");const e=new WebSocket(T4());ps=e,e.onopen=()=>{ps===e&&Ru("open")},e.onmessage=t=>{if(ps===e)try{const n=JSON.parse(t.data);for(const r of $u)r(n)}catch{}},e.onclose=()=>{if(ps===e){if(ps=null,$p||$u.size===0){$p=!1,Ru("closed");return}Ru("reconnecting"),R4()}},e.onerror=()=>{e.close()}}function A4(e){return $u.add(e),F2(),()=>{$u.delete(e),$u.size===0&&(ia&&(clearTimeout(ia),ia=null),ps&&($p=!0,ps.close(),ps=null),Ru("closed"))}}function Ei(e){const t=m.useRef(e);t.current=e,m.useEffect(()=>A4(o=>t.current(o)),[])}const sm=["7d","30d","90d","all","custom"],z2="30d",P4=/^\d{4}-\d{2}-\d{2}$/,_d=["project","workspace","model","tool"],_4={"7d":7,"30d":30,"90d":90};function Iu(e){if(typeof e!="string"||!P4.test(e))return!1;const[t,n,r]=e.split("-").map(Number);if(n<1||n>12||r<1||r>31)return!1;const o=new Date(Date.UTC(t,n-1,r));return o.getUTCFullYear()===t&&o.getUTCMonth()===n-1&&o.getUTCDate()===r}function P1(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${r}`}function D4(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function $4(e,t=new Date){const n=e.window??z2;if(n==="all")return{};if(n==="custom"){const o={};return e.since&&(o.since=e.since),e.until&&(o.until=e.until),o}const r=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return{since:P1(D4(r,-(_4[n]-1))),until:P1(r)}}function I4(e){const t=[];if(!e||typeof e!="object"||Array.isArray(e))return{ok:!1,errors:["filters must be an object"]};const n=e;n.window!==void 0&&!sm.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const r of["since","until"])n[r]!==void 0&&!Iu(n[r])&&t.push(`invalid ${r}: ${String(n[r])} (expected YYYY-MM-DD)`);for(const r of _d)n[r]!==void 0&&(typeof n[r]!="string"||n[r].length===0)&&t.push(`invalid ${r}: must be a non-empty string`);return Iu(n.since)&&Iu(n.until)&&n.since>n.until&&t.push("since must be on or before until"),{ok:t.length===0,errors:t}}function Dd(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;typeof n.window=="string"&&sm.includes(n.window)&&(t.window=n.window),Iu(n.since)&&(t.since=n.since),Iu(n.until)&&(t.until=n.until);for(const r of _d)typeof n[r]=="string"&&n[r].length>0&&(t[r]=n[r]);return t.window!=="custom"&&(delete t.since,delete t.until),t}function Nb(e){const t=Dd(e),n=new URLSearchParams;t.window&&n.set("window",t.window),t.window==="custom"&&(t.since&&n.set("since",t.since),t.until&&n.set("until",t.until));for(const r of _d)t[r]&&n.set(r,t[r]);return n}function L4(e){const t={};for(const n of["window","since","until",..._d]){const r=e.get(n);r!==null&&(t[n]=r)}return Dd(t)}function B2(e,t=new Date){const n=Dd(e),{since:r,until:o}=$4(n,t),i=new URLSearchParams;r&&i.set("since",r),o&&i.set("until",o);for(const a of _d)n[a]&&i.set(a,n[a]);return i}const M4={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function _1(e){const t=Dd(e),n=t.window??z2,r=[];return r.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:M4[n]),t.workspace&&r.push(`workspace: ${t.workspace}`),t.project&&r.push(`project: ${t.project}`),t.model&&r.push(`model: ${t.model}`),t.tool&&r.push(`tool: ${t.tool}`),r.join(" · ")}function tn(e,t,n=!0,r=!1){const[o,i]=m.useState(null),[a,l]=m.useState(!0),[u,f]=m.useState(null),[p,h]=m.useState(0),g=m.useRef(!1),y=n?e:null,k=m.useCallback(()=>{h(b=>b+1)},[]),v=m.useRef(y);return r&&v.current!==y&&(v.current=y,i(null),g.current=!1,f(null),l(!0)),m.useEffect(()=>{if(!y){l(!1),i(null),g.current=!1;return}let b=!1;return l(!g.current),f(null),fetch(y).then(async j=>{if(!j.ok){const N=await j.json().catch(()=>null);throw new Error((N==null?void 0:N.error)||`HTTP ${j.status}`)}return j.json()}).then(j=>{b||(i(j),g.current=!0,l(!1))}).catch(j=>{b||(f(j.message),l(!1))}),()=>{b=!0}},[y,p]),Ei(b=>{!t||!y||((b.type==="project-updated"||b.type==="assignment-updated")&&k(),b.type==="servers-updated"&&t==="servers"&&k(),b.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&k(),b.type==="playbooks-updated"&&t==="playbooks"&&k(),b.type==="leases-updated"&&t==="inventories"&&k())}),{data:o,loading:a,error:u,refetch:k}}function to(e=!0){return tn("/api/projects","projects",e)}function Ea(){return tn("/api/workspaces","projects")}function mn(){const{workspace:e}=qt();return e?`/w/${e}`:""}function O4(e={}){const t=new URLSearchParams;typeof e.staleLimit=="number"&&Number.isFinite(e.staleLimit)&&t.set("staleLimit",String(e.staleLimit)),typeof e.staleOffset=="number"&&Number.isFinite(e.staleOffset)&&t.set("staleOffset",String(e.staleOffset));const n=t.toString(),r=n?`/api/overview?${n}`:"/api/overview";return tn(r,"overview")}function om(e=!0){return tn("/api/assignments","assignments",e)}function F4(e=!0){return tn("/api/archived","assignments",e)}function U2(){return tn("/api/help")}function H2(e){const t=e?`/api/projects/${e}`:null;return tn(t,"project",!0,!0)}function z4(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return tn(n,"assignment",!0,!0)}function B4(e){const t=e?`/api/assignments/${e}`:null;return tn(t,"assignment",!0,!0)}function V2(e){return tn(e,void 0,!0,!0)}function Jv(e=!0){return tn("/api/servers","servers",e)}function W2(){return tn("/api/leases","inventories")}function im(){return tn("/api/agent-sessions","agent-sessions")}function U4(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return tn(n,"agent-sessions",!0,!0)}function H4(e){const t=e?`/api/assignments/${e}/sessions`:null;return tn(t,"agent-sessions",!0,!0)}function V4(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return tn(n,void 0,!0,!0)}function W4(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return tn(t,void 0,!0,!0)}function Zv(e=!0){return tn("/api/playbooks","playbooks",e)}function q4(e){const t=B2(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return tn(n,void 0,!0,!0)}function q2(e=!0){return tn("/api/usage/facets",void 0,e)}function K4(e){const t=e?`/api/playbooks/${e}`:null;return tn(t,"playbooks",!0,!0)}function G4(){return tn("/api/memories","project")}function Y4(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return tn(n,"project",!0,!0)}function X4(){return tn("/api/resources","project")}function Q4(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return tn(n,"project",!0,!0)}const am=["new-workspace","new-project","new-todo","new-assignment"];function J4(e){return typeof e=="string"&&am.includes(e)}const Z4=["mod+k","mod+shift+k","?","escape","enter","shift+t","g","g o","g m","g a","g t","g s","g !","g ,","j","k","o","a","e","/","r","p","h","d","s","[","]"],e5=["mod","ctrl","alt","shift"];function wr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(wr).filter(l=>l.length>0).join(" ");const n=t.split("+").map(l=>l.trim()).filter(l=>l.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const r=n[n.length-1].toLowerCase(),o=n.slice(0,-1).map(l=>l.toLowerCase()),i=new Set,a=[];for(const l of e5)o.includes(l)&&!i.has(l)&&(a.push(l),i.add(l));for(const l of o)i.has(l)||(a.push(l),i.add(l));return[...a,r].join("+")}function t5(e){const t=wr(e);return t?Z4.includes(t):!1}const n5={"new-workspace":wr("Mod+Shift+Alt+w"),"new-project":wr("Mod+Shift+Alt+p"),"new-todo":wr("Mod+Shift+Alt+t"),"new-assignment":wr("Mod+Shift+Alt+a")};function r5(e){const t={...n5};for(const n of am){const r=e[n];typeof r=="string"&&r.length>0&&(t[n]=r)}return t}function sa(){if(typeof navigator>"u")return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)||/Mac OS X/.test(t)}function s5(e){const t=e.split("+").map(o=>o.trim()),n=t[t.length-1]??"",r=new Set(t.slice(0,-1).map(o=>o.toLowerCase()));return{key:n.toLowerCase(),mod:r.has("mod"),shift:r.has("shift"),alt:r.has("alt"),ctrl:r.has("ctrl")}}function np(e,t){const n=s5(t);if(e.key.toLowerCase()!==n.key)return!1;const o=sa()?e.metaKey:e.ctrlKey;return!(n.mod&&!o||!n.mod&&!n.ctrl&&o||n.ctrl&&!e.ctrlKey||n.shift&&!e.shiftKey||!n.shift&&!(n.key.length===1&&!/^[a-z0-9]$/.test(n.key))&&e.shiftKey||n.alt&&!e.altKey||!n.alt&&e.altKey)}function K2(e){const t=[],n=sa()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const r=e.key;let o;r===" "||r==="Spacebar"?o="space":(r.length,o=r.toLowerCase());const i=o.length===1&&/^[a-z0-9]$/.test(o);e.shiftKey&&i&&t.push("shift");const a=[...t,o].join("+");return wr(a)}function Qs(e){return e.split("+").map(n=>{const r=n.toLowerCase();return r==="mod"?sa()?"⌘":"Ctrl":r==="shift"?sa()?"⇧":"Shift":r==="alt"?sa()?"⌥":"Alt":r==="ctrl"?sa()?"⌃":"Ctrl":r==="enter"?"↵":r==="escape"?"Esc":r==="arrowup"?"↑":r==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(sa()?"":"+")}function o5(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),Ei(u=>{u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function G2(e=!0){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch("/api/todos");if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[]);return m.useEffect(()=>{if(!e){o(!1);return}l()},[l,e]),Ei(u=>{e&&u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}async function ew(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}`,{description:t,tags:n})}async function Y2(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/complete`,{summary:"Completed."})}async function X2(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/block`,{reason:n})}async function Q2(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/start`,{session:n})}async function J2(e,t){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{})}async function Z2(e,t){await i5(`/api/todos/${encodeURIComponent(e)}/${t}`)}async function eT(e,t,n){const r=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}function tw(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function tT(e,t,n){for(const r of n){const o=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(r.name||"file"),"x-attachment-mime":r.type||"application/octet-stream"},body:r});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function nT(e,t,n){const r=await fetch(tw(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function Ti(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.text().catch(()=>"");let o=null;try{o=r?JSON.parse(r):null}catch{}const i=(o==null?void 0:o.error)||r||`HTTP ${n.status}`,a=new Error(i);throw a.status=n.status,a}return n.json().catch(()=>({}))}async function i5(e){const t=await fetch(e,{method:"DELETE"});if(!t.ok){const n=await t.text().catch(()=>"");let r=null;try{r=n?JSON.parse(n):null}catch{}const o=(r==null?void 0:r.error)||n||`HTTP ${t.status}`,i=new Error(o);throw i.status=t.status,i}}async function a5(e,t){return await Ti(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function l5(e){return await Ti("/api/todos/promote-bulk",e)}async function c5(e,t,n){await Ti(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const lm=["assignment","project","todo","server","playbook"],fa={defaultScope:"all",aliases:{a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},externalIds:!0},rT=["kind","status","tag","tags","assignee","type","project","externalid","jira","title","search"],Cb="all",sT=/^[a-z][a-z0-9]*$/;function nw(e){return typeof e=="string"&&lm.includes(e)}function u5(e){return e==="all"||nw(e)}function d5(e){if(!e||typeof e!="object")return p5();const t=e,n=u5(t.defaultScope)?t.defaultScope:fa.defaultScope,r=typeof t.externalIds=="boolean"?t.externalIds:fa.externalIds;let o;if(t.aliases&&typeof t.aliases=="object"){o={};for(const[i,a]of Object.entries(t.aliases))sT.test(i)&&i!==Cb&&!rT.includes(i)&&nw(a)&&(o[i]=a)}else o={...fa.aliases};return{defaultScope:n,aliases:o,externalIds:r}}function f5(e){if(!e||typeof e!="object")return{ok:!1,errors:["aliases must be an object"]};const t=[];for(const[n,r]of Object.entries(e))sT.test(n)||t.push(`alias key "${n}" must be lowercase and match [a-z][a-z0-9]*`),n===Cb&&t.push(`alias key "${Cb}" is reserved (the "search everything" escape)`),rT.includes(n)&&t.push(`alias key "${n}" collides with the reserved field name "${n}"`),nw(r)||t.push(`alias "${n}" must map to one of: ${lm.join(", ")}`);return t.length===0?{ok:!0}:{ok:!1,errors:t}}function p5(){return{defaultScope:fa.defaultScope,aliases:{...fa.aliases},externalIds:fa.externalIds}}const rw={search:fa,custom:!1};let El=null,cl=null,uh=0;const Eb=new Set;function oT(e){El=e;for(const t of Eb)t(e)}function sw(e){if(!e||typeof e!="object")return rw;const t=e;return{search:d5(t.search),custom:t.custom===!0}}function h5(){if(El)return Promise.resolve(El);if(cl)return cl;const e=++uh;return cl=fetch("/api/config/search").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{cl=null;const n=sw(t);return e!==uh?El??n:(El=n,n)}).catch(()=>(cl=null,rw)),cl}function ow(){const[e,t]=m.useState(()=>El??rw);return m.useEffect(()=>{let n=!1;return h5().then(r=>{n||t(r)}),Eb.add(t),()=>{n=!0,Eb.delete(t)}},[]),e}async function m5(e){var r;++uh;const t=await fetch("/api/config/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const o=await t.json().catch(()=>null);throw new Error(((r=o==null?void 0:o.errors)==null?void 0:r.join("; "))??(o==null?void 0:o.error)??`HTTP ${t.status}`)}const n=sw(await t.json());return oT(n),n}async function g5(){++uh;const e=await fetch("/api/config/search",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=sw(await e.json());return oT(t),t}const x5=new Set(["/projects","/assignments","/servers","/todos"]);function Ip(e,t){return x5.has(e)?`${t}${e}`:e}const y5=[{id:"page-overview",title:"Overview",basePath:"/",keywords:["home","dashboard"]},{id:"page-projects",title:"Projects",basePath:"/projects",keywords:[]},{id:"page-assignments",title:"Assignments",basePath:"/assignments",keywords:[]},{id:"page-todos",title:"Todos",basePath:"/todos",keywords:["tasks"]},{id:"page-servers",title:"Servers",basePath:"/servers",keywords:["sessions"]},{id:"page-playbooks",title:"Playbooks",basePath:"/playbooks",keywords:[]},{id:"page-memories",title:"Memories",basePath:"/memories",keywords:["knowledge","learnings"]},{id:"page-resources",title:"Resources",basePath:"/resources",keywords:["knowledge","reference"]},{id:"page-workflow",title:"Workflow",basePath:"/workflow",keywords:["statuses","transitions","derive","facts"]},{id:"page-settings",title:"Settings",basePath:"/settings",keywords:[]},{id:"page-help",title:"Help",basePath:"/help",keywords:["shortcuts"]}];function b5(e){if(!(e!=null&&e.length))return[];const t=[];for(const n of e)n.id&&(t.push(n.id),n.system&&t.push(`${n.system}:${n.id}`));return t}function v5(e){const t=[],n=e.externalIds!==!1,r=i=>n?b5(i):[],o=i=>n?i:void 0;for(const i of y5)t.push({type:"page",id:i.id,title:i.title,keywords:[...i.keywords],route:Ip(i.basePath,e.wsPrefix)});for(const i of e.projects??[]){const a=i.workspace?`/w/${i.workspace}`:"";t.push({type:"project",id:`project-${i.slug}`,title:i.title,subtitle:i.slug,keywords:[...i.tags??[],...r(i.externalIds)],route:`${a}/projects/${i.slug}`,tags:i.tags,project:i.slug,externalIds:o(i.externalIds)}),t.push({type:"todo",id:`project-todos-${i.slug}`,title:`${i.title} todos`,subtitle:`${i.slug} · project`,keywords:[...i.tags??[],"project","todos"],route:`${a}/projects/${i.slug}?tab=todos`})}for(const i of e.assignments??[]){const a=i.projectWorkspace?`/w/${i.projectWorkspace}`:"";t.push({type:"assignment",id:i.projectSlug===null?`assignment-standalone-${i.id}`:`assignment-${i.projectSlug}-${i.slug}`,title:i.title,subtitle:`${i.projectTitle} · ${i.status}`,keywords:[i.projectSlug??"standalone",i.assignee??"",...r(i.externalIds)].filter(l=>!!l),route:i.projectSlug===null?`/assignments/${i.id}`:`${a}/projects/${i.projectSlug}/assignments/${i.slug}`,status:i.status,tags:i.tags,assignee:i.assignee,assignmentType:i.type,project:i.projectSlug,externalIds:o(i.externalIds)})}for(const i of e.playbooks??[])t.push({type:"playbook",id:`playbook-${i.slug}`,title:i.name,subtitle:i.description,keywords:i.tags,route:`/playbooks/${i.slug}`,tags:i.tags});for(const i of e.servers??[])t.push({type:"server",id:`server-${i.name}`,title:i.name,subtitle:i.alive?"alive":"dead",route:`${Ip("/servers",e.wsPrefix)}#server-${encodeURIComponent(i.name)}`});for(const i of e.todos??[]){const a=i.workspace&&i.workspace!=="_ungrouped"?`/w/${i.workspace}`:e.wsPrefix,l=Ip("/todos",a);t.push({type:"todo",id:`todo-${i.id}`,title:i.description,subtitle:i.status,keywords:i.tags,route:`${l}?focus=${encodeURIComponent(i.id)}`,status:i.status,tags:i.tags})}return t}function w5(e){return!e.standalone&&!!e.projectWorkspace&&e.fileKind!=="memory"&&e.fileKind!=="resource"?`/w/${e.projectWorkspace}`:""}function j5(e){return e.map((t,n)=>({type:"content",id:`content-${t.path}-${n}`,title:`${t.assignmentSlug??t.itemSlug??""} › ${t.section??t.fileKind}`,subtitle:t.projectSlug??(t.standalone?"standalone":void 0),route:`${w5(t)}${t.route}`,project:t.projectSlug,snippet:t.snippet,snippetMatches:t.matches}))}function Ir(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Lp(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function k5(e,t,n){const r=t?"disable":"enable",o=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${r}`,{method:"POST"});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error||`Failed to ${r} playbook`)}n()}async function ey(e,t){const n=await fetch(`/api/todos/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`Failed to create todo (HTTP ${n.status})`)}}async function D1(){const e=await fetch("/api/workspaces");if(!e.ok)throw new Error(`Failed to load workspaces (HTTP ${e.status})`);const t=await e.json();return{workspaces:Array.isArray(t.workspaces)?t.workspaces:[],hasUngrouped:t.hasUngrouped===!0}}async function $1(){const e=await fetch("/api/projects");if(!e.ok)throw new Error(`Failed to load projects (HTTP ${e.status})`);const t=await e.json();return Array.isArray(t)?t:[]}async function ty(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to load template (HTTP ${t.status})`);const n=await t.json();if(!n.content)throw new Error("Template returned no content");return n.content}function Xi(e,t,n){const r=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!r)return`---
|
|
547
547
|
${t}: ${JSON.stringify(n)}
|
|
548
548
|
---
|
|
549
549
|
${e}`;const o=r[1],i=r[2],a=r[3],l=e.slice(r[0].length),u=JSON.stringify(n),f=new RegExp(`^${t}:\\s*.*$`,"m");let p;return f.test(i)?p=i.replace(f,`${t}: ${u}`):p=`${i}
|
|
@@ -602,7 +602,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
602
602
|
To pick up a draggable item, press the space bar.
|
|
603
603
|
While dragging, use the arrow keys to move the item.
|
|
604
604
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
605
|
-
`},$B={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function IB(e){let{announcements:t=$B,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=DB}=e;const{announce:i,announcement:a}=AB(),l=Od("DndLiveRegion"),[u,f]=m.useState(!1);if(m.useEffect(()=>{f(!0)},[]),PB(m.useMemo(()=>({onDragStart(h){let{active:g}=h;i(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:y}=h;t.onDragMove&&i(t.onDragMove({active:g,over:y}))},onDragOver(h){let{active:g,over:y}=h;i(t.onDragOver({active:g,over:y}))},onDragEnd(h){let{active:g,over:y}=h;i(t.onDragEnd({active:g,over:y}))},onDragCancel(h){let{active:g,over:y}=h;i(t.onDragCancel({active:g,over:y}))}}),[i,t])),!u)return null;const p=Lt.createElement(Lt.Fragment,null,Lt.createElement(TB,{id:r,value:o.draggable}),Lt.createElement(RB,{id:l,announcement:a}));return n?jo.createPortal(p,n):p}var $n;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})($n||($n={}));function gh(){}function ji(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function bm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ks=Object.freeze({x:0,y:0});function SR(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function LB(e,t){const n=mh(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function NR(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function MB(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function oS(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function CR(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function iS(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const vm=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=iS(t,t.left,t.top),i=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const f=SR(iS(u),o);i.push({id:l,data:{droppableContainer:a,value:f}})}}return i.sort(NR)},OB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=oS(t),i=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const f=oS(u),p=o.reduce((g,y,k)=>g+SR(f[k],y),0),h=Number((p/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:h}})}}return i.sort(NR)};function FB(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=i-n;if(r<o&&n<i){const u=t.width*t.height,f=e.width*e.height,p=a*l,h=p/(u+f-p);return Number(h.toFixed(4))}return 0}const zB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const u=FB(l,t);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(MB)};function BB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ER(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ks}function UB(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,l)=>({...a,top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),{...n})}}const HB=UB(1);function TR(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function VB(e,t,n){const r=TR(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,u=e.left-a-(1-o)*parseFloat(n),f=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),p=o?e.width/o:e.width,h=i?e.height/i:e.height;return{width:p,height:h,top:f,right:u+p,bottom:f+h,left:u}}const WB={ignoreTransform:!1};function wc(e,t){t===void 0&&(t=WB);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:p}=ur(e).getComputedStyle(e);f&&(n=VB(n,f,p))}const{top:r,left:o,width:i,height:a,bottom:l,right:u}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:u}}function aS(e){return wc(e,{ignoreTransform:!0})}function qB(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function KB(e,t){return t===void 0&&(t=ur(e).getComputedStyle(e)),t.position==="fixed"}function GB(e,t){t===void 0&&(t=ur(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function wm(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Nw(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ld(o)||wR(o)||n.includes(o))return n;const i=ur(e).getComputedStyle(o);return o!==e&&GB(o,i)&&n.push(o),KB(o,i)?n:r(o.parentNode)}return e?r(e):n}function RR(e){const[t]=wm(e,1);return t??null}function hy(e){return!gm||!e?null:bc(e)?e:Sw(e)?Nw(e)||e===vc(e).scrollingElement?window:Ld(e)?e:null:null}function AR(e){return bc(e)?e.scrollX:e.scrollLeft}function PR(e){return bc(e)?e.scrollY:e.scrollTop}function $b(e){return{x:AR(e),y:PR(e)}}var Vn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Vn||(Vn={}));function _R(e){return!gm||!e?!1:e===document.scrollingElement}function DR(e){const t={x:0,y:0},n=_R(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:l,maxScroll:r,minScroll:t}}const YB={x:.2,y:.2};function XB(e,t,n,r,o){let{top:i,left:a,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=YB);const{isTop:f,isBottom:p,isLeft:h,isRight:g}=DR(e),y={x:0,y:0},k={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!f&&i<=t.top+v.height?(y.y=Vn.Backward,k.y=r*Math.abs((t.top+v.height-i)/v.height)):!p&&u>=t.bottom-v.height&&(y.y=Vn.Forward,k.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!g&&l>=t.right-v.width?(y.x=Vn.Forward,k.x=r*Math.abs((t.right-v.width-l)/v.width)):!h&&a<=t.left+v.width&&(y.x=Vn.Backward,k.x=r*Math.abs((t.left+v.width-a)/v.width)),{direction:y,speed:k}}function QB(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function $R(e){return e.reduce((t,n)=>Bl(t,$b(n)),ks)}function JB(e){return e.reduce((t,n)=>t+AR(n),0)}function ZB(e){return e.reduce((t,n)=>t+PR(n),0)}function IR(e,t){if(t===void 0&&(t=wc),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);RR(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const e8=[["x",["left","right"],JB],["y",["top","bottom"],ZB]];class Cw{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=wm(n),o=$R(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,l]of e8)for(const u of a)Object.defineProperty(this,u,{get:()=>{const f=l(r),p=o[i]-f;return this.rect[u]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Uu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function t8(e){const{EventTarget:t}=ur(e);return e instanceof t?e:vc(e)}function my(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Zr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Zr||(Zr={}));function lS(e){e.preventDefault()}function n8(e){e.stopPropagation()}var At;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(At||(At={}));const LR={start:[At.Space,At.Enter],cancel:[At.Esc],end:[At.Space,At.Enter,At.Tab]},r8=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case At.Right:return{...n,x:n.x+25};case At.Left:return{...n,x:n.x-25};case At.Down:return{...n,y:n.y+25};case At.Up:return{...n,y:n.y-25}}};class jc{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Uu(vc(n)),this.windowListeners=new Uu(ur(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Zr.Resize,this.handleCancel),this.windowListeners.add(Zr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Zr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&IR(r),n(ks)}handleKeyDown(t){if(ym(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=LR,coordinateGetter:a=r8,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:f}=r.current,p=f?{x:f.left,y:f.top}:ks;this.referenceCoordinates||(this.referenceCoordinates=p);const h=a(t,{active:n,context:r.current,currentCoordinates:p});if(h){const g=od(h,p),y={x:0,y:0},{scrollableAncestors:k}=r.current;for(const v of k){const b=t.code,{isTop:j,isRight:N,isLeft:S,isBottom:C,maxScroll:D,minScroll:T}=DR(v),R=QB(v),$={x:Math.min(b===At.Right?R.right-R.width/2:R.right,Math.max(b===At.Right?R.left:R.left+R.width/2,h.x)),y:Math.min(b===At.Down?R.bottom-R.height/2:R.bottom,Math.max(b===At.Down?R.top:R.top+R.height/2,h.y))},P=b===At.Right&&!N||b===At.Left&&!S,F=b===At.Down&&!C||b===At.Up&&!j;if(P&&$.x!==h.x){const _=v.scrollLeft+g.x,V=b===At.Right&&_<=D.x||b===At.Left&&_>=T.x;if(V&&!g.y){v.scrollTo({left:_,behavior:l});return}V?y.x=v.scrollLeft-_:y.x=b===At.Right?v.scrollLeft-D.x:v.scrollLeft-T.x,y.x&&v.scrollBy({left:-y.x,behavior:l});break}else if(F&&$.y!==h.y){const _=v.scrollTop+g.y,V=b===At.Down&&_<=D.y||b===At.Up&&_>=T.y;if(V&&!g.x){v.scrollTo({top:_,behavior:l});return}V?y.y=v.scrollTop-_:y.y=b===At.Down?v.scrollTop-D.y:v.scrollTop-T.y,y.y&&v.scrollBy({top:-y.y,behavior:l});break}}this.handleMove(t,Bl(od(h,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}jc.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=LR,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function cS(e){return!!(e&&"distance"in e)}function uS(e){return!!(e&&"delay"in e)}class Ew{constructor(t,n,r){var o;r===void 0&&(r=t8(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=vc(a),this.documentListeners=new Uu(this.document),this.listeners=new Uu(r),this.windowListeners=new Uu(ur(a)),this.initialCoordinates=(o=mh(i))!=null?o:ks,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Zr.Resize,this.handleCancel),this.windowListeners.add(Zr.DragStart,lS),this.windowListeners.add(Zr.VisibilityChange,this.handleCancel),this.windowListeners.add(Zr.ContextMenu,lS),this.documentListeners.add(Zr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(uS(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(cS(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Zr.Click,n8,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Zr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:l}}=i;if(!o)return;const u=(n=mh(t))!=null?n:ks,f=od(o,u);if(!r&&l){if(cS(l)){if(l.tolerance!=null&&my(f,l.tolerance))return this.handleCancel();if(my(f,l.distance))return this.handleStart()}if(uS(l)&&my(f,l.tolerance))return this.handleCancel();this.handlePending(l,f);return}t.cancelable&&t.preventDefault(),a(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===At.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const s8={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class kc extends Ew{constructor(t){const{event:n}=t,r=vc(n.target);super(t,s8,r)}}kc.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const o8={move:{name:"mousemove"},end:{name:"mouseup"}};var Ib;(function(e){e[e.RightClick=2]="RightClick"})(Ib||(Ib={}));class i8 extends Ew{constructor(t){super(t,o8,vc(t.event.target))}}i8.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ib.RightClick?!1:(r==null||r({event:n}),!0)}}];const gy={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class a8 extends Ew{constructor(t){super(t,gy)}static setup(){return window.addEventListener(gy.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(gy.move.name,t)};function t(){}}}a8.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Hu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Hu||(Hu={}));var xh;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xh||(xh={}));function l8(e){let{acceleration:t,activator:n=Hu.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:l=xh.TreeOrder,pointerCoordinates:u,scrollableAncestors:f,scrollableAncestorRects:p,delta:h,threshold:g}=e;const y=u8({delta:h,disabled:!i}),[k,v]=kB(),b=m.useRef({x:0,y:0}),j=m.useRef({x:0,y:0}),N=m.useMemo(()=>{switch(n){case Hu.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Hu.DraggableRect:return o}},[n,o,u]),S=m.useRef(null),C=m.useCallback(()=>{const T=S.current;if(!T)return;const R=b.current.x*j.current.x,$=b.current.y*j.current.y;T.scrollBy(R,$)},[]),D=m.useMemo(()=>l===xh.TreeOrder?[...f].reverse():f,[l,f]);m.useEffect(()=>{if(!i||!f.length||!N){v();return}for(const T of D){if((r==null?void 0:r(T))===!1)continue;const R=f.indexOf(T),$=p[R];if(!$)continue;const{direction:P,speed:F}=XB(T,$,N,t,g);for(const _ of["x","y"])y[_][P[_]]||(F[_]=0,P[_]=0);if(F.x>0||F.y>0){v(),S.current=T,k(C,a),b.current=F,j.current=P;return}}b.current={x:0,y:0},j.current={x:0,y:0},v()},[t,C,r,v,i,a,JSON.stringify(N),JSON.stringify(y),k,f,D,p,JSON.stringify(g)])}const c8={x:{[Vn.Backward]:!1,[Vn.Forward]:!1},y:{[Vn.Backward]:!1,[Vn.Forward]:!1}};function u8(e){let{delta:t,disabled:n}=e;const r=hh(t);return Md(o=>{if(n||!r||!o)return c8;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Vn.Backward]:o.x[Vn.Backward]||i.x===-1,[Vn.Forward]:o.x[Vn.Forward]||i.x===1},y:{[Vn.Backward]:o.y[Vn.Backward]||i.y===-1,[Vn.Forward]:o.y[Vn.Forward]||i.y===1}}},[n,t,r])}function d8(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Md(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function f8(e,t){return m.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var id;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(id||(id={}));var Lb;(function(e){e.Optimized="optimized"})(Lb||(Lb={}));const dS=new Map;function p8(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=m.useState(null),{frequency:l,measure:u,strategy:f}=o,p=m.useRef(e),h=b(),g=sd(h),y=m.useCallback(function(j){j===void 0&&(j=[]),!g.current&&a(N=>N===null?j:N.concat(j.filter(S=>!N.includes(S))))},[g]),k=m.useRef(null),v=Md(j=>{if(h&&!n)return dS;if(!j||j===dS||p.current!==e||i!=null){const N=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){N.set(S.id,S.rect.current);continue}const C=S.node.current,D=C?new Cw(u(C),C):null;S.rect.current=D,D&&N.set(S.id,D)}return N}return j},[e,i,n,h,u]);return m.useEffect(()=>{p.current=e},[e]),m.useEffect(()=>{h||y()},[n,h]),m.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),m.useEffect(()=>{h||typeof l!="number"||k.current!==null||(k.current=setTimeout(()=>{y(),k.current=null},l))},[l,h,y,...r]),{droppableRects:v,measureDroppableContainers:y,measuringScheduled:i!=null};function b(){switch(f){case id.Always:return!1;case id.BeforeDragging:return n;default:return!n}}}function Tw(e,t){return Md(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function h8(e,t){return Tw(e,t)}function m8(e){let{callback:t,disabled:n}=e;const r=xm(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function jm(e){let{callback:t,disabled:n}=e;const r=xm(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function g8(e){return new Cw(wc(e),e)}function fS(e,t,n){t===void 0&&(t=g8);const[r,o]=m.useState(null);function i(){o(u=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=u??n)!=null?f:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const a=m8({callback(u){if(e)for(const f of u){const{type:p,target:h}=f;if(p==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),l=jm({callback:i});return ws(()=>{i(),e?(l==null||l.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[e]),r}function x8(e){const t=Tw(e);return ER(e,t)}const pS=[];function y8(e){const t=m.useRef(e),n=Md(r=>e?r&&r!==pS&&e&&t.current&&e.parentNode===t.current.parentNode?r:wm(e):pS,[e]);return m.useEffect(()=>{t.current=e},[e]),n}function b8(e){const[t,n]=m.useState(null),r=m.useRef(e),o=m.useCallback(i=>{const a=hy(i.target);a&&n(l=>l?(l.set(a,$b(a)),new Map(l)):null)},[]);return m.useEffect(()=>{const i=r.current;if(e!==i){a(i);const l=e.map(u=>{const f=hy(u);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,$b(f)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(i)};function a(l){l.forEach(u=>{const f=hy(u);f==null||f.removeEventListener("scroll",o)})}},[o,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>Bl(i,a),ks):$R(e):ks,[e,t])}function hS(e,t){t===void 0&&(t=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},t),m.useEffect(()=>{const r=e!==ks;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?od(e,n.current):ks}function v8(e){m.useEffect(()=>{if(!gm)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function w8(e,t){return m.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function MR(e){return m.useMemo(()=>e?qB(e):null,[e])}const mS=[];function j8(e,t){t===void 0&&(t=wc);const[n]=e,r=MR(n?ur(n):null),[o,i]=m.useState(mS);function a(){i(()=>e.length?e.map(u=>_R(u)?r:new Cw(t(u),u)):mS)}const l=jm({callback:a});return ws(()=>{l==null||l.disconnect(),a(),e.forEach(u=>l==null?void 0:l.observe(u))},[e]),o}function OR(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ld(t)?t:e}function k8(e){let{measure:t}=e;const[n,r]=m.useState(null),o=m.useCallback(f=>{for(const{target:p}of f)if(Ld(p)){r(h=>{const g=t(p);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),i=jm({callback:o}),a=m.useCallback(f=>{const p=OR(f);i==null||i.disconnect(),p&&(i==null||i.observe(p)),r(p?t(p):null)},[t,i]),[l,u]=ph(a);return m.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const S8=[{sensor:kc,options:{}},{sensor:jc,options:{}}],N8={current:{}},Hp={draggable:{measure:aS},droppable:{measure:aS,strategy:id.WhileDragging,frequency:Lb.Optimized},dragOverlay:{measure:wc}};class Vu extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const C8={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Vu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:gh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hp,measureDroppableContainers:gh,windowRect:null,measuringScheduled:!1},FR={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:gh,draggableNodes:new Map,over:null,measureDroppableContainers:gh},Fd=m.createContext(FR),zR=m.createContext(C8);function E8(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Vu}}}function T8(e,t){switch(t.type){case $n.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case $n.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case $n.DragEnd:case $n.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $n.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Vu(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case $n.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Vu(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case $n.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Vu(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function R8(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=m.useContext(Fd),i=hh(r),a=hh(n==null?void 0:n.id);return m.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!ym(i)||document.activeElement===i.target)return;const l=o.get(a);if(!l)return;const{activatorNode:u,node:f}=l;if(!u.current&&!f.current)return;requestAnimationFrame(()=>{for(const p of[u.current,f.current]){if(!p)continue;const h=CB(p);if(h){h.focus();break}}})}},[r,t,o,a,i]),null}function BR(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function A8(e){return m.useMemo(()=>({draggable:{...Hp.draggable,...e==null?void 0:e.draggable},droppable:{...Hp.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Hp.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function P8(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=m.useRef(!1),{x:a,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ws(()=>{if(!a&&!l||!t){i.current=!1;return}if(i.current||!r)return;const f=t==null?void 0:t.node.current;if(!f||f.isConnected===!1)return;const p=n(f),h=ER(p,r);if(a||(h.x=0),l||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=RR(f);g&&g.scrollBy({top:h.y,left:h.x})}},[t,a,l,r,n])}const km=m.createContext({...ks,scaleX:1,scaleY:1});var gi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(gi||(gi={}));const Sm=m.memo(function(t){var n,r,o,i;let{id:a,accessibility:l,autoScroll:u=!0,children:f,sensors:p=S8,collisionDetection:h=zB,measuring:g,modifiers:y,...k}=t;const v=m.useReducer(T8,void 0,E8),[b,j]=v,[N,S]=_B(),[C,D]=m.useState(gi.Uninitialized),T=C===gi.Initialized,{draggable:{active:R,nodes:$,translate:P},droppable:{containers:F}}=b,_=R!=null?$.get(R):null,V=m.useRef({initial:null,translated:null}),U=m.useMemo(()=>{var lt;return R!=null?{id:R,data:(lt=_==null?void 0:_.data)!=null?lt:N8,rect:V}:null},[R,_]),I=m.useRef(null),[M,B]=m.useState(null),[W,O]=m.useState(null),H=sd(k,Object.values(k)),L=Od("DndDescribedBy",a),z=m.useMemo(()=>F.getEnabled(),[F]),Y=A8(g),{droppableRects:q,measureDroppableContainers:Q,measuringScheduled:ee}=p8(z,{dragging:T,dependencies:[P.x,P.y],config:Y.droppable}),Z=d8($,R),ie=m.useMemo(()=>W?mh(W):null,[W]),ne=ze(),ue=h8(Z,Y.draggable.measure);P8({activeNode:R!=null?$.get(R):null,config:ne.layoutShiftCompensation,initialRect:ue,measure:Y.draggable.measure});const ge=fS(Z,Y.draggable.measure,ue),Ne=fS(Z?Z.parentElement:null),Ce=m.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=F.getNodeFor((n=Ce.current.over)==null?void 0:n.id),Ue=k8({measure:Y.dragOverlay.measure}),oe=(r=Ue.nodeRef.current)!=null?r:Z,ve=T?(o=Ue.rect)!=null?o:ge:null,be=!!(Ue.nodeRef.current&&Ue.rect),Re=x8(be?null:ge),He=MR(oe?ur(oe):null),rt=y8(T?ke??Z:null),Fe=j8(rt),ot=BR(y,{transform:{x:P.x-Re.x,y:P.y-Re.y,scaleX:1,scaleY:1},activatorEvent:W,active:U,activeNodeRect:ge,containerNodeRect:Ne,draggingNodeRect:ve,over:Ce.current.over,overlayNodeRect:Ue.rect,scrollableAncestors:rt,scrollableAncestorRects:Fe,windowRect:He}),Nt=ie?Bl(ie,P):null,mt=b8(rt),at=hS(mt),ce=hS(mt,[ge]),me=Bl(ot,at),Ie=ve?HB(ve,ot):null,Ae=U&&Ie?h({active:U,collisionRect:Ie,droppableRects:q,droppableContainers:z,pointerCoordinates:Nt}):null,We=CR(Ae,"id"),[pt,Pe]=m.useState(null),Qe=be?ot:Bl(ot,ce),Je=BB(Qe,(i=pt==null?void 0:pt.rect)!=null?i:null,ge),ut=m.useRef(null),fe=m.useCallback((lt,ht)=>{let{sensor:vt,options:tt}=ht;if(I.current==null)return;const _t=$.get(I.current);if(!_t)return;const zt=lt.nativeEvent,Bt=new vt({active:I.current,activeNode:_t,event:zt,options:tt,context:Ce,onAbort(Oe){if(!$.get(Oe))return;const{onDragAbort:Et}=H.current,ln={id:Oe};Et==null||Et(ln),N({type:"onDragAbort",event:ln})},onPending(Oe,it,Et,ln){if(!$.get(Oe))return;const{onDragPending:le}=H.current,Se={id:Oe,constraint:it,initialCoordinates:Et,offset:ln};le==null||le(Se),N({type:"onDragPending",event:Se})},onStart(Oe){const it=I.current;if(it==null)return;const Et=$.get(it);if(!Et)return;const{onDragStart:ln}=H.current,Ut={activatorEvent:zt,active:{id:it,data:Et.data,rect:V}};jo.unstable_batchedUpdates(()=>{ln==null||ln(Ut),D(gi.Initializing),j({type:$n.DragStart,initialCoordinates:Oe,active:it}),N({type:"onDragStart",event:Ut}),B(ut.current),O(zt)})},onMove(Oe){j({type:$n.DragMove,coordinates:Oe})},onEnd:we($n.DragEnd),onCancel:we($n.DragCancel)});ut.current=Bt;function we(Oe){return async function(){const{active:Et,collisions:ln,over:Ut,scrollAdjustedTranslate:le}=Ce.current;let Se=null;if(Et&&le){const{cancelDrop:nt}=H.current;Se={activatorEvent:zt,active:Et,collisions:ln,delta:le,over:Ut},Oe===$n.DragEnd&&typeof nt=="function"&&await Promise.resolve(nt(Se))&&(Oe=$n.DragCancel)}I.current=null,jo.unstable_batchedUpdates(()=>{j({type:Oe}),D(gi.Uninitialized),Pe(null),B(null),O(null),ut.current=null;const nt=Oe===$n.DragEnd?"onDragEnd":"onDragCancel";if(Se){const Tn=H.current[nt];Tn==null||Tn(Se),N({type:nt,event:Se})}})}}},[$]),K=m.useCallback((lt,ht)=>(vt,tt)=>{const _t=vt.nativeEvent,zt=$.get(tt);if(I.current!==null||!zt||_t.dndKit||_t.defaultPrevented)return;const Bt={active:zt};lt(vt,ht.options,Bt)===!0&&(_t.dndKit={capturedBy:ht.sensor},I.current=tt,fe(vt,ht))},[$,fe]),re=f8(p,K);v8(p),ws(()=>{ge&&C===gi.Initializing&&D(gi.Initialized)},[ge,C]),m.useEffect(()=>{const{onDragMove:lt}=H.current,{active:ht,activatorEvent:vt,collisions:tt,over:_t}=Ce.current;if(!ht||!vt)return;const zt={active:ht,activatorEvent:vt,collisions:tt,delta:{x:me.x,y:me.y},over:_t};jo.unstable_batchedUpdates(()=>{lt==null||lt(zt),N({type:"onDragMove",event:zt})})},[me.x,me.y]),m.useEffect(()=>{const{active:lt,activatorEvent:ht,collisions:vt,droppableContainers:tt,scrollAdjustedTranslate:_t}=Ce.current;if(!lt||I.current==null||!ht||!_t)return;const{onDragOver:zt}=H.current,Bt=tt.get(We),we=Bt&&Bt.rect.current?{id:Bt.id,rect:Bt.rect.current,data:Bt.data,disabled:Bt.disabled}:null,Oe={active:lt,activatorEvent:ht,collisions:vt,delta:{x:_t.x,y:_t.y},over:we};jo.unstable_batchedUpdates(()=>{Pe(we),zt==null||zt(Oe),N({type:"onDragOver",event:Oe})})},[We]),ws(()=>{Ce.current={activatorEvent:W,active:U,activeNode:Z,collisionRect:Ie,collisions:Ae,droppableRects:q,draggableNodes:$,draggingNode:oe,draggingNodeRect:ve,droppableContainers:F,over:pt,scrollableAncestors:rt,scrollAdjustedTranslate:me},V.current={initial:ve,translated:Ie}},[U,Z,Ae,Ie,$,oe,ve,q,F,pt,rt,me]),l8({...ne,delta:P,draggingRect:Ie,pointerCoordinates:Nt,scrollableAncestors:rt,scrollableAncestorRects:Fe});const xe=m.useMemo(()=>({active:U,activeNode:Z,activeNodeRect:ge,activatorEvent:W,collisions:Ae,containerNodeRect:Ne,dragOverlay:Ue,draggableNodes:$,droppableContainers:F,droppableRects:q,over:pt,measureDroppableContainers:Q,scrollableAncestors:rt,scrollableAncestorRects:Fe,measuringConfiguration:Y,measuringScheduled:ee,windowRect:He}),[U,Z,ge,W,Ae,Ne,Ue,$,F,q,pt,Q,rt,Fe,Y,ee,He]),Ge=m.useMemo(()=>({activatorEvent:W,activators:re,active:U,activeNodeRect:ge,ariaDescribedById:{draggable:L},dispatch:j,draggableNodes:$,over:pt,measureDroppableContainers:Q}),[W,re,U,ge,j,L,$,pt,Q]);return Lt.createElement(kR.Provider,{value:S},Lt.createElement(Fd.Provider,{value:Ge},Lt.createElement(zR.Provider,{value:xe},Lt.createElement(km.Provider,{value:Je},f)),Lt.createElement(R8,{disabled:(l==null?void 0:l.restoreFocus)===!1})),Lt.createElement(IB,{...l,hiddenTextDescribedById:L}));function ze(){const lt=(M==null?void 0:M.autoScrollEnabled)===!1,ht=typeof u=="object"?u.enabled===!1:u===!1,vt=T&&!lt&&!ht;return typeof u=="object"?{...u,enabled:vt}:{enabled:vt}}}),_8=m.createContext(null),gS="button",D8="Draggable";function $8(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Od(D8),{activators:a,activatorEvent:l,active:u,activeNodeRect:f,ariaDescribedById:p,draggableNodes:h,over:g}=m.useContext(Fd),{role:y=gS,roleDescription:k="draggable",tabIndex:v=0}=o??{},b=(u==null?void 0:u.id)===t,j=m.useContext(b?km:_8),[N,S]=ph(),[C,D]=ph(),T=w8(a,t),R=sd(n);ws(()=>(h.set(t,{id:t,key:i,node:N,activatorNode:C,data:R}),()=>{const P=h.get(t);P&&P.key===i&&h.delete(t)}),[h,t]);const $=m.useMemo(()=>({role:y,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&y===gS?!0:void 0,"aria-roledescription":k,"aria-describedby":p.draggable}),[r,y,v,b,k,p.draggable]);return{active:u,activatorEvent:l,activeNodeRect:f,attributes:$,isDragging:b,listeners:r?void 0:T,node:N,over:g,setNodeRef:S,setActivatorNodeRef:D,transform:j}}function UR(){return m.useContext(zR)}const I8="Droppable",L8={timeout:25};function M8(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Od(I8),{active:a,dispatch:l,over:u,measureDroppableContainers:f}=m.useContext(Fd),p=m.useRef({disabled:n}),h=m.useRef(!1),g=m.useRef(null),y=m.useRef(null),{disabled:k,updateMeasurementsFor:v,timeout:b}={...L8,...o},j=sd(v??r),N=m.useCallback(()=>{if(!h.current){h.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{f(Array.isArray(j.current)?j.current:[j.current]),y.current=null},b)},[b]),S=jm({callback:N,disabled:k||!a}),C=m.useCallback(($,P)=>{S&&(P&&(S.unobserve(P),h.current=!1),$&&S.observe($))},[S]),[D,T]=ph(C),R=sd(t);return m.useEffect(()=>{!S||!D.current||(S.disconnect(),h.current=!1,S.observe(D.current))},[D,S]),m.useEffect(()=>(l({type:$n.RegisterDroppable,element:{id:r,key:i,disabled:n,node:D,rect:g,data:R}}),()=>l({type:$n.UnregisterDroppable,key:i,id:r})),[r]),m.useEffect(()=>{n!==p.current.disabled&&(l({type:$n.SetDroppableDisabled,id:r,key:i,disabled:n}),p.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:(u==null?void 0:u.id)===r,node:D,over:u,setNodeRef:T}}function O8(e){let{animation:t,children:n}=e;const[r,o]=m.useState(null),[i,a]=m.useState(null),l=hh(n);return!n&&!r&&l&&o(l),ws(()=>{if(!i)return;const u=r==null?void 0:r.key,f=r==null?void 0:r.props.id;if(u==null||f==null){o(null);return}Promise.resolve(t(f,i)).then(()=>{o(null)})},[t,r,i]),Lt.createElement(Lt.Fragment,null,n,r?m.cloneElement(r,{ref:a}):null)}const F8={x:0,y:0,scaleX:1,scaleY:1};function z8(e){let{children:t}=e;return Lt.createElement(Fd.Provider,{value:FR},Lt.createElement(km.Provider,{value:F8},t))}const B8={position:"fixed",touchAction:"none"},U8=e=>ym(e)?"transform 250ms ease":void 0,H8=m.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:i,className:a,rect:l,style:u,transform:f,transition:p=U8}=e;if(!l)return null;const h=o?f:{...f,scaleX:1,scaleY:1},g={...B8,width:l.width,height:l.height,top:l.top,left:l.left,transform:js.Transform.toString(h),transformOrigin:o&&r?LB(r,l):void 0,transition:typeof p=="function"?p(r):p,...u};return Lt.createElement(n,{className:a,style:g,ref:t},i)}),V8=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:i,className:a}=e;if(i!=null&&i.active)for(const[l,u]of Object.entries(i.active))u!==void 0&&(o[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,u));if(i!=null&&i.dragOverlay)for(const[l,u]of Object.entries(i.dragOverlay))u!==void 0&&r.node.style.setProperty(l,u);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[u,f]of Object.entries(o))n.node.style.setProperty(u,f);a!=null&&a.active&&n.node.classList.remove(a.active)}},W8=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:js.Transform.toString(t)},{transform:js.Transform.toString(n)}]},q8={duration:250,easing:"ease",keyframes:W8,sideEffects:V8({styles:{active:{opacity:"0"}}})};function K8(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return xm((i,a)=>{if(t===null)return;const l=n.get(i);if(!l)return;const u=l.node.current;if(!u)return;const f=OR(a);if(!f)return;const{transform:p}=ur(a).getComputedStyle(a),h=TR(p);if(!h)return;const g=typeof t=="function"?t:G8(t);return IR(u,o.draggable.measure),g({active:{id:i,data:l.data,node:u,rect:o.draggable.measure(u)},draggableNodes:n,dragOverlay:{node:a,rect:o.dragOverlay.measure(f)},droppableContainers:r,measuringConfiguration:o,transform:h})})}function G8(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...q8,...e};return i=>{let{active:a,dragOverlay:l,transform:u,...f}=i;if(!t)return;const p={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},h={scaleX:u.scaleX!==1?a.rect.width*u.scaleX/l.rect.width:1,scaleY:u.scaleY!==1?a.rect.height*u.scaleY/l.rect.height:1},g={x:u.x-p.x,y:u.y-p.y,...h},y=o({...f,active:a,dragOverlay:l,transform:{initial:u,final:g}}),[k]=y,v=y[y.length-1];if(JSON.stringify(k)===JSON.stringify(v))return;const b=r==null?void 0:r({active:a,dragOverlay:l,...f}),j=l.node.animate(y,{duration:t,easing:n,fill:"forwards"});return new Promise(N=>{j.onfinish=()=>{b==null||b(),N()}})}}let xS=0;function Y8(e){return m.useMemo(()=>{if(e!=null)return xS++,xS},[e])}const X8=Lt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:i,modifiers:a,wrapperElement:l="div",className:u,zIndex:f=999}=e;const{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggableNodes:k,droppableContainers:v,dragOverlay:b,over:j,measuringConfiguration:N,scrollableAncestors:S,scrollableAncestorRects:C,windowRect:D}=UR(),T=m.useContext(km),R=Y8(h==null?void 0:h.id),$=BR(a,{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:b.rect,over:j,overlayNodeRect:b.rect,scrollableAncestors:S,scrollableAncestorRects:C,transform:T,windowRect:D}),P=Tw(g),F=K8({config:r,draggableNodes:k,droppableContainers:v,measuringConfiguration:N}),_=P?b.setRef:void 0;return Lt.createElement(z8,null,Lt.createElement(O8,{animation:F},h&&R?Lt.createElement(H8,{key:R,id:h.id,ref:_,as:l,activatorEvent:p,adjustScale:t,className:u,transition:i,rect:P,style:{zIndex:f,...o},transform:$},n):null))});function Sc(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Q8(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function cp(e){return e!==null&&e>=0}function J8(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Z8(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Rw=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Sc(t,r,n),a=t[o],l=i[o];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},up={scaleX:1,scaleY:1},Aw=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const f=i[a];return f?{x:0,y:n<a?f.top+f.height-(l.top+l.height):f.top-l.top,...up}:null}const u=e7(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-u,...up}:o<n&&o>=a?{x:0,y:l.height+u,...up}:{x:0,y:0,...up}};function e7(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const HR="Sortable",VR=Lt.createContext({activeIndex:-1,containerId:HR,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Rw,disabled:{draggable:!1,droppable:!1}});function Nm(e){let{children:t,id:n,items:r,strategy:o=Rw,disabled:i=!1}=e;const{active:a,dragOverlay:l,droppableRects:u,over:f,measureDroppableContainers:p}=UR(),h=Od(HR,n),g=l.rect!==null,y=m.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),k=a!=null,v=a?y.indexOf(a.id):-1,b=f?y.indexOf(f.id):-1,j=m.useRef(y),N=!J8(y,j.current),S=b!==-1&&v===-1||N,C=Z8(i);ws(()=>{N&&k&&p(y)},[N,y,k,p]),m.useEffect(()=>{j.current=y},[y]);const D=m.useMemo(()=>({activeIndex:v,containerId:h,disabled:C,disableTransforms:S,items:y,overIndex:b,useDragOverlay:g,sortedRects:Q8(y,u),strategy:o}),[v,h,C.draggable,C.droppable,S,y,b,u,g,o]);return Lt.createElement(VR.Provider,{value:D},t)}const t7=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Sc(n,r,o).indexOf(t)},n7=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:u,transition:f}=e;return!f||!r||l!==i&&o===a?!1:n?!0:a!==o&&t===u},r7={duration:200,easing:"ease"},WR="transform",s7=js.Transition.toString({property:WR,duration:0,easing:"linear"}),o7={roleDescription:"sortable"};function i7(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=m.useState(null),l=m.useRef(n);return ws(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const f=wc(r.current,{ignoreTransform:!0}),p={x:u.left-f.left,y:u.top-f.top,scaleX:u.width/f.width,scaleY:u.height/f.height};(p.x||p.y)&&a(p)}}n!==l.current&&(l.current=n)},[t,n,r,o]),m.useEffect(()=>{i&&a(null)},[i]),i}function Cm(e){let{animateLayoutChanges:t=n7,attributes:n,disabled:r,data:o,getNewIndex:i=t7,id:a,strategy:l,resizeObserverConfig:u,transition:f=r7}=e;const{items:p,containerId:h,activeIndex:g,disabled:y,disableTransforms:k,sortedRects:v,overIndex:b,useDragOverlay:j,strategy:N}=m.useContext(VR),S=a7(r,y),C=p.indexOf(a),D=m.useMemo(()=>({sortable:{containerId:h,index:C,items:p},...o}),[h,o,C,p]),T=m.useMemo(()=>p.slice(p.indexOf(a)),[p,a]),{rect:R,node:$,isOver:P,setNodeRef:F}=M8({id:a,data:D,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...u}}),{active:_,activatorEvent:V,activeNodeRect:U,attributes:I,setNodeRef:M,listeners:B,isDragging:W,over:O,setActivatorNodeRef:H,transform:L}=$8({id:a,data:D,attributes:{...o7,...n},disabled:S.draggable}),z=jB(F,M),Y=!!_,q=Y&&!k&&cp(g)&&cp(b),Q=!j&&W,ee=Q&&q?L:null,ie=q?ee??(l??N)({rects:v,activeNodeRect:U,activeIndex:g,overIndex:b,index:C}):null,ne=cp(g)&&cp(b)?i({id:a,items:p,activeIndex:g,overIndex:b}):C,ue=_==null?void 0:_.id,ge=m.useRef({activeId:ue,items:p,newIndex:ne,containerId:h}),Ne=p!==ge.current.items,Ce=t({active:_,containerId:h,isDragging:W,isSorting:Y,id:a,index:C,items:p,newIndex:ge.current.newIndex,previousItems:ge.current.items,previousContainerId:ge.current.containerId,transition:f,wasDragging:ge.current.activeId!=null}),ke=i7({disabled:!Ce,index:C,node:$,rect:R});return m.useEffect(()=>{Y&&ge.current.newIndex!==ne&&(ge.current.newIndex=ne),h!==ge.current.containerId&&(ge.current.containerId=h),p!==ge.current.items&&(ge.current.items=p)},[Y,ne,h,p]),m.useEffect(()=>{if(ue===ge.current.activeId)return;if(ue!=null&&ge.current.activeId==null){ge.current.activeId=ue;return}const oe=setTimeout(()=>{ge.current.activeId=ue},50);return()=>clearTimeout(oe)},[ue]),{active:_,activeIndex:g,attributes:I,data:D,rect:R,index:C,newIndex:ne,items:p,isOver:P,isSorting:Y,isDragging:W,listeners:B,node:$,overIndex:b,over:O,setNodeRef:z,setActivatorNodeRef:H,setDroppableNodeRef:F,setDraggableNodeRef:M,transform:ke??ie,transition:Ue()};function Ue(){if(ke||Ne&&ge.current.newIndex===C)return s7;if(!(Q&&!ym(V)||!f)&&(Y||Ce))return js.Transition.toString({...f,property:WR})}}function a7(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function yh(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const l7=[At.Down,At.Right,At.Up,At.Left],qR=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(l7.includes(e.code)){if(e.preventDefault(),!n||!r)return;const u=[];i.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const g=o.get(h.id);if(g)switch(e.code){case At.Down:r.top<g.top&&u.push(h);break;case At.Up:r.top>g.top&&u.push(h);break;case At.Left:r.left>g.left&&u.push(h);break;case At.Right:r.left<g.left&&u.push(h);break}});const f=OB({collisionRect:r,droppableRects:o,droppableContainers:u});let p=CR(f,"id");if(p===(a==null?void 0:a.id)&&f.length>1&&(p=f[1].id),p!=null){const h=i.get(n.id),g=i.get(p),y=g?o.get(g.id):null,k=g==null?void 0:g.node.current;if(k&&y&&h&&g){const b=wm(k).some((T,R)=>l[R]!==T),j=KR(h,g),N=c7(h,g),S=b||!j?{x:0,y:0}:{x:N?r.width-y.width:0,y:N?r.height-y.height:0},C={x:y.left,y:y.top};return S.x&&S.y?C:od(C,S)}}}};function KR(e,t){return!yh(e)||!yh(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function c7(e,t){return!yh(e)||!yh(t)||!KR(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function bt({label:e="Loading dashboard data…"}){return s.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:s.jsx("div",{className:"chrome-card !px-4 !py-3",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function Rt({title:e="Something went wrong",error:t,action:n,onRetry:r,retryLabel:o="Retry"}){const i=n??(r?s.jsxs("button",{type:"button",onClick:r,className:"shell-action",children:[s.jsx(EO,{className:"h-4 w-4"}),s.jsx("span",{children:o})]}):null);return s.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),s.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),i?s.jsx("div",{className:"pt-2",children:i}):null]})})}function Vp({command:e,description:t,example:n}){return s.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[s.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?s.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?s.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function qe({title:e,description:t,children:n,className:r,actions:o}){return s.jsxs("section",{className:je("surface-panel space-y-3",r),children:[e||o?s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[e?s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?s.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),o]}):null,n]})}function u7({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return s.jsx(qe,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:s.jsx(De,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:s.jsx("div",{className:"space-y-3",children:n.map((r,o)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:o+1}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:r.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:r.detail}),r.command?s.jsx(Vp,{command:r.command.command,example:r.command.example}):null]})]})},r.title))})})}const xy={review:"{total} items ready for your review","review.singular":"Review {title}",ready_to_implement:"{total} plans ready to implement — start with {title}","ready_to_implement.singular":"Start implementing {title}",ready_for_planning:"{total} assignments ready to plan — start with {title}","ready_for_planning.singular":"Plan {title}",in_progress:"Resume {title} ({total} in progress)","in_progress.singular":"Resume {title}",draft:"Shape your {total} drafts — start with {title}","draft.singular":"Shape {title}",blocked:"Unblock {title} ({total} blocked)","blocked.singular":"Unblock {title}",stale:"Triage {total} stale items","stale.singular":"Triage {title} — sitting stale",clean:"You’re all clear. Nothing needs you right now."},pa={emptyStateCleanTitle:"You’re all clear",emptyStateCleanCTA:"Browse projects",recentSessionsEmptyTitle:"No recent sessions",recentSessionsEmptyHint:"Use /grab-assignment or `syntaur track-session` to register one.",recentSessionsCopyPathLabel:"Copy path",recentSessionsCopyPathDisabled:"Session has no path",recentSessionsCopyFallbackHint:"Press ⌘C to copy"};function d7(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function f7({hero:e,itemsById:t}){const n=mn();if(e.kind==="clean")return s.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-border/60 bg-background/60 p-6 shadow-sm",children:[s.jsx("p",{className:"eyebrow",children:pa.emptyStateCleanTitle}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:xy.clean}),s.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"When work shows up — a draft, a review, a stale row — it’ll surface here."}),s.jsx("div",{className:"mt-4",children:s.jsx(De,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:pa.emptyStateCleanCTA})})]});const r=e.itemId?t[e.itemId]:void 0,o=(r==null?void 0:r.assignmentTitle)??"",i=xy[e.copyKey]??xy[e.kind],a=d7(i,{total:e.total,title:o}),l=r?p7(r,n):`${n}/assignments`;return s.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-primary/20 bg-primary/5 p-6 shadow-sm",children:[s.jsx("p",{className:"eyebrow",children:"Top priority"}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:a}),r?s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["In ",s.jsx("span",{className:"font-medium text-foreground",children:r.projectTitle??"Standalone"})," ","· status ",s.jsx("span",{className:"font-medium text-foreground",children:r.status})]}):null,s.jsx("div",{className:"mt-4",children:s.jsxs(De,{to:l,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function p7(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const yy=["title","status","priority","assignee","dependencies","created","updated"],ad=24,GR=60;function h7(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Number.isInteger(t.w)&&t.w>=1&&t.w<=ad&&Number.isInteger(t.h)&&t.h>=1&&t.h<=GR}const m7={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},yS="2026-05-21T00:00:00Z";function by(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...m7,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:yS,updatedAt:yS}}const bi={version:1,views:[by("default-recently-updated","Recently updated",{}),by("default-high-priority","High priority",{priority:"high"}),by("default-stale","Stale",{activity:"stale"})],dashboard:{version:1,slots:[{id:"slot-0",widget:{kind:"agent-sessions"}},{id:"slot-1",widget:{kind:"saved-view",viewId:"default-recently-updated"}},{id:"slot-2",widget:{kind:"saved-view",viewId:"default-high-priority"}},{id:"slot-3",widget:{kind:"saved-view",viewId:"default-stale"}},{id:"slot-4",widget:{kind:"inventories"}}]}};function YR(e,t){const n=Ve(e.filters.project),r=n.length===0||n.length===1&&n[0]===t,o=e.filters.activity,i=typeof e.filters.search=="string"&&e.filters.search.trim().length>0,a=e.filters.query,l=typeof a=="string"&&a.trim().length>0&&Fu(a)===null;return r&&(!o||o==="all")&&!i&&!l}function XR(e,t){switch(t.kind){case"global":return e.workspace===null;case"workspace":return e.workspace===t.workspace||e.workspace===null;case"project":return e.workspace===t.workspace||e.workspace===null?YR(e.config,t.slug):!1}}const QR=`syntaur.savedViews.cache.v${bi.version}`;let Ul=g7(),ta=null,Pw=null;const Mb=new Set,bh=new Set;let JR=0;function ZR(){return++JR}function Ob(e){return e===JR}function g7(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(QR);if(!e)return null;const t=JSON.parse(e);return t.version!==bi.version?null:t}catch{return null}}function x7(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(QR,JSON.stringify(e))}catch{}}function eA(e){Ul=e,Pw=null,x7(e);for(const t of Mb)t(e);for(const t of bh)t(null)}function y7(e){Pw=e;for(const t of bh)t(e)}function tA(e){if(!e||typeof e!="object")return bi;const t=e;return t.version!==bi.version||!Array.isArray(t.views)||!t.dashboard?bi:t}function bS(){if(ta)return ta;const e=ZR();return ta=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=tA(t);return Ob(e)&&eA(n),ta=null,Ul??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Ob(e)&&y7(n),ta=null,Ul??bi}),ta}function _w(){const[e,t]=m.useState(()=>Ul??bi),[n,r]=m.useState(()=>Ul===null),[o,i]=m.useState(!1),[a,l]=m.useState(()=>Pw);return m.useEffect(()=>{let f=!1;Ul===null&&r(!0),bS().then(g=>{f||(t(g),r(!1),i(!0))});const p=g=>{f||(t(g),r(!1),i(!0),l(null))},h=g=>{f||(l(g),r(!1),i(!0))};return Mb.add(p),bh.add(h),()=>{f=!0,Mb.delete(p),bh.delete(h)}},[]),{file:e,loading:n,ready:o,error:a,refetch:()=>{ta=null,r(!0),l(null),i(!1),bS()}}}function zd(){const{file:e,loading:t}=_w();return{views:e.views,loading:t}}function nA(){const{file:e,loading:t}=_w();return{layout:e.dashboard,loading:t}}function ki(e){const{file:t,loading:n,ready:r,error:o,refetch:i}=_w();return e?{view:t.views.find(l=>l.id===e)??null,loading:n,ready:r,error:o,refetch:i}:{view:null,loading:!1,ready:!0,error:null,refetch:i}}async function Em(e,t,n){const r=ZR(),o=await fetch(t,{method:e,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!o.ok){const a=await o.json().catch(()=>({error:`HTTP ${o.status}`}));throw new Error(a.error??`HTTP ${o.status}`)}const i=tA(await o.json());return Ob(r)&&eA(i),i}function Zl(e){return Em("POST","/api/saved-views",e)}function vh(e,t){return Em("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function b7(e){return Em("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function Fb(e){return Em("PUT","/api/dashboard",{slots:e})}const v7=["top","right","bottom","left"],Si=Math.min,Mr=Math.max,wh=Math.round,dp=Math.floor,Js=e=>({x:e,y:e}),w7={left:"right",right:"left",bottom:"top",top:"bottom"};function zb(e,t,n){return Mr(e,Si(t,n))}function To(e,t){return typeof e=="function"?e(t):e}function Ro(e){return e.split("-")[0]}function Nc(e){return e.split("-")[1]}function Dw(e){return e==="x"?"y":"x"}function $w(e){return e==="y"?"height":"width"}function Gs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Iw(e){return Dw(Gs(e))}function j7(e,t,n){n===void 0&&(n=!1);const r=Nc(e),o=Iw(e),i=$w(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=jh(a)),[a,jh(a)]}function k7(e){const t=jh(e);return[Bb(e),t,Bb(t)]}function Bb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const vS=["left","right"],wS=["right","left"],S7=["top","bottom"],N7=["bottom","top"];function C7(e,t,n){switch(e){case"top":case"bottom":return n?t?wS:vS:t?vS:wS;case"left":case"right":return t?S7:N7;default:return[]}}function E7(e,t,n,r){const o=Nc(e);let i=C7(Ro(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Bb)))),i}function jh(e){const t=Ro(e);return w7[t]+e.slice(t.length)}function T7(e){return{top:0,right:0,bottom:0,left:0,...e}}function rA(e){return typeof e!="number"?T7(e):{top:e,right:e,bottom:e,left:e}}function kh(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function jS(e,t,n){let{reference:r,floating:o}=e;const i=Gs(t),a=Iw(t),l=$w(a),u=Ro(t),f=i==="y",p=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,g=r[l]/2-o[l]/2;let y;switch(u){case"top":y={x:p,y:r.y-o.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:h};break;case"left":y={x:r.x-o.width,y:h};break;default:y={x:r.x,y:r.y}}switch(Nc(t)){case"start":y[a]-=g*(n&&f?-1:1);break;case"end":y[a]+=g*(n&&f?-1:1);break}return y}async function R7(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:h="floating",altBoundary:g=!1,padding:y=0}=To(t,e),k=rA(y),b=l[g?h==="floating"?"reference":"floating":h],j=kh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:f,rootBoundary:p,strategy:u})),N=h==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},D=kh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:S,strategy:u}):N);return{top:(j.top-D.top+k.top)/C.y,bottom:(D.bottom-j.bottom+k.bottom)/C.y,left:(j.left-D.left+k.left)/C.x,right:(D.right-j.right+k.right)/C.x}}const A7=50,P7=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:R7},u=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:h}=jS(f,r,u),g=r,y=0;const k={};for(let v=0;v<i.length;v++){const b=i[v];if(!b)continue;const{name:j,fn:N}=b,{x:S,y:C,data:D,reset:T}=await N({x:p,y:h,initialPlacement:r,placement:g,strategy:o,middlewareData:k,rects:f,platform:l,elements:{reference:e,floating:t}});p=S??p,h=C??h,k[j]={...k[j],...D},T&&y<A7&&(y++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(f=T.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:p,y:h}=jS(f,g,u)),v=-1)}return{x:p,y:h,placement:g,strategy:o,middlewareData:k}},_7=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:u}=t,{element:f,padding:p=0}=To(e,t)||{};if(f==null)return{};const h=rA(p),g={x:n,y:r},y=Iw(o),k=$w(y),v=await a.getDimensions(f),b=y==="y",j=b?"top":"left",N=b?"bottom":"right",S=b?"clientHeight":"clientWidth",C=i.reference[k]+i.reference[y]-g[y]-i.floating[k],D=g[y]-i.reference[y],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let R=T?T[S]:0;(!R||!await(a.isElement==null?void 0:a.isElement(T)))&&(R=l.floating[S]||i.floating[k]);const $=C/2-D/2,P=R/2-v[k]/2-1,F=Si(h[j],P),_=Si(h[N],P),V=F,U=R-v[k]-_,I=R/2-v[k]/2+$,M=zb(V,I,U),B=!u.arrow&&Nc(o)!=null&&I!==M&&i.reference[k]/2-(I<V?F:_)-v[k]/2<0,W=B?I<V?I-V:I-U:0;return{[y]:g[y]+W,data:{[y]:M,centerOffset:I-M-W,...B&&{alignmentOffset:W}},reset:B}}}),D7=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:u,elements:f}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:v=!0,...b}=To(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const j=Ro(o),N=Gs(l),S=Ro(l)===l,C=await(u.isRTL==null?void 0:u.isRTL(f.floating)),D=g||(S||!v?[jh(l)]:k7(l)),T=k!=="none";!g&&T&&D.push(...E7(l,v,k,C));const R=[l,...D],$=await u.detectOverflow(t,b),P=[];let F=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&P.push($[j]),h){const I=j7(o,a,C);P.push($[I[0]],$[I[1]])}if(F=[...F,{placement:o,overflows:P}],!P.every(I=>I<=0)){var _,V;const I=(((_=i.flip)==null?void 0:_.index)||0)+1,M=R[I];if(M&&(!(h==="alignment"?N!==Gs(M):!1)||F.every(O=>Gs(O.placement)===N?O.overflows[0]>0:!0)))return{data:{index:I,overflows:F},reset:{placement:M}};let B=(V=F.filter(W=>W.overflows[0]<=0).sort((W,O)=>W.overflows[1]-O.overflows[1])[0])==null?void 0:V.placement;if(!B)switch(y){case"bestFit":{var U;const W=(U=F.filter(O=>{if(T){const H=Gs(O.placement);return H===N||H==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(H=>H>0).reduce((H,L)=>H+L,0)]).sort((O,H)=>O[1]-H[1])[0])==null?void 0:U[0];W&&(B=W);break}case"initialPlacement":B=l;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function kS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function SS(e){return v7.some(t=>e[t]>=0)}const $7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=To(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=kS(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:SS(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...i,altBoundary:!0}),l=kS(a,n.floating);return{data:{escapedOffsets:l,escaped:SS(l)}}}default:return{}}}}},sA=new Set(["left","top"]);async function I7(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=Ro(n),l=Nc(n),u=Gs(n)==="y",f=sA.has(a)?-1:1,p=i&&u?-1:1,h=To(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:k}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof k=="number"&&(y=l==="end"?k*-1:k),u?{x:y*p,y:g*f}:{x:g*f,y:y*p}}const L7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,u=await I7(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:a}}}}},M7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:u={fn:j=>{let{x:N,y:S}=j;return{x:N,y:S}}},...f}=To(e,t),p={x:n,y:r},h=await i.detectOverflow(t,f),g=Gs(Ro(o)),y=Dw(g);let k=p[y],v=p[g];if(a){const j=y==="y"?"top":"left",N=y==="y"?"bottom":"right",S=k+h[j],C=k-h[N];k=zb(S,k,C)}if(l){const j=g==="y"?"top":"left",N=g==="y"?"bottom":"right",S=v+h[j],C=v-h[N];v=zb(S,v,C)}const b=u.fn({...t,[y]:k,[g]:v});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:a,[g]:l}}}}}},O7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:u=!0,crossAxis:f=!0}=To(e,t),p={x:n,y:r},h=Gs(o),g=Dw(h);let y=p[g],k=p[h];const v=To(l,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const S=g==="y"?"height":"width",C=i.reference[g]-i.floating[S]+b.mainAxis,D=i.reference[g]+i.reference[S]-b.mainAxis;y<C?y=C:y>D&&(y=D)}if(f){var j,N;const S=g==="y"?"width":"height",C=sA.has(Ro(o)),D=i.reference[h]-i.floating[S]+(C&&((j=a.offset)==null?void 0:j[h])||0)+(C?0:b.crossAxis),T=i.reference[h]+i.reference[S]+(C?0:((N=a.offset)==null?void 0:N[h])||0)-(C?b.crossAxis:0);k<D?k=D:k>T&&(k=T)}return{[g]:y,[h]:k}}}},F7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:l}=t,{apply:u=()=>{},...f}=To(e,t),p=await a.detectOverflow(t,f),h=Ro(o),g=Nc(o),y=Gs(o)==="y",{width:k,height:v}=i.floating;let b,j;h==="top"||h==="bottom"?(b=h,j=g===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(j=h,b=g==="end"?"top":"bottom");const N=v-p.top-p.bottom,S=k-p.left-p.right,C=Si(v-p[b],N),D=Si(k-p[j],S),T=!t.middlewareData.shift;let R=C,$=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=N),T&&!g){const F=Mr(p.left,0),_=Mr(p.right,0),V=Mr(p.top,0),U=Mr(p.bottom,0);y?$=k-2*(F!==0||_!==0?F+_:Mr(p.left,p.right)):R=v-2*(V!==0||U!==0?V+U:Mr(p.top,p.bottom))}await u({...t,availableWidth:$,availableHeight:R});const P=await a.getDimensions(l.floating);return k!==P.width||v!==P.height?{reset:{rects:!0}}:{}}}};function Tm(){return typeof window<"u"}function Cc(e){return oA(e)?(e.nodeName||"").toLowerCase():"#document"}function Ur(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function no(e){var t;return(t=(oA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function oA(e){return Tm()?e instanceof Node||e instanceof Ur(e).Node:!1}function Ss(e){return Tm()?e instanceof Element||e instanceof Ur(e).Element:!1}function _o(e){return Tm()?e instanceof HTMLElement||e instanceof Ur(e).HTMLElement:!1}function NS(e){return!Tm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ur(e).ShadowRoot}function Bd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function z7(e){return/^(table|td|th)$/.test(Cc(e))}function Rm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const B7=/transform|translate|scale|rotate|perspective|filter/,U7=/paint|layout|strict|content/,Qi=e=>!!e&&e!=="none";let vy;function Lw(e){const t=Ss(e)?Ns(e):e;return Qi(t.transform)||Qi(t.translate)||Qi(t.scale)||Qi(t.rotate)||Qi(t.perspective)||!Mw()&&(Qi(t.backdropFilter)||Qi(t.filter))||B7.test(t.willChange||"")||U7.test(t.contain||"")}function H7(e){let t=Ni(e);for(;_o(t)&&!ec(t);){if(Lw(t))return t;if(Rm(t))return null;t=Ni(t)}return null}function Mw(){return vy==null&&(vy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),vy}function ec(e){return/^(html|body|#document)$/.test(Cc(e))}function Ns(e){return Ur(e).getComputedStyle(e)}function Am(e){return Ss(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ni(e){if(Cc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||NS(e)&&e.host||no(e);return NS(t)?t.host:t}function iA(e){const t=Ni(e);return ec(t)?e.ownerDocument?e.ownerDocument.body:e.body:_o(t)&&Bd(t)?t:iA(t)}function ld(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=iA(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=Ur(o);if(i){const l=Ub(a);return t.concat(a,a.visualViewport||[],Bd(o)?o:[],l&&n?ld(l):[])}else return t.concat(o,ld(o,[],n))}function Ub(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aA(e){const t=Ns(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=_o(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=wh(n)!==i||wh(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Ow(e){return Ss(e)?e:e.contextElement}function Hl(e){const t=Ow(e);if(!_o(t))return Js(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=aA(t);let a=(i?wh(n.width):n.width)/r,l=(i?wh(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const V7=Js(0);function lA(e){const t=Ur(e);return!Mw()||!t.visualViewport?V7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function W7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ur(e)?!1:t}function wa(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ow(e);let a=Js(1);t&&(r?Ss(r)&&(a=Hl(r)):a=Hl(e));const l=W7(i,n,r)?lA(i):Js(0);let u=(o.left+l.x)/a.x,f=(o.top+l.y)/a.y,p=o.width/a.x,h=o.height/a.y;if(i){const g=Ur(i),y=r&&Ss(r)?Ur(r):r;let k=g,v=Ub(k);for(;v&&r&&y!==k;){const b=Hl(v),j=v.getBoundingClientRect(),N=Ns(v),S=j.left+(v.clientLeft+parseFloat(N.paddingLeft))*b.x,C=j.top+(v.clientTop+parseFloat(N.paddingTop))*b.y;u*=b.x,f*=b.y,p*=b.x,h*=b.y,u+=S,f+=C,k=Ur(v),v=Ub(k)}}return kh({width:p,height:h,x:u,y:f})}function Pm(e,t){const n=Am(e).scrollLeft;return t?t.left+n:wa(no(e)).left+n}function cA(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Pm(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function q7(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",a=no(r),l=t?Rm(t.floating):!1;if(r===a||l&&i)return n;let u={scrollLeft:0,scrollTop:0},f=Js(1);const p=Js(0),h=_o(r);if((h||!h&&!i)&&((Cc(r)!=="body"||Bd(a))&&(u=Am(r)),h)){const y=wa(r);f=Hl(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const g=a&&!h&&!i?cA(a,u):Js(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+p.x+g.x,y:n.y*f.y-u.scrollTop*f.y+p.y+g.y}}function K7(e){return Array.from(e.getClientRects())}function G7(e){const t=no(e),n=Am(e),r=e.ownerDocument.body,o=Mr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Mr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Pm(e);const l=-n.scrollTop;return Ns(r).direction==="rtl"&&(a+=Mr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}const CS=25;function Y7(e,t){const n=Ur(e),r=no(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,u=0;if(o){i=o.width,a=o.height;const p=Mw();(!p||p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}const f=Pm(r);if(f<=0){const p=r.ownerDocument,h=p.body,g=getComputedStyle(h),y=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,k=Math.abs(r.clientWidth-h.clientWidth-y);k<=CS&&(i-=k)}else f<=CS&&(i+=f);return{width:i,height:a,x:l,y:u}}function X7(e,t){const n=wa(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=_o(e)?Hl(e):Js(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,u=o*i.x,f=r*i.y;return{width:a,height:l,x:u,y:f}}function ES(e,t,n){let r;if(t==="viewport")r=Y7(e,n);else if(t==="document")r=G7(no(e));else if(Ss(t))r=X7(t,n);else{const o=lA(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return kh(r)}function uA(e,t){const n=Ni(e);return n===t||!Ss(n)||ec(n)?!1:Ns(n).position==="fixed"||uA(n,t)}function Q7(e,t){const n=t.get(e);if(n)return n;let r=ld(e,[],!1).filter(l=>Ss(l)&&Cc(l)!=="body"),o=null;const i=Ns(e).position==="fixed";let a=i?Ni(e):e;for(;Ss(a)&&!ec(a);){const l=Ns(a),u=Lw(a);!u&&l.position==="fixed"&&(o=null),(i?!u&&!o:!u&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Bd(a)&&!u&&uA(e,a))?r=r.filter(p=>p!==a):o=l,a=Ni(a)}return t.set(e,r),r}function J7(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?Rm(t)?[]:Q7(t,this._c):[].concat(n),r],l=ES(t,a[0],o);let u=l.top,f=l.right,p=l.bottom,h=l.left;for(let g=1;g<a.length;g++){const y=ES(t,a[g],o);u=Mr(y.top,u),f=Si(y.right,f),p=Si(y.bottom,p),h=Mr(y.left,h)}return{width:f-h,height:p-u,x:h,y:u}}function Z7(e){const{width:t,height:n}=aA(e);return{width:t,height:n}}function eU(e,t,n){const r=_o(t),o=no(t),i=n==="fixed",a=wa(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const u=Js(0);function f(){u.x=Pm(o)}if(r||!r&&!i)if((Cc(t)!=="body"||Bd(o))&&(l=Am(t)),r){const y=wa(t,!0,i,t);u.x=y.x+t.clientLeft,u.y=y.y+t.clientTop}else o&&f();i&&!r&&o&&f();const p=o&&!r&&!i?cA(o,l):Js(0),h=a.left+l.scrollLeft-u.x-p.x,g=a.top+l.scrollTop-u.y-p.y;return{x:h,y:g,width:a.width,height:a.height}}function wy(e){return Ns(e).position==="static"}function TS(e,t){if(!_o(e)||Ns(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return no(e)===n&&(n=n.ownerDocument.body),n}function dA(e,t){const n=Ur(e);if(Rm(e))return n;if(!_o(e)){let o=Ni(e);for(;o&&!ec(o);){if(Ss(o)&&!wy(o))return o;o=Ni(o)}return n}let r=TS(e,t);for(;r&&z7(r)&&wy(r);)r=TS(r,t);return r&&ec(r)&&wy(r)&&!Lw(r)?n:r||H7(e)||n}const tU=async function(e){const t=this.getOffsetParent||dA,n=this.getDimensions,r=await n(e.floating);return{reference:eU(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nU(e){return Ns(e).direction==="rtl"}const rU={convertOffsetParentRelativeRectToViewportRelativeRect:q7,getDocumentElement:no,getClippingRect:J7,getOffsetParent:dA,getElementRects:tU,getClientRects:K7,getDimensions:Z7,getScale:Hl,isElement:Ss,isRTL:nU};function fA(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sU(e,t){let n=null,r;const o=no(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),i();const f=e.getBoundingClientRect(),{left:p,top:h,width:g,height:y}=f;if(l||t(),!g||!y)return;const k=dp(h),v=dp(o.clientWidth-(p+g)),b=dp(o.clientHeight-(h+y)),j=dp(p),S={rootMargin:-k+"px "+-v+"px "+-b+"px "+-j+"px",threshold:Mr(0,Si(1,u))||1};let C=!0;function D(T){const R=T[0].intersectionRatio;if(R!==u){if(!C)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R===1&&!fA(f,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(D,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,S)}n.observe(e)}return a(!0),i}function oU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=Ow(e),p=o||i?[...f?ld(f):[],...t?ld(t):[]]:[];p.forEach(j=>{o&&j.addEventListener("scroll",n,{passive:!0}),i&&j.addEventListener("resize",n)});const h=f&&l?sU(f,n):null;let g=-1,y=null;a&&(y=new ResizeObserver(j=>{let[N]=j;N&&N.target===f&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var S;(S=y)==null||S.observe(t)})),n()}),f&&!u&&y.observe(f),t&&y.observe(t));let k,v=u?wa(e):null;u&&b();function b(){const j=wa(e);v&&!fA(v,j)&&n(),v=j,k=requestAnimationFrame(b)}return n(),()=>{var j;p.forEach(N=>{o&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),h==null||h(),(j=y)==null||j.disconnect(),y=null,u&&cancelAnimationFrame(k)}}const iU=L7,aU=M7,lU=D7,cU=F7,uU=$7,RS=_7,dU=O7,fU=(e,t,n)=>{const r=new Map,o={platform:rU,...n},i={...o.platform,_c:r};return P7(e,t,{...o,platform:i})};var pU=typeof document<"u",hU=function(){},Wp=pU?m.useLayoutEffect:hU;function Sh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Sh(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Sh(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function pA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function AS(e,t){const n=pA(e);return Math.round(t*n)/n}function jy(e){const t=m.useRef(e);return Wp(()=>{t.current=e}),t}function mU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:u,open:f}=e,[p,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=m.useState(r);Sh(g,r)||y(r);const[k,v]=m.useState(null),[b,j]=m.useState(null),N=m.useCallback(O=>{O!==T.current&&(T.current=O,v(O))},[]),S=m.useCallback(O=>{O!==R.current&&(R.current=O,j(O))},[]),C=i||k,D=a||b,T=m.useRef(null),R=m.useRef(null),$=m.useRef(p),P=u!=null,F=jy(u),_=jy(o),V=jy(f),U=m.useCallback(()=>{if(!T.current||!R.current)return;const O={placement:t,strategy:n,middleware:g};_.current&&(O.platform=_.current),fU(T.current,R.current,O).then(H=>{const L={...H,isPositioned:V.current!==!1};I.current&&!Sh($.current,L)&&($.current=L,jo.flushSync(()=>{h(L)}))})},[g,t,n,_,V]);Wp(()=>{f===!1&&$.current.isPositioned&&($.current.isPositioned=!1,h(O=>({...O,isPositioned:!1})))},[f]);const I=m.useRef(!1);Wp(()=>(I.current=!0,()=>{I.current=!1}),[]),Wp(()=>{if(C&&(T.current=C),D&&(R.current=D),C&&D){if(F.current)return F.current(C,D,U);U()}},[C,D,U,F,P]);const M=m.useMemo(()=>({reference:T,floating:R,setReference:N,setFloating:S}),[N,S]),B=m.useMemo(()=>({reference:C,floating:D}),[C,D]),W=m.useMemo(()=>{const O={position:n,left:0,top:0};if(!B.floating)return O;const H=AS(B.floating,p.x),L=AS(B.floating,p.y);return l?{...O,transform:"translate("+H+"px, "+L+"px)",...pA(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:L}},[n,l,B.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:U,refs:M,elements:B,floatingStyles:W}),[p,U,M,B,W])}const gU=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?RS({element:r.current,padding:o}).fn(n):{}:r?RS({element:r,padding:o}).fn(n):{}}}},xU=(e,t)=>{const n=iU(e);return{name:n.name,fn:n.fn,options:[e,t]}},yU=(e,t)=>{const n=aU(e);return{name:n.name,fn:n.fn,options:[e,t]}},bU=(e,t)=>({fn:dU(e).fn,options:[e,t]}),vU=(e,t)=>{const n=lU(e);return{name:n.name,fn:n.fn,options:[e,t]}},wU=(e,t)=>{const n=cU(e);return{name:n.name,fn:n.fn,options:[e,t]}},jU=(e,t)=>{const n=uU(e);return{name:n.name,fn:n.fn,options:[e,t]}},kU=(e,t)=>{const n=gU(e);return{name:n.name,fn:n.fn,options:[e,t]}};var SU="Arrow",hA=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return s.jsx(Sn.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});hA.displayName=SU;var NU=hA;function CU(e){const[t,n]=m.useState(void 0);return wi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let a,l;if("borderBoxSize"in i){const u=i.borderBoxSize,f=Array.isArray(u)?u[0]:u;a=f.inlineSize,l=f.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Fw="Popper",[mA,gA]=Ta(Fw),[EU,xA]=mA(Fw),yA=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return s.jsx(EU,{scope:t,anchor:r,onAnchorChange:o,children:n})};yA.displayName=Fw;var bA="PopperAnchor",vA=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=xA(bA,n),a=m.useRef(null),l=nr(t,a),u=m.useRef(null);return m.useEffect(()=>{const f=u.current;u.current=(r==null?void 0:r.current)||a.current,f!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(Sn.div,{...o,ref:l})});vA.displayName=bA;var zw="PopperContent",[TU,RU]=mA(zw),wA=m.forwardRef((e,t)=>{var ie,ne,ue,ge,Ne,Ce;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:k,...v}=e,b=xA(zw,n),[j,N]=m.useState(null),S=nr(t,ke=>N(ke)),[C,D]=m.useState(null),T=CU(C),R=(T==null?void 0:T.width)??0,$=(T==null?void 0:T.height)??0,P=r+(i!=="center"?"-"+i:""),F=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},_=Array.isArray(f)?f:[f],V=_.length>0,U={padding:F,boundary:_.filter(PU),altBoundary:V},{refs:I,floatingStyles:M,placement:B,isPositioned:W,middlewareData:O}=mU({strategy:"fixed",placement:P,whileElementsMounted:(...ke)=>oU(...ke,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[xU({mainAxis:o+$,alignmentAxis:a}),u&&yU({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?bU():void 0,...U}),u&&vU({...U}),wU({...U,apply:({elements:ke,rects:Ue,availableWidth:oe,availableHeight:ve})=>{const{width:be,height:Re}=Ue.reference,He=ke.floating.style;He.setProperty("--radix-popper-available-width",`${oe}px`),He.setProperty("--radix-popper-available-height",`${ve}px`),He.setProperty("--radix-popper-anchor-width",`${be}px`),He.setProperty("--radix-popper-anchor-height",`${Re}px`)}}),C&&kU({element:C,padding:l}),_U({arrowWidth:R,arrowHeight:$}),g&&jU({strategy:"referenceHidden",...U})]}),[H,L]=SA(B),z=ba(k);wi(()=>{W&&(z==null||z())},[W,z]);const Y=(ie=O.arrow)==null?void 0:ie.x,q=(ne=O.arrow)==null?void 0:ne.y,Q=((ue=O.arrow)==null?void 0:ue.centerOffset)!==0,[ee,Z]=m.useState();return wi(()=>{j&&Z(window.getComputedStyle(j).zIndex)},[j]),s.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:W?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(ge=O.transformOrigin)==null?void 0:ge.x,(Ne=O.transformOrigin)==null?void 0:Ne.y].join(" "),...((Ce=O.hide)==null?void 0:Ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(TU,{scope:n,placedSide:H,onArrowChange:D,arrowX:Y,arrowY:q,shouldHideArrow:Q,children:s.jsx(Sn.div,{"data-side":H,"data-align":L,...v,ref:S,style:{...v.style,animation:W?void 0:"none"}})})})});wA.displayName=zw;var jA="PopperArrow",AU={top:"bottom",right:"left",bottom:"top",left:"right"},kA=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=RU(jA,r),a=AU[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(NU,{...o,ref:n,style:{...o.style,display:"block"}})})});kA.displayName=jA;function PU(e){return e!==null}var _U=e=>({name:"transformOrigin",options:e,fn(t){var b,j,N;const{placement:n,rects:r,middlewareData:o}=t,a=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[f,p]=SA(n),h={start:"0%",center:"50%",end:"100%"}[p],g=(((j=o.arrow)==null?void 0:j.x)??0)+l/2,y=(((N=o.arrow)==null?void 0:N.y)??0)+u/2;let k="",v="";return f==="bottom"?(k=a?h:`${g}px`,v=`${-u}px`):f==="top"?(k=a?h:`${g}px`,v=`${r.floating.height+u}px`):f==="right"?(k=`${-u}px`,v=a?h:`${y}px`):f==="left"&&(k=`${r.floating.width+u}px`,v=a?h:`${y}px`),{data:{x:k,y:v}}}});function SA(e){const[t,n="center"]=e.split("-");return[t,n]}var DU=yA,$U=vA,IU=wA,LU=kA,MU=Symbol("radix.slottable");function OU(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=MU,t}var FU=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),zU="VisuallyHidden",NA=m.forwardRef((e,t)=>s.jsx(Sn.span,{...e,ref:t,style:{...FU,...e.style}}));NA.displayName=zU;var BU=NA,[_m]=Ta("Tooltip",[gA]),Dm=gA(),CA="TooltipProvider",UU=700,Hb="tooltip.open",[HU,Bw]=_m(CA),EA=e=>{const{__scopeTooltip:t,delayDuration:n=UU,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,a=m.useRef(!0),l=m.useRef(!1),u=m.useRef(0);return m.useEffect(()=>{const f=u.current;return()=>window.clearTimeout(f)},[]),s.jsx(HU,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(f=>{l.current=f},[]),disableHoverableContent:o,children:i})};EA.displayName=CA;var cd="Tooltip",[VU,Ud]=_m(cd),TA=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,u=Bw(cd,e.__scopeTooltip),f=Dm(t),[p,h]=m.useState(null),g=Ml(),y=m.useRef(0),k=a??u.disableHoverableContent,v=l??u.delayDuration,b=m.useRef(!1),[j,N]=pm({prop:r,defaultProp:o??!1,onChange:R=>{R?(u.onOpen(),document.dispatchEvent(new CustomEvent(Hb))):u.onClose(),i==null||i(R)},caller:cd}),S=m.useMemo(()=>j?b.current?"delayed-open":"instant-open":"closed",[j]),C=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,b.current=!1,N(!0)},[N]),D=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,N(!1)},[N]),T=m.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,N(!0),y.current=0},v)},[v,N]);return m.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),s.jsx(DU,{...f,children:s.jsx(VU,{scope:t,contentId:g,open:j,stateAttribute:S,trigger:p,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{u.isOpenDelayedRef.current?T():C()},[u.isOpenDelayedRef,T,C]),onTriggerLeave:m.useCallback(()=>{k?D():(window.clearTimeout(y.current),y.current=0)},[D,k]),onOpen:C,onClose:D,disableHoverableContent:k,children:n})})};TA.displayName=cd;var Vb="TooltipTrigger",RA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ud(Vb,n),i=Bw(Vb,n),a=Dm(n),l=m.useRef(null),u=nr(t,l,o.onTriggerChange),f=m.useRef(!1),p=m.useRef(!1),h=m.useCallback(()=>f.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx($U,{asChild:!0,...a,children:s.jsx(Sn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:sn(e.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:sn(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:sn(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:sn(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:sn(e.onBlur,o.onClose),onClick:sn(e.onClick,o.onClose)})})});RA.displayName=Vb;var Uw="TooltipPortal",[WU,qU]=_m(Uw,{forceMount:void 0}),AA=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Ud(Uw,t);return s.jsx(WU,{scope:t,forceMount:n,children:s.jsx(Ra,{present:n||i.open,children:s.jsx(aw,{asChild:!0,container:o,children:r})})})};AA.displayName=Uw;var tc="TooltipContent",PA=m.forwardRef((e,t)=>{const n=qU(tc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,a=Ud(tc,e.__scopeTooltip);return s.jsx(Ra,{present:r||a.open,children:a.disableHoverableContent?s.jsx(_A,{side:o,...i,ref:t}):s.jsx(KU,{side:o,...i,ref:t})})}),KU=m.forwardRef((e,t)=>{const n=Ud(tc,e.__scopeTooltip),r=Bw(tc,e.__scopeTooltip),o=m.useRef(null),i=nr(t,o),[a,l]=m.useState(null),{trigger:u,onClose:f}=n,p=o.current,{onPointerInTransitChange:h}=r,g=m.useCallback(()=>{l(null),h(!1)},[h]),y=m.useCallback((k,v)=>{const b=k.currentTarget,j={x:k.clientX,y:k.clientY},N=JU(j,b.getBoundingClientRect()),S=ZU(j,N),C=eH(v.getBoundingClientRect()),D=nH([...S,...C]);l(D),h(!0)},[h]);return m.useEffect(()=>()=>g(),[g]),m.useEffect(()=>{if(u&&p){const k=b=>y(b,p),v=b=>y(b,u);return u.addEventListener("pointerleave",k),p.addEventListener("pointerleave",v),()=>{u.removeEventListener("pointerleave",k),p.removeEventListener("pointerleave",v)}}},[u,p,y,g]),m.useEffect(()=>{if(a){const k=v=>{const b=v.target,j={x:v.clientX,y:v.clientY},N=(u==null?void 0:u.contains(b))||(p==null?void 0:p.contains(b)),S=!tH(j,a);N?g():S&&(g(),f())};return document.addEventListener("pointermove",k),()=>document.removeEventListener("pointermove",k)}},[u,p,a,f,g]),s.jsx(_A,{...e,ref:i})}),[GU,YU]=_m(cd,{isInside:!1}),XU=OU("TooltipContent"),_A=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,u=Ud(tc,n),f=Dm(n),{onClose:p}=u;return m.useEffect(()=>(document.addEventListener(Hb,p),()=>document.removeEventListener(Hb,p)),[p]),m.useEffect(()=>{if(u.trigger){const h=g=>{const y=g.target;y!=null&&y.contains(u.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,p]),s.jsx(iw,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:s.jsxs(IU,{"data-state":u.stateAttribute,...f,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(XU,{children:r}),s.jsx(GU,{scope:n,isInside:!0,children:s.jsx(BU,{id:u.contentId,role:"tooltip",children:o||r})})]})})});PA.displayName=tc;var DA="TooltipArrow",QU=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Dm(n);return YU(DA,n).isInside?null:s.jsx(LU,{...o,...r,ref:t})});QU.displayName=DA;function JU(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function ZU(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function eH(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function tH(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const l=t[i],u=t[a],f=l.x,p=l.y,h=u.x,g=u.y;p>r!=g>r&&n<(h-f)*(r-p)/(g-p)+f&&(o=!o)}return o}function nH(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),rH(t)}function rH(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var sH=EA,oH=TA,iH=RA,aH=AA,$A=PA;const ha=sH,Or=oH,Fr=iH,vr=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(aH,{children:s.jsx($A,{ref:r,sideOffset:t,className:je("z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));vr.displayName=$A.displayName;function Hw({items:e,align:t="end"}){const[n,r]=m.useState(!1),[o,i]=m.useState(null),a=m.useRef(null);if(m.useEffect(()=>{if(!n){i(null);return}function u(p){a.current&&!a.current.contains(p.target)&&r(!1)}function f(p){p.key==="Escape"&&r(!1)}return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f)}},[n]),e.length===0)return null;function l(u,f){const p=u.icon,h=je("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",f&&"pl-8",u.disabled?"opacity-50 cursor-not-allowed":u.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),g=f?u.active?s.jsx(Sr,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):s.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):p?s.jsx(p,{className:"h-4 w-4 shrink-0"}):null,y=s.jsxs(s.Fragment,{children:[g,s.jsx("span",{className:"block min-w-0 truncate",children:u.label})]});if(u.disabled){const k=s.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:s.jsx("button",{type:"button",disabled:!0,className:h,children:y})});return u.disabledReason?s.jsxs(Or,{children:[s.jsx(Fr,{asChild:!0,children:k}),s.jsx(vr,{side:"left",children:u.disabledReason})]},u.key):s.jsx("div",{children:k},u.key)}return u.href?s.jsx(De,{to:u.href,className:h,onClick:()=>r(!1),children:y},u.key):s.jsx("button",{type:"button",className:h,onClick:()=>{var k;(k=u.onSelect)==null||k.call(u),r(!1)},children:y},u.key)}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsx("button",{type:"button",onClick:()=>r(u=>!u),className:"shell-action",title:"More actions","aria-label":"More actions","aria-haspopup":"true","aria-expanded":n,children:s.jsx(oO,{className:"h-4 w-4"})}),n&&s.jsx("div",{className:je("absolute top-full mt-1 z-30 min-w-[220px] rounded-md border border-border/70 bg-background shadow-lg py-1",t==="end"?"right-0":"left-0"),children:s.jsx(ha,{delayDuration:200,children:e.map(u=>{if(u.submenu&&u.submenu.length>0){const f=u.icon,p=o===u.key;return s.jsxs("div",{children:[s.jsxs("button",{type:"button",className:je("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":p,onClick:()=>i(p?null:u.key),children:[f?s.jsx(f,{className:"h-4 w-4 shrink-0"}):null,s.jsx("span",{className:"block min-w-0 flex-1 truncate",children:u.label}),p?s.jsx(cr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):s.jsx(c2,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),p?u.submenu.map(h=>l(h,!0)):null]},u.key)}return l(u,!1)})})})]})}function PS(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const lH={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function cH(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,0,0,0,0).getTime()}function uH(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function dH(e,t,n=Date.now()){if(!t)return!0;const r=t.field==="created"?e.created??e.updated:e.updated,o=Date.parse(r);if(Number.isNaN(o))return!1;if(t.preset){const l=lH[t.preset];return l===void 0?!0:t.preset.startsWith("older_")?n-o>l:o>=n-l&&o<=n}const i=t.from&&t.from.length>0?t.from:void 0,a=t.to&&t.to.length>0?t.to:void 0;return!i&&!a?!0:!(i&&o<cH(i)||a&&o>uH(a))}function fH(e,t,n={}){const{workspace:r,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const a=Ve(t.status),l=Ve(t.priority),u=Ve(t.type),f=Ve(t.assignee),p=Ve(t.project),h=Ve(t.tags),{activity:g}=t;if(r){if(r==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==r)return!1}if(a.length&&!a.includes(e.status)||l.length&&!l.includes(e.priority)||u.length&&!u.includes(e.type??"")||g==="stale"&&!PS(e.updated)||g==="fresh"&&PS(e.updated))return!1;if(f.length){const y=e.assignee??"__unassigned__";if(!f.includes(y))return!1}if(p.length&&!p.some(k=>k==="__standalone__"?e.projectSlug==null:e.projectSlug===k))return!1;if(h.length){const y=e.tags??[];if(!h.some(k=>y.includes(k)))return!1}if(!dH(e,t.dateRange))return!1;if(o){const y=o.trim().toLowerCase();if(y&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(y))return!1}return!0}function ud(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const _S={critical:0,high:1,medium:2,low:3};function fp(e){return Date.parse(e??"")||0}function Hd(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"title":a=o.title.localeCompare(i.title);break;case"status":a=o.status.localeCompare(i.status);break;case"priority":a=(_S[o.priority]??99)-(_S[i.priority]??99);break;case"assignee":a=(o.assignee??"").localeCompare(i.assignee??"");break;case"dependencies":a=o.dependsOn.length-i.dependsOn.length;break;case"created":a=fp(o.created)-fp(i.created);break;case"updated":a=fp(o.updated)-fp(i.updated);break}return n==="asc"?a:-a})}function pH(e){const t=`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`;return{...e.facts??{},status:e.status,phase:e.phase,disposition:e.disposition,priority:e.priority,type:e.type,assignee:e.assignee,project:e.projectSlug,tags:e.tags,archived:e.archived,title:e.title,created:e.created,updated:e.updated,completedAt:e.completedAt,statusAge:e.statusAge,phaseAge:e.phaseAge,searchText:t}}function IA(e,t,n={}){const{workspace:r,includeArchived:o=!1,now:i=Date.now()}=n,a={now:i};return e.filter(l=>{if(l.archived===!0&&!o)return!1;if(r){if(r==="_ungrouped"){if(l.projectWorkspace!=null)return!1}else if(l.projectWorkspace!==r)return!1}if(!t)return!0;const u=pH(l);return t.predicate(u,a)})}const $m={hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},pinned:{kind:"bool"}};function Im(e){const t=e.name,n={fact:t,approved:`${t}Approved`,changesRequested:`${t}ChangesRequested`,by:`${t}By`,approvedBy:`${t}ApprovedBy`},r=e.type==="attestation"?[n.fact,n.approved,n.changesRequested,n.by,n.approvedBy].map(o=>o.toLowerCase()):[n.fact.toLowerCase()];return{storageKey:t,exports:n,registryKeys:r}}function hH(e){const t=[];for(const n of e??[]){if(!n||typeof n.name!="string")continue;const r=n.name.trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(r))continue;const o=(n.type??"").trim();if(o==="bool"||o==="number")t.push({name:r,type:o});else if(o==="attestation"){const i=(n.binds??"none").toString().trim()||"none";(i==="plan"||i==="commit"||i==="none")&&t.push({name:r,type:"attestation",binds:i})}}return t}function Wb(e){const t=[],n=new Map;for(const r of Object.keys($m))n.set(r,"built-in");for(const r of Object.keys(cm))n.set(r,"built-in");for(const r of e??[]){const o=((r==null?void 0:r.name)??"").trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(o)){t.push(`fact "${(r==null?void 0:r.name)??""}": invalid name — must match /^[a-z][a-zA-Z0-9]*$/`);continue}const i=(r.type??"").trim();if(i!=="bool"&&i!=="number"&&i!=="attestation"){t.push(`fact "${o}": invalid type "${r.type??""}" — expected bool, number, or attestation`);continue}if(i==="attestation"){const f=(r.binds??"none").toString().trim()||"none";if(f!=="plan"&&f!=="commit"&&f!=="none"){t.push(`fact "${o}": invalid binds "${r.binds}" — expected plan, commit, or none`);continue}}const l=Im(i==="attestation"?{name:o,type:i}:{name:o,type:i}).registryKeys,u=l.find(f=>n.has(f));if(u!==void 0){const f=n.get(u);f==="built-in"?t.push(`fact "${o}": exported field "${u}" collides with a built-in field`):f===o?t.push(`fact "${o}": duplicate declaration (a fact named "${o}" is already declared)`):t.push(`fact "${o}": exported field "${u}" collides with fact "${f}"`);continue}for(const f of l)n.set(f,o)}return t}function mH(e){const t=new Set([...Object.keys($m),...Object.keys(cm)]),n=[];for(const r of e){const o=Im(r).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(r)}}return n}function LA(e,t){const n=Im(t);t.type==="attestation"?(e[n.exports.fact.toLowerCase()]={kind:"bool",get:r=>r[n.exports.fact]},e[n.exports.approved.toLowerCase()]={kind:"bool",get:r=>r[n.exports.approved]},e[n.exports.changesRequested.toLowerCase()]={kind:"bool",get:r=>r[n.exports.changesRequested]},e[n.exports.by.toLowerCase()]={kind:"list",get:r=>r[n.exports.by]},e[n.exports.approvedBy.toLowerCase()]={kind:"list",get:r=>r[n.exports.approvedBy]}):e[n.exports.fact.toLowerCase()]={kind:t.type,get:r=>r[n.exports.fact]}}function Vw(e){const t={...$m};for(const n of e)LA(t,n);return t}function MA(e){const t={...cm};for(const n of e)LA(t,n);return t}function OA(e){const t=["status","priority","type","assignee","project","tag","tags","archived","title","search","created","updated","completedAt","statusAge","phase","disposition","phaseAge","hasRealObjective","acRealTotal","acRealChecked","acAllChecked","planExists","planApproved","workspaceSet","implementationStarted","depsSatisfied","unresolvedQuestions","progressStaleDays","blocked","parked","reviewRequested","pinned"],n=[];for(const r of e){const o=Im(r);r.type==="attestation"?n.push(o.exports.fact,o.exports.approved,o.exports.changesRequested,o.exports.by,o.exports.approvedBy):n.push(o.exports.fact)}return[...t,...n]}function St({title:e,description:t,actions:n}){return s.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:s.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[s.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?s.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const nc='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Lm({columns:e,items:t,getItemId:n,getColumnId:r,renderCard:o,canDrop:i,onMove:a,getExternalDragData:l,onCardContextMenu:u,emptyMessage:f="No cards in this column.",hiddenColumnIds:p,onHideColumn:h,compact:g=!1,dragDisabled:y=!1,boundedColumns:k=!1}){const v=k&&!g,b=m.useMemo(()=>new Set(p??[]),[p]),j=m.useMemo(()=>e.filter(B=>!b.has(B.id)),[e,b]),N=m.useMemo(()=>e.filter(B=>b.has(B.id)),[e,b]),[S,C]=m.useState(null),[D,T]=m.useState(null),R=m.useRef(null),$=m.useMemo(()=>new Map(t.map(B=>[n(B),B])),[n,t]),P=m.useMemo(()=>j.map(B=>({column:B,items:t.filter(W=>r(W)===B.id)})),[j,r,t]),F=S?$.get(S)??null:null;function _(B){if(!F)return{allowed:!1};const W=r(F);return(i==null?void 0:i({item:F,fromColumnId:W,toColumnId:B}))??{allowed:!0}}function V(){C(null),T(null)}function U(B,W,O){if(y)return;const H=(l==null?void 0:l(W))??null;!a&&!H||(B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",O),H&&B.dataTransfer.setData("application/json",JSON.stringify(H)),a&&C(O))}function I(B,W,O){y||!a||!F||!_(W).allowed||(B.preventDefault(),B.dataTransfer.dropEffect="move",T(L=>(L==null?void 0:L.columnId)===W&&L.index===O?L:{columnId:W,index:O}))}async function M(B,W,O){var q;if(B.preventDefault(),y||!a||!F){V();return}const H=r(F),z=(((q=P.find(Q=>Q.column.id===H))==null?void 0:q.items)??[]).findIndex(Q=>n(Q)===n(F));if(!_(W).allowed||z<0){V();return}if(H===W&&(O===z||O===z+1)){V();return}try{await a({item:F,fromColumnId:H,toColumnId:W,fromIndex:z,toIndex:O})}finally{V()}}return s.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[N.length>0&&h?s.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{children:"Hidden:"}),N.map(B=>s.jsxs("button",{type:"button",onClick:()=>h(B.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${B.title}" column`,children:[B.title," ×"]},B.id))]}):null,s.jsx("div",{className:je("grid min-w-max grid-flow-col items-start gap-4",g?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:P.map(({column:B,items:W})=>{const O=_(B.id),H=(D==null?void 0:D.columnId)===B.id;return s.jsxs("section",{className:je("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",g?"min-h-[200px] p-2":"min-h-[320px] p-3",v?"max-h-[70vh]":"",F&&!O.allowed?"border-dashed opacity-65":"",F&&O.allowed?"border-primary/30 bg-accent/30":"",H?"ring-2 ring-ring/30":""),title:F&&!O.allowed?O.reason:void 0,children:[s.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:je("font-semibold uppercase tracking-[0.16em] text-muted-foreground",g?"text-xs":"text-sm"),children:B.title}),B.description&&!g?s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:B.description}):null]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs font-semibold text-foreground",children:W.length}),h?s.jsx("button",{type:"button",onClick:()=>h(B.id),className:"rounded-full border border-transparent px-1.5 py-0.5 text-xs text-muted-foreground hover:border-border hover:text-foreground",title:`Hide "${B.title}" column`,"aria-label":`Hide column ${B.title}`,children:"×"}):null]})]}),s.jsxs("div",{className:je("flex flex-1 flex-col gap-3",v?"min-h-0 overflow-y-auto pr-1":""),onDragOver:L=>I(L,B.id,W.length),onDrop:L=>M(L,B.id,W.length),children:[W.length===0?y?s.jsx("div",{className:"flex min-h-[128px] items-center justify-center rounded-lg border border-border/60 bg-background/50 px-4 text-center text-sm text-muted-foreground",children:typeof f=="function"?f(B):f}):s.jsx(gH,{active:(D==null?void 0:D.columnId)===B.id&&D.index===0,disabled:!!F&&!O.allowed,children:typeof f=="function"?f(B):f}):null,W.map((L,z)=>{const Y=n(L),q=S===Y;return s.jsxs(m.Fragment,{children:[s.jsx("div",{className:je("h-2 rounded-full transition",(D==null?void 0:D.columnId)===B.id&&D.index===z?"bg-primary/70":"bg-transparent"),onDragOver:Q=>I(Q,B.id,z),onDrop:Q=>M(Q,B.id,z)}),s.jsx("div",{draggable:!y&&!!(a||l),onMouseDown:Q=>{R.current=Q.target},onDragStart:Q=>{const ee=R.current;if(ee!=null&&ee.closest(nc)){Q.preventDefault();return}U(Q,L,Y)},onDragEnd:V,onContextMenu:Q=>{if(!u)return;const ee=Q.target;ee!=null&&ee.closest(nc)||u(L,Q)},className:je("transition",!y&&(a||l)?"cursor-grab active:cursor-grabbing":"",q?"scale-[0.98] opacity-50":""),children:o(L,{dragging:q})})]},Y)}),W.length>0&&!y?s.jsx("div",{className:je("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(D==null?void 0:D.columnId)===B.id&&D.index===W.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",F&&!O.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},B.id)})})]})}function gH({active:e,disabled:t,children:n}){return s.jsx("div",{className:je("flex min-h-[128px] items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground transition",e?"border-primary/60 bg-primary/10 text-foreground":"border-border/60 bg-background/50",t?"opacity-45":""),children:n})}const So="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Vl="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",FA="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",qb="border-status-review-foreground/30 bg-status-review text-status-review-foreground",zA="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",BA="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",UA="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",qp=So,xH={draft:So,pending:So,ready_for_planning:So,ready_to_implement:Vl,in_progress:Vl,blocked:FA,review:qb,code_review:qb,completed:zA,failed:BA,active:Vl,stopped:So,archived:UA};function yH(e){return xH[e]??qp}const bH={slate:qp,gray:qp,grey:qp};function HA(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function vH(e){let t=e.trim().replace(/^#/,"");return t.length===3&&(t=t.split("").map(n=>n+n).join("")),t.length!==6||/[^0-9a-fA-F]/.test(t)?null:{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function wH(e,t){const n=t==null?void 0:t.trim();if(n)if(n.startsWith("#")){const r=vH(n);if(r){const{r:o,g:i,b:a}=r;return{className:"",style:{backgroundColor:`rgba(${o}, ${i}, ${a}, 0.15)`,borderColor:`rgba(${o}, ${i}, ${a}, 0.4)`,color:n}}}}else{const r=bH[n.toLowerCase()];if(r)return{className:r}}return{className:yH(e)}}function dd(e,t){const n=e.find(i=>i.id===t),{className:r,style:o}=wH(t,n==null?void 0:n.color);return{label:(n==null?void 0:n.label)??HA(t),className:r,style:o,iconName:n==null?void 0:n.icon}}function Kb(e){return e?!!e.terminal||e.id==="completed"||e.id==="failed":!1}function VA(e){const t=new Map(e.statuses.map(a=>[a.id,a])),n=e.order.length>0?e.order:e.statuses.map(a=>a.id),r=new Set,o=[],i=(a,l)=>{r.has(a)||(r.add(a),o.push({id:a,label:(l==null?void 0:l.label)??HA(a),terminal:Kb(l??{id:a})}))};for(const a of n)i(a,t.get(a));for(const a of e.statuses)i(a.id,a);return o}const WA={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:So,icon:xc},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:So,icon:ZM},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:So,icon:f2},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Vl,icon:SO},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Vl,icon:Vv},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:FA,icon:ih},review:{label:"Review",description:"Ready for inspection or approval.",className:qb,icon:TO},completed:{label:"Completed",description:"Finished successfully.",className:zA,icon:em},failed:{label:"Failed",description:"Could not be completed as planned.",className:BA,icon:ih},active:{label:"Active",description:"The project has active or review work in flight.",className:Vl,icon:bb},stopped:{label:"Stopped",description:"Session ended without completing.",className:So,icon:QM},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:UA,icon:bb}},qA="inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-medium tracking-normal shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0)] dark:shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0.04)]";function Gb(e){var t;return((t=WA[e])==null?void 0:t.icon)??bb}function kn({status:e,className:t,showIcon:n=!0,progress:r}){var y;const o=As(),i=dd(o.statuses,e),a=Gb(e),l=i.label,u=((y=o.statuses.find(k=>k.id===e))==null?void 0:y.description)??Vd(e),f=r&&r.total>0,p=f?Math.min(1,Math.max(0,r.checked/r.total)):0,h=f?`${l} — ${u} (${r.checked}/${r.total} criteria)`:`${l} — ${u}`,g=n?f?s.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:[s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[s.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),s.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*7,strokeDashoffset:2*Math.PI*7*(1-p)})]}),s.jsx(a,{className:"h-2.5 w-2.5"})]}):s.jsx(a,{className:"h-3.5 w-3.5 shrink-0"}):null;return s.jsxs("span",{title:h,className:je(qA,i.className,t),style:i.style,children:[g,s.jsx("span",{className:"min-w-0 truncate",children:l})]})}function Vd(e){var t;return((t=WA[e])==null?void 0:t.description)??`Status: ${e}`}function Aa({type:e,className:t,compact:n=!1}){const r=$d();if(!e)return null;const o=pz(r,e),i=(o==null?void 0:o.label)??e.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase()),a=o!=null&&o.color?{backgroundColor:`color-mix(in oklch, ${o.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${o.color} 50%, transparent)`,color:o.color}:void 0;return s.jsx("span",{title:(o==null?void 0:o.description)??`Type: ${i}`,style:a,className:je("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!a&&"border-border/60 text-muted-foreground",t),children:i})}async function Wd(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return jH(e)}function jH(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function Hr({value:e,label:t,disabled:n=!1,disabledReason:r,onError:o}){const[i,a]=m.useState(!1);async function l(){n||(await Wd(e)?(a(!0),setTimeout(()=>a(!1),1500)):o==null||o(new Error("Copy to clipboard failed in this context.")))}return n?s.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:r??"Copy unavailable","aria-label":t??"Copy",children:s.jsx(ah,{className:"h-3 w-3","aria-hidden":"true"})}):s.jsx("button",{type:"button",onClick:l,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded",title:i?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:i?s.jsx(Sr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(ah,{className:"h-3 w-3","aria-hidden":"true"})})}function kH(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function SH({items:e,statusOrder:t,sortField:n,sortDirection:r,listSectionVisibility:o,compact:i=!1}){const a=As(),[l,u]=m.useState(()=>new Set(o.collapsed));m.useEffect(()=>{u(new Set(o.collapsed))},[o]);const f=p=>{u(h=>{const g=new Set(h);return g.has(p)?g.delete(p):g.add(p),g})};return s.jsx("div",{className:je("space-y-2",i?"space-y-1.5":"space-y-3"),children:t.map(p=>{const h=Hd(e.filter(k=>k.status===p),n,r);if(h.length===0)return null;const g=!l.has(p),y=Co(a,p);return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[s.jsxs("button",{type:"button",onClick:()=>f(p),className:je("flex w-full items-center gap-2 text-left",i?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[s.jsx(cr,{className:je("text-muted-foreground transition-transform",i?"h-3.5 w-3.5":"h-4 w-4",g?"":"-rotate-90")}),s.jsx("span",{className:"font-semibold text-foreground",children:y}),s.jsx("span",{className:je("rounded-full border border-border/60 text-muted-foreground",i?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:h.length})]}),g&&s.jsx("ul",{className:je("divide-y divide-border/40 border-t border-border/40",i?"text-xs":"text-sm"),children:h.map(k=>{const v=kH(k);return s.jsx("li",{children:s.jsxs(De,{to:v,className:je("flex items-center gap-3 hover:bg-muted/40",i?"px-3 py-1.5":"px-4 py-2.5"),children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:k.title}),k.projectTitle?s.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:k.projectTitle}):null,s.jsx("span",{className:"shrink-0 text-muted-foreground",children:Yn(k.updated)})]})},`${k.projectSlug??"standalone"}:${k.id}`)})})]},p)})})}function NH(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function CH({items:e,sortField:t,sortDirection:n,tableColumnVisibility:r,compact:o=!1}){const i=new Set(r.hidden);i.delete("title");const a=p=>!i.has(p),l=Hd(e,t,n),u=o?"py-2 pr-3":"py-3 pr-4",f=o?"text-xs":"text-sm";return s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:je("w-full text-left",f),children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[a("title")?s.jsx("th",{className:je("font-medium",u),children:"Assignment"}):null,a("status")?s.jsx("th",{className:je("font-medium",u),children:"Status"}):null,a("priority")?s.jsx("th",{className:je("font-medium",u),children:"Priority"}):null,a("assignee")?s.jsx("th",{className:je("font-medium",u),children:"Assignee"}):null,a("dependencies")?s.jsx("th",{className:je("font-medium",u),children:"Dependencies"}):null,a("created")?s.jsx("th",{className:je("font-medium",u),children:"Created"}):null,a("updated")?s.jsx("th",{className:je("font-medium",u),children:"Updated"}):null]})}),s.jsx("tbody",{children:l.map(p=>{const h=NH(p),g=`${p.projectSlug??"standalone"}:${p.id}`;return s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[a("title")?s.jsxs("td",{className:u,children:[s.jsx(De,{to:h,className:"font-semibold text-foreground hover:text-primary",children:p.title}),p.projectTitle?s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:p.projectTitle}):null]}):null,a("status")?s.jsx("td",{className:u,children:s.jsx(kn,{status:p.status,className:"max-w-[150px]"})}):null,a("priority")?s.jsx("td",{className:je("capitalize text-muted-foreground",u),children:p.priority}):null,a("assignee")?s.jsx("td",{className:je("text-muted-foreground",u),children:p.assignee??"Unassigned"}):null,a("dependencies")?s.jsx("td",{className:je("text-muted-foreground",u),children:p.dependsOn.length}):null,a("created")?s.jsx("td",{className:je("text-muted-foreground",u),children:Yn(p.created)}):null,a("updated")?s.jsx("td",{className:je("text-muted-foreground",u),children:Yn(p.updated)}):null]},g)})})]})})}function KA({view:e,compact:t,emptyDescription:n}){const{data:r,loading:o,error:i}=om(),a=As(),l=m.useMemo(()=>a.order.map(p=>({id:p,title:Co(a,p),description:Vd(p)})),[a]),u=m.useMemo(()=>MA(a.factDeclarations),[a.factDeclarations]),f=m.useMemo(()=>{if(!r)return[];const p=e.config.filters.query??Ou(e.config.filters);let h=null;p.trim()!==""&&(h=Jl(p,u).query);const g=IA(r.assignments,h,{workspace:e.workspace});return Hd(g,e.config.sortField,e.config.sortDirection)},[r,e,u]);if(o&&!r)return s.jsx(bt,{label:"Loading assignments…"});if(i)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});if(f.length===0)return s.jsx(St,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return s.jsx(Lm,{compact:t,dragDisabled:!0,columns:l,items:f,getItemId:p=>p.slug||p.id,getColumnId:p=>p.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:p=>t?s.jsx(EH,{item:p}):s.jsx(TH,{item:p})});case"list":return s.jsx(SH,{items:f,statusOrder:a.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return s.jsx(CH,{items:f,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function EH({item:e}){const t=ud(e);return s.jsxs("div",{className:je("rounded-md border border-border/60 bg-background/85 p-2 shadow-sm"),children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(De,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),s.jsx(kn,{status:e.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),s.jsx("span",{className:"shrink-0",children:Yn(e.updated)})]}),e.id?s.jsxs("p",{className:"mt-1 inline-flex items-center gap-1 font-mono text-[10px] text-muted-foreground/70",children:[e.id.slice(0,8),s.jsx(Hr,{value:e.id})]}):null]})}function TH({item:e}){const t=ud(e);return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(De,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),s.jsx(kn,{status:e.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[s.jsx(Aa,{type:e.type,compact:!0}),s.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),s.jsx("span",{className:"shrink-0",children:Yn(e.updated)})]})]})}function RH({viewId:e,onPickAnother:t}){const{view:n,loading:r,error:o,refetch:i}=ki(e);return r?s.jsx(bt,{label:"Loading view…"}):o?s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o.message}),s.jsx("button",{type:"button",onClick:()=>i(),className:"shell-action mt-3",children:"Retry"})]}):n?s.jsx(KA,{view:n,compact:!0,emptyDescription:"Adjust the view's filters to surface different work, or pick another widget for this slot."}):s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"View no longer exists"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The saved view this slot was bound to has been deleted."}),s.jsx("button",{type:"button",onClick:t,className:"shell-action mt-3",children:"Pick another widget"})]})}function GA({sessions:e}){return s.jsxs("aside",{"aria-labelledby":"overview-sessions-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsx("header",{className:"border-b border-border/40 px-4 py-3",children:s.jsx("h3",{id:"overview-sessions-title",className:"text-sm font-semibold text-foreground",children:"Recent Sessions"})}),e.length===0?s.jsxs("div",{className:"px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:pa.recentSessionsEmptyTitle}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:pa.recentSessionsEmptyHint})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>s.jsx("li",{children:s.jsx(AH,{session:t})},t.sessionId))})]})}function AH({session:e}){const t=mn(),[n,r]=m.useState(!1),o=PH(e,t),i=_H(e),a=!e.path;return s.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(De,{to:o,className:"block text-sm font-medium text-foreground hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:e.agent}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[i," · ",Yv(e.started)]}),n&&e.path?s.jsxs("div",{className:"mt-1 space-y-0.5",children:[s.jsx("code",{className:"block w-full select-all rounded bg-muted/40 px-1.5 py-0.5 text-xs text-foreground",children:e.path}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:pa.recentSessionsCopyFallbackHint})]}):null]}),s.jsx(Hr,{value:e.path,label:pa.recentSessionsCopyPathLabel,disabled:a,disabledReason:pa.recentSessionsCopyPathDisabled,onError:()=>r(!0)})]})}function PH(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function _H(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const DH={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function na(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function $H(e,t,n=Date.now()){const r=na(e);if(t.preset){const a=DH[t.preset];return a?t.preset.startsWith("older_")?r<n-a:r>=n-a:!0}const o=t.from?Date.parse(`${t.from}T00:00:00.000Z`):null,i=t.to?Date.parse(`${t.to}T23:59:59.999Z`):null;return!(o!==null&&Number.isFinite(o)&&r<o||i!==null&&Number.isFinite(i)&&r>i)}function IH(e,t,n=Date.now()){const{dateRange:r,project:o,agent:i,sessionStatus:a}=t,l=new Set(o??[]),u=new Set(i??[]),f=new Set(a??[]);return e.filter(p=>{if(r&&!$H(p.started,r,n))return!1;if(l.size>0){const h=p.projectSlug??"__standalone__";if(!l.has(h))return!1}if(u.size>0&&!Array.from(u).some(g=>g.toLowerCase()===p.agent.toLowerCase()))return!1;if(f.size>0){let h=!1;for(const g of f){switch(g){case"active":p.status==="active"&&(h=!0);break;case"ended":(p.status==="completed"||p.status==="stopped")&&(h=!0);break;case"tracked":h=!0;break}if(h)break}if(!h)return!1}return!0})}function LH(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"started":a=na(o.started)-na(i.started);break;case"lastActivity":a=na(o.updatedAt)-na(i.updatedAt);break;case"projectName":{const l=o.projectSlug??"",u=i.projectSlug??"";a=l.localeCompare(u);break}case"agentName":a=o.agent.localeCompare(i.agent);break;default:a=na(o.started)-na(i.started);break}return n==="asc"?a:-a})}function MH(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function OH({view:e,emptyDescription:t}){const{data:n,loading:r,error:o}=im(),i=m.useMemo(()=>{if(!n)return[];const a=n.sessions??[],{config:l}=e,u=l.filters,f={dateRange:u.dateRange?{...u.dateRange,field:"started"}:void 0,project:Ve(u.project),agent:Ve(u.agent),sessionStatus:Ve(u.sessionStatus),limit:l.limit};let p=IH(a,f);return p=LH(p,l.sortField,l.sortDirection),p=MH(p,l.limit),p},[n,e]);return r&&!n?s.jsx(bt,{label:"Loading sessions…"}):o?s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o})]}):i.length===0?s.jsx(St,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):s.jsx(GA,{sessions:i})}function FH({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:r,loading:o}=zd(),[i,a]=m.useState(!1),l=m.useRef(null),u=m.useMemo(()=>r.filter(h=>h.entityType==="session"),[r]);m.useEffect(()=>{if(!i)return;function h(y){l.current&&!l.current.contains(y.target)&&a(!1)}function g(y){y.key==="Escape"&&a(!1)}return document.addEventListener("mousedown",h),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",g)}},[i]);const f=e?r.find(h=>h.id===e)??null:null,p=o?"Session views…":f?f.name:"Session views";return s.jsxs("div",{className:"relative",ref:l,children:[s.jsxs("button",{type:"button",disabled:o,onClick:()=>a(h=>!h),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":i,title:"Session views",children:[s.jsx("span",{className:"max-w-[160px] truncate",children:p}),s.jsx(cr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),i&&s.jsxs("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:[s.jsxs("button",{type:"button",onClick:()=>{a(!1),t(null)},className:je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",!e&&"font-semibold text-foreground"),children:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e?null:s.jsx(Sr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),s.jsx("span",{children:"All sessions"})]}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"my-1 border-t border-border/40"}),u.map(h=>{const g=h.id===e;return s.jsxs("button",{type:"button",onClick:()=>{a(!1),t(h.id)},className:je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",g&&"font-semibold text-foreground"),children:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:g?s.jsx(Sr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),s.jsx("span",{className:"truncate",children:h.name})]},h.id)})]}),s.jsx("div",{className:"my-1 border-t border-border/40"}),s.jsxs("button",{type:"button",onClick:()=>{a(!1),n()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5 text-muted-foreground",children:[s.jsx(Mt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"Create new view…"})]})]})]})}const zH={__unassigned__:"Unassigned",__standalone__:"No project"};function wn({options:e,value:t,onChange:n,allLabel:r="Any",className:o,disabled:i,ariaLabel:a}){const[l,u]=m.useState(!1),f=m.useRef(null),p=m.useRef(null),h=m.useRef([]),g=m.useMemo(()=>{const N=new Set(e.map(C=>C.value)),S=t.filter(C=>!N.has(C)).map(C=>({value:C,label:zH[C]??C}));return[...e,...S]},[e,t]),y=m.useMemo(()=>new Set(t),[t]);m.useEffect(()=>{if(!l)return;function N(S){f.current&&!f.current.contains(S.target)&&u(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),m.useEffect(()=>{var N;l&&((N=h.current[0])==null||N.focus())},[l]);const k=m.useMemo(()=>{if(t.length===0)return r;if(t.length===1){const N=g.find(S=>S.value===t[0]);return N?N.label:t[0]}return`${t.length} selected`},[t,g,r]);function v(N){n(y.has(N)?t.filter(S=>S!==N):[...t,N])}function b(N){var C;const S=Math.max(0,Math.min(N,g.length-1));(C=h.current[S])==null||C.focus()}function j(N){var T;const S=h.current,C=document.activeElement,D=S.findIndex(R=>R===C);N.key==="ArrowDown"?(N.preventDefault(),b(D<0?0:D+1)):N.key==="ArrowUp"?(N.preventDefault(),b(D<0?g.length-1:D-1)):N.key==="Home"?(N.preventDefault(),b(0)):N.key==="End"?(N.preventDefault(),b(g.length-1)):N.key==="Escape"&&(N.preventDefault(),u(!1),(T=p.current)==null||T.focus())}return s.jsxs("div",{className:"relative",ref:f,children:[s.jsxs("button",{type:"button",ref:p,disabled:i,"aria-haspopup":"menu","aria-expanded":l,"aria-label":a,onClick:()=>u(N=>!N),onKeyDown:N=>{!l&&(N.key==="ArrowDown"||N.key==="ArrowUp")&&(N.preventDefault(),u(!0))},className:je("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",o),children:[s.jsx("span",{className:"truncate",children:k}),s.jsx(cr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),l?s.jsxs("div",{role:"menu","aria-label":a,onKeyDown:j,className:"absolute left-0 top-full z-30 mt-1 max-h-72 min-w-[200px] overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[s.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===g.length,onClick:()=>n(g.map(N=>N.value)),children:"Select all"}),s.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===0,onClick:()=>n([]),children:"Clear"})]}),g.length===0?s.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):g.map((N,S)=>{const C=y.has(N.value);return s.jsxs("button",{ref:D=>{h.current[S]=D},type:"button",role:"menuitemcheckbox","aria-checked":C,tabIndex:-1,onClick:()=>v(N.value),className:je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",C?"text-foreground":"text-muted-foreground"),children:[s.jsx("span",{className:je("flex h-4 w-4 shrink-0 items-center justify-center rounded border",C?"border-foreground bg-foreground text-background":"border-border/70"),"aria-hidden":"true",children:C?s.jsx(Sr,{className:"h-3 w-3"}):null}),s.jsx("span",{className:"truncate",children:N.label})]},N.value)})]}):null]})}const DS={last_24h:"Last 24 hours",last_7d:"Last 7 days",last_30d:"Last 30 days",last_90d:"Last 90 days",older_7d:"Older than 7 days",older_30d:"Older than 30 days"},BH=["updated","created"];function Mm({value:e,onChange:t,className:n,ariaLabel:r="Date range filter"}){const[o,i]=m.useState(!1),a=m.useRef(null),l=(e==null?void 0:e.field)??"updated",u=!!(e&&!e.preset&&(e.from||e.to)),[f,p]=m.useState(u);m.useEffect(()=>p(u),[u]),m.useEffect(()=>{if(!o)return;function j(S){a.current&&!a.current.contains(S.target)&&i(!1)}function N(S){S.key==="Escape"&&i(!1)}return document.addEventListener("mousedown",j),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",N)}},[o]);const h=!!(e&&(e.preset||e.from||e.to)),g=m.useMemo(()=>!h||!e?"Any date":e.preset?`${l}: ${DS[e.preset]??e.preset}`:`${l}: ${e.from||"…"} → ${e.to||"…"}`,[h,e,l]);function y(j){t(e?{...e,field:j}:{field:j,preset:"",from:"",to:""})}function k(j){p(!1),t({field:l,preset:j,from:"",to:""})}function v(){p(!1),t(null)}function b(j,N){const S={field:l,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...S,[j]:N})}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":o,"aria-label":r,onClick:()=>i(j=>!j),className:je("editor-input inline-flex items-center justify-between gap-1.5 text-left",h&&"border-foreground/40 text-foreground",n),children:[s.jsx("span",{className:"truncate",children:g}),s.jsx(cr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),o?s.jsxs("div",{className:"absolute left-0 top-full z-30 mt-1 w-64 rounded-md border border-border/70 bg-background p-2 shadow-lg",children:[s.jsx("div",{className:"mb-2 inline-flex rounded-md border border-border/60 bg-background/80 p-0.5",children:BH.map(j=>s.jsx("button",{type:"button","aria-pressed":l===j,onClick:()=>y(j),className:je("rounded-sm px-2.5 py-1 text-xs font-medium capitalize transition",l===j?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:j},j))}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ky,{label:"Any date",selected:!h,onClick:v}),M6.map(j=>s.jsx(ky,{label:DS[j],selected:(e==null?void 0:e.preset)===j,onClick:()=>k(j)},j)),s.jsx(ky,{label:"Custom range…",selected:f,onClick:()=>{p(!0),t({field:l,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""})}})]}),f?s.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/60 pt-2",children:[s.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["From",s.jsx("input",{type:"date",value:(e==null?void 0:e.from)??"",max:(e==null?void 0:e.to)||void 0,onChange:j=>b("from",j.target.value),className:"editor-input w-40"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["To",s.jsx("input",{type:"date",value:(e==null?void 0:e.to)??"",min:(e==null?void 0:e.from)||void 0,onChange:j=>b("to",j.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function ky({label:e,selected:t,onClick:n}){return s.jsxs("button",{type:"button",onClick:n,className:je("flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-left text-sm transition hover:bg-foreground/5",t?"text-foreground":"text-muted-foreground"),children:[s.jsx("span",{children:e}),t?s.jsx(Sr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const UH=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function HH(e,t){const n={};for(const[r,o]of Object.entries(e))UH.has(r)||(n[r]=o);return{...n,...t}}function Nh(e,t,n){return{...e,viewMode:t.viewMode,filters:HH(e.filters,t.filters),sortField:t.sortField,sortDirection:t.sortDirection,limit:t.limit,listSectionVisibility:{collapsed:[...n.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...n.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...n.tableColumnVisibility.hidden]}}}function VH(e,t){var g,y;const n={},r=Ve(e.status);r.length&&(n.status=r);const o=Ve(e.type);o.length&&(n.type=o);const i=Ve(e.priority);i.length&&(n.priority=i);const a=Ve(e.assignee);a.length&&(n.assignee=a);const l=Ve(e.tags);if(l.length&&(n.tags=l),t&&t!=="all")n.project=[t];else{const k=Ve(e.project);k.length&&(n.project=k)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const u=Ve(e.sessionStatus);u.length&&(n.sessionStatus=u);const f=Ve(e.agent);f.length&&(n.agent=f),e.dateRange&&(n.dateRange=e.dateRange);const p=(g=e.search)==null?void 0:g.trim();p&&(n.search=p);const h=(y=e.query)==null?void 0:y.trim();return h&&(n.query=h),n}function rc(e){const t={viewMode:e.state.viewMode,filters:VH(e.state.filters,e.context.projectSlug),sortField:e.state.sortField,sortDirection:e.state.sortDirection,listSectionVisibility:{collapsed:[...e.state.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...e.state.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...e.state.tableColumnVisibility.hidden]}};return{name:e.name.trim(),workspace:e.context.workspace,config:t}}const ml={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},pp={sortField:"started",sortDirection:"desc"};function YA(e,t){const{config:n}=rc({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:e.viewMode,filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),r={...n};return e.limit!==void 0&&e.limit>0&&(r.limit=e.limit),{workspace:t,config:r}}function Ww(e,t){const{config:n}=rc({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:"list",filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),r={...n};return e.limit!==void 0&&e.limit>0&&(r.limit=e.limit),{workspace:t,config:r}}function ma(e){if(!e)return;if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return;const r={field:e.field};return t&&(r.from=t),n&&(r.to=n),r}function Om(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function XA(e,t){var r,o,i,a,l,u,f,p,h,g,y,k,v,b,j;const{config:n}=e;if((r=t.setViewMode)==null||r.call(t,n.viewMode),(o=t.setStatusFilter)==null||o.call(t,Ve(n.filters.status)),(i=t.setTypeFilter)==null||i.call(t,Ve(n.filters.type)),(a=t.setPriorityFilter)==null||a.call(t,Ve(n.filters.priority)),(l=t.setAssigneeFilter)==null||l.call(t,Ve(n.filters.assignee)),(u=t.setProjectFilter)==null||u.call(t,Ve(n.filters.project)),(f=t.setTagsFilter)==null||f.call(t,Ve(n.filters.tags)),(p=t.setDateRange)==null||p.call(t,Om(n.filters.dateRange)),(h=t.setSearch)==null||h.call(t,n.filters.search??""),(g=t.setQuery)==null||g.call(t,n.filters.query??Ou(n.filters)),t.setActivityFilter){const N=n.filters.activity??"all";t.setActivityFilter(N==="fresh"||N==="stale"?N:"all")}(y=t.setSortField)==null||y.call(t,n.sortField),(k=t.setSortDirection)==null||k.call(t,n.sortDirection),(v=t.setListSectionVisibility)==null||v.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(b=t.setKanbanColumnVisibility)==null||b.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(j=t.setTableColumnVisibility)==null||j.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Kp(e){return e?`/w/${e}/views`:"/views"}function QA(e){return`${Kp(e.workspace)}/${encodeURIComponent(e.id)}`}function JA(e){const t=e.workspace?`/w/${e.workspace}`:"",n=Ve(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&YR(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const WH=["critical","high","medium","low"],qH={last_24h:"last 24 hours",last_7d:"last 7 days",last_30d:"last 30 days",last_90d:"last 90 days",older_7d:"older than 7 days",older_30d:"older than 30 days"};function KH(e){if(e.preset)return`${e.field} ${qH[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function ZA(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&Fu(t)===null)return`query: ${t}`;const n=[];for(const a of["status","priority","type","assignee","project","tags"]){const l=Ve(e[a]);l.length&&n.push(`${a}=${l.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(KH(e.dateRange));const r=(i=e.search)==null?void 0:i.trim();return r&&n.push(`search="${r}"`),n.join(" · ")||"no filters"}const $S=80,GH=["started","lastActivity","projectName","agentName"],YH={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},XH=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function eP({open:e,onOpenChange:t,initialView:n,onSubmit:r}){const o=!!n,{data:i}=to(),{data:a}=im(),[l,u]=m.useState(""),[f,p]=m.useState([]),[h,g]=m.useState([]),[y,k]=m.useState([]),[v,b]=m.useState(null),[j,N]=m.useState(pp.sortField),[S,C]=m.useState(pp.sortDirection),[D,T]=m.useState(""),[R,$]=m.useState(!1),[P,F]=m.useState(null);function _(){p([]),g([]),k([]),b(null),N(pp.sortField),C(pp.sortDirection),T("")}m.useEffect(()=>{if(e)if(F(null),$(!1),n){const O=n.config.filters;u(n.name),p(Ve(O.project)),g(Ve(O.agent)),k(Ve(O.sessionStatus)),b(Om(O.dateRange)),N(n.config.sortField),C(n.config.sortDirection),T(n.config.limit!==void 0?String(n.config.limit):"")}else u(""),_()},[e,n]);const V=m.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(H=>({value:H.slug,label:H.title}))],[i]),U=m.useMemo(()=>{const O=new Set;for(const H of(a==null?void 0:a.sessions)??[])H.agent&&O.add(H.agent);return Array.from(O).sort().map(H=>({value:H,label:H}))},[a]),I=l.trim(),M=I.length>0&&I.length<=$S,B=D.trim()===""?void 0:parseInt(D.trim(),10),W=D.trim()===""||Number.isFinite(B)&&B!==void 0&&B>0&&B<=500;return s.jsx(Mn,{open:e,onOpenChange:t,children:s.jsx(Nn,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async O=>{if(O.preventDefault(),!M||!W||R)return;$(!0),F(null);const H=ma(v),L=H?{...H,field:"started"}:void 0,z={filters:{project:f,agent:h,sessionStatus:y,dateRange:L},sortField:j,sortDirection:S,limit:B};try{await r(I,z)}catch(Y){F(Y instanceof Error?Y.message:String(Y)),$(!1)}},children:[s.jsx(sr,{children:s.jsx(Cn,{children:o?"Edit session view":"Create session view"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-session-view-name",children:"Name"}),s.jsx("input",{id:"create-session-view-name",type:"text",value:l,autoFocus:!0,required:!0,maxLength:$S,onChange:O=>u(O.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(gl,{label:"Date range (session start)",children:s.jsx(Mm,{className:"w-full",value:v,onChange:b})}),s.jsx(gl,{label:"Project",children:s.jsx(wn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:V,value:f,onChange:p})}),s.jsx(gl,{label:"Agent",children:s.jsx(wn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:U,value:h,onChange:g})}),s.jsx(gl,{label:"Session status",children:s.jsx(wn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:XH,value:y,onChange:k})}),s.jsx(gl,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:j,onChange:O=>N(O.target.value),className:"editor-input w-full",children:GH.map(O=>s.jsx("option",{value:O,children:YH[O]??O},O))}),s.jsx("button",{type:"button",onClick:()=>C(O=>O==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:S==="asc"?"Ascending":"Descending",children:S==="asc"?"Asc":"Desc"})]})}),s.jsxs(gl,{label:"Max results",className:"sm:col-span-2",children:[s.jsx("input",{type:"number",min:1,max:500,value:D,onChange:O=>T(O.target.value),placeholder:"No limit",className:"editor-input w-full"}),W?null:s.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:"Limit must be between 1 and 500"})]})]}),P?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:P}):null,s.jsxs(Wr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:_,className:"shell-action",disabled:R,children:"Clear all"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:R,children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!M||!W||R,className:"shell-action shell-action--cta disabled:opacity-50",children:R?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function gl({label:e,className:t,children:n}){return s.jsxs("label",{className:`space-y-1 ${t??""}`,children:[s.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}function Sy({title:e,message:t,onPickAnother:n}){return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:e}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t}),n?s.jsx("button",{type:"button",onClick:n,className:"shell-action mt-3",children:"Pick another widget"}):null]})}function QH({viewId:e,slotId:t,onPickAnother:n}){const{data:r,loading:o,error:i}=im(),{view:a,loading:l,ready:u}=ki(e??null),{layout:f}=nA(),{showToast:p}=Qn(),[h,g]=m.useState(!1),y=m.useCallback(async b=>{if(!t)return;const j=f.slots.map(N=>N.id===t?{...N,widget:b?{kind:"agent-sessions",viewId:b}:{kind:"agent-sessions"}}:N);try{await Fb(j)}catch(N){p(N instanceof Error?N.message:"Failed to update widget")}},[f,t,p]);async function k(b,j){const{workspace:N,config:S}=Ww(j,null);try{const D=(await Zl({name:b,workspace:N,config:S,entityType:"session"})).views.find(T=>T.name===b&&T.entityType==="session");D&&await y(D.id),g(!1),p(`Created session view "${b}"`)}catch(C){throw p(C instanceof Error?C.message:"Failed to create session view"),C}}let v;return e?l&&!u?v=s.jsx(bt,{label:"Loading view…"}):a?a.entityType!=="session"?v=s.jsx(Sy,{title:"Wrong view type",message:"This widget is bound to an assignment view. Choose a session view above, or pick a different widget.",onPickAnother:n}):v=s.jsx(OH,{view:a,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):v=s.jsx(Sy,{title:"View no longer exists",message:"The saved view this widget was bound to has been deleted. Pick another session view above, or choose a different widget.",onPickAnother:n}):o&&!r?v=s.jsx(bt,{label:"Loading sessions…"}):i?v=s.jsx(Sy,{title:"Couldn't load sessions",message:i}):v=s.jsx(GA,{sessions:(r==null?void 0:r.sessions)??[]}),s.jsxs("div",{className:"space-y-2",children:[t?s.jsx("div",{className:"flex items-center justify-between gap-2",children:s.jsx(FH,{activeViewId:e??null,onSelectView:b=>void y(b),onCreateNew:()=>g(!0)})}):null,v,s.jsx(eP,{open:h,onOpenChange:g,workspace:null,onSubmit:k})]})}const JH=5;function ZH(){const{data:e,loading:t,error:n}=W2();if(t&&!e)return s.jsx(bt,{label:"Loading inventories…"});if(n)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load inventories"}),s.jsx("p",{className:"mt-1 text-xs",children:n})]});const o=((e==null?void 0:e.inventories)??[]).slice(0,JH);return s.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[s.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),s.jsx(De,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),o.length===0?s.jsxs("div",{className:"px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:o.map(i=>{const a=i.inventory,l=i.active_leases.length,u=i.members.length,f=a.display_name??a.slug;return s.jsx("li",{children:s.jsxs(De,{to:`/inventories/${encodeURIComponent(a.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:f}),s.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[l,"/",u," leased"]})]})},a.slug)})})]})}function e9(e){let t=0,n=0;for(const r of e.daily)t+=r.total_tokens,n+=r.total_cost;return{tokens:t,cost:n}}function IS({filters:e,metric:t}){const n=e??{},{data:r,loading:o,error:i}=q4(n),a=t==="cost"?"Spend":"Token Usage",l=`/usage?${Nb(n).toString()}`;let u;if(o&&!r)u=s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});else if(i&&!r)u=s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load usage"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});else if(!r||r.daily.length===0)u=s.jsx("p",{className:"text-sm text-muted-foreground",children:"No usage for these filters."});else{const{tokens:f,cost:p}=e9(r),h=t==="cost"?{label:"Total spend",value:Ql(p)}:{label:"Total tokens",value:Xl(f)},g=t==="cost"?{label:"Tokens",value:Xl(f)}:{label:"Spend",value:Ql(p)};u=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(LS,{label:h.label,value:h.value,emphasize:!0}),s.jsx(LS,{label:g.label,value:g.value})]})}return s.jsxs("aside",{className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsxs("header",{className:"flex items-center justify-between gap-2 border-b border-border/40 px-4 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:a}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",title:_1(n),children:_1(n)})]}),s.jsx(De,{to:l,className:"shrink-0 text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),s.jsx("div",{className:"px-4 py-4",children:u})]})}function LS({label:e,value:t,emphasize:n}){return s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),s.jsx("p",{className:n?"text-2xl font-semibold tabular-nums text-foreground":"text-lg font-semibold tabular-nums text-foreground",children:t})]})}const t9={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function n9(e){return e.kind==="token-usage"||e.kind==="spend"?e.filters??{}:{}}const xl="bg-background border border-border rounded px-2 py-1 text-sm text-foreground";function MS({config:e,open:t,onSave:n,onCancel:r}){const o=e.kind==="spend"?"Configure Spend":"Configure Token Usage",{data:i}=to(),{data:a}=Ea(),{data:l}=q2(t),[u,f]=m.useState("30d"),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,v]=m.useState(""),[b,j]=m.useState(""),[N,S]=m.useState(""),[C,D]=m.useState(""),[T,R]=m.useState(!1),[$,P]=m.useState(null);m.useEffect(()=>{if(!t)return;const M=n9(e);f(M.window??"30d"),h(M.since??""),y(M.until??""),v(M.project??""),j(M.workspace??""),S(M.model??""),D(M.tool??""),R(!1),P(null)},[t,e]);function F(){return Dd({window:u,since:u==="custom"?p:void 0,until:u==="custom"?g:void 0,project:k||void 0,workspace:b||void 0,model:N||void 0,tool:C||void 0})}async function _(M){if(M.preventDefault(),T)return;const B=F(),W=I4(B);if(!W.ok){P(W.errors.join("; "));return}R(!0),P(null);const O=e.kind==="token-usage"?{kind:"token-usage",filters:B}:e.kind==="spend"?{kind:"spend",filters:B}:e;try{await n(O)}catch(H){P(H instanceof Error?H.message:String(H)),R(!1)}}const V=(i==null?void 0:i.map(M=>M.slug))??[],U=(a==null?void 0:a.workspaces)??[],I=(a==null?void 0:a.hasUngrouped)??!1;return s.jsx(Mn,{open:t,onOpenChange:M=>{M||r()},children:s.jsx(Nn,{className:"max-w-md",children:s.jsxs("form",{onSubmit:_,children:[s.jsx(sr,{children:s.jsx(Cn,{children:o})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Window"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:sm.map(M=>s.jsx("button",{type:"button",onClick:()=>f(M),className:"rounded px-2.5 py-1 text-sm border "+(M===u?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:t9[M]},M))})]}),u==="custom"?s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Since"}),s.jsx("input",{type:"date",value:p,onChange:M=>h(M.target.value),className:xl})]}),s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Until"}),s.jsx("input",{type:"date",value:g,onChange:M=>y(M.target.value),className:xl})]})]}):null,s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),s.jsxs("select",{value:b,onChange:M=>{j(M.target.value),M.target.value&&v("")},className:xl,children:[s.jsx("option",{value:"",children:"All workspaces"}),I?s.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,U.map(M=>s.jsx("option",{value:M,children:M},M))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Project"}),s.jsxs("select",{value:k,onChange:M=>{v(M.target.value),M.target.value&&j("")},className:xl,children:[s.jsx("option",{value:"",children:"All projects"}),V.map(M=>s.jsx("option",{value:M,children:M},M))]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Model"}),s.jsxs("select",{value:N,onChange:M=>S(M.target.value),className:xl,children:[s.jsx("option",{value:"",children:"All models"}),((l==null?void 0:l.models)??[]).map(M=>s.jsx("option",{value:M,children:M},M))]})]}),s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Tool"}),s.jsxs("select",{value:C,onChange:M=>D(M.target.value),className:xl,children:[s.jsx("option",{value:"",children:"All tools"}),((l==null?void 0:l.tools)??[]).map(M=>s.jsx("option",{value:M,children:M},M))]})]})]}),$?s.jsx("p",{className:"text-xs text-destructive",role:"alert",children:$}):null]}),s.jsxs(Wr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:r,disabled:T,className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:T,className:"shell-action shell-action--cta",children:T?"Saving…":"Save"})]})]})})})}const qw={"saved-view":{title:"Saved view",icon:m2,render:(e,t)=>e.kind!=="saved-view"?null:m.createElement(RH,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Xh,render:(e,t)=>e.kind!=="agent-sessions"?null:m.createElement(QH,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:zv,render:()=>m.createElement(ZH)},"token-usage":{title:"Token Usage",icon:pO,render:e=>e.kind!=="token-usage"?null:m.createElement(IS,{filters:e.filters,metric:"tokens"}),ConfigEditor:MS},spend:{title:"Spend",icon:tm,render:e=>e.kind!=="spend"?null:m.createElement(IS,{filters:e.filters,metric:"cost"}),ConfigEditor:MS}},tP=50,Yb=16,r9=2,ua=6,Ch=11,Xb={w:6,h:2};function Gp(e,t,n){return Math.min(Math.max(e,t),n)}const s9=[{minWidth:1280,columns:24},{minWidth:1024,columns:16},{minWidth:768,columns:12},{minWidth:640,columns:6},{minWidth:0,columns:1}];function o9(e){if(!Number.isFinite(e)||e<0)return 1;for(const t of s9)if(e>=t.minWidth)return t.columns;return 1}function Yp(e,t){return t<=0?1:Gp(Math.round(e/ad*t),1,t)}function Qb(e){if(h7(e))return e;switch(e){case"small":return{w:8,h:ua};case"wide":return{w:16,h:ua};case"tall":return{w:8,h:Ch};case"large":return{w:16,h:Ch};default:return{w:8,h:ua}}}function i9(e,t){return t>0?Math.round(e/t):0}function a9(e,t=tP){return Math.round(e/t)}const l9=[{label:"Third",w:8,h:ua},{label:"Half",w:12,h:ua},{label:"Two-thirds",w:16,h:ua},{label:"Full",w:24,h:ua},{label:"Half tall",w:12,h:Ch},{label:"Full tall",w:24,h:Ch}];function c9({slot:e,activeColumns:t,colWidthPx:n,onReplace:r,onRemove:o,onRemoveSlot:i,onResize:a,onConfigChange:l}){const[u,f]=m.useState(!1),[p,h]=m.useState(null),g=m.useRef(null),{attributes:y,listeners:k,setNodeRef:v,setActivatorNodeRef:b,transform:j,transition:N,isDragging:S}=Cm({id:e.id}),C=Qb(e.size),D=p?p.renderW:Yp(C.w,t),T=p?p.h:C.h,R={transform:js.Translate.toString(j),transition:N,zIndex:S?50:void 0,position:S?"relative":void 0,gridColumn:`span ${D}`,gridRow:`span ${T}`};function $(B){g.current=null;try{B.currentTarget.releasePointerCapture(B.pointerId)}catch{}h(null)}function P(B){return{onPointerDown:W=>{if(g.current)return;W.preventDefault(),W.stopPropagation(),W.currentTarget.setPointerCapture(W.pointerId);const O=Yp(C.w,t);g.current={pointerId:W.pointerId,startX:W.clientX,startY:W.clientY,startRenderW:O,startH:C.h,axis:B,lastRenderW:O,lastH:C.h},h({renderW:O,h:C.h})},onPointerMove:W=>{const O=g.current;if(!O||W.pointerId!==O.pointerId)return;let H=O.startRenderW,L=O.startH;(O.axis==="w"||O.axis==="both")&&(H=Gp(O.startRenderW+i9(W.clientX-O.startX,n),1,t)),(O.axis==="h"||O.axis==="both")&&(L=Gp(O.startH+a9(W.clientY-O.startY),r9,GR)),O.lastRenderW=H,O.lastH=L,h({renderW:H,h:L})},onPointerUp:W=>{const O=g.current;if(!O||W.pointerId!==O.pointerId)return;const H=Qb(e.size),z={w:O.axis==="h"?H.w:Gp(Math.round(O.lastRenderW/t*ad),1,ad),h:O.lastH};$(W),(z.w!==H.w||z.h!==H.h)&&a(z)},onPointerCancel:W=>{const O=g.current;O&&W.pointerId===O.pointerId&&$(W)},onLostPointerCapture:W=>{const O=g.current;O&&W.pointerId===O.pointerId&&$(W)}}}const F="absolute z-10 touch-none rounded-sm bg-transparent transition hover:bg-primary/30",_=s.jsxs(s.Fragment,{children:[t>1?s.jsx("div",{"aria-hidden":"true",className:je(F,"right-0 top-0 h-full w-1.5 cursor-ew-resize"),...P("w")}):null,s.jsx("div",{"aria-hidden":"true",className:je(F,"bottom-0 left-0 h-1.5 w-full cursor-ns-resize"),...P("h")}),t>1?s.jsx("div",{"aria-hidden":"true",className:je(F,"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"),...P("both")}):null]}),V=s.jsx("button",{ref:b,...y,...k,type:"button","aria-label":"Drag to reorder widget",className:"touch-none cursor-grab text-muted-foreground/40 transition hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:cursor-grabbing",children:s.jsx(gc,{className:"h-4 w-4","aria-hidden":"true"})});if(e.widget===null)return s.jsxs("div",{ref:v,style:{...R,gridColumn:`span ${Yp(Xb.w,t)}`,gridRow:`span ${Xb.h}`},className:je("relative flex items-center justify-center rounded-lg border border-dashed border-border bg-card/40 p-3 shadow-sm transition-colors hover:border-primary/40 hover:bg-card/60",S&&"opacity-0"),children:[s.jsx("div",{className:"absolute left-2 top-2",children:V}),s.jsx("button",{type:"button","aria-label":"Remove slot",onClick:i,onPointerDown:B=>B.stopPropagation(),className:"absolute right-2 top-2 z-10 text-muted-foreground/50 transition hover:text-destructive",children:s.jsx(jn,{className:"h-4 w-4"})}),s.jsxs("button",{type:"button",onClick:r,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(Mt,{className:"h-4 w-4"}),"Add widget"]})]});const U=qw[e.widget.kind];if(!U)return s.jsxs("div",{ref:v,style:R,className:je("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",S&&"opacity-0"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[V,s.jsxs("div",{className:"flex-1 rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})]}),_]});const I=U.icon,M=U.ConfigEditor;return s.jsxs("div",{ref:v,style:R,className:je("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",S&&"opacity-0"),children:[s.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[V,s.jsx(I,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:s.jsx(d9,{slot:e,fallback:U.title})})]}),s.jsx(Hw,{items:[{key:"replace",label:"Replace…",icon:NO,onSelect:r},...U.ConfigEditor?[{key:"configure",label:"Configure…",icon:PO,onSelect:()=>f(!0)}]:[],{key:"size",label:"Size",icon:wO,submenu:l9.map(B=>({key:`size-${B.label}`,label:B.label,active:C.w===B.w&&C.h===B.h,onSelect:()=>a({w:B.w,h:B.h})}))},{key:"remove",label:"Remove",icon:jn,destructive:!0,onSelect:o}]})]}),s.jsx("div",{children:U.render(e.widget,{slotId:e.id,onPickAnother:r})}),M?s.jsx(M,{config:e.widget,open:u,onSave:async B=>{await l(B),f(!1)},onCancel:()=>f(!1)}):null,_]})}function u9({slot:e,activeColumns:t,colWidthPx:n}){const r=e.widget?qw[e.widget.kind]:null,o=r==null?void 0:r.icon,i=e.widget===null?"Empty widget slot":(r==null?void 0:r.title)??`Unknown widget kind: ${e.widget.kind}`,a=e.widget===null?Xb:Qb(e.size),l=Yp(a.w,t),u=n>0?l*n+(l-1)*Yb:void 0;return s.jsx("div",{"aria-hidden":"true",className:"min-w-[200px] rounded-lg border border-border/70 bg-card/95 p-3 shadow-xl ring-1 ring-foreground/10",style:{width:u?`${Math.max(u,200)}px`:void 0},children:s.jsxs("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[s.jsx(gc,{className:"h-4 w-4","aria-hidden":"true"}),o?s.jsx(o,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null,s.jsx("span",{className:"min-w-0 flex-1 truncate",children:i})]})})}function d9({slot:e,fallback:t}){var o,i;const n=((o=e.widget)==null?void 0:o.kind)==="saved-view"?e.widget.viewId:null,{view:r}=ki(n);return((i=e.widget)==null?void 0:i.kind)==="saved-view"&&r?s.jsx(s.Fragment,{children:r.name}):s.jsx(s.Fragment,{children:t})}const f9=["agent-sessions","inventories","token-usage","spend"];function p9({open:e,onOpenChange:t,onSelect:n}){const{views:r,loading:o}=zd();function i(a){n(a),t(!1)}return s.jsx(Mn,{open:e,onOpenChange:t,children:s.jsxs(Nn,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsx(Cn,{children:"Add a widget"}),s.jsx(ns,{children:"Choose a built-in widget, an assignment view, or a session view."})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:f9.map(a=>{const l=qw[a],u=l.icon;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:a}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx(u,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),s.jsx("span",{className:"font-medium text-foreground",children:l.title})]})},a)})})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),o?s.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):r.length===0?s.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",s.jsx(De,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):s.jsxs("div",{className:"space-y-3",children:[r.some(a=>a.entityType!=="session")&&s.jsxs("div",{children:[s.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Assignments"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:r.filter(a=>a.entityType!=="session").map(a=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:"saved-view",viewId:a.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:a.name}),a.workspace!==null?s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${a.workspace}`,children:a.workspace}):null,s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:a.config.viewMode})]})},a.id))})]}),r.some(a=>a.entityType==="session")&&s.jsxs("div",{children:[s.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Sessions"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:r.filter(a=>a.entityType==="session").map(a=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:"agent-sessions",viewId:a.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:a.name}),a.workspace!==null?s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${a.workspace}`,children:a.workspace}):null]})},a.id))})]})]}),!o&&r.some(a=>a.workspace!==null)?s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}const h9=(e,{currentCoordinates:t,context:n})=>{var h;const r=e.code==="ArrowRight"||e.code==="ArrowDown"?1:e.code==="ArrowLeft"||e.code==="ArrowUp"?-1:0;if(r===0)return;e.preventDefault();const o=n.over??n.active,i=(h=o==null?void 0:o.data.current)==null?void 0:h.sortable,a=i==null?void 0:i.items;if(!o||!a)return t;const l=a.indexOf(o.id);if(l===-1)return t;const u=a[l+r],f=u===void 0?null:n.droppableRects.get(u),p=n.collisionRect;return!f||!p?t:{x:f.left+(f.width-p.width)/2,y:f.top+(f.height-p.height)/2}};function m9(e){const t=new Set(e.map(o=>o.id));let n=-1;for(const o of t){const i=/^slot-(\d+)$/.exec(o);if(i){const a=parseInt(i[1],10);a>n&&(n=a)}}let r=n+1;for(;t.has(`slot-${r}`);)r++;return`slot-${r}`}function g9(e,t){const n={id:m9(e),widget:null};return[...e,n]}function x9(e,t){return e.filter(n=>n.id!==t)}function y9(){const{data:e,error:t,refetch:n}=O4(),{data:r}=U2(),{layout:o}=nA(),[i,a]=m.useState(!1),[l,u]=m.useState(null),[f,p]=m.useState(null),[h,g]=m.useState(o.slots),[y,k]=m.useState(null),v=m.useRef(null),[b,j]=m.useState(ad),[N,S]=m.useState(0);m.useEffect(()=>{const W=v.current;if(!W)return;const O=new ResizeObserver(H=>{for(const L of H){const z=L.contentRect.width,Y=o9(z),q=Y>0?(z-(Y-1)*Yb)/Y:0;j(Y),S(q)}});return O.observe(W),()=>O.disconnect()},[]),m.useEffect(()=>{g(o.slots)},[o.slots]);const C=bm(ji(kc,{activationConstraint:{distance:8}}),ji(jc,{coordinateGetter:h9}));Ai("list:overview"),en({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const D=m.useCallback(W=>{u(W),a(!0)},[]),T=m.useCallback(async(W,O)=>{p(null),g(W);try{await Fb(W)}catch(H){g(O),p(H instanceof Error?H.message:String(H))}},[]),R=m.useCallback(W=>{if(l===null)return;const O=h.map((H,L)=>L===l?{...H,widget:W}:H);u(null),T(O,h)},[h,l,T]),$=m.useCallback(W=>{const O=h.map((H,L)=>L===W?{...H,widget:null,size:void 0}:H);T(O,h)},[h,T]),P=m.useCallback(W=>{const O=x9(h,W);T(O,h)},[h,T]),F=m.useCallback(()=>{const W=g9(h);T(W,h)},[h,T]),_=m.useCallback((W,O)=>{const H=h.map((L,z)=>z===W?{...L,size:O}:L);T(H,h)},[h,T]),V=m.useCallback(W=>{const{active:O,over:H}=W;if(k(null),!H||O.id===H.id)return;const L=h.findIndex(q=>q.id===O.id),z=h.findIndex(q=>q.id===H.id);if(L===-1||z===-1)return;const Y=Sc(h,L,z);T(Y,h)},[h,T]),U=m.useCallback(W=>{k(String(W.active.id))},[]),I=h.find(W=>W.id===y)??null,M=m.useCallback(async(W,O)=>{const H=h,L=h.map((z,Y)=>Y===W?{...z,widget:O}:z);p(null),g(L);try{await Fb(L)}catch(z){g(H);const Y=z instanceof Error?z.message:String(z);throw p(Y),z instanceof Error?z:new Error(Y)}},[h]),B={};if(e)for(const W of Object.keys(e.segments))for(const O of e.segments[W].items)B[O.id]=O;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("header",{className:"space-y-2",children:[s.jsx("p",{className:"eyebrow",children:"Workspace Overview"}),s.jsx("h1",{className:"text-4xl font-semibold tracking-display text-foreground md:text-5xl",children:"What needs you today"})]}),e?s.jsx(f7,{hero:e.hero,itemsById:B}):t?s.jsx(Rt,{error:t,onRetry:n}):s.jsx(bt,{label:"Loading overview…"}),e!=null&&e.firstRun?s.jsx(u7,{help:r}):null,f?s.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Couldn't save dashboard layout: ",f]}):null,s.jsxs(Sm,{sensors:C,collisionDetection:vm,onDragStart:U,onDragCancel:()=>k(null),onDragEnd:V,children:[s.jsx(Nm,{items:h.map(W=>W.id),strategy:Rw,children:s.jsx("div",{ref:v,style:{display:"grid",gridTemplateColumns:`repeat(${b}, minmax(0, 1fr))`,gridAutoRows:`${tP}px`,gridAutoFlow:"dense",gap:`${Yb}px`},children:h.map((W,O)=>s.jsx(c9,{slot:W,index:O,activeColumns:b,colWidthPx:N,onReplace:()=>D(O),onRemove:()=>$(O),onRemoveSlot:()=>P(W.id),onResize:H=>_(O,H),onConfigChange:H=>M(O,H)},W.id))})}),s.jsx(X8,{dropAnimation:null,children:I?s.jsx(u9,{slot:I,activeColumns:b,colWidthPx:N}):null})]}),s.jsxs("button",{type:"button",onClick:F,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(Mt,{className:"h-4 w-4"}),"Add slot"]}),e!=null&&e.serverStats?s.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(Wv,{className:"h-3 w-3","aria-hidden":"true"}),s.jsxs("span",{children:["● ",e.serverStats.totalPorts," ports ·"," ",e.serverStats.deadSessions>0?`${e.serverStats.deadSessions} dead`:"all healthy"]})]}):null,s.jsx(p9,{open:i,onOpenChange:W=>{a(W),W||u(null)},onSelect:R})]})}const b9=["review","blocked","question","plan-approval"],v9={review:"Review",blocked:"Blocked",question:"Questions","plan-approval":"Plan approval"};function w9(e){const t=[];for(const n of b9){const r=e.filter(o=>o.category===n).sort((o,i)=>i.ageMs-o.ageMs);r.length!==0&&t.push({category:n,label:v9[n],count:r.length,items:r})}return t}function j9(e){if(!Number.isFinite(e)||e<0)return"just now";const t=Math.floor(e/1e3);if(t<60)return"just now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function nP(e,t){const n=encodeURIComponent(t);return e.project===null?{method:"POST",url:`/api/assignments/${encodeURIComponent(e.assignmentId)}/transitions/${n}`}:{method:"POST",url:`/api/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}/transitions/${n}`}}function k9(e){return e.project===null?{method:"POST",url:`/api/assignments/${encodeURIComponent(e.assignmentId)}/comments`}:{method:"POST",url:`/api/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}/comments`}}function S9(e,t){const n=encodeURIComponent(t);return e.project===null?{method:"PATCH",url:`/api/assignments/${encodeURIComponent(e.assignmentId)}/comments/${n}/resolved`}:{method:"PATCH",url:`/api/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}/comments/${n}/resolved`}}function Kw(e,t){const n=t?`?tab=${t}`:"";return e.project===null?`/assignments/${encodeURIComponent(e.assignmentId)}${n}`:`/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}${n}`}function N9(){const{items:e,total:t,loading:n,error:r,refetch:o}=QT(),{toast:i,showToast:a,dismissToast:l}=Qn();if(n&&e.length===0)return s.jsx(bt,{label:"Loading your inbox…"});if(r&&e.length===0)return s.jsx(Rt,{title:"Inbox unavailable",error:r,action:s.jsx("button",{type:"button",className:"shell-action",onClick:o,children:"Retry"})});const u=w9(e);return u.length===0?s.jsxs("div",{className:"space-y-4",children:[s.jsx(Xn,{toast:i,onDismiss:l}),s.jsx(OS,{total:0}),s.jsx(St,{title:"Nothing needs you right now",description:"No reviews, blocks, open questions, or plans awaiting approval across your projects. New items appear here the moment something needs a human decision."})]}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(Xn,{toast:i,onDismiss:l}),s.jsx(OS,{total:t}),u.map(f=>s.jsx(qe,{title:f.label,actions:s.jsx("span",{className:"rounded-full bg-foreground px-2.5 py-0.5 text-xs font-semibold text-background",children:f.count}),children:s.jsx("ul",{className:"space-y-3",children:f.items.map(p=>s.jsx(C9,{item:p,onMutated:o,onError:h=>a(h,"error"),onSuccess:h=>a(h,"success")},`${p.category}:${p.assignmentId}:${p.since}`))})},f.category))]})}function OS({total:e}){return s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("span",{className:"inline-flex h-9 w-9 items-center justify-center rounded-lg bg-card text-foreground shadow-sm ring-1 ring-border/60",children:s.jsx(h2,{className:"h-4 w-4"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Needs me"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e===0?"Everything is handled.":`${e} ${e===1?"item":"items"} awaiting your decision.`})]})]})}async function Eh(e,t,n,r){try{const o=await fetch(e.url,{method:e.method,headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const i=await o.json().catch(()=>null);throw new Error((i==null?void 0:i.error)||`HTTP ${o.status}`)}return n.onSuccess(r),n.onMutated(),!0}catch(o){return n.onError(o instanceof Error?o.message:String(o)),!1}}function C9({item:e,onMutated:t,onError:n,onSuccess:r}){return s.jsxs("li",{className:"flex flex-col gap-2 rounded-lg border border-border/70 bg-background/40 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[s.jsx(De,{to:Kw(e),className:"text-sm font-semibold text-foreground hover:underline",children:e.title}),s.jsx("span",{className:"text-xs text-muted-foreground",children:e.project?e.project:"standalone"}),s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",title:e.since,children:j9(e.ageMs)})]}),e.summary?s.jsx("p",{className:"text-sm text-muted-foreground",children:e.summary}):null,s.jsx(E9,{item:e,onMutated:t,onError:n,onSuccess:r}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-muted/60 px-2 py-1 font-mono text-[11px] text-muted-foreground",children:e.action.command}),s.jsx(Hr,{value:e.action.command,label:"Copy",onError:o=>n(o.message)})]})]})}function E9(e){switch(e.item.category){case"review":return s.jsx(T9,{...e});case"blocked":return s.jsx(R9,{...e});case"question":return s.jsx(A9,{...e});case"plan-approval":return s.jsx(P9,{...e});default:return null}}const ga="shell-action inline-flex items-center gap-1.5";function T9({item:e,onMutated:t,onError:n,onSuccess:r}){const[o,i]=m.useState(null),{acceptCommand:a,reopenCommand:l}=e;async function u(f,p){i(f),await Eh(nP(e,f),void 0,{onMutated:t,onError:n,onSuccess:r},`${p} — ${e.title}`),i(null)}return s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a?s.jsxs("button",{type:"button",className:ga,disabled:o!==null,onClick:()=>u(a,"Accepted"),children:[s.jsx(Sr,{className:"h-3.5 w-3.5"}),o===a?"Accepting…":"Accept"]}):null,l?s.jsxs("button",{type:"button",className:ga,disabled:o!==null,onClick:()=>u(l,"Reopened"),children:[s.jsx(vs,{className:"h-3.5 w-3.5"}),o===l?"Reopening…":"Reopen"]}):null]})}function R9({item:e,onMutated:t,onError:n,onSuccess:r}){const[o,i]=m.useState(""),[a,l]=m.useState(!1);async function u(){l(!0);const f=await Eh(nP(e,"unblock"),o.trim()?{reason:o.trim()}:void 0,{onMutated:t,onError:n,onSuccess:r},`Unblocked — ${e.title}`);l(!1),f&&i("")}return s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("input",{type:"text",value:o,onChange:f=>i(f.target.value),placeholder:"Reason (optional)",className:"min-w-[12rem] flex-1 rounded border border-border bg-background px-2 py-1 text-sm"}),s.jsxs("button",{type:"button",className:ga,disabled:a,onClick:u,children:[s.jsx(vO,{className:"h-3.5 w-3.5"}),a?"Unblocking…":"Unblock"]})]})}function A9({item:e,onMutated:t,onError:n,onSuccess:r}){const[o,i]=m.useState(""),[a,l]=m.useState(!1),u=e.commentId;async function f(){if(!o.trim())return;l(!0);const h=await Eh(k9(e),{body:o.trim(),type:"note",author:"human",...u?{replyTo:u}:{}},{onMutated:t,onError:n,onSuccess:r},`Replied — ${e.title}`);l(!1),h&&i("")}async function p(){if(!u){n("Could not determine which question to resolve — open the assignment to resolve it.");return}l(!0),await Eh({...S9(e,u)},{resolved:!0},{onMutated:t,onError:n,onSuccess:r},`Resolved — ${e.title}`),l(!1)}return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(De,{to:Kw(e,"comments"),className:ga,children:[s.jsx(Zh,{className:"h-3.5 w-3.5"}),"Open to answer"]}),s.jsxs("button",{type:"button",className:ga,disabled:a||!u,title:u?void 0:"Open the assignment to resolve this question.",onClick:p,children:[s.jsx(em,{className:"h-3.5 w-3.5"}),"Resolve"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("input",{type:"text",value:o,onChange:h=>i(h.target.value),placeholder:"Reply inline…",className:"min-w-[12rem] flex-1 rounded border border-border bg-background px-2 py-1 text-sm"}),s.jsxs("button",{type:"button",className:ga,disabled:a||!o.trim(),onClick:f,children:[s.jsx(d2,{className:"h-3.5 w-3.5"}),a?"Posting…":"Reply"]})]})]})}function P9({item:e}){return s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.jsxs(De,{to:Kw(e,"plan"),className:ga,children:[s.jsx(Zh,{className:"h-3.5 w-3.5"}),"Review plan"]})})}function _9({term:e,description:t}){return s.jsx("span",{title:t,className:"cursor-help rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-foreground underline decoration-dotted underline-offset-4",children:e})}function D9(){const{data:e,loading:t,error:n}=U2(),{openCheatsheet:r}=Ri();return t?s.jsx(bt,{label:"Loading help…"}):n||!e?s.jsx(Rt,{error:n||"Help content is unavailable."}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(qe,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center gap-2 rounded-md border border-border/70 bg-background/80 px-3 py-1.5 text-sm font-medium text-foreground hover:bg-accent",children:"Open shortcuts cheatsheet"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",s.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",Qs("Mod+k")," opens the command palette."]})]})}),s.jsx(qe,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:s.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(o=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:o},o))})}),s.jsx(qe,{title:"Getting Started",children:s.jsx("div",{className:"space-y-3",children:e.workflow.map((o,i)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?s.jsx(Vp,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?s.jsx(De,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsxs(qe,{title:"Core Concepts",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>s.jsx(_9,{term:o.term,description:o.description},o.term))}),s.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.term}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.term))})]}),s.jsx(qe,{title:"Status Guide",children:s.jsx("div",{className:"space-y-3",children:e.statusGuide.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(kn,{status:o.status}),s.jsx("p",{className:"font-semibold text-foreground",children:o.meaning})]}),s.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:o.useWhen})]},o.status))})})]}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsx(qe,{title:"Ownership And File Rules",children:s.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.files.map(i=>s.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:i},i))})]},o.label))})}),s.jsx(qe,{title:"How To Navigate The Dashboard",children:s.jsx("div",{className:"space-y-3",children:e.navigation.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),s.jsx(De,{className:"text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open"})]}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.label))})})]}),s.jsx(qe,{title:"CLI Quick Reference",children:s.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(o=>s.jsx(Vp,{command:o.command,description:o.description,example:o.example},o.command))})}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsx(qe,{title:"FAQ",children:s.jsx("div",{className:"space-y-3",children:e.faq.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.question}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.answer})]},o.question))})}),s.jsx(qe,{title:"First Project Checklist",children:s.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((o,i)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?s.jsx(Vp,{command:o.command.command,example:o.command.example}):null,o.href?s.jsx(De,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function Gw({children:e}){return s.jsx("div",{className:"chrome-card flex flex-col gap-2 !p-2.5 md:flex-row md:flex-wrap md:items-center",children:e})}const Fm=m.forwardRef(({value:e,onChange:t,placeholder:n="Search"},r)=>s.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[s.jsx(Ci,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),s.jsx("input",{ref:r,value:e,onChange:o=>t(o.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));Fm.displayName="SearchInput";function zm({value:e,options:t,onChange:n}){return s.jsx("div",{className:"inline-flex rounded-md border border-border/60 bg-background/80 p-1",children:t.map(r=>s.jsx("button",{type:"button","aria-pressed":e===r.value,onClick:()=>n(r.value),className:je("rounded-sm px-2.5 py-1.5 text-sm font-medium transition",e===r.value?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:r.label},r.value))})}const $9={completed:"bg-status-completed-foreground",in_progress:"bg-status-in-progress-foreground",review:"bg-status-review-foreground",blocked:"bg-status-blocked-foreground",failed:"bg-status-failed-foreground",pending:"bg-status-pending-foreground"},FS=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function Th({progress:e,className:t,showLegend:n=!1}){const r=As(),i=m.useMemo(()=>{let a=0;const l=Object.keys(e).filter(f=>f!=="total");return(r.order.length>0?[...r.order,...l.filter(f=>!r.order.includes(f))]:l).map(f=>({key:f,className:$9[f]??FS[a++%FS.length]}))},[r.order,e]).filter(a=>(e[a.key]??0)>0);return s.jsxs("div",{className:je("space-y-2",t),children:[s.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?s.jsx("div",{className:"h-full w-full bg-muted"}):i.map(a=>s.jsx("div",{className:a.className,style:{width:`${(e[a.key]??0)/e.total*100}%`},title:`${bn(a.key)}: ${e[a.key]??0}`},a.key))}),n?i.length>0?s.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:i.map(a=>s.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[s.jsx("span",{className:je("h-2 w-2 rounded-full",a.className)}),s.jsx("span",{children:bn(a.key)}),s.jsx("span",{className:"font-medium text-foreground",children:e[a.key]??0})]},a.key))}):s.jsx("p",{className:"text-xs text-muted-foreground/70",children:"No assignments yet"}):null]})}const I9=["pending","active","blocked","failed","completed"],Yw=I9,L9=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function rP(e){return e&&e.length>0?e:[...L9]}function M9(e,t,n){if(t<0||t>=e.length)return e;const r=[...e],[o]=r.splice(t,1),i=t<n?n-1:n;return r.splice(Math.max(0,Math.min(i,r.length)),0,o),r}const O9=220,hp=8;function sP({anchor:e,items:t,onClose:n}){const r=m.useRef(null),[o,i]=m.useState(null);return m.useLayoutEffect(()=>{if(!e){i(null);return}const a=r.current,l=(a==null?void 0:a.offsetWidth)??O9,u=(a==null?void 0:a.offsetHeight)??0,f=Math.max(hp,window.innerWidth-l-hp),p=Math.max(hp,window.innerHeight-u-hp);i({left:Math.min(e.x,f),top:Math.min(e.y,p)})},[e]),m.useEffect(()=>{if(!e)return;function a(f){r.current&&!r.current.contains(f.target)&&n()}function l(f){f.key==="Escape"&&n()}function u(){n()}return document.addEventListener("mousedown",a),document.addEventListener("keydown",l),document.addEventListener("contextmenu",a),window.addEventListener("scroll",u,!0),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",l),document.removeEventListener("contextmenu",a),window.removeEventListener("scroll",u,!0)}},[e,n]),!e||t.length===0?null:s.jsx("div",{ref:r,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(o==null?void 0:o.left)??e.x,top:(o==null?void 0:o.top)??e.y,visibility:o?"visible":"hidden"},children:s.jsx(ha,{delayDuration:200,children:t.map(a=>{const l=a.icon,u=je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",a.disabled?"cursor-not-allowed opacity-50":a.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),f=s.jsxs(s.Fragment,{children:[l?s.jsx(l,{className:"h-4 w-4 shrink-0"}):null,s.jsx("span",{className:"block min-w-0 truncate",children:a.label})]});if(a.disabled){const p=s.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:s.jsx("button",{type:"button",disabled:!0,className:u,children:f})});return a.disabledReason?s.jsxs(Or,{children:[s.jsx(Fr,{asChild:!0,children:p}),s.jsx(vr,{side:"left",children:a.disabledReason})]},a.key):s.jsx("div",{children:p},a.key)}return a.href?s.jsx(De,{to:a.href,className:u,onClick:()=>n(),children:f},a.key):s.jsx("button",{type:"button",className:u,onClick:()=>{var p;(p=a.onSelect)==null||p.call(a),n()},children:f},a.key)})})})}const F9="__ungrouped__";function Xw({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:r,title:o="Move to workspace",description:i="Pick the workspace this item should belong to."}){const{data:a,loading:l}=Ea(),[u,f]=m.useState(n),[p,h]=m.useState(!1),[g,y]=m.useState(null);m.useEffect(()=>{e&&(f(n),y(null))},[e,n]);const k=m.useMemo(()=>[...((a==null?void 0:a.workspaces)??[]).map(N=>({key:N,label:N,value:N})),{key:F9,label:"Ungrouped",value:null}],[a]),v=!p&&u!==n;async function b(){if(v){h(!0),y(null);try{await r(u),t(!1)}catch(j){y(j instanceof Error?j.message:"Failed to move item")}finally{h(!1)}}}return s.jsx(Mn,{open:e,onOpenChange:j=>p?void 0:t(j),children:s.jsxs(Nn,{children:[s.jsxs(sr,{children:[s.jsx(Cn,{children:o}),s.jsx(ns,{children:i})]}),s.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:l&&k.length===0?s.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[s.jsx(Vv,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):k.map(j=>{const N=j.value===n,S=j.value===u;return s.jsxs("button",{type:"button",disabled:N||p,onClick:()=>f(j.value),className:je("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",N?"cursor-not-allowed bg-foreground/5 text-muted-foreground":S?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[s.jsxs("span",{className:je("block min-w-0 truncate",j.value===null?"italic text-muted-foreground":""),children:[j.label,N?s.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),S?s.jsx(Sr,{className:"h-4 w-4 text-foreground"}):null]},j.key)})}),g?s.jsx("p",{className:"text-sm text-destructive",role:"alert",children:g}):null,s.jsxs(Wr,{children:[s.jsx("button",{type:"button",onClick:()=>t(!1),disabled:p,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",onClick:b,disabled:!v,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:p?"Moving…":"Move"})]})]})})}function zS(){const{workspace:e}=qt(),t=mn(),n=Wt(),{data:r,loading:o,error:i,refetch:a}=to(),{toast:l,showToast:u,dismissToast:f}=Qn(),p=m.useRef(null);Ai("list:projects");const[h,g]=m.useState(""),[y,k]=m.useState("all"),[v,b]=m.useState("all"),[j,N]=m.useState("updated"),[S,C]=Ts(),D=S.get("view"),T=D==="table"||D==="kanban"?D:"cards",R=z=>{C(Y=>{const q=new URLSearchParams(Y);return z==="cards"?q.delete("view"):q.set("view",z),q})},[$,P]=m.useState({}),[F,_]=m.useState(null),[V,U]=m.useState(null),I=m.useMemo(()=>r?r.filter(z=>{if(e){if(e==="_ungrouped"){if(z.workspace!==null)return!1}else if(z.workspace!==e)return!1}return y!=="all"&&z.status!==y||v!=="all"&&!z.tags.includes(v)?!1:h.trim()?`${z.title} ${z.tags.join(" ")} ${z.slug}`.toLowerCase().includes(h.toLowerCase()):!0}).sort((z,Y)=>B9(z,Y,j)):[],[r,h,y,v,j,e]),M=I.map(z=>`${z.slug}:${z.status}`).join("|");m.useEffect(()=>{P(U9(I))},[M,j]);const B=m.useMemo(()=>{const z=new Map(I.map(Y=>[Y.slug,Y]));return Yw.flatMap(Y=>($[Y]??I.filter(Q=>Q.status===Y).map(Q=>Q.slug)).map(Q=>z.get(Q)).filter(Q=>!!Q))},[I,$]),{visibleItems:W,visibleIndexByKey:O}=m.useMemo(()=>{const z=T==="kanban"?B:I,Y=new Map;return z.forEach((q,Q)=>Y.set(q.slug,Q)),{visibleItems:z,visibleIndexByKey:Y}},[T,I,B]),{hotkeyRowProps:H}=Id(W,{scope:"list:projects",onOpen:z=>n(`${t}/projects/${z.slug}`)});if(en({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var z;return(z=p.current)==null?void 0:z.focus()}}),en({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>a()}),o)return s.jsx(bt,{label:"Loading projects…"});if(i||!r)return s.jsx(Rt,{error:i||"Project list is unavailable.",onRetry:a});const L=Array.from(new Set(r.flatMap(z=>z.tags))).sort();return s.jsxs("div",{className:"space-y-5",children:[s.jsx(Xn,{toast:l,onDismiss:f}),s.jsxs(Gw,{children:[s.jsx(Fm,{ref:p,value:h,onChange:g,placeholder:"Search by project title or tag"}),s.jsxs("select",{value:y,onChange:z=>k(z.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All statuses"}),s.jsx("option",{value:"pending",children:"Pending"}),s.jsx("option",{value:"active",children:"Active"}),s.jsx("option",{value:"blocked",children:"Blocked"}),s.jsx("option",{value:"failed",children:"Failed"}),s.jsx("option",{value:"completed",children:"Completed"})]}),s.jsxs("select",{value:v,onChange:z=>b(z.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All tags"}),L.map(z=>s.jsx("option",{value:z,children:z},z))]}),s.jsxs("select",{value:j,onChange:z=>N(z.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"updated",children:"Sort: Updated"}),s.jsx("option",{value:"created",children:"Sort: Created"}),s.jsx("option",{value:"title",children:"Sort: Title"}),s.jsx("option",{value:"attention",children:"Sort: Attention"})]}),s.jsx(zm,{value:T,onChange:z=>R(z),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),I.length===0?r.length===0?s.jsxs("div",{className:"rounded-frame border border-border/60 bg-card px-6 py-16 text-center",children:[s.jsx("p",{className:"eyebrow mx-auto justify-center",children:"Start here"}),s.jsx("h2",{className:"mx-auto mt-4 max-w-2xl text-3xl font-semibold tracking-display text-foreground md:text-4xl",children:"The task manager built for agents, by agents"}),s.jsx("p",{className:"mx-auto mt-3 max-w-xl text-sm leading-6 text-muted-foreground",children:"A project groups assignments, resources, and memories under one objective. Markdown stays authoritative — the dashboard is just a view."}),s.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[s.jsx(De,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),s.jsx(De,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):s.jsx(St,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:s.jsx(De,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):T==="cards"?s.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:I.map((z,Y)=>s.jsxs(De,{to:`${t}/projects/${z.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...H(Y),children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:z.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Yn(z.updated)]})]}),s.jsx(kn,{status:z.status})]}),s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsx(Th,{progress:z.progress,showLegend:!0}),s.jsx("div",{className:"flex flex-wrap gap-2",children:z.tags.map(q=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:q},q))}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),s.jsx("p",{className:"mt-1 font-semibold text-foreground",children:z.needsAttention.blockedCount+z.needsAttention.failedCount})]}),s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("p",{className:"text-muted-foreground",children:"Assignments"}),s.jsx("p",{className:"mt-1 font-semibold text-foreground",children:z.progress.total})]})]})]})]},z.slug))}):T==="table"?s.jsx(qe,{title:`${I.length} project${I.length===1?"":"s"}`,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[s.jsx("th",{className:"pb-3 font-medium",children:"Project"}),s.jsx("th",{className:"pb-3 font-medium",children:"Status"}),s.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),s.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),s.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),s.jsx("tbody",{children:I.map((z,Y)=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",...H(Y),children:[s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx(De,{to:`${t}/projects/${z.slug}`,className:"font-semibold text-foreground hover:text-primary",children:z.title}),s.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:z.tags.map(q=>s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:q},q))})]}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx(kn,{status:z.status})}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx("div",{className:"min-w-[220px]",children:s.jsx(Th,{progress:z.progress})})}),s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:z.needsAttention.blockedCount+z.needsAttention.failedCount}),s.jsx("td",{className:"py-4 text-muted-foreground",children:Yn(z.updated)})]},z.slug))})]})})}):s.jsx(Lm,{columns:BS,items:B,getItemId:z=>z.slug,getColumnId:z=>z.status,canDrop:({fromColumnId:z,toColumnId:Y})=>({allowed:!0,reason:z===Y?void 0:"This will set a manual status override on the project."}),onMove:async({item:z,fromColumnId:Y,toColumnId:q,fromIndex:Q,toIndex:ee})=>{var Z;if(Y===q){const ie=$[Y]??I.filter(ne=>ne.status===Y).map(ne=>ne.slug);P(ne=>({...ne,[Y]:M9(ie,Q,ee)}));return}try{const ie=await fetch(`/api/projects/${z.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:q})});if(!ie.ok){const ue=await ie.json().catch(()=>null);u((ue==null?void 0:ue.error)||`HTTP ${ie.status}`,"error");return}a();const ne=((Z=BS.find(ue=>ue.id===q))==null?void 0:Z.title)??q;u(`Moved "${z.title}" to ${ne}`,"success")}catch(ie){u(ie instanceof Error?ie.message:"Failed to move project","error")}},getExternalDragData:z=>({type:"project",id:z.slug}),onCardContextMenu:(z,Y)=>{Y.preventDefault(),_({project:z,anchor:{x:Y.clientX,y:Y.clientY}})},emptyMessage:z=>`No ${z.title.toLowerCase()} projects.`,renderCard:(z,{dragging:Y})=>{const q=O.get(z.slug)??-1;return s.jsx("div",{...q>=0?H(q):{},children:s.jsx(H9,{project:z,dragging:Y})})}}),s.jsx(sP,{anchor:(F==null?void 0:F.anchor)??null,items:F?[{key:"edit",label:"Edit",icon:xc,onSelect:()=>n(`${t}/projects/${F.project.slug}`)},{key:"move",label:"Move to workspace…",icon:Jh,onSelect:()=>U(F.project)}]:[],onClose:()=>_(null)}),s.jsx(Xw,{open:V!==null,onOpenChange:z=>{z||U(null)},currentWorkspace:(V==null?void 0:V.workspace)??null,title:"Move project to workspace",onSubmit:async z=>{if(!V)return;const Y=await fetch(`/api/projects/${encodeURIComponent(V.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:z})});if(!Y.ok){const q=await Y.json().catch(()=>({}));throw new Error(q.error||"Failed to move project")}a()}}),s.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Hv,{className:"mt-0.5 h-4 w-4"}),s.jsxs("p",{children:["Project status is derived from assignment state by default.",T==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const z9={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},BS=Yw.map(e=>({id:e,title:z9[e],description:Vd(e)}));function B9(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return US(t)-US(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function US(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function U9(e){return Object.fromEntries(Yw.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function H9({project:e,dragging:t}){const n=mn();return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(De,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Yn(e.updated)]})]}),s.jsx(kn,{status:e.status})]}),s.jsx("div",{className:"mt-4",children:s.jsx(Th,{progress:e.progress})}),s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.tags.map(r=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:r},r)),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.progress.total," assignments"]}),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.needsAttention.blockedCount+e.needsAttention.failedCount," needs attention"]})]}),s.jsx("div",{className:"mt-4 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:t?"Reordering within status":"Derived project lane"})]})}function Rh({title:e,description:t,actions:n,className:r}){return s.jsxs("div",{className:je("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",r),children:[s.jsxs("div",{className:"space-y-1",children:[e?s.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?s.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?s.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}function V9(){return s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-status-archived-foreground/30 bg-status-archived px-2 py-0.5 text-xs font-medium text-status-archived-foreground",children:[s.jsx(Qh,{className:"h-3 w-3"}),"Archived"]})}function HS(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function W9(){const{data:e,loading:t,error:n,refetch:r}=F4(),[o,i]=m.useState(null),[a,l]=m.useState(null),[u,f]=m.useState({}),{toast:p,showToast:h,dismissToast:g}=Qn();async function y(S,C,D){i(C),l(null);try{const T=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"}});if(!T.ok){const R=await T.json().catch(()=>null);throw new Error((R==null?void 0:R.error)||`HTTP ${T.status}`)}r(),h(D,"success")}catch(T){l(T instanceof Error?T.message:"Restore failed")}finally{i(null)}}function k(S){return y(`/api/projects/${S.slug}/unarchive`,`project:${S.slug}`,"Project restored")}function v(S){const C=S.projectSlug?`/api/projects/${S.projectSlug}/assignments/${S.slug}/unarchive`:`/api/assignments/${S.id}/unarchive`;return y(C,`assignment:${S.id}`,"Assignment restored")}if(t)return s.jsx(bt,{label:"Loading archived content…"});if(n)return s.jsx(Rt,{error:n});const b=(e==null?void 0:e.projects)??[],j=(e==null?void 0:e.assignments)??[],N=b.length===0&&j.length===0;return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Xn,{toast:p,onDismiss:g}),s.jsx(Rh,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),a?s.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:a}):null,N?s.jsx(St,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):s.jsxs(s.Fragment,{children:[b.length>0&&s.jsx(qe,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:s.jsx("ul",{className:"divide-y divide-border",children:b.map(S=>{const C=u[S.slug]??!1;return s.jsxs("li",{className:"py-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("button",{type:"button",onClick:()=>f(D=>({...D,[S.slug]:!C})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":C,children:[C?s.jsx(cr,{className:"h-4 w-4"}):s.jsx(c2,{className:"h-4 w-4"}),s.jsx(Bv,{className:"h-4 w-4 text-muted-foreground"}),S.title,s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",S.assignments.length," assignment",S.assignments.length===1?"":"s",")"]})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",S.archivedAt?Nr(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(De,{to:`/projects/${S.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),s.jsxs("button",{type:"button",onClick:()=>k(S),disabled:o===`project:${S.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[s.jsx(rh,{className:"h-3 w-3"}),"Restore"]})]})]}),C&&S.assignments.length>0&&s.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:S.assignments.map(D=>s.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx(De,{to:HS(D),className:"text-foreground hover:text-foreground/80",children:D.title}),s.jsx(kn,{status:D.status,showIcon:!1}),s.jsx("span",{className:"text-xs text-muted-foreground",children:D.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},D.id))})]},S.slug)})})}),j.length>0&&s.jsx(qe,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:s.jsx("ul",{className:"divide-y divide-border",children:j.map(S=>s.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[s.jsx(De,{to:HS(S),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:S.title}),s.jsx(kn,{status:S.status,showIcon:!1}),s.jsx(V9,{}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[S.projectTitle??"Standalone"," · Archived"," ",S.archivedAt?Nr(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),s.jsxs("button",{type:"button",onClick:()=>v(S),disabled:o===`assignment:${S.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[s.jsx(rh,{className:"h-3 w-3"}),"Restore"]})]},S.id))})})]})]})}const VS="inline-flex max-w-[14rem] items-center gap-1 whitespace-nowrap rounded-full border px-2 py-0.5 text-[11px] font-semibold tracking-wide border-border/60 text-muted-foreground",WS="block min-w-0 truncate";function Qw({externalIds:e,className:t}){return e.length===0?null:s.jsx("span",{className:je("flex flex-wrap items-center gap-1.5",t),children:e.map((n,r)=>{const o=`${n.system}:${n.id}`,i=`${n.system}:${n.id}:${r}`;return n.url!=null&&n.url.length>0?s.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:je(VS,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[s.jsx("span",{className:WS,children:o}),s.jsx(mc,{className:"h-2.5 w-2.5 shrink-0"})]},i):s.jsx("span",{className:VS,title:o,children:s.jsx("span",{className:WS,children:o})},i)})})}const q9={default:"chrome-card",info:"rounded-lg border border-primary/30 bg-primary/5 p-3 dark:border-primary/40 dark:bg-primary/10",warn:"rounded-lg border border-warning-foreground/30 bg-warning p-3",danger:"rounded-lg border border-error-foreground/30 bg-error p-3",success:"rounded-lg border border-success-foreground/30 bg-success p-3"};function Gn({label:e,value:t,description:n,icon:r,tone:o="default",to:i}){const a=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),s.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),r?s.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:s.jsx(r,{className:"h-5 w-5"})}):null]}),n?s.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),f=je(q9[(t===0||t==="0")&&(o==="warn"||o==="danger")?"default":o],i?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return i?s.jsx(De,{to:i,className:f,children:a}):s.jsx("article",{className:f,children:a})}function qS(e){const t=K9(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),u=l.find(Y9);if(u){const f=u.props.children,p=l.map(h=>h===u?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return s.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,p):null})}return s.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function K9(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=Q9(o),l=X9(i,o.props);return o.type!==m.Fragment&&(l.ref=r?fm(r,a):a),m.cloneElement(o,l)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var G9=Symbol("radix.slottable");function Y9(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===G9}function X9(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const u=i(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Q9(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function J9(e){const t=e+"CollectionProvider",[n,r]=Ta(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:b,children:j}=v,N=Lt.useRef(null),S=Lt.useRef(new Map).current;return s.jsx(o,{scope:b,itemMap:S,collectionRef:N,children:j})};a.displayName=t;const l=e+"CollectionSlot",u=qS(l),f=Lt.forwardRef((v,b)=>{const{scope:j,children:N}=v,S=i(l,j),C=nr(b,S.collectionRef);return s.jsx(u,{ref:C,children:N})});f.displayName=l;const p=e+"CollectionItemSlot",h="data-radix-collection-item",g=qS(p),y=Lt.forwardRef((v,b)=>{const{scope:j,children:N,...S}=v,C=Lt.useRef(null),D=nr(b,C),T=i(p,j);return Lt.useEffect(()=>(T.itemMap.set(C,{ref:C,...S}),()=>void T.itemMap.delete(C))),s.jsx(g,{[h]:"",ref:D,children:N})});y.displayName=p;function k(v){const b=i(e+"CollectionConsumer",v);return Lt.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const S=Array.from(N.querySelectorAll(`[${h}]`));return Array.from(b.itemMap.values()).sort((T,R)=>S.indexOf(T.ref.current)-S.indexOf(R.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:f,ItemSlot:y},k,r]}var Z9=m.createContext(void 0);function oP(e){const t=m.useContext(Z9);return e||t||"ltr"}var Ny="rovingFocusGroup.onEntryFocus",eV={bubbles:!1,cancelable:!0},qd="RovingFocusGroup",[Jb,iP,tV]=J9(qd),[nV,aP]=Ta(qd,[tV]),[rV,sV]=nV(qd),lP=m.forwardRef((e,t)=>s.jsx(Jb.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Jb.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(oV,{...e,ref:t})})}));lP.displayName=qd;var oV=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...h}=e,g=m.useRef(null),y=nr(t,g),k=oP(i),[v,b]=pm({prop:a,defaultProp:l??null,onChange:u,caller:qd}),[j,N]=m.useState(!1),S=ba(f),C=iP(n),D=m.useRef(!1),[T,R]=m.useState(0);return m.useEffect(()=>{const $=g.current;if($)return $.addEventListener(Ny,S),()=>$.removeEventListener(Ny,S)},[S]),s.jsx(rV,{scope:n,orientation:r,dir:k,loop:o,currentTabStopId:v,onItemFocus:m.useCallback($=>b($),[b]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>R($=>$+1),[]),onFocusableItemRemove:m.useCallback(()=>R($=>$-1),[]),children:s.jsx(Sn.div,{tabIndex:j||T===0?-1:0,"data-orientation":r,...h,ref:y,style:{outline:"none",...e.style},onMouseDown:sn(e.onMouseDown,()=>{D.current=!0}),onFocus:sn(e.onFocus,$=>{const P=!D.current;if($.target===$.currentTarget&&P&&!j){const F=new CustomEvent(Ny,eV);if($.currentTarget.dispatchEvent(F),!F.defaultPrevented){const _=C().filter(B=>B.focusable),V=_.find(B=>B.active),U=_.find(B=>B.id===v),M=[V,U,..._].filter(Boolean).map(B=>B.ref.current);dP(M,p)}}D.current=!1}),onBlur:sn(e.onBlur,()=>N(!1))})})}),cP="RovingFocusGroupItem",uP=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:a,...l}=e,u=Ml(),f=i||u,p=sV(cP,n),h=p.currentTabStopId===f,g=iP(n),{onFocusableItemAdd:y,onFocusableItemRemove:k,currentTabStopId:v}=p;return m.useEffect(()=>{if(r)return y(),()=>k()},[r,y,k]),s.jsx(Jb.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:s.jsx(Sn.span,{tabIndex:h?0:-1,"data-orientation":p.orientation,...l,ref:t,onMouseDown:sn(e.onMouseDown,b=>{r?p.onItemFocus(f):b.preventDefault()}),onFocus:sn(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:sn(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){p.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const j=lV(b,p.orientation,p.dir);if(j!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let S=g().filter(C=>C.focusable).map(C=>C.ref.current);if(j==="last")S.reverse();else if(j==="prev"||j==="next"){j==="prev"&&S.reverse();const C=S.indexOf(b.currentTarget);S=p.loop?cV(S,C+1):S.slice(C+1)}setTimeout(()=>dP(S))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:v!=null}):a})})});uP.displayName=cP;var iV={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function aV(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function lV(e,t,n){const r=aV(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return iV[r]}function dP(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function cV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var uV=lP,dV=uP,Bm="Tabs",[fV]=Ta(Bm,[aP]),fP=aP(),[pV,Jw]=fV(Bm),pP=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:u="automatic",...f}=e,p=oP(l),[h,g]=pm({prop:r,onChange:o,defaultProp:i??"",caller:Bm});return s.jsx(pV,{scope:n,baseId:Ml(),value:h,onValueChange:g,orientation:a,dir:p,activationMode:u,children:s.jsx(Sn.div,{dir:p,"data-orientation":a,...f,ref:t})})});pP.displayName=Bm;var hP="TabsList",mP=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Jw(hP,n),a=fP(n);return s.jsx(uV,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Sn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});mP.displayName=hP;var gP="TabsTrigger",xP=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,a=Jw(gP,n),l=fP(n),u=vP(a.baseId,r),f=wP(a.baseId,r),p=r===a.value;return s.jsx(dV,{asChild:!0,...l,focusable:!o,active:p,children:s.jsx(Sn.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...i,ref:t,onMouseDown:sn(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?a.onValueChange(r):h.preventDefault()}),onKeyDown:sn(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(r)}),onFocus:sn(e.onFocus,()=>{const h=a.activationMode!=="manual";!p&&!o&&h&&a.onValueChange(r)})})})});xP.displayName=gP;var yP="TabsContent",bP=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...a}=e,l=Jw(yP,n),u=vP(l.baseId,r),f=wP(l.baseId,r),p=r===l.value,h=m.useRef(p);return m.useEffect(()=>{const g=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Ra,{present:o||p,children:({present:g})=>s.jsx(Sn.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:f,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:g&&i})})});bP.displayName=yP;function vP(e,t){return`${e}-trigger-${t}`}function wP(e,t){return`${e}-content-${t}`}var jP=pP,kP=mP,Zb=xP,ev=bP;function Um({value:e,onValueChange:t,items:n,className:r}){const o=m.useRef(null),[i,a]=m.useState(!1),l=m.useCallback(()=>{const u=o.current;u&&a(u.scrollLeft+u.clientWidth<u.scrollWidth-1)},[]);return m.useEffect(()=>{const u=o.current;if(!u)return;l(),u.addEventListener("scroll",l,{passive:!0});const f=new ResizeObserver(l);return f.observe(u),()=>{u.removeEventListener("scroll",l),f.disconnect()}},[l,n.length]),s.jsxs(jP,{value:e,onValueChange:t,className:r,children:[s.jsxs("div",{className:"relative",children:[s.jsx(kP,{ref:o,className:"flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(u=>s.jsxs(Zb,{value:u.value,className:je("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:[s.jsx("span",{children:u.label}),typeof u.count=="number"?s.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:u.count}):null,u.problemCount&&u.problemCount>0?s.jsx("span",{className:"rounded-full bg-destructive/15 px-2 py-0.5 text-xs text-destructive","aria-label":`${u.problemCount} ${u.problemCount===1?"error":"errors"}`,title:`${u.problemCount} ${u.problemCount===1?"error":"errors"}`,children:u.problemCount}):null]},u.value))}),i?s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 w-8 rounded-r-md bg-gradient-to-l from-card to-transparent"}):null]}),n.map(u=>s.jsx(ev,{value:u.value,className:"pt-3",children:u.content},u.value))]})}const hV="modulepreload",mV=function(e){return"/"+e},KS={},gV=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let a=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=a(n.map(f=>{if(f=mV(f),f in KS)return;KS[f]=!0;const p=f.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${h}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":hV,p||(g.as="script"),g.crossOrigin="",g.href=f,u&&g.setAttribute("nonce",u),document.head.appendChild(g),p)return new Promise((y,k)=>{g.addEventListener("load",y),g.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return o.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function xV({definition:e,className:t,nodeRoutes:n={}}){const r=m.useRef(null),[o,i]=m.useState(null),[a,l]=m.useState(!0),u=Wt(),f=document.documentElement.classList.contains("dark")?"dark":"default";return m.useEffect(()=>{let p=!1;async function h(){if(r.current)try{const g=(await gV(async()=>{const{default:v}=await import("./mermaid.core-BR4E6mM3.js").then(b=>b.bs);return{default:v}},[])).default;if(g.initialize({startOnLoad:!1,theme:"base",themeVariables:yV(f==="dark")}),p)return;const y=`mermaid-${Date.now()}`,{svg:k}=await g.render(y,e);if(p||!r.current)return;r.current.innerHTML=k,bV(r.current,n,u),l(!1)}catch(g){p||(i(g instanceof Error?g.message:"Failed to render graph"),l(!1))}}return l(!0),i(null),h(),()=>{p=!0}},[e,u,n,f]),o?s.jsxs("div",{className:je("rounded-lg border border-border bg-card p-4",t),children:[s.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",o]}),s.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):s.jsxs("div",{className:je("rounded-lg border border-border bg-card p-4",t),children:[a&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),s.jsx("div",{ref:r,className:"overflow-auto"})]})}function yV(e){const t=document.documentElement,n=h=>{const g=getComputedStyle(t).getPropertyValue(h).trim();return g?`oklch(${g})`:""},r=n("--card"),o=n("--card-foreground"),i=n("--border"),a=n("--primary"),l=n("--primary-foreground"),u=n("--muted"),f=n("--muted-foreground"),p=n("--secondary");return{background:r,primaryColor:r,primaryTextColor:o,primaryBorderColor:i,secondaryColor:u,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:u,tertiaryTextColor:f,tertiaryBorderColor:i,lineColor:e?f:i,textColor:o,mainBkg:r,nodeBkg:r,nodeTextColor:o,nodeBorder:i,clusterBkg:u,clusterBorder:i,edgeLabelBackground:r,titleColor:o,activeTaskBkgColor:a,activeTaskBorderColor:a,altBackground:u,labelColor:o,errorBkgColor:p,errorTextColor:l}}function bV(e,t,n){var r;for(const o of e.querySelectorAll(".node")){const i=((r=o.textContent)==null?void 0:r.replace(/\s+/g," ").trim())??"",a=t[i];if(!a)continue;o.style.cursor="pointer",o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Open ${i}`);const l=()=>n(a);o.addEventListener("click",l),o.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),l())})}}function vV(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const wV=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jV=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kV={};function GS(e,t){return(kV.jsx?jV:wV).test(e)}const SV=/[ \t\n\f\r]/g;function NV(e){return typeof e=="object"?e.type==="text"?YS(e.value):!1:YS(e)}function YS(e){return e.replace(SV,"")===""}class Kd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Kd.prototype.normal={};Kd.prototype.property={};Kd.prototype.space=void 0;function SP(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Kd(n,r,t)}function tv(e){return e.toLowerCase()}class Cr{constructor(t,n){this.attribute=n,this.property=t}}Cr.prototype.attribute="";Cr.prototype.booleanish=!1;Cr.prototype.boolean=!1;Cr.prototype.commaOrSpaceSeparated=!1;Cr.prototype.commaSeparated=!1;Cr.prototype.defined=!1;Cr.prototype.mustUseProperty=!1;Cr.prototype.number=!1;Cr.prototype.overloadedBoolean=!1;Cr.prototype.property="";Cr.prototype.spaceSeparated=!1;Cr.prototype.space=void 0;let CV=0;const kt=Pa(),yn=Pa(),nv=Pa(),Le=Pa(),Gt=Pa(),Wl=Pa(),$r=Pa();function Pa(){return 2**++CV}const rv=Object.freeze(Object.defineProperty({__proto__:null,boolean:kt,booleanish:yn,commaOrSpaceSeparated:$r,commaSeparated:Wl,number:Le,overloadedBoolean:nv,spaceSeparated:Gt},Symbol.toStringTag,{value:"Module"})),Cy=Object.keys(rv);class Zw extends Cr{constructor(t,n,r,o){let i=-1;if(super(t,n),XS(this,"space",o),typeof r=="number")for(;++i<Cy.length;){const a=Cy[i];XS(this,Cy[i],(r&rv[a])===rv[a])}}}Zw.prototype.defined=!0;function XS(e,t,n){n&&(e[t]=n)}function Ec(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new Zw(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[tv(r)]=r,n[tv(i.attribute)]=r}return new Kd(t,n,e.space)}const NP=Ec({properties:{ariaActiveDescendant:null,ariaAtomic:yn,ariaAutoComplete:null,ariaBusy:yn,ariaChecked:yn,ariaColCount:Le,ariaColIndex:Le,ariaColSpan:Le,ariaControls:Gt,ariaCurrent:null,ariaDescribedBy:Gt,ariaDetails:null,ariaDisabled:yn,ariaDropEffect:Gt,ariaErrorMessage:null,ariaExpanded:yn,ariaFlowTo:Gt,ariaGrabbed:yn,ariaHasPopup:null,ariaHidden:yn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Gt,ariaLevel:Le,ariaLive:null,ariaModal:yn,ariaMultiLine:yn,ariaMultiSelectable:yn,ariaOrientation:null,ariaOwns:Gt,ariaPlaceholder:null,ariaPosInSet:Le,ariaPressed:yn,ariaReadOnly:yn,ariaRelevant:null,ariaRequired:yn,ariaRoleDescription:Gt,ariaRowCount:Le,ariaRowIndex:Le,ariaRowSpan:Le,ariaSelected:yn,ariaSetSize:Le,ariaSort:null,ariaValueMax:Le,ariaValueMin:Le,ariaValueNow:Le,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function CP(e,t){return t in e?e[t]:t}function EP(e,t){return CP(e,t.toLowerCase())}const EV=Ec({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wl,acceptCharset:Gt,accessKey:Gt,action:null,allow:null,allowFullScreen:kt,allowPaymentRequest:kt,allowUserMedia:kt,alt:null,as:null,async:kt,autoCapitalize:null,autoComplete:Gt,autoFocus:kt,autoPlay:kt,blocking:Gt,capture:null,charSet:null,checked:kt,cite:null,className:Gt,cols:Le,colSpan:null,content:null,contentEditable:yn,controls:kt,controlsList:Gt,coords:Le|Wl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kt,defer:kt,dir:null,dirName:null,disabled:kt,download:nv,draggable:yn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kt,formTarget:null,headers:Gt,height:Le,hidden:nv,high:Le,href:null,hrefLang:null,htmlFor:Gt,httpEquiv:Gt,id:null,imageSizes:null,imageSrcSet:null,inert:kt,inputMode:null,integrity:null,is:null,isMap:kt,itemId:null,itemProp:Gt,itemRef:Gt,itemScope:kt,itemType:Gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kt,low:Le,manifest:null,max:null,maxLength:Le,media:null,method:null,min:null,minLength:Le,multiple:kt,muted:kt,name:null,nonce:null,noModule:kt,noValidate:kt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:kt,optimum:Le,pattern:null,ping:Gt,placeholder:null,playsInline:kt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kt,referrerPolicy:null,rel:Gt,required:kt,reversed:kt,rows:Le,rowSpan:Le,sandbox:Gt,scope:null,scoped:kt,seamless:kt,selected:kt,shadowRootClonable:kt,shadowRootDelegatesFocus:kt,shadowRootMode:null,shape:null,size:Le,sizes:null,slot:null,span:Le,spellCheck:yn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Le,step:null,style:null,tabIndex:Le,target:null,title:null,translate:null,type:null,typeMustMatch:kt,useMap:null,value:yn,width:Le,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Gt,axis:null,background:null,bgColor:null,border:Le,borderColor:null,bottomMargin:Le,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kt,declare:kt,event:null,face:null,frame:null,frameBorder:null,hSpace:Le,leftMargin:Le,link:null,longDesc:null,lowSrc:null,marginHeight:Le,marginWidth:Le,noResize:kt,noHref:kt,noShade:kt,noWrap:kt,object:null,profile:null,prompt:null,rev:null,rightMargin:Le,rules:null,scheme:null,scrolling:yn,standby:null,summary:null,text:null,topMargin:Le,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Le,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kt,disableRemotePlayback:kt,prefix:null,property:null,results:Le,security:null,unselectable:null},space:"html",transform:EP}),TV=Ec({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:$r,accentHeight:Le,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Le,amplitude:Le,arabicForm:null,ascent:Le,attributeName:null,attributeType:null,azimuth:Le,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Le,by:null,calcMode:null,capHeight:Le,className:Gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Le,diffuseConstant:Le,direction:null,display:null,dur:null,divisor:Le,dominantBaseline:null,download:kt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Le,enableBackground:null,end:null,event:null,exponent:Le,externalResourcesRequired:null,fill:null,fillOpacity:Le,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Wl,g2:Wl,glyphName:Wl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Le,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Le,horizOriginX:Le,horizOriginY:Le,id:null,ideographic:Le,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Le,k:Le,k1:Le,k2:Le,k3:Le,k4:Le,kernelMatrix:$r,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Le,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Le,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Le,overlineThickness:Le,paintOrder:null,panose1:null,path:null,pathLength:Le,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Le,pointsAtY:Le,pointsAtZ:Le,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:$r,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:$r,rev:$r,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:$r,requiredFeatures:$r,requiredFonts:$r,requiredFormats:$r,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Le,specularExponent:Le,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Le,strikethroughThickness:Le,string:null,stroke:null,strokeDashArray:$r,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Le,strokeOpacity:Le,strokeWidth:null,style:null,surfaceScale:Le,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:$r,tabIndex:Le,tableValues:null,target:null,targetX:Le,targetY:Le,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:$r,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Le,underlineThickness:Le,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Le,values:null,vAlphabetic:Le,vMathematical:Le,vectorEffect:null,vHanging:Le,vIdeographic:Le,version:null,vertAdvY:Le,vertOriginX:Le,vertOriginY:Le,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Le,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:CP}),TP=Ec({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),RP=Ec({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:EP}),AP=Ec({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),RV={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},AV=/[A-Z]/g,QS=/-[a-z]/g,PV=/^data[-\w.:]+$/i;function _V(e,t){const n=tv(t);let r=t,o=Cr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&PV.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(QS,$V);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!QS.test(i)){let a=i.replace(AV,DV);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=Zw}return new o(r,t)}function DV(e){return"-"+e.toLowerCase()}function $V(e){return e.charAt(1).toUpperCase()}const IV=SP([NP,EV,TP,RP,AP],"html"),e0=SP([NP,TV,TP,RP,AP],"svg");function LV(e){return e.join(" ").trim()}var yl={},Ey,JS;function MV(){if(JS)return Ey;JS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
605
|
+
`},$B={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function IB(e){let{announcements:t=$B,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=DB}=e;const{announce:i,announcement:a}=AB(),l=Od("DndLiveRegion"),[u,f]=m.useState(!1);if(m.useEffect(()=>{f(!0)},[]),PB(m.useMemo(()=>({onDragStart(h){let{active:g}=h;i(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:y}=h;t.onDragMove&&i(t.onDragMove({active:g,over:y}))},onDragOver(h){let{active:g,over:y}=h;i(t.onDragOver({active:g,over:y}))},onDragEnd(h){let{active:g,over:y}=h;i(t.onDragEnd({active:g,over:y}))},onDragCancel(h){let{active:g,over:y}=h;i(t.onDragCancel({active:g,over:y}))}}),[i,t])),!u)return null;const p=Lt.createElement(Lt.Fragment,null,Lt.createElement(TB,{id:r,value:o.draggable}),Lt.createElement(RB,{id:l,announcement:a}));return n?jo.createPortal(p,n):p}var $n;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})($n||($n={}));function gh(){}function ji(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function bm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const ks=Object.freeze({x:0,y:0});function SR(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function LB(e,t){const n=mh(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function NR(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function MB(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function oS(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function CR(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function iS(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const vm=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=iS(t,t.left,t.top),i=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const f=SR(iS(u),o);i.push({id:l,data:{droppableContainer:a,value:f}})}}return i.sort(NR)},OB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=oS(t),i=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const f=oS(u),p=o.reduce((g,y,k)=>g+SR(f[k],y),0),h=Number((p/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:h}})}}return i.sort(NR)};function FB(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,l=i-n;if(r<o&&n<i){const u=t.width*t.height,f=e.width*e.height,p=a*l,h=p/(u+f-p);return Number(h.toFixed(4))}return 0}const zB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const u=FB(l,t);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(MB)};function BB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ER(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ks}function UB(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,l)=>({...a,top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),{...n})}}const HB=UB(1);function TR(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function VB(e,t,n){const r=TR(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,u=e.left-a-(1-o)*parseFloat(n),f=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),p=o?e.width/o:e.width,h=i?e.height/i:e.height;return{width:p,height:h,top:f,right:u+p,bottom:f+h,left:u}}const WB={ignoreTransform:!1};function wc(e,t){t===void 0&&(t=WB);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:p}=ur(e).getComputedStyle(e);f&&(n=VB(n,f,p))}const{top:r,left:o,width:i,height:a,bottom:l,right:u}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:u}}function aS(e){return wc(e,{ignoreTransform:!0})}function qB(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function KB(e,t){return t===void 0&&(t=ur(e).getComputedStyle(e)),t.position==="fixed"}function GB(e,t){t===void 0&&(t=ur(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function wm(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Nw(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ld(o)||wR(o)||n.includes(o))return n;const i=ur(e).getComputedStyle(o);return o!==e&&GB(o,i)&&n.push(o),KB(o,i)?n:r(o.parentNode)}return e?r(e):n}function RR(e){const[t]=wm(e,1);return t??null}function hy(e){return!gm||!e?null:bc(e)?e:Sw(e)?Nw(e)||e===vc(e).scrollingElement?window:Ld(e)?e:null:null}function AR(e){return bc(e)?e.scrollX:e.scrollLeft}function PR(e){return bc(e)?e.scrollY:e.scrollTop}function $b(e){return{x:AR(e),y:PR(e)}}var Vn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Vn||(Vn={}));function _R(e){return!gm||!e?!1:e===document.scrollingElement}function DR(e){const t={x:0,y:0},n=_R(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:l,maxScroll:r,minScroll:t}}const YB={x:.2,y:.2};function XB(e,t,n,r,o){let{top:i,left:a,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=YB);const{isTop:f,isBottom:p,isLeft:h,isRight:g}=DR(e),y={x:0,y:0},k={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!f&&i<=t.top+v.height?(y.y=Vn.Backward,k.y=r*Math.abs((t.top+v.height-i)/v.height)):!p&&u>=t.bottom-v.height&&(y.y=Vn.Forward,k.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!g&&l>=t.right-v.width?(y.x=Vn.Forward,k.x=r*Math.abs((t.right-v.width-l)/v.width)):!h&&a<=t.left+v.width&&(y.x=Vn.Backward,k.x=r*Math.abs((t.left+v.width-a)/v.width)),{direction:y,speed:k}}function QB(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function $R(e){return e.reduce((t,n)=>Bl(t,$b(n)),ks)}function JB(e){return e.reduce((t,n)=>t+AR(n),0)}function ZB(e){return e.reduce((t,n)=>t+PR(n),0)}function IR(e,t){if(t===void 0&&(t=wc),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);RR(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const e8=[["x",["left","right"],JB],["y",["top","bottom"],ZB]];class Cw{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=wm(n),o=$R(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,l]of e8)for(const u of a)Object.defineProperty(this,u,{get:()=>{const f=l(r),p=o[i]-f;return this.rect[u]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Uu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function t8(e){const{EventTarget:t}=ur(e);return e instanceof t?e:vc(e)}function my(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Zr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Zr||(Zr={}));function lS(e){e.preventDefault()}function n8(e){e.stopPropagation()}var At;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(At||(At={}));const LR={start:[At.Space,At.Enter],cancel:[At.Esc],end:[At.Space,At.Enter,At.Tab]},r8=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case At.Right:return{...n,x:n.x+25};case At.Left:return{...n,x:n.x-25};case At.Down:return{...n,y:n.y+25};case At.Up:return{...n,y:n.y-25}}};class jc{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Uu(vc(n)),this.windowListeners=new Uu(ur(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Zr.Resize,this.handleCancel),this.windowListeners.add(Zr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Zr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&IR(r),n(ks)}handleKeyDown(t){if(ym(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=LR,coordinateGetter:a=r8,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:f}=r.current,p=f?{x:f.left,y:f.top}:ks;this.referenceCoordinates||(this.referenceCoordinates=p);const h=a(t,{active:n,context:r.current,currentCoordinates:p});if(h){const g=od(h,p),y={x:0,y:0},{scrollableAncestors:k}=r.current;for(const v of k){const b=t.code,{isTop:j,isRight:N,isLeft:S,isBottom:C,maxScroll:D,minScroll:T}=DR(v),R=QB(v),$={x:Math.min(b===At.Right?R.right-R.width/2:R.right,Math.max(b===At.Right?R.left:R.left+R.width/2,h.x)),y:Math.min(b===At.Down?R.bottom-R.height/2:R.bottom,Math.max(b===At.Down?R.top:R.top+R.height/2,h.y))},P=b===At.Right&&!N||b===At.Left&&!S,F=b===At.Down&&!C||b===At.Up&&!j;if(P&&$.x!==h.x){const _=v.scrollLeft+g.x,V=b===At.Right&&_<=D.x||b===At.Left&&_>=T.x;if(V&&!g.y){v.scrollTo({left:_,behavior:l});return}V?y.x=v.scrollLeft-_:y.x=b===At.Right?v.scrollLeft-D.x:v.scrollLeft-T.x,y.x&&v.scrollBy({left:-y.x,behavior:l});break}else if(F&&$.y!==h.y){const _=v.scrollTop+g.y,V=b===At.Down&&_<=D.y||b===At.Up&&_>=T.y;if(V&&!g.x){v.scrollTo({top:_,behavior:l});return}V?y.y=v.scrollTop-_:y.y=b===At.Down?v.scrollTop-D.y:v.scrollTop-T.y,y.y&&v.scrollBy({top:-y.y,behavior:l});break}}this.handleMove(t,Bl(od(h,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}jc.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=LR,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function cS(e){return!!(e&&"distance"in e)}function uS(e){return!!(e&&"delay"in e)}class Ew{constructor(t,n,r){var o;r===void 0&&(r=t8(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=vc(a),this.documentListeners=new Uu(this.document),this.listeners=new Uu(r),this.windowListeners=new Uu(ur(a)),this.initialCoordinates=(o=mh(i))!=null?o:ks,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Zr.Resize,this.handleCancel),this.windowListeners.add(Zr.DragStart,lS),this.windowListeners.add(Zr.VisibilityChange,this.handleCancel),this.windowListeners.add(Zr.ContextMenu,lS),this.documentListeners.add(Zr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(uS(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(cS(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Zr.Click,n8,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Zr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:l}}=i;if(!o)return;const u=(n=mh(t))!=null?n:ks,f=od(o,u);if(!r&&l){if(cS(l)){if(l.tolerance!=null&&my(f,l.tolerance))return this.handleCancel();if(my(f,l.distance))return this.handleStart()}if(uS(l)&&my(f,l.tolerance))return this.handleCancel();this.handlePending(l,f);return}t.cancelable&&t.preventDefault(),a(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===At.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const s8={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class kc extends Ew{constructor(t){const{event:n}=t,r=vc(n.target);super(t,s8,r)}}kc.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const o8={move:{name:"mousemove"},end:{name:"mouseup"}};var Ib;(function(e){e[e.RightClick=2]="RightClick"})(Ib||(Ib={}));class i8 extends Ew{constructor(t){super(t,o8,vc(t.event.target))}}i8.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Ib.RightClick?!1:(r==null||r({event:n}),!0)}}];const gy={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class a8 extends Ew{constructor(t){super(t,gy)}static setup(){return window.addEventListener(gy.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(gy.move.name,t)};function t(){}}}a8.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Hu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Hu||(Hu={}));var xh;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(xh||(xh={}));function l8(e){let{acceleration:t,activator:n=Hu.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:l=xh.TreeOrder,pointerCoordinates:u,scrollableAncestors:f,scrollableAncestorRects:p,delta:h,threshold:g}=e;const y=u8({delta:h,disabled:!i}),[k,v]=kB(),b=m.useRef({x:0,y:0}),j=m.useRef({x:0,y:0}),N=m.useMemo(()=>{switch(n){case Hu.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Hu.DraggableRect:return o}},[n,o,u]),S=m.useRef(null),C=m.useCallback(()=>{const T=S.current;if(!T)return;const R=b.current.x*j.current.x,$=b.current.y*j.current.y;T.scrollBy(R,$)},[]),D=m.useMemo(()=>l===xh.TreeOrder?[...f].reverse():f,[l,f]);m.useEffect(()=>{if(!i||!f.length||!N){v();return}for(const T of D){if((r==null?void 0:r(T))===!1)continue;const R=f.indexOf(T),$=p[R];if(!$)continue;const{direction:P,speed:F}=XB(T,$,N,t,g);for(const _ of["x","y"])y[_][P[_]]||(F[_]=0,P[_]=0);if(F.x>0||F.y>0){v(),S.current=T,k(C,a),b.current=F,j.current=P;return}}b.current={x:0,y:0},j.current={x:0,y:0},v()},[t,C,r,v,i,a,JSON.stringify(N),JSON.stringify(y),k,f,D,p,JSON.stringify(g)])}const c8={x:{[Vn.Backward]:!1,[Vn.Forward]:!1},y:{[Vn.Backward]:!1,[Vn.Forward]:!1}};function u8(e){let{delta:t,disabled:n}=e;const r=hh(t);return Md(o=>{if(n||!r||!o)return c8;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Vn.Backward]:o.x[Vn.Backward]||i.x===-1,[Vn.Forward]:o.x[Vn.Forward]||i.x===1},y:{[Vn.Backward]:o.y[Vn.Backward]||i.y===-1,[Vn.Forward]:o.y[Vn.Forward]||i.y===1}}},[n,t,r])}function d8(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Md(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function f8(e,t){return m.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var id;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(id||(id={}));var Lb;(function(e){e.Optimized="optimized"})(Lb||(Lb={}));const dS=new Map;function p8(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=m.useState(null),{frequency:l,measure:u,strategy:f}=o,p=m.useRef(e),h=b(),g=sd(h),y=m.useCallback(function(j){j===void 0&&(j=[]),!g.current&&a(N=>N===null?j:N.concat(j.filter(S=>!N.includes(S))))},[g]),k=m.useRef(null),v=Md(j=>{if(h&&!n)return dS;if(!j||j===dS||p.current!==e||i!=null){const N=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){N.set(S.id,S.rect.current);continue}const C=S.node.current,D=C?new Cw(u(C),C):null;S.rect.current=D,D&&N.set(S.id,D)}return N}return j},[e,i,n,h,u]);return m.useEffect(()=>{p.current=e},[e]),m.useEffect(()=>{h||y()},[n,h]),m.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),m.useEffect(()=>{h||typeof l!="number"||k.current!==null||(k.current=setTimeout(()=>{y(),k.current=null},l))},[l,h,y,...r]),{droppableRects:v,measureDroppableContainers:y,measuringScheduled:i!=null};function b(){switch(f){case id.Always:return!1;case id.BeforeDragging:return n;default:return!n}}}function Tw(e,t){return Md(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function h8(e,t){return Tw(e,t)}function m8(e){let{callback:t,disabled:n}=e;const r=xm(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function jm(e){let{callback:t,disabled:n}=e;const r=xm(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function g8(e){return new Cw(wc(e),e)}function fS(e,t,n){t===void 0&&(t=g8);const[r,o]=m.useState(null);function i(){o(u=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=u??n)!=null?f:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const a=m8({callback(u){if(e)for(const f of u){const{type:p,target:h}=f;if(p==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),l=jm({callback:i});return ws(()=>{i(),e?(l==null||l.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[e]),r}function x8(e){const t=Tw(e);return ER(e,t)}const pS=[];function y8(e){const t=m.useRef(e),n=Md(r=>e?r&&r!==pS&&e&&t.current&&e.parentNode===t.current.parentNode?r:wm(e):pS,[e]);return m.useEffect(()=>{t.current=e},[e]),n}function b8(e){const[t,n]=m.useState(null),r=m.useRef(e),o=m.useCallback(i=>{const a=hy(i.target);a&&n(l=>l?(l.set(a,$b(a)),new Map(l)):null)},[]);return m.useEffect(()=>{const i=r.current;if(e!==i){a(i);const l=e.map(u=>{const f=hy(u);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,$b(f)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(i)};function a(l){l.forEach(u=>{const f=hy(u);f==null||f.removeEventListener("scroll",o)})}},[o,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>Bl(i,a),ks):$R(e):ks,[e,t])}function hS(e,t){t===void 0&&(t=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},t),m.useEffect(()=>{const r=e!==ks;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?od(e,n.current):ks}function v8(e){m.useEffect(()=>{if(!gm)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function w8(e,t){return m.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function MR(e){return m.useMemo(()=>e?qB(e):null,[e])}const mS=[];function j8(e,t){t===void 0&&(t=wc);const[n]=e,r=MR(n?ur(n):null),[o,i]=m.useState(mS);function a(){i(()=>e.length?e.map(u=>_R(u)?r:new Cw(t(u),u)):mS)}const l=jm({callback:a});return ws(()=>{l==null||l.disconnect(),a(),e.forEach(u=>l==null?void 0:l.observe(u))},[e]),o}function OR(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ld(t)?t:e}function k8(e){let{measure:t}=e;const[n,r]=m.useState(null),o=m.useCallback(f=>{for(const{target:p}of f)if(Ld(p)){r(h=>{const g=t(p);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),i=jm({callback:o}),a=m.useCallback(f=>{const p=OR(f);i==null||i.disconnect(),p&&(i==null||i.observe(p)),r(p?t(p):null)},[t,i]),[l,u]=ph(a);return m.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const S8=[{sensor:kc,options:{}},{sensor:jc,options:{}}],N8={current:{}},Hp={draggable:{measure:aS},droppable:{measure:aS,strategy:id.WhileDragging,frequency:Lb.Optimized},dragOverlay:{measure:wc}};class Vu extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const C8={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Vu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:gh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Hp,measureDroppableContainers:gh,windowRect:null,measuringScheduled:!1},FR={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:gh,draggableNodes:new Map,over:null,measureDroppableContainers:gh},Fd=m.createContext(FR),zR=m.createContext(C8);function E8(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Vu}}}function T8(e,t){switch(t.type){case $n.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case $n.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case $n.DragEnd:case $n.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $n.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Vu(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case $n.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Vu(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case $n.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Vu(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function R8(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=m.useContext(Fd),i=hh(r),a=hh(n==null?void 0:n.id);return m.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!ym(i)||document.activeElement===i.target)return;const l=o.get(a);if(!l)return;const{activatorNode:u,node:f}=l;if(!u.current&&!f.current)return;requestAnimationFrame(()=>{for(const p of[u.current,f.current]){if(!p)continue;const h=CB(p);if(h){h.focus();break}}})}},[r,t,o,a,i]),null}function BR(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function A8(e){return m.useMemo(()=>({draggable:{...Hp.draggable,...e==null?void 0:e.draggable},droppable:{...Hp.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Hp.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function P8(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=m.useRef(!1),{x:a,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ws(()=>{if(!a&&!l||!t){i.current=!1;return}if(i.current||!r)return;const f=t==null?void 0:t.node.current;if(!f||f.isConnected===!1)return;const p=n(f),h=ER(p,r);if(a||(h.x=0),l||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=RR(f);g&&g.scrollBy({top:h.y,left:h.x})}},[t,a,l,r,n])}const km=m.createContext({...ks,scaleX:1,scaleY:1});var gi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(gi||(gi={}));const Sm=m.memo(function(t){var n,r,o,i;let{id:a,accessibility:l,autoScroll:u=!0,children:f,sensors:p=S8,collisionDetection:h=zB,measuring:g,modifiers:y,...k}=t;const v=m.useReducer(T8,void 0,E8),[b,j]=v,[N,S]=_B(),[C,D]=m.useState(gi.Uninitialized),T=C===gi.Initialized,{draggable:{active:R,nodes:$,translate:P},droppable:{containers:F}}=b,_=R!=null?$.get(R):null,V=m.useRef({initial:null,translated:null}),U=m.useMemo(()=>{var lt;return R!=null?{id:R,data:(lt=_==null?void 0:_.data)!=null?lt:N8,rect:V}:null},[R,_]),I=m.useRef(null),[M,B]=m.useState(null),[W,O]=m.useState(null),H=sd(k,Object.values(k)),L=Od("DndDescribedBy",a),z=m.useMemo(()=>F.getEnabled(),[F]),Y=A8(g),{droppableRects:q,measureDroppableContainers:Q,measuringScheduled:ee}=p8(z,{dragging:T,dependencies:[P.x,P.y],config:Y.droppable}),Z=d8($,R),ie=m.useMemo(()=>W?mh(W):null,[W]),ne=ze(),ue=h8(Z,Y.draggable.measure);P8({activeNode:R!=null?$.get(R):null,config:ne.layoutShiftCompensation,initialRect:ue,measure:Y.draggable.measure});const ge=fS(Z,Y.draggable.measure,ue),Ne=fS(Z?Z.parentElement:null),Ce=m.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=F.getNodeFor((n=Ce.current.over)==null?void 0:n.id),Ue=k8({measure:Y.dragOverlay.measure}),oe=(r=Ue.nodeRef.current)!=null?r:Z,ve=T?(o=Ue.rect)!=null?o:ge:null,be=!!(Ue.nodeRef.current&&Ue.rect),Re=x8(be?null:ge),He=MR(oe?ur(oe):null),rt=y8(T?ke??Z:null),Fe=j8(rt),ot=BR(y,{transform:{x:P.x-Re.x,y:P.y-Re.y,scaleX:1,scaleY:1},activatorEvent:W,active:U,activeNodeRect:ge,containerNodeRect:Ne,draggingNodeRect:ve,over:Ce.current.over,overlayNodeRect:Ue.rect,scrollableAncestors:rt,scrollableAncestorRects:Fe,windowRect:He}),Nt=ie?Bl(ie,P):null,mt=b8(rt),at=hS(mt),ce=hS(mt,[ge]),me=Bl(ot,at),Ie=ve?HB(ve,ot):null,Ae=U&&Ie?h({active:U,collisionRect:Ie,droppableRects:q,droppableContainers:z,pointerCoordinates:Nt}):null,We=CR(Ae,"id"),[pt,Pe]=m.useState(null),Qe=be?ot:Bl(ot,ce),Je=BB(Qe,(i=pt==null?void 0:pt.rect)!=null?i:null,ge),ut=m.useRef(null),fe=m.useCallback((lt,ht)=>{let{sensor:vt,options:tt}=ht;if(I.current==null)return;const _t=$.get(I.current);if(!_t)return;const zt=lt.nativeEvent,Bt=new vt({active:I.current,activeNode:_t,event:zt,options:tt,context:Ce,onAbort(Oe){if(!$.get(Oe))return;const{onDragAbort:Et}=H.current,ln={id:Oe};Et==null||Et(ln),N({type:"onDragAbort",event:ln})},onPending(Oe,it,Et,ln){if(!$.get(Oe))return;const{onDragPending:le}=H.current,Se={id:Oe,constraint:it,initialCoordinates:Et,offset:ln};le==null||le(Se),N({type:"onDragPending",event:Se})},onStart(Oe){const it=I.current;if(it==null)return;const Et=$.get(it);if(!Et)return;const{onDragStart:ln}=H.current,Ut={activatorEvent:zt,active:{id:it,data:Et.data,rect:V}};jo.unstable_batchedUpdates(()=>{ln==null||ln(Ut),D(gi.Initializing),j({type:$n.DragStart,initialCoordinates:Oe,active:it}),N({type:"onDragStart",event:Ut}),B(ut.current),O(zt)})},onMove(Oe){j({type:$n.DragMove,coordinates:Oe})},onEnd:we($n.DragEnd),onCancel:we($n.DragCancel)});ut.current=Bt;function we(Oe){return async function(){const{active:Et,collisions:ln,over:Ut,scrollAdjustedTranslate:le}=Ce.current;let Se=null;if(Et&&le){const{cancelDrop:nt}=H.current;Se={activatorEvent:zt,active:Et,collisions:ln,delta:le,over:Ut},Oe===$n.DragEnd&&typeof nt=="function"&&await Promise.resolve(nt(Se))&&(Oe=$n.DragCancel)}I.current=null,jo.unstable_batchedUpdates(()=>{j({type:Oe}),D(gi.Uninitialized),Pe(null),B(null),O(null),ut.current=null;const nt=Oe===$n.DragEnd?"onDragEnd":"onDragCancel";if(Se){const Tn=H.current[nt];Tn==null||Tn(Se),N({type:nt,event:Se})}})}}},[$]),K=m.useCallback((lt,ht)=>(vt,tt)=>{const _t=vt.nativeEvent,zt=$.get(tt);if(I.current!==null||!zt||_t.dndKit||_t.defaultPrevented)return;const Bt={active:zt};lt(vt,ht.options,Bt)===!0&&(_t.dndKit={capturedBy:ht.sensor},I.current=tt,fe(vt,ht))},[$,fe]),re=f8(p,K);v8(p),ws(()=>{ge&&C===gi.Initializing&&D(gi.Initialized)},[ge,C]),m.useEffect(()=>{const{onDragMove:lt}=H.current,{active:ht,activatorEvent:vt,collisions:tt,over:_t}=Ce.current;if(!ht||!vt)return;const zt={active:ht,activatorEvent:vt,collisions:tt,delta:{x:me.x,y:me.y},over:_t};jo.unstable_batchedUpdates(()=>{lt==null||lt(zt),N({type:"onDragMove",event:zt})})},[me.x,me.y]),m.useEffect(()=>{const{active:lt,activatorEvent:ht,collisions:vt,droppableContainers:tt,scrollAdjustedTranslate:_t}=Ce.current;if(!lt||I.current==null||!ht||!_t)return;const{onDragOver:zt}=H.current,Bt=tt.get(We),we=Bt&&Bt.rect.current?{id:Bt.id,rect:Bt.rect.current,data:Bt.data,disabled:Bt.disabled}:null,Oe={active:lt,activatorEvent:ht,collisions:vt,delta:{x:_t.x,y:_t.y},over:we};jo.unstable_batchedUpdates(()=>{Pe(we),zt==null||zt(Oe),N({type:"onDragOver",event:Oe})})},[We]),ws(()=>{Ce.current={activatorEvent:W,active:U,activeNode:Z,collisionRect:Ie,collisions:Ae,droppableRects:q,draggableNodes:$,draggingNode:oe,draggingNodeRect:ve,droppableContainers:F,over:pt,scrollableAncestors:rt,scrollAdjustedTranslate:me},V.current={initial:ve,translated:Ie}},[U,Z,Ae,Ie,$,oe,ve,q,F,pt,rt,me]),l8({...ne,delta:P,draggingRect:Ie,pointerCoordinates:Nt,scrollableAncestors:rt,scrollableAncestorRects:Fe});const xe=m.useMemo(()=>({active:U,activeNode:Z,activeNodeRect:ge,activatorEvent:W,collisions:Ae,containerNodeRect:Ne,dragOverlay:Ue,draggableNodes:$,droppableContainers:F,droppableRects:q,over:pt,measureDroppableContainers:Q,scrollableAncestors:rt,scrollableAncestorRects:Fe,measuringConfiguration:Y,measuringScheduled:ee,windowRect:He}),[U,Z,ge,W,Ae,Ne,Ue,$,F,q,pt,Q,rt,Fe,Y,ee,He]),Ge=m.useMemo(()=>({activatorEvent:W,activators:re,active:U,activeNodeRect:ge,ariaDescribedById:{draggable:L},dispatch:j,draggableNodes:$,over:pt,measureDroppableContainers:Q}),[W,re,U,ge,j,L,$,pt,Q]);return Lt.createElement(kR.Provider,{value:S},Lt.createElement(Fd.Provider,{value:Ge},Lt.createElement(zR.Provider,{value:xe},Lt.createElement(km.Provider,{value:Je},f)),Lt.createElement(R8,{disabled:(l==null?void 0:l.restoreFocus)===!1})),Lt.createElement(IB,{...l,hiddenTextDescribedById:L}));function ze(){const lt=(M==null?void 0:M.autoScrollEnabled)===!1,ht=typeof u=="object"?u.enabled===!1:u===!1,vt=T&&!lt&&!ht;return typeof u=="object"?{...u,enabled:vt}:{enabled:vt}}}),_8=m.createContext(null),gS="button",D8="Draggable";function $8(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Od(D8),{activators:a,activatorEvent:l,active:u,activeNodeRect:f,ariaDescribedById:p,draggableNodes:h,over:g}=m.useContext(Fd),{role:y=gS,roleDescription:k="draggable",tabIndex:v=0}=o??{},b=(u==null?void 0:u.id)===t,j=m.useContext(b?km:_8),[N,S]=ph(),[C,D]=ph(),T=w8(a,t),R=sd(n);ws(()=>(h.set(t,{id:t,key:i,node:N,activatorNode:C,data:R}),()=>{const P=h.get(t);P&&P.key===i&&h.delete(t)}),[h,t]);const $=m.useMemo(()=>({role:y,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&y===gS?!0:void 0,"aria-roledescription":k,"aria-describedby":p.draggable}),[r,y,v,b,k,p.draggable]);return{active:u,activatorEvent:l,activeNodeRect:f,attributes:$,isDragging:b,listeners:r?void 0:T,node:N,over:g,setNodeRef:S,setActivatorNodeRef:D,transform:j}}function UR(){return m.useContext(zR)}const I8="Droppable",L8={timeout:25};function M8(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Od(I8),{active:a,dispatch:l,over:u,measureDroppableContainers:f}=m.useContext(Fd),p=m.useRef({disabled:n}),h=m.useRef(!1),g=m.useRef(null),y=m.useRef(null),{disabled:k,updateMeasurementsFor:v,timeout:b}={...L8,...o},j=sd(v??r),N=m.useCallback(()=>{if(!h.current){h.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{f(Array.isArray(j.current)?j.current:[j.current]),y.current=null},b)},[b]),S=jm({callback:N,disabled:k||!a}),C=m.useCallback(($,P)=>{S&&(P&&(S.unobserve(P),h.current=!1),$&&S.observe($))},[S]),[D,T]=ph(C),R=sd(t);return m.useEffect(()=>{!S||!D.current||(S.disconnect(),h.current=!1,S.observe(D.current))},[D,S]),m.useEffect(()=>(l({type:$n.RegisterDroppable,element:{id:r,key:i,disabled:n,node:D,rect:g,data:R}}),()=>l({type:$n.UnregisterDroppable,key:i,id:r})),[r]),m.useEffect(()=>{n!==p.current.disabled&&(l({type:$n.SetDroppableDisabled,id:r,key:i,disabled:n}),p.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:(u==null?void 0:u.id)===r,node:D,over:u,setNodeRef:T}}function O8(e){let{animation:t,children:n}=e;const[r,o]=m.useState(null),[i,a]=m.useState(null),l=hh(n);return!n&&!r&&l&&o(l),ws(()=>{if(!i)return;const u=r==null?void 0:r.key,f=r==null?void 0:r.props.id;if(u==null||f==null){o(null);return}Promise.resolve(t(f,i)).then(()=>{o(null)})},[t,r,i]),Lt.createElement(Lt.Fragment,null,n,r?m.cloneElement(r,{ref:a}):null)}const F8={x:0,y:0,scaleX:1,scaleY:1};function z8(e){let{children:t}=e;return Lt.createElement(Fd.Provider,{value:FR},Lt.createElement(km.Provider,{value:F8},t))}const B8={position:"fixed",touchAction:"none"},U8=e=>ym(e)?"transform 250ms ease":void 0,H8=m.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:i,className:a,rect:l,style:u,transform:f,transition:p=U8}=e;if(!l)return null;const h=o?f:{...f,scaleX:1,scaleY:1},g={...B8,width:l.width,height:l.height,top:l.top,left:l.left,transform:js.Transform.toString(h),transformOrigin:o&&r?LB(r,l):void 0,transition:typeof p=="function"?p(r):p,...u};return Lt.createElement(n,{className:a,style:g,ref:t},i)}),V8=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:i,className:a}=e;if(i!=null&&i.active)for(const[l,u]of Object.entries(i.active))u!==void 0&&(o[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,u));if(i!=null&&i.dragOverlay)for(const[l,u]of Object.entries(i.dragOverlay))u!==void 0&&r.node.style.setProperty(l,u);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[u,f]of Object.entries(o))n.node.style.setProperty(u,f);a!=null&&a.active&&n.node.classList.remove(a.active)}},W8=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:js.Transform.toString(t)},{transform:js.Transform.toString(n)}]},q8={duration:250,easing:"ease",keyframes:W8,sideEffects:V8({styles:{active:{opacity:"0"}}})};function K8(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return xm((i,a)=>{if(t===null)return;const l=n.get(i);if(!l)return;const u=l.node.current;if(!u)return;const f=OR(a);if(!f)return;const{transform:p}=ur(a).getComputedStyle(a),h=TR(p);if(!h)return;const g=typeof t=="function"?t:G8(t);return IR(u,o.draggable.measure),g({active:{id:i,data:l.data,node:u,rect:o.draggable.measure(u)},draggableNodes:n,dragOverlay:{node:a,rect:o.dragOverlay.measure(f)},droppableContainers:r,measuringConfiguration:o,transform:h})})}function G8(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...q8,...e};return i=>{let{active:a,dragOverlay:l,transform:u,...f}=i;if(!t)return;const p={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},h={scaleX:u.scaleX!==1?a.rect.width*u.scaleX/l.rect.width:1,scaleY:u.scaleY!==1?a.rect.height*u.scaleY/l.rect.height:1},g={x:u.x-p.x,y:u.y-p.y,...h},y=o({...f,active:a,dragOverlay:l,transform:{initial:u,final:g}}),[k]=y,v=y[y.length-1];if(JSON.stringify(k)===JSON.stringify(v))return;const b=r==null?void 0:r({active:a,dragOverlay:l,...f}),j=l.node.animate(y,{duration:t,easing:n,fill:"forwards"});return new Promise(N=>{j.onfinish=()=>{b==null||b(),N()}})}}let xS=0;function Y8(e){return m.useMemo(()=>{if(e!=null)return xS++,xS},[e])}const X8=Lt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:i,modifiers:a,wrapperElement:l="div",className:u,zIndex:f=999}=e;const{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggableNodes:k,droppableContainers:v,dragOverlay:b,over:j,measuringConfiguration:N,scrollableAncestors:S,scrollableAncestorRects:C,windowRect:D}=UR(),T=m.useContext(km),R=Y8(h==null?void 0:h.id),$=BR(a,{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:b.rect,over:j,overlayNodeRect:b.rect,scrollableAncestors:S,scrollableAncestorRects:C,transform:T,windowRect:D}),P=Tw(g),F=K8({config:r,draggableNodes:k,droppableContainers:v,measuringConfiguration:N}),_=P?b.setRef:void 0;return Lt.createElement(z8,null,Lt.createElement(O8,{animation:F},h&&R?Lt.createElement(H8,{key:R,id:h.id,ref:_,as:l,activatorEvent:p,adjustScale:t,className:u,transition:i,rect:P,style:{zIndex:f,...o},transform:$},n):null))});function Sc(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Q8(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function cp(e){return e!==null&&e>=0}function J8(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Z8(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Rw=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Sc(t,r,n),a=t[o],l=i[o];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},up={scaleX:1,scaleY:1},Aw=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const f=i[a];return f?{x:0,y:n<a?f.top+f.height-(l.top+l.height):f.top-l.top,...up}:null}const u=e7(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-u,...up}:o<n&&o>=a?{x:0,y:l.height+u,...up}:{x:0,y:0,...up}};function e7(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const HR="Sortable",VR=Lt.createContext({activeIndex:-1,containerId:HR,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Rw,disabled:{draggable:!1,droppable:!1}});function Nm(e){let{children:t,id:n,items:r,strategy:o=Rw,disabled:i=!1}=e;const{active:a,dragOverlay:l,droppableRects:u,over:f,measureDroppableContainers:p}=UR(),h=Od(HR,n),g=l.rect!==null,y=m.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),k=a!=null,v=a?y.indexOf(a.id):-1,b=f?y.indexOf(f.id):-1,j=m.useRef(y),N=!J8(y,j.current),S=b!==-1&&v===-1||N,C=Z8(i);ws(()=>{N&&k&&p(y)},[N,y,k,p]),m.useEffect(()=>{j.current=y},[y]);const D=m.useMemo(()=>({activeIndex:v,containerId:h,disabled:C,disableTransforms:S,items:y,overIndex:b,useDragOverlay:g,sortedRects:Q8(y,u),strategy:o}),[v,h,C.draggable,C.droppable,S,y,b,u,g,o]);return Lt.createElement(VR.Provider,{value:D},t)}const t7=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Sc(n,r,o).indexOf(t)},n7=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:u,transition:f}=e;return!f||!r||l!==i&&o===a?!1:n?!0:a!==o&&t===u},r7={duration:200,easing:"ease"},WR="transform",s7=js.Transition.toString({property:WR,duration:0,easing:"linear"}),o7={roleDescription:"sortable"};function i7(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=m.useState(null),l=m.useRef(n);return ws(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const f=wc(r.current,{ignoreTransform:!0}),p={x:u.left-f.left,y:u.top-f.top,scaleX:u.width/f.width,scaleY:u.height/f.height};(p.x||p.y)&&a(p)}}n!==l.current&&(l.current=n)},[t,n,r,o]),m.useEffect(()=>{i&&a(null)},[i]),i}function Cm(e){let{animateLayoutChanges:t=n7,attributes:n,disabled:r,data:o,getNewIndex:i=t7,id:a,strategy:l,resizeObserverConfig:u,transition:f=r7}=e;const{items:p,containerId:h,activeIndex:g,disabled:y,disableTransforms:k,sortedRects:v,overIndex:b,useDragOverlay:j,strategy:N}=m.useContext(VR),S=a7(r,y),C=p.indexOf(a),D=m.useMemo(()=>({sortable:{containerId:h,index:C,items:p},...o}),[h,o,C,p]),T=m.useMemo(()=>p.slice(p.indexOf(a)),[p,a]),{rect:R,node:$,isOver:P,setNodeRef:F}=M8({id:a,data:D,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...u}}),{active:_,activatorEvent:V,activeNodeRect:U,attributes:I,setNodeRef:M,listeners:B,isDragging:W,over:O,setActivatorNodeRef:H,transform:L}=$8({id:a,data:D,attributes:{...o7,...n},disabled:S.draggable}),z=jB(F,M),Y=!!_,q=Y&&!k&&cp(g)&&cp(b),Q=!j&&W,ee=Q&&q?L:null,ie=q?ee??(l??N)({rects:v,activeNodeRect:U,activeIndex:g,overIndex:b,index:C}):null,ne=cp(g)&&cp(b)?i({id:a,items:p,activeIndex:g,overIndex:b}):C,ue=_==null?void 0:_.id,ge=m.useRef({activeId:ue,items:p,newIndex:ne,containerId:h}),Ne=p!==ge.current.items,Ce=t({active:_,containerId:h,isDragging:W,isSorting:Y,id:a,index:C,items:p,newIndex:ge.current.newIndex,previousItems:ge.current.items,previousContainerId:ge.current.containerId,transition:f,wasDragging:ge.current.activeId!=null}),ke=i7({disabled:!Ce,index:C,node:$,rect:R});return m.useEffect(()=>{Y&&ge.current.newIndex!==ne&&(ge.current.newIndex=ne),h!==ge.current.containerId&&(ge.current.containerId=h),p!==ge.current.items&&(ge.current.items=p)},[Y,ne,h,p]),m.useEffect(()=>{if(ue===ge.current.activeId)return;if(ue!=null&&ge.current.activeId==null){ge.current.activeId=ue;return}const oe=setTimeout(()=>{ge.current.activeId=ue},50);return()=>clearTimeout(oe)},[ue]),{active:_,activeIndex:g,attributes:I,data:D,rect:R,index:C,newIndex:ne,items:p,isOver:P,isSorting:Y,isDragging:W,listeners:B,node:$,overIndex:b,over:O,setNodeRef:z,setActivatorNodeRef:H,setDroppableNodeRef:F,setDraggableNodeRef:M,transform:ke??ie,transition:Ue()};function Ue(){if(ke||Ne&&ge.current.newIndex===C)return s7;if(!(Q&&!ym(V)||!f)&&(Y||Ce))return js.Transition.toString({...f,property:WR})}}function a7(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function yh(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const l7=[At.Down,At.Right,At.Up,At.Left],qR=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(l7.includes(e.code)){if(e.preventDefault(),!n||!r)return;const u=[];i.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const g=o.get(h.id);if(g)switch(e.code){case At.Down:r.top<g.top&&u.push(h);break;case At.Up:r.top>g.top&&u.push(h);break;case At.Left:r.left>g.left&&u.push(h);break;case At.Right:r.left<g.left&&u.push(h);break}});const f=OB({collisionRect:r,droppableRects:o,droppableContainers:u});let p=CR(f,"id");if(p===(a==null?void 0:a.id)&&f.length>1&&(p=f[1].id),p!=null){const h=i.get(n.id),g=i.get(p),y=g?o.get(g.id):null,k=g==null?void 0:g.node.current;if(k&&y&&h&&g){const b=wm(k).some((T,R)=>l[R]!==T),j=KR(h,g),N=c7(h,g),S=b||!j?{x:0,y:0}:{x:N?r.width-y.width:0,y:N?r.height-y.height:0},C={x:y.left,y:y.top};return S.x&&S.y?C:od(C,S)}}}};function KR(e,t){return!yh(e)||!yh(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function c7(e,t){return!yh(e)||!yh(t)||!KR(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function bt({label:e="Loading dashboard data…"}){return s.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:s.jsx("div",{className:"chrome-card !px-4 !py-3",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function Rt({title:e="Something went wrong",error:t,action:n,onRetry:r,retryLabel:o="Retry"}){const i=n??(r?s.jsxs("button",{type:"button",onClick:r,className:"shell-action",children:[s.jsx(EO,{className:"h-4 w-4"}),s.jsx("span",{children:o})]}):null);return s.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),s.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),i?s.jsx("div",{className:"pt-2",children:i}):null]})})}function Vp({command:e,description:t,example:n}){return s.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[s.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?s.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?s.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function qe({title:e,description:t,children:n,className:r,actions:o}){return s.jsxs("section",{className:je("surface-panel space-y-3",r),children:[e||o?s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[e?s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?s.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),o]}):null,n]})}function u7({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return s.jsx(qe,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:s.jsx(De,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:s.jsx("div",{className:"space-y-3",children:n.map((r,o)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:o+1}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:r.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:r.detail}),r.command?s.jsx(Vp,{command:r.command.command,example:r.command.example}):null]})]})},r.title))})})}const xy={review:"{total} items ready for your review","review.singular":"Review {title}",ready_to_implement:"{total} plans ready to implement — start with {title}","ready_to_implement.singular":"Start implementing {title}",ready_for_planning:"{total} assignments ready to plan — start with {title}","ready_for_planning.singular":"Plan {title}",in_progress:"Resume {title} ({total} in progress)","in_progress.singular":"Resume {title}",draft:"Shape your {total} drafts — start with {title}","draft.singular":"Shape {title}",blocked:"Unblock {title} ({total} blocked)","blocked.singular":"Unblock {title}",stale:"Triage {total} stale items","stale.singular":"Triage {title} — sitting stale",clean:"You’re all clear. Nothing needs you right now."},pa={emptyStateCleanTitle:"You’re all clear",emptyStateCleanCTA:"Browse projects",recentSessionsEmptyTitle:"No recent sessions",recentSessionsEmptyHint:"Use /grab-assignment or `syntaur track-session` to register one.",recentSessionsCopyPathLabel:"Copy path",recentSessionsCopyPathDisabled:"Session has no path",recentSessionsCopyFallbackHint:"Press ⌘C to copy"};function d7(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function f7({hero:e,itemsById:t}){const n=mn();if(e.kind==="clean")return s.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-border/60 bg-background/60 p-6 shadow-sm",children:[s.jsx("p",{className:"eyebrow",children:pa.emptyStateCleanTitle}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:xy.clean}),s.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"When work shows up — a draft, a review, a stale row — it’ll surface here."}),s.jsx("div",{className:"mt-4",children:s.jsx(De,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:pa.emptyStateCleanCTA})})]});const r=e.itemId?t[e.itemId]:void 0,o=(r==null?void 0:r.assignmentTitle)??"",i=xy[e.copyKey]??xy[e.kind],a=d7(i,{total:e.total,title:o}),l=r?p7(r,n):`${n}/assignments`;return s.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-primary/20 bg-primary/5 p-6 shadow-sm",children:[s.jsx("p",{className:"eyebrow",children:"Top priority"}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:a}),r?s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["In ",s.jsx("span",{className:"font-medium text-foreground",children:r.projectTitle??"Standalone"})," ","· status ",s.jsx("span",{className:"font-medium text-foreground",children:r.status})]}):null,s.jsx("div",{className:"mt-4",children:s.jsxs(De,{to:l,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function p7(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const yy=["title","status","priority","assignee","dependencies","created","updated"],ad=24,GR=60;function h7(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Number.isInteger(t.w)&&t.w>=1&&t.w<=ad&&Number.isInteger(t.h)&&t.h>=1&&t.h<=GR}const m7={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},yS="2026-05-21T00:00:00Z";function by(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...m7,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:yS,updatedAt:yS}}const bi={version:1,views:[by("default-recently-updated","Recently updated",{}),by("default-high-priority","High priority",{priority:"high"}),by("default-stale","Stale",{activity:"stale"})],dashboard:{version:1,slots:[{id:"slot-0",widget:{kind:"agent-sessions"}},{id:"slot-1",widget:{kind:"saved-view",viewId:"default-recently-updated"}},{id:"slot-2",widget:{kind:"saved-view",viewId:"default-high-priority"}},{id:"slot-3",widget:{kind:"saved-view",viewId:"default-stale"}},{id:"slot-4",widget:{kind:"inventories"}}]}};function YR(e,t){const n=Ve(e.filters.project),r=n.length===0||n.length===1&&n[0]===t,o=e.filters.activity,i=typeof e.filters.search=="string"&&e.filters.search.trim().length>0,a=e.filters.query,l=typeof a=="string"&&a.trim().length>0&&Fu(a)===null;return r&&(!o||o==="all")&&!i&&!l}function XR(e,t){switch(t.kind){case"global":return e.workspace===null;case"workspace":return e.workspace===t.workspace||e.workspace===null;case"project":return e.workspace===t.workspace||e.workspace===null?YR(e.config,t.slug):!1}}const QR=`syntaur.savedViews.cache.v${bi.version}`;let Ul=g7(),ta=null,Pw=null;const Mb=new Set,bh=new Set;let JR=0;function ZR(){return++JR}function Ob(e){return e===JR}function g7(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(QR);if(!e)return null;const t=JSON.parse(e);return t.version!==bi.version?null:t}catch{return null}}function x7(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(QR,JSON.stringify(e))}catch{}}function eA(e){Ul=e,Pw=null,x7(e);for(const t of Mb)t(e);for(const t of bh)t(null)}function y7(e){Pw=e;for(const t of bh)t(e)}function tA(e){if(!e||typeof e!="object")return bi;const t=e;return t.version!==bi.version||!Array.isArray(t.views)||!t.dashboard?bi:t}function bS(){if(ta)return ta;const e=ZR();return ta=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=tA(t);return Ob(e)&&eA(n),ta=null,Ul??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Ob(e)&&y7(n),ta=null,Ul??bi}),ta}function _w(){const[e,t]=m.useState(()=>Ul??bi),[n,r]=m.useState(()=>Ul===null),[o,i]=m.useState(!1),[a,l]=m.useState(()=>Pw);return m.useEffect(()=>{let f=!1;Ul===null&&r(!0),bS().then(g=>{f||(t(g),r(!1),i(!0))});const p=g=>{f||(t(g),r(!1),i(!0),l(null))},h=g=>{f||(l(g),r(!1),i(!0))};return Mb.add(p),bh.add(h),()=>{f=!0,Mb.delete(p),bh.delete(h)}},[]),{file:e,loading:n,ready:o,error:a,refetch:()=>{ta=null,r(!0),l(null),i(!1),bS()}}}function zd(){const{file:e,loading:t}=_w();return{views:e.views,loading:t}}function nA(){const{file:e,loading:t}=_w();return{layout:e.dashboard,loading:t}}function ki(e){const{file:t,loading:n,ready:r,error:o,refetch:i}=_w();return e?{view:t.views.find(l=>l.id===e)??null,loading:n,ready:r,error:o,refetch:i}:{view:null,loading:!1,ready:!0,error:null,refetch:i}}async function Em(e,t,n){const r=ZR(),o=await fetch(t,{method:e,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!o.ok){const a=await o.json().catch(()=>({error:`HTTP ${o.status}`}));throw new Error(a.error??`HTTP ${o.status}`)}const i=tA(await o.json());return Ob(r)&&eA(i),i}function Zl(e){return Em("POST","/api/saved-views",e)}function vh(e,t){return Em("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function b7(e){return Em("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function Fb(e){return Em("PUT","/api/dashboard",{slots:e})}const v7=["top","right","bottom","left"],Si=Math.min,Mr=Math.max,wh=Math.round,dp=Math.floor,Js=e=>({x:e,y:e}),w7={left:"right",right:"left",bottom:"top",top:"bottom"};function zb(e,t,n){return Mr(e,Si(t,n))}function To(e,t){return typeof e=="function"?e(t):e}function Ro(e){return e.split("-")[0]}function Nc(e){return e.split("-")[1]}function Dw(e){return e==="x"?"y":"x"}function $w(e){return e==="y"?"height":"width"}function Gs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Iw(e){return Dw(Gs(e))}function j7(e,t,n){n===void 0&&(n=!1);const r=Nc(e),o=Iw(e),i=$w(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=jh(a)),[a,jh(a)]}function k7(e){const t=jh(e);return[Bb(e),t,Bb(t)]}function Bb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const vS=["left","right"],wS=["right","left"],S7=["top","bottom"],N7=["bottom","top"];function C7(e,t,n){switch(e){case"top":case"bottom":return n?t?wS:vS:t?vS:wS;case"left":case"right":return t?S7:N7;default:return[]}}function E7(e,t,n,r){const o=Nc(e);let i=C7(Ro(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Bb)))),i}function jh(e){const t=Ro(e);return w7[t]+e.slice(t.length)}function T7(e){return{top:0,right:0,bottom:0,left:0,...e}}function rA(e){return typeof e!="number"?T7(e):{top:e,right:e,bottom:e,left:e}}function kh(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function jS(e,t,n){let{reference:r,floating:o}=e;const i=Gs(t),a=Iw(t),l=$w(a),u=Ro(t),f=i==="y",p=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,g=r[l]/2-o[l]/2;let y;switch(u){case"top":y={x:p,y:r.y-o.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:h};break;case"left":y={x:r.x-o.width,y:h};break;default:y={x:r.x,y:r.y}}switch(Nc(t)){case"start":y[a]-=g*(n&&f?-1:1);break;case"end":y[a]+=g*(n&&f?-1:1);break}return y}async function R7(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:h="floating",altBoundary:g=!1,padding:y=0}=To(t,e),k=rA(y),b=l[g?h==="floating"?"reference":"floating":h],j=kh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:f,rootBoundary:p,strategy:u})),N=h==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},D=kh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:S,strategy:u}):N);return{top:(j.top-D.top+k.top)/C.y,bottom:(D.bottom-j.bottom+k.bottom)/C.y,left:(j.left-D.left+k.left)/C.x,right:(D.right-j.right+k.right)/C.x}}const A7=50,P7=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:R7},u=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:h}=jS(f,r,u),g=r,y=0;const k={};for(let v=0;v<i.length;v++){const b=i[v];if(!b)continue;const{name:j,fn:N}=b,{x:S,y:C,data:D,reset:T}=await N({x:p,y:h,initialPlacement:r,placement:g,strategy:o,middlewareData:k,rects:f,platform:l,elements:{reference:e,floating:t}});p=S??p,h=C??h,k[j]={...k[j],...D},T&&y<A7&&(y++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(f=T.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:p,y:h}=jS(f,g,u)),v=-1)}return{x:p,y:h,placement:g,strategy:o,middlewareData:k}},_7=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:u}=t,{element:f,padding:p=0}=To(e,t)||{};if(f==null)return{};const h=rA(p),g={x:n,y:r},y=Iw(o),k=$w(y),v=await a.getDimensions(f),b=y==="y",j=b?"top":"left",N=b?"bottom":"right",S=b?"clientHeight":"clientWidth",C=i.reference[k]+i.reference[y]-g[y]-i.floating[k],D=g[y]-i.reference[y],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let R=T?T[S]:0;(!R||!await(a.isElement==null?void 0:a.isElement(T)))&&(R=l.floating[S]||i.floating[k]);const $=C/2-D/2,P=R/2-v[k]/2-1,F=Si(h[j],P),_=Si(h[N],P),V=F,U=R-v[k]-_,I=R/2-v[k]/2+$,M=zb(V,I,U),B=!u.arrow&&Nc(o)!=null&&I!==M&&i.reference[k]/2-(I<V?F:_)-v[k]/2<0,W=B?I<V?I-V:I-U:0;return{[y]:g[y]+W,data:{[y]:M,centerOffset:I-M-W,...B&&{alignmentOffset:W}},reset:B}}}),D7=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:u,elements:f}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:v=!0,...b}=To(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const j=Ro(o),N=Gs(l),S=Ro(l)===l,C=await(u.isRTL==null?void 0:u.isRTL(f.floating)),D=g||(S||!v?[jh(l)]:k7(l)),T=k!=="none";!g&&T&&D.push(...E7(l,v,k,C));const R=[l,...D],$=await u.detectOverflow(t,b),P=[];let F=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&P.push($[j]),h){const I=j7(o,a,C);P.push($[I[0]],$[I[1]])}if(F=[...F,{placement:o,overflows:P}],!P.every(I=>I<=0)){var _,V;const I=(((_=i.flip)==null?void 0:_.index)||0)+1,M=R[I];if(M&&(!(h==="alignment"?N!==Gs(M):!1)||F.every(O=>Gs(O.placement)===N?O.overflows[0]>0:!0)))return{data:{index:I,overflows:F},reset:{placement:M}};let B=(V=F.filter(W=>W.overflows[0]<=0).sort((W,O)=>W.overflows[1]-O.overflows[1])[0])==null?void 0:V.placement;if(!B)switch(y){case"bestFit":{var U;const W=(U=F.filter(O=>{if(T){const H=Gs(O.placement);return H===N||H==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(H=>H>0).reduce((H,L)=>H+L,0)]).sort((O,H)=>O[1]-H[1])[0])==null?void 0:U[0];W&&(B=W);break}case"initialPlacement":B=l;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function kS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function SS(e){return v7.some(t=>e[t]>=0)}const $7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=To(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=kS(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:SS(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...i,altBoundary:!0}),l=kS(a,n.floating);return{data:{escapedOffsets:l,escaped:SS(l)}}}default:return{}}}}},sA=new Set(["left","top"]);async function I7(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=Ro(n),l=Nc(n),u=Gs(n)==="y",f=sA.has(a)?-1:1,p=i&&u?-1:1,h=To(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:k}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof k=="number"&&(y=l==="end"?k*-1:k),u?{x:y*p,y:g*f}:{x:g*f,y:y*p}}const L7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,u=await I7(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:a}}}}},M7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:u={fn:j=>{let{x:N,y:S}=j;return{x:N,y:S}}},...f}=To(e,t),p={x:n,y:r},h=await i.detectOverflow(t,f),g=Gs(Ro(o)),y=Dw(g);let k=p[y],v=p[g];if(a){const j=y==="y"?"top":"left",N=y==="y"?"bottom":"right",S=k+h[j],C=k-h[N];k=zb(S,k,C)}if(l){const j=g==="y"?"top":"left",N=g==="y"?"bottom":"right",S=v+h[j],C=v-h[N];v=zb(S,v,C)}const b=u.fn({...t,[y]:k,[g]:v});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:a,[g]:l}}}}}},O7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:u=!0,crossAxis:f=!0}=To(e,t),p={x:n,y:r},h=Gs(o),g=Dw(h);let y=p[g],k=p[h];const v=To(l,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const S=g==="y"?"height":"width",C=i.reference[g]-i.floating[S]+b.mainAxis,D=i.reference[g]+i.reference[S]-b.mainAxis;y<C?y=C:y>D&&(y=D)}if(f){var j,N;const S=g==="y"?"width":"height",C=sA.has(Ro(o)),D=i.reference[h]-i.floating[S]+(C&&((j=a.offset)==null?void 0:j[h])||0)+(C?0:b.crossAxis),T=i.reference[h]+i.reference[S]+(C?0:((N=a.offset)==null?void 0:N[h])||0)-(C?b.crossAxis:0);k<D?k=D:k>T&&(k=T)}return{[g]:y,[h]:k}}}},F7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:l}=t,{apply:u=()=>{},...f}=To(e,t),p=await a.detectOverflow(t,f),h=Ro(o),g=Nc(o),y=Gs(o)==="y",{width:k,height:v}=i.floating;let b,j;h==="top"||h==="bottom"?(b=h,j=g===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(j=h,b=g==="end"?"top":"bottom");const N=v-p.top-p.bottom,S=k-p.left-p.right,C=Si(v-p[b],N),D=Si(k-p[j],S),T=!t.middlewareData.shift;let R=C,$=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=N),T&&!g){const F=Mr(p.left,0),_=Mr(p.right,0),V=Mr(p.top,0),U=Mr(p.bottom,0);y?$=k-2*(F!==0||_!==0?F+_:Mr(p.left,p.right)):R=v-2*(V!==0||U!==0?V+U:Mr(p.top,p.bottom))}await u({...t,availableWidth:$,availableHeight:R});const P=await a.getDimensions(l.floating);return k!==P.width||v!==P.height?{reset:{rects:!0}}:{}}}};function Tm(){return typeof window<"u"}function Cc(e){return oA(e)?(e.nodeName||"").toLowerCase():"#document"}function Ur(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function no(e){var t;return(t=(oA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function oA(e){return Tm()?e instanceof Node||e instanceof Ur(e).Node:!1}function Ss(e){return Tm()?e instanceof Element||e instanceof Ur(e).Element:!1}function _o(e){return Tm()?e instanceof HTMLElement||e instanceof Ur(e).HTMLElement:!1}function NS(e){return!Tm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ur(e).ShadowRoot}function Bd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function z7(e){return/^(table|td|th)$/.test(Cc(e))}function Rm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const B7=/transform|translate|scale|rotate|perspective|filter/,U7=/paint|layout|strict|content/,Qi=e=>!!e&&e!=="none";let vy;function Lw(e){const t=Ss(e)?Ns(e):e;return Qi(t.transform)||Qi(t.translate)||Qi(t.scale)||Qi(t.rotate)||Qi(t.perspective)||!Mw()&&(Qi(t.backdropFilter)||Qi(t.filter))||B7.test(t.willChange||"")||U7.test(t.contain||"")}function H7(e){let t=Ni(e);for(;_o(t)&&!ec(t);){if(Lw(t))return t;if(Rm(t))return null;t=Ni(t)}return null}function Mw(){return vy==null&&(vy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),vy}function ec(e){return/^(html|body|#document)$/.test(Cc(e))}function Ns(e){return Ur(e).getComputedStyle(e)}function Am(e){return Ss(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ni(e){if(Cc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||NS(e)&&e.host||no(e);return NS(t)?t.host:t}function iA(e){const t=Ni(e);return ec(t)?e.ownerDocument?e.ownerDocument.body:e.body:_o(t)&&Bd(t)?t:iA(t)}function ld(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=iA(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=Ur(o);if(i){const l=Ub(a);return t.concat(a,a.visualViewport||[],Bd(o)?o:[],l&&n?ld(l):[])}else return t.concat(o,ld(o,[],n))}function Ub(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aA(e){const t=Ns(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=_o(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=wh(n)!==i||wh(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Ow(e){return Ss(e)?e:e.contextElement}function Hl(e){const t=Ow(e);if(!_o(t))return Js(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=aA(t);let a=(i?wh(n.width):n.width)/r,l=(i?wh(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const V7=Js(0);function lA(e){const t=Ur(e);return!Mw()||!t.visualViewport?V7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function W7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ur(e)?!1:t}function wa(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ow(e);let a=Js(1);t&&(r?Ss(r)&&(a=Hl(r)):a=Hl(e));const l=W7(i,n,r)?lA(i):Js(0);let u=(o.left+l.x)/a.x,f=(o.top+l.y)/a.y,p=o.width/a.x,h=o.height/a.y;if(i){const g=Ur(i),y=r&&Ss(r)?Ur(r):r;let k=g,v=Ub(k);for(;v&&r&&y!==k;){const b=Hl(v),j=v.getBoundingClientRect(),N=Ns(v),S=j.left+(v.clientLeft+parseFloat(N.paddingLeft))*b.x,C=j.top+(v.clientTop+parseFloat(N.paddingTop))*b.y;u*=b.x,f*=b.y,p*=b.x,h*=b.y,u+=S,f+=C,k=Ur(v),v=Ub(k)}}return kh({width:p,height:h,x:u,y:f})}function Pm(e,t){const n=Am(e).scrollLeft;return t?t.left+n:wa(no(e)).left+n}function cA(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Pm(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function q7(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",a=no(r),l=t?Rm(t.floating):!1;if(r===a||l&&i)return n;let u={scrollLeft:0,scrollTop:0},f=Js(1);const p=Js(0),h=_o(r);if((h||!h&&!i)&&((Cc(r)!=="body"||Bd(a))&&(u=Am(r)),h)){const y=wa(r);f=Hl(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const g=a&&!h&&!i?cA(a,u):Js(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+p.x+g.x,y:n.y*f.y-u.scrollTop*f.y+p.y+g.y}}function K7(e){return Array.from(e.getClientRects())}function G7(e){const t=no(e),n=Am(e),r=e.ownerDocument.body,o=Mr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Mr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Pm(e);const l=-n.scrollTop;return Ns(r).direction==="rtl"&&(a+=Mr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}const CS=25;function Y7(e,t){const n=Ur(e),r=no(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,u=0;if(o){i=o.width,a=o.height;const p=Mw();(!p||p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}const f=Pm(r);if(f<=0){const p=r.ownerDocument,h=p.body,g=getComputedStyle(h),y=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,k=Math.abs(r.clientWidth-h.clientWidth-y);k<=CS&&(i-=k)}else f<=CS&&(i+=f);return{width:i,height:a,x:l,y:u}}function X7(e,t){const n=wa(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=_o(e)?Hl(e):Js(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,u=o*i.x,f=r*i.y;return{width:a,height:l,x:u,y:f}}function ES(e,t,n){let r;if(t==="viewport")r=Y7(e,n);else if(t==="document")r=G7(no(e));else if(Ss(t))r=X7(t,n);else{const o=lA(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return kh(r)}function uA(e,t){const n=Ni(e);return n===t||!Ss(n)||ec(n)?!1:Ns(n).position==="fixed"||uA(n,t)}function Q7(e,t){const n=t.get(e);if(n)return n;let r=ld(e,[],!1).filter(l=>Ss(l)&&Cc(l)!=="body"),o=null;const i=Ns(e).position==="fixed";let a=i?Ni(e):e;for(;Ss(a)&&!ec(a);){const l=Ns(a),u=Lw(a);!u&&l.position==="fixed"&&(o=null),(i?!u&&!o:!u&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Bd(a)&&!u&&uA(e,a))?r=r.filter(p=>p!==a):o=l,a=Ni(a)}return t.set(e,r),r}function J7(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?Rm(t)?[]:Q7(t,this._c):[].concat(n),r],l=ES(t,a[0],o);let u=l.top,f=l.right,p=l.bottom,h=l.left;for(let g=1;g<a.length;g++){const y=ES(t,a[g],o);u=Mr(y.top,u),f=Si(y.right,f),p=Si(y.bottom,p),h=Mr(y.left,h)}return{width:f-h,height:p-u,x:h,y:u}}function Z7(e){const{width:t,height:n}=aA(e);return{width:t,height:n}}function eU(e,t,n){const r=_o(t),o=no(t),i=n==="fixed",a=wa(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const u=Js(0);function f(){u.x=Pm(o)}if(r||!r&&!i)if((Cc(t)!=="body"||Bd(o))&&(l=Am(t)),r){const y=wa(t,!0,i,t);u.x=y.x+t.clientLeft,u.y=y.y+t.clientTop}else o&&f();i&&!r&&o&&f();const p=o&&!r&&!i?cA(o,l):Js(0),h=a.left+l.scrollLeft-u.x-p.x,g=a.top+l.scrollTop-u.y-p.y;return{x:h,y:g,width:a.width,height:a.height}}function wy(e){return Ns(e).position==="static"}function TS(e,t){if(!_o(e)||Ns(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return no(e)===n&&(n=n.ownerDocument.body),n}function dA(e,t){const n=Ur(e);if(Rm(e))return n;if(!_o(e)){let o=Ni(e);for(;o&&!ec(o);){if(Ss(o)&&!wy(o))return o;o=Ni(o)}return n}let r=TS(e,t);for(;r&&z7(r)&&wy(r);)r=TS(r,t);return r&&ec(r)&&wy(r)&&!Lw(r)?n:r||H7(e)||n}const tU=async function(e){const t=this.getOffsetParent||dA,n=this.getDimensions,r=await n(e.floating);return{reference:eU(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nU(e){return Ns(e).direction==="rtl"}const rU={convertOffsetParentRelativeRectToViewportRelativeRect:q7,getDocumentElement:no,getClippingRect:J7,getOffsetParent:dA,getElementRects:tU,getClientRects:K7,getDimensions:Z7,getScale:Hl,isElement:Ss,isRTL:nU};function fA(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sU(e,t){let n=null,r;const o=no(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),i();const f=e.getBoundingClientRect(),{left:p,top:h,width:g,height:y}=f;if(l||t(),!g||!y)return;const k=dp(h),v=dp(o.clientWidth-(p+g)),b=dp(o.clientHeight-(h+y)),j=dp(p),S={rootMargin:-k+"px "+-v+"px "+-b+"px "+-j+"px",threshold:Mr(0,Si(1,u))||1};let C=!0;function D(T){const R=T[0].intersectionRatio;if(R!==u){if(!C)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R===1&&!fA(f,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(D,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,S)}n.observe(e)}return a(!0),i}function oU(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=Ow(e),p=o||i?[...f?ld(f):[],...t?ld(t):[]]:[];p.forEach(j=>{o&&j.addEventListener("scroll",n,{passive:!0}),i&&j.addEventListener("resize",n)});const h=f&&l?sU(f,n):null;let g=-1,y=null;a&&(y=new ResizeObserver(j=>{let[N]=j;N&&N.target===f&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var S;(S=y)==null||S.observe(t)})),n()}),f&&!u&&y.observe(f),t&&y.observe(t));let k,v=u?wa(e):null;u&&b();function b(){const j=wa(e);v&&!fA(v,j)&&n(),v=j,k=requestAnimationFrame(b)}return n(),()=>{var j;p.forEach(N=>{o&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),h==null||h(),(j=y)==null||j.disconnect(),y=null,u&&cancelAnimationFrame(k)}}const iU=L7,aU=M7,lU=D7,cU=F7,uU=$7,RS=_7,dU=O7,fU=(e,t,n)=>{const r=new Map,o={platform:rU,...n},i={...o.platform,_c:r};return P7(e,t,{...o,platform:i})};var pU=typeof document<"u",hU=function(){},Wp=pU?m.useLayoutEffect:hU;function Sh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Sh(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Sh(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function pA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function AS(e,t){const n=pA(e);return Math.round(t*n)/n}function jy(e){const t=m.useRef(e);return Wp(()=>{t.current=e}),t}function mU(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:u,open:f}=e,[p,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=m.useState(r);Sh(g,r)||y(r);const[k,v]=m.useState(null),[b,j]=m.useState(null),N=m.useCallback(O=>{O!==T.current&&(T.current=O,v(O))},[]),S=m.useCallback(O=>{O!==R.current&&(R.current=O,j(O))},[]),C=i||k,D=a||b,T=m.useRef(null),R=m.useRef(null),$=m.useRef(p),P=u!=null,F=jy(u),_=jy(o),V=jy(f),U=m.useCallback(()=>{if(!T.current||!R.current)return;const O={placement:t,strategy:n,middleware:g};_.current&&(O.platform=_.current),fU(T.current,R.current,O).then(H=>{const L={...H,isPositioned:V.current!==!1};I.current&&!Sh($.current,L)&&($.current=L,jo.flushSync(()=>{h(L)}))})},[g,t,n,_,V]);Wp(()=>{f===!1&&$.current.isPositioned&&($.current.isPositioned=!1,h(O=>({...O,isPositioned:!1})))},[f]);const I=m.useRef(!1);Wp(()=>(I.current=!0,()=>{I.current=!1}),[]),Wp(()=>{if(C&&(T.current=C),D&&(R.current=D),C&&D){if(F.current)return F.current(C,D,U);U()}},[C,D,U,F,P]);const M=m.useMemo(()=>({reference:T,floating:R,setReference:N,setFloating:S}),[N,S]),B=m.useMemo(()=>({reference:C,floating:D}),[C,D]),W=m.useMemo(()=>{const O={position:n,left:0,top:0};if(!B.floating)return O;const H=AS(B.floating,p.x),L=AS(B.floating,p.y);return l?{...O,transform:"translate("+H+"px, "+L+"px)",...pA(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:L}},[n,l,B.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:U,refs:M,elements:B,floatingStyles:W}),[p,U,M,B,W])}const gU=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?RS({element:r.current,padding:o}).fn(n):{}:r?RS({element:r,padding:o}).fn(n):{}}}},xU=(e,t)=>{const n=iU(e);return{name:n.name,fn:n.fn,options:[e,t]}},yU=(e,t)=>{const n=aU(e);return{name:n.name,fn:n.fn,options:[e,t]}},bU=(e,t)=>({fn:dU(e).fn,options:[e,t]}),vU=(e,t)=>{const n=lU(e);return{name:n.name,fn:n.fn,options:[e,t]}},wU=(e,t)=>{const n=cU(e);return{name:n.name,fn:n.fn,options:[e,t]}},jU=(e,t)=>{const n=uU(e);return{name:n.name,fn:n.fn,options:[e,t]}},kU=(e,t)=>{const n=gU(e);return{name:n.name,fn:n.fn,options:[e,t]}};var SU="Arrow",hA=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return s.jsx(Sn.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});hA.displayName=SU;var NU=hA;function CU(e){const[t,n]=m.useState(void 0);return wi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let a,l;if("borderBoxSize"in i){const u=i.borderBoxSize,f=Array.isArray(u)?u[0]:u;a=f.inlineSize,l=f.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Fw="Popper",[mA,gA]=Ta(Fw),[EU,xA]=mA(Fw),yA=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return s.jsx(EU,{scope:t,anchor:r,onAnchorChange:o,children:n})};yA.displayName=Fw;var bA="PopperAnchor",vA=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=xA(bA,n),a=m.useRef(null),l=nr(t,a),u=m.useRef(null);return m.useEffect(()=>{const f=u.current;u.current=(r==null?void 0:r.current)||a.current,f!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(Sn.div,{...o,ref:l})});vA.displayName=bA;var zw="PopperContent",[TU,RU]=mA(zw),wA=m.forwardRef((e,t)=>{var ie,ne,ue,ge,Ne,Ce;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:k,...v}=e,b=xA(zw,n),[j,N]=m.useState(null),S=nr(t,ke=>N(ke)),[C,D]=m.useState(null),T=CU(C),R=(T==null?void 0:T.width)??0,$=(T==null?void 0:T.height)??0,P=r+(i!=="center"?"-"+i:""),F=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},_=Array.isArray(f)?f:[f],V=_.length>0,U={padding:F,boundary:_.filter(PU),altBoundary:V},{refs:I,floatingStyles:M,placement:B,isPositioned:W,middlewareData:O}=mU({strategy:"fixed",placement:P,whileElementsMounted:(...ke)=>oU(...ke,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[xU({mainAxis:o+$,alignmentAxis:a}),u&&yU({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?bU():void 0,...U}),u&&vU({...U}),wU({...U,apply:({elements:ke,rects:Ue,availableWidth:oe,availableHeight:ve})=>{const{width:be,height:Re}=Ue.reference,He=ke.floating.style;He.setProperty("--radix-popper-available-width",`${oe}px`),He.setProperty("--radix-popper-available-height",`${ve}px`),He.setProperty("--radix-popper-anchor-width",`${be}px`),He.setProperty("--radix-popper-anchor-height",`${Re}px`)}}),C&&kU({element:C,padding:l}),_U({arrowWidth:R,arrowHeight:$}),g&&jU({strategy:"referenceHidden",...U})]}),[H,L]=SA(B),z=ba(k);wi(()=>{W&&(z==null||z())},[W,z]);const Y=(ie=O.arrow)==null?void 0:ie.x,q=(ne=O.arrow)==null?void 0:ne.y,Q=((ue=O.arrow)==null?void 0:ue.centerOffset)!==0,[ee,Z]=m.useState();return wi(()=>{j&&Z(window.getComputedStyle(j).zIndex)},[j]),s.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:W?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ee,"--radix-popper-transform-origin":[(ge=O.transformOrigin)==null?void 0:ge.x,(Ne=O.transformOrigin)==null?void 0:Ne.y].join(" "),...((Ce=O.hide)==null?void 0:Ce.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(TU,{scope:n,placedSide:H,onArrowChange:D,arrowX:Y,arrowY:q,shouldHideArrow:Q,children:s.jsx(Sn.div,{"data-side":H,"data-align":L,...v,ref:S,style:{...v.style,animation:W?void 0:"none"}})})})});wA.displayName=zw;var jA="PopperArrow",AU={top:"bottom",right:"left",bottom:"top",left:"right"},kA=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=RU(jA,r),a=AU[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(NU,{...o,ref:n,style:{...o.style,display:"block"}})})});kA.displayName=jA;function PU(e){return e!==null}var _U=e=>({name:"transformOrigin",options:e,fn(t){var b,j,N;const{placement:n,rects:r,middlewareData:o}=t,a=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[f,p]=SA(n),h={start:"0%",center:"50%",end:"100%"}[p],g=(((j=o.arrow)==null?void 0:j.x)??0)+l/2,y=(((N=o.arrow)==null?void 0:N.y)??0)+u/2;let k="",v="";return f==="bottom"?(k=a?h:`${g}px`,v=`${-u}px`):f==="top"?(k=a?h:`${g}px`,v=`${r.floating.height+u}px`):f==="right"?(k=`${-u}px`,v=a?h:`${y}px`):f==="left"&&(k=`${r.floating.width+u}px`,v=a?h:`${y}px`),{data:{x:k,y:v}}}});function SA(e){const[t,n="center"]=e.split("-");return[t,n]}var DU=yA,$U=vA,IU=wA,LU=kA,MU=Symbol("radix.slottable");function OU(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=MU,t}var FU=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),zU="VisuallyHidden",NA=m.forwardRef((e,t)=>s.jsx(Sn.span,{...e,ref:t,style:{...FU,...e.style}}));NA.displayName=zU;var BU=NA,[_m]=Ta("Tooltip",[gA]),Dm=gA(),CA="TooltipProvider",UU=700,Hb="tooltip.open",[HU,Bw]=_m(CA),EA=e=>{const{__scopeTooltip:t,delayDuration:n=UU,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,a=m.useRef(!0),l=m.useRef(!1),u=m.useRef(0);return m.useEffect(()=>{const f=u.current;return()=>window.clearTimeout(f)},[]),s.jsx(HU,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(f=>{l.current=f},[]),disableHoverableContent:o,children:i})};EA.displayName=CA;var cd="Tooltip",[VU,Ud]=_m(cd),TA=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,u=Bw(cd,e.__scopeTooltip),f=Dm(t),[p,h]=m.useState(null),g=Ml(),y=m.useRef(0),k=a??u.disableHoverableContent,v=l??u.delayDuration,b=m.useRef(!1),[j,N]=pm({prop:r,defaultProp:o??!1,onChange:R=>{R?(u.onOpen(),document.dispatchEvent(new CustomEvent(Hb))):u.onClose(),i==null||i(R)},caller:cd}),S=m.useMemo(()=>j?b.current?"delayed-open":"instant-open":"closed",[j]),C=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,b.current=!1,N(!0)},[N]),D=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,N(!1)},[N]),T=m.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,N(!0),y.current=0},v)},[v,N]);return m.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),s.jsx(DU,{...f,children:s.jsx(VU,{scope:t,contentId:g,open:j,stateAttribute:S,trigger:p,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{u.isOpenDelayedRef.current?T():C()},[u.isOpenDelayedRef,T,C]),onTriggerLeave:m.useCallback(()=>{k?D():(window.clearTimeout(y.current),y.current=0)},[D,k]),onOpen:C,onClose:D,disableHoverableContent:k,children:n})})};TA.displayName=cd;var Vb="TooltipTrigger",RA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ud(Vb,n),i=Bw(Vb,n),a=Dm(n),l=m.useRef(null),u=nr(t,l,o.onTriggerChange),f=m.useRef(!1),p=m.useRef(!1),h=m.useCallback(()=>f.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx($U,{asChild:!0,...a,children:s.jsx(Sn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:sn(e.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:sn(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:sn(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:sn(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:sn(e.onBlur,o.onClose),onClick:sn(e.onClick,o.onClose)})})});RA.displayName=Vb;var Uw="TooltipPortal",[WU,qU]=_m(Uw,{forceMount:void 0}),AA=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Ud(Uw,t);return s.jsx(WU,{scope:t,forceMount:n,children:s.jsx(Ra,{present:n||i.open,children:s.jsx(aw,{asChild:!0,container:o,children:r})})})};AA.displayName=Uw;var tc="TooltipContent",PA=m.forwardRef((e,t)=>{const n=qU(tc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,a=Ud(tc,e.__scopeTooltip);return s.jsx(Ra,{present:r||a.open,children:a.disableHoverableContent?s.jsx(_A,{side:o,...i,ref:t}):s.jsx(KU,{side:o,...i,ref:t})})}),KU=m.forwardRef((e,t)=>{const n=Ud(tc,e.__scopeTooltip),r=Bw(tc,e.__scopeTooltip),o=m.useRef(null),i=nr(t,o),[a,l]=m.useState(null),{trigger:u,onClose:f}=n,p=o.current,{onPointerInTransitChange:h}=r,g=m.useCallback(()=>{l(null),h(!1)},[h]),y=m.useCallback((k,v)=>{const b=k.currentTarget,j={x:k.clientX,y:k.clientY},N=JU(j,b.getBoundingClientRect()),S=ZU(j,N),C=eH(v.getBoundingClientRect()),D=nH([...S,...C]);l(D),h(!0)},[h]);return m.useEffect(()=>()=>g(),[g]),m.useEffect(()=>{if(u&&p){const k=b=>y(b,p),v=b=>y(b,u);return u.addEventListener("pointerleave",k),p.addEventListener("pointerleave",v),()=>{u.removeEventListener("pointerleave",k),p.removeEventListener("pointerleave",v)}}},[u,p,y,g]),m.useEffect(()=>{if(a){const k=v=>{const b=v.target,j={x:v.clientX,y:v.clientY},N=(u==null?void 0:u.contains(b))||(p==null?void 0:p.contains(b)),S=!tH(j,a);N?g():S&&(g(),f())};return document.addEventListener("pointermove",k),()=>document.removeEventListener("pointermove",k)}},[u,p,a,f,g]),s.jsx(_A,{...e,ref:i})}),[GU,YU]=_m(cd,{isInside:!1}),XU=OU("TooltipContent"),_A=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,u=Ud(tc,n),f=Dm(n),{onClose:p}=u;return m.useEffect(()=>(document.addEventListener(Hb,p),()=>document.removeEventListener(Hb,p)),[p]),m.useEffect(()=>{if(u.trigger){const h=g=>{const y=g.target;y!=null&&y.contains(u.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,p]),s.jsx(iw,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:s.jsxs(IU,{"data-state":u.stateAttribute,...f,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(XU,{children:r}),s.jsx(GU,{scope:n,isInside:!0,children:s.jsx(BU,{id:u.contentId,role:"tooltip",children:o||r})})]})})});PA.displayName=tc;var DA="TooltipArrow",QU=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Dm(n);return YU(DA,n).isInside?null:s.jsx(LU,{...o,...r,ref:t})});QU.displayName=DA;function JU(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function ZU(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function eH(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function tH(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const l=t[i],u=t[a],f=l.x,p=l.y,h=u.x,g=u.y;p>r!=g>r&&n<(h-f)*(r-p)/(g-p)+f&&(o=!o)}return o}function nH(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),rH(t)}function rH(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var sH=EA,oH=TA,iH=RA,aH=AA,$A=PA;const ha=sH,Or=oH,Fr=iH,vr=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(aH,{children:s.jsx($A,{ref:r,sideOffset:t,className:je("z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));vr.displayName=$A.displayName;function Hw({items:e,align:t="end"}){const[n,r]=m.useState(!1),[o,i]=m.useState(null),a=m.useRef(null);if(m.useEffect(()=>{if(!n){i(null);return}function u(p){a.current&&!a.current.contains(p.target)&&r(!1)}function f(p){p.key==="Escape"&&r(!1)}return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f)}},[n]),e.length===0)return null;function l(u,f){const p=u.icon,h=je("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",f&&"pl-8",u.disabled?"opacity-50 cursor-not-allowed":u.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),g=f?u.active?s.jsx(Sr,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):s.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):p?s.jsx(p,{className:"h-4 w-4 shrink-0"}):null,y=s.jsxs(s.Fragment,{children:[g,s.jsx("span",{className:"block min-w-0 truncate",children:u.label})]});if(u.disabled){const k=s.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:s.jsx("button",{type:"button",disabled:!0,className:h,children:y})});return u.disabledReason?s.jsxs(Or,{children:[s.jsx(Fr,{asChild:!0,children:k}),s.jsx(vr,{side:"left",children:u.disabledReason})]},u.key):s.jsx("div",{children:k},u.key)}return u.href?s.jsx(De,{to:u.href,className:h,onClick:()=>r(!1),children:y},u.key):s.jsx("button",{type:"button",className:h,onClick:()=>{var k;(k=u.onSelect)==null||k.call(u),r(!1)},children:y},u.key)}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsx("button",{type:"button",onClick:()=>r(u=>!u),className:"shell-action",title:"More actions","aria-label":"More actions","aria-haspopup":"true","aria-expanded":n,children:s.jsx(oO,{className:"h-4 w-4"})}),n&&s.jsx("div",{className:je("absolute top-full mt-1 z-30 min-w-[220px] rounded-md border border-border/70 bg-background shadow-lg py-1",t==="end"?"right-0":"left-0"),children:s.jsx(ha,{delayDuration:200,children:e.map(u=>{if(u.submenu&&u.submenu.length>0){const f=u.icon,p=o===u.key;return s.jsxs("div",{children:[s.jsxs("button",{type:"button",className:je("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":p,onClick:()=>i(p?null:u.key),children:[f?s.jsx(f,{className:"h-4 w-4 shrink-0"}):null,s.jsx("span",{className:"block min-w-0 flex-1 truncate",children:u.label}),p?s.jsx(cr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):s.jsx(c2,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),p?u.submenu.map(h=>l(h,!0)):null]},u.key)}return l(u,!1)})})})]})}function PS(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const lH={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function cH(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,0,0,0,0).getTime()}function uH(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function dH(e,t,n=Date.now()){if(!t)return!0;const r=t.field==="created"?e.created??e.updated:e.updated,o=Date.parse(r);if(Number.isNaN(o))return!1;if(t.preset){const l=lH[t.preset];return l===void 0?!0:t.preset.startsWith("older_")?n-o>l:o>=n-l&&o<=n}const i=t.from&&t.from.length>0?t.from:void 0,a=t.to&&t.to.length>0?t.to:void 0;return!i&&!a?!0:!(i&&o<cH(i)||a&&o>uH(a))}function fH(e,t,n={}){const{workspace:r,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const a=Ve(t.status),l=Ve(t.priority),u=Ve(t.type),f=Ve(t.assignee),p=Ve(t.project),h=Ve(t.tags),{activity:g}=t;if(r){if(r==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==r)return!1}if(a.length&&!a.includes(e.status)||l.length&&!l.includes(e.priority)||u.length&&!u.includes(e.type??"")||g==="stale"&&!PS(e.updated)||g==="fresh"&&PS(e.updated))return!1;if(f.length){const y=e.assignee??"__unassigned__";if(!f.includes(y))return!1}if(p.length&&!p.some(k=>k==="__standalone__"?e.projectSlug==null:e.projectSlug===k))return!1;if(h.length){const y=e.tags??[];if(!h.some(k=>y.includes(k)))return!1}if(!dH(e,t.dateRange))return!1;if(o){const y=o.trim().toLowerCase();if(y&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(y))return!1}return!0}function ud(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const _S={critical:0,high:1,medium:2,low:3};function fp(e){return Date.parse(e??"")||0}function Hd(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"title":a=o.title.localeCompare(i.title);break;case"status":a=o.status.localeCompare(i.status);break;case"priority":a=(_S[o.priority]??99)-(_S[i.priority]??99);break;case"assignee":a=(o.assignee??"").localeCompare(i.assignee??"");break;case"dependencies":a=o.dependsOn.length-i.dependsOn.length;break;case"created":a=fp(o.created)-fp(i.created);break;case"updated":a=fp(o.updated)-fp(i.updated);break}return n==="asc"?a:-a})}function pH(e){const t=`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`;return{...e.facts??{},status:e.status,phase:e.phase,disposition:e.disposition,priority:e.priority,type:e.type,assignee:e.assignee,project:e.projectSlug,tags:e.tags,archived:e.archived,title:e.title,created:e.created,updated:e.updated,completedAt:e.completedAt,statusAge:e.statusAge,phaseAge:e.phaseAge,searchText:t}}function IA(e,t,n={}){const{workspace:r,includeArchived:o=!1,now:i=Date.now()}=n,a={now:i};return e.filter(l=>{if(l.archived===!0&&!o)return!1;if(r){if(r==="_ungrouped"){if(l.projectWorkspace!=null)return!1}else if(l.projectWorkspace!==r)return!1}if(!t)return!0;const u=pH(l);return t.predicate(u,a)})}const $m={hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},pinned:{kind:"bool"}};function Im(e){const t=e.name,n={fact:t,approved:`${t}Approved`,changesRequested:`${t}ChangesRequested`,by:`${t}By`,approvedBy:`${t}ApprovedBy`},r=e.type==="attestation"?[n.fact,n.approved,n.changesRequested,n.by,n.approvedBy].map(o=>o.toLowerCase()):[n.fact.toLowerCase()];return{storageKey:t,exports:n,registryKeys:r}}function hH(e){const t=[];for(const n of e??[]){if(!n||typeof n.name!="string")continue;const r=n.name.trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(r))continue;const o=(n.type??"").trim();if(o==="bool"||o==="number")t.push({name:r,type:o});else if(o==="attestation"){const i=(n.binds??"none").toString().trim()||"none";(i==="plan"||i==="commit"||i==="none")&&t.push({name:r,type:"attestation",binds:i})}}return t}function Wb(e){const t=[],n=new Map;for(const r of Object.keys($m))n.set(r,"built-in");for(const r of Object.keys(cm))n.set(r,"built-in");for(const r of e??[]){const o=((r==null?void 0:r.name)??"").trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(o)){t.push(`fact "${(r==null?void 0:r.name)??""}": invalid name — must match /^[a-z][a-zA-Z0-9]*$/`);continue}const i=(r.type??"").trim();if(i!=="bool"&&i!=="number"&&i!=="attestation"){t.push(`fact "${o}": invalid type "${r.type??""}" — expected bool, number, or attestation`);continue}if(i==="attestation"){const f=(r.binds??"none").toString().trim()||"none";if(f!=="plan"&&f!=="commit"&&f!=="none"){t.push(`fact "${o}": invalid binds "${r.binds}" — expected plan, commit, or none`);continue}}const l=Im(i==="attestation"?{name:o,type:i}:{name:o,type:i}).registryKeys,u=l.find(f=>n.has(f));if(u!==void 0){const f=n.get(u);f==="built-in"?t.push(`fact "${o}": exported field "${u}" collides with a built-in field`):f===o?t.push(`fact "${o}": duplicate declaration (a fact named "${o}" is already declared)`):t.push(`fact "${o}": exported field "${u}" collides with fact "${f}"`);continue}for(const f of l)n.set(f,o)}return t}function mH(e){const t=new Set([...Object.keys($m),...Object.keys(cm)]),n=[];for(const r of e){const o=Im(r).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(r)}}return n}function LA(e,t){const n=Im(t);t.type==="attestation"?(e[n.exports.fact.toLowerCase()]={kind:"bool",get:r=>r[n.exports.fact]},e[n.exports.approved.toLowerCase()]={kind:"bool",get:r=>r[n.exports.approved]},e[n.exports.changesRequested.toLowerCase()]={kind:"bool",get:r=>r[n.exports.changesRequested]},e[n.exports.by.toLowerCase()]={kind:"list",get:r=>r[n.exports.by]},e[n.exports.approvedBy.toLowerCase()]={kind:"list",get:r=>r[n.exports.approvedBy]}):e[n.exports.fact.toLowerCase()]={kind:t.type,get:r=>r[n.exports.fact]}}function Vw(e){const t={...$m};for(const n of e)LA(t,n);return t}function MA(e){const t={...cm};for(const n of e)LA(t,n);return t}function OA(e){const t=["status","priority","type","assignee","project","tag","tags","archived","title","search","created","updated","completedAt","statusAge","phase","disposition","phaseAge","hasRealObjective","acRealTotal","acRealChecked","acAllChecked","planExists","planApproved","workspaceSet","implementationStarted","depsSatisfied","unresolvedQuestions","progressStaleDays","blocked","parked","reviewRequested","pinned"],n=[];for(const r of e){const o=Im(r);r.type==="attestation"?n.push(o.exports.fact,o.exports.approved,o.exports.changesRequested,o.exports.by,o.exports.approvedBy):n.push(o.exports.fact)}return[...t,...n]}function St({title:e,description:t,actions:n}){return s.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:s.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[s.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?s.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const nc='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Lm({columns:e,items:t,getItemId:n,getColumnId:r,renderCard:o,canDrop:i,onMove:a,getExternalDragData:l,onCardContextMenu:u,emptyMessage:f="No cards in this column.",hiddenColumnIds:p,onHideColumn:h,compact:g=!1,dragDisabled:y=!1,boundedColumns:k=!1}){const v=k&&!g,b=m.useMemo(()=>new Set(p??[]),[p]),j=m.useMemo(()=>e.filter(B=>!b.has(B.id)),[e,b]),N=m.useMemo(()=>e.filter(B=>b.has(B.id)),[e,b]),[S,C]=m.useState(null),[D,T]=m.useState(null),R=m.useRef(null),$=m.useMemo(()=>new Map(t.map(B=>[n(B),B])),[n,t]),P=m.useMemo(()=>j.map(B=>({column:B,items:t.filter(W=>r(W)===B.id)})),[j,r,t]),F=S?$.get(S)??null:null;function _(B){if(!F)return{allowed:!1};const W=r(F);return(i==null?void 0:i({item:F,fromColumnId:W,toColumnId:B}))??{allowed:!0}}function V(){C(null),T(null)}function U(B,W,O){if(y)return;const H=(l==null?void 0:l(W))??null;!a&&!H||(B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",O),H&&B.dataTransfer.setData("application/json",JSON.stringify(H)),a&&C(O))}function I(B,W,O){y||!a||!F||!_(W).allowed||(B.preventDefault(),B.dataTransfer.dropEffect="move",T(L=>(L==null?void 0:L.columnId)===W&&L.index===O?L:{columnId:W,index:O}))}async function M(B,W,O){var q;if(B.preventDefault(),y||!a||!F){V();return}const H=r(F),z=(((q=P.find(Q=>Q.column.id===H))==null?void 0:q.items)??[]).findIndex(Q=>n(Q)===n(F));if(!_(W).allowed||z<0){V();return}if(H===W&&(O===z||O===z+1)){V();return}try{await a({item:F,fromColumnId:H,toColumnId:W,fromIndex:z,toIndex:O})}finally{V()}}return s.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[N.length>0&&h?s.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{children:"Hidden:"}),N.map(B=>s.jsxs("button",{type:"button",onClick:()=>h(B.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${B.title}" column`,children:[B.title," ×"]},B.id))]}):null,s.jsx("div",{className:je("grid min-w-max grid-flow-col items-start gap-4",g?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:P.map(({column:B,items:W})=>{const O=_(B.id),H=(D==null?void 0:D.columnId)===B.id;return s.jsxs("section",{className:je("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",g?"min-h-[200px] p-2":"min-h-[320px] p-3",v?"max-h-[70vh]":"",F&&!O.allowed?"border-dashed opacity-65":"",F&&O.allowed?"border-primary/30 bg-accent/30":"",H?"ring-2 ring-ring/30":""),title:F&&!O.allowed?O.reason:void 0,children:[s.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:je("font-semibold uppercase tracking-[0.16em] text-muted-foreground",g?"text-xs":"text-sm"),children:B.title}),B.description&&!g?s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:B.description}):null]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs font-semibold text-foreground",children:W.length}),h?s.jsx("button",{type:"button",onClick:()=>h(B.id),className:"rounded-full border border-transparent px-1.5 py-0.5 text-xs text-muted-foreground hover:border-border hover:text-foreground",title:`Hide "${B.title}" column`,"aria-label":`Hide column ${B.title}`,children:"×"}):null]})]}),s.jsxs("div",{className:je("flex flex-1 flex-col gap-3",v?"min-h-0 overflow-y-auto pr-1":""),onDragOver:L=>I(L,B.id,W.length),onDrop:L=>M(L,B.id,W.length),children:[W.length===0?y?s.jsx("div",{className:"flex min-h-[128px] items-center justify-center rounded-lg border border-border/60 bg-background/50 px-4 text-center text-sm text-muted-foreground",children:typeof f=="function"?f(B):f}):s.jsx(gH,{active:(D==null?void 0:D.columnId)===B.id&&D.index===0,disabled:!!F&&!O.allowed,children:typeof f=="function"?f(B):f}):null,W.map((L,z)=>{const Y=n(L),q=S===Y;return s.jsxs(m.Fragment,{children:[s.jsx("div",{className:je("h-2 rounded-full transition",(D==null?void 0:D.columnId)===B.id&&D.index===z?"bg-primary/70":"bg-transparent"),onDragOver:Q=>I(Q,B.id,z),onDrop:Q=>M(Q,B.id,z)}),s.jsx("div",{draggable:!y&&!!(a||l),onMouseDown:Q=>{R.current=Q.target},onDragStart:Q=>{const ee=R.current;if(ee!=null&&ee.closest(nc)){Q.preventDefault();return}U(Q,L,Y)},onDragEnd:V,onContextMenu:Q=>{if(!u)return;const ee=Q.target;ee!=null&&ee.closest(nc)||u(L,Q)},className:je("transition",!y&&(a||l)?"cursor-grab active:cursor-grabbing":"",q?"scale-[0.98] opacity-50":""),children:o(L,{dragging:q})})]},Y)}),W.length>0&&!y?s.jsx("div",{className:je("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(D==null?void 0:D.columnId)===B.id&&D.index===W.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",F&&!O.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},B.id)})})]})}function gH({active:e,disabled:t,children:n}){return s.jsx("div",{className:je("flex min-h-[128px] items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground transition",e?"border-primary/60 bg-primary/10 text-foreground":"border-border/60 bg-background/50",t?"opacity-45":""),children:n})}const So="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Vl="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",FA="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",qb="border-status-review-foreground/30 bg-status-review text-status-review-foreground",zA="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",BA="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",UA="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",qp=So,xH={draft:So,pending:So,ready_for_planning:So,ready_to_implement:Vl,in_progress:Vl,blocked:FA,review:qb,code_review:qb,completed:zA,failed:BA,active:Vl,stopped:So,archived:UA};function yH(e){return xH[e]??qp}const bH={slate:qp,gray:qp,grey:qp};function HA(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function vH(e){let t=e.trim().replace(/^#/,"");return t.length===3&&(t=t.split("").map(n=>n+n).join("")),t.length!==6||/[^0-9a-fA-F]/.test(t)?null:{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function wH(e,t){const n=t==null?void 0:t.trim();if(n)if(n.startsWith("#")){const r=vH(n);if(r){const{r:o,g:i,b:a}=r;return{className:"",style:{backgroundColor:`rgba(${o}, ${i}, ${a}, 0.15)`,borderColor:`rgba(${o}, ${i}, ${a}, 0.4)`,color:n}}}}else{const r=bH[n.toLowerCase()];if(r)return{className:r}}return{className:yH(e)}}function dd(e,t){const n=e.find(i=>i.id===t),{className:r,style:o}=wH(t,n==null?void 0:n.color);return{label:(n==null?void 0:n.label)??HA(t),className:r,style:o,iconName:n==null?void 0:n.icon}}function Kb(e){return e?!!e.terminal||e.id==="completed"||e.id==="failed":!1}function VA(e){const t=new Map(e.statuses.map(a=>[a.id,a])),n=e.order.length>0?e.order:e.statuses.map(a=>a.id),r=new Set,o=[],i=(a,l)=>{r.has(a)||(r.add(a),o.push({id:a,label:(l==null?void 0:l.label)??HA(a),terminal:Kb(l??{id:a})}))};for(const a of n)i(a,t.get(a));for(const a of e.statuses)i(a.id,a);return o}const WA={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:So,icon:xc},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:So,icon:ZM},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:So,icon:f2},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Vl,icon:SO},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Vl,icon:Vv},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:FA,icon:ih},review:{label:"Review",description:"Ready for inspection or approval.",className:qb,icon:TO},completed:{label:"Completed",description:"Finished successfully.",className:zA,icon:em},failed:{label:"Failed",description:"Could not be completed as planned.",className:BA,icon:ih},active:{label:"Active",description:"The project has active or review work in flight.",className:Vl,icon:bb},stopped:{label:"Stopped",description:"Session ended without completing.",className:So,icon:QM},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:UA,icon:bb}},qA="inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-medium tracking-normal shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0)] dark:shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0.04)]";function Gb(e){var t;return((t=WA[e])==null?void 0:t.icon)??bb}function kn({status:e,className:t,showIcon:n=!0,progress:r}){var y;const o=As(),i=dd(o.statuses,e),a=Gb(e),l=i.label,u=((y=o.statuses.find(k=>k.id===e))==null?void 0:y.description)??Vd(e),f=r&&r.total>0,p=f?Math.min(1,Math.max(0,r.checked/r.total)):0,h=f?`${l} — ${u} (${r.checked}/${r.total} criteria)`:`${l} — ${u}`,g=n?f?s.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:[s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[s.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),s.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*7,strokeDashoffset:2*Math.PI*7*(1-p)})]}),s.jsx(a,{className:"h-2.5 w-2.5"})]}):s.jsx(a,{className:"h-3.5 w-3.5 shrink-0"}):null;return s.jsxs("span",{title:h,className:je(qA,i.className,t),style:i.style,children:[g,s.jsx("span",{className:"min-w-0 truncate",children:l})]})}function Vd(e){var t;return((t=WA[e])==null?void 0:t.description)??`Status: ${e}`}function Aa({type:e,className:t,compact:n=!1}){const r=$d();if(!e)return null;const o=pz(r,e),i=(o==null?void 0:o.label)??e.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase()),a=o!=null&&o.color?{backgroundColor:`color-mix(in oklch, ${o.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${o.color} 50%, transparent)`,color:o.color}:void 0;return s.jsx("span",{title:(o==null?void 0:o.description)??`Type: ${i}`,style:a,className:je("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!a&&"border-border/60 text-muted-foreground",t),children:i})}async function Wd(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return jH(e)}function jH(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function Hr({value:e,label:t,disabled:n=!1,disabledReason:r,onError:o}){const[i,a]=m.useState(!1);async function l(){n||(await Wd(e)?(a(!0),setTimeout(()=>a(!1),1500)):o==null||o(new Error("Copy to clipboard failed in this context.")))}return n?s.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:r??"Copy unavailable","aria-label":t??"Copy",children:s.jsx(ah,{className:"h-3 w-3","aria-hidden":"true"})}):s.jsx("button",{type:"button",onClick:l,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded",title:i?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:i?s.jsx(Sr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(ah,{className:"h-3 w-3","aria-hidden":"true"})})}function kH(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function SH({items:e,statusOrder:t,sortField:n,sortDirection:r,listSectionVisibility:o,compact:i=!1}){const a=As(),[l,u]=m.useState(()=>new Set(o.collapsed));m.useEffect(()=>{u(new Set(o.collapsed))},[o]);const f=p=>{u(h=>{const g=new Set(h);return g.has(p)?g.delete(p):g.add(p),g})};return s.jsx("div",{className:je("space-y-2",i?"space-y-1.5":"space-y-3"),children:t.map(p=>{const h=Hd(e.filter(k=>k.status===p),n,r);if(h.length===0)return null;const g=!l.has(p),y=Co(a,p);return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[s.jsxs("button",{type:"button",onClick:()=>f(p),className:je("flex w-full items-center gap-2 text-left",i?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[s.jsx(cr,{className:je("text-muted-foreground transition-transform",i?"h-3.5 w-3.5":"h-4 w-4",g?"":"-rotate-90")}),s.jsx("span",{className:"font-semibold text-foreground",children:y}),s.jsx("span",{className:je("rounded-full border border-border/60 text-muted-foreground",i?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:h.length})]}),g&&s.jsx("ul",{className:je("divide-y divide-border/40 border-t border-border/40",i?"text-xs":"text-sm"),children:h.map(k=>{const v=kH(k);return s.jsx("li",{children:s.jsxs(De,{to:v,className:je("flex items-center gap-3 hover:bg-muted/40",i?"px-3 py-1.5":"px-4 py-2.5"),children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:k.title}),k.projectTitle?s.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:k.projectTitle}):null,s.jsx("span",{className:"shrink-0 text-muted-foreground",children:Yn(k.updated)})]})},`${k.projectSlug??"standalone"}:${k.id}`)})})]},p)})})}function NH(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function CH({items:e,sortField:t,sortDirection:n,tableColumnVisibility:r,compact:o=!1}){const i=new Set(r.hidden);i.delete("title");const a=p=>!i.has(p),l=Hd(e,t,n),u=o?"py-2 pr-3":"py-3 pr-4",f=o?"text-xs":"text-sm";return s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:je("w-full text-left",f),children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[a("title")?s.jsx("th",{className:je("font-medium",u),children:"Assignment"}):null,a("status")?s.jsx("th",{className:je("font-medium",u),children:"Status"}):null,a("priority")?s.jsx("th",{className:je("font-medium",u),children:"Priority"}):null,a("assignee")?s.jsx("th",{className:je("font-medium",u),children:"Assignee"}):null,a("dependencies")?s.jsx("th",{className:je("font-medium",u),children:"Dependencies"}):null,a("created")?s.jsx("th",{className:je("font-medium",u),children:"Created"}):null,a("updated")?s.jsx("th",{className:je("font-medium",u),children:"Updated"}):null]})}),s.jsx("tbody",{children:l.map(p=>{const h=NH(p),g=`${p.projectSlug??"standalone"}:${p.id}`;return s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[a("title")?s.jsxs("td",{className:u,children:[s.jsx(De,{to:h,className:"font-semibold text-foreground hover:text-primary",children:p.title}),p.projectTitle?s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:p.projectTitle}):null]}):null,a("status")?s.jsx("td",{className:u,children:s.jsx(kn,{status:p.status,className:"max-w-[150px]"})}):null,a("priority")?s.jsx("td",{className:je("capitalize text-muted-foreground",u),children:p.priority}):null,a("assignee")?s.jsx("td",{className:je("text-muted-foreground",u),children:p.assignee??"Unassigned"}):null,a("dependencies")?s.jsx("td",{className:je("text-muted-foreground",u),children:p.dependsOn.length}):null,a("created")?s.jsx("td",{className:je("text-muted-foreground",u),children:Yn(p.created)}):null,a("updated")?s.jsx("td",{className:je("text-muted-foreground",u),children:Yn(p.updated)}):null]},g)})})]})})}function KA({view:e,compact:t,emptyDescription:n}){const{data:r,loading:o,error:i}=om(),a=As(),l=m.useMemo(()=>a.order.map(p=>({id:p,title:Co(a,p),description:Vd(p)})),[a]),u=m.useMemo(()=>MA(a.factDeclarations),[a.factDeclarations]),f=m.useMemo(()=>{if(!r)return[];const p=e.config.filters.query??Ou(e.config.filters);let h=null;p.trim()!==""&&(h=Jl(p,u).query);const g=IA(r.assignments,h,{workspace:e.workspace});return Hd(g,e.config.sortField,e.config.sortDirection)},[r,e,u]);if(o&&!r)return s.jsx(bt,{label:"Loading assignments…"});if(i)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});if(f.length===0)return s.jsx(St,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return s.jsx(Lm,{compact:t,dragDisabled:!0,columns:l,items:f,getItemId:p=>p.slug||p.id,getColumnId:p=>p.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:p=>t?s.jsx(EH,{item:p}):s.jsx(TH,{item:p})});case"list":return s.jsx(SH,{items:f,statusOrder:a.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return s.jsx(CH,{items:f,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function EH({item:e}){const t=ud(e);return s.jsxs("div",{className:je("rounded-md border border-border/60 bg-background/85 p-2 shadow-sm"),children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(De,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),s.jsx(kn,{status:e.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),s.jsx("span",{className:"shrink-0",children:Yn(e.updated)})]}),e.id?s.jsxs("p",{className:"mt-1 inline-flex items-center gap-1 font-mono text-[10px] text-muted-foreground/70",children:[e.id.slice(0,8),s.jsx(Hr,{value:e.id})]}):null]})}function TH({item:e}){const t=ud(e);return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(De,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),s.jsx(kn,{status:e.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[s.jsx(Aa,{type:e.type,compact:!0}),s.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),s.jsx("span",{className:"shrink-0",children:Yn(e.updated)})]})]})}function RH({viewId:e,onPickAnother:t}){const{view:n,loading:r,error:o,refetch:i}=ki(e);return r?s.jsx(bt,{label:"Loading view…"}):o?s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o.message}),s.jsx("button",{type:"button",onClick:()=>i(),className:"shell-action mt-3",children:"Retry"})]}):n?s.jsx(KA,{view:n,compact:!0,emptyDescription:"Adjust the view's filters to surface different work, or pick another widget for this slot."}):s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"View no longer exists"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The saved view this slot was bound to has been deleted."}),s.jsx("button",{type:"button",onClick:t,className:"shell-action mt-3",children:"Pick another widget"})]})}function GA({sessions:e}){return s.jsxs("aside",{"aria-labelledby":"overview-sessions-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsx("header",{className:"border-b border-border/40 px-4 py-3",children:s.jsx("h3",{id:"overview-sessions-title",className:"text-sm font-semibold text-foreground",children:"Recent Sessions"})}),e.length===0?s.jsxs("div",{className:"px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:pa.recentSessionsEmptyTitle}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:pa.recentSessionsEmptyHint})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>s.jsx("li",{children:s.jsx(AH,{session:t})},t.sessionId))})]})}function AH({session:e}){const t=mn(),[n,r]=m.useState(!1),o=PH(e,t),i=_H(e),a=!e.path;return s.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(De,{to:o,className:"block text-sm font-medium text-foreground hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:e.agent}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[i," · ",Yv(e.started)]}),n&&e.path?s.jsxs("div",{className:"mt-1 space-y-0.5",children:[s.jsx("code",{className:"block w-full select-all rounded bg-muted/40 px-1.5 py-0.5 text-xs text-foreground",children:e.path}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:pa.recentSessionsCopyFallbackHint})]}):null]}),s.jsx(Hr,{value:e.path,label:pa.recentSessionsCopyPathLabel,disabled:a,disabledReason:pa.recentSessionsCopyPathDisabled,onError:()=>r(!0)})]})}function PH(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function _H(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const DH={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function na(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function $H(e,t,n=Date.now()){const r=na(e);if(t.preset){const a=DH[t.preset];return a?t.preset.startsWith("older_")?r<n-a:r>=n-a:!0}const o=t.from?Date.parse(`${t.from}T00:00:00.000Z`):null,i=t.to?Date.parse(`${t.to}T23:59:59.999Z`):null;return!(o!==null&&Number.isFinite(o)&&r<o||i!==null&&Number.isFinite(i)&&r>i)}function IH(e,t,n=Date.now()){const{dateRange:r,project:o,agent:i,sessionStatus:a}=t,l=new Set(o??[]),u=new Set(i??[]),f=new Set(a??[]);return e.filter(p=>{if(r&&!$H(p.started,r,n))return!1;if(l.size>0){const h=p.projectSlug??"__standalone__";if(!l.has(h))return!1}if(u.size>0&&!Array.from(u).some(g=>g.toLowerCase()===p.agent.toLowerCase()))return!1;if(f.size>0){let h=!1;for(const g of f){switch(g){case"active":p.status==="active"&&(h=!0);break;case"ended":(p.status==="completed"||p.status==="stopped")&&(h=!0);break;case"tracked":h=!0;break}if(h)break}if(!h)return!1}return!0})}function LH(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"started":a=na(o.started)-na(i.started);break;case"lastActivity":a=na(o.updatedAt)-na(i.updatedAt);break;case"projectName":{const l=o.projectSlug??"",u=i.projectSlug??"";a=l.localeCompare(u);break}case"agentName":a=o.agent.localeCompare(i.agent);break;default:a=na(o.started)-na(i.started);break}return n==="asc"?a:-a})}function MH(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function OH({view:e,emptyDescription:t}){const{data:n,loading:r,error:o}=im(),i=m.useMemo(()=>{if(!n)return[];const a=n.sessions??[],{config:l}=e,u=l.filters,f={dateRange:u.dateRange?{...u.dateRange,field:"started"}:void 0,project:Ve(u.project),agent:Ve(u.agent),sessionStatus:Ve(u.sessionStatus),limit:l.limit};let p=IH(a,f);return p=LH(p,l.sortField,l.sortDirection),p=MH(p,l.limit),p},[n,e]);return r&&!n?s.jsx(bt,{label:"Loading sessions…"}):o?s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o})]}):i.length===0?s.jsx(St,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):s.jsx(GA,{sessions:i})}function FH({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:r,loading:o}=zd(),[i,a]=m.useState(!1),l=m.useRef(null),u=m.useMemo(()=>r.filter(h=>h.entityType==="session"),[r]);m.useEffect(()=>{if(!i)return;function h(y){l.current&&!l.current.contains(y.target)&&a(!1)}function g(y){y.key==="Escape"&&a(!1)}return document.addEventListener("mousedown",h),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",g)}},[i]);const f=e?r.find(h=>h.id===e)??null:null,p=o?"Session views…":f?f.name:"Session views";return s.jsxs("div",{className:"relative",ref:l,children:[s.jsxs("button",{type:"button",disabled:o,onClick:()=>a(h=>!h),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":i,title:"Session views",children:[s.jsx("span",{className:"max-w-[160px] truncate",children:p}),s.jsx(cr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),i&&s.jsxs("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:[s.jsxs("button",{type:"button",onClick:()=>{a(!1),t(null)},className:je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",!e&&"font-semibold text-foreground"),children:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e?null:s.jsx(Sr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),s.jsx("span",{children:"All sessions"})]}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"my-1 border-t border-border/40"}),u.map(h=>{const g=h.id===e;return s.jsxs("button",{type:"button",onClick:()=>{a(!1),t(h.id)},className:je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",g&&"font-semibold text-foreground"),children:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:g?s.jsx(Sr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),s.jsx("span",{className:"truncate",children:h.name})]},h.id)})]}),s.jsx("div",{className:"my-1 border-t border-border/40"}),s.jsxs("button",{type:"button",onClick:()=>{a(!1),n()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5 text-muted-foreground",children:[s.jsx(Mt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"Create new view…"})]})]})]})}const zH={__unassigned__:"Unassigned",__standalone__:"No project"};function wn({options:e,value:t,onChange:n,allLabel:r="Any",className:o,disabled:i,ariaLabel:a}){const[l,u]=m.useState(!1),f=m.useRef(null),p=m.useRef(null),h=m.useRef([]),g=m.useMemo(()=>{const N=new Set(e.map(C=>C.value)),S=t.filter(C=>!N.has(C)).map(C=>({value:C,label:zH[C]??C}));return[...e,...S]},[e,t]),y=m.useMemo(()=>new Set(t),[t]);m.useEffect(()=>{if(!l)return;function N(S){f.current&&!f.current.contains(S.target)&&u(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),m.useEffect(()=>{var N;l&&((N=h.current[0])==null||N.focus())},[l]);const k=m.useMemo(()=>{if(t.length===0)return r;if(t.length===1){const N=g.find(S=>S.value===t[0]);return N?N.label:t[0]}return`${t.length} selected`},[t,g,r]);function v(N){n(y.has(N)?t.filter(S=>S!==N):[...t,N])}function b(N){var C;const S=Math.max(0,Math.min(N,g.length-1));(C=h.current[S])==null||C.focus()}function j(N){var T;const S=h.current,C=document.activeElement,D=S.findIndex(R=>R===C);N.key==="ArrowDown"?(N.preventDefault(),b(D<0?0:D+1)):N.key==="ArrowUp"?(N.preventDefault(),b(D<0?g.length-1:D-1)):N.key==="Home"?(N.preventDefault(),b(0)):N.key==="End"?(N.preventDefault(),b(g.length-1)):N.key==="Escape"&&(N.preventDefault(),u(!1),(T=p.current)==null||T.focus())}return s.jsxs("div",{className:"relative",ref:f,children:[s.jsxs("button",{type:"button",ref:p,disabled:i,"aria-haspopup":"menu","aria-expanded":l,"aria-label":a,onClick:()=>u(N=>!N),onKeyDown:N=>{!l&&(N.key==="ArrowDown"||N.key==="ArrowUp")&&(N.preventDefault(),u(!0))},className:je("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",o),children:[s.jsx("span",{className:"truncate",children:k}),s.jsx(cr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),l?s.jsxs("div",{role:"menu","aria-label":a,onKeyDown:j,className:"absolute left-0 top-full z-30 mt-1 max-h-72 min-w-[200px] overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[s.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===g.length,onClick:()=>n(g.map(N=>N.value)),children:"Select all"}),s.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===0,onClick:()=>n([]),children:"Clear"})]}),g.length===0?s.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):g.map((N,S)=>{const C=y.has(N.value);return s.jsxs("button",{ref:D=>{h.current[S]=D},type:"button",role:"menuitemcheckbox","aria-checked":C,tabIndex:-1,onClick:()=>v(N.value),className:je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",C?"text-foreground":"text-muted-foreground"),children:[s.jsx("span",{className:je("flex h-4 w-4 shrink-0 items-center justify-center rounded border",C?"border-foreground bg-foreground text-background":"border-border/70"),"aria-hidden":"true",children:C?s.jsx(Sr,{className:"h-3 w-3"}):null}),s.jsx("span",{className:"truncate",children:N.label})]},N.value)})]}):null]})}const DS={last_24h:"Last 24 hours",last_7d:"Last 7 days",last_30d:"Last 30 days",last_90d:"Last 90 days",older_7d:"Older than 7 days",older_30d:"Older than 30 days"},BH=["updated","created"];function Mm({value:e,onChange:t,className:n,ariaLabel:r="Date range filter"}){const[o,i]=m.useState(!1),a=m.useRef(null),l=(e==null?void 0:e.field)??"updated",u=!!(e&&!e.preset&&(e.from||e.to)),[f,p]=m.useState(u);m.useEffect(()=>p(u),[u]),m.useEffect(()=>{if(!o)return;function j(S){a.current&&!a.current.contains(S.target)&&i(!1)}function N(S){S.key==="Escape"&&i(!1)}return document.addEventListener("mousedown",j),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",N)}},[o]);const h=!!(e&&(e.preset||e.from||e.to)),g=m.useMemo(()=>!h||!e?"Any date":e.preset?`${l}: ${DS[e.preset]??e.preset}`:`${l}: ${e.from||"…"} → ${e.to||"…"}`,[h,e,l]);function y(j){t(e?{...e,field:j}:{field:j,preset:"",from:"",to:""})}function k(j){p(!1),t({field:l,preset:j,from:"",to:""})}function v(){p(!1),t(null)}function b(j,N){const S={field:l,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...S,[j]:N})}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":o,"aria-label":r,onClick:()=>i(j=>!j),className:je("editor-input inline-flex items-center justify-between gap-1.5 text-left",h&&"border-foreground/40 text-foreground",n),children:[s.jsx("span",{className:"truncate",children:g}),s.jsx(cr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),o?s.jsxs("div",{className:"absolute left-0 top-full z-30 mt-1 w-64 rounded-md border border-border/70 bg-background p-2 shadow-lg",children:[s.jsx("div",{className:"mb-2 inline-flex rounded-md border border-border/60 bg-background/80 p-0.5",children:BH.map(j=>s.jsx("button",{type:"button","aria-pressed":l===j,onClick:()=>y(j),className:je("rounded-sm px-2.5 py-1 text-xs font-medium capitalize transition",l===j?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:j},j))}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ky,{label:"Any date",selected:!h,onClick:v}),M6.map(j=>s.jsx(ky,{label:DS[j],selected:(e==null?void 0:e.preset)===j,onClick:()=>k(j)},j)),s.jsx(ky,{label:"Custom range…",selected:f,onClick:()=>{p(!0),t({field:l,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""})}})]}),f?s.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/60 pt-2",children:[s.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["From",s.jsx("input",{type:"date",value:(e==null?void 0:e.from)??"",max:(e==null?void 0:e.to)||void 0,onChange:j=>b("from",j.target.value),className:"editor-input w-40"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["To",s.jsx("input",{type:"date",value:(e==null?void 0:e.to)??"",min:(e==null?void 0:e.from)||void 0,onChange:j=>b("to",j.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function ky({label:e,selected:t,onClick:n}){return s.jsxs("button",{type:"button",onClick:n,className:je("flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-left text-sm transition hover:bg-foreground/5",t?"text-foreground":"text-muted-foreground"),children:[s.jsx("span",{children:e}),t?s.jsx(Sr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const UH=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function HH(e,t){const n={};for(const[r,o]of Object.entries(e))UH.has(r)||(n[r]=o);return{...n,...t}}function Nh(e,t,n){return{...e,viewMode:t.viewMode,filters:HH(e.filters,t.filters),sortField:t.sortField,sortDirection:t.sortDirection,limit:t.limit,listSectionVisibility:{collapsed:[...n.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...n.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...n.tableColumnVisibility.hidden]}}}function VH(e,t){var g,y;const n={},r=Ve(e.status);r.length&&(n.status=r);const o=Ve(e.type);o.length&&(n.type=o);const i=Ve(e.priority);i.length&&(n.priority=i);const a=Ve(e.assignee);a.length&&(n.assignee=a);const l=Ve(e.tags);if(l.length&&(n.tags=l),t&&t!=="all")n.project=[t];else{const k=Ve(e.project);k.length&&(n.project=k)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const u=Ve(e.sessionStatus);u.length&&(n.sessionStatus=u);const f=Ve(e.agent);f.length&&(n.agent=f),e.dateRange&&(n.dateRange=e.dateRange);const p=(g=e.search)==null?void 0:g.trim();p&&(n.search=p);const h=(y=e.query)==null?void 0:y.trim();return h&&(n.query=h),n}function rc(e){const t={viewMode:e.state.viewMode,filters:VH(e.state.filters,e.context.projectSlug),sortField:e.state.sortField,sortDirection:e.state.sortDirection,listSectionVisibility:{collapsed:[...e.state.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...e.state.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...e.state.tableColumnVisibility.hidden]}};return{name:e.name.trim(),workspace:e.context.workspace,config:t}}const ml={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},pp={sortField:"started",sortDirection:"desc"};function YA(e,t){const{config:n}=rc({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:e.viewMode,filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),r={...n};return e.limit!==void 0&&e.limit>0&&(r.limit=e.limit),{workspace:t,config:r}}function Ww(e,t){const{config:n}=rc({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:"list",filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),r={...n};return e.limit!==void 0&&e.limit>0&&(r.limit=e.limit),{workspace:t,config:r}}function ma(e){if(!e)return;if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return;const r={field:e.field};return t&&(r.from=t),n&&(r.to=n),r}function Om(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function XA(e,t){var r,o,i,a,l,u,f,p,h,g,y,k,v,b,j;const{config:n}=e;if((r=t.setViewMode)==null||r.call(t,n.viewMode),(o=t.setStatusFilter)==null||o.call(t,Ve(n.filters.status)),(i=t.setTypeFilter)==null||i.call(t,Ve(n.filters.type)),(a=t.setPriorityFilter)==null||a.call(t,Ve(n.filters.priority)),(l=t.setAssigneeFilter)==null||l.call(t,Ve(n.filters.assignee)),(u=t.setProjectFilter)==null||u.call(t,Ve(n.filters.project)),(f=t.setTagsFilter)==null||f.call(t,Ve(n.filters.tags)),(p=t.setDateRange)==null||p.call(t,Om(n.filters.dateRange)),(h=t.setSearch)==null||h.call(t,n.filters.search??""),(g=t.setQuery)==null||g.call(t,n.filters.query??Ou(n.filters)),t.setActivityFilter){const N=n.filters.activity??"all";t.setActivityFilter(N==="fresh"||N==="stale"?N:"all")}(y=t.setSortField)==null||y.call(t,n.sortField),(k=t.setSortDirection)==null||k.call(t,n.sortDirection),(v=t.setListSectionVisibility)==null||v.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(b=t.setKanbanColumnVisibility)==null||b.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(j=t.setTableColumnVisibility)==null||j.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Kp(e){return e?`/w/${e}/views`:"/views"}function QA(e){return`${Kp(e.workspace)}/${encodeURIComponent(e.id)}`}function JA(e){const t=e.workspace?`/w/${e.workspace}`:"",n=Ve(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&YR(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const WH=["critical","high","medium","low"],qH={last_24h:"last 24 hours",last_7d:"last 7 days",last_30d:"last 30 days",last_90d:"last 90 days",older_7d:"older than 7 days",older_30d:"older than 30 days"};function KH(e){if(e.preset)return`${e.field} ${qH[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function ZA(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&Fu(t)===null)return`query: ${t}`;const n=[];for(const a of["status","priority","type","assignee","project","tags"]){const l=Ve(e[a]);l.length&&n.push(`${a}=${l.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(KH(e.dateRange));const r=(i=e.search)==null?void 0:i.trim();return r&&n.push(`search="${r}"`),n.join(" · ")||"no filters"}const $S=80,GH=["started","lastActivity","projectName","agentName"],YH={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},XH=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function eP({open:e,onOpenChange:t,initialView:n,onSubmit:r}){const o=!!n,{data:i}=to(),{data:a}=im(),[l,u]=m.useState(""),[f,p]=m.useState([]),[h,g]=m.useState([]),[y,k]=m.useState([]),[v,b]=m.useState(null),[j,N]=m.useState(pp.sortField),[S,C]=m.useState(pp.sortDirection),[D,T]=m.useState(""),[R,$]=m.useState(!1),[P,F]=m.useState(null);function _(){p([]),g([]),k([]),b(null),N(pp.sortField),C(pp.sortDirection),T("")}m.useEffect(()=>{if(e)if(F(null),$(!1),n){const O=n.config.filters;u(n.name),p(Ve(O.project)),g(Ve(O.agent)),k(Ve(O.sessionStatus)),b(Om(O.dateRange)),N(n.config.sortField),C(n.config.sortDirection),T(n.config.limit!==void 0?String(n.config.limit):"")}else u(""),_()},[e,n]);const V=m.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(H=>({value:H.slug,label:H.title}))],[i]),U=m.useMemo(()=>{const O=new Set;for(const H of(a==null?void 0:a.sessions)??[])H.agent&&O.add(H.agent);return Array.from(O).sort().map(H=>({value:H,label:H}))},[a]),I=l.trim(),M=I.length>0&&I.length<=$S,B=D.trim()===""?void 0:parseInt(D.trim(),10),W=D.trim()===""||Number.isFinite(B)&&B!==void 0&&B>0&&B<=500;return s.jsx(Mn,{open:e,onOpenChange:t,children:s.jsx(Nn,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async O=>{if(O.preventDefault(),!M||!W||R)return;$(!0),F(null);const H=ma(v),L=H?{...H,field:"started"}:void 0,z={filters:{project:f,agent:h,sessionStatus:y,dateRange:L},sortField:j,sortDirection:S,limit:B};try{await r(I,z)}catch(Y){F(Y instanceof Error?Y.message:String(Y)),$(!1)}},children:[s.jsx(sr,{children:s.jsx(Cn,{children:o?"Edit session view":"Create session view"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-session-view-name",children:"Name"}),s.jsx("input",{id:"create-session-view-name",type:"text",value:l,autoFocus:!0,required:!0,maxLength:$S,onChange:O=>u(O.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(gl,{label:"Date range (session start)",children:s.jsx(Mm,{className:"w-full",value:v,onChange:b})}),s.jsx(gl,{label:"Project",children:s.jsx(wn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:V,value:f,onChange:p})}),s.jsx(gl,{label:"Agent",children:s.jsx(wn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:U,value:h,onChange:g})}),s.jsx(gl,{label:"Session status",children:s.jsx(wn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:XH,value:y,onChange:k})}),s.jsx(gl,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:j,onChange:O=>N(O.target.value),className:"editor-input w-full",children:GH.map(O=>s.jsx("option",{value:O,children:YH[O]??O},O))}),s.jsx("button",{type:"button",onClick:()=>C(O=>O==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:S==="asc"?"Ascending":"Descending",children:S==="asc"?"Asc":"Desc"})]})}),s.jsxs(gl,{label:"Max results",className:"sm:col-span-2",children:[s.jsx("input",{type:"number",min:1,max:500,value:D,onChange:O=>T(O.target.value),placeholder:"No limit",className:"editor-input w-full"}),W?null:s.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:"Limit must be between 1 and 500"})]})]}),P?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:P}):null,s.jsxs(Wr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:_,className:"shell-action",disabled:R,children:"Clear all"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:R,children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!M||!W||R,className:"shell-action shell-action--cta disabled:opacity-50",children:R?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function gl({label:e,className:t,children:n}){return s.jsxs("label",{className:`space-y-1 ${t??""}`,children:[s.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}function Sy({title:e,message:t,onPickAnother:n}){return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:e}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t}),n?s.jsx("button",{type:"button",onClick:n,className:"shell-action mt-3",children:"Pick another widget"}):null]})}function QH({viewId:e,slotId:t,onPickAnother:n}){const{data:r,loading:o,error:i}=im(),{view:a,loading:l,ready:u}=ki(e??null),{layout:f}=nA(),{showToast:p}=Qn(),[h,g]=m.useState(!1),y=m.useCallback(async b=>{if(!t)return;const j=f.slots.map(N=>N.id===t?{...N,widget:b?{kind:"agent-sessions",viewId:b}:{kind:"agent-sessions"}}:N);try{await Fb(j)}catch(N){p(N instanceof Error?N.message:"Failed to update widget")}},[f,t,p]);async function k(b,j){const{workspace:N,config:S}=Ww(j,null);try{const D=(await Zl({name:b,workspace:N,config:S,entityType:"session"})).views.find(T=>T.name===b&&T.entityType==="session");D&&await y(D.id),g(!1),p(`Created session view "${b}"`)}catch(C){throw p(C instanceof Error?C.message:"Failed to create session view"),C}}let v;return e?l&&!u?v=s.jsx(bt,{label:"Loading view…"}):a?a.entityType!=="session"?v=s.jsx(Sy,{title:"Wrong view type",message:"This widget is bound to an assignment view. Choose a session view above, or pick a different widget.",onPickAnother:n}):v=s.jsx(OH,{view:a,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):v=s.jsx(Sy,{title:"View no longer exists",message:"The saved view this widget was bound to has been deleted. Pick another session view above, or choose a different widget.",onPickAnother:n}):o&&!r?v=s.jsx(bt,{label:"Loading sessions…"}):i?v=s.jsx(Sy,{title:"Couldn't load sessions",message:i}):v=s.jsx(GA,{sessions:(r==null?void 0:r.sessions)??[]}),s.jsxs("div",{className:"space-y-2",children:[t?s.jsx("div",{className:"flex items-center justify-between gap-2",children:s.jsx(FH,{activeViewId:e??null,onSelectView:b=>void y(b),onCreateNew:()=>g(!0)})}):null,v,s.jsx(eP,{open:h,onOpenChange:g,workspace:null,onSubmit:k})]})}const JH=5;function ZH(){const{data:e,loading:t,error:n}=W2();if(t&&!e)return s.jsx(bt,{label:"Loading inventories…"});if(n)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load inventories"}),s.jsx("p",{className:"mt-1 text-xs",children:n})]});const o=((e==null?void 0:e.inventories)??[]).slice(0,JH);return s.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[s.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),s.jsx(De,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),o.length===0?s.jsxs("div",{className:"px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:o.map(i=>{const a=i.inventory,l=i.active_leases.length,u=i.members.length,f=a.display_name??a.slug;return s.jsx("li",{children:s.jsxs(De,{to:`/inventories/${encodeURIComponent(a.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:f}),s.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[l,"/",u," leased"]})]})},a.slug)})})]})}function e9(e){let t=0,n=0;for(const r of e.daily)t+=r.total_tokens,n+=r.total_cost;return{tokens:t,cost:n}}function IS({filters:e,metric:t}){const n=e??{},{data:r,loading:o,error:i}=q4(n),a=t==="cost"?"Spend":"Token Usage",l=`/usage?${Nb(n).toString()}`;let u;if(o&&!r)u=s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});else if(i&&!r)u=s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load usage"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});else if(!r||r.daily.length===0)u=s.jsx("p",{className:"text-sm text-muted-foreground",children:"No usage for these filters."});else{const{tokens:f,cost:p}=e9(r),h=t==="cost"?{label:"Total spend",value:Ql(p)}:{label:"Total tokens",value:Xl(f)},g=t==="cost"?{label:"Tokens",value:Xl(f)}:{label:"Spend",value:Ql(p)};u=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(LS,{label:h.label,value:h.value,emphasize:!0}),s.jsx(LS,{label:g.label,value:g.value})]})}return s.jsxs("aside",{className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsxs("header",{className:"flex items-center justify-between gap-2 border-b border-border/40 px-4 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:a}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",title:_1(n),children:_1(n)})]}),s.jsx(De,{to:l,className:"shrink-0 text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),s.jsx("div",{className:"px-4 py-4",children:u})]})}function LS({label:e,value:t,emphasize:n}){return s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),s.jsx("p",{className:n?"text-2xl font-semibold tabular-nums text-foreground":"text-lg font-semibold tabular-nums text-foreground",children:t})]})}const t9={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function n9(e){return e.kind==="token-usage"||e.kind==="spend"?e.filters??{}:{}}const xl="bg-background border border-border rounded px-2 py-1 text-sm text-foreground";function MS({config:e,open:t,onSave:n,onCancel:r}){const o=e.kind==="spend"?"Configure Spend":"Configure Token Usage",{data:i}=to(),{data:a}=Ea(),{data:l}=q2(t),[u,f]=m.useState("30d"),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,v]=m.useState(""),[b,j]=m.useState(""),[N,S]=m.useState(""),[C,D]=m.useState(""),[T,R]=m.useState(!1),[$,P]=m.useState(null);m.useEffect(()=>{if(!t)return;const M=n9(e);f(M.window??"30d"),h(M.since??""),y(M.until??""),v(M.project??""),j(M.workspace??""),S(M.model??""),D(M.tool??""),R(!1),P(null)},[t,e]);function F(){return Dd({window:u,since:u==="custom"?p:void 0,until:u==="custom"?g:void 0,project:k||void 0,workspace:b||void 0,model:N||void 0,tool:C||void 0})}async function _(M){if(M.preventDefault(),T)return;const B=F(),W=I4(B);if(!W.ok){P(W.errors.join("; "));return}R(!0),P(null);const O=e.kind==="token-usage"?{kind:"token-usage",filters:B}:e.kind==="spend"?{kind:"spend",filters:B}:e;try{await n(O)}catch(H){P(H instanceof Error?H.message:String(H)),R(!1)}}const V=(i==null?void 0:i.map(M=>M.slug))??[],U=(a==null?void 0:a.workspaces)??[],I=(a==null?void 0:a.hasUngrouped)??!1;return s.jsx(Mn,{open:t,onOpenChange:M=>{M||r()},children:s.jsx(Nn,{className:"max-w-md",children:s.jsxs("form",{onSubmit:_,children:[s.jsx(sr,{children:s.jsx(Cn,{children:o})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Window"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:sm.map(M=>s.jsx("button",{type:"button",onClick:()=>f(M),className:"rounded px-2.5 py-1 text-sm border "+(M===u?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:t9[M]},M))})]}),u==="custom"?s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Since"}),s.jsx("input",{type:"date",value:p,onChange:M=>h(M.target.value),className:xl})]}),s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Until"}),s.jsx("input",{type:"date",value:g,onChange:M=>y(M.target.value),className:xl})]})]}):null,s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),s.jsxs("select",{value:b,onChange:M=>{j(M.target.value),M.target.value&&v("")},className:xl,children:[s.jsx("option",{value:"",children:"All workspaces"}),I?s.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,U.map(M=>s.jsx("option",{value:M,children:M},M))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Project"}),s.jsxs("select",{value:k,onChange:M=>{v(M.target.value),M.target.value&&j("")},className:xl,children:[s.jsx("option",{value:"",children:"All projects"}),V.map(M=>s.jsx("option",{value:M,children:M},M))]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Model"}),s.jsxs("select",{value:N,onChange:M=>S(M.target.value),className:xl,children:[s.jsx("option",{value:"",children:"All models"}),((l==null?void 0:l.models)??[]).map(M=>s.jsx("option",{value:M,children:M},M))]})]}),s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Tool"}),s.jsxs("select",{value:C,onChange:M=>D(M.target.value),className:xl,children:[s.jsx("option",{value:"",children:"All tools"}),((l==null?void 0:l.tools)??[]).map(M=>s.jsx("option",{value:M,children:M},M))]})]})]}),$?s.jsx("p",{className:"text-xs text-destructive",role:"alert",children:$}):null]}),s.jsxs(Wr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:r,disabled:T,className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:T,className:"shell-action shell-action--cta",children:T?"Saving…":"Save"})]})]})})})}const qw={"saved-view":{title:"Saved view",icon:m2,render:(e,t)=>e.kind!=="saved-view"?null:m.createElement(RH,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Xh,render:(e,t)=>e.kind!=="agent-sessions"?null:m.createElement(QH,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:zv,render:()=>m.createElement(ZH)},"token-usage":{title:"Token Usage",icon:pO,render:e=>e.kind!=="token-usage"?null:m.createElement(IS,{filters:e.filters,metric:"tokens"}),ConfigEditor:MS},spend:{title:"Spend",icon:tm,render:e=>e.kind!=="spend"?null:m.createElement(IS,{filters:e.filters,metric:"cost"}),ConfigEditor:MS}},tP=50,Yb=16,r9=2,ua=6,Ch=11,Xb={w:6,h:2};function Gp(e,t,n){return Math.min(Math.max(e,t),n)}const s9=[{minWidth:1280,columns:24},{minWidth:1024,columns:16},{minWidth:768,columns:12},{minWidth:640,columns:6},{minWidth:0,columns:1}];function o9(e){if(!Number.isFinite(e)||e<0)return 1;for(const t of s9)if(e>=t.minWidth)return t.columns;return 1}function Yp(e,t){return t<=0?1:Gp(Math.round(e/ad*t),1,t)}function Qb(e){if(h7(e))return e;switch(e){case"small":return{w:8,h:ua};case"wide":return{w:16,h:ua};case"tall":return{w:8,h:Ch};case"large":return{w:16,h:Ch};default:return{w:8,h:ua}}}function i9(e,t){return t>0?Math.round(e/t):0}function a9(e,t=tP){return Math.round(e/t)}const l9=[{label:"Third",w:8,h:ua},{label:"Half",w:12,h:ua},{label:"Two-thirds",w:16,h:ua},{label:"Full",w:24,h:ua},{label:"Half tall",w:12,h:Ch},{label:"Full tall",w:24,h:Ch}];function c9({slot:e,activeColumns:t,colWidthPx:n,onReplace:r,onRemove:o,onRemoveSlot:i,onResize:a,onConfigChange:l}){const[u,f]=m.useState(!1),[p,h]=m.useState(null),g=m.useRef(null),{attributes:y,listeners:k,setNodeRef:v,setActivatorNodeRef:b,transform:j,transition:N,isDragging:S}=Cm({id:e.id}),C=Qb(e.size),D=p?p.renderW:Yp(C.w,t),T=p?p.h:C.h,R={transform:js.Translate.toString(j),transition:N,zIndex:S?50:void 0,position:S?"relative":void 0,gridColumn:`span ${D}`,gridRow:`span ${T}`};function $(B){g.current=null;try{B.currentTarget.releasePointerCapture(B.pointerId)}catch{}h(null)}function P(B){return{onPointerDown:W=>{if(g.current)return;W.preventDefault(),W.stopPropagation(),W.currentTarget.setPointerCapture(W.pointerId);const O=Yp(C.w,t);g.current={pointerId:W.pointerId,startX:W.clientX,startY:W.clientY,startRenderW:O,startH:C.h,axis:B,lastRenderW:O,lastH:C.h},h({renderW:O,h:C.h})},onPointerMove:W=>{const O=g.current;if(!O||W.pointerId!==O.pointerId)return;let H=O.startRenderW,L=O.startH;(O.axis==="w"||O.axis==="both")&&(H=Gp(O.startRenderW+i9(W.clientX-O.startX,n),1,t)),(O.axis==="h"||O.axis==="both")&&(L=Gp(O.startH+a9(W.clientY-O.startY),r9,GR)),O.lastRenderW=H,O.lastH=L,h({renderW:H,h:L})},onPointerUp:W=>{const O=g.current;if(!O||W.pointerId!==O.pointerId)return;const H=Qb(e.size),z={w:O.axis==="h"?H.w:Gp(Math.round(O.lastRenderW/t*ad),1,ad),h:O.lastH};$(W),(z.w!==H.w||z.h!==H.h)&&a(z)},onPointerCancel:W=>{const O=g.current;O&&W.pointerId===O.pointerId&&$(W)},onLostPointerCapture:W=>{const O=g.current;O&&W.pointerId===O.pointerId&&$(W)}}}const F="absolute z-10 touch-none rounded-sm bg-transparent transition hover:bg-primary/30",_=s.jsxs(s.Fragment,{children:[t>1?s.jsx("div",{"aria-hidden":"true",className:je(F,"right-0 top-0 h-full w-1.5 cursor-ew-resize"),...P("w")}):null,s.jsx("div",{"aria-hidden":"true",className:je(F,"bottom-0 left-0 h-1.5 w-full cursor-ns-resize"),...P("h")}),t>1?s.jsx("div",{"aria-hidden":"true",className:je(F,"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"),...P("both")}):null]}),V=s.jsx("button",{ref:b,...y,...k,type:"button","aria-label":"Drag to reorder widget",className:"touch-none cursor-grab text-muted-foreground/40 transition hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:cursor-grabbing",children:s.jsx(gc,{className:"h-4 w-4","aria-hidden":"true"})});if(e.widget===null)return s.jsxs("div",{ref:v,style:{...R,gridColumn:`span ${Yp(Xb.w,t)}`,gridRow:`span ${Xb.h}`},className:je("relative flex items-center justify-center rounded-lg border border-dashed border-border bg-card/40 p-3 shadow-sm transition-colors hover:border-primary/40 hover:bg-card/60",S&&"opacity-0"),children:[s.jsx("div",{className:"absolute left-2 top-2",children:V}),s.jsx("button",{type:"button","aria-label":"Remove slot",onClick:i,onPointerDown:B=>B.stopPropagation(),className:"absolute right-2 top-2 z-10 text-muted-foreground/50 transition hover:text-destructive",children:s.jsx(jn,{className:"h-4 w-4"})}),s.jsxs("button",{type:"button",onClick:r,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(Mt,{className:"h-4 w-4"}),"Add widget"]})]});const U=qw[e.widget.kind];if(!U)return s.jsxs("div",{ref:v,style:R,className:je("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",S&&"opacity-0"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[V,s.jsxs("div",{className:"flex-1 rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})]}),_]});const I=U.icon,M=U.ConfigEditor;return s.jsxs("div",{ref:v,style:R,className:je("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",S&&"opacity-0"),children:[s.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[V,s.jsx(I,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:s.jsx(d9,{slot:e,fallback:U.title})})]}),s.jsx(Hw,{items:[{key:"replace",label:"Replace…",icon:NO,onSelect:r},...U.ConfigEditor?[{key:"configure",label:"Configure…",icon:PO,onSelect:()=>f(!0)}]:[],{key:"size",label:"Size",icon:wO,submenu:l9.map(B=>({key:`size-${B.label}`,label:B.label,active:C.w===B.w&&C.h===B.h,onSelect:()=>a({w:B.w,h:B.h})}))},{key:"remove",label:"Remove",icon:jn,destructive:!0,onSelect:o}]})]}),s.jsx("div",{children:U.render(e.widget,{slotId:e.id,onPickAnother:r})}),M?s.jsx(M,{config:e.widget,open:u,onSave:async B=>{await l(B),f(!1)},onCancel:()=>f(!1)}):null,_]})}function u9({slot:e,activeColumns:t,colWidthPx:n}){const r=e.widget?qw[e.widget.kind]:null,o=r==null?void 0:r.icon,i=e.widget===null?"Empty widget slot":(r==null?void 0:r.title)??`Unknown widget kind: ${e.widget.kind}`,a=e.widget===null?Xb:Qb(e.size),l=Yp(a.w,t),u=n>0?l*n+(l-1)*Yb:void 0;return s.jsx("div",{"aria-hidden":"true",className:"min-w-[200px] rounded-lg border border-border/70 bg-card/95 p-3 shadow-xl ring-1 ring-foreground/10",style:{width:u?`${Math.max(u,200)}px`:void 0},children:s.jsxs("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[s.jsx(gc,{className:"h-4 w-4","aria-hidden":"true"}),o?s.jsx(o,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null,s.jsx("span",{className:"min-w-0 flex-1 truncate",children:i})]})})}function d9({slot:e,fallback:t}){var o,i;const n=((o=e.widget)==null?void 0:o.kind)==="saved-view"?e.widget.viewId:null,{view:r}=ki(n);return((i=e.widget)==null?void 0:i.kind)==="saved-view"&&r?s.jsx(s.Fragment,{children:r.name}):s.jsx(s.Fragment,{children:t})}const f9=["agent-sessions","inventories","token-usage","spend"];function p9({open:e,onOpenChange:t,onSelect:n}){const{views:r,loading:o}=zd();function i(a){n(a),t(!1)}return s.jsx(Mn,{open:e,onOpenChange:t,children:s.jsxs(Nn,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsx(Cn,{children:"Add a widget"}),s.jsx(ns,{children:"Choose a built-in widget, an assignment view, or a session view."})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:f9.map(a=>{const l=qw[a],u=l.icon;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:a}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx(u,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),s.jsx("span",{className:"font-medium text-foreground",children:l.title})]})},a)})})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),o?s.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):r.length===0?s.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",s.jsx(De,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):s.jsxs("div",{className:"space-y-3",children:[r.some(a=>a.entityType!=="session")&&s.jsxs("div",{children:[s.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Assignments"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:r.filter(a=>a.entityType!=="session").map(a=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:"saved-view",viewId:a.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:a.name}),a.workspace!==null?s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${a.workspace}`,children:a.workspace}):null,s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:a.config.viewMode})]})},a.id))})]}),r.some(a=>a.entityType==="session")&&s.jsxs("div",{children:[s.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Sessions"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:r.filter(a=>a.entityType==="session").map(a=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:"agent-sessions",viewId:a.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:a.name}),a.workspace!==null?s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${a.workspace}`,children:a.workspace}):null]})},a.id))})]})]}),!o&&r.some(a=>a.workspace!==null)?s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}const h9=(e,{currentCoordinates:t,context:n})=>{var h;const r=e.code==="ArrowRight"||e.code==="ArrowDown"?1:e.code==="ArrowLeft"||e.code==="ArrowUp"?-1:0;if(r===0)return;e.preventDefault();const o=n.over??n.active,i=(h=o==null?void 0:o.data.current)==null?void 0:h.sortable,a=i==null?void 0:i.items;if(!o||!a)return t;const l=a.indexOf(o.id);if(l===-1)return t;const u=a[l+r],f=u===void 0?null:n.droppableRects.get(u),p=n.collisionRect;return!f||!p?t:{x:f.left+(f.width-p.width)/2,y:f.top+(f.height-p.height)/2}};function m9(e){const t=new Set(e.map(o=>o.id));let n=-1;for(const o of t){const i=/^slot-(\d+)$/.exec(o);if(i){const a=parseInt(i[1],10);a>n&&(n=a)}}let r=n+1;for(;t.has(`slot-${r}`);)r++;return`slot-${r}`}function g9(e,t){const n={id:m9(e),widget:null};return[...e,n]}function x9(e,t){return e.filter(n=>n.id!==t)}function y9(){const{data:e,error:t,refetch:n}=O4(),{data:r}=U2(),{layout:o}=nA(),[i,a]=m.useState(!1),[l,u]=m.useState(null),[f,p]=m.useState(null),[h,g]=m.useState(o.slots),[y,k]=m.useState(null),v=m.useRef(null),[b,j]=m.useState(ad),[N,S]=m.useState(0);m.useEffect(()=>{const W=v.current;if(!W)return;const O=new ResizeObserver(H=>{for(const L of H){const z=L.contentRect.width,Y=o9(z),q=Y>0?(z-(Y-1)*Yb)/Y:0;j(Y),S(q)}});return O.observe(W),()=>O.disconnect()},[]),m.useEffect(()=>{g(o.slots)},[o.slots]);const C=bm(ji(kc,{activationConstraint:{distance:8}}),ji(jc,{coordinateGetter:h9}));Ai("list:overview"),en({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const D=m.useCallback(W=>{u(W),a(!0)},[]),T=m.useCallback(async(W,O)=>{p(null),g(W);try{await Fb(W)}catch(H){g(O),p(H instanceof Error?H.message:String(H))}},[]),R=m.useCallback(W=>{if(l===null)return;const O=h.map((H,L)=>L===l?{...H,widget:W}:H);u(null),T(O,h)},[h,l,T]),$=m.useCallback(W=>{const O=h.map((H,L)=>L===W?{...H,widget:null,size:void 0}:H);T(O,h)},[h,T]),P=m.useCallback(W=>{const O=x9(h,W);T(O,h)},[h,T]),F=m.useCallback(()=>{const W=g9(h);T(W,h)},[h,T]),_=m.useCallback((W,O)=>{const H=h.map((L,z)=>z===W?{...L,size:O}:L);T(H,h)},[h,T]),V=m.useCallback(W=>{const{active:O,over:H}=W;if(k(null),!H||O.id===H.id)return;const L=h.findIndex(q=>q.id===O.id),z=h.findIndex(q=>q.id===H.id);if(L===-1||z===-1)return;const Y=Sc(h,L,z);T(Y,h)},[h,T]),U=m.useCallback(W=>{k(String(W.active.id))},[]),I=h.find(W=>W.id===y)??null,M=m.useCallback(async(W,O)=>{const H=h,L=h.map((z,Y)=>Y===W?{...z,widget:O}:z);p(null),g(L);try{await Fb(L)}catch(z){g(H);const Y=z instanceof Error?z.message:String(z);throw p(Y),z instanceof Error?z:new Error(Y)}},[h]),B={};if(e)for(const W of Object.keys(e.segments))for(const O of e.segments[W].items)B[O.id]=O;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("header",{className:"space-y-2",children:[s.jsx("p",{className:"eyebrow",children:"Workspace Overview"}),s.jsx("h1",{className:"text-4xl font-semibold tracking-display text-foreground md:text-5xl",children:"What needs you today"})]}),e?s.jsx(f7,{hero:e.hero,itemsById:B}):t?s.jsx(Rt,{error:t,onRetry:n}):s.jsx(bt,{label:"Loading overview…"}),e!=null&&e.firstRun?s.jsx(u7,{help:r}):null,f?s.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Couldn't save dashboard layout: ",f]}):null,s.jsxs(Sm,{sensors:C,collisionDetection:vm,onDragStart:U,onDragCancel:()=>k(null),onDragEnd:V,children:[s.jsx(Nm,{items:h.map(W=>W.id),strategy:Rw,children:s.jsx("div",{ref:v,style:{display:"grid",gridTemplateColumns:`repeat(${b}, minmax(0, 1fr))`,gridAutoRows:`${tP}px`,gridAutoFlow:"dense",gap:`${Yb}px`},children:h.map((W,O)=>s.jsx(c9,{slot:W,index:O,activeColumns:b,colWidthPx:N,onReplace:()=>D(O),onRemove:()=>$(O),onRemoveSlot:()=>P(W.id),onResize:H=>_(O,H),onConfigChange:H=>M(O,H)},W.id))})}),s.jsx(X8,{dropAnimation:null,children:I?s.jsx(u9,{slot:I,activeColumns:b,colWidthPx:N}):null})]}),s.jsxs("button",{type:"button",onClick:F,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(Mt,{className:"h-4 w-4"}),"Add slot"]}),e!=null&&e.serverStats?s.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(Wv,{className:"h-3 w-3","aria-hidden":"true"}),s.jsxs("span",{children:["● ",e.serverStats.totalPorts," ports ·"," ",e.serverStats.deadSessions>0?`${e.serverStats.deadSessions} dead`:"all healthy"]})]}):null,s.jsx(p9,{open:i,onOpenChange:W=>{a(W),W||u(null)},onSelect:R})]})}const b9=["review","blocked","question","plan-approval"],v9={review:"Review",blocked:"Blocked",question:"Questions","plan-approval":"Plan approval"};function w9(e){const t=[];for(const n of b9){const r=e.filter(o=>o.category===n).sort((o,i)=>i.ageMs-o.ageMs);r.length!==0&&t.push({category:n,label:v9[n],count:r.length,items:r})}return t}function j9(e){if(!Number.isFinite(e)||e<0)return"just now";const t=Math.floor(e/1e3);if(t<60)return"just now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function nP(e,t){const n=encodeURIComponent(t);return e.project===null?{method:"POST",url:`/api/assignments/${encodeURIComponent(e.assignmentId)}/transitions/${n}`}:{method:"POST",url:`/api/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}/transitions/${n}`}}function k9(e){return e.project===null?{method:"POST",url:`/api/assignments/${encodeURIComponent(e.assignmentId)}/comments`}:{method:"POST",url:`/api/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}/comments`}}function S9(e,t){const n=encodeURIComponent(t);return e.project===null?{method:"PATCH",url:`/api/assignments/${encodeURIComponent(e.assignmentId)}/comments/${n}/resolved`}:{method:"PATCH",url:`/api/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}/comments/${n}/resolved`}}function Kw(e,t){const n=t?`?tab=${t}`:"";return e.project===null?`/assignments/${encodeURIComponent(e.assignmentId)}${n}`:`/projects/${encodeURIComponent(e.project)}/assignments/${encodeURIComponent(e.assignmentSlug)}${n}`}function N9(){const{items:e,total:t,loading:n,error:r,refetch:o}=QT(),{toast:i,showToast:a,dismissToast:l}=Qn();if(n&&e.length===0)return s.jsx(bt,{label:"Loading your inbox…"});if(r&&e.length===0)return s.jsx(Rt,{title:"Inbox unavailable",error:r,action:s.jsx("button",{type:"button",className:"shell-action",onClick:o,children:"Retry"})});const u=w9(e);return u.length===0?s.jsxs("div",{className:"space-y-4",children:[s.jsx(Xn,{toast:i,onDismiss:l}),s.jsx(OS,{total:0}),s.jsx(St,{title:"Nothing needs you right now",description:"No reviews, blocks, open questions, or plans awaiting approval across your projects. New items appear here the moment something needs a human decision."})]}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(Xn,{toast:i,onDismiss:l}),s.jsx(OS,{total:t}),u.map(f=>s.jsx(qe,{title:f.label,actions:s.jsx("span",{className:"rounded-full bg-foreground px-2.5 py-0.5 text-xs font-semibold text-background",children:f.count}),children:s.jsx("ul",{className:"space-y-3",children:f.items.map(p=>s.jsx(C9,{item:p,onMutated:o,onError:h=>a(h,"error"),onSuccess:h=>a(h,"success")},`${p.category}:${p.assignmentId}:${p.since}`))})},f.category))]})}function OS({total:e}){return s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("span",{className:"inline-flex h-9 w-9 items-center justify-center rounded-lg bg-card text-foreground shadow-sm ring-1 ring-border/60",children:s.jsx(h2,{className:"h-4 w-4"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Needs me"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e===0?"Everything is handled.":`${e} ${e===1?"item":"items"} awaiting your decision.`})]})]})}async function Eh(e,t,n,r){try{const o=await fetch(e.url,{method:e.method,headers:{"Content-Type":"application/json"},body:JSON.stringify(t??{})});if(!o.ok){const i=await o.json().catch(()=>null);throw new Error((i==null?void 0:i.error)||`HTTP ${o.status}`)}return n.onSuccess(r),n.onMutated(),!0}catch(o){return n.onError(o instanceof Error?o.message:String(o)),!1}}function C9({item:e,onMutated:t,onError:n,onSuccess:r}){return s.jsxs("li",{className:"flex flex-col gap-2 rounded-lg border border-border/70 bg-background/40 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[s.jsx(De,{to:Kw(e),className:"text-sm font-semibold text-foreground hover:underline",children:e.title}),s.jsx("span",{className:"text-xs text-muted-foreground",children:e.project?e.project:"standalone"}),s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",title:e.since,children:j9(e.ageMs)})]}),e.summary?s.jsx("p",{className:"text-sm text-muted-foreground",children:e.summary}):null,s.jsx(E9,{item:e,onMutated:t,onError:n,onSuccess:r}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-muted/60 px-2 py-1 font-mono text-[11px] text-muted-foreground",children:e.action.command}),s.jsx(Hr,{value:e.action.command,label:"Copy",onError:o=>n(o.message)})]})]})}function E9(e){switch(e.item.category){case"review":return s.jsx(T9,{...e});case"blocked":return s.jsx(R9,{...e});case"question":return s.jsx(A9,{...e});case"plan-approval":return s.jsx(P9,{...e});default:return null}}const ga="shell-action inline-flex items-center gap-1.5";function T9({item:e,onMutated:t,onError:n,onSuccess:r}){const[o,i]=m.useState(null),{acceptCommand:a,reopenCommand:l}=e;async function u(f,p){i(f),await Eh(nP(e,f),void 0,{onMutated:t,onError:n,onSuccess:r},`${p} — ${e.title}`),i(null)}return s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a?s.jsxs("button",{type:"button",className:ga,disabled:o!==null,onClick:()=>u(a,"Accepted"),children:[s.jsx(Sr,{className:"h-3.5 w-3.5"}),o===a?"Accepting…":"Accept"]}):null,l?s.jsxs("button",{type:"button",className:ga,disabled:o!==null,onClick:()=>u(l,"Reopened"),children:[s.jsx(vs,{className:"h-3.5 w-3.5"}),o===l?"Reopening…":"Reopen"]}):null]})}function R9({item:e,onMutated:t,onError:n,onSuccess:r}){const[o,i]=m.useState(""),[a,l]=m.useState(!1);async function u(){l(!0);const f=await Eh(nP(e,"unblock"),o.trim()?{reason:o.trim()}:void 0,{onMutated:t,onError:n,onSuccess:r},`Unblocked — ${e.title}`);l(!1),f&&i("")}return s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("input",{type:"text",value:o,onChange:f=>i(f.target.value),placeholder:"Reason (optional)",className:"min-w-[12rem] flex-1 rounded border border-border bg-background px-2 py-1 text-sm"}),s.jsxs("button",{type:"button",className:ga,disabled:a,onClick:u,children:[s.jsx(vO,{className:"h-3.5 w-3.5"}),a?"Unblocking…":"Unblock"]})]})}function A9({item:e,onMutated:t,onError:n,onSuccess:r}){const[o,i]=m.useState(""),[a,l]=m.useState(!1),u=e.commentId;async function f(){if(!o.trim())return;l(!0);const h=await Eh(k9(e),{body:o.trim(),type:"note",author:"human",...u?{replyTo:u}:{}},{onMutated:t,onError:n,onSuccess:r},`Replied — ${e.title}`);l(!1),h&&i("")}async function p(){if(!u){n("Could not determine which question to resolve — open the assignment to resolve it.");return}l(!0),await Eh({...S9(e,u)},{resolved:!0},{onMutated:t,onError:n,onSuccess:r},`Resolved — ${e.title}`),l(!1)}return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(De,{to:Kw(e,"comments"),className:ga,children:[s.jsx(Zh,{className:"h-3.5 w-3.5"}),"Open to answer"]}),s.jsxs("button",{type:"button",className:ga,disabled:a||!u,title:u?void 0:"Open the assignment to resolve this question.",onClick:p,children:[s.jsx(em,{className:"h-3.5 w-3.5"}),"Resolve"]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("input",{type:"text",value:o,onChange:h=>i(h.target.value),placeholder:"Reply inline…",className:"min-w-[12rem] flex-1 rounded border border-border bg-background px-2 py-1 text-sm"}),s.jsxs("button",{type:"button",className:ga,disabled:a||!o.trim(),onClick:f,children:[s.jsx(d2,{className:"h-3.5 w-3.5"}),a?"Posting…":"Reply"]})]})]})}function P9({item:e}){return s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s.jsxs(De,{to:Kw(e,"plan"),className:ga,children:[s.jsx(Zh,{className:"h-3.5 w-3.5"}),"Review plan"]})})}function _9({term:e,description:t}){return s.jsx("span",{title:t,className:"cursor-help rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-foreground underline decoration-dotted underline-offset-4",children:e})}function D9(){const{data:e,loading:t,error:n}=U2(),{openCheatsheet:r}=Ri();return t?s.jsx(bt,{label:"Loading help…"}):n||!e?s.jsx(Rt,{error:n||"Help content is unavailable."}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(qe,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center gap-2 rounded-md border border-border/70 bg-background/80 px-3 py-1.5 text-sm font-medium text-foreground hover:bg-accent",children:"Open shortcuts cheatsheet"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",s.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",Qs("Mod+k")," opens the command palette."]})]})}),s.jsx(qe,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:s.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(o=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:o},o))})}),s.jsx(qe,{title:"Getting Started",children:s.jsx("div",{className:"space-y-3",children:e.workflow.map((o,i)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?s.jsx(Vp,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?s.jsx(De,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsxs(qe,{title:"Core Concepts",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>s.jsx(_9,{term:o.term,description:o.description},o.term))}),s.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.term}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.term))})]}),s.jsx(qe,{title:"Status Guide",children:s.jsx("div",{className:"space-y-3",children:e.statusGuide.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(kn,{status:o.status}),s.jsx("p",{className:"font-semibold text-foreground",children:o.meaning})]}),s.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:o.useWhen})]},o.status))})})]}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsx(qe,{title:"Ownership And File Rules",children:s.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.files.map(i=>s.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:i},i))})]},o.label))})}),s.jsx(qe,{title:"How To Navigate The Dashboard",children:s.jsx("div",{className:"space-y-3",children:e.navigation.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),s.jsx(De,{className:"text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open"})]}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.label))})})]}),s.jsx(qe,{title:"CLI Quick Reference",children:s.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(o=>s.jsx(Vp,{command:o.command,description:o.description,example:o.example},o.command))})}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsx(qe,{title:"FAQ",children:s.jsx("div",{className:"space-y-3",children:e.faq.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.question}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.answer})]},o.question))})}),s.jsx(qe,{title:"First Project Checklist",children:s.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((o,i)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?s.jsx(Vp,{command:o.command.command,example:o.command.example}):null,o.href?s.jsx(De,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function Gw({children:e}){return s.jsx("div",{className:"chrome-card flex flex-col gap-2 !p-2.5 md:flex-row md:flex-wrap md:items-center",children:e})}const Fm=m.forwardRef(({value:e,onChange:t,placeholder:n="Search"},r)=>s.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[s.jsx(Ci,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),s.jsx("input",{ref:r,value:e,onChange:o=>t(o.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));Fm.displayName="SearchInput";function zm({value:e,options:t,onChange:n}){return s.jsx("div",{className:"inline-flex rounded-md border border-border/60 bg-background/80 p-1",children:t.map(r=>s.jsx("button",{type:"button","aria-pressed":e===r.value,onClick:()=>n(r.value),className:je("rounded-sm px-2.5 py-1.5 text-sm font-medium transition",e===r.value?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:r.label},r.value))})}const $9={completed:"bg-status-completed-foreground",in_progress:"bg-status-in-progress-foreground",review:"bg-status-review-foreground",blocked:"bg-status-blocked-foreground",failed:"bg-status-failed-foreground",pending:"bg-status-pending-foreground"},FS=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function Th({progress:e,className:t,showLegend:n=!1}){const r=As(),i=m.useMemo(()=>{let a=0;const l=Object.keys(e).filter(f=>f!=="total");return(r.order.length>0?[...r.order,...l.filter(f=>!r.order.includes(f))]:l).map(f=>({key:f,className:$9[f]??FS[a++%FS.length]}))},[r.order,e]).filter(a=>(e[a.key]??0)>0);return s.jsxs("div",{className:je("space-y-2",t),children:[s.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?s.jsx("div",{className:"h-full w-full bg-muted"}):i.map(a=>s.jsx("div",{className:a.className,style:{width:`${(e[a.key]??0)/e.total*100}%`},title:`${bn(a.key)}: ${e[a.key]??0}`},a.key))}),n?i.length>0?s.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:i.map(a=>s.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[s.jsx("span",{className:je("h-2 w-2 rounded-full",a.className)}),s.jsx("span",{children:bn(a.key)}),s.jsx("span",{className:"font-medium text-foreground",children:e[a.key]??0})]},a.key))}):s.jsx("p",{className:"text-xs text-muted-foreground/70",children:"No assignments yet"}):null]})}const I9=["pending","active","blocked","failed","completed"],Yw=I9,L9=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function rP(e){return e&&e.length>0?e:[...L9]}function M9(e,t,n){if(t<0||t>=e.length)return e;const r=[...e],[o]=r.splice(t,1),i=t<n?n-1:n;return r.splice(Math.max(0,Math.min(i,r.length)),0,o),r}const O9=220,hp=8;function sP({anchor:e,items:t,onClose:n}){const r=m.useRef(null),[o,i]=m.useState(null);return m.useLayoutEffect(()=>{if(!e){i(null);return}const a=r.current,l=(a==null?void 0:a.offsetWidth)??O9,u=(a==null?void 0:a.offsetHeight)??0,f=Math.max(hp,window.innerWidth-l-hp),p=Math.max(hp,window.innerHeight-u-hp);i({left:Math.min(e.x,f),top:Math.min(e.y,p)})},[e]),m.useEffect(()=>{if(!e)return;function a(f){r.current&&!r.current.contains(f.target)&&n()}function l(f){f.key==="Escape"&&n()}function u(){n()}return document.addEventListener("mousedown",a),document.addEventListener("keydown",l),document.addEventListener("contextmenu",a),window.addEventListener("scroll",u,!0),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",l),document.removeEventListener("contextmenu",a),window.removeEventListener("scroll",u,!0)}},[e,n]),!e||t.length===0?null:s.jsx("div",{ref:r,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(o==null?void 0:o.left)??e.x,top:(o==null?void 0:o.top)??e.y,visibility:o?"visible":"hidden"},children:s.jsx(ha,{delayDuration:200,children:t.map(a=>{const l=a.icon,u=je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",a.disabled?"cursor-not-allowed opacity-50":a.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),f=s.jsxs(s.Fragment,{children:[l?s.jsx(l,{className:"h-4 w-4 shrink-0"}):null,s.jsx("span",{className:"block min-w-0 truncate",children:a.label})]});if(a.disabled){const p=s.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:s.jsx("button",{type:"button",disabled:!0,className:u,children:f})});return a.disabledReason?s.jsxs(Or,{children:[s.jsx(Fr,{asChild:!0,children:p}),s.jsx(vr,{side:"left",children:a.disabledReason})]},a.key):s.jsx("div",{children:p},a.key)}return a.href?s.jsx(De,{to:a.href,className:u,onClick:()=>n(),children:f},a.key):s.jsx("button",{type:"button",className:u,onClick:()=>{var p;(p=a.onSelect)==null||p.call(a),n()},children:f},a.key)})})})}const F9="__ungrouped__";function Xw({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:r,title:o="Move to workspace",description:i="Pick the workspace this item should belong to."}){const{data:a,loading:l}=Ea(),[u,f]=m.useState(n),[p,h]=m.useState(!1),[g,y]=m.useState(null);m.useEffect(()=>{e&&(f(n),y(null))},[e,n]);const k=m.useMemo(()=>[...((a==null?void 0:a.workspaces)??[]).map(N=>({key:N,label:N,value:N})),{key:F9,label:"Ungrouped",value:null}],[a]),v=!p&&u!==n;async function b(){if(v){h(!0),y(null);try{await r(u),t(!1)}catch(j){y(j instanceof Error?j.message:"Failed to move item")}finally{h(!1)}}}return s.jsx(Mn,{open:e,onOpenChange:j=>p?void 0:t(j),children:s.jsxs(Nn,{children:[s.jsxs(sr,{children:[s.jsx(Cn,{children:o}),s.jsx(ns,{children:i})]}),s.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:l&&k.length===0?s.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[s.jsx(Vv,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):k.map(j=>{const N=j.value===n,S=j.value===u;return s.jsxs("button",{type:"button",disabled:N||p,onClick:()=>f(j.value),className:je("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",N?"cursor-not-allowed bg-foreground/5 text-muted-foreground":S?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[s.jsxs("span",{className:je("block min-w-0 truncate",j.value===null?"italic text-muted-foreground":""),children:[j.label,N?s.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),S?s.jsx(Sr,{className:"h-4 w-4 text-foreground"}):null]},j.key)})}),g?s.jsx("p",{className:"text-sm text-destructive",role:"alert",children:g}):null,s.jsxs(Wr,{children:[s.jsx("button",{type:"button",onClick:()=>t(!1),disabled:p,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",onClick:b,disabled:!v,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:p?"Moving…":"Move"})]})]})})}function zS(){const{workspace:e}=qt(),t=mn(),n=Wt(),{data:r,loading:o,error:i,refetch:a}=to(),{toast:l,showToast:u,dismissToast:f}=Qn(),p=m.useRef(null);Ai("list:projects");const[h,g]=m.useState(""),[y,k]=m.useState("all"),[v,b]=m.useState("all"),[j,N]=m.useState("updated"),[S,C]=Ts(),D=S.get("view"),T=D==="table"||D==="kanban"?D:"cards",R=z=>{C(Y=>{const q=new URLSearchParams(Y);return z==="cards"?q.delete("view"):q.set("view",z),q})},[$,P]=m.useState({}),[F,_]=m.useState(null),[V,U]=m.useState(null),I=m.useMemo(()=>r?r.filter(z=>{if(e){if(e==="_ungrouped"){if(z.workspace!==null)return!1}else if(z.workspace!==e)return!1}return y!=="all"&&z.status!==y||v!=="all"&&!z.tags.includes(v)?!1:h.trim()?`${z.title} ${z.tags.join(" ")} ${z.slug}`.toLowerCase().includes(h.toLowerCase()):!0}).sort((z,Y)=>B9(z,Y,j)):[],[r,h,y,v,j,e]),M=I.map(z=>`${z.slug}:${z.status}`).join("|");m.useEffect(()=>{P(U9(I))},[M,j]);const B=m.useMemo(()=>{const z=new Map(I.map(Y=>[Y.slug,Y]));return Yw.flatMap(Y=>($[Y]??I.filter(Q=>Q.status===Y).map(Q=>Q.slug)).map(Q=>z.get(Q)).filter(Q=>!!Q))},[I,$]),{visibleItems:W,visibleIndexByKey:O}=m.useMemo(()=>{const z=T==="kanban"?B:I,Y=new Map;return z.forEach((q,Q)=>Y.set(q.slug,Q)),{visibleItems:z,visibleIndexByKey:Y}},[T,I,B]),{hotkeyRowProps:H}=Id(W,{scope:"list:projects",onOpen:z=>n(`${t}/projects/${z.slug}`)});if(en({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var z;return(z=p.current)==null?void 0:z.focus()}}),en({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>a()}),o)return s.jsx(bt,{label:"Loading projects…"});if(i||!r)return s.jsx(Rt,{error:i||"Project list is unavailable.",onRetry:a});const L=Array.from(new Set(r.flatMap(z=>z.tags))).sort();return s.jsxs("div",{className:"space-y-5",children:[s.jsx(Xn,{toast:l,onDismiss:f}),s.jsxs(Gw,{children:[s.jsx(Fm,{ref:p,value:h,onChange:g,placeholder:"Search by project title or tag"}),s.jsxs("select",{value:y,onChange:z=>k(z.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All statuses"}),s.jsx("option",{value:"pending",children:"Pending"}),s.jsx("option",{value:"active",children:"Active"}),s.jsx("option",{value:"blocked",children:"Blocked"}),s.jsx("option",{value:"failed",children:"Failed"}),s.jsx("option",{value:"completed",children:"Completed"})]}),s.jsxs("select",{value:v,onChange:z=>b(z.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All tags"}),L.map(z=>s.jsx("option",{value:z,children:z},z))]}),s.jsxs("select",{value:j,onChange:z=>N(z.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"updated",children:"Sort: Updated"}),s.jsx("option",{value:"created",children:"Sort: Created"}),s.jsx("option",{value:"title",children:"Sort: Title"}),s.jsx("option",{value:"attention",children:"Sort: Attention"})]}),s.jsx(zm,{value:T,onChange:z=>R(z),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),I.length===0?r.length===0?s.jsxs("div",{className:"rounded-frame border border-border/60 bg-card px-6 py-16 text-center",children:[s.jsx("p",{className:"eyebrow mx-auto justify-center",children:"Start here"}),s.jsx("h2",{className:"mx-auto mt-4 max-w-2xl text-3xl font-semibold tracking-display text-foreground md:text-4xl",children:"The task manager built for agents, by agents"}),s.jsx("p",{className:"mx-auto mt-3 max-w-xl text-sm leading-6 text-muted-foreground",children:"A project groups assignments, resources, and memories under one objective. Markdown stays authoritative — the dashboard is just a view."}),s.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[s.jsx(De,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),s.jsx(De,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):s.jsx(St,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:s.jsx(De,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):T==="cards"?s.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:I.map((z,Y)=>s.jsxs(De,{to:`${t}/projects/${z.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...H(Y),children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:z.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Yn(z.updated)]})]}),s.jsx(kn,{status:z.status})]}),s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsx(Th,{progress:z.progress,showLegend:!0}),s.jsx("div",{className:"flex flex-wrap gap-2",children:z.tags.map(q=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:q},q))}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),s.jsx("p",{className:"mt-1 font-semibold text-foreground",children:z.needsAttention.blockedCount+z.needsAttention.failedCount})]}),s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("p",{className:"text-muted-foreground",children:"Assignments"}),s.jsx("p",{className:"mt-1 font-semibold text-foreground",children:z.progress.total})]})]})]})]},z.slug))}):T==="table"?s.jsx(qe,{title:`${I.length} project${I.length===1?"":"s"}`,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[s.jsx("th",{className:"pb-3 font-medium",children:"Project"}),s.jsx("th",{className:"pb-3 font-medium",children:"Status"}),s.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),s.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),s.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),s.jsx("tbody",{children:I.map((z,Y)=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",...H(Y),children:[s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx(De,{to:`${t}/projects/${z.slug}`,className:"font-semibold text-foreground hover:text-primary",children:z.title}),s.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:z.tags.map(q=>s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:q},q))})]}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx(kn,{status:z.status})}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx("div",{className:"min-w-[220px]",children:s.jsx(Th,{progress:z.progress})})}),s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:z.needsAttention.blockedCount+z.needsAttention.failedCount}),s.jsx("td",{className:"py-4 text-muted-foreground",children:Yn(z.updated)})]},z.slug))})]})})}):s.jsx(Lm,{columns:BS,items:B,getItemId:z=>z.slug,getColumnId:z=>z.status,canDrop:({fromColumnId:z,toColumnId:Y})=>({allowed:!0,reason:z===Y?void 0:"This will set a manual status override on the project."}),onMove:async({item:z,fromColumnId:Y,toColumnId:q,fromIndex:Q,toIndex:ee})=>{var Z;if(Y===q){const ie=$[Y]??I.filter(ne=>ne.status===Y).map(ne=>ne.slug);P(ne=>({...ne,[Y]:M9(ie,Q,ee)}));return}try{const ie=await fetch(`/api/projects/${z.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:q})});if(!ie.ok){const ue=await ie.json().catch(()=>null);u((ue==null?void 0:ue.error)||`HTTP ${ie.status}`,"error");return}a();const ne=((Z=BS.find(ue=>ue.id===q))==null?void 0:Z.title)??q;u(`Moved "${z.title}" to ${ne}`,"success")}catch(ie){u(ie instanceof Error?ie.message:"Failed to move project","error")}},getExternalDragData:z=>({type:"project",id:z.slug}),onCardContextMenu:(z,Y)=>{Y.preventDefault(),_({project:z,anchor:{x:Y.clientX,y:Y.clientY}})},emptyMessage:z=>`No ${z.title.toLowerCase()} projects.`,renderCard:(z,{dragging:Y})=>{const q=O.get(z.slug)??-1;return s.jsx("div",{...q>=0?H(q):{},children:s.jsx(H9,{project:z,dragging:Y})})}}),s.jsx(sP,{anchor:(F==null?void 0:F.anchor)??null,items:F?[{key:"edit",label:"Edit",icon:xc,onSelect:()=>n(`${t}/projects/${F.project.slug}`)},{key:"move",label:"Move to workspace…",icon:Jh,onSelect:()=>U(F.project)}]:[],onClose:()=>_(null)}),s.jsx(Xw,{open:V!==null,onOpenChange:z=>{z||U(null)},currentWorkspace:(V==null?void 0:V.workspace)??null,title:"Move project to workspace",onSubmit:async z=>{if(!V)return;const Y=await fetch(`/api/projects/${encodeURIComponent(V.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:z})});if(!Y.ok){const q=await Y.json().catch(()=>({}));throw new Error(q.error||"Failed to move project")}a()}}),s.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Hv,{className:"mt-0.5 h-4 w-4"}),s.jsxs("p",{children:["Project status is derived from assignment state by default.",T==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const z9={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},BS=Yw.map(e=>({id:e,title:z9[e],description:Vd(e)}));function B9(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return US(t)-US(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function US(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function U9(e){return Object.fromEntries(Yw.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function H9({project:e,dragging:t}){const n=mn();return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(De,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Yn(e.updated)]})]}),s.jsx(kn,{status:e.status})]}),s.jsx("div",{className:"mt-4",children:s.jsx(Th,{progress:e.progress})}),s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.tags.map(r=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:r},r)),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.progress.total," assignments"]}),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.needsAttention.blockedCount+e.needsAttention.failedCount," needs attention"]})]}),s.jsx("div",{className:"mt-4 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:t?"Reordering within status":"Derived project lane"})]})}function Rh({title:e,description:t,actions:n,className:r}){return s.jsxs("div",{className:je("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",r),children:[s.jsxs("div",{className:"space-y-1",children:[e?s.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?s.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?s.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}function V9(){return s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-status-archived-foreground/30 bg-status-archived px-2 py-0.5 text-xs font-medium text-status-archived-foreground",children:[s.jsx(Qh,{className:"h-3 w-3"}),"Archived"]})}function HS(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function W9(){const{data:e,loading:t,error:n,refetch:r}=F4(),[o,i]=m.useState(null),[a,l]=m.useState(null),[u,f]=m.useState({}),{toast:p,showToast:h,dismissToast:g}=Qn();async function y(S,C,D){i(C),l(null);try{const T=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"}});if(!T.ok){const R=await T.json().catch(()=>null);throw new Error((R==null?void 0:R.error)||`HTTP ${T.status}`)}r(),h(D,"success")}catch(T){l(T instanceof Error?T.message:"Restore failed")}finally{i(null)}}function k(S){return y(`/api/projects/${S.slug}/unarchive`,`project:${S.slug}`,"Project restored")}function v(S){const C=S.projectSlug?`/api/projects/${S.projectSlug}/assignments/${S.slug}/unarchive`:`/api/assignments/${S.id}/unarchive`;return y(C,`assignment:${S.id}`,"Assignment restored")}if(t)return s.jsx(bt,{label:"Loading archived content…"});if(n)return s.jsx(Rt,{error:n});const b=(e==null?void 0:e.projects)??[],j=(e==null?void 0:e.assignments)??[],N=b.length===0&&j.length===0;return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Xn,{toast:p,onDismiss:g}),s.jsx(Rh,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),a?s.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:a}):null,N?s.jsx(St,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):s.jsxs(s.Fragment,{children:[b.length>0&&s.jsx(qe,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:s.jsx("ul",{className:"divide-y divide-border",children:b.map(S=>{const C=u[S.slug]??!1;return s.jsxs("li",{className:"py-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("button",{type:"button",onClick:()=>f(D=>({...D,[S.slug]:!C})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":C,children:[C?s.jsx(cr,{className:"h-4 w-4"}):s.jsx(c2,{className:"h-4 w-4"}),s.jsx(Bv,{className:"h-4 w-4 text-muted-foreground"}),S.title,s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",S.assignments.length," assignment",S.assignments.length===1?"":"s",")"]})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",S.archivedAt?Nr(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(De,{to:`/projects/${S.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),s.jsxs("button",{type:"button",onClick:()=>k(S),disabled:o===`project:${S.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[s.jsx(rh,{className:"h-3 w-3"}),"Restore"]})]})]}),C&&S.assignments.length>0&&s.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:S.assignments.map(D=>s.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx(De,{to:HS(D),className:"text-foreground hover:text-foreground/80",children:D.title}),s.jsx(kn,{status:D.status,showIcon:!1}),s.jsx("span",{className:"text-xs text-muted-foreground",children:D.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},D.id))})]},S.slug)})})}),j.length>0&&s.jsx(qe,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:s.jsx("ul",{className:"divide-y divide-border",children:j.map(S=>s.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[s.jsx(De,{to:HS(S),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:S.title}),s.jsx(kn,{status:S.status,showIcon:!1}),s.jsx(V9,{}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[S.projectTitle??"Standalone"," · Archived"," ",S.archivedAt?Nr(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),s.jsxs("button",{type:"button",onClick:()=>v(S),disabled:o===`assignment:${S.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[s.jsx(rh,{className:"h-3 w-3"}),"Restore"]})]},S.id))})})]})]})}const VS="inline-flex max-w-[14rem] items-center gap-1 whitespace-nowrap rounded-full border px-2 py-0.5 text-[11px] font-semibold tracking-wide border-border/60 text-muted-foreground",WS="block min-w-0 truncate";function Qw({externalIds:e,className:t}){return e.length===0?null:s.jsx("span",{className:je("flex flex-wrap items-center gap-1.5",t),children:e.map((n,r)=>{const o=`${n.system}:${n.id}`,i=`${n.system}:${n.id}:${r}`;return n.url!=null&&n.url.length>0?s.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:je(VS,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[s.jsx("span",{className:WS,children:o}),s.jsx(mc,{className:"h-2.5 w-2.5 shrink-0"})]},i):s.jsx("span",{className:VS,title:o,children:s.jsx("span",{className:WS,children:o})},i)})})}const q9={default:"chrome-card",info:"rounded-lg border border-primary/30 bg-primary/5 p-3 dark:border-primary/40 dark:bg-primary/10",warn:"rounded-lg border border-warning-foreground/30 bg-warning p-3",danger:"rounded-lg border border-error-foreground/30 bg-error p-3",success:"rounded-lg border border-success-foreground/30 bg-success p-3"};function Gn({label:e,value:t,description:n,icon:r,tone:o="default",to:i}){const a=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),s.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),r?s.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:s.jsx(r,{className:"h-5 w-5"})}):null]}),n?s.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),f=je(q9[(t===0||t==="0")&&(o==="warn"||o==="danger")?"default":o],i?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return i?s.jsx(De,{to:i,className:f,children:a}):s.jsx("article",{className:f,children:a})}function qS(e){const t=K9(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),u=l.find(Y9);if(u){const f=u.props.children,p=l.map(h=>h===u?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return s.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,p):null})}return s.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function K9(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=Q9(o),l=X9(i,o.props);return o.type!==m.Fragment&&(l.ref=r?fm(r,a):a),m.cloneElement(o,l)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var G9=Symbol("radix.slottable");function Y9(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===G9}function X9(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const u=i(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Q9(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function J9(e){const t=e+"CollectionProvider",[n,r]=Ta(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:b,children:j}=v,N=Lt.useRef(null),S=Lt.useRef(new Map).current;return s.jsx(o,{scope:b,itemMap:S,collectionRef:N,children:j})};a.displayName=t;const l=e+"CollectionSlot",u=qS(l),f=Lt.forwardRef((v,b)=>{const{scope:j,children:N}=v,S=i(l,j),C=nr(b,S.collectionRef);return s.jsx(u,{ref:C,children:N})});f.displayName=l;const p=e+"CollectionItemSlot",h="data-radix-collection-item",g=qS(p),y=Lt.forwardRef((v,b)=>{const{scope:j,children:N,...S}=v,C=Lt.useRef(null),D=nr(b,C),T=i(p,j);return Lt.useEffect(()=>(T.itemMap.set(C,{ref:C,...S}),()=>void T.itemMap.delete(C))),s.jsx(g,{[h]:"",ref:D,children:N})});y.displayName=p;function k(v){const b=i(e+"CollectionConsumer",v);return Lt.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const S=Array.from(N.querySelectorAll(`[${h}]`));return Array.from(b.itemMap.values()).sort((T,R)=>S.indexOf(T.ref.current)-S.indexOf(R.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:f,ItemSlot:y},k,r]}var Z9=m.createContext(void 0);function oP(e){const t=m.useContext(Z9);return e||t||"ltr"}var Ny="rovingFocusGroup.onEntryFocus",eV={bubbles:!1,cancelable:!0},qd="RovingFocusGroup",[Jb,iP,tV]=J9(qd),[nV,aP]=Ta(qd,[tV]),[rV,sV]=nV(qd),lP=m.forwardRef((e,t)=>s.jsx(Jb.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Jb.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(oV,{...e,ref:t})})}));lP.displayName=qd;var oV=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...h}=e,g=m.useRef(null),y=nr(t,g),k=oP(i),[v,b]=pm({prop:a,defaultProp:l??null,onChange:u,caller:qd}),[j,N]=m.useState(!1),S=ba(f),C=iP(n),D=m.useRef(!1),[T,R]=m.useState(0);return m.useEffect(()=>{const $=g.current;if($)return $.addEventListener(Ny,S),()=>$.removeEventListener(Ny,S)},[S]),s.jsx(rV,{scope:n,orientation:r,dir:k,loop:o,currentTabStopId:v,onItemFocus:m.useCallback($=>b($),[b]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>R($=>$+1),[]),onFocusableItemRemove:m.useCallback(()=>R($=>$-1),[]),children:s.jsx(Sn.div,{tabIndex:j||T===0?-1:0,"data-orientation":r,...h,ref:y,style:{outline:"none",...e.style},onMouseDown:sn(e.onMouseDown,()=>{D.current=!0}),onFocus:sn(e.onFocus,$=>{const P=!D.current;if($.target===$.currentTarget&&P&&!j){const F=new CustomEvent(Ny,eV);if($.currentTarget.dispatchEvent(F),!F.defaultPrevented){const _=C().filter(B=>B.focusable),V=_.find(B=>B.active),U=_.find(B=>B.id===v),M=[V,U,..._].filter(Boolean).map(B=>B.ref.current);dP(M,p)}}D.current=!1}),onBlur:sn(e.onBlur,()=>N(!1))})})}),cP="RovingFocusGroupItem",uP=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:a,...l}=e,u=Ml(),f=i||u,p=sV(cP,n),h=p.currentTabStopId===f,g=iP(n),{onFocusableItemAdd:y,onFocusableItemRemove:k,currentTabStopId:v}=p;return m.useEffect(()=>{if(r)return y(),()=>k()},[r,y,k]),s.jsx(Jb.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:s.jsx(Sn.span,{tabIndex:h?0:-1,"data-orientation":p.orientation,...l,ref:t,onMouseDown:sn(e.onMouseDown,b=>{r?p.onItemFocus(f):b.preventDefault()}),onFocus:sn(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:sn(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){p.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const j=lV(b,p.orientation,p.dir);if(j!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let S=g().filter(C=>C.focusable).map(C=>C.ref.current);if(j==="last")S.reverse();else if(j==="prev"||j==="next"){j==="prev"&&S.reverse();const C=S.indexOf(b.currentTarget);S=p.loop?cV(S,C+1):S.slice(C+1)}setTimeout(()=>dP(S))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:v!=null}):a})})});uP.displayName=cP;var iV={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function aV(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function lV(e,t,n){const r=aV(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return iV[r]}function dP(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function cV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var uV=lP,dV=uP,Bm="Tabs",[fV]=Ta(Bm,[aP]),fP=aP(),[pV,Jw]=fV(Bm),pP=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:u="automatic",...f}=e,p=oP(l),[h,g]=pm({prop:r,onChange:o,defaultProp:i??"",caller:Bm});return s.jsx(pV,{scope:n,baseId:Ml(),value:h,onValueChange:g,orientation:a,dir:p,activationMode:u,children:s.jsx(Sn.div,{dir:p,"data-orientation":a,...f,ref:t})})});pP.displayName=Bm;var hP="TabsList",mP=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Jw(hP,n),a=fP(n);return s.jsx(uV,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Sn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});mP.displayName=hP;var gP="TabsTrigger",xP=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,a=Jw(gP,n),l=fP(n),u=vP(a.baseId,r),f=wP(a.baseId,r),p=r===a.value;return s.jsx(dV,{asChild:!0,...l,focusable:!o,active:p,children:s.jsx(Sn.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...i,ref:t,onMouseDown:sn(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?a.onValueChange(r):h.preventDefault()}),onKeyDown:sn(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(r)}),onFocus:sn(e.onFocus,()=>{const h=a.activationMode!=="manual";!p&&!o&&h&&a.onValueChange(r)})})})});xP.displayName=gP;var yP="TabsContent",bP=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...a}=e,l=Jw(yP,n),u=vP(l.baseId,r),f=wP(l.baseId,r),p=r===l.value,h=m.useRef(p);return m.useEffect(()=>{const g=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Ra,{present:o||p,children:({present:g})=>s.jsx(Sn.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:f,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:g&&i})})});bP.displayName=yP;function vP(e,t){return`${e}-trigger-${t}`}function wP(e,t){return`${e}-content-${t}`}var jP=pP,kP=mP,Zb=xP,ev=bP;function Um({value:e,onValueChange:t,items:n,className:r}){const o=m.useRef(null),[i,a]=m.useState(!1),l=m.useCallback(()=>{const u=o.current;u&&a(u.scrollLeft+u.clientWidth<u.scrollWidth-1)},[]);return m.useEffect(()=>{const u=o.current;if(!u)return;l(),u.addEventListener("scroll",l,{passive:!0});const f=new ResizeObserver(l);return f.observe(u),()=>{u.removeEventListener("scroll",l),f.disconnect()}},[l,n.length]),s.jsxs(jP,{value:e,onValueChange:t,className:r,children:[s.jsxs("div",{className:"relative",children:[s.jsx(kP,{ref:o,className:"flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(u=>s.jsxs(Zb,{value:u.value,className:je("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:[s.jsx("span",{children:u.label}),typeof u.count=="number"?s.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:u.count}):null,u.problemCount&&u.problemCount>0?s.jsx("span",{className:"rounded-full bg-destructive/15 px-2 py-0.5 text-xs text-destructive","aria-label":`${u.problemCount} ${u.problemCount===1?"error":"errors"}`,title:`${u.problemCount} ${u.problemCount===1?"error":"errors"}`,children:u.problemCount}):null]},u.value))}),i?s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 w-8 rounded-r-md bg-gradient-to-l from-card to-transparent"}):null]}),n.map(u=>s.jsx(ev,{value:u.value,className:"pt-3",children:u.content},u.value))]})}const hV="modulepreload",mV=function(e){return"/"+e},KS={},gV=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let a=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=a(n.map(f=>{if(f=mV(f),f in KS)return;KS[f]=!0;const p=f.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${h}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":hV,p||(g.as="script"),g.crossOrigin="",g.href=f,u&&g.setAttribute("nonce",u),document.head.appendChild(g),p)return new Promise((y,k)=>{g.addEventListener("load",y),g.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return o.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function xV({definition:e,className:t,nodeRoutes:n={}}){const r=m.useRef(null),[o,i]=m.useState(null),[a,l]=m.useState(!0),u=Wt(),f=document.documentElement.classList.contains("dark")?"dark":"default";return m.useEffect(()=>{let p=!1;async function h(){if(r.current)try{const g=(await gV(async()=>{const{default:v}=await import("./mermaid.core-CAwQaPqG.js").then(b=>b.bs);return{default:v}},[])).default;if(g.initialize({startOnLoad:!1,theme:"base",themeVariables:yV(f==="dark")}),p)return;const y=`mermaid-${Date.now()}`,{svg:k}=await g.render(y,e);if(p||!r.current)return;r.current.innerHTML=k,bV(r.current,n,u),l(!1)}catch(g){p||(i(g instanceof Error?g.message:"Failed to render graph"),l(!1))}}return l(!0),i(null),h(),()=>{p=!0}},[e,u,n,f]),o?s.jsxs("div",{className:je("rounded-lg border border-border bg-card p-4",t),children:[s.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",o]}),s.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):s.jsxs("div",{className:je("rounded-lg border border-border bg-card p-4",t),children:[a&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),s.jsx("div",{ref:r,className:"overflow-auto"})]})}function yV(e){const t=document.documentElement,n=h=>{const g=getComputedStyle(t).getPropertyValue(h).trim();return g?`oklch(${g})`:""},r=n("--card"),o=n("--card-foreground"),i=n("--border"),a=n("--primary"),l=n("--primary-foreground"),u=n("--muted"),f=n("--muted-foreground"),p=n("--secondary");return{background:r,primaryColor:r,primaryTextColor:o,primaryBorderColor:i,secondaryColor:u,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:u,tertiaryTextColor:f,tertiaryBorderColor:i,lineColor:e?f:i,textColor:o,mainBkg:r,nodeBkg:r,nodeTextColor:o,nodeBorder:i,clusterBkg:u,clusterBorder:i,edgeLabelBackground:r,titleColor:o,activeTaskBkgColor:a,activeTaskBorderColor:a,altBackground:u,labelColor:o,errorBkgColor:p,errorTextColor:l}}function bV(e,t,n){var r;for(const o of e.querySelectorAll(".node")){const i=((r=o.textContent)==null?void 0:r.replace(/\s+/g," ").trim())??"",a=t[i];if(!a)continue;o.style.cursor="pointer",o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Open ${i}`);const l=()=>n(a);o.addEventListener("click",l),o.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),l())})}}function vV(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const wV=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jV=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kV={};function GS(e,t){return(kV.jsx?jV:wV).test(e)}const SV=/[ \t\n\f\r]/g;function NV(e){return typeof e=="object"?e.type==="text"?YS(e.value):!1:YS(e)}function YS(e){return e.replace(SV,"")===""}class Kd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Kd.prototype.normal={};Kd.prototype.property={};Kd.prototype.space=void 0;function SP(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Kd(n,r,t)}function tv(e){return e.toLowerCase()}class Cr{constructor(t,n){this.attribute=n,this.property=t}}Cr.prototype.attribute="";Cr.prototype.booleanish=!1;Cr.prototype.boolean=!1;Cr.prototype.commaOrSpaceSeparated=!1;Cr.prototype.commaSeparated=!1;Cr.prototype.defined=!1;Cr.prototype.mustUseProperty=!1;Cr.prototype.number=!1;Cr.prototype.overloadedBoolean=!1;Cr.prototype.property="";Cr.prototype.spaceSeparated=!1;Cr.prototype.space=void 0;let CV=0;const kt=Pa(),yn=Pa(),nv=Pa(),Le=Pa(),Gt=Pa(),Wl=Pa(),$r=Pa();function Pa(){return 2**++CV}const rv=Object.freeze(Object.defineProperty({__proto__:null,boolean:kt,booleanish:yn,commaOrSpaceSeparated:$r,commaSeparated:Wl,number:Le,overloadedBoolean:nv,spaceSeparated:Gt},Symbol.toStringTag,{value:"Module"})),Cy=Object.keys(rv);class Zw extends Cr{constructor(t,n,r,o){let i=-1;if(super(t,n),XS(this,"space",o),typeof r=="number")for(;++i<Cy.length;){const a=Cy[i];XS(this,Cy[i],(r&rv[a])===rv[a])}}}Zw.prototype.defined=!0;function XS(e,t,n){n&&(e[t]=n)}function Ec(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new Zw(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[tv(r)]=r,n[tv(i.attribute)]=r}return new Kd(t,n,e.space)}const NP=Ec({properties:{ariaActiveDescendant:null,ariaAtomic:yn,ariaAutoComplete:null,ariaBusy:yn,ariaChecked:yn,ariaColCount:Le,ariaColIndex:Le,ariaColSpan:Le,ariaControls:Gt,ariaCurrent:null,ariaDescribedBy:Gt,ariaDetails:null,ariaDisabled:yn,ariaDropEffect:Gt,ariaErrorMessage:null,ariaExpanded:yn,ariaFlowTo:Gt,ariaGrabbed:yn,ariaHasPopup:null,ariaHidden:yn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Gt,ariaLevel:Le,ariaLive:null,ariaModal:yn,ariaMultiLine:yn,ariaMultiSelectable:yn,ariaOrientation:null,ariaOwns:Gt,ariaPlaceholder:null,ariaPosInSet:Le,ariaPressed:yn,ariaReadOnly:yn,ariaRelevant:null,ariaRequired:yn,ariaRoleDescription:Gt,ariaRowCount:Le,ariaRowIndex:Le,ariaRowSpan:Le,ariaSelected:yn,ariaSetSize:Le,ariaSort:null,ariaValueMax:Le,ariaValueMin:Le,ariaValueNow:Le,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function CP(e,t){return t in e?e[t]:t}function EP(e,t){return CP(e,t.toLowerCase())}const EV=Ec({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Wl,acceptCharset:Gt,accessKey:Gt,action:null,allow:null,allowFullScreen:kt,allowPaymentRequest:kt,allowUserMedia:kt,alt:null,as:null,async:kt,autoCapitalize:null,autoComplete:Gt,autoFocus:kt,autoPlay:kt,blocking:Gt,capture:null,charSet:null,checked:kt,cite:null,className:Gt,cols:Le,colSpan:null,content:null,contentEditable:yn,controls:kt,controlsList:Gt,coords:Le|Wl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kt,defer:kt,dir:null,dirName:null,disabled:kt,download:nv,draggable:yn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kt,formTarget:null,headers:Gt,height:Le,hidden:nv,high:Le,href:null,hrefLang:null,htmlFor:Gt,httpEquiv:Gt,id:null,imageSizes:null,imageSrcSet:null,inert:kt,inputMode:null,integrity:null,is:null,isMap:kt,itemId:null,itemProp:Gt,itemRef:Gt,itemScope:kt,itemType:Gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kt,low:Le,manifest:null,max:null,maxLength:Le,media:null,method:null,min:null,minLength:Le,multiple:kt,muted:kt,name:null,nonce:null,noModule:kt,noValidate:kt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:kt,optimum:Le,pattern:null,ping:Gt,placeholder:null,playsInline:kt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kt,referrerPolicy:null,rel:Gt,required:kt,reversed:kt,rows:Le,rowSpan:Le,sandbox:Gt,scope:null,scoped:kt,seamless:kt,selected:kt,shadowRootClonable:kt,shadowRootDelegatesFocus:kt,shadowRootMode:null,shape:null,size:Le,sizes:null,slot:null,span:Le,spellCheck:yn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Le,step:null,style:null,tabIndex:Le,target:null,title:null,translate:null,type:null,typeMustMatch:kt,useMap:null,value:yn,width:Le,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Gt,axis:null,background:null,bgColor:null,border:Le,borderColor:null,bottomMargin:Le,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kt,declare:kt,event:null,face:null,frame:null,frameBorder:null,hSpace:Le,leftMargin:Le,link:null,longDesc:null,lowSrc:null,marginHeight:Le,marginWidth:Le,noResize:kt,noHref:kt,noShade:kt,noWrap:kt,object:null,profile:null,prompt:null,rev:null,rightMargin:Le,rules:null,scheme:null,scrolling:yn,standby:null,summary:null,text:null,topMargin:Le,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Le,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kt,disableRemotePlayback:kt,prefix:null,property:null,results:Le,security:null,unselectable:null},space:"html",transform:EP}),TV=Ec({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:$r,accentHeight:Le,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Le,amplitude:Le,arabicForm:null,ascent:Le,attributeName:null,attributeType:null,azimuth:Le,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Le,by:null,calcMode:null,capHeight:Le,className:Gt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Le,diffuseConstant:Le,direction:null,display:null,dur:null,divisor:Le,dominantBaseline:null,download:kt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Le,enableBackground:null,end:null,event:null,exponent:Le,externalResourcesRequired:null,fill:null,fillOpacity:Le,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Wl,g2:Wl,glyphName:Wl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Le,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Le,horizOriginX:Le,horizOriginY:Le,id:null,ideographic:Le,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Le,k:Le,k1:Le,k2:Le,k3:Le,k4:Le,kernelMatrix:$r,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Le,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Le,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Le,overlineThickness:Le,paintOrder:null,panose1:null,path:null,pathLength:Le,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Le,pointsAtY:Le,pointsAtZ:Le,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:$r,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:$r,rev:$r,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:$r,requiredFeatures:$r,requiredFonts:$r,requiredFormats:$r,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Le,specularExponent:Le,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Le,strikethroughThickness:Le,string:null,stroke:null,strokeDashArray:$r,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Le,strokeOpacity:Le,strokeWidth:null,style:null,surfaceScale:Le,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:$r,tabIndex:Le,tableValues:null,target:null,targetX:Le,targetY:Le,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:$r,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Le,underlineThickness:Le,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Le,values:null,vAlphabetic:Le,vMathematical:Le,vectorEffect:null,vHanging:Le,vIdeographic:Le,version:null,vertAdvY:Le,vertOriginX:Le,vertOriginY:Le,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Le,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:CP}),TP=Ec({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),RP=Ec({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:EP}),AP=Ec({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),RV={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},AV=/[A-Z]/g,QS=/-[a-z]/g,PV=/^data[-\w.:]+$/i;function _V(e,t){const n=tv(t);let r=t,o=Cr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&PV.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(QS,$V);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!QS.test(i)){let a=i.replace(AV,DV);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=Zw}return new o(r,t)}function DV(e){return"-"+e.toLowerCase()}function $V(e){return e.charAt(1).toUpperCase()}const IV=SP([NP,EV,TP,RP,AP],"html"),e0=SP([NP,TV,TP,RP,AP],"svg");function LV(e){return e.join(" ").trim()}var yl={},Ey,JS;function MV(){if(JS)return Ey;JS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
606
606
|
`,f="/",p="*",h="",g="comment",y="declaration";function k(b,j){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];j=j||{};var N=1,S=1;function C(I){var M=I.match(t);M&&(N+=M.length);var B=I.lastIndexOf(u);S=~B?I.length-B:S+I.length}function D(){var I={line:N,column:S};return function(M){return M.position=new T(I),P(),M}}function T(I){this.start=I,this.end={line:N,column:S},this.source=j.source}T.prototype.content=b;function R(I){var M=new Error(j.source+":"+N+":"+S+": "+I);if(M.reason=I,M.filename=j.source,M.line=N,M.column=S,M.source=b,!j.silent)throw M}function $(I){var M=I.exec(b);if(M){var B=M[0];return C(B),b=b.slice(B.length),M}}function P(){$(n)}function F(I){var M;for(I=I||[];M=_();)M!==!1&&I.push(M);return I}function _(){var I=D();if(!(f!=b.charAt(0)||p!=b.charAt(1))){for(var M=2;h!=b.charAt(M)&&(p!=b.charAt(M)||f!=b.charAt(M+1));)++M;if(M+=2,h===b.charAt(M-1))return R("End of comment missing");var B=b.slice(2,M-2);return S+=2,C(B),b=b.slice(M),S+=2,I({type:g,comment:B})}}function V(){var I=D(),M=$(r);if(M){if(_(),!$(o))return R("property missing ':'");var B=$(i),W=I({type:y,property:v(M[0].replace(e,h)),value:B?v(B[0].replace(e,h)):h});return $(a),W}}function U(){var I=[];F(I);for(var M;M=V();)M!==!1&&(I.push(M),F(I));return I}return P(),U()}function v(b){return b?b.replace(l,h):h}return Ey=k,Ey}var ZS;function OV(){if(ZS)return yl;ZS=1;var e=yl&&yl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(yl,"__esModule",{value:!0}),yl.default=n;const t=e(MV());function n(r,o){let i=null;if(!r||typeof r!="string")return i;const a=(0,t.default)(r),l=typeof o=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:p}=u;l?o(f,p,u):p&&(i=i||{},i[f]=p)}),i}return yl}var xu={},eN;function FV(){if(eN)return xu;eN=1,Object.defineProperty(xu,"__esModule",{value:!0}),xu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(f){return!f||n.test(f)||e.test(f)},a=function(f,p){return p.toUpperCase()},l=function(f,p){return"".concat(p,"-")},u=function(f,p){return p===void 0&&(p={}),i(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(o,l):f=f.replace(r,l),f.replace(t,a))};return xu.camelCase=u,xu}var yu,tN;function zV(){if(tN)return yu;tN=1;var e=yu&&yu.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(OV()),n=FV();function r(o,i){var a={};return!o||typeof o!="string"||(0,t.default)(o,function(l,u){l&&u&&(a[(0,n.camelCase)(l,i)]=u)}),a}return r.default=r,yu=r,yu}var BV=zV();const UV=Cd(BV),PP=_P("end"),t0=_P("start");function _P(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function HV(e){const t=t0(e),n=PP(e);if(t&&n)return{start:t,end:n}}function Wu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nN(e.position):"start"in e||"end"in e?nN(e):"line"in e||"column"in e?sv(e):""}function sv(e){return rN(e&&e.line)+":"+rN(e&&e.column)}function nN(e){return sv(e&&e.start)+"-"+sv(e&&e.end)}function rN(e){return e&&typeof e=="number"?e:1}class or extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(a=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?i.ruleId=r:(i.source=r.slice(0,u),i.ruleId=r.slice(u+1))}if(!i.place&&i.ancestors&&i.ancestors){const u=i.ancestors[i.ancestors.length-1];u&&(i.place=u.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=l?l.line:void 0,this.name=Wu(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}or.prototype.file="";or.prototype.name="";or.prototype.reason="";or.prototype.message="";or.prototype.stack="";or.prototype.column=void 0;or.prototype.line=void 0;or.prototype.ancestors=void 0;or.prototype.cause=void 0;or.prototype.fatal=void 0;or.prototype.place=void 0;or.prototype.ruleId=void 0;or.prototype.source=void 0;const n0={}.hasOwnProperty,VV=new Map,WV=/[A-Z]/g,qV=new Set(["table","tbody","thead","tfoot","tr"]),KV=new Set(["td","th"]),DP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function GV(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=nW(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=tW(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?e0:IV,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=$P(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function $P(e,t,n){if(t.type==="element")return YV(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return XV(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return JV(e,t,n);if(t.type==="mdxjsEsm")return QV(e,t);if(t.type==="root")return ZV(e,t,n);if(t.type==="text")return eW(e,t)}function YV(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=e0,e.schema=o),e.ancestors.push(t);const i=LP(e,t.tagName,!1),a=rW(e,t);let l=s0(e,t);return qV.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!NV(u):!0})),IP(e,a,i,t),r0(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function XV(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}fd(e,t.position)}function QV(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);fd(e,t.position)}function JV(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=e0,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:LP(e,t.name,!0),a=sW(e,t),l=s0(e,t);return IP(e,a,i,t),r0(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function ZV(e,t,n){const r={};return r0(r,s0(e,t)),e.create(t,e.Fragment,r,n)}function eW(e,t){return t.value}function IP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function r0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function tW(e,t,n){return r;function r(o,i,a,l){const f=Array.isArray(a.children)?n:t;return l?f(i,a,l):f(i,a)}}function nW(e,t){return n;function n(r,o,i,a){const l=Array.isArray(i.children),u=t0(r);return t(o,i,a,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function rW(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&n0.call(t.properties,o)){const i=oW(e,o,t.properties[o]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&KV.has(t.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function sW(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else fd(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else fd(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function s0(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:VV;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const u=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(u){const f=o.get(u)||0;a=u+"-"+f,o.set(u,f+1)}}const l=$P(e,i,a);l!==void 0&&n.push(l)}return n}function oW(e,t,n){const r=_V(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?vV(n):LV(n)),r.property==="style"){let o=typeof n=="object"?n:iW(e,String(n));return e.stylePropertyNameCase==="css"&&(o=aW(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?RV[r.property]||r.property:r.attribute,n]}}function iW(e,t){try{return UV(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new or("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=DP+"#cannot-parse-style-attribute",o}}function LP(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,a;for(;++i<o.length;){const l=GS(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=GS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return n0.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);fd(e)}function fd(e,t){const n=new or("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=DP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function aW(e){const t={};let n;for(n in e)n0.call(e,n)&&(t[lW(n)]=e[n]);return t}function lW(e){let t=e.replace(WV,cW);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function cW(e){return"-"+e.toLowerCase()}const Ty={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},uW={};function dW(e,t){const n=uW,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return MP(e,r,o)}function MP(e,t,n){if(fW(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return sN(e.children,t,n)}return Array.isArray(e)?sN(e,t,n):""}function sN(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=MP(e[o],t,n);return r.join("")}function fW(e){return!!(e&&typeof e=="object")}const oN=document.createElement("i");function o0(e){const t="&"+e+";";oN.innerHTML=t;const n=oN.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function eo(e,t,n,r){const o=e.length;let i=0,a;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function es(e,t){return e.length>0?(eo(e,e.length,0,t),e):t}const iN={}.hasOwnProperty;function pW(e){const t={};let n=-1;for(;++n<e.length;)hW(t,e[n]);return t}function hW(e,t){let n;for(n in t){const o=(iN.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){iN.call(o,a)||(o[a]=[]);const l=i[a];mW(o[a],Array.isArray(l)?l:l?[l]:[])}}}function mW(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);eo(e,0,0,r)}function OP(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ql(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ks=Pi(/[A-Za-z]/),Br=Pi(/[\dA-Za-z]/),gW=Pi(/[#-'*+\--9=?A-Z^-~]/);function ov(e){return e!==null&&(e<32||e===127)}const iv=Pi(/\d/),xW=Pi(/[\dA-Fa-f]/),yW=Pi(/[!-/:-@[-`{-~]/);function xt(e){return e!==null&&e<-2}function kr(e){return e!==null&&(e<0||e===32)}function Ft(e){return e===-2||e===-1||e===32}const bW=Pi(new RegExp("\\p{P}|\\p{S}","u")),vW=Pi(/\s/);function Pi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Tc(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Br(e.charCodeAt(n+1))&&Br(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),o=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+o+1,a=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Yt(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(u){return Ft(u)?(e.enter(n),l(u)):t(u)}function l(u){return Ft(u)&&i++<o?(e.consume(u),l):(e.exit(n),t(u))}}const wW={tokenize:jW};function jW(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Yt(e,t,"linePrefix")}function o(l){return e.enter("paragraph"),i(l)}function i(l){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return xt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const kW={tokenize:SW},aN={tokenize:NW};function SW(e){const t=this,n=[];let r=0,o,i,a;return l;function l(S){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,u,f)(S)}return f(S)}function u(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&N();const C=t.events.length;let D=C,T;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){T=t.events[D][1].end;break}j(r);let R=C;for(;R<t.events.length;)t.events[R][1].end={...T},R++;return eo(t.events,D+1,0,t.events.slice(C)),t.events.length=R,f(S)}return l(S)}function f(S){if(r===n.length){if(!o)return g(S);if(o.currentConstruct&&o.currentConstruct.concrete)return k(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(aN,p,h)(S)}function p(S){return o&&N(),j(r),g(S)}function h(S){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,k(S)}function g(S){return t.containerState={},e.attempt(aN,y,k)(S)}function y(S){return r++,n.push([t.currentConstruct,t.containerState]),g(S)}function k(S){if(S===null){o&&N(),j(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),v(S)}function v(S){if(S===null){b(e.exit("chunkFlow"),!0),j(0),e.consume(S);return}return xt(S)?(e.consume(S),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(S),v)}function b(S,C){const D=t.sliceStream(S);if(C&&D.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(D),t.parser.lazy[S.start.line]){let T=o.events.length;for(;T--;)if(o.events[T][1].start.offset<a&&(!o.events[T][1].end||o.events[T][1].end.offset>a))return;const R=t.events.length;let $=R,P,F;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(P){F=t.events[$][1].end;break}P=!0}for(j(r),T=R;T<t.events.length;)t.events[T][1].end={...F},T++;eo(t.events,$+1,0,t.events.slice(R)),t.events.length=T}}function j(S){let C=n.length;for(;C-- >S;){const D=n[C];t.containerState=D[1],D[0].exit.call(t,e)}n.length=S}function N(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function NW(e,t,n){return Yt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function lN(e){if(e===null||kr(e)||vW(e))return 1;if(bW(e))return 2}function i0(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const av={name:"attention",resolveAll:CW,tokenize:EW};function CW(e,t){let n=-1,r,o,i,a,l,u,f,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},g={...e[n][1].start};cN(h,-u),cN(g,u),a={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:u>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=es(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=es(f,[["enter",o,t],["enter",a,t],["exit",a,t],["enter",i,t]]),f=es(f,i0(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=es(f,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=es(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,eo(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function EW(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=lN(r);let i;return a;function a(u){return i=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===i)return e.consume(u),l;const f=e.exit("attentionSequence"),p=lN(u),h=!p||p===2&&o||n.includes(u),g=!o||o===2&&p||n.includes(r);return f._open=!!(i===42?h:h&&(o||!g)),f._close=!!(i===42?g:g&&(p||!h)),t(u)}}function cN(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const TW={name:"autolink",tokenize:RW};function RW(e,t,n){let r=0;return o;function o(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(y){return Ks(y)?(e.consume(y),a):y===64?n(y):f(y)}function a(y){return y===43||y===45||y===46||Br(y)?(r=1,l(y)):f(y)}function l(y){return y===58?(e.consume(y),r=0,u):(y===43||y===45||y===46||Br(y))&&r++<32?(e.consume(y),l):(r=0,f(y))}function u(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||ov(y)?n(y):(e.consume(y),u)}function f(y){return y===64?(e.consume(y),p):gW(y)?(e.consume(y),f):n(y)}function p(y){return Br(y)?h(y):n(y)}function h(y){return y===46?(e.consume(y),r=0,p):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):g(y)}function g(y){if((y===45||Br(y))&&r++<63){const k=y===45?g:h;return e.consume(y),k}return n(y)}}const Hm={partial:!0,tokenize:AW};function AW(e,t,n){return r;function r(i){return Ft(i)?Yt(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||xt(i)?t(i):n(i)}}const FP={continuation:{tokenize:_W},exit:DW,name:"blockQuote",tokenize:PW};function PW(e,t,n){const r=this;return o;function o(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Ft(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function _W(e,t,n){const r=this;return o;function o(a){return Ft(a)?Yt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(FP,t,n)(a)}}function DW(e){e.exit("blockQuote")}const zP={name:"characterEscape",tokenize:$W};function $W(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return yW(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const BP={name:"characterReference",tokenize:IW};function IW(e,t,n){const r=this;let o=0,i,a;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),u}function u(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),i=31,a=Br,p(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=xW,p):(e.enter("characterReferenceValue"),i=7,a=iv,p(h))}function p(h){if(h===59&&o){const g=e.exit("characterReferenceValue");return a===Br&&!o0(r.sliceSerialize(g))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(h)&&o++<i?(e.consume(h),p):n(h)}}const uN={partial:!0,tokenize:MW},dN={concrete:!0,name:"codeFenced",tokenize:LW};function LW(e,t,n){const r=this,o={partial:!0,tokenize:D};let i=0,a=0,l;return u;function u(T){return f(T)}function f(T){const R=r.events[r.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(T)}function p(T){return T===l?(a++,e.consume(T),p):a<3?n(T):(e.exit("codeFencedFenceSequence"),Ft(T)?Yt(e,h,"whitespace")(T):h(T))}function h(T){return T===null||xt(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(uN,v,C)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||xt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Ft(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Yt(e,y,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),g)}function y(T){return T===null||xt(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(T))}function k(T){return T===null||xt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===l?n(T):(e.consume(T),k)}function v(T){return e.attempt(o,C,b)(T)}function b(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),j}function j(T){return i>0&&Ft(T)?Yt(e,N,"linePrefix",i+1)(T):N(T)}function N(T){return T===null||xt(T)?e.check(uN,v,C)(T):(e.enter("codeFlowValue"),S(T))}function S(T){return T===null||xt(T)?(e.exit("codeFlowValue"),N(T)):(e.consume(T),S)}function C(T){return e.exit("codeFenced"),t(T)}function D(T,R,$){let P=0;return F;function F(M){return T.enter("lineEnding"),T.consume(M),T.exit("lineEnding"),_}function _(M){return T.enter("codeFencedFence"),Ft(M)?Yt(T,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):V(M)}function V(M){return M===l?(T.enter("codeFencedFenceSequence"),U(M)):$(M)}function U(M){return M===l?(P++,T.consume(M),U):P>=a?(T.exit("codeFencedFenceSequence"),Ft(M)?Yt(T,I,"whitespace")(M):I(M)):$(M)}function I(M){return M===null||xt(M)?(T.exit("codeFencedFence"),R(M)):$(M)}}}function MW(e,t,n){const r=this;return o;function o(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Ry={name:"codeIndented",tokenize:FW},OW={partial:!0,tokenize:zW};function FW(e,t,n){const r=this;return o;function o(f){return e.enter("codeIndented"),Yt(e,i,"linePrefix",5)(f)}function i(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(f):n(f)}function a(f){return f===null?u(f):xt(f)?e.attempt(OW,a,u)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||xt(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),l)}function u(f){return e.exit("codeIndented"),t(f)}}function zW(e,t,n){const r=this;return o;function o(a){return r.parser.lazy[r.now().line]?n(a):xt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):Yt(e,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):xt(a)?o(a):n(a)}}const BW={name:"codeText",previous:HW,resolve:UW,tokenize:VW};function UW(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function HW(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function VW(e,t,n){let r=0,o,i;return a;function a(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),r++,l):(e.exit("codeTextSequence"),u(h))}function u(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),u):h===96?(i=e.enter("codeTextSequence"),o=0,p(h)):xt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||xt(h)?(e.exit("codeTextData"),u(h)):(e.consume(h),f)}function p(h){return h===96?(e.consume(h),o++,p):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",f(h))}}class WW{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&bu(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),bu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),bu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);bu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);bu(this.left,n.reverse())}}}function bu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function UP(e){const t={};let n=-1,r,o,i,a,l,u,f;const p=new WW(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,i=0,i<u.length&&u[i][1].type==="lineEndingBlank"&&(i+=2),i<u.length&&u[i][1].type==="content"))for(;++i<u.length&&u[i][1].type!=="content";)u[i][1].type==="chunkText"&&(u[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,qW(p,n)),n=t[n],f=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(a=p.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(o&&(p.get(o)[1].type="lineEndingBlank"),a[1].type="lineEnding",o=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;o&&(r[1].end={...p.get(o)[1].start},l=p.slice(o,n),l.unshift(r),p.splice(o,n-o+1,l))}}return eo(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function qW(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,u=[],f={};let p,h,g=-1,y=n,k=0,v=0;const b=[v];for(;y;){for(;e.get(++o)[1]!==y;);i.push(o),y._tokenizer||(p=r.sliceStream(y),y.next||p.push(null),h&&a.defineSkip(y.start),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=y,y=y.next}for(y=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(v=g+1,b.push(v),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(a.events=[],y?(y._tokenizer=void 0,y.previous=void 0):b.pop(),g=b.length;g--;){const j=l.slice(b[g],b[g+1]),N=i.pop();u.push([N,N+j.length-1]),e.splice(N,2,j)}for(u.reverse(),g=-1;++g<u.length;)f[k+u[g][0]]=k+u[g][1],k+=u[g][1]-u[g][0]-1;return f}const KW={resolve:YW,tokenize:XW},GW={partial:!0,tokenize:QW};function YW(e){return UP(e),e}function XW(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(l)}function o(l){return l===null?i(l):xt(l)?e.check(GW,a,i)(l):(e.consume(l),o)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function QW(e,t,n){const r=this;return o;function o(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Yt(e,i,"linePrefix")}function i(a){if(a===null||xt(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function HP(e,t,n,r,o,i,a,l,u){const f=u||Number.POSITIVE_INFINITY;let p=0;return h;function h(j){return j===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(j),e.exit(i),g):j===null||j===32||j===41||ov(j)?n(j):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(j))}function g(j){return j===62?(e.enter(i),e.consume(j),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===62?(e.exit("chunkString"),e.exit(l),g(j)):j===null||j===60||xt(j)?n(j):(e.consume(j),j===92?k:y)}function k(j){return j===60||j===62||j===92?(e.consume(j),y):y(j)}function v(j){return!p&&(j===null||j===41||kr(j))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(j)):p<f&&j===40?(e.consume(j),p++,v):j===41?(e.consume(j),p--,v):j===null||j===32||j===40||ov(j)?n(j):(e.consume(j),j===92?b:v)}function b(j){return j===40||j===41||j===92?(e.consume(j),v):v(j)}}function VP(e,t,n,r,o,i){const a=this;let l=0,u;return f;function f(y){return e.enter(r),e.enter(o),e.consume(y),e.exit(o),e.enter(i),p}function p(y){return l>999||y===null||y===91||y===93&&!u||y===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(y):y===93?(e.exit(i),e.enter(o),e.consume(y),e.exit(o),e.exit(r),t):xt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===null||y===91||y===93||xt(y)||l++>999?(e.exit("chunkString"),p(y)):(e.consume(y),u||(u=!Ft(y)),y===92?g:h)}function g(y){return y===91||y===92||y===93?(e.consume(y),l++,h):h(y)}}function WP(e,t,n,r,o,i){let a;return l;function l(g){return g===34||g===39||g===40?(e.enter(r),e.enter(o),e.consume(g),e.exit(o),a=g===40?41:g,u):n(g)}function u(g){return g===a?(e.enter(o),e.consume(g),e.exit(o),e.exit(r),t):(e.enter(i),f(g))}function f(g){return g===a?(e.exit(i),u(a)):g===null?n(g):xt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Yt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===a||g===null||xt(g)?(e.exit("chunkString"),f(g)):(e.consume(g),g===92?h:p)}function h(g){return g===a||g===92?(e.consume(g),p):p(g)}}function qu(e,t){let n;return r;function r(o){return xt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Ft(o)?Yt(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const JW={name:"definition",tokenize:eq},ZW={partial:!0,tokenize:tq};function eq(e,t,n){const r=this;let o;return i;function i(y){return e.enter("definition"),a(y)}function a(y){return VP.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function l(y){return o=ql(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),u):n(y)}function u(y){return kr(y)?qu(e,f)(y):f(y)}function f(y){return HP(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(ZW,h,h)(y)}function h(y){return Ft(y)?Yt(e,g,"whitespace")(y):g(y)}function g(y){return y===null||xt(y)?(e.exit("definition"),r.parser.defined.push(o),t(y)):n(y)}}function tq(e,t,n){return r;function r(l){return kr(l)?qu(e,o)(l):n(l)}function o(l){return WP(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ft(l)?Yt(e,a,"whitespace")(l):a(l)}function a(l){return l===null||xt(l)?t(l):n(l)}}const nq={name:"hardBreakEscape",tokenize:rq};function rq(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return xt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const sq={name:"headingAtx",resolve:oq,tokenize:iq};function oq(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},eo(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function iq(e,t,n){let r=0;return o;function o(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||kr(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||xt(p)?(e.exit("atxHeading"),t(p)):Ft(p)?Yt(e,l,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),l(p))}function f(p){return p===null||p===35||kr(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),f)}}const aq=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],fN=["pre","script","style","textarea"],lq={concrete:!0,name:"htmlFlow",resolveTo:dq,tokenize:fq},cq={partial:!0,tokenize:hq},uq={partial:!0,tokenize:pq};function dq(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function fq(e,t,n){const r=this;let o,i,a,l,u;return f;function f(q){return p(q)}function p(q){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(q),h}function h(q){return q===33?(e.consume(q),g):q===47?(e.consume(q),i=!0,v):q===63?(e.consume(q),o=3,r.interrupt?t:L):Ks(q)?(e.consume(q),a=String.fromCharCode(q),b):n(q)}function g(q){return q===45?(e.consume(q),o=2,y):q===91?(e.consume(q),o=5,l=0,k):Ks(q)?(e.consume(q),o=4,r.interrupt?t:L):n(q)}function y(q){return q===45?(e.consume(q),r.interrupt?t:L):n(q)}function k(q){const Q="CDATA[";return q===Q.charCodeAt(l++)?(e.consume(q),l===Q.length?r.interrupt?t:V:k):n(q)}function v(q){return Ks(q)?(e.consume(q),a=String.fromCharCode(q),b):n(q)}function b(q){if(q===null||q===47||q===62||kr(q)){const Q=q===47,ee=a.toLowerCase();return!Q&&!i&&fN.includes(ee)?(o=1,r.interrupt?t(q):V(q)):aq.includes(a.toLowerCase())?(o=6,Q?(e.consume(q),j):r.interrupt?t(q):V(q)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(q):i?N(q):S(q))}return q===45||Br(q)?(e.consume(q),a+=String.fromCharCode(q),b):n(q)}function j(q){return q===62?(e.consume(q),r.interrupt?t:V):n(q)}function N(q){return Ft(q)?(e.consume(q),N):F(q)}function S(q){return q===47?(e.consume(q),F):q===58||q===95||Ks(q)?(e.consume(q),C):Ft(q)?(e.consume(q),S):F(q)}function C(q){return q===45||q===46||q===58||q===95||Br(q)?(e.consume(q),C):D(q)}function D(q){return q===61?(e.consume(q),T):Ft(q)?(e.consume(q),D):S(q)}function T(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(e.consume(q),u=q,R):Ft(q)?(e.consume(q),T):$(q)}function R(q){return q===u?(e.consume(q),u=null,P):q===null||xt(q)?n(q):(e.consume(q),R)}function $(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||kr(q)?D(q):(e.consume(q),$)}function P(q){return q===47||q===62||Ft(q)?S(q):n(q)}function F(q){return q===62?(e.consume(q),_):n(q)}function _(q){return q===null||xt(q)?V(q):Ft(q)?(e.consume(q),_):n(q)}function V(q){return q===45&&o===2?(e.consume(q),B):q===60&&o===1?(e.consume(q),W):q===62&&o===4?(e.consume(q),z):q===63&&o===3?(e.consume(q),L):q===93&&o===5?(e.consume(q),H):xt(q)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(cq,Y,U)(q)):q===null||xt(q)?(e.exit("htmlFlowData"),U(q)):(e.consume(q),V)}function U(q){return e.check(uq,I,Y)(q)}function I(q){return e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),M}function M(q){return q===null||xt(q)?U(q):(e.enter("htmlFlowData"),V(q))}function B(q){return q===45?(e.consume(q),L):V(q)}function W(q){return q===47?(e.consume(q),a="",O):V(q)}function O(q){if(q===62){const Q=a.toLowerCase();return fN.includes(Q)?(e.consume(q),z):V(q)}return Ks(q)&&a.length<8?(e.consume(q),a+=String.fromCharCode(q),O):V(q)}function H(q){return q===93?(e.consume(q),L):V(q)}function L(q){return q===62?(e.consume(q),z):q===45&&o===2?(e.consume(q),L):V(q)}function z(q){return q===null||xt(q)?(e.exit("htmlFlowData"),Y(q)):(e.consume(q),z)}function Y(q){return e.exit("htmlFlow"),t(q)}}function pq(e,t,n){const r=this;return o;function o(a){return xt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function hq(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Hm,t,n)}}const mq={name:"htmlText",tokenize:gq};function gq(e,t,n){const r=this;let o,i,a;return l;function l(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),u}function u(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),D):L===63?(e.consume(L),S):Ks(L)?(e.consume(L),$):n(L)}function f(L){return L===45?(e.consume(L),p):L===91?(e.consume(L),i=0,k):Ks(L)?(e.consume(L),N):n(L)}function p(L){return L===45?(e.consume(L),y):n(L)}function h(L){return L===null?n(L):L===45?(e.consume(L),g):xt(L)?(a=h,W(L)):(e.consume(L),h)}function g(L){return L===45?(e.consume(L),y):h(L)}function y(L){return L===62?B(L):L===45?g(L):h(L)}function k(L){const z="CDATA[";return L===z.charCodeAt(i++)?(e.consume(L),i===z.length?v:k):n(L)}function v(L){return L===null?n(L):L===93?(e.consume(L),b):xt(L)?(a=v,W(L)):(e.consume(L),v)}function b(L){return L===93?(e.consume(L),j):v(L)}function j(L){return L===62?B(L):L===93?(e.consume(L),j):v(L)}function N(L){return L===null||L===62?B(L):xt(L)?(a=N,W(L)):(e.consume(L),N)}function S(L){return L===null?n(L):L===63?(e.consume(L),C):xt(L)?(a=S,W(L)):(e.consume(L),S)}function C(L){return L===62?B(L):S(L)}function D(L){return Ks(L)?(e.consume(L),T):n(L)}function T(L){return L===45||Br(L)?(e.consume(L),T):R(L)}function R(L){return xt(L)?(a=R,W(L)):Ft(L)?(e.consume(L),R):B(L)}function $(L){return L===45||Br(L)?(e.consume(L),$):L===47||L===62||kr(L)?P(L):n(L)}function P(L){return L===47?(e.consume(L),B):L===58||L===95||Ks(L)?(e.consume(L),F):xt(L)?(a=P,W(L)):Ft(L)?(e.consume(L),P):B(L)}function F(L){return L===45||L===46||L===58||L===95||Br(L)?(e.consume(L),F):_(L)}function _(L){return L===61?(e.consume(L),V):xt(L)?(a=_,W(L)):Ft(L)?(e.consume(L),_):P(L)}function V(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),o=L,U):xt(L)?(a=V,W(L)):Ft(L)?(e.consume(L),V):(e.consume(L),I)}function U(L){return L===o?(e.consume(L),o=void 0,M):L===null?n(L):xt(L)?(a=U,W(L)):(e.consume(L),U)}function I(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||kr(L)?P(L):(e.consume(L),I)}function M(L){return L===47||L===62||kr(L)?P(L):n(L)}function B(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function W(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),O}function O(L){return Ft(L)?Yt(e,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):H(L)}function H(L){return e.enter("htmlTextData"),a(L)}}const a0={name:"labelEnd",resolveAll:vq,resolveTo:wq,tokenize:jq},xq={tokenize:kq},yq={tokenize:Sq},bq={tokenize:Nq};function vq(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&eo(e,0,e.length,n),e}function wq(e,t){let n=e.length,r=0,o,i,a,l;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(a=n);const u={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",u,t],["enter",f,t]],l=es(l,e.slice(i+1,i+r+3)),l=es(l,[["enter",p,t]]),l=es(l,i0(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=es(l,[["exit",p,t],e[a-2],e[a-1],["exit",f,t]]),l=es(l,e.slice(a+1)),l=es(l,[["exit",u,t]]),eo(e,i,e.length,l),e}function jq(e,t,n){const r=this;let o=r.events.length,i,a;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return l;function l(g){return i?i._inactive?h(g):(a=r.parser.defined.includes(ql(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):n(g)}function u(g){return g===40?e.attempt(xq,p,a?p:h)(g):g===91?e.attempt(yq,p,a?f:h)(g):a?p(g):h(g)}function f(g){return e.attempt(bq,p,h)(g)}function p(g){return t(g)}function h(g){return i._balanced=!0,n(g)}}function kq(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),o}function o(h){return kr(h)?qu(e,i)(h):i(h)}function i(h){return h===41?p(h):HP(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return kr(h)?qu(e,u)(h):p(h)}function l(h){return n(h)}function u(h){return h===34||h===39||h===40?WP(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function f(h){return kr(h)?qu(e,p)(h):p(h)}function p(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function Sq(e,t,n){const r=this;return o;function o(l){return VP.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(ql(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function Nq(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Cq={name:"labelStartImage",resolveAll:a0.resolveAll,tokenize:Eq};function Eq(e,t,n){const r=this;return o;function o(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Tq={name:"labelStartLink",resolveAll:a0.resolveAll,tokenize:Rq};function Rq(e,t,n){const r=this;return o;function o(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Ay={name:"lineEnding",tokenize:Aq};function Aq(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Yt(e,t,"linePrefix")}}const Xp={name:"thematicBreak",tokenize:Pq};function Pq(e,t,n){let r=0,o;return i;function i(f){return e.enter("thematicBreak"),a(f)}function a(f){return o=f,l(f)}function l(f){return f===o?(e.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||xt(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===o?(e.consume(f),r++,u):(e.exit("thematicBreakSequence"),Ft(f)?Yt(e,l,"whitespace")(f):l(f))}}const yr={continuation:{tokenize:Iq},exit:Mq,name:"list",tokenize:$q},_q={partial:!0,tokenize:Oq},Dq={partial:!0,tokenize:Lq};function $q(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,a=0;return l;function l(y){const k=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:iv(y)){if(r.containerState.type||(r.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Xp,n,f)(y):f(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(y)}return n(y)}function u(y){return iv(y)&&++a<10?(e.consume(y),u):(!r.interrupt||a<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):n(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Hm,r.interrupt?n:p,e.attempt(_q,g,h))}function p(y){return r.containerState.initialBlankLine=!0,i++,g(y)}function h(y){return Ft(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),g):n(y)}function g(y){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function Iq(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Hm,o,i);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Yt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ft(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Dq,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Yt(e,e.attempt(yr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Lq(e,t,n){const r=this;return Yt(e,o,"listItemIndent",r.containerState.size+1);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function Mq(e){e.exit(this.containerState.type)}function Oq(e,t,n){const r=this;return Yt(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const a=r.events[r.events.length-1];return!Ft(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const pN={name:"setextUnderline",resolveTo:Fq,tokenize:zq};function Fq(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function zq(e,t,n){const r=this;let o;return i;function i(f){let p=r.events.length,h;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){h=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),o=f,a(f)):n(f)}function a(f){return e.enter("setextHeadingLineSequence"),l(f)}function l(f){return f===o?(e.consume(f),l):(e.exit("setextHeadingLineSequence"),Ft(f)?Yt(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||xt(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const Bq={tokenize:Uq};function Uq(e){const t=this,n=e.attempt(Hm,r,e.attempt(this.parser.constructs.flowInitial,o,Yt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(KW,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Hq={resolveAll:KP()},Vq=qP("string"),Wq=qP("text");function qP(e){return{resolveAll:KP(e==="text"?qq:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,a,l);return a;function a(p){return f(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),u}function u(p){return f(p)?(n.exit("data"),i(p)):(n.consume(p),u)}function f(p){if(p===null)return!0;const h=o[p];let g=-1;if(h)for(;++g<h.length;){const y=h[g];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function KP(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function qq(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,a=-1,l=0,u;for(;i--;){const f=o[i];if(typeof f=="string"){for(a=f.length;f.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(f===-2)u=!0,l++;else if(f!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const f={type:n===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const Kq={42:yr,43:yr,45:yr,48:yr,49:yr,50:yr,51:yr,52:yr,53:yr,54:yr,55:yr,56:yr,57:yr,62:FP},Gq={91:JW},Yq={[-2]:Ry,[-1]:Ry,32:Ry},Xq={35:sq,42:Xp,45:[pN,Xp],60:lq,61:pN,95:Xp,96:dN,126:dN},Qq={38:BP,92:zP},Jq={[-5]:Ay,[-4]:Ay,[-3]:Ay,33:Cq,38:BP,42:av,60:[TW,mq],91:Tq,92:[nq,zP],93:a0,95:av,96:BW},Zq={null:[av,Hq]},eK={null:[42,95]},tK={null:[]},nK=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:eK,contentInitial:Gq,disable:tK,document:Kq,flow:Xq,flowInitial:Yq,insideSpan:Zq,string:Qq,text:Jq},Symbol.toStringTag,{value:"Module"}));function rK(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let a=[],l=[];const u={attempt:R(D),check:R(T),consume:N,enter:S,exit:C,interrupt:R(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:v,events:[],now:k,parser:e,previous:null,sliceSerialize:g,sliceStream:y,write:h};let p=t.tokenize.call(f,u);return t.resolveAll&&i.push(t),f;function h(_){return a=es(a,_),b(),a[a.length-1]!==null?[]:($(t,0),f.events=i0(i,f.events,f),f.events)}function g(_,V){return oK(y(_),V)}function y(_){return sK(a,_)}function k(){const{_bufferIndex:_,_index:V,line:U,column:I,offset:M}=r;return{_bufferIndex:_,_index:V,line:U,column:I,offset:M}}function v(_){o[_.line]=_.column,F()}function b(){let _;for(;r._index<a.length;){const V=a[r._index];if(typeof V=="string")for(_=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===_&&r._bufferIndex<V.length;)j(V.charCodeAt(r._bufferIndex));else j(V)}}function j(_){p=p(_)}function N(_){xt(_)?(r.line++,r.column=1,r.offset+=_===-3?2:1,F()):_!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=_}function S(_,V){const U=V||{};return U.type=_,U.start=k(),f.events.push(["enter",U,f]),l.push(U),U}function C(_){const V=l.pop();return V.end=k(),f.events.push(["exit",V,f]),V}function D(_,V){$(_,V.from)}function T(_,V){V.restore()}function R(_,V){return U;function U(I,M,B){let W,O,H,L;return Array.isArray(I)?Y(I):"tokenize"in I?Y([I]):z(I);function z(Z){return ie;function ie(ne){const ue=ne!==null&&Z[ne],ge=ne!==null&&Z.null,Ne=[...Array.isArray(ue)?ue:ue?[ue]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return Y(Ne)(ne)}}function Y(Z){return W=Z,O=0,Z.length===0?B:q(Z[O])}function q(Z){return ie;function ie(ne){return L=P(),H=Z,Z.partial||(f.currentConstruct=Z),Z.name&&f.parser.constructs.disable.null.includes(Z.name)?ee():Z.tokenize.call(V?Object.assign(Object.create(f),V):f,u,Q,ee)(ne)}}function Q(Z){return _(H,L),M}function ee(Z){return L.restore(),++O<W.length?q(W[O]):B}}}function $(_,V){_.resolveAll&&!i.includes(_)&&i.push(_),_.resolve&&eo(f.events,V,f.events.length-V,_.resolve(f.events.slice(V),f)),_.resolveTo&&(f.events=_.resolveTo(f.events,f))}function P(){const _=k(),V=f.previous,U=f.currentConstruct,I=f.events.length,M=Array.from(l);return{from:I,restore:B};function B(){r=_,f.previous=V,f.currentConstruct=U,f.events.length=I,l=M,F()}}function F(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function sK(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let a;if(n===o)a=[e[n].slice(r,i)];else{if(a=e.slice(n,o),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(e[o].slice(0,i))}return a}function oK(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
607
607
|
`;break}case-3:{a=`\r
|
|
608
608
|
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&o)continue;a=" ";break}default:a=String.fromCharCode(i)}o=i===-2,r.push(a)}return r.join("")}function iK(e){const r={constructs:pW([nK,...(e||{}).extensions||[]]),content:o(wW),defined:[],document:o(kW),flow:o(Bq),lazy:{},string:o(Vq),text:o(Wq)};return r;function o(i){return a;function a(l){return rK(r,i,l)}}}function aK(e){for(;!UP(e););return e}const hN=/[\0\t\n\r]/g;function lK(){let e=1,t="",n=!0,r;return o;function o(i,a,l){const u=[];let f,p,h,g,y;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(hN.lastIndex=h,f=hN.exec(i),g=f&&f.index!==void 0?f.index:i.length,y=i.charCodeAt(g),!f){t=i.slice(h);break}if(y===10&&h===g&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),h<g&&(u.push(i.slice(h,g)),e+=g-h),y){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}h=g+1}return l&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const cK=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uK(e){return e.replace(cK,dK)}function dK(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return OP(n.slice(i?2:1),i?16:10)}return o0(n)||e}const GP={}.hasOwnProperty;function fK(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),pK(n)(aK(iK(n).document().write(lK()(e,t,!0))))}function pK(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(He),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(oe),blockQuote:i(ge),characterEscape:P,characterReference:P,codeFenced:i(Ne),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Ne,a),codeText:i(Ce,a),codeTextData:P,data:P,codeFlowValue:P,definition:i(ke),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Ue),hardBreakEscape:i(ve),hardBreakTrailing:i(ve),htmlFlow:i(be,a),htmlFlowData:P,htmlText:i(be,a),htmlTextData:P,image:i(Re),label:a,link:i(He),listItem:i(Fe),listItemValue:g,listOrdered:i(rt,h),listUnordered:i(rt),paragraph:i(ot),reference:q,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(oe),strong:i(Nt),thematicBreak:i(at)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:ue,autolinkProtocol:ne,blockQuote:u(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:ee,characterReferenceMarkerNumeric:ee,characterReferenceValue:Z,characterReference:ie,codeFenced:u(b),codeFencedFence:v,codeFencedFenceInfo:y,codeFencedFenceMeta:k,codeFlowValue:F,codeIndented:u(j),codeText:u(M),codeTextData:F,data:F,definition:u(),definitionDestinationString:C,definitionLabelString:N,definitionTitleString:S,emphasis:u(),hardBreakEscape:u(V),hardBreakTrailing:u(V),htmlFlow:u(U),htmlFlowData:F,htmlText:u(I),htmlTextData:F,image:u(W),label:H,labelText:O,lineEnding:_,link:u(B),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:Q,resourceDestinationString:L,resourceTitleString:z,resource:Y,setextHeading:u($),setextHeadingLineSequence:R,setextHeadingText:T,strong:u(),thematicBreak:u()}};YP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ce){let me={type:"root",children:[]};const Ie={stack:[me],tokenStack:[],config:t,enter:l,exit:f,buffer:a,resume:p,data:n},Ae=[];let We=-1;for(;++We<ce.length;)if(ce[We][1].type==="listOrdered"||ce[We][1].type==="listUnordered")if(ce[We][0]==="enter")Ae.push(We);else{const pt=Ae.pop();We=o(ce,pt,We)}for(We=-1;++We<ce.length;){const pt=t[ce[We][0]];GP.call(pt,ce[We][1].type)&&pt[ce[We][1].type].call(Object.assign({sliceSerialize:ce[We][2].sliceSerialize},Ie),ce[We][1])}if(Ie.tokenStack.length>0){const pt=Ie.tokenStack[Ie.tokenStack.length-1];(pt[1]||mN).call(Ie,void 0,pt[0])}for(me.position={start:ci(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:ci(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},We=-1;++We<t.transforms.length;)me=t.transforms[We](me)||me;return me}function o(ce,me,Ie){let Ae=me-1,We=-1,pt=!1,Pe,Qe,Je,ut;for(;++Ae<=Ie;){const fe=ce[Ae];switch(fe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{fe[0]==="enter"?We++:We--,ut=void 0;break}case"lineEndingBlank":{fe[0]==="enter"&&(Pe&&!ut&&!We&&!Je&&(Je=Ae),ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ut=void 0}if(!We&&fe[0]==="enter"&&fe[1].type==="listItemPrefix"||We===-1&&fe[0]==="exit"&&(fe[1].type==="listUnordered"||fe[1].type==="listOrdered")){if(Pe){let K=Ae;for(Qe=void 0;K--;){const re=ce[K];if(re[1].type==="lineEnding"||re[1].type==="lineEndingBlank"){if(re[0]==="exit")continue;Qe&&(ce[Qe][1].type="lineEndingBlank",pt=!0),re[1].type="lineEnding",Qe=K}else if(!(re[1].type==="linePrefix"||re[1].type==="blockQuotePrefix"||re[1].type==="blockQuotePrefixWhitespace"||re[1].type==="blockQuoteMarker"||re[1].type==="listItemIndent"))break}Je&&(!Qe||Je<Qe)&&(Pe._spread=!0),Pe.end=Object.assign({},Qe?ce[Qe][1].start:fe[1].end),ce.splice(Qe||Ae,0,["exit",Pe,fe[2]]),Ae++,Ie++}if(fe[1].type==="listItemPrefix"){const K={type:"listItem",_spread:!1,start:Object.assign({},fe[1].start),end:void 0};Pe=K,ce.splice(Ae,0,["enter",K,fe[2]]),Ae++,Ie++,Je=void 0,ut=!0}}}return ce[me][1]._spread=pt,Ie}function i(ce,me){return Ie;function Ie(Ae){l.call(this,ce(Ae),Ae),me&&me.call(this,Ae)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(ce,me,Ie){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([me,Ie||void 0]),ce.position={start:ci(me.start),end:void 0}}function u(ce){return me;function me(Ie){ce&&ce.call(this,Ie),f.call(this,Ie)}}function f(ce,me){const Ie=this.stack.pop(),Ae=this.tokenStack.pop();if(Ae)Ae[0].type!==ce.type&&(me?me.call(this,ce,Ae[0]):(Ae[1]||mN).call(this,ce,Ae[0]));else throw new Error("Cannot close `"+ce.type+"` ("+Wu({start:ce.start,end:ce.end})+"): it’s not open");Ie.position.end=ci(ce.end)}function p(){return dW(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(ce){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.lang=ce}function k(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.meta=ce}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce.replace(/(\r?\n|\r)$/g,"")}function N(ce){const me=this.resume(),Ie=this.stack[this.stack.length-1];Ie.label=me,Ie.identifier=ql(this.sliceSerialize(ce)).toLowerCase()}function S(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.title=ce}function C(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.url=ce}function D(ce){const me=this.stack[this.stack.length-1];if(!me.depth){const Ie=this.sliceSerialize(ce).length;me.depth=Ie}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function R(ce){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function P(ce){const Ie=this.stack[this.stack.length-1].children;let Ae=Ie[Ie.length-1];(!Ae||Ae.type!=="text")&&(Ae=mt(),Ae.position={start:ci(ce.start),end:void 0},Ie.push(Ae)),this.stack.push(Ae)}function F(ce){const me=this.stack.pop();me.value+=this.sliceSerialize(ce),me.position.end=ci(ce.end)}function _(ce){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ie=me.children[me.children.length-1];Ie.position.end=ci(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(me.type)&&(P.call(this,ce),F.call(this,ce))}function V(){this.data.atHardBreak=!0}function U(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce}function I(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce}function M(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce}function B(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=me,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function W(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=me,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function O(ce){const me=this.sliceSerialize(ce),Ie=this.stack[this.stack.length-2];Ie.label=uK(me),Ie.identifier=ql(me).toLowerCase()}function H(){const ce=this.stack[this.stack.length-1],me=this.resume(),Ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ie.type==="link"){const Ae=ce.children;Ie.children=Ae}else Ie.alt=me}function L(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.url=ce}function z(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.title=ce}function Y(){this.data.inReference=void 0}function q(){this.data.referenceType="collapsed"}function Q(ce){const me=this.resume(),Ie=this.stack[this.stack.length-1];Ie.label=me,Ie.identifier=ql(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function ee(ce){this.data.characterReferenceType=ce.type}function Z(ce){const me=this.sliceSerialize(ce),Ie=this.data.characterReferenceType;let Ae;Ie?(Ae=OP(me,Ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ae=o0(me);const We=this.stack[this.stack.length-1];We.value+=Ae}function ie(ce){const me=this.stack.pop();me.position.end=ci(ce.end)}function ne(ce){F.call(this,ce);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(ce)}function ue(ce){F.call(this,ce);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(ce)}function ge(){return{type:"blockquote",children:[]}}function Ne(){return{type:"code",lang:null,meta:null,value:""}}function Ce(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ue(){return{type:"emphasis",children:[]}}function oe(){return{type:"heading",depth:0,children:[]}}function ve(){return{type:"break"}}function be(){return{type:"html",value:""}}function Re(){return{type:"image",title:null,url:"",alt:null}}function He(){return{type:"link",title:null,url:"",children:[]}}function rt(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function Fe(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function ot(){return{type:"paragraph",children:[]}}function Nt(){return{type:"strong",children:[]}}function mt(){return{type:"text",value:""}}function at(){return{type:"thematicBreak"}}}function ci(e){return{line:e.line,column:e.column,offset:e.offset}}function YP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?YP(e,r):hK(e,r)}}function hK(e,t){let n;for(n in t)if(GP.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function mN(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wu({start:t.start,end:t.end})+") is still open")}function mK(e){const t=this;t.parser=n;function n(r){return fK(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function gK(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function xK(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|