deskcord 0.9.0 โ†’ 0.9.1

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.
@@ -97,7 +97,7 @@
97
97
  When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
98
98
  and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
99
99
  `);const k=b.state[a];if(k==null)return;JSON.stringify(i.getState())!==JSON.stringify(k)&&g(k);return}i.dispatchFromDevtools&&typeof i.dispatch=="function"&&i.dispatch(b)});case"DISPATCH":switch(v.payload.type){case"RESET":return g(_),a===void 0?l==null?void 0:l.init(i.getState()):l==null?void 0:l.init(Fr(c.name));case"COMMIT":if(a===void 0){l==null||l.init(i.getState());return}return l==null?void 0:l.init(Fr(c.name));case"ROLLBACK":return ss(v.state,b=>{if(a===void 0){g(b),l==null||l.init(i.getState());return}g(b[a]),l==null||l.init(Fr(c.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return ss(v.state,b=>{if(a===void 0){g(b);return}JSON.stringify(i.getState())!==JSON.stringify(b[a])&&g(b[a])});case"IMPORT_STATE":{const{nextLiftedState:b}=v.payload,k=(x=b.computedStates.slice(-1)[0])==null?void 0:x.state;if(!k)return;g(a===void 0?k:k[a]),l==null||l.send(null,b);return}case"PAUSE_RECORDING":return m=!m}return}}),_},ss=(t,e)=>{let n;try{n=JSON.parse(t)}catch(r){console.error("[zustand devtools middleware] Could not parse the received json",r)}n!==void 0&&e(n)};function Fy(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var o;const s=c=>c===null?null:JSON.parse(c,void 0),a=(o=n.getItem(i))!=null?o:null;return a instanceof Promise?a.then(s):s(a)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>n.removeItem(i)}}const Wn=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return Wn(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Wn(r)(n)}}}},Vy=(t,e)=>(n,r,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:x=>x,version:0,merge:(x,b)=>({...b,...x}),...e},s=!1;const a=new Set,c=new Set;let h;try{h=o.getStorage()}catch{}if(!h)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...x)},r,i);const l=Wn(o.serialize),f=()=>{const x=o.partialize({...r()});let b;const k=l({state:x,version:o.version}).then(S=>h.setItem(o.name,S)).catch(S=>{b=S});if(b)throw b;return k},m=i.setState;i.setState=(x,b)=>{m(x,b),f()};const g=t((...x)=>{n(...x),f()},r,i);let _;const v=()=>{var x;if(!h)return;s=!1,a.forEach(k=>k(r()));const b=((x=o.onRehydrateStorage)==null?void 0:x.call(o,r()))||void 0;return Wn(h.getItem.bind(h))(o.name).then(k=>{if(k)return o.deserialize(k)}).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==o.version){if(o.migrate)return o.migrate(k.state,k.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return k.state}).then(k=>{var S;return _=o.merge(k,(S=r())!=null?S:g),n(_,!0),f()}).then(()=>{b==null||b(_,void 0),s=!0,c.forEach(k=>k(_))}).catch(k=>{b==null||b(void 0,k)})};return i.persist={setOptions:x=>{o={...o,...x},x.getStorage&&(h=x.getStorage())},clearStorage:()=>{h==null||h.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>v(),hasHydrated:()=>s,onHydrate:x=>(a.add(x),()=>{a.delete(x)}),onFinishHydration:x=>(c.add(x),()=>{c.delete(x)})},v(),_||g},Uy=(t,e)=>(n,r,i)=>{let o={storage:Fy(()=>localStorage),partialize:v=>v,version:0,merge:(v,x)=>({...x,...v}),...e},s=!1;const a=new Set,c=new Set;let h=o.storage;if(!h)return t((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...v)},r,i);const l=()=>{const v=o.partialize({...r()});return h.setItem(o.name,{state:v,version:o.version})},f=i.setState;i.setState=(v,x)=>{f(v,x),l()};const m=t((...v)=>{n(...v),l()},r,i);i.getInitialState=()=>m;let g;const _=()=>{var v,x;if(!h)return;s=!1,a.forEach(k=>{var S;return k((S=r())!=null?S:m)});const b=((x=o.onRehydrateStorage)==null?void 0:x.call(o,(v=r())!=null?v:m))||void 0;return Wn(h.getItem.bind(h))(o.name).then(k=>{if(k)if(typeof k.version=="number"&&k.version!==o.version){if(o.migrate)return[!0,o.migrate(k.state,k.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,k.state];return[!1,void 0]}).then(k=>{var S;const[M,T]=k;if(g=o.merge(T,(S=r())!=null?S:m),n(g,!0),M)return l()}).then(()=>{b==null||b(g,void 0),g=r(),s=!0,c.forEach(k=>k(g))}).catch(k=>{b==null||b(void 0,k)})};return i.persist={setOptions:v=>{o={...o,...v},v.storage&&(h=v.storage)},clearStorage:()=>{h==null||h.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>_(),hasHydrated:()=>s,onHydrate:v=>(a.add(v),()=>{a.delete(v)}),onFinishHydration:v=>(c.add(v),()=>{c.delete(v)})},o.skipHydration||_(),g||m},$y=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((Or?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Vy(t,e)):Uy(t,e);/*! js-cookie v3.0.5 | MIT */function Vr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var zy={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function as(t,e){function n(i,o,s){if(!(typeof document>"u")){s=Vr({},e,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a="";for(var c in s)s[c]&&(a+="; "+c,s[c]!==!0&&(a+="="+s[c].split(";")[0]));return document.cookie=i+"="+t.write(o,i)+a}}function r(i){if(!(typeof document>"u"||arguments.length&&!i)){for(var o=document.cookie?document.cookie.split("; "):[],s={},a=0;a<o.length;a++){var c=o[a].split("="),h=c.slice(1).join("=");try{var l=decodeURIComponent(c[0]);if(s[l]=t.read(h,l),i===l)break}catch{}}return i?s[i]:s}}return Object.create({set:n,get:r,remove:function(i,o){n(i,"",Vr({},o,{expires:-1}))},withAttributes:function(i){return as(this.converter,Vr({},this.attributes,i))},withConverter:function(i){return as(Vr({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var Re=as(zy,{path:"/"});function Ur(t){const e=t.content.slice(0,50);return t.support?`${t.date}-${t.authorName}-${e}`:`${t.date}-customer-${e}`}function id(t,e){const n=new Map;return t.forEach(r=>{const i=Ur(r);n.set(i,r)}),e.forEach(r=>{const i=Ur(r);n.set(i,r)}),Array.from(n.values()).sort((r,i)=>r.date-i.date)}function jy(t,e){const n=Ur(e);return t.some(r=>Ur(r)===n)}const od=460,Hy=750,Wy="https://api.deskcord.chat";function Ky(){var n,r,i,o;const t=(r=(n=window.deskcord)==null?void 0:n.settings)==null?void 0:r.app_id,e=((o=(i=window.deskcord)==null?void 0:i.settings)==null?void 0:o.domain)??Wy;if(!t)throw new Error("Cannot initialize discord chat. Please check your installation and embed.");return{app_id:t,domain:e}}const Bt=Ky();function yt(...t){}async function qy(t){const e=new Headers;e.append("Content-Type","application/json"),e.append("Authorization",`Bearer ${t}`);try{const n=await fetch(`${Bt.domain}/conversations/unread-count`,{method:"GET",headers:e});return n.ok?(await n.json()).unreadCount:(yt(`Failed to fetch unread count: ${n.status}`),null)}catch{return null}}async function Yy(t,e){const n=new Headers;n.append("Content-Type","application/json"),n.append("Authorization",`Bearer ${t}`);try{const r=await fetch(`${Bt.domain}/conversations/mark-read`,{method:"POST",headers:n,body:JSON.stringify({timestamp:e})});return r.ok?(await r.json()).success:(yt(`Failed to mark as read: ${r.status}`),!1)}catch{return!1}}const sd="deskcord_last_read",ad="deskcord_unread_count",Gy=()=>{try{const t=localStorage.getItem(sd);if(!t)return null;const e=parseInt(t,10);return isNaN(e)?null:e}catch{return console.warn("[Deskcord] localStorage unavailable for reading last read timestamp"),null}},cd=t=>{try{localStorage.setItem(sd,t.toString())}catch{console.warn("[Deskcord] localStorage unavailable for writing last read timestamp")}},$r=()=>{try{const t=localStorage.getItem(ad);if(!t)return 0;const e=parseInt(t,10);return isNaN(e)?0:e}catch{return console.warn("[Deskcord] localStorage unavailable for reading unread count"),0}},Kn=t=>{try{localStorage.setItem(ad,t.toString())}catch{console.warn("[Deskcord] localStorage unavailable for writing unread count")}},Y=Ey(Oy($y((t,e)=>({_REHYDRATED_:!1,token:"",isNetworkInitialized:!1,isChatOpen:!1,isChatVisible:!1,isConversationOpen:!0,conversations:[],email:"",username:"",openConversationId:null,guildSettings:{iconURL:"",header_title:"",header_subtitle:"",lastUpdate:null},fullScreen:!1,isLoading:!1,networkError:null,currentConversationLastFetchedAt:null,pastConversationsLastFetchedAt:null,unreadCount:0,lastReadMessageDate:null,typingByThread:{},setThreadTyping:(n,r)=>t(i=>({typingByThread:{...i.typingByThread,[n]:r}})),setRehydrated:n=>t(()=>({_REHYDRATED_:n})),setFullScreen:n=>t(()=>({fullScreen:n})),setToken:n=>t(()=>({token:n})),toggleChatOpen:()=>t(n=>({isChatOpen:!n.isChatOpen})),setNetworkInitialized:n=>t(()=>({isNetworkInitialized:n})),setChatVisible:n=>t(()=>({isChatVisible:n})),setChatOpen:n=>t(()=>({isChatOpen:n})),setOpenConversationId:n=>t(()=>({openConversationId:n})),setConversations:n=>t(()=>({conversations:n})),setGuildSettings:n=>t(r=>({guildSettings:{...r.guildSettings,...n}})),setConversationOpen:(n,r)=>t(i=>({conversations:i.conversations.map(o=>o.threadId===n?{...o,status:r?"open":"closed"}:o)})),setConversationCSMember:(n,r)=>t(an(i=>{const o=i.conversations.find(s=>s.threadId===n);o&&(o.csMember=r)})),addMessage:(n,r)=>t(an(i=>{const o=i.conversations.find(s=>s.threadId===n);o?o.messages.push(r):(i.conversations.push({threadId:n,lastMessageDate:Date.now(),firstMessageDate:Date.now(),status:"open",messages:[r]}),i.openConversationId=n)})),updateMessage:(n,r,i)=>t(an(o=>{const s=o.conversations.findIndex(a=>a.threadId===n);if(s!==-1){const a=o.conversations[s].messages.findIndex(c=>c.date===r);o.conversations[s].messages[a]=i}})),removeMessage:(n,r)=>t(an(i=>{const o=i.conversations.findIndex(s=>s.threadId===n);o!==-1&&(i.conversations[o].messages=i.conversations[o].messages.filter(s=>s.date!==r))})),tempConversationToThread:n=>t(r=>({...r,openConversationId:n,conversations:r.conversations.map(i=>i.threadId==="TEMP"?{...i,threadId:n}:i)})),setEmail:n=>t(()=>({email:n})),setUsername:n=>t(()=>({username:n})),getConversation:()=>{const{conversations:n,openConversationId:r}=e();return r?n.find(i=>i.threadId===r)??null:null},setLoading:n=>t(()=>({isLoading:n})),setNetworkError:n=>t(()=>({networkError:n})),setCurrentConversationLastFetchedAt:n=>t(()=>({currentConversationLastFetchedAt:n})),setPastConversationsLastFetchedAt:n=>t(()=>({pastConversationsLastFetchedAt:n})),smartMergeCurrentConversation:n=>t(an(r=>{const i=r.conversations.findIndex(o=>o.threadId===n.threadId);if(i!==-1){const o=r.conversations[i],s=id(o.messages,n.messages);r.conversations[i]={...n,messages:s}}else r.conversations.push(n);r.currentConversationLastFetchedAt=Date.now()})),smartMergePastConversations:n=>t(an(r=>{n.forEach(i=>{const o=r.conversations.findIndex(s=>s.threadId===i.threadId);if(o!==-1){const s=r.conversations[o],a=id(s.messages,i.messages);r.conversations[o]={...i,messages:a}}else r.conversations.push(i)}),r.pastConversationsLastFetchedAt=Date.now()})),incrementUnreadCount:()=>t(n=>{const r=n.unreadCount+1;return Kn(r),{unreadCount:r}}),markMessagesAsRead:()=>t(()=>{const n=Date.now();return Kn(0),cd(n),{unreadCount:0,lastReadMessageDate:n}}),setUnreadCount:n=>t(()=>(Kn(n),{unreadCount:n})),syncUnreadCountFromServer:async()=>{const n=Re.get("discord-widget");if(!n){const r=$r();t(()=>({unreadCount:r}));return}try{const r=await qy(n);if(r!==null)yt(`Synced unread count from server: ${r}`),Kn(r),t(()=>({unreadCount:r}));else{yt("Server unavailable, using cached unread count");const i=$r();t(()=>({unreadCount:i}))}}catch{const i=$r();t(()=>({unreadCount:i}))}},markMessagesAsReadWithSync:async()=>{const n=Date.now();Kn(0),cd(n),t(()=>({unreadCount:0,lastReadMessageDate:n}));const r=Re.get("discord-widget");if(r)try{const i=await Yy(r,n);yt(i?"Successfully synced mark-read with server":"Failed to sync mark-read with server (will retry on next load)")}catch{}},initializeUnreadState:()=>{const n=$r(),r=Gy();t(()=>({unreadCount:n,lastReadMessageDate:r}))}}),{name:"discord-widget-storage",partialize:t=>({token:t.token,username:t.username,email:t.email,openConversationId:t.openConversationId,conversations:Xy(t.conversations),guildSettings:t.guildSettings}),onRehydrateStorage:t=>()=>t.setRehydrated(!0)}),{enabled:!1}));function Xy(t){return t.map(e=>({...e,messages:e.messages.filter(n=>!n.ephemeral&&!n.pending)}))}const Zy="bottom-right";function Jy(t){return t==="bottom-left"||t==="bottom-right"}function cs(t){return Jy(t)?t:Zy}function zr(t,e){return t==="bottom-left"?{left:e}:{right:e}}const Qy=({onClick:t,isOpen:e,unreadCount:n=0})=>{const[r,i]=W(!1),{guildSettings:o}=Y(),s=cs(o==null?void 0:o.widget_position);U(()=>{if(n>0&&!e){i(!0);const c=setTimeout(()=>i(!1),600),h=setInterval(()=>{i(!0),setTimeout(()=>i(!1),600)},1e4);return()=>{clearTimeout(c),clearInterval(h)}}else i(!1)},[n,e]);const a=n>0&&!e;return w("div",{className:"fixed",style:{zIndex:9998,bottom:30,...zr(s,30)},children:[r&&a&&w(Qt.div,{className:"absolute inset-0 rounded-full",style:{background:"linear-gradient(135deg, var(--dc-primary) 0%, var(--dc-primary-mid) 80%, var(--dc-primary-dark) 100%)"},initial:{scale:1,opacity:.6},animate:{scale:1.5,opacity:0},transition:{duration:.6,ease:"easeOut"}}),w(Qt.button,{onClick:t,className:"relative w-14 h-14 rounded-full shadow-lg flex items-center justify-center outline-none",style:{boxShadow:"0 4px 12px rgba(0, 0, 0, 0.25)",background:"linear-gradient(135deg, var(--dc-primary) 0%, var(--dc-primary-mid) 80%, var(--dc-primary-dark) 100%)"},"aria-label":e?"Close chat":"Open chat",animate:{scale:[1,.9,1.05,1]},transition:{duration:.25,ease:"easeOut"},children:[w(bo,{mode:"wait",initial:!1,children:w(Qt.div,{initial:{rotate:-90,opacity:0,scale:.9},animate:{rotate:0,opacity:1,scale:1},exit:{rotate:90,opacity:0,scale:.9},transition:{duration:.18,ease:"easeInOut"},className:"flex items-center justify-center",whileHover:{scale:1.1},whileTap:{scale:.95},children:e?w(Xg,{size:24,color:"#FFFFFF"}):w(Wg,{size:22,fill:"#FFFFFF",color:"#FFFFFF"})},e?"close":"open")}),w(bo,{children:a&&w(Qt.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"absolute flex items-center justify-center",style:{top:-4,right:-4,minWidth:22,height:22,borderRadius:11,backgroundColor:"var(--dc-primary)",border:"2px solid #FFFFFF",padding:"0 6px"},children:w("span",{style:{color:"#FFFFFF",fontSize:12,fontWeight:600,lineHeight:1},children:n>99?"99+":n})})})]})]})};async function t1({content:t}){const e=Y.getState().username,n=Re.get("discord-widget"),r=JSON.stringify({name:e,content:t}),i=new Headers;i.append("Content-Type","application/json"),i.append("Authorization",`Bearer ${n}`);const o={method:"POST",headers:i,body:r};return await(await fetch(`${Bt.domain}/conversations/sendMessage`,o)).json()}var cn=(t=>(t[t.IntroduceYourself=0]="IntroduceYourself",t[t.UploadFile=1]="UploadFile",t))(cn||{});const qn="System",e1={content:"This conversation has been closed by the support.",support:!0,authorName:qn,date:Date.now()},n1={content:"",support:!0,authorName:qn,date:Date.now(),customRenderer:cn.IntroduceYourself};function ld(t){return{content:`You are now chatting with ${t}.`,support:!0,authorName:qn,date:Date.now(),ephemeral:!0}}function r1(t){return{content:"",support:!0,authorName:qn,date:Date.now(),customRenderer:cn.UploadFile,customRendererProps:{file:t},ephemeral:!0}}function i1(t){return{content:"",support:!1,authorName:"",date:Date.now(),ephemeral:!0,attachments:t}}const ud=["image/png","image/jpeg","image/gif","image/webp","application/pdf"],o1=fe(({accept:t,maxSize:e,uploadConfig:n,onFileSelect:r,onUploadComplete:i,onUploadStart:o,onError:s},a)=>{const c=F(null),h=F(null),{addMessage:l,getConversation:f,removeMessage:m,updateMessage:g}=Y(),_=f();Cn(a,()=>({upload:async()=>{if(h.current)try{const M=new FormData;M.append("file",h.current),o==null||o(h.current),x(h.current);const T=await fetch(n.url,{method:n.method,headers:n.headers,body:M}),R=await T.json();i==null||i(T),b(h.current),v(R)}catch(M){s==null||s(M),k(h.current)}},clear:()=>{h.current=null,c.current&&(c.current.value=""),r==null||r(null)}}));function v(M){_&&l(_.threadId,i1(M.attachments))}function x(M){_&&l(_.threadId,r1({fileName:M.name,status:"uploading",size:M.size}))}function b(M){var R;if(!_)return;const T=(R=f())==null?void 0:R.messages.find(N=>{var P,I;return((I=(P=N.customRendererProps)==null?void 0:P.file)==null?void 0:I.fileName)===M.name});T&&m(_.threadId,T.date)}function k(M){var R,N;if(!_)return;const T=(R=f())==null?void 0:R.messages.find(P=>{var I,D;return((D=(I=P.customRendererProps)==null?void 0:I.file)==null?void 0:D.fileName)===M.name});(N=T==null?void 0:T.customRendererProps)!=null&&N.file&&g(_.threadId,T.date,{...T,customRendererProps:{...T.customRendererProps,file:{...T.customRendererProps.file,status:"error"}}})}return w(tt,{children:[w("button",{className:"text-gray-500 hover:text-blue-500","aria-label":"Upload file",onClick:()=>{var M;return(M=c.current)==null?void 0:M.click()},children:w(Kg,{size:16})}),w("input",{type:"file",accept:t,ref:c,style:{display:"none"},onChange:M=>{var R;const T=(R=M.target.files)==null?void 0:R[0];T&&T.size<=e&&ud.includes(T.type)?(h.current=T,r==null||r(T)):(h.current=null,r==null||r(null))}})]})}),s1=({size:t})=>w("svg",{className:"shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:t||16,height:t||16,fill:"currentColor",viewBox:"0 0 16 16",children:w("path",{d:"M15.964.686a.5.5 0 0 0-.65-.65L.767 5.855H.766l-.452.18a.5.5 0 0 0-.082.887l.41.26.001.002 4.995 3.178 3.178 4.995.002.002.26.41a.5.5 0 0 0 .886-.083l6-15Zm-1.833 1.89L6.637 10.07l-.215-.338a.5.5 0 0 0-.154-.154l-.338-.215 7.494-7.494 1.178-.471-.47 1.178Z"})}),a1=({onPickEmoji:t})=>w("div",{className:"mb-2 p-2 bg-white max-h-40 overflow-y-auto",children:w("div",{className:"grid grid-cols-8 gap-2",children:c1.map((e,n)=>w("button",{className:"text-2xl hover:bg-gray-100 rounded",onClick:()=>t(e),children:e},n))})}),c1=["๐Ÿ˜€","๐Ÿ˜ƒ","๐Ÿ˜„","๐Ÿ˜","๐Ÿ˜†","๐Ÿ˜…","๐Ÿ˜‚","๐Ÿคฃ","๐Ÿ˜Š","๐Ÿ˜‡","๐Ÿ™‚","๐Ÿ™ƒ","๐Ÿ˜‰","๐Ÿ˜Œ","๐Ÿ˜","๐Ÿฅฐ","๐Ÿ˜˜","๐Ÿ˜—","๐Ÿ˜™","๐Ÿ˜š","๐Ÿ˜‹","๐Ÿ˜›","๐Ÿ˜","๐Ÿ˜œ","๐Ÿคช","๐Ÿคจ","๐Ÿง","๐Ÿค“","๐Ÿ˜Ž","๐Ÿคฉ","๐Ÿฅณ","๐Ÿ˜","๐Ÿ˜’","๐Ÿ˜ž","๐Ÿ˜”","๐Ÿ˜Ÿ","๐Ÿ˜•","๐Ÿ™","โ˜น๏ธ","๐Ÿ˜ฃ","๐Ÿ˜–","๐Ÿ˜ซ","๐Ÿ˜ฉ","๐Ÿฅบ","๐Ÿ˜ข","๐Ÿ˜ญ","๐Ÿ˜ค","๐Ÿ˜ ","๐Ÿ˜ก","๐Ÿคฌ","๐Ÿคฏ","๐Ÿ˜ณ","๐Ÿฅต","๐Ÿฅถ","๐Ÿ˜ฑ","๐Ÿ˜จ","๐Ÿ˜ฐ","๐Ÿ˜ฅ","๐Ÿ˜“","๐Ÿค—","๐Ÿค”","๐Ÿคญ","๐Ÿคซ","๐Ÿคฅ","๐Ÿ˜ถ","๐Ÿ˜","๐Ÿ˜‘","๐Ÿ˜ฌ","๐Ÿ™„","๐Ÿ˜ฏ","๐Ÿ˜ฆ","๐Ÿ˜ง","๐Ÿ˜ฎ","๐Ÿ˜ฒ","๐Ÿฅฑ","๐Ÿ˜ด","๐Ÿคค","๐Ÿ˜ช","๐Ÿ˜ต","๐Ÿค","๐Ÿฅด","๐Ÿคข","๐Ÿคฎ","๐Ÿคง","๐Ÿ˜ท","๐Ÿค’","๐Ÿค•"],l1=({imageUrl:t,fileName:e,onDelete:n,width:r,height:i})=>w("div",{className:"relative w-32 h-32 rounded-lg overflow-hidden bg-gray-100 border border-gray-200",children:[w("div",{className:"flex justify-center absolute inset-0",children:w("img",{src:t,alt:"Preview",className:`w-[${r}px] h-[${i}px] max-w-[100px] max-h-[100px] aspect-auto`})}),w("button",{onClick:n,className:"absolute top-1 right-1 bg-gray-600 p-1 rounded-lg text-red-400 hover:text-white transition",children:w(Ou,{size:20})}),w("div",{className:"absolute bottom-0 left-0 right-0 bg-gray-800 bg-opacity-80 text-white text-sm px-2 py-1 truncate",children:e})]}),ls=({extension:t,className:e="",iconColorClassName:n="text-gray-300 dark:text-neutral-600"})=>{const r=t==null?void 0:t.slice(0,4).toUpperCase();return w("span",{className:`relative inline-flex shrink-0 items-center justify-center ${e}`,children:[w(jg,{className:`w-full h-full ${n}`,strokeWidth:1.5}),r&&w("span",{className:"absolute left-1/2 bottom-[22%] -translate-x-1/2 rounded-[3px] bg-blue-600 px-[3px] leading-[11px] text-[7px] font-bold tracking-tight text-white",children:r})]})};function jr(t){const e=t.lastIndexOf(".");return e<=0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function us(t,e=!1,n=1){const r=e?1e3:1024;if(Math.abs(t)<r)return t+" B";const i=e?["kB","MB","GB","TB","PB","EB","ZB","YB"]:["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let o=-1;const s=10**n;do t/=r,++o;while(Math.round(Math.abs(t)*s)/s>=r&&o<i.length-1);return t.toFixed(n)+" "+i[o]}const u1=({fileName:t,size:e,onDelete:n})=>w("div",{className:"relative flex items-center gap-3 w-56 rounded-lg border border-gray-200 bg-gray-50 pl-3 pr-8 py-2",children:[w(ls,{extension:jr(t),className:"w-8 h-9"}),w("div",{className:"min-w-0",children:[w("p",{className:"text-sm font-medium text-gray-800 truncate",children:t}),w("p",{className:"text-xs text-gray-500",children:us(e)})]}),w("button",{onClick:n,"aria-label":"Remove attachment",className:"absolute top-1 right-1 p-1 rounded-lg text-gray-400 hover:text-red-500 transition",children:w(Ou,{size:16})})]}),d1=({className:t})=>w("svg",{className:t,viewBox:"0 0 642 74",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:w("path",{d:"M23.9 73.2C19.4333 73.2 15.3667 72.0667 11.7 69.8C8.1 67.5333 5.23333 64.4333 3.1 60.5C1.03333 56.5 7.45058e-08 51.9667 7.45058e-08 46.9C7.45058e-08 41.7667 1.06667 37.2333 3.2 33.3C5.33333 29.3 8.23333 26.1667 11.9 23.9C15.6333 21.5667 19.7667 20.4 24.3 20.4C27.7667 20.4 30.8 21.0333 33.4 22.3C36 23.5 38.1333 25.2667 39.8 27.6V-2.86102e-06H54.8V72H41.5L39.8 65.5C38.8 66.9 37.5667 68.2 36.1 69.4C34.7 70.5333 33 71.4333 31 72.1C29 72.8333 26.6333 73.2 23.9 73.2ZM27.8 60.1C30.2667 60.1 32.4333 59.5333 34.3 58.4C36.2333 57.2667 37.7 55.7 38.7 53.7C39.7667 51.7 40.3 49.4 40.3 46.8C40.3 44.2 39.7667 41.9 38.7 39.9C37.7 37.9 36.2333 36.3333 34.3 35.2C32.4333 34.0667 30.2667 33.5 27.8 33.5C25.4 33.5 23.2333 34.0667 21.3 35.2C19.4333 36.3333 17.9667 37.9 16.9 39.9C15.8333 41.9 15.3 44.1667 15.3 46.7C15.3 49.3 15.8333 51.6333 16.9 53.7C17.9667 55.7 19.4333 57.2667 21.3 58.4C23.2333 59.5333 25.4 60.1 27.8 60.1ZM86.6086 73.2C81.4086 73.2 76.8419 72.1333 72.9086 70C68.9753 67.8 65.8753 64.7667 63.6086 60.9C61.4086 56.9667 60.3086 52.4667 60.3086 47.4C60.3086 42.2 61.4086 37.5667 63.6086 33.5C65.8086 29.4333 68.8753 26.2333 72.8086 23.9C76.7419 21.5667 81.3086 20.4 86.5086 20.4C91.5753 20.4 96.0086 21.5 99.8086 23.7C103.609 25.9 106.575 28.9 108.709 32.7C110.909 36.4333 112.009 40.7667 112.009 45.7C112.009 46.3667 111.975 47.1333 111.909 48C111.909 48.8 111.842 49.6333 111.709 50.5H71.0086V41.8H96.7086C96.5753 39 95.5419 36.7667 93.6086 35.1C91.7419 33.3667 89.4086 32.5 86.6086 32.5C84.4753 32.5 82.5419 33 80.8086 34C79.0753 35 77.6753 36.5 76.6086 38.5C75.6086 40.5 75.1086 43.0333 75.1086 46.1V49.1C75.1086 51.4333 75.5419 53.5 76.4086 55.3C77.3419 57.1 78.6419 58.5 80.3086 59.5C82.0419 60.5 84.0753 61 86.4086 61C88.6086 61 90.4086 60.5667 91.8086 59.7C93.2753 58.7667 94.4086 57.6 95.2086 56.2H110.509C109.575 59.4 107.975 62.3 105.709 64.9C103.442 67.4333 100.675 69.4667 97.4086 71C94.1419 72.4667 90.5419 73.2 86.6086 73.2ZM138.039 73.2C133.306 73.2 129.206 72.4667 125.739 71C122.339 69.4667 119.639 67.4 117.639 64.8C115.706 62.2 114.606 59.2667 114.339 56H129.239C129.506 57.1333 129.972 58.1667 130.639 59.1C131.372 59.9667 132.339 60.6667 133.539 61.2C134.806 61.6667 136.206 61.9 137.739 61.9C139.406 61.9 140.739 61.7 141.739 61.3C142.806 60.8333 143.606 60.2333 144.139 59.5C144.672 58.7667 144.939 58 144.939 57.2C144.939 55.9333 144.539 54.9667 143.739 54.3C143.006 53.6333 141.906 53.1 140.439 52.7C138.972 52.2333 137.206 51.8 135.139 51.4C132.739 50.8667 130.339 50.2667 127.939 49.6C125.606 48.8667 123.506 47.9667 121.639 46.9C119.839 45.8333 118.372 44.4667 117.239 42.8C116.172 41.0667 115.639 38.9667 115.639 36.5C115.639 33.5 116.472 30.8 118.139 28.4C119.806 25.9333 122.206 24 125.339 22.6C128.472 21.1333 132.272 20.4 136.739 20.4C143.072 20.4 148.039 21.8 151.639 24.6C155.239 27.4 157.372 31.1667 158.039 35.9H144.039C143.639 34.5667 142.806 33.5667 141.539 32.9C140.272 32.1667 138.672 31.8 136.739 31.8C134.539 31.8 132.872 32.1667 131.739 32.9C130.606 33.6333 130.039 34.6 130.039 35.8C130.039 36.6 130.406 37.3333 131.139 38C131.939 38.6 133.072 39.1333 134.539 39.6C136.006 40.0667 137.806 40.5333 139.939 41C144.006 41.8667 147.506 42.8 150.439 43.8C153.439 44.8 155.772 46.2667 157.439 48.2C159.106 50.0667 159.906 52.8 159.839 56.4C159.906 59.6667 159.039 62.5667 157.239 65.1C155.506 67.6333 153.006 69.6333 149.739 71.1C146.472 72.5 142.572 73.2 138.039 73.2ZM198.643 72L177.843 44.4L196.343 21.6H214.043L189.143 50.8V38.8L217.243 72H198.643ZM165.043 72V-2.86102e-06H180.043V72H165.043ZM239.509 73.2C234.309 73.2 229.709 72.0667 225.709 69.8C221.776 67.5333 218.676 64.4333 216.409 60.5C214.209 56.5667 213.109 52.0667 213.109 47C213.109 41.8 214.209 37.2333 216.409 33.3C218.676 29.3 221.776 26.1667 225.709 23.9C229.709 21.5667 234.309 20.4 239.509 20.4C246.109 20.4 251.643 22.1333 256.109 25.6C260.643 29.0667 263.509 33.9 264.709 40.1H248.809C248.209 37.9667 247.076 36.3 245.409 35.1C243.743 33.9 241.743 33.3 239.409 33.3C237.209 33.3 235.276 33.8667 233.609 35C232.009 36.0667 230.743 37.6333 229.809 39.7C228.876 41.7 228.409 44.0667 228.409 46.8C228.409 48.8667 228.676 50.7333 229.209 52.4C229.743 54.0667 230.476 55.5 231.409 56.7C232.409 57.9 233.576 58.8333 234.909 59.5C236.243 60.1 237.743 60.4 239.409 60.4C241.009 60.4 242.409 60.1333 243.609 59.6C244.876 59.0667 245.943 58.3 246.809 57.3C247.743 56.3 248.409 55.0667 248.809 53.6H264.709C263.509 59.6 260.643 64.3667 256.109 67.9C251.576 71.4333 246.043 73.2 239.509 73.2ZM294.528 73.2C289.661 73.2 285.295 72.0667 281.428 69.8C277.561 67.5333 274.495 64.4333 272.228 60.5C269.961 56.5 268.828 51.9667 268.828 46.9C268.828 41.7 269.961 37.1333 272.228 33.2C274.495 29.2 277.561 26.0667 281.428 23.8C285.361 21.5333 289.728 20.4 294.528 20.4C299.461 20.4 303.861 21.5333 307.728 23.8C311.595 26.0667 314.661 29.2 316.928 33.2C319.195 37.1333 320.328 41.6667 320.328 46.8C320.328 51.9333 319.195 56.5 316.928 60.5C314.661 64.4333 311.595 67.5333 307.728 69.8C303.861 72.0667 299.461 73.2 294.528 73.2ZM294.528 60.2C296.528 60.2 298.295 59.7 299.828 58.7C301.428 57.7 302.695 56.2 303.628 54.2C304.561 52.2 305.028 49.7333 305.028 46.8C305.028 43.8667 304.561 41.4 303.628 39.4C302.695 37.4 301.461 35.9 299.928 34.9C298.395 33.9 296.628 33.4 294.628 33.4C292.628 33.4 290.828 33.9 289.228 34.9C287.695 35.9 286.461 37.4 285.528 39.4C284.595 41.4 284.128 43.8667 284.128 46.8C284.128 49.7333 284.595 52.2 285.528 54.2C286.461 56.2 287.695 57.7 289.228 58.7C290.828 59.7 292.595 60.2 294.528 60.2ZM325.852 72V21.6H339.152L340.552 30.8C341.885 28.6667 343.452 26.8333 345.252 25.3C347.052 23.7667 349.118 22.5667 351.452 21.7C353.852 20.8333 356.418 20.4 359.152 20.4V36.3H354.152C352.152 36.3 350.318 36.5333 348.652 37C347.052 37.4 345.652 38.1 344.452 39.1C343.318 40.1 342.418 41.4667 341.752 43.2C341.152 44.8667 340.852 46.9667 340.852 49.5V72H325.852ZM383.853 73.2C379.386 73.2 375.32 72.0667 371.653 69.8C368.053 67.5333 365.186 64.4333 363.053 60.5C360.986 56.5 359.953 51.9667 359.953 46.9C359.953 41.7667 361.02 37.2333 363.153 33.3C365.286 29.3 368.186 26.1667 371.853 23.9C375.586 21.5667 379.72 20.4 384.253 20.4C387.72 20.4 390.753 21.0333 393.353 22.3C395.953 23.5 398.086 25.2667 399.753 27.6V-2.86102e-06H414.753V72H401.453L399.753 65.5C398.753 66.9 397.52 68.2 396.053 69.4C394.653 70.5333 392.953 71.4333 390.953 72.1C388.953 72.8333 386.586 73.2 383.853 73.2ZM387.753 60.1C390.22 60.1 392.386 59.5333 394.253 58.4C396.186 57.2667 397.653 55.7 398.653 53.7C399.72 51.7 400.253 49.4 400.253 46.8C400.253 44.2 399.72 41.9 398.653 39.9C397.653 37.9 396.186 36.3333 394.253 35.2C392.386 34.0667 390.22 33.5 387.753 33.5C385.353 33.5 383.186 34.0667 381.253 35.2C379.386 36.3333 377.92 37.9 376.853 39.9C375.786 41.9 375.253 44.1667 375.253 46.7C375.253 49.3 375.786 51.6333 376.853 53.7C377.92 55.7 379.386 57.2667 381.253 58.4C383.186 59.5333 385.353 60.1 387.753 60.1ZM428.762 72.5C426.028 72.5 423.795 71.7 422.062 70.1C420.395 68.4333 419.562 66.4333 419.562 64.1C419.562 61.7 420.395 59.7 422.062 58.1C423.795 56.4333 426.028 55.6 428.762 55.6C431.428 55.6 433.595 56.4333 435.262 58.1C436.928 59.7 437.762 61.7 437.762 64.1C437.762 66.4333 436.928 68.4333 435.262 70.1C433.595 71.7 431.428 72.5 428.762 72.5ZM467.42 73.2C462.22 73.2 457.62 72.0667 453.62 69.8C449.686 67.5333 446.586 64.4333 444.32 60.5C442.12 56.5667 441.02 52.0667 441.02 47C441.02 41.8 442.12 37.2333 444.32 33.3C446.586 29.3 449.686 26.1667 453.62 23.9C457.62 21.5667 462.22 20.4 467.42 20.4C474.02 20.4 479.553 22.1333 484.02 25.6C488.553 29.0667 491.42 33.9 492.62 40.1H476.72C476.12 37.9667 474.986 36.3 473.32 35.1C471.653 33.9 469.653 33.3 467.32 33.3C465.12 33.3 463.186 33.8667 461.52 35C459.92 36.0667 458.653 37.6333 457.72 39.7C456.786 41.7 456.32 44.0667 456.32 46.8C456.32 48.8667 456.586 50.7333 457.12 52.4C457.653 54.0667 458.386 55.5 459.32 56.7C460.32 57.9 461.486 58.8333 462.82 59.5C464.153 60.1 465.653 60.4 467.32 60.4C468.92 60.4 470.32 60.1333 471.52 59.6C472.786 59.0667 473.853 58.3 474.72 57.3C475.653 56.3 476.32 55.0667 476.72 53.6H492.62C491.42 59.6 488.553 64.3667 484.02 67.9C479.486 71.4333 473.953 73.2 467.42 73.2ZM498.238 72V-2.86102e-06H513.238V28.8C514.838 26.2667 517.005 24.2333 519.738 22.7C522.472 21.1667 525.672 20.4 529.338 20.4C533.605 20.4 537.172 21.3 540.038 23.1C542.905 24.9 545.072 27.5333 546.538 31C548.005 34.4 548.738 38.5333 548.738 43.4V72H533.838V44.8C533.838 41.0667 533.038 38.1667 531.438 36.1C529.905 34.0333 527.438 33 524.038 33C522.038 33 520.205 33.5 518.538 34.5C516.872 35.5 515.572 36.9333 514.638 38.8C513.705 40.6 513.238 42.7667 513.238 45.3V72H498.238ZM572.427 73.2C568.227 73.2 564.727 72.5333 561.927 71.2C559.193 69.8667 557.16 68.0667 555.827 65.8C554.56 63.4667 553.927 60.9 553.927 58.1C553.927 55.1 554.66 52.4667 556.127 50.2C557.66 47.8667 560.027 46.0333 563.227 44.7C566.427 43.3 570.46 42.6 575.327 42.6H587.527C587.527 40.3333 587.227 38.4667 586.627 37C586.093 35.5333 585.193 34.4333 583.927 33.7C582.66 32.9667 580.927 32.6 578.727 32.6C576.393 32.6 574.427 33.0667 572.827 34C571.227 34.9333 570.227 36.4 569.827 38.4H555.427C555.76 34.8 556.927 31.6667 558.927 29C560.993 26.3333 563.727 24.2333 567.127 22.7C570.527 21.1667 574.427 20.4 578.827 20.4C583.627 20.4 587.793 21.2 591.327 22.8C594.86 24.3333 597.593 26.6 599.527 29.6C601.527 32.6 602.527 36.3333 602.527 40.8V72H590.027L588.227 64.7C587.493 65.9667 586.627 67.1333 585.627 68.2C584.627 69.2 583.46 70.1 582.127 70.9C580.793 71.6333 579.327 72.2 577.727 72.6C576.127 73 574.36 73.2 572.427 73.2ZM576.127 61.8C577.727 61.8 579.127 61.5333 580.327 61C581.527 60.4667 582.56 59.7333 583.427 58.8C584.293 57.8667 584.993 56.8 585.527 55.6C586.127 54.3333 586.56 52.9667 586.827 51.5V51.4H577.127C575.46 51.4 574.06 51.6333 572.927 52.1C571.86 52.5 571.06 53.1 570.527 53.9C569.993 54.7 569.727 55.6333 569.727 56.7C569.727 57.8333 569.993 58.8 570.527 59.6C571.127 60.3333 571.893 60.9 572.827 61.3C573.827 61.6333 574.927 61.8 576.127 61.8ZM632.299 72C628.633 72 625.399 71.4333 622.599 70.3C619.799 69.1 617.633 67.1667 616.099 64.5C614.566 61.8333 613.799 58.2 613.799 53.6V34.1H605.199V21.6H613.799L615.399 7.4H628.799V21.6H641.699V34.1H628.799V53.8C628.799 55.8 629.233 57.2333 630.099 58.1C631.033 58.9 632.599 59.3 634.799 59.3H641.699V72H632.299Z",fill:"currentColor"})}),h1=t=>{const{inputMessage:e,setInputMessage:n,sendMessage:r,setFiles:i,files:o,showEmojiPicker:s,addEmoji:a,setShowEmojiPicker:c,attachmentPreviews:h,disabled:l=!1}=t,{getConversation:f}=Y(),m=f(),g=Re.get("discord-widget"),_=F(null),v=(m==null?void 0:m.status)==="closed",x=v||l,b=()=>{},k=P=>{i(o.filter(I=>(P==null?void 0:P.name)!==I.name))},S=P=>{P&&i([...o,P])},M=()=>{var P;(P=_.current)==null||P.upload()},T=()=>{o.length&&M(),r()},R=P=>{P.key==="Enter"&&(P.shiftKey?(P.preventDefault(),n(`${e}
100
- `)):(P.preventDefault(),T()))};return w("div",{className:"relative",children:[!v&&s&&w(a1,{onPickEmoji:a}),!v&&(()=>{if(!(o!=null&&o.length))return null;const P=o.map((I,D)=>{if(!h[I.name])return null;const O=()=>{var $;i(o.filter(ut=>ut.name!==I.name)),($=_.current)==null||$.clear()};if(!I.type.startsWith("image/"))return w(u1,{onDelete:O,fileName:I.name,size:I.size},`attachment-preview-${D}`);const{url:J,width:at,height:Tt}=h[I.name];return w(l1,{onDelete:O,fileName:I.name,width:at,height:Tt,imageUrl:J},`attachment-preview-${D}`)});return w("div",{className:"m-2",children:P})})(),!v&&w("div",{className:"flex items-start gap-2 p-2 bg-white dark:bg-neutral-900",children:[w("textarea",{id:"hs-textarea-ex-1",disabled:x,value:e,onChange:P=>n(P.target.value),onKeyDown:R,className:"flex-1 p-3 block text-base md:text-sm outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:text-neutral-400 dark:placeholder-neutral-500 resize-none min-h-[55px] max-h-[200px] overflow-y-auto",placeholder:l?"Please introduce yourself first...":"Ask us anything!","data-hs-textarea-auto-height":""}),w("button",{type:"button",disabled:x,onClick:()=>T(),style:{background:x?"#9CA3AF":"linear-gradient(167deg, var(--dc-primary) 0%, var(--dc-primary-mid) 100%)"},"aria-label":"Send message",className:"inline-flex shrink-0 justify-center items-center w-[33px] h-[33px] rounded-lg text-white transform transition-transform duration-150 hover:scale-105 active:scale-95 disabled:opacity-50 disabled:pointer-events-none disabled:transform-none",children:w(s1,{size:16})})]}),w("div",{className:"flex items-center justify-between px-2 py-1.5 bg-white dark:bg-neutral-900",children:[w("div",{className:"flex items-center gap-1",children:!v&&w(tt,{children:[w("div",{className:"inline-flex shrink-0 justify-center items-center size-8 rounded-lg text-gray-500 hover:bg-gray-100 focus:z-10 focus:outline-none focus:bg-gray-100 dark:text-neutral-500 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800 transition-colors duration-150",children:w(o1,{ref:_,accept:ud.join(","),maxSize:10*1024*1024,uploadConfig:{url:`${Bt.domain}/conversations/uploadAttachment`,method:"POST",headers:{Authorization:`Bearer ${g}`}},onUploadComplete:b,onUploadStart:k,onFileSelect:S})}),w("button",{type:"button",disabled:x,onClick:x?void 0:()=>c(!s),"aria-label":"Open emoji picker",className:"inline-flex shrink-0 justify-center items-center size-8 rounded-lg text-gray-500 hover:bg-gray-100 focus:z-10 focus:outline-none focus:bg-gray-100 dark:text-neutral-500 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800 disabled:opacity-50 disabled:pointer-events-none transition-colors duration-150",children:w(Yg,{size:16})})]})}),w("a",{href:"https://deskcord.chat",target:"_blank",rel:"noopener noreferrer","aria-label":"Powered by Deskcord",className:"flex items-center gap-1 text-[10px] text-gray-400 hover:text-gray-600 dark:text-neutral-600 dark:hover:text-neutral-400 transition-colors duration-200 no-underline",children:[w("span",{children:"Powered by"}),w(d1,{className:"h-[10px] w-auto"})]})]})]})},dd=t=>{const e=Date.now(),n=Math.floor((e-t)/1e3);return n<60?"Just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`},hd="carousel",fd="controller",f1="navigation",p1="no-scroll",ds="portal",m1="root",pd="toolbar",hs="loading",fs="error",ps="complete",g1="placeholder",y1=t=>`active-slide-${t}`,md="flex_center",w1="no_scroll",gd="no_scroll_padding",v1="slide_wrapper",Ne="prev",De="next",yd="swipe",ln="close",wd="onPointerDown",vd="onPointerMove",_d="onPointerUp",bd="onPointerLeave",xd="onPointerCancel",Cd="onKeyDown",_1="onKeyUp",kd="onWheel",b1="Escape",x1="ArrowLeft",C1="ArrowRight",k1="button",ms="icon",Ed="contain",Sd="cover",E1="Unknown action type",Td="yarl__";function ue(...t){return[...t].filter(Boolean).join(" ")}function G(t){return`${Td}${t}`}function Rt(t){return`--${Td}${t}`}function Yn(t,e){return`${t}${e?`_${e}`:""}`}function gs(t){return e=>Yn(t,e)}function S1(t,e){var n;return(n=t==null?void 0:t[e])!==null&&n!==void 0?n:e}function Ad(...t){return()=>{t.forEach(e=>{e()})}}function Le(t,e,n){return()=>{const r=ft(n);if(!r)throw new Error(`${t} must be used within a ${e}.Provider`);return r}}function Pd(){return typeof window<"u"}function T1(t,e=0){const n=10**e;return Math.round((t+Number.EPSILON)*n)/n}function Id(t){return t.type===void 0||t.type==="image"}function A1(t,e){return t.imageFit===Sd||t.imageFit!==Ed&&e===Sd}function Hr(t){return typeof t=="string"?Number.parseInt(t,10):t}function Wr(t){if(typeof t=="number")return{pixel:t};if(typeof t=="string"){const e=Hr(t);return t.endsWith("%")?{percent:e}:{pixel:e}}return{pixel:0}}function P1(t,e){const n=Wr(e),r=n.percent!==void 0?t.width/100*n.percent:n.pixel;return{width:Math.max(t.width-2*r,0),height:Math.max(t.height-2*r,0)}}function Md(t,e){return e>0?(t%e+e)%e:0}function Rd(t){return t.length>0}function Nd(t,e){return t[Md(e,t.length)]}function ys(t,e){return Rd(t)?Nd(t,e):void 0}function I1(t){return Id(t)?t.src:void 0}function M1(t,e,n=0){return Math.min(t.preload,Math.max(t.finite?e.length-1:Math.floor(e.length/2),n))}const R1=Number(Da.split(".")[0])>=19;function N1(t){return{inert:R1?t:t?"":void 0}}const ws={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[ln]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:Ed,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,preventDefaultWheelX:!0,preventDefaultWheelY:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function Be(t,e){return{name:t,component:e}}function xt(t,e){return{module:t,children:e}}function Dd(t,e,n){return t.module.name===e?n(t):t.children?[xt(t.module,t.children.flatMap(r=>{var i;return(i=Dd(r,e,n))!==null&&i!==void 0?i:[]}))]:[t]}function un(t,e,n){return t.flatMap(r=>{var i;return(i=Dd(r,e,n))!==null&&i!==void 0?i:[]})}function D1(t,e=[],n=[]){let r=t;const i=g=>{const _=[...r];for(;_.length>0;){const v=_.pop();if((v==null?void 0:v.module.name)===g)return!0;v!=null&&v.children&&_.push(...v.children)}return!1},o=(g,_)=>{if(g===""){r=[xt(_,r)];return}r=un(r,g,v=>[xt(_,[v])])},s=(g,_)=>{r=un(r,g,v=>[xt(v.module,[xt(_,v.children)])])},a=(g,_,v)=>{r=un(r,g,x=>{var b;return[xt(x.module,[...v?[xt(_)]:[],...(b=x.children)!==null&&b!==void 0?b:[],...v?[]:[xt(_)]])]})},c=(g,_,v)=>{r=un(r,g,x=>[...v?[xt(_)]:[],x,...v?[]:[xt(_)]])},h=g=>{s(fd,g)},l=(g,_)=>{r=un(r,g,v=>[xt(_,v.children)])},f=g=>{r=un(r,g,_=>_.children)},m=g=>{n.push(g)};return e.forEach(g=>{g({contains:i,addParent:o,append:s,addChild:a,addSibling:c,addModule:h,replace:l,remove:f,augment:m})}),{config:r,augmentation:g=>n.reduce((_,v)=>v(_),g)}}const Ld=At(null),vs=Le("useDocument","DocumentContext",Ld);function L1({nodeRef:t,children:e}){const n=_t(()=>{const r=o=>{var s;return((s=o||t.current)===null||s===void 0?void 0:s.ownerDocument)||document};return{getOwnerDocument:r,getOwnerWindow:o=>{var s;return((s=r(o))===null||s===void 0?void 0:s.defaultView)||window}}},[t]);return B(Ld.Provider,{value:n},e)}const Bd=At(null),Kr=Le("useEvents","EventsContext",Bd);function B1({children:t}){const[e]=W({});U(()=>()=>{Object.keys(e).forEach(r=>delete e[r])},[e]);const n=_t(()=>{const r=(s,a)=>{var c;(c=e[s])===null||c===void 0||c.splice(0,e[s].length,...e[s].filter(h=>h!==a))};return{publish:(...[s,a])=>{var c;(c=e[s])===null||c===void 0||c.forEach(h=>h(a))},subscribe:(s,a)=>(e[s]||(e[s]=[]),e[s].push(a),()=>r(s,a)),unsubscribe:r}},[e]);return B(Bd.Provider,{value:n},t)}const Od=At(null),Gn=Le("useLightboxProps","LightboxPropsContext",Od);function O1({children:t,...e}){return B(Od.Provider,{value:e},t)}const Fd=At(null),qr=Le("useLightboxState","LightboxStateContext",Fd),Vd=At(null),F1=Le("useLightboxDispatch","LightboxDispatchContext",Vd);function V1(t,e){switch(e.type){case"swipe":{const{slides:n}=t,r=(e==null?void 0:e.increment)||0,i=t.globalIndex+r,o=Md(i,n.length),s=ys(n,o),a=r||e.duration?{increment:r,duration:e.duration,easing:e.easing}:void 0;return{slides:n,currentIndex:o,globalIndex:i,currentSlide:s,animation:a}}case"update":return e.slides!==t.slides||e.index!==t.currentIndex?{slides:e.slides,currentIndex:e.index,globalIndex:e.index,currentSlide:ys(e.slides,e.index)}:t;default:throw new Error(E1)}}function U1({slides:t,index:e,children:n}){const[r,i]=xn(V1,{slides:t,currentIndex:e,globalIndex:e,currentSlide:ys(t,e)});U(()=>{i({type:"update",slides:t,index:e})},[t,e]);const o=_t(()=>({...r,state:r,dispatch:i}),[r,i]);return B(Vd.Provider,{value:i},B(Fd.Provider,{value:o},n))}const Ud=At(null),Yr=Le("useTimeouts","TimeoutsContext",Ud);function $1({children:t}){const[e]=W([]);U(()=>()=>{e.forEach(r=>window.clearTimeout(r)),e.splice(0,e.length)},[e]);const n=_t(()=>{const r=s=>{e.splice(0,e.length,...e.filter(a=>a!==s))};return{setTimeout:(s,a)=>{const c=window.setTimeout(()=>{r(c),s()},a);return e.push(c),c},clearTimeout:s=>{s!==void 0&&(r(s),window.clearTimeout(s))}}},[e]);return B(Ud.Provider,{value:n},t)}const $d=fe(function({label:e,className:n,icon:r,renderIcon:i,onClick:o,style:s,...a},c){const{styles:h,labels:l}=Gn(),f=S1(l,e);return B("button",{ref:c,type:"button",title:f,"aria-label":f,className:ue(G(k1),n),onClick:o,style:{...s,...h.button},...a},i?i():B(r,{className:G(ms),style:h.icon}))});function z1(t,e){const n=r=>B("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...r},e);return n.displayName=t,n}function Xn(t,e){return z1(t,B("g",{fill:"currentColor"},B("path",{d:"M0 0h24v24H0z",fill:"none"}),e))}const j1=Xn("Close",B("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),H1=Xn("Previous",B("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),W1=Xn("Next",B("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),K1=Xn("Loading",B(tt,null,Array.from({length:8}).map((t,e,n)=>B("line",{key:e,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/n.length*(e+1),transform:`rotate(${360/n.length*e}, 12, 12)`})))),q1=Xn("Error",B("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),Zn=Pd()?ae:U;function zd(){const[t,e]=W(!1);return U(()=>{var n,r;const i=(n=window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-reduced-motion: reduce)");e(i==null?void 0:i.matches);const o=s=>e(s.matches);return(r=i==null?void 0:i.addEventListener)===null||r===void 0||r.call(i,"change",o),()=>{var s;return(s=i==null?void 0:i.removeEventListener)===null||s===void 0?void 0:s.call(i,"change",o)}},[]),t}function Y1(t){let e=0,n=0,r=0;const o=window.getComputedStyle(t).transform.match(/matrix.*\((.+)\)/);if(o){const s=o[1].split(",").map(Hr);s.length===6?(e=s[4],n=s[5]):s.length===16&&(e=s[12],n=s[13],r=s[14])}return{x:e,y:n,z:r}}function jd(t,e){const n=F(),r=F(),i=zd();return Zn(()=>{var o,s,a;if(t.current&&n.current!==void 0&&!i){const{keyframes:c,duration:h,easing:l,onfinish:f}=e(n.current,t.current.getBoundingClientRect(),Y1(t.current))||{};if(c&&h){(o=r.current)===null||o===void 0||o.cancel(),r.current=void 0;try{r.current=(a=(s=t.current).animate)===null||a===void 0?void 0:a.call(s,c,{duration:h,easing:l})}catch(m){console.error(m)}r.current&&(r.current.onfinish=()=>{r.current=void 0,f==null||f()})}}n.current=void 0}),{prepareAnimation:o=>{n.current=o},isAnimationPlaying:()=>{var o;return((o=r.current)===null||o===void 0?void 0:o.playState)==="running"}}}function Hd(){const t=F(null),e=F(),[n,r]=W();return{setContainerRef:et(o=>{t.current=o,e.current&&(e.current.disconnect(),e.current=void 0);const s=()=>{if(o){const a=window.getComputedStyle(o),c=h=>parseFloat(h)||0;r({width:Math.round(o.clientWidth-c(a.paddingLeft)-c(a.paddingRight)),height:Math.round(o.clientHeight-c(a.paddingTop)-c(a.paddingBottom))})}else r(void 0)};s(),o&&typeof ResizeObserver<"u"&&(e.current=new ResizeObserver(s),e.current.observe(o))},[]),containerRef:t,containerRect:n}}function Gr(){const t=F(),{setTimeout:e,clearTimeout:n}=Yr();return et((r,i)=>{n(t.current),t.current=e(r,i>0?i:0)},[e,n])}function wt(t){const e=F(t);return Zn(()=>{e.current=t}),et((...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function Wd(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function _s(t,e){return _t(()=>t==null&&e==null?null:n=>{Wd(t,n),Wd(e,n)},[t,e])}function G1(t,e=!1){const n=F();Zn(()=>{e&&n.current&&(n.current=!1,t())},[e,t]);const r=et(()=>{n.current=!0},[]),i=et(()=>{n.current=!1},[]);return{onFocus:r,onBlur:i}}function bs(){const[t,e]=W(!1);return Zn(()=>{e(window.getComputedStyle(window.document.documentElement).direction==="rtl")},[]),t}function X1(){const[t]=W({}),e=et((i,o)=>{var s;(s=t[i])===null||s===void 0||s.forEach(a=>{o.isPropagationStopped()||a(o)})},[t]),n=_t(()=>({onPointerDown:i=>e(wd,i),onPointerMove:i=>e(vd,i),onPointerUp:i=>e(_d,i),onPointerLeave:i=>e(bd,i),onPointerCancel:i=>e(xd,i),onKeyDown:i=>e(Cd,i),onKeyUp:i=>e(_1,i),onWheel:i=>e(kd,i)}),[e]),r=et((i,o)=>(t[i]||(t[i]=[]),t[i].unshift(o),()=>{const s=t[i];s&&s.splice(0,s.length,...s.filter(a=>a!==o))}),[t]);return{registerSensors:n,subscribeSensors:r}}function Kd(t,e){const n=F(0),r=Gr(),i=wt((...o)=>{n.current=Date.now(),t(o)});return et((...o)=>{r(()=>{i(o)},e-(Date.now()-n.current))},[e,i,r])}const xs=gs("slide"),Cs=gs("slide_image");function Z1({slide:t,offset:e,render:n,rect:r,imageFit:i,imageProps:o,onClick:s,onLoad:a,onError:c,style:h}){var l,f,m,g,_,v,x;const[b,k]=W(hs),{publish:S}=Kr(),{setTimeout:M}=Yr(),T=F(null);U(()=>{e===0&&S(y1(b))},[e,b,S]);const R=wt(q=>{("decode"in q?q.decode():Promise.resolve()).catch(()=>{}).then(()=>{q.parentNode&&(k(ps),M(()=>{a==null||a(q)},0))})}),N=et(q=>{T.current=q,q!=null&&q.complete&&R(q)},[R]),P=et(q=>{R(q.currentTarget)},[R]),I=wt(()=>{k(fs),c==null||c()}),D=A1(t,i),O=(q,Gt)=>Number.isFinite(q)?q:Gt,J=O(Math.max(...((f=(l=t.srcSet)===null||l===void 0?void 0:l.map(q=>q.width))!==null&&f!==void 0?f:[]).concat(t.width?[t.width]:[]).filter(Boolean)),((m=T.current)===null||m===void 0?void 0:m.naturalWidth)||0),at=O(Math.max(...((_=(g=t.srcSet)===null||g===void 0?void 0:g.map(q=>q.height))!==null&&_!==void 0?_:[]).concat(t.height?[t.height]:[]).filter(Boolean)),((v=T.current)===null||v===void 0?void 0:v.naturalHeight)||0),Tt=J&&at?{maxWidth:`min(${J}px, 100%)`,maxHeight:`min(${at}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},$=(x=t.srcSet)===null||x===void 0?void 0:x.sort((q,Gt)=>q.width-Gt.width).map(q=>`${q.src} ${q.width}w`).join(", "),ut=()=>r&&!D&&t.width&&t.height?r.height/t.height*t.width:Number.MAX_VALUE,z=$&&r&&Pd()?`${Math.round(Math.min(ut(),r.width))}px`:void 0,{style:nt,className:Ot,...Ht}=o||{};return B(tt,null,B("img",{ref:N,onLoad:P,onError:I,onClick:s,draggable:!1,className:ue(G(Cs()),D&&G(Cs("cover")),b!==ps&&G(Cs("loading")),Ot),style:{...Tt,...h,...nt},...Ht,alt:t.alt,sizes:z,srcSet:$,src:t.src}),b!==ps&&B("div",{className:G(xs(g1))},b===hs&&(n!=null&&n.iconLoading?n.iconLoading():B(K1,{className:ue(G(ms),G(xs(hs)))})),b===fs&&(n!=null&&n.iconError?n.iconError():B(q1,{className:ue(G(ms),G(xs(fs)))}))))}const J1=fe(function({className:e,children:n,...r},i){const o=F(null);return B(L1,{nodeRef:o},B("div",{ref:_s(i,o),className:ue(G("root"),e),...r},n))});var St;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL",t[t.ANIMATION=3]="ANIMATION"})(St||(St={}));function Q1(t,e,n,r,i){U(()=>Ad(t(wd,e),t(vd,n),t(_d,r),t(bd,r),t(xd,r)),[t,e,n,r,i])}var qt;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL"})(qt||(qt={}));const ks=30;function tw(t,e,n,r,i,o,s,a,c,h,l,f,m,g){const _=F(0),v=F([]),x=F(),b=F(0),k=F(qt.NONE),S=et(I=>{x.current===I.pointerId&&(x.current=void 0,k.current=qt.NONE);const D=v.current;D.splice(0,D.length,...D.filter(O=>O.pointerId!==I.pointerId))},[]),M=et(I=>{S(I),I.persist(),v.current.push(I)},[S]),T=wt(I=>{M(I)}),R=(I,D)=>h&&I>D||c&&I<-D,N=wt(I=>{if(v.current.find(D=>D.pointerId===I.pointerId)&&x.current===I.pointerId){const D=Date.now()-b.current,O=_.current;k.current===qt.SWIPE?Math.abs(O)>.3*n||Math.abs(O)>5&&D<r?s(O,D):a(O):k.current===qt.PULL&&(R(O,2*ks)?m(O,D):g(O)),_.current=0,k.current=qt.NONE}S(I)}),P=wt(I=>{const D=v.current.find(O=>O.pointerId===I.pointerId);if(D){const O=x.current===I.pointerId;if(I.buttons===0){O&&_.current!==0?N(I):S(D);return}const J=I.clientX-D.clientX,at=I.clientY-D.clientY;if(x.current===void 0){const Tt=$=>{M(I),x.current=I.pointerId,b.current=Date.now(),k.current=$};Math.abs(J)>Math.abs(at)&&Math.abs(J)>ks&&e(J)?(Tt(qt.SWIPE),i()):Math.abs(at)>Math.abs(J)&&R(at,ks)&&(Tt(qt.PULL),l())}else O&&(k.current===qt.SWIPE?(_.current=J,o(J)):k.current===qt.PULL&&(_.current=at,f(at)))}});Q1(t,T,P,N)}function ew({preventDefaultWheelX:t,preventDefaultWheelY:e}){const n=F(null),r=wt(i=>{const o=Math.abs(i.deltaX)>Math.abs(i.deltaY);(o&&t||!o&&e||i.ctrlKey)&&i.preventDefault()});return et(i=>{var o;i?i.addEventListener("wheel",r,{passive:!1}):(o=n.current)===null||o===void 0||o.removeEventListener("wheel",r),n.current=i},[r])}function nw(t,e,n,r,i,o,s,a,c){const h=F(0),l=F(0),f=F(),m=F(),g=F(0),_=F(),v=F(0),{setTimeout:x,clearTimeout:b}=Yr(),k=et(()=>{f.current&&(b(f.current),f.current=void 0)},[b]),S=et(()=>{m.current&&(b(m.current),m.current=void 0)},[b]),M=wt(()=>{t!==St.SWIPE&&(h.current=0,v.current=0,k(),S())});U(M,[t,M]);const T=wt(N=>{m.current=void 0,h.current===N&&c(h.current)}),R=wt(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const P=I=>{g.current=I,b(_.current),_.current=I>0?x(()=>{g.current=0,_.current=void 0},300):void 0};if(t===St.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){P(N.deltaX);return}if(!n(-N.deltaX))return;if(l.current+=N.deltaX,k(),Math.abs(l.current)>30)l.current=0,P(0),v.current=Date.now(),o();else{const I=l.current;f.current=x(()=>{f.current=void 0,I===l.current&&(l.current=0)},i)}}else if(t===St.SWIPE){let I=h.current-N.deltaX;if(I=Math.min(Math.abs(I),r)*Math.sign(I),h.current=I,s(I),S(),Math.abs(I)>.2*r){P(N.deltaX),a(I,Date.now()-v.current);return}m.current=x(()=>T(I),2*i)}else P(N.deltaX)});U(()=>e(kd,R),[e,R])}const qd=gs("container"),Yd=At(null),Jn=Le("useController","ControllerContext",Yd);function rw({children:t,...e}){var n;const{carousel:r,animation:i,controller:o,on:s,styles:a,render:c}=e,{closeOnPullUp:h,closeOnPullDown:l,preventDefaultWheelX:f,preventDefaultWheelY:m}=o,[g,_]=W(),v=qr(),x=F1(),[b,k]=W(St.NONE),S=F(0),M=F(0),T=F(1),{registerSensors:R,subscribeSensors:N}=X1(),{subscribe:P,publish:I}=Kr(),D=Gr(),O=Gr(),J=Gr(),{containerRef:at,setContainerRef:Tt,containerRect:$}=Hd(),ut=_s(ew({preventDefaultWheelX:f,preventDefaultWheelY:m}),Tt),z=F(null),nt=_s(z,void 0),{getOwnerDocument:Ot}=vs(),Ht=bs(),q=L=>(Ht?-1:1)*(typeof L=="number"?L:1),Gt=wt(()=>{var L;return(L=at.current)===null||L===void 0?void 0:L.focus()}),oi=wt(()=>e),mt=wt(()=>v),bt=et(L=>I(Ne,L),[I]),Fe=et(L=>I(De,L),[I]),we=et(()=>I(ln),[I]),fn=L=>!(r.finite&&(q(L)>0&&v.currentIndex===0||q(L)<0&&v.currentIndex===v.slides.length-1)),rr=L=>{var Q;S.current=L,(Q=at.current)===null||Q===void 0||Q.style.setProperty(Rt("swipe_offset"),`${Math.round(L)}px`)},pn=L=>{var Q,Ct;M.current=L,T.current=(()=>{const he=l&&L>0?L:h&&L<0?-L:0;return Math.min(Math.max(T1(1-he/60*(1-.5),2),.5),1)})(),(Q=at.current)===null||Q===void 0||Q.style.setProperty(Rt("pull_offset"),`${Math.round(L)}px`),(Ct=at.current)===null||Ct===void 0||Ct.style.setProperty(Rt("pull_opacity"),`${T.current}`)},{prepareAnimation:ve}=jd(z,(L,Q,Ct)=>{if(z.current&&$)return{keyframes:[{transform:`translate(0, ${L.rect.y-Q.y+Ct.y}px)`,opacity:L.opacity},{transform:"translate(0, 0)",opacity:1}],duration:L.duration,easing:i.easing.fade}}),mn=(L,Q)=>{if(h||l){pn(L);let Ct=0;z.current&&(Ct=i.fade*(Q?2:1),ve({rect:z.current.getBoundingClientRect(),opacity:T.current,duration:Ct})),J(()=>{pn(0),k(St.NONE)},Ct),k(St.ANIMATION),Q||we()}},{prepareAnimation:si,isAnimationPlaying:Hs}=jd(z,(L,Q,Ct)=>{var It;if(z.current&&$&&(!((It=v.animation)===null||It===void 0)&&It.duration)){const ct=Wr(r.spacing),he=(ct.percent?ct.percent*$.width/100:ct.pixel)||0;return{keyframes:[{transform:`translate(${q(v.globalIndex-L.index)*($.width+he)+L.rect.x-Q.x+Ct.x}px, 0)`},{transform:"translate(0, 0)"}],duration:v.animation.duration,easing:v.animation.easing}}}),_e=wt(L=>{var Q,Ct;const It=L.offset||0,ct=It?i.swipe:(Q=i.navigation)!==null&&Q!==void 0?Q:i.swipe,he=!It&&!Hs()?i.easing.navigation:i.easing.swipe;let{direction:gn}=L;const Ft=(Ct=L.count)!==null&&Ct!==void 0?Ct:1;let or=St.ANIMATION,p=ct*Ft;if(!gn){const d=$==null?void 0:$.width,y=L.duration||0,C=d?ct/d*Math.abs(It):ct;Ft!==0?(y<C?p=p/C*Math.max(y,C/5):d&&(p=ct/d*(d-Math.abs(It))),gn=q(It)>0?Ne:De):p=ct/2}let u=0;gn===Ne?fn(q(1))?u=-Ft:(or=St.NONE,p=ct):gn===De&&(fn(q(-1))?u=Ft:(or=St.NONE,p=ct)),p=Math.round(p),O(()=>{rr(0),k(St.NONE)},p),z.current&&si({rect:z.current.getBoundingClientRect(),index:v.globalIndex}),k(or),I(yd,{type:"swipe",increment:u,duration:p,easing:he})});U(()=>{var L,Q;!((L=v.animation)===null||L===void 0)&&L.increment&&(!((Q=v.animation)===null||Q===void 0)&&Q.duration)&&D(()=>x({type:"swipe",increment:0}),v.animation.duration)},[v.animation,x,D]);const de=[N,fn,($==null?void 0:$.width)||0,i.swipe,()=>k(St.SWIPE),L=>rr(L),(L,Q)=>_e({offset:L,duration:Q,count:1}),L=>_e({offset:L,count:0})],Ve=[()=>{l&&k(St.PULL)},L=>pn(L),L=>mn(L),L=>mn(L,!0)];tw(...de,h,l,...Ve),nw(b,...de);const ai=wt(()=>{o.focus&&Ot().querySelector(`.${G(ds)} .${G(qd())}`)&&Gt()});U(ai,[ai]);const ci=wt(()=>{var L;(L=s.view)===null||L===void 0||L.call(s,{index:v.currentIndex})});U(ci,[v.globalIndex,ci]),U(()=>Ad(P(Ne,L=>_e({direction:Ne,...L})),P(De,L=>_e({direction:De,...L})),P(yd,L=>x(L))),[P,_e,x]);const ir=_t(()=>({prev:bt,next:Fe,close:we,focus:Gt,slideRect:$?P1($,r.padding):{width:0,height:0},containerRect:$||{width:0,height:0},subscribeSensors:N,containerRef:at,setCarouselRef:nt,toolbarWidth:g,setToolbarWidth:_}),[bt,Fe,we,Gt,N,$,at,nt,g,_,r.padding]);return Cn(o.ref,()=>({prev:bt,next:Fe,close:we,focus:Gt,getLightboxProps:oi,getLightboxState:mt}),[bt,Fe,we,Gt,oi,mt]),B("div",{ref:ut,className:ue(G(qd()),G(md)),style:{...b===St.SWIPE?{[Rt("swipe_offset")]:`${Math.round(S.current)}px`}:null,...b===St.PULL?{[Rt("pull_offset")]:`${Math.round(M.current)}px`,[Rt("pull_opacity")]:`${T.current}`}:null,...o.touchAction!=="none"?{[Rt("controller_touch_action")]:o.touchAction}:null,...a.container},...o.aria?{role:"presentation","aria-live":"polite"}:null,tabIndex:-1,...R},$&&B(Yd.Provider,{value:ir},t,(n=c.controls)===null||n===void 0?void 0:n.call(c)))}const iw=Be(fd,rw);function Oe(t){return Yn(hd,t)}function Gd(t){return Yn("slide",t)}function ow({slide:t,offset:e}){const n=F(null),{currentIndex:r}=qr(),{slideRect:i,close:o,focus:s}=Jn(),{render:a,carousel:{imageFit:c,imageProps:h},on:{click:l},controller:{closeOnBackdropClick:f},styles:{slide:m}}=Gn(),{getOwnerDocument:g}=vs(),_=e!==0;U(()=>{var b;_&&(!((b=n.current)===null||b===void 0)&&b.contains(g().activeElement))&&s()},[_,s,g]);const v=()=>{var b,k,S,M;let T=(b=a.slide)===null||b===void 0?void 0:b.call(a,{slide:t,offset:e,rect:i});return!T&&Id(t)&&(T=B(Z1,{slide:t,offset:e,render:a,rect:i,imageFit:c,imageProps:h,onClick:_?void 0:()=>l==null?void 0:l({index:r})})),T?B(tt,null,(k=a.slideHeader)===null||k===void 0?void 0:k.call(a,{slide:t}),((S=a.slideContainer)!==null&&S!==void 0?S:({children:R})=>R)({slide:t,children:T}),(M=a.slideFooter)===null||M===void 0?void 0:M.call(a,{slide:t})):null},x=b=>{const k=n.current,S=b.target instanceof HTMLElement?b.target:void 0;f&&S&&k&&(S===k||Array.from(k.children).find(M=>M===S)&&S.classList.contains(G(v1)))&&o()};return B("div",{ref:n,className:ue(G(Gd()),!_&&G(Gd("current")),G(md)),...N1(_),onClick:x,style:m},v())}function sw(){const t=Gn().styles.slide;return B("div",{className:G("slide"),style:t})}function aw({carousel:t}){const{slides:e,currentIndex:n,globalIndex:r}=qr(),{setCarouselRef:i}=Jn(),o=Wr(t.spacing),s=Wr(t.padding),a=M1(t,e,1),c=[];if(Rd(e))for(let h=n-a;h<=n+a;h+=1){const l=Nd(e,h),f=r-n+h,m=t.finite&&(h<0||h>e.length-1);c.push(m?{key:f}:{key:[`${f}`,I1(l)].filter(Boolean).join("|"),offset:h-n,slide:l})}return B("div",{ref:i,className:ue(G(Oe()),c.length>0&&G(Oe("with_slides"))),style:{[`${Rt(Oe("slides_count"))}`]:c.length,[`${Rt(Oe("spacing_px"))}`]:o.pixel||0,[`${Rt(Oe("spacing_percent"))}`]:o.percent||0,[`${Rt(Oe("padding_px"))}`]:s.pixel||0,[`${Rt(Oe("padding_percent"))}`]:s.percent||0}},c.map(({key:h,slide:l,offset:f})=>l?B(ow,{key:h,slide:l,offset:f}):B(sw,{key:h})))}const cw=Be(hd,aw);function Xd(){const{carousel:t}=Gn(),{slides:e,currentIndex:n}=qr(),r=e.length===0||t.finite&&n===0,i=e.length===0||t.finite&&n===e.length-1;return{prevDisabled:r,nextDisabled:i}}function lw(t){var e;const n=bs(),{publish:r}=Kr(),{animation:i}=Gn(),{prevDisabled:o,nextDisabled:s}=Xd(),a=((e=i.navigation)!==null&&e!==void 0?e:i.swipe)/2,c=Kd(()=>r(Ne),a),h=Kd(()=>r(De),a),l=wt(f=>{switch(f.key){case b1:r(ln);break;case x1:(n?s:o)||(n?h:c)();break;case C1:(n?o:s)||(n?c:h)();break}});U(()=>t(Cd,l),[t,l])}function Zd({label:t,icon:e,renderIcon:n,action:r,onClick:i,disabled:o,style:s}){return B($d,{label:t,icon:e,renderIcon:n,className:G(`navigation_${r}`),disabled:o,onClick:i,style:s,...G1(Jn().focus,o)})}function uw({render:{buttonPrev:t,buttonNext:e,iconPrev:n,iconNext:r},styles:i}){const{prev:o,next:s,subscribeSensors:a}=Jn(),{prevDisabled:c,nextDisabled:h}=Xd();return lw(a),B(tt,null,t?t():B(Zd,{label:"Previous",action:Ne,icon:H1,renderIcon:n,style:i.navigationPrev,disabled:c,onClick:o}),e?e():B(Zd,{label:"Next",action:De,icon:W1,renderIcon:r,style:i.navigationNext,disabled:h,onClick:s}))}const dw=Be(f1,uw),Jd=G(w1),hw=G(gd);function fw(t){return"style"in t}function Qd(t,e,n){const r=window.getComputedStyle(t),i=n?"padding-left":"padding-right",o=n?r.paddingLeft:r.paddingRight,s=t.style.getPropertyValue(i);return t.style.setProperty(i,`${(Hr(o)||0)+e}px`),()=>{s?t.style.setProperty(i,s):t.style.removeProperty(i)}}function pw({noScroll:{disabled:t},children:e}){const n=bs(),{getOwnerDocument:r,getOwnerWindow:i}=vs();return U(()=>{if(t)return()=>{};const o=[],s=i(),{body:a,documentElement:c}=r(),h=Math.round(s.innerWidth-c.clientWidth);if(h>0){o.push(Qd(a,h,n));const l=a.getElementsByTagName("*");for(let f=0;f<l.length;f+=1){const m=l[f];fw(m)&&s.getComputedStyle(m).getPropertyValue("position")==="fixed"&&!m.classList.contains(hw)&&o.push(Qd(m,h,n))}}return a.classList.add(Jd),()=>{a.classList.remove(Jd),o.forEach(l=>l())}},[n,t,r,i]),B(tt,null,e)}const mw=Be(p1,pw);function th(t){return Yn(ds,t)}function eh(t,e,n){const r=t.getAttribute(e);return t.setAttribute(e,n),()=>{r?t.setAttribute(e,r):t.removeAttribute(e)}}function gw({children:t,animation:e,styles:n,className:r,on:i,portal:o,close:s}){const[a,c]=W(!1),[h,l]=W(!1),f=F([]),m=F(null),{setTimeout:g}=Yr(),{subscribe:_}=Kr(),x=zd()?0:e.fade;U(()=>(c(!0),()=>{c(!1),l(!1)}),[]);const b=wt(()=>{f.current.forEach(T=>T()),f.current=[]}),k=wt(()=>{var T;l(!1),b(),(T=i.exiting)===null||T===void 0||T.call(i),g(()=>{var R;(R=i.exited)===null||R===void 0||R.call(i),s()},x)});U(()=>_(ln,k),[_,k]);const S=wt(T=>{var R,N,P;T.scrollTop,l(!0),(R=i.entering)===null||R===void 0||R.call(i);const I=(P=(N=T.parentNode)===null||N===void 0?void 0:N.children)!==null&&P!==void 0?P:[];for(let D=0;D<I.length;D+=1){const O=I[D];["TEMPLATE","SCRIPT","STYLE"].indexOf(O.tagName)===-1&&O!==T&&(f.current.push(eh(O,"inert","")),f.current.push(eh(O,"aria-hidden","true")))}f.current.push(()=>{var D,O;(O=(D=m.current)===null||D===void 0?void 0:D.focus)===null||O===void 0||O.call(D)}),g(()=>{var D;(D=i.entered)===null||D===void 0||D.call(i)},x)}),M=et(T=>{T?S(T):b()},[S,b]);return a?Ai(B(J1,{ref:M,className:ue(r,G(th()),G(gd),h&&G(th("open"))),role:"presentation","aria-live":"polite",style:{...e.fade!==ws.animation.fade?{[Rt("fade_animation_duration")]:`${x}ms`}:null,...e.easing.fade!==ws.animation.easing.fade?{[Rt("fade_animation_timing_function")]:e.easing.fade}:null,...n.root},onFocus:T=>{m.current||(m.current=T.relatedTarget)}},t),o.root||document.body):null}const yw=Be(ds,gw);function ww({children:t}){return B(tt,null,t)}const vw=Be(m1,ww);function _w(t){return Yn(pd,t)}function bw({toolbar:{buttons:t},render:{buttonClose:e,iconClose:n},styles:r}){const{close:i,setToolbarWidth:o}=Jn(),{setContainerRef:s,containerRect:a}=Hd();Zn(()=>{o(a==null?void 0:a.width)},[o,a==null?void 0:a.width]);const c=()=>e?e():B($d,{key:ln,label:"Close",icon:j1,renderIcon:n,onClick:i});return B("div",{ref:s,style:r.toolbar,className:G(_w())},t==null?void 0:t.map(h=>h===ln?c():h))}const xw=Be(pd,bw);function nh(t,e){var n;return B(t.module.component,{key:t.module.name,...e},(n=t.children)===null||n===void 0?void 0:n.map(r=>nh(r,e)))}function Cw(t,e={}){const{easing:n,...r}=t,{easing:i,...o}=e;return{easing:{...n,...i},...r,...o}}function kw({carousel:t,animation:e,render:n,toolbar:r,controller:i,noScroll:o,on:s,plugins:a,slides:c,index:h,...l}){const{animation:f,carousel:m,render:g,toolbar:_,controller:v,noScroll:x,on:b,slides:k,index:S,plugins:M,...T}=ws,{config:R,augmentation:N}=D1([xt(yw,[xt(mw,[xt(iw,[xt(cw),xt(xw),xt(dw)])])])],a||M),P=N({animation:Cw(f,e),carousel:{...m,...t},render:{...g,...n},toolbar:{..._,...r},controller:{...v,...i},noScroll:{...x,...o},on:{...b,...s},...T,...l});return P.open?B(O1,{...P},B(U1,{slides:c||k,index:Hr(h||S)},B($1,null,B(B1,null,nh(xt(vw,R),P))))):null}const Ew=({attachment:t})=>{const e=async n=>{n.preventDefault();try{const r=await fetch(t.url);if(!r.ok)throw new Error("Download failed");const i=await r.blob(),o=URL.createObjectURL(i),s=document.createElement("a");s.href=o,s.download=t.name,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o)}catch{window.open(t.url,"_blank","noopener,noreferrer")}};return w("a",{href:t.url,onClick:e,className:"flex items-center gap-3 max-w-[240px] rounded-lg border border-gray-200 bg-white px-3 py-2 no-underline hover:bg-gray-50 transition-colors cursor-pointer dark:bg-neutral-800 dark:border-neutral-700 dark:hover:bg-neutral-700",children:[w(ls,{extension:jr(t.name),className:"w-8 h-9"}),w("div",{className:"min-w-0",children:[w("p",{className:"text-sm font-medium text-gray-800 dark:text-white truncate",children:t.name}),w("p",{className:"text-xs text-gray-500 dark:text-neutral-400",children:us(t.size)})]})]})},Sw=["png","jpg","jpeg","gif","webp"];function rh(t){return t.contentType?t.contentType.startsWith("image/"):Sw.includes(jr(t.name))}function ih(t){var e;return t.contentType?t.contentType==="image/gif":((e=t.name)==null?void 0:e.toLowerCase().endsWith(".gif"))??!1}const oh=({messageIndexKey:t,attachments:e})=>{const{setFullScreen:n}=Y(),[r,i]=W(!1),o=ft(Fh);function s(){if(o){const l=o.getElementById("deskcord-lightbox-portal");if(l)return l}const h=document.getElementById("deskcord-lightbox-portal");return h||document.body}const a=(e==null?void 0:e.filter(h=>rh(h)&&!ih(h)))??[];function c(){return a.length?w(kw,{open:r,portal:{root:s()},close:()=>{i(!1),n(!1)},slides:a.map(h=>({src:h.proxyURL}))}):null}return e!=null&&e.length?w("div",{children:[e.map((h,l)=>{const{proxyURL:f,width:m,height:g}=h;return rh(h)?ih(h)?w("div",{children:w("img",{src:f,alt:"GIF",className:`rounded-lg w-[${m}px] h-[${g}px] max-w-[200px] max-h-[200px] aspect-auto`})},`conv-cus-attachment-${t}-${l}`):w("div",{onClick:()=>{n(!0),i(!0)},className:"cursor-pointer",children:w("img",{src:f,alt:"Preview",className:`rounded-lg w-[${m}px] h-[${g}px] max-w-[200px] max-h-[200px] aspect-auto`})},`conv-cus-attachment-${t}-${l}`):w("div",{className:"mt-1",children:w(Ew,{attachment:h})},`conv-cus-attachment-${t}-${l}`)}),c()]},`conv-cus-attachment-${t}`):null},sh=({imageUrls:t,messageIndexKey:e})=>t.length?w("div",{className:"flex flex-col gap-1 mt-1",children:t.map((n,r)=>w("div",{className:"inline-block",children:w("img",{src:n,alt:"Inline image",className:"rounded-lg max-w-[200px] max-h-[200px] object-contain",loading:"lazy"})},`inline-img-${e}-${r}`))}):null,Tw=["tenor.com","giphy.com","imgur.com","gfycat.com","media.discordapp.net","cdn.discordapp.com","i.redd.it","i.imgur.com"],Aw=[".gif",".jpg",".jpeg",".png",".webp",".apng"];function Pw(t){try{const e=new URL(t),n=e.pathname.toLowerCase(),r=e.hostname.toLowerCase();for(const i of Aw)if(n.endsWith(i))return!0;for(const i of Tw)if(r===i||r.endsWith(`.${i}`))return!0;return!1}catch{return!1}}const Iw=/https?:\/\/[^\s<>]+/gi;function ah(t){if(!t)return{text:"",imageUrls:[]};const e=[];let n=t;const r=t.match(Iw);if(r)for(const i of r)Pw(i)&&(e.push(i),n=n.replace(i,""));return n=n.replace(/\s+/g," ").trim(),{text:n,imageUrls:e}}const Mw=({renderTimestamp:t,message:e,indexKey:n})=>{function r(s,a){const c=/<\w?:\w+:\d+>/g,h=s.split(c),l=s.match(c)??[],f=[];for(let m=0;m<h.length;m++)if(f.push(h[m]),l[m]){const g=a[l[m]];g&&f.push(w("img",{src:g.imageURL,alt:"",style:{display:"inline-block",width:"20px",height:"20px"}},m))}return f}const{text:i,imageUrls:o}=ah(e.content??"");return w("li",{className:"flex flex-col items-start max-w-lg gap-x-2 sm:gap-x-4 me-11",children:[i&&w("div",{style:{background:"linear-gradient(167deg, #27292A 0%, #404547 100%)"},className:"text-white text-sm min-w-10 inline-block rounded-lg px-3 py-2 shadow-sm",children:r(i,e.emojis??{})}),w(sh,{imageUrls:o,messageIndexKey:n}),w("div",{className:"flex flex-1",children:w(oh,{attachments:e.attachments,messageIndexKey:n})}),t&&w("div",{children:w("span",{className:"mt-1.5 flex items-center gap-x-1 text-xs text-gray-500",children:[e.authorName," ยท ",dd(e.date)," ",e.edited?"(edited)":""]})})]},`conv-cs-${n}`)},Rw=({message:t,indexKey:e})=>{const{text:n,imageUrls:r}=ah(t.content??"");return w("li",{className:`flex flex-col items-end ms-auto my-[3px] ${t.pending?"opacity-80":""}`,children:[n&&w("div",{className:"grow",children:w("div",{style:{background:"linear-gradient(167deg, var(--dc-primary) 0%, var(--dc-primary-mid) 100%)"},className:"min-w-10 inline-block rounded-lg px-3 py-2 shadow-sm",children:w("p",{className:"text-left text-sm text-white",children:n})})}),w(sh,{imageUrls:r,messageIndexKey:e}),t.attachments&&w("div",{className:"flex flex-1 justify-end",children:w(oh,{attachments:t.attachments,messageIndexKey:e})},`conv-cus-${e}-attachments`)]},`conv-cus-${e}`)},Nw=({message:t,indexKey:e})=>w("li",{className:"max-w-lg flex gap-x-2 sm:gap-x-4 me-11",children:w("div",{className:"bg-white border border-gray-200 rounded-2xl p-4 space-y-3 dark:bg-neutral-900 dark:border-neutral-700",children:w("p",{className:"mb-1.5 text-sm text-gray-800 dark:text-white",children:t.content})})},`conv-system-${e}`),Dw=()=>{const{setEmail:t,setUsername:e,username:n,email:r,token:i}=Y(),[o,s]=W(r),[a,c]=W(n),[h,l]=W(""),[f,m]=W(!1),g=b=>/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(b),_=!!n&&!!r,v=b=>{if(b.preventDefault(),!!a.trim()){if(!g(o)){l("Please enter a valid email address");return}f||(m(!0),l(""),t(o),e(a))}};function x(){return w("form",{onSubmit:v,className:"w-full space-y-4",children:[w("div",{className:"mb-4",children:[w("h3",{className:"text-base font-semibold text-gray-900 mb-1",children:"Let's get started"}),w("p",{className:"text-sm text-gray-600",children:"Tell us a bit about yourself so we can assist you better."})]}),w("div",{children:[w("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-2",children:"Your name"}),w("div",{className:"relative",children:[w("div",{className:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5",children:w(Gg,{size:18,className:"text-gray-400"})}),w("input",{type:"text",id:"name",value:a,onChange:b=>c(b.target.value),name:"name",className:"py-2.5 px-4 ps-11 block w-full bg-white border border-gray-300 rounded-lg text-base md:text-sm text-gray-900 placeholder-gray-500 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-[var(--dc-primary)] focus:ring-opacity-50 focus:border-transparent disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed",placeholder:"John Smith",disabled:_,required:!0})]})]}),w("div",{children:[w("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-2",children:"Email address"}),w("div",{className:"relative",children:[w("div",{className:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5",children:w(Hg,{size:18,className:"text-gray-400"})}),w("input",{type:"email",id:"email",value:o,onChange:b=>{s(b.target.value),h&&l("")},name:"email",className:`py-2.5 px-4 ps-11 block w-full bg-white rounded-lg text-base md:text-sm text-gray-900 placeholder-gray-500 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-opacity-50 focus:border-transparent disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed border ${h?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-[var(--dc-primary)]"}`,placeholder:"you@example.com",disabled:_,required:!0})]}),h&&w("p",{className:"text-red-600 text-sm mt-2 flex items-center gap-1",children:[w("span",{className:"inline-block w-1 h-1 bg-red-600 rounded-full"}),h]})]}),w("p",{className:"text-xs text-gray-500 text-center",children:"We'll never share your information"}),!n||!r?w("button",{type:"submit",className:"w-full py-2.5 px-4 bg-[var(--dc-primary)] hover:bg-[var(--dc-primary-mid)] text-white font-medium text-sm rounded-lg transition-all duration-200 transform hover:shadow-md active:scale-95 focus:outline-none focus:ring-2 focus:ring-[var(--dc-primary)] focus:ring-opacity-50 disabled:opacity-50 disabled:cursor-not-allowed",disabled:f,children:"Start Chatting"}):null]})}return w(tt,{children:[w("li",{className:`max-w-lg flex gap-x-2 sm:gap-x-4 me-11 ${i?"opacity-75":""}`,children:w("div",{className:"w-full rounded-xl p-5 bg-white shadow-lg border border-gray-100 overflow-hidden",children:x()})}),n&&r&&w("li",{className:"flex ms-auto my-4 animate-slide-in",style:{marginTop:"1rem"},children:w("div",{className:"grow",children:w("div",{style:{background:"linear-gradient(167deg, var(--dc-primary) 0%, var(--dc-primary-mid) 100%)"},className:"min-w-10 inline-block rounded-lg px-4 py-2 shadow-sm flex items-center gap-2",children:[w(zg,{size:16,className:"text-white flex-shrink-0"}),w("p",{className:"text-sm text-white font-medium",children:["Nice to meet you, ",w("span",{className:"font-semibold",children:n}),"! Feel free to ask us anything."]})]})})})]})};function Lw(t,e){const n=F();U(()=>{n.current=t},[t]),U(()=>{function r(){var i;(i=n==null?void 0:n.current)==null||i.call(n)}if(e!==null){const i=setInterval(r,e);return()=>clearInterval(i)}},[e])}const Bw=({indexKey:t,message:e})=>{const n=e.customRendererProps.file,r=n.status==="error",[i,o]=W(!0),[s,a]=W(0);return Lw(()=>{s<88?a(s+2.5):o(!1)},i&&!r?250:null),w("li",{className:"max-w-lg flex gap-x-2 sm:gap-x-4",style:{marginTop:"20px",marginBottom:"20px"},children:w("div",{className:"w-full bg-white border border-gray-200 rounded-2xl p-4 space-y-4",children:w("div",{children:[w("div",{className:"mb-2 flex justify-between items-center",children:[w("div",{className:"flex items-center gap-x-3",children:[w(ls,{extension:jr(n.fileName),className:"size-9",iconColorClassName:r?"text-red-300":void 0}),w("div",{children:[w("p",{className:`text-sm ${r?"font-semibold text-red-500":"font-medium text-gray-800"}`,children:n.fileName}),w("p",{className:"text-xs text-gray-500 dark:text-neutral-500",children:us(n.size)})]})]}),r&&w("div",{className:"inline-flex items-center gap-x-2",children:w("span",{className:"relative",children:[w("svg",{className:"shrink-0 size-4 text-red-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16",children:w("path",{d:"M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"})}),w("span",{className:"sr-only",children:"Danger"})]})})]}),w("div",{className:"flex items-center gap-x-3 whitespace-nowrap",children:[w("div",{className:"flex w-full h-2 bg-gray-200 rounded-full overflow-hidden dark:bg-neutral-700",role:"progressbar",children:w("div",{className:`flex flex-col justify-center rounded-full overflow-hidden ${r?"bg-red-500":"bg-blue-600"} text-xs text-white text-center whitespace-nowrap transition duration-500 dark:bg-blue-500`,style:{width:`${s}%`}})}),w("div",{className:"w-6 text-end",children:w("span",{className:"text-sm text-gray-800 dark:text-white",children:[Math.round(s),"%"]})})]})]})})},`conv-fileupload-${t}`)},Ow=({conversation:t,open:e})=>{const n=F(!1),{isChatOpen:r}=Y();U(()=>{r?n.current=!0:n.current=!1},[r]);function i(c,h){const l=`${c.date}-${h}`;let f;if(typeof c.customRenderer<"u")switch(c.customRenderer){case cn.IntroduceYourself:f=w(Dw,{});break;case cn.UploadFile:f=w(Bw,{message:c,indexKey:l});break;default:f=a(c,l)}else c.authorName===qn?f=a(c,l):c.support?f=o(c,l):f=s(c,l);return r&&(c.pending??(c.support&&n.current))?w(Qt.li,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},children:f},l):w("li",{children:f},l)}function o(c,h){var g;const l=(g=t==null?void 0:t.messages)==null?void 0:g.filter(_=>_.support),f=l==null?void 0:l[l.length-1],m=c.date===(f==null?void 0:f.date);return w(Mw,{renderTimestamp:m,message:c,indexKey:h})}function s(c,h){return w(Rw,{message:c,indexKey:h})}function a(c,h){return w(Nw,{message:c,indexKey:h})}return w("ul",{className:"space-y-[3px]",children:[[...(t==null?void 0:t.messages)??[]].sort((c,h)=>c.date-h.date).map(i),t&&!e&&i(e1,1)]})},Fw={duration:.9,repeat:1/0,ease:"easeInOut"},Vw=({authorName:t,visible:e})=>w("div",{className:`flex items-center gap-2 px-4 py-1.5 bg-white dark:bg-neutral-900 transition-opacity duration-150 ${e?"opacity-100":"opacity-0 pointer-events-none"}`,role:"status","aria-hidden":!e,"aria-label":e?`${t} is typing`:void 0,children:[w("span",{className:"inline-flex items-center gap-1",children:[0,1,2].map(n=>w(Qt.span,{className:"block w-1.5 h-1.5 rounded-full bg-gray-400 dark:bg-neutral-500",animate:e?{y:[0,-3,0]}:{y:0},transition:e?{...Fw,delay:n*.15}:void 0},n))}),w("span",{className:"text-xs text-gray-500 dark:text-neutral-400",children:[w("span",{className:"font-semibold text-gray-700 dark:text-neutral-200",children:t})," ","is typing..."]})]}),Uw=()=>{var Tt;const{getConversation:t,addMessage:e,tempConversationToThread:n,username:r,email:i,updateMessage:o,isChatOpen:s,typingByThread:a}=Y(),c=!!(r&&i),h=F(!1);U(()=>{s&&!h.current&&(h.current=!0),s||(h.current=!1)},[s]);const[l,f]=W(!1),[m,g]=W([]),[_,v]=W({}),x=t(),b=(x==null?void 0:x.status)==="open",[k,S]=W(""),[M,T]=W(!1),R=F(null),N=()=>{T(!0),R.current!==null&&clearTimeout(R.current),R.current=window.setTimeout(()=>{T(!1),R.current=null},800)};U(()=>()=>{R.current!==null&&clearTimeout(R.current)},[]);const P=!!(x&&a[x.threadId]),I=[...(x==null?void 0:x.messages)??[]].filter($=>$.support&&$.authorName).sort(($,ut)=>ut.date-$.date)[0],D=((Tt=x==null?void 0:x.csMember)==null?void 0:Tt.displayName)??(I==null?void 0:I.authorName)??"Support";U(()=>{const $={};m.forEach(ut=>{if(!ut.type.startsWith("image/")){$[ut.name]={url:"",width:0,height:0,size:ut.size},v({...$});return}const z=new FileReader;z.addEventListener("load",function(){const nt=new Image;nt.onload=()=>{$[ut.name]={url:z.result,width:nt.width,height:nt.height,size:ut.size},v({...$})},nt.src=z.result},!1),z.readAsDataURL(ut)})},[m]);const O=$=>{S(ut=>ut+$)},J=async()=>{const $=Date.now(),ut={support:!1,content:k,date:$,authorName:r,pending:!0};if(k.trim()!==""){S(""),e(x?x.threadId:"TEMP",ut);const z=await t1({content:k});z&&((!x||x.threadId==="TEMP")&&n(z.threadId),o(z.threadId,$,{...ut,pending:!1,date:z.date}))}},at=s&&!h.current;return w(tt,{children:[w("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 flex flex-col-reverse space-y-4 space-y-reverse dc-scroll ${M?"dc-scroll--active":""}`,onScroll:N,children:w(Qt.div,{initial:at?{opacity:0,x:20}:!1,animate:{opacity:1,x:0},transition:{duration:.3,ease:"easeOut",delay:.1},children:w(Ow,{conversation:x,open:b})})}),w(Vw,{authorName:D,visible:P}),w("div",{className:(x==null?void 0:x.status)==="closed"?"":"border-t border-t-gray-200 dark:border-neutral-800",children:w(h1,{attachmentPreviews:_,files:m,setFiles:g,inputMessage:k,setInputMessage:S,showEmojiPicker:l,setShowEmojiPicker:f,addEmoji:O,sendMessage:J,disabled:!c})})]})};function Es(t,e){switch(t){case"online":return e==="text"?"text-teal-600":"bg-teal-400";case"idle":return e==="text"?"text-yellow-600":"bg-yellow-400";case"dnd":return e==="text"?"text-red-600":"bg-red-400";case"offline":case"invisible":return e==="text"?"text-black":"bg-gray-400";default:return e==="text"?"text-black":"bg-gray-400"}}function $w(t){switch(t){case"online":return"Online";case"idle":case"offline":case"invisible":return"Away";case"dnd":return"Unavailable";default:return"Away"}}const ee=Object.create(null);ee.open="0",ee.close="1",ee.ping="2",ee.pong="3",ee.message="4",ee.upgrade="5",ee.noop="6";const Xr=Object.create(null);Object.keys(ee).forEach(t=>{Xr[ee[t]]=t});const Ss={type:"error",data:"parser error"},ch=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",lh=typeof ArrayBuffer=="function",uh=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Ts=({type:t,data:e},n,r)=>ch&&e instanceof Blob?n?r(e):dh(e,r):lh&&(e instanceof ArrayBuffer||uh(e))?n?r(e):dh(new Blob([e]),r):r(ee[t]+(e||"")),dh=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function hh(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let As;function zw(t,e){if(ch&&t.data instanceof Blob)return t.data.arrayBuffer().then(hh).then(e);if(lh&&(t.data instanceof ArrayBuffer||uh(t.data)))return e(hh(t.data));Ts(t,!1,n=>{As||(As=new TextEncoder),e(As.encode(n))})}const fh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<fh.length;t++)Qn[fh.charCodeAt(t)]=t;const jw=t=>{let e=t.length*.75,n=t.length,r,i=0,o,s,a,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const h=new ArrayBuffer(e),l=new Uint8Array(h);for(r=0;r<n;r+=4)o=Qn[t.charCodeAt(r)],s=Qn[t.charCodeAt(r+1)],a=Qn[t.charCodeAt(r+2)],c=Qn[t.charCodeAt(r+3)],l[i++]=o<<2|s>>4,l[i++]=(s&15)<<4|a>>2,l[i++]=(a&3)<<6|c&63;return h},Hw=typeof ArrayBuffer=="function",Ps=(t,e)=>{if(typeof t!="string")return{type:"message",data:ph(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:Ww(t.substring(1),e)}:Xr[n]?t.length>1?{type:Xr[n],data:t.substring(1)}:{type:Xr[n]}:Ss},Ww=(t,e)=>{if(Hw){const n=jw(t);return ph(n,e)}else return{base64:!0,data:t}},ph=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},mh="",Kw=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,s)=>{Ts(o,!1,a=>{r[s]=a,++i===n&&e(r.join(mh))})})},qw=(t,e)=>{const n=t.split(mh),r=[];for(let i=0;i<n.length;i++){const o=Ps(n[i],e);if(r.push(o),o.type==="error")break}return r};function Yw(){return new TransformStream({transform(t,e){zw(t,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let Is;function Zr(t){return t.reduce((e,n)=>e+n.length,0)}function Jr(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;i<e;i++)n[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function Gw(t,e){Is||(Is=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(r===0){if(Zr(n)<1)break;const c=Jr(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Zr(n)<2)break;const c=Jr(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Zr(n)<8)break;const c=Jr(n,8),h=new DataView(c.buffer,c.byteOffset,c.length),l=h.getUint32(0);if(l>Math.pow(2,21)-1){a.enqueue(Ss);break}i=l*Math.pow(2,32)+h.getUint32(4),r=3}else{if(Zr(n)<i)break;const c=Jr(n,i);a.enqueue(Ps(o?c:Is.decode(c),e)),r=0}if(i===0||i>t){a.enqueue(Ss);break}}}})}const gh=4;function vt(t){if(t)return Xw(t)}function Xw(t){for(var e in vt.prototype)t[e]=vt.prototype[e];return t}vt.prototype.on=vt.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},vt.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},vt.prototype.off=vt.prototype.removeListener=vt.prototype.removeAllListeners=vt.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this},vt.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this},vt.prototype.emitReserved=vt.prototype.emit,vt.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},vt.prototype.hasListeners=function(t){return!!this.listeners(t).length};const zt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function yh(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const Zw=zt.setTimeout,Jw=zt.clearTimeout;function Qr(t,e){e.useNativeTimers?(t.setTimeoutFn=Zw.bind(zt),t.clearTimeoutFn=Jw.bind(zt)):(t.setTimeoutFn=zt.setTimeout.bind(zt),t.clearTimeoutFn=zt.clearTimeout.bind(zt))}const Qw=1.33;function tv(t){return typeof t=="string"?ev(t):Math.ceil((t.byteLength||t.size)*Qw)}function ev(t){let e=0,n=0;for(let r=0,i=t.length;r<i;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function nv(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function rv(t){let e={},n=t.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class iv extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Ms extends vt{constructor(e){super(),this.writable=!1,Qr(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new iv(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=Ps(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=nv(e);return n.length?"?"+n:""}}const wh="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Rs=64,ov={};let vh=0,ti=0,_h;function bh(t){let e="";do e=wh[t%Rs]+e,t=Math.floor(t/Rs);while(t>0);return e}function xh(){const t=bh(+new Date);return t!==_h?(vh=0,_h=t):t+"."+bh(vh++)}for(;ti<Rs;ti++)ov[wh[ti]]=ti;let Ch=!1;try{Ch=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const sv=Ch;function kh(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||sv))return new XMLHttpRequest}catch{}if(!e)try{return new zt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function O_(){}function av(){}const cv=function(){return new kh({xdomain:!1}).responseType!=null}();class lv extends Ms{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let i=location.port;i||(i=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}const n=e&&e.forceBase64;this.supportsBinary=cv&&!n,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};qw(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Kw(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=xh()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ne(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class ne extends vt{constructor(e,n){super(),Qr(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.data=n.data!==void 0?n.data:null,this.create()}create(){var e;const n=yh(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new kh(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=ne.requestsCount++,ne.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=av,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ne.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(ne.requestsCount=0,ne.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Eh);else if(typeof addEventListener=="function"){const t="onpagehide"in zt?"pagehide":"unload";addEventListener(t,Eh,!1)}}function Eh(){for(let t in ne.requests)ne.requests.hasOwnProperty(t)&&ne.requests[t].abort()}var uv={},ei={};ei.byteLength=fv,ei.toByteArray=mv,ei.fromByteArray=wv;for(var re=[],jt=[],dv=typeof Uint8Array<"u"?Uint8Array:Array,Ns="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dn=0,hv=Ns.length;dn<hv;++dn)re[dn]=Ns[dn],jt[Ns.charCodeAt(dn)]=dn;jt[45]=62,jt[95]=63;function Sh(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function fv(t){var e=Sh(t),n=e[0],r=e[1];return(n+r)*3/4-r}function pv(t,e,n){return(e+n)*3/4-n}function mv(t){var e,n=Sh(t),r=n[0],i=n[1],o=new dv(pv(t,r,i)),s=0,a=i>0?r-4:r,c;for(c=0;c<a;c+=4)e=jt[t.charCodeAt(c)]<<18|jt[t.charCodeAt(c+1)]<<12|jt[t.charCodeAt(c+2)]<<6|jt[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=jt[t.charCodeAt(c)]<<2|jt[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=jt[t.charCodeAt(c)]<<10|jt[t.charCodeAt(c+1)]<<4|jt[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function gv(t){return re[t>>18&63]+re[t>>12&63]+re[t>>6&63]+re[t&63]}function yv(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(gv(r));return i.join("")}function wv(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;s<a;s+=o)i.push(yv(t,s,s+o>a?a:s+o));return r===1?(e=t[n-1],i.push(re[e>>2]+re[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(re[e>>10]+re[e>>4&63]+re[e<<2&63]+"=")),i.join("")}var Ds={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Ds.read=function(t,e,n,r,i){var o,s,a=i*8-r-1,c=(1<<a)-1,h=c>>1,l=-7,f=n?i-1:0,m=n?-1:1,g=t[e+f];for(f+=m,o=g&(1<<-l)-1,g>>=-l,l+=a;l>0;o=o*256+t[e+f],f+=m,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=s*256+t[e+f],f+=m,l-=8);if(o===0)o=1-h;else{if(o===c)return s?NaN:(g?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-h}return(g?-1:1)*s*Math.pow(2,o-r)},Ds.write=function(t,e,n,r,i,o){var s,a,c,h=o*8-i-1,l=(1<<h)-1,f=l>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=r?0:o-1,_=r?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+f>=1?e+=m/c:e+=m*Math.pow(2,1-f),e*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(e*c-1)*Math.pow(2,i),s=s+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+g]=a&255,g+=_,a/=256,i-=8);for(s=s<<i|a,h+=i;h>0;t[n+g]=s&255,g+=_,s/=256,h-=8);t[n+g-_]|=v*128};/*!
100
+ `)):(P.preventDefault(),T()))};return w("div",{className:"relative",children:[!v&&s&&w(a1,{onPickEmoji:a}),!v&&(()=>{if(!(o!=null&&o.length))return null;const P=o.map((I,D)=>{if(!h[I.name])return null;const O=()=>{var $;i(o.filter(ut=>ut.name!==I.name)),($=_.current)==null||$.clear()};if(!I.type.startsWith("image/"))return w(u1,{onDelete:O,fileName:I.name,size:I.size},`attachment-preview-${D}`);const{url:J,width:at,height:Tt}=h[I.name];return w(l1,{onDelete:O,fileName:I.name,width:at,height:Tt,imageUrl:J},`attachment-preview-${D}`)});return w("div",{className:"m-2",children:P})})(),!v&&w("div",{className:"flex items-start gap-2 p-2 bg-white dark:bg-neutral-900",children:[w("textarea",{id:"hs-textarea-ex-1",disabled:x,value:e,onChange:P=>n(P.target.value),onKeyDown:R,className:"flex-1 p-3 block text-base md:text-sm outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:text-neutral-400 dark:placeholder-neutral-500 resize-none min-h-[55px] max-h-[200px] overflow-y-auto",placeholder:l?"Please introduce yourself first...":"Ask us anything!","data-hs-textarea-auto-height":""}),w("button",{type:"button",disabled:x,onClick:()=>T(),style:{background:x?"#9CA3AF":"linear-gradient(167deg, var(--dc-primary) 0%, var(--dc-primary-mid) 100%)"},"aria-label":"Send message",className:"inline-flex shrink-0 justify-center items-center w-[33px] h-[33px] rounded-lg text-white transform transition-transform duration-150 hover:scale-105 active:scale-95 disabled:opacity-50 disabled:pointer-events-none disabled:transform-none",children:w(s1,{size:16})})]}),w("div",{className:"flex items-center justify-between px-2 py-1.5 bg-white dark:bg-neutral-900",children:[w("div",{className:"flex items-center gap-1",children:!v&&w(tt,{children:[w("div",{className:"inline-flex shrink-0 justify-center items-center size-8 rounded-lg text-gray-500 hover:bg-gray-100 focus:z-10 focus:outline-none focus:bg-gray-100 dark:text-neutral-500 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800 transition-colors duration-150",children:w(o1,{ref:_,accept:ud.join(","),maxSize:10*1024*1024,uploadConfig:{url:`${Bt.domain}/conversations/uploadAttachment`,method:"POST",headers:{Authorization:`Bearer ${g}`}},onUploadComplete:b,onUploadStart:k,onFileSelect:S})}),w("button",{type:"button",disabled:x,onClick:x?void 0:()=>c(!s),"aria-label":"Open emoji picker",className:"inline-flex shrink-0 justify-center items-center size-8 rounded-lg text-gray-500 hover:bg-gray-100 focus:z-10 focus:outline-none focus:bg-gray-100 dark:text-neutral-500 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800 disabled:opacity-50 disabled:pointer-events-none transition-colors duration-150",children:w(Yg,{size:16})})]})}),w("a",{href:"https://deskcord.chat",target:"_blank",rel:"noopener noreferrer","aria-label":"Powered by Deskcord",className:"flex items-center gap-1 text-[10px] text-gray-400 hover:text-gray-600 dark:text-neutral-600 dark:hover:text-neutral-400 transition-colors duration-200 no-underline",children:[w("span",{children:"Powered by"}),w(d1,{className:"h-[10px] w-auto"})]})]})]})},dd=t=>{const e=Date.now(),n=Math.floor((e-t)/1e3);return n<60?"Just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`},hd="carousel",fd="controller",f1="navigation",p1="no-scroll",ds="portal",m1="root",pd="toolbar",hs="loading",fs="error",ps="complete",g1="placeholder",y1=t=>`active-slide-${t}`,md="flex_center",w1="no_scroll",gd="no_scroll_padding",v1="slide_wrapper",Ne="prev",De="next",yd="swipe",ln="close",wd="onPointerDown",vd="onPointerMove",_d="onPointerUp",bd="onPointerLeave",xd="onPointerCancel",Cd="onKeyDown",_1="onKeyUp",kd="onWheel",b1="Escape",x1="ArrowLeft",C1="ArrowRight",k1="button",ms="icon",Ed="contain",Sd="cover",E1="Unknown action type",Td="yarl__";function ue(...t){return[...t].filter(Boolean).join(" ")}function G(t){return`${Td}${t}`}function Rt(t){return`--${Td}${t}`}function Yn(t,e){return`${t}${e?`_${e}`:""}`}function gs(t){return e=>Yn(t,e)}function S1(t,e){var n;return(n=t==null?void 0:t[e])!==null&&n!==void 0?n:e}function Ad(...t){return()=>{t.forEach(e=>{e()})}}function Le(t,e,n){return()=>{const r=ft(n);if(!r)throw new Error(`${t} must be used within a ${e}.Provider`);return r}}function Pd(){return typeof window<"u"}function T1(t,e=0){const n=10**e;return Math.round((t+Number.EPSILON)*n)/n}function Id(t){return t.type===void 0||t.type==="image"}function A1(t,e){return t.imageFit===Sd||t.imageFit!==Ed&&e===Sd}function Hr(t){return typeof t=="string"?Number.parseInt(t,10):t}function Wr(t){if(typeof t=="number")return{pixel:t};if(typeof t=="string"){const e=Hr(t);return t.endsWith("%")?{percent:e}:{pixel:e}}return{pixel:0}}function P1(t,e){const n=Wr(e),r=n.percent!==void 0?t.width/100*n.percent:n.pixel;return{width:Math.max(t.width-2*r,0),height:Math.max(t.height-2*r,0)}}function Md(t,e){return e>0?(t%e+e)%e:0}function Rd(t){return t.length>0}function Nd(t,e){return t[Md(e,t.length)]}function ys(t,e){return Rd(t)?Nd(t,e):void 0}function I1(t){return Id(t)?t.src:void 0}function M1(t,e,n=0){return Math.min(t.preload,Math.max(t.finite?e.length-1:Math.floor(e.length/2),n))}const R1=Number(Da.split(".")[0])>=19;function N1(t){return{inert:R1?t:t?"":void 0}}const ws={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[ln]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:Ed,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,preventDefaultWheelX:!0,preventDefaultWheelY:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function Be(t,e){return{name:t,component:e}}function xt(t,e){return{module:t,children:e}}function Dd(t,e,n){return t.module.name===e?n(t):t.children?[xt(t.module,t.children.flatMap(r=>{var i;return(i=Dd(r,e,n))!==null&&i!==void 0?i:[]}))]:[t]}function un(t,e,n){return t.flatMap(r=>{var i;return(i=Dd(r,e,n))!==null&&i!==void 0?i:[]})}function D1(t,e=[],n=[]){let r=t;const i=g=>{const _=[...r];for(;_.length>0;){const v=_.pop();if((v==null?void 0:v.module.name)===g)return!0;v!=null&&v.children&&_.push(...v.children)}return!1},o=(g,_)=>{if(g===""){r=[xt(_,r)];return}r=un(r,g,v=>[xt(_,[v])])},s=(g,_)=>{r=un(r,g,v=>[xt(v.module,[xt(_,v.children)])])},a=(g,_,v)=>{r=un(r,g,x=>{var b;return[xt(x.module,[...v?[xt(_)]:[],...(b=x.children)!==null&&b!==void 0?b:[],...v?[]:[xt(_)]])]})},c=(g,_,v)=>{r=un(r,g,x=>[...v?[xt(_)]:[],x,...v?[]:[xt(_)]])},h=g=>{s(fd,g)},l=(g,_)=>{r=un(r,g,v=>[xt(_,v.children)])},f=g=>{r=un(r,g,_=>_.children)},m=g=>{n.push(g)};return e.forEach(g=>{g({contains:i,addParent:o,append:s,addChild:a,addSibling:c,addModule:h,replace:l,remove:f,augment:m})}),{config:r,augmentation:g=>n.reduce((_,v)=>v(_),g)}}const Ld=At(null),vs=Le("useDocument","DocumentContext",Ld);function L1({nodeRef:t,children:e}){const n=_t(()=>{const r=o=>{var s;return((s=o||t.current)===null||s===void 0?void 0:s.ownerDocument)||document};return{getOwnerDocument:r,getOwnerWindow:o=>{var s;return((s=r(o))===null||s===void 0?void 0:s.defaultView)||window}}},[t]);return B(Ld.Provider,{value:n},e)}const Bd=At(null),Kr=Le("useEvents","EventsContext",Bd);function B1({children:t}){const[e]=W({});U(()=>()=>{Object.keys(e).forEach(r=>delete e[r])},[e]);const n=_t(()=>{const r=(s,a)=>{var c;(c=e[s])===null||c===void 0||c.splice(0,e[s].length,...e[s].filter(h=>h!==a))};return{publish:(...[s,a])=>{var c;(c=e[s])===null||c===void 0||c.forEach(h=>h(a))},subscribe:(s,a)=>(e[s]||(e[s]=[]),e[s].push(a),()=>r(s,a)),unsubscribe:r}},[e]);return B(Bd.Provider,{value:n},t)}const Od=At(null),Gn=Le("useLightboxProps","LightboxPropsContext",Od);function O1({children:t,...e}){return B(Od.Provider,{value:e},t)}const Fd=At(null),qr=Le("useLightboxState","LightboxStateContext",Fd),Vd=At(null),F1=Le("useLightboxDispatch","LightboxDispatchContext",Vd);function V1(t,e){switch(e.type){case"swipe":{const{slides:n}=t,r=(e==null?void 0:e.increment)||0,i=t.globalIndex+r,o=Md(i,n.length),s=ys(n,o),a=r||e.duration?{increment:r,duration:e.duration,easing:e.easing}:void 0;return{slides:n,currentIndex:o,globalIndex:i,currentSlide:s,animation:a}}case"update":return e.slides!==t.slides||e.index!==t.currentIndex?{slides:e.slides,currentIndex:e.index,globalIndex:e.index,currentSlide:ys(e.slides,e.index)}:t;default:throw new Error(E1)}}function U1({slides:t,index:e,children:n}){const[r,i]=xn(V1,{slides:t,currentIndex:e,globalIndex:e,currentSlide:ys(t,e)});U(()=>{i({type:"update",slides:t,index:e})},[t,e]);const o=_t(()=>({...r,state:r,dispatch:i}),[r,i]);return B(Vd.Provider,{value:i},B(Fd.Provider,{value:o},n))}const Ud=At(null),Yr=Le("useTimeouts","TimeoutsContext",Ud);function $1({children:t}){const[e]=W([]);U(()=>()=>{e.forEach(r=>window.clearTimeout(r)),e.splice(0,e.length)},[e]);const n=_t(()=>{const r=s=>{e.splice(0,e.length,...e.filter(a=>a!==s))};return{setTimeout:(s,a)=>{const c=window.setTimeout(()=>{r(c),s()},a);return e.push(c),c},clearTimeout:s=>{s!==void 0&&(r(s),window.clearTimeout(s))}}},[e]);return B(Ud.Provider,{value:n},t)}const $d=fe(function({label:e,className:n,icon:r,renderIcon:i,onClick:o,style:s,...a},c){const{styles:h,labels:l}=Gn(),f=S1(l,e);return B("button",{ref:c,type:"button",title:f,"aria-label":f,className:ue(G(k1),n),onClick:o,style:{...s,...h.button},...a},i?i():B(r,{className:G(ms),style:h.icon}))});function z1(t,e){const n=r=>B("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...r},e);return n.displayName=t,n}function Xn(t,e){return z1(t,B("g",{fill:"currentColor"},B("path",{d:"M0 0h24v24H0z",fill:"none"}),e))}const j1=Xn("Close",B("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),H1=Xn("Previous",B("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),W1=Xn("Next",B("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),K1=Xn("Loading",B(tt,null,Array.from({length:8}).map((t,e,n)=>B("line",{key:e,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/n.length*(e+1),transform:`rotate(${360/n.length*e}, 12, 12)`})))),q1=Xn("Error",B("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),Zn=Pd()?ae:U;function zd(){const[t,e]=W(!1);return U(()=>{var n,r;const i=(n=window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-reduced-motion: reduce)");e(i==null?void 0:i.matches);const o=s=>e(s.matches);return(r=i==null?void 0:i.addEventListener)===null||r===void 0||r.call(i,"change",o),()=>{var s;return(s=i==null?void 0:i.removeEventListener)===null||s===void 0?void 0:s.call(i,"change",o)}},[]),t}function Y1(t){let e=0,n=0,r=0;const o=window.getComputedStyle(t).transform.match(/matrix.*\((.+)\)/);if(o){const s=o[1].split(",").map(Hr);s.length===6?(e=s[4],n=s[5]):s.length===16&&(e=s[12],n=s[13],r=s[14])}return{x:e,y:n,z:r}}function jd(t,e){const n=F(),r=F(),i=zd();return Zn(()=>{var o,s,a;if(t.current&&n.current!==void 0&&!i){const{keyframes:c,duration:h,easing:l,onfinish:f}=e(n.current,t.current.getBoundingClientRect(),Y1(t.current))||{};if(c&&h){(o=r.current)===null||o===void 0||o.cancel(),r.current=void 0;try{r.current=(a=(s=t.current).animate)===null||a===void 0?void 0:a.call(s,c,{duration:h,easing:l})}catch(m){console.error(m)}r.current&&(r.current.onfinish=()=>{r.current=void 0,f==null||f()})}}n.current=void 0}),{prepareAnimation:o=>{n.current=o},isAnimationPlaying:()=>{var o;return((o=r.current)===null||o===void 0?void 0:o.playState)==="running"}}}function Hd(){const t=F(null),e=F(),[n,r]=W();return{setContainerRef:et(o=>{t.current=o,e.current&&(e.current.disconnect(),e.current=void 0);const s=()=>{if(o){const a=window.getComputedStyle(o),c=h=>parseFloat(h)||0;r({width:Math.round(o.clientWidth-c(a.paddingLeft)-c(a.paddingRight)),height:Math.round(o.clientHeight-c(a.paddingTop)-c(a.paddingBottom))})}else r(void 0)};s(),o&&typeof ResizeObserver<"u"&&(e.current=new ResizeObserver(s),e.current.observe(o))},[]),containerRef:t,containerRect:n}}function Gr(){const t=F(),{setTimeout:e,clearTimeout:n}=Yr();return et((r,i)=>{n(t.current),t.current=e(r,i>0?i:0)},[e,n])}function wt(t){const e=F(t);return Zn(()=>{e.current=t}),et((...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function Wd(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function _s(t,e){return _t(()=>t==null&&e==null?null:n=>{Wd(t,n),Wd(e,n)},[t,e])}function G1(t,e=!1){const n=F();Zn(()=>{e&&n.current&&(n.current=!1,t())},[e,t]);const r=et(()=>{n.current=!0},[]),i=et(()=>{n.current=!1},[]);return{onFocus:r,onBlur:i}}function bs(){const[t,e]=W(!1);return Zn(()=>{e(window.getComputedStyle(window.document.documentElement).direction==="rtl")},[]),t}function X1(){const[t]=W({}),e=et((i,o)=>{var s;(s=t[i])===null||s===void 0||s.forEach(a=>{o.isPropagationStopped()||a(o)})},[t]),n=_t(()=>({onPointerDown:i=>e(wd,i),onPointerMove:i=>e(vd,i),onPointerUp:i=>e(_d,i),onPointerLeave:i=>e(bd,i),onPointerCancel:i=>e(xd,i),onKeyDown:i=>e(Cd,i),onKeyUp:i=>e(_1,i),onWheel:i=>e(kd,i)}),[e]),r=et((i,o)=>(t[i]||(t[i]=[]),t[i].unshift(o),()=>{const s=t[i];s&&s.splice(0,s.length,...s.filter(a=>a!==o))}),[t]);return{registerSensors:n,subscribeSensors:r}}function Kd(t,e){const n=F(0),r=Gr(),i=wt((...o)=>{n.current=Date.now(),t(o)});return et((...o)=>{r(()=>{i(o)},e-(Date.now()-n.current))},[e,i,r])}const xs=gs("slide"),Cs=gs("slide_image");function Z1({slide:t,offset:e,render:n,rect:r,imageFit:i,imageProps:o,onClick:s,onLoad:a,onError:c,style:h}){var l,f,m,g,_,v,x;const[b,k]=W(hs),{publish:S}=Kr(),{setTimeout:M}=Yr(),T=F(null);U(()=>{e===0&&S(y1(b))},[e,b,S]);const R=wt(q=>{("decode"in q?q.decode():Promise.resolve()).catch(()=>{}).then(()=>{q.parentNode&&(k(ps),M(()=>{a==null||a(q)},0))})}),N=et(q=>{T.current=q,q!=null&&q.complete&&R(q)},[R]),P=et(q=>{R(q.currentTarget)},[R]),I=wt(()=>{k(fs),c==null||c()}),D=A1(t,i),O=(q,Gt)=>Number.isFinite(q)?q:Gt,J=O(Math.max(...((f=(l=t.srcSet)===null||l===void 0?void 0:l.map(q=>q.width))!==null&&f!==void 0?f:[]).concat(t.width?[t.width]:[]).filter(Boolean)),((m=T.current)===null||m===void 0?void 0:m.naturalWidth)||0),at=O(Math.max(...((_=(g=t.srcSet)===null||g===void 0?void 0:g.map(q=>q.height))!==null&&_!==void 0?_:[]).concat(t.height?[t.height]:[]).filter(Boolean)),((v=T.current)===null||v===void 0?void 0:v.naturalHeight)||0),Tt=J&&at?{maxWidth:`min(${J}px, 100%)`,maxHeight:`min(${at}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},$=(x=t.srcSet)===null||x===void 0?void 0:x.sort((q,Gt)=>q.width-Gt.width).map(q=>`${q.src} ${q.width}w`).join(", "),ut=()=>r&&!D&&t.width&&t.height?r.height/t.height*t.width:Number.MAX_VALUE,z=$&&r&&Pd()?`${Math.round(Math.min(ut(),r.width))}px`:void 0,{style:nt,className:Ot,...Ht}=o||{};return B(tt,null,B("img",{ref:N,onLoad:P,onError:I,onClick:s,draggable:!1,className:ue(G(Cs()),D&&G(Cs("cover")),b!==ps&&G(Cs("loading")),Ot),style:{...Tt,...h,...nt},...Ht,alt:t.alt,sizes:z,srcSet:$,src:t.src}),b!==ps&&B("div",{className:G(xs(g1))},b===hs&&(n!=null&&n.iconLoading?n.iconLoading():B(K1,{className:ue(G(ms),G(xs(hs)))})),b===fs&&(n!=null&&n.iconError?n.iconError():B(q1,{className:ue(G(ms),G(xs(fs)))}))))}const J1=fe(function({className:e,children:n,...r},i){const o=F(null);return B(L1,{nodeRef:o},B("div",{ref:_s(i,o),className:ue(G("root"),e),...r},n))});var St;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL",t[t.ANIMATION=3]="ANIMATION"})(St||(St={}));function Q1(t,e,n,r,i){U(()=>Ad(t(wd,e),t(vd,n),t(_d,r),t(bd,r),t(xd,r)),[t,e,n,r,i])}var qt;(function(t){t[t.NONE=0]="NONE",t[t.SWIPE=1]="SWIPE",t[t.PULL=2]="PULL"})(qt||(qt={}));const ks=30;function tw(t,e,n,r,i,o,s,a,c,h,l,f,m,g){const _=F(0),v=F([]),x=F(),b=F(0),k=F(qt.NONE),S=et(I=>{x.current===I.pointerId&&(x.current=void 0,k.current=qt.NONE);const D=v.current;D.splice(0,D.length,...D.filter(O=>O.pointerId!==I.pointerId))},[]),M=et(I=>{S(I),I.persist(),v.current.push(I)},[S]),T=wt(I=>{M(I)}),R=(I,D)=>h&&I>D||c&&I<-D,N=wt(I=>{if(v.current.find(D=>D.pointerId===I.pointerId)&&x.current===I.pointerId){const D=Date.now()-b.current,O=_.current;k.current===qt.SWIPE?Math.abs(O)>.3*n||Math.abs(O)>5&&D<r?s(O,D):a(O):k.current===qt.PULL&&(R(O,2*ks)?m(O,D):g(O)),_.current=0,k.current=qt.NONE}S(I)}),P=wt(I=>{const D=v.current.find(O=>O.pointerId===I.pointerId);if(D){const O=x.current===I.pointerId;if(I.buttons===0){O&&_.current!==0?N(I):S(D);return}const J=I.clientX-D.clientX,at=I.clientY-D.clientY;if(x.current===void 0){const Tt=$=>{M(I),x.current=I.pointerId,b.current=Date.now(),k.current=$};Math.abs(J)>Math.abs(at)&&Math.abs(J)>ks&&e(J)?(Tt(qt.SWIPE),i()):Math.abs(at)>Math.abs(J)&&R(at,ks)&&(Tt(qt.PULL),l())}else O&&(k.current===qt.SWIPE?(_.current=J,o(J)):k.current===qt.PULL&&(_.current=at,f(at)))}});Q1(t,T,P,N)}function ew({preventDefaultWheelX:t,preventDefaultWheelY:e}){const n=F(null),r=wt(i=>{const o=Math.abs(i.deltaX)>Math.abs(i.deltaY);(o&&t||!o&&e||i.ctrlKey)&&i.preventDefault()});return et(i=>{var o;i?i.addEventListener("wheel",r,{passive:!1}):(o=n.current)===null||o===void 0||o.removeEventListener("wheel",r),n.current=i},[r])}function nw(t,e,n,r,i,o,s,a,c){const h=F(0),l=F(0),f=F(),m=F(),g=F(0),_=F(),v=F(0),{setTimeout:x,clearTimeout:b}=Yr(),k=et(()=>{f.current&&(b(f.current),f.current=void 0)},[b]),S=et(()=>{m.current&&(b(m.current),m.current=void 0)},[b]),M=wt(()=>{t!==St.SWIPE&&(h.current=0,v.current=0,k(),S())});U(M,[t,M]);const T=wt(N=>{m.current=void 0,h.current===N&&c(h.current)}),R=wt(N=>{if(N.ctrlKey||Math.abs(N.deltaY)>Math.abs(N.deltaX))return;const P=I=>{g.current=I,b(_.current),_.current=I>0?x(()=>{g.current=0,_.current=void 0},300):void 0};if(t===St.NONE){if(Math.abs(N.deltaX)<=1.2*Math.abs(g.current)){P(N.deltaX);return}if(!n(-N.deltaX))return;if(l.current+=N.deltaX,k(),Math.abs(l.current)>30)l.current=0,P(0),v.current=Date.now(),o();else{const I=l.current;f.current=x(()=>{f.current=void 0,I===l.current&&(l.current=0)},i)}}else if(t===St.SWIPE){let I=h.current-N.deltaX;if(I=Math.min(Math.abs(I),r)*Math.sign(I),h.current=I,s(I),S(),Math.abs(I)>.2*r){P(N.deltaX),a(I,Date.now()-v.current);return}m.current=x(()=>T(I),2*i)}else P(N.deltaX)});U(()=>e(kd,R),[e,R])}const qd=gs("container"),Yd=At(null),Jn=Le("useController","ControllerContext",Yd);function rw({children:t,...e}){var n;const{carousel:r,animation:i,controller:o,on:s,styles:a,render:c}=e,{closeOnPullUp:h,closeOnPullDown:l,preventDefaultWheelX:f,preventDefaultWheelY:m}=o,[g,_]=W(),v=qr(),x=F1(),[b,k]=W(St.NONE),S=F(0),M=F(0),T=F(1),{registerSensors:R,subscribeSensors:N}=X1(),{subscribe:P,publish:I}=Kr(),D=Gr(),O=Gr(),J=Gr(),{containerRef:at,setContainerRef:Tt,containerRect:$}=Hd(),ut=_s(ew({preventDefaultWheelX:f,preventDefaultWheelY:m}),Tt),z=F(null),nt=_s(z,void 0),{getOwnerDocument:Ot}=vs(),Ht=bs(),q=L=>(Ht?-1:1)*(typeof L=="number"?L:1),Gt=wt(()=>{var L;return(L=at.current)===null||L===void 0?void 0:L.focus()}),oi=wt(()=>e),mt=wt(()=>v),bt=et(L=>I(Ne,L),[I]),Fe=et(L=>I(De,L),[I]),we=et(()=>I(ln),[I]),fn=L=>!(r.finite&&(q(L)>0&&v.currentIndex===0||q(L)<0&&v.currentIndex===v.slides.length-1)),rr=L=>{var Q;S.current=L,(Q=at.current)===null||Q===void 0||Q.style.setProperty(Rt("swipe_offset"),`${Math.round(L)}px`)},pn=L=>{var Q,Ct;M.current=L,T.current=(()=>{const he=l&&L>0?L:h&&L<0?-L:0;return Math.min(Math.max(T1(1-he/60*(1-.5),2),.5),1)})(),(Q=at.current)===null||Q===void 0||Q.style.setProperty(Rt("pull_offset"),`${Math.round(L)}px`),(Ct=at.current)===null||Ct===void 0||Ct.style.setProperty(Rt("pull_opacity"),`${T.current}`)},{prepareAnimation:ve}=jd(z,(L,Q,Ct)=>{if(z.current&&$)return{keyframes:[{transform:`translate(0, ${L.rect.y-Q.y+Ct.y}px)`,opacity:L.opacity},{transform:"translate(0, 0)",opacity:1}],duration:L.duration,easing:i.easing.fade}}),mn=(L,Q)=>{if(h||l){pn(L);let Ct=0;z.current&&(Ct=i.fade*(Q?2:1),ve({rect:z.current.getBoundingClientRect(),opacity:T.current,duration:Ct})),J(()=>{pn(0),k(St.NONE)},Ct),k(St.ANIMATION),Q||we()}},{prepareAnimation:si,isAnimationPlaying:Hs}=jd(z,(L,Q,Ct)=>{var It;if(z.current&&$&&(!((It=v.animation)===null||It===void 0)&&It.duration)){const ct=Wr(r.spacing),he=(ct.percent?ct.percent*$.width/100:ct.pixel)||0;return{keyframes:[{transform:`translate(${q(v.globalIndex-L.index)*($.width+he)+L.rect.x-Q.x+Ct.x}px, 0)`},{transform:"translate(0, 0)"}],duration:v.animation.duration,easing:v.animation.easing}}}),_e=wt(L=>{var Q,Ct;const It=L.offset||0,ct=It?i.swipe:(Q=i.navigation)!==null&&Q!==void 0?Q:i.swipe,he=!It&&!Hs()?i.easing.navigation:i.easing.swipe;let{direction:gn}=L;const Ft=(Ct=L.count)!==null&&Ct!==void 0?Ct:1;let or=St.ANIMATION,p=ct*Ft;if(!gn){const d=$==null?void 0:$.width,y=L.duration||0,C=d?ct/d*Math.abs(It):ct;Ft!==0?(y<C?p=p/C*Math.max(y,C/5):d&&(p=ct/d*(d-Math.abs(It))),gn=q(It)>0?Ne:De):p=ct/2}let u=0;gn===Ne?fn(q(1))?u=-Ft:(or=St.NONE,p=ct):gn===De&&(fn(q(-1))?u=Ft:(or=St.NONE,p=ct)),p=Math.round(p),O(()=>{rr(0),k(St.NONE)},p),z.current&&si({rect:z.current.getBoundingClientRect(),index:v.globalIndex}),k(or),I(yd,{type:"swipe",increment:u,duration:p,easing:he})});U(()=>{var L,Q;!((L=v.animation)===null||L===void 0)&&L.increment&&(!((Q=v.animation)===null||Q===void 0)&&Q.duration)&&D(()=>x({type:"swipe",increment:0}),v.animation.duration)},[v.animation,x,D]);const de=[N,fn,($==null?void 0:$.width)||0,i.swipe,()=>k(St.SWIPE),L=>rr(L),(L,Q)=>_e({offset:L,duration:Q,count:1}),L=>_e({offset:L,count:0})],Ve=[()=>{l&&k(St.PULL)},L=>pn(L),L=>mn(L),L=>mn(L,!0)];tw(...de,h,l,...Ve),nw(b,...de);const ai=wt(()=>{o.focus&&Ot().querySelector(`.${G(ds)} .${G(qd())}`)&&Gt()});U(ai,[ai]);const ci=wt(()=>{var L;(L=s.view)===null||L===void 0||L.call(s,{index:v.currentIndex})});U(ci,[v.globalIndex,ci]),U(()=>Ad(P(Ne,L=>_e({direction:Ne,...L})),P(De,L=>_e({direction:De,...L})),P(yd,L=>x(L))),[P,_e,x]);const ir=_t(()=>({prev:bt,next:Fe,close:we,focus:Gt,slideRect:$?P1($,r.padding):{width:0,height:0},containerRect:$||{width:0,height:0},subscribeSensors:N,containerRef:at,setCarouselRef:nt,toolbarWidth:g,setToolbarWidth:_}),[bt,Fe,we,Gt,N,$,at,nt,g,_,r.padding]);return Cn(o.ref,()=>({prev:bt,next:Fe,close:we,focus:Gt,getLightboxProps:oi,getLightboxState:mt}),[bt,Fe,we,Gt,oi,mt]),B("div",{ref:ut,className:ue(G(qd()),G(md)),style:{...b===St.SWIPE?{[Rt("swipe_offset")]:`${Math.round(S.current)}px`}:null,...b===St.PULL?{[Rt("pull_offset")]:`${Math.round(M.current)}px`,[Rt("pull_opacity")]:`${T.current}`}:null,...o.touchAction!=="none"?{[Rt("controller_touch_action")]:o.touchAction}:null,...a.container},...o.aria?{role:"presentation","aria-live":"polite"}:null,tabIndex:-1,...R},$&&B(Yd.Provider,{value:ir},t,(n=c.controls)===null||n===void 0?void 0:n.call(c)))}const iw=Be(fd,rw);function Oe(t){return Yn(hd,t)}function Gd(t){return Yn("slide",t)}function ow({slide:t,offset:e}){const n=F(null),{currentIndex:r}=qr(),{slideRect:i,close:o,focus:s}=Jn(),{render:a,carousel:{imageFit:c,imageProps:h},on:{click:l},controller:{closeOnBackdropClick:f},styles:{slide:m}}=Gn(),{getOwnerDocument:g}=vs(),_=e!==0;U(()=>{var b;_&&(!((b=n.current)===null||b===void 0)&&b.contains(g().activeElement))&&s()},[_,s,g]);const v=()=>{var b,k,S,M;let T=(b=a.slide)===null||b===void 0?void 0:b.call(a,{slide:t,offset:e,rect:i});return!T&&Id(t)&&(T=B(Z1,{slide:t,offset:e,render:a,rect:i,imageFit:c,imageProps:h,onClick:_?void 0:()=>l==null?void 0:l({index:r})})),T?B(tt,null,(k=a.slideHeader)===null||k===void 0?void 0:k.call(a,{slide:t}),((S=a.slideContainer)!==null&&S!==void 0?S:({children:R})=>R)({slide:t,children:T}),(M=a.slideFooter)===null||M===void 0?void 0:M.call(a,{slide:t})):null},x=b=>{const k=n.current,S=b.target instanceof HTMLElement?b.target:void 0;f&&S&&k&&(S===k||Array.from(k.children).find(M=>M===S)&&S.classList.contains(G(v1)))&&o()};return B("div",{ref:n,className:ue(G(Gd()),!_&&G(Gd("current")),G(md)),...N1(_),onClick:x,style:m},v())}function sw(){const t=Gn().styles.slide;return B("div",{className:G("slide"),style:t})}function aw({carousel:t}){const{slides:e,currentIndex:n,globalIndex:r}=qr(),{setCarouselRef:i}=Jn(),o=Wr(t.spacing),s=Wr(t.padding),a=M1(t,e,1),c=[];if(Rd(e))for(let h=n-a;h<=n+a;h+=1){const l=Nd(e,h),f=r-n+h,m=t.finite&&(h<0||h>e.length-1);c.push(m?{key:f}:{key:[`${f}`,I1(l)].filter(Boolean).join("|"),offset:h-n,slide:l})}return B("div",{ref:i,className:ue(G(Oe()),c.length>0&&G(Oe("with_slides"))),style:{[`${Rt(Oe("slides_count"))}`]:c.length,[`${Rt(Oe("spacing_px"))}`]:o.pixel||0,[`${Rt(Oe("spacing_percent"))}`]:o.percent||0,[`${Rt(Oe("padding_px"))}`]:s.pixel||0,[`${Rt(Oe("padding_percent"))}`]:s.percent||0}},c.map(({key:h,slide:l,offset:f})=>l?B(ow,{key:h,slide:l,offset:f}):B(sw,{key:h})))}const cw=Be(hd,aw);function Xd(){const{carousel:t}=Gn(),{slides:e,currentIndex:n}=qr(),r=e.length===0||t.finite&&n===0,i=e.length===0||t.finite&&n===e.length-1;return{prevDisabled:r,nextDisabled:i}}function lw(t){var e;const n=bs(),{publish:r}=Kr(),{animation:i}=Gn(),{prevDisabled:o,nextDisabled:s}=Xd(),a=((e=i.navigation)!==null&&e!==void 0?e:i.swipe)/2,c=Kd(()=>r(Ne),a),h=Kd(()=>r(De),a),l=wt(f=>{switch(f.key){case b1:r(ln);break;case x1:(n?s:o)||(n?h:c)();break;case C1:(n?o:s)||(n?c:h)();break}});U(()=>t(Cd,l),[t,l])}function Zd({label:t,icon:e,renderIcon:n,action:r,onClick:i,disabled:o,style:s}){return B($d,{label:t,icon:e,renderIcon:n,className:G(`navigation_${r}`),disabled:o,onClick:i,style:s,...G1(Jn().focus,o)})}function uw({render:{buttonPrev:t,buttonNext:e,iconPrev:n,iconNext:r},styles:i}){const{prev:o,next:s,subscribeSensors:a}=Jn(),{prevDisabled:c,nextDisabled:h}=Xd();return lw(a),B(tt,null,t?t():B(Zd,{label:"Previous",action:Ne,icon:H1,renderIcon:n,style:i.navigationPrev,disabled:c,onClick:o}),e?e():B(Zd,{label:"Next",action:De,icon:W1,renderIcon:r,style:i.navigationNext,disabled:h,onClick:s}))}const dw=Be(f1,uw),Jd=G(w1),hw=G(gd);function fw(t){return"style"in t}function Qd(t,e,n){const r=window.getComputedStyle(t),i=n?"padding-left":"padding-right",o=n?r.paddingLeft:r.paddingRight,s=t.style.getPropertyValue(i);return t.style.setProperty(i,`${(Hr(o)||0)+e}px`),()=>{s?t.style.setProperty(i,s):t.style.removeProperty(i)}}function pw({noScroll:{disabled:t},children:e}){const n=bs(),{getOwnerDocument:r,getOwnerWindow:i}=vs();return U(()=>{if(t)return()=>{};const o=[],s=i(),{body:a,documentElement:c}=r(),h=Math.round(s.innerWidth-c.clientWidth);if(h>0){o.push(Qd(a,h,n));const l=a.getElementsByTagName("*");for(let f=0;f<l.length;f+=1){const m=l[f];fw(m)&&s.getComputedStyle(m).getPropertyValue("position")==="fixed"&&!m.classList.contains(hw)&&o.push(Qd(m,h,n))}}return a.classList.add(Jd),()=>{a.classList.remove(Jd),o.forEach(l=>l())}},[n,t,r,i]),B(tt,null,e)}const mw=Be(p1,pw);function th(t){return Yn(ds,t)}function eh(t,e,n){const r=t.getAttribute(e);return t.setAttribute(e,n),()=>{r?t.setAttribute(e,r):t.removeAttribute(e)}}function gw({children:t,animation:e,styles:n,className:r,on:i,portal:o,close:s}){const[a,c]=W(!1),[h,l]=W(!1),f=F([]),m=F(null),{setTimeout:g}=Yr(),{subscribe:_}=Kr(),x=zd()?0:e.fade;U(()=>(c(!0),()=>{c(!1),l(!1)}),[]);const b=wt(()=>{f.current.forEach(T=>T()),f.current=[]}),k=wt(()=>{var T;l(!1),b(),(T=i.exiting)===null||T===void 0||T.call(i),g(()=>{var R;(R=i.exited)===null||R===void 0||R.call(i),s()},x)});U(()=>_(ln,k),[_,k]);const S=wt(T=>{var R,N,P;T.scrollTop,l(!0),(R=i.entering)===null||R===void 0||R.call(i);const I=(P=(N=T.parentNode)===null||N===void 0?void 0:N.children)!==null&&P!==void 0?P:[];for(let D=0;D<I.length;D+=1){const O=I[D];["TEMPLATE","SCRIPT","STYLE"].indexOf(O.tagName)===-1&&O!==T&&(f.current.push(eh(O,"inert","")),f.current.push(eh(O,"aria-hidden","true")))}f.current.push(()=>{var D,O;(O=(D=m.current)===null||D===void 0?void 0:D.focus)===null||O===void 0||O.call(D)}),g(()=>{var D;(D=i.entered)===null||D===void 0||D.call(i)},x)}),M=et(T=>{T?S(T):b()},[S,b]);return a?Ai(B(J1,{ref:M,className:ue(r,G(th()),G(gd),h&&G(th("open"))),role:"presentation","aria-live":"polite",style:{...e.fade!==ws.animation.fade?{[Rt("fade_animation_duration")]:`${x}ms`}:null,...e.easing.fade!==ws.animation.easing.fade?{[Rt("fade_animation_timing_function")]:e.easing.fade}:null,...n.root},onFocus:T=>{m.current||(m.current=T.relatedTarget)}},t),o.root||document.body):null}const yw=Be(ds,gw);function ww({children:t}){return B(tt,null,t)}const vw=Be(m1,ww);function _w(t){return Yn(pd,t)}function bw({toolbar:{buttons:t},render:{buttonClose:e,iconClose:n},styles:r}){const{close:i,setToolbarWidth:o}=Jn(),{setContainerRef:s,containerRect:a}=Hd();Zn(()=>{o(a==null?void 0:a.width)},[o,a==null?void 0:a.width]);const c=()=>e?e():B($d,{key:ln,label:"Close",icon:j1,renderIcon:n,onClick:i});return B("div",{ref:s,style:r.toolbar,className:G(_w())},t==null?void 0:t.map(h=>h===ln?c():h))}const xw=Be(pd,bw);function nh(t,e){var n;return B(t.module.component,{key:t.module.name,...e},(n=t.children)===null||n===void 0?void 0:n.map(r=>nh(r,e)))}function Cw(t,e={}){const{easing:n,...r}=t,{easing:i,...o}=e;return{easing:{...n,...i},...r,...o}}function kw({carousel:t,animation:e,render:n,toolbar:r,controller:i,noScroll:o,on:s,plugins:a,slides:c,index:h,...l}){const{animation:f,carousel:m,render:g,toolbar:_,controller:v,noScroll:x,on:b,slides:k,index:S,plugins:M,...T}=ws,{config:R,augmentation:N}=D1([xt(yw,[xt(mw,[xt(iw,[xt(cw),xt(xw),xt(dw)])])])],a||M),P=N({animation:Cw(f,e),carousel:{...m,...t},render:{...g,...n},toolbar:{..._,...r},controller:{...v,...i},noScroll:{...x,...o},on:{...b,...s},...T,...l});return P.open?B(O1,{...P},B(U1,{slides:c||k,index:Hr(h||S)},B($1,null,B(B1,null,nh(xt(vw,R),P))))):null}const Ew=({attachment:t})=>{const e=async n=>{n.preventDefault();try{const r=await fetch(t.url);if(!r.ok)throw new Error("Download failed");const i=await r.blob(),o=URL.createObjectURL(i),s=document.createElement("a");s.href=o,s.download=t.name,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o)}catch{window.open(t.url,"_blank","noopener,noreferrer")}};return w("a",{href:t.url,onClick:e,className:"flex items-center gap-3 max-w-[240px] rounded-lg border border-gray-200 bg-white px-3 py-2 no-underline hover:bg-gray-50 transition-colors cursor-pointer dark:bg-neutral-800 dark:border-neutral-700 dark:hover:bg-neutral-700",children:[w(ls,{extension:jr(t.name),className:"w-8 h-9"}),w("div",{className:"min-w-0",children:[w("p",{className:"text-sm font-medium text-gray-800 dark:text-white truncate",children:t.name}),w("p",{className:"text-xs text-gray-500 dark:text-neutral-400",children:us(t.size)})]})]})},Sw=["png","jpg","jpeg","gif","webp"];function rh(t){return t.contentType?t.contentType.startsWith("image/"):Sw.includes(jr(t.name))}function ih(t){var e;return t.contentType?t.contentType==="image/gif":((e=t.name)==null?void 0:e.toLowerCase().endsWith(".gif"))??!1}const oh=({messageIndexKey:t,attachments:e})=>{const{setFullScreen:n}=Y(),[r,i]=W(!1),o=ft(Fh);function s(){if(o){const l=o.getElementById("deskcord-lightbox-portal");if(l)return l}const h=document.getElementById("deskcord-lightbox-portal");return h||document.body}const a=(e==null?void 0:e.filter(h=>rh(h)&&!ih(h)))??[];function c(){return a.length?w(kw,{open:r,portal:{root:s()},close:()=>{i(!1),n(!1)},slides:a.map(h=>({src:h.proxyURL}))}):null}return e!=null&&e.length?w("div",{children:[e.map((h,l)=>{const{proxyURL:f,width:m,height:g}=h;return rh(h)?ih(h)?w("div",{children:w("img",{src:f,alt:"GIF",className:`rounded-lg w-[${m}px] h-[${g}px] max-w-[200px] max-h-[200px] aspect-auto`})},`conv-cus-attachment-${t}-${l}`):w("div",{onClick:()=>{n(!0),i(!0)},className:"cursor-pointer",children:w("img",{src:f,alt:"Preview",className:`rounded-lg w-[${m}px] h-[${g}px] max-w-[200px] max-h-[200px] aspect-auto`})},`conv-cus-attachment-${t}-${l}`):w("div",{className:"mt-1",children:w(Ew,{attachment:h})},`conv-cus-attachment-${t}-${l}`)}),c()]},`conv-cus-attachment-${t}`):null},sh=({imageUrls:t,messageIndexKey:e})=>t.length?w("div",{className:"flex flex-col gap-1 mt-1",children:t.map((n,r)=>w("div",{className:"inline-block",children:w("img",{src:n,alt:"Inline image",className:"rounded-lg max-w-[200px] max-h-[200px] object-contain",loading:"lazy"})},`inline-img-${e}-${r}`))}):null,Tw=["giphy.com","imgur.com","gfycat.com","media.discordapp.net","cdn.discordapp.com","i.redd.it","i.imgur.com"],Aw=[".gif",".jpg",".jpeg",".png",".webp",".apng"];function Pw(t){try{const e=new URL(t),n=e.pathname.toLowerCase(),r=e.hostname.toLowerCase();for(const i of Aw)if(n.endsWith(i))return!0;for(const i of Tw)if(r===i||r.endsWith(`.${i}`))return!0;return!1}catch{return!1}}const Iw=/https?:\/\/[^\s<>]+/gi;function ah(t){if(!t)return{text:"",imageUrls:[]};const e=[];let n=t;const r=t.match(Iw);if(r)for(const i of r)Pw(i)&&(e.push(i),n=n.replace(i,""));return n=n.replace(/\s+/g," ").trim(),{text:n,imageUrls:e}}const Mw=({renderTimestamp:t,message:e,indexKey:n})=>{function r(s,a){const c=/<\w?:\w+:\d+>/g,h=s.split(c),l=s.match(c)??[],f=[];for(let m=0;m<h.length;m++)if(f.push(h[m]),l[m]){const g=a[l[m]];g&&f.push(w("img",{src:g.imageURL,alt:"",style:{display:"inline-block",width:"20px",height:"20px"}},m))}return f}const{text:i,imageUrls:o}=ah(e.content??"");return w("li",{className:"flex flex-col items-start max-w-lg gap-x-2 sm:gap-x-4 me-11",children:[i&&w("div",{style:{background:"linear-gradient(167deg, #27292A 0%, #404547 100%)"},className:"text-white text-sm min-w-10 inline-block rounded-lg px-3 py-2 shadow-sm",children:r(i,e.emojis??{})}),w(sh,{imageUrls:o,messageIndexKey:n}),w("div",{className:"flex flex-1",children:w(oh,{attachments:e.attachments,messageIndexKey:n})}),t&&w("div",{children:w("span",{className:"mt-1.5 flex items-center gap-x-1 text-xs text-gray-500",children:[e.authorName," ยท ",dd(e.date)," ",e.edited?"(edited)":""]})})]},`conv-cs-${n}`)},Rw=({message:t,indexKey:e})=>{const{text:n,imageUrls:r}=ah(t.content??"");return w("li",{className:`flex flex-col items-end ms-auto my-[3px] ${t.pending?"opacity-80":""}`,children:[n&&w("div",{className:"grow",children:w("div",{style:{background:"linear-gradient(167deg, var(--dc-primary) 0%, var(--dc-primary-mid) 100%)"},className:"min-w-10 inline-block rounded-lg px-3 py-2 shadow-sm",children:w("p",{className:"text-left text-sm text-white",children:n})})}),w(sh,{imageUrls:r,messageIndexKey:e}),t.attachments&&w("div",{className:"flex flex-1 justify-end",children:w(oh,{attachments:t.attachments,messageIndexKey:e})},`conv-cus-${e}-attachments`)]},`conv-cus-${e}`)},Nw=({message:t,indexKey:e})=>w("li",{className:"max-w-lg flex gap-x-2 sm:gap-x-4 me-11",children:w("div",{className:"bg-white border border-gray-200 rounded-2xl p-4 space-y-3 dark:bg-neutral-900 dark:border-neutral-700",children:w("p",{className:"mb-1.5 text-sm text-gray-800 dark:text-white",children:t.content})})},`conv-system-${e}`),Dw=()=>{const{setEmail:t,setUsername:e,username:n,email:r,token:i}=Y(),[o,s]=W(r),[a,c]=W(n),[h,l]=W(""),[f,m]=W(!1),g=b=>/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(b),_=!!n&&!!r,v=b=>{if(b.preventDefault(),!!a.trim()){if(!g(o)){l("Please enter a valid email address");return}f||(m(!0),l(""),t(o),e(a))}};function x(){return w("form",{onSubmit:v,className:"w-full space-y-4",children:[w("div",{className:"mb-4",children:[w("h3",{className:"text-base font-semibold text-gray-900 mb-1",children:"Let's get started"}),w("p",{className:"text-sm text-gray-600",children:"Tell us a bit about yourself so we can assist you better."})]}),w("div",{children:[w("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-2",children:"Your name"}),w("div",{className:"relative",children:[w("div",{className:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5",children:w(Gg,{size:18,className:"text-gray-400"})}),w("input",{type:"text",id:"name",value:a,onChange:b=>c(b.target.value),name:"name",className:"py-2.5 px-4 ps-11 block w-full bg-white border border-gray-300 rounded-lg text-base md:text-sm text-gray-900 placeholder-gray-500 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-[var(--dc-primary)] focus:ring-opacity-50 focus:border-transparent disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed",placeholder:"John Smith",disabled:_,required:!0})]})]}),w("div",{children:[w("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-2",children:"Email address"}),w("div",{className:"relative",children:[w("div",{className:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5",children:w(Hg,{size:18,className:"text-gray-400"})}),w("input",{type:"email",id:"email",value:o,onChange:b=>{s(b.target.value),h&&l("")},name:"email",className:`py-2.5 px-4 ps-11 block w-full bg-white rounded-lg text-base md:text-sm text-gray-900 placeholder-gray-500 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-opacity-50 focus:border-transparent disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed border ${h?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-[var(--dc-primary)]"}`,placeholder:"you@example.com",disabled:_,required:!0})]}),h&&w("p",{className:"text-red-600 text-sm mt-2 flex items-center gap-1",children:[w("span",{className:"inline-block w-1 h-1 bg-red-600 rounded-full"}),h]})]}),w("p",{className:"text-xs text-gray-500 text-center",children:"We'll never share your information"}),!n||!r?w("button",{type:"submit",className:"w-full py-2.5 px-4 bg-[var(--dc-primary)] hover:bg-[var(--dc-primary-mid)] text-white font-medium text-sm rounded-lg transition-all duration-200 transform hover:shadow-md active:scale-95 focus:outline-none focus:ring-2 focus:ring-[var(--dc-primary)] focus:ring-opacity-50 disabled:opacity-50 disabled:cursor-not-allowed",disabled:f,children:"Start Chatting"}):null]})}return w(tt,{children:[w("li",{className:`max-w-lg flex gap-x-2 sm:gap-x-4 me-11 ${i?"opacity-75":""}`,children:w("div",{className:"w-full rounded-xl p-5 bg-white shadow-lg border border-gray-100 overflow-hidden",children:x()})}),n&&r&&w("li",{className:"flex ms-auto my-4 animate-slide-in",style:{marginTop:"1rem"},children:w("div",{className:"grow",children:w("div",{style:{background:"linear-gradient(167deg, var(--dc-primary) 0%, var(--dc-primary-mid) 100%)"},className:"min-w-10 inline-block rounded-lg px-4 py-2 shadow-sm flex items-center gap-2",children:[w(zg,{size:16,className:"text-white flex-shrink-0"}),w("p",{className:"text-sm text-white font-medium",children:["Nice to meet you, ",w("span",{className:"font-semibold",children:n}),"! Feel free to ask us anything."]})]})})})]})};function Lw(t,e){const n=F();U(()=>{n.current=t},[t]),U(()=>{function r(){var i;(i=n==null?void 0:n.current)==null||i.call(n)}if(e!==null){const i=setInterval(r,e);return()=>clearInterval(i)}},[e])}const Bw=({indexKey:t,message:e})=>{const n=e.customRendererProps.file,r=n.status==="error",[i,o]=W(!0),[s,a]=W(0);return Lw(()=>{s<88?a(s+2.5):o(!1)},i&&!r?250:null),w("li",{className:"max-w-lg flex gap-x-2 sm:gap-x-4",style:{marginTop:"20px",marginBottom:"20px"},children:w("div",{className:"w-full bg-white border border-gray-200 rounded-2xl p-4 space-y-4",children:w("div",{children:[w("div",{className:"mb-2 flex justify-between items-center",children:[w("div",{className:"flex items-center gap-x-3",children:[w(ls,{extension:jr(n.fileName),className:"size-9",iconColorClassName:r?"text-red-300":void 0}),w("div",{children:[w("p",{className:`text-sm ${r?"font-semibold text-red-500":"font-medium text-gray-800"}`,children:n.fileName}),w("p",{className:"text-xs text-gray-500 dark:text-neutral-500",children:us(n.size)})]})]}),r&&w("div",{className:"inline-flex items-center gap-x-2",children:w("span",{className:"relative",children:[w("svg",{className:"shrink-0 size-4 text-red-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16",children:w("path",{d:"M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"})}),w("span",{className:"sr-only",children:"Danger"})]})})]}),w("div",{className:"flex items-center gap-x-3 whitespace-nowrap",children:[w("div",{className:"flex w-full h-2 bg-gray-200 rounded-full overflow-hidden dark:bg-neutral-700",role:"progressbar",children:w("div",{className:`flex flex-col justify-center rounded-full overflow-hidden ${r?"bg-red-500":"bg-blue-600"} text-xs text-white text-center whitespace-nowrap transition duration-500 dark:bg-blue-500`,style:{width:`${s}%`}})}),w("div",{className:"w-6 text-end",children:w("span",{className:"text-sm text-gray-800 dark:text-white",children:[Math.round(s),"%"]})})]})]})})},`conv-fileupload-${t}`)},Ow=({conversation:t,open:e})=>{const n=F(!1),{isChatOpen:r}=Y();U(()=>{r?n.current=!0:n.current=!1},[r]);function i(c,h){const l=`${c.date}-${h}`;let f;if(typeof c.customRenderer<"u")switch(c.customRenderer){case cn.IntroduceYourself:f=w(Dw,{});break;case cn.UploadFile:f=w(Bw,{message:c,indexKey:l});break;default:f=a(c,l)}else c.authorName===qn?f=a(c,l):c.support?f=o(c,l):f=s(c,l);return r&&(c.pending??(c.support&&n.current))?w(Qt.li,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},children:f},l):w("li",{children:f},l)}function o(c,h){var g;const l=(g=t==null?void 0:t.messages)==null?void 0:g.filter(_=>_.support),f=l==null?void 0:l[l.length-1],m=c.date===(f==null?void 0:f.date);return w(Mw,{renderTimestamp:m,message:c,indexKey:h})}function s(c,h){return w(Rw,{message:c,indexKey:h})}function a(c,h){return w(Nw,{message:c,indexKey:h})}return w("ul",{className:"space-y-[3px]",children:[[...(t==null?void 0:t.messages)??[]].sort((c,h)=>c.date-h.date).map(i),t&&!e&&i(e1,1)]})},Fw={duration:.9,repeat:1/0,ease:"easeInOut"},Vw=({authorName:t,visible:e})=>w("div",{className:`flex items-center gap-2 px-4 py-1.5 bg-white dark:bg-neutral-900 transition-opacity duration-150 ${e?"opacity-100":"opacity-0 pointer-events-none"}`,role:"status","aria-hidden":!e,"aria-label":e?`${t} is typing`:void 0,children:[w("span",{className:"inline-flex items-center gap-1",children:[0,1,2].map(n=>w(Qt.span,{className:"block w-1.5 h-1.5 rounded-full bg-gray-400 dark:bg-neutral-500",animate:e?{y:[0,-3,0]}:{y:0},transition:e?{...Fw,delay:n*.15}:void 0},n))}),w("span",{className:"text-xs text-gray-500 dark:text-neutral-400",children:[w("span",{className:"font-semibold text-gray-700 dark:text-neutral-200",children:t})," ","is typing..."]})]}),Uw=()=>{var Tt;const{getConversation:t,addMessage:e,tempConversationToThread:n,username:r,email:i,updateMessage:o,isChatOpen:s,typingByThread:a}=Y(),c=!!(r&&i),h=F(!1);U(()=>{s&&!h.current&&(h.current=!0),s||(h.current=!1)},[s]);const[l,f]=W(!1),[m,g]=W([]),[_,v]=W({}),x=t(),b=(x==null?void 0:x.status)==="open",[k,S]=W(""),[M,T]=W(!1),R=F(null),N=()=>{T(!0),R.current!==null&&clearTimeout(R.current),R.current=window.setTimeout(()=>{T(!1),R.current=null},800)};U(()=>()=>{R.current!==null&&clearTimeout(R.current)},[]);const P=!!(x&&a[x.threadId]),I=[...(x==null?void 0:x.messages)??[]].filter($=>$.support&&$.authorName).sort(($,ut)=>ut.date-$.date)[0],D=((Tt=x==null?void 0:x.csMember)==null?void 0:Tt.displayName)??(I==null?void 0:I.authorName)??"Support";U(()=>{const $={};m.forEach(ut=>{if(!ut.type.startsWith("image/")){$[ut.name]={url:"",width:0,height:0,size:ut.size},v({...$});return}const z=new FileReader;z.addEventListener("load",function(){const nt=new Image;nt.onload=()=>{$[ut.name]={url:z.result,width:nt.width,height:nt.height,size:ut.size},v({...$})},nt.src=z.result},!1),z.readAsDataURL(ut)})},[m]);const O=$=>{S(ut=>ut+$)},J=async()=>{const $=Date.now(),ut={support:!1,content:k,date:$,authorName:r,pending:!0};if(k.trim()!==""){S(""),e(x?x.threadId:"TEMP",ut);const z=await t1({content:k});z&&((!x||x.threadId==="TEMP")&&n(z.threadId),o(z.threadId,$,{...ut,pending:!1,date:z.date}))}},at=s&&!h.current;return w(tt,{children:[w("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 flex flex-col-reverse space-y-4 space-y-reverse dc-scroll ${M?"dc-scroll--active":""}`,onScroll:N,children:w(Qt.div,{initial:at?{opacity:0,x:20}:!1,animate:{opacity:1,x:0},transition:{duration:.3,ease:"easeOut",delay:.1},children:w(Ow,{conversation:x,open:b})})}),w(Vw,{authorName:D,visible:P}),w("div",{className:(x==null?void 0:x.status)==="closed"?"":"border-t border-t-gray-200 dark:border-neutral-800",children:w(h1,{attachmentPreviews:_,files:m,setFiles:g,inputMessage:k,setInputMessage:S,showEmojiPicker:l,setShowEmojiPicker:f,addEmoji:O,sendMessage:J,disabled:!c})})]})};function Es(t,e){switch(t){case"online":return e==="text"?"text-teal-600":"bg-teal-400";case"idle":return e==="text"?"text-yellow-600":"bg-yellow-400";case"dnd":return e==="text"?"text-red-600":"bg-red-400";case"offline":case"invisible":return e==="text"?"text-black":"bg-gray-400";default:return e==="text"?"text-black":"bg-gray-400"}}function $w(t){switch(t){case"online":return"Online";case"idle":case"offline":case"invisible":return"Away";case"dnd":return"Unavailable";default:return"Away"}}const ee=Object.create(null);ee.open="0",ee.close="1",ee.ping="2",ee.pong="3",ee.message="4",ee.upgrade="5",ee.noop="6";const Xr=Object.create(null);Object.keys(ee).forEach(t=>{Xr[ee[t]]=t});const Ss={type:"error",data:"parser error"},ch=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",lh=typeof ArrayBuffer=="function",uh=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Ts=({type:t,data:e},n,r)=>ch&&e instanceof Blob?n?r(e):dh(e,r):lh&&(e instanceof ArrayBuffer||uh(e))?n?r(e):dh(new Blob([e]),r):r(ee[t]+(e||"")),dh=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function hh(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let As;function zw(t,e){if(ch&&t.data instanceof Blob)return t.data.arrayBuffer().then(hh).then(e);if(lh&&(t.data instanceof ArrayBuffer||uh(t.data)))return e(hh(t.data));Ts(t,!1,n=>{As||(As=new TextEncoder),e(As.encode(n))})}const fh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<fh.length;t++)Qn[fh.charCodeAt(t)]=t;const jw=t=>{let e=t.length*.75,n=t.length,r,i=0,o,s,a,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const h=new ArrayBuffer(e),l=new Uint8Array(h);for(r=0;r<n;r+=4)o=Qn[t.charCodeAt(r)],s=Qn[t.charCodeAt(r+1)],a=Qn[t.charCodeAt(r+2)],c=Qn[t.charCodeAt(r+3)],l[i++]=o<<2|s>>4,l[i++]=(s&15)<<4|a>>2,l[i++]=(a&3)<<6|c&63;return h},Hw=typeof ArrayBuffer=="function",Ps=(t,e)=>{if(typeof t!="string")return{type:"message",data:ph(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:Ww(t.substring(1),e)}:Xr[n]?t.length>1?{type:Xr[n],data:t.substring(1)}:{type:Xr[n]}:Ss},Ww=(t,e)=>{if(Hw){const n=jw(t);return ph(n,e)}else return{base64:!0,data:t}},ph=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},mh="",Kw=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,s)=>{Ts(o,!1,a=>{r[s]=a,++i===n&&e(r.join(mh))})})},qw=(t,e)=>{const n=t.split(mh),r=[];for(let i=0;i<n.length;i++){const o=Ps(n[i],e);if(r.push(o),o.type==="error")break}return r};function Yw(){return new TransformStream({transform(t,e){zw(t,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let Is;function Zr(t){return t.reduce((e,n)=>e+n.length,0)}function Jr(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;i<e;i++)n[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function Gw(t,e){Is||(Is=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(r===0){if(Zr(n)<1)break;const c=Jr(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Zr(n)<2)break;const c=Jr(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Zr(n)<8)break;const c=Jr(n,8),h=new DataView(c.buffer,c.byteOffset,c.length),l=h.getUint32(0);if(l>Math.pow(2,21)-1){a.enqueue(Ss);break}i=l*Math.pow(2,32)+h.getUint32(4),r=3}else{if(Zr(n)<i)break;const c=Jr(n,i);a.enqueue(Ps(o?c:Is.decode(c),e)),r=0}if(i===0||i>t){a.enqueue(Ss);break}}}})}const gh=4;function vt(t){if(t)return Xw(t)}function Xw(t){for(var e in vt.prototype)t[e]=vt.prototype[e];return t}vt.prototype.on=vt.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},vt.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},vt.prototype.off=vt.prototype.removeListener=vt.prototype.removeAllListeners=vt.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this},vt.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this},vt.prototype.emitReserved=vt.prototype.emit,vt.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},vt.prototype.hasListeners=function(t){return!!this.listeners(t).length};const zt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function yh(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const Zw=zt.setTimeout,Jw=zt.clearTimeout;function Qr(t,e){e.useNativeTimers?(t.setTimeoutFn=Zw.bind(zt),t.clearTimeoutFn=Jw.bind(zt)):(t.setTimeoutFn=zt.setTimeout.bind(zt),t.clearTimeoutFn=zt.clearTimeout.bind(zt))}const Qw=1.33;function tv(t){return typeof t=="string"?ev(t):Math.ceil((t.byteLength||t.size)*Qw)}function ev(t){let e=0,n=0;for(let r=0,i=t.length;r<i;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function nv(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function rv(t){let e={},n=t.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class iv extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Ms extends vt{constructor(e){super(),this.writable=!1,Qr(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new iv(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=Ps(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=nv(e);return n.length?"?"+n:""}}const wh="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Rs=64,ov={};let vh=0,ti=0,_h;function bh(t){let e="";do e=wh[t%Rs]+e,t=Math.floor(t/Rs);while(t>0);return e}function xh(){const t=bh(+new Date);return t!==_h?(vh=0,_h=t):t+"."+bh(vh++)}for(;ti<Rs;ti++)ov[wh[ti]]=ti;let Ch=!1;try{Ch=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const sv=Ch;function kh(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||sv))return new XMLHttpRequest}catch{}if(!e)try{return new zt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function O_(){}function av(){}const cv=function(){return new kh({xdomain:!1}).responseType!=null}();class lv extends Ms{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let i=location.port;i||(i=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}const n=e&&e.forceBase64;this.supportsBinary=cv&&!n,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};qw(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Kw(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=xh()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ne(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class ne extends vt{constructor(e,n){super(),Qr(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.data=n.data!==void 0?n.data:null,this.create()}create(){var e;const n=yh(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new kh(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=ne.requestsCount++,ne.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=av,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ne.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(ne.requestsCount=0,ne.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Eh);else if(typeof addEventListener=="function"){const t="onpagehide"in zt?"pagehide":"unload";addEventListener(t,Eh,!1)}}function Eh(){for(let t in ne.requests)ne.requests.hasOwnProperty(t)&&ne.requests[t].abort()}var uv={},ei={};ei.byteLength=fv,ei.toByteArray=mv,ei.fromByteArray=wv;for(var re=[],jt=[],dv=typeof Uint8Array<"u"?Uint8Array:Array,Ns="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dn=0,hv=Ns.length;dn<hv;++dn)re[dn]=Ns[dn],jt[Ns.charCodeAt(dn)]=dn;jt[45]=62,jt[95]=63;function Sh(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function fv(t){var e=Sh(t),n=e[0],r=e[1];return(n+r)*3/4-r}function pv(t,e,n){return(e+n)*3/4-n}function mv(t){var e,n=Sh(t),r=n[0],i=n[1],o=new dv(pv(t,r,i)),s=0,a=i>0?r-4:r,c;for(c=0;c<a;c+=4)e=jt[t.charCodeAt(c)]<<18|jt[t.charCodeAt(c+1)]<<12|jt[t.charCodeAt(c+2)]<<6|jt[t.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=jt[t.charCodeAt(c)]<<2|jt[t.charCodeAt(c+1)]>>4,o[s++]=e&255),i===1&&(e=jt[t.charCodeAt(c)]<<10|jt[t.charCodeAt(c+1)]<<4|jt[t.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function gv(t){return re[t>>18&63]+re[t>>12&63]+re[t>>6&63]+re[t&63]}function yv(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(gv(r));return i.join("")}function wv(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;s<a;s+=o)i.push(yv(t,s,s+o>a?a:s+o));return r===1?(e=t[n-1],i.push(re[e>>2]+re[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(re[e>>10]+re[e>>4&63]+re[e<<2&63]+"=")),i.join("")}var Ds={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Ds.read=function(t,e,n,r,i){var o,s,a=i*8-r-1,c=(1<<a)-1,h=c>>1,l=-7,f=n?i-1:0,m=n?-1:1,g=t[e+f];for(f+=m,o=g&(1<<-l)-1,g>>=-l,l+=a;l>0;o=o*256+t[e+f],f+=m,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=s*256+t[e+f],f+=m,l-=8);if(o===0)o=1-h;else{if(o===c)return s?NaN:(g?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-h}return(g?-1:1)*s*Math.pow(2,o-r)},Ds.write=function(t,e,n,r,i,o){var s,a,c,h=o*8-i-1,l=(1<<h)-1,f=l>>1,m=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=r?0:o-1,_=r?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+f>=1?e+=m/c:e+=m*Math.pow(2,1-f),e*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(e*c-1)*Math.pow(2,i),s=s+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+g]=a&255,g+=_,a/=256,i-=8);for(s=s<<i|a,h+=i;h>0;t[n+g]=s&255,g+=_,s/=256,h-=8);t[n+g-_]|=v*128};/*!
101
101
  * The buffer module from node.js, for the browser.
102
102
  *
103
103
  * @author Feross Aboukhadijeh <https://feross.org>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "deskcord",
3
3
  "private": false,
4
- "version": "0.9.0",
4
+ "version": "0.9.1",
5
5
  "author": "Maxime Bertonnier <m.bertonnier@gmail.com>",
6
6
  "homepage": "https://deskcord.chat",
7
7
  "type": "module",