juneau 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -54,5 +54,5 @@ Try asking: *"Show me the data"* or *"Can you suggest something?"*`,25),yield{ty
54
54
  `))+1))}const l="#".repeat(i),a=t.enter("headingAtx"),s=t.enter("phrasing");o.move(l+" ");let u=t.containerPhrasing(e,{before:"# ",after:`
55
55
  `,...o.current()});return/^[\t ]/.test(u)&&(u=ot(u.charCodeAt(0))+u.slice(1)),u=u?l+" "+u:l,t.options.closeAtx&&(u+=" "+l),s(),a(),u}wi.peek=rf;function wi(e){return e.value||""}function rf(){return"<"}Ci.peek=lf;function Ci(e,n,t,r){const i=vn(t),o=i==='"'?"Quote":"Apostrophe",l=t.enter("image");let a=t.enter("label");const s=t.createTracker(r);let u=s.move("![");return u+=s.move(t.safe(e.alt,{before:u,after:"]",...s.current()})),u+=s.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=t.enter("destinationLiteral"),u+=s.move("<"),u+=s.move(t.safe(e.url,{before:u,after:">",...s.current()})),u+=s.move(">")):(a=t.enter("destinationRaw"),u+=s.move(t.safe(e.url,{before:u,after:e.title?" ":")",...s.current()}))),a(),e.title&&(a=t.enter(`title${o}`),u+=s.move(" "+i),u+=s.move(t.safe(e.title,{before:u,after:i,...s.current()})),u+=s.move(i),a()),u+=s.move(")"),l(),u}function lf(){return"!"}Si.peek=of;function Si(e,n,t,r){const i=e.referenceType,o=t.enter("imageReference");let l=t.enter("label");const a=t.createTracker(r);let s=a.move("![");const u=t.safe(e.alt,{before:s,after:"]",...a.current()});s+=a.move(u+"]["),l();const f=t.stack;t.stack=[],l=t.enter("reference");const c=t.safe(t.associationId(e),{before:s,after:"]",...a.current()});return l(),t.stack=f,o(),i==="full"||!u||u!==c?s+=a.move(c+"]"):i==="shortcut"?s=s.slice(0,-1):s+=a.move("]"),s}function of(){return"!"}vi.peek=af;function vi(e,n,t){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<t.unsafe.length;){const l=t.unsafe[o],a=t.compilePattern(l);let s;if(l.atBreak)for(;s=a.exec(r);){let u=s.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(s.index+1)}}return i+r+i}function af(){return"`"}function _i(e,n){const t=mn(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(t===e.url||"mailto:"+t===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Ai.peek=sf;function Ai(e,n,t,r){const i=vn(t),o=i==='"'?"Quote":"Apostrophe",l=t.createTracker(r);let a,s;if(_i(e,t)){const f=t.stack;t.stack=[],a=t.enter("autolink");let c=l.move("<");return c+=l.move(t.containerPhrasing(e,{before:c,after:">",...l.current()})),c+=l.move(">"),a(),t.stack=f,c}a=t.enter("link"),s=t.enter("label");let u=l.move("[");return u+=l.move(t.containerPhrasing(e,{before:u,after:"](",...l.current()})),u+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=t.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(t.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=t.enter("destinationRaw"),u+=l.move(t.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=t.enter(`title${o}`),u+=l.move(" "+i),u+=l.move(t.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),u+=l.move(")"),a(),u}function sf(e,n,t){return _i(e,t)?"<":"["}Ei.peek=uf;function Ei(e,n,t,r){const i=e.referenceType,o=t.enter("linkReference");let l=t.enter("label");const a=t.createTracker(r);let s=a.move("[");const u=t.containerPhrasing(e,{before:s,after:"]",...a.current()});s+=a.move(u+"]["),l();const f=t.stack;t.stack=[],l=t.enter("reference");const c=t.safe(t.associationId(e),{before:s,after:"]",...a.current()});return l(),t.stack=f,o(),i==="full"||!u||u!==c?s+=a.move(c+"]"):i==="shortcut"?s=s.slice(0,-1):s+=a.move("]"),s}function uf(){return"["}function _n(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function cf(e){const n=_n(e),t=e.options.bulletOther;if(!t)return n==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+t+"`) to be different");return t}function ff(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function Ii(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function pf(e,n,t,r){const i=t.enter("list"),o=t.bulletCurrent;let l=e.ordered?ff(t):_n(t);const a=e.ordered?l==="."?")":".":cf(t);let s=n&&t.bulletLastUsed?l===t.bulletLastUsed:!1;if(!e.ordered){const f=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&f&&(!f.children||!f.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(s=!0),Ii(t)===l&&f){let c=-1;for(;++c<e.children.length;){const h=e.children[c];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){s=!0;break}}}}s&&(l=a),t.bulletCurrent=l;const u=t.containerFlow(e,r);return t.bulletLastUsed=l,t.bulletCurrent=o,i(),u}function hf(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function df(e,n,t,r){const i=hf(t);let o=t.bulletCurrent||_n(t);n&&n.type==="list"&&n.ordered&&(o=(typeof n.start=="number"&&n.start>-1?n.start:1)+(t.options.incrementListMarker===!1?0:n.children.indexOf(e))+o);let l=o.length+1;(i==="tab"||i==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(l=Math.ceil(l/4)*4);const a=t.createTracker(r);a.move(o+" ".repeat(l-o.length)),a.shift(l);const s=t.enter("listItem"),u=t.indentLines(t.containerFlow(e,a.current()),f);return s(),u;function f(c,h,p){return h?(p?"":" ".repeat(l))+c:(p?o:o+" ".repeat(l-o.length))+c}}function mf(e,n,t,r){const i=t.enter("paragraph"),o=t.enter("phrasing"),l=t.containerPhrasing(e,r);return o(),i(),l}const gf=It(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function yf(e,n,t,r){return(e.children.some(function(l){return gf(l)})?t.containerPhrasing:t.containerFlow).call(t,e,r)}function xf(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}Ti.peek=kf;function Ti(e,n,t,r){const i=xf(t),o=t.enter("strong"),l=t.createTracker(r),a=l.move(i+i);let s=l.move(t.containerPhrasing(e,{after:i,before:a,...l.current()}));const u=s.charCodeAt(0),f=St(r.before.charCodeAt(r.before.length-1),u,i);f.inside&&(s=ot(u)+s.slice(1));const c=s.charCodeAt(s.length-1),h=St(r.after.charCodeAt(0),c,i);h.inside&&(s=s.slice(0,-1)+ot(c));const p=l.move(i+i);return o(),t.attentionEncodeSurroundingInfo={after:h.outside,before:f.outside},a+s+p}function kf(e,n,t){return t.options.strong||"*"}function bf(e,n,t,r){return t.safe(e.value,r)}function wf(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function Cf(e,n,t){const r=(Ii(t)+(t.options.ruleSpaces?" ":"")).repeat(wf(t));return t.options.ruleSpaces?r.slice(0,-1):r}const ji={blockquote:Vc,break:br,code:Jc,definition:Kc,emphasis:bi,hardBreak:br,heading:nf,html:wi,image:Ci,imageReference:Si,inlineCode:vi,link:Ai,linkReference:Ei,list:pf,listItem:df,paragraph:mf,root:yf,strong:Ti,text:bf,thematicBreak:Cf};function Sf(){return{enter:{table:vf,tableData:wr,tableHeader:wr,tableRow:Af},exit:{codeText:Ef,table:_f,tableData:Wt,tableHeader:Wt,tableRow:Wt}}}function vf(e){const n=e._align;this.enter({type:"table",align:n.map(function(t){return t==="none"?null:t}),children:[]},e),this.data.inTable=!0}function _f(e){this.exit(e),this.data.inTable=void 0}function Af(e){this.enter({type:"tableRow",children:[]},e)}function Wt(e){this.exit(e)}function wr(e){this.enter({type:"tableCell",children:[]},e)}function Ef(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,If));const t=this.stack[this.stack.length-1];t.type,t.value=n,this.exit(e)}function If(e,n){return n==="|"?n:e}function Tf(e){const n=e||{},t=n.tableCellPadding,r=n.tablePipeAlign,i=n.stringLength,o=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
56
56
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:l,tableCell:s,tableRow:a}};function l(p,g,C,S){return u(f(p,C,S),p.align)}function a(p,g,C,S){const x=c(p,C,S),E=u([x]);return E.slice(0,E.indexOf(`
57
- `))}function s(p,g,C,S){const x=C.enter("tableCell"),E=C.enter("phrasing"),_=C.containerPhrasing(p,{...S,before:o,after:o});return E(),x(),_}function u(p,g){return Hc(p,{align:g,alignDelimiters:r,padding:t,stringLength:i})}function f(p,g,C){const S=p.children;let x=-1;const E=[],_=g.enter("table");for(;++x<S.length;)E[x]=c(S[x],g,C);return _(),E}function c(p,g,C){const S=p.children;let x=-1;const E=[],_=g.enter("tableRow");for(;++x<S.length;)E[x]=s(S[x],p,g,C);return _(),E}function h(p,g,C){let S=ji.inlineCode(p,g,C);return C.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function jf(){return{exit:{taskListCheckValueChecked:Cr,taskListCheckValueUnchecked:Cr,paragraph:Pf}}}function zf(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Lf}}}function Cr(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function Pf(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const t=this.stack[this.stack.length-1];t.type;const r=t.children[0];if(r&&r.type==="text"){const i=n.children;let o=-1,l;for(;++o<i.length;){const a=i[o];if(a.type==="paragraph"){l=a;break}}l===t&&(r.value=r.value.slice(1),r.value.length===0?t.children.shift():t.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,t.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Lf(e,n,t,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",a=t.createTracker(r);o&&a.move(l);let s=ji.listItem(e,n,t,{...r,...a.current()});return o&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),s;function u(f){return f+l}}function Df(){return[fc(),Pc(),Nc(),Sf(),jf()]}function Mf(e){return{extensions:[pc(),Lc(e),Rc(),Tf(e),zf()]}}const Nf={tokenize:Hf,partial:!0},zi={tokenize:qf,partial:!0},Pi={tokenize:Vf,partial:!0},Li={tokenize:Uf,partial:!0},Rf={tokenize:Wf,partial:!0},Di={name:"wwwAutolink",tokenize:Bf,previous:Ni},Mi={name:"protocolAutolink",tokenize:$f,previous:Ri},_e={name:"emailAutolink",tokenize:Of,previous:Fi},be={};function Ff(){return{text:be}}let Le=48;for(;Le<123;)be[Le]=_e,Le++,Le===58?Le=65:Le===91&&(Le=97);be[43]=_e;be[45]=_e;be[46]=_e;be[95]=_e;be[72]=[_e,Mi];be[104]=[_e,Mi];be[87]=[_e,Di];be[119]=[_e,Di];function Of(e,n,t){const r=this;let i,o;return l;function l(c){return!ln(c)||!Fi.call(r,r.previous)||An(r.events)?t(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(c))}function a(c){return ln(c)?(e.consume(c),a):c===64?(e.consume(c),s):t(c)}function s(c){return c===46?e.check(Rf,f,u)(c):c===45||c===95||ie(c)?(o=!0,e.consume(c),s):f(c)}function u(c){return e.consume(c),i=!0,s}function f(c){return o&&i&&ae(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(c)):t(c)}}function Bf(e,n,t){const r=this;return i;function i(l){return l!==87&&l!==119||!Ni.call(r,r.previous)||An(r.events)?t(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Nf,e.attempt(zi,e.attempt(Pi,o),t),t)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(l)}}function $f(e,n,t){const r=this;let i="",o=!1;return l;function l(c){return(c===72||c===104)&&Ri.call(r,r.previous)&&!An(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),a):t(c)}function a(c){if(ae(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),a;if(c===58){const h=i.toLowerCase();if(h==="http"||h==="https")return e.consume(c),s}return t(c)}function s(c){return c===47?(e.consume(c),o?u:(o=!0,s)):t(c)}function u(c){return c===null||bt(c)||G(c)||Ne(c)||_t(c)?t(c):e.attempt(zi,e.attempt(Pi,f),t)(c)}function f(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(c)}}function Hf(e,n,t){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),o):t(l)}function o(l){return l===null?t(l):n(l)}}function qf(e,n,t){let r,i,o;return l;function l(u){return u===46||u===95?e.check(Li,s,a)(u):u===null||G(u)||Ne(u)||u!==45&&_t(u)?s(u):(o=!0,e.consume(u),l)}function a(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),l}function s(u){return i||r||!o?t(u):n(u)}}function Vf(e,n){let t=0,r=0;return i;function i(l){return l===40?(t++,e.consume(l),i):l===41&&r<t?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(Li,n,o)(l):l===null||G(l)||Ne(l)?n(l):(e.consume(l),i)}function o(l){return l===41&&r++,e.consume(l),i}}function Uf(e,n,t){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?(e.consume(a),r):a===38?(e.consume(a),o):a===93?(e.consume(a),i):a===60||a===null||G(a)||Ne(a)?n(a):t(a)}function i(a){return a===null||a===40||a===91||G(a)||Ne(a)?n(a):r(a)}function o(a){return ae(a)?l(a):t(a)}function l(a){return a===59?(e.consume(a),r):ae(a)?(e.consume(a),l):t(a)}}function Wf(e,n,t){return r;function r(o){return e.consume(o),i}function i(o){return ie(o)?t(o):n(o)}}function Ni(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||G(e)}function Ri(e){return!ae(e)}function Fi(e){return!(e===47||ln(e))}function ln(e){return e===43||e===45||e===46||e===95||ie(e)}function An(e){let n=e.length,t=!1;for(;n--;){const r=e[n][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){t=!0;break}if(r._gfmAutolinkLiteralWalkedInto){t=!1;break}}return e.length>0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const Yf={tokenize:tp,partial:!0};function Qf(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Kf,continuation:{tokenize:Zf},exit:ep}},text:{91:{name:"gfmFootnoteCall",tokenize:Gf},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Xf,resolveTo:Jf}}}}function Xf(e,n,t){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const s=r.events[i][1];if(s.type==="labelImage"){l=s;break}if(s.type==="gfmFootnoteCall"||s.type==="labelLink"||s.type==="label"||s.type==="image"||s.type==="link")break}return a;function a(s){if(!l||!l._balanced)return t(s);const u=ye(r.sliceSerialize({start:l.end,end:r.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?t(s):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),n(s))}}function Jf(e,n){let t=e.length;for(;t--;)if(e[t][1].type==="labelImage"&&e[t][0]==="enter"){e[t][1];break}e[t+1][1].type="data",e[t+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[t+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[t+3][1].end),end:Object.assign({},e[t+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[t+1],e[t+2],["enter",r,n],e[t+3],e[t+4],["enter",i,n],["exit",i,n],["enter",o,n],["enter",l,n],["exit",l,n],["exit",o,n],e[e.length-2],e[e.length-1],["exit",r,n]];return e.splice(t,e.length-t+1,...a),e}function Gf(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return a;function a(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),s}function s(c){return c!==94?t(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(o>999||c===93&&!l||c===null||c===91||G(c))return t(c);if(c===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(ye(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):t(c)}return G(c)||(l=!0),o++,e.consume(c),c===92?f:u}function f(c){return c===91||c===92||c===93?(e.consume(c),o++,u):u(c)}}function Kf(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,l=0,a;return s;function s(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):t(g)}function f(g){if(l>999||g===93&&!a||g===null||g===91||G(g))return t(g);if(g===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return o=ye(r.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return G(g)||(a=!0),l++,e.consume(g),g===92?c:f}function c(g){return g===91||g===92||g===93?(e.consume(g),l++,f):f(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(o)||i.push(o),W(e,p,"gfmFootnoteDefinitionWhitespace")):t(g)}function p(g){return n(g)}}function Zf(e,n,t){return e.check(st,n,e.attempt(Yf,n,t))}function ep(e){e.exit("gfmFootnoteDefinition")}function tp(e,n,t){const r=this;return W(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?n(o):t(o)}}function np(e){let t=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return t==null&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,a){let s=-1;for(;++s<l.length;)if(l[s][0]==="enter"&&l[s][1].type==="strikethroughSequenceTemporary"&&l[s][1]._close){let u=s;for(;u--;)if(l[u][0]==="exit"&&l[u][1].type==="strikethroughSequenceTemporary"&&l[u][1]._open&&l[s][1].end.offset-l[s][1].start.offset===l[u][1].end.offset-l[u][1].start.offset){l[s][1].type="strikethroughSequence",l[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},l[u][1].start),end:Object.assign({},l[s][1].end)},c={type:"strikethroughText",start:Object.assign({},l[u][1].end),end:Object.assign({},l[s][1].start)},h=[["enter",f,a],["enter",l[u][1],a],["exit",l[u][1],a],["enter",c,a]],p=a.parser.constructs.insideSpan.null;p&&he(h,h.length,0,At(p,l.slice(u+1,s),a)),he(h,h.length,0,[["exit",c,a],["enter",l[s][1],a],["exit",l[s][1],a],["exit",f,a]]),he(l,u-1,s-u+3,h),s=u+h.length-2;break}}for(s=-1;++s<l.length;)l[s][1].type==="strikethroughSequenceTemporary"&&(l[s][1].type="data");return l}function o(l,a,s){const u=this.previous,f=this.events;let c=0;return h;function h(g){return u===126&&f[f.length-1][1].type!=="characterEscape"?s(g):(l.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const C=qe(u);if(g===126)return c>1?s(g):(l.consume(g),c++,p);if(c<2&&!t)return s(g);const S=l.exit("strikethroughSequenceTemporary"),x=qe(g);return S._open=!x||x===2&&!!C,S._close=!C||C===2&&!!x,a(g)}}}class rp{constructor(){this.map=[]}add(n,t,r){ip(this,n,t,r)}consume(n){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let t=this.map.length;const r=[];for(;t>0;)t-=1,r.push(n.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),n.length=this.map[t][0];r.push(n.slice()),n.length=0;let i=r.pop();for(;i;){for(const o of i)n.push(o);i=r.pop()}this.map.length=0}}function ip(e,n,t,r){let i=0;if(!(t===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===n){e.map[i][1]+=t,e.map[i][2].push(...r);return}i+=1}e.map.push([n,t,r])}}function lp(e,n){let t=!1;const r=[];for(;n<e.length;){const i=e[n];if(t){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(t=!0);n+=1}return r}function op(){return{flow:{null:{name:"table",tokenize:ap,resolveAll:sp}}}}function ap(e,n,t){const r=this;let i=0,o=0,l;return a;function a(k){let T=r.events.length-1;for(;T>-1;){const P=r.events[T][1].type;if(P==="lineEnding"||P==="linePrefix")T--;else break}const j=T>-1?r.events[T][1].type:null,U=j==="tableHead"||j==="tableRow"?b:s;return U===b&&r.parser.lazy[r.now().line]?t(k):U(k)}function s(k){return e.enter("tableHead"),e.enter("tableRow"),u(k)}function u(k){return k===124||(l=!0,o+=1),f(k)}function f(k){return k===null?t(k):L(k)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),p):t(k):$(k)?W(e,f,"whitespace")(k):(o+=1,l&&(l=!1,i+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),l=!0,f):(e.enter("data"),c(k)))}function c(k){return k===null||k===124||G(k)?(e.exit("data"),f(k)):(e.consume(k),k===92?h:c)}function h(k){return k===92||k===124?(e.consume(k),c):c(k)}function p(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?t(k):(e.enter("tableDelimiterRow"),l=!1,$(k)?W(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):g(k))}function g(k){return k===45||k===58?S(k):k===124?(l=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),C):M(k)}function C(k){return $(k)?W(e,S,"whitespace")(k):S(k)}function S(k){return k===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),x):k===45?(o+=1,x(k)):k===null||L(k)?z(k):M(k)}function x(k){return k===45?(e.enter("tableDelimiterFiller"),E(k)):M(k)}function E(k){return k===45?(e.consume(k),E):k===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(k))}function _(k){return $(k)?W(e,z,"whitespace")(k):z(k)}function z(k){return k===124?g(k):k===null||L(k)?!l||i!==o?M(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(k)):M(k)}function M(k){return t(k)}function b(k){return e.enter("tableRow"),F(k)}function F(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),F):k===null||L(k)?(e.exit("tableRow"),n(k)):$(k)?W(e,F,"whitespace")(k):(e.enter("data"),H(k))}function H(k){return k===null||k===124||G(k)?(e.exit("data"),F(k)):(e.consume(k),k===92?B:H)}function B(k){return k===92||k===124?(e.consume(k),H):H(k)}}function sp(e,n){let t=-1,r=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],a=!1,s=0,u,f,c;const h=new rp;for(;++t<e.length;){const p=e[t],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,s!==0&&(Sr(h,n,s,u,f),f=void 0,s=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(t,0,[["enter",u,n]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,c=void 0,o=[0,0,0,0],l=[0,t+1,0,0],a&&(a=!1,f={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(t,0,[["enter",f,n]])),i=g.type==="tableDelimiterRow"?2:f?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],c=mt(h,n,o,i,void 0,c),o=[0,0,0,0]),l[2]=t)):g.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],c=mt(h,n,o,i,void 0,c)),o=l,l=[o[1],t,0,0])):g.type==="tableHead"?(a=!0,s=t):g.type==="tableRow"||g.type==="tableDelimiterRow"?(s=t,o[1]!==0?(l[0]=l[1],c=mt(h,n,o,i,t,c)):l[1]!==0&&(c=mt(h,n,l,i,t,c)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(l[3]=t)}for(s!==0&&Sr(h,n,s,u,f),h.consume(n.events),t=-1;++t<n.events.length;){const p=n.events[t];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=lp(n.events,t))}return e}function mt(e,n,t,r,i,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";t[0]!==0&&(o.end=Object.assign({},He(n.events,t[0])),e.add(t[0],0,[["exit",o,n]]));const s=He(n.events,t[1]);if(o={type:l,start:Object.assign({},s),end:Object.assign({},s)},e.add(t[1],0,[["enter",o,n]]),t[2]!==0){const u=He(n.events,t[2]),f=He(n.events,t[3]),c={type:a,start:Object.assign({},u),end:Object.assign({},f)};if(e.add(t[2],0,[["enter",c,n]]),r!==2){const h=n.events[t[2]],p=n.events[t[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",t[3]>t[2]+1){const g=t[2]+1,C=t[3]-t[2]-1;e.add(g,C,[])}}e.add(t[3]+1,0,[["exit",c,n]])}return i!==void 0&&(o.end=Object.assign({},He(n.events,i)),e.add(i,0,[["exit",o,n]]),o=void 0),o}function Sr(e,n,t,r,i){const o=[],l=He(n.events,t);i&&(i.end=Object.assign({},l),o.push(["exit",i,n])),r.end=Object.assign({},l),o.push(["exit",r,n]),e.add(t+1,0,o)}function He(e,n){const t=e[n],r=t[0]==="enter"?"start":"end";return t[1][r]}const up={name:"tasklistCheck",tokenize:fp};function cp(){return{text:{91:up}}}function fp(e,n,t){const r=this;return i;function i(s){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?t(s):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),o)}function o(s){return G(s)?(e.enter("taskListCheckValueUnchecked"),e.consume(s),e.exit("taskListCheckValueUnchecked"),l):s===88||s===120?(e.enter("taskListCheckValueChecked"),e.consume(s),e.exit("taskListCheckValueChecked"),l):t(s)}function l(s){return s===93?(e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):t(s)}function a(s){return L(s)?n(s):$(s)?e.check({tokenize:pp},n,t)(s):t(s)}}function pp(e,n,t){return W(e,r,"whitespace");function r(i){return i===null?t(i):n(i)}}function hp(e){return Qr([Ff(),Qf(),np(e),op(),cp()])}const dp={};function mp(e){const n=this,t=e||dp,r=n.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(hp(t)),o.push(Df()),l.push(Mf(t))}const gp="_wrapper_v5oy7_1",yp="_table_v5oy7_8",xp="_th_v5oy7_14",kp="_tr_v5oy7_24",bp="_td_v5oy7_32",Ze={wrapper:gp,table:yp,th:xp,tr:kp,td:bp};function Oi({part:e}){return y.jsx("div",{className:Ze.wrapper,"data-juneau":"table-part",children:y.jsxs("table",{className:Ze.table,children:[y.jsx("thead",{children:y.jsx("tr",{children:e.columns.map(n=>y.jsx("th",{className:Ze.th,children:n},n))})}),y.jsx("tbody",{children:e.rows.map((n,t)=>y.jsx("tr",{className:Ze.tr,children:e.columns.map(r=>y.jsx("td",{className:Ze.td,children:String(n[r]??"")},r))},t))})]})})}const wp="_card_83cdc_1",Cp="_header_83cdc_9",Sp="_icon_83cdc_16",vp="_title_83cdc_23",_p="_description_83cdc_29",Ap="_cardResolved_83cdc_36",Ep="_resolvedBadge_83cdc_40",Ip="_actions_83cdc_51",Tp="_confirm_83cdc_56",jp="_cancel_83cdc_72",ge={card:wp,header:Cp,icon:Sp,title:vp,description:_p,cardResolved:Ap,resolvedBadge:Ep,actions:Ip,confirm:Tp,cancel:jp};function Bi({part:e,onConfirm:n,onCancel:t}){const r=Te(),{proposal:i}=e,o=i.resolved==="confirmed"?r.proposalConfirmed:i.resolved==="cancelled"?r.proposalCancelled:i.resolved==="expired"?r.proposalExpired:null;return y.jsxs("div",{className:i.resolved?`${ge.card} ${ge.cardResolved}`:ge.card,"data-juneau":"proposal-card",children:[y.jsxs("div",{className:ge.header,children:[y.jsx("svg",{className:ge.icon,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M10 1a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5A.75.75 0 0110 1zM5.05 3.05a.75.75 0 011.06 1.06l-1.06 1.06a.75.75 0 11-1.06-1.06l1.06-1.06zm9.9 0a.75.75 0 010 1.06l-1.06 1.06a.75.75 0 11-1.06-1.06l1.06-1.06a.75.75 0 011.06 0zM10 6a4 4 0 100 8 4 4 0 000-8zm-9 4a.75.75 0 01.75-.75h1.5a.75.75 0 010 1.5h-1.5A.75.75 0 011 10zm15.75-.75a.75.75 0 000 1.5h1.5a.75.75 0 000-1.5h-1.5zM4.11 14.89a.75.75 0 010 1.06l-1.06 1.06a.75.75 0 11-1.06-1.06l1.06-1.06a.75.75 0 011.06 0zm11.84 1.06a.75.75 0 10-1.06-1.06l-1.06 1.06a.75.75 0 101.06 1.06l1.06-1.06zM10 17.25a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5a.75.75 0 01.75-.75z"})}),y.jsx("span",{className:ge.title,children:i.title})]}),i.description&&y.jsx("p",{className:ge.description,children:i.description}),o?y.jsx("span",{className:ge.resolvedBadge,children:o}):y.jsxs("div",{className:ge.actions,children:[y.jsx("button",{className:ge.confirm,onClick:()=>n(i.id,i.payload),children:i.confirmLabel??r.proposalConfirm}),y.jsx("button",{className:ge.cancel,onClick:()=>t(i.id),children:i.cancelLabel??r.proposalCancel})]})]})}const zp="_activity_2jjfs_1",Pp="_indicator_2jjfs_13",Lp="_content_2jjfs_36",Dp="_title_2jjfs_40",Mp="_description_2jjfs_45",et={activity:zp,indicator:Pp,content:Lp,title:Dp,description:Mp};function $i({part:e}){return y.jsxs("div",{className:et.activity,"data-status":e.status,"data-juneau":"activity-part",children:[y.jsx("span",{className:et.indicator,"aria-hidden":"true"}),y.jsxs("div",{className:et.content,children:[y.jsx("div",{className:et.title,children:e.title}),e.description&&y.jsx("div",{className:et.description,children:e.description})]})]})}const Np="_card_jwkcu_1",Rp="_cardClickable_jwkcu_14",Fp="_header_jwkcu_24",Op="_title_jwkcu_30",Bp="_subtitle_jwkcu_36",$p="_fields_jwkcu_41",Hp="_fieldRow_jwkcu_48",qp="_fieldLabel_jwkcu_55",Vp="_fieldValue_jwkcu_61",Up="_badge_jwkcu_68",Wp="_badgeSuccess_jwkcu_76",Yp="_badgeWarning_jwkcu_81",Qp="_badgeDanger_jwkcu_86",Xp="_badgeNeutral_jwkcu_91",oe={card:Np,cardClickable:Rp,header:Fp,title:Op,subtitle:Bp,fields:$p,fieldRow:Hp,fieldLabel:qp,fieldValue:Vp,badge:Up,badgeSuccess:Wp,badgeWarning:Yp,badgeDanger:Qp,badgeNeutral:Xp},Jp={success:oe.badgeSuccess,warning:oe.badgeWarning,danger:oe.badgeDanger,neutral:oe.badgeNeutral};function En({part:e,onEntityClick:n}){const{entity:t,entityType:r}=e,i=n!==void 0,o=y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:oe.header,children:[y.jsx("span",{className:oe.title,children:t.title}),t.subtitle&&y.jsx("span",{className:oe.subtitle,children:t.subtitle})]}),t.fields&&t.fields.length>0&&y.jsx("dl",{className:oe.fields,children:t.fields.map((l,a)=>y.jsxs("div",{className:oe.fieldRow,children:[y.jsx("dt",{className:oe.fieldLabel,children:l.label}),y.jsx("dd",{className:oe.fieldValue,children:l.badge?y.jsx("span",{className:`${oe.badge} ${Jp[l.badge]}`,children:l.value}):l.value})]},a))})]});return i?y.jsx("button",{type:"button",className:`${oe.card} ${oe.cardClickable}`,onClick:()=>n(t,r),"data-juneau":"entity-card",children:o}):y.jsx("div",{className:oe.card,"data-juneau":"entity-card",children:o})}const Gp="_list_a2maw_1",Kp="_listTitle_a2maw_11",vr={list:Gp,listTitle:Kp};function Hi({part:e,onEntityClick:n}){return y.jsxs("div",{className:vr.list,"data-juneau":"entity-list-part",children:[e.title&&y.jsx("span",{className:vr.listTitle,children:e.title}),e.entities.map((t,r)=>y.jsx(En,{part:{type:"entity",entity:t,entityType:e.entityType},onEntityClick:n},t.id??r))]})}const Zp="_markdown_1yi3y_1",eh="_unknownPart_1yi3y_84",th="_errorText_1yi3y_98",nh="_errorIcon_1yi3y_106",gt={markdown:Zp,unknownPart:eh,errorText:th,errorIcon:nh};function qi({part:e,onProposalConfirm:n,onProposalCancel:t,onEntityClick:r,renderPart:i}){if(i){const o=i(e);if(o!=null)return y.jsx(y.Fragment,{children:o})}switch(e.type){case"text":return y.jsx("div",{className:gt.markdown,children:y.jsx(tc,{remarkPlugins:[mp],children:e.text})});case"table":return y.jsx(Oi,{part:e});case"activity":return y.jsx($i,{part:e});case"proposal":return y.jsx(Bi,{part:e,onConfirm:n,onCancel:t});case"entity":return y.jsx(En,{part:e,onEntityClick:r});case"entity-list":return y.jsx(Hi,{part:e,onEntityClick:r});case"error":return y.jsxs("span",{className:gt.errorText,children:[y.jsx(ql,{className:gt.errorIcon}),e.message]});default:return globalThis.process?.env?.NODE_ENV!=="production"?y.jsxs("div",{className:gt.unknownPart,children:["Unhandled part type: ",y.jsx("code",{children:e.type})," — pass a"," ",y.jsx("code",{children:"renderPart"})," prop to render it."]}):null}}const rh="_wrapper_1q20p_1",ih="_user_1q20p_8",lh="_assistant_1q20p_12",oh="_avatar_1q20p_16",ah="_content_1q20p_43",sh="_bubble_1q20p_51",uh="_card_1q20p_70",ch="_empty_1q20p_92",xe={wrapper:rh,user:ih,assistant:lh,avatar:oh,content:ah,bubble:sh,card:uh,empty:ch},fh=new Set(["text","error","activity"]);function Vi(e){return!fh.has(e.type)}function ph(e){const n=[];return e.forEach((t,r)=>{const i=Vi(t),o=n[n.length-1];if(o&&!i&&!o.card){o.parts.push({part:t,index:r});return}n.push({card:i,parts:[{part:t,index:r}]})}),n}function Ui({message:e,onProposalConfirm:n,onProposalCancel:t,onEntityClick:r,assistantIcon:i,renderPart:o}){const l=Te(),a=e.role==="user",s=(f,c)=>y.jsx(qi,{part:f,onProposalConfirm:n,onProposalCancel:t,onEntityClick:r,renderPart:o},c),u=e.parts.some(Vi);return y.jsxs("div",{className:`${xe.wrapper} ${a?xe.user:xe.assistant}`,"data-juneau":"message","data-juneau-role":e.role,children:[!a&&y.jsx("div",{className:xe.avatar,"aria-hidden":"true",children:i??y.jsx(Pr,{})}),u?y.jsx("div",{className:xe.content,children:ph(e.parts).map((f,c)=>y.jsx("div",{className:f.card?xe.card:xe.bubble,"data-juneau-segment":f.card?"card":"bubble",children:f.parts.map(({part:h,index:p})=>s(h,p))},c))}):y.jsxs("div",{className:xe.bubble,"data-juneau-segment":"bubble",children:[e.parts.map((f,c)=>s(f,c)),e.parts.length===0&&y.jsx("span",{className:xe.empty})]}),a&&y.jsx("div",{className:xe.avatar,children:l.userLabel})]})}const hh="_wrapper_1dvvu_1",dh="_dot_1dvvu_8",mh="_connectingLabel_1dvvu_19",tt={wrapper:hh,dot:dh,connectingLabel:mh};function Wi({connecting:e=!1}){const n=Te();return y.jsxs("div",{className:tt.wrapper,"aria-label":e?n.connectingMessage:n.typingMessage,"data-juneau":"typing-indicator",children:[y.jsx("span",{className:tt.dot}),y.jsx("span",{className:tt.dot}),y.jsx("span",{className:tt.dot}),e&&y.jsx("span",{className:tt.connectingLabel,children:n.connectingMessage})]})}const gh="_list_1f8gn_1",yh="_empty_1f8gn_11",xh="_hint_1f8gn_24",kh="_typing_1f8gn_31",yt={list:gh,empty:yh,hint:xh,typing:kh};function Yi({messages:e,isLoading:n,isConnecting:t,onProposalConfirm:r,onProposalCancel:i,onEntityClick:o,assistantIcon:l,renderPart:a,emptyState:s}){const u=Te(),f=q.useRef(null);return q.useEffect(()=>{f.current?.scrollIntoView({behavior:"smooth"})},[e,n]),y.jsxs("div",{className:yt.list,"data-juneau":"message-list",children:[e.length===0&&(s??y.jsxs("div",{className:yt.empty,"data-juneau":"empty-state",children:[y.jsx("p",{children:u.emptyStateText}),y.jsx("p",{className:yt.hint,children:y.jsx("em",{children:u.emptyStateHint})})]})),e.map(c=>y.jsx(Ui,{message:c,onProposalConfirm:r,onProposalCancel:i,onEntityClick:o,assistantIcon:l,renderPart:a},c.id)),n&&y.jsx("div",{className:yt.typing,children:y.jsx(Wi,{connecting:t})}),y.jsx("div",{ref:f})]})}const bh="_wrapper_v8iyr_1",wh="_textarea_v8iyr_11",Ch="_toolbar_v8iyr_35",Sh="_actions_v8iyr_45",vh="_actionBtn_v8iyr_52",_h="_sendBtn_v8iyr_85",Ah="_spinnerIcon_v8iyr_116",Eh="_stopBtn_v8iyr_126",Ih="_stopIcon_v8iyr_149",Se={wrapper:bh,textarea:wh,toolbar:Ch,actions:Sh,actionBtn:vh,sendBtn:_h,spinnerIcon:Ah,stopBtn:Eh,stopIcon:Ih};function Qi({value:e,onChange:n,onSend:t,onStop:r,isLoading:i,placeholder:o,actions:l,sendIcon:a}){const s=Te(),u=q.useRef(null),f=q.useRef(!1);q.useEffect(()=>{f.current&&!i&&u.current?.focus(),f.current=i},[i]);const c=[{icon:y.jsx(Ml,{}),label:s.actionAddFile},{icon:y.jsx(Nl,{}),label:s.actionQuickActions},{icon:y.jsx(Rl,{}),label:s.actionNew},{icon:y.jsx(Fl,{}),label:s.actionHistory},{icon:y.jsx(Ol,{}),label:s.actionRules}],h=l??c,p=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),i||t())};return y.jsxs("div",{className:Se.wrapper,"data-juneau":"input",children:[y.jsx("textarea",{ref:u,className:Se.textarea,"data-juneau":"input-textarea",value:e,onChange:g=>n(g.target.value),onKeyDown:p,placeholder:o??s.inputPlaceholder,rows:3,"aria-label":s.sendMessage}),y.jsxs("div",{className:Se.toolbar,children:[h.length>0&&y.jsx("div",{className:Se.actions,children:h.map((g,C)=>y.jsxs("button",{className:Se.actionBtn,type:"button",disabled:i,"aria-label":g.label,onClick:g.onClick,children:[g.icon,y.jsx("span",{children:g.label})]},C))}),i&&r?y.jsxs("button",{className:Se.stopBtn,onClick:r,"aria-label":s.stopMessage,type:"button",children:[y.jsx("svg",{className:Se.stopIcon,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),y.jsx("span",{children:s.stopMessage})]}):y.jsxs("button",{className:Se.sendBtn,onClick:t,disabled:i||!e.trim(),"aria-label":s.sendMessage,type:"button",children:[i?y.jsx("svg",{className:Se.spinnerIcon,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:y.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"12"})}):a??y.jsx(Dl,{}),y.jsx("span",{children:s.sendMessage})]})]})]})}const Th="_wrapper_1kefv_1",jh="_icon_1kefv_14",zh="_message_1kefv_20",Ph="_dismiss_1kefv_24",xt={wrapper:Th,icon:jh,message:zh,dismiss:Ph};function Xi({message:e,onDismiss:n}){const t=Te();return y.jsxs("div",{className:xt.wrapper,role:"alert","data-juneau":"error",children:[y.jsx("svg",{className:xt.icon,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}),y.jsx("span",{className:xt.message,children:e}),n&&y.jsx("button",{className:xt.dismiss,onClick:n,"aria-label":t.errorDismiss,children:y.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}const Lh="_chat_1acbe_1",Dh={chat:Lh};function Ji({messages:e,input:n,isLoading:t,isConnecting:r,error:i,onInputChange:o,onSend:l,onStop:a,onProposalConfirm:s,onProposalCancel:u,onEntityClick:f,placeholder:c,assistantIcon:h,actions:p,sendIcon:g,renderPart:C,emptyState:S,className:x,style:E}){return y.jsxs("div",{className:[Dh.chat,x].filter(Boolean).join(" "),style:E,"data-juneau":"chat",children:[y.jsx(Yi,{messages:e,isLoading:t,isConnecting:r,onProposalConfirm:s,onProposalCancel:u,onEntityClick:f,assistantIcon:h,renderPart:C,emptyState:S}),i&&y.jsx(Xi,{message:i}),y.jsx(Qi,{value:n,onChange:o,onSend:l,onStop:a,isLoading:t,placeholder:c,actions:p,sendIcon:g})]})}const Mh="_header_1ss3g_1",Nh="_left_1ss3g_12",Rh="_icon_1ss3g_18",Fh="_title_1ss3g_23",Oh="_resetBtn_1ss3g_29",Bh="_actions_1ss3g_50",$h="_badge_1ss3g_57",Ie={header:Mh,left:Nh,icon:Rh,title:Fh,resetBtn:Oh,actions:Bh,badge:$h};function Gi({title:e,onMinimize:n,isMinimized:t,icon:r,onReset:i,badge:o,headerActions:l}){const a=Te();return y.jsxs("div",{className:Ie.header,"data-juneau":"header",children:[y.jsxs("div",{className:Ie.left,children:[y.jsx("span",{className:Ie.icon,"aria-hidden":"true",children:r??y.jsx(Pr,{})}),y.jsx("span",{className:Ie.title,children:e??a.sidebarTitle}),o&&y.jsx("span",{className:Ie.badge,"data-juneau":"header-badge",children:o})]}),(n||i||l)&&y.jsxs("div",{className:Ie.actions,children:[l,i&&y.jsx("button",{className:Ie.resetBtn,onClick:i,title:a.resetConversation,"aria-label":a.resetConversation,"data-juneau":"header-reset",children:y.jsx(Hl,{})}),n&&y.jsx("button",{className:Ie.resetBtn,onClick:n,title:t?a.expandSidebar:a.minimizeSidebar,"aria-label":t?a.expandSidebar:a.minimizeSidebar,"data-juneau":"header-minimize",children:t?y.jsx($l,{}):y.jsx(Bl,{})})]})]})}const Hh="_sidebar_17ski_1",qh="_minimized_17ski_20",_r={sidebar:Hh,minimized:qh};function Vh({title:e,icon:n,assistantIcon:t,actions:r,sendIcon:i,height:o="60vh",className:l,style:a,onReset:s,confirmReset:u,renderPart:f,onEntityClick:c,headerActions:h,badge:p,minimized:g,onMinimizedChange:C,emptyState:S}){const[x,E]=q.useState(!1),_=g!==void 0,z=_?g:x,M=()=>{const Y=!z;_||E(Y),C?.(Y)},{messages:b,input:F,setInput:H,sendMessage:B,stop:k,isLoading:T,isConnecting:j,error:U,reset:P,confirmProposal:v,cancelProposal:D}=zr(),O=s?async()=>{u&&!await u()||(P(),s())}:void 0;return y.jsxs("aside",{className:[_r.sidebar,z?_r.minimized:"",l].filter(Boolean).join(" "),style:{height:z?void 0:o,...a},"data-juneau":"sidebar",children:[y.jsx(Gi,{title:e,icon:n,onMinimize:M,isMinimized:z,onReset:O,badge:p,headerActions:h}),!z&&y.jsx(Ji,{messages:b,input:F,isLoading:T,isConnecting:j,error:U,onInputChange:H,onSend:B,onStop:k,onProposalConfirm:v,onProposalCancel:D,assistantIcon:t??n,actions:r,sendIcon:i,renderPart:f,onEntityClick:c,emptyState:S})]})}const Uh="_list_180ms_1",Wh="_item_180ms_10",Yh="_chat_180ms_16",Qh="_chatActive_180ms_36",Xh="_title_180ms_40",Jh="_date_180ms_50",Gh="_empty_180ms_82",ve={list:Uh,item:Wh,chat:Yh,chatActive:Qh,title:Xh,date:Jh,delete:"_delete_180ms_56",empty:Gh};function Kh({chats:e,onSelect:n,activeChatId:t,onDelete:r}){const i=Te();return e.length===0?y.jsx("p",{className:ve.empty,children:i.historyEmpty}):y.jsx("ul",{className:ve.list,"data-juneau":"history-list",children:e.map(o=>y.jsxs("li",{className:ve.item,children:[y.jsxs("button",{className:o.id===t?`${ve.chat} ${ve.chatActive}`:ve.chat,onClick:()=>n(o.id),children:[y.jsx("span",{className:ve.title,children:o.title}),y.jsx("span",{className:ve.date,children:o.updatedAt.toLocaleDateString(void 0,{day:"numeric",month:"short"})})]}),r&&y.jsx("button",{className:ve.delete,onClick:()=>r(o.id),"aria-label":i.historyDeleteChat,children:y.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]},o.id))})}exports.AiActivityPart=$i;exports.AiChat=Ji;exports.AiChatContext=vt;exports.AiChatHeader=Gi;exports.AiChatHistoryList=Kh;exports.AiChatProvider=Pl;exports.AiEntityCard=En;exports.AiEntityListPart=Hi;exports.AiError=Xi;exports.AiInput=Qi;exports.AiMessageBubble=Ui;exports.AiMessageList=Yi;exports.AiMessagePartRenderer=qi;exports.AiProposalCard=Bi;exports.AiSidebar=Vh;exports.AiTablePart=Oi;exports.AiTypingIndicator=Wi;exports.JuneauProvider=Tl;exports.consumeStream=Yt;exports.createFetchStreamAdapter=Sl;exports.createSseAdapter=bl;exports.delay=K;exports.deserializeMessages=cl;exports.getMessageText=Er;exports.isProposalPart=on;exports.juneauCs=Ll;exports.juneauEn=sn;exports.mockAdapter=pl;exports.parseJuneauWire=an;exports.serializeForStorage=sl;exports.serializeMessages=Ar;exports.trimChats=fl;exports.trimHistory=Ir;exports.useAiChat=Tr;exports.useAiChatContext=zr;exports.useAiChatContextSafe=zl;
57
+ `))}function s(p,g,C,S){const x=C.enter("tableCell"),E=C.enter("phrasing"),_=C.containerPhrasing(p,{...S,before:o,after:o});return E(),x(),_}function u(p,g){return Hc(p,{align:g,alignDelimiters:r,padding:t,stringLength:i})}function f(p,g,C){const S=p.children;let x=-1;const E=[],_=g.enter("table");for(;++x<S.length;)E[x]=c(S[x],g,C);return _(),E}function c(p,g,C){const S=p.children;let x=-1;const E=[],_=g.enter("tableRow");for(;++x<S.length;)E[x]=s(S[x],p,g,C);return _(),E}function h(p,g,C){let S=ji.inlineCode(p,g,C);return C.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function jf(){return{exit:{taskListCheckValueChecked:Cr,taskListCheckValueUnchecked:Cr,paragraph:Pf}}}function zf(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Lf}}}function Cr(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function Pf(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const t=this.stack[this.stack.length-1];t.type;const r=t.children[0];if(r&&r.type==="text"){const i=n.children;let o=-1,l;for(;++o<i.length;){const a=i[o];if(a.type==="paragraph"){l=a;break}}l===t&&(r.value=r.value.slice(1),r.value.length===0?t.children.shift():t.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,t.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Lf(e,n,t,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",a=t.createTracker(r);o&&a.move(l);let s=ji.listItem(e,n,t,{...r,...a.current()});return o&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),s;function u(f){return f+l}}function Df(){return[fc(),Pc(),Nc(),Sf(),jf()]}function Mf(e){return{extensions:[pc(),Lc(e),Rc(),Tf(e),zf()]}}const Nf={tokenize:Hf,partial:!0},zi={tokenize:qf,partial:!0},Pi={tokenize:Vf,partial:!0},Li={tokenize:Uf,partial:!0},Rf={tokenize:Wf,partial:!0},Di={name:"wwwAutolink",tokenize:Bf,previous:Ni},Mi={name:"protocolAutolink",tokenize:$f,previous:Ri},_e={name:"emailAutolink",tokenize:Of,previous:Fi},be={};function Ff(){return{text:be}}let Le=48;for(;Le<123;)be[Le]=_e,Le++,Le===58?Le=65:Le===91&&(Le=97);be[43]=_e;be[45]=_e;be[46]=_e;be[95]=_e;be[72]=[_e,Mi];be[104]=[_e,Mi];be[87]=[_e,Di];be[119]=[_e,Di];function Of(e,n,t){const r=this;let i,o;return l;function l(c){return!ln(c)||!Fi.call(r,r.previous)||An(r.events)?t(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(c))}function a(c){return ln(c)?(e.consume(c),a):c===64?(e.consume(c),s):t(c)}function s(c){return c===46?e.check(Rf,f,u)(c):c===45||c===95||ie(c)?(o=!0,e.consume(c),s):f(c)}function u(c){return e.consume(c),i=!0,s}function f(c){return o&&i&&ae(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(c)):t(c)}}function Bf(e,n,t){const r=this;return i;function i(l){return l!==87&&l!==119||!Ni.call(r,r.previous)||An(r.events)?t(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Nf,e.attempt(zi,e.attempt(Pi,o),t),t)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(l)}}function $f(e,n,t){const r=this;let i="",o=!1;return l;function l(c){return(c===72||c===104)&&Ri.call(r,r.previous)&&!An(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),a):t(c)}function a(c){if(ae(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),a;if(c===58){const h=i.toLowerCase();if(h==="http"||h==="https")return e.consume(c),s}return t(c)}function s(c){return c===47?(e.consume(c),o?u:(o=!0,s)):t(c)}function u(c){return c===null||bt(c)||G(c)||Ne(c)||_t(c)?t(c):e.attempt(zi,e.attempt(Pi,f),t)(c)}function f(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(c)}}function Hf(e,n,t){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),o):t(l)}function o(l){return l===null?t(l):n(l)}}function qf(e,n,t){let r,i,o;return l;function l(u){return u===46||u===95?e.check(Li,s,a)(u):u===null||G(u)||Ne(u)||u!==45&&_t(u)?s(u):(o=!0,e.consume(u),l)}function a(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),l}function s(u){return i||r||!o?t(u):n(u)}}function Vf(e,n){let t=0,r=0;return i;function i(l){return l===40?(t++,e.consume(l),i):l===41&&r<t?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(Li,n,o)(l):l===null||G(l)||Ne(l)?n(l):(e.consume(l),i)}function o(l){return l===41&&r++,e.consume(l),i}}function Uf(e,n,t){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?(e.consume(a),r):a===38?(e.consume(a),o):a===93?(e.consume(a),i):a===60||a===null||G(a)||Ne(a)?n(a):t(a)}function i(a){return a===null||a===40||a===91||G(a)||Ne(a)?n(a):r(a)}function o(a){return ae(a)?l(a):t(a)}function l(a){return a===59?(e.consume(a),r):ae(a)?(e.consume(a),l):t(a)}}function Wf(e,n,t){return r;function r(o){return e.consume(o),i}function i(o){return ie(o)?t(o):n(o)}}function Ni(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||G(e)}function Ri(e){return!ae(e)}function Fi(e){return!(e===47||ln(e))}function ln(e){return e===43||e===45||e===46||e===95||ie(e)}function An(e){let n=e.length,t=!1;for(;n--;){const r=e[n][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){t=!0;break}if(r._gfmAutolinkLiteralWalkedInto){t=!1;break}}return e.length>0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const Yf={tokenize:tp,partial:!0};function Qf(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Kf,continuation:{tokenize:Zf},exit:ep}},text:{91:{name:"gfmFootnoteCall",tokenize:Gf},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Xf,resolveTo:Jf}}}}function Xf(e,n,t){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const s=r.events[i][1];if(s.type==="labelImage"){l=s;break}if(s.type==="gfmFootnoteCall"||s.type==="labelLink"||s.type==="label"||s.type==="image"||s.type==="link")break}return a;function a(s){if(!l||!l._balanced)return t(s);const u=ye(r.sliceSerialize({start:l.end,end:r.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?t(s):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),n(s))}}function Jf(e,n){let t=e.length;for(;t--;)if(e[t][1].type==="labelImage"&&e[t][0]==="enter"){e[t][1];break}e[t+1][1].type="data",e[t+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[t+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[t+3][1].end),end:Object.assign({},e[t+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[t+1],e[t+2],["enter",r,n],e[t+3],e[t+4],["enter",i,n],["exit",i,n],["enter",o,n],["enter",l,n],["exit",l,n],["exit",o,n],e[e.length-2],e[e.length-1],["exit",r,n]];return e.splice(t,e.length-t+1,...a),e}function Gf(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return a;function a(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),s}function s(c){return c!==94?t(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(o>999||c===93&&!l||c===null||c===91||G(c))return t(c);if(c===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(ye(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):t(c)}return G(c)||(l=!0),o++,e.consume(c),c===92?f:u}function f(c){return c===91||c===92||c===93?(e.consume(c),o++,u):u(c)}}function Kf(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,l=0,a;return s;function s(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):t(g)}function f(g){if(l>999||g===93&&!a||g===null||g===91||G(g))return t(g);if(g===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return o=ye(r.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return G(g)||(a=!0),l++,e.consume(g),g===92?c:f}function c(g){return g===91||g===92||g===93?(e.consume(g),l++,f):f(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(o)||i.push(o),W(e,p,"gfmFootnoteDefinitionWhitespace")):t(g)}function p(g){return n(g)}}function Zf(e,n,t){return e.check(st,n,e.attempt(Yf,n,t))}function ep(e){e.exit("gfmFootnoteDefinition")}function tp(e,n,t){const r=this;return W(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?n(o):t(o)}}function np(e){let t=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return t==null&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,a){let s=-1;for(;++s<l.length;)if(l[s][0]==="enter"&&l[s][1].type==="strikethroughSequenceTemporary"&&l[s][1]._close){let u=s;for(;u--;)if(l[u][0]==="exit"&&l[u][1].type==="strikethroughSequenceTemporary"&&l[u][1]._open&&l[s][1].end.offset-l[s][1].start.offset===l[u][1].end.offset-l[u][1].start.offset){l[s][1].type="strikethroughSequence",l[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},l[u][1].start),end:Object.assign({},l[s][1].end)},c={type:"strikethroughText",start:Object.assign({},l[u][1].end),end:Object.assign({},l[s][1].start)},h=[["enter",f,a],["enter",l[u][1],a],["exit",l[u][1],a],["enter",c,a]],p=a.parser.constructs.insideSpan.null;p&&he(h,h.length,0,At(p,l.slice(u+1,s),a)),he(h,h.length,0,[["exit",c,a],["enter",l[s][1],a],["exit",l[s][1],a],["exit",f,a]]),he(l,u-1,s-u+3,h),s=u+h.length-2;break}}for(s=-1;++s<l.length;)l[s][1].type==="strikethroughSequenceTemporary"&&(l[s][1].type="data");return l}function o(l,a,s){const u=this.previous,f=this.events;let c=0;return h;function h(g){return u===126&&f[f.length-1][1].type!=="characterEscape"?s(g):(l.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const C=qe(u);if(g===126)return c>1?s(g):(l.consume(g),c++,p);if(c<2&&!t)return s(g);const S=l.exit("strikethroughSequenceTemporary"),x=qe(g);return S._open=!x||x===2&&!!C,S._close=!C||C===2&&!!x,a(g)}}}class rp{constructor(){this.map=[]}add(n,t,r){ip(this,n,t,r)}consume(n){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let t=this.map.length;const r=[];for(;t>0;)t-=1,r.push(n.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),n.length=this.map[t][0];r.push(n.slice()),n.length=0;let i=r.pop();for(;i;){for(const o of i)n.push(o);i=r.pop()}this.map.length=0}}function ip(e,n,t,r){let i=0;if(!(t===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===n){e.map[i][1]+=t,e.map[i][2].push(...r);return}i+=1}e.map.push([n,t,r])}}function lp(e,n){let t=!1;const r=[];for(;n<e.length;){const i=e[n];if(t){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(t=!0);n+=1}return r}function op(){return{flow:{null:{name:"table",tokenize:ap,resolveAll:sp}}}}function ap(e,n,t){const r=this;let i=0,o=0,l;return a;function a(k){let T=r.events.length-1;for(;T>-1;){const P=r.events[T][1].type;if(P==="lineEnding"||P==="linePrefix")T--;else break}const j=T>-1?r.events[T][1].type:null,U=j==="tableHead"||j==="tableRow"?b:s;return U===b&&r.parser.lazy[r.now().line]?t(k):U(k)}function s(k){return e.enter("tableHead"),e.enter("tableRow"),u(k)}function u(k){return k===124||(l=!0,o+=1),f(k)}function f(k){return k===null?t(k):L(k)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),p):t(k):$(k)?W(e,f,"whitespace")(k):(o+=1,l&&(l=!1,i+=1),k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),l=!0,f):(e.enter("data"),c(k)))}function c(k){return k===null||k===124||G(k)?(e.exit("data"),f(k)):(e.consume(k),k===92?h:c)}function h(k){return k===92||k===124?(e.consume(k),c):c(k)}function p(k){return r.interrupt=!1,r.parser.lazy[r.now().line]?t(k):(e.enter("tableDelimiterRow"),l=!1,$(k)?W(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):g(k))}function g(k){return k===45||k===58?S(k):k===124?(l=!0,e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),C):M(k)}function C(k){return $(k)?W(e,S,"whitespace")(k):S(k)}function S(k){return k===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),x):k===45?(o+=1,x(k)):k===null||L(k)?z(k):M(k)}function x(k){return k===45?(e.enter("tableDelimiterFiller"),E(k)):M(k)}function E(k){return k===45?(e.consume(k),E):k===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(k),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(k))}function _(k){return $(k)?W(e,z,"whitespace")(k):z(k)}function z(k){return k===124?g(k):k===null||L(k)?!l||i!==o?M(k):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(k)):M(k)}function M(k){return t(k)}function b(k){return e.enter("tableRow"),F(k)}function F(k){return k===124?(e.enter("tableCellDivider"),e.consume(k),e.exit("tableCellDivider"),F):k===null||L(k)?(e.exit("tableRow"),n(k)):$(k)?W(e,F,"whitespace")(k):(e.enter("data"),H(k))}function H(k){return k===null||k===124||G(k)?(e.exit("data"),F(k)):(e.consume(k),k===92?B:H)}function B(k){return k===92||k===124?(e.consume(k),H):H(k)}}function sp(e,n){let t=-1,r=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],a=!1,s=0,u,f,c;const h=new rp;for(;++t<e.length;){const p=e[t],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,s!==0&&(Sr(h,n,s,u,f),f=void 0,s=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(t,0,[["enter",u,n]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,c=void 0,o=[0,0,0,0],l=[0,t+1,0,0],a&&(a=!1,f={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(t,0,[["enter",f,n]])),i=g.type==="tableDelimiterRow"?2:f?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],c=mt(h,n,o,i,void 0,c),o=[0,0,0,0]),l[2]=t)):g.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],c=mt(h,n,o,i,void 0,c)),o=l,l=[o[1],t,0,0])):g.type==="tableHead"?(a=!0,s=t):g.type==="tableRow"||g.type==="tableDelimiterRow"?(s=t,o[1]!==0?(l[0]=l[1],c=mt(h,n,o,i,t,c)):l[1]!==0&&(c=mt(h,n,l,i,t,c)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(l[3]=t)}for(s!==0&&Sr(h,n,s,u,f),h.consume(n.events),t=-1;++t<n.events.length;){const p=n.events[t];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=lp(n.events,t))}return e}function mt(e,n,t,r,i,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";t[0]!==0&&(o.end=Object.assign({},He(n.events,t[0])),e.add(t[0],0,[["exit",o,n]]));const s=He(n.events,t[1]);if(o={type:l,start:Object.assign({},s),end:Object.assign({},s)},e.add(t[1],0,[["enter",o,n]]),t[2]!==0){const u=He(n.events,t[2]),f=He(n.events,t[3]),c={type:a,start:Object.assign({},u),end:Object.assign({},f)};if(e.add(t[2],0,[["enter",c,n]]),r!==2){const h=n.events[t[2]],p=n.events[t[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",t[3]>t[2]+1){const g=t[2]+1,C=t[3]-t[2]-1;e.add(g,C,[])}}e.add(t[3]+1,0,[["exit",c,n]])}return i!==void 0&&(o.end=Object.assign({},He(n.events,i)),e.add(i,0,[["exit",o,n]]),o=void 0),o}function Sr(e,n,t,r,i){const o=[],l=He(n.events,t);i&&(i.end=Object.assign({},l),o.push(["exit",i,n])),r.end=Object.assign({},l),o.push(["exit",r,n]),e.add(t+1,0,o)}function He(e,n){const t=e[n],r=t[0]==="enter"?"start":"end";return t[1][r]}const up={name:"tasklistCheck",tokenize:fp};function cp(){return{text:{91:up}}}function fp(e,n,t){const r=this;return i;function i(s){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?t(s):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),o)}function o(s){return G(s)?(e.enter("taskListCheckValueUnchecked"),e.consume(s),e.exit("taskListCheckValueUnchecked"),l):s===88||s===120?(e.enter("taskListCheckValueChecked"),e.consume(s),e.exit("taskListCheckValueChecked"),l):t(s)}function l(s){return s===93?(e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):t(s)}function a(s){return L(s)?n(s):$(s)?e.check({tokenize:pp},n,t)(s):t(s)}}function pp(e,n,t){return W(e,r,"whitespace");function r(i){return i===null?t(i):n(i)}}function hp(e){return Qr([Ff(),Qf(),np(e),op(),cp()])}const dp={};function mp(e){const n=this,t=e||dp,r=n.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(hp(t)),o.push(Df()),l.push(Mf(t))}const gp="_wrapper_v5oy7_1",yp="_table_v5oy7_8",xp="_th_v5oy7_14",kp="_tr_v5oy7_24",bp="_td_v5oy7_32",Ze={wrapper:gp,table:yp,th:xp,tr:kp,td:bp};function Oi({part:e}){return y.jsx("div",{className:Ze.wrapper,"data-juneau":"table-part",children:y.jsxs("table",{className:Ze.table,children:[y.jsx("thead",{children:y.jsx("tr",{children:e.columns.map(n=>y.jsx("th",{className:Ze.th,children:n},n))})}),y.jsx("tbody",{children:e.rows.map((n,t)=>y.jsx("tr",{className:Ze.tr,children:e.columns.map(r=>y.jsx("td",{className:Ze.td,children:String(n[r]??"")},r))},t))})]})})}const wp="_card_1un2m_1",Cp="_header_1un2m_9",Sp="_icon_1un2m_16",vp="_title_1un2m_24",_p="_description_1un2m_30",Ap="_cardResolved_1un2m_37",Ep="_resolvedBadge_1un2m_41",Ip="_actions_1un2m_52",Tp="_confirm_1un2m_57",jp="_cancel_1un2m_73",ge={card:wp,header:Cp,icon:Sp,title:vp,description:_p,cardResolved:Ap,resolvedBadge:Ep,actions:Ip,confirm:Tp,cancel:jp};function Bi({part:e,onConfirm:n,onCancel:t}){const r=Te(),{proposal:i}=e,o=i.resolved==="confirmed"?r.proposalConfirmed:i.resolved==="cancelled"?r.proposalCancelled:i.resolved==="expired"?r.proposalExpired:null;return y.jsxs("div",{className:i.resolved?`${ge.card} ${ge.cardResolved}`:ge.card,"data-juneau":"proposal-card",children:[y.jsxs("div",{className:ge.header,children:[y.jsx("svg",{className:ge.icon,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M10 1a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5A.75.75 0 0110 1zM5.05 3.05a.75.75 0 011.06 1.06l-1.06 1.06a.75.75 0 11-1.06-1.06l1.06-1.06zm9.9 0a.75.75 0 010 1.06l-1.06 1.06a.75.75 0 11-1.06-1.06l1.06-1.06a.75.75 0 011.06 0zM10 6a4 4 0 100 8 4 4 0 000-8zm-9 4a.75.75 0 01.75-.75h1.5a.75.75 0 010 1.5h-1.5A.75.75 0 011 10zm15.75-.75a.75.75 0 000 1.5h1.5a.75.75 0 000-1.5h-1.5zM4.11 14.89a.75.75 0 010 1.06l-1.06 1.06a.75.75 0 11-1.06-1.06l1.06-1.06a.75.75 0 011.06 0zm11.84 1.06a.75.75 0 10-1.06-1.06l-1.06 1.06a.75.75 0 101.06 1.06l1.06-1.06zM10 17.25a.75.75 0 01.75.75v1.5a.75.75 0 01-1.5 0v-1.5a.75.75 0 01.75-.75z"})}),y.jsx("span",{className:ge.title,children:i.title})]}),i.description&&y.jsx("p",{className:ge.description,children:i.description}),o?y.jsx("span",{className:ge.resolvedBadge,children:o}):y.jsxs("div",{className:ge.actions,children:[y.jsx("button",{className:ge.confirm,onClick:()=>n(i.id,i.payload),children:i.confirmLabel??r.proposalConfirm}),y.jsx("button",{className:ge.cancel,onClick:()=>t(i.id),children:i.cancelLabel??r.proposalCancel})]})]})}const zp="_activity_2jjfs_1",Pp="_indicator_2jjfs_13",Lp="_content_2jjfs_36",Dp="_title_2jjfs_40",Mp="_description_2jjfs_45",et={activity:zp,indicator:Pp,content:Lp,title:Dp,description:Mp};function $i({part:e}){return y.jsxs("div",{className:et.activity,"data-status":e.status,"data-juneau":"activity-part",children:[y.jsx("span",{className:et.indicator,"aria-hidden":"true"}),y.jsxs("div",{className:et.content,children:[y.jsx("div",{className:et.title,children:e.title}),e.description&&y.jsx("div",{className:et.description,children:e.description})]})]})}const Np="_card_jwkcu_1",Rp="_cardClickable_jwkcu_14",Fp="_header_jwkcu_24",Op="_title_jwkcu_30",Bp="_subtitle_jwkcu_36",$p="_fields_jwkcu_41",Hp="_fieldRow_jwkcu_48",qp="_fieldLabel_jwkcu_55",Vp="_fieldValue_jwkcu_61",Up="_badge_jwkcu_68",Wp="_badgeSuccess_jwkcu_76",Yp="_badgeWarning_jwkcu_81",Qp="_badgeDanger_jwkcu_86",Xp="_badgeNeutral_jwkcu_91",oe={card:Np,cardClickable:Rp,header:Fp,title:Op,subtitle:Bp,fields:$p,fieldRow:Hp,fieldLabel:qp,fieldValue:Vp,badge:Up,badgeSuccess:Wp,badgeWarning:Yp,badgeDanger:Qp,badgeNeutral:Xp},Jp={success:oe.badgeSuccess,warning:oe.badgeWarning,danger:oe.badgeDanger,neutral:oe.badgeNeutral};function En({part:e,onEntityClick:n}){const{entity:t,entityType:r}=e,i=n!==void 0,o=y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:oe.header,children:[y.jsx("span",{className:oe.title,children:t.title}),t.subtitle&&y.jsx("span",{className:oe.subtitle,children:t.subtitle})]}),t.fields&&t.fields.length>0&&y.jsx("dl",{className:oe.fields,children:t.fields.map((l,a)=>y.jsxs("div",{className:oe.fieldRow,children:[y.jsx("dt",{className:oe.fieldLabel,children:l.label}),y.jsx("dd",{className:oe.fieldValue,children:l.badge?y.jsx("span",{className:`${oe.badge} ${Jp[l.badge]}`,children:l.value}):l.value})]},a))})]});return i?y.jsx("button",{type:"button",className:`${oe.card} ${oe.cardClickable}`,onClick:()=>n(t,r),"data-juneau":"entity-card",children:o}):y.jsx("div",{className:oe.card,"data-juneau":"entity-card",children:o})}const Gp="_list_a2maw_1",Kp="_listTitle_a2maw_11",vr={list:Gp,listTitle:Kp};function Hi({part:e,onEntityClick:n}){return y.jsxs("div",{className:vr.list,"data-juneau":"entity-list-part",children:[e.title&&y.jsx("span",{className:vr.listTitle,children:e.title}),e.entities.map((t,r)=>y.jsx(En,{part:{type:"entity",entity:t,entityType:e.entityType},onEntityClick:n},t.id??r))]})}const Zp="_markdown_1yi3y_1",eh="_unknownPart_1yi3y_84",th="_errorText_1yi3y_98",nh="_errorIcon_1yi3y_106",gt={markdown:Zp,unknownPart:eh,errorText:th,errorIcon:nh};function qi({part:e,onProposalConfirm:n,onProposalCancel:t,onEntityClick:r,renderPart:i}){if(i){const o=i(e);if(o!=null)return y.jsx(y.Fragment,{children:o})}switch(e.type){case"text":return y.jsx("div",{className:gt.markdown,children:y.jsx(tc,{remarkPlugins:[mp],children:e.text})});case"table":return y.jsx(Oi,{part:e});case"activity":return y.jsx($i,{part:e});case"proposal":return y.jsx(Bi,{part:e,onConfirm:n,onCancel:t});case"entity":return y.jsx(En,{part:e,onEntityClick:r});case"entity-list":return y.jsx(Hi,{part:e,onEntityClick:r});case"error":return y.jsxs("span",{className:gt.errorText,children:[y.jsx(ql,{className:gt.errorIcon}),e.message]});default:return globalThis.process?.env?.NODE_ENV!=="production"?y.jsxs("div",{className:gt.unknownPart,children:["Unhandled part type: ",y.jsx("code",{children:e.type})," — pass a"," ",y.jsx("code",{children:"renderPart"})," prop to render it."]}):null}}const rh="_wrapper_1q20p_1",ih="_user_1q20p_8",lh="_assistant_1q20p_12",oh="_avatar_1q20p_16",ah="_content_1q20p_43",sh="_bubble_1q20p_51",uh="_card_1q20p_70",ch="_empty_1q20p_92",xe={wrapper:rh,user:ih,assistant:lh,avatar:oh,content:ah,bubble:sh,card:uh,empty:ch},fh=new Set(["text","error","activity"]);function Vi(e){return!fh.has(e.type)}function ph(e){const n=[];return e.forEach((t,r)=>{const i=Vi(t),o=n[n.length-1];if(o&&!i&&!o.card){o.parts.push({part:t,index:r});return}n.push({card:i,parts:[{part:t,index:r}]})}),n}function Ui({message:e,onProposalConfirm:n,onProposalCancel:t,onEntityClick:r,assistantIcon:i,renderPart:o}){const l=Te(),a=e.role==="user",s=(f,c)=>y.jsx(qi,{part:f,onProposalConfirm:n,onProposalCancel:t,onEntityClick:r,renderPart:o},c),u=e.parts.some(Vi);return y.jsxs("div",{className:`${xe.wrapper} ${a?xe.user:xe.assistant}`,"data-juneau":"message","data-juneau-role":e.role,children:[!a&&y.jsx("div",{className:xe.avatar,"aria-hidden":"true","data-juneau":"assistant-avatar",children:i??y.jsx(Pr,{})}),u?y.jsx("div",{className:xe.content,children:ph(e.parts).map((f,c)=>y.jsx("div",{className:f.card?xe.card:xe.bubble,"data-juneau-segment":f.card?"card":"bubble",children:f.parts.map(({part:h,index:p})=>s(h,p))},c))}):y.jsxs("div",{className:xe.bubble,"data-juneau-segment":"bubble",children:[e.parts.map((f,c)=>s(f,c)),e.parts.length===0&&y.jsx("span",{className:xe.empty})]}),a&&y.jsx("div",{className:xe.avatar,children:l.userLabel})]})}const hh="_wrapper_1dvvu_1",dh="_dot_1dvvu_8",mh="_connectingLabel_1dvvu_19",tt={wrapper:hh,dot:dh,connectingLabel:mh};function Wi({connecting:e=!1}){const n=Te();return y.jsxs("div",{className:tt.wrapper,"aria-label":e?n.connectingMessage:n.typingMessage,"data-juneau":"typing-indicator",children:[y.jsx("span",{className:tt.dot}),y.jsx("span",{className:tt.dot}),y.jsx("span",{className:tt.dot}),e&&y.jsx("span",{className:tt.connectingLabel,children:n.connectingMessage})]})}const gh="_list_1f8gn_1",yh="_empty_1f8gn_11",xh="_hint_1f8gn_24",kh="_typing_1f8gn_31",yt={list:gh,empty:yh,hint:xh,typing:kh};function Yi({messages:e,isLoading:n,isConnecting:t,onProposalConfirm:r,onProposalCancel:i,onEntityClick:o,assistantIcon:l,renderPart:a,emptyState:s}){const u=Te(),f=q.useRef(null);return q.useEffect(()=>{f.current?.scrollIntoView({behavior:"smooth"})},[e,n]),y.jsxs("div",{className:yt.list,"data-juneau":"message-list",children:[e.length===0&&(s??y.jsxs("div",{className:yt.empty,"data-juneau":"empty-state",children:[y.jsx("p",{children:u.emptyStateText}),y.jsx("p",{className:yt.hint,children:y.jsx("em",{children:u.emptyStateHint})})]})),e.map(c=>y.jsx(Ui,{message:c,onProposalConfirm:r,onProposalCancel:i,onEntityClick:o,assistantIcon:l,renderPart:a},c.id)),n&&y.jsx("div",{className:yt.typing,children:y.jsx(Wi,{connecting:t})}),y.jsx("div",{ref:f})]})}const bh="_wrapper_v8iyr_1",wh="_textarea_v8iyr_11",Ch="_toolbar_v8iyr_35",Sh="_actions_v8iyr_45",vh="_actionBtn_v8iyr_52",_h="_sendBtn_v8iyr_85",Ah="_spinnerIcon_v8iyr_116",Eh="_stopBtn_v8iyr_126",Ih="_stopIcon_v8iyr_149",Se={wrapper:bh,textarea:wh,toolbar:Ch,actions:Sh,actionBtn:vh,sendBtn:_h,spinnerIcon:Ah,stopBtn:Eh,stopIcon:Ih};function Qi({value:e,onChange:n,onSend:t,onStop:r,isLoading:i,placeholder:o,actions:l,sendIcon:a}){const s=Te(),u=q.useRef(null),f=q.useRef(!1);q.useEffect(()=>{f.current&&!i&&u.current?.focus(),f.current=i},[i]);const c=[{icon:y.jsx(Ml,{}),label:s.actionAddFile},{icon:y.jsx(Nl,{}),label:s.actionQuickActions},{icon:y.jsx(Rl,{}),label:s.actionNew},{icon:y.jsx(Fl,{}),label:s.actionHistory},{icon:y.jsx(Ol,{}),label:s.actionRules}],h=l??c,p=g=>{g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),i||t())};return y.jsxs("div",{className:Se.wrapper,"data-juneau":"input",children:[y.jsx("textarea",{ref:u,className:Se.textarea,"data-juneau":"input-textarea",value:e,onChange:g=>n(g.target.value),onKeyDown:p,placeholder:o??s.inputPlaceholder,rows:3,"aria-label":s.sendMessage}),y.jsxs("div",{className:Se.toolbar,children:[h.length>0&&y.jsx("div",{className:Se.actions,children:h.map((g,C)=>y.jsxs("button",{className:Se.actionBtn,type:"button",disabled:i,"aria-label":g.label,onClick:g.onClick,children:[g.icon,y.jsx("span",{children:g.label})]},C))}),i&&r?y.jsxs("button",{className:Se.stopBtn,onClick:r,"aria-label":s.stopMessage,type:"button",children:[y.jsx("svg",{className:Se.stopIcon,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),y.jsx("span",{children:s.stopMessage})]}):y.jsxs("button",{className:Se.sendBtn,onClick:t,disabled:i||!e.trim(),"aria-label":s.sendMessage,type:"button",children:[i?y.jsx("svg",{className:Se.spinnerIcon,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:y.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"12"})}):a??y.jsx(Dl,{}),y.jsx("span",{children:s.sendMessage})]})]})]})}const Th="_wrapper_1kefv_1",jh="_icon_1kefv_14",zh="_message_1kefv_20",Ph="_dismiss_1kefv_24",xt={wrapper:Th,icon:jh,message:zh,dismiss:Ph};function Xi({message:e,onDismiss:n}){const t=Te();return y.jsxs("div",{className:xt.wrapper,role:"alert","data-juneau":"error",children:[y.jsx("svg",{className:xt.icon,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}),y.jsx("span",{className:xt.message,children:e}),n&&y.jsx("button",{className:xt.dismiss,onClick:n,"aria-label":t.errorDismiss,children:y.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}const Lh="_chat_1acbe_1",Dh={chat:Lh};function Ji({messages:e,input:n,isLoading:t,isConnecting:r,error:i,onInputChange:o,onSend:l,onStop:a,onProposalConfirm:s,onProposalCancel:u,onEntityClick:f,placeholder:c,assistantIcon:h,actions:p,sendIcon:g,renderPart:C,emptyState:S,className:x,style:E}){return y.jsxs("div",{className:[Dh.chat,x].filter(Boolean).join(" "),style:E,"data-juneau":"chat",children:[y.jsx(Yi,{messages:e,isLoading:t,isConnecting:r,onProposalConfirm:s,onProposalCancel:u,onEntityClick:f,assistantIcon:h,renderPart:C,emptyState:S}),i&&y.jsx(Xi,{message:i}),y.jsx(Qi,{value:n,onChange:o,onSend:l,onStop:a,isLoading:t,placeholder:c,actions:p,sendIcon:g})]})}const Mh="_header_1ss3g_1",Nh="_left_1ss3g_12",Rh="_icon_1ss3g_18",Fh="_title_1ss3g_23",Oh="_resetBtn_1ss3g_29",Bh="_actions_1ss3g_50",$h="_badge_1ss3g_57",Ie={header:Mh,left:Nh,icon:Rh,title:Fh,resetBtn:Oh,actions:Bh,badge:$h};function Gi({title:e,onMinimize:n,isMinimized:t,icon:r,onReset:i,badge:o,headerActions:l}){const a=Te();return y.jsxs("div",{className:Ie.header,"data-juneau":"header",children:[y.jsxs("div",{className:Ie.left,children:[y.jsx("span",{className:Ie.icon,"aria-hidden":"true","data-juneau":"header-icon",children:r??y.jsx(Pr,{})}),y.jsx("span",{className:Ie.title,children:e??a.sidebarTitle}),o&&y.jsx("span",{className:Ie.badge,"data-juneau":"header-badge",children:o})]}),(n||i||l)&&y.jsxs("div",{className:Ie.actions,children:[l,i&&y.jsx("button",{className:Ie.resetBtn,onClick:i,title:a.resetConversation,"aria-label":a.resetConversation,"data-juneau":"header-reset",children:y.jsx(Hl,{})}),n&&y.jsx("button",{className:Ie.resetBtn,onClick:n,title:t?a.expandSidebar:a.minimizeSidebar,"aria-label":t?a.expandSidebar:a.minimizeSidebar,"data-juneau":"header-minimize",children:t?y.jsx($l,{}):y.jsx(Bl,{})})]})]})}const Hh="_sidebar_17ski_1",qh="_minimized_17ski_20",_r={sidebar:Hh,minimized:qh};function Vh({title:e,icon:n,assistantIcon:t,actions:r,sendIcon:i,height:o="60vh",className:l,style:a,onReset:s,confirmReset:u,renderPart:f,onEntityClick:c,headerActions:h,badge:p,minimized:g,onMinimizedChange:C,emptyState:S}){const[x,E]=q.useState(!1),_=g!==void 0,z=_?g:x,M=()=>{const Y=!z;_||E(Y),C?.(Y)},{messages:b,input:F,setInput:H,sendMessage:B,stop:k,isLoading:T,isConnecting:j,error:U,reset:P,confirmProposal:v,cancelProposal:D}=zr(),O=s?async()=>{u&&!await u()||(P(),s())}:void 0;return y.jsxs("aside",{className:[_r.sidebar,z?_r.minimized:"",l].filter(Boolean).join(" "),style:{height:z?void 0:o,...a},"data-juneau":"sidebar",children:[y.jsx(Gi,{title:e,icon:n,onMinimize:M,isMinimized:z,onReset:O,badge:p,headerActions:h}),!z&&y.jsx(Ji,{messages:b,input:F,isLoading:T,isConnecting:j,error:U,onInputChange:H,onSend:B,onStop:k,onProposalConfirm:v,onProposalCancel:D,assistantIcon:t??n,actions:r,sendIcon:i,renderPart:f,onEntityClick:c,emptyState:S})]})}const Uh="_list_180ms_1",Wh="_item_180ms_10",Yh="_chat_180ms_16",Qh="_chatActive_180ms_36",Xh="_title_180ms_40",Jh="_date_180ms_50",Gh="_empty_180ms_82",ve={list:Uh,item:Wh,chat:Yh,chatActive:Qh,title:Xh,date:Jh,delete:"_delete_180ms_56",empty:Gh};function Kh({chats:e,onSelect:n,activeChatId:t,onDelete:r}){const i=Te();return e.length===0?y.jsx("p",{className:ve.empty,children:i.historyEmpty}):y.jsx("ul",{className:ve.list,"data-juneau":"history-list",children:e.map(o=>y.jsxs("li",{className:ve.item,children:[y.jsxs("button",{className:o.id===t?`${ve.chat} ${ve.chatActive}`:ve.chat,onClick:()=>n(o.id),children:[y.jsx("span",{className:ve.title,children:o.title}),y.jsx("span",{className:ve.date,children:o.updatedAt.toLocaleDateString(void 0,{day:"numeric",month:"short"})})]}),r&&y.jsx("button",{className:ve.delete,onClick:()=>r(o.id),"aria-label":i.historyDeleteChat,children:y.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:y.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]},o.id))})}exports.AiActivityPart=$i;exports.AiChat=Ji;exports.AiChatContext=vt;exports.AiChatHeader=Gi;exports.AiChatHistoryList=Kh;exports.AiChatProvider=Pl;exports.AiEntityCard=En;exports.AiEntityListPart=Hi;exports.AiError=Xi;exports.AiInput=Qi;exports.AiMessageBubble=Ui;exports.AiMessageList=Yi;exports.AiMessagePartRenderer=qi;exports.AiProposalCard=Bi;exports.AiSidebar=Vh;exports.AiTablePart=Oi;exports.AiTypingIndicator=Wi;exports.JuneauProvider=Tl;exports.consumeStream=Yt;exports.createFetchStreamAdapter=Sl;exports.createSseAdapter=bl;exports.delay=K;exports.deserializeMessages=cl;exports.getMessageText=Er;exports.isProposalPart=on;exports.juneauCs=Ll;exports.juneauEn=sn;exports.mockAdapter=pl;exports.parseJuneauWire=an;exports.serializeForStorage=sl;exports.serializeMessages=Ar;exports.trimChats=fl;exports.trimHistory=Ir;exports.useAiChat=Tr;exports.useAiChatContext=zr;exports.useAiChatContextSafe=zl;
58
58
  //# sourceMappingURL=index.cjs.map