@runtypelabs/persona 4.17.0 → 4.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-BpWGm7_6.d.cts → types-DsmTD8TO.d.cts} +12 -0
- package/dist/animations/{types-BpWGm7_6.d.ts → types-DsmTD8TO.d.ts} +12 -0
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/chunk-3I2S3I5P.js +1 -0
- package/dist/chunk-76IELU7F.js +1 -0
- package/dist/chunk-EFJBUH5F.js +1 -0
- package/dist/chunk-PDPVORUF.js +1 -0
- package/dist/chunk-Q735PSZL.js +1 -0
- package/dist/chunk-VK6JOIYJ.js +1 -0
- package/dist/codegen.cjs +4 -4
- package/dist/codegen.js +4 -4
- package/dist/{context-mentions-BTSTIBFC.js → context-mentions-MJL6S6P2.js} +1 -1
- package/dist/context-mentions.cjs +9 -8
- package/dist/context-mentions.d.cts +1224 -14
- package/dist/context-mentions.d.ts +1224 -14
- package/dist/context-mentions.js +9 -8
- package/dist/event-stream-view-4EZ7BGFK.js +1 -0
- package/dist/event-stream-view.cjs +129 -0
- package/dist/event-stream-view.d.cts +8384 -0
- package/dist/event-stream-view.d.ts +8384 -0
- package/dist/event-stream-view.js +129 -0
- package/dist/history-view-BD6OXLNA.js +898 -0
- package/dist/history-view.cjs +898 -0
- package/dist/history-view.d.cts +1461 -0
- package/dist/history-view.d.ts +1461 -0
- package/dist/history-view.js +898 -0
- package/dist/index.cjs +77 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2040 -21
- package/dist/index.d.ts +2040 -21
- package/dist/index.global.js +67 -66
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +77 -77
- package/dist/index.js.map +1 -1
- package/dist/launcher.global.js +5 -4
- package/dist/launcher.global.js.map +1 -1
- package/dist/plugin-kit.cjs +1 -1
- package/dist/plugin-kit.d.cts +0 -8
- package/dist/plugin-kit.d.ts +0 -8
- package/dist/plugin-kit.js +1 -1
- package/dist/smart-dom-reader.d.cts +1224 -14
- package/dist/smart-dom-reader.d.ts +1224 -14
- package/dist/theme-editor-preview.cjs +970 -73
- package/dist/theme-editor-preview.d.cts +1343 -15
- package/dist/theme-editor-preview.d.ts +1343 -15
- package/dist/theme-editor-preview.js +81 -81
- package/dist/theme-editor.cjs +7 -7
- package/dist/theme-editor.d.cts +1227 -15
- package/dist/theme-editor.d.ts +1227 -15
- package/dist/theme-editor.js +9 -9
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +226 -7
- package/dist/theme-reference.d.ts +226 -7
- package/dist/theme-reference.js +1 -1
- package/dist/webmcp-polyfill.js +2 -2
- package/dist/widget.css +1 -1
- package/package.json +18 -6
- package/src/client-history-rest.test.ts +1034 -0
- package/src/client-visitor-history.test.ts +596 -0
- package/src/client.ts +1040 -24
- package/src/components/artifact-inline.ts +8 -1
- package/src/components/artifact-pane.test.ts +278 -1
- package/src/components/artifact-pane.ts +135 -67
- package/src/components/artifact-preview.test.ts +14 -1
- package/src/components/artifact-preview.ts +9 -0
- package/src/components/header-builder.ts +3 -0
- package/src/components/header-layouts.test.ts +171 -7
- package/src/components/header-layouts.ts +83 -53
- package/src/components/header-parts.test.ts +154 -1
- package/src/components/header-parts.ts +266 -138
- package/src/components/history-confirm-dialog.ts +177 -0
- package/src/components/history-shell-copy.ts +99 -0
- package/src/components/history-view/announcer.ts +40 -0
- package/src/components/history-view/copy.ts +105 -0
- package/src/components/history-view/css.ts +1078 -0
- package/src/components/history-view/grouping.test.ts +142 -0
- package/src/components/history-view/grouping.ts +142 -0
- package/src/components/history-view/icons.ts +73 -0
- package/src/components/history-view/rows.ts +341 -0
- package/src/components/history-view/state.ts +309 -0
- package/src/components/history-view.test.ts +2660 -0
- package/src/components/history-view.ts +1891 -0
- package/src/components/launcher-surface.test.ts +133 -0
- package/src/components/launcher.test.ts +18 -0
- package/src/components/launcher.ts +7 -7
- package/src/components/panel.ts +17 -7
- package/src/components/welcome.ts +72 -2
- package/src/defaults.ts +36 -3
- package/src/event-stream-view-bundle.test.ts +69 -0
- package/src/event-stream-view-entry.ts +19 -0
- package/src/event-stream-view-loader.ts +31 -0
- package/src/event-stream-view.ts +19 -0
- package/src/generated/runtype-openapi-contract.ts +54 -4
- package/src/history-render.ts +325 -0
- package/src/history-view-bundle.test.ts +78 -0
- package/src/history-view-entry.ts +41 -0
- package/src/history-view-loader.test.ts +30 -0
- package/src/history-view-loader.ts +32 -0
- package/src/history-view.ts +28 -0
- package/src/index-core.ts +50 -2
- package/src/index-global.ts +55 -0
- package/src/internal/demo-history-provider.test.ts +402 -0
- package/src/internal/demo-history-provider.ts +689 -0
- package/src/internal/history-provider-registry.ts +25 -0
- package/src/internal/history-provider.ts +150 -0
- package/src/internal/runtype-history-provider.test.ts +313 -0
- package/src/internal/runtype-history-provider.ts +240 -0
- package/src/plugin-kit.test.ts +16 -0
- package/src/plugin-kit.ts +13 -5
- package/src/plugins/types.ts +177 -1
- package/src/session-history.test.ts +1397 -0
- package/src/session.ts +1200 -26
- package/src/styles/widget-styles.test.ts +133 -0
- package/src/styles/widget.css +227 -8
- package/src/theme-editor/preview-utils.test.ts +19 -0
- package/src/theme-editor/preview-utils.ts +15 -1
- package/src/theme-editor/preview.ts +7 -1
- package/src/theme-editor/role-mappings.ts +4 -1
- package/src/theme-editor/sections.test.ts +168 -1
- package/src/theme-editor/sections.ts +136 -7
- package/src/theme-editor/webmcp/summary.ts +16 -2
- package/src/theme-reference.ts +20 -6
- package/src/types/theme.ts +213 -7
- package/src/types.ts +927 -7
- package/src/ui.artifact-rail-resize.test.ts +235 -0
- package/src/ui.attachments-drop.test.ts +1 -0
- package/src/ui.header-update-stability.test.ts +2 -2
- package/src/ui.history-chunk.test.ts +72 -0
- package/src/ui.history-config-provider.test.ts +318 -0
- package/src/ui.history-controller.test.ts +711 -0
- package/src/ui.history-lifecycle.test.ts +456 -0
- package/src/ui.history-render-hooks.test.ts +904 -0
- package/src/ui.history-shell.test.ts +1887 -0
- package/src/ui.rail-overlay.test.ts +573 -0
- package/src/ui.rail-resize.test.ts +284 -0
- package/src/ui.rebuild-composer.test.ts +21 -0
- package/src/ui.render-welcome.test.ts +42 -0
- package/src/ui.shortcuts.test.ts +166 -0
- package/src/ui.ts +3071 -240
- package/src/utils/__fixtures__/client-conversation-history-wire.json +108 -0
- package/src/utils/artifact-file.ts +15 -0
- package/src/utils/artifact-gate.test.ts +4 -0
- package/src/utils/artifact-gate.ts +13 -17
- package/src/utils/artifact-resize.test.ts +28 -0
- package/src/utils/artifact-resize.ts +9 -2
- package/src/utils/buttons.ts +188 -1
- package/src/utils/config-merge.test.ts +91 -0
- package/src/utils/dropdown.ts +10 -1
- package/src/utils/history-messages.test.ts +284 -0
- package/src/utils/history-messages.ts +284 -0
- package/src/utils/icons.ts +3 -0
- package/src/utils/shortcuts.test.ts +288 -0
- package/src/utils/shortcuts.ts +221 -0
- package/src/utils/theme.test.ts +501 -4
- package/src/utils/theme.ts +42 -3
- package/src/utils/tokens.ts +153 -15
- package/src/utils/tooltip-timing.ts +4 -0
- package/src/utils/tooltip.test.ts +249 -7
- package/src/utils/tooltip.ts +146 -4
- package/src/utils/visitor-store.test.ts +425 -0
- package/src/utils/visitor-store.ts +337 -0
- package/dist/chunk-QJ4LV2KW.js +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";var ue=Object.defineProperty;var To=Object.getOwnPropertyDescriptor;var Ro=Object.getOwnPropertyNames;var Lo=Object.prototype.hasOwnProperty;var Io=(a,e)=>{for(var t in e)ue(a,t,{get:e[t],enumerable:!0})},Bo=(a,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ro(e))!Lo.call(a,r)&&r!==t&&ue(a,r,{get:()=>e[r],enumerable:!(o=To(e,r))||o.enumerable});return a};var Do=a=>Bo(ue({},"__esModule",{value:!0}),a);var Ko={};Io(Ko,{mountContextMentions:()=>Po});module.exports=Do(Ko);var R=(a,e)=>{let t=document.createElement(a);return e&&(t.className=e),t};var S=(a,e={},...t)=>{let o=document.createElement(a);if(e.className&&(o.className=e.className),e.text!==void 0&&(o.textContent=e.text),e.attrs)for(let[s,n]of Object.entries(e.attrs))o.setAttribute(s,n);if(e.style){let s=o.style,n=e.style;for(let i of Object.keys(n)){let l=n[i];l!=null&&(s[i]=l)}}let r=t.filter(s=>s!=null);return r.length>0&&o.append(...r),o};var pe=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"}]];var me=[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]];var xe=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];var ce=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]];var he=[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]];var ge=[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]];var Ce=[["circle",{cx:"12",cy:"12",r:"4"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"}]];var Me=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M4.929 4.929 19.07 19.071"}]];var ve=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"}]];var Se=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z"}]];var ye=[["path",{d:"M12 8V4H8"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}],["path",{d:"M2 14h2"}],["path",{d:"M20 14h2"}],["path",{d:"M15 13v2"}],["path",{d:"M9 13v2"}]];var be=[["path",{d:"M12 10h.01"}],["path",{d:"M12 14h.01"}],["path",{d:"M12 6h.01"}],["path",{d:"M16 10h.01"}],["path",{d:"M16 14h.01"}],["path",{d:"M16 6h.01"}],["path",{d:"M8 10h.01"}],["path",{d:"M8 14h.01"}],["path",{d:"M8 6h.01"}],["path",{d:"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2"}]];var Ae=[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}],["path",{d:"M8 14h.01"}],["path",{d:"M12 14h.01"}],["path",{d:"M16 14h.01"}],["path",{d:"M8 18h.01"}],["path",{d:"M12 18h.01"}],["path",{d:"M16 18h.01"}]];var we=[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}]];var ke=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];var X=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M18 17V9"}],["path",{d:"M13 17V5"}],["path",{d:"M8 17v-3"}]];var Pe=[["path",{d:"M20 6 9 17l-5-5"}]];var Te=[["path",{d:"m6 9 6 6 6-6"}]];var Re=[["path",{d:"m15 18-6-6 6-6"}]];var Le=[["path",{d:"m9 18 6-6-6-6"}]];var Ie=[["path",{d:"m18 15-6-6-6 6"}]];var K=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m9 12 2 2 4-4"}]];var $=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m15 9-6 6"}],["path",{d:"m9 9 6 6"}]];var Be=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];var De=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}]];var Fe=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]];var Z=[["path",{d:"m18 16 4-4-4-4"}],["path",{d:"m6 8-4 4 4 4"}],["path",{d:"m14.5 4-5 16"}]];var He=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];var Oe=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10"}]];var Ee=[["line",{x1:"12",x2:"12",y1:"2",y2:"22"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"}]];var qe=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];var Q=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"12",cy:"5",r:"1"}],["circle",{cx:"12",cy:"19",r:"1"}]];var _=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]];var We=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];var Ue=[["path",{d:"M15 3h6v6"}],["path",{d:"M10 14 21 3"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}]];var Ne=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];var Ve=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 12.5 8 15l2 2.5"}],["path",{d:"m14 12.5 2 2.5-2 2.5"}]];var ze=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M8 13h2"}],["path",{d:"M14 13h2"}],["path",{d:"M8 17h2"}],["path",{d:"M14 17h2"}]];var Ge=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];var Xe=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];var Ke=[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1"}]];var $e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M7 3v18"}],["path",{d:"M3 7.5h4"}],["path",{d:"M3 12h18"}],["path",{d:"M3 16.5h4"}],["path",{d:"M17 3v18"}],["path",{d:"M17 7.5h4"}],["path",{d:"M17 16.5h4"}]];var Ze=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528"}]];var Qe=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}]];var _e=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];var j=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"}]];var je=[["path",{d:"M12 7v14"}],["path",{d:"M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8"}],["path",{d:"M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5"}],["rect",{x:"3",y:"7",width:"18",height:"4",rx:"1"}]];var Je=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]];var Ye=[["line",{x1:"4",x2:"20",y1:"9",y2:"9"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21"}]];var et=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3"}]];var tt=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"}]];var ot=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}],["path",{d:"M12 7v5l4 2"}]];var J=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}]];var at=[["path",{d:"M16 5h6"}],["path",{d:"M19 2v6"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}],["circle",{cx:"9",cy:"9",r:"2"}]];var rt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}],["circle",{cx:"9",cy:"9",r:"2"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]];var st=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];var nt=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"}],["path",{d:"m21 2-9.6 9.6"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5"}]];var lt=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}],["path",{d:"M9 18h6"}],["path",{d:"M10 22h4"}]];var ft=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];var Y=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]];var it=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];var dt=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]];var ut=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}]];var pt=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"}],["circle",{cx:"12",cy:"10",r:"3"}]];var mt=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];var xt=[["path",{d:"M4 5h16"}],["path",{d:"M4 12h16"}],["path",{d:"M4 19h16"}]];var ct=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}]];var ht=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"}]];var gt=[["path",{d:"M12 19v3"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"}]];var Ct=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]];var Mt=[["path",{d:"M5 12h14"}]];var vt=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]];var St=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"}]];var yt=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"}],["path",{d:"M12 22V12"}],["polyline",{points:"3.29 7 12 12 20.71 7"}],["path",{d:"m7.5 4.27 9 5.15"}]];var bt=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"}]];var At=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1"}]];var ee=[["path",{d:"M13 21h8"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}]];var wt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];var kt=[["line",{x1:"19",x2:"5",y1:"5",y2:"19"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5"}]];var Pt=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"}]];var Tt=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"}]];var Rt=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];var Lt=[["path",{d:"M12 17V7"}],["path",{d:"M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8"}],["path",{d:"M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z"}]];var It=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];var Bt=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];var Dt=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7"}]];var Ft=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];var Ht=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"}],["path",{d:"m21.854 2.147-10.94 10.939"}]];var Ot=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]];var Et=[["path",{d:"M12 2v13"}],["path",{d:"m16 6-4-4-4 4"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}]];var qt=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"M12 8v4"}],["path",{d:"M12 16h.01"}]];var Wt=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"m9 12 2 2 4-4"}]];var te=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"m14.5 9.5-5 5"}],["path",{d:"m9.5 9.5 5 5"}]];var Ut=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}]];var Nt=[["path",{d:"M16 10a4 4 0 0 1-8 0"}],["path",{d:"M3.103 6.034h17.794"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z"}]];var Vt=[["circle",{cx:"8",cy:"21",r:"1"}],["circle",{cx:"19",cy:"21",r:"1"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"}]];var zt=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]];var oe=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}],["path",{d:"M20 2v4"}],["path",{d:"M22 4h-4"}],["circle",{cx:"4",cy:"20",r:"2"}]];var Gt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];var Xt=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"}]];var Kt=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05"}]];var $t=[["circle",{cx:"12",cy:"12",r:"4"}],["path",{d:"M12 2v2"}],["path",{d:"M12 20v2"}],["path",{d:"m4.93 4.93 1.41 1.41"}],["path",{d:"m17.66 17.66 1.41 1.41"}],["path",{d:"M2 12h2"}],["path",{d:"M20 12h2"}],["path",{d:"m6.34 17.66-1.41 1.41"}],["path",{d:"m19.07 4.93-1.41 1.41"}]];var Zt=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}]];var Qt=[["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"}],["path",{d:"M17 14V2"}]];var _t=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"}],["path",{d:"M7 10v12"}]];var jt=[["line",{x1:"10",x2:"14",y1:"2",y2:"2"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11"}],["circle",{cx:"12",cy:"14",r:"8"}]];var Jt=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];var Yt=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];var ae=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];var eo=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2"}],["path",{d:"M15 18H9"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14"}],["circle",{cx:"17",cy:"18",r:"2"}],["circle",{cx:"7",cy:"18",r:"2"}]];var to=[["path",{d:"M12 3v12"}],["path",{d:"m17 8-5-5-5 5"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}]];var oo=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]];var ao=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]];var ro=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15"}]];var so=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"}]];var no=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var lo=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];var Fo={activity:pe,"arrow-down":me,"arrow-up":ge,"arrow-up-right":he,bot:ye,"chevron-down":Te,"chevron-up":Ie,"chevron-right":Le,"chevron-left":Re,check:Pe,clipboard:De,"clipboard-copy":Be,"code-xml":Z,copy:He,file:Xe,"file-code":Ve,"file-spreadsheet":ze,"file-text":Ge,"image-plus":at,loader:it,"loader-circle":Y,mic:gt,paperclip:bt,"refresh-cw":It,search:Ft,send:Ht,"shield-alert":qt,"shield-check":Wt,"shield-x":te,square:Gt,"thumbs-down":Qt,"thumbs-up":_t,upload:to,"volume-2":ao,x:no,user:oo,mail:ut,phone:Pt,calendar:we,clock:Fe,building:be,"map-pin":pt,lock:dt,key:nt,"credit-card":Oe,"at-sign":Ce,hash:Ye,globe:Je,link:ft,"circle-check":K,"circle-x":$,"triangle-alert":ae,info:st,ban:Me,shield:Ut,"arrow-left":xe,"arrow-right":ce,"external-link":Ue,ellipsis:_,"ellipsis-vertical":Q,menu:xt,house:J,plus:Rt,minus:Mt,pencil:wt,"pen-line":ee,trash:Yt,"trash-2":Jt,save:Dt,download:qe,share:Et,funnel:j,settings:Ot,"rotate-cw":Bt,maximize:mt,minimize:Ct,"shopping-cart":Vt,"shopping-bag":Nt,package:yt,truck:eo,tag:Zt,gift:je,receipt:Lt,wallet:so,store:Kt,"dollar-sign":Ee,percent:kt,play:Tt,pause:At,"volume-x":ro,camera:ke,image:rt,film:$e,headphones:et,"message-circle":ct,"message-square":ht,bell:ve,heart:tt,star:Xt,eye:Ne,"eye-off":We,bookmark:Se,"calendar-days":Ae,history:ot,timer:jt,folder:_e,"folder-open":Qe,files:Ke,"chart-column":X,sparkles:oe,zap:lo,sun:$t,moon:St,flag:Ze,lightbulb:lt,monitor:vt,smartphone:zt},U=(a,e=24,t="currentColor",o=2)=>{let r=Fo[a];return r?Ho(r,e,t,o):(console.warn(`Lucide icon "${a}" is not in the Persona registry. Add it to packages/widget/src/utils/icons.ts (see docs/icon-registry-shortlist.md).`),null)};function Ho(a,e,t,o){if(!Array.isArray(a))return null;let r=document.createElementNS("http://www.w3.org/2000/svg","svg");return r.setAttribute("width",String(e)),r.setAttribute("height",String(e)),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke",t),r.setAttribute("stroke-width",String(o)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.setAttribute("aria-hidden","true"),a.forEach(s=>{if(!Array.isArray(s)||s.length<2)return;let n=s[0],i=s[1];if(!i)return;let l=document.createElementNS("http://www.w3.org/2000/svg",n);Object.entries(i).forEach(([f,g])=>{f!=="stroke"&&l.setAttribute(f,String(g))}),r.appendChild(l)}),r}function xo(a){let{ref:e,config:t,onRemove:o}=a;if(t.renderMentionChip){let u="resolving",y,w=t.renderMentionChip({ref:e,status:u,payload:y,remove:o});return{get el(){return w},setStatus:(c,k)=>{if(c===u&&k===y)return;u=c,y=k;let P=t.renderMentionChip({ref:e,status:u,payload:y,remove:o});w.replaceWith(P),w=P}}}let r=e.iconName??t.chipIconName??"at-sign",s=S("div",{className:"persona-mention-chip",attrs:{"data-persona-mention-chip":"","data-status":"resolving",title:e.label}}),n=R("span","persona-mention-chip-icon"),i=u=>{n.replaceChildren();let y=U(u,13,"currentColor",2);y&&n.appendChild(y)};i(r);let l=R("span","persona-mention-chip-spinner"),f=S("span",{className:"persona-mention-chip-label",text:e.label}),g=S("button",{className:"persona-mention-chip-remove",attrs:{type:"button","aria-label":`Remove ${e.label} context`}}),p=U("x",11,"currentColor",2.5);return p?g.appendChild(p):g.textContent="\xD7",g.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),o()}),s.appendChild(l),s.appendChild(f),s.appendChild(g),{el:s,setStatus:u=>{s.setAttribute("data-status",u),u==="resolving"?(l.parentNode!==s&&s.insertBefore(l,f),n.parentNode===s&&n.remove(),s.setAttribute("title",e.label)):(l.parentNode===s&&l.remove(),n.parentNode!==s&&s.insertBefore(n,f),u==="error"?(i("triangle-alert"),s.setAttribute("title",`Couldn't add ${e.label} to context`)):(i(r),s.setAttribute("title",e.label)))}}}function Oo(a){let e=0;for(let t of a.split(`
|
|
2
|
-
`)){let o=/^ {0,3}(`+)/.exec(t);o&&o[1].length>e&&(e=o[1].length)}return e}function
|
|
1
|
+
"use strict";var me=Object.defineProperty;var Io=Object.getOwnPropertyDescriptor;var Bo=Object.getOwnPropertyNames;var Do=Object.prototype.hasOwnProperty;var Fo=(a,e)=>{for(var t in e)me(a,t,{get:e[t],enumerable:!0})},Ho=(a,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Bo(e))!Do.call(a,r)&&r!==t&&me(a,r,{get:()=>e[r],enumerable:!(o=Io(e,r))||o.enumerable});return a};var Oo=a=>Ho(me({},"__esModule",{value:!0}),a);var Qo={};Fo(Qo,{mountContextMentions:()=>Lo});module.exports=Oo(Qo);var R=(a,e)=>{let t=document.createElement(a);return e&&(t.className=e),t};var S=(a,e={},...t)=>{let o=document.createElement(a);if(e.className&&(o.className=e.className),e.text!==void 0&&(o.textContent=e.text),e.attrs)for(let[s,n]of Object.entries(e.attrs))o.setAttribute(s,n);if(e.style){let s=o.style,n=e.style;for(let i of Object.keys(n)){let l=n[i];l!=null&&(s[i]=l)}}let r=t.filter(s=>s!=null);return r.length>0&&o.append(...r),o};var xe=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"}]];var ce=[["path",{d:"M12 5v14"}],["path",{d:"m19 12-7 7-7-7"}]];var he=[["path",{d:"m12 19-7-7 7-7"}],["path",{d:"M19 12H5"}]];var ge=[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]];var Ce=[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]];var Me=[["path",{d:"m5 12 7-7 7 7"}],["path",{d:"M12 19V5"}]];var ve=[["circle",{cx:"12",cy:"12",r:"4"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"}]];var Se=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M4.929 4.929 19.07 19.071"}]];var ye=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"}]];var be=[["path",{d:"M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z"}]];var Ae=[["path",{d:"M12 8V4H8"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}],["path",{d:"M2 14h2"}],["path",{d:"M20 14h2"}],["path",{d:"M15 13v2"}],["path",{d:"M9 13v2"}]];var we=[["path",{d:"M12 10h.01"}],["path",{d:"M12 14h.01"}],["path",{d:"M12 6h.01"}],["path",{d:"M16 10h.01"}],["path",{d:"M16 14h.01"}],["path",{d:"M16 6h.01"}],["path",{d:"M8 10h.01"}],["path",{d:"M8 14h.01"}],["path",{d:"M8 6h.01"}],["path",{d:"M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2"}]];var ke=[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}],["path",{d:"M8 14h.01"}],["path",{d:"M12 14h.01"}],["path",{d:"M16 14h.01"}],["path",{d:"M8 18h.01"}],["path",{d:"M12 18h.01"}],["path",{d:"M16 18h.01"}]];var Pe=[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}]];var Te=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z"}],["circle",{cx:"12",cy:"13",r:"3"}]];var X=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}],["path",{d:"M18 17V9"}],["path",{d:"M13 17V5"}],["path",{d:"M8 17v-3"}]];var Re=[["path",{d:"M20 6 9 17l-5-5"}]];var Le=[["path",{d:"m6 9 6 6 6-6"}]];var Ie=[["path",{d:"m15 18-6-6 6-6"}]];var Be=[["path",{d:"m9 18 6-6-6-6"}]];var De=[["path",{d:"m18 15-6-6-6 6"}]];var K=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m9 12 2 2 4-4"}]];var $=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"m15 9-6 6"}],["path",{d:"m9 9 6 6"}]];var Fe=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4"}],["path",{d:"M21 14H11"}],["path",{d:"m15 10-4 4 4 4"}]];var He=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}]];var Oe=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 6v6l4 2"}]];var Z=[["path",{d:"m18 16 4-4-4-4"}],["path",{d:"m6 8-4 4 4 4"}],["path",{d:"m14.5 4-5 16"}]];var Ee=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];var qe=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10"}]];var We=[["line",{x1:"12",x2:"12",y1:"2",y2:"22"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"}]];var Ue=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];var Q=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"12",cy:"5",r:"1"}],["circle",{cx:"12",cy:"19",r:"1"}]];var _=[["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}]];var Ne=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];var Ve=[["path",{d:"M15 3h6v6"}],["path",{d:"M10 14 21 3"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}]];var ze=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];var Ge=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 12.5 8 15l2 2.5"}],["path",{d:"m14 12.5 2 2.5-2 2.5"}]];var Xe=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M8 13h2"}],["path",{d:"M14 13h2"}],["path",{d:"M8 17h2"}],["path",{d:"M14 17h2"}]];var Ke=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["path",{d:"M10 9H8"}],["path",{d:"M16 13H8"}],["path",{d:"M16 17H8"}]];var $e=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}]];var Ze=[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1"}]];var Qe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M7 3v18"}],["path",{d:"M3 7.5h4"}],["path",{d:"M3 12h18"}],["path",{d:"M3 16.5h4"}],["path",{d:"M17 3v18"}],["path",{d:"M17 7.5h4"}],["path",{d:"M17 16.5h4"}]];var _e=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528"}]];var je=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}]];var Je=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];var j=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"}]];var Ye=[["path",{d:"M12 7v14"}],["path",{d:"M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8"}],["path",{d:"M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5"}],["rect",{x:"3",y:"7",width:"18",height:"4",rx:"1"}]];var et=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}],["path",{d:"M2 12h20"}]];var tt=[["line",{x1:"4",x2:"20",y1:"9",y2:"9"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21"}]];var ot=[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3"}]];var at=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"}]];var rt=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}],["path",{d:"M12 7v5l4 2"}]];var J=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}]];var st=[["path",{d:"M16 5h6"}],["path",{d:"M19 2v6"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}],["circle",{cx:"9",cy:"9",r:"2"}]];var nt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}],["circle",{cx:"9",cy:"9",r:"2"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}]];var lt=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];var ft=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"}],["path",{d:"m21 2-9.6 9.6"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5"}]];var it=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"}],["path",{d:"M9 18h6"}],["path",{d:"M10 22h4"}]];var dt=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];var Y=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]];var ut=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];var pt=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4"}]];var mt=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}]];var xt=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"}],["circle",{cx:"12",cy:"10",r:"3"}]];var ct=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3"}]];var ht=[["path",{d:"M4 5h16"}],["path",{d:"M4 12h16"}],["path",{d:"M4 19h16"}]];var gt=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}]];var Ct=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"}]];var Mt=[["path",{d:"M12 19v3"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"}]];var vt=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3"}]];var St=[["path",{d:"M5 12h14"}]];var yt=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21"}]];var bt=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"}]];var At=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"}],["path",{d:"M12 22V12"}],["polyline",{points:"3.29 7 12 12 20.71 7"}],["path",{d:"m7.5 4.27 9 5.15"}]];var ee=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M9 3v18"}]];var wt=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"}]];var kt=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1"}]];var te=[["path",{d:"M13 21h8"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}]];var Pt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];var Tt=[["line",{x1:"19",x2:"5",y1:"5",y2:"19"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5"}]];var Rt=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"}]];var Lt=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"}]];var It=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];var Bt=[["path",{d:"M12 17V7"}],["path",{d:"M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8"}],["path",{d:"M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z"}]];var Dt=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];var Ft=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];var Ht=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7"}]];var Ot=[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]];var Et=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"}],["path",{d:"m21.854 2.147-10.94 10.939"}]];var qt=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}],["circle",{cx:"12",cy:"12",r:"3"}]];var Wt=[["path",{d:"M12 2v13"}],["path",{d:"m16 6-4-4-4 4"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}]];var Ut=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"M12 8v4"}],["path",{d:"M12 16h.01"}]];var Nt=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"m9 12 2 2 4-4"}]];var oe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}],["path",{d:"m14.5 9.5-5 5"}],["path",{d:"m9.5 9.5 5 5"}]];var Vt=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"}]];var zt=[["path",{d:"M16 10a4 4 0 0 1-8 0"}],["path",{d:"M3.103 6.034h17.794"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z"}]];var Gt=[["circle",{cx:"8",cy:"21",r:"1"}],["circle",{cx:"19",cy:"21",r:"1"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12"}]];var Xt=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2"}],["path",{d:"M12 18h.01"}]];var ae=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"}],["path",{d:"M20 2v4"}],["path",{d:"M22 4h-4"}],["circle",{cx:"4",cy:"20",r:"2"}]];var Kt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}]];var $t=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"}]];var Zt=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05"}]];var Qt=[["circle",{cx:"12",cy:"12",r:"4"}],["path",{d:"M12 2v2"}],["path",{d:"M12 20v2"}],["path",{d:"m4.93 4.93 1.41 1.41"}],["path",{d:"m17.66 17.66 1.41 1.41"}],["path",{d:"M2 12h2"}],["path",{d:"M20 12h2"}],["path",{d:"m6.34 17.66-1.41 1.41"}],["path",{d:"m19.07 4.93-1.41 1.41"}]];var _t=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}]];var jt=[["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"}],["path",{d:"M17 14V2"}]];var Jt=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"}],["path",{d:"M7 10v12"}]];var Yt=[["line",{x1:"10",x2:"14",y1:"2",y2:"2"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11"}],["circle",{cx:"12",cy:"14",r:"8"}]];var eo=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];var to=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];var re=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];var oo=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2"}],["path",{d:"M15 18H9"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14"}],["circle",{cx:"17",cy:"18",r:"2"}],["circle",{cx:"7",cy:"18",r:"2"}]];var ao=[["path",{d:"M12 3v12"}],["path",{d:"m17 8-5-5-5 5"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}]];var ro=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}],["circle",{cx:"12",cy:"7",r:"4"}]];var so=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]];var no=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15"}]];var lo=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"}]];var fo=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var io=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"}]];var Eo={activity:xe,"arrow-down":ce,"arrow-up":Me,"arrow-up-right":Ce,bot:Ae,"chevron-down":Le,"chevron-up":De,"chevron-right":Be,"chevron-left":Ie,check:Re,clipboard:He,"clipboard-copy":Fe,"code-xml":Z,copy:Ee,file:$e,"file-code":Ge,"file-spreadsheet":Xe,"file-text":Ke,"image-plus":st,loader:ut,"loader-circle":Y,mic:Mt,paperclip:wt,"refresh-cw":Dt,search:Ot,send:Et,"shield-alert":Ut,"shield-check":Nt,"shield-x":oe,square:Kt,"thumbs-down":jt,"thumbs-up":Jt,upload:ao,"volume-2":so,x:fo,user:ro,mail:mt,phone:Rt,calendar:Pe,clock:Oe,building:we,"map-pin":xt,lock:pt,key:ft,"credit-card":qe,"at-sign":ve,hash:tt,globe:et,link:dt,"circle-check":K,"circle-x":$,"triangle-alert":re,info:lt,ban:Se,shield:Vt,"arrow-left":he,"arrow-right":ge,"external-link":Ve,ellipsis:_,"ellipsis-vertical":Q,menu:ht,house:J,"panel-left":ee,plus:It,minus:St,pencil:Pt,"pen-line":te,trash:to,"trash-2":eo,save:Ht,download:Ue,share:Wt,funnel:j,settings:qt,"rotate-cw":Ft,maximize:ct,minimize:vt,"shopping-cart":Gt,"shopping-bag":zt,package:At,truck:oo,tag:_t,gift:Ye,receipt:Bt,wallet:lo,store:Zt,"dollar-sign":We,percent:Tt,play:Lt,pause:kt,"volume-x":no,camera:Te,image:nt,film:Qe,headphones:ot,"message-circle":gt,"message-square":Ct,bell:ye,heart:at,star:$t,eye:ze,"eye-off":Ne,bookmark:be,"calendar-days":ke,history:rt,timer:Yt,folder:Je,"folder-open":je,files:Ze,"chart-column":X,sparkles:ae,zap:io,sun:Qt,moon:bt,flag:_e,lightbulb:it,monitor:yt,smartphone:Xt},U=(a,e=24,t="currentColor",o=2)=>{let r=Eo[a];return r?qo(r,e,t,o):(console.warn(`Lucide icon "${a}" is not in the Persona registry. Add it to packages/widget/src/utils/icons.ts (see docs/icon-registry-shortlist.md).`),null)};function qo(a,e,t,o){if(!Array.isArray(a))return null;let r=document.createElementNS("http://www.w3.org/2000/svg","svg");return r.setAttribute("width",String(e)),r.setAttribute("height",String(e)),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke",t),r.setAttribute("stroke-width",String(o)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.setAttribute("aria-hidden","true"),a.forEach(s=>{if(!Array.isArray(s)||s.length<2)return;let n=s[0],i=s[1];if(!i)return;let l=document.createElementNS("http://www.w3.org/2000/svg",n);Object.entries(i).forEach(([f,g])=>{f!=="stroke"&&l.setAttribute(f,String(g))}),r.appendChild(l)}),r}function ho(a){let{ref:e,config:t,onRemove:o}=a;if(t.renderMentionChip){let u="resolving",y,w=t.renderMentionChip({ref:e,status:u,payload:y,remove:o});return{get el(){return w},setStatus:(c,k)=>{if(c===u&&k===y)return;u=c,y=k;let P=t.renderMentionChip({ref:e,status:u,payload:y,remove:o});w.replaceWith(P),w=P}}}let r=e.iconName??t.chipIconName??"at-sign",s=S("div",{className:"persona-mention-chip",attrs:{"data-persona-mention-chip":"","data-status":"resolving",title:e.label}}),n=R("span","persona-mention-chip-icon"),i=u=>{n.replaceChildren();let y=U(u,13,"currentColor",2);y&&n.appendChild(y)};i(r);let l=R("span","persona-mention-chip-spinner"),f=S("span",{className:"persona-mention-chip-label",text:e.label}),g=S("button",{className:"persona-mention-chip-remove",attrs:{type:"button","aria-label":`Remove ${e.label} context`}}),p=U("x",11,"currentColor",2.5);return p?g.appendChild(p):g.textContent="\xD7",g.addEventListener("click",u=>{u.preventDefault(),u.stopPropagation(),o()}),s.appendChild(l),s.appendChild(f),s.appendChild(g),{el:s,setStatus:u=>{s.setAttribute("data-status",u),u==="resolving"?(l.parentNode!==s&&s.insertBefore(l,f),n.parentNode===s&&n.remove(),s.setAttribute("title",e.label)):(l.parentNode===s&&l.remove(),n.parentNode!==s&&s.insertBefore(n,f),u==="error"?(i("triangle-alert"),s.setAttribute("title",`Couldn't add ${e.label} to context`)):(i(r),s.setAttribute("title",e.label)))}}}function Wo(a){let e=0;for(let t of a.split(`
|
|
2
|
+
`)){let o=/^ {0,3}(`+)/.exec(t);o&&o[1].length>e&&(e=o[1].length)}return e}function uo(a,e){let t="`".repeat(Math.max(3,Wo(e)+1));return`${t}${a}
|
|
3
3
|
${e}
|
|
4
|
-
${t}`}function
|
|
4
|
+
${t}`}function Uo(a,e,t){return e.includes("</document_content>")?uo(a,e):`<document index="${t+1}">
|
|
5
5
|
<source>${a}</source>
|
|
6
6
|
<document_content>
|
|
7
7
|
${e}
|
|
8
8
|
</document_content>
|
|
9
|
-
</document>`}function
|
|
9
|
+
</document>`}function go(a,e,t="fenced"){if(typeof t=="function")try{return t(a,e)}catch(o){return console.warn("[persona] contextMentions.llmFormat threw; falling back to the fenced format for this mention",o),uo(a.label,a.text)}return t==="document"?Uo(a.label,a.text,e):uo(a.label,a.text)}function se(a,e){return{sourceId:a.id,itemId:e.id,label:e.label,iconName:e.iconName,color:e.color}}var Co=(a,e)=>`${a}\0${e}`,ne=class{constructor(e){this.mentions=[];this.opts=e,this.updateRowVisibility()}get maxMentions(){return this.opts.mentionConfig.maxMentions??8}hasMentions(){return this.mentions.length>0}add(e,t,o=""){let r=Co(e.id,t.id);if(this.mentions.some(i=>i.key===r))return this.reject(e,t,"duplicate");if(this.atLimit())return this.reject(e,t,"limit");let s=se(e,t),n={key:r,source:e,item:t,ref:s,status:"resolving",args:o};return n.chip=ho({ref:s,config:this.opts.mentionConfig,onRemove:()=>this.remove(r)}),this.opts.contextRow.appendChild(n.chip.el),this.startPending(n),this.updateRowVisibility(),!0}atLimit(){return this.mentions.length>=this.maxMentions}admit(e,t){return this.atLimit()?this.reject(e,t,"limit"):!0}track(e,t,o,r="",s){let n={key:e,source:t,item:o,ref:se(t,o),status:"resolving",args:r,reportStatus:s};this.startPending(n)}reject(e,t,o){return this.opts.mentionConfig.onMentionRejected?.(t,o),this.opts.emit?.("rejected",{sourceId:e.id,itemId:t.id,reason:o}),!1}startPending(e){this.mentions.push(e),e.source.resolveOn==="submit"?(e.status="ready",e.chip?.setStatus("ready"),e.reportStatus?.("resolved")):e.resolvePromise=this.resolvePending(e),this.opts.announce(`Added ${e.ref.label} to context`)}buildResolveContext(e,t,o=this.opts.getComposerText()){return{messages:this.opts.getMessages(),config:this.opts.getConfig(),composerText:o,args:t,signal:e}}async resolvePending(e){let t=new AbortController;e.abort=t;try{let o=await e.source.resolve(e.item,this.buildResolveContext(t.signal,e.args));if(t.signal.aborted)return;e.payload=o,e.status="ready",e.chip?.setStatus("ready",o),e.reportStatus?.("resolved")}catch(o){if(t.signal.aborted)return;e.status="error",e.chip?.setStatus("error"),e.reportStatus?.("error"),(this.opts.announceError??this.opts.announce)(`Couldn't attach ${e.ref.label} to context`),this.opts.mentionConfig.onMentionResolveError?.(e.item,o),this.opts.emit?.("resolve-error",{sourceId:e.source.id,itemId:e.item.id})}}remove(e){let t=this.mentions.findIndex(r=>r.key===e);if(t===-1)return;let[o]=this.mentions.splice(t,1);o.abort?.abort(),o.chip?.el.remove(),this.updateRowVisibility(),this.opts.announce(`Removed ${o.ref.label} from context`)}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.updateRowVisibility()}collectForSubmit(){let e=[...this.mentions],t=e.map(s=>s.ref),o=this.opts.getComposerText();for(let s of e)s.chip?.el.remove();return this.mentions.length=0,this.updateRowVisibility(),{refs:t,finalize:async()=>{var g;let s=await Promise.all(e.map(async p=>{try{return p.source.resolveOn==="submit"?await p.source.resolve(p.item,this.buildResolveContext(new AbortController().signal,p.args,o)):(p.resolvePromise&&await p.resolvePromise,p.payload??null)}catch(m){try{this.opts.mentionConfig.onMentionResolveError?.(p.item,m)}catch(u){typeof console<"u"&&console.warn("[Persona] onMentionResolveError callback threw",u)}return this.opts.emit?.("resolve-error",{sourceId:p.source.id,itemId:p.item.id}),null}})),n=[],i=[],l={},f=new Set;for(let p=0;p<e.length;p++){let m=e[p],u=s[p];if(!u)continue;let y=Co(m.source.id,m.item.id);if(!f.has(y)){if(f.add(y),u.llmAppend&&u.llmAppend.trim())try{n.push(go({label:m.ref.label,text:u.llmAppend,ref:m.ref,item:m.item},n.length,this.opts.mentionConfig.llmFormat))}catch(w){typeof console<"u"&&console.warn("[Persona] context-mention llmFormat threw",w)}u.contentParts?.length&&i.push(...u.contentParts),u.context&&((l[g=m.source.id]??(l[g]={}))[m.item.id]=u.context)}}return{blocks:n,contentParts:i,context:l}}}}updateRowVisibility(){this.opts.contextRow.style.display=this.mentions.length>0?"flex":"none"}};var fe=a=>a.nodeType===Node.DOCUMENT_NODE,vo=a=>a.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&a.host!==void 0;function Mo(a){let e=a.getRootNode?.();return e&&vo(e)||e&&fe(e)?e:a.ownerDocument??document}function le(a,e,t){let o=fe(a)?a.head:a,r=e.replace(/["\\]/g,"\\$&");if(o.querySelector(`style[data-persona-plugin-style="${r}"]`))return;let n=(fe(a)?a:a.ownerDocument??document).createElement("style");n.setAttribute("data-persona-plugin-style",e),n.textContent=t,o.appendChild(n)}function So(a,e,t){if(fe(a)||vo(a)){le(a,e,t);return}let o=a;if(o.isConnected){le(Mo(o),e,t);return}let r=o.ownerDocument??document;le(r,e,t),queueMicrotask(()=>{let s=Mo(o);s!==r&&le(s,e,t)})}function No(a){let e=a.getRootNode?.();return e instanceof ShadowRoot?e:(a.ownerDocument??document).body}function yo(a){let{anchor:e,content:t,placement:o="bottom-start",offset:r=6,matchAnchorWidth:s=!1,horizontalOffset:n,verticalOffset:i,zIndex:l=2147483e3,onOpen:f,onDismiss:g}=a,p=a.container??No(e),m=!1,u=null,y=()=>{if(!m)return;let c=e.getBoundingClientRect();t.style.position="fixed",s&&(t.style.minWidth=`${c.width}px`),n&&(t.style.maxWidth=`${c.width}px`);let k=t.getBoundingClientRect(),P=i?.()??null,O=P!=null?c.top+P:c.top,N=o==="top-start"||o==="top-end"?O-r-k.height:c.bottom+r,E=o==="bottom-end"||o==="top-end"?c.right-k.width:c.left,ue=n?.()??null;if(ue!=null){let xo=Math.max(c.left,c.right-k.width);E=Math.min(Math.max(c.left+ue,c.left),xo)}t.style.top=`${N}px`,t.style.left=`${E}px`},w=()=>{m&&(m=!1,u&&(u(),u=null),t.remove())},H=()=>{if(m)return;m=!0,l!=null&&(t.style.zIndex=String(l)),p.appendChild(t),y();let c=(e.ownerDocument??document).defaultView??window,k=e.ownerDocument??document,P=()=>{if(!e.isConnected){w(),g?.("anchor-removed");return}y()},O=z=>{let E=typeof z.composedPath=="function"?z.composedPath():[];E.includes(t)||E.includes(e)||(w(),g?.("outside"))},N=c.setTimeout(()=>{k.addEventListener("pointerdown",O,!0)},0);c.addEventListener("scroll",P,!0),c.addEventListener("resize",P),u=()=>{c.clearTimeout(N),k.removeEventListener("pointerdown",O,!0),c.removeEventListener("scroll",P,!0),c.removeEventListener("resize",P)},f?.()};return{get isOpen(){return m},open:H,close:w,toggle:()=>m?w():H(),reposition:y,destroy:w}}var bo=`
|
|
10
10
|
.persona-mention-menu {
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
display: flex;
|
|
@@ -164,11 +164,11 @@ ${e}
|
|
|
164
164
|
min-height: 36px;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
`;var
|
|
168
|
-
`:o===""||
|
|
169
|
-
`||n==="\uFFFC"||!r&&So.test(n))return null;s--}return null}function io(a,e,t){for(let o of t){let r=Uo(a,e,o.trigger,o.position??"anywhere",o.allowSpaces??!1);if(r)return{channel:o,match:r}}return null}function yo(a,e,t){return{value:a.slice(0,e.triggerIndex)+a.slice(t),caret:e.triggerIndex}}function bo(a){let e={trigger:a.trigger??"@",position:a.triggerPosition??"anywhere",allowSpaces:!1,sources:Array.isArray(a.sources)?a.sources:[],searchPlaceholder:a.searchPlaceholder,showButton:a.showButton!==!1,buttonIconName:a.buttonIconName,buttonTooltipText:a.buttonTooltipText},t=(a.triggers??[]).map(o=>({trigger:o.trigger,position:o.triggerPosition??"anywhere",allowSpaces:o.allowSpaces??!1,sources:Array.isArray(o.sources)?o.sources:[],searchPlaceholder:o.searchPlaceholder,showButton:o.showButton===!0,buttonIconName:o.buttonIconName,buttonTooltipText:o.buttonTooltipText}));return[e,...t]}function le(a){let e=a.replace(/^\s+/,""),t=e.search(/\s/);return t===-1?{name:e,args:""}:{name:e.slice(0,t),args:e.slice(t+1).trim()}}var Ao=new Map,No=(a,e,t)=>{let o=`${a}|${e}|${t}`,r=Ao.get(o);return r===void 0&&(r=U(a,e,"currentColor",t),Ao.set(o,r)),r?r.cloneNode(!0):null};function wo(a){let{config:e,listboxId:t}=a,o=S("div",{className:"persona-mention-menu",attrs:{"data-persona-mention-menu":""}}),r=S("div",{className:"persona-mention-search",style:{display:"none"}}),s=R("span","persona-mention-search-icon"),n=U("search",15,"currentColor",2);n&&s.appendChild(n);let i=S("input",{className:"persona-mention-search-input",attrs:{type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-controls":t,"aria-label":e.searchPlaceholder??"Search context",placeholder:e.searchPlaceholder??"Search context\u2026",autocomplete:"off",autocapitalize:"off",spellcheck:"false"}});r.append(s,i),i.addEventListener("input",()=>a.onSearchInput?.(i.value)),i.addEventListener("keydown",d=>a.onSearchKeydown?.(d));let l=S("div",{className:"persona-mention-list",attrs:{role:"listbox",id:t,"aria-label":"Context mentions"}});o.append(r,l);let f=[],g=[],p=-1,m=new Map,u=(d,x)=>`${d}\0${x}`,y=d=>`${t}-opt-${d}`,w=d=>`${t}-grp-${d}`,H=(d,x)=>{let C=f[d];C&&(x?C.setAttribute("data-active","true"):C.removeAttribute("data-active"),C.setAttribute("aria-selected",x?"true":"false"),g[d]?.(x))},c=(d,x=!0)=>{p>=0&&p!==d&&H(p,!1),p=d;let C=f[d];C?(H(d,!0),x&&C.scrollIntoView?.({block:"nearest"}),l.setAttribute("aria-activedescendant",C.id),i.setAttribute("aria-activedescendant",C.id)):(l.removeAttribute("aria-activedescendant"),i.removeAttribute("aria-activedescendant"))},k=(d,x)=>{let C=w(x),v=S("div",{className:"persona-mention-group",attrs:{role:"group","aria-labelledby":C}});return v.appendChild(S("div",{className:"persona-mention-group-header",attrs:{id:C},text:d})),v},P=()=>{let d=S("div",{className:"persona-mention-option",attrs:{role:"option","aria-selected":"false"}}),x=R("span","persona-mention-option-icon");d.appendChild(x);let C="",v=R("span","persona-mention-option-text"),L=R("span","persona-mention-option-labelline"),T=R("span","persona-mention-option-label");L.appendChild(T),v.appendChild(L),d.appendChild(v);let A=null,b=null,M={el:d,index:0,update:(h,q,F)=>{M.index=q,d.id=y(q),d.setAttribute("aria-setsize",String(F)),d.setAttribute("aria-posinset",String(q+1)),d.removeAttribute("data-active"),d.setAttribute("aria-selected","false");let I=h.iconName??e.chipIconName??"at-sign";if(I!==C){C=I;let W=No(I,15,2);x.replaceChildren(...W?[W]:[])}T.textContent!==h.label&&(T.textContent=h.label);let B=h.commandArgsPlaceholder?`\u2039${h.commandArgsPlaceholder}\u203A`:null;B?(A||(A=R("span","persona-mention-option-arghint"),L.appendChild(A)),A.textContent!==B&&(A.textContent=B)):A&&(A.remove(),A=null),h.description?(b||(b=R("span","persona-mention-option-desc"),v.appendChild(b)),b.textContent!==h.description&&(b.textContent=h.description)):b&&(b.remove(),b=null)}};return d.addEventListener("mousedown",h=>{h.button===0&&(h.preventDefault(),a.onSelectIndex(M.index))}),d.addEventListener("mouseenter",()=>a.onHoverIndex(M.index)),M},O=(d,x,C,v,L)=>{let T=S("div",{className:"persona-mention-option",attrs:{role:"option",id:y(v),"aria-selected":"false","aria-setsize":String(L),"aria-posinset":String(v+1)}}),A=b=>{T.replaceChildren(e.renderMentionItem({item:d,source:x,query:C,active:b,index:v}))};return A(!1),T.addEventListener("mousedown",b=>{b.button===0&&(b.preventDefault(),a.onSelectIndex(v))}),T.addEventListener("mouseenter",()=>a.onHoverIndex(v)),{el:T,paint:A}},N=d=>{let x=S("div",{className:"persona-mention-status persona-mention-error"});if(x.appendChild(S("span",{className:"persona-mention-error-text",text:`Couldn't load ${d.label}`})),a.onRetry){let C=S("button",{className:"persona-mention-retry",attrs:{type:"button"},text:"Retry"});C.addEventListener("mousedown",v=>v.preventDefault()),C.addEventListener("click",v=>{v.preventDefault(),a.onRetry(d.id)}),x.appendChild(C)}return x};return{el:o,render:d=>{l.replaceChildren(),f=[],g=[],p=-1;let x=new Set,C=0,v=0,L=0,T=0,A=0,b=d.groups.reduce((M,h)=>h.status==="ready"?M+h.items.length:M,0);for(let M of d.groups)if(M.status==="loading"){L++;let h=k(M.source.label,A++);h.appendChild(S("div",{className:"persona-mention-status persona-mention-loading",attrs:{role:"presentation"},text:"Loading\u2026"})),l.appendChild(h)}else if(M.status==="error"){T++;let h=k(M.source.label,A++);h.appendChild(N(M.source)),l.appendChild(h)}else if(M.status==="ready"&&M.items.length>0){let h=new Map;for(let F of M.items){let I=F.group??M.source.label,B=h.get(I);B?B.push(F):h.set(I,[F])}let q=Array.from(h.entries());q.forEach(([F,I],B)=>{let W=k(F,A++);for(let de of I){let mo=C++,G;if(e.renderMentionItem){let D=O(de,M.source,d.query,mo,b);G=D.el,g.push(D.paint)}else{let D=u(M.source.id,de.id),V=x.has(D)?void 0:m.get(D);V||(V=P(),x.has(D)||m.set(D,V)),x.add(D),V.update(de,mo,b),G=V.el,g.push(null)}f.push(G),W.appendChild(G),v++}M.truncated&&B===q.length-1&&W.appendChild(S("div",{className:"persona-mention-hint",attrs:{role:"presentation"},text:"Keep typing to narrow\u2026"})),l.appendChild(W)})}for(let M of m.keys())x.has(M)||m.delete(M);v===0&&L===0&&T===0&&l.appendChild(S("div",{className:"persona-mention-empty",attrs:{role:"presentation"},text:"No matches"})),f.length>0?c(Math.min(Math.max(0,d.activeIndex),f.length-1)):(l.removeAttribute("aria-activedescendant"),i.removeAttribute("aria-activedescendant"))},setActiveIndex:c,destroy:()=>{l.replaceChildren(),f=[],m.clear(),o.remove()},showSearch:(d,x)=>{i.value=d,x&&(i.placeholder=x),r.style.display="",i.setAttribute("aria-expanded","true"),i.focus(),typeof requestAnimationFrame=="function"&&requestAnimationFrame(()=>{r.style.display!=="none"&&i.focus()})},hideSearch:()=>{r.style.display="none",i.value="",i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant")}}}var Vo=a=>!!a&&(typeof a=="object"||typeof a=="function")&&typeof a.then=="function",zo=0,fe=class{constructor(e){this.popover=null;this.resizeObserver=null;this.isOpenState=!1;this.query="";this.triggerMatch=null;this.activeIndex=0;this.activeKey=null;this.pickerMode=!1;this.pickerTrigger=null;this.groups=[];this.flat=[];this.searchToken=0;this.searchAbort=null;this.debounceTimer=null;this.knownAsync=new Set;this.invokedForToken=new Set;this.lastAnnouncedCount=-1;this.triggerAnchorOffset=null;this.measuredTriggerIndex=null;this.opts=e;let t=e.mentionConfig,o=bo(t),r=o.filter(n=>n.sources.length>0);this.channels=r.length>0?r:[o[0]],this.activeChannel=this.channels[0],this.maxPerGroup=t.maxItemsPerGroup??6,this.debounceMs=t.searchDebounceMs??150,this.listboxId=`persona-mention-listbox-${++zo}`,this.menu=e.mentionConfig.renderMentionMenu?this.createHostMenu():wo({config:e.mentionConfig,listboxId:this.listboxId,onSelectIndex:n=>this.selectIndex(n),onHoverIndex:n=>this.setActiveIndex(n,!1),onRetry:n=>this.retrySource(n),onSearchInput:n=>this.setQuery(n),onSearchKeydown:n=>{this.handleKeydown(n)}});let s=e.composerInput.element;s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",this.listboxId)}get input(){return this.opts.composerInput}createHostMenu(){let e=document.createElement("div");e.setAttribute("data-persona-mention-menu",""),e.setAttribute("role","listbox"),e.id=this.listboxId;let t=()=>{let o=this.opts.mentionConfig.renderMentionMenu({query:this.query,groups:this.groups.map(r=>({source:r.source,items:r.items})),status:Object.fromEntries(this.groups.map(r=>[r.source.id,r.status])),activeIndex:this.activeIndex,select:r=>{let s=this.groups.find(n=>n.items.includes(r));s&&this.commit(s.source,r)},close:()=>this.close()});e.replaceChildren(o)};return{el:e,render:t,setActiveIndex:t,destroy:()=>e.remove()}}isOpen(){return this.isOpenState}openFromButton(e){let t=e&&this.channels.find(n=>n.trigger===e)||this.channels[0],o=this.input.getSelection().start,r=io(this.input.getLogicalText(),o,[t]);if(r){this.pickerMode=!1,this.triggerMatch=r.match,this.isOpenState?(this.switchChannel(t),this.setQuery(r.match.query)):this.open(r.match.query,t),this.input.focus();return}let s=this.pickerTrigger;this.pickerMode=!0,this.pickerTrigger=t.trigger,this.triggerMatch=null,this.isOpenState?(s&&s!==t.trigger&&this.opts.onPickerOpenChange?.(!1,s,this.listboxId),this.switchChannel(t),this.setQuery("")):this.open("",t),this.menu.showSearch?this.menu.showSearch("",t.searchPlaceholder):this.input.focus(),this.opts.onPickerOpenChange?.(!0,t.trigger,this.listboxId)}onInput(){let e=this.input.getSelection().start,t=io(this.input.getLogicalText(),e,this.channels);if(!t){this.isOpenState&&this.close();return}if(this.isInlineArgTail(t.channel,t.match.query)){this.triggerMatch=null,this.isOpenState&&this.close(!1);return}this.triggerMatch=t.match,this.isOpenState?(this.switchChannel(t.channel),this.measuredTriggerIndex!==t.match.triggerIndex&&this.updateTriggerAnchor(),this.setQuery(t.match.query)):this.open(t.match.query,t.channel)}switchChannel(e){e!==this.activeChannel&&(this.activeChannel=e,this.groups=[],this.activeIndex=0)}open(e,t){if(this.isOpenState=!0,this.activeChannel=t,this.groups=[],this.activeIndex=0,this.lastAnnouncedCount=-1,!this.popover){let o=this.canAnchorMenu();if(this.popover=Mo({anchor:this.opts.anchor,content:this.menu.el,placement:"top-start",matchAnchorWidth:!o,offset:6,container:this.opts.popoverContainer,horizontalOffset:o?()=>this.triggerAnchorOffset?.x??null:void 0,verticalOffset:o?()=>this.triggerAnchorOffset?.y??null:void 0,onDismiss:()=>this.close(!1)}),o){let r=this.opts.anchor.getBoundingClientRect().width;this.menu.el.style.minWidth=`${Math.min(220,r)}px`}}this.updateTriggerAnchor(),this.popover.open(),Co(this.menu.el,"persona-mention-menu",vo),this.observeComposerResize(),this.opts.emit?.("opened",{trigger:t.trigger}),this.setQuery(e)}observeComposerResize(){typeof ResizeObserver>"u"||this.resizeObserver||(this.resizeObserver=new ResizeObserver(()=>{this.isOpenState&&(this.updateTriggerAnchor(),this.popover?.reposition())}),this.resizeObserver.observe(this.opts.anchor))}disconnectComposerResize(){this.resizeObserver?.disconnect(),this.resizeObserver=null}canAnchorMenu(){return this.isInlineDisplay()&&!!this.input.getLogicalRangeRect}updateTriggerAnchor(){let e=this.triggerMatch,t=this.input.getLogicalRangeRect;if(this.measuredTriggerIndex=e?.triggerIndex??null,this.triggerAnchorOffset=null,!e||!t)return;let o=t(e.triggerIndex,e.triggerIndex+1);if(!o)return;let r=this.opts.anchor.getBoundingClientRect(),s=o.top-r.top,n=this.input.element,i=typeof getComputedStyle=="function"&&getComputedStyle(n).direction==="rtl";this.triggerAnchorOffset={x:i?null:o.left-r.left,y:s}}close(e=!0){this.isOpenState&&(this.isOpenState=!1,this.disconnectComposerResize(),this.debounceTimer&&clearTimeout(this.debounceTimer),this.searchAbort?.abort(),this.searchToken++,this.popover?.close(),this.input.element.removeAttribute("aria-activedescendant"),this.pickerMode&&(this.pickerMode=!1,this.menu.hideSearch?.(),this.opts.onPickerOpenChange?.(!1,this.pickerTrigger??this.activeChannel.trigger,this.listboxId),this.pickerTrigger=null,e&&this.input.focus()))}setQuery(e){this.query=e,this.activeIndex=0,this.activeKey=null;let t=++this.searchToken;this.invokedForToken.clear(),this.searchAbort?.abort(),this.searchAbort=new AbortController;for(let o of this.activeChannel.sources)this.knownAsync.has(o.id)?this.setGroupStatus(o.id,"loading"):(this.invokedForToken.add(o.id),this.invokeSource(o,t));this.render(),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{if(t===this.searchToken)for(let o of this.activeChannel.sources)this.knownAsync.has(o.id)&&!this.invokedForToken.has(o.id)&&this.invokeSource(o,t)},this.debounceMs)}invokeSource(e,t){let o={messages:this.opts.getMessages(),config:this.opts.getConfig(),signal:this.searchAbort.signal},r;try{r=e.search(this.query,o)}catch{this.setGroupStatus(e.id,"error"),this.render();return}Vo(r)?(this.knownAsync.add(e.id),this.setGroupStatus(e.id,"loading"),r.then(s=>{t===this.searchToken&&(this.setGroupItems(e.id,s),this.render())}).catch(()=>{t===this.searchToken&&(this.setGroupStatus(e.id,"error"),this.render())})):this.setGroupItems(e.id,r)}getOrCreateGroup(e){let t=this.groups.find(o=>o.source.id===e.id);if(!t){t={source:e,items:[],status:"loading",truncated:!1};let o=this.activeChannel.sources;this.groups.push(t),this.groups.sort((r,s)=>o.findIndex(n=>n.id===r.source.id)-o.findIndex(n=>n.id===s.source.id))}return t}setGroupStatus(e,t){let o=this.activeChannel.sources.find(r=>r.id===e);o&&(this.getOrCreateGroup(o).status=t)}setGroupItems(e,t){let o=this.activeChannel.sources.find(s=>s.id===e);if(!o)return;let r=this.getOrCreateGroup(o);r.truncated=t.length>this.maxPerGroup,r.items=t.slice(0,this.maxPerGroup),r.status=r.items.length===0?"empty":"ready"}keyOf(e){return JSON.stringify([e.source.id,e.item.id])}rebuildFlat(){this.flat=[];for(let e of this.groups)if(e.status==="ready")for(let t of e.items)this.flat.push({source:e.source,item:t});if(this.activeKey){let e=this.flat.findIndex(t=>this.keyOf(t)===this.activeKey);this.activeIndex=e>=0?e:Math.min(this.activeIndex,Math.max(0,this.flat.length-1))}else this.activeIndex>=this.flat.length&&(this.activeIndex=Math.max(0,this.flat.length-1))}viewModel(){return{query:this.query,groups:this.groups,activeIndex:this.activeIndex}}render(){this.rebuildFlat(),this.menu.render(this.viewModel()),this.syncActiveDescendant(),this.popover?.reposition();let e=this.groups.some(t=>t.status==="loading");this.flat.length===0&&e||this.flat.length!==this.lastAnnouncedCount&&(this.lastAnnouncedCount=this.flat.length,this.opts.announce(this.flat.length===0?"No matches":this.flat.length===1?"1 result":`${this.flat.length} results`),this.opts.emit?.("searched",{query:this.query,results:this.flat.length}))}setActiveIndex(e,t=!0){e<0||e>=this.flat.length||(this.activeIndex=e,this.activeKey=this.keyOf(this.flat[e]),this.menu.setActiveIndex(e,t),this.syncActiveDescendant())}syncActiveDescendant(){this.isOpenState&&!this.pickerMode&&this.activeIndex>=0&&this.activeIndex<this.flat.length?this.input.element.setAttribute("aria-activedescendant",`${this.listboxId}-opt-${this.activeIndex}`):this.input.element.removeAttribute("aria-activedescendant")}retrySource(e){let t=this.activeChannel.sources.find(o=>o.id===e);!t||!this.searchAbort||(this.setGroupStatus(e,"loading"),this.render(),this.invokeSource(t,this.searchToken),this.render())}handleKeydown(e){if(!this.isOpenState)return!1;switch(e.key){case"ArrowDown":return this.flat.length===0||(e.preventDefault(),this.setActiveIndex((this.activeIndex+1)%this.flat.length)),!0;case"ArrowUp":return this.flat.length===0||(e.preventDefault(),this.setActiveIndex((this.activeIndex-1+this.flat.length)%this.flat.length)),!0;case"Home":return this.flat.length===0||(e.preventDefault(),this.setActiveIndex(0)),!0;case"End":return this.flat.length===0||(e.preventDefault(),this.setActiveIndex(this.flat.length-1)),!0;case"Enter":case"Tab":return this.flat.length===0?(this.close(),!1):(e.preventDefault(),this.selectIndex(this.activeIndex),!0);case"Escape":return e.preventDefault(),this.close(),!0;case"Backspace":return this.query.length===0&&this.close(),!1;default:return!1}}selectIndex(e){let t=this.flat[e];t&&this.commit(t.source,t.item)}deriveArgs(e){return le(e).args}isInlineCommand(e){return e.command==="server"||e.commandArgsPlaceholder!=null}commit(e,t){let o=t.command;if(this.isInlineCommand(t)){this.completeCommandInline(e,t);return}if(o==="action"){let s=this.deriveArgs(this.query);this.stripQuery(),this.close(),this.runAction(t,s),this.opts.emit?.("command",{sourceId:e.id,itemId:t.id,kind:"action",args:s}),this.input.focus();return}if(o==="prompt"){let s=this.deriveArgs(this.query),n=this.captureStripTarget();this.close(),this.runPromptMacro(e,t,s,n),this.opts.emit?.("command",{sourceId:e.id,itemId:t.id,kind:"prompt",args:s});return}if(this.isInlineDisplay()){this.commitInlineMention(e,t);return}this.opts.onSelect(e,t,"")&&(this.stripQuery(),this.opts.emit?.("selected",{sourceId:e.id,itemId:t.id,label:t.label})),this.close(),this.input.focus()}isInlineDisplay(){return this.opts.mentionConfig.display==="inline"&&!!this.opts.onInsertMention&&!!this.input.insertMentionAtTrigger}commitInlineMention(e,t){if(this.opts.admitMention&&!this.opts.admitMention(e,t)){this.close(),this.input.focus();return}let o=re(e,t),r=this.triggerMatch?this.input.insertMentionAtTrigger(o,this.triggerMatch):this.input.insertMentionAtSelection?.(o)??null;r?(this.opts.onInsertMention(r,e,t,""),this.opts.emit?.("selected",{sourceId:e.id,itemId:t.id,label:t.label})):(this.opts.mentionConfig.onMentionRejected?.(t,"stale"),this.opts.emit?.("rejected",{sourceId:e.id,itemId:t.id,reason:"stale"})),this.triggerMatch=null,this.close(),this.input.focus()}completeCommandInline(e,t){let o=`${this.activeChannel.trigger}${t.label} `,r=this.input.getSelection().start,s=this.triggerMatch?this.triggerMatch.triggerIndex:r;if(this.input.replaceLogicalRange)this.input.replaceLogicalRange(s,r,o);else{let n=this.input.getValue();this.input.setValueWithCaret(n.slice(0,s)+o+n.slice(r),s+o.length)}this.triggerMatch=null,this.close(),this.opts.emit?.("command",{sourceId:e.id,itemId:t.id,kind:t.command??"prompt",phase:"armed"}),this.input.dispatchInput(),this.input.focus()}isInlineArgTail(e,t){let{name:o}=le(t);return!o||t.length<=o.length?!1:e.sources.some(r=>{let s=r.matchCommand?.(o);return!!s&&this.isInlineCommand(s)})}matchInlineCommand(e){for(let t of this.channels){if(!t.trigger)continue;let o=t.position==="anywhere"?[e]:t.position==="line-start"?e.split(`
|
|
167
|
+
`;var Ao=/\s/;function Vo(a,e,t){if(t==="input-start")return e===0;let o=e>0?a[e-1]:"";return t==="line-start"?o===""||o===`
|
|
168
|
+
`:o===""||Ao.test(o)}function zo(a,e,t="@",o="anywhere",r=!1){if(!t||e<=0||e>a.length)return null;let s=e-1;for(;s>=0;){let n=a[s];if(n===t)return Vo(a,s,o)?{triggerIndex:s,query:a.slice(s+1,e)}:null;if(n===`
|
|
169
|
+
`||n==="\uFFFC"||!r&&Ao.test(n))return null;s--}return null}function po(a,e,t){for(let o of t){let r=zo(a,e,o.trigger,o.position??"anywhere",o.allowSpaces??!1);if(r)return{channel:o,match:r}}return null}function wo(a,e,t){return{value:a.slice(0,e.triggerIndex)+a.slice(t),caret:e.triggerIndex}}function ko(a){let e={trigger:a.trigger??"@",position:a.triggerPosition??"anywhere",allowSpaces:!1,sources:Array.isArray(a.sources)?a.sources:[],searchPlaceholder:a.searchPlaceholder,showButton:a.showButton!==!1,buttonIconName:a.buttonIconName,buttonTooltipText:a.buttonTooltipText},t=(a.triggers??[]).map(o=>({trigger:o.trigger,position:o.triggerPosition??"anywhere",allowSpaces:o.allowSpaces??!1,sources:Array.isArray(o.sources)?o.sources:[],searchPlaceholder:o.searchPlaceholder,showButton:o.showButton===!0,buttonIconName:o.buttonIconName,buttonTooltipText:o.buttonTooltipText}));return[e,...t]}function ie(a){let e=a.replace(/^\s+/,""),t=e.search(/\s/);return t===-1?{name:e,args:""}:{name:e.slice(0,t),args:e.slice(t+1).trim()}}var Po=new Map,Go=(a,e,t)=>{let o=`${a}|${e}|${t}`,r=Po.get(o);return r===void 0&&(r=U(a,e,"currentColor",t),Po.set(o,r)),r?r.cloneNode(!0):null};function To(a){let{config:e,listboxId:t}=a,o=S("div",{className:"persona-mention-menu",attrs:{"data-persona-mention-menu":""}}),r=S("div",{className:"persona-mention-search",style:{display:"none"}}),s=R("span","persona-mention-search-icon"),n=U("search",15,"currentColor",2);n&&s.appendChild(n);let i=S("input",{className:"persona-mention-search-input",attrs:{type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-controls":t,"aria-label":e.searchPlaceholder??"Search context",placeholder:e.searchPlaceholder??"Search context\u2026",autocomplete:"off",autocapitalize:"off",spellcheck:"false"}});r.append(s,i),i.addEventListener("input",()=>a.onSearchInput?.(i.value)),i.addEventListener("keydown",d=>a.onSearchKeydown?.(d));let l=S("div",{className:"persona-mention-list",attrs:{role:"listbox",id:t,"aria-label":"Context mentions"}});o.append(r,l);let f=[],g=[],p=-1,m=new Map,u=(d,x)=>`${d}\0${x}`,y=d=>`${t}-opt-${d}`,w=d=>`${t}-grp-${d}`,H=(d,x)=>{let C=f[d];C&&(x?C.setAttribute("data-active","true"):C.removeAttribute("data-active"),C.setAttribute("aria-selected",x?"true":"false"),g[d]?.(x))},c=(d,x=!0)=>{p>=0&&p!==d&&H(p,!1),p=d;let C=f[d];C?(H(d,!0),x&&C.scrollIntoView?.({block:"nearest"}),l.setAttribute("aria-activedescendant",C.id),i.setAttribute("aria-activedescendant",C.id)):(l.removeAttribute("aria-activedescendant"),i.removeAttribute("aria-activedescendant"))},k=(d,x)=>{let C=w(x),v=S("div",{className:"persona-mention-group",attrs:{role:"group","aria-labelledby":C}});return v.appendChild(S("div",{className:"persona-mention-group-header",attrs:{id:C},text:d})),v},P=()=>{let d=S("div",{className:"persona-mention-option",attrs:{role:"option","aria-selected":"false"}}),x=R("span","persona-mention-option-icon");d.appendChild(x);let C="",v=R("span","persona-mention-option-text"),L=R("span","persona-mention-option-labelline"),T=R("span","persona-mention-option-label");L.appendChild(T),v.appendChild(L),d.appendChild(v);let A=null,b=null,M={el:d,index:0,update:(h,q,F)=>{M.index=q,d.id=y(q),d.setAttribute("aria-setsize",String(F)),d.setAttribute("aria-posinset",String(q+1)),d.removeAttribute("data-active"),d.setAttribute("aria-selected","false");let I=h.iconName??e.chipIconName??"at-sign";if(I!==C){C=I;let W=Go(I,15,2);x.replaceChildren(...W?[W]:[])}T.textContent!==h.label&&(T.textContent=h.label);let B=h.commandArgsPlaceholder?`\u2039${h.commandArgsPlaceholder}\u203A`:null;B?(A||(A=R("span","persona-mention-option-arghint"),L.appendChild(A)),A.textContent!==B&&(A.textContent=B)):A&&(A.remove(),A=null),h.description?(b||(b=R("span","persona-mention-option-desc"),v.appendChild(b)),b.textContent!==h.description&&(b.textContent=h.description)):b&&(b.remove(),b=null)}};return d.addEventListener("mousedown",h=>{h.button===0&&(h.preventDefault(),a.onSelectIndex(M.index))}),d.addEventListener("mouseenter",()=>a.onHoverIndex(M.index)),M},O=(d,x,C,v,L)=>{let T=S("div",{className:"persona-mention-option",attrs:{role:"option",id:y(v),"aria-selected":"false","aria-setsize":String(L),"aria-posinset":String(v+1)}}),A=b=>{T.replaceChildren(e.renderMentionItem({item:d,source:x,query:C,active:b,index:v}))};return A(!1),T.addEventListener("mousedown",b=>{b.button===0&&(b.preventDefault(),a.onSelectIndex(v))}),T.addEventListener("mouseenter",()=>a.onHoverIndex(v)),{el:T,paint:A}},N=d=>{let x=S("div",{className:"persona-mention-status persona-mention-error"});if(x.appendChild(S("span",{className:"persona-mention-error-text",text:`Couldn't load ${d.label}`})),a.onRetry){let C=S("button",{className:"persona-mention-retry",attrs:{type:"button"},text:"Retry"});C.addEventListener("mousedown",v=>v.preventDefault()),C.addEventListener("click",v=>{v.preventDefault(),a.onRetry(d.id)}),x.appendChild(C)}return x};return{el:o,render:d=>{l.replaceChildren(),f=[],g=[],p=-1;let x=new Set,C=0,v=0,L=0,T=0,A=0,b=d.groups.reduce((M,h)=>h.status==="ready"?M+h.items.length:M,0);for(let M of d.groups)if(M.status==="loading"){L++;let h=k(M.source.label,A++);h.appendChild(S("div",{className:"persona-mention-status persona-mention-loading",attrs:{role:"presentation"},text:"Loading\u2026"})),l.appendChild(h)}else if(M.status==="error"){T++;let h=k(M.source.label,A++);h.appendChild(N(M.source)),l.appendChild(h)}else if(M.status==="ready"&&M.items.length>0){let h=new Map;for(let F of M.items){let I=F.group??M.source.label,B=h.get(I);B?B.push(F):h.set(I,[F])}let q=Array.from(h.entries());q.forEach(([F,I],B)=>{let W=k(F,A++);for(let pe of I){let co=C++,G;if(e.renderMentionItem){let D=O(pe,M.source,d.query,co,b);G=D.el,g.push(D.paint)}else{let D=u(M.source.id,pe.id),V=x.has(D)?void 0:m.get(D);V||(V=P(),x.has(D)||m.set(D,V)),x.add(D),V.update(pe,co,b),G=V.el,g.push(null)}f.push(G),W.appendChild(G),v++}M.truncated&&B===q.length-1&&W.appendChild(S("div",{className:"persona-mention-hint",attrs:{role:"presentation"},text:"Keep typing to narrow\u2026"})),l.appendChild(W)})}for(let M of m.keys())x.has(M)||m.delete(M);v===0&&L===0&&T===0&&l.appendChild(S("div",{className:"persona-mention-empty",attrs:{role:"presentation"},text:"No matches"})),f.length>0?c(Math.min(Math.max(0,d.activeIndex),f.length-1)):(l.removeAttribute("aria-activedescendant"),i.removeAttribute("aria-activedescendant"))},setActiveIndex:c,destroy:()=>{l.replaceChildren(),f=[],m.clear(),o.remove()},showSearch:(d,x)=>{i.value=d,x&&(i.placeholder=x),r.style.display="",i.setAttribute("aria-expanded","true"),i.focus(),typeof requestAnimationFrame=="function"&&requestAnimationFrame(()=>{r.style.display!=="none"&&i.focus()})},hideSearch:()=>{r.style.display="none",i.value="",i.setAttribute("aria-expanded","false"),i.removeAttribute("aria-activedescendant")}}}var Xo=a=>!!a&&(typeof a=="object"||typeof a=="function")&&typeof a.then=="function",Ko=0,de=class{constructor(e){this.popover=null;this.resizeObserver=null;this.isOpenState=!1;this.query="";this.triggerMatch=null;this.activeIndex=0;this.activeKey=null;this.pickerMode=!1;this.pickerTrigger=null;this.groups=[];this.flat=[];this.searchToken=0;this.searchAbort=null;this.debounceTimer=null;this.knownAsync=new Set;this.invokedForToken=new Set;this.lastAnnouncedCount=-1;this.triggerAnchorOffset=null;this.measuredTriggerIndex=null;this.opts=e;let t=e.mentionConfig,o=ko(t),r=o.filter(n=>n.sources.length>0);this.channels=r.length>0?r:[o[0]],this.activeChannel=this.channels[0],this.maxPerGroup=t.maxItemsPerGroup??6,this.debounceMs=t.searchDebounceMs??150,this.listboxId=`persona-mention-listbox-${++Ko}`,this.menu=e.mentionConfig.renderMentionMenu?this.createHostMenu():To({config:e.mentionConfig,listboxId:this.listboxId,onSelectIndex:n=>this.selectIndex(n),onHoverIndex:n=>this.setActiveIndex(n,!1),onRetry:n=>this.retrySource(n),onSearchInput:n=>this.setQuery(n),onSearchKeydown:n=>{this.handleKeydown(n)}});let s=e.composerInput.element;s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",this.listboxId)}get input(){return this.opts.composerInput}createHostMenu(){let e=document.createElement("div");e.setAttribute("data-persona-mention-menu",""),e.setAttribute("role","listbox"),e.id=this.listboxId;let t=()=>{let o=this.opts.mentionConfig.renderMentionMenu({query:this.query,groups:this.groups.map(r=>({source:r.source,items:r.items})),status:Object.fromEntries(this.groups.map(r=>[r.source.id,r.status])),activeIndex:this.activeIndex,select:r=>{let s=this.groups.find(n=>n.items.includes(r));s&&this.commit(s.source,r)},close:()=>this.close()});e.replaceChildren(o)};return{el:e,render:t,setActiveIndex:t,destroy:()=>e.remove()}}isOpen(){return this.isOpenState}openFromButton(e){let t=e&&this.channels.find(n=>n.trigger===e)||this.channels[0],o=this.input.getSelection().start,r=po(this.input.getLogicalText(),o,[t]);if(r){this.pickerMode=!1,this.triggerMatch=r.match,this.isOpenState?(this.switchChannel(t),this.setQuery(r.match.query)):this.open(r.match.query,t),this.input.focus();return}let s=this.pickerTrigger;this.pickerMode=!0,this.pickerTrigger=t.trigger,this.triggerMatch=null,this.isOpenState?(s&&s!==t.trigger&&this.opts.onPickerOpenChange?.(!1,s,this.listboxId),this.switchChannel(t),this.setQuery("")):this.open("",t),this.menu.showSearch?this.menu.showSearch("",t.searchPlaceholder):this.input.focus(),this.opts.onPickerOpenChange?.(!0,t.trigger,this.listboxId)}onInput(){let e=this.input.getSelection().start,t=po(this.input.getLogicalText(),e,this.channels);if(!t){this.isOpenState&&this.close();return}if(this.isInlineArgTail(t.channel,t.match.query)){this.triggerMatch=null,this.isOpenState&&this.close(!1);return}this.triggerMatch=t.match,this.isOpenState?(this.switchChannel(t.channel),this.measuredTriggerIndex!==t.match.triggerIndex&&this.updateTriggerAnchor(),this.setQuery(t.match.query)):this.open(t.match.query,t.channel)}switchChannel(e){e!==this.activeChannel&&(this.activeChannel=e,this.groups=[],this.activeIndex=0)}open(e,t){if(this.isOpenState=!0,this.activeChannel=t,this.groups=[],this.activeIndex=0,this.lastAnnouncedCount=-1,!this.popover){let o=this.canAnchorMenu();if(this.popover=yo({anchor:this.opts.anchor,content:this.menu.el,placement:"top-start",matchAnchorWidth:!o,offset:6,container:this.opts.popoverContainer,horizontalOffset:o?()=>this.triggerAnchorOffset?.x??null:void 0,verticalOffset:o?()=>this.triggerAnchorOffset?.y??null:void 0,onDismiss:()=>this.close(!1)}),o){let r=this.opts.anchor.getBoundingClientRect().width;this.menu.el.style.minWidth=`${Math.min(220,r)}px`}}this.updateTriggerAnchor(),this.popover.open(),So(this.menu.el,"persona-mention-menu",bo),this.observeComposerResize(),this.opts.emit?.("opened",{trigger:t.trigger}),this.setQuery(e)}observeComposerResize(){typeof ResizeObserver>"u"||this.resizeObserver||(this.resizeObserver=new ResizeObserver(()=>{this.isOpenState&&(this.updateTriggerAnchor(),this.popover?.reposition())}),this.resizeObserver.observe(this.opts.anchor))}disconnectComposerResize(){this.resizeObserver?.disconnect(),this.resizeObserver=null}canAnchorMenu(){return this.isInlineDisplay()&&!!this.input.getLogicalRangeRect}updateTriggerAnchor(){let e=this.triggerMatch,t=this.input.getLogicalRangeRect;if(this.measuredTriggerIndex=e?.triggerIndex??null,this.triggerAnchorOffset=null,!e||!t)return;let o=t(e.triggerIndex,e.triggerIndex+1);if(!o)return;let r=this.opts.anchor.getBoundingClientRect(),s=o.top-r.top,n=this.input.element,i=typeof getComputedStyle=="function"&&getComputedStyle(n).direction==="rtl";this.triggerAnchorOffset={x:i?null:o.left-r.left,y:s}}close(e=!0){this.isOpenState&&(this.isOpenState=!1,this.disconnectComposerResize(),this.debounceTimer&&clearTimeout(this.debounceTimer),this.searchAbort?.abort(),this.searchToken++,this.popover?.close(),this.input.element.removeAttribute("aria-activedescendant"),this.pickerMode&&(this.pickerMode=!1,this.menu.hideSearch?.(),this.opts.onPickerOpenChange?.(!1,this.pickerTrigger??this.activeChannel.trigger,this.listboxId),this.pickerTrigger=null,e&&this.input.focus()))}setQuery(e){this.query=e,this.activeIndex=0,this.activeKey=null;let t=++this.searchToken;this.invokedForToken.clear(),this.searchAbort?.abort(),this.searchAbort=new AbortController;for(let o of this.activeChannel.sources)this.knownAsync.has(o.id)?this.setGroupStatus(o.id,"loading"):(this.invokedForToken.add(o.id),this.invokeSource(o,t));this.render(),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{if(t===this.searchToken)for(let o of this.activeChannel.sources)this.knownAsync.has(o.id)&&!this.invokedForToken.has(o.id)&&this.invokeSource(o,t)},this.debounceMs)}invokeSource(e,t){let o={messages:this.opts.getMessages(),config:this.opts.getConfig(),signal:this.searchAbort.signal},r;try{r=e.search(this.query,o)}catch{this.setGroupStatus(e.id,"error"),this.render();return}Xo(r)?(this.knownAsync.add(e.id),this.setGroupStatus(e.id,"loading"),r.then(s=>{t===this.searchToken&&(this.setGroupItems(e.id,s),this.render())}).catch(()=>{t===this.searchToken&&(this.setGroupStatus(e.id,"error"),this.render())})):this.setGroupItems(e.id,r)}getOrCreateGroup(e){let t=this.groups.find(o=>o.source.id===e.id);if(!t){t={source:e,items:[],status:"loading",truncated:!1};let o=this.activeChannel.sources;this.groups.push(t),this.groups.sort((r,s)=>o.findIndex(n=>n.id===r.source.id)-o.findIndex(n=>n.id===s.source.id))}return t}setGroupStatus(e,t){let o=this.activeChannel.sources.find(r=>r.id===e);o&&(this.getOrCreateGroup(o).status=t)}setGroupItems(e,t){let o=this.activeChannel.sources.find(s=>s.id===e);if(!o)return;let r=this.getOrCreateGroup(o);r.truncated=t.length>this.maxPerGroup,r.items=t.slice(0,this.maxPerGroup),r.status=r.items.length===0?"empty":"ready"}keyOf(e){return JSON.stringify([e.source.id,e.item.id])}rebuildFlat(){this.flat=[];for(let e of this.groups)if(e.status==="ready")for(let t of e.items)this.flat.push({source:e.source,item:t});if(this.activeKey){let e=this.flat.findIndex(t=>this.keyOf(t)===this.activeKey);this.activeIndex=e>=0?e:Math.min(this.activeIndex,Math.max(0,this.flat.length-1))}else this.activeIndex>=this.flat.length&&(this.activeIndex=Math.max(0,this.flat.length-1))}viewModel(){return{query:this.query,groups:this.groups,activeIndex:this.activeIndex}}render(){this.rebuildFlat(),this.menu.render(this.viewModel()),this.syncActiveDescendant(),this.popover?.reposition();let e=this.groups.some(t=>t.status==="loading");this.flat.length===0&&e||this.flat.length!==this.lastAnnouncedCount&&(this.lastAnnouncedCount=this.flat.length,this.opts.announce(this.flat.length===0?"No matches":this.flat.length===1?"1 result":`${this.flat.length} results`),this.opts.emit?.("searched",{query:this.query,results:this.flat.length}))}setActiveIndex(e,t=!0){e<0||e>=this.flat.length||(this.activeIndex=e,this.activeKey=this.keyOf(this.flat[e]),this.menu.setActiveIndex(e,t),this.syncActiveDescendant())}syncActiveDescendant(){this.isOpenState&&!this.pickerMode&&this.activeIndex>=0&&this.activeIndex<this.flat.length?this.input.element.setAttribute("aria-activedescendant",`${this.listboxId}-opt-${this.activeIndex}`):this.input.element.removeAttribute("aria-activedescendant")}retrySource(e){let t=this.activeChannel.sources.find(o=>o.id===e);!t||!this.searchAbort||(this.setGroupStatus(e,"loading"),this.render(),this.invokeSource(t,this.searchToken),this.render())}handleKeydown(e){if(!this.isOpenState)return!1;switch(e.key){case"ArrowDown":return this.flat.length===0||(e.preventDefault(),this.setActiveIndex((this.activeIndex+1)%this.flat.length)),!0;case"ArrowUp":return this.flat.length===0||(e.preventDefault(),this.setActiveIndex((this.activeIndex-1+this.flat.length)%this.flat.length)),!0;case"Home":return this.flat.length===0||(e.preventDefault(),this.setActiveIndex(0)),!0;case"End":return this.flat.length===0||(e.preventDefault(),this.setActiveIndex(this.flat.length-1)),!0;case"Enter":case"Tab":return this.flat.length===0?(this.close(),!1):(e.preventDefault(),this.selectIndex(this.activeIndex),!0);case"Escape":return e.preventDefault(),this.close(),!0;case"Backspace":return this.query.length===0&&this.close(),!1;default:return!1}}selectIndex(e){let t=this.flat[e];t&&this.commit(t.source,t.item)}deriveArgs(e){return ie(e).args}isInlineCommand(e){return e.command==="server"||e.commandArgsPlaceholder!=null}commit(e,t){let o=t.command;if(this.isInlineCommand(t)){this.completeCommandInline(e,t);return}if(o==="action"){let s=this.deriveArgs(this.query);this.stripQuery(),this.close(),this.runAction(t,s),this.opts.emit?.("command",{sourceId:e.id,itemId:t.id,kind:"action",args:s}),this.input.focus();return}if(o==="prompt"){let s=this.deriveArgs(this.query),n=this.captureStripTarget();this.close(),this.runPromptMacro(e,t,s,n),this.opts.emit?.("command",{sourceId:e.id,itemId:t.id,kind:"prompt",args:s});return}if(this.isInlineDisplay()){this.commitInlineMention(e,t);return}this.opts.onSelect(e,t,"")&&(this.stripQuery(),this.opts.emit?.("selected",{sourceId:e.id,itemId:t.id,label:t.label})),this.close(),this.input.focus()}isInlineDisplay(){return this.opts.mentionConfig.display==="inline"&&!!this.opts.onInsertMention&&!!this.input.insertMentionAtTrigger}commitInlineMention(e,t){if(this.opts.admitMention&&!this.opts.admitMention(e,t)){this.close(),this.input.focus();return}let o=se(e,t),r=this.triggerMatch?this.input.insertMentionAtTrigger(o,this.triggerMatch):this.input.insertMentionAtSelection?.(o)??null;r?(this.opts.onInsertMention(r,e,t,""),this.opts.emit?.("selected",{sourceId:e.id,itemId:t.id,label:t.label})):(this.opts.mentionConfig.onMentionRejected?.(t,"stale"),this.opts.emit?.("rejected",{sourceId:e.id,itemId:t.id,reason:"stale"})),this.triggerMatch=null,this.close(),this.input.focus()}completeCommandInline(e,t){let o=`${this.activeChannel.trigger}${t.label} `,r=this.input.getSelection().start,s=this.triggerMatch?this.triggerMatch.triggerIndex:r;if(this.input.replaceLogicalRange)this.input.replaceLogicalRange(s,r,o);else{let n=this.input.getValue();this.input.setValueWithCaret(n.slice(0,s)+o+n.slice(r),s+o.length)}this.triggerMatch=null,this.close(),this.opts.emit?.("command",{sourceId:e.id,itemId:t.id,kind:t.command??"prompt",phase:"armed"}),this.input.dispatchInput(),this.input.focus()}isInlineArgTail(e,t){let{name:o}=ie(t);return!o||t.length<=o.length?!1:e.sources.some(r=>{let s=r.matchCommand?.(o);return!!s&&this.isInlineCommand(s)})}matchInlineCommand(e){for(let t of this.channels){if(!t.trigger)continue;let o=t.position==="anywhere"?[e]:t.position==="line-start"?e.split(`
|
|
170
170
|
`):[e.split(`
|
|
171
|
-
`)[0]];for(let r of o){if(!r.startsWith(t.trigger))continue;let{name:s,args:n}=
|
|
171
|
+
`)[0]];for(let r of o){if(!r.startsWith(t.trigger))continue;let{name:s,args:n}=ie(r.slice(t.trigger.length));if(s)for(let i of t.sources){let l=i.matchCommand?.(s);if(l&&this.isInlineCommand(l))return{source:i,item:l,args:n}}}}return null}async dispatchInlineCommand(e){let t=this.matchInlineCommand(e);if(!t)return null;let{source:o,item:r,args:s}=t,n=r.command??"prompt";if(this.opts.emit?.("command",{sourceId:o.id,itemId:r.id,kind:n,args:s}),n==="action")return this.runAction(r,s),{kind:"action"};if(n==="prompt"){let l;try{l=await o.resolve(r,this.resolveContext(s,e))}catch(f){return typeof console<"u"&&console.warn("[Persona] inline prompt command resolve failed",f),null}return{kind:"prompt",sendText:l.insertText??l.llmAppend??e}}return{kind:"server",mentions:{refs:[],finalize:async()=>{let l=await o.resolve(r,this.resolveContext(s,e)),f={};return l.context&&(f[o.id]={[r.id]:l.context}),{blocks:[],contentParts:l.contentParts??[],context:f}}}}}resolveContext(e,t){return{messages:this.opts.getMessages(),config:this.opts.getConfig(),composerText:t,args:e,signal:new AbortController().signal}}runAction(e,t){if(e.action)try{Promise.resolve(e.action({args:t,config:this.opts.getConfig(),messages:this.opts.getMessages(),composer:this.input})).catch(o=>{typeof console<"u"&&console.warn("[Persona] context-mention command action failed",o)})}catch(o){typeof console<"u"&&console.warn("[Persona] context-mention command action failed",o)}}captureStripTarget(){return this.triggerMatch?{value:this.input.getValue(),start:this.triggerMatch.triggerIndex,end:this.input.getSelection().start}:null}async runPromptMacro(e,t,o,r){let s=this.input,n;try{n=await e.resolve(t,{messages:this.opts.getMessages(),config:this.opts.getConfig(),composerText:s.getValue(),args:o,signal:new AbortController().signal})}catch(l){typeof console<"u"&&console.warn("[Persona] context-mention prompt resolve failed",l);return}let i=n.insertText??n.llmAppend??"";t.insertMode==="insert-at-caret"&&r?s.replaceLogicalRange?(s.replaceLogicalRange(r.start,r.end,i),s.dispatchInput()):s.setValue(r.value.slice(0,r.start)+i+r.value.slice(r.end)):s.setValue(i),t.submitOnSelect&&s.submit()}stripQuery(){if(!this.triggerMatch)return;let e=this.input.getSelection().start;if(this.input.replaceLogicalRange)this.input.replaceLogicalRange(this.triggerMatch.triggerIndex,e,"");else{let t=wo(this.input.getValue(),this.triggerMatch,e);this.input.setValueWithCaret(t.value,t.caret)}this.input.dispatchInput(),this.triggerMatch=null}destroy(){this.disconnectComposerResize(),this.debounceTimer&&clearTimeout(this.debounceTimer),this.searchAbort?.abort(),this.popover?.destroy(),this.menu.destroy();let e=this.input.element;e.removeAttribute("aria-haspopup"),e.removeAttribute("aria-controls"),e.removeAttribute("aria-activedescendant")}};function $o(a){a&&(typeof a.requestSubmit=="function"?a.requestSubmit():a.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0})))}function Ro(a){let e=()=>{a.dispatchEvent(new Event("input",{bubbles:!0}))};return{element:a,getValue:()=>a.value,getLogicalText:()=>a.value,getSelection:()=>({start:a.selectionStart??0,end:a.selectionEnd??0}),setSelection:(t,o=t)=>{a.setSelectionRange(t,o)},setValueWithCaret:(t,o)=>{a.value=t,a.setSelectionRange(o,o)},setValue:t=>{a.value=t,a.setSelectionRange(t.length,t.length),e(),a.focus()},submit:()=>$o(a.form),dispatchInput:e,focus:()=>a.focus()}}var Zo={position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:"0"};function mo(a,e){let t=document.createElement("div");t.className="persona-sr-only",t.setAttribute("aria-live",a),t.setAttribute("aria-atomic","true"),t.setAttribute("role",a==="assertive"?"alert":"status"),t.setAttribute("data-persona-mention-live-region","");let o=e.getRootNode();typeof ShadowRoot<"u"&&o instanceof ShadowRoot?(Object.assign(t.style,Zo),document.body.appendChild(t)):e.appendChild(t);let s;return{announce:n=>{s!==void 0&&clearTimeout(s),t.textContent="",s=setTimeout(()=>{s=void 0,t.textContent=n},0)},destroy:()=>{s!==void 0&&clearTimeout(s),t.remove()}}}function Lo(a){let e=a.composerInput??Ro(a.textarea),t=mo("polite",a.liveRegionHost),o=mo("assertive",a.liveRegionHost),r=f=>t.announce(f),s=f=>o.announce(f),n=new ne({mentionConfig:a.mentionConfig,contextRow:a.contextRow,getMessages:a.getMessages,getConfig:a.getConfig,getComposerText:()=>e.getValue(),announce:r,announceError:s,emit:a.emit}),i=()=>new de({mentionConfig:a.mentionConfig,composerInput:e,anchor:a.anchor,getMessages:a.getMessages,getConfig:a.getConfig,onSelect:(f,g,p)=>n.add(f,g,p),onInsertMention:(f,g,p,m)=>n.track(f,g,p,m,u=>e.setMentionStatus?.(f,u)),admitMention:(f,g)=>n.admit(f,g),announce:r,popoverContainer:a.popoverContainer,onPickerOpenChange:a.onPickerOpenChange,emit:a.emit}),l=i();return{openMenu:f=>l.openFromButton(f),isMenuOpen:()=>l.isOpen(),handleInput:()=>l.onInput(),handleKeydown:f=>l.handleKeydown(f),hasMentions:()=>n.hasMentions(),removeLastChip:()=>n.removeLast(),dispatchInlineCommand:f=>l.dispatchInlineCommand(f),collectForSubmit:()=>n.hasMentions()?n.collectForSubmit():null,untrackMention:f=>n.remove(f),rebindComposer:f=>{f!==e&&(l.destroy(),e=f,l=i())},clear:()=>n.clear(),destroy:()=>{l.destroy(),n.clear(),t.destroy(),o.destroy()}}}0&&(module.exports={mountContextMentions});
|
|
172
172
|
/*! Bundled license information:
|
|
173
173
|
|
|
174
174
|
lucide/dist/esm/icons/activity.mjs:
|
|
@@ -245,6 +245,7 @@ lucide/dist/esm/icons/minus.mjs:
|
|
|
245
245
|
lucide/dist/esm/icons/monitor.mjs:
|
|
246
246
|
lucide/dist/esm/icons/moon.mjs:
|
|
247
247
|
lucide/dist/esm/icons/package.mjs:
|
|
248
|
+
lucide/dist/esm/icons/panel-left.mjs:
|
|
248
249
|
lucide/dist/esm/icons/paperclip.mjs:
|
|
249
250
|
lucide/dist/esm/icons/pause.mjs:
|
|
250
251
|
lucide/dist/esm/icons/pen-line.mjs:
|