@epam/statgpt-conversation-list 0.8.0-dev.12 → 0.8.0-dev.17

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 (3) hide show
  1. package/index.js +1 -1
  2. package/index.mjs +166 -166
  3. package/package.json +9 -4
package/index.js CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("classnames");c=s(c);let l=require("react");l=s(l);let u=require("lodash"),d=require("@epam/statgpt-ui-components"),f=require("@tabler/icons-react"),p=require("react/jsx-runtime"),m=require("jszip");m=s(m);let h=require("@epam/statgpt-shared-toolkit"),g=require("@epam/statgpt-dial-toolkit");var _=function(e){return e.DELETE=`delete`,e.EXPORT=`export`,e.SHARE=`share`,e.RENAME=`rename`,e}({}),v=function(e){return e.SHARED=`shared`,e.TODAY=`today`,e.YESTERDAY=`yesterday`,e.WEEK=`week`,e.EARLIER=`earlier`,e}({}),y=(e,t)=>e?.resources?.filter(e=>e?.parentPath===t)?.map(e=>{let n=`${e?.bucket}/${t}`,r=e?.url?.split(`/`)?.slice(1)?.join(`/`);return{...e,folderId:n,id:r,isShared:!0}})||[],b=e=>({[v.SHARED]:e}),x={[v.TODAY]:[],[v.YESTERDAY]:[],[v.WEEK]:[],[v.EARLIER]:[]},S=(e,t)=>e.toDateString()===t.toDateString(),C=(e,t)=>S(t,new Date(e.getFullYear(),e.getMonth(),e.getDate()-1)),w=(e,t)=>{let n=e.getTime()-t.getTime();return Math.floor(n/(1e3*60*60*24))},T=e=>e.updatedAt||Number(e.id?.split(`-`).pop()),E=e=>{let t=new Date,n=(0,u.cloneDeep)(x);for(let r of e)if(r.updatedAt){let e=new Date(r.updatedAt),i;i=S(t,e)?n[v.TODAY]:C(t,e)?n[v.YESTERDAY]:w(t,e)<=7?n[v.WEEK]:n[v.EARLIER],i?.some(e=>e.id===r.id)||i.push(r)}return n},D=e=>e?.sort((e,t)=>(T(t)||0)-(T(e)||0)),O=(e,t)=>e===v.SHARED?t?.shared||`Shared`:e===v.TODAY?t?.today||`Today`:e===v.YESTERDAY?t?.yesterday||`Yesterday`:e===v.WEEK?t?.lastWeek||`Last week`:t?.earlier||`Earlier`,k=(0,l.createContext)(null);function A(){let e=(0,l.useContext)(k);if(!e)throw Error(`useConversationStyles must be used within ConversationStylesContext.Provider`);return e}var j=({onCloseModal:e,deleteConversation:t,locale:n})=>{let{titles:r,disableModalDividers:i,isSmallModalButton:a}=A();return(0,p.jsxs)(d.Popup,{heading:r?.deleteTitle??`Delete conversation`,portalId:`delete-conversation`,containerClassName:`delete-conversation-popup`,size:d.PopUpSize.SM,dividers:!i,onClose:e,closeButtonTitle:r?.close??`Cancel`,children:[(0,p.jsx)(`div`,{className:`px-6 py-4 sm:px-0`,lang:n,children:r?.deleteMessage??`Are you sure you want to delete this conversation? This action cannot be undone.`}),(0,p.jsxs)(`div`,{className:`delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3`,children:[(0,p.jsx)(d.Button,{buttonClassName:`cancel-button`,title:r?.cancel??`Cancel`,isSmallButton:a,onClick:t=>{t.stopPropagation(),e()}}),(0,p.jsx)(d.Button,{buttonClassName:`text-button-primary text-button-primary-error`,title:r?.delete??`Delete`,isSmallButton:a,onClick:e=>{e.stopPropagation(),t()}})]})]})},M=e=>(0,u.uniqBy)(I((0,h.getConversationAttachments)(e)).map(e=>({...e,relativePath:``,contentLength:0})),e=>B(e.relativePath,e.name)),N=e=>e.endsWith(`/`),P=e=>{let t=e.toLowerCase();return[`data:`,`//`,`http://`,`https://`,`file://`,`ftp://`,`mailto:`,`telnet://`,`api/files`].some(e=>t.startsWith(e))},F=e=>{let t=B(...e.split(`/`).map(e=>decodeURIComponent(e))),n=t.lastIndexOf(`/`);return{absolutePath:t.slice(0,n),name:t.slice(n+1)}},I=e=>e?e.map(e=>{if(!e.url||P(e.url)||N(e.url))return null;let{absolutePath:t,name:n}=F(e.url);return{id:e.url,name:n,contentType:e.type,folderId:t,absolutePath:t}}).filter(Boolean):[];async function L(e,t){let n=M(e),r=new m.default;n.forEach(e=>{let n=t(`${encodeURI(B(e.absolutePath,e.name))}`.replace(`files/`,``)),i=B(`res`,R(e.folderId),e.name);r.file(i,n)});let i={version:5,history:[e].map(z)||[],folders:[]},a=JSON.stringify(i,null,2);return r.file(`conversations/conversations_history.json`,a),await r.generateAsync({type:`base64`})}var R=e=>{let t=e.split(`/`);return t.length>2?B(...t.slice(2)):void 0},z=e=>(0,u.omit)(e,[`publicationInfo`]),B=(...e)=>e.filter(Boolean).join(`/`);function V(e,t){let n=document.createElement(`a`);n.download=t,n.href=e,n.style.display=`none`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}var H=Object.defineProperty,U=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,K=(e,t,n)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q=(e,t)=>{for(var n in t||={})W.call(t,n)&&K(e,n,t[n]);if(U)for(var n of U(t))G.call(t,n)&&K(e,n,t[n]);return e},J=(e,t)=>{var n={};for(var r in e)W.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&U)for(var r of U(e))t.indexOf(r)<0&&G.call(e,r)&&(n[r]=e[r]);return n},Y;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(Y||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(Y||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(Y||={});var X=Y,ee={L:X.QrCode.Ecc.LOW,M:X.QrCode.Ecc.MEDIUM,Q:X.QrCode.Ecc.QUARTILE,H:X.QrCode.Ecc.HIGH},te=128,Z=`L`,Q=`#FFFFFF`,ne=`#000000`,re=!1,ie=1,ae=4,oe=0,se=.1;function ce(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function le(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function ue(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*se),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function de(e,t){return t==null?e?ae:oe:Math.max(Math.floor(t),0)}function $({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=l.default.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...X.QrSegment.makeSegments(t)),e),[]);return X.QrCode.encodeSegments(r,ee[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:u,margin:d,numCells:f,calculatedImageSettings:p}=l.default.useMemo(()=>{let e=c.getModules(),t=de(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:ue(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:d,cells:u,numCells:f,calculatedImageSettings:p}}var fe=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),pe=l.default.forwardRef(function(e,t){let n=e,{value:r,size:i=te,level:a=Z,bgColor:o=Q,fgColor:s=ne,includeMargin:c=re,minVersion:u=ie,boostLevel:d,marginSize:f,imageSettings:p}=n,m=J(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:h}=m,g=J(m,[`style`]),_=p?.src,v=l.default.useRef(null),y=l.default.useRef(null),b=l.default.useCallback(e=>{v.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[x,S]=l.default.useState(!1),{margin:C,cells:w,numCells:T,calculatedImageSettings:E}=$({value:r,level:a,minVersion:u,boostLevel:d,includeMargin:c,marginSize:f,imageSettings:p,size:i});l.default.useEffect(()=>{if(v.current!=null){let e=v.current,t=e.getContext(`2d`);if(!t)return;let n=w,r=y.current,a=E!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&E.excavation!=null&&(n=le(w,E.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/T*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,T,T),t.fillStyle=s,fe?t.fill(new Path2D(ce(n,C))):w.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+C,n+C,1,1)})}),E&&(t.globalAlpha=E.opacity),a&&t.drawImage(r,E.x+C,E.y+C,E.w,E.h)}}),l.default.useEffect(()=>{S(!1)},[_]);let D=q({height:i,width:i},h),O=null;return _!=null&&(O=l.default.createElement(`img`,{src:_,key:_,style:{display:`none`},onLoad:()=>{S(!0)},ref:y,crossOrigin:E?.crossOrigin})),l.default.createElement(l.default.Fragment,null,l.default.createElement(`canvas`,q({style:D,height:i,width:i,ref:b,role:`img`},g)),O)});pe.displayName=`QRCodeCanvas`;var me=l.default.forwardRef(function(e,t){let n=e,{value:r,size:i=te,level:a=Z,bgColor:o=Q,fgColor:s=ne,includeMargin:c=re,minVersion:u=ie,boostLevel:d,title:f,marginSize:p,imageSettings:m}=n,h=J(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:g,cells:_,numCells:v,calculatedImageSettings:y}=$({value:r,level:a,minVersion:u,boostLevel:d,includeMargin:c,marginSize:p,imageSettings:m,size:i}),b=_,x=null;m!=null&&y!=null&&(y.excavation!=null&&(b=le(_,y.excavation)),x=l.default.createElement(`image`,{href:m.src,height:y.h,width:y.w,x:y.x+g,y:y.y+g,preserveAspectRatio:`none`,opacity:y.opacity,crossOrigin:y.crossOrigin}));let S=ce(b,g);return l.default.createElement(`svg`,q({height:i,width:i,viewBox:`0 0 ${v} ${v}`,ref:t,role:`img`},h),!!f&&l.default.createElement(`title`,null,f),l.default.createElement(`path`,{fill:o,d:`M0,0 h${v}v${v}H0z`,shapeRendering:`crispEdges`}),l.default.createElement(`path`,{fill:s,d:S,shapeRendering:`crispEdges`}),x)});me.displayName=`QRCodeSVG`;var he=(e,t)=>({invitationType:g.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(e)}`},...t]}),ge=e=>`/${h.SHARE_CONVERSATION_ROUTE}/${e?.invitationLink?.split(`/`).at(-1)||``}`,_e=(e,t)=>t?.find(t=>{let n=e?.id?.split(`/`)?.pop(),r=t?.url?.split(`/`)?.pop()||``;return r===n||decodeURI(r)===n}),ve=e=>(e?.messages?.filter(e=>!!e?.custom_content?.attachments))?.flatMap(e=>e?.custom_content?.attachments?.map(e=>({url:e?.url||``}))||[])?.filter(e=>!!e?.url)||[],ye=({conversation:e,locale:t,onCloseModal:n,modalDividers:r,getConversation:i,generateConversationLink:a,chatExpiration:o,chatExpirationDays:s,close:c,chatWarning:u,shareLink:m,shareCopyLink:_,shareCopiedLink:v,shareDescription:y,shareRemoveAccessToUsers:b,chatName:x,getSharedConversations:S,revokeSharedConversations:C,baseUrl:w,id:T,clientSharedPage:E,clientSharedProp:D,shareAlertMessage:O})=>{let[k,A]=(0,l.useState)(null),[j,M]=(0,l.useState)(),[N,P]=(0,l.useState)(!1),[F,I]=(0,l.useState)(!1),[L,R]=(0,l.useState)(),z=(0,l.useRef)(null),B=(0,l.useRef)(null),V=(0,l.useMemo)(()=>e?.id?decodeURI(e.id):T?.[0]&&T?.[1]&&t?decodeURI(`${T[0]}/${t}/${T[1]}`):null,[e?.id,T,t]),H=(0,l.useMemo)(()=>{if(!k)return``;let e=w||window.location.origin;return w&&w!==window.location.origin&&E&&D?`${e}/${E}?${D}=${k.split(`/${h.SHARE_CONVERSATION_ROUTE}/`)?.[1]}`:`${e}/${t}${k}`},[w,k,t,E,D]),U=(0,l.useCallback)(async e=>{let t=await S?.((0,g.getSharedConversationsRequest)(g.ShareTarget.OTHERS));if(t)return _e({id:e},t.resources)},[S]);(0,l.useEffect)(()=>{if(!V||z.current===V)return;z.current=V,P(!1),B.current?.abort();let e=new AbortController;return B.current=e,(async()=>{try{let t=he(V,ve(await i?.(V))),n=await a?.(t),r=await U(V);if(e.signal.aborted||!n)return;A(ge(n)),M(r),P(!0)}catch(t){if(e.signal.aborted)return;P(!1),console.error(`Error sharing conversation`,t)}})(),()=>{e.abort(),z.current=null}},[V,a,i,U]);let W=(0,l.useCallback)(()=>{B.current?.abort(),z.current=null,n(),A(null),P(!1),I(!1)},[n]),G=(0,l.useCallback)(()=>{I(!0),navigator.clipboard.writeText(H||``)},[H]),K=async()=>{try{if(R(!0),j&&await C?.({resources:[j]}),V){let e=await U(V);B.current?.signal.aborted||M(e)}}catch(e){console.error(`Error revoking shared conversation`,e)}finally{B.current?.signal.aborted||R(!1)}},q=(0,l.useCallback)(()=>(0,p.jsx)(d.Button,{buttonClassName:F?`text-button-secondary`:`text-button-primary`,iconBefore:F?(0,p.jsx)(f.IconCheck,{width:20,height:20}):(0,p.jsx)(f.IconCopy,{width:20,height:20}),title:F?v??`Copied`:_??`Copy link`,disabled:F,onClick:G}),[F,G,v,_]);return(0,p.jsxs)(d.Popup,{heading:m??`Share link`,portalId:`share`,size:d.PopUpSize.SM,dividers:r,onClose:W,closeButtonTitle:c??`Close`,children:[N?(0,p.jsxs)(`div`,{className:`share flex flex-col gap-y-4 overflow-auto px-6 pb-6 sm:p-0`,children:[O?(0,p.jsx)(d.InlineAlert,{type:d.InlineAlertType.Note,icon:(0,p.jsx)(f.IconInfoCircle,{width:16,height:16}),children:O}):null,e?.name?(0,p.jsxs)(`div`,{className:`share-info flex w-full`,children:[(0,p.jsx)(`p`,{className:`share-info-title body-1 mr-1 text-neutrals-800`,children:x??`Chat name:`}),(0,p.jsx)(`h3`,{className:`min-w-0 flex-1 truncate`,title:e?.name,children:e?.name})]}):null,(0,p.jsxs)(`div`,{className:`share-info flex`,children:[(0,p.jsx)(`p`,{className:`share-info-title body-1 mr-1 text-neutrals-800`,children:o??`Link expiration date:`}),(0,p.jsxs)(`h3`,{children:[`3 `,s??`days`]})]}),(0,p.jsx)(me,{className:`min-h-[200px] self-center rounded border border-neutrals-600 p-2`,value:H,size:200}),(0,p.jsx)(`p`,{className:`body-2 text-neutrals-1000`,children:y??`Your name, special instructions, and any messages you add after sharing remain confidential.`}),(0,p.jsx)(d.InputWithIcon,{containerClasses:`share-input-container`,cssClass:`share-input`,readonly:!0,placeholder:H,value:H,inputId:`conversationLink`,iconAfterInput:q()})]}):(0,p.jsx)(`div`,{className:`flex items-center justify-center p-6`,children:(0,p.jsx)(d.Loader,{})}),N?e&&j?(0,p.jsx)(`div`,{className:`remove-access`,children:(0,p.jsx)(d.Button,{title:b??`Remove access to all users`,buttonClassName:`remove-access-button py-3 px-4`,isSmallButton:!0,disabled:L,onClick:K})}):(0,p.jsx)(`p`,{className:`body-2 share-footer text-neutrals-800`,children:u??`This chat has not been shared with anyone yet.`}):(0,p.jsx)(`div`,{})]})},be=({conversation:e,onCloseModal:t,renameConversation:n,locale:r})=>{let{titles:i,disableModalDividers:a,isSmallModalButton:o}=A(),[s,c]=(0,l.useState)(e?.name||``),u=e=>{c(e)},f=()=>{let t=`${e?.folderId}/${encodeURIComponent((0,h.getClearedConversationName)(s))}-${new Date().getTime()}`;n(`conversations/${e.id}`,`conversations/${t}`)};return(0,p.jsxs)(d.Popup,{heading:i?.renameTitle??`Rename conversation`,portalId:`rename-conversation`,containerClassName:`rename-conversation-popup`,size:d.PopUpSize.SM,dividers:!a,onClose:t,closeButtonTitle:i?.close??`Cancel`,children:[(0,p.jsx)(`div`,{className:`px-6 py-4 sm:px-0`,lang:r,children:(0,p.jsx)(d.Input,{inputId:`rename`,value:s,onChange:u,cssClass:`w-full`})}),(0,p.jsxs)(`div`,{className:`delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3`,children:[(0,p.jsx)(d.Button,{buttonClassName:`cancel-button`,title:i?.cancel??`Cancel`,isSmallButton:o,onClick:e=>{e.stopPropagation(),t()}}),(0,p.jsx)(d.Button,{buttonClassName:`text-button-primary text-button-primary`,title:i?.save??`Rename`,isSmallButton:o,disabled:!s,onClick:e=>{e.stopPropagation(),f()}})]})]})},xe=(0,l.createContext)(null);function Se({children:e,value:t}){return(0,p.jsx)(xe.Provider,{value:t,children:e})}function Ce(){let e=(0,l.useContext)(xe);if(!e)throw Error(`useConversationListActions must be used within ConversationListActionsProvider`);return e}var we=({conversation:e,triggerButton:t,isDisabled:n})=>{let r=A(),{locale:i,deleteConversation:a,renameConversation:o,getConversation:s,getFileBlob:c,shareConversationProps:u}=Ce(),f=(0,l.useMemo)(()=>{let t=[{key:_.DELETE,title:r?.titles?.delete??`Delete`,icon:r.actionsIcons?.[_.DELETE]}];return e?.model?.id?.endsWith(h.ONBOARDING_MODEL_POSTFIX)?t:[...e.isShared?[]:[{key:_.SHARE,title:r?.titles?.share??`Share`,icon:r.actionsIcons?.[_.SHARE]},{key:_.RENAME,title:r?.titles?.rename??`Rename`,icon:r.actionsIcons?.[_.RENAME]}],{key:_.EXPORT,title:r?.titles?.export??`Export`,icon:r.actionsIcons?.[_.EXPORT]},...t]},[e.isShared,e?.model?.id,r.titles,r.actionsIcons]),[m,g]=(0,l.useState)(d.PopUpState.Closed),[v,y]=(0,l.useState)(d.PopUpState.Closed),[b,x]=(0,l.useState)(d.PopUpState.Closed),S=(0,l.useCallback)(()=>{g(d.PopUpState.Closed)},[g]),C=(0,l.useCallback)(()=>{y(d.PopUpState.Closed)},[y]),w=(0,l.useCallback)(()=>{x(d.PopUpState.Closed)},[x]),T=(0,l.useCallback)(()=>{a(e),S()},[e,a,S]),E=(0,l.useCallback)((e,t)=>{o(e,t),w()},[o,w]);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.Dropdown,{containerClassName:`ml-3 hidden group-hover:flex`,triggerButton:t??(0,p.jsx)(Te,{disabled:n}),options:f,openedClassName:`!flex action-menu-opened`,onOptionSelect:t=>{t===_.DELETE&&g(d.PopUpState.Opened),t===_.SHARE&&y(d.PopUpState.Opened),t===_.RENAME&&x(d.PopUpState.Opened),t===_.EXPORT&&s(decodeURI(e.id)).then(e=>{L(e,c).then(e=>{V(`data:application/zip;base64,${e}`,`chat_with_attachments_${new Date().toLocaleDateString()}.dial`)})})},disabled:n}),m===d.PopUpState.Opened&&(0,p.jsx)(j,{locale:i,deleteConversation:T,onCloseModal:S}),v===d.PopUpState.Opened&&(0,p.jsx)(ye,{conversation:e,locale:i,onCloseModal:C,...u}),b===d.PopUpState.Opened&&(0,p.jsx)(be,{conversation:e,locale:i,renameConversation:E,onCloseModal:w})]})},Te=({disabled:e})=>(0,p.jsx)(`div`,{className:(0,c.default)(`flex items-center justify-center w-[24px]`,e?`cursor-not-allowed`:`cursor-pointer`),children:(0,p.jsx)(f.IconDotsVertical,{width:20,height:20,stroke:2,className:`text-primary`})}),Ee=({conversation:e,selectedConversationId:t,searchQuery:n,onConversationClick:r,isDisabled:i})=>{let{titles:a,conversationItemIcon:o}=A(),s=(0,l.useRef)(null),u=(0,h.getClearedConversationName)(e?.name);return(0,l.useEffect)(()=>{if(e?.id===t&&s?.current){let e=s.current.parentElement?.parentElement?.parentElement;if(e){let t=s.current.getBoundingClientRect(),n=e.getBoundingClientRect(),r=t.height,i=n.height,a=t.top-n.top+e.scrollTop-(i/2-r/2);e.scrollTo({top:a,behavior:`smooth`})}}},[e,t]),(0,p.jsxs)(`div`,{ref:s,className:(0,c.default)(`flex justify-between items-center py-2 px-3 border-transparent relative group border`,`conversation-item`,t===e?.id&&`bg-hues-100 conversation-item-active`,i?`cursor-not-allowed`:`cursor-pointer hover:border-hues-600`),onClick:()=>!i&&r(e.folderId,e?.id),title:i?a?.noActionsAllowed:u,children:[(0,p.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:[o||null,(0,p.jsx)(`h3`,{className:(0,c.default)(`truncate pb-px -mb-px font-semibold text-neutrals-1000 sm:body-2`,`conversation-item-text`,t===e?.id?`conversation-item-text-active`:``),title:i?a?.noActionsAllowed:u,children:n?.length?(0,p.jsx)(d.HighlightText,{text:u,highlightText:n}):u})]}),(0,p.jsx)(we,{conversation:e,isDisabled:i})]})},De=({handleConversationClick:e,selectedConversationId:t,groupLabel:n,groupedConversations:r,isDisabled:i,isCollapsed:a,onToggleCollapse:o})=>{let{titles:s}=A();return(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`conversation-group-items-title mb-3 inline-flex cursor-pointer items-center gap-1 text-neutrals-700`,onClick:o,children:[(0,p.jsx)(f.IconCaretRightFilled,{className:(0,c.default)(`w-3 h-3 conversation-group-items-arrow`,a?`rotate-[90deg]`:`rotate-0`)}),(0,p.jsx)(`span`,{className:`body-3 conversation-group-items-title-text`,children:O(n,s)})]}),!a&&(0,p.jsx)(`div`,{className:(0,c.default)(`flex flex-col gap-y-3`,`conversation-group-items`),children:D(r).map(n=>(0,p.jsx)(Ee,{isDisabled:i,conversation:n,selectedConversationId:t,onConversationClick:e},n.id||n.name))})]},n)},Oe=({searchQuery:e,isExpandedSearch:t,onSearchConversations:n,toggleSearchField:r})=>{let{titles:i,searchIcon:a}=A();return(0,p.jsx)(p.Fragment,{children:t?(0,p.jsx)(d.InputWithIcon,{inputId:`conversations-search`,placeholder:i?.searchPlaceholder??`Search`,containerClasses:`conversation-list-search-input h-[40px] bg-transparent px-4 py-2 rounded-full border-neutrals-400 shadow-none`,cssClass:`h-auto`,value:e,iconAfterInput:(0,p.jsx)(d.IconButton,{buttonClassName:`text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5`,onClick:r,icon:(0,p.jsx)(f.IconX,{})}),onChange:n}):(0,p.jsx)(d.Button,{buttonClassName:`text-button-tertiary p-0 search-button`,iconBefore:a||(0,p.jsx)(f.IconSearch,{className:`size-5`}),onClick:r})})},ke=({conversations:e,selectedConversationId:t,searchQuery:n,handleConversationClick:r,isDisabled:i})=>{let{titles:a}=A(),[o,s]=(0,l.useState)([]);return(0,l.useEffect)(()=>{s(D(e?.filter(e=>(0,h.getClearedConversationName)(e?.name)?.includes(n||``))))},[e,n]),(0,p.jsx)(p.Fragment,{children:o?.length?o.map(e=>(0,p.jsx)(Ee,{conversation:e,searchQuery:n,selectedConversationId:t,onConversationClick:r,isDisabled:i},e.id)):(0,p.jsx)(`h3`,{className:`text-neutrals-800`,children:a?.noConversation??`No conversations yet`})})},Ae=()=>{let{titles:e}=A();return(0,p.jsxs)(`div`,{className:`flex flex-col p-8 text-center`,children:[(0,p.jsx)(`p`,{className:`text-neutrals-800`,children:e?.noConversation??`No conversations yet`}),(0,p.jsx)(`p`,{className:`mt-2 text-sm text-neutrals-800`,children:e?.clickNewChat??`Click "New Chat" to start a conversation`})]})},je=({handleConversationClick:e,selectedConversationId:t,actions:n,children:r,isCollapsed:i,isStreaming:a,conversationStyles:o,conversations:s,locale:u,sharedConversations:f,setConversations:m,setSharedConversations:_,shareConversationProps:v,handleSelectedConversationRemove:x})=>{let[S,C]=(0,l.useState)({}),[w,T]=(0,l.useState)(!0),[D,O]=(0,l.useState)(``),[A,j]=(0,l.useState)(!1),[M,N]=(0,l.useState)(new Set),P=(0,l.useCallback)(e=>{N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),{getConversations:F,getSharedConversations:I,deleteConversation:L,renameConversation:R}=n,z=(0,l.useMemo)(()=>!!D?.length,[D]);(0,l.useEffect)(()=>{C({...b(f),...E(s)})},[s,f]),(0,l.useEffect)(()=>{async function e(){try{T(!0);let e=await F(u),t=await I((0,g.getSharedConversationsRequest)(g.ShareTarget.ME));m((0,h.cleanConversationNames)(e)),_((0,h.cleanConversationNames)(y(t,u)))}catch(e){console.error(`Error loading conversation`,e)}finally{T(!1)}}e()},[F,m,u,I,_]);let B=(0,l.useCallback)(async e=>{try{await L(e);let n=await F(u),r=await I((0,g.getSharedConversationsRequest)(g.ShareTarget.ME));m((0,h.cleanConversationNames)(n)),_((0,h.cleanConversationNames)(y(r,u))),t===e?.id&&x()}catch(e){console.error(`Error deleting conversation`,e)}},[L,F,u,I,m,_,t,x]),V=(0,l.useCallback)(async(e,t)=>{try{T(!0),await R(e,t);let n=await F(u),r=await I((0,g.getSharedConversationsRequest)(g.ShareTarget.ME));m((0,h.cleanConversationNames)(n)),_((0,h.cleanConversationNames)(y(r,u)))}catch(e){console.error(`Error renaming conversation`,e)}finally{T(!1)}},[F,u,I,m,_,R]),H=(0,l.useCallback)(e=>{O(e)},[O]),U=(0,l.useCallback)(()=>{j(e=>!e),O(``)},[j]);return w?(0,p.jsx)(d.Loader,{}):(0,p.jsx)(Se,{value:{locale:u,deleteConversation:B,renameConversation:V,getConversation:n.getConversation,getFileBlob:n.getFileBlob,shareConversationProps:v},children:(0,p.jsxs)(k.Provider,{value:o,children:[!i&&(0,p.jsxs)(`div`,{className:(0,c.default)(`flex justify-between items-center pr-6`,A?` pt-4 pb-0 sm:pt-10`:` pt-6 pb-2 sm:pt-10`),children:[!A&&(0,p.jsx)(`h3`,{className:`sm:body-2 text-neutrals-700`,children:o?.titles?.allChats??`All Chats`}),(0,p.jsx)(Oe,{searchQuery:D,isExpandedSearch:A,onSearchConversations:H,toggleSearchField:U})]}),(0,p.jsx)(`div`,{className:`scroll-hidden-container mt-4 flex min-h-0 flex-1 flex-col`,children:i?null:(0,p.jsx)(`div`,{className:(0,c.default)(`flex flex-col pr-4`,z?`gap-y-1`:`gap-y-6`),children:s?.length===0&&f?.length===0?(0,p.jsx)(Ae,{}):z?(0,p.jsx)(ke,{conversations:[...f,...s],searchQuery:D,selectedConversationId:t,handleConversationClick:e,isDisabled:a}):Object.entries(S).map(([n,r])=>r?.length>0&&(0,p.jsx)(De,{isDisabled:a,groupLabel:n,groupedConversations:r,handleConversationClick:e,selectedConversationId:t,isCollapsed:M.has(n),onToggleCollapse:()=>P(n)},n))})}),r]})})},Me=({onCloseModal:e,disableModalDividers:t,signOut:n,isSmallButton:r,locale:i,titles:a})=>(0,p.jsxs)(d.Popup,{heading:a?.popupTitle||`Log out?`,portalId:`sign-out`,containerClassName:`sign-out-popup`,size:d.PopUpSize.SM,dividers:!t,onClose:e,closeButtonTitle:`Cancel`,children:[(0,p.jsx)(`div`,{className:`px-6 py-4 sm:px-0`,lang:i,children:a?.popupText}),(0,p.jsxs)(`div`,{className:`delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3`,children:[(0,p.jsx)(d.Button,{buttonClassName:`cancel-button`,title:a?.popupCancel||`Cancel`,isSmallButton:r,onClick:t=>{t.stopPropagation(),e()}}),(0,p.jsx)(d.Button,{buttonClassName:`text-button-primary`,title:a?.popupApply||`Sign Out`,isSmallButton:r,onClick:e=>{e.stopPropagation(),n?.()}})]})]}),Ne=({userInfo:e,signOutAction:t,contactSupportUrl:n,styles:r,locale:i,titles:a})=>{let o=e=>e?.split(` `)?.map((e,t)=>t<2?e[0].toUpperCase():``)?.join(``)??``,s=(0,l.useMemo)(()=>e?.name?o(e?.name):e?.email?.[0].toUpperCase()??``,[e]),[u,f]=(0,l.useState)(!1),m=e?.name?.split(` `),h=m?`${m?.[0]??``} ${m?.[1]?.[0]?m?.[1]?.[0]+`.`:``}`:e?.email??``,g=(0,l.useCallback)(()=>{f(!0)},[]),_=(0,l.useCallback)(()=>{f(!1)},[]),v=(0,l.useCallback)(()=>{window.open(n||`#`,`_blank`,`noopener,noreferrer`)},[n]),y=(0,l.useMemo)(()=>(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`div`,{className:(0,c.default)(`cursor-pointer flex items-center justify-center size-11 rounded-[100px] p-[10px] sm:h-[32px] sm:w-[32px] flex-shrink-0`,r?.initialStyles),children:s}),(0,p.jsx)(`p`,{className:(0,c.default)(`h3 cursor-pointer overflow-hidden text-ellipsis`,r?.userNameStyles),children:(r?.showShortName?h:e?.name)??e?.email??``})]}),[s,h,r,e]),b=(0,l.useMemo)(()=>(0,p.jsxs)(`div`,{className:(0,c.default)(`py-1`,r?.dropDownStyles),children:[r?.settingsIcon&&(0,p.jsxs)(`button`,{className:(0,c.default)(`p-2 items-center flex gap-1 text-primary fill-primary`,r?.dropdownButtonTypographyStyles||`body-1`,r?.dropdownButtonStyles),title:a?.settings,children:[(0,p.jsx)(`span`,{className:`shrink-0`,children:r?.settingsIcon}),(0,p.jsx)(`span`,{className:`min-w-0 break-words`,children:a?.settings||`Settings`})]}),r?.contactSupportIcon&&(0,p.jsxs)(`button`,{className:(0,c.default)(`p-2 items-center flex gap-1 text-primary fill-primary`,r?.dropdownButtonTypographyStyles||`body-1`,r?.dropdownButtonStyles),title:a?.contactSupport,onClick:v,children:[(0,p.jsx)(`span`,{className:`shrink-0`,children:r?.contactSupportIcon}),(0,p.jsx)(`span`,{className:`min-w-0 break-words`,children:a?.contactSupport||`Contact support`})]}),(0,p.jsx)(`div`,{className:(0,c.default)(`h-0 border-t border-neutrals-600 my-2`,r?.showSeparator?`block`:`hidden`)}),(0,p.jsxs)(`button`,{className:(0,c.default)(`p-2 items-center flex gap-1 text-primary fill-primary`,r?.dropdownButtonTypographyStyles||`body-1`,r?.dropdownButtonStyles),title:a?.signOut,onClick:g,children:[(0,p.jsx)(`span`,{className:`shrink-0`,children:r?.signOutIcon}),(0,p.jsx)(`span`,{className:`min-w-0 break-words`,children:a?.signOut||`Sign out`}),u&&(0,p.jsx)(Me,{onCloseModal:_,signOut:()=>t?.(),locale:i,disableModalDividers:r?.disableModalDividers,titles:a})]})]}),[r,a,g,v,u,_,i,t]);if(e)return(0,p.jsx)(d.Dropdown,{containerClassName:(0,c.default)(`transition-opacity group-hover:opacity-100 shrink w-full`,r?.dropdownContainerClassName),triggerButton:y,content:b,openedClassName:`action-menu-opened`})};exports.ActionMenu=we,exports.ActionMenuItem=_,exports.ConversationList=je,exports.User=Ne,exports.getSharedConversationsGroup=b,exports.transformSharedConversations=y;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("classnames");c=s(c);let l=require("react");l=s(l);let u=require("lodash"),d=require("@epam/statgpt-ui-components"),f=require("@tabler/icons-react"),p=require("react/jsx-runtime"),m=require("jszip");m=s(m);let h=require("@epam/statgpt-shared-toolkit"),g=require("@epam/statgpt-dial-toolkit");var _=function(e){return e.DELETE=`delete`,e.EXPORT=`export`,e.SHARE=`share`,e.RENAME=`rename`,e}({}),v=function(e){return e.SHARED=`shared`,e.TODAY=`today`,e.YESTERDAY=`yesterday`,e.WEEK=`week`,e.EARLIER=`earlier`,e}({}),y=(e,t)=>e?.resources?.filter(e=>e?.parentPath===t)?.map(e=>{let n=`${e?.bucket}/${t}`,r=e?.url?.split(`/`)?.slice(1)?.join(`/`);return{...e,folderId:n,id:r,isShared:!0}})||[],b=e=>({[v.SHARED]:e}),x={[v.TODAY]:[],[v.YESTERDAY]:[],[v.WEEK]:[],[v.EARLIER]:[]},S=(e,t)=>e.toDateString()===t.toDateString(),C=(e,t)=>S(t,new Date(e.getFullYear(),e.getMonth(),e.getDate()-1)),w=(e,t)=>{let n=e.getTime()-t.getTime();return Math.floor(n/(1e3*60*60*24))},T=e=>e.updatedAt||Number(e.id?.split(`-`).pop()),E=e=>{let t=new Date,n=(0,u.cloneDeep)(x);for(let r of e)if(r.updatedAt){let e=new Date(r.updatedAt),i;i=S(t,e)?n[v.TODAY]:C(t,e)?n[v.YESTERDAY]:w(t,e)<=7?n[v.WEEK]:n[v.EARLIER],i?.some(e=>e.id===r.id)||i.push(r)}return n},D=e=>e?.sort((e,t)=>(T(t)||0)-(T(e)||0)),O=(e,t)=>e===v.SHARED?t?.shared||`Shared`:e===v.TODAY?t?.today||`Today`:e===v.YESTERDAY?t?.yesterday||`Yesterday`:e===v.WEEK?t?.lastWeek||`Last week`:t?.earlier||`Earlier`,k=(0,l.createContext)(null);function A(){let e=(0,l.useContext)(k);if(!e)throw Error(`useConversationStyles must be used within ConversationStylesContext.Provider`);return e}var j=({onCloseModal:e,deleteConversation:t,locale:n})=>{let{titles:r,disableModalDividers:i,isSmallModalButton:a}=A();return(0,p.jsxs)(d.Popup,{heading:r?.deleteTitle??`Delete conversation`,portalId:`delete-conversation`,containerClassName:`delete-conversation-popup`,size:d.PopUpSize.SM,dividers:!i,onClose:e,closeButtonTitle:r?.close??`Cancel`,children:[(0,p.jsx)(`div`,{className:`px-6 py-4 sm:px-0`,lang:n,children:r?.deleteMessage??`Are you sure you want to delete this conversation? This action cannot be undone.`}),(0,p.jsxs)(`div`,{className:`delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3`,children:[(0,p.jsx)(d.Button,{buttonClassName:`cancel-button`,title:r?.cancel??`Cancel`,isSmallButton:a,onClick:t=>{t.stopPropagation(),e()}}),(0,p.jsx)(d.Button,{buttonClassName:`text-button-primary text-button-primary-error`,title:r?.delete??`Delete`,isSmallButton:a,onClick:e=>{e.stopPropagation(),t()}})]})]})},M=e=>(0,u.uniqBy)(I((0,h.getConversationAttachments)(e)).map(e=>({...e,relativePath:``,contentLength:0})),e=>B(e.relativePath,e.name)),N=e=>e.endsWith(`/`),P=e=>{let t=e.toLowerCase();return[`data:`,`//`,`http://`,`https://`,`file://`,`ftp://`,`mailto:`,`telnet://`,`api/files`].some(e=>t.startsWith(e))},F=e=>{let t=B(...e.split(`/`).map(e=>decodeURIComponent(e))),n=t.lastIndexOf(`/`);return{absolutePath:t.slice(0,n),name:t.slice(n+1)}},I=e=>e?e.map(e=>{if(!e.url||P(e.url)||N(e.url))return null;let{absolutePath:t,name:n}=F(e.url);return{id:e.url,name:n,contentType:e.type,folderId:t,absolutePath:t}}).filter(Boolean):[];async function L(e,t){let n=M(e),r=new m.default;n.forEach(e=>{let n=t(`${encodeURI(B(e.absolutePath,e.name))}`.replace(`files/`,``)),i=B(`res`,R(e.folderId),e.name);r.file(i,n)});let i={version:5,history:[e].map(z)||[],folders:[]},a=JSON.stringify(i,null,2);return r.file(`conversations/conversations_history.json`,a),await r.generateAsync({type:`base64`})}var R=e=>{let t=e.split(`/`);return t.length>2?B(...t.slice(2)):void 0},z=e=>(0,u.omit)(e,[`publicationInfo`]),B=(...e)=>e.filter(Boolean).join(`/`);function V(e,t){let n=document.createElement(`a`);n.download=t,n.href=e,n.style.display=`none`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}var H=Object.defineProperty,U=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,K=(e,t,n)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q=(e,t)=>{for(var n in t||={})W.call(t,n)&&K(e,n,t[n]);if(U)for(var n of U(t))G.call(t,n)&&K(e,n,t[n]);return e},J=(e,t)=>{var n={};for(var r in e)W.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&U)for(var r of U(e))t.indexOf(r)<0&&G.call(e,r)&&(n[r]=e[r]);return n},Y;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(Y||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(Y||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(Y||={});var X=Y,ee={L:X.QrCode.Ecc.LOW,M:X.QrCode.Ecc.MEDIUM,Q:X.QrCode.Ecc.QUARTILE,H:X.QrCode.Ecc.HIGH},te=128,Z=`L`,Q=`#FFFFFF`,ne=`#000000`,re=!1,ie=1,ae=4,oe=0,se=.1;function ce(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function le(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function ue(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*se),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function de(e,t){return t==null?e?ae:oe:Math.max(Math.floor(t),0)}function fe({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=l.default.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...X.QrSegment.makeSegments(t)),e),[]);return X.QrCode.encodeSegments(r,ee[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:u,margin:d,numCells:f,calculatedImageSettings:p}=l.default.useMemo(()=>{let e=c.getModules(),t=de(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:ue(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:d,cells:u,numCells:f,calculatedImageSettings:p}}var pe=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),me=l.default.forwardRef(function(e,t){let n=e,{value:r,size:i=te,level:a=Z,bgColor:o=Q,fgColor:s=ne,includeMargin:c=re,minVersion:u=ie,boostLevel:d,marginSize:f,imageSettings:p}=n,m=J(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:h}=m,g=J(m,[`style`]),_=p?.src,v=l.default.useRef(null),y=l.default.useRef(null),b=l.default.useCallback(e=>{v.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[x,S]=l.default.useState(!1),{margin:C,cells:w,numCells:T,calculatedImageSettings:E}=fe({value:r,level:a,minVersion:u,boostLevel:d,includeMargin:c,marginSize:f,imageSettings:p,size:i});l.default.useEffect(()=>{if(v.current!=null){let e=v.current,t=e.getContext(`2d`);if(!t)return;let n=w,r=y.current,a=E!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&E.excavation!=null&&(n=le(w,E.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/T*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,T,T),t.fillStyle=s,pe?t.fill(new Path2D(ce(n,C))):w.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+C,n+C,1,1)})}),E&&(t.globalAlpha=E.opacity),a&&t.drawImage(r,E.x+C,E.y+C,E.w,E.h)}}),l.default.useEffect(()=>{S(!1)},[_]);let D=q({height:i,width:i},h),O=null;return _!=null&&(O=l.default.createElement(`img`,{src:_,key:_,style:{display:`none`},onLoad:()=>{S(!0)},ref:y,crossOrigin:E?.crossOrigin})),l.default.createElement(l.default.Fragment,null,l.default.createElement(`canvas`,q({style:D,height:i,width:i,ref:b,role:`img`},g)),O)});me.displayName=`QRCodeCanvas`;var he=l.default.forwardRef(function(e,t){let n=e,{value:r,size:i=te,level:a=Z,bgColor:o=Q,fgColor:s=ne,includeMargin:c=re,minVersion:u=ie,boostLevel:d,title:f,marginSize:p,imageSettings:m}=n,h=J(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:g,cells:_,numCells:v,calculatedImageSettings:y}=fe({value:r,level:a,minVersion:u,boostLevel:d,includeMargin:c,marginSize:p,imageSettings:m,size:i}),b=_,x=null;m!=null&&y!=null&&(y.excavation!=null&&(b=le(_,y.excavation)),x=l.default.createElement(`image`,{href:m.src,height:y.h,width:y.w,x:y.x+g,y:y.y+g,preserveAspectRatio:`none`,opacity:y.opacity,crossOrigin:y.crossOrigin}));let S=ce(b,g);return l.default.createElement(`svg`,q({height:i,width:i,viewBox:`0 0 ${v} ${v}`,ref:t,role:`img`},h),!!f&&l.default.createElement(`title`,null,f),l.default.createElement(`path`,{fill:o,d:`M0,0 h${v}v${v}H0z`,shapeRendering:`crispEdges`}),l.default.createElement(`path`,{fill:s,d:S,shapeRendering:`crispEdges`}),x)});he.displayName=`QRCodeSVG`;var ge=(e,t)=>({invitationType:g.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(e)}`},...t]}),_e=e=>`/${h.SHARE_CONVERSATION_ROUTE}/${e?.invitationLink?.split(`/`).at(-1)||``}`,ve=(e,t)=>t?.find(t=>{let n=e?.id?.split(`/`)?.pop(),r=t?.url?.split(`/`)?.pop()||``;return r===n||decodeURI(r)===n}),ye=e=>(e?.messages?.filter(e=>!!e?.custom_content?.attachments))?.flatMap(e=>e?.custom_content?.attachments?.map(e=>({url:e?.url||``}))||[])?.filter(e=>!!e?.url)||[],be=({conversation:e,locale:t,onCloseModal:n,modalDividers:r,getConversation:i,generateConversationLink:a,chatExpiration:o,chatExpirationDays:s,close:c,chatWarning:u,shareLink:m,shareCopyLink:_,shareCopiedLink:v,shareDescription:y,shareRemoveAccessToUsers:b,chatName:x,getSharedConversations:S,revokeSharedConversations:C,baseUrl:w,id:T,clientSharedPage:E,clientSharedProp:D,shareAlertMessage:O})=>{let[k,A]=(0,l.useState)(null),[j,M]=(0,l.useState)(),[N,P]=(0,l.useState)(!1),[F,I]=(0,l.useState)(!1),[L,R]=(0,l.useState)(),z=(0,l.useRef)(null),B=(0,l.useRef)(null),V=(0,l.useMemo)(()=>e?.id?decodeURI(e.id):T?.[0]&&T?.[1]&&t?decodeURI(`${T[0]}/${t}/${T[1]}`):null,[e?.id,T,t]),H=(0,l.useMemo)(()=>{if(!k)return``;let e=w||window.location.origin;return w&&w!==window.location.origin&&E&&D?`${e}/${E}?${D}=${k.split(`/${h.SHARE_CONVERSATION_ROUTE}/`)?.[1]}`:`${e}/${t}${k}`},[w,k,t,E,D]),U=(0,l.useCallback)(async e=>{let t=await S?.((0,g.getSharedConversationsRequest)(g.ShareTarget.OTHERS));if(t)return ve({id:e},t.resources)},[S]);(0,l.useEffect)(()=>{if(!V||z.current===V)return;z.current=V,P(!1),B.current?.abort();let e=new AbortController;return B.current=e,(async()=>{try{let t=ge(V,ye(await i?.(V))),n=await a?.(t),r=await U(V);if(e.signal.aborted||!n)return;A(_e(n)),M(r),P(!0)}catch(t){if(e.signal.aborted)return;P(!1),console.error(`Error sharing conversation`,t)}})(),()=>{e.abort(),z.current=null}},[V,a,i,U]);let W=(0,l.useCallback)(()=>{B.current?.abort(),z.current=null,n(),A(null),P(!1),I(!1)},[n]),G=(0,l.useCallback)(()=>{I(!0),navigator.clipboard.writeText(H||``)},[H]),K=async()=>{try{if(R(!0),j&&await C?.({resources:[j]}),V){let e=await U(V);B.current?.signal.aborted||M(e)}}catch(e){console.error(`Error revoking shared conversation`,e)}finally{B.current?.signal.aborted||R(!1)}},q=(0,l.useCallback)(()=>(0,p.jsx)(d.Button,{buttonClassName:F?`text-button-secondary`:`text-button-primary`,iconBefore:F?(0,p.jsx)(f.IconCheck,{width:20,height:20}):(0,p.jsx)(f.IconCopy,{width:20,height:20}),title:F?v??`Copied`:_??`Copy link`,disabled:F,onClick:G}),[F,G,v,_]);return(0,p.jsxs)(d.Popup,{heading:m??`Share link`,portalId:`share`,size:d.PopUpSize.SM,dividers:r,onClose:W,closeButtonTitle:c??`Close`,children:[N?(0,p.jsxs)(`div`,{className:`share flex flex-col gap-y-4 overflow-auto px-6 pb-6 sm:p-0`,children:[O?(0,p.jsx)(d.InlineAlert,{type:d.InlineAlertType.Note,icon:(0,p.jsx)(f.IconInfoCircle,{width:16,height:16}),children:O}):null,e?.name?(0,p.jsxs)(`div`,{className:`share-info flex w-full`,children:[(0,p.jsx)(`p`,{className:`share-info-title body-1 mr-1 text-neutrals-800`,children:x??`Chat name:`}),(0,p.jsx)(`h3`,{className:`min-w-0 flex-1 truncate`,title:e?.name,children:e?.name})]}):null,(0,p.jsxs)(`div`,{className:`share-info flex`,children:[(0,p.jsx)(`p`,{className:`share-info-title body-1 mr-1 text-neutrals-800`,children:o??`Link expiration date:`}),(0,p.jsxs)(`h3`,{children:[`3 `,s??`days`]})]}),(0,p.jsx)(he,{className:`min-h-[200px] self-center rounded border border-neutrals-600 p-2`,value:H,size:200}),(0,p.jsx)(`p`,{className:`body-2 text-neutrals-1000`,children:y??`Your name, special instructions, and any messages you add after sharing remain confidential.`}),(0,p.jsx)(d.InputWithIcon,{containerClasses:`share-input-container`,cssClass:`share-input`,readonly:!0,placeholder:H,value:H,inputId:`conversationLink`,iconAfterInput:q()})]}):(0,p.jsx)(`div`,{className:`flex items-center justify-center p-6`,children:(0,p.jsx)(d.Loader,{})}),N?e&&j?(0,p.jsx)(`div`,{className:`remove-access`,children:(0,p.jsx)(d.Button,{title:b??`Remove access to all users`,buttonClassName:`remove-access-button py-3 px-4`,isSmallButton:!0,disabled:L,onClick:K})}):(0,p.jsx)(`p`,{className:`body-2 share-footer text-neutrals-800`,children:u??`This chat has not been shared with anyone yet.`}):(0,p.jsx)(`div`,{})]})},xe=({conversation:e,onCloseModal:t,renameConversation:n,locale:r})=>{let{titles:i,disableModalDividers:a,isSmallModalButton:o}=A(),[s,c]=(0,l.useState)(e?.name||``),u=e=>{c(e)},f=()=>{let t=`${e?.folderId}/${encodeURIComponent((0,h.getClearedConversationName)(s))}-${new Date().getTime()}`;n(`conversations/${e.id}`,`conversations/${t}`)};return(0,p.jsxs)(d.Popup,{heading:i?.renameTitle??`Rename conversation`,portalId:`rename-conversation`,containerClassName:`rename-conversation-popup`,size:d.PopUpSize.SM,dividers:!a,onClose:t,closeButtonTitle:i?.close??`Cancel`,children:[(0,p.jsx)(`div`,{className:`px-6 py-4 sm:px-0`,lang:r,children:(0,p.jsx)(d.Input,{inputId:`rename`,value:s,onChange:u,cssClass:`w-full`})}),(0,p.jsxs)(`div`,{className:`delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3`,children:[(0,p.jsx)(d.Button,{buttonClassName:`cancel-button`,title:i?.cancel??`Cancel`,isSmallButton:o,onClick:e=>{e.stopPropagation(),t()}}),(0,p.jsx)(d.Button,{buttonClassName:`text-button-primary text-button-primary`,title:i?.save??`Rename`,isSmallButton:o,disabled:!s,onClick:e=>{e.stopPropagation(),f()}})]})]})},Se=(0,l.createContext)(null);function Ce({children:e,value:t}){return(0,p.jsx)(Se.Provider,{value:t,children:e})}function we(){let e=(0,l.useContext)(Se);if(!e)throw Error(`useConversationListActions must be used within ConversationListActionsProvider`);return e}var $=({conversation:e,triggerButton:t,isDisabled:n})=>{let r=A(),{locale:i,deleteConversation:a,renameConversation:o,getConversation:s,getFileBlob:c,shareConversationProps:u}=we(),f=(0,l.useMemo)(()=>{let t=[{key:_.DELETE,title:r?.titles?.delete??`Delete`,icon:r.actionsIcons?.[_.DELETE]}];return e?.model?.id?.endsWith(h.ONBOARDING_MODEL_POSTFIX)?t:[...e.isShared?[]:[{key:_.SHARE,title:r?.titles?.share??`Share`,icon:r.actionsIcons?.[_.SHARE]},{key:_.RENAME,title:r?.titles?.rename??`Rename`,icon:r.actionsIcons?.[_.RENAME]}],{key:_.EXPORT,title:r?.titles?.export??`Export`,icon:r.actionsIcons?.[_.EXPORT]},...t]},[e.isShared,e?.model?.id,r.titles,r.actionsIcons]),[m,g]=(0,l.useState)(d.PopUpState.Closed),[v,y]=(0,l.useState)(d.PopUpState.Closed),[b,x]=(0,l.useState)(d.PopUpState.Closed),S=(0,l.useCallback)(()=>{g(d.PopUpState.Closed)},[g]),C=(0,l.useCallback)(()=>{y(d.PopUpState.Closed)},[y]),w=(0,l.useCallback)(()=>{x(d.PopUpState.Closed)},[x]),T=(0,l.useCallback)(()=>{a(e),S()},[e,a,S]),E=(0,l.useCallback)((e,t)=>{o(e,t),w()},[o,w]);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(d.Dropdown,{containerClassName:`ml-3 hidden group-hover:flex`,triggerButton:t??(0,p.jsx)(Te,{disabled:n}),options:f,openedClassName:`!flex action-menu-opened`,onOptionSelect:t=>{t===_.DELETE&&g(d.PopUpState.Opened),t===_.SHARE&&y(d.PopUpState.Opened),t===_.RENAME&&x(d.PopUpState.Opened),t===_.EXPORT&&s(decodeURI(e.id)).then(e=>{L(e,c).then(e=>{V(`data:application/zip;base64,${e}`,`chat_with_attachments_${new Date().toLocaleDateString()}.dial`)})})},disabled:n}),m===d.PopUpState.Opened&&(0,p.jsx)(j,{locale:i,deleteConversation:T,onCloseModal:S}),v===d.PopUpState.Opened&&(0,p.jsx)(be,{conversation:e,locale:i,onCloseModal:C,...u}),b===d.PopUpState.Opened&&(0,p.jsx)(xe,{conversation:e,locale:i,renameConversation:E,onCloseModal:w})]})},Te=({disabled:e})=>(0,p.jsx)(`div`,{className:(0,c.default)(`flex items-center justify-center w-[24px]`,e?`cursor-not-allowed`:`cursor-pointer`),children:(0,p.jsx)(f.IconDotsVertical,{width:20,height:20,stroke:2,className:`text-primary`})}),Ee=({conversation:e,selectedConversationId:t,searchQuery:n,onConversationClick:r,isDisabled:i})=>{let{titles:a,conversationItemIcon:o}=A(),s=(0,l.useRef)(null),u=(0,h.getClearedConversationName)(e?.name);return(0,l.useEffect)(()=>{if(e?.id===t&&s?.current){let e=s.current.parentElement?.parentElement?.parentElement;if(e){let t=s.current.getBoundingClientRect(),n=e.getBoundingClientRect(),r=t.height,i=n.height,a=t.top-n.top+e.scrollTop-(i/2-r/2);e.scrollTo({top:a,behavior:`smooth`})}}},[e,t]),(0,p.jsxs)(`div`,{ref:s,className:(0,c.default)(`flex justify-between items-center py-2 px-3 border-transparent relative group border`,`conversation-item`,t===e?.id&&`bg-hues-100 conversation-item-active`,i?`cursor-not-allowed`:`cursor-pointer hover:border-hues-600`),onClick:()=>!i&&r(e.folderId,e?.id),title:i?a?.noActionsAllowed:u,children:[(0,p.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:[o||null,(0,p.jsx)(`h3`,{className:(0,c.default)(`truncate pb-px -mb-px font-semibold text-neutrals-1000 sm:body-2`,`conversation-item-text`,t===e?.id?`conversation-item-text-active`:``),title:i?a?.noActionsAllowed:u,children:n?.length?(0,p.jsx)(d.HighlightText,{text:u,highlightText:n}):u})]}),(0,p.jsx)($,{conversation:e,isDisabled:i})]})},De=({handleConversationClick:e,selectedConversationId:t,groupLabel:n,groupedConversations:r,isDisabled:i,isCollapsed:a,onToggleCollapse:o})=>{let{titles:s}=A();return(0,p.jsxs)(`div`,{children:[(0,p.jsxs)(`div`,{className:`conversation-group-items-title mb-3 inline-flex cursor-pointer items-center gap-1 text-neutrals-700`,onClick:o,children:[(0,p.jsx)(f.IconCaretRightFilled,{className:(0,c.default)(`w-3 h-3 conversation-group-items-arrow`,a?`rotate-[90deg]`:`rotate-0`)}),(0,p.jsx)(`span`,{className:`body-3 conversation-group-items-title-text`,children:O(n,s)})]}),!a&&(0,p.jsx)(`div`,{className:(0,c.default)(`flex flex-col gap-y-3`,`conversation-group-items`),children:D(r).map(n=>(0,p.jsx)(Ee,{isDisabled:i,conversation:n,selectedConversationId:t,onConversationClick:e},n.id||n.name))})]},n)},Oe=({searchQuery:e,isExpandedSearch:t,onSearchConversations:n,toggleSearchField:r})=>{let{titles:i,searchIcon:a}=A();return(0,p.jsx)(p.Fragment,{children:t?(0,p.jsx)(d.InputWithIcon,{inputId:`conversations-search`,placeholder:i?.searchPlaceholder??`Search`,containerClasses:`conversation-list-search-input h-[40px] bg-transparent px-4 py-2 rounded-full border-neutrals-400 shadow-none`,cssClass:`h-auto`,value:e,iconAfterInput:(0,p.jsx)(d.IconButton,{buttonClassName:`text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5`,onClick:r,icon:(0,p.jsx)(f.IconX,{})}),onChange:n}):(0,p.jsx)(d.Button,{buttonClassName:`text-button-tertiary p-0 search-button`,iconBefore:a||(0,p.jsx)(f.IconSearch,{className:`size-5`}),onClick:r})})},ke=({conversations:e,selectedConversationId:t,searchQuery:n,handleConversationClick:r,isDisabled:i})=>{let{titles:a}=A(),[o,s]=(0,l.useState)([]);return(0,l.useEffect)(()=>{s(D(e?.filter(e=>(0,h.getClearedConversationName)(e?.name)?.includes(n||``))))},[e,n]),(0,p.jsx)(p.Fragment,{children:o?.length?o.map(e=>(0,p.jsx)(Ee,{conversation:e,searchQuery:n,selectedConversationId:t,onConversationClick:r,isDisabled:i},e.id)):(0,p.jsx)(`h3`,{className:`text-neutrals-800`,children:a?.noConversation??`No conversations yet`})})},Ae=()=>{let{titles:e}=A();return(0,p.jsxs)(`div`,{className:`flex flex-col p-8 text-center`,children:[(0,p.jsx)(`p`,{className:`text-neutrals-800`,children:e?.noConversation??`No conversations yet`}),(0,p.jsx)(`p`,{className:`mt-2 text-sm text-neutrals-800`,children:e?.clickNewChat??`Click "New Chat" to start a conversation`})]})},je=({handleConversationClick:e,selectedConversationId:t,actions:n,children:r,isCollapsed:i,isStreaming:a,conversationStyles:o,conversations:s,locale:u,sharedConversations:f,setConversations:m,setSharedConversations:_,shareConversationProps:v,handleSelectedConversationRemove:x})=>{let[S,C]=(0,l.useState)({}),[w,T]=(0,l.useState)(!0),[D,O]=(0,l.useState)(!1),[A,j]=(0,l.useState)(``),[M,N]=(0,l.useState)(!1),[P,F]=(0,l.useState)(new Set),I=(0,l.useCallback)(e=>{F(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),{getConversations:L,getSharedConversations:R,deleteConversation:z,renameConversation:B}=n,V=(0,l.useMemo)(()=>!!A?.length,[A]);(0,l.useEffect)(()=>{C({...b(f),...E(s)})},[s,f]),(0,l.useEffect)(()=>{async function e(){try{T(!0);let e=await L(u),t=await R((0,g.getSharedConversationsRequest)(g.ShareTarget.ME));m((0,h.cleanConversationNames)(e)),_((0,h.cleanConversationNames)(y(t,u)))}catch(e){console.error(`Error loading conversation`,e)}finally{T(!1),O(!0)}}e()},[L,m,u,R,_]);let H=(0,l.useCallback)(async e=>{try{await z(e);let n=await L(u),r=await R((0,g.getSharedConversationsRequest)(g.ShareTarget.ME));m((0,h.cleanConversationNames)(n)),_((0,h.cleanConversationNames)(y(r,u))),t===e?.id&&x()}catch(e){console.error(`Error deleting conversation`,e)}},[z,L,u,R,m,_,t,x]),U=(0,l.useCallback)(async(e,t)=>{try{T(!0),await B(e,t);let n=await L(u),r=await R((0,g.getSharedConversationsRequest)(g.ShareTarget.ME));m((0,h.cleanConversationNames)(n)),_((0,h.cleanConversationNames)(y(r,u)))}catch(e){console.error(`Error renaming conversation`,e)}finally{T(!1)}},[L,u,R,m,_,B]),W=(0,l.useCallback)(e=>{j(e)},[j]),G=(0,l.useCallback)(()=>{N(e=>!e),j(``)},[N]);return w&&!D?(0,p.jsx)(d.Loader,{}):(0,p.jsx)(Ce,{value:{locale:u,deleteConversation:H,renameConversation:U,getConversation:n.getConversation,getFileBlob:n.getFileBlob,shareConversationProps:v},children:(0,p.jsxs)(k.Provider,{value:o,children:[!i&&(0,p.jsxs)(`div`,{className:(0,c.default)(`flex justify-between items-center pr-6`,M?` pt-4 pb-0 sm:pt-10`:` pt-6 pb-2 sm:pt-10`),children:[!M&&(0,p.jsx)(`h3`,{className:`sm:body-2 text-neutrals-700`,children:o?.titles?.allChats??`All Chats`}),(0,p.jsx)(Oe,{searchQuery:A,isExpandedSearch:M,onSearchConversations:W,toggleSearchField:G})]}),(0,p.jsx)(`div`,{className:`scroll-hidden-container mt-4 flex min-h-0 flex-1 flex-col`,children:(0,p.jsx)(`div`,{className:(0,c.default)(`flex flex-col pr-4`,V?`gap-y-1`:`gap-y-6`,i&&`hidden`),children:s?.length===0&&f?.length===0?(0,p.jsx)(Ae,{}):V?(0,p.jsx)(ke,{conversations:[...f,...s],searchQuery:A,selectedConversationId:t,handleConversationClick:e,isDisabled:a}):Object.entries(S).map(([n,r])=>r?.length>0&&(0,p.jsx)(De,{isDisabled:a,groupLabel:n,groupedConversations:r,handleConversationClick:e,selectedConversationId:t,isCollapsed:P.has(n),onToggleCollapse:()=>I(n)},n))})}),r]})})},Me=({onCloseModal:e,disableModalDividers:t,signOut:n,isSmallButton:r,locale:i,titles:a})=>(0,p.jsxs)(d.Popup,{heading:a?.popupTitle||`Log out?`,portalId:`sign-out`,containerClassName:`sign-out-popup`,size:d.PopUpSize.SM,dividers:!t,onClose:e,closeButtonTitle:`Cancel`,children:[(0,p.jsx)(`div`,{className:`px-6 py-4 sm:px-0`,lang:i,children:a?.popupText}),(0,p.jsxs)(`div`,{className:`delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3`,children:[(0,p.jsx)(d.Button,{buttonClassName:`cancel-button`,title:a?.popupCancel||`Cancel`,isSmallButton:r,onClick:t=>{t.stopPropagation(),e()}}),(0,p.jsx)(d.Button,{buttonClassName:`text-button-primary`,title:a?.popupApply||`Sign Out`,isSmallButton:r,onClick:e=>{e.stopPropagation(),n?.()}})]})]}),Ne=({userInfo:e,signOutAction:t,contactSupportUrl:n,styles:r,locale:i,titles:a})=>{let o=e=>e?.split(` `)?.map((e,t)=>t<2?e[0].toUpperCase():``)?.join(``)??``,s=(0,l.useMemo)(()=>e?.name?o(e?.name):e?.email?.[0].toUpperCase()??``,[e]),[u,f]=(0,l.useState)(!1),m=e?.name?.split(` `),h=m?`${m?.[0]??``} ${m?.[1]?.[0]?m?.[1]?.[0]+`.`:``}`:e?.email??``,g=(0,l.useCallback)(()=>{f(!0)},[]),_=(0,l.useCallback)(()=>{f(!1)},[]),v=(0,l.useCallback)(()=>{window.open(n||`#`,`_blank`,`noopener,noreferrer`)},[n]),y=(0,l.useMemo)(()=>(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`div`,{className:(0,c.default)(`cursor-pointer flex items-center justify-center size-11 rounded-[100px] p-[10px] sm:h-[32px] sm:w-[32px] flex-shrink-0`,r?.initialStyles),children:s}),(0,p.jsx)(`p`,{className:(0,c.default)(`h3 cursor-pointer overflow-hidden text-ellipsis`,r?.userNameStyles),children:(r?.showShortName?h:e?.name)??e?.email??``})]}),[s,h,r,e]),b=(0,l.useMemo)(()=>(0,p.jsxs)(`div`,{className:(0,c.default)(`py-1`,r?.dropDownStyles),children:[r?.settingsIcon&&(0,p.jsxs)(`button`,{className:(0,c.default)(`p-2 items-center flex gap-1 text-primary fill-primary`,r?.dropdownButtonTypographyStyles||`body-1`,r?.dropdownButtonStyles),title:a?.settings,children:[(0,p.jsx)(`span`,{className:`shrink-0`,children:r?.settingsIcon}),(0,p.jsx)(`span`,{className:`min-w-0 break-words`,children:a?.settings||`Settings`})]}),r?.contactSupportIcon&&(0,p.jsxs)(`button`,{className:(0,c.default)(`p-2 items-center flex gap-1 text-primary fill-primary`,r?.dropdownButtonTypographyStyles||`body-1`,r?.dropdownButtonStyles),title:a?.contactSupport,onClick:v,children:[(0,p.jsx)(`span`,{className:`shrink-0`,children:r?.contactSupportIcon}),(0,p.jsx)(`span`,{className:`min-w-0 break-words`,children:a?.contactSupport||`Contact support`})]}),(0,p.jsx)(`div`,{className:(0,c.default)(`h-0 border-t border-neutrals-600 my-2`,r?.showSeparator?`block`:`hidden`)}),(0,p.jsxs)(`button`,{className:(0,c.default)(`p-2 items-center flex gap-1 text-primary fill-primary`,r?.dropdownButtonTypographyStyles||`body-1`,r?.dropdownButtonStyles),title:a?.signOut,onClick:g,children:[(0,p.jsx)(`span`,{className:`shrink-0`,children:r?.signOutIcon}),(0,p.jsx)(`span`,{className:`min-w-0 break-words`,children:a?.signOut||`Sign out`}),u&&(0,p.jsx)(Me,{onCloseModal:_,signOut:()=>t?.(),locale:i,disableModalDividers:r?.disableModalDividers,titles:a})]})]}),[r,a,g,v,u,_,i,t]);if(e)return(0,p.jsx)(d.Dropdown,{containerClassName:(0,c.default)(`transition-opacity group-hover:opacity-100 shrink w-full`,r?.dropdownContainerClassName),triggerButton:y,content:b,openedClassName:`action-menu-opened`})};exports.ActionMenu=$,exports.ActionMenuItem=_,exports.ConversationList=je,exports.User=Ne,exports.getSharedConversationsGroup=b,exports.transformSharedConversations=y;
package/index.mjs CHANGED
@@ -2,17 +2,17 @@ import e from "classnames";
2
2
  import t, { createContext as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
3
3
  import { cloneDeep as l, omit as u, uniqBy as d } from "lodash";
4
4
  import { Button as f, Dropdown as p, HighlightText as m, IconButton as h, InlineAlert as g, InlineAlertType as _, Input as v, InputWithIcon as y, Loader as b, PopUpSize as x, PopUpState as S, Popup as C } from "@epam/statgpt-ui-components";
5
- import { IconCaretRightFilled as w, IconCheck as T, IconCopy as E, IconDotsVertical as D, IconInfoCircle as O, IconSearch as ee, IconX as te } from "@tabler/icons-react";
6
- import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
7
- import M from "jszip";
5
+ import { IconCaretRightFilled as w, IconCheck as T, IconCopy as E, IconDotsVertical as D, IconInfoCircle as O, IconSearch as k, IconX as ee } from "@tabler/icons-react";
6
+ import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
7
+ import te from "jszip";
8
8
  import { ONBOARDING_MODEL_POSTFIX as N, SHARE_CONVERSATION_ROUTE as P, cleanConversationNames as F, getClearedConversationName as I, getConversationAttachments as L } from "@epam/statgpt-shared-toolkit";
9
- import { InvitationType as R, ShareTarget as z, getSharedConversationsRequest as B } from "@epam/statgpt-dial-toolkit";
9
+ import { InvitationType as R, ShareTarget as ne, getSharedConversationsRequest as z } from "@epam/statgpt-dial-toolkit";
10
10
  //#region libs/conversation-list/src/types/action-menu-item.ts
11
- var V = /* @__PURE__ */ function(e) {
11
+ var B = /* @__PURE__ */ function(e) {
12
12
  return e.DELETE = "delete", e.EXPORT = "export", e.SHARE = "share", e.RENAME = "rename", e;
13
- }({}), H = /* @__PURE__ */ function(e) {
13
+ }({}), V = /* @__PURE__ */ function(e) {
14
14
  return e.SHARED = "shared", e.TODAY = "today", e.YESTERDAY = "yesterday", e.WEEK = "week", e.EARLIER = "earlier", e;
15
- }({}), U = (e, t) => e?.resources?.filter((e) => e?.parentPath === t)?.map((e) => {
15
+ }({}), H = (e, t) => e?.resources?.filter((e) => e?.parentPath === t)?.map((e) => {
16
16
  let n = `${e?.bucket}/${t}`, r = e?.url?.split("/")?.slice(1)?.join("/");
17
17
  return {
18
18
  ...e,
@@ -20,22 +20,22 @@ var V = /* @__PURE__ */ function(e) {
20
20
  id: r,
21
21
  isShared: !0
22
22
  };
23
- }) || [], W = (e) => ({ [H.SHARED]: e }), ne = {
24
- [H.TODAY]: [],
25
- [H.YESTERDAY]: [],
26
- [H.WEEK]: [],
27
- [H.EARLIER]: []
23
+ }) || [], U = (e) => ({ [V.SHARED]: e }), W = {
24
+ [V.TODAY]: [],
25
+ [V.YESTERDAY]: [],
26
+ [V.WEEK]: [],
27
+ [V.EARLIER]: []
28
28
  }, G = (e, t) => e.toDateString() === t.toDateString(), K = (e, t) => G(t, new Date(e.getFullYear(), e.getMonth(), e.getDate() - 1)), re = (e, t) => {
29
29
  let n = e.getTime() - t.getTime();
30
30
  return Math.floor(n / (1e3 * 60 * 60 * 24));
31
31
  }, ie = (e) => e.updatedAt || Number(e.id?.split("-").pop()), ae = (e) => {
32
- let t = /* @__PURE__ */ new Date(), n = l(ne);
32
+ let t = /* @__PURE__ */ new Date(), n = l(W);
33
33
  for (let r of e) if (r.updatedAt) {
34
34
  let e = new Date(r.updatedAt), i;
35
- i = G(t, e) ? n[H.TODAY] : K(t, e) ? n[H.YESTERDAY] : re(t, e) <= 7 ? n[H.WEEK] : n[H.EARLIER], i?.some((e) => e.id === r.id) || i.push(r);
35
+ i = G(t, e) ? n[V.TODAY] : K(t, e) ? n[V.YESTERDAY] : re(t, e) <= 7 ? n[V.WEEK] : n[V.EARLIER], i?.some((e) => e.id === r.id) || i.push(r);
36
36
  }
37
37
  return n;
38
- }, q = (e) => e?.sort((e, t) => (ie(t) || 0) - (ie(e) || 0)), J = (e, t) => e === H.SHARED ? t?.shared || "Shared" : e === H.TODAY ? t?.today || "Today" : e === H.YESTERDAY ? t?.yesterday || "Yesterday" : e === H.WEEK ? t?.lastWeek || "Last week" : t?.earlier || "Earlier", Y = n(null);
38
+ }, q = (e) => e?.sort((e, t) => (ie(t) || 0) - (ie(e) || 0)), J = (e, t) => e === V.SHARED ? t?.shared || "Shared" : e === V.TODAY ? t?.today || "Today" : e === V.YESTERDAY ? t?.yesterday || "Yesterday" : e === V.WEEK ? t?.lastWeek || "Last week" : t?.earlier || "Earlier", Y = n(null);
39
39
  function X() {
40
40
  let e = i(Y);
41
41
  if (!e) throw Error("useConversationStyles must be used within ConversationStylesContext.Provider");
@@ -45,7 +45,7 @@ function X() {
45
45
  //#region libs/conversation-list/src/components/ConversationDelete/ConversationDelete.tsx
46
46
  var Z = ({ onCloseModal: e, deleteConversation: t, locale: n }) => {
47
47
  let { titles: r, disableModalDividers: i, isSmallModalButton: a } = X();
48
- return /* @__PURE__ */ j(C, {
48
+ return /* @__PURE__ */ M(C, {
49
49
  heading: r?.deleteTitle ?? "Delete conversation",
50
50
  portalId: "delete-conversation",
51
51
  containerClassName: "delete-conversation-popup",
@@ -53,20 +53,20 @@ var Z = ({ onCloseModal: e, deleteConversation: t, locale: n }) => {
53
53
  dividers: !i,
54
54
  onClose: e,
55
55
  closeButtonTitle: r?.close ?? "Cancel",
56
- children: [/* @__PURE__ */ A("div", {
56
+ children: [/* @__PURE__ */ j("div", {
57
57
  className: "px-6 py-4 sm:px-0",
58
58
  lang: n,
59
59
  children: r?.deleteMessage ?? "Are you sure you want to delete this conversation? This action cannot be undone."
60
- }), /* @__PURE__ */ j("div", {
60
+ }), /* @__PURE__ */ M("div", {
61
61
  className: "delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",
62
- children: [/* @__PURE__ */ A(f, {
62
+ children: [/* @__PURE__ */ j(f, {
63
63
  buttonClassName: "cancel-button",
64
64
  title: r?.cancel ?? "Cancel",
65
65
  isSmallButton: a,
66
66
  onClick: (t) => {
67
67
  t.stopPropagation(), e();
68
68
  }
69
- }), /* @__PURE__ */ A(f, {
69
+ }), /* @__PURE__ */ j(f, {
70
70
  buttonClassName: "text-button-primary text-button-primary-error",
71
71
  title: r?.delete ?? "Delete",
72
72
  isSmallButton: a,
@@ -111,7 +111,7 @@ var Z = ({ onCloseModal: e, deleteConversation: t, locale: n }) => {
111
111
  };
112
112
  }).filter(Boolean) : [];
113
113
  async function de(e, t) {
114
- let n = oe(e), r = new M();
114
+ let n = oe(e), r = new te();
115
115
  n.forEach((e) => {
116
116
  let n = t(`${encodeURI(Q(e.absolutePath, e.name))}`.replace("files/", "")), i = Q("res", fe(e.folderId), e.name);
117
117
  r.file(i, n);
@@ -1096,25 +1096,25 @@ var Ve = (e, t) => ({
1096
1096
  }), He = (e) => `/${P}/${e?.invitationLink?.split("/").at(-1) || ""}`, Ue = (e, t) => t?.find((t) => {
1097
1097
  let n = e?.id?.split("/")?.pop(), r = t?.url?.split("/")?.pop() || "";
1098
1098
  return r === n || decodeURI(r) === n;
1099
- }), We = (e) => (e?.messages?.filter((e) => !!e?.custom_content?.attachments))?.flatMap((e) => e?.custom_content?.attachments?.map((e) => ({ url: e?.url || "" })) || [])?.filter((e) => !!e?.url) || [], Ge = ({ conversation: e, locale: t, onCloseModal: n, modalDividers: i, getConversation: l, generateConversationLink: u, chatExpiration: d, chatExpirationDays: p, close: m, chatWarning: h, shareLink: v, shareCopyLink: S, shareCopiedLink: w, shareDescription: D, shareRemoveAccessToUsers: ee, chatName: te, getSharedConversations: k, revokeSharedConversations: M, baseUrl: N, id: F, clientSharedPage: I, clientSharedProp: L, shareAlertMessage: R }) => {
1100
- let [V, H] = c(null), [U, W] = c(), [ne, G] = c(!1), [K, re] = c(!1), [ie, ae] = c(), q = s(null), J = s(null), Y = o(() => e?.id ? decodeURI(e.id) : F?.[0] && F?.[1] && t ? decodeURI(`${F[0]}/${t}/${F[1]}`) : null, [
1099
+ }), We = (e) => (e?.messages?.filter((e) => !!e?.custom_content?.attachments))?.flatMap((e) => e?.custom_content?.attachments?.map((e) => ({ url: e?.url || "" })) || [])?.filter((e) => !!e?.url) || [], Ge = ({ conversation: e, locale: t, onCloseModal: n, modalDividers: i, getConversation: l, generateConversationLink: u, chatExpiration: d, chatExpirationDays: p, close: m, chatWarning: h, shareLink: v, shareCopyLink: S, shareCopiedLink: w, shareDescription: D, shareRemoveAccessToUsers: k, chatName: ee, getSharedConversations: A, revokeSharedConversations: te, baseUrl: N, id: F, clientSharedPage: I, clientSharedProp: L, shareAlertMessage: R }) => {
1100
+ let [B, V] = c(null), [H, U] = c(), [W, G] = c(!1), [K, re] = c(!1), [ie, ae] = c(), q = s(null), J = s(null), Y = o(() => e?.id ? decodeURI(e.id) : F?.[0] && F?.[1] && t ? decodeURI(`${F[0]}/${t}/${F[1]}`) : null, [
1101
1101
  e?.id,
1102
1102
  F,
1103
1103
  t
1104
1104
  ]), X = o(() => {
1105
- if (!V) return "";
1105
+ if (!B) return "";
1106
1106
  let e = N || window.location.origin;
1107
- return N && N !== window.location.origin && I && L ? `${e}/${I}?${L}=${V.split(`/${P}/`)?.[1]}` : `${e}/${t}${V}`;
1107
+ return N && N !== window.location.origin && I && L ? `${e}/${I}?${L}=${B.split(`/${P}/`)?.[1]}` : `${e}/${t}${B}`;
1108
1108
  }, [
1109
1109
  N,
1110
- V,
1110
+ B,
1111
1111
  t,
1112
1112
  I,
1113
1113
  L
1114
1114
  ]), Z = r(async (e) => {
1115
- let t = await k?.(B(z.OTHERS));
1115
+ let t = await A?.(z(ne.OTHERS));
1116
1116
  if (t) return Ue({ id: e }, t.resources);
1117
- }, [k]);
1117
+ }, [A]);
1118
1118
  a(() => {
1119
1119
  if (!Y || q.current === Y) return;
1120
1120
  q.current = Y, G(!1), J.current?.abort();
@@ -1123,7 +1123,7 @@ var Ve = (e, t) => ({
1123
1123
  try {
1124
1124
  let t = Ve(Y, We(await l?.(Y))), n = await u?.(t), r = await Z(Y);
1125
1125
  if (e.signal.aborted || !n) return;
1126
- H(He(n)), W(r), G(!0);
1126
+ V(He(n)), U(r), G(!0);
1127
1127
  } catch (t) {
1128
1128
  if (e.signal.aborted) return;
1129
1129
  G(!1), console.error("Error sharing conversation", t);
@@ -1138,23 +1138,23 @@ var Ve = (e, t) => ({
1138
1138
  Z
1139
1139
  ]);
1140
1140
  let oe = r(() => {
1141
- J.current?.abort(), q.current = null, n(), H(null), G(!1), re(!1);
1141
+ J.current?.abort(), q.current = null, n(), V(null), G(!1), re(!1);
1142
1142
  }, [n]), se = r(() => {
1143
1143
  re(!0), navigator.clipboard.writeText(X || "");
1144
1144
  }, [X]), ce = async () => {
1145
1145
  try {
1146
- if (ae(!0), U && await M?.({ resources: [U] }), Y) {
1146
+ if (ae(!0), H && await te?.({ resources: [H] }), Y) {
1147
1147
  let e = await Z(Y);
1148
- J.current?.signal.aborted || W(e);
1148
+ J.current?.signal.aborted || U(e);
1149
1149
  }
1150
1150
  } catch (e) {
1151
1151
  console.error("Error revoking shared conversation", e);
1152
1152
  } finally {
1153
1153
  J.current?.signal.aborted || ae(!1);
1154
1154
  }
1155
- }, le = r(() => /* @__PURE__ */ A(f, {
1155
+ }, le = r(() => /* @__PURE__ */ j(f, {
1156
1156
  buttonClassName: K ? "text-button-secondary" : "text-button-primary",
1157
- iconBefore: A(K ? T : E, {
1157
+ iconBefore: j(K ? T : E, {
1158
1158
  width: 20,
1159
1159
  height: 20
1160
1160
  }),
@@ -1167,52 +1167,52 @@ var Ve = (e, t) => ({
1167
1167
  w,
1168
1168
  S
1169
1169
  ]);
1170
- return /* @__PURE__ */ j(C, {
1170
+ return /* @__PURE__ */ M(C, {
1171
1171
  heading: v ?? "Share link",
1172
1172
  portalId: "share",
1173
1173
  size: x.SM,
1174
1174
  dividers: i,
1175
1175
  onClose: oe,
1176
1176
  closeButtonTitle: m ?? "Close",
1177
- children: [ne ? /* @__PURE__ */ j("div", {
1177
+ children: [W ? /* @__PURE__ */ M("div", {
1178
1178
  className: "share flex flex-col gap-y-4 overflow-auto px-6 pb-6 sm:p-0",
1179
1179
  children: [
1180
- R ? /* @__PURE__ */ A(g, {
1180
+ R ? /* @__PURE__ */ j(g, {
1181
1181
  type: _.Note,
1182
- icon: /* @__PURE__ */ A(O, {
1182
+ icon: /* @__PURE__ */ j(O, {
1183
1183
  width: 16,
1184
1184
  height: 16
1185
1185
  }),
1186
1186
  children: R
1187
1187
  }) : null,
1188
- e?.name ? /* @__PURE__ */ j("div", {
1188
+ e?.name ? /* @__PURE__ */ M("div", {
1189
1189
  className: "share-info flex w-full",
1190
- children: [/* @__PURE__ */ A("p", {
1190
+ children: [/* @__PURE__ */ j("p", {
1191
1191
  className: "share-info-title body-1 mr-1 text-neutrals-800",
1192
- children: te ?? "Chat name:"
1193
- }), /* @__PURE__ */ A("h3", {
1192
+ children: ee ?? "Chat name:"
1193
+ }), /* @__PURE__ */ j("h3", {
1194
1194
  className: "min-w-0 flex-1 truncate",
1195
1195
  title: e?.name,
1196
1196
  children: e?.name
1197
1197
  })]
1198
1198
  }) : null,
1199
- /* @__PURE__ */ j("div", {
1199
+ /* @__PURE__ */ M("div", {
1200
1200
  className: "share-info flex",
1201
- children: [/* @__PURE__ */ A("p", {
1201
+ children: [/* @__PURE__ */ j("p", {
1202
1202
  className: "share-info-title body-1 mr-1 text-neutrals-800",
1203
1203
  children: d ?? "Link expiration date:"
1204
- }), /* @__PURE__ */ j("h3", { children: ["3 ", p ?? "days"] })]
1204
+ }), /* @__PURE__ */ M("h3", { children: ["3 ", p ?? "days"] })]
1205
1205
  }),
1206
- /* @__PURE__ */ A(Be, {
1206
+ /* @__PURE__ */ j(Be, {
1207
1207
  className: "min-h-[200px] self-center rounded border border-neutrals-600 p-2",
1208
1208
  value: X,
1209
1209
  size: 200
1210
1210
  }),
1211
- /* @__PURE__ */ A("p", {
1211
+ /* @__PURE__ */ j("p", {
1212
1212
  className: "body-2 text-neutrals-1000",
1213
1213
  children: D ?? "Your name, special instructions, and any messages you add after sharing remain confidential."
1214
1214
  }),
1215
- /* @__PURE__ */ A(y, {
1215
+ /* @__PURE__ */ j(y, {
1216
1216
  containerClasses: "share-input-container",
1217
1217
  cssClass: "share-input",
1218
1218
  readonly: !0,
@@ -1222,22 +1222,22 @@ var Ve = (e, t) => ({
1222
1222
  iconAfterInput: le()
1223
1223
  })
1224
1224
  ]
1225
- }) : /* @__PURE__ */ A("div", {
1225
+ }) : /* @__PURE__ */ j("div", {
1226
1226
  className: "flex items-center justify-center p-6",
1227
- children: /* @__PURE__ */ A(b, {})
1228
- }), ne ? e && U ? /* @__PURE__ */ A("div", {
1227
+ children: /* @__PURE__ */ j(b, {})
1228
+ }), W ? e && H ? /* @__PURE__ */ j("div", {
1229
1229
  className: "remove-access",
1230
- children: /* @__PURE__ */ A(f, {
1231
- title: ee ?? "Remove access to all users",
1230
+ children: /* @__PURE__ */ j(f, {
1231
+ title: k ?? "Remove access to all users",
1232
1232
  buttonClassName: "remove-access-button py-3 px-4",
1233
1233
  isSmallButton: !0,
1234
1234
  disabled: ie,
1235
1235
  onClick: ce
1236
1236
  })
1237
- }) : /* @__PURE__ */ A("p", {
1237
+ }) : /* @__PURE__ */ j("p", {
1238
1238
  className: "body-2 share-footer text-neutrals-800",
1239
1239
  children: h ?? "This chat has not been shared with anyone yet."
1240
- }) : /* @__PURE__ */ A("div", {})]
1240
+ }) : /* @__PURE__ */ j("div", {})]
1241
1241
  });
1242
1242
  }, Ke = ({ conversation: e, onCloseModal: t, renameConversation: n, locale: r }) => {
1243
1243
  let { titles: i, disableModalDividers: a, isSmallModalButton: o } = X(), [s, l] = c(e?.name || ""), u = (e) => {
@@ -1246,7 +1246,7 @@ var Ve = (e, t) => ({
1246
1246
  let t = `${e?.folderId}/${encodeURIComponent(I(s))}-${(/* @__PURE__ */ new Date()).getTime()}`;
1247
1247
  n(`conversations/${e.id}`, `conversations/${t}`);
1248
1248
  };
1249
- return /* @__PURE__ */ j(C, {
1249
+ return /* @__PURE__ */ M(C, {
1250
1250
  heading: i?.renameTitle ?? "Rename conversation",
1251
1251
  portalId: "rename-conversation",
1252
1252
  containerClassName: "rename-conversation-popup",
@@ -1254,25 +1254,25 @@ var Ve = (e, t) => ({
1254
1254
  dividers: !a,
1255
1255
  onClose: t,
1256
1256
  closeButtonTitle: i?.close ?? "Cancel",
1257
- children: [/* @__PURE__ */ A("div", {
1257
+ children: [/* @__PURE__ */ j("div", {
1258
1258
  className: "px-6 py-4 sm:px-0",
1259
1259
  lang: r,
1260
- children: /* @__PURE__ */ A(v, {
1260
+ children: /* @__PURE__ */ j(v, {
1261
1261
  inputId: "rename",
1262
1262
  value: s,
1263
1263
  onChange: u,
1264
1264
  cssClass: "w-full"
1265
1265
  })
1266
- }), /* @__PURE__ */ j("div", {
1266
+ }), /* @__PURE__ */ M("div", {
1267
1267
  className: "delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",
1268
- children: [/* @__PURE__ */ A(f, {
1268
+ children: [/* @__PURE__ */ j(f, {
1269
1269
  buttonClassName: "cancel-button",
1270
1270
  title: i?.cancel ?? "Cancel",
1271
1271
  isSmallButton: o,
1272
1272
  onClick: (e) => {
1273
1273
  e.stopPropagation(), t();
1274
1274
  }
1275
- }), /* @__PURE__ */ A(f, {
1275
+ }), /* @__PURE__ */ j(f, {
1276
1276
  buttonClassName: "text-button-primary text-button-primary",
1277
1277
  title: i?.save ?? "Rename",
1278
1278
  isSmallButton: o,
@@ -1285,7 +1285,7 @@ var Ve = (e, t) => ({
1285
1285
  });
1286
1286
  }, qe = n(null);
1287
1287
  function Je({ children: e, value: t }) {
1288
- return /* @__PURE__ */ A(qe.Provider, {
1288
+ return /* @__PURE__ */ j(qe.Provider, {
1289
1289
  value: t,
1290
1290
  children: e
1291
1291
  });
@@ -1300,24 +1300,24 @@ function Ye() {
1300
1300
  var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1301
1301
  let i = X(), { locale: a, deleteConversation: s, renameConversation: l, getConversation: u, getFileBlob: d, shareConversationProps: f } = Ye(), m = o(() => {
1302
1302
  let t = [{
1303
- key: V.DELETE,
1303
+ key: B.DELETE,
1304
1304
  title: i?.titles?.delete ?? "Delete",
1305
- icon: i.actionsIcons?.[V.DELETE]
1305
+ icon: i.actionsIcons?.[B.DELETE]
1306
1306
  }];
1307
1307
  return e?.model?.id?.endsWith(N) ? t : [
1308
1308
  ...e.isShared ? [] : [{
1309
- key: V.SHARE,
1309
+ key: B.SHARE,
1310
1310
  title: i?.titles?.share ?? "Share",
1311
- icon: i.actionsIcons?.[V.SHARE]
1311
+ icon: i.actionsIcons?.[B.SHARE]
1312
1312
  }, {
1313
- key: V.RENAME,
1313
+ key: B.RENAME,
1314
1314
  title: i?.titles?.rename ?? "Rename",
1315
- icon: i.actionsIcons?.[V.RENAME]
1315
+ icon: i.actionsIcons?.[B.RENAME]
1316
1316
  }],
1317
1317
  {
1318
- key: V.EXPORT,
1318
+ key: B.EXPORT,
1319
1319
  title: i?.titles?.export ?? "Export",
1320
- icon: i.actionsIcons?.[V.EXPORT]
1320
+ icon: i.actionsIcons?.[B.EXPORT]
1321
1321
  },
1322
1322
  ...t
1323
1323
  ];
@@ -1341,14 +1341,14 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1341
1341
  ]), E = r((e, t) => {
1342
1342
  l(e, t), w();
1343
1343
  }, [l, w]);
1344
- return /* @__PURE__ */ j(k, { children: [
1345
- /* @__PURE__ */ A(p, {
1344
+ return /* @__PURE__ */ M(A, { children: [
1345
+ /* @__PURE__ */ j(p, {
1346
1346
  containerClassName: "ml-3 hidden group-hover:flex",
1347
- triggerButton: t ?? /* @__PURE__ */ A(Ze, { disabled: n }),
1347
+ triggerButton: t ?? /* @__PURE__ */ j(Ze, { disabled: n }),
1348
1348
  options: m,
1349
1349
  openedClassName: "!flex action-menu-opened",
1350
1350
  onOptionSelect: (t) => {
1351
- t === V.DELETE && g(S.Opened), t === V.SHARE && v(S.Opened), t === V.RENAME && b(S.Opened), t === V.EXPORT && u(decodeURI(e.id)).then((e) => {
1351
+ t === B.DELETE && g(S.Opened), t === B.SHARE && v(S.Opened), t === B.RENAME && b(S.Opened), t === B.EXPORT && u(decodeURI(e.id)).then((e) => {
1352
1352
  de(e, d).then((e) => {
1353
1353
  me(`data:application/zip;base64,${e}`, `chat_with_attachments_${(/* @__PURE__ */ new Date()).toLocaleDateString()}.dial`);
1354
1354
  });
@@ -1356,27 +1356,27 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1356
1356
  },
1357
1357
  disabled: n
1358
1358
  }),
1359
- h === S.Opened && /* @__PURE__ */ A(Z, {
1359
+ h === S.Opened && /* @__PURE__ */ j(Z, {
1360
1360
  locale: a,
1361
1361
  deleteConversation: T,
1362
1362
  onCloseModal: x
1363
1363
  }),
1364
- _ === S.Opened && /* @__PURE__ */ A(Ge, {
1364
+ _ === S.Opened && /* @__PURE__ */ j(Ge, {
1365
1365
  conversation: e,
1366
1366
  locale: a,
1367
1367
  onCloseModal: C,
1368
1368
  ...f
1369
1369
  }),
1370
- y === S.Opened && /* @__PURE__ */ A(Ke, {
1370
+ y === S.Opened && /* @__PURE__ */ j(Ke, {
1371
1371
  conversation: e,
1372
1372
  locale: a,
1373
1373
  renameConversation: E,
1374
1374
  onCloseModal: w
1375
1375
  })
1376
1376
  ] });
1377
- }, Ze = ({ disabled: t }) => /* @__PURE__ */ A("div", {
1377
+ }, Ze = ({ disabled: t }) => /* @__PURE__ */ j("div", {
1378
1378
  className: e("flex items-center justify-center w-[24px]", t ? "cursor-not-allowed" : "cursor-pointer"),
1379
- children: /* @__PURE__ */ A(D, {
1379
+ children: /* @__PURE__ */ j(D, {
1380
1380
  width: 20,
1381
1381
  height: 20,
1382
1382
  stroke: 2,
@@ -1395,38 +1395,38 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1395
1395
  });
1396
1396
  }
1397
1397
  }
1398
- }, [t, n]), /* @__PURE__ */ j("div", {
1398
+ }, [t, n]), /* @__PURE__ */ M("div", {
1399
1399
  ref: u,
1400
1400
  className: e("flex justify-between items-center py-2 px-3 border-transparent relative group border", "conversation-item", n === t?.id && "bg-hues-100 conversation-item-active", o ? "cursor-not-allowed" : "cursor-pointer hover:border-hues-600"),
1401
1401
  onClick: () => !o && i(t.folderId, t?.id),
1402
1402
  title: o ? c?.noActionsAllowed : d,
1403
- children: [/* @__PURE__ */ j("div", {
1403
+ children: [/* @__PURE__ */ M("div", {
1404
1404
  className: "flex min-w-0 flex-1 items-center",
1405
- children: [l || null, /* @__PURE__ */ A("h3", {
1405
+ children: [l || null, /* @__PURE__ */ j("h3", {
1406
1406
  className: e("truncate pb-px -mb-px font-semibold text-neutrals-1000 sm:body-2", "conversation-item-text", n === t?.id ? "conversation-item-text-active" : ""),
1407
1407
  title: o ? c?.noActionsAllowed : d,
1408
- children: r?.length ? /* @__PURE__ */ A(m, {
1408
+ children: r?.length ? /* @__PURE__ */ j(m, {
1409
1409
  text: d,
1410
1410
  highlightText: r
1411
1411
  }) : d
1412
1412
  })]
1413
- }), /* @__PURE__ */ A(Xe, {
1413
+ }), /* @__PURE__ */ j(Xe, {
1414
1414
  conversation: t,
1415
1415
  isDisabled: o
1416
1416
  })]
1417
1417
  });
1418
1418
  }, $e = ({ handleConversationClick: t, selectedConversationId: n, groupLabel: r, groupedConversations: i, isDisabled: a, isCollapsed: o, onToggleCollapse: s }) => {
1419
1419
  let { titles: c } = X();
1420
- return /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("div", {
1420
+ return /* @__PURE__ */ M("div", { children: [/* @__PURE__ */ M("div", {
1421
1421
  className: "conversation-group-items-title mb-3 inline-flex cursor-pointer items-center gap-1 text-neutrals-700",
1422
1422
  onClick: s,
1423
- children: [/* @__PURE__ */ A(w, { className: e("w-3 h-3 conversation-group-items-arrow", o ? "rotate-[90deg]" : "rotate-0") }), /* @__PURE__ */ A("span", {
1423
+ children: [/* @__PURE__ */ j(w, { className: e("w-3 h-3 conversation-group-items-arrow", o ? "rotate-[90deg]" : "rotate-0") }), /* @__PURE__ */ j("span", {
1424
1424
  className: "body-3 conversation-group-items-title-text",
1425
1425
  children: J(r, c)
1426
1426
  })]
1427
- }), !o && /* @__PURE__ */ A("div", {
1427
+ }), !o && /* @__PURE__ */ j("div", {
1428
1428
  className: e("flex flex-col gap-y-3", "conversation-group-items"),
1429
- children: q(i).map((e) => /* @__PURE__ */ A(Qe, {
1429
+ children: q(i).map((e) => /* @__PURE__ */ j(Qe, {
1430
1430
  isDisabled: a,
1431
1431
  conversation: e,
1432
1432
  selectedConversationId: n,
@@ -1435,161 +1435,161 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1435
1435
  })] }, r);
1436
1436
  }, et = ({ searchQuery: e, isExpandedSearch: t, onSearchConversations: n, toggleSearchField: r }) => {
1437
1437
  let { titles: i, searchIcon: a } = X();
1438
- return /* @__PURE__ */ A(k, { children: t ? /* @__PURE__ */ A(y, {
1438
+ return /* @__PURE__ */ j(A, { children: t ? /* @__PURE__ */ j(y, {
1439
1439
  inputId: "conversations-search",
1440
1440
  placeholder: i?.searchPlaceholder ?? "Search",
1441
1441
  containerClasses: "conversation-list-search-input h-[40px] bg-transparent px-4 py-2 rounded-full border-neutrals-400 shadow-none",
1442
1442
  cssClass: "h-auto",
1443
1443
  value: e,
1444
- iconAfterInput: /* @__PURE__ */ A(h, {
1444
+ iconAfterInput: /* @__PURE__ */ j(h, {
1445
1445
  buttonClassName: "text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5",
1446
1446
  onClick: r,
1447
- icon: /* @__PURE__ */ A(te, {})
1447
+ icon: /* @__PURE__ */ j(ee, {})
1448
1448
  }),
1449
1449
  onChange: n
1450
- }) : /* @__PURE__ */ A(f, {
1450
+ }) : /* @__PURE__ */ j(f, {
1451
1451
  buttonClassName: "text-button-tertiary p-0 search-button",
1452
- iconBefore: a || /* @__PURE__ */ A(ee, { className: "size-5" }),
1452
+ iconBefore: a || /* @__PURE__ */ j(k, { className: "size-5" }),
1453
1453
  onClick: r
1454
1454
  }) });
1455
1455
  }, tt = ({ conversations: e, selectedConversationId: t, searchQuery: n, handleConversationClick: r, isDisabled: i }) => {
1456
1456
  let { titles: o } = X(), [s, l] = c([]);
1457
1457
  return a(() => {
1458
1458
  l(q(e?.filter((e) => I(e?.name)?.includes(n || ""))));
1459
- }, [e, n]), /* @__PURE__ */ A(k, { children: s?.length ? s.map((e) => /* @__PURE__ */ A(Qe, {
1459
+ }, [e, n]), /* @__PURE__ */ j(A, { children: s?.length ? s.map((e) => /* @__PURE__ */ j(Qe, {
1460
1460
  conversation: e,
1461
1461
  searchQuery: n,
1462
1462
  selectedConversationId: t,
1463
1463
  onConversationClick: r,
1464
1464
  isDisabled: i
1465
- }, e.id)) : /* @__PURE__ */ A("h3", {
1465
+ }, e.id)) : /* @__PURE__ */ j("h3", {
1466
1466
  className: "text-neutrals-800",
1467
1467
  children: o?.noConversation ?? "No conversations yet"
1468
1468
  }) });
1469
1469
  }, nt = () => {
1470
1470
  let { titles: e } = X();
1471
- return /* @__PURE__ */ j("div", {
1471
+ return /* @__PURE__ */ M("div", {
1472
1472
  className: "flex flex-col p-8 text-center",
1473
- children: [/* @__PURE__ */ A("p", {
1473
+ children: [/* @__PURE__ */ j("p", {
1474
1474
  className: "text-neutrals-800",
1475
1475
  children: e?.noConversation ?? "No conversations yet"
1476
- }), /* @__PURE__ */ A("p", {
1476
+ }), /* @__PURE__ */ j("p", {
1477
1477
  className: "mt-2 text-sm text-neutrals-800",
1478
1478
  children: e?.clickNewChat ?? "Click \"New Chat\" to start a conversation"
1479
1479
  })]
1480
1480
  });
1481
1481
  }, rt = ({ handleConversationClick: t, selectedConversationId: n, actions: i, children: s, isCollapsed: l, isStreaming: u, conversationStyles: d, conversations: f, locale: p, sharedConversations: m, setConversations: h, setSharedConversations: g, shareConversationProps: _, handleSelectedConversationRemove: v }) => {
1482
- let [y, x] = c({}), [S, C] = c(!0), [w, T] = c(""), [E, D] = c(!1), [O, ee] = c(/* @__PURE__ */ new Set()), te = r((e) => {
1483
- ee((t) => {
1482
+ let [y, x] = c({}), [S, C] = c(!0), [w, T] = c(!1), [E, D] = c(""), [O, k] = c(!1), [ee, A] = c(/* @__PURE__ */ new Set()), te = r((e) => {
1483
+ A((t) => {
1484
1484
  let n = new Set(t);
1485
1485
  return n.has(e) ? n.delete(e) : n.add(e), n;
1486
1486
  });
1487
- }, []), { getConversations: k, getSharedConversations: M, deleteConversation: N, renameConversation: P } = i, I = o(() => !!w?.length, [w]);
1487
+ }, []), { getConversations: N, getSharedConversations: P, deleteConversation: I, renameConversation: L } = i, R = o(() => !!E?.length, [E]);
1488
1488
  a(() => {
1489
1489
  x({
1490
- ...W(m),
1490
+ ...U(m),
1491
1491
  ...ae(f)
1492
1492
  });
1493
1493
  }, [f, m]), a(() => {
1494
1494
  async function e() {
1495
1495
  try {
1496
1496
  C(!0);
1497
- let e = await k(p), t = await M(B(z.ME));
1498
- h(F(e)), g(F(U(t, p)));
1497
+ let e = await N(p), t = await P(z(ne.ME));
1498
+ h(F(e)), g(F(H(t, p)));
1499
1499
  } catch (e) {
1500
1500
  console.error("Error loading conversation", e);
1501
1501
  } finally {
1502
- C(!1);
1502
+ C(!1), T(!0);
1503
1503
  }
1504
1504
  }
1505
1505
  e();
1506
1506
  }, [
1507
- k,
1507
+ N,
1508
1508
  h,
1509
1509
  p,
1510
- M,
1510
+ P,
1511
1511
  g
1512
1512
  ]);
1513
- let L = r(async (e) => {
1513
+ let B = r(async (e) => {
1514
1514
  try {
1515
- await N(e);
1516
- let t = await k(p), r = await M(B(z.ME));
1517
- h(F(t)), g(F(U(r, p))), n === e?.id && v();
1515
+ await I(e);
1516
+ let t = await N(p), r = await P(z(ne.ME));
1517
+ h(F(t)), g(F(H(r, p))), n === e?.id && v();
1518
1518
  } catch (e) {
1519
1519
  console.error("Error deleting conversation", e);
1520
1520
  }
1521
1521
  }, [
1522
+ I,
1522
1523
  N,
1523
- k,
1524
1524
  p,
1525
- M,
1525
+ P,
1526
1526
  h,
1527
1527
  g,
1528
1528
  n,
1529
1529
  v
1530
- ]), R = r(async (e, t) => {
1530
+ ]), V = r(async (e, t) => {
1531
1531
  try {
1532
- C(!0), await P(e, t);
1533
- let n = await k(p), r = await M(B(z.ME));
1534
- h(F(n)), g(F(U(r, p)));
1532
+ C(!0), await L(e, t);
1533
+ let n = await N(p), r = await P(z(ne.ME));
1534
+ h(F(n)), g(F(H(r, p)));
1535
1535
  } catch (e) {
1536
1536
  console.error("Error renaming conversation", e);
1537
1537
  } finally {
1538
1538
  C(!1);
1539
1539
  }
1540
1540
  }, [
1541
- k,
1541
+ N,
1542
1542
  p,
1543
- M,
1543
+ P,
1544
1544
  h,
1545
1545
  g,
1546
- P
1547
- ]), V = r((e) => {
1548
- T(e);
1549
- }, [T]), H = r(() => {
1550
- D((e) => !e), T("");
1551
- }, [D]);
1552
- return S ? /* @__PURE__ */ A(b, {}) : /* @__PURE__ */ A(Je, {
1546
+ L
1547
+ ]), W = r((e) => {
1548
+ D(e);
1549
+ }, [D]), G = r(() => {
1550
+ k((e) => !e), D("");
1551
+ }, [k]);
1552
+ return S && !w ? /* @__PURE__ */ j(b, {}) : /* @__PURE__ */ j(Je, {
1553
1553
  value: {
1554
1554
  locale: p,
1555
- deleteConversation: L,
1556
- renameConversation: R,
1555
+ deleteConversation: B,
1556
+ renameConversation: V,
1557
1557
  getConversation: i.getConversation,
1558
1558
  getFileBlob: i.getFileBlob,
1559
1559
  shareConversationProps: _
1560
1560
  },
1561
- children: /* @__PURE__ */ j(Y.Provider, {
1561
+ children: /* @__PURE__ */ M(Y.Provider, {
1562
1562
  value: d,
1563
1563
  children: [
1564
- !l && /* @__PURE__ */ j("div", {
1565
- className: e("flex justify-between items-center pr-6", E ? " pt-4 pb-0 sm:pt-10" : " pt-6 pb-2 sm:pt-10"),
1566
- children: [!E && /* @__PURE__ */ A("h3", {
1564
+ !l && /* @__PURE__ */ M("div", {
1565
+ className: e("flex justify-between items-center pr-6", O ? " pt-4 pb-0 sm:pt-10" : " pt-6 pb-2 sm:pt-10"),
1566
+ children: [!O && /* @__PURE__ */ j("h3", {
1567
1567
  className: "sm:body-2 text-neutrals-700",
1568
1568
  children: d?.titles?.allChats ?? "All Chats"
1569
- }), /* @__PURE__ */ A(et, {
1570
- searchQuery: w,
1571
- isExpandedSearch: E,
1572
- onSearchConversations: V,
1573
- toggleSearchField: H
1569
+ }), /* @__PURE__ */ j(et, {
1570
+ searchQuery: E,
1571
+ isExpandedSearch: O,
1572
+ onSearchConversations: W,
1573
+ toggleSearchField: G
1574
1574
  })]
1575
1575
  }),
1576
- /* @__PURE__ */ A("div", {
1576
+ /* @__PURE__ */ j("div", {
1577
1577
  className: "scroll-hidden-container mt-4 flex min-h-0 flex-1 flex-col",
1578
- children: l ? null : /* @__PURE__ */ A("div", {
1579
- className: e("flex flex-col pr-4", I ? "gap-y-1" : "gap-y-6"),
1580
- children: f?.length === 0 && m?.length === 0 ? /* @__PURE__ */ A(nt, {}) : I ? /* @__PURE__ */ A(tt, {
1578
+ children: /* @__PURE__ */ j("div", {
1579
+ className: e("flex flex-col pr-4", R ? "gap-y-1" : "gap-y-6", l && "hidden"),
1580
+ children: f?.length === 0 && m?.length === 0 ? /* @__PURE__ */ j(nt, {}) : R ? /* @__PURE__ */ j(tt, {
1581
1581
  conversations: [...m, ...f],
1582
- searchQuery: w,
1582
+ searchQuery: E,
1583
1583
  selectedConversationId: n,
1584
1584
  handleConversationClick: t,
1585
1585
  isDisabled: u
1586
- }) : Object.entries(y).map(([e, r]) => r?.length > 0 && /* @__PURE__ */ A($e, {
1586
+ }) : Object.entries(y).map(([e, r]) => r?.length > 0 && /* @__PURE__ */ j($e, {
1587
1587
  isDisabled: u,
1588
1588
  groupLabel: e,
1589
1589
  groupedConversations: r,
1590
1590
  handleConversationClick: t,
1591
1591
  selectedConversationId: n,
1592
- isCollapsed: O.has(e),
1592
+ isCollapsed: ee.has(e),
1593
1593
  onToggleCollapse: () => te(e)
1594
1594
  }, e))
1595
1595
  })
@@ -1598,7 +1598,7 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1598
1598
  ]
1599
1599
  })
1600
1600
  });
1601
- }, it = ({ onCloseModal: e, disableModalDividers: t, signOut: n, isSmallButton: r, locale: i, titles: a }) => /* @__PURE__ */ j(C, {
1601
+ }, it = ({ onCloseModal: e, disableModalDividers: t, signOut: n, isSmallButton: r, locale: i, titles: a }) => /* @__PURE__ */ M(C, {
1602
1602
  heading: a?.popupTitle || "Log out?",
1603
1603
  portalId: "sign-out",
1604
1604
  containerClassName: "sign-out-popup",
@@ -1606,20 +1606,20 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1606
1606
  dividers: !t,
1607
1607
  onClose: e,
1608
1608
  closeButtonTitle: "Cancel",
1609
- children: [/* @__PURE__ */ A("div", {
1609
+ children: [/* @__PURE__ */ j("div", {
1610
1610
  className: "px-6 py-4 sm:px-0",
1611
1611
  lang: i,
1612
1612
  children: a?.popupText
1613
- }), /* @__PURE__ */ j("div", {
1613
+ }), /* @__PURE__ */ M("div", {
1614
1614
  className: "delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",
1615
- children: [/* @__PURE__ */ A(f, {
1615
+ children: [/* @__PURE__ */ j(f, {
1616
1616
  buttonClassName: "cancel-button",
1617
1617
  title: a?.popupCancel || "Cancel",
1618
1618
  isSmallButton: r,
1619
1619
  onClick: (t) => {
1620
1620
  t.stopPropagation(), e();
1621
1621
  }
1622
- }), /* @__PURE__ */ A(f, {
1622
+ }), /* @__PURE__ */ j(f, {
1623
1623
  buttonClassName: "text-button-primary",
1624
1624
  title: a?.popupApply || "Sign Out",
1625
1625
  isSmallButton: r,
@@ -1635,12 +1635,12 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1635
1635
  m(!1);
1636
1636
  }, []), y = r(() => {
1637
1637
  window.open(i || "#", "_blank", "noopener,noreferrer");
1638
- }, [i]), b = o(() => /* @__PURE__ */ j("div", {
1638
+ }, [i]), b = o(() => /* @__PURE__ */ M("div", {
1639
1639
  className: "flex items-center gap-2",
1640
- children: [/* @__PURE__ */ A("div", {
1640
+ children: [/* @__PURE__ */ j("div", {
1641
1641
  className: e("cursor-pointer flex items-center justify-center size-11 rounded-[100px] p-[10px] sm:h-[32px] sm:w-[32px] flex-shrink-0", a?.initialStyles),
1642
1642
  children: d
1643
- }), /* @__PURE__ */ A("p", {
1643
+ }), /* @__PURE__ */ j("p", {
1644
1644
  className: e("h3 cursor-pointer overflow-hidden text-ellipsis", a?.userNameStyles),
1645
1645
  children: (a?.showShortName ? g : t?.name) ?? t?.email ?? ""
1646
1646
  })]
@@ -1649,47 +1649,47 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1649
1649
  g,
1650
1650
  a,
1651
1651
  t
1652
- ]), x = o(() => /* @__PURE__ */ j("div", {
1652
+ ]), x = o(() => /* @__PURE__ */ M("div", {
1653
1653
  className: e("py-1", a?.dropDownStyles),
1654
1654
  children: [
1655
- a?.settingsIcon && /* @__PURE__ */ j("button", {
1655
+ a?.settingsIcon && /* @__PURE__ */ M("button", {
1656
1656
  className: e("p-2 items-center flex gap-1 text-primary fill-primary", a?.dropdownButtonTypographyStyles || "body-1", a?.dropdownButtonStyles),
1657
1657
  title: l?.settings,
1658
- children: [/* @__PURE__ */ A("span", {
1658
+ children: [/* @__PURE__ */ j("span", {
1659
1659
  className: "shrink-0",
1660
1660
  children: a?.settingsIcon
1661
- }), /* @__PURE__ */ A("span", {
1661
+ }), /* @__PURE__ */ j("span", {
1662
1662
  className: "min-w-0 break-words",
1663
1663
  children: l?.settings || "Settings"
1664
1664
  })]
1665
1665
  }),
1666
- a?.contactSupportIcon && /* @__PURE__ */ j("button", {
1666
+ a?.contactSupportIcon && /* @__PURE__ */ M("button", {
1667
1667
  className: e("p-2 items-center flex gap-1 text-primary fill-primary", a?.dropdownButtonTypographyStyles || "body-1", a?.dropdownButtonStyles),
1668
1668
  title: l?.contactSupport,
1669
1669
  onClick: y,
1670
- children: [/* @__PURE__ */ A("span", {
1670
+ children: [/* @__PURE__ */ j("span", {
1671
1671
  className: "shrink-0",
1672
1672
  children: a?.contactSupportIcon
1673
- }), /* @__PURE__ */ A("span", {
1673
+ }), /* @__PURE__ */ j("span", {
1674
1674
  className: "min-w-0 break-words",
1675
1675
  children: l?.contactSupport || "Contact support"
1676
1676
  })]
1677
1677
  }),
1678
- /* @__PURE__ */ A("div", { className: e("h-0 border-t border-neutrals-600 my-2", a?.showSeparator ? "block" : "hidden") }),
1679
- /* @__PURE__ */ j("button", {
1678
+ /* @__PURE__ */ j("div", { className: e("h-0 border-t border-neutrals-600 my-2", a?.showSeparator ? "block" : "hidden") }),
1679
+ /* @__PURE__ */ M("button", {
1680
1680
  className: e("p-2 items-center flex gap-1 text-primary fill-primary", a?.dropdownButtonTypographyStyles || "body-1", a?.dropdownButtonStyles),
1681
1681
  title: l?.signOut,
1682
1682
  onClick: _,
1683
1683
  children: [
1684
- /* @__PURE__ */ A("span", {
1684
+ /* @__PURE__ */ j("span", {
1685
1685
  className: "shrink-0",
1686
1686
  children: a?.signOutIcon
1687
1687
  }),
1688
- /* @__PURE__ */ A("span", {
1688
+ /* @__PURE__ */ j("span", {
1689
1689
  className: "min-w-0 break-words",
1690
1690
  children: l?.signOut || "Sign out"
1691
1691
  }),
1692
- f && /* @__PURE__ */ A(it, {
1692
+ f && /* @__PURE__ */ j(it, {
1693
1693
  onCloseModal: v,
1694
1694
  signOut: () => n?.(),
1695
1695
  locale: s,
@@ -1709,7 +1709,7 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1709
1709
  s,
1710
1710
  n
1711
1711
  ]);
1712
- if (t) return /* @__PURE__ */ A(p, {
1712
+ if (t) return /* @__PURE__ */ j(p, {
1713
1713
  containerClassName: e("transition-opacity group-hover:opacity-100 shrink w-full", a?.dropdownContainerClassName),
1714
1714
  triggerButton: b,
1715
1715
  content: x,
@@ -1717,4 +1717,4 @@ var Xe = ({ conversation: e, triggerButton: t, isDisabled: n }) => {
1717
1717
  });
1718
1718
  };
1719
1719
  //#endregion
1720
- export { Xe as ActionMenu, V as ActionMenuItem, rt as ConversationList, at as User, W as getSharedConversationsGroup, U as transformSharedConversations };
1720
+ export { Xe as ActionMenu, B as ActionMenuItem, rt as ConversationList, at as User, U as getSharedConversationsGroup, H as transformSharedConversations };
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@epam/statgpt-conversation-list",
3
- "version": "0.8.0-dev.12",
3
+ "version": "0.8.0-dev.17",
4
4
  "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/epam/statgpt-portal-frontend.git",
8
+ "directory": "libs/conversation-list"
9
+ },
5
10
  "dependencies": {
6
- "@epam/statgpt-dial-toolkit": "0.8.0-dev.12",
7
- "@epam/statgpt-shared-toolkit": "0.8.0-dev.12",
8
- "@epam/statgpt-ui-components": "0.8.0-dev.12"
11
+ "@epam/statgpt-dial-toolkit": "0.8.0-dev.17",
12
+ "@epam/statgpt-shared-toolkit": "0.8.0-dev.17",
13
+ "@epam/statgpt-ui-components": "0.8.0-dev.17"
9
14
  },
10
15
  "peerDependencies": {
11
16
  "@epam/ai-dial-shared": "^0.43.3",