@cas0570/chat-widget 0.0.7 → 0.0.8

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.
@@ -1,287 +1,329 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(':root{--gcw-color-white: #fff;--gcw-color-gray-50: #f9fafb;--gcw-color-gray-100: #f3f4f6;--gcw-color-gray-200: #e5e7eb;--gcw-color-gray-300: #d1d5db;--gcw-color-gray-400: #9ca3af;--gcw-color-gray-500: #6b7280;--gcw-color-gray-600: #4b5563;--gcw-color-gray-700: #374151;--gcw-color-gray-800: #1f2937;--gcw-color-gray-900: #111827;--gcw-color-primary: #3b82f6;--gcw-color-primary-hover: #2563eb;--gcw-color-primary-light: #eff6ff;--gcw-color-error: #ef4444;--gcw-color-success: #22c55e;--gcw-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;--gcw-font-size-xs: .625rem;--gcw-font-size-sm: .75rem;--gcw-font-size-base: .875rem;--gcw-font-size-lg: 1rem;--gcw-spacing-1: .25rem;--gcw-spacing-2: .5rem;--gcw-spacing-3: .75rem;--gcw-spacing-4: 1rem;--gcw-spacing-6: 1.5rem;--gcw-spacing-8: 2rem;--gcw-spacing-10: 2.5rem;--gcw-spacing-12: 3rem;--gcw-spacing-16: 4rem;--gcw-spacing-20: 5rem;--gcw-radius-sm: .25rem;--gcw-radius-md: .5rem;--gcw-radius-lg: .75rem;--gcw-radius-xl: 1rem;--gcw-radius-2xl: 1.25rem;--gcw-radius-full: 9999px;--gcw-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);--gcw-shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--gcw-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--gcw-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--gcw-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25);--gcw-transition-fast: .15s ease;--gcw-transition-base: .2s ease;--gcw-transition-slow: .3s ease;--gcw-z-widget: 9999}.gcw-widget,.gcw-widget *,.gcw-widget *:before,.gcw-widget *:after{box-sizing:border-box;margin:0;padding:0;font-family:var(--gcw-font-family);line-height:1.5}.gcw-widget{font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-base);line-height:1.5;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:var(--gcw-color-gray-800);text-align:left;letter-spacing:normal;word-spacing:normal;text-transform:none;text-indent:0;text-shadow:none;font-weight:400;font-style:normal}.gcw-container{position:fixed;z-index:var(--gcw-z-widget);display:flex;gap:var(--gcw-spacing-4)}.gcw-container--bottom-right{right:var(--gcw-spacing-4);bottom:var(--gcw-spacing-4);flex-direction:column-reverse;align-items:flex-end}.gcw-container--bottom-left{left:var(--gcw-spacing-4);bottom:var(--gcw-spacing-4);flex-direction:column-reverse;align-items:flex-start}.gcw-container--top-right{right:var(--gcw-spacing-4);top:var(--gcw-spacing-4);flex-direction:column;align-items:flex-end}.gcw-container--top-left{left:var(--gcw-spacing-4);top:var(--gcw-spacing-4);flex-direction:column;align-items:flex-start}.gcw-container--custom{flex-direction:column-reverse;align-items:flex-end}.gcw-container--custom.gcw-container--align-left{align-items:flex-start}.gcw-container--custom.gcw-container--flow-down{flex-direction:column}.gcw-toggle{position:relative;width:3.5rem;height:3.5rem;border:none;border-radius:var(--gcw-radius-full);background-color:var(--gcw-color-primary);color:var(--gcw-color-white);cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:var(--gcw-shadow-lg);transition:transform var(--gcw-transition-base),box-shadow var(--gcw-transition-base)}.gcw-toggle:hover{transform:scale(1.1);box-shadow:var(--gcw-shadow-xl)}.gcw-toggle:active{transform:scale(.95)}.gcw-toggle__icon{width:1.5rem;height:1.5rem;transition:transform var(--gcw-transition-slow)}.gcw-toggle__badge{position:absolute;top:-.25rem;right:-.25rem;width:1rem;height:1rem;border-radius:var(--gcw-radius-full);display:flex;align-items:center;justify-content:center;font-size:var(--gcw-font-size-xs);font-weight:700;animation:gcw-pulse 2s infinite}.gcw-toggle__badge--unread{background-color:var(--gcw-color-error);color:var(--gcw-color-white)}.gcw-toggle__badge--popout{background-color:var(--gcw-color-success)}.gcw-window{position:relative;display:flex;flex-direction:column;background-color:var(--gcw-color-white);border-radius:var(--gcw-radius-2xl);box-shadow:var(--gcw-shadow-2xl);border:1px solid var(--gcw-color-gray-200);overflow:hidden;animation:gcw-slide-up var(--gcw-transition-slow) ease-out}.gcw-window--small{width:365px;height:450px}.gcw-window--medium{width:380px;height:560px}.gcw-window--large{width:480px;height:680px}.gcw-window--fullscreen{width:calc(100vw - 2rem);height:calc(100vh - 6rem);max-width:56rem}.gcw-window{max-height:90vh;transition:width var(--gcw-transition-base),height var(--gcw-transition-base)}.gcw-header{display:flex;align-items:center;justify-content:space-between;padding:var(--gcw-spacing-3) var(--gcw-spacing-4);color:var(--gcw-color-white);flex-shrink:0}.gcw-header__left{display:flex;align-items:center;gap:var(--gcw-spacing-3)}.gcw-header__avatar{width:2.5rem;height:2.5rem;border-radius:var(--gcw-radius-full);background-color:#fff3;display:flex;align-items:center;justify-content:center}.gcw-header__avatar-icon{width:1.25rem;height:1.25rem}.gcw-header__info{display:flex;flex-direction:column;min-width:0;flex:1}.gcw-header__title{font-size:var(--gcw-font-size-base);font-weight:600;line-height:1.4;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gcw-header__subtitle{font-size:var(--gcw-font-size-sm);font-weight:400;line-height:1.4;opacity:.9;margin:0;word-wrap:break-word;overflow-wrap:break-word}.gcw-header__actions{display:flex;align-items:center;gap:.125rem}.gcw-header__btn{width:2rem;height:2rem;border:none;border-radius:var(--gcw-radius-full);background-color:transparent;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color var(--gcw-transition-fast)}.gcw-header__btn:hover{background-color:#fff3}.gcw-header__btn-icon{width:1rem;height:1rem}.gcw-header-menu{position:relative}.gcw-header-menu__dropdown{position:absolute;top:calc(100% + .25rem);right:0;min-width:12rem;background-color:var(--gcw-color-white);border-radius:var(--gcw-radius-lg);box-shadow:var(--gcw-shadow-xl);border:1px solid var(--gcw-color-gray-200);padding:var(--gcw-spacing-1) 0;z-index:10;animation:gcw-menu-appear var(--gcw-transition-fast) ease-out}.gcw-header-menu__item{display:flex;align-items:center;gap:var(--gcw-spacing-3);width:100%;padding:var(--gcw-spacing-2) var(--gcw-spacing-3);border:none;background:none;color:var(--gcw-color-gray-700);font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-sm);cursor:pointer;transition:background-color var(--gcw-transition-fast);text-align:left;white-space:nowrap}.gcw-header-menu__item:hover{background-color:var(--gcw-color-gray-100)}.gcw-header-menu__item--danger{color:var(--gcw-color-error)}.gcw-header-menu__item--danger:hover{background-color:#fef2f2}.gcw-header-menu__icon{width:1rem;height:1rem;flex-shrink:0}.gcw-header-menu__divider{height:1px;background-color:var(--gcw-color-gray-200);margin:var(--gcw-spacing-1) 0}@keyframes gcw-menu-appear{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}.gcw-messages{flex:1;overflow-y:auto;padding:var(--gcw-spacing-4);display:flex;flex-direction:column;gap:var(--gcw-spacing-4)}.gcw-messages::-webkit-scrollbar{width:6px}.gcw-messages::-webkit-scrollbar-track{background:transparent}.gcw-messages::-webkit-scrollbar-thumb{background-color:var(--gcw-color-gray-300);border-radius:3px}.gcw-messages::-webkit-scrollbar-thumb:hover{background-color:var(--gcw-color-gray-400)}.gcw-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--gcw-spacing-6);color:var(--gcw-color-gray-400);text-align:center}.gcw-empty__icon{width:4rem;height:4rem;margin-bottom:var(--gcw-spacing-4);opacity:.5}.gcw-empty__text{font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.5;margin:0}.gcw-session-loading{display:flex;flex-direction:column;align-items:center;gap:var(--gcw-spacing-3)}.gcw-session-loading__spinner{width:2rem;height:2rem;border:3px solid var(--gcw-color-gray-200);border-top-color:var(--gcw-color-primary);border-radius:50%;animation:gcw-spin .8s linear infinite}@keyframes gcw-spin{to{transform:rotate(360deg)}}.gcw-bubble-row{display:flex}.gcw-bubble-row--user{justify-content:flex-end}.gcw-bubble-row--assistant{justify-content:flex-start}.gcw-bubble-wrapper{max-width:85%;display:flex;flex-direction:column}.gcw-bubble-wrapper--user{align-items:flex-end}.gcw-bubble-wrapper--assistant{align-items:flex-start}.gcw-bubble{padding:var(--gcw-spacing-2) var(--gcw-spacing-4);border-radius:var(--gcw-radius-2xl);font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.6;letter-spacing:normal;word-wrap:break-word}.gcw-bubble--user{color:var(--gcw-color-white);border-bottom-right-radius:var(--gcw-radius-sm)}.gcw-bubble--assistant{background-color:var(--gcw-color-gray-100);color:var(--gcw-color-gray-800);border-bottom-left-radius:var(--gcw-radius-sm)}.gcw-bubble__timestamp{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400);margin-top:var(--gcw-spacing-1);padding:0 var(--gcw-spacing-1)}.gcw-content p{margin-bottom:var(--gcw-spacing-2)}.gcw-content p:last-child{margin-bottom:0}.gcw-content strong{font-weight:600}.gcw-content em{font-style:italic}.gcw-content ul,.gcw-content ol{margin:var(--gcw-spacing-2) 0;padding-left:var(--gcw-spacing-6)}.gcw-content li{margin-bottom:var(--gcw-spacing-1)}.gcw-content code{background-color:#0000001a;padding:.125rem .375rem;border-radius:var(--gcw-radius-sm);font-size:.875em;font-family:SF Mono,Monaco,Consolas,monospace}.gcw-bubble--user .gcw-content code{background-color:#fff3}.gcw-content pre{background-color:var(--gcw-color-gray-800);color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3);border-radius:var(--gcw-radius-md);overflow-x:auto;margin:var(--gcw-spacing-2) 0}.gcw-content pre code{background-color:transparent;padding:0;font-size:var(--gcw-font-size-sm)}.gcw-content a{color:var(--gcw-color-primary);text-decoration:underline}.gcw-content a:hover{color:var(--gcw-color-primary-hover)}.gcw-bubble--user .gcw-content a{color:#ffffffe6}.gcw-md-heading{font-weight:600;margin-top:var(--gcw-spacing-3);margin-bottom:var(--gcw-spacing-1)}.gcw-md-heading--h2{font-size:var(--gcw-font-size-lg);font-weight:700}.gcw-md-heading--h3,.gcw-md-heading--h4{font-size:var(--gcw-font-size-base)}.gcw-md-heading--h5{font-size:var(--gcw-font-size-sm)}.gcw-md-paragraph{margin-bottom:var(--gcw-spacing-2)}.gcw-md-paragraph:last-child{margin-bottom:0}.gcw-md-list{margin:var(--gcw-spacing-2) 0;padding-left:var(--gcw-spacing-4)}.gcw-md-list--ul{list-style-type:disc}.gcw-md-list--ol{list-style-type:decimal}.gcw-md-list__item{font-size:var(--gcw-font-size-base);margin-bottom:var(--gcw-spacing-1)}.gcw-md-bold{font-weight:600}.gcw-md-italic{font-style:italic}.gcw-md-code{background-color:var(--gcw-color-gray-200);padding:.125rem var(--gcw-spacing-2);border-radius:var(--gcw-radius-sm);font-size:var(--gcw-font-size-sm);font-family:SF Mono,Monaco,Consolas,monospace}.gcw-bubble--user .gcw-md-code{background-color:#fff3}.gcw-md-code-block{background-color:var(--gcw-color-gray-800);color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3);border-radius:var(--gcw-radius-lg);font-size:var(--gcw-font-size-sm);overflow-x:auto;margin:var(--gcw-spacing-2) 0}.gcw-md-code-block code{font-family:SF Mono,Monaco,Consolas,monospace}.gcw-md-link{color:var(--gcw-color-primary);text-decoration:underline}.gcw-md-link:hover{color:var(--gcw-color-primary-hover)}.gcw-bubble--user .gcw-md-link{color:#ffffffe6}.gcw-sources{display:flex;flex-wrap:wrap;gap:var(--gcw-spacing-2);margin-top:var(--gcw-spacing-2)}.gcw-source{display:inline-flex;align-items:center;gap:var(--gcw-spacing-1);padding:var(--gcw-spacing-1) var(--gcw-spacing-2);border-radius:var(--gcw-radius-full);background-color:var(--gcw-color-primary-light);color:var(--gcw-color-primary);font-size:var(--gcw-font-size-sm);text-decoration:none;transition:background-color var(--gcw-transition-fast)}.gcw-source:hover{background-color:#dbeafe}.gcw-source__icon{width:.75rem;height:.75rem}.gcw-typing{display:flex;justify-content:flex-start}.gcw-typing__bubble{background-color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3) var(--gcw-spacing-4);border-radius:var(--gcw-radius-2xl);border-bottom-left-radius:var(--gcw-radius-sm)}.gcw-typing__dots{display:flex;gap:var(--gcw-spacing-1)}.gcw-typing__dot{width:.5rem;height:.5rem;background-color:var(--gcw-color-gray-400);border-radius:var(--gcw-radius-full);animation:gcw-typing-bounce 1.4s infinite ease-in-out both}.gcw-typing__dot:nth-child(1){animation-delay:-.32s}.gcw-typing__dot:nth-child(2){animation-delay:-.16s}.gcw-input-area{padding:var(--gcw-spacing-3);border-top:1px solid var(--gcw-color-gray-200);background-color:var(--gcw-color-white);flex-shrink:0}.gcw-input-row{display:flex;align-items:flex-end;gap:var(--gcw-spacing-2)}.gcw-input{flex:1;min-height:44px;max-height:120px;padding:var(--gcw-spacing-2) var(--gcw-spacing-4);border:1px solid var(--gcw-color-gray-200);border-radius:var(--gcw-radius-xl);background-color:var(--gcw-color-white);color:var(--gcw-color-gray-800);font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.5;letter-spacing:normal;resize:none;outline:none;transition:border-color var(--gcw-transition-fast),box-shadow var(--gcw-transition-fast)}.gcw-input:focus{border-color:var(--gcw-color-primary);box-shadow:0 0 0 3px #3b82f61a}.gcw-input:disabled{background-color:var(--gcw-color-gray-50);cursor:not-allowed}.gcw-input::placeholder{color:var(--gcw-color-gray-400)}.gcw-send-btn{width:2.5rem;height:2.5rem;flex-shrink:0;border:none;border-radius:var(--gcw-radius-lg);color:var(--gcw-color-white);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:opacity var(--gcw-transition-fast),transform var(--gcw-transition-fast)}.gcw-send-btn:hover:not(:disabled){opacity:.9}.gcw-send-btn:active:not(:disabled){transform:scale(.95)}.gcw-send-btn:disabled{opacity:.5;cursor:not-allowed}.gcw-send-btn__icon{width:1.25rem;height:1.25rem}.gcw-input-hint{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400);text-align:center;margin-top:var(--gcw-spacing-2)}@keyframes gcw-slide-up{0%{opacity:0;transform:translateY(1rem)}to{opacity:1;transform:translateY(0)}}@keyframes gcw-pulse{0%,to{opacity:1}50%{opacity:.5}}@keyframes gcw-typing-bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}@keyframes gcw-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gcw-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.gcw-spin{animation:gcw-spin 1s linear infinite}.gcw-history{display:flex;flex-direction:column;flex:1;overflow:hidden;animation:gcw-slide-in-left var(--gcw-transition-base) ease-out}.gcw-history__header{display:flex;align-items:center;gap:var(--gcw-spacing-3);padding:var(--gcw-spacing-2) var(--gcw-spacing-3);color:var(--gcw-color-white);flex-shrink:0}.gcw-history__title{flex:1;font-size:var(--gcw-font-size-base);font-weight:600;margin:0}.gcw-history__list{flex:1;overflow-y:auto;padding:var(--gcw-spacing-2) 0}.gcw-history__list::-webkit-scrollbar{width:6px}.gcw-history__list::-webkit-scrollbar-track{background:transparent}.gcw-history__list::-webkit-scrollbar-thumb{background-color:var(--gcw-color-gray-300);border-radius:3px}.gcw-history__loading{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--gcw-spacing-3);padding:var(--gcw-spacing-8);color:var(--gcw-color-gray-400);font-size:var(--gcw-font-size-sm)}.gcw-history__empty{display:flex;align-items:center;justify-content:center;padding:var(--gcw-spacing-8);color:var(--gcw-color-gray-400);font-size:var(--gcw-font-size-sm)}.gcw-history__item{display:flex;align-items:center;justify-content:space-between;gap:var(--gcw-spacing-2);width:100%;padding:var(--gcw-spacing-3) var(--gcw-spacing-4);border:none;border-left:3px solid transparent;background:none;cursor:pointer;text-align:left;transition:background-color var(--gcw-transition-fast);font-family:var(--gcw-font-family)}.gcw-history__item:hover{background-color:var(--gcw-color-gray-50)}.gcw-history__item--active{background-color:var(--gcw-color-primary-light)}.gcw-history__item-content{display:flex;flex-direction:column;gap:.125rem;min-width:0;flex:1}.gcw-history__item-title{font-size:var(--gcw-font-size-sm);font-weight:500;color:var(--gcw-color-gray-800);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gcw-history__item-meta{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400)}.gcw-history__item-delete{flex-shrink:0;width:1.75rem;height:1.75rem;border:none;border-radius:var(--gcw-radius-md);background:transparent;color:var(--gcw-color-gray-300);cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity var(--gcw-transition-fast),color var(--gcw-transition-fast),background-color var(--gcw-transition-fast)}.gcw-history__item:hover .gcw-history__item-delete{opacity:1}.gcw-history__item-delete:hover{color:var(--gcw-color-error);background-color:#ef44441a}.gcw-history__item-delete-icon{width:.875rem;height:.875rem}@keyframes gcw-slide-in-left{0%{opacity:0;transform:translate(-1rem)}to{opacity:1;transform:translate(0)}}.gcw-modal-overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:#0006;display:flex;align-items:center;justify-content:center;z-index:100;animation:gcw-fade-in .15s ease-out;border-radius:var(--gcw-radius-2xl)}.gcw-modal{background:#fff;border-radius:.75rem;padding:1.25rem;margin:1rem;max-width:20rem;width:100%;box-shadow:0 8px 24px #00000026;animation:gcw-scale-in .15s ease-out}.gcw-modal__title{font-size:.9375rem;font-weight:600;color:#1f2937;margin:0 0 .5rem}.gcw-modal__message{font-size:.8125rem;color:#6b7280;line-height:1.5;margin:0 0 1.25rem}.gcw-modal__actions{display:flex;gap:.5rem;justify-content:flex-end}.gcw-modal__btn{padding:.4375rem .875rem;border-radius:.375rem;font-size:.8125rem;font-weight:500;cursor:pointer;border:1px solid #e5e7eb;transition:background-color .15s,border-color .15s}.gcw-modal__btn--cancel{background:#fff;color:#374151}.gcw-modal__btn--cancel:hover{background:#f9fafb;border-color:#d1d5db}.gcw-modal__btn--confirm{background:#3b82f6;color:#fff;border-color:#3b82f6}.gcw-modal__btn--confirm:hover{background:#2563eb;border-color:#2563eb}.gcw-modal__btn--danger{background:#ef4444;border-color:#ef4444}.gcw-modal__btn--danger:hover{background:#dc2626;border-color:#dc2626}@keyframes gcw-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gcw-scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- import { jsxs as d, jsx as t, Fragment as ge } from "react/jsx-runtime";
3
- import pe, { useState as x, useRef as H, useCallback as $, useEffect as C } from "react";
4
- const fe = "gcw_session_", we = "gcw_popout_", be = "gcw_read_";
5
- function q(e) {
6
- return `${fe}${e || "default"}`;
1
+ (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(':root{--gcw-color-white: #fff;--gcw-color-gray-50: #f9fafb;--gcw-color-gray-100: #f3f4f6;--gcw-color-gray-200: #e5e7eb;--gcw-color-gray-300: #d1d5db;--gcw-color-gray-400: #9ca3af;--gcw-color-gray-500: #6b7280;--gcw-color-gray-600: #4b5563;--gcw-color-gray-700: #374151;--gcw-color-gray-800: #1f2937;--gcw-color-gray-900: #111827;--gcw-color-primary: #3b82f6;--gcw-color-primary-hover: #2563eb;--gcw-color-primary-light: #eff6ff;--gcw-color-error: #ef4444;--gcw-color-success: #22c55e;--gcw-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;--gcw-font-size-xs: .625rem;--gcw-font-size-sm: .75rem;--gcw-font-size-base: .875rem;--gcw-font-size-lg: 1rem;--gcw-spacing-1: .25rem;--gcw-spacing-2: .5rem;--gcw-spacing-3: .75rem;--gcw-spacing-4: 1rem;--gcw-spacing-6: 1.5rem;--gcw-spacing-8: 2rem;--gcw-spacing-10: 2.5rem;--gcw-spacing-12: 3rem;--gcw-spacing-16: 4rem;--gcw-spacing-20: 5rem;--gcw-radius-sm: .25rem;--gcw-radius-md: .5rem;--gcw-radius-lg: .75rem;--gcw-radius-xl: 1rem;--gcw-radius-2xl: 1.25rem;--gcw-radius-full: 9999px;--gcw-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);--gcw-shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--gcw-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--gcw-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--gcw-shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / .25);--gcw-transition-fast: .15s ease;--gcw-transition-base: .2s ease;--gcw-transition-slow: .3s ease;--gcw-z-widget: 9999}.gcw-widget,.gcw-widget *,.gcw-widget *:before,.gcw-widget *:after{box-sizing:border-box;margin:0;padding:0;font-family:var(--gcw-font-family);line-height:1.5}.gcw-widget{font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-base);line-height:1.5;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:var(--gcw-color-gray-800);text-align:left;letter-spacing:normal;word-spacing:normal;text-transform:none;text-indent:0;text-shadow:none;font-weight:400;font-style:normal}.gcw-container{position:fixed;z-index:var(--gcw-z-widget);display:flex;gap:var(--gcw-spacing-4)}.gcw-container--bottom-right{right:var(--gcw-spacing-4);bottom:var(--gcw-spacing-4);flex-direction:column-reverse;align-items:flex-end}.gcw-container--bottom-left{left:var(--gcw-spacing-4);bottom:var(--gcw-spacing-4);flex-direction:column-reverse;align-items:flex-start}.gcw-container--top-right{right:var(--gcw-spacing-4);top:var(--gcw-spacing-4);flex-direction:column;align-items:flex-end}.gcw-container--top-left{left:var(--gcw-spacing-4);top:var(--gcw-spacing-4);flex-direction:column;align-items:flex-start}.gcw-container--custom{flex-direction:column-reverse;align-items:flex-end}.gcw-container--custom.gcw-container--align-left{align-items:flex-start}.gcw-container--custom.gcw-container--flow-down{flex-direction:column}.gcw-toggle{position:relative;width:3.5rem;height:3.5rem;border:none;border-radius:var(--gcw-radius-full);background-color:var(--gcw-color-primary);color:var(--gcw-color-white);cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:var(--gcw-shadow-lg);transition:transform var(--gcw-transition-base),box-shadow var(--gcw-transition-base)}.gcw-toggle:hover{transform:scale(1.1);box-shadow:var(--gcw-shadow-xl)}.gcw-toggle:active{transform:scale(.95)}.gcw-toggle__icon{width:1.5rem;height:1.5rem;transition:transform var(--gcw-transition-slow)}.gcw-toggle__badge{position:absolute;top:-.25rem;right:-.25rem;width:1rem;height:1rem;border-radius:var(--gcw-radius-full);display:flex;align-items:center;justify-content:center;font-size:var(--gcw-font-size-xs);font-weight:700;animation:gcw-pulse 2s infinite}.gcw-toggle__badge--unread{background-color:var(--gcw-color-error);color:var(--gcw-color-white)}.gcw-toggle__badge--popout{background-color:var(--gcw-color-success)}.gcw-window{position:relative;display:flex;flex-direction:column;background-color:var(--gcw-color-white);border-radius:var(--gcw-radius-2xl);box-shadow:var(--gcw-shadow-2xl);border:1px solid var(--gcw-color-gray-200);overflow:hidden;animation:gcw-slide-up var(--gcw-transition-slow) ease-out}.gcw-window--small{width:365px;height:450px}.gcw-window--medium{width:380px;height:560px}.gcw-window--large{width:480px;height:680px}.gcw-window--fullscreen{width:calc(100vw - 2rem);height:calc(100vh - 6rem);max-width:56rem}.gcw-window{max-height:90vh;transition:width var(--gcw-transition-base),height var(--gcw-transition-base)}.gcw-header{display:flex;align-items:center;justify-content:space-between;padding:var(--gcw-spacing-3) var(--gcw-spacing-4);color:var(--gcw-color-white);flex-shrink:0}.gcw-header__left{display:flex;align-items:center;gap:var(--gcw-spacing-3)}.gcw-header__avatar{width:2.5rem;height:2.5rem;border-radius:var(--gcw-radius-full);background-color:#fff3;display:flex;align-items:center;justify-content:center}.gcw-header__avatar-icon{width:1.25rem;height:1.25rem}.gcw-header__info{display:flex;flex-direction:column;min-width:0;flex:1}.gcw-header__title{font-size:var(--gcw-font-size-base);font-weight:600;line-height:1.4;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gcw-header__subtitle{font-size:var(--gcw-font-size-sm);font-weight:400;line-height:1.4;opacity:.9;margin:0;word-wrap:break-word;overflow-wrap:break-word}.gcw-header__actions{display:flex;align-items:center;gap:.125rem}.gcw-header__btn{width:2rem;height:2rem;border:none;border-radius:var(--gcw-radius-full);background-color:transparent;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color var(--gcw-transition-fast)}.gcw-header__btn:hover{background-color:#fff3}.gcw-header__btn-icon{width:1rem;height:1rem}.gcw-header-menu{position:relative}.gcw-header-menu__dropdown{position:absolute;top:calc(100% + .25rem);right:0;min-width:12rem;background-color:var(--gcw-color-white);border-radius:var(--gcw-radius-lg);box-shadow:var(--gcw-shadow-xl);border:1px solid var(--gcw-color-gray-200);padding:var(--gcw-spacing-1) 0;z-index:10;animation:gcw-menu-appear var(--gcw-transition-fast) ease-out}.gcw-header-menu__item{display:flex;align-items:center;gap:var(--gcw-spacing-3);width:100%;padding:var(--gcw-spacing-2) var(--gcw-spacing-3);border:none;background:none;color:var(--gcw-color-gray-700);font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-sm);cursor:pointer;transition:background-color var(--gcw-transition-fast);text-align:left;white-space:nowrap}.gcw-header-menu__item:hover{background-color:var(--gcw-color-gray-100)}.gcw-header-menu__item--danger{color:var(--gcw-color-error)}.gcw-header-menu__item--danger:hover{background-color:#fef2f2}.gcw-header-menu__icon{width:1rem;height:1rem;flex-shrink:0}.gcw-header-menu__divider{height:1px;background-color:var(--gcw-color-gray-200);margin:var(--gcw-spacing-1) 0}@keyframes gcw-menu-appear{0%{opacity:0;transform:translateY(-.25rem)}to{opacity:1;transform:translateY(0)}}.gcw-messages{flex:1;overflow-y:auto;padding:var(--gcw-spacing-4);display:flex;flex-direction:column;gap:var(--gcw-spacing-4)}.gcw-messages::-webkit-scrollbar{width:6px}.gcw-messages::-webkit-scrollbar-track{background:transparent}.gcw-messages::-webkit-scrollbar-thumb{background-color:var(--gcw-color-gray-300);border-radius:3px}.gcw-messages::-webkit-scrollbar-thumb:hover{background-color:var(--gcw-color-gray-400)}.gcw-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--gcw-spacing-6);color:var(--gcw-color-gray-400);text-align:center}.gcw-empty__icon{width:4rem;height:4rem;margin-bottom:var(--gcw-spacing-4);opacity:.5}.gcw-empty__text{font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.5;margin:0}.gcw-session-loading{display:flex;flex-direction:column;align-items:center;gap:var(--gcw-spacing-3)}.gcw-session-loading__spinner{width:2rem;height:2rem;border:3px solid var(--gcw-color-gray-200);border-top-color:var(--gcw-color-primary);border-radius:50%;animation:gcw-spin .8s linear infinite}.gcw-bubble-row{display:flex}.gcw-bubble-row--user{justify-content:flex-end}.gcw-bubble-row--assistant{justify-content:flex-start}.gcw-bubble-wrapper{max-width:85%;display:flex;flex-direction:column}.gcw-bubble-wrapper--user{align-items:flex-end}.gcw-bubble-wrapper--assistant{align-items:flex-start}.gcw-bubble{padding:var(--gcw-spacing-2) var(--gcw-spacing-4);border-radius:var(--gcw-radius-2xl);font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.6;letter-spacing:normal;word-wrap:break-word}.gcw-bubble--user{color:var(--gcw-color-white);border-bottom-right-radius:var(--gcw-radius-sm)}.gcw-bubble--assistant{background-color:var(--gcw-color-gray-100);color:var(--gcw-color-gray-800);border-bottom-left-radius:var(--gcw-radius-sm)}.gcw-bubble__timestamp{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400);margin-top:var(--gcw-spacing-1);padding:0 var(--gcw-spacing-1)}.gcw-content p{margin-bottom:var(--gcw-spacing-2)}.gcw-content p:last-child{margin-bottom:0}.gcw-content strong{font-weight:600}.gcw-content em{font-style:italic}.gcw-content ul,.gcw-content ol{margin:var(--gcw-spacing-2) 0;padding-left:var(--gcw-spacing-6)}.gcw-content li{margin-bottom:var(--gcw-spacing-1)}.gcw-content code{background-color:#0000001a;padding:.125rem .375rem;border-radius:var(--gcw-radius-sm);font-size:.875em;font-family:SF Mono,Monaco,Consolas,monospace}.gcw-bubble--user .gcw-content code{background-color:#fff3}.gcw-content pre{background-color:var(--gcw-color-gray-800);color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3);border-radius:var(--gcw-radius-md);overflow-x:auto;margin:var(--gcw-spacing-2) 0}.gcw-content pre code{background-color:transparent;padding:0;font-size:var(--gcw-font-size-sm)}.gcw-content a{color:var(--gcw-color-primary);text-decoration:underline}.gcw-content a:hover{color:var(--gcw-color-primary-hover)}.gcw-bubble--user .gcw-content a{color:#ffffffe6}.gcw-md-heading{font-weight:600;margin-top:var(--gcw-spacing-3);margin-bottom:var(--gcw-spacing-1)}.gcw-md-heading--h2{font-size:var(--gcw-font-size-lg);font-weight:700}.gcw-md-heading--h3,.gcw-md-heading--h4{font-size:var(--gcw-font-size-base)}.gcw-md-heading--h5{font-size:var(--gcw-font-size-sm)}.gcw-md-paragraph{margin-bottom:var(--gcw-spacing-2)}.gcw-md-paragraph:last-child{margin-bottom:0}.gcw-md-list{margin:var(--gcw-spacing-2) 0;padding-left:var(--gcw-spacing-4)}.gcw-md-list--ul{list-style-type:disc}.gcw-md-list--ol{list-style-type:decimal}.gcw-md-list__item{font-size:var(--gcw-font-size-base);margin-bottom:var(--gcw-spacing-1)}.gcw-md-bold{font-weight:600}.gcw-md-italic{font-style:italic}.gcw-md-code{background-color:var(--gcw-color-gray-200);padding:.125rem var(--gcw-spacing-2);border-radius:var(--gcw-radius-sm);font-size:var(--gcw-font-size-sm);font-family:SF Mono,Monaco,Consolas,monospace}.gcw-bubble--user .gcw-md-code{background-color:#fff3}.gcw-md-code-block{background-color:var(--gcw-color-gray-800);color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3);border-radius:var(--gcw-radius-lg);font-size:var(--gcw-font-size-sm);overflow-x:auto;margin:var(--gcw-spacing-2) 0}.gcw-md-code-block code{font-family:SF Mono,Monaco,Consolas,monospace}.gcw-md-link{color:var(--gcw-color-primary);text-decoration:underline}.gcw-md-link:hover{color:var(--gcw-color-primary-hover)}.gcw-bubble--user .gcw-md-link{color:#ffffffe6}.gcw-sources{display:flex;flex-wrap:wrap;gap:var(--gcw-spacing-2);margin-top:var(--gcw-spacing-2)}.gcw-source{display:inline-flex;align-items:center;gap:var(--gcw-spacing-1);padding:var(--gcw-spacing-1) var(--gcw-spacing-2);border-radius:var(--gcw-radius-full);background-color:var(--gcw-color-primary-light);color:var(--gcw-color-primary);font-size:var(--gcw-font-size-sm);text-decoration:none;transition:background-color var(--gcw-transition-fast)}.gcw-source:hover{background-color:#dbeafe}.gcw-source__icon{width:.75rem;height:.75rem}.gcw-typing{display:flex;justify-content:flex-start}.gcw-typing__bubble{background-color:var(--gcw-color-gray-100);padding:var(--gcw-spacing-3) var(--gcw-spacing-4);border-radius:var(--gcw-radius-2xl);border-bottom-left-radius:var(--gcw-radius-sm)}.gcw-typing__dots{display:flex;gap:var(--gcw-spacing-1)}.gcw-typing__dot{width:.5rem;height:.5rem;background-color:var(--gcw-color-gray-400);border-radius:var(--gcw-radius-full);animation:gcw-typing-bounce 1.4s infinite ease-in-out both}.gcw-typing__dot:nth-child(1){animation-delay:-.32s}.gcw-typing__dot:nth-child(2){animation-delay:-.16s}.gcw-input-area{padding:var(--gcw-spacing-3);border-top:1px solid var(--gcw-color-gray-200);background-color:var(--gcw-color-white);flex-shrink:0}.gcw-input-row{display:flex;align-items:flex-end;gap:var(--gcw-spacing-2)}.gcw-input{flex:1;min-height:44px;max-height:120px;padding:var(--gcw-spacing-2) var(--gcw-spacing-4);border:1px solid var(--gcw-color-gray-200);border-radius:var(--gcw-radius-xl);background-color:var(--gcw-color-white);color:var(--gcw-color-gray-800);font-family:var(--gcw-font-family);font-size:var(--gcw-font-size-base);font-weight:400;line-height:1.5;letter-spacing:normal;resize:none;outline:none;transition:border-color var(--gcw-transition-fast),box-shadow var(--gcw-transition-fast)}.gcw-input:focus{border-color:var(--gcw-color-primary);box-shadow:0 0 0 3px #3b82f61a}.gcw-input:disabled{background-color:var(--gcw-color-gray-50);cursor:not-allowed}.gcw-input::placeholder{color:var(--gcw-color-gray-400)}.gcw-send-btn{width:2.5rem;height:2.5rem;flex-shrink:0;border:none;border-radius:var(--gcw-radius-lg);color:var(--gcw-color-white);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:opacity var(--gcw-transition-fast),transform var(--gcw-transition-fast)}.gcw-send-btn:hover:not(:disabled){opacity:.9}.gcw-send-btn:active:not(:disabled){transform:scale(.95)}.gcw-send-btn:disabled{opacity:.5;cursor:not-allowed}.gcw-send-btn__icon{width:1.25rem;height:1.25rem}.gcw-input-hint{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400);text-align:center;margin-top:var(--gcw-spacing-2)}@keyframes gcw-slide-up{0%{opacity:0;transform:translateY(1rem)}to{opacity:1;transform:translateY(0)}}@keyframes gcw-pulse{0%,to{opacity:1}50%{opacity:.5}}@keyframes gcw-typing-bounce{0%,80%,to{transform:scale(0)}40%{transform:scale(1)}}@keyframes gcw-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.gcw-spin{animation:gcw-spin 1s linear infinite}.gcw-history{display:flex;flex-direction:column;flex:1;overflow:hidden;animation:gcw-slide-in-left var(--gcw-transition-base) ease-out}.gcw-history__header{display:flex;align-items:center;gap:var(--gcw-spacing-3);padding:var(--gcw-spacing-2) var(--gcw-spacing-3);color:var(--gcw-color-white);flex-shrink:0}.gcw-history__title{flex:1;font-size:var(--gcw-font-size-base);font-weight:600;margin:0}.gcw-history__list{flex:1;overflow-y:auto;padding:var(--gcw-spacing-2) 0}.gcw-history__list::-webkit-scrollbar{width:6px}.gcw-history__list::-webkit-scrollbar-track{background:transparent}.gcw-history__list::-webkit-scrollbar-thumb{background-color:var(--gcw-color-gray-300);border-radius:3px}.gcw-history__loading{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--gcw-spacing-3);padding:var(--gcw-spacing-8);color:var(--gcw-color-gray-400);font-size:var(--gcw-font-size-sm)}.gcw-history__empty{display:flex;align-items:center;justify-content:center;padding:var(--gcw-spacing-8);color:var(--gcw-color-gray-400);font-size:var(--gcw-font-size-sm)}.gcw-history__item{display:flex;align-items:center;justify-content:space-between;gap:var(--gcw-spacing-2);width:100%;padding:var(--gcw-spacing-3) var(--gcw-spacing-4);border:none;border-left:3px solid transparent;background:none;cursor:pointer;text-align:left;transition:background-color var(--gcw-transition-fast);font-family:var(--gcw-font-family)}.gcw-history__item:hover{background-color:var(--gcw-color-gray-50)}.gcw-history__item--active{background-color:var(--gcw-color-primary-light)}.gcw-history__item-content{display:flex;flex-direction:column;gap:.125rem;min-width:0;flex:1}.gcw-history__item-title{font-size:var(--gcw-font-size-sm);font-weight:500;color:var(--gcw-color-gray-800);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gcw-history__item-meta{font-size:var(--gcw-font-size-xs);color:var(--gcw-color-gray-400)}.gcw-history__item-delete{flex-shrink:0;width:1.75rem;height:1.75rem;border:none;border-radius:var(--gcw-radius-md);background:transparent;color:var(--gcw-color-gray-300);cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity var(--gcw-transition-fast),color var(--gcw-transition-fast),background-color var(--gcw-transition-fast)}.gcw-history__item:hover .gcw-history__item-delete{opacity:1}.gcw-history__item-delete:hover{color:var(--gcw-color-error);background-color:#ef44441a}.gcw-history__item-delete-icon{width:.875rem;height:.875rem}@keyframes gcw-slide-in-left{0%{opacity:0;transform:translate(-1rem)}to{opacity:1;transform:translate(0)}}.gcw-modal-overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:#0006;display:flex;align-items:center;justify-content:center;z-index:100;animation:gcw-fade-in .15s ease-out;border-radius:var(--gcw-radius-2xl)}.gcw-modal{background:#fff;border-radius:.75rem;padding:1.25rem;margin:1rem;max-width:20rem;width:100%;box-shadow:0 8px 24px #00000026;animation:gcw-scale-in .15s ease-out}.gcw-modal__title{font-size:.9375rem;font-weight:600;color:#1f2937;margin:0 0 .5rem}.gcw-modal__message{font-size:.8125rem;color:#6b7280;line-height:1.5;margin:0 0 1.25rem}.gcw-modal__actions{display:flex;gap:.5rem;justify-content:flex-end}.gcw-modal__btn{padding:.4375rem .875rem;border-radius:.375rem;font-size:.8125rem;font-weight:500;cursor:pointer;border:1px solid #e5e7eb;transition:background-color .15s,border-color .15s}.gcw-modal__btn--cancel{background:#fff;color:#374151}.gcw-modal__btn--cancel:hover{background:#f9fafb;border-color:#d1d5db}.gcw-modal__btn--confirm{background:#3b82f6;color:#fff;border-color:#3b82f6}.gcw-modal__btn--confirm:hover{background:#2563eb;border-color:#2563eb}.gcw-modal__btn--danger{background:#ef4444;border-color:#ef4444}.gcw-modal__btn--danger:hover{background:#dc2626;border-color:#dc2626}@keyframes gcw-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gcw-scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
+ import { jsxs as h, jsx as n, Fragment as ve } from "react/jsx-runtime";
3
+ import ye, { useState as v, useRef as H, useCallback as L, useEffect as M } from "react";
4
+ function ke({ authUrl: e, headers: s = {} }) {
5
+ const [t, a] = v(!e), [i, o] = v(!!e), [r, u] = v(null), [c, l] = v(null), m = H(s);
6
+ m.current = s;
7
+ const f = L(async (S) => {
8
+ if (!e) return !0;
9
+ try {
10
+ const p = await fetch(e, {
11
+ method: "GET",
12
+ headers: {
13
+ Accept: "application/json",
14
+ ...m.current
15
+ },
16
+ credentials: "include",
17
+ signal: S
18
+ });
19
+ if (p.ok) {
20
+ const g = await p.json(), y = {
21
+ id: g.Id ?? g.id ?? "",
22
+ email: g.Email ?? g.email ?? "",
23
+ fullName: g.FullName ?? g.fullName ?? "",
24
+ roles: Array.isArray(g.Roles ?? g.roles) ? (g.Roles ?? g.roles).map(
25
+ (d) => typeof d == "string" ? d : d.name ?? ""
26
+ ) : []
27
+ };
28
+ return u(y), a(!0), l(null), !0;
29
+ }
30
+ return u(null), a(!1), l(p.status === 401 ? "Niet ingelogd" : "Geen toegang"), !1;
31
+ } catch (p) {
32
+ return p instanceof DOMException && p.name === "AbortError" || (u(null), a(!1), l("Authenticatie verificatie mislukt")), !1;
33
+ }
34
+ }, [e]);
35
+ M(() => {
36
+ if (!e) return;
37
+ const S = new AbortController();
38
+ return (async () => {
39
+ o(!0), await f(S.signal), S.signal.aborted || o(!1);
40
+ })(), () => {
41
+ S.abort();
42
+ };
43
+ }, [e, f]);
44
+ const N = L(async () => f(), [f]);
45
+ return { isAuthenticated: t, isLoading: i, user: r, error: c, recheckAuth: N };
46
+ }
47
+ const _e = "gcw_session_", xe = "gcw_popout_", Ne = "gcw_read_";
48
+ function Q(e) {
49
+ return `${_e}${e || "default"}`;
7
50
  }
8
- function ve(e, s) {
51
+ function Se(e, s) {
9
52
  try {
10
- const n = q(s);
11
- e ? localStorage.setItem(n, e) : localStorage.removeItem(n);
12
- } catch (n) {
13
- console.warn("Failed to save session ID:", n);
53
+ const t = Q(s);
54
+ e ? localStorage.setItem(t, e) : localStorage.removeItem(t);
55
+ } catch (t) {
56
+ console.warn("Failed to save session ID:", t);
14
57
  }
15
58
  }
16
- function ye(e) {
59
+ function Me(e) {
17
60
  try {
18
- return localStorage.getItem(q(e));
61
+ return localStorage.getItem(Q(e));
19
62
  } catch {
20
63
  return null;
21
64
  }
22
65
  }
23
- function W(e) {
66
+ function O(e) {
24
67
  try {
25
- localStorage.removeItem(q(e)), localStorage.removeItem(Y(e));
68
+ localStorage.removeItem(Q(e)), localStorage.removeItem(Z(e));
26
69
  } catch (s) {
27
70
  console.warn("Failed to clear session:", s);
28
71
  }
29
72
  }
30
- function ke(e, s) {
31
- const n = q(e), a = (i) => {
32
- i.key === n && s(i.newValue);
73
+ function Ce(e, s) {
74
+ const t = Q(e), a = (i) => {
75
+ i.key === t && s(i.newValue);
33
76
  };
34
77
  return window.addEventListener("storage", a), () => window.removeEventListener("storage", a);
35
78
  }
36
- function ee(e) {
37
- return `${we}${e || "default"}`;
79
+ function ne(e) {
80
+ return `${xe}${e || "default"}`;
38
81
  }
39
- function G(e, s) {
82
+ function J(e, s) {
40
83
  try {
41
- e ? localStorage.setItem(ee(s), "true") : localStorage.removeItem(ee(s));
42
- } catch (n) {
43
- console.warn("Failed to save popout state:", n);
84
+ e ? localStorage.setItem(ne(s), "true") : localStorage.removeItem(ne(s));
85
+ } catch (t) {
86
+ console.warn("Failed to save popout state:", t);
44
87
  }
45
88
  }
46
- function _e(e) {
89
+ function Ie(e) {
47
90
  try {
48
- return localStorage.getItem(ee(e)) === "true";
91
+ return localStorage.getItem(ne(e)) === "true";
49
92
  } catch {
50
93
  return !1;
51
94
  }
52
95
  }
53
- function Y(e) {
54
- return `${be}${e || "default"}`;
96
+ function Z(e) {
97
+ return `${Ne}${e || "default"}`;
55
98
  }
56
- function X(e, s) {
99
+ function Y(e, s) {
57
100
  try {
58
- e > 0 ? localStorage.setItem(Y(s), String(e)) : localStorage.removeItem(Y(s));
59
- } catch (n) {
60
- console.warn("Failed to save read state:", n);
101
+ e > 0 ? localStorage.setItem(Z(s), String(e)) : localStorage.removeItem(Z(s));
102
+ } catch (t) {
103
+ console.warn("Failed to save read state:", t);
61
104
  }
62
105
  }
63
- function Me(e) {
106
+ function Le(e) {
64
107
  try {
65
- const s = localStorage.getItem(Y(e));
108
+ const s = localStorage.getItem(Z(e));
66
109
  return s && parseInt(s, 10) || 0;
67
110
  } catch {
68
111
  return 0;
69
112
  }
70
113
  }
71
- function xe(e) {
72
- const { apiUrl: s, tenantId: n, sessionId: a, headers: i = {}, onError: o, persist: r = !0 } = e, [h, c] = x([]), [l, m] = x(!1), [f, N] = x(!1), [j, w] = x(null), [g, v] = x(() => a || (r ? ye(n) : null)), u = H(null), y = H(!1), S = $(() => s.replace(/\/chat\/?$/, ""), [s]), L = $(async (p) => {
114
+ function Ee(e) {
115
+ const { apiUrl: s, tenantId: t, sessionId: a, headers: i = {}, onError: o, persist: r = !0 } = e, [u, c] = v([]), [l, m] = v(!1), [f, N] = v(!1), [S, p] = v(null), [g, y] = v(() => a || (r ? Me(t) : null)), d = H(null), k = H(!1), w = L(() => s.replace(/\/chat\/?$/, ""), [s]), z = L(async (b) => {
73
116
  N(!0);
74
117
  try {
75
- const k = S(), E = await fetch(`${k}/sessions/${p}`, {
118
+ const _ = w(), T = await fetch(`${_}/sessions/${b}`, {
76
119
  method: "GET",
77
120
  headers: {
78
121
  "Content-Type": "application/json",
79
- ...n && { "X-Tenant-ID": n },
122
+ ...t && { "X-Tenant-ID": t },
80
123
  ...i
81
124
  }
82
125
  });
83
- if (E.status === 500)
126
+ if (T.status === 500)
84
127
  return console.error("Server error while loading session, will retry later"), !1;
85
- if (E.status === 401)
86
- return console.info("Unauthorized while loading session, clearing session"), r && W(n), v(null), !1;
87
- if (E.status === 404)
88
- return console.info("Session not found, starting fresh"), r && W(n), v(null), !1;
89
- if (E.status === 429)
128
+ if (T.status === 401)
129
+ return console.info("Unauthorized while loading session, clearing session"), r && O(t), y(null), !1;
130
+ if (T.status === 404)
131
+ return console.info("Session not found, starting fresh"), r && O(t), y(null), !1;
132
+ if (T.status === 429)
90
133
  return console.info("Rate limited while loading session, will retry later"), !1;
91
- if (!E.ok)
92
- throw new Error(`Failed to load session: ${E.status}`);
93
- const I = (await E.json()).messages.map((B) => {
94
- var z;
134
+ if (!T.ok)
135
+ throw new Error(`Failed to load session: ${T.status}`);
136
+ const $ = (await T.json()).messages.map((A) => {
137
+ var R;
95
138
  return {
96
- id: B.id,
97
- role: B.role,
98
- content: B.content,
99
- timestamp: new Date(B.timestamp),
100
- sources: (z = B.citations) == null ? void 0 : z.map((M) => ({
101
- title: M.title,
102
- url: M.url,
103
- relevance: M.relevance_score
139
+ id: A.id,
140
+ role: A.role,
141
+ content: A.content,
142
+ timestamp: new Date(A.timestamp),
143
+ sources: (R = A.citations) == null ? void 0 : R.map((I) => ({
144
+ title: I.title,
145
+ url: I.url,
146
+ relevance: I.relevance_score
104
147
  }))
105
148
  };
106
149
  });
107
- return c(I), v(p), !0;
108
- } catch (k) {
109
- return console.error("Failed to load session:", k), r && W(n), v(null), !1;
150
+ return c($), y(b), !0;
151
+ } catch (_) {
152
+ return console.error("Failed to load session:", _), r && O(t), y(null), !1;
110
153
  } finally {
111
154
  N(!1);
112
155
  }
113
- }, [S, n, i, r]);
114
- C(() => {
115
- y.current || (y.current = !0, g && L(g));
116
- }, []), C(() => {
117
- r && ve(g, n);
118
- }, [g, n, r]), C(() => r ? ke(n, (k) => {
119
- k && k !== g ? L(k) : k || (c([]), v(null));
120
- }) : void 0, [n, r, g, L]);
121
- const b = $(async (p) => {
122
- var E;
123
- if (!p.trim() || l) return;
124
- u.current && u.current.abort(), u.current = new AbortController();
125
- const k = {
156
+ }, [w, t, i, r]);
157
+ M(() => {
158
+ k.current || (k.current = !0, g && z(g));
159
+ }, []), M(() => {
160
+ r && Se(g, t);
161
+ }, [g, t, r]), M(() => r ? Ce(t, (_) => {
162
+ _ && _ !== g ? z(_) : _ || (c([]), y(null));
163
+ }) : void 0, [t, r, g, z]);
164
+ const W = L(async (b) => {
165
+ var T;
166
+ if (!b.trim() || l) return;
167
+ d.current && d.current.abort(), d.current = new AbortController();
168
+ const _ = {
126
169
  id: `temp_${Date.now()}`,
127
170
  role: "user",
128
- content: p.trim(),
171
+ content: b.trim(),
129
172
  timestamp: /* @__PURE__ */ new Date()
130
173
  };
131
- c((_) => [..._, k]), m(!0), w(null);
174
+ c((C) => [...C, _]), m(!0), p(null);
132
175
  try {
133
- const _ = await fetch(s, {
176
+ const C = await fetch(s, {
134
177
  method: "POST",
135
178
  headers: {
136
179
  "Content-Type": "application/json",
137
- ...n && { "X-Tenant-ID": n },
180
+ ...t && { "X-Tenant-ID": t },
138
181
  ...i
139
182
  },
140
183
  body: JSON.stringify({
141
- message: p.trim(),
184
+ message: b.trim(),
142
185
  session_id: g
143
186
  }),
144
- signal: u.current.signal
187
+ signal: d.current.signal
145
188
  });
146
- if (!_.ok) {
147
- if (_.status === 500) {
148
- console.error("Server error while sending message");
149
- const O = {
189
+ if (!C.ok) {
190
+ if (C.status === 500) {
191
+ const j = {
150
192
  id: `temp_${Date.now()}_servererror`,
151
193
  role: "assistant",
152
194
  content: "Er is een fout opgetreden bij het verwerken van je bericht. Probeer het later opnieuw.",
153
195
  timestamp: /* @__PURE__ */ new Date()
154
196
  };
155
- c((V) => [...V, O]);
197
+ c((P) => [...P, j]);
156
198
  return;
157
199
  }
158
- if (_.status === 401) {
159
- const O = {
200
+ if (C.status === 401) {
201
+ const j = {
160
202
  id: `temp_${Date.now()}_unauthorized`,
161
203
  role: "assistant",
162
204
  content: "Je sessie is verlopen of je hebt geen toegang. Vernieuw de pagina om opnieuw te verbinden.",
163
205
  timestamp: /* @__PURE__ */ new Date()
164
206
  };
165
- c((V) => [...V, O]), r && W(n), v(null);
207
+ c((P) => [...P, j]), r && O(t), y(null);
166
208
  return;
167
209
  }
168
- if (_.status === 429) {
169
- const O = {
210
+ if (C.status === 429) {
211
+ const j = {
170
212
  id: `temp_${Date.now()}_ratelimit`,
171
213
  role: "assistant",
172
214
  content: "Je stuurt te veel berichten achter elkaar. Wacht even en probeer het dan opnieuw.",
173
215
  timestamp: /* @__PURE__ */ new Date()
174
216
  };
175
- c((V) => [...V, O]);
217
+ c((P) => [...P, j]);
176
218
  return;
177
219
  }
178
- const M = await _.json().catch(() => ({}));
179
- throw new Error(M.detail || `Request failed with status ${_.status}`);
220
+ const I = await C.json().catch(() => ({}));
221
+ throw new Error(I.detail || `Request failed with status ${C.status}`);
180
222
  }
181
- const I = await _.json(), B = (E = I.message.citations) == null ? void 0 : E.map((M) => ({
182
- title: M.title,
183
- url: M.url,
184
- relevance: M.relevance_score
185
- })), z = {
223
+ const $ = await C.json(), A = (T = $.message.citations) == null ? void 0 : T.map((I) => ({
224
+ title: I.title,
225
+ url: I.url,
226
+ relevance: I.relevance_score
227
+ })), R = {
186
228
  id: `temp_${Date.now()}_assistant`,
187
229
  role: "assistant",
188
- content: I.message.content,
230
+ content: $.message.content,
189
231
  timestamp: /* @__PURE__ */ new Date(),
190
- sources: B
232
+ sources: A
191
233
  };
192
- c((M) => [...M, z]), I.session_id && v(I.session_id);
193
- } catch (_) {
194
- if (_.name === "AbortError")
234
+ c((I) => [...I, R]), $.session_id && y($.session_id);
235
+ } catch (C) {
236
+ if (C.name === "AbortError")
195
237
  return;
196
- const I = _ instanceof Error ? _ : new Error("An error occurred");
197
- w(I), o == null || o(I);
238
+ const $ = C instanceof Error ? C : new Error("An error occurred");
239
+ p($), o == null || o($);
198
240
  } finally {
199
- m(!1), u.current = null;
241
+ m(!1), d.current = null;
200
242
  }
201
- }, [s, n, g, i, l, o]), F = $(() => {
202
- c([]), v(null), w(null), y.current = !1, r && W(n);
203
- }, [r, n]), P = $(async () => {
243
+ }, [s, t, g, i, l, o]), U = L(() => {
244
+ c([]), y(null), p(null), k.current = !1, r && O(t);
245
+ }, [r, t]), F = L(async () => {
204
246
  if (g)
205
247
  try {
206
- const p = S();
207
- await fetch(`${p}/sessions/${g}`, {
248
+ const b = w();
249
+ await fetch(`${b}/sessions/${g}`, {
208
250
  method: "DELETE",
209
251
  headers: {
210
252
  "Content-Type": "application/json",
211
- ...n && { "X-Tenant-ID": n },
253
+ ...t && { "X-Tenant-ID": t },
212
254
  ...i
213
255
  }
214
256
  });
215
- } catch (p) {
216
- console.error("Failed to delete session:", p);
257
+ } catch (b) {
258
+ console.error("Failed to delete session:", b);
217
259
  }
218
- c([]), v(null), w(null), y.current = !1, r && W(n);
219
- }, [g, S, n, i, r]), R = $(async (p) => {
260
+ c([]), y(null), p(null), k.current = !1, r && O(t);
261
+ }, [g, w, t, i, r]), B = L(async (b) => {
220
262
  try {
221
- const k = S();
222
- await fetch(`${k}/sessions/${p}`, {
263
+ const _ = w();
264
+ await fetch(`${_}/sessions/${b}`, {
223
265
  method: "DELETE",
224
266
  headers: {
225
267
  "Content-Type": "application/json",
226
- ...n && { "X-Tenant-ID": n },
268
+ ...t && { "X-Tenant-ID": t },
227
269
  ...i
228
270
  }
229
271
  });
230
- } catch (k) {
231
- console.error("Failed to delete session:", k);
232
- }
233
- p === g && (c([]), v(null), w(null), y.current = !1, r && W(n));
234
- }, [S, n, i, g, r]), U = $(() => {
235
- c([]), v(null), w(null), y.current = !1, r && W(n);
236
- }, [r, n]), Z = $(async (p) => {
237
- await L(p);
238
- }, [L]), Q = $(async () => {
272
+ } catch (_) {
273
+ console.error("Failed to delete session:", _);
274
+ }
275
+ b === g && (c([]), y(null), p(null), k.current = !1, r && O(t));
276
+ }, [w, t, i, g, r]), x = L(() => {
277
+ c([]), y(null), p(null), k.current = !1, r && O(t);
278
+ }, [r, t]), ee = L(async (b) => {
279
+ await z(b);
280
+ }, [z]), te = L(async () => {
239
281
  try {
240
- const p = S(), k = await fetch(`${p}/sessions`, {
282
+ const b = w(), _ = await fetch(`${b}/sessions`, {
241
283
  method: "GET",
242
284
  headers: {
243
285
  "Content-Type": "application/json",
244
- ...n && { "X-Tenant-ID": n },
286
+ ...t && { "X-Tenant-ID": t },
245
287
  ...i
246
288
  }
247
289
  });
248
- return k.ok ? await k.json() : (console.error("Failed to list sessions:", k.status), []);
249
- } catch (p) {
250
- return console.error("Failed to list sessions:", p), [];
290
+ return _.ok ? await _.json() : (console.error("Failed to list sessions:", _.status), []);
291
+ } catch (b) {
292
+ return console.error("Failed to list sessions:", b), [];
251
293
  }
252
- }, [S, n, i]);
294
+ }, [w, t, i]);
253
295
  return {
254
- messages: h,
296
+ messages: u,
255
297
  isLoading: l,
256
298
  isLoadingSession: f,
257
- error: j,
258
- sendMessage: b,
259
- clearMessages: F,
260
- deleteSession: P,
261
- deleteSessionById: R,
262
- startNewSession: U,
263
- switchSession: Z,
264
- listSessions: Q,
299
+ error: S,
300
+ sendMessage: W,
301
+ clearMessages: U,
302
+ deleteSession: F,
303
+ deleteSessionById: B,
304
+ startNewSession: x,
305
+ switchSession: ee,
306
+ listSessions: te,
265
307
  sessionId: g
266
308
  };
267
309
  }
268
- let K = null;
269
- function Ne(e, s, n) {
270
- const [a, i] = x(() => _e(e.tenantId)), o = H(K);
271
- C(() => {
310
+ let X = null;
311
+ function Te(e, s, t) {
312
+ const [a, i] = v(() => Ie(e.tenantId)), o = H(X);
313
+ M(() => {
272
314
  if (a && !o.current) {
273
315
  const l = window.open("", "GeoAppsChatPopout");
274
- l && l.location.href !== "about:blank" && !l.closed ? (o.current = l, K = l) : (i(!1), G(!1, e.tenantId));
316
+ l && l.location.href !== "about:blank" && !l.closed ? (o.current = l, X = l) : (i(!1), J(!1, e.tenantId));
275
317
  }
276
- }, [a, e.tenantId]), C(() => {
318
+ }, [a, e.tenantId]), M(() => {
277
319
  if (!o.current) return;
278
320
  const l = setInterval(() => {
279
321
  var m;
280
- (m = o.current) != null && m.closed && (i(!1), o.current = null, K = null, G(!1, e.tenantId), n == null || n());
322
+ (m = o.current) != null && m.closed && (i(!1), o.current = null, X = null, J(!1, e.tenantId), t == null || t());
281
323
  }, 500);
282
324
  return () => clearInterval(l);
283
- }, [e.tenantId, n]);
284
- const r = $(() => {
325
+ }, [e.tenantId, t]);
326
+ const r = L(() => {
285
327
  if (o.current && !o.current.closed) {
286
328
  o.current.focus();
287
329
  return;
@@ -291,240 +333,253 @@ function Ne(e, s, n) {
291
333
  medium: { width: 440, height: 660 },
292
334
  large: { width: 560, height: 780 },
293
335
  fullscreen: { width: 700, height: 800 }
294
- }, { width: m, height: f } = l[s], N = (window.screen.width - m) / 2, j = (window.screen.height - f) / 2, w = window.open(
336
+ }, { width: m, height: f } = l[s], N = (window.screen.width - m) / 2, S = (window.screen.height - f) / 2, p = window.open(
295
337
  "",
296
338
  "GeoAppsChatPopout",
297
- `width=${m},height=${f},left=${N},top=${j},resizable=yes,scrollbars=no`
339
+ `width=${m},height=${f},left=${N},top=${S},resizable=yes,scrollbars=no`
298
340
  );
299
- if (!w) {
341
+ if (!p) {
300
342
  console.error("Failed to open popup window. Check if popups are blocked.");
301
343
  return;
302
344
  }
303
- w.__CHAT_CONFIG__ = e, w.document.write(Ae(e)), w.document.close(), o.current = w, K = w, i(!0), G(!0, e.tenantId);
304
- }, [e, s]), h = $(() => {
305
- o.current && !o.current.closed && o.current.close(), o.current = null, K = null, i(!1), G(!1, e.tenantId);
306
- }, [e.tenantId]), c = $(() => {
345
+ p.__CHAT_CONFIG__ = e, p.document.write(Xe(e)), p.document.close(), o.current = p, X = p, i(!0), J(!0, e.tenantId);
346
+ }, [e, s]), u = L(() => {
347
+ o.current && !o.current.closed && o.current.close(), o.current = null, X = null, i(!1), J(!1, e.tenantId);
348
+ }, [e.tenantId]), c = L(() => {
307
349
  o.current && !o.current.closed && o.current.focus();
308
350
  }, []);
309
351
  return {
310
352
  isPoppedOut: a,
311
353
  openPopout: r,
312
- closePopout: h,
354
+ closePopout: u,
313
355
  focusPopout: c
314
356
  };
315
357
  }
316
- const Se = ["bottom-right", "bottom-left", "top-right", "top-left"];
317
- function Ce(e) {
318
- return typeof e == "string" && Se.includes(e);
358
+ const $e = ["bottom-right", "bottom-left", "top-right", "top-left"];
359
+ function je(e) {
360
+ return typeof e == "string" && $e.includes(e);
319
361
  }
320
- function Ie(e) {
321
- if (Ce(e))
362
+ function De(e) {
363
+ if (je(e))
322
364
  return { className: `gcw-container--${e}`, style: {} };
323
- const s = e, n = {}, a = ["gcw-container--custom"];
324
- return s.top != null && (n.top = s.top), s.bottom != null && (n.bottom = s.bottom), s.left != null && (n.left = s.left), s.right != null && (n.right = s.right), s.top != null && s.bottom == null && a.push("gcw-container--flow-down"), s.left != null && s.right == null && a.push("gcw-container--align-left"), { className: a.join(" "), style: n };
365
+ const s = e, t = {}, a = ["gcw-container--custom"];
366
+ return s.top != null && (t.top = s.top), s.bottom != null && (t.bottom = s.bottom), s.left != null && (t.left = s.left), s.right != null && (t.right = s.right), s.top != null && s.bottom == null && a.push("gcw-container--flow-down"), s.left != null && s.right == null && a.push("gcw-container--align-left"), { className: a.join(" "), style: t };
325
367
  }
326
- function et({
368
+ function it({
327
369
  apiUrl: e,
328
- tenantId: s,
329
- title: n = "Chat Assistent",
330
- subtitle: a = "Hoe kan ik je helpen?",
331
- placeholder: i = "Typ een bericht...",
332
- greeting: o,
333
- primaryColor: r = "#3b82f6",
334
- position: h = "bottom-right",
335
- defaultOpen: c = !1,
336
- defaultSize: l = "medium",
337
- headers: m,
338
- onOpen: f,
339
- onClose: N,
340
- onMessageSent: j,
341
- onResponseReceived: w
370
+ authUrl: s,
371
+ tenantId: t,
372
+ title: a = "Chat Assistent",
373
+ subtitle: i = "Hoe kan ik je helpen?",
374
+ placeholder: o = "Typ een bericht...",
375
+ greeting: r,
376
+ primaryColor: u = "#3b82f6",
377
+ position: c = "bottom-right",
378
+ defaultOpen: l = !1,
379
+ defaultSize: m = "medium",
380
+ headers: f,
381
+ onOpen: N,
382
+ onClose: S,
383
+ onMessageSent: p,
384
+ onResponseReceived: g
342
385
  }) {
343
- const [g, v] = x(c), [u, y] = x(l), [S, L] = x(!1), { messages: b, isLoading: F, isLoadingSession: P, sendMessage: R, deleteSession: U, deleteSessionById: Z, startNewSession: Q, switchSession: p, listSessions: k, sessionId: E } = xe({
386
+ const { isAuthenticated: y, isLoading: d, recheckAuth: k } = ke({ authUrl: s, headers: f }), [w, z] = v(l), [W, U] = v(m), [F, B] = v(!1), { messages: x, isLoading: ee, isLoadingSession: te, sendMessage: b, deleteSession: _, deleteSessionById: T, startNewSession: C, switchSession: $, listSessions: A, sessionId: R } = Ee({
344
387
  apiUrl: e,
345
- tenantId: s,
346
- headers: m
347
- }), [_, I] = x(() => b.length > 0), [B, z] = x([]);
348
- C(() => {
349
- g && o && !_ && b.length === 0 && I(!0);
350
- }, [g, o, _, b.length]), C(() => {
351
- b.length > 0 && I(!0);
352
- }, [b.length]), C(() => {
353
- _ && o && b.length === 0 ? z([
388
+ tenantId: t,
389
+ headers: f
390
+ }), [I, j] = v(() => x.length > 0), [P, K] = v([]);
391
+ M(() => {
392
+ w && r && !I && x.length === 0 && j(!0);
393
+ }, [w, r, I, x.length]), M(() => {
394
+ x.length > 0 && j(!0);
395
+ }, [x.length]), M(() => {
396
+ I && r && x.length === 0 ? K([
354
397
  {
355
398
  id: "greeting",
356
399
  role: "assistant",
357
- content: o,
400
+ content: r,
358
401
  timestamp: /* @__PURE__ */ new Date()
359
402
  }
360
- ]) : o && b.length > 0 ? z([
403
+ ]) : r && x.length > 0 ? K([
361
404
  {
362
405
  id: "greeting",
363
406
  role: "assistant",
364
- content: o,
407
+ content: r,
365
408
  timestamp: /* @__PURE__ */ new Date()
366
409
  },
367
- ...b
368
- ]) : z(b);
369
- }, [b, _, o]);
370
- const { isPoppedOut: M, openPopout: O, focusPopout: V } = Ne(
410
+ ...x
411
+ ]) : K(x);
412
+ }, [x, I, r]);
413
+ const { isPoppedOut: V, openPopout: le, focusPopout: ce } = Te(
371
414
  {
372
415
  apiUrl: e,
373
- tenantId: s,
374
- title: n,
375
- subtitle: a,
376
- placeholder: i,
377
- primaryColor: r,
378
- sessionId: E,
379
- messages: B,
380
- headers: m
416
+ tenantId: t,
417
+ title: a,
418
+ subtitle: i,
419
+ placeholder: o,
420
+ primaryColor: u,
421
+ sessionId: R,
422
+ messages: P,
423
+ headers: f
381
424
  },
382
- u,
425
+ W,
383
426
  () => {
384
427
  }
385
428
  );
386
- C(() => {
387
- const T = b.filter((D) => D.role === "assistant").length;
388
- if (T === 0) {
389
- L(!1);
429
+ M(() => {
430
+ const E = x.filter((D) => D.role === "assistant").length;
431
+ if (E === 0) {
432
+ B(!1);
390
433
  return;
391
434
  }
392
- if (g || M)
393
- X(T, s), L(!1);
435
+ if (w || V)
436
+ Y(E, t), B(!1);
394
437
  else {
395
- const D = Me(s);
396
- L(T > D);
438
+ const D = Le(t);
439
+ B(E > D);
397
440
  }
398
- }, [g, M, b, s]);
399
- const te = () => {
400
- if (M) {
401
- V();
441
+ }, [w, V, x, t]);
442
+ const se = () => {
443
+ if (V) {
444
+ ce();
402
445
  return;
403
446
  }
404
- const T = !g;
405
- if (v(T), T) {
406
- f == null || f();
407
- const D = b.filter((he) => he.role === "assistant").length;
408
- D > 0 && X(D, s), L(!1);
409
- } else
447
+ const E = !w;
448
+ if (z(E), E) {
410
449
  N == null || N();
411
- }, oe = async (T) => {
412
- j == null || j(T), await R(T);
413
- const D = b[b.length - 1];
414
- (D == null ? void 0 : D.role) === "assistant" && (w == null || w(D.content));
415
- }, ie = async () => {
416
- await U(), I(!1), z([]), L(!1), X(0, s);
417
- }, ae = () => {
418
- Q(), I(!1), z([]), L(!1), X(0, s);
419
- }, le = async (T) => {
420
- await p(T), I(!0);
421
- }, ce = (T) => {
422
- y(T);
423
- }, de = () => {
424
- v(!1), O();
425
- }, { className: ue, style: me } = Ie(h);
426
- return /* @__PURE__ */ d("div", { className: `gcw-widget gcw-container ${ue}`, style: me, children: [
427
- /* @__PURE__ */ t(
428
- We,
450
+ const D = x.filter((re) => re.role === "assistant").length;
451
+ D > 0 && Y(D, t), B(!1);
452
+ } else
453
+ S == null || S();
454
+ }, de = async (E) => {
455
+ if (s && !await k()) {
456
+ K((be) => [
457
+ ...be,
458
+ {
459
+ id: `auth-error-${Date.now()}`,
460
+ role: "assistant",
461
+ content: "Je sessie is verlopen of je hebt geen toegang. Vernieuw de pagina om opnieuw te verbinden.",
462
+ timestamp: /* @__PURE__ */ new Date()
463
+ }
464
+ ]);
465
+ return;
466
+ }
467
+ p == null || p(E), await b(E);
468
+ const D = x[x.length - 1];
469
+ (D == null ? void 0 : D.role) === "assistant" && (g == null || g(D.content));
470
+ }, ue = async () => {
471
+ await _(), j(!1), K([]), B(!1), Y(0, t);
472
+ }, me = () => {
473
+ C(), j(!1), K([]), B(!1), Y(0, t);
474
+ }, he = async (E) => {
475
+ await $(E), j(!0);
476
+ }, ge = (E) => {
477
+ U(E);
478
+ }, pe = () => {
479
+ z(!1), le();
480
+ }, { className: fe, style: we } = De(c);
481
+ return d || !y ? null : /* @__PURE__ */ h("div", { className: `gcw-widget gcw-container ${fe}`, style: we, children: [
482
+ /* @__PURE__ */ n(
483
+ Re,
429
484
  {
430
- isOpen: g,
431
- onClick: te,
432
- primaryColor: r,
433
- hasUnread: S && !g && !M,
434
- isPoppedOut: M
485
+ isOpen: w,
486
+ onClick: se,
487
+ primaryColor: u,
488
+ hasUnread: F && !w && !V,
489
+ isPoppedOut: V
435
490
  }
436
491
  ),
437
- g && !M && /* @__PURE__ */ t(
438
- Ee,
492
+ w && !V && /* @__PURE__ */ n(
493
+ Be,
439
494
  {
440
- title: n,
441
- subtitle: a,
442
- placeholder: i,
443
- messages: B,
444
- isLoading: F,
445
- isLoadingSession: P,
446
- onSendMessage: oe,
447
- onClose: te,
448
- onClear: ie,
449
- onSizeChange: ce,
450
- onPopout: de,
451
- onNewSession: ae,
452
- onSelectSession: le,
453
- onListSessions: k,
454
- onDeleteSession: Z,
455
- currentSessionId: E,
456
- primaryColor: r,
457
- size: u
495
+ title: a,
496
+ subtitle: i,
497
+ placeholder: o,
498
+ messages: P,
499
+ isLoading: ee,
500
+ isLoadingSession: te,
501
+ onSendMessage: de,
502
+ onClose: se,
503
+ onClear: ue,
504
+ onSizeChange: ge,
505
+ onPopout: pe,
506
+ onNewSession: me,
507
+ onSelectSession: he,
508
+ onListSessions: A,
509
+ onDeleteSession: T,
510
+ currentSessionId: R,
511
+ primaryColor: u,
512
+ size: W
458
513
  }
459
514
  )
460
515
  ] });
461
516
  }
462
- const Le = {
517
+ const ze = {
463
518
  small: "gcw-window--small",
464
519
  medium: "gcw-window--medium",
465
520
  large: "gcw-window--large",
466
521
  fullscreen: "gcw-window--fullscreen"
467
522
  };
468
- function Ee({
523
+ function Be({
469
524
  title: e,
470
525
  subtitle: s,
471
- placeholder: n,
526
+ placeholder: t,
472
527
  messages: a,
473
528
  isLoading: i,
474
529
  isLoadingSession: o = !1,
475
530
  onSendMessage: r,
476
- onClose: h,
531
+ onClose: u,
477
532
  onClear: c,
478
533
  onSizeChange: l,
479
534
  onPopout: m,
480
535
  onNewSession: f,
481
536
  onSelectSession: N,
482
- onListSessions: j,
483
- onDeleteSession: w,
537
+ onListSessions: S,
538
+ onDeleteSession: p,
484
539
  currentSessionId: g,
485
- primaryColor: v,
486
- size: u
540
+ primaryColor: y,
541
+ size: d
487
542
  }) {
488
- const [y, S] = x(!1), [L, b] = x(!1), F = () => {
489
- const P = ["small", "medium", "large", "fullscreen"], U = (P.indexOf(u) + 1) % P.length;
490
- l(P[U]);
543
+ const [k, w] = v(!1), [z, W] = v(!1), U = () => {
544
+ const F = ["small", "medium", "large", "fullscreen"], x = (F.indexOf(d) + 1) % F.length;
545
+ l(F[x]);
491
546
  };
492
- return /* @__PURE__ */ d("div", { className: `gcw-window ${Le[u]}`, children: [
493
- /* @__PURE__ */ d("div", { className: "gcw-header", style: { backgroundColor: v }, children: [
494
- /* @__PURE__ */ d("div", { className: "gcw-header__left", children: [
495
- /* @__PURE__ */ t("div", { className: "gcw-header__avatar", children: /* @__PURE__ */ t(Je, { className: "gcw-header__avatar-icon" }) }),
496
- /* @__PURE__ */ d("div", { className: "gcw-header__info", children: [
497
- /* @__PURE__ */ t("h3", { className: "gcw-header__title", children: e }),
498
- /* @__PURE__ */ t("p", { className: "gcw-header__subtitle", children: s })
547
+ return /* @__PURE__ */ h("div", { className: `gcw-window ${ze[d]}`, children: [
548
+ /* @__PURE__ */ h("div", { className: "gcw-header", style: { backgroundColor: y }, children: [
549
+ /* @__PURE__ */ h("div", { className: "gcw-header__left", children: [
550
+ /* @__PURE__ */ n("div", { className: "gcw-header__avatar", children: /* @__PURE__ */ n(tt, { className: "gcw-header__avatar-icon" }) }),
551
+ /* @__PURE__ */ h("div", { className: "gcw-header__info", children: [
552
+ /* @__PURE__ */ n("h3", { className: "gcw-header__title", children: e }),
553
+ /* @__PURE__ */ n("p", { className: "gcw-header__subtitle", children: s })
499
554
  ] })
500
555
  ] }),
501
- /* @__PURE__ */ d("div", { className: "gcw-header__actions", children: [
502
- /* @__PURE__ */ t(
503
- Ke,
556
+ /* @__PURE__ */ h("div", { className: "gcw-header__actions", children: [
557
+ /* @__PURE__ */ n(
558
+ qe,
504
559
  {
505
- size: u,
506
- onCycleSize: F,
560
+ size: d,
561
+ onCycleSize: U,
507
562
  onPopout: m,
508
- onClear: () => b(!0),
563
+ onClear: () => W(!0),
509
564
  onNewSession: () => {
510
- f(), S(!1);
565
+ f(), w(!1);
511
566
  },
512
- onShowHistory: () => S(!0)
567
+ onShowHistory: () => w(!0)
513
568
  }
514
569
  ),
515
- /* @__PURE__ */ t(
570
+ /* @__PURE__ */ n(
516
571
  "button",
517
572
  {
518
- onClick: h,
573
+ onClick: u,
519
574
  className: "gcw-header__btn",
520
575
  title: "Sluiten",
521
- children: /* @__PURE__ */ t(Xe, { className: "gcw-header__btn-icon" })
576
+ children: /* @__PURE__ */ n(et, { className: "gcw-header__btn-icon" })
522
577
  }
523
578
  )
524
579
  ] })
525
580
  ] }),
526
- L && /* @__PURE__ */ t(
527
- ne,
581
+ z && /* @__PURE__ */ n(
582
+ oe,
528
583
  {
529
584
  title: "Chat verwijderen",
530
585
  message: "Weet je zeker dat je dit gesprek wilt verwijderen? Dit kan niet ongedaan worden gemaakt.",
@@ -532,65 +587,65 @@ function Ee({
532
587
  cancelLabel: "Annuleren",
533
588
  variant: "danger",
534
589
  onConfirm: () => {
535
- b(!1), c();
590
+ W(!1), c();
536
591
  },
537
- onCancel: () => b(!1)
592
+ onCancel: () => W(!1)
538
593
  }
539
594
  ),
540
- y ? /* @__PURE__ */ t(
541
- Pe,
595
+ k ? /* @__PURE__ */ n(
596
+ Ke,
542
597
  {
543
598
  currentSessionId: g,
544
- onBack: () => S(!1),
599
+ onBack: () => w(!1),
545
600
  onSelectSession: N,
546
601
  onNewSession: f,
547
- onListSessions: j,
548
- onDeleteSession: w,
549
- primaryColor: v
602
+ onListSessions: S,
603
+ onDeleteSession: p,
604
+ primaryColor: y
550
605
  }
551
- ) : /* @__PURE__ */ d(ge, { children: [
552
- /* @__PURE__ */ t(
553
- Be,
606
+ ) : /* @__PURE__ */ h(ve, { children: [
607
+ /* @__PURE__ */ n(
608
+ Oe,
554
609
  {
555
610
  messages: a,
556
611
  isLoading: i,
557
612
  isLoadingSession: o,
558
- primaryColor: v
613
+ primaryColor: y
559
614
  }
560
615
  ),
561
- /* @__PURE__ */ t(
562
- ze,
616
+ /* @__PURE__ */ n(
617
+ Fe,
563
618
  {
564
- placeholder: n,
619
+ placeholder: t,
565
620
  isLoading: i,
566
621
  onSendMessage: r,
567
- primaryColor: v
622
+ primaryColor: y
568
623
  }
569
624
  )
570
625
  ] })
571
626
  ] });
572
627
  }
573
- function Te({ className: e }) {
574
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" }) });
628
+ function Ae({ className: e }) {
629
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" }) });
575
630
  }
576
- function je(e) {
631
+ function He(e) {
577
632
  return e.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
578
633
  }
579
- function $e(e, s) {
634
+ function We(e, s) {
580
635
  return e.length <= s ? e : e.slice(0, s - 3) + "...";
581
636
  }
582
- function De({ message: e, primaryColor: s }) {
583
- const n = e.role === "user", a = n ? "user" : "assistant";
584
- return /* @__PURE__ */ t("div", { className: `gcw-bubble-row gcw-bubble-row--${a}`, children: /* @__PURE__ */ d("div", { className: `gcw-bubble-wrapper gcw-bubble-wrapper--${a}`, children: [
585
- /* @__PURE__ */ t(
637
+ function Pe({ message: e, primaryColor: s }) {
638
+ const t = e.role === "user", a = t ? "user" : "assistant";
639
+ return /* @__PURE__ */ n("div", { className: `gcw-bubble-row gcw-bubble-row--${a}`, children: /* @__PURE__ */ h("div", { className: `gcw-bubble-wrapper gcw-bubble-wrapper--${a}`, children: [
640
+ /* @__PURE__ */ n(
586
641
  "div",
587
642
  {
588
643
  className: `gcw-bubble gcw-bubble--${a}`,
589
- style: n ? { backgroundColor: s } : void 0,
590
- children: /* @__PURE__ */ t(Oe, { content: e.content, className: "gcw-content" })
644
+ style: t ? { backgroundColor: s } : void 0,
645
+ children: /* @__PURE__ */ n(Ve, { content: e.content, className: "gcw-content" })
591
646
  }
592
647
  ),
593
- e.sources && e.sources.length > 0 && /* @__PURE__ */ t("div", { className: "gcw-sources", children: e.sources.slice(0, 3).map((i, o) => /* @__PURE__ */ d(
648
+ e.sources && e.sources.length > 0 && /* @__PURE__ */ n("div", { className: "gcw-sources", children: e.sources.slice(0, 3).map((i, o) => /* @__PURE__ */ h(
594
649
  "a",
595
650
  {
596
651
  href: i.url,
@@ -598,59 +653,59 @@ function De({ message: e, primaryColor: s }) {
598
653
  rel: "noopener noreferrer",
599
654
  className: "gcw-source",
600
655
  children: [
601
- /* @__PURE__ */ t(Te, { className: "gcw-source__icon" }),
602
- $e(i.title, 25)
656
+ /* @__PURE__ */ n(Ae, { className: "gcw-source__icon" }),
657
+ We(i.title, 25)
603
658
  ]
604
659
  },
605
660
  o
606
661
  )) }),
607
- /* @__PURE__ */ t("span", { className: "gcw-bubble__timestamp", children: je(e.timestamp) })
662
+ /* @__PURE__ */ n("span", { className: "gcw-bubble__timestamp", children: He(e.timestamp) })
608
663
  ] }) });
609
664
  }
610
- function Be({ messages: e, isLoading: s, isLoadingSession: n = !1, primaryColor: a }) {
665
+ function Oe({ messages: e, isLoading: s, isLoadingSession: t = !1, primaryColor: a }) {
611
666
  var o;
612
667
  const i = H(null);
613
- return C(() => {
668
+ return M(() => {
614
669
  var r;
615
670
  (r = i.current) == null || r.scrollIntoView({ behavior: "smooth" });
616
- }, [e, s]), n ? /* @__PURE__ */ t("div", { className: "gcw-empty", children: /* @__PURE__ */ d("div", { className: "gcw-session-loading", children: [
617
- /* @__PURE__ */ t("div", { className: "gcw-session-loading__spinner" }),
618
- /* @__PURE__ */ t("p", { className: "gcw-empty__text", children: "Chatgeschiedenis laden..." })
619
- ] }) }) : e.length === 0 && !s ? /* @__PURE__ */ d("div", { className: "gcw-empty", children: [
620
- /* @__PURE__ */ t("svg", { className: "gcw-empty__icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
621
- /* @__PURE__ */ t("p", { className: "gcw-empty__text", children: "Begin een gesprek door hieronder een bericht te typen" })
622
- ] }) : /* @__PURE__ */ d("div", { className: "gcw-messages", children: [
623
- e.map((r) => /* @__PURE__ */ t(
624
- De,
671
+ }, [e, s]), t ? /* @__PURE__ */ n("div", { className: "gcw-empty", children: /* @__PURE__ */ h("div", { className: "gcw-session-loading", children: [
672
+ /* @__PURE__ */ n("div", { className: "gcw-session-loading__spinner" }),
673
+ /* @__PURE__ */ n("p", { className: "gcw-empty__text", children: "Chatgeschiedenis laden..." })
674
+ ] }) }) : e.length === 0 && !s ? /* @__PURE__ */ h("div", { className: "gcw-empty", children: [
675
+ /* @__PURE__ */ n("svg", { className: "gcw-empty__icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
676
+ /* @__PURE__ */ n("p", { className: "gcw-empty__text", children: "Begin een gesprek door hieronder een bericht te typen" })
677
+ ] }) : /* @__PURE__ */ h("div", { className: "gcw-messages", children: [
678
+ e.map((r) => /* @__PURE__ */ n(
679
+ Pe,
625
680
  {
626
681
  message: r,
627
682
  primaryColor: a
628
683
  },
629
684
  r.id
630
685
  )),
631
- s && ((o = e[e.length - 1]) == null ? void 0 : o.role) !== "assistant" && /* @__PURE__ */ t(Fe, {}),
632
- /* @__PURE__ */ t("div", { ref: i })
686
+ s && ((o = e[e.length - 1]) == null ? void 0 : o.role) !== "assistant" && /* @__PURE__ */ n(Je, {}),
687
+ /* @__PURE__ */ n("div", { ref: i })
633
688
  ] });
634
689
  }
635
- function ze({ placeholder: e, isLoading: s, onSendMessage: n, primaryColor: a }) {
636
- const [i, o] = x(""), r = H(null);
637
- C(() => {
690
+ function Fe({ placeholder: e, isLoading: s, onSendMessage: t, primaryColor: a }) {
691
+ const [i, o] = v(""), r = H(null);
692
+ M(() => {
638
693
  const l = r.current;
639
694
  l && (l.style.height = "auto", l.style.height = `${Math.min(l.scrollHeight, 120)}px`);
640
695
  }, [i]);
641
- const h = () => {
642
- i.trim() && !s && (n(i), o(""), r.current && (r.current.style.height = "auto"));
696
+ const u = () => {
697
+ i.trim() && !s && (t(i), o(""), r.current && (r.current.style.height = "auto"));
643
698
  };
644
- return /* @__PURE__ */ d("div", { className: "gcw-input-area", children: [
645
- /* @__PURE__ */ d("div", { className: "gcw-input-row", children: [
646
- /* @__PURE__ */ t(
699
+ return /* @__PURE__ */ h("div", { className: "gcw-input-area", children: [
700
+ /* @__PURE__ */ h("div", { className: "gcw-input-row", children: [
701
+ /* @__PURE__ */ n(
647
702
  "textarea",
648
703
  {
649
704
  ref: r,
650
705
  value: i,
651
706
  onChange: (l) => o(l.target.value),
652
707
  onKeyDown: (l) => {
653
- l.key === "Enter" && !l.shiftKey && (l.preventDefault(), h());
708
+ l.key === "Enter" && !l.shiftKey && (l.preventDefault(), u());
654
709
  },
655
710
  placeholder: e,
656
711
  disabled: s,
@@ -658,84 +713,84 @@ function ze({ placeholder: e, isLoading: s, onSendMessage: n, primaryColor: a })
658
713
  className: "gcw-input"
659
714
  }
660
715
  ),
661
- /* @__PURE__ */ t(
716
+ /* @__PURE__ */ n(
662
717
  "button",
663
718
  {
664
- onClick: h,
719
+ onClick: u,
665
720
  disabled: !i.trim() || s,
666
721
  className: "gcw-send-btn",
667
722
  style: { backgroundColor: a },
668
723
  title: "Verstuur bericht",
669
- children: s ? /* @__PURE__ */ d("svg", { className: "gcw-send-btn__icon gcw-spin", fill: "none", viewBox: "0 0 24 24", children: [
670
- /* @__PURE__ */ t("circle", { style: { opacity: 0.25 }, cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
671
- /* @__PURE__ */ t("path", { style: { opacity: 0.75 }, fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
672
- ] }) : /* @__PURE__ */ t("svg", { className: "gcw-send-btn__icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 19l9 2-9-18-9 18 9-2zm0 0v-8" }) })
724
+ children: s ? /* @__PURE__ */ h("svg", { className: "gcw-send-btn__icon gcw-spin", fill: "none", viewBox: "0 0 24 24", children: [
725
+ /* @__PURE__ */ n("circle", { style: { opacity: 0.25 }, cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
726
+ /* @__PURE__ */ n("path", { style: { opacity: 0.75 }, fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
727
+ ] }) : /* @__PURE__ */ n("svg", { className: "gcw-send-btn__icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 19l9 2-9-18-9 18 9-2zm0 0v-8" }) })
673
728
  }
674
729
  )
675
730
  ] }),
676
- /* @__PURE__ */ t("p", { className: "gcw-input-hint", children: "Druk op Enter om te verzenden, Shift+Enter voor een nieuwe regel" })
731
+ /* @__PURE__ */ n("p", { className: "gcw-input-hint", children: "Druk op Enter om te verzenden, Shift+Enter voor een nieuwe regel" })
677
732
  ] });
678
733
  }
679
- function We({ isOpen: e, onClick: s, primaryColor: n, hasUnread: a, isPoppedOut: i }) {
680
- return /* @__PURE__ */ d(
734
+ function Re({ isOpen: e, onClick: s, primaryColor: t, hasUnread: a, isPoppedOut: i }) {
735
+ return /* @__PURE__ */ h(
681
736
  "button",
682
737
  {
683
738
  onClick: s,
684
739
  className: "gcw-toggle",
685
- style: { backgroundColor: n },
740
+ style: { backgroundColor: t },
686
741
  title: i ? "Chat is open in een ander venster" : e ? "Sluit chat" : "Open chat",
687
742
  children: [
688
- a && !e && /* @__PURE__ */ t("span", { className: "gcw-toggle__badge gcw-toggle__badge--unread", children: "!" }),
689
- i && /* @__PURE__ */ t("span", { className: "gcw-toggle__badge gcw-toggle__badge--popout" }),
690
- /* @__PURE__ */ t("div", { className: "gcw-toggle__icon", children: i ? /* @__PURE__ */ t("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }) : e ? /* @__PURE__ */ t("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ t("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }) })
743
+ a && !e && /* @__PURE__ */ n("span", { className: "gcw-toggle__badge gcw-toggle__badge--unread", children: "!" }),
744
+ i && /* @__PURE__ */ n("span", { className: "gcw-toggle__badge gcw-toggle__badge--popout" }),
745
+ /* @__PURE__ */ n("div", { className: "gcw-toggle__icon", children: i ? /* @__PURE__ */ n("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }) : e ? /* @__PURE__ */ n("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ n("svg", { fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }) })
691
746
  ]
692
747
  }
693
748
  );
694
749
  }
695
- function He(e) {
750
+ function Ge(e) {
696
751
  const s = new Date(e), a = (/* @__PURE__ */ new Date()).getTime() - s.getTime(), i = Math.floor(a / 6e4), o = Math.floor(a / 36e5), r = Math.floor(a / 864e5);
697
752
  return i < 1 ? "Zojuist" : i < 60 ? `${i} min geleden` : o < 24 ? `${o} uur geleden` : r < 7 ? `${r} ${r === 1 ? "dag" : "dagen"} geleden` : s.toLocaleDateString("nl-NL", { day: "numeric", month: "short" });
698
753
  }
699
- function Pe({
754
+ function Ke({
700
755
  currentSessionId: e,
701
756
  onBack: s,
702
- onSelectSession: n,
757
+ onSelectSession: t,
703
758
  onNewSession: a,
704
759
  onDeleteSession: i,
705
760
  onListSessions: o,
706
761
  primaryColor: r
707
762
  }) {
708
- const [h, c] = x([]), [l, m] = x(!0), [f, N] = x(null);
709
- C(() => {
710
- let u = !1;
711
- return m(!0), o().then((y) => {
712
- u || (c(y), m(!1));
763
+ const [u, c] = v([]), [l, m] = v(!0), [f, N] = v(null);
764
+ M(() => {
765
+ let d = !1;
766
+ return m(!0), o().then((k) => {
767
+ d || (c(k), m(!1));
713
768
  }), () => {
714
- u = !0;
769
+ d = !0;
715
770
  };
716
771
  }, [o]);
717
- const j = (u) => {
718
- n(u), s();
719
- }, w = (u, y) => {
720
- u.stopPropagation(), N(y);
772
+ const S = (d) => {
773
+ t(d), s();
774
+ }, p = (d, k) => {
775
+ d.stopPropagation(), N(k);
721
776
  }, g = async () => {
722
777
  if (!f) return;
723
- const u = f;
724
- N(null), await i(u), c((y) => y.filter((S) => S.id !== u));
778
+ const d = f;
779
+ N(null), await i(d), c((k) => k.filter((w) => w.id !== d));
725
780
  };
726
- return /* @__PURE__ */ d("div", { className: "gcw-history", children: [
727
- /* @__PURE__ */ d("div", { className: "gcw-history__header", style: { backgroundColor: r }, children: [
728
- /* @__PURE__ */ t(
781
+ return /* @__PURE__ */ h("div", { className: "gcw-history", children: [
782
+ /* @__PURE__ */ h("div", { className: "gcw-history__header", style: { backgroundColor: r }, children: [
783
+ /* @__PURE__ */ n(
729
784
  "button",
730
785
  {
731
786
  className: "gcw-header__btn",
732
787
  onClick: s,
733
788
  title: "Terug",
734
- children: /* @__PURE__ */ t(qe, { className: "gcw-header__btn-icon" })
789
+ children: /* @__PURE__ */ n(st, { className: "gcw-header__btn-icon" })
735
790
  }
736
791
  ),
737
- /* @__PURE__ */ t("h3", { className: "gcw-history__title", children: "Gesprekken" }),
738
- /* @__PURE__ */ t(
792
+ /* @__PURE__ */ n("h3", { className: "gcw-history__title", children: "Gesprekken" }),
793
+ /* @__PURE__ */ n(
739
794
  "button",
740
795
  {
741
796
  className: "gcw-header__btn",
@@ -743,50 +798,50 @@ function Pe({
743
798
  a(), s();
744
799
  },
745
800
  title: "Nieuw gesprek",
746
- children: /* @__PURE__ */ t(re, { className: "gcw-header__btn-icon" })
801
+ children: /* @__PURE__ */ n(ae, { className: "gcw-header__btn-icon" })
747
802
  }
748
803
  )
749
804
  ] }),
750
- /* @__PURE__ */ t("div", { className: "gcw-history__list", children: l ? /* @__PURE__ */ d("div", { className: "gcw-history__loading", children: [
751
- /* @__PURE__ */ t("div", { className: "gcw-session-loading__spinner" }),
752
- /* @__PURE__ */ t("span", { children: "Gesprekken laden..." })
753
- ] }) : h.length === 0 ? /* @__PURE__ */ t("div", { className: "gcw-history__empty", children: /* @__PURE__ */ t("p", { children: "Geen eerdere gesprekken" }) }) : h.map((u) => /* @__PURE__ */ d(
805
+ /* @__PURE__ */ n("div", { className: "gcw-history__list", children: l ? /* @__PURE__ */ h("div", { className: "gcw-history__loading", children: [
806
+ /* @__PURE__ */ n("div", { className: "gcw-session-loading__spinner" }),
807
+ /* @__PURE__ */ n("span", { children: "Gesprekken laden..." })
808
+ ] }) : u.length === 0 ? /* @__PURE__ */ n("div", { className: "gcw-history__empty", children: /* @__PURE__ */ n("p", { children: "Geen eerdere gesprekken" }) }) : u.map((d) => /* @__PURE__ */ h(
754
809
  "div",
755
810
  {
756
- className: `gcw-history__item ${u.id === e ? "gcw-history__item--active" : ""}`,
757
- onClick: () => j(u.id),
758
- style: u.id === e ? { borderLeftColor: r } : void 0,
811
+ className: `gcw-history__item ${d.id === e ? "gcw-history__item--active" : ""}`,
812
+ onClick: () => S(d.id),
813
+ style: d.id === e ? { borderLeftColor: r } : void 0,
759
814
  role: "button",
760
815
  tabIndex: 0,
761
- onKeyDown: (y) => {
762
- y.key === "Enter" && j(u.id);
816
+ onKeyDown: (k) => {
817
+ k.key === "Enter" && S(d.id);
763
818
  },
764
819
  children: [
765
- /* @__PURE__ */ d("div", { className: "gcw-history__item-content", children: [
766
- /* @__PURE__ */ t("span", { className: "gcw-history__item-title", children: u.title || "Naamloos gesprek" }),
767
- /* @__PURE__ */ d("span", { className: "gcw-history__item-meta", children: [
768
- u.message_count,
820
+ /* @__PURE__ */ h("div", { className: "gcw-history__item-content", children: [
821
+ /* @__PURE__ */ n("span", { className: "gcw-history__item-title", children: d.title || "Naamloos gesprek" }),
822
+ /* @__PURE__ */ h("span", { className: "gcw-history__item-meta", children: [
823
+ d.message_count,
769
824
  " ",
770
- u.message_count === 1 ? "bericht" : "berichten",
825
+ d.message_count === 1 ? "bericht" : "berichten",
771
826
  " · ",
772
- He(u.updated_at)
827
+ Ge(d.updated_at)
773
828
  ] })
774
829
  ] }),
775
- /* @__PURE__ */ t(
830
+ /* @__PURE__ */ n(
776
831
  "button",
777
832
  {
778
833
  className: "gcw-history__item-delete",
779
- onClick: (y) => w(y, u.id),
834
+ onClick: (k) => p(k, d.id),
780
835
  title: "Verwijder gesprek",
781
- children: /* @__PURE__ */ t(se, { className: "gcw-history__item-delete-icon" })
836
+ children: /* @__PURE__ */ n(ie, { className: "gcw-history__item-delete-icon" })
782
837
  }
783
838
  )
784
839
  ]
785
840
  },
786
- u.id
841
+ d.id
787
842
  )) }),
788
- f && /* @__PURE__ */ t(
789
- ne,
843
+ f && /* @__PURE__ */ n(
844
+ oe,
790
845
  {
791
846
  title: "Gesprek verwijderen",
792
847
  message: "Weet je zeker dat je dit gesprek wilt verwijderen? Dit kan niet ongedaan worden gemaakt.",
@@ -799,93 +854,93 @@ function Pe({
799
854
  )
800
855
  ] });
801
856
  }
802
- function ne({
857
+ function oe({
803
858
  title: e,
804
859
  message: s,
805
- confirmLabel: n = "Bevestigen",
860
+ confirmLabel: t = "Bevestigen",
806
861
  cancelLabel: a = "Annuleren",
807
862
  onConfirm: i,
808
863
  onCancel: o,
809
864
  variant: r = "default"
810
865
  }) {
811
- const h = H(null), c = H(null);
812
- return C(() => {
866
+ const u = H(null), c = H(null);
867
+ return M(() => {
813
868
  var m;
814
869
  (m = c.current) == null || m.focus();
815
- }, []), C(() => {
870
+ }, []), M(() => {
816
871
  const m = (f) => {
817
872
  f.key === "Escape" && o();
818
873
  };
819
874
  return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
820
- }, [o]), /* @__PURE__ */ t("div", { className: "gcw-modal-overlay", ref: h, onClick: (m) => {
821
- m.target === h.current && o();
822
- }, children: /* @__PURE__ */ d("div", { className: "gcw-modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "gcw-modal-title", children: [
823
- /* @__PURE__ */ t("h4", { className: "gcw-modal__title", id: "gcw-modal-title", children: e }),
824
- /* @__PURE__ */ t("p", { className: "gcw-modal__message", children: s }),
825
- /* @__PURE__ */ d("div", { className: "gcw-modal__actions", children: [
826
- /* @__PURE__ */ t("button", { className: "gcw-modal__btn gcw-modal__btn--cancel", onClick: o, children: a }),
827
- /* @__PURE__ */ t(
875
+ }, [o]), /* @__PURE__ */ n("div", { className: "gcw-modal-overlay", ref: u, onClick: (m) => {
876
+ m.target === u.current && o();
877
+ }, children: /* @__PURE__ */ h("div", { className: "gcw-modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "gcw-modal-title", children: [
878
+ /* @__PURE__ */ n("h4", { className: "gcw-modal__title", id: "gcw-modal-title", children: e }),
879
+ /* @__PURE__ */ n("p", { className: "gcw-modal__message", children: s }),
880
+ /* @__PURE__ */ h("div", { className: "gcw-modal__actions", children: [
881
+ /* @__PURE__ */ n("button", { className: "gcw-modal__btn gcw-modal__btn--cancel", onClick: o, children: a }),
882
+ /* @__PURE__ */ n(
828
883
  "button",
829
884
  {
830
885
  className: `gcw-modal__btn gcw-modal__btn--confirm ${r === "danger" ? "gcw-modal__btn--danger" : ""}`,
831
886
  onClick: i,
832
887
  ref: c,
833
- children: n
888
+ children: t
834
889
  }
835
890
  )
836
891
  ] })
837
892
  ] }) });
838
893
  }
839
- function Oe({ content: e, className: s }) {
894
+ function Ve({ content: e, className: s }) {
840
895
  if (!e) return null;
841
- const n = Ve(e);
842
- return /* @__PURE__ */ t("div", { className: s, children: n.map((a, i) => /* @__PURE__ */ t(pe.Fragment, { children: a }, i)) });
896
+ const t = Ue(e);
897
+ return /* @__PURE__ */ n("div", { className: s, children: t.map((a, i) => /* @__PURE__ */ n(ye.Fragment, { children: a }, i)) });
843
898
  }
844
- function Ve(e) {
899
+ function Ue(e) {
845
900
  const s = e.split(`
846
- `), n = [];
901
+ `), t = [];
847
902
  let a = null;
848
903
  const i = () => {
849
- a && (a.type === "ul" ? n.push(
850
- /* @__PURE__ */ t("ul", { className: "gcw-md-list gcw-md-list--ul", children: a.items.map((o, r) => /* @__PURE__ */ t("li", { className: "gcw-md-list__item", children: o }, r)) }, `list-${n.length}`)
851
- ) : n.push(
852
- /* @__PURE__ */ t("ol", { className: "gcw-md-list gcw-md-list--ol", children: a.items.map((o, r) => /* @__PURE__ */ t("li", { className: "gcw-md-list__item", children: o }, r)) }, `list-${n.length}`)
904
+ a && (a.type === "ul" ? t.push(
905
+ /* @__PURE__ */ n("ul", { className: "gcw-md-list gcw-md-list--ul", children: a.items.map((o, r) => /* @__PURE__ */ n("li", { className: "gcw-md-list__item", children: o }, r)) }, `list-${t.length}`)
906
+ ) : t.push(
907
+ /* @__PURE__ */ n("ol", { className: "gcw-md-list gcw-md-list--ol", children: a.items.map((o, r) => /* @__PURE__ */ n("li", { className: "gcw-md-list__item", children: o }, r)) }, `list-${t.length}`)
853
908
  ), a = null);
854
909
  };
855
910
  for (let o = 0; o < s.length; o++) {
856
911
  const r = s[o];
857
912
  if (r.startsWith("#### ")) {
858
- i(), n.push(
859
- /* @__PURE__ */ t("h5", { className: "gcw-md-heading gcw-md-heading--h5", children: A(r.slice(5)) }, o)
913
+ i(), t.push(
914
+ /* @__PURE__ */ n("h5", { className: "gcw-md-heading gcw-md-heading--h5", children: G(r.slice(5)) }, o)
860
915
  );
861
916
  continue;
862
917
  }
863
918
  if (r.startsWith("### ")) {
864
- i(), n.push(
865
- /* @__PURE__ */ t("h4", { className: "gcw-md-heading gcw-md-heading--h4", children: A(r.slice(4)) }, o)
919
+ i(), t.push(
920
+ /* @__PURE__ */ n("h4", { className: "gcw-md-heading gcw-md-heading--h4", children: G(r.slice(4)) }, o)
866
921
  );
867
922
  continue;
868
923
  }
869
924
  if (r.startsWith("## ")) {
870
- i(), n.push(
871
- /* @__PURE__ */ t("h3", { className: "gcw-md-heading gcw-md-heading--h3", children: A(r.slice(3)) }, o)
925
+ i(), t.push(
926
+ /* @__PURE__ */ n("h3", { className: "gcw-md-heading gcw-md-heading--h3", children: G(r.slice(3)) }, o)
872
927
  );
873
928
  continue;
874
929
  }
875
930
  if (r.startsWith("# ")) {
876
- i(), n.push(
877
- /* @__PURE__ */ t("h2", { className: "gcw-md-heading gcw-md-heading--h2", children: A(r.slice(2)) }, o)
931
+ i(), t.push(
932
+ /* @__PURE__ */ n("h2", { className: "gcw-md-heading gcw-md-heading--h2", children: G(r.slice(2)) }, o)
878
933
  );
879
934
  continue;
880
935
  }
881
- const h = r.match(/^[\s]*[-*•]\s+(.+)/);
882
- if (h) {
883
- (!a || a.type !== "ul") && (i(), a = { type: "ul", items: [] }), a.items.push(A(h[1]));
936
+ const u = r.match(/^[\s]*[-*•]\s+(.+)/);
937
+ if (u) {
938
+ (!a || a.type !== "ul") && (i(), a = { type: "ul", items: [] }), a.items.push(G(u[1]));
884
939
  continue;
885
940
  }
886
941
  const c = r.match(/^[\s]*(\d+)[.)]\s+(.+)/);
887
942
  if (c) {
888
- (!a || a.type !== "ol") && (i(), a = { type: "ol", items: [] }), a.items.push(A(c[2]));
943
+ (!a || a.type !== "ol") && (i(), a = { type: "ol", items: [] }), a.items.push(G(c[2]));
889
944
  continue;
890
945
  }
891
946
  if (r.startsWith("```")) {
@@ -893,9 +948,9 @@ function Ve(e) {
893
948
  const l = [];
894
949
  for (o++; o < s.length && !s[o].startsWith("```"); )
895
950
  l.push(s[o]), o++;
896
- n.push(
897
- /* @__PURE__ */ t("pre", { className: "gcw-md-code-block", children: /* @__PURE__ */ t("code", { children: l.join(`
898
- `) }) }, `code-${n.length}`)
951
+ t.push(
952
+ /* @__PURE__ */ n("pre", { className: "gcw-md-code-block", children: /* @__PURE__ */ n("code", { children: l.join(`
953
+ `) }) }, `code-${t.length}`)
899
954
  );
900
955
  continue;
901
956
  }
@@ -903,63 +958,63 @@ function Ve(e) {
903
958
  i();
904
959
  continue;
905
960
  }
906
- i(), n.push(
907
- /* @__PURE__ */ t("p", { className: "gcw-md-paragraph", children: A(r) }, o)
961
+ i(), t.push(
962
+ /* @__PURE__ */ n("p", { className: "gcw-md-paragraph", children: G(r) }, o)
908
963
  );
909
964
  }
910
- return i(), n;
965
+ return i(), t;
911
966
  }
912
- function A(e) {
967
+ function G(e) {
913
968
  if (!e) return null;
914
969
  const s = [];
915
- let n = e, a = 0;
916
- for (; n.length > 0; ) {
917
- const i = n.match(/^\*\*(.+?)\*\*/);
970
+ let t = e, a = 0;
971
+ for (; t.length > 0; ) {
972
+ const i = t.match(/^\*\*(.+?)\*\*/);
918
973
  if (i) {
919
- s.push(/* @__PURE__ */ t("strong", { className: "gcw-md-bold", children: i[1] }, a++)), n = n.slice(i[0].length);
974
+ s.push(/* @__PURE__ */ n("strong", { className: "gcw-md-bold", children: i[1] }, a++)), t = t.slice(i[0].length);
920
975
  continue;
921
976
  }
922
- const o = n.match(/^\*([^*]+?)\*/);
977
+ const o = t.match(/^\*([^*]+?)\*/);
923
978
  if (o) {
924
- s.push(/* @__PURE__ */ t("em", { className: "gcw-md-italic", children: o[1] }, a++)), n = n.slice(o[0].length);
979
+ s.push(/* @__PURE__ */ n("em", { className: "gcw-md-italic", children: o[1] }, a++)), t = t.slice(o[0].length);
925
980
  continue;
926
981
  }
927
- const r = n.match(/^`([^`]+)`/);
982
+ const r = t.match(/^`([^`]+)`/);
928
983
  if (r) {
929
984
  s.push(
930
- /* @__PURE__ */ t("code", { className: "gcw-md-code", children: r[1] }, a++)
931
- ), n = n.slice(r[0].length);
985
+ /* @__PURE__ */ n("code", { className: "gcw-md-code", children: r[1] }, a++)
986
+ ), t = t.slice(r[0].length);
932
987
  continue;
933
988
  }
934
- const h = n.match(/^\[([^\]]+)\]\(([^)]+)\)/);
935
- if (h) {
989
+ const u = t.match(/^\[([^\]]+)\]\(([^)]+)\)/);
990
+ if (u) {
936
991
  s.push(
937
- /* @__PURE__ */ t(
992
+ /* @__PURE__ */ n(
938
993
  "a",
939
994
  {
940
- href: h[2],
995
+ href: u[2],
941
996
  target: "_blank",
942
997
  rel: "noopener noreferrer",
943
998
  className: "gcw-md-link",
944
- children: h[1]
999
+ children: u[1]
945
1000
  },
946
1001
  a++
947
1002
  )
948
- ), n = n.slice(h[0].length);
1003
+ ), t = t.slice(u[0].length);
949
1004
  continue;
950
1005
  }
951
- const c = n.search(/[\*`\[]/);
1006
+ const c = t.search(/[\*`\[]/);
952
1007
  if (c === -1) {
953
- s.push(n);
1008
+ s.push(t);
954
1009
  break;
955
- } else c === 0 ? (s.push(n[0]), n = n.slice(1)) : (s.push(n.slice(0, c)), n = n.slice(c));
1010
+ } else c === 0 ? (s.push(t[0]), t = t.slice(1)) : (s.push(t.slice(0, c)), t = t.slice(c));
956
1011
  }
957
1012
  return s.length === 1 ? s[0] : s;
958
1013
  }
959
- function Ae(e) {
960
- const s = e.messages.map((n) => ({
961
- ...n,
962
- timestamp: n.timestamp.toISOString()
1014
+ function Xe(e) {
1015
+ const s = e.messages.map((t) => ({
1016
+ ...t,
1017
+ timestamp: t.timestamp.toISOString()
963
1018
  }));
964
1019
  return `
965
1020
  <!DOCTYPE html>
@@ -967,7 +1022,7 @@ function Ae(e) {
967
1022
  <head>
968
1023
  <meta charset="UTF-8">
969
1024
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
970
- <title>${J(e.title)}</title>
1025
+ <title>${q(e.title)}</title>
971
1026
  <style>
972
1027
  * { margin: 0; padding: 0; box-sizing: border-box; }
973
1028
  html, body, #chat-root { height: 100%; width: 100%; }
@@ -1242,8 +1297,8 @@ function Ae(e) {
1242
1297
  </svg>
1243
1298
  </div>
1244
1299
  <div class="popout-header-info">
1245
- <div class="popout-title">${J(e.title)}</div>
1246
- <div class="popout-subtitle">${J(e.subtitle)}</div>
1300
+ <div class="popout-title">${q(e.title)}</div>
1301
+ <div class="popout-subtitle">${q(e.subtitle)}</div>
1247
1302
  </div>
1248
1303
  </div>
1249
1304
  <div class="popout-messages" id="messages-container"></div>
@@ -1252,7 +1307,7 @@ function Ae(e) {
1252
1307
  <textarea
1253
1308
  class="popout-textarea"
1254
1309
  id="message-input"
1255
- placeholder="${J(e.placeholder)}"
1310
+ placeholder="${q(e.placeholder)}"
1256
1311
  rows="1"
1257
1312
  ></textarea>
1258
1313
  <button
@@ -1531,199 +1586,183 @@ function Ae(e) {
1531
1586
  </html>
1532
1587
  `;
1533
1588
  }
1534
- function J(e) {
1589
+ function q(e) {
1535
1590
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
1536
1591
  }
1537
- function Fe() {
1538
- return /* @__PURE__ */ t("div", { className: "gcw-typing", children: /* @__PURE__ */ t("div", { className: "gcw-typing__bubble", children: /* @__PURE__ */ d("div", { className: "gcw-typing__dots", children: [
1539
- /* @__PURE__ */ t("span", { className: "gcw-typing__dot" }),
1540
- /* @__PURE__ */ t("span", { className: "gcw-typing__dot" }),
1541
- /* @__PURE__ */ t("span", { className: "gcw-typing__dot" })
1592
+ function Je() {
1593
+ return /* @__PURE__ */ n("div", { className: "gcw-typing", children: /* @__PURE__ */ n("div", { className: "gcw-typing__bubble", children: /* @__PURE__ */ h("div", { className: "gcw-typing__dots", children: [
1594
+ /* @__PURE__ */ n("span", { className: "gcw-typing__dot" }),
1595
+ /* @__PURE__ */ n("span", { className: "gcw-typing__dot" }),
1596
+ /* @__PURE__ */ n("span", { className: "gcw-typing__dot" })
1542
1597
  ] }) }) });
1543
1598
  }
1544
- const Ue = {
1599
+ const Ye = {
1545
1600
  small: "Klein",
1546
1601
  medium: "Middel",
1547
1602
  large: "Groot",
1548
1603
  fullscreen: "Volledig scherm"
1549
1604
  };
1550
- function Ke({ size: e, onCycleSize: s, onPopout: n, onClear: a, onNewSession: i, onShowHistory: o }) {
1551
- const [r, h] = x(!1), c = H(null);
1552
- C(() => {
1605
+ function qe({ size: e, onCycleSize: s, onPopout: t, onClear: a, onNewSession: i, onShowHistory: o }) {
1606
+ const [r, u] = v(!1), c = H(null);
1607
+ M(() => {
1553
1608
  if (!r) return;
1554
1609
  const m = (N) => {
1555
- c.current && !c.current.contains(N.target) && h(!1);
1610
+ c.current && !c.current.contains(N.target) && u(!1);
1556
1611
  }, f = setTimeout(() => {
1557
1612
  document.addEventListener("click", m);
1558
1613
  }, 0);
1559
1614
  return () => {
1560
1615
  clearTimeout(f), document.removeEventListener("click", m);
1561
1616
  };
1562
- }, [r]), C(() => {
1617
+ }, [r]), M(() => {
1563
1618
  if (!r) return;
1564
1619
  const m = (f) => {
1565
- f.key === "Escape" && h(!1);
1620
+ f.key === "Escape" && u(!1);
1566
1621
  };
1567
1622
  return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
1568
1623
  }, [r]);
1569
1624
  const l = (m) => {
1570
- m(), h(!1);
1625
+ m(), u(!1);
1571
1626
  };
1572
- return /* @__PURE__ */ d("div", { className: "gcw-header-menu", ref: c, children: [
1573
- /* @__PURE__ */ t(
1627
+ return /* @__PURE__ */ h("div", { className: "gcw-header-menu", ref: c, children: [
1628
+ /* @__PURE__ */ n(
1574
1629
  "button",
1575
1630
  {
1576
- onClick: () => h(!r),
1631
+ onClick: () => u(!r),
1577
1632
  className: "gcw-header__btn",
1578
1633
  title: "Menu",
1579
1634
  "aria-expanded": r,
1580
1635
  "aria-haspopup": "true",
1581
- children: /* @__PURE__ */ d("svg", { className: "gcw-header__btn-icon", fill: "currentColor", viewBox: "0 0 24 24", children: [
1582
- /* @__PURE__ */ t("circle", { cx: "12", cy: "5", r: "2" }),
1583
- /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "2" }),
1584
- /* @__PURE__ */ t("circle", { cx: "12", cy: "19", r: "2" })
1636
+ children: /* @__PURE__ */ h("svg", { className: "gcw-header__btn-icon", fill: "currentColor", viewBox: "0 0 24 24", children: [
1637
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "5", r: "2" }),
1638
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "2" }),
1639
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "19", r: "2" })
1585
1640
  ] })
1586
1641
  }
1587
1642
  ),
1588
- r && /* @__PURE__ */ d("div", { className: "gcw-header-menu__dropdown", role: "menu", children: [
1589
- /* @__PURE__ */ d(
1643
+ r && /* @__PURE__ */ h("div", { className: "gcw-header-menu__dropdown", role: "menu", children: [
1644
+ /* @__PURE__ */ h(
1590
1645
  "button",
1591
1646
  {
1592
1647
  className: "gcw-header-menu__item",
1593
1648
  onClick: () => l(i),
1594
1649
  role: "menuitem",
1595
1650
  children: [
1596
- /* @__PURE__ */ t(re, { className: "gcw-header-menu__icon" }),
1597
- /* @__PURE__ */ t("span", { children: "Nieuwe chat" })
1651
+ /* @__PURE__ */ n(ae, { className: "gcw-header-menu__icon" }),
1652
+ /* @__PURE__ */ n("span", { children: "Nieuwe chat" })
1598
1653
  ]
1599
1654
  }
1600
1655
  ),
1601
- /* @__PURE__ */ d(
1656
+ /* @__PURE__ */ h(
1602
1657
  "button",
1603
1658
  {
1604
1659
  className: "gcw-header-menu__item",
1605
1660
  onClick: () => l(o),
1606
1661
  role: "menuitem",
1607
1662
  children: [
1608
- /* @__PURE__ */ t(Ye, { className: "gcw-header-menu__icon" }),
1609
- /* @__PURE__ */ t("span", { children: "Chat geschiedenis" })
1663
+ /* @__PURE__ */ n(nt, { className: "gcw-header-menu__icon" }),
1664
+ /* @__PURE__ */ n("span", { children: "Chat geschiedenis" })
1610
1665
  ]
1611
1666
  }
1612
1667
  ),
1613
- /* @__PURE__ */ t("div", { className: "gcw-header-menu__divider" }),
1614
- /* @__PURE__ */ d(
1668
+ /* @__PURE__ */ n("div", { className: "gcw-header-menu__divider" }),
1669
+ /* @__PURE__ */ h(
1615
1670
  "button",
1616
1671
  {
1617
1672
  className: "gcw-header-menu__item",
1618
1673
  onClick: () => l(s),
1619
1674
  role: "menuitem",
1620
1675
  children: [
1621
- /* @__PURE__ */ t(Re, { size: e, className: "gcw-header-menu__icon" }),
1622
- /* @__PURE__ */ d("span", { children: [
1676
+ /* @__PURE__ */ n(Ze, { size: e, className: "gcw-header-menu__icon" }),
1677
+ /* @__PURE__ */ h("span", { children: [
1623
1678
  "Grootte: ",
1624
- Ue[e]
1679
+ Ye[e]
1625
1680
  ] })
1626
1681
  ]
1627
1682
  }
1628
1683
  ),
1629
- /* @__PURE__ */ d(
1684
+ /* @__PURE__ */ h(
1630
1685
  "button",
1631
1686
  {
1632
1687
  className: "gcw-header-menu__item",
1633
- onClick: () => l(n),
1688
+ onClick: () => l(t),
1634
1689
  role: "menuitem",
1635
1690
  children: [
1636
- /* @__PURE__ */ t(Ge, { className: "gcw-header-menu__icon" }),
1637
- /* @__PURE__ */ t("span", { children: "Open in nieuw venster" })
1691
+ /* @__PURE__ */ n(Qe, { className: "gcw-header-menu__icon" }),
1692
+ /* @__PURE__ */ n("span", { children: "Open in nieuw venster" })
1638
1693
  ]
1639
1694
  }
1640
1695
  ),
1641
- /* @__PURE__ */ t("div", { className: "gcw-header-menu__divider" }),
1642
- /* @__PURE__ */ d(
1696
+ /* @__PURE__ */ n("div", { className: "gcw-header-menu__divider" }),
1697
+ /* @__PURE__ */ h(
1643
1698
  "button",
1644
1699
  {
1645
1700
  className: "gcw-header-menu__item gcw-header-menu__item--danger",
1646
1701
  onClick: () => l(a),
1647
1702
  role: "menuitem",
1648
1703
  children: [
1649
- /* @__PURE__ */ t(se, { className: "gcw-header-menu__icon" }),
1650
- /* @__PURE__ */ t("span", { children: "Chat verwijderen" })
1704
+ /* @__PURE__ */ n(ie, { className: "gcw-header-menu__icon" }),
1705
+ /* @__PURE__ */ n("span", { children: "Chat verwijderen" })
1651
1706
  ]
1652
1707
  }
1653
1708
  )
1654
1709
  ] })
1655
1710
  ] });
1656
1711
  }
1657
- function Re({ size: e, className: s = "gcw-w-4 gcw-h-4" }) {
1658
- switch (e) {
1659
- case "small":
1660
- return /* @__PURE__ */ t("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1661
- case "medium":
1662
- return /* @__PURE__ */ t("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1663
- case "large":
1664
- return /* @__PURE__ */ t("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1665
- case "fullscreen":
1666
- return /* @__PURE__ */ t("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" }) });
1667
- }
1668
- }
1669
- function tt({ className: e = "gcw-w-4 gcw-h-4" }) {
1670
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1671
- }
1672
- function nt({ className: e = "gcw-w-4 gcw-h-4" }) {
1673
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" }) });
1712
+ function Ze({ size: e, className: s }) {
1713
+ return /* @__PURE__ */ n("svg", { className: s, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: e === "fullscreen" ? "M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25" : "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) });
1674
1714
  }
1675
- function Ge({ className: e = "gcw-w-4 gcw-h-4" }) {
1676
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) });
1715
+ function Qe({ className: e }) {
1716
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) });
1677
1717
  }
1678
- function Xe({ className: e = "gcw-w-4 gcw-h-4" }) {
1679
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) });
1718
+ function et({ className: e }) {
1719
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) });
1680
1720
  }
1681
- function se({ className: e = "gcw-w-4 gcw-h-4" }) {
1682
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) });
1721
+ function ie({ className: e }) {
1722
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) });
1683
1723
  }
1684
- function Je({ className: e = "gcw-w-6 gcw-h-6" }) {
1685
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" }) });
1724
+ function tt({ className: e }) {
1725
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" }) });
1686
1726
  }
1687
- function re({ className: e = "gcw-w-4 gcw-h-4" }) {
1688
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) });
1727
+ function ae({ className: e }) {
1728
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) });
1689
1729
  }
1690
- function Ye({ className: e = "gcw-w-4 gcw-h-4" }) {
1691
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) });
1730
+ function nt({ className: e }) {
1731
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) });
1692
1732
  }
1693
- function qe({ className: e = "gcw-w-4 gcw-h-4" }) {
1694
- return /* @__PURE__ */ t("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) });
1733
+ function st({ className: e }) {
1734
+ return /* @__PURE__ */ n("svg", { className: e, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) });
1695
1735
  }
1696
1736
  export {
1697
- qe as ArrowLeftIcon,
1698
- De as ChatBubble,
1699
- Je as ChatIcon,
1700
- et as ChatWidget,
1701
- Ee as ChatWindow,
1702
- Xe as CloseIcon,
1703
- ne as ConfirmModal,
1704
- nt as ContractIcon,
1705
- tt as ExpandIcon,
1706
- Ke as HeaderMenu,
1707
- Ye as HistoryIcon,
1708
- Oe as MarkdownRenderer,
1709
- ze as MessageInput,
1710
- Be as MessageList,
1711
- re as NewChatIcon,
1712
- Ge as PopoutIcon,
1713
- Re as ResizeIcon,
1714
- Pe as SessionHistory,
1715
- We as ToggleButton,
1716
- se as TrashIcon,
1717
- Fe as TypingIndicator,
1718
- W as clearSession,
1719
- Ae as getPopoutHTML,
1720
- _e as loadPopoutState,
1721
- Me as loadSeenAssistantCount,
1722
- ye as loadSessionId,
1723
- G as savePopoutState,
1724
- X as saveSeenAssistantCount,
1725
- ve as saveSessionId,
1726
- ke as subscribeToSessionChanges,
1727
- xe as useChat,
1728
- Ne as usePopout
1737
+ st as ArrowLeftIcon,
1738
+ Pe as ChatBubble,
1739
+ tt as ChatIcon,
1740
+ it as ChatWidget,
1741
+ Be as ChatWindow,
1742
+ et as CloseIcon,
1743
+ oe as ConfirmModal,
1744
+ qe as HeaderMenu,
1745
+ nt as HistoryIcon,
1746
+ Ve as MarkdownRenderer,
1747
+ Fe as MessageInput,
1748
+ Oe as MessageList,
1749
+ ae as NewChatIcon,
1750
+ Qe as PopoutIcon,
1751
+ Ze as ResizeIcon,
1752
+ Ke as SessionHistory,
1753
+ Re as ToggleButton,
1754
+ ie as TrashIcon,
1755
+ Je as TypingIndicator,
1756
+ O as clearSession,
1757
+ Xe as getPopoutHTML,
1758
+ Ie as loadPopoutState,
1759
+ Le as loadSeenAssistantCount,
1760
+ Me as loadSessionId,
1761
+ J as savePopoutState,
1762
+ Y as saveSeenAssistantCount,
1763
+ Se as saveSessionId,
1764
+ Ce as subscribeToSessionChanges,
1765
+ ke as useAuth,
1766
+ Ee as useChat,
1767
+ Te as usePopout
1729
1768
  };