@tenancy.nz/chat-ui 0.1.11 → 0.1.12

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/esm/index.js CHANGED
@@ -14,7 +14,7 @@ var Ke = (r, e, t, n) => ({
14
14
  }
15
15
  });
16
16
  import lm, { useState as ve, useCallback as hr, useRef as Oe, useEffect as xs, useMemo as Sd } from "react";
17
- const DC = ':root{--bg: #f7f9fc;--panel: #ffffff;--text: #0b1324;--muted: #64748b;--accent: #1a73e8;--accent-2: #1a73e8;--danger: #e11d48;--border: #e5e7eb;--pdf-citations-width: 260px}*{box-sizing:border-box}.app{display:grid;grid-template-rows:auto 1fr auto;min-height:100%}.app-header{padding:16px 20px;border-bottom:1px solid var(--border);background:var(--panel);position:sticky;top:0}.app-header h1{margin:0;font-size:18px;letter-spacing:.2px;color:#111827}.app-header .subtitle{margin:4px 0 0;color:var(--muted);font-size:12px}.app-main{display:grid;grid-template-columns:1fr;padding:0}.app-footer{padding:10px 16px;color:var(--muted);border-top:1px solid var(--border);font-size:12px;background:var(--panel)}.chat-container{width:100%;max-width:none;background:var(--panel);border-top:1px solid var(--border);border-bottom:1px solid var(--border);border-radius:0;overflow:hidden;box-shadow:none}.chat-layout{display:grid;grid-template-columns:300px 1fr;min-height:100vh}.sidebar{border-right:1px solid var(--border);background:#fff;padding:10px;display:flex;flex-direction:column;gap:10px}.sidebar-header{display:flex;align-items:center;justify-content:space-between;font-weight:600;color:#0f172a;padding:6px 8px;border-radius:10px;border:1px solid transparent;background:linear-gradient(#fff,#fff) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box}.sidebar-new{background:transparent;border:none;color:var(--accent);font-size:18px;cursor:pointer}.thread-list{overflow:auto;display:grid;gap:6px;padding-right:4px}.thread-group{display:grid;gap:6px}.thread-group-title{color:#94a3b8;font-size:11px;padding:8px 6px 0;text-transform:uppercase;letter-spacing:.04em}.thread-empty{color:var(--muted);font-size:12px;padding:12px 8px}.thread-item{text-align:left;border:0;background:#fff;color:var(--text);border-radius:8px;padding:8px;display:flex;align-items:flex-start;gap:10px;cursor:pointer}.thread-item:hover{background:#f8fafc}.thread-item.active{background:#f8fafc;box-shadow:inset 0 0 0 1px #e5e7eb}.thread-icon{width:24px;height:24px;color:#94a3b8;display:grid;place-items:center}.thread-text{display:grid;gap:4px}.thread-date{font-size:10px;color:#a4a4a4;font-family:Montserrat,Inter,ui-sans-serif,system-ui}.thread-title{font-size:12px;font-weight:500;color:#0b1324;font-family:Montserrat,Inter,ui-sans-serif,system-ui}.messages-main{display:flex;flex-direction:column}.messages{height:calc(100vh - 100px);overflow:auto;padding:28px 40px;display:flex;flex-direction:column;gap:12px;background:#fff;position:relative}.messages-loading{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#fffc;-webkit-backdrop-filter:blur(2px) saturate(110%);backdrop-filter:blur(2px) saturate(110%);z-index:5}.messages-loading .loading-inner{display:inline-flex;align-items:center;gap:10px;padding:10px 14px;border-radius:999px;border:1px solid rgba(0,0,0,.06);background:#fff;box-shadow:0 8px 18px #00000014;color:#374151;font-size:13px}.message{display:flex}.message.user{justify-content:flex-end}.message.assistant{justify-content:flex-start;align-items:flex-start;gap:12px}.bubble{max-width:80%;padding:12px 14px;border-radius:12px;line-height:1.6;white-space:normal;word-wrap:break-word;font-size:14px;color:#1f2937;font-family:Montserrat,Inter,ui-sans-serif,system-ui}.message.user .bubble{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box;color:#0b1324;border:1px solid transparent;border-bottom-right-radius:4px}.message.assistant .bubble{background:#fff;border:1px solid #e5e7eb;color:#0b1324;border-bottom-left-radius:4px}.message.assistant .bubble-plain{background:transparent;border:0;padding:0;max-width:72ch;font-size:14px;color:#364152;font-family:Montserrat,Inter,ui-sans-serif,system-ui;line-height:1.55}.message.assistant .bubble-plain p,.bubble p{margin:0 0 8px}.bubble>*:first-child{margin-top:0}.bubble>*:last-child{margin-bottom:0}.bubble ul,.bubble ol{margin:8px 0 8px 18px;padding:0}.bubble li{margin:4px 0}.bubble h1,.bubble h2,.bubble h3,.bubble h4,.bubble h5,.bubble h6{margin:10px 0 6px;line-height:1.3}.bubble pre{margin:8px 0;padding:10px;background:#f8fafc;border:1px solid #e5e7eb;border-radius:8px;overflow:auto}.bubble code:not(pre code){background:#f3f4f6;padding:1px 4px;border-radius:4px}.bubble table{border-collapse:collapse;margin:8px 0}.bubble th,.bubble td{border:1px solid #e5e7eb;padding:6px 8px}.message.assistant .bubble-plain a{color:var(--accent);text-decoration:underline;text-underline-offset:2px}.avatar{width:28px;height:28px;border-radius:9999px;background:transparent;border:0;display:grid;place-items:center;color:var(--accent);font-size:14px;margin-top:3px}.avatar-star{transform:rotate(12deg)}.bubble-pending{opacity:.8;font-style:italic}.msg-toolbar{display:flex;align-items:center;gap:12px;margin-left:40px}.msg-divider{height:1px;background:#e5e7eb;flex:1}.btn-copy{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:8px;padding:4px 8px;font-size:12px;cursor:pointer;display:inline-flex;align-items:center;gap:6px}.btn-copy:hover{color:#111827;border-color:#cfd8e3}.sources-hud{margin-top:14px;border:1px solid #dbe7ff;background:#f8fafc;padding:6px 6px 8px;border-radius:8px;max-width:86%}.sources-copy{display:flex;align-items:center;gap:6px;margin:8px 0 6px}.msg-subdivider{height:1px;background:#f3f3f3;margin:10px 0 6px}.sources-header{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:6px}.sources-title{font-size:10px;color:#6b7280;margin:0;text-transform:uppercase;letter-spacing:.04em}.sources-list{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:6px}.source-item{display:flex;align-items:center;gap:6px}.source-link{display:inline-flex;align-items:center;gap:6px;border:1px solid #e5e7eb;background:#fff;border-radius:8px;padding:6px 8px;font-size:11px;cursor:pointer;min-width:160px;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.source-link:hover{border-color:#d1d5db;background:#f9fafb}.source-rank{font-weight:600;color:var(--accent)}.source-name{font-weight:500;color:#0b1324;overflow:hidden;text-overflow:ellipsis}.source-page{color:#6b7280}.source-score{margin-left:auto;font-variant-numeric:tabular-nums;color:#6b7280}.source-open{text-decoration:none;font-size:12px}.btn-copy-inline{border:0;background:transparent;padding:0;color:#1a73e8;display:inline-flex;align-items:center;gap:6px;font-size:12px}.btn-copy-inline:hover{text-decoration:underline}.message-divider{height:1px;background:#f3f3f3;margin:10px 0 2px 40px}.message.user{align-items:center;gap:8px}.user-bubble{background:#e8f0fe;border:1px solid #dbe7ff;color:#0b1324;box-shadow:0 1px 2px #0000000a,0 3px 10px #0445b71a}.user-avatar{width:28px;height:28px;border-radius:9999px;background:linear-gradient(#e2e8f0,#e2e8f0) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box;color:#274a9a;display:grid;place-items:center;font-size:12px;font-weight:600;font-family:Montserrat,Inter,ui-sans-serif,system-ui;border:1px solid transparent}.user-avatar-img{width:28px;height:28px;border-radius:8px;object-fit:cover;display:inline-block}.modal{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;padding:2vh 2vw;z-index:1000;visibility:hidden;opacity:0;pointer-events:none;background:#ffffff8c;-webkit-backdrop-filter:blur(8px) saturate(120%);backdrop-filter:blur(8px) saturate(120%);transition:opacity .12s ease-in-out,visibility .12s ease-in-out}.modal.open{visibility:visible;opacity:1;pointer-events:auto}.modal-content{background:#fff;width:min(92vw,800px);max-width:min(92vw,800px);max-height:680px;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 8px 24px #0000001f;overflow:hidden;display:flex;flex-direction:column}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid rgba(0,0,0,.06)}.modal-title{font-weight:600;color:#111827}.modal-close{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;color:#6b7280;border:0;font-size:20px;line-height:1;width:28px;height:28px;display:inline-grid;place-items:center;border-radius:6px;cursor:pointer}.modal-body{height:680px;overflow:hidden;position:relative;padding:0}.modal-body.panning{cursor:grabbing}.pdf-stage canvas{display:block}.pdf-viewer{position:relative;min-height:320px}.pdf-blocker{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#fff;z-index:5}.pdf-loading{display:flex;align-items:center;justify-content:center;height:320px}.spinner{width:28px;height:28px;border:3px solid #e5e7eb;border-top-color:var(--accent);border-radius:50%;animation:spin .9s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.composer{padding:14px;border-top:1px solid var(--border);background:#f8fafc}.messages-main .composer{position:sticky;bottom:0;border-top:none;background:#fff;padding:16px}.composer-field{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid #dfe3ea;border-radius:10px;padding:0 6px 0 2px;box-shadow:0 12px 28px #0000001a,0 3px 8px #0445b733}.composer-field:focus-within{border-color:var(--accent);box-shadow:0 16px 36px #0000001f,0 4px 10px #0445b73d}.composer-field input{flex:1;height:46px;border:0;outline:none;background:transparent;padding:0 12px 0 14px;font-size:14px}.composer-field textarea{flex:1;min-height:44px;max-height:200px;border:0;outline:none;background:transparent;padding:10px 12px 10px 14px;font-size:14px;line-height:1.5;resize:none;font-family:inherit}.composer-send{width:36px;height:36px;border-radius:9999px;background:var(--accent);color:#fff;border:none;display:grid;place-items:center;cursor:pointer}.composer-send:disabled{opacity:.6;cursor:not-allowed}.error{color:var(--danger);padding:0 16px 14px;font-size:13px}.empty-hero{display:grid;place-items:center;height:calc(100vh - 140px);background:#fff}.empty-hero-inner{text-align:center}.empty-hero h1{margin:0 0 6px;font-family:Montserrat,Inter,ui-sans-serif;font-weight:800;color:#0b1324;font-size:36px;letter-spacing:.2px}.empty-hero p{margin:0 0 18px;color:#64748b;font-size:16px}.chip-row{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}.chip{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;color:#0b1324;border-radius:9999px;padding:8px 14px;font-size:13px;cursor:pointer;border:1px solid #cfe0ff;box-shadow:0 1px 2px #00000005}.chip:hover{background:#f8fbff;border-color:#bcd3ff}.skeleton{position:relative;overflow:hidden;background:#f3f4f6}.skeleton:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background:linear-gradient(90deg,#fff0,#fff9,#fff0);animation:shimmer 1.2s infinite}@keyframes shimmer{to{transform:translate(100%)}}.skeleton-line{height:12px;border-radius:6px;margin:8px 0}.skeleton-line.sm{height:10px}.skeleton-line.lg{height:14px}.w40{width:40%}.w60{width:60%}.w80{width:80%}.w100{width:100%}.pdf-thumbs{width:130px;min-width:110px;max-width:160px;border-left:1px solid #eef2f7;background:#fbfbfb;overflow:auto}.pdf-thumbs-list{list-style:none;margin:0;padding:8px;display:grid;gap:8px}.pdf-thumb{display:grid;gap:6px;width:100%;border:1px solid #e5e7eb;background:#fff;border-radius:8px;padding:6px;cursor:pointer}.pdf-thumb.active{outline:2px solid #1a73e8;outline-offset:0}.pdf-thumb img{display:block;width:100%;height:auto;border-radius:4px}.thumb-label{font-size:11px;color:#6b7280;justify-self:center}.thumb-skeleton{background:#f3f4f6;border-radius:6px;position:relative;overflow:hidden}.thumb-skeleton:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background:linear-gradient(90deg,#fff0,#fff9,#fff0);animation:shimmer 1.2s infinite}.pdf-citations{flex:0 0 var(--pdf-citations-width);width:var(--pdf-citations-width);border-right:1px solid #eef2f7;background:#fbfbfb;overflow-y:auto;overflow-x:hidden;padding:8px 12px 12px 8px;box-sizing:border-box}.pdf-citations *{max-width:100%;word-break:break-word}.pdf-container{display:flex;width:100%;height:100%;gap:0}.pdf-content{flex:1;min-width:0;overflow:hidden;padding:0 16px}.pdf-toolbar{position:sticky;bottom:0;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;border-top:1px solid rgba(0,0,0,.06);box-shadow:0 -4px 8px #00000008;padding:8px 12px}.pdf-toolbar-left{display:flex;gap:8px}.pdf-btn{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:linear-gradient(180deg,#fff,#f7f7f7);border:1px solid rgba(0,0,0,.12);color:#111827;width:34px;height:34px;display:inline-grid;place-items:center;border-radius:8px;cursor:pointer}.pdf-btn:disabled{opacity:.5;cursor:not-allowed}.pdf-page-label{font-size:13px;color:#374151}.typing-hud{position:sticky;bottom:0;display:flex;justify-content:flex-start;padding:10px 0;background:linear-gradient(180deg,#fff0,#ffffffd9 40%,#fff)}.typing-hud-inner{display:inline-flex;align-items:center;gap:10px;padding:8px 12px;border-radius:999px;border:1px solid rgba(0,0,0,.08);box-shadow:0 4px 14px #0000000f;background:linear-gradient(90deg,#fff,#fafbff,#fff);background-size:200% 100%;color:#3b3b3b;font-size:13px;line-height:1;animation:shimmerBg 2.2s ease-in-out infinite}.typing-dot{width:10px;height:10px;border-radius:50%;background:linear-gradient(180deg,#5446e6,#1a73e8);box-shadow:0 0 0 2px #1a73e81f;animation:pulseDot 1.4s ease-in-out infinite}.typing-text{opacity:.9}.pdf-sources{width:100%}.pdf-sources-title{padding:10px 10px 6px;font-size:12px;font-weight:600;color:#374151}.pdf-sources-list{list-style:none;margin:0;padding:0 12px 12px 8px;display:flex;flex-direction:column;gap:8px;box-sizing:border-box}.pdf-source-item{display:flex;width:100%;text-align:left;gap:8px;padding:10px 12px;border-radius:8px;border:1px solid rgba(0,0,0,.08);background:transparent;color:#111827;cursor:pointer}.pdf-source-item.active{background:#1976d214}.pdf-source-rank{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:6px;background:linear-gradient(180deg,#fff,#f7f7f7);border:1px solid rgba(0,0,0,.12);font-size:12px;color:#374151}.pdf-source-text{display:inline-block;overflow:hidden}.pdf-source-filename{display:block;font-size:12px;font-weight:600;color:#111827}.pdf-source-page{display:block;font-size:11px;color:#6b7280}.pdf-source-snippet{display:block;font-size:11px;color:#6b7280;margin-top:2px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media (max-width: 1280px){.modal-content{width:95vw}}@media (max-width: 1024px){.pdf-thumbs,.pdf-citations{display:none}.modal-content{width:96vw;height:92vh}}@media (max-width: 640px){.modal-content{width:98vw;height:92vh;border-radius:10px}}@media (max-width: 900px){.chat-layout{grid-template-columns:1fr;position:relative}.sidebar{position:fixed;top:0;bottom:0;left:0;width:min(86vw,320px);max-width:92vw;transform:translate(-100%);transition:transform .2s ease-in-out;z-index:1000;box-shadow:0 10px 30px #0000002e}.chat-container.drawer-open .sidebar{transform:translate(0)}.drawer-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#0000005c;-webkit-backdrop-filter:saturate(120%) blur(2px);backdrop-filter:saturate(120%) blur(2px);z-index:900}.mobile-bar{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--border);background:#fff;position:sticky;top:0;z-index:10}.sidebar-toggle{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;color:#111827;border:1px solid #e5e7eb;border-radius:8px;width:36px;height:36px;display:inline-grid;place-items:center;cursor:pointer}}@media (min-width: 901px){.mobile-bar{display:none}}.new-messages-chip{position:fixed;left:50%;transform:translate(-50%);bottom:96px;z-index:50}.older-messages{display:flex;justify-content:center;margin:8px 0}.toasts{position:fixed;top:16px;right:16px;display:grid;gap:8px;z-index:2000}.toast{background:#111827;color:#fff;border-radius:8px;padding:10px 12px;font-size:13px;box-shadow:0 10px 20px #0003}.toast.error{background:#b91c1c}.toast.success{background:#065f46}';
17
+ const OC = ':root{--bg: #f7f9fc;--panel: #ffffff;--text: #0b1324;--muted: #64748b;--accent: #1a73e8;--accent-2: #1a73e8;--danger: #e11d48;--border: #e5e7eb;--pdf-citations-width: 260px}*{box-sizing:border-box}.app{display:grid;grid-template-rows:auto 1fr auto;min-height:100%}.app-header{padding:16px 20px;border-bottom:1px solid var(--border);background:var(--panel);position:sticky;top:0}.app-header h1{margin:0;font-size:18px;letter-spacing:.2px;color:#111827}.app-header .subtitle{margin:4px 0 0;color:var(--muted);font-size:12px}.app-main{display:grid;grid-template-columns:1fr;padding:0}.app-footer{padding:10px 16px;color:var(--muted);border-top:1px solid var(--border);font-size:12px;background:var(--panel)}.chat-container{width:100%;max-width:none;background:var(--panel);border-top:1px solid var(--border);border-bottom:1px solid var(--border);border-radius:0;overflow:hidden;box-shadow:none}.chat-layout{display:grid;grid-template-columns:300px 1fr;min-height:100vh}.sidebar{border-right:1px solid var(--border);background:#fff;padding:10px;display:flex;flex-direction:column;gap:10px}.sidebar-header{display:flex;align-items:center;justify-content:space-between;font-weight:600;color:#0f172a;padding:6px 8px;border-radius:10px;border:1px solid transparent;background:linear-gradient(#fff,#fff) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box}.sidebar-new{background:transparent;border:none;color:var(--accent);font-size:18px;cursor:pointer}.thread-list{overflow:auto;display:grid;gap:6px;padding-right:4px}.thread-group{display:grid;gap:6px}.thread-group-title{color:#94a3b8;font-size:11px;padding:8px 6px 0;text-transform:uppercase;letter-spacing:.04em}.thread-empty{color:var(--muted);font-size:12px;padding:12px 8px}.thread-item{text-align:left;border:0;background:#fff;color:var(--text);border-radius:8px;padding:8px;display:flex;align-items:flex-start;gap:10px;cursor:pointer}.thread-item:hover{background:#f8fafc}.thread-item.active{background:#f8fafc;box-shadow:inset 0 0 0 1px #e5e7eb}.thread-icon{width:24px;height:24px;color:#94a3b8;display:grid;place-items:center}.thread-text{display:grid;gap:4px}.thread-date{font-size:10px;color:#a4a4a4;font-family:Montserrat,Inter,ui-sans-serif,system-ui}.thread-title{font-size:12px;font-weight:500;color:#0b1324;font-family:Montserrat,Inter,ui-sans-serif,system-ui}.messages-main{display:flex;flex-direction:column}.messages{height:calc(100vh - 100px);overflow:auto;padding:28px 40px;display:flex;flex-direction:column;gap:12px;background:#fff;position:relative}.messages-loading{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#fffc;-webkit-backdrop-filter:blur(2px) saturate(110%);backdrop-filter:blur(2px) saturate(110%);z-index:5}.messages-loading .loading-inner{display:inline-flex;align-items:center;gap:10px;padding:10px 14px;border-radius:999px;border:1px solid rgba(0,0,0,.06);background:#fff;box-shadow:0 8px 18px #00000014;color:#374151;font-size:13px}.message{display:flex}.message.user{justify-content:flex-end}.message.assistant{justify-content:flex-start;align-items:flex-start;gap:12px}.bubble{max-width:80%;padding:12px 14px;border-radius:12px;line-height:1.6;white-space:normal;word-wrap:break-word;font-size:14px;color:#1f2937;font-family:Montserrat,Inter,ui-sans-serif,system-ui}.message.user .bubble{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box;color:#0b1324;border:1px solid transparent;border-bottom-right-radius:4px}.message.assistant .bubble{background:#fff;border:1px solid #e5e7eb;color:#0b1324;border-bottom-left-radius:4px}.message.assistant .bubble-plain{background:transparent;border:0;padding:0;max-width:72ch;font-size:14px;color:#364152;font-family:Montserrat,Inter,ui-sans-serif,system-ui;line-height:1.55}.message.assistant .bubble-plain p,.bubble p{margin:0 0 8px}.bubble>*:first-child{margin-top:0}.bubble>*:last-child{margin-bottom:0}.bubble ul,.bubble ol{margin:8px 0 8px 18px;padding:0}.bubble li{margin:4px 0}.bubble h1,.bubble h2,.bubble h3,.bubble h4,.bubble h5,.bubble h6{margin:10px 0 6px;line-height:1.3}.bubble pre{margin:8px 0;padding:10px;background:#f8fafc;border:1px solid #e5e7eb;border-radius:8px;overflow:auto}.bubble code:not(pre code){background:#f3f4f6;padding:1px 4px;border-radius:4px}.bubble table{border-collapse:collapse;margin:8px 0}.bubble th,.bubble td{border:1px solid #e5e7eb;padding:6px 8px}.message.assistant .bubble-plain a{color:var(--accent);text-decoration:underline;text-underline-offset:2px}.avatar{width:28px;height:28px;border-radius:9999px;background:transparent;border:0;display:grid;place-items:center;color:var(--accent);font-size:14px;margin-top:3px}.avatar-star{transform:rotate(12deg)}.bubble-pending{opacity:.8;font-style:italic}.msg-toolbar{display:flex;align-items:center;gap:12px;margin-left:40px}.msg-divider{height:1px;background:#e5e7eb;flex:1}.btn-copy{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:8px;padding:4px 8px;font-size:12px;cursor:pointer;display:inline-flex;align-items:center;gap:6px}.btn-copy:hover{color:#111827;border-color:#cfd8e3}.sources-hud{margin-top:14px;border:1px solid #dbe7ff;background:#f8fafc;padding:6px 6px 8px;border-radius:8px;max-width:86%}.sources-copy{display:flex;align-items:center;gap:6px;margin:8px 0 6px}.msg-subdivider{height:1px;background:#f3f3f3;margin:10px 0 6px}.sources-header{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:6px}.sources-title{font-size:10px;color:#6b7280;margin:0;text-transform:uppercase;letter-spacing:.04em}.sources-list{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:6px}.source-item{display:flex;align-items:center;gap:6px}.source-link{display:inline-flex;align-items:center;gap:6px;border:1px solid #e5e7eb;background:#fff;border-radius:8px;padding:6px 8px;font-size:11px;cursor:pointer;min-width:160px;max-width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.source-link:hover{border-color:#d1d5db;background:#f9fafb}.source-rank{font-weight:600;color:var(--accent)}.source-name{font-weight:500;color:#0b1324;overflow:hidden;text-overflow:ellipsis}.source-page{color:#6b7280}.source-score{margin-left:auto;font-variant-numeric:tabular-nums;color:#6b7280}.source-open{text-decoration:none;font-size:12px}.btn-copy-inline{border:0;background:transparent;padding:0;color:#1a73e8;display:inline-flex;align-items:center;gap:6px;font-size:12px}.btn-copy-inline:hover{text-decoration:underline}.message-divider{height:1px;background:#f3f3f3;margin:10px 0 2px 40px}.message.user{align-items:center;gap:8px}.user-bubble{background:#e8f0fe;border:1px solid #dbe7ff;color:#0b1324;box-shadow:0 1px 2px #0000000a,0 3px 10px #0445b71a}.user-avatar{width:28px;height:28px;border-radius:9999px;background:linear-gradient(#e2e8f0,#e2e8f0) padding-box,linear-gradient(180deg,#0445b7,#0cc1a3) border-box;color:#274a9a;display:grid;place-items:center;font-size:12px;font-weight:600;font-family:Montserrat,Inter,ui-sans-serif,system-ui;border:1px solid transparent}.user-avatar-img{width:28px;height:28px;border-radius:8px;object-fit:cover;display:inline-block}.modal{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;padding:2vh 2vw;z-index:1000;visibility:hidden;opacity:0;pointer-events:none;background:#ffffff8c;-webkit-backdrop-filter:blur(8px) saturate(120%);backdrop-filter:blur(8px) saturate(120%);transition:opacity .12s ease-in-out,visibility .12s ease-in-out}.modal.open{visibility:visible;opacity:1;pointer-events:auto}.modal-content{background:#fff;width:min(92vw,800px);max-width:min(92vw,800px);max-height:680px;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 8px 24px #0000001f;overflow:hidden;display:flex;flex-direction:column}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid rgba(0,0,0,.06)}.modal-title{font-weight:600;color:#111827}.modal-close{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;color:#6b7280;border:0;font-size:20px;line-height:1;width:28px;height:28px;display:inline-grid;place-items:center;border-radius:6px;cursor:pointer}.modal-body{height:680px;overflow:hidden;position:relative;padding:0}.modal-body.panning{cursor:grabbing}.pdf-stage canvas{display:block}.pdf-viewer{position:relative;min-height:320px}.pdf-blocker{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#fff;z-index:5}.pdf-loading{display:flex;align-items:center;justify-content:center;height:320px}.spinner{width:28px;height:28px;border:3px solid #e5e7eb;border-top-color:var(--accent);border-radius:50%;animation:spin .9s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.composer{padding:14px;border-top:1px solid var(--border);background:#f8fafc}.messages-main .composer{position:sticky;bottom:0;border-top:none;background:#fff;padding:16px}.composer-field{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid #dfe3ea;border-radius:10px;padding:0 6px 0 2px;box-shadow:0 12px 28px #0000001a,0 3px 8px #0445b733}.composer-field:focus-within{border-color:var(--accent);box-shadow:0 16px 36px #0000001f,0 4px 10px #0445b73d}.composer-field input{flex:1;height:46px;border:0;outline:none;background:transparent;padding:0 12px 0 14px;font-size:14px}.composer-field textarea{flex:1;min-height:44px;max-height:200px;border:0;outline:none;background:transparent;padding:10px 12px 10px 14px;font-size:14px;line-height:1.5;resize:none;font-family:inherit}.composer-send{width:36px;height:36px;border-radius:9999px;background:var(--accent);color:#fff;border:none;display:grid;place-items:center;cursor:pointer}.composer-send:disabled{opacity:.6;cursor:not-allowed}.error{color:var(--danger);padding:0 16px 14px;font-size:13px}.empty-hero{display:grid;place-items:center;height:calc(100vh - 140px);background:#fff}.empty-hero-inner{text-align:center}.empty-hero h1{margin:0 0 6px;font-family:Montserrat,Inter,ui-sans-serif;font-weight:800;color:#0b1324;font-size:36px;letter-spacing:.2px}.empty-hero p{margin:0 0 18px;color:#64748b;font-size:16px}.chip-row{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}.chip{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;color:#0b1324;border-radius:9999px;padding:8px 14px;font-size:13px;cursor:pointer;border:1px solid #cfe0ff;box-shadow:0 1px 2px #00000005}.chip:hover{background:#f8fbff;border-color:#bcd3ff}.skeleton{position:relative;overflow:hidden;background:#f3f4f6}.skeleton:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background:linear-gradient(90deg,#fff0,#fff9,#fff0);animation:shimmer 1.2s infinite}@keyframes shimmer{to{transform:translate(100%)}}.skeleton-line{height:12px;border-radius:6px;margin:8px 0}.skeleton-line.sm{height:10px}.skeleton-line.lg{height:14px}.w40{width:40%}.w60{width:60%}.w80{width:80%}.w100{width:100%}.pdf-thumbs{width:130px;min-width:110px;max-width:160px;border-left:1px solid #eef2f7;background:#fbfbfb;overflow:auto}.pdf-thumbs-list{list-style:none;margin:0;padding:8px;display:grid;gap:8px}.pdf-thumb{display:grid;gap:6px;width:100%;border:1px solid #e5e7eb;background:#fff;border-radius:8px;padding:6px;cursor:pointer}.pdf-thumb.active{outline:2px solid #1a73e8;outline-offset:0}.pdf-thumb img{display:block;width:100%;height:auto;border-radius:4px}.thumb-label{font-size:11px;color:#6b7280;justify-self:center}.thumb-skeleton{background:#f3f4f6;border-radius:6px;position:relative;overflow:hidden}.thumb-skeleton:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background:linear-gradient(90deg,#fff0,#fff9,#fff0);animation:shimmer 1.2s infinite}.pdf-citations{flex:0 0 var(--pdf-citations-width);width:var(--pdf-citations-width);border-right:1px solid #eef2f7;background:#fbfbfb;overflow-y:auto;overflow-x:hidden;padding:8px 12px 12px 8px;box-sizing:border-box}.pdf-citations *{max-width:100%;word-break:break-word}.pdf-container{display:flex;width:100%;height:100%;gap:0}.pdf-content{flex:1;min-width:0;overflow:hidden;padding:0 16px}.pdf-toolbar{position:sticky;bottom:0;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fff;border-top:1px solid rgba(0,0,0,.06);box-shadow:0 -4px 8px #00000008;padding:8px 12px}.pdf-toolbar-left{display:flex;gap:8px}.pdf-btn{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:linear-gradient(180deg,#fff,#f7f7f7);border:1px solid rgba(0,0,0,.12);color:#111827;width:34px;height:34px;display:inline-grid;place-items:center;border-radius:8px;cursor:pointer}.pdf-btn:disabled{opacity:.5;cursor:not-allowed}.pdf-page-label{font-size:13px;color:#374151}.typing-hud{position:sticky;bottom:0;display:flex;justify-content:flex-start;padding:10px 0;background:linear-gradient(180deg,#fff0,#ffffffd9 40%,#fff)}.typing-hud-inner{display:inline-flex;align-items:center;gap:10px;padding:8px 12px;border-radius:999px;border:1px solid rgba(0,0,0,.08);box-shadow:0 4px 14px #0000000f;background:linear-gradient(90deg,#fff,#fafbff,#fff);background-size:200% 100%;color:#3b3b3b;font-size:13px;line-height:1;animation:shimmerBg 2.2s ease-in-out infinite}.typing-dot{width:10px;height:10px;border-radius:50%;background:linear-gradient(180deg,#5446e6,#1a73e8);box-shadow:0 0 0 2px #1a73e81f;animation:pulseDot 1.4s ease-in-out infinite}.typing-text{opacity:.9}.pdf-sources{width:100%}.pdf-sources-title{padding:10px 10px 6px;font-size:12px;font-weight:600;color:#374151}.pdf-sources-list{list-style:none;margin:0;padding:0 12px 12px 8px;display:flex;flex-direction:column;gap:8px;box-sizing:border-box}.pdf-source-item{display:flex;width:100%;text-align:left;gap:8px;padding:10px 12px;border-radius:8px;border:1px solid rgba(0,0,0,.08);background:transparent;color:#111827;cursor:pointer}.pdf-source-item.active{background:#1976d214}.pdf-source-rank{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:6px;background:linear-gradient(180deg,#fff,#f7f7f7);border:1px solid rgba(0,0,0,.12);font-size:12px;color:#374151}.pdf-source-text{display:inline-block;overflow:hidden}.pdf-source-filename{display:block;font-size:12px;font-weight:600;color:#111827}.pdf-source-page{display:block;font-size:11px;color:#6b7280}.pdf-source-snippet{display:block;font-size:11px;color:#6b7280;margin-top:2px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media (max-width: 1280px){.modal-content{width:95vw}}@media (max-width: 1024px){.pdf-thumbs,.pdf-citations{display:none}.modal-content{width:96vw;height:92vh}}@media (max-width: 640px){.modal-content{width:98vw;height:92vh;border-radius:10px}}@media (max-width: 900px){.chat-layout{grid-template-columns:1fr;position:relative}.sidebar{position:fixed;top:0;bottom:0;left:0;width:min(86vw,320px);max-width:92vw;transform:translate(-100%);transition:transform .2s ease-in-out;z-index:1000;box-shadow:0 10px 30px #0000002e}.chat-container.drawer-open .sidebar{transform:translate(0)}.drawer-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#0000005c;-webkit-backdrop-filter:saturate(120%) blur(2px);backdrop-filter:saturate(120%) blur(2px);z-index:900}.mobile-bar{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--border);background:#fff;position:sticky;top:0;z-index:10}.sidebar-toggle{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#fff;color:#111827;border:1px solid #e5e7eb;border-radius:8px;width:36px;height:36px;display:inline-grid;place-items:center;cursor:pointer}}@media (min-width: 901px){.mobile-bar{display:none}}.new-messages-chip{position:fixed;left:50%;transform:translate(-50%);bottom:96px;z-index:50}.older-messages{display:flex;justify-content:center;margin:8px 0}.toasts{position:fixed;top:16px;right:16px;display:grid;gap:8px;z-index:2000}.toast{background:#111827;color:#fff;border-radius:8px;padding:10px 12px;font-size:13px;box-shadow:0 10px 20px #0003}.toast.error{background:#b91c1c}.toast.success{background:#065f46}';
18
18
  var sh = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
19
19
  function cm(r) {
20
20
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
@@ -26985,31 +26985,18 @@ vt.normalizeUnicode;
26985
26985
  vt.setLayerDimensions;
26986
26986
  vt.shadow;
26987
26987
  vt.stopEvent;
26988
- var TC = vt.version;
26988
+ vt.version;
26989
26989
  let Cu = null;
26990
- function RC() {
26991
- var n, i;
26992
- const r = globalThis == null ? void 0 : globalThis.PDFJS_WORKER_URL, e = (i = (n = import.meta) == null ? void 0 : n.env) == null ? void 0 : i.VITE_PDFJS_WORKER_URL;
26993
- return typeof r == "string" && r ? r : typeof e == "string" && e ? e : `https://cdn.jsdelivr.net/npm/pdfjs-dist@${TC || "4.8.69"}/legacy/build/pdf.worker.min.mjs`;
26990
+ function TC() {
26991
+ var t, n;
26992
+ const r = globalThis == null ? void 0 : globalThis.PDFJS_WORKER_URL, e = (n = (t = import.meta) == null ? void 0 : t.env) == null ? void 0 : n.VITE_PDFJS_WORKER_URL;
26993
+ return typeof r == "string" && r || typeof e == "string" && e || // Fallback to CDN (ESM worker)
26994
+ "https://cdn.jsdelivr.net/npm/pdfjs-dist@4.8.69/legacy/build/pdf.worker.min.mjs";
26994
26995
  }
26995
- function IC() {
26996
+ function RC() {
26996
26997
  return Cu || (Cu = (async () => {
26997
- const r = RC(), e = `
26998
- if (typeof Promise.allSettled !== 'function') {
26999
- Promise.allSettled = function(iterable) {
27000
- const tasks = [];
27001
- for (const item of iterable) {
27002
- tasks.push(Promise.resolve(item)
27003
- .then(value => ({ status: 'fulfilled', value }))
27004
- .catch(reason => ({ status: 'rejected', reason }))
27005
- );
27006
- }
27007
- return Promise.all(tasks);
27008
- };
27009
- }
27010
- import '${r}';
27011
- `, t = new Blob([e], { type: "application/javascript" }), n = URL.createObjectURL(t);
27012
- kC.workerSrc = n;
26998
+ const r = TC();
26999
+ kC.workerSrc = r;
27013
27000
  try {
27014
27001
  await fetch(r, { method: "GET" });
27015
27002
  } catch {
@@ -27017,7 +27004,7 @@ function IC() {
27017
27004
  })(), Cu);
27018
27005
  }
27019
27006
  const am = /* @__PURE__ */ new Map();
27020
- function PC({ fileUrl: r, pageNumber: e, onMeta: t, scrollBehavior: n = "auto", highlights: i }) {
27007
+ function IC({ fileUrl: r, pageNumber: e, onMeta: t, scrollBehavior: n = "auto", highlights: i }) {
27021
27008
  const [s, a] = ve(0), [o, l] = ve(!0), [u, h] = ve(null), [d, f] = ve(0), p = Oe([]), g = Oe([]), m = Oe(null), v = Oe(null), b = Oe(!1), A = Oe(null), E = Oe(null), R = Oe(1), k = hr((O) => {
27022
27009
  try {
27023
27010
  return !O || /^https?:\/\//i.test(O) ? O : new URL(O, window.location.origin).href;
@@ -27141,7 +27128,7 @@ function PC({ fileUrl: r, pageNumber: e, onMeta: t, scrollBehavior: n = "auto",
27141
27128
  let O = !1;
27142
27129
  return (async () => {
27143
27130
  try {
27144
- l(!0), console.debug("[SimplePdfViewer] start load", { fileUrl: r }), await IC();
27131
+ l(!0), console.debug("[SimplePdfViewer] start load", { fileUrl: r }), await RC();
27145
27132
  const L = k(r);
27146
27133
  let I = am.get(L);
27147
27134
  if (I || (I = await CC(L).promise, O || am.set(L, I)), O) return;
@@ -27265,7 +27252,7 @@ function PC({ fileUrl: r, pageNumber: e, onMeta: t, scrollBehavior: n = "auto",
27265
27252
  )) })
27266
27253
  ] });
27267
27254
  }
27268
- function MC({
27255
+ function PC({
27269
27256
  open: r,
27270
27257
  file: e,
27271
27258
  page: t,
@@ -27321,7 +27308,7 @@ function MC({
27321
27308
  }
27322
27309
  ) }),
27323
27310
  /* @__PURE__ */ F.jsx("div", { className: "pdf-content", ref: p, children: /* @__PURE__ */ F.jsx(
27324
- PC,
27311
+ IC,
27325
27312
  {
27326
27313
  fileUrl: e,
27327
27314
  pageNumber: t,
@@ -27364,7 +27351,7 @@ function MC({
27364
27351
  ] })
27365
27352
  ] }) });
27366
27353
  }
27367
- function FC({ user: r, generateToken: e, clientId: t }) {
27354
+ function DC({ user: r, generateToken: e, clientId: t }) {
27368
27355
  const n = "https://fastify.tpsportal.co.nz/api", i = "https://fastify.tpsportal.co.nz/docs", [s, a] = ve([]), [o, l] = ve(""), [u, h] = ve(!1), [d, f] = ve(null), [p, g] = ve(null), [m, v] = ve([]), [b, A] = ve({ open: !1 }), [E, R] = ve(null), k = Oe(null), S = Oe(!0), M = Oe(0), [O, L] = ve(!0), [I, D] = ve(!1), [_, B] = ve(50), [U, $] = ve(!1), [N, H] = ve(!1), q = Oe(null), lt = Oe(null), T = Oe(null), { toasts: bt, pushToast: ft } = Ov(), C = Sd(() => Rv({ apiBase: n, generateToken: e, clientId: t }), [n, e, t]), gt = hr(({ numPages: X }) => R(X), []), Mt = hr(() => {
27369
27356
  const X = k.current;
27370
27357
  X && requestAnimationFrame(() => {
@@ -27637,7 +27624,7 @@ function FC({ user: r, generateToken: e, clientId: t }) {
27637
27624
  }
27638
27625
  ) }),
27639
27626
  /* @__PURE__ */ F.jsx(
27640
- MC,
27627
+ PC,
27641
27628
  {
27642
27629
  open: b.open,
27643
27630
  file: b.file,
@@ -27655,7 +27642,7 @@ function FC({ user: r, generateToken: e, clientId: t }) {
27655
27642
  ] });
27656
27643
  }
27657
27644
  export {
27658
- FC as Chat,
27659
- DC as ChatInlineStyles
27645
+ DC as Chat,
27646
+ OC as ChatInlineStyles
27660
27647
  };
27661
27648
  //# sourceMappingURL=index.js.map