| 387 | } |
| 388 | |
| 389 | function createShareCopilotCard() { |
| 390 | const host = document.createElement('section'); |
| 391 | host.className = 'fr-share-ai-launcher'; |
| 392 | host.innerHTML = [ |
| 393 | '<div class="fr-share-ai-launcher-copy">', |
| 394 | '<div class="fr-share-kicker">AI Assistant</div>', |
| 395 | '<div class="fr-share-ai-launcher-title">Ask AI about this share</div>', |
| 396 | '<div class="fr-share-ai-launcher-subtitle"></div>', |
| 397 | '</div>', |
| 398 | '<button type="button" class="fr-share-btn fr-share-ai-open">Ask AI</button>', |
| 399 | '<div class="fr-share-ai-backdrop" hidden>', |
| 400 | '<section class="fr-share-card fr-share-copilot fr-share-ai-dialog" role="dialog" aria-modal="true" aria-labelledby="frShareAiDialogTitle">', |
| 401 | '<div class="fr-share-copilot-head">', |
| 402 | '<div>', |
| 403 | '<div class="fr-share-kicker">AI Assistant</div>', |
| 404 | '<div class="fr-share-title fr-share-copilot-title" id="frShareAiDialogTitle">Ask about this share</div>', |
| 405 | '<div class="fr-share-subtitle fr-share-copilot-subtitle"></div>', |
| 406 | '</div>', |
| 407 | '<button type="button" class="fr-share-btn fr-share-btn-ghost fr-share-ai-close">Close</button>', |
| 408 | '</div>', |
| 409 | '<div class="fr-share-copilot-suggestions" hidden></div>', |
| 410 | '<div class="fr-share-copilot-log" aria-live="polite"></div>', |
| 411 | '<form class="fr-share-copilot-form">', |
| 412 | '<textarea class="fr-share-copilot-input" rows="3" placeholder="Ask about files, uploads, or access in this share"></textarea>', |
| 413 | '<div class="fr-share-copilot-actions">', |
| 414 | '<div class="fr-share-copilot-meta"></div>', |
| 415 | '<button type="submit" class="fr-share-btn">Send</button>', |
| 416 | '</div>', |
| 417 | '</form>', |
| 418 | '</section>', |
| 419 | '</div>' |
| 420 | ].join(''); |
| 421 | return host; |
| 422 | } |
| 423 | |
| 424 | async function mountShareCopilot() { |
| 425 | if (!token || !shareAiEnabled) return; |