rio-assist-widget 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rio-assist.js +71 -49
- package/index.html +9 -17
- package/package.json +1 -1
- package/src/components/conversations-panel/conversations-panel.styles.ts +300 -294
- package/src/components/conversations-panel/conversations-panel.template.ts +184 -184
- package/src/components/fullscreen/fullscreen.styles.ts +185 -178
- package/src/components/mini-panel/mini-panel.styles.ts +346 -337
- package/src/components/mini-panel/mini-panel.template.ts +1 -1
- package/src/components/rio-assist/rio-assist.ts +281 -255
package/dist/rio-assist.js
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const N=globalThis,D=N.ShadowRoot&&(N.ShadyCSS===void 0||N.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,j=Symbol(),
|
|
5
|
+
*/const N=globalThis,D=N.ShadowRoot&&(N.ShadyCSS===void 0||N.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,j=Symbol(),K=new WeakMap;let Z=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==j)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(D&&e===void 0){const s=t!==void 0&&t.length===1;s&&(e=K.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&K.set(t,e))}return e}toString(){return this.cssText}};const we=n=>new Z(typeof n=="string"?n:n+"",void 0,j),I=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((s,i,o)=>s+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new Z(t,n,j)},xe=(n,e)=>{if(D)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const s=document.createElement("style"),i=N.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=t.cssText,n.appendChild(s)}},W=D?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return we(t)})(n):n;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:Ce,defineProperty:Se,getOwnPropertyDescriptor:ye,getOwnPropertyNames:Ue,getOwnPropertySymbols:Ee,getPrototypeOf:Ie}=Object,b=globalThis,J=b.trustedTypes,$e=J?J.emptyScript:"",H=b.reactiveElementPolyfillSupport,$=(n,e)=>n,V={toAttribute(n,e){switch(e){case Boolean:n=n?$e:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},ee=(n,e)=>!Ce(n,e),te={attribute:!0,type:String,converter:V,reflect:!1,useDefault:!1,hasChanged:ee};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),b.litPropertyMetadata??(b.litPropertyMetadata=new WeakMap);let U=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=te){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&Se(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:
|
|
9
|
+
*/const{is:Ce,defineProperty:Se,getOwnPropertyDescriptor:ye,getOwnPropertyNames:Ue,getOwnPropertySymbols:Ee,getPrototypeOf:Ie}=Object,b=globalThis,J=b.trustedTypes,$e=J?J.emptyScript:"",H=b.reactiveElementPolyfillSupport,$=(n,e)=>n,V={toAttribute(n,e){switch(e){case Boolean:n=n?$e:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},ee=(n,e)=>!Ce(n,e),te={attribute:!0,type:String,converter:V,reflect:!1,useDefault:!1,hasChanged:ee};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),b.litPropertyMetadata??(b.litPropertyMetadata=new WeakMap);let U=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=te){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);i!==void 0&&Se(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:o}=ye(this.prototype,e)??{get(){return this[t]},set(r){this[t]=r}};return{get:i,set(r){const c=i==null?void 0:i.call(this);o==null||o.call(this,r),this.requestUpdate(e,c,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??te}static _$Ei(){if(this.hasOwnProperty($("elementProperties")))return;const e=Ie(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty($("properties"))){const t=this.properties,s=[...Ue(t),...Ee(t)];for(const i of s)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[s,i]of t)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const i of s)t.unshift(W(i))}else e!==void 0&&t.push(W(e));return t}static _$Eu(e,t){const s=t.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xe(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var s;return(s=t.hostConnected)==null?void 0:s.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var s;return(s=t.hostDisconnected)==null?void 0:s.call(t)})}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){var o;const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(i!==void 0&&s.reflect===!0){const r=(((o=s.converter)==null?void 0:o.toAttribute)!==void 0?s.converter:V).toAttribute(t,s.type);this._$Em=e,r==null?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){var o,r;const s=this.constructor,i=s._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const c=s.getPropertyOptions(i),a=typeof c.converter=="function"?{fromAttribute:c.converter}:((o=c.converter)==null?void 0:o.fromAttribute)!==void 0?c.converter:V;this._$Em=i;const h=a.fromAttribute(t,c.type);this[i]=h??((r=this._$Ej)==null?void 0:r.get(i))??h,this._$Em=null}}requestUpdate(e,t,s){var i;if(e!==void 0){const o=this.constructor,r=this[e];if(s??(s=o.getPropertyOptions(e)),!((s.hasChanged??ee)(r,t)||s.useDefault&&s.reflect&&r===((i=this._$Ej)==null?void 0:i.get(e))&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,t,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:o},r){s&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,r??t??this[e]),o!==!0||r!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[o,r]of this._$Ep)this[o]=r;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[o,r]of i){const{wrapped:c}=r,a=this[o];c!==!0||this._$AL.has(o)||a===void 0||this.C(o,void 0,r,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(s=this._$EO)==null||s.forEach(i=>{var o;return(o=i.hostUpdate)==null?void 0:o.call(i)}),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};U.elementStyles=[],U.shadowRootOptions={mode:"open"},U[$("elementProperties")]=new Map,U[$("finalized")]=new Map,H==null||H({ReactiveElement:U}),(b.reactiveElementVersions??(b.reactiveElementVersions=[])).push("2.1.1");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
13
|
*/const R=globalThis,Q=R.trustedTypes,se=Q?Q.createPolicy("lit-html",{createHTML:n=>n}):void 0,ie="$lit$",m=`lit$${Math.random().toFixed(9).slice(2)}$`,ne="?"+m,Re=`<${ne}>`,x=document,B=()=>x.createComment(""),_=n=>n===null||typeof n!="object"&&typeof n!="function",F=Array.isArray,Be=n=>F(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",X=`[
|
|
14
|
-
\f\r]`,k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),ae=/'/g,le=/"/g,ce=/^(?:script|style|textarea|title)$/i,_e=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),u=_e(1),v=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),he=new WeakMap,S=x.createTreeWalker(x,129);function de(n,e){if(!F(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return se!==void 0?se.createHTML(e):e}const ke=(n,e)=>{const t=n.length-1,s=[];let i,
|
|
14
|
+
\f\r]`,k=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,oe=/-->/g,re=/>/g,C=RegExp(`>|${X}(?:([^\\s"'>=/]+)(${X}*=${X}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ae=/'/g,le=/"/g,ce=/^(?:script|style|textarea|title)$/i,_e=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),u=_e(1),v=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),he=new WeakMap,S=x.createTreeWalker(x,129);function de(n,e){if(!F(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return se!==void 0?se.createHTML(e):e}const ke=(n,e)=>{const t=n.length-1,s=[];let i,o=e===2?"<svg>":e===3?"<math>":"",r=k;for(let c=0;c<t;c++){const a=n[c];let h,p,d=-1,f=0;for(;f<a.length&&(r.lastIndex=f,p=r.exec(a),p!==null);)f=r.lastIndex,r===k?p[1]==="!--"?r=oe:p[1]!==void 0?r=re:p[2]!==void 0?(ce.test(p[2])&&(i=RegExp("</"+p[2],"g")),r=C):p[3]!==void 0&&(r=C):r===C?p[0]===">"?(r=i??k,d=-1):p[1]===void 0?d=-2:(d=r.lastIndex-p[2].length,h=p[1],r=p[3]===void 0?C:p[3]==='"'?le:ae):r===le||r===ae?r=C:r===oe||r===re?r=k:(r=C,i=void 0);const w=r===C&&n[c+1].startsWith("/>")?" ":"";o+=r===k?a+Re:d>=0?(s.push(h),a.slice(0,d)+ie+a.slice(d)+m+w):a+m+(d===-2?c:w)}return[de(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class M{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let o=0,r=0;const c=e.length-1,a=this.parts,[h,p]=ke(e,t);if(this.el=M.createElement(h,s),S.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=S.nextNode())!==null&&a.length<c;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(ie)){const f=p[r++],w=i.getAttribute(d).split(m),O=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:O[2],strings:w,ctor:O[1]==="."?Te:O[1]==="?"?Pe:O[1]==="@"?Ne:L}),i.removeAttribute(d)}else d.startsWith(m)&&(a.push({type:6,index:o}),i.removeAttribute(d));if(ce.test(i.tagName)){const d=i.textContent.split(m),f=d.length-1;if(f>0){i.textContent=Q?Q.emptyScript:"";for(let w=0;w<f;w++)i.append(d[w],B()),S.nextNode(),a.push({type:2,index:++o});i.append(d[f],B())}}}else if(i.nodeType===8)if(i.data===ne)a.push({type:2,index:o});else{let d=-1;for(;(d=i.data.indexOf(m,d+1))!==-1;)a.push({type:7,index:o}),d+=m.length-1}o++}}static createElement(e,t){const s=x.createElement("template");return s.innerHTML=e,s}}function E(n,e,t=n,s){var r,c;if(e===v)return e;let i=s!==void 0?(r=t._$Co)==null?void 0:r[s]:t._$Cl;const o=_(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==o&&((c=i==null?void 0:i._$AO)==null||c.call(i,!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,s)),s!==void 0?(t._$Co??(t._$Co=[]))[s]=i:t._$Cl=i),i!==void 0&&(e=E(n,i._$AS(n,e.values),i,s)),e}class Me{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=((e==null?void 0:e.creationScope)??x).importNode(t,!0);S.currentNode=i;let o=S.nextNode(),r=0,c=0,a=s[0];for(;a!==void 0;){if(r===a.index){let h;a.type===2?h=new T(o,o.nextSibling,this,e):a.type===1?h=new a.ctor(o,a.name,a.strings,this,e):a.type===6&&(h=new Qe(o,this,e)),this._$AV.push(h),a=s[++c]}r!==(a==null?void 0:a.index)&&(o=S.nextNode(),r++)}return S.currentNode=x,i}p(e){let t=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class T{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=E(this,e,t),_(e)?e===A||e==null||e===""?(this._$AH!==A&&this._$AR(),this._$AH=A):e!==this._$AH&&e!==v&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Be(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==A&&_(this._$AH)?this._$AA.nextSibling.data=e:this.T(x.createTextNode(e)),this._$AH=e}$(e){var o;const{values:t,_$litType$:s}=e,i=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=M.createElement(de(s.h,s.h[0]),this.options)),s);if(((o=this._$AH)==null?void 0:o._$AD)===i)this._$AH.p(t);else{const r=new Me(i,this),c=r.u(this.options);r.p(t),this.T(c),this._$AH=r}}_$AC(e){let t=he.get(e.strings);return t===void 0&&he.set(e.strings,t=new M(e)),t}k(e){F(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const o of e)i===t.length?t.push(s=new T(this.O(B()),this.O(B()),this,this.options)):s=t[i],s._$AI(o),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,t);e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class L{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,o){this.type=1,this._$AH=A,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A}_$AI(e,t=this,s,i){const o=this.strings;let r=!1;if(o===void 0)e=E(this,e,t,0),r=!_(e)||e!==this._$AH&&e!==v,r&&(this._$AH=e);else{const c=e;let a,h;for(e=o[0],a=0;a<o.length-1;a++)h=E(this,c[s+a],t,a),h===v&&(h=this._$AH[a]),r||(r=!_(h)||h!==this._$AH[a]),h===A?e=A:e!==A&&(e+=(h??"")+o[a+1]),this._$AH[a]=h}r&&!i&&this.j(e)}j(e){e===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Te extends L{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===A?void 0:e}}class Pe extends L{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==A)}}class Ne extends L{constructor(e,t,s,i,o){super(e,t,s,i,o),this.type=5}_$AI(e,t=this){if((e=E(this,e,t,0)??A)===v)return;const s=this._$AH,i=e===A&&s!==A||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,o=e!==A&&(s===A||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class Qe{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){E(this,e)}}const z=R.litHtmlPolyfillSupport;z==null||z(M,T),(R.litHtmlVersions??(R.litHtmlVersions=[])).push("3.3.1");const Le=(n,e,t)=>{const s=(t==null?void 0:t.renderBefore)??e;let i=s._$litPart$;if(i===void 0){const o=(t==null?void 0:t.renderBefore)??null;s._$litPart$=i=new T(e.insertBefore(B(),o),o,void 0,t??{})}return i._$AI(n),i};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const y=globalThis;let P=class extends U{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=
|
|
19
|
+
*/const y=globalThis;let P=class extends U{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Le(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return v}};P._$litElement$=!0,P.finalized=!0,(ve=y.litElementHydrateSupport)==null||ve.call(y,{LitElement:P});const G=y.litElementPolyfillSupport;G==null||G({LitElement:P}),(y.litElementVersions??(y.litElementVersions=[])).push("4.2.1");const Ye=I`
|
|
20
20
|
.floating-button {
|
|
21
21
|
position: absolute;
|
|
22
22
|
pointer-events: auto;
|
|
@@ -227,30 +227,35 @@
|
|
|
227
227
|
width: 100%;
|
|
228
228
|
display: flex;
|
|
229
229
|
flex-direction: column;
|
|
230
|
-
gap:
|
|
230
|
+
gap: 12px;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
.message {
|
|
234
234
|
border-radius: 16px;
|
|
235
235
|
border: 1px solid #e4eaee;
|
|
236
|
-
padding:
|
|
236
|
+
padding: 10px 16px;
|
|
237
237
|
max-width: 90%;
|
|
238
238
|
background: #fff;
|
|
239
239
|
color: #1f2f36;
|
|
240
240
|
font-size: 15px;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
.message p {
|
|
244
|
+
margin: 0;
|
|
245
|
+
line-height: 1.35;
|
|
246
|
+
}
|
|
247
|
+
|
|
243
248
|
.message--user {
|
|
244
249
|
align-self: flex-end;
|
|
245
|
-
background: #
|
|
246
|
-
border-color: #
|
|
247
|
-
color: #
|
|
250
|
+
background: #e5ebf0;
|
|
251
|
+
border-color: #cfd6dc;
|
|
252
|
+
color: #1f2f36;
|
|
253
|
+
padding: 8px 10px;
|
|
248
254
|
}
|
|
249
255
|
|
|
250
256
|
.message time {
|
|
251
257
|
display: block;
|
|
252
258
|
font-size: 11px;
|
|
253
|
-
margin-top: 6px;
|
|
254
259
|
color: #8a98a4;
|
|
255
260
|
text-align: right;
|
|
256
261
|
}
|
|
@@ -260,6 +265,10 @@
|
|
|
260
265
|
opacity: 0.75;
|
|
261
266
|
}
|
|
262
267
|
|
|
268
|
+
.message--user time {
|
|
269
|
+
margin-top: 3px;
|
|
270
|
+
}
|
|
271
|
+
|
|
263
272
|
.panel-footer {
|
|
264
273
|
width: 100%;
|
|
265
274
|
display: flex;
|
|
@@ -566,13 +575,20 @@
|
|
|
566
575
|
display: flex;
|
|
567
576
|
flex-direction: column;
|
|
568
577
|
align-items: center;
|
|
569
|
-
padding: 36px
|
|
578
|
+
padding: 36px 32px 18px;
|
|
579
|
+
width: 100%;
|
|
580
|
+
flex: 1;
|
|
581
|
+
min-height: 0;
|
|
582
|
+
overflow: hidden;
|
|
583
|
+
max-width: 1400px;
|
|
584
|
+
margin: 0 auto;
|
|
570
585
|
}
|
|
571
586
|
|
|
572
587
|
.fullscreen-chat .panel-body {
|
|
573
588
|
max-width: 920px;
|
|
574
589
|
width: 100%;
|
|
575
|
-
padding: 12px
|
|
590
|
+
padding: 12px 32px 12px;
|
|
591
|
+
margin: 0 auto;
|
|
576
592
|
}
|
|
577
593
|
|
|
578
594
|
.fullscreen-chat .panel-footer {
|
|
@@ -690,6 +706,7 @@
|
|
|
690
706
|
flex-direction: column;
|
|
691
707
|
gap: 8px;
|
|
692
708
|
min-height: 0;
|
|
709
|
+
box-sizing: border-box;
|
|
693
710
|
}
|
|
694
711
|
|
|
695
712
|
.conversation-list-wrapper {
|
|
@@ -707,15 +724,21 @@
|
|
|
707
724
|
.conversations-panel--sidebar .conversation-list {
|
|
708
725
|
width: 100%;
|
|
709
726
|
padding-left: 16px;
|
|
710
|
-
padding-right:
|
|
727
|
+
padding-right: 14px;
|
|
711
728
|
overflow-y: auto;
|
|
712
729
|
min-height: 0;
|
|
730
|
+
scrollbar-width: none;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
.conversations-panel--sidebar .conversation-list::-webkit-scrollbar {
|
|
734
|
+
width: 0;
|
|
735
|
+
height: 0;
|
|
713
736
|
}
|
|
714
737
|
|
|
715
738
|
.conversation-scrollbar {
|
|
716
739
|
position: absolute;
|
|
717
740
|
top: 8px;
|
|
718
|
-
right:
|
|
741
|
+
right: 8px;
|
|
719
742
|
width: 8px;
|
|
720
743
|
height: calc(100% - 8px);
|
|
721
744
|
border-radius: 999px;
|
|
@@ -843,27 +866,26 @@
|
|
|
843
866
|
|
|
844
867
|
.new-conversation-cta__button {
|
|
845
868
|
width: 100%;
|
|
846
|
-
height:
|
|
847
|
-
border-radius:
|
|
869
|
+
height: 34px;
|
|
870
|
+
border-radius: 4px;
|
|
848
871
|
border: 1px solid #30b4c0;
|
|
849
872
|
background: #fff;
|
|
850
|
-
color: #
|
|
873
|
+
color: #30b4c0;
|
|
851
874
|
font-family: 'Source Sans Pro', 'Inter', sans-serif;
|
|
852
|
-
font-size:
|
|
853
|
-
font-weight:
|
|
875
|
+
font-size: 14px;
|
|
876
|
+
font-weight: 500;
|
|
854
877
|
display: inline-flex;
|
|
855
878
|
align-items: center;
|
|
856
879
|
justify-content: center;
|
|
857
|
-
gap:
|
|
858
|
-
padding:
|
|
859
|
-
box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04);
|
|
880
|
+
gap: 8px;
|
|
881
|
+
padding: 8px 12px;
|
|
860
882
|
cursor: pointer;
|
|
861
883
|
transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
|
|
862
884
|
}
|
|
863
885
|
|
|
864
886
|
.new-conversation-cta__button img {
|
|
865
|
-
width:
|
|
866
|
-
height:
|
|
887
|
+
width: 24px;
|
|
888
|
+
height: 24px;
|
|
867
889
|
}
|
|
868
890
|
|
|
869
891
|
.new-conversation-cta__button:disabled,
|
|
@@ -891,7 +913,7 @@
|
|
|
891
913
|
border-radius: 999px;
|
|
892
914
|
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
893
915
|
}
|
|
894
|
-
`,
|
|
916
|
+
`,Ye,Oe,De,je];/**
|
|
895
917
|
* @license
|
|
896
918
|
* Copyright 2017 Google LLC
|
|
897
919
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -899,7 +921,7 @@
|
|
|
899
921
|
* @license
|
|
900
922
|
* Copyright 2018 Google LLC
|
|
901
923
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
902
|
-
*/const g=ue(class extends Ae{constructor(n){var e;if(super(n),n.type!==pe.ATTRIBUTE||n.name!=="class"||((e=n.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(n){return" "+Object.keys(n).filter(e=>n[e]).join(" ")+" "}update(n,[e]){var s,i;if(this.st===void 0){this.st=new Set,n.strings!==void 0&&(this.nt=new Set(n.strings.join(" ").split(/\s/).filter(
|
|
924
|
+
*/const g=ue(class extends Ae{constructor(n){var e;if(super(n),n.type!==pe.ATTRIBUTE||n.name!=="class"||((e=n.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(n){return" "+Object.keys(n).filter(e=>n[e]).join(" ")+" "}update(n,[e]){var s,i;if(this.st===void 0){this.st=new Set,n.strings!==void 0&&(this.nt=new Set(n.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(const o in e)e[o]&&!((s=this.nt)!=null&&s.has(o))&&this.st.add(o);return this.render(e)}const t=n.element.classList;for(const o of this.st)o in e||(t.remove(o),this.st.delete(o));for(const o in e){const r=!!e[o];r===this.st.has(o)||(i=this.nt)!=null&&i.has(o)||(r?(t.add(o),this.st.add(o)):(t.remove(o),this.st.delete(o)))}return v}}),Ve=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIRSURBVHgB7Ze/T8JAFMcfxMVFq5OaGBsTJxccXEn/AAdGNvE/8C9QjP+AOybippuDDrpQdCT+ijpIRJowwICCMZFBk/O99iANob+urS73SV5ee717/XL37l0BkEgkklhJQAQwxhR0isPjbiKR6IIggQSiEA1dBm0BLcVFKT6HG9xIbBntBIUbEBUobptFSwctA1GAgTZZPJBIFcKCQeosPg7c3j3mQ5yG7gPtkDcZDl37+aiClaMq+EOD/4B+mN+Zd4vjuYuZVUIomVWwZmjSoSvNMu1QA02nHcqs/CqBx2xiX7FyRy9gYvlHyb/OY2henUEUFm5zkEiFxym5dXTTkHQRp8HQ0jROK/BcOB/cv93UzPtW+XFUCBKX49f3IEgySOfGWQWq+xeDexL3enwFd7tHTkP6p4zwURdIoJ1es2PO4Ex6Gb4/e+Z1HAgLbF+/mH5+bdX0Lf0B4kBYYD/vqgVryVuXTyCI6/KLz+BtDcZnp9CmYWJpDr6a76YJ4LqBhAS2Md9+MO8Ws2lY2cqannDYzV4UQQRmFemwZHisPYfneQiDV4H1oG6LU7e1UwHXmVVnw4FBFLQiCw4JUHmMnK09B3HAhY5apjwXkGHWmZtitg9Q3tYJI9Dze5CgPz0YfLgcbGB70WkMX8IShES0zLiKI/C5jm4H/gpbLuUCjsvHnoNh4SIpF1MgkUgkkkD8AgAi3WKqFnrYAAAAAElFTkSuQmCC",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,Fe=n=>u`
|
|
903
925
|
<button
|
|
904
926
|
class="floating-button"
|
|
905
927
|
style="background:${n.accentColor}"
|
|
@@ -913,11 +935,11 @@
|
|
|
913
935
|
* @license
|
|
914
936
|
* Copyright 2018 Google LLC
|
|
915
937
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
916
|
-
*/const ge="important",Xe=" !"+ge,ze=ue(class extends Ae{constructor(n){var e;if(super(n),n.type!==pe.ATTRIBUTE||n.name!=="style"||((e=n.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((e,t)=>{const s=n[t];return s==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(n,[e]){const{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const s of this.ft)e[s]==null&&(this.ft.delete(s),s.includes("-")?t.removeProperty(s):t[s]=null);for(const s in e){const i=e[s];if(i!=null){this.ft.add(s);const
|
|
938
|
+
*/const ge="important",Xe=" !"+ge,ze=ue(class extends Ae{constructor(n){var e;if(super(n),n.type!==pe.ATTRIBUTE||n.name!=="style"||((e=n.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((e,t)=>{const s=n[t];return s==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(n,[e]){const{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const s of this.ft)e[s]==null&&(this.ft.delete(s),s.includes("-")?t.removeProperty(s):t[s]=null);for(const s in e){const i=e[s];if(i!=null){this.ft.add(s);const o=typeof i=="string"&&i.endsWith(Xe);s.includes("-")||o?t.setProperty(s,o?i.slice(0,-11):i,o?ge:""):t[s]=i}}return v}}),Ge=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADdSURBVHgB5ZQxCsJAEEX/rsbaI3gEvYE22ppO7DyCJ1BvoCdIFSNBGFOIaBBzg1whR0gpqLsuSWHnBBKI4G+mefyB+Z8B6pBD1C7KCg7wgusCSi0Bndxh9Wb2IP3GS84wN8t2d1rqMeZw3hCIMjuIVEorQhXyKOw7dCt8x98Wm7JPl+4TYiGho4k93HA8G8oLILN1rCHW2/25fMom3U8YDbCSPKAH0CrQwHxqjw74D7n+sevRqVOEZW+4o5Ck1Yo1mrFrKlTa0ISRVcVUpw2F8oZGq3yIpLLnUOtjeAMX/z7Yit+o3QAAAABJRU5ErkJggg==",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,qe=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADJSURBVHgBvZPdCcIwFIVPqvjcETpCnUDzrA86ghOIG+gGbqIv4mPjBhmhI/goFhNv2qpNQfIjeCCQhHu++0MC/CgWEpwfihQjLHCHkEteBgHyc5FBsQIaGR2vqPTYQBJfAG5k0rQapRhgajZOgMmcny5rymaycrqStEo8IJwtWGUztpWzya6eA1XgnEGv51Z6I+d8341L/M1UdoVjP5b5mzV/lf0VEGq2ADHmNyDWbNQMUdGjiDB/ALa8zUbDFiOg9Kredz7KX/QESDR2d7Kg6IcAAAAASUVORK5CYII=",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,Ke=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADoSURBVHgBpZLfDYIwEMavqImPjOAIdQP6bIw6AhM4giMYR3ACEhOegQ3qBh2hvplIOItG6NXKn/glbY6745e7DwD+FPMl+SXbwgRCkqxAybXI3d6pDwAB2wNCRJNYmCvyTsCTLIQZS+whzAmdXm2ObJ4eGMudUO8J5qa5RHudK/jFHCD1gKfFARAX0CeGJ7kSr2moB1gtTXXTC6jg/AkDp6RbGApz519xrRKUH4BtoUu1eX5AMAig6SvjpboAEvqEePsNCKzxmPUz0ZisQD/j3RRnDeHYFqzYMZoAjLuap1kMXWID1hyjJ+SZQp3ORCa/AAAAAElFTkSuQmCC",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,Ze=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAF+SURBVHgBxZNNTsMwEIVnnBAqVuEG6Q16A8INeoOSFXRFkEpFVqRCaquqi7CA0hXhBNATUE4ANyBHyA4aKg+OU0QgxgKExNvkx8+fx89jgD8S6gb98NK2rKcdALZFCLacwOkuYxBHQTv5FqhzMnGZCdfCYqvGOWA4DnZ7b99MZTocnTWYibcFhHoMqD4K9jBbrG8SkCcsifgXdvrnvrai7uDiUTwcYd4eBu355/GjwcThAPdEAC9ZrR6FXlqpqNufNnOIWCFWQXIN83w4nCKiba09+8qtEZJblEpXoFG2UYukH6ChBCFREe4CEh0oOvBS6V+dZjVsKgDcooYO5Iucyt8VEGcwlzxk+6CRCawlfQSxEjSWAeODCNvtDKbHKojsMXH84jUxVgtXjj+fvDJJiTBjvsQZY8uEc9NBgzcZYquo4r09UAcRmPSLzs4b0iu3B2ogvVHQDkXzuZyDK5wOEaYGoxtVf6EOAj+QDBuN5azYxu8gH5Rf1PIl/De9AhTgnL0rAocOAAAAAElFTkSuQmCC",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,We=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADhSURBVHgB7ZbdCYNAEIRnJb6nBEu4ErSAEK0gLaSUdJAS8gt5vKQDO4gd6HtAc0YhEm4NOQUJ7AcnuHMrI7cMBwjCP6N2el4vDMCDI+qoY/h0NytXJx3CEWcDpjM2z+bviVZwxN3ASIgBMTC5gRkntAHTFzJvjVAHUsBtTJMo4zSyFV8h49EW/QZ+o6qidBFdP8v2I+iGzFgwYWU3UGKPsSmrg61M3P6vM+BjY9qXzYv5+ANr8BRmDgqbwA5h21BwujrrjkZ5moQZHJAcEANiwN1AN6zK6oYpUBcdDL0VC8ITASg13Rg8meYAAAAASUVORK5CYII=",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,fe=(n,e={})=>{const t=e.variant??"drawer",s=t==="sidebar",i=s||n.showConversations;return u`
|
|
917
939
|
<div
|
|
918
940
|
class=${g({"conversations-panel":!0,"conversations-panel--open":i,"conversations-panel--sidebar":s})}
|
|
919
941
|
aria-hidden=${!i}
|
|
920
|
-
@pointerdown=${
|
|
942
|
+
@pointerdown=${o=>n.handleConversationsPanelPointer(o)}
|
|
921
943
|
>
|
|
922
944
|
<div
|
|
923
945
|
class=${g({"conversations-panel__surface":!0,"conversations-panel__surface--sidebar":s})}
|
|
@@ -943,37 +965,37 @@
|
|
|
943
965
|
`:null,i=u`
|
|
944
966
|
<div
|
|
945
967
|
class=${g({"conversation-list":!0,"conversation-list--sidebar":t})}
|
|
946
|
-
@scroll=${t?
|
|
968
|
+
@scroll=${t?o=>n.handleConversationListScroll(o):null}
|
|
947
969
|
>
|
|
948
|
-
${n.filteredConversations.map(
|
|
970
|
+
${n.filteredConversations.map(o=>{const r=n.conversationMenuId===o.id;return u`
|
|
949
971
|
<div class="conversation-item">
|
|
950
972
|
<div class="conversation-item__text">
|
|
951
|
-
${
|
|
973
|
+
${o.title}
|
|
952
974
|
</div>
|
|
953
975
|
<button
|
|
954
976
|
class="conversation-menu-button"
|
|
955
977
|
type="button"
|
|
956
|
-
@click=${c=>n.handleConversationMenuToggle(c,
|
|
978
|
+
@click=${c=>n.handleConversationMenuToggle(c,o.id)}
|
|
957
979
|
>
|
|
958
980
|
<img src=${Ge} alt="" aria-hidden="true" />
|
|
959
981
|
</button>
|
|
960
|
-
${
|
|
982
|
+
${r?u`
|
|
961
983
|
<div
|
|
962
984
|
class=${g({"conversation-menu":!0,"conversation-menu--above":n.conversationMenuPlacement==="above"})}
|
|
963
985
|
@click=${c=>c.stopPropagation()}
|
|
964
986
|
>
|
|
965
987
|
<button
|
|
966
988
|
type="button"
|
|
967
|
-
@click=${()=>n.handleConversationAction("rename",
|
|
989
|
+
@click=${()=>n.handleConversationAction("rename",o.id)}
|
|
968
990
|
>
|
|
969
|
-
<img src=${
|
|
991
|
+
<img src=${qe} alt="" aria-hidden="true" />
|
|
970
992
|
Renomear
|
|
971
993
|
</button>
|
|
972
994
|
<button
|
|
973
995
|
type="button"
|
|
974
|
-
@click=${()=>n.handleConversationAction("delete",
|
|
996
|
+
@click=${()=>n.handleConversationAction("delete",o.id)}
|
|
975
997
|
>
|
|
976
|
-
<img src=${
|
|
998
|
+
<img src=${Ke} alt="" aria-hidden="true" />
|
|
977
999
|
Excluir
|
|
978
1000
|
</button>
|
|
979
1001
|
</div>
|
|
@@ -990,7 +1012,7 @@
|
|
|
990
1012
|
type="text"
|
|
991
1013
|
placeholder="Buscar nas conversas"
|
|
992
1014
|
.value=${n.conversationSearch}
|
|
993
|
-
@input=${
|
|
1015
|
+
@input=${o=>n.handleConversationSearch(o)}
|
|
994
1016
|
/>
|
|
995
1017
|
</div>
|
|
996
1018
|
|
|
@@ -1001,10 +1023,10 @@
|
|
|
1001
1023
|
${t?u`
|
|
1002
1024
|
<div
|
|
1003
1025
|
class=${g({"conversation-scrollbar":!0,"conversation-scrollbar--visible":n.conversationScrollbar.visible})}
|
|
1004
|
-
@pointerdown=${
|
|
1005
|
-
@pointermove=${
|
|
1006
|
-
@pointerup=${
|
|
1007
|
-
@pointercancel=${
|
|
1026
|
+
@pointerdown=${o=>n.handleConversationScrollbarPointerDown(o)}
|
|
1027
|
+
@pointermove=${o=>n.handleConversationScrollbarPointerMove(o)}
|
|
1028
|
+
@pointerup=${o=>n.handleConversationScrollbarPointerUp(o)}
|
|
1029
|
+
@pointercancel=${o=>n.handleConversationScrollbarPointerUp(o)}
|
|
1008
1030
|
>
|
|
1009
1031
|
<span
|
|
1010
1032
|
class="conversation-scrollbar__thumb"
|
|
@@ -1032,7 +1054,7 @@
|
|
|
1032
1054
|
`)}
|
|
1033
1055
|
${n.isLoading?u`
|
|
1034
1056
|
<div class="message message--assistant typing">
|
|
1035
|
-
<span>
|
|
1057
|
+
<span>Rio Insight está respondendo...</span>
|
|
1036
1058
|
</div>
|
|
1037
1059
|
`:null}
|
|
1038
1060
|
</div>
|
|
@@ -1082,7 +1104,7 @@
|
|
|
1082
1104
|
</p>
|
|
1083
1105
|
</div>
|
|
1084
1106
|
</div>
|
|
1085
|
-
`},
|
|
1107
|
+
`},ot=n=>{const e=be(n);return u`
|
|
1086
1108
|
<aside class=${g({panel:!0,open:n.open})} role="dialog">
|
|
1087
1109
|
<header class="panel-header">
|
|
1088
1110
|
<div class="panel-header__top">
|
|
@@ -1131,11 +1153,11 @@
|
|
|
1131
1153
|
|
|
1132
1154
|
${fe(n,{variant:"drawer"})}
|
|
1133
1155
|
</aside>
|
|
1134
|
-
`},
|
|
1156
|
+
`},rt=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAClSURBVHgB7ZXtCYAgEIbPaIBGsA1arU3aoJFqgxqhDa6LFPogO/UEoR44ENHn/eGpADmBiHorSIGRT6Y0SELCyogt27gCCYx8wDtDdIhDHh/CkIeHeMj9QwLk/JAI+XuIgNwdQpMdytFbb3HIkLk4FwpITDYBLVV9qZazsQQei1JqPk7QQS6cjd85gz8gHcoOqO0aeH4uRmrTU1vi/vHrh/WzbesVLQQBC6E6gyQAAAAASUVORK5CYII=",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,at=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIQSURBVHgB5ZZLTuQwEIbLjqWRRizCDcIJpvsGnQ1MNBvYoe5G5AYzV+EGRoGIXe8mYjb0nGAyJyA3ICsQUtqmKiTpPPrhZAm1ieOU63NV/bYC8NGMmTqeLk7tgy8HE8aYTe8adJJBltx5d4nJ+r2gaTT1OeOXOJxscYmVVlehF0oYAjqPzh2LWQsGbAQGRhmu9MrdluFG0PTPdMQ1f8DVNvSzVK2UG/4I470gykRw8W8ApIJlOhu3M+NtLyzXkEwARZIWQ1swsWh/b4Co8dgTB/oCNLjBSXCIz+tiekSxtoI45z+hJwQr4N54N0t610xXvSmUuvYtB3lvmHiEnhB5LONyPZW9XhHxIg7lmUwbGQkQjiGjAyGVtiFk2ddsso5fLkYnPAswBJIfBegKSClVzfGdUbHJiqsxbiLZCTFQaQXSXKfNrUNMTQ6Pw9jSlosz//tCOPBkHa4w/8G3s9fsqe6IKvJvT26v2wFMMxFaHElPJu/QwqSbq2NZd2Saydn97HIIhCpSQhqgInBn9zns9+wXjefRfGLaE6bYVZPbsvn9nO650YYdpqZXE4kn+B4c1ec6qhNKnOVB22YKIWW+iwd2gqiuiil3I8wEQsqs9WYriIwkjZlV58fQYktZ41L+nU3sW30RXfgocxLDt40OGv7ihmTgBXJXHOOfEz/yHfwZccr7jA64eBbL8tL8fPYGlj3l1qpxcVgAAAAASUVORK5CYII=",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,lt=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIVSURBVHgB5VVBctNAEOxZiQpwEi+IfoD9A+uAKI4yVamycyC8gPwAeAGVF+AcEldR5VpuQHKweQHmBYgf+AhUvMMsthVZWkm2wynpizS7O9M7O7O9wG0DbbrwvdbB3vxhh4kCaxszT30faS95lm7i30h0Nro4UopeyG/HNc/AlA2fHD6PB9iFaKg/hQxPE6iFjcApMI+qMnQSfdAXLQMay24DbAFZP2NwdJjE00YimwnB/1ZJwvzdBiRS+2KELjLCVbuYmSpH8moz6XXjVr8bd6QZTl3zsvOA4evi+BqRLbwsDXFDCFlrEesaft7wFL3ihiDn+lIahKUWqG2SZacOcuQL2NoI7486Z2b8zBwJ+2jAL/iPXibRzP5nGV3BD/06Eilyv/skXNlnoy9vlFKva1ywhz8d+Xy0/1mNlCl3UB72uLAl2FDWVGpjJ1BwPvp8jB2RERGr2h3btiXlvcM2wUUPS0QPPG+C/w3/floiShbdManzYzbZJb2nSIpMaeVaEdteEpWJltOnqKZJ+92nRyvrQPTMGPO2arU0z0neXiPqJfFAajHFjUGpjZUfKV0d0alERNEhqhQO9eV4bUTUoagk8qyIangRSuMO7PpMWBIlJAdJVDoV5z2y5y+ZteuKXcS/lxZe20Wy2EQDhlpUmHEs4vbYScD8VXRvUKzJ1kTXhONQFDHEUqpYqdlveJOVaN49/AWuVb4JKaLcJgAAAABJRU5ErkJggg==",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,ct=new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGYSURBVHgBzZZPTsJAFMbfG8A/0USO0BvQI9AFJu5sjEbiptwATgCcQG5QN1ATNeOOBEioN8Ab9Ai4MHFR5jmjxiilzNSi8dt00vfN+01m5r0W4I+EWcw+5+VivGOrcVx8mTVcd2461wikALuw3yaA5lKoU3drXZMczMS0DXvTFZA30DUfX4KBtKD+3chDQDstrhYQ3AyrkBfEkI51HmLpCzEGAbIDnYWQWTqPFkREj9okCDOtR2dAxHuNIwIohZAXJK9vKB+pV5hg0aq7TgQaGRdswEceEXgMWUUQPSGIWQG3Omeuo922/yXVFQI+tNbFwUBrt27Ax015iKr1qGShEOLh/fDVTGEzLFTkqCpPKhICuhcnh1eZQQGf+DKBBxkkk/XO3VorJbYZiA6WAKnexhj6kEdx7NRPj8KvrxJ1xBi0Ia+KxUSOb6DB7UQ2ULQgv6p9PrJTQYQLbRc2loB0kOxrFmxMZKWCflPLIOOfDW1i9lHYq0CIpd5n5edS8tORqCOfT8s7EP/4UhSA5s9Qihqus7HdyaRXhOV61M1m9WYAAAAASUVORK5CYII=",l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("rio-assist.js",document.baseURI).href).href,ht=n=>{const e=be(n);return u`
|
|
1135
1157
|
<section class="fullscreen-shell" role="dialog" aria-modal="true">
|
|
1136
1158
|
<div class="fullscreen-shell__rail">
|
|
1137
1159
|
<button type="button" class="rail-button" aria-label="Ir para home">
|
|
1138
|
-
<img src=${
|
|
1160
|
+
<img src=${rt} alt="" aria-hidden="true" />
|
|
1139
1161
|
</button>
|
|
1140
1162
|
<button
|
|
1141
1163
|
type="button"
|
|
@@ -1209,7 +1231,7 @@
|
|
|
1209
1231
|
`},dt=n=>{const e=g({canvas:!0,"canvas--fullscreen":n.isFullscreen});return u`
|
|
1210
1232
|
<div class=${e}>
|
|
1211
1233
|
${Fe(n)}
|
|
1212
|
-
${
|
|
1234
|
+
${ot(n)}
|
|
1213
1235
|
${n.isFullscreen?ht(n):null}
|
|
1214
1236
|
</div>
|
|
1215
|
-
`},pt="wss://ws.volkswagen.latam-sandbox.rio.cloud",ut="eu.amazon.nova-pro-v1:0";class At{constructor(e){this.socket=null,this.connectPromise=null,this.listeners=new Set,this.token=e}matchesToken(e){return this.token===e}async sendMessage(e){const t=await this.ensureConnection(),s={action:"sendMessage",message:e,agentModel:ut};t.send(JSON.stringify(s))}onMessage(e){return this.listeners.add(e),()=>this.listeners.delete(e)}close(){this.socket&&this.socket.readyState===WebSocket.OPEN&&this.socket.close(),this.connectPromise=null,this.socket=null,this.listeners.clear()}async ensureConnection(){if(this.socket&&(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING))return await this.connectPromise,this.socket;if(this.socket=new WebSocket(`${pt}?token=${encodeURIComponent(this.token)}`),this.socket.addEventListener("message",e=>this.handleMessage(e)),this.socket.addEventListener("close",()=>{this.connectPromise=null,this.socket=null}),this.connectPromise=new Promise((e,t)=>{if(!this.socket){t(new Error("Falha ao criar conexão WebSocket."));return}const s=()=>{r(),e()},i=()=>{var o;r(),(o=this.socket)==null||o.close(),this.socket=null,this.connectPromise=null,t(new Error("Não foi possível abrir conexão com o websocket do Rio Insight."))},r=()=>{var o,c;(o=this.socket)==null||o.removeEventListener("open",s),(c=this.socket)==null||c.removeEventListener("error",i)};this.socket.addEventListener("open",s,{once:!0}),this.socket.addEventListener("error",i,{once:!0})}),await this.connectPromise,!this.socket||this.socket.readyState!==WebSocket.OPEN)throw new Error("Conexão WebSocket do Rio Insight não está pronta.");return this.socket}async handleMessage(e){const t=await this.readMessage(e.data);let s=null,i=t;try{if(s=JSON.parse(t),typeof s=="object"&&s!==null){const r=s.message??s.response??s.text??s.content;typeof r=="string"&&(i=r)}}catch{s=null}this.listeners.forEach(r=>r({text:i,raw:t,data:s}))}async readMessage(e){return typeof e=="string"?e:e instanceof Blob?e.text():e instanceof ArrayBuffer?new TextDecoder().decode(new Uint8Array(e)):ArrayBuffer.isView(e)?new TextDecoder().decode(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):String(e??"")}}const L=class L extends P{constructor(){super(...arguments),this.open=!1,this.message="",this.titleText="Rio Insight",this.buttonLabel="Rio Insight",this.placeholder="Pergunte alguma coisa",this.accentColor="#008B9A",this.apiBaseUrl="",this.rioToken="",this.suggestionsSource="",this.messages=[],this.isLoading=!1,this.errorMessage="",this.showConversations=!1,this.conversationSearch="",this.conversationMenuId=null,this.conversationMenuPlacement="below",this.isFullscreen=!1,this.showNewConversationShortcut=!1,this.conversationScrollbar={height:0,top:0,visible:!1},this.conversationScrollbarRaf=null,this.rioClient=null,this.rioUnsubscribe=null,this.loadingTimer=null,this.conversationScrollbarDraggingId=null,this.conversationScrollbarDragState=null,this.conversations=Array.from({length:20}).map((e,t)=>({id:`${t+1}`,title:["Caminhões com problema na frota de veículos.","Próximas manutenções periódicas preventivas.","Quais revisões meu plano inclui?","Como automatizar preenchimento de odômetro.","Valor das peças da próxima revisão.","O que é revisão de assentamento?","Alertas críticos ativos.","Veículo superaquecendo, causas e recomendações.","Calibragem recomendada nos pneus do e-Delivery.","Quantos mil km trocar o óleo do motor.","Qual a vida útil da bateria Moura M100HE."][t%11],updatedAt:new Date(Date.now()-t*36e5).toISOString()}))}get suggestions(){return this.suggestionsSource?this.suggestionsSource.split("|").map(e=>e.trim()).filter(Boolean):[]}updated(e){super.updated(e),this.style.setProperty("--accent-color",this.accentColor),(e.has("isFullscreen")||e.has("showConversations")||e.has("conversations"))&&this.enqueueConversationScrollbarMeasure()}firstUpdated(){this.enqueueConversationScrollbarMeasure()}disconnectedCallback(){super.disconnectedCallback(),this.conversationScrollbarRaf!==null&&(cancelAnimationFrame(this.conversationScrollbarRaf),this.conversationScrollbarRaf=null),this.teardownRioClient(),this.clearLoadingGuard()}get filteredConversations(){const e=this.conversationSearch.trim().toLowerCase();return e?this.conversations.filter(t=>t.title.toLowerCase().includes(e)):this.conversations}get hasActiveConversation(){return this.messages.length>0}togglePanel(){if(this.isFullscreen){this.exitFullscreen(!1);return}this.open=!this.open,this.dispatchEvent(new CustomEvent(this.open?"rioassist:open":"rioassist:close",{bubbles:!0,composed:!0}))}closePanel(){this.isFullscreen=!1,this.open&&this.togglePanel()}openConversationsPanel(){this.showConversations=!0}closeConversationsPanel(){this.showConversations=!1,this.conversationMenuId=null}toggleConversationsPanel(){this.showConversations=!this.showConversations,this.showConversations||(this.conversationMenuId=null)}toggleNewConversationShortcut(){this.showNewConversationShortcut=!this.showNewConversationShortcut}handleConversationSearch(e){this.conversationSearch=e.target.value}handleConversationMenuToggle(e,t){if(e.stopPropagation(),this.conversationMenuId===t){this.conversationMenuId=null;return}const s=e.currentTarget,i=this.renderRoot.querySelector(".conversations-panel__surface");if(s&&i){const r=s.getBoundingClientRect(),c=i.getBoundingClientRect().bottom-r.bottom;this.conversationMenuPlacement=c<140?"above":"below"}else this.conversationMenuPlacement="below";this.conversationMenuId=t}handleConversationsPanelPointer(e){const t=e.target;!t.closest(".conversation-menu")&&!t.closest(".conversation-menu-button")&&(this.conversationMenuId=null)}handleConversationAction(e,t){this.conversationMenuId=null;const s=this.conversations.find(r=>r.id===t);if(!s)return;const i=`${e==="rename"?"Renomear":"Excluir"} "${s.title}"`;console.info(`[Mock] ${i}`)}handleCloseAction(){if(this.isFullscreen){this.exitFullscreen(!0);return}this.showConversations?this.closeConversationsPanel():this.closePanel()}enterFullscreen(){this.isFullscreen||(this.isFullscreen=!0,this.open=!1,this.showConversations=!1)}exitFullscreen(e){this.isFullscreen&&(this.isFullscreen=!1,this.conversationMenuId=null,this.showNewConversationShortcut=!1,e&&(this.open=!0))}handleCreateConversation(){this.hasActiveConversation&&(this.clearLoadingGuard(),this.isLoading=!1,this.messages=[],this.message="",this.errorMessage="",this.showConversations=!1,this.teardownRioClient(),this.showNewConversationShortcut=!1,this.dispatchEvent(new CustomEvent("rioassist:new-conversation",{bubbles:!0,composed:!0})))}handleConversationListScroll(e){const t=e.currentTarget;t&&this.updateConversationScrollbar(t)}handleConversationScrollbarPointerDown(e){const t=e.currentTarget,s=this.renderRoot.querySelector(".conversation-list--sidebar");if(!t||!s)return;const i=t.getBoundingClientRect(),r=i.height*(this.conversationScrollbar.height/100),o=Math.max(i.height-r,0),c=Math.max(s.scrollHeight-s.clientHeight,1),a=s.scrollTop/c*o,h=e.clientY-i.top,p=h>=a&&h<=a+r,d=p?a:Math.min(Math.max(h-r/2,0),o);p||(s.scrollTop=d/Math.max(o,1)*(s.scrollHeight-s.clientHeight),this.updateConversationScrollbar(s)),t.setPointerCapture(e.pointerId),this.conversationScrollbarDraggingId=e.pointerId,this.conversationScrollbarDragState={startY:e.clientY,startThumbTop:d,trackHeight:i.height,thumbHeight:r,list:s},e.preventDefault()}handleConversationScrollbarPointerMove(e){if(this.conversationScrollbarDraggingId===null||this.conversationScrollbarDraggingId!==e.pointerId||!this.conversationScrollbarDragState)return;const{startY:t,startThumbTop:s,trackHeight:i,thumbHeight:r,list:o}=this.conversationScrollbarDragState,c=Math.max(i-r,0),a=e.clientY-t,h=Math.min(Math.max(s+a,0),c),p=o.scrollHeight-o.clientHeight;p>0&&(o.scrollTop=h/Math.max(c,1)*p,this.updateConversationScrollbar(o)),e.preventDefault()}handleConversationScrollbarPointerUp(e){if(this.conversationScrollbarDraggingId!==e.pointerId)return;const t=e.currentTarget;t==null||t.releasePointerCapture(e.pointerId),this.conversationScrollbarDraggingId=null,this.conversationScrollbarDragState=null}enqueueConversationScrollbarMeasure(){this.conversationScrollbarRaf===null&&(this.conversationScrollbarRaf=requestAnimationFrame(()=>{this.conversationScrollbarRaf=null,this.updateConversationScrollbar()}))}updateConversationScrollbar(e){const t=e??this.renderRoot.querySelector(".conversation-list--sidebar");if(!t){this.conversationScrollbar.visible&&(this.conversationScrollbar={height:0,top:0,visible:!1});return}const{scrollHeight:s,clientHeight:i,scrollTop:r}=t;if(s<=i+1){this.conversationScrollbar.visible&&(this.conversationScrollbar={height:0,top:0,visible:!1});return}const o=i/s,c=Math.max(o*100,8),a=100-c,h=r/(s-i)*(a>0?a:0);this.conversationScrollbar={height:c,top:h,visible:!0}}async onSuggestionClick(e){await this.processMessage(e)}async handleSubmit(e){e.preventDefault(),await this.processMessage(this.message)}createMessage(e,t){return{id:typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random()}`,role:e,text:t,timestamp:Date.now()}}async processMessage(e){const t=e.trim();if(!t||this.isLoading)return;this.dispatchEvent(new CustomEvent("rioassist:send",{detail:{message:t,apiBaseUrl:this.apiBaseUrl,token:this.rioToken},bubbles:!0,composed:!0}));const s=this.createMessage("user",t);this.messages=[...this.messages,s],this.message="",this.errorMessage="",this.isLoading=!0,this.startLoadingGuard();try{await this.ensureRioClient().sendMessage(t)}catch(i){this.clearLoadingGuard(),this.isLoading=!1,this.errorMessage=i instanceof Error?i.message:"Nao foi possivel enviar a mensagem para o agente."}}ensureRioClient(){const e=this.rioToken.trim();if(!e)throw new Error("Informe o token RIO em data-rio-token para conectar no websocket do assistente.");return(!this.rioClient||!this.rioClient.matchesToken(e))&&(this.teardownRioClient(),this.rioClient=new At(e),this.rioUnsubscribe=this.rioClient.onMessage(t=>{this.handleIncomingMessage(t)})),this.rioClient}handleIncomingMessage(e){const t=this.createMessage("assistant",e.text);this.messages=[...this.messages,t],this.clearLoadingGuard(),this.isLoading=!1}teardownRioClient(){this.rioUnsubscribe&&(this.rioUnsubscribe(),this.rioUnsubscribe=null),this.rioClient&&(this.rioClient.close(),this.rioClient=null)}startLoadingGuard(){this.clearLoadingGuard(),this.loadingTimer=window.setTimeout(()=>{this.loadingTimer=null,this.isLoading=!1},15e3)}clearLoadingGuard(){this.loadingTimer!==null&&(window.clearTimeout(this.loadingTimer),this.loadingTimer=null)}render(){return dt(this)}};L.styles=He,L.properties={open:{type:Boolean,state:!0},message:{type:String,state:!0},titleText:{type:String,attribute:"data-title"},buttonLabel:{type:String,attribute:"data-button-label"},placeholder:{type:String,attribute:"data-placeholder"},accentColor:{type:String,attribute:"data-accent-color"},apiBaseUrl:{type:String,attribute:"data-api-base-url"},rioToken:{type:String,attribute:"data-rio-token"},suggestionsSource:{type:String,attribute:"data-suggestions"},messages:{state:!0},isLoading:{type:Boolean,state:!0},errorMessage:{type:String,state:!0},showConversations:{type:Boolean,state:!0},conversationSearch:{type:String,state:!0},conversationMenuId:{state:!0},conversationMenuPlacement:{state:!0},isFullscreen:{type:Boolean,state:!0},conversationScrollbar:{state:!0},showNewConversationShortcut:{type:Boolean,state:!0}};let K=L;customElements.get("rio-assist-widget")||customElements.define("rio-assist-widget",K);const gt={title:"Rio Insight",buttonLabel:"Rio Insight",placeholder:"Pergunte alguma coisa",suggestions:["Veículos com problemas","Valor das peças","Planos de manutenção"],accentColor:"#008B9A",apiBaseUrl:"",rioToken:""},me="rio-assist-widget";function ft(n={}){const{target:e=document.body,...t}=n;let s=document.querySelector(me);s||(s=document.createElement(me),e.appendChild(s));const i={...gt,...t};Object.entries(i).forEach(([r,o])=>{o!==void 0&&(s==null||s.setAttribute(`data-${r.replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`)}`,Array.isArray(o)?o.join("|"):String(o)))})}typeof window<"u"&&(window.RioAssist=window.RioAssist??{init:ft},window.dispatchEvent(new Event("rio-assist-ready")))})();
|
|
1237
|
+
`},pt="wss://ws.volkswagen.latam-sandbox.rio.cloud",ut="eu.amazon.nova-pro-v1:0";class At{constructor(e){this.socket=null,this.connectPromise=null,this.listeners=new Set,this.token=e}matchesToken(e){return this.token===e}async sendMessage(e){const t=await this.ensureConnection(),s={action:"sendMessage",message:e,agentModel:ut};t.send(JSON.stringify(s))}onMessage(e){return this.listeners.add(e),()=>this.listeners.delete(e)}close(){this.socket&&this.socket.readyState===WebSocket.OPEN&&this.socket.close(),this.connectPromise=null,this.socket=null,this.listeners.clear()}async ensureConnection(){if(this.socket&&(this.socket.readyState===WebSocket.OPEN||this.socket.readyState===WebSocket.CONNECTING))return await this.connectPromise,this.socket;if(this.socket=new WebSocket(`${pt}?token=${encodeURIComponent(this.token)}`),this.socket.addEventListener("message",e=>this.handleMessage(e)),this.socket.addEventListener("close",()=>{this.connectPromise=null,this.socket=null}),this.connectPromise=new Promise((e,t)=>{if(!this.socket){t(new Error("Falha ao criar conexão WebSocket."));return}const s=()=>{o(),e()},i=()=>{var r;o(),(r=this.socket)==null||r.close(),this.socket=null,this.connectPromise=null,t(new Error("Não foi possível abrir conexão com o websocket do Rio Insight."))},o=()=>{var r,c;(r=this.socket)==null||r.removeEventListener("open",s),(c=this.socket)==null||c.removeEventListener("error",i)};this.socket.addEventListener("open",s,{once:!0}),this.socket.addEventListener("error",i,{once:!0})}),await this.connectPromise,!this.socket||this.socket.readyState!==WebSocket.OPEN)throw new Error("Conexão WebSocket do Rio Insight não está pronta.");return this.socket}async handleMessage(e){const t=await this.readMessage(e.data);let s=null,i=t;try{if(s=JSON.parse(t),typeof s=="object"&&s!==null){const o=s.message??s.response??s.text??s.content;typeof o=="string"&&(i=o)}}catch{s=null}this.listeners.forEach(o=>o({text:i,raw:t,data:s}))}async readMessage(e){return typeof e=="string"?e:e instanceof Blob?e.text():e instanceof ArrayBuffer?new TextDecoder().decode(new Uint8Array(e)):ArrayBuffer.isView(e)?new TextDecoder().decode(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):String(e??"")}}const Y=class Y extends P{constructor(){super(...arguments),this.open=!1,this.message="",this.titleText="Rio Insight",this.buttonLabel="Rio Insight",this.placeholder="Pergunte alguma coisa",this.accentColor="#008B9A",this.apiBaseUrl="",this.rioToken="",this.suggestionsSource="",this.messages=[],this.isLoading=!1,this.errorMessage="",this.showConversations=!1,this.conversationSearch="",this.conversationMenuId=null,this.conversationMenuPlacement="below",this.isFullscreen=!1,this.showNewConversationShortcut=!1,this.conversationScrollbar={height:0,top:0,visible:!1},this.conversationScrollbarRaf=null,this.rioClient=null,this.rioUnsubscribe=null,this.loadingTimer=null,this.conversationScrollbarDraggingId=null,this.conversationScrollbarDragState=null,this.conversations=Array.from({length:20}).map((e,t)=>({id:`${t+1}`,title:["Caminhões com problema na frota de veículos.","Próximas manutenções periódicas preventivas.","Quais revisões meu plano inclui?","Como automatizar preenchimento de odômetro.","Valor das peças da próxima revisão.","O que é revisão de assentamento?","Alertas críticos ativos.","Veículo superaquecendo, causas e recomendações.","Calibragem recomendada nos pneus do e-Delivery.","Quantos mil km trocar o óleo do motor.","Qual a vida útil da bateria Moura M100HE."][t%11],updatedAt:new Date(Date.now()-t*36e5).toISOString()}))}get suggestions(){return this.suggestionsSource?this.suggestionsSource.split("|").map(e=>e.trim()).filter(Boolean):[]}updated(e){super.updated(e),this.style.setProperty("--accent-color",this.accentColor),(e.has("isFullscreen")||e.has("showConversations")||e.has("conversations"))&&this.enqueueConversationScrollbarMeasure(),(e.has("messages")||e.has("isLoading")&&this.isLoading||e.has("open")&&this.open||e.has("isFullscreen")&&this.isFullscreen)&&this.scrollConversationToBottom()}firstUpdated(){this.enqueueConversationScrollbarMeasure()}disconnectedCallback(){super.disconnectedCallback(),this.conversationScrollbarRaf!==null&&(cancelAnimationFrame(this.conversationScrollbarRaf),this.conversationScrollbarRaf=null),this.teardownRioClient(),this.clearLoadingGuard()}get filteredConversations(){const e=this.conversationSearch.trim().toLowerCase();return e?this.conversations.filter(t=>t.title.toLowerCase().includes(e)):this.conversations}get hasActiveConversation(){return this.messages.length>0}togglePanel(){if(this.isFullscreen){this.exitFullscreen(!1);return}this.open=!this.open,this.dispatchEvent(new CustomEvent(this.open?"rioassist:open":"rioassist:close",{bubbles:!0,composed:!0}))}closePanel(){this.isFullscreen=!1,this.open&&this.togglePanel()}openConversationsPanel(){this.showConversations=!0}closeConversationsPanel(){this.showConversations=!1,this.conversationMenuId=null}toggleConversationsPanel(){this.showConversations=!this.showConversations,this.showConversations||(this.conversationMenuId=null)}toggleNewConversationShortcut(){this.showNewConversationShortcut=!this.showNewConversationShortcut}handleConversationSearch(e){this.conversationSearch=e.target.value}handleConversationMenuToggle(e,t){if(e.stopPropagation(),this.conversationMenuId===t){this.conversationMenuId=null;return}const s=e.currentTarget,i=this.renderRoot.querySelector(".conversations-panel__surface");if(s&&i){const o=s.getBoundingClientRect(),c=i.getBoundingClientRect().bottom-o.bottom;this.conversationMenuPlacement=c<140?"above":"below"}else this.conversationMenuPlacement="below";this.conversationMenuId=t}handleConversationsPanelPointer(e){const t=e.target;!t.closest(".conversation-menu")&&!t.closest(".conversation-menu-button")&&(this.conversationMenuId=null)}handleConversationAction(e,t){this.conversationMenuId=null;const s=this.conversations.find(o=>o.id===t);if(!s)return;const i=`${e==="rename"?"Renomear":"Excluir"} "${s.title}"`;console.info(`[Mock] ${i}`)}handleCloseAction(){if(this.isFullscreen){this.exitFullscreen(!0);return}this.showConversations?this.closeConversationsPanel():this.closePanel()}enterFullscreen(){this.isFullscreen||(this.isFullscreen=!0,this.open=!1,this.showConversations=!1)}exitFullscreen(e){this.isFullscreen&&(this.isFullscreen=!1,this.conversationMenuId=null,this.showNewConversationShortcut=!1,e&&(this.open=!0))}handleCreateConversation(){this.hasActiveConversation&&(this.clearLoadingGuard(),this.isLoading=!1,this.messages=[],this.message="",this.errorMessage="",this.showConversations=!1,this.teardownRioClient(),this.showNewConversationShortcut=!1,this.dispatchEvent(new CustomEvent("rioassist:new-conversation",{bubbles:!0,composed:!0})))}handleConversationListScroll(e){const t=e.currentTarget;t&&this.updateConversationScrollbar(t)}handleConversationScrollbarPointerDown(e){const t=e.currentTarget,s=this.renderRoot.querySelector(".conversation-list--sidebar");if(!t||!s)return;const i=t.getBoundingClientRect(),o=i.height*(this.conversationScrollbar.height/100),r=Math.max(i.height-o,0),c=Math.max(s.scrollHeight-s.clientHeight,1),a=s.scrollTop/c*r,h=e.clientY-i.top,p=h>=a&&h<=a+o,d=p?a:Math.min(Math.max(h-o/2,0),r);p||(s.scrollTop=d/Math.max(r,1)*(s.scrollHeight-s.clientHeight),this.updateConversationScrollbar(s)),t.setPointerCapture(e.pointerId),this.conversationScrollbarDraggingId=e.pointerId,this.conversationScrollbarDragState={startY:e.clientY,startThumbTop:d,trackHeight:i.height,thumbHeight:o,list:s},e.preventDefault()}handleConversationScrollbarPointerMove(e){if(this.conversationScrollbarDraggingId===null||this.conversationScrollbarDraggingId!==e.pointerId||!this.conversationScrollbarDragState)return;const{startY:t,startThumbTop:s,trackHeight:i,thumbHeight:o,list:r}=this.conversationScrollbarDragState,c=Math.max(i-o,0),a=e.clientY-t,h=Math.min(Math.max(s+a,0),c),p=r.scrollHeight-r.clientHeight;p>0&&(r.scrollTop=h/Math.max(c,1)*p,this.updateConversationScrollbar(r)),e.preventDefault()}handleConversationScrollbarPointerUp(e){if(this.conversationScrollbarDraggingId!==e.pointerId)return;const t=e.currentTarget;t==null||t.releasePointerCapture(e.pointerId),this.conversationScrollbarDraggingId=null,this.conversationScrollbarDragState=null}enqueueConversationScrollbarMeasure(){this.conversationScrollbarRaf===null&&(this.conversationScrollbarRaf=requestAnimationFrame(()=>{this.conversationScrollbarRaf=null,this.updateConversationScrollbar()}))}updateConversationScrollbar(e){const t=e??this.renderRoot.querySelector(".conversation-list--sidebar");if(!t){this.conversationScrollbar.visible&&(this.conversationScrollbar={height:0,top:0,visible:!1});return}const{scrollHeight:s,clientHeight:i,scrollTop:o}=t;if(s<=i+1){this.conversationScrollbar.visible&&(this.conversationScrollbar={height:0,top:0,visible:!1});return}const r=i/s,c=Math.max(r*100,8),a=100-c,h=o/(s-i)*(a>0?a:0);this.conversationScrollbar={height:c,top:h,visible:!0}}async onSuggestionClick(e){await this.processMessage(e)}async handleSubmit(e){e.preventDefault(),await this.processMessage(this.message)}createMessage(e,t){return{id:typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random()}`,role:e,text:t,timestamp:Date.now()}}async processMessage(e){const t=e.trim();if(!t||this.isLoading)return;const s=this.messages.length===0;this.dispatchEvent(new CustomEvent("rioassist:send",{detail:{message:t,apiBaseUrl:this.apiBaseUrl,token:this.rioToken},bubbles:!0,composed:!0}));const i=this.createMessage("user",t);this.messages=[...this.messages,i],s&&(this.showNewConversationShortcut=!0),this.message="",this.errorMessage="",this.isLoading=!0,this.startLoadingGuard();try{await this.ensureRioClient().sendMessage(t)}catch(o){this.clearLoadingGuard(),this.isLoading=!1,this.errorMessage=o instanceof Error?o.message:"Nao foi possivel enviar a mensagem para o agente."}}ensureRioClient(){const e=this.rioToken.trim();if(!e)throw new Error("Informe o token RIO em data-rio-token para conectar no websocket do assistente.");return(!this.rioClient||!this.rioClient.matchesToken(e))&&(this.teardownRioClient(),this.rioClient=new At(e),this.rioUnsubscribe=this.rioClient.onMessage(t=>{this.handleIncomingMessage(t)})),this.rioClient}handleIncomingMessage(e){const t=this.createMessage("assistant",e.text);this.messages=[...this.messages,t],this.clearLoadingGuard(),this.isLoading=!1}teardownRioClient(){this.rioUnsubscribe&&(this.rioUnsubscribe(),this.rioUnsubscribe=null),this.rioClient&&(this.rioClient.close(),this.rioClient=null)}startLoadingGuard(){this.clearLoadingGuard(),this.loadingTimer=window.setTimeout(()=>{this.loadingTimer=null,this.isLoading=!1},15e3)}clearLoadingGuard(){this.loadingTimer!==null&&(window.clearTimeout(this.loadingTimer),this.loadingTimer=null)}scrollConversationToBottom(){Array.from(this.renderRoot.querySelectorAll(".panel-content")).forEach(t=>{requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})})}render(){return dt(this)}};Y.styles=He,Y.properties={open:{type:Boolean,state:!0},message:{type:String,state:!0},titleText:{type:String,attribute:"data-title"},buttonLabel:{type:String,attribute:"data-button-label"},placeholder:{type:String,attribute:"data-placeholder"},accentColor:{type:String,attribute:"data-accent-color"},apiBaseUrl:{type:String,attribute:"data-api-base-url"},rioToken:{type:String,attribute:"data-rio-token"},suggestionsSource:{type:String,attribute:"data-suggestions"},messages:{state:!0},isLoading:{type:Boolean,state:!0},errorMessage:{type:String,state:!0},showConversations:{type:Boolean,state:!0},conversationSearch:{type:String,state:!0},conversationMenuId:{state:!0},conversationMenuPlacement:{state:!0},isFullscreen:{type:Boolean,state:!0},conversationScrollbar:{state:!0},showNewConversationShortcut:{type:Boolean,state:!0}};let q=Y;customElements.get("rio-assist-widget")||customElements.define("rio-assist-widget",q);const gt={title:"Rio Insight",buttonLabel:"Rio Insight",placeholder:"Pergunte alguma coisa",suggestions:["Veículos com problemas","Valor das peças","Planos de manutenção"],accentColor:"#008B9A",apiBaseUrl:"",rioToken:""},me="rio-assist-widget";function ft(n={}){const{target:e=document.body,...t}=n;let s=document.querySelector(me);s||(s=document.createElement(me),e.appendChild(s));const i={...gt,...t};Object.entries(i).forEach(([o,r])=>{r!==void 0&&(s==null||s.setAttribute(`data-${o.replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`)}`,Array.isArray(r)?r.join("|"):String(r)))})}typeof window<"u"&&(window.RioAssist=window.RioAssist??{init:ft},window.dispatchEvent(new Event("rio-assist-ready")))})();
|
package/index.html
CHANGED
|
@@ -9,28 +9,20 @@
|
|
|
9
9
|
min-height: 100vh;
|
|
10
10
|
margin: 0;
|
|
11
11
|
font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
|
|
12
|
-
background:
|
|
13
|
-
color: #
|
|
14
|
-
padding: 32px;
|
|
12
|
+
background: #f5f7fa;
|
|
13
|
+
color: #1f2f36;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
h1 {
|
|
22
|
-
margin-top: 0;
|
|
16
|
+
.page {
|
|
17
|
+
padding: 24px;
|
|
18
|
+
max-width: 720px;
|
|
23
19
|
}
|
|
24
20
|
</style>
|
|
25
21
|
</head>
|
|
26
22
|
<body>
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
Playground de teste para o webcomponent. Clique no
|
|
31
|
-
botão flutuante no canto inferior direito para testar.
|
|
32
|
-
</p>
|
|
33
|
-
</main>
|
|
23
|
+
<div class="page">
|
|
24
|
+
<p>Abra o botão flutuante no canto inferior direito para testar.</p>
|
|
25
|
+
</div>
|
|
34
26
|
|
|
35
27
|
<rio-assist-widget
|
|
36
28
|
data-title="Rio Insight"
|
|
@@ -44,4 +36,4 @@
|
|
|
44
36
|
<script type="module" src="/src/playground.ts"></script>
|
|
45
37
|
</body>
|
|
46
38
|
</html>
|
|
47
|
-
|
|
39
|
+
</body>
|