@epam/statgpt-conversation-list 0.5.0-rc.44 → 0.5.0-rc.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.mjs +139 -139
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),O=require("classnames"),p=require("react"),ce=require("lodash"),x=require("@epam/statgpt-ui-components"),q=require("@tabler/icons-react"),Oe=require("jszip"),F=require("@epam/statgpt-shared-toolkit"),Y=require("@epam/statgpt-dial-toolkit");var L=(t=>(t.DELETE="delete",t.EXPORT="export",t.SHARE="share",t.RENAME="rename",t))(L||{}),B=(t=>(t.SHARED="shared",t.TODAY="today",t.YESTERDAY="yesterday",t.WEEK="week",t.EARLIER="earlier",t))(B||{});const te=(t,r)=>t?.resources?.filter(s=>s?.parentPath===r)?.map(s=>{const i=`${s?.bucket}/${r}`,d=s?.url?.split("/")?.slice(1)?.join("/");return{...s,folderId:i,id:d,isShared:!0}})||[],pe=t=>({[B.SHARED]:t}),ke={[B.TODAY]:[],[B.YESTERDAY]:[],[B.WEEK]:[],[B.EARLIER]:[]},fe=(t,r)=>t.toDateString()===r.toDateString(),Le=(t,r)=>{const s=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1);return fe(r,s)},Be=(t,r)=>{const s=t.getTime()-r.getTime();return Math.floor(s/(1e3*60*60*24))},de=t=>t.updatedAt||Number(t.id?.split("-").pop()),Ue=t=>{const r=new Date,s=ce.cloneDeep(ke);for(const i of t)if(i.updatedAt){const d=new Date(i.updatedAt);let u;fe(r,d)?u=s[B.TODAY]:Le(r,d)?u=s[B.YESTERDAY]:Be(r,d)<=7?u=s[B.WEEK]:u=s[B.EARLIER],u?.some(E=>E.id===i.id)||u.push(i)}return s},me=t=>t?.sort((r,s)=>(de(s)||0)-(de(r)||0)),Fe=(t,r)=>t===B.SHARED?r?.shared||"Shared":t===B.TODAY?r?.today||"Today":t===B.YESTERDAY?r?.yesterday||"Yesterday":t===B.WEEK?r?.lastWeek||"Last week":r?.earlier||"Earlier",ge=p.createContext(null);function G(){const t=p.useContext(ge);if(!t)throw new Error("useConversationStyles must be used within ConversationStylesContext.Provider");return t}const ze=({onCloseModal:t,deleteConversation:r,locale:s})=>{const{titles:i,disableModalDividers:d,isSmallModalButton:u}=G();return c.jsxs(x.Popup,{heading:i?.deleteTitle??"Delete conversation",portalId:"delete-conversation",containerClassName:"delete-conversation-popup",size:x.PopUpSize.SM,dividers:!d,onClose:t,closeButtonTitle:i?.close??"Cancel",children:[c.jsx("div",{className:"px-6 py-4 sm:px-0",lang:s,children:i?.deleteMessage??"Are you sure you want to delete this conversation? This action cannot be undone."}),c.jsxs("div",{className:"delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",children:[c.jsx(x.Button,{buttonClassName:"cancel-button",title:i?.cancel??"Cancel",isSmallButton:u,onClick:E=>{E.stopPropagation(),t()}}),c.jsx(x.Button,{buttonClassName:"text-button-primary text-button-primary-error",title:i?.delete??"Delete",isSmallButton:u,onClick:E=>{E.stopPropagation(),r()}})]})]})},_e=t=>{const r=Qe(F.getConversationAttachments(t)).map(s=>({...s,relativePath:"",contentLength:0}));return ce.uniqBy(r,s=>J(s.relativePath,s.name))},$e=t=>t.endsWith("/"),He=t=>{const r=t.toLowerCase();return["data:","//","http://","https://","file://","ftp://","mailto:","telnet://","api/files"].some(s=>r.startsWith(s))},Ye=t=>{const r=J(...t.split("/").map(i=>decodeURIComponent(i))),s=r.lastIndexOf("/");return{absolutePath:r.slice(0,s),name:r.slice(s+1)}},Qe=t=>t?t.map(r=>{if(!r.url||He(r.url)||$e(r.url))return null;const{absolutePath:s,name:i}=Ye(r.url);return{id:r.url,name:i,contentType:r.type,folderId:s,absolutePath:s}}).filter(Boolean):[];async function Ge(t,r){const s=_e(t),i=new Oe;s.forEach(m=>{const e=encodeURI(J(m.absolutePath,m.name)),o=r(`${e}`.replace("files/","")),n=We(m.folderId),a=J("res",n,m.name);i.file(a,o)});const d={version:5,history:[t].map(Ve)||[],folders:[]},u=JSON.stringify(d,null,2);return i.file("conversations/conversations_history.json",u),await i.generateAsync({type:"base64"})}const We=t=>{const r=t.split("/");return r.length>2?J(...r.slice(2)):void 0},Ve=t=>ce.omit(t,["publicationInfo"]),J=(...t)=>t.filter(Boolean).join("/");function Xe(t,r){const s=document.createElement("a");s.download=r,s.href=t,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(t)}var Ke=Object.defineProperty,ne=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,he=(t,r,s)=>r in t?Ke(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,ie=(t,r)=>{for(var s in r||(r={}))Ce.call(r,s)&&he(t,s,r[s]);if(ne)for(var s of ne(r))Ee.call(r,s)&&he(t,s,r[s]);return t},le=(t,r)=>{var s={};for(var i in t)Ce.call(t,i)&&r.indexOf(i)<0&&(s[i]=t[i]);if(t!=null&&ne)for(var i of ne(t))r.indexOf(i)<0&&Ee.call(t,i)&&(s[i]=t[i]);return s};var V;(t=>{const r=class S{constructor(e,o,n,a){if(this.version=e,this.errorCorrectionLevel=o,this.modules=[],this.isFunction=[],e<S.MIN_VERSION||e>S.MAX_VERSION)throw new RangeError("Version value out of range");if(a<-1||a>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let l=[];for(let h=0;h<this.size;h++)l.push(!1);for(let h=0;h<this.size;h++)this.modules.push(l.slice()),this.isFunction.push(l.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(n);if(this.drawCodewords(f),a==-1){let h=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const g=this.getPenaltyScore();g<h&&(a=v,h=g),this.applyMask(v)}}d(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(e,o){const n=t.QrSegment.makeSegments(e);return S.encodeSegments(n,o)}static encodeBinary(e,o){const n=t.QrSegment.makeBytes(e);return S.encodeSegments([n],o)}static encodeSegments(e,o,n=1,a=40,l=-1,f=!0){if(!(S.MIN_VERSION<=n&&n<=a&&a<=S.MAX_VERSION)||l<-1||l>7)throw new RangeError("Invalid value");let h,v;for(h=n;;h++){const C=S.getNumDataCodewords(h,o)*8,y=E.getTotalBits(e,h);if(y<=C){v=y;break}if(h>=a)throw new RangeError("Data too long")}for(const C of[S.Ecc.MEDIUM,S.Ecc.QUARTILE,S.Ecc.HIGH])f&&v<=S.getNumDataCodewords(h,C)*8&&(o=C);let g=[];for(const C of e){s(C.mode.modeBits,4,g),s(C.numChars,C.mode.numCharCountBits(h),g);for(const y of C.getData())g.push(y)}d(g.length==v);const R=S.getNumDataCodewords(h,o)*8;d(g.length<=R),s(0,Math.min(4,R-g.length),g),s(0,(8-g.length%8)%8,g),d(g.length%8==0);for(let C=236;g.length<R;C^=253)s(C,8,g);let w=[];for(;w.length*8<g.length;)w.push(0);return g.forEach((C,y)=>w[y>>>3]|=C<<7-(y&7)),new S(h,o,w,l)}getModule(e,o){return 0<=e&&e<this.size&&0<=o&&o<this.size&&this.modules[o][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let n=0;n<this.size;n++)this.setFunctionModule(6,n,n%2==0),this.setFunctionModule(n,6,n%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),o=e.length;for(let n=0;n<o;n++)for(let a=0;a<o;a++)n==0&&a==0||n==0&&a==o-1||n==o-1&&a==0||this.drawAlignmentPattern(e[n],e[a]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const o=this.errorCorrectionLevel.formatBits<<3|e;let n=o;for(let l=0;l<10;l++)n=n<<1^(n>>>9)*1335;const a=(o<<10|n)^21522;d(a>>>15==0);for(let l=0;l<=5;l++)this.setFunctionModule(8,l,i(a,l));this.setFunctionModule(8,7,i(a,6)),this.setFunctionModule(8,8,i(a,7)),this.setFunctionModule(7,8,i(a,8));for(let l=9;l<15;l++)this.setFunctionModule(14-l,8,i(a,l));for(let l=0;l<8;l++)this.setFunctionModule(this.size-1-l,8,i(a,l));for(let l=8;l<15;l++)this.setFunctionModule(8,this.size-15+l,i(a,l));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let n=0;n<12;n++)e=e<<1^(e>>>11)*7973;const o=this.version<<12|e;d(o>>>18==0);for(let n=0;n<18;n++){const a=i(o,n),l=this.size-11+n%3,f=Math.floor(n/3);this.setFunctionModule(l,f,a),this.setFunctionModule(f,l,a)}}drawFinderPattern(e,o){for(let n=-4;n<=4;n++)for(let a=-4;a<=4;a++){const l=Math.max(Math.abs(a),Math.abs(n)),f=e+a,h=o+n;0<=f&&f<this.size&&0<=h&&h<this.size&&this.setFunctionModule(f,h,l!=2&&l!=4)}}drawAlignmentPattern(e,o){for(let n=-2;n<=2;n++)for(let a=-2;a<=2;a++)this.setFunctionModule(e+a,o+n,Math.max(Math.abs(a),Math.abs(n))!=1)}setFunctionModule(e,o,n){this.modules[o][e]=n,this.isFunction[o][e]=!0}addEccAndInterleave(e){const o=this.version,n=this.errorCorrectionLevel;if(e.length!=S.getNumDataCodewords(o,n))throw new RangeError("Invalid argument");const a=S.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][o],l=S.ECC_CODEWORDS_PER_BLOCK[n.ordinal][o],f=Math.floor(S.getNumRawDataModules(o)/8),h=a-f%a,v=Math.floor(f/a);let g=[];const R=S.reedSolomonComputeDivisor(l);for(let C=0,y=0;C<a;C++){let A=e.slice(y,y+v-l+(C<h?0:1));y+=A.length;const j=S.reedSolomonComputeRemainder(A,R);C<h&&A.push(0),g.push(A.concat(j))}let w=[];for(let C=0;C<g[0].length;C++)g.forEach((y,A)=>{(C!=v-l||A>=h)&&w.push(y[C])});return d(w.length==f),w}drawCodewords(e){if(e.length!=Math.floor(S.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let o=0;for(let n=this.size-1;n>=1;n-=2){n==6&&(n=5);for(let a=0;a<this.size;a++)for(let l=0;l<2;l++){const f=n-l,v=(n+1&2)==0?this.size-1-a:a;!this.isFunction[v][f]&&o<e.length*8&&(this.modules[v][f]=i(e[o>>>3],7-(o&7)),o++)}}d(o==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let o=0;o<this.size;o++)for(let n=0;n<this.size;n++){let a;switch(e){case 0:a=(n+o)%2==0;break;case 1:a=o%2==0;break;case 2:a=n%3==0;break;case 3:a=(n+o)%3==0;break;case 4:a=(Math.floor(n/3)+Math.floor(o/2))%2==0;break;case 5:a=n*o%2+n*o%3==0;break;case 6:a=(n*o%2+n*o%3)%2==0;break;case 7:a=((n+o)%2+n*o%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[o][n]&&a&&(this.modules[o][n]=!this.modules[o][n])}}getPenaltyScore(){let e=0;for(let l=0;l<this.size;l++){let f=!1,h=0,v=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[l][g]==f?(h++,h==5?e+=S.PENALTY_N1:h>5&&e++):(this.finderPenaltyAddHistory(h,v),f||(e+=this.finderPenaltyCountPatterns(v)*S.PENALTY_N3),f=this.modules[l][g],h=1);e+=this.finderPenaltyTerminateAndCount(f,h,v)*S.PENALTY_N3}for(let l=0;l<this.size;l++){let f=!1,h=0,v=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[g][l]==f?(h++,h==5?e+=S.PENALTY_N1:h>5&&e++):(this.finderPenaltyAddHistory(h,v),f||(e+=this.finderPenaltyCountPatterns(v)*S.PENALTY_N3),f=this.modules[g][l],h=1);e+=this.finderPenaltyTerminateAndCount(f,h,v)*S.PENALTY_N3}for(let l=0;l<this.size-1;l++)for(let f=0;f<this.size-1;f++){const h=this.modules[l][f];h==this.modules[l][f+1]&&h==this.modules[l+1][f]&&h==this.modules[l+1][f+1]&&(e+=S.PENALTY_N2)}let o=0;for(const l of this.modules)o=l.reduce((f,h)=>f+(h?1:0),o);const n=this.size*this.size,a=Math.ceil(Math.abs(o*20-n*10)/n)-1;return d(0<=a&&a<=9),e+=a*S.PENALTY_N4,d(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,o=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let n=[6];for(let a=this.size-7;n.length<e;a-=o)n.splice(1,0,a);return n}}static getNumRawDataModules(e){if(e<S.MIN_VERSION||e>S.MAX_VERSION)throw new RangeError("Version number out of range");let o=(16*e+128)*e+64;if(e>=2){const n=Math.floor(e/7)+2;o-=(25*n-10)*n-55,e>=7&&(o-=36)}return d(208<=o&&o<=29648),o}static getNumDataCodewords(e,o){return Math.floor(S.getNumRawDataModules(e)/8)-S.ECC_CODEWORDS_PER_BLOCK[o.ordinal][e]*S.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let o=[];for(let a=0;a<e-1;a++)o.push(0);o.push(1);let n=1;for(let a=0;a<e;a++){for(let l=0;l<o.length;l++)o[l]=S.reedSolomonMultiply(o[l],n),l+1<o.length&&(o[l]^=o[l+1]);n=S.reedSolomonMultiply(n,2)}return o}static reedSolomonComputeRemainder(e,o){let n=o.map(a=>0);for(const a of e){const l=a^n.shift();n.push(0),o.forEach((f,h)=>n[h]^=S.reedSolomonMultiply(f,l))}return n}static reedSolomonMultiply(e,o){if(e>>>8||o>>>8)throw new RangeError("Byte out of range");let n=0;for(let a=7;a>=0;a--)n=n<<1^(n>>>7)*285,n^=(o>>>a&1)*e;return d(n>>>8==0),n}finderPenaltyCountPatterns(e){const o=e[1];d(o<=this.size*3);const n=o>0&&e[2]==o&&e[3]==o*3&&e[4]==o&&e[5]==o;return(n&&e[0]>=o*4&&e[6]>=o?1:0)+(n&&e[6]>=o*4&&e[0]>=o?1:0)}finderPenaltyTerminateAndCount(e,o,n){return e&&(this.finderPenaltyAddHistory(o,n),o=0),o+=this.size,this.finderPenaltyAddHistory(o,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,o){o[0]==0&&(e+=this.size),o.pop(),o.unshift(e)}};r.MIN_VERSION=1,r.MAX_VERSION=40,r.PENALTY_N1=3,r.PENALTY_N2=3,r.PENALTY_N3=40,r.PENALTY_N4=10,r.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]],r.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]],t.QrCode=r;function s(m,e,o){if(e<0||e>31||m>>>e)throw new RangeError("Value out of range");for(let n=e-1;n>=0;n--)o.push(m>>>n&1)}function i(m,e){return(m>>>e&1)!=0}function d(m){if(!m)throw new Error("Assertion error")}const u=class M{constructor(e,o,n){if(this.mode=e,this.numChars=o,this.bitData=n,o<0)throw new RangeError("Invalid argument");this.bitData=n.slice()}static makeBytes(e){let o=[];for(const n of e)s(n,8,o);return new M(M.Mode.BYTE,e.length,o)}static makeNumeric(e){if(!M.isNumeric(e))throw new RangeError("String contains non-numeric characters");let o=[];for(let n=0;n<e.length;){const a=Math.min(e.length-n,3);s(parseInt(e.substring(n,n+a),10),a*3+1,o),n+=a}return new M(M.Mode.NUMERIC,e.length,o)}static makeAlphanumeric(e){if(!M.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let o=[],n;for(n=0;n+2<=e.length;n+=2){let a=M.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n))*45;a+=M.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n+1)),s(a,11,o)}return n<e.length&&s(M.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n)),6,o),new M(M.Mode.ALPHANUMERIC,e.length,o)}static makeSegments(e){return e==""?[]:M.isNumeric(e)?[M.makeNumeric(e)]:M.isAlphanumeric(e)?[M.makeAlphanumeric(e)]:[M.makeBytes(M.toUtf8ByteArray(e))]}static makeEci(e){let o=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)s(e,8,o);else if(e<16384)s(2,2,o),s(e,14,o);else if(e<1e6)s(6,3,o),s(e,21,o);else throw new RangeError("ECI assignment value out of range");return new M(M.Mode.ECI,0,o)}static isNumeric(e){return M.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return M.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,o){let n=0;for(const a of e){const l=a.mode.numCharCountBits(o);if(a.numChars>=1<<l)return 1/0;n+=4+l+a.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let o=[];for(let n=0;n<e.length;n++)e.charAt(n)!="%"?o.push(e.charCodeAt(n)):(o.push(parseInt(e.substring(n+1,n+3),16)),n+=2);return o}};u.NUMERIC_REGEX=/^[0-9]*$/,u.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,u.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let E=u;t.QrSegment=u})(V||(V={}));(t=>{(r=>{const s=class{constructor(d,u){this.ordinal=d,this.formatBits=u}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),r.Ecc=s})(t.QrCode||(t.QrCode={}))})(V||(V={}));(t=>{(r=>{const s=class{constructor(d,u){this.modeBits=d,this.numBitsCharCount=u}numCharCountBits(d){return this.numBitsCharCount[Math.floor((d+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),r.Mode=s})(t.QrSegment||(t.QrSegment={}))})(V||(V={}));var K=V;var qe={L:K.QrCode.Ecc.LOW,M:K.QrCode.Ecc.MEDIUM,Q:K.QrCode.Ecc.QUARTILE,H:K.QrCode.Ecc.HIGH},ve=128,xe="L",Se="#FFFFFF",we="#000000",ye=!1,Ne=1,Ze=4,Je=0,et=.1;function Re(t,r=0){const s=[];return t.forEach(function(i,d){let u=null;i.forEach(function(E,m){if(!E&&u!==null){s.push(`M${u+r} ${d+r}h${m-u}v1H${u+r}z`),u=null;return}if(m===i.length-1){if(!E)return;u===null?s.push(`M${m+r},${d+r} h1v1H${m+r}z`):s.push(`M${u+r},${d+r} h${m+1-u}v1H${u+r}z`);return}E&&u===null&&(u=m)})}),s.join("")}function be(t,r){return t.slice().map((s,i)=>i<r.y||i>=r.y+r.h?s:s.map((d,u)=>u<r.x||u>=r.x+r.w?d:!1))}function tt(t,r,s,i){if(i==null)return null;const d=t.length+s*2,u=Math.floor(r*et),E=d/r,m=(i.width||u)*E,e=(i.height||u)*E,o=i.x==null?t.length/2-m/2:i.x*E,n=i.y==null?t.length/2-e/2:i.y*E,a=i.opacity==null?1:i.opacity;let l=null;if(i.excavate){let h=Math.floor(o),v=Math.floor(n),g=Math.ceil(m+o-h),R=Math.ceil(e+n-v);l={x:h,y:v,w:g,h:R}}const f=i.crossOrigin;return{x:o,y:n,h:e,w:m,excavation:l,opacity:a,crossOrigin:f}}function nt(t,r){return r!=null?Math.max(Math.floor(r),0):t?Ze:Je}function Me({value:t,level:r,minVersion:s,includeMargin:i,marginSize:d,imageSettings:u,size:E,boostLevel:m}){let e=p.useMemo(()=>{const h=(Array.isArray(t)?t:[t]).reduce((v,g)=>(v.push(...K.QrSegment.makeSegments(g)),v),[]);return K.QrCode.encodeSegments(h,qe[r],s,void 0,void 0,m)},[t,r,s,m]);const{cells:o,margin:n,numCells:a,calculatedImageSettings:l}=p.useMemo(()=>{let f=e.getModules();const h=nt(i,d),v=f.length+h*2,g=tt(f,E,h,u);return{cells:f,margin:h,numCells:v,calculatedImageSettings:g}},[e,E,u,i,d]);return{qrcode:e,margin:n,cells:o,numCells:a,calculatedImageSettings:l}}var ot=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),st=p.forwardRef(function(r,s){const i=r,{value:d,size:u=ve,level:E=xe,bgColor:m=Se,fgColor:e=we,includeMargin:o=ye,minVersion:n=Ne,boostLevel:a,marginSize:l,imageSettings:f}=i,v=le(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:g}=v,R=le(v,["style"]),w=f?.src,C=p.useRef(null),y=p.useRef(null),A=p.useCallback(_=>{C.current=_,typeof s=="function"?s(_):s&&(s.current=_)},[s]),[j,b]=p.useState(!1),{margin:D,cells:z,numCells:$,calculatedImageSettings:T}=Me({value:d,level:E,minVersion:n,boostLevel:a,includeMargin:o,marginSize:l,imageSettings:f,size:u});p.useEffect(()=>{if(C.current!=null){const _=C.current,N=_.getContext("2d");if(!N)return;let I=z;const P=y.current,k=T!=null&&P!==null&&P.complete&&P.naturalHeight!==0&&P.naturalWidth!==0;k&&T.excavation!=null&&(I=be(z,T.excavation));const Q=window.devicePixelRatio||1;_.height=_.width=u*Q;const X=u/$*Q;N.scale(X,X),N.fillStyle=m,N.fillRect(0,0,$,$),N.fillStyle=e,ot?N.fill(new Path2D(Re(I,D))):z.forEach(function(oe,ee){oe.forEach(function(se,re){se&&N.fillRect(re+D,ee+D,1,1)})}),T&&(N.globalAlpha=T.opacity),k&&N.drawImage(P,T.x+D,T.y+D,T.w,T.h)}}),p.useEffect(()=>{b(!1)},[w]);const H=ie({height:u,width:u},g);let W=null;return w!=null&&(W=p.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{b(!0)},ref:y,crossOrigin:T?.crossOrigin})),p.createElement(p.Fragment,null,p.createElement("canvas",ie({style:H,height:u,width:u,ref:A,role:"img"},R)),W)});st.displayName="QRCodeCanvas";var Ae=p.forwardRef(function(r,s){const i=r,{value:d,size:u=ve,level:E=xe,bgColor:m=Se,fgColor:e=we,includeMargin:o=ye,minVersion:n=Ne,boostLevel:a,title:l,marginSize:f,imageSettings:h}=i,v=le(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:g,cells:R,numCells:w,calculatedImageSettings:C}=Me({value:d,level:E,minVersion:n,boostLevel:a,includeMargin:o,marginSize:f,imageSettings:h,size:u});let y=R,A=null;h!=null&&C!=null&&(C.excavation!=null&&(y=be(R,C.excavation)),A=p.createElement("image",{href:h.src,height:C.h,width:C.w,x:C.x+g,y:C.y+g,preserveAspectRatio:"none",opacity:C.opacity,crossOrigin:C.crossOrigin}));const j=Re(y,g);return p.createElement("svg",ie({height:u,width:u,viewBox:`0 0 ${w} ${w}`,ref:s,role:"img"},v),!!l&&p.createElement("title",null,l),p.createElement("path",{fill:m,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),p.createElement("path",{fill:e,d:j,shapeRendering:"crispEdges"}),A)});Ae.displayName="QRCodeSVG";const rt=(t,r)=>({invitationType:Y.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(t)}`},...r]}),at=t=>{const r=t?.invitationLink?.split("/").at(-1)||"";return`/${F.SHARE_CONVERSATION_ROUTE}/${r}`},it=(t,r)=>r?.find(s=>{const i=t?.id?.split("/")?.pop(),d=s?.url?.split("/")?.pop()||"";return d===i||decodeURI(d)===i}),lt=t=>t?.messages?.filter(s=>!!s?.custom_content?.attachments)?.flatMap(s=>s?.custom_content?.attachments?.map(i=>({url:i?.url||""}))||[])?.filter(s=>!!s?.url)||[],ct=({conversation:t,locale:r,onCloseModal:s,modalDividers:i,getConversation:d,generateConversationLink:u,chatExpiration:E,chatExpirationDays:m,close:e,chatWarning:o,shareLink:n,shareCopyLink:a,shareCopiedLink:l,shareDescription:f,shareRemoveAccessToUsers:h,chatName:v,getSharedConversations:g,revokeSharedConversations:R,baseUrl:w,id:C,clientSharedPage:y,clientSharedProp:A})=>{const[j,b]=p.useState(null),[D,z]=p.useState(),[$,T]=p.useState(!1),[H,W]=p.useState(!1),[_,N]=p.useState(),I=p.useRef(null),P=p.useRef(null),k=p.useMemo(()=>t?.id?decodeURI(t.id):C?.[0]&&C?.[1]&&r?decodeURI(`${C[0]}/${r}/${C[1]}`):null,[t?.id,C,r]),Q=p.useMemo(()=>{if(!j)return"";const U=w||window.location.origin;if(w&&w!==window.location.origin&&y&&A){const Z=j.split(`/${F.SHARE_CONVERSATION_ROUTE}/`)?.[1];return`${U}/${y}?${A}=${Z}`}return`${U}/${r}${j}`},[w,j,r,y,A]),X=p.useCallback(async U=>{const Z=await g?.(Y.getSharedConversationsRequest(Y.ShareTarget.OTHERS));if(Z)return it({id:U},Z.resources)},[g]);p.useEffect(()=>{if(!k||I.current===k)return;I.current=k,T(!1),P.current?.abort();const U=new AbortController;return P.current=U,(async()=>{try{const ae=await d?.(k),Te=rt(k,lt(ae)),ue=await u?.(Te),De=await X(k);if(U.signal.aborted||!ue)return;b(at(ue)),z(De),T(!0)}catch(ae){if(U.signal.aborted)return;T(!1),console.error("Error sharing conversation",ae)}})(),()=>{U.abort(),I.current=null}},[k,u,d,X]);const oe=p.useCallback(()=>{P.current?.abort(),I.current=null,s(),b(null),T(!1),W(!1)},[s]),ee=p.useCallback(()=>{W(!0),navigator.clipboard.writeText(Q||"")},[Q]),se=async()=>{try{if(N(!0),D&&await R?.({resources:[D]}),k){const U=await X(k);P.current?.signal.aborted||z(U)}}catch(U){console.error("Error revoking shared conversation",U)}finally{P.current?.signal.aborted||N(!1)}},re=p.useCallback(()=>c.jsx(x.Button,{buttonClassName:H?"text-button-secondary":"text-button-primary",iconBefore:H?c.jsx(q.IconCheck,{width:20,height:20}):c.jsx(q.IconCopy,{width:20,height:20}),title:H?l??"Copied":a??"Copy link",disabled:H,onClick:ee}),[H,ee,l,a]);return c.jsxs(x.Popup,{heading:n??"Share link",portalId:"share",size:x.PopUpSize.SM,dividers:i,onClose:oe,closeButtonTitle:e??"Close",children:[$?c.jsxs("div",{className:"share flex flex-col gap-y-4 overflow-auto px-6 pb-6 sm:p-0",children:[t?.name?c.jsxs("div",{className:"share-info flex w-full",children:[c.jsx("p",{className:"share-info-title body-1 mr-1 text-neutrals-800",children:v??"Chat name:"}),c.jsx("h3",{className:"min-w-0 flex-1 truncate",title:t?.name,children:t?.name})]}):null,c.jsxs("div",{className:"share-info flex",children:[c.jsx("p",{className:"share-info-title body-1 mr-1 text-neutrals-800",children:E??"Link expiration date:"}),c.jsxs("h3",{children:["3 ",m??"days"]})]}),c.jsx(Ae,{className:"min-h-[200px] self-center rounded border border-neutrals-600 p-2",value:Q,size:200}),c.jsx("p",{className:"body-2 text-neutrals-1000",children:f??"Your name, special instructions, and any messages you add after sharing remain confidential."}),c.jsx(x.InputWithIcon,{containerClasses:"share-input-container",cssClass:"share-input",readonly:!0,placeholder:Q,value:Q,inputId:"conversationLink",iconAfterInput:re()})]}):c.jsx("div",{className:"flex items-center justify-center p-6",children:c.jsx(x.Loader,{})}),$?t&&D?c.jsx("div",{className:"remove-access",children:c.jsx(x.Button,{title:h??"Remove access to all users",buttonClassName:"remove-access-button py-3 px-4",isSmallButton:!0,disabled:_,onClick:se})}):c.jsx("p",{className:"body-2 share-footer text-neutrals-800",children:o??"This chat has not been shared with anyone yet."}):c.jsx("div",{})]})},ut=({conversation:t,onCloseModal:r,renameConversation:s,locale:i})=>{const{titles:d,disableModalDividers:u,isSmallModalButton:E}=G(),[m,e]=p.useState(t?.name||""),o=a=>{e(a)},n=()=>{const a=`${t?.folderId}/${encodeURIComponent(F.getClearedConversationName(m))}-${new Date().getTime()}`;s(`conversations/${t.id}`,`conversations/${a}`)};return c.jsxs(x.Popup,{heading:d?.renameTitle??"Rename conversation",portalId:"rename-conversation",containerClassName:"rename-conversation-popup",size:x.PopUpSize.SM,dividers:!u,onClose:r,closeButtonTitle:d?.close??"Cancel",children:[c.jsx("div",{className:"px-6 py-4 sm:px-0",lang:i,children:c.jsx(x.Input,{inputId:"rename",value:m,onChange:o,cssClass:"w-full"})}),c.jsxs("div",{className:"delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",children:[c.jsx(x.Button,{buttonClassName:"cancel-button",title:d?.cancel??"Cancel",isSmallButton:E,onClick:a=>{a.stopPropagation(),r()}}),c.jsx(x.Button,{buttonClassName:"text-button-primary text-button-primary",title:d?.save??"Rename",isSmallButton:E,disabled:!m,onClick:a=>{a.stopPropagation(),n()}})]})]})},Ie=p.createContext(null);function dt({children:t,value:r}){return c.jsx(Ie.Provider,{value:r,children:t})}function ht(){const t=p.useContext(Ie);if(!t)throw new Error("useConversationListActions must be used within ConversationListActionsProvider");return t}const Pe=({conversation:t,triggerButton:r,isDisabled:s})=>{const i=G(),{locale:d,deleteConversation:u,renameConversation:E,getConversation:m,getFileBlob:e,shareConversationProps:o}=ht(),n=p.useMemo(()=>{const b=[{key:L.DELETE,title:i?.titles?.delete??"Delete",icon:i.actionsIcons?.[L.DELETE]}];return t?.model?.id?.endsWith(F.ONBOARDING_MODEL_POSTFIX)?b:[...t.isShared?[]:[{key:L.SHARE,title:i?.titles?.share??"Share",icon:i.actionsIcons?.[L.SHARE]},{key:L.RENAME,title:i?.titles?.rename??"Rename",icon:i.actionsIcons?.[L.RENAME]}],{key:L.EXPORT,title:i?.titles?.export??"Export",icon:i.actionsIcons?.[L.EXPORT]},...b]},[t.isShared,t?.model?.id,i.titles,i.actionsIcons]),[a,l]=p.useState(x.PopUpState.Closed),[f,h]=p.useState(x.PopUpState.Closed),[v,g]=p.useState(x.PopUpState.Closed),R=p.useCallback(()=>{l(x.PopUpState.Closed)},[l]),w=p.useCallback(()=>{h(x.PopUpState.Closed)},[h]),C=p.useCallback(()=>{g(x.PopUpState.Closed)},[g]),y=p.useCallback(()=>{u(t),R()},[t,u,R]),A=p.useCallback((b,D)=>{E(b,D),C()},[E,C]),j=b=>{b===L.DELETE&&l(x.PopUpState.Opened),b===L.SHARE&&h(x.PopUpState.Opened),b===L.RENAME&&g(x.PopUpState.Opened),b===L.EXPORT&&m(decodeURI(t.id)).then(D=>{Ge(D,e).then(z=>{Xe(`data:application/zip;base64,${z}`,`chat_with_attachments_${new Date().toLocaleDateString()}.dial`)})})};return c.jsxs(c.Fragment,{children:[c.jsx(x.Dropdown,{containerClassName:"ml-3 group-hover:visible invisible",triggerButton:r??c.jsx(pt,{disabled:s}),options:n,openedClassName:"action-menu-opened",onOptionSelect:j,disabled:s}),a===x.PopUpState.Opened&&c.jsx(ze,{locale:d,deleteConversation:y,onCloseModal:R}),f===x.PopUpState.Opened&&c.jsx(ct,{conversation:t,locale:d,onCloseModal:w,...o}),v===x.PopUpState.Opened&&c.jsx(ut,{conversation:t,locale:d,renameConversation:A,onCloseModal:C})]})},pt=({disabled:t})=>c.jsx("div",{className:O("flex items-center justify-center w-[24px]",t?"cursor-not-allowed":"cursor-pointer"),children:c.jsx(q.IconDotsVertical,{width:20,height:20,stroke:2,className:"text-primary"})}),je=({conversation:t,selectedConversationId:r,searchQuery:s,onConversationClick:i,isDisabled:d})=>{const{titles:u,conversationItemIcon:E}=G(),m=p.useRef(null),e=F.getClearedConversationName(t?.name);return p.useEffect(()=>{if(t?.id===r&&m?.current){const o=m.current.parentElement?.parentElement?.parentElement;if(o){const n=m.current.getBoundingClientRect(),a=o.getBoundingClientRect(),l=n.height,f=a.height,v=n.top-a.top+o.scrollTop-(f/2-l/2);o.scrollTo({top:v,behavior:"smooth"})}}},[t,r]),c.jsxs("div",{ref:m,className:O("flex justify-between items-center py-2 px-3 border-transparent relative group border","conversation-item",r===t?.id&&"bg-hues-100 conversation-item-active",d?"cursor-not-allowed":"cursor-pointer hover:border-hues-600"),onClick:()=>!d&&i(t.folderId,t?.id),title:d?u?.noActionsAllowed:e,children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-center",children:[E||null,c.jsx("h3",{className:O("truncate font-semibold text-neutrals-1000 sm:body-2","conversation-item-text",r===t?.id?"conversation-item-text-active":""),title:d?u?.noActionsAllowed:e,children:s?.length?c.jsx(x.HighlightText,{text:e,highlightText:s}):e})]}),c.jsx(Pe,{conversation:t,isDisabled:d})]})},ft=({handleConversationClick:t,selectedConversationId:r,groupLabel:s,groupedConversations:i,isDisabled:d})=>{const{titles:u}=G(),[E,m]=p.useState(!1),e=p.useCallback(()=>{m(o=>!o)},[m]);return c.jsxs("div",{children:[c.jsxs("div",{className:"conversation-group-items-title mb-3 inline-flex cursor-pointer items-center gap-1 text-neutrals-700",onClick:e,children:[c.jsx(q.IconCaretRightFilled,{className:O("w-3 h-3 conversation-group-items-arrow",E?"rotate-[90deg]":"rotate-0")}),c.jsx("span",{className:"body-3 conversation-group-items-title-text",children:Fe(s,u)})]}),!E&&c.jsx("div",{className:O("flex flex-col gap-y-3","conversation-group-items"),children:me(i).map(o=>c.jsx(je,{isDisabled:d,conversation:o,selectedConversationId:r,onConversationClick:t},o.id||o.name))})]},s)},mt=({searchQuery:t,isExpandedSearch:r,onSearchConversations:s,toggleSearchField:i})=>{const{titles:d,searchIcon:u}=G();return c.jsx(c.Fragment,{children:r?c.jsx(x.InputWithIcon,{inputId:"conversations-search",placeholder:d?.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:t,iconAfterInput:c.jsx(x.IconButton,{buttonClassName:"text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5",onClick:i,icon:c.jsx(q.IconX,{})}),onChange:s}):c.jsx(x.Button,{buttonClassName:"text-button-tertiary p-0 search-button",iconBefore:u||c.jsx(q.IconSearch,{className:"size-5"}),onClick:i})})},gt=({conversations:t,selectedConversationId:r,searchQuery:s,handleConversationClick:i,isDisabled:d})=>{const{titles:u}=G(),[E,m]=p.useState([]);return p.useEffect(()=>{m(me(t?.filter(e=>F.getClearedConversationName(e?.name)?.includes(s||""))))},[t,s]),c.jsx(c.Fragment,{children:E?.length?E.map(e=>c.jsx(je,{conversation:e,searchQuery:s,selectedConversationId:r,onConversationClick:i,isDisabled:d},e.id)):c.jsx("h3",{className:"text-neutrals-800",children:u?.noConversation??"No conversations yet"})})},Ct=()=>{const{titles:t}=G();return c.jsxs("div",{className:"flex flex-col p-8 text-center",children:[c.jsx("p",{className:"text-neutrals-800",children:t?.noConversation??"No conversations yet"}),c.jsx("p",{className:"mt-2 text-sm text-neutrals-800",children:t?.clickNewChat??'Click "New Chat" to start a conversation'})]})},Et=({handleConversationClick:t,selectedConversationId:r,actions:s,children:i,isCollapsed:d,isStreaming:u,conversationStyles:E,conversations:m,locale:e,sharedConversations:o,setConversations:n,setSharedConversations:a,shareConversationProps:l,handleSelectedConversationRemove:f})=>{const[h,v]=p.useState({}),[g,R]=p.useState(!0),[w,C]=p.useState(""),[y,A]=p.useState(!1),{getConversations:j,getSharedConversations:b,deleteConversation:D,renameConversation:z}=s,$=p.useMemo(()=>!!w?.length,[w]);p.useEffect(()=>{v({...pe(o),...Ue(m)})},[m,o]),p.useEffect(()=>{async function N(){try{R(!0);const I=await j(e),P=await b(Y.getSharedConversationsRequest(Y.ShareTarget.ME));n(F.cleanConversationNames(I)),a(F.cleanConversationNames(te(P,e)))}catch(I){console.error("Error loading conversation",I)}finally{R(!1)}}N()},[j,n,e,b,a]);const T=p.useCallback(async N=>{try{await D(N);const I=await j(e),P=await b(Y.getSharedConversationsRequest(Y.ShareTarget.ME));n(F.cleanConversationNames(I)),a(F.cleanConversationNames(te(P,e))),r===N?.id&&f()}catch(I){console.error("Error deleting conversation",I)}},[D,j,e,b,n,a,r,f]),H=p.useCallback(async(N,I)=>{try{R(!0),await z(N,I);const P=await j(e),k=await b(Y.getSharedConversationsRequest(Y.ShareTarget.ME));n(F.cleanConversationNames(P)),a(F.cleanConversationNames(te(k,e)))}catch(P){console.error("Error renaming conversation",P)}finally{R(!1)}},[j,e,b,n,a,z]),W=p.useCallback(N=>{C(N)},[C]),_=p.useCallback(()=>{A(N=>!N),C("")},[A]);return g?c.jsx(x.Loader,{}):c.jsx(dt,{value:{locale:e,deleteConversation:T,renameConversation:H,getConversation:s.getConversation,getFileBlob:s.getFileBlob,shareConversationProps:l},children:c.jsxs(ge.Provider,{value:E,children:[!d&&c.jsxs("div",{className:O("flex justify-between items-center",y?" pt-4 pb-0 sm:pt-10":" pt-6 pb-2 sm:pt-10"),children:[!y&&c.jsx("h3",{className:"sm:body-2 text-neutrals-700",children:E?.titles?.allChats??"All Chats"}),c.jsx(mt,{searchQuery:w,isExpandedSearch:y,onSearchConversations:W,toggleSearchField:_})]}),c.jsx("div",{className:O("scroll-hidden-container flex flex-col mt-4 flex-1 min-h-0 pr-2",$?"gap-y-1":"gap-y-6"),children:d?null:c.jsx(c.Fragment,{children:m?.length===0&&o?.length===0?c.jsx(Ct,{}):$?c.jsx(gt,{conversations:[...o,...m],searchQuery:w,selectedConversationId:r,handleConversationClick:t,isDisabled:u}):Object.entries(h).map(([N,I])=>I?.length>0&&c.jsx(ft,{isDisabled:u,groupLabel:N,groupedConversations:I,handleConversationClick:t,selectedConversationId:r},N))})}),i]})})},vt=({onCloseModal:t,disableModalDividers:r,signOut:s,isSmallButton:i,locale:d,titles:u})=>c.jsxs(x.Popup,{heading:u?.popupTitle||"Log out?",portalId:"sign-out",containerClassName:"sign-out-popup",size:x.PopUpSize.SM,dividers:!r,onClose:t,closeButtonTitle:"Cancel",children:[c.jsx("div",{className:"px-6 py-4 sm:px-0",lang:d,children:u?.popupText}),c.jsxs("div",{className:"delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",children:[c.jsx(x.Button,{buttonClassName:"cancel-button",title:u?.popupCancel||"Cancel",isSmallButton:i,onClick:E=>{E.stopPropagation(),t()}}),c.jsx(x.Button,{buttonClassName:"text-button-primary",title:u?.popupApply||"Sign Out",isSmallButton:i,onClick:E=>{E.stopPropagation(),s?.()}})]})]}),xt=({userInfo:t,signOutAction:r,contactSupportUrl:s,styles:i,locale:d,titles:u})=>{const E=R=>R?.split(" ")?.map((w,C)=>C<2?w[0].toUpperCase():"")?.join("")??"",m=p.useMemo(()=>t?.name?E(t?.name):t?.email?.[0].toUpperCase()??"",[t]),[e,o]=p.useState(!1),n=t?.name?.split(" "),a=n?`${n?.[0]??""} ${n?.[1]?.[0]?n?.[1]?.[0]+".":""}`:t?.email??"",l=p.useCallback(()=>{o(!0)},[]),f=p.useCallback(()=>{o(!1)},[]),h=p.useCallback(()=>{window.open(s||"#","_blank","noopener,noreferrer")},[s]),v=p.useMemo(()=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:O("cursor-pointer flex items-center justify-center size-11 rounded-[100px] p-[10px] sm:h-[32px] sm:w-[32px] flex-shrink-0",i?.initialStyles),children:m}),c.jsx("p",{className:O("h3 cursor-pointer overflow-hidden text-ellipsis",i?.userNameStyles),children:(i?.showShortName?a:t?.name)??t?.email??""})]}),[m,a,i,t]),g=p.useMemo(()=>c.jsxs("div",{className:O("py-1",i?.dropDownStyles),children:[i?.settingsIcon&&c.jsxs("button",{className:O("p-2 items-center flex gap-1 text-primary fill-primary",i?.dropdownButtonTypographyStyles||"body-1",i?.dropdownButtonStyles),title:u?.settings,children:[c.jsx("span",{className:"shrink-0",children:i?.settingsIcon}),c.jsx("span",{className:"min-w-0 break-words",children:u?.settings||"Settings"})]}),i?.contactSupportIcon&&c.jsxs("button",{className:O("p-2 items-center flex gap-1 text-primary fill-primary",i?.dropdownButtonTypographyStyles||"body-1",i?.dropdownButtonStyles),title:u?.contactSupport,onClick:h,children:[c.jsx("span",{className:"shrink-0",children:i?.contactSupportIcon}),c.jsx("span",{className:"min-w-0 break-words",children:u?.contactSupport||"Contact support"})]}),c.jsx("div",{className:O("h-0 border-t border-neutrals-600 my-2",i?.showSeparator?"block":"hidden")}),c.jsxs("button",{className:O("p-2 items-center flex gap-1 text-primary fill-primary",i?.dropdownButtonTypographyStyles||"body-1",i?.dropdownButtonStyles),title:u?.signOut,onClick:l,children:[c.jsx("span",{className:"shrink-0",children:i?.signOutIcon}),c.jsx("span",{className:"min-w-0 break-words",children:u?.signOut||"Sign out"}),e&&c.jsx(vt,{onCloseModal:f,signOut:()=>r?.(),locale:d,disableModalDividers:i?.disableModalDividers,titles:u})]})]}),[i,u,l,h,e,f,d,r]);if(t)return c.jsx(x.Dropdown,{containerClassName:O("transition-opacity group-hover:opacity-100 shrink w-full",i?.dropdownContainerClassName),triggerButton:v,content:g,openedClassName:"action-menu-opened"})};exports.ActionMenu=Pe;exports.ActionMenuItem=L;exports.ConversationList=Et;exports.User=xt;exports.getSharedConversationsGroup=pe;exports.transformSharedConversations=te;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),O=require("classnames"),p=require("react"),ce=require("lodash"),x=require("@epam/statgpt-ui-components"),q=require("@tabler/icons-react"),Oe=require("jszip"),F=require("@epam/statgpt-shared-toolkit"),Y=require("@epam/statgpt-dial-toolkit");var L=(t=>(t.DELETE="delete",t.EXPORT="export",t.SHARE="share",t.RENAME="rename",t))(L||{}),B=(t=>(t.SHARED="shared",t.TODAY="today",t.YESTERDAY="yesterday",t.WEEK="week",t.EARLIER="earlier",t))(B||{});const te=(t,r)=>t?.resources?.filter(s=>s?.parentPath===r)?.map(s=>{const i=`${s?.bucket}/${r}`,d=s?.url?.split("/")?.slice(1)?.join("/");return{...s,folderId:i,id:d,isShared:!0}})||[],pe=t=>({[B.SHARED]:t}),ke={[B.TODAY]:[],[B.YESTERDAY]:[],[B.WEEK]:[],[B.EARLIER]:[]},fe=(t,r)=>t.toDateString()===r.toDateString(),Le=(t,r)=>{const s=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1);return fe(r,s)},Be=(t,r)=>{const s=t.getTime()-r.getTime();return Math.floor(s/(1e3*60*60*24))},de=t=>t.updatedAt||Number(t.id?.split("-").pop()),Ue=t=>{const r=new Date,s=ce.cloneDeep(ke);for(const i of t)if(i.updatedAt){const d=new Date(i.updatedAt);let u;fe(r,d)?u=s[B.TODAY]:Le(r,d)?u=s[B.YESTERDAY]:Be(r,d)<=7?u=s[B.WEEK]:u=s[B.EARLIER],u?.some(E=>E.id===i.id)||u.push(i)}return s},me=t=>t?.sort((r,s)=>(de(s)||0)-(de(r)||0)),Fe=(t,r)=>t===B.SHARED?r?.shared||"Shared":t===B.TODAY?r?.today||"Today":t===B.YESTERDAY?r?.yesterday||"Yesterday":t===B.WEEK?r?.lastWeek||"Last week":r?.earlier||"Earlier",ge=p.createContext(null);function G(){const t=p.useContext(ge);if(!t)throw new Error("useConversationStyles must be used within ConversationStylesContext.Provider");return t}const ze=({onCloseModal:t,deleteConversation:r,locale:s})=>{const{titles:i,disableModalDividers:d,isSmallModalButton:u}=G();return c.jsxs(x.Popup,{heading:i?.deleteTitle??"Delete conversation",portalId:"delete-conversation",containerClassName:"delete-conversation-popup",size:x.PopUpSize.SM,dividers:!d,onClose:t,closeButtonTitle:i?.close??"Cancel",children:[c.jsx("div",{className:"px-6 py-4 sm:px-0",lang:s,children:i?.deleteMessage??"Are you sure you want to delete this conversation? This action cannot be undone."}),c.jsxs("div",{className:"delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",children:[c.jsx(x.Button,{buttonClassName:"cancel-button",title:i?.cancel??"Cancel",isSmallButton:u,onClick:E=>{E.stopPropagation(),t()}}),c.jsx(x.Button,{buttonClassName:"text-button-primary text-button-primary-error",title:i?.delete??"Delete",isSmallButton:u,onClick:E=>{E.stopPropagation(),r()}})]})]})},_e=t=>{const r=Qe(F.getConversationAttachments(t)).map(s=>({...s,relativePath:"",contentLength:0}));return ce.uniqBy(r,s=>J(s.relativePath,s.name))},$e=t=>t.endsWith("/"),He=t=>{const r=t.toLowerCase();return["data:","//","http://","https://","file://","ftp://","mailto:","telnet://","api/files"].some(s=>r.startsWith(s))},Ye=t=>{const r=J(...t.split("/").map(i=>decodeURIComponent(i))),s=r.lastIndexOf("/");return{absolutePath:r.slice(0,s),name:r.slice(s+1)}},Qe=t=>t?t.map(r=>{if(!r.url||He(r.url)||$e(r.url))return null;const{absolutePath:s,name:i}=Ye(r.url);return{id:r.url,name:i,contentType:r.type,folderId:s,absolutePath:s}}).filter(Boolean):[];async function Ge(t,r){const s=_e(t),i=new Oe;s.forEach(m=>{const e=encodeURI(J(m.absolutePath,m.name)),o=r(`${e}`.replace("files/","")),n=We(m.folderId),a=J("res",n,m.name);i.file(a,o)});const d={version:5,history:[t].map(Ve)||[],folders:[]},u=JSON.stringify(d,null,2);return i.file("conversations/conversations_history.json",u),await i.generateAsync({type:"base64"})}const We=t=>{const r=t.split("/");return r.length>2?J(...r.slice(2)):void 0},Ve=t=>ce.omit(t,["publicationInfo"]),J=(...t)=>t.filter(Boolean).join("/");function Xe(t,r){const s=document.createElement("a");s.download=r,s.href=t,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(t)}var Ke=Object.defineProperty,ne=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,he=(t,r,s)=>r in t?Ke(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s,ie=(t,r)=>{for(var s in r||(r={}))Ce.call(r,s)&&he(t,s,r[s]);if(ne)for(var s of ne(r))Ee.call(r,s)&&he(t,s,r[s]);return t},le=(t,r)=>{var s={};for(var i in t)Ce.call(t,i)&&r.indexOf(i)<0&&(s[i]=t[i]);if(t!=null&&ne)for(var i of ne(t))r.indexOf(i)<0&&Ee.call(t,i)&&(s[i]=t[i]);return s};var V;(t=>{const r=class S{constructor(e,o,n,a){if(this.version=e,this.errorCorrectionLevel=o,this.modules=[],this.isFunction=[],e<S.MIN_VERSION||e>S.MAX_VERSION)throw new RangeError("Version value out of range");if(a<-1||a>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let l=[];for(let h=0;h<this.size;h++)l.push(!1);for(let h=0;h<this.size;h++)this.modules.push(l.slice()),this.isFunction.push(l.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(n);if(this.drawCodewords(f),a==-1){let h=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const g=this.getPenaltyScore();g<h&&(a=v,h=g),this.applyMask(v)}}d(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(e,o){const n=t.QrSegment.makeSegments(e);return S.encodeSegments(n,o)}static encodeBinary(e,o){const n=t.QrSegment.makeBytes(e);return S.encodeSegments([n],o)}static encodeSegments(e,o,n=1,a=40,l=-1,f=!0){if(!(S.MIN_VERSION<=n&&n<=a&&a<=S.MAX_VERSION)||l<-1||l>7)throw new RangeError("Invalid value");let h,v;for(h=n;;h++){const C=S.getNumDataCodewords(h,o)*8,y=E.getTotalBits(e,h);if(y<=C){v=y;break}if(h>=a)throw new RangeError("Data too long")}for(const C of[S.Ecc.MEDIUM,S.Ecc.QUARTILE,S.Ecc.HIGH])f&&v<=S.getNumDataCodewords(h,C)*8&&(o=C);let g=[];for(const C of e){s(C.mode.modeBits,4,g),s(C.numChars,C.mode.numCharCountBits(h),g);for(const y of C.getData())g.push(y)}d(g.length==v);const R=S.getNumDataCodewords(h,o)*8;d(g.length<=R),s(0,Math.min(4,R-g.length),g),s(0,(8-g.length%8)%8,g),d(g.length%8==0);for(let C=236;g.length<R;C^=253)s(C,8,g);let w=[];for(;w.length*8<g.length;)w.push(0);return g.forEach((C,y)=>w[y>>>3]|=C<<7-(y&7)),new S(h,o,w,l)}getModule(e,o){return 0<=e&&e<this.size&&0<=o&&o<this.size&&this.modules[o][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let n=0;n<this.size;n++)this.setFunctionModule(6,n,n%2==0),this.setFunctionModule(n,6,n%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),o=e.length;for(let n=0;n<o;n++)for(let a=0;a<o;a++)n==0&&a==0||n==0&&a==o-1||n==o-1&&a==0||this.drawAlignmentPattern(e[n],e[a]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const o=this.errorCorrectionLevel.formatBits<<3|e;let n=o;for(let l=0;l<10;l++)n=n<<1^(n>>>9)*1335;const a=(o<<10|n)^21522;d(a>>>15==0);for(let l=0;l<=5;l++)this.setFunctionModule(8,l,i(a,l));this.setFunctionModule(8,7,i(a,6)),this.setFunctionModule(8,8,i(a,7)),this.setFunctionModule(7,8,i(a,8));for(let l=9;l<15;l++)this.setFunctionModule(14-l,8,i(a,l));for(let l=0;l<8;l++)this.setFunctionModule(this.size-1-l,8,i(a,l));for(let l=8;l<15;l++)this.setFunctionModule(8,this.size-15+l,i(a,l));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let n=0;n<12;n++)e=e<<1^(e>>>11)*7973;const o=this.version<<12|e;d(o>>>18==0);for(let n=0;n<18;n++){const a=i(o,n),l=this.size-11+n%3,f=Math.floor(n/3);this.setFunctionModule(l,f,a),this.setFunctionModule(f,l,a)}}drawFinderPattern(e,o){for(let n=-4;n<=4;n++)for(let a=-4;a<=4;a++){const l=Math.max(Math.abs(a),Math.abs(n)),f=e+a,h=o+n;0<=f&&f<this.size&&0<=h&&h<this.size&&this.setFunctionModule(f,h,l!=2&&l!=4)}}drawAlignmentPattern(e,o){for(let n=-2;n<=2;n++)for(let a=-2;a<=2;a++)this.setFunctionModule(e+a,o+n,Math.max(Math.abs(a),Math.abs(n))!=1)}setFunctionModule(e,o,n){this.modules[o][e]=n,this.isFunction[o][e]=!0}addEccAndInterleave(e){const o=this.version,n=this.errorCorrectionLevel;if(e.length!=S.getNumDataCodewords(o,n))throw new RangeError("Invalid argument");const a=S.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][o],l=S.ECC_CODEWORDS_PER_BLOCK[n.ordinal][o],f=Math.floor(S.getNumRawDataModules(o)/8),h=a-f%a,v=Math.floor(f/a);let g=[];const R=S.reedSolomonComputeDivisor(l);for(let C=0,y=0;C<a;C++){let A=e.slice(y,y+v-l+(C<h?0:1));y+=A.length;const j=S.reedSolomonComputeRemainder(A,R);C<h&&A.push(0),g.push(A.concat(j))}let w=[];for(let C=0;C<g[0].length;C++)g.forEach((y,A)=>{(C!=v-l||A>=h)&&w.push(y[C])});return d(w.length==f),w}drawCodewords(e){if(e.length!=Math.floor(S.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let o=0;for(let n=this.size-1;n>=1;n-=2){n==6&&(n=5);for(let a=0;a<this.size;a++)for(let l=0;l<2;l++){const f=n-l,v=(n+1&2)==0?this.size-1-a:a;!this.isFunction[v][f]&&o<e.length*8&&(this.modules[v][f]=i(e[o>>>3],7-(o&7)),o++)}}d(o==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let o=0;o<this.size;o++)for(let n=0;n<this.size;n++){let a;switch(e){case 0:a=(n+o)%2==0;break;case 1:a=o%2==0;break;case 2:a=n%3==0;break;case 3:a=(n+o)%3==0;break;case 4:a=(Math.floor(n/3)+Math.floor(o/2))%2==0;break;case 5:a=n*o%2+n*o%3==0;break;case 6:a=(n*o%2+n*o%3)%2==0;break;case 7:a=((n+o)%2+n*o%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[o][n]&&a&&(this.modules[o][n]=!this.modules[o][n])}}getPenaltyScore(){let e=0;for(let l=0;l<this.size;l++){let f=!1,h=0,v=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[l][g]==f?(h++,h==5?e+=S.PENALTY_N1:h>5&&e++):(this.finderPenaltyAddHistory(h,v),f||(e+=this.finderPenaltyCountPatterns(v)*S.PENALTY_N3),f=this.modules[l][g],h=1);e+=this.finderPenaltyTerminateAndCount(f,h,v)*S.PENALTY_N3}for(let l=0;l<this.size;l++){let f=!1,h=0,v=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[g][l]==f?(h++,h==5?e+=S.PENALTY_N1:h>5&&e++):(this.finderPenaltyAddHistory(h,v),f||(e+=this.finderPenaltyCountPatterns(v)*S.PENALTY_N3),f=this.modules[g][l],h=1);e+=this.finderPenaltyTerminateAndCount(f,h,v)*S.PENALTY_N3}for(let l=0;l<this.size-1;l++)for(let f=0;f<this.size-1;f++){const h=this.modules[l][f];h==this.modules[l][f+1]&&h==this.modules[l+1][f]&&h==this.modules[l+1][f+1]&&(e+=S.PENALTY_N2)}let o=0;for(const l of this.modules)o=l.reduce((f,h)=>f+(h?1:0),o);const n=this.size*this.size,a=Math.ceil(Math.abs(o*20-n*10)/n)-1;return d(0<=a&&a<=9),e+=a*S.PENALTY_N4,d(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,o=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let n=[6];for(let a=this.size-7;n.length<e;a-=o)n.splice(1,0,a);return n}}static getNumRawDataModules(e){if(e<S.MIN_VERSION||e>S.MAX_VERSION)throw new RangeError("Version number out of range");let o=(16*e+128)*e+64;if(e>=2){const n=Math.floor(e/7)+2;o-=(25*n-10)*n-55,e>=7&&(o-=36)}return d(208<=o&&o<=29648),o}static getNumDataCodewords(e,o){return Math.floor(S.getNumRawDataModules(e)/8)-S.ECC_CODEWORDS_PER_BLOCK[o.ordinal][e]*S.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let o=[];for(let a=0;a<e-1;a++)o.push(0);o.push(1);let n=1;for(let a=0;a<e;a++){for(let l=0;l<o.length;l++)o[l]=S.reedSolomonMultiply(o[l],n),l+1<o.length&&(o[l]^=o[l+1]);n=S.reedSolomonMultiply(n,2)}return o}static reedSolomonComputeRemainder(e,o){let n=o.map(a=>0);for(const a of e){const l=a^n.shift();n.push(0),o.forEach((f,h)=>n[h]^=S.reedSolomonMultiply(f,l))}return n}static reedSolomonMultiply(e,o){if(e>>>8||o>>>8)throw new RangeError("Byte out of range");let n=0;for(let a=7;a>=0;a--)n=n<<1^(n>>>7)*285,n^=(o>>>a&1)*e;return d(n>>>8==0),n}finderPenaltyCountPatterns(e){const o=e[1];d(o<=this.size*3);const n=o>0&&e[2]==o&&e[3]==o*3&&e[4]==o&&e[5]==o;return(n&&e[0]>=o*4&&e[6]>=o?1:0)+(n&&e[6]>=o*4&&e[0]>=o?1:0)}finderPenaltyTerminateAndCount(e,o,n){return e&&(this.finderPenaltyAddHistory(o,n),o=0),o+=this.size,this.finderPenaltyAddHistory(o,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,o){o[0]==0&&(e+=this.size),o.pop(),o.unshift(e)}};r.MIN_VERSION=1,r.MAX_VERSION=40,r.PENALTY_N1=3,r.PENALTY_N2=3,r.PENALTY_N3=40,r.PENALTY_N4=10,r.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]],r.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]],t.QrCode=r;function s(m,e,o){if(e<0||e>31||m>>>e)throw new RangeError("Value out of range");for(let n=e-1;n>=0;n--)o.push(m>>>n&1)}function i(m,e){return(m>>>e&1)!=0}function d(m){if(!m)throw new Error("Assertion error")}const u=class M{constructor(e,o,n){if(this.mode=e,this.numChars=o,this.bitData=n,o<0)throw new RangeError("Invalid argument");this.bitData=n.slice()}static makeBytes(e){let o=[];for(const n of e)s(n,8,o);return new M(M.Mode.BYTE,e.length,o)}static makeNumeric(e){if(!M.isNumeric(e))throw new RangeError("String contains non-numeric characters");let o=[];for(let n=0;n<e.length;){const a=Math.min(e.length-n,3);s(parseInt(e.substring(n,n+a),10),a*3+1,o),n+=a}return new M(M.Mode.NUMERIC,e.length,o)}static makeAlphanumeric(e){if(!M.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let o=[],n;for(n=0;n+2<=e.length;n+=2){let a=M.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n))*45;a+=M.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n+1)),s(a,11,o)}return n<e.length&&s(M.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n)),6,o),new M(M.Mode.ALPHANUMERIC,e.length,o)}static makeSegments(e){return e==""?[]:M.isNumeric(e)?[M.makeNumeric(e)]:M.isAlphanumeric(e)?[M.makeAlphanumeric(e)]:[M.makeBytes(M.toUtf8ByteArray(e))]}static makeEci(e){let o=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)s(e,8,o);else if(e<16384)s(2,2,o),s(e,14,o);else if(e<1e6)s(6,3,o),s(e,21,o);else throw new RangeError("ECI assignment value out of range");return new M(M.Mode.ECI,0,o)}static isNumeric(e){return M.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return M.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,o){let n=0;for(const a of e){const l=a.mode.numCharCountBits(o);if(a.numChars>=1<<l)return 1/0;n+=4+l+a.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let o=[];for(let n=0;n<e.length;n++)e.charAt(n)!="%"?o.push(e.charCodeAt(n)):(o.push(parseInt(e.substring(n+1,n+3),16)),n+=2);return o}};u.NUMERIC_REGEX=/^[0-9]*$/,u.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,u.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let E=u;t.QrSegment=u})(V||(V={}));(t=>{(r=>{const s=class{constructor(d,u){this.ordinal=d,this.formatBits=u}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),r.Ecc=s})(t.QrCode||(t.QrCode={}))})(V||(V={}));(t=>{(r=>{const s=class{constructor(d,u){this.modeBits=d,this.numBitsCharCount=u}numCharCountBits(d){return this.numBitsCharCount[Math.floor((d+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),r.Mode=s})(t.QrSegment||(t.QrSegment={}))})(V||(V={}));var K=V;var qe={L:K.QrCode.Ecc.LOW,M:K.QrCode.Ecc.MEDIUM,Q:K.QrCode.Ecc.QUARTILE,H:K.QrCode.Ecc.HIGH},ve=128,xe="L",Se="#FFFFFF",we="#000000",ye=!1,Ne=1,Ze=4,Je=0,et=.1;function Re(t,r=0){const s=[];return t.forEach(function(i,d){let u=null;i.forEach(function(E,m){if(!E&&u!==null){s.push(`M${u+r} ${d+r}h${m-u}v1H${u+r}z`),u=null;return}if(m===i.length-1){if(!E)return;u===null?s.push(`M${m+r},${d+r} h1v1H${m+r}z`):s.push(`M${u+r},${d+r} h${m+1-u}v1H${u+r}z`);return}E&&u===null&&(u=m)})}),s.join("")}function be(t,r){return t.slice().map((s,i)=>i<r.y||i>=r.y+r.h?s:s.map((d,u)=>u<r.x||u>=r.x+r.w?d:!1))}function tt(t,r,s,i){if(i==null)return null;const d=t.length+s*2,u=Math.floor(r*et),E=d/r,m=(i.width||u)*E,e=(i.height||u)*E,o=i.x==null?t.length/2-m/2:i.x*E,n=i.y==null?t.length/2-e/2:i.y*E,a=i.opacity==null?1:i.opacity;let l=null;if(i.excavate){let h=Math.floor(o),v=Math.floor(n),g=Math.ceil(m+o-h),R=Math.ceil(e+n-v);l={x:h,y:v,w:g,h:R}}const f=i.crossOrigin;return{x:o,y:n,h:e,w:m,excavation:l,opacity:a,crossOrigin:f}}function nt(t,r){return r!=null?Math.max(Math.floor(r),0):t?Ze:Je}function Me({value:t,level:r,minVersion:s,includeMargin:i,marginSize:d,imageSettings:u,size:E,boostLevel:m}){let e=p.useMemo(()=>{const h=(Array.isArray(t)?t:[t]).reduce((v,g)=>(v.push(...K.QrSegment.makeSegments(g)),v),[]);return K.QrCode.encodeSegments(h,qe[r],s,void 0,void 0,m)},[t,r,s,m]);const{cells:o,margin:n,numCells:a,calculatedImageSettings:l}=p.useMemo(()=>{let f=e.getModules();const h=nt(i,d),v=f.length+h*2,g=tt(f,E,h,u);return{cells:f,margin:h,numCells:v,calculatedImageSettings:g}},[e,E,u,i,d]);return{qrcode:e,margin:n,cells:o,numCells:a,calculatedImageSettings:l}}var ot=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),st=p.forwardRef(function(r,s){const i=r,{value:d,size:u=ve,level:E=xe,bgColor:m=Se,fgColor:e=we,includeMargin:o=ye,minVersion:n=Ne,boostLevel:a,marginSize:l,imageSettings:f}=i,v=le(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:g}=v,R=le(v,["style"]),w=f?.src,C=p.useRef(null),y=p.useRef(null),A=p.useCallback(_=>{C.current=_,typeof s=="function"?s(_):s&&(s.current=_)},[s]),[j,b]=p.useState(!1),{margin:D,cells:z,numCells:$,calculatedImageSettings:T}=Me({value:d,level:E,minVersion:n,boostLevel:a,includeMargin:o,marginSize:l,imageSettings:f,size:u});p.useEffect(()=>{if(C.current!=null){const _=C.current,N=_.getContext("2d");if(!N)return;let I=z;const P=y.current,k=T!=null&&P!==null&&P.complete&&P.naturalHeight!==0&&P.naturalWidth!==0;k&&T.excavation!=null&&(I=be(z,T.excavation));const Q=window.devicePixelRatio||1;_.height=_.width=u*Q;const X=u/$*Q;N.scale(X,X),N.fillStyle=m,N.fillRect(0,0,$,$),N.fillStyle=e,ot?N.fill(new Path2D(Re(I,D))):z.forEach(function(oe,ee){oe.forEach(function(se,re){se&&N.fillRect(re+D,ee+D,1,1)})}),T&&(N.globalAlpha=T.opacity),k&&N.drawImage(P,T.x+D,T.y+D,T.w,T.h)}}),p.useEffect(()=>{b(!1)},[w]);const H=ie({height:u,width:u},g);let W=null;return w!=null&&(W=p.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{b(!0)},ref:y,crossOrigin:T?.crossOrigin})),p.createElement(p.Fragment,null,p.createElement("canvas",ie({style:H,height:u,width:u,ref:A,role:"img"},R)),W)});st.displayName="QRCodeCanvas";var Ae=p.forwardRef(function(r,s){const i=r,{value:d,size:u=ve,level:E=xe,bgColor:m=Se,fgColor:e=we,includeMargin:o=ye,minVersion:n=Ne,boostLevel:a,title:l,marginSize:f,imageSettings:h}=i,v=le(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:g,cells:R,numCells:w,calculatedImageSettings:C}=Me({value:d,level:E,minVersion:n,boostLevel:a,includeMargin:o,marginSize:f,imageSettings:h,size:u});let y=R,A=null;h!=null&&C!=null&&(C.excavation!=null&&(y=be(R,C.excavation)),A=p.createElement("image",{href:h.src,height:C.h,width:C.w,x:C.x+g,y:C.y+g,preserveAspectRatio:"none",opacity:C.opacity,crossOrigin:C.crossOrigin}));const j=Re(y,g);return p.createElement("svg",ie({height:u,width:u,viewBox:`0 0 ${w} ${w}`,ref:s,role:"img"},v),!!l&&p.createElement("title",null,l),p.createElement("path",{fill:m,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),p.createElement("path",{fill:e,d:j,shapeRendering:"crispEdges"}),A)});Ae.displayName="QRCodeSVG";const rt=(t,r)=>({invitationType:Y.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(t)}`},...r]}),at=t=>{const r=t?.invitationLink?.split("/").at(-1)||"";return`/${F.SHARE_CONVERSATION_ROUTE}/${r}`},it=(t,r)=>r?.find(s=>{const i=t?.id?.split("/")?.pop(),d=s?.url?.split("/")?.pop()||"";return d===i||decodeURI(d)===i}),lt=t=>t?.messages?.filter(s=>!!s?.custom_content?.attachments)?.flatMap(s=>s?.custom_content?.attachments?.map(i=>({url:i?.url||""}))||[])?.filter(s=>!!s?.url)||[],ct=({conversation:t,locale:r,onCloseModal:s,modalDividers:i,getConversation:d,generateConversationLink:u,chatExpiration:E,chatExpirationDays:m,close:e,chatWarning:o,shareLink:n,shareCopyLink:a,shareCopiedLink:l,shareDescription:f,shareRemoveAccessToUsers:h,chatName:v,getSharedConversations:g,revokeSharedConversations:R,baseUrl:w,id:C,clientSharedPage:y,clientSharedProp:A})=>{const[j,b]=p.useState(null),[D,z]=p.useState(),[$,T]=p.useState(!1),[H,W]=p.useState(!1),[_,N]=p.useState(),I=p.useRef(null),P=p.useRef(null),k=p.useMemo(()=>t?.id?decodeURI(t.id):C?.[0]&&C?.[1]&&r?decodeURI(`${C[0]}/${r}/${C[1]}`):null,[t?.id,C,r]),Q=p.useMemo(()=>{if(!j)return"";const U=w||window.location.origin;if(w&&w!==window.location.origin&&y&&A){const Z=j.split(`/${F.SHARE_CONVERSATION_ROUTE}/`)?.[1];return`${U}/${y}?${A}=${Z}`}return`${U}/${r}${j}`},[w,j,r,y,A]),X=p.useCallback(async U=>{const Z=await g?.(Y.getSharedConversationsRequest(Y.ShareTarget.OTHERS));if(Z)return it({id:U},Z.resources)},[g]);p.useEffect(()=>{if(!k||I.current===k)return;I.current=k,T(!1),P.current?.abort();const U=new AbortController;return P.current=U,(async()=>{try{const ae=await d?.(k),Te=rt(k,lt(ae)),ue=await u?.(Te),De=await X(k);if(U.signal.aborted||!ue)return;b(at(ue)),z(De),T(!0)}catch(ae){if(U.signal.aborted)return;T(!1),console.error("Error sharing conversation",ae)}})(),()=>{U.abort(),I.current=null}},[k,u,d,X]);const oe=p.useCallback(()=>{P.current?.abort(),I.current=null,s(),b(null),T(!1),W(!1)},[s]),ee=p.useCallback(()=>{W(!0),navigator.clipboard.writeText(Q||"")},[Q]),se=async()=>{try{if(N(!0),D&&await R?.({resources:[D]}),k){const U=await X(k);P.current?.signal.aborted||z(U)}}catch(U){console.error("Error revoking shared conversation",U)}finally{P.current?.signal.aborted||N(!1)}},re=p.useCallback(()=>c.jsx(x.Button,{buttonClassName:H?"text-button-secondary":"text-button-primary",iconBefore:H?c.jsx(q.IconCheck,{width:20,height:20}):c.jsx(q.IconCopy,{width:20,height:20}),title:H?l??"Copied":a??"Copy link",disabled:H,onClick:ee}),[H,ee,l,a]);return c.jsxs(x.Popup,{heading:n??"Share link",portalId:"share",size:x.PopUpSize.SM,dividers:i,onClose:oe,closeButtonTitle:e??"Close",children:[$?c.jsxs("div",{className:"share flex flex-col gap-y-4 overflow-auto px-6 pb-6 sm:p-0",children:[t?.name?c.jsxs("div",{className:"share-info flex w-full",children:[c.jsx("p",{className:"share-info-title body-1 mr-1 text-neutrals-800",children:v??"Chat name:"}),c.jsx("h3",{className:"min-w-0 flex-1 truncate",title:t?.name,children:t?.name})]}):null,c.jsxs("div",{className:"share-info flex",children:[c.jsx("p",{className:"share-info-title body-1 mr-1 text-neutrals-800",children:E??"Link expiration date:"}),c.jsxs("h3",{children:["3 ",m??"days"]})]}),c.jsx(Ae,{className:"min-h-[200px] self-center rounded border border-neutrals-600 p-2",value:Q,size:200}),c.jsx("p",{className:"body-2 text-neutrals-1000",children:f??"Your name, special instructions, and any messages you add after sharing remain confidential."}),c.jsx(x.InputWithIcon,{containerClasses:"share-input-container",cssClass:"share-input",readonly:!0,placeholder:Q,value:Q,inputId:"conversationLink",iconAfterInput:re()})]}):c.jsx("div",{className:"flex items-center justify-center p-6",children:c.jsx(x.Loader,{})}),$?t&&D?c.jsx("div",{className:"remove-access",children:c.jsx(x.Button,{title:h??"Remove access to all users",buttonClassName:"remove-access-button py-3 px-4",isSmallButton:!0,disabled:_,onClick:se})}):c.jsx("p",{className:"body-2 share-footer text-neutrals-800",children:o??"This chat has not been shared with anyone yet."}):c.jsx("div",{})]})},ut=({conversation:t,onCloseModal:r,renameConversation:s,locale:i})=>{const{titles:d,disableModalDividers:u,isSmallModalButton:E}=G(),[m,e]=p.useState(t?.name||""),o=a=>{e(a)},n=()=>{const a=`${t?.folderId}/${encodeURIComponent(F.getClearedConversationName(m))}-${new Date().getTime()}`;s(`conversations/${t.id}`,`conversations/${a}`)};return c.jsxs(x.Popup,{heading:d?.renameTitle??"Rename conversation",portalId:"rename-conversation",containerClassName:"rename-conversation-popup",size:x.PopUpSize.SM,dividers:!u,onClose:r,closeButtonTitle:d?.close??"Cancel",children:[c.jsx("div",{className:"px-6 py-4 sm:px-0",lang:i,children:c.jsx(x.Input,{inputId:"rename",value:m,onChange:o,cssClass:"w-full"})}),c.jsxs("div",{className:"delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",children:[c.jsx(x.Button,{buttonClassName:"cancel-button",title:d?.cancel??"Cancel",isSmallButton:E,onClick:a=>{a.stopPropagation(),r()}}),c.jsx(x.Button,{buttonClassName:"text-button-primary text-button-primary",title:d?.save??"Rename",isSmallButton:E,disabled:!m,onClick:a=>{a.stopPropagation(),n()}})]})]})},Ie=p.createContext(null);function dt({children:t,value:r}){return c.jsx(Ie.Provider,{value:r,children:t})}function ht(){const t=p.useContext(Ie);if(!t)throw new Error("useConversationListActions must be used within ConversationListActionsProvider");return t}const Pe=({conversation:t,triggerButton:r,isDisabled:s})=>{const i=G(),{locale:d,deleteConversation:u,renameConversation:E,getConversation:m,getFileBlob:e,shareConversationProps:o}=ht(),n=p.useMemo(()=>{const b=[{key:L.DELETE,title:i?.titles?.delete??"Delete",icon:i.actionsIcons?.[L.DELETE]}];return t?.model?.id?.endsWith(F.ONBOARDING_MODEL_POSTFIX)?b:[...t.isShared?[]:[{key:L.SHARE,title:i?.titles?.share??"Share",icon:i.actionsIcons?.[L.SHARE]},{key:L.RENAME,title:i?.titles?.rename??"Rename",icon:i.actionsIcons?.[L.RENAME]}],{key:L.EXPORT,title:i?.titles?.export??"Export",icon:i.actionsIcons?.[L.EXPORT]},...b]},[t.isShared,t?.model?.id,i.titles,i.actionsIcons]),[a,l]=p.useState(x.PopUpState.Closed),[f,h]=p.useState(x.PopUpState.Closed),[v,g]=p.useState(x.PopUpState.Closed),R=p.useCallback(()=>{l(x.PopUpState.Closed)},[l]),w=p.useCallback(()=>{h(x.PopUpState.Closed)},[h]),C=p.useCallback(()=>{g(x.PopUpState.Closed)},[g]),y=p.useCallback(()=>{u(t),R()},[t,u,R]),A=p.useCallback((b,D)=>{E(b,D),C()},[E,C]),j=b=>{b===L.DELETE&&l(x.PopUpState.Opened),b===L.SHARE&&h(x.PopUpState.Opened),b===L.RENAME&&g(x.PopUpState.Opened),b===L.EXPORT&&m(decodeURI(t.id)).then(D=>{Ge(D,e).then(z=>{Xe(`data:application/zip;base64,${z}`,`chat_with_attachments_${new Date().toLocaleDateString()}.dial`)})})};return c.jsxs(c.Fragment,{children:[c.jsx(x.Dropdown,{containerClassName:"ml-3 hidden group-hover:flex",triggerButton:r??c.jsx(pt,{disabled:s}),options:n,openedClassName:"!flex action-menu-opened",onOptionSelect:j,disabled:s}),a===x.PopUpState.Opened&&c.jsx(ze,{locale:d,deleteConversation:y,onCloseModal:R}),f===x.PopUpState.Opened&&c.jsx(ct,{conversation:t,locale:d,onCloseModal:w,...o}),v===x.PopUpState.Opened&&c.jsx(ut,{conversation:t,locale:d,renameConversation:A,onCloseModal:C})]})},pt=({disabled:t})=>c.jsx("div",{className:O("flex items-center justify-center w-[24px]",t?"cursor-not-allowed":"cursor-pointer"),children:c.jsx(q.IconDotsVertical,{width:20,height:20,stroke:2,className:"text-primary"})}),je=({conversation:t,selectedConversationId:r,searchQuery:s,onConversationClick:i,isDisabled:d})=>{const{titles:u,conversationItemIcon:E}=G(),m=p.useRef(null),e=F.getClearedConversationName(t?.name);return p.useEffect(()=>{if(t?.id===r&&m?.current){const o=m.current.parentElement?.parentElement?.parentElement;if(o){const n=m.current.getBoundingClientRect(),a=o.getBoundingClientRect(),l=n.height,f=a.height,v=n.top-a.top+o.scrollTop-(f/2-l/2);o.scrollTo({top:v,behavior:"smooth"})}}},[t,r]),c.jsxs("div",{ref:m,className:O("flex justify-between items-center py-2 px-3 border-transparent relative group border","conversation-item",r===t?.id&&"bg-hues-100 conversation-item-active",d?"cursor-not-allowed":"cursor-pointer hover:border-hues-600"),onClick:()=>!d&&i(t.folderId,t?.id),title:d?u?.noActionsAllowed:e,children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-center",children:[E||null,c.jsx("h3",{className:O("truncate font-semibold text-neutrals-1000 sm:body-2","conversation-item-text",r===t?.id?"conversation-item-text-active":""),title:d?u?.noActionsAllowed:e,children:s?.length?c.jsx(x.HighlightText,{text:e,highlightText:s}):e})]}),c.jsx(Pe,{conversation:t,isDisabled:d})]})},ft=({handleConversationClick:t,selectedConversationId:r,groupLabel:s,groupedConversations:i,isDisabled:d})=>{const{titles:u}=G(),[E,m]=p.useState(!1),e=p.useCallback(()=>{m(o=>!o)},[m]);return c.jsxs("div",{children:[c.jsxs("div",{className:"conversation-group-items-title mb-3 inline-flex cursor-pointer items-center gap-1 text-neutrals-700",onClick:e,children:[c.jsx(q.IconCaretRightFilled,{className:O("w-3 h-3 conversation-group-items-arrow",E?"rotate-[90deg]":"rotate-0")}),c.jsx("span",{className:"body-3 conversation-group-items-title-text",children:Fe(s,u)})]}),!E&&c.jsx("div",{className:O("flex flex-col gap-y-3","conversation-group-items"),children:me(i).map(o=>c.jsx(je,{isDisabled:d,conversation:o,selectedConversationId:r,onConversationClick:t},o.id||o.name))})]},s)},mt=({searchQuery:t,isExpandedSearch:r,onSearchConversations:s,toggleSearchField:i})=>{const{titles:d,searchIcon:u}=G();return c.jsx(c.Fragment,{children:r?c.jsx(x.InputWithIcon,{inputId:"conversations-search",placeholder:d?.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:t,iconAfterInput:c.jsx(x.IconButton,{buttonClassName:"text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5",onClick:i,icon:c.jsx(q.IconX,{})}),onChange:s}):c.jsx(x.Button,{buttonClassName:"text-button-tertiary p-0 search-button",iconBefore:u||c.jsx(q.IconSearch,{className:"size-5"}),onClick:i})})},gt=({conversations:t,selectedConversationId:r,searchQuery:s,handleConversationClick:i,isDisabled:d})=>{const{titles:u}=G(),[E,m]=p.useState([]);return p.useEffect(()=>{m(me(t?.filter(e=>F.getClearedConversationName(e?.name)?.includes(s||""))))},[t,s]),c.jsx(c.Fragment,{children:E?.length?E.map(e=>c.jsx(je,{conversation:e,searchQuery:s,selectedConversationId:r,onConversationClick:i,isDisabled:d},e.id)):c.jsx("h3",{className:"text-neutrals-800",children:u?.noConversation??"No conversations yet"})})},Ct=()=>{const{titles:t}=G();return c.jsxs("div",{className:"flex flex-col p-8 text-center",children:[c.jsx("p",{className:"text-neutrals-800",children:t?.noConversation??"No conversations yet"}),c.jsx("p",{className:"mt-2 text-sm text-neutrals-800",children:t?.clickNewChat??'Click "New Chat" to start a conversation'})]})},Et=({handleConversationClick:t,selectedConversationId:r,actions:s,children:i,isCollapsed:d,isStreaming:u,conversationStyles:E,conversations:m,locale:e,sharedConversations:o,setConversations:n,setSharedConversations:a,shareConversationProps:l,handleSelectedConversationRemove:f})=>{const[h,v]=p.useState({}),[g,R]=p.useState(!0),[w,C]=p.useState(""),[y,A]=p.useState(!1),{getConversations:j,getSharedConversations:b,deleteConversation:D,renameConversation:z}=s,$=p.useMemo(()=>!!w?.length,[w]);p.useEffect(()=>{v({...pe(o),...Ue(m)})},[m,o]),p.useEffect(()=>{async function N(){try{R(!0);const I=await j(e),P=await b(Y.getSharedConversationsRequest(Y.ShareTarget.ME));n(F.cleanConversationNames(I)),a(F.cleanConversationNames(te(P,e)))}catch(I){console.error("Error loading conversation",I)}finally{R(!1)}}N()},[j,n,e,b,a]);const T=p.useCallback(async N=>{try{await D(N);const I=await j(e),P=await b(Y.getSharedConversationsRequest(Y.ShareTarget.ME));n(F.cleanConversationNames(I)),a(F.cleanConversationNames(te(P,e))),r===N?.id&&f()}catch(I){console.error("Error deleting conversation",I)}},[D,j,e,b,n,a,r,f]),H=p.useCallback(async(N,I)=>{try{R(!0),await z(N,I);const P=await j(e),k=await b(Y.getSharedConversationsRequest(Y.ShareTarget.ME));n(F.cleanConversationNames(P)),a(F.cleanConversationNames(te(k,e)))}catch(P){console.error("Error renaming conversation",P)}finally{R(!1)}},[j,e,b,n,a,z]),W=p.useCallback(N=>{C(N)},[C]),_=p.useCallback(()=>{A(N=>!N),C("")},[A]);return g?c.jsx(x.Loader,{}):c.jsx(dt,{value:{locale:e,deleteConversation:T,renameConversation:H,getConversation:s.getConversation,getFileBlob:s.getFileBlob,shareConversationProps:l},children:c.jsxs(ge.Provider,{value:E,children:[!d&&c.jsxs("div",{className:O("flex justify-between items-center pr-6",y?" pt-4 pb-0 sm:pt-10":" pt-6 pb-2 sm:pt-10"),children:[!y&&c.jsx("h3",{className:"sm:body-2 text-neutrals-700",children:E?.titles?.allChats??"All Chats"}),c.jsx(mt,{searchQuery:w,isExpandedSearch:y,onSearchConversations:W,toggleSearchField:_})]}),c.jsx("div",{className:"scroll-hidden-container flex flex-col mt-4 flex-1 min-h-0",children:d?null:c.jsx("div",{className:O("flex flex-col pr-4",$?"gap-y-1":"gap-y-6"),children:m?.length===0&&o?.length===0?c.jsx(Ct,{}):$?c.jsx(gt,{conversations:[...o,...m],searchQuery:w,selectedConversationId:r,handleConversationClick:t,isDisabled:u}):Object.entries(h).map(([N,I])=>I?.length>0&&c.jsx(ft,{isDisabled:u,groupLabel:N,groupedConversations:I,handleConversationClick:t,selectedConversationId:r},N))})}),i]})})},vt=({onCloseModal:t,disableModalDividers:r,signOut:s,isSmallButton:i,locale:d,titles:u})=>c.jsxs(x.Popup,{heading:u?.popupTitle||"Log out?",portalId:"sign-out",containerClassName:"sign-out-popup",size:x.PopUpSize.SM,dividers:!r,onClose:t,closeButtonTitle:"Cancel",children:[c.jsx("div",{className:"px-6 py-4 sm:px-0",lang:d,children:u?.popupText}),c.jsxs("div",{className:"delete-conversation-popup-footer flex justify-end gap-x-2 px-6 py-3",children:[c.jsx(x.Button,{buttonClassName:"cancel-button",title:u?.popupCancel||"Cancel",isSmallButton:i,onClick:E=>{E.stopPropagation(),t()}}),c.jsx(x.Button,{buttonClassName:"text-button-primary",title:u?.popupApply||"Sign Out",isSmallButton:i,onClick:E=>{E.stopPropagation(),s?.()}})]})]}),xt=({userInfo:t,signOutAction:r,contactSupportUrl:s,styles:i,locale:d,titles:u})=>{const E=R=>R?.split(" ")?.map((w,C)=>C<2?w[0].toUpperCase():"")?.join("")??"",m=p.useMemo(()=>t?.name?E(t?.name):t?.email?.[0].toUpperCase()??"",[t]),[e,o]=p.useState(!1),n=t?.name?.split(" "),a=n?`${n?.[0]??""} ${n?.[1]?.[0]?n?.[1]?.[0]+".":""}`:t?.email??"",l=p.useCallback(()=>{o(!0)},[]),f=p.useCallback(()=>{o(!1)},[]),h=p.useCallback(()=>{window.open(s||"#","_blank","noopener,noreferrer")},[s]),v=p.useMemo(()=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:O("cursor-pointer flex items-center justify-center size-11 rounded-[100px] p-[10px] sm:h-[32px] sm:w-[32px] flex-shrink-0",i?.initialStyles),children:m}),c.jsx("p",{className:O("h3 cursor-pointer overflow-hidden text-ellipsis",i?.userNameStyles),children:(i?.showShortName?a:t?.name)??t?.email??""})]}),[m,a,i,t]),g=p.useMemo(()=>c.jsxs("div",{className:O("py-1",i?.dropDownStyles),children:[i?.settingsIcon&&c.jsxs("button",{className:O("p-2 items-center flex gap-1 text-primary fill-primary",i?.dropdownButtonTypographyStyles||"body-1",i?.dropdownButtonStyles),title:u?.settings,children:[c.jsx("span",{className:"shrink-0",children:i?.settingsIcon}),c.jsx("span",{className:"min-w-0 break-words",children:u?.settings||"Settings"})]}),i?.contactSupportIcon&&c.jsxs("button",{className:O("p-2 items-center flex gap-1 text-primary fill-primary",i?.dropdownButtonTypographyStyles||"body-1",i?.dropdownButtonStyles),title:u?.contactSupport,onClick:h,children:[c.jsx("span",{className:"shrink-0",children:i?.contactSupportIcon}),c.jsx("span",{className:"min-w-0 break-words",children:u?.contactSupport||"Contact support"})]}),c.jsx("div",{className:O("h-0 border-t border-neutrals-600 my-2",i?.showSeparator?"block":"hidden")}),c.jsxs("button",{className:O("p-2 items-center flex gap-1 text-primary fill-primary",i?.dropdownButtonTypographyStyles||"body-1",i?.dropdownButtonStyles),title:u?.signOut,onClick:l,children:[c.jsx("span",{className:"shrink-0",children:i?.signOutIcon}),c.jsx("span",{className:"min-w-0 break-words",children:u?.signOut||"Sign out"}),e&&c.jsx(vt,{onCloseModal:f,signOut:()=>r?.(),locale:d,disableModalDividers:i?.disableModalDividers,titles:u})]})]}),[i,u,l,h,e,f,d,r]);if(t)return c.jsx(x.Dropdown,{containerClassName:O("transition-opacity group-hover:opacity-100 shrink w-full",i?.dropdownContainerClassName),triggerButton:v,content:g,openedClassName:"action-menu-opened"})};exports.ActionMenu=Pe;exports.ActionMenuItem=L;exports.ConversationList=Et;exports.User=xt;exports.getSharedConversationsGroup=pe;exports.transformSharedConversations=te;
|
package/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsxs as S, jsx as h, Fragment as
|
|
1
|
+
import { jsxs as S, jsx as h, Fragment as Ee } from "react/jsx-runtime";
|
|
2
2
|
import k from "classnames";
|
|
3
|
-
import P, { createContext as Re, useContext as Se, useState as B, useRef as
|
|
3
|
+
import P, { createContext as Re, useContext as Se, useState as B, useRef as me, useMemo as K, useCallback as O, useEffect as ne } from "react";
|
|
4
4
|
import { cloneDeep as Ve, uniqBy as Xe, omit as Ke } from "lodash";
|
|
5
|
-
import { Popup as
|
|
5
|
+
import { Popup as le, PopUpSize as ce, Button as j, Loader as be, InputWithIcon as Me, Input as Ze, PopUpState as $, Dropdown as Ae, HighlightText as Je, IconButton as qe } from "@epam/statgpt-ui-components";
|
|
6
6
|
import { IconCheck as et, IconCopy as tt, IconDotsVertical as nt, IconCaretRightFilled as ot, IconX as rt, IconSearch as st } from "@tabler/icons-react";
|
|
7
7
|
import it from "jszip";
|
|
8
8
|
import { getConversationAttachments as at, SHARE_CONVERSATION_ROUTE as Ie, getClearedConversationName as ve, ONBOARDING_MODEL_POSTFIX as lt, cleanConversationNames as q } from "@epam/statgpt-shared-toolkit";
|
|
9
9
|
import { InvitationType as ct, getSharedConversationsRequest as se, ShareTarget as ie } from "@epam/statgpt-dial-toolkit";
|
|
10
10
|
var _ = /* @__PURE__ */ ((t) => (t.DELETE = "delete", t.EXPORT = "export", t.SHARE = "share", t.RENAME = "rename", t))(_ || {}), U = /* @__PURE__ */ ((t) => (t.SHARED = "shared", t.TODAY = "today", t.YESTERDAY = "yesterday", t.WEEK = "week", t.EARLIER = "earlier", t))(U || {});
|
|
11
|
-
const
|
|
11
|
+
const pe = (t, s) => t?.resources?.filter((r) => r?.parentPath === s)?.map((r) => {
|
|
12
12
|
const a = `${r?.bucket}/${s}`, u = r?.url?.split("/")?.slice(1)?.join("/");
|
|
13
13
|
return {
|
|
14
14
|
...r,
|
|
@@ -30,16 +30,16 @@ const me = (t, s) => t?.resources?.filter((r) => r?.parentPath === s)?.map((r) =
|
|
|
30
30
|
t.getDate() - 1
|
|
31
31
|
);
|
|
32
32
|
return xe(s, r);
|
|
33
|
-
},
|
|
33
|
+
}, ft = (t, s) => {
|
|
34
34
|
const r = t.getTime() - s.getTime();
|
|
35
35
|
return Math.floor(r / (1e3 * 60 * 60 * 24));
|
|
36
|
-
}, ye = (t) => t.updatedAt || Number(t.id?.split("-").pop()),
|
|
36
|
+
}, ye = (t) => t.updatedAt || Number(t.id?.split("-").pop()), pt = (t) => {
|
|
37
37
|
const s = /* @__PURE__ */ new Date(), r = Ve(dt);
|
|
38
38
|
for (const a of t)
|
|
39
39
|
if (a.updatedAt) {
|
|
40
40
|
const u = new Date(a.updatedAt);
|
|
41
41
|
let c;
|
|
42
|
-
xe(s, u) ? c = r[U.TODAY] : ht(s, u) ? c = r[U.YESTERDAY] :
|
|
42
|
+
xe(s, u) ? c = r[U.TODAY] : ht(s, u) ? c = r[U.YESTERDAY] : ft(s, u) <= 7 ? c = r[U.WEEK] : c = r[U.EARLIER], c?.some(
|
|
43
43
|
(C) => C.id === a.id
|
|
44
44
|
) || c.push(a);
|
|
45
45
|
}
|
|
@@ -62,12 +62,12 @@ const gt = ({
|
|
|
62
62
|
}) => {
|
|
63
63
|
const { titles: a, disableModalDividers: u, isSmallModalButton: c } = V();
|
|
64
64
|
return /* @__PURE__ */ S(
|
|
65
|
-
|
|
65
|
+
le,
|
|
66
66
|
{
|
|
67
67
|
heading: a?.deleteTitle ?? "Delete conversation",
|
|
68
68
|
portalId: "delete-conversation",
|
|
69
69
|
containerClassName: "delete-conversation-popup",
|
|
70
|
-
size:
|
|
70
|
+
size: ce.SM,
|
|
71
71
|
dividers: !u,
|
|
72
72
|
onClose: t,
|
|
73
73
|
closeButtonTitle: a?.close ?? "Cancel",
|
|
@@ -147,8 +147,8 @@ const gt = ({
|
|
|
147
147
|
}).filter(Boolean) : [];
|
|
148
148
|
async function Nt(t, s) {
|
|
149
149
|
const r = Ct(t), a = new it();
|
|
150
|
-
r.forEach((
|
|
151
|
-
const e = encodeURI(oe(
|
|
150
|
+
r.forEach((p) => {
|
|
151
|
+
const e = encodeURI(oe(p.absolutePath, p.name)), o = s(`${e}`.replace("files/", "")), n = Rt(p.folderId), i = oe("res", n, p.name);
|
|
152
152
|
a.file(i, o);
|
|
153
153
|
});
|
|
154
154
|
const u = {
|
|
@@ -166,14 +166,14 @@ function bt(t, s) {
|
|
|
166
166
|
const r = document.createElement("a");
|
|
167
167
|
r.download = s, r.href = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(t);
|
|
168
168
|
}
|
|
169
|
-
var Mt = Object.defineProperty, ae = Object.getOwnPropertySymbols, Te = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable, Ne = (t, s, r) => s in t ? Mt(t, s, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[s] = r,
|
|
169
|
+
var Mt = Object.defineProperty, ae = Object.getOwnPropertySymbols, Te = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable, Ne = (t, s, r) => s in t ? Mt(t, s, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[s] = r, ge = (t, s) => {
|
|
170
170
|
for (var r in s || (s = {}))
|
|
171
171
|
Te.call(s, r) && Ne(t, r, s[r]);
|
|
172
172
|
if (ae)
|
|
173
173
|
for (var r of ae(s))
|
|
174
174
|
Oe.call(s, r) && Ne(t, r, s[r]);
|
|
175
175
|
return t;
|
|
176
|
-
},
|
|
176
|
+
}, Ce = (t, s) => {
|
|
177
177
|
var r = {};
|
|
178
178
|
for (var a in t)
|
|
179
179
|
Te.call(t, a) && s.indexOf(a) < 0 && (r[a] = t[a]);
|
|
@@ -202,8 +202,8 @@ var Z;
|
|
|
202
202
|
for (let d = 0; d < this.size; d++)
|
|
203
203
|
this.modules.push(l.slice()), this.isFunction.push(l.slice());
|
|
204
204
|
this.drawFunctionPatterns();
|
|
205
|
-
const
|
|
206
|
-
if (this.drawCodewords(
|
|
205
|
+
const f = this.addEccAndInterleave(n);
|
|
206
|
+
if (this.drawCodewords(f), i == -1) {
|
|
207
207
|
let d = 1e9;
|
|
208
208
|
for (let E = 0; E < 8; E++) {
|
|
209
209
|
this.applyMask(E), this.drawFormatBits(E);
|
|
@@ -241,7 +241,7 @@ var Z;
|
|
|
241
241
|
// This function allows the user to create a custom sequence of segments that switches
|
|
242
242
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
|
243
243
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
244
|
-
static encodeSegments(e, o, n = 1, i = 40, l = -1,
|
|
244
|
+
static encodeSegments(e, o, n = 1, i = 40, l = -1, f = !0) {
|
|
245
245
|
if (!(v.MIN_VERSION <= n && n <= i && i <= v.MAX_VERSION) || l < -1 || l > 7)
|
|
246
246
|
throw new RangeError("Invalid value");
|
|
247
247
|
let d, E;
|
|
@@ -255,7 +255,7 @@ var Z;
|
|
|
255
255
|
throw new RangeError("Data too long");
|
|
256
256
|
}
|
|
257
257
|
for (const g of [v.Ecc.MEDIUM, v.Ecc.QUARTILE, v.Ecc.HIGH])
|
|
258
|
-
|
|
258
|
+
f && E <= v.getNumDataCodewords(d, g) * 8 && (o = g);
|
|
259
259
|
let m = [];
|
|
260
260
|
for (const g of e) {
|
|
261
261
|
r(g.mode.modeBits, 4, m), r(g.numChars, g.mode.numCharCountBits(d), m);
|
|
@@ -326,8 +326,8 @@ var Z;
|
|
|
326
326
|
const o = this.version << 12 | e;
|
|
327
327
|
u(o >>> 18 == 0);
|
|
328
328
|
for (let n = 0; n < 18; n++) {
|
|
329
|
-
const i = a(o, n), l = this.size - 11 + n % 3,
|
|
330
|
-
this.setFunctionModule(l,
|
|
329
|
+
const i = a(o, n), l = this.size - 11 + n % 3, f = Math.floor(n / 3);
|
|
330
|
+
this.setFunctionModule(l, f, i), this.setFunctionModule(f, l, i);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
// Draws a 9*9 finder pattern including the border separator,
|
|
@@ -335,8 +335,8 @@ var Z;
|
|
|
335
335
|
drawFinderPattern(e, o) {
|
|
336
336
|
for (let n = -4; n <= 4; n++)
|
|
337
337
|
for (let i = -4; i <= 4; i++) {
|
|
338
|
-
const l = Math.max(Math.abs(i), Math.abs(n)),
|
|
339
|
-
0 <=
|
|
338
|
+
const l = Math.max(Math.abs(i), Math.abs(n)), f = e + i, d = o + n;
|
|
339
|
+
0 <= f && f < this.size && 0 <= d && d < this.size && this.setFunctionModule(f, d, l != 2 && l != 4);
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
// Draws a 5*5 alignment pattern, with the center module
|
|
@@ -358,7 +358,7 @@ var Z;
|
|
|
358
358
|
const o = this.version, n = this.errorCorrectionLevel;
|
|
359
359
|
if (e.length != v.getNumDataCodewords(o, n))
|
|
360
360
|
throw new RangeError("Invalid argument");
|
|
361
|
-
const i = v.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][o], l = v.ECC_CODEWORDS_PER_BLOCK[n.ordinal][o],
|
|
361
|
+
const i = v.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][o], l = v.ECC_CODEWORDS_PER_BLOCK[n.ordinal][o], f = Math.floor(v.getNumRawDataModules(o) / 8), d = i - f % i, E = Math.floor(f / i);
|
|
362
362
|
let m = [];
|
|
363
363
|
const R = v.reedSolomonComputeDivisor(l);
|
|
364
364
|
for (let g = 0, y = 0; g < i; g++) {
|
|
@@ -372,7 +372,7 @@ var Z;
|
|
|
372
372
|
m.forEach((y, A) => {
|
|
373
373
|
(g != E - l || A >= d) && w.push(y[g]);
|
|
374
374
|
});
|
|
375
|
-
return u(w.length ==
|
|
375
|
+
return u(w.length == f), w;
|
|
376
376
|
}
|
|
377
377
|
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
|
378
378
|
// data area of this QR Code. Function modules need to be marked off before this is called.
|
|
@@ -384,8 +384,8 @@ var Z;
|
|
|
384
384
|
n == 6 && (n = 5);
|
|
385
385
|
for (let i = 0; i < this.size; i++)
|
|
386
386
|
for (let l = 0; l < 2; l++) {
|
|
387
|
-
const
|
|
388
|
-
!this.isFunction[E][
|
|
387
|
+
const f = n - l, E = (n + 1 & 2) == 0 ? this.size - 1 - i : i;
|
|
388
|
+
!this.isFunction[E][f] && o < e.length * 8 && (this.modules[E][f] = a(e[o >>> 3], 7 - (o & 7)), o++);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
u(o == e.length * 8);
|
|
@@ -437,25 +437,25 @@ var Z;
|
|
|
437
437
|
getPenaltyScore() {
|
|
438
438
|
let e = 0;
|
|
439
439
|
for (let l = 0; l < this.size; l++) {
|
|
440
|
-
let
|
|
440
|
+
let f = !1, d = 0, E = [0, 0, 0, 0, 0, 0, 0];
|
|
441
441
|
for (let m = 0; m < this.size; m++)
|
|
442
|
-
this.modules[l][m] ==
|
|
443
|
-
e += this.finderPenaltyTerminateAndCount(
|
|
442
|
+
this.modules[l][m] == f ? (d++, d == 5 ? e += v.PENALTY_N1 : d > 5 && e++) : (this.finderPenaltyAddHistory(d, E), f || (e += this.finderPenaltyCountPatterns(E) * v.PENALTY_N3), f = this.modules[l][m], d = 1);
|
|
443
|
+
e += this.finderPenaltyTerminateAndCount(f, d, E) * v.PENALTY_N3;
|
|
444
444
|
}
|
|
445
445
|
for (let l = 0; l < this.size; l++) {
|
|
446
|
-
let
|
|
446
|
+
let f = !1, d = 0, E = [0, 0, 0, 0, 0, 0, 0];
|
|
447
447
|
for (let m = 0; m < this.size; m++)
|
|
448
|
-
this.modules[m][l] ==
|
|
449
|
-
e += this.finderPenaltyTerminateAndCount(
|
|
448
|
+
this.modules[m][l] == f ? (d++, d == 5 ? e += v.PENALTY_N1 : d > 5 && e++) : (this.finderPenaltyAddHistory(d, E), f || (e += this.finderPenaltyCountPatterns(E) * v.PENALTY_N3), f = this.modules[m][l], d = 1);
|
|
449
|
+
e += this.finderPenaltyTerminateAndCount(f, d, E) * v.PENALTY_N3;
|
|
450
450
|
}
|
|
451
451
|
for (let l = 0; l < this.size - 1; l++)
|
|
452
|
-
for (let
|
|
453
|
-
const d = this.modules[l][
|
|
454
|
-
d == this.modules[l][
|
|
452
|
+
for (let f = 0; f < this.size - 1; f++) {
|
|
453
|
+
const d = this.modules[l][f];
|
|
454
|
+
d == this.modules[l][f + 1] && d == this.modules[l + 1][f] && d == this.modules[l + 1][f + 1] && (e += v.PENALTY_N2);
|
|
455
455
|
}
|
|
456
456
|
let o = 0;
|
|
457
457
|
for (const l of this.modules)
|
|
458
|
-
o = l.reduce((
|
|
458
|
+
o = l.reduce((f, d) => f + (d ? 1 : 0), o);
|
|
459
459
|
const n = this.size * this.size, i = Math.ceil(Math.abs(o * 20 - n * 10) / n) - 1;
|
|
460
460
|
return u(0 <= i && i <= 9), e += i * v.PENALTY_N4, u(0 <= e && e <= 2568888), e;
|
|
461
461
|
}
|
|
@@ -515,7 +515,7 @@ var Z;
|
|
|
515
515
|
let n = o.map((i) => 0);
|
|
516
516
|
for (const i of e) {
|
|
517
517
|
const l = i ^ n.shift();
|
|
518
|
-
n.push(0), o.forEach((
|
|
518
|
+
n.push(0), o.forEach((f, d) => n[d] ^= v.reedSolomonMultiply(f, l));
|
|
519
519
|
}
|
|
520
520
|
return n;
|
|
521
521
|
}
|
|
@@ -569,17 +569,17 @@ var Z;
|
|
|
569
569
|
[-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]
|
|
570
570
|
// High
|
|
571
571
|
], t.QrCode = s;
|
|
572
|
-
function r(
|
|
573
|
-
if (e < 0 || e > 31 ||
|
|
572
|
+
function r(p, e, o) {
|
|
573
|
+
if (e < 0 || e > 31 || p >>> e)
|
|
574
574
|
throw new RangeError("Value out of range");
|
|
575
575
|
for (let n = e - 1; n >= 0; n--)
|
|
576
|
-
o.push(
|
|
576
|
+
o.push(p >>> n & 1);
|
|
577
577
|
}
|
|
578
|
-
function a(
|
|
579
|
-
return (
|
|
578
|
+
function a(p, e) {
|
|
579
|
+
return (p >>> e & 1) != 0;
|
|
580
580
|
}
|
|
581
|
-
function u(
|
|
582
|
-
if (!
|
|
581
|
+
function u(p) {
|
|
582
|
+
if (!p)
|
|
583
583
|
throw new Error("Assertion error");
|
|
584
584
|
}
|
|
585
585
|
const c = class M {
|
|
@@ -728,22 +728,22 @@ function _e(t, s = 0) {
|
|
|
728
728
|
const r = [];
|
|
729
729
|
return t.forEach(function(a, u) {
|
|
730
730
|
let c = null;
|
|
731
|
-
a.forEach(function(C,
|
|
731
|
+
a.forEach(function(C, p) {
|
|
732
732
|
if (!C && c !== null) {
|
|
733
733
|
r.push(
|
|
734
|
-
`M${c + s} ${u + s}h${
|
|
734
|
+
`M${c + s} ${u + s}h${p - c}v1H${c + s}z`
|
|
735
735
|
), c = null;
|
|
736
736
|
return;
|
|
737
737
|
}
|
|
738
|
-
if (
|
|
738
|
+
if (p === a.length - 1) {
|
|
739
739
|
if (!C)
|
|
740
740
|
return;
|
|
741
|
-
c === null ? r.push(`M${
|
|
742
|
-
`M${c + s},${u + s} h${
|
|
741
|
+
c === null ? r.push(`M${p + s},${u + s} h1v1H${p + s}z`) : r.push(
|
|
742
|
+
`M${c + s},${u + s} h${p + 1 - c}v1H${c + s}z`
|
|
743
743
|
);
|
|
744
744
|
return;
|
|
745
745
|
}
|
|
746
|
-
C && c === null && (c =
|
|
746
|
+
C && c === null && (c = p);
|
|
747
747
|
});
|
|
748
748
|
}), r.join("");
|
|
749
749
|
}
|
|
@@ -753,14 +753,14 @@ function $e(t, s) {
|
|
|
753
753
|
function Dt(t, s, r, a) {
|
|
754
754
|
if (a == null)
|
|
755
755
|
return null;
|
|
756
|
-
const u = t.length + r * 2, c = Math.floor(s * Pt), C = u / s,
|
|
756
|
+
const u = t.length + r * 2, c = Math.floor(s * Pt), C = u / s, p = (a.width || c) * C, e = (a.height || c) * C, o = a.x == null ? t.length / 2 - p / 2 : a.x * C, n = a.y == null ? t.length / 2 - e / 2 : a.y * C, i = a.opacity == null ? 1 : a.opacity;
|
|
757
757
|
let l = null;
|
|
758
758
|
if (a.excavate) {
|
|
759
|
-
let d = Math.floor(o), E = Math.floor(n), m = Math.ceil(
|
|
759
|
+
let d = Math.floor(o), E = Math.floor(n), m = Math.ceil(p + o - d), R = Math.ceil(e + n - E);
|
|
760
760
|
l = { x: d, y: E, w: m, h: R };
|
|
761
761
|
}
|
|
762
|
-
const
|
|
763
|
-
return { x: o, y: n, h: e, w:
|
|
762
|
+
const f = a.crossOrigin;
|
|
763
|
+
return { x: o, y: n, h: e, w: p, excavation: l, opacity: i, crossOrigin: f };
|
|
764
764
|
}
|
|
765
765
|
function Tt(t, s) {
|
|
766
766
|
return s != null ? Math.max(Math.floor(s), 0) : t ? It : xt;
|
|
@@ -773,7 +773,7 @@ function He({
|
|
|
773
773
|
marginSize: u,
|
|
774
774
|
imageSettings: c,
|
|
775
775
|
size: C,
|
|
776
|
-
boostLevel:
|
|
776
|
+
boostLevel: p
|
|
777
777
|
}) {
|
|
778
778
|
let e = P.useMemo(() => {
|
|
779
779
|
const d = (Array.isArray(t) ? t : [t]).reduce((E, m) => (E.push(...ee.QrSegment.makeSegments(m)), E), []);
|
|
@@ -783,19 +783,19 @@ function He({
|
|
|
783
783
|
r,
|
|
784
784
|
void 0,
|
|
785
785
|
void 0,
|
|
786
|
-
|
|
786
|
+
p
|
|
787
787
|
);
|
|
788
|
-
}, [t, s, r,
|
|
788
|
+
}, [t, s, r, p]);
|
|
789
789
|
const { cells: o, margin: n, numCells: i, calculatedImageSettings: l } = P.useMemo(() => {
|
|
790
|
-
let
|
|
791
|
-
const d = Tt(a, u), E =
|
|
792
|
-
|
|
790
|
+
let f = e.getModules();
|
|
791
|
+
const d = Tt(a, u), E = f.length + d * 2, m = Dt(
|
|
792
|
+
f,
|
|
793
793
|
C,
|
|
794
794
|
d,
|
|
795
795
|
c
|
|
796
796
|
);
|
|
797
797
|
return {
|
|
798
|
-
cells:
|
|
798
|
+
cells: f,
|
|
799
799
|
margin: d,
|
|
800
800
|
numCells: E,
|
|
801
801
|
calculatedImageSettings: m
|
|
@@ -822,14 +822,14 @@ var Ot = (function() {
|
|
|
822
822
|
value: u,
|
|
823
823
|
size: c = Le,
|
|
824
824
|
level: C = Be,
|
|
825
|
-
bgColor:
|
|
825
|
+
bgColor: p = ke,
|
|
826
826
|
fgColor: e = Fe,
|
|
827
827
|
includeMargin: o = Ue,
|
|
828
828
|
minVersion: n = ze,
|
|
829
829
|
boostLevel: i,
|
|
830
830
|
marginSize: l,
|
|
831
|
-
imageSettings:
|
|
832
|
-
} = a, E =
|
|
831
|
+
imageSettings: f
|
|
832
|
+
} = a, E = Ce(a, [
|
|
833
833
|
"value",
|
|
834
834
|
"size",
|
|
835
835
|
"level",
|
|
@@ -840,7 +840,7 @@ var Ot = (function() {
|
|
|
840
840
|
"boostLevel",
|
|
841
841
|
"marginSize",
|
|
842
842
|
"imageSettings"
|
|
843
|
-
]), { style: m } = E, R =
|
|
843
|
+
]), { style: m } = E, R = Ce(E, ["style"]), w = f?.src, g = P.useRef(null), y = P.useRef(null), A = P.useCallback(
|
|
844
844
|
(Y) => {
|
|
845
845
|
g.current = Y, typeof r == "function" ? r(Y) : r && (r.current = Y);
|
|
846
846
|
},
|
|
@@ -852,7 +852,7 @@ var Ot = (function() {
|
|
|
852
852
|
boostLevel: i,
|
|
853
853
|
includeMargin: o,
|
|
854
854
|
marginSize: l,
|
|
855
|
-
imageSettings:
|
|
855
|
+
imageSettings: f,
|
|
856
856
|
size: c
|
|
857
857
|
});
|
|
858
858
|
P.useEffect(() => {
|
|
@@ -869,9 +869,9 @@ var Ot = (function() {
|
|
|
869
869
|
const W = window.devicePixelRatio || 1;
|
|
870
870
|
Y.height = Y.width = c * W;
|
|
871
871
|
const J = c / Q * W;
|
|
872
|
-
N.scale(J, J), N.fillStyle =
|
|
873
|
-
|
|
874
|
-
|
|
872
|
+
N.scale(J, J), N.fillStyle = p, N.fillRect(0, 0, Q, Q), N.fillStyle = e, Ot ? N.fill(new Path2D(_e(I, L))) : H.forEach(function(ue, re) {
|
|
873
|
+
ue.forEach(function(de, he) {
|
|
874
|
+
de && N.fillRect(he + L, re + L, 1, 1);
|
|
875
875
|
});
|
|
876
876
|
}), D && (N.globalAlpha = D.opacity), F && N.drawImage(
|
|
877
877
|
x,
|
|
@@ -884,7 +884,7 @@ var Ot = (function() {
|
|
|
884
884
|
}), P.useEffect(() => {
|
|
885
885
|
b(!1);
|
|
886
886
|
}, [w]);
|
|
887
|
-
const G =
|
|
887
|
+
const G = ge({ height: c, width: c }, m);
|
|
888
888
|
let X = null;
|
|
889
889
|
return w != null && (X = /* @__PURE__ */ P.createElement(
|
|
890
890
|
"img",
|
|
@@ -900,7 +900,7 @@ var Ot = (function() {
|
|
|
900
900
|
}
|
|
901
901
|
)), /* @__PURE__ */ P.createElement(P.Fragment, null, /* @__PURE__ */ P.createElement(
|
|
902
902
|
"canvas",
|
|
903
|
-
|
|
903
|
+
ge({
|
|
904
904
|
style: G,
|
|
905
905
|
height: c,
|
|
906
906
|
width: c,
|
|
@@ -917,15 +917,15 @@ var Ye = P.forwardRef(
|
|
|
917
917
|
value: u,
|
|
918
918
|
size: c = Le,
|
|
919
919
|
level: C = Be,
|
|
920
|
-
bgColor:
|
|
920
|
+
bgColor: p = ke,
|
|
921
921
|
fgColor: e = Fe,
|
|
922
922
|
includeMargin: o = Ue,
|
|
923
923
|
minVersion: n = ze,
|
|
924
924
|
boostLevel: i,
|
|
925
925
|
title: l,
|
|
926
|
-
marginSize:
|
|
926
|
+
marginSize: f,
|
|
927
927
|
imageSettings: d
|
|
928
|
-
} = a, E =
|
|
928
|
+
} = a, E = Ce(a, [
|
|
929
929
|
"value",
|
|
930
930
|
"size",
|
|
931
931
|
"level",
|
|
@@ -943,7 +943,7 @@ var Ye = P.forwardRef(
|
|
|
943
943
|
minVersion: n,
|
|
944
944
|
boostLevel: i,
|
|
945
945
|
includeMargin: o,
|
|
946
|
-
marginSize:
|
|
946
|
+
marginSize: f,
|
|
947
947
|
imageSettings: d,
|
|
948
948
|
size: c
|
|
949
949
|
});
|
|
@@ -967,7 +967,7 @@ var Ye = P.forwardRef(
|
|
|
967
967
|
const T = _e(y, m);
|
|
968
968
|
return /* @__PURE__ */ P.createElement(
|
|
969
969
|
"svg",
|
|
970
|
-
|
|
970
|
+
ge({
|
|
971
971
|
height: c,
|
|
972
972
|
width: c,
|
|
973
973
|
viewBox: `0 0 ${w} ${w}`,
|
|
@@ -978,7 +978,7 @@ var Ye = P.forwardRef(
|
|
|
978
978
|
/* @__PURE__ */ P.createElement(
|
|
979
979
|
"path",
|
|
980
980
|
{
|
|
981
|
-
fill:
|
|
981
|
+
fill: p,
|
|
982
982
|
d: `M0,0 h${w}v${w}H0z`,
|
|
983
983
|
shapeRendering: "crispEdges"
|
|
984
984
|
}
|
|
@@ -1015,13 +1015,13 @@ const Bt = (t, s) => ({
|
|
|
1015
1015
|
getConversation: u,
|
|
1016
1016
|
generateConversationLink: c,
|
|
1017
1017
|
chatExpiration: C,
|
|
1018
|
-
chatExpirationDays:
|
|
1018
|
+
chatExpirationDays: p,
|
|
1019
1019
|
close: e,
|
|
1020
1020
|
chatWarning: o,
|
|
1021
1021
|
shareLink: n,
|
|
1022
1022
|
shareCopyLink: i,
|
|
1023
1023
|
shareCopiedLink: l,
|
|
1024
|
-
shareDescription:
|
|
1024
|
+
shareDescription: f,
|
|
1025
1025
|
shareRemoveAccessToUsers: d,
|
|
1026
1026
|
chatName: E,
|
|
1027
1027
|
getSharedConversations: m,
|
|
@@ -1031,7 +1031,7 @@ const Bt = (t, s) => ({
|
|
|
1031
1031
|
clientSharedPage: y,
|
|
1032
1032
|
clientSharedProp: A
|
|
1033
1033
|
}) => {
|
|
1034
|
-
const [T, b] = B(null), [L, H] = B(), [Q, D] = B(!1), [G, X] = B(!1), [Y, N] = B(), I =
|
|
1034
|
+
const [T, b] = B(null), [L, H] = B(), [Q, D] = B(!1), [G, X] = B(!1), [Y, N] = B(), I = me(null), x = me(null), F = K(() => t?.id ? decodeURI(t.id) : g?.[0] && g?.[1] && s ? decodeURI(`${g[0]}/${s}/${g[1]}`) : null, [t?.id, g, s]), W = K(() => {
|
|
1035
1035
|
if (!T)
|
|
1036
1036
|
return "";
|
|
1037
1037
|
const z = w || window.location.origin;
|
|
@@ -1083,11 +1083,11 @@ const Bt = (t, s) => ({
|
|
|
1083
1083
|
u,
|
|
1084
1084
|
J
|
|
1085
1085
|
]);
|
|
1086
|
-
const
|
|
1086
|
+
const ue = O(() => {
|
|
1087
1087
|
x.current?.abort(), I.current = null, r(), b(null), D(!1), X(!1);
|
|
1088
1088
|
}, [r]), re = O(() => {
|
|
1089
1089
|
X(!0), navigator.clipboard.writeText(W || "");
|
|
1090
|
-
}, [W]),
|
|
1090
|
+
}, [W]), de = async () => {
|
|
1091
1091
|
try {
|
|
1092
1092
|
if (N(!0), L && await R?.({
|
|
1093
1093
|
resources: [L]
|
|
@@ -1100,7 +1100,7 @@ const Bt = (t, s) => ({
|
|
|
1100
1100
|
} finally {
|
|
1101
1101
|
x.current?.signal.aborted || N(!1);
|
|
1102
1102
|
}
|
|
1103
|
-
},
|
|
1103
|
+
}, he = O(() => /* @__PURE__ */ h(
|
|
1104
1104
|
j,
|
|
1105
1105
|
{
|
|
1106
1106
|
buttonClassName: G ? "text-button-secondary" : "text-button-primary",
|
|
@@ -1111,13 +1111,13 @@ const Bt = (t, s) => ({
|
|
|
1111
1111
|
}
|
|
1112
1112
|
), [G, re, l, i]);
|
|
1113
1113
|
return /* @__PURE__ */ S(
|
|
1114
|
-
|
|
1114
|
+
le,
|
|
1115
1115
|
{
|
|
1116
1116
|
heading: n ?? "Share link",
|
|
1117
1117
|
portalId: "share",
|
|
1118
|
-
size:
|
|
1118
|
+
size: ce.SM,
|
|
1119
1119
|
dividers: a,
|
|
1120
|
-
onClose:
|
|
1120
|
+
onClose: ue,
|
|
1121
1121
|
closeButtonTitle: e ?? "Close",
|
|
1122
1122
|
children: [
|
|
1123
1123
|
Q ? /* @__PURE__ */ S("div", { className: "share flex flex-col gap-y-4 overflow-auto px-6 pb-6 sm:p-0", children: [
|
|
@@ -1136,7 +1136,7 @@ const Bt = (t, s) => ({
|
|
|
1136
1136
|
/* @__PURE__ */ h("p", { className: "share-info-title body-1 mr-1 text-neutrals-800", children: C ?? "Link expiration date:" }),
|
|
1137
1137
|
/* @__PURE__ */ S("h3", { children: [
|
|
1138
1138
|
"3 ",
|
|
1139
|
-
|
|
1139
|
+
p ?? "days"
|
|
1140
1140
|
] })
|
|
1141
1141
|
] }),
|
|
1142
1142
|
/* @__PURE__ */ h(
|
|
@@ -1147,7 +1147,7 @@ const Bt = (t, s) => ({
|
|
|
1147
1147
|
size: 200
|
|
1148
1148
|
}
|
|
1149
1149
|
),
|
|
1150
|
-
/* @__PURE__ */ h("p", { className: "body-2 text-neutrals-1000", children:
|
|
1150
|
+
/* @__PURE__ */ h("p", { className: "body-2 text-neutrals-1000", children: f ?? "Your name, special instructions, and any messages you add after sharing remain confidential." }),
|
|
1151
1151
|
/* @__PURE__ */ h(
|
|
1152
1152
|
Me,
|
|
1153
1153
|
{
|
|
@@ -1157,7 +1157,7 @@ const Bt = (t, s) => ({
|
|
|
1157
1157
|
placeholder: W,
|
|
1158
1158
|
value: W,
|
|
1159
1159
|
inputId: "conversationLink",
|
|
1160
|
-
iconAfterInput:
|
|
1160
|
+
iconAfterInput: he()
|
|
1161
1161
|
}
|
|
1162
1162
|
)
|
|
1163
1163
|
] }) : /* @__PURE__ */ h("div", { className: "flex items-center justify-center p-6", children: /* @__PURE__ */ h(be, {}) }),
|
|
@@ -1168,7 +1168,7 @@ const Bt = (t, s) => ({
|
|
|
1168
1168
|
buttonClassName: "remove-access-button py-3 px-4",
|
|
1169
1169
|
isSmallButton: !0,
|
|
1170
1170
|
disabled: Y,
|
|
1171
|
-
onClick:
|
|
1171
|
+
onClick: de
|
|
1172
1172
|
}
|
|
1173
1173
|
) }) : /* @__PURE__ */ h("p", { className: "body-2 share-footer text-neutrals-800", children: o ?? "This chat has not been shared with anyone yet." }) : /* @__PURE__ */ h("div", {})
|
|
1174
1174
|
]
|
|
@@ -1180,22 +1180,22 @@ const Bt = (t, s) => ({
|
|
|
1180
1180
|
renameConversation: r,
|
|
1181
1181
|
locale: a
|
|
1182
1182
|
}) => {
|
|
1183
|
-
const { titles: u, disableModalDividers: c, isSmallModalButton: C } = V(), [
|
|
1183
|
+
const { titles: u, disableModalDividers: c, isSmallModalButton: C } = V(), [p, e] = B(t?.name || ""), o = (i) => {
|
|
1184
1184
|
e(i);
|
|
1185
1185
|
}, n = () => {
|
|
1186
|
-
const i = `${t?.folderId}/${encodeURIComponent(ve(
|
|
1186
|
+
const i = `${t?.folderId}/${encodeURIComponent(ve(p))}-${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
1187
1187
|
r(
|
|
1188
1188
|
`conversations/${t.id}`,
|
|
1189
1189
|
`conversations/${i}`
|
|
1190
1190
|
);
|
|
1191
1191
|
};
|
|
1192
1192
|
return /* @__PURE__ */ S(
|
|
1193
|
-
|
|
1193
|
+
le,
|
|
1194
1194
|
{
|
|
1195
1195
|
heading: u?.renameTitle ?? "Rename conversation",
|
|
1196
1196
|
portalId: "rename-conversation",
|
|
1197
1197
|
containerClassName: "rename-conversation-popup",
|
|
1198
|
-
size:
|
|
1198
|
+
size: ce.SM,
|
|
1199
1199
|
dividers: !c,
|
|
1200
1200
|
onClose: s,
|
|
1201
1201
|
closeButtonTitle: u?.close ?? "Cancel",
|
|
@@ -1204,7 +1204,7 @@ const Bt = (t, s) => ({
|
|
|
1204
1204
|
Ze,
|
|
1205
1205
|
{
|
|
1206
1206
|
inputId: "rename",
|
|
1207
|
-
value:
|
|
1207
|
+
value: p,
|
|
1208
1208
|
onChange: o,
|
|
1209
1209
|
cssClass: "w-full"
|
|
1210
1210
|
}
|
|
@@ -1227,7 +1227,7 @@ const Bt = (t, s) => ({
|
|
|
1227
1227
|
buttonClassName: "text-button-primary text-button-primary",
|
|
1228
1228
|
title: u?.save ?? "Rename",
|
|
1229
1229
|
isSmallButton: C,
|
|
1230
|
-
disabled: !
|
|
1230
|
+
disabled: !p,
|
|
1231
1231
|
onClick: (i) => {
|
|
1232
1232
|
i.stopPropagation(), n();
|
|
1233
1233
|
}
|
|
@@ -1261,7 +1261,7 @@ const Yt = ({
|
|
|
1261
1261
|
locale: u,
|
|
1262
1262
|
deleteConversation: c,
|
|
1263
1263
|
renameConversation: C,
|
|
1264
|
-
getConversation:
|
|
1264
|
+
getConversation: p,
|
|
1265
1265
|
getFileBlob: e,
|
|
1266
1266
|
shareConversationProps: o
|
|
1267
1267
|
} = Ht(), n = K(() => {
|
|
@@ -1297,7 +1297,7 @@ const Yt = ({
|
|
|
1297
1297
|
t?.model?.id,
|
|
1298
1298
|
a.titles,
|
|
1299
1299
|
a.actionsIcons
|
|
1300
|
-
]), [i, l] = B($.Closed), [
|
|
1300
|
+
]), [i, l] = B($.Closed), [f, d] = B($.Closed), [E, m] = B($.Closed), R = O(() => {
|
|
1301
1301
|
l($.Closed);
|
|
1302
1302
|
}, [l]), w = O(() => {
|
|
1303
1303
|
d($.Closed);
|
|
@@ -1311,16 +1311,16 @@ const Yt = ({
|
|
|
1311
1311
|
},
|
|
1312
1312
|
[C, g]
|
|
1313
1313
|
);
|
|
1314
|
-
return /* @__PURE__ */ S(
|
|
1314
|
+
return /* @__PURE__ */ S(Ee, { children: [
|
|
1315
1315
|
/* @__PURE__ */ h(
|
|
1316
1316
|
Ae,
|
|
1317
1317
|
{
|
|
1318
|
-
containerClassName: "ml-3 group-hover:
|
|
1318
|
+
containerClassName: "ml-3 hidden group-hover:flex",
|
|
1319
1319
|
triggerButton: s ?? /* @__PURE__ */ h(Qt, { disabled: r }),
|
|
1320
1320
|
options: n,
|
|
1321
|
-
openedClassName: "action-menu-opened",
|
|
1321
|
+
openedClassName: "!flex action-menu-opened",
|
|
1322
1322
|
onOptionSelect: (b) => {
|
|
1323
|
-
b === _.DELETE && l($.Opened), b === _.SHARE && d($.Opened), b === _.RENAME && m($.Opened), b === _.EXPORT &&
|
|
1323
|
+
b === _.DELETE && l($.Opened), b === _.SHARE && d($.Opened), b === _.RENAME && m($.Opened), b === _.EXPORT && p(decodeURI(t.id)).then((L) => {
|
|
1324
1324
|
Nt(L, e).then((H) => {
|
|
1325
1325
|
bt(
|
|
1326
1326
|
`data:application/zip;base64,${H}`,
|
|
@@ -1340,7 +1340,7 @@ const Yt = ({
|
|
|
1340
1340
|
onCloseModal: R
|
|
1341
1341
|
}
|
|
1342
1342
|
),
|
|
1343
|
-
|
|
1343
|
+
f === $.Opened && /* @__PURE__ */ h(
|
|
1344
1344
|
zt,
|
|
1345
1345
|
{
|
|
1346
1346
|
conversation: t,
|
|
@@ -1383,12 +1383,12 @@ const Yt = ({
|
|
|
1383
1383
|
onConversationClick: a,
|
|
1384
1384
|
isDisabled: u
|
|
1385
1385
|
}) => {
|
|
1386
|
-
const { titles: c, conversationItemIcon: C } = V(),
|
|
1386
|
+
const { titles: c, conversationItemIcon: C } = V(), p = me(null), e = ve(t?.name);
|
|
1387
1387
|
return ne(() => {
|
|
1388
|
-
if (t?.id === s &&
|
|
1389
|
-
const o =
|
|
1388
|
+
if (t?.id === s && p?.current) {
|
|
1389
|
+
const o = p.current.parentElement?.parentElement?.parentElement;
|
|
1390
1390
|
if (o) {
|
|
1391
|
-
const n =
|
|
1391
|
+
const n = p.current.getBoundingClientRect(), i = o.getBoundingClientRect(), l = n.height, f = i.height, E = n.top - i.top + o.scrollTop - (f / 2 - l / 2);
|
|
1392
1392
|
o.scrollTo({
|
|
1393
1393
|
top: E,
|
|
1394
1394
|
behavior: "smooth"
|
|
@@ -1398,7 +1398,7 @@ const Yt = ({
|
|
|
1398
1398
|
}, [t, s]), /* @__PURE__ */ S(
|
|
1399
1399
|
"div",
|
|
1400
1400
|
{
|
|
1401
|
-
ref:
|
|
1401
|
+
ref: p,
|
|
1402
1402
|
className: k(
|
|
1403
1403
|
"flex justify-between items-center py-2 px-3 border-transparent relative group border",
|
|
1404
1404
|
"conversation-item",
|
|
@@ -1440,9 +1440,9 @@ const Yt = ({
|
|
|
1440
1440
|
groupedConversations: a,
|
|
1441
1441
|
isDisabled: u
|
|
1442
1442
|
}) => {
|
|
1443
|
-
const { titles: c } = V(), [C,
|
|
1444
|
-
|
|
1445
|
-
}, [
|
|
1443
|
+
const { titles: c } = V(), [C, p] = B(!1), e = O(() => {
|
|
1444
|
+
p((o) => !o);
|
|
1445
|
+
}, [p]);
|
|
1446
1446
|
return /* @__PURE__ */ S("div", { children: [
|
|
1447
1447
|
/* @__PURE__ */ S(
|
|
1448
1448
|
"div",
|
|
@@ -1492,7 +1492,7 @@ const Yt = ({
|
|
|
1492
1492
|
toggleSearchField: a
|
|
1493
1493
|
}) => {
|
|
1494
1494
|
const { titles: u, searchIcon: c } = V();
|
|
1495
|
-
return /* @__PURE__ */ h(
|
|
1495
|
+
return /* @__PURE__ */ h(Ee, { children: s ? /* @__PURE__ */ h(
|
|
1496
1496
|
Me,
|
|
1497
1497
|
{
|
|
1498
1498
|
inputId: "conversations-search",
|
|
@@ -1525,9 +1525,9 @@ const Yt = ({
|
|
|
1525
1525
|
handleConversationClick: a,
|
|
1526
1526
|
isDisabled: u
|
|
1527
1527
|
}) => {
|
|
1528
|
-
const { titles: c } = V(), [C,
|
|
1528
|
+
const { titles: c } = V(), [C, p] = B([]);
|
|
1529
1529
|
return ne(() => {
|
|
1530
|
-
|
|
1530
|
+
p(
|
|
1531
1531
|
Pe(
|
|
1532
1532
|
t?.filter(
|
|
1533
1533
|
(e) => ve(e?.name)?.includes(
|
|
@@ -1536,7 +1536,7 @@ const Yt = ({
|
|
|
1536
1536
|
)
|
|
1537
1537
|
)
|
|
1538
1538
|
);
|
|
1539
|
-
}, [t, r]), /* @__PURE__ */ h(
|
|
1539
|
+
}, [t, r]), /* @__PURE__ */ h(Ee, { children: C?.length ? C.map((e) => /* @__PURE__ */ h(
|
|
1540
1540
|
Ge,
|
|
1541
1541
|
{
|
|
1542
1542
|
conversation: e,
|
|
@@ -1561,13 +1561,13 @@ const Yt = ({
|
|
|
1561
1561
|
isCollapsed: u,
|
|
1562
1562
|
isStreaming: c,
|
|
1563
1563
|
conversationStyles: C,
|
|
1564
|
-
conversations:
|
|
1564
|
+
conversations: p,
|
|
1565
1565
|
locale: e,
|
|
1566
1566
|
sharedConversations: o,
|
|
1567
1567
|
setConversations: n,
|
|
1568
1568
|
setSharedConversations: i,
|
|
1569
1569
|
shareConversationProps: l,
|
|
1570
|
-
handleSelectedConversationRemove:
|
|
1570
|
+
handleSelectedConversationRemove: f
|
|
1571
1571
|
}) => {
|
|
1572
1572
|
const [d, E] = B({}), [m, R] = B(!0), [w, g] = B(""), [y, A] = B(!1), {
|
|
1573
1573
|
getConversations: T,
|
|
@@ -1578,9 +1578,9 @@ const Yt = ({
|
|
|
1578
1578
|
ne(() => {
|
|
1579
1579
|
E({
|
|
1580
1580
|
...ut(o),
|
|
1581
|
-
...
|
|
1581
|
+
...pt(p)
|
|
1582
1582
|
});
|
|
1583
|
-
}, [
|
|
1583
|
+
}, [p, o]), ne(() => {
|
|
1584
1584
|
async function N() {
|
|
1585
1585
|
try {
|
|
1586
1586
|
R(!0);
|
|
@@ -1589,7 +1589,7 @@ const Yt = ({
|
|
|
1589
1589
|
);
|
|
1590
1590
|
n(q(I)), i(
|
|
1591
1591
|
q(
|
|
1592
|
-
|
|
1592
|
+
pe(x, e)
|
|
1593
1593
|
)
|
|
1594
1594
|
);
|
|
1595
1595
|
} catch (I) {
|
|
@@ -1615,9 +1615,9 @@ const Yt = ({
|
|
|
1615
1615
|
);
|
|
1616
1616
|
n(q(I)), i(
|
|
1617
1617
|
q(
|
|
1618
|
-
|
|
1618
|
+
pe(x, e)
|
|
1619
1619
|
)
|
|
1620
|
-
), s === N?.id &&
|
|
1620
|
+
), s === N?.id && f();
|
|
1621
1621
|
} catch (I) {
|
|
1622
1622
|
console.error("Error deleting conversation", I);
|
|
1623
1623
|
}
|
|
@@ -1630,7 +1630,7 @@ const Yt = ({
|
|
|
1630
1630
|
n,
|
|
1631
1631
|
i,
|
|
1632
1632
|
s,
|
|
1633
|
-
|
|
1633
|
+
f
|
|
1634
1634
|
]
|
|
1635
1635
|
), G = O(
|
|
1636
1636
|
async (N, I) => {
|
|
@@ -1641,7 +1641,7 @@ const Yt = ({
|
|
|
1641
1641
|
);
|
|
1642
1642
|
n(q(x)), i(
|
|
1643
1643
|
q(
|
|
1644
|
-
|
|
1644
|
+
pe(F, e)
|
|
1645
1645
|
)
|
|
1646
1646
|
);
|
|
1647
1647
|
} catch (x) {
|
|
@@ -1682,7 +1682,7 @@ const Yt = ({
|
|
|
1682
1682
|
"div",
|
|
1683
1683
|
{
|
|
1684
1684
|
className: k(
|
|
1685
|
-
"flex justify-between items-center",
|
|
1685
|
+
"flex justify-between items-center pr-6",
|
|
1686
1686
|
y ? " pt-4 pb-0 sm:pt-10" : " pt-6 pb-2 sm:pt-10"
|
|
1687
1687
|
),
|
|
1688
1688
|
children: [
|
|
@@ -1699,17 +1699,17 @@ const Yt = ({
|
|
|
1699
1699
|
]
|
|
1700
1700
|
}
|
|
1701
1701
|
),
|
|
1702
|
-
/* @__PURE__ */ h(
|
|
1702
|
+
/* @__PURE__ */ h("div", { className: "scroll-hidden-container flex flex-col mt-4 flex-1 min-h-0", children: u ? null : /* @__PURE__ */ h(
|
|
1703
1703
|
"div",
|
|
1704
1704
|
{
|
|
1705
1705
|
className: k(
|
|
1706
|
-
"
|
|
1706
|
+
"flex flex-col pr-4",
|
|
1707
1707
|
Q ? "gap-y-1" : "gap-y-6"
|
|
1708
1708
|
),
|
|
1709
|
-
children:
|
|
1709
|
+
children: p?.length === 0 && o?.length === 0 ? /* @__PURE__ */ h(Vt, {}) : Q ? /* @__PURE__ */ h(
|
|
1710
1710
|
Wt,
|
|
1711
1711
|
{
|
|
1712
|
-
conversations: [...o, ...
|
|
1712
|
+
conversations: [...o, ...p],
|
|
1713
1713
|
searchQuery: w,
|
|
1714
1714
|
selectedConversationId: s,
|
|
1715
1715
|
handleConversationClick: t,
|
|
@@ -1727,9 +1727,9 @@ const Yt = ({
|
|
|
1727
1727
|
},
|
|
1728
1728
|
N
|
|
1729
1729
|
)
|
|
1730
|
-
)
|
|
1730
|
+
)
|
|
1731
1731
|
}
|
|
1732
|
-
),
|
|
1732
|
+
) }),
|
|
1733
1733
|
a
|
|
1734
1734
|
] })
|
|
1735
1735
|
}
|
|
@@ -1742,12 +1742,12 @@ const Yt = ({
|
|
|
1742
1742
|
locale: u,
|
|
1743
1743
|
titles: c
|
|
1744
1744
|
}) => /* @__PURE__ */ S(
|
|
1745
|
-
|
|
1745
|
+
le,
|
|
1746
1746
|
{
|
|
1747
1747
|
heading: c?.popupTitle || "Log out?",
|
|
1748
1748
|
portalId: "sign-out",
|
|
1749
1749
|
containerClassName: "sign-out-popup",
|
|
1750
|
-
size:
|
|
1750
|
+
size: ce.SM,
|
|
1751
1751
|
dividers: !s,
|
|
1752
1752
|
onClose: t,
|
|
1753
1753
|
closeButtonTitle: "Cancel",
|
|
@@ -1787,12 +1787,12 @@ const Yt = ({
|
|
|
1787
1787
|
locale: u,
|
|
1788
1788
|
titles: c
|
|
1789
1789
|
}) => {
|
|
1790
|
-
const C = (R) => R?.split(" ")?.map((w, g) => g < 2 ? w[0].toUpperCase() : "")?.join("") ?? "",
|
|
1790
|
+
const C = (R) => R?.split(" ")?.map((w, g) => g < 2 ? w[0].toUpperCase() : "")?.join("") ?? "", p = K(
|
|
1791
1791
|
() => t?.name ? C(t?.name) : t?.email?.[0].toUpperCase() ?? "",
|
|
1792
1792
|
[t]
|
|
1793
1793
|
), [e, o] = B(!1), n = t?.name?.split(" "), i = n ? `${n?.[0] ?? ""} ${n?.[1]?.[0] ? n?.[1]?.[0] + "." : ""}` : t?.email ?? "", l = O(() => {
|
|
1794
1794
|
o(!0);
|
|
1795
|
-
}, []),
|
|
1795
|
+
}, []), f = O(() => {
|
|
1796
1796
|
o(!1);
|
|
1797
1797
|
}, []), d = O(() => {
|
|
1798
1798
|
window.open(r || "#", "_blank", "noopener,noreferrer");
|
|
@@ -1804,7 +1804,7 @@ const Yt = ({
|
|
|
1804
1804
|
"cursor-pointer flex items-center justify-center size-11 rounded-[100px] p-[10px] sm:h-[32px] sm:w-[32px] flex-shrink-0",
|
|
1805
1805
|
a?.initialStyles
|
|
1806
1806
|
),
|
|
1807
|
-
children:
|
|
1807
|
+
children: p
|
|
1808
1808
|
}
|
|
1809
1809
|
),
|
|
1810
1810
|
/* @__PURE__ */ h(
|
|
@@ -1817,7 +1817,7 @@ const Yt = ({
|
|
|
1817
1817
|
children: (a?.showShortName ? i : t?.name) ?? t?.email ?? ""
|
|
1818
1818
|
}
|
|
1819
1819
|
)
|
|
1820
|
-
] }), [
|
|
1820
|
+
] }), [p, i, a, t]), m = K(() => /* @__PURE__ */ S("div", { className: k("py-1", a?.dropDownStyles), children: [
|
|
1821
1821
|
a?.settingsIcon && /* @__PURE__ */ S(
|
|
1822
1822
|
"button",
|
|
1823
1823
|
{
|
|
@@ -1874,7 +1874,7 @@ const Yt = ({
|
|
|
1874
1874
|
e && /* @__PURE__ */ h(
|
|
1875
1875
|
Xt,
|
|
1876
1876
|
{
|
|
1877
|
-
onCloseModal:
|
|
1877
|
+
onCloseModal: f,
|
|
1878
1878
|
signOut: () => s?.(),
|
|
1879
1879
|
locale: u,
|
|
1880
1880
|
disableModalDividers: a?.disableModalDividers,
|
|
@@ -1890,7 +1890,7 @@ const Yt = ({
|
|
|
1890
1890
|
l,
|
|
1891
1891
|
d,
|
|
1892
1892
|
e,
|
|
1893
|
-
|
|
1893
|
+
f,
|
|
1894
1894
|
u,
|
|
1895
1895
|
s
|
|
1896
1896
|
]);
|
|
@@ -1914,5 +1914,5 @@ export {
|
|
|
1914
1914
|
ln as ConversationList,
|
|
1915
1915
|
cn as User,
|
|
1916
1916
|
ut as getSharedConversationsGroup,
|
|
1917
|
-
|
|
1917
|
+
pe as transformSharedConversations
|
|
1918
1918
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/statgpt-conversation-list",
|
|
3
|
-
"version": "0.5.0-rc.
|
|
3
|
+
"version": "0.5.0-rc.45",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@tabler/icons-react": "^3.34.1",
|
|
7
7
|
"@epam/ai-dial-shared": "^0.43.3",
|
|
8
|
-
"@epam/statgpt-ui-components": "0.5.0-rc.
|
|
8
|
+
"@epam/statgpt-ui-components": "0.5.0-rc.45",
|
|
9
9
|
"classnames": "^2.5.1",
|
|
10
|
-
"@epam/statgpt-shared-toolkit": "0.5.0-rc.
|
|
11
|
-
"@epam/statgpt-dial-toolkit": "0.5.0-rc.
|
|
10
|
+
"@epam/statgpt-shared-toolkit": "0.5.0-rc.45",
|
|
11
|
+
"@epam/statgpt-dial-toolkit": "0.5.0-rc.45",
|
|
12
12
|
"jszip": "3.10.1",
|
|
13
13
|
"lodash": "^4.17.23"
|
|
14
14
|
},
|