@rubytech/create-maxy-code 0.1.498 → 0.1.499

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.
Files changed (41) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/lib/active-rules/dist/index.d.ts +3 -7
  3. package/payload/platform/lib/active-rules/dist/index.d.ts.map +1 -1
  4. package/payload/platform/lib/active-rules/dist/index.js +20 -52
  5. package/payload/platform/lib/active-rules/dist/index.js.map +1 -1
  6. package/payload/platform/lib/active-rules/src/index.test.ts +35 -69
  7. package/payload/platform/lib/active-rules/src/index.ts +17 -58
  8. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +3 -3
  9. package/payload/platform/plugins/docs/references/internals.md +2 -2
  10. package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.d.ts +2 -0
  11. package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.d.ts.map +1 -0
  12. package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.js +53 -0
  13. package/payload/platform/plugins/email/mcp/dist/__tests__/compose-signature.test.js.map +1 -0
  14. package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.d.ts +2 -0
  15. package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.d.ts.map +1 -0
  16. package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.js +50 -0
  17. package/payload/platform/plugins/email/mcp/dist/__tests__/signature.test.js.map +1 -0
  18. package/payload/platform/plugins/email/mcp/dist/lib/compose.d.ts.map +1 -1
  19. package/payload/platform/plugins/email/mcp/dist/lib/compose.js +15 -2
  20. package/payload/platform/plugins/email/mcp/dist/lib/compose.js.map +1 -1
  21. package/payload/platform/plugins/email/mcp/dist/lib/signature.d.ts +29 -0
  22. package/payload/platform/plugins/email/mcp/dist/lib/signature.d.ts.map +1 -0
  23. package/payload/platform/plugins/email/mcp/dist/lib/signature.js +55 -0
  24. package/payload/platform/plugins/email/mcp/dist/lib/signature.js.map +1 -0
  25. package/payload/platform/plugins/email/references/email-reference.md +10 -0
  26. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.js +10 -9
  27. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.js.map +1 -1
  28. package/payload/platform/plugins/memory/skills/conversational-memory/SKILL.md +2 -0
  29. package/payload/platform/plugins/memory/skills/preference-audit/SKILL.md +16 -0
  30. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.d.ts +19 -19
  31. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.d.ts.map +1 -1
  32. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.js +28 -34
  33. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.js.map +1 -1
  34. package/payload/server/public/assets/{chat-qtOiJX-Y.js → chat-MvnxPJZ5.js} +1 -1
  35. package/payload/server/public/assets/{operator-icJwMkZF.js → operator-DCNWUKP_.js} +1 -1
  36. package/payload/server/public/assets/{page-iG57nKOg.js → page-C4TrTU6r.js} +1 -1
  37. package/payload/server/public/assets/{public-CkOumzpf.js → public-DXJXQPwe.js} +1 -1
  38. package/payload/server/public/chat.html +2 -2
  39. package/payload/server/public/operator.html +2 -2
  40. package/payload/server/public/public.html +2 -2
  41. package/payload/server/server.js +47 -57
@@ -29,4 +29,4 @@ import{o as e,r as t,t as n}from"./chunk-fQC6bEKA.js";import{B as r,F as i,G as
29
29
  `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
30
30
  `,...a.current()});return/^[\t ]/.test(l)&&(l=Sc(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Oc.peek=kc;function Oc(e){return e.value||``}function kc(){return`<`}Ac.peek=jc;function Ac(e,t,n,r){let i=yc(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function jc(){return`!`}Mc.peek=Nc;function Mc(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Nc(){return`!`}Pc.peek=Fc;function Pc(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function Fc(){return"`"}function Ic(e,t){let n=gn(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Lc.peek=Rc;function Lc(e,t,n,r){let i=yc(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Ic(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function Rc(e,t,n){return Ic(e,n)?`<`:`[`}zc.peek=Bc;function zc(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function Bc(){return`[`}function Vc(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Hc(e){let t=Vc(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Uc(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function Wc(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Gc(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Uc(n):Vc(n),s=e.ordered?o===`.`?`)`:`.`:Hc(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),Wc(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function Kc(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function qc(e,t,n,r){let i=Kc(n),a=n.bulletCurrent||Vc(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Jc(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var Yc=to([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Xc(e,t,n,r){return(e.children.some(function(e){return Yc(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Zc(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Qc.peek=$c;function Qc(e,t,n,r){let i=Zc(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Cc(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Sc(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Cc(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Sc(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function $c(e,t,n){return n.options.strong||`*`}function el(e,t,n,r){return n.safe(e.value,r)}function tl(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function nl(e,t,n){let r=(Wc(n)+(n.options.ruleSpaces?` `:``)).repeat(tl(n));return n.options.ruleSpaces?r.slice(0,-1):r}var rl={blockquote:lc,break:pc,code:_c,definition:bc,emphasis:wc,hardBreak:pc,heading:Dc,html:Oc,image:Ac,imageReference:Mc,inlineCode:Pc,link:Lc,linkReference:zc,list:Gc,listItem:qc,paragraph:Jc,root:Xc,strong:Qc,text:el,thematicBreak:nl};function il(){return{enter:{table:al,tableData:ll,tableHeader:ll,tableRow:sl},exit:{codeText:ul,table:ol,tableData:cl,tableHeader:cl,tableRow:cl}}}function al(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function ol(e){this.exit(e),this.data.inTable=void 0}function sl(e){this.enter({type:`tableRow`,children:[]},e)}function cl(e){this.exit(e)}function ll(e){this.enter({type:`tableCell`,children:[]},e)}function ul(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,dl));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function dl(e,t){return t===`|`?t:e}function fl(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
31
31
  `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
32
- `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return oc(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=rl.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function pl(){return{exit:{taskListCheckValueChecked:hl,taskListCheckValueUnchecked:hl,paragraph:gl}}}function ml(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:_l}}}function hl(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function gl(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function _l(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=rl.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function vl(){return[ws(),Js(),$s(),il(),pl()]}function yl(e){return{extensions:[Ts(),Ys(e),ec(),fl(e),ml()]}}var bl={tokenize:Pl,partial:!0},xl={tokenize:Fl,partial:!0},Sl={tokenize:Il,partial:!0},Cl={tokenize:Ll,partial:!0},wl={tokenize:Rl,partial:!0},Tl={name:`wwwAutolink`,tokenize:Ml,previous:zl},El={name:`protocolAutolink`,tokenize:Nl,previous:Bl},Dl={name:`emailAutolink`,tokenize:jl,previous:Vl},Ol={};function kl(){return{text:Ol}}for(var Al=48;Al<123;)Ol[Al]=Dl,Al++,Al===58?Al=65:Al===91&&(Al=97);Ol[43]=Dl,Ol[45]=Dl,Ol[46]=Dl,Ol[95]=Dl,Ol[72]=[Dl,El],Ol[104]=[Dl,El],Ol[87]=[Dl,Tl],Ol[119]=[Dl,Tl];function jl(e,t,n){let r=this,i,a;return o;function o(t){return!Hl(t)||!Vl.call(r,r.previous)||Ul(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Hl(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(wl,u,l)(t):t===45||t===95||K(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&G(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Ml(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!zl.call(r,r.previous)||Ul(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(bl,e.attempt(xl,e.attempt(Sl,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Nl(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Bl.call(r,r.previous)&&!Ul(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(G(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||An(t)||J(t)||Fn(t)||Pn(t)?n(t):e.attempt(xl,e.attempt(Sl,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Pl(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Fl(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Cl,c,s)(t):t===null||J(t)||Fn(t)||t!==45&&Pn(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Il(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(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?e.check(Cl,t,a)(o):o===null||J(o)||Fn(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Ll(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||J(o)||Fn(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||J(e)||Fn(e)?t(e):r(e)}function a(e){return G(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):G(t)?(e.consume(t),o):n(t)}}function Rl(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return K(e)?n(e):t(e)}}function zl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||J(e)}function Bl(e){return!G(e)}function Vl(e){return!(e===47||Hl(e))}function Hl(e){return e===43||e===45||e===46||e===95||K(e)}function Ul(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Wl={tokenize:Ql,partial:!0};function Gl(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Yl,continuation:{tokenize:Xl},exit:Zl}},text:{91:{name:`gfmFootnoteCall`,tokenize:Jl},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Kl,resolveTo:ql}}}}function Kl(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=On(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function ql(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Jl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||J(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(On(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return J(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Yl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||J(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=On(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return J(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),X(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Xl(e,t,n){return e.check(Qn,t,e.attempt(Wl,t,n))}function Zl(e){e.exit(`gfmFootnoteDefinition`)}function Ql(e,t,n){let r=this;return X(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function $l(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&W(o,o.length,0,Gn(s,e.slice(r+1,n),t)),W(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),W(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Wn(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Wn(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var eu=class{constructor(){this.map=[]}add(e,t,n){tu(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function tu(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function nu(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function ru(){return{flow:{null:{name:`table`,tokenize:iu,resolveAll:au}}}}function iu(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Y(t)?X(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||J(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Y(t)?X(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Y(t)?X(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Y(t)?X(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||q(n)?(e.exit(`tableRow`),t(n)):Y(n)?X(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||J(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function au(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new eu;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(su(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=ou(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=ou(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=ou(f,t,o,i,n,d)):(o[0]=o[1],d=ou(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&su(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=nu(t.events,n))}return e}function ou(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},cu(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=cu(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=cu(t.events,n[2]),a=cu(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},cu(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function su(e,t,n,r,i){let a=[],o=cu(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function cu(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var lu={name:`tasklistCheck`,tokenize:du};function uu(){return{text:{91:lu}}}function du(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return J(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return q(r)?t(r):Y(r)?e.check({tokenize:fu},t,n)(r):n(r)}}function fu(e,t,n){return X(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function pu(e){return wn([kl(),Gl(),$l(e),ru(),uu()])}var mu={};function hu(e){let t=this,n=e||mu,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(pu(n)),a.push(vl()),o.push(yl(n))}var gu=null;function _u(){return gu||=Me(async()=>{let{default:e}=await import(`./mermaid.core-mH3N7K0I.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>(e.initialize({startOnLoad:!1,theme:`neutral`}),e)),gu}function vu({source:e}){let t=(0,$.useRef)(null),[n,r]=(0,$.useState)(null);return(0,$.useEffect)(()=>{let n=!1,i=`mermaid-${Math.random().toString(36).slice(2,9)}`;return _u().then(t=>t.render(i,e)).then(({svg:e})=>{!n&&t.current&&(t.current.innerHTML=e)}).catch(t=>{n||(console.error(`[MermaidBlock] render failed:`,e,t),r(t instanceof Error?t.message:`Diagram render failed`))}),()=>{n=!0}},[e]),n?(0,Q.jsxs)(`div`,{className:`md-mermaid md-mermaid-error`,children:[(0,Q.jsx)(`div`,{className:`md-mermaid-error-label`,children:`Diagram render error`}),(0,Q.jsx)(`pre`,{className:`md-pre`,children:(0,Q.jsx)(`code`,{className:`md-code`,children:e})})]}):(0,Q.jsx)(`div`,{className:`md-mermaid`,ref:t})}var yu=/\.(mp4|webm|mov)(\?.*)?$/i,bu=/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/,xu=/vimeo\.com\/(\d+)/;function Su(e){return!!e&&yu.test(e)}function Cu(e){if(!e)return null;let t=e.match(bu);return t?t[1]:null}function wu(e){if(!e)return null;let t=e.match(xu);return t?t[1]:null}function Tu({src:e}){return(0,Q.jsx)(`video`,{className:`md-video`,controls:!0,playsInline:!0,preload:`metadata`,children:(0,Q.jsx)(`source`,{src:e})})}function Eu({videoId:e}){return(0,Q.jsx)(`div`,{className:`md-video-iframe`,children:(0,Q.jsx)(`iframe`,{src:`https://www.youtube-nocookie.com/embed/${e}`,allow:`accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,loading:`lazy`})})}function Du({videoId:e}){return(0,Q.jsx)(`div`,{className:`md-video-iframe`,children:(0,Q.jsx)(`iframe`,{src:`https://player.vimeo.com/video/${e}`,allow:`autoplay; fullscreen; picture-in-picture`,allowFullScreen:!0,loading:`lazy`})})}function Ou(e){if(Su(e))return(0,Q.jsx)(Tu,{src:e});let t=Cu(e);if(t)return(0,Q.jsx)(Eu,{videoId:t});let n=wu(e);return n?(0,Q.jsx)(Du,{videoId:n}):null}var ku={p:({children:e})=>(0,Q.jsx)(`p`,{className:`md-p`,children:e}),h1:({children:e})=>(0,Q.jsx)(`h1`,{className:`md-heading`,children:e}),h2:({children:e})=>(0,Q.jsx)(`h2`,{className:`md-heading`,children:e}),h3:({children:e})=>(0,Q.jsx)(`h3`,{className:`md-heading`,children:e}),code:({children:e,className:t})=>t===`language-mermaid`?(0,Q.jsx)(vu,{source:String(e).replace(/\n$/,``)}):(0,Q.jsx)(`code`,{className:`md-code ${t||``}`.trim(),children:e}),pre:({children:e,node:t})=>{let n=t?.children?.[0];return n?.type===`element`&&n.tagName===`code`&&(n.properties?.className??[]).includes(`language-mermaid`)?(0,Q.jsx)(Q.Fragment,{children:e}):(0,Q.jsx)(`pre`,{className:`md-pre`,children:e})},ul:({children:e})=>(0,Q.jsx)(`ul`,{className:`md-list`,children:e}),ol:({children:e})=>(0,Q.jsx)(`ol`,{className:`md-list md-list-ordered`,children:e}),li:({children:e})=>(0,Q.jsx)(`li`,{className:`md-list-item`,children:e}),hr:()=>(0,Q.jsx)(`hr`,{className:`md-hr`}),strong:({children:e})=>(0,Q.jsx)(`strong`,{className:`md-strong`,children:e}),img:({src:e,alt:t})=>Ou(e)||(0,Q.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:(0,Q.jsx)(`img`,{className:`md-img`,src:e,alt:t||``,loading:`lazy`})}),a:({href:e,children:t})=>Ou(e)||(0,Q.jsx)(`a`,{href:e,className:`md-link`,target:`_blank`,rel:`noopener noreferrer`,children:t}),table:({children:e})=>(0,Q.jsx)(`table`,{className:`md-table`,children:e}),thead:({children:e})=>(0,Q.jsx)(`thead`,{className:`md-thead`,children:e}),tbody:({children:e})=>(0,Q.jsx)(`tbody`,{children:e}),tr:({children:e})=>(0,Q.jsx)(`tr`,{className:`md-tr`,children:e}),th:({children:e})=>(0,Q.jsx)(`th`,{className:`md-th`,children:e}),td:({children:e})=>(0,Q.jsx)(`td`,{className:`md-td`,children:e})};function Au({content:e,elapsedSeconds:t,timestamp:n}){return(0,Q.jsxs)(`div`,{className:`markdown-message`,children:[(0,Q.jsx)(ds,{remarkPlugins:[hu],components:ku,children:e}),t!==void 0&&(0,Q.jsxs)(`div`,{className:`message-meta`,children:[t,`s`]}),n&&(0,Q.jsx)(`span`,{className:`message-timestamp`,children:n})]})}var ju=`Accomplishing.Actioning.Actualizing.Architecting.Baking.Beaming.Befuddling.Billowing.Blanching.Bloviating.Boogieing.Boondoggling.Booping.Bootstrapping.Brewing.Bunning.Burrowing.Calculating.Canoodling.Caramelizing.Cascading.Catapulting.Cerebrating.Channeling.Channelling.Choreographing.Churning.Clauding.Coalescing.Cogitating.Combobulating.Composing.Computing.Concocting.Considering.Contemplating.Cooking.Crafting.Creating.Crunching.Crystallizing.Cultivating.Deciphering.Deliberating.Determining.Discombobulating.Doing.Doodling.Drizzling.Ebbing.Effecting.Elucidating.Embellishing.Enchanting.Envisioning.Evaporating.Fermenting.Finagling.Flibbertigibbeting.Flowing.Flummoxing.Fluttering.Forging.Forming.Frolicking.Frosting.Gallivanting.Galloping.Garnishing.Generating.Germinating.Gesticulating.Gitifying.Grooving.Gusting.Harmonizing.Hashing.Hatching.Herding.Honking.Hullaballooing.Hyperspacing.Ideating.Imagining.Improvising.Incubating.Inferring.Infusing.Ionizing.Jitterbugging.Julienning.Kneading.Leavening.Levitating.Lollygagging.Manifesting.Marinating.Meandering.Metamorphosing.Misting.Moonwalking.Moseying.Mulling.Musing.Mustering.Nebulizing.Nesting.Newspapering.Noodling.Nucleating.Orbiting.Orchestrating.Osmosing.Perambulating.Percolating.Perusing.Philosophising.Photosynthesizing.Pollinating.Pondering.Pontificating.Pouncing.Precipitating.Prestidigitating.Processing.Proofing.Propagating.Puttering.Puzzling.Quantumizing.Razzmatazzing.Recombobulating.Reticulating.Roosting.Ruminating.Scampering.Schlepping.Scurrying.Seasoning.Shenaniganing.Shimmying.Simmering.Skedaddling.Sketching.Slithering.Smooshing.Spelunking.Spinning.Sprouting.Stewing.Sublimating.Swirling.Swooping.Symbioting.Synthesizing.Tempering.Thinking.Thundering.Tinkering.Tomfoolering.Transfiguring.Transmuting.Twisting.Undulating.Unfurling.Unravelling.Vibing.Waddling.Wandering.Warping.Whatchamacalliting.Whirlpooling.Whirring.Whisking.Wibbling.Working.Wrangling.Zesting.Zigzagging`.split(`.`),Mu=3e5,Nu=9e4,Pu=4e3,Fu=2500;function Iu(e){let t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function Lu({activity:e,turnCount:t,liveness:n}){let[r]=(0,$.useState)(()=>Date.now()),[i,a]=(0,$.useState)(()=>Date.now());(0,$.useEffect)(()=>{let e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[]);let[o,s]=(0,$.useState)(()=>Date.now()),[c,l]=(0,$.useState)(()=>Math.floor(Math.random()*ju.length)),u=()=>l(e=>(e+1+Math.floor(Math.random()*(ju.length-1)))%ju.length);(0,$.useEffect)(()=>{s(Date.now()),u()},[t]);let d=(0,$.useRef)(0),f=n?n.tick:null;(0,$.useEffect)(()=>{if(f===null)return;let e=Date.now();e-d.current<Fu||(d.current=e,u())},[f]);let p=n!=null&&!e,m=e?e.lastEmitAt:p?n.at??r:o,h=p?Nu:Mu,g=i-m>h,_=p?i-m<Pu:null,v=e?`${e.count>=2?`${e.count} agents · `:``}${e.agentType} · ${e.description}`:`${ju[c]}…`;return(0,Q.jsxs)(`div`,{className:`chat-activity`,"data-stalled":g?`true`:`false`,"data-fresh":_===null?void 0:_?`true`:`false`,"aria-live":`polite`,"aria-label":g?`Agent may be stalled`:`Agent is working`,children:[(0,Q.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`chat-activity-icon`}),(0,Q.jsx)(`span`,{className:`chat-activity-word`,children:v}),(0,Q.jsx)(`span`,{className:`chat-activity-elapsed`,children:Iu(i-r)}),g&&(0,Q.jsx)(`span`,{className:`chat-activity-stalled`,children:`stalled`})]})}function Ru({variant:e,icon:t,label:n,children:r}){let[i,a]=(0,$.useState)(!1);return(0,Q.jsxs)(`div`,{className:`chat-${e}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`chat-${e}-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,Q.jsx)(`span`,{className:`wa-chevron`,children:t}),(0,Q.jsx)(`span`,{className:`chat-${e}-label`,children:n})]}),i&&r]})}function zu({turns:e}){let t=e.filter(e=>e.kind===`tool-call`).length,n=t>0?`Used ${t} tool${t===1?``:`s`}`:`${e.length} tool result${e.length===1?``:`s`}`;return(0,Q.jsx)(Ru,{variant:`toolrun`,icon:(0,Q.jsx)(je,{size:12}),label:n,children:e.map((e,t)=>(0,Q.jsxs)(`div`,{className:`chat-toolrun-item`,children:[(0,Q.jsx)(`span`,{className:`chat-toolrun-name`,children:e.kind===`tool-call`?`↳ ${e.name}`:e.isError?`result (error)`:`result`}),(0,Q.jsx)(`pre`,{className:`wa-code`,children:e.kind===`tool-call`?JSON.stringify(e.input,null,2):e.text})]},t))})}function Bu({turns:e}){return(0,Q.jsx)(Ru,{variant:`thinking`,icon:(0,Q.jsx)(ze,{size:12}),label:`Thoughts`,children:e.map((e,t)=>(0,Q.jsx)(`div`,{className:`chat-thinking-item`,children:(0,Q.jsx)(Au,{content:e.text})},t))})}function Vu({ts:e}){let t=se(e);return t?(0,Q.jsx)(`time`,{className:`chat-time`,children:t}):null}function Hu({text:e}){let{status:t,copy:n}=Ne(),r=t===`ok`;return(0,Q.jsx)(`button`,{type:`button`,className:`chat-copy`,"aria-label":r?`Copied`:`Copy message`,title:r?`Copied`:`Copy`,onClick:()=>n(e),children:r?(0,Q.jsx)(s,{size:13,"aria-hidden":!0}):(0,Q.jsx)(M,{size:13,"aria-hidden":!0})})}function Uu({ts:e,copyText:t}){return(0,Q.jsxs)(`div`,{className:`chat-msg-foot`,children:[(0,Q.jsx)(Vu,{ts:e}),(0,Q.jsx)(Hu,{text:t})]})}function Wu(e,t,n,r,i){switch(e.kind){case`operator-inbound`:case`operator-typed`:{let a=(e.kind===`operator-inbound`?e.rawBody:void 0)??e.text,o=e.kind===`operator-inbound`?e.attachments:void 0,s=e.channel,c=e.kind===`operator-inbound`&&(e.source===`whatsapp`||e.source===`telegram`)?e.source:void 0,l=s??c;return(0,Q.jsxs)(`div`,{className:l?`chat-turn-op chat-turn-op--${l}`:`chat-turn-op`,children:[a&&(0,Q.jsx)(`p`,{className:`chat-op-body`,children:a}),o&&o.length>0&&(0,Q.jsx)(`div`,{className:`chat-attachment-list`,children:o.map((e,t)=>(0,Q.jsx)(E,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:D(e.attachmentId,n,r,i)},t))}),a?(0,Q.jsx)(Uu,{ts:e.ts,copyText:a}):(0,Q.jsx)(Vu,{ts:e.ts})]},t)}case`agent-reply`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[(0,Q.jsx)(Au,{content:e.text}),e.text?(0,Q.jsx)(Uu,{ts:e.ts,copyText:e.text}):(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`agent-webchat-final`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[(0,Q.jsx)(Au,{content:e.text}),e.text?(0,Q.jsx)(Uu,{ts:e.ts,copyText:e.text}):(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`agent-reply-document`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[e.files.map((e,t)=>(0,Q.jsx)(E,{filename:w(e)},t)),e.caption&&(0,Q.jsx)(Au,{content:e.caption}),(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`agent-file`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[e.files.map((t,n)=>{let a=w(t),o=e.downloads?.[n];if(!o)return(0,Q.jsxs)(`p`,{className:`chat-doc`,children:[(0,Q.jsx)(C,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,a]},n);let s=x(o,r,i);return O.test(a)?(0,Q.jsx)(re,{src:x(o,r,i,`inline`),filename:a},n):te.test(a)?(0,Q.jsx)(`img`,{className:`chat-doc-image`,src:s,alt:a},n):(0,Q.jsxs)(`a`,{className:`chat-doc chat-doc-attachment`,href:s,download:a,children:[(0,Q.jsx)(C,{size:14,"aria-hidden":!0}),a]},n)}),e.caption&&(0,Q.jsx)(Au,{content:e.caption}),(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`session-continued`:return(0,Q.jsx)(A,{},t);case`harness-internal`:return(0,Q.jsx)(Ru,{variant:`thinking`,icon:(0,Q.jsx)(je,{size:12}),label:`Internal`,children:(0,Q.jsx)(`div`,{className:`chat-thinking-item`,children:(0,Q.jsx)(Au,{content:e.text})})},t);case`whatsapp-persisted`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[(0,Q.jsx)(Au,{content:e.text}),e.reactions&&e.reactions.length>0&&(0,Q.jsx)(`div`,{className:`wa-reactions`,children:e.reactions.map((e,t)=>(0,Q.jsx)(`span`,{className:`wa-reaction`,title:e.reactorName??void 0,children:e.emoji},t))}),(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`agent-error`:return(0,Q.jsxs)(`div`,{className:`chat-agent-error`,role:`alert`,children:[(0,Q.jsx)(`span`,{className:`chat-agent-error-msg`,children:ce(e.code,n)}),n===`admin`&&e.code===`agent_error`&&e.raw&&(0,Q.jsx)(`pre`,{className:`chat-agent-error-raw`,children:e.raw})]},t)}}function Gu({text:e,filenames:t}){return(0,Q.jsxs)(`div`,{className:`chat-turn-op chat-turn-op--pending`,"aria-busy":`true`,children:[e&&(0,Q.jsx)(`p`,{className:`chat-op-body`,children:e}),t.length>0&&(0,Q.jsx)(`div`,{className:`chat-attachment-list`,children:t.map((e,t)=>(0,Q.jsx)(`span`,{className:`chat-pending-attachment`,children:e},t))})]})}function Ku(e,t,n,r=`admin`){let i=[],a=[],o=[],s=null,c=()=>{a.length!==0&&(i.push((0,Q.jsx)(zu,{turns:a},`tools-${i.length}`)),a=[])},l=()=>{o.length!==0&&(i.push((0,Q.jsx)(Bu,{turns:o},`think-${i.length}`)),o=[])};return e.forEach((e,u)=>{let d=T(e),f=ee(d);if(f!==null&&f!==s&&(c(),l(),i.push((0,Q.jsx)(k,{ts:d},`day-${u}`)),s=f),e.kind===`turn`&&(e.turn.kind===`tool-call`||e.turn.kind===`tool-result`)){l(),a.push(e.turn);return}if(e.kind===`turn`&&e.turn.kind===`agent-text`){c(),o.push(e.turn);return}c(),l(),e.kind===`directive`?i.push((0,Q.jsx)(S,{entry:e.entry,sessionId:t,sessionKey:n},u)):i.push(Wu(e.turn,u,r,t,n))}),c(),l(),i}new Set(`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,text/rtf,application/rtf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-powerpoint,application/vnd.oasis.opendocument.presentation,audio/ogg,audio/opus,audio/mp4,audio/mpeg,audio/webm,audio/wav,.docx,.odt,.rtf,.xlsx,.xls,.ods,.pptx,.ppt,.odp,.opus,.ogg,.m4a,.mp3,.wav,.webm`.split(`,`).filter(e=>!e.startsWith(`.`)));var qu=typeof window<`u`&&/^(localhost|127\.0\.0\.1|[a-z0-9-]+\.local)(:|$)/.test(window.location.hostname);function Ju(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Yu(){let e=window.location.pathname.match(/^\/([a-z][a-z0-9-]{2,49})$/);return e?e[1]:void 0}var Xu=`maxy_seed_q`;function Zu(){let e=new URLSearchParams(window.location.search).get(`q`);if(e==null)return null;let t=e.trim();return t?t.slice(0,2e3):null}function Qu(e){return`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`}function $u({data:e,active:t}){let n=[];if(e&&e.length>0&&t){let t=Math.floor(e.length/24);for(let r=0;r<24;r++){let i=e[r*t]??128,a=Math.abs(i-128)/128;n.push(Math.max(.15,a))}}else for(let e=0;e<24;e++)n.push(.15);return(0,Q.jsx)(`div`,{className:`voice-waveform`,"aria-hidden":`true`,children:n.map((e,t)=>(0,Q.jsx)(`div`,{className:`voice-waveform-bar`,style:{height:`${Math.round(e*100)}%`}},t))})}function ed({state:e,elapsedSeconds:t,waveform:n,onTogglePause:r,onDiscard:i,onSend:a}){if(e===`idle`||e===`error`)return null;let o=e===`recording`,s=e===`paused`,c=e===`sending`;return(0,Q.jsxs)(`div`,{className:`voice-recorder`,role:`region`,"aria-label":`Voice recording`,"aria-live":`polite`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`voice-trash`,onClick:i,disabled:c,"aria-label":`Discard recording`,children:(0,Q.jsx)(u,{size:16})}),(0,Q.jsx)(`span`,{className:`voice-timer`,"aria-live":`polite`,"aria-atomic":`true`,children:Qu(t)}),(0,Q.jsx)($u,{data:n,active:o}),(0,Q.jsx)(`button`,{type:`button`,className:`voice-pause`,onClick:r,disabled:c,"aria-label":s?`Resume recording`:`Pause recording`,children:s?(0,Q.jsx)(ke,{size:14}):(0,Q.jsx)(de,{size:14})}),(0,Q.jsx)(j,{variant:`send`,type:`button`,onClick:a,disabled:c,loading:c,"aria-label":`Send voice note`,children:(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Q.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,Q.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]})}var td=i(`wrench-off`,[[`path`,{d:`M10.747 5.093a6 6 0 0 1 6.841-2.882c.438.12.54.662.219.984L14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-2.882 6.842`,key:`a1`}],[`path`,{d:`m13.5 13.5-7.88 7.88a1 1 0 0 1-2.999-3l7.88-7.88`,key:`a2`}],[`path`,{d:`m2 2 20 20`,key:`a3`}]]),nd={low:`Low`,medium:`Medium`,high:`High`,xhigh:`Highest`},rd=[{id:Se,label:we(Se)},{id:me,label:we(me)},{id:be,label:we(be)}],id=[{id:`low`,label:`Low`},{id:`medium`,label:`Medium`},{id:`high`,label:`High`},{id:`xhigh`,label:`Extra`},{id:`max`,label:`Max`}],ad=[{id:`default`,label:`Ask permissions`},{id:`acceptEdits`,label:`Accept edits`},{id:`bypassPermissions`,label:`Bypass permissions`}];function od({newModel:e,onPickModel:t,newEffort:n,onPickEffort:r,onNewSession:i,newSessionPending:a,newPermMode:o,onPickPermMode:c}){let l=Math.max(0,id.findIndex(e=>e.id===n)),u=id[l]?.label??``,d=id.length-1,f=e=>`calc(14px + (100% - 28px) * ${d>0?e/d:0})`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`webchat-newsession-field`,children:[(0,Q.jsx)(`span`,{children:`Model`}),(0,Q.jsx)(`div`,{className:`webchat-newsession-models`,children:rd.map(n=>(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-newsession-model`,role:`menuitemradio`,"aria-checked":e===n.id,onClick:()=>t(n.id),children:[(0,Q.jsx)(`span`,{children:n.label}),e===n.id&&(0,Q.jsx)(s,{size:13})]},n.id))})]}),(0,Q.jsxs)(`div`,{className:`webchat-newsession-field`,children:[(0,Q.jsxs)(`div`,{className:`webchat-newsession-effort-head`,children:[(0,Q.jsxs)(`span`,{children:[`Effort `,(0,Q.jsx)(`strong`,{children:u})]}),(0,Q.jsx)(`span`,{className:`webchat-newsession-effort-help`,title:`Higher effort lets the model think longer before it answers.`,children:(0,Q.jsx)(Fe,{size:14})})]}),(0,Q.jsxs)(`div`,{className:`webchat-newsession-slider-ends`,"aria-hidden":`true`,children:[(0,Q.jsx)(`span`,{children:`Faster`}),(0,Q.jsx)(`span`,{children:`Smarter`})]}),(0,Q.jsxs)(`div`,{className:`webchat-newsession-track`,children:[(0,Q.jsx)(`span`,{className:`webchat-newsession-track-fill`,style:{width:f(l)},"aria-hidden":`true`}),id.map((e,t)=>(0,Q.jsx)(`span`,{className:`webchat-newsession-dot${t===d?` is-max`:``}`,style:{left:f(t)},"aria-hidden":`true`},e.id)),(0,Q.jsx)(`span`,{className:`webchat-newsession-knob`,style:{left:f(l)},"aria-hidden":`true`}),(0,Q.jsx)(`input`,{type:`range`,className:`webchat-newsession-slider`,min:0,max:d,step:1,value:l,onChange:e=>r(id[Number(e.target.value)].id),"aria-label":`New session thinking effort`})]})]}),o!=null&&c&&(0,Q.jsxs)(`div`,{className:`webchat-newsession-field`,children:[(0,Q.jsx)(`span`,{children:`Permissions`}),(0,Q.jsx)(`div`,{className:`webchat-newsession-models`,children:ad.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-newsession-model`,role:`menuitemradio`,"aria-checked":o===e.id,onClick:()=>c(e.id),children:[(0,Q.jsx)(`span`,{children:e.label}),o===e.id&&(0,Q.jsx)(s,{size:13})]},e.id))})]}),(0,Q.jsx)(`button`,{type:`button`,className:`webchat-newsession-go`,onClick:()=>void i(),disabled:a,children:a?`Starting…`:`Start new session`})]})}var sd={default:`Ask permissions`,acceptEdits:`Accept edits`,plan:`Plan mode`,auto:`Auto mode`,bypassPermissions:`Bypass permissions`};function cd(e){return we(ve(e))}function ld(e){return e>=1e6?`~${(e/1e6).toFixed(e%1e6==0?0:1)}M`:e>=1e3?`~${Math.round(e/1e3)}k`:`~${e}`}function ud({pct:e,usedTokens:t,window:n}){let r=Math.max(0,Math.min(100,e)),i=`Context window used — ${e}% · ${ld(t)}/${ld(n)}`;return(0,Q.jsx)(`span`,{className:`webchat-context-ring`,role:`img`,"aria-label":i,title:i,children:(0,Q.jsxs)(`svg`,{viewBox:`0 0 14 14`,width:`14`,height:`14`,"aria-hidden":`true`,children:[(0,Q.jsx)(`circle`,{className:`ring-track`,cx:`7`,cy:`7`,r:`5`}),(0,Q.jsx)(`circle`,{className:`ring-fill`,cx:`7`,cy:`7`,r:`5`,pathLength:100,strokeDasharray:`${r} 100`,transform:`rotate(-90 7 7)`})]})})}function dd(e){let{deliveryFailure:t,permPrompt:n,onVerdict:r,isDragOver:i,onDragOver:a,onDragLeave:o,onDrop:c,fileInputRef:u,acceptMime:d,onFileInputChange:f,showResizeHandle:p,onResizePointerDown:m,onResizeKeyDown:v,pendingFiles:b,thumbUrls:x,onRemoveFile:S,attachError:w,sendError:T,transcribing:E=!1,voice:D,isVoiceActive:O,onVoiceSend:k,text:ee,onTextareaChange:te,textareaRef:ne,textareaHeight:A,textareaDisabled:re,placeholder:ie=`Message your agent…`,onKeyDown:ae,onPaste:oe,onSend:se,sendDisabled:ce,turnActive:le=!1,onStop:de,stopping:fe=!1,deadChildNotice:j,conflictHint:me,showNewSession:_e,newSessionRef:ve,newSessionOpen:ye,onToggleNewSession:be,newSessionDisabled:xe,newModel:Se,onPickModel:Ce,newEffort:we,onPickEffort:Te,onNewSession:Ee,newSessionPending:Oe,newPermMode:ke,onPickPermMode:Me,onAttachClick:Ne,attachDisabled:Pe,micMenuRef:Fe,onMicStart:Re,micStartDisabled:ze,onOpenMicMenu:Ve,micMenuOpen:He,micDevices:Ue,micDeviceId:We,onChooseMic:Ge,showCleanToggle:Ke,cleanView:qe,onToggleClean:Je,showControlsRight:Ye,sessionId:N,mode:Xe,model:Ze,effort:Qe,contextUsage:P,paramsMenuRef:$e,paramsMenuOpen:et,onToggleParamsMenu:F}=e,I=e=>e.preventDefault(),[tt,L]=(0,$.useState)(!1),R=(0,$.useRef)(null),nt=(0,$.useRef)(null),z=()=>{N&&(R.current=setTimeout(()=>{let e=navigator.clipboard?.writeText(N);e&&e.then(()=>{L(!0),nt.current&&clearTimeout(nt.current),nt.current=setTimeout(()=>L(!1),1200)}).catch(()=>{})},500))},B=()=>{R.current&&=(clearTimeout(R.current),null)};return(0,$.useEffect)(()=>()=>{R.current&&clearTimeout(R.current),nt.current&&clearTimeout(nt.current)},[]),(0,Q.jsxs)(`div`,{className:`webchat-composer`,children:[t&&(0,Q.jsx)(`div`,{className:`webchat-delivery-failed`,role:`alert`,children:`Message not delivered — the session was unresponsive. Resend to retry.`}),n&&(0,Q.jsxs)(`div`,{className:`webchat-perm-card`,role:`alertdialog`,"aria-label":`Permission request`,children:[(0,Q.jsxs)(`div`,{className:`webchat-perm-head`,children:[`Claude wants to run `,(0,Q.jsx)(`strong`,{children:n.toolName})]}),n.description&&(0,Q.jsx)(`div`,{className:`webchat-perm-desc`,children:n.description}),n.inputPreview&&(0,Q.jsx)(`pre`,{className:`webchat-perm-preview`,children:n.inputPreview}),(0,Q.jsxs)(`div`,{className:`webchat-perm-actions`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`webchat-perm-deny`,onPointerDown:I,onClick:()=>void r(`deny`),children:`Deny`}),(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-perm-allow`,onPointerDown:I,onClick:()=>void r(`allow`),children:[`Allow`,(0,Q.jsx)(Ie,{size:14})]})]})]}),(0,Q.jsxs)(`div`,{className:`webchat-composer-box${i?` drag-over`:``}`,onDragOver:a,onDragLeave:o,onDrop:c,children:[(0,Q.jsx)(`input`,{ref:u,type:`file`,multiple:!0,accept:d,style:{display:`none`},onChange:f}),p&&(0,Q.jsx)(`div`,{className:`webchat-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize input — drag up to enlarge`,tabIndex:0,onPointerDown:m,onKeyDown:v}),b.length>0&&(0,Q.jsx)(`div`,{className:`attachment-strip`,children:b.map((e,t)=>(0,Q.jsxs)(`div`,{className:`attachment-chip`,children:[x[t]?(0,Q.jsx)(`img`,{src:x[t]??void 0,alt:e.name,className:`attachment-chip-thumb`}):e.type.startsWith(`audio/`)?(0,Q.jsx)(ue,{size:14}):e.type===`application/pdf`?(0,Q.jsx)(y,{size:14}):(0,Q.jsx)(_,{size:14}),(0,Q.jsx)(`span`,{className:`attachment-chip-name`,children:e.name}),(0,Q.jsx)(`button`,{type:`button`,className:`attachment-chip-remove`,onClick:()=>S(t),"aria-label":`Remove ${e.name}`,children:`×`})]},t))}),w&&(0,Q.jsx)(`p`,{className:`attach-error`,children:w}),T&&(0,Q.jsx)(`p`,{className:`webchat-send-error`,role:`alert`,children:T}),j&&(0,Q.jsxs)(`p`,{className:`webchat-dead-child-notice`,role:`status`,children:[(0,Q.jsx)(Ae,{size:14,"aria-hidden":!0}),` `,j]}),E&&(0,Q.jsxs)(`p`,{className:`webchat-transcribing`,role:`status`,"aria-live":`polite`,children:[(0,Q.jsx)(l,{size:14,className:`webchat-transcribing-spin`}),`Transcribing audio…`]}),D.state===`error`&&D.errorMessage&&(0,Q.jsxs)(`p`,{className:`voice-error`,role:`alert`,children:[(0,Q.jsx)(ue,{size:14}),D.errorMessage]}),O?(0,Q.jsx)(`div`,{className:`webchat-input-row voice-active`,children:(0,Q.jsx)(ed,{state:D.state,elapsedSeconds:D.elapsedSeconds,waveform:D.waveform,onTogglePause:D.togglePause,onDiscard:D.discard,onSend:()=>void k()})}):(0,Q.jsxs)(`div`,{className:`webchat-input-row`,children:[(0,Q.jsx)(`textarea`,{ref:ne,className:`webchat-input`,value:ee,placeholder:ie,rows:2,style:{height:`${A}px`},disabled:re,onChange:te,onKeyDown:ae,onPaste:oe}),le?(0,Q.jsx)(`button`,{type:`button`,className:`webchat-send webchat-stop${fe?` is-stopping`:``}`,onPointerDown:I,onClick:()=>void de?.(),disabled:fe,"aria-label":fe?`Stopping`:`Stop`,title:fe?`Stopping…`:`Stop generating`,children:fe?(0,Q.jsx)(l,{size:16,className:`webchat-stop-spin`}):(0,Q.jsx)(h,{size:16})}):ee.trim().length===0&&b.length===0?(0,Q.jsx)(`button`,{type:`button`,className:`webchat-send webchat-mic-inline`,onPointerDown:I,onClick:()=>void Re(),disabled:ze,"aria-label":`Voice input`,title:`Record voice note`,children:(0,Q.jsx)(ue,{size:16})}):(0,Q.jsx)(`button`,{type:`button`,className:`webchat-send`,onPointerDown:I,onClick:()=>void se(),disabled:ce,"aria-label":`Send`,title:`Send`,children:(0,Q.jsx)(Ie,{size:16})})]}),me!==null&&(0,Q.jsxs)(`p`,{className:`webchat-conflict-hint`,children:[`This session is bound to the `,me,` channel — message it there. The transcript stays readable here.`]})]}),(0,Q.jsxs)(`div`,{className:`webchat-controls`,children:[(0,Q.jsxs)(`div`,{className:`webchat-controls-left`,children:[_e&&(0,Q.jsxs)(`div`,{className:`webchat-newsession`,ref:ve,children:[(0,Q.jsx)(`button`,{type:`button`,className:`webchat-control`,onPointerDown:I,onClick:be,disabled:xe,"aria-haspopup":`menu`,"aria-expanded":ye,title:`New session`,"aria-label":`New session`,children:(0,Q.jsx)(g,{size:14})}),ye&&(0,Q.jsx)(`div`,{className:`webchat-newsession-panel`,role:`menu`,children:(0,Q.jsx)(od,{newModel:Se,onPickModel:Ce,newEffort:we,onPickEffort:Te,onNewSession:Ee,newSessionPending:Oe,newPermMode:ke,onPickPermMode:Me})})]}),(0,Q.jsx)(`button`,{type:`button`,className:`webchat-control`,onPointerDown:I,onClick:Ne,disabled:Pe,title:`Attach files`,"aria-label":`Attach`,children:(0,Q.jsx)(C,{size:14})}),(0,Q.jsxs)(`div`,{className:`webchat-mic-split`,ref:Fe,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-control webchat-mic-chevron`,onPointerDown:I,onClick:Ve,disabled:ze,"aria-haspopup":`menu`,"aria-expanded":He,title:`Choose microphone`,"aria-label":`Choose microphone`,children:[(0,Q.jsx)(ue,{size:14}),(0,Q.jsx)(pe,{size:12})]}),He&&(0,Q.jsxs)(`div`,{className:`webchat-mic-panel`,role:`menu`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-mic-item`,role:`menuitemradio`,"aria-checked":We===null,onClick:()=>Ge(null,`System default`),children:[(0,Q.jsx)(`span`,{children:`System default`}),We===null&&(0,Q.jsx)(s,{size:13})]}),Ue.filter(e=>e.label).map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-mic-item`,role:`menuitemradio`,"aria-checked":e.deviceId===We,onClick:()=>Ge(e.deviceId,e.label||`Microphone ${t+1}`),children:[(0,Q.jsx)(`span`,{children:e.label}),e.deviceId===We&&(0,Q.jsx)(s,{size:13})]},e.deviceId)),Ue.filter(e=>e.label).length===0&&(0,Q.jsx)(`span`,{className:`webchat-mic-hint`,children:`Allow microphone access to choose a device`})]})]}),Ke&&(0,Q.jsx)(`button`,{type:`button`,className:`webchat-control webchat-clean-toggle`,onPointerDown:I,onClick:Je,"aria-pressed":!qe,"aria-label":`Show tool calls and thinking`,title:qe?`Showing delivered messages only — click to show tool calls, results, and thinking`:`Showing tool calls, results, and thinking — click to show delivered messages only`,children:qe?(0,Q.jsx)(td,{size:14}):(0,Q.jsx)(je,{size:14})})]}),Ye&&(0,Q.jsxs)(`div`,{className:`webchat-controls-right`,children:[N&&(0,Q.jsx)(`code`,{className:`webchat-session-id`,title:`First 8 characters of this session's id — matches the Sessions list.`,children:N.slice(0,8)}),(Xe||Ze||Qe)&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`webchat-params webchat-params--inline`,"aria-label":`Session parameters`,children:[Xe&&(0,Q.jsx)(`span`,{className:`webchat-param`,children:sd[Xe]??Xe}),Ze&&(0,Q.jsx)(`span`,{className:`webchat-param`,children:cd(Ze)}),Qe&&(0,Q.jsx)(`span`,{className:`webchat-param`,children:nd[Qe]??Qe})]}),(0,Q.jsxs)(`div`,{className:`webchat-params-menu`,ref:$e,children:[(0,Q.jsx)(`button`,{type:`button`,className:`webchat-control webchat-params-trigger`,onPointerDown:I,"aria-haspopup":`menu`,"aria-expanded":et,"aria-label":`Session parameters`,title:`Session parameters`,onClick:F,children:(0,Q.jsx)(he,{size:14})}),et&&(0,Q.jsxs)(`div`,{className:`webchat-params-panel`,role:`menu`,children:[Xe&&(0,Q.jsxs)(`span`,{className:`webchat-param`,role:`menuitem`,children:[(0,Q.jsx)(Be,{size:13,"aria-hidden":`true`}),sd[Xe]??Xe]}),Ze&&(0,Q.jsxs)(`span`,{className:`webchat-param`,role:`menuitem`,children:[(0,Q.jsx)(De,{size:13,"aria-hidden":`true`}),cd(Ze)]}),Qe&&(0,Q.jsxs)(`span`,{className:`webchat-param`,role:`menuitem`,children:[(0,Q.jsx)(Le,{size:13,"aria-hidden":`true`}),nd[Qe]??Qe]}),N&&(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-param webchat-session-id-full${tt?` is-copied`:``}`,role:`menuitem`,title:`Long-press to copy the full session id`,"aria-label":tt?`Session id copied`:`Session id — long-press to copy`,onPointerDown:z,onPointerUp:B,onPointerLeave:B,onContextMenu:e=>e.preventDefault(),children:[tt?(0,Q.jsx)(s,{size:13,"aria-hidden":`true`}):(0,Q.jsx)(M,{size:13,"aria-hidden":`true`}),(0,Q.jsx)(`code`,{children:tt?`Copied`:N})]}),P&&(0,Q.jsxs)(`span`,{className:`webchat-param`,role:`menuitem`,children:[(0,Q.jsx)(ge,{size:13,"aria-hidden":`true`}),P.pct,`% · `,ld(P.usedTokens),`/`,ld(P.window)]})]})]})]}),P&&(0,Q.jsx)(ud,{pct:P.pct,usedTokens:P.usedTokens,window:P.window})]})]})]})}function fd(e,t){return(t??{}).deadChild===!0?`dead-child`:e===200?`ok`:`failed`}function pd(e,t){if(e)return null;try{return new URLSearchParams(t).get(`session`)}catch{return null}}function md(e){return typeof e!=`number`||!Number.isFinite(e)?``:new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function hd({s:e,onOpen:t,onRename:n,onArchive:r,onDelete:i,onEnd:a,onCopyId:o}){let[l,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,y]=(0,$.useState)(!1),b=(0,$.useRef)(!1),x=()=>{f(!1),y(!1)},S=()=>{_(e.name||``),m(!0),f(!1)},C=()=>{if(m(!1),b.current){b.current=!1;return}g.trim()!==(e.name||``)&&n(e,g)};return p?(0,Q.jsx)(`div`,{className:`op-conv-rename`,children:(0,Q.jsx)(`input`,{className:`op-conv-rename-input`,autoFocus:!0,onFocus:e=>e.currentTarget.select(),value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`?C():e.key===`Escape`&&(b.current=!0,m(!1))},onBlur:C,placeholder:`Conversation name`,"aria-label":`Conversation name`})}):(0,Q.jsxs)(`div`,{className:`op-conv-rowwrap`,"aria-current":e.active?`true`:void 0,children:[(0,Q.jsxs)(`div`,{className:`op-conv-row-inner`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-resume`,onClick:()=>t(e),children:[(0,Q.jsxs)(`span`,{className:`op-conv-line1`,children:[e.active?(0,Q.jsx)(`span`,{className:`op-conv-current`,"aria-label":`Current session`,children:(0,Q.jsx)(s,{size:14})}):null,(0,Q.jsx)(`span`,{className:`op-conv-name`,children:e.name||`New conversation`})]}),(0,Q.jsxs)(`span`,{className:`op-conv-line2`,children:[(0,Q.jsx)(`span`,{className:`op-conv-when`,children:md(e.lastActiveMs)}),(0,Q.jsx)(`code`,{className:`op-conv-id`,title:e.id,children:e.id})]})]}),(0,Q.jsx)(`button`,{type:`button`,className:`op-conv-copy`,"aria-label":`Copy session id`,title:`Copy session id`,onClick:()=>o(e),children:(0,Q.jsx)(M,{size:14})}),(0,Q.jsx)(`button`,{type:`button`,className:`op-conv-kebab`,"aria-label":l?`Close actions`:`Conversation actions`,"aria-expanded":l,onClick:()=>l?x():f(!0),children:l?(0,Q.jsx)(d,{size:16}):(0,Q.jsx)(he,{size:16})})]}),l?(0,Q.jsxs)(`div`,{className:`op-conv-actions`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action`,onClick:S,children:[(0,Q.jsx)(c,{size:13}),` Rename`]}),e.active?(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action`,onClick:()=>{a(e),x()},children:[(0,Q.jsx)(h,{size:13}),` End session`]}):null,e.active?null:e.archived?(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action`,onClick:()=>{r(e,!1),x()},children:[(0,Q.jsx)(Ee,{size:13}),` Unarchive`]}):(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action`,onClick:()=>{r(e,!0),x()},children:[(0,Q.jsx)(Te,{size:13}),` Archive`]}),e.active?null:v?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action danger`,onClick:()=>{i(e),x()},children:[(0,Q.jsx)(u,{size:13}),` Confirm`]}),(0,Q.jsx)(`button`,{type:`button`,className:`op-conv-action`,onClick:()=>y(!1),children:`Cancel`})]}):(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action danger`,onClick:()=>y(!0),children:[(0,Q.jsx)(u,{size:13}),` Delete`]})]}):null]})}function gd({sessions:e,onOpen:t,onRename:n,onArchive:r,onDelete:i,onEnd:a,onNew:o,onBack:s,onCopyId:c}){let[l,u]=(0,$.useState)(!1),f=e.filter(e=>!e.archived),p=e.filter(e=>e.archived),m={onOpen:t,onRename:n,onArchive:r,onDelete:i,onEnd:a,onCopyId:c};return(0,Q.jsxs)(`div`,{className:`op-conv`,style:{flex:1,minHeight:0,position:`relative`},children:[(0,Q.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,Q.jsx)(`span`,{className:`op-conv-title`,children:`Conversations`}),(0,Q.jsx)(`button`,{type:`button`,className:`op-conv-close`,onClick:s,"aria-label":`Close conversations`,title:`Close`,children:(0,Q.jsx)(d,{size:16})})]}),(0,Q.jsx)(`div`,{className:`op-conv-list`,style:{flex:1,minHeight:0},children:e.length===0?(0,Q.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No conversations yet`}):(0,Q.jsxs)(Q.Fragment,{children:[f.map(e=>(0,Q.jsx)(hd,{s:e,...m},e.id)),p.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-archived-head`,"aria-expanded":l,onClick:()=>u(e=>!e),children:[(0,Q.jsx)(Oe,{size:14,style:{transform:l?`rotate(-90deg)`:`rotate(180deg)`,transition:`transform 0.12s`}}),`Archived (`,p.length,`)`]}),l?p.map(e=>(0,Q.jsx)(hd,{s:e,...m},e.id)):null]}):null]})}),(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-new op-conv-new-float`,onClick:o,children:[(0,Q.jsx)(g,{size:14}),` New session`]})]})}var _d=2500,vd=15e3,yd=[{id:`catch-up`,label:`Catch me up`,Icon:Re,prompt:`Catch me up — what came in across my inbox and WhatsApp while I was away, and what needs a reply?`},{id:`my-day`,label:`My day`,Icon:Pe,prompt:`What does my day look like — calendar, anything I need to prep for, and is there a free slot this afternoon?`},{id:`to-do`,label:`To-do`,Icon:ye,prompt:`What is still open and on me — pull together my outstanding tasks: unanswered messages, emails awaiting a reply, follow-ups I have asked you to track, and anything due soon.`}];function bd({userName:e,variant:t,onChip:n}){let r=e?.trim().split(/\s+/)[0];return(0,Q.jsxs)(`div`,{className:`webchat-greeting`,children:[(0,Q.jsx)(`h2`,{className:`webchat-greeting-head`,children:r?`What's up next, ${r}?`:`What's up next?`}),t!==`public`&&(0,Q.jsx)(`div`,{className:`webchat-greeting-chips`,children:yd.map(({id:e,label:t,Icon:r,prompt:i})=>(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-greeting-chip`,onClick:()=>n({id:e,prompt:i}),children:[(0,Q.jsx)(r,{size:16}),` `,t]},e))})]})}function xd({cacheKey:e,userName:t,targetSessionId:n,variant:r=`admin`,conversationsOpen:i=!1,onCloseConversations:a,cleared:s=!1,onFirstSend:c,switchId:u=null}){let d=r===`public`,p=d,[h,g]=(0,$.useState)(!0),[_,y]=(0,$.useState)(!1),[x,S]=(0,$.useState)(null),C=(0,$.useRef)(null),[w,T]=(0,$.useState)(null),[E,D]=(0,$.useState)(``),O=(0,$.useRef)(null),k=(0,$.useRef)(!1),ee=(0,$.useRef)(null),[te,A]=(0,$.useState)(0),[re,se]=(0,$.useState)(!1),[ce,ue]=(0,$.useState)(0),de=ce>0,[fe,pe]=(0,$.useState)(!1),[j,me]=(0,$.useState)(null),[he,ge]=(0,$.useState)(null),ve=(0,$.useRef)(!1),[ye,be]=(0,$.useState)(!1);(0,$.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(pointer: coarse)`);be(e.matches);let t=e=>be(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let[Ce,we]=(0,$.useState)(0),Te=(0,$.useRef)(0),Ee=(0,$.useCallback)(e=>{Te.current=e,we(e)},[]),[De,Oe]=(0,$.useState)(null),[M,ke]=(0,$.useState)([]),[Ae,je]=(0,$.useState)(null),[Me,Ne]=(0,$.useState)(!1),Pe=(0,$.useRef)(null),Fe=()=>Math.round((typeof window>`u`?900:window.innerHeight)/3),[Ie,Le]=(0,$.useState)(null),Re=(0,$.useRef)(null),ze=(0,$.useRef)(null),Be=(0,$.useRef)(null),Ue=(0,$.useCallback)(e=>{let t=Be.current;t&&Le(Math.min(Fe(),Math.max(44,t.startH+(t.startY-e.clientY))))},[]),We=(0,$.useCallback)(()=>{Be.current=null,window.removeEventListener(`pointermove`,Ue),window.removeEventListener(`pointerup`,We)},[Ue]),Ke=(0,$.useCallback)(e=>{Be.current={startY:e.clientY,startH:Re.current?.offsetHeight??44},window.addEventListener(`pointermove`,Ue),window.addEventListener(`pointerup`,We),e.preventDefault()},[Ue,We]),qe=(0,$.useCallback)(e=>{let t=Ie??Re.current?.offsetHeight??44;e.key===`ArrowUp`?(e.preventDefault(),Le(Math.min(Fe(),t+24))):e.key===`ArrowDown`&&(e.preventDefault(),Le(Math.max(44,t-24)))},[Ie]),[Je,Ye]=(0,$.useState)(null);(0,$.useEffect)(()=>{if(Ie!==null)return;let e=Re.current;if(!e)return;let t=e.style.height;e.style.height=`auto`;let n=Math.min(Fe(),Math.max(44,e.scrollHeight));e.style.height=t,Ye(n)},[E,Ie]),(0,$.useLayoutEffect)(()=>{if(ze.current===null)return;let e=Re.current;if(!e)return;let t=ze.current;ze.current=null,e.setSelectionRange(t,t)},[E]);let N=f(e),[Xe,Ze]=(0,$.useState)(!1),[Qe,P]=(0,$.useState)(Se),[$e,et]=(0,$.useState)(`medium`),[F,I]=(0,$.useState)(!1),tt=(0,$.useRef)(null);(0,$.useEffect)(()=>{if(!Xe)return;let e=e=>{tt.current?.contains(e.target)||Ze(!1)},t=e=>{e.key===`Escape`&&Ze(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[Xe]);let L=(0,$.useCallback)(async()=>{if(!F){I(!0);try{let e=await N(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({model:Qe,effort:$e})}),t=await e.json().catch(()=>({})),n=xe(e.ok,e.status,t);console.info(`[admin-ui] composer-new-session status=${e.status} outcome=${n.kind} model=${Qe} effort=${$e}`),n.kind===`navigate`?n.sameOrigin?window.location.assign(n.url):(window.open(n.url,`_blank`),Ze(!1)):e.status===503||n.reason===`claude-auth-dead`?(console.info(`[admin-ui] op=llm-action-blocked action=spawn reason=claude-disconnected`),Ze(!1),y(!0)):console.error(`[admin-ui] composer-new-session-failed status=${e.status} reason=${n.reason}`)}catch(e){console.error(`[admin-ui] composer-new-session-failed error=${e instanceof Error?e.message:String(e)}`)}finally{I(!1)}}},[N,Qe,$e,F]),R=!d,[nt,z]=(0,$.useState)([]),[B,rt]=(0,$.useState)(!1),V=(0,$.useRef)(0),it=(0,$.useRef)(!1);(0,$.useEffect)(()=>(it.current=!1,()=>{it.current=!0}),[]);let at=(0,$.useCallback)(async()=>{if(!R)return;let e=++V.current;try{let t=await N(`/api/admin/sidebar-sessions`);if(!t.ok){console.error(`[chat-conversations] op=enumerate-failed status=${t.status}`);return}let n=((await t.json()).sessions??[]).filter(e=>e.channel!==`whatsapp`&&e.channel!==`telegram`).map(e=>({id:e.sessionId,name:e.title,active:e.live,archived:!!e.archived,lastActiveMs:Number.isFinite(Date.parse(e.startedAt))?Date.parse(e.startedAt):null})).sort((e,t)=>(t.lastActiveMs??0)-(e.lastActiveMs??0));if(it.current||e!==V.current)return;z(n),rt(!0),console.info(`[chat-conversations] op=enumerate owned=${n.length}`)}catch(e){console.error(`[chat-conversations] op=enumerate-failed error=${e instanceof Error?e.message:String(e)}`)}},[N,R]);(0,$.useEffect)(()=>{at()},[at]),(0,$.useEffect)(()=>{i&&at()},[i,at]);let ot=(0,$.useCallback)(async(e,t,n,r)=>{console.info(`[chat-conversations] op=action name=${e} sessionId=${t.id.slice(0,8)}`);try{let t=await N(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!t.ok){console.error(`[chat-conversations] op=action-failed name=${e} status=${t.status}`);return}at()}catch(t){console.error(`[chat-conversations] op=action-failed name=${e} error=${t instanceof Error?t.message:String(t)}`)}},[N,at]),st=(0,$.useCallback)(e=>{console.info(`[chat-conversations] op=action name=open sessionId=${e.id.slice(0,8)}`),window.location.assign(`/chat?session=${encodeURIComponent(e.id)}`)},[]),ct=(0,$.useCallback)((e,t)=>{ot(`rename`,e,`/api/admin/session-rename`,{sessionId:e.id,title:t.trim()})},[ot]),lt=(0,$.useCallback)((e,t)=>{ot(`archive`,e,`/api/admin/session-archive`,{sessionId:e.id,mode:t?`archive`:`unarchive`})},[ot]),ut=(0,$.useCallback)(e=>{ot(`delete`,e,`/api/admin/session-delete`,{sessionId:e.id})},[ot]),dt=(0,$.useCallback)(e=>{ot(`stop`,e,`/api/admin/session-stop`,{sessionId:e.id})},[ot]),ft=(0,$.useCallback)(e=>{m(e.id)},[]),pt=(0,$.useCallback)(e=>{je(null);let t=e.find(e=>!ie(e.type,v));if(t){je(`Unsupported file type: "${t.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, zip, voice notes.`);return}let n=e.find(e=>e.size>b);if(n){je(`"${n.name}" exceeds the 50 MB limit.`);return}ke(t=>[...t,...e].slice(0,5))},[]),mt=(0,$.useMemo)(()=>M.map(e=>e.type.startsWith(`image/`)?URL.createObjectURL(e):null),[M]);(0,$.useEffect)(()=>()=>{for(let e of mt)e&&URL.revokeObjectURL(e)},[mt]);let ht=ne(),gt=ht.state===`recording`||ht.state===`paused`||ht.state===`sending`,_t=(0,$.useCallback)(async()=>{let t=await ht.send();if(!t)return;let r=t.type===`audio/ogg`?`.ogg`:t.type===`audio/mp4`?`.m4a`:`.webm`,i=new File([t],`voice-note${r}`,{type:t.type});if(re){ke(e=>[...e,i].slice(0,5));return}se(!0);let a=new FormData;if(d){a.append(`message`,``),a.append(`session_key`,w??``);let e=Yu();e&&a.append(`agent`,e)}else a.append(`text`,``);a.append(`attachments`,i),!d&&n&&a.append(`session`,n);try{let t=d?await fetch(`/api/chat`,{method:`POST`,body:a}):await fetch(`/api/webchat/send?session_key=${encodeURIComponent(e)}`,{method:`POST`,body:a});t.ok||(console.error(`[admin-ui] webchat-send-failed kind=voice status=${t.status}`),ke(e=>[...e,i].slice(0,5)),je(`Voice note failed to send. The recording is attached — press send to retry.`))}catch(e){console.error(`[admin-ui] webchat-send-failed kind=voice error=${e instanceof Error?e.message:String(e)}`),ke(e=>[...e,i].slice(0,5)),je(`Voice note failed to send. The recording is attached — press send to retry.`)}finally{se(!1)}},[ht,e,n,re,d,w]),vt=(0,$.useRef)(!1);(0,$.useEffect)(()=>(vt.current=!1,()=>{vt.current=!0}),[]);let yt=(0,$.useRef)(!1),bt=(0,$.useCallback)(async()=>{if(yt.current)return null;yt.current=!0;try{if(d){let e=Yu(),t=await fetch(`/api/public-reader/session${e?`?agent=${encodeURIComponent(e)}`:``}`);if(!t.ok)return null;let n=await t.json();if(vt.current)return null;T(n.sessionKey);let r={sessionId:n.sessionId??``,projectDir:n.projectDir};return C.current=r,S(r),r}let t=`session_key=${encodeURIComponent(e)}${n?`&session=${encodeURIComponent(n)}`:``}`,r=await fetch(`/api/webchat/session?${t}`);if(!r.ok)return null;let i=await r.json();return vt.current?i:(C.current=i,S(i),i)}catch{return null}finally{yt.current=!1}},[e,n,d]);(0,$.useEffect)(()=>{bt();let e=setInterval(()=>{bt()},_d);return()=>clearInterval(e)},[bt]),(0,$.useEffect)(()=>{if(d)return;let e=!1,t=async()=>{try{let t=await fetch(`/api/health`);if(!t.ok)return;let n=await t.json();e||g(n.auth_status!==`dead`&&n.auth_status!==`missing`)}catch{}};t();let n=setInterval(t,6e4);return()=>{e=!0,clearInterval(n)}},[d]);let xt=(0,$.useCallback)(async()=>{let t=E.trim();if(!t&&M.length===0||re)return!1;if(!d&&!h)return console.info(`[admin-ui] op=llm-action-blocked action=send reason=claude-disconnected`),y(!0),!1;se(!0),ve.current=!1;try{if(d){let e=w;if(!e)return console.error(`[public-webchat] op=send-skip reason=no-key`),!1;let n,r=Yu();if(M.length>0){let i=new FormData;i.append(`message`,t),i.append(`session_key`,e),r&&i.append(`agent`,r);for(let e of M)i.append(`attachments`,e);n=await fetch(`/api/chat`,{method:`POST`,body:i})}else n=await fetch(`/api/chat`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({message:t,session_key:e,...r?{agent:r}:{}})});return n.ok?(D(``),ke([]),je(null),!0):(console.error(`[public-webchat] op=send-failed status=${n.status}`),!1)}M.some(e=>Ge(e.type))&&(pe(!0),console.info(`[admin-ui] op=transcribe-indicator state=show`));let r=s&&!n,i;if(M.length>0){let a=new FormData;a.append(`text`,t);for(let e of M)a.append(`attachments`,e);n&&a.append(`session`,n),r&&a.append(`clearSignal`,`true`),i=await fetch(`/api/webchat/send?session_key=${encodeURIComponent(e)}`,{method:`POST`,body:a})}else i=await fetch(`/api/webchat/send?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:t,...n?{session:n}:{},...r?{clearSignal:!0}:{}})});if(i.ok)return je(null),ge(null),Ut(!1),Gt(null),c?.(),ve.current=!0,me({baselineSize:C.current?.sizeBytes??null,baselineTurns:Te.current,text:t,files:M}),D(``),ke([]),!0;i.status===409?console.error(`[admin-ui] webchat-send-refused reason=channel-conflict`):console.error(`[admin-ui] webchat-send-failed status=${i.status}`)}catch(e){console.error(`[admin-ui] webchat-send-failed error=${e instanceof Error?e.message:String(e)}`)}finally{ve.current||se(!1),M.some(e=>Ge(e.type))&&console.info(`[admin-ui] op=transcribe-indicator state=clear`),pe(!1)}return!1},[E,re,e,M,n,d,h,w,c,s]);(0,$.useEffect)(()=>{if(!d||k.current||!w)return;let e=Zu(),t=`url`;if(!e)try{let n=sessionStorage.getItem(Xu);n&&n.trim()&&(e=n.trim().slice(0,2e3),t=`storage`)}catch{}if(!e){new URLSearchParams(window.location.search).has(`q`)&&qu&&console.info(`[public-webchat] op=seed-skip reason=empty`),k.current=!0;return}if(qu&&console.info(`[public-webchat] op=seed-detected source=${t} len=${e.length} head=${e.slice(0,40)}`),t===`storage`&&qu&&console.info(`[public-webchat] op=seed-restored source=storage len=${e.length}`),E!==``){qu&&console.info(`[public-webchat] op=seed-skip reason=composer-dirty`),k.current=!0;return}O.current=e,D(e)},[d,w]),(0,$.useEffect)(()=>{let e=O.current;if(!(!e||E!==e||!w||k.current)){k.current=!0,O.current=null;try{let e=new URL(window.location.href);e.searchParams.delete(`q`),window.history.replaceState({},``,e.pathname+e.search+e.hash)}catch{}try{sessionStorage.removeItem(Xu)}catch{}qu&&console.info(`[public-webchat] op=seed-sent key=${w} len=${e.length}`),xt().then(e=>{e||console.error(`[public-webchat] op=seed-send-failed`)})}},[E,w,xt]);let St=(0,$.useCallback)(e=>{console.info(`[admin-ui] op=chip-tap id=${e.id} chars=${e.prompt.length}`),ee.current=e.prompt,D(e.prompt),A(e=>e+1)},[]);(0,$.useEffect)(()=>{let e=ee.current;!e||E!==e||(ee.current=null,xt().then(e=>{e||console.error(`[admin-ui] op=chip-send-failed`)}))},[te,E,xt]);let Ct=(0,$.useCallback)(async()=>{Vt(!0),ue(e=>e+1);let t=x?.sessionId??n??void 0;try{let n=await fetch(`/api/webchat/interrupt?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t?{session:t}:{})}),r=await n.json().catch(()=>({}));fd(n.status,r)===`dead-child`&&(Ut(!0),Vt(!1),Gt(`The agent stopped. Send a message to resume.`),console.log(`[admin-ui] op=stop-dead-child sessionId=${(t??``).slice(0,8)}`))}catch(e){console.error(`[admin-ui] webchat-stop-failed error=${e instanceof Error?e.message:String(e)}`)}finally{ue(e=>e-1)}},[e,x?.sessionId,n]),wt=(0,$.useCallback)(e=>{if(e.key===`Enter`&&!e.shiftKey&&!ye){e.preventDefault(),xt();return}if(e.key===`Enter`){let t=e.currentTarget,n=Ve(t.value,t.selectionStart,t.selectionEnd);n&&(e.preventDefault(),ze.current=n.caret,D(n.value));return}},[xt,ye]),Tt=(0,$.useMemo)(()=>{if(!j)return null;let e=x?.sizeBytes;return e!=null&&(j.baselineSize==null||e>j.baselineSize)?`pointer`:Ce>j.baselineTurns?`transcript`:null},[j,x?.sizeBytes,Ce]),Et=Tt!==null;(0,$.useEffect)(()=>{!j||!Tt||(console.info(`[admin-ui] op=send-confirmed via=${Tt} baselineSize=${j.baselineSize??`absent`} baselineTurns=${j.baselineTurns}`),ge(null),me(null),ve.current=!1,se(!1))},[j,Tt]),(0,$.useEffect)(()=>{if(!j)return;let e=setTimeout(()=>{D(j.text),ke(e=>[...j.files,...e].slice(0,5)),me(null),ve.current=!1,se(!1),ge(`Couldn't be delivered — press send to retry.`)},vd);return()=>clearTimeout(e)},[j]);let Dt=n?x?.channelBinding??null:null,Ot=(0,$.useRef)(!1);(0,$.useEffect)(()=>{!n||Ot.current||!x||(Ot.current=!0,console.warn(`[admin-ui] chat-session-target sessionId=${n} jsonl=${x.projectDir?`found`:`missing`} known=${x.known===!0}`))},[x,n]);let kt=(0,$.useRef)(!1);(0,$.useEffect)(()=>{n||kt.current||!x?.sessionId||(kt.current=!0,console.info(`[admin-ui] chat-session-resolve sessionId=${x.sessionId.slice(0,8)} source=canonical`))},[x,n]);let H=s?null:x,At=H?H.effectivePermissionMode??H.permissionMode??null:null,jt=H?.model??null,Mt=H?.activity===`busy`,Nt=(0,$.useRef)(!1);(0,$.useEffect)(()=>{if(!s||Nt.current||!x)return;Nt.current=!0;let e=x.sessionId?x.sessionId.slice(0,8):`none`;console.info(`[sub-account] op=post-switch-pointer switchId=${u?u.slice(0,8):`none`} source=${x.source??`unknown`} shown=${e}`)},[s,x,u]);let Pt=(0,$.useMemo)(()=>d?(e,t,n)=>Ku(e,t,n,`public`):Ku,[d]),Ft=(0,$.useMemo)(()=>!d&&j&&!Et?(0,Q.jsx)(Gu,{text:j.text,filenames:j.files.map(e=>e.name)}):null,[d,j,Et]),It=(0,$.useMemo)(()=>{if(d)return null;let e=Mt?(0,Q.jsx)(Lu,{activity:De,turnCount:Ce}):null;return!Ft&&!e?null:(0,Q.jsxs)(Q.Fragment,{children:[Ft,e]})},[d,Mt,De,Ce,Ft]),Lt=(0,$.useMemo)(()=>{try{return new URLSearchParams(window.location.search).get(`diag`)===`composer`}catch{return!1}},[]),U=(0,$.useRef)(null),Rt=(0,$.useRef)(0),zt=(0,$.useCallback)((e,t,n)=>{let r=U.current;r&&console.info(`[diag:composer] keystroke #${r.seq} reconciled transcript — phase=${t} actualDuration=${n.toFixed(2)}ms latency=${(performance.now()-r.t0).toFixed(2)}ms`)},[]),[Bt,Vt]=(0,$.useState)(!1);(0,$.useEffect)(()=>{Mt||Vt(!1)},[Mt]);let[Ht,Ut]=(0,$.useState)(!1),[Wt,Gt]=(0,$.useState)(null);(0,$.useEffect)(()=>{H?.turnAborted?Ht||(Ut(!0),Gt(`The agent stopped. Send a message to resume.`),console.log(`[admin-ui] op=phantom-turn-cleared sessionId=${(H.sessionId??``).slice(0,8)}`)):Mt&&(Ht||Wt!==null)&&(Ut(!1),Gt(null))},[H?.turnAborted,H?.sessionId,Mt,Ht,Wt]);let[Kt,qt]=(0,$.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`maxy:whatsapp-reader:clean-view`)===`1`}catch{return!1}}),Jt=(0,$.useCallback)(()=>{qt(e=>{let t=!e;try{window.localStorage.setItem(`maxy:whatsapp-reader:clean-view`,t?`1`:`0`)}catch{}return t})},[]),[Yt,Xt]=(0,$.useState)(!1),Zt=(0,$.useRef)(null);(0,$.useEffect)(()=>{if(!Yt)return;let e=e=>{Zt.current?.contains(e.target)||Xt(!1)},t=e=>{e.key===`Escape`&&Xt(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[Yt]);let[Qt,$t]=(0,$.useState)(()=>{try{return window.localStorage.getItem(`maxy:webchat:mic-device-id`)}catch{return null}}),[en,tn]=(0,$.useState)([]),[nn,rn]=(0,$.useState)(!1),an=(0,$.useRef)(null);(0,$.useEffect)(()=>{if(!nn)return;let e=e=>{an.current?.contains(e.target)||rn(!1)},t=e=>{e.key===`Escape`&&rn(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[nn]);let on=(0,$.useCallback)(async()=>{rn(e=>!e),tn(await oe())},[]),sn=(0,$.useCallback)((e,t)=>{$t(e);try{e?window.localStorage.setItem(`maxy:webchat:mic-device-id`,e):window.localStorage.removeItem(`maxy:webchat:mic-device-id`)}catch{}console.info(`[admin-ui] mic-device-selected`,t),rn(!1)},[]),cn=(0,$.useCallback)(async t=>{let n=x?.pendingPermissionPrompt;if(!(!n||!x?.sessionId))try{await fetch(`/api/webchat/permission-verdict?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:x.sessionId,request_id:n.requestId,behavior:t})})}catch(e){console.error(`[admin-ui] permission-verdict-failed error=${e instanceof Error?e.message:String(e)}`)}},[e,x?.sessionId,x?.pendingPermissionPrompt]),ln=(0,$.useRef)(!1);return(0,$.useEffect)(()=>{ln.current||x?.projectDir&&x.activity==null&&At==null&&jt==null&&(ln.current=!0,console.warn(`[admin-ui] composer-indicators-unavailable sessionId=${x.sessionId} (manager meta unreadable or pre-activity)`))},[x,At,jt]),(0,$.useEffect)(()=>{console.info(`[admin-ui] chat-render variant=${r} isPublic=${d} deliveredOnly=${p} model=${jt??`null`} audience=${d?`public`:`admin`}`)},[r,d,p,jt]),(0,Q.jsxs)(`div`,{className:`webchat-page`,children:[de?(0,Q.jsx)(`div`,{className:`interrupt-overlay`,role:`status`,"aria-live":`polite`,children:(0,Q.jsxs)(`div`,{className:`interrupt-modal`,children:[(0,Q.jsx)(l,{className:`spin interrupt-spinner`,size:28,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`interrupt-label`,children:`Interruption in progress…`})]})}):null,x?.projectDir&&!s?(()=>{let t=(0,Q.jsx)(ae,{resetKey:x.sessionId,sessionId:x.transcriptSessionId??x.sessionId,projectDir:x.projectDir,sessionKey:d?w??``:e,renderItems:Pt,clean:r===`admin`?Kt:void 0,onToggleClean:r===`admin`?Jt:void 0,forceDeliveredOnly:p,streamEndpoint:d?`/api/public-reader/stream`:`/api/whatsapp-reader/stream`,suppressDirectives:d,tail:It,onTurnsChange:d?void 0:Ee,onActivityChange:d?void 0:Oe},x.sessionId);return Lt?(0,Q.jsx)($.Profiler,{id:`chat-transcript`,onRender:zt,children:t}):t})():R&&!n&&B&&nt.length===0&&x?.known===!1?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`webchat-conv-splash`,"data-testid":`conversations-splash`,children:[(0,Q.jsx)(`img`,{src:o,alt:``,className:`webchat-conv-splash-logo`}),(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-conv-splash-new`,onClick:L,disabled:F,children:[F?(0,Q.jsx)(l,{size:16,className:`spin`}):null,` New session`]})]}),Ft?(0,Q.jsx)(`div`,{className:`webchat-pending-standalone`,children:Ft}):null]}):x&&!d?!n||x.known?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(bd,{userName:t,variant:r,onChip:St}),Ft?(0,Q.jsx)(`div`,{className:`webchat-pending-standalone`,children:Ft}):null]}):(0,Q.jsx)(`div`,{className:`webchat-greeting`,children:(0,Q.jsx)(`p`,{className:`webchat-greeting-none`,children:`No transcript found for this session.`})}):null,i&&R?(0,Q.jsx)(`div`,{className:`webchat-conv-overlay`,children:(0,Q.jsx)(gd,{sessions:s?nt.map(e=>({...e,active:!1})):nt,onOpen:st,onRename:ct,onArchive:lt,onDelete:ut,onEnd:dt,onNew:L,onBack:()=>a?.(),onCopyId:ft})}):null,(0,Q.jsx)(dd,{deliveryFailure:!!H?.deliveryFailure,permPrompt:H?.pendingPermissionPrompt??null,onVerdict:cn,isDragOver:Me,onDragOver:e=>{e.preventDefault(),Ne(!0)},onDragLeave:()=>Ne(!1),onDrop:e=>{e.preventDefault(),Ne(!1),pt([...e.dataTransfer.files])},fileInputRef:Pe,acceptMime:le,onFileInputChange:e=>{e.target.files&&pt([...e.target.files]),e.target.value=``},showResizeHandle:!gt,onResizePointerDown:Ke,onResizeKeyDown:qe,pendingFiles:M,thumbUrls:mt,onRemoveFile:e=>ke(t=>t.filter((t,n)=>n!==e)),attachError:Ae,sendError:he,transcribing:fe,voice:ht,isVoiceActive:gt,onVoiceSend:_t,text:E,onTextareaChange:e=>{if(Lt){let e=++Rt.current;U.current={seq:e,t0:performance.now()},requestAnimationFrame(()=>{U.current?.seq===e&&(U.current=null)})}D(e.target.value)},textareaRef:Re,textareaHeight:Ie??Je??44,textareaDisabled:Dt!==null||re||j!==null,onKeyDown:wt,onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let n=He(t,Date.now());n.length>0&&pt(n)},onSend:xt,sendDisabled:re||E.trim().length===0&&M.length===0||Dt!==null,turnActive:!d&&Mt&&!Ht,onStop:Ct,stopping:Bt,deadChildNotice:Wt,conflictHint:Dt,showNewSession:!d,newSessionRef:tt,newSessionOpen:Xe,onToggleNewSession:()=>Ze(e=>!e),newSessionDisabled:Dt!==null,newModel:Qe,onPickModel:P,newEffort:$e,onPickEffort:et,onNewSession:L,newSessionPending:F,onAttachClick:()=>Pe.current?.click(),attachDisabled:Dt!==null,micMenuRef:an,onMicStart:()=>ht.start(Qt??void 0),micStartDisabled:gt||Dt!==null,onOpenMicMenu:on,micMenuOpen:nn,micDevices:en,micDeviceId:Qt,onChooseMic:sn,showCleanToggle:r===`admin`,cleanView:Kt,onToggleClean:Jt,showControlsRight:!d,sessionId:H?.sessionId??null,mode:At,model:jt,effort:H?.effort??null,contextUsage:H?.contextUsage??null,paramsMenuRef:Zt,paramsMenuOpen:Yt,onToggleParamsMenu:()=>Xt(e=>!e)}),(0,Q.jsx)(_e,{open:_,onConnect:()=>window.location.assign(`/?connect=claude`),onClose:()=>y(!1)})]})}var Sd=`maxy-subaccount-switch-clear`;function Cd(e){if(e)return!1;try{return sessionStorage.getItem(Sd)!=null}catch{return!1}}function wd(e){if(e)return null;try{return sessionStorage.getItem(Sd)}catch{return null}}function Td(e){if(e)return!1;let t=null;try{t=sessionStorage.getItem(Sd),t&&sessionStorage.removeItem(Sd)}catch{}return console.info(`[sub-account] op=post-switch-chat switchId=${t??`none`} signal=${t!=null} resume=${t==null}`),t!=null}function Ed({variant:e=`admin`,forceCanonicalSession:t=!1}){let[n,r]=(0,$.useState)(null),[i]=(0,$.useState)(()=>pd(t,window.location.search)),[a,o]=(0,$.useState)(()=>Cd(t)),[s]=(0,$.useState)(()=>wd(t)),c=(0,$.useRef)(!1);(0,$.useEffect)(()=>{c.current||(c.current=!0,Td(t))},[t]);let[u,d]=(0,$.useState)(!1),[f,m]=(0,$.useState)(!1),[h,g]=(0,$.useState)(void 0),[_,v]=(0,$.useState)(null),[y,b]=(0,$.useState)(void 0),[x,S]=(0,$.useState)(null),[C,w]=(0,$.useState)(null);(0,$.useEffect)(()=>{let e=!1,t=null;try{t=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!t){r(null),d(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(t)}`).then(async n=>{if(!e){if(n.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(n.ok)try{let e=await n.json();typeof e.businessName==`string`&&g(e.businessName),e.sessionId!==void 0&&v(e.sessionId??null),w(e.role??null),b(e.userName===void 0?null:e.userName),S(e.avatar??null)}catch{}r(t),d(!0)}}).catch(()=>{e||(r(t),d(!0))}),()=>{e=!0}},[]);let T=(0,$.useRef)(!1);(0,$.useEffect)(()=>{e!==`operator`||!u||!n||T.current||(T.current=!0,console.info(`[operator-ui] op=mount surface=chat sessionId=${(_??``).slice(0,8)}`))},[e,u,n,_]);let E=(0,$.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),[D,O]=(0,$.useState)(!1),k=(0,$.useCallback)(async()=>{O(!0);try{let e=await fe();if(e){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`}return e}finally{O(!1)}},[]);return u?n?(0,Q.jsx)(p,{cacheKey:n,surface:`chat`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=chat`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,Q.jsx)(Ce,{cacheKey:n,businessName:h,variant:e,sessionId:_,onLogout:E,onDisconnect:k,disconnecting:D,userName:y,userAvatar:x,role:C,onOpenConversations:()=>m(!0),children:(0,Q.jsx)(xd,{cacheKey:n,userName:y??null,targetSessionId:i,variant:e,conversationsOpen:f,onCloseConversations:()=>m(!1),cleared:a,onFirstSend:()=>o(!1),switchId:s})})}):(0,Q.jsx)(`div`,{className:`data-page`,children:(0,Q.jsxs)(`div`,{className:`data-empty`,children:[(0,Q.jsx)(`p`,{children:`You are not signed in.`}),(0,Q.jsxs)(`p`,{children:[`Open the `,(0,Q.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,Q.jsx)(`div`,{className:`data-page`,children:(0,Q.jsxs)(`div`,{className:`data-loading`,children:[(0,Q.jsx)(l,{size:18,className:`spin`}),` Loading…`]})})}function Dd(){return(0,Q.jsx)(Ed,{})}export{Yu as a,qu as c,Xu as i,Dd as n,Zu as o,xd as r,Ju as s,Ed as t};
32
+ `))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return oc(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=rl.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function pl(){return{exit:{taskListCheckValueChecked:hl,taskListCheckValueUnchecked:hl,paragraph:gl}}}function ml(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:_l}}}function hl(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function gl(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function _l(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=rl.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function vl(){return[ws(),Js(),$s(),il(),pl()]}function yl(e){return{extensions:[Ts(),Ys(e),ec(),fl(e),ml()]}}var bl={tokenize:Pl,partial:!0},xl={tokenize:Fl,partial:!0},Sl={tokenize:Il,partial:!0},Cl={tokenize:Ll,partial:!0},wl={tokenize:Rl,partial:!0},Tl={name:`wwwAutolink`,tokenize:Ml,previous:zl},El={name:`protocolAutolink`,tokenize:Nl,previous:Bl},Dl={name:`emailAutolink`,tokenize:jl,previous:Vl},Ol={};function kl(){return{text:Ol}}for(var Al=48;Al<123;)Ol[Al]=Dl,Al++,Al===58?Al=65:Al===91&&(Al=97);Ol[43]=Dl,Ol[45]=Dl,Ol[46]=Dl,Ol[95]=Dl,Ol[72]=[Dl,El],Ol[104]=[Dl,El],Ol[87]=[Dl,Tl],Ol[119]=[Dl,Tl];function jl(e,t,n){let r=this,i,a;return o;function o(t){return!Hl(t)||!Vl.call(r,r.previous)||Ul(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Hl(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(wl,u,l)(t):t===45||t===95||K(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&G(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Ml(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!zl.call(r,r.previous)||Ul(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(bl,e.attempt(xl,e.attempt(Sl,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Nl(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Bl.call(r,r.previous)&&!Ul(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(G(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||An(t)||J(t)||Fn(t)||Pn(t)?n(t):e.attempt(xl,e.attempt(Sl,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Pl(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Fl(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Cl,c,s)(t):t===null||J(t)||Fn(t)||t!==45&&Pn(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Il(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(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?e.check(Cl,t,a)(o):o===null||J(o)||Fn(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Ll(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||J(o)||Fn(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||J(e)||Fn(e)?t(e):r(e)}function a(e){return G(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):G(t)?(e.consume(t),o):n(t)}}function Rl(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return K(e)?n(e):t(e)}}function zl(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||J(e)}function Bl(e){return!G(e)}function Vl(e){return!(e===47||Hl(e))}function Hl(e){return e===43||e===45||e===46||e===95||K(e)}function Ul(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Wl={tokenize:Ql,partial:!0};function Gl(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Yl,continuation:{tokenize:Xl},exit:Zl}},text:{91:{name:`gfmFootnoteCall`,tokenize:Jl},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Kl,resolveTo:ql}}}}function Kl(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=On(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function ql(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Jl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||J(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(On(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return J(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Yl(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||J(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=On(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return J(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),X(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Xl(e,t,n){return e.check(Qn,t,e.attempt(Wl,t,n))}function Zl(e){e.exit(`gfmFootnoteDefinition`)}function Ql(e,t,n){let r=this;return X(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function $l(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&W(o,o.length,0,Gn(s,e.slice(r+1,n),t)),W(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),W(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Wn(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Wn(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var eu=class{constructor(){this.map=[]}add(e,t,n){tu(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function tu(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function nu(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function ru(){return{flow:{null:{name:`table`,tokenize:iu,resolveAll:au}}}}function iu(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Y(t)?X(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||J(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Y(t)?X(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Y(t)?X(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Y(t)?X(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||q(n)?(e.exit(`tableRow`),t(n)):Y(n)?X(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||J(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function au(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new eu;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(su(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=ou(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=ou(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=ou(f,t,o,i,n,d)):(o[0]=o[1],d=ou(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&su(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=nu(t.events,n))}return e}function ou(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},cu(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=cu(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=cu(t.events,n[2]),a=cu(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},cu(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function su(e,t,n,r,i){let a=[],o=cu(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function cu(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var lu={name:`tasklistCheck`,tokenize:du};function uu(){return{text:{91:lu}}}function du(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return J(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return q(r)?t(r):Y(r)?e.check({tokenize:fu},t,n)(r):n(r)}}function fu(e,t,n){return X(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function pu(e){return wn([kl(),Gl(),$l(e),ru(),uu()])}var mu={};function hu(e){let t=this,n=e||mu,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(pu(n)),a.push(vl()),o.push(yl(n))}var gu=null;function _u(){return gu||=Me(async()=>{let{default:e}=await import(`./mermaid.core-mH3N7K0I.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>(e.initialize({startOnLoad:!1,theme:`neutral`}),e)),gu}function vu({source:e}){let t=(0,$.useRef)(null),[n,r]=(0,$.useState)(null);return(0,$.useEffect)(()=>{let n=!1,i=`mermaid-${Math.random().toString(36).slice(2,9)}`;return _u().then(t=>t.render(i,e)).then(({svg:e})=>{!n&&t.current&&(t.current.innerHTML=e)}).catch(t=>{n||(console.error(`[MermaidBlock] render failed:`,e,t),r(t instanceof Error?t.message:`Diagram render failed`))}),()=>{n=!0}},[e]),n?(0,Q.jsxs)(`div`,{className:`md-mermaid md-mermaid-error`,children:[(0,Q.jsx)(`div`,{className:`md-mermaid-error-label`,children:`Diagram render error`}),(0,Q.jsx)(`pre`,{className:`md-pre`,children:(0,Q.jsx)(`code`,{className:`md-code`,children:e})})]}):(0,Q.jsx)(`div`,{className:`md-mermaid`,ref:t})}var yu=/\.(mp4|webm|mov)(\?.*)?$/i,bu=/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/,xu=/vimeo\.com\/(\d+)/;function Su(e){return!!e&&yu.test(e)}function Cu(e){if(!e)return null;let t=e.match(bu);return t?t[1]:null}function wu(e){if(!e)return null;let t=e.match(xu);return t?t[1]:null}function Tu({src:e}){return(0,Q.jsx)(`video`,{className:`md-video`,controls:!0,playsInline:!0,preload:`metadata`,children:(0,Q.jsx)(`source`,{src:e})})}function Eu({videoId:e}){return(0,Q.jsx)(`div`,{className:`md-video-iframe`,children:(0,Q.jsx)(`iframe`,{src:`https://www.youtube-nocookie.com/embed/${e}`,allow:`accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,loading:`lazy`})})}function Du({videoId:e}){return(0,Q.jsx)(`div`,{className:`md-video-iframe`,children:(0,Q.jsx)(`iframe`,{src:`https://player.vimeo.com/video/${e}`,allow:`autoplay; fullscreen; picture-in-picture`,allowFullScreen:!0,loading:`lazy`})})}function Ou(e){if(Su(e))return(0,Q.jsx)(Tu,{src:e});let t=Cu(e);if(t)return(0,Q.jsx)(Eu,{videoId:t});let n=wu(e);return n?(0,Q.jsx)(Du,{videoId:n}):null}var ku={p:({children:e})=>(0,Q.jsx)(`p`,{className:`md-p`,children:e}),h1:({children:e})=>(0,Q.jsx)(`h1`,{className:`md-heading`,children:e}),h2:({children:e})=>(0,Q.jsx)(`h2`,{className:`md-heading`,children:e}),h3:({children:e})=>(0,Q.jsx)(`h3`,{className:`md-heading`,children:e}),code:({children:e,className:t})=>t===`language-mermaid`?(0,Q.jsx)(vu,{source:String(e).replace(/\n$/,``)}):(0,Q.jsx)(`code`,{className:`md-code ${t||``}`.trim(),children:e}),pre:({children:e,node:t})=>{let n=t?.children?.[0];return n?.type===`element`&&n.tagName===`code`&&(n.properties?.className??[]).includes(`language-mermaid`)?(0,Q.jsx)(Q.Fragment,{children:e}):(0,Q.jsx)(`pre`,{className:`md-pre`,children:e})},ul:({children:e})=>(0,Q.jsx)(`ul`,{className:`md-list`,children:e}),ol:({children:e})=>(0,Q.jsx)(`ol`,{className:`md-list md-list-ordered`,children:e}),li:({children:e})=>(0,Q.jsx)(`li`,{className:`md-list-item`,children:e}),hr:()=>(0,Q.jsx)(`hr`,{className:`md-hr`}),strong:({children:e})=>(0,Q.jsx)(`strong`,{className:`md-strong`,children:e}),img:({src:e,alt:t})=>Ou(e)||(0,Q.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:(0,Q.jsx)(`img`,{className:`md-img`,src:e,alt:t||``,loading:`lazy`})}),a:({href:e,children:t})=>Ou(e)||(0,Q.jsx)(`a`,{href:e,className:`md-link`,target:`_blank`,rel:`noopener noreferrer`,children:t}),table:({children:e})=>(0,Q.jsx)(`table`,{className:`md-table`,children:e}),thead:({children:e})=>(0,Q.jsx)(`thead`,{className:`md-thead`,children:e}),tbody:({children:e})=>(0,Q.jsx)(`tbody`,{children:e}),tr:({children:e})=>(0,Q.jsx)(`tr`,{className:`md-tr`,children:e}),th:({children:e})=>(0,Q.jsx)(`th`,{className:`md-th`,children:e}),td:({children:e})=>(0,Q.jsx)(`td`,{className:`md-td`,children:e})};function Au({content:e,elapsedSeconds:t,timestamp:n}){return(0,Q.jsxs)(`div`,{className:`markdown-message`,children:[(0,Q.jsx)(ds,{remarkPlugins:[hu],components:ku,children:e}),t!==void 0&&(0,Q.jsxs)(`div`,{className:`message-meta`,children:[t,`s`]}),n&&(0,Q.jsx)(`span`,{className:`message-timestamp`,children:n})]})}var ju=`Accomplishing.Actioning.Actualizing.Architecting.Baking.Beaming.Befuddling.Billowing.Blanching.Bloviating.Boogieing.Boondoggling.Booping.Bootstrapping.Brewing.Bunning.Burrowing.Calculating.Canoodling.Caramelizing.Cascading.Catapulting.Cerebrating.Channeling.Channelling.Choreographing.Churning.Clauding.Coalescing.Cogitating.Combobulating.Composing.Computing.Concocting.Considering.Contemplating.Cooking.Crafting.Creating.Crunching.Crystallizing.Cultivating.Deciphering.Deliberating.Determining.Discombobulating.Doing.Doodling.Drizzling.Ebbing.Effecting.Elucidating.Embellishing.Enchanting.Envisioning.Evaporating.Fermenting.Finagling.Flibbertigibbeting.Flowing.Flummoxing.Fluttering.Forging.Forming.Frolicking.Frosting.Gallivanting.Galloping.Garnishing.Generating.Germinating.Gesticulating.Gitifying.Grooving.Gusting.Harmonizing.Hashing.Hatching.Herding.Honking.Hullaballooing.Hyperspacing.Ideating.Imagining.Improvising.Incubating.Inferring.Infusing.Ionizing.Jitterbugging.Julienning.Kneading.Leavening.Levitating.Lollygagging.Manifesting.Marinating.Meandering.Metamorphosing.Misting.Moonwalking.Moseying.Mulling.Musing.Mustering.Nebulizing.Nesting.Newspapering.Noodling.Nucleating.Orbiting.Orchestrating.Osmosing.Perambulating.Percolating.Perusing.Philosophising.Photosynthesizing.Pollinating.Pondering.Pontificating.Pouncing.Precipitating.Prestidigitating.Processing.Proofing.Propagating.Puttering.Puzzling.Quantumizing.Razzmatazzing.Recombobulating.Reticulating.Roosting.Ruminating.Scampering.Schlepping.Scurrying.Seasoning.Shenaniganing.Shimmying.Simmering.Skedaddling.Sketching.Slithering.Smooshing.Spelunking.Spinning.Sprouting.Stewing.Sublimating.Swirling.Swooping.Symbioting.Synthesizing.Tempering.Thinking.Thundering.Tinkering.Tomfoolering.Transfiguring.Transmuting.Twisting.Undulating.Unfurling.Unravelling.Vibing.Waddling.Wandering.Warping.Whatchamacalliting.Whirlpooling.Whirring.Whisking.Wibbling.Working.Wrangling.Zesting.Zigzagging`.split(`.`),Mu=3e5,Nu=9e4,Pu=4e3,Fu=2500;function Iu(e){let t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function Lu({activity:e,turnCount:t,liveness:n}){let[r]=(0,$.useState)(()=>Date.now()),[i,a]=(0,$.useState)(()=>Date.now());(0,$.useEffect)(()=>{let e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[]);let[o,s]=(0,$.useState)(()=>Date.now()),[c,l]=(0,$.useState)(()=>Math.floor(Math.random()*ju.length)),u=()=>l(e=>(e+1+Math.floor(Math.random()*(ju.length-1)))%ju.length);(0,$.useEffect)(()=>{s(Date.now()),u()},[t]);let d=(0,$.useRef)(0),f=n?n.tick:null;(0,$.useEffect)(()=>{if(f===null)return;let e=Date.now();e-d.current<Fu||(d.current=e,u())},[f]);let p=n!=null&&!e,m=e?e.lastEmitAt:p?n.at??r:o,h=p?Nu:Mu,g=i-m>h,_=p?i-m<Pu:null,v=e?`${e.count>=2?`${e.count} agents · `:``}${e.agentType} · ${e.description}`:`${ju[c]}…`;return(0,Q.jsxs)(`div`,{className:`chat-activity`,"data-stalled":g?`true`:`false`,"data-fresh":_===null?void 0:_?`true`:`false`,"aria-live":`polite`,"aria-label":g?`Agent may be stalled`:`Agent is working`,children:[(0,Q.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`chat-activity-icon`}),(0,Q.jsx)(`span`,{className:`chat-activity-word`,children:v}),(0,Q.jsx)(`span`,{className:`chat-activity-elapsed`,children:Iu(i-r)}),g&&(0,Q.jsx)(`span`,{className:`chat-activity-stalled`,children:`stalled`})]})}function Ru({variant:e,icon:t,label:n,children:r}){let[i,a]=(0,$.useState)(!1);return(0,Q.jsxs)(`div`,{className:`chat-${e}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`chat-${e}-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[(0,Q.jsx)(`span`,{className:`wa-chevron`,children:t}),(0,Q.jsx)(`span`,{className:`chat-${e}-label`,children:n})]}),i&&r]})}function zu({turns:e}){let t=e.filter(e=>e.kind===`tool-call`).length,n=t>0?`Used ${t} tool${t===1?``:`s`}`:`${e.length} tool result${e.length===1?``:`s`}`;return(0,Q.jsx)(Ru,{variant:`toolrun`,icon:(0,Q.jsx)(je,{size:12}),label:n,children:e.map((e,t)=>(0,Q.jsxs)(`div`,{className:`chat-toolrun-item`,children:[(0,Q.jsx)(`span`,{className:`chat-toolrun-name`,children:e.kind===`tool-call`?`↳ ${e.name}`:e.isError?`result (error)`:`result`}),(0,Q.jsx)(`pre`,{className:`wa-code`,children:e.kind===`tool-call`?JSON.stringify(e.input,null,2):e.text})]},t))})}function Bu({turns:e}){return(0,Q.jsx)(Ru,{variant:`thinking`,icon:(0,Q.jsx)(ze,{size:12}),label:`Thoughts`,children:e.map((e,t)=>(0,Q.jsx)(`div`,{className:`chat-thinking-item`,children:(0,Q.jsx)(Au,{content:e.text})},t))})}function Vu({ts:e}){let t=se(e);return t?(0,Q.jsx)(`time`,{className:`chat-time`,children:t}):null}function Hu({text:e}){let{status:t,copy:n}=Ne(),r=t===`ok`;return(0,Q.jsx)(`button`,{type:`button`,className:`chat-copy`,"aria-label":r?`Copied`:`Copy message`,title:r?`Copied`:`Copy`,onClick:()=>n(e),children:r?(0,Q.jsx)(s,{size:13,"aria-hidden":!0}):(0,Q.jsx)(M,{size:13,"aria-hidden":!0})})}function Uu({ts:e,copyText:t}){return(0,Q.jsxs)(`div`,{className:`chat-msg-foot`,children:[(0,Q.jsx)(Vu,{ts:e}),(0,Q.jsx)(Hu,{text:t})]})}function Wu(e,t,n,r,i,a=!1){switch(e.kind){case`operator-inbound`:case`operator-typed`:{let o=e.kind===`operator-inbound`?e.rawBody:void 0,s=a?o??e.text:e.text,c=e.kind===`operator-inbound`?e.attachments:void 0,l=e.channel,u=e.kind===`operator-inbound`&&(e.source===`whatsapp`||e.source===`telegram`)?e.source:void 0,d=l??u;return(0,Q.jsxs)(`div`,{className:d?`chat-turn-op chat-turn-op--${d}`:`chat-turn-op`,children:[s&&(0,Q.jsx)(`p`,{className:`chat-op-body`,children:s}),c&&c.length>0&&(0,Q.jsx)(`div`,{className:`chat-attachment-list`,children:c.map((e,t)=>(0,Q.jsx)(E,{expandable:!0,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,href:D(e.attachmentId,n,r,i)},t))}),s?(0,Q.jsx)(Uu,{ts:e.ts,copyText:s}):(0,Q.jsx)(Vu,{ts:e.ts})]},t)}case`agent-reply`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[(0,Q.jsx)(Au,{content:e.text}),e.text?(0,Q.jsx)(Uu,{ts:e.ts,copyText:e.text}):(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`agent-webchat-final`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[(0,Q.jsx)(Au,{content:e.text}),e.text?(0,Q.jsx)(Uu,{ts:e.ts,copyText:e.text}):(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`agent-reply-document`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[e.files.map((e,t)=>(0,Q.jsx)(E,{filename:w(e)},t)),e.caption&&(0,Q.jsx)(Au,{content:e.caption}),(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`agent-file`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[e.files.map((t,n)=>{let a=w(t),o=e.downloads?.[n];if(!o)return(0,Q.jsxs)(`p`,{className:`chat-doc`,children:[(0,Q.jsx)(C,{size:14,"aria-hidden":!0,style:{verticalAlign:`text-bottom`}}),` `,a]},n);let s=x(o,r,i);return O.test(a)?(0,Q.jsx)(re,{src:x(o,r,i,`inline`),filename:a},n):te.test(a)?(0,Q.jsx)(`img`,{className:`chat-doc-image`,src:s,alt:a},n):(0,Q.jsxs)(`a`,{className:`chat-doc chat-doc-attachment`,href:s,download:a,children:[(0,Q.jsx)(C,{size:14,"aria-hidden":!0}),a]},n)}),e.caption&&(0,Q.jsx)(Au,{content:e.caption}),(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`session-continued`:return(0,Q.jsx)(A,{},t);case`harness-internal`:return(0,Q.jsx)(Ru,{variant:`thinking`,icon:(0,Q.jsx)(je,{size:12}),label:`Internal`,children:(0,Q.jsx)(`div`,{className:`chat-thinking-item`,children:(0,Q.jsx)(Au,{content:e.text})})},t);case`whatsapp-persisted`:return(0,Q.jsxs)(`div`,{className:`chat-prose`,children:[(0,Q.jsx)(Au,{content:e.text}),e.reactions&&e.reactions.length>0&&(0,Q.jsx)(`div`,{className:`wa-reactions`,children:e.reactions.map((e,t)=>(0,Q.jsx)(`span`,{className:`wa-reaction`,title:e.reactorName??void 0,children:e.emoji},t))}),(0,Q.jsx)(Vu,{ts:e.ts})]},t);case`agent-error`:return(0,Q.jsxs)(`div`,{className:`chat-agent-error`,role:`alert`,children:[(0,Q.jsx)(`span`,{className:`chat-agent-error-msg`,children:ce(e.code,n)}),n===`admin`&&e.code===`agent_error`&&e.raw&&(0,Q.jsx)(`pre`,{className:`chat-agent-error-raw`,children:e.raw})]},t)}}function Gu({text:e,filenames:t}){return(0,Q.jsxs)(`div`,{className:`chat-turn-op chat-turn-op--pending`,"aria-busy":`true`,children:[e&&(0,Q.jsx)(`p`,{className:`chat-op-body`,children:e}),t.length>0&&(0,Q.jsx)(`div`,{className:`chat-attachment-list`,children:t.map((e,t)=>(0,Q.jsx)(`span`,{className:`chat-pending-attachment`,children:e},t))})]})}function Ku(e,t,n,r=`admin`,i=!1){let a=[],o=[],s=[],c=null,l=()=>{o.length!==0&&(a.push((0,Q.jsx)(zu,{turns:o},`tools-${a.length}`)),o=[])},u=()=>{s.length!==0&&(a.push((0,Q.jsx)(Bu,{turns:s},`think-${a.length}`)),s=[])};return e.forEach((e,d)=>{let f=T(e),p=ee(f);if(p!==null&&p!==c&&(l(),u(),a.push((0,Q.jsx)(k,{ts:f},`day-${d}`)),c=p),e.kind===`turn`&&(e.turn.kind===`tool-call`||e.turn.kind===`tool-result`)){u(),o.push(e.turn);return}if(e.kind===`turn`&&e.turn.kind===`agent-text`){l(),s.push(e.turn);return}l(),u(),e.kind===`directive`?a.push((0,Q.jsx)(S,{entry:e.entry,sessionId:t,sessionKey:n},d)):a.push(Wu(e.turn,d,r,t,n,i))}),l(),u(),a}new Set(`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,text/rtf,application/rtf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.ms-powerpoint,application/vnd.oasis.opendocument.presentation,audio/ogg,audio/opus,audio/mp4,audio/mpeg,audio/webm,audio/wav,.docx,.odt,.rtf,.xlsx,.xls,.ods,.pptx,.ppt,.odp,.opus,.ogg,.m4a,.mp3,.wav,.webm`.split(`,`).filter(e=>!e.startsWith(`.`)));var qu=typeof window<`u`&&/^(localhost|127\.0\.0\.1|[a-z0-9-]+\.local)(:|$)/.test(window.location.hostname);function Ju(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Yu(){let e=window.location.pathname.match(/^\/([a-z][a-z0-9-]{2,49})$/);return e?e[1]:void 0}var Xu=`maxy_seed_q`;function Zu(){let e=new URLSearchParams(window.location.search).get(`q`);if(e==null)return null;let t=e.trim();return t?t.slice(0,2e3):null}function Qu(e){return`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`}function $u({data:e,active:t}){let n=[];if(e&&e.length>0&&t){let t=Math.floor(e.length/24);for(let r=0;r<24;r++){let i=e[r*t]??128,a=Math.abs(i-128)/128;n.push(Math.max(.15,a))}}else for(let e=0;e<24;e++)n.push(.15);return(0,Q.jsx)(`div`,{className:`voice-waveform`,"aria-hidden":`true`,children:n.map((e,t)=>(0,Q.jsx)(`div`,{className:`voice-waveform-bar`,style:{height:`${Math.round(e*100)}%`}},t))})}function ed({state:e,elapsedSeconds:t,waveform:n,onTogglePause:r,onDiscard:i,onSend:a}){if(e===`idle`||e===`error`)return null;let o=e===`recording`,s=e===`paused`,c=e===`sending`;return(0,Q.jsxs)(`div`,{className:`voice-recorder`,role:`region`,"aria-label":`Voice recording`,"aria-live":`polite`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`voice-trash`,onClick:i,disabled:c,"aria-label":`Discard recording`,children:(0,Q.jsx)(u,{size:16})}),(0,Q.jsx)(`span`,{className:`voice-timer`,"aria-live":`polite`,"aria-atomic":`true`,children:Qu(t)}),(0,Q.jsx)($u,{data:n,active:o}),(0,Q.jsx)(`button`,{type:`button`,className:`voice-pause`,onClick:r,disabled:c,"aria-label":s?`Resume recording`:`Pause recording`,children:s?(0,Q.jsx)(ke,{size:14}):(0,Q.jsx)(de,{size:14})}),(0,Q.jsx)(j,{variant:`send`,type:`button`,onClick:a,disabled:c,loading:c,"aria-label":`Send voice note`,children:(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Q.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,Q.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]})}var td=i(`wrench-off`,[[`path`,{d:`M10.747 5.093a6 6 0 0 1 6.841-2.882c.438.12.54.662.219.984L14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-2.882 6.842`,key:`a1`}],[`path`,{d:`m13.5 13.5-7.88 7.88a1 1 0 0 1-2.999-3l7.88-7.88`,key:`a2`}],[`path`,{d:`m2 2 20 20`,key:`a3`}]]),nd={low:`Low`,medium:`Medium`,high:`High`,xhigh:`Highest`},rd=[{id:Se,label:we(Se)},{id:me,label:we(me)},{id:be,label:we(be)}],id=[{id:`low`,label:`Low`},{id:`medium`,label:`Medium`},{id:`high`,label:`High`},{id:`xhigh`,label:`Extra`},{id:`max`,label:`Max`}],ad=[{id:`default`,label:`Ask permissions`},{id:`acceptEdits`,label:`Accept edits`},{id:`bypassPermissions`,label:`Bypass permissions`}];function od({newModel:e,onPickModel:t,newEffort:n,onPickEffort:r,onNewSession:i,newSessionPending:a,newPermMode:o,onPickPermMode:c}){let l=Math.max(0,id.findIndex(e=>e.id===n)),u=id[l]?.label??``,d=id.length-1,f=e=>`calc(14px + (100% - 28px) * ${d>0?e/d:0})`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`webchat-newsession-field`,children:[(0,Q.jsx)(`span`,{children:`Model`}),(0,Q.jsx)(`div`,{className:`webchat-newsession-models`,children:rd.map(n=>(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-newsession-model`,role:`menuitemradio`,"aria-checked":e===n.id,onClick:()=>t(n.id),children:[(0,Q.jsx)(`span`,{children:n.label}),e===n.id&&(0,Q.jsx)(s,{size:13})]},n.id))})]}),(0,Q.jsxs)(`div`,{className:`webchat-newsession-field`,children:[(0,Q.jsxs)(`div`,{className:`webchat-newsession-effort-head`,children:[(0,Q.jsxs)(`span`,{children:[`Effort `,(0,Q.jsx)(`strong`,{children:u})]}),(0,Q.jsx)(`span`,{className:`webchat-newsession-effort-help`,title:`Higher effort lets the model think longer before it answers.`,children:(0,Q.jsx)(Fe,{size:14})})]}),(0,Q.jsxs)(`div`,{className:`webchat-newsession-slider-ends`,"aria-hidden":`true`,children:[(0,Q.jsx)(`span`,{children:`Faster`}),(0,Q.jsx)(`span`,{children:`Smarter`})]}),(0,Q.jsxs)(`div`,{className:`webchat-newsession-track`,children:[(0,Q.jsx)(`span`,{className:`webchat-newsession-track-fill`,style:{width:f(l)},"aria-hidden":`true`}),id.map((e,t)=>(0,Q.jsx)(`span`,{className:`webchat-newsession-dot${t===d?` is-max`:``}`,style:{left:f(t)},"aria-hidden":`true`},e.id)),(0,Q.jsx)(`span`,{className:`webchat-newsession-knob`,style:{left:f(l)},"aria-hidden":`true`}),(0,Q.jsx)(`input`,{type:`range`,className:`webchat-newsession-slider`,min:0,max:d,step:1,value:l,onChange:e=>r(id[Number(e.target.value)].id),"aria-label":`New session thinking effort`})]})]}),o!=null&&c&&(0,Q.jsxs)(`div`,{className:`webchat-newsession-field`,children:[(0,Q.jsx)(`span`,{children:`Permissions`}),(0,Q.jsx)(`div`,{className:`webchat-newsession-models`,children:ad.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-newsession-model`,role:`menuitemradio`,"aria-checked":o===e.id,onClick:()=>c(e.id),children:[(0,Q.jsx)(`span`,{children:e.label}),o===e.id&&(0,Q.jsx)(s,{size:13})]},e.id))})]}),(0,Q.jsx)(`button`,{type:`button`,className:`webchat-newsession-go`,onClick:()=>void i(),disabled:a,children:a?`Starting…`:`Start new session`})]})}var sd={default:`Ask permissions`,acceptEdits:`Accept edits`,plan:`Plan mode`,auto:`Auto mode`,bypassPermissions:`Bypass permissions`};function cd(e){return we(ve(e))}function ld(e){return e>=1e6?`~${(e/1e6).toFixed(e%1e6==0?0:1)}M`:e>=1e3?`~${Math.round(e/1e3)}k`:`~${e}`}function ud({pct:e,usedTokens:t,window:n}){let r=Math.max(0,Math.min(100,e)),i=`Context window used — ${e}% · ${ld(t)}/${ld(n)}`;return(0,Q.jsx)(`span`,{className:`webchat-context-ring`,role:`img`,"aria-label":i,title:i,children:(0,Q.jsxs)(`svg`,{viewBox:`0 0 14 14`,width:`14`,height:`14`,"aria-hidden":`true`,children:[(0,Q.jsx)(`circle`,{className:`ring-track`,cx:`7`,cy:`7`,r:`5`}),(0,Q.jsx)(`circle`,{className:`ring-fill`,cx:`7`,cy:`7`,r:`5`,pathLength:100,strokeDasharray:`${r} 100`,transform:`rotate(-90 7 7)`})]})})}function dd(e){let{deliveryFailure:t,permPrompt:n,onVerdict:r,isDragOver:i,onDragOver:a,onDragLeave:o,onDrop:c,fileInputRef:u,acceptMime:d,onFileInputChange:f,showResizeHandle:p,onResizePointerDown:m,onResizeKeyDown:v,pendingFiles:b,thumbUrls:x,onRemoveFile:S,attachError:w,sendError:T,transcribing:E=!1,voice:D,isVoiceActive:O,onVoiceSend:k,text:ee,onTextareaChange:te,textareaRef:ne,textareaHeight:A,textareaDisabled:re,placeholder:ie=`Message your agent…`,onKeyDown:ae,onPaste:oe,onSend:se,sendDisabled:ce,turnActive:le=!1,onStop:de,stopping:fe=!1,deadChildNotice:j,conflictHint:me,showNewSession:_e,newSessionRef:ve,newSessionOpen:ye,onToggleNewSession:be,newSessionDisabled:xe,newModel:Se,onPickModel:Ce,newEffort:we,onPickEffort:Te,onNewSession:Ee,newSessionPending:Oe,newPermMode:ke,onPickPermMode:Me,onAttachClick:Ne,attachDisabled:Pe,micMenuRef:Fe,onMicStart:Re,micStartDisabled:ze,onOpenMicMenu:Ve,micMenuOpen:He,micDevices:Ue,micDeviceId:We,onChooseMic:Ge,showCleanToggle:Ke,cleanView:qe,onToggleClean:Je,showControlsRight:Ye,sessionId:N,mode:Xe,model:Ze,effort:Qe,contextUsage:P,paramsMenuRef:$e,paramsMenuOpen:et,onToggleParamsMenu:F}=e,I=e=>e.preventDefault(),[tt,L]=(0,$.useState)(!1),R=(0,$.useRef)(null),nt=(0,$.useRef)(null),z=()=>{N&&(R.current=setTimeout(()=>{let e=navigator.clipboard?.writeText(N);e&&e.then(()=>{L(!0),nt.current&&clearTimeout(nt.current),nt.current=setTimeout(()=>L(!1),1200)}).catch(()=>{})},500))},B=()=>{R.current&&=(clearTimeout(R.current),null)};return(0,$.useEffect)(()=>()=>{R.current&&clearTimeout(R.current),nt.current&&clearTimeout(nt.current)},[]),(0,Q.jsxs)(`div`,{className:`webchat-composer`,children:[t&&(0,Q.jsx)(`div`,{className:`webchat-delivery-failed`,role:`alert`,children:`Message not delivered — the session was unresponsive. Resend to retry.`}),n&&(0,Q.jsxs)(`div`,{className:`webchat-perm-card`,role:`alertdialog`,"aria-label":`Permission request`,children:[(0,Q.jsxs)(`div`,{className:`webchat-perm-head`,children:[`Claude wants to run `,(0,Q.jsx)(`strong`,{children:n.toolName})]}),n.description&&(0,Q.jsx)(`div`,{className:`webchat-perm-desc`,children:n.description}),n.inputPreview&&(0,Q.jsx)(`pre`,{className:`webchat-perm-preview`,children:n.inputPreview}),(0,Q.jsxs)(`div`,{className:`webchat-perm-actions`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`webchat-perm-deny`,onPointerDown:I,onClick:()=>void r(`deny`),children:`Deny`}),(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-perm-allow`,onPointerDown:I,onClick:()=>void r(`allow`),children:[`Allow`,(0,Q.jsx)(Ie,{size:14})]})]})]}),(0,Q.jsxs)(`div`,{className:`webchat-composer-box${i?` drag-over`:``}`,onDragOver:a,onDragLeave:o,onDrop:c,children:[(0,Q.jsx)(`input`,{ref:u,type:`file`,multiple:!0,accept:d,style:{display:`none`},onChange:f}),p&&(0,Q.jsx)(`div`,{className:`webchat-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize input — drag up to enlarge`,tabIndex:0,onPointerDown:m,onKeyDown:v}),b.length>0&&(0,Q.jsx)(`div`,{className:`attachment-strip`,children:b.map((e,t)=>(0,Q.jsxs)(`div`,{className:`attachment-chip`,children:[x[t]?(0,Q.jsx)(`img`,{src:x[t]??void 0,alt:e.name,className:`attachment-chip-thumb`}):e.type.startsWith(`audio/`)?(0,Q.jsx)(ue,{size:14}):e.type===`application/pdf`?(0,Q.jsx)(y,{size:14}):(0,Q.jsx)(_,{size:14}),(0,Q.jsx)(`span`,{className:`attachment-chip-name`,children:e.name}),(0,Q.jsx)(`button`,{type:`button`,className:`attachment-chip-remove`,onClick:()=>S(t),"aria-label":`Remove ${e.name}`,children:`×`})]},t))}),w&&(0,Q.jsx)(`p`,{className:`attach-error`,children:w}),T&&(0,Q.jsx)(`p`,{className:`webchat-send-error`,role:`alert`,children:T}),j&&(0,Q.jsxs)(`p`,{className:`webchat-dead-child-notice`,role:`status`,children:[(0,Q.jsx)(Ae,{size:14,"aria-hidden":!0}),` `,j]}),E&&(0,Q.jsxs)(`p`,{className:`webchat-transcribing`,role:`status`,"aria-live":`polite`,children:[(0,Q.jsx)(l,{size:14,className:`webchat-transcribing-spin`}),`Transcribing audio…`]}),D.state===`error`&&D.errorMessage&&(0,Q.jsxs)(`p`,{className:`voice-error`,role:`alert`,children:[(0,Q.jsx)(ue,{size:14}),D.errorMessage]}),O?(0,Q.jsx)(`div`,{className:`webchat-input-row voice-active`,children:(0,Q.jsx)(ed,{state:D.state,elapsedSeconds:D.elapsedSeconds,waveform:D.waveform,onTogglePause:D.togglePause,onDiscard:D.discard,onSend:()=>void k()})}):(0,Q.jsxs)(`div`,{className:`webchat-input-row`,children:[(0,Q.jsx)(`textarea`,{ref:ne,className:`webchat-input`,value:ee,placeholder:ie,rows:2,style:{height:`${A}px`},disabled:re,onChange:te,onKeyDown:ae,onPaste:oe}),le?(0,Q.jsx)(`button`,{type:`button`,className:`webchat-send webchat-stop${fe?` is-stopping`:``}`,onPointerDown:I,onClick:()=>void de?.(),disabled:fe,"aria-label":fe?`Stopping`:`Stop`,title:fe?`Stopping…`:`Stop generating`,children:fe?(0,Q.jsx)(l,{size:16,className:`webchat-stop-spin`}):(0,Q.jsx)(h,{size:16})}):ee.trim().length===0&&b.length===0?(0,Q.jsx)(`button`,{type:`button`,className:`webchat-send webchat-mic-inline`,onPointerDown:I,onClick:()=>void Re(),disabled:ze,"aria-label":`Voice input`,title:`Record voice note`,children:(0,Q.jsx)(ue,{size:16})}):(0,Q.jsx)(`button`,{type:`button`,className:`webchat-send`,onPointerDown:I,onClick:()=>void se(),disabled:ce,"aria-label":`Send`,title:`Send`,children:(0,Q.jsx)(Ie,{size:16})})]}),me!==null&&(0,Q.jsxs)(`p`,{className:`webchat-conflict-hint`,children:[`This session is bound to the `,me,` channel — message it there. The transcript stays readable here.`]})]}),(0,Q.jsxs)(`div`,{className:`webchat-controls`,children:[(0,Q.jsxs)(`div`,{className:`webchat-controls-left`,children:[_e&&(0,Q.jsxs)(`div`,{className:`webchat-newsession`,ref:ve,children:[(0,Q.jsx)(`button`,{type:`button`,className:`webchat-control`,onPointerDown:I,onClick:be,disabled:xe,"aria-haspopup":`menu`,"aria-expanded":ye,title:`New session`,"aria-label":`New session`,children:(0,Q.jsx)(g,{size:14})}),ye&&(0,Q.jsx)(`div`,{className:`webchat-newsession-panel`,role:`menu`,children:(0,Q.jsx)(od,{newModel:Se,onPickModel:Ce,newEffort:we,onPickEffort:Te,onNewSession:Ee,newSessionPending:Oe,newPermMode:ke,onPickPermMode:Me})})]}),(0,Q.jsx)(`button`,{type:`button`,className:`webchat-control`,onPointerDown:I,onClick:Ne,disabled:Pe,title:`Attach files`,"aria-label":`Attach`,children:(0,Q.jsx)(C,{size:14})}),(0,Q.jsxs)(`div`,{className:`webchat-mic-split`,ref:Fe,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-control webchat-mic-chevron`,onPointerDown:I,onClick:Ve,disabled:ze,"aria-haspopup":`menu`,"aria-expanded":He,title:`Choose microphone`,"aria-label":`Choose microphone`,children:[(0,Q.jsx)(ue,{size:14}),(0,Q.jsx)(pe,{size:12})]}),He&&(0,Q.jsxs)(`div`,{className:`webchat-mic-panel`,role:`menu`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-mic-item`,role:`menuitemradio`,"aria-checked":We===null,onClick:()=>Ge(null,`System default`),children:[(0,Q.jsx)(`span`,{children:`System default`}),We===null&&(0,Q.jsx)(s,{size:13})]}),Ue.filter(e=>e.label).map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-mic-item`,role:`menuitemradio`,"aria-checked":e.deviceId===We,onClick:()=>Ge(e.deviceId,e.label||`Microphone ${t+1}`),children:[(0,Q.jsx)(`span`,{children:e.label}),e.deviceId===We&&(0,Q.jsx)(s,{size:13})]},e.deviceId)),Ue.filter(e=>e.label).length===0&&(0,Q.jsx)(`span`,{className:`webchat-mic-hint`,children:`Allow microphone access to choose a device`})]})]}),Ke&&(0,Q.jsx)(`button`,{type:`button`,className:`webchat-control webchat-clean-toggle`,onPointerDown:I,onClick:Je,"aria-pressed":!qe,"aria-label":`Show tool calls and thinking`,title:qe?`Showing delivered messages only — click to show tool calls, results, and thinking`:`Showing tool calls, results, and thinking — click to show delivered messages only`,children:qe?(0,Q.jsx)(td,{size:14}):(0,Q.jsx)(je,{size:14})})]}),Ye&&(0,Q.jsxs)(`div`,{className:`webchat-controls-right`,children:[N&&(0,Q.jsx)(`code`,{className:`webchat-session-id`,title:`First 8 characters of this session's id — matches the Sessions list.`,children:N.slice(0,8)}),(Xe||Ze||Qe)&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`webchat-params webchat-params--inline`,"aria-label":`Session parameters`,children:[Xe&&(0,Q.jsx)(`span`,{className:`webchat-param`,children:sd[Xe]??Xe}),Ze&&(0,Q.jsx)(`span`,{className:`webchat-param`,children:cd(Ze)}),Qe&&(0,Q.jsx)(`span`,{className:`webchat-param`,children:nd[Qe]??Qe})]}),(0,Q.jsxs)(`div`,{className:`webchat-params-menu`,ref:$e,children:[(0,Q.jsx)(`button`,{type:`button`,className:`webchat-control webchat-params-trigger`,onPointerDown:I,"aria-haspopup":`menu`,"aria-expanded":et,"aria-label":`Session parameters`,title:`Session parameters`,onClick:F,children:(0,Q.jsx)(he,{size:14})}),et&&(0,Q.jsxs)(`div`,{className:`webchat-params-panel`,role:`menu`,children:[Xe&&(0,Q.jsxs)(`span`,{className:`webchat-param`,role:`menuitem`,children:[(0,Q.jsx)(Be,{size:13,"aria-hidden":`true`}),sd[Xe]??Xe]}),Ze&&(0,Q.jsxs)(`span`,{className:`webchat-param`,role:`menuitem`,children:[(0,Q.jsx)(De,{size:13,"aria-hidden":`true`}),cd(Ze)]}),Qe&&(0,Q.jsxs)(`span`,{className:`webchat-param`,role:`menuitem`,children:[(0,Q.jsx)(Le,{size:13,"aria-hidden":`true`}),nd[Qe]??Qe]}),N&&(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-param webchat-session-id-full${tt?` is-copied`:``}`,role:`menuitem`,title:`Long-press to copy the full session id`,"aria-label":tt?`Session id copied`:`Session id — long-press to copy`,onPointerDown:z,onPointerUp:B,onPointerLeave:B,onContextMenu:e=>e.preventDefault(),children:[tt?(0,Q.jsx)(s,{size:13,"aria-hidden":`true`}):(0,Q.jsx)(M,{size:13,"aria-hidden":`true`}),(0,Q.jsx)(`code`,{children:tt?`Copied`:N})]}),P&&(0,Q.jsxs)(`span`,{className:`webchat-param`,role:`menuitem`,children:[(0,Q.jsx)(ge,{size:13,"aria-hidden":`true`}),P.pct,`% · `,ld(P.usedTokens),`/`,ld(P.window)]})]})]})]}),P&&(0,Q.jsx)(ud,{pct:P.pct,usedTokens:P.usedTokens,window:P.window})]})]})]})}function fd(e,t){return(t??{}).deadChild===!0?`dead-child`:e===200?`ok`:`failed`}function pd(e,t){if(e)return null;try{return new URLSearchParams(t).get(`session`)}catch{return null}}function md(e){return typeof e!=`number`||!Number.isFinite(e)?``:new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function hd({s:e,onOpen:t,onRename:n,onArchive:r,onDelete:i,onEnd:a,onCopyId:o}){let[l,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,y]=(0,$.useState)(!1),b=(0,$.useRef)(!1),x=()=>{f(!1),y(!1)},S=()=>{_(e.name||``),m(!0),f(!1)},C=()=>{if(m(!1),b.current){b.current=!1;return}g.trim()!==(e.name||``)&&n(e,g)};return p?(0,Q.jsx)(`div`,{className:`op-conv-rename`,children:(0,Q.jsx)(`input`,{className:`op-conv-rename-input`,autoFocus:!0,onFocus:e=>e.currentTarget.select(),value:g,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`?C():e.key===`Escape`&&(b.current=!0,m(!1))},onBlur:C,placeholder:`Conversation name`,"aria-label":`Conversation name`})}):(0,Q.jsxs)(`div`,{className:`op-conv-rowwrap`,"aria-current":e.active?`true`:void 0,children:[(0,Q.jsxs)(`div`,{className:`op-conv-row-inner`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-resume`,onClick:()=>t(e),children:[(0,Q.jsxs)(`span`,{className:`op-conv-line1`,children:[e.active?(0,Q.jsx)(`span`,{className:`op-conv-current`,"aria-label":`Current session`,children:(0,Q.jsx)(s,{size:14})}):null,(0,Q.jsx)(`span`,{className:`op-conv-name`,children:e.name||`New conversation`})]}),(0,Q.jsxs)(`span`,{className:`op-conv-line2`,children:[(0,Q.jsx)(`span`,{className:`op-conv-when`,children:md(e.lastActiveMs)}),(0,Q.jsx)(`code`,{className:`op-conv-id`,title:e.id,children:e.id})]})]}),(0,Q.jsx)(`button`,{type:`button`,className:`op-conv-copy`,"aria-label":`Copy session id`,title:`Copy session id`,onClick:()=>o(e),children:(0,Q.jsx)(M,{size:14})}),(0,Q.jsx)(`button`,{type:`button`,className:`op-conv-kebab`,"aria-label":l?`Close actions`:`Conversation actions`,"aria-expanded":l,onClick:()=>l?x():f(!0),children:l?(0,Q.jsx)(d,{size:16}):(0,Q.jsx)(he,{size:16})})]}),l?(0,Q.jsxs)(`div`,{className:`op-conv-actions`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action`,onClick:S,children:[(0,Q.jsx)(c,{size:13}),` Rename`]}),e.active?(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action`,onClick:()=>{a(e),x()},children:[(0,Q.jsx)(h,{size:13}),` End session`]}):null,e.active?null:e.archived?(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action`,onClick:()=>{r(e,!1),x()},children:[(0,Q.jsx)(Ee,{size:13}),` Unarchive`]}):(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action`,onClick:()=>{r(e,!0),x()},children:[(0,Q.jsx)(Te,{size:13}),` Archive`]}),e.active?null:v?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action danger`,onClick:()=>{i(e),x()},children:[(0,Q.jsx)(u,{size:13}),` Confirm`]}),(0,Q.jsx)(`button`,{type:`button`,className:`op-conv-action`,onClick:()=>y(!1),children:`Cancel`})]}):(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-action danger`,onClick:()=>y(!0),children:[(0,Q.jsx)(u,{size:13}),` Delete`]})]}):null]})}function gd({sessions:e,onOpen:t,onRename:n,onArchive:r,onDelete:i,onEnd:a,onNew:o,onBack:s,onCopyId:c}){let[l,u]=(0,$.useState)(!1),f=e.filter(e=>!e.archived),p=e.filter(e=>e.archived),m={onOpen:t,onRename:n,onArchive:r,onDelete:i,onEnd:a,onCopyId:c};return(0,Q.jsxs)(`div`,{className:`op-conv`,style:{flex:1,minHeight:0,position:`relative`},children:[(0,Q.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,Q.jsx)(`span`,{className:`op-conv-title`,children:`Conversations`}),(0,Q.jsx)(`button`,{type:`button`,className:`op-conv-close`,onClick:s,"aria-label":`Close conversations`,title:`Close`,children:(0,Q.jsx)(d,{size:16})})]}),(0,Q.jsx)(`div`,{className:`op-conv-list`,style:{flex:1,minHeight:0},children:e.length===0?(0,Q.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No conversations yet`}):(0,Q.jsxs)(Q.Fragment,{children:[f.map(e=>(0,Q.jsx)(hd,{s:e,...m},e.id)),p.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-archived-head`,"aria-expanded":l,onClick:()=>u(e=>!e),children:[(0,Q.jsx)(Oe,{size:14,style:{transform:l?`rotate(-90deg)`:`rotate(180deg)`,transition:`transform 0.12s`}}),`Archived (`,p.length,`)`]}),l?p.map(e=>(0,Q.jsx)(hd,{s:e,...m},e.id)):null]}):null]})}),(0,Q.jsxs)(`button`,{type:`button`,className:`op-conv-new op-conv-new-float`,onClick:o,children:[(0,Q.jsx)(g,{size:14}),` New session`]})]})}var _d=2500,vd=15e3,yd=[{id:`catch-up`,label:`Catch me up`,Icon:Re,prompt:`Catch me up — what came in across my inbox and WhatsApp while I was away, and what needs a reply?`},{id:`my-day`,label:`My day`,Icon:Pe,prompt:`What does my day look like — calendar, anything I need to prep for, and is there a free slot this afternoon?`},{id:`to-do`,label:`To-do`,Icon:ye,prompt:`What is still open and on me — pull together my outstanding tasks: unanswered messages, emails awaiting a reply, follow-ups I have asked you to track, and anything due soon.`}];function bd({userName:e,variant:t,onChip:n}){let r=e?.trim().split(/\s+/)[0];return(0,Q.jsxs)(`div`,{className:`webchat-greeting`,children:[(0,Q.jsx)(`h2`,{className:`webchat-greeting-head`,children:r?`What's up next, ${r}?`:`What's up next?`}),t!==`public`&&(0,Q.jsx)(`div`,{className:`webchat-greeting-chips`,children:yd.map(({id:e,label:t,Icon:r,prompt:i})=>(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-greeting-chip`,onClick:()=>n({id:e,prompt:i}),children:[(0,Q.jsx)(r,{size:16}),` `,t]},e))})]})}function xd({cacheKey:e,userName:t,targetSessionId:n,variant:r=`admin`,conversationsOpen:i=!1,onCloseConversations:a,cleared:s=!1,onFirstSend:c,switchId:u=null}){let d=r===`public`,p=d,[h,g]=(0,$.useState)(!0),[_,y]=(0,$.useState)(!1),[x,S]=(0,$.useState)(null),C=(0,$.useRef)(null),[w,T]=(0,$.useState)(null),[E,D]=(0,$.useState)(``),O=(0,$.useRef)(null),k=(0,$.useRef)(!1),ee=(0,$.useRef)(null),[te,A]=(0,$.useState)(0),[re,se]=(0,$.useState)(!1),[ce,ue]=(0,$.useState)(0),de=ce>0,[fe,pe]=(0,$.useState)(!1),[j,me]=(0,$.useState)(null),[he,ge]=(0,$.useState)(null),ve=(0,$.useRef)(!1),[ye,be]=(0,$.useState)(!1);(0,$.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(pointer: coarse)`);be(e.matches);let t=e=>be(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let[Ce,we]=(0,$.useState)(0),Te=(0,$.useRef)(0),Ee=(0,$.useCallback)(e=>{Te.current=e,we(e)},[]),[De,Oe]=(0,$.useState)(null),[M,ke]=(0,$.useState)([]),[Ae,je]=(0,$.useState)(null),[Me,Ne]=(0,$.useState)(!1),Pe=(0,$.useRef)(null),Fe=()=>Math.round((typeof window>`u`?900:window.innerHeight)/3),[Ie,Le]=(0,$.useState)(null),Re=(0,$.useRef)(null),ze=(0,$.useRef)(null),Be=(0,$.useRef)(null),Ue=(0,$.useCallback)(e=>{let t=Be.current;t&&Le(Math.min(Fe(),Math.max(44,t.startH+(t.startY-e.clientY))))},[]),We=(0,$.useCallback)(()=>{Be.current=null,window.removeEventListener(`pointermove`,Ue),window.removeEventListener(`pointerup`,We)},[Ue]),Ke=(0,$.useCallback)(e=>{Be.current={startY:e.clientY,startH:Re.current?.offsetHeight??44},window.addEventListener(`pointermove`,Ue),window.addEventListener(`pointerup`,We),e.preventDefault()},[Ue,We]),qe=(0,$.useCallback)(e=>{let t=Ie??Re.current?.offsetHeight??44;e.key===`ArrowUp`?(e.preventDefault(),Le(Math.min(Fe(),t+24))):e.key===`ArrowDown`&&(e.preventDefault(),Le(Math.max(44,t-24)))},[Ie]),[Je,Ye]=(0,$.useState)(null);(0,$.useEffect)(()=>{if(Ie!==null)return;let e=Re.current;if(!e)return;let t=e.style.height;e.style.height=`auto`;let n=Math.min(Fe(),Math.max(44,e.scrollHeight));e.style.height=t,Ye(n)},[E,Ie]),(0,$.useLayoutEffect)(()=>{if(ze.current===null)return;let e=Re.current;if(!e)return;let t=ze.current;ze.current=null,e.setSelectionRange(t,t)},[E]);let N=f(e),[Xe,Ze]=(0,$.useState)(!1),[Qe,P]=(0,$.useState)(Se),[$e,et]=(0,$.useState)(`medium`),[F,I]=(0,$.useState)(!1),tt=(0,$.useRef)(null);(0,$.useEffect)(()=>{if(!Xe)return;let e=e=>{tt.current?.contains(e.target)||Ze(!1)},t=e=>{e.key===`Escape`&&Ze(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[Xe]);let L=(0,$.useCallback)(async()=>{if(!F){I(!0);try{let e=await N(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({model:Qe,effort:$e})}),t=await e.json().catch(()=>({})),n=xe(e.ok,e.status,t);console.info(`[admin-ui] composer-new-session status=${e.status} outcome=${n.kind} model=${Qe} effort=${$e}`),n.kind===`navigate`?n.sameOrigin?window.location.assign(n.url):(window.open(n.url,`_blank`),Ze(!1)):e.status===503||n.reason===`claude-auth-dead`?(console.info(`[admin-ui] op=llm-action-blocked action=spawn reason=claude-disconnected`),Ze(!1),y(!0)):console.error(`[admin-ui] composer-new-session-failed status=${e.status} reason=${n.reason}`)}catch(e){console.error(`[admin-ui] composer-new-session-failed error=${e instanceof Error?e.message:String(e)}`)}finally{I(!1)}}},[N,Qe,$e,F]),R=!d,[nt,z]=(0,$.useState)([]),[B,rt]=(0,$.useState)(!1),V=(0,$.useRef)(0),it=(0,$.useRef)(!1);(0,$.useEffect)(()=>(it.current=!1,()=>{it.current=!0}),[]);let at=(0,$.useCallback)(async()=>{if(!R)return;let e=++V.current;try{let t=await N(`/api/admin/sidebar-sessions`);if(!t.ok){console.error(`[chat-conversations] op=enumerate-failed status=${t.status}`);return}let n=((await t.json()).sessions??[]).filter(e=>e.channel!==`whatsapp`&&e.channel!==`telegram`).map(e=>({id:e.sessionId,name:e.title,active:e.live,archived:!!e.archived,lastActiveMs:Number.isFinite(Date.parse(e.startedAt))?Date.parse(e.startedAt):null})).sort((e,t)=>(t.lastActiveMs??0)-(e.lastActiveMs??0));if(it.current||e!==V.current)return;z(n),rt(!0),console.info(`[chat-conversations] op=enumerate owned=${n.length}`)}catch(e){console.error(`[chat-conversations] op=enumerate-failed error=${e instanceof Error?e.message:String(e)}`)}},[N,R]);(0,$.useEffect)(()=>{at()},[at]),(0,$.useEffect)(()=>{i&&at()},[i,at]);let ot=(0,$.useCallback)(async(e,t,n,r)=>{console.info(`[chat-conversations] op=action name=${e} sessionId=${t.id.slice(0,8)}`);try{let t=await N(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!t.ok){console.error(`[chat-conversations] op=action-failed name=${e} status=${t.status}`);return}at()}catch(t){console.error(`[chat-conversations] op=action-failed name=${e} error=${t instanceof Error?t.message:String(t)}`)}},[N,at]),st=(0,$.useCallback)(e=>{console.info(`[chat-conversations] op=action name=open sessionId=${e.id.slice(0,8)}`),window.location.assign(`/chat?session=${encodeURIComponent(e.id)}`)},[]),ct=(0,$.useCallback)((e,t)=>{ot(`rename`,e,`/api/admin/session-rename`,{sessionId:e.id,title:t.trim()})},[ot]),lt=(0,$.useCallback)((e,t)=>{ot(`archive`,e,`/api/admin/session-archive`,{sessionId:e.id,mode:t?`archive`:`unarchive`})},[ot]),ut=(0,$.useCallback)(e=>{ot(`delete`,e,`/api/admin/session-delete`,{sessionId:e.id})},[ot]),dt=(0,$.useCallback)(e=>{ot(`stop`,e,`/api/admin/session-stop`,{sessionId:e.id})},[ot]),ft=(0,$.useCallback)(e=>{m(e.id)},[]),pt=(0,$.useCallback)(e=>{je(null);let t=e.find(e=>!ie(e.type,v));if(t){je(`Unsupported file type: "${t.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, zip, voice notes.`);return}let n=e.find(e=>e.size>b);if(n){je(`"${n.name}" exceeds the 50 MB limit.`);return}ke(t=>[...t,...e].slice(0,5))},[]),mt=(0,$.useMemo)(()=>M.map(e=>e.type.startsWith(`image/`)?URL.createObjectURL(e):null),[M]);(0,$.useEffect)(()=>()=>{for(let e of mt)e&&URL.revokeObjectURL(e)},[mt]);let ht=ne(),gt=ht.state===`recording`||ht.state===`paused`||ht.state===`sending`,_t=(0,$.useCallback)(async()=>{let t=await ht.send();if(!t)return;let r=t.type===`audio/ogg`?`.ogg`:t.type===`audio/mp4`?`.m4a`:`.webm`,i=new File([t],`voice-note${r}`,{type:t.type});if(re){ke(e=>[...e,i].slice(0,5));return}se(!0);let a=new FormData;if(d){a.append(`message`,``),a.append(`session_key`,w??``);let e=Yu();e&&a.append(`agent`,e)}else a.append(`text`,``);a.append(`attachments`,i),!d&&n&&a.append(`session`,n);try{let t=d?await fetch(`/api/chat`,{method:`POST`,body:a}):await fetch(`/api/webchat/send?session_key=${encodeURIComponent(e)}`,{method:`POST`,body:a});t.ok||(console.error(`[admin-ui] webchat-send-failed kind=voice status=${t.status}`),ke(e=>[...e,i].slice(0,5)),je(`Voice note failed to send. The recording is attached — press send to retry.`))}catch(e){console.error(`[admin-ui] webchat-send-failed kind=voice error=${e instanceof Error?e.message:String(e)}`),ke(e=>[...e,i].slice(0,5)),je(`Voice note failed to send. The recording is attached — press send to retry.`)}finally{se(!1)}},[ht,e,n,re,d,w]),vt=(0,$.useRef)(!1);(0,$.useEffect)(()=>(vt.current=!1,()=>{vt.current=!0}),[]);let yt=(0,$.useRef)(!1),bt=(0,$.useCallback)(async()=>{if(yt.current)return null;yt.current=!0;try{if(d){let e=Yu(),t=await fetch(`/api/public-reader/session${e?`?agent=${encodeURIComponent(e)}`:``}`);if(!t.ok)return null;let n=await t.json();if(vt.current)return null;T(n.sessionKey);let r={sessionId:n.sessionId??``,projectDir:n.projectDir};return C.current=r,S(r),r}let t=`session_key=${encodeURIComponent(e)}${n?`&session=${encodeURIComponent(n)}`:``}`,r=await fetch(`/api/webchat/session?${t}`);if(!r.ok)return null;let i=await r.json();return vt.current?i:(C.current=i,S(i),i)}catch{return null}finally{yt.current=!1}},[e,n,d]);(0,$.useEffect)(()=>{bt();let e=setInterval(()=>{bt()},_d);return()=>clearInterval(e)},[bt]),(0,$.useEffect)(()=>{if(d)return;let e=!1,t=async()=>{try{let t=await fetch(`/api/health`);if(!t.ok)return;let n=await t.json();e||g(n.auth_status!==`dead`&&n.auth_status!==`missing`)}catch{}};t();let n=setInterval(t,6e4);return()=>{e=!0,clearInterval(n)}},[d]);let xt=(0,$.useCallback)(async()=>{let t=E.trim();if(!t&&M.length===0||re)return!1;if(!d&&!h)return console.info(`[admin-ui] op=llm-action-blocked action=send reason=claude-disconnected`),y(!0),!1;se(!0),ve.current=!1;try{if(d){let e=w;if(!e)return console.error(`[public-webchat] op=send-skip reason=no-key`),!1;let n,r=Yu();if(M.length>0){let i=new FormData;i.append(`message`,t),i.append(`session_key`,e),r&&i.append(`agent`,r);for(let e of M)i.append(`attachments`,e);n=await fetch(`/api/chat`,{method:`POST`,body:i})}else n=await fetch(`/api/chat`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({message:t,session_key:e,...r?{agent:r}:{}})});return n.ok?(D(``),ke([]),je(null),!0):(console.error(`[public-webchat] op=send-failed status=${n.status}`),!1)}M.some(e=>Ge(e.type))&&(pe(!0),console.info(`[admin-ui] op=transcribe-indicator state=show`));let r=s&&!n,i;if(M.length>0){let a=new FormData;a.append(`text`,t);for(let e of M)a.append(`attachments`,e);n&&a.append(`session`,n),r&&a.append(`clearSignal`,`true`),i=await fetch(`/api/webchat/send?session_key=${encodeURIComponent(e)}`,{method:`POST`,body:a})}else i=await fetch(`/api/webchat/send?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:t,...n?{session:n}:{},...r?{clearSignal:!0}:{}})});if(i.ok)return je(null),ge(null),Kt(!1),Jt(null),c?.(),ve.current=!0,me({baselineSize:C.current?.sizeBytes??null,baselineTurns:Te.current,text:t,files:M}),D(``),ke([]),!0;i.status===409?console.error(`[admin-ui] webchat-send-refused reason=channel-conflict`):console.error(`[admin-ui] webchat-send-failed status=${i.status}`)}catch(e){console.error(`[admin-ui] webchat-send-failed error=${e instanceof Error?e.message:String(e)}`)}finally{ve.current||se(!1),M.some(e=>Ge(e.type))&&console.info(`[admin-ui] op=transcribe-indicator state=clear`),pe(!1)}return!1},[E,re,e,M,n,d,h,w,c,s]);(0,$.useEffect)(()=>{if(!d||k.current||!w)return;let e=Zu(),t=`url`;if(!e)try{let n=sessionStorage.getItem(Xu);n&&n.trim()&&(e=n.trim().slice(0,2e3),t=`storage`)}catch{}if(!e){new URLSearchParams(window.location.search).has(`q`)&&qu&&console.info(`[public-webchat] op=seed-skip reason=empty`),k.current=!0;return}if(qu&&console.info(`[public-webchat] op=seed-detected source=${t} len=${e.length} head=${e.slice(0,40)}`),t===`storage`&&qu&&console.info(`[public-webchat] op=seed-restored source=storage len=${e.length}`),E!==``){qu&&console.info(`[public-webchat] op=seed-skip reason=composer-dirty`),k.current=!0;return}O.current=e,D(e)},[d,w]),(0,$.useEffect)(()=>{let e=O.current;if(!(!e||E!==e||!w||k.current)){k.current=!0,O.current=null;try{let e=new URL(window.location.href);e.searchParams.delete(`q`),window.history.replaceState({},``,e.pathname+e.search+e.hash)}catch{}try{sessionStorage.removeItem(Xu)}catch{}qu&&console.info(`[public-webchat] op=seed-sent key=${w} len=${e.length}`),xt().then(e=>{e||console.error(`[public-webchat] op=seed-send-failed`)})}},[E,w,xt]);let St=(0,$.useCallback)(e=>{console.info(`[admin-ui] op=chip-tap id=${e.id} chars=${e.prompt.length}`),ee.current=e.prompt,D(e.prompt),A(e=>e+1)},[]);(0,$.useEffect)(()=>{let e=ee.current;!e||E!==e||(ee.current=null,xt().then(e=>{e||console.error(`[admin-ui] op=chip-send-failed`)}))},[te,E,xt]);let Ct=(0,$.useCallback)(async()=>{Wt(!0),ue(e=>e+1);let t=x?.sessionId??n??void 0;try{let n=await fetch(`/api/webchat/interrupt?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t?{session:t}:{})}),r=await n.json().catch(()=>({}));fd(n.status,r)===`dead-child`&&(Kt(!0),Wt(!1),Jt(`The agent stopped. Send a message to resume.`),console.log(`[admin-ui] op=stop-dead-child sessionId=${(t??``).slice(0,8)}`))}catch(e){console.error(`[admin-ui] webchat-stop-failed error=${e instanceof Error?e.message:String(e)}`)}finally{ue(e=>e-1)}},[e,x?.sessionId,n]),wt=(0,$.useCallback)(e=>{if(e.key===`Enter`&&!e.shiftKey&&!ye){e.preventDefault(),xt();return}if(e.key===`Enter`){let t=e.currentTarget,n=Ve(t.value,t.selectionStart,t.selectionEnd);n&&(e.preventDefault(),ze.current=n.caret,D(n.value));return}},[xt,ye]),Tt=(0,$.useMemo)(()=>{if(!j)return null;let e=x?.sizeBytes;return e!=null&&(j.baselineSize==null||e>j.baselineSize)?`pointer`:Ce>j.baselineTurns?`transcript`:null},[j,x?.sizeBytes,Ce]),Et=Tt!==null;(0,$.useEffect)(()=>{!j||!Tt||(console.info(`[admin-ui] op=send-confirmed via=${Tt} baselineSize=${j.baselineSize??`absent`} baselineTurns=${j.baselineTurns}`),ge(null),me(null),ve.current=!1,se(!1))},[j,Tt]),(0,$.useEffect)(()=>{if(!j)return;let e=setTimeout(()=>{D(j.text),ke(e=>[...j.files,...e].slice(0,5)),me(null),ve.current=!1,se(!1),ge(`Couldn't be delivered — press send to retry.`)},vd);return()=>clearTimeout(e)},[j]);let Dt=n?x?.channelBinding??null:null,Ot=(0,$.useRef)(!1);(0,$.useEffect)(()=>{!n||Ot.current||!x||(Ot.current=!0,console.warn(`[admin-ui] chat-session-target sessionId=${n} jsonl=${x.projectDir?`found`:`missing`} known=${x.known===!0}`))},[x,n]);let kt=(0,$.useRef)(!1);(0,$.useEffect)(()=>{n||kt.current||!x?.sessionId||(kt.current=!0,console.info(`[admin-ui] chat-session-resolve sessionId=${x.sessionId.slice(0,8)} source=canonical`))},[x,n]);let H=s?null:x,At=H?H.effectivePermissionMode??H.permissionMode??null:null,jt=H?.model??null,Mt=H?.activity===`busy`,Nt=(0,$.useRef)(!1);(0,$.useEffect)(()=>{if(!s||Nt.current||!x)return;Nt.current=!0;let e=x.sessionId?x.sessionId.slice(0,8):`none`;console.info(`[sub-account] op=post-switch-pointer switchId=${u?u.slice(0,8):`none`} source=${x.source??`unknown`} shown=${e}`)},[s,x,u]);let[Pt,Ft]=(0,$.useState)(()=>{if(typeof window>`u`)return!1;try{return window.localStorage.getItem(`maxy:whatsapp-reader:clean-view`)===`1`}catch{return!1}}),It=(0,$.useCallback)(()=>{Ft(e=>{let t=!e;try{window.localStorage.setItem(`maxy:whatsapp-reader:clean-view`,t?`1`:`0`)}catch{}return t})},[]),Lt=(0,$.useMemo)(()=>d?(e,t,n)=>Ku(e,t,n,`public`):(e,t,n)=>Ku(e,t,n,`admin`,r===`admin`?Pt:!0),[d,Pt,r]),U=(0,$.useMemo)(()=>!d&&j&&!Et?(0,Q.jsx)(Gu,{text:j.text,filenames:j.files.map(e=>e.name)}):null,[d,j,Et]),Rt=(0,$.useMemo)(()=>{if(d)return null;let e=Mt?(0,Q.jsx)(Lu,{activity:De,turnCount:Ce}):null;return!U&&!e?null:(0,Q.jsxs)(Q.Fragment,{children:[U,e]})},[d,Mt,De,Ce,U]),zt=(0,$.useMemo)(()=>{try{return new URLSearchParams(window.location.search).get(`diag`)===`composer`}catch{return!1}},[]),Bt=(0,$.useRef)(null),Vt=(0,$.useRef)(0),Ht=(0,$.useCallback)((e,t,n)=>{let r=Bt.current;r&&console.info(`[diag:composer] keystroke #${r.seq} reconciled transcript — phase=${t} actualDuration=${n.toFixed(2)}ms latency=${(performance.now()-r.t0).toFixed(2)}ms`)},[]),[Ut,Wt]=(0,$.useState)(!1);(0,$.useEffect)(()=>{Mt||Wt(!1)},[Mt]);let[Gt,Kt]=(0,$.useState)(!1),[qt,Jt]=(0,$.useState)(null);(0,$.useEffect)(()=>{H?.turnAborted?Gt||(Kt(!0),Jt(`The agent stopped. Send a message to resume.`),console.log(`[admin-ui] op=phantom-turn-cleared sessionId=${(H.sessionId??``).slice(0,8)}`)):Mt&&(Gt||qt!==null)&&(Kt(!1),Jt(null))},[H?.turnAborted,H?.sessionId,Mt,Gt,qt]);let[Yt,Xt]=(0,$.useState)(!1),Zt=(0,$.useRef)(null);(0,$.useEffect)(()=>{if(!Yt)return;let e=e=>{Zt.current?.contains(e.target)||Xt(!1)},t=e=>{e.key===`Escape`&&Xt(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[Yt]);let[Qt,$t]=(0,$.useState)(()=>{try{return window.localStorage.getItem(`maxy:webchat:mic-device-id`)}catch{return null}}),[en,tn]=(0,$.useState)([]),[nn,rn]=(0,$.useState)(!1),an=(0,$.useRef)(null);(0,$.useEffect)(()=>{if(!nn)return;let e=e=>{an.current?.contains(e.target)||rn(!1)},t=e=>{e.key===`Escape`&&rn(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[nn]);let on=(0,$.useCallback)(async()=>{rn(e=>!e),tn(await oe())},[]),sn=(0,$.useCallback)((e,t)=>{$t(e);try{e?window.localStorage.setItem(`maxy:webchat:mic-device-id`,e):window.localStorage.removeItem(`maxy:webchat:mic-device-id`)}catch{}console.info(`[admin-ui] mic-device-selected`,t),rn(!1)},[]),cn=(0,$.useCallback)(async t=>{let n=x?.pendingPermissionPrompt;if(!(!n||!x?.sessionId))try{await fetch(`/api/webchat/permission-verdict?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:x.sessionId,request_id:n.requestId,behavior:t})})}catch(e){console.error(`[admin-ui] permission-verdict-failed error=${e instanceof Error?e.message:String(e)}`)}},[e,x?.sessionId,x?.pendingPermissionPrompt]),ln=(0,$.useRef)(!1);return(0,$.useEffect)(()=>{ln.current||x?.projectDir&&x.activity==null&&At==null&&jt==null&&(ln.current=!0,console.warn(`[admin-ui] composer-indicators-unavailable sessionId=${x.sessionId} (manager meta unreadable or pre-activity)`))},[x,At,jt]),(0,$.useEffect)(()=>{console.info(`[admin-ui] chat-render variant=${r} isPublic=${d} deliveredOnly=${p} model=${jt??`null`} audience=${d?`public`:`admin`}`)},[r,d,p,jt]),(0,Q.jsxs)(`div`,{className:`webchat-page`,children:[de?(0,Q.jsx)(`div`,{className:`interrupt-overlay`,role:`status`,"aria-live":`polite`,children:(0,Q.jsxs)(`div`,{className:`interrupt-modal`,children:[(0,Q.jsx)(l,{className:`spin interrupt-spinner`,size:28,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`interrupt-label`,children:`Interruption in progress…`})]})}):null,x?.projectDir&&!s?(()=>{let t=(0,Q.jsx)(ae,{resetKey:x.sessionId,sessionId:x.transcriptSessionId??x.sessionId,projectDir:x.projectDir,sessionKey:d?w??``:e,renderItems:Lt,clean:r===`admin`?Pt:void 0,onToggleClean:r===`admin`?It:void 0,forceDeliveredOnly:p,streamEndpoint:d?`/api/public-reader/stream`:`/api/whatsapp-reader/stream`,suppressDirectives:d,tail:Rt,onTurnsChange:d?void 0:Ee,onActivityChange:d?void 0:Oe},x.sessionId);return zt?(0,Q.jsx)($.Profiler,{id:`chat-transcript`,onRender:Ht,children:t}):t})():R&&!n&&B&&nt.length===0&&x?.known===!1?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`webchat-conv-splash`,"data-testid":`conversations-splash`,children:[(0,Q.jsx)(`img`,{src:o,alt:``,className:`webchat-conv-splash-logo`}),(0,Q.jsxs)(`button`,{type:`button`,className:`webchat-conv-splash-new`,onClick:L,disabled:F,children:[F?(0,Q.jsx)(l,{size:16,className:`spin`}):null,` New session`]})]}),U?(0,Q.jsx)(`div`,{className:`webchat-pending-standalone`,children:U}):null]}):x&&!d?!n||x.known?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(bd,{userName:t,variant:r,onChip:St}),U?(0,Q.jsx)(`div`,{className:`webchat-pending-standalone`,children:U}):null]}):(0,Q.jsx)(`div`,{className:`webchat-greeting`,children:(0,Q.jsx)(`p`,{className:`webchat-greeting-none`,children:`No transcript found for this session.`})}):null,i&&R?(0,Q.jsx)(`div`,{className:`webchat-conv-overlay`,children:(0,Q.jsx)(gd,{sessions:s?nt.map(e=>({...e,active:!1})):nt,onOpen:st,onRename:ct,onArchive:lt,onDelete:ut,onEnd:dt,onNew:L,onBack:()=>a?.(),onCopyId:ft})}):null,(0,Q.jsx)(dd,{deliveryFailure:!!H?.deliveryFailure,permPrompt:H?.pendingPermissionPrompt??null,onVerdict:cn,isDragOver:Me,onDragOver:e=>{e.preventDefault(),Ne(!0)},onDragLeave:()=>Ne(!1),onDrop:e=>{e.preventDefault(),Ne(!1),pt([...e.dataTransfer.files])},fileInputRef:Pe,acceptMime:le,onFileInputChange:e=>{e.target.files&&pt([...e.target.files]),e.target.value=``},showResizeHandle:!gt,onResizePointerDown:Ke,onResizeKeyDown:qe,pendingFiles:M,thumbUrls:mt,onRemoveFile:e=>ke(t=>t.filter((t,n)=>n!==e)),attachError:Ae,sendError:he,transcribing:fe,voice:ht,isVoiceActive:gt,onVoiceSend:_t,text:E,onTextareaChange:e=>{if(zt){let e=++Vt.current;Bt.current={seq:e,t0:performance.now()},requestAnimationFrame(()=>{Bt.current?.seq===e&&(Bt.current=null)})}D(e.target.value)},textareaRef:Re,textareaHeight:Ie??Je??44,textareaDisabled:Dt!==null||re||j!==null,onKeyDown:wt,onPaste:e=>{let t=e.clipboardData?.items;if(!t)return;let n=He(t,Date.now());n.length>0&&pt(n)},onSend:xt,sendDisabled:re||E.trim().length===0&&M.length===0||Dt!==null,turnActive:!d&&Mt&&!Gt,onStop:Ct,stopping:Ut,deadChildNotice:qt,conflictHint:Dt,showNewSession:!d,newSessionRef:tt,newSessionOpen:Xe,onToggleNewSession:()=>Ze(e=>!e),newSessionDisabled:Dt!==null,newModel:Qe,onPickModel:P,newEffort:$e,onPickEffort:et,onNewSession:L,newSessionPending:F,onAttachClick:()=>Pe.current?.click(),attachDisabled:Dt!==null,micMenuRef:an,onMicStart:()=>ht.start(Qt??void 0),micStartDisabled:gt||Dt!==null,onOpenMicMenu:on,micMenuOpen:nn,micDevices:en,micDeviceId:Qt,onChooseMic:sn,showCleanToggle:r===`admin`,cleanView:Pt,onToggleClean:It,showControlsRight:!d,sessionId:H?.sessionId??null,mode:At,model:jt,effort:H?.effort??null,contextUsage:H?.contextUsage??null,paramsMenuRef:Zt,paramsMenuOpen:Yt,onToggleParamsMenu:()=>Xt(e=>!e)}),(0,Q.jsx)(_e,{open:_,onConnect:()=>window.location.assign(`/?connect=claude`),onClose:()=>y(!1)})]})}var Sd=`maxy-subaccount-switch-clear`;function Cd(e){if(e)return!1;try{return sessionStorage.getItem(Sd)!=null}catch{return!1}}function wd(e){if(e)return null;try{return sessionStorage.getItem(Sd)}catch{return null}}function Td(e){if(e)return!1;let t=null;try{t=sessionStorage.getItem(Sd),t&&sessionStorage.removeItem(Sd)}catch{}return console.info(`[sub-account] op=post-switch-chat switchId=${t??`none`} signal=${t!=null} resume=${t==null}`),t!=null}function Ed({variant:e=`admin`,forceCanonicalSession:t=!1}){let[n,r]=(0,$.useState)(null),[i]=(0,$.useState)(()=>pd(t,window.location.search)),[a,o]=(0,$.useState)(()=>Cd(t)),[s]=(0,$.useState)(()=>wd(t)),c=(0,$.useRef)(!1);(0,$.useEffect)(()=>{c.current||(c.current=!0,Td(t))},[t]);let[u,d]=(0,$.useState)(!1),[f,m]=(0,$.useState)(!1),[h,g]=(0,$.useState)(void 0),[_,v]=(0,$.useState)(null),[y,b]=(0,$.useState)(void 0),[x,S]=(0,$.useState)(null),[C,w]=(0,$.useState)(null);(0,$.useEffect)(()=>{let e=!1,t=null;try{t=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!t){r(null),d(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(t)}`).then(async n=>{if(!e){if(n.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(n.ok)try{let e=await n.json();typeof e.businessName==`string`&&g(e.businessName),e.sessionId!==void 0&&v(e.sessionId??null),w(e.role??null),b(e.userName===void 0?null:e.userName),S(e.avatar??null)}catch{}r(t),d(!0)}}).catch(()=>{e||(r(t),d(!0))}),()=>{e=!0}},[]);let T=(0,$.useRef)(!1);(0,$.useEffect)(()=>{e!==`operator`||!u||!n||T.current||(T.current=!0,console.info(`[operator-ui] op=mount surface=chat sessionId=${(_??``).slice(0,8)}`))},[e,u,n,_]);let E=(0,$.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),[D,O]=(0,$.useState)(!1),k=(0,$.useCallback)(async()=>{O(!0);try{let e=await fe();if(e){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`}return e}finally{O(!1)}},[]);return u?n?(0,Q.jsx)(p,{cacheKey:n,surface:`chat`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=chat`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,Q.jsx)(Ce,{cacheKey:n,businessName:h,variant:e,sessionId:_,onLogout:E,onDisconnect:k,disconnecting:D,userName:y,userAvatar:x,role:C,onOpenConversations:()=>m(!0),children:(0,Q.jsx)(xd,{cacheKey:n,userName:y??null,targetSessionId:i,variant:e,conversationsOpen:f,onCloseConversations:()=>m(!1),cleared:a,onFirstSend:()=>o(!1),switchId:s})})}):(0,Q.jsx)(`div`,{className:`data-page`,children:(0,Q.jsxs)(`div`,{className:`data-empty`,children:[(0,Q.jsx)(`p`,{children:`You are not signed in.`}),(0,Q.jsxs)(`p`,{children:[`Open the `,(0,Q.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,Q.jsx)(`div`,{className:`data-page`,children:(0,Q.jsxs)(`div`,{className:`data-loading`,children:[(0,Q.jsx)(l,{size:18,className:`spin`}),` Loading…`]})})}function Dd(){return(0,Q.jsx)(Ed,{})}export{Yu as a,qu as c,Xu as i,Dd as n,Zu as o,xd as r,Ju as s,Ed as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-fQC6bEKA.js";import{B as t,G as n,U as r}from"./useSubAccountSwitcher-Bc7XHr0L.js";import"./useVoiceRecorder-Cu6zvuFx.js";import{b as i}from"./AdminShell-BFVVkWFC.js";import{a,c as o,i as s,o as c,r as l,s as u}from"./page-iG57nKOg.js";import"./useCopyFeedback-DHCtz8qX.js";var d=r(),f=e(n(),1),p=t();function m({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(null);async function d(e){e.preventDefault();let n=a.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,p.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Verifying your link…`}),(0,p.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`That link did not work`}),(0,p.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,p.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,p.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,p.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,p.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,p.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:a,onChange:e=>o(e.target.value),disabled:s}),l&&(0,p.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,p.jsx)(i,{type:`submit`,disabled:s||!a.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Check your email`}),(0,p.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function h(){let[e,t]=(0,f.useState)(null),[n,r]=(0,f.useState)(null),[i,l]=(0,f.useState)(`loading`),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(null),S=(0,f.useMemo)(()=>a(),[]),C=(0,f.useRef)(S||``),w=(0,f.useRef)(null),T=(0,f.useRef)(null),E=(0,f.useRef)(!1),D=(0,f.useRef)(null),[O,k]=(0,f.useState)(`request-link`),[A,j]=(0,f.useState)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,f.useEffect)(()=>{try{let e=c();e&&(sessionStorage.setItem(s,e),o&&console.info(`[public-webchat] op=seed-persisted len=${e.length} head=${e.slice(0,40)}`))}catch{}},[]);let P=(0,f.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}l(`chat`)},[]),F=(0,f.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),l(`auth-required`),k(`request-link`)},[]),I=(0,f.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,f.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:u(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return o&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),p(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&p(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return o&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:l,agentDisplayName:d,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,f.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function g(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}=h();return(0,f.useEffect)(()=>{e()},[e]),t===`loading`?(0,p.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,p.jsx)(m,{gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}):(0,p.jsx)(`div`,{className:`public-shell`,children:(0,p.jsx)(l,{cacheKey:``,variant:`public`})})}(0,d.createRoot)(document.getElementById(`root`)).render((0,p.jsx)(g,{}));
1
+ import{o as e}from"./chunk-fQC6bEKA.js";import{B as t,G as n,U as r}from"./useSubAccountSwitcher-Bc7XHr0L.js";import"./useVoiceRecorder-Cu6zvuFx.js";import{b as i}from"./AdminShell-BFVVkWFC.js";import{a,c as o,i as s,o as c,r as l,s as u}from"./page-C4TrTU6r.js";import"./useCopyFeedback-DHCtz8qX.js";var d=r(),f=e(n(),1),p=t();function m({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(null);async function d(e){e.preventDefault();let n=a.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,p.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Verifying your link…`}),(0,p.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`That link did not work`}),(0,p.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,p.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,p.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,p.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,p.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,p.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:a,onChange:e=>o(e.target.value),disabled:s}),l&&(0,p.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,p.jsx)(i,{type:`submit`,disabled:s||!a.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Check your email`}),(0,p.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function h(){let[e,t]=(0,f.useState)(null),[n,r]=(0,f.useState)(null),[i,l]=(0,f.useState)(`loading`),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(null),S=(0,f.useMemo)(()=>a(),[]),C=(0,f.useRef)(S||``),w=(0,f.useRef)(null),T=(0,f.useRef)(null),E=(0,f.useRef)(!1),D=(0,f.useRef)(null),[O,k]=(0,f.useState)(`request-link`),[A,j]=(0,f.useState)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,f.useEffect)(()=>{try{let e=c();e&&(sessionStorage.setItem(s,e),o&&console.info(`[public-webchat] op=seed-persisted len=${e.length} head=${e.slice(0,40)}`))}catch{}},[]);let P=(0,f.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}l(`chat`)},[]),F=(0,f.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),l(`auth-required`),k(`request-link`)},[]),I=(0,f.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,f.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:u(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return o&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),p(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&p(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return o&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:l,agentDisplayName:d,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,f.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function g(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}=h();return(0,f.useEffect)(()=>{e()},[e]),t===`loading`?(0,p.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,p.jsx)(m,{gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}):(0,p.jsx)(`div`,{className:`public-shell`,children:(0,p.jsx)(l,{cacheKey:``,variant:`public`})})}(0,d.createRoot)(document.getElementById(`root`)).render((0,p.jsx)(g,{}));
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Chat — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/chat-qtOiJX-Y.js"></script>
8
+ <script type="module" crossorigin src="/assets/chat-MvnxPJZ5.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-fQC6bEKA.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-Bc7XHr0L.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/AdminShell-BFVVkWFC.js">
@@ -18,7 +18,7 @@
18
18
  <link rel="modulepreload" crossorigin href="/assets/chevron-left-BzIg4in6.js">
19
19
  <link rel="modulepreload" crossorigin href="/assets/rotate-ccw-L42fL8ey.js">
20
20
  <link rel="modulepreload" crossorigin href="/assets/wrench-iWkROE1V.js">
21
- <link rel="modulepreload" crossorigin href="/assets/page-iG57nKOg.js">
21
+ <link rel="modulepreload" crossorigin href="/assets/page-C4TrTU6r.js">
22
22
  <link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DPHQJO7E.css">
23
23
  <link rel="stylesheet" href="/brand-defaults.css">
24
24
  </head>
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Operator — Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/operator-icJwMkZF.js"></script>
8
+ <script type="module" crossorigin src="/assets/operator-DCNWUKP_.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-fQC6bEKA.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-Bc7XHr0L.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/AdminShell-BFVVkWFC.js">
@@ -19,7 +19,7 @@
19
19
  <link rel="modulepreload" crossorigin href="/assets/chevron-left-BzIg4in6.js">
20
20
  <link rel="modulepreload" crossorigin href="/assets/rotate-ccw-L42fL8ey.js">
21
21
  <link rel="modulepreload" crossorigin href="/assets/wrench-iWkROE1V.js">
22
- <link rel="modulepreload" crossorigin href="/assets/page-iG57nKOg.js">
22
+ <link rel="modulepreload" crossorigin href="/assets/page-C4TrTU6r.js">
23
23
  <link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DPHQJO7E.css">
24
24
  <link rel="stylesheet" crossorigin href="/assets/AdminLoginScreens-CWMpccrR.css">
25
25
  <link rel="stylesheet" href="/brand-defaults.css">
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Maxy</title>
7
7
  <link rel="icon" href="/favicon.ico">
8
- <script type="module" crossorigin src="/assets/public-CkOumzpf.js"></script>
8
+ <script type="module" crossorigin src="/assets/public-DXJXQPwe.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/chunk-fQC6bEKA.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/useSubAccountSwitcher-Bc7XHr0L.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/AdminShell-BFVVkWFC.js">
@@ -18,7 +18,7 @@
18
18
  <link rel="modulepreload" crossorigin href="/assets/chevron-left-BzIg4in6.js">
19
19
  <link rel="modulepreload" crossorigin href="/assets/rotate-ccw-L42fL8ey.js">
20
20
  <link rel="modulepreload" crossorigin href="/assets/wrench-iWkROE1V.js">
21
- <link rel="modulepreload" crossorigin href="/assets/page-iG57nKOg.js">
21
+ <link rel="modulepreload" crossorigin href="/assets/page-C4TrTU6r.js">
22
22
  <link rel="stylesheet" crossorigin href="/assets/useSubAccountSwitcher-DPHQJO7E.css">
23
23
  <link rel="stylesheet" href="/brand-defaults.css">
24
24
  </head>