@salla.sa/ui-ai-kit-core 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/cjs/ai-agent-error.cjs.entry.js +3 -3
  2. package/dist/cjs/ai-card.cjs.entry.js +3 -3
  3. package/dist/cjs/ai-chat-container.cjs.entry.js +63 -14
  4. package/dist/cjs/ai-chat-header.cjs.entry.js +63 -8
  5. package/dist/cjs/ai-chat-message.cjs.entry.js +10 -4
  6. package/dist/cjs/ai-conversation-list.cjs.entry.js +37 -12
  7. package/dist/cjs/ai-conversation-summary.cjs.entry.js +3 -3
  8. package/dist/cjs/ai-icon.cjs.entry.js +2 -2
  9. package/dist/cjs/ai-in-chat-browser.cjs.entry.js +68 -0
  10. package/dist/cjs/ai-link.cjs.entry.js +3 -3
  11. package/dist/cjs/ai-loading.cjs.entry.js +2 -2
  12. package/dist/cjs/ai-message-input.cjs.entry.js +12 -7
  13. package/dist/cjs/ai-rating.cjs.entry.js +26 -18
  14. package/dist/cjs/ai-route-decision.cjs.entry.js +3 -3
  15. package/dist/cjs/ai-suggestion.cjs.entry.js +3 -3
  16. package/dist/cjs/ai-voice-input.cjs.entry.js +2 -2
  17. package/dist/cjs/icon-registry-D-m8GW4D.js +126 -0
  18. package/dist/cjs/{index-Bs23yVuF.js → index-BQ8Az7-D.js} +71 -1
  19. package/dist/cjs/loader.cjs.js +2 -2
  20. package/dist/cjs/ui-ai-kit.cjs.js +2 -2
  21. package/dist/collection/collection-manifest.json +1 -0
  22. package/dist/collection/components/ai-agent-error/ai-agent-error.js +1 -1
  23. package/dist/collection/components/ai-card/ai-card.js +2 -2
  24. package/dist/collection/components/ai-chat-container/ai-chat-container.css +175 -3
  25. package/dist/collection/components/ai-chat-container/ai-chat-container.js +155 -11
  26. package/dist/collection/components/ai-chat-header/ai-chat-header.css +98 -0
  27. package/dist/collection/components/ai-chat-header/ai-chat-header.js +239 -7
  28. package/dist/collection/components/ai-chat-message/ai-chat-message.js +8 -2
  29. package/dist/collection/components/ai-conversation-list/ai-conversation-list.css +116 -7
  30. package/dist/collection/components/ai-conversation-list/ai-conversation-list.js +128 -9
  31. package/dist/collection/components/ai-conversation-summary/ai-conversation-summary.js +1 -1
  32. package/dist/collection/components/ai-icon/ai-icon.js +1 -1
  33. package/dist/collection/components/ai-in-chat-browser/ai-in-chat-browser.css +88 -0
  34. package/dist/collection/components/ai-in-chat-browser/ai-in-chat-browser.js +171 -0
  35. package/dist/collection/components/ai-link/ai-link.js +1 -1
  36. package/dist/collection/components/ai-message-input/ai-message-input.css +46 -5
  37. package/dist/collection/components/ai-message-input/ai-message-input.js +10 -5
  38. package/dist/collection/components/ai-rating/ai-rating.css +22 -2
  39. package/dist/collection/components/ai-rating/ai-rating.js +46 -17
  40. package/dist/collection/components/ai-route-decision/ai-route-decision.js +1 -1
  41. package/dist/collection/components/ai-suggestion/ai-suggestion.js +2 -2
  42. package/dist/collection/components/ai-voice-input/ai-voice-input.js +1 -1
  43. package/dist/collection/utils/icon-registry.js +27 -7
  44. package/dist/components/ai-agent-error.js +1 -1
  45. package/dist/components/ai-card.js +1 -1
  46. package/dist/components/ai-chat-container.js +1 -1
  47. package/dist/components/ai-chat-header.js +1 -1
  48. package/dist/components/ai-chat-message.js +2 -2
  49. package/dist/components/ai-conversation-list.js +1 -1
  50. package/dist/components/ai-conversation-summary.js +1 -1
  51. package/dist/components/ai-icon.js +1 -1
  52. package/dist/components/ai-in-chat-browser.d.ts +11 -0
  53. package/dist/components/ai-in-chat-browser.js +1 -0
  54. package/dist/components/ai-link.js +1 -1
  55. package/dist/components/ai-loading.js +1 -1
  56. package/dist/components/ai-message-input.js +1 -1
  57. package/dist/components/ai-rating.js +1 -1
  58. package/dist/components/ai-route-decision.js +1 -1
  59. package/dist/components/ai-suggestion.js +1 -1
  60. package/dist/components/ai-voice-input.js +1 -1
  61. package/dist/components/index.js +1 -1
  62. package/dist/components/p-B3gdcdCK.js +1 -0
  63. package/dist/components/{p-Bbmjx9lq.js → p-C2LB8D3t.js} +1 -1
  64. package/dist/components/p-CXJ3iEt8.js +1 -0
  65. package/dist/components/p-D4mVoP6B.js +1 -0
  66. package/dist/components/p-DKsh1ZQX.js +1 -0
  67. package/dist/components/p-DlD8m3rf.js +1 -0
  68. package/dist/components/{p-C5gkZloN.js → p-NKAwri_g.js} +1 -1
  69. package/dist/esm/ai-agent-error.entry.js +3 -3
  70. package/dist/esm/ai-card.entry.js +3 -3
  71. package/dist/esm/ai-chat-container.entry.js +63 -14
  72. package/dist/esm/ai-chat-header.entry.js +63 -8
  73. package/dist/esm/ai-chat-message.entry.js +10 -4
  74. package/dist/esm/ai-conversation-list.entry.js +37 -12
  75. package/dist/esm/ai-conversation-summary.entry.js +3 -3
  76. package/dist/esm/ai-icon.entry.js +2 -2
  77. package/dist/esm/ai-in-chat-browser.entry.js +66 -0
  78. package/dist/esm/ai-link.entry.js +3 -3
  79. package/dist/esm/ai-loading.entry.js +2 -2
  80. package/dist/esm/ai-message-input.entry.js +12 -7
  81. package/dist/esm/ai-rating.entry.js +26 -18
  82. package/dist/esm/ai-route-decision.entry.js +3 -3
  83. package/dist/esm/ai-suggestion.entry.js +3 -3
  84. package/dist/esm/ai-voice-input.entry.js +2 -2
  85. package/dist/esm/icon-registry-DlD8m3rf.js +124 -0
  86. package/dist/esm/{index-hxWjzqcH.js → index-BSQ0GkzI.js} +71 -1
  87. package/dist/esm/loader.js +3 -3
  88. package/dist/esm/ui-ai-kit.js +3 -3
  89. package/dist/types/components/ai-chat-container/ai-chat-container.d.ts +17 -1
  90. package/dist/types/components/ai-chat-header/ai-chat-header.d.ts +26 -1
  91. package/dist/types/components/ai-conversation-list/ai-conversation-list.d.ts +11 -0
  92. package/dist/types/components/ai-in-chat-browser/ai-in-chat-browser.d.ts +22 -0
  93. package/dist/types/components/ai-rating/ai-rating.d.ts +4 -1
  94. package/dist/types/components.d.ts +279 -5
  95. package/dist/types/utils/icon-registry.d.ts +1 -1
  96. package/dist/ui-ai-kit/{p-889c6b00.entry.js → p-1e8e6440.entry.js} +1 -1
  97. package/dist/ui-ai-kit/p-29d84924.entry.js +1 -0
  98. package/dist/ui-ai-kit/p-39a2d4c3.entry.js +1 -0
  99. package/dist/ui-ai-kit/{p-ccaec7b4.entry.js → p-3a86919b.entry.js} +1 -1
  100. package/dist/ui-ai-kit/{p-5ea933a4.entry.js → p-47797619.entry.js} +1 -1
  101. package/dist/ui-ai-kit/{p-b33e92ea.entry.js → p-658d8b24.entry.js} +1 -1
  102. package/dist/ui-ai-kit/{p-cf6caba5.entry.js → p-73cbb80b.entry.js} +1 -1
  103. package/dist/ui-ai-kit/p-77ef8015.entry.js +1 -0
  104. package/dist/ui-ai-kit/{p-999dd7c8.entry.js → p-78fb4ceb.entry.js} +1 -1
  105. package/dist/ui-ai-kit/p-849cd7e2.entry.js +1 -0
  106. package/dist/ui-ai-kit/p-8cb807f3.entry.js +1 -0
  107. package/dist/ui-ai-kit/p-BSQ0GkzI.js +2 -0
  108. package/dist/ui-ai-kit/p-DlD8m3rf.js +1 -0
  109. package/dist/ui-ai-kit/p-abd68089.entry.js +1 -0
  110. package/dist/ui-ai-kit/{p-27bf454d.entry.js → p-b88808a4.entry.js} +1 -1
  111. package/dist/ui-ai-kit/{p-72c6e3d1.entry.js → p-c9dca99e.entry.js} +1 -1
  112. package/dist/ui-ai-kit/{p-210b11dc.entry.js → p-dac67692.entry.js} +1 -1
  113. package/dist/ui-ai-kit/{p-0da537b1.entry.js → p-eb40ffd0.entry.js} +2 -2
  114. package/dist/ui-ai-kit/ui-ai-kit.css +1 -1
  115. package/dist/ui-ai-kit/ui-ai-kit.esm.js +1 -1
  116. package/package.json +1 -1
  117. package/dist/cjs/icon-registry-BKb9-2Nt.js +0 -106
  118. package/dist/components/p-CAnlgwx0.js +0 -1
  119. package/dist/components/p-SJZ6Ujn9.js +0 -1
  120. package/dist/esm/icon-registry-SJZ6Ujn9.js +0 -104
  121. package/dist/ui-ai-kit/p-1cce63d4.entry.js +0 -1
  122. package/dist/ui-ai-kit/p-70836960.entry.js +0 -1
  123. package/dist/ui-ai-kit/p-8f721843.entry.js +0 -1
  124. package/dist/ui-ai-kit/p-95b50b7b.entry.js +0 -1
  125. package/dist/ui-ai-kit/p-SJZ6Ujn9.js +0 -1
  126. package/dist/ui-ai-kit/p-c9ec615f.entry.js +0 -1
  127. package/dist/ui-ai-kit/p-hxWjzqcH.js +0 -2
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bs23yVuF.js');
4
- var iconRegistry = require('./icon-registry-BKb9-2Nt.js');
3
+ var index = require('./index-BQ8Az7-D.js');
4
+ var iconRegistry = require('./icon-registry-D-m8GW4D.js');
5
5
 
6
6
  const aiAgentErrorCss = () => `:host{display:block}.icon-wrap{display:inline-flex;align-items:center;justify-content:center;line-height:0}@keyframes fade-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.error-card{background:var(--ai-danger-bg);border:1px solid var(--ai-danger-border);border-radius:16px;box-shadow:var(--ai-shadow-error);overflow:hidden;animation:fade-in 0.3s ease}.error-body{display:flex;align-items:flex-start;gap:12px;padding:16px}.error-icon-wrap{width:36px;height:36px;border-radius:9999px;background:var(--ai-bg-card);border:1px solid var(--ai-danger-border);display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--ai-danger-text)}.error-content{flex:1;display:flex;flex-direction:column;gap:6px;min-width:0}.error-headline-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.error-headline{font-size:14px;font-weight:600;color:var(--ai-danger-text);line-height:1.4}.error-code-badge{font-size:11px;font-weight:500;color:var(--ai-danger-text);background:var(--ai-bg-card);border:1px solid var(--ai-danger-border);padding:1px 7px;border-radius:9999px;white-space:nowrap;flex-shrink:0;opacity:0.85}.error-message{margin:0;font-size:13px;font-weight:400;color:var(--ai-text-secondary);line-height:1.5}.dismiss-btn{display:inline-flex;align-items:center;justify-content:center;background:none;border:none;padding:4px;cursor:pointer;color:var(--ai-danger-text);opacity:0.6;flex-shrink:0;border-radius:6px;transition:opacity 0.15s ease, background 0.15s ease}.dismiss-btn:hover{opacity:1;background:var(--ai-hover-overlay)}.error-footer{padding:0 16px 14px}.retry-btn{display:inline-flex;align-items:center;gap:6px;background:var(--ai-bg-card);border:1px solid var(--ai-danger-border);border-radius:9999px;padding:6px 14px;font-size:13px;font-weight:500;color:var(--ai-danger-text);cursor:pointer;transition:box-shadow 0.15s ease, opacity 0.15s ease;font-family:inherit}.retry-btn:hover{box-shadow:var(--ai-shadow-active);opacity:0.9}.retry-btn:active{opacity:0.75}`;
7
7
 
@@ -33,7 +33,7 @@ const AiAgentError = class {
33
33
  return index.h("span", { class: "icon-wrap", innerHTML: svg });
34
34
  }
35
35
  render() {
36
- return (index.h(index.Host, { key: '0376a351dfcff6612ddbbf9ec38afd90b51e4a42' }, index.h("div", { key: '4085f93755a8cd3b74ec182ebe510bb8a6626133', class: "error-card" }, index.h("div", { key: '61d42da5ed3d8bbc69cd9604e600437fc241edb0', class: "error-body" }, index.h("div", { key: '0d98c6ad7bfc320164ba5308b8f1f8f5557eccf2', class: "error-icon-wrap" }, this.renderIcon('warning', 20, 20)), index.h("div", { key: '7b75d807a6227d335b26965cd959471c7ae8f20b', class: "error-content" }, index.h("div", { key: 'd46f618bb685bb3ce20ba11fb59f524e4ffe6238', class: "error-headline-row" }, index.h("span", { key: '6ee0b1d651d6a037073e6ad8917b2fe5495d0ee0', class: "error-headline" }, this.headline), this.errorCode && (index.h("span", { key: 'b541eee2462ff33791e3975102841845297335d4', class: "error-code-badge" }, this.errorCode))), this.message && (index.h("p", { key: '34d133731a7512ebe16a873bf52eb97120463335', class: "error-message" }, this.message))), this.dismissible && (index.h("button", { key: '0e3bc48998e3e7e2379557e2c6c7503d5c021a42', class: "dismiss-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642", onClick: () => this.dismissClick.emit() }, this.renderIcon('cancel', 16, 16)))), this.retryable && (index.h("div", { key: 'f1865b3e69d946be9833943b66e1b8de046d343d', class: "error-footer" }, index.h("button", { key: '11c72fbbfbaabf60e5da178ac07177185c0046b8', class: "retry-btn", onClick: () => this.retryClick.emit() }, this.renderIcon('reload', 16, 16), index.h("span", { key: 'fafdec1b9bc0aa727ada94d011bd1e66da53df0e' }, this.retryLabel)))))));
36
+ return (index.h(index.Host, { key: '58e3dfec84f2fcea2f53657dc2b7d16344ada0c2' }, index.h("div", { key: 'c85a02edecb0919d664a01468b4318b3258e126c', class: "error-card" }, index.h("div", { key: '9336d8a342877b2cccc08f1e52aa981d5ecb7e4b', class: "error-body" }, index.h("div", { key: '0e472ff1f226635242feb969b6c897b5a8eb57b8', class: "error-icon-wrap" }, this.renderIcon('warning', 20, 20)), index.h("div", { key: 'bec21585c826378a01a30a1e2c347289fa968b6d', class: "error-content" }, index.h("div", { key: '04030863e65ad1551abd0941709cbc61ef36b4f4', class: "error-headline-row" }, index.h("span", { key: '6044558b93d6e9be50cbf3f251bf8cd615014a2b', class: "error-headline" }, this.headline), this.errorCode && (index.h("span", { key: '33c20307ceb7d55d6b0dd1a2b583456fdb50a947', class: "error-code-badge" }, this.errorCode))), this.message && (index.h("p", { key: '911f62b72bc8b61a2d6bd444d6e6304c6e4adaed', class: "error-message" }, this.message))), this.dismissible && (index.h("button", { key: '76fcb3b7e964f7f1fdebb422c9b056d1631df666', class: "dismiss-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642", onClick: () => this.dismissClick.emit() }, this.renderIcon('cancel', 16, 16)))), this.retryable && (index.h("div", { key: '670e28d12c27dcfc9ce9c017ae06278fb07906cd', class: "error-footer" }, index.h("button", { key: '2cf7655d43e1d68c6befde8a48b72b10c1077f68', class: "retry-btn", onClick: () => this.retryClick.emit() }, this.renderIcon('reload', 16, 16), index.h("span", { key: 'e28ca18eba500c9d50d7d690889777ad312b9e62' }, this.retryLabel)))))));
37
37
  }
38
38
  };
39
39
  AiAgentError.style = aiAgentErrorCss();
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bs23yVuF.js');
3
+ var index = require('./index-BQ8Az7-D.js');
4
4
 
5
5
  const aiCardCss = () => `:host{--ai-card-border:1px solid var(--ai-border-default);--ai-card-radius:16px;--ai-card-padding:16px;--ai-card-gap:12px;--ai-card-shadow:var(--ai-shadow-sm);display:block}.card{background:var(--ai-bg-card);border:var(--ai-card-border);border-radius:var(--ai-card-radius);padding:var(--ai-card-padding);box-shadow:var(--ai-card-shadow);box-sizing:border-box;overflow:hidden;color:var(--ai-text-primary);width:100%;display:flex;flex-direction:column;gap:var(--ai-card-gap);text-align:start;font-size:14px;line-height:20px}.card--no-padding{padding:0}.card--no-shadow{box-shadow:none}`;
6
6
 
@@ -13,11 +13,11 @@ const AiCard = class {
13
13
  /** Remove the shadow */
14
14
  noShadow = false;
15
15
  render() {
16
- return (index.h(index.Host, { key: 'b9af2e825faa2dc3ba5a0c145a9c9399a75e048a' }, index.h("div", { key: 'f698c538583908fc84f4987e574c9f6740047791', class: {
16
+ return (index.h(index.Host, { key: '1bdd14661b995f51378e67676a44c92730626ffe' }, index.h("div", { key: 'fa15c03048be26793d36bfb8c6a7325b21b04d5c', class: {
17
17
  card: true,
18
18
  'card--no-padding': this.noPadding,
19
19
  'card--no-shadow': this.noShadow,
20
- } }, index.h("slot", { key: '8012eba0a43945d4354f51f97badf87df072e0ea' }))));
20
+ } }, index.h("slot", { key: 'a1d77664d0754f5d71c75ebc658a74c581111091' }))));
21
21
  }
22
22
  };
23
23
  AiCard.style = aiCardCss();
@@ -1,10 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bs23yVuF.js');
3
+ var index = require('./index-BQ8Az7-D.js');
4
4
 
5
- const aiChatContainerCss = () => `:host{display:contents}.chat-container{font-family:var(--ai-font-family);display:flex;flex-direction:column;overflow:hidden;position:relative;background-color:var(--ai-container-bg, var(--ai-bg-card));border:1px solid var(--ai-border-default);z-index:50;box-sizing:border-box}.messages-area{flex:1;overflow-y:auto;min-height:0;scrollbar-width:thin;padding:var(--ai-spacing-2xl, 16px);scrollbar-color:var(--ai-scrollbar-thumb) transparent}.messages-area::-webkit-scrollbar{width:3px}.messages-area::-webkit-scrollbar-track{background:transparent}.messages-area::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.messages-area::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.chat-container.left,.chat-container.right{position:fixed;top:0;bottom:0;transition:transform 300ms cubic-bezier(0.4, 0, 0.2, 1)}.chat-container.left{left:0;transform:translateX(-100%)}.chat-container.right{right:0;transform:translateX(100%)}.chat-container.left.open,.chat-container.right.open{transform:translateX(0)}.chat-container.float{position:fixed;border-radius:16px;box-shadow:var(--ai-shadow-float);opacity:0;pointer-events:none;transform:scale(0.95);transform-origin:bottom left;transition:opacity 200ms ease, transform 200ms ease}.chat-container.float.open{opacity:1;pointer-events:auto;transform:scale(1)}.watermark{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none}.watermark ai-icon{opacity:var(--ai-watermark-opacity, 0.8);filter:var(--ai-watermark-filter, var(--ai-shadow-watermark))}.chat-container.mobile{width:100% !important}.chat-container.float.mobile{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}@media (max-width: 767px){.chat-container{width:100% !important}.chat-container.float{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}}`;
5
+ const aiChatContainerCss = () => `:host{display:contents}.chat-container{font-family:var(--ai-font-family);display:flex;flex-direction:column;overflow:hidden;position:relative;background-color:var(--ai-container-bg, var(--ai-bg-card));border:1px solid var(--ai-border-default);z-index:50;box-sizing:border-box}.messages-area{flex:1;overflow-y:auto;min-height:0;scrollbar-width:thin;padding:var(--ai-spacing-2xl, 16px);scrollbar-color:var(--ai-scrollbar-thumb) transparent}.messages-area::-webkit-scrollbar{width:3px}.messages-area::-webkit-scrollbar-track{background:transparent}.messages-area::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.messages-area::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.chat-container.left,.chat-container.right{position:fixed;top:0;bottom:0;transition:transform 300ms cubic-bezier(0.4, 0, 0.2, 1)}.chat-container.left{left:0;transform:translateX(-100%)}.chat-container.right{right:0;transform:translateX(100%)}.chat-container.left.open,.chat-container.right.open{transform:translateX(0)}.chat-container.float{position:fixed;border-radius:16px;box-shadow:var(--ai-shadow-float);opacity:0;pointer-events:none;transform:scale(0.95);transform-origin:bottom left;transition:opacity 200ms ease, transform 200ms ease}.chat-container.float.open{opacity:1;pointer-events:auto;transform:scale(1)}.watermark{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);pointer-events:none;width:133px;height:133px}.watermark .watermark-circle-svg{position:absolute;top:0;left:0}.watermark .watermark-star-svg{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.watermark .watermark-circle{fill:var(--ai-watermark-circle, #FCFCFC)}.watermark .watermark-star{fill:var(--ai-watermark-star, #FAFAFA)}:host(.dark) .watermark .watermark-circle{fill:var(--ai-watermark-circle, #222222)}:host(.dark) .watermark .watermark-star{fill:var(--ai-watermark-star, #292B2C)}.chat-container.mobile{width:100% !important}.chat-container.float.mobile{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}@media (max-width: 767px){.chat-container{width:100% !important}.chat-container.float{left:0 !important;right:0 !important;top:0 !important;bottom:0 !important;height:100% !important;border-radius:0 !important}}@keyframes skeleton-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.skeleton-messages{display:flex;flex-direction:column;gap:20px;padding:8px 0}.skeleton-row{display:flex;align-items:flex-start;gap:10px}.skeleton-row.agent{flex-direction:row}.skeleton-row.user{flex-direction:row-reverse}.skeleton-avatar{width:32px;height:32px;min-width:32px;border-radius:50%;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-bubble{display:flex;flex-direction:column;gap:8px;padding:14px 16px;border-radius:16px;background-color:var(--ai-bg-surface, #f9fafb);max-width:75%;min-width:120px}.skeleton-row.user .skeleton-bubble{background-color:var(--ai-user-bubble-bg, var(--ai-accent, #004956));border-radius:16px}.skeleton-line{height:12px;border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}.skeleton-row.user .skeleton-line{background:linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.08) 75%);background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-avatar{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}:host(.dark) .skeleton-bubble{background-color:var(--ai-bg-surface, #1f2937)}:host(.dark) .skeleton-line{background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.06) 75%));background-size:200% 100%;animation:skeleton-shimmer 1.6s ease-in-out infinite}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:12px;padding:48px 24px;flex:1}.error-icon{color:var(--ai-text-muted, #9ca3af);opacity:0.7}.error-text{margin:0;font-size:14px;line-height:1.5;color:var(--ai-text-secondary, #6b7280)}.error-retry-btn{display:inline-flex;align-items:center;justify-content:center;padding:8px 20px;border-radius:9999px;border:1px solid var(--ai-border-default);background-color:var(--ai-bg-surface, #f9fafb);color:var(--ai-text-primary);font-size:13px;font-weight:500;font-family:inherit;cursor:pointer;transition:background-color 0.15s ease, border-color 0.15s ease}.error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(0, 0, 0, 0.04));border-color:var(--ai-accent, #004956)}.error-retry-btn:focus-visible{outline:2px solid var(--ai-focus-ring-color, var(--ai-focus-ring));outline-offset:2px}:host(.dark) .error-retry-btn{background-color:var(--ai-bg-surface, #1f2937);color:var(--ai-text-primary, #f9fafb)}:host(.dark) .error-retry-btn:hover{background-color:var(--ai-hover-overlay, rgba(255, 255, 255, 0.06))}`;
6
6
 
7
7
  const ChatContainer = class {
8
+ constructor(hostRef) {
9
+ index.registerInstance(this, hostRef);
10
+ this.retryClick = index.createEvent(this, "retryClick");
11
+ }
8
12
  get el() { return index.getElement(this); }
9
13
  /** Controls visibility of the chat panel */
10
14
  isOpen = false;
@@ -20,6 +24,16 @@ const ChatContainer = class {
20
24
  floatHeight = '600px';
21
25
  /** Color theme for the panel */
22
26
  theme = 'light';
27
+ /** Show skeleton loading state (e.g. while loading conversation history) */
28
+ loading = false;
29
+ /** Show error state (e.g. failed to load conversation) */
30
+ error = false;
31
+ /** Error message text */
32
+ errorText = 'تعذّر تحميل المحادثة';
33
+ /** Retry button label */
34
+ retryLabel = 'إعادة المحاولة';
35
+ /** Event emitted when the retry button is clicked */
36
+ retryClick;
23
37
  isMobile = false;
24
38
  floatLeft = '24px';
25
39
  floatTop = '24px';
@@ -27,8 +41,11 @@ const ChatContainer = class {
27
41
  messagesAreaRef;
28
42
  dragState = null;
29
43
  mutationObserver = null;
44
+ resizeObserver = null;
30
45
  // Named arrow so we can reliably add/remove it without leaking
31
46
  dragListener = (e) => {
47
+ if (typeof window === 'undefined')
48
+ return;
32
49
  const container = this.containerRef;
33
50
  if (!container)
34
51
  return;
@@ -67,20 +84,24 @@ const ChatContainer = class {
67
84
  document.addEventListener('pointermove', onMove);
68
85
  document.addEventListener('pointerup', onUp);
69
86
  };
70
- constructor(hostRef) {
71
- index.registerInstance(this, hostRef);
72
- // Bind so window.removeEventListener can match the reference
73
- this.checkMobile = this.checkMobile.bind(this);
74
- }
75
87
  componentWillLoad() {
76
88
  this.checkMobile();
77
89
  }
78
90
  componentDidLoad() {
79
- if (typeof window !== 'undefined') {
80
- window.addEventListener('resize', this.checkMobile);
81
- if (this.position === 'float') {
82
- this.setupDrag();
83
- }
91
+ if (typeof window === 'undefined')
92
+ return;
93
+ // Use ResizeObserver for responsive mobile detection instead of window.resize
94
+ if (typeof ResizeObserver !== 'undefined') {
95
+ this.resizeObserver = new ResizeObserver(() => {
96
+ this.checkMobile();
97
+ this.clampFloatPosition();
98
+ });
99
+ this.resizeObserver.observe(this.el);
100
+ }
101
+ // Also listen to window resize for viewport changes (e.g. browser resize)
102
+ window.addEventListener('resize', this.handleWindowResize);
103
+ if (this.position === 'float') {
104
+ this.setupDrag();
84
105
  }
85
106
  this.mutationObserver = new MutationObserver(() => {
86
107
  if (this.autoScroll && this.messagesAreaRef) {
@@ -105,9 +126,12 @@ const ChatContainer = class {
105
126
  }
106
127
  }
107
128
  disconnectedCallback() {
108
- window.removeEventListener('resize', this.checkMobile);
129
+ if (typeof window !== 'undefined') {
130
+ window.removeEventListener('resize', this.handleWindowResize);
131
+ }
109
132
  this.el.removeEventListener('headerDragStart', this.dragListener);
110
133
  this.mutationObserver?.disconnect();
134
+ this.resizeObserver?.disconnect();
111
135
  }
112
136
  /** Programmatically scroll the messages area to the bottom */
113
137
  async scrollToBottom() {
@@ -115,11 +139,30 @@ const ChatContainer = class {
115
139
  this.messagesAreaRef.scrollTop = this.messagesAreaRef.scrollHeight;
116
140
  }
117
141
  }
142
+ handleWindowResize = () => {
143
+ this.checkMobile();
144
+ this.clampFloatPosition();
145
+ };
118
146
  checkMobile() {
119
147
  if (typeof window !== 'undefined') {
120
148
  this.isMobile = window.innerWidth < 768;
121
149
  }
122
150
  }
151
+ /** Re-clamp float position so the panel never ends up off-screen after resize */
152
+ clampFloatPosition() {
153
+ if (typeof window === 'undefined' || this.position !== 'float' || !this.containerRef)
154
+ return;
155
+ const vw = window.innerWidth;
156
+ const vh = window.innerHeight;
157
+ const w = this.containerRef.offsetWidth;
158
+ const h = this.containerRef.offsetHeight;
159
+ let left = parseFloat(this.floatLeft) || 0;
160
+ let top = parseFloat(this.floatTop) || 0;
161
+ left = Math.max(0, Math.min(left, vw - w));
162
+ top = Math.max(0, Math.min(top, vh - h));
163
+ this.floatLeft = `${left}px`;
164
+ this.floatTop = `${top}px`;
165
+ }
123
166
  setupDrag() {
124
167
  // Remove any existing listener before adding to prevent accumulation
125
168
  this.el.removeEventListener('headerDragStart', this.dragListener);
@@ -159,8 +202,14 @@ const ChatContainer = class {
159
202
  }
160
203
  return false;
161
204
  }
205
+ renderSkeleton() {
206
+ return (index.h("div", { class: "skeleton-messages", "aria-busy": "true", "aria-label": "Loading conversation" }, index.h("div", { class: "skeleton-row agent" }, index.h("div", { class: "skeleton-bubble" }, index.h("div", { class: "skeleton-line", style: { width: '80%' } }), index.h("div", { class: "skeleton-line", style: { width: '60%' } }), index.h("div", { class: "skeleton-line", style: { width: '40%' } }))), index.h("div", { class: "skeleton-row user" }, index.h("div", { class: "skeleton-bubble" }, index.h("div", { class: "skeleton-line", style: { width: '70%' } }))), index.h("div", { class: "skeleton-row agent" }, index.h("div", { class: "skeleton-bubble" }, index.h("div", { class: "skeleton-line", style: { width: '90%' } }), index.h("div", { class: "skeleton-line", style: { width: '55%' } }))), index.h("div", { class: "skeleton-row user" }, index.h("div", { class: "skeleton-bubble" }, index.h("div", { class: "skeleton-line", style: { width: '50%' } }), index.h("div", { class: "skeleton-line", style: { width: '35%' } })))));
207
+ }
208
+ renderError() {
209
+ return (index.h("div", { class: "error-state", role: "alert" }, index.h("svg", { class: "error-icon", width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", "stroke-width": "1.5" }), index.h("path", { d: "M12 7v6", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }), index.h("circle", { cx: "12", cy: "16.5", r: "0.75", fill: "currentColor" })), index.h("p", { class: "error-text" }, this.errorText), index.h("button", { class: "error-retry-btn", type: "button", onClick: () => this.retryClick.emit() }, this.retryLabel)));
210
+ }
162
211
  render() {
163
- return (index.h(index.Host, { key: 'fb25617bfba35681e5190cec602ad17f8a8e53ef', class: { dark: this.isDark() } }, index.h("div", { key: '463a07a473470a497212948fa601cd677d1f266b', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && (index.h("div", { key: '40c3fa4a496a848950dba73372acacd14b4c5dda', class: "watermark" }, index.h("ai-icon", { key: '7467301453bce43c8d3eaca7efe83800a9e4bc8b', name: "watermark", size: 133 }))), index.h("slot", { key: 'c082990d1e7829d5d879a1c176dd0b57a3b3a244', name: "header" }), index.h("div", { key: '13b9ccd90f1e1e26794c8e780a5e8e89a4de43d2', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, index.h("slot", { key: '247cb11401e834b41d220515b88d5e202f40e8e8' })), index.h("slot", { key: '8115183cbe55bc3ba472fed0e368a811e5232b47', name: "footer" }))));
212
+ return (index.h(index.Host, { key: '146842c18b30c96eff709262d14f0026b3c0b5f2', class: { dark: this.isDark() } }, index.h("div", { key: '6d138b05c08cf3c01645d2832b9df847ae8fb34e', class: this.getContainerClasses(), style: this.getContainerStyle(), ref: el => (this.containerRef = el) }, this.showWatermark && !this.loading && !this.error && (index.h("div", { key: 'ef54afa1cec6e7589aa559938792429eb0fe76b6', class: "watermark" }, index.h("svg", { key: 'eb5dc8d17a48b73ed28c23d50a77939995efe818', class: "watermark-circle-svg", width: "133", height: "133", viewBox: "0 0 133 133", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: 'c2f60242842b2788cfc577a96da595a6588d5dac', filter: "url(#wm_circle_shadow)" }, index.h("circle", { key: '9681bf0e38334eea7978e16854f7572bfc702a7d', cx: "66.415", cy: "66.415", r: "66.415", class: "watermark-circle" })), index.h("defs", { key: 'dfb531e4137c54ae2cb3cd67fc4f48cff578bbd6' }, index.h("filter", { key: '61c6a2e8a4ad2726280fdecea7f416f160e1388c', id: "wm_circle_shadow", x: "0", y: "0", width: "132.83", height: "135.83", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, index.h("feFlood", { key: 'e001abcfa7ea700a4c9df12f7edb2d77f41a681a', "flood-opacity": "0", result: "BackgroundImageFix" }), index.h("feBlend", { key: 'ab42b31ddffdafbcd0d8b3a1ac3638cad08422de', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), index.h("feColorMatrix", { key: 'dbe6cee1b694612115237fe7ba631962b299c17e', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), index.h("feOffset", { key: '6e4df9fac567a782676e6ee11124405856e2d216', dy: "3" }), index.h("feGaussianBlur", { key: 'cf3eccf07988f8d35fc22db8dc8acd7efafb9f28', stdDeviation: "3" }), index.h("feComposite", { key: '8ede441bedbc49e505402977ab4787b7f80b8c17', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), index.h("feColorMatrix", { key: '4d6286fd6303c018d7c9e37258bc3fe746d716c0', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), index.h("feBlend", { key: '137f322f9922e682873b3f7c3f44b714793d80bc', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))), index.h("svg", { key: '5ed41b236f120a820e138829fdd86d6d7517953b', class: "watermark-star-svg", width: "78", height: "78", viewBox: "0 0 78 78", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: 'bd4a4b26cf740bccb6dfa44c185e1c6ce9281407', filter: "url(#wm_star_shadow)" }, index.h("path", { key: '7b0769a6ef62e35206e0057da58ae0b2187a5aad', d: "M38.7421 0C39.5691 0 40.2689 0.286272 40.8414 0.858815C41.414 1.43136 41.7002 2.13113 41.7002 2.95814C41.7002 8.87442 43.1952 14.3772 46.1851 19.4665C49.1115 24.4285 53.0557 28.3727 58.0177 31.299C63.107 34.289 68.6097 35.7839 74.526 35.7839C75.353 35.7839 76.0528 36.0702 76.6254 36.6428C77.1979 37.2153 77.4842 37.9151 77.4842 38.7421C77.4842 39.5691 77.1979 40.2689 76.6254 40.8414C76.0528 41.414 75.353 41.7002 74.526 41.7002C68.6097 41.7002 63.107 43.1952 58.0177 46.1851C53.0557 49.1115 49.1115 53.0557 46.1851 58.0177C43.1952 63.107 41.7002 68.6097 41.7002 74.526C41.7002 75.353 41.414 76.0528 40.8414 76.6254C40.2689 77.1979 39.5691 77.4842 38.7421 77.4842C37.9151 77.4842 37.2153 77.1979 36.6428 76.6254C36.0702 76.0528 35.7839 75.353 35.7839 74.526C35.7839 68.6097 34.289 63.107 31.299 58.0177C28.3727 53.0557 24.4285 49.1115 19.4665 46.1851C14.3772 43.1952 8.87442 41.7002 2.95814 41.7002C2.13113 41.7002 1.43136 41.414 0.858815 40.8414C0.286272 40.2689 0 39.5691 0 38.7421C0 37.9151 0.286272 37.2153 0.858815 36.6428C1.43136 36.0702 2.13113 35.7839 2.95814 35.7839C8.87442 35.7839 14.3772 34.289 19.4665 31.299C24.4285 28.3727 28.3727 24.4285 31.299 19.4665C34.289 14.3772 35.7839 8.87442 35.7839 2.95814C35.7839 2.13113 36.0702 1.43136 36.6428 0.858815C37.2153 0.286272 37.9151 0 38.7421 0Z", class: "watermark-star" })), index.h("defs", { key: 'a004811963ac78b6c13df187333f3ba525c18f55' }, index.h("filter", { key: '734877af85b6554e27f24720e06bcd59b707362b', id: "wm_star_shadow", x: "0", y: "0", width: "77.4844", height: "79.4841", filterUnits: "userSpaceOnUse", "color-interpolation-filters": "sRGB" }, index.h("feFlood", { key: 'bfa384407eb019aa79be662411bea47097744323', "flood-opacity": "0", result: "BackgroundImageFix" }), index.h("feBlend", { key: '7cd90c875f8bce1780a4eaa899bc222b8cd5991e', mode: "normal", in: "SourceGraphic", in2: "BackgroundImageFix", result: "shape" }), index.h("feColorMatrix", { key: '3edcb0bb26efba7f93e6ea125cc1b21f885cc75e', in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), index.h("feOffset", { key: '2e18721ab747cedc0a6ae4d422a6b2991e37ed80', dy: "2" }), index.h("feGaussianBlur", { key: '0772cc52ba154b42d7f780d5e9bf16bd2293dee9', stdDeviation: "2" }), index.h("feComposite", { key: '739a5b26667c1745e8d42c33aadedf56b3530a52', in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }), index.h("feColorMatrix", { key: '23ca07f2d016d14aa95a64b581f8804cc43469fb', type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" }), index.h("feBlend", { key: '66e8b6a28ba77465df00123176f40e9b53a171c0', mode: "normal", in2: "shape", result: "effect1_innerShadow" })))))), index.h("slot", { key: 'd24884b15dfa86c3ccc353587f8bf5b1b0e00bc6', name: "header" }), index.h("div", { key: '4bafceed191d908bebf24a838e5277707831042a', class: "messages-area", ref: el => (this.messagesAreaRef = el) }, this.loading ? this.renderSkeleton() : this.error ? this.renderError() : index.h("slot", null)), index.h("slot", { key: 'ea962c2d9a6cb59c50b785c42e5b9d2103ac8848', name: "footer" }))));
164
213
  }
165
214
  static get watchers() { return {
166
215
  "isOpen": [{
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bs23yVuF.js');
4
- var iconRegistry = require('./icon-registry-BKb9-2Nt.js');
3
+ var index = require('./index-BQ8Az7-D.js');
4
+ var iconRegistry = require('./icon-registry-D-m8GW4D.js');
5
5
 
6
- const aiChatHeaderCss = () => `:host{display:block}.header-container{display:flex;align-items:center;gap:8px;padding:16px;background:var(--ai-bg-card);border-bottom:1px solid var(--ai-border-light);width:100%;box-sizing:border-box}.drag-btn{cursor:grab;color:var(--ai-text-muted)}.drag-btn:active{cursor:grabbing}.action-btn,.back-btn{width:40px;height:40px;padding:4px;display:flex;align-items:center;justify-content:center;background:var(--ai-bg-card);border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-primary);transition:background 0.15s ease}.action-btn:hover,.back-btn:hover{background:var(--ai-bg-surface)}.action-btn:focus-visible,.back-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.action-btn:active,.back-btn:active{background:var(--ai-bg-surface)}.actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.content{flex:1 0 0;display:flex;align-items:center;justify-content:flex-start;min-width:0}.content.agent{gap:4px;height:40px}.content.human{gap:8px}.dropdown-trigger{display:flex;align-items:center;gap:4px;background:none;border:none;cursor:pointer;padding:0;flex-shrink:0;color:var(--ai-text-primary)}.dropdown-chevron{display:inline-flex;transition:transform 0.2s ease}.dropdown-chevron.open{transform:rotate(180deg)}.dropdown-trigger:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.title{font-size:16px;font-weight:700;color:var(--ai-text-primary);white-space:nowrap;line-height:normal;min-width:0;overflow:hidden;text-overflow:ellipsis}.avatar-wrapper{position:relative;width:40px;height:40px;flex-shrink:0}.avatar{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);object-fit:cover;display:block}.avatar-fallback{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);background:var(--ai-bg-surface);color:var(--ai-text-primary);font-size:16px;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0}.online-dot{position:absolute;bottom:0;inset-inline-end:0;width:10px;height:10px;display:inline-flex;align-items:center;justify-content:center;color:var(--ai-bg-card);}.online-dot.status-online{color:#22c55e;}.online-dot.status-offline{color:#9ca3af;}.online-dot.status-busy{color:#ef4444;}.online-dot.status-away{color:#f59e0b;}.text-block{display:flex;flex-direction:column;align-items:flex-start;gap:0;flex-shrink:0}.agent-name{font-size:14px;font-weight:500;color:var(--ai-text-primary);line-height:20px;white-space:nowrap}.agent-status{font-size:14px;font-weight:400;color:var(--ai-text-secondary);line-height:20px;white-space:nowrap}.icon-wrap{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.icon-wrap svg{display:block}:host-context([dir='ltr']) .back-btn .icon-wrap,:host([dir='ltr']) .back-btn .icon-wrap{transform:scaleX(-1)}`;
6
+ const aiChatHeaderCss = () => `:host{display:block;position:relative;z-index:10}.header-wrapper{position:relative;display:flex;flex-direction:column}.header-container{display:flex;align-items:center;gap:8px;padding:16px;background:var(--ai-bg-card);border-bottom:1px solid var(--ai-border-light);width:100%;box-sizing:border-box}.drag-btn{cursor:grab;color:var(--ai-text-muted)}.drag-btn:active{cursor:grabbing}.action-btn,.back-btn{width:40px;height:40px;padding:4px;display:flex;align-items:center;justify-content:center;background:var(--ai-bg-card);border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-primary);transition:background 0.15s ease}.action-btn:hover,.back-btn:hover{background:var(--ai-bg-surface)}.action-btn:focus-visible,.back-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.action-btn:active,.back-btn:active{background:var(--ai-bg-surface)}.actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.content{flex:1 0 0;display:flex;align-items:center;justify-content:flex-start;min-width:0}.content.agent{gap:4px;height:40px}.content.human{gap:8px}.content.browser{gap:8px}.dropdown-trigger{display:flex;align-items:center;gap:4px;background:none;border:none;cursor:pointer;padding:0;flex-shrink:0;color:var(--ai-text-primary)}.dropdown-chevron{display:inline-flex;transition:transform 0.2s ease}.dropdown-chevron.open{transform:rotate(180deg)}.dropdown-trigger:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.title{font-size:16px;font-weight:700;color:var(--ai-text-primary);white-space:nowrap;line-height:normal;min-width:0;overflow:hidden;text-overflow:ellipsis}@keyframes title-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.title-skeleton{display:inline-block;width:120px;height:16px;border-radius:8px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0,0,0,0.06) 25%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.06) 75%));background-size:200% 100%;animation:title-shimmer 1.6s ease-in-out infinite}.browser-title{font-size:14px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;line-height:20px}.browser-link-btn{width:28px;height:28px;padding:0;display:inline-flex;align-items:center;justify-content:center;background:none;border:none;border-radius:8px;cursor:pointer;flex-shrink:0;color:var(--ai-text-secondary)}.browser-link-btn:focus-visible{outline:2px solid var(--ai-focus-ring);outline-offset:2px}.avatar-wrapper{position:relative;width:40px;height:40px;flex-shrink:0}.avatar{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);object-fit:cover;display:block}.avatar-fallback{width:40px;height:40px;border-radius:9999px;border:1px solid var(--ai-border-default);background:var(--ai-bg-surface);color:var(--ai-text-primary);font-size:16px;font-weight:600;display:flex;align-items:center;justify-content:center;flex-shrink:0}.online-dot{position:absolute;bottom:0;inset-inline-end:0;width:10px;height:10px;display:inline-flex;align-items:center;justify-content:center;color:var(--ai-bg-card);}.online-dot.status-online{color:#22c55e;}.online-dot.status-offline{color:#9ca3af;}.online-dot.status-busy{color:#ef4444;}.online-dot.status-away{color:#f59e0b;}.text-block{display:flex;flex-direction:column;align-items:flex-start;gap:0;flex-shrink:0}.agent-name{font-size:14px;font-weight:500;color:var(--ai-text-primary);line-height:20px;white-space:nowrap}.agent-status{font-size:14px;font-weight:400;color:var(--ai-text-secondary);line-height:20px;white-space:nowrap}.icon-wrap{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.icon-wrap svg{display:block}:host-context([dir='ltr']) .back-btn .icon-wrap,:host([dir='ltr']) .back-btn .icon-wrap{transform:scaleX(-1)}.conversation-dropdown{position:absolute;top:100%;left:0;right:0;z-index:20;height:360px;display:flex;flex-direction:column;background:var(--ai-bg-surface);border-bottom:1px solid var(--ai-border-light);box-shadow:var(--ai-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));animation:slideDown 0.2s ease;overflow:hidden}.conversation-dropdown ai-conversation-list{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}@keyframes slideDown{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}`;
7
7
 
8
8
  const AiChatHeader = class {
9
9
  constructor(hostRef) {
@@ -14,7 +14,11 @@ const AiChatHeader = class {
14
14
  this.positionClick = index.createEvent(this, "positionClick");
15
15
  this.backClick = index.createEvent(this, "backClick");
16
16
  this.headerDragStart = index.createEvent(this, "headerDragStart");
17
+ this.openExternal = index.createEvent(this, "openExternal");
18
+ this.conversationSelect = index.createEvent(this, "conversationSelect");
19
+ this.conversationDelete = index.createEvent(this, "conversationDelete");
17
20
  }
21
+ get el() { return index.getElement(this); }
18
22
  /** Layout variant */
19
23
  mode = 'agent';
20
24
  /** Agent mode: conversation title */
@@ -30,6 +34,18 @@ const AiChatHeader = class {
30
34
  isDraggable = false;
31
35
  /** Human mode: status indicator variant */
32
36
  statusIndicator = 'online';
37
+ /** Browser mode: page title shown in the header */
38
+ pageTitle = '';
39
+ /** Browser mode: the external URL to link to */
40
+ pageUrl = '';
41
+ /** Conversation list: items to display in the dropdown panel */
42
+ conversationItems = [];
43
+ /** Conversation list: ID of the currently active conversation */
44
+ conversationActiveId = '';
45
+ /** Conversation list: show skeleton loading state */
46
+ conversationLoading = false;
47
+ /** Show a shimmer skeleton in place of the conversation title (e.g. while loading conversation) */
48
+ titleLoading = false;
33
49
  avatarError = false;
34
50
  dropdownOpen = false;
35
51
  /** Cancel / close button */
@@ -47,6 +63,17 @@ const AiChatHeader = class {
47
63
  * Composed + bubbling so ai-chat-container can receive it across shadow roots.
48
64
  */
49
65
  headerDragStart;
66
+ /** Open-external button (browser mode) */
67
+ openExternal;
68
+ /** Fired when a conversation is selected from the dropdown list */
69
+ conversationSelect;
70
+ /** Fired when a conversation delete button is clicked */
71
+ conversationDelete;
72
+ handleDocumentClick(event) {
73
+ if (this.dropdownOpen && !this.el.contains(event.target)) {
74
+ this.dropdownOpen = false;
75
+ }
76
+ }
50
77
  renderIcon(name, width, height) {
51
78
  const icon = iconRegistry.iconRegistry[name];
52
79
  if (!icon)
@@ -59,18 +86,39 @@ const AiChatHeader = class {
59
86
  if (!this.agentAvatar || this.avatarError) {
60
87
  return index.h("div", { class: "avatar-fallback" }, fallbackLetter);
61
88
  }
62
- return (index.h("img", { class: "avatar", src: this.agentAvatar, alt: this.agentName, onError: () => { this.avatarError = true; } }));
89
+ return (index.h("img", { class: "avatar", src: this.agentAvatar, alt: this.agentName, onError: () => {
90
+ this.avatarError = true;
91
+ } }));
63
92
  }
64
93
  renderDragBtn() {
65
- return this.isDraggable && (index.h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
94
+ return (this.isDraggable && (index.h("button", { class: "action-btn drag-btn", "aria-label": "\u0633\u062D\u0628 / Drag", onPointerDown: (e) => {
66
95
  e.preventDefault();
67
96
  this.headerDragStart.emit({ clientX: e.clientX, clientY: e.clientY });
68
- } }, this.renderIcon('drag', 11, 15)));
97
+ } }, this.renderIcon('drag', 11, 15))));
98
+ }
99
+ handleConversationSelect = (e) => {
100
+ e.stopPropagation();
101
+ this.conversationSelect.emit(e.detail);
102
+ this.dropdownOpen = false;
103
+ };
104
+ handleConversationDelete = (e) => {
105
+ e.stopPropagation();
106
+ this.conversationDelete.emit(e.detail);
107
+ };
108
+ renderConversationDropdown() {
109
+ if (!this.dropdownOpen || this.mode !== 'agent')
110
+ return null;
111
+ return (index.h("div", { class: "conversation-dropdown" }, index.h("ai-conversation-list", { items: this.conversationItems, activeId: this.conversationActiveId, loading: this.conversationLoading, onConversationSelect: this.handleConversationSelect, onConversationDelete: this.handleConversationDelete })));
69
112
  }
70
113
  renderAgentMode() {
71
114
  return [
72
115
  this.renderDragBtn(),
73
- index.h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => { this.dropdownOpen = !this.dropdownOpen; this.dropdownClick.emit(); }, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, index.h("span", { class: "title" }, this.conversation), index.h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24))),
116
+ index.h("div", { class: "content agent dropdown-trigger", role: "button", onClick: () => {
117
+ if (this.titleLoading)
118
+ return;
119
+ this.dropdownOpen = !this.dropdownOpen;
120
+ this.dropdownClick.emit();
121
+ }, "aria-haspopup": "listbox", "aria-expanded": this.dropdownOpen, "aria-label": `${this.conversation}, افتح قائمة المحادثات` }, this.titleLoading ? (index.h("span", { class: "title-skeleton", "aria-busy": "true", "aria-label": "\u062C\u0627\u0631\u064A \u0627\u0644\u062A\u062D\u0645\u064A\u0644" })) : (index.h("span", { class: "title" }, this.conversation)), !this.titleLoading && (index.h("span", { class: `dropdown-chevron${this.dropdownOpen ? ' open' : ''}` }, this.renderIcon('chevron-down', 24, 24)))),
74
122
  index.h("div", { class: "actions" }, index.h("button", { class: "action-btn", "aria-label": "\u062A\u0639\u062F\u064A\u0644 / Edit", onClick: () => this.editClick.emit() }, this.renderIcon('pencil-edit', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => this.positionClick.emit() }, this.renderIcon('hand', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
75
123
  ];
76
124
  }
@@ -81,8 +129,15 @@ const AiChatHeader = class {
81
129
  index.h("div", { class: "actions" }, index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => this.positionClick.emit() }, this.renderIcon('hand', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
82
130
  ];
83
131
  }
132
+ renderBrowserMode() {
133
+ return [
134
+ this.renderDragBtn(),
135
+ index.h("div", { class: "content browser" }, index.h("button", { class: "back-btn", "aria-label": "\u0631\u062C\u0648\u0639 / Back", onClick: () => this.backClick.emit() }, this.renderIcon('arrow-right', 24, 24)), index.h("span", { class: "browser-title" }, this.pageTitle), index.h("button", { class: "browser-link-btn", "aria-label": "\u0641\u062A\u062D \u0641\u064A \u0646\u0627\u0641\u0630\u0629 \u062C\u062F\u064A\u062F\u0629 / Open externally", onClick: () => this.openExternal.emit(this.pageUrl) }, this.renderIcon('link', 14, 14))),
136
+ index.h("div", { class: "actions" }, index.h("button", { class: "action-btn", "aria-label": "\u0627\u0644\u0639\u0631\u0636 / Position", onClick: () => this.positionClick.emit() }, this.renderIcon('hand', 22, 22)), index.h("button", { class: "action-btn", "aria-label": "\u0625\u063A\u0644\u0627\u0642 / Close", onClick: () => this.closeClick.emit() }, this.renderIcon('cancel', 22, 22))),
137
+ ];
138
+ }
84
139
  render() {
85
- return (index.h(index.Host, { key: 'e7384f8737db6d63472fb458ebb0e1090438c03e' }, index.h("div", { key: 'b1b5fcc22aeca94649cc972042c3e9de75ddbdb7', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.renderHumanMode())));
140
+ return (index.h(index.Host, { key: '8e1fe67030a0cb1eb94327f093327fb23d4faf01' }, index.h("div", { key: '14766bd663e5fe027f1a3320bd3f16d79e9feb45', class: "header-wrapper" }, index.h("div", { key: 'bef30f621ba3b148f4af055347eb707bc8f64b15', class: "header-container" }, this.mode === 'agent' ? this.renderAgentMode() : this.mode === 'human' ? this.renderHumanMode() : this.renderBrowserMode()), this.renderConversationDropdown())));
86
141
  }
87
142
  };
88
143
  AiChatHeader.style = aiChatHeaderCss();
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bs23yVuF.js');
4
- var iconRegistry = require('./icon-registry-BKb9-2Nt.js');
3
+ var index = require('./index-BQ8Az7-D.js');
4
+ var iconRegistry = require('./icon-registry-D-m8GW4D.js');
5
5
 
6
6
  /*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */
7
7
 
@@ -1522,7 +1522,13 @@ const AiChatMessage = class {
1522
1522
  getRenderedContent() {
1523
1523
  if (!this.content)
1524
1524
  return '';
1525
- return purify.sanitize(this.parseMarkdown(this.content), SANITIZE_CONFIG);
1525
+ try {
1526
+ return purify.sanitize(this.parseMarkdown(this.content), SANITIZE_CONFIG);
1527
+ }
1528
+ catch {
1529
+ // Fallback: render raw text safely if markdown parsing fails
1530
+ return purify.sanitize(`<p>${this.content.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, '<br>')}</p>`, SANITIZE_CONFIG);
1531
+ }
1526
1532
  }
1527
1533
  getRelativeTime() {
1528
1534
  if (!this.timestamp)
@@ -1591,7 +1597,7 @@ const AiChatMessage = class {
1591
1597
  } })), index.h("slot", null), showActions && this.renderActionsBar()), (this.agentName || this.timestamp) && (index.h("div", { class: "agent-info" }, this.agentName && index.h("span", { class: "agent-info-name" }, this.agentName), this.agentName && this.timestamp && this.renderIcon('eclipse', 10), this.timestamp && index.h("span", { class: "agent-info-time" }, this.getRelativeTime()))))));
1592
1598
  }
1593
1599
  render() {
1594
- return index.h(index.Host, { key: '004ac6918ec7ec7e960ca6fd3f75edb13529bf71' }, this.role === 'user' ? this.renderUserMessage() : this.renderAgentMessage());
1600
+ return index.h(index.Host, { key: 'b6fe466c9830e69c3ae6f405daa9e77ef3f75aca' }, this.role === 'user' ? this.renderUserMessage() : this.renderAgentMessage());
1595
1601
  }
1596
1602
  };
1597
1603
  AiChatMessage.style = aiChatMessageCss();
@@ -1,15 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bs23yVuF.js');
4
- var iconRegistry = require('./icon-registry-BKb9-2Nt.js');
3
+ var index = require('./index-BQ8Az7-D.js');
4
+ var iconRegistry = require('./icon-registry-D-m8GW4D.js');
5
5
 
6
- const aiConversationListCss = () => `:host{display:block;height:100%}.conversation-list{display:flex;flex-direction:column;gap:8px;height:100%;background:var(--ai-bg-surface)}.list-scroll{flex:1;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) var(--ai-scrollbar-track)}.list-scroll::-webkit-scrollbar{width:4px}.list-scroll::-webkit-scrollbar-track{background:var(--ai-scrollbar-track)}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:4px}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient);background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}`;
6
+ const aiConversationListCss = () => `:host{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden}.conversation-list{display:flex;flex-direction:column;gap:8px;flex:1;min-height:0;background:var(--ai-bg-surface)}.list-scroll{flex:1;min-height:0;overflow-y:auto;padding:0 8px 12px;scrollbar-width:thin;scrollbar-color:var(--ai-scrollbar-thumb) transparent}.list-scroll::-webkit-scrollbar{width:3px}.list-scroll::-webkit-scrollbar-track{background:transparent}.list-scroll::-webkit-scrollbar-thumb{background:var(--ai-scrollbar-thumb);border-radius:99px}.list-scroll::-webkit-scrollbar-thumb:hover{background:var(--ai-scrollbar-thumb-hover)}.conv-item{display:flex;align-items:flex-start;gap:6px;margin-top:6px;padding:10px 10px 10px 6px;border-radius:10px;cursor:pointer;transition:background 0.15s;position:relative}.conv-item:hover{background:var(--ai-bg-card)}.conv-item--active{background:var(--ai-bg-card);box-shadow:var(--ai-shadow-sm)}.conv-item__body{flex:1;min-width:0}.conv-item__title{margin:0 0 3px;font-size:13px;font-weight:600;color:var(--ai-text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.conv-item__preview{margin:0 0 5px;font-size:12px;color:var(--ai-text-muted);line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conv-item__meta{display:flex;align-items:center;gap:8px}.conv-item__time{font-size:11px;color:var(--ai-text-muted);flex-shrink:0}.rating-dots{display:flex;align-items:center;gap:3px}.rating-dot{width:6px;height:6px;border-radius:50%;background:var(--ai-border-default);transition:background 0.15s}.rating-dot--filled{background:var(--ai-accent-warning, #ffaf44)}.delete-btn{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;background:transparent;border:none;border-radius:6px;cursor:pointer;color:var(--ai-text-muted);opacity:0;transition:opacity 0.15s, background 0.15s, color 0.15s;margin-block-start:2px}.conv-item:hover .delete-btn,.conv-item--active .delete-btn{opacity:1}.delete-btn:hover{background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444)}.delete-btn .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.empty-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-bg-card);color:var(--ai-text-muted);line-height:0}.empty-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.empty-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 16px;text-align:center}.error-state__icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;background:var(--ai-status-danger-bg, rgba(239, 68, 68, 0.1));color:var(--ai-status-danger, #ef4444);line-height:0}.error-state__icon .icon-wrap{display:inline-flex;align-items:center;line-height:0}.error-state__text{margin:0;font-size:13px;color:var(--ai-text-muted);line-height:1.4}.error-state__retry{display:inline-flex;align-items:center;gap:4px;margin-top:4px;padding:6px 14px;font-size:12px;font-weight:600;color:var(--ai-text-primary);background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:8px;cursor:pointer;transition:background 0.15s, box-shadow 0.15s}.error-state__retry:hover{box-shadow:var(--ai-shadow-sm)}.error-state__retry .icon-wrap{display:inline-flex;align-items:center;line-height:0}.skeleton-list{display:flex;flex-direction:column;gap:4px}.skeleton-item{padding:10px;border-radius:10px;display:flex;flex-direction:column;gap:6px}.skeleton-line{border-radius:6px;background:var(--ai-shimmer-gradient, linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.06) 75%));background-size:200% 100%;animation:shimmer 2s linear infinite;height:12px}.skeleton-line--title{width:65%;height:13px}.skeleton-line--preview{width:100%}.skeleton-line--meta{width:35%;height:10px}@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}`;
7
7
 
8
8
  const AiConversationList = class {
9
9
  constructor(hostRef) {
10
10
  index.registerInstance(this, hostRef);
11
11
  this.conversationSelect = index.createEvent(this, "conversationSelect");
12
12
  this.conversationDelete = index.createEvent(this, "conversationDelete");
13
+ this.retryClick = index.createEvent(this, "retryClick");
13
14
  }
14
15
  /** JSON array of ConversationItem */
15
16
  items = [];
@@ -17,8 +18,17 @@ const AiConversationList = class {
17
18
  activeId = '';
18
19
  /** Show skeleton loading state */
19
20
  loading = false;
21
+ /** Text shown when the list is empty */
22
+ emptyText = 'لا توجد محادثات';
23
+ /** Show error state when fetching conversations fails */
24
+ error = false;
25
+ /** Error message text */
26
+ errorText = 'تعذّر تحميل المحادثات';
27
+ /** Retry button label for error state */
28
+ retryLabel = 'إعادة المحاولة';
20
29
  conversationSelect;
21
30
  conversationDelete;
31
+ retryClick;
22
32
  renderIcon(name, width, height) {
23
33
  const icon = iconRegistry.iconRegistry[name];
24
34
  if (!icon)
@@ -27,8 +37,12 @@ const AiConversationList = class {
27
37
  return index.h("span", { class: "icon-wrap", innerHTML: svg });
28
38
  }
29
39
  formatRelativeTime(timestamp) {
40
+ if (!timestamp)
41
+ return '';
30
42
  try {
31
43
  const date = new Date(timestamp);
44
+ if (isNaN(date.getTime()))
45
+ return timestamp;
32
46
  const diffMs = Date.now() - date.getTime();
33
47
  const diffMin = Math.floor(diffMs / 60000);
34
48
  const diffHour = Math.floor(diffMin / 60);
@@ -44,7 +58,7 @@ const AiConversationList = class {
44
58
  return rtf.format(-diffDay, 'day');
45
59
  }
46
60
  catch {
47
- return '';
61
+ return timestamp;
48
62
  }
49
63
  }
50
64
  renderRatingDots(rating) {
@@ -54,16 +68,27 @@ const AiConversationList = class {
54
68
  renderSkeleton() {
55
69
  return (index.h("div", { class: "skeleton-list" }, [1, 2, 3, 4].map(i => (index.h("div", { key: i, class: "skeleton-item" }, index.h("div", { class: "skeleton-line skeleton-line--title" }), index.h("div", { class: "skeleton-line skeleton-line--preview" }), index.h("div", { class: "skeleton-line skeleton-line--meta" }))))));
56
70
  }
71
+ renderEmpty() {
72
+ return (index.h("div", { class: "empty-state" }, index.h("div", { class: "empty-state__icon" }, this.renderIcon('list', 24, 24)), index.h("p", { class: "empty-state__text" }, this.emptyText)));
73
+ }
74
+ renderError() {
75
+ return (index.h("div", { class: "error-state" }, index.h("div", { class: "error-state__icon" }, this.renderIcon('wifi-off', 24, 24)), index.h("p", { class: "error-state__text" }, this.errorText), index.h("button", { class: "error-state__retry", onClick: () => this.retryClick.emit() }, this.renderIcon('reload', 14, 14), index.h("span", null, this.retryLabel))));
76
+ }
57
77
  render() {
58
- return (index.h(index.Host, { key: 'b67df60c8d758fdf42afec98e4322b3560abc212' }, index.h("div", { key: '13a7d396f253ba185edb3ad3cc97a7468d5209dc', class: "conversation-list" }, index.h("div", { key: 'efacc2632ca9ae8b5b3b68f3751b390879517e06', class: "list-scroll", role: "list" }, this.loading
78
+ const showEmpty = !this.loading && !this.error && this.items.length === 0;
79
+ return (index.h(index.Host, { key: 'f869a0422848385a43512486a021e3932e51589d' }, index.h("div", { key: 'b0f78202691e6329b9a73987f499c20d89b86c4b', class: "conversation-list" }, index.h("div", { key: '5a007fffa3fe9ef16445395966b1e14d2f516cf9', class: "list-scroll", role: "list" }, this.loading
59
80
  ? this.renderSkeleton()
60
- : this.items.map(item => {
61
- const isActive = item.id === this.activeId;
62
- return (index.h("div", { key: item.id, class: { 'conv-item': true, 'conv-item--active': isActive }, role: "listitem", "aria-current": isActive ? 'true' : undefined, onClick: () => this.conversationSelect.emit(item.id) }, index.h("div", { class: "conv-item__body" }, index.h("p", { class: "conv-item__title" }, item.title), index.h("p", { class: "conv-item__preview" }, item.preview), index.h("div", { class: "conv-item__meta" }, index.h("span", { class: "conv-item__time" }, this.formatRelativeTime(item.timestamp)), item.rating != null && this.renderRatingDots(item.rating))), index.h("button", { class: "delete-btn", "aria-label": "\u062D\u0630\u0641 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629", onClick: e => {
63
- e.stopPropagation();
64
- this.conversationDelete.emit(item.id);
65
- } }, this.renderIcon('cancel', 14, 14))));
66
- })))));
81
+ : this.error
82
+ ? this.renderError()
83
+ : showEmpty
84
+ ? this.renderEmpty()
85
+ : this.items.map(item => {
86
+ const isActive = item.id === this.activeId;
87
+ return (index.h("div", { key: item.id, class: { 'conv-item': true, 'conv-item--active': isActive }, role: "listitem", "aria-current": isActive ? 'true' : undefined, onClick: () => this.conversationSelect.emit(item.id) }, index.h("div", { class: "conv-item__body" }, index.h("p", { class: "conv-item__title" }, item.title), index.h("p", { class: "conv-item__preview" }, item.preview), index.h("div", { class: "conv-item__meta" }, index.h("span", { class: "conv-item__time" }, this.formatRelativeTime(item.timestamp)), item.rating != null && this.renderRatingDots(item.rating))), index.h("button", { class: "delete-btn", "aria-label": "\u062D\u0630\u0641 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629", onClick: e => {
88
+ e.stopPropagation();
89
+ this.conversationDelete.emit(item.id);
90
+ } }, this.renderIcon('cancel', 14, 14))));
91
+ })))));
67
92
  }
68
93
  };
69
94
  AiConversationList.style = aiConversationListCss();
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bs23yVuF.js');
4
- var iconRegistry = require('./icon-registry-BKb9-2Nt.js');
3
+ var index = require('./index-BQ8Az7-D.js');
4
+ var iconRegistry = require('./icon-registry-D-m8GW4D.js');
5
5
 
6
6
  const aiConversationSummaryCss = () => `:host{display:block}.icon-wrap{display:inline-flex;align-items:center;justify-content:center;line-height:0}.summary-card{background:var(--ai-bg-card);border:1px solid var(--ai-border-default);border-radius:16px;box-shadow:var(--ai-shadow-sm);overflow:hidden;animation:fade-in 0.3s ease}@keyframes fade-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.summary-header{display:flex;align-items:center;gap:8px;padding:14px 16px;border-bottom:1px solid var(--ai-border-default)}.sparkle-avatar{width:24px;height:24px;border-radius:9999px;background:var(--ai-bg-surface);box-shadow:var(--ai-shadow-inner);display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--ai-amber)}.summary-title{font-size:15px;font-weight:500;color:var(--ai-text-primary);flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.summary-badges{display:inline-flex;align-items:center;gap:6px;flex-shrink:0}.badge{display:inline-flex;align-items:center;gap:3px;font-size:11px;font-weight:500;color:var(--ai-accent-dark);background:var(--ai-accent-bg);padding:2px 8px;border-radius:9999px;white-space:nowrap}.lang-badge{color:var(--ai-text-secondary);background:var(--ai-bg-surface)}.summary-body{margin:0;padding:12px 16px;font-size:14px;color:var(--ai-text-secondary);line-height:1.6;border-bottom:1px solid var(--ai-border-default)}.summary-slot{padding:12px 16px}.summary-slot:empty{display:none}`;
7
7
 
@@ -25,7 +25,7 @@ const AiConversationSummary = class {
25
25
  return index.h("span", { class: "icon-wrap", innerHTML: svg });
26
26
  }
27
27
  render() {
28
- return (index.h(index.Host, { key: '7d24574485e990986d6325bbf6f04b52b65e6a2d' }, index.h("div", { key: 'd55f22088754c266516c242228028c486ec94796', class: "summary-card" }, index.h("div", { key: 'b60b8f661a7edbb8a3b133f4a4998eb0ae57371c', class: "summary-header" }, index.h("div", { key: '1a1ce3df47afcf2b92caf2a8fc4dd2c7baca3370', class: "sparkle-avatar" }, this.renderIcon('sparkle', 14, 14)), index.h("span", { key: 'fbebe5e290dfa41a607e32f7159778b5ddb6250c', class: "summary-title" }, this.conversation), index.h("div", { key: '662436df14966ae975116c54dec54bb70ee887f5', class: "summary-badges" }, this.messageCount > 0 && (index.h("span", { key: 'ad3cc08fc5ba060deccafbebe39c53201d520192', class: "badge" }, this.renderIcon('list', 12, 12), this.messageCount)), this.language && (index.h("span", { key: 'c1fb40de5cce02913770604508aceae616bf50c4', class: "badge lang-badge" }, this.language)))), this.summary && (index.h("p", { key: 'd555295af336a739ede2f3453cba567630eaafe1', class: "summary-body", ref: el => el && (el.textContent = this.summary) })), index.h("div", { key: '4cb6f52194b37a037029da491153624749cd9bef', class: "summary-slot" }, index.h("slot", { key: '53cbd9e4d53ae8a51e43960369d7a5b45d7d491d' })))));
28
+ return (index.h(index.Host, { key: 'd8dd368f17be91aaef528ae8092cce78bb19e35a' }, index.h("div", { key: '0460dcf3531e947c8ad6ea9d38fc76a1f0ec687d', class: "summary-card" }, index.h("div", { key: '01d46505f838f90ccc4c2d6e57f7b92982f45bd9', class: "summary-header" }, index.h("div", { key: '33afcdbe1f575a31a04ac7a1de948ab32dc76a83', class: "sparkle-avatar" }, this.renderIcon('sparkle', 14, 14)), index.h("span", { key: 'a645e52868e63ddcc8be501ae4d2a680ec6b3b27', class: "summary-title" }, this.conversation), index.h("div", { key: '14ade251a1136afae789c4d097013686f50a18f7', class: "summary-badges" }, this.messageCount > 0 && (index.h("span", { key: '70bf7e43f5d8f2ee38b2627d7f011d686bbb1b49', class: "badge" }, this.renderIcon('list', 12, 12), this.messageCount)), this.language && (index.h("span", { key: '9ad21900a26a59dabb2a25809995500363768692', class: "badge lang-badge" }, this.language)))), this.summary && (index.h("p", { key: '342007bc9de432fb64f71c84b301fbc802f9d119', class: "summary-body", ref: el => el && (el.textContent = this.summary) })), index.h("div", { key: 'c0ca1841f37918e0e1a805b34f53e2f0b204bbda', class: "summary-slot" }, index.h("slot", { key: '24cf0b383924109ed50aded7929320c1d66f3ea1' })))));
29
29
  }
30
30
  };
31
31
  AiConversationSummary.style = aiConversationSummaryCss();
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Bs23yVuF.js');
4
- var iconRegistry = require('./icon-registry-BKb9-2Nt.js');
3
+ var index = require('./index-BQ8Az7-D.js');
4
+ var iconRegistry = require('./icon-registry-D-m8GW4D.js');
5
5
 
6
6
  const aiIconCss = () => `:host{display:inline-flex;align-items:center;justify-content:center}svg{display:block}`;
7
7
 
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-BQ8Az7-D.js');
4
+
5
+ const aiInChatBrowserCss = () => `:host{display:flex;flex-direction:column;width:calc(100% + 2 * var(--ai-spacing-2xl, 16px));height:calc(100% + 2 * var(--ai-spacing-2xl, 16px));margin:calc(-1 * var(--ai-spacing-2xl, 16px))}.browser-container{display:flex;flex-direction:column;width:100%;height:100%;background:var(--ai-bg-card);overflow:hidden}.browser-content{flex:1;position:relative;overflow:hidden;background:var(--ai-bg-surface)}.browser-iframe{width:100%;height:100%;border:none;display:block;background:var(--ai-bg-card)}.browser-loading{position:absolute;top:0;left:0;right:0;z-index:2;height:3px;overflow:hidden;background:var(--ai-border-light)}.loading-bar{width:40%;height:100%;background:var(--ai-accent);border-radius:2px;animation:browser-loading-slide 1.2s ease-in-out infinite}@keyframes browser-loading-slide{0%{transform:translateX(-100%)}100%{transform:translateX(350%)}}.browser-error{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:8px;padding:24px;text-align:center}.error-text{font-size:14px;font-weight:600;color:var(--ai-text-primary)}.error-url{font-size:12px;color:var(--ai-text-muted);word-break:break-all;max-width:280px}`;
6
+
7
+ const AiInChatBrowser = class {
8
+ constructor(hostRef) {
9
+ index.registerInstance(this, hostRef);
10
+ this.browserClose = index.createEvent(this, "browserClose");
11
+ this.browserOpenExternal = index.createEvent(this, "browserOpenExternal");
12
+ }
13
+ /** The URL to display inside the in-chat browser iframe */
14
+ url = '';
15
+ /** Page title shown in the browser header. Defaults to the URL hostname when empty. */
16
+ pageTitle = '';
17
+ /** Show the drag handle in the header (for floating containers) */
18
+ isDraggable = false;
19
+ /** Fired when the user clicks the back / close button to dismiss the browser */
20
+ browserClose;
21
+ /** Fired when the user clicks the external-link button */
22
+ browserOpenExternal;
23
+ isLoading = true;
24
+ hasError = false;
25
+ onUrlChange() {
26
+ this.isLoading = true;
27
+ this.hasError = false;
28
+ }
29
+ getDisplayTitle() {
30
+ if (this.pageTitle)
31
+ return this.pageTitle;
32
+ try {
33
+ const parsed = new URL(this.url);
34
+ return parsed.hostname;
35
+ }
36
+ catch {
37
+ return this.url || '';
38
+ }
39
+ }
40
+ handleIframeLoad = () => {
41
+ this.isLoading = false;
42
+ };
43
+ handleIframeError = () => {
44
+ this.isLoading = false;
45
+ this.hasError = true;
46
+ };
47
+ handleBack = () => {
48
+ this.browserClose.emit();
49
+ };
50
+ handleOpenExternal = () => {
51
+ if (this.url) {
52
+ window.open(this.url, '_blank', 'noopener,noreferrer');
53
+ }
54
+ this.browserOpenExternal.emit(this.url);
55
+ };
56
+ render() {
57
+ const displayTitle = this.getDisplayTitle();
58
+ return (index.h(index.Host, { key: '8486b7a1506c0eb22dea066adfc98ede9e2542c4' }, index.h("div", { key: '8781447cadcc8f33dba9b6eb6b63e1e1cb6c0cfd', class: "browser-container" }, index.h("ai-chat-header", { key: 'f30265b9050991ccbe61e0eeb53015f9b56c113b', mode: "browser", pageTitle: displayTitle, pageUrl: this.url, isDraggable: this.isDraggable, onBackClick: this.handleBack, onOpenExternal: () => this.handleOpenExternal() }), index.h("div", { key: '2d1ecf5b11e882ab1632278edacf55fa264e1a08', class: "browser-content" }, this.isLoading && (index.h("div", { key: '0e3fc77efa82fb52c5a531b3b30fb81fcee339d8', class: "browser-loading" }, index.h("div", { key: '09db30ff5f494eedfaf7928389abda72dceb9597', class: "loading-bar" }))), this.hasError ? (index.h("div", { class: "browser-error" }, index.h("span", { class: "error-text" }, "\u062A\u0639\u0630\u0651\u0631 \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0635\u0641\u062D\u0629"), index.h("span", { class: "error-url" }, this.url))) : (this.url && (index.h("iframe", { class: "browser-iframe", src: this.url, onLoad: this.handleIframeLoad, onError: this.handleIframeError, sandbox: "allow-scripts allow-same-origin allow-forms allow-popups", referrerPolicy: "no-referrer", title: displayTitle })))))));
59
+ }
60
+ static get watchers() { return {
61
+ "url": [{
62
+ "onUrlChange": 0
63
+ }]
64
+ }; }
65
+ };
66
+ AiInChatBrowser.style = aiInChatBrowserCss();
67
+
68
+ exports.ai_in_chat_browser = AiInChatBrowser;