@runtypelabs/persona 4.34.0 → 4.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/activity-ui.d.cts +3 -3
  2. package/dist/activity-ui.d.ts +3 -3
  3. package/dist/animations/glyph-cycle.d.cts +1 -1
  4. package/dist/animations/glyph-cycle.d.ts +1 -1
  5. package/dist/animations/wipe.d.cts +1 -1
  6. package/dist/animations/wipe.d.ts +1 -1
  7. package/dist/approval-ui.d.cts +3 -3
  8. package/dist/approval-ui.d.ts +3 -3
  9. package/dist/artifacts-ui.d.cts +3 -3
  10. package/dist/artifacts-ui.d.ts +3 -3
  11. package/dist/background-runtime.d.cts +1 -1
  12. package/dist/background-runtime.d.ts +1 -1
  13. package/dist/{chunk-CxNPSY-b.js → chunk-B1P8w9_X.js} +1 -1
  14. package/dist/{chunk-CV8EPIhT.js → chunk-B30Jdgg6.js} +1 -1
  15. package/dist/{chunk-6CUrH_jm.js → chunk-Bzo9GaAi.js} +1 -1
  16. package/dist/chunk-CNBMBx-Y.js +2 -0
  17. package/dist/chunk-Cd8mp8Sv.js +1 -0
  18. package/dist/chunk-CsfE8WRG.js +1 -0
  19. package/dist/{chunk-Co3VVwGe.js → chunk-D2pHRNEq.js} +0 -0
  20. package/dist/chunk-D3kZO8u-.js +1 -0
  21. package/dist/chunk-DAthf5H3.js +1 -0
  22. package/dist/{chunk-YMkMvAsa.js → chunk-DZ_aillY.js} +1 -1
  23. package/dist/{chunk-6C23QQdP.js → chunk-DgJV9zbK.js} +1 -1
  24. package/dist/chunk-Dv6KtIT1.js +1 -0
  25. package/dist/chunk-Dws8IrdR.js +1 -0
  26. package/dist/{chunk-DsWv3EGF.js → chunk-ThxxD8oK.js} +1 -1
  27. package/dist/client-dispatch.js +1 -1
  28. package/dist/client-history.js +1 -1
  29. package/dist/codegen.cjs +1 -1
  30. package/dist/codegen.js +1 -1
  31. package/dist/composer-actions-runtime.cjs +1 -1
  32. package/dist/composer-actions-runtime.d.cts +3 -3
  33. package/dist/composer-actions-runtime.d.ts +3 -3
  34. package/dist/composer-actions-runtime.js +1 -1
  35. package/dist/{composer-input-i_FiUp6J.d.cts → composer-input-BSDNPOqV.d.cts} +1 -1
  36. package/dist/{composer-input-i_FiUp6J.d.ts → composer-input-BSDNPOqV.d.ts} +1 -1
  37. package/dist/{composer-store-DhGNgG7Z.d.cts → composer-store-DC-gAjtN.d.cts} +1 -1
  38. package/dist/{composer-store-DhGNgG7Z.d.ts → composer-store-DC-gAjtN.d.ts} +1 -1
  39. package/dist/{context-mention-manager-DL-xwGfL.d.cts → context-mention-manager-CCpeoGL2.d.cts} +2 -2
  40. package/dist/{context-mention-manager-DL-xwGfL.d.ts → context-mention-manager-CCpeoGL2.d.ts} +2 -2
  41. package/dist/context-mentions-inline.d.cts +2 -2
  42. package/dist/context-mentions-inline.d.ts +2 -2
  43. package/dist/context-mentions.cjs +1 -1
  44. package/dist/context-mentions.d.cts +3 -3
  45. package/dist/context-mentions.d.ts +3 -3
  46. package/dist/context-mentions.js +1 -1
  47. package/dist/{defaults-Bga2Xrsp.d.cts → defaults-tj5RcN8r.d.cts} +1 -1
  48. package/dist/{defaults-Bga2Xrsp.d.ts → defaults-tj5RcN8r.d.ts} +1 -1
  49. package/dist/dictation-runtime.d.cts +2 -2
  50. package/dist/dictation-runtime.d.ts +2 -2
  51. package/dist/event-stream-view.d.cts +1 -1
  52. package/dist/event-stream-view.d.ts +1 -1
  53. package/dist/{fallback-speech-engine-kLdyPcmk.d.cts → fallback-speech-engine-gkhbjLiZ.d.cts} +1 -1
  54. package/dist/{fallback-speech-engine-kLdyPcmk.d.ts → fallback-speech-engine-gkhbjLiZ.d.ts} +1 -1
  55. package/dist/{feature-preferences-CmwZGKrf.d.cts → feature-preferences-CerDWGZ7.d.cts} +1 -1
  56. package/dist/{feature-preferences-CmwZGKrf.d.ts → feature-preferences-CerDWGZ7.d.ts} +1 -1
  57. package/dist/forms-ui.d.cts +2 -2
  58. package/dist/forms-ui.d.ts +2 -2
  59. package/dist/{history-confirm-dialog-i46-lPN_.d.cts → history-confirm-dialog-CrkSB3Ra.d.cts} +1 -1
  60. package/dist/{history-confirm-dialog-i46-lPN_.d.ts → history-confirm-dialog-CrkSB3Ra.d.ts} +1 -1
  61. package/dist/history-shell.d.cts +6 -6
  62. package/dist/history-shell.d.ts +6 -6
  63. package/dist/history-view.d.cts +1 -1
  64. package/dist/history-view.d.ts +1 -1
  65. package/dist/index.cjs +32 -32
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.d.cts +8 -8
  68. package/dist/index.d.ts +8 -8
  69. package/dist/index.global.js +1 -1
  70. package/dist/index.global.js.map +1 -1
  71. package/dist/index.js +40 -40
  72. package/dist/index.js.map +1 -1
  73. package/dist/install.global.js +1 -1
  74. package/dist/launcher.global.js +1 -1
  75. package/dist/{loading-label-runtime-loader-Ccr3ETd3.d.cts → loading-label-runtime-loader-fWIRrhUF.d.cts} +1 -1
  76. package/dist/{loading-label-runtime-loader-Ccr3ETd3.d.ts → loading-label-runtime-loader-fWIRrhUF.d.ts} +1 -1
  77. package/dist/loading-label-runtime.d.cts +1 -1
  78. package/dist/loading-label-runtime.d.ts +1 -1
  79. package/dist/{message-bubble-C6AVaH7f.d.cts → message-bubble-Czc0lOHr.d.cts} +1 -1
  80. package/dist/{message-bubble-C6AVaH7f.d.ts → message-bubble-Czc0lOHr.d.ts} +1 -1
  81. package/dist/{plugin-kit-BVggqE3C.d.cts → plugin-kit-C30jE-cw.d.cts} +3 -1
  82. package/dist/{plugin-kit-BVggqE3C.d.ts → plugin-kit-C30jE-cw.d.ts} +3 -1
  83. package/dist/plugin-kit.cjs +1 -1
  84. package/dist/plugin-kit.d.cts +1 -1
  85. package/dist/plugin-kit.d.ts +1 -1
  86. package/dist/plugin-kit.js +1 -1
  87. package/dist/preferences-runtime.d.cts +1 -1
  88. package/dist/preferences-runtime.d.ts +1 -1
  89. package/dist/{preview-BMdRffo4.d.cts → preview-D-osV3FU.d.cts} +2 -2
  90. package/dist/{preview-BMdRffo4.d.ts → preview-D-osV3FU.d.ts} +2 -2
  91. package/dist/{registry-B16l8s1b.d.cts → registry-B6w91tx0.d.cts} +1 -1
  92. package/dist/{registry-B16l8s1b.d.ts → registry-B6w91tx0.d.ts} +1 -1
  93. package/dist/{session-CtZHe7fc.d.cts → session-BUQrs3Of.d.cts} +10 -9
  94. package/dist/{session-CtZHe7fc.d.ts → session-BUQrs3Of.d.ts} +10 -9
  95. package/dist/session-reconnect.d.cts +2 -2
  96. package/dist/session-reconnect.d.ts +2 -2
  97. package/dist/smart-dom-reader.d.cts +1 -1
  98. package/dist/smart-dom-reader.d.ts +1 -1
  99. package/dist/theme-editor-preview.cjs +43 -43
  100. package/dist/theme-editor-preview.d.cts +1 -1
  101. package/dist/theme-editor-preview.d.ts +1 -1
  102. package/dist/theme-editor-preview.js +3 -3
  103. package/dist/theme-editor.d.cts +2 -2
  104. package/dist/theme-editor.d.ts +2 -2
  105. package/dist/theme-reference.d.cts +2 -2
  106. package/dist/theme-reference.d.ts +2 -2
  107. package/dist/{tool-loading-animation-D2cyFvmM.d.cts → tool-loading-animation-B7XUf8TN.d.cts} +1 -1
  108. package/dist/{tool-loading-animation-D2cyFvmM.d.ts → tool-loading-animation-B7XUf8TN.d.ts} +1 -1
  109. package/dist/{turn-activity-ui-Do1Nd-Ow.d.cts → turn-activity-ui-CohuNMHT.d.cts} +2 -2
  110. package/dist/{turn-activity-ui-Do1Nd-Ow.d.ts → turn-activity-ui-CohuNMHT.d.ts} +2 -2
  111. package/dist/turn-activity-ui.d.cts +1 -1
  112. package/dist/turn-activity-ui.d.ts +1 -1
  113. package/dist/{types-BC7MRxO5.d.cts → types-9i0xcAMT.d.cts} +52 -0
  114. package/dist/{types-BC7MRxO5.d.ts → types-9i0xcAMT.d.ts} +52 -0
  115. package/dist/voice-client-tools.d.cts +1 -1
  116. package/dist/voice-client-tools.d.ts +1 -1
  117. package/dist/voice-runtime.cjs +1 -1
  118. package/dist/voice-runtime.d.cts +2 -2
  119. package/dist/voice-runtime.d.ts +2 -2
  120. package/dist/voice-runtime.js +1 -1
  121. package/dist/voice-worklet-player.d.cts +2 -2
  122. package/dist/voice-worklet-player.d.ts +2 -2
  123. package/dist/{webmcp-runtime-entry-B8g46vS0.d.ts → webmcp-runtime-entry-XNaXa-9h.d.cts} +9 -1
  124. package/dist/{webmcp-runtime-entry-B8g46vS0.d.cts → webmcp-runtime-entry-XNaXa-9h.d.ts} +9 -1
  125. package/dist/webmcp-runtime.cjs +1 -1
  126. package/dist/webmcp-runtime.d.cts +1 -1
  127. package/dist/webmcp-runtime.d.ts +1 -1
  128. package/dist/webmcp-runtime.js +1 -1
  129. package/package.json +2 -2
  130. package/src/client-dispatch.ts +13 -0
  131. package/src/client.ts +37 -2
  132. package/src/client.webmcp-require-confirm.test.ts +212 -0
  133. package/src/components/composer-model-picker.ts +0 -14
  134. package/src/components/composer-overflow-menu.ts +0 -15
  135. package/src/components/composer-tokens.ts +0 -20
  136. package/src/generated/runtype-openapi-contract.ts +13 -0
  137. package/src/plugin-kit.test.ts +101 -0
  138. package/src/plugin-kit.ts +29 -1
  139. package/src/session.ts +6 -2
  140. package/src/session.webmcp.test.ts +32 -0
  141. package/src/types.ts +35 -0
  142. package/src/ui.composer-models.test.ts +5 -7
  143. package/src/ui.composer-overflow.test.ts +14 -21
  144. package/src/utils/context-mention-controller.test.ts +56 -0
  145. package/src/webmcp-bridge.test.ts +102 -0
  146. package/src/webmcp-runtime-entry.ts +29 -1
  147. package/dist/chunk-BAkaTZpd.js +0 -1
  148. package/dist/chunk-BEDTp-dm.js +0 -1
  149. package/dist/chunk-C-rux8Q9.js +0 -1
  150. package/dist/chunk-CNhThrLX.js +0 -1
  151. package/dist/chunk-CzLEhoB_.js +0 -2
  152. package/dist/chunk-Dqa_GOcj.js +0 -1
  153. package/dist/chunk-NUNdcnAZ.js +0 -1
@@ -1,5 +1,5 @@
1
- import { B as AgentWidgetContextMentionRef, I as AgentWidgetContextMentionItem, U as AgentWidgetContextMentionSource, Ur as ContentPart, z as AgentWidgetContextMentionPayload } from "./types-BC7MRxO5.js";
2
- import "./composer-input-i_FiUp6J.js";
1
+ import { B as AgentWidgetContextMentionRef, I as AgentWidgetContextMentionItem, U as AgentWidgetContextMentionSource, Ur as ContentPart, z as AgentWidgetContextMentionPayload } from "./types-9i0xcAMT.js";
2
+ import "./composer-input-BSDNPOqV.js";
3
3
  type MentionChipStatus = "resolving" | "ready" | "error";
4
4
  interface MentionChipParts {
5
5
  el: HTMLElement;
@@ -1,5 +1,5 @@
1
- import { B as AgentWidgetContextMentionRef } from "./types-BC7MRxO5.cjs";
2
- import { t as ComposerInputCapability } from "./composer-input-i_FiUp6J.cjs";
1
+ import { B as AgentWidgetContextMentionRef } from "./types-9i0xcAMT.cjs";
2
+ import { t as ComposerInputCapability } from "./composer-input-BSDNPOqV.cjs";
3
3
  interface InlineComposerMountContext {
4
4
  /** The live composer textarea to migrate from (value + caret + look). */
5
5
  textarea: HTMLTextAreaElement;
@@ -1,5 +1,5 @@
1
- import { B as AgentWidgetContextMentionRef } from "./types-BC7MRxO5.js";
2
- import { t as ComposerInputCapability } from "./composer-input-i_FiUp6J.js";
1
+ import { B as AgentWidgetContextMentionRef } from "./types-9i0xcAMT.js";
2
+ import { t as ComposerInputCapability } from "./composer-input-BSDNPOqV.js";
3
3
  interface InlineComposerMountContext {
4
4
  /** The live composer textarea to migrate from (value + caret + look). */
5
5
  textarea: HTMLTextAreaElement;
@@ -6,7 +6,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>
6
6
  * See the LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  ;var r=(/* @__PURE__ */ e((e=>{e.Search=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]],e.X=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]]})))();const i=(e,t=24,n=`currentColor`,r=2)=>{if(!Array.isArray(e))return null;let i=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[e,a]of Object.entries({width:String(t),height:String(t),viewBox:`0 0 24 24`,fill:`none`,stroke:n,"stroke-width":String(r),"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`}))i.setAttribute(e,a);for(let t of e){if(!Array.isArray(t)||t.length<2)continue;let e=t[0],n=t[1];if(!n)continue;let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);for(let[e,t]of Object.entries(n))e!==`stroke`&&r.setAttribute(e,String(t));i.appendChild(r)}return i};let a=null;const o=e=>{a=e},s=(e,t,n,r)=>a?.(e,t,n,r)??null;function c(e){let{ref:a,config:o,onRemove:c}=e;if(o.renderMentionChip){let e=`resolving`,t,n=o.renderMentionChip({ref:a,status:e,payload:t,remove:c});return{get el(){return n},setStatus:(r,i)=>{if(r===e&&i===t)return;e=r,t=i;let s=o.renderMentionChip({ref:a,status:e,payload:t,remove:c});n.replaceWith(s),n=s}}}let l=a.iconName??o.chipIconName??`at-sign`,u=n(`div`,{className:`persona-mention-chip`,attrs:{"data-persona-mention-chip":``,"data-status":`resolving`,title:a.label}}),d=t(`span`,`persona-mention-chip-icon`),f=e=>{d.replaceChildren();let t=s(e,13,`currentColor`,2);t&&d.appendChild(t)};f(l);let p=t(`span`,`persona-mention-chip-spinner`),m=n(`span`,{className:`persona-mention-chip-label`,text:a.label}),h=n(`button`,{className:`persona-mention-chip-remove`,attrs:{type:`button`,"aria-label":`Remove ${a.label} context`}}),g=i(r.X,11,`currentColor`,2.5);return g?h.appendChild(g):h.textContent=`×`,h.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),c()}),u.appendChild(p),u.appendChild(m),u.appendChild(h),{el:u,setStatus:e=>{u.setAttribute(`data-status`,e),e===`resolving`?(p.parentNode!==u&&u.insertBefore(p,m),d.parentNode===u&&d.remove(),u.setAttribute(`title`,a.label)):(p.parentNode===u&&p.remove(),d.parentNode!==u&&u.insertBefore(d,m),e===`error`?(f(`triangle-alert`),u.setAttribute(`title`,`Couldn't add ${a.label} to context`)):(f(l),u.setAttribute(`title`,a.label)))}}}function l(e){e.style.display=e.childElementCount>0?`flex`:`none`}function u(e){let t=0;for(let n of e.split(`
9
- `)){let e=/^ {0,3}(`+)/.exec(n);e&&e[1].length>t&&(t=e[1].length)}return t}function d(e,t){let n="`".repeat(Math.max(3,u(t)+1));return`${n}${e}\n${t}\n${n}`}function f(e,t,n){return t.includes(`</document_content>`)?d(e,t):`<document index="${n+1}">\n<source>${e}</source>\n<document_content>\n${t}\n</document_content>\n</document>`}function p(e,t,n=`fenced`){if(typeof n==`function`)try{return n(e,t)}catch(t){return console.warn(`[persona] contextMentions.llmFormat threw; falling back to the fenced format for this mention`,t),d(e.label,e.text)}return n===`document`?f(e.label,e.text,t):d(e.label,e.text)}function m(e,t){return{sourceId:e.id,itemId:t.id,label:t.label,iconName:t.iconName,color:t.color}}const h=(e,t)=>`${e}\u0000${t}`;var g=class{#e;constructor(e){this.mentions=[],this.#e=e,this.#o()}get#t(){return this.#e.mentionConfig.maxMentions??8}hasMentions(){return this.mentions.length>0}add(e,t,n=``){let r=h(e.id,t.id);if(this.mentions.some(e=>e.key===r))return this.#n(e,t,`duplicate`);if(this.atLimit())return this.#n(e,t,`limit`);let i=m(e,t),a={key:r,source:e,item:t,ref:i,status:`resolving`,args:n};return a.chip=c({ref:i,config:this.#e.mentionConfig,onRemove:()=>this.remove(r)}),a.chip.el.setAttribute(`data-persona-chip-enter`,``),a.chip.el.addEventListener(`animationend`,()=>a.chip?.el.removeAttribute(`data-persona-chip-enter`),{once:!0}),this.#e.contextRow.appendChild(a.chip.el),this.#r(a),this.#o(),!0}atLimit(){return this.mentions.length>=this.#t}admit(e,t){return!this.atLimit()||this.#n(e,t,`limit`)}track(e,t,n,r=``,i){let a={key:e,source:t,item:n,ref:m(t,n),status:`resolving`,args:r,reportStatus:i};this.#r(a)}#n(e,t,n){return this.#e.mentionConfig.onMentionRejected?.(t,n),this.#e.emit?.(`rejected`,{sourceId:e.id,itemId:t.id,reason:n}),!1}#r(e){this.mentions.push(e),e.source.resolveOn===`submit`?(e.status=`ready`,e.chip?.setStatus(`ready`),e.reportStatus?.(`resolved`)):e.resolvePromise=this.#a(e),this.#e.announce(`Added ${e.ref.label} to context`)}#i(e,t,n=this.#e.getComposerText()){return{messages:this.#e.getMessages(),config:this.#e.getConfig(),composerText:n,args:t,signal:e}}async#a(e){let t=new AbortController;e.abort=t;try{let n=await e.source.resolve(e.item,this.#i(t.signal,e.args));if(t.signal.aborted)return;e.payload=n,e.status=`ready`,e.chip?.setStatus(`ready`,n),e.reportStatus?.(`resolved`)}catch(n){if(t.signal.aborted)return;e.status=`error`,e.chip?.setStatus(`error`),e.reportStatus?.(`error`),(this.#e.announceError??this.#e.announce)(`Couldn't attach ${e.ref.label} to context`),this.#e.mentionConfig.onMentionResolveError?.(e.item,n),this.#e.emit?.(`resolve-error`,{sourceId:e.source.id,itemId:e.item.id})}}remove(e){let t=this.mentions.findIndex(t=>t.key===e);if(t===-1)return;let[n]=this.mentions.splice(t,1);n.abort?.abort(),n.chip?.el.remove(),this.#o(),this.#e.announce(`Removed ${n.ref.label} from context`)}getRefs(){return this.mentions.map(e=>e.ref)}captureDraft(){return this.mentions.map(({key:e,source:t,item:n,ref:r,status:i,payload:a,args:o})=>({key:e,source:t,item:n,ref:r,status:i,payload:a,args:o}))}restoreDraft(e,t){this.clear();let n=[...this.#e.mentionConfig.sources??[],...(this.#e.mentionConfig.triggers??[]).flatMap(e=>e.sources)];for(let r of e){let e=n.find(e=>e.id===r.source.id);if(!e)continue;let i={...r,source:e};t.getDocument?.().blocks.some(e=>e.kind===`mention`&&e.id===r.key)?i.reportStatus=e=>t.setMentionStatus?.(r.key,e):(i.chip=c({ref:r.ref,config:this.#e.mentionConfig,onRemove:()=>this.remove(r.key)}),this.#e.contextRow.appendChild(i.chip.el)),this.mentions.push(i),i.status===`resolving`?i.resolvePromise=this.#a(i):(i.chip?.setStatus(i.status,i.payload),i.reportStatus?.(i.status===`ready`?`resolved`:`error`))}this.#o()}removeLast(){let e=this.mentions[this.mentions.length-1];return e?(this.remove(e.key),!0):!1}clear(){for(let e of this.mentions)e.abort?.abort(),e.chip?.el.remove();this.mentions.length=0,this.#o()}collectForSubmit(){let e=[...this.mentions],t=e.map(e=>e.ref),n=this.#e.getComposerText();for(let t of e)t.chip?.el.remove();return this.mentions.length=0,this.#o(),{refs:t,finalize:async()=>{let t=await Promise.all(e.map(async e=>{try{return e.source.resolveOn===`submit`?await e.source.resolve(e.item,this.#i(new AbortController().signal,e.args,n)):(e.resolvePromise&&await e.resolvePromise,e.payload??null)}catch(t){try{this.#e.mentionConfig.onMentionResolveError?.(e.item,t)}catch(e){typeof console<`u`&&console.warn(`[Persona] onMentionResolveError callback threw`,e)}return this.#e.emit?.(`resolve-error`,{sourceId:e.source.id,itemId:e.item.id}),null}})),r=[],i=[],a={},o=/* @__PURE__ */ new Set;for(let n=0;n<e.length;n++){let s=e[n],c=t[n];if(!c)continue;let l=h(s.source.id,s.item.id);if(!o.has(l)){if(o.add(l),c.llmAppend&&c.llmAppend.trim())try{r.push(p({label:s.ref.label,text:c.llmAppend,ref:s.ref,item:s.item},r.length,this.#e.mentionConfig.llmFormat))}catch(e){typeof console<`u`&&console.warn(`[Persona] context-mention llmFormat threw`,e)}c.contentParts?.length&&i.push(...c.contentParts),c.context&&((a[s.source.id]??={})[s.item.id]=c.context)}}return{blocks:r,contentParts:i,context:a}}}}#o(){l(this.#e.contextRow)}};const _=e=>e.nodeType===Node.DOCUMENT_NODE,v=e=>e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host!==void 0;function y(e){let t=e.getRootNode?.();return t&&v(t)||t&&_(t)?t:e.ownerDocument??document}function b(e,t,n){let r=_(e)?e.head:e,i=t.replace(/["\\]/g,`\\$&`);if(r.querySelector(`style[data-persona-plugin-style="${i}"]`))return;let a=(_(e)?e:e.ownerDocument??document).createElement(`style`);a.setAttribute(`data-persona-plugin-style`,t),a.textContent=n,r.appendChild(a)}function x(e,t,n){if(_(e)||v(e)){b(e,t,n);return}let r=e;if(r.isConnected){b(y(r),t,n);return}let i=r.ownerDocument??document;b(i,t,n),queueMicrotask(()=>{let e=y(r);e!==i&&b(e,t,n)})}function S(e){let t=e.getRootNode?.();return t instanceof ShadowRoot?t:e.closest(`dialog[open]`)??(e.ownerDocument??document).body}function C(e){let{anchor:t,content:n,placement:r=`bottom-start`,offset:i=6,matchAnchorWidth:a=!1,horizontalOffset:o,verticalOffset:s,zIndex:c=2147483e3,onOpen:l,onDismiss:u}=e,d=()=>e.container??S(t),f=!1,p=null,m=()=>{if(!f)return;let c=d();if(n.parentNode!==c){let e=n.contains(n.ownerDocument.activeElement)?n.ownerDocument.activeElement:null;c.appendChild(n),e?.focus({preventScroll:!0})}let l=e.getAnchorRect?.()??t.getBoundingClientRect();n.style.position=`fixed`,a&&(n.style.minWidth=`${l.width}px`),o&&(n.style.maxWidth=`${l.width}px`);let u=n.getBoundingClientRect(),p=s?.()??null,m=p==null?l.top:l.top+p,h=e.getPlacement?.()??r,g=h===`top-start`||h===`top-end`?m-i-u.height:l.bottom+i,_=h===`bottom-end`||h===`top-end`?l.right-u.width:l.left,v=o?.()??null;if(v!=null){let e=Math.max(l.left,l.right-u.width);_=Math.min(Math.max(l.left+v,l.left),e)}if(e.viewportPadding!==void 0){let n=e.viewportPadding,r=t.ownerDocument.defaultView,a=r?.innerHeight??0,o=r?.innerWidth??0,s=m-i-n,c=a-l.bottom-i-n;g=(h.startsWith(`top`)?s>=u.height||s>=c:!(c>=u.height||c>=s))?m-i-u.height:l.bottom+i,g=Math.max(n,Math.min(g,a-n-u.height)),_=Math.max(n,Math.min(_,o-n-u.width))}n.style.top=`${g}px`,n.style.left=`${_}px`},h=()=>{f&&(f=!1,p&&=(p(),null),n.remove())},g=()=>{if(f)return;f=!0,c!=null&&(n.style.zIndex=String(c)),m();let r=(t.ownerDocument??document).defaultView??window,i=t.ownerDocument??document,a=()=>{t.isConnected?m():(h(),u?.(`anchor-removed`))},o=e=>{let r=typeof e.composedPath==`function`?e.composedPath():[];r.includes(n)||r.includes(t)||(h(),u?.(`outside`))},s=e.viewportPadding!==void 0&&r.ResizeObserver?new r.ResizeObserver(a):null;s?.observe(n),s?.observe(t);let d=r.setTimeout(()=>{i.addEventListener(`pointerdown`,o,!0)},0);r.addEventListener(`scroll`,a,!0),r.addEventListener(`resize`,a);let g=t.closest(`[data-persona-root]`);g?.addEventListener(`persona:internal:host-moved`,a),p=()=>{s?.disconnect(),r.clearTimeout(d),i.removeEventListener(`pointerdown`,o,!0),r.removeEventListener(`scroll`,a,!0),r.removeEventListener(`resize`,a),g?.removeEventListener(`persona:internal:host-moved`,a)},l?.()};return{get isOpen(){return f},open:g,close:h,toggle:()=>f?h():g(),reposition:m,destroy:h}}const w=/\s/;function T(e,t,n){if(n===`input-start`)return t===0;let r=t>0?e[t-1]:``;return n===`line-start`?r===``||r===`
9
+ `)){let e=/^ {0,3}(`+)/.exec(n);e&&e[1].length>t&&(t=e[1].length)}return t}function d(e,t){let n="`".repeat(Math.max(3,u(t)+1));return`${n}${e}\n${t}\n${n}`}function f(e,t,n){return t.includes(`</document_content>`)?d(e,t):`<document index="${n+1}">\n<source>${e}</source>\n<document_content>\n${t}\n</document_content>\n</document>`}function p(e,t,n=`fenced`){if(typeof n==`function`)try{return n(e,t)}catch(t){return console.warn(`[persona] contextMentions.llmFormat threw; falling back to the fenced format for this mention`,t),d(e.label,e.text)}return n===`document`?f(e.label,e.text,t):d(e.label,e.text)}function m(e,t){return{sourceId:e.id,itemId:t.id,label:t.label,iconName:t.iconName,color:t.color}}const h=(e,t)=>`${e}\u0000${t}`;var g=class{#e;constructor(e){this.mentions=[],this.#e=e,this.#o()}get#t(){return this.#e.mentionConfig.maxMentions??8}hasMentions(){return this.mentions.length>0}add(e,t,n=``){let r=h(e.id,t.id);if(this.mentions.some(e=>e.key===r))return this.#n(e,t,`duplicate`);if(this.atLimit())return this.#n(e,t,`limit`);let i=m(e,t),a={key:r,source:e,item:t,ref:i,status:`resolving`,args:n};return a.chip=c({ref:i,config:this.#e.mentionConfig,onRemove:()=>this.remove(r)}),a.chip.el.setAttribute(`data-persona-chip-enter`,``),a.chip.el.addEventListener(`animationend`,()=>a.chip?.el.removeAttribute(`data-persona-chip-enter`),{once:!0}),this.#e.contextRow.appendChild(a.chip.el),this.#r(a),this.#o(),!0}atLimit(){return this.mentions.length>=this.#t}admit(e,t){return!this.atLimit()||this.#n(e,t,`limit`)}track(e,t,n,r=``,i){let a={key:e,source:t,item:n,ref:m(t,n),status:`resolving`,args:r,reportStatus:i};this.#r(a)}#n(e,t,n){return this.#e.mentionConfig.onMentionRejected?.(t,n),this.#e.emit?.(`rejected`,{sourceId:e.id,itemId:t.id,reason:n}),!1}#r(e){this.mentions.push(e),e.source.resolveOn===`submit`?(e.status=`ready`,e.chip?.setStatus(`ready`),e.reportStatus?.(`resolved`)):e.resolvePromise=this.#a(e),this.#e.announce(`Added ${e.ref.label} to context`)}#i(e,t,n=this.#e.getComposerText()){return{messages:this.#e.getMessages(),config:this.#e.getConfig(),composerText:n,args:t,signal:e}}async#a(e){let t=new AbortController;e.abort=t;try{let n=await e.source.resolve(e.item,this.#i(t.signal,e.args));if(t.signal.aborted)return;e.payload=n,e.status=`ready`,e.chip?.setStatus(`ready`,n),e.reportStatus?.(`resolved`)}catch(n){if(t.signal.aborted)return;e.status=`error`,e.chip?.setStatus(`error`),e.reportStatus?.(`error`),(this.#e.announceError??this.#e.announce)(`Couldn't attach ${e.ref.label} to context`),this.#e.mentionConfig.onMentionResolveError?.(e.item,n),this.#e.emit?.(`resolve-error`,{sourceId:e.source.id,itemId:e.item.id})}}remove(e){let t=this.mentions.findIndex(t=>t.key===e);if(t===-1)return;let[n]=this.mentions.splice(t,1);n.abort?.abort(),n.chip?.el.remove(),this.#o(),this.#e.announce(`Removed ${n.ref.label} from context`)}getRefs(){return this.mentions.map(e=>e.ref)}captureDraft(){return this.mentions.map(({key:e,source:t,item:n,ref:r,status:i,payload:a,args:o})=>({key:e,source:t,item:n,ref:r,status:i,payload:a,args:o}))}restoreDraft(e,t){this.clear();let n=[...this.#e.mentionConfig.sources??[],...(this.#e.mentionConfig.triggers??[]).flatMap(e=>e.sources)];for(let r of e){let e=n.find(e=>e.id===r.source.id);if(!e)continue;let i={...r,source:e};t.getDocument?.().blocks.some(e=>e.kind===`mention`&&e.id===r.key)?i.reportStatus=e=>t.setMentionStatus?.(r.key,e):(i.chip=c({ref:r.ref,config:this.#e.mentionConfig,onRemove:()=>this.remove(r.key)}),this.#e.contextRow.appendChild(i.chip.el)),this.mentions.push(i),i.status===`resolving`?i.resolvePromise=this.#a(i):(i.chip?.setStatus(i.status,i.payload),i.reportStatus?.(i.status===`ready`?`resolved`:`error`))}this.#o()}removeLast(){let e=this.mentions[this.mentions.length-1];return e?(this.remove(e.key),!0):!1}clear(){for(let e of this.mentions)e.abort?.abort(),e.chip?.el.remove();this.mentions.length=0,this.#o()}collectForSubmit(){let e=[...this.mentions],t=e.map(e=>e.ref),n=this.#e.getComposerText();for(let t of e)t.chip?.el.remove();return this.mentions.length=0,this.#o(),{refs:t,finalize:async()=>{let t=await Promise.all(e.map(async e=>{try{return e.source.resolveOn===`submit`?await e.source.resolve(e.item,this.#i(new AbortController().signal,e.args,n)):(e.resolvePromise&&await e.resolvePromise,e.payload??null)}catch(t){try{this.#e.mentionConfig.onMentionResolveError?.(e.item,t)}catch(e){typeof console<`u`&&console.warn(`[Persona] onMentionResolveError callback threw`,e)}return this.#e.emit?.(`resolve-error`,{sourceId:e.source.id,itemId:e.item.id}),null}})),r=[],i=[],a={},o=/* @__PURE__ */ new Set;for(let n=0;n<e.length;n++){let s=e[n],c=t[n];if(!c)continue;let l=h(s.source.id,s.item.id);if(!o.has(l)){if(o.add(l),c.llmAppend&&c.llmAppend.trim())try{r.push(p({label:s.ref.label,text:c.llmAppend,ref:s.ref,item:s.item},r.length,this.#e.mentionConfig.llmFormat))}catch(e){typeof console<`u`&&console.warn(`[Persona] context-mention llmFormat threw`,e)}c.contentParts?.length&&i.push(...c.contentParts),c.context&&((a[s.source.id]??={})[s.item.id]=c.context)}}return{blocks:r,contentParts:i,context:a}}}}#o(){l(this.#e.contextRow)}};const _=e=>e.nodeType===Node.DOCUMENT_NODE,v=e=>e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host!==void 0;function y(e){let t=e.getRootNode?.();return t&&v(t)||t&&_(t)?t:e.ownerDocument??document}function b(e,t,n){let r=_(e)?e.head:e,i=t.replace(/["\\]/g,`\\$&`);if(r.querySelector(`style[data-persona-plugin-style="${i}"]`))return;let a=(_(e)?e:e.ownerDocument??document).createElement(`style`);a.setAttribute(`data-persona-plugin-style`,t),a.textContent=n,r.appendChild(a)}function x(e,t,n){if(_(e)||v(e)){b(e,t,n);return}let r=e;if(r.isConnected){b(y(r),t,n);return}let i=r.ownerDocument??document;b(i,t,n),queueMicrotask(()=>{let e=y(r);e!==i&&b(e,t,n)})}function S(e){let t=e.getRootNode?.();return t instanceof ShadowRoot?t:e.closest(`dialog[open]`)??(e.ownerDocument??document).body}function C(e){let{anchor:t,content:n,placement:r=`bottom-start`,offset:i=6,matchAnchorWidth:a=!1,horizontalOffset:o,verticalOffset:s,zIndex:c=2147483e3,onOpen:l,onDismiss:u}=e,d=()=>e.container??S(t),f=!1,p=null,m=[],h=()=>{let e=t.closest(`[data-persona-root]`);if(!e||e.contains(n))return;let{style:r}=e;for(let e of m)r.getPropertyValue(e)||n.style.removeProperty(e);m=Array.from(r).filter(e=>e.startsWith(`--`));for(let e of m)n.style.setProperty(e,r.getPropertyValue(e));for(let t of[`data-persona-color-scheme`,`data-persona-defaults`]){let r=e.getAttribute(t);r?n.setAttribute(t,r):n.removeAttribute(t)}},g=()=>{if(!f)return;let c=d();if(n.parentNode!==c){let e=n.contains(n.ownerDocument.activeElement)?n.ownerDocument.activeElement:null;c.appendChild(n),h(),e?.focus({preventScroll:!0})}let l=e.getAnchorRect?.()??t.getBoundingClientRect();n.style.position=`fixed`,a&&(n.style.minWidth=`${l.width}px`),o&&(n.style.maxWidth=`${l.width}px`);let u=n.getBoundingClientRect(),p=s?.()??null,m=p==null?l.top:l.top+p,g=e.getPlacement?.()??r,_=g===`top-start`||g===`top-end`?m-i-u.height:l.bottom+i,v=g===`bottom-end`||g===`top-end`?l.right-u.width:l.left,y=o?.()??null;if(y!=null){let e=Math.max(l.left,l.right-u.width);v=Math.min(Math.max(l.left+y,l.left),e)}if(e.viewportPadding!==void 0){let n=e.viewportPadding,r=t.ownerDocument.defaultView,a=r?.innerHeight??0,o=r?.innerWidth??0,s=m-i-n,c=a-l.bottom-i-n;_=(g.startsWith(`top`)?s>=u.height||s>=c:!(c>=u.height||c>=s))?m-i-u.height:l.bottom+i,_=Math.max(n,Math.min(_,a-n-u.height)),v=Math.max(n,Math.min(v,o-n-u.width))}n.style.top=`${_}px`,n.style.left=`${v}px`},_=()=>{f&&(f=!1,p&&=(p(),null),n.remove())},v=()=>{if(f)return;f=!0,c!=null&&(n.style.zIndex=String(c)),g();let r=(t.ownerDocument??document).defaultView??window,i=t.ownerDocument??document,a=()=>{t.isConnected?g():(_(),u?.(`anchor-removed`))},o=e=>{let r=typeof e.composedPath==`function`?e.composedPath():[];r.includes(n)||r.includes(t)||(_(),u?.(`outside`))},s=e.viewportPadding!==void 0&&r.ResizeObserver?new r.ResizeObserver(a):null;s?.observe(n),s?.observe(t);let d=r.setTimeout(()=>{i.addEventListener(`pointerdown`,o,!0)},0);r.addEventListener(`scroll`,a,!0),r.addEventListener(`resize`,a);let m=t.closest(`[data-persona-root]`);m?.addEventListener(`persona:internal:host-moved`,a);let v;m&&r.MutationObserver&&(v=new r.MutationObserver(h),v.observe(m,{attributeFilter:[`style`,`data-persona-color-scheme`]})),p=()=>{s?.disconnect(),v?.disconnect(),r.clearTimeout(d),i.removeEventListener(`pointerdown`,o,!0),r.removeEventListener(`scroll`,a,!0),r.removeEventListener(`resize`,a),m?.removeEventListener(`persona:internal:host-moved`,a)},l?.()};return{get isOpen(){return f},open:v,close:_,toggle:()=>f?_():v(),reposition:g,destroy:_}}const w=/\s/;function T(e,t,n){if(n===`input-start`)return t===0;let r=t>0?e[t-1]:``;return n===`line-start`?r===``||r===`
10
10
  `:r===``||w.test(r)}function E(e,t,n=`@`,r=`anywhere`,i=!1){if(!n||t<=0||t>e.length)return null;let a=t-1;for(;a>=0;){let o=e[a];if(o===n)return T(e,a,r)?{triggerIndex:a,query:e.slice(a+1,t)}:null;if(o===`
11
11
  `||o===``||!i&&w.test(o))return null;a--}return null}function D(e,t,n){for(let r of n){let n=E(e,t,r.trigger,r.position??`anywhere`,r.allowSpaces??!1);if(n)return{channel:r,match:n}}return null}function O(e,t,n){return{value:e.slice(0,t.triggerIndex)+e.slice(n),caret:t.triggerIndex}}function k(e){return[{trigger:e.trigger??`@`,position:e.triggerPosition??`anywhere`,allowSpaces:!1,sources:Array.isArray(e.sources)?e.sources:[],searchPlaceholder:e.searchPlaceholder,showButton:e.showButton!==!1,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText},...(e.triggers??[]).map(e=>({trigger:e.trigger,position:e.triggerPosition??`anywhere`,allowSpaces:e.allowSpaces??!1,sources:Array.isArray(e.sources)?e.sources:[],searchPlaceholder:e.searchPlaceholder,showButton:e.showButton===!0,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText}))]}function A(e){let t=e.replace(/^\s+/,``),n=t.search(/\s/);return n===-1?{name:t,args:``}:{name:t.slice(0,n),args:t.slice(n+1).trim()}}const j=/* @__PURE__ */ new Map,M=(e,t,n)=>{let r=`${e}|${t}|${n}`,i=j.get(r);return i===void 0&&(i=s(e,t,`currentColor`,n),j.set(r,i)),i?i.cloneNode(!0):null};function N(e){let{config:a,listboxId:o}=e,s=n(`div`,{className:`persona-mention-menu`,attrs:{"data-persona-mention-menu":``}}),c=n(`div`,{className:`persona-mention-search`,style:{display:`none`}}),l=t(`span`,`persona-mention-search-icon`),u=i(r.Search,15,`currentColor`,2);u&&l.appendChild(u);let d=n(`input`,{className:`persona-mention-search-input`,attrs:{type:`text`,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":`false`,"aria-controls":o,"aria-label":a.searchPlaceholder??`Search context`,placeholder:a.searchPlaceholder??`Search context…`,autocomplete:`off`,autocapitalize:`off`,spellcheck:`false`}});c.append(l,d),d.addEventListener(`input`,()=>e.onSearchInput?.(d.value)),d.addEventListener(`keydown`,t=>e.onSearchKeydown?.(t));let f=n(`div`,{className:`persona-mention-list`,attrs:{role:`listbox`,id:o,"aria-label":`Context mentions`}});s.append(c,f);let p=[],m=[],h=-1,g=/* @__PURE__ */ new Map,_=(e,t)=>`${e}${t}`,v=e=>`${o}-opt-${e}`,y=e=>`${o}-grp-${e}`,b=(e,t)=>{let n=p[e];n&&(t?n.setAttribute(`data-active`,`true`):n.removeAttribute(`data-active`),n.setAttribute(`aria-selected`,t?`true`:`false`),m[e]?.(t))},x=(e,t=!0)=>{h>=0&&h!==e&&b(h,!1),h=e;let n=p[e];n?(b(e,!0),t&&n.scrollIntoView?.({block:`nearest`}),f.setAttribute(`aria-activedescendant`,n.id),d.setAttribute(`aria-activedescendant`,n.id)):(f.removeAttribute(`aria-activedescendant`),d.removeAttribute(`aria-activedescendant`))},S=(e,t)=>{let r=y(t),i=n(`div`,{className:`persona-mention-group`,attrs:{role:`group`,"aria-labelledby":r}});return i.appendChild(n(`div`,{className:`persona-mention-group-header`,attrs:{id:r},text:e})),i},C=()=>{let r=n(`div`,{className:`persona-mention-option`,attrs:{role:`option`,"aria-selected":`false`}}),i=t(`span`,`persona-mention-option-icon`);r.appendChild(i);let o=``,s=t(`span`,`persona-mention-option-text`),c=t(`span`,`persona-mention-option-labelline`),l=t(`span`,`persona-mention-option-label`);c.appendChild(l),s.appendChild(c),r.appendChild(s);let u=null,d=null,f={el:r,index:0,update:(e,n,p)=>{f.index=n,r.id=v(n),r.setAttribute(`aria-setsize`,String(p)),r.setAttribute(`aria-posinset`,String(n+1)),r.removeAttribute(`data-active`),r.setAttribute(`aria-selected`,`false`);let m=e.iconName??a.chipIconName??`at-sign`;if(m!==o){o=m;let e=M(m,15,2);i.replaceChildren(...e?[e]:[])}l.textContent!==e.label&&(l.textContent=e.label);let h=e.commandArgsPlaceholder?`‹${e.commandArgsPlaceholder}›`:null;h?(u||(u=t(`span`,`persona-mention-option-arghint`),c.appendChild(u)),u.textContent!==h&&(u.textContent=h)):u&&=(u.remove(),null),e.description?(d||(d=t(`span`,`persona-mention-option-desc`),s.appendChild(d)),d.textContent!==e.description&&(d.textContent=e.description)):d&&=(d.remove(),null)}};return r.addEventListener(`mousedown`,t=>{t.button===0&&(t.preventDefault(),e.onSelectIndex(f.index))}),r.addEventListener(`mouseenter`,()=>e.onHoverIndex(f.index)),f},w=(t,r,i,o,s)=>{let c=n(`div`,{className:`persona-mention-option`,attrs:{role:`option`,id:v(o),"aria-selected":`false`,"aria-setsize":String(s),"aria-posinset":String(o+1)}}),l=e=>{c.replaceChildren(a.renderMentionItem({item:t,source:r,query:i,active:e,index:o}))};return l(!1),c.addEventListener(`mousedown`,t=>{t.button===0&&(t.preventDefault(),e.onSelectIndex(o))}),c.addEventListener(`mouseenter`,()=>e.onHoverIndex(o)),{el:c,paint:l}},T=t=>{let r=n(`div`,{className:`persona-mention-status persona-mention-error`});if(r.appendChild(n(`span`,{className:`persona-mention-error-text`,text:`Couldn't load ${t.label}`})),e.onRetry){let i=n(`button`,{className:`persona-mention-retry`,attrs:{type:`button`},text:`Retry`});i.addEventListener(`mousedown`,e=>e.preventDefault()),i.addEventListener(`click`,n=>{n.preventDefault(),e.onRetry(t.id)}),r.appendChild(i)}return r};return{el:s,render:e=>{f.replaceChildren(),p=[],m=[],h=-1;let t=/* @__PURE__ */ new Set,r=0,i=0,o=0,s=0,c=0,l=e.groups.reduce((e,t)=>t.status===`ready`?e+t.items.length:e,0);for(let u of e.groups)if(u.status===`loading`){o++;let e=S(u.source.label,c++);e.appendChild(n(`div`,{className:`persona-mention-status persona-mention-loading`,attrs:{role:`presentation`},text:`Loading…`})),f.appendChild(e)}else if(u.status===`error`){s++;let e=S(u.source.label,c++);e.appendChild(T(u.source)),f.appendChild(e)}else if(u.status===`ready`&&u.items.length>0){let o=/* @__PURE__ */ new Map;for(let e of u.items){let t=e.group??u.source.label,n=o.get(t);n?n.push(e):o.set(t,[e])}let s=Array.from(o.entries());s.forEach(([o,d],h)=>{let v=S(o,c++);for(let n of d){let o=r++,s;if(a.renderMentionItem){let t=w(n,u.source,e.query,o,l);s=t.el,m.push(t.paint)}else{let e=_(u.source.id,n.id),r=t.has(e)?void 0:g.get(e);r||(r=C(),t.has(e)||g.set(e,r)),t.add(e),r.update(n,o,l),s=r.el,m.push(null)}p.push(s),v.appendChild(s),i++}u.truncated&&h===s.length-1&&v.appendChild(n(`div`,{className:`persona-mention-hint`,attrs:{role:`presentation`},text:`Keep typing to narrow…`})),f.appendChild(v)})}for(let e of g.keys())t.has(e)||g.delete(e);i===0&&o===0&&s===0&&f.appendChild(n(`div`,{className:`persona-mention-empty`,attrs:{role:`presentation`},text:`No matches`})),p.length>0?x(Math.min(Math.max(0,e.activeIndex),p.length-1)):(f.removeAttribute(`aria-activedescendant`),d.removeAttribute(`aria-activedescendant`))},setActiveIndex:x,destroy:()=>{f.replaceChildren(),p=[],g.clear(),s.remove()},showSearch:(e,t)=>{d.value=e,t&&(d.placeholder=t),c.style.display=``,d.setAttribute(`aria-expanded`,`true`),d.focus(),typeof requestAnimationFrame==`function`&&requestAnimationFrame(()=>{c.style.display!==`none`&&d.focus()})},hideSearch:()=>{c.style.display=`none`,d.value=``,d.setAttribute(`aria-expanded`,`false`),d.removeAttribute(`aria-activedescendant`)}}}const P=e=>!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`;let F=0;var I=class{#e;#t;#n;#r;#i;#a;#o;#s=null;#c=null;#l=!1;#u=``;#d=null;#f=0;#p=null;#m=!1;#h=null;#g=[];#_=[];#v=0;#y=null;#b=null;#x=/* @__PURE__ */ new Set;#S=/* @__PURE__ */ new Set;#C=-1;#w=null;#T=null;constructor(e){this.#e=e;let t=e.mentionConfig,n=k(t),r=n.filter(e=>e.sources.length>0);this.#t=r.length>0?r:[n[0]],this.#n=this.#t[0],this.#r=t.maxItemsPerGroup??6,this.#i=t.searchDebounceMs??150,this.#o=`persona-mention-listbox-${++F}`,this.#a=e.mentionConfig.renderMentionMenu?this.#E():N({config:e.mentionConfig,listboxId:this.#o,onSelectIndex:e=>this.#G(e),onHoverIndex:e=>this.#H(e,!1),onRetry:e=>this.#W(e),onSearchInput:e=>this.#N(e),onSearchKeydown:e=>{this.handleKeydown(e)}});let i=e.composerInput.element;i.setAttribute(`aria-haspopup`,`listbox`),i.setAttribute(`aria-controls`,this.#o)}get input(){return this.#e.composerInput}#E(){let e=document.createElement(`div`);e.setAttribute(`data-persona-mention-menu`,``),e.setAttribute(`role`,`listbox`),e.id=this.#o;let t=()=>{let t=this.#e.mentionConfig.renderMentionMenu({query:this.#u,groups:this.#g.map(e=>({source:e.source,items:e.items})),status:Object.fromEntries(this.#g.map(e=>[e.source.id,e.status])),activeIndex:this.#f,select:e=>{let t=this.#g.find(t=>t.items.includes(e));t&&this.#J(t.source,e)},close:()=>this.close()});e.replaceChildren(t)};return{el:e,render:t,setActiveIndex:t,destroy:()=>e.remove()}}isOpen(){return this.#l}openFromButton(e){let t=e&&this.#t.find(t=>t.trigger===e)||this.#t[0],n=this.input.getSelection().start,r=D(this.input.getLogicalText(),n,[t]);if(r){this.#m=!1,this.#d=r.match,this.#l?(this.#D(t),this.#N(r.match.query)):this.#O(r.match.query,t),this.input.focus();return}let i=this.#h;this.#m=!0,this.#h=t.trigger,this.#d=null,this.#l?(i&&i!==t.trigger&&this.#e.onPickerOpenChange?.(!1,i,this.#o),this.#D(t),this.#N(``)):this.#O(``,t),this.#a.showSearch?this.#a.showSearch(``,t.searchPlaceholder):this.input.focus(),this.#e.onPickerOpenChange?.(!0,t.trigger,this.#o)}onInput(){let e=this.input.getSelection().start,t=D(this.input.getLogicalText(),e,this.#t);t?this.#Q(t.channel,t.match.query)?(this.#d=null,this.#l&&this.close(!1)):(this.#d=t.match,this.#l?(this.#D(t.channel),this.#T!==t.match.triggerIndex&&this.#M(),this.#N(t.match.query)):this.#O(t.match.query,t.channel)):this.#l&&this.close()}#D(e){e!==this.#n&&(this.#n=e,this.#g=[],this.#f=0)}#O(e,t){if(this.#l=!0,this.#n=t,this.#g=[],this.#f=0,this.#C=-1,!this.#s){let e=this.#j();if(this.#s=C({anchor:this.#e.anchor,content:this.#a.el,placement:`top-start`,matchAnchorWidth:!e,offset:6,container:this.#e.popoverContainer,horizontalOffset:e?()=>this.#w?.x??null:void 0,verticalOffset:e?()=>this.#w?.y??null:void 0,onDismiss:()=>this.close(!1)}),e){let e=this.#e.anchor.getBoundingClientRect().width;this.#a.el.style.minWidth=`${Math.min(220,e)}px`}}this.#M(),this.#s.open(),x(this.#a.el,`persona-mention-menu`,`
12
12
  .persona-mention-menu {
@@ -1,6 +1,6 @@
1
- import { B as AgentWidgetContextMentionRef, Ct as AgentWidgetMessage, F as AgentWidgetContextMentionConfig, k as AgentWidgetConfig } from "./types-BC7MRxO5.cjs";
2
- import { t as ComposerInputCapability } from "./composer-input-i_FiUp6J.cjs";
3
- import { n as MentionSubmitBundle, t as ContextMentionDraft } from "./context-mention-manager-DL-xwGfL.cjs";
1
+ import { B as AgentWidgetContextMentionRef, Ct as AgentWidgetMessage, F as AgentWidgetContextMentionConfig, k as AgentWidgetConfig } from "./types-9i0xcAMT.cjs";
2
+ import { t as ComposerInputCapability } from "./composer-input-BSDNPOqV.cjs";
3
+ import { n as MentionSubmitBundle, t as ContextMentionDraft } from "./context-mention-manager-CCpeoGL2.cjs";
4
4
  /**
5
5
  * Outcome of dispatching an inline slash command at submit (Slack-style). The UI
6
6
  * acts on the kind: an `"action"` already ran and nothing is sent; a `"prompt"`
@@ -1,6 +1,6 @@
1
- import { B as AgentWidgetContextMentionRef, Ct as AgentWidgetMessage, F as AgentWidgetContextMentionConfig, k as AgentWidgetConfig } from "./types-BC7MRxO5.js";
2
- import { t as ComposerInputCapability } from "./composer-input-i_FiUp6J.js";
3
- import { n as MentionSubmitBundle, t as ContextMentionDraft } from "./context-mention-manager-DL-xwGfL.js";
1
+ import { B as AgentWidgetContextMentionRef, Ct as AgentWidgetMessage, F as AgentWidgetContextMentionConfig, k as AgentWidgetConfig } from "./types-9i0xcAMT.js";
2
+ import { t as ComposerInputCapability } from "./composer-input-BSDNPOqV.js";
3
+ import { n as MentionSubmitBundle, t as ContextMentionDraft } from "./context-mention-manager-CCpeoGL2.js";
4
4
  /**
5
5
  * Outcome of dispatching an inline slash command at submit (Slack-style). The UI
6
6
  * acts on the kind: an `"action"` already ran and nothing is sent; a `"prompt"`
@@ -20,7 +20,7 @@ i(),o()}));
20
20
  * See the LICENSE file in the root directory of this source tree.
21
21
  */
22
22
  s();const c=(e,t=24,n=`currentColor`,r=2)=>{if(!Array.isArray(e))return null;let i=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[e,a]of Object.entries({width:String(t),height:String(t),viewBox:`0 0 24 24`,fill:`none`,stroke:n,"stroke-width":String(r),"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`}))i.setAttribute(e,a);for(let t of e){if(!Array.isArray(t)||t.length<2)continue;let e=t[0],n=t[1];if(!n)continue;let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);for(let[e,t]of Object.entries(n))e!==`stroke`&&r.setAttribute(e,String(t));i.appendChild(r)}return i};let l=null;const u=e=>{l=e},d=(e,t,n,r)=>l?.(e,t,n,r)??null;function f(e){let{ref:r,config:i,onRemove:o}=e;if(i.renderMentionChip){let e=`resolving`,t,n=i.renderMentionChip({ref:r,status:e,payload:t,remove:o});return{get el(){return n},setStatus:(a,s)=>{if(a===e&&s===t)return;e=a,t=s;let c=i.renderMentionChip({ref:r,status:e,payload:t,remove:o});n.replaceWith(c),n=c}}}let s=r.iconName??i.chipIconName??`at-sign`,l=n(`div`,{className:`persona-mention-chip`,attrs:{"data-persona-mention-chip":``,"data-status":`resolving`,title:r.label}}),u=t(`span`,`persona-mention-chip-icon`),f=e=>{u.replaceChildren();let t=d(e,13,`currentColor`,2);t&&u.appendChild(t)};f(s);let p=t(`span`,`persona-mention-chip-spinner`),m=n(`span`,{className:`persona-mention-chip-label`,text:r.label}),h=n(`button`,{className:`persona-mention-chip-remove`,attrs:{type:`button`,"aria-label":`Remove ${r.label} context`}}),g=c(a,11,`currentColor`,2.5);return g?h.appendChild(g):h.textContent=`×`,h.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),o()}),l.appendChild(p),l.appendChild(m),l.appendChild(h),{el:l,setStatus:e=>{l.setAttribute(`data-status`,e),e===`resolving`?(p.parentNode!==l&&l.insertBefore(p,m),u.parentNode===l&&u.remove(),l.setAttribute(`title`,r.label)):(p.parentNode===l&&p.remove(),u.parentNode!==l&&l.insertBefore(u,m),e===`error`?(f(`triangle-alert`),l.setAttribute(`title`,`Couldn't add ${r.label} to context`)):(f(s),l.setAttribute(`title`,r.label)))}}}function p(e){e.style.display=e.childElementCount>0?`flex`:`none`}function m(e){let t=0;for(let n of e.split(`
23
- `)){let e=/^ {0,3}(`+)/.exec(n);e&&e[1].length>t&&(t=e[1].length)}return t}function h(e,t){let n="`".repeat(Math.max(3,m(t)+1));return`${n}${e}\n${t}\n${n}`}function g(e,t,n){return t.includes(`</document_content>`)?h(e,t):`<document index="${n+1}">\n<source>${e}</source>\n<document_content>\n${t}\n</document_content>\n</document>`}function _(e,t,n=`fenced`){if(typeof n==`function`)try{return n(e,t)}catch(t){return console.warn(`[persona] contextMentions.llmFormat threw; falling back to the fenced format for this mention`,t),h(e.label,e.text)}return n===`document`?g(e.label,e.text,t):h(e.label,e.text)}function v(e,t){return{sourceId:e.id,itemId:t.id,label:t.label,iconName:t.iconName,color:t.color}}const y=(e,t)=>`${e}\u0000${t}`;var b=class{#e;constructor(e){this.mentions=[],this.#e=e,this.#o()}get#t(){return this.#e.mentionConfig.maxMentions??8}hasMentions(){return this.mentions.length>0}add(e,t,n=``){let r=y(e.id,t.id);if(this.mentions.some(e=>e.key===r))return this.#n(e,t,`duplicate`);if(this.atLimit())return this.#n(e,t,`limit`);let i=v(e,t),a={key:r,source:e,item:t,ref:i,status:`resolving`,args:n};return a.chip=f({ref:i,config:this.#e.mentionConfig,onRemove:()=>this.remove(r)}),a.chip.el.setAttribute(`data-persona-chip-enter`,``),a.chip.el.addEventListener(`animationend`,()=>a.chip?.el.removeAttribute(`data-persona-chip-enter`),{once:!0}),this.#e.contextRow.appendChild(a.chip.el),this.#r(a),this.#o(),!0}atLimit(){return this.mentions.length>=this.#t}admit(e,t){return!this.atLimit()||this.#n(e,t,`limit`)}track(e,t,n,r=``,i){let a={key:e,source:t,item:n,ref:v(t,n),status:`resolving`,args:r,reportStatus:i};this.#r(a)}#n(e,t,n){return this.#e.mentionConfig.onMentionRejected?.(t,n),this.#e.emit?.(`rejected`,{sourceId:e.id,itemId:t.id,reason:n}),!1}#r(e){this.mentions.push(e),e.source.resolveOn===`submit`?(e.status=`ready`,e.chip?.setStatus(`ready`),e.reportStatus?.(`resolved`)):e.resolvePromise=this.#a(e),this.#e.announce(`Added ${e.ref.label} to context`)}#i(e,t,n=this.#e.getComposerText()){return{messages:this.#e.getMessages(),config:this.#e.getConfig(),composerText:n,args:t,signal:e}}async#a(e){let t=new AbortController;e.abort=t;try{let n=await e.source.resolve(e.item,this.#i(t.signal,e.args));if(t.signal.aborted)return;e.payload=n,e.status=`ready`,e.chip?.setStatus(`ready`,n),e.reportStatus?.(`resolved`)}catch(n){if(t.signal.aborted)return;e.status=`error`,e.chip?.setStatus(`error`),e.reportStatus?.(`error`),(this.#e.announceError??this.#e.announce)(`Couldn't attach ${e.ref.label} to context`),this.#e.mentionConfig.onMentionResolveError?.(e.item,n),this.#e.emit?.(`resolve-error`,{sourceId:e.source.id,itemId:e.item.id})}}remove(e){let t=this.mentions.findIndex(t=>t.key===e);if(t===-1)return;let[n]=this.mentions.splice(t,1);n.abort?.abort(),n.chip?.el.remove(),this.#o(),this.#e.announce(`Removed ${n.ref.label} from context`)}getRefs(){return this.mentions.map(e=>e.ref)}captureDraft(){return this.mentions.map(({key:e,source:t,item:n,ref:r,status:i,payload:a,args:o})=>({key:e,source:t,item:n,ref:r,status:i,payload:a,args:o}))}restoreDraft(e,t){this.clear();let n=[...this.#e.mentionConfig.sources??[],...(this.#e.mentionConfig.triggers??[]).flatMap(e=>e.sources)];for(let r of e){let e=n.find(e=>e.id===r.source.id);if(!e)continue;let i={...r,source:e};t.getDocument?.().blocks.some(e=>e.kind===`mention`&&e.id===r.key)?i.reportStatus=e=>t.setMentionStatus?.(r.key,e):(i.chip=f({ref:r.ref,config:this.#e.mentionConfig,onRemove:()=>this.remove(r.key)}),this.#e.contextRow.appendChild(i.chip.el)),this.mentions.push(i),i.status===`resolving`?i.resolvePromise=this.#a(i):(i.chip?.setStatus(i.status,i.payload),i.reportStatus?.(i.status===`ready`?`resolved`:`error`))}this.#o()}removeLast(){let e=this.mentions[this.mentions.length-1];return e?(this.remove(e.key),!0):!1}clear(){for(let e of this.mentions)e.abort?.abort(),e.chip?.el.remove();this.mentions.length=0,this.#o()}collectForSubmit(){let e=[...this.mentions],t=e.map(e=>e.ref),n=this.#e.getComposerText();for(let t of e)t.chip?.el.remove();return this.mentions.length=0,this.#o(),{refs:t,finalize:async()=>{let t=await Promise.all(e.map(async e=>{try{return e.source.resolveOn===`submit`?await e.source.resolve(e.item,this.#i(new AbortController().signal,e.args,n)):(e.resolvePromise&&await e.resolvePromise,e.payload??null)}catch(t){try{this.#e.mentionConfig.onMentionResolveError?.(e.item,t)}catch(e){typeof console<`u`&&console.warn(`[Persona] onMentionResolveError callback threw`,e)}return this.#e.emit?.(`resolve-error`,{sourceId:e.source.id,itemId:e.item.id}),null}})),r=[],i=[],a={},o=/* @__PURE__ */ new Set;for(let n=0;n<e.length;n++){let s=e[n],c=t[n];if(!c)continue;let l=y(s.source.id,s.item.id);if(!o.has(l)){if(o.add(l),c.llmAppend&&c.llmAppend.trim())try{r.push(_({label:s.ref.label,text:c.llmAppend,ref:s.ref,item:s.item},r.length,this.#e.mentionConfig.llmFormat))}catch(e){typeof console<`u`&&console.warn(`[Persona] context-mention llmFormat threw`,e)}c.contentParts?.length&&i.push(...c.contentParts),c.context&&((a[s.source.id]??={})[s.item.id]=c.context)}}return{blocks:r,contentParts:i,context:a}}}}#o(){p(this.#e.contextRow)}};const x=e=>e.nodeType===Node.DOCUMENT_NODE,S=e=>e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host!==void 0;function C(e){let t=e.getRootNode?.();return t&&S(t)||t&&x(t)?t:e.ownerDocument??document}function w(e,t,n){let r=x(e)?e.head:e,i=t.replace(/["\\]/g,`\\$&`);if(r.querySelector(`style[data-persona-plugin-style="${i}"]`))return;let a=(x(e)?e:e.ownerDocument??document).createElement(`style`);a.setAttribute(`data-persona-plugin-style`,t),a.textContent=n,r.appendChild(a)}function T(e,t,n){if(x(e)||S(e)){w(e,t,n);return}let r=e;if(r.isConnected){w(C(r),t,n);return}let i=r.ownerDocument??document;w(i,t,n),queueMicrotask(()=>{let e=C(r);e!==i&&w(e,t,n)})}function E(e){let t=e.getRootNode?.();return t instanceof ShadowRoot?t:e.closest(`dialog[open]`)??(e.ownerDocument??document).body}function D(e){let{anchor:t,content:n,placement:r=`bottom-start`,offset:i=6,matchAnchorWidth:a=!1,horizontalOffset:o,verticalOffset:s,zIndex:c=2147483e3,onOpen:l,onDismiss:u}=e,d=()=>e.container??E(t),f=!1,p=null,m=()=>{if(!f)return;let c=d();if(n.parentNode!==c){let e=n.contains(n.ownerDocument.activeElement)?n.ownerDocument.activeElement:null;c.appendChild(n),e?.focus({preventScroll:!0})}let l=e.getAnchorRect?.()??t.getBoundingClientRect();n.style.position=`fixed`,a&&(n.style.minWidth=`${l.width}px`),o&&(n.style.maxWidth=`${l.width}px`);let u=n.getBoundingClientRect(),p=s?.()??null,m=p==null?l.top:l.top+p,h=e.getPlacement?.()??r,g=h===`top-start`||h===`top-end`?m-i-u.height:l.bottom+i,_=h===`bottom-end`||h===`top-end`?l.right-u.width:l.left,v=o?.()??null;if(v!=null){let e=Math.max(l.left,l.right-u.width);_=Math.min(Math.max(l.left+v,l.left),e)}if(e.viewportPadding!==void 0){let n=e.viewportPadding,r=t.ownerDocument.defaultView,a=r?.innerHeight??0,o=r?.innerWidth??0,s=m-i-n,c=a-l.bottom-i-n;g=(h.startsWith(`top`)?s>=u.height||s>=c:!(c>=u.height||c>=s))?m-i-u.height:l.bottom+i,g=Math.max(n,Math.min(g,a-n-u.height)),_=Math.max(n,Math.min(_,o-n-u.width))}n.style.top=`${g}px`,n.style.left=`${_}px`},h=()=>{f&&(f=!1,p&&=(p(),null),n.remove())},g=()=>{if(f)return;f=!0,c!=null&&(n.style.zIndex=String(c)),m();let r=(t.ownerDocument??document).defaultView??window,i=t.ownerDocument??document,a=()=>{t.isConnected?m():(h(),u?.(`anchor-removed`))},o=e=>{let r=typeof e.composedPath==`function`?e.composedPath():[];r.includes(n)||r.includes(t)||(h(),u?.(`outside`))},s=e.viewportPadding!==void 0&&r.ResizeObserver?new r.ResizeObserver(a):null;s?.observe(n),s?.observe(t);let d=r.setTimeout(()=>{i.addEventListener(`pointerdown`,o,!0)},0);r.addEventListener(`scroll`,a,!0),r.addEventListener(`resize`,a);let g=t.closest(`[data-persona-root]`);g?.addEventListener(`persona:internal:host-moved`,a),p=()=>{s?.disconnect(),r.clearTimeout(d),i.removeEventListener(`pointerdown`,o,!0),r.removeEventListener(`scroll`,a,!0),r.removeEventListener(`resize`,a),g?.removeEventListener(`persona:internal:host-moved`,a)},l?.()};return{get isOpen(){return f},open:g,close:h,toggle:()=>f?h():g(),reposition:m,destroy:h}}const O=/\s/;function k(e,t,n){if(n===`input-start`)return t===0;let r=t>0?e[t-1]:``;return n===`line-start`?r===``||r===`
23
+ `)){let e=/^ {0,3}(`+)/.exec(n);e&&e[1].length>t&&(t=e[1].length)}return t}function h(e,t){let n="`".repeat(Math.max(3,m(t)+1));return`${n}${e}\n${t}\n${n}`}function g(e,t,n){return t.includes(`</document_content>`)?h(e,t):`<document index="${n+1}">\n<source>${e}</source>\n<document_content>\n${t}\n</document_content>\n</document>`}function _(e,t,n=`fenced`){if(typeof n==`function`)try{return n(e,t)}catch(t){return console.warn(`[persona] contextMentions.llmFormat threw; falling back to the fenced format for this mention`,t),h(e.label,e.text)}return n===`document`?g(e.label,e.text,t):h(e.label,e.text)}function v(e,t){return{sourceId:e.id,itemId:t.id,label:t.label,iconName:t.iconName,color:t.color}}const y=(e,t)=>`${e}\u0000${t}`;var b=class{#e;constructor(e){this.mentions=[],this.#e=e,this.#o()}get#t(){return this.#e.mentionConfig.maxMentions??8}hasMentions(){return this.mentions.length>0}add(e,t,n=``){let r=y(e.id,t.id);if(this.mentions.some(e=>e.key===r))return this.#n(e,t,`duplicate`);if(this.atLimit())return this.#n(e,t,`limit`);let i=v(e,t),a={key:r,source:e,item:t,ref:i,status:`resolving`,args:n};return a.chip=f({ref:i,config:this.#e.mentionConfig,onRemove:()=>this.remove(r)}),a.chip.el.setAttribute(`data-persona-chip-enter`,``),a.chip.el.addEventListener(`animationend`,()=>a.chip?.el.removeAttribute(`data-persona-chip-enter`),{once:!0}),this.#e.contextRow.appendChild(a.chip.el),this.#r(a),this.#o(),!0}atLimit(){return this.mentions.length>=this.#t}admit(e,t){return!this.atLimit()||this.#n(e,t,`limit`)}track(e,t,n,r=``,i){let a={key:e,source:t,item:n,ref:v(t,n),status:`resolving`,args:r,reportStatus:i};this.#r(a)}#n(e,t,n){return this.#e.mentionConfig.onMentionRejected?.(t,n),this.#e.emit?.(`rejected`,{sourceId:e.id,itemId:t.id,reason:n}),!1}#r(e){this.mentions.push(e),e.source.resolveOn===`submit`?(e.status=`ready`,e.chip?.setStatus(`ready`),e.reportStatus?.(`resolved`)):e.resolvePromise=this.#a(e),this.#e.announce(`Added ${e.ref.label} to context`)}#i(e,t,n=this.#e.getComposerText()){return{messages:this.#e.getMessages(),config:this.#e.getConfig(),composerText:n,args:t,signal:e}}async#a(e){let t=new AbortController;e.abort=t;try{let n=await e.source.resolve(e.item,this.#i(t.signal,e.args));if(t.signal.aborted)return;e.payload=n,e.status=`ready`,e.chip?.setStatus(`ready`,n),e.reportStatus?.(`resolved`)}catch(n){if(t.signal.aborted)return;e.status=`error`,e.chip?.setStatus(`error`),e.reportStatus?.(`error`),(this.#e.announceError??this.#e.announce)(`Couldn't attach ${e.ref.label} to context`),this.#e.mentionConfig.onMentionResolveError?.(e.item,n),this.#e.emit?.(`resolve-error`,{sourceId:e.source.id,itemId:e.item.id})}}remove(e){let t=this.mentions.findIndex(t=>t.key===e);if(t===-1)return;let[n]=this.mentions.splice(t,1);n.abort?.abort(),n.chip?.el.remove(),this.#o(),this.#e.announce(`Removed ${n.ref.label} from context`)}getRefs(){return this.mentions.map(e=>e.ref)}captureDraft(){return this.mentions.map(({key:e,source:t,item:n,ref:r,status:i,payload:a,args:o})=>({key:e,source:t,item:n,ref:r,status:i,payload:a,args:o}))}restoreDraft(e,t){this.clear();let n=[...this.#e.mentionConfig.sources??[],...(this.#e.mentionConfig.triggers??[]).flatMap(e=>e.sources)];for(let r of e){let e=n.find(e=>e.id===r.source.id);if(!e)continue;let i={...r,source:e};t.getDocument?.().blocks.some(e=>e.kind===`mention`&&e.id===r.key)?i.reportStatus=e=>t.setMentionStatus?.(r.key,e):(i.chip=f({ref:r.ref,config:this.#e.mentionConfig,onRemove:()=>this.remove(r.key)}),this.#e.contextRow.appendChild(i.chip.el)),this.mentions.push(i),i.status===`resolving`?i.resolvePromise=this.#a(i):(i.chip?.setStatus(i.status,i.payload),i.reportStatus?.(i.status===`ready`?`resolved`:`error`))}this.#o()}removeLast(){let e=this.mentions[this.mentions.length-1];return e?(this.remove(e.key),!0):!1}clear(){for(let e of this.mentions)e.abort?.abort(),e.chip?.el.remove();this.mentions.length=0,this.#o()}collectForSubmit(){let e=[...this.mentions],t=e.map(e=>e.ref),n=this.#e.getComposerText();for(let t of e)t.chip?.el.remove();return this.mentions.length=0,this.#o(),{refs:t,finalize:async()=>{let t=await Promise.all(e.map(async e=>{try{return e.source.resolveOn===`submit`?await e.source.resolve(e.item,this.#i(new AbortController().signal,e.args,n)):(e.resolvePromise&&await e.resolvePromise,e.payload??null)}catch(t){try{this.#e.mentionConfig.onMentionResolveError?.(e.item,t)}catch(e){typeof console<`u`&&console.warn(`[Persona] onMentionResolveError callback threw`,e)}return this.#e.emit?.(`resolve-error`,{sourceId:e.source.id,itemId:e.item.id}),null}})),r=[],i=[],a={},o=/* @__PURE__ */ new Set;for(let n=0;n<e.length;n++){let s=e[n],c=t[n];if(!c)continue;let l=y(s.source.id,s.item.id);if(!o.has(l)){if(o.add(l),c.llmAppend&&c.llmAppend.trim())try{r.push(_({label:s.ref.label,text:c.llmAppend,ref:s.ref,item:s.item},r.length,this.#e.mentionConfig.llmFormat))}catch(e){typeof console<`u`&&console.warn(`[Persona] context-mention llmFormat threw`,e)}c.contentParts?.length&&i.push(...c.contentParts),c.context&&((a[s.source.id]??={})[s.item.id]=c.context)}}return{blocks:r,contentParts:i,context:a}}}}#o(){p(this.#e.contextRow)}};const x=e=>e.nodeType===Node.DOCUMENT_NODE,S=e=>e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.host!==void 0;function C(e){let t=e.getRootNode?.();return t&&S(t)||t&&x(t)?t:e.ownerDocument??document}function w(e,t,n){let r=x(e)?e.head:e,i=t.replace(/["\\]/g,`\\$&`);if(r.querySelector(`style[data-persona-plugin-style="${i}"]`))return;let a=(x(e)?e:e.ownerDocument??document).createElement(`style`);a.setAttribute(`data-persona-plugin-style`,t),a.textContent=n,r.appendChild(a)}function T(e,t,n){if(x(e)||S(e)){w(e,t,n);return}let r=e;if(r.isConnected){w(C(r),t,n);return}let i=r.ownerDocument??document;w(i,t,n),queueMicrotask(()=>{let e=C(r);e!==i&&w(e,t,n)})}function E(e){let t=e.getRootNode?.();return t instanceof ShadowRoot?t:e.closest(`dialog[open]`)??(e.ownerDocument??document).body}function D(e){let{anchor:t,content:n,placement:r=`bottom-start`,offset:i=6,matchAnchorWidth:a=!1,horizontalOffset:o,verticalOffset:s,zIndex:c=2147483e3,onOpen:l,onDismiss:u}=e,d=()=>e.container??E(t),f=!1,p=null,m=[],h=()=>{let e=t.closest(`[data-persona-root]`);if(!e||e.contains(n))return;let{style:r}=e;for(let e of m)r.getPropertyValue(e)||n.style.removeProperty(e);m=Array.from(r).filter(e=>e.startsWith(`--`));for(let e of m)n.style.setProperty(e,r.getPropertyValue(e));for(let t of[`data-persona-color-scheme`,`data-persona-defaults`]){let r=e.getAttribute(t);r?n.setAttribute(t,r):n.removeAttribute(t)}},g=()=>{if(!f)return;let c=d();if(n.parentNode!==c){let e=n.contains(n.ownerDocument.activeElement)?n.ownerDocument.activeElement:null;c.appendChild(n),h(),e?.focus({preventScroll:!0})}let l=e.getAnchorRect?.()??t.getBoundingClientRect();n.style.position=`fixed`,a&&(n.style.minWidth=`${l.width}px`),o&&(n.style.maxWidth=`${l.width}px`);let u=n.getBoundingClientRect(),p=s?.()??null,m=p==null?l.top:l.top+p,g=e.getPlacement?.()??r,_=g===`top-start`||g===`top-end`?m-i-u.height:l.bottom+i,v=g===`bottom-end`||g===`top-end`?l.right-u.width:l.left,y=o?.()??null;if(y!=null){let e=Math.max(l.left,l.right-u.width);v=Math.min(Math.max(l.left+y,l.left),e)}if(e.viewportPadding!==void 0){let n=e.viewportPadding,r=t.ownerDocument.defaultView,a=r?.innerHeight??0,o=r?.innerWidth??0,s=m-i-n,c=a-l.bottom-i-n;_=(g.startsWith(`top`)?s>=u.height||s>=c:!(c>=u.height||c>=s))?m-i-u.height:l.bottom+i,_=Math.max(n,Math.min(_,a-n-u.height)),v=Math.max(n,Math.min(v,o-n-u.width))}n.style.top=`${_}px`,n.style.left=`${v}px`},_=()=>{f&&(f=!1,p&&=(p(),null),n.remove())},v=()=>{if(f)return;f=!0,c!=null&&(n.style.zIndex=String(c)),g();let r=(t.ownerDocument??document).defaultView??window,i=t.ownerDocument??document,a=()=>{t.isConnected?g():(_(),u?.(`anchor-removed`))},o=e=>{let r=typeof e.composedPath==`function`?e.composedPath():[];r.includes(n)||r.includes(t)||(_(),u?.(`outside`))},s=e.viewportPadding!==void 0&&r.ResizeObserver?new r.ResizeObserver(a):null;s?.observe(n),s?.observe(t);let d=r.setTimeout(()=>{i.addEventListener(`pointerdown`,o,!0)},0);r.addEventListener(`scroll`,a,!0),r.addEventListener(`resize`,a);let m=t.closest(`[data-persona-root]`);m?.addEventListener(`persona:internal:host-moved`,a);let v;m&&r.MutationObserver&&(v=new r.MutationObserver(h),v.observe(m,{attributeFilter:[`style`,`data-persona-color-scheme`]})),p=()=>{s?.disconnect(),v?.disconnect(),r.clearTimeout(d),i.removeEventListener(`pointerdown`,o,!0),r.removeEventListener(`scroll`,a,!0),r.removeEventListener(`resize`,a),m?.removeEventListener(`persona:internal:host-moved`,a)},l?.()};return{get isOpen(){return f},open:v,close:_,toggle:()=>f?_():v(),reposition:g,destroy:_}}const O=/\s/;function k(e,t,n){if(n===`input-start`)return t===0;let r=t>0?e[t-1]:``;return n===`line-start`?r===``||r===`
24
24
  `:r===``||O.test(r)}function A(e,t,n=`@`,r=`anywhere`,i=!1){if(!n||t<=0||t>e.length)return null;let a=t-1;for(;a>=0;){let o=e[a];if(o===n)return k(e,a,r)?{triggerIndex:a,query:e.slice(a+1,t)}:null;if(o===`
25
25
  `||o===``||!i&&O.test(o))return null;a--}return null}function j(e,t,n){for(let r of n){let n=A(e,t,r.trigger,r.position??`anywhere`,r.allowSpaces??!1);if(n)return{channel:r,match:n}}return null}function M(e,t,n){return{value:e.slice(0,t.triggerIndex)+e.slice(n),caret:t.triggerIndex}}function N(e){return[{trigger:e.trigger??`@`,position:e.triggerPosition??`anywhere`,allowSpaces:!1,sources:Array.isArray(e.sources)?e.sources:[],searchPlaceholder:e.searchPlaceholder,showButton:e.showButton!==!1,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText},...(e.triggers??[]).map(e=>({trigger:e.trigger,position:e.triggerPosition??`anywhere`,allowSpaces:e.allowSpaces??!1,sources:Array.isArray(e.sources)?e.sources:[],searchPlaceholder:e.searchPlaceholder,showButton:e.showButton===!0,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText}))]}function P(e){let t=e.replace(/^\s+/,``),n=t.search(/\s/);return n===-1?{name:t,args:``}:{name:t.slice(0,n),args:t.slice(n+1).trim()}}s();const F=/* @__PURE__ */ new Map,I=(e,t,n)=>{let r=`${e}|${t}|${n}`,i=F.get(r);return i===void 0&&(i=d(e,t,`currentColor`,n),F.set(r,i)),i?i.cloneNode(!0):null};function L(e){let{config:i,listboxId:a}=e,o=n(`div`,{className:`persona-mention-menu`,attrs:{"data-persona-mention-menu":``}}),s=n(`div`,{className:`persona-mention-search`,style:{display:`none`}}),l=t(`span`,`persona-mention-search-icon`),u=c(r,15,`currentColor`,2);u&&l.appendChild(u);let d=n(`input`,{className:`persona-mention-search-input`,attrs:{type:`text`,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":`false`,"aria-controls":a,"aria-label":i.searchPlaceholder??`Search context`,placeholder:i.searchPlaceholder??`Search context…`,autocomplete:`off`,autocapitalize:`off`,spellcheck:`false`}});s.append(l,d),d.addEventListener(`input`,()=>e.onSearchInput?.(d.value)),d.addEventListener(`keydown`,t=>e.onSearchKeydown?.(t));let f=n(`div`,{className:`persona-mention-list`,attrs:{role:`listbox`,id:a,"aria-label":`Context mentions`}});o.append(s,f);let p=[],m=[],h=-1,g=/* @__PURE__ */ new Map,_=(e,t)=>`${e}${t}`,v=e=>`${a}-opt-${e}`,y=e=>`${a}-grp-${e}`,b=(e,t)=>{let n=p[e];n&&(t?n.setAttribute(`data-active`,`true`):n.removeAttribute(`data-active`),n.setAttribute(`aria-selected`,t?`true`:`false`),m[e]?.(t))},x=(e,t=!0)=>{h>=0&&h!==e&&b(h,!1),h=e;let n=p[e];n?(b(e,!0),t&&n.scrollIntoView?.({block:`nearest`}),f.setAttribute(`aria-activedescendant`,n.id),d.setAttribute(`aria-activedescendant`,n.id)):(f.removeAttribute(`aria-activedescendant`),d.removeAttribute(`aria-activedescendant`))},S=(e,t)=>{let r=y(t),i=n(`div`,{className:`persona-mention-group`,attrs:{role:`group`,"aria-labelledby":r}});return i.appendChild(n(`div`,{className:`persona-mention-group-header`,attrs:{id:r},text:e})),i},C=()=>{let r=n(`div`,{className:`persona-mention-option`,attrs:{role:`option`,"aria-selected":`false`}}),a=t(`span`,`persona-mention-option-icon`);r.appendChild(a);let o=``,s=t(`span`,`persona-mention-option-text`),c=t(`span`,`persona-mention-option-labelline`),l=t(`span`,`persona-mention-option-label`);c.appendChild(l),s.appendChild(c),r.appendChild(s);let u=null,d=null,f={el:r,index:0,update:(e,n,p)=>{f.index=n,r.id=v(n),r.setAttribute(`aria-setsize`,String(p)),r.setAttribute(`aria-posinset`,String(n+1)),r.removeAttribute(`data-active`),r.setAttribute(`aria-selected`,`false`);let m=e.iconName??i.chipIconName??`at-sign`;if(m!==o){o=m;let e=I(m,15,2);a.replaceChildren(...e?[e]:[])}l.textContent!==e.label&&(l.textContent=e.label);let h=e.commandArgsPlaceholder?`‹${e.commandArgsPlaceholder}›`:null;h?(u||(u=t(`span`,`persona-mention-option-arghint`),c.appendChild(u)),u.textContent!==h&&(u.textContent=h)):u&&=(u.remove(),null),e.description?(d||(d=t(`span`,`persona-mention-option-desc`),s.appendChild(d)),d.textContent!==e.description&&(d.textContent=e.description)):d&&=(d.remove(),null)}};return r.addEventListener(`mousedown`,t=>{t.button===0&&(t.preventDefault(),e.onSelectIndex(f.index))}),r.addEventListener(`mouseenter`,()=>e.onHoverIndex(f.index)),f},w=(t,r,a,o,s)=>{let c=n(`div`,{className:`persona-mention-option`,attrs:{role:`option`,id:v(o),"aria-selected":`false`,"aria-setsize":String(s),"aria-posinset":String(o+1)}}),l=e=>{c.replaceChildren(i.renderMentionItem({item:t,source:r,query:a,active:e,index:o}))};return l(!1),c.addEventListener(`mousedown`,t=>{t.button===0&&(t.preventDefault(),e.onSelectIndex(o))}),c.addEventListener(`mouseenter`,()=>e.onHoverIndex(o)),{el:c,paint:l}},T=t=>{let r=n(`div`,{className:`persona-mention-status persona-mention-error`});if(r.appendChild(n(`span`,{className:`persona-mention-error-text`,text:`Couldn't load ${t.label}`})),e.onRetry){let i=n(`button`,{className:`persona-mention-retry`,attrs:{type:`button`},text:`Retry`});i.addEventListener(`mousedown`,e=>e.preventDefault()),i.addEventListener(`click`,n=>{n.preventDefault(),e.onRetry(t.id)}),r.appendChild(i)}return r};return{el:o,render:e=>{f.replaceChildren(),p=[],m=[],h=-1;let t=/* @__PURE__ */ new Set,r=0,a=0,o=0,s=0,c=0,l=e.groups.reduce((e,t)=>t.status===`ready`?e+t.items.length:e,0);for(let u of e.groups)if(u.status===`loading`){o++;let e=S(u.source.label,c++);e.appendChild(n(`div`,{className:`persona-mention-status persona-mention-loading`,attrs:{role:`presentation`},text:`Loading…`})),f.appendChild(e)}else if(u.status===`error`){s++;let e=S(u.source.label,c++);e.appendChild(T(u.source)),f.appendChild(e)}else if(u.status===`ready`&&u.items.length>0){let o=/* @__PURE__ */ new Map;for(let e of u.items){let t=e.group??u.source.label,n=o.get(t);n?n.push(e):o.set(t,[e])}let s=Array.from(o.entries());s.forEach(([o,d],h)=>{let v=S(o,c++);for(let n of d){let o=r++,s;if(i.renderMentionItem){let t=w(n,u.source,e.query,o,l);s=t.el,m.push(t.paint)}else{let e=_(u.source.id,n.id),r=t.has(e)?void 0:g.get(e);r||(r=C(),t.has(e)||g.set(e,r)),t.add(e),r.update(n,o,l),s=r.el,m.push(null)}p.push(s),v.appendChild(s),a++}u.truncated&&h===s.length-1&&v.appendChild(n(`div`,{className:`persona-mention-hint`,attrs:{role:`presentation`},text:`Keep typing to narrow…`})),f.appendChild(v)})}for(let e of g.keys())t.has(e)||g.delete(e);a===0&&o===0&&s===0&&f.appendChild(n(`div`,{className:`persona-mention-empty`,attrs:{role:`presentation`},text:`No matches`})),p.length>0?x(Math.min(Math.max(0,e.activeIndex),p.length-1)):(f.removeAttribute(`aria-activedescendant`),d.removeAttribute(`aria-activedescendant`))},setActiveIndex:x,destroy:()=>{f.replaceChildren(),p=[],g.clear(),o.remove()},showSearch:(e,t)=>{d.value=e,t&&(d.placeholder=t),s.style.display=``,d.setAttribute(`aria-expanded`,`true`),d.focus(),typeof requestAnimationFrame==`function`&&requestAnimationFrame(()=>{s.style.display!==`none`&&d.focus()})},hideSearch:()=>{s.style.display=`none`,d.value=``,d.setAttribute(`aria-expanded`,`false`),d.removeAttribute(`aria-activedescendant`)}}}const R=e=>!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e.then==`function`;let z=0;var B=class{#e;#t;#n;#r;#i;#a;#o;#s=null;#c=null;#l=!1;#u=``;#d=null;#f=0;#p=null;#m=!1;#h=null;#g=[];#_=[];#v=0;#y=null;#b=null;#x=/* @__PURE__ */ new Set;#S=/* @__PURE__ */ new Set;#C=-1;#w=null;#T=null;constructor(e){this.#e=e;let t=e.mentionConfig,n=N(t),r=n.filter(e=>e.sources.length>0);this.#t=r.length>0?r:[n[0]],this.#n=this.#t[0],this.#r=t.maxItemsPerGroup??6,this.#i=t.searchDebounceMs??150,this.#o=`persona-mention-listbox-${++z}`,this.#a=e.mentionConfig.renderMentionMenu?this.#E():L({config:e.mentionConfig,listboxId:this.#o,onSelectIndex:e=>this.#G(e),onHoverIndex:e=>this.#H(e,!1),onRetry:e=>this.#W(e),onSearchInput:e=>this.#N(e),onSearchKeydown:e=>{this.handleKeydown(e)}});let i=e.composerInput.element;i.setAttribute(`aria-haspopup`,`listbox`),i.setAttribute(`aria-controls`,this.#o)}get input(){return this.#e.composerInput}#E(){let e=document.createElement(`div`);e.setAttribute(`data-persona-mention-menu`,``),e.setAttribute(`role`,`listbox`),e.id=this.#o;let t=()=>{let t=this.#e.mentionConfig.renderMentionMenu({query:this.#u,groups:this.#g.map(e=>({source:e.source,items:e.items})),status:Object.fromEntries(this.#g.map(e=>[e.source.id,e.status])),activeIndex:this.#f,select:e=>{let t=this.#g.find(t=>t.items.includes(e));t&&this.#J(t.source,e)},close:()=>this.close()});e.replaceChildren(t)};return{el:e,render:t,setActiveIndex:t,destroy:()=>e.remove()}}isOpen(){return this.#l}openFromButton(e){let t=e&&this.#t.find(t=>t.trigger===e)||this.#t[0],n=this.input.getSelection().start,r=j(this.input.getLogicalText(),n,[t]);if(r){this.#m=!1,this.#d=r.match,this.#l?(this.#D(t),this.#N(r.match.query)):this.#O(r.match.query,t),this.input.focus();return}let i=this.#h;this.#m=!0,this.#h=t.trigger,this.#d=null,this.#l?(i&&i!==t.trigger&&this.#e.onPickerOpenChange?.(!1,i,this.#o),this.#D(t),this.#N(``)):this.#O(``,t),this.#a.showSearch?this.#a.showSearch(``,t.searchPlaceholder):this.input.focus(),this.#e.onPickerOpenChange?.(!0,t.trigger,this.#o)}onInput(){let e=this.input.getSelection().start,t=j(this.input.getLogicalText(),e,this.#t);t?this.#Q(t.channel,t.match.query)?(this.#d=null,this.#l&&this.close(!1)):(this.#d=t.match,this.#l?(this.#D(t.channel),this.#T!==t.match.triggerIndex&&this.#M(),this.#N(t.match.query)):this.#O(t.match.query,t.channel)):this.#l&&this.close()}#D(e){e!==this.#n&&(this.#n=e,this.#g=[],this.#f=0)}#O(e,t){if(this.#l=!0,this.#n=t,this.#g=[],this.#f=0,this.#C=-1,!this.#s){let e=this.#j();if(this.#s=D({anchor:this.#e.anchor,content:this.#a.el,placement:`top-start`,matchAnchorWidth:!e,offset:6,container:this.#e.popoverContainer,horizontalOffset:e?()=>this.#w?.x??null:void 0,verticalOffset:e?()=>this.#w?.y??null:void 0,onDismiss:()=>this.close(!1)}),e){let e=this.#e.anchor.getBoundingClientRect().width;this.#a.el.style.minWidth=`${Math.min(220,e)}px`}}this.#M(),this.#s.open(),T(this.#a.el,`persona-mention-menu`,`
26
26
  .persona-mention-menu {
@@ -1,4 +1,4 @@
1
- import { Oo as SemanticTokens, Po as ThemeValidationResult, So as PersonaTheme, To as ResolvedToken, _o as DeepPartial, go as CreateThemeOptions, k as AgentWidgetConfig, mo as ComponentTokens } from "./types-BC7MRxO5.cjs";
1
+ import { Oo as SemanticTokens, Po as ThemeValidationResult, So as PersonaTheme, To as ResolvedToken, _o as DeepPartial, go as CreateThemeOptions, k as AgentWidgetConfig, mo as ComponentTokens } from "./types-9i0xcAMT.cjs";
2
2
  declare const DEFAULT_PALETTE: {
3
3
  spacing: Record<0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64, string>;
4
4
  typography: {
@@ -1,4 +1,4 @@
1
- import { Oo as SemanticTokens, Po as ThemeValidationResult, So as PersonaTheme, To as ResolvedToken, _o as DeepPartial, go as CreateThemeOptions, k as AgentWidgetConfig, mo as ComponentTokens } from "./types-BC7MRxO5.js";
1
+ import { Oo as SemanticTokens, Po as ThemeValidationResult, So as PersonaTheme, To as ResolvedToken, _o as DeepPartial, go as CreateThemeOptions, k as AgentWidgetConfig, mo as ComponentTokens } from "./types-9i0xcAMT.js";
2
2
  declare const DEFAULT_PALETTE: {
3
3
  spacing: Record<0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64, string>;
4
4
  typography: {
@@ -1,5 +1,5 @@
1
- import { Gr as DictationPhase, Jr as DictationRenderHandle, Kr as DictationProviderConfig, Ro as AgentWidgetPlugin, Yr as DictationState, ja as renderLucideIcon, k as AgentWidgetConfig, qr as DictationRenderContext } from "./types-BC7MRxO5.cjs";
2
- import { t as ComposerInputCapability } from "./composer-input-i_FiUp6J.cjs";
1
+ import { Gr as DictationPhase, Jr as DictationRenderHandle, Kr as DictationProviderConfig, Ro as AgentWidgetPlugin, Yr as DictationState, ja as renderLucideIcon, k as AgentWidgetConfig, qr as DictationRenderContext } from "./types-9i0xcAMT.cjs";
2
+ import { t as ComposerInputCapability } from "./composer-input-BSDNPOqV.cjs";
3
3
  import { r as attachTooltip } from "./tooltip-DbXkAuJL.cjs";
4
4
  type DictationCallbacks = {
5
5
  onState: (state: DictationState, levelOnly: boolean) => void;
@@ -1,5 +1,5 @@
1
- import { Gr as DictationPhase, Jr as DictationRenderHandle, Kr as DictationProviderConfig, Ro as AgentWidgetPlugin, Yr as DictationState, ja as renderLucideIcon, k as AgentWidgetConfig, qr as DictationRenderContext } from "./types-BC7MRxO5.js";
2
- import { t as ComposerInputCapability } from "./composer-input-i_FiUp6J.js";
1
+ import { Gr as DictationPhase, Jr as DictationRenderHandle, Kr as DictationProviderConfig, Ro as AgentWidgetPlugin, Yr as DictationState, ja as renderLucideIcon, k as AgentWidgetConfig, qr as DictationRenderContext } from "./types-9i0xcAMT.js";
2
+ import { t as ComposerInputCapability } from "./composer-input-BSDNPOqV.js";
3
3
  import { r as attachTooltip } from "./tooltip-DbXkAuJL.js";
4
4
  type DictationCallbacks = {
5
5
  onState: (state: DictationState, levelOnly: boolean) => void;
@@ -1,4 +1,4 @@
1
- import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-BC7MRxO5.cjs";
1
+ import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-9i0xcAMT.cjs";
2
2
  /** Explicit jump only: automatic following keeps its separate policy and animation. */
3
3
  declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLElement, onFrame: () => void, onComplete: () => void, onCancel: () => void): {
4
4
  readonly active: boolean;
@@ -1,4 +1,4 @@
1
- import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-BC7MRxO5.js";
1
+ import { Ro as AgentWidgetPlugin, Wi as SSEEventRecord, k as AgentWidgetConfig } from "./types-9i0xcAMT.js";
2
2
  /** Explicit jump only: automatic following keeps its separate policy and animation. */
3
3
  declare function createScrollToLatest(element: HTMLElement, keyboardScope: HTMLElement, onFrame: () => void, onComplete: () => void, onCancel: () => void): {
4
4
  readonly active: boolean;
@@ -1,4 +1,4 @@
1
- import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-BC7MRxO5.cjs";
1
+ import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-9i0xcAMT.cjs";
2
2
  interface FallbackSpeechEngineOptions {
3
3
  /**
4
4
  * Called once when the primary engine fails before audio starts and the
@@ -1,4 +1,4 @@
1
- import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-BC7MRxO5.js";
1
+ import { Ji as SpeechCallbacks, Xi as SpeechRequest, Yi as SpeechEngine } from "./types-9i0xcAMT.js";
2
2
  interface FallbackSpeechEngineOptions {
3
3
  /**
4
4
  * Called once when the primary engine fails before audio starts and the
@@ -1,4 +1,4 @@
1
- import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-BC7MRxO5.cjs";
1
+ import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-9i0xcAMT.cjs";
2
2
  /** Canonicalize the deprecated `"card"` alias to `"collapsed"`. */
3
3
  declare function canonicalArtifactDisplayMode(mode: PersonaArtifactDisplayModeInput): PersonaArtifactDisplayMode;
4
4
  type PersonaArtifactDisplayDescriptor = Pick<PersonaArtifactRecord, "artifactType" | "file" | "presentation">;
@@ -1,4 +1,4 @@
1
- import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-BC7MRxO5.js";
1
+ import { Ai as PersonaArtifactDisplayModeInput, Li as PersonaArtifactRecord, Oa as WidgetPreferenceSlice, Pi as PersonaArtifactKind, _ as AgentWidgetArtifactsFeature, k as AgentWidgetConfig, ki as PersonaArtifactDisplayMode, nt as AgentWidgetFeatureFlags } from "./types-9i0xcAMT.js";
2
2
  /** Canonicalize the deprecated `"card"` alias to `"collapsed"`. */
3
3
  declare function canonicalArtifactDisplayMode(mode: PersonaArtifactDisplayModeInput): PersonaArtifactDisplayMode;
4
4
  type PersonaArtifactDisplayDescriptor = Pick<PersonaArtifactRecord, "artifactType" | "file" | "presentation">;
@@ -1,5 +1,5 @@
1
- import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-BC7MRxO5.cjs";
2
- import { t as AgentWidgetSession } from "./session-CtZHe7fc.cjs";
1
+ import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-9i0xcAMT.cjs";
2
+ import { t as AgentWidgetSession } from "./session-BUQrs3Of.cjs";
3
3
  export declare const formDefinitions: Record<string, {
4
4
  title: string;
5
5
  description?: string;
@@ -1,5 +1,5 @@
1
- import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-BC7MRxO5.js";
2
- import { t as AgentWidgetSession } from "./session-CtZHe7fc.js";
1
+ import { Ct as AgentWidgetMessage, k as AgentWidgetConfig } from "./types-9i0xcAMT.js";
2
+ import { t as AgentWidgetSession } from "./session-BUQrs3Of.js";
3
3
  export declare const formDefinitions: Record<string, {
4
4
  title: string;
5
5
  description?: string;
@@ -1,4 +1,4 @@
1
- import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-BC7MRxO5.cjs";
1
+ import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-9i0xcAMT.cjs";
2
2
  import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-DbXkAuJL.cjs";
3
3
  type HistoryViewCopyInput = AgentWidgetHistoryCopy;
4
4
  type ResolvedHistoryViewCopy = Required<AgentWidgetHistoryCopy>;
@@ -1,4 +1,4 @@
1
- import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-BC7MRxO5.js";
1
+ import { Fa as HistoryOperationContext, Ra as HistoryProvider, ct as AgentWidgetHistoryListAction, li as HistoryIdentityStatus, lt as AgentWidgetHistoryRenderActions, ot as AgentWidgetHistoryCopy, si as HistoryConversationSummary } from "./types-9i0xcAMT.js";
2
2
  import { n as TooltipOptions, t as TooltipHandle } from "./tooltip-DbXkAuJL.js";
3
3
  type HistoryViewCopyInput = AgentWidgetHistoryCopy;
4
4
  type ResolvedHistoryViewCopy = Required<AgentWidgetHistoryCopy>;
@@ -1,10 +1,10 @@
1
- import { Ct as AgentWidgetMessage, Go as ariaCombo, Hi as ResolvedHistoryPresentation, Ko as formatCombo, Ra as HistoryProvider, Ro as AgentWidgetPlugin, Ta as WidgetHistoryInternals, di as HistoryReturnSurface, fi as HistoryScope, ja as renderLucideIcon, k as AgentWidgetConfig, oi as HistoryConversationPatch, on as AgentWidgetStorageAdapter, q as AgentWidgetControllerEventMap, qo as parseCombo, si as HistoryConversationSummary, za as HistoryProviderError } from "./types-BC7MRxO5.cjs";
2
- import { a as applyBubbleGeometry, u as getBubbleClasses } from "./message-bubble-C6AVaH7f.cjs";
3
- import { Ct as AttachmentManager, h as PanelElements, i as SessionHistoryState, nn as HistoryClientError, r as SessionHistoryError, t as AgentWidgetSession, vt as isDockedMountMode } from "./session-CtZHe7fc.cjs";
4
- import { p as resolveThemeDefaults } from "./defaults-Bga2Xrsp.cjs";
1
+ import { Ct as AgentWidgetMessage, Go as ariaCombo, Hi as ResolvedHistoryPresentation, Ko as formatCombo, Ra as HistoryProvider, Ro as AgentWidgetPlugin, Ta as WidgetHistoryInternals, di as HistoryReturnSurface, fi as HistoryScope, ja as renderLucideIcon, k as AgentWidgetConfig, oi as HistoryConversationPatch, on as AgentWidgetStorageAdapter, q as AgentWidgetControllerEventMap, qo as parseCombo, si as HistoryConversationSummary, za as HistoryProviderError } from "./types-9i0xcAMT.cjs";
2
+ import { a as applyBubbleGeometry, u as getBubbleClasses } from "./message-bubble-Czc0lOHr.cjs";
3
+ import { Ct as AttachmentManager, h as PanelElements, i as SessionHistoryState, nn as HistoryClientError, r as SessionHistoryError, t as AgentWidgetSession, vt as isDockedMountMode } from "./session-BUQrs3Of.cjs";
4
+ import { p as resolveThemeDefaults } from "./defaults-tj5RcN8r.cjs";
5
5
  import { r as attachTooltip } from "./tooltip-DbXkAuJL.cjs";
6
- import { t as createComposerStore } from "./composer-store-DhGNgG7Z.cjs";
7
- import { n as HistoryViewHandle, r as HistoryViewOptions, t as showHistoryConfirm } from "./history-confirm-dialog-i46-lPN_.cjs";
6
+ import { t as createComposerStore } from "./composer-store-DC-gAjtN.cjs";
7
+ import { n as HistoryViewHandle, r as HistoryViewOptions, t as showHistoryConfirm } from "./history-confirm-dialog-CrkSB3Ra.cjs";
8
8
  interface LauncherButton {
9
9
  element: HTMLButtonElement;
10
10
  update: (config: AgentWidgetConfig) => void;
@@ -1,10 +1,10 @@
1
- import { Ct as AgentWidgetMessage, Go as ariaCombo, Hi as ResolvedHistoryPresentation, Ko as formatCombo, Ra as HistoryProvider, Ro as AgentWidgetPlugin, Ta as WidgetHistoryInternals, di as HistoryReturnSurface, fi as HistoryScope, ja as renderLucideIcon, k as AgentWidgetConfig, oi as HistoryConversationPatch, on as AgentWidgetStorageAdapter, q as AgentWidgetControllerEventMap, qo as parseCombo, si as HistoryConversationSummary, za as HistoryProviderError } from "./types-BC7MRxO5.js";
2
- import { a as applyBubbleGeometry, u as getBubbleClasses } from "./message-bubble-C6AVaH7f.js";
3
- import { Ct as AttachmentManager, h as PanelElements, i as SessionHistoryState, nn as HistoryClientError, r as SessionHistoryError, t as AgentWidgetSession, vt as isDockedMountMode } from "./session-CtZHe7fc.js";
4
- import { p as resolveThemeDefaults } from "./defaults-Bga2Xrsp.js";
1
+ import { Ct as AgentWidgetMessage, Go as ariaCombo, Hi as ResolvedHistoryPresentation, Ko as formatCombo, Ra as HistoryProvider, Ro as AgentWidgetPlugin, Ta as WidgetHistoryInternals, di as HistoryReturnSurface, fi as HistoryScope, ja as renderLucideIcon, k as AgentWidgetConfig, oi as HistoryConversationPatch, on as AgentWidgetStorageAdapter, q as AgentWidgetControllerEventMap, qo as parseCombo, si as HistoryConversationSummary, za as HistoryProviderError } from "./types-9i0xcAMT.js";
2
+ import { a as applyBubbleGeometry, u as getBubbleClasses } from "./message-bubble-Czc0lOHr.js";
3
+ import { Ct as AttachmentManager, h as PanelElements, i as SessionHistoryState, nn as HistoryClientError, r as SessionHistoryError, t as AgentWidgetSession, vt as isDockedMountMode } from "./session-BUQrs3Of.js";
4
+ import { p as resolveThemeDefaults } from "./defaults-tj5RcN8r.js";
5
5
  import { r as attachTooltip } from "./tooltip-DbXkAuJL.js";
6
- import { t as createComposerStore } from "./composer-store-DhGNgG7Z.js";
7
- import { n as HistoryViewHandle, r as HistoryViewOptions, t as showHistoryConfirm } from "./history-confirm-dialog-i46-lPN_.js";
6
+ import { t as createComposerStore } from "./composer-store-DC-gAjtN.js";
7
+ import { n as HistoryViewHandle, r as HistoryViewOptions, t as showHistoryConfirm } from "./history-confirm-dialog-CrkSB3Ra.js";
8
8
  interface LauncherButton {
9
9
  element: HTMLButtonElement;
10
10
  update: (config: AgentWidgetConfig) => void;
@@ -1,3 +1,3 @@
1
- import { a as HistoryViewPresentation, c as HistoryListState, d as ResolvedHistoryViewCopy, f as resolveHistoryViewCopy, i as HistoryViewPendingAction, l as HISTORY_VIEW_COPY_DEFAULTS, n as HistoryViewHandle, o as createHistoryView, r as HistoryViewOptions, s as HistoryListErrorReason, t as showHistoryConfirm, u as HistoryViewCopyInput } from "./history-confirm-dialog-i46-lPN_.cjs";
1
+ import { a as HistoryViewPresentation, c as HistoryListState, d as ResolvedHistoryViewCopy, f as resolveHistoryViewCopy, i as HistoryViewPendingAction, l as HISTORY_VIEW_COPY_DEFAULTS, n as HistoryViewHandle, o as createHistoryView, r as HistoryViewOptions, s as HistoryListErrorReason, t as showHistoryConfirm, u as HistoryViewCopyInput } from "./history-confirm-dialog-CrkSB3Ra.cjs";
2
2
  export { HISTORY_VIEW_COPY_DEFAULTS, type HistoryListErrorReason, type HistoryListState, type HistoryViewCopyInput, type HistoryViewHandle, type HistoryViewOptions, type HistoryViewPendingAction, type HistoryViewPresentation, type ResolvedHistoryViewCopy, createHistoryView, resolveHistoryViewCopy, showHistoryConfirm };
3
3
  export {}
@@ -1,3 +1,3 @@
1
- import { a as HistoryViewPresentation, c as HistoryListState, d as ResolvedHistoryViewCopy, f as resolveHistoryViewCopy, i as HistoryViewPendingAction, l as HISTORY_VIEW_COPY_DEFAULTS, n as HistoryViewHandle, o as createHistoryView, r as HistoryViewOptions, s as HistoryListErrorReason, t as showHistoryConfirm, u as HistoryViewCopyInput } from "./history-confirm-dialog-i46-lPN_.js";
1
+ import { a as HistoryViewPresentation, c as HistoryListState, d as ResolvedHistoryViewCopy, f as resolveHistoryViewCopy, i as HistoryViewPendingAction, l as HISTORY_VIEW_COPY_DEFAULTS, n as HistoryViewHandle, o as createHistoryView, r as HistoryViewOptions, s as HistoryListErrorReason, t as showHistoryConfirm, u as HistoryViewCopyInput } from "./history-confirm-dialog-CrkSB3Ra.js";
2
2
  export { HISTORY_VIEW_COPY_DEFAULTS, type HistoryListErrorReason, type HistoryListState, type HistoryViewCopyInput, type HistoryViewHandle, type HistoryViewOptions, type HistoryViewPendingAction, type HistoryViewPresentation, type ResolvedHistoryViewCopy, createHistoryView, resolveHistoryViewCopy, showHistoryConfirm };
3
3
  export {}