botnote 0.2.15 → 0.2.16

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.
@@ -146,14 +146,14 @@ Error generating stack: `+j.message+`
146
146
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:o,tableCell:l,tableRow:a}};function o(O,y,b,v){return u(f(O,b,v),O.align)}function a(O,y,b,v){const w=p(O,b,v),C=u([w]);return C.slice(0,C.indexOf(`
147
147
  `))}function l(O,y,b,v){const w=b.enter("tableCell"),C=b.enter("phrasing"),S=b.containerPhrasing(O,{...v,before:s,after:s});return C(),w(),S}function u(O,y){return sge(O,{align:y,alignDelimiters:r,padding:n,stringLength:i})}function f(O,y,b){const v=O.children;let w=-1;const C=[],S=y.enter("table");for(;++w<v.length;)C[w]=p(v[w],y,b);return S(),C}function p(O,y,b){const v=O.children;let w=-1;const C=[],S=y.enter("tableRow");for(;++w<v.length;)C[w]=l(v[w],O,y,b);return S(),C}function g(O,y,b){let v=mD.inlineCode(O,y,b);return b.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function Xge(){return{exit:{taskListCheckValueChecked:uM,taskListCheckValueUnchecked:uM,paragraph:qge}}}function Wge(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Uge}}}function uM(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function qge(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function Uge(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=mD.listItem(t,e,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(f){return f+o}}function Yge(){return[Pme(),Ume(),Jme(),Vge(),Xge()]}function Gge(t){return{extensions:[Mme(),Yme(t),ege(),Bge(t),Wge()]}}const Kge={tokenize:i2e,partial:!0},gD={tokenize:s2e,partial:!0},OD={tokenize:o2e,partial:!0},xD={tokenize:a2e,partial:!0},Jge={tokenize:l2e,partial:!0},yD={name:"wwwAutolink",tokenize:n2e,previous:vD},bD={name:"protocolAutolink",tokenize:r2e,previous:kD},Ra={name:"emailAutolink",tokenize:t2e,previous:wD},Bo={};function e2e(){return{text:Bo}}let Tc=48;for(;Tc<123;)Bo[Tc]=Ra,Tc++,Tc===58?Tc=65:Tc===91&&(Tc=97);Bo[43]=Ra;Bo[45]=Ra;Bo[46]=Ra;Bo[95]=Ra;Bo[72]=[Ra,bD];Bo[104]=[Ra,bD];Bo[87]=[Ra,yD];Bo[119]=[Ra,yD];function t2e(t,e,n){const r=this;let i,s;return o;function o(p){return!xb(p)||!wD.call(r,r.previous)||sk(r.events)?n(p):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(p))}function a(p){return xb(p)?(t.consume(p),a):p===64?(t.consume(p),l):n(p)}function l(p){return p===46?t.check(Jge,f,u)(p):p===45||p===95||Kr(p)?(s=!0,t.consume(p),l):f(p)}function u(p){return t.consume(p),i=!0,l}function f(p){return s&&i&&di(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(p)):n(p)}}function n2e(t,e,n){const r=this;return i;function i(o){return o!==87&&o!==119||!vD.call(r,r.previous)||sk(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(Kge,t.attempt(gD,t.attempt(OD,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function r2e(t,e,n){const r=this;let i="",s=!1;return o;function o(p){return(p===72||p===104)&&kD.call(r,r.previous)&&!sk(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(p),t.consume(p),a):n(p)}function a(p){if(di(p)&&i.length<5)return i+=String.fromCodePoint(p),t.consume(p),a;if(p===58){const g=i.toLowerCase();if(g==="http"||g==="https")return t.consume(p),l}return n(p)}function l(p){return p===47?(t.consume(p),s?u:(s=!0,l)):n(p)}function u(p){return p===null||u2(p)||Sn(p)||gu(p)||R8(p)?n(p):t.attempt(gD,t.attempt(OD,f),n)(p)}function f(p){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(p)}}function i2e(t,e,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),i):o===46&&r===3?(t.consume(o),s):n(o)}function s(o){return o===null?n(o):e(o)}}function s2e(t,e,n){let r,i,s;return o;function o(u){return u===46||u===95?t.check(xD,l,a)(u):u===null||Sn(u)||gu(u)||u!==45&&R8(u)?l(u):(s=!0,t.consume(u),o)}function a(u){return u===95?r=!0:(i=r,r=void 0),t.consume(u),o}function l(u){return i||r||!s?n(u):e(u)}}function o2e(t,e){let n=0,r=0;return i;function i(o){return o===40?(n++,t.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(xD,e,s)(o):o===null||Sn(o)||gu(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&r++,t.consume(o),i}}function a2e(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),s):a===93?(t.consume(a),i):a===60||a===null||Sn(a)||gu(a)?e(a):n(a)}function i(a){return a===null||a===40||a===91||Sn(a)||gu(a)?e(a):r(a)}function s(a){return di(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):di(a)?(t.consume(a),o):n(a)}}function l2e(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return Kr(s)?n(s):e(s)}}function vD(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Sn(t)}function kD(t){return!di(t)}function wD(t){return!(t===47||xb(t))}function xb(t){return t===43||t===45||t===46||t===95||Kr(t)}function sk(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const c2e={tokenize:O2e,partial:!0};function u2e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:p2e,continuation:{tokenize:m2e},exit:g2e}},text:{91:{name:"gfmFootnoteCall",tokenize:h2e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:d2e,resolveTo:f2e}}}}function d2e(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const u=Xs(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function f2e(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function h2e(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(p){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),l}function l(p){return p!==94?n(p):(t.enter("gfmFootnoteCallMarker"),t.consume(p),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",u)}function u(p){if(s>999||p===93&&!o||p===null||p===91||Sn(p))return n(p);if(p===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return i.includes(Xs(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(p),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(p)}return Sn(p)||(o=!0),s++,t.consume(p),p===92?f:u}function f(p){return p===91||p===92||p===93?(t.consume(p),s++,u):u(p)}}function p2e(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(y)}function f(y){if(o>999||y===93&&!a||y===null||y===91||Sn(y))return n(y);if(y===93){t.exit("chunkString");const b=t.exit("gfmFootnoteDefinitionLabelString");return s=Xs(r.sliceSerialize(b)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return Sn(y)||(a=!0),o++,t.consume(y),y===92?p:f}function p(y){return y===91||y===92||y===93?(t.consume(y),o++,f):f(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),i.includes(s)||i.push(s),Jt(t,O,"gfmFootnoteDefinitionWhitespace")):n(y)}function O(y){return e(y)}}function m2e(t,e,n){return t.check(M1,e,t.attempt(c2e,e,n))}function g2e(t){t.exit("gfmFootnoteDefinition")}function O2e(t,e,n){const r=this;return Jt(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):n(s)}}function x2e(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},p={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},g=[["enter",f,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",p,a]],O=a.parser.constructs.insideSpan.null;O&&es(g,g.length,0,j8(O,o.slice(u+1,l),a)),es(g,g.length,0,[["exit",p,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",f,a]]),es(o,u-1,l-u+3,g),l=u+g.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const u=this.previous,f=this.events;let p=0;return g;function g(y){return u===126&&f[f.length-1][1].type!=="characterEscape"?l(y):(o.enter("strikethroughSequenceTemporary"),O(y))}function O(y){const b=d0(u);if(y===126)return p>1?l(y):(o.consume(y),p++,O);if(p<2&&!n)return l(y);const v=o.exit("strikethroughSequenceTemporary"),w=d0(y);return v._open=!w||w===2&&!!b,v._close=!b||b===2&&!!w,a(y)}}}class y2e{constructor(){this.map=[]}add(e,n,r){b2e(this,e,n,r)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function b2e(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function v2e(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function k2e(){return{flow:{null:{name:"table",tokenize:w2e,resolveAll:S2e}}}}function w2e(t,e,n){const r=this;let i=0,s=0,o;return a;function a(M){let V=r.events.length-1;for(;V>-1;){const B=r.events[V][1].type;if(B==="lineEnding"||B==="linePrefix")V--;else break}const Z=V>-1?r.events[V][1].type:null,D=Z==="tableHead"||Z==="tableRow"?T:l;return D===T&&r.parser.lazy[r.now().line]?n(M):D(M)}function l(M){return t.enter("tableHead"),t.enter("tableRow"),u(M)}function u(M){return M===124||(o=!0,s+=1),f(M)}function f(M){return M===null?n(M):bt(M)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),O):n(M):_t(M)?Jt(t,f,"whitespace")(M):(s+=1,o&&(o=!1,i+=1),M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),o=!0,f):(t.enter("data"),p(M)))}function p(M){return M===null||M===124||Sn(M)?(t.exit("data"),f(M)):(t.consume(M),M===92?g:p)}function g(M){return M===92||M===124?(t.consume(M),p):p(M)}function O(M){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(M):(t.enter("tableDelimiterRow"),o=!1,_t(M)?Jt(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):y(M))}function y(M){return M===45||M===58?v(M):M===124?(o=!0,t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),b):P(M)}function b(M){return _t(M)?Jt(t,v,"whitespace")(M):v(M)}function v(M){return M===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),w):M===45?(s+=1,w(M)):M===null||bt(M)?A(M):P(M)}function w(M){return M===45?(t.enter("tableDelimiterFiller"),C(M)):P(M)}function C(M){return M===45?(t.consume(M),C):M===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(M),t.exit("tableDelimiterMarker"),S):(t.exit("tableDelimiterFiller"),S(M))}function S(M){return _t(M)?Jt(t,A,"whitespace")(M):A(M)}function A(M){return M===124?y(M):M===null||bt(M)?!o||i!==s?P(M):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(M)):P(M)}function P(M){return n(M)}function T(M){return t.enter("tableRow"),$(M)}function $(M){return M===124?(t.enter("tableCellDivider"),t.consume(M),t.exit("tableCellDivider"),$):M===null||bt(M)?(t.exit("tableRow"),e(M)):_t(M)?Jt(t,$,"whitespace")(M):(t.enter("data"),I(M))}function I(M){return M===null||M===124||Sn(M)?(t.exit("data"),$(M)):(t.consume(M),M===92?L:I)}function L(M){return M===92||M===124?(t.consume(M),I):I(M)}}function S2e(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,f,p;const g=new y2e;for(;++n<t.length;){const O=t[n],y=O[1];O[0]==="enter"?y.type==="tableHead"?(a=!1,l!==0&&(dM(g,e,l,u,f),f=void 0,l=0),u={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},g.add(n,0,[["enter",u,e]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(r=!0,p=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,f={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},g.add(n,0,[["enter",f,e]])),i=y.type==="tableDelimiterRow"?2:f?3:1):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],p=Qm(g,e,s,i,void 0,p),s=[0,0,0,0]),o[2]=n)):y.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],p=Qm(g,e,s,i,void 0,p)),s=o,o=[s[1],n,0,0])):y.type==="tableHead"?(a=!0,l=n):y.type==="tableRow"||y.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],p=Qm(g,e,s,i,n,p)):o[1]!==0&&(p=Qm(g,e,o,i,n,p)),i=0):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&dM(g,e,l,u,f),g.consume(e.events),n=-1;++n<e.events.length;){const O=e.events[n];O[0]==="enter"&&O[1].type==="table"&&(O[1]._align=v2e(e.events,n))}return t}function Qm(t,e,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},gd(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const l=gd(e.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const u=gd(e.events,n[2]),f=gd(e.events,n[3]),p={type:a,start:Object.assign({},u),end:Object.assign({},f)};if(t.add(n[2],0,[["enter",p,e]]),r!==2){const g=e.events[n[2]],O=e.events[n[3]];if(g[1].end=Object.assign({},O[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const y=n[2]+1,b=n[3]-n[2]-1;t.add(y,b,[])}}t.add(n[3]+1,0,[["exit",p,e]])}return i!==void 0&&(s.end=Object.assign({},gd(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function dM(t,e,n,r,i){const s=[],o=gd(e.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),r.end=Object.assign({},o),s.push(["exit",r,e]),t.add(n+1,0,s)}function gd(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const C2e={name:"tasklistCheck",tokenize:A2e};function E2e(){return{text:{91:C2e}}}function A2e(t,e,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return Sn(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):n(l)}function a(l){return bt(l)?e(l):_t(l)?t.check({tokenize:P2e},e,n)(l):n(l)}}function P2e(t,e,n){return Jt(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function M2e(t){return IV([e2e(),u2e(),x2e(t),k2e(),E2e()])}const T2e={};function SD(t){const e=this,n=t||T2e,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(M2e(n)),s.push(Yge()),o.push(Gge(n))}const fM=600;function R2e(t,e){const n=t===""?[]:t.split(`
148
148
  `),r=e===""?[]:e.split(`
149
- `);if(n.length>fM||r.length>fM)return[...n.map(f=>({type:"del",text:f})),...r.map(f=>({type:"add",text:f}))];const i=n.length,s=r.length,o=Array.from({length:i+1},()=>new Array(s+1).fill(0));for(let f=i-1;f>=0;f--)for(let p=s-1;p>=0;p--)o[f][p]=n[f]===r[p]?o[f+1][p+1]+1:Math.max(o[f+1][p],o[f][p+1]);const a=[];let l=0,u=0;for(;l<i&&u<s;)n[l]===r[u]?(a.push({type:"same",text:n[l]}),l++,u++):o[l+1][u]>=o[l][u+1]?(a.push({type:"del",text:n[l]}),l++):(a.push({type:"add",text:r[u]}),u++);for(;l<i;)a.push({type:"del",text:n[l++]});for(;u<s;)a.push({type:"add",text:r[u++]});return a}function j2e(t,e=2){const n=new Array(t.length).fill(!1);t.forEach((s,o)=>{if(s.type!=="same")for(let a=Math.max(0,o-e);a<=Math.min(t.length-1,o+e);a++)n[a]=!0});const r=[];let i=0;return t.forEach((s,o)=>{n[o]?(i>0&&r.push({type:"skip",count:i}),i=0,r.push(s)):i++}),i>0&&r.push({type:"skip",count:i}),r}const I2e="",CD="/login",$2e=new Set(["/v1/auth/login","/v1/auth/logout","/v1/auth/whoami","/health"]);function L2e(t){if(typeof window>"u"||window.location.pathname===CD)return!1;for(const e of $2e)if(t.startsWith(e))return!1;return!0}async function It(t,e){const n=new Headers(e==null?void 0:e.headers);(e==null?void 0:e.body)!==void 0&&(e==null?void 0:e.body)!==null&&!n.has("content-type")&&n.set("content-type","application/json");const r=await fetch(`${I2e}${t}`,{...e,credentials:"include",headers:n});if(r.status===401&&L2e(t)){const i=window.location.pathname+window.location.search;throw window.location.href=`${CD}?next=${encodeURIComponent(i)}`,new Error("unauthenticated")}if(!r.ok){let i="";try{i=await r.text()}catch{}throw new Error(`${(e==null?void 0:e.method)??"GET"} ${t} -> ${r.status} ${i}`)}if(r.status!==204)return await r.json()}const Zt={health:()=>It("/health"),listProjects:(t={})=>{const e=new URLSearchParams;t.includeArchived&&e.set("includeArchived","true");const n=e.size?`?${e.toString()}`:"";return It(`/v1/projects${n}`)},getProject:t=>It(`/v1/projects/${t}`),getProjectByKey:t=>It(`/v1/projects/by-key/${encodeURIComponent(t)}`),createProject:t=>It("/v1/projects",{method:"POST",body:JSON.stringify(t)}),updateProject:(t,e)=>It(`/v1/projects/${t}`,{method:"PATCH",body:JSON.stringify(e)}),openingBrief:(t,e=10)=>It(`/v1/projects/${t}/opening-brief`,{method:"POST",body:JSON.stringify({recentLimit:e})}),getEntity:t=>It(`/v1/entities/${t}`),entityRevisions:t=>It(`/v1/entities/${t}/revisions`),getEntityByKey:(t,e)=>It(`/v1/projects/by-key/${encodeURIComponent(t)}/entities/by-seq/${e}`),createTask:t=>It("/v1/tasks",{method:"POST",body:JSON.stringify(t)}),createNote:t=>It("/v1/notes",{method:"POST",body:JSON.stringify(t)}),writeEntity:t=>{if(t.kind==="task"){const{kind:r,...i}=t;return It("/v1/tasks",{method:"POST",body:JSON.stringify(i)})}const{kind:e,...n}=t;return It("/v1/notes",{method:"POST",body:JSON.stringify(n)})},updateEntity:(t,e)=>It(`/v1/entities/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteEntity:t=>It(`/v1/entities/${t}`,{method:"DELETE"}),purgeEntity:t=>It(`/v1/entities/${t}?purge=true`,{method:"DELETE"}),restoreEntity:t=>It(`/v1/entities/${t}/restore`,{method:"POST"}),listTrash:(t=100)=>It(`/v1/trash?limit=${t}`),childEntities:t=>It(`/v1/entities/${t}/children`),listComments:(t,e=500)=>It(`/v1/entities/${t}/comments?limit=${e}`),addComment:(t,e)=>It(`/v1/entities/${t}/comments`,{method:"POST",body:JSON.stringify(e)}),recent:(t={})=>It("/v1/recent",{method:"POST",body:JSON.stringify(t)}),search:t=>It("/v1/search",{method:"POST",body:JSON.stringify(t)}),listFeedback:(t={})=>{const e=new URLSearchParams;t.category&&e.set("category",t.category),t.status&&e.set("status",t.status),t.limit&&e.set("limit",String(t.limit));const n=e.size?`?${e.toString()}`:"";return It(`/v1/feedback${n}`)},getEmbeddingSettings:()=>It("/v1/settings/embedding"),updateEmbeddingSettings:t=>It("/v1/settings/embedding",{method:"PATCH",body:JSON.stringify(t)}),backfillEmbeddings:t=>It("/v1/settings/embedding/backfill",{method:"POST",body:JSON.stringify(t==null?{}:{limit:t})}),getWorkspaceSettings:()=>It("/v1/settings/workspace"),updateWorkspaceSettings:t=>It("/v1/settings/workspace",{method:"PATCH",body:JSON.stringify(t)}),tasksRange:t=>It("/v1/tasks/range",{method:"POST",body:JSON.stringify(t)}),configureRecurrence:(t,e)=>It(`/v1/tasks/${t}/recurrence`,{method:"POST",body:JSON.stringify(e)}),getRecurrence:t=>It(`/v1/tasks/${t}/recurrence`),skipOccurrence:(t,e)=>It(`/v1/tasks/${t}/skip-occurrence`,{method:"POST",body:JSON.stringify(e?{reason:e,actorKind:"human"}:{actorKind:"human"})}),stopRecurrence:(t,e)=>It(`/v1/recurrences/${t}/stop`,{method:"POST",body:JSON.stringify(e?{reason:e}:{})}),splitRecurrence:(t,e)=>It(`/v1/recurrences/${t}/split`,{method:"POST",body:JSON.stringify(e)}),listTokens:()=>It("/v1/tokens"),createToken:t=>It("/v1/tokens",{method:"POST",body:JSON.stringify({name:t})}),revokeToken:t=>It(`/v1/tokens/${t}`,{method:"DELETE"}),login:t=>It("/v1/auth/login",{method:"POST",body:JSON.stringify({password:t})}),logout:()=>It("/v1/auth/logout",{method:"POST"}),whoami:()=>It("/v1/auth/whoami")},R1=3e4;function N2e(){return Mr({queryKey:["health"],queryFn:Zt.health,staleTime:5*6e4})}function Qi(t={}){const e=!!t.includeArchived;return Mr({queryKey:["projects",e],queryFn:()=>Zt.listProjects({includeArchived:e})})}function Q2e(t){return Mr({queryKey:["project",t],queryFn:()=>Zt.getProject(t),enabled:!!t})}function ED(t){return Mr({queryKey:["project","by-key",t],queryFn:()=>Zt.getProjectByKey(t),enabled:!!t})}function hM(t){return Mr({queryKey:["entity",t],queryFn:()=>Zt.getEntity(t),enabled:!!t})}function Z2e(t,e={}){return Mr({queryKey:["revisions",t],queryFn:()=>Zt.entityRevisions(t),enabled:!!t&&(e.enabled??!0)})}function pM(t){return Mr({queryKey:["children",t],queryFn:()=>Zt.childEntities(t),enabled:!!t})}function V2e(t,e={}){return Mr({queryKey:["comments",t],queryFn:()=>Zt.listComments(t),enabled:!!t&&(e.enabled??!0)})}function D2e(){const t=lr();return Dr({mutationFn:({parentId:e,input:n})=>Zt.addComment(e,n),onSuccess:(e,{parentId:n})=>{t.invalidateQueries({queryKey:["comments",n]}),t.invalidateQueries({queryKey:["opening-brief",e.projectId??void 0]}),t.invalidateQueries({queryKey:["recent"]})}})}function H2e(t,e={}){return Mr({queryKey:["recent",t],queryFn:()=>Zt.recent(t),refetchInterval:e.poll===!1?!1:R1})}function ok(t,e,n={}){return Mr({queryKey:["entity-list",t,e],queryFn:()=>Zt.recent({projectId:t??null,kinds:e??null,limit:100}),enabled:!!t,refetchInterval:n.poll===!1?!1:R1})}function AD(t){return Mr({queryKey:["search",t],queryFn:()=>Zt.search(t),enabled:!!(t&&t.query.length>0)})}function F2e(t={},e={}){return Mr({queryKey:["feedback",t],queryFn:()=>Zt.listFeedback(t),refetchInterval:e.poll===!1?!1:R1})}function PD(t=100){return Mr({queryKey:["trash",t],queryFn:()=>Zt.listTrash(t)})}const _2e=[["trash"],["tasks-range"],["recent"],["entity-list"],["feedback"]];function z2e(){const t=lr();return Dr({mutationFn:e=>Zt.restoreEntity(e),onSuccess:()=>{for(const e of _2e)t.invalidateQueries({queryKey:e})}})}function B2e(){const t=lr();return Dr({mutationFn:e=>Zt.purgeEntity(e),onSuccess:()=>{t.invalidateQueries({queryKey:["trash"]})}})}function X2e(){return Mr({queryKey:["settings","embedding"],queryFn:Zt.getEmbeddingSettings,refetchInterval:R1})}function W2e(){const t=lr();return Dr({mutationFn:e=>Zt.updateEmbeddingSettings(e),onSuccess:e=>{t.setQueryData(["settings","embedding"],e),t.invalidateQueries({queryKey:["health"]})}})}function q2e(){const t=lr();return Dr({mutationFn:e=>Zt.backfillEmbeddings(e),onSuccess:e=>{t.setQueryData(["settings","embedding"],e.settings)}})}function U2e(){return Mr({queryKey:["settings","workspace"],queryFn:Zt.getWorkspaceSettings})}function Y2e(){const t=lr();return Dr({mutationFn:e=>Zt.updateWorkspaceSettings(e),onSuccess:e=>{t.setQueryData(["settings","workspace"],e)}})}function Pu(t,e={}){return Mr({queryKey:["tasks-range",t],queryFn:()=>Zt.tasksRange(t),refetchInterval:e.poll===!1?!1:R1})}function G2e(t){return Mr({queryKey:["recurrence",t],queryFn:()=>Zt.getRecurrence(t),enabled:!!t,retry:!1})}function MD(){const t=lr();return Dr({mutationFn:({taskId:e,input:n})=>Zt.configureRecurrence(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["entity",e.currentOccurrenceId??void 0]}),t.invalidateQueries({queryKey:["recurrence"]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["entity-list"]})}})}function K2e(){const t=lr();return Dr({mutationFn:({taskId:e,reason:n})=>Zt.skipOccurrence(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["entity",e.skipped.id]}),e.next&&t.invalidateQueries({queryKey:["entity",e.next.id]}),t.invalidateQueries({queryKey:["recurrence"]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["entity-list"]})}})}function J2e(){const t=lr();return Dr({mutationFn:({ruleId:e,reason:n})=>Zt.stopRecurrence(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["recurrence"]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["entity-list"]})}})}function e8e(){const t=lr();return Dr({mutationFn:({ruleId:e,input:n})=>Zt.splitRecurrence(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["entity",e.currentOccurrenceId??void 0]}),t.invalidateQueries({queryKey:["recurrence"]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["entity-list"]})}})}function t8e(){const t=lr();return Dr({mutationFn:e=>Zt.createProject(e),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]})}})}function n8e(){const t=lr();return Dr({mutationFn:({id:e,fields:n})=>Zt.updateProject(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["projects"]}),t.setQueryData(["project",e.id],e),t.invalidateQueries({queryKey:["project","by-key",e.key]}),t.invalidateQueries({queryKey:["opening-brief",e.id]})}})}function TD(){const t=lr();return Dr({mutationFn:e=>Zt.writeEntity(e),onSuccess:e=>{t.invalidateQueries({queryKey:["entity-list",e.projectId??void 0]}),t.invalidateQueries({queryKey:["opening-brief",e.projectId??void 0]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["tasks-range"]}),e.parentId&&t.invalidateQueries({queryKey:["children",e.parentId]})}})}function ec(){const t=lr();return Dr({mutationFn:({id:e,fields:n})=>Zt.updateEntity(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["entity",e.id]}),t.invalidateQueries({queryKey:["entity-list",e.projectId??void 0]}),t.invalidateQueries({queryKey:["opening-brief",e.projectId??void 0]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["children"]}),t.invalidateQueries({queryKey:["revisions",e.id]}),e.kind==="feedback"&&t.invalidateQueries({queryKey:["feedback"]})}})}function r8e(){const t=lr();return Dr({mutationFn:({id:e,agentsMd:n})=>Zt.updateProject(e,{agentsMd:n}),onSuccess:e=>{t.invalidateQueries({queryKey:["project","by-key",e.key]}),t.invalidateQueries({queryKey:["opening-brief",e.id]}),t.invalidateQueries({queryKey:["projects"]})}})}function i8e(){return Mr({queryKey:["tokens"],queryFn:Zt.listTokens})}function s8e(){const t=lr();return Dr({mutationFn:e=>Zt.createToken(e),onSuccess:()=>{t.invalidateQueries({queryKey:["tokens"]})}})}function o8e(){const t=lr();return Dr({mutationFn:e=>Zt.revokeToken(e),onSuccess:(e,n)=>{t.setQueryData(["tokens"],r=>(r==null?void 0:r.filter(i=>i.id!==n))??r),t.invalidateQueries({queryKey:["tokens"],refetchType:"active"})}})}const a8e=["task","note","comment","feedback"],l8e=["bug","feature","friction","idea"],c8e=["task","note"],RD=["planned","active","watching","paused","archived"],jD=["urgent","high","medium","low","none"],ID=["light","dark","system"],$D="botnote.colorMode",LD="(prefers-color-scheme: dark)",yb=new Set;let N8=d8e();function u8e(t){return ID.includes(t)}function d8e(){try{const t=window.localStorage.getItem($D);return u8e(t)?t:"system"}catch{return"system"}}function f8e(){return typeof window.matchMedia=="function"&&window.matchMedia(LD).matches}function h8e(t,e){return t==="system"?e?"dark":"light":t}function ak(){document.documentElement.dataset.mode=h8e(N8,f8e()),yb.forEach(t=>t())}function p8e(){return document.documentElement.dataset.mode==="dark"}function m8e(){return N8}function g8e(t){N8=t;try{window.localStorage.setItem($D,t)}catch{}ak()}function ND(t){return yb.add(t),()=>yb.delete(t)}function O8e(){if(typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(LD),e=()=>{N8==="system"&&ak()};return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function x8e(){return[c.useSyncExternalStore(ND,m8e),g8e]}function y8e(){return c.useSyncExternalStore(ND,p8e)}const QD=Be.theme({"&.cm-editor":{backgroundColor:"transparent",color:"var(--text-color-kumo-default)"},"&.cm-editor .cm-gutters":{backgroundColor:"var(--color-kumo-tint)",color:"var(--text-color-kumo-placeholder)",borderRight:"1px solid var(--color-kumo-hairline)"}}),b8e=[QD],v8e=[fV,QD];function ZD(){return y8e()?v8e:b8e}function ro(){const[t,e]=e1(),n=t.get("d"),r=c.useCallback(s=>{e(o=>{const a=new URLSearchParams(o);return a.set("d",s),a})},[e]),i=c.useCallback(()=>{e(s=>{const o=new URLSearchParams(s);return o.delete("d"),o})},[e]);return{openId:n,open:r,close:i}}function Or(t){var n;if(t.title&&t.title.trim())return t.title;const e=((n=t.body.split(`
150
- `).find(r=>r.trim()))==null?void 0:n.trim())??"";return e?e.length>60?`${e.slice(0,60)}…`:e:"Untitled"}function As(t){return!t.title||!t.title.trim()}function k8e(t,e=!1){const{overflowY:n}=hi(t);return n!=="auto"&&n!=="scroll"?!1:e?t.clientHeight>0:t.scrollHeight>t.clientHeight}function VD(t,e){const n=(e??un(t).getComputedStyle(t)).transform;let r=0,i=0,s=1;if(n&&n!=="none"){const o=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(o){const a=o[1].split(", ").map(parseFloat);a.length===6?(r=a[4],i=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],i=a[13],s=a[0])}}return{x:r,y:i,scale:s}}function ox(t,e,n){switch(t){case"up":return-n;case"down":return n;case"left":return-e;case"right":return e;default:return 0}}const lk=c.createContext(void 0);lk.displayName="ToastContext";function j1(){const t=c.useContext(lk);if(!t)throw new Error("Base UI: useToastManager must be used within <Toast.Provider>.");return t}let mM=0;function DD(t){return mM+=1,`${t}-${Math.random().toString(36).slice(2,6)}-${mM}`}function ax(t,e){if(typeof t=="string")return{description:t};if(typeof t=="function"){const n=t(e);return typeof n=="string"?{description:n}:n}return t}function lx(t){const e=new Map;let n=0,r=0;return t.forEach((i,s)=>{const o=i.transitionStatus==="ending";e.set(i.id,{value:i,domIndex:s,visibleIndex:o?-1:n,offsetY:r}),r+=i.height||0,o||(n+=1)}),e}function cx(t,e){let n=0;return t.map(r=>{if(r.transitionStatus==="ending")return r;const i=n>=e;return n+=1,r.limited===i?r:{...r,limited:i}})}const Vs={toasts:t=>t.toasts,isEmpty:t=>t.toasts.length===0,toast:(t,e)=>{var n;return(n=t.toastMetadata.get(e))==null?void 0:n.value},toastIndex:(t,e)=>{var n;return((n=t.toastMetadata.get(e))==null?void 0:n.domIndex)??-1},toastOffsetY:(t,e)=>{var n;return((n=t.toastMetadata.get(e))==null?void 0:n.offsetY)??0},toastVisibleIndex:(t,e)=>{var n;return((n=t.toastMetadata.get(e))==null?void 0:n.visibleIndex)??-1},focused:t=>t.focused,expanded:t=>t.hovering||t.focused,expandedOrOutOfFocus:t=>t.hovering||t.focused||!t.isWindowFocused,prevFocusElement:t=>t.prevFocusElement};var w8e=class extends wu{constructor(e){super({...e,toastMetadata:lx(e.toasts)},{},Vs);$t(this,"timers",new Map);$t(this,"areTimersPaused",!1);$t(this,"setViewport",e=>{this.set("viewport",e)});$t(this,"disposeEffect",()=>()=>{this.timers.forEach(e=>{var n;(n=e.timeout)==null||n.clear()}),this.timers.clear()});$t(this,"addToast",e=>{const{timeout:n,limit:r}=this.state,i=e.id||DD("toast");if(e.id){const l=Vs.toast(this.state,e.id);if(l)if(l.transitionStatus==="ending")this.removeToast(e.id,!0);else{const{id:u,transitionStatus:f,...p}=e;return this.updateToastInternal(e.id,p,!0,!0),e.id}}const s={...e,id:i,updateKey:0,transitionStatus:"starting"},o=[s,...this.state.toasts];this.setToasts(cx(o,r));const a=s.timeout??n;return s.type!=="loading"&&a>0&&this.scheduleTimer(i,a,()=>this.closeToast(i)),Vs.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i});$t(this,"updateToast",(e,n)=>{const r=Vs.toast(this.state,e);!r||r.transitionStatus==="ending"||this.updateToastInternal(e,typeof n=="function"?n(r):n,!1,!0)});$t(this,"updateToastInternal",(e,n,r=!1,i=!1)=>{const{timeout:s,toasts:o}=this.state,a=Vs.toast(this.state,e);if(!a||a.transitionStatus==="ending")return;const l={...a,...n,...i&&{updateKey:a.updateKey+1}};this.setToasts(o.map(v=>v.id===e?l:v));const u=l.timeout??s,f=a.timeout??s,p=Object.hasOwn(n,"timeout"),g=l.transitionStatus!=="ending"&&l.type!=="loading"&&u>0,O=this.timers.has(e),y=f!==u,b=a.type==="loading";if(!g&&O){this.clearTimer(e);return}g&&(!O||y||p||b||r)&&(this.clearTimer(e),this.scheduleTimer(e,u,()=>this.closeToast(e)),Vs.expandedOrOutOfFocus(this.state)&&this.pauseTimers())});$t(this,"closeToast",e=>{const n=e===void 0,{limit:r,toasts:i}=this.state;let s;if(n)s=i,this.clearTimers();else{const a=Vs.toast(this.state,e);if(!a)return;s=[a],this.clearTimer(e)}const o=cx(i.map(a=>n||a.id===e?{...a,transitionStatus:"ending",height:0}:a),r);this.setToasts(o,!o.some(a=>a.transitionStatus!=="ending")),s.forEach(a=>{var l;a.transitionStatus!=="ending"&&((l=a.onClose)==null||l.call(a))}),this.handleFocusManagement(e)});$t(this,"promiseToast",(e,n)=>{const r=ax(n.loading),i=this.addToast({...r,type:"loading"}),s=e.then(o=>{const a=ax(n.success,o);return this.updateToast(i,{...a,type:"success",timeout:a.timeout}),o}).catch(o=>{const a=ax(n.error,o);return this.updateToast(i,{...a,type:"error",timeout:a.timeout}),Promise.reject(o)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(s),s});$t(this,"handleDocumentPointerDown",e=>{if(e.pointerType!=="touch")return;const n=ln(e);Ue(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))})}syncProviderProps(e,n){const r=this.state.limit!==n;if(this.state.timeout===e&&!r)return;const i={timeout:e,limit:n};if(r){const s=cx(this.state.toasts,n);i.toasts=s,i.toastMetadata=lx(s)}this.update(i)}removeToast(e,n=!1){var o;const r=Vs.toastIndex(this.state,e);if(r===-1)return;const i=this.state.toasts[r];n||(o=i==null?void 0:i.onRemove)==null||o.call(i);const s=[...this.state.toasts];s.splice(r,1),this.setToasts(s)}pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{e.timeout&&(e.timeout.clear(),e.remaining=Math.max(e.remaining-(Date.now()-e.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,n)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??(e.timeout=qs.create()),e.timeout.start(e.remaining,()=>{this.handleTimerFired(n),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){var e;(e=this.state.prevFocusElement)==null||e.focus({preventScroll:!0})}scheduleTimer(e,n,r){const i=Date.now(),s=Vs.expandedOrOutOfFocus(this.state)?void 0:qs.create();s==null||s.start(n,()=>{this.handleTimerFired(e),r()}),this.timers.set(e,{timeout:s,start:i,delay:n,remaining:n,callback:r})}clearTimers(){this.timers.forEach(e=>{var n;(n=e.timeout)==null||n.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(e){var n,r;(r=(n=this.timers.get(e))==null?void 0:n.timeout)==null||r.clear(),this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(e){this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(e,n=e.length===0){const r={toasts:e,toastMetadata:lx(e)};n&&(r.hovering=!1,r.focused=!1),this.update(r)}handleFocusManagement(e){var a,l;const n=Gn(Ct(this.state.viewport));if(!this.state.viewport||!Ue(this.state.viewport,n)||!xg(n))return;if(e===void 0){this.restoreFocusToPrevElement();return}const r=Vs.toasts(this.state),i=Vs.toastIndex(this.state,e),s=(u,f)=>{for(let p=u;p>=0&&p<r.length;p+=f)if(r[p].transitionStatus!=="ending")return r[p];return null},o=s(i+1,1)??s(i-1,-1);o?(l=(a=o.ref)==null?void 0:a.current)==null||l.focus():this.restoreFocusToPrevElement()}};const ck=function(e){const{children:n,timeout:r=5e3,limit:i=3,toastManager:s}=e,o=Qn(()=>new w8e({timeout:r,limit:i,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return _2(o.disposeEffect),c.useEffect(function(){if(s)return s[" subscribe"](({action:l,options:u})=>{const f=u.id;l==="promise"&&u.promise?o.promiseToast(u.promise,u):l==="update"&&f?o.updateToast(f,u.updates):l==="close"?o.closeToast(f):o.addToast(u)})},[o,s]),m.jsxs(lk.Provider,{value:o,children:[m.jsx(S8e,{store:o,timeout:r,limit:i}),n]})};ck.displayName="ToastProvider";function S8e(t){const{store:e,timeout:n,limit:r}=t;return Pe(()=>{e.syncProviderProps(n,r)},[e,n,r]),null}const C8e="--toast-frontmost-height",uk=c.forwardRef(function(e,n){var X;const{render:r,className:i,style:s,children:o,...a}=e,l=j1(),u=wn(),f=c.useRef(!1),p=c.useRef(!1),g=c.useRef(!1),O=l.useState("isEmpty"),y=l.useState("toasts"),b=l.useState("focused"),v=l.useState("expanded"),w=l.useState("prevFocusElement"),C=(X=y[0])==null?void 0:X.height,S=y.some(R=>R.transitionStatus==="ending"),A=y.filter(R=>R.priority==="high");c.useEffect(()=>{const R=l.state.viewport;if(!R||O)return;const Q=un(R),F=Ct(R);function N(K){K.key==="F6"&&ln(K)!==R&&(K.preventDefault(),l.set("prevFocusElement",Gn(F)),R==null||R.focus({preventScroll:!0}),l.pauseTimers(),l.set("focused",!0))}function z(K){ln(K)===Q&&(l.set("isWindowFocused",!1),l.pauseTimers())}function J(K){if(K.relatedTarget)return;const ne=ln(K),se=Gn(Ct(R));(ne===Q||!Ue(R,ne)||!xg(se))&&l.resumeTimers(),u.start(0,()=>l.set("isWindowFocused",!0))}return zs(wt(Q,"keydown",N),wt(Q,"blur",z,!0),wt(Q,"focus",J,!0),wt(F,"pointerdown",l.handleDocumentPointerDown,!0))},[l,u,O]);function P(R){var F,N;f.current=!0;const Q=R.relatedTarget===l.state.viewport?y.find(z=>z.transitionStatus!=="ending"&&!z.limited):void 0;Q?(N=(F=Q.ref)==null?void 0:F.current)==null||N.focus():l.restoreFocusToPrevElement()}function T(R){R.key==="Tab"&&R.shiftKey&&ln(R.nativeEvent)===l.state.viewport&&(R.preventDefault(),l.restoreFocusToPrevElement())}function $(){l.state.toasts.some(R=>R.transitionStatus==="ending")||g.current||!p.current||(l.state.isWindowFocused&&l.resumeTimers(),l.set("hovering",!1),p.current=!1)}c.useEffect($,[S,l]);function I(){l.pauseTimers(),l.set("hovering",!0),p.current=!1}function L(){l.state.isWindowFocused&&l.resumeTimers()}function M(){p.current=!0,$()}function V(R){R.pointerType==="touch"&&(g.current=!0)}function Z(R){R.pointerType==="touch"&&(g.current=!1,$())}function D(){if(f.current){f.current=!1;return}b||xg(Gn(Ct(l.state.viewport)))&&(l.set("focused",!0),l.pauseTimers())}function B(R){!b||Ue(l.state.viewport,R.relatedTarget)||(l.set("focused",!1),L())}const H={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:I,onMouseMove:I,onMouseLeave:M,onFocus:D,onBlur:B,onKeyDown:T,onClick:D,onPointerDown:V,onPointerUp:Z,onPointerCancel:Z,style:{[C8e]:C?`${C}px`:void 0}},U={expanded:v},q=!O&&w&&m.jsx(Ll,{onFocus:P}),W=He("div",e,{ref:[n,l.setViewport],state:U,props:[H,a,{children:m.jsxs(c.Fragment,{children:[q,o,q]})}]});return m.jsxs(c.Fragment,{children:[q,W,!b&&A.length>0&&m.jsx("div",{style:ku,children:A.map(R=>m.jsxs("div",{role:"alert","aria-atomic":!0,children:[m.jsx("div",{children:R.title}),m.jsx("div",{children:R.description})]},R.id))})]})});uk.displayName="ToastViewport";const dk=c.createContext(void 0);dk.displayName="ToastRootContext";function Q8(){const t=c.useContext(dk);if(!t)throw new Error("Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.");return t}const HD="--toast-index",E8e="--toast-offset-y",A8e="--toast-height",P8e="--toast-swipe-movement-x",M8e="--toast-swipe-movement-y",T8e="data-swipe-direction",R8e={...is,swipeDirection(t){return t?{[T8e]:t}:null}},gM=40,j8e=10,OM=.5,I8e=1,$8e=`${jY},${IY}`,fk=c.forwardRef(function(e,n){var Me;const{toast:r,render:i,className:s,swipeDirection:o=["down","right"],style:a,...l}=e,u=((Me=r.positionerProps)==null?void 0:Me.anchor)!==void 0;let f=[];u||(f=Array.isArray(o)?o:[o]);const p=f.length>0,g=j1(),[O,y]=c.useState(void 0),[b,v]=c.useState(!1),[w,C]=c.useState(!1),[S,A]=c.useState({x:0,y:0}),[P,T]=c.useState({x:0,y:0,scale:1}),[$,I]=c.useState(),[L,M]=c.useState(),[V,Z]=c.useState(null),D=c.useRef(null),B=c.useRef(void 0),H=c.useRef({x:0,y:0}),U=c.useRef({x:0,y:0,scale:1}),q=c.useRef(void 0),W=c.useRef(0),X=c.useRef(!1),R=c.useRef({x:0,y:0}),Q=c.useRef(!1),F=c.useRef({x:0,y:0}),N=c.useRef(null),z=c.useRef(null),J=g.useState("toastIndex",r.id),K=g.useState("toastVisibleIndex",r.id),ne=g.useState("toastOffsetY",r.id),se=g.useState("focused"),ie=g.useState("expanded");Hr({open:r.transitionStatus!=="ending",ref:D,onComplete(){r.transitionStatus==="ending"&&g.removeToast(r.id)}});const he=Ee((oe=!1)=>{const ge=D.current;if(!ge)return;const Y=ge.style.height;ge.style.height="auto";const G=ge.offsetHeight;ge.style.height=Y;function de(){g.updateToastInternal(r.id,{ref:D,height:G,transitionStatus:void 0})}oe?ts.flushSync(de):de()});Pe(()=>{const oe=B.current;r.transitionStatus!=="starting"&&oe===r.id||(oe!==void 0&&(y(void 0),T({x:0,y:0,scale:1}),Se({x:0,y:0})),B.current=r.id,he())},[he,r.id,r.transitionStatus]);function Se(oe){F.current=oe,A(oe)}Pe(()=>()=>{var oe;(oe=z.current)==null||oe.abort()},[]);function Oe(oe,ge){const Y=Ae=>Ae>0?Ae**OM:-(Math.abs(Ae)**OM),G=oe>0&&!f.includes("right")||oe<0&&!f.includes("left"),de=ge>0&&!f.includes("down")||ge<0&&!f.includes("up");return{x:G?Y(oe):oe,y:de?Y(ge):ge}}const be=Ee(oe=>{var Re;if(oe.pointerId!==N.current)return;N.current=null,(Re=z.current)==null||Re.abort(),z.current=null,v(!1),C(!1),Z(null);const ge=U.current;if(oe.type==="pointercancel"||X.current){Se({x:ge.x,y:ge.y}),y(void 0);return}const Y=F.current,G=Y.x-ge.x,de=Y.y-ge.y;let Ae;for(const Ge of f)if(ox(Ge,G,de)>gM){Ae=Ge;break}Ae?(y(Ae),g.closeToast(r.id)):(Se({x:ge.x,y:ge.y}),y(void 0))});function me(oe){var Ae,Re,Ge;if(oe.button!==0||(oe.pointerType==="touch"&&g.pauseTimers(),(Ae=ln(oe.nativeEvent))!=null&&Ae.closest(`button,a,input,textarea,[role="button"],${$8e}`)))return;X.current=!1,q.current=void 0,W.current=0,N.current=oe.pointerId,H.current={x:oe.clientX,y:oe.clientY},R.current=H.current;const ge=oe.currentTarget,Y=VD(ge);U.current=Y,T(Y),Se({x:Y.x,y:Y.y}),g.set("hovering",!0),v(!0),C(!1),Z(null),Q.current=!0,(Re=z.current)==null||Re.abort();const G=new AbortController;z.current=G;const de=Ct(ge);de.addEventListener("pointerup",be,{signal:G.signal}),de.addEventListener("pointercancel",be,{signal:G.signal}),(Ge=ge.setPointerCapture)==null||Ge.call(ge,oe.pointerId)}function ue(oe){if(oe.pointerId!==N.current)return;oe.preventDefault(),Q.current&&(H.current={x:oe.clientX,y:oe.clientY},Q.current=!1);const{clientY:ge,clientX:Y,movementX:G,movementY:de}=oe;(de<0&&ge>R.current.y||de>0&&ge<R.current.y)&&(R.current={x:R.current.x,y:ge}),(G<0&&Y>R.current.x||G>0&&Y<R.current.x)&&(R.current={x:Y,y:R.current.y});const Ae=Y-H.current.x,Re=ge-H.current.y,Ge=ge-R.current.y,dt=Y-R.current.x;let Te=V;if(!w&&Math.sqrt(Ae*Ae+Re*Re)>=I8e){C(!0);const Mt=f.includes("left")||f.includes("right"),Ht=f.includes("up")||f.includes("down");Mt&&Ht&&(Te=Math.abs(Ae)>Math.abs(Re)?"horizontal":"vertical",Z(Te))}let Ke;if(!q.current)Te==="vertical"?Re>0?Ke="down":Re<0&&(Ke="up"):Te==="horizontal"?Ae>0?Ke="right":Ae<0&&(Ke="left"):Math.abs(Ae)>=Math.abs(Re)?Ke=Ae>0?"right":"left":Ke=Re>0?"down":"up",Ke&&f.includes(Ke)&&(q.current=Ke,W.current=ox(Ke,Ae,Re),y(Ke));else{const Mt=q.current,Ht=ox(Mt,dt,Ge);Ht>gM?(X.current=!1,y(Mt)):!(f.includes("left")&&f.includes("right"))&&!(f.includes("up")&&f.includes("down"))&&W.current-Ht>=j8e&&(X.current=!0)}const gt=Oe(Ae,Re);let Pt=U.current.x,jt=U.current.y;const et=f.includes("left")||f.includes("right"),Yt=f.includes("up")||f.includes("down");Te!=="vertical"&&et&&(Pt+=gt.x),Te!=="horizontal"&&Yt&&(jt+=gt.y),Se({x:Pt,y:jt})}function ve(oe){if(oe.key==="Escape"){if(!D.current||!Ue(D.current,Gn(Ct(D.current))))return;g.closeToast(r.id)}}c.useEffect(()=>{const oe=D.current;if(!p||!oe)return;function ge(Y){N.current===null||!Ue(oe,ln(Y))||Y.preventDefault()}return wt(oe,"touchmove",ge,{passive:!1})},[p]);function xe(){const oe=S.x-P.x,ge=S.y-P.y;return{transition:b?"none":void 0,transform:b?`translateX(${S.x}px) translateY(${S.y}px) scale(${P.scale})`:void 0,[P8e]:`${oe}px`,[M8e]:`${ge}px`}}const Ce=r.priority==="high",we={role:Ce?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":$,"aria-describedby":L,"aria-hidden":Ce&&!se?!0:void 0,onPointerDown:p?me:void 0,onPointerMove:p?ue:void 0,onPointerUp:p?be:void 0,onPointerCancel:p?be:void 0,onKeyDown:ve,inert:C1(r.limited),style:{...xe(),[HD]:r.transitionStatus==="ending"?J:K,[E8e]:`${ne}px`,[A8e]:r.height?`${r.height}px`:void 0}},Le=c.useMemo(()=>({toast:r,setTitleId:I,setDescriptionId:M,recalculateHeight:he,visibleIndex:K,expanded:ie}),[r,I,M,he,K,ie]),Ie={transitionStatus:r.transitionStatus,expanded:ie,limited:r.limited||!1,type:r.type,swiping:b,swipeDirection:O},Fe=He("div",e,{ref:[n,D],state:Ie,stateAttributesMapping:R8e,props:[we,l]});return m.jsx(dk.Provider,{value:Le,children:Fe})});fk.displayName="ToastRoot";function FD(t){return t==null||typeof t=="boolean"||t===""?!1:Array.isArray(t)?t.some(FD):!0}function _D(t){return c.isValidElement(t)&&FD(t.props.children)}function zD(t,e,n){const{toast:r,setTitleId:i,setDescriptionId:s}=Q8(),o=n==="title"?i:s,a=e??(n==="title"?r.title:r.description);return{id:$l(t),children:a,type:r.type,setId:o}}function BD(t,e,n){const r=_D(t);return Pe(()=>{if(r)return n(e),()=>{n(i=>i===e?void 0:i)}},[r,e,n]),r?t:null}const hk=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,children:a,...l}=e,{id:u,children:f,type:p,setId:g}=zD(o,a,"description");return BD(He("p",e,{ref:n,state:{type:p},props:{...l,id:u,children:f}}),u,g)});hk.displayName="ToastDescription";const pk=c.createContext(void 0);pk.displayName="ToastPositionerContext";function L8e(){const t=c.useContext(pk);if(t===void 0)throw new Error("Base UI: ToastPositionerContext is missing. ToastPositioner parts must be placed within <Toast.Positioner>.");return t}const XD=c.forwardRef(function(e,n){const{toast:r,...i}=e,s=j1(),o=r.positionerProps??Ut,{render:a,className:l,anchor:u=o.anchor,positionMethod:f=o.positionMethod??"absolute",side:p=o.side??"top",align:g=o.align??"center",sideOffset:O=o.sideOffset??0,alignOffset:y=o.alignOffset??0,collisionBoundary:b=o.collisionBoundary??"clipping-ancestors",collisionPadding:v=o.collisionPadding??5,arrowPadding:w=o.arrowPadding??5,sticky:C=o.sticky??!1,disableAnchorTracking:S=o.disableAnchorTracking??!1,collisionAvoidance:A=o.collisionAvoidance??yv,style:P,...T}=i,[$,I]=c.useState(null),L=s.useState("toastIndex",r.id),M=s.useState("toastVisibleIndex",r.id),V=Nt(u)?u:null,Z=Lv({open:!0,onOpenChange:qt,elements:{floating:$,reference:V}}),D=d1({anchor:V,positionMethod:f,floatingRootContext:Z,mounted:!0,side:p,sideOffset:O,align:g,alignOffset:y,collisionBoundary:b,collisionPadding:v,sticky:C,arrowPadding:w,disableAnchorTracking:S,keepMounted:!0,collisionAvoidance:A}),B={side:D.side,align:D.align,anchorHidden:D.anchorHidden},H=h1(e,B,{styles:{...D.positionerStyles,[HD]:r.transitionStatus==="ending"?L:M},transitionStatus:r.transitionStatus,props:T,refs:[n,I]});return m.jsx(pk.Provider,{value:D,children:H})});XD.displayName="ToastPositioner";function WD(){const t=j1(),e=t.useState("toasts");return c.useMemo(()=>({toasts:e,add:t.addToast,close:t.closeToast,update:t.updateToast,promise:t.promiseToast}),[e,t])}function qD(){const t=new Set;function e(n){t.forEach(r=>r(n))}return{" subscribe":function(r){return t.add(r),()=>{t.delete(r)}},add(n){const r=n.id||DD("toast");return e({action:"add",options:{...n,id:r,transitionStatus:"starting"}}),r},close(n){e({action:"close",options:{id:n}})},update(n,r){e({action:"update",options:{id:n,updates:r}})},promise(n,r){let i=n;return e({action:"promise",options:{...r,promise:n,setPromise(s){i=s}}}),i}}}const UD=c.forwardRef(function(e,n){const{render:r,className:i,style:s,...o}=e,{visibleIndex:a,expanded:l,recalculateHeight:u}=Q8(),f=c.useRef(null);return Pe(()=>{u();const p=f.current;if(!p||typeof ResizeObserver!="function"||typeof MutationObserver!="function")return;const g=new ResizeObserver(()=>u(!0)),O=new MutationObserver(()=>u(!0));return g.observe(p),O.observe(p,{childList:!0,subtree:!0,characterData:!0}),()=>{g.disconnect(),O.disconnect()}},[u]),He("div",e,{ref:[n,f],state:{expanded:l,behind:a>0},props:o})});UD.displayName="ToastContent";const YD=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,children:a,...l}=e,{id:u,children:f,type:p,setId:g}=zD(o,a,"title"),O=He("h2",e,{ref:n,state:{type:p},props:{...l,id:u,children:f}});return BD(O,u,g)});YD.displayName="ToastTitle";const GD=c.forwardRef(function(e,n){const{render:r,className:i,style:s,disabled:o,nativeButton:a=!0,...l}=e,u=j1(),{toast:f,expanded:p}=Q8(),[g,O]=c.useState(!1),{getButtonProps:y,buttonRef:b}=Tr({disabled:o,native:a}),v={type:f.type};return He("button",e,{ref:[n,b],state:v,props:[{"aria-hidden":!p&&!g,onClick(){u.closeToast(f.id)},onFocus(){O(!0)},onBlur(){O(!1)}},l,y]})});GD.displayName="ToastClose";const N8e=c.forwardRef(function(e,n){var b;const{render:r,className:i,style:s,disabled:o,nativeButton:a=!0,...l}=e,{toast:u}=Q8(),f=((b=u.actionProps)==null?void 0:b.children)??l.children,{getButtonProps:p,buttonRef:g}=Tr({disabled:o,native:a}),O={type:u.type},y=He("button",e,{ref:[n,g],state:O,props:[l,u.actionProps,p,{children:f}]});return _D(y)?y:null});N8e.displayName="ToastAction";const KD=c.forwardRef(function(e,n){return m.jsx(Nv,{ref:n,...e})});KD.displayName="ToastPortal";const Q8e=c.forwardRef(function(e,n){const{className:r,render:i,style:s,...o}=e,{arrowRef:a,side:l,align:u,arrowUncentered:f,arrowStyles:p}=L8e();return He("div",e,{state:{side:l,align:u,uncentered:f},ref:[n,a],props:[{style:p,"aria-hidden":!0},o]})});Q8e.displayName="ToastArrow";const T0=c.forwardRef((t,e)=>{const{alt:n,color:r="currentColor",size:i="1em",weight:s="regular",mirrored:o=!1,children:a,weights:l,...u}=t;return c.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,fill:r,viewBox:"0 0 256 256",transform:o?"scale(-1, 1)":void 0,...u},!!n&&c.createElement("title",null,n),a,l.get(s))});T0.displayName="SSRBase";const Z8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),c.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),JD=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:Z8e}));JD.displayName="CheckCircleIcon";const V8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),c.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),eH=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:V8e}));eH.displayName="InfoIcon";const D8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),c.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),tH=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:D8e}));tH.displayName="WarningIcon";const H8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M116,132V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0ZM236,91.55v72.9a19.86,19.86,0,0,1-5.86,14.14l-51.55,51.55A19.85,19.85,0,0,1,164.45,236H91.55a19.85,19.85,0,0,1-14.14-5.86L25.86,178.59A19.86,19.86,0,0,1,20,164.45V91.55a19.86,19.86,0,0,1,5.86-14.14L77.41,25.86A19.85,19.85,0,0,1,91.55,20h72.9a19.85,19.85,0,0,1,14.14,5.86l51.55,51.55A19.86,19.86,0,0,1,236,91.55Zm-24,1.66L162.79,44H93.21L44,93.21v69.58L93.21,212h69.58L212,162.79ZM128,156a16,16,0,1,0,16,16A16,16,0,0,0,128,156Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M224,91.55v72.9a8,8,0,0,1-2.34,5.66l-51.55,51.55a8,8,0,0,1-5.66,2.34H91.55a8,8,0,0,1-5.66-2.34L34.34,170.11A8,8,0,0,1,32,164.45V91.55a8,8,0,0,1,2.34-5.66L85.89,34.34A8,8,0,0,1,91.55,32h72.9a8,8,0,0,1,5.66,2.34l51.55,51.55A8,8,0,0,1,224,91.55Z",opacity:"0.2"}),c.createElement("path",{d:"M120,136V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0ZM232,91.55v72.9a15.86,15.86,0,0,1-4.69,11.31l-51.55,51.55A15.86,15.86,0,0,1,164.45,232H91.55a15.86,15.86,0,0,1-11.31-4.69L28.69,175.76A15.86,15.86,0,0,1,24,164.45V91.55a15.86,15.86,0,0,1,4.69-11.31L80.24,28.69A15.86,15.86,0,0,1,91.55,24h72.9a15.86,15.86,0,0,1,11.31,4.69l51.55,51.55A15.86,15.86,0,0,1,232,91.55Zm-16,0L164.45,40H91.55L40,91.55v72.9L91.55,216h72.9L216,164.45ZM128,160a12,12,0,1,0,12,12A12,12,0,0,0,128,160Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M227.31,80.23,175.77,28.69A16.13,16.13,0,0,0,164.45,24H91.55a16.13,16.13,0,0,0-11.32,4.69L28.69,80.23A16.13,16.13,0,0,0,24,91.55v72.9a16.13,16.13,0,0,0,4.69,11.32l51.54,51.54A16.13,16.13,0,0,0,91.55,232h72.9a16.13,16.13,0,0,0,11.32-4.69l51.54-51.54A16.13,16.13,0,0,0,232,164.45V91.55A16.13,16.13,0,0,0,227.31,80.23ZM120,80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M122,136V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0ZM230,91.55v72.9a13.92,13.92,0,0,1-4.1,9.9L174.35,225.9a13.92,13.92,0,0,1-9.9,4.1H91.55a13.92,13.92,0,0,1-9.9-4.1L30.1,174.35a13.92,13.92,0,0,1-4.1-9.9V91.55a13.92,13.92,0,0,1,4.1-9.9L81.65,30.1a13.92,13.92,0,0,1,9.9-4.1h72.9a13.92,13.92,0,0,1,9.9,4.1L225.9,81.65A13.92,13.92,0,0,1,230,91.55Zm-12,0a2,2,0,0,0-.59-1.42L165.87,38.59a2,2,0,0,0-1.42-.59H91.55a2,2,0,0,0-1.41.59L38.58,90.13A2,2,0,0,0,38,91.55v72.9a2,2,0,0,0,.59,1.42l51.54,51.54a2,2,0,0,0,1.42.59h72.9a2,2,0,0,0,1.41-.59l51.56-51.54a2,2,0,0,0,.58-1.42ZM128,162a10,10,0,1,0,10,10A10,10,0,0,0,128,162Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M120,136V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0ZM232,91.55v72.9a15.86,15.86,0,0,1-4.69,11.31l-51.55,51.55A15.86,15.86,0,0,1,164.45,232H91.55a15.86,15.86,0,0,1-11.31-4.69L28.69,175.76A15.86,15.86,0,0,1,24,164.45V91.55a15.86,15.86,0,0,1,4.69-11.31L80.24,28.69A15.86,15.86,0,0,1,91.55,24h72.9a15.86,15.86,0,0,1,11.31,4.69l51.55,51.55A15.86,15.86,0,0,1,232,91.55Zm-16,0L164.45,40H91.55L40,91.55v72.9L91.55,216h72.9L216,164.45ZM128,160a12,12,0,1,0,12,12A12,12,0,0,0,128,160Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M124,136V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0ZM228,91.55v72.9a12,12,0,0,1-3.51,8.49l-51.55,51.55a12,12,0,0,1-8.49,3.51H91.55a12,12,0,0,1-8.49-3.51L31.51,172.94A12,12,0,0,1,28,164.45V91.55a12,12,0,0,1,3.51-8.49L83.06,31.51A12,12,0,0,1,91.55,28h72.9a12,12,0,0,1,8.49,3.51l51.55,51.55A12,12,0,0,1,228,91.55Zm-8,0a4,4,0,0,0-1.17-2.83L167.28,37.17A4.06,4.06,0,0,0,164.45,36H91.55a4.06,4.06,0,0,0-2.83,1.17L37.17,88.72A4,4,0,0,0,36,91.55v72.9a4,4,0,0,0,1.17,2.83l51.55,51.55A4.06,4.06,0,0,0,91.55,220h72.9a4.06,4.06,0,0,0,2.83-1.17l51.55-51.55a4,4,0,0,0,1.17-2.83ZM128,164a8,8,0,1,0,8,8A8,8,0,0,0,128,164Z"}))]]),nH=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:H8e}));nH.displayName="WarningOctagonIcon";const F8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),c.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),rH=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:F8e}));rH.displayName="XIcon";const iH={variant:{default:{classes:"border-kumo-fill bg-kumo-base",description:"Default toast style"},success:{classes:"ring-[0.3px] ring-kumo-success bg-kumo-base [&_[data-toast-icon]]:text-kumo-success [&_[data-toast-title]]:text-kumo-success",description:"Success toast for confirmations and positive outcomes",icon:JD},error:{classes:"ring-[0.3px] ring-kumo-danger bg-kumo-base [&_[data-toast-icon]]:text-kumo-danger [&_[data-toast-title]]:text-kumo-danger",description:"Error toast for critical issues",icon:nH},warning:{classes:"ring-[0.3px] ring-kumo-warning bg-kumo-base [&_[data-toast-icon]]:text-kumo-warning [&_[data-toast-title]]:text-kumo-warning",description:"Warning toast for cautionary messages",icon:tH},info:{classes:"ring-[0.3px] ring-kumo-info bg-kumo-control [&_[data-toast-icon]]:text-kumo-info [&_[data-toast-title]]:text-kumo-info",description:"Info toast for neutral informational messages",icon:eH}}},bb={variant:"default"};function _8e({variant:t=bb.variant}={}){return le("rounded-xl ring ring-kumo-line bg-clip-padding p-4 shadow-lg",sr(iH.variant,t,bb.variant).classes)}function sH(t){return{...t,add:e=>{if(e.id){const n=t.toasts;if(n){const r=n.find(i=>i.id===e.id);if(r&&r.transitionStatus!=="ending")return t.update(e.id,{bump:!1}),requestAnimationFrame(()=>{t.update(e.id,{bump:!0,...e.timeout!==void 0&&{timeout:e.timeout}})}),e.id;if(r&&r.transitionStatus==="ending")return e.id}}return t.add({...e})},update:(e,n)=>t.update(e,typeof n=="function"?r=>n(r):{...n}),promise:(e,n)=>t.promise(e,{loading:{...n.loading},success:typeof n.success=="function"?r=>({...n.success(r)}):{...n.success},error:typeof n.error=="function"?r=>({...n.error(r)}):{...n.error}})}}const z8e=()=>{const t=WD();return{...sH(t),toasts:t.toasts}},B8e=()=>sH(qD());function X8e({children:t,container:e,toastManager:n}){const r=vu();return m.jsxs(ck,{toastManager:n,children:[t,m.jsx(KD,{container:e??r??void 0,children:m.jsx(uk,{className:"fixed top-auto right-4 bottom-4 z-1 mx-auto flex w-[calc(100%-2rem)] sm:right-8 sm:bottom-8 sm:w-[340px]",children:m.jsx(W8e,{})})})]})}function W8e(){const{toasts:t}=z8e();return t.map(e=>m.jsxs(fk,{toast:e,className:le("absolute right-0 bottom-0 left-auto z-[calc(1000-var(--toast-index))] mr-0 h-[var(--height)] w-full origin-bottom select-none",_8e({variant:e.variant}),"[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]","[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,height_0.15s]","after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']","data-[ending-style]:opacity-0 data-[expanded]:h-[var(--toast-height)] data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--offset-y)))] data-[limited]:opacity-0 data-[starting-style]:[transform:translateY(150%)]","data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))] data-[expanded]:data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]","data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-[expanded]:data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]","data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]","data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))] data-[expanded]:data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]","[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",e.bump&&"animate-toast-bump"),children:[m.jsx(Y8e,{variant:e.variant}),m.jsxs(UD,{className:"isolate flex flex-col gap-1 transition-opacity [transition-duration:250ms] data-[behind]:pointer-events-none data-[behind]:opacity-0 data-[expanded]:pointer-events-auto data-[expanded]:opacity-100",children:[e.content??m.jsx(m.Fragment,{children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(G8e,{variant:e.variant}),m.jsxs("div",{className:"flex flex-col gap-1 overflow-hidden",children:[m.jsx(YD,{"data-toast-title":!0,className:"text-[0.975rem] leading-5 font-medium text-kumo-default"}),m.jsx(hk,{className:"text-[0.925rem] leading-5 text-kumo-default/70"}),!!e.actions&&m.jsx("div",{className:"mt-2 flex min-w-0 flex-nowrap gap-2 overflow-x-auto p-px",children:e.actions.map((n,r)=>m.jsx(nt,{...n},r))})]})]})}),m.jsx(GD,{"data-kumo-part":"close","aria-label":"Close",render:m.jsx(nt,{variant:"ghost",size:"sm",shape:"square","aria-label":"Close",className:le("absolute top-2 right-2 size-5 rounded text-kumo-subtle hover:bg-current/15",e.variant&&q8e[e.variant]),icon:m.jsx(rH,{className:"h-3 w-3"})})})]})]},e.id))}const q8e={success:"text-kumo-success",error:"text-kumo-danger",warning:"text-kumo-warning",info:"text-kumo-info"},U8e={success:"bg-kumo-success-tint/20",error:"bg-kumo-danger-tint/50",warning:"bg-kumo-warning-tint/50",info:"bg-kumo-info-tint/50"};function Y8e({variant:t}){const e=t&&U8e[t];return m.jsx("div",{className:le("absolute inset-0 rounded-xl bg-kumo-base/90",e)})}function G8e({variant:t}){if(!t||t==="default")return null;const e=sr(iH.variant,t,bb.variant);if(!("icon"in e))return null;const n=e.icon;return m.jsx(n,{"data-toast-icon":!0,className:"mt-0.5 h-4 w-4 shrink-0",weight:"fill"})}const oH=c.createContext(null),K8e=6e3;function J8e({children:t}){const[e]=c.useState(B8e),n=c.useMemo(()=>({show:({message:r,description:i,action:s,onExpire:o,duration:a=K8e})=>{let l=!1;const u=e.add({title:r,description:i,timeout:a,actions:s&&[{children:s.label,size:"sm",variant:"secondary",onClick:()=>{l=!0,s.onClick(),e.close(u)}}],onClose:()=>{l||o==null||o()}})}}),[e]);return m.jsx(oH.Provider,{value:n,children:m.jsx(X8e,{toastManager:e,children:t})})}function e4e(){const t=c.useContext(oH);if(!t)throw new Error("useToasts must be used inside ToastsProvider");return t}const xM=[["tasks-range"],["recent"],["entity-list"],["feedback"],["trash"],["children"]];function t4e(t,e){if(Array.isArray(t))return t.filter(n=>n.id!==e);if(t&&typeof t=="object"&&"scheduled"in t){const n=t;return{...n,scheduled:n.scheduled.filter(r=>r.id!==e),overdue:n.overdue.filter(r=>r.id!==e),backlog:n.backlog.filter(r=>r.id!==e)}}return t}function aH(){const t=lr(),{show:e}=e4e(),n=c.useCallback(()=>{for(const r of xM)t.invalidateQueries({queryKey:r})},[t]);return c.useCallback(r=>{const i=[];for(const s of xM)for(const[o,a]of t.getQueriesData({queryKey:s}))a!==void 0&&(i.push([o,a]),t.setQueryData(o,t4e(a,r.id)));Zt.deleteEntity(r.id).catch(()=>{for(const[s,o]of i)t.setQueryData(s,o)}),e({message:"Moved to trash",description:Or(r),action:{label:"Undo",onClick:()=>{Zt.restoreEntity(r.id).then(n).catch(n)}},onExpire:n})},[t,e,n])}const lH=["hourly","daily","weekly","monthly","yearly"],vb=["MO","TU","WE","TH","FR","SA","SU"];function n4e(t){if(!t)return;const e=t.match(/^(\d{4})(\d{2})(\d{2})/);if(e)return`${e[1]}-${e[2]}-${e[3]}`;const n=new Date(t);return Number.isNaN(n.getTime())?void 0:n.toISOString().slice(0,10)}function cH(t){var a;const e=new Map(t.replace(/^RRULE:/i,"").split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,u])=>[l.toUpperCase(),u])),n=(a=e.get("FREQ"))==null?void 0:a.toLowerCase(),r=lH.includes(n)?n:void 0,i=Number(e.get("INTERVAL")??1),s=Number(e.get("COUNT")),o=(e.get("BYDAY")??"").split(",").filter(l=>vb.includes(l));return{preset:r,interval:Number.isFinite(i)&&i>0?i:1,byWeekday:o,count:Number.isFinite(s)&&s>0?s:void 0,until:n4e(e.get("UNTIL"))}}const r4e=["title","body","tags","priority"];function i4e(t,e,n){return!e||!r4e.some(i=>i in t)?t:{...t,recurrenceScope:n}}const s4e="inline-flex w-fit flex-none shrink-0 items-center justify-self-start gap-1 rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap [a:hover_&]:ring [a:hover_&]:ring-current",kb={variant:{primary:{classes:"bg-kumo-badge-inverted text-kumo-badge-inverted",description:"Primary badge"},secondary:{classes:"bg-kumo-fill text-kumo-badge-neutral-subtle",description:"Secondary badge"},error:{classes:"bg-kumo-danger-tint text-kumo-danger",description:"Error badge"},warning:{classes:"bg-kumo-warning-tint text-kumo-warning",description:"Warning badge"},success:{classes:"bg-kumo-success-tint text-kumo-success",description:"Success badge"},destructive:{classes:"bg-kumo-badge-red text-white",description:"Deprecated. Use red instead."},info:{classes:"bg-kumo-info-tint text-kumo-info",description:"Info badge"},beta:{classes:"border border-dashed border-kumo-brand bg-transparent text-kumo-link",description:"Indicates beta or experimental features"},outline:{classes:"border border-kumo-fill bg-kumo-base text-kumo-default",description:"Bordered badge with base background"},red:{classes:"bg-kumo-badge-red text-white",description:"Red badge"},green:{classes:"bg-kumo-badge-green text-white",description:"Green badge"},neutral:{classes:"bg-kumo-badge-neutral text-white",description:"Neutral badge"},orange:{classes:"bg-kumo-badge-orange text-black",description:"Orange badge"},purple:{classes:"bg-kumo-badge-purple text-white",description:"Purple badge"},teal:{classes:"bg-kumo-badge-teal text-white",description:"Teal badge"},"teal-subtle":{classes:"bg-kumo-badge-teal-subtle text-kumo-badge-teal-subtle",description:"Subtle teal badge"},blue:{classes:"bg-kumo-badge-blue text-white",description:"Blue badge"}},appearance:{filled:{classes:"",description:"Filled badge with background color (default)"},dot:{classes:"gap-1.5 bg-transparent text-kumo-default ring ring-kumo-hairline",description:"Outlined badge with a colored circle dot indicating status"}},dotColor:{none:{classes:"",description:"No dot indicator (used when appearance is not dot, or variant has no dot color)"},success:{classes:"bg-kumo-success",description:"Green dot for success status"},warning:{classes:"bg-kumo-badge-orange",description:"Orange dot for warning status"},error:{classes:"bg-kumo-badge-red",description:"Red dot for error status"},neutral:{classes:"bg-kumo-badge-neutral",description:"Neutral dot for informational status"}}},zc={variant:"primary",appearance:"filled",dotColor:"none"};function o4e({variant:t=zc.variant,appearance:e=zc.appearance}={}){const n=sr(kb.variant,t,zc.variant).classes,r=sr(kb.appearance,e,zc.appearance).classes;return le(s4e,e==="dot"?"":n,r)}const a4e=t=>{if(!t)return null;const e=t,n=Jr.isValidElement(t)?t:m.jsx(e,{});return m.jsx("span",{className:"flex h-lh w-3 shrink-0 items-center justify-center [&>svg]:size-3",children:n})};function Mu({variant:t=zc.variant,appearance:e=zc.appearance,className:n,icon:r,children:i}){const s=e==="dot"?sr(kb.dotColor,t,zc.dotColor).classes:"";return m.jsxs("span",{className:le(o4e({variant:t,appearance:e}),r&&"pl-1.5",n),children:[s?m.jsx("span",{"aria-hidden":"true",className:le("size-1.75 shrink-0 rounded-full",s)}):null,a4e(r),i]})}const p2={task:"task",note:"memory",comment:"worklog",feedback:"feedback"},l4e={task:{icon:wj,variant:"info"},note:{icon:O0,variant:"secondary"},comment:{icon:q2,variant:"warning"},feedback:{icon:Y2,variant:"outline"}};function Z8({kind:t,compact:e=!1}){const{icon:n,variant:r}=l4e[t],i=p2[t];return m.jsx(Mu,{variant:r,icon:m.jsx("span",{title:i,className:"flex",children:m.jsx(n,{size:12,weight:"bold"})}),className:le("h-5 py-0 text-[11px]",e?"px-1.5":"uppercase tracking-wider"),children:e?m.jsx("span",{className:"sr-only",children:i}):i})}const uH=[{name:"circle",Icon:Cg},{name:"square",Icon:Kj},{name:"triangle",Icon:sI},{name:"hexagon",Icon:Qj},{name:"folder",Icon:Ij},{name:"briefcase",Icon:vj},{name:"rocket",Icon:Wj},{name:"sparkles",Icon:Gj},{name:"target",Icon:rI},{name:"layers",Icon:eI},{name:"code",Icon:Ej},{name:"book",Icon:bj},{name:"flame",Icon:Rj},{name:"zap",Icon:Gv},{name:"star",Icon:tI},{name:"heart",Icon:Nj},{name:"box",Icon:Pj},{name:"lightbulb",Icon:Vj},{name:"pencil",Icon:G2},{name:"hash",Icon:Lj}],c4e=new Map(uH.map(t=>[t.name,t.Icon]));function u4e(t){return t?c4e.get(t)??Cg:Cg}const d4e=[{name:"gray",value:"#6f6f76"},{name:"red",value:"#ef4444"},{name:"orange",value:"#f59e0b"},{name:"yellow",value:"#eab308"},{name:"green",value:"#10b981"},{name:"teal",value:"#14b8a6"},{name:"cyan",value:"#06b6d4"},{name:"blue",value:"#3b82f6"},{name:"indigo",value:"#5e6ad2"},{name:"purple",value:"#8b5cf6"},{name:"pink",value:"#ec4899"}],dH="#5e6ad2",fH="circle";function f4e(t){return t==="circle"||t==="square"||t==="triangle"}function tc({color:t,icon:e,size:n=12,className:r=""}){const i=u4e(e),s=f4e(e);return m.jsx(i,{size:n,className:`shrink-0 ${r}`,color:t,weight:s?"fill":"bold"})}function Ou({status:t,size:e=14}){const n="currentColor";return t==="done"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-success) shrink-0",children:[m.jsx("circle",{cx:"7",cy:"7",r:"6",fill:"currentColor"}),m.jsx("path",{d:"M4 7.4L6.2 9.5L10 5.5",strokeWidth:"1.6",className:"stroke-kumo-base",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):t==="in_progress"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-warning) shrink-0",children:[m.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:n,strokeWidth:"1.4",fill:"none"}),m.jsx("path",{d:"M7 1 a6 6 0 0 1 0 12 z",fill:"currentColor"})]}):t==="rejected"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-danger) shrink-0",children:[m.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:n,strokeWidth:"1.4",fill:"none"}),m.jsx("path",{d:"M4 4l6 6M10 4l-6 6",stroke:n,strokeWidth:"1.4",strokeLinecap:"round"})]}):m.jsx("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-kumo-placeholder shrink-0",children:m.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:n,strokeWidth:"1.4",fill:"none"})})}function zl({priority:t,size:e=14}){return t==="urgent"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-danger) shrink-0",children:[m.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"}),m.jsx("path",{d:"M7 4v3.5M7 9.5h.01",strokeWidth:"1.6",strokeLinecap:"round",className:"stroke-kumo-base"})]}):t==="high"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-warning) shrink-0",children:[m.jsx("rect",{x:"2",y:"8",width:"2.5",height:"4",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"5.75",y:"5",width:"2.5",height:"7",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"9.5",y:"2",width:"2.5",height:"10",rx:"0.5",fill:"currentColor"})]}):t==="medium"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-info) shrink-0",children:[m.jsx("rect",{x:"2",y:"8",width:"2.5",height:"4",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"5.75",y:"5",width:"2.5",height:"7",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"9.5",y:"2",width:"2.5",height:"10",rx:"0.5",opacity:"0.3",fill:"currentColor"})]}):t==="low"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-kumo-placeholder shrink-0",children:[m.jsx("rect",{x:"2",y:"8",width:"2.5",height:"4",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"5.75",y:"5",width:"2.5",height:"7",rx:"0.5",opacity:"0.3",fill:"currentColor"}),m.jsx("rect",{x:"9.5",y:"2",width:"2.5",height:"10",rx:"0.5",opacity:"0.3",fill:"currentColor"})]}):m.jsx("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-kumo-placeholder shrink-0",children:m.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeDasharray:"1.5 1.5"})})}function R0({size:t=12,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 14 14",fill:"none",className:`shrink-0 ${e}`,"aria-hidden":"true",children:[m.jsx("path",{d:"M2.5 7a4.5 4.5 0 0 1 7.7-3.2L11.5 5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M11.5 2v3h-3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M11.5 7a4.5 4.5 0 0 1-7.7 3.2L2.5 9",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M2.5 12V9h3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]})}const xu={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"No priority"},m2={open:"Todo",in_progress:"In progress",done:"Done",rejected:"Cancelled"},hH=["open","in_progress","done","rejected"],mk=c.forwardRef(function(e,n){const{className:r,render:i,orientation:s="horizontal",style:o,...a}=e;return He("div",e,{state:{orientation:s},ref:n,props:[{role:"separator","aria-orientation":s},a]})});mk.displayName="Separator";const pH=c.createContext(null);pH.displayName="MenubarContext";function mH(t){return c.useContext(pH)}const gk=c.createContext(void 0);gk.displayName="MenuPositionerContext";function j0(t){const e=c.useContext(gk);if(e===void 0&&!t)throw new Error("Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.");return e}const Ok=c.createContext(void 0);Ok.displayName="MenuRootContext";function io(t){const e=c.useContext(Ok);if(e===void 0&&!t)throw new Error("Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.");return e}const gH=c.createContext(void 0);gH.displayName="ContextMenuRootContext";function xk(t=!0){const e=c.useContext(gH);if(e===void 0&&!t)throw new Error("Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.");return e}const yk=c.createContext(void 0);yk.displayName="MenuCheckboxItemContext";function h4e(){const t=c.useContext(yk);if(t===void 0)throw new Error("Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.");return t}function OH(t){const{closeOnClick:e,highlighted:n,id:r,nodeId:i,store:s,typingRef:o,itemRef:a,itemMetadata:l}=t,{events:u}=s.useState("floatingTreeRoot"),f=s.useState("open"),p=xk(!0),g=p!==void 0;return c.useMemo(()=>({id:r,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(O){O.key===" "&&(o!=null&&o.current)&&O.preventDefault()},onMouseMove(O){i&&u.emit("itemhover",{nodeId:i,target:O.currentTarget})},onClick(O){e&&u.emit("close",{domEvent:O,reason:Rl})},onMouseUp(O){if(p){const y=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,g&&y&&Math.abs(O.clientX-y.x)<=1&&Math.abs(O.clientY-y.y)<=1||g&&!sv&&O.button===2)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!g||O.button===2)&&l.type==="regular-item"&&Rd(a.current,O,{detail:1})}}),[e,n,r,u,i,f,s,o,a,p,g,l])}const V8={type:"regular-item"};function D8(t){const{closeOnClick:e,disabled:n,highlighted:r,id:i,store:s,typingRef:o=s.context.typingRef,nativeButton:a,itemMetadata:l,nodeId:u}=t,f=c.useRef(null),{getButtonProps:p,buttonRef:g}=Tr({disabled:n,focusableWhenDisabled:!0,native:a,composite:!0}),O=OH({closeOnClick:e,highlighted:r,id:i,nodeId:u,store:s,typingRef:o,itemRef:f,itemMetadata:l}),y=c.useCallback(v=>ar(O,{onMouseEnter(){l.type==="submenu-trigger"&&l.setActive()}},v,p),[O,p,l]),b=ns(f,g);return c.useMemo(()=>({getItemProps:y,itemRef:b}),[y,b])}const p4e="data-checked",m4e="data-unchecked",H8={checked(t){return t?{[p4e]:""}:{[m4e]:""}},...is},bk=c.forwardRef(function(e,n){const{render:r,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!1,checked:f,defaultChecked:p,onCheckedChange:g,style:O,...y}=e,b=Ta({guess:!0,label:o}),v=j0(!0),w=Pn(s),{store:C}=io(),S=C.useState("disabled"),A=l||S,P=C.useState("isActive",b.index),T=C.useState("itemProps"),[$,I]=Ji({controlled:f,default:p??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:L,itemRef:M}=D8({closeOnClick:u,disabled:A,highlighted:P,id:w,store:C,nativeButton:a,nodeId:v==null?void 0:v.context.nodeId,itemMetadata:V8}),V=c.useMemo(()=>({disabled:A,highlighted:P,checked:$}),[A,P,$]);function Z(B){const H=_e(Rl,B.nativeEvent,void 0,{preventUnmountOnClose:qt});g==null||g(!$,H),!H.isCanceled&&I(U=>!U)}const D=He("div",e,{state:V,stateAttributesMapping:H8,props:[T,{role:"menuitemcheckbox","aria-checked":$,onClick:Z},y,L],ref:[M,n,b.ref]});return m.jsx(yk.Provider,{value:V,children:D})});bk.displayName="MenuCheckboxItem";const xH=c.forwardRef(function(e,n){const{render:r,className:i,style:s,keepMounted:o=!1,...a}=e,l=h4e(),u=c.useRef(null),{transitionStatus:f,mounted:p,setMounted:g}=Ks(l.checked);Hr({batch:!0,enabled:!l.checked,open:l.checked,ref:u,onComplete(){l.checked||g(!1)}});const O={checked:l.checked,disabled:l.disabled,highlighted:l.highlighted,transitionStatus:f};return He("span",e,{state:O,ref:[n,u],stateAttributesMapping:H8,props:{"aria-hidden":!0,...a},enabled:o||p})});xH.displayName="MenuCheckboxItemIndicator";const F8=c.createContext(void 0);F8.displayName="MenuGroupContext";function g4e(){const t=c.useContext(F8);if(t===void 0)throw new Error("Base UI: MenuGroupContext is missing. Menu group parts must be used within <Menu.Group> or <Menu.RadioGroup>.");return t}const yH=c.forwardRef(function(e,n){const{render:r,className:i,style:s,...o}=e,[a,l]=c.useState(void 0),u=He("div",e,{ref:n,props:{role:"group","aria-labelledby":a,...o}});return m.jsx(F8.Provider,{value:l,children:u})});yH.displayName="MenuGroup";const vk=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,...a}=e,l=Pn(o),u=g4e();return Pe(()=>(u(l),()=>{u(f=>f===l?void 0:f)}),[u,l]),He("div",e,{ref:n,props:{id:l,"aria-hidden":!0,...a}})});vk.displayName="MenuGroupLabel";const kk=c.forwardRef(function(e,n){const{render:r,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!0,style:f,...p}=e,g=Ta({guess:!0,label:o}),O=j0(!0),y=Pn(s),{store:b}=io(),v=b.useState("disabled"),w=l||v,C=b.useState("isActive",g.index),S=b.useState("itemProps"),{getItemProps:A,itemRef:P}=D8({closeOnClick:u,disabled:w,highlighted:C,id:y,store:b,nativeButton:a,nodeId:O==null?void 0:O.context.nodeId,itemMetadata:V8});return He("div",e,{state:{disabled:w,highlighted:C},props:[S,p,A],ref:[P,n,g.ref]})});kk.displayName="MenuItem";const bH=c.forwardRef(function(e,n){var T;const{render:r,className:i,id:s,label:o,closeOnClick:a=!1,style:l,...u}=e,f=c.useRef(null),p=Ta({guess:!0,label:o}),g=(T=j0(!0))==null?void 0:T.context.nodeId,O=Pn(s),{store:y}=io(),b=y.useState("isActive",p.index),v=y.useState("itemProps"),w=y.context.typingRef,{getButtonProps:C,buttonRef:S}=Tr({native:!1,composite:!0}),A=OH({closeOnClick:a,highlighted:b,id:O,nodeId:g,store:y,typingRef:w,itemRef:f,itemMetadata:V8});function P($){return ar(A,$,C)}return He("a",e,{state:{highlighted:b},props:[v,u,P],ref:[f,S,n,p.ref]})});bH.displayName="MenuLinkItem";const vH=c.forwardRef(function(e,n){const{render:r,className:i,style:s,finalFocus:o,...a}=e,{store:l}=io(),{side:u,align:f}=j0(),p=BQ()!=null,g=l.useState("open"),O=l.useState("transitionStatus"),y=l.useState("popupProps"),b=l.useState("mounted"),v=l.useState("instantType"),w=l.useState("activeTriggerElement"),C=l.useState("parent"),S=l.useState("lastOpenChangeReason"),A=l.useState("rootId"),P=l.useState("floatingRootContext"),T=l.useState("floatingTreeRoot"),$=l.useState("closeDelay"),I=l.useState("hoverEnabled"),L=l.useState("disabled"),M=l.useState("openMethod"),V=C.type==="context-menu";Hr({open:g,ref:l.context.popupRef,onComplete(){var U,q;g&&((q=(U=l.context).onOpenChangeComplete)==null||q.call(U,!0))}}),c.useEffect(()=>{function U(q){l.setOpen(!1,_e(q.reason,q.domEvent))}return T.events.on("close",U),()=>{T.events.off("close",U)}},[T.events,l]),nj(P,{enabled:I&&!L&&!V&&C.type!=="menubar",closeDelay:$});const Z=l.useStateSetter("popupElement"),D={transitionStatus:O,side:u,align:f,open:g,nested:C.type==="menu",instant:v},B=He("div",e,{state:D,ref:[n,l.context.popupRef,Z],stateAttributesMapping:cv,props:[y,{onKeyDown(U){p&&w8.has(U.key)&&U.stopPropagation()}},f1(O),a,{"data-rootownerid":A}]});let H=C.type===void 0||V;return(w||C.type==="menubar"&&S!=="outside-press")&&(H=!0),m.jsx(x8,{context:P,openInteractionType:M,modal:V,disabled:!b,returnFocus:o===void 0?H:o,initialFocus:C.type!=="menu",restoreFocus:!0,externalTree:C.type!=="menubar"?T:void 0,previousFocusableElement:w,nextFocusableElement:C.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:C.type===void 0?l.context.beforeContentFocusGuardRef:void 0,children:B})});vH.displayName="MenuPopup";const wk=c.createContext(void 0);wk.displayName="MenuPortalContext";function O4e(){const t=c.useContext(wk);if(t===void 0)throw new Error("Base UI: <Menu.Portal> is missing.");return t}const Sk=c.forwardRef(function(e,n){const{keepMounted:r=!1,...i}=e,{store:s,parent:o}=io();if(!(s.useState("mounted")||r))return null;const a=o.type==="menu"||o.type==="menubar"?"group":void 0;return m.jsx(wk.Provider,{value:r,children:m.jsx(l1,{ref:n,...i,portalOwnerRole:a})})});Sk.displayName="MenuPortal";const kH=c.forwardRef(function(e,n){var we;const{anchor:r,positionMethod:i="absolute",className:s,render:o,side:a,align:l,sideOffset:u=0,alignOffset:f=0,collisionBoundary:p="clipping-ancestors",collisionPadding:g=5,arrowPadding:O=5,sticky:y=!1,disableAnchorTracking:b=!1,collisionAvoidance:v=xv,style:w,...C}=e,{store:S}=io(),A=O4e(),P=xk(!0),T=S.useState("parent"),$=S.useState("floatingRootContext"),I=S.useState("floatingTreeRoot"),L=S.useState("mounted"),M=S.useState("open"),V=S.useState("modal"),Z=S.useState("openMethod"),D=S.useState("activeTriggerElement"),B=S.useState("transitionStatus"),H=S.useState("positionerElement"),U=S.useState("instantType"),q=S.useState("adaptiveOrigin"),W=S.useState("lastOpenChangeReason"),X=S.useState("floatingNodeId"),R=S.useState("floatingParentNodeId"),Q=$.useState("domReferenceElement"),F=c.useRef(null),N=z2(H);let z=r,J=u,K=f,ne=l,se=v;T.type==="context-menu"&&(z=r??((we=T.context)==null?void 0:we.anchor),ne=ne??"start",!a&&ne!=="center"&&(K=e.alignOffset??2,J=e.sideOffset??-5));let ie=a,he=ne;T.type==="menu"?(ie=ie??"inline-end",he=he??"start",se=e.collisionAvoidance??yv):T.type==="menubar"&&(ie=ie??(T.context.orientation==="vertical"?"inline-end":"bottom"),he=he??"start");const Se=T.type==="context-menu",Oe=d1({anchor:z,floatingRootContext:$,positionMethod:P?"fixed":i,mounted:L,side:ie,sideOffset:J,align:he,alignOffset:K,arrowPadding:Se?0:O,collisionBoundary:p,collisionPadding:g,sticky:y,nodeId:X,keepMounted:A,disableAnchorTracking:b,collisionAvoidance:se,shift:Se?{crossAxis:!("side"in se&&se.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:I,adaptiveOrigin:q});c.useEffect(()=>{function Le(Ie){Ie.open&&(Ie.parentNodeId===X&&S.set("hoverEnabled",!1),Ie.nodeId!==X&&Ie.parentNodeId===S.select("floatingParentNodeId")&&S.setOpen(!1,_e(Z6)))}return I.events.on("menuopenchange",Le),()=>{I.events.off("menuopenchange",Le)}},[S,I.events,X]),c.useEffect(()=>{if(S.select("floatingParentNodeId")==null)return;function Le(Ie){if(Ie.open||Ie.nodeId!==S.select("floatingParentNodeId"))return;const Fe=Ie.reason??"sibling-open";S.setOpen(!1,_e(Fe))}return I.events.on("menuopenchange",Le),()=>{I.events.off("menuopenchange",Le)}},[I.events,S]);const be=wn();c.useEffect(()=>{M||be.clear()},[M,be]),c.useEffect(()=>{function Le(Ie){if(!(!M||Ie.nodeId!==S.select("floatingParentNodeId")))if(Ie.target&&D&&D!==Ie.target){const Fe=S.select("closeDelay");Fe>0?be.isStarted()||be.start(Fe,()=>{S.setOpen(!1,_e(Z6))}):S.setOpen(!1,_e(Z6))}else be.clear()}return I.events.on("itemhover",Le),()=>{I.events.off("itemhover",Le)}},[I.events,M,D,S,be]),c.useEffect(()=>{const Le={open:M,nodeId:X,parentNodeId:R,reason:S.select("lastOpenChangeReason")};I.events.emit("menuopenchange",Le)},[I.events,M,S,X,R]),Pe(()=>{const Le=Q,Ie=F.current;if(Le&&(F.current=Le),Ie&&Le&&Le!==Ie){S.set("instantType",void 0);const Fe=new AbortController;return N(()=>{S.set("instantType","trigger-change")},Fe.signal),()=>{Fe.abort()}}},[Q,N,S]);const me={open:M,side:Oe.side,align:Oe.align,anchorHidden:Oe.anchorHidden,nested:T.type==="menu",instant:U},ue=T.type==="menubar"&&T.context.modal;v5(M&&(ue||V&&W!=="trigger-hover"),Z==="touch",H,D);const ve=h1(e,me,{styles:Oe.positionerStyles,transitionStatus:B,props:C,refs:[n,S.useStateSetter("positionerElement")],hidden:!L,inert:!M}),xe=L&&T.type!=="menu"&&(T.type!=="menubar"&&V&&W!=="trigger-hover"||T.type==="menubar"&&T.context.modal);let Ce=null;return T.type==="menubar"?Ce=T.context.contentElement:T.type===void 0&&(Ce=D),m.jsxs(gk.Provider,{value:Oe,children:[xe&&m.jsx(S1,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:C1(!M),cutout:Ce}),m.jsx(yY,{id:X,children:m.jsx(C0,{elementsRef:S.context.itemDomElements,labelsRef:S.context.itemLabels,children:ve})})]})});kH.displayName="MenuPositioner";const Ck=c.createContext(void 0);Ck.displayName="MenuRadioGroupContext";function x4e(){const t=c.useContext(Ck);if(t===void 0)throw new Error("Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.");return t}const wH=c.memo(c.forwardRef(function(e,n){const{render:r,className:i,value:s,defaultValue:o,onValueChange:a,disabled:l=!1,style:u,"aria-labelledby":f,...p}=e,[g,O]=c.useState(void 0),[y,b]=Ji({controlled:s,default:o,name:"MenuRadioGroup"}),v=Ee((S,A)=>{a==null||a(S,A),!A.isCanceled&&b(S)}),w=He("div",e,{state:{disabled:l},ref:n,props:{role:"group","aria-labelledby":f??g,"aria-disabled":l||void 0,...p}}),C=c.useMemo(()=>({value:y,setValue:v,disabled:l}),[y,v,l]);return m.jsx(F8.Provider,{value:O,children:m.jsx(Ck.Provider,{value:C,children:w})})}));wH.displayName="MenuRadioGroup";const Ek=c.createContext(void 0);Ek.displayName="MenuRadioItemContext";function y4e(){const t=c.useContext(Ek);if(t===void 0)throw new Error("Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.");return t}const SH=c.forwardRef(function(e,n){const{render:r,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!1,value:f,style:p,...g}=e,O=Ta({guess:!0,label:o}),y=j0(!0),b=Pn(s),{store:v}=io(),w=v.useState("isActive",O.index),C=v.useState("itemProps"),{value:S,setValue:A,disabled:P}=x4e(),T=v.useState("disabled"),$=l||P||T,I=S===f,{getItemProps:L,itemRef:M}=D8({closeOnClick:u,disabled:$,highlighted:w,id:b,store:v,nativeButton:a,nodeId:y==null?void 0:y.context.nodeId,itemMetadata:V8}),V=c.useMemo(()=>({disabled:$,highlighted:w,checked:I}),[$,w,I]);function Z(B){const H=_e(Rl,B.nativeEvent,void 0,{preventUnmountOnClose:qt});A(f,H)}const D=He("div",e,{state:V,stateAttributesMapping:H8,props:[C,{role:"menuitemradio","aria-checked":I,onClick:Z},g,L],ref:[M,n,O.ref]});return m.jsx(Ek.Provider,{value:V,children:D})});SH.displayName="MenuRadioItem";const CH=c.forwardRef(function(e,n){const{render:r,className:i,style:s,keepMounted:o=!1,...a}=e,l=y4e(),u=c.useRef(null),{transitionStatus:f,mounted:p,setMounted:g}=Ks(l.checked);Hr({batch:!0,enabled:!l.checked,open:l.checked,ref:u,onComplete(){l.checked||g(!1)}});const O={checked:l.checked,disabled:l.disabled,highlighted:l.highlighted,transitionStatus:f};return He("span",e,{state:O,stateAttributesMapping:H8,ref:[n,u],props:{"aria-hidden":!0,...a},enabled:o||p})});CH.displayName="MenuRadioItemIndicator";const b4e={...Iv,disabled:t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled,modal:t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0),openMethod:t=>t.openMethod,allowMouseEnter:t=>t.allowMouseEnter,highlightItemOnHover:t=>t.highlightItemOnHover,parent:t=>t.parent,rootId:t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId,activeIndex:t=>t.activeIndex,isActive:(t,e)=>t.activeIndex===e,hoverEnabled:t=>t.hoverEnabled,instantType:t=>t.instantType,lastOpenChangeReason:t=>t.openChangeReason,floatingTreeRoot:t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot,floatingNodeId:t=>t.floatingNodeId,floatingParentNodeId:t=>t.floatingParentNodeId,itemProps:t=>t.itemProps,closeDelay:t=>t.closeDelay,adaptiveOrigin:t=>t.adaptiveOrigin,keyboardEventRelay:t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")}};var v4e=class extends wu{constructor(e,n,r=!1){const i=new F2,s=w4e(i,n,r,e);super(s,k4e(i),b4e);$t(this,"unsubscribeParentListener",null);this.unsubscribeParentListener=this.observe("parent",o=>{var a;if((a=this.unsubscribeParentListener)==null||a.call(this),o.type==="menu"){let l=o.store.select("rootId"),u=o.store.select("floatingTreeRoot"),f=o.store.select("keyboardEventRelay");this.unsubscribeParentListener=o.store.subscribe(()=>{const p=o.store.select("rootId"),g=o.store.select("floatingTreeRoot"),O=o.store.select("keyboardEventRelay");l===p&&u===g&&f===O||(l=p,u=g,f=O,this.notifyAll())}),this.context.allowMouseUpTriggerRef=o.store.context.allowMouseUpTriggerRef;return}o.type!==void 0&&(this.context.allowMouseUpTriggerRef=o.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:n})}};function k4e(t){return{positionerRef:c.createRef(),popupRef:c.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:c.createRef(),beforeContentFocusGuardRef:c.createRef(),onOpenChangeComplete:void 0,triggerElements:t}}function w4e(t,e,n=!1,r){return{...Rv(t,e,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new pv,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Ut,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}const Ak=c.createContext(void 0);Ak.displayName="MenuSubmenuRootContext";function EH(){return c.useContext(Ak)}const Pk=H2(function(e){const{children:n,open:r,onOpenChange:i,onOpenChangeComplete:s,defaultOpen:o=!1,disabled:a=!1,modal:l,loopFocus:u=!0,orientation:f="vertical",actionsRef:p,closeParentOnEsc:g=!1,handle:O,triggerId:y,defaultTriggerId:b=null,highlightItemOnHover:v=!0}=e,w=xk(!0),C=io(!0),S=mH(!0),A=EH(),P=c.useMemo(()=>A&&C?{type:"menu",store:C.store}:S?{type:"menubar",context:S}:w&&!C?{type:"context-menu",context:w}:{type:void 0},[w,C,S,A]),T=$l(),$=$l(),I=ql(),L=P.type==="menu"?P.store:void 0,M=(r??o)&&(L==null?void 0:L.state.transitionStatus)==="starting",V=Qn(()=>M?L==null?void 0:L.state.instantType:void 0).current,Z=S4e({open:o,openProp:r,activeTriggerId:b,triggerIdProp:y,parent:P,disabled:a,highlightItemOnHover:v,modal:P.type===void 0?l:void 0,rootId:T,instantType:V},$,I!=null);Z.useControlledProp("openProp",r),Z.useControlledProp("triggerIdProp",y),Z.useContextCallback("onOpenChangeComplete",s);const D=Z.useState("floatingTreeRoot"),B=XR(D),H=Z.useState("open"),U=Z.useState("activeTriggerElement"),q=Z.useState("positionerElement"),W=Z.useState("hoverEnabled"),X=Z.useState("disabled"),R=Z.useState("lastOpenChangeReason"),Q=Z.useState("parent"),F=Z.useState("activeIndex"),N=Z.useState("payload"),z=Z.useState("floatingParentNodeId"),J=c.useRef(null),K=c.useRef(Q.type!=="context-menu"),ne=wn(),se=c.useRef(!0),ie=wn(),he=z!=null;Q.type!==void 0&&l!==void 0&&console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored.");const{openMethod:Se,triggerProps:Oe}=h5(H);Z.useSyncedValues({disabled:a,highlightItemOnHover:v,modal:Q.type===void 0?l:void 0,openMethod:Se,rootId:T}),Pv(Z);const{forceUnmount:be,transitionStatus:me}=Mv(H,Z,()=>{Z.set("allowMouseEnter",!1)},M),ue=z2(Z.context.popupRef);c.useEffect(()=>{if(V===void 0)return;const Te=()=>{Z.state.instantType===V&&Z.set("instantType",void 0)};if(!H){Te();return}if(me!==void 0)return;if(Z.context.popupRef.current==null){Te();return}const Ke=new AbortController;return ue(Te,Ke.signal),()=>{Ke.abort()}},[V,H,me,ue,Z]),Pe(()=>{w&&!C?Z.update({parent:{type:"context-menu",context:w},floatingNodeId:B,floatingParentNodeId:I}):C&&Z.update({floatingNodeId:B,floatingParentNodeId:I})},[w,C,B,I,Z]),c.useEffect(()=>{if(H||(J.current=null),Q.type==="context-menu"){if(!H){ne.clear(),K.current=!1;return}ne.start(500,()=>{K.current=!0})}},[ne,H,Q.type]),Pe(()=>{!H&&!W&&Z.set("hoverEnabled",!0)},[H,W,Z]);const ve=Ee((Te,Ke)=>{const gt=Ke.reason;if(!Te&&!Z.select("open")||H===Te&&Ke.trigger===U&&R===gt)return;const Pt=aj(Ke);if(!Te&&Ke.trigger==null&&(Ke.trigger=U??void 0),i==null||i(Te,Ke),Ke.isCanceled)return;Z.state.floatingRootContext.dispatchOpenChange(Te,Ke);const jt=Ke.event;if(Te===!1&&(jt==null?void 0:jt.type)==="click"&&jt.pointerType==="touch"&&!se.current)return;Te&&gt==="trigger-focus"?(se.current=!1,ie.start(300,()=>{se.current=!0})):(se.current=!0,ie.clear());const et=(gt==="trigger-press"||gt==="item-press")&&jt.detail===0,Yt=!Te&&(gt==="escape-key"||gt==null);J.current=Ke.event;const Mt=Ev(Z.state,Te,Ke.trigger,Pt());Mt.openChangeReason=gt,Q.type==="menubar"&&(gt==="trigger-focus"||gt==="focus-out"||gt==="trigger-hover"||gt==="list-navigation"||gt==="sibling-open")?Mt.instantType="group":et||Yt?Mt.instantType=et?"click":"dismiss":Mt.instantType=void 0,Z.update(Mt)}),xe=ij({popupStore:Z,floatingRootContext:Z.state.floatingRootContext,floatingId:$,nested:I!=null,onOpenChange:ve}),Ce=xe.context.events;Pe(()=>{const Te=({open:Ke,eventDetails:gt})=>ve(Ke,gt);return Ce.on("setOpen",Te),()=>{Ce==null||Ce.off("setOpen",Te)}},[Ce,ve]);const we=c.useCallback(()=>{Z.setOpen(!1,_e(hv))},[Z]);c.useImperativeHandle(p,()=>({unmount:be,close:we}),[be,we]);let Le;Q.type==="context-menu"&&(Le=Q.context),c.useImperativeHandle(Le==null?void 0:Le.positionerRef,()=>q,[q]),c.useImperativeHandle(Le==null?void 0:Le.actionsRef,()=>({setOpen:ve}),[ve]);const Ie=c1(xe,{enabled:!X,bubbles:{escapeKey:g&&Q.type==="menu"},outsidePress(){var Te;return Q.type!=="context-menu"||((Te=J.current)==null?void 0:Te.type)==="contextmenu"?!0:K.current},externalTree:he?D:void 0}),Fe=Aa(),Me=c.useCallback(Te=>{Z.select("activeIndex")!==Te&&Z.set("activeIndex",Te)},[Z]),oe=p5(xe,{enabled:!X,listRef:Z.context.itemDomElements,activeIndex:F,nested:Q.type!==void 0,loopFocus:u,orientation:f,parentOrientation:Q.type==="menubar"?Q.context.orientation:void 0,rtl:Fe==="rtl",disabledIndices:ir,onNavigate:Me,openOnArrowKeyDown:Q.type!=="context-menu",externalTree:he?D:void 0,focusItemOnHover:v}),ge=c.useCallback(Te=>{Z.context.typingRef.current=Te},[Z]),Y=m5(xe,{enabled:!X,listRef:Z.context.itemLabels,elementsRef:Z.context.itemDomElements,activeIndex:F,resetMs:500,onMatch:Te=>{H&&Te!==F&&Z.set("activeIndex",Te)},onTyping:ge}),G=c.useMemo(()=>{const Te=ar(Y.reference,oe.reference,Ie.reference,{onMouseMove(){Z.set("allowMouseEnter",!0)}},Oe);return Te["aria-haspopup"]="menu",Te["aria-expanded"]=H,Te},[Z,Y.reference,oe.reference,Ie.reference,Oe,H]),de=c.useMemo(()=>{const Te=ar(oe.trigger,Ie.trigger,Oe);return Te["aria-haspopup"]="menu",Te["aria-expanded"]=!1,Te},[oe.trigger,Ie.trigger,Oe]);Qn(()=>(Z.update({inactiveTriggerProps:de}),null));const Ae=c.useMemo(()=>ar(u1,{id:$,role:"menu","aria-orientation":f==="horizontal"?"horizontal":void 0,"aria-labelledby":U==null?void 0:U.id,onMouseMove(){Z.set("allowMouseEnter",!0),Q.type==="menu"&&Z.set("hoverEnabled",!1)},onClick(){Z.select("hoverEnabled")&&Z.set("hoverEnabled",!1)},onKeyDown(Te){const Ke=Z.select("keyboardEventRelay");Ke&&!Te.isPropagationStopped()&&Ke(Te)}},Y.floating,oe.floating,Ie.floating),[U,$,f,Q.type,Z,Y.floating,oe.floating,Ie.floating]),Re=oe.item??Ut;Tv(Z,{floatingRootContext:xe,activeTriggerProps:G,inactiveTriggerProps:de,popupProps:Ae,itemProps:Re});const Ge=c.useMemo(()=>({store:Z,parent:P}),[Z,P]),dt=m.jsxs(Ok.Provider,{value:Ge,children:[O&&m.jsx(Cv,{handle:O,store:Z}),typeof n=="function"?n({payload:N}):n]});return Q.type===void 0||Q.type==="context-menu"?m.jsx(bY,{externalTree:D,children:dt}):dt});Pk.displayName="MenuRoot";function S4e(t,e,n){return Qn(()=>new v4e(t,e,n)).current}function C4e(t){const e=io().store,n=c.useMemo(()=>({parentMenu:e}),[e]);return m.jsx(Ak.Provider,{value:n,children:m.jsx(Pk,{...t})})}function AH(t){if(on(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid");if(!Io(t))return AH(Ws(t))}const E4e={"aria-expanded":void 0},Mk=c.forwardRef(function(e,n){const{render:r,className:i,style:s,label:o,id:a,nativeButton:l=!1,openOnHover:u=!0,delay:f=100,closeDelay:p=0,disabled:g=!1,...O}=e,y=EH();if(!(y!=null&&y.parentMenu))throw new Error("Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>.");const b=Ta({guess:!0,label:o}),v=j0(),{store:w}=io(),C=Pn(a),S=w.useState("open"),A=w.useState("floatingRootContext"),P=w.useState("floatingTreeRoot"),T=w.useState("triggerPopupId",C),$=oj(C,w),I=Ee(ne=>{$(ne),ne!==null&&w.select("open")&&w.select("activeTriggerId")==null&&w.update({activeTriggerId:C??null,activeTriggerElement:ne,closeDelay:p})}),L=c.useRef(null),M=c.useCallback(ne=>{L.current=ne,w.set("activeTriggerElement",ne)},[w]);Pe(()=>(I(L.current),()=>I(null)),[I,C,w]),w.useSyncedValue("closeDelay",p);const V=y.parentMenu,Z=w.useState("disabled"),D=V.useState("disabled"),B=g||Z||D;c.useEffect(()=>{var se;const ne=L.current;if(ne&&k5(ne)&&!B){const ie=((se=Er.captureOwnerStack)==null?void 0:se.call(Er))||"";M2(`A disabled element was detected on <Menu.SubmenuTrigger>. To properly disable the trigger, use the \`disabled\` prop on the component instead of setting it on the rendered element.${ie}`)}});const H=V.useState("itemProps"),U=V.useState("isActive",b.index),q=c.useMemo(()=>({type:"submenu-trigger",setActive(){V.select("highlightItemOnHover")&&V.set("activeIndex",b.index)}}),[V,b.index]),{getItemProps:W,itemRef:X}=D8({closeOnClick:!1,disabled:B,highlighted:U,id:C,store:w,typingRef:V.context.typingRef,nativeButton:l,itemMetadata:q,nodeId:v==null?void 0:v.context.nodeId}),R=w.useState("hoverEnabled"),Q=wv(A,{enabled:R&&u&&!B,handleClose:Sv({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:f,delay:{open:f,close:p},shouldOpen:f>0?()=>V.select("allowMouseEnter"):void 0,triggerElementRef:L,externalTree:P,isClosing:()=>w.select("transitionStatus")==="ending",guardStaleOpen:!0}),F=S0(A,{enabled:!B,event:"mousedown",toggle:!u,ignoreMouse:u,stickIfOpen:!1}).reference??Ut,N=w.useState("triggerProps",!0);delete N.id;const z={disabled:B,highlighted:U,open:S},J=w.useState("openMethod"),K=w.useState("lastOpenChangeReason")==="list-navigation"||J==="keyboard";return He("div",e,{state:z,stateAttributesMapping:i1,props:[F,Q,N,H,S&&K&&qR?E4e:void 0,{"aria-controls":T,tabIndex:S||U?0:-1,onBlur(){U&&V.set("activeIndex",null)}},O,W],ref:[n,b.ref,X,I,M]})});Mk.displayName="MenuSubmenuTrigger";function PH(t={}){const{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:r}=v8(),{ref:i,index:s}=Ta(t),o=n===s,a=c.useRef(null),l=ns(i,a);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(s)},onMouseMove(){const u=a.current;if(!e||!u)return;const f=u.hasAttribute("disabled")||u.ariaDisabled==="true";!o&&!f&&u.focus()}},compositeRef:l,index:s}}function A4e(t){const{render:e,className:n,style:r,state:i=Ut,props:s=ir,refs:o=ir,metadata:a,stateAttributesMapping:l,tag:u="div",...f}=t,{compositeProps:p,compositeRef:g}=PH({metadata:a});return He(u,t,{state:i,ref:[g,...o],props:[p,...s,f],stateAttributesMapping:l})}function P4e(t,e){const n=c.useRef(null);function r(s){var o;ts.flushSync(()=>{t.setOpen(!1,_e(bg,s.nativeEvent,s.currentTarget))}),(o=cY(n.current))==null||o.focus()}function i(s){var a;const o=t.select("positionerElement");if(o&&kd(s,o))(a=t.context.beforeContentFocusGuardRef.current)==null||a.focus();else{ts.flushSync(()=>{t.setOpen(!1,_e(bg,s.nativeEvent,s.currentTarget))});let l=lY(t.context.triggerFocusTargetRef.current||e.current);for(;l!==null&&Ue(o,l);){const u=l;if(l=dv(l),l===u)break}l==null||l.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function M4e(t){const{enabled:e=!0,mouseDownAction:n,open:r}=t,i=c.useRef(!1);return c.useMemo(()=>e?{onMouseDown:s=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,Ct(s.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:s=>{i.current&&(i.current=!1,s.preventBaseUIHandler())}}:Ut,[e,n,r])}const wb=Ov(function(e,n){const{render:r,className:i,style:s,disabled:o=!1,nativeButton:a=!0,id:l,openOnHover:u,delay:f=100,closeDelay:p=0,handle:g,payload:O,...y}=e,b=io(!0),v=$v(g)??(b==null?void 0:b.store);if(!v)throw new Error("Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.");const w=Pn(l),C=v.useState("isTriggerActive",w),S=v.useState("floatingRootContext"),A=v.useState("isOpenedByTrigger",w),P=v.useState("triggerPopupId",w),T=c.useRef(null),$=R4e(),I=v8(!0),L=Ul(),M=c.useMemo(()=>L??new pv,[L]),V=XR(M),Z=ql(),{registerTrigger:D,isMountedByThisTrigger:B}=Av(w,T,v,{payload:O,closeDelay:p,parent:$,floatingTreeRoot:M,floatingNodeId:V,floatingParentNodeId:Z,keyboardEventRelay:I==null?void 0:I.relayKeyboardEvent}),H=$.type==="menubar",U=v.useState("disabled"),q=o||U||H&&$.context.disabled,{getButtonProps:W,buttonRef:X}=Tr({disabled:q,native:a});c.useEffect(()=>{!A&&$.type===void 0&&(v.context.allowMouseUpTriggerRef.current=!1)},[v,A,$.type]);const R=c.useRef(null),Q=wn(),F=Ee(Ce=>{if(!R.current)return;Q.clear(),v.context.allowMouseUpTriggerRef.current=!1;const we=Ce.target;Ue(R.current,we)||Ue(v.select("positionerElement"),we)||we===R.current||we!=null&&AH(we)===v.select("rootId")||y5(Ce,R.current)||M.events.emit("close",{domEvent:Ce,reason:fv})});c.useEffect(()=>{A&&v.select("lastOpenChangeReason")==="trigger-hover"&&Ct(R.current).addEventListener("mouseup",F,{once:!0})},[A,F,v]);const N=H&&$.context.hasSubmenuOpen,z=wv(S,{enabled:(u??N)&&!q&&(!H||N&&!B),handleClose:Sv({blockPointerEvents:!H}),mouseOnly:!0,move:!1,restMs:$.type===void 0?f:void 0,delay:{close:p},triggerElementRef:T,externalTree:M,isActiveTrigger:C,isClosing:()=>v.select("transitionStatus")==="ending"}),J=T4e(A,v.select("lastOpenChangeReason")),K=S0(S,{enabled:!q,event:A&&H?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:$.type===void 0?J:!1}),ne=dj(S,{enabled:!q&&N}),se=M4e({open:A,enabled:H,mouseDownAction:"open"}),ie=c.useMemo(()=>ar(ne.reference,K.reference),[ne.reference,K.reference]),he=v.useState("triggerProps",B),{preFocusGuardRef:Se,handlePreFocusGuardFocus:Oe,handleFocusTargetFocus:be}=P4e(v,T),me={disabled:q,open:A},ue=[R,n,X,D,T],ve=[ie,z??Ut,he,{"aria-haspopup":"menu","aria-controls":P,id:w,onMouseDown:Ce=>{v.select("open")||(Q.start(200,()=>{v.context.allowMouseUpTriggerRef.current=!0}),Ct(Ce.currentTarget).addEventListener("mouseup",F,{once:!0}))}},H?{role:"menuitem"}:{},se,y,W],xe=He("button",e,{enabled:!H,stateAttributesMapping:gg,state:me,ref:ue,props:ve});return H?m.jsx(A4e,{tag:"button",render:r,className:i,style:s,state:me,refs:ue,props:ve,stateAttributesMapping:gg}):A?m.jsxs(c.Fragment,{children:[m.jsx(Ll,{ref:Se,onFocus:Oe},`${w}-pre-focus-guard`),m.jsx(c.Fragment,{children:xe},w),m.jsx(Ll,{ref:v.context.triggerFocusTargetRef,onFocus:be},`${w}-post-focus-guard`)]}):m.jsx(c.Fragment,{children:xe},w)});wb.displayName="MenuTrigger";function T4e(t,e){const n=wn(),[r,i]=c.useState(!1);return Pe(()=>{t&&e==="trigger-hover"?(i(!0),n.start(500,()=>{i(!1)})):t||(n.clear(),i(!1))},[t,e,n]),r}function R4e(){const t=mH();return c.useMemo(()=>t?{type:"menubar",context:t}:{type:void 0},[t])}const j4e={variant:{default:{classes:"",description:"Default dropdown item appearance"},danger:{classes:"text-kumo-danger data-highlighted:bg-kumo-danger/5 data-highlighted:text-kumo-danger",description:"Destructive action item"}}},yM={variant:"default"};function MH({variant:t=yM.variant}={}){return le(sr(j4e.variant,t,yM.variant).classes)}const TH=c.forwardRef(({className:t,inset:e,children:n,icon:r,...i},s)=>m.jsxs(Mk,{ref:s,"data-kumo-component":"DropdownMenu","data-kumo-part":"submenu-trigger",className:le("flex cursor-default items-center rounded-sm text-base outline-hidden select-none","px-2 py-1.5","focus:bg-kumo-tint focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand","data-[state=open]:bg-kumo-tint",e&&"pl-8",t),...i,children:[r&&m.jsx(r,{className:"mr-2 h-4 w-4"}),n,m.jsx(Pa,{className:"ml-auto h-4 w-4"})]}));TH.displayName=Mk.displayName;const bM=c.forwardRef(({className:t,sideOffset:e=8,children:n,container:r,...i},s)=>{const o=vu();return m.jsx(Sk,{container:r??o??void 0,children:m.jsx(kH,{ref:s,sideOffset:e,...i,children:m.jsx(vH,{className:le("overflow-hidden bg-kumo-control text-kumo-default","max-h-[var(--available-height)] overflow-y-auto","rounded-lg shadow-lg ring ring-kumo-line","min-w-36 p-1.5","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2","data-[side=top]:slide-in-from-bottom-2","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",t),children:n})})})}),Tk=t=>t?c.isValidElement(t)?t:m.jsx(t,{className:"mr-2 h-4 w-4"}):null,RH=c.forwardRef(({className:t,inset:e,icon:n,children:r,selected:i,render:s,href:o,variant:a="default",...l},u)=>{const f=t1(),p=c.useMemo(()=>m.jsxs(m.Fragment,{children:[n&&Tk(n),r,i&&m.jsx("span",{className:"inline-flex",children:m.jsx(Fr,{})})]}),[n,r,i]),g=c.useMemo(()=>{if(!o)return;const y=/^(https?:)?\/\//.test(o),b=le("flex items-center",a==="danger"&&"text-kumo-danger data-highlighted:bg-kumo-danger/5 data-highlighted:text-kumo-danger");return y?m.jsx("a",{className:le(b,"w-full text-inherit! no-underline!"),href:o,target:"_blank",rel:"noreferrer",onClick:v=>v.stopPropagation(),children:p}):m.jsx(f,{className:le(b,"w-full text-inherit! no-underline!"),href:o,to:o,onClick:v=>v.stopPropagation(),children:p})},[o,p,a,f]),O=o||s;return m.jsx(kk,{ref:u,"data-kumo-component":"DropdownMenu","data-kumo-part":"item",className:le("relative flex cursor-default items-center rounded-md px-2 py-1.5 text-base outline-hidden select-none focus:text-kumo-default focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-kumo-overlay",e&&"pl-8",MH({variant:a}),t),render:o?g:s,...l,children:O?void 0:p})});RH.displayName=kk.displayName;const jH=c.forwardRef(({className:t,inset:e,icon:n,children:r,variant:i="default",...s},o)=>m.jsxs(bH,{ref:o,"data-kumo-component":"DropdownMenu","data-kumo-part":"link-item",className:le("relative flex cursor-default items-center rounded-md px-2 py-1.5 text-base outline-hidden select-none","focus:text-kumo-default focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-kumo-overlay","text-inherit no-underline",e&&"pl-8",MH({variant:i}),t),...s,children:[n&&Tk(n),r]}));jH.displayName="DropdownMenuLinkItem";const IH=c.forwardRef(({className:t,children:e,checked:n,...r},i)=>m.jsxs(bk,{ref:i,"data-kumo-component":"DropdownMenu","data-kumo-part":"checkbox-item",className:le("relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-base outline-hidden transition-colors select-none focus:bg-kumo-tint focus:text-kumo-default focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand data-disabled:pointer-events-none data-disabled:opacity-50",t),checked:n,...r,children:[m.jsx(xH,{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center text-inherit",children:m.jsx(Fr,{weight:"bold",size:12})}),e]}));IH.displayName=bk.displayName;const $H=c.forwardRef(({className:t,inset:e,...n},r)=>m.jsx(vk,{ref:r,className:le("px-2 py-1.5 text-base font-semibold",e&&"pl-8",t),...n}));$H.displayName=vk.displayName;const LH=c.forwardRef(({className:t,...e},n)=>m.jsx(mk,{ref:n,className:le("-mx-1 my-1 h-px bg-kumo-hairline",t),...e}));LH.displayName=mk.displayName;const NH=({className:t,...e})=>m.jsx("span",{className:le("ml-auto text-xs tracking-widest opacity-60",t),...e});NH.displayName="DropdownMenuShortcut";const QH=c.forwardRef(({className:t,children:e,inset:n,icon:r,...i},s)=>m.jsxs(SH,{ref:s,"data-kumo-component":"DropdownMenu","data-kumo-part":"radio-item",className:le("relative flex cursor-default items-center rounded-md px-2 py-1.5 text-base outline-hidden select-none","data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-kumo-tint",n&&"pl-8",t),...i,children:[r&&Tk(r),e]}));QH.displayName="DropdownMenuRadioItem";const ZH=c.forwardRef(({className:t,children:e,...n},r)=>m.jsx(CH,{ref:r,className:le("ml-auto",t),...n,children:e??m.jsx(Fr,{className:"h-4 w-4"})}));ZH.displayName="DropdownMenuRadioItemIndicator";const VH=c.forwardRef(({children:t,render:e,...n},r)=>{if(e)return m.jsx(wb,{ref:r,...n,render:e,children:t});const i=c.isValidElement(t)?t:null;return m.jsx(wb,{ref:r,...n,...i&&{render:i},children:i?void 0:t})});VH.displayName="DropdownMenuTrigger";const pn=Object.assign(Pk,{Trigger:VH,Portal:Sk,Sub:C4e,SubTrigger:TH,SubContent:bM,Content:bM,Item:RH,LinkItem:jH,CheckboxItem:IH,RadioGroup:wH,RadioItem:QH,RadioItemIndicator:ZH,Label:$H,Separator:LH,Shortcut:NH,Group:yH});function I1({task:t,size:e=14,className:n="",align:r="start",onStatusChange:i}){const s=ec(),o=a=>{if(t.status===a)return;const l=t.status;i==null||i(a),s.mutate({id:t.id,fields:{status:a}},{onError:()=>i==null?void 0:i(l)})};return m.jsxs(pn,{children:[m.jsx(pn.Trigger,{render:m.jsx("button",{type:"button",draggable:!1,className:`inline-flex shrink-0 items-center justify-center rounded p-0.5 -m-0.5 hover:bg-kumo-fill disabled:opacity-60 ${n}`,onClick:a=>a.stopPropagation(),onPointerDown:a=>a.stopPropagation(),onMouseDown:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),onKeyUp:a=>a.stopPropagation(),onDragStart:a=>{a.preventDefault(),a.stopPropagation()},disabled:s.isPending,title:`Change status (${m2[t.status]??t.status})`,"aria-label":"Change status",children:m.jsx(Ou,{status:t.status,size:e})})}),m.jsx(pn.Content,{align:r,onClick:a=>a.stopPropagation(),children:m.jsx(pn.RadioGroup,{value:t.status,onValueChange:a=>o(String(a)),children:hH.map(a=>m.jsxs(pn.RadioItem,{value:a,closeOnClick:!0,className:"gap-2",children:[m.jsx(Ou,{status:a,size:12}),m.jsx("span",{children:m2[a]??a}),m.jsx(pn.RadioItemIndicator,{})]},a))})})]})}function _8({tag:t,className:e}){return m.jsx(Mu,{variant:"secondary",className:le("flex-initial shrink min-w-0 max-w-32 px-1.5 text-[11px]",e),children:m.jsx("span",{className:"truncate min-w-0",title:t,children:t})})}const I4e=600,DH={hourly:"Hourly",daily:"Daily",weekly:"Weekly",monthly:"Monthly",yearly:"Yearly"},HH={hourly:"hour",daily:"day",weekly:"week",monthly:"month",yearly:"year"};function $4e(){const{openId:t,close:e}=ro(),{active:n}=cr();return c.useEffect(()=>{if(!t||n)return;const r=i=>{if(i.key!=="Escape")return;const s=i.target;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.closest(".cm-editor"))){s.blur();return}e()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t,n,e]),t?m.jsxs("div",{className:"fixed inset-0 z-30 flex",children:[m.jsx("div",{className:"flex-1 cursor-pointer bg-kumo-recessed/60 backdrop-blur-[1px]",onClick:e}),m.jsx("aside",{className:"flex w-[min(680px,92vw)] flex-col border-l border-kumo-line bg-kumo-base shadow-lg",children:m.jsx(L4e,{id:t,onClose:e})})]}):null}function ux(t){if(!t)return"";const e=new Date(t),n=r=>String(r).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`}function L4e({id:t,onClose:e}){var Fe,Me,oe;const{data:n,isLoading:r}=hM(t),{data:i}=Qi(),{data:s}=pM((n==null?void 0:n.kind)==="task"?t:void 0),{data:o}=hM((n==null?void 0:n.parentId)??void 0),{data:a}=pM((n==null?void 0:n.kind)==="task"&&(o==null?void 0:o.kind)==="task"?o.id:void 0),l=(s??[]).filter(ge=>ge.kind==="task"),u=(s??[]).filter(ge=>ge.kind==="note"),{data:f}=G2e((n==null?void 0:n.kind)==="task"?t:void 0),p=ec(),g=aH(),O=MD(),y=K2e(),b=J2e(),v=e8e(),{open:w}=cr(),{open:C}=ro(),[S,A]=c.useState(""),[P,T]=c.useState(""),$=ZD(),[I,L]=c.useState([]),[M,V]=c.useState("open"),[Z,D]=c.useState(""),[B,H]=c.useState(""),[U,q]=c.useState("none"),[W,X]=c.useState(!1),[R,Q]=c.useState("idle"),[F,N]=c.useState("future"),z=c.useRef(null),J=c.useRef(!1);c.useEffect(()=>{n&&z.current!==n.id&&(A(n.title??""),T(n.body),L(n.tags),V(n.status),D(n.dueAt?n.dueAt.slice(0,10):""),H(ux(n.completedAt)),J.current=!1,q(n.priority),X(!1),Q("idle"),z.current=n.id)},[n==null?void 0:n.id,n]),c.useEffect(()=>{!n||J.current||H(ux(n.completedAt))},[n,n==null?void 0:n.completedAt]);const K=c.useMemo(()=>{if(!W||!n||z.current!==n.id)return null;const ge=n.kind==="note",Y=S.trim(),G=Y||(ge?null:Y),de={};G!==(n.title??"")&&!(G===null&&n.title===null)&&G!==n.title&&(de.title=G===""?null:G),P!==n.body&&(de.body=P),JSON.stringify(I)!==JSON.stringify(n.tags)&&(de.tags=I),M!==n.status&&(de.status=M),U!==n.priority&&(de.priority=U);const Ae=n.dueAt?n.dueAt.slice(0,10):"";if(Z!==Ae&&(de.dueAt=Z?new Date(Z).toISOString():null),n.kind==="task"&&M==="done"&&J.current){const Re=ux(n.completedAt);B!==Re&&(de.completedAt=B?new Date(B).toISOString():null)}return de},[W,n,S,P,I,M,U,Z,B]),ne=n!=null&&((Me=(Fe=n.metadata)==null?void 0:Fe.recurrence)==null?void 0:Me.role)==="occurrence";function se(ge){return i4e(ge,ne,F)}if(c.useEffect(()=>{if(!W||!n||!K||Object.keys(K).length===0)return;Q("idle");const ge=setTimeout(async()=>{Q("saving");try{await p.mutateAsync({id:n.id,fields:se(K)}),Q("saved")}catch{Q("error")}},I4e);return()=>clearTimeout(ge)},[W,K]),r||!n)return m.jsxs("div",{className:"flex items-center justify-between p-6 text-sm text-kumo-subtle",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[m.jsx(Su,{size:14}),"Loading…"]}),m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(Us,{size:14}),title:"Close (Esc)",className:"text-kumo-subtle",onClick:e})]});const ie=n,he=i==null?void 0:i.find(ge=>ge.id===ie.projectId),Se=he?`/p/${he.key}`:"",Oe=ie.kind==="note",be=K?Object.keys(K).length>0:!1,me=ge=>he?()=>w({kind:"quick-create",projectId:he.id,initialKind:ge,parentId:ie.id}):void 0;function ue(){A(ie.title??""),T(ie.body),L(ie.tags),V(ie.status),D(ie.dueAt?ie.dueAt.slice(0,10):""),q(ie.priority),Q("idle"),N("future"),X(!0)}async function ve(){if(!be||!K){X(!1);return}Q("saving");try{await p.mutateAsync({id:ie.id,fields:se(K)}),Q("saved"),X(!1)}catch{Q("error")}}async function xe(){g(n),e()}async function Ce(){if(!f||!confirm("Skip this recurring occurrence?"))return;const ge=await y.mutateAsync({taskId:ie.id});ge.next&&C(ge.next.id)}async function we(){!f||!confirm("Stop this recurrence series?")||await b.mutateAsync({ruleId:f.rule.id})}async function Le(ge,Y){if(!Y)throw new Error("First due date is required");const G=ie.dueAt?ie.dueAt.slice(0,10):"";Y!==G&&await p.mutateAsync({id:ie.id,fields:{dueAt:new Date(`${Y}T12:00:00Z`).toISOString()}}),await O.mutateAsync({taskId:ie.id,input:ge})}async function Ie(ge){if(!f)return;const{dtstart:Y,...G}=ge;await v.mutateAsync({ruleId:f.rule.id,input:G})}return m.jsxs(m.Fragment,{children:[m.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b border-kumo-line px-3",children:[m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(Us,{size:16}),title:"Close (Esc)",className:"text-kumo-subtle",onClick:e}),m.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-xs text-kumo-subtle",children:[he&&m.jsxs(m.Fragment,{children:[m.jsxs(Jh,{to:Se,className:"flex items-center gap-1 hover:opacity-80",children:[m.jsx(tc,{color:he.color,icon:he.icon,size:12}),m.jsx("span",{className:"font-mono tabular-nums",style:{color:he.color},children:he.key})]}),m.jsx(Pa,{size:11,className:"shrink-0 text-kumo-placeholder"})]}),m.jsx(Z8,{kind:n.kind,compact:!0}),n.sequenceId&&he&&m.jsxs("span",{className:"font-mono tabular-nums",children:[he.key,"-",n.sequenceId]})]}),m.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[W&&m.jsx(H4e,{state:R,dirty:be}),Oe&&m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(K2,{size:14,weight:n.pinned?"fill":"regular"}),title:n.pinned?"Unpin from opening brief":"Pin to opening brief","aria-pressed":n.pinned,className:n.pinned?"text-kumo-brand":"text-kumo-subtle",onClick:()=>p.mutate({id:n.id,fields:{pinned:!n.pinned}})}),W?m.jsx(nt,{size:"sm",icon:m.jsx(Fr,{size:14}),onClick:ve,children:"Done"}):m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(G2,{size:14}),title:"Edit",className:"text-kumo-subtle",onClick:ue}),m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(cu,{size:14}),title:"Delete",className:"text-kumo-subtle hover:bg-kumo-danger-tint hover:text-kumo-danger",onClick:xe})]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-thin",children:m.jsxs("div",{className:"px-6 py-5 space-y-4",children:[m.jsxs("div",{className:"space-y-1",children:[o&&m.jsx(z4e,{entity:n,parent:o,project:i==null?void 0:i.find(ge=>ge.id===o.projectId),siblings:a,onOpen:C}),W?m.jsx("input",{className:le("w-full bg-transparent px-0 py-1 text-lg font-semibold text-kumo-default outline-hidden placeholder:text-kumo-placeholder",!S&&"placeholder:italic"),value:S,placeholder:Oe?"Untitled":"Title","aria-label":"Title",onChange:ge=>A(ge.target.value),autoFocus:!0}):m.jsx("h2",{className:le("py-1 text-lg font-semibold",As(n)?"italic text-kumo-subtle":"text-kumo-default"),children:Or(n)})]}),m.jsx(D4e,{isEditing:W,isTask:n.kind==="task",status:M,setStatus:V,dueDate:Z,setDueDate:D,priority:U,setPriority:q,tags:I,setTags:L,completedAt:n.completedAt,completedAtStr:B,setCompletedAtStr:ge=>{J.current=!0,H(ge)},createdAt:n.createdAt,actorKind:((oe=n.actor)==null?void 0:oe.label)??n.actorKind,task:ie.kind==="task"?{...ie,status:M}:void 0,onStatusChange:V,recurrence:f,recurrenceBusy:p.isPending||O.isPending||y.isPending||b.isPending||v.isPending,onSaveRecurrence:Le,onSkipOccurrence:Ce,onStopRecurrence:we,onSplitRecurrence:Ie,isRecurringOccurrence:ne,occurrenceScope:F,setOccurrenceScope:N}),m.jsx("div",{className:"overflow-hidden rounded-lg border border-kumo-line bg-kumo-base",children:W?m.jsx(Z5,{value:P,onChange:ge=>T(ge),extensions:[bQ()],basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1},theme:$,minHeight:"220px",placeholder:"Write in Markdown…"}):P?m.jsx("div",{className:"min-h-[120px] p-3",children:m.jsx(Sb,{body:P})}):m.jsx("div",{className:"min-h-[120px] p-3 text-xs text-kumo-placeholder",children:"No description."})}),W&&P&&m.jsxs("details",{className:"text-xxs text-kumo-subtle",children:[m.jsx("summary",{className:"cursor-pointer hover:text-kumo-default",children:"Preview rendered Markdown"}),m.jsx("div",{className:"mt-2 rounded-lg border border-kumo-line bg-kumo-recessed p-3",children:m.jsx(Sb,{body:P})})]}),n.kind==="task"&&l.length>0&&m.jsx(X4e,{items:l,projects:i??[],onOpen:C,onAdd:me("task")}),n.kind==="task"&&u.length>0&&m.jsx(U4e,{items:u,onOpen:C,onAdd:me("note")}),n.kind==="task"&&he&&s&&(l.length===0||u.length===0)&&m.jsx("div",{className:"border-t border-kumo-hairline pt-3",children:m.jsxs("div",{className:"-ml-1.5 flex items-center gap-1",children:[l.length===0&&m.jsx(CM,{onClick:me("task"),children:"Add sub-task"}),u.length===0&&m.jsx(CM,{onClick:me("note"),children:"Add memory"})]})}),n.kind!=="comment"&&m.jsx(Y4e,{entity:n,canWrite:n.kind==="task"}),n.kind!=="comment"&&m.jsx(N4e,{entity:n})]})})]})}function N4e({entity:t}){const[e,n]=c.useState(!1),r=Z2e(t.id,{enabled:e}),i=r.data??[];return m.jsxs("section",{className:"border-t border-kumo-hairline pt-4",children:[m.jsxs("button",{type:"button","aria-expanded":e,className:"group flex h-6 w-full items-center gap-2 text-left",onClick:()=>n(s=>!s),children:[m.jsx(_j,{size:14,className:"shrink-0 text-kumo-subtle"}),m.jsx("span",{className:"text-xs font-semibold text-kumo-default",children:"Edits"}),e&&r.data&&m.jsx(jk,{n:i.length}),m.jsx(Pa,{size:12,className:le("ml-auto text-kumo-subtle transition-transform group-hover:text-kumo-default",e&&"rotate-90")})]}),e&&m.jsx("div",{className:"mt-2",children:r.isLoading?m.jsx("div",{className:"flex justify-center p-3 text-kumo-subtle",children:m.jsx(Su,{size:14})}):i.length===0?m.jsx("div",{className:"rounded-lg border border-dashed border-kumo-line p-3 text-center text-xs text-kumo-subtle",children:"Never edited since it was written."}):m.jsx("div",{className:"divide-y divide-kumo-hairline overflow-hidden rounded-lg border border-kumo-line",children:i.map((s,o)=>{const a=o===0?t:i[o-1];return m.jsx(Q4e,{before:s,after:a},s.id)})})})]})}function Q4e({before:t,after:e}){var o;const n=[];(t.title??"")!==(e.title??"")&&n.push(["title",t.title??"(untitled)",e.title??"(untitled)"]),t.status!==e.status&&n.push(["status",t.status,e.status]),t.priority!==e.priority&&n.push(["priority",t.priority,e.priority]),t.tags.join("\0")!==e.tags.join("\0")&&n.push(["tags",t.tags.join(", ")||"—",e.tags.join(", ")||"—"]);const r=t.body!==e.body,i=c.useMemo(()=>r?j2e(R2e(t.body,e.body)):[],[r,t.body,e.body]),s=((o=t.actor)==null?void 0:o.label)??t.actorKind;return m.jsxs("div",{className:"px-3 py-2 text-xs",children:[m.jsxs("div",{className:"flex items-baseline gap-2 text-xxs text-kumo-subtle",children:[m.jsxs("span",{className:"font-mono tabular-nums text-kumo-placeholder",children:["#",t.revision]}),m.jsx("span",{children:new Date(t.createdAt).toLocaleString()}),m.jsxs("span",{children:["· by ",m.jsx("span",{className:"text-kumo-default",children:s})]})]}),n.length>0&&m.jsx("ul",{className:"mt-1 space-y-0.5",children:n.map(([a,l,u])=>m.jsxs("li",{className:"text-xxs",children:[m.jsxs("span",{className:"text-kumo-subtle",children:[a,":"]})," ",m.jsx("span",{className:"text-kumo-danger line-through",children:l})," ",m.jsx("span",{className:"text-kumo-placeholder",children:"→"})," ",m.jsx("span",{className:"text-kumo-default",children:u})]},a))}),r&&m.jsx("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap wrap-break-word rounded-md bg-kumo-recessed p-2 font-mono text-xxs leading-relaxed",children:i.map((a,l)=>a.type==="skip"?m.jsxs("div",{className:"italic text-kumo-placeholder",children:["… ",a.count," unchanged line",a.count===1?"":"s"]},l):m.jsxs("div",{className:a.type==="add"?"bg-kumo-success-tint text-kumo-default":a.type==="del"?"bg-kumo-danger-tint text-kumo-subtle line-through":"text-kumo-subtle",children:[m.jsx("span",{className:"mr-1 select-none text-kumo-placeholder",children:a.type==="add"?"+":a.type==="del"?"−":" "}),a.text||" "]},l))}),!r&&n.length===0&&m.jsx("div",{className:"mt-1 text-xxs text-kumo-placeholder",children:"No visible difference."})]})}function Z4e(t){const e=t.rule,n=cH(e.rrule),r=n.preset??"daily",i=n.interval??1,s=i>1?`Every ${i} ${HH[r]}s`:DH[r],o=n.byWeekday.length?` · ${n.byWeekday.join(", ")}`:"",a=e.anchor==="completion"?"after completion":"scheduled",l=e.enabled?"":" · stopped",u=e.nextOccurrenceAt?` · next ${new Date(e.nextOccurrenceAt).toLocaleDateString()}`:"";return`${s}${o} · ${a}${u}${l}`}function vM(t){const e=t?cH(t.rule.rrule):void 0;return{preset:t?(e==null?void 0:e.preset)??"weekly":"none",interval:(e==null?void 0:e.interval)??1,anchor:(t==null?void 0:t.rule.anchor)??"scheduled",byWeekday:(e==null?void 0:e.byWeekday)??[],count:e!=null&&e.count?String(e.count):"",until:(e==null?void 0:e.until)??""}}function V4e({isEditing:t,task:e,dueDate:n,recurrence:r,onSave:i,onSkip:s,onStop:o,onSplit:a,busy:l}){const[u,f]=c.useState(()=>vM(r)),[p,g]=c.useState(null);if(c.useEffect(()=>{f(vM(r)),g(null)},[t,e==null?void 0:e.id,e==null?void 0:e.dueAt,r==null?void 0:r.rule.id,r==null?void 0:r.rule.rrule,r==null?void 0:r.rule.anchor]),!e)return null;const O=["done","rejected"].includes(e.status),y=!!(r!=null&&r.rule.enabled)&&(r==null?void 0:r.rule.currentOccurrenceId)===e.id,b=!!(r!=null&&r.rule.enabled),v=u.preset!=="none",w=!!i&&n.length>0&&v&&u.interval>=1,C=!!a&&!!(r!=null&&r.rule.enabled)&&v&&u.interval>=1;function S(I){f(L=>({...L,...I})),g(null)}function A(I){const L=new Set(u.byWeekday);L.has(I)?L.delete(I):L.add(I),S({byWeekday:vb.filter(M=>L.has(M))})}function P(){const I={preset:u.preset,interval:u.interval,anchor:u.anchor,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,allDay:!0};return u.preset==="weekly"&&u.byWeekday.length>0&&(I.byWeekday=u.byWeekday),u.count&&(I.count=Number(u.count)),u.until&&(I.until=new Date(`${u.until}T23:59:59Z`).toISOString()),I}async function T(){if(u.preset==="none"){g(null);return}if(!n){g("Set due date first");return}if(u.count&&u.until){g("Use count or until");return}try{await(i==null?void 0:i(P(),n)),g(null)}catch(I){g(I instanceof Error?I.message:"Could not save repeat")}}async function $(){if(u.preset!=="none"){if(u.count&&u.until){g("Use count or until");return}try{await(a==null?void 0:a(P())),g(null)}catch(I){g(I instanceof Error?I.message:"Could not split series")}}}return!t||O?m.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{className:r?"truncate text-kumo-subtle":"text-kumo-placeholder",children:r?Z4e(r):"None"}),y&&s&&m.jsx(nt,{variant:"ghost",size:"xs",className:"shrink-0 text-kumo-subtle",disabled:l,onClick:s,children:"Skip occurrence"})]}):m.jsxs("span",{className:"flex min-w-0 flex-col gap-1.5",children:[m.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx(ah,{label:"Repeat",value:u.preset,onChange:I=>S({preset:I}),options:[{value:"none",label:"None"},...lH.map(I=>({value:I,label:DH[I]}))]}),v&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-kumo-subtle",children:"every"}),m.jsx(mr,{type:"number",size:"sm",min:1,max:999,"aria-label":"Interval",className:"w-14",value:u.interval,onChange:I=>S({interval:Math.max(1,Number(I.target.value)||1)})}),m.jsxs("span",{className:"text-kumo-subtle",children:[HH[u.preset],u.interval===1?"":"s"," from"]}),m.jsx(ah,{label:"Anchor",value:u.anchor,onChange:I=>S({anchor:I}),options:[{value:"scheduled",label:"Schedule"},{value:"completion",label:"Completion"}]})]})]}),v&&u.preset==="weekly"&&m.jsx("span",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Weekdays",children:vb.map(I=>{const L=u.byWeekday.includes(I);return m.jsx(nt,{size:"xs",variant:L?"primary":"secondary","aria-pressed":L,className:"w-8 justify-center",onClick:()=>A(I),children:I},I)})}),v&&m.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx("span",{className:"text-kumo-subtle",children:"Ends after"}),m.jsx(mr,{type:"number",size:"sm",min:1,max:1e4,"aria-label":"Count",placeholder:"∞",className:"w-16",value:u.count,onChange:I=>S({count:I.target.value,until:I.target.value?"":u.until})}),m.jsx("span",{className:"text-kumo-subtle",children:"times, or on"}),m.jsx(mr,{type:"date",size:"sm","aria-label":"Until",className:"w-36",value:u.until,onChange:I=>S({until:I.target.value,count:I.target.value?"":u.count})})]}),(v||b&&o)&&m.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[v&&m.jsx(nt,{size:"xs",variant:"primary",disabled:l||!w,onClick:T,children:r?"Update repeat":"Save repeat"}),C&&m.jsx(nt,{size:"xs",disabled:l,title:"Keep past occurrences on the old cadence; apply this cadence going forward",onClick:$,children:"Split series"}),b&&o&&m.jsx(nt,{size:"xs",variant:"ghost",disabled:l,className:"text-kumo-subtle hover:bg-kumo-danger-tint hover:text-kumo-danger",onClick:o,children:"Stop series"}),v&&!n&&m.jsx("span",{className:"text-xxs text-kumo-placeholder",children:"Set due date first"}),p&&m.jsx("span",{className:"truncate text-xxs text-kumo-danger",children:p})]})]})}function ah({label:t,value:e,onChange:n,options:r,className:i}){const s=new Map(r.map(o=>[o.value,o]));return m.jsx(No,{size:"sm","aria-label":t,value:e,onValueChange:o=>{o!==null&&n(o)},renderValue:o=>{var a,l;return m.jsx(kM,{icon:(a=s.get(o))==null?void 0:a.icon,label:((l=s.get(o))==null?void 0:l.label)??o})},className:le("min-w-28",i),children:r.map(o=>m.jsx(No.Option,{value:o.value,className:"py-1 text-sm",children:m.jsx(kM,{icon:o.icon,label:o.label})},o.value))})}function kM({icon:t,label:e}){return m.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[t,m.jsx("span",{className:"truncate",children:e})]})}function D4e({isEditing:t,isTask:e,status:n,setStatus:r,dueDate:i,setDueDate:s,priority:o,setPriority:a,tags:l,setTags:u,completedAt:f,completedAtStr:p,setCompletedAtStr:g,createdAt:O,actorKind:y,task:b,onStatusChange:v,recurrence:w,recurrenceBusy:C,onSaveRecurrence:S,onSkipOccurrence:A,onStopRecurrence:P,onSplitRecurrence:T,isRecurringOccurrence:$,occurrenceScope:I,setOccurrenceScope:L}){return m.jsxs("div",{className:"grid auto-rows-[minmax(26px,auto)] grid-cols-[80px_1fr] items-center gap-x-3 gap-y-1.5 text-xs",children:[e&&m.jsxs(m.Fragment,{children:[m.jsx(al,{children:"Status"}),m.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:t?m.jsx(ah,{label:"Status",value:n,onChange:r,options:hH.map(M=>({value:M,label:m2[M]??M,icon:m.jsx(Ou,{status:M,size:12})}))}):m.jsxs(m.Fragment,{children:[b?m.jsx(I1,{task:b,size:12,onStatusChange:v}):m.jsx(Ou,{status:n,size:12}),m.jsx("span",{className:"text-kumo-default",children:m2[n]??n})]})}),m.jsx(al,{children:"Due"}),m.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:t?m.jsxs(m.Fragment,{children:[m.jsx(mr,{type:"date",size:"sm","aria-label":"Due date",className:"w-36",value:i,onChange:M=>s(M.target.value)}),i?m.jsx(SM,{label:"Clear due date",onClick:()=>s("")}):m.jsx(wM,{children:"inbox"})]}):m.jsx("span",{className:i?"tabular-nums text-kumo-default":"text-kumo-placeholder",children:i||"inbox"})}),(w||t&&b&&!["done","rejected"].includes(n))&&m.jsxs(m.Fragment,{children:[m.jsx(al,{top:t,children:"Repeat"}),m.jsx(V4e,{isEditing:t,task:b,dueDate:i,recurrence:w,busy:!!C,onSave:S,onSkip:A,onStop:P,onSplit:T})]}),t&&$&&m.jsxs(m.Fragment,{children:[m.jsx(al,{children:"Apply to"}),m.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:m.jsx(ah,{label:"Recurrence edit scope",value:I??"future",onChange:M=>L==null?void 0:L(M),className:"min-w-40",options:[{value:"future",label:"This and future"},{value:"this",label:"This occurrence only"}]})})]}),m.jsx(al,{children:"Priority"}),m.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:t?m.jsx(ah,{label:"Priority",value:o,onChange:a,options:jD.map(M=>({value:M,label:xu[M],icon:m.jsx(zl,{priority:M,size:12})}))}):m.jsxs(m.Fragment,{children:[m.jsx(zl,{priority:o,size:12}),m.jsx("span",{className:"text-kumo-default",children:xu[o]})]})}),n==="done"&&m.jsxs(m.Fragment,{children:[m.jsx(al,{children:"Completed"}),t?m.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[m.jsx(mr,{type:"datetime-local",size:"sm","aria-label":"Completed at",className:"w-48",value:p,onChange:M=>g(M.target.value)}),p?m.jsx(SM,{label:"Clear completed time",onClick:()=>g("")}):m.jsx(wM,{children:"auto"})]}):m.jsx("span",{className:"text-kumo-subtle",children:f?new Date(f).toLocaleString():"Not recorded"})]})]}),m.jsx(al,{children:"Tags"}),t?m.jsx(xZ,{"aria-label":"Tags",value:l,onValueChange:u,placeholder:l.length?"":"Add tag…",className:"min-h-6.5 gap-x-1 gap-y-1 px-1 py-0.5 text-xs [&>span]:h-5 [&>span]:text-xs"}):l.length?m.jsx("span",{className:"flex min-w-0 flex-wrap gap-1",children:l.map(M=>m.jsx(_8,{tag:M},M))}):m.jsx("span",{className:"text-kumo-placeholder",children:"none"}),m.jsx(al,{children:"Created"}),m.jsxs("span",{className:"text-kumo-subtle",children:[new Date(O).toLocaleString()," · by"," ",m.jsx("span",{className:"text-kumo-default",children:y})]})]})}function al({children:t,top:e=!1}){return m.jsx("span",{className:le("text-kumo-subtle",e&&"self-start leading-6.5"),children:t})}function wM({children:t}){return m.jsx("span",{className:"text-[11px] text-kumo-placeholder",children:t})}function SM({label:t,onClick:e}){return m.jsx(nt,{variant:"ghost",size:"xs",shape:"square",icon:m.jsx(Us,{size:12}),"aria-label":t,className:"size-5 text-kumo-subtle hover:text-kumo-danger",onClick:e})}function H4e({state:t,dirty:e}){return t==="saving"?m.jsxs("span",{className:"flex items-center gap-1 text-xxs text-kumo-subtle",children:[m.jsx(Su,{size:11}),"Saving…"]}):t==="saved"&&!e?m.jsxs("span",{className:"flex items-center gap-1 text-xxs text-kumo-placeholder",children:[m.jsx(Cj,{size:12}),"Saved"]}):t==="error"?m.jsx("span",{className:"text-xxs text-kumo-danger",children:"Save failed"}):e?m.jsxs("span",{className:"flex items-center gap-1 text-xxs text-kumo-placeholder",children:[m.jsx(Sj,{size:12}),"Unsaved"]}):null}function Rk({icon:t,title:e,meta:n,action:r}){return m.jsxs("div",{className:"mb-2 flex h-6 items-center gap-2",children:[m.jsx(t,{size:14,className:"shrink-0 text-kumo-subtle"}),m.jsx("h3",{className:"text-xs font-semibold text-kumo-default",children:e}),n,r&&m.jsx("div",{className:"ml-auto flex items-center",children:r})]})}function CM({onClick:t,children:e}){return m.jsx(nt,{variant:"ghost",size:"xs",className:"text-kumo-subtle hover:text-kumo-default",icon:m.jsx($i,{size:12}),onClick:t,children:e})}function jk({n:t}){return m.jsx("span",{className:"text-xs tabular-nums text-kumo-placeholder",children:t})}function F4e(t,e){if(!t.sequenceId)return null;const n=e.find(r=>r.id===t.projectId);return n?`${n.key}-${t.sequenceId}`:null}const _4e={task:"Sub-task of",note:"Memory for",comment:"Worklog on",feedback:"Linked to"};function z4e({entity:t,parent:e,project:n,siblings:r,onOpen:i}){const s=e.sequenceId&&n?`${n.key}-${e.sequenceId}`:null,o=(r??[]).filter(l=>l.kind==="task"),a=o.filter(l=>g2.has(l.status)).length;return m.jsxs("button",{type:"button",className:"group -mx-1.5 flex max-w-full items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs text-kumo-subtle transition-colors hover:bg-kumo-tint",title:`Open ${s??"parent"}`,onClick:()=>i(e.id),children:[m.jsx(Sg,{size:12,className:"shrink-0 text-kumo-placeholder"}),m.jsx("span",{className:"shrink-0",children:_4e[t.kind]}),e.kind==="task"&&m.jsx(Ou,{status:e.status,size:12}),s&&m.jsx("span",{className:"shrink-0 font-mono tabular-nums",children:s}),m.jsx("span",{className:"truncate font-medium text-kumo-default group-hover:text-kumo-link",children:Or(e)}),o.length>1&&m.jsxs("span",{className:"shrink-0 tabular-nums text-kumo-placeholder",children:["· ",a,"/",o.length]})]})}const g2=new Set(["done","rejected"]),EM={in_progress:0,open:1,done:2,rejected:3},B4e=3;function AM(t,e){return(EM[t.status]??1)-(EM[e.status]??1)}function X4e({items:t,projects:e,onOpen:n,onAdd:r}){const[i,s]=c.useState(!1),o=t.filter(p=>p.kind==="task"),a=o.filter(p=>!g2.has(p.status)).sort(AM),l=o.filter(p=>g2.has(p.status)).sort(AM),u=l.length>B4e,f=u&&!i?a:[...a,...l];return m.jsxs("section",{className:"border-t border-kumo-hairline pt-4",children:[m.jsx(Rk,{icon:iI,title:"Sub-tasks",meta:o.length>0?m.jsx(W4e,{tasks:o}):null,action:r&&m.jsx(nt,{variant:"ghost",size:"xs",icon:m.jsx($i,{size:12}),className:"text-kumo-link",onClick:r,children:"Add sub-task"})}),o.length>0&&m.jsxs("div",{className:"overflow-hidden rounded-lg border border-kumo-line",children:[f.length>0&&m.jsx("ul",{className:"divide-y divide-kumo-hairline",children:f.map(p=>m.jsx(q4e,{task:p,idLabel:F4e(p,e),onOpen:n},p.id))}),u&&m.jsxs("button",{type:"button","aria-expanded":i,className:`flex w-full items-center gap-1.5 bg-kumo-recessed/60 px-3 py-1.5 text-xxs text-kumo-subtle transition-colors hover:text-kumo-default ${f.length>0?"border-t border-kumo-hairline":""}`,onClick:()=>s(p=>!p),children:[m.jsx(Pa,{size:10,className:le("transition-transform",i&&"rotate-90")}),i?"Hide":"Show"," ",l.length," closed"]})]})]})}function W4e({tasks:t}){const e=l=>t.filter(u=>u.status===l).length,n=e("done"),r=e("rejected"),i=e("in_progress"),s=n+r,o=l=>`${l/t.length*100}%`,a=[`${n} done`,r&&`${r} rejected`,i&&`${i} in progress`,`${t.length-s-i} open`].filter(Boolean).join(" · ");return m.jsxs("span",{className:"flex items-center gap-2",title:a,children:[m.jsxs("span",{className:"flex h-1.5 w-20 overflow-hidden rounded-full bg-kumo-fill",children:[m.jsx("span",{className:"h-full bg-(--color-kumo-success)",style:{width:o(s)}}),m.jsx("span",{className:"h-full bg-(--color-kumo-warning)",style:{width:o(i)}})]}),m.jsxs("span",{className:"text-xs tabular-nums text-kumo-subtle",children:[s,"/",t.length]})]})}function q4e({task:t,idLabel:e,onOpen:n}){const r=g2.has(t.status),i=t.dueAt?new Date(t.dueAt):null,s=i!==null&&!r&&i.getTime()<new Date().setHours(0,0,0,0);return m.jsxs("li",{role:"button",tabIndex:0,className:"group flex cursor-pointer items-center gap-2.5 px-3 py-2 transition-colors hover:bg-kumo-tint focus-visible:bg-kumo-tint focus-visible:outline-hidden",onClick:()=>n(t.id),onKeyDown:o=>{o.key==="Enter"&&n(t.id)},children:[m.jsx(I1,{task:t,size:14}),e&&m.jsx("span",{className:"shrink-0 font-mono text-xxs tabular-nums text-kumo-subtle",children:e}),m.jsx("span",{className:le("min-w-0 flex-1 truncate text-sm",r?"text-kumo-subtle":"text-kumo-default group-hover:text-kumo-link"),children:Or(t)}),i&&!r&&m.jsx("span",{className:`shrink-0 text-xxs tabular-nums ${s?"text-kumo-danger":"text-kumo-subtle"}`,children:rr(i,"MMM d")}),t.priority!=="none"&&!r&&m.jsx("span",{title:`${xu[t.priority]} priority`,className:"flex",children:m.jsx(zl,{priority:t.priority,size:12})})]})}function U4e({items:t,onOpen:e,onAdd:n}){const r=t.filter(i=>i.kind==="note");return m.jsxs("section",{className:"border-t border-kumo-hairline pt-4",children:[m.jsx(Rk,{icon:O0,title:"Memory",meta:r.length>0?m.jsx(jk,{n:r.length}):null,action:n&&m.jsx(nt,{variant:"ghost",size:"xs",icon:m.jsx($i,{size:12}),className:"text-kumo-link",onClick:n,children:"Add memory"})}),r.length>0&&m.jsx("div",{className:"divide-y divide-kumo-hairline overflow-hidden rounded-lg border border-kumo-line",children:r.map(i=>m.jsxs("button",{type:"button",className:"flex w-full items-start gap-2 px-3 py-2 text-left transition-colors hover:bg-kumo-tint",onClick:()=>e(i.id),children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:le("truncate text-sm",As(i)?"italic text-kumo-subtle":"text-kumo-default"),children:Or(i)}),!As(i)&&i.body&&m.jsx("div",{className:"mt-0.5 truncate text-xxs text-kumo-subtle",children:i.body.replace(/\n/g," ").slice(0,140)})]}),i.pinned&&m.jsx(K2,{size:12,weight:"fill",className:"mt-1 shrink-0 text-kumo-brand"})]},i.id))})]})}const PM=5;function Y4e({entity:t,canWrite:e}){const{data:n,isLoading:r}=V2e(t.id),[i,s]=c.useState(!1),o=n??[];if(!e&&o.length===0)return null;const a=i||o.length<=PM+1?0:o.length-PM,l=o.slice(a),u=o.at(-1);return m.jsxs("section",{className:"border-t border-kumo-hairline pt-4",children:[m.jsx(Rk,{icon:q2,title:"Worklog",meta:o.length>0?m.jsx(jk,{n:o.length}):null,action:u&&m.jsxs("span",{className:"text-xxs text-kumo-placeholder",children:["Last entry ",zH(u.createdAt)]})}),r?m.jsx("div",{className:"flex justify-center p-3 text-kumo-subtle",children:m.jsx(Su,{size:14})}):m.jsxs("ol",{className:"mt-3",children:[a>0&&m.jsxs("li",{className:"relative flex gap-3 pb-5",children:[m.jsx(FH,{}),m.jsx("span",{className:"relative z-10 flex size-6 shrink-0 items-center justify-center rounded-full border border-dashed border-kumo-line bg-kumo-base text-[10px] tabular-nums text-kumo-subtle",children:a}),m.jsxs("button",{type:"button",className:"h-6 text-xs text-kumo-link hover:underline",onClick:()=>s(!0),children:["Show ",a," earlier ",a===1?"entry":"entries"]})]}),l.map((f,p)=>m.jsx(K4e,{entry:f,isLast:!e&&p===l.length-1},f.id)),e&&m.jsx(n6e,{entityId:t.id,isFirst:o.length===0})]})]})}function FH(){return m.jsx("span",{"aria-hidden":!0,className:"absolute bottom-0 left-3 top-6 w-px -translate-x-1/2 bg-kumo-line"})}const MM={agent:{icon:e3,className:"bg-kumo-brand-tint text-kumo-brand"},human:{icon:s3,className:"bg-kumo-fill text-kumo-default"},system:{icon:U2,className:"bg-kumo-fill text-kumo-subtle"}};function _H({kind:t}){const{icon:e,className:n}=MM[t]??MM.system;return m.jsx("span",{className:le("relative z-10 flex size-6 shrink-0 items-center justify-center rounded-full ring-4 ring-kumo-base",n),children:m.jsx(e,{size:13,weight:"bold"})})}function G4e(t){var n;const e=((n=t.actor)==null?void 0:n.label)??t.actorKind;return e===t.actorKind?e.charAt(0).toUpperCase()+e.slice(1):e}function zH(t){const e=new Date(t),n=Date.now()-e.getTime();return n<6e4?"just now":n<7*864e5?sfe(e,{addSuffix:!0}):rr(e,e.getFullYear()===new Date().getFullYear()?"MMM d":"MMM d, yyyy")}function K4e({entry:t,isLast:e}){return m.jsxs("li",{className:"relative flex gap-3 pb-5",children:[!e&&m.jsx(FH,{}),m.jsx(_H,{kind:t.actorKind}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex h-6 items-center gap-2 text-xs",children:[m.jsx("span",{className:"truncate font-medium text-kumo-default",children:G4e(t)}),m.jsx("time",{dateTime:t.createdAt,title:new Date(t.createdAt).toLocaleString(),className:"ml-auto shrink-0 tabular-nums text-kumo-placeholder",children:zH(t.createdAt)})]}),m.jsx(t6e,{body:t.body})]})]})}const J4e=600,e6e=12;function t6e({body:t}){const[e,n]=c.useState(!1),r=t.length>J4e||t.split(`
149
+ `);if(n.length>fM||r.length>fM)return[...n.map(f=>({type:"del",text:f})),...r.map(f=>({type:"add",text:f}))];const i=n.length,s=r.length,o=Array.from({length:i+1},()=>new Array(s+1).fill(0));for(let f=i-1;f>=0;f--)for(let p=s-1;p>=0;p--)o[f][p]=n[f]===r[p]?o[f+1][p+1]+1:Math.max(o[f+1][p],o[f][p+1]);const a=[];let l=0,u=0;for(;l<i&&u<s;)n[l]===r[u]?(a.push({type:"same",text:n[l]}),l++,u++):o[l+1][u]>=o[l][u+1]?(a.push({type:"del",text:n[l]}),l++):(a.push({type:"add",text:r[u]}),u++);for(;l<i;)a.push({type:"del",text:n[l++]});for(;u<s;)a.push({type:"add",text:r[u++]});return a}function j2e(t,e=2){const n=new Array(t.length).fill(!1);t.forEach((s,o)=>{if(s.type!=="same")for(let a=Math.max(0,o-e);a<=Math.min(t.length-1,o+e);a++)n[a]=!0});const r=[];let i=0;return t.forEach((s,o)=>{n[o]?(i>0&&r.push({type:"skip",count:i}),i=0,r.push(s)):i++}),i>0&&r.push({type:"skip",count:i}),r}const I2e="",CD="/login",$2e=new Set(["/v1/auth/login","/v1/auth/logout","/v1/auth/whoami","/health"]);function L2e(t){if(typeof window>"u"||window.location.pathname===CD)return!1;for(const e of $2e)if(t.startsWith(e))return!1;return!0}async function It(t,e){const n=new Headers(e==null?void 0:e.headers);(e==null?void 0:e.body)!==void 0&&(e==null?void 0:e.body)!==null&&!n.has("content-type")&&n.set("content-type","application/json");const r=await fetch(`${I2e}${t}`,{...e,credentials:"include",headers:n});if(r.status===401&&L2e(t)){const i=window.location.pathname+window.location.search;throw window.location.href=`${CD}?next=${encodeURIComponent(i)}`,new Error("unauthenticated")}if(!r.ok){let i="";try{i=await r.text()}catch{}throw new Error(`${(e==null?void 0:e.method)??"GET"} ${t} -> ${r.status} ${i}`)}if(r.status!==204)return await r.json()}const Zt={health:()=>It("/health"),listProjects:(t={})=>{const e=new URLSearchParams;t.includeArchived&&e.set("includeArchived","true");const n=e.size?`?${e.toString()}`:"";return It(`/v1/projects${n}`)},getProject:t=>It(`/v1/projects/${t}`),getProjectByKey:t=>It(`/v1/projects/by-key/${encodeURIComponent(t)}`),createProject:t=>It("/v1/projects",{method:"POST",body:JSON.stringify(t)}),updateProject:(t,e)=>It(`/v1/projects/${t}`,{method:"PATCH",body:JSON.stringify(e)}),openingBrief:(t,e=10)=>It(`/v1/projects/${t}/opening-brief`,{method:"POST",body:JSON.stringify({recentLimit:e})}),getEntity:t=>It(`/v1/entities/${t}`),entityRevisions:t=>It(`/v1/entities/${t}/revisions`),getEntityByKey:(t,e)=>It(`/v1/projects/by-key/${encodeURIComponent(t)}/entities/by-seq/${e}`),createTask:t=>It("/v1/tasks",{method:"POST",body:JSON.stringify(t)}),createNote:t=>It("/v1/notes",{method:"POST",body:JSON.stringify(t)}),writeEntity:t=>{if(t.kind==="task"){const{kind:r,...i}=t;return It("/v1/tasks",{method:"POST",body:JSON.stringify(i)})}const{kind:e,...n}=t;return It("/v1/notes",{method:"POST",body:JSON.stringify(n)})},updateEntity:(t,e)=>It(`/v1/entities/${t}`,{method:"PATCH",body:JSON.stringify(e)}),deleteEntity:t=>It(`/v1/entities/${t}`,{method:"DELETE"}),purgeEntity:t=>It(`/v1/entities/${t}?purge=true`,{method:"DELETE"}),restoreEntity:t=>It(`/v1/entities/${t}/restore`,{method:"POST"}),listTrash:(t=100)=>It(`/v1/trash?limit=${t}`),childEntities:t=>It(`/v1/entities/${t}/children`),listWorklog:(t,e=500)=>It(`/v1/entities/${t}/worklog?limit=${e}`),addWorklogEntry:(t,e)=>It(`/v1/entities/${t}/worklog`,{method:"POST",body:JSON.stringify(e)}),recent:(t={})=>It("/v1/recent",{method:"POST",body:JSON.stringify(t)}),search:t=>It("/v1/search",{method:"POST",body:JSON.stringify(t)}),listFeedback:(t={})=>{const e=new URLSearchParams;t.category&&e.set("category",t.category),t.status&&e.set("status",t.status),t.limit&&e.set("limit",String(t.limit));const n=e.size?`?${e.toString()}`:"";return It(`/v1/feedback${n}`)},getEmbeddingSettings:()=>It("/v1/settings/embedding"),updateEmbeddingSettings:t=>It("/v1/settings/embedding",{method:"PATCH",body:JSON.stringify(t)}),backfillEmbeddings:t=>It("/v1/settings/embedding/backfill",{method:"POST",body:JSON.stringify(t==null?{}:{limit:t})}),getWorkspaceSettings:()=>It("/v1/settings/workspace"),updateWorkspaceSettings:t=>It("/v1/settings/workspace",{method:"PATCH",body:JSON.stringify(t)}),tasksRange:t=>It("/v1/tasks/range",{method:"POST",body:JSON.stringify(t)}),configureRecurrence:(t,e)=>It(`/v1/tasks/${t}/recurrence`,{method:"POST",body:JSON.stringify(e)}),getRecurrence:t=>It(`/v1/tasks/${t}/recurrence`),skipOccurrence:(t,e)=>It(`/v1/tasks/${t}/skip-occurrence`,{method:"POST",body:JSON.stringify(e?{reason:e,actorKind:"human"}:{actorKind:"human"})}),stopRecurrence:(t,e)=>It(`/v1/recurrences/${t}/stop`,{method:"POST",body:JSON.stringify(e?{reason:e}:{})}),splitRecurrence:(t,e)=>It(`/v1/recurrences/${t}/split`,{method:"POST",body:JSON.stringify(e)}),listTokens:()=>It("/v1/tokens"),createToken:t=>It("/v1/tokens",{method:"POST",body:JSON.stringify({name:t})}),revokeToken:t=>It(`/v1/tokens/${t}`,{method:"DELETE"}),login:t=>It("/v1/auth/login",{method:"POST",body:JSON.stringify({password:t})}),logout:()=>It("/v1/auth/logout",{method:"POST"}),whoami:()=>It("/v1/auth/whoami")},R1=3e4;function N2e(){return Mr({queryKey:["health"],queryFn:Zt.health,staleTime:5*6e4})}function Qi(t={}){const e=!!t.includeArchived;return Mr({queryKey:["projects",e],queryFn:()=>Zt.listProjects({includeArchived:e})})}function Q2e(t){return Mr({queryKey:["project",t],queryFn:()=>Zt.getProject(t),enabled:!!t})}function ED(t){return Mr({queryKey:["project","by-key",t],queryFn:()=>Zt.getProjectByKey(t),enabled:!!t})}function hM(t){return Mr({queryKey:["entity",t],queryFn:()=>Zt.getEntity(t),enabled:!!t})}function Z2e(t,e={}){return Mr({queryKey:["revisions",t],queryFn:()=>Zt.entityRevisions(t),enabled:!!t&&(e.enabled??!0)})}function pM(t){return Mr({queryKey:["children",t],queryFn:()=>Zt.childEntities(t),enabled:!!t})}function V2e(t,e={}){return Mr({queryKey:["worklog",t],queryFn:()=>Zt.listWorklog(t),enabled:!!t&&(e.enabled??!0)})}function D2e(){const t=lr();return Dr({mutationFn:({parentId:e,input:n})=>Zt.addWorklogEntry(e,n),onSuccess:(e,{parentId:n})=>{t.invalidateQueries({queryKey:["worklog",n]}),t.invalidateQueries({queryKey:["opening-brief",e.projectId??void 0]}),t.invalidateQueries({queryKey:["recent"]})}})}function H2e(t,e={}){return Mr({queryKey:["recent",t],queryFn:()=>Zt.recent(t),refetchInterval:e.poll===!1?!1:R1})}function ok(t,e,n={}){return Mr({queryKey:["entity-list",t,e],queryFn:()=>Zt.recent({projectId:t??null,kinds:e??null,limit:100}),enabled:!!t,refetchInterval:n.poll===!1?!1:R1})}function AD(t){return Mr({queryKey:["search",t],queryFn:()=>Zt.search(t),enabled:!!(t&&t.query.length>0)})}function F2e(t={},e={}){return Mr({queryKey:["feedback",t],queryFn:()=>Zt.listFeedback(t),refetchInterval:e.poll===!1?!1:R1})}function PD(t=100){return Mr({queryKey:["trash",t],queryFn:()=>Zt.listTrash(t)})}const _2e=[["trash"],["tasks-range"],["recent"],["entity-list"],["feedback"]];function z2e(){const t=lr();return Dr({mutationFn:e=>Zt.restoreEntity(e),onSuccess:()=>{for(const e of _2e)t.invalidateQueries({queryKey:e})}})}function B2e(){const t=lr();return Dr({mutationFn:e=>Zt.purgeEntity(e),onSuccess:()=>{t.invalidateQueries({queryKey:["trash"]})}})}function X2e(){return Mr({queryKey:["settings","embedding"],queryFn:Zt.getEmbeddingSettings,refetchInterval:R1})}function W2e(){const t=lr();return Dr({mutationFn:e=>Zt.updateEmbeddingSettings(e),onSuccess:e=>{t.setQueryData(["settings","embedding"],e),t.invalidateQueries({queryKey:["health"]})}})}function q2e(){const t=lr();return Dr({mutationFn:e=>Zt.backfillEmbeddings(e),onSuccess:e=>{t.setQueryData(["settings","embedding"],e.settings)}})}function U2e(){return Mr({queryKey:["settings","workspace"],queryFn:Zt.getWorkspaceSettings})}function Y2e(){const t=lr();return Dr({mutationFn:e=>Zt.updateWorkspaceSettings(e),onSuccess:e=>{t.setQueryData(["settings","workspace"],e)}})}function Pu(t,e={}){return Mr({queryKey:["tasks-range",t],queryFn:()=>Zt.tasksRange(t),refetchInterval:e.poll===!1?!1:R1})}function G2e(t){return Mr({queryKey:["recurrence",t],queryFn:()=>Zt.getRecurrence(t),enabled:!!t,retry:!1})}function MD(){const t=lr();return Dr({mutationFn:({taskId:e,input:n})=>Zt.configureRecurrence(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["entity",e.currentOccurrenceId??void 0]}),t.invalidateQueries({queryKey:["recurrence"]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["entity-list"]})}})}function K2e(){const t=lr();return Dr({mutationFn:({taskId:e,reason:n})=>Zt.skipOccurrence(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["entity",e.skipped.id]}),e.next&&t.invalidateQueries({queryKey:["entity",e.next.id]}),t.invalidateQueries({queryKey:["recurrence"]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["entity-list"]})}})}function J2e(){const t=lr();return Dr({mutationFn:({ruleId:e,reason:n})=>Zt.stopRecurrence(e,n),onSuccess:()=>{t.invalidateQueries({queryKey:["recurrence"]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["entity-list"]})}})}function e8e(){const t=lr();return Dr({mutationFn:({ruleId:e,input:n})=>Zt.splitRecurrence(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["entity",e.currentOccurrenceId??void 0]}),t.invalidateQueries({queryKey:["recurrence"]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["entity-list"]})}})}function t8e(){const t=lr();return Dr({mutationFn:e=>Zt.createProject(e),onSuccess:()=>{t.invalidateQueries({queryKey:["projects"]})}})}function n8e(){const t=lr();return Dr({mutationFn:({id:e,fields:n})=>Zt.updateProject(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["projects"]}),t.setQueryData(["project",e.id],e),t.invalidateQueries({queryKey:["project","by-key",e.key]}),t.invalidateQueries({queryKey:["opening-brief",e.id]})}})}function TD(){const t=lr();return Dr({mutationFn:e=>Zt.writeEntity(e),onSuccess:e=>{t.invalidateQueries({queryKey:["entity-list",e.projectId??void 0]}),t.invalidateQueries({queryKey:["opening-brief",e.projectId??void 0]}),t.invalidateQueries({queryKey:["recent"]}),t.invalidateQueries({queryKey:["tasks-range"]}),e.parentId&&t.invalidateQueries({queryKey:["children",e.parentId]})}})}function ec(){const t=lr();return Dr({mutationFn:({id:e,fields:n})=>Zt.updateEntity(e,n),onSuccess:e=>{t.invalidateQueries({queryKey:["entity",e.id]}),t.invalidateQueries({queryKey:["entity-list",e.projectId??void 0]}),t.invalidateQueries({queryKey:["opening-brief",e.projectId??void 0]}),t.invalidateQueries({queryKey:["tasks-range"]}),t.invalidateQueries({queryKey:["children"]}),t.invalidateQueries({queryKey:["revisions",e.id]}),e.kind==="feedback"&&t.invalidateQueries({queryKey:["feedback"]})}})}function r8e(){const t=lr();return Dr({mutationFn:({id:e,agentsMd:n})=>Zt.updateProject(e,{agentsMd:n}),onSuccess:e=>{t.invalidateQueries({queryKey:["project","by-key",e.key]}),t.invalidateQueries({queryKey:["opening-brief",e.id]}),t.invalidateQueries({queryKey:["projects"]})}})}function i8e(){return Mr({queryKey:["tokens"],queryFn:Zt.listTokens})}function s8e(){const t=lr();return Dr({mutationFn:e=>Zt.createToken(e),onSuccess:()=>{t.invalidateQueries({queryKey:["tokens"]})}})}function o8e(){const t=lr();return Dr({mutationFn:e=>Zt.revokeToken(e),onSuccess:(e,n)=>{t.setQueryData(["tokens"],r=>(r==null?void 0:r.filter(i=>i.id!==n))??r),t.invalidateQueries({queryKey:["tokens"],refetchType:"active"})}})}const a8e=["task","note","worklog","feedback"],l8e=["bug","feature","friction","idea"],c8e=["task","note"],RD=["planned","active","watching","paused","archived"],jD=["urgent","high","medium","low","none"],ID=["light","dark","system"],$D="botnote.colorMode",LD="(prefers-color-scheme: dark)",yb=new Set;let N8=d8e();function u8e(t){return ID.includes(t)}function d8e(){try{const t=window.localStorage.getItem($D);return u8e(t)?t:"system"}catch{return"system"}}function f8e(){return typeof window.matchMedia=="function"&&window.matchMedia(LD).matches}function h8e(t,e){return t==="system"?e?"dark":"light":t}function ak(){document.documentElement.dataset.mode=h8e(N8,f8e()),yb.forEach(t=>t())}function p8e(){return document.documentElement.dataset.mode==="dark"}function m8e(){return N8}function g8e(t){N8=t;try{window.localStorage.setItem($D,t)}catch{}ak()}function ND(t){return yb.add(t),()=>yb.delete(t)}function O8e(){if(typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia(LD),e=()=>{N8==="system"&&ak()};return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function x8e(){return[c.useSyncExternalStore(ND,m8e),g8e]}function y8e(){return c.useSyncExternalStore(ND,p8e)}const QD=Be.theme({"&.cm-editor":{backgroundColor:"transparent",color:"var(--text-color-kumo-default)"},"&.cm-editor .cm-gutters":{backgroundColor:"var(--color-kumo-tint)",color:"var(--text-color-kumo-placeholder)",borderRight:"1px solid var(--color-kumo-hairline)"}}),b8e=[QD],v8e=[fV,QD];function ZD(){return y8e()?v8e:b8e}function ro(){const[t,e]=e1(),n=t.get("d"),r=c.useCallback(s=>{e(o=>{const a=new URLSearchParams(o);return a.set("d",s),a})},[e]),i=c.useCallback(()=>{e(s=>{const o=new URLSearchParams(s);return o.delete("d"),o})},[e]);return{openId:n,open:r,close:i}}function Or(t){var n;if(t.title&&t.title.trim())return t.title;const e=((n=t.body.split(`
150
+ `).find(r=>r.trim()))==null?void 0:n.trim())??"";return e?e.length>60?`${e.slice(0,60)}…`:e:"Untitled"}function As(t){return!t.title||!t.title.trim()}function k8e(t,e=!1){const{overflowY:n}=hi(t);return n!=="auto"&&n!=="scroll"?!1:e?t.clientHeight>0:t.scrollHeight>t.clientHeight}function VD(t,e){const n=(e??un(t).getComputedStyle(t)).transform;let r=0,i=0,s=1;if(n&&n!=="none"){const o=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(o){const a=o[1].split(", ").map(parseFloat);a.length===6?(r=a[4],i=a[5],s=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(r=a[12],i=a[13],s=a[0])}}return{x:r,y:i,scale:s}}function ox(t,e,n){switch(t){case"up":return-n;case"down":return n;case"left":return-e;case"right":return e;default:return 0}}const lk=c.createContext(void 0);lk.displayName="ToastContext";function j1(){const t=c.useContext(lk);if(!t)throw new Error("Base UI: useToastManager must be used within <Toast.Provider>.");return t}let mM=0;function DD(t){return mM+=1,`${t}-${Math.random().toString(36).slice(2,6)}-${mM}`}function ax(t,e){if(typeof t=="string")return{description:t};if(typeof t=="function"){const n=t(e);return typeof n=="string"?{description:n}:n}return t}function lx(t){const e=new Map;let n=0,r=0;return t.forEach((i,s)=>{const o=i.transitionStatus==="ending";e.set(i.id,{value:i,domIndex:s,visibleIndex:o?-1:n,offsetY:r}),r+=i.height||0,o||(n+=1)}),e}function cx(t,e){let n=0;return t.map(r=>{if(r.transitionStatus==="ending")return r;const i=n>=e;return n+=1,r.limited===i?r:{...r,limited:i}})}const Vs={toasts:t=>t.toasts,isEmpty:t=>t.toasts.length===0,toast:(t,e)=>{var n;return(n=t.toastMetadata.get(e))==null?void 0:n.value},toastIndex:(t,e)=>{var n;return((n=t.toastMetadata.get(e))==null?void 0:n.domIndex)??-1},toastOffsetY:(t,e)=>{var n;return((n=t.toastMetadata.get(e))==null?void 0:n.offsetY)??0},toastVisibleIndex:(t,e)=>{var n;return((n=t.toastMetadata.get(e))==null?void 0:n.visibleIndex)??-1},focused:t=>t.focused,expanded:t=>t.hovering||t.focused,expandedOrOutOfFocus:t=>t.hovering||t.focused||!t.isWindowFocused,prevFocusElement:t=>t.prevFocusElement};var w8e=class extends wu{constructor(e){super({...e,toastMetadata:lx(e.toasts)},{},Vs);$t(this,"timers",new Map);$t(this,"areTimersPaused",!1);$t(this,"setViewport",e=>{this.set("viewport",e)});$t(this,"disposeEffect",()=>()=>{this.timers.forEach(e=>{var n;(n=e.timeout)==null||n.clear()}),this.timers.clear()});$t(this,"addToast",e=>{const{timeout:n,limit:r}=this.state,i=e.id||DD("toast");if(e.id){const l=Vs.toast(this.state,e.id);if(l)if(l.transitionStatus==="ending")this.removeToast(e.id,!0);else{const{id:u,transitionStatus:f,...p}=e;return this.updateToastInternal(e.id,p,!0,!0),e.id}}const s={...e,id:i,updateKey:0,transitionStatus:"starting"},o=[s,...this.state.toasts];this.setToasts(cx(o,r));const a=s.timeout??n;return s.type!=="loading"&&a>0&&this.scheduleTimer(i,a,()=>this.closeToast(i)),Vs.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i});$t(this,"updateToast",(e,n)=>{const r=Vs.toast(this.state,e);!r||r.transitionStatus==="ending"||this.updateToastInternal(e,typeof n=="function"?n(r):n,!1,!0)});$t(this,"updateToastInternal",(e,n,r=!1,i=!1)=>{const{timeout:s,toasts:o}=this.state,a=Vs.toast(this.state,e);if(!a||a.transitionStatus==="ending")return;const l={...a,...n,...i&&{updateKey:a.updateKey+1}};this.setToasts(o.map(v=>v.id===e?l:v));const u=l.timeout??s,f=a.timeout??s,p=Object.hasOwn(n,"timeout"),g=l.transitionStatus!=="ending"&&l.type!=="loading"&&u>0,O=this.timers.has(e),y=f!==u,b=a.type==="loading";if(!g&&O){this.clearTimer(e);return}g&&(!O||y||p||b||r)&&(this.clearTimer(e),this.scheduleTimer(e,u,()=>this.closeToast(e)),Vs.expandedOrOutOfFocus(this.state)&&this.pauseTimers())});$t(this,"closeToast",e=>{const n=e===void 0,{limit:r,toasts:i}=this.state;let s;if(n)s=i,this.clearTimers();else{const a=Vs.toast(this.state,e);if(!a)return;s=[a],this.clearTimer(e)}const o=cx(i.map(a=>n||a.id===e?{...a,transitionStatus:"ending",height:0}:a),r);this.setToasts(o,!o.some(a=>a.transitionStatus!=="ending")),s.forEach(a=>{var l;a.transitionStatus!=="ending"&&((l=a.onClose)==null||l.call(a))}),this.handleFocusManagement(e)});$t(this,"promiseToast",(e,n)=>{const r=ax(n.loading),i=this.addToast({...r,type:"loading"}),s=e.then(o=>{const a=ax(n.success,o);return this.updateToast(i,{...a,type:"success",timeout:a.timeout}),o}).catch(o=>{const a=ax(n.error,o);return this.updateToast(i,{...a,type:"error",timeout:a.timeout}),Promise.reject(o)});return{}.hasOwnProperty.call(n,"setPromise")&&n.setPromise(s),s});$t(this,"handleDocumentPointerDown",e=>{if(e.pointerType!=="touch")return;const n=ln(e);Ue(this.state.viewport,n)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))})}syncProviderProps(e,n){const r=this.state.limit!==n;if(this.state.timeout===e&&!r)return;const i={timeout:e,limit:n};if(r){const s=cx(this.state.toasts,n);i.toasts=s,i.toastMetadata=lx(s)}this.update(i)}removeToast(e,n=!1){var o;const r=Vs.toastIndex(this.state,e);if(r===-1)return;const i=this.state.toasts[r];n||(o=i==null?void 0:i.onRemove)==null||o.call(i);const s=[...this.state.toasts];s.splice(r,1),this.setToasts(s)}pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{e.timeout&&(e.timeout.clear(),e.remaining=Math.max(e.remaining-(Date.now()-e.start),0))}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,n)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??(e.timeout=qs.create()),e.timeout.start(e.remaining,()=>{this.handleTimerFired(n),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){var e;(e=this.state.prevFocusElement)==null||e.focus({preventScroll:!0})}scheduleTimer(e,n,r){const i=Date.now(),s=Vs.expandedOrOutOfFocus(this.state)?void 0:qs.create();s==null||s.start(n,()=>{this.handleTimerFired(e),r()}),this.timers.set(e,{timeout:s,start:i,delay:n,remaining:n,callback:r})}clearTimers(){this.timers.forEach(e=>{var n;(n=e.timeout)==null||n.clear()}),this.timers.clear(),this.areTimersPaused=!1}clearTimer(e){var n,r;(r=(n=this.timers.get(e))==null?void 0:n.timeout)==null||r.clear(),this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}handleTimerFired(e){this.timers.delete(e),this.resetPausedStateIfNoTimersRemain()}resetPausedStateIfNoTimersRemain(){this.timers.size===0&&(this.areTimersPaused=!1)}setToasts(e,n=e.length===0){const r={toasts:e,toastMetadata:lx(e)};n&&(r.hovering=!1,r.focused=!1),this.update(r)}handleFocusManagement(e){var a,l;const n=Gn(Ct(this.state.viewport));if(!this.state.viewport||!Ue(this.state.viewport,n)||!xg(n))return;if(e===void 0){this.restoreFocusToPrevElement();return}const r=Vs.toasts(this.state),i=Vs.toastIndex(this.state,e),s=(u,f)=>{for(let p=u;p>=0&&p<r.length;p+=f)if(r[p].transitionStatus!=="ending")return r[p];return null},o=s(i+1,1)??s(i-1,-1);o?(l=(a=o.ref)==null?void 0:a.current)==null||l.focus():this.restoreFocusToPrevElement()}};const ck=function(e){const{children:n,timeout:r=5e3,limit:i=3,toastManager:s}=e,o=Qn(()=>new w8e({timeout:r,limit:i,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return _2(o.disposeEffect),c.useEffect(function(){if(s)return s[" subscribe"](({action:l,options:u})=>{const f=u.id;l==="promise"&&u.promise?o.promiseToast(u.promise,u):l==="update"&&f?o.updateToast(f,u.updates):l==="close"?o.closeToast(f):o.addToast(u)})},[o,s]),m.jsxs(lk.Provider,{value:o,children:[m.jsx(S8e,{store:o,timeout:r,limit:i}),n]})};ck.displayName="ToastProvider";function S8e(t){const{store:e,timeout:n,limit:r}=t;return Pe(()=>{e.syncProviderProps(n,r)},[e,n,r]),null}const C8e="--toast-frontmost-height",uk=c.forwardRef(function(e,n){var X;const{render:r,className:i,style:s,children:o,...a}=e,l=j1(),u=wn(),f=c.useRef(!1),p=c.useRef(!1),g=c.useRef(!1),O=l.useState("isEmpty"),y=l.useState("toasts"),b=l.useState("focused"),v=l.useState("expanded"),w=l.useState("prevFocusElement"),C=(X=y[0])==null?void 0:X.height,S=y.some(R=>R.transitionStatus==="ending"),A=y.filter(R=>R.priority==="high");c.useEffect(()=>{const R=l.state.viewport;if(!R||O)return;const Q=un(R),F=Ct(R);function N(K){K.key==="F6"&&ln(K)!==R&&(K.preventDefault(),l.set("prevFocusElement",Gn(F)),R==null||R.focus({preventScroll:!0}),l.pauseTimers(),l.set("focused",!0))}function z(K){ln(K)===Q&&(l.set("isWindowFocused",!1),l.pauseTimers())}function J(K){if(K.relatedTarget)return;const ne=ln(K),se=Gn(Ct(R));(ne===Q||!Ue(R,ne)||!xg(se))&&l.resumeTimers(),u.start(0,()=>l.set("isWindowFocused",!0))}return zs(wt(Q,"keydown",N),wt(Q,"blur",z,!0),wt(Q,"focus",J,!0),wt(F,"pointerdown",l.handleDocumentPointerDown,!0))},[l,u,O]);function P(R){var F,N;f.current=!0;const Q=R.relatedTarget===l.state.viewport?y.find(z=>z.transitionStatus!=="ending"&&!z.limited):void 0;Q?(N=(F=Q.ref)==null?void 0:F.current)==null||N.focus():l.restoreFocusToPrevElement()}function T(R){R.key==="Tab"&&R.shiftKey&&ln(R.nativeEvent)===l.state.viewport&&(R.preventDefault(),l.restoreFocusToPrevElement())}function $(){l.state.toasts.some(R=>R.transitionStatus==="ending")||g.current||!p.current||(l.state.isWindowFocused&&l.resumeTimers(),l.set("hovering",!1),p.current=!1)}c.useEffect($,[S,l]);function I(){l.pauseTimers(),l.set("hovering",!0),p.current=!1}function L(){l.state.isWindowFocused&&l.resumeTimers()}function M(){p.current=!0,$()}function V(R){R.pointerType==="touch"&&(g.current=!0)}function Z(R){R.pointerType==="touch"&&(g.current=!1,$())}function D(){if(f.current){f.current=!1;return}b||xg(Gn(Ct(l.state.viewport)))&&(l.set("focused",!0),l.pauseTimers())}function B(R){!b||Ue(l.state.viewport,R.relatedTarget)||(l.set("focused",!1),L())}const H={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:I,onMouseMove:I,onMouseLeave:M,onFocus:D,onBlur:B,onKeyDown:T,onClick:D,onPointerDown:V,onPointerUp:Z,onPointerCancel:Z,style:{[C8e]:C?`${C}px`:void 0}},U={expanded:v},q=!O&&w&&m.jsx(Ll,{onFocus:P}),W=He("div",e,{ref:[n,l.setViewport],state:U,props:[H,a,{children:m.jsxs(c.Fragment,{children:[q,o,q]})}]});return m.jsxs(c.Fragment,{children:[q,W,!b&&A.length>0&&m.jsx("div",{style:ku,children:A.map(R=>m.jsxs("div",{role:"alert","aria-atomic":!0,children:[m.jsx("div",{children:R.title}),m.jsx("div",{children:R.description})]},R.id))})]})});uk.displayName="ToastViewport";const dk=c.createContext(void 0);dk.displayName="ToastRootContext";function Q8(){const t=c.useContext(dk);if(!t)throw new Error("Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.");return t}const HD="--toast-index",E8e="--toast-offset-y",A8e="--toast-height",P8e="--toast-swipe-movement-x",M8e="--toast-swipe-movement-y",T8e="data-swipe-direction",R8e={...is,swipeDirection(t){return t?{[T8e]:t}:null}},gM=40,j8e=10,OM=.5,I8e=1,$8e=`${jY},${IY}`,fk=c.forwardRef(function(e,n){var Me;const{toast:r,render:i,className:s,swipeDirection:o=["down","right"],style:a,...l}=e,u=((Me=r.positionerProps)==null?void 0:Me.anchor)!==void 0;let f=[];u||(f=Array.isArray(o)?o:[o]);const p=f.length>0,g=j1(),[O,y]=c.useState(void 0),[b,v]=c.useState(!1),[w,C]=c.useState(!1),[S,A]=c.useState({x:0,y:0}),[P,T]=c.useState({x:0,y:0,scale:1}),[$,I]=c.useState(),[L,M]=c.useState(),[V,Z]=c.useState(null),D=c.useRef(null),B=c.useRef(void 0),H=c.useRef({x:0,y:0}),U=c.useRef({x:0,y:0,scale:1}),q=c.useRef(void 0),W=c.useRef(0),X=c.useRef(!1),R=c.useRef({x:0,y:0}),Q=c.useRef(!1),F=c.useRef({x:0,y:0}),N=c.useRef(null),z=c.useRef(null),J=g.useState("toastIndex",r.id),K=g.useState("toastVisibleIndex",r.id),ne=g.useState("toastOffsetY",r.id),se=g.useState("focused"),ie=g.useState("expanded");Hr({open:r.transitionStatus!=="ending",ref:D,onComplete(){r.transitionStatus==="ending"&&g.removeToast(r.id)}});const he=Ee((oe=!1)=>{const ge=D.current;if(!ge)return;const Y=ge.style.height;ge.style.height="auto";const G=ge.offsetHeight;ge.style.height=Y;function de(){g.updateToastInternal(r.id,{ref:D,height:G,transitionStatus:void 0})}oe?ts.flushSync(de):de()});Pe(()=>{const oe=B.current;r.transitionStatus!=="starting"&&oe===r.id||(oe!==void 0&&(y(void 0),T({x:0,y:0,scale:1}),Se({x:0,y:0})),B.current=r.id,he())},[he,r.id,r.transitionStatus]);function Se(oe){F.current=oe,A(oe)}Pe(()=>()=>{var oe;(oe=z.current)==null||oe.abort()},[]);function Oe(oe,ge){const Y=Ae=>Ae>0?Ae**OM:-(Math.abs(Ae)**OM),G=oe>0&&!f.includes("right")||oe<0&&!f.includes("left"),de=ge>0&&!f.includes("down")||ge<0&&!f.includes("up");return{x:G?Y(oe):oe,y:de?Y(ge):ge}}const be=Ee(oe=>{var Re;if(oe.pointerId!==N.current)return;N.current=null,(Re=z.current)==null||Re.abort(),z.current=null,v(!1),C(!1),Z(null);const ge=U.current;if(oe.type==="pointercancel"||X.current){Se({x:ge.x,y:ge.y}),y(void 0);return}const Y=F.current,G=Y.x-ge.x,de=Y.y-ge.y;let Ae;for(const Ge of f)if(ox(Ge,G,de)>gM){Ae=Ge;break}Ae?(y(Ae),g.closeToast(r.id)):(Se({x:ge.x,y:ge.y}),y(void 0))});function me(oe){var Ae,Re,Ge;if(oe.button!==0||(oe.pointerType==="touch"&&g.pauseTimers(),(Ae=ln(oe.nativeEvent))!=null&&Ae.closest(`button,a,input,textarea,[role="button"],${$8e}`)))return;X.current=!1,q.current=void 0,W.current=0,N.current=oe.pointerId,H.current={x:oe.clientX,y:oe.clientY},R.current=H.current;const ge=oe.currentTarget,Y=VD(ge);U.current=Y,T(Y),Se({x:Y.x,y:Y.y}),g.set("hovering",!0),v(!0),C(!1),Z(null),Q.current=!0,(Re=z.current)==null||Re.abort();const G=new AbortController;z.current=G;const de=Ct(ge);de.addEventListener("pointerup",be,{signal:G.signal}),de.addEventListener("pointercancel",be,{signal:G.signal}),(Ge=ge.setPointerCapture)==null||Ge.call(ge,oe.pointerId)}function ue(oe){if(oe.pointerId!==N.current)return;oe.preventDefault(),Q.current&&(H.current={x:oe.clientX,y:oe.clientY},Q.current=!1);const{clientY:ge,clientX:Y,movementX:G,movementY:de}=oe;(de<0&&ge>R.current.y||de>0&&ge<R.current.y)&&(R.current={x:R.current.x,y:ge}),(G<0&&Y>R.current.x||G>0&&Y<R.current.x)&&(R.current={x:Y,y:R.current.y});const Ae=Y-H.current.x,Re=ge-H.current.y,Ge=ge-R.current.y,dt=Y-R.current.x;let Te=V;if(!w&&Math.sqrt(Ae*Ae+Re*Re)>=I8e){C(!0);const Mt=f.includes("left")||f.includes("right"),Ht=f.includes("up")||f.includes("down");Mt&&Ht&&(Te=Math.abs(Ae)>Math.abs(Re)?"horizontal":"vertical",Z(Te))}let Ke;if(!q.current)Te==="vertical"?Re>0?Ke="down":Re<0&&(Ke="up"):Te==="horizontal"?Ae>0?Ke="right":Ae<0&&(Ke="left"):Math.abs(Ae)>=Math.abs(Re)?Ke=Ae>0?"right":"left":Ke=Re>0?"down":"up",Ke&&f.includes(Ke)&&(q.current=Ke,W.current=ox(Ke,Ae,Re),y(Ke));else{const Mt=q.current,Ht=ox(Mt,dt,Ge);Ht>gM?(X.current=!1,y(Mt)):!(f.includes("left")&&f.includes("right"))&&!(f.includes("up")&&f.includes("down"))&&W.current-Ht>=j8e&&(X.current=!0)}const gt=Oe(Ae,Re);let Pt=U.current.x,jt=U.current.y;const et=f.includes("left")||f.includes("right"),Yt=f.includes("up")||f.includes("down");Te!=="vertical"&&et&&(Pt+=gt.x),Te!=="horizontal"&&Yt&&(jt+=gt.y),Se({x:Pt,y:jt})}function ve(oe){if(oe.key==="Escape"){if(!D.current||!Ue(D.current,Gn(Ct(D.current))))return;g.closeToast(r.id)}}c.useEffect(()=>{const oe=D.current;if(!p||!oe)return;function ge(Y){N.current===null||!Ue(oe,ln(Y))||Y.preventDefault()}return wt(oe,"touchmove",ge,{passive:!1})},[p]);function xe(){const oe=S.x-P.x,ge=S.y-P.y;return{transition:b?"none":void 0,transform:b?`translateX(${S.x}px) translateY(${S.y}px) scale(${P.scale})`:void 0,[P8e]:`${oe}px`,[M8e]:`${ge}px`}}const Ce=r.priority==="high",we={role:Ce?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":$,"aria-describedby":L,"aria-hidden":Ce&&!se?!0:void 0,onPointerDown:p?me:void 0,onPointerMove:p?ue:void 0,onPointerUp:p?be:void 0,onPointerCancel:p?be:void 0,onKeyDown:ve,inert:C1(r.limited),style:{...xe(),[HD]:r.transitionStatus==="ending"?J:K,[E8e]:`${ne}px`,[A8e]:r.height?`${r.height}px`:void 0}},Le=c.useMemo(()=>({toast:r,setTitleId:I,setDescriptionId:M,recalculateHeight:he,visibleIndex:K,expanded:ie}),[r,I,M,he,K,ie]),Ie={transitionStatus:r.transitionStatus,expanded:ie,limited:r.limited||!1,type:r.type,swiping:b,swipeDirection:O},Fe=He("div",e,{ref:[n,D],state:Ie,stateAttributesMapping:R8e,props:[we,l]});return m.jsx(dk.Provider,{value:Le,children:Fe})});fk.displayName="ToastRoot";function FD(t){return t==null||typeof t=="boolean"||t===""?!1:Array.isArray(t)?t.some(FD):!0}function _D(t){return c.isValidElement(t)&&FD(t.props.children)}function zD(t,e,n){const{toast:r,setTitleId:i,setDescriptionId:s}=Q8(),o=n==="title"?i:s,a=e??(n==="title"?r.title:r.description);return{id:$l(t),children:a,type:r.type,setId:o}}function BD(t,e,n){const r=_D(t);return Pe(()=>{if(r)return n(e),()=>{n(i=>i===e?void 0:i)}},[r,e,n]),r?t:null}const hk=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,children:a,...l}=e,{id:u,children:f,type:p,setId:g}=zD(o,a,"description");return BD(He("p",e,{ref:n,state:{type:p},props:{...l,id:u,children:f}}),u,g)});hk.displayName="ToastDescription";const pk=c.createContext(void 0);pk.displayName="ToastPositionerContext";function L8e(){const t=c.useContext(pk);if(t===void 0)throw new Error("Base UI: ToastPositionerContext is missing. ToastPositioner parts must be placed within <Toast.Positioner>.");return t}const XD=c.forwardRef(function(e,n){const{toast:r,...i}=e,s=j1(),o=r.positionerProps??Ut,{render:a,className:l,anchor:u=o.anchor,positionMethod:f=o.positionMethod??"absolute",side:p=o.side??"top",align:g=o.align??"center",sideOffset:O=o.sideOffset??0,alignOffset:y=o.alignOffset??0,collisionBoundary:b=o.collisionBoundary??"clipping-ancestors",collisionPadding:v=o.collisionPadding??5,arrowPadding:w=o.arrowPadding??5,sticky:C=o.sticky??!1,disableAnchorTracking:S=o.disableAnchorTracking??!1,collisionAvoidance:A=o.collisionAvoidance??yv,style:P,...T}=i,[$,I]=c.useState(null),L=s.useState("toastIndex",r.id),M=s.useState("toastVisibleIndex",r.id),V=Nt(u)?u:null,Z=Lv({open:!0,onOpenChange:qt,elements:{floating:$,reference:V}}),D=d1({anchor:V,positionMethod:f,floatingRootContext:Z,mounted:!0,side:p,sideOffset:O,align:g,alignOffset:y,collisionBoundary:b,collisionPadding:v,sticky:C,arrowPadding:w,disableAnchorTracking:S,keepMounted:!0,collisionAvoidance:A}),B={side:D.side,align:D.align,anchorHidden:D.anchorHidden},H=h1(e,B,{styles:{...D.positionerStyles,[HD]:r.transitionStatus==="ending"?L:M},transitionStatus:r.transitionStatus,props:T,refs:[n,I]});return m.jsx(pk.Provider,{value:D,children:H})});XD.displayName="ToastPositioner";function WD(){const t=j1(),e=t.useState("toasts");return c.useMemo(()=>({toasts:e,add:t.addToast,close:t.closeToast,update:t.updateToast,promise:t.promiseToast}),[e,t])}function qD(){const t=new Set;function e(n){t.forEach(r=>r(n))}return{" subscribe":function(r){return t.add(r),()=>{t.delete(r)}},add(n){const r=n.id||DD("toast");return e({action:"add",options:{...n,id:r,transitionStatus:"starting"}}),r},close(n){e({action:"close",options:{id:n}})},update(n,r){e({action:"update",options:{id:n,updates:r}})},promise(n,r){let i=n;return e({action:"promise",options:{...r,promise:n,setPromise(s){i=s}}}),i}}}const UD=c.forwardRef(function(e,n){const{render:r,className:i,style:s,...o}=e,{visibleIndex:a,expanded:l,recalculateHeight:u}=Q8(),f=c.useRef(null);return Pe(()=>{u();const p=f.current;if(!p||typeof ResizeObserver!="function"||typeof MutationObserver!="function")return;const g=new ResizeObserver(()=>u(!0)),O=new MutationObserver(()=>u(!0));return g.observe(p),O.observe(p,{childList:!0,subtree:!0,characterData:!0}),()=>{g.disconnect(),O.disconnect()}},[u]),He("div",e,{ref:[n,f],state:{expanded:l,behind:a>0},props:o})});UD.displayName="ToastContent";const YD=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,children:a,...l}=e,{id:u,children:f,type:p,setId:g}=zD(o,a,"title"),O=He("h2",e,{ref:n,state:{type:p},props:{...l,id:u,children:f}});return BD(O,u,g)});YD.displayName="ToastTitle";const GD=c.forwardRef(function(e,n){const{render:r,className:i,style:s,disabled:o,nativeButton:a=!0,...l}=e,u=j1(),{toast:f,expanded:p}=Q8(),[g,O]=c.useState(!1),{getButtonProps:y,buttonRef:b}=Tr({disabled:o,native:a}),v={type:f.type};return He("button",e,{ref:[n,b],state:v,props:[{"aria-hidden":!p&&!g,onClick(){u.closeToast(f.id)},onFocus(){O(!0)},onBlur(){O(!1)}},l,y]})});GD.displayName="ToastClose";const N8e=c.forwardRef(function(e,n){var b;const{render:r,className:i,style:s,disabled:o,nativeButton:a=!0,...l}=e,{toast:u}=Q8(),f=((b=u.actionProps)==null?void 0:b.children)??l.children,{getButtonProps:p,buttonRef:g}=Tr({disabled:o,native:a}),O={type:u.type},y=He("button",e,{ref:[n,g],state:O,props:[l,u.actionProps,p,{children:f}]});return _D(y)?y:null});N8e.displayName="ToastAction";const KD=c.forwardRef(function(e,n){return m.jsx(Nv,{ref:n,...e})});KD.displayName="ToastPortal";const Q8e=c.forwardRef(function(e,n){const{className:r,render:i,style:s,...o}=e,{arrowRef:a,side:l,align:u,arrowUncentered:f,arrowStyles:p}=L8e();return He("div",e,{state:{side:l,align:u,uncentered:f},ref:[n,a],props:[{style:p,"aria-hidden":!0},o]})});Q8e.displayName="ToastArrow";const T0=c.forwardRef((t,e)=>{const{alt:n,color:r="currentColor",size:i="1em",weight:s="regular",mirrored:o=!1,children:a,weights:l,...u}=t;return c.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:i,height:i,fill:r,viewBox:"0 0 256 256",transform:o?"scale(-1, 1)":void 0,...u},!!n&&c.createElement("title",null,n),a,l.get(s))});T0.displayName="SSRBase";const Z8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),c.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),JD=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:Z8e}));JD.displayName="CheckCircleIcon";const V8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),c.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),eH=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:V8e}));eH.displayName="InfoIcon";const D8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),c.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),tH=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:D8e}));tH.displayName="WarningIcon";const H8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M116,132V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0ZM236,91.55v72.9a19.86,19.86,0,0,1-5.86,14.14l-51.55,51.55A19.85,19.85,0,0,1,164.45,236H91.55a19.85,19.85,0,0,1-14.14-5.86L25.86,178.59A19.86,19.86,0,0,1,20,164.45V91.55a19.86,19.86,0,0,1,5.86-14.14L77.41,25.86A19.85,19.85,0,0,1,91.55,20h72.9a19.85,19.85,0,0,1,14.14,5.86l51.55,51.55A19.86,19.86,0,0,1,236,91.55Zm-24,1.66L162.79,44H93.21L44,93.21v69.58L93.21,212h69.58L212,162.79ZM128,156a16,16,0,1,0,16,16A16,16,0,0,0,128,156Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M224,91.55v72.9a8,8,0,0,1-2.34,5.66l-51.55,51.55a8,8,0,0,1-5.66,2.34H91.55a8,8,0,0,1-5.66-2.34L34.34,170.11A8,8,0,0,1,32,164.45V91.55a8,8,0,0,1,2.34-5.66L85.89,34.34A8,8,0,0,1,91.55,32h72.9a8,8,0,0,1,5.66,2.34l51.55,51.55A8,8,0,0,1,224,91.55Z",opacity:"0.2"}),c.createElement("path",{d:"M120,136V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0ZM232,91.55v72.9a15.86,15.86,0,0,1-4.69,11.31l-51.55,51.55A15.86,15.86,0,0,1,164.45,232H91.55a15.86,15.86,0,0,1-11.31-4.69L28.69,175.76A15.86,15.86,0,0,1,24,164.45V91.55a15.86,15.86,0,0,1,4.69-11.31L80.24,28.69A15.86,15.86,0,0,1,91.55,24h72.9a15.86,15.86,0,0,1,11.31,4.69l51.55,51.55A15.86,15.86,0,0,1,232,91.55Zm-16,0L164.45,40H91.55L40,91.55v72.9L91.55,216h72.9L216,164.45ZM128,160a12,12,0,1,0,12,12A12,12,0,0,0,128,160Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M227.31,80.23,175.77,28.69A16.13,16.13,0,0,0,164.45,24H91.55a16.13,16.13,0,0,0-11.32,4.69L28.69,80.23A16.13,16.13,0,0,0,24,91.55v72.9a16.13,16.13,0,0,0,4.69,11.32l51.54,51.54A16.13,16.13,0,0,0,91.55,232h72.9a16.13,16.13,0,0,0,11.32-4.69l51.54-51.54A16.13,16.13,0,0,0,232,164.45V91.55A16.13,16.13,0,0,0,227.31,80.23ZM120,80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M122,136V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0ZM230,91.55v72.9a13.92,13.92,0,0,1-4.1,9.9L174.35,225.9a13.92,13.92,0,0,1-9.9,4.1H91.55a13.92,13.92,0,0,1-9.9-4.1L30.1,174.35a13.92,13.92,0,0,1-4.1-9.9V91.55a13.92,13.92,0,0,1,4.1-9.9L81.65,30.1a13.92,13.92,0,0,1,9.9-4.1h72.9a13.92,13.92,0,0,1,9.9,4.1L225.9,81.65A13.92,13.92,0,0,1,230,91.55Zm-12,0a2,2,0,0,0-.59-1.42L165.87,38.59a2,2,0,0,0-1.42-.59H91.55a2,2,0,0,0-1.41.59L38.58,90.13A2,2,0,0,0,38,91.55v72.9a2,2,0,0,0,.59,1.42l51.54,51.54a2,2,0,0,0,1.42.59h72.9a2,2,0,0,0,1.41-.59l51.56-51.54a2,2,0,0,0,.58-1.42ZM128,162a10,10,0,1,0,10,10A10,10,0,0,0,128,162Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M120,136V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0ZM232,91.55v72.9a15.86,15.86,0,0,1-4.69,11.31l-51.55,51.55A15.86,15.86,0,0,1,164.45,232H91.55a15.86,15.86,0,0,1-11.31-4.69L28.69,175.76A15.86,15.86,0,0,1,24,164.45V91.55a15.86,15.86,0,0,1,4.69-11.31L80.24,28.69A15.86,15.86,0,0,1,91.55,24h72.9a15.86,15.86,0,0,1,11.31,4.69l51.55,51.55A15.86,15.86,0,0,1,232,91.55Zm-16,0L164.45,40H91.55L40,91.55v72.9L91.55,216h72.9L216,164.45ZM128,160a12,12,0,1,0,12,12A12,12,0,0,0,128,160Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M124,136V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0ZM228,91.55v72.9a12,12,0,0,1-3.51,8.49l-51.55,51.55a12,12,0,0,1-8.49,3.51H91.55a12,12,0,0,1-8.49-3.51L31.51,172.94A12,12,0,0,1,28,164.45V91.55a12,12,0,0,1,3.51-8.49L83.06,31.51A12,12,0,0,1,91.55,28h72.9a12,12,0,0,1,8.49,3.51l51.55,51.55A12,12,0,0,1,228,91.55Zm-8,0a4,4,0,0,0-1.17-2.83L167.28,37.17A4.06,4.06,0,0,0,164.45,36H91.55a4.06,4.06,0,0,0-2.83,1.17L37.17,88.72A4,4,0,0,0,36,91.55v72.9a4,4,0,0,0,1.17,2.83l51.55,51.55A4.06,4.06,0,0,0,91.55,220h72.9a4.06,4.06,0,0,0,2.83-1.17l51.55-51.55a4,4,0,0,0,1.17-2.83ZM128,164a8,8,0,1,0,8,8A8,8,0,0,0,128,164Z"}))]]),nH=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:H8e}));nH.displayName="WarningOctagonIcon";const F8e=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),c.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),rH=c.forwardRef((t,e)=>c.createElement(T0,{ref:e,...t,weights:F8e}));rH.displayName="XIcon";const iH={variant:{default:{classes:"border-kumo-fill bg-kumo-base",description:"Default toast style"},success:{classes:"ring-[0.3px] ring-kumo-success bg-kumo-base [&_[data-toast-icon]]:text-kumo-success [&_[data-toast-title]]:text-kumo-success",description:"Success toast for confirmations and positive outcomes",icon:JD},error:{classes:"ring-[0.3px] ring-kumo-danger bg-kumo-base [&_[data-toast-icon]]:text-kumo-danger [&_[data-toast-title]]:text-kumo-danger",description:"Error toast for critical issues",icon:nH},warning:{classes:"ring-[0.3px] ring-kumo-warning bg-kumo-base [&_[data-toast-icon]]:text-kumo-warning [&_[data-toast-title]]:text-kumo-warning",description:"Warning toast for cautionary messages",icon:tH},info:{classes:"ring-[0.3px] ring-kumo-info bg-kumo-control [&_[data-toast-icon]]:text-kumo-info [&_[data-toast-title]]:text-kumo-info",description:"Info toast for neutral informational messages",icon:eH}}},bb={variant:"default"};function _8e({variant:t=bb.variant}={}){return le("rounded-xl ring ring-kumo-line bg-clip-padding p-4 shadow-lg",sr(iH.variant,t,bb.variant).classes)}function sH(t){return{...t,add:e=>{if(e.id){const n=t.toasts;if(n){const r=n.find(i=>i.id===e.id);if(r&&r.transitionStatus!=="ending")return t.update(e.id,{bump:!1}),requestAnimationFrame(()=>{t.update(e.id,{bump:!0,...e.timeout!==void 0&&{timeout:e.timeout}})}),e.id;if(r&&r.transitionStatus==="ending")return e.id}}return t.add({...e})},update:(e,n)=>t.update(e,typeof n=="function"?r=>n(r):{...n}),promise:(e,n)=>t.promise(e,{loading:{...n.loading},success:typeof n.success=="function"?r=>({...n.success(r)}):{...n.success},error:typeof n.error=="function"?r=>({...n.error(r)}):{...n.error}})}}const z8e=()=>{const t=WD();return{...sH(t),toasts:t.toasts}},B8e=()=>sH(qD());function X8e({children:t,container:e,toastManager:n}){const r=vu();return m.jsxs(ck,{toastManager:n,children:[t,m.jsx(KD,{container:e??r??void 0,children:m.jsx(uk,{className:"fixed top-auto right-4 bottom-4 z-1 mx-auto flex w-[calc(100%-2rem)] sm:right-8 sm:bottom-8 sm:w-[340px]",children:m.jsx(W8e,{})})})]})}function W8e(){const{toasts:t}=z8e();return t.map(e=>m.jsxs(fk,{toast:e,className:le("absolute right-0 bottom-0 left-auto z-[calc(1000-var(--toast-index))] mr-0 h-[var(--height)] w-full origin-bottom select-none",_8e({variant:e.variant}),"[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]","[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,height_0.15s]","after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']","data-[ending-style]:opacity-0 data-[expanded]:h-[var(--toast-height)] data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--offset-y)))] data-[limited]:opacity-0 data-[starting-style]:[transform:translateY(150%)]","data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))] data-[expanded]:data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]","data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-[expanded]:data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]","data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]","data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))] data-[expanded]:data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]","[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",e.bump&&"animate-toast-bump"),children:[m.jsx(Y8e,{variant:e.variant}),m.jsxs(UD,{className:"isolate flex flex-col gap-1 transition-opacity [transition-duration:250ms] data-[behind]:pointer-events-none data-[behind]:opacity-0 data-[expanded]:pointer-events-auto data-[expanded]:opacity-100",children:[e.content??m.jsx(m.Fragment,{children:m.jsxs("div",{className:"flex items-start gap-2",children:[m.jsx(G8e,{variant:e.variant}),m.jsxs("div",{className:"flex flex-col gap-1 overflow-hidden",children:[m.jsx(YD,{"data-toast-title":!0,className:"text-[0.975rem] leading-5 font-medium text-kumo-default"}),m.jsx(hk,{className:"text-[0.925rem] leading-5 text-kumo-default/70"}),!!e.actions&&m.jsx("div",{className:"mt-2 flex min-w-0 flex-nowrap gap-2 overflow-x-auto p-px",children:e.actions.map((n,r)=>m.jsx(nt,{...n},r))})]})]})}),m.jsx(GD,{"data-kumo-part":"close","aria-label":"Close",render:m.jsx(nt,{variant:"ghost",size:"sm",shape:"square","aria-label":"Close",className:le("absolute top-2 right-2 size-5 rounded text-kumo-subtle hover:bg-current/15",e.variant&&q8e[e.variant]),icon:m.jsx(rH,{className:"h-3 w-3"})})})]})]},e.id))}const q8e={success:"text-kumo-success",error:"text-kumo-danger",warning:"text-kumo-warning",info:"text-kumo-info"},U8e={success:"bg-kumo-success-tint/20",error:"bg-kumo-danger-tint/50",warning:"bg-kumo-warning-tint/50",info:"bg-kumo-info-tint/50"};function Y8e({variant:t}){const e=t&&U8e[t];return m.jsx("div",{className:le("absolute inset-0 rounded-xl bg-kumo-base/90",e)})}function G8e({variant:t}){if(!t||t==="default")return null;const e=sr(iH.variant,t,bb.variant);if(!("icon"in e))return null;const n=e.icon;return m.jsx(n,{"data-toast-icon":!0,className:"mt-0.5 h-4 w-4 shrink-0",weight:"fill"})}const oH=c.createContext(null),K8e=6e3;function J8e({children:t}){const[e]=c.useState(B8e),n=c.useMemo(()=>({show:({message:r,description:i,action:s,onExpire:o,duration:a=K8e})=>{let l=!1;const u=e.add({title:r,description:i,timeout:a,actions:s&&[{children:s.label,size:"sm",variant:"secondary",onClick:()=>{l=!0,s.onClick(),e.close(u)}}],onClose:()=>{l||o==null||o()}})}}),[e]);return m.jsx(oH.Provider,{value:n,children:m.jsx(X8e,{toastManager:e,children:t})})}function e4e(){const t=c.useContext(oH);if(!t)throw new Error("useToasts must be used inside ToastsProvider");return t}const xM=[["tasks-range"],["recent"],["entity-list"],["feedback"],["trash"],["children"]];function t4e(t,e){if(Array.isArray(t))return t.filter(n=>n.id!==e);if(t&&typeof t=="object"&&"scheduled"in t){const n=t;return{...n,scheduled:n.scheduled.filter(r=>r.id!==e),overdue:n.overdue.filter(r=>r.id!==e),backlog:n.backlog.filter(r=>r.id!==e)}}return t}function aH(){const t=lr(),{show:e}=e4e(),n=c.useCallback(()=>{for(const r of xM)t.invalidateQueries({queryKey:r})},[t]);return c.useCallback(r=>{const i=[];for(const s of xM)for(const[o,a]of t.getQueriesData({queryKey:s}))a!==void 0&&(i.push([o,a]),t.setQueryData(o,t4e(a,r.id)));Zt.deleteEntity(r.id).catch(()=>{for(const[s,o]of i)t.setQueryData(s,o)}),e({message:"Moved to trash",description:Or(r),action:{label:"Undo",onClick:()=>{Zt.restoreEntity(r.id).then(n).catch(n)}},onExpire:n})},[t,e,n])}const lH=["hourly","daily","weekly","monthly","yearly"],vb=["MO","TU","WE","TH","FR","SA","SU"];function n4e(t){if(!t)return;const e=t.match(/^(\d{4})(\d{2})(\d{2})/);if(e)return`${e[1]}-${e[2]}-${e[3]}`;const n=new Date(t);return Number.isNaN(n.getTime())?void 0:n.toISOString().slice(0,10)}function cH(t){var a;const e=new Map(t.replace(/^RRULE:/i,"").split(";").map(l=>l.split("=")).filter(l=>l.length===2).map(([l,u])=>[l.toUpperCase(),u])),n=(a=e.get("FREQ"))==null?void 0:a.toLowerCase(),r=lH.includes(n)?n:void 0,i=Number(e.get("INTERVAL")??1),s=Number(e.get("COUNT")),o=(e.get("BYDAY")??"").split(",").filter(l=>vb.includes(l));return{preset:r,interval:Number.isFinite(i)&&i>0?i:1,byWeekday:o,count:Number.isFinite(s)&&s>0?s:void 0,until:n4e(e.get("UNTIL"))}}const r4e=["title","body","tags","priority"];function i4e(t,e,n){return!e||!r4e.some(i=>i in t)?t:{...t,recurrenceScope:n}}const s4e="inline-flex w-fit flex-none shrink-0 items-center justify-self-start gap-1 rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap [a:hover_&]:ring [a:hover_&]:ring-current",kb={variant:{primary:{classes:"bg-kumo-badge-inverted text-kumo-badge-inverted",description:"Primary badge"},secondary:{classes:"bg-kumo-fill text-kumo-badge-neutral-subtle",description:"Secondary badge"},error:{classes:"bg-kumo-danger-tint text-kumo-danger",description:"Error badge"},warning:{classes:"bg-kumo-warning-tint text-kumo-warning",description:"Warning badge"},success:{classes:"bg-kumo-success-tint text-kumo-success",description:"Success badge"},destructive:{classes:"bg-kumo-badge-red text-white",description:"Deprecated. Use red instead."},info:{classes:"bg-kumo-info-tint text-kumo-info",description:"Info badge"},beta:{classes:"border border-dashed border-kumo-brand bg-transparent text-kumo-link",description:"Indicates beta or experimental features"},outline:{classes:"border border-kumo-fill bg-kumo-base text-kumo-default",description:"Bordered badge with base background"},red:{classes:"bg-kumo-badge-red text-white",description:"Red badge"},green:{classes:"bg-kumo-badge-green text-white",description:"Green badge"},neutral:{classes:"bg-kumo-badge-neutral text-white",description:"Neutral badge"},orange:{classes:"bg-kumo-badge-orange text-black",description:"Orange badge"},purple:{classes:"bg-kumo-badge-purple text-white",description:"Purple badge"},teal:{classes:"bg-kumo-badge-teal text-white",description:"Teal badge"},"teal-subtle":{classes:"bg-kumo-badge-teal-subtle text-kumo-badge-teal-subtle",description:"Subtle teal badge"},blue:{classes:"bg-kumo-badge-blue text-white",description:"Blue badge"}},appearance:{filled:{classes:"",description:"Filled badge with background color (default)"},dot:{classes:"gap-1.5 bg-transparent text-kumo-default ring ring-kumo-hairline",description:"Outlined badge with a colored circle dot indicating status"}},dotColor:{none:{classes:"",description:"No dot indicator (used when appearance is not dot, or variant has no dot color)"},success:{classes:"bg-kumo-success",description:"Green dot for success status"},warning:{classes:"bg-kumo-badge-orange",description:"Orange dot for warning status"},error:{classes:"bg-kumo-badge-red",description:"Red dot for error status"},neutral:{classes:"bg-kumo-badge-neutral",description:"Neutral dot for informational status"}}},zc={variant:"primary",appearance:"filled",dotColor:"none"};function o4e({variant:t=zc.variant,appearance:e=zc.appearance}={}){const n=sr(kb.variant,t,zc.variant).classes,r=sr(kb.appearance,e,zc.appearance).classes;return le(s4e,e==="dot"?"":n,r)}const a4e=t=>{if(!t)return null;const e=t,n=Jr.isValidElement(t)?t:m.jsx(e,{});return m.jsx("span",{className:"flex h-lh w-3 shrink-0 items-center justify-center [&>svg]:size-3",children:n})};function Mu({variant:t=zc.variant,appearance:e=zc.appearance,className:n,icon:r,children:i}){const s=e==="dot"?sr(kb.dotColor,t,zc.dotColor).classes:"";return m.jsxs("span",{className:le(o4e({variant:t,appearance:e}),r&&"pl-1.5",n),children:[s?m.jsx("span",{"aria-hidden":"true",className:le("size-1.75 shrink-0 rounded-full",s)}):null,a4e(r),i]})}const p2={task:"task",note:"memory",worklog:"worklog",feedback:"feedback"},l4e={task:{icon:wj,variant:"info"},note:{icon:O0,variant:"secondary"},worklog:{icon:q2,variant:"warning"},feedback:{icon:Y2,variant:"outline"}};function Z8({kind:t,compact:e=!1}){const{icon:n,variant:r}=l4e[t],i=p2[t];return m.jsx(Mu,{variant:r,icon:m.jsx("span",{title:i,className:"flex",children:m.jsx(n,{size:12,weight:"bold"})}),className:le("h-5 py-0 text-[11px]",e?"px-1.5":"uppercase tracking-wider"),children:e?m.jsx("span",{className:"sr-only",children:i}):i})}const uH=[{name:"circle",Icon:Cg},{name:"square",Icon:Kj},{name:"triangle",Icon:sI},{name:"hexagon",Icon:Qj},{name:"folder",Icon:Ij},{name:"briefcase",Icon:vj},{name:"rocket",Icon:Wj},{name:"sparkles",Icon:Gj},{name:"target",Icon:rI},{name:"layers",Icon:eI},{name:"code",Icon:Ej},{name:"book",Icon:bj},{name:"flame",Icon:Rj},{name:"zap",Icon:Gv},{name:"star",Icon:tI},{name:"heart",Icon:Nj},{name:"box",Icon:Pj},{name:"lightbulb",Icon:Vj},{name:"pencil",Icon:G2},{name:"hash",Icon:Lj}],c4e=new Map(uH.map(t=>[t.name,t.Icon]));function u4e(t){return t?c4e.get(t)??Cg:Cg}const d4e=[{name:"gray",value:"#6f6f76"},{name:"red",value:"#ef4444"},{name:"orange",value:"#f59e0b"},{name:"yellow",value:"#eab308"},{name:"green",value:"#10b981"},{name:"teal",value:"#14b8a6"},{name:"cyan",value:"#06b6d4"},{name:"blue",value:"#3b82f6"},{name:"indigo",value:"#5e6ad2"},{name:"purple",value:"#8b5cf6"},{name:"pink",value:"#ec4899"}],dH="#5e6ad2",fH="circle";function f4e(t){return t==="circle"||t==="square"||t==="triangle"}function tc({color:t,icon:e,size:n=12,className:r=""}){const i=u4e(e),s=f4e(e);return m.jsx(i,{size:n,className:`shrink-0 ${r}`,color:t,weight:s?"fill":"bold"})}function Ou({status:t,size:e=14}){const n="currentColor";return t==="done"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-success) shrink-0",children:[m.jsx("circle",{cx:"7",cy:"7",r:"6",fill:"currentColor"}),m.jsx("path",{d:"M4 7.4L6.2 9.5L10 5.5",strokeWidth:"1.6",className:"stroke-kumo-base",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}):t==="in_progress"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-warning) shrink-0",children:[m.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:n,strokeWidth:"1.4",fill:"none"}),m.jsx("path",{d:"M7 1 a6 6 0 0 1 0 12 z",fill:"currentColor"})]}):t==="rejected"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-danger) shrink-0",children:[m.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:n,strokeWidth:"1.4",fill:"none"}),m.jsx("path",{d:"M4 4l6 6M10 4l-6 6",stroke:n,strokeWidth:"1.4",strokeLinecap:"round"})]}):m.jsx("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-kumo-placeholder shrink-0",children:m.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:n,strokeWidth:"1.4",fill:"none"})})}function zl({priority:t,size:e=14}){return t==="urgent"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-danger) shrink-0",children:[m.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"}),m.jsx("path",{d:"M7 4v3.5M7 9.5h.01",strokeWidth:"1.6",strokeLinecap:"round",className:"stroke-kumo-base"})]}):t==="high"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-warning) shrink-0",children:[m.jsx("rect",{x:"2",y:"8",width:"2.5",height:"4",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"5.75",y:"5",width:"2.5",height:"7",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"9.5",y:"2",width:"2.5",height:"10",rx:"0.5",fill:"currentColor"})]}):t==="medium"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-(--color-kumo-info) shrink-0",children:[m.jsx("rect",{x:"2",y:"8",width:"2.5",height:"4",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"5.75",y:"5",width:"2.5",height:"7",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"9.5",y:"2",width:"2.5",height:"10",rx:"0.5",opacity:"0.3",fill:"currentColor"})]}):t==="low"?m.jsxs("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-kumo-placeholder shrink-0",children:[m.jsx("rect",{x:"2",y:"8",width:"2.5",height:"4",rx:"0.5",fill:"currentColor"}),m.jsx("rect",{x:"5.75",y:"5",width:"2.5",height:"7",rx:"0.5",opacity:"0.3",fill:"currentColor"}),m.jsx("rect",{x:"9.5",y:"2",width:"2.5",height:"10",rx:"0.5",opacity:"0.3",fill:"currentColor"})]}):m.jsx("svg",{width:e,height:e,viewBox:"0 0 14 14",className:"text-kumo-placeholder shrink-0",children:m.jsx("line",{x1:"3",y1:"7",x2:"11",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeDasharray:"1.5 1.5"})})}function R0({size:t=12,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 14 14",fill:"none",className:`shrink-0 ${e}`,"aria-hidden":"true",children:[m.jsx("path",{d:"M2.5 7a4.5 4.5 0 0 1 7.7-3.2L11.5 5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M11.5 2v3h-3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M11.5 7a4.5 4.5 0 0 1-7.7 3.2L2.5 9",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),m.jsx("path",{d:"M2.5 12V9h3",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]})}const xu={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"No priority"},m2={open:"Todo",in_progress:"In progress",done:"Done",rejected:"Cancelled"},hH=["open","in_progress","done","rejected"],mk=c.forwardRef(function(e,n){const{className:r,render:i,orientation:s="horizontal",style:o,...a}=e;return He("div",e,{state:{orientation:s},ref:n,props:[{role:"separator","aria-orientation":s},a]})});mk.displayName="Separator";const pH=c.createContext(null);pH.displayName="MenubarContext";function mH(t){return c.useContext(pH)}const gk=c.createContext(void 0);gk.displayName="MenuPositionerContext";function j0(t){const e=c.useContext(gk);if(e===void 0&&!t)throw new Error("Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.");return e}const Ok=c.createContext(void 0);Ok.displayName="MenuRootContext";function io(t){const e=c.useContext(Ok);if(e===void 0&&!t)throw new Error("Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.");return e}const gH=c.createContext(void 0);gH.displayName="ContextMenuRootContext";function xk(t=!0){const e=c.useContext(gH);if(e===void 0&&!t)throw new Error("Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.");return e}const yk=c.createContext(void 0);yk.displayName="MenuCheckboxItemContext";function h4e(){const t=c.useContext(yk);if(t===void 0)throw new Error("Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.");return t}function OH(t){const{closeOnClick:e,highlighted:n,id:r,nodeId:i,store:s,typingRef:o,itemRef:a,itemMetadata:l}=t,{events:u}=s.useState("floatingTreeRoot"),f=s.useState("open"),p=xk(!0),g=p!==void 0;return c.useMemo(()=>({id:r,role:"menuitem",tabIndex:f&&n?0:-1,onKeyDown(O){O.key===" "&&(o!=null&&o.current)&&O.preventDefault()},onMouseMove(O){i&&u.emit("itemhover",{nodeId:i,target:O.currentTarget})},onClick(O){e&&u.emit("close",{domEvent:O,reason:Rl})},onMouseUp(O){if(p){const y=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,g&&y&&Math.abs(O.clientX-y.x)<=1&&Math.abs(O.clientY-y.y)<=1||g&&!sv&&O.button===2)return}a.current&&s.context.allowMouseUpTriggerRef.current&&(!g||O.button===2)&&l.type==="regular-item"&&Rd(a.current,O,{detail:1})}}),[e,n,r,u,i,f,s,o,a,p,g,l])}const V8={type:"regular-item"};function D8(t){const{closeOnClick:e,disabled:n,highlighted:r,id:i,store:s,typingRef:o=s.context.typingRef,nativeButton:a,itemMetadata:l,nodeId:u}=t,f=c.useRef(null),{getButtonProps:p,buttonRef:g}=Tr({disabled:n,focusableWhenDisabled:!0,native:a,composite:!0}),O=OH({closeOnClick:e,highlighted:r,id:i,nodeId:u,store:s,typingRef:o,itemRef:f,itemMetadata:l}),y=c.useCallback(v=>ar(O,{onMouseEnter(){l.type==="submenu-trigger"&&l.setActive()}},v,p),[O,p,l]),b=ns(f,g);return c.useMemo(()=>({getItemProps:y,itemRef:b}),[y,b])}const p4e="data-checked",m4e="data-unchecked",H8={checked(t){return t?{[p4e]:""}:{[m4e]:""}},...is},bk=c.forwardRef(function(e,n){const{render:r,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!1,checked:f,defaultChecked:p,onCheckedChange:g,style:O,...y}=e,b=Ta({guess:!0,label:o}),v=j0(!0),w=Pn(s),{store:C}=io(),S=C.useState("disabled"),A=l||S,P=C.useState("isActive",b.index),T=C.useState("itemProps"),[$,I]=Ji({controlled:f,default:p??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:L,itemRef:M}=D8({closeOnClick:u,disabled:A,highlighted:P,id:w,store:C,nativeButton:a,nodeId:v==null?void 0:v.context.nodeId,itemMetadata:V8}),V=c.useMemo(()=>({disabled:A,highlighted:P,checked:$}),[A,P,$]);function Z(B){const H=_e(Rl,B.nativeEvent,void 0,{preventUnmountOnClose:qt});g==null||g(!$,H),!H.isCanceled&&I(U=>!U)}const D=He("div",e,{state:V,stateAttributesMapping:H8,props:[T,{role:"menuitemcheckbox","aria-checked":$,onClick:Z},y,L],ref:[M,n,b.ref]});return m.jsx(yk.Provider,{value:V,children:D})});bk.displayName="MenuCheckboxItem";const xH=c.forwardRef(function(e,n){const{render:r,className:i,style:s,keepMounted:o=!1,...a}=e,l=h4e(),u=c.useRef(null),{transitionStatus:f,mounted:p,setMounted:g}=Ks(l.checked);Hr({batch:!0,enabled:!l.checked,open:l.checked,ref:u,onComplete(){l.checked||g(!1)}});const O={checked:l.checked,disabled:l.disabled,highlighted:l.highlighted,transitionStatus:f};return He("span",e,{state:O,ref:[n,u],stateAttributesMapping:H8,props:{"aria-hidden":!0,...a},enabled:o||p})});xH.displayName="MenuCheckboxItemIndicator";const F8=c.createContext(void 0);F8.displayName="MenuGroupContext";function g4e(){const t=c.useContext(F8);if(t===void 0)throw new Error("Base UI: MenuGroupContext is missing. Menu group parts must be used within <Menu.Group> or <Menu.RadioGroup>.");return t}const yH=c.forwardRef(function(e,n){const{render:r,className:i,style:s,...o}=e,[a,l]=c.useState(void 0),u=He("div",e,{ref:n,props:{role:"group","aria-labelledby":a,...o}});return m.jsx(F8.Provider,{value:l,children:u})});yH.displayName="MenuGroup";const vk=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,...a}=e,l=Pn(o),u=g4e();return Pe(()=>(u(l),()=>{u(f=>f===l?void 0:f)}),[u,l]),He("div",e,{ref:n,props:{id:l,"aria-hidden":!0,...a}})});vk.displayName="MenuGroupLabel";const kk=c.forwardRef(function(e,n){const{render:r,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!0,style:f,...p}=e,g=Ta({guess:!0,label:o}),O=j0(!0),y=Pn(s),{store:b}=io(),v=b.useState("disabled"),w=l||v,C=b.useState("isActive",g.index),S=b.useState("itemProps"),{getItemProps:A,itemRef:P}=D8({closeOnClick:u,disabled:w,highlighted:C,id:y,store:b,nativeButton:a,nodeId:O==null?void 0:O.context.nodeId,itemMetadata:V8});return He("div",e,{state:{disabled:w,highlighted:C},props:[S,p,A],ref:[P,n,g.ref]})});kk.displayName="MenuItem";const bH=c.forwardRef(function(e,n){var T;const{render:r,className:i,id:s,label:o,closeOnClick:a=!1,style:l,...u}=e,f=c.useRef(null),p=Ta({guess:!0,label:o}),g=(T=j0(!0))==null?void 0:T.context.nodeId,O=Pn(s),{store:y}=io(),b=y.useState("isActive",p.index),v=y.useState("itemProps"),w=y.context.typingRef,{getButtonProps:C,buttonRef:S}=Tr({native:!1,composite:!0}),A=OH({closeOnClick:a,highlighted:b,id:O,nodeId:g,store:y,typingRef:w,itemRef:f,itemMetadata:V8});function P($){return ar(A,$,C)}return He("a",e,{state:{highlighted:b},props:[v,u,P],ref:[f,S,n,p.ref]})});bH.displayName="MenuLinkItem";const vH=c.forwardRef(function(e,n){const{render:r,className:i,style:s,finalFocus:o,...a}=e,{store:l}=io(),{side:u,align:f}=j0(),p=BQ()!=null,g=l.useState("open"),O=l.useState("transitionStatus"),y=l.useState("popupProps"),b=l.useState("mounted"),v=l.useState("instantType"),w=l.useState("activeTriggerElement"),C=l.useState("parent"),S=l.useState("lastOpenChangeReason"),A=l.useState("rootId"),P=l.useState("floatingRootContext"),T=l.useState("floatingTreeRoot"),$=l.useState("closeDelay"),I=l.useState("hoverEnabled"),L=l.useState("disabled"),M=l.useState("openMethod"),V=C.type==="context-menu";Hr({open:g,ref:l.context.popupRef,onComplete(){var U,q;g&&((q=(U=l.context).onOpenChangeComplete)==null||q.call(U,!0))}}),c.useEffect(()=>{function U(q){l.setOpen(!1,_e(q.reason,q.domEvent))}return T.events.on("close",U),()=>{T.events.off("close",U)}},[T.events,l]),nj(P,{enabled:I&&!L&&!V&&C.type!=="menubar",closeDelay:$});const Z=l.useStateSetter("popupElement"),D={transitionStatus:O,side:u,align:f,open:g,nested:C.type==="menu",instant:v},B=He("div",e,{state:D,ref:[n,l.context.popupRef,Z],stateAttributesMapping:cv,props:[y,{onKeyDown(U){p&&w8.has(U.key)&&U.stopPropagation()}},f1(O),a,{"data-rootownerid":A}]});let H=C.type===void 0||V;return(w||C.type==="menubar"&&S!=="outside-press")&&(H=!0),m.jsx(x8,{context:P,openInteractionType:M,modal:V,disabled:!b,returnFocus:o===void 0?H:o,initialFocus:C.type!=="menu",restoreFocus:!0,externalTree:C.type!=="menubar"?T:void 0,previousFocusableElement:w,nextFocusableElement:C.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:C.type===void 0?l.context.beforeContentFocusGuardRef:void 0,children:B})});vH.displayName="MenuPopup";const wk=c.createContext(void 0);wk.displayName="MenuPortalContext";function O4e(){const t=c.useContext(wk);if(t===void 0)throw new Error("Base UI: <Menu.Portal> is missing.");return t}const Sk=c.forwardRef(function(e,n){const{keepMounted:r=!1,...i}=e,{store:s,parent:o}=io();if(!(s.useState("mounted")||r))return null;const a=o.type==="menu"||o.type==="menubar"?"group":void 0;return m.jsx(wk.Provider,{value:r,children:m.jsx(l1,{ref:n,...i,portalOwnerRole:a})})});Sk.displayName="MenuPortal";const kH=c.forwardRef(function(e,n){var we;const{anchor:r,positionMethod:i="absolute",className:s,render:o,side:a,align:l,sideOffset:u=0,alignOffset:f=0,collisionBoundary:p="clipping-ancestors",collisionPadding:g=5,arrowPadding:O=5,sticky:y=!1,disableAnchorTracking:b=!1,collisionAvoidance:v=xv,style:w,...C}=e,{store:S}=io(),A=O4e(),P=xk(!0),T=S.useState("parent"),$=S.useState("floatingRootContext"),I=S.useState("floatingTreeRoot"),L=S.useState("mounted"),M=S.useState("open"),V=S.useState("modal"),Z=S.useState("openMethod"),D=S.useState("activeTriggerElement"),B=S.useState("transitionStatus"),H=S.useState("positionerElement"),U=S.useState("instantType"),q=S.useState("adaptiveOrigin"),W=S.useState("lastOpenChangeReason"),X=S.useState("floatingNodeId"),R=S.useState("floatingParentNodeId"),Q=$.useState("domReferenceElement"),F=c.useRef(null),N=z2(H);let z=r,J=u,K=f,ne=l,se=v;T.type==="context-menu"&&(z=r??((we=T.context)==null?void 0:we.anchor),ne=ne??"start",!a&&ne!=="center"&&(K=e.alignOffset??2,J=e.sideOffset??-5));let ie=a,he=ne;T.type==="menu"?(ie=ie??"inline-end",he=he??"start",se=e.collisionAvoidance??yv):T.type==="menubar"&&(ie=ie??(T.context.orientation==="vertical"?"inline-end":"bottom"),he=he??"start");const Se=T.type==="context-menu",Oe=d1({anchor:z,floatingRootContext:$,positionMethod:P?"fixed":i,mounted:L,side:ie,sideOffset:J,align:he,alignOffset:K,arrowPadding:Se?0:O,collisionBoundary:p,collisionPadding:g,sticky:y,nodeId:X,keepMounted:A,disableAnchorTracking:b,collisionAvoidance:se,shift:Se?{crossAxis:!("side"in se&&se.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:I,adaptiveOrigin:q});c.useEffect(()=>{function Le(Ie){Ie.open&&(Ie.parentNodeId===X&&S.set("hoverEnabled",!1),Ie.nodeId!==X&&Ie.parentNodeId===S.select("floatingParentNodeId")&&S.setOpen(!1,_e(Z6)))}return I.events.on("menuopenchange",Le),()=>{I.events.off("menuopenchange",Le)}},[S,I.events,X]),c.useEffect(()=>{if(S.select("floatingParentNodeId")==null)return;function Le(Ie){if(Ie.open||Ie.nodeId!==S.select("floatingParentNodeId"))return;const Fe=Ie.reason??"sibling-open";S.setOpen(!1,_e(Fe))}return I.events.on("menuopenchange",Le),()=>{I.events.off("menuopenchange",Le)}},[I.events,S]);const be=wn();c.useEffect(()=>{M||be.clear()},[M,be]),c.useEffect(()=>{function Le(Ie){if(!(!M||Ie.nodeId!==S.select("floatingParentNodeId")))if(Ie.target&&D&&D!==Ie.target){const Fe=S.select("closeDelay");Fe>0?be.isStarted()||be.start(Fe,()=>{S.setOpen(!1,_e(Z6))}):S.setOpen(!1,_e(Z6))}else be.clear()}return I.events.on("itemhover",Le),()=>{I.events.off("itemhover",Le)}},[I.events,M,D,S,be]),c.useEffect(()=>{const Le={open:M,nodeId:X,parentNodeId:R,reason:S.select("lastOpenChangeReason")};I.events.emit("menuopenchange",Le)},[I.events,M,S,X,R]),Pe(()=>{const Le=Q,Ie=F.current;if(Le&&(F.current=Le),Ie&&Le&&Le!==Ie){S.set("instantType",void 0);const Fe=new AbortController;return N(()=>{S.set("instantType","trigger-change")},Fe.signal),()=>{Fe.abort()}}},[Q,N,S]);const me={open:M,side:Oe.side,align:Oe.align,anchorHidden:Oe.anchorHidden,nested:T.type==="menu",instant:U},ue=T.type==="menubar"&&T.context.modal;v5(M&&(ue||V&&W!=="trigger-hover"),Z==="touch",H,D);const ve=h1(e,me,{styles:Oe.positionerStyles,transitionStatus:B,props:C,refs:[n,S.useStateSetter("positionerElement")],hidden:!L,inert:!M}),xe=L&&T.type!=="menu"&&(T.type!=="menubar"&&V&&W!=="trigger-hover"||T.type==="menubar"&&T.context.modal);let Ce=null;return T.type==="menubar"?Ce=T.context.contentElement:T.type===void 0&&(Ce=D),m.jsxs(gk.Provider,{value:Oe,children:[xe&&m.jsx(S1,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:C1(!M),cutout:Ce}),m.jsx(yY,{id:X,children:m.jsx(C0,{elementsRef:S.context.itemDomElements,labelsRef:S.context.itemLabels,children:ve})})]})});kH.displayName="MenuPositioner";const Ck=c.createContext(void 0);Ck.displayName="MenuRadioGroupContext";function x4e(){const t=c.useContext(Ck);if(t===void 0)throw new Error("Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.");return t}const wH=c.memo(c.forwardRef(function(e,n){const{render:r,className:i,value:s,defaultValue:o,onValueChange:a,disabled:l=!1,style:u,"aria-labelledby":f,...p}=e,[g,O]=c.useState(void 0),[y,b]=Ji({controlled:s,default:o,name:"MenuRadioGroup"}),v=Ee((S,A)=>{a==null||a(S,A),!A.isCanceled&&b(S)}),w=He("div",e,{state:{disabled:l},ref:n,props:{role:"group","aria-labelledby":f??g,"aria-disabled":l||void 0,...p}}),C=c.useMemo(()=>({value:y,setValue:v,disabled:l}),[y,v,l]);return m.jsx(F8.Provider,{value:O,children:m.jsx(Ck.Provider,{value:C,children:w})})}));wH.displayName="MenuRadioGroup";const Ek=c.createContext(void 0);Ek.displayName="MenuRadioItemContext";function y4e(){const t=c.useContext(Ek);if(t===void 0)throw new Error("Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.");return t}const SH=c.forwardRef(function(e,n){const{render:r,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!1,value:f,style:p,...g}=e,O=Ta({guess:!0,label:o}),y=j0(!0),b=Pn(s),{store:v}=io(),w=v.useState("isActive",O.index),C=v.useState("itemProps"),{value:S,setValue:A,disabled:P}=x4e(),T=v.useState("disabled"),$=l||P||T,I=S===f,{getItemProps:L,itemRef:M}=D8({closeOnClick:u,disabled:$,highlighted:w,id:b,store:v,nativeButton:a,nodeId:y==null?void 0:y.context.nodeId,itemMetadata:V8}),V=c.useMemo(()=>({disabled:$,highlighted:w,checked:I}),[$,w,I]);function Z(B){const H=_e(Rl,B.nativeEvent,void 0,{preventUnmountOnClose:qt});A(f,H)}const D=He("div",e,{state:V,stateAttributesMapping:H8,props:[C,{role:"menuitemradio","aria-checked":I,onClick:Z},g,L],ref:[M,n,O.ref]});return m.jsx(Ek.Provider,{value:V,children:D})});SH.displayName="MenuRadioItem";const CH=c.forwardRef(function(e,n){const{render:r,className:i,style:s,keepMounted:o=!1,...a}=e,l=y4e(),u=c.useRef(null),{transitionStatus:f,mounted:p,setMounted:g}=Ks(l.checked);Hr({batch:!0,enabled:!l.checked,open:l.checked,ref:u,onComplete(){l.checked||g(!1)}});const O={checked:l.checked,disabled:l.disabled,highlighted:l.highlighted,transitionStatus:f};return He("span",e,{state:O,stateAttributesMapping:H8,ref:[n,u],props:{"aria-hidden":!0,...a},enabled:o||p})});CH.displayName="MenuRadioItemIndicator";const b4e={...Iv,disabled:t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled,modal:t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0),openMethod:t=>t.openMethod,allowMouseEnter:t=>t.allowMouseEnter,highlightItemOnHover:t=>t.highlightItemOnHover,parent:t=>t.parent,rootId:t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId,activeIndex:t=>t.activeIndex,isActive:(t,e)=>t.activeIndex===e,hoverEnabled:t=>t.hoverEnabled,instantType:t=>t.instantType,lastOpenChangeReason:t=>t.openChangeReason,floatingTreeRoot:t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot,floatingNodeId:t=>t.floatingNodeId,floatingParentNodeId:t=>t.floatingParentNodeId,itemProps:t=>t.itemProps,closeDelay:t=>t.closeDelay,adaptiveOrigin:t=>t.adaptiveOrigin,keyboardEventRelay:t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")}};var v4e=class extends wu{constructor(e,n,r=!1){const i=new F2,s=w4e(i,n,r,e);super(s,k4e(i),b4e);$t(this,"unsubscribeParentListener",null);this.unsubscribeParentListener=this.observe("parent",o=>{var a;if((a=this.unsubscribeParentListener)==null||a.call(this),o.type==="menu"){let l=o.store.select("rootId"),u=o.store.select("floatingTreeRoot"),f=o.store.select("keyboardEventRelay");this.unsubscribeParentListener=o.store.subscribe(()=>{const p=o.store.select("rootId"),g=o.store.select("floatingTreeRoot"),O=o.store.select("keyboardEventRelay");l===p&&u===g&&f===O||(l=p,u=g,f=O,this.notifyAll())}),this.context.allowMouseUpTriggerRef=o.store.context.allowMouseUpTriggerRef;return}o.type!==void 0&&(this.context.allowMouseUpTriggerRef=o.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:n})}};function k4e(t){return{positionerRef:c.createRef(),popupRef:c.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:c.createRef(),beforeContentFocusGuardRef:c.createRef(),onOpenChangeComplete:void 0,triggerElements:t}}function w4e(t,e,n=!1,r){return{...Rv(t,e,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new pv,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Ut,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}const Ak=c.createContext(void 0);Ak.displayName="MenuSubmenuRootContext";function EH(){return c.useContext(Ak)}const Pk=H2(function(e){const{children:n,open:r,onOpenChange:i,onOpenChangeComplete:s,defaultOpen:o=!1,disabled:a=!1,modal:l,loopFocus:u=!0,orientation:f="vertical",actionsRef:p,closeParentOnEsc:g=!1,handle:O,triggerId:y,defaultTriggerId:b=null,highlightItemOnHover:v=!0}=e,w=xk(!0),C=io(!0),S=mH(!0),A=EH(),P=c.useMemo(()=>A&&C?{type:"menu",store:C.store}:S?{type:"menubar",context:S}:w&&!C?{type:"context-menu",context:w}:{type:void 0},[w,C,S,A]),T=$l(),$=$l(),I=ql(),L=P.type==="menu"?P.store:void 0,M=(r??o)&&(L==null?void 0:L.state.transitionStatus)==="starting",V=Qn(()=>M?L==null?void 0:L.state.instantType:void 0).current,Z=S4e({open:o,openProp:r,activeTriggerId:b,triggerIdProp:y,parent:P,disabled:a,highlightItemOnHover:v,modal:P.type===void 0?l:void 0,rootId:T,instantType:V},$,I!=null);Z.useControlledProp("openProp",r),Z.useControlledProp("triggerIdProp",y),Z.useContextCallback("onOpenChangeComplete",s);const D=Z.useState("floatingTreeRoot"),B=XR(D),H=Z.useState("open"),U=Z.useState("activeTriggerElement"),q=Z.useState("positionerElement"),W=Z.useState("hoverEnabled"),X=Z.useState("disabled"),R=Z.useState("lastOpenChangeReason"),Q=Z.useState("parent"),F=Z.useState("activeIndex"),N=Z.useState("payload"),z=Z.useState("floatingParentNodeId"),J=c.useRef(null),K=c.useRef(Q.type!=="context-menu"),ne=wn(),se=c.useRef(!0),ie=wn(),he=z!=null;Q.type!==void 0&&l!==void 0&&console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored.");const{openMethod:Se,triggerProps:Oe}=h5(H);Z.useSyncedValues({disabled:a,highlightItemOnHover:v,modal:Q.type===void 0?l:void 0,openMethod:Se,rootId:T}),Pv(Z);const{forceUnmount:be,transitionStatus:me}=Mv(H,Z,()=>{Z.set("allowMouseEnter",!1)},M),ue=z2(Z.context.popupRef);c.useEffect(()=>{if(V===void 0)return;const Te=()=>{Z.state.instantType===V&&Z.set("instantType",void 0)};if(!H){Te();return}if(me!==void 0)return;if(Z.context.popupRef.current==null){Te();return}const Ke=new AbortController;return ue(Te,Ke.signal),()=>{Ke.abort()}},[V,H,me,ue,Z]),Pe(()=>{w&&!C?Z.update({parent:{type:"context-menu",context:w},floatingNodeId:B,floatingParentNodeId:I}):C&&Z.update({floatingNodeId:B,floatingParentNodeId:I})},[w,C,B,I,Z]),c.useEffect(()=>{if(H||(J.current=null),Q.type==="context-menu"){if(!H){ne.clear(),K.current=!1;return}ne.start(500,()=>{K.current=!0})}},[ne,H,Q.type]),Pe(()=>{!H&&!W&&Z.set("hoverEnabled",!0)},[H,W,Z]);const ve=Ee((Te,Ke)=>{const gt=Ke.reason;if(!Te&&!Z.select("open")||H===Te&&Ke.trigger===U&&R===gt)return;const Pt=aj(Ke);if(!Te&&Ke.trigger==null&&(Ke.trigger=U??void 0),i==null||i(Te,Ke),Ke.isCanceled)return;Z.state.floatingRootContext.dispatchOpenChange(Te,Ke);const jt=Ke.event;if(Te===!1&&(jt==null?void 0:jt.type)==="click"&&jt.pointerType==="touch"&&!se.current)return;Te&&gt==="trigger-focus"?(se.current=!1,ie.start(300,()=>{se.current=!0})):(se.current=!0,ie.clear());const et=(gt==="trigger-press"||gt==="item-press")&&jt.detail===0,Yt=!Te&&(gt==="escape-key"||gt==null);J.current=Ke.event;const Mt=Ev(Z.state,Te,Ke.trigger,Pt());Mt.openChangeReason=gt,Q.type==="menubar"&&(gt==="trigger-focus"||gt==="focus-out"||gt==="trigger-hover"||gt==="list-navigation"||gt==="sibling-open")?Mt.instantType="group":et||Yt?Mt.instantType=et?"click":"dismiss":Mt.instantType=void 0,Z.update(Mt)}),xe=ij({popupStore:Z,floatingRootContext:Z.state.floatingRootContext,floatingId:$,nested:I!=null,onOpenChange:ve}),Ce=xe.context.events;Pe(()=>{const Te=({open:Ke,eventDetails:gt})=>ve(Ke,gt);return Ce.on("setOpen",Te),()=>{Ce==null||Ce.off("setOpen",Te)}},[Ce,ve]);const we=c.useCallback(()=>{Z.setOpen(!1,_e(hv))},[Z]);c.useImperativeHandle(p,()=>({unmount:be,close:we}),[be,we]);let Le;Q.type==="context-menu"&&(Le=Q.context),c.useImperativeHandle(Le==null?void 0:Le.positionerRef,()=>q,[q]),c.useImperativeHandle(Le==null?void 0:Le.actionsRef,()=>({setOpen:ve}),[ve]);const Ie=c1(xe,{enabled:!X,bubbles:{escapeKey:g&&Q.type==="menu"},outsidePress(){var Te;return Q.type!=="context-menu"||((Te=J.current)==null?void 0:Te.type)==="contextmenu"?!0:K.current},externalTree:he?D:void 0}),Fe=Aa(),Me=c.useCallback(Te=>{Z.select("activeIndex")!==Te&&Z.set("activeIndex",Te)},[Z]),oe=p5(xe,{enabled:!X,listRef:Z.context.itemDomElements,activeIndex:F,nested:Q.type!==void 0,loopFocus:u,orientation:f,parentOrientation:Q.type==="menubar"?Q.context.orientation:void 0,rtl:Fe==="rtl",disabledIndices:ir,onNavigate:Me,openOnArrowKeyDown:Q.type!=="context-menu",externalTree:he?D:void 0,focusItemOnHover:v}),ge=c.useCallback(Te=>{Z.context.typingRef.current=Te},[Z]),Y=m5(xe,{enabled:!X,listRef:Z.context.itemLabels,elementsRef:Z.context.itemDomElements,activeIndex:F,resetMs:500,onMatch:Te=>{H&&Te!==F&&Z.set("activeIndex",Te)},onTyping:ge}),G=c.useMemo(()=>{const Te=ar(Y.reference,oe.reference,Ie.reference,{onMouseMove(){Z.set("allowMouseEnter",!0)}},Oe);return Te["aria-haspopup"]="menu",Te["aria-expanded"]=H,Te},[Z,Y.reference,oe.reference,Ie.reference,Oe,H]),de=c.useMemo(()=>{const Te=ar(oe.trigger,Ie.trigger,Oe);return Te["aria-haspopup"]="menu",Te["aria-expanded"]=!1,Te},[oe.trigger,Ie.trigger,Oe]);Qn(()=>(Z.update({inactiveTriggerProps:de}),null));const Ae=c.useMemo(()=>ar(u1,{id:$,role:"menu","aria-orientation":f==="horizontal"?"horizontal":void 0,"aria-labelledby":U==null?void 0:U.id,onMouseMove(){Z.set("allowMouseEnter",!0),Q.type==="menu"&&Z.set("hoverEnabled",!1)},onClick(){Z.select("hoverEnabled")&&Z.set("hoverEnabled",!1)},onKeyDown(Te){const Ke=Z.select("keyboardEventRelay");Ke&&!Te.isPropagationStopped()&&Ke(Te)}},Y.floating,oe.floating,Ie.floating),[U,$,f,Q.type,Z,Y.floating,oe.floating,Ie.floating]),Re=oe.item??Ut;Tv(Z,{floatingRootContext:xe,activeTriggerProps:G,inactiveTriggerProps:de,popupProps:Ae,itemProps:Re});const Ge=c.useMemo(()=>({store:Z,parent:P}),[Z,P]),dt=m.jsxs(Ok.Provider,{value:Ge,children:[O&&m.jsx(Cv,{handle:O,store:Z}),typeof n=="function"?n({payload:N}):n]});return Q.type===void 0||Q.type==="context-menu"?m.jsx(bY,{externalTree:D,children:dt}):dt});Pk.displayName="MenuRoot";function S4e(t,e,n){return Qn(()=>new v4e(t,e,n)).current}function C4e(t){const e=io().store,n=c.useMemo(()=>({parentMenu:e}),[e]);return m.jsx(Ak.Provider,{value:n,children:m.jsx(Pk,{...t})})}function AH(t){if(on(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid");if(!Io(t))return AH(Ws(t))}const E4e={"aria-expanded":void 0},Mk=c.forwardRef(function(e,n){const{render:r,className:i,style:s,label:o,id:a,nativeButton:l=!1,openOnHover:u=!0,delay:f=100,closeDelay:p=0,disabled:g=!1,...O}=e,y=EH();if(!(y!=null&&y.parentMenu))throw new Error("Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>.");const b=Ta({guess:!0,label:o}),v=j0(),{store:w}=io(),C=Pn(a),S=w.useState("open"),A=w.useState("floatingRootContext"),P=w.useState("floatingTreeRoot"),T=w.useState("triggerPopupId",C),$=oj(C,w),I=Ee(ne=>{$(ne),ne!==null&&w.select("open")&&w.select("activeTriggerId")==null&&w.update({activeTriggerId:C??null,activeTriggerElement:ne,closeDelay:p})}),L=c.useRef(null),M=c.useCallback(ne=>{L.current=ne,w.set("activeTriggerElement",ne)},[w]);Pe(()=>(I(L.current),()=>I(null)),[I,C,w]),w.useSyncedValue("closeDelay",p);const V=y.parentMenu,Z=w.useState("disabled"),D=V.useState("disabled"),B=g||Z||D;c.useEffect(()=>{var se;const ne=L.current;if(ne&&k5(ne)&&!B){const ie=((se=Er.captureOwnerStack)==null?void 0:se.call(Er))||"";M2(`A disabled element was detected on <Menu.SubmenuTrigger>. To properly disable the trigger, use the \`disabled\` prop on the component instead of setting it on the rendered element.${ie}`)}});const H=V.useState("itemProps"),U=V.useState("isActive",b.index),q=c.useMemo(()=>({type:"submenu-trigger",setActive(){V.select("highlightItemOnHover")&&V.set("activeIndex",b.index)}}),[V,b.index]),{getItemProps:W,itemRef:X}=D8({closeOnClick:!1,disabled:B,highlighted:U,id:C,store:w,typingRef:V.context.typingRef,nativeButton:l,itemMetadata:q,nodeId:v==null?void 0:v.context.nodeId}),R=w.useState("hoverEnabled"),Q=wv(A,{enabled:R&&u&&!B,handleClose:Sv({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:f,delay:{open:f,close:p},shouldOpen:f>0?()=>V.select("allowMouseEnter"):void 0,triggerElementRef:L,externalTree:P,isClosing:()=>w.select("transitionStatus")==="ending",guardStaleOpen:!0}),F=S0(A,{enabled:!B,event:"mousedown",toggle:!u,ignoreMouse:u,stickIfOpen:!1}).reference??Ut,N=w.useState("triggerProps",!0);delete N.id;const z={disabled:B,highlighted:U,open:S},J=w.useState("openMethod"),K=w.useState("lastOpenChangeReason")==="list-navigation"||J==="keyboard";return He("div",e,{state:z,stateAttributesMapping:i1,props:[F,Q,N,H,S&&K&&qR?E4e:void 0,{"aria-controls":T,tabIndex:S||U?0:-1,onBlur(){U&&V.set("activeIndex",null)}},O,W],ref:[n,b.ref,X,I,M]})});Mk.displayName="MenuSubmenuTrigger";function PH(t={}){const{highlightItemOnHover:e,highlightedIndex:n,onHighlightedIndexChange:r}=v8(),{ref:i,index:s}=Ta(t),o=n===s,a=c.useRef(null),l=ns(i,a);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(s)},onMouseMove(){const u=a.current;if(!e||!u)return;const f=u.hasAttribute("disabled")||u.ariaDisabled==="true";!o&&!f&&u.focus()}},compositeRef:l,index:s}}function A4e(t){const{render:e,className:n,style:r,state:i=Ut,props:s=ir,refs:o=ir,metadata:a,stateAttributesMapping:l,tag:u="div",...f}=t,{compositeProps:p,compositeRef:g}=PH({metadata:a});return He(u,t,{state:i,ref:[g,...o],props:[p,...s,f],stateAttributesMapping:l})}function P4e(t,e){const n=c.useRef(null);function r(s){var o;ts.flushSync(()=>{t.setOpen(!1,_e(bg,s.nativeEvent,s.currentTarget))}),(o=cY(n.current))==null||o.focus()}function i(s){var a;const o=t.select("positionerElement");if(o&&kd(s,o))(a=t.context.beforeContentFocusGuardRef.current)==null||a.focus();else{ts.flushSync(()=>{t.setOpen(!1,_e(bg,s.nativeEvent,s.currentTarget))});let l=lY(t.context.triggerFocusTargetRef.current||e.current);for(;l!==null&&Ue(o,l);){const u=l;if(l=dv(l),l===u)break}l==null||l.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function M4e(t){const{enabled:e=!0,mouseDownAction:n,open:r}=t,i=c.useRef(!1);return c.useMemo(()=>e?{onMouseDown:s=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,Ct(s.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:s=>{i.current&&(i.current=!1,s.preventBaseUIHandler())}}:Ut,[e,n,r])}const wb=Ov(function(e,n){const{render:r,className:i,style:s,disabled:o=!1,nativeButton:a=!0,id:l,openOnHover:u,delay:f=100,closeDelay:p=0,handle:g,payload:O,...y}=e,b=io(!0),v=$v(g)??(b==null?void 0:b.store);if(!v)throw new Error("Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.");const w=Pn(l),C=v.useState("isTriggerActive",w),S=v.useState("floatingRootContext"),A=v.useState("isOpenedByTrigger",w),P=v.useState("triggerPopupId",w),T=c.useRef(null),$=R4e(),I=v8(!0),L=Ul(),M=c.useMemo(()=>L??new pv,[L]),V=XR(M),Z=ql(),{registerTrigger:D,isMountedByThisTrigger:B}=Av(w,T,v,{payload:O,closeDelay:p,parent:$,floatingTreeRoot:M,floatingNodeId:V,floatingParentNodeId:Z,keyboardEventRelay:I==null?void 0:I.relayKeyboardEvent}),H=$.type==="menubar",U=v.useState("disabled"),q=o||U||H&&$.context.disabled,{getButtonProps:W,buttonRef:X}=Tr({disabled:q,native:a});c.useEffect(()=>{!A&&$.type===void 0&&(v.context.allowMouseUpTriggerRef.current=!1)},[v,A,$.type]);const R=c.useRef(null),Q=wn(),F=Ee(Ce=>{if(!R.current)return;Q.clear(),v.context.allowMouseUpTriggerRef.current=!1;const we=Ce.target;Ue(R.current,we)||Ue(v.select("positionerElement"),we)||we===R.current||we!=null&&AH(we)===v.select("rootId")||y5(Ce,R.current)||M.events.emit("close",{domEvent:Ce,reason:fv})});c.useEffect(()=>{A&&v.select("lastOpenChangeReason")==="trigger-hover"&&Ct(R.current).addEventListener("mouseup",F,{once:!0})},[A,F,v]);const N=H&&$.context.hasSubmenuOpen,z=wv(S,{enabled:(u??N)&&!q&&(!H||N&&!B),handleClose:Sv({blockPointerEvents:!H}),mouseOnly:!0,move:!1,restMs:$.type===void 0?f:void 0,delay:{close:p},triggerElementRef:T,externalTree:M,isActiveTrigger:C,isClosing:()=>v.select("transitionStatus")==="ending"}),J=T4e(A,v.select("lastOpenChangeReason")),K=S0(S,{enabled:!q,event:A&&H?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:$.type===void 0?J:!1}),ne=dj(S,{enabled:!q&&N}),se=M4e({open:A,enabled:H,mouseDownAction:"open"}),ie=c.useMemo(()=>ar(ne.reference,K.reference),[ne.reference,K.reference]),he=v.useState("triggerProps",B),{preFocusGuardRef:Se,handlePreFocusGuardFocus:Oe,handleFocusTargetFocus:be}=P4e(v,T),me={disabled:q,open:A},ue=[R,n,X,D,T],ve=[ie,z??Ut,he,{"aria-haspopup":"menu","aria-controls":P,id:w,onMouseDown:Ce=>{v.select("open")||(Q.start(200,()=>{v.context.allowMouseUpTriggerRef.current=!0}),Ct(Ce.currentTarget).addEventListener("mouseup",F,{once:!0}))}},H?{role:"menuitem"}:{},se,y,W],xe=He("button",e,{enabled:!H,stateAttributesMapping:gg,state:me,ref:ue,props:ve});return H?m.jsx(A4e,{tag:"button",render:r,className:i,style:s,state:me,refs:ue,props:ve,stateAttributesMapping:gg}):A?m.jsxs(c.Fragment,{children:[m.jsx(Ll,{ref:Se,onFocus:Oe},`${w}-pre-focus-guard`),m.jsx(c.Fragment,{children:xe},w),m.jsx(Ll,{ref:v.context.triggerFocusTargetRef,onFocus:be},`${w}-post-focus-guard`)]}):m.jsx(c.Fragment,{children:xe},w)});wb.displayName="MenuTrigger";function T4e(t,e){const n=wn(),[r,i]=c.useState(!1);return Pe(()=>{t&&e==="trigger-hover"?(i(!0),n.start(500,()=>{i(!1)})):t||(n.clear(),i(!1))},[t,e,n]),r}function R4e(){const t=mH();return c.useMemo(()=>t?{type:"menubar",context:t}:{type:void 0},[t])}const j4e={variant:{default:{classes:"",description:"Default dropdown item appearance"},danger:{classes:"text-kumo-danger data-highlighted:bg-kumo-danger/5 data-highlighted:text-kumo-danger",description:"Destructive action item"}}},yM={variant:"default"};function MH({variant:t=yM.variant}={}){return le(sr(j4e.variant,t,yM.variant).classes)}const TH=c.forwardRef(({className:t,inset:e,children:n,icon:r,...i},s)=>m.jsxs(Mk,{ref:s,"data-kumo-component":"DropdownMenu","data-kumo-part":"submenu-trigger",className:le("flex cursor-default items-center rounded-sm text-base outline-hidden select-none","px-2 py-1.5","focus:bg-kumo-tint focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand","data-[state=open]:bg-kumo-tint",e&&"pl-8",t),...i,children:[r&&m.jsx(r,{className:"mr-2 h-4 w-4"}),n,m.jsx(Pa,{className:"ml-auto h-4 w-4"})]}));TH.displayName=Mk.displayName;const bM=c.forwardRef(({className:t,sideOffset:e=8,children:n,container:r,...i},s)=>{const o=vu();return m.jsx(Sk,{container:r??o??void 0,children:m.jsx(kH,{ref:s,sideOffset:e,...i,children:m.jsx(vH,{className:le("overflow-hidden bg-kumo-control text-kumo-default","max-h-[var(--available-height)] overflow-y-auto","rounded-lg shadow-lg ring ring-kumo-line","min-w-36 p-1.5","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2","data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2","data-[side=top]:slide-in-from-bottom-2","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",t),children:n})})})}),Tk=t=>t?c.isValidElement(t)?t:m.jsx(t,{className:"mr-2 h-4 w-4"}):null,RH=c.forwardRef(({className:t,inset:e,icon:n,children:r,selected:i,render:s,href:o,variant:a="default",...l},u)=>{const f=t1(),p=c.useMemo(()=>m.jsxs(m.Fragment,{children:[n&&Tk(n),r,i&&m.jsx("span",{className:"inline-flex",children:m.jsx(Fr,{})})]}),[n,r,i]),g=c.useMemo(()=>{if(!o)return;const y=/^(https?:)?\/\//.test(o),b=le("flex items-center",a==="danger"&&"text-kumo-danger data-highlighted:bg-kumo-danger/5 data-highlighted:text-kumo-danger");return y?m.jsx("a",{className:le(b,"w-full text-inherit! no-underline!"),href:o,target:"_blank",rel:"noreferrer",onClick:v=>v.stopPropagation(),children:p}):m.jsx(f,{className:le(b,"w-full text-inherit! no-underline!"),href:o,to:o,onClick:v=>v.stopPropagation(),children:p})},[o,p,a,f]),O=o||s;return m.jsx(kk,{ref:u,"data-kumo-component":"DropdownMenu","data-kumo-part":"item",className:le("relative flex cursor-default items-center rounded-md px-2 py-1.5 text-base outline-hidden select-none focus:text-kumo-default focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-kumo-overlay",e&&"pl-8",MH({variant:a}),t),render:o?g:s,...l,children:O?void 0:p})});RH.displayName=kk.displayName;const jH=c.forwardRef(({className:t,inset:e,icon:n,children:r,variant:i="default",...s},o)=>m.jsxs(bH,{ref:o,"data-kumo-component":"DropdownMenu","data-kumo-part":"link-item",className:le("relative flex cursor-default items-center rounded-md px-2 py-1.5 text-base outline-hidden select-none","focus:text-kumo-default focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-kumo-overlay","text-inherit no-underline",e&&"pl-8",MH({variant:i}),t),...s,children:[n&&Tk(n),r]}));jH.displayName="DropdownMenuLinkItem";const IH=c.forwardRef(({className:t,children:e,checked:n,...r},i)=>m.jsxs(bk,{ref:i,"data-kumo-component":"DropdownMenu","data-kumo-part":"checkbox-item",className:le("relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-base outline-hidden transition-colors select-none focus:bg-kumo-tint focus:text-kumo-default focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand data-disabled:pointer-events-none data-disabled:opacity-50",t),checked:n,...r,children:[m.jsx(xH,{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center text-inherit",children:m.jsx(Fr,{weight:"bold",size:12})}),e]}));IH.displayName=bk.displayName;const $H=c.forwardRef(({className:t,inset:e,...n},r)=>m.jsx(vk,{ref:r,className:le("px-2 py-1.5 text-base font-semibold",e&&"pl-8",t),...n}));$H.displayName=vk.displayName;const LH=c.forwardRef(({className:t,...e},n)=>m.jsx(mk,{ref:n,className:le("-mx-1 my-1 h-px bg-kumo-hairline",t),...e}));LH.displayName=mk.displayName;const NH=({className:t,...e})=>m.jsx("span",{className:le("ml-auto text-xs tracking-widest opacity-60",t),...e});NH.displayName="DropdownMenuShortcut";const QH=c.forwardRef(({className:t,children:e,inset:n,icon:r,...i},s)=>m.jsxs(SH,{ref:s,"data-kumo-component":"DropdownMenu","data-kumo-part":"radio-item",className:le("relative flex cursor-default items-center rounded-md px-2 py-1.5 text-base outline-hidden select-none","data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-kumo-tint",n&&"pl-8",t),...i,children:[r&&Tk(r),e]}));QH.displayName="DropdownMenuRadioItem";const ZH=c.forwardRef(({className:t,children:e,...n},r)=>m.jsx(CH,{ref:r,className:le("ml-auto",t),...n,children:e??m.jsx(Fr,{className:"h-4 w-4"})}));ZH.displayName="DropdownMenuRadioItemIndicator";const VH=c.forwardRef(({children:t,render:e,...n},r)=>{if(e)return m.jsx(wb,{ref:r,...n,render:e,children:t});const i=c.isValidElement(t)?t:null;return m.jsx(wb,{ref:r,...n,...i&&{render:i},children:i?void 0:t})});VH.displayName="DropdownMenuTrigger";const pn=Object.assign(Pk,{Trigger:VH,Portal:Sk,Sub:C4e,SubTrigger:TH,SubContent:bM,Content:bM,Item:RH,LinkItem:jH,CheckboxItem:IH,RadioGroup:wH,RadioItem:QH,RadioItemIndicator:ZH,Label:$H,Separator:LH,Shortcut:NH,Group:yH});function I1({task:t,size:e=14,className:n="",align:r="start",onStatusChange:i}){const s=ec(),o=a=>{if(t.status===a)return;const l=t.status;i==null||i(a),s.mutate({id:t.id,fields:{status:a}},{onError:()=>i==null?void 0:i(l)})};return m.jsxs(pn,{children:[m.jsx(pn.Trigger,{render:m.jsx("button",{type:"button",draggable:!1,className:`inline-flex shrink-0 items-center justify-center rounded p-0.5 -m-0.5 hover:bg-kumo-fill disabled:opacity-60 ${n}`,onClick:a=>a.stopPropagation(),onPointerDown:a=>a.stopPropagation(),onMouseDown:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),onKeyUp:a=>a.stopPropagation(),onDragStart:a=>{a.preventDefault(),a.stopPropagation()},disabled:s.isPending,title:`Change status (${m2[t.status]??t.status})`,"aria-label":"Change status",children:m.jsx(Ou,{status:t.status,size:e})})}),m.jsx(pn.Content,{align:r,onClick:a=>a.stopPropagation(),children:m.jsx(pn.RadioGroup,{value:t.status,onValueChange:a=>o(String(a)),children:hH.map(a=>m.jsxs(pn.RadioItem,{value:a,closeOnClick:!0,className:"gap-2",children:[m.jsx(Ou,{status:a,size:12}),m.jsx("span",{children:m2[a]??a}),m.jsx(pn.RadioItemIndicator,{})]},a))})})]})}function _8({tag:t,className:e}){return m.jsx(Mu,{variant:"secondary",className:le("flex-initial shrink min-w-0 max-w-32 px-1.5 text-[11px]",e),children:m.jsx("span",{className:"truncate min-w-0",title:t,children:t})})}const I4e=600,DH={hourly:"Hourly",daily:"Daily",weekly:"Weekly",monthly:"Monthly",yearly:"Yearly"},HH={hourly:"hour",daily:"day",weekly:"week",monthly:"month",yearly:"year"};function $4e(){const{openId:t,close:e}=ro(),{active:n}=cr();return c.useEffect(()=>{if(!t||n)return;const r=i=>{if(i.key!=="Escape")return;const s=i.target;if(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.closest(".cm-editor"))){s.blur();return}e()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t,n,e]),t?m.jsxs("div",{className:"fixed inset-0 z-30 flex",children:[m.jsx("div",{className:"flex-1 cursor-pointer bg-kumo-recessed/60 backdrop-blur-[1px]",onClick:e}),m.jsx("aside",{className:"flex w-[min(680px,92vw)] flex-col border-l border-kumo-line bg-kumo-base shadow-lg",children:m.jsx(L4e,{id:t,onClose:e})})]}):null}function ux(t){if(!t)return"";const e=new Date(t),n=r=>String(r).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`}function L4e({id:t,onClose:e}){var Fe,Me,oe;const{data:n,isLoading:r}=hM(t),{data:i}=Qi(),{data:s}=pM((n==null?void 0:n.kind)==="task"?t:void 0),{data:o}=hM((n==null?void 0:n.parentId)??void 0),{data:a}=pM((n==null?void 0:n.kind)==="task"&&(o==null?void 0:o.kind)==="task"?o.id:void 0),l=(s??[]).filter(ge=>ge.kind==="task"),u=(s??[]).filter(ge=>ge.kind==="note"),{data:f}=G2e((n==null?void 0:n.kind)==="task"?t:void 0),p=ec(),g=aH(),O=MD(),y=K2e(),b=J2e(),v=e8e(),{open:w}=cr(),{open:C}=ro(),[S,A]=c.useState(""),[P,T]=c.useState(""),$=ZD(),[I,L]=c.useState([]),[M,V]=c.useState("open"),[Z,D]=c.useState(""),[B,H]=c.useState(""),[U,q]=c.useState("none"),[W,X]=c.useState(!1),[R,Q]=c.useState("idle"),[F,N]=c.useState("future"),z=c.useRef(null),J=c.useRef(!1);c.useEffect(()=>{n&&z.current!==n.id&&(A(n.title??""),T(n.body),L(n.tags),V(n.status),D(n.dueAt?n.dueAt.slice(0,10):""),H(ux(n.completedAt)),J.current=!1,q(n.priority),X(!1),Q("idle"),z.current=n.id)},[n==null?void 0:n.id,n]),c.useEffect(()=>{!n||J.current||H(ux(n.completedAt))},[n,n==null?void 0:n.completedAt]);const K=c.useMemo(()=>{if(!W||!n||z.current!==n.id)return null;const ge=n.kind==="note",Y=S.trim(),G=Y||(ge?null:Y),de={};G!==(n.title??"")&&!(G===null&&n.title===null)&&G!==n.title&&(de.title=G===""?null:G),P!==n.body&&(de.body=P),JSON.stringify(I)!==JSON.stringify(n.tags)&&(de.tags=I),M!==n.status&&(de.status=M),U!==n.priority&&(de.priority=U);const Ae=n.dueAt?n.dueAt.slice(0,10):"";if(Z!==Ae&&(de.dueAt=Z?new Date(Z).toISOString():null),n.kind==="task"&&M==="done"&&J.current){const Re=ux(n.completedAt);B!==Re&&(de.completedAt=B?new Date(B).toISOString():null)}return de},[W,n,S,P,I,M,U,Z,B]),ne=n!=null&&((Me=(Fe=n.metadata)==null?void 0:Fe.recurrence)==null?void 0:Me.role)==="occurrence";function se(ge){return i4e(ge,ne,F)}if(c.useEffect(()=>{if(!W||!n||!K||Object.keys(K).length===0)return;Q("idle");const ge=setTimeout(async()=>{Q("saving");try{await p.mutateAsync({id:n.id,fields:se(K)}),Q("saved")}catch{Q("error")}},I4e);return()=>clearTimeout(ge)},[W,K]),r||!n)return m.jsxs("div",{className:"flex items-center justify-between p-6 text-sm text-kumo-subtle",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[m.jsx(Su,{size:14}),"Loading…"]}),m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(Us,{size:14}),title:"Close (Esc)",className:"text-kumo-subtle",onClick:e})]});const ie=n,he=i==null?void 0:i.find(ge=>ge.id===ie.projectId),Se=he?`/p/${he.key}`:"",Oe=ie.kind==="note",be=K?Object.keys(K).length>0:!1,me=ge=>he?()=>w({kind:"quick-create",projectId:he.id,initialKind:ge,parentId:ie.id}):void 0;function ue(){A(ie.title??""),T(ie.body),L(ie.tags),V(ie.status),D(ie.dueAt?ie.dueAt.slice(0,10):""),q(ie.priority),Q("idle"),N("future"),X(!0)}async function ve(){if(!be||!K){X(!1);return}Q("saving");try{await p.mutateAsync({id:ie.id,fields:se(K)}),Q("saved"),X(!1)}catch{Q("error")}}async function xe(){g(n),e()}async function Ce(){if(!f||!confirm("Skip this recurring occurrence?"))return;const ge=await y.mutateAsync({taskId:ie.id});ge.next&&C(ge.next.id)}async function we(){!f||!confirm("Stop this recurrence series?")||await b.mutateAsync({ruleId:f.rule.id})}async function Le(ge,Y){if(!Y)throw new Error("First due date is required");const G=ie.dueAt?ie.dueAt.slice(0,10):"";Y!==G&&await p.mutateAsync({id:ie.id,fields:{dueAt:new Date(`${Y}T12:00:00Z`).toISOString()}}),await O.mutateAsync({taskId:ie.id,input:ge})}async function Ie(ge){if(!f)return;const{dtstart:Y,...G}=ge;await v.mutateAsync({ruleId:f.rule.id,input:G})}return m.jsxs(m.Fragment,{children:[m.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b border-kumo-line px-3",children:[m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(Us,{size:16}),title:"Close (Esc)",className:"text-kumo-subtle",onClick:e}),m.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 text-xs text-kumo-subtle",children:[he&&m.jsxs(m.Fragment,{children:[m.jsxs(Jh,{to:Se,className:"flex items-center gap-1 hover:opacity-80",children:[m.jsx(tc,{color:he.color,icon:he.icon,size:12}),m.jsx("span",{className:"font-mono tabular-nums",style:{color:he.color},children:he.key})]}),m.jsx(Pa,{size:11,className:"shrink-0 text-kumo-placeholder"})]}),m.jsx(Z8,{kind:n.kind,compact:!0}),n.sequenceId&&he&&m.jsxs("span",{className:"font-mono tabular-nums",children:[he.key,"-",n.sequenceId]})]}),m.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[W&&m.jsx(H4e,{state:R,dirty:be}),Oe&&m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(K2,{size:14,weight:n.pinned?"fill":"regular"}),title:n.pinned?"Unpin from opening brief":"Pin to opening brief","aria-pressed":n.pinned,className:n.pinned?"text-kumo-brand":"text-kumo-subtle",onClick:()=>p.mutate({id:n.id,fields:{pinned:!n.pinned}})}),W?m.jsx(nt,{size:"sm",icon:m.jsx(Fr,{size:14}),onClick:ve,children:"Done"}):m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(G2,{size:14}),title:"Edit",className:"text-kumo-subtle",onClick:ue}),m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(cu,{size:14}),title:"Delete",className:"text-kumo-subtle hover:bg-kumo-danger-tint hover:text-kumo-danger",onClick:xe})]})]}),m.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-thin",children:m.jsxs("div",{className:"px-6 py-5 space-y-4",children:[m.jsxs("div",{className:"space-y-1",children:[o&&m.jsx(z4e,{entity:n,parent:o,project:i==null?void 0:i.find(ge=>ge.id===o.projectId),siblings:a,onOpen:C}),W?m.jsx("input",{className:le("w-full bg-transparent px-0 py-1 text-lg font-semibold text-kumo-default outline-hidden placeholder:text-kumo-placeholder",!S&&"placeholder:italic"),value:S,placeholder:Oe?"Untitled":"Title","aria-label":"Title",onChange:ge=>A(ge.target.value),autoFocus:!0}):m.jsx("h2",{className:le("py-1 text-lg font-semibold",As(n)?"italic text-kumo-subtle":"text-kumo-default"),children:Or(n)})]}),m.jsx(D4e,{isEditing:W,isTask:n.kind==="task",status:M,setStatus:V,dueDate:Z,setDueDate:D,priority:U,setPriority:q,tags:I,setTags:L,completedAt:n.completedAt,completedAtStr:B,setCompletedAtStr:ge=>{J.current=!0,H(ge)},createdAt:n.createdAt,actorKind:((oe=n.actor)==null?void 0:oe.label)??n.actorKind,task:ie.kind==="task"?{...ie,status:M}:void 0,onStatusChange:V,recurrence:f,recurrenceBusy:p.isPending||O.isPending||y.isPending||b.isPending||v.isPending,onSaveRecurrence:Le,onSkipOccurrence:Ce,onStopRecurrence:we,onSplitRecurrence:Ie,isRecurringOccurrence:ne,occurrenceScope:F,setOccurrenceScope:N}),m.jsx("div",{className:"overflow-hidden rounded-lg border border-kumo-line bg-kumo-base",children:W?m.jsx(Z5,{value:P,onChange:ge=>T(ge),extensions:[bQ()],basicSetup:{lineNumbers:!1,foldGutter:!1,highlightActiveLine:!1,highlightActiveLineGutter:!1},theme:$,minHeight:"220px",placeholder:"Write in Markdown…"}):P?m.jsx("div",{className:"min-h-[120px] p-3",children:m.jsx(Sb,{body:P})}):m.jsx("div",{className:"min-h-[120px] p-3 text-xs text-kumo-placeholder",children:"No description."})}),W&&P&&m.jsxs("details",{className:"text-xxs text-kumo-subtle",children:[m.jsx("summary",{className:"cursor-pointer hover:text-kumo-default",children:"Preview rendered Markdown"}),m.jsx("div",{className:"mt-2 rounded-lg border border-kumo-line bg-kumo-recessed p-3",children:m.jsx(Sb,{body:P})})]}),n.kind==="task"&&l.length>0&&m.jsx(X4e,{items:l,projects:i??[],onOpen:C,onAdd:me("task")}),n.kind==="task"&&u.length>0&&m.jsx(U4e,{items:u,onOpen:C,onAdd:me("note")}),n.kind==="task"&&he&&s&&(l.length===0||u.length===0)&&m.jsx("div",{className:"border-t border-kumo-hairline pt-3",children:m.jsxs("div",{className:"-ml-1.5 flex items-center gap-1",children:[l.length===0&&m.jsx(CM,{onClick:me("task"),children:"Add sub-task"}),u.length===0&&m.jsx(CM,{onClick:me("note"),children:"Add memory"})]})}),n.kind!=="worklog"&&m.jsx(Y4e,{entity:n,canWrite:n.kind==="task"}),n.kind!=="worklog"&&m.jsx(N4e,{entity:n})]})})]})}function N4e({entity:t}){const[e,n]=c.useState(!1),r=Z2e(t.id,{enabled:e}),i=r.data??[];return m.jsxs("section",{className:"border-t border-kumo-hairline pt-4",children:[m.jsxs("button",{type:"button","aria-expanded":e,className:"group flex h-6 w-full items-center gap-2 text-left",onClick:()=>n(s=>!s),children:[m.jsx(_j,{size:14,className:"shrink-0 text-kumo-subtle"}),m.jsx("span",{className:"text-xs font-semibold text-kumo-default",children:"Edits"}),e&&r.data&&m.jsx(jk,{n:i.length}),m.jsx(Pa,{size:12,className:le("ml-auto text-kumo-subtle transition-transform group-hover:text-kumo-default",e&&"rotate-90")})]}),e&&m.jsx("div",{className:"mt-2",children:r.isLoading?m.jsx("div",{className:"flex justify-center p-3 text-kumo-subtle",children:m.jsx(Su,{size:14})}):i.length===0?m.jsx("div",{className:"rounded-lg border border-dashed border-kumo-line p-3 text-center text-xs text-kumo-subtle",children:"Never edited since it was written."}):m.jsx("div",{className:"divide-y divide-kumo-hairline overflow-hidden rounded-lg border border-kumo-line",children:i.map((s,o)=>{const a=o===0?t:i[o-1];return m.jsx(Q4e,{before:s,after:a},s.id)})})})]})}function Q4e({before:t,after:e}){var o;const n=[];(t.title??"")!==(e.title??"")&&n.push(["title",t.title??"(untitled)",e.title??"(untitled)"]),t.status!==e.status&&n.push(["status",t.status,e.status]),t.priority!==e.priority&&n.push(["priority",t.priority,e.priority]),t.tags.join("\0")!==e.tags.join("\0")&&n.push(["tags",t.tags.join(", ")||"—",e.tags.join(", ")||"—"]);const r=t.body!==e.body,i=c.useMemo(()=>r?j2e(R2e(t.body,e.body)):[],[r,t.body,e.body]),s=((o=t.actor)==null?void 0:o.label)??t.actorKind;return m.jsxs("div",{className:"px-3 py-2 text-xs",children:[m.jsxs("div",{className:"flex items-baseline gap-2 text-xxs text-kumo-subtle",children:[m.jsxs("span",{className:"font-mono tabular-nums text-kumo-placeholder",children:["#",t.revision]}),m.jsx("span",{children:new Date(t.createdAt).toLocaleString()}),m.jsxs("span",{children:["· by ",m.jsx("span",{className:"text-kumo-default",children:s})]})]}),n.length>0&&m.jsx("ul",{className:"mt-1 space-y-0.5",children:n.map(([a,l,u])=>m.jsxs("li",{className:"text-xxs",children:[m.jsxs("span",{className:"text-kumo-subtle",children:[a,":"]})," ",m.jsx("span",{className:"text-kumo-danger line-through",children:l})," ",m.jsx("span",{className:"text-kumo-placeholder",children:"→"})," ",m.jsx("span",{className:"text-kumo-default",children:u})]},a))}),r&&m.jsx("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap wrap-break-word rounded-md bg-kumo-recessed p-2 font-mono text-xxs leading-relaxed",children:i.map((a,l)=>a.type==="skip"?m.jsxs("div",{className:"italic text-kumo-placeholder",children:["… ",a.count," unchanged line",a.count===1?"":"s"]},l):m.jsxs("div",{className:a.type==="add"?"bg-kumo-success-tint text-kumo-default":a.type==="del"?"bg-kumo-danger-tint text-kumo-subtle line-through":"text-kumo-subtle",children:[m.jsx("span",{className:"mr-1 select-none text-kumo-placeholder",children:a.type==="add"?"+":a.type==="del"?"−":" "}),a.text||" "]},l))}),!r&&n.length===0&&m.jsx("div",{className:"mt-1 text-xxs text-kumo-placeholder",children:"No visible difference."})]})}function Z4e(t){const e=t.rule,n=cH(e.rrule),r=n.preset??"daily",i=n.interval??1,s=i>1?`Every ${i} ${HH[r]}s`:DH[r],o=n.byWeekday.length?` · ${n.byWeekday.join(", ")}`:"",a=e.anchor==="completion"?"after completion":"scheduled",l=e.enabled?"":" · stopped",u=e.nextOccurrenceAt?` · next ${new Date(e.nextOccurrenceAt).toLocaleDateString()}`:"";return`${s}${o} · ${a}${u}${l}`}function vM(t){const e=t?cH(t.rule.rrule):void 0;return{preset:t?(e==null?void 0:e.preset)??"weekly":"none",interval:(e==null?void 0:e.interval)??1,anchor:(t==null?void 0:t.rule.anchor)??"scheduled",byWeekday:(e==null?void 0:e.byWeekday)??[],count:e!=null&&e.count?String(e.count):"",until:(e==null?void 0:e.until)??""}}function V4e({isEditing:t,task:e,dueDate:n,recurrence:r,onSave:i,onSkip:s,onStop:o,onSplit:a,busy:l}){const[u,f]=c.useState(()=>vM(r)),[p,g]=c.useState(null);if(c.useEffect(()=>{f(vM(r)),g(null)},[t,e==null?void 0:e.id,e==null?void 0:e.dueAt,r==null?void 0:r.rule.id,r==null?void 0:r.rule.rrule,r==null?void 0:r.rule.anchor]),!e)return null;const O=["done","rejected"].includes(e.status),y=!!(r!=null&&r.rule.enabled)&&(r==null?void 0:r.rule.currentOccurrenceId)===e.id,b=!!(r!=null&&r.rule.enabled),v=u.preset!=="none",w=!!i&&n.length>0&&v&&u.interval>=1,C=!!a&&!!(r!=null&&r.rule.enabled)&&v&&u.interval>=1;function S(I){f(L=>({...L,...I})),g(null)}function A(I){const L=new Set(u.byWeekday);L.has(I)?L.delete(I):L.add(I),S({byWeekday:vb.filter(M=>L.has(M))})}function P(){const I={preset:u.preset,interval:u.interval,anchor:u.anchor,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,allDay:!0};return u.preset==="weekly"&&u.byWeekday.length>0&&(I.byWeekday=u.byWeekday),u.count&&(I.count=Number(u.count)),u.until&&(I.until=new Date(`${u.until}T23:59:59Z`).toISOString()),I}async function T(){if(u.preset==="none"){g(null);return}if(!n){g("Set due date first");return}if(u.count&&u.until){g("Use count or until");return}try{await(i==null?void 0:i(P(),n)),g(null)}catch(I){g(I instanceof Error?I.message:"Could not save repeat")}}async function $(){if(u.preset!=="none"){if(u.count&&u.until){g("Use count or until");return}try{await(a==null?void 0:a(P())),g(null)}catch(I){g(I instanceof Error?I.message:"Could not split series")}}}return!t||O?m.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m.jsx("span",{className:r?"truncate text-kumo-subtle":"text-kumo-placeholder",children:r?Z4e(r):"None"}),y&&s&&m.jsx(nt,{variant:"ghost",size:"xs",className:"shrink-0 text-kumo-subtle",disabled:l,onClick:s,children:"Skip occurrence"})]}):m.jsxs("span",{className:"flex min-w-0 flex-col gap-1.5",children:[m.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx(ah,{label:"Repeat",value:u.preset,onChange:I=>S({preset:I}),options:[{value:"none",label:"None"},...lH.map(I=>({value:I,label:DH[I]}))]}),v&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"text-kumo-subtle",children:"every"}),m.jsx(mr,{type:"number",size:"sm",min:1,max:999,"aria-label":"Interval",className:"w-14",value:u.interval,onChange:I=>S({interval:Math.max(1,Number(I.target.value)||1)})}),m.jsxs("span",{className:"text-kumo-subtle",children:[HH[u.preset],u.interval===1?"":"s"," from"]}),m.jsx(ah,{label:"Anchor",value:u.anchor,onChange:I=>S({anchor:I}),options:[{value:"scheduled",label:"Schedule"},{value:"completion",label:"Completion"}]})]})]}),v&&u.preset==="weekly"&&m.jsx("span",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Weekdays",children:vb.map(I=>{const L=u.byWeekday.includes(I);return m.jsx(nt,{size:"xs",variant:L?"primary":"secondary","aria-pressed":L,className:"w-8 justify-center",onClick:()=>A(I),children:I},I)})}),v&&m.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[m.jsx("span",{className:"text-kumo-subtle",children:"Ends after"}),m.jsx(mr,{type:"number",size:"sm",min:1,max:1e4,"aria-label":"Count",placeholder:"∞",className:"w-16",value:u.count,onChange:I=>S({count:I.target.value,until:I.target.value?"":u.until})}),m.jsx("span",{className:"text-kumo-subtle",children:"times, or on"}),m.jsx(mr,{type:"date",size:"sm","aria-label":"Until",className:"w-36",value:u.until,onChange:I=>S({until:I.target.value,count:I.target.value?"":u.count})})]}),(v||b&&o)&&m.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[v&&m.jsx(nt,{size:"xs",variant:"primary",disabled:l||!w,onClick:T,children:r?"Update repeat":"Save repeat"}),C&&m.jsx(nt,{size:"xs",disabled:l,title:"Keep past occurrences on the old cadence; apply this cadence going forward",onClick:$,children:"Split series"}),b&&o&&m.jsx(nt,{size:"xs",variant:"ghost",disabled:l,className:"text-kumo-subtle hover:bg-kumo-danger-tint hover:text-kumo-danger",onClick:o,children:"Stop series"}),v&&!n&&m.jsx("span",{className:"text-xxs text-kumo-placeholder",children:"Set due date first"}),p&&m.jsx("span",{className:"truncate text-xxs text-kumo-danger",children:p})]})]})}function ah({label:t,value:e,onChange:n,options:r,className:i}){const s=new Map(r.map(o=>[o.value,o]));return m.jsx(No,{size:"sm","aria-label":t,value:e,onValueChange:o=>{o!==null&&n(o)},renderValue:o=>{var a,l;return m.jsx(kM,{icon:(a=s.get(o))==null?void 0:a.icon,label:((l=s.get(o))==null?void 0:l.label)??o})},className:le("min-w-28",i),children:r.map(o=>m.jsx(No.Option,{value:o.value,className:"py-1 text-sm",children:m.jsx(kM,{icon:o.icon,label:o.label})},o.value))})}function kM({icon:t,label:e}){return m.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[t,m.jsx("span",{className:"truncate",children:e})]})}function D4e({isEditing:t,isTask:e,status:n,setStatus:r,dueDate:i,setDueDate:s,priority:o,setPriority:a,tags:l,setTags:u,completedAt:f,completedAtStr:p,setCompletedAtStr:g,createdAt:O,actorKind:y,task:b,onStatusChange:v,recurrence:w,recurrenceBusy:C,onSaveRecurrence:S,onSkipOccurrence:A,onStopRecurrence:P,onSplitRecurrence:T,isRecurringOccurrence:$,occurrenceScope:I,setOccurrenceScope:L}){return m.jsxs("div",{className:"grid auto-rows-[minmax(26px,auto)] grid-cols-[80px_1fr] items-center gap-x-3 gap-y-1.5 text-xs",children:[e&&m.jsxs(m.Fragment,{children:[m.jsx(al,{children:"Status"}),m.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:t?m.jsx(ah,{label:"Status",value:n,onChange:r,options:hH.map(M=>({value:M,label:m2[M]??M,icon:m.jsx(Ou,{status:M,size:12})}))}):m.jsxs(m.Fragment,{children:[b?m.jsx(I1,{task:b,size:12,onStatusChange:v}):m.jsx(Ou,{status:n,size:12}),m.jsx("span",{className:"text-kumo-default",children:m2[n]??n})]})}),m.jsx(al,{children:"Due"}),m.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:t?m.jsxs(m.Fragment,{children:[m.jsx(mr,{type:"date",size:"sm","aria-label":"Due date",className:"w-36",value:i,onChange:M=>s(M.target.value)}),i?m.jsx(SM,{label:"Clear due date",onClick:()=>s("")}):m.jsx(wM,{children:"inbox"})]}):m.jsx("span",{className:i?"tabular-nums text-kumo-default":"text-kumo-placeholder",children:i||"inbox"})}),(w||t&&b&&!["done","rejected"].includes(n))&&m.jsxs(m.Fragment,{children:[m.jsx(al,{top:t,children:"Repeat"}),m.jsx(V4e,{isEditing:t,task:b,dueDate:i,recurrence:w,busy:!!C,onSave:S,onSkip:A,onStop:P,onSplit:T})]}),t&&$&&m.jsxs(m.Fragment,{children:[m.jsx(al,{children:"Apply to"}),m.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:m.jsx(ah,{label:"Recurrence edit scope",value:I??"future",onChange:M=>L==null?void 0:L(M),className:"min-w-40",options:[{value:"future",label:"This and future"},{value:"this",label:"This occurrence only"}]})})]}),m.jsx(al,{children:"Priority"}),m.jsx("span",{className:"flex min-w-0 items-center gap-1.5",children:t?m.jsx(ah,{label:"Priority",value:o,onChange:a,options:jD.map(M=>({value:M,label:xu[M],icon:m.jsx(zl,{priority:M,size:12})}))}):m.jsxs(m.Fragment,{children:[m.jsx(zl,{priority:o,size:12}),m.jsx("span",{className:"text-kumo-default",children:xu[o]})]})}),n==="done"&&m.jsxs(m.Fragment,{children:[m.jsx(al,{children:"Completed"}),t?m.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[m.jsx(mr,{type:"datetime-local",size:"sm","aria-label":"Completed at",className:"w-48",value:p,onChange:M=>g(M.target.value)}),p?m.jsx(SM,{label:"Clear completed time",onClick:()=>g("")}):m.jsx(wM,{children:"auto"})]}):m.jsx("span",{className:"text-kumo-subtle",children:f?new Date(f).toLocaleString():"Not recorded"})]})]}),m.jsx(al,{children:"Tags"}),t?m.jsx(xZ,{"aria-label":"Tags",value:l,onValueChange:u,placeholder:l.length?"":"Add tag…",className:"min-h-6.5 gap-x-1 gap-y-1 px-1 py-0.5 text-xs [&>span]:h-5 [&>span]:text-xs"}):l.length?m.jsx("span",{className:"flex min-w-0 flex-wrap gap-1",children:l.map(M=>m.jsx(_8,{tag:M},M))}):m.jsx("span",{className:"text-kumo-placeholder",children:"none"}),m.jsx(al,{children:"Created"}),m.jsxs("span",{className:"text-kumo-subtle",children:[new Date(O).toLocaleString()," · by"," ",m.jsx("span",{className:"text-kumo-default",children:y})]})]})}function al({children:t,top:e=!1}){return m.jsx("span",{className:le("text-kumo-subtle",e&&"self-start leading-6.5"),children:t})}function wM({children:t}){return m.jsx("span",{className:"text-[11px] text-kumo-placeholder",children:t})}function SM({label:t,onClick:e}){return m.jsx(nt,{variant:"ghost",size:"xs",shape:"square",icon:m.jsx(Us,{size:12}),"aria-label":t,className:"size-5 text-kumo-subtle hover:text-kumo-danger",onClick:e})}function H4e({state:t,dirty:e}){return t==="saving"?m.jsxs("span",{className:"flex items-center gap-1 text-xxs text-kumo-subtle",children:[m.jsx(Su,{size:11}),"Saving…"]}):t==="saved"&&!e?m.jsxs("span",{className:"flex items-center gap-1 text-xxs text-kumo-placeholder",children:[m.jsx(Cj,{size:12}),"Saved"]}):t==="error"?m.jsx("span",{className:"text-xxs text-kumo-danger",children:"Save failed"}):e?m.jsxs("span",{className:"flex items-center gap-1 text-xxs text-kumo-placeholder",children:[m.jsx(Sj,{size:12}),"Unsaved"]}):null}function Rk({icon:t,title:e,meta:n,action:r}){return m.jsxs("div",{className:"mb-2 flex h-6 items-center gap-2",children:[m.jsx(t,{size:14,className:"shrink-0 text-kumo-subtle"}),m.jsx("h3",{className:"text-xs font-semibold text-kumo-default",children:e}),n,r&&m.jsx("div",{className:"ml-auto flex items-center",children:r})]})}function CM({onClick:t,children:e}){return m.jsx(nt,{variant:"ghost",size:"xs",className:"text-kumo-subtle hover:text-kumo-default",icon:m.jsx($i,{size:12}),onClick:t,children:e})}function jk({n:t}){return m.jsx("span",{className:"text-xs tabular-nums text-kumo-placeholder",children:t})}function F4e(t,e){if(!t.sequenceId)return null;const n=e.find(r=>r.id===t.projectId);return n?`${n.key}-${t.sequenceId}`:null}const _4e={task:"Sub-task of",note:"Memory for",worklog:"Worklog on",feedback:"Linked to"};function z4e({entity:t,parent:e,project:n,siblings:r,onOpen:i}){const s=e.sequenceId&&n?`${n.key}-${e.sequenceId}`:null,o=(r??[]).filter(l=>l.kind==="task"),a=o.filter(l=>g2.has(l.status)).length;return m.jsxs("button",{type:"button",className:"group -mx-1.5 flex max-w-full items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs text-kumo-subtle transition-colors hover:bg-kumo-tint",title:`Open ${s??"parent"}`,onClick:()=>i(e.id),children:[m.jsx(Sg,{size:12,className:"shrink-0 text-kumo-placeholder"}),m.jsx("span",{className:"shrink-0",children:_4e[t.kind]}),e.kind==="task"&&m.jsx(Ou,{status:e.status,size:12}),s&&m.jsx("span",{className:"shrink-0 font-mono tabular-nums",children:s}),m.jsx("span",{className:"truncate font-medium text-kumo-default group-hover:text-kumo-link",children:Or(e)}),o.length>1&&m.jsxs("span",{className:"shrink-0 tabular-nums text-kumo-placeholder",children:["· ",a,"/",o.length]})]})}const g2=new Set(["done","rejected"]),EM={in_progress:0,open:1,done:2,rejected:3},B4e=3;function AM(t,e){return(EM[t.status]??1)-(EM[e.status]??1)}function X4e({items:t,projects:e,onOpen:n,onAdd:r}){const[i,s]=c.useState(!1),o=t.filter(p=>p.kind==="task"),a=o.filter(p=>!g2.has(p.status)).sort(AM),l=o.filter(p=>g2.has(p.status)).sort(AM),u=l.length>B4e,f=u&&!i?a:[...a,...l];return m.jsxs("section",{className:"border-t border-kumo-hairline pt-4",children:[m.jsx(Rk,{icon:iI,title:"Sub-tasks",meta:o.length>0?m.jsx(W4e,{tasks:o}):null,action:r&&m.jsx(nt,{variant:"ghost",size:"xs",icon:m.jsx($i,{size:12}),className:"text-kumo-link",onClick:r,children:"Add sub-task"})}),o.length>0&&m.jsxs("div",{className:"overflow-hidden rounded-lg border border-kumo-line",children:[f.length>0&&m.jsx("ul",{className:"divide-y divide-kumo-hairline",children:f.map(p=>m.jsx(q4e,{task:p,idLabel:F4e(p,e),onOpen:n},p.id))}),u&&m.jsxs("button",{type:"button","aria-expanded":i,className:`flex w-full items-center gap-1.5 bg-kumo-recessed/60 px-3 py-1.5 text-xxs text-kumo-subtle transition-colors hover:text-kumo-default ${f.length>0?"border-t border-kumo-hairline":""}`,onClick:()=>s(p=>!p),children:[m.jsx(Pa,{size:10,className:le("transition-transform",i&&"rotate-90")}),i?"Hide":"Show"," ",l.length," closed"]})]})]})}function W4e({tasks:t}){const e=l=>t.filter(u=>u.status===l).length,n=e("done"),r=e("rejected"),i=e("in_progress"),s=n+r,o=l=>`${l/t.length*100}%`,a=[`${n} done`,r&&`${r} rejected`,i&&`${i} in progress`,`${t.length-s-i} open`].filter(Boolean).join(" · ");return m.jsxs("span",{className:"flex items-center gap-2",title:a,children:[m.jsxs("span",{className:"flex h-1.5 w-20 overflow-hidden rounded-full bg-kumo-fill",children:[m.jsx("span",{className:"h-full bg-(--color-kumo-success)",style:{width:o(s)}}),m.jsx("span",{className:"h-full bg-(--color-kumo-warning)",style:{width:o(i)}})]}),m.jsxs("span",{className:"text-xs tabular-nums text-kumo-subtle",children:[s,"/",t.length]})]})}function q4e({task:t,idLabel:e,onOpen:n}){const r=g2.has(t.status),i=t.dueAt?new Date(t.dueAt):null,s=i!==null&&!r&&i.getTime()<new Date().setHours(0,0,0,0);return m.jsxs("li",{role:"button",tabIndex:0,className:"group flex cursor-pointer items-center gap-2.5 px-3 py-2 transition-colors hover:bg-kumo-tint focus-visible:bg-kumo-tint focus-visible:outline-hidden",onClick:()=>n(t.id),onKeyDown:o=>{o.key==="Enter"&&n(t.id)},children:[m.jsx(I1,{task:t,size:14}),e&&m.jsx("span",{className:"shrink-0 font-mono text-xxs tabular-nums text-kumo-subtle",children:e}),m.jsx("span",{className:le("min-w-0 flex-1 truncate text-sm",r?"text-kumo-subtle":"text-kumo-default group-hover:text-kumo-link"),children:Or(t)}),i&&!r&&m.jsx("span",{className:`shrink-0 text-xxs tabular-nums ${s?"text-kumo-danger":"text-kumo-subtle"}`,children:rr(i,"MMM d")}),t.priority!=="none"&&!r&&m.jsx("span",{title:`${xu[t.priority]} priority`,className:"flex",children:m.jsx(zl,{priority:t.priority,size:12})})]})}function U4e({items:t,onOpen:e,onAdd:n}){const r=t.filter(i=>i.kind==="note");return m.jsxs("section",{className:"border-t border-kumo-hairline pt-4",children:[m.jsx(Rk,{icon:O0,title:"Memory",meta:r.length>0?m.jsx(jk,{n:r.length}):null,action:n&&m.jsx(nt,{variant:"ghost",size:"xs",icon:m.jsx($i,{size:12}),className:"text-kumo-link",onClick:n,children:"Add memory"})}),r.length>0&&m.jsx("div",{className:"divide-y divide-kumo-hairline overflow-hidden rounded-lg border border-kumo-line",children:r.map(i=>m.jsxs("button",{type:"button",className:"flex w-full items-start gap-2 px-3 py-2 text-left transition-colors hover:bg-kumo-tint",onClick:()=>e(i.id),children:[m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:le("truncate text-sm",As(i)?"italic text-kumo-subtle":"text-kumo-default"),children:Or(i)}),!As(i)&&i.body&&m.jsx("div",{className:"mt-0.5 truncate text-xxs text-kumo-subtle",children:i.body.replace(/\n/g," ").slice(0,140)})]}),i.pinned&&m.jsx(K2,{size:12,weight:"fill",className:"mt-1 shrink-0 text-kumo-brand"})]},i.id))})]})}const PM=5;function Y4e({entity:t,canWrite:e}){const{data:n,isLoading:r}=V2e(t.id),[i,s]=c.useState(!1),o=n??[];if(!e&&o.length===0)return null;const a=i||o.length<=PM+1?0:o.length-PM,l=o.slice(a),u=o.at(-1);return m.jsxs("section",{className:"border-t border-kumo-hairline pt-4",children:[m.jsx(Rk,{icon:q2,title:"Worklog",meta:o.length>0?m.jsx(jk,{n:o.length}):null,action:u&&m.jsxs("span",{className:"text-xxs text-kumo-placeholder",children:["Last entry ",zH(u.createdAt)]})}),r?m.jsx("div",{className:"flex justify-center p-3 text-kumo-subtle",children:m.jsx(Su,{size:14})}):m.jsxs("ol",{className:"mt-3",children:[a>0&&m.jsxs("li",{className:"relative flex gap-3 pb-5",children:[m.jsx(FH,{}),m.jsx("span",{className:"relative z-10 flex size-6 shrink-0 items-center justify-center rounded-full border border-dashed border-kumo-line bg-kumo-base text-[10px] tabular-nums text-kumo-subtle",children:a}),m.jsxs("button",{type:"button",className:"h-6 text-xs text-kumo-link hover:underline",onClick:()=>s(!0),children:["Show ",a," earlier ",a===1?"entry":"entries"]})]}),l.map((f,p)=>m.jsx(K4e,{entry:f,isLast:!e&&p===l.length-1},f.id)),e&&m.jsx(n6e,{entityId:t.id,isFirst:o.length===0})]})]})}function FH(){return m.jsx("span",{"aria-hidden":!0,className:"absolute bottom-0 left-3 top-6 w-px -translate-x-1/2 bg-kumo-line"})}const MM={agent:{icon:e3,className:"bg-kumo-brand-tint text-kumo-brand"},human:{icon:s3,className:"bg-kumo-fill text-kumo-default"},system:{icon:U2,className:"bg-kumo-fill text-kumo-subtle"}};function _H({kind:t}){const{icon:e,className:n}=MM[t]??MM.system;return m.jsx("span",{className:le("relative z-10 flex size-6 shrink-0 items-center justify-center rounded-full ring-4 ring-kumo-base",n),children:m.jsx(e,{size:13,weight:"bold"})})}function G4e(t){var n;const e=((n=t.actor)==null?void 0:n.label)??t.actorKind;return e===t.actorKind?e.charAt(0).toUpperCase()+e.slice(1):e}function zH(t){const e=new Date(t),n=Date.now()-e.getTime();return n<6e4?"just now":n<7*864e5?sfe(e,{addSuffix:!0}):rr(e,e.getFullYear()===new Date().getFullYear()?"MMM d":"MMM d, yyyy")}function K4e({entry:t,isLast:e}){return m.jsxs("li",{className:"relative flex gap-3 pb-5",children:[!e&&m.jsx(FH,{}),m.jsx(_H,{kind:t.actorKind}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsxs("div",{className:"flex h-6 items-center gap-2 text-xs",children:[m.jsx("span",{className:"truncate font-medium text-kumo-default",children:G4e(t)}),m.jsx("time",{dateTime:t.createdAt,title:new Date(t.createdAt).toLocaleString(),className:"ml-auto shrink-0 tabular-nums text-kumo-placeholder",children:zH(t.createdAt)})]}),m.jsx(t6e,{body:t.body})]})]})}const J4e=600,e6e=12;function t6e({body:t}){const[e,n]=c.useState(!1),r=t.length>J4e||t.split(`
151
151
  `).length>e6e;return m.jsxs("div",{className:"mt-0.5",children:[m.jsx("div",{className:le(r&&!e&&"max-h-44 overflow-hidden [mask-image:linear-gradient(to_bottom,black_65%,transparent)]"),children:m.jsx(Sb,{body:t})}),r&&m.jsx("button",{type:"button",className:"mt-1 text-xxs font-medium text-kumo-link hover:underline",onClick:()=>n(i=>!i),children:e?"Show less":"Show more"})]})}function n6e({entityId:t,isFirst:e}){const[n,r]=c.useState(""),i=D2e(),s=n.trim().length>0&&!i.isPending;async function o(){if(s)try{await i.mutateAsync({parentId:t,input:{body:n.trim(),actorKind:"human"}}),r("")}catch{}}return m.jsxs("li",{className:"relative flex gap-3",children:[m.jsx(_H,{kind:"human"}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx(O8,{"aria-label":"New worklog entry",rows:2,className:"w-full resize-y py-1.5 text-sm leading-snug",placeholder:e?"No entries yet. Log progress, a decision, or a blocker…":"Log progress, a decision, or a blocker…",value:n,onChange:a=>r(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.metaKey||a.ctrlKey)&&(a.preventDefault(),o())}}),n.trim()&&m.jsxs("div",{className:"mt-1.5 flex items-center justify-between gap-2",children:[m.jsxs("span",{className:"text-xxs text-kumo-placeholder",children:["Markdown · ",m.jsx("kbd",{children:"⌘"}),"+",m.jsx("kbd",{children:"Enter"})," to log"]}),m.jsx(nt,{size:"sm",variant:"primary",disabled:!s,onClick:o,children:i.isPending?"Logging…":"Log entry"})]}),i.error&&m.jsx("div",{className:"mt-1 text-xs text-kumo-danger",children:i.error.message})]})]})}function Sb({body:t}){return m.jsx("div",{className:"space-y-2 text-sm leading-relaxed text-kumo-default [&_a]:text-kumo-link [&_a]:underline [&_blockquote]:border-l-2 [&_blockquote]:border-kumo-line [&_blockquote]:pl-3 [&_blockquote]:text-kumo-subtle [&_code]:rounded [&_code]:bg-kumo-fill [&_code]:px-1 [&_code]:py-0.5 [&_code]:text-xs [&_h1]:mb-1.5 [&_h1]:mt-3 [&_h1]:text-lg [&_h1]:font-semibold [&_h2]:mb-1 [&_h2]:mt-3 [&_h2]:text-base [&_h2]:font-semibold [&_h3]:mt-2 [&_h3]:font-semibold [&_li]:my-0.5 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-1 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-kumo-recessed [&_pre]:p-2 [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_table]:border-collapse [&_td]:border [&_td]:border-kumo-line [&_td]:px-2 [&_td]:py-1 [&_th]:border [&_th]:border-kumo-line [&_th]:px-2 [&_th]:py-1 [&_ul]:list-disc [&_ul]:pl-5",children:m.jsx(eD,{remarkPlugins:[SD],children:t})})}const f0={planned:"Planned",active:"Active",watching:"Watching",paused:"Paused",archived:"Archived"},BH={planned:"Committed, not started",active:"Currently being built",watching:"Built, in maintenance",paused:"Intentionally on hold",archived:"Hidden from active work"},Cb=["planned","active","watching","paused","archived"];function XH(){return m.jsxs(Jh,{to:"/",className:"flex items-center gap-2 text-kumo-default hover:opacity-90",children:[m.jsx("img",{src:"/favicon.svg",alt:"","aria-hidden":"true",className:"size-5"}),m.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"botnote"})]})}const dx={key:"Key (A→Z)",name:"Name (A→Z)",recent:"Recently active"},TM={archived:!0},WH="data-[active]:bg-kumo-brand-tint data-[active]:text-kumo-link [&[data-active]_svg]:opacity-100";function r6e(t,e){const n=[...t];return e==="key"?n.sort((r,i)=>r.key.localeCompare(i.key)):e==="name"?n.sort((r,i)=>r.name.localeCompare(i.name)):n.sort((r,i)=>+new Date(i.updatedAt)-+new Date(r.updatedAt))}function i6e(){const{open:t}=cr(),{key:e}=P2(),n=yu(),{setOpenMobile:r}=Ps(),[i,s]=bh("botnote.projectSort","key"),[o,a]=bh("botnote.sidebar.projectGroups.collapsed",TM),{data:l,isLoading:u}=Qi({includeArchived:!0}),{data:f}=PD(200),p=(f==null?void 0:f.length)??0;c.useEffect(()=>{r(!1)},[n.pathname,n.search,r]);const g=c.useMemo(()=>{const v=l??[];return new Map(Cb.map(w=>[w,r6e(v.filter(C=>C.status===w),i)]))},[l,i]),O=(l==null?void 0:l.length)??0,y=v=>o[v]??TM[v]??!1,b=(v,w=!1)=>w?n.pathname===v:n.pathname===v||n.pathname.startsWith(`${v}/`);return m.jsxs(tr,{children:[m.jsx(tr.Header,{className:"h-12 px-6",children:m.jsx(XH,{})}),m.jsxs(tr.Content,{children:[m.jsx(tr.Group,{children:m.jsxs(tr.Menu,{children:[m.jsx(ud,{to:"/",icon:kj,label:"Tasks",shortcut:"g d",active:b("/",!0)}),m.jsx(ud,{to:"/today",icon:r3,label:"Today",shortcut:"g t",active:b("/today")}),m.jsx(ud,{to:"/inbox",icon:yh,label:"Inbox",shortcut:"g i",active:b("/inbox")}),m.jsx(ud,{to:"/dashboard",icon:Jj,label:"Workspace",shortcut:"g w",active:b("/dashboard")})]})}),m.jsxs(tr.Group,{children:[m.jsxs("div",{className:"mt-4 mb-1 flex items-center justify-between pl-3",children:[m.jsx("span",{className:"text-sm font-medium text-kumo-subtle",children:"Projects"}),m.jsxs("div",{className:"flex items-center",children:[m.jsxs(pn,{children:[m.jsx(pn.Trigger,{render:m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(Yj,{size:14}),"aria-label":`Sort projects: ${dx[i]}`,className:"text-kumo-subtle"})}),m.jsx(pn.Content,{align:"end",children:m.jsx(pn.RadioGroup,{value:i,onValueChange:v=>s(v),children:Object.keys(dx).map(v=>m.jsxs(pn.RadioItem,{value:v,closeOnClick:!0,children:[m.jsx("span",{children:dx[v]}),m.jsx(pn.RadioItemIndicator,{})]},v))})})]}),m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx($i,{size:14}),title:"New project (n)",className:"text-kumo-subtle",onClick:()=>t({kind:"new-project"})})]})]}),m.jsxs(tr.Menu,{children:[u&&m.jsx("li",{className:"px-3 py-1 text-sm text-kumo-placeholder",children:"Loading…"}),!u&&O===0&&m.jsxs(tr.MenuButton,{size:"sm",className:"text-kumo-subtle",onClick:()=>t({kind:"new-project"}),children:["No projects yet.",m.jsx("span",{className:"text-kumo-link",children:"Create →"})]}),!u&&Cb.map(v=>{const w=g.get(v)??[];return w.length===0?null:m.jsx(tr.MenuItem,{children:m.jsxs(tr.Collapsible,{open:!y(v),onOpenChange:C=>a({...o,[v]:!C}),children:[m.jsx(tr.CollapsibleTrigger,{render:m.jsxs(tr.MenuButton,{size:"sm",className:"text-xs font-medium text-kumo-subtle",children:[f0[v],m.jsx("span",{className:"ml-auto tabular-nums text-kumo-placeholder",children:w.length}),m.jsx(tr.MenuChevron,{className:"ml-0"})]})}),m.jsx(tr.CollapsibleContent,{children:m.jsx(tr.Menu,{children:w.map(C=>m.jsx(s6e,{project:C,active:e===C.key},C.id))})})]})},v)})]})]})]}),m.jsx("div",{className:"shrink-0 border-t border-kumo-line px-3.5 py-2",children:m.jsxs(tr.Menu,{children:[m.jsx(ud,{to:"/trash",icon:cu,label:"Trash",active:b("/trash"),children:p>0&&m.jsx("span",{className:"ml-auto text-xs tabular-nums text-kumo-subtle",children:p})}),m.jsx(ud,{to:"/settings",icon:U2,label:"Settings",active:b("/settings")})]})})]})}function ud({to:t,icon:e,label:n,shortcut:r,active:i,children:s}){return m.jsxs(tr.MenuButton,{href:t,icon:e,active:i,className:WH,children:[n,s,r&&m.jsx("kbd",{className:"ml-auto opacity-0 transition-opacity group-hover/menu-button:opacity-100",children:r})]})}function s6e({project:t,active:e}){const n=t.status==="archived";return m.jsx(tr.MenuItem,{children:m.jsxs(tr.MenuButton,{size:"sm",href:`/p/${t.key}`,active:e,icon:m.jsx(tc,{color:t.color,icon:t.icon,size:14}),title:n?`${t.name} (archived)`:t.name,className:le(WH,n&&"opacity-60"),children:[m.jsx("span",{className:"shrink-0 font-mono text-xs tabular-nums",style:{color:t.color},children:t.key}),m.jsx("span",{className:"truncate text-kumo-subtle",children:t.name})]})})}const fx={light:{label:"Light",icon:nI},dark:{label:"Dark",icon:Hj},system:{label:"System",icon:Mj}};function o6e(){const{open:t}=cr(),e=Xl(),{isMobile:n,open:r,toggleSidebar:i}=Ps(),s=typeof navigator<"u"&&navigator.platform.includes("Mac")?"⌘":"Ctrl";async function o(){try{await Zt.logout()}catch{}e("/login",{replace:!0})}return m.jsxs("header",{className:"flex h-12 shrink-0 items-center justify-between gap-2 border-b border-kumo-line bg-kumo-base px-3",children:[m.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n?m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(Dj,{size:18}),"aria-label":"Open navigation",onClick:i}):m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(qj,{size:18}),title:r?"Hide sidebar":"Show sidebar",className:"text-kumo-subtle",onClick:i}),(n||!r)&&m.jsx(XH,{})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs(nt,{size:"sm",icon:m.jsx(xh,{size:14,className:"text-kumo-subtle"}),className:"md:min-w-[220px]",onClick:()=>t({kind:"search"}),children:[m.jsx("span",{className:"sr-only sm:not-sr-only sm:flex-1 sm:text-left sm:text-kumo-subtle",children:"Search…"}),m.jsxs("kbd",{className:"hidden md:inline-flex",children:[s,"K"]})]}),m.jsxs(nt,{variant:"primary",size:"sm",icon:m.jsx($i,{size:14,weight:"bold"}),onClick:()=>t({kind:"quick-create"}),children:[m.jsx("span",{className:"sr-only sm:not-sr-only",children:"New"}),m.jsx("kbd",{className:"hidden border-white/25 bg-white/15 text-white md:inline-flex",children:"c"})]}),m.jsx(a6e,{}),m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(t3,{size:16}),title:"Log out",className:"text-kumo-subtle hover:text-kumo-danger",onClick:o})]})]})}function a6e(){const[t,e]=x8e(),n=fx[t].icon;return m.jsxs(pn,{children:[m.jsx(pn.Trigger,{render:m.jsx(nt,{variant:"ghost",size:"sm",shape:"square",icon:m.jsx(n,{size:16}),"aria-label":`Theme: ${fx[t].label}`,className:"text-kumo-subtle"})}),m.jsx(pn.Content,{align:"end",className:"w-36",children:m.jsx(pn.RadioGroup,{value:t,onValueChange:r=>e(r),children:ID.map(r=>{const{label:i,icon:s}=fx[r];return m.jsxs(pn.RadioItem,{value:r,className:"gap-2",children:[m.jsx(s,{size:14,className:"text-kumo-subtle"}),i,m.jsx(pn.RadioItemIndicator,{})]},r)})})})]})}const l6e={"--sidebar-width":"15rem"};function c6e(){BJ();const[t,e]=bh("botnote.sidebar.open",!0);return m.jsxs(tr.Provider,{collapsible:"offcanvas",defaultOpen:t,onOpenChange:e,className:"h-full",style:l6e,children:[m.jsx(i6e,{}),m.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[m.jsx(o6e,{}),m.jsx("main",{className:"min-h-0 flex-1 overflow-hidden bg-kumo-canvas",children:m.jsx(YX,{})})]}),m.jsx($4e,{})]})}function qH({icon:t,color:e,onIconChange:n,onColorChange:r}){return m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{children:[m.jsx("div",{className:"mb-1.5 text-base font-medium text-kumo-default",children:"Color"}),m.jsx("div",{className:"flex flex-wrap gap-1.5",children:d4e.map(i=>m.jsx("button",{type:"button",onClick:()=>r(i.value),className:"relative w-6 h-6 rounded-full border border-kumo-line hover:scale-110 transition-transform focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-kumo-brand focus-visible:ring-offset-1 focus-visible:ring-offset-kumo-base",style:{backgroundColor:i.value},title:i.name,"aria-label":i.name,"aria-pressed":e===i.value,children:e===i.value&&m.jsx(Fr,{size:12,weight:"bold",className:"absolute inset-0 m-auto text-white"})},i.value))})]}),m.jsxs("div",{children:[m.jsx("div",{className:"mb-1.5 text-base font-medium text-kumo-default",children:"Icon"}),m.jsx("div",{className:"flex flex-wrap gap-1",children:uH.map(i=>m.jsx("button",{type:"button",onClick:()=>n(i.name),"aria-label":i.name,"aria-pressed":t===i.name,className:`w-7 h-7 rounded-md flex items-center justify-center border transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-kumo-brand ${t===i.name?"border-kumo-brand bg-kumo-brand-tint":"border-kumo-line bg-kumo-base hover:bg-kumo-tint"}`,title:i.name,children:m.jsx(tc,{color:e,icon:i.name,size:14})},i.name))})]})]})}const Ik=c.createContext(void 0);Ik.displayName="DialogRootContext";function nc(t){const e=c.useContext(Ik);if(!t&&e===void 0)throw new Error("Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.");return e}const $k=c.createContext(void 0);$k.displayName="DialogPortalContext";function u6e(){const t=c.useContext($k);if(t===void 0)throw new Error("Base UI: <Dialog.Portal> is missing.");return t}const d6e="data-nested-dialog-open",f6e={...g0,...is,nestedDialogOpen(t){return t?{[d6e]:""}:null}},O2=c.forwardRef(function(e,n){const{keepMounted:r=!1,...i}=e,s=nc(),o=s.useState("mounted"),a=s.useState("modal"),l=s.useState("open");return o||r?m.jsx($k.Provider,{value:r,children:m.jsxs(l1,{ref:n,...i,children:[o&&a===!0&&m.jsx(S1,{ref:s.context.internalBackdropRef,inert:C1(!l)}),e.children]})}):null});O2.displayName="DialogPortal";function h6e({store:t,parentContext:e,isDrawer:n}){const r=t.useState("open"),i=t.useState("disablePointerDismissal"),s=t.useState("modal"),o=t.useState("popupElement"),a=t.useState("floatingRootContext"),[l,u]=c.useState(0),[f,p]=c.useState(0),g=l===0,O=c1(a,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(y){if(!t.context.outsidePressEnabledRef.current||"button"in y&&y.button!==0)return!1;if("touches"in y){if(y.type==="touchend"){if(y.changedTouches.length!==1||y.touches.length!==0)return!1}else if(y.touches.length!==1)return!1}const b=ln(y);if(g&&!i){if(s){const v=t.context.internalBackdropRef.current,w=t.context.backdropRef.current;return v||w?v===b||w===b||Ue(b,o)&&!(b!=null&&b.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:g});return IQ(r&&s===!0,o),t.useContextCallback("onNestedDialogOpen",(y,b)=>{u(y),p(b)}),Pe(()=>(e!=null&&e.onNestedDialogOpen&&(r?e.onNestedDialogOpen(l+1,f+(n?1:0)):e.onNestedDialogOpen(0,0)),()=>{e!=null&&e.onNestedDialogOpen&&r&&e.onNestedDialogOpen(0,0)}),[n,r,l,f,e]),Tv(t,{activeTriggerProps:O.reference,inactiveTriggerProps:O.trigger,popupProps:O.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:f}),null}const p6e={...Iv,modal:t=>t.modal,nested:t=>t.nested,nestedOpenDialogCount:t=>t.nestedOpenDialogCount,nestedOpenDrawerCount:t=>t.nestedOpenDrawerCount,disablePointerDismissal:t=>t.disablePointerDismissal,openMethod:t=>t.openMethod,descriptionElementId:t=>t.descriptionElementId,titleElementId:t=>t.titleElementId,viewportElement:t=>t.viewportElement,role:t=>t.role};var m6e=class extends wu{constructor(e,n,r){const i=new F2,s=g6e(e,i,n,r);super(s,O6e(i),p6e);$t(this,"setOpen",(e,n)=>{var r,i;n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!e&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),(i=(r=this.context).onOpenChange)==null||i.call(r,e,n),!n.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,n),this.update(Ev(this.state,e,n.trigger)))})}};function g6e(t,e,n,r=!1){return{...Rv(e,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...t}}function O6e(t){return{popupRef:c.createRef(),backdropRef:c.createRef(),internalBackdropRef:c.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:t,onOpenChange:void 0,onOpenChangeComplete:void 0}}function UH(t,e){const{children:n,open:r,defaultOpen:i=!1,onOpenChange:s,onOpenChangeComplete:o,disablePointerDismissal:a=!1,modal:l=!0,actionsRef:u,handle:f,triggerId:p,defaultTriggerId:g=null}=e,O=t==="drawer",y=t==="alert-dialog",b=y?!0:l,v=y||a,w=y?"alertdialog":"dialog",C=nc(!0),S={modal:b,disablePointerDismissal:v,nested:C!=null,role:w},A=sj((M,V)=>new m6e({open:i,openProp:r,activeTriggerId:g,triggerIdProp:p,...S},M,V),!0);A.useControlledProp("openProp",r),A.useControlledProp("triggerIdProp",p),A.useSyncedValues(S),A.useContextCallback("onOpenChange",s),A.useContextCallback("onOpenChangeComplete",o);const P=A.useState("open"),T=A.useState("mounted"),$=A.useState("payload");nG(A,P),Pv(A);const{forceUnmount:I}=Mv(P,A);c.useImperativeHandle(u,()=>({unmount:I,close:()=>A.setOpen(!1,_e(hv))}),[I,A]);const L=P||T;return m.jsxs(Ik.Provider,{value:A,children:[f&&m.jsx(Cv,{handle:f,store:A}),L&&m.jsx(h6e,{store:A,parentContext:C==null?void 0:C.context,isDrawer:O}),typeof n=="function"?n({payload:$}):n]})}const x2=c.forwardRef(function(e,n){const{render:r,className:i,style:s,forceRender:o=!1,...a}=e,l=nc(),u=l.useState("open"),f=l.useState("nested"),p=l.useState("mounted"),g={open:u,transitionStatus:l.useState("transitionStatus")};return He("div",e,{state:g,ref:[l.context.backdropRef,n],stateAttributesMapping:cv,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:o||!f})});x2.displayName="DialogBackdrop";const x6e="--nested-dialogs",y2=c.forwardRef(function(e,n){const{render:r,className:i,style:s,finalFocus:o,initialFocus:a,...l}=e,u=nc(),f=u.useState("descriptionElementId"),p=u.useState("disablePointerDismissal"),g=u.useState("floatingRootContext"),O=u.useState("popupProps"),y=u.useState("modal"),b=u.useState("mounted"),v=u.useState("nested"),w=u.useState("nestedOpenDialogCount"),C=u.useState("open"),S=u.useState("openMethod"),A=u.useState("titleElementId"),P=u.useState("transitionStatus"),T=u.useState("role"),$=g.useState("floatingId");u6e(),Hr({open:C,ref:u.context.popupRef,onComplete(){var Z,D;C&&((D=(Z=u.context).onOpenChangeComplete)==null||D.call(Z,!0))}});const I=a===void 0?eG(u.context.popupRef):a,L=w>0,M=u.useStateSetter("popupElement"),V=He("div",e,{state:{open:C,nested:v,transitionStatus:P,nestedDialogOpen:L},props:[O,{id:$,"aria-labelledby":A,"aria-describedby":f,role:T,...u1,hidden:!b,onKeyDown(Z){w8.has(Z.key)&&Z.stopPropagation()},style:{[x6e]:w}},l],ref:[n,u.context.popupRef,M],stateAttributesMapping:f6e});return m.jsx(x8,{context:g,openInteractionType:S,disabled:!b,closeOnFocusOut:!p,initialFocus:I,returnFocus:o,modal:y!==!1,restoreFocus:"popup",children:V})});y2.displayName="DialogPopup";const Eb=c.forwardRef(function(e,n){const{render:r,className:i,style:s,disabled:o=!1,nativeButton:a=!0,...l}=e,u=nc(),f=u.useState("open"),{getButtonProps:p,buttonRef:g}=Tr({disabled:o,native:a}),O={disabled:o};function y(b){f&&u.setOpen(!1,_e(DR,b.nativeEvent))}return He("button",e,{state:O,ref:[n,g],props:[{onClick:y},l,p]})});Eb.displayName="DialogClose";const Ab=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,...a}=e,l=nc(),u=Pn(o);return l.useSyncedValueWithCleanup("descriptionElementId",u),He("p",e,{ref:n,props:[{id:u},a]})});Ab.displayName="DialogDescription";const Pb=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,...a}=e,l=nc(),u=Pn(o);return l.useSyncedValueWithCleanup("titleElementId",u),He("h2",e,{ref:n,props:[{id:u},a]})});Pb.displayName="DialogTitle";const Lk=Ov(function(e,n){const{render:r,className:i,style:s,disabled:o=!1,nativeButton:a=!0,id:l,payload:u,handle:f,...p}=e,g=nc(!0),O=$v(f)??g;if(!O)throw new Error("Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.");const y=Pn(l),b=O.useState("floatingRootContext"),v=O.useState("isOpenedByTrigger",y),w=O.useState("triggerPopupId",y),C=c.useRef(null),{registerTrigger:S,isMountedByThisTrigger:A}=Av(y,C,O,{payload:u}),{getButtonProps:P,buttonRef:T}=Tr({disabled:o,native:a}),$=S0(b),I=jQ(()=>O.select("open"),V=>{O.set("openMethod",V)}),L={disabled:o,open:v},M=O.useState("triggerProps",A);return He("button",e,{state:L,ref:[T,n,S,C],props:[$.reference,M,I,{[MY]:"",id:y,"aria-haspopup":"dialog","aria-expanded":v,"aria-controls":w},p,P],stateAttributesMapping:i1})});Lk.displayName="DialogTrigger";const Nk=H2(function(e){return UH("dialog",e)});Nk.displayName="DialogRoot";function y6e(t){return UH("alert-dialog",t)}const b6e=Lk;function YH(t){return He(t.defaultTagName??"div",t,t)}const v6e="overflow-hidden rounded-lg bg-kumo-base shadow-xs ring ring-kumo-line",k6e="flex w-full flex-col overflow-hidden rounded-lg bg-kumo-elevated text-base ring ring-kumo-hairline",w6e="-my-2 flex items-center gap-2 bg-kumo-elevated p-4 text-base font-medium text-kumo-subtle",S6e="relative flex flex-col gap-2 overflow-hidden rounded-lg bg-kumo-base p-4 pr-3 text-inherit no-underline ring ring-kumo-fill";function C6e(t={}){return le(v6e)}function GH(t){return c.Children.toArray(t).some(e=>c.isValidElement(e)?e.type===Zk||e.type===Qk?!0:e.type===c.Fragment?GH(e.props.children):!1:!1)}const KH=c.forwardRef(function({children:e,className:n,render:r,...i},s){const o=GH(e),a={className:le(o?k6e:C6e(),n)};return YH({defaultTagName:"div",render:r,ref:s,props:ar(a,i,{children:e})})});function Qk({children:t,className:e,...n}){return m.jsx("div",{className:le(w6e,e),...n,children:t})}function Zk({children:t,className:e,...n}){return m.jsx("div",{className:le(S6e,e),...n,children:t})}KH.displayName="LayerCard";Qk.displayName="LayerCard.Secondary";Zk.displayName="LayerCard.Primary";const JH=Object.assign(KH,{Primary:Zk,Secondary:Qk}),E6e={size:{base:{classes:"sm:w-96",description:"Default dialog width (384px)"},sm:{classes:"sm:w-72",description:"Small dialog for simple confirmations (288px)"},lg:{classes:"sm:w-[32rem]",description:"Large dialog for complex content (512px)"},xl:{classes:"sm:w-[48rem]",description:"Extra large dialog for detailed views (768px)"}}},b2={size:"base",role:"dialog"},Mb=c.createContext("dialog");function $1(){return c.useContext(Mb)}function A6e({size:t=b2.size}={}){return le("shadow-m ring ring-kumo-line fixed top-8 left-1/2 sm:top-16 w-full max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-xl bg-kumo-base text-kumo-default duration-150 data-ending-style:scale-90 data-ending-style:opacity-0 data-starting-style:scale-90 data-starting-style:opacity-0",sr(E6e.size,t,b2.size).classes)}function P6e({className:t,children:e,style:n,size:r=b2.size,container:i}){const s=$1(),o=vu();return m.jsxs(O2,{container:i??o??void 0,children:[m.jsx(x2,{className:"fixed inset-0 bg-kumo-recessed opacity-80 transition-all duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0"}),m.jsx(JH,{render:m.jsx(y2,{}),className:le(A6e({size:r}),t),style:{transitionProperty:"scale, opacity",transitionTimingFunction:"var(--default-transition-timing-function)","--tw-shadow":"0 20px 25px -5px rgb(0 0 0 / 0.03), 0 8px 10px -6px rgb(0 0 0 / 0.03)",...n},children:e})]})}function eF(t){if(t.role==="alertdialog"){const{children:i,role:s,...o}=t;return m.jsx(Mb.Provider,{value:s,children:m.jsx(y6e,{...o,children:i})})}const{children:e,role:n=b2.role,...r}=t;return m.jsx(Mb.Provider,{value:n,children:m.jsx(Nk,{...r,children:e})})}eF.displayName="Dialog.Root";function tF({children:t,...e}){return $1()==="alertdialog"?m.jsx(b6e,{"data-kumo-component":"Dialog","data-kumo-part":"trigger",...e,children:t}):m.jsx(Lk,{"data-kumo-component":"Dialog","data-kumo-part":"trigger",...e,children:t})}tF.displayName="Dialog.Trigger";function nF({className:t,...e}){const n=($1()==="alertdialog",Pb);return m.jsx(n,{className:t,...e})}nF.displayName="Dialog.Title";function rF({className:t,...e}){const n=($1()==="alertdialog",Ab);return m.jsx(n,{className:t,...e})}rF.displayName="Dialog.Description";function iF({children:t,...e}){const n=($1()==="alertdialog",Eb);return m.jsx(n,{"data-kumo-component":"Dialog","data-kumo-part":"close",...e,children:t})}iF.displayName="Dialog.Close";const Zm=Object.assign(P6e,{Root:eF,Trigger:tF,Title:nF,Description:rF,Close:iF});function v2({title:t,children:e,width:n="sm:w-2xl"}){const{close:r}=cr();return m.jsx(Zm.Root,{open:!0,onOpenChange:i=>{i||r()},children:m.jsxs(Zm,{className:n,children:[m.jsxs("div",{className:"h-11 pl-4 pr-2 flex items-center justify-between border-b border-kumo-hairline",children:[m.jsx(Zm.Title,{className:"text-base font-semibold text-kumo-default",children:t}),m.jsx(Zm.Close,{render:i=>m.jsx(nt,{...i,variant:"ghost",size:"sm",shape:"square",icon:m.jsx(Us,{size:14}),"aria-label":"Close"})})]}),e]})})}function Qc({label:t,size:e="base",id:n,className:r,...i}){const s=c.useId(),o=n??s,a=m.jsx("select",{...i,id:o,className:le(_o({size:e}),"min-w-0",r)});return t?m.jsxs("div",{className:"grid gap-2",children:[m.jsx("label",{htmlFor:o,className:"text-base font-medium text-kumo-default",children:t}),a]}):a}function M6e({projectId:t}){const{data:e}=Q2e(t),n=n8e(),{close:r}=cr(),[i,s]=c.useState(""),[o,a]=c.useState("active"),[l,u]=c.useState(dH),[f,p]=c.useState(fH);if(c.useEffect(()=>{e&&(s(e.name),a(e.status),u(e.color),p(e.icon))},[e==null?void 0:e.id,e==null?void 0:e.name,e==null?void 0:e.status,e==null?void 0:e.color,e==null?void 0:e.icon]),!e)return m.jsx(v2,{title:"Project settings",width:"sm:w-md",children:m.jsx("div",{className:"p-4 text-sm text-kumo-subtle",children:"Loading…"})});const g=e,O=i!==g.name||o!==g.status||l!==g.color||f!==g.icon,y=i.trim().length>0;return m.jsx(v2,{title:`Settings · ${g.key}`,width:"sm:w-md",children:m.jsxs("form",{onSubmit:async b=>{b.preventDefault(),!(!O||!y)&&(await n.mutateAsync({id:g.id,fields:{name:i.trim(),status:o,color:l,icon:f}}),r())},className:"p-4 space-y-4",children:[m.jsx(mr,{autoFocus:!0,label:"Name",className:"w-full",value:i,onChange:b=>s(b.target.value)}),m.jsx(qH,{icon:f,color:l,onIconChange:p,onColorChange:u}),m.jsx(Qc,{label:"Status",className:"w-full",value:o,onChange:b=>a(b.target.value),children:RD.map(b=>m.jsxs("option",{value:b,children:[f0[b]," · ",BH[b]]},b))}),m.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[m.jsx(nt,{type:"button",onClick:r,children:"Cancel"}),m.jsx(nt,{type:"submit",variant:"primary",disabled:!O||!y||n.isPending,children:n.isPending?"Saving…":"Save"})]}),n.error&&m.jsx("div",{className:"text-xs text-kumo-danger",children:n.error.message})]})})}function T6e(){const[t,e]=c.useState(""),[n,r]=c.useState(""),[i,s]=c.useState("active"),[o,a]=c.useState(""),[l,u]=c.useState(dH),[f,p]=c.useState(fH),g=t8e(),{close:O}=cr(),y=Xl(),b=/^[A-Z][A-Z0-9_]{0,19}$/.test(t)&&n.trim().length>0;return m.jsx(v2,{title:"New project",width:"sm:w-md",children:m.jsxs("form",{onSubmit:async v=>{if(v.preventDefault(),!b)return;const w=await g.mutateAsync({key:t.trim(),name:n.trim(),status:i,color:l,icon:f,agentsMd:o.trim()});O(),y(`/p/${w.key}`)},className:"p-4 space-y-4",children:[m.jsx(mr,{autoFocus:!0,label:"Key (uppercase, e.g. BOT)",className:"w-full font-mono uppercase",value:t,onChange:v=>e(v.target.value.toUpperCase()),placeholder:"BOT",maxLength:20}),m.jsx(mr,{label:"Name",className:"w-full",value:n,onChange:v=>r(v.target.value),placeholder:"botnote"}),m.jsx(qH,{icon:f,color:l,onIconChange:p,onColorChange:u}),m.jsx(Qc,{label:"Status",className:"w-full",value:i,onChange:v=>s(v.target.value),children:RD.map(v=>m.jsxs("option",{value:v,children:[f0[v]," · ",BH[v]]},v))}),m.jsx(O8,{label:"AGENTS.md (optional)",className:"h-24 w-full resize-y py-1.5 font-mono text-xs leading-snug",value:o,onChange:v=>a(v.target.value),placeholder:`## Critical
152
152
  - ALWAYS run pnpm typecheck before commit.`}),m.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[m.jsx(nt,{type:"button",onClick:O,children:"Cancel"}),m.jsx(nt,{type:"submit",variant:"primary",disabled:!b||g.isPending,children:g.isPending?"Creating…":"Create project"})]}),g.error&&m.jsx("div",{className:"text-xs text-kumo-danger",children:g.error.message})]})})}const Vk=c.forwardRef(function(e,n){var O;const{render:r,className:i,style:s,disabled:o=!1,...a}=e,[l,u]=c.useState(void 0),f=((O=a5(!0))==null?void 0:O.disabled)||o,p=He("fieldset",e,{ref:n,state:{disabled:f},props:[{"aria-labelledby":l,disabled:f},a]}),g=c.useMemo(()=>({legendId:l,setLegendId:u,disabled:f}),[l,u,f]);return m.jsx(o5.Provider,{value:g,children:p})});Vk.displayName="FieldsetRoot";const L1=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,...a}=e,{disabled:l,setLegendId:u}=a5(),f=l5(o,u);return He("div",e,{state:{disabled:l},ref:n,props:[{id:f},a]})});L1.displayName="FieldsetLegend";const Dk=c.createContext(void 0);Dk.displayName="CheckboxGroupContext";function R6e(){return c.useContext(Dk)}function j6e(t){const{allValues:e=ir,value:n,onValueChange:r}=t,i=c.useRef(n),s=c.useRef(new Map),[o,a]=c.useState("mixed"),[l,u]=c.useState(()=>({registry:new Map})),f=n.length===e.length,p=n.length!==e.length&&n.length>0,g=Ee(r),O=Ee((v,w)=>{const C=l.registry,S=C.get(v);return S!=null&&S.includes(w)||(C.set(v,S?S.concat(w):[w]),u({registry:C})),()=>{const A=C.get(v);if(!(A!=null&&A.includes(w)))return;const P=A.filter(T=>T!==w);P.length===0?C.delete(v):C.set(v,P),u({registry:C})}}),y=c.useCallback(()=>({indeterminate:p,checked:f,"aria-controls":e.flatMap(v=>l.registry.get(v)??ir).join(" ")||void 0,onCheckedChange(v,w){const C=i.current,S=e.filter($=>s.current.get($)&&C.includes($)),A=e.filter($=>!s.current.get($)||C.includes($));if(C.length===A.length||C.length===0){n.length===A.length?g(S,w):g(A,w);return}let P="mixed",T=C;o==="mixed"?(P="on",T=A):o==="on"&&(P="off",T=S),g(T,w),w.isCanceled||a(P)}}),[e,f,l,p,g,o,n.length]),b=c.useCallback(v=>({checked:n.includes(v),onCheckedChange(w,C){const S=n.slice();w?S.push(v):S.splice(S.indexOf(v),1),g(S,C),C.isCanceled||(i.current=S,a("mixed"))}}),[g,n]);return c.useMemo(()=>({getParentProps:y,getChildProps:b,registerChildId:O,disabledStatesRef:s}),[y,b,O])}const sF=c.forwardRef(function(e,n){const{allValues:r,className:i,defaultValue:s,disabled:o=!1,id:a,onValueChange:l,render:u,value:f,style:p,...g}=e,{disabled:O,name:y,state:b,validation:v,setFilled:w,setDirty:C,validityData:S}=pi(),{labelId:A,registerControlId:P,getDescriptionProps:T}=Li(),{clearErrors:$,elementRef:I}=Fo(),L=O||o,[M,V]=Ji({controlled:f,default:s??ir,name:"CheckboxGroup",state:"value"}),Z=Ee((Q,F)=>{l==null||l(Q,F),!F.isCanceled&&V(Q)}),D=j6e({allValues:r,value:M,onValueChange:Z});Yl({id:null});const B=Pn(a),H=v.getInputControl,U=c.useMemo(()=>({get current(){return H()}}),[H]),q=Ee(()=>{const Q=I.current;if(!Q)return M;const F=new Set;for(const[N,z]of v.registeredInputs)z.value!==void 0&&N.checked&&CQ(N,Q)&&F.add(z.value);return M.filter(N=>F.has(N))});w0(U,B,M,q,!!y&&!L,y),Pe(()=>{w(M.length>0)},[M,w]),gs(M,()=>{y&&$(y);const Q=Array.isArray(S.initialValue)?S.initialValue:ir;C(!$Q(M,Q)),v.change(M)});const W={...b,disabled:L},X=c.useMemo(()=>({allValues:r,value:M,setValue:Z,parent:D,disabled:L,validation:v,registerControlId:P}),[r,M,Z,D,L,v,P]),R=He("div",e,{state:W,ref:n,props:[{id:a,role:"group","aria-labelledby":A},g,T],stateAttributesMapping:eo});return m.jsx(Dk.Provider,{value:X,children:R})});sF.displayName="CheckboxGroup";function oF(t,e,n,r=!0,i){const[s,o]=c.useState(),a=Pn(i?`${i}-label`:void 0),l=t??e??s;return Pe(()=>{const u=t||e||!r?void 0:I6e(n.current,a);s!==u&&o(u)}),l}function I6e(t,e){const n=$6e(t);if(n)return!n.id&&e&&(n.id=e),n.id||void 0}function $6e(t){if(!t)return;const e=t.parentElement;if(e&&e.tagName==="LABEL")return e;const n=t.id;if(n){const i=t.nextElementSibling;if(i&&i.htmlFor===n)return i}const r=t.labels;return r&&r[0]}function L6e(t){if(!t)return null;for(const e of t.elements){const n=e.tagName;if(n==="BUTTON"||n==="INPUT"){const r=e;if(r.type==="submit")return r}}return null}const N6e="data-checked",Q6e="data-unchecked";function aF(t){return{checked(e){return t.indeterminate?{}:e?{[N6e]:""}:{[Q6e]:""}},...eo}}const Hk=c.createContext(void 0);Hk.displayName="CheckboxRootContext";function Z6e(){const t=c.useContext(Hk);if(t===void 0)throw new Error("Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.");return t}const V6e="data-parent",Fk=c.forwardRef(function(e,n){const{checked:r,className:i,defaultChecked:s=!1,"aria-labelledby":o,disabled:a=!1,form:l,id:u,indeterminate:f=!1,inputRef:p,name:g,onCheckedChange:O,parent:y=!1,readOnly:b=!1,render:v,required:w=!1,uncheckedValue:C,value:S,nativeButton:A=!1,style:P,...T}=e,{clearErrors:$}=Fo(),{disabled:I,name:L,setDirty:M,setFilled:V,setFocused:Z,setTouched:D,state:B,validationMode:H,validityData:U,validation:q}=pi(),W=c5(),{labelId:X,registerControlId:R,getDescriptionProps:Q}=Li(),F=R6e(),N=(F==null?void 0:F.allValues)===void 0?void 0:F.parent,z=N!==void 0,J=I||W.disabled||(F==null?void 0:F.disabled)||a,K=L??g,ne=S??K,se=Pn(),ie=(F==null?void 0:F.registerControlId)!==R,he=Yl({id:u||void 0,enabled:ie}),Se=A?he:se;let Oe={};z&&(y?Oe=N.getParentProps():ne!==void 0&&(Oe=N.getChildProps(ne)));const{checked:be=r,indeterminate:me=f,onCheckedChange:ue,...ve}=Oe,xe=F==null?void 0:F.value,Ce=c.useRef(null),{getButtonProps:we,buttonRef:Le}=Tr({disabled:J,native:A}),Ie=(F==null?void 0:F.validation)??q,[Fe,Me]=Ji({controlled:ne!==void 0&&xe!==void 0&&!y?xe.includes(ne):be,default:s,name:"Checkbox",state:"checked"}),oe=z?!!be:Fe,ge=z&&me||f;w0(Ce,se,Fe,void 0,!F&&!J,g);const Y=N==null?void 0:N.registerChildId,G=c.useRef(null),de=Ie.registerInput,Ae=F?ne:void 0,Re=c.useCallback(et=>de(et,{controlRef:Ce,value:Ae}),[de,Ae]),Ge=ns(p,G,y?void 0:Re),dt=oF(o,X,G,!A,he);Pe(()=>{G.current&&(G.current.indeterminate=ge),F||V(Fe)},[Fe,ge,F,V]),gs(Fe,()=>{F||($(K),M(Fe!==U.initialValue),Ie.change(Fe))});const Te=ar({checked:Fe,disabled:J,form:l,name:y?void 0:K,id:A?void 0:he,required:w,ref:Ge,style:K?a1:ku,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(et){if(et.nativeEvent.defaultPrevented)return;if(b){et.preventDefault();return}const Yt=et.currentTarget.checked,Mt=_e(_n,et.nativeEvent);if(O==null||O(Yt,Mt),!Mt.isCanceled&&(ue==null||ue(Yt,Mt),!Mt.isCanceled&&(Me(Yt),ne!==void 0&&F!==void 0&&!y&&!z))){const Ht=Yt?[...F.value,ne]:F.value.filter(an=>an!==ne);F.setValue(Ht,Mt)}},onClick(et){et.stopPropagation()},onFocus(){var et;(et=Ce.current)==null||et.focus()}},S!==void 0?{value:(F?Fe&&S:S)||""}:Ut,Q,et=>Ie.getValidationProps(J,et));c.useEffect(()=>{if(!N||ne===void 0)return;const et=N.disabledStatesRef.current;return et.set(ne,J),()=>{et.delete(ne)}},[N,J,ne]);const Ke=c.useMemo(()=>({...B,checked:oe,disabled:J,readOnly:b,required:w,indeterminate:ge}),[B,oe,J,b,w,ge]),gt=aF(Ke),Pt=He("span",e,{state:Ke,ref:[Le,Ce,n],props:[{id:Se,role:"checkbox","aria-checked":ge?"mixed":oe,"aria-readonly":b||void 0,"aria-required":w||void 0,"aria-labelledby":dt,[V6e]:y?"":void 0,onFocus(){J||Z(!0)},onBlur(){const et=G.current;et&&(D(!0),Z(!1),H==="onBlur"&&Ie.commit(F?xe:et.checked))},onKeyDown(et){var Xt;if(et.key!=="Enter"||(et.preventBaseUIHandler(),et.defaultPrevented))return;const Yt=((Xt=G.current)==null?void 0:Xt.form)??null,Mt=et.currentTarget,Ht=et.nativeEvent,an=et.preventDefault,at=Ht.preventDefault;let ht=!1;et.preventDefault=()=>{ht=!0,an.call(et)},Ht.preventDefault=()=>{ht=!0,at.call(Ht)},at.call(Ht),un(Mt).queueMicrotask(()=>{var zt;et.preventDefault=an,Ht.preventDefault=at,ht||(zt=L6e(Yt))==null||zt.click()})},onClick(et){if(b||J)return;et.preventDefault();const Yt=G.current;Yt&&Rd(Yt,et)}},T,ve,we,Q,et=>Ie.getValidationProps(J,et)],stateAttributesMapping:gt}),jt=Pt.props.id;return Pe(()=>{if(!(!Y||y||ne===void 0||jt===void 0))return Y(ne,jt)},[Y,y,ne,jt]),m.jsxs(Hk.Provider,{value:Ke,children:[Pt,!Fe&&!F&&K&&!y&&C!==void 0&&m.jsx("input",{type:"hidden",form:l,name:K,value:C,disabled:J}),m.jsx("input",{...Te,suppressHydrationWarning:!0})]})});Fk.displayName="CheckboxRoot";const _k=c.forwardRef(function(e,n){const{render:r,className:i,style:s,keepMounted:o=!1,...a}=e,l=Z6e(),u=l.checked||l.indeterminate,{mounted:f,transitionStatus:p,setMounted:g}=Ks(u),O=c.useRef(null),y={...l,transitionStatus:p};Hr({batch:!0,enabled:!u,open:u,ref:O,onComplete(){u||g(!1)}});const b={...aF(l),...is},v=o||f,w=He("span",e,{ref:[n,O],state:y,stateAttributesMapping:b,props:a});return v?w:null});_k.displayName="CheckboxIndicator";const lF=c.createContext({controlFirst:!0}),cF=c.forwardRef(({className:t,checked:e,indeterminate:n,disabled:r,variant:i="default",label:s,labelTooltip:o,controlFirst:a=!0,onCheckedChange:l,required:u,name:f,...p},g)=>{{const y=!!s,b=!!p["aria-label"],v=!!p["aria-labelledby"];!y&&!b&&!v&&console.warn(`[Kumo Checkbox]: Checkbox must have an accessible name. Provide either:
153
153
  - label prop: <Checkbox label='Accept terms' />
154
154
  - aria-label: <Checkbox aria-label='Select item' />
155
155
  - aria-labelledby for custom label association
156
- Note: When used inside Checkbox.Group, label is optional`)}const O=m.jsx(Fk,{ref:g,"data-kumo-component":"Checkbox",name:f,checked:e,indeterminate:n,disabled:r,onCheckedChange:l,className:le("relative flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border-0 bg-kumo-base ring after:absolute after:-inset-x-3 after:-inset-y-2 focus:outline-none",s&&"mt-0.5",i==="error"?"ring-kumo-danger":"ring-kumo-hairline",!r&&"hover:ring-kumo-hairline focus:ring-2 focus:ring-kumo-focus focus-visible:ring-2 focus-visible:ring-kumo-brand","data-[checked]:bg-kumo-contrast data-[checked]:ring-kumo-contrast data-[indeterminate]:bg-kumo-contrast data-[indeterminate]:ring-kumo-contrast",r&&"cursor-not-allowed opacity-50",t),...p,children:m.jsx(_k,{keepMounted:!0,className:"flex items-center justify-center text-kumo-inverse data-[unchecked]:invisible",render:(y,b)=>m.jsx("span",{...y,children:b.indeterminate?m.jsx(Kv,{weight:"bold",size:12}):m.jsx(Fr,{weight:"bold",size:12})})})});return s?m.jsx(u5,{className:"inline-flex",children:m.jsxs(d5,{className:le("!m-0 inline-flex !min-h-0 items-start gap-2 !text-base",a?"flex-row":"flex-row-reverse justify-end",r?"cursor-not-allowed":"cursor-pointer"),children:[O,m.jsx(g8,{showOptional:u===!1,tooltip:o,asContent:!0,children:s})]})}):O});cF.displayName="Checkbox";const uF=c.forwardRef(({className:t,checked:e,indeterminate:n,disabled:r,variant:i="default",label:s,value:o,onCheckedChange:a,name:l},u)=>{const{controlFirst:f}=c.useContext(lF);return m.jsxs("label",{"data-kumo-component":"Checkbox","data-kumo-part":"item-label",className:le("relative m-0 inline-flex items-start gap-2",!f&&"flex-row-reverse justify-end",r?"cursor-not-allowed opacity-50":"cursor-pointer",t),children:[m.jsx(Fk,{ref:u,"data-kumo-component":"Checkbox","data-kumo-part":"item",value:o,name:l,checked:e,indeterminate:n,disabled:r,onCheckedChange:a,className:le("peer relative mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border-0 bg-kumo-base ring after:absolute after:-inset-x-3 after:-inset-y-2",i==="error"?"ring-kumo-danger":"ring-kumo-hairline",!r&&"group-hover:ring-kumo-hairline hover:ring-kumo-hairline focus:ring-2 focus:ring-kumo-focus focus-visible:ring-2 focus-visible:ring-kumo-brand","data-[checked]:bg-kumo-contrast data-[checked]:ring-kumo-contrast data-[indeterminate]:bg-kumo-contrast data-[indeterminate]:ring-kumo-contrast"),children:m.jsx(_k,{keepMounted:!0,className:"flex items-center justify-center text-kumo-inverse data-[unchecked]:invisible",render:(p,g)=>m.jsx("span",{...p,children:g.indeterminate?m.jsx(Kv,{weight:"bold",size:12}):m.jsx(Fr,{weight:"bold",size:12})})})}),m.jsx("span",{className:"text-base text-kumo-default",children:s})]})});uF.displayName="Checkbox.Item";function dF({children:t,className:e}){return m.jsx(L1,{className:le("text-base font-medium text-kumo-default",e),children:t})}dF.displayName="Checkbox.Legend";function D6e({legend:t,children:e,error:n,description:r,defaultValue:i,value:s,onValueChange:o,allValues:a,disabled:l,controlFirst:u=!0,className:f}){return m.jsx(lF.Provider,{value:{controlFirst:u},children:m.jsx(sF,{defaultValue:i,value:s,onValueChange:o,allValues:a,disabled:l,children:m.jsxs(Vk,{className:le("flex flex-col gap-4 p-0",f),children:[t&&m.jsx(L1,{className:"text-base font-medium text-kumo-default",children:t}),m.jsx("div",{className:"flex flex-col gap-2",children:e}),n&&m.jsx("p",{className:"text-sm text-kumo-danger",children:n}),r&&m.jsx("p",{className:"text-sm text-kumo-subtle",children:r})]})})})}const zk=Object.assign(cF,{Item:uF,Group:D6e,Legend:dF});zk.displayName="Checkbox";function H6e(){const[,t]=c.useState({});return c.useCallback(()=>{t({})},[])}function RM(t){const e=hi(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=on(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r;return(Ud(n)!==s||Ud(r)!==o)&&(n=s,r=o),{width:n,height:r}}const F6e="data-composite-item-active";function _6e(t){const{loopFocus:e=!0,orientation:n="both",grid:r,onLoop:i,direction:s,highlightedIndex:o,onHighlightedIndexChange:a,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:f,disabledIndices:p,modifierKeys:g=ir}=t,[O,y]=c.useState(0),b=r!=null,v=c.useRef(null),w=ns(v,l),C=c.useRef([]),S=c.useRef(!1),A=c.useRef(null),P=o??O,T=Ee((M,V=!1)=>{if(A.current=C.current[M]??null,(a??y)(M),V){const Z=C.current[M];DA(v.current,Z,s,n)}}),$=Ee(M=>{var B;if(M.size===0)return;if(S.current){const H=C.current,U=H.indexOf(A.current);if(U===-1){const q=H[P];!q||Tl(H,P,p)?T(z6e(H,p)):A.current=q}else U!==P&&T(U);return}S.current=!0;const V=Array.from(M.keys()),Z=V.find(H=>H==null?void 0:H.hasAttribute("data-composite-item-active"))??null,D=Z?((B=M.get(Z))==null?void 0:B.index)??-1:-1;if(D!==-1)T(D);else if(Tl(V,P,p)){const H=Cr(V,{disabledIndices:p});Ml(V,H)||T(H)}DA(v.current,Z,s,n)});Pe(()=>{if(p==null||o!=null||!S.current)return;const M=C.current;if(Tl(M,P,p)){const V=Cr(M,{disabledIndices:p});Ml(M,V)||T(V)}},[p,o,P,C,T]);const I=Ee((M,V,Z)=>i?i(M,V,Z,C):Z),L=Ee(M=>{const V=M.key==="Home"||M.key==="End";if(!w8.has(M.key)||!u&&V||B6e(M,g)||!v.current)return;const Z=s==="rtl",D=Z?Gy:Ky,B=Z?Ky:Gy,H=n==="vertical"?WQ:D,U=n==="vertical"?XQ:B,q=ln(M.nativeEvent);if(q!=null&&VA(q)&&!k5(q)){const N=q.selectionStart,z=q.selectionEnd,J=q.value;if(N==null||M.shiftKey||N!==z||M.key!==U&&N<J.length||M.key!==H&&N>0)return}let W=P;const X=zm(C,p),R=Bx(C,p);r!=null&&(W=r({disabledIndices:p,elementsRef:C,event:M,highlightedIndex:P,loopFocus:e,maxIndex:R,minIndex:X,onLoop:I,orientation:n,rtl:Z}));const Q=n!=="vertical"&&M.key===D||n!=="horizontal"&&M.key==="ArrowDown",F=n!=="vertical"&&M.key===B||n!=="horizontal"&&M.key==="ArrowUp";u&&(M.key==="Home"?W=X:M.key==="End"&&(W=R)),W===P&&(Q||F)&&(e&&W===R&&Q?(W=X,i&&(W=i(M,P,W,C))):e&&W===X&&F?(W=R,i&&(W=i(M,P,W,C))):W=Cr(C.current,{startingIndex:W,decrement:F,disabledIndices:p})),W!==P&&!Ml(C.current,W)&&(f&&M.stopPropagation(),(b||V||Q||F)&&M.preventDefault(),T(W,!0),queueMicrotask(()=>{var N;(N=C.current[W])==null||N.focus()}))});return{props:{ref:w,onFocus(M){const V=v.current,Z=ln(M.nativeEvent);!V||Z==null||!VA(Z)||Z.setSelectionRange(0,Z.value.length)},onKeyDown:L},highlightedIndex:P,onHighlightedIndexChange:T,elementsRef:C,onMapChange:$,relayKeyboardEvent:L}}function z6e(t,e){let n=-1;for(let r=0;r<t.length;r+=1){const i=t[r];if(!(!i||Tl(t,r,e))){if(i.hasAttribute("data-composite-item-active"))return r;n===-1&&(n=r)}}return Math.max(n,0)}function B6e(t,e){for(const n of oce)if(!e.includes(n)&&t.getModifierState(n))return!0;return!1}function X6e(t){const{render:e,className:n,style:r,refs:i=ir,props:s=ir,state:o=Ut,stateAttributesMapping:a,highlightedIndex:l,onHighlightedIndexChange:u,orientation:f,grid:p,loopFocus:g,onLoop:O,enableHomeAndEndKeys:y,onMapChange:b,stopEventPropagation:v=!0,rootRef:w,disabledIndices:C,modifierKeys:S,highlightItemOnHover:A=!1,tag:P="div",...T}=t,{props:$,highlightedIndex:I,onHighlightedIndexChange:L,elementsRef:M,onMapChange:V,relayKeyboardEvent:Z}=_6e({grid:p,loopFocus:g,onLoop:O,orientation:f,highlightedIndex:l,onHighlightedIndexChange:u,rootRef:w,stopEventPropagation:v,enableHomeAndEndKeys:y,direction:Aa(),disabledIndices:C,modifierKeys:S}),D=He(P,t,{state:o,ref:i,props:[$,...s,T],stateAttributesMapping:a}),B=c.useMemo(()=>({highlightedIndex:I,onHighlightedIndexChange:L,highlightItemOnHover:A,relayKeyboardEvent:Z}),[I,L,A,Z]);return m.jsx(g5.Provider,{value:B,children:m.jsx(C0,{elementsRef:M,onMapChange:H=>{b==null||b(H),V(H)},children:D})})}function W6e(){return qt}function q6e(){return!1}function U6e(){return!0}function Y6e(){return D2.useSyncExternalStore(W6e,q6e,U6e)}function G6e(t){const{script:e}=t,{nonce:n}=l3();return Y6e()?m.jsx("script",{nonce:n,dangerouslySetInnerHTML:{__html:e},suppressHydrationWarning:!0}):null}const Bk=c.createContext(void 0);Bk.displayName="TabsRootContext";function Xk(){const t=c.useContext(Bk);if(t===void 0)throw new Error("Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.");return t}const K6e="data-activation-direction",z8={tabActivationDirection:t=>({[K6e]:t})},fF=c.forwardRef(function(e,n){const{className:r,defaultValue:i=0,onValueChange:s,orientation:o="horizontal",render:a,value:l,style:u,...f}=e,p=e.defaultValue!==void 0,g=c.useRef([]),[O,y]=c.useState(()=>new Map),[b,v]=Ji({controlled:l,default:i,name:"Tabs",state:"value"}),w=l!==void 0,[C,S]=c.useState(()=>new Map),A=c.useRef(void 0),P=c.useCallback(ne=>Tb(C,ne),[C]),[T,$]=c.useState(()=>({previousValue:b,tabActivationDirection:"none"})),{previousValue:I,tabActivationDirection:L}=T;let M=L,V=!1;I!==b&&(M=jM(I,b,o,C),V=I!=null&&b!=null&&P(b)==null);const Z=V?I:b,D=I!==Z||L!==M;Pe(()=>{D&&$({previousValue:Z,tabActivationDirection:M})},[Z,D,M]);const B=Ee((ne,se)=>{se.activationDirection=jM(b,ne,o,C),s==null||s(ne,se),!se.isCanceled&&v(ne)}),H=Ee((ne,se)=>{s==null||s(ne,_e(se,void 0,void 0,{activationDirection:"none"}))}),U=Ee((ne,se)=>(y(ie=>{const he=new Map(ie);return he.set(ne,se),he}),()=>{y(ie=>{if(ie.get(ne)!==se)return ie;const he=new Map(ie);return he.delete(ne),he})})),q=c.useCallback(ne=>O.get(ne),[O]),W=c.useCallback(ne=>{for(const se of C.values())if(ne===se.value)return se.id},[C]),X=c.useMemo(()=>({getTabElementBySelectedValue:P,getTabIdByPanelValue:W,getTabPanelIdByValue:q,onValueChange:B,orientation:o,registerMountedTabPanel:U,setTabMap:S,tabActivationDirection:M,value:b}),[P,W,q,B,o,U,S,M,b]),R=c.useMemo(()=>{for(const ne of C.values())if(ne.value===b)return ne},[C,b]),Q=c.useMemo(()=>{for(const ne of C.values())if(!ne.disabled)return ne.value},[C]),F=c.useRef(!p),N=c.useRef(i),z=c.useRef(p),J=c.useRef(!1);Pe(()=>{var Se;if(w)return;function ne(Oe,be){v(Oe),$({previousValue:Oe,tabActivationDirection:"none"}),H(Oe,be),F.current=!1}if(C.size===0){J.current&&b!==null&&!((Se=A.current)!=null&&Se.isConnected)&&ne(null,$9);return}J.current=!0,A.current=C.keys().next().value;const se=R==null?void 0:R.disabled,ie=R==null&&b!==null;if(!se&&b===N.current&&(z.current=!1),z.current&&se&&b===N.current)return;const he=F.current;if(se||ie){const Oe=Q??null;if(b===Oe){F.current=!1;return}let be=$9;he?be=L9:se&&(be=_R),ne(Oe,be);return}he&&R!=null&&(H(b,L9),F.current=!1)},[Q,w,H,R,v,C,b]);const K=He("div",e,{state:{orientation:o,tabActivationDirection:M},ref:n,props:f,stateAttributesMapping:z8});return m.jsx(Bk.Provider,{value:X,children:m.jsx(C0,{elementsRef:g,children:K})})});fF.displayName="TabsRoot";function Tb(t,e){for(const[n,r]of t.entries())if(e===r.value)return n;return null}function jM(t,e,n,r){if(t==null||e==null)return"none";const[i,s,o]=n==="horizontal"?["left","left","right"]:["top","up","down"],a=Tb(r,t),l=Tb(r,e);if(a==null||l==null)return a!==l&&(typeof t=="number"||typeof t=="string")&&typeof t==typeof e?e>t?o:s:"none";const u=a.getBoundingClientRect()[i],f=l.getBoundingClientRect()[i];return f<u?s:f>u?o:"none"}const Wk=c.createContext(void 0);Wk.displayName="TabsListContext";function hF(){const t=c.useContext(Wk);if(t===void 0)throw new Error("Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.");return t}const pF=c.forwardRef(function(e,n){const{className:r,disabled:i=!1,render:s,value:o,id:a,nativeButton:l=!0,style:u,...f}=e,{value:p,getTabPanelIdByValue:g,onValueChange:O,orientation:y,tabActivationDirection:b}=Xk(),{activateOnFocus:v,registerTabResizeObserverElement:w,tabsListElement:C}=hF(),{highlightedIndex:S,onHighlightedIndexChange:A}=v8(),P=Pn(a),T=c.useMemo(()=>({disabled:i,id:P,value:o}),[i,P,o]),{compositeProps:$,compositeRef:I,index:L}=PH({metadata:T}),M=o===p,V=c.useRef(!1),Z=c.useRef(null),D=Ee(N=>{var z;(z=Z.current)==null||z.call(Z),Z.current=N?w(N):null});Pe(()=>{if(V.current){V.current=!1;return}if(!(M&&L>-1&&S!==L))return;const N=C;if(N!=null){const z=Gn(Ct(N));if(z&&Ue(N,z))return}i||A(L)},[M,L,S,A,i,C]);const{getButtonProps:B,buttonRef:H}=Tr({disabled:i,native:l,focusableWhenDisabled:!0}),U=g(o),q=c.useRef(!1),W=c.useRef(!1);function X(N){O(o,_e(_n,N.nativeEvent,void 0,{activationDirection:"none"}))}function R(N){M||i||X(N)}function Q(N){M||i||v&&(!q.current||W.current)&&X(N)}function F(N){if(M||i)return;q.current=!0,W.current=N.button===0;const z=Ct(N.currentTarget);function J(){q.current=!1,W.current=!1,z.removeEventListener("pointerup",J),z.removeEventListener("pointercancel",J)}z.addEventListener("pointerup",J),z.addEventListener("pointercancel",J)}return He("button",e,{state:{disabled:i,active:M,orientation:y,tabActivationDirection:b},ref:[n,H,I,D],props:[$,{role:"tab","aria-controls":U,"aria-selected":M,id:P,onClick:R,onFocus:Q,onPointerDown:F,[F6e]:M?"":void 0,onKeyDownCapture(){V.current=!0}},f,B],stateAttributesMapping:z8})});pF.displayName="TabsTab";const J6e="--active-tab-left",eOe="--active-tab-right",tOe="--active-tab-top",nOe="--active-tab-bottom",rOe="--active-tab-width",iOe="--active-tab-height";var IM;const sOe={...z8,activeTabPosition:()=>null,activeTabSize:()=>null},$M=2,mF=c.forwardRef(function(e,n){const{className:r,render:i,renderBeforeHydration:s=!1,style:o,...a}=e,{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:f,value:p}=Xk(),{tabsListElement:g,registerIndicatorUpdateListener:O}=hF(),y=H6e();c.useEffect(()=>O(y),[O,y]);let b=0,v=0,w=0,C=0,S=0,A=0,P=!1;if(p!=null&&g!=null){const M=l(p);if(M!=null){P=!0;const{width:V,height:Z}=RM(M),{width:D,height:B}=RM(g),H=M.getBoundingClientRect(),U=g.getBoundingClientRect(),q=D>0?U.width/D:1,W=B>0?U.height/B:1,X=oOe(M,g);b=X.left,w=X.top;const R=(H.left-U.left)/q+g.scrollLeft-g.clientLeft,Q=(H.top-U.top)/W+g.scrollTop-g.clientTop,F=aOe(M);Math.abs(R-F.x-b)<=$M&&Math.abs(Q-F.y-w)<=$M&&(b=R,w=Q),S=V,A=Z,v=g.scrollWidth-b-S,C=g.scrollHeight-w-A}}const T=P?{left:b,right:v,top:w,bottom:C}:null,$=P?{width:S,height:A}:null,I=P?{[J6e]:`${b}px`,[eOe]:`${v}px`,[tOe]:`${w}px`,[nOe]:`${C}px`,[rOe]:`${S}px`,[iOe]:`${A}px`}:void 0,L=He("span",e,{state:{orientation:u,activeTabPosition:T,activeTabSize:$,tabActivationDirection:f},ref:n,props:[{role:"presentation",style:I,hidden:!(P&&S>0&&A>0)},a,{suppressHydrationWarning:!0}],stateAttributesMapping:sOe});return p==null?null:m.jsxs(c.Fragment,{children:[L,s&&(IM||(IM=m.jsx(G6e,{script:""})))]})});mF.displayName="TabsIndicator";function oOe(t,e){const n=LM(t),r=LM(e);let i=n.left-r.left-e.clientLeft,s=n.top-r.top-e.clientTop,o=Ws(t);for(;on(o)&&o!==e&&!Io(o);)i-=o.scrollLeft,s-=o.scrollTop,o=Ws(o);return{left:i,top:s}}function LM(t){let e=0,n=0,r=t;for(;r!=null;){e+=r.offsetLeft,n+=r.offsetTop;const i=r.offsetParent;i!=null&&(e+=i.clientLeft,n+=i.clientTop),r=i}return{left:e,top:n}}function aOe(t){const e=un(t).getComputedStyle(t),{x:n,y:r}=VD(t,e);let i=n,s=r;const{translate:o}=e;if(o&&o!=="none"){const a=o.split(" ");i+=NM(a[0],t.offsetWidth),s+=NM(a[1],t.offsetHeight)}return{x:i,y:s}}function NM(t,e){if(!t)return 0;const n=parseFloat(t);return Number.isFinite(n)?t.endsWith("%")?n/100*e:n:0}const gF=c.forwardRef(function(e,n){const{activateOnFocus:r=!1,className:i,loopFocus:s=!0,render:o,style:a,...l}=e,{orientation:u,setTabMap:f,tabActivationDirection:p}=Xk(),[g,O]=c.useState(0),[y,b]=c.useState(null),v=c.useRef(new Set),w=c.useRef(new Set),C=c.useRef(null);Pe(()=>{if(typeof ResizeObserver>"u")return;const I=new ResizeObserver(()=>{v.current.forEach(L=>{L()})});return C.current=I,y&&I.observe(y),w.current.forEach(L=>{I.observe(L)}),()=>{I.disconnect(),C.current=null}},[y]);const S=Ee(I=>(v.current.add(I),()=>{v.current.delete(I)})),A=Ee(I=>{var L;return w.current.add(I),(L=C.current)==null||L.observe(I),()=>{var M;w.current.delete(I),(M=C.current)==null||M.unobserve(I)}}),P={orientation:u,tabActivationDirection:p},T={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},$=c.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:S,registerTabResizeObserverElement:A,tabsListElement:y}),[r,S,A,y]);return m.jsx(Wk.Provider,{value:$,children:m.jsx(X6e,{render:o,className:i,style:a,state:P,refs:[n,b],props:[T,l],stateAttributesMapping:z8,highlightedIndex:g,enableHomeAndEndKeys:!0,loopFocus:s,orientation:u,onHighlightedIndexChange:O,onMapChange:f,disabledIndices:ir})})});gF.displayName="TabsList";const QM={variant:"segmented",size:"base"},lOe={scrollStart:"Scroll tabs left",scrollEnd:"Scroll tabs right"};function rc({tabs:t,value:e,selectedValue:n,onValueChange:r,activateOnFocus:i,className:s,listClassName:o,indicatorClassName:a,labels:l,variant:u=QM.variant,size:f=QM.size}){var I;const p=t??[];if(p.length===0)return null;const g=(I=p[0])==null?void 0:I.value,O=e!==void 0,y={value:O?e:void 0,defaultValue:O?void 0:n??g},b=u==="segmented",v=u==="underline",w=f==="sm",C={...lOe,...l},{ref:S,isOverflowing:A,canScrollStart:P,canScrollEnd:T}=dOe(!0,p.map(L=>L.value).join("|")),$=uOe(S,A);return m.jsxs(fF,{...y,className:le("relative isolate min-w-0 font-medium",b&&(w?"rounded-md":"rounded-lg")+" ring ring-kumo-hairline/70",s),onValueChange:L=>{r==null||r(String(L))},children:[b&&m.jsx("div",{className:le("absolute inset-x-0 top-1/2 z-0 -translate-y-1/2 rounded-lg bg-kumo-recessed",w?"h-6.5":"h-9")}),m.jsxs(gF,{ref:S,activateOnFocus:i,"data-overflowing":A?"":void 0,"data-overflow-start":P?"":void 0,"data-overflow-end":T?"":void 0,...$(),className:le("kumo-tabs-list relative flex min-w-0 shrink scroll-px-(--scroll-fade-width) items-stretch overflow-x-auto overflow-y-hidden [--scroll-fade-width:3rem]",b&&"rounded-lg bg-kumo-recessed px-0.5",b&&(w?"h-6.5 rounded-md":"h-9"),A&&"cursor-grab active:cursor-grabbing",v&&"gap-4 border-b border-kumo-hairline pb-2",v&&(w?"h-6.5":"h-7.5"),o),children:[p.map(L=>m.jsx(pF,{"data-kumo-component":"Tabs","data-kumo-part":"tab",value:L.value,render:L.render,nativeButton:L.nativeButton,onClick:M=>{M.currentTarget.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},className:le("relative z-2 flex items-center rounded bg-transparent whitespace-nowrap focus:ring-kumo-focus/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-kumo-brand",A?"cursor-grab active:cursor-grabbing":"cursor-pointer",w?"text-xs":"text-base",b&&"my-0.5 text-kumo-subtle hover:text-kumo-default focus-visible:ring-inset aria-selected:text-kumo-default",b&&(w?"rounded-sm px-2":"rounded-md px-2.5"),v&&"text-kumo-subtle hover:bg-kumo-tint hover:text-kumo-default aria-selected:font-medium aria-selected:text-kumo-default aria-selected:hover:bg-kumo-tint",v&&(w?"px-1.5 py-2.5":"px-2 py-3"),L.className),children:L.label},L.value)),m.jsx(mF,{render:L=>m.jsx("div",{...L,className:le("absolute left-0 z-1","w-(--active-tab-width) translate-x-(--active-tab-left) transition-all duration-200","data-[rendered=false]:scale-90 data-[rendered=false]:opacity-0",b&&le("top-(--active-tab-top) h-(--active-tab-height) bg-kumo-base shadow-sm ring ring-kumo-line",w?"rounded":"rounded-md"),v&&"bottom-0 h-0.5 bg-kumo-brand",a)})})]}),b&&m.jsxs(m.Fragment,{children:[m.jsx(ZM,{side:"start",visible:P,variant:u,size:f,label:C.scrollStart,onClick:()=>VM(S,"start")}),m.jsx(ZM,{side:"end",visible:T,variant:u,size:f,label:C.scrollEnd,onClick:()=>VM(S,"end")})]})]})}function ZM({side:t,visible:e,variant:n,size:r,label:i,onClick:s}){const o=t==="start",a=n==="segmented";return m.jsx("button",{type:"button","data-kumo-component":"Tabs","data-kumo-part":"overflow-control","data-side":t,"aria-label":i,"aria-hidden":!e,tabIndex:e?0:-1,onClick:s,className:le("absolute inset-y-0 z-3 flex items-center border-0 bg-transparent p-0 transition-opacity duration-150 focus:outline-none focus-visible:[&>span]:ring-2 focus-visible:[&>span]:ring-kumo-brand",o?"left-0 justify-start bg-linear-to-r":"right-0 justify-end bg-linear-to-l",e?"pointer-events-auto opacity-100":"pointer-events-none opacity-0",a?"from-kumo-recessed via-kumo-recessed/95 to-transparent":"from-kumo-base via-kumo-base/95 to-transparent",a&&(r==="sm"?"w-8 rounded-md":"w-10 rounded-lg"),!a&&"w-8"),children:m.jsx("span",{className:le("flex items-center justify-center text-kumo-subtle transition-colors hover:text-kumo-default",r==="sm"?"size-5":"size-6",a?r==="sm"?"rounded-sm":"rounded-md":"rounded",o?"ml-1":"mr-1"),children:m.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"size-3.5","aria-hidden":"true",children:m.jsx("path",{d:o?"M9.25 4.25L5.75 8L9.25 11.75":"M6.75 4.25L10.25 8L6.75 11.75",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})})})}function VM(t,e){const n=t.current;if(!n)return;const r=Array.from(n.querySelectorAll('[data-kumo-part="tab"]')),i=cOe(n.clientWidth,r);n.scrollBy({left:e==="start"?-i:i,behavior:"smooth"})}function cOe(t,e){let n=0;for(const r of e){const i=r.offsetWidth;if(n+i>t)return n||t;n+=i}return Math.max(80,Math.floor(t*.8))}function uOe(t,e){const n=c.useRef(null),r=c.useRef(!1);return()=>({onPointerDownCapture:i=>{const s=t.current;!s||!e||i.pointerType!=="mouse"||i.button!==0||(n.current={pointerId:i.pointerId,startX:i.clientX,scrollLeft:s.scrollLeft,dragging:!1},r.current=!1)},onPointerMoveCapture:i=>{const s=t.current,o=n.current;if(!s||!e||!o||o.pointerId!==i.pointerId)return;const a=i.clientX-o.startX;if(!o.dragging){if(Math.abs(a)<=3)return;o.dragging=!0,r.current=!0,s.setPointerCapture(i.pointerId)}i.preventDefault(),s.scrollLeft=o.scrollLeft-a},onPointerUpCapture:i=>{const s=t.current,o=n.current;!s||!o||o.pointerId!==i.pointerId||(n.current=null,s.hasPointerCapture(i.pointerId)&&s.releasePointerCapture(i.pointerId),r.current&&window.setTimeout(()=>{r.current=!1},0))},onPointerCancelCapture:i=>{const s=t.current,o=n.current;!s||!o||o.pointerId!==i.pointerId||(n.current=null,s.hasPointerCapture(i.pointerId)&&s.releasePointerCapture(i.pointerId))},onClickCapture:i=>{r.current&&(i.preventDefault(),i.stopPropagation(),r.current=!1)}})}function dOe(t,e){const n=c.useRef(null),[r,i]=c.useState({isOverflowing:!1,canScrollStart:!1,canScrollEnd:!1});return c.useLayoutEffect(()=>{const s=n.current;s&&i(o=>DM(s,o))},[t,e]),c.useEffect(()=>{const s=n.current;if(!s)return;const o=()=>{i(u=>DM(s,u))},a=new ResizeObserver(o);a.observe(s);const l=new MutationObserver(o);return l.observe(s,{childList:!0,characterData:!0,subtree:!0}),s.addEventListener("scroll",o,{passive:!0}),o(),()=>{a.disconnect(),l.disconnect(),s.removeEventListener("scroll",o)}},[t]),{ref:n,...r}}function DM(t,e){const n=Math.max(0,t.scrollWidth-t.clientWidth),r=Math.min(Math.max(0,t.scrollLeft),n),i={isOverflowing:n>1,canScrollStart:r>1,canScrollEnd:n-r>1};return e.isOverflowing===i.isOverflowing&&e.canScrollStart===i.canScrollStart&&e.canScrollEnd===i.canScrollEnd?e:i}function fOe({initialProjectId:t,initialKind:e,initialParentId:n}){const{data:r}=Qi(),[i,s]=c.useState(e??"task"),[o,a]=c.useState(t??""),[l,u]=c.useState(""),[f,p]=c.useState(""),[g,O]=c.useState(""),[y,b]=c.useState(""),[v,w]=c.useState("none"),[C,S]=c.useState("none"),[A,P]=c.useState(1),[T,$]=c.useState("scheduled"),[I,L]=c.useState(!1),[M,V]=c.useState(n??""),Z=TD(),D=MD(),{close:B}=cr(),{open:H}=ro(),U=r==null?void 0:r.find(Q=>Q.id===o),q=i==="note",W=q||!!n,{data:X}=ok(W&&o?o:void 0,["task"]),R=o.length>0&&(q?l.trim().length>0||f.trim().length>0:l.trim().length>0&&(C==="none"||y.length>0));return m.jsx(v2,{title:"Quick create",width:"sm:w-xl",children:m.jsxs("form",{onSubmit:async Q=>{if(Q.preventDefault(),!R)return;const F=l.trim(),N=g.split(",").map(J=>J.trim()).filter(Boolean),z=i==="task"?await Z.mutateAsync({kind:"task",projectId:o,title:F,body:f.trim(),tags:N,actorKind:"human",dueAt:y?new Date(y).toISOString():null,priority:v,parentId:M||null}):await Z.mutateAsync({kind:"note",projectId:o,title:F||null,body:f.trim(),tags:N,actorKind:"human",pinned:I,parentId:M||null});i==="task"&&C!=="none"&&await D.mutateAsync({taskId:z.id,input:{preset:C,interval:A,anchor:T,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,allDay:!0}}),B(),H(z.id)},className:"p-4 space-y-3",children:[m.jsxs("div",{className:"flex gap-2",children:[m.jsx(rc,{variant:"segmented",tabs:c8e.map(Q=>({value:Q,label:m.jsx("span",{className:"capitalize",children:p2[Q]})})),value:i,onValueChange:Q=>s(Q),className:"shrink-0"}),m.jsxs(Qc,{"aria-label":"Project",className:"flex-1",value:o,onChange:Q=>a(Q.target.value),children:[m.jsx("option",{value:"",children:"— pick a project —"}),r==null?void 0:r.map(Q=>m.jsxs("option",{value:Q.id,children:[Q.key," · ",Q.name]},Q.id))]})]}),m.jsx(mr,{autoFocus:!0,"aria-label":"Title",className:"w-full",placeholder:q?"Title (optional)":"Title",value:l,onChange:Q=>u(Q.target.value)}),m.jsx(O8,{"aria-label":"Body",className:"h-32 w-full resize-y py-1.5 font-mono text-xs leading-snug",placeholder:"Body (Markdown, optional)",value:f,onChange:Q=>p(Q.target.value)}),m.jsxs("div",{className:"flex flex-wrap gap-2",children:[m.jsx(mr,{"aria-label":"Tags",className:"min-w-48 flex-1",placeholder:"Tags (comma-separated, optional)",value:g,onChange:Q=>O(Q.target.value)}),i==="task"&&m.jsxs(m.Fragment,{children:[m.jsx(mr,{type:"date","aria-label":"Due date",className:"flex-1 sm:w-36 sm:flex-none",value:y,onChange:Q=>b(Q.target.value),title:"Due date"}),m.jsx(Qc,{"aria-label":"Priority",className:"flex-1 sm:w-36 sm:flex-none",value:v,onChange:Q=>w(Q.target.value),title:"Priority",children:jD.map(Q=>m.jsx("option",{value:Q,children:xu[Q]},Q))})]})]}),i==="task"&&m.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_84px_132px] gap-2",children:[m.jsxs(Qc,{"aria-label":"Repeat",value:C,onChange:Q=>S(Q.target.value),title:"Repeat",children:[m.jsx("option",{value:"none",children:"Repeat: none"}),m.jsx("option",{value:"hourly",children:"Hourly"}),m.jsx("option",{value:"daily",children:"Daily"}),m.jsx("option",{value:"weekly",children:"Weekly"}),m.jsx("option",{value:"monthly",children:"Monthly"}),m.jsx("option",{value:"yearly",children:"Yearly"})]}),m.jsx(mr,{type:"number",min:1,max:999,"aria-label":"Repeat interval",className:"w-full",value:A,disabled:C==="none",onChange:Q=>P(Math.max(1,Number(Q.target.value)||1)),title:"Repeat interval"}),m.jsxs(Qc,{"aria-label":"Repeat anchor",value:T,disabled:C==="none",onChange:Q=>$(Q.target.value),title:"Repeat anchor",children:[m.jsx("option",{value:"scheduled",children:"Scheduled"}),m.jsx("option",{value:"completion",children:"Completion"})]})]}),i==="task"&&v!=="none"&&m.jsxs("div",{className:"flex items-center gap-1.5 text-xxs text-kumo-subtle",children:[m.jsx(zl,{priority:v,size:11}),m.jsxs("span",{children:[xu[v]," priority"]})]}),q&&m.jsx(zk,{label:"📌 Pin to project — auto-include in agent opening brief",checked:I,onCheckedChange:L}),W&&X&&X.length>0&&m.jsxs("div",{className:"flex items-center gap-2 text-sm text-kumo-subtle",children:[m.jsx("span",{className:"shrink-0",children:q?"Link to task:":"Sub-task of:"}),m.jsxs(Qc,{size:"sm","aria-label":q?"Link to task":"Parent task",className:"flex-1",value:M,onChange:Q=>V(Q.target.value),children:[m.jsx("option",{value:"",children:"— none —"}),X.map(Q=>m.jsxs("option",{value:Q.id,children:[U!=null&&U.key&&Q.sequenceId?`${U.key}-${Q.sequenceId} · `:"",Or(Q)]},Q.id))]})]}),m.jsxs("div",{className:"flex justify-end sm:justify-between items-center pt-1",children:[m.jsxs("div",{className:"hidden sm:block text-xxs text-kumo-subtle",children:[m.jsx("kbd",{children:"⌘"}),"+",m.jsx("kbd",{children:"Enter"})," to submit · ",m.jsx("kbd",{children:"Esc"})," to close"]}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(nt,{type:"button",onClick:B,children:"Cancel"}),m.jsx(nt,{type:"submit",variant:"primary",disabled:!R||Z.isPending,children:Z.isPending?"Creating…":`Create ${p2[i]}`})]})]}),Z.error&&m.jsx("div",{className:"text-xs text-kumo-danger",children:Z.error.message})]})})}function qk(t){return Array.isArray(t)?t.map(e=>qk(e)).join(","):t==null?"":String(t)}function hOe(t,e,n,r,i,s,o,a,l,u=2){const f=tY(n.current,{event:t,orientation:r,loopFocus:i,rtl:s,cols:u,disabledIndices:o,minIndex:a,maxIndex:l,prevIndex:e>l?a:e,stopEvent:!0});return Ml(n.current,f)?void 0:f}const Uk=c.createContext(void 0);Uk.displayName="ComboboxRootContext";const Yk=c.createContext(void 0);Yk.displayName="ComboboxFloatingContext";const Gk=c.createContext(void 0);Gk.displayName="ComboboxDerivedItemsContext";const Kk=c.createContext(!1);Kk.displayName="ComboboxHasItemsContext";const Jk=c.createContext("");Jk.displayName="ComboboxInputValueContext";function zr(){const t=c.useContext(Uk);if(!t)throw new Error("Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>.");return t}function B8(){const t=c.useContext(Yk);if(!t)throw new Error("Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>.");return t}function N1(){const t=c.useContext(Gk);if(!t)throw new Error("Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>.");return t}function ew(){return c.useContext(Jk)}function pOe(){return c.useContext(Kk)}const mOe={id:t=>t.id,labelId:t=>t.labelId,items:t=>t.items,selectedValue:t=>t.selectedValue,hasSelectionChips:t=>{const e=t.selectedValue;return Array.isArray(e)&&e.length>0},hasSelectedValue:t=>{const{selectedValue:e,selectionMode:n}=t;return e==null?!1:n==="multiple"&&Array.isArray(e)?e.length>0:!0},hasNullItemLabel:(t,e)=>e?VQ(t.items):!1,open:t=>t.open,mounted:t=>t.mounted,forceMounted:t=>t.forceMounted,inline:t=>t.inline,activeIndex:t=>t.activeIndex,selectedIndex:t=>t.selectedIndex,isActive:(t,e)=>t.activeIndex===e,isSelected:(t,e)=>{const n=t.isItemEqualToValue,r=t.selectedValue;return Array.isArray(r)?r.some(i=>Es(e,i,n)):Es(e,r,n)},transitionStatus:t=>t.transitionStatus,popupProps:t=>t.popupProps,listProps:t=>t.listProps,inputProps:t=>t.inputProps,triggerProps:t=>t.triggerProps,itemProps:t=>t.itemProps,positionerElement:t=>t.positionerElement,listElement:t=>t.listElement,popupId:t=>t.popupId,triggerElement:t=>t.triggerElement,inputElement:t=>t.inputElement,inputGroupElement:t=>t.inputGroupElement,popupSide:t=>t.popupSide,openMethod:t=>t.openMethod,inputInsidePopup:t=>t.inputInsidePopup,inputOwnsFormValue:t=>t.inputOwnsFormValue,selectionMode:t=>t.selectionMode,name:t=>t.name,form:t=>t.form,disabled:t=>t.disabled,readOnly:t=>t.readOnly,required:t=>t.required,grid:t=>t.grid,virtualized:t=>t.virtualized,itemToStringLabel:t=>t.itemToStringLabel,isItemEqualToValue:t=>t.isItemEqualToValue,modal:t=>t.modal,autoHighlight:t=>t.autoHighlight};function OF(t){return t==null?void 0:`${t}-popup`}function xF(t,e){return(n,r)=>n==null?!1:t.contains(n,r,e)}function gOe(t,e,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const s=(e==null?void 0:e.selected)??e,o=n!=null?Bs(n,s):"";return o&&t.contains(o,i)&&o.length===i.length?!0:t.contains(r,i,e)}}const HM=new Map;function yF(t={}){const e={usage:"search",sensitivity:"base",ignorePunctuation:!0,...t},n=`${qk(t.locale)}|${JSON.stringify(e)}`,r=HM.get(n);if(r)return r;const i=new Intl.Collator(t.locale,e),s={contains(o,a,l){if(!a)return!0;const u=Bs(o,l);for(let f=0;f<=u.length-a.length;f+=1)if(i.compare(u.slice(f,f+a.length),a)===0)return!0;return!1},startsWith(o,a,l){if(!a)return!0;const u=Bs(o,l);return i.compare(u.slice(0,a.length),a)===0},endsWith(o,a,l){if(!a)return!0;const u=Bs(o,l),f=a.length;return u.length>=f&&i.compare(u.slice(u.length-f),a)===0}};return HM.set(n,s),s}const bF=yF;function OOe(t={}){const{multiple:e=!1,value:n,...r}=t,i=yF(r),s=c.useCallback((o,a,l)=>e?xF(i,l)(o,a):gOe(i,l,n)(o,a),[i,n,e]);return c.useMemo(()=>({...i,contains:s}),[s,i])}const vF=Symbol("none"),hx={value:vF,index:-1};function Rb(t,e,n){const r=t.get(e);if(r!==void 0||n===k8)return r;for(const[i,s]of t)if(Es(i,e,n))return s}function kF(t){const{id:e,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:s,defaultInputValue:o,inputValue:a,open:l,defaultOpen:u=!1,selectionMode:f,onItemHighlighted:p,name:g,form:O,disabled:y=!1,readOnly:b=!1,required:v=!1,inputRef:w,grid:C=!1,items:S,filteredItems:A,filter:P,filterQuery:T,openOnInputClick:$=!0,autoHighlight:I=!1,keepHighlight:L=!1,highlightItemOnHover:M=!0,loopFocus:V=!0,itemToStringLabel:Z,itemToStringValue:D,isItemEqualToValue:B=k8,virtualized:H=!1,inline:U=!1,fillInputOnItemPress:q=!0,modal:W=!1,limit:X=-1,autoComplete:R="list",formAutoComplete:Q,locale:F,submitOnItemClick:N=!1}=t,{clearErrors:z}=Fo(),{setDirty:J,validityData:K,setFilled:ne,name:se,disabled:ie,setTouched:he,setFocused:Se,validationMode:Oe,validation:be}=pi(),me=Aa(),ue=Yl({id:e}),ve=bF({locale:F}),xe=Array.isArray(S)?null:S;if(xe&&typeof xe.label!="function")throw new Error("Base UI: the `items` prop received an object that is not a collection, so its items cannot be read. Pass an array of items, an array of groups with items, or the result of `createItems()`. See https://base-ui.com/react/components/combobox#createitems");const Ce=xe?xe.data:S,we=xe==null?void 0:xe.value,Le=we?void 0:Ce,Ie=c.useMemo(()=>{if(!A||!we)return;const Ne=nh(A),ze=Ne.map(we);let vt;return{values:ze,findItem(en,yn){if(!vt){vt=new Map;for(let tn=0;tn<ze.length;tn+=1)vt.has(ze[tn])||vt.set(ze[tn],Ne[tn])}return Rb(vt,en,yn)}}},[A,we]),Fe=c.useMemo(()=>xe?Ne=>xe.label(Ne,B,ze=>{const vt=Ie==null?void 0:Ie.findItem(ze,B);return vt!=null?xe.itemLabel(vt):Bs(ze,Z)}):Z,[xe,Z,Ie,B]),Me=c.useMemo(()=>xe?Object.assign(Ne=>xe.itemLabel(Ne),{selected:Ne=>Bs(Ne,Fe)}):Z,[xe,Fe,Z]);function oe(Ne){return Bs(Ne,Fe)}const[ge,Y]=c.useState(!1),[G,de]=c.useState(null),Ae=c.useRef(G),Re=c.useRef([]),Ge=c.useRef([]),dt=c.useRef(null),Te=c.useRef(null),Ke=c.useRef(null),gt=c.useRef(null),Pt=c.useRef(null),jt=c.useRef(!0),et=c.useRef(!1),Yt=c.useRef(null),Mt=c.useRef(null),Ht=c.useRef(null),an=c.useRef(hx),at=c.useRef(null),ht=c.useRef([]),Xt=c.useRef(null),zt=ie||y,Mn=se??g,rn=f==="multiple",Jn=f==="single",Wn=a!==void 0||o!==void 0,Tn=Ce!==void 0,Ot=A!==void 0;let Tt;I==="always"?Tt="always":Tt=I?"input-change":!1;const[St,ri]=Ji({controlled:i,default:rn?r??ir:r,name:"Combobox",state:"selectedValue"}),xr=c.useMemo(()=>P===null?()=>!0:P!==void 0?P:xF(ve,Me),[P,ve,Me]),Zi=Qn(()=>Wn?o??"":Jn?oe(St):"").current,[Rn,so]=Ji({controlled:a,default:Zi,name:"Combobox",state:"inputValue"}),[dn,ii]=Ji({controlled:l,default:u,name:"Combobox",state:"open"}),ja=O5(Ce),si=!dn&&G!==null?G:String(Rn).trim(),Xo=Jn?oe(St):"",$0=Jn&&!ge&&si!==""&&Xo.length===si.length&&ve.contains(Xo,si),Wo=$0?"":T??si,L0=Tn&&Ot&&$0&&(!xe||xe.hasValue(St,B)),ic=c.useMemo(()=>Ce?nh(Ce):ir,[Ce]),sc=c.useMemo(()=>{if(A&&!L0)return A;if(!Ce)return ir;if(ja){const ze=Ce,vt=[];let en=0;for(const yn of ze){if(X>-1&&en>=X)break;const tn=X>-1?X-en:1/0,fn=Wo===""?yn.items.slice(0,tn):[];if(Wo!=="")for(const qn of yn.items){if(fn.length>=tn)break;xr(qn,Wo,Me)&&fn.push(qn)}if(fn.length>0){const qn={...yn,items:fn};vt.push(qn),en+=fn.length}}return vt}if(Wo==="")return X>-1?ic.slice(0,X):ic;const Ne=[];for(const ze of ic){if(X>-1&&Ne.length>=X)break;xr(ze,Wo,Me)&&Ne.push(ze)}return Ne},[A,L0,Ce,ja,Wo,X,xr,Me,ic]),Rr=c.useMemo(()=>{if(Ie&&sc===A)return Ie.values;const Ne=nh(sc);return we?Ne.map(ze=>we(ze)):Ne},[sc,A,Ie,we]),We=Qn(()=>{let Ne=null;return U&&dn&&Tn&&f!=="none"&&(Ne=th(Rr,St,B,rn)),new wu({id:ue,labelId:void 0,selectedValue:St,open:dn,items:Le,selectionMode:f,name:Mn,form:O,disabled:zt,readOnly:b,required:v,grid:C,virtualized:H,openOnInputClick:$,itemToStringLabel:Fe,isItemEqualToValue:B,modal:W,autoHighlight:Tt,submitOnItemClick:N,hasInputValue:Wn,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:U,activeIndex:null,selectedIndex:Ne,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:Ut,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:f==="none"},{onOpenChangeComplete:qt,setOpen:qt,setInputValue:qt,setSelectedValue:qt,setIndices:qt,handleSelection:qt,forceMount:qt,requestSubmit:qt,listRef:Re,labelsRef:Ge,popupRef:dt,emptyRef:Pt,inputRef:Te,startDismissRef:Ke,endDismissRef:gt,keyboardActiveRef:jt,chipsContainerRef:Yt,clearRef:Mt,valuesRef:ht,pointerDownItemRef:Xt,selectionEventRef:Ht},mOe)}).current,Ia=f==="none"?Rn:St,N0=c.useMemo(()=>f==="none"?Ia:Array.isArray(St)?St.map(Ne=>Fs(Ne,D)):Fs(St,D),[Ia,D,f,St]),Z1=Ee(p),$a=Ee(n),V1=We.useState("activeIndex"),D1=We.useState("selectedIndex"),qo=We.useState("positionerElement"),jr=We.useState("listElement"),Uo=We.useState("triggerElement"),yr=We.useState("inputElement"),G8=We.useState("inputGroupElement"),Br=We.useState("inline"),Vi=We.useState("inputInsidePopup"),ju=We.useState("inputOwnsFormValue"),oc=Jn&&!Vi&&Rn===Xo,ac=Ln(Uo),{mounted:Iu,setMounted:K8,transitionStatus:H1}=Ks(dn),{openMethod:Q0,triggerProps:Z0}=h5(dn),V0=Ee(()=>N0);w0(Vi?ac:Te,ue,Ia,V0,!zt,g);const La=Ee(()=>{Ce?Ge.current=Rr.map(oe):We.set("forceMounted",!0)}),Na=Ee((Ne,ze,vt)=>{if(ze===-1){if(an.current===hx)return;an.current=hx}else an.current={value:Ne,index:ze};Z1(Ne,pY(vt,void 0,{index:ze}))}),mi=Ee(Ne=>{const ze={};Ne.activeIndex!==void 0&&(ze.activeIndex=Ne.activeIndex),Ne.selectedIndex!==void 0&&(ze.selectedIndex=Ne.selectedIndex),We.update(ze);const vt=Ne.activeIndex;if(vt===void 0)return;const en=Ne.type||"none";vt===null?Na(void 0,-1,en):Na(ht.current[vt],vt,en)}),Qt=Ee((Ne,ze)=>{var vt;if((vt=t.onInputValueChange)==null||vt.call(t,Ne,ze),!ze.isCanceled){if(et.current=ze.reason===ca,ze.reason==="input-change"){dn&&G!==null&&de(null);const en=ze.event,yn=en.inputType;if(en.type==="compositionend"||yn!=null&&yn!==""&&yn!=="insertReplacementText"){const tn=Ne.trim()!=="";tn&&Y(!0),at.current={hasQuery:tn};const fn=We.state.listElement;if(!We.state.virtualized&&fn){const qn=dt.current;for(const br of Wd(fn.firstElementChild??fn)){if(!on(br)||(qn?!Ue(qn,br):br.getAttribute("role")==="dialog"))break;if(k8e(br)){br.scrollTop=0;break}}}tn&&Tt&&We.state.activeIndex==null&&(dn||Br)&&We.set("activeIndex",0)}}else ze.reason==="input-clear"&&Ne===""&&We.state.inputInsidePopup&&(at.current={hasQuery:!1,selection:!0});so(Ne)}}),D0=Ee(Ne=>{const ze=!Ne&&Vi&&!Br&&Rn!==""&&(String(Rn).trim()===G||Rn===Xo);!Ne&&(ze||Rn===""||oc)&&Y(!1),de(null),ze&&Qt("",_e(ca))}),Qa=Ee((Ne,ze)=>{var vt;if(dn!==Ne&&(ze.reason==="escape-key"&&Tn&&Rr.length===0&&!Pt.current&&ze.allowPropagation(),(vt=t.onOpenChange)==null||vt.call(t,Ne,ze),!ze.isCanceled&&(Ne&&G!==null&&D0(ze.reason===Bm),!Ne&&ge&&(Jn?(Br||de(si),si===""&&Y(!1)):rn&&(Br||de(si),Vi&&mi({activeIndex:null}),(!Vi||Br)&&Qt("",_e(ca,ze.event,void 0,{isItemPress:ze.reason===Rl})))),ii(Ne),!Ne&&Vi&&(ze.reason==="focus-out"||ze.reason==="outside-press")&&(he(!0),Se(!1),Oe==="onBlur")))){const en=f==="none"?Rn:St;be.commit(en)}}),oo=Ee((Ne,ze)=>{s==null||s(Ne,ze),!ze.isCanceled&&(ri(Ne),(f==="none"&&dt.current&&q||Jn&&!We.state.inputInsidePopup)&&Qt(oe(Ne),_e(ze.reason,ze.event)))}),F1=Ee((Ne,ze)=>{var fn;const vt=ln(Ne),en=Ht.current??Ne;Ht.current=null;const yn=_e(Rl,en),tn=(fn=vt==null?void 0:vt.closest("a"))==null?void 0:fn.getAttribute("href");if(tn){tn.startsWith("#")&&Qa(!1,yn);return}if(rn){const qn=Array.isArray(St)?St:[],br=e2(qn,ze,B),fo=br?ZQ(qn,ze,B):[...qn,ze];if(oo(fo,yn),yn.isCanceled||!(Te.current&&Te.current.value.trim()!==""))return;if(We.state.inputInsidePopup){Qt("",_e(ca,yn.event,void 0,{isItemPress:!0}));const os=at.current;os&&!br&&(os.toggledValue=ze)}else Qa(!1,yn)}else{if(oo(ze,yn),yn.isCanceled)return;Qa(!1,yn)}}),_1=Ee(()=>{var ze,vt;const Ne=((ze=be.inputRef.current)==null?void 0:ze.form)??((vt=We.state.inputElement)==null?void 0:vt.form);Ne&&typeof Ne.requestSubmit=="function"&&Ne.requestSubmit()}),$u=Ee(()=>{if(K8(!1),$a==null||$a(!1),Y(!1),de(null),mi(f==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),rn&&Te.current&&Te.current.value!==""&&!et.current&&Qt("",_e(ca)),Jn)if(We.state.inputInsidePopup)Te.current&&Te.current.value!==""&&Qt("",_e(ca));else{const Ne=oe(St);Te.current&&Te.current.value!==Ne&&Qt(Ne,_e(Ne===""?ca:_n))}}),H0=c.useMemo(()=>Br&&qo?{current:qo.closest('[role="dialog"]')}:dt,[Br,qo]);Hr({enabled:!t.actionsRef,open:dn,ref:H0,onComplete(){dn||$u()}}),c.useImperativeHandle(t.actionsRef,()=>({unmount:$u}),[$u]),Pe(function(){const ze=Ae.current!==null&&G===null;if(Ae.current=G,dn&&(!ze||!Tn)||(dn||(Xt.current=null),f==="none"))return;const vt=Tn?Rr:ht.current;mi({selectedIndex:th(vt,St,B,rn)})},[dn,G,St,f,rn,Tn,Rr,B,mi]),Pe(()=>{Ce&&(ht.current=Rr,Re.current.length=Rr.length)},[Ce,Rr]),Pe(()=>{var fn;const Ne=at.current;if(Ne){const qn=dn||Br||((fn=We.state.positionerElement)==null?void 0:fn.hidden)===!1;if(Ne.hasQuery)Tt&&qn&&We.set("activeIndex",0),at.current=null;else if(String(Rn).trim()===""&&(at.current=null,qn)){const br=Ne.selection;Tt==="always"&&!br&&We.state.selectionMode==="none"&&We.set("activeIndex",0),queueMicrotask(()=>{if(!We.state.open&&!We.state.inline||Te.current&&Te.current.value.trim()!=="")return;const fo=We.state.selectedValue,os=We.state.selectionMode==="multiple";if(os&&Array.isArray(fo)?fo.length>0:We.state.selectionMode!=="none"&&fo!=null){const Vu=Tn||Ot?Rr:ht.current,Fa=iu(Vu,Ne.toggledValue,We.state.isItemEqualToValue);We.set("activeIndex",Fa!==-1?Fa:th(Vu,fo,We.state.isItemEqualToValue,os))}else br?We.set("activeIndex",null):Tt==="always"&&We.set("activeIndex",0)})}}if(!dn&&!Br)return;const ze=Tn||Ot?Rr:ht.current,vt=We.state.activeIndex;if(vt==null){if(Tt==="always"&&ze.length>0){We.set("activeIndex",0);return}Na(void 0,-1,_n);return}if(vt>=ze.length){Na(void 0,-1,_n),We.set("activeIndex",null);return}const en=ze[vt],yn=an.current.value,tn=yn!==vF&&Es(en,yn,We.state.isItemEqualToValue);(an.current.index!==vt||!tn)&&Na(en,vt,_n)},[V1,Tt,Na,Ot,Tn,Rr,Br,dn,We,Rn]),Pe(()=>{if(f==="none"){ne(String(Rn)!=="");return}ne(rn?Array.isArray(St)&&St.length>0:St!=null)},[ne,f,Rn,St,rn]),c.useEffect(()=>{Tn&&Tt&&Rr.length===0&&mi({activeIndex:null})},[Tn,Tt,Rr.length,mi]);function Lu(){dn&&si!==""&&si!==String(Zi)&&!oc&&Y(!0)}function ao(){dn&&G!==null&&D0(!1)}let Rs=!1;function js(){!Rs&&Rn!==Xo&&(Rs=!0,Qt(Xo,_e(_n)))}function lc(){f!=="none"&&(z(Mn),J(NQ(St,K.initialValue,B)),be.change(St),Jn&&!Wn&&!Vi&&js())}function Za(){Jn&&!Wn&&!Vi&&!ge&&js()}function lo(){f==="none"&&(z(Mn),J(Rn!==K.initialValue),be.change(Rn))}gs(si,Lu),gs(dn,ao),gs(St,lc),gs(Xo,Za),gs(Ce,Za),gs(Rn,lo);const Nu=Lv({open:Br?!0:dn,onOpenChange:Qa,elements:{reference:Vi?Uo:yr,floating:qo}}),F0=C?"grid":"listbox",co=dn||Br,z1=co?"true":"false",cc=c.useMemo(()=>{const Ne=(yr==null?void 0:yr.tagName)==="INPUT",ze=yr==null||Ne,vt=ze||co,en=ze?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return vt&&(en.role="combobox",en["aria-expanded"]=z1,en["aria-haspopup"]=F0,en["aria-controls"]=co?jr==null?void 0:jr.id:void 0,en["aria-autocomplete"]=b?"none":R),{reference:en,floating:{role:"presentation"}}},[yr,co,z1,F0,jr==null?void 0:jr.id,R,b]),uc=S0(Nu,{enabled:!zt&&$,event:"mousedown-only",toggle:!1,touchOpenDelay:Vi?0:100,reason:HR}),dc=c1(Nu,{enabled:!zt&&!Br,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Br?!0:void 0,outsidePress(Ne){const ze=ln(Ne);return!Ue(Uo,ze)&&!Ue(Mt.current,ze)&&!Ue(Yt.current,ze)&&!Ue(G8,ze)}}),Va=p5(Nu,{enabled:!zt,id:ue,listRef:Re,activeIndex:V1,selectedIndex:D1,virtual:!0,loopFocus:V,allowEscape:V&&!Tt,focusItemOnOpen:ge||f==="none"&&!Tt?!1:"auto",focusItemOnHover:M,resetOnPointerLeave:!L,orientation:C?"horizontal":void 0,rtl:me==="rtl",disabledIndices:ir,grid:C?hOe:void 0,onNavigate(Ne,ze){!ze&&!dn||H1==="ending"||mi(ze?{activeIndex:Ne,type:jt.current?o1:V2}:{activeIndex:Ne})}}),Da=c.useMemo(()=>ar(Va.reference,{onKeyDown(Ne){C&&We.state.activeIndex==null&&(Ne.key==="ArrowLeft"||Ne.key==="ArrowRight")&&Ne.preventBaseUIHandler()}},dc.reference,uc.reference,cc.reference),[Va.reference,dc.reference,uc.reference,cc.reference,C,We]),Ha=c.useMemo(()=>ar(u1,dc.floating),[dc.floating]),Yo=c.useMemo(()=>ar(Va.floating,cc.floating),[Va.floating,cc.floating]),fc=c.useMemo(()=>{const Ne=Va.item;return Ne?{...Ne,onFocus:void 0}:Ut},[Va.item]);We.useContextCallback("setOpen",Qa),We.useContextCallback("setInputValue",Qt),We.useContextCallback("setSelectedValue",oo),We.useContextCallback("setIndices",mi),We.useContextCallback("handleSelection",F1),We.useContextCallback("forceMount",La),We.useContextCallback("requestSubmit",_1),We.useContextCallback("onOpenChangeComplete",n),LQ(()=>{We.update({inline:U,popupProps:Ha,listProps:Yo,inputProps:Da,triggerProps:Z0,itemProps:fc})});const B1={id:ue,selectedValue:St,open:dn,mounted:Iu,transitionStatus:H1,items:Le,inline:U,popupProps:Ha,listProps:Yo,inputProps:Da,triggerProps:Z0,itemProps:fc,openMethod:Q0,selectionMode:f,name:Mn,form:O,disabled:zt,readOnly:b,required:v,grid:C,virtualized:H,openOnInputClick:$,itemToStringLabel:Fe,modal:W,autoHighlight:Tt,isItemEqualToValue:B,submitOnItemClick:N,hasInputValue:Wn};Pe(()=>{We.update({...B1,inputOwnsFormValue:f==="none"&&(U||!We.state.inputInsidePopup)})},[We,...Object.values(B1)]);const J8=ns(w,be.inputRef),_0=c.useMemo(()=>({query:si,hasItems:Tn,filteredItems:sc,flatFilteredValues:Rr}),[si,Tn,sc,Rr]),Qu=c.useMemo(()=>Array.isArray(Ia)?"":Fs(Ia,D),[Ia,D]),z0=rn&&Array.isArray(St)&&St.length>0,Zu=rn||f==="none"&&ju?void 0:Mn,uo=c.useMemo(()=>!rn||!Array.isArray(St)||!Mn?null:St.map(Ne=>{const ze=Fs(Ne,D);return m.jsx("input",{type:"hidden",form:O,name:Mn,value:ze,disabled:zt},ze)}),[rn,St,O,Mn,D,zt]),B0=m.jsxs(c.Fragment,{children:[t.children,m.jsx("input",{...be.getValidationProps(zt,{onFocus(){var Ne;if(Vi){Uo==null||Uo.focus();return}(Ne=Te.current||Uo)==null||Ne.focus()},onChange(Ne){if(Ne.nativeEvent.defaultPrevented||zt||b)return;const ze=Ne.currentTarget.value,vt=ze.toLowerCase(),en=_e(_n,Ne.nativeEvent),yn=()=>ht.current.findIndex(fn=>Fs(fn,D).toLowerCase()===vt||oe(fn).toLowerCase()===vt);function tn(){if(rn)return;if(f==="none"){Qt(ze,en);return}let fn=yn();fn===-1&&(fn=ht.current.findIndex((br,fo)=>{const os=Ge.current[fo];return os!=null&&os.toLowerCase()===vt}));const qn=fn===-1?void 0:ht.current[fn];qn!=null&&(oo==null||oo(qn,en))}Jn&&(La(),Ce&&yn()===-1&&We.set("forceMounted",!0)),queueMicrotask(tn)}}),id:ue&&Zu==null?`${ue}-hidden-input`:void 0,form:O,name:Zu,autoComplete:Q,disabled:zt,required:v&&!z0,readOnly:b,value:Qu,ref:J8,style:Zu?a1:ku,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),uo]});return m.jsx(Uk.Provider,{value:We,children:m.jsx(Yk.Provider,{value:Nu,children:m.jsx(Kk.Provider,{value:Tn,children:m.jsx(Gk.Provider,{value:_0,children:m.jsx(Jk.Provider,{value:Rn,children:B0})})})})})}const xOe="data-popup-side",yOe="data-list-empty",wF={...gg,...eo,popupSide:t=>t?{[xOe]:t}:null,listEmpty:t=>t?{[yOe]:""}:null},tw=c.createContext(void 0);tw.displayName="ComboboxChipsContext";function SF(){return c.useContext(tw)}const nw=c.createContext(void 0);nw.displayName="ComboboxPositionerContext";function rw(t){const e=c.useContext(nw);if(e===void 0&&!t)throw new Error("Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component");return e}const iw=c.forwardRef(function(e,n){const r=zr(),{buttonRef:i,getButtonProps:s}=Tr({native:!1}),o=ns(n,i);function a(u){r.context.setOpen(!1,_e(DR,u.nativeEvent,u.currentTarget))}const l=s({onClick:a});return m.jsx("span",{ref:o,...l,"aria-label":"Dismiss",tabIndex:void 0,style:a1})});iw.displayName="ComboboxInternalDismissButton";function CF(t){const e=t.useState("mounted"),n=t.useState("popupSide"),r=t.useState("positionerElement");return e&&r?n:null}function X8(){return N1().filteredItems.length===0}function EF(t){return t==="rtl"?["ArrowRight","ArrowLeft"]:["ArrowLeft","ArrowRight"]}function AF(t,e){const n=t>=e-1?e-2:t;return n>=0?n:void 0}function PF(t,e,n){const r=t.context.listRef.current[e];r&&(t.context.selectionEventRef.current=n,r.click(),t.context.selectionEventRef.current=null)}const Q1=c.forwardRef(function(e,n){const{render:r,className:i,disabled:s=!1,id:o,style:a,...l}=e,{state:u,disabled:f,setTouched:p,setFocused:g,validationMode:O,validation:y}=pi(),{labelId:b}=Li(),v=SF(),C=!!rw(!0),S=zr(),A=ew(),P=Aa(),T=S.useState("required"),$=S.useState("disabled"),I=S.useState("readOnly"),L=S.useState("name"),M=S.useState("form"),V=S.useState("selectionMode"),Z=S.useState("autoHighlight"),D=S.useState("inputProps"),B=S.useState("triggerProps"),H=S.useState("open"),U=S.useState("mounted"),q=S.useState("selectedValue"),W=S.useState("id"),X=S.useState("inline"),R=S.useState("modal"),Q=!!Z,F=CF(S),N=f||$||s,z=X8(),J=C||X,K=!J||R,ne=Pn(o??(J?void 0:W)),se=C?vQ:u,[ie,he]=c.useState(null),Se=c.useRef(!1),Oe=c.useRef(null),be=c.useRef(!1),me=V==="none"&&!C,ue=Ee(Me=>{const oe=C||S.state.inline;oe&&!S.state.hasInputValue&&S.context.setInputValue("",_e(_n)),S.update({inputElement:Me,inputInsidePopup:oe,inputOwnsFormValue:me})}),ve=C?l:y.getValidationProps(N,l);function xe(){S.context.setIndices({activeIndex:null,selectedIndex:null,type:S.context.keyboardActiveRef.current?o1:V2})}function Ce(){S.context.keyboardActiveRef.current=!1}const we={...se,open:H,disabled:N,readOnly:I,popupSide:F,listEmpty:z};function Le(Me){if(!v)return;let oe;const{highlightedChipIndex:ge}=v,Y=v.chipsRef.current.length,[G,de]=EF(P);return ge!==void 0?(Me.key===G?(Me.preventDefault(),ge>0?oe=ge-1:oe=void 0):Me.key===de?(Me.preventDefault(),ge<Y-1?oe=ge+1:oe=void 0):(Me.key==="Backspace"||Me.key==="Delete")&&(Me.preventDefault(),oe=AF(ge,q.length),xe()),oe):(Me.key===G&&(Me.currentTarget.selectionStart??0)===0&&q.length>0&&(Me.preventDefault(),oe=Y>0?Y-1:void 0),oe)}const Ie=He("input",e,{state:we,ref:[n,S.context.inputRef,ue],props:[D,B,{value:ie??A,"aria-readonly":I||void 0,"aria-required":T||void 0,"aria-labelledby":b,disabled:N,readOnly:I,required:V==="none"?T:void 0,form:M,...me&&L&&{name:L},id:ne,onFocus(){if(g(!0),!X||!be.current)return;be.current=!1;const Me=Oe.current;Me==null||!Object.hasOwn(S.context.valuesRef.current,Me)||S.context.setIndices({activeIndex:Me})},onBlur(){p(!0),g(!1);const Me=S.state.activeIndex;if(X&&Me!==null&&Z!=="always"&&(Oe.current=Me,be.current=!0,S.context.setIndices({activeIndex:null})),O==="onBlur"){const oe=V==="none"?A:q;y.commit(oe)}},onCompositionStart(Me){mg||(Se.current=!0,he(Me.currentTarget.value))},onCompositionEnd(Me){Se.current=!1;const oe=Me.currentTarget.value;he(null),S.context.setInputValue(oe,_e(Bm,Me.nativeEvent))},onChange(Me){const oe=Me.nativeEvent,ge=oe.inputType,Y=!ge||ge==="insertReplacementText",G=Se.current||!Y;function de(dt){I||N||!dt||!G||(S.context.setOpen(!0,_e(Bm,oe)),Q||xe())}if(Se.current){const dt=Me.currentTarget.value;he(dt),dt===""&&!S.state.openOnInputClick&&!S.state.inputInsidePopup&&S.context.setOpen(!1,_e(ca,oe));const Te=dt.trim(),Ke=Q&&Te!=="";de(Te),H&&S.state.activeIndex!==null&&!Ke&&xe();return}const Ae=_e(Bm,oe);if(S.context.setInputValue(Me.currentTarget.value,Ae),Ae.isCanceled)return;const Re=Me.currentTarget.value==="",Ge=_e(ca,oe);Re&&!S.state.inputInsidePopup&&(V==="single"&&S.context.setSelectedValue(null,Ge),S.state.openOnInputClick||S.context.setOpen(!1,Ge)),de(Me.currentTarget.value.trim()),H&&S.state.activeIndex!==null&&!Q&&xe()},onKeyDown(Me){var Ae,Re;if(Me.ctrlKey||Me.shiftKey||Me.altKey||Me.metaKey)return;if(S.context.keyboardActiveRef.current=!0,N||I){I&&Me.key==="Enter"&&H&&S.state.activeIndex!==null&&Dn(Me);return}const oe=Me.currentTarget,ge=oe.scrollWidth-oe.clientWidth,Y=P==="rtl";if(Me.key==="Home"){Dn(Me);const Ge=j9&&Y?oe.value.length:0;oe.setSelectionRange(Ge,Ge),oe.scrollLeft=0;return}if(Me.key==="End"){Dn(Me);const Ge=j9&&Y?0:oe.value.length;oe.setSelectionRange(Ge,Ge),oe.scrollLeft=Y?-ge:ge;return}if(!U&&Me.key==="Escape"){const Ge=V==="multiple"&&Array.isArray(q)?q.length===0:q===null,dt=_e(FR,Me.nativeEvent),Te=V==="multiple"?[]:null;S.context.setInputValue("",dt),S.context.setSelectedValue(Te,dt),!Ge&&!S.state.inline&&!dt.isPropagationAllowed&&Me.stopPropagation();return}if(v&&Me.key==="Backspace"&&oe.value===""&&v.highlightedChipIndex===void 0&&Array.isArray(q)&&q.length>0){const Ge=v.chipsRef.current.length,dt=Ge>0?Ge-1:q.length-1,Te=q.filter((Ke,gt)=>gt!==dt);xe(),S.context.setSelectedValue(Te,_e(_n,Me.nativeEvent));return}const G=(v==null?void 0:v.highlightedChipIndex)!==void 0,de=Le(Me);if(v==null||v.setHighlightedChipIndex(de),de!==void 0?(Ae=v==null?void 0:v.chipsRef.current[de])==null||Ae.focus():G&&((Re=S.context.inputRef.current)==null||Re.focus()),Me.which!==229&&Me.key==="Enter"&&H){const Ge=S.state.activeIndex,dt=Me.nativeEvent;if(Ge===null){if(X)return;S.context.setOpen(!1,_e(_n,dt));return}Dn(Me),PF(S,Ge,dt)}},onPointerMove:Ce,onPointerDown:Ce},ve],stateAttributesMapping:wF}),Fe=C?m.jsx(p8.Provider,{value:kQ,children:Ie}):Ie;return m.jsxs(c.Fragment,{children:[H&&K&&m.jsx(iw,{ref:S.context.startDismissRef}),Fe]})});Q1.displayName="ComboboxInput";const sw=c.createContext(null);sw.displayName="GroupCollectionContext";function bOe(){return c.useContext(sw)}function vOe(t){const{children:e,items:n}=t,r=c.useMemo(()=>({items:n}),[n]);return m.jsx(sw.Provider,{value:r,children:e})}function MF(t){const{children:e}=t,{filteredItems:n}=N1(),r=bOe(),i=r?r.items:n;return m.jsx(c.Fragment,{children:i.map(e)})}const ow=c.forwardRef(function(e,n){var r;const{render:i,className:s,style:o,children:a,...l}=e,u=zr(),f=B8(),p=!!rw(!0),{filteredItems:g,hasItems:O}=N1(),y=u.useState("selectionMode"),b=u.useState("grid"),v=u.useState("readOnly"),w=u.useState("listProps"),C=u.useState("virtualized"),S=u.useState("forceMounted"),A=y==="multiple",P=g.length===0,T=Ee(D=>{u.set("positionerElement",D)}),$=Ee(D=>{u.set("listElement",D)}),I=c.useMemo(()=>typeof a=="function"?r||(r=m.jsx(MF,{children:a})):a,[a]),L={empty:P},M=f.useState("floatingId"),V=He("div",e,{state:L,ref:[n,$,p?null:T],props:[w,{children:I,tabIndex:-1,id:M,role:b?"grid":"listbox","aria-multiselectable":A?"true":void 0,"aria-readonly":!b&&v?!0:void 0,onKeyDown(D){if(!(u.state.disabled||u.state.readOnly)&&D.key==="Enter"){const B=u.state.activeIndex;if(B==null)return;Dn(D),PF(u,B,D.nativeEvent)}},onKeyDownCapture(){u.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){u.context.keyboardActiveRef.current=!1}},l]});if(C)return V;const Z=O&&!S?void 0:u.context.labelsRef;return m.jsx(C0,{elementsRef:u.context.listRef,labelsRef:Z,children:V})});ow.displayName="ComboboxList";const kOe="⁠";function wOe(t){const e=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);let n=null;for(;e.nextNode();){const r=e.currentNode;r.nodeValue!==""&&(n=r)}return n}function SOe(){const t=wn(),e=c.useRef(null);return c.useEffect(()=>{if(r1)return;const n=e.current;if(n==null)return;const r=wOe(n);if(r==null)return;const i=r.data,s=`${i}${kOe}`;return r.nodeValue=s,t.start(200,()=>{r.nodeValue===s&&(r.nodeValue=i)}),()=>{t.clear(),r.nodeValue===s&&(r.nodeValue=i)}},[e,t]),e}const aw=c.createContext(void 0);aw.displayName="ComboboxGroupContext";function COe(){const t=c.useContext(aw);if(t===void 0)throw new Error("Base UI: ComboboxGroupContext is missing. ComboboxGroup parts must be placed within <Combobox.Group>.");return t}const TF=c.forwardRef(function(e,n){const{render:r,className:i,style:s,items:o,...a}=e,l=zr().useState("grid"),[u,f]=c.useState(),p=c.useMemo(()=>({labelId:u,setLabelId:f,items:o}),[u,f,o]),g=He("div",e,{ref:n,props:[{role:l?"rowgroup":"group","aria-labelledby":u},a]}),O=m.jsx(aw.Provider,{value:p,children:g});return o?m.jsx(vOe,{items:o,children:O}):O});TF.displayName="ComboboxGroup";const RF=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,...a}=e,{setLabelId:l}=COe(),u=Pn(o);return Pe(()=>(l(u),()=>{l(f=>f===u?void 0:f)}),[u,l]),He("div",e,{ref:n,props:[{id:u,"aria-hidden":!0},a]})});RF.displayName="ComboboxGroupLabel";const lw=c.createContext(void 0);lw.displayName="ComboboxItemContext";function jF(){const t=c.useContext(lw);if(!t)throw new Error("Base UI: ComboboxItemContext is missing. ComboboxItem parts must be placed within <Combobox.Item>.");return t}const IF=c.createContext(!1);IF.displayName="ComboboxRowContext";function EOe(){return c.useContext(IF)}function $F(t){const{componentProps:e,forwardedRef:n,virtualized:r,indexFromFilter:i}=t,{render:s,className:o,style:a,value:l=null,index:u,disabled:f=!1,nativeButton:p=!1,...g}=e,O=c.useRef(null),y=Ta({guess:!0,index:u,textRef:O}),b=zr(),v=EOe(),w=pOe(),C=b.useState("selectionMode"),S=b.useState("disabled"),A=b.useState("readOnly"),P=b.useState("isItemEqualToValue"),T=S||f,$=C!=="none",I=u??i??y.index,L=I!==-1,M=b.useState("id"),V=b.useState("isActive",I),Z=b.useState("isSelected",l),D=b.useState("itemProps"),B=c.useRef(null),H=M!=null&&L?`${M}-${I}`:void 0,U=Z&&$;Pe(()=>{if(!(L&&(r||u!=null)))return;const z=b.context.listRef.current;return z[I]=B.current,()=>{delete z[I]}},[L,r,I,u,b]),Pe(()=>{if(!L||w)return;const z=b.context.valuesRef.current;return z[I]=l,()=>{delete z[I]}},[L,w,I,l,b]),Pe(()=>{if(!L||w)return;const z=b.state.selectedValue;let J=b.state.selectedIndex;b.state.selectionMode==="multiple"&&Array.isArray(z)?J=QQ(I,l,b.context.valuesRef.current,z,P,J):Es(l,z,P)&&(J=I),b.set("selectedIndex",J)},[L,w,b,I,l,P]);const{getButtonProps:q,buttonRef:W}=Tr({disabled:T,focusableWhenDisabled:!0,native:p,composite:!0}),X={disabled:T,selected:U,highlighted:V};function R(z){function J(){b.context.handleSelection(z,l)}b.state.submitOnItemClick?(ts.flushSync(J),b.context.requestSubmit()):J()}const Q={id:H,role:v?"gridcell":"option","aria-selected":$?U:void 0,tabIndex:void 0,onPointerDownCapture(z){z.isPrimary&&(b.context.pointerDownItemRef.current=z.currentTarget),z.preventDefault()},onMouseDown(z){z.preventDefault()},onClick(z){T||A||R(z.nativeEvent)},onMouseUp(z){const J=b.context.pointerDownItemRef.current===z.currentTarget;b.context.pointerDownItemRef.current=null,!(T||A||z.button!==0||J||!V)&&R(z.nativeEvent)}},F=He("div",e,{ref:[W,n,y.ref,B],state:X,props:[D,Q,g,q]}),N=c.useMemo(()=>({selected:U,textRef:O}),[U,O]);return m.jsx(lw.Provider,{value:N,children:F})}function AOe(t){const{componentProps:e,forwardedRef:n}=t,r=zr().useState("isItemEqualToValue"),{flatFilteredValues:i}=N1(),s=e.value??null,o=iu(i,s,r);return m.jsx($F,{componentProps:e,forwardedRef:n,virtualized:!0,indexFromFilter:o})}const cw=c.memo(c.forwardRef(function(e,n){const r=zr().useState("virtualized");return r&&e.index==null?m.jsx(AOe,{componentProps:e,forwardedRef:n}):m.jsx($F,{componentProps:e,forwardedRef:n,virtualized:r,indexFromFilter:void 0})}));cw.displayName="ComboboxItem";const uw=c.forwardRef(function(e,n){const{render:r,className:i,style:s,children:o,...a}=e,{filteredItems:l}=N1(),u=zr(),f=SOe(),p=l.length===0?o:null;return He("div",e,{ref:[n,u.context.emptyRef,f],props:[{children:p,role:"status","aria-live":"polite","aria-atomic":!0},a]})});uw.displayName="ComboboxEmpty";function POe(t){const{openOnInputClick:e=!1,value:n,defaultValue:r,onValueChange:i,mode:s="list",itemToStringValue:o,...a}=t,l=(s==="inline"||s==="both")&&!t.readOnly,u=s==="inline"||s==="none",f=n!==void 0,[p,g]=c.useState(r??""),[O,y]=c.useState("");c.useEffect(()=>{(f||!l)&&y("")},[n,f,l]);let b;l&&O!==""?b=O:f?b=n??"":b=p;const v=bF({locale:a.locale}),w=String((f?n:p)??"").trim(),C=u||a.filter===null?null:a.filter??v.contains;function S(P,T){y(""),f||g(P),i==null||i(P,T)}function A(P,T){var $;($=t.onItemHighlighted)==null||$.call(t,P,T),T.reason!=="pointer"&&y(l&&P!=null?Bs(P,o):"")}return m.jsx(kF,{...a,itemToStringLabel:o,openOnInputClick:e,selectionMode:"none",fillInputOnItemPress:!0,filter:C,filterQuery:s==="both"?w:void 0,autoComplete:s,inputValue:b,defaultInputValue:r,onInputValueChange:S,onItemHighlighted:A})}const MOe=cw,LF=c.createContext({});function TOe({open:t,onOpenChange:e,onBackdropClick:n,children:r,container:i}){const s=vu(),o=i??s??void 0,a=u=>{n?n(u):e(!1)},l=c.useCallback(()=>{e(!1)},[e]);return m.jsx(Nk,{open:t,onOpenChange:e,modal:!0,children:m.jsxs(O2,{container:o,children:[m.jsx(x2,{className:"fixed inset-0 bg-kumo-overlay opacity-80 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",onClick:a}),m.jsx(JH,{render:m.jsx(y2,{}),className:le("fixed top-[10vh] left-1/2 w-full max-w-2xl -translate-x-1/2","overflow-hidden rounded-lg","duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0"),style:{transitionProperty:"scale, opacity",transitionTimingFunction:"var(--default-transition-timing-function)"},children:m.jsx(LF.Provider,{value:{onClose:l},children:r})})]})})}function ROe({open:t,onOpenChange:e,onBackdropClick:n,children:r,items:i,value:s,onValueChange:o,onItemHighlighted:a,itemToStringValue:l,filter:u,onSelect:f,getSelectableItems:p,container:g}){return m.jsx(TOe,{open:t,onOpenChange:e,onBackdropClick:n,container:g,children:m.jsx(ZOe,{items:i,value:s,onValueChange:o,onItemHighlighted:a,itemToStringValue:l,filter:u,open:t,onSelect:f,getSelectableItems:p,children:r})})}function jOe({children:t,leading:e,trailing:n}){return m.jsxs("div",{className:"flex items-center gap-3 bg-kumo-base px-4 py-3 focus-within:ring-2 focus-within:ring-kumo-brand",children:[e??m.jsx(xh,{className:"h-4 w-4 text-kumo-subtle",weight:"bold"}),t,n]})}const NF=c.forwardRef(function({children:e,className:n},r){return m.jsx("div",{ref:r,className:le("relative min-h-0 flex-1 scroll-py-2 overflow-y-auto rounded-b-lg bg-kumo-base px-2 py-2 ring-1 ring-kumo-hairline",n),children:e})});NF.displayName="CommandPalette.List";function IOe({value:t,disabled:e,children:n,className:r,onClick:i}){return m.jsx(MOe,{value:t,disabled:e,onClick:i,className:le("group flex w-full items-center gap-3 px-2 py-1.5 text-left text-base transition-colors","cursor-pointer data-[highlighted]:bg-kumo-overlay","rounded-lg",e&&"cursor-default opacity-50",r),children:n})}function $Oe({children:t}){return m.jsx(uw,{children:m.jsx("div",{className:"p-8 text-center",children:m.jsx("p",{className:"text-kumo-subtle",children:t??"No results found"})})})}function LOe({children:t}){return m.jsx("div",{className:"flex items-center justify-between rounded-b-lg bg-kumo-elevated px-4 py-3 text-xs text-kumo-subtle",children:t})}function NOe({children:t,className:e}){return m.jsx("div",{className:le("flex max-h-[60vh] flex-col overflow-hidden rounded-lg bg-kumo-elevated",e),children:t})}const QF=c.createContext({}),QOe=()=>!0;function ZOe({children:t,items:e,value:n,onValueChange:r,onItemHighlighted:i,itemToStringValue:s,filter:o=QOe,open:a=!0,className:l,onSelect:u,getSelectableItems:f}){const p=c.useRef(-1),g=c.useCallback((y,b)=>{p.current=b.index,i==null||i(y,b)},[i]),O=c.useCallback(y=>{const b=y.key==="Enter",v=y.metaKey||y.ctrlKey;if(b&&v&&u&&f){const w=f(e)[p.current];w!==void 0&&(y.preventDefault(),u(w,{newTab:!0}))}},[e,u,f]);return m.jsx(NOe,{className:l,children:m.jsx(POe,{items:e,value:n,onValueChange:r,onItemHighlighted:g,itemToStringValue:s,filter:o,autoHighlight:"always",keepHighlight:!0,open:a,children:m.jsx(QF.Provider,{value:{onInputKeyDown:O},children:t})})})}function VOe({autoFocus:t=!0,placeholder:e,className:n,onKeyDown:r,leading:i,trailing:s,...o}){const{onInputKeyDown:a}=c.useContext(QF),{onClose:l}=c.useContext(LF),u=c.useCallback(f=>{if(r==null||r(f),!f.defaultPrevented){if(f.key==="Escape"&&l){f.preventDefault(),l();return}a==null||a(f)}},[a,r,l]);return m.jsx(jOe,{leading:i,trailing:s,children:m.jsx(Q1,{placeholder:e,className:le("kumo-input-placeholder flex-1 border-none bg-transparent text-base","outline-none",n),onKeyDown:u,autoFocus:t,...o})})}function DOe({children:t,className:e}){return m.jsx(ow,{className:le("space-y-3",e),children:t})}const Rc={Root:ROe,Input:VOe,List:NF,Item:IOe,Empty:$Oe,Footer:LOe,Results:DOe},HOe={task:{label:"task",icon:null},note:{label:"memory",icon:O0},comment:{label:"worklog",icon:q2},feedback:{label:"feedback",icon:Y2}};function FOe(){const[t,e]=c.useState(""),[n,r]=c.useState(""),{close:i}=cr(),{open:s}=ro(),{data:o}=Qi();c.useEffect(()=>{const g=setTimeout(()=>r(t.trim()),200);return()=>clearTimeout(g)},[t]);const{data:a,isFetching:l}=AD(n?{query:n,limit:20}:null),u=n?(a==null?void 0:a.hits)??[]:[],f=c.useMemo(()=>{const g=new Map;return o==null||o.forEach(O=>g.set(O.id,O.key)),g},[o]),p=g=>{i(),s(g.entity.id)};return m.jsxs(Rc.Root,{open:!0,onOpenChange:g=>{g||i()},items:u,value:t,onValueChange:e,itemToStringValue:g=>Or(g.entity),children:[m.jsx(Rc.Input,{placeholder:"Search tasks, memory, worklogs…","aria-label":"Search",trailing:l?m.jsx(Su,{size:14}):m.jsx("kbd",{children:"esc"})}),m.jsxs(Rc.List,{className:"scrollbar-thin",children:[m.jsx(Rc.Results,{className:"space-y-0.5",children:g=>{const O=HOe[g.entity.kind],y=O.icon,b=g.entity.projectId?f.get(g.entity.projectId):null,v=g.entity.body.replace(/\n/g," ").slice(0,140);return m.jsxs(Rc.Item,{value:g,onClick:()=>p(g),className:"items-start",children:[m.jsx("span",{className:"mt-0.5 flex size-4 shrink-0 items-center justify-center text-kumo-subtle",children:y?m.jsx(y,{size:16}):m.jsx(Ou,{status:g.entity.status})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:"truncate text-sm text-kumo-default",children:Or(g.entity)}),v&&m.jsx("div",{className:"mt-0.5 truncate text-xs text-kumo-subtle",children:v}),m.jsxs("div",{className:"mt-0.5 flex gap-1.5 text-xxs text-kumo-placeholder tabular-nums",children:[m.jsx("span",{children:O.label}),b&&m.jsxs("span",{children:["· ",b]}),m.jsxs("span",{children:["· score ",g.score.toFixed(3)]}),g.components.bm25&&m.jsx("span",{children:"· bm25"}),g.components.cosine&&m.jsx("span",{children:"· vec"})]})]}),m.jsx(Oj,{size:14,className:"mt-0.5 shrink-0 text-kumo-subtle opacity-0 transition-opacity group-data-[highlighted]:opacity-100"})]},g.entity.id)}}),m.jsx(Rc.Empty,{children:n?l?"Searching…":"No matches.":"Hybrid search over BM25, vectors and recency."})]}),m.jsxs(Rc.Footer,{children:[m.jsx("span",{children:a&&n?`${a.hits.length} result(s) · embedding ${a.embeddingUsed?"on":"off (BM25-only)"}`:null}),m.jsxs("span",{className:"flex items-center gap-3",children:[m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("kbd",{children:"↑"}),m.jsx("kbd",{children:"↓"}),"navigate"]}),m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("kbd",{children:"↵"}),"open"]})]})]})]})}function _Oe(){const{active:t}=cr();if(!t)return null;switch(t.kind){case"search":return m.jsx(FOe,{});case"quick-create":return m.jsx(fOe,{initialProjectId:t.projectId,initialKind:t.initialKind,initialParentId:t.parentId});case"new-project":return m.jsx(T6e,{});case"edit-project":return m.jsx(M6e,{projectId:t.projectId})}}const zOe=`## Critical
156
+ Note: When used inside Checkbox.Group, label is optional`)}const O=m.jsx(Fk,{ref:g,"data-kumo-component":"Checkbox",name:f,checked:e,indeterminate:n,disabled:r,onCheckedChange:l,className:le("relative flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border-0 bg-kumo-base ring after:absolute after:-inset-x-3 after:-inset-y-2 focus:outline-none",s&&"mt-0.5",i==="error"?"ring-kumo-danger":"ring-kumo-hairline",!r&&"hover:ring-kumo-hairline focus:ring-2 focus:ring-kumo-focus focus-visible:ring-2 focus-visible:ring-kumo-brand","data-[checked]:bg-kumo-contrast data-[checked]:ring-kumo-contrast data-[indeterminate]:bg-kumo-contrast data-[indeterminate]:ring-kumo-contrast",r&&"cursor-not-allowed opacity-50",t),...p,children:m.jsx(_k,{keepMounted:!0,className:"flex items-center justify-center text-kumo-inverse data-[unchecked]:invisible",render:(y,b)=>m.jsx("span",{...y,children:b.indeterminate?m.jsx(Kv,{weight:"bold",size:12}):m.jsx(Fr,{weight:"bold",size:12})})})});return s?m.jsx(u5,{className:"inline-flex",children:m.jsxs(d5,{className:le("!m-0 inline-flex !min-h-0 items-start gap-2 !text-base",a?"flex-row":"flex-row-reverse justify-end",r?"cursor-not-allowed":"cursor-pointer"),children:[O,m.jsx(g8,{showOptional:u===!1,tooltip:o,asContent:!0,children:s})]})}):O});cF.displayName="Checkbox";const uF=c.forwardRef(({className:t,checked:e,indeterminate:n,disabled:r,variant:i="default",label:s,value:o,onCheckedChange:a,name:l},u)=>{const{controlFirst:f}=c.useContext(lF);return m.jsxs("label",{"data-kumo-component":"Checkbox","data-kumo-part":"item-label",className:le("relative m-0 inline-flex items-start gap-2",!f&&"flex-row-reverse justify-end",r?"cursor-not-allowed opacity-50":"cursor-pointer",t),children:[m.jsx(Fk,{ref:u,"data-kumo-component":"Checkbox","data-kumo-part":"item",value:o,name:l,checked:e,indeterminate:n,disabled:r,onCheckedChange:a,className:le("peer relative mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border-0 bg-kumo-base ring after:absolute after:-inset-x-3 after:-inset-y-2",i==="error"?"ring-kumo-danger":"ring-kumo-hairline",!r&&"group-hover:ring-kumo-hairline hover:ring-kumo-hairline focus:ring-2 focus:ring-kumo-focus focus-visible:ring-2 focus-visible:ring-kumo-brand","data-[checked]:bg-kumo-contrast data-[checked]:ring-kumo-contrast data-[indeterminate]:bg-kumo-contrast data-[indeterminate]:ring-kumo-contrast"),children:m.jsx(_k,{keepMounted:!0,className:"flex items-center justify-center text-kumo-inverse data-[unchecked]:invisible",render:(p,g)=>m.jsx("span",{...p,children:g.indeterminate?m.jsx(Kv,{weight:"bold",size:12}):m.jsx(Fr,{weight:"bold",size:12})})})}),m.jsx("span",{className:"text-base text-kumo-default",children:s})]})});uF.displayName="Checkbox.Item";function dF({children:t,className:e}){return m.jsx(L1,{className:le("text-base font-medium text-kumo-default",e),children:t})}dF.displayName="Checkbox.Legend";function D6e({legend:t,children:e,error:n,description:r,defaultValue:i,value:s,onValueChange:o,allValues:a,disabled:l,controlFirst:u=!0,className:f}){return m.jsx(lF.Provider,{value:{controlFirst:u},children:m.jsx(sF,{defaultValue:i,value:s,onValueChange:o,allValues:a,disabled:l,children:m.jsxs(Vk,{className:le("flex flex-col gap-4 p-0",f),children:[t&&m.jsx(L1,{className:"text-base font-medium text-kumo-default",children:t}),m.jsx("div",{className:"flex flex-col gap-2",children:e}),n&&m.jsx("p",{className:"text-sm text-kumo-danger",children:n}),r&&m.jsx("p",{className:"text-sm text-kumo-subtle",children:r})]})})})}const zk=Object.assign(cF,{Item:uF,Group:D6e,Legend:dF});zk.displayName="Checkbox";function H6e(){const[,t]=c.useState({});return c.useCallback(()=>{t({})},[])}function RM(t){const e=hi(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=on(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r;return(Ud(n)!==s||Ud(r)!==o)&&(n=s,r=o),{width:n,height:r}}const F6e="data-composite-item-active";function _6e(t){const{loopFocus:e=!0,orientation:n="both",grid:r,onLoop:i,direction:s,highlightedIndex:o,onHighlightedIndexChange:a,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:f,disabledIndices:p,modifierKeys:g=ir}=t,[O,y]=c.useState(0),b=r!=null,v=c.useRef(null),w=ns(v,l),C=c.useRef([]),S=c.useRef(!1),A=c.useRef(null),P=o??O,T=Ee((M,V=!1)=>{if(A.current=C.current[M]??null,(a??y)(M),V){const Z=C.current[M];DA(v.current,Z,s,n)}}),$=Ee(M=>{var B;if(M.size===0)return;if(S.current){const H=C.current,U=H.indexOf(A.current);if(U===-1){const q=H[P];!q||Tl(H,P,p)?T(z6e(H,p)):A.current=q}else U!==P&&T(U);return}S.current=!0;const V=Array.from(M.keys()),Z=V.find(H=>H==null?void 0:H.hasAttribute("data-composite-item-active"))??null,D=Z?((B=M.get(Z))==null?void 0:B.index)??-1:-1;if(D!==-1)T(D);else if(Tl(V,P,p)){const H=Cr(V,{disabledIndices:p});Ml(V,H)||T(H)}DA(v.current,Z,s,n)});Pe(()=>{if(p==null||o!=null||!S.current)return;const M=C.current;if(Tl(M,P,p)){const V=Cr(M,{disabledIndices:p});Ml(M,V)||T(V)}},[p,o,P,C,T]);const I=Ee((M,V,Z)=>i?i(M,V,Z,C):Z),L=Ee(M=>{const V=M.key==="Home"||M.key==="End";if(!w8.has(M.key)||!u&&V||B6e(M,g)||!v.current)return;const Z=s==="rtl",D=Z?Gy:Ky,B=Z?Ky:Gy,H=n==="vertical"?WQ:D,U=n==="vertical"?XQ:B,q=ln(M.nativeEvent);if(q!=null&&VA(q)&&!k5(q)){const N=q.selectionStart,z=q.selectionEnd,J=q.value;if(N==null||M.shiftKey||N!==z||M.key!==U&&N<J.length||M.key!==H&&N>0)return}let W=P;const X=zm(C,p),R=Bx(C,p);r!=null&&(W=r({disabledIndices:p,elementsRef:C,event:M,highlightedIndex:P,loopFocus:e,maxIndex:R,minIndex:X,onLoop:I,orientation:n,rtl:Z}));const Q=n!=="vertical"&&M.key===D||n!=="horizontal"&&M.key==="ArrowDown",F=n!=="vertical"&&M.key===B||n!=="horizontal"&&M.key==="ArrowUp";u&&(M.key==="Home"?W=X:M.key==="End"&&(W=R)),W===P&&(Q||F)&&(e&&W===R&&Q?(W=X,i&&(W=i(M,P,W,C))):e&&W===X&&F?(W=R,i&&(W=i(M,P,W,C))):W=Cr(C.current,{startingIndex:W,decrement:F,disabledIndices:p})),W!==P&&!Ml(C.current,W)&&(f&&M.stopPropagation(),(b||V||Q||F)&&M.preventDefault(),T(W,!0),queueMicrotask(()=>{var N;(N=C.current[W])==null||N.focus()}))});return{props:{ref:w,onFocus(M){const V=v.current,Z=ln(M.nativeEvent);!V||Z==null||!VA(Z)||Z.setSelectionRange(0,Z.value.length)},onKeyDown:L},highlightedIndex:P,onHighlightedIndexChange:T,elementsRef:C,onMapChange:$,relayKeyboardEvent:L}}function z6e(t,e){let n=-1;for(let r=0;r<t.length;r+=1){const i=t[r];if(!(!i||Tl(t,r,e))){if(i.hasAttribute("data-composite-item-active"))return r;n===-1&&(n=r)}}return Math.max(n,0)}function B6e(t,e){for(const n of oce)if(!e.includes(n)&&t.getModifierState(n))return!0;return!1}function X6e(t){const{render:e,className:n,style:r,refs:i=ir,props:s=ir,state:o=Ut,stateAttributesMapping:a,highlightedIndex:l,onHighlightedIndexChange:u,orientation:f,grid:p,loopFocus:g,onLoop:O,enableHomeAndEndKeys:y,onMapChange:b,stopEventPropagation:v=!0,rootRef:w,disabledIndices:C,modifierKeys:S,highlightItemOnHover:A=!1,tag:P="div",...T}=t,{props:$,highlightedIndex:I,onHighlightedIndexChange:L,elementsRef:M,onMapChange:V,relayKeyboardEvent:Z}=_6e({grid:p,loopFocus:g,onLoop:O,orientation:f,highlightedIndex:l,onHighlightedIndexChange:u,rootRef:w,stopEventPropagation:v,enableHomeAndEndKeys:y,direction:Aa(),disabledIndices:C,modifierKeys:S}),D=He(P,t,{state:o,ref:i,props:[$,...s,T],stateAttributesMapping:a}),B=c.useMemo(()=>({highlightedIndex:I,onHighlightedIndexChange:L,highlightItemOnHover:A,relayKeyboardEvent:Z}),[I,L,A,Z]);return m.jsx(g5.Provider,{value:B,children:m.jsx(C0,{elementsRef:M,onMapChange:H=>{b==null||b(H),V(H)},children:D})})}function W6e(){return qt}function q6e(){return!1}function U6e(){return!0}function Y6e(){return D2.useSyncExternalStore(W6e,q6e,U6e)}function G6e(t){const{script:e}=t,{nonce:n}=l3();return Y6e()?m.jsx("script",{nonce:n,dangerouslySetInnerHTML:{__html:e},suppressHydrationWarning:!0}):null}const Bk=c.createContext(void 0);Bk.displayName="TabsRootContext";function Xk(){const t=c.useContext(Bk);if(t===void 0)throw new Error("Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.");return t}const K6e="data-activation-direction",z8={tabActivationDirection:t=>({[K6e]:t})},fF=c.forwardRef(function(e,n){const{className:r,defaultValue:i=0,onValueChange:s,orientation:o="horizontal",render:a,value:l,style:u,...f}=e,p=e.defaultValue!==void 0,g=c.useRef([]),[O,y]=c.useState(()=>new Map),[b,v]=Ji({controlled:l,default:i,name:"Tabs",state:"value"}),w=l!==void 0,[C,S]=c.useState(()=>new Map),A=c.useRef(void 0),P=c.useCallback(ne=>Tb(C,ne),[C]),[T,$]=c.useState(()=>({previousValue:b,tabActivationDirection:"none"})),{previousValue:I,tabActivationDirection:L}=T;let M=L,V=!1;I!==b&&(M=jM(I,b,o,C),V=I!=null&&b!=null&&P(b)==null);const Z=V?I:b,D=I!==Z||L!==M;Pe(()=>{D&&$({previousValue:Z,tabActivationDirection:M})},[Z,D,M]);const B=Ee((ne,se)=>{se.activationDirection=jM(b,ne,o,C),s==null||s(ne,se),!se.isCanceled&&v(ne)}),H=Ee((ne,se)=>{s==null||s(ne,_e(se,void 0,void 0,{activationDirection:"none"}))}),U=Ee((ne,se)=>(y(ie=>{const he=new Map(ie);return he.set(ne,se),he}),()=>{y(ie=>{if(ie.get(ne)!==se)return ie;const he=new Map(ie);return he.delete(ne),he})})),q=c.useCallback(ne=>O.get(ne),[O]),W=c.useCallback(ne=>{for(const se of C.values())if(ne===se.value)return se.id},[C]),X=c.useMemo(()=>({getTabElementBySelectedValue:P,getTabIdByPanelValue:W,getTabPanelIdByValue:q,onValueChange:B,orientation:o,registerMountedTabPanel:U,setTabMap:S,tabActivationDirection:M,value:b}),[P,W,q,B,o,U,S,M,b]),R=c.useMemo(()=>{for(const ne of C.values())if(ne.value===b)return ne},[C,b]),Q=c.useMemo(()=>{for(const ne of C.values())if(!ne.disabled)return ne.value},[C]),F=c.useRef(!p),N=c.useRef(i),z=c.useRef(p),J=c.useRef(!1);Pe(()=>{var Se;if(w)return;function ne(Oe,be){v(Oe),$({previousValue:Oe,tabActivationDirection:"none"}),H(Oe,be),F.current=!1}if(C.size===0){J.current&&b!==null&&!((Se=A.current)!=null&&Se.isConnected)&&ne(null,$9);return}J.current=!0,A.current=C.keys().next().value;const se=R==null?void 0:R.disabled,ie=R==null&&b!==null;if(!se&&b===N.current&&(z.current=!1),z.current&&se&&b===N.current)return;const he=F.current;if(se||ie){const Oe=Q??null;if(b===Oe){F.current=!1;return}let be=$9;he?be=L9:se&&(be=_R),ne(Oe,be);return}he&&R!=null&&(H(b,L9),F.current=!1)},[Q,w,H,R,v,C,b]);const K=He("div",e,{state:{orientation:o,tabActivationDirection:M},ref:n,props:f,stateAttributesMapping:z8});return m.jsx(Bk.Provider,{value:X,children:m.jsx(C0,{elementsRef:g,children:K})})});fF.displayName="TabsRoot";function Tb(t,e){for(const[n,r]of t.entries())if(e===r.value)return n;return null}function jM(t,e,n,r){if(t==null||e==null)return"none";const[i,s,o]=n==="horizontal"?["left","left","right"]:["top","up","down"],a=Tb(r,t),l=Tb(r,e);if(a==null||l==null)return a!==l&&(typeof t=="number"||typeof t=="string")&&typeof t==typeof e?e>t?o:s:"none";const u=a.getBoundingClientRect()[i],f=l.getBoundingClientRect()[i];return f<u?s:f>u?o:"none"}const Wk=c.createContext(void 0);Wk.displayName="TabsListContext";function hF(){const t=c.useContext(Wk);if(t===void 0)throw new Error("Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.");return t}const pF=c.forwardRef(function(e,n){const{className:r,disabled:i=!1,render:s,value:o,id:a,nativeButton:l=!0,style:u,...f}=e,{value:p,getTabPanelIdByValue:g,onValueChange:O,orientation:y,tabActivationDirection:b}=Xk(),{activateOnFocus:v,registerTabResizeObserverElement:w,tabsListElement:C}=hF(),{highlightedIndex:S,onHighlightedIndexChange:A}=v8(),P=Pn(a),T=c.useMemo(()=>({disabled:i,id:P,value:o}),[i,P,o]),{compositeProps:$,compositeRef:I,index:L}=PH({metadata:T}),M=o===p,V=c.useRef(!1),Z=c.useRef(null),D=Ee(N=>{var z;(z=Z.current)==null||z.call(Z),Z.current=N?w(N):null});Pe(()=>{if(V.current){V.current=!1;return}if(!(M&&L>-1&&S!==L))return;const N=C;if(N!=null){const z=Gn(Ct(N));if(z&&Ue(N,z))return}i||A(L)},[M,L,S,A,i,C]);const{getButtonProps:B,buttonRef:H}=Tr({disabled:i,native:l,focusableWhenDisabled:!0}),U=g(o),q=c.useRef(!1),W=c.useRef(!1);function X(N){O(o,_e(_n,N.nativeEvent,void 0,{activationDirection:"none"}))}function R(N){M||i||X(N)}function Q(N){M||i||v&&(!q.current||W.current)&&X(N)}function F(N){if(M||i)return;q.current=!0,W.current=N.button===0;const z=Ct(N.currentTarget);function J(){q.current=!1,W.current=!1,z.removeEventListener("pointerup",J),z.removeEventListener("pointercancel",J)}z.addEventListener("pointerup",J),z.addEventListener("pointercancel",J)}return He("button",e,{state:{disabled:i,active:M,orientation:y,tabActivationDirection:b},ref:[n,H,I,D],props:[$,{role:"tab","aria-controls":U,"aria-selected":M,id:P,onClick:R,onFocus:Q,onPointerDown:F,[F6e]:M?"":void 0,onKeyDownCapture(){V.current=!0}},f,B],stateAttributesMapping:z8})});pF.displayName="TabsTab";const J6e="--active-tab-left",eOe="--active-tab-right",tOe="--active-tab-top",nOe="--active-tab-bottom",rOe="--active-tab-width",iOe="--active-tab-height";var IM;const sOe={...z8,activeTabPosition:()=>null,activeTabSize:()=>null},$M=2,mF=c.forwardRef(function(e,n){const{className:r,render:i,renderBeforeHydration:s=!1,style:o,...a}=e,{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:f,value:p}=Xk(),{tabsListElement:g,registerIndicatorUpdateListener:O}=hF(),y=H6e();c.useEffect(()=>O(y),[O,y]);let b=0,v=0,w=0,C=0,S=0,A=0,P=!1;if(p!=null&&g!=null){const M=l(p);if(M!=null){P=!0;const{width:V,height:Z}=RM(M),{width:D,height:B}=RM(g),H=M.getBoundingClientRect(),U=g.getBoundingClientRect(),q=D>0?U.width/D:1,W=B>0?U.height/B:1,X=oOe(M,g);b=X.left,w=X.top;const R=(H.left-U.left)/q+g.scrollLeft-g.clientLeft,Q=(H.top-U.top)/W+g.scrollTop-g.clientTop,F=aOe(M);Math.abs(R-F.x-b)<=$M&&Math.abs(Q-F.y-w)<=$M&&(b=R,w=Q),S=V,A=Z,v=g.scrollWidth-b-S,C=g.scrollHeight-w-A}}const T=P?{left:b,right:v,top:w,bottom:C}:null,$=P?{width:S,height:A}:null,I=P?{[J6e]:`${b}px`,[eOe]:`${v}px`,[tOe]:`${w}px`,[nOe]:`${C}px`,[rOe]:`${S}px`,[iOe]:`${A}px`}:void 0,L=He("span",e,{state:{orientation:u,activeTabPosition:T,activeTabSize:$,tabActivationDirection:f},ref:n,props:[{role:"presentation",style:I,hidden:!(P&&S>0&&A>0)},a,{suppressHydrationWarning:!0}],stateAttributesMapping:sOe});return p==null?null:m.jsxs(c.Fragment,{children:[L,s&&(IM||(IM=m.jsx(G6e,{script:""})))]})});mF.displayName="TabsIndicator";function oOe(t,e){const n=LM(t),r=LM(e);let i=n.left-r.left-e.clientLeft,s=n.top-r.top-e.clientTop,o=Ws(t);for(;on(o)&&o!==e&&!Io(o);)i-=o.scrollLeft,s-=o.scrollTop,o=Ws(o);return{left:i,top:s}}function LM(t){let e=0,n=0,r=t;for(;r!=null;){e+=r.offsetLeft,n+=r.offsetTop;const i=r.offsetParent;i!=null&&(e+=i.clientLeft,n+=i.clientTop),r=i}return{left:e,top:n}}function aOe(t){const e=un(t).getComputedStyle(t),{x:n,y:r}=VD(t,e);let i=n,s=r;const{translate:o}=e;if(o&&o!=="none"){const a=o.split(" ");i+=NM(a[0],t.offsetWidth),s+=NM(a[1],t.offsetHeight)}return{x:i,y:s}}function NM(t,e){if(!t)return 0;const n=parseFloat(t);return Number.isFinite(n)?t.endsWith("%")?n/100*e:n:0}const gF=c.forwardRef(function(e,n){const{activateOnFocus:r=!1,className:i,loopFocus:s=!0,render:o,style:a,...l}=e,{orientation:u,setTabMap:f,tabActivationDirection:p}=Xk(),[g,O]=c.useState(0),[y,b]=c.useState(null),v=c.useRef(new Set),w=c.useRef(new Set),C=c.useRef(null);Pe(()=>{if(typeof ResizeObserver>"u")return;const I=new ResizeObserver(()=>{v.current.forEach(L=>{L()})});return C.current=I,y&&I.observe(y),w.current.forEach(L=>{I.observe(L)}),()=>{I.disconnect(),C.current=null}},[y]);const S=Ee(I=>(v.current.add(I),()=>{v.current.delete(I)})),A=Ee(I=>{var L;return w.current.add(I),(L=C.current)==null||L.observe(I),()=>{var M;w.current.delete(I),(M=C.current)==null||M.unobserve(I)}}),P={orientation:u,tabActivationDirection:p},T={"aria-orientation":u==="vertical"?"vertical":void 0,role:"tablist"},$=c.useMemo(()=>({activateOnFocus:r,registerIndicatorUpdateListener:S,registerTabResizeObserverElement:A,tabsListElement:y}),[r,S,A,y]);return m.jsx(Wk.Provider,{value:$,children:m.jsx(X6e,{render:o,className:i,style:a,state:P,refs:[n,b],props:[T,l],stateAttributesMapping:z8,highlightedIndex:g,enableHomeAndEndKeys:!0,loopFocus:s,orientation:u,onHighlightedIndexChange:O,onMapChange:f,disabledIndices:ir})})});gF.displayName="TabsList";const QM={variant:"segmented",size:"base"},lOe={scrollStart:"Scroll tabs left",scrollEnd:"Scroll tabs right"};function rc({tabs:t,value:e,selectedValue:n,onValueChange:r,activateOnFocus:i,className:s,listClassName:o,indicatorClassName:a,labels:l,variant:u=QM.variant,size:f=QM.size}){var I;const p=t??[];if(p.length===0)return null;const g=(I=p[0])==null?void 0:I.value,O=e!==void 0,y={value:O?e:void 0,defaultValue:O?void 0:n??g},b=u==="segmented",v=u==="underline",w=f==="sm",C={...lOe,...l},{ref:S,isOverflowing:A,canScrollStart:P,canScrollEnd:T}=dOe(!0,p.map(L=>L.value).join("|")),$=uOe(S,A);return m.jsxs(fF,{...y,className:le("relative isolate min-w-0 font-medium",b&&(w?"rounded-md":"rounded-lg")+" ring ring-kumo-hairline/70",s),onValueChange:L=>{r==null||r(String(L))},children:[b&&m.jsx("div",{className:le("absolute inset-x-0 top-1/2 z-0 -translate-y-1/2 rounded-lg bg-kumo-recessed",w?"h-6.5":"h-9")}),m.jsxs(gF,{ref:S,activateOnFocus:i,"data-overflowing":A?"":void 0,"data-overflow-start":P?"":void 0,"data-overflow-end":T?"":void 0,...$(),className:le("kumo-tabs-list relative flex min-w-0 shrink scroll-px-(--scroll-fade-width) items-stretch overflow-x-auto overflow-y-hidden [--scroll-fade-width:3rem]",b&&"rounded-lg bg-kumo-recessed px-0.5",b&&(w?"h-6.5 rounded-md":"h-9"),A&&"cursor-grab active:cursor-grabbing",v&&"gap-4 border-b border-kumo-hairline pb-2",v&&(w?"h-6.5":"h-7.5"),o),children:[p.map(L=>m.jsx(pF,{"data-kumo-component":"Tabs","data-kumo-part":"tab",value:L.value,render:L.render,nativeButton:L.nativeButton,onClick:M=>{M.currentTarget.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},className:le("relative z-2 flex items-center rounded bg-transparent whitespace-nowrap focus:ring-kumo-focus/50 focus:outline-none focus-visible:ring-2 focus-visible:ring-kumo-brand",A?"cursor-grab active:cursor-grabbing":"cursor-pointer",w?"text-xs":"text-base",b&&"my-0.5 text-kumo-subtle hover:text-kumo-default focus-visible:ring-inset aria-selected:text-kumo-default",b&&(w?"rounded-sm px-2":"rounded-md px-2.5"),v&&"text-kumo-subtle hover:bg-kumo-tint hover:text-kumo-default aria-selected:font-medium aria-selected:text-kumo-default aria-selected:hover:bg-kumo-tint",v&&(w?"px-1.5 py-2.5":"px-2 py-3"),L.className),children:L.label},L.value)),m.jsx(mF,{render:L=>m.jsx("div",{...L,className:le("absolute left-0 z-1","w-(--active-tab-width) translate-x-(--active-tab-left) transition-all duration-200","data-[rendered=false]:scale-90 data-[rendered=false]:opacity-0",b&&le("top-(--active-tab-top) h-(--active-tab-height) bg-kumo-base shadow-sm ring ring-kumo-line",w?"rounded":"rounded-md"),v&&"bottom-0 h-0.5 bg-kumo-brand",a)})})]}),b&&m.jsxs(m.Fragment,{children:[m.jsx(ZM,{side:"start",visible:P,variant:u,size:f,label:C.scrollStart,onClick:()=>VM(S,"start")}),m.jsx(ZM,{side:"end",visible:T,variant:u,size:f,label:C.scrollEnd,onClick:()=>VM(S,"end")})]})]})}function ZM({side:t,visible:e,variant:n,size:r,label:i,onClick:s}){const o=t==="start",a=n==="segmented";return m.jsx("button",{type:"button","data-kumo-component":"Tabs","data-kumo-part":"overflow-control","data-side":t,"aria-label":i,"aria-hidden":!e,tabIndex:e?0:-1,onClick:s,className:le("absolute inset-y-0 z-3 flex items-center border-0 bg-transparent p-0 transition-opacity duration-150 focus:outline-none focus-visible:[&>span]:ring-2 focus-visible:[&>span]:ring-kumo-brand",o?"left-0 justify-start bg-linear-to-r":"right-0 justify-end bg-linear-to-l",e?"pointer-events-auto opacity-100":"pointer-events-none opacity-0",a?"from-kumo-recessed via-kumo-recessed/95 to-transparent":"from-kumo-base via-kumo-base/95 to-transparent",a&&(r==="sm"?"w-8 rounded-md":"w-10 rounded-lg"),!a&&"w-8"),children:m.jsx("span",{className:le("flex items-center justify-center text-kumo-subtle transition-colors hover:text-kumo-default",r==="sm"?"size-5":"size-6",a?r==="sm"?"rounded-sm":"rounded-md":"rounded",o?"ml-1":"mr-1"),children:m.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"size-3.5","aria-hidden":"true",children:m.jsx("path",{d:o?"M9.25 4.25L5.75 8L9.25 11.75":"M6.75 4.25L10.25 8L6.75 11.75",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})})})}function VM(t,e){const n=t.current;if(!n)return;const r=Array.from(n.querySelectorAll('[data-kumo-part="tab"]')),i=cOe(n.clientWidth,r);n.scrollBy({left:e==="start"?-i:i,behavior:"smooth"})}function cOe(t,e){let n=0;for(const r of e){const i=r.offsetWidth;if(n+i>t)return n||t;n+=i}return Math.max(80,Math.floor(t*.8))}function uOe(t,e){const n=c.useRef(null),r=c.useRef(!1);return()=>({onPointerDownCapture:i=>{const s=t.current;!s||!e||i.pointerType!=="mouse"||i.button!==0||(n.current={pointerId:i.pointerId,startX:i.clientX,scrollLeft:s.scrollLeft,dragging:!1},r.current=!1)},onPointerMoveCapture:i=>{const s=t.current,o=n.current;if(!s||!e||!o||o.pointerId!==i.pointerId)return;const a=i.clientX-o.startX;if(!o.dragging){if(Math.abs(a)<=3)return;o.dragging=!0,r.current=!0,s.setPointerCapture(i.pointerId)}i.preventDefault(),s.scrollLeft=o.scrollLeft-a},onPointerUpCapture:i=>{const s=t.current,o=n.current;!s||!o||o.pointerId!==i.pointerId||(n.current=null,s.hasPointerCapture(i.pointerId)&&s.releasePointerCapture(i.pointerId),r.current&&window.setTimeout(()=>{r.current=!1},0))},onPointerCancelCapture:i=>{const s=t.current,o=n.current;!s||!o||o.pointerId!==i.pointerId||(n.current=null,s.hasPointerCapture(i.pointerId)&&s.releasePointerCapture(i.pointerId))},onClickCapture:i=>{r.current&&(i.preventDefault(),i.stopPropagation(),r.current=!1)}})}function dOe(t,e){const n=c.useRef(null),[r,i]=c.useState({isOverflowing:!1,canScrollStart:!1,canScrollEnd:!1});return c.useLayoutEffect(()=>{const s=n.current;s&&i(o=>DM(s,o))},[t,e]),c.useEffect(()=>{const s=n.current;if(!s)return;const o=()=>{i(u=>DM(s,u))},a=new ResizeObserver(o);a.observe(s);const l=new MutationObserver(o);return l.observe(s,{childList:!0,characterData:!0,subtree:!0}),s.addEventListener("scroll",o,{passive:!0}),o(),()=>{a.disconnect(),l.disconnect(),s.removeEventListener("scroll",o)}},[t]),{ref:n,...r}}function DM(t,e){const n=Math.max(0,t.scrollWidth-t.clientWidth),r=Math.min(Math.max(0,t.scrollLeft),n),i={isOverflowing:n>1,canScrollStart:r>1,canScrollEnd:n-r>1};return e.isOverflowing===i.isOverflowing&&e.canScrollStart===i.canScrollStart&&e.canScrollEnd===i.canScrollEnd?e:i}function fOe({initialProjectId:t,initialKind:e,initialParentId:n}){const{data:r}=Qi(),[i,s]=c.useState(e??"task"),[o,a]=c.useState(t??""),[l,u]=c.useState(""),[f,p]=c.useState(""),[g,O]=c.useState(""),[y,b]=c.useState(""),[v,w]=c.useState("none"),[C,S]=c.useState("none"),[A,P]=c.useState(1),[T,$]=c.useState("scheduled"),[I,L]=c.useState(!1),[M,V]=c.useState(n??""),Z=TD(),D=MD(),{close:B}=cr(),{open:H}=ro(),U=r==null?void 0:r.find(Q=>Q.id===o),q=i==="note",W=q||!!n,{data:X}=ok(W&&o?o:void 0,["task"]),R=o.length>0&&(q?l.trim().length>0||f.trim().length>0:l.trim().length>0&&(C==="none"||y.length>0));return m.jsx(v2,{title:"Quick create",width:"sm:w-xl",children:m.jsxs("form",{onSubmit:async Q=>{if(Q.preventDefault(),!R)return;const F=l.trim(),N=g.split(",").map(J=>J.trim()).filter(Boolean),z=i==="task"?await Z.mutateAsync({kind:"task",projectId:o,title:F,body:f.trim(),tags:N,actorKind:"human",dueAt:y?new Date(y).toISOString():null,priority:v,parentId:M||null}):await Z.mutateAsync({kind:"note",projectId:o,title:F||null,body:f.trim(),tags:N,actorKind:"human",pinned:I,parentId:M||null});i==="task"&&C!=="none"&&await D.mutateAsync({taskId:z.id,input:{preset:C,interval:A,anchor:T,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,allDay:!0}}),B(),H(z.id)},className:"p-4 space-y-3",children:[m.jsxs("div",{className:"flex gap-2",children:[m.jsx(rc,{variant:"segmented",tabs:c8e.map(Q=>({value:Q,label:m.jsx("span",{className:"capitalize",children:p2[Q]})})),value:i,onValueChange:Q=>s(Q),className:"shrink-0"}),m.jsxs(Qc,{"aria-label":"Project",className:"flex-1",value:o,onChange:Q=>a(Q.target.value),children:[m.jsx("option",{value:"",children:"— pick a project —"}),r==null?void 0:r.map(Q=>m.jsxs("option",{value:Q.id,children:[Q.key," · ",Q.name]},Q.id))]})]}),m.jsx(mr,{autoFocus:!0,"aria-label":"Title",className:"w-full",placeholder:q?"Title (optional)":"Title",value:l,onChange:Q=>u(Q.target.value)}),m.jsx(O8,{"aria-label":"Body",className:"h-32 w-full resize-y py-1.5 font-mono text-xs leading-snug",placeholder:"Body (Markdown, optional)",value:f,onChange:Q=>p(Q.target.value)}),m.jsxs("div",{className:"flex flex-wrap gap-2",children:[m.jsx(mr,{"aria-label":"Tags",className:"min-w-48 flex-1",placeholder:"Tags (comma-separated, optional)",value:g,onChange:Q=>O(Q.target.value)}),i==="task"&&m.jsxs(m.Fragment,{children:[m.jsx(mr,{type:"date","aria-label":"Due date",className:"flex-1 sm:w-36 sm:flex-none",value:y,onChange:Q=>b(Q.target.value),title:"Due date"}),m.jsx(Qc,{"aria-label":"Priority",className:"flex-1 sm:w-36 sm:flex-none",value:v,onChange:Q=>w(Q.target.value),title:"Priority",children:jD.map(Q=>m.jsx("option",{value:Q,children:xu[Q]},Q))})]})]}),i==="task"&&m.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_84px_132px] gap-2",children:[m.jsxs(Qc,{"aria-label":"Repeat",value:C,onChange:Q=>S(Q.target.value),title:"Repeat",children:[m.jsx("option",{value:"none",children:"Repeat: none"}),m.jsx("option",{value:"hourly",children:"Hourly"}),m.jsx("option",{value:"daily",children:"Daily"}),m.jsx("option",{value:"weekly",children:"Weekly"}),m.jsx("option",{value:"monthly",children:"Monthly"}),m.jsx("option",{value:"yearly",children:"Yearly"})]}),m.jsx(mr,{type:"number",min:1,max:999,"aria-label":"Repeat interval",className:"w-full",value:A,disabled:C==="none",onChange:Q=>P(Math.max(1,Number(Q.target.value)||1)),title:"Repeat interval"}),m.jsxs(Qc,{"aria-label":"Repeat anchor",value:T,disabled:C==="none",onChange:Q=>$(Q.target.value),title:"Repeat anchor",children:[m.jsx("option",{value:"scheduled",children:"Scheduled"}),m.jsx("option",{value:"completion",children:"Completion"})]})]}),i==="task"&&v!=="none"&&m.jsxs("div",{className:"flex items-center gap-1.5 text-xxs text-kumo-subtle",children:[m.jsx(zl,{priority:v,size:11}),m.jsxs("span",{children:[xu[v]," priority"]})]}),q&&m.jsx(zk,{label:"📌 Pin to project — auto-include in agent opening brief",checked:I,onCheckedChange:L}),W&&X&&X.length>0&&m.jsxs("div",{className:"flex items-center gap-2 text-sm text-kumo-subtle",children:[m.jsx("span",{className:"shrink-0",children:q?"Link to task:":"Sub-task of:"}),m.jsxs(Qc,{size:"sm","aria-label":q?"Link to task":"Parent task",className:"flex-1",value:M,onChange:Q=>V(Q.target.value),children:[m.jsx("option",{value:"",children:"— none —"}),X.map(Q=>m.jsxs("option",{value:Q.id,children:[U!=null&&U.key&&Q.sequenceId?`${U.key}-${Q.sequenceId} · `:"",Or(Q)]},Q.id))]})]}),m.jsxs("div",{className:"flex justify-end sm:justify-between items-center pt-1",children:[m.jsxs("div",{className:"hidden sm:block text-xxs text-kumo-subtle",children:[m.jsx("kbd",{children:"⌘"}),"+",m.jsx("kbd",{children:"Enter"})," to submit · ",m.jsx("kbd",{children:"Esc"})," to close"]}),m.jsxs("div",{className:"flex gap-2",children:[m.jsx(nt,{type:"button",onClick:B,children:"Cancel"}),m.jsx(nt,{type:"submit",variant:"primary",disabled:!R||Z.isPending,children:Z.isPending?"Creating…":`Create ${p2[i]}`})]})]}),Z.error&&m.jsx("div",{className:"text-xs text-kumo-danger",children:Z.error.message})]})})}function qk(t){return Array.isArray(t)?t.map(e=>qk(e)).join(","):t==null?"":String(t)}function hOe(t,e,n,r,i,s,o,a,l,u=2){const f=tY(n.current,{event:t,orientation:r,loopFocus:i,rtl:s,cols:u,disabledIndices:o,minIndex:a,maxIndex:l,prevIndex:e>l?a:e,stopEvent:!0});return Ml(n.current,f)?void 0:f}const Uk=c.createContext(void 0);Uk.displayName="ComboboxRootContext";const Yk=c.createContext(void 0);Yk.displayName="ComboboxFloatingContext";const Gk=c.createContext(void 0);Gk.displayName="ComboboxDerivedItemsContext";const Kk=c.createContext(!1);Kk.displayName="ComboboxHasItemsContext";const Jk=c.createContext("");Jk.displayName="ComboboxInputValueContext";function zr(){const t=c.useContext(Uk);if(!t)throw new Error("Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>.");return t}function B8(){const t=c.useContext(Yk);if(!t)throw new Error("Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>.");return t}function N1(){const t=c.useContext(Gk);if(!t)throw new Error("Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>.");return t}function ew(){return c.useContext(Jk)}function pOe(){return c.useContext(Kk)}const mOe={id:t=>t.id,labelId:t=>t.labelId,items:t=>t.items,selectedValue:t=>t.selectedValue,hasSelectionChips:t=>{const e=t.selectedValue;return Array.isArray(e)&&e.length>0},hasSelectedValue:t=>{const{selectedValue:e,selectionMode:n}=t;return e==null?!1:n==="multiple"&&Array.isArray(e)?e.length>0:!0},hasNullItemLabel:(t,e)=>e?VQ(t.items):!1,open:t=>t.open,mounted:t=>t.mounted,forceMounted:t=>t.forceMounted,inline:t=>t.inline,activeIndex:t=>t.activeIndex,selectedIndex:t=>t.selectedIndex,isActive:(t,e)=>t.activeIndex===e,isSelected:(t,e)=>{const n=t.isItemEqualToValue,r=t.selectedValue;return Array.isArray(r)?r.some(i=>Es(e,i,n)):Es(e,r,n)},transitionStatus:t=>t.transitionStatus,popupProps:t=>t.popupProps,listProps:t=>t.listProps,inputProps:t=>t.inputProps,triggerProps:t=>t.triggerProps,itemProps:t=>t.itemProps,positionerElement:t=>t.positionerElement,listElement:t=>t.listElement,popupId:t=>t.popupId,triggerElement:t=>t.triggerElement,inputElement:t=>t.inputElement,inputGroupElement:t=>t.inputGroupElement,popupSide:t=>t.popupSide,openMethod:t=>t.openMethod,inputInsidePopup:t=>t.inputInsidePopup,inputOwnsFormValue:t=>t.inputOwnsFormValue,selectionMode:t=>t.selectionMode,name:t=>t.name,form:t=>t.form,disabled:t=>t.disabled,readOnly:t=>t.readOnly,required:t=>t.required,grid:t=>t.grid,virtualized:t=>t.virtualized,itemToStringLabel:t=>t.itemToStringLabel,isItemEqualToValue:t=>t.isItemEqualToValue,modal:t=>t.modal,autoHighlight:t=>t.autoHighlight};function OF(t){return t==null?void 0:`${t}-popup`}function xF(t,e){return(n,r)=>n==null?!1:t.contains(n,r,e)}function gOe(t,e,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const s=(e==null?void 0:e.selected)??e,o=n!=null?Bs(n,s):"";return o&&t.contains(o,i)&&o.length===i.length?!0:t.contains(r,i,e)}}const HM=new Map;function yF(t={}){const e={usage:"search",sensitivity:"base",ignorePunctuation:!0,...t},n=`${qk(t.locale)}|${JSON.stringify(e)}`,r=HM.get(n);if(r)return r;const i=new Intl.Collator(t.locale,e),s={contains(o,a,l){if(!a)return!0;const u=Bs(o,l);for(let f=0;f<=u.length-a.length;f+=1)if(i.compare(u.slice(f,f+a.length),a)===0)return!0;return!1},startsWith(o,a,l){if(!a)return!0;const u=Bs(o,l);return i.compare(u.slice(0,a.length),a)===0},endsWith(o,a,l){if(!a)return!0;const u=Bs(o,l),f=a.length;return u.length>=f&&i.compare(u.slice(u.length-f),a)===0}};return HM.set(n,s),s}const bF=yF;function OOe(t={}){const{multiple:e=!1,value:n,...r}=t,i=yF(r),s=c.useCallback((o,a,l)=>e?xF(i,l)(o,a):gOe(i,l,n)(o,a),[i,n,e]);return c.useMemo(()=>({...i,contains:s}),[s,i])}const vF=Symbol("none"),hx={value:vF,index:-1};function Rb(t,e,n){const r=t.get(e);if(r!==void 0||n===k8)return r;for(const[i,s]of t)if(Es(i,e,n))return s}function kF(t){const{id:e,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:s,defaultInputValue:o,inputValue:a,open:l,defaultOpen:u=!1,selectionMode:f,onItemHighlighted:p,name:g,form:O,disabled:y=!1,readOnly:b=!1,required:v=!1,inputRef:w,grid:C=!1,items:S,filteredItems:A,filter:P,filterQuery:T,openOnInputClick:$=!0,autoHighlight:I=!1,keepHighlight:L=!1,highlightItemOnHover:M=!0,loopFocus:V=!0,itemToStringLabel:Z,itemToStringValue:D,isItemEqualToValue:B=k8,virtualized:H=!1,inline:U=!1,fillInputOnItemPress:q=!0,modal:W=!1,limit:X=-1,autoComplete:R="list",formAutoComplete:Q,locale:F,submitOnItemClick:N=!1}=t,{clearErrors:z}=Fo(),{setDirty:J,validityData:K,setFilled:ne,name:se,disabled:ie,setTouched:he,setFocused:Se,validationMode:Oe,validation:be}=pi(),me=Aa(),ue=Yl({id:e}),ve=bF({locale:F}),xe=Array.isArray(S)?null:S;if(xe&&typeof xe.label!="function")throw new Error("Base UI: the `items` prop received an object that is not a collection, so its items cannot be read. Pass an array of items, an array of groups with items, or the result of `createItems()`. See https://base-ui.com/react/components/combobox#createitems");const Ce=xe?xe.data:S,we=xe==null?void 0:xe.value,Le=we?void 0:Ce,Ie=c.useMemo(()=>{if(!A||!we)return;const Ne=nh(A),ze=Ne.map(we);let vt;return{values:ze,findItem(en,yn){if(!vt){vt=new Map;for(let tn=0;tn<ze.length;tn+=1)vt.has(ze[tn])||vt.set(ze[tn],Ne[tn])}return Rb(vt,en,yn)}}},[A,we]),Fe=c.useMemo(()=>xe?Ne=>xe.label(Ne,B,ze=>{const vt=Ie==null?void 0:Ie.findItem(ze,B);return vt!=null?xe.itemLabel(vt):Bs(ze,Z)}):Z,[xe,Z,Ie,B]),Me=c.useMemo(()=>xe?Object.assign(Ne=>xe.itemLabel(Ne),{selected:Ne=>Bs(Ne,Fe)}):Z,[xe,Fe,Z]);function oe(Ne){return Bs(Ne,Fe)}const[ge,Y]=c.useState(!1),[G,de]=c.useState(null),Ae=c.useRef(G),Re=c.useRef([]),Ge=c.useRef([]),dt=c.useRef(null),Te=c.useRef(null),Ke=c.useRef(null),gt=c.useRef(null),Pt=c.useRef(null),jt=c.useRef(!0),et=c.useRef(!1),Yt=c.useRef(null),Mt=c.useRef(null),Ht=c.useRef(null),an=c.useRef(hx),at=c.useRef(null),ht=c.useRef([]),Xt=c.useRef(null),zt=ie||y,Mn=se??g,rn=f==="multiple",Jn=f==="single",Wn=a!==void 0||o!==void 0,Tn=Ce!==void 0,Ot=A!==void 0;let Tt;I==="always"?Tt="always":Tt=I?"input-change":!1;const[St,ri]=Ji({controlled:i,default:rn?r??ir:r,name:"Combobox",state:"selectedValue"}),xr=c.useMemo(()=>P===null?()=>!0:P!==void 0?P:xF(ve,Me),[P,ve,Me]),Zi=Qn(()=>Wn?o??"":Jn?oe(St):"").current,[Rn,so]=Ji({controlled:a,default:Zi,name:"Combobox",state:"inputValue"}),[dn,ii]=Ji({controlled:l,default:u,name:"Combobox",state:"open"}),ja=O5(Ce),si=!dn&&G!==null?G:String(Rn).trim(),Xo=Jn?oe(St):"",$0=Jn&&!ge&&si!==""&&Xo.length===si.length&&ve.contains(Xo,si),Wo=$0?"":T??si,L0=Tn&&Ot&&$0&&(!xe||xe.hasValue(St,B)),ic=c.useMemo(()=>Ce?nh(Ce):ir,[Ce]),sc=c.useMemo(()=>{if(A&&!L0)return A;if(!Ce)return ir;if(ja){const ze=Ce,vt=[];let en=0;for(const yn of ze){if(X>-1&&en>=X)break;const tn=X>-1?X-en:1/0,fn=Wo===""?yn.items.slice(0,tn):[];if(Wo!=="")for(const qn of yn.items){if(fn.length>=tn)break;xr(qn,Wo,Me)&&fn.push(qn)}if(fn.length>0){const qn={...yn,items:fn};vt.push(qn),en+=fn.length}}return vt}if(Wo==="")return X>-1?ic.slice(0,X):ic;const Ne=[];for(const ze of ic){if(X>-1&&Ne.length>=X)break;xr(ze,Wo,Me)&&Ne.push(ze)}return Ne},[A,L0,Ce,ja,Wo,X,xr,Me,ic]),Rr=c.useMemo(()=>{if(Ie&&sc===A)return Ie.values;const Ne=nh(sc);return we?Ne.map(ze=>we(ze)):Ne},[sc,A,Ie,we]),We=Qn(()=>{let Ne=null;return U&&dn&&Tn&&f!=="none"&&(Ne=th(Rr,St,B,rn)),new wu({id:ue,labelId:void 0,selectedValue:St,open:dn,items:Le,selectionMode:f,name:Mn,form:O,disabled:zt,readOnly:b,required:v,grid:C,virtualized:H,openOnInputClick:$,itemToStringLabel:Fe,isItemEqualToValue:B,modal:W,autoHighlight:Tt,submitOnItemClick:N,hasInputValue:Wn,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:U,activeIndex:null,selectedIndex:Ne,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:Ut,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:f==="none"},{onOpenChangeComplete:qt,setOpen:qt,setInputValue:qt,setSelectedValue:qt,setIndices:qt,handleSelection:qt,forceMount:qt,requestSubmit:qt,listRef:Re,labelsRef:Ge,popupRef:dt,emptyRef:Pt,inputRef:Te,startDismissRef:Ke,endDismissRef:gt,keyboardActiveRef:jt,chipsContainerRef:Yt,clearRef:Mt,valuesRef:ht,pointerDownItemRef:Xt,selectionEventRef:Ht},mOe)}).current,Ia=f==="none"?Rn:St,N0=c.useMemo(()=>f==="none"?Ia:Array.isArray(St)?St.map(Ne=>Fs(Ne,D)):Fs(St,D),[Ia,D,f,St]),Z1=Ee(p),$a=Ee(n),V1=We.useState("activeIndex"),D1=We.useState("selectedIndex"),qo=We.useState("positionerElement"),jr=We.useState("listElement"),Uo=We.useState("triggerElement"),yr=We.useState("inputElement"),G8=We.useState("inputGroupElement"),Br=We.useState("inline"),Vi=We.useState("inputInsidePopup"),ju=We.useState("inputOwnsFormValue"),oc=Jn&&!Vi&&Rn===Xo,ac=Ln(Uo),{mounted:Iu,setMounted:K8,transitionStatus:H1}=Ks(dn),{openMethod:Q0,triggerProps:Z0}=h5(dn),V0=Ee(()=>N0);w0(Vi?ac:Te,ue,Ia,V0,!zt,g);const La=Ee(()=>{Ce?Ge.current=Rr.map(oe):We.set("forceMounted",!0)}),Na=Ee((Ne,ze,vt)=>{if(ze===-1){if(an.current===hx)return;an.current=hx}else an.current={value:Ne,index:ze};Z1(Ne,pY(vt,void 0,{index:ze}))}),mi=Ee(Ne=>{const ze={};Ne.activeIndex!==void 0&&(ze.activeIndex=Ne.activeIndex),Ne.selectedIndex!==void 0&&(ze.selectedIndex=Ne.selectedIndex),We.update(ze);const vt=Ne.activeIndex;if(vt===void 0)return;const en=Ne.type||"none";vt===null?Na(void 0,-1,en):Na(ht.current[vt],vt,en)}),Qt=Ee((Ne,ze)=>{var vt;if((vt=t.onInputValueChange)==null||vt.call(t,Ne,ze),!ze.isCanceled){if(et.current=ze.reason===ca,ze.reason==="input-change"){dn&&G!==null&&de(null);const en=ze.event,yn=en.inputType;if(en.type==="compositionend"||yn!=null&&yn!==""&&yn!=="insertReplacementText"){const tn=Ne.trim()!=="";tn&&Y(!0),at.current={hasQuery:tn};const fn=We.state.listElement;if(!We.state.virtualized&&fn){const qn=dt.current;for(const br of Wd(fn.firstElementChild??fn)){if(!on(br)||(qn?!Ue(qn,br):br.getAttribute("role")==="dialog"))break;if(k8e(br)){br.scrollTop=0;break}}}tn&&Tt&&We.state.activeIndex==null&&(dn||Br)&&We.set("activeIndex",0)}}else ze.reason==="input-clear"&&Ne===""&&We.state.inputInsidePopup&&(at.current={hasQuery:!1,selection:!0});so(Ne)}}),D0=Ee(Ne=>{const ze=!Ne&&Vi&&!Br&&Rn!==""&&(String(Rn).trim()===G||Rn===Xo);!Ne&&(ze||Rn===""||oc)&&Y(!1),de(null),ze&&Qt("",_e(ca))}),Qa=Ee((Ne,ze)=>{var vt;if(dn!==Ne&&(ze.reason==="escape-key"&&Tn&&Rr.length===0&&!Pt.current&&ze.allowPropagation(),(vt=t.onOpenChange)==null||vt.call(t,Ne,ze),!ze.isCanceled&&(Ne&&G!==null&&D0(ze.reason===Bm),!Ne&&ge&&(Jn?(Br||de(si),si===""&&Y(!1)):rn&&(Br||de(si),Vi&&mi({activeIndex:null}),(!Vi||Br)&&Qt("",_e(ca,ze.event,void 0,{isItemPress:ze.reason===Rl})))),ii(Ne),!Ne&&Vi&&(ze.reason==="focus-out"||ze.reason==="outside-press")&&(he(!0),Se(!1),Oe==="onBlur")))){const en=f==="none"?Rn:St;be.commit(en)}}),oo=Ee((Ne,ze)=>{s==null||s(Ne,ze),!ze.isCanceled&&(ri(Ne),(f==="none"&&dt.current&&q||Jn&&!We.state.inputInsidePopup)&&Qt(oe(Ne),_e(ze.reason,ze.event)))}),F1=Ee((Ne,ze)=>{var fn;const vt=ln(Ne),en=Ht.current??Ne;Ht.current=null;const yn=_e(Rl,en),tn=(fn=vt==null?void 0:vt.closest("a"))==null?void 0:fn.getAttribute("href");if(tn){tn.startsWith("#")&&Qa(!1,yn);return}if(rn){const qn=Array.isArray(St)?St:[],br=e2(qn,ze,B),fo=br?ZQ(qn,ze,B):[...qn,ze];if(oo(fo,yn),yn.isCanceled||!(Te.current&&Te.current.value.trim()!==""))return;if(We.state.inputInsidePopup){Qt("",_e(ca,yn.event,void 0,{isItemPress:!0}));const os=at.current;os&&!br&&(os.toggledValue=ze)}else Qa(!1,yn)}else{if(oo(ze,yn),yn.isCanceled)return;Qa(!1,yn)}}),_1=Ee(()=>{var ze,vt;const Ne=((ze=be.inputRef.current)==null?void 0:ze.form)??((vt=We.state.inputElement)==null?void 0:vt.form);Ne&&typeof Ne.requestSubmit=="function"&&Ne.requestSubmit()}),$u=Ee(()=>{if(K8(!1),$a==null||$a(!1),Y(!1),de(null),mi(f==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),rn&&Te.current&&Te.current.value!==""&&!et.current&&Qt("",_e(ca)),Jn)if(We.state.inputInsidePopup)Te.current&&Te.current.value!==""&&Qt("",_e(ca));else{const Ne=oe(St);Te.current&&Te.current.value!==Ne&&Qt(Ne,_e(Ne===""?ca:_n))}}),H0=c.useMemo(()=>Br&&qo?{current:qo.closest('[role="dialog"]')}:dt,[Br,qo]);Hr({enabled:!t.actionsRef,open:dn,ref:H0,onComplete(){dn||$u()}}),c.useImperativeHandle(t.actionsRef,()=>({unmount:$u}),[$u]),Pe(function(){const ze=Ae.current!==null&&G===null;if(Ae.current=G,dn&&(!ze||!Tn)||(dn||(Xt.current=null),f==="none"))return;const vt=Tn?Rr:ht.current;mi({selectedIndex:th(vt,St,B,rn)})},[dn,G,St,f,rn,Tn,Rr,B,mi]),Pe(()=>{Ce&&(ht.current=Rr,Re.current.length=Rr.length)},[Ce,Rr]),Pe(()=>{var fn;const Ne=at.current;if(Ne){const qn=dn||Br||((fn=We.state.positionerElement)==null?void 0:fn.hidden)===!1;if(Ne.hasQuery)Tt&&qn&&We.set("activeIndex",0),at.current=null;else if(String(Rn).trim()===""&&(at.current=null,qn)){const br=Ne.selection;Tt==="always"&&!br&&We.state.selectionMode==="none"&&We.set("activeIndex",0),queueMicrotask(()=>{if(!We.state.open&&!We.state.inline||Te.current&&Te.current.value.trim()!=="")return;const fo=We.state.selectedValue,os=We.state.selectionMode==="multiple";if(os&&Array.isArray(fo)?fo.length>0:We.state.selectionMode!=="none"&&fo!=null){const Vu=Tn||Ot?Rr:ht.current,Fa=iu(Vu,Ne.toggledValue,We.state.isItemEqualToValue);We.set("activeIndex",Fa!==-1?Fa:th(Vu,fo,We.state.isItemEqualToValue,os))}else br?We.set("activeIndex",null):Tt==="always"&&We.set("activeIndex",0)})}}if(!dn&&!Br)return;const ze=Tn||Ot?Rr:ht.current,vt=We.state.activeIndex;if(vt==null){if(Tt==="always"&&ze.length>0){We.set("activeIndex",0);return}Na(void 0,-1,_n);return}if(vt>=ze.length){Na(void 0,-1,_n),We.set("activeIndex",null);return}const en=ze[vt],yn=an.current.value,tn=yn!==vF&&Es(en,yn,We.state.isItemEqualToValue);(an.current.index!==vt||!tn)&&Na(en,vt,_n)},[V1,Tt,Na,Ot,Tn,Rr,Br,dn,We,Rn]),Pe(()=>{if(f==="none"){ne(String(Rn)!=="");return}ne(rn?Array.isArray(St)&&St.length>0:St!=null)},[ne,f,Rn,St,rn]),c.useEffect(()=>{Tn&&Tt&&Rr.length===0&&mi({activeIndex:null})},[Tn,Tt,Rr.length,mi]);function Lu(){dn&&si!==""&&si!==String(Zi)&&!oc&&Y(!0)}function ao(){dn&&G!==null&&D0(!1)}let Rs=!1;function js(){!Rs&&Rn!==Xo&&(Rs=!0,Qt(Xo,_e(_n)))}function lc(){f!=="none"&&(z(Mn),J(NQ(St,K.initialValue,B)),be.change(St),Jn&&!Wn&&!Vi&&js())}function Za(){Jn&&!Wn&&!Vi&&!ge&&js()}function lo(){f==="none"&&(z(Mn),J(Rn!==K.initialValue),be.change(Rn))}gs(si,Lu),gs(dn,ao),gs(St,lc),gs(Xo,Za),gs(Ce,Za),gs(Rn,lo);const Nu=Lv({open:Br?!0:dn,onOpenChange:Qa,elements:{reference:Vi?Uo:yr,floating:qo}}),F0=C?"grid":"listbox",co=dn||Br,z1=co?"true":"false",cc=c.useMemo(()=>{const Ne=(yr==null?void 0:yr.tagName)==="INPUT",ze=yr==null||Ne,vt=ze||co,en=ze?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return vt&&(en.role="combobox",en["aria-expanded"]=z1,en["aria-haspopup"]=F0,en["aria-controls"]=co?jr==null?void 0:jr.id:void 0,en["aria-autocomplete"]=b?"none":R),{reference:en,floating:{role:"presentation"}}},[yr,co,z1,F0,jr==null?void 0:jr.id,R,b]),uc=S0(Nu,{enabled:!zt&&$,event:"mousedown-only",toggle:!1,touchOpenDelay:Vi?0:100,reason:HR}),dc=c1(Nu,{enabled:!zt&&!Br,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Br?!0:void 0,outsidePress(Ne){const ze=ln(Ne);return!Ue(Uo,ze)&&!Ue(Mt.current,ze)&&!Ue(Yt.current,ze)&&!Ue(G8,ze)}}),Va=p5(Nu,{enabled:!zt,id:ue,listRef:Re,activeIndex:V1,selectedIndex:D1,virtual:!0,loopFocus:V,allowEscape:V&&!Tt,focusItemOnOpen:ge||f==="none"&&!Tt?!1:"auto",focusItemOnHover:M,resetOnPointerLeave:!L,orientation:C?"horizontal":void 0,rtl:me==="rtl",disabledIndices:ir,grid:C?hOe:void 0,onNavigate(Ne,ze){!ze&&!dn||H1==="ending"||mi(ze?{activeIndex:Ne,type:jt.current?o1:V2}:{activeIndex:Ne})}}),Da=c.useMemo(()=>ar(Va.reference,{onKeyDown(Ne){C&&We.state.activeIndex==null&&(Ne.key==="ArrowLeft"||Ne.key==="ArrowRight")&&Ne.preventBaseUIHandler()}},dc.reference,uc.reference,cc.reference),[Va.reference,dc.reference,uc.reference,cc.reference,C,We]),Ha=c.useMemo(()=>ar(u1,dc.floating),[dc.floating]),Yo=c.useMemo(()=>ar(Va.floating,cc.floating),[Va.floating,cc.floating]),fc=c.useMemo(()=>{const Ne=Va.item;return Ne?{...Ne,onFocus:void 0}:Ut},[Va.item]);We.useContextCallback("setOpen",Qa),We.useContextCallback("setInputValue",Qt),We.useContextCallback("setSelectedValue",oo),We.useContextCallback("setIndices",mi),We.useContextCallback("handleSelection",F1),We.useContextCallback("forceMount",La),We.useContextCallback("requestSubmit",_1),We.useContextCallback("onOpenChangeComplete",n),LQ(()=>{We.update({inline:U,popupProps:Ha,listProps:Yo,inputProps:Da,triggerProps:Z0,itemProps:fc})});const B1={id:ue,selectedValue:St,open:dn,mounted:Iu,transitionStatus:H1,items:Le,inline:U,popupProps:Ha,listProps:Yo,inputProps:Da,triggerProps:Z0,itemProps:fc,openMethod:Q0,selectionMode:f,name:Mn,form:O,disabled:zt,readOnly:b,required:v,grid:C,virtualized:H,openOnInputClick:$,itemToStringLabel:Fe,modal:W,autoHighlight:Tt,isItemEqualToValue:B,submitOnItemClick:N,hasInputValue:Wn};Pe(()=>{We.update({...B1,inputOwnsFormValue:f==="none"&&(U||!We.state.inputInsidePopup)})},[We,...Object.values(B1)]);const J8=ns(w,be.inputRef),_0=c.useMemo(()=>({query:si,hasItems:Tn,filteredItems:sc,flatFilteredValues:Rr}),[si,Tn,sc,Rr]),Qu=c.useMemo(()=>Array.isArray(Ia)?"":Fs(Ia,D),[Ia,D]),z0=rn&&Array.isArray(St)&&St.length>0,Zu=rn||f==="none"&&ju?void 0:Mn,uo=c.useMemo(()=>!rn||!Array.isArray(St)||!Mn?null:St.map(Ne=>{const ze=Fs(Ne,D);return m.jsx("input",{type:"hidden",form:O,name:Mn,value:ze,disabled:zt},ze)}),[rn,St,O,Mn,D,zt]),B0=m.jsxs(c.Fragment,{children:[t.children,m.jsx("input",{...be.getValidationProps(zt,{onFocus(){var Ne;if(Vi){Uo==null||Uo.focus();return}(Ne=Te.current||Uo)==null||Ne.focus()},onChange(Ne){if(Ne.nativeEvent.defaultPrevented||zt||b)return;const ze=Ne.currentTarget.value,vt=ze.toLowerCase(),en=_e(_n,Ne.nativeEvent),yn=()=>ht.current.findIndex(fn=>Fs(fn,D).toLowerCase()===vt||oe(fn).toLowerCase()===vt);function tn(){if(rn)return;if(f==="none"){Qt(ze,en);return}let fn=yn();fn===-1&&(fn=ht.current.findIndex((br,fo)=>{const os=Ge.current[fo];return os!=null&&os.toLowerCase()===vt}));const qn=fn===-1?void 0:ht.current[fn];qn!=null&&(oo==null||oo(qn,en))}Jn&&(La(),Ce&&yn()===-1&&We.set("forceMounted",!0)),queueMicrotask(tn)}}),id:ue&&Zu==null?`${ue}-hidden-input`:void 0,form:O,name:Zu,autoComplete:Q,disabled:zt,required:v&&!z0,readOnly:b,value:Qu,ref:J8,style:Zu?a1:ku,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),uo]});return m.jsx(Uk.Provider,{value:We,children:m.jsx(Yk.Provider,{value:Nu,children:m.jsx(Kk.Provider,{value:Tn,children:m.jsx(Gk.Provider,{value:_0,children:m.jsx(Jk.Provider,{value:Rn,children:B0})})})})})}const xOe="data-popup-side",yOe="data-list-empty",wF={...gg,...eo,popupSide:t=>t?{[xOe]:t}:null,listEmpty:t=>t?{[yOe]:""}:null},tw=c.createContext(void 0);tw.displayName="ComboboxChipsContext";function SF(){return c.useContext(tw)}const nw=c.createContext(void 0);nw.displayName="ComboboxPositionerContext";function rw(t){const e=c.useContext(nw);if(e===void 0&&!t)throw new Error("Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component");return e}const iw=c.forwardRef(function(e,n){const r=zr(),{buttonRef:i,getButtonProps:s}=Tr({native:!1}),o=ns(n,i);function a(u){r.context.setOpen(!1,_e(DR,u.nativeEvent,u.currentTarget))}const l=s({onClick:a});return m.jsx("span",{ref:o,...l,"aria-label":"Dismiss",tabIndex:void 0,style:a1})});iw.displayName="ComboboxInternalDismissButton";function CF(t){const e=t.useState("mounted"),n=t.useState("popupSide"),r=t.useState("positionerElement");return e&&r?n:null}function X8(){return N1().filteredItems.length===0}function EF(t){return t==="rtl"?["ArrowRight","ArrowLeft"]:["ArrowLeft","ArrowRight"]}function AF(t,e){const n=t>=e-1?e-2:t;return n>=0?n:void 0}function PF(t,e,n){const r=t.context.listRef.current[e];r&&(t.context.selectionEventRef.current=n,r.click(),t.context.selectionEventRef.current=null)}const Q1=c.forwardRef(function(e,n){const{render:r,className:i,disabled:s=!1,id:o,style:a,...l}=e,{state:u,disabled:f,setTouched:p,setFocused:g,validationMode:O,validation:y}=pi(),{labelId:b}=Li(),v=SF(),C=!!rw(!0),S=zr(),A=ew(),P=Aa(),T=S.useState("required"),$=S.useState("disabled"),I=S.useState("readOnly"),L=S.useState("name"),M=S.useState("form"),V=S.useState("selectionMode"),Z=S.useState("autoHighlight"),D=S.useState("inputProps"),B=S.useState("triggerProps"),H=S.useState("open"),U=S.useState("mounted"),q=S.useState("selectedValue"),W=S.useState("id"),X=S.useState("inline"),R=S.useState("modal"),Q=!!Z,F=CF(S),N=f||$||s,z=X8(),J=C||X,K=!J||R,ne=Pn(o??(J?void 0:W)),se=C?vQ:u,[ie,he]=c.useState(null),Se=c.useRef(!1),Oe=c.useRef(null),be=c.useRef(!1),me=V==="none"&&!C,ue=Ee(Me=>{const oe=C||S.state.inline;oe&&!S.state.hasInputValue&&S.context.setInputValue("",_e(_n)),S.update({inputElement:Me,inputInsidePopup:oe,inputOwnsFormValue:me})}),ve=C?l:y.getValidationProps(N,l);function xe(){S.context.setIndices({activeIndex:null,selectedIndex:null,type:S.context.keyboardActiveRef.current?o1:V2})}function Ce(){S.context.keyboardActiveRef.current=!1}const we={...se,open:H,disabled:N,readOnly:I,popupSide:F,listEmpty:z};function Le(Me){if(!v)return;let oe;const{highlightedChipIndex:ge}=v,Y=v.chipsRef.current.length,[G,de]=EF(P);return ge!==void 0?(Me.key===G?(Me.preventDefault(),ge>0?oe=ge-1:oe=void 0):Me.key===de?(Me.preventDefault(),ge<Y-1?oe=ge+1:oe=void 0):(Me.key==="Backspace"||Me.key==="Delete")&&(Me.preventDefault(),oe=AF(ge,q.length),xe()),oe):(Me.key===G&&(Me.currentTarget.selectionStart??0)===0&&q.length>0&&(Me.preventDefault(),oe=Y>0?Y-1:void 0),oe)}const Ie=He("input",e,{state:we,ref:[n,S.context.inputRef,ue],props:[D,B,{value:ie??A,"aria-readonly":I||void 0,"aria-required":T||void 0,"aria-labelledby":b,disabled:N,readOnly:I,required:V==="none"?T:void 0,form:M,...me&&L&&{name:L},id:ne,onFocus(){if(g(!0),!X||!be.current)return;be.current=!1;const Me=Oe.current;Me==null||!Object.hasOwn(S.context.valuesRef.current,Me)||S.context.setIndices({activeIndex:Me})},onBlur(){p(!0),g(!1);const Me=S.state.activeIndex;if(X&&Me!==null&&Z!=="always"&&(Oe.current=Me,be.current=!0,S.context.setIndices({activeIndex:null})),O==="onBlur"){const oe=V==="none"?A:q;y.commit(oe)}},onCompositionStart(Me){mg||(Se.current=!0,he(Me.currentTarget.value))},onCompositionEnd(Me){Se.current=!1;const oe=Me.currentTarget.value;he(null),S.context.setInputValue(oe,_e(Bm,Me.nativeEvent))},onChange(Me){const oe=Me.nativeEvent,ge=oe.inputType,Y=!ge||ge==="insertReplacementText",G=Se.current||!Y;function de(dt){I||N||!dt||!G||(S.context.setOpen(!0,_e(Bm,oe)),Q||xe())}if(Se.current){const dt=Me.currentTarget.value;he(dt),dt===""&&!S.state.openOnInputClick&&!S.state.inputInsidePopup&&S.context.setOpen(!1,_e(ca,oe));const Te=dt.trim(),Ke=Q&&Te!=="";de(Te),H&&S.state.activeIndex!==null&&!Ke&&xe();return}const Ae=_e(Bm,oe);if(S.context.setInputValue(Me.currentTarget.value,Ae),Ae.isCanceled)return;const Re=Me.currentTarget.value==="",Ge=_e(ca,oe);Re&&!S.state.inputInsidePopup&&(V==="single"&&S.context.setSelectedValue(null,Ge),S.state.openOnInputClick||S.context.setOpen(!1,Ge)),de(Me.currentTarget.value.trim()),H&&S.state.activeIndex!==null&&!Q&&xe()},onKeyDown(Me){var Ae,Re;if(Me.ctrlKey||Me.shiftKey||Me.altKey||Me.metaKey)return;if(S.context.keyboardActiveRef.current=!0,N||I){I&&Me.key==="Enter"&&H&&S.state.activeIndex!==null&&Dn(Me);return}const oe=Me.currentTarget,ge=oe.scrollWidth-oe.clientWidth,Y=P==="rtl";if(Me.key==="Home"){Dn(Me);const Ge=j9&&Y?oe.value.length:0;oe.setSelectionRange(Ge,Ge),oe.scrollLeft=0;return}if(Me.key==="End"){Dn(Me);const Ge=j9&&Y?0:oe.value.length;oe.setSelectionRange(Ge,Ge),oe.scrollLeft=Y?-ge:ge;return}if(!U&&Me.key==="Escape"){const Ge=V==="multiple"&&Array.isArray(q)?q.length===0:q===null,dt=_e(FR,Me.nativeEvent),Te=V==="multiple"?[]:null;S.context.setInputValue("",dt),S.context.setSelectedValue(Te,dt),!Ge&&!S.state.inline&&!dt.isPropagationAllowed&&Me.stopPropagation();return}if(v&&Me.key==="Backspace"&&oe.value===""&&v.highlightedChipIndex===void 0&&Array.isArray(q)&&q.length>0){const Ge=v.chipsRef.current.length,dt=Ge>0?Ge-1:q.length-1,Te=q.filter((Ke,gt)=>gt!==dt);xe(),S.context.setSelectedValue(Te,_e(_n,Me.nativeEvent));return}const G=(v==null?void 0:v.highlightedChipIndex)!==void 0,de=Le(Me);if(v==null||v.setHighlightedChipIndex(de),de!==void 0?(Ae=v==null?void 0:v.chipsRef.current[de])==null||Ae.focus():G&&((Re=S.context.inputRef.current)==null||Re.focus()),Me.which!==229&&Me.key==="Enter"&&H){const Ge=S.state.activeIndex,dt=Me.nativeEvent;if(Ge===null){if(X)return;S.context.setOpen(!1,_e(_n,dt));return}Dn(Me),PF(S,Ge,dt)}},onPointerMove:Ce,onPointerDown:Ce},ve],stateAttributesMapping:wF}),Fe=C?m.jsx(p8.Provider,{value:kQ,children:Ie}):Ie;return m.jsxs(c.Fragment,{children:[H&&K&&m.jsx(iw,{ref:S.context.startDismissRef}),Fe]})});Q1.displayName="ComboboxInput";const sw=c.createContext(null);sw.displayName="GroupCollectionContext";function bOe(){return c.useContext(sw)}function vOe(t){const{children:e,items:n}=t,r=c.useMemo(()=>({items:n}),[n]);return m.jsx(sw.Provider,{value:r,children:e})}function MF(t){const{children:e}=t,{filteredItems:n}=N1(),r=bOe(),i=r?r.items:n;return m.jsx(c.Fragment,{children:i.map(e)})}const ow=c.forwardRef(function(e,n){var r;const{render:i,className:s,style:o,children:a,...l}=e,u=zr(),f=B8(),p=!!rw(!0),{filteredItems:g,hasItems:O}=N1(),y=u.useState("selectionMode"),b=u.useState("grid"),v=u.useState("readOnly"),w=u.useState("listProps"),C=u.useState("virtualized"),S=u.useState("forceMounted"),A=y==="multiple",P=g.length===0,T=Ee(D=>{u.set("positionerElement",D)}),$=Ee(D=>{u.set("listElement",D)}),I=c.useMemo(()=>typeof a=="function"?r||(r=m.jsx(MF,{children:a})):a,[a]),L={empty:P},M=f.useState("floatingId"),V=He("div",e,{state:L,ref:[n,$,p?null:T],props:[w,{children:I,tabIndex:-1,id:M,role:b?"grid":"listbox","aria-multiselectable":A?"true":void 0,"aria-readonly":!b&&v?!0:void 0,onKeyDown(D){if(!(u.state.disabled||u.state.readOnly)&&D.key==="Enter"){const B=u.state.activeIndex;if(B==null)return;Dn(D),PF(u,B,D.nativeEvent)}},onKeyDownCapture(){u.context.keyboardActiveRef.current=!0},onPointerMoveCapture(){u.context.keyboardActiveRef.current=!1}},l]});if(C)return V;const Z=O&&!S?void 0:u.context.labelsRef;return m.jsx(C0,{elementsRef:u.context.listRef,labelsRef:Z,children:V})});ow.displayName="ComboboxList";const kOe="⁠";function wOe(t){const e=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);let n=null;for(;e.nextNode();){const r=e.currentNode;r.nodeValue!==""&&(n=r)}return n}function SOe(){const t=wn(),e=c.useRef(null);return c.useEffect(()=>{if(r1)return;const n=e.current;if(n==null)return;const r=wOe(n);if(r==null)return;const i=r.data,s=`${i}${kOe}`;return r.nodeValue=s,t.start(200,()=>{r.nodeValue===s&&(r.nodeValue=i)}),()=>{t.clear(),r.nodeValue===s&&(r.nodeValue=i)}},[e,t]),e}const aw=c.createContext(void 0);aw.displayName="ComboboxGroupContext";function COe(){const t=c.useContext(aw);if(t===void 0)throw new Error("Base UI: ComboboxGroupContext is missing. ComboboxGroup parts must be placed within <Combobox.Group>.");return t}const TF=c.forwardRef(function(e,n){const{render:r,className:i,style:s,items:o,...a}=e,l=zr().useState("grid"),[u,f]=c.useState(),p=c.useMemo(()=>({labelId:u,setLabelId:f,items:o}),[u,f,o]),g=He("div",e,{ref:n,props:[{role:l?"rowgroup":"group","aria-labelledby":u},a]}),O=m.jsx(aw.Provider,{value:p,children:g});return o?m.jsx(vOe,{items:o,children:O}):O});TF.displayName="ComboboxGroup";const RF=c.forwardRef(function(e,n){const{render:r,className:i,style:s,id:o,...a}=e,{setLabelId:l}=COe(),u=Pn(o);return Pe(()=>(l(u),()=>{l(f=>f===u?void 0:f)}),[u,l]),He("div",e,{ref:n,props:[{id:u,"aria-hidden":!0},a]})});RF.displayName="ComboboxGroupLabel";const lw=c.createContext(void 0);lw.displayName="ComboboxItemContext";function jF(){const t=c.useContext(lw);if(!t)throw new Error("Base UI: ComboboxItemContext is missing. ComboboxItem parts must be placed within <Combobox.Item>.");return t}const IF=c.createContext(!1);IF.displayName="ComboboxRowContext";function EOe(){return c.useContext(IF)}function $F(t){const{componentProps:e,forwardedRef:n,virtualized:r,indexFromFilter:i}=t,{render:s,className:o,style:a,value:l=null,index:u,disabled:f=!1,nativeButton:p=!1,...g}=e,O=c.useRef(null),y=Ta({guess:!0,index:u,textRef:O}),b=zr(),v=EOe(),w=pOe(),C=b.useState("selectionMode"),S=b.useState("disabled"),A=b.useState("readOnly"),P=b.useState("isItemEqualToValue"),T=S||f,$=C!=="none",I=u??i??y.index,L=I!==-1,M=b.useState("id"),V=b.useState("isActive",I),Z=b.useState("isSelected",l),D=b.useState("itemProps"),B=c.useRef(null),H=M!=null&&L?`${M}-${I}`:void 0,U=Z&&$;Pe(()=>{if(!(L&&(r||u!=null)))return;const z=b.context.listRef.current;return z[I]=B.current,()=>{delete z[I]}},[L,r,I,u,b]),Pe(()=>{if(!L||w)return;const z=b.context.valuesRef.current;return z[I]=l,()=>{delete z[I]}},[L,w,I,l,b]),Pe(()=>{if(!L||w)return;const z=b.state.selectedValue;let J=b.state.selectedIndex;b.state.selectionMode==="multiple"&&Array.isArray(z)?J=QQ(I,l,b.context.valuesRef.current,z,P,J):Es(l,z,P)&&(J=I),b.set("selectedIndex",J)},[L,w,b,I,l,P]);const{getButtonProps:q,buttonRef:W}=Tr({disabled:T,focusableWhenDisabled:!0,native:p,composite:!0}),X={disabled:T,selected:U,highlighted:V};function R(z){function J(){b.context.handleSelection(z,l)}b.state.submitOnItemClick?(ts.flushSync(J),b.context.requestSubmit()):J()}const Q={id:H,role:v?"gridcell":"option","aria-selected":$?U:void 0,tabIndex:void 0,onPointerDownCapture(z){z.isPrimary&&(b.context.pointerDownItemRef.current=z.currentTarget),z.preventDefault()},onMouseDown(z){z.preventDefault()},onClick(z){T||A||R(z.nativeEvent)},onMouseUp(z){const J=b.context.pointerDownItemRef.current===z.currentTarget;b.context.pointerDownItemRef.current=null,!(T||A||z.button!==0||J||!V)&&R(z.nativeEvent)}},F=He("div",e,{ref:[W,n,y.ref,B],state:X,props:[D,Q,g,q]}),N=c.useMemo(()=>({selected:U,textRef:O}),[U,O]);return m.jsx(lw.Provider,{value:N,children:F})}function AOe(t){const{componentProps:e,forwardedRef:n}=t,r=zr().useState("isItemEqualToValue"),{flatFilteredValues:i}=N1(),s=e.value??null,o=iu(i,s,r);return m.jsx($F,{componentProps:e,forwardedRef:n,virtualized:!0,indexFromFilter:o})}const cw=c.memo(c.forwardRef(function(e,n){const r=zr().useState("virtualized");return r&&e.index==null?m.jsx(AOe,{componentProps:e,forwardedRef:n}):m.jsx($F,{componentProps:e,forwardedRef:n,virtualized:r,indexFromFilter:void 0})}));cw.displayName="ComboboxItem";const uw=c.forwardRef(function(e,n){const{render:r,className:i,style:s,children:o,...a}=e,{filteredItems:l}=N1(),u=zr(),f=SOe(),p=l.length===0?o:null;return He("div",e,{ref:[n,u.context.emptyRef,f],props:[{children:p,role:"status","aria-live":"polite","aria-atomic":!0},a]})});uw.displayName="ComboboxEmpty";function POe(t){const{openOnInputClick:e=!1,value:n,defaultValue:r,onValueChange:i,mode:s="list",itemToStringValue:o,...a}=t,l=(s==="inline"||s==="both")&&!t.readOnly,u=s==="inline"||s==="none",f=n!==void 0,[p,g]=c.useState(r??""),[O,y]=c.useState("");c.useEffect(()=>{(f||!l)&&y("")},[n,f,l]);let b;l&&O!==""?b=O:f?b=n??"":b=p;const v=bF({locale:a.locale}),w=String((f?n:p)??"").trim(),C=u||a.filter===null?null:a.filter??v.contains;function S(P,T){y(""),f||g(P),i==null||i(P,T)}function A(P,T){var $;($=t.onItemHighlighted)==null||$.call(t,P,T),T.reason!=="pointer"&&y(l&&P!=null?Bs(P,o):"")}return m.jsx(kF,{...a,itemToStringLabel:o,openOnInputClick:e,selectionMode:"none",fillInputOnItemPress:!0,filter:C,filterQuery:s==="both"?w:void 0,autoComplete:s,inputValue:b,defaultInputValue:r,onInputValueChange:S,onItemHighlighted:A})}const MOe=cw,LF=c.createContext({});function TOe({open:t,onOpenChange:e,onBackdropClick:n,children:r,container:i}){const s=vu(),o=i??s??void 0,a=u=>{n?n(u):e(!1)},l=c.useCallback(()=>{e(!1)},[e]);return m.jsx(Nk,{open:t,onOpenChange:e,modal:!0,children:m.jsxs(O2,{container:o,children:[m.jsx(x2,{className:"fixed inset-0 bg-kumo-overlay opacity-80 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",onClick:a}),m.jsx(JH,{render:m.jsx(y2,{}),className:le("fixed top-[10vh] left-1/2 w-full max-w-2xl -translate-x-1/2","overflow-hidden rounded-lg","duration-150 data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0"),style:{transitionProperty:"scale, opacity",transitionTimingFunction:"var(--default-transition-timing-function)"},children:m.jsx(LF.Provider,{value:{onClose:l},children:r})})]})})}function ROe({open:t,onOpenChange:e,onBackdropClick:n,children:r,items:i,value:s,onValueChange:o,onItemHighlighted:a,itemToStringValue:l,filter:u,onSelect:f,getSelectableItems:p,container:g}){return m.jsx(TOe,{open:t,onOpenChange:e,onBackdropClick:n,container:g,children:m.jsx(ZOe,{items:i,value:s,onValueChange:o,onItemHighlighted:a,itemToStringValue:l,filter:u,open:t,onSelect:f,getSelectableItems:p,children:r})})}function jOe({children:t,leading:e,trailing:n}){return m.jsxs("div",{className:"flex items-center gap-3 bg-kumo-base px-4 py-3 focus-within:ring-2 focus-within:ring-kumo-brand",children:[e??m.jsx(xh,{className:"h-4 w-4 text-kumo-subtle",weight:"bold"}),t,n]})}const NF=c.forwardRef(function({children:e,className:n},r){return m.jsx("div",{ref:r,className:le("relative min-h-0 flex-1 scroll-py-2 overflow-y-auto rounded-b-lg bg-kumo-base px-2 py-2 ring-1 ring-kumo-hairline",n),children:e})});NF.displayName="CommandPalette.List";function IOe({value:t,disabled:e,children:n,className:r,onClick:i}){return m.jsx(MOe,{value:t,disabled:e,onClick:i,className:le("group flex w-full items-center gap-3 px-2 py-1.5 text-left text-base transition-colors","cursor-pointer data-[highlighted]:bg-kumo-overlay","rounded-lg",e&&"cursor-default opacity-50",r),children:n})}function $Oe({children:t}){return m.jsx(uw,{children:m.jsx("div",{className:"p-8 text-center",children:m.jsx("p",{className:"text-kumo-subtle",children:t??"No results found"})})})}function LOe({children:t}){return m.jsx("div",{className:"flex items-center justify-between rounded-b-lg bg-kumo-elevated px-4 py-3 text-xs text-kumo-subtle",children:t})}function NOe({children:t,className:e}){return m.jsx("div",{className:le("flex max-h-[60vh] flex-col overflow-hidden rounded-lg bg-kumo-elevated",e),children:t})}const QF=c.createContext({}),QOe=()=>!0;function ZOe({children:t,items:e,value:n,onValueChange:r,onItemHighlighted:i,itemToStringValue:s,filter:o=QOe,open:a=!0,className:l,onSelect:u,getSelectableItems:f}){const p=c.useRef(-1),g=c.useCallback((y,b)=>{p.current=b.index,i==null||i(y,b)},[i]),O=c.useCallback(y=>{const b=y.key==="Enter",v=y.metaKey||y.ctrlKey;if(b&&v&&u&&f){const w=f(e)[p.current];w!==void 0&&(y.preventDefault(),u(w,{newTab:!0}))}},[e,u,f]);return m.jsx(NOe,{className:l,children:m.jsx(POe,{items:e,value:n,onValueChange:r,onItemHighlighted:g,itemToStringValue:s,filter:o,autoHighlight:"always",keepHighlight:!0,open:a,children:m.jsx(QF.Provider,{value:{onInputKeyDown:O},children:t})})})}function VOe({autoFocus:t=!0,placeholder:e,className:n,onKeyDown:r,leading:i,trailing:s,...o}){const{onInputKeyDown:a}=c.useContext(QF),{onClose:l}=c.useContext(LF),u=c.useCallback(f=>{if(r==null||r(f),!f.defaultPrevented){if(f.key==="Escape"&&l){f.preventDefault(),l();return}a==null||a(f)}},[a,r,l]);return m.jsx(jOe,{leading:i,trailing:s,children:m.jsx(Q1,{placeholder:e,className:le("kumo-input-placeholder flex-1 border-none bg-transparent text-base","outline-none",n),onKeyDown:u,autoFocus:t,...o})})}function DOe({children:t,className:e}){return m.jsx(ow,{className:le("space-y-3",e),children:t})}const Rc={Root:ROe,Input:VOe,List:NF,Item:IOe,Empty:$Oe,Footer:LOe,Results:DOe},HOe={task:{label:"task",icon:null},note:{label:"memory",icon:O0},worklog:{label:"worklog",icon:q2},feedback:{label:"feedback",icon:Y2}};function FOe(){const[t,e]=c.useState(""),[n,r]=c.useState(""),{close:i}=cr(),{open:s}=ro(),{data:o}=Qi();c.useEffect(()=>{const g=setTimeout(()=>r(t.trim()),200);return()=>clearTimeout(g)},[t]);const{data:a,isFetching:l}=AD(n?{query:n,limit:20}:null),u=n?(a==null?void 0:a.hits)??[]:[],f=c.useMemo(()=>{const g=new Map;return o==null||o.forEach(O=>g.set(O.id,O.key)),g},[o]),p=g=>{i(),s(g.entity.id)};return m.jsxs(Rc.Root,{open:!0,onOpenChange:g=>{g||i()},items:u,value:t,onValueChange:e,itemToStringValue:g=>Or(g.entity),children:[m.jsx(Rc.Input,{placeholder:"Search tasks, memory, worklogs…","aria-label":"Search",trailing:l?m.jsx(Su,{size:14}):m.jsx("kbd",{children:"esc"})}),m.jsxs(Rc.List,{className:"scrollbar-thin",children:[m.jsx(Rc.Results,{className:"space-y-0.5",children:g=>{const O=HOe[g.entity.kind],y=O.icon,b=g.entity.projectId?f.get(g.entity.projectId):null,v=g.entity.body.replace(/\n/g," ").slice(0,140);return m.jsxs(Rc.Item,{value:g,onClick:()=>p(g),className:"items-start",children:[m.jsx("span",{className:"mt-0.5 flex size-4 shrink-0 items-center justify-center text-kumo-subtle",children:y?m.jsx(y,{size:16}):m.jsx(Ou,{status:g.entity.status})}),m.jsxs("div",{className:"min-w-0 flex-1",children:[m.jsx("div",{className:"truncate text-sm text-kumo-default",children:Or(g.entity)}),v&&m.jsx("div",{className:"mt-0.5 truncate text-xs text-kumo-subtle",children:v}),m.jsxs("div",{className:"mt-0.5 flex gap-1.5 text-xxs text-kumo-placeholder tabular-nums",children:[m.jsx("span",{children:O.label}),b&&m.jsxs("span",{children:["· ",b]}),m.jsxs("span",{children:["· score ",g.score.toFixed(3)]}),g.components.bm25&&m.jsx("span",{children:"· bm25"}),g.components.cosine&&m.jsx("span",{children:"· vec"})]})]}),m.jsx(Oj,{size:14,className:"mt-0.5 shrink-0 text-kumo-subtle opacity-0 transition-opacity group-data-[highlighted]:opacity-100"})]},g.entity.id)}}),m.jsx(Rc.Empty,{children:n?l?"Searching…":"No matches.":"Hybrid search over BM25, vectors and recency."})]}),m.jsxs(Rc.Footer,{children:[m.jsx("span",{children:a&&n?`${a.hits.length} result(s) · embedding ${a.embeddingUsed?"on":"off (BM25-only)"}`:null}),m.jsxs("span",{className:"flex items-center gap-3",children:[m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("kbd",{children:"↑"}),m.jsx("kbd",{children:"↓"}),"navigate"]}),m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("kbd",{children:"↵"}),"open"]})]})]})]})}function _Oe(){const{active:t}=cr();if(!t)return null;switch(t.kind){case"search":return m.jsx(FOe,{});case"quick-create":return m.jsx(fOe,{initialProjectId:t.projectId,initialKind:t.initialKind,initialParentId:t.parentId});case"new-project":return m.jsx(T6e,{});case"edit-project":return m.jsx(M6e,{projectId:t.projectId})}}const zOe=`## Critical
157
157
  - NEVER commit credentials.
158
158
  - ALWAYS run tests before commit.
159
159