@chat-leo/chatleo 0.0.0-stage → 2.0.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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chatleo/chatleo.esm.js +1 -0
  3. package/dist/chatleo/index.esm.js +1 -0
  4. package/dist/chatleo/p-43ada232.entry.js +1 -0
  5. package/dist/chatleo/p-4485e141.entry.js +1 -0
  6. package/dist/chatleo/p-BnCPdbII.js +1 -0
  7. package/dist/chatleo/p-C-l90Wre.js +1 -0
  8. package/dist/chatleo/p-DQuL1Twl.js +1 -0
  9. package/dist/chatleo/p-DmL518NK.js +3 -0
  10. package/dist/chatleo/p-aed60255.entry.js +1 -0
  11. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  12. package/dist/cjs/chatleo-avatar_13.cjs.entry.js +2986 -0
  13. package/dist/cjs/chatleo-call-adapter-B2OfC0VZ.js +35 -0
  14. package/dist/cjs/chatleo-chat-input.cjs.entry.js +67 -0
  15. package/dist/cjs/chatleo.cjs.js +25 -0
  16. package/dist/cjs/index-DkSDLR0y.js +56 -0
  17. package/dist/cjs/index-Dxw4YCA_.js +1741 -0
  18. package/dist/cjs/index.cjs.js +7 -0
  19. package/dist/cjs/loader.cjs.js +13 -0
  20. package/dist/cjs/my-component.cjs.entry.js +33 -0
  21. package/dist/collection/__mocks__/stencil-core.js +26 -0
  22. package/dist/collection/collection-manifest.json +27 -0
  23. package/dist/collection/components/chatleo-avatar/chatleo-avatar.css +40 -0
  24. package/dist/collection/components/chatleo-avatar/chatleo-avatar.js +116 -0
  25. package/dist/collection/components/chatleo-chat/chatleo-chat.css +108 -0
  26. package/dist/collection/components/chatleo-chat/chatleo-chat.js +459 -0
  27. package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.css +22 -0
  28. package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.js +105 -0
  29. package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.css +84 -0
  30. package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.js +141 -0
  31. package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.css +149 -0
  32. package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.js +259 -0
  33. package/dist/collection/components/chatleo-component/chatleo-component.css +271 -0
  34. package/dist/collection/components/chatleo-component/chatleo-component.js +1366 -0
  35. package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.css +96 -0
  36. package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.js +231 -0
  37. package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.css +352 -0
  38. package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.js +976 -0
  39. package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.css +169 -0
  40. package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.js +400 -0
  41. package/dist/collection/components/chatleo-room-list/chatleo-room-list.css +111 -0
  42. package/dist/collection/components/chatleo-room-list/chatleo-room-list.js +180 -0
  43. package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.css +110 -0
  44. package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.js +241 -0
  45. package/dist/collection/components/chatleo-room-view/chatleo-room-view.css +93 -0
  46. package/dist/collection/components/chatleo-room-view/chatleo-room-view.js +593 -0
  47. package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.css +284 -0
  48. package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.js +391 -0
  49. package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.css +56 -0
  50. package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.js +149 -0
  51. package/dist/collection/components/my-component/my-component.css +4 -0
  52. package/dist/collection/components/my-component/my-component.js +95 -0
  53. package/dist/collection/index.js +10 -0
  54. package/dist/collection/utils/call-entry.js +34 -0
  55. package/dist/collection/utils/delivery.js +7 -0
  56. package/dist/collection/utils/utils.js +51 -0
  57. package/dist/components/chatleo-avatar.d.ts +11 -0
  58. package/dist/components/chatleo-avatar.js +1 -0
  59. package/dist/components/chatleo-chat-header.d.ts +11 -0
  60. package/dist/components/chatleo-chat-header.js +1 -0
  61. package/dist/components/chatleo-chat-input.d.ts +11 -0
  62. package/dist/components/chatleo-chat-input.js +1 -0
  63. package/dist/components/chatleo-chat-message.d.ts +11 -0
  64. package/dist/components/chatleo-chat-message.js +1 -0
  65. package/dist/components/chatleo-chat.d.ts +11 -0
  66. package/dist/components/chatleo-chat.js +1 -0
  67. package/dist/components/chatleo-component.d.ts +11 -0
  68. package/dist/components/chatleo-component.js +1 -0
  69. package/dist/components/chatleo-new-message-selector.d.ts +11 -0
  70. package/dist/components/chatleo-new-message-selector.js +1 -0
  71. package/dist/components/chatleo-rich-input.d.ts +11 -0
  72. package/dist/components/chatleo-rich-input.js +1 -0
  73. package/dist/components/chatleo-rich-message-renderer.d.ts +11 -0
  74. package/dist/components/chatleo-rich-message-renderer.js +1 -0
  75. package/dist/components/chatleo-room-list.d.ts +11 -0
  76. package/dist/components/chatleo-room-list.js +1 -0
  77. package/dist/components/chatleo-room-tile-component.d.ts +11 -0
  78. package/dist/components/chatleo-room-tile-component.js +1 -0
  79. package/dist/components/chatleo-room-view.d.ts +11 -0
  80. package/dist/components/chatleo-room-view.js +1 -0
  81. package/dist/components/chatleo-tray-component.d.ts +11 -0
  82. package/dist/components/chatleo-tray-component.js +1 -0
  83. package/dist/components/chatleo-user-tile.d.ts +11 -0
  84. package/dist/components/chatleo-user-tile.js +1 -0
  85. package/dist/components/index.d.ts +35 -0
  86. package/dist/components/index.js +1 -0
  87. package/dist/components/my-component.d.ts +11 -0
  88. package/dist/components/my-component.js +1 -0
  89. package/dist/components/p-8kvQ-Uh-.js +1 -0
  90. package/dist/components/p-B7cdqAgv.js +1 -0
  91. package/dist/components/p-BdiOcOYZ.js +1 -0
  92. package/dist/components/p-BlbDSb7D.js +1 -0
  93. package/dist/components/p-BnCPdbII.js +1 -0
  94. package/dist/components/p-C-v19aUJ.js +1 -0
  95. package/dist/components/p-C1mF0s8g.js +1 -0
  96. package/dist/components/p-CRtBdzP3.js +1 -0
  97. package/dist/components/p-CfayCm9O.js +1 -0
  98. package/dist/components/p-DGjAxoQy.js +1 -0
  99. package/dist/components/p-Exj_2-yI.js +1 -0
  100. package/dist/components/p-XlwGxsqT.js +1 -0
  101. package/dist/components/p-fjMaTJam.js +1 -0
  102. package/dist/components/p-xt4kzz3B.js +1 -0
  103. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  104. package/dist/esm/chatleo-avatar_13.entry.js +2972 -0
  105. package/dist/esm/chatleo-call-adapter-BnCPdbII.js +33 -0
  106. package/dist/esm/chatleo-chat-input.entry.js +65 -0
  107. package/dist/esm/chatleo.js +21 -0
  108. package/dist/esm/index-C-l90Wre.js +53 -0
  109. package/dist/esm/index-DmL518NK.js +1733 -0
  110. package/dist/esm/index.js +1 -0
  111. package/dist/esm/loader.js +11 -0
  112. package/dist/esm/my-component.entry.js +31 -0
  113. package/dist/index.cjs.js +1 -0
  114. package/dist/index.js +1 -0
  115. package/dist/types/__mocks__/stencil-core.d.ts +24 -0
  116. package/dist/types/components/chatleo-avatar/chatleo-avatar.d.ts +27 -0
  117. package/dist/types/components/chatleo-chat/chatleo-chat.d.ts +75 -0
  118. package/dist/types/components/chatleo-chat-header/chatleo-chat-header.d.ts +27 -0
  119. package/dist/types/components/chatleo-chat-input/chatleo-chat-input.d.ts +31 -0
  120. package/dist/types/components/chatleo-chat-message/chatleo-chat-message.d.ts +22 -0
  121. package/dist/types/components/chatleo-component/chatleo-component.d.ts +278 -0
  122. package/dist/types/components/chatleo-new-message-selector/chatleo-new-message-selector.d.ts +68 -0
  123. package/dist/types/components/chatleo-rich-input/chatleo-rich-input.d.ts +216 -0
  124. package/dist/types/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.d.ts +77 -0
  125. package/dist/types/components/chatleo-room-list/chatleo-room-list.d.ts +52 -0
  126. package/dist/types/components/chatleo-room-tile-component/chatleo-room-tile-component.d.ts +59 -0
  127. package/dist/types/components/chatleo-room-view/chatleo-room-view.d.ts +91 -0
  128. package/dist/types/components/chatleo-tray-component/chatleo-tray-component.d.ts +112 -0
  129. package/dist/types/components/chatleo-user-tile/chatleo-user-tile.d.ts +36 -0
  130. package/dist/types/components/my-component/my-component.d.ts +16 -0
  131. package/dist/types/components.d.ts +1593 -0
  132. package/dist/types/index.d.ts +12 -0
  133. package/dist/types/stencil-public-runtime.d.ts +1879 -0
  134. package/dist/types/utils/call-entry.d.ts +9 -0
  135. package/dist/types/utils/delivery.d.ts +7 -0
  136. package/dist/types/utils/utils.d.ts +24 -0
  137. package/loader/cdn.js +1 -0
  138. package/loader/index.cjs.js +1 -0
  139. package/loader/index.d.ts +24 -0
  140. package/loader/index.es2017.js +1 -0
  141. package/loader/index.js +2 -0
  142. package/package.json +70 -3
  143. package/readme.md +111 -0
  144. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ function t(t,e,n){const o="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==o;){const o=Object.getOwnPropertyDescriptor(t,e);if(o&&(!n||o.get))return o;t=Object.getPrototypeOf(t)}}var e,n=(e,n)=>{var o;Object.entries(null!=(o=n.o.t)?o:{}).map((([o,[l]])=>{if(31&l||32&l){const l=e[o],s=t(Object.getPrototypeOf(e),o,!0)||Object.getOwnPropertyDescriptor(e,o);s&&Object.defineProperty(e,o,{get(){return s.get.call(this)},set(t){s.set.call(this,t)},configurable:!0,enumerable:!0}),n.l.has(o)?e[o]=n.l.get(o):void 0!==l&&(e[o]=l)}}))},o=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},l=(t,e)=>e in t,s=(t,e)=>(0,console.error)(t,e),i=new Map,r="undefined"!=typeof window?window:{},c=r.HTMLElement||class{},f={i:0,u:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},u=(()=>{var t;let e=!1;try{null==(t=r.document)||t.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch(t){}return e})(),a=(()=>{try{return!!r.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),d=!!a&&(()=>!!r.document&&Object.getOwnPropertyDescriptor(r.document.adoptedStyleSheets,"length").writable)(),p=!1,h=[],v=[],m=()=>{var t;return(null==(t=r.document)?void 0:t.hidden)?setTimeout($,16):f.raf($)},b=(t,e)=>n=>{t.push(n),p||(p=!0,e&&4&f.i?g($):m())},y=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){s(t)}t.length=0},$=()=>{y(h),y(v),(p=h.length>0)&&m()},g=t=>Promise.resolve(undefined).then(t),w=b(v,!0),j=t=>{const e=new URL(t,f.u);return e.origin!==r.location.origin?e.href:e.pathname},O=t=>f.u=t;function S(){const t=this.attachShadow({mode:"open"});void 0===e&&(e=null),e&&(d?t.adoptedStyleSheets.push(e):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e])}var k,M=new WeakMap,E=t=>"sc-"+t.p,x=t=>"object"==(t=typeof t)||"function"===t,C=(t,e,...n)=>{let o=null,l=null,i=!1,r=!1;const c=[],f=e=>{for(let n=0;n<e.length;n++)if(o=e[n],Array.isArray(o))f(o);else if(null!=o&&"boolean"!=typeof o){if(i="function"!=typeof t&&!x(o))o=String(o);else if("function"!=typeof t&&void 0===o.i){s("Invalid vNode child");continue}i&&r?c[c.length-1].h+=o:c.push(i?N(null,o):o),r=i}};if(f(n),e){e.key&&(l=e.key);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}if("function"==typeof t)return t(null===e?{}:e,c,L);const u=N(t,null);return u.v=e,c.length>0&&(u.m=c),u.$=l,u},N=(t,e)=>({i:0,j:t,h:null!=e?e:null,O:null,m:null,v:null,$:null}),A={},L={forEach:(t,e)=>t.map(_).forEach(e),map:(t,e)=>t.map(_).map(e).map(D)},_=t=>({vattrs:t.v,vchildren:t.m,vkey:t.$,vname:t.S,vtag:t.j,vtext:t.h}),D=t=>{if("function"==typeof t.vtag){const e={...t.vattrs};return t.vkey&&(e.key=t.vkey),t.vname&&(e.name=t.vname),C(t.vtag,e,...t.vchildren||[])}const e=N(t.vtag,t.vtext);return e.v=t.vattrs,e.m=t.vchildren,e.$=t.vkey,e.S=t.vname,e},H=t=>{if(!t)return;const e=Object.keys(t);if(0===e.length)return;let n=!1;for(const o of e){if(n)break;for(const e of t[o])if("string"==typeof e){n=!0;break}}if(!n)return t;const o={};for(const n of e)o[n]=t[n].map((t=>"string"==typeof t?{[t]:0}:t));return o},P=(t,e)=>null==t||x(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?"string"==typeof t?parseFloat(t):"number"==typeof t?t:NaN:1&e?String(t):t,R=(t,e)=>{const n=t;return{emit:t=>U(n,e,{bubbles:!0,composed:!0,cancelable:!0,detail:t})}},U=(t,e,n)=>{const o=f.ce(e,n);return t.dispatchEvent(o),o},W=(t,e,n,s,i,c)=>{if(n===s)return;let u=l(t,e),a=e.toLowerCase();if("class"===e){const e=t.classList,o=q(n);let l=q(s);{let t=o.filter((t=>t&&!l.includes(t)));e.remove(...t),e.add(...l.filter((t=>t&&!o.includes(t))))}}else if("style"===e){for(const e in n)s&&null!=s[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in s)n&&s[e]===n[e]||(e.includes("-")?t.style.setProperty(e,s[e]):t.style[e]=s[e])}else if("key"===e);else if("ref"===e)s&&ot(s,t);else if(t.__lookupSetter__(e)||"o"!==e[0]||"n"!==e[1]){if("a"===e[0]&&e.startsWith("attr:")){const n=e.slice(5);let l;{const e=o(t);if(e&&e.o&&e.o.t){const t=e.o.t[n];t&&t[1]&&(l=t[1])}}return l||(l=n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==s||!1===s?!1===s&&""!==t.getAttribute(l)||t.removeAttribute(l):t.setAttribute(l,!0===s?"":s))}if("p"===e[0]&&e.startsWith("prop:")){const n=e.slice(5);try{t[n]=s}catch(t){}return}{const o=x(s);if((u||o&&null!==s)&&!i)try{if(t.tagName.includes("-"))t[e]!==s&&(t[e]=s);else{const o=null==s?"":s;"list"===e?u=!1:null!=n&&t[e]===o||("function"==typeof t.__lookupSetter__(e)?t[e]=o:t.setAttribute(e,o))}}catch(t){}null==s||!1===s?(!1!==s||""===t.getAttribute(e)||4&c&&!F(e))&&t.removeAttribute(e):(!u||4&c||i)&&!o&&1===t.nodeType&&t.setAttribute(e,s=!0===s?"":s)}}else if(e="-"===e[2]?e.slice(3):l(r,a)?a.slice(2):a[2]+e.slice(3),n||s){const o=e.endsWith(z);e=e.replace(I,""),n&&f.rel(t,e,n,o),s&&f.ael(t,e,s,o)}},T=new Set(["draggable","contenteditable","spellcheck"]),F=t=>T.has(t)||t.startsWith("aria-"),V=/\s/,q=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(V):[]),z="Capture",I=new RegExp(z+"$"),Y=(t,e,n)=>{const o=11===e.O.nodeType&&e.O.host?e.O.host:e.O,l=t&&t.v||{},s=e.v||{};for(const t of Z(Object.keys(l)))t in s||W(o,t,l[t],void 0,n,e.i);for(const t of Z(Object.keys(s)))W(o,t,l[t],s[t],n,e.i)};function Z(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var B=!1,G=[],J=[],K=(t,e,n)=>{const o=e.m[n];let l,s,i=0;if(null!=o.h)l=o.O=r.document.createTextNode(o.h);else{if(B||(B="svg"===o.j),!r.document)throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(l=o.O=r.document.createElementNS(B?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",o.j),B&&"foreignObject"===o.j&&(B=!1),Y(null,o,B),o.m){const e="template"===o.j?l.content:l;for(i=0;i<o.m.length;++i)s=K(t,o,i),s&&e.appendChild(s)}"svg"===o.j?B=!1:"foreignObject"===l.tagName&&(B=!0)}return l["s-hn"]=k,l},Q=(t,e,n,o,l,s)=>{let i,r=t;for(r.shadowRoot&&r.tagName===k&&(r=r.shadowRoot),"template"===n.j&&(r=r.content);l<=s;++l)o[l]&&(i=K(null,n,l),i&&(o[l].O=i,lt(r,i,e)))},X=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.O;nt(e),t&&t.remove()}}},tt=(t,e,n=!1)=>t.j===e.j&&(n?(n&&!t.$&&e.$&&(t.$=e.$),!0):t.$===e.$),et=(t,e,n=!1)=>{const o=e.O=t.O,l=t.m,s=e.m,i=e.j,r=e.h;null==r?(Y(t,e,B="svg"===i||"foreignObject"!==i&&B),null!==l&&null!==s?((t,e,n,o,l=!1)=>{let s,i,r=0,c=0,f=0,u=0,a=e.length-1,d=e[0],p=e[a],h=o.length-1,v=o[0],m=o[h];const b="template"===n.j?t.content:t;for(;r<=a&&c<=h;)if(null==d)d=e[++r];else if(null==p)p=e[--a];else if(null==v)v=o[++c];else if(null==m)m=o[--h];else if(tt(d,v,l))et(d,v,l),d=e[++r],v=o[++c];else if(tt(p,m,l))et(p,m,l),p=e[--a],m=o[--h];else if(tt(d,m,l))et(d,m,l),lt(b,d.O,p.O.nextSibling),d=e[++r],m=o[--h];else if(tt(p,v,l))et(p,v,l),lt(b,p.O,d.O),p=e[--a],v=o[++c];else{for(f=-1,u=r;u<=a;++u)if(e[u]&&null!==e[u].$&&e[u].$===v.$){f=u;break}f>=0?(i=e[f],i.j!==v.j?s=K(e&&e[c],n,c):(et(i,v,l),e[f]=void 0,s=i.O),v=o[++c]):(s=K(e&&e[c],n,c),v=o[++c]),s&&lt(d.O.parentNode,s,d.O)}r>a?Q(t,null==o[h+1]?null:o[h+1].O,n,o,c,h):c>h&&X(e,r,a)})(o,l,e,s,n):null!==s?(null!==t.h&&(o.textContent=""),Q(o,null,e,s,0,s.length-1)):!n&&null!==l&&X(l,0,l.length-1),B&&"svg"===i&&(B=!1)):t.h!==r&&(o.data=r)},nt=t=>{t.v&&t.v.ref&&G.push((()=>t.v.ref(null))),t.m&&t.m.map(nt)},ot=(t,e)=>{J.push((()=>t(e)))},lt=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),st=(t,e,n=!1)=>{const o=t.$hostElement$,l=t.k||N(null,null);var s;const i=(s=e)&&s.j===A?e:C(null,null,e);if(k=o.tagName,n&&i.v)for(const t of Object.keys(i.v))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(i.v[t]=o[t]);i.j=null,i.i|=4,t.k=i,i.O=l.O=o.shadowRoot||o,et(l,i,n),G.forEach((t=>t())),G.length=0,J.forEach((t=>t())),J.length=0},it=(t,e)=>{if(e&&!t.M&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.M=()=>{e["s-p"].splice(n-1,1),o()})))}},rt=(t,e)=>{if(t.i|=16,4&t.i)return void(t.i|=512);it(t,t.C);const n=()=>ct(t,e);if(!e)return w(n);queueMicrotask((()=>{n()}))},ct=(t,e)=>{const n=t.$hostElement$,o=n;if(!o)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return l=vt(o,e?"componentWillLoad":"componentWillUpdate",void 0,n),l=ft(l,(()=>vt(o,"componentWillRender",void 0,n))),ft(l,(()=>at(t,o,e)))},ft=(t,e)=>ut(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),ut=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,at=async(t,e,n)=>{var o;const l=t.$hostElement$,s=l["s-rc"];n&&(t=>{const e=t.o,n=t.$hostElement$,o=e.i,l=((t,e)=>{var n,o,l;const s=E(e),c=i.get(s);if(!r.document)return s;if(t=11===t.nodeType?t:r.document,c)if("string"==typeof c){let l,i=M.get(t=t.head||t);if(i||M.set(t,i=new Set),!i.has(s)){l=r.document.createElement("style"),l.textContent=c;const u=null!=(n=f.N)?n:function(){var t,e,n;return null!=(n=null==(e=null==(t=r.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?n:void 0}();if(null!=u&&l.setAttribute("nonce",u),!(1&e.i))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(a){const e=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(c),d?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.textContent=c+e.textContent:t.prepend(l)}else t.append(l);1&e.i&&t.insertBefore(l,null),4&e.i&&(l.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),i&&i.add(s)}}else{let e=M.get(t);if(e||M.set(t,e=new Set),!e.has(s)){const n=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(c.constructor===n.CSSStyleSheet)o=c;else{o=new n.CSSStyleSheet;for(let t=0;t<c.cssRules.length;t++)o.insertRule(c.cssRules[t].cssText,t)}d?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],e.add(s)}}return s})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&o&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);dt(t,e,l,n),s&&(s.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>pt(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.i|=4,e.length=0)}},dt=(t,e,n,o)=>{try{e=e.render(),t.i&=-17,t.i|=2,st(t,e,o)}catch(e){s(e,t.$hostElement$)}return null},pt=t=>{const e=t.$hostElement$,n=e,o=t.C;vt(n,"componentDidRender",void 0,e),64&t.i?vt(n,"componentDidUpdate",void 0,e):(t.i|=64,mt(e),vt(n,"componentDidLoad",void 0,e),t.A(e),o||ht()),t.M&&(t.M(),t.M=void 0),512&t.i&&g((()=>rt(t,!1))),t.i&=-517},ht=()=>{g((()=>U(r,"appload",{detail:{namespace:"chatleo"}})))},vt=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){s(t,o)}},mt=t=>t.classList.add("hydrated"),bt=(t,e,n,l)=>{const i=o(t);if(!i)return;const r=t,c=i.l.get(e),f=i.i,u=r;n=P(n,l.t[e][0]);const a=Number.isNaN(c)&&Number.isNaN(n);if(n!==c&&!a){if(i.l.set(e,n),l.L){const t=l.L[e];t&&t.map((t=>{try{const[[o,l]]=Object.entries(t);(128&f||1&l)&&(u?u[o](n,c,e):i._.push((()=>{i.D[o](n,c,e)})))}catch(t){s(t,r)}}))}if(2&f){if(u.componentShouldUpdate&&!1===u.componentShouldUpdate(n,c,e)&&!(16&f))return;16&f||rt(i,!1)}}},yt=(e,n)=>{var l,s;const i=e.prototype;{e.watchers&&!n.L&&(n.L=H(e.watchers)),e.deserializers&&!n.H&&(n.H=e.deserializers),e.serializers&&!n.P&&(n.P=e.serializers);const r=Object.entries(null!=(l=n.t)?l:{});r.map((([e,[l]])=>{if(31&l||32&l){const{get:s,set:r}=t(i,e)||{};s&&(n.t[e][0]|=2048),r&&(n.t[e][0]|=4096),Object.defineProperty(i,e,{get(){return s?s.apply(this):(t=e,o(this).l.get(t));var t},configurable:!0,enumerable:!0}),Object.defineProperty(i,e,{set(t){const s=o(this);if(s){if(r)return void 0===(32&l?this[e]:s.$hostElement$[e])&&s.l.get(e)&&(t=s.l.get(e)),r.apply(this,[P(t,l)]),void bt(this,e,t=32&l?this[e]:s.$hostElement$[e],n);bt(this,e,t,n)}}})}}));{const t=new Map;i.attributeChangedCallback=function(e,l,s){f.jmp((()=>{var c;const f=t.get(e),u=o(this);if(this.hasOwnProperty(f),i.hasOwnProperty(f)&&"number"==typeof this[f]&&this[f]==s)return;if(null==f){const t=null==u?void 0:u.i;if(u&&t&&!(8&t)&&s!==l){const o=this,i=null==(c=n.L)?void 0:c[e];null==i||i.forEach((n=>{const[[i,r]]=Object.entries(n);null!=o[i]&&(128&t||1&r)&&o[i].call(o,s,l,e)}))}return}const a=r.find((([t])=>t===f)),d=4&(a?a[1][0]:0),p=d&&null===s&&void 0===this[f];d&&(s=null!==s&&"false"!==s);const h=Object.getOwnPropertyDescriptor(i,f);p||s==this[f]||h.get&&!h.set||(this[f]=s)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=n.L)?s:{}),...r.filter((([t,e])=>31&e[0])).map((([e,n])=>{const o=n[1]||e;return t.set(o,e),o}))]))}}return e},$t=async(t,e,n)=>{let o;try{if(!(32&e.i)&&(e.i|=32,e.i&=-1025,o=t.constructor,customElements.whenDefined(t.localName).then((()=>e.i|=128)),o&&o.style)){let t;"string"==typeof o.style&&(t=o.style);const e=E(n);if(!i.has(e)){const o=()=>{};((t,e,n)=>{let o=i.get(t);a&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,i.set(t,o)})(e,t,!!(1&n.i)),o()}}const l=e.C,s=()=>rt(e,!0);l&&l["s-rc"]?l["s-rc"].push(s):s()}catch(n){s(n,t),e.M&&(e.M(),e.M=void 0),!e.A||1024&e.i||e.A(t)}},gt=(t,e)=>{const l={i:e[0],p:e[1]};try{l.t=e[2],l.R=e[3],l.L=H(t.L),l.H=t.H,l.P=t.P;const s=t.prototype.connectedCallback,i=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,e)=>{const o={i:0,$hostElement$:t,o:e,l:new Map,U:new Map};o.W=new Promise((t=>o.A=t)),t["s-p"]=[],t["s-rc"]=[];const l=o;t.__stencil__getHostRef=()=>l,512&e.i&&n(t,o)})(this,l)},connectedCallback(){if(!this.__hasHostListenerAttached){const t=o(this);if(!t)return;wt(this,t,l.R),this.__hasHostListenerAttached=!0}(t=>{if(!(1&f.i)){const e=o(t);if(!e)return;const n=e.o,l=()=>{};if(1&e.i)wt(t,e,n.R),(null==e?void 0:e.D)||(1024&e.i?setTimeout((()=>$t(t,e,n)),1e3):(null==e?void 0:e.W)&&e.W.then((()=>{})));else{e.i|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){it(e,e.C=n);break}}n.t&&Object.entries(n.t).map((([e,[n]])=>{if(31&n&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];delete t[e],t[e]=n}})),$t(t,e,n)}l()}})(this),s&&s.call(this)},disconnectedCallback(){(async t=>{if(!(1&f.i)){const e=o(t);(null==e?void 0:e.T)&&(e.T.map((t=>t())),e.T=void 0)}M.has(t)&&M.delete(t),t.shadowRoot&&M.has(t.shadowRoot)&&M.delete(t.shadowRoot)})(this),i&&i.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw new Error(`Unable to re-use existing shadow root for ${l.p}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else S.call(this,l)}}),Object.defineProperty(t,"is",{value:l.p,configurable:!0}),yt(t,l)}catch(e){return s(e),t}},wt=(t,e,n)=>{n&&r.document&&n.map((([n,o,l])=>{const s=t,i=jt(e,l),r=Ot(n);f.ael(s,o,i,r),(e.T=e.T||[]).push((()=>f.rel(s,o,i,r)))}))},jt=(t,e)=>n=>{try{t.$hostElement$[e](n)}catch(e){s(e,t.$hostElement$)}},Ot=t=>u?{passive:!!(1&t),capture:!!(2&t)}:!!(2&t),St=t=>f.N=t,kt=t=>Object.assign(f,t),Mt=new WeakMap;function Et(t,e){let n=Mt.get(e);n||(n={i:0,o:{i:0,p:e.tagName},$hostElement$:e},Mt.set(e,n)),st(n,t)}function xt(t){return t}export{c as H,St as a,kt as b,R as c,j as g,C as h,gt as p,Et as r,O as s,xt as t}
@@ -0,0 +1 @@
1
+ import{t,p as e,H as n,c as a,h as i}from"./p-C-v19aUJ.js";const o=e(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.contentChange=a(this,"contentChange"),this.messageSend=a(this,"messageSend")}get hostElement(){return this}disabled=!1;placeholder="Write a message...";maxHeight="200px";acceptFiles="image/*,.pdf,.doc,.docx,.txt";isDragOver=!1;hasContent=!1;contentChange;messageSend;editorRef;fileInputRef;async getText(){return this.editorRef?.innerText??""}async setText(t){this.editorRef&&(this.editorRef.innerText=t??"",this.placeCaretAtEnd(this.editorRef),this.emitContentChange())}async addFiles(t){t?.length&&await this.handleFiles(t)}async focusEditor(){this.editorRef&&(this.editorRef.focus(),this.placeCaretAtEnd(this.editorRef))}generateAttachmentId(){return crypto.randomUUID()}isImageFile(t){return t.type.startsWith("image/")}async generateThumbnail(t){if(this.isImageFile(t))return new Promise((e=>{const n=new FileReader;n.onload=t=>{const n=new Image;n.onload=()=>{const t=document.createElement("canvas"),a=t.getContext("2d"),i=100;let{width:o,height:r}=n;o>r?o>i&&(r*=i/o,o=i):r>i&&(o*=i/r,r=i),t.width=o,t.height=r,a?.drawImage(n,0,0,o,r),e(t.toDataURL("image/jpeg",.8))},n.src=t.target?.result},n.readAsDataURL(t)}))}async handleFiles(t){const e=Array.from(t),n=[];for(const t of e){const e={mime_type:t.type,id:this.generateAttachmentId(),file:t,name:t.name,size:t.size};e.mime_type.startsWith("image")&&(e.preview=await this.generateThumbnail(t)),n.push(e)}n.length>0&&this.insertAttachmentsAtCursor(n),this.emitContentChange()}getEditorSelection(){if(!this.editorRef)return null;const t=this.hostElement.shadowRoot,e=t&&"function"==typeof t.getSelection?t.getSelection():window.getSelection();if(!e||0===e.rangeCount)return null;const n=e.anchorNode;return n&&this.editorRef.contains(n)?e:null}placeCaretAtEnd(t){const e=document.createRange();e.selectNodeContents(t),e.collapse(!1);const n=this.hostElement.shadowRoot?.getSelection?.()??window.getSelection();n?.removeAllRanges(),n?.addRange(e)}insertAttachmentsAtCursor(t){if(!this.editorRef)return;const e=this.createAttachmentBlock(t);this.editorRef.focus();let n=this.getEditorSelection();if(n||(this.placeCaretAtEnd(this.editorRef),n=this.getEditorSelection()),n&&n.rangeCount>0){const t=n.getRangeAt(0);if(t.startContainer.nodeType===Node.TEXT_NODE&&t.startOffset>0){t.setStart(t.startContainer,t.startContainer.textContent?.length||0),t.collapse(!0);const e=document.createElement("br");t.insertNode(e),t.setStartAfter(e)}t.insertNode(e);const a=document.createElement("br");return t.setStartAfter(e),t.insertNode(a),t.setStartAfter(a),t.collapse(!0),n.removeAllRanges(),void n.addRange(t)}this.editorRef.innerHTML.trim()&&!this.editorRef.innerHTML.endsWith("<br>")&&this.editorRef.appendChild(document.createElement("br")),this.editorRef.appendChild(e);const a=document.createElement("br");this.editorRef.appendChild(a),this.placeCaretAtEnd(this.editorRef)}createAttachmentBlock(t){const e=document.createElement("div");e.className="attachment-block",e.contentEditable="false",1===t.length&&(e.setAttribute("data-attachment-id",t[0].id),e._attachmentData=t[0]),e._attachmentsData=t;const n=document.createElement("div");return n.className="attachment-content",t.forEach((t=>{const a=document.createElement("div");if(a.className="attachment-item",t.mime_type.startsWith("image")&&t.preview){const e=document.createElement("img");e.src=t.preview,e.alt=t.name,e.className="attachment-thumbnail",a.appendChild(e)}else{const t=document.createElement("div");t.className="attachment-icon",t.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">\n <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n <polyline points="14,2 14,8 20,8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n ',a.appendChild(t)}const i=document.createElement("div");i.className="attachment-info";const o=document.createElement("div");o.className="attachment-name",o.textContent=t.name,i.appendChild(o);const r=document.createElement("div");r.className="attachment-size",r.textContent=this.formatFileSize(t.size),i.appendChild(r),a.appendChild(i);const s=document.createElement("button");s.className="attachment-remove",s.type="button",s.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">\n <path d="M12 4L4 12M4 4l8 8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n ',s.onclick=n=>{n.preventDefault(),n.stopPropagation(),this.removeAttachmentFromBlock(e,t.id)},a.appendChild(s),n.appendChild(a)})),e.appendChild(n),e}removeAttachmentFromBlock(t,e){const n=t._attachmentsData;if(n){const a=n.filter((t=>t.id!==e));if(0===a.length)this.removeAttachmentBlock(t);else{t._attachmentsData=a,1===a.length?(t._attachmentData=a[0],t.setAttribute("data-attachment-id",a[0].id)):(delete t._attachmentData,t.removeAttribute("data-attachment-id"));const e=this.createAttachmentBlock(a);t.replaceWith(e),this.emitContentChange()}}}removeAttachmentBlock(t){if(t.parentNode){const e=t.nextSibling;e&&"BR"===e.nodeName&&e.parentNode?.removeChild(e),t.parentNode.removeChild(t),this.emitContentChange()}}handleInput=()=>{this.emitContentChange()};extractContent(){if(!this.editorRef)return{text:"",attachments:[]};let t="";const e=[];if(document.createTreeWalker){const n=document.createTreeWalker(this.editorRef,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:t=>{if(t.nodeType===Node.TEXT_NODE)return NodeFilter.FILTER_ACCEPT;if(t.nodeType===Node.ELEMENT_NODE){const e=t;if(e.classList.contains("attachment-block"))return NodeFilter.FILTER_ACCEPT;if("BR"===e.tagName)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP}});let a;for(;a=n.nextNode();)if(a.nodeType===Node.TEXT_NODE)t+=a.textContent||"";else if(a.nodeType===Node.ELEMENT_NODE){const n=a;if(n.classList.contains("attachment-block")){const a=n._attachmentsData,i=n._attachmentData;a?e.push(...a):i&&e.push(i),t+="\n[attachment]\n"}else"BR"===n.tagName&&(t+="\n")}}else{const n=[],a=t=>{n.push(t),t.childNodes.forEach(a)};a(this.editorRef);for(const a of n)if(a.nodeType===Node.TEXT_NODE)t+=a.textContent||"";else if(a.nodeType===Node.ELEMENT_NODE){const n=a;if(n.classList.contains("attachment-block")){const a=n._attachmentsData,i=n._attachmentData;a?e.push(...a):i&&e.push(i),t+="\n[attachment]\n"}else"BR"===n.tagName&&(t+="\n")}}return{text:t.trim(),attachments:e}}generateHtmlContent(t){const e=[];for(const n of t)if("text"===n.type){const t=n.content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>");e.push(`<div data-block-id="${n.id}" data-block-type="text">${t}</div>`)}else if("attachment"===n.type){const t=n.attachments,a=t.map((t=>`\n <div class="attachment-item" data-attachment-id="${t.id}" data-attachment-type="${t.mime_type}" data-attachment-name="${this.escapeHtml(t.name)}" data-attachment-size="${t.size}">\n ${t.mime_type?.startsWith("image")&&t.preview?`<img src="${t.preview}" alt="${this.escapeHtml(t.name)}" class="attachment-thumbnail">`:'<div class="attachment-icon">\n <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">\n <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n <polyline points="14,2 14,8 20,8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n </div>'}\n <div class="attachment-info">\n <div class="attachment-name">${this.escapeHtml(t.name)}</div>\n <div class="attachment-size">${this.formatFileSize(t.size)}</div>\n </div>\n </div>\n `)).join("\n");e.push(`\n <div class="attachment-block" data-block-id="${n.id}" data-block-type="attachment" data-attachment-count="${t.length}">\n <div class="attachment-content">\n ${a}\n </div>\n </div>`.trim())}return e.join("\n")}escapeHtml(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}extractStructuredContent(){if(!this.editorRef)return{blocks:[],version:"1.0",html:""};const t=[];let e=0;const n=Array.from(this.editorRef.childNodes);let a="";const i=()=>{if(a.length>0){const n={id:"text_"+ ++e,type:"text",content:a};t.push(n),a=""}};for(const o of n)if(o.nodeType===Node.TEXT_NODE){const t=o.textContent??"";t.length>0&&(a+=t)}else if(o.nodeType===Node.ELEMENT_NODE){const n=o;if(n.classList.contains("attachment-block")){i();const a=n._attachmentsData,o=n._attachmentData;if(a){const n={id:"attachment_"+ ++e,type:"attachment",attachments:a};t.push(n)}else if(o){const n={id:"attachment_"+ ++e,type:"attachment",attachments:[o]};t.push(n)}}else if("BR"===n.tagName)a+="\n";else{const t=n.textContent??"";t.length>0&&(a+=t),this.isBlockElement(n)&&!a.endsWith("\n")&&(a+="\n")}}i();const o=this.generateHtmlContent(t);return{blocks:t,version:"1.0",html:o}}isBlockElement(t){return new Set(["DIV","P","PRE","LI","UL","OL","H1","H2","H3","H4","H5","H6","BLOCKQUOTE"]).has(t.tagName)}handleKeyDown=t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),this.handleSendMessage())};handleFileButtonClick=()=>{this.fileInputRef?.click()};handleFileInputChange=t=>{const e=t.target;e.files&&e.files.length>0&&(this.handleFiles(e.files),e.value="")};handleDragOver=t=>{t.preventDefault(),t.stopPropagation(),this.isDragOver=!0};handleDragLeave=t=>{t.preventDefault(),t.stopPropagation(),this.isDragOver=!1};handleDrop=async t=>{t.preventDefault(),t.stopPropagation(),this.isDragOver=!1;const e=t.dataTransfer?.files;if(e&&e.length>0){const n=document.caretRangeFromPoint(t.clientX,t.clientY);if(n&&this.editorRef?.contains(n.startContainer)){const t=window.getSelection();t?.removeAllRanges(),t?.addRange(n)}await this.handleFiles(e)}};handleSendMessage=()=>{const t=this.extractContent(),e=this.extractStructuredContent();console.debug("handleSendMessage",e.blocks),(t.text.trim()||t.attachments.length>0)&&(this.messageSend.emit(e),this.editorRef&&(this.editorRef.innerHTML=""),this.emitContentChange())};emitContentChange=()=>{const t=this.extractContent(),e=!!(t.text.trim()||t.attachments.length>0);this.hasContent!==e&&(this.hasContent=e),this.contentChange.emit(t)};formatFileSize=t=>{if(0===t)return"0 Bytes";const e=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,e)).toFixed(2))+" "+["Bytes","KB","MB","GB"][e]};render(){const t=this.hasContent;return i("div",{key:"2a3b14309017d69790c17db7591a28f82f49cee4",class:"rich-input-container "+(this.isDragOver?"drag-over":""),onDragOver:this.handleDragOver,onDragLeave:this.handleDragLeave,onDrop:this.handleDrop},i("div",{key:"4a2310a460ed29c6d47dd1683f070ebbd054b73a",class:"editor-area"},i("div",{key:"922433e6227fdd46fa71fdc5b05f1c508fcab423",class:"editor-wrapper"},i("div",{key:"6fd7691dab9e056058a0109dfe708e6bd3236c4b",ref:t=>this.editorRef=t,class:"rich-editor",contentEditable:!this.disabled,onInput:this.handleInput,onKeyDown:this.handleKeyDown,"data-placeholder":this.placeholder,style:{maxHeight:this.maxHeight}}),i("div",{key:"7ef1ab99474753beafcbf08e85d55e1037b887ff",class:"input-actions"},i("button",{key:"622970886800a5f602a079598d283eea9a1f0689",class:"action-button file-button",onClick:this.handleFileButtonClick,disabled:this.disabled,type:"button"},i("svg",{key:"722d7fb7a68b08888039e36f58d16d39472ad229",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},i("path",{key:"e06306ea498415db01f587e218637594b90a8983",d:"M11.9286 3.42858L11.9286 10.5714C11.9286 12.6286 10.2714 14.2857 8.21429 14.2857C6.15714 14.2857 4.5 12.6286 4.5 10.5714L4.5 4.28572C4.5 2.85715 5.64286 1.71429 7.07143 1.71429C8.5 1.71429 9.64286 2.85715 9.64286 4.28572L9.64286 10C9.64286 10.8 9.01429 11.4286 8.21429 11.4286C7.41429 11.4286 6.78571 10.8 6.78571 10L6.78571 5.14287",stroke:"#4A86E8","stroke-width":"1.5","stroke-miterlimit":"10","stroke-linecap":"square"}))),i("button",{key:"717f2e6f57f4b8316ffa58da639f695f4e55ca6f",class:"action-button file-button",onClick:this.handleFileButtonClick,disabled:this.disabled,type:"button"},i("svg",{key:"08a5a232a719d8e4e18053d469e868aeeba1972b",xmlns:"http://www.w3.org/2000/svg",width:"33",height:"32",viewBox:"0 0 33 32",fill:"none"},i("path",{key:"c642251b6186dde4ab105f7655c212f510734693",d:"M10.5 18.5312L14.3226 14.7683C14.6047 14.4907 15.062 14.4907 15.344 14.7683L18.4444 17.8203M18.4444 17.8203L17.3611 18.8867M18.4444 17.8203L19.7393 16.5457C20.0214 16.268 20.4786 16.268 20.7607 16.5457L23.5 19.2422M11.9444 21.375H22.0556C22.8533 21.375 23.5 20.7384 23.5 19.9531V11.4219C23.5 10.6366 22.8533 10 22.0556 10H11.9444C11.1467 10 10.5 10.6366 10.5 11.4219V19.9531C10.5 20.7384 11.1467 21.375 11.9444 21.375ZM21.6944 13.1992C21.6944 13.9845 21.0477 14.6211 20.25 14.6211C19.4523 14.6211 18.8056 13.9845 18.8056 13.1992C18.8056 12.4139 19.4523 11.7773 20.25 11.7773C21.0477 11.7773 21.6944 12.4139 21.6944 13.1992Z",stroke:"#4A86E8","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))),i("button",{key:"caa33c6d18525872a4ee2d672bee04a549779499",class:"action-button send-button",onClick:this.handleSendMessage,disabled:this.disabled||!t,type:"button"},i("svg",{key:"c111af09449b62afeb754eb691abdeee59c092ce",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},i("path",{key:"c7a9328a8abe02f7aa16dbae45574639bc94eb37",d:"M14.214 2.28564L5.64258 9.14279L5.64258 13.1428L7.69972 10.6856",stroke:"#4A86E8","stroke-width":"1.5","stroke-miterlimit":"10"}),i("path",{key:"0e141532e3694d564b8eab7240fd80a2ce172a7c",d:"M2.78613 6.85707L14.2147 2.28564L11.929 13.7142L2.78613 6.85707Z",stroke:"#4A86E8","stroke-width":"1.5","stroke-miterlimit":"10","stroke-linecap":"square"})))))),i("input",{key:"ed2eb79d5e731a3c324943439f5fcc8cee484e66",ref:t=>this.fileInputRef=t,type:"file",accept:this.acceptFiles,multiple:!0,onChange:this.handleFileInputChange,style:{display:"none"}}),this.isDragOver&&i("div",{key:"7d1deb8bc1c5cceac823ea6aa08de5c81e412e3d",class:"drag-overlay"},i("div",{key:"c27aff7a27b17eb06c4b79f25901e2db7c11be69",class:"drag-content"},i("svg",{key:"13c7243782c1fb604113ec8e09a53cd44aabb1e4",xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none"},i("path",{key:"0ac333bcd102668edcf034e559a75cbd64e7bdd8",d:"M38 20v16a4 4 0 0 1-4 4H14a4 4 0 0 1-4-4V20M32 10L24 2l-8 8M24 2v28",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})),i("p",{key:"4addb3c7733503a556958fa9b46b2c520cc3bf5d"},"Dateien hier ziehen"))))}static get style(){return":host{display:block;--rich-input-border-radius:12px;--rich-input-padding:4px;--attachment-item-radius:8px;--attachment-preview-size:60px;--min-input-height:18px;--max-input-height:120px;--transition-duration:0.2s}.rich-input-container{position:relative;background:var(--bg-primary, #ffffff);}.rich-input-container:focus-within{border-color:var(--accent-color, #4a86e8);box-shadow:0 0 0 2px rgba(74, 134, 232, 0.1)}.rich-input-container.drag-over{border-color:var(--accent-color, #4a86e8);background:var(--bg-light, #f8fafc)}.editor-area{padding:var(--rich-input-padding)}.editor-wrapper{display:flex;align-items:flex-end;gap:12px}.rich-editor{flex:1;min-height:var(--min-input-height);max-height:var(--max-input-height, 200px);overflow-y:auto;padding:12px 16px;border:none;outline:none;background:var(--bg-secondary, #f8f9fa);border-radius:20px;font-family:var(--font-primary, system-ui, sans-serif);font-size:14px;line-height:1.4;color:var(--text-primary, #212529);white-space:pre-wrap;word-wrap:break-word;resize:none;transition:background-color var(--transition-duration) ease}.rich-editor:focus{}@media (max-width: 768px){.rich-editor{font-size:16px}}.rich-editor:empty::before{content:attr(data-placeholder);color:var(--text-secondary, #6c757d);pointer-events:none}.rich-editor:focus:empty::before{content:''}.attachment-block{display:block;background:var(--bg-secondary, #f8f9fa);border:1px solid var(--border-light, #e9ecef);border-radius:var(--attachment-item-radius);padding:8px;margin:8px 0;max-width:300px;position:relative;box-sizing:border-box;user-select:none;-webkit-user-select:none}.attachment-block .attachment-content{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0}.attachment-item{display:flex;align-items:center;gap:8px;position:relative;min-width:0}.attachment-block .attachment-thumbnail{width:var(--attachment-preview-size);height:var(--attachment-preview-size);object-fit:cover;border-radius:4px;flex-shrink:0}.attachment-item .attachment-thumbnail{width:var(--attachment-preview-size);height:var(--attachment-preview-size);object-fit:cover;border-radius:4px;flex-shrink:0}.attachment-block .attachment-icon{width:var(--attachment-preview-size);height:var(--attachment-preview-size);display:flex;align-items:center;justify-content:center;background:var(--bg-light, #f1f3f4);border-radius:4px;color:var(--text-secondary, #6c757d);flex-shrink:0}.attachment-item .attachment-icon{width:var(--attachment-preview-size);height:var(--attachment-preview-size);display:flex;align-items:center;justify-content:center;background:var(--bg-light, #f1f3f4);border-radius:4px;color:var(--text-secondary, #6c757d);flex-shrink:0}.attachment-block .attachment-info{flex:1;min-width:0}.attachment-item .attachment-info{flex:1;min-width:0}.attachment-block .attachment-name{font-size:12px;font-weight:500;color:var(--text-primary, #212529);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.3}.attachment-item .attachment-name{font-size:12px;font-weight:500;color:var(--text-primary, #212529);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.3}.attachment-block .attachment-size{font-size:11px;color:var(--text-secondary, #6c757d);line-height:1.2}.attachment-item .attachment-size{font-size:11px;color:var(--text-secondary, #6c757d);line-height:1.2}.attachment-block .attachment-remove{position:absolute;top:-6px;right:-6px;width:20px;height:20px;border:none;background:var(--bg-primary, #ffffff);border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);color:var(--text-secondary, #6c757d);transition:all var(--transition-duration) ease}.attachment-item .attachment-remove{position:absolute;top:-6px;right:-6px;width:20px;height:20px;border:none;background:var(--bg-primary, #ffffff);border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);color:var(--text-secondary, #6c757d);transition:all var(--transition-duration) ease}.attachment-block .attachment-remove:hover{background:#dc3545;color:white;transform:scale(1.1)}.attachment-item .attachment-remove:hover{background:#dc3545;color:white;transform:scale(1.1)}.rich-editor::-webkit-scrollbar{width:4px}.rich-editor::-webkit-scrollbar-track{background:transparent}.rich-editor::-webkit-scrollbar-thumb{background:var(--border-color, #dee2e6);border-radius:2px}.rich-editor::-webkit-scrollbar-thumb:hover{background:var(--text-secondary, #6c757d)}.input-actions{display:flex;flex-direction:row;align-items:flex-end;gap:2px}.action-button{width:36px;height:36px;border:none;background:transparent;border-radius:18px;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--accent-color, #4a86e8);transition:all var(--transition-duration) ease;flex-shrink:0}.action-button:hover:not(:disabled){background:var(--bg-light, #f1f3f4);transform:scale(1.05)}.action-button:disabled{color:var(--text-secondary, #6c757d);cursor:not-allowed;opacity:0.5}.send-button:not(:disabled){color:white}.send-button:hover:not(:disabled){background:var(--accent-hover, #3d71d9)}.drag-overlay{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(74, 134, 232, 0.05);border:2px dashed var(--accent-color, #4a86e8);border-radius:var(--rich-input-border-radius);display:flex;align-items:center;justify-content:center;z-index:10}.drag-content{text-align:center;color:var(--accent-color, #4a86e8)}.drag-content svg{margin-bottom:8px}.drag-content p{margin:0;font-size:14px;font-weight:500}@media (max-width: 768px){:host{--rich-input-padding:12px;--attachment-preview-size:48px}.attachment-block{max-width:260px}.action-button{width:32px;height:32px}}"}},[513,"chatleo-rich-input",{disabled:[4],placeholder:[1],maxHeight:[1,"max-height"],acceptFiles:[1,"accept-files"],isDragOver:[32],hasContent:[32],getText:[64],setText:[64],addFiles:[64],focusEditor:[64]}]);function r(){"undefined"!=typeof customElements&&["chatleo-rich-input"].forEach((e=>{"chatleo-rich-input"===e&&(customElements.get(t(e))||customElements.define(t(e),o))}))}r();export{o as C,r as d}
@@ -0,0 +1 @@
1
+ import{t,p as e,H as n,h as i}from"./p-C-v19aUJ.js";const r=e(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}content;downloadUrls={};alignment="left";translations={};attachmentStates={};MAX_RETRIES=3;INITIAL_RETRY_DELAY_MS=1e3;FETCH_TIMEOUT_MS=5e3;initAttachmentState(t){this.attachmentStates[t]||(this.attachmentStates={...this.attachmentStates,[t]:{isLoading:!1,retryCount:0,hasError:!1}})}async handleImageError(t,e,n){this.initAttachmentState(t);const i=this.attachmentStates[t];if(console.log("handleImageError",t,i),!e.startsWith("image/")||i.retryCount>=this.MAX_RETRIES)return this.attachmentStates={...this.attachmentStates,[t]:{...i,isLoading:!1,hasError:!0}},void(n.src=this.getPlaceholderIcon(e));const r=this.downloadUrls[t];if(!r)return this.attachmentStates={...this.attachmentStates,[t]:{...i,isLoading:!1,hasError:!0}},void(n.src=this.getPlaceholderIcon(e));try{const s=new AbortController,o=setTimeout((()=>s.abort()),this.FETCH_TIMEOUT_MS);try{const a=await fetch(r.download_url,{method:"HEAD",signal:s.signal});if(clearTimeout(o),console.debug("HEAD response",a),404===a.status){this.attachmentStates={...this.attachmentStates,[t]:{...i,isLoading:!0,retryCount:i.retryCount+1}};const e=this.INITIAL_RETRY_DELAY_MS*Math.pow(2,i.retryCount);await new Promise((t=>setTimeout(t,e))),this.attachmentStates={...this.attachmentStates,[t]:{...this.attachmentStates[t],isLoading:!1}};const s=new URL(r.download_url);s.searchParams.set("retry",String(Date.now())),n.src=s.toString()}else this.attachmentStates={...this.attachmentStates,[t]:{...i,isLoading:!1,hasError:!0}},n.src=this.getPlaceholderIcon(e)}catch(r){clearTimeout(o),this.attachmentStates={...this.attachmentStates,[t]:{...i,isLoading:!1,hasError:!0}},n.src=this.getPlaceholderIcon(e)}}catch(r){this.attachmentStates={...this.attachmentStates,[t]:{...i,isLoading:!1,hasError:!0}},n.src=this.getPlaceholderIcon(e)}}renderLoadingSpinner(){return i("div",{class:"loading-spinner"},i("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},i("circle",{class:"spinner-circle",cx:"12",cy:"12",r:"10",fill:"none",stroke:"#6b7280","stroke-width":"2"})))}defaultTranslations={unsupported_content:"Unsupported content"};t(t){return this.translations[t]||this.defaultTranslations[t]||t}renderPlainText(t){const e=t.split("\n"),n=[];return e.forEach(((t,r)=>{t&&n.push(t),r<e.length-1&&n.push(i("br",null))})),n}renderTextBlock(t){return t.content?i("p",null,this.renderPlainText(String(t.content))):null}renderUnknownBlock(t){return"string"==typeof t?.fallback_text&&t.fallback_text.length>0?i("p",null,this.renderPlainText(t.fallback_text)):i("p",{class:"unsupported-content"},this.t("unsupported_content"))}blockRenderers={text:t=>this.renderTextBlock(t),attachment:t=>this.renderAttachmentBlock(t)};generateThumbnail(t,e){const n=this.downloadUrls[t];return console.debug("generateThumbnail",{downloadUrls:this.downloadUrls,attachmentId:t,downloadInfo:n}),n&&n.mime_type.startsWith("image/")?n.download_url:this.getPlaceholderIcon(e)}getPlaceholderIcon(t){const e="#6b7280";return t.startsWith("image/")?`data:image/svg+xml,${encodeURIComponent(`\n <svg width="48" height="48" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <rect x="3" y="3" width="18" height="18" rx="2" ry="2" stroke="${e}" stroke-width="2" fill="none"/>\n <circle cx="8.5" cy="8.5" r="1.5" fill="${e}"/>\n <polyline points="21,15 16,10 5,21" stroke="${e}" stroke-width="2" fill="none"/>\n </svg>\n `)}`:t.includes("pdf")?`data:image/svg+xml,${encodeURIComponent(`\n <svg width="48" height="48" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" fill="${e}"/>\n </svg>\n `)}`:`data:image/svg+xml,${encodeURIComponent(`\n <svg width="48" height="48" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z" stroke="${e}" stroke-width="2" fill="none"/>\n <polyline points="14,2 14,8 20,8" stroke="${e}" stroke-width="2" fill="none"/>\n </svg>\n `)}`}renderAttachmentBlock(t){if(!t.attachments||0===t.attachments.length)return null;const e=t.attachments.map((t=>{const e=this.generateThumbnail(t.id,t.mime_type),n=this.downloadUrls[t.id];this.initAttachmentState(t.id);const r=this.attachmentStates[t.id];return i("div",{class:"attachment-item",key:t.id},i("div",{class:"attachment-thumbnail"},t.mime_type.startsWith("image/")?i("div",{class:"image-container"},i("img",{src:e,alt:"Image attachment",onError:e=>{this.handleImageError(t.id,t.mime_type,e.target)},style:{display:r.isLoading?"none":"block"}}),r.isLoading&&this.renderLoadingSpinner()):i("img",{src:e,alt:"File attachment"})),n&&i("div",{class:"attachment-overlay"},i("a",{href:n.download_url,target:"_blank",rel:"noopener noreferrer"},i("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),i("polyline",{points:"7,10 12,15 17,10",stroke:"white","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),i("line",{x1:"12",y1:"15",x2:"12",y2:"3",stroke:"white","stroke-width":"2","stroke-linecap":"round"})))))}));return i("p",null,i("div",{class:"attachment-container"},e))}render(){if(!this.content||!this.content.blocks)return i("div",{class:`rich-message-content ${this.alignment}`});const t=this.content.blocks.map((t=>{const e=Object.prototype.hasOwnProperty.call(this.blockRenderers,t?.type)?this.blockRenderers[t.type]:void 0;return e?e(t):this.renderUnknownBlock(t)}));return i("div",{class:`rich-message-content ${this.alignment}`},t)}static get style(){return":host{display:block}.rich-message-content{width:100%}.rich-message-content.left{text-align:left}.rich-message-content.right{text-align:right}.rich-message-content p{margin:0.5em 0;line-height:1.4}.rich-message-content p:first-child{margin-top:0}.rich-message-content p:last-child{margin-bottom:0}.attachment-container{display:flex;gap:8px;overflow-x:auto;padding:4px 0;scrollbar-width:thin}.attachment-container::-webkit-scrollbar{height:4px}.attachment-container::-webkit-scrollbar-track{background:#f1f1f1;border-radius:2px}.attachment-container::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:2px}.attachment-container::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.attachment-item{position:relative;flex-shrink:0;width:80px;height:80px;border-radius:8px;overflow:hidden;background-color:#f5f5f5;border:1px solid #e5e5e5;cursor:pointer;transition:transform 0.2s ease, box-shadow 0.2s ease}.attachment-item:hover{transform:scale(1.05);box-shadow:0 4px 8px rgba(0, 0, 0, 0.1)}.attachment-thumbnail{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.attachment-thumbnail img{width:100%;height:100%;object-fit:cover;border-radius:7px}.image-container{width:100%;height:100%;display:flex;align-items:center;justify-content:center;position:relative}.loading-spinner{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.spinner-circle{animation:spin 1s linear infinite;transform-origin:center;stroke-dasharray:50;stroke-dashoffset:0}@keyframes spin{0%{transform:rotate(0deg);stroke-dashoffset:0}50%{stroke-dashoffset:25}100%{transform:rotate(360deg);stroke-dashoffset:50}}.attachment-overlay{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0, 0, 0, 0.3);display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity 0.2s ease;border-radius:7px}.attachment-item:hover .attachment-overlay{opacity:1}.attachment-overlay a{display:flex;align-items:center;justify-content:center;width:32px;height:32px;background:rgba(0, 0, 0, 0.6);border-radius:50%;text-decoration:none;transition:background 0.2s ease}.attachment-overlay a:hover{background:rgba(0, 0, 0, 0.8)}.rich-message-content.right .attachment-container{justify-content:flex-end}"}},[513,"chatleo-rich-message-renderer",{content:[16],downloadUrls:[16],alignment:[1],translations:[16],attachmentStates:[32]}]);function s(){"undefined"!=typeof customElements&&["chatleo-rich-message-renderer"].forEach((e=>{"chatleo-rich-message-renderer"===e&&(customElements.get(t(e))||customElements.define(t(e),r))}))}s();export{r as C,s as d}
@@ -0,0 +1 @@
1
+ import{t as e,p as t,H as a,c as s,h as o}from"./p-C-v19aUJ.js";import{g as n}from"./index.js";import{d as i}from"./p-Exj_2-yI.js";import{d as r}from"./p-B7cdqAgv.js";import{d as c}from"./p-XlwGxsqT.js";import{d}from"./p-BdiOcOYZ.js";import{d as h}from"./p-C1mF0s8g.js";import{d as l}from"./p-CRtBdzP3.js";import{d as p}from"./p-fjMaTJam.js";import{d as f}from"./p-xt4kzz3B.js";const b=t(class extends a{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.newChatClicked=s(this,"newChatClicked"),this.messageChatSent=s(this,"messageChatSent")}chatStore;isChatOpen=!1;isNewChatSelectorOpen=!1;isMessagesOpen=!1;selectedRoomId;isPending=!1;_version=0;isSessionExpired=!1;connectionStatus="disconnected";messagesContainerRef;lastMessageCount=-1;boundOnPresenceChange=()=>this.onPresenceChange();boundOnRoomMessageAdded=e=>this.onRoomMessageAdded(e);boundOnSessionExpiredChanged=e=>this.onSessionExpiredChanged(e);boundOnConnectionStatusChanged=e=>this.onConnectionStatusChanged(e);boundOnRoomReadCountChanged=()=>{this._version++};onChatStoreChange(e,t){t&&(t.removeEventListener("presenceChanged",this.boundOnPresenceChange),t.removeEventListener("roomMessageAdded",this.boundOnRoomMessageAdded),t.removeEventListener("sessionExpiredChanged",this.boundOnSessionExpiredChanged),t.removeEventListener("connectionStatusChanged",this.boundOnConnectionStatusChanged),t.removeEventListener("roomReadCountChanged",this.boundOnRoomReadCountChanged)),e&&(e.addEventListener("presenceChanged",this.boundOnPresenceChange),e.addEventListener("roomMessageAdded",this.boundOnRoomMessageAdded),e.addEventListener("sessionExpiredChanged",this.boundOnSessionExpiredChanged),e.addEventListener("connectionStatusChanged",this.boundOnConnectionStatusChanged),this.isSessionExpired=e.isSessionExpired,this.connectionStatus=e.connectionStatus,e.addEventListener("roomReadCountChanged",this.boundOnRoomReadCountChanged))}onSelectedRoomIdChanged(){this.lastMessageCount=-1,this._version++,this.chatStore?.setActiveRoomId(this.selectedRoomId??null)}onPresenceChange(){console.debug("onPresenceChange"),this._version++}onRoomMessageAdded(e){console.debug("onRoomMessageAdded",e),this._version++,this.isMessagesOpen&&e.detail?.roomId===this.selectedRoomId&&this.chatStore?.markRoomAsRead(this.selectedRoomId)}onSessionExpiredChanged(e){this.isSessionExpired=e.detail.isSessionExpired,this.isSessionExpired&&(this.isChatOpen=!0)}onConnectionStatusChanged(e){this.connectionStatus=e.detail.status}toggleChat=()=>{this.isChatOpen=!this.isChatOpen,this._version++};newChatClicked;onNewChatClicked(){this.isNewChatSelectorOpen?this.isNewChatSelectorOpen=!1:(this.isNewChatSelectorOpen=!0,this.isMessagesOpen=!1,this.newChatClicked.emit())}onUserSelected=()=>{this.isNewChatSelectorOpen=!1};onSelectorClose=()=>{this.isNewChatSelectorOpen=!1};roomClickedHandler(e){console.log("Received the roomClicked event: ",e.detail),this.isNewChatSelectorOpen=!1,this.isMessagesOpen=!0,this.selectedRoomId=e.detail.id,this.chatStore?.markRoomAsRead(e.detail.id)}messageChatSent;messageSendHandler(e){console.log("Received the messageSend event: ",JSON.stringify(e.detail));const t=(e.detail?.blocks??[]).map((e=>{if("attachment"===e?.type&&Array.isArray(e.attachments)){const t=e.attachments.map((e=>{const{preview:t,...a}=e??{};return a}));return{...e,attachments:t}}return e}));this.messageChatSent.emit({room_id:this.selectedRoomId,content:{blocks:t,version:e.detail.version},content_type:"application/json+blocks",sender:this.chatStore?.profile?.id})}async openChatPanel(e,t=!1){console.debug(`openChatPanel ${e} ${t}`),this.selectedRoomId=e,this.isPending=t,this.isChatOpen=!1,this.isMessagesOpen=!0,e&&this.chatStore?.markRoomAsRead(e),this._version++}onDoClose(e){e.preventDefault(),this.isMessagesOpen=!1}scrollToBottom(){if(this.messagesContainerRef)try{this.messagesContainerRef.scrollTop=this.messagesContainerRef.scrollHeight}catch(e){}}scrollToBottomNextTick(){requestAnimationFrame((()=>{this.scrollToBottom()}))}componentDidRender(){if(!this.isMessagesOpen||!this.selectedRoomId)return;const e=(this.chatStore?.roomMessages(this.selectedRoomId)??[]).length;e!==this.lastMessageCount&&(this.scrollToBottomNextTick(),this.lastMessageCount=e)}render(){const e=n(this.chatStore?.roomMessages(this.selectedRoomId)??[]);return o("div",{key:"16d13ecf2c8d78c822b66ee140fdf3aedb03d1fa",class:"tray-container"},o("div",{key:"2087230f83fa231255a127bcf25935c96bb5a89d",class:this.isNewChatSelectorOpen?"selector-panel open":"selector-panel"},o("chatleo-new-message-selector",{key:"346f747952e4c2d3872db97adfd9fab7434526cf",chatStore:this.chatStore,onUserSelected:this.onUserSelected,onDoClose:this.onSelectorClose})),o("div",{key:"245326a45ffdea0c3c8a8507a449391635576c95",class:this.isMessagesOpen?"messages-panel open":"messages-panel"},o("div",{key:"b5b82048cbee06bdb73967c2ff342d4bad66a89a",class:"messages-container-header-closer"},o("button",{key:"0196b861999831d834df3407cc5c350fba9338f9",class:"close-button",onClick:this.onDoClose.bind(this)},o("svg",{key:"1db85ebbbb9291ecd8674d25a063bcbe215bd6d0",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o("path",{key:"d5f23bc40608fac8577860d6ff03e0e5c47e26cf",d:"M12 4L4 12",stroke:"#565D6D","stroke-width":"1.37143","stroke-miterlimit":"10","stroke-linecap":"square"}),o("path",{key:"6f27dd8b4a9969dd19bdae6059cad74d5e466d6f",d:"M12 12L4 4",stroke:"#565D6D","stroke-width":"1.37143","stroke-miterlimit":"10","stroke-linecap":"square"})))),o("chatleo-chat-header",{key:"d4320c822ed8ed5e4472c91a8c03508137bb3985",name:this.chatStore?.profile?.display_name,avatar:this.chatStore?.profile?.profile_picture_url??"https://placehold.co/48x48?text=AV",isOnline:this.chatStore?.isConnected}),o("div",{key:"ffb54f65c17f3ecf51f661aaa2cd1777d57e2468",class:"messages-container",ref:e=>this.messagesContainerRef=e},Object.entries(e).sort((([e],[t])=>new Date(e).getTime()-new Date(t).getTime())).map((([e,t])=>o("div",{class:"message-group"},o("div",{class:"date-separator"},e),t.map((e=>o("chatleo-chat-message",{message:e,sender:this.chatStore?.usernameResolver(e.sender_id),isOwnMessage:e.sender_id===this.chatStore?.profile.id,translations:{you:this.chatStore?.usernameResolver(e.sender_id)?.display_name}}))))))),o("chatleo-rich-input",{key:"5db7ffd32df847bbe103659d4f8ededfcc3105b2",disabled:!this.selectedRoomId,placeholder:"Nachricht schreiben"})),o("div",{key:"a4374b9f51b6f4f528ca0099df022272d41e8062",id:"chats",class:this.isChatOpen?"chat-panel open":"chat-panel"},this.isSessionExpired&&o("div",{key:"77f04c709823b47590588651b78531fa23d84254",class:"session-expired-banner"},o("svg",{key:"7a9e8a3baba8576df14229384f67c4e771e4280e",class:"session-expired-banner-icon",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},o("path",{key:"bededb8359f4374f131f914124f89cae938c63f2",d:"M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})),o("span",{key:"49ede701a42a2c16954859e5c0443c6c94168376"},"Session abgelaufen –"),o("button",{key:"1533de4c91c3e496e82781e03e34d8df9cd92bf7",class:"session-expired-banner-btn",onClick:()=>window.location.reload()},"Seite neu laden")),!this.isSessionExpired&&("connecting"===this.connectionStatus||"reconnecting"===this.connectionStatus||"disconnected"===this.connectionStatus)&&o("div",{key:"5f11759ba32e228f990b2866d09e2d25c647315c",class:`connection-status-banner connection-status-banner--${this.connectionStatus}`},o("span",{key:"55ad4bf597fcf0ee3a1e180ebfac85a8c271da16",class:"connection-status-banner__dot"}),"connecting"===this.connectionStatus?"Verbindung wird hergestellt…":"reconnecting"===this.connectionStatus?"Verbindung wird wiederhergestellt…":"Offline"),o("div",{key:"c8adfe1c61695332bef014492c7abe3d641160b0",class:"tray"},o("chatleo-avatar",{key:"e5ca63cb0a77c19c75ca8404a0ec92833f9881f2",name:this.chatStore?.profile?.display_name??"",url:this.chatStore?.profile?.profile_picture_url,isOnline:!!this.chatStore?.profile?.id&&(this.chatStore?.isOnline(this.chatStore.profile.id)??!1)}),o("div",{key:"a7bbd2492328f400a7e349f8296f3c1a499e171e",class:"title"},"Nachrichten"),o("button",{key:"7c2450e2977563c59a41efc874fc9ca5c6ecbea7",class:"new-chat-btn",onClick:()=>this.onNewChatClicked()},o("svg",{key:"a7de1919583f9264c85d2f8a0879e8f993ff848c",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},o("path",{key:"63e200bbf4038f0ceb626000b53f685318cd19f8",d:"M10.497 2.43838L12.7094 4.62657M12.9439 1.6838L13.4519 2.19178C13.9192 2.6591 13.9192 3.41677 13.4519 3.8841L6.72919 10.6068C6.59783 10.7381 6.43768 10.8371 6.26144 10.8958L3.79663 11.7174C3.56275 11.7954 3.34026 11.5729 3.41821 11.339L4.23982 8.87421C4.29857 8.69797 4.39754 8.53783 4.5289 8.40647L11.2516 1.6838C11.7189 1.21648 12.4766 1.21648 12.9439 1.6838Z",stroke:"#565D6D","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),o("path",{key:"222831ec61fc41f09ba0296731aed27050ff1b55",d:"M8 2.13312H7.2H1.8C1.35817 2.13312 1 2.49129 1 2.93312V13.7331C1 14.1749 1.35817 14.5331 1.8 14.5331H12.6C13.0418 14.5331 13.4 14.1749 13.4 13.7331V8.33312V6.99998",stroke:"#565D6D","stroke-width":"1.5","stroke-linecap":"round"}))),o("button",{key:"51ce8b2bc912659e7347f9eb9bfe1a1c56b23b75",class:"chat-tray-btn",onClick:this.toggleChat},o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},o("path",this.isChatOpen?{d:"M3.07273 4.66669L2 5.73941L8 11.7394L14 5.73941L12.9273 4.66669L8 9.59393L3.07273 4.66669Z",fill:"#565D6D"}:{d:"M12.9273 11.7393L14 10.6665L8 4.66655L2 10.6665L3.07273 11.7393L8 6.81202L12.9273 11.7393Z",fill:"#565D6D"})))),o("div",{key:"9f46873326aab72ba87cfa6b387de9c5616bb497",class:"chat-content"},o("ul",{key:"f1f9da34aab6ae95a9d3910de295e1dc64f31c2c"},this.chatStore?.rooms.map((e=>{const t=e.participantIdsWithoutSelf?.filter((e=>this.chatStore.isOnline(e)))??[];return o("li",null,o("chatleo-room-tile-component",{chatStore:this.chatStore,room:e,onlineUserIds:t,lastMessage:void 0,timestamp:void 0,unreadCount:e.unreadCount}))}))))))}static get watchers(){return{chatStore:[{onChatStoreChange:0}],selectedRoomId:[{onSelectedRoomIdChanged:0}]}}static get style(){return":host{--hover-color:#f9f9f9;--shadow-light:rgba(0, 0, 0, 0.1);--z-index-tray:1000;--tray-height:52px;--gap-small:12px;--gap-medium:16px;--transition-duration:0.3s;--gray-black:#171A1F;--chat-panel-width:280px;--selector-panel-width:320px;--messages-panel-width:50vw}.tray-container{position:fixed;bottom:0;right:20px;z-index:var(--z-index-tray);display:flex;flex-direction:row;align-items:flex-end;gap:var(--gap-small);font-family:var(--font-primary), sans-serif}.chat-panel{width:var(--chat-panel-width);flex:0 0 var(--chat-panel-width);box-sizing:border-box;position:relative;background:var(--bg-primary);border:1px solid var(--border-color);border-radius:var(--border-radius) var(--border-radius) 0 0;box-shadow:0 -2px 10px var(--shadow-light);overflow:hidden;max-height:var(--tray-height);transition:max-height var(--transition-duration) ease-in-out}.chat-panel.open{max-height:calc(50vh + var(--tray-height));}.tray{display:flex;flex-direction:row;align-items:center;background:var(--bg-primary);border-bottom:1px solid var(--border-light);height:var(--tray-height);box-sizing:border-box;width:100%;padding:0 8px;margin:0;}chatleo-avatar{--avatar-size:36px}.title{margin:0 8px;flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gray-black, #171A1F);font-size:14px}.selector-panel{display:none;background:var(--bg-primary);border:1px solid var(--border-color);border-radius:var(--border-radius) var(--border-radius) 0 0;box-shadow:0 -2px 10px var(--shadow-light);box-sizing:border-box;width:var(--selector-panel-width);flex:0 0 var(--selector-panel-width);overflow:hidden;max-height:var(--tray-height);}.selector-panel.open{display:flex;flex-direction:column;max-height:calc(50vh + var(--tray-height))}.messages-panel{display:none;background:var(--bg-primary);border:1px solid var(--border-color);border-radius:var(--border-radius) var(--border-radius) 0 0;box-shadow:0 -2px 10px var(--shadow-light);box-sizing:border-box;width:var(--messages-panel-width);overflow:hidden;position:relative;max-height:70vh;flex-direction:column}.messages-panel.open{display:flex}.new-chat-btn{border:0;background:transparent;cursor:pointer;padding:0;margin:0 8px;flex:0 0 auto;color:#565D6D}.chat-tray-btn{border:0;background:transparent;cursor:pointer;padding:0;margin:0 8px;flex:0 0 auto;color:#565D6D}.chat-content{overflow:hidden}.chat-content ul{margin:0;padding:0;list-style:none;overflow-y:auto;max-height:calc(50vh - var(--tray-height));}.chat-content li{padding:16px;cursor:pointer}.chat-content li:hover{background:var(--hover-color)}@media (max-width: 768px){.chat-panel.open,.selector-panel.open{max-height:calc(80vh + 60px)}.chat-content ul{max-height:calc(80vh - 60px)}}.messages-container-header-closer{position:absolute;top:4px;right:4px}.messages-container{display:block;flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;padding-right:16px;overscroll-behavior:contain;scrollbar-gutter:stable;max-width:100%}.message-group{display:flex;flex-direction:column;gap:16px}.date-separator{text-align:center;font-family:var(--font-primary), sans-serif;font-weight:400;font-size:12px;line-height:1.65;color:var(--text-secondary)}.close-button{background:none;border:none;cursor:pointer;font-size:16px;color:var(--text-secondary)}.connection-status-banner{display:flex;align-items:center;gap:6px;padding:5px 12px;font-family:var(--font-primary), sans-serif;font-size:12px;font-weight:600;color:#fff;background:#f59e0b}.connection-status-banner--disconnected{background:#ef4444}.connection-status-banner__dot{width:6px;height:6px;border-radius:50%;background:rgba(255,255,255,0.8);flex-shrink:0;animation:tray-pulse-dot 1.4s ease-in-out infinite}.connection-status-banner--disconnected .connection-status-banner__dot{animation:none}@keyframes tray-pulse-dot{0%,100%{opacity:1}50%{opacity:0.3}}.session-expired-banner{display:flex;align-items:center;gap:6px;background:#fff8e1;border-bottom:1px solid #ffe082;padding:6px 12px;font-family:var(--font-primary), sans-serif;font-size:12px;color:#795548}.session-expired-banner-icon{flex-shrink:0;color:#f59e0b}.session-expired-banner-btn{margin-left:auto;padding:3px 10px;background:#f59e0b;color:#fff;border:none;border-radius:4px;font-family:var(--font-primary), sans-serif;font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap}.session-expired-banner-btn:hover{background:#d97706}"}},[513,"chatleo-tray-component",{chatStore:[16],isChatOpen:[32],isNewChatSelectorOpen:[32],isMessagesOpen:[32],selectedRoomId:[32],isPending:[32],_version:[32],isSessionExpired:[32],connectionStatus:[32],openChatPanel:[64]},[[0,"roomClicked","roomClickedHandler"],[0,"messageSend","messageSendHandler"]],{chatStore:[{onChatStoreChange:0}],selectedRoomId:[{onSelectedRoomIdChanged:0}]}]);function g(){"undefined"!=typeof customElements&&["chatleo-tray-component","chatleo-avatar","chatleo-chat-header","chatleo-chat-message","chatleo-new-message-selector","chatleo-rich-input","chatleo-rich-message-renderer","chatleo-room-tile-component","chatleo-user-tile"].forEach((t=>{switch(t){case"chatleo-tray-component":customElements.get(e(t))||customElements.define(e(t),b);break;case"chatleo-avatar":customElements.get(e(t))||i();break;case"chatleo-chat-header":customElements.get(e(t))||r();break;case"chatleo-chat-message":customElements.get(e(t))||c();break;case"chatleo-new-message-selector":customElements.get(e(t))||d();break;case"chatleo-rich-input":customElements.get(e(t))||h();break;case"chatleo-rich-message-renderer":customElements.get(e(t))||l();break;case"chatleo-room-tile-component":customElements.get(e(t))||p();break;case"chatleo-user-tile":customElements.get(e(t))||f()}}))}g();export{b as C,g as d}
@@ -0,0 +1 @@
1
+ import{t as e,p as t,H as o,c as a,h as s}from"./p-C-v19aUJ.js";import{d as i}from"./p-Exj_2-yI.js";import{d as r}from"./p-B7cdqAgv.js";import{d as n}from"./p-XlwGxsqT.js";import{d as l}from"./p-BdiOcOYZ.js";import{d as c}from"./p-C1mF0s8g.js";import{d as h}from"./p-CRtBdzP3.js";import{d as m}from"./p-8kvQ-Uh-.js";import{d}from"./p-fjMaTJam.js";import{d as p}from"./p-BlbDSb7D.js";import{d as g}from"./p-xt4kzz3B.js";const f=t(class extends o{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.messageChatSent=a(this,"messageChatSent")}chatStore;isOnline=!1;pending=!1;callsAvailable=!1;inCall=!1;selectedRoomId;_version=0;_showRoomDetail=!1;roomViewRef;handleToggleMobileView(){this._showRoomDetail=!this._showRoomDetail}isMobileViewport(){return window.innerWidth<768}async openRoom(e){e&&(this.selectedRoomId=e,this.chatStore?.setActiveRoomId(e),this.chatStore?.markRoomAsRead(e),this.isMobileViewport()&&(this._showRoomDetail=!0))}async closeRoom(){this._showRoomDetail=!1,this.chatStore?.setActiveRoomId(null)}async getDraft(){return await(this.roomViewRef?.getDraft?.())??""}async setDraft(e){e&&await(this.roomViewRef?.setDraft?.(e))}async addFiles(e){await(this.roomViewRef?.addFiles?.(e??[]))}async focusComposer(){await(this.roomViewRef?.focusComposer?.())}onChatStoreChange(e,t){console.debug("onChatStoreChange",e,t),e.addEventListener("roomAdded",(e=>{console.debug("roomAdded",e),this._version++})),e.addEventListener("roomMessageAdded",(t=>{console.debug("roomMessageAdded",t),this._version++;const o=t.detail;o?.roomId&&o.roomId===this.selectedRoomId&&e.markRoomAsRead(o.roomId)})),e.addEventListener("roomReadCountChanged",(()=>{this._version++})),e.addEventListener("presenceChanged",(e=>{console.debug("onPresenceChange",e),this._version++}))}messageChatSent;handleSendMessage(e){this.messageChatSent.emit({room_id:this.selectedRoomId,content:e.detail,sender:this.chatStore?.profile?.id,content_type:"text/plain"})}messageSendHandler(e){console.log("Received the messageSend event: ",JSON.stringify(e.detail));const t=(e.detail?.blocks??[]).map((e=>{if("attachment"===e?.type&&Array.isArray(e.attachments)){const t=e.attachments.map((e=>{const{preview:t,...o}=e??{};return o}));return{...e,attachments:t}}return e}));this.messageChatSent.emit({room_id:this.selectedRoomId,content:{blocks:t,version:e.detail.version},content_type:"application/json+blocks",sender:this.chatStore?.profile?.id})}async handleRoomClicked(e){console.debug("ChatleoChat.roomClicked",e),await this.openRoom(e.detail.id)}render(){return s("div",{key:"759aa942b6cfba0635119d0064afe7bc4e2ef901",class:"chat-container-list-and-chat "+(this._showRoomDetail?"show-room-view":"show-room-list")},s("chatleo-room-list",{key:"feecf22c1ab746ec5af8cb1e61708f131946a260",rooms:this.chatStore?.rooms,chatStore:this.chatStore,selectedRoomId:this.selectedRoomId}),s("chatleo-room-view",{key:"c90a58b6946c949288176b3aa5a411b3d7722e7e",ref:e=>this.roomViewRef=e,chatStore:this.chatStore,roomId:this.selectedRoomId,isOnline:this.isOnline,pending:this.pending,callsAvailable:this.callsAvailable,inCall:this.inCall}),s("button",{key:"d1ccaa37c2135f5a0f2945d82cc5becda60ea6e0",class:"toggle-btn",onClick:()=>this.handleToggleMobileView()},s("svg",{key:"e5af148d5cfd19d7bc44cdd76fea530bc6683ea9",viewBox:"0 0 24 24"},s("path",this._showRoomDetail?{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"}:{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}))))}static get watchers(){return{chatStore:[{onChatStoreChange:0}]}}static get style(){return":host{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.chat-container-list-and-chat{display:flex;flex-direction:row;height:100%;max-width:100%;min-height:0;overflow:hidden;padding:2px;border:1px solid var(--border-light);box-sizing:border-box;background:var(--bg-primary);position:relative}chatleo-room-view{flex:1;min-width:0;min-height:0;border-left:1px solid var(--border-light);transition:transform 0.3s ease-out}chatleo-room-list{flex:0 0 auto;min-height:0;transition:transform 0.3s ease-out}.toggle-btn{display:none;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:100;width:48px;height:48px;border-radius:50%;border:1px solid var(--border-light);background:var(--bg-primary);cursor:pointer;box-shadow:0 2px 8px rgba(0, 0, 0, 0.15);align-items:center;justify-content:center;padding:0}.toggle-btn svg{width:24px;height:24px;fill:var(--text-primary)}@media (max-width: 768px){.chat-container-list-and-chat{overflow-x:hidden}.toggle-btn{display:flex;right:8px;left:auto;top:8px;transform:none}chatleo-room-list{width:100%;flex:1}chatleo-room-view{width:100%;position:absolute;top:0;left:0;right:0;bottom:0;border-left:none}.show-room-list chatleo-room-list{transform:translateX(0)}.show-room-list chatleo-room-view{transform:translateX(100%)}.show-room-view chatleo-room-list{transform:translateX(-100%)}.show-room-view chatleo-room-view{transform:translateX(0)}}"}},[513,"chatleo-chat",{chatStore:[16],isOnline:[4,"is-online"],pending:[4],callsAvailable:[4,"calls-available"],inCall:[4,"in-call"],selectedRoomId:[32],_version:[32],_showRoomDetail:[32],openRoom:[64],closeRoom:[64],getDraft:[64],setDraft:[64],addFiles:[64],focusComposer:[64]},[[0,"messageInputSent","handleSendMessage"],[0,"messageSend","messageSendHandler"],[0,"roomClicked","handleRoomClicked"]],{chatStore:[{onChatStoreChange:0}]}]);function b(){"undefined"!=typeof customElements&&["chatleo-chat","chatleo-avatar","chatleo-chat-header","chatleo-chat-message","chatleo-new-message-selector","chatleo-rich-input","chatleo-rich-message-renderer","chatleo-room-list","chatleo-room-tile-component","chatleo-room-view","chatleo-user-tile"].forEach((t=>{switch(t){case"chatleo-chat":customElements.get(e(t))||customElements.define(e(t),f);break;case"chatleo-avatar":customElements.get(e(t))||i();break;case"chatleo-chat-header":customElements.get(e(t))||r();break;case"chatleo-chat-message":customElements.get(e(t))||n();break;case"chatleo-new-message-selector":customElements.get(e(t))||l();break;case"chatleo-rich-input":customElements.get(e(t))||c();break;case"chatleo-rich-message-renderer":customElements.get(e(t))||h();break;case"chatleo-room-list":customElements.get(e(t))||m();break;case"chatleo-room-tile-component":customElements.get(e(t))||d();break;case"chatleo-room-view":customElements.get(e(t))||p();break;case"chatleo-user-tile":customElements.get(e(t))||g()}}))}b();export{f as C,b as d}
@@ -0,0 +1 @@
1
+ import{t,p as a,H as s,h as e}from"./p-C-v19aUJ.js";const i=a(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}name;url;isOnline=!1;render(){const t=`\n <svg width="100" height="100" xmlns="http://www.w3.org/2000/svg">\n <circle cx="50" cy="50" r="45" fill="royalblue" />\n <text x="50" y="55" font-size="12" text-anchor="middle" fill="white">${this.name.substring(0,2)}</text>\n </svg>\n `,a="data:image/svg+xml,"+encodeURIComponent(t);return e("div",{key:"e7b5846df55e2088312546869f50c32fc1b3f809",class:"user-avatar"},e("img",{key:"ef7af555265926a194ce8f972286ca3be5746b40",src:this.url??a,alt:this.name,title:this.name}),e("div",{key:"46e7627446b02d7f1e42d110cbb5fd5a55ff333b",class:"status-indicator "+(this.isOnline?"online":"offline")}))}static get style(){return":host{--avatar-bg:#dddddd;--status-size:12px;--status-border:2px;--status-position:2px}.user-avatar{position:relative;flex-shrink:0}.user-avatar img{width:var(--avatar-size, 48px);height:var(--avatar-size, 48px);border-radius:50%;object-fit:cover;background-color:var(--avatar-bg);overflow:hidden}.status-indicator{position:absolute;bottom:var(--status-position);right:var(--status-position);width:var(--status-size);height:var(--status-size);border-radius:50%;border:var(--status-border) solid var(--bg-primary)}.status-indicator.online{background-color:var(--status-online)}.status-indicator.offline{background-color:var(--status-offline)}"}},[513,"chatleo-avatar",{name:[1],url:[1],isOnline:[4,"is-online"]}]);function r(){"undefined"!=typeof customElements&&["chatleo-avatar"].forEach((a=>{"chatleo-avatar"===a&&(customElements.get(t(a))||customElements.define(t(a),i))}))}r();export{i as C,r as d}
@@ -0,0 +1 @@
1
+ import{t as e,p as t,H as s,c as a,h as r}from"./p-C-v19aUJ.js";import{d as i}from"./p-Exj_2-yI.js";import{d as n}from"./p-CRtBdzP3.js";const o=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.messageRetry=a(this,"messageRetry"),this.messageDiscard=a(this,"messageDiscard")}message;sender=void 0;senderIsOnline=!1;isOwnMessage=!1;locale="en-US";translations={};messageRetry;messageDiscard;isStructuredContent(e){try{const t=JSON.parse(e);if(t&&t.blocks&&Array.isArray(t.blocks)&&t.version)return t}catch(e){}return null}formatTimestamp(e){try{return new Intl.DateTimeFormat(this.locale,{hour:"numeric",minute:"numeric"}).format(new Date(e))}catch(t){return e}}defaultTranslations={you:"You",sending:"Sending…",failed:"Not sent",retry:"Retry",discard:"Discard"};t(e){return console.log(`Translating key: ${e}`,this.translations,this.defaultTranslations),this.translations[e]||this.defaultTranslations[e]||e}callEntry(){return function(e){try{const t=JSON.parse(e),s=t?.call??(Array.isArray(t?.blocks)?t.blocks.find((e=>"call"===e?.type)):void 0);if(!s)return null;const a=s.fallback_text??t.fallback_text;if(a)return String(a);const r=s.event??s.state,i="number"==typeof s.duration_ms?Math.round(s.duration_ms/1e3):void 0,n=i?` · ${Math.floor(i/60)}:${String(i%60).padStart(2,"0")}`:"";return"missed"===r||"missed"===s.reason?"Missed call":"declined"===r||"declined"===s.reason?"Call declined":"ended"===r||"failed"===r?`Call ended${n}`:"started"===r||"active"===r?"group"===s.mode?"Group call started":"Call started":"Call"}catch{return null}}(this.message.content_body)}renderMessageContent(){const e=this.callEntry();if(e)return r("div",{class:"call-message"},e);const t=this.isStructuredContent(this.message.content_body);return t?r(r.Fragment,null,r("chatleo-rich-message-renderer",{content:t,downloadUrls:this.message.attachment_details,alignment:this.isOwnMessage?"right":"left"})):r("div",{class:"message-text",style:{textAlign:this.isOwnMessage?"right":"left"}},this.message.content_body)}renderDeliveryStatus(){const e=(t=this.message,this.isOwnMessage&&t?.delivery&&"sent"!==t.delivery?{status:t.delivery,error:t.error,canRetry:Boolean(t.client_id)}:{status:"none",canRetry:!1});var t;if("none"===e.status)return null;const s=this.message.client_id;return"pending"===e.status?r("div",{class:"message-status pending","aria-live":"polite"},this.t("sending")):r("div",{class:"message-status failed"},r("span",{class:"message-status-text"},this.t("failed"),e.error?`: ${e.error}`:""),e.canRetry&&s&&r("span",{class:"message-status-actions"},r("button",{type:"button",class:"status-action",onClick:()=>this.messageRetry.emit(s)},this.t("retry")),r("button",{type:"button",class:"status-action discard",onClick:()=>this.messageDiscard.emit(s)},this.t("discard"))))}render(){const e=this.isOwnMessage?this.t("you"):this.sender?.display_name??"";return r("div",{key:"c91f01cbf694c79d4e68b8445a99ffbc5b0b9790",class:"message-row"},!this.isOwnMessage&&r("chatleo-avatar",{key:"6f05c378fd18203d9917f1edbc61b20bf94b81b9",name:e,url:this.sender?.profile_picture_url??null,isOnline:this.senderIsOnline}),r("div",{key:"b1f4df458b587cace3423637b5bad8350a5c3a14",class:"message-content"},r("div",{key:"f7c565319462013dac380d21a813e21861544833",class:"message-header",style:{justifyContent:this.isOwnMessage?"end":"start"}},r("span",{key:"4d30b5eb0c55abb854b6192f0fe9c78bb54aff33",class:"message-author"},e),r("span",{key:"13867dc122764cbdbdd7fa60f5ff7e6916ed49e7",class:"message-timestamp"},this.formatTimestamp(this.message.created_at))),this.renderMessageContent(),this.renderDeliveryStatus()),this.isOwnMessage&&r("chatleo-avatar",{key:"c818e945cb494c07356fae74c00719e32a2c6b23",name:e,url:this.sender?.profile_picture_url??null,isOnline:this.senderIsOnline}))}static get style(){return":host{--status-size:9px;--status-border:1.5px}.message-row{display:flex;gap:16px;padding-left:16px}.message-avatar-container{position:relative;width:var(--avatar-size);height:var(--avatar-size);flex-shrink:0}.message-avatar{width:100%;height:100%;border-radius:50%;object-fit:cover;background:var(--bg-light)}.message-status-indicator{position:absolute;bottom:0;right:0;width:var(--status-size);height:var(--status-size);border-radius:50%;border:var(--status-border) solid var(--bg-primary)}.message-status-indicator.online{background:var(--status-online)}.message-status-indicator.offline{background:var(--border-color)}.message-content{flex:1;display:flex;flex-direction:column;gap:4px}.message-header{display:flex;align-items:center;gap:8px}.message-author{font-family:var(--font-primary);font-weight:700;font-size:14px;line-height:1.6;color:var(--text-primary)}.message-timestamp{font-family:var(--font-primary);font-weight:400;font-size:12px;line-height:1.65;color:var(--text-secondary)}.message-timestamp::before{content:'•';margin-right:8px}.message-text{font-family:var(--font-primary);font-weight:400;font-size:14px;line-height:1.6;color:var(--text-primary);word-wrap:break-word;}.message-status{display:flex;align-items:center;gap:8px;font-family:var(--font-primary);font-size:12px;line-height:1.5}.message-status.pending{color:var(--text-secondary);font-style:italic}.message-status.failed{color:#c62828;flex-wrap:wrap}.message-status-actions{display:inline-flex;gap:6px}.status-action{border:1px solid currentColor;background:transparent;color:inherit;border-radius:4px;padding:1px 8px;font:inherit;cursor:pointer}.status-action:hover{background:rgba(198, 40, 40, 0.08)}.status-action.discard{opacity:0.8}.call-message{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border:1px solid var(--border-light, #ddd);border-radius:8px;font-family:var(--font-primary);font-size:13px;color:var(--text-secondary, #667);background:var(--bg-secondary, transparent)}.call-message::before{content:'☎';font-size:15px}"}},[513,"chatleo-chat-message",{message:[16],sender:[16],senderIsOnline:[4,"sender-is-online"],isOwnMessage:[4,"is-own-message"],locale:[1],translations:[16]}]);function l(){"undefined"!=typeof customElements&&["chatleo-chat-message","chatleo-avatar","chatleo-rich-message-renderer"].forEach((t=>{switch(t){case"chatleo-chat-message":customElements.get(e(t))||customElements.define(e(t),o);break;case"chatleo-avatar":customElements.get(e(t))||i();break;case"chatleo-rich-message-renderer":customElements.get(e(t))||n()}}))}l();export{o as C,l as d}
@@ -0,0 +1 @@
1
+ import{t as e,p as a,H as t,c as o,h as s}from"./p-C-v19aUJ.js";import{d as r}from"./p-Exj_2-yI.js";const i=a(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.roomClicked=o(this,"roomClicked")}room;chatStore;onlineUserIds;lastMessage;timestamp;unreadCount;isActive=!1;roomClicked;onClick(){console.log("Room clicked",this.room.id),this.roomClicked.emit({id:this.room.id})}render(){const e=this.onlineUserIds.includes(this.room.participantIdsWithoutSelf[0]),a=this.chatStore?.users.find((e=>e.id===this.room.participantIdsWithoutSelf[0]))?.profile_picture_url,t=this.isActive?"room-tile active":"room-tile",o=this.chatStore?.activeCall(this.room.id);return s("div",{key:"2f667c91928a5dc65554d2204372b322b0e43272",class:t,onClick:()=>this.onClick()},s("chatleo-avatar",{key:"2b072a48103fad1cfe23a0eec2c18645572e8071",name:this.room.name,url:a,isOnline:e}),s("div",{key:"bfb0d3b61dbd0bc816b8c0c578e04c622214a3ad",class:"room-content"},s("div",{key:"2ce0fda6bcd7af24a8bb823f7ba75329449239cf",class:"room-header"},s("h3",{key:"fa5ed3dd1401c147f2996bc93bed06d8f096a521",class:"room-name"},this.room.name),s("span",{key:"308d082b266a01fad292839ae69c4edd0a21d1bb",class:"timestamp"},this.timestamp??"")),s("div",{key:"f7b3206df5b8f9870ff358f693d4600fb21302d4",class:"room-footer"},s("p",{key:"a69f70a6b237b7e0c1f5776627f7ffd3ed16685d",class:"last-message"},o?"Call in progress":this.lastMessage??" "),o&&s("span",{key:"03e324140c78c3bce371fd14725eca835596a600",class:"call-marker",title:"Call in progress"},"Call"),this.room.isReadOnly?s("span",{class:"read-only-badge"},"Read only"):this.unreadCount>0&&s("span",{class:"unread-count"},this.unreadCount))))}static get style(){return":host{--room-name-size:16px;--timestamp-size:12px;--message-size:14px;--unread-size:12px;--room-name-weight:600;--unread-weight:600;--room-margin:4px;--room-spacing:8px;--unread-padding:2px 8px;--unread-radius:10px;--unread-min-width:20px;display:block}.room-tile{display:flex;align-items:center;cursor:pointer;transition:background-color var(--transition-duration) ease}.room-tile.active{background-color:var(--bg-secondary, #f0f0f0)}.room-content{padding-left:var(--room-spacing);flex:1;min-width:0}.room-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--room-margin)}.room-name{font-size:var(--room-name-size);font-weight:var(--room-name-weight);margin:0;color:var(--text-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.timestamp{font-size:var(--timestamp-size);color:var(--text-secondary);flex-shrink:0;margin-left:var(--room-spacing)}.room-footer{display:flex;align-items:center;justify-content:space-between}.last-message{font-size:var(--message-size);color:var(--text-secondary);margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.read-only-badge{font-size:var(--timestamp-size);color:var(--text-secondary);flex-shrink:0;margin-left:var(--room-spacing)}.unread-count{background-color:var(--accent-color);color:white;font-size:0.7rem;line-height:1;text-align:center;display:flex;justify-content:center;align-items:center;width:1rem;height:1rem;border-radius:50%;overflow:hidden;flex-shrink:0}.call-marker{margin-left:6px;padding:1px 6px;border-radius:999px;background:#1b8a3a;color:#fff;font-size:10px;font-weight:700;text-transform:uppercase}"}},[513,"chatleo-room-tile-component",{room:[16],chatStore:[16],onlineUserIds:[16],lastMessage:[1,"last-message"],timestamp:[1],unreadCount:[2,"unread-count"],isActive:[4,"is-active"]}]);function n(){"undefined"!=typeof customElements&&["chatleo-room-tile-component","chatleo-avatar"].forEach((a=>{switch(a){case"chatleo-room-tile-component":customElements.get(e(a))||customElements.define(e(a),i);break;case"chatleo-avatar":customElements.get(e(a))||r()}}))}n();export{i as C,n as d}
@@ -0,0 +1 @@
1
+ import{t as e,p as t,H as s,c as a,h as r}from"./p-C-v19aUJ.js";import{d as i}from"./p-Exj_2-yI.js";const o=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.userClicked=a(this,"userClicked")}profile;isOnline=!1;lastSeen;userClicked;onClick(){this.profile&&this.userClicked.emit(this.profile)}render(){const e=this.profile,t=e?.profile_picture_url,s=e?.display_name??"Unknown user";return r("div",{key:"a1e0334d626b162edba9e5bcb93472ab1d75ea8d",class:"user-tile",onClick:()=>this.onClick()},r("chatleo-avatar",{key:"3eed64212482962fe151dbcdb275d2396d91a39f",name:s,url:t,isOnline:this.isOnline}),r("div",{key:"9438ec481cd480b576ef18e95a9fc30003b200ea",class:"user-content"},r("div",{key:"62a9cd55c2e1061c28934f419addbd3ac28b6dca",class:"user-header"},r("h3",{key:"e8f36bfd9e972193fc066b0a0de8a599180104a9",class:"user-name"},s)),r("div",{key:"dbffef93dbe1aff1b85a73669d020df94159b014",class:"user-footer"},r("p",{key:"ee7c35805b645f520b8ef9913c282e0651770684",class:"user-status"},this.isOnline?"Online":this.lastSeen?`Zuletzt online ${this.lastSeen}`:""))))}static get style(){return":host{--hover-color:#f5f7fa;--user-tile-border:1px solid var(--border-color);--font-size-name:16px;--font-size-status:14px;--font-weight-name:600;--tile-margin:2px;display:block}.user-tile{display:flex;align-items:center;cursor:pointer;transition:background-color var(--transition-duration) ease;border-bottom:var(--user-tile-border)}.user-tile:hover{background-color:var(--hover-color)}.user-content{flex:1;min-width:0;margin-left:8px}.user-header{margin-bottom:var(--tile-margin)}.user-name{font-size:var(--font-size-name);font-weight:var(--font-weight-name);margin:0;color:var(--text-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.user-footer{display:flex;align-items:center}.user-status{font-size:var(--font-size-status);color:var(--text-secondary);margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}"}},[513,"chatleo-user-tile",{profile:[16],isOnline:[4,"is-online"],lastSeen:[1,"last-seen"]}]);function n(){"undefined"!=typeof customElements&&["chatleo-user-tile","chatleo-avatar"].forEach((t=>{switch(t){case"chatleo-user-tile":customElements.get(e(t))||customElements.define(e(t),o);break;case"chatleo-avatar":customElements.get(e(t))||i()}}))}n();export{o as C,n as d}
@@ -0,0 +1,3 @@
1
+ const globalScripts = () => {};
2
+
3
+ export { globalScripts as g };