@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,i){const s="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==s;){const s=Object.getOwnPropertyDescriptor(t,e);if(s&&(!i||s.get))return s;t=Object.getPrototypeOf(t)}}var e,i=(e,i)=>{var s;Object.entries(null!=(s=i.l.t)?s:{}).map((([s,[n]])=>{if(31&n||32&n){const n=e[s],a=t(Object.getPrototypeOf(e),s,!0)||Object.getOwnPropertyDescriptor(e,s);a&&Object.defineProperty(e,s,{get(){return a.get.call(this)},set(t){a.set.call(this,t)},configurable:!0,enumerable:!0}),i.o.has(s)?e[s]=i.o.get(s):void 0!==n&&(e[s]=n)}}))},s=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},n=(t,e)=>e in t,a=(t,e)=>(0,console.error)(t,e),o=new Map,r="undefined"!=typeof window?window:{},c=r.HTMLElement||class{},l={i:0,u:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,i,s)=>t.addEventListener(e,i,s),rel:(t,e,i,s)=>t.removeEventListener(e,i,s),ce:(t,e)=>new CustomEvent(t,e)},h=(()=>{try{return!!r.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),d=!!h&&!!r.document&&Object.getOwnPropertyDescriptor(r.document.adoptedStyleSheets,"length").writable,f=!1,u=[],p=[],m=()=>{var t;return(null==(t=r.document)?void 0:t.hidden)?setTimeout(g,16):l.raf(g)},b=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){a(t)}t.length=0},g=()=>{b(u),b(p),(f=u.length>0)&&m()},y=t=>Promise.resolve(void 0).then(t),v=(t=>e=>{t.push(e),f||(f=!0,4&l.i?y(g):m())})(p);function w(){const t=this.attachShadow({mode:"open"});void 0===e&&(e=null),e&&(d?t.adoptedStyleSheets.push(e):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e])}var k,x=new WeakMap,S=t=>"sc-"+t.p,C=t=>"object"==(t=typeof t)||"function"===t,M=(t,e,...i)=>{let s=null,n=null,o=!1,r=!1;const c=[],l=e=>{for(let i=0;i<e.length;i++)if(s=e[i],Array.isArray(s))l(s);else if(null!=s&&"boolean"!=typeof s){if(o="function"!=typeof t&&!C(s))s+="";else if("function"!=typeof t&&void 0===s.i){a("Invalid vNode child");continue}o&&r?c[c.length-1].h+=s:c.push(o?E(null,s):s),r=o}};if(l(i),e){e.key&&(n=e.key);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}const h=E(t,null);return h.m=e,c.length>0&&(h.v=c),h.$=n,h},E=(t,e)=>({i:0,j:t,h:null!=e?e:null,O:null,v:null,m:null,$:null}),T={},j=t=>{if(!t)return;const e=Object.keys(t);if(0===e.length)return;let i=!1;for(const s of e){if(i)break;for(const e of t[s])if("string"==typeof e){i=!0;break}}if(!i)return t;const s={};for(const i of e)s[i]=t[i].map((t=>"string"==typeof t?{[t]:0}:t));return s},I=(t,e)=>null==t||C(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?"string"==typeof t?parseFloat(t):"number"==typeof t?t:NaN:1&e?t+"":t,R=(t,e)=>{const i=t;return{emit:t=>L(i,e,{bubbles:!0,composed:!0,cancelable:!0,detail:t})}},L=(t,e,i)=>{const s=l.ce(e,i);return t.dispatchEvent(s),s},W=(t,e,i,a,o,c)=>{if(i===a)return;let h=n(t,e),d=e.toLowerCase();if("class"===e){const e=t.classList,s=_(i);let n=_(a);{let t=s.filter((t=>t&&!n.includes(t)));e.remove(...t),e.add(...n.filter((t=>t&&!s.includes(t))))}}else if("style"===e){for(const e in i)a&&null!=a[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in a)i&&a[e]===i[e]||(e.includes("-")?t.style.setProperty(e,a[e]):t.style[e]=a[e])}else if("key"===e);else if("ref"===e)a&&Z(a,t);else if(t.__lookupSetter__(e)||"o"!==e[0]||"n"!==e[1]){if("a"===e[0]&&e.startsWith("attr:")){const i=e.slice(5);let n;{const e=s(t);if(e&&e.l&&e.l.t){const t=e.l.t[i];t&&t[1]&&(n=t[1])}}return n||(n=i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==a||!1===a?!1===a&&""!==t.getAttribute(n)||t.removeAttribute(n):t.setAttribute(n,!0===a?"":a))}if("p"===e[0]&&e.startsWith("prop:")){const i=e.slice(5);try{t[i]=a}catch(t){}return}{const s=C(a);if((h||s&&null!==a)&&!o)try{if(t.tagName.includes("-"))t[e]!==a&&(t[e]=a);else{const s=null==a?"":a;"list"===e?h=!1:null!=i&&t[e]===s||("function"==typeof t.__lookupSetter__(e)?t[e]=s:t.setAttribute(e,s))}}catch(t){}null==a||!1===a?(!1!==a||""===t.getAttribute(e)||4&c&&!P(e))&&t.removeAttribute(e):(!h||4&c||o)&&!s&&1===t.nodeType&&t.setAttribute(e,a=!0===a?"":a)}}else if(e="-"===e[2]?e.slice(3):n(r,d)?d.slice(2):d[2]+e.slice(3),i||a){const s=e.endsWith(D);e=e.replace(U,""),i&&l.rel(t,e,i,s),a&&l.ael(t,e,a,s)}},A=new Set(["draggable","contenteditable","spellcheck"]),P=t=>A.has(t)||t.startsWith("aria-"),O=/\s/,_=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(O):[]),D="Capture",U=RegExp(D+"$"),z=(t,e,i)=>{const s=11===e.O.nodeType&&e.O.host?e.O.host:e.O,n=t&&t.m||{},a=e.m||{};for(const t of N(Object.keys(n)))t in a||W(s,t,n[t],void 0,i,e.i);for(const t of N(Object.keys(a)))W(s,t,n[t],a[t],i,e.i)};function N(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var $=!1,H=!1,q=[],F=[],B=(t,e,i)=>{const s=e.v[i];let n,a,o=0;if(null!=s.h)n=s.O=r.document.createTextNode(s.h);else{if(!r.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(n=s.O=r.document.createElement(s.j),z(null,s,H),s.v){const e="template"===s.j?n.content:n;for(o=0;o<s.v.length;++o)a=B(t,s,o),a&&e.appendChild(a)}}return n["s-hn"]=k,n},J=(t,e,i,s,n,a)=>{let o,r=t;for(r.shadowRoot&&r.tagName===k&&(r=r.shadowRoot),"template"===i.j&&(r=r.content);n<=a;++n)s[n]&&(o=B(null,i,n),o&&(s[n].O=o,G(r,o,e)))},V=(t,e,i)=>{for(let s=e;s<=i;++s){const e=t[s];if(e){const t=e.O;K(e),t&&t.remove()}}},Y=(t,e,i=!1)=>t.j===e.j&&(i?(i&&!t.$&&e.$&&(t.$=e.$),!0):t.$===e.$),X=(t,e,i=!1)=>{const s=e.O=t.O,n=t.v,a=e.v,o=e.h;null==o?("slot"!==e.j||$||t.S!==e.S&&(e.O["s-sn"]=e.S||"",(t=>{l.i|=1;const e=t.closest(k.toLowerCase());if(null!=e){const i=Array.from(e.__childNodes||e.childNodes).find((t=>t["s-cr"])),s=Array.from(t.__childNodes||t.childNodes);for(const t of i?s.reverse():s)null!=t["s-sh"]&&(G(e,t,null!=i?i:null),t["s-sh"]=void 0)}l.i&=-2})(e.O.parentElement)),z(t,e,H),null!==n&&null!==a?((t,e,i,s,n=!1)=>{let a,o,r=0,c=0,l=0,h=0,d=e.length-1,f=e[0],u=e[d],p=s.length-1,m=s[0],b=s[p];const g="template"===i.j?t.content:t;for(;r<=d&&c<=p;)if(null==f)f=e[++r];else if(null==u)u=e[--d];else if(null==m)m=s[++c];else if(null==b)b=s[--p];else if(Y(f,m,n))X(f,m,n),f=e[++r],m=s[++c];else if(Y(u,b,n))X(u,b,n),u=e[--d],b=s[--p];else if(Y(f,b,n))X(f,b,n),G(g,f.O,u.O.nextSibling),f=e[++r],b=s[--p];else if(Y(u,m,n))X(u,m,n),G(g,u.O,f.O),u=e[--d],m=s[++c];else{for(l=-1,h=r;h<=d;++h)if(e[h]&&null!==e[h].$&&e[h].$===m.$){l=h;break}l>=0?(o=e[l],o.j!==m.j?a=B(e&&e[c],i,c):(X(o,m,n),e[l]=void 0,a=o.O),m=s[++c]):(a=B(e&&e[c],i,c),m=s[++c]),a&&G(f.O.parentNode,a,f.O)}r>d?J(t,null==s[p+1]?null:s[p+1].O,i,s,c,p):c>p&&V(e,r,d)})(s,n,e,a,i):null!==a?(null!==t.h&&(s.textContent=""),J(s,null,e,a,0,a.length-1)):!i&&null!==n&&V(n,0,n.length-1)):t.h!==o&&(s.data=o)},K=t=>{t.m&&t.m.ref&&q.push((()=>t.m.ref(null))),t.v&&t.v.map(K)},Z=(t,e)=>{F.push((()=>t(e)))},G=(t,e,i)=>null==t?void 0:t.insertBefore(e,i),Q=(t,e)=>{if(e&&!t.M&&e["s-p"]){const i=e["s-p"].push(new Promise((s=>t.M=()=>{e["s-p"].splice(i-1,1),s()})))}},tt=(t,e)=>{if(t.i|=16,4&t.i)return void(t.i|=512);Q(t,t.A);const i=()=>et(t,e);if(!e)return v(i);queueMicrotask((()=>{i()}))},et=(t,e)=>{const i=t.$hostElement$,s=i;if(!s)throw Error(`Can't render component <${i.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 n;return n=ct(s,e?"componentWillLoad":"componentWillUpdate",void 0,i),n=it(n,(()=>ct(s,"componentWillRender",void 0,i))),it(n,(()=>nt(t,s,e)))},it=(t,e)=>st(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),st=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,nt=async(t,e,i)=>{var s;const n=t.$hostElement$,a=n["s-rc"];i&&(t=>{const e=t.l,i=t.$hostElement$,s=e.i,n=((t,e)=>{var i,s,n;const a=S(e),c=o.get(a);if(!r.document)return a;if(t=11===t.nodeType?t:r.document,c)if("string"==typeof c){let n,o=x.get(t=t.head||t);if(o||x.set(t,o=new Set),!o.has(a)){n=r.document.createElement("style"),n.textContent=c;const f=null!=(i=l.C)?i:function(){var t,e,i;return null!=(i=null==(e=null==(t=r.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?i:void 0}();if(null!=f&&n.setAttribute("nonce",f),!(1&e.i))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),i=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(n,(null==i?void 0:i.parentNode)===t?i:null)}else if("host"in t)if(h){const e=new(null!=(s=t.defaultView)?s: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(n)}else t.append(n);1&e.i&&t.insertBefore(n,null),4&e.i&&(n.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),o&&o.add(a)}}else{let e=x.get(t);if(e||x.set(t,e=new Set),!e.has(a)){const i=null!=(n=t.defaultView)?n:t.ownerDocument.defaultView;let s;if(c.constructor===i.CSSStyleSheet)s=c;else{s=new i.CSSStyleSheet;for(let t=0;t<c.cssRules.length;t++)s.insertRule(c.cssRules[t].cssText,t)}d?t.adoptedStyleSheets.push(s):t.adoptedStyleSheets=[...t.adoptedStyleSheets,s],e.add(a)}}return a})(i.shadowRoot?i.shadowRoot:i.getRootNode(),e);10&s&&(i["s-sc"]=n,i.classList.add(n+"-h"))})(t),at(t,e,n,i),a&&(a.map((t=>t())),n["s-rc"]=void 0);{const e=null!=(s=n["s-p"])?s:[],i=()=>ot(t);0===e.length?i():(Promise.all(e).then(i).catch(i),t.i|=4,e.length=0)}},at=(t,e,i,s)=>{try{e=e.render(),t.i&=-17,t.i|=2,((t,e,i=!1)=>{const s=t.$hostElement$,n=t.l,a=t.k||E(null,null),o=(t=>t&&t.j===T)(e)?e:M(null,null,e);if(k=s.tagName,i&&o.m)for(const t of Object.keys(o.m))s.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(o.m[t]=s[t]);o.j=null,o.i|=4,t.k=o,o.O=a.O=s.shadowRoot||s,$=!(!(1&n.i)||128&n.i),X(a,o,i),q.forEach((t=>t())),q.length=0,F.forEach((t=>t())),F.length=0})(t,e,s)}catch(e){a(e,t.$hostElement$)}return null},ot=t=>{const e=t.$hostElement$,i=e,s=t.A;ct(i,"componentDidRender",void 0,e),64&t.i?ct(i,"componentDidUpdate",void 0,e):(t.i|=64,lt(e),ct(i,"componentDidLoad",void 0,e),t.N(e),s||rt()),t.M&&(t.M(),t.M=void 0),512&t.i&&y((()=>tt(t,!1))),t.i&=-517},rt=()=>{y((()=>L(r,"appload",{detail:{namespace:"callcomponents"}})))},ct=(t,e,i,s)=>{if(t&&t[e])try{return t[e](i)}catch(t){a(t,s)}},lt=t=>t.classList.add("hydrated"),ht=(t,e,i,n)=>{const o=s(t);if(!o)return;const r=t,c=o.o.get(e),l=o.i,h=r;if(!((i=I(i,n.t[e][0]))===c||Number.isNaN(c)&&Number.isNaN(i))){if(o.o.set(e,i),n.L){const t=n.L[e];t&&t.map((t=>{try{const[[s,n]]=Object.entries(t);(128&l||1&n)&&(h?h[s](i,c,e):o._.push((()=>{o.D[s](i,c,e)})))}catch(t){a(t,r)}}))}if(2&l){if(h.componentShouldUpdate&&!1===h.componentShouldUpdate(i,c,e)&&!(16&l))return;16&l||tt(o,!1)}}},dt=(e,i)=>{var n,a;const o=e.prototype;{e.watchers&&!i.L&&(i.L=j(e.watchers)),e.deserializers&&!i.H&&(i.H=e.deserializers),e.serializers&&!i.P&&(i.P=e.serializers);const r=Object.entries(null!=(n=i.t)?n:{});r.map((([e,[n]])=>{if(31&n||32&n){const{get:a,set:r}=t(o,e)||{};a&&(i.t[e][0]|=2048),r&&(i.t[e][0]|=4096),Object.defineProperty(o,e,{get(){return a?a.apply(this):((t,e)=>s(this).o.get(e))(0,e)},configurable:!0,enumerable:!0}),Object.defineProperty(o,e,{set(t){const a=s(this);if(a){if(r)return void 0===(32&n?this[e]:a.$hostElement$[e])&&a.o.get(e)&&(t=a.o.get(e)),r.call(this,I(t,n)),void ht(this,e,t=32&n?this[e]:a.$hostElement$[e],i);ht(this,e,t,i)}}})}}));{const t=new Map;o.attributeChangedCallback=function(e,n,a){l.jmp((()=>{var c;const l=t.get(e),h=s(this);if(this.hasOwnProperty(l),o.hasOwnProperty(l)&&"number"==typeof this[l]&&this[l]==a)return;if(null==l){const t=null==h?void 0:h.i;if(h&&t&&!(8&t)&&a!==n){const s=this,o=null==(c=i.L)?void 0:c[e];null==o||o.forEach((i=>{const[[o,r]]=Object.entries(i);null!=s[o]&&(128&t||1&r)&&s[o].call(s,a,n,e)}))}return}const d=r.find((([t])=>t===l)),f=4&(d?d[1][0]:0),u=f&&null===a&&void 0===this[l];f&&(a=null!==a&&"false"!==a);const p=Object.getOwnPropertyDescriptor(o,l);u||a==this[l]||p.get&&!p.set||(this[l]=a)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(a=i.L)?a:{}),...r.filter((([t,e])=>31&e[0])).map((([e,i])=>{const s=i[1]||e;return t.set(s,e),s}))]))}}return e},ft=async(t,e,i)=>{let s;try{if(!(32&e.i)&&(e.i|=32,e.i&=-1025,s=t.constructor,customElements.whenDefined(t.localName).then((()=>e.i|=128)),s&&s.style)){let t;"string"==typeof s.style&&(t=s.style);const e=S(i);o.has(e)||((t,e,i)=>{let s=o.get(t);h&&i?(s=s||new CSSStyleSheet,"string"==typeof s?s=e:s.replaceSync(e)):s=e,o.set(t,s)})(e,t,!!(1&i.i))}const n=e.A,a=()=>tt(e,!0);n&&n["s-rc"]?n["s-rc"].push(a):a()}catch(i){a(i,t),e.M&&(e.M(),e.M=void 0),!e.N||1024&e.i||e.N(t)}},ut=(t,e)=>{const n={i:e[0],p:e[1]};try{n.t=e[2],n.R=e[3],n.L=j(t.L),n.H=t.H,n.P=t.P;const a=t.prototype.connectedCallback,o=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,e)=>{const s={i:0,$hostElement$:t,l:e,o:new Map,U:new Map};s.W=new Promise((t=>s.N=t)),t["s-p"]=[],t["s-rc"]=[];const n=s;t.__stencil__getHostRef=()=>n,512&e.i&&i(t,s)})(this,n)},connectedCallback(){if(!this.__hasHostListenerAttached){const t=s(this);if(!t)return;pt(this,t,n.R),this.__hasHostListenerAttached=!0}(t=>{if(!(1&l.i)){const e=s(t);if(!e)return;const i=e.l;if(1&e.i)pt(t,e,i.R),(null==e?void 0:e.D)||(1024&e.i?setTimeout((()=>ft(t,e,i)),1e3):(null==e?void 0:e.W)&&e.W.then((()=>{})));else{e.i|=1;{let i=t;for(;i=i.parentNode||i.host;)if(i["s-p"]){Q(e,e.A=i);break}}i.t&&Object.entries(i.t).map((([e,[i]])=>{if(31&i&&Object.prototype.hasOwnProperty.call(t,e)){const i=t[e];delete t[e],t[e]=i}})),ft(t,e,i)}}})(this),a&&a.call(this)},disconnectedCallback(){(async t=>{if(!(1&l.i)){const e=s(t);(null==e?void 0:e.T)&&(e.T.map((t=>t())),e.T=void 0)}x.has(t)&&x.delete(t),t.shadowRoot&&x.has(t.shadowRoot)&&x.delete(t.shadowRoot)})(this),o&&o.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${n.p}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else w.call(this,n)}}),Object.defineProperty(t,"is",{value:n.p,configurable:!0}),dt(t,n)}catch(e){return a(e),t}},pt=(t,e,i)=>{i&&r.document&&i.map((([i,s,n])=>{const a=t,o=mt(e,n),r=bt(i);l.ael(a,s,o,r),(e.T=e.T||[]).push((()=>l.rel(a,s,o,r)))}))},mt=(t,e)=>i=>{try{t.$hostElement$[e](i)}catch(e){a(e,t.$hostElement$)}},bt=t=>({passive:!!(1&t),capture:!!(2&t)});const gt={publishAudio:!1,publishVideo:!1,publishScreen:!1,moderate:!1},yt={join:"Join call",leave:"Leave call",connecting:"Connecting…",reconnecting:"Reconnecting…",migrating:"Moving to another server…",ended:"Call ended",failed:"Call failed",mute:"Mute microphone",unmute:"Unmute microphone",cameraOn:"Turn camera on",cameraOff:"Turn camera off",shareScreen:"Share screen",stopSharing:"Stop sharing",raiseHand:"Raise hand",lowerHand:"Lower hand",chat:"Chat",transcript:"Transcript",captions:"Captions",layout:"Switch layout",lobbyTitle:"Ready to join?",speaker:"Speaker",microphone:"Microphone",camera:"Camera",noDevices:"No devices found",permissionDenied:"Microphone or camera access was denied. Allow access in your browser settings and try again.",permissionBlocked:"Your system is blocking access to the microphone or camera.",joinAsListener:"Join as listener",incomingCall:"Incoming call",accept:"Accept",decline:"Decline",promote:"Promote to speaker",demote:"Move to audience",muteParticipant:"Mute participant",removeParticipant:"Remove participant",audience:"audience",noAudienceYet:"No audience yet",waitingForOthers:"Waiting for others to join…",calling:"Calling…",resumeAudio:"Resume audio",audioBlocked:"Your browser blocked audio playback.",transcriptionRunning:"Transcription is running",recordingRunning:"Recording is running",rejoin:"Rejoin",shareUnsupported:"Screen sharing is not supported in this browser.",shareAlreadyActive:"Someone is already sharing their screen.",deviceFallback:"Your selected device was disconnected. The default device is now in use.",emptyTranscript:"No transcript yet.",pin:"Pin participant",unpin:"Unpin participant",quality:"Video quality",layerAuto:"Auto",layerLow:"Low",layerMedium:"Medium",layerHigh:"High",layerReasonBandwidth:"Bandwidth",layerReasonPinned:"Pinned",layerReasonPublisher:"Publisher",agentIdle:"Idle",agentListening:"Listening",agentThinking:"Thinking",agentSpeaking:"Speaking"};function vt(t){return{...yt,...t??{}}}const wt={speakerActivationDelayMs:300,speakerHoldMs:2e3,speakerThreshold:.02,reconnectTimeoutMs:3e4},kt={permissionDenied:{code:"permission_denied",category:"permission",recoverable:!0,message:"Microphone or camera access was denied."},permissionBlocked:{code:"permission_blocked",category:"permission",recoverable:!0,message:"The operating system is blocking access to the device."},deviceNotFound:{code:"device_not_found",category:"device",recoverable:!0,message:"The selected device is not available."},deviceUnplugged:{code:"device_unplugged",category:"device",recoverable:!0,message:"A device was disconnected; the default device is now in use."},authExpired:{code:"auth_expired",category:"auth",recoverable:!0,message:"The call token expired."},authRejected:{code:"auth_rejected",category:"auth",recoverable:!1,message:"The call token was rejected."},sessionUnknown:{code:"session_unknown",category:"network",recoverable:!0,message:"The call session is no longer available; rejoining."},negotiationInProgress:{code:"negotiation_in_progress",category:"protocol",recoverable:!0,message:"The call server is negotiating; trying again."},sessionReplaced:{code:"session_replaced",category:"auth",recoverable:!1,message:"You joined this call on another device."},rateLimited:{code:"rate_limited",category:"network",recoverable:!0,message:"The call server is busy; retrying."},capabilityDenied:{code:"capability_denied",category:"auth",recoverable:!1,message:"This action is not allowed for your role."},networkLost:{code:"network_lost",category:"network",recoverable:!0,message:"The connection to the call server was lost."},networkFailed:{code:"network_failed",category:"network",recoverable:!0,message:"Could not reconnect to the call. You can rejoin."},iceFailed:{code:"ice_failed",category:"network",recoverable:!0,message:"The media connection failed and is being renegotiated."},roomEnded:{code:"room_ended",category:"room",recoverable:!1,message:"The call ended."},roomFull:{code:"room_full",category:"room",recoverable:!1,message:"The room is full."},removed:{code:"removed",category:"room",recoverable:!1,message:"You were removed from the call."},protocolMismatch:{code:"protocol_mismatch",category:"protocol",recoverable:!1,message:"This client is not compatible with the call server."},invalidAction:{code:"invalid_action",category:"room",recoverable:!0,message:"That action is not available right now."},shareUnsupported:{code:"share_unsupported",category:"device",recoverable:!0,message:"Screen sharing is not supported in this browser."},shareAlreadyActive:{code:"share_already_active",category:"room",recoverable:!0,message:"Someone is already sharing their screen."}};let xt=class t extends Error{constructor(t,e,i){super(e??t.message),this.name="CallError",this.code=t.code,this.category=t.category,this.recoverable=t.recoverable,this.cause=i}static from(e,i,s){return new t(kt[e],i,s)}toInfo(){return{code:this.code,category:this.category,recoverable:this.recoverable,message:this.message}}};function St(t,e,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(t):s?s.value:e.get(t)}function Ct(t,e,i){if("function"==typeof e||!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,i),i}var Mt,Et,Tt,jt,It,Rt,Lt,Wt,At,Pt,Ot,_t,Dt,Ut,zt,Nt,$t,Ht,qt,Ft,Bt,Jt,Vt,Yt,Xt,Kt,Zt,Gt,Qt,te,ee,ie,se,ne,ae,oe,re,ce,le,he,de,fe,ue,pe,me,be,ge,ye,ve,we,ke,xe,Se,Ce,Me,Ee,Te,je,Ie,Re,Le,We,Ae,Pe,Oe,_e,De,Ue,ze,Ne,$e,He,qe,Fe,Be,Je,Ve,Ye,Xe,Ke,Ze,Ge,Qe,ti,ei,ii,si;"function"==typeof SuppressedError&&SuppressedError;class ni{constructor(t){Mt.set(this,void 0),Et.set(this,new Set),Ct(this,Mt,t)}getState(){return St(this,Mt,"f")}setState(t){const e=t(St(this,Mt,"f"));if(!Object.is(e,St(this,Mt,"f"))){Ct(this,Mt,e);for(const t of Array.from(St(this,Et,"f"))){const i=t.selector(e);if(!t.equals(t.last,i)){const e=t.last;t.last=i,t.listener(i,e)}}}}subscribe(t,e,i=Object.is){const s={selector:t,listener:e,equals:i,last:t(St(this,Mt,"f"))};St(this,Et,"f").add(s);const n=()=>{St(this,Et,"f").delete(s)};return Object.assign(n,{unsubscribe:n})}get subscriberCount(){return St(this,Et,"f").size}}Mt=new WeakMap,Et=new WeakMap;class ai{constructor(t={}){Tt.add(this),jt.set(this,void 0),It.set(this,new Map),Rt.set(this,null),Lt.set(this,0),Wt.set(this,0),Ct(this,jt,{...wt,...t})}get activeSpeakerId(){return St(this,Rt,"f")}get config(){return St(this,jt,"f")}update(t,e=Date.now()){Ct(this,Wt,e);const i=[],s=new Set;for(const[n,a]of Object.entries(t)){s.add(n);const t=St(this,It,"f").get(n)??{aboveSince:null,lastAbove:0},o=Number.isFinite(a)&&a>=St(this,jt,"f").speakerThreshold;o?(t.lastAbove=e,null===t.aboveSince&&(t.aboveSince=e)):t.aboveSince=null,St(this,It,"f").set(n,t),o&&i.push(n)}for(const[t,i]of St(this,It,"f"))!s.has(t)&&e-i.lastAbove>St(this,jt,"f").speakerHoldMs&&(St(this,It,"f").delete(t),St(this,Rt,"f")===t&&Ct(this,Rt,null));const n=St(this,Tt,"m",At).call(this);if(n){const t=St(this,It,"f").get(n),i=null!==t.aboveSince&&e-t.aboveSince>=St(this,jt,"f").speakerActivationDelayMs,s=St(this,Rt,"f")?St(this,It,"f").get(St(this,Rt,"f")):void 0,a=!!s&&e-s.lastAbove<St(this,jt,"f").speakerHoldMs;!i||St(this,Rt,"f")&&n===St(this,Rt,"f")||a&&null!==St(this,Rt,"f")||(Ct(this,Rt,n),Ct(this,Lt,e))}else if(St(this,Rt,"f")){const t=St(this,It,"f").get(St(this,Rt,"f"));(!t||e-t.lastAbove>=St(this,jt,"f").speakerHoldMs)&&Ct(this,Rt,null)}return{speaking:i,activeSpeakerId:St(this,Rt,"f")}}remove(t){St(this,It,"f").delete(t),St(this,Rt,"f")===t&&Ct(this,Rt,null)}reset(){St(this,It,"f").clear(),Ct(this,Rt,null),Ct(this,Lt,0)}get lastUpdate(){return St(this,Wt,"f")}get activeSince(){return St(this,Lt,"f")}}jt=new WeakMap,It=new WeakMap,Rt=new WeakMap,Lt=new WeakMap,Wt=new WeakMap,Tt=new WeakSet,At=function(){let t=null,e=Number.POSITIVE_INFINITY;for(const[i,s]of St(this,It,"f"))null!==s.aboveSince&&s.aboveSince<e&&(t=i,e=s.aboveSince);return t};class oi{constructor(t={}){Pt.set(this,void 0),Ot.set(this,void 0),_t.set(this,[]),Dt.set(this,{}),Ut.set(this,"unknown"),zt.set(this,new Set),Nt.set(this,(()=>{this.refresh()})),$t.set(this,!1),Ct(this,Pt,t.logger),Ct(this,Ot,t.mediaDevices??("undefined"!=typeof navigator?navigator.mediaDevices:void 0))}get devices(){return St(this,_t,"f")}get selected(){return{...St(this,Dt,"f")}}get permission(){return St(this,Ut,"f")}get supported(){return!!St(this,Ot,"f")}async start(){St(this,$t,"f")||"undefined"==typeof navigator||(Ct(this,$t,!0),navigator.mediaDevices?.addEventListener?.("devicechange",St(this,Nt,"f")),await this.refresh())}stop(){St(this,$t,"f")&&"undefined"!=typeof navigator&&(navigator.mediaDevices?.removeEventListener?.("devicechange",St(this,Nt,"f")),Ct(this,$t,!1))}onChange(t){return St(this,zt,"f").add(t),()=>St(this,zt,"f").delete(t)}async refresh(){if(!St(this,Ot,"f")?.enumerateDevices)return St(this,_t,"f");try{const t=await St(this,Ot,"f").enumerateDevices();Ct(this,_t,t.filter((t=>"audioinput"===t.kind||"videoinput"===t.kind||"audiooutput"===t.kind)).map((t=>({deviceId:t.deviceId,kind:t.kind,label:t.label,groupId:t.groupId})))),St(this,Dt,"f").audioinput||(St(this,Dt,"f").audioinput=St(this,_t,"f").find((t=>"audioinput"===t.kind))?.deviceId),St(this,Dt,"f").videoinput||(St(this,Dt,"f").videoinput=St(this,_t,"f").find((t=>"videoinput"===t.kind))?.deviceId),St(this,Dt,"f").audiooutput||(St(this,Dt,"f").audiooutput=St(this,_t,"f").find((t=>"audiooutput"===t.kind))?.deviceId),St(this,zt,"f").forEach((t=>t(St(this,_t,"f"))))}catch(t){St(this,Pt,"f")?.warn?.("call-core: could not enumerate devices",t)}return St(this,_t,"f")}async requestPermission(){if(!St(this,Ot,"f")?.getUserMedia)return"unknown";try{(await St(this,Ot,"f").getUserMedia({audio:!0})).getTracks().forEach((t=>t.stop())),Ct(this,Ut,"granted")}catch(t){const e=t?.name;Ct(this,Ut,"NotAllowedError"===e?"denied":"blocked")}return St(this,Ut,"f")}select(t,e){St(this,Dt,"f")[t]=e}async acquire(t){if(!St(this,Ot,"f")?.getUserMedia)throw xt.from("deviceNotFound","This browser does not expose media devices.");const e={};t.audio&&(e.audio=!St(this,Dt,"f").audioinput||{deviceId:{exact:St(this,Dt,"f").audioinput}}),t.video&&(e.video=!St(this,Dt,"f").videoinput||{deviceId:{exact:St(this,Dt,"f").videoinput}});try{const i=await St(this,Ot,"f").getUserMedia(e);return Ct(this,Ut,"granted"),{audio:t.audio?i.getAudioTracks()[0]:void 0,video:t.video?i.getVideoTracks()[0]:void 0}}catch(t){const e=t?.name;throw"NotAllowedError"===e&&Ct(this,Ut,"denied"),"NotReadableError"!==e&&"SecurityError"!==e||Ct(this,Ut,"blocked"),function(t){const e=t?.name;return"NotAllowedError"===e||"SecurityError"===e?xt.from("permissionDenied",void 0,t):xt.from("deviceNotFound","NotFoundError"===e||"OverconstrainedError"===e?void 0:t?.message,t)}(t)}}async replace(t,e){const i="mic"===t,s="camera"===t;try{const t=await this.acquire({audio:i,video:s});return e?.stop(),i?t.audio:t.video}catch(t){if(!e||"ended"===e.readyState)return;return St(this,Pt,"f")?.warn?.("call-core: keeping current track after device switch failed",t),e}}static release(t){if(t)try{t.stop()}catch{}}}Pt=new WeakMap,Ot=new WeakMap,_t=new WeakMap,Dt=new WeakMap,Ut=new WeakMap,zt=new WeakMap,Nt=new WeakMap,$t=new WeakMap;class ri{constructor(){Ht.set(this,void 0),qt.set(this,void 0)}connect(t,e){if(this.disconnect(),Ct(this,qt,t),"undefined"==typeof EventSource)return;const i=new EventSource(t);Ct(this,Ht,i),i.onmessage=t=>{try{const i=JSON.parse(t.data);e("segment"in i?i.segment:i)}catch{}}}disconnect(){St(this,Ht,"f")?.close(),Ct(this,Ht,void 0)}get url(){return St(this,qt,"f")}}Ht=new WeakMap,qt=new WeakMap;class ci{static isSupported(){return"undefined"!=typeof navigator&&!!navigator.mediaDevices?.getDisplayMedia}static async acquire(t={}){if(!ci.isSupported())throw new Error("Screen sharing is not supported in this browser.");const e=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:t.audio??!0}),i=e.getVideoTracks()[0];if(i)try{i.contentHint="detail"}catch{}return e}static release(t){if(t)for(const e of t.getTracks())try{e.stop()}catch{}}static onEnded(t,e){const i=t.getVideoTracks()[0];return i?(i.addEventListener("ended",e,{once:!0}),()=>i.removeEventListener("ended",e)):()=>{}}}class li{constructor(t,e={}){Ft.add(this),Bt.set(this,void 0),Jt.set(this,void 0),Vt.set(this,void 0),Yt.set(this,1),Xt.set(this,new Map),Kt.set(this,!1),Zt.set(this,!1),Ct(this,Bt,t),Ct(this,Jt,e)}get url(){return St(this,Bt,"f").url}get connected(){return St(this,Zt,"f")}connect(){const t=St(this,Bt,"f").WebSocketImpl??("undefined"!=typeof WebSocket?WebSocket:void 0);return t?new Promise(((e,i)=>{let s=!1;const n=setTimeout((()=>{s||(s=!0,this.close(),i(xt.from("networkLost")))}),St(this,Bt,"f").requestTimeoutMs??15e3),a=new t(St(this,Bt,"f").url);Ct(this,Vt,a),a.onopen=()=>{Ct(this,Zt,!0),s||(s=!0,clearTimeout(n),e())},a.onmessage=t=>{St(this,Ft,"m",Qt).call(this,t.data)},a.onerror=()=>{s||(s=!0,clearTimeout(n),i(xt.from("networkLost")))},a.onclose=t=>{if(Ct(this,Zt,!1),St(this,Ft,"m",ee).call(this,xt.from("networkLost")),!s)return s=!0,clearTimeout(n),void i(xt.from("networkLost"));St(this,Kt,"f")||St(this,Jt,"f").onClose?.(t.code,t.reason)}})):Promise.reject(new Error("call-core: WebSocket is not available in this environment."))}request(t,e={}){var i,s;if(1!==St(this,Vt,"f")?.readyState)return Promise.reject(xt.from("networkLost"));const n=(Ct(this,Yt,(s=St(this,Yt,"f"),i=s++,s)),i),a=St(this,Bt,"f").requestTimeoutMs??15e3;return new Promise(((i,s)=>{const o=setTimeout((()=>{St(this,Xt,"f").delete(n),s(xt.from("networkLost",`call-core: ${t} timed out`))}),a);St(this,Xt,"f").set(n,{resolve:t=>i(t),reject:s,timer:o}),St(this,Ft,"m",Gt).call(this,{jsonrpc:"2.0",id:n,method:t,params:e})}))}notify(t,e={}){St(this,Ft,"m",Gt).call(this,{jsonrpc:"2.0",method:t,params:e})}close(t=1e3){Ct(this,Kt,!0),Ct(this,Zt,!1),St(this,Ft,"m",ee).call(this,xt.from("networkLost"));const e=St(this,Vt,"f");if(Ct(this,Vt,void 0),e){e.onopen=e.onmessage=e.onerror=e.onclose=null;try{e.close(t)}catch{}}}}Bt=new WeakMap,Jt=new WeakMap,Vt=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,Kt=new WeakMap,Zt=new WeakMap,Ft=new WeakSet,Gt=function(t){if(1===St(this,Vt,"f")?.readyState)try{St(this,Vt,"f").send(JSON.stringify(t))}catch(t){St(this,Bt,"f").logger?.warn?.("call-core: could not send signalling frame",t)}},Qt=function(t){let e;try{e=JSON.parse(t)}catch(t){return void St(this,Bt,"f").logger?.warn?.("call-core: ignoring malformed signalling frame",t)}if(void 0!==e.id){const t=St(this,Xt,"f").get(e.id);if(!t)return;return St(this,Xt,"f").delete(e.id),clearTimeout(t.timer),void(e.error?t.reject(St(this,Ft,"m",te).call(this,e.error)):t.resolve(e.result??{}))}e.method&&St(this,Jt,"f").onNotification?.(e.method,e.params??{})},te=function(t){return function(t){const e=(t.data?.reason??"").toLowerCase(),i=t.message;if("negotiation_in_progress"===e)return xt.from("negotiationInProgress",i);switch(t.code){case 4401:return/expired/.test(e)?xt.from("authExpired",i):xt.from("authRejected",i);case 4403:return xt.from("authRejected",i);case 4404:return xt.from("sessionUnknown",i);case 4409:return xt.from("sessionReplaced",i);case 4429:return xt.from("rateLimited",i);case 4503:return/full/.test(e)?xt.from("roomFull",i):xt.from("roomEnded",i);case 4400:return xt.from("invalidAction",i);case 4408:case 4500:return xt.from("networkLost",i)}return"expired"===e?xt.from("authExpired",i):"unknown_session"===e?xt.from("sessionUnknown",i):"replaced"===e?xt.from("sessionReplaced",i):"room_full"===e?xt.from("roomFull",i):"room_closing"===e||"wrong_room"===e?xt.from("roomEnded",i):"rate_limited"===e?xt.from("rateLimited",i):"bad_signature"===e||"not_permitted"===e?xt.from("authRejected",i):/expired/i.test(e)||-32001===t.code?xt.from("authExpired",i):/token|auth|forbidden/i.test(e)||401===t.code||403===t.code?xt.from("authRejected",i):/resume|not found|no such|unknown_session/i.test(e)||404===t.code||409===t.code?xt.from("sessionUnknown",i):xt.from("networkLost",i)}(t)},ee=function(t){for(const e of St(this,Xt,"f").values())clearTimeout(e.timer),e.reject(t);St(this,Xt,"f").clear()};const hi=[{rid:"l",maxBitrate:15e4,scaleResolutionDownBy:4},{rid:"m",maxBitrate:5e5,scaleResolutionDownBy:2},{rid:"h",maxBitrate:15e5,scaleResolutionDownBy:1}],di=["l","m","h"];function fi(t,e){return"screen"===t?"audio"===e?"screen-audio":"screen":"camera"===t?"camera":"microphone"===t?"mic":void 0}let ui=0;function pi(t){switch(t){case"admin":case"moderator":return{publishAudio:!0,publishVideo:!0,publishScreen:!0,moderate:!0};case"publisher":return{publishAudio:!0,publishVideo:!0,publishScreen:!0,moderate:!1};default:return{...gt}}}class mi{constructor(t={}){ie.add(this),se.set(this,void 0),ne.set(this,void 0),ae.set(this,{}),oe.set(this,"idle"),re.set(this,void 0),ce.set(this,void 0),le.set(this,void 0),he.set(this,void 0),de.set(this,void 0),fe.set(this,!1),ue.set(this,new Map),pe.set(this,""),me.set(this,""),be.set(this,"viewer"),ge.set(this,new Map),ye.set(this,new Map),ve.set(this,new Map),we.set(this,[]),ke.set(this,[]),xe.set(this,[]),Se.set(this,Promise.resolve()),Ce.set(this,new Set),Me.set(this,Promise.resolve()),Ee.set(this,void 0),Te.set(this,!1),je.set(this,!1),Ie.set(this,void 0),Re.set(this,0),Le.set(this,0),We.set(this,void 0),Ct(this,se,t),Ct(this,ne,t.logger)}get status(){return St(this,oe,"f")}get participantId(){return St(this,pe,"f")}get role(){return St(this,be,"f")}get peerConnection(){return St(this,le,"f")}async connect(t,e){Ct(this,re,t),Ct(this,ae,e),Ct(this,Te,!1),St(this,ie,"m",ii).call(this,"connecting");const i=St(this,ie,"m",He).call(this,t.iceServers);if(!i)throw xt.from("networkLost","call-core: RTCPeerConnection is not available.");Ct(this,le,i);for(const[t,e]of St(this,ue,"f"))"camera"!==t?(i.addTrack(e,new MediaStream([e])),"mic"===t&&Ct(this,he,i.getTransceivers().find((t=>t.sender.track===e)))):await St(this,ie,"m",De).call(this,e);St(this,he,"f")||Ct(this,he,i.addTransceiver("audio",{direction:"sendrecv"})),await i.setLocalDescription(await i.createOffer()),Ct(this,Me,new Promise((t=>{Ct(this,Ee,t)})));const s=new li({url:t.sfuUrl,logger:St(this,ne,"f"),WebSocketImpl:St(this,se,"f").WebSocketImpl},{onNotification:(t,e)=>St(this,ie,"m",Ve).call(this,t,e),onClose:(t,e)=>St(this,ie,"m",Ge).call(this,t,e)});Ct(this,ce,s),await s.connect();const n={token:t.token,offer:i.localDescription?.sdp??""};let a;try{a=await s.request("join",n)}catch(t){throw St(this,Ee,"f")?.call(this),i.close(),Ct(this,le,void 0),t}if(!a.answer)throw St(this,Ee,"f")?.call(this),i.close(),Ct(this,le,void 0),xt.from("protocolMismatch","call-core: the SFU did not return an SDP answer.");if(Ct(this,je,!0),St(this,ie,"m",Ae).call(this,a),a.iceServers?.length&&"function"==typeof i.setConfiguration)try{i.setConfiguration({iceServers:a.iceServers})}catch(t){St(this,ne,"f")?.warn?.("call-core: could not apply join-result ICE servers",t)}return await i.setRemoteDescription({type:"answer",sdp:a.answer}),St(this,Ee,"f")?.call(this),St(this,ie,"m",ii).call(this,"connected"),St(this,ie,"m",Pe).call(this,a)}setInitialTracks(t){Ct(this,ue,new Map(t.map((({source:t,track:e})=>[t,e]))))}async disconnect(){Ct(this,Te,!0),St(this,Ie,"f")&&clearTimeout(St(this,Ie,"f")),St(this,We,"f")&&clearTimeout(St(this,We,"f")),Ct(this,Ie,void 0),Ct(this,We,void 0),St(this,ce,"f")?.connected&&await St(this,ce,"f").request("leave",{}).catch((()=>{})),St(this,ce,"f")?.close(),Ct(this,ce,void 0),St(this,le,"f")?.close(),Ct(this,le,void 0),Ct(this,he,void 0),Ct(this,de,void 0),Ct(this,fe,!1),St(this,ue,"f").clear(),St(this,ge,"f").clear(),St(this,ye,"f").clear(),St(this,ve,"f").clear(),Ct(this,we,[]),St(this,ke,"f").splice(0).forEach((t=>clearTimeout(t.timer))),Ct(this,xe,[]),Ct(this,je,!1),St(this,ie,"m",ii).call(this,"idle")}async publish(t){const e="local-track-"+ ++ui,i={id:e,participantId:St(this,pe,"f"),source:t.source,kind:t.track.kind,muted:!1,mediaStreamTrack:t.track,availableLayers:[],currentLayer:null,pinnedLayer:null,subscribed:!0};St(this,ge,"f").set(e,i);const s=St(this,ie,"m",Ke).call(this,i.kind);if(St(this,ue,"f").delete(t.source)){"camera"===t.source&&St(this,fe,"f")&&(i.availableLayers=[...di]);try{i.id=await s,i.id!==e&&(St(this,ge,"f").delete(e),St(this,ge,"f").set(i.id,i)),await St(this,ie,"m",Ue).call(this,i.id,t.source)}catch(t){St(this,ne,"f")?.warn?.("call-core: initial track was not announced",t)}return i}if("mic"===t.source&&St(this,he,"f"))await St(this,he,"f").sender.replaceTrack(t.track);else if("camera"===t.source&&St(this,le,"f")){const{simulcast:e}=await St(this,ie,"m",De).call(this,t.track);e&&(i.availableLayers=[...di])}else if("screen"===t.source&&St(this,le,"f"))await St(this,ie,"m",Ne).call(this,t.track);else if(St(this,le,"f")){const e=St(this,le,"f").addTrack(t.track,new MediaStream([t.track]));"mic"===t.source&&Ct(this,he,St(this,le,"f").getTransceivers().find((t=>t.sender===e)))}try{await St(this,ie,"m",Fe).call(this),i.id=await s,i.id!==e&&(St(this,ge,"f").delete(e),St(this,ge,"f").set(i.id,i)),await St(this,ie,"m",Ue).call(this,i.id,t.source)}catch(t){St(this,ne,"f")?.warn?.("call-core: publish renegotiation failed",t)}return i}async unpublish(t){const e=St(this,ge,"f").get(t);if(e){if(St(this,le,"f")){const i=St(this,le,"f").getSenders().find((t=>t.track===e.mediaStreamTrack));i&&(i===St(this,he,"f")?.sender||i===St(this,de,"f")?.sender?await i.replaceTrack(null):St(this,le,"f").removeTrack(i));try{await St(this,ie,"m",Fe).call(this)}catch(t){St(this,ne,"f")?.warn?.("call-core: unpublish renegotiation failed",t)}}e.mediaStreamTrack=void 0,St(this,ge,"f").delete(t),St(this,ae,"f").onTrackUnpublished?.(t)}}async subscribe(t,e){const i=St(this,ye,"f").get(t.id)??t;if(i.subscribed=!0,e&&(i.pinnedLayer=e),St(this,ce,"f")?.connected)try{await St(this,ce,"f").request("subscribe",{trackId:t.id,...e?{layer:e}:{}})}catch(t){St(this,ne,"f")?.warn?.("call-core: subscribe failed",t)}i.mediaStreamTrack&&St(this,ae,"f").onTrackSubscribed?.({...i})}async unsubscribe(t){const e=St(this,ye,"f").get(t);if(e&&(e.subscribed=!1),St(this,ce,"f")?.connected)try{await St(this,ce,"f").request("unsubscribe",{trackId:t})}catch(t){St(this,ne,"f")?.warn?.("call-core: unsubscribe failed",t)}}async setLayer(t,e){const i=St(this,ye,"f").get(t);if(i&&(i.pinnedLayer=e),St(this,ce,"f")?.connected)try{await St(this,ce,"f").request("subscribe",{trackId:t,layer:e})}catch(t){St(this,ne,"f")?.warn?.("call-core: layer selection failed",t)}}async setMuted(t,e){const i=St(this,ge,"f").get(t);if(i&&(i.muted=e),St(this,ce,"f")?.connected)try{await St(this,ce,"f").request(e?"mute":"unmute",{trackId:t})}catch(t){St(this,ne,"f")?.warn?.("call-core: mute command failed",t)}}async setHandRaised(t){St(this,ce,"f")?.connected&&await St(this,ce,"f").request("raiseHand",{raised:t})}async setVisibleParticipants(t){}async promote(t,e){St(this,ne,"f")?.debug?.("call-core: promotion is decided by the token issuer; refresh the token instead")}async demote(t){St(this,ne,"f")?.debug?.("call-core: demotion is decided by the token issuer; refresh the token instead")}async muteRemote(t,e){St(this,ce,"f")?.connected&&await St(this,ce,"f").request("muteParticipant",{participantId:t})}async remove(t){St(this,ce,"f")?.connected&&await St(this,ce,"f").request("removeParticipant",{participantId:t})}async startTranscription(){await St(this,ie,"m",ei).call(this,"startTranscription")}async stopTranscription(){await St(this,ie,"m",ei).call(this,"stopTranscription")}async startRecording(){await St(this,ie,"m",ei).call(this,"startRecording")}async stopRecording(){await St(this,ie,"m",ei).call(this,"stopRecording")}async requestICERestart(){if(St(this,le,"f"))try{St(this,le,"f").restartIce?.(),await St(this,ie,"m",Fe).call(this)}catch(t){St(this,ne,"f")?.warn?.("call-core: ICE restart failed",t),St(this,ae,"f").onError?.(xt.from("iceFailed"),!1)}}async updateToken(t){if(!St(this,re,"f"))return;const e=St(this,re,"f");if(Ct(this,re,{...St(this,re,"f"),token:t}),St(this,ce,"f")?.connected)try{return void await St(this,ce,"f").request("refreshToken",{token:t})}catch(t){St(this,ne,"f")?.warn?.("call-core: refreshToken failed; resuming with the new token",t)}St(this,ce,"f")?.close(),Ct(this,ce,void 0);try{await St(this,ie,"m",ti).call(this)}catch(t){Ct(this,re,e),St(this,ae,"f").onError?.(t instanceof xt?t:xt.from("authRejected"),!0),St(this,ie,"m",ii).call(this,"failed")}}}var bi,gi,yi,vi,wi,ki,xi,Si,Ci,Mi,Ei,Ti,ji,Ii,Ri,Li,Wi,Ai,Pi,Oi,_i,Di,Ui,zi,Ni,$i,Hi,qi,Fi,Bi,Ji,Vi,Yi,Xi,Ki,Zi,Gi,Qi,ts,es,is,ss,ns,as,os,rs,cs,ls,hs,ds;se=new WeakMap,ne=new WeakMap,ae=new WeakMap,oe=new WeakMap,re=new WeakMap,ce=new WeakMap,le=new WeakMap,he=new WeakMap,de=new WeakMap,fe=new WeakMap,ue=new WeakMap,pe=new WeakMap,me=new WeakMap,be=new WeakMap,ge=new WeakMap,ye=new WeakMap,ve=new WeakMap,we=new WeakMap,ke=new WeakMap,xe=new WeakMap,Se=new WeakMap,Ce=new WeakMap,Me=new WeakMap,Ee=new WeakMap,Te=new WeakMap,je=new WeakMap,Ie=new WeakMap,Re=new WeakMap,Le=new WeakMap,We=new WeakMap,ie=new WeakSet,Ae=function(t){Ct(this,pe,t.participantId),Ct(this,me,t.resumeSecret),Ct(this,be,t.role),St(this,ve,"f").clear(),St(this,ye,"f").clear(),Ct(this,we,[]);for(const e of t.participants){const t=St(this,ie,"m",Oe).call(this,e);t.isLocal=e.participantId===St(this,pe,"f"),St(this,ve,"f").set(t.id,t)}if(!St(this,ve,"f").has(St(this,pe,"f"))){const e=St(this,ie,"m",Oe).call(this,{participantId:St(this,pe,"f"),displayName:"",role:t.role});e.isLocal=!0,St(this,ve,"f").set(e.id,e)}for(const e of t.tracks)St(this,ie,"m",_e).call(this,e);t.roomState?.transcription&&St(this,ae,"f").onTranscriptionState?.(!0),St(this,ae,"f").onRecordingState?.(!!t.roomState?.recording)},Pe=function(t){const e=Array.from(St(this,ve,"f").values()).map((t=>({...t,tracks:t.tracks.map((t=>({...t})))}))),i=e.find((t=>t.id===St(this,pe,"f")));return{participantId:St(this,pe,"f"),capabilities:i?.capabilities??pi(St(this,be,"f")),participants:e,tracks:e.flatMap((t=>t.tracks)),iceServers:t.iceServers}},Oe=function(t){return{id:t.participantId,userId:t.userId??t.participantId,kind:"agent"===t.kind?"agent":"human",isLocal:t.participantId===St(this,pe,"f"),capabilities:pi(t.role),tracks:[],audioLevel:0,speaking:!1,handRaised:!1,connection:"connected",displayName:t.displayName}},_e=function(t){const e=St(this,ye,"f").get(t.trackId);if(e){e.muted=t.muted,t.layers&&(e.availableLayers=[...t.layers]);const i=fi(t.source,t.kind);return i&&(e.source=i),e}const i=t.kind,s=fi(t.source,i)??("audio"===i?"mic":"camera"),n={id:t.trackId,participantId:t.ownerId,source:s,kind:i,muted:t.muted,availableLayers:t.layers?[...t.layers]:[],currentLayer:null,pinnedLayer:null,subscribed:!0};St(this,ye,"f").set(n.id,n);let a=St(this,ve,"f").get(t.ownerId);return a||t.ownerId===St(this,pe,"f")||(a={id:t.ownerId,kind:"human",isLocal:!1,capabilities:{...gt},tracks:[],audioLevel:0,speaking:!1,handRaised:!1,connection:"connected"},St(this,ve,"f").set(a.id,a),St(this,ae,"f").onParticipantJoined?.({...a,tracks:[]})),a&&!a.isLocal&&(a.tracks=[...a.tracks,n],St(this,we,"f").push(n),St(this,ae,"f").onTrackPublished?.({...n})),n},De=async function(t){const e=St(this,le,"f");if(!e)return{simulcast:!1};if(St(this,de,"f"))return await St(this,de,"f").sender.replaceTrack(t),{simulcast:St(this,fe,"f")};try{const i=e.addTransceiver(t,{direction:"sendonly",sendEncodings:hi});return Ct(this,de,i),Ct(this,fe,!0),St(this,ie,"m",$e).call(this,i),{simulcast:!0}}catch(i){St(this,ne,"f")?.warn?.("call-core: simulcast encodings rejected; publishing one camera layer",i);const s=e.addTrack(t,new MediaStream([t]));return Ct(this,de,e.getTransceivers().find((t=>t.sender===s))),Ct(this,fe,!1),{simulcast:!1}}},Ue=async function(t,e){if("screen"===e&&St(this,ce,"f")?.connected)try{await St(this,ce,"f").request("setTrackSource",{trackId:t,source:"screen"})}catch(t){St(this,ne,"f")?.warn?.("call-core: setTrackSource failed; the SFU will treat the track as camera",t)}},ze=function(t,e){const i=St(this,ye,"f").get(t)??St(this,ge,"f").get(t);if(!i)return;const s=fi(e,i.kind);if(!s||s===i.source)return;i.source=s;const n=i.participantId?St(this,ve,"f").get(i.participantId):void 0;n&&(n.tracks=n.tracks.map((e=>e.id===t?i:e))),St(this,ae,"f").onTrackSourceChanged?.(t,s)},Ne=async function(t){const e=St(this,le,"f");if(!e)return{temporal:!1};try{t.contentHint="detail"}catch(t){St(this,ne,"f")?.debug?.("call-core: could not set screen contentHint",t)}try{const i=e.addTransceiver(t,{direction:"sendonly",streams:[new MediaStream([t])],sendEncodings:[{scalabilityMode:"L1T3",maxBitrate:15e5}]});return St(this,ie,"m",$e).call(this,i),{temporal:!0}}catch(i){St(this,ne,"f")?.warn?.("call-core: temporal screen encoding rejected; publishing a plain screen sender",i);try{e.addTrack(t,new MediaStream([t]))}catch(t){St(this,ne,"f")?.warn?.("call-core: could not publish the screen track",t)}return{temporal:!1}}},$e=function(t){try{const e="undefined"!=typeof RTCRtpSender?RTCRtpSender.getCapabilities?.("video"):void 0,i=e?.codecs.filter((t=>"video/vp8"===t.mimeType.toLowerCase()))??[];i.length>0&&t.setCodecPreferences?.(i)}catch(t){St(this,ne,"f")?.debug?.("call-core: could not set VP8 codec preference",t)}},He=function(t=[]){const e=St(this,se,"f").createPeerConnection??("undefined"!=typeof RTCPeerConnection?t=>new RTCPeerConnection(t):void 0);if(!e)return;const i=e({iceServers:t});return i.onicecandidate=t=>{St(this,je,"f")&&St(this,ce,"f")?.notify("candidate",{candidate:t.candidate?.candidate??null,sdpMid:t.candidate?.sdpMid??null,sdpMLineIndex:t.candidate?.sdpMLineIndex??null})},i.ontrack=t=>St(this,ie,"m",qe).call(this,t),i.onconnectionstatechange=()=>{const t=i.connectionState;"failed"===t?(St(this,ae,"f").onError?.(xt.from("iceFailed"),!1),St(this,ie,"m",ii).call(this,"reconnecting"),this.requestICERestart()):"disconnected"===t?(St(this,ie,"m",ii).call(this,"reconnecting"),St(this,We,"f")||Ct(this,We,setTimeout((()=>{Ct(this,We,void 0),"connected"!==St(this,le,"f")?.connectionState&&this.requestICERestart()}),5e3))):"connected"===t&&(St(this,We,"f")&&clearTimeout(St(this,We,"f")),Ct(this,We,void 0),"reconnecting"===St(this,oe,"f")&&St(this,ce,"f")?.connected&&St(this,ie,"m",ii).call(this,"connected"))},i},qe=function(t){const e=St(this,we,"f").findIndex((e=>e.kind===t.track.kind&&!e.mediaStreamTrack));if(e<0)return void St(this,ne,"f")?.debug?.("call-core: ignoring unannounced remote track",t.track.kind);const[i]=St(this,we,"f").splice(e,1);i.mediaStreamTrack=t.track,i.subscribed=!0,t.track.onended=()=>{St(this,ae,"f").onTrackUnpublished?.(i.id),St(this,ye,"f").delete(i.id);const t=St(this,ve,"f").get(i.participantId);t&&(t.tracks=t.tracks.filter((t=>t.id!==i.id)))},St(this,ae,"f").onTrackSubscribed?.({...i})},Fe=async function t(e=4){const i=St(this,le,"f");if(!i||!St(this,ce,"f"))return;let s=!1;Ct(this,Se,St(this,Se,"f").then((async()=>{if("closed"===i.signalingState||!St(this,ce,"f"))return;if("stable"!==i.signalingState)return;const t=await i.createOffer();let e;await i.setLocalDescription(t);try{e=await St(this,ce,"f").request("offer",{sdp:t.sdp??""})}catch(t){if(t instanceof xt&&"negotiation_in_progress"===t.code)return s=!0,void await i.setLocalDescription({type:"rollback"}).catch((()=>{}));throw t}e?.sdp&&await i.setRemoteDescription({type:"answer",sdp:e.sdp})})).catch((t=>{St(this,ne,"f")?.warn?.("call-core: renegotiation failed",t)}))),await St(this,Se,"f"),s&&e>0&&(await St(this,ie,"m",Be).call(this,1500),await St(this,ie,"m",t).call(this,e-1))},Be=function(t){return new Promise((e=>{const i=()=>{clearTimeout(s),St(this,Ce,"f").delete(i),e()},s=setTimeout(i,t);St(this,Ce,"f").add(i)}))},Je=async function(t){await St(this,Me,"f");const e=St(this,le,"f");if(!e)return;const i=String(t.negotiationId??""),s=String(t.sdp??"");Ct(this,Se,St(this,Se,"f").then((async()=>{if("stable"!==e.signalingState)try{await e.setLocalDescription({type:"rollback"})}catch{}await e.setRemoteDescription({type:"offer",sdp:s}),await e.setLocalDescription(await e.createAnswer()),await St(this,ce,"f").request("answer",{negotiationId:i,sdp:e.localDescription?.sdp??""})})).catch((t=>{St(this,ne,"f")?.warn?.("call-core: could not answer server offer",t)}))),await St(this,Se,"f");for(const t of Array.from(St(this,Ce,"f")))t()},Ve=function(t,e){switch(t){case"offer":St(this,ie,"m",Je).call(this,e);break;case"candidate":St(this,le,"f")&&null!=e.candidate&&St(this,le,"f").addIceCandidate({candidate:String(e.candidate),sdpMid:e.sdpMid??null,sdpMLineIndex:e.sdpMLineIndex??null}).catch((t=>St(this,ne,"f")?.warn?.("call-core: could not add server candidate",t)));break;case"trackPublished":St(this,ie,"m",Ye).call(this,e.track);break;case"trackUnpublished":St(this,ie,"m",Xe).call(this,String(e.trackId??""));break;case"trackMuted":{const t=String(e.trackId??""),i=!!e.muted,s=St(this,ye,"f").get(t)??St(this,ge,"f").get(t);s&&(s.muted=i),St(this,ae,"f").onTrackMuted?.(t,i);break}case"layerChanged":{const t=e,i=St(this,ye,"f").get(t.trackId);if(!i)break;i.currentLayer=t.layer,i.layerReason=t.reason,St(this,ae,"f").onLayerChanged?.(t.trackId,t.layer,t.reason);break}case"trackSourceChanged":{const t=e;St(this,ie,"m",ze).call(this,t.trackId,t.source);break}case"handRaised":{const t=String(e.participantId??""),i=!!e.raised,s=St(this,ve,"f").get(t);if(!s)break;s.handRaised=i,St(this,ae,"f").onParticipantUpdated?.({...s,tracks:s.tracks.map((t=>({...t})))});break}case"participantUpdated":{const t=e.participant,i=t?.participantId??String(e.participantId??""),s=St(this,ve,"f").get(i);if(!s)break;t?(s.userId=t.userId??s.userId,s.kind="agent"===t.kind?"agent":"human",s.displayName=t.displayName||s.displayName,s.capabilities=pi(t.role),i===St(this,pe,"f")&&Ct(this,be,t.role)):"string"==typeof e.role&&(s.capabilities=pi(e.role),i===St(this,pe,"f")&&Ct(this,be,e.role)),St(this,ae,"f").onParticipantUpdated?.({...s,tracks:s.tracks.map((t=>({...t})))});break}case"participantJoined":{const t=e.participant,i=St(this,ie,"m",Oe).call(this,t),s=St(this,ve,"f").get(i.id);s?(i.tracks=s.tracks,St(this,ve,"f").set(i.id,i),St(this,ae,"f").onParticipantUpdated?.({...i})):(St(this,ve,"f").set(i.id,i),St(this,ae,"f").onParticipantJoined?.({...i,tracks:[]}));break}case"participantLeft":{const t=String(e.participantId??"");for(const e of St(this,ye,"f").values())e.participantId===t&&St(this,ye,"f").delete(e.id);St(this,ve,"f").delete(t),St(this,ae,"f").onParticipantLeft?.(t);break}case"activeSpeaker":{const t=e.participantId?String(e.participantId):null,i={};for(const e of St(this,ve,"f").keys())i[e]=e===t?1:0;St(this,ae,"f").onAudioLevels?.(i);break}case"roomState":St(this,ae,"f").onTranscriptionState?.(!!e.transcription),St(this,ae,"f").onRecordingState?.(!!e.recording);break;case"transcript":{const t=e;St(this,ae,"f").onTranscript?.({id:t.segmentId,participantId:t.participantId,text:t.text,final:t.final,startMs:Date.parse(t.start)||0,endMs:Date.parse(t.end)||0,language:t.language||"en"});break}case"tokenExpiring":St(this,ae,"f").onError?.(xt.from("authExpired"),!1);break;case"roomClosing":St(this,ae,"f").onError?.(xt.from("roomEnded","The room is closing."),!0),St(this,ie,"m",ii).call(this,"failed");break;case"error":{const t=String(e.reason??e.message??"Signalling error");St(this,ae,"f").onError?.(xt.from("networkLost",t),!1);break}default:St(this,ne,"f")?.debug?.("call-core: ignoring unknown signalling notification",t)}},Ye=function(t){t&&(t.ownerId!==St(this,pe,"f")?St(this,ie,"m",_e).call(this,t):St(this,ie,"m",Ze).call(this,t.trackId,t.kind))},Xe=function(t){St(this,ye,"f").delete(t);for(const e of St(this,ve,"f").values())e.tracks.some((e=>e.id===t))&&(e.tracks=e.tracks.filter((e=>e.id!==t)));Ct(this,we,St(this,we,"f").filter((e=>e.id!==t))),St(this,ae,"f").onTrackUnpublished?.(t)},Ke=function(t){const e=St(this,xe,"f").findIndex((e=>e.kind===t));if(e>=0){const[t]=St(this,xe,"f").splice(e,1);return Promise.resolve(t.trackId)}return new Promise((e=>{const i=setTimeout((()=>{Ct(this,ke,St(this,ke,"f").filter((t=>t.timer!==i))),St(this,ne,"f")?.warn?.("call-core: SFU did not announce a local track in time"),e(`pending-${t}-${Date.now()}`)}),6e3);St(this,ke,"f").push({kind:t,resolve:e,timer:i})}))},Ze=function(t,e){const i=St(this,ke,"f").findIndex((t=>t.kind===e));if(i<0)return void St(this,xe,"f").push({kind:e,trackId:t});const[s]=St(this,ke,"f").splice(i,1);clearTimeout(s.timer),s.resolve(t)},Ge=function(t,e){if(St(this,Te,"f"))return;St(this,ne,"f")?.warn?.("call-core: signalling socket closed",t,e);const i=(()=>{const i=e.toLowerCase();switch(t){case 1e3:return xt.from("roomEnded",e||void 0);case 4401:return/expired/.test(i)?xt.from("authExpired",e||void 0):xt.from("authRejected",e||void 0);case 4403:return xt.from("authRejected",e||void 0);case 4404:return xt.from("sessionUnknown",e||void 0);case 4409:return xt.from("sessionReplaced",e||void 0);case 4429:return xt.from("rateLimited",e||void 0);case 4503:return/full/.test(i)?xt.from("roomFull",e||void 0):xt.from("roomEnded",e||void 0);default:return null}})();if(i){const t=!i.recoverable;if(St(this,ae,"f").onError?.(i,t),t)return void St(this,ie,"m",ii).call(this,"failed");if("session_unknown"===i.code||"auth_expired"===i.code)return void St(this,ie,"m",ii).call(this,"reconnecting")}St(this,ie,"m",ii).call(this,"reconnecting"),Ct(this,Le,0),Ct(this,Re,Date.now()),St(this,ie,"m",Qe).call(this)},Qe=function t(){if(St(this,Te,"f"))return;if(Date.now()-St(this,Re,"f")>=St(this,ie,"m",si).call(this))return St(this,ie,"m",ii).call(this,"failed"),void St(this,ae,"f").onError?.(xt.from("networkFailed"),!1);const e=Math.min(8e3,500*2**St(this,Le,"f"))*(.5+.5*Math.random());Ct(this,Le,St(this,Le,"f")+1),Ct(this,Ie,setTimeout((()=>{Ct(this,Ie,void 0),St(this,ie,"m",ti).call(this).catch((e=>(St(this,ne,"f")?.warn?.("call-core: resume failed",e),e instanceof xt&&("authRejected"===e.code||"roomEnded"===e.code||"sessionReplaced"===e.code)?(St(this,ie,"m",ii).call(this,"failed"),void St(this,ae,"f").onError?.(e,!0)):e instanceof xt&&"session_unknown"===e.code?(St(this,ie,"m",ii).call(this,"reconnecting"),void St(this,ae,"f").onError?.(e,!1)):void St(this,ie,"m",t).call(this))))}),e))},ti=async function(){if(St(this,Te,"f")||!St(this,re,"f")||!St(this,pe,"f")||!St(this,me,"f"))throw xt.from("networkLost");St(this,ce,"f")?.close();const t=new li({url:St(this,re,"f").sfuUrl,logger:St(this,ne,"f"),WebSocketImpl:St(this,se,"f").WebSocketImpl},{onNotification:(t,e)=>St(this,ie,"m",Ve).call(this,t,e),onClose:(t,e)=>St(this,ie,"m",Ge).call(this,t,e)});Ct(this,ce,t),await t.connect();const e=await t.request("join",{token:St(this,re,"f").token,resume:{participantId:St(this,pe,"f"),resumeSecret:St(this,me,"f")}});for(const t of e.participants){const e=St(this,ie,"m",Oe).call(this,t);St(this,ve,"f").set(e.id,e),St(this,ae,"f").onParticipantUpdated?.({...e,tracks:[]})}for(const t of e.tracks)St(this,ie,"m",_e).call(this,t);St(this,ie,"m",ii).call(this,"connected")},ei=async function(t){if(!St(this,ce,"f")?.connected)throw xt.from("invalidAction","Not connected to the call server.");await St(this,ce,"f").request(t,{})},ii=function(t){St(this,oe,"f")!==t&&(Ct(this,oe,t),St(this,ae,"f").onStatus?.(t))},si=function(){return St(this,se,"f").reconnectTimeoutMs??3e4};const fs={status:"idle",mode:null,roomId:null,sfuUrl:null,localParticipantId:null,participants:[],activeSpeakerId:null,pinnedId:null,visibleParticipantIds:[],transcriptionRunning:!1,recordingRunning:!1,transcript:[],audioBlocked:!1,handRaised:!1,sharingId:null,notice:null,error:null,migratingTo:null};class us{constructor(t={}){bi.add(this),gi.set(this,void 0),yi.set(this,void 0),vi.set(this,void 0),wi.set(this,void 0),ki.set(this,void 0),xi.set(this,void 0),Si.set(this,void 0),Ci.set(this,void 0),Mi.set(this,void 0),Ei.set(this,void 0),Ti.set(this,new Map),ji.set(this,new Map),Ii.set(this,new Map),Ri.set(this,!1),this.store=new ni({...fs}),this.strings=vt(t.strings),this.config={...wt,...t.config??{}},Ct(this,gi,t.identity),Ct(this,vi,t.logger),Ct(this,xi,t.getToken),Ct(this,Si,t.promote),Ct(this,Ci,t.demote),Ct(this,yi,t.transport??new mi({logger:t.logger})),Ct(this,wi,new oi({logger:t.logger})),Ct(this,ki,new ai(this.config)),Ct(this,Mi,t.transcript??new ri)}get transport(){return St(this,yi,"f")}get devices(){return St(this,wi,"f")}async prepare(){if("idle"!==this.store.getState().status)throw xt.from("invalidAction","The room is already prepared.");St(this,bi,"m",ls).call(this,"lobby"),await St(this,wi,"f").start()}async startPreview(t={}){if("lobby"!==this.store.getState().status)throw xt.from("invalidAction","Preview is only available in the lobby.");await St(this,bi,"m",Oi).call(this,"mic",!!t.audio),await St(this,bi,"m",Oi).call(this,"camera",!!t.video)}async join(t){const e=this.store.getState().status;if("idle"!==e&&"lobby"!==e&&"failed"!==e)throw xt.from("invalidAction","The room is already joined.");Ct(this,Ei,t),St(this,bi,"m",ls).call(this,"connecting"),St(this,bi,"m",hs).call(this,{mode:t.mode,roomId:t.roomId,sfuUrl:t.sfuUrl,error:null,notice:null}),await St(this,bi,"m",Li).call(this,t)}async leave(){const t=this.store.getState().status;if("idle"!==t&&"ended"!==t){St(this,bi,"m",ls).call(this,"ended");for(const t of St(this,Ti,"f").values())t.track.stop();St(this,Ti,"f").clear(),await(St(this,Mi,"f").disconnect?.()),St(this,wi,"f").stop();try{await St(this,yi,"f").disconnect()}catch(t){St(this,vi,"f")?.warn?.("call-core: transport disconnect failed",t)}St(this,ki,"f").reset(),St(this,ji,"f").clear(),St(this,bi,"m",hs).call(this,{participants:[],activeSpeakerId:null,sharingId:null,visibleParticipantIds:[],handRaised:!1,transcriptionRunning:!1,recordingRunning:!1,transcript:[],localParticipantId:null})}}async rejoin(){if(!St(this,Ei,"f"))throw xt.from("invalidAction","There is no call to rejoin.");await this.join(St(this,Ei,"f"))}async refreshToken(){if(!St(this,xi,"f")||!St(this,Ei,"f"))throw xt.from("invalidAction","No token source for this call.");const t=await St(this,xi,"f").call(this,St(this,Ei,"f"));Ct(this,Ei,{...St(this,Ei,"f"),token:t.token,sfuUrl:t.sfuUrl??St(this,Ei,"f").sfuUrl,iceServers:t.iceServers??St(this,Ei,"f").iceServers});try{St(this,yi,"f").updateToken&&await St(this,yi,"f").updateToken(t.token)}catch(t){const e=xt.from("authRejected",void 0,t);throw St(this,bi,"m",hs).call(this,{error:e.toInfo()}),St(this,bi,"m",ls).call(this,"failed"),St(this,bi,"m",ds).call(this,"error",e.toInfo()),e}}async setMicEnabled(t){St(this,bi,"m",cs).call(this,"publishAudio");const e=St(this,Ti,"f").get("mic");if(t){if(!e){const t=St(this,bi,"m",ts).call(this,"mic");if(t)return await St(this,yi,"f").setMuted(t.id,!1),void St(this,bi,"m",as).call(this,t.id,{muted:!1});const e=await St(this,bi,"m",_i).call(this,"mic");if(!e)return;return void await St(this,bi,"m",Ai).call(this,"mic",e)}return e.track.enabled=!0,e.trackId&&await St(this,yi,"f").setMuted(e.trackId,!1),void St(this,bi,"m",rs).call(this,"mic",{muted:!1})}if(e)e.track.enabled=!1,e.trackId&&await St(this,yi,"f").setMuted(e.trackId,!0),St(this,bi,"m",rs).call(this,"mic",{muted:!0});else{const t=St(this,bi,"m",ts).call(this,"mic");t&&(await St(this,yi,"f").setMuted(t.id,!0),St(this,bi,"m",as).call(this,t.id,{muted:!0}))}}async setCameraEnabled(t){St(this,bi,"m",cs).call(this,"publishVideo");const e=St(this,Ti,"f").get("camera");if(t){if(e)return;const t=St(this,bi,"m",ts).call(this,"camera");if(t?.mediaStreamTrack)return;const i=await St(this,bi,"m",_i).call(this,"camera");i&&await St(this,bi,"m",Ai).call(this,"camera",i)}else if(e)await St(this,bi,"m",Pi).call(this,"camera"),e.track.stop();else{const t=St(this,bi,"m",ts).call(this,"camera");t&&(await St(this,yi,"f").unpublish(t.id),St(this,bi,"m",os).call(this,t.id))}}async startScreenShare(){if(St(this,bi,"m",cs).call(this,"publishScreen"),this.store.getState().sharingId)throw xt.from("shareAlreadyActive");if(!ci.isSupported())throw xt.from("shareUnsupported");let t;try{t=await ci.acquire({audio:!0})}catch(t){throw xt.from("permissionDenied",void 0,t)}const e=t.getVideoTracks()[0];if(!e)throw xt.from("shareUnsupported");await St(this,bi,"m",Ai).call(this,"screen",e,"video");const i=t.getAudioTracks()[0];i&&await St(this,bi,"m",Ai).call(this,"screen-audio",i,"audio"),ci.onEnded(t,(()=>{this.stopScreenShare()}));const s=this.store.getState().localParticipantId;St(this,bi,"m",hs).call(this,{sharingId:s})}async stopScreenShare(){const t=St(this,Ti,"f").get("screen"),e=St(this,Ti,"f").get("screen-audio");(t||e)&&(t&&(await St(this,bi,"m",Pi).call(this,"screen"),t.track.stop()),e&&(await St(this,bi,"m",Pi).call(this,"screen-audio"),e.track.stop()),St(this,bi,"m",hs).call(this,{sharingId:null}))}async selectDevice(t,e){St(this,wi,"f").select(t,e);const i="audioinput"===t?"mic":"videoinput"===t?"camera":null;if(!i)return;const s=St(this,Ti,"f").get(i);if(s)try{const t=await St(this,wi,"f").replace(i,s.track);if(!t)return;s.trackId&&await St(this,yi,"f").unpublish(s.trackId),s.trackId=void 0,s.track=t,await St(this,bi,"m",Ai).call(this,i,t,"mic"===i?"audio":"video")}catch(t){St(this,bi,"m",hs).call(this,{notice:this.strings.deviceFallback}),St(this,vi,"f")?.warn?.("call-core: device switch failed",t)}}async setHandRaised(t){await St(this,yi,"f").setHandRaised(t),St(this,bi,"m",hs).call(this,{handRaised:t}),St(this,bi,"m",ss).call(this,this.store.getState().localParticipantId,{handRaised:t})}pin(t){St(this,bi,"m",hs).call(this,{pinnedId:t})}async setLayer(t,e){const i=St(this,bi,"m",is).call(this,t);i&&i.pinnedLayer!==e&&(St(this,bi,"m",as).call(this,t,{pinnedLayer:e}),i.subscribed&&await St(this,yi,"f").setLayer(t,e))}async setVisibleParticipants(t){if(St(this,bi,"m",hs).call(this,{visibleParticipantIds:[...t]}),await St(this,yi,"f").setVisibleParticipants(t),"connected"!==this.store.getState().status)return;const e=new Set(t);for(const t of this.store.getState().participants)if(!t.isLocal)for(const i of t.tracks)"video"===i.kind&&(e.has(t.id)?i.subscribed||await St(this,bi,"m",Qi).call(this,i):i.subscribed&&(await St(this,yi,"f").unsubscribe(i.id),St(this,bi,"m",as).call(this,i.id,{subscribed:!1,mediaStreamTrack:void 0})))}async promote(t,e){St(this,bi,"m",cs).call(this,"moderate"),St(this,Si,"f")?await St(this,Si,"f").call(this,t,e,St(this,bi,"m",es).call(this,t)):await St(this,yi,"f").promote(t,e),St(this,bi,"m",ss).call(this,t,{capabilities:e})}async demote(t){St(this,bi,"m",cs).call(this,"moderate"),St(this,Ci,"f")?await St(this,Ci,"f").call(this,t,St(this,bi,"m",es).call(this,t)):await St(this,yi,"f").demote(t),St(this,bi,"m",ss).call(this,t,{capabilities:{...gt}})}async muteRemote(t,e="mic"){St(this,bi,"m",cs).call(this,"moderate"),await St(this,yi,"f").muteRemote(t,e);const i=St(this,bi,"m",es).call(this,t),s=i?.tracks.find((t=>t.source===e));s&&St(this,bi,"m",as).call(this,s.id,{muted:!0})}async remove(t){St(this,bi,"m",cs).call(this,"moderate"),await St(this,yi,"f").remove(t),St(this,bi,"m",Ni).call(this,t)}async startTranscription(){St(this,bi,"m",cs).call(this,"moderate"),await St(this,yi,"f").startTranscription(),St(this,bi,"m",hs).call(this,{transcriptionRunning:!0})}async stopTranscription(){St(this,bi,"m",cs).call(this,"moderate"),await St(this,yi,"f").stopTranscription(),St(this,bi,"m",hs).call(this,{transcriptionRunning:!1})}async startRecording(){St(this,bi,"m",cs).call(this,"moderate"),await St(this,yi,"f").startRecording(),St(this,bi,"m",hs).call(this,{recordingRunning:!0})}async stopRecording(){St(this,bi,"m",cs).call(this,"moderate"),await St(this,yi,"f").stopRecording(),St(this,bi,"m",hs).call(this,{recordingRunning:!1})}setRecordingRunning(t){St(this,bi,"m",hs).call(this,{recordingRunning:t})}notifyAudioBlocked(){this.store.getState().audioBlocked||(St(this,bi,"m",hs).call(this,{audioBlocked:!0}),St(this,bi,"m",ds).call(this,"audioBlocked",!0))}resumeAudio(){St(this,bi,"m",hs).call(this,{audioBlocked:!1}),St(this,bi,"m",ds).call(this,"resumeAudio")}getState(){return this.store.getState()}localParticipant(){return St(this,bi,"m",es).call(this,this.store.getState().localParticipantId)}audioLevel(t){return St(this,ji,"f").get(t)??0}remoteAudioTracks(){const t=[];for(const e of this.store.getState().participants)if(!e.isLocal)for(const i of e.tracks)"audio"===i.kind&&i.mediaStreamTrack&&!i.muted&&t.push(i.mediaStreamTrack);return t}localPreviewStream(){if("undefined"==typeof MediaStream)return null;const t=Array.from(St(this,Ti,"f").values()).map((t=>t.track)).filter((t=>"ended"!==t.readyState));return t.length?new MediaStream(t):null}on(t,e){let i=St(this,Ii,"f").get(t);return i||(i=new Set,St(this,Ii,"f").set(t,i)),i.add(e),()=>i?.delete(e)}setIdentityResolver(t){Ct(this,gi,t)}setTranscriptSource(t){Ct(this,Mi,t)}connectTranscript(t){St(this,Mi,"f").connect(t,(t=>St(this,bi,"m",Yi).call(this,t)))}get transcriptSegments(){return this.store.getState().transcript}}gi=new WeakMap,yi=new WeakMap,vi=new WeakMap,wi=new WeakMap,ki=new WeakMap,xi=new WeakMap,Si=new WeakMap,Ci=new WeakMap,Mi=new WeakMap,Ei=new WeakMap,Ti=new WeakMap,ji=new WeakMap,Ii=new WeakMap,Ri=new WeakMap,bi=new WeakSet,Li=async function t(e){const i={onParticipantJoined:t=>St(this,bi,"m",Di).call(this,t),onParticipantLeft:t=>St(this,bi,"m",Ni).call(this,t),onParticipantUpdated:t=>St(this,bi,"m",Ui).call(this,t),onTrackPublished:t=>St(this,bi,"m",$i).call(this,t),onTrackUnpublished:t=>St(this,bi,"m",Hi).call(this,t),onTrackMuted:(t,e)=>St(this,bi,"m",as).call(this,t,{muted:e}),onLayerChanged:(t,e,i)=>St(this,bi,"m",Fi).call(this,t,e,i),onTrackSourceChanged:(t,e)=>St(this,bi,"m",Bi).call(this,t,e),onTrackSubscribed:t=>St(this,bi,"m",qi).call(this,t),onAudioLevels:t=>St(this,bi,"m",Ji).call(this,t),onTranscriptionState:t=>St(this,bi,"m",hs).call(this,{transcriptionRunning:t}),onAgentState:(t,e)=>St(this,bi,"m",Vi).call(this,t,e),onTranscript:t=>St(this,bi,"m",Yi).call(this,t),onMigrate:t=>{St(this,bi,"m",Xi).call(this,t)},onStatus:t=>St(this,bi,"m",Zi).call(this,t),onError:(t,e)=>{St(this,bi,"m",Ki).call(this,t,e)},onAudioBlocked:()=>this.notifyAudioBlocked()};try{const t=Array.from(St(this,Ti,"f").entries()).filter((([,t])=>!t.trackId)).map((([t,e])=>({source:t,track:e.track})));St(this,yi,"f").setInitialTracks?.(t);const s=await St(this,yi,"f").connect(e,i),n=s.participants.map((t=>({...t}))),a=n.find((t=>t.id===s.participantId));a?(a.isLocal=!0,a.capabilities=s.capabilities):n.push({id:s.participantId,kind:"human",isLocal:!0,capabilities:s.capabilities,tracks:[],audioLevel:0,speaking:!1,handRaised:!1,connection:"connected"});for(const t of s.tracks)for(const e of n)e.id!==t.participantId||e.tracks.some((e=>e.id===t.id))||(e.tracks=[...e.tracks,t]);St(this,bi,"m",hs).call(this,{mode:e.mode,roomId:e.roomId,sfuUrl:e.sfuUrl,localParticipantId:s.participantId,participants:n,error:null,migratingTo:null}),St(this,bi,"m",ls).call(this,"connected");for(const t of n)if(!t.isLocal)for(const e of t.tracks)"audio"===e.kind&&await St(this,bi,"m",Qi).call(this,e);St(this,bi,"m",Gi).call(this,n.map((t=>t.userId??t.id))),await St(this,bi,"m",Wi).call(this)}catch(i){const s=i instanceof xt?i:xt.from("networkFailed",i?.message,i);if("auth_expired"===s.code&&St(this,xi,"f"))try{const i=await St(this,xi,"f").call(this,e),s={...e,token:i.token,sfuUrl:i.sfuUrl??e.sfuUrl,iceServers:i.iceServers??e.iceServers};return Ct(this,Ei,s),St(this,bi,"m",hs).call(this,{sfuUrl:s.sfuUrl}),void await St(this,bi,"m",t).call(this,s)}catch(t){const e=xt.from("authRejected",void 0,t);throw St(this,bi,"m",hs).call(this,{error:e.toInfo()}),St(this,bi,"m",ls).call(this,"failed"),St(this,bi,"m",ds).call(this,"error",e.toInfo()),e}throw St(this,bi,"m",hs).call(this,{error:s.toInfo()}),St(this,bi,"m",ls).call(this,"failed"),St(this,bi,"m",ds).call(this,"error",s.toInfo()),s}},Wi=async function(){const t=this.localParticipant();for(const[e,i]of St(this,Ti,"f"))i.trackId||("mic"!==e||t?.capabilities.publishAudio)&&("camera"!==e||t?.capabilities.publishVideo)&&("screen"!==e||t?.capabilities.publishScreen)&&await St(this,bi,"m",Ai).call(this,e,i.track,i.track.kind)},Ai=async function(t,e,i){const s=await St(this,yi,"f").publish({track:e,source:t,simulcast:"camera"===t}),n=St(this,Ti,"f").get(t)??{track:e};n.track=e,n.trackId=s.id,St(this,Ti,"f").set(t,n);const a=this.store.getState().localParticipantId,o={id:s.id,participantId:a??s.participantId,source:t,kind:i??e.kind,muted:"mic"===t&&!e.enabled,mediaStreamTrack:e,availableLayers:s.availableLayers??[],currentLayer:s.currentLayer??null,pinnedLayer:s.pinnedLayer??null,layerReason:s.layerReason,subscribed:!0};a&&St(this,bi,"m",ns).call(this,a,o),St(this,bi,"m",ds).call(this,"participant",a)},Pi=async function(t){const e=St(this,Ti,"f").get(t);e&&(e.trackId&&(await St(this,yi,"f").unpublish(e.trackId),St(this,bi,"m",os).call(this,e.trackId)),e.trackId=void 0,St(this,Ti,"f").delete(t))},Oi=async function(t,e){if(!e)return;if(St(this,Ti,"f").get(t))return;const i=await St(this,bi,"m",_i).call(this,t);i&&St(this,Ti,"f").set(t,{track:i})},_i=async function(t){try{const e=await St(this,wi,"f").acquire({audio:"mic"===t,video:"camera"===t}),i="mic"===t?e.audio:e.video;if(!i)return;return i}catch(t){const e=t instanceof xt?t:xt.from("permissionDenied",void 0,t);return St(this,bi,"m",hs).call(this,{error:e.toInfo()}),void St(this,bi,"m",ds).call(this,"error",e.toInfo())}},Di=function(t){const e=this.store.getState().participants;e.some((e=>e.id===t.id))?St(this,bi,"m",ss).call(this,t.id,t):St(this,bi,"m",hs).call(this,{participants:[...e,t]});for(const e of t.tracks)"audio"===e.kind&&St(this,bi,"m",Qi).call(this,e);St(this,bi,"m",Gi).call(this,[t.userId??t.id]),St(this,bi,"m",ds).call(this,"participant",t.id)},Ui=function(t){const e=St(this,bi,"m",es).call(this,t.id);if(!e)return void St(this,bi,"m",Di).call(this,t);const i={...e,...t,isLocal:e.isLocal,tracks:e.tracks,displayName:t.displayName??e.displayName,avatarUrl:t.avatarUrl??e.avatarUrl};St(this,bi,"m",ss).call(this,t.id,i),St(this,bi,"m",Gi).call(this,[t.userId??t.id]),e.isLocal&&t.capabilities&&St(this,bi,"m",zi).call(this,t.capabilities)},zi=async function(t){const e={mic:t.publishAudio,camera:t.publishVideo,screen:t.publishScreen,"screen-audio":t.publishScreen};for(const t of Array.from(St(this,Ti,"f").keys())){if(e[t])continue;const i=St(this,Ti,"f").get(t);try{await St(this,bi,"m",Pi).call(this,t)}catch(e){St(this,vi,"f")?.warn?.("call-core: could not unpublish after a demotion",e),St(this,Ti,"f").delete(t)}i?.track.stop(),"screen"===t&&St(this,bi,"m",hs).call(this,{sharingId:null})}},Ni=function(t){St(this,ki,"f").remove(t),St(this,ji,"f").delete(t),St(this,bi,"m",hs).call(this,(e=>({participants:e.participants.filter((e=>e.id!==t)),pinnedId:e.pinnedId===t?null:e.pinnedId,activeSpeakerId:e.activeSpeakerId===t?null:e.activeSpeakerId,sharingId:e.sharingId===t?null:e.sharingId})))},$i=function(t){t.participantId!==this.store.getState().localParticipantId&&(St(this,bi,"m",ns).call(this,t.participantId,t),"audio"===t.kind?St(this,bi,"m",Qi).call(this,t):"screen"===t.source?(St(this,bi,"m",hs).call(this,{sharingId:t.participantId}),St(this,bi,"m",Qi).call(this,t)):this.store.getState().visibleParticipantIds.includes(t.participantId)&&St(this,bi,"m",Qi).call(this,t))},Hi=function(t){const e=this.store.getState().participants.find((e=>e.tracks.some((e=>e.id===t)))),i=e?.tracks.find((e=>e.id===t));St(this,bi,"m",os).call(this,t),"screen"===i?.source&&(this.store.getState().participants.some((t=>t.id===i.participantId&&t.tracks.some((t=>"screen"===t.source))))||St(this,bi,"m",hs).call(this,{sharingId:null}))},qi=function(t){St(this,bi,"m",as).call(this,t.id,{mediaStreamTrack:t.mediaStreamTrack,subscribed:!0,muted:t.muted,availableLayers:t.availableLayers,currentLayer:t.currentLayer,pinnedLayer:t.pinnedLayer,layerReason:t.layerReason})},Fi=function(t,e,i){const s=St(this,bi,"m",is).call(this,t);s&&(s.currentLayer===e&&s.layerReason===i||St(this,bi,"m",as).call(this,t,{currentLayer:e,layerReason:i}))},Bi=function(t,e){const i=St(this,bi,"m",is).call(this,t);if(!i||i.source===e)return;const s=i.source;if(St(this,bi,"m",as).call(this,t,{source:e}),"screen"===e)return St(this,bi,"m",hs).call(this,{sharingId:i.participantId}),void(i.subscribed||St(this,bi,"m",Qi).call(this,{...i,source:e}));"screen"===s&&(this.store.getState().participants.some((e=>e.id===i.participantId&&e.tracks.some((e=>e.id!==t&&"screen"===e.source))))||this.store.getState().sharingId!==i.participantId||St(this,bi,"m",hs).call(this,{sharingId:null}))},Ji=function(t){for(const[e,i]of Object.entries(t))St(this,ji,"f").set(e,i);const{speaking:e,activeSpeakerId:i}=St(this,ki,"f").update(t);St(this,bi,"m",ds).call(this,"audioLevel",t);const s=this.store.getState();(i!==s.activeSpeakerId||s.participants.some((t=>t.speaking!==e.includes(t.id))))&&St(this,bi,"m",hs).call(this,{activeSpeakerId:i,participants:s.participants.map((i=>{const s=e.includes(i.id);return i.speaking===s?i:{...i,speaking:s,audioLevel:t[i.id]??i.audioLevel}}))})},Vi=function(t,e){St(this,bi,"m",ss).call(this,t,{agentState:e})},Yi=function(t){const e=this.store.getState().transcript,i=e.findIndex((e=>e.id===t.id)),s=i>=0?e.map(((e,s)=>s===i?t:e)):[...e,t];St(this,bi,"m",hs).call(this,{transcript:s}),St(this,bi,"m",ds).call(this,"transcript",t)},Xi=async function(t){if(St(this,Ri,"f"))return;Ct(this,Ri,!0),St(this,bi,"m",hs).call(this,{migratingTo:t.sfuUrl}),St(this,bi,"m",ls).call(this,"migrating"),St(this,bi,"m",ds).call(this,"migrate",t);const e=Array.from(St(this,Ti,"f").keys());try{await St(this,yi,"f").disconnect();const i={sfuUrl:t.sfuUrl,token:t.token,roomId:t.roomId,mode:this.store.getState().mode??"group"};Ct(this,Ei,i);for(const t of e){const e=St(this,Ti,"f").get(t);e&&(e.trackId=void 0)}await St(this,bi,"m",Li).call(this,i)}catch(t){St(this,vi,"f")?.warn?.("call-core: migration failed",t)}finally{Ct(this,Ri,!1)}},Ki=async function(t,e){const i=t instanceof xt?t:xt.from("networkLost",void 0,t);if("session_unknown"===i.code&&St(this,xi,"f")&&St(this,Ei,"f"))try{const t=await St(this,xi,"f").call(this,St(this,Ei,"f")),e={...St(this,Ei,"f"),token:t.token,sfuUrl:t.sfuUrl??St(this,Ei,"f").sfuUrl,iceServers:t.iceServers??St(this,Ei,"f").iceServers};return Ct(this,Ei,e),St(this,bi,"m",ls).call(this,"connecting"),await St(this,yi,"f").disconnect().catch((()=>{})),void await St(this,bi,"m",Li).call(this,e)}catch(t){const e=xt.from("authRejected",void 0,t);return St(this,bi,"m",hs).call(this,{error:e.toInfo()}),St(this,bi,"m",ls).call(this,"failed"),void St(this,bi,"m",ds).call(this,"error",e.toInfo())}if("auth_expired"===i.code&&St(this,xi,"f"))try{const t=await St(this,xi,"f").call(this,St(this,Ei,"f"));return void(St(this,yi,"f").updateToken?await St(this,yi,"f").updateToken(t.token):St(this,Ei,"f")&&(Ct(this,Ei,{...St(this,Ei,"f"),token:t.token,sfuUrl:t.sfuUrl??St(this,Ei,"f").sfuUrl,iceServers:t.iceServers??St(this,Ei,"f").iceServers}),await this.join(St(this,Ei,"f"))))}catch(t){const e=xt.from("authRejected",void 0,t);return St(this,bi,"m",hs).call(this,{error:e.toInfo()}),St(this,bi,"m",ls).call(this,"failed"),void St(this,bi,"m",ds).call(this,"error",e.toInfo())}St(this,bi,"m",hs).call(this,{error:i.toInfo()}),St(this,bi,"m",ds).call(this,"error",i.toInfo()),e&&"room"===i.category&&St(this,bi,"m",ls).call(this,"failed")},Zi=function(t){"reconnecting"===t&&"connected"===this.store.getState().status?St(this,bi,"m",ls).call(this,"reconnecting"):"connected"===t&&"reconnecting"===this.store.getState().status?St(this,bi,"m",ls).call(this,"connected"):"failed"===t&&"ended"!==this.store.getState().status&&St(this,bi,"m",ls).call(this,"failed")},Gi=async function(t){if(!St(this,gi,"f")||0===t.length)return;const e=await async function(t,e){if(!t||0===e.length)return{};try{return await t.resolve(e)}catch{return{}}}(St(this,gi,"f"),t);if(0===Object.entries(e).length)return;const i=this.store.getState().participants.map((t=>{const i=e[t.userId??t.id];return i?{...t,displayName:i.displayName??t.displayName,avatarUrl:i.avatarUrl??t.avatarUrl,kind:i.kind??t.kind}:t}));St(this,bi,"m",hs).call(this,{participants:i})},Qi=async function(t){if(!t.subscribed)try{await St(this,yi,"f").subscribe(t,t.pinnedLayer??void 0),St(this,bi,"m",as).call(this,t.id,{subscribed:!0})}catch(t){St(this,vi,"f")?.warn?.("call-core: could not subscribe to track",t)}},ts=function(t){return this.localParticipant()?.tracks.find((e=>e.source===t))},es=function(t){if(t)return this.store.getState().participants.find((e=>e.id===t))},is=function(t){for(const e of this.store.getState().participants){const i=e.tracks.find((e=>e.id===t));if(i)return i}},ss=function(t,e){t&&St(this,bi,"m",hs).call(this,{participants:this.store.getState().participants.map((i=>i.id===t?{...i,...e}:i))})},ns=function(t,e){St(this,bi,"m",hs).call(this,{participants:this.store.getState().participants.map((i=>i.id!==t?i:i.tracks.some((t=>t.id===e.id))?{...i,tracks:i.tracks.map((t=>t.id===e.id?{...t,...e}:t))}:{...i,tracks:[...i.tracks,e]}))})},as=function(t,e){St(this,bi,"m",hs).call(this,{participants:this.store.getState().participants.map((i=>i.tracks.some((e=>e.id===t))?{...i,tracks:i.tracks.map((i=>i.id===t?{...i,...e}:i))}:i))})},os=function(t){St(this,bi,"m",hs).call(this,{participants:this.store.getState().participants.map((e=>e.tracks.some((e=>e.id===t))?{...e,tracks:e.tracks.filter((e=>e.id!==t))}:e))})},rs=function(t,e){const i=St(this,Ti,"f").get(t);i?.trackId&&St(this,bi,"m",as).call(this,i.trackId,e)},cs=function(t){const e=this.localParticipant();if(!e?.capabilities[t])throw xt.from("capabilityDenied")},ls=function(t){const e=this.store.getState().status;e!==t&&(St(this,bi,"m",hs).call(this,{status:t}),St(this,bi,"m",ds).call(this,"statusChange",{status:t,previous:e}))},hs=function(t){this.store.setState((e=>({...e,..."function"==typeof t?t(e):t})))},ds=function(t,e){for(const i of St(this,Ii,"f").get(t)??[])try{i(e)}catch(t){St(this,vi,"f")?.warn?.("call-core: session listener failed",t)}};const ps=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}state="idle";strings;get labels(){return{...yt,...this.strings??{}}}render(){const t=this.labels,e="listening"===this.state?t.agentListening:"thinking"===this.state?t.agentThinking:"speaking"===this.state?t.agentSpeaking:t.agentIdle;return M(T,{key:"8b749b8d6db8352727a285808632a6e13566e46a"},M("span",{key:"7af887f2860c4523616ad4d0b8f6ecae718741bb",class:{indicator:!0,[this.state]:!0},part:"indicator",role:"status","aria-live":"polite"},M("span",{key:"b7640b1e56af294dfec16a8f0c8c6a98625e1e7d",class:"dot","aria-hidden":"true"}),M("span",{key:"41905116ca40f1d14fb45b46118527d135a4d2ec",class:"label"},e)))}static get style(){return":host{display:inline-block;--agent-color:var(--accent-color, #4a86e8)}.indicator{display:inline-flex;align-items:center;gap:6px;font-family:var(--font-primary, sans-serif);font-size:12px;color:var(--text-primary, #171a1f)}.dot{width:8px;height:8px;border-radius:50%;background:var(--agent-color);box-shadow:0 0 0 0 color-mix(in srgb, var(--agent-color) 45%, transparent)}.idle .dot{background:var(--text-secondary, #9095a1)}.thinking .dot{animation:pulse 1s ease-in-out infinite}.speaking .dot{animation:pulse 0.6s ease-in-out infinite}@keyframes pulse{0%,100%{box-shadow:0 0 0 0 color-mix(in srgb, var(--agent-color) 45%, transparent)}50%{box-shadow:0 0 0 5px color-mix(in srgb, var(--agent-color) 0%, transparent)}}@media (prefers-reduced-motion: reduce){.dot{animation:none !important}}"}},[513,"chatleo-call-agent-indicator",{state:[1],strings:[16]}]);function ms(){"undefined"!=typeof customElements&&["chatleo-call-agent-indicator"].forEach((t=>{"chatleo-call-agent-indicator"===t&&(customElements.get(t)||customElements.define(t,ps))}))}ms();const bs=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.audioBlocked=R(this,"audioBlocked")}get host(){return this}session;sinkId;audioBlocked;audio;unsubscribe;connectedCallback(){this.attach()}disconnectedCallback(){this.unsubscribe?.()}onSessionChange(){this.attach()}onSinkChange(){this.applySink()}async resumeAudio(){await this.play()}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((t=>t.participants),(()=>this.sync()),((t,e)=>t===e)),this.sync())}sync(){if(!this.audio||!this.session)return;const t=this.session.remoteAudioTracks();if(!t.length)return void(this.audio.srcObject=null);if("undefined"==typeof MediaStream)return;const e=new MediaStream(t);this.audio.srcObject=e,this.applySink(),this.play()}async play(){if(this.audio)try{await this.audio.play()}catch{this.audioBlocked.emit(),this.session?.notifyAudioBlocked()}}applySink(){const t=this.audio;t?.setSinkId&&this.sinkId&&t.setSinkId(this.sinkId).catch((()=>{}))}render(){return M(T,{key:"fef3bac1dc7359ca03a359462c0e089db434e42e",hidden:!0},M("audio",{key:"73bb7c0f5f4e840bb79a64caef91a6f496817983",autoplay:!0,ref:t=>{this.audio=t,this.sync()}}))}static get watchers(){return{session:[{onSessionChange:0}],sinkId:[{onSinkChange:0}]}}},[513,"chatleo-call-audio",{session:[16],sinkId:[1,"sink-id"],resumeAudio:[64]},void 0,{session:[{onSessionChange:0}],sinkId:[{onSinkChange:0}]}]);function gs(){"undefined"!=typeof customElements&&["chatleo-call-audio"].forEach((t=>{"chatleo-call-audio"===t&&(customElements.get(t)||customElements.define(t,bs))}))}gs();const ys=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.toggleMic=R(this,"toggleMic"),this.toggleCamera=R(this,"toggleCamera"),this.toggleScreenShare=R(this,"toggleScreenShare"),this.toggleHand=R(this,"toggleHand"),this.toggleChat=R(this,"toggleChat"),this.toggleTranscript=R(this,"toggleTranscript"),this.toggleLayout=R(this,"toggleLayout"),this.leave=R(this,"leave")}session;mode="group";compact=!1;layout="auto";chatOpen=!1;transcriptOpen=!1;strings;toggleMic;toggleCamera;toggleScreenShare;toggleHand;toggleChat;toggleTranscript;toggleLayout;leave;controlState={micOn:!1,cameraOn:!1,sharing:!1,handRaised:!1,canPublishAudio:!1,canPublishVideo:!1,canPublishScreen:!1,canModerate:!1,localId:null,sharingId:null};unsubscribe;get labels(){return{...yt,...this.strings??{}}}connectedCallback(){this.attach()}disconnectedCallback(){this.unsubscribe?.()}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((t=>{const e=t.participants.find((t=>t.isLocal));return{micOn:!!e?.tracks.find((t=>"mic"===t.source&&!t.muted)),cameraOn:!!e?.tracks.find((t=>"camera"===t.source)),sharing:!!e&&t.sharingId===e.id,handRaised:t.handRaised,canPublishAudio:!!e?.capabilities.publishAudio,canPublishVideo:!!e?.capabilities.publishVideo,canPublishScreen:!!e?.capabilities.publishScreen,canModerate:!!e?.capabilities.moderate,localId:t.localParticipantId,sharingId:t.sharingId}}),(t=>{this.controlState=t}),((t,e)=>JSON.stringify(t)===JSON.stringify(e))),this.controlState=this.readState())}readState(){if(!this.session)return this.controlState;const t=this.session.getState(),e=t.participants.find((t=>t.isLocal));return{micOn:!!e?.tracks.find((t=>"mic"===t.source&&!t.muted)),cameraOn:!!e?.tracks.find((t=>"camera"===t.source)),sharing:!!e&&t.sharingId===e.id,handRaised:t.handRaised,canPublishAudio:!!e?.capabilities.publishAudio,canPublishVideo:!!e?.capabilities.publishVideo,canPublishScreen:!!e?.capabilities.publishScreen,canModerate:!!e?.capabilities.moderate,localId:t.localParticipantId,sharingId:t.sharingId}}screenSupported(){return"undefined"!=typeof navigator&&!!navigator.mediaDevices?.getDisplayMedia}render(){const t=this.labels,e=this.controlState,i=this.screenSupported(),s="stage"===this.mode,n="group"===this.mode,a=[e.canPublishAudio?M("button",{type:"button",class:{active:e.micOn},"aria-pressed":e.micOn?"true":"false","aria-label":e.micOn?t.mute:t.unmute,title:e.micOn?t.mute:t.unmute,onClick:()=>this.toggleMic.emit({enabled:!e.micOn})},e.micOn?"🎙":"🔇"):null,e.canPublishVideo?M("button",{type:"button",class:{active:e.cameraOn},"aria-pressed":e.cameraOn?"true":"false","aria-label":e.cameraOn?t.cameraOff:t.cameraOn,title:e.cameraOn?t.cameraOff:t.cameraOn,onClick:()=>this.toggleCamera.emit({enabled:!e.cameraOn})},e.cameraOn?"📹":"📷"):null,M("button",{key:"778ea621eeadd90c8ef79cad39988a5b507f88b2",type:"button",class:{active:this.chatOpen},"aria-pressed":this.chatOpen?"true":"false","aria-label":t.chat,title:t.chat,onClick:()=>this.toggleChat.emit()},"💬"),M("button",{key:"b8113c612b6dac2b6ca90f9fe2082890899c1b23",type:"button",class:{active:this.transcriptOpen},"aria-pressed":this.transcriptOpen?"true":"false","aria-label":t.transcript,title:t.transcript,onClick:()=>this.toggleTranscript.emit()},"CC"),M("button",{key:"e176addec95b1c865805b5e83a96e8b00198346d",type:"button",class:"leave","aria-label":t.leave,title:t.leave,onClick:()=>this.leave.emit()},"⏻")],o=[e.canPublishScreen&&i?M("button",{type:"button",class:{active:e.sharing},"aria-pressed":e.sharing?"true":"false","aria-label":e.sharing?t.stopSharing:t.shareScreen,title:e.sharing?t.stopSharing:t.shareScreen,onClick:()=>this.toggleScreenShare.emit({enabled:!e.sharing})},"🖥"):null,s?M("button",{type:"button",class:{active:e.handRaised},"aria-pressed":e.handRaised?"true":"false","aria-label":e.handRaised?t.lowerHand:t.raiseHand,title:e.handRaised?t.lowerHand:t.raiseHand,onClick:()=>this.toggleHand.emit({raised:!e.handRaised})},"✋"):null,n?M("button",{type:"button","aria-label":t.layout,title:t.layout,onClick:()=>this.toggleLayout.emit()},"speaker"===this.layout?"▦":"▣"):null];return M(T,{key:"3f708646ac696e79172da46bba0f7d367e574867"},M("div",{key:"2f5eb284750d77d266cf91461a5b829fa5cf78f8",class:{controls:!0,compact:this.compact},part:"controls",role:"toolbar","aria-label":"Call controls"},M("div",{key:"438cf1c4213642641e16cdeb281a80c49817db81",class:"group start"},M("slot",{key:"dcfc413e6a90e6897765ed36b5a9012341afe13b",name:"start"})),this.compact?a:[...a,...o],this.compact?M("details",{class:"overflow"},M("summary",{"aria-label":"More controls"},"⋯"),M("div",{class:"overflow-menu"},o)):null,M("div",{key:"b0497290c5aa46046a2d05f93b6111a3513f007e",class:"group end"},M("slot",{key:"a1abb281f805c141e7440d444f7446dbb78ed534",name:"end"}))))}static get style(){return":host{display:block;font-family:var(--font-primary, sans-serif)}.controls{display:flex;align-items:center;gap:8px;padding:8px;background:var(--bg-primary, #fff);border-top:1px solid var(--border-light, #eeeeee)}.group{display:flex;gap:6px}.start{margin-right:auto}.end{margin-left:auto}button,summary{min-width:40px;height:40px;border:1px solid var(--border-color, #bdc1ca);border-radius:999px;background:var(--bg-secondary, #f3f4f6);color:var(--text-primary, #171a1f);font-size:16px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0 10px}button.active{background:var(--accent-color, #4a86e8);border-color:var(--accent-color, #4a86e8);color:#fff}button.leave{background:#ef4444;border-color:#ef4444;color:#fff}button:focus-visible,summary:focus-visible{outline:2px solid var(--accent-color, #4a86e8);outline-offset:2px}.overflow{position:relative}.overflow summary{list-style:none}.overflow-menu{position:absolute;bottom:48px;right:0;display:flex;gap:6px;padding:6px;background:var(--bg-primary, #fff);border:1px solid var(--border-light, #eeeeee);border-radius:var(--border-radius, 8px);box-shadow:0 4px 16px rgba(0, 0, 0, 0.12);z-index:10}@media (prefers-reduced-motion: reduce){button{transition:none}}"}},[769,"chatleo-call-controls",{session:[16],mode:[1],compact:[4],layout:[1],chatOpen:[4,"chat-open"],transcriptOpen:[4,"transcript-open"],strings:[16],controlState:[32]}]);function vs(){"undefined"!=typeof customElements&&["chatleo-call-controls"].forEach((t=>{"chatleo-call-controls"===t&&(customElements.get(t)||customElements.define(t,ys))}))}vs();const ws=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.deviceChange=R(this,"deviceChange")}session;kind="audioinput";label;strings;deviceChange;devices=[];selected;unsubscribe;get labels(){return{...yt,...this.strings??{}}}connectedCallback(){this.attach()}disconnectedCallback(){this.unsubscribe?.()}onSessionChange(){this.attach()}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.devices.onChange((()=>this.sync())),this.session.devices.start().then((()=>this.sync())),this.sync())}sync(){this.session&&(this.devices=this.session.devices.devices.filter((t=>t.kind===this.kind)).map((t=>({deviceId:t.deviceId,label:t.label||this.labels.noDevices}))),this.selected=this.session.devices.selected[this.kind])}get fallbackLabel(){return this.label?this.label:"audioinput"===this.kind?this.labels.microphone:"videoinput"===this.kind?this.labels.camera:this.labels.speaker}render(){return M(T,{key:"bd092a8a9513cfb293badfcd7be30d6e86684d35"},M("label",{key:"07087145735a24aff4c700ffae7464d0b49d4aa0",class:"field",part:"field"},M("span",{key:"bbf72354c07ddf2b643dbf8b46e4c22e176b53b8",class:"label"},this.fallbackLabel),M("select",{key:"43694a96dffd693b5ee6ad287e355fa57dca47db",onChange:t=>{const e=t.target.value;this.selected=e,this.deviceChange.emit({kind:this.kind,deviceId:e})}},0===this.devices.length?M("option",{value:""},this.labels.noDevices):null,this.devices.map((t=>M("option",{value:t.deviceId,selected:t.deviceId===this.selected},t.label))))))}static get watchers(){return{session:[{onSessionChange:0}]}}static get style(){return":host{display:block;font-family:var(--font-primary, sans-serif)}.field{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--text-secondary, #9095a1)}select{min-height:34px;border:1px solid var(--border-color, #bdc1ca);border-radius:var(--border-radius, 8px);background:var(--bg-primary, #fff);color:var(--text-primary, #171a1f);font:inherit;padding:4px 8px}select:focus-visible{outline:2px solid var(--accent-color, #4a86e8);outline-offset:1px}"}},[513,"chatleo-call-device-select",{session:[16],kind:[1],label:[1],strings:[16],devices:[32],selected:[32]},void 0,{session:[{onSessionChange:0}]}]);function ks(){"undefined"!=typeof customElements&&["chatleo-call-device-select"].forEach((t=>{"chatleo-call-device-select"===t&&(customElements.get(t)||customElements.define(t,ws))}))}function xs(t,e="?"){if(!t)return e;const i=t.trim().split(/\s+/).filter(Boolean);return 0===i.length?e:1===i.length?i[0].slice(0,2).toUpperCase():`${i[0][0]}${i[i.length-1][0]}`.toUpperCase()}function Ss(t,e="camera"){if(t)return function(t,e){if(t)return t.tracks.find((t=>t.source===e))}(t,"screen"===e?"screen":"camera")}function Cs(t,e="Participant"){return t?.displayName||t?.id||e}ks();const Ms=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.accept=R(this,"accept"),this.decline=R(this,"decline")}caller;video=!1;strings;accept;decline;get labels(){return{...yt,...this.strings??{}}}render(){const t=this.labels,e=this.caller?.displayName||this.caller?.id||t.incomingCall;return M(T,{key:"a9dc9f24ebdf69dee36f74c1a4f6578e28013043"},M("div",{key:"8fba33929de794afbcfe81d13584216819a2e7cb",class:"incoming",part:"incoming",role:"dialog","aria-label":t.incomingCall},M("div",{key:"0a938ee7b707e6bd5eb034bdd885c97c0876cf2c",class:"avatar","aria-hidden":"true"},this.caller?.avatarUrl?M("img",{src:this.caller.avatarUrl,alt:""}):xs(e)),M("div",{key:"549545ce93d6fe5232d0d871b9a4bf1eef90bbd4",class:"who"},M("span",{key:"0e6ea7c9e26557c24ff07cdd66dcf0fd28004976",class:"title"},t.incomingCall),M("span",{key:"bc6439309e40198c6e50c8186f1261c5b0d0a585",class:"name"},e),M("span",{key:"31add48f93045b247882fe9be8c3a8a40e9c63f6",class:"kind"},this.video?"Video call":"Audio call")),M("div",{key:"55f674789c7302a451249ed32cbdd0eb3d9d811c",class:"actions"},M("button",{key:"44fc4ab2a0e628118176c03fd8940dfedf1be78d",type:"button",class:"decline",onClick:()=>this.decline.emit()},t.decline),M("button",{key:"4667a6cdc0e0dbfab582827262ef6431c1d43a2f",type:"button",class:"accept",onClick:()=>this.accept.emit()},t.accept))))}static get style(){return":host{display:block;font-family:var(--font-primary, sans-serif)}.incoming{display:flex;align-items:center;gap:12px;padding:12px 16px;border-radius:var(--border-radius, 8px);background:var(--bg-primary, #fff);border:1px solid var(--border-light, #eeeeee);box-shadow:0 8px 32px rgba(0, 0, 0, 0.16);color:var(--text-primary, #171a1f)}.avatar{width:44px;height:44px;border-radius:50%;overflow:hidden;background:var(--bg-secondary, #f3f4f6);display:flex;align-items:center;justify-content:center;font-weight:700;color:var(--text-secondary, #9095a1);flex-shrink:0}.avatar img{width:100%;height:100%;object-fit:cover}.who{display:flex;flex-direction:column;flex:1;min-width:0}.title{font-size:11px;text-transform:uppercase;letter-spacing:0.05em;color:var(--text-secondary, #9095a1)}.name{font-size:15px;font-weight:700}.kind{font-size:12px;color:var(--text-secondary, #9095a1)}.actions{display:flex;gap:8px}button{min-height:34px;padding:0 12px;border-radius:999px;border:1px solid var(--border-color, #bdc1ca);background:var(--bg-secondary, #f3f4f6);color:var(--text-primary, #171a1f);font:inherit;cursor:pointer}button.accept{background:#16a34a;border-color:#16a34a;color:#fff}button.decline{background:#ef4444;border-color:#ef4444;color:#fff}button:focus-visible{outline:2px solid var(--accent-color, #4a86e8);outline-offset:2px}"}},[513,"chatleo-call-incoming",{caller:[16],video:[4],strings:[16]}]);function Es(){"undefined"!=typeof customElements&&["chatleo-call-incoming"].forEach((t=>{"chatleo-call-incoming"===t&&(customElements.get(t)||customElements.define(t,Ms))}))}Es();const Ts=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.joinRequest=R(this,"joinRequest")}get host(){return this}session;audioOnly=!1;strings;joinRequest;micEnabled=!0;cameraEnabled=!1;level=0;permissionError=null;ready=!1;activeSession;preview;audioContext;animation;unsubscribe;deviceUnsubscribe;get labels(){return{...yt,...this.strings??{}}}connectedCallback(){this.activeSession=this.session??function(t){let e;const i=new CustomEvent("chatleoCallSessionRequest",{bubbles:!0,composed:!0,cancelable:!0,detail:{callback:t=>{e=t}}});return t.dispatchEvent(i),e}(this.host),this.cameraEnabled=!this.audioOnly,this.prepare()}disconnectedCallback(){this.unsubscribe?.(),this.deviceUnsubscribe?.(),this.animation&&cancelAnimationFrame(this.animation),this.audioContext?.close().catch((()=>{}))}async prepare(){if(this.activeSession)try{"idle"===this.activeSession.getState().status&&await this.activeSession.prepare(),await this.activeSession.startPreview({audio:!0,video:!this.audioOnly});const t=this.activeSession.getState().error;"permission"===t?.category&&(this.permissionError="permission_blocked"===t.code?this.labels.permissionBlocked:this.labels.permissionDenied),this.deviceUnsubscribe=this.activeSession.devices.onChange((()=>this.ready=!0)),this.bindPreview(),this.startMeter(),this.ready=!0}catch{const t=this.activeSession.getState().error;this.permissionError="permission"===t?.category?"permission_blocked"===t.code?this.labels.permissionBlocked:this.labels.permissionDenied:null}}bindPreview(){if(!this.preview||!this.activeSession)return;const t=this.activeSession.localPreviewStream();this.preview.srcObject=t,t&&this.preview.play().catch((()=>{}))}startMeter(){const t=this.activeSession?.localPreviewStream(),e=t?.getAudioTracks()[0],i="undefined"!=typeof AudioContext?AudioContext:void 0;if(e&&i)try{this.audioContext=new i;const e=this.audioContext.createMediaStreamSource(t),s=this.audioContext.createAnalyser();s.fftSize=256,e.connect(s);const n=new Uint8Array(s.frequencyBinCount),a=()=>{s.getByteFrequencyData(n);const t=n.reduce(((t,e)=>t+e),0)/n.length/255;this.level=t,this.animation=requestAnimationFrame(a)};a()}catch{}}async toggleMic(){this.activeSession&&(this.micEnabled=!this.micEnabled,await this.activeSession.setMicEnabled(this.micEnabled),this.bindPreview())}async toggleCamera(){this.activeSession&&(this.cameraEnabled=!this.cameraEnabled,await this.activeSession.setCameraEnabled(this.cameraEnabled),this.bindPreview())}async selectDevice(t,e){await(this.activeSession?.selectDevice(t,e)),this.bindPreview()}render(){const t=this.labels,e=!this.audioOnly,i=this.activeSession?.localParticipant()?.displayName;return M(T,{key:"c5b46525a69f412df0fe99b2794267f120e24f64"},M("div",{key:"0fe3c8af38e2740be6ec04b9892bdd214acd58ca",class:"lobby",part:"lobby"},M("h2",{key:"7fa89e307da483ffe2231e82a72fb4e42debca5a"},t.lobbyTitle),e?M("div",{class:"preview",part:"preview"},M("video",{autoplay:!0,playsinline:!0,muted:!0,ref:t=>{this.preview=t,this.bindPreview()}}),this.cameraEnabled?null:M("div",{class:"placeholder"},xs(i,"👤"))):null,this.permissionError?M("p",{class:"error",role:"alert"},this.permissionError):null,M("div",{key:"a7616fca77a2fbda06d975e490184ec534a703b8",class:"devices"},M("chatleo-call-device-select",{key:"640948ae2a148a4eed1a3434fe9eb1b8d8082acf",session:this.activeSession,kind:"audioinput",strings:this.strings,onDeviceChange:t=>this.selectDevice("audioinput",t.detail.deviceId)}),e?M("chatleo-call-device-select",{session:this.activeSession,kind:"videoinput",strings:this.strings,onDeviceChange:t=>this.selectDevice("videoinput",t.detail.deviceId)}):null,M("chatleo-call-device-select",{key:"db1a810579f8eacdfe692489bbe7f6129176757b",session:this.activeSession,kind:"audiooutput",strings:this.strings,onDeviceChange:t=>this.selectDevice("audiooutput",t.detail.deviceId)})),M("div",{key:"3d11a4d5979e84892fd174c17b23ffe36f63bc81",class:"meter","aria-label":"Microphone level"},M("span",{key:"8a07087e338c603ee210e020e8968d5922ccab86",style:{width:`${Math.round(100*this.level)}%`}})),M("div",{key:"c9ec39a57cd7476a3c880cb2ecada77c44ff0606",class:"actions"},M("button",{key:"6338e90c14ed83b5d8f8b527b71f617454812340",type:"button","aria-pressed":this.micEnabled?"true":"false",onClick:()=>{this.toggleMic()}},this.micEnabled?t.mute:t.unmute),e?M("button",{type:"button","aria-pressed":this.cameraEnabled?"true":"false",onClick:()=>{this.toggleCamera()}},this.cameraEnabled?t.cameraOff:t.cameraOn):null),M("div",{key:"79d3497f27f8b99915f50240f4b0c27b2f530164",class:"join-actions"},M("button",{key:"c6dcee7fbfe120897514ed0c56774cfe5aee0565",type:"button",class:"primary",disabled:!this.ready,onClick:()=>this.joinRequest.emit({audio:this.micEnabled,video:e&&this.cameraEnabled})},t.join),M("button",{key:"bce078ad6d179d47dbad1a982245224bfd5e4b45",type:"button",onClick:()=>this.joinRequest.emit({audio:!1,video:!1})},t.joinAsListener)),M("slot",{key:"c073a2fbde36f5039a435a05fbd688efed41be18",name:"lobby"})))}static get style(){return":host{display:block;font-family:var(--font-primary, sans-serif);background:var(--bg-primary, #fff);color:var(--text-primary, #171a1f)}.lobby{display:flex;flex-direction:column;gap:12px;padding:16px;max-width:640px;margin:0 auto}h2{margin:0;font-size:18px}.preview{position:relative;aspect-ratio:16 / 9;background:var(--bg-secondary, #f3f4f6);border-radius:var(--border-radius, 8px);overflow:hidden;display:flex;align-items:center;justify-content:center}.preview video{width:100%;height:100%;object-fit:cover;transform:scaleX(-1)}.placeholder{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:40px;background:var(--bg-secondary, #f3f4f6);color:var(--text-secondary, #9095a1)}.devices{display:grid;gap:8px}.meter{height:6px;background:var(--bg-secondary, #f3f4f6);border-radius:999px;overflow:hidden}.meter span{display:block;height:100%;background:var(--accent-color, #4a86e8);transition:width 80ms linear}.actions,.join-actions{display:flex;gap:8px;flex-wrap:wrap}button{min-height:38px;padding:0 14px;border-radius:var(--border-radius, 8px);border:1px solid var(--border-color, #bdc1ca);background:var(--bg-secondary, #f3f4f6);color:var(--text-primary, #171a1f);font:inherit;cursor:pointer}button.primary{background:var(--accent-color, #4a86e8);border-color:var(--accent-color, #4a86e8);color:#fff}button:disabled{opacity:0.5;cursor:not-allowed}button:focus-visible{outline:2px solid var(--accent-color, #4a86e8);outline-offset:2px}.error{color:#b91c1c;font-size:13px}@media (prefers-reduced-motion: reduce){.meter span{transition:none}}"}},[769,"chatleo-call-lobby",{session:[16],audioOnly:[4,"audio-only"],strings:[16],micEnabled:[32],cameraEnabled:[32],level:[32],permissionError:[32],ready:[32]}]);function js(){"undefined"!=typeof customElements&&["chatleo-call-lobby","chatleo-call-device-select"].forEach((t=>{switch(t){case"chatleo-call-lobby":customElements.get(t)||customElements.define(t,Ts);break;case"chatleo-call-device-select":customElements.get(t)||ks()}}))}function Is(t){const e=t.capabilities;return e.publishAudio||e.publishVideo||e.publishScreen}js();const Rs=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.promote=R(this,"promote"),this.demote=R(this,"demote"),this.muteRemote=R(this,"muteRemote"),this.remove=R(this,"remove")}session;showAudience=!0;strings;promote;demote;muteRemote;remove;participants=[];canModerate=!1;localId=null;stageMode=!1;unsubscribe;get labels(){return{...yt,...this.strings??{}}}connectedCallback(){this.attach()}disconnectedCallback(){this.unsubscribe?.()}attach(){if(this.unsubscribe?.(),!this.session)return;this.unsubscribe=this.session.store.subscribe((t=>t.participants),(t=>{this.participants=t,this.canModerate=!!t.find((t=>t.isLocal))?.capabilities.moderate}));const t=this.session.getState();this.participants=t.participants,this.localId=t.localParticipantId,this.stageMode="stage"===t.mode,this.canModerate=!!t.participants.find((t=>t.isLocal))?.capabilities.moderate}sorted(){return[...this.participants].sort(((t,e)=>t.handRaised!==e.handRaised?t.handRaised?-1:1:t.isLocal!==e.isLocal?t.isLocal?-1:1:t.speaking!==e.speaking?t.speaking?-1:1:Cs(t).localeCompare(Cs(e))))}speakers(){return this.participants.filter((t=>Is(t)||t.isLocal))}audience(){return this.participants.filter((t=>!Is(t)&&!t.isLocal))}render(){const t=this.labels,e=this.sorted();return M(T,{key:"5a0574e8194c7d3a22b2de9933ddcf6e37322181"},M("div",{key:"19b4da10be08cfb6d0744dc5c7e26709079c9e10",class:"roster",part:"roster"},this.stageMode&&this.showAudience?M("div",{class:"counts",part:"counts"},M("span",null,this.speakers().length," ",t.speaker),M("span",null,this.audience().length," ",t.audience)):null,M("ul",{key:"b6a77857209010c05dfbea6c2dd99cda32581800",role:"list"},e.map((e=>{const i=this.canModerate&&e.id!==this.localId,s=!Is(e)&&!e.isLocal;return M("li",{class:{row:!0,speaking:e.speaking,hand:e.handRaised}},M("span",{class:"avatar","aria-hidden":"true"},e.avatarUrl?M("img",{src:e.avatarUrl,alt:""}):xs(Cs(e))),M("span",{class:"who"},M("span",{class:"name"},Cs(e)),M("span",{class:"meta"},e.isLocal?"you":"agent"===e.kind?"agent":s?t.audience:t.speaker,e.handRaised?" • hand raised":"",e.speaking?" • speaking":"")),i?M("span",{class:"actions"},s?M("button",{type:"button","aria-label":`${t.promote}: ${Cs(e)}`,title:t.promote,onClick:()=>this.promote.emit({participantId:e.id})},"↑"):M("button",{type:"button","aria-label":`${t.demote}: ${Cs(e)}`,title:t.demote,onClick:()=>this.demote.emit({participantId:e.id})},"↓"),M("button",{type:"button","aria-label":`${t.muteParticipant}: ${Cs(e)}`,title:t.muteParticipant,onClick:()=>this.muteRemote.emit({participantId:e.id,source:"mic"})},"🔇"),M("button",{type:"button",class:"remove","aria-label":`${t.removeParticipant}: ${Cs(e)}`,title:t.removeParticipant,onClick:()=>this.remove.emit({participantId:e.id})},"×")):null)}))),0===e.length?M("p",{class:"empty"},t.waitingForOthers):null))}static get style(){return":host{display:block;font-family:var(--font-primary, sans-serif)}.roster{padding:8px}.counts{display:flex;justify-content:space-between;font-size:12px;color:var(--text-secondary, #9095a1);padding:4px 6px 8px}ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}.row{display:flex;align-items:center;gap:8px;padding:6px;border-radius:var(--border-radius, 8px)}.row.hand{background:color-mix(in srgb, var(--accent-color, #4a86e8) 10%, transparent)}.avatar{width:28px;height:28px;border-radius:50%;background:var(--bg-secondary, #f3f4f6);color:var(--text-secondary, #9095a1);display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;overflow:hidden;flex-shrink:0}.avatar img{width:100%;height:100%;object-fit:cover}.who{display:flex;flex-direction:column;min-width:0;flex:1}.name{font-size:13px;font-weight:600;color:var(--text-primary, #171a1f);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.meta{font-size:11px;color:var(--text-secondary, #9095a1)}.row.speaking .name::after{content:' •';color:var(--accent-color, #4a86e8)}.actions{display:flex;gap:2px}.actions button{width:26px;height:26px;border-radius:50%;border:1px solid var(--border-color, #bdc1ca);background:var(--bg-primary, #fff);cursor:pointer;font-size:12px;line-height:1}.actions button.remove{color:#ef4444}.empty{font-size:12px;color:var(--text-secondary, #9095a1);padding:8px}"}},[513,"chatleo-call-roster",{session:[16],showAudience:[4,"show-audience"],strings:[16],participants:[32],canModerate:[32],localId:[32],stageMode:[32]}]);function Ls(){"undefined"!=typeof customElements&&["chatleo-call-roster"].forEach((t=>{"chatleo-call-roster"===t&&(customElements.get(t)||customElements.define(t,Rs))}))}Ls();const Ws=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.pin=R(this,"pin"),this.layerChange=R(this,"layerChange")}get host(){return this}session;participant;source="camera";fit="cover";mirrored;strings;pin;layerChange;video;unsubscribeLevel;get labels(){return{...yt,...this.strings??{}}}connectedCallback(){this.session&&(this.unsubscribeLevel=this.session.on("audioLevel",(t=>{this.host.style.setProperty("--speaking-level",String(Math.min(1,Math.max(0,this.participant?t[this.participant.id]??0:0))))})))}disconnectedCallback(){this.unsubscribeLevel?.()}onSessionChange(){this.unsubscribeLevel?.(),this.connectedCallback()}componentDidRender(){const t=this.participant?Ss(this.participant,this.source):void 0;if(!this.video)return;const e=t?.mediaStreamTrack;if(!e)return void(this.video.srcObject=null);const i=this.video.srcObject;i?.getTracks()[0]!==e&&(this.video.srcObject="undefined"!=typeof MediaStream?new MediaStream([e]):null)}get isPinned(){return!!this.participant&&this.session?.getState().pinnedId===this.participant.id}get isMirrored(){return"screen"!==this.source&&(void 0!==this.mirrored?this.mirrored:!!this.participant?.isLocal)}togglePin=t=>{t.stopPropagation(),this.participant&&this.pin.emit({participantId:this.participant.id,pinned:!this.isPinned})};layerName(t){const e=this.labels;switch(t){case"l":return e.layerLow;case"m":return e.layerMedium;case"h":return e.layerHigh;default:return e.layerAuto}}reasonName(t){const e=this.labels;switch(t){case"bandwidth":return e.layerReasonBandwidth;case"pinned":return e.layerReasonPinned;case"publisher":return e.layerReasonPublisher;default:return}}changeLayer=t=>{if(t.stopPropagation(),!this.participant)return;const e=Ss(this.participant,this.source);if(!e)return;const i=t.target.value;this.layerChange.emit({participantId:this.participant.id,trackId:e.id,layer:""===i?null:i})};render(){const t=this.participant,e=this.labels,i=function(t,e="camera"){const i=Ss(t,e);return!!i&&!i.muted&&!!i.mediaStreamTrack}(t,this.source),s=Cs(t),n=t?Ss(t,this.source):void 0,a="agent"===t?.kind,o=n?.availableLayers??[],r=!t?.isLocal&&o.length>1,c=this.reasonName(n?.layerReason);return M(T,{key:"98b48fd19b439dd66d48ff09cf0671f1211eb4fd"},M("div",{key:"4f2c72cca2dce7701d32becabbafea7b7ff44fe1",class:{tile:!0,speaking:!!t?.speaking,mirrored:this.isMirrored,"fit-contain":"contain"===this.fit,agent:a,"self-view":!!t?.isLocal},part:"tile","data-source":this.source,"data-participant-id":t?.id??"","data-track-id":n?.id??""},a?M("div",{class:"agent-body",part:"agent"},M("chatleo-call-agent-indicator",{state:t?.agentState??"idle"})):null,!a&&i?M("video",{class:"video",part:"video",autoplay:!0,playsinline:!0,muted:!0,ref:t=>{this.video=t}}):null,a||i?null:M("div",{class:"avatar",part:"avatar","aria-hidden":"true"},t?.avatarUrl?M("img",{src:t.avatarUrl,alt:""}):M("span",{class:"initials"},xs(s))),M("div",{key:"34c35cb20ece877202bcf0425742c6ef8656c2b4",class:"speaking-ring","aria-hidden":"true"}),M("span",{key:"6c0fe599f8d1a7119348191bcd4ce68fd013a654",class:"sr-only"},t?.speaking?"Speaking":""),M("div",{key:"1dce385fc8e8bccbc10ac6ddc0dd9dc97235da15",class:"top-badges"},r?M("span",{class:"badge quality",part:"quality",title:`${e.quality}: ${this.layerName(n?.currentLayer)}${c?` · ${c}`:""}`,"aria-label":`${e.quality}: ${this.layerName(n?.currentLayer)}${c?`, ${c}`:""}`},this.layerName(n?.currentLayer),c?M("span",{class:"quality-reason"}," · ",c):null):null,t?.handRaised?M("span",{class:"badge hand",title:e.raiseHand,"aria-label":e.raiseHand},"✋"):null,n?.muted?M("span",{class:"badge muted","aria-label":e.mute},"🔇"):null,"reconnecting"===t?.connection?M("span",{class:"badge reconnecting"},"…"):null),M("div",{key:"1bced9db2da6199526f087fc0c1786d21704ef93",class:"bottom-bar"},M("span",{key:"cb4a39c5b8ed184a7c97612d2173fbe35feee4a2",class:"name"},s),t?.isLocal?M("span",{class:"you"},"(you)"):null),r&&n?M("div",{class:"layer-control",part:"layer-control"},M("select",{class:"layer-select","aria-label":e.quality,onChange:this.changeLayer},M("option",{value:"",selected:!n.pinnedLayer},e.layerAuto),o.map((t=>M("option",{value:t,selected:n.pinnedLayer===t},this.layerName(t)))))):null,M("button",{key:"679dcbbdd938875848b58abfa96f9899efdf84f9",type:"button",class:"pin-button",part:"pin","aria-label":this.isPinned?e.unpin:e.pin,"aria-pressed":this.isPinned?"true":"false",title:this.isPinned?e.unpin:e.pin,onClick:this.togglePin},this.isPinned?"★":"☆"),M("slot",{key:"b273db2d22e11307c0680827b3773462879642d2",name:"overlay"})))}static get watchers(){return{session:[{onSessionChange:0}]}}static get style(){return":host{display:block;min-width:0;min-height:0;--speaking-level:0;--tile-radius:var(--border-radius, 8px);--tile-bg:var(--bg-secondary, #f3f4f6);--tile-text:var(--text-primary, #171a1f);--accent:var(--accent-color, #4a86e8)}.tile{position:relative;width:100%;height:100%;overflow:hidden;border-radius:var(--tile-radius);background:var(--tile-bg);color:var(--tile-text);display:flex;align-items:center;justify-content:center;aspect-ratio:16 / 9;isolation:isolate}.video{width:100%;height:100%;object-fit:cover;display:block}.fit-contain .video{object-fit:contain;background:#000}.mirrored .video{transform:scaleX(-1)}.avatar{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:linear-gradient(160deg, var(--bg-light, #e7effc), var(--bg-secondary, #f3f4f6))}.avatar img{width:100%;height:100%;object-fit:cover}.initials{font-family:var(--font-primary, sans-serif);font-size:clamp(20px, 12cqmin, 56px);font-weight:700;color:var(--text-secondary, #9095a1)}.speaking-ring{position:absolute;inset:0;border-radius:inherit;pointer-events:none;box-shadow:inset 0 0 0 calc(2px + var(--speaking-level) * 4px) var(--accent);opacity:calc(0.35 + var(--speaking-level) * 0.65);transition:opacity 120ms linear}.tile.speaking .name::after{content:' • speaking';color:var(--accent);font-weight:600}.top-badges{position:absolute;top:6px;left:6px;display:flex;gap:4px}.badge{background:rgba(0, 0, 0, 0.55);color:#fff;border-radius:999px;padding:2px 6px;font-size:12px}.badge.quality{font-variant-numeric:tabular-nums;text-transform:uppercase;letter-spacing:0.02em}.quality-reason{font-weight:400;opacity:0.8;text-transform:none}.layer-control{position:absolute;top:6px;right:40px;display:flex;align-items:center}.layer-select{appearance:auto;max-width:110px;padding:3px 4px;border-radius:6px;border:1px solid rgba(255, 255, 255, 0.4);background:rgba(0, 0, 0, 0.55);color:#fff;font-family:var(--font-primary, sans-serif);font-size:11px;cursor:pointer}.layer-select:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.bottom-bar{position:absolute;left:0;right:0;bottom:0;padding:18px 8px 6px;display:flex;gap:4px;align-items:baseline;background:linear-gradient(transparent, rgba(0, 0, 0, 0.6))}.name{font-family:var(--font-primary, sans-serif);font-size:12px;font-weight:600;color:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.you{font-size:11px;color:rgba(255, 255, 255, 0.75)}.pin-button{position:absolute;top:6px;right:6px;width:28px;height:28px;border-radius:50%;border:1px solid rgba(255, 255, 255, 0.4);background:rgba(0, 0, 0, 0.45);color:#fff;cursor:pointer;font-size:14px;line-height:1;opacity:0;transition:opacity 120ms ease}.tile:hover .pin-button,.pin-button:focus-visible{opacity:1}.agent-body{padding:12px;text-align:center}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border:0}@media (prefers-reduced-motion: reduce){.speaking-ring,.pin-button{transition:none}}@container (max-width: 420px){.pin-button{opacity:1}.layer-select{max-width:86px}}"}},[769,"chatleo-call-tile",{session:[16],participant:[16],source:[1],fit:[1],mirrored:[4],strings:[16]},void 0,{session:[{onSessionChange:0}]}]);function As(){"undefined"!=typeof customElements&&["chatleo-call-tile","chatleo-call-agent-indicator"].forEach((t=>{switch(t){case"chatleo-call-tile":customElements.get(t)||customElements.define(t,Ws);break;case"chatleo-call-agent-indicator":customElements.get(t)||ms()}}))}As();const Ps=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.layoutChange=R(this,"layoutChange")}get host(){return this}session;layout="auto";maxTiles;strings;layoutChange;result;unsubscribe;resizeObserver;lastVisibleKey="";connectedCallback(){this.attach(),this.observeSize()}disconnectedCallback(){this.unsubscribe?.(),this.resizeObserver?.disconnect()}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((t=>({participants:t.participants,activeSpeakerId:t.activeSpeakerId,pinnedId:t.pinnedId,sharingId:t.sharingId,mode:t.mode})),(()=>this.recompute()),((t,e)=>t.activeSpeakerId===e.activeSpeakerId&&t.pinnedId===e.pinnedId&&t.sharingId===e.sharingId&&t.mode===e.mode&&function(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every(((t,i)=>Object.is(t,e[i])));if(t&&e&&"object"==typeof t&&"object"==typeof e){const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>Object.prototype.hasOwnProperty.call(e,i)&&Object.is(t[i],e[i])))}return!1}(t.participants,e.participants))),this.recompute())}observeSize(){"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver((()=>this.recompute())),this.resizeObserver.observe(this.host))}recompute(){if(!this.session)return;const t=this.session.getState();if(!t.mode)return;const e=function(t){const e="stage"===t.mode?t.participants.filter(Is):t.participants,i=(s=t.containerWidth,n=t.containerHeight,(a=t.maxTiles)&&a>0?a:s>0&&s<600||n>0&&n<360?4:9);var s,n,a;const o="camera";if(t.sharingId){const s=e.find((e=>e.id===t.sharingId));if(s)return{kind:"share",stageId:s.id,stageSource:"screen",filmstrip:e.filter((t=>t.id!==s.id)),grid:[],inset:null,page:0,pageCount:1,visible:e.map((t=>t.id)),columns:1,rows:1,cap:i}}if(t.pinnedId){const s=e.find((e=>e.id===t.pinnedId));if(s)return{kind:"pin",stageId:s.id,stageSource:s.tracks.some((t=>"screen"===t.source))?"screen":o,filmstrip:e.filter((t=>t.id!==s.id)),grid:[],inset:null,page:0,pageCount:1,visible:e.map((t=>t.id)),columns:1,rows:1,cap:i}}if("speaker"===t.layout){const s=e.find((t=>t.isLocal))?.id??null;let n=t.activeSpeakerId?e.find((e=>e.id===t.activeSpeakerId)):void 0;if(!n||n.id===s){const t=e.filter((t=>t.id!==s));n=t.sort(((t,e)=>e.audioLevel-t.audioLevel))[0]}if(n)return{kind:"speaker",stageId:n.id,stageSource:"camera",filmstrip:e.filter((t=>t.id!==n.id)),grid:[],inset:null,page:0,pageCount:1,visible:e.map((t=>t.id)),columns:1,rows:1,cap:i}}if("direct"===t.mode&&2===e.length){const t=e.find((t=>t.isLocal))??null,s=e.find((t=>!t.isLocal))??null;if(s)return{kind:"direct",stageId:s.id,stageSource:"camera",filmstrip:[],grid:[],inset:t,page:0,pageCount:1,visible:e.map((t=>t.id)),columns:1,rows:1,cap:i}}const r=function(t,e,i){return t.map(((t,e)=>({participant:t,index:e}))).sort(((t,s)=>{const n=t.participant.tracks.some((t=>"screen"===t.source))?1:0,a=s.participant.tracks.some((t=>"screen"===t.source))?1:0;return n!==a?a-n:t.participant.id===e?-1:s.participant.id===e?1:t.participant.speaking!==s.participant.speaking?t.participant.speaking?-1:1:t.participant.id===i?-1:s.participant.id===i?1:t.index-s.index})).map((t=>t.participant))}(e,t.pinnedId,t.activeSpeakerId),{pages:c}=function(t,e,i){if(0===t.length)return{pages:[[]],page:0};const s=[];for(let i=0;i<t.length;i+=e)s.push(t.slice(i,i+e));if(i){const n=t.findIndex((t=>t.id===i));if(n>=e){const i=[...t],[a]=i.splice(n,1);i.unshift(a),s.length=0;for(let t=0;t<i.length;t+=e)s.push(i.slice(t,t+e))}}return{pages:s,page:0}}(r,i,t.participants.find((t=>t.isLocal))?.id??null),l=c[0]??[],h=function(t,e,i){if(t<=1)return{columns:1,rows:1};let s={columns:t,rows:1},n=Number.POSITIVE_INFINITY;const a=16/9;for(let o=1;o<=t;o+=1){const r=Math.ceil(t/o),c=o*r-t,l=Math.abs(Math.log((e>0?e/o:o)/(i>0?i/r:r)/a))+.25*c;l<n&&(n=l,s={columns:o,rows:r})}return s}(l.length,t.containerWidth,t.containerHeight);return{kind:"grid",stageId:null,stageSource:o,filmstrip:[],grid:l,inset:null,page:0,pageCount:c.length,visible:l.map((t=>t.id)),columns:h.columns,rows:h.rows,cap:i}}({mode:t.mode,layout:this.layout,participants:t.participants,activeSpeakerId:t.activeSpeakerId,pinnedId:t.pinnedId,sharingId:t.sharingId,maxTiles:this.maxTiles,containerWidth:this.host.clientWidth||0,containerHeight:this.host.clientHeight||0});this.result=e;const i=e.visible.join(",");i!==this.lastVisibleKey&&(this.lastVisibleKey=i,this.session.setVisibleParticipants(e.visible),this.layoutChange.emit({kind:e.kind,page:e.page,pageCount:e.pageCount,visible:e.visible}))}tile(t,e,i){return M("chatleo-call-tile",{class:i,session:this.session,participant:t,source:e,fit:"screen"===e?"contain":"cover",strings:this.strings})}render(){const t=this.result;if(!t)return M(T,null);const e=t=>this.session?.getState().participants.find((e=>e.id===t));if("grid"===t.kind)return M(T,null,M("div",{class:"grid",part:"grid",style:{"--columns":String(t.columns)}},t.grid.map((t=>this.tile(t,"camera")))));if("direct"===t.kind){const i=e(t.stageId),s=t.inset;return M(T,null,M("div",{class:"stage",part:"stage"},M("div",{class:"main"},i?this.tile(i,"camera"):null),s?M("div",{class:"inset"},this.tile(s,"camera","inset-tile")):null))}const i=e(t.stageId);return M(T,null,M("div",{class:{stage:!0,[t.kind]:!0},part:"stage"},M("div",{class:"main"},i?this.tile(i,t.stageSource):null),t.filmstrip.length>0?M("div",{class:"filmstrip",part:"filmstrip"},t.filmstrip.map((t=>this.tile(t,"camera","strip-tile")))):null))}static get style(){return":host{display:block;min-width:0;min-height:0;width:100%;height:100%;container-type:size}.grid{display:grid;grid-template-columns:repeat(var(--columns, 3), minmax(0, 1fr));gap:8px;padding:8px;width:100%;height:100%;box-sizing:border-box;align-content:center}.stage{position:relative;display:flex;flex-direction:column;width:100%;height:100%;padding:8px;box-sizing:border-box;gap:8px}.main{flex:1;min-height:0}.filmstrip{display:flex;gap:8px;overflow-x:auto;flex:0 0 96px}.filmstrip .strip-tile{width:160px;flex:0 0 auto}.inset{position:absolute;right:20px;bottom:20px;width:min(28%, 220px);aspect-ratio:16 / 9;box-shadow:0 6px 24px rgba(0, 0, 0, 0.3);border-radius:var(--border-radius, 8px);overflow:hidden;cursor:grab}@container (max-width: 600px){.grid{gap:4px;padding:4px}.filmstrip{flex-basis:72px}.filmstrip .strip-tile{width:120px}.inset{width:32%;right:12px;bottom:12px}}@media (prefers-reduced-motion: reduce){.inset{transition:none}}"}},[513,"chatleo-call-stage",{session:[16],layout:[1],maxTiles:[2,"max-tiles"],strings:[16],result:[32]}]);function Os(){"undefined"!=typeof customElements&&["chatleo-call-stage","chatleo-call-agent-indicator","chatleo-call-tile"].forEach((t=>{switch(t){case"chatleo-call-stage":customElements.get(t)||customElements.define(t,Ps);break;case"chatleo-call-agent-indicator":customElements.get(t)||ms();break;case"chatleo-call-tile":customElements.get(t)||As()}}))}Os();const _s=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.resumeAudio=R(this,"resumeAudio"),this.rejoin=R(this,"rejoin")}session;strings;resumeAudio;rejoin;state;unsubscribe;get labels(){return{...yt,...this.strings??{}}}connectedCallback(){this.attach()}disconnectedCallback(){this.unsubscribe?.()}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((t=>t),(t=>{this.state=t})),this.state=this.session.getState())}render(){const t=this.labels,e=this.state;if(!e)return M(T,{hidden:!0});const i=[];return"reconnecting"===e.status&&i.push({tone:"warn",text:t.reconnecting}),"migrating"===e.status&&i.push({tone:"warn",text:t.migrating}),"failed"===e.status&&i.push({tone:"error",text:e.error?.message??t.failed,action:"rejoin"}),"ended"===e.status&&i.push({tone:"muted",text:t.ended}),e.audioBlocked&&i.push({tone:"warn",text:t.audioBlocked,action:"resume"}),e.notice&&i.push({tone:"info",text:e.notice}),e.error&&"failed"!==e.status&&i.push({tone:"error",text:e.error.message}),e.transcriptionRunning&&i.push({tone:"live",text:t.transcriptionRunning}),e.recordingRunning&&i.push({tone:"live",text:t.recordingRunning}),M(T,null,M("div",{class:"live-region","aria-live":"polite","aria-atomic":"true"},i.length>0?i.map((t=>t.text)).join(". "):""),i.map((e=>M("div",{class:{banner:!0,[e.tone]:!0},part:"banner",role:"error"===e.tone?"alert":"status"},M("span",{class:"text"},e.text),"resume"===e.action?M("button",{type:"button",onClick:()=>this.resumeAudio.emit()},t.resumeAudio):null,"rejoin"===e.action?M("button",{type:"button",onClick:()=>this.rejoin.emit()},t.rejoin):null))))}static get style(){return":host{display:block;font-family:var(--font-primary, sans-serif)}.banner{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;font-size:12px;font-weight:600;color:#fff;background:#6b7280}.banner.warn{background:#f59e0b}.banner.error{background:#ef4444}.banner.info{background:#4a86e8}.banner.live{background:#b91c1c}.banner.muted{background:#6b7280}.banner button{border:1px solid rgba(255, 255, 255, 0.7);background:transparent;color:inherit;border-radius:var(--border-radius, 8px);padding:2px 8px;font:inherit;cursor:pointer}.live-region{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}"}},[513,"chatleo-call-status",{session:[16],strings:[16],state:[32]}]);function Ds(){"undefined"!=typeof customElements&&["chatleo-call-status"].forEach((t=>{"chatleo-call-status"===t&&(customElements.get(t)||customElements.define(t,_s))}))}Ds();const Us=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get host(){return this}session;maxLines=200;captions=!1;strings;segments=[];autoScroll=!0;unsubscribe;scrollEl;get labels(){return{...yt,...this.strings??{}}}connectedCallback(){this.attach()}disconnectedCallback(){this.unsubscribe?.()}attach(){this.unsubscribe?.(),this.session&&(this.unsubscribe=this.session.store.subscribe((t=>t.transcript),(t=>{this.segments=t,requestAnimationFrame((()=>this.scrollToBottom()))})),this.segments=this.session.getState().transcript)}scrollToBottom(){this.autoScroll&&this.scrollEl&&(this.scrollEl.scrollTop=this.scrollEl.scrollHeight)}onScroll=()=>{this.scrollEl&&(this.autoScroll=this.scrollEl.scrollHeight-this.scrollEl.scrollTop-this.scrollEl.clientHeight<48)};groups(t){const e=[];for(const i of t){const t=e[e.length-1],s=this.session?.getState().participants.find((t=>t.id===i.participantId)),n=Cs(s,i.participantId);t&&t.participantId===i.participantId?t.segments.push(i):e.push({participantId:i.participantId,name:n,segments:[i]})}return e}render(){const t=this.labels,e=this.segments.slice(-this.maxLines);if(this.captions){const i=e.slice(-2);return M(T,null,M("div",{class:"captions",part:"captions","aria-live":"polite","aria-atomic":"false"},0===i.length?M("span",{class:"empty"},t.emptyTranscript):null,i.map((t=>M("p",{class:{line:!0,interim:!t.final}},M("span",{class:"speaker"},Cs(this.session?.getState().participants.find((e=>e.id===t.participantId)),t.participantId),":")," ",t.text)))))}const i=this.groups(e);return M(T,null,M("div",{class:"panel",part:"panel"},M("div",{class:"scroll",ref:t=>{this.scrollEl=t},onScroll:this.onScroll},0===i.length?M("p",{class:"empty"},t.emptyTranscript):null,i.map((t=>M("div",{class:"group"},M("span",{class:"speaker"},t.name),t.segments.map((t=>M("span",{class:{text:!0,interim:!t.final}},t.text," "))))))),this.autoScroll?null:M("button",{type:"button",class:"jump",onClick:()=>{this.autoScroll=!0,this.scrollToBottom()}},"↓")))}static get style(){return":host{display:block;font-family:var(--font-primary, sans-serif);min-height:0}.panel{position:relative;height:100%;min-height:120px;background:var(--bg-primary, #fff);color:var(--text-primary, #171a1f)}.scroll{height:100%;overflow-y:auto;padding:8px;display:flex;flex-direction:column;gap:8px}.group{display:flex;flex-direction:column;gap:2px}.speaker{font-size:11px;font-weight:700;color:var(--accent-color, #4a86e8)}.text{font-size:13px;line-height:1.4}.text.interim{color:var(--text-secondary, #9095a1);font-style:italic}.empty{font-size:12px;color:var(--text-secondary, #9095a1)}.jump{position:absolute;right:12px;bottom:12px;width:30px;height:30px;border-radius:50%;border:1px solid var(--border-color, #bdc1ca);background:var(--bg-primary, #fff);cursor:pointer}.captions{position:absolute;left:50%;bottom:12px;transform:translateX(-50%);max-width:min(90%, 720px);padding:6px 12px;border-radius:var(--border-radius, 8px);background:rgba(0, 0, 0, 0.7);color:#fff;text-align:center;pointer-events:none}.line{margin:0;font-size:14px;line-height:1.35}.line.interim{opacity:0.7}"}},[513,"chatleo-call-transcript",{session:[16],maxLines:[2,"max-lines"],captions:[4],strings:[16],segments:[32],autoScroll:[32]}]);function zs(){"undefined"!=typeof customElements&&["chatleo-call-transcript"].forEach((t=>{"chatleo-call-transcript"===t&&(customElements.get(t)||customElements.define(t,Us))}))}zs();const Ns=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.callJoined=R(this,"callJoined"),this.callLeft=R(this,"callLeft"),this.callError=R(this,"callError"),this.callStatusChange=R(this,"callStatusChange")}get host(){return this}mode="group";connection;identity;autoJoin=!1;audience=!1;layout="auto";strings;transport;getToken;promoteHandler;demoteHandler;transcriptUrl;session;callJoined;callLeft;callError;callStatusChange;activeSession;status="idle";activeLayout="auto";chatOpen=!0;transcriptOpen=!1;ownsSession=!1;unsubscribers=[];audioEl;returnFocus;get labels(){return vt(this.strings)}componentWillLoad(){this.returnFocus="undefined"!=typeof document?document.activeElement:void 0,this.activeLayout=this.layout,this.session?(this.activeSession=this.session,this.activeSession.setIdentityResolver(this.identity)):(this.ownsSession=!0,this.activeSession=function(t={}){return new us(t)}({identity:this.identity,transport:this.transport,strings:this.strings,logger:console,getToken:this.getToken,promote:this.promoteHandler,demote:this.demoteHandler})),this.attach()}componentDidLoad(){this.init()}disconnectedCallback(){this.unsubscribers.forEach((t=>t())),this.unsubscribers=[],this.ownsSession&&this.activeSession?.leave()}onSessionPropChange(){this.session&&(this.ownsSession=!1,this.activeSession=this.session,this.attach())}onLayoutPropChange(){this.activeLayout=this.layout}onSessionRequest(t){t.stopPropagation(),t.detail.callback(this.activeSession)}async join(t){const e=t??this.connection;if(!e)throw new Error("chatleo-call-room: no connection credentials supplied.");await(this.activeSession?.join(e))}async refreshToken(){await(this.activeSession?.refreshToken())}async leave(){await this.leaveCall()}attach(){this.unsubscribers.forEach((t=>t())),this.unsubscribers=[];const t=this.activeSession;t&&(this.unsubscribers.push(t.store.subscribe((t=>t.status),(t=>this.onStatus(t)))),this.unsubscribers.push(t.on("error",(t=>{this.callError.emit(t)}))),this.unsubscribers.push(t.on("statusChange",(t=>{const{status:e,previous:i}=t;this.callStatusChange.emit({status:e,previous:i})}))),this.onStatus(t.getState().status),this.transcriptUrl&&t.connectTranscript(this.transcriptUrl))}async init(){const t=this.activeSession;t&&(this.connection&&(this.autoJoin||this.audience||"stage"===this.mode)&&(this.audience||this.autoJoin)?await this.joinWithMedia(this.connection,{audio:!this.audience,video:!this.audience}):"idle"===t.getState().status&&await t.prepare())}onStatus(t){const e=this.status;this.status=t,"connected"===t&&"connected"!==e&&(this.callJoined.emit({roomId:this.activeSession?.getState().roomId??"",participantId:this.activeSession?.getState().localParticipantId??""}),this.host.focus?.()),"lobby"!==t&&"connected"!==t||setTimeout((()=>this.host.focus?.()),0)}async joinWithMedia(t,e){const i=this.activeSession;if(!i)return;await i.join(t);const s=i.localParticipant();e.audio&&s?.capabilities.publishAudio&&await i.setMicEnabled(!0),e.video&&s?.capabilities.publishVideo&&await i.setCameraEnabled(!0)}async leaveCall(){await(this.activeSession?.leave()),this.callLeft.emit(),this.returnFocus?.focus?.()}async report(t){try{await t()}catch(t){const e=t.toInfo?.()??{code:"unexpected_error",category:"room",recoverable:!0,message:t?.message??"Something went wrong."};this.callError.emit(e)}}onJoinRequest(t){t.stopPropagation(),this.connection&&this.report((()=>this.joinWithMedia(this.connection,t.detail)))}onToggleMic(t){t.stopPropagation(),this.report((()=>this.activeSession.setMicEnabled(t.detail.enabled)))}onToggleCamera(t){t.stopPropagation(),this.report((()=>this.activeSession.setCameraEnabled(t.detail.enabled)))}onToggleScreenShare(t){t.stopPropagation(),this.report((()=>t.detail.enabled?this.activeSession.startScreenShare():this.activeSession.stopScreenShare()))}onToggleHand(t){t.stopPropagation(),this.report((()=>this.activeSession.setHandRaised(t.detail.raised)))}onToggleChat(t){t.stopPropagation(),this.chatOpen=!this.chatOpen,this.chatOpen&&(this.transcriptOpen=!1)}onToggleTranscript(t){t.stopPropagation(),this.transcriptOpen=!this.transcriptOpen,this.transcriptOpen&&(this.chatOpen=!1)}onToggleLayout(t){t.stopPropagation();const e=["auto","grid","speaker"];this.activeLayout=e[(e.indexOf(this.activeLayout)+1)%e.length]}onPin(t){t.stopPropagation(),this.activeSession?.pin(t.detail.pinned?t.detail.participantId:null)}onLayerChange(t){t.stopPropagation(),this.report((()=>this.activeSession.setLayer(t.detail.trackId,t.detail.layer)))}onDeviceChange(t){t.stopPropagation(),this.report((()=>this.activeSession.selectDevice(t.detail.kind,t.detail.deviceId)))}onPromote(t){t.stopPropagation();const e=this.participant(t.detail.participantId);this.report((()=>this.activeSession.promote(t.detail.participantId,{publishAudio:!0,publishVideo:!0,publishScreen:!0,moderate:!!e?.capabilities.moderate})))}onDemote(t){t.stopPropagation(),this.report((()=>this.activeSession.demote(t.detail.participantId)))}onMuteRemote(t){t.stopPropagation(),this.report((()=>this.activeSession.muteRemote(t.detail.participantId,t.detail.source)))}onRemove(t){t.stopPropagation(),this.report((()=>this.activeSession.remove(t.detail.participantId)))}onResumeAudio(t){t.stopPropagation(),this.audioEl?.resumeAudio(),this.activeSession?.resumeAudio()}onRejoin(t){t.stopPropagation(),this.report((()=>this.activeSession.rejoin()))}onLeave(t){t.stopPropagation(),this.leaveCall()}participant(t){return this.activeSession?.getState().participants.find((e=>e.id===t))}render(){const t=this.activeSession,e=this.labels,i="lobby"===this.status&&!this.audience,s="connected"===this.status||"reconnecting"===this.status||"migrating"===this.status,n=s,a="stage"===this.activeSession?.getState().mode;return M(T,{key:"0665700a4378102caab6a088ae4be3c51036dd56",tabIndex:-1},M("div",{key:"d79cf04ddb0d0aac5b9c23711b9dd1ee07731587",class:{room:!0,[`status-${this.status}`]:!0},part:"room"},M("div",{key:"2bc1af847d197e154f75e00bc473eae7933d8c62",class:"body"},M("main",{key:"f265d55fad07df031fec8903437887d67534664b",class:"stage-area",part:"stage-area"},i?M("slot",{name:"lobby"},M("chatleo-call-lobby",{session:t,strings:this.strings})):null,s?M("chatleo-call-stage",{session:t,layout:this.activeLayout,strings:this.strings}):null,"idle"===this.status||"ended"===this.status?M("slot",{name:"empty"}):null,"connected"!==this.status&&"reconnecting"!==this.status||!this.transcriptOpen?null:M("div",{class:"captions-layer"},M("chatleo-call-transcript",{session:t,captions:!0,strings:this.strings})),M("chatleo-call-status",{key:"66843a8b669c81b39afd4e15e0a0e141177a15b8",session:t,strings:this.strings})),M("aside",{key:"864eb956df9ef5d3c71168f8c209784cbbe55850",class:{side:!0,open:this.chatOpen||this.transcriptOpen},part:"side"},M("div",{key:"2848351ae713e82b6232615df455952f94fb9812",class:"tabs"},M("button",{key:"e284ca8682a63e824c6097f36a47dd8016752451",type:"button",class:{active:this.chatOpen},"aria-pressed":this.chatOpen?"true":"false",onClick:t=>this.onToggleChat(t)},e.chat),M("button",{key:"65cb3bbce8ab18decfbf9849f881a68b9e4c1127",type:"button",class:{active:this.transcriptOpen},"aria-pressed":this.transcriptOpen?"true":"false",onClick:t=>this.onToggleTranscript(t)},e.transcript)),M("div",{key:"065b72d3e57f3b898cffb92a5645a30cdfc9e4a8",class:"panel"},this.chatOpen?M("div",{class:"chat-slot",hidden:!this.chatOpen},M("slot",{name:"chat"})):null,this.transcriptOpen?M("chatleo-call-transcript",{session:t,strings:this.strings}):null,this.chatOpen||this.transcriptOpen||a?null:M("chatleo-call-roster",{session:t,strings:this.strings})),M("div",{key:"73e8d86a8dc1c7050400e7f3a92d5e7368543b21",class:"roster-slot"},a?M("chatleo-call-roster",{session:t,strings:this.strings}):null))),n?M("chatleo-call-controls",{session:t,mode:this.activeSession?.getState().mode??this.mode,layout:this.activeLayout,chatOpen:this.chatOpen,transcriptOpen:this.transcriptOpen,strings:this.strings},M("slot",{name:"controls-start",slot:"start"}),M("slot",{name:"controls-end",slot:"end"})):null,M("chatleo-call-audio",{key:"e7928a204a5bbd02cdb71cf7c776538ad46c74b7",session:t,ref:t=>{this.audioEl=t}})))}static get watchers(){return{session:[{onSessionPropChange:0}],layout:[{onLayoutPropChange:0}]}}static get style(){return":host{display:block;position:relative;width:100%;height:100%;min-height:320px;font-family:var(--font-primary, 'Manrope', sans-serif);color:var(--text-primary, #171a1f);background:var(--bg-primary, #ffffff);--bg-primary:var(--bg-primary, #ffffff);--bg-secondary:var(--bg-secondary, #f3f4f6);--bg-light:var(--bg-light, #e7effc);--text-primary:var(--text-primary, #171a1f);--text-secondary:var(--text-secondary, #9095a1);--border-color:var(--border-color, #bdc1ca);--border-light:var(--border-light, #eeeeee);--accent-color:var(--accent-color, #4a86e8);--accent-hover:var(--accent-hover, #3a7bd8);--border-radius:var(--border-radius, 8px)}:host(:focus-visible){outline:2px solid var(--accent-color);outline-offset:-2px}.room{display:flex;flex-direction:column;width:100%;height:100%;min-height:0;container-type:inline-size}.body{display:flex;flex:1;min-height:0}.stage-area{position:relative;flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--bg-secondary, #f3f4f6)}.stage-area>chatleo-call-stage{flex:1;min-height:0}.captions-layer{position:absolute;left:0;right:0;bottom:0;pointer-events:none}.side{width:clamp(240px, 28%, 360px);min-width:0;border-left:1px solid var(--border-light, #eeeeee);background:var(--bg-primary, #ffffff);display:flex;flex-direction:column;min-height:0}.side:not(.open){width:0;border-left:0;overflow:hidden}.tabs{display:flex;gap:4px;padding:6px;border-bottom:1px solid var(--border-light, #eeeeee)}.tabs button{flex:1;min-height:32px;border:0;border-radius:var(--border-radius, 8px);background:transparent;color:var(--text-secondary, #9095a1);font:inherit;font-size:12px;font-weight:600;cursor:pointer}.tabs button.active{background:var(--bg-secondary, #f3f4f6);color:var(--text-primary, #171a1f)}.tabs button:focus-visible{outline:2px solid var(--accent-color);outline-offset:1px}.panel,.chat-slot,.roster-slot{min-height:0}.panel{flex:1;overflow:auto}.chat-slot{height:100%}.roster-slot{border-top:1px solid var(--border-light, #eeeeee)}chatleo-call-status{flex-shrink:0}@container (max-width: 640px){.body{flex-direction:column}.side{width:100%;height:42%;border-left:0;border-top:1px solid var(--border-light, #eeeeee)}.side:not(.open){height:0}.tabs{position:sticky;top:0;background:var(--bg-primary, #ffffff);z-index:2}}@media (prefers-reduced-motion: reduce){*{transition:none !important;animation:none !important}}"}},[769,"chatleo-call-room",{mode:[1],connection:[16],identity:[16],autoJoin:[4,"auto-join"],audience:[4],layout:[1],strings:[16],transport:[16],getToken:[16],promoteHandler:[16],demoteHandler:[16],transcriptUrl:[1,"transcript-url"],session:[16],activeSession:[32],status:[32],activeLayout:[32],chatOpen:[32],transcriptOpen:[32],join:[64],refreshToken:[64],leave:[64]},[[0,"chatleoCallSessionRequest","onSessionRequest"],[0,"joinRequest","onJoinRequest"],[0,"toggleMic","onToggleMic"],[0,"toggleCamera","onToggleCamera"],[0,"toggleScreenShare","onToggleScreenShare"],[0,"toggleHand","onToggleHand"],[0,"toggleChat","onToggleChat"],[0,"toggleTranscript","onToggleTranscript"],[0,"toggleLayout","onToggleLayout"],[0,"pin","onPin"],[0,"layerChange","onLayerChange"],[0,"deviceChange","onDeviceChange"],[0,"promote","onPromote"],[0,"demote","onDemote"],[0,"muteRemote","onMuteRemote"],[0,"remove","onRemove"],[0,"resumeAudio","onResumeAudio"],[0,"rejoin","onRejoin"],[0,"leave","onLeave"]],{session:[{onSessionPropChange:0}],layout:[{onLayoutPropChange:0}]}]);function $s(){"undefined"!=typeof customElements&&["chatleo-call-room","chatleo-call-agent-indicator","chatleo-call-audio","chatleo-call-controls","chatleo-call-device-select","chatleo-call-lobby","chatleo-call-roster","chatleo-call-stage","chatleo-call-status","chatleo-call-tile","chatleo-call-transcript"].forEach((t=>{switch(t){case"chatleo-call-room":customElements.get(t)||customElements.define(t,Ns);break;case"chatleo-call-agent-indicator":customElements.get(t)||ms();break;case"chatleo-call-audio":customElements.get(t)||gs();break;case"chatleo-call-controls":customElements.get(t)||vs();break;case"chatleo-call-device-select":customElements.get(t)||ks();break;case"chatleo-call-lobby":customElements.get(t)||js();break;case"chatleo-call-roster":customElements.get(t)||Ls();break;case"chatleo-call-stage":customElements.get(t)||Os();break;case"chatleo-call-status":customElements.get(t)||Ds();break;case"chatleo-call-tile":customElements.get(t)||As();break;case"chatleo-call-transcript":customElements.get(t)||zs()}}))}$s();const Hs=ut(class extends c{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.callAccept=R(this,"callAccept"),this.callDecline=R(this,"callDecline")}get host(){return this}callId;conversationId;mode="group";autoJoin=!1;video=!0;connection;credentialsProvider;identity;getToken;promoteHandler;demoteHandler;callEvents;strings;callAccept;callDecline;incoming;roomCredentials;roomMode="group";listeners=[];attachedTarget;connectedCallback(){this.attachEvents(this.callEvents)}disconnectedCallback(){this.detachEvents()}onCallEventsChange(t){this.attachEvents(t)}detachEvents(){if(this.attachedTarget){for(const{type:t,handler:e}of this.listeners)this.attachedTarget.removeEventListener(t,e);this.listeners=[],this.attachedTarget=void 0}}attachEvents(t){if(this.detachEvents(),!t)return;this.attachedTarget=t;const e=(e,i)=>{const s=t=>i(t.detail??{});t.addEventListener(e,s),this.listeners.push({type:e,handler:s})};e("call.ringing",(t=>{this.incoming=t,this.roomMode=t.mode??"direct"})),e("call.accepted",(()=>{this.incoming&&!this.roomCredentials&&this.accept()})),e("call.declined",(()=>{this.incoming=void 0})),e("call.ended",(()=>{this.incoming=void 0,this.roomCredentials=void 0}))}async fetchCredentials(){return this.connection?this.connection:this.credentialsProvider&&this.callId?this.credentialsProvider(this.callId):void 0}async accept(){const t=await this.fetchCredentials();t&&(this.roomCredentials=t,this.roomMode=t.mode,this.callAccept.emit({callId:this.callId??t.roomId}),this.incoming=void 0)}decline(){this.callDecline.emit({callId:this.callId??""}),this.incoming=void 0}async refreshToken(){const t=this.host.shadowRoot?.querySelector("chatleo-call-room");await(t?.refreshToken?.())}render(){if(this.incoming)return M(T,null,M("chatleo-call-incoming",{caller:this.incoming.caller,video:this.incoming.video??this.video,strings:this.strings,onAccept:()=>{this.accept()},onDecline:()=>this.decline()}));const t=this.roomCredentials??this.connection;return t?M(T,null,M("chatleo-call-room",{mode:this.roomCredentials?this.roomMode:this.connection?.mode??this.mode,connection:t,identity:this.identity,autoJoin:this.autoJoin,strings:this.strings,getToken:this.getToken,promoteHandler:this.promoteHandler,demoteHandler:this.demoteHandler},M("slot",{name:"chat",slot:"chat"}),M("slot",{name:"controls-start",slot:"controls-start"}),M("slot",{name:"controls-end",slot:"controls-end"}),M("slot",{name:"empty",slot:"empty"}))):M(T,null,M("slot",{name:"empty"}),M("span",{class:"hint"},this.strings?.incomingCall??yt.incomingCall))}static get watchers(){return{callEvents:[{onCallEventsChange:0}]}}},[769,"chatleo-call-adapter",{callId:[1,"call-id"],conversationId:[1,"conversation-id"],mode:[1],autoJoin:[4,"auto-join"],video:[4],connection:[16],credentialsProvider:[16],identity:[16],getToken:[16],promoteHandler:[16],demoteHandler:[16],callEvents:[16],strings:[16],incoming:[32],roomCredentials:[32],roomMode:[32],refreshToken:[64]},void 0,{callEvents:[{onCallEventsChange:0}]}]);"undefined"!=typeof customElements&&["chatleo-call-adapter","chatleo-call-agent-indicator","chatleo-call-audio","chatleo-call-controls","chatleo-call-device-select","chatleo-call-incoming","chatleo-call-lobby","chatleo-call-room","chatleo-call-roster","chatleo-call-stage","chatleo-call-status","chatleo-call-tile","chatleo-call-transcript"].forEach((t=>{switch(t){case"chatleo-call-adapter":customElements.get(t)||customElements.define(t,Hs);break;case"chatleo-call-agent-indicator":customElements.get(t)||ms();break;case"chatleo-call-audio":customElements.get(t)||gs();break;case"chatleo-call-controls":customElements.get(t)||vs();break;case"chatleo-call-device-select":customElements.get(t)||ks();break;case"chatleo-call-incoming":customElements.get(t)||Es();break;case"chatleo-call-lobby":customElements.get(t)||js();break;case"chatleo-call-room":customElements.get(t)||$s();break;case"chatleo-call-roster":customElements.get(t)||Ls();break;case"chatleo-call-stage":customElements.get(t)||Os();break;case"chatleo-call-status":customElements.get(t)||Ds();break;case"chatleo-call-tile":customElements.get(t)||As();break;case"chatleo-call-transcript":customElements.get(t)||zs()}}));
@@ -0,0 +1 @@
1
+ function e(e,n,t){return(e||"")+(n?` ${n}`:"")+(t?` ${t}`:"")}function n(e){return[...e].sort(((e,n)=>"number"==typeof e.seq&&"number"==typeof n.seq?e.seq-n.seq:"number"==typeof e.seq||"number"==typeof n.seq?"number"==typeof e.seq?-1:1:new Date(e.created_at).getTime()-new Date(n.created_at).getTime())).reduce(((e,n)=>{const t=new Date(n.created_at).toLocaleDateString("en-US",{day:"numeric",month:"short",year:"numeric"}).toUpperCase();return e[t]||(e[t]=[]),e[t].push(n),e}),{})}export{e as f,n as g}
@@ -0,0 +1 @@
1
+ const o=()=>{};export{o as g}
@@ -0,0 +1,3 @@
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],i=t(Object.getPrototypeOf(e),o,!0)||Object.getOwnPropertyDescriptor(e,o);i&&Object.defineProperty(e,o,{get(){return i.get.call(this)},set(t){i.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&&(t.__stencil__getHostRef=()=>e,e.i=t,512&e.o.u&&n(t,e))},i=(t,e)=>e in t,s=(t,e)=>(0,console.error)(t,e),r=new Map,c=new Map,u=new Map,f="undefined"!=typeof window?window:{},a={u:0,p:"",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)},d=t=>Promise.resolve(t),p=(()=>{try{return!!f.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),h=!!p&&(()=>!!f.document&&Object.getOwnPropertyDescriptor(f.document.adoptedStyleSheets,"length").writable)(),v=!1,m=[],y=[],b=()=>{var t;return(null==(t=f.document)?void 0:t.hidden)?setTimeout(g,16):a.raf(g)},w=(t,e)=>n=>{t.push(n),v||(v=!0,e&&4&a.u?j(g):b())},$=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){s(t)}t.length=0},g=()=>{$(m),$(y),(v=m.length>0)&&b()},j=t=>d().then(t),O=w(y,!0);function S(){const t=this.attachShadow({mode:"open"});void 0===e&&(e=null),e&&(h?t.adoptedStyleSheets.push(e):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e])}function k(t){var e,n,o;return null!=(o=null==(n=null==(e=t.head)?void 0:e.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?o:void 0}var E,M=new WeakMap,C=t=>"sc-"+t.h,x=t=>"object"==(t=typeof t)||"function"===t,N=(t,e,...n)=>{let o=null,l=null,i=!1,r=!1;const c=[],u=e=>{for(let n=0;n<e.length;n++)if(o=e[n],Array.isArray(o))u(o);else if(null!=o&&"boolean"!=typeof o){if(i="function"!=typeof t&&!x(o))o+="";else if("function"!=typeof t&&void 0===o.u){s("Invalid vNode child");continue}i&&r?c[c.length-1].v+=o:c.push(i?T(null,o):o),r=i}};if(u(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,P);const f=T(t,null);return f.m=e,c.length>0&&(f.$=c),f.j=l,f},T=(t,e)=>({u:0,O:t,v:null!=e?e:null,S:null,$:null,m:null,j:null}),L={},P={forEach:(t,e)=>t.map(R).forEach(e),map:(t,e)=>t.map(R).map(e).map(D)},R=t=>({vattrs:t.m,vchildren:t.$,vkey:t.j,vname:t.k,vtag:t.O,vtext:t.v}),D=t=>{if("function"==typeof t.vtag){const e={...t.vattrs};return t.vkey&&(e.key=t.vkey),t.vname&&(e.name=t.vname),N(t.vtag,e,...t.vchildren||[])}const e=T(t.vtag,t.vtext);return e.m=t.vattrs,e.$=t.vchildren,e.j=t.vkey,e.k=t.vname,e},A=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},H=(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?t+"":t,U=t=>{var e;return null==(e=o(t))?void 0:e.$hostElement$},W=(t,e)=>{const n=U(t);return{emit:t=>z(n,e,{bubbles:!0,composed:!0,cancelable:!0,detail:t})}},z=(t,e,n)=>{const o=a.ce(e,n);return t.dispatchEvent(o),o},F=(t,e,n,l,s,r)=>{if(n===l)return;let c=i(t,e),u=e.toLowerCase();if("class"===e){const e=t.classList,o=G(n);let i=G(l);{let t=o.filter((t=>t&&!i.includes(t)));e.remove(...t),e.add(...i.filter((t=>t&&!o.includes(t))))}}else if("style"===e){for(const e in n)l&&null!=l[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in l)n&&l[e]===n[e]||(e.includes("-")?t.style.setProperty(e,l[e]):t.style[e]=l[e])}else if("key"===e);else if("ref"===e)l&&it(l,t);else if(c||"o"!==e[0]||"n"!==e[1]){if("a"===e[0]&&e.startsWith("attr:")){const n=e.slice(5);let i;{const e=o(t);if(e&&e.o&&e.o.t){const t=e.o.t[n];t&&t[1]&&(i=t[1])}}return i||(i=n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==l||!1===l?!1===l&&""!==t.getAttribute(i)||t.removeAttribute(i):t.setAttribute(i,!0===l?"":l))}if("p"===e[0]&&e.startsWith("prop:")){const n=e.slice(5);try{t[n]=l}catch(t){}return}{const o=x(l);if((c||o&&null!==l)&&!s)try{if(t.tagName.includes("-"))t[e]!==l&&(t[e]=l);else{const o=null==l?"":l;"list"===e?c=!1:null!=n&&t[e]===o||("function"==typeof t.__lookupSetter__(e)?t[e]=o:t.setAttribute(e,o))}}catch(t){}null==l||!1===l?(!1!==l||""===t.getAttribute(e)||4&r&&!q(e))&&t.removeAttribute(e):(!c||4&r||s)&&!o&&1===t.nodeType&&t.setAttribute(e,l=!0===l?"":l)}}else if(e="-"===e[2]?e.slice(3):i(f,u)?u.slice(2):u[2]+e.slice(3),n||l){const o=e.endsWith(I);e=e.replace(Y,""),n&&a.rel(t,e,n,o),l&&a.ael(t,e,l,o)}},V=new Set(["draggable","contenteditable","spellcheck"]),q=t=>V.has(t)||t.startsWith("aria-"),B=/\s/,G=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(B):[]),I="Capture",Y=RegExp(I+"$"),Z=(t,e,n)=>{const o=11===e.S.nodeType&&e.S.host?e.S.host:e.S,l=t&&t.m||{},i=e.m||{};for(const t of _(Object.keys(l)))t in i||F(o,t,l[t],void 0,n,e.u);for(const t of _(Object.keys(i)))F(o,t,l[t],i[t],n,e.u)};function _(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var J=!1,K=[],Q=[],X=(t,e,n)=>{const o=e.$[n];let l,i,s=0;if(null!=o.v)l=o.S=f.document.createTextNode(o.v);else{if(J||(J="svg"===o.O),!f.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(l=o.S=f.document.createElementNS(J?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",o.O),J&&"foreignObject"===o.O&&(J=!1),Z(null,o,J),o.$){const e="template"===o.O?l.content:l;for(s=0;s<o.$.length;++s)i=X(t,o,s),i&&e.appendChild(i)}"svg"===o.O?J=!1:"foreignObject"===l.tagName&&(J=!0)}return l["s-hn"]=E,l},tt=(t,e,n,o,l,i)=>{let s,r=t;for(r.shadowRoot&&r.tagName===E&&(r=r.shadowRoot),"template"===n.O&&(r=r.content);l<=i;++l)o[l]&&(s=X(null,n,l),s&&(o[l].S=s,st(r,s,e)))},et=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.S;lt(e),t&&t.remove()}}},nt=(t,e,n=!1)=>t.O===e.O&&(n?(n&&!t.j&&e.j&&(t.j=e.j),!0):t.j===e.j),ot=(t,e,n=!1)=>{const o=e.S=t.S,l=t.$,i=e.$,s=e.O,r=e.v;null==r?(Z(t,e,J="svg"===s||"foreignObject"!==s&&J),null!==l&&null!==i?((t,e,n,o,l=!1)=>{let i,s,r=0,c=0,u=0,f=0,a=e.length-1,d=e[0],p=e[a],h=o.length-1,v=o[0],m=o[h];const y="template"===n.O?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(nt(d,v,l))ot(d,v,l),d=e[++r],v=o[++c];else if(nt(p,m,l))ot(p,m,l),p=e[--a],m=o[--h];else if(nt(d,m,l))ot(d,m,l),st(y,d.S,p.S.nextSibling),d=e[++r],m=o[--h];else if(nt(p,v,l))ot(p,v,l),st(y,p.S,d.S),p=e[--a],v=o[++c];else{for(u=-1,f=r;f<=a;++f)if(e[f]&&null!==e[f].j&&e[f].j===v.j){u=f;break}u>=0?(s=e[u],s.O!==v.O?i=X(e&&e[c],n,c):(ot(s,v,l),e[u]=void 0,i=s.S),v=o[++c]):(i=X(e&&e[c],n,c),v=o[++c]),i&&st(d.S.parentNode,i,d.S)}r>a?tt(t,null==o[h+1]?null:o[h+1].S,n,o,c,h):c>h&&et(e,r,a)})(o,l,e,i,n):null!==i?(null!==t.v&&(o.textContent=""),tt(o,null,e,i,0,i.length-1)):!n&&null!==l&&et(l,0,l.length-1),J&&"svg"===s&&(J=!1)):t.v!==r&&(o.data=r)},lt=t=>{t.m&&t.m.ref&&K.push((()=>t.m.ref(null))),t.$&&t.$.map(lt)},it=(t,e)=>{Q.push((()=>t(e)))},st=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),rt=(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()})))}},ct=(t,e)=>{if(t.u|=16,4&t.u)return void(t.u|=512);rt(t,t.C);const n=()=>ut(t,e);if(!e)return O(n);queueMicrotask((()=>{n()}))},ut=(t,e)=>{const n=t.$hostElement$,o=t.i;if(!o)throw 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 e?(t.u|=256,t.N&&(t.N.map((([t,e])=>mt(o,t,e,n))),t.N=void 0),t.T.length&&t.T.forEach((t=>t(n))),l=mt(o,"componentWillLoad",void 0,n)):l=mt(o,"componentWillUpdate",void 0,n),l=ft(l,(()=>mt(o,"componentWillRender",void 0,n))),ft(l,(()=>dt(t,o,e)))},ft=(t,e)=>at(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),at=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,dt=async(t,e,n)=>{var o;const l=t.$hostElement$,i=l["s-rc"];n&&(t=>{const e=t.o,n=t.$hostElement$,o=e.u,l=((t,e)=>{var n,o,l;const i=C(e),s=u.get(i);if(!f.document)return i;if(t=11===t.nodeType?t:f.document,s)if("string"==typeof s){let l,r=M.get(t=t.head||t);if(r||M.set(t,r=new Set),!r.has(i)){l=f.document.createElement("style"),l.textContent=s;const c=null!=(n=a.L)?n:k(f.document);if(null!=c&&l.setAttribute("nonce",c),!(1&e.u))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(p){const e=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(s),h?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.textContent=s+e.textContent:t.prepend(l)}else t.append(l);1&e.u&&t.insertBefore(l,null),4&e.u&&(l.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),r&&r.add(i)}}else{let e=M.get(t);if(e||M.set(t,e=new Set),!e.has(i)){const n=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(s.constructor===n.CSSStyleSheet)o=s;else{o=new n.CSSStyleSheet;for(let t=0;t<s.cssRules.length;t++)o.insertRule(s.cssRules[t].cssText,t)}h?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],e.add(i)}}return i})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&o&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);pt(t,e,l,n),i&&(i.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>ht(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.u|=4,e.length=0)}},pt=(t,e,n,o)=>{try{e=e.render(),t.u&=-17,t.u|=2,((t,e,n=!1)=>{const o=t.$hostElement$,l=t.P||T(null,null),i=(t=>t&&t.O===L)(e)?e:N(null,null,e);if(E=o.tagName,n&&i.m)for(const t of Object.keys(i.m))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(i.m[t]=o[t]);i.O=null,i.u|=4,t.P=i,i.S=l.S=o.shadowRoot||o,ot(l,i,n),K.forEach((t=>t())),K.length=0,Q.forEach((t=>t())),Q.length=0})(t,e,o)}catch(e){s(e,t.$hostElement$)}return null},ht=t=>{const e=t.$hostElement$,n=t.i,o=t.C;mt(n,"componentDidRender",void 0,e),64&t.u?mt(n,"componentDidUpdate",void 0,e):(t.u|=64,yt(e),mt(n,"componentDidLoad",void 0,e),t.R(e),o||vt()),t.D(e),t.M&&(t.M(),t.M=void 0),512&t.u&&j((()=>ct(t,!1))),t.u&=-517},vt=()=>{j((()=>z(f,"appload",{detail:{namespace:"chatleo"}})))},mt=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){s(t,o)}},yt=t=>t.classList.add("hydrated"),bt=(t,e)=>o(t).l.get(e),wt=(t,e,n,l)=>{const i=o(t);if(!i)return;if(!i)throw Error(`Couldn't find host element for "${l.h}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`);const r=i.$hostElement$,c=i.l.get(e),u=i.u,f=i.i;if(n=H(n,l.t[e][0]),!(8&u&&void 0!==c||n===c||Number.isNaN(c)&&Number.isNaN(n))){if(i.l.set(e,n),l.A){const t=l.A[e];t&&t.map((t=>{try{const[[o,l]]=Object.entries(t);(128&u||1&l)&&(f?f[o](n,c,e):i.T.push((()=>{i.i[o](n,c,e)})))}catch(t){s(t,r)}}))}if(2&u){if(f.componentShouldUpdate&&!1===f.componentShouldUpdate(n,c,e)&&!(16&u))return;16&u||ct(i,!1)}}},$t=(e,n,l)=>{var i,s;const r=e.prototype;{e.watchers&&!n.A&&(n.A=A(e.watchers)),e.deserializers&&!n.H&&(n.H=e.deserializers),e.serializers&&!n.U&&(n.U=e.serializers);const c=Object.entries(null!=(i=n.t)?i:{});if(c.map((([e,[i]])=>{if(31&i||2&l&&32&i){const{get:s,set:c}=t(r,e)||{};s&&(n.t[e][0]|=2048),c&&(n.t[e][0]|=4096),(1&l||!s)&&Object.defineProperty(r,e,{get(){{if(!(2048&n.t[e][0]))return bt(this,e);const t=o(this);return t?t.i?t.i[e]:bt(this,e):r[e]}},configurable:!0,enumerable:!0}),Object.defineProperty(r,e,{set(t){const s=o(this);if(s){if(c)return void 0===(32&i?this[e]:s.$hostElement$[e])&&s.l.get(e)&&(t=s.l.get(e)),c.call(this,H(t,i)),void wt(this,e,t=32&i?this[e]:s.$hostElement$[e],n);{if(!(1&l&&4096&n.t[e][0]))return void wt(this,e,t,n);const o=H(t,i);if(s.i){const t=s.i[e];!s.l.get(e)&&t&&s.l.set(e,t),s.i[e]=o,wt(this,e,s.i[e],n)}else s.l.set(e,o)}}}})}else 1&l&&64&i&&Object.defineProperty(r,e,{value(...t){var n;const l=o(this);return null==(n=null==l?void 0:l.W)?void 0:n.then((()=>{var n;return null==(n=l.i)?void 0:n[e](...t)}))}})})),1&l){const t=new Map;r.attributeChangedCallback=function(e,l,i){a.jmp((()=>{var s;const u=t.get(e),f=o(this);if(this.hasOwnProperty(u)&&(i=this[u],delete this[u]),r.hasOwnProperty(u)&&"number"==typeof this[u]&&this[u]==i)return;if(null==u){const t=null==f?void 0:f.u;if(f&&t&&!(8&t)&&i!==l){const o=f.i,r=null==(s=n.A)?void 0:s[e];null==r||r.forEach((n=>{const[[s,r]]=Object.entries(n);null!=o[s]&&(128&t||1&r)&&o[s].call(o,i,l,e)}))}return}const a=c.find((([t])=>t===u)),d=4&(a?a[1][0]:0),p=d&&null===i&&void 0===this[u];d&&(i=null!==i&&"false"!==i);const h=Object.getOwnPropertyDescriptor(r,u);p||i==this[u]||h.get&&!h.set||(this[u]=i)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=n.A)?s:{}),...c.filter((([t,e])=>31&e[0])).map((([e,n])=>{const o=n[1]||e;return t.set(o,e),o}))]))}}return e},gt=async(t,e,n)=>{var o;let l;try{if(!(32&e.u)){if(e.u|=32,e.u&=-1025,n.F){const i=((t,e)=>{var n;const o=t.h.replace(/-/g,"_"),l=t.F;if(!l)return;const i=r.get(l);if(i)return i[o];const u=null!=(n=c.get(l))?n:0,f=[u>0?"s-retry="+u:"",""].filter(Boolean).join("&");
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
3
+ return import(`./${l}.entry.js${f?"?"+f:""}`).then((t=>(c.delete(l),r.set(l,t),t[o])),(t=>{c.set(l,u+1),s(t,e.$hostElement$)}))})(n,e);if(i&&"then"in i){const t=()=>{};l=await i,t()}else l=i;if(!l)throw e.u&=-33,e.V=(null!=(o=e.V)?o:0)+1,e.V<3&&(e.u|=1024),Error(`Constructor for "${n.h}#${e.q}" was not found`);l.isProxied||(n.A=A(l.watchers),n.U=l.serializers,n.H=l.deserializers,$t(l,n,2),l.isProxied=!0);const u=()=>{};e.u|=8;try{new l(e)}catch(e){s(e,t)}e.u&=-9,((t,e)=>{var n;const o=t.i;if(o)for(const[l,[i]]of Object.entries(null!=(n=e.t)?n:{}))if(4096&i&&t.l.has(l)){const e=t.l.get(l);o[l]!==e&&(o[l]=e)}})(e,n),e.u|=128,u(),jt(e.i,t)}else l=t.constructor,customElements.whenDefined(t.localName).then((()=>e.u|=128));if(l&&l.style){let t;"string"==typeof l.style&&(t=l.style);const e=C(n);if(!u.has(e)){const o=()=>{};((t,e,n)=>{let o=u.get(t);p&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,u.set(t,o)})(e,t,!!(1&n.u)),o()}}}const i=e.C,f=()=>ct(e,!0);i&&i["s-rc"]?i["s-rc"].push(f):f()}catch(n){s(n,t),e.M&&(e.M(),e.M=void 0),!e.R||1024&e.u||e.R(t)}},jt=(t,e)=>{mt(t,"connectedCallback",void 0,e)},Ot=(t,e)=>{mt(t,"disconnectedCallback",void 0,e||t)},St=(t,e={})=>{var n;if(!f.document)return void console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");const l=[],i=e.exclude||[],s=f.customElements,r=f.document.head,c=r.querySelector("meta[charset]"),u=f.document.createElement("style"),d=[];let p,h=!0;if(Object.assign(a,e),a.p=new URL(e.resourcesUrl||"./",f.document.baseURI).href,t.map((t=>{t[1].map((e=>{var n,r;const c={u:e[0],h:e[1],t:e[2],B:e[3]};c.t=e[2],c.B=e[3],c.A=A(e[4]),c.U=null!=(n=e[5])?n:{},c.H=null!=(r=e[6])?r:{};const u=c.h,f=class extends HTMLElement{"s-p";"s-rc";hasRegisteredEventListeners=!1;constructor(t){if(super(t),((t,e)=>{const n={u:0,$hostElement$:t,o:e,l:new Map,G:new Map};n.W=new Promise((t=>n.D=t)),n.I=new Promise((t=>n.R=t)),t["s-p"]=[],t["s-rc"]=[],n.T=[];const o=n;t.__stencil__getHostRef=()=>o})(t=this,c),1&c.u)if(t.shadowRoot){if("open"!==t.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.h}! Mode is set to ${t.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else S.call(t,c)}connectedCallback(){const t=o(this);t&&(this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0,kt(this,t,c.B)),p&&(clearTimeout(p),p=null),h?d.push(this):a.jmp((()=>(t=>{if(!(1&a.u)){const e=o(t);if(!e)return;const n=e.o,l=()=>{};if(1&e.u)kt(t,e,n.B),(null==e?void 0:e.i)?jt(e.i,t):1024&e.u?setTimeout((()=>gt(t,e,n)),1e3):(null==e?void 0:e.I)&&e.I.then((()=>jt(e.i,t)));else{e.u|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){rt(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}})),gt(t,e,n)}l()}})(this))))}disconnectedCallback(){a.jmp((()=>(async t=>{if(!(1&a.u)){const e=o(t);(null==e?void 0:e.Y)&&(e.Y.map((t=>t())),e.Y=void 0),(null==e?void 0:e.i)?Ot(e.i,t):(null==e?void 0:e.I)&&e.I.then((()=>Ot(e.i,t)))}M.has(t)&&M.delete(t),t.shadowRoot&&M.has(t.shadowRoot)&&M.delete(t.shadowRoot)})(this))),j((()=>{var t;const e=o(this);if(!e)return;const n=d.findIndex((t=>t===this));n>-1&&d.splice(n,1),(null==(t=null==e?void 0:e.P)?void 0:t.S)instanceof Node&&!e.P.S.isConnected&&delete e.P.S}))}componentOnReady(){var t;return null==(t=o(this))?void 0:t.I}};c.F=t[0],i.includes(u)||s.get(u)||(l.push(u),s.define(u,$t(f,c,1)))}))})),l.length>0&&(u.textContent+=l.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",u.innerHTML.length)){u.setAttribute("data-styles","");const t=null!=(n=a.L)?n:k(f.document);null!=t&&u.setAttribute("nonce",t),r.insertBefore(u,c?c.nextSibling:r.firstChild)}h=!1,d.length?d.map((t=>t.connectedCallback())):a.jmp((()=>p=setTimeout(vt,30)))},kt=(t,e,n)=>{n&&f.document&&n.map((([n,o,l])=>{const i=t,s=Et(e,l),r=Mt(n);a.ael(i,o,s,r),(e.Y=e.Y||[]).push((()=>a.rel(i,o,s,r)))}))},Et=(t,e)=>n=>{var o;try{256&t.u?null==(o=t.i)||o[e](n):(t.N=t.N||[]).push([e,n])}catch(e){s(e,t.$hostElement$)}},Mt=t=>({passive:!!(1&t),capture:!!(2&t)}),Ct=t=>a.L=t;export{St as b,W as c,U as g,N as h,d as p,l as r,Ct as s}
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as a}from"./p-DmL518NK.js";const n=class{constructor(a){t(this,a),this.messageInputSent=e(this,"messageInputSent")}disabled=!1;sendOnModifierEnter=!1;inputValue="";messageInputSent;inputRef;isMac=()=>"undefined"!=typeof navigator&&navigator.platform.toUpperCase().indexOf("MAC")>=0;handleSubmit=t=>{if(t.preventDefault(),this.disabled)return;const e=this.inputValue.trim();e&&(this.messageInputSent.emit(e),this.inputValue="",this.inputRef.value="")};handleKeyPress=t=>{"Enter"===t.key&&(this.sendOnModifierEnter?(this.isMac()?t.metaKey:t.ctrlKey)&&this.handleSubmit(t):this.handleSubmit(t))};handleInput=t=>{this.inputValue=t.target.value};render(){return a("div",{key:"d4696c7c5c3a24901303a7ad4ccb5caa46e5a76c",class:"chat-input-container"},a("div",{key:"bda9a1218853fa285da618b59da61b7e42c872fa",class:"input-wrapper"},a("input",{key:"96d1683a63cdfd3129a895a3dbe583a2d7e19618",ref:t=>this.inputRef=t,type:"text",placeholder:"Write a comment...",class:"chat-input",onKeyPress:this.handleKeyPress,onInput:this.handleInput,disabled:this.disabled}),a("button",{key:"7de82bd11d42e77cf43d49691c1ce1a5cafa31ab",class:"emoji-button"},"😊")),a("div",{key:"63d136df55745b6f5c99a17e670fcff32c28a02f",class:"action-buttons"},a("button",{key:"884b6bb075e46fe72d334720ea18b579c9fd37c0",class:"action-button"},a("svg",{key:"ffbcc860666136d91ae0e7833a22f5ecafb9a83e",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},a("path",{key:"8e1f60338db9d48dff0293c120b17b44ea97eba4",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"}))),a("button",{key:"1abac7331daae09f49faacaab62eb620dcc138b7",class:"action-button"},a("svg",{key:"51ad70231d80fb7ca5543904b530697c528e8490",xmlns:"http://www.w3.org/2000/svg",width:"33",height:"32",viewBox:"0 0 33 32",fill:"none"},a("path",{key:"d606dad20a4ce3b88d6924a3ca9bd035a40fe894",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"}))),a("button",{key:"7e90543be4744853a917661f7ee9ad7d7792ea1c",class:"action-button",onClick:this.handleSubmit},a("svg",{key:"9ca013889d4fec8d45543c54695a6335685b6802",xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},a("path",{key:"078800be3b4eef96e6801cd3b9b4036f5ac6c4e0",d:"M14.214 2.28564L5.64258 9.14279L5.64258 13.1428L7.69972 10.6856",stroke:"#4A86E8","stroke-width":"1.5","stroke-miterlimit":"10"}),a("path",{key:"10da5167e57bf2f5784a8e0b42c12aedcbb4f2e4",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"})))))}};n.style=":host{--input-radius:100px;--button-radius:4px}.chat-input-container{display:flex;align-items:center;gap:16px;padding:16px;border-top:1px solid var(--border-color);background:var(--bg-primary)}.input-wrapper{flex:1;display:flex;align-items:center;gap:8px;background:var(--bg-secondary);border-radius:var(--input-radius);padding:8px 16px}.chat-input{flex:1;border:none;outline:none;background:transparent;font-family:var(--font-primary);font-weight:400;font-size:14px;line-height:1.6;color:var(--text-primary)}.chat-input::placeholder{color:var(--text-secondary)}.emoji-button{border:none;background:transparent;cursor:pointer;font-size:16px;padding:0;display:flex;align-items:center;justify-content:center}.action-buttons{display:flex;gap:0}.action-button{width:32px;height:32px;border:none;background:transparent;border-radius:var(--button-radius);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:14px;transition:background-color var(--transition-duration) ease}.action-button:hover{background:var(--bg-secondary)}";export{n as chatleo_chat_input}
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const globalScripts = () => {};
4
+
5
+ exports.globalScripts = globalScripts;