collabdocchat 2.5.2 → 2.5.4

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.
@@ -1,4 +1,4 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();const Me="http://localhost:8765/api";class Be{async login(e,n){const a=await fetch(`${Me}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:n})});if(!a.ok){const l=await a.json();throw new Error(l.message)}return await a.json()}async register(e,n){const a=await fetch(`${Me}/auth/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:n})});if(!a.ok){const l=await a.json();throw new Error(l.message)}return await a.json()}async getCurrentUser(){const e=localStorage.getItem("token"),n=await fetch(`${Me}/auth/me`,{headers:{Authorization:`Bearer ${e}`}});if(!n.ok)throw new Error("获取用户信息失败");return(await n.json()).user}logout(){localStorage.removeItem("token"),window.location.reload()}}class Ct{constructor(){this.ws=null,this.listeners=new Map}connect(e){this.ws=new WebSocket("ws://localhost:8765"),this.ws.onopen=()=>{console.log("✅ WebSocket 连接成功"),this.send({type:"auth",token:e})},this.ws.onmessage=n=>{const a=JSON.parse(n.data);this.notifyListeners(a.type,a)},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n)},this.ws.onclose=()=>{console.log("🔌 WebSocket 连接关闭"),setTimeout(()=>this.connect(e),3e3)}}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(e))}on(e,n){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(n)}off(e,n){if(this.listeners.has(e)){const a=this.listeners.get(e),l=a.indexOf(n);l>-1&&a.splice(l,1)}}notifyListeners(e,n){this.listeners.has(e)&&this.listeners.get(e).forEach(a=>a(n))}joinGroup(e){this.send({type:"join_group",groupId:e})}sendChatMessage(e,n,a){this.send({type:"chat_message",groupId:e,username:n,content:a})}syncDocument(e,n,a){this.send({type:"document_sync",documentId:e,content:n,cursorPosition:a})}respondToCall(e,n){this.send({type:"call_response",groupId:e,username:n})}sendTyping(e,n,a){this.send({type:"typing",documentId:e,username:n,isTyping:a})}sendWhiteboardDraw(e,n){this.send({type:"whiteboard_draw",groupId:e,...n})}sendWhiteboardClear(e){this.send({type:"whiteboard_clear",groupId:e})}}function zt(t){const e=document.getElementById("app"),n=new Be;e.innerHTML=`
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();const Me="http://localhost:3000/api";class Be{async login(e,n){const a=await fetch(`${Me}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:n})});if(!a.ok){const l=await a.json();throw new Error(l.message)}return await a.json()}async register(e,n){const a=await fetch(`${Me}/auth/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:n})});if(!a.ok){const l=await a.json();throw new Error(l.message)}return await a.json()}async getCurrentUser(){const e=localStorage.getItem("token"),n=await fetch(`${Me}/auth/me`,{headers:{Authorization:`Bearer ${e}`}});if(!n.ok)throw new Error("获取用户信息失败");return(await n.json()).user}logout(){localStorage.removeItem("token"),window.location.reload()}}class Ct{constructor(){this.ws=null,this.listeners=new Map}connect(e){this.ws=new WebSocket("ws://localhost:3000"),this.ws.onopen=()=>{console.log("✅ WebSocket 连接成功"),this.send({type:"auth",token:e})},this.ws.onmessage=n=>{const a=JSON.parse(n.data);this.notifyListeners(a.type,a)},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n)},this.ws.onclose=()=>{console.log("🔌 WebSocket 连接关闭"),setTimeout(()=>this.connect(e),3e3)}}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(e))}on(e,n){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(n)}off(e,n){if(this.listeners.has(e)){const a=this.listeners.get(e),l=a.indexOf(n);l>-1&&a.splice(l,1)}}notifyListeners(e,n){this.listeners.has(e)&&this.listeners.get(e).forEach(a=>a(n))}joinGroup(e){this.send({type:"join_group",groupId:e})}sendChatMessage(e,n,a){this.send({type:"chat_message",groupId:e,username:n,content:a})}syncDocument(e,n,a){this.send({type:"document_sync",documentId:e,content:n,cursorPosition:a})}respondToCall(e,n){this.send({type:"call_response",groupId:e,username:n})}sendTyping(e,n,a){this.send({type:"typing",documentId:e,username:n,isTyping:a})}sendWhiteboardDraw(e,n){this.send({type:"whiteboard_draw",groupId:e,...n})}sendWhiteboardClear(e){this.send({type:"whiteboard_clear",groupId:e})}}function zt(t){const e=document.getElementById("app"),n=new Be;e.innerHTML=`
2
2
  <div class="login-container">
3
3
  <div class="login-card">
4
4
  <div class="login-header">
@@ -48,7 +48,7 @@
48
48
  </div>
49
49
  </div>
50
50
  </div>
51
- `,document.getElementById("showRegister").addEventListener("click",()=>{document.getElementById("loginSection").classList.add("hidden"),document.getElementById("registerSection").classList.remove("hidden")}),document.getElementById("showLogin").addEventListener("click",()=>{document.getElementById("registerSection").classList.add("hidden"),document.getElementById("loginSection").classList.remove("hidden")}),document.getElementById("loginForm").addEventListener("submit",async a=>{a.preventDefault();const l=new FormData(a.target),o=l.get("username"),i=l.get("password");try{const S=await n.login(o,i);t(S.user,S.token)}catch(S){document.getElementById("loginError").textContent=S.message}}),document.getElementById("registerForm").addEventListener("submit",async a=>{a.preventDefault();const l=new FormData(a.target),o=l.get("username"),i=l.get("password");try{const S=await n.register(o,i);t(S.user,S.token)}catch(S){document.getElementById("registerError").textContent=S.message}})}const Ce="http://localhost:8765/api";class ct{constructor(){this.token=localStorage.getItem("token")}async request(e,n={}){const a=await fetch(`${Ce}${e}`,{...n,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`,...n.headers}});if(!a.ok){const l=await a.json().catch(()=>({message:"请求失败"}));throw console.error("API 错误:",{endpoint:e,status:a.status,error:l}),new Error(l.message||`请求失败: ${a.status}`)}return await a.json()}async getGroups(){return await this.request("/groups")}async getAllGroups(){return await this.request("/groups/all")}async getGroup(e){return await this.request(`/groups/${e}`)}async createGroup(e,n,a){return await this.request("/groups",{method:"POST",body:JSON.stringify({name:e,description:n,members:a})})}async joinGroup(e){return await this.request(`/groups/${e}/join`,{method:"POST"})}async leaveGroup(e){return await this.request(`/groups/${e}/leave`,{method:"POST"})}async addMember(e,n){return await this.request(`/groups/${e}/members`,{method:"POST",body:JSON.stringify({userId:n})})}async removeMember(e,n){return await this.request(`/groups/${e}/members/${n}`,{method:"DELETE"})}async setMuteAll(e,n){return await this.request(`/groups/${e}/mute/all`,{method:"POST",body:JSON.stringify({enabled:n})})}async setUserMute(e,n,a){return await this.request(`/groups/${e}/mute/users/${n}`,{method:"POST",body:JSON.stringify({muted:a})})}async getAllUsers(){return await this.request("/auth/users")}async getGroupMessages(e){return await this.request(`/groups/${e}/messages`)}async randomCall(e,n=1){return await this.request(`/groups/${e}/call`,{method:"POST",body:JSON.stringify({count:n})})}async clearGroupMessages(e){return await this.request(`/groups/${e}/messages`,{method:"DELETE",body:JSON.stringify({deleteAll:!0})})}async getTasks(e){return await this.request(`/tasks/group/${e}`)}async getMyTasks(){return await this.request("/tasks/my")}async createTask(e){return await this.request("/tasks",{method:"POST",body:JSON.stringify(e)})}async updateTaskStatus(e,n){return await this.request(`/tasks/${e}/status`,{method:"PATCH",body:JSON.stringify({status:n})})}async deleteTask(e){return await this.request(`/tasks/${e}`,{method:"DELETE"})}async getDocuments(e){return await this.request(`/documents/group/${e}`)}async getDocument(e){return await this.request(`/documents/${e}`)}async createDocument(e,n,a,l=[]){return await this.request("/documents",{method:"POST",body:JSON.stringify({title:e,content:n,groupId:a,editableMembers:l})})}async updateDocument(e,n){return await this.request(`/documents/${e}`,{method:"PATCH",body:JSON.stringify({content:n})})}async updateDocumentPermissions(e,n){return await this.request(`/documents/${e}/permissions`,{method:"PATCH",body:JSON.stringify({editableMembers:n})})}async getDocumentVersions(e){return await this.request(`/documents/${e}/versions`)}async deleteDocument(e){return await this.request(`/documents/${e}`,{method:"DELETE"})}async getAuditLogs(e={},n={}){const a=new URLSearchParams;Object.keys(e).forEach(o=>{e[o]&&a.append(o,e[o])}),Object.keys(n).forEach(o=>{n[o]&&a.append(o,n[o])});const l=a.toString();return await this.request(`/audit${l?"?"+l:""}`)}async getUserActivityStats(e,n={}){const l=new URLSearchParams(n).toString();return await this.request(`/audit/user-stats/${e}${l?"?"+l:""}`)}async getDocumentEditHistory(e,n=20){return await this.request(`/audit/document-history/${e}?limit=${n}`)}async getGroupAuditLogs(e,n={},a={}){const l=new URLSearchParams;Object.keys(n).forEach(i=>{n[i]&&l.append(i,n[i])}),Object.keys(a).forEach(i=>{a[i]&&l.append(i,a[i])});const o=l.toString();return await this.request(`/audit/group/${e}${o?"?"+o:""}`)}async getAuditSummary(e={}){const a=new URLSearchParams(e).toString();return await this.request(`/audit/stats/summary${a?"?"+a:""}`)}async getAuditLogDetail(e){return await this.request(`/audit/${e}`)}async clearAuditLogs(e={}){return await this.request("/audit",{method:"DELETE",body:JSON.stringify(e)})}async uploadFile(e,n,a=""){const l=new FormData;l.append("file",n),l.append("groupId",e),a&&l.append("description",a);const o=await fetch(`${Ce}/files/upload`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:l});if(!o.ok){const i=await o.json().catch(()=>({message:"上传失败"}));throw new Error(i.message||"上传失败")}return await o.json()}async getGroupFiles(e){return await this.request(`/files/group/${e}`)}async deleteFile(e){return await this.request(`/files/${e}`,{method:"DELETE"})}getFileDownloadUrl(e){return`${Ce}/files/${e}/download?token=${this.token}`}async createPoll(e){return await this.request("/polls",{method:"POST",body:JSON.stringify(e)})}async getGroupPolls(e){return await this.request(`/polls/group/${e}`)}async getPoll(e){return await this.request(`/polls/${e}`)}async vote(e,n){return await this.request(`/polls/${e}/vote`,{method:"POST",body:JSON.stringify({optionIndexes:n})})}async endPoll(e){return await this.request(`/polls/${e}/end`,{method:"PUT"})}async deletePoll(e){return await this.request(`/polls/${e}`,{method:"DELETE"})}}function we(t){if(typeof t!="string"||!t)throw new Error("expected a non-empty string, got: "+t)}function ze(t){if(typeof t!="number")throw new Error("expected a number, got: "+t)}const jt=1,Dt=1,me="emoji",he="keyvalue",Ge="favorites",_t="tokens",pt="tokens",At="unicode",ut="count",Pt="group",Ft="order",gt="group-order",He="eTag",Te="url",Qe="skinTone",be="readonly",We="readwrite",mt="skinUnicodes",Ot="skinUnicodes",Ht="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",Nt="en";function Ut(t,e){const n=new Set,a=[];for(const l of t){const o=e(l);n.has(o)||(n.add(o),a.push(l))}return a}function et(t){return Ut(t,e=>e.unicode)}function Rt(t){function e(n,a,l){const o=a?t.createObjectStore(n,{keyPath:a}):t.createObjectStore(n);if(l)for(const[i,[S,N]]of Object.entries(l))o.createIndex(i,S,{multiEntry:N});return o}e(he),e(me,At,{[pt]:[_t,!0],[gt]:[[Pt,Ft]],[mt]:[Ot,!0]}),e(Ge,void 0,{[ut]:[""]})}const Ne={},Le={},Ie={};function yt(t,e,n){n.onerror=()=>e(n.error),n.onblocked=()=>e(new Error("IDB blocked")),n.onsuccess=()=>t(n.result)}async function qt(t){const e=await new Promise((n,a)=>{const l=indexedDB.open(t,jt);Ne[t]=l,l.onupgradeneeded=o=>{o.oldVersion<Dt&&Rt(l.result)},yt(n,a,l)});return e.onclose=()=>Ve(t),e}function Gt(t){return Le[t]||(Le[t]=qt(t)),Le[t]}function pe(t,e,n,a){return new Promise((l,o)=>{const i=t.transaction(e,n,{durability:"relaxed"}),S=typeof e=="string"?i.objectStore(e):e.map($=>i.objectStore($));let N;a(S,i,$=>{N=$}),i.oncomplete=()=>l(N),i.onerror=()=>o(i.error)})}function Ve(t){const e=Ne[t],n=e&&e.result;if(n){n.close();const a=Ie[t];if(a)for(const l of a)l()}delete Ne[t],delete Le[t],delete Ie[t]}function Wt(t){return new Promise((e,n)=>{Ve(t);const a=indexedDB.deleteDatabase(t);yt(e,n,a)})}function Vt(t,e){let n=Ie[t];n||(n=Ie[t]=[]),n.push(e)}const Kt=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function ye(t){return t.split(/[\s_]+/).map(e=>!e.match(/\w/)||Kt.has(e)?e.toLowerCase():e.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const Yt=2;function ht(t){return t.filter(Boolean).map(e=>e.toLowerCase()).filter(e=>e.length>=Yt)}function Jt(t){return t.map(({annotation:n,emoticon:a,group:l,order:o,shortcodes:i,skins:S,tags:N,emoji:$,version:D})=>{const H=[...new Set(ht([...(i||[]).map(ye).flat(),...(N||[]).map(ye).flat(),...ye(n),a]))].sort(),_={annotation:n,group:l,order:o,tags:N,tokens:H,unicode:$,version:D};if(a&&(_.emoticon=a),i&&(_.shortcodes=i),S){_.skinTones=[],_.skinUnicodes=[],_.skinVersions=[];for(const{tone:R,emoji:ae,version:Z}of S)_.skinTones.push(R),_.skinUnicodes.push(ae),_.skinVersions.push(Z)}return _})}function bt(t,e,n,a){t[e](n).onsuccess=l=>a&&a(l.target.result)}function ge(t,e,n){bt(t,"get",e,n)}function vt(t,e,n){bt(t,"getAll",e,n)}function Ke(t){t.commit&&t.commit()}function Xt(t,e){let n=t[0];for(let a=1;a<t.length;a++){const l=t[a];e(n)>e(l)&&(n=l)}return n}function xt(t,e){const n=Xt(t,l=>l.length),a=[];for(const l of n)t.some(o=>o.findIndex(i=>e(i)===e(l))===-1)||a.push(l);return a}async function Zt(t){return!await Ye(t,he,Te)}async function Qt(t,e,n){const[a,l]=await Promise.all([He,Te].map(o=>Ye(t,he,o)));return a===n&&l===e}async function ea(t,e){return pe(t,me,be,(a,l,o)=>{let i;const S=()=>{a.getAll(i&&IDBKeyRange.lowerBound(i,!0),50).onsuccess=N=>{const $=N.target.result;for(const D of $)if(i=D.unicode,e(D))return o(D);if($.length<50)return o();S()}};S()})}async function ft(t,e,n,a){try{const l=Jt(e);await pe(t,[me,he],We,([o,i],S)=>{let N,$,D=0;function H(){++D===2&&_()}function _(){if(!(N===a&&$===n)){o.clear();for(const R of l)o.put(R);i.put(a,He),i.put(n,Te),Ke(S)}}ge(i,He,R=>{N=R,H()}),ge(i,Te,R=>{$=R,H()})})}finally{}}async function ta(t,e){return pe(t,me,be,(n,a,l)=>{const o=IDBKeyRange.bound([e,0],[e+1,0],!1,!0);vt(n.index(gt),o,l)})}async function wt(t,e){const n=ht(ye(e));return n.length?pe(t,me,be,(a,l,o)=>{const i=[],S=()=>{i.length===n.length&&N()},N=()=>{const $=xt(i,D=>D.unicode);o($.sort((D,H)=>D.order<H.order?-1:1))};for(let $=0;$<n.length;$++){const D=n[$],H=$===n.length-1?IDBKeyRange.bound(D,D+"￿",!1,!0):IDBKeyRange.only(D);vt(a.index(pt),H,_=>{i.push(_),S()})}}):[]}async function aa(t,e){const n=await wt(t,e);return n.length?n.filter(a=>(a.shortcodes||[]).map(o=>o.toLowerCase()).includes(e.toLowerCase()))[0]||null:await ea(t,l=>(l.shortcodes||[]).includes(e.toLowerCase()))||null}async function na(t,e){return pe(t,me,be,(n,a,l)=>ge(n,e,o=>{if(o)return l(o);ge(n.index(mt),e,i=>l(i||null))}))}function Ye(t,e,n){return pe(t,e,be,(a,l,o)=>ge(a,n,o))}function sa(t,e,n,a){return pe(t,e,We,(l,o)=>{l.put(a,n),Ke(o)})}function oa(t,e){return pe(t,Ge,We,(n,a)=>ge(n,e,l=>{n.put((l||0)+1,e),Ke(a)}))}function ia(t,e,n){return n===0?[]:pe(t,[Ge,me],be,([a,l],o,i)=>{const S=[];a.index(ut).openCursor(void 0,"prev").onsuccess=N=>{const $=N.target.result;if(!$)return i(S);function D(R){if(S.push(R),S.length===n)return i(S);$.continue()}const H=$.primaryKey,_=e.byName(H);if(_)return D(_);ge(l,H,R=>{if(R)return D(R);$.continue()})}})}const ke="";function ra(t,e){const n=new Map;for(const l of t){const o=e(l);for(const i of o){let S=n;for(let $=0;$<i.length;$++){const D=i.charAt($);let H=S.get(D);H||(H=new Map,S.set(D,H)),S=H}let N=S.get(ke);N||(N=[],S.set(ke,N)),N.push(l)}}return(l,o)=>{let i=n;for(let $=0;$<l.length;$++){const D=l.charAt($),H=i.get(D);if(H)i=H;else return[]}if(o)return i.get(ke)||[];const S=[],N=[i];for(;N.length;){const D=[...N.shift().entries()].sort((H,_)=>H[0]<_[0]?-1:1);for(const[H,_]of D)H===ke?S.push(..._):N.push(_)}return S}}const da=["name","url"];function la(t){const e=t&&Array.isArray(t),n=e&&t.length&&(!t[0]||da.some(a=>!(a in t[0])));if(!e||n)throw new Error("Custom emojis are in the wrong format")}function tt(t){la(t);const e=(_,R)=>_.name.toLowerCase()<R.name.toLowerCase()?-1:1,n=t.sort(e),l=ra(t,_=>{const R=new Set;if(_.shortcodes)for(const ae of _.shortcodes)for(const Z of ye(ae))R.add(Z);return R}),o=_=>l(_,!0),i=_=>l(_,!1),S=_=>{const R=ye(_),ae=R.map((Z,se)=>(se<R.length-1?o:i)(Z));return xt(ae,Z=>Z.name).sort(e)},N=new Map,$=new Map;for(const _ of t){$.set(_.name.toLowerCase(),_);for(const R of _.shortcodes||[])N.set(R.toLowerCase(),_)}return{all:n,search:S,byShortcode:_=>N.get(_.toLowerCase()),byName:_=>$.get(_.toLowerCase())}}const ca=typeof wrappedJSObject<"u";function xe(t){if(!t)return t;if(ca&&(t=structuredClone(t)),delete t.tokens,t.skinTones){const e=t.skinTones.length;t.skins=Array(e);for(let n=0;n<e;n++)t.skins[n]={tone:t.skinTones[n],unicode:t.skinUnicodes[n],version:t.skinVersions[n]};delete t.skinTones,delete t.skinUnicodes,delete t.skinVersions}return t}function kt(t){t||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const pa=["annotation","emoji","group","order","version"];function ua(t){if(!t||!Array.isArray(t)||!t[0]||typeof t[0]!="object"||pa.some(e=>!(e in t[0])))throw new Error("Emoji data is in the wrong format")}function Et(t,e){if(Math.floor(t.status/100)!==2)throw new Error("Failed to fetch: "+e+": "+t.status)}async function ga(t){const e=await fetch(t,{method:"HEAD"});Et(e,t);const n=e.headers.get("etag");return kt(n),n}async function Ue(t){const e=await fetch(t);Et(e,t);const n=e.headers.get("etag");kt(n);const a=await e.json();return ua(a),[n,a]}function ma(t){for(var e="",n=new Uint8Array(t),a=n.byteLength,l=-1;++l<a;)e+=String.fromCharCode(n[l]);return e}function ya(t){for(var e=t.length,n=new ArrayBuffer(e),a=new Uint8Array(n),l=-1;++l<e;)a[l]=t.charCodeAt(l);return n}async function Lt(t){const e=JSON.stringify(t);let n=ya(e);const a=await crypto.subtle.digest("SHA-1",n),l=ma(a);return btoa(l)}async function ha(t,e){let n,a=await ga(e);if(!a){const l=await Ue(e);a=l[0],n=l[1],a||(a=await Lt(n))}await Qt(t,e,a)||(n||(n=(await Ue(e))[1]),await ft(t,n,e,a))}async function ba(t,e){let[n,a]=await Ue(e);n||(n=await Lt(a)),await ft(t,a,e,n)}async function va(t,e){try{await ha(t,e)}catch(n){if(n.name!=="InvalidStateError")throw n}}class xa{constructor({dataSource:e=Ht,locale:n=Nt,customEmoji:a=[]}={}){this.dataSource=e,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=tt(a),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const e=this._db=await Gt(this._dbName);Vt(this._dbName,this._clear);const n=this.dataSource;await Zt(e)?await ba(e,n):this._lazyUpdate=va(e,n)}async ready(){const e=async()=>(this._ready||(this._ready=this._init()),this._ready);await e(),this._db||await e()}async getEmojiByGroup(e){return ze(e),await this.ready(),et(await ta(this._db,e)).map(xe)}async getEmojiBySearchQuery(e){we(e),await this.ready();const n=this._custom.search(e),a=et(await wt(this._db,e)).map(xe);return[...n,...a]}async getEmojiByShortcode(e){we(e),await this.ready();const n=this._custom.byShortcode(e);return n||xe(await aa(this._db,e))}async getEmojiByUnicodeOrName(e){we(e),await this.ready();const n=this._custom.byName(e);return n||xe(await na(this._db,e))}async getPreferredSkinTone(){return await this.ready(),await Ye(this._db,he,Qe)||0}async setPreferredSkinTone(e){return ze(e),await this.ready(),sa(this._db,he,Qe,e)}async incrementFavoriteEmojiCount(e){return we(e),await this.ready(),oa(this._db,e)}async getTopFavoriteEmoji(e){return ze(e),await this.ready(),(await ia(this._db,this._custom,e)).map(xe)}set customEmoji(e){this._custom=tt(e)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await Ve(this._dbName)}async delete(){await this._shutdown(),await Wt(this._dbName)}}const Re=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([t,e,n])=>({id:t,emoji:e,name:n})),je=Re.slice(1),fa=2,at=6,$t=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function nt(t){return t.unicode.includes("‍")}const wa={"🫪":17,"🫩":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱‍♀️":4,"🤣":3,"👁️‍🗨️":2,"😀":1,"😐️":.7,"😃":.6},ka=1e3,Ea="🖐️",La=8,$a=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],Tt='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Ta=(t,e)=>t<e?-1:t>e?1:0,st=(t,e)=>{const n=document.createElement("canvas");n.width=n.height=1;const a=n.getContext("2d",{willReadFrequently:!0});return a.textBaseline="top",a.font=`100px ${Tt}`,a.fillStyle=e,a.scale(.01,.01),a.fillText(t,0,0),a.getImageData(0,0,1,1).data},Ia=(t,e)=>{const n=[...t].join(","),a=[...e].join(",");return n===a&&!n.startsWith("0,0,0,")};function Sa(t){const e=st(t,"#000"),n=st(t,"#fff");return e&&n&&Ia(e,n)}function Ba(){const t=Object.entries(wa);try{for(const[e,n]of t)if(Sa(e))return n}catch{}finally{}return t[0][1]}let De;const _e=()=>(De||(De=new Promise(t=>$t(()=>t(Ba())))),De),qe=new Map,Ma="️",Ca="\uD83C",za="‍",ja=127995,Da=57339;function _a(t,e){if(e===0)return t;const n=t.indexOf(za);return n!==-1?t.substring(0,n)+String.fromCodePoint(ja+e-1)+t.substring(n):(t.endsWith(Ma)&&(t=t.substring(0,t.length-1)),t+Ca+String.fromCodePoint(Da+e-1))}function ce(t){t.preventDefault(),t.stopPropagation()}function Ae(t,e,n){return e+=t?-1:1,e<0?e=n.length-1:e>=n.length&&(e=0),e}function It(t,e){const n=new Set,a=[];for(const l of t){const o=e(l);n.has(o)||(n.add(o),a.push(l))}return a}function Aa(t,e){const n=a=>{const l={};for(const o of a)typeof o.tone=="number"&&o.version<=e&&(l[o.tone]=o.unicode);return l};return t.map(({unicode:a,skins:l,shortcodes:o,url:i,name:S,category:N,annotation:$})=>({unicode:a,name:S,shortcodes:o,url:i,category:N,annotation:$,id:a||S,skins:l&&n(l)}))}const $e=requestAnimationFrame;let Pa=typeof ResizeObserver=="function";function Fa(t,e,n){let a;Pa?(a=new ResizeObserver(n),a.observe(t)):$e(n),e.addEventListener("abort",()=>{a&&a.disconnect()})}function ot(t){{const e=document.createRange();return e.selectNode(t.firstChild),e.getBoundingClientRect().width}}let Pe;function Oa(t,e,n){let a=!0;for(const l of t){const o=n(l);if(!o)continue;const i=ot(o);typeof Pe>"u"&&(Pe=ot(e));const S=i/1.8<Pe;qe.set(l.unicode,S),S||(a=!1)}return a}function Ha(t){return It(t,e=>e)}function Na(t){t&&(t.scrollTop=0)}function fe(t,e,n){let a=t.get(e);return a||(a=n(),t.set(e,a)),a}function it(t){return""+t}function Ua(t){const e=document.createElement("template");return e.innerHTML=t,e}const Ra=new WeakMap,qa=new WeakMap,Ga=Symbol("un-keyed"),Wa="replaceChildren"in Element.prototype;function Va(t,e){Wa?t.replaceChildren(...e):(t.innerHTML="",t.append(...e))}function Ka(t,e){let n=t.firstChild,a=0;for(;n;){if(e[a]!==n)return!0;n=n.nextSibling,a++}return a!==e.length}function Ya(t,e){const{targetNode:n}=e;let{targetParentNode:a}=e,l=!1;a?l=Ka(a,t):(l=!0,e.targetNode=void 0,e.targetParentNode=a=n.parentNode),l&&Va(a,t)}function Ja(t,e){for(const n of e){const{targetNode:a,currentExpression:l,binding:{expressionIndex:o,attributeName:i,attributeValuePre:S,attributeValuePost:N}}=n,$=t[o];if(l!==$)if(n.currentExpression=$,i)if($===null)a.removeAttribute(i);else{const D=S+it($)+N;a.setAttribute(i,D)}else{let D;Array.isArray($)?Ya($,n):$ instanceof Element?(D=$,a.replaceWith(D)):a.nodeValue=it($),D&&(n.targetNode=D)}}}function Xa(t){let e="",n=!1,a=!1,l=-1;const o=new Map,i=[];let S=0;for(let $=0,D=t.length;$<D;$++){const H=t[$];if(e+=H.slice(S),$===D-1)break;for(let U=0;U<H.length;U++)switch(H.charAt(U)){case"<":{H.charAt(U+1)==="/"?i.pop():(n=!0,i.push(++l));break}case">":{n=!1,a=!1;break}case"=":{a=!0;break}}const _=i[i.length-1],R=fe(o,_,()=>[]);let ae,Z,se;if(a){const U=/(\S+)="?([^"=]*)$/.exec(H);ae=U[1],Z=U[2];const V=/^([^">]*)("?)/.exec(t[$+1]);se=V[1],e=e.slice(0,-1*U[0].length),S=V[0].length}else S=0;const le={attributeName:ae,attributeValuePre:Z,attributeValuePost:se,expressionIndex:$};R.push(le),!n&&!a&&(e+=" ")}return{template:Ua(e),elementsToBindings:o}}function rt(t,e,n){for(let a=0;a<t.length;a++){const l=t[a],o=l.attributeName?e:e.firstChild,i={binding:l,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(i)}}function Za(t,e){const n=[];let a;if(e.size===1&&(a=e.get(0)))rt(a,t,n);else{const l=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);let o=t,i=-1;do{const S=e.get(++i);S&&rt(S,o,n)}while(o=l.nextNode())}return n}function Qa(t){const{template:e,elementsToBindings:n}=fe(Ra,t,()=>Xa(t)),a=e.cloneNode(!0).content.firstElementChild,l=Za(a,n);return function(i){return Ja(i,l),a}}function en(t){const e=fe(qa,t,()=>new Map);let n=Ga;function a(o,...i){const S=fe(e,o,()=>new Map);return fe(S,n,()=>Qa(o))(i)}function l(o,i,S){return o.map((N,$)=>{const D=n;n=S(N);try{return i(N,$)}finally{n=D}})}return{map:l,html:a}}function tn(t,e,n,a,l,o,i,S,N){const{labelWithSkin:$,titleForEmoji:D,unicodeWithSkin:H}=n,{html:_,map:R}=en(e);function ae(U,V,Q){return R(U,(ne,re)=>_`<button role="${V?"option":"menuitem"}" aria-selected="${V?re===e.activeSearchItem:null}" aria-label="${$(ne,e.currentSkinTone)}" title="${D(ne)}" class="${"emoji"+(V&&re===e.activeSearchItem?" active":"")+(ne.unicode?"":" custom-emoji")}" id="${`${Q}-${ne.id}`}" style="${ne.unicode?null:`--custom-emoji-background: url(${JSON.stringify(ne.url)})`}">${ne.unicode?H(ne,e.currentSkinTone):""}</button>`,ne=>`${Q}-${ne.id}`)}const se=_`<section data-ref="rootElement" class="picker" aria-label="${e.i18n.regionLabel}" style="${e.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${e.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(e.searchMode&&e.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${e.activeSearchItemId?`emo-${e.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${e.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${e.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${e.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${e.skinTonePickerExpanded?"hide-focus":""}" aria-label="${e.skinToneButtonLabel}" title="${e.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${e.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${e.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${e.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${e.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${e.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${e.i18n.skinTonesLabel}" aria-activedescendant="skintone-${e.activeSkinTone}" aria-hidden="${!e.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${R(e.skinTones,(U,V)=>_`<div id="skintone-${V}" class="emoji ${V===e.activeSkinTone?"active":""}" aria-selected="${V===e.activeSkinTone}" role="option" title="${e.i18n.skinTones[V]}" aria-label="${e.i18n.skinTones[V]}">${U}</div>`,U=>U)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${e.groups.length},1fr)" aria-label="${e.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${R(e.groups,U=>_`<button role="tab" class="nav-button" aria-controls="tab-${U.id}" aria-label="${e.i18n.categories[U.name]}" aria-selected="${!e.searchMode&&e.currentGroup.id===U.id}" title="${e.i18n.categories[U.name]}" data-group-id="${U.id}"><div class="nav-emoji emoji">${U.emoji}</div></button>`,U=>U.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(e.isRtl?-1:1)*e.currentGroupIndex*100}%)"></div></div><div class="message ${e.message?"":"gone"}" role="alert" aria-live="polite">${e.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!e.databaseLoaded||e.message?"gone":""}" role="${e.searchMode?"region":"tabpanel"}" aria-label="${e.searchMode?e.i18n.searchResultsLabel:e.i18n.categories[e.currentGroup.name]}" id="${e.searchMode?null:`tab-${e.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${R(e.currentEmojisWithCategories,(U,V)=>_`<div><div id="menu-label-${V}" class="category ${e.currentEmojisWithCategories.length===1&&e.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${e.searchMode?e.i18n.searchResultsLabel:U.category?U.category:e.currentEmojisWithCategories.length>1?e.i18n.categories.custom:e.i18n.categories[e.currentGroup.name]}</div><div class="emoji-menu ${V!==0&&!e.searchMode&&e.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil(U.emojis.length/e.numColumns)}`}" data-action="updateOnIntersection" role="${e.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${V}" id="${e.searchMode?"search-results":null}">${ae(U.emojis,e.searchMode,"emo")}</div></div>`,U=>U.category)}</div></div><div class="favorites onscreen emoji-menu ${e.message?"gone":""}" role="menu" aria-label="${e.i18n.favoritesLabel}" data-on-click="onEmojiClick">${ae(e.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,le=(U,V)=>{for(const Q of t.querySelectorAll(`[${U}]`))V(Q,Q.getAttribute(U))};if(N){t.appendChild(se);for(const U of["click","focusout","input","keydown","keyup"])le(`data-on-${U}`,(V,Q)=>{V.addEventListener(U,a[Q])});le("data-ref",(U,V)=>{o[V]=U}),i.addEventListener("abort",()=>{t.removeChild(se)})}le("data-action",(U,V)=>{let Q=S.get(V);Q||S.set(V,Q=new WeakSet),Q.has(U)||(Q.add(U),l[V](U))})}const Se=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t);function an(t){let e=!1,n;const a=new Map,l=new Set;let o;const i=()=>{if(e)return;const $=[...l];l.clear();try{for(const D of $)D()}finally{o=!1,l.size&&(o=!0,Se(i))}},S=new Proxy({},{get($,D){if(n){let H=a.get(D);H||(H=new Set,a.set(D,H)),H.add(n)}return $[D]},set($,D,H){if($[D]!==H){$[D]=H;const _=a.get(D);if(_){for(const R of _)l.add(R);o||(o=!0,Se(i))}}return!0}}),N=$=>{const D=()=>{const H=n;n=D;try{return $()}finally{n=H}};return D()};return t.addEventListener("abort",()=>{e=!0}),{state:S,createEffect:N}}function Fe(t,e,n){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++)if(!n(t[a],e[a]))return!1;return!0}const dt=new WeakMap;function nn(t,e,n){{const a=t.closest(".tabpanel");let l=dt.get(a);l||(l=new IntersectionObserver(n,{root:a,rootMargin:"50% 0px 50% 0px",threshold:0}),dt.set(a,l),e.addEventListener("abort",()=>{l.disconnect()})),l.observe(t)}}const Oe=[],{assign:Ee}=Object;function sn(t,e){const n={},a=new AbortController,l=a.signal,{state:o,createEffect:i}=an(l),S=new Map;Ee(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),Ee(o,e),Ee(o,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:La,isRtl:!1,currentGroupIndex:0,groups:je,databaseLoaded:!1,activeSearchItemId:void 0}),i(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const N=s=>{t.getElementById(s).focus()},$=s=>t.getElementById(`emo-${s.id}`),D=(s,c)=>{n.rootElement.dispatchEvent(new CustomEvent(s,{detail:c,bubbles:!0,composed:!0}))},H=(s,c)=>s.id===c.id,_=(s,c)=>{const{category:v,emojis:w}=s,{category:P,emojis:p}=c;return v!==P?!1:Fe(w,p,H)},R=s=>{Fe(o.currentEmojis,s,H)||(o.currentEmojis=s)},ae=s=>{o.searchMode!==s&&(o.searchMode=s)},Z=s=>{Fe(o.currentEmojisWithCategories,s,_)||(o.currentEmojisWithCategories=s)},se=(s,c)=>c&&s.skins&&s.skins[c]||s.unicode,V={labelWithSkin:(s,c)=>Ha([s.name||se(s,c),s.annotation,...s.shortcodes||Oe].filter(Boolean)).join(", "),titleForEmoji:s=>s.annotation||(s.shortcodes||Oe).join(", "),unicodeWithSkin:se},Q={onClickSkinToneButton:B,onEmojiClick:u,onNavClick:oe,onNavKeydown:K,onSearchKeydown:O,onSkinToneOptionsClick:k,onSkinToneOptionsFocusOut:r,onSkinToneOptionsKeydown:y,onSkinToneOptionsKeyup:g,onSearchInput:d},ne={calculateEmojiGridStyle:E,updateOnIntersection:F};let re=!0;i(()=>{tn(t,o,V,Q,ne,n,l,S,re),re=!1}),o.emojiVersion||_e().then(s=>{s||(o.message=o.i18n.emojiUnsupportedMessage)}),i(()=>{async function s(){let c=!1;const v=setTimeout(()=>{c=!0,o.message=o.i18n.loadingMessage},ka);try{await o.database.ready(),o.databaseLoaded=!0}catch(w){console.error(w),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(v),c&&(c=!1,o.message="")}}o.database&&s()}),i(()=>{o.pickerStyle=`
51
+ `,document.getElementById("showRegister").addEventListener("click",()=>{document.getElementById("loginSection").classList.add("hidden"),document.getElementById("registerSection").classList.remove("hidden")}),document.getElementById("showLogin").addEventListener("click",()=>{document.getElementById("registerSection").classList.add("hidden"),document.getElementById("loginSection").classList.remove("hidden")}),document.getElementById("loginForm").addEventListener("submit",async a=>{a.preventDefault();const l=new FormData(a.target),o=l.get("username"),i=l.get("password");try{const S=await n.login(o,i);t(S.user,S.token)}catch(S){document.getElementById("loginError").textContent=S.message}}),document.getElementById("registerForm").addEventListener("submit",async a=>{a.preventDefault();const l=new FormData(a.target),o=l.get("username"),i=l.get("password");try{const S=await n.register(o,i);t(S.user,S.token)}catch(S){document.getElementById("registerError").textContent=S.message}})}const Ce="http://localhost:3000/api";class ct{constructor(){this.token=localStorage.getItem("token")}async request(e,n={}){const a=await fetch(`${Ce}${e}`,{...n,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`,...n.headers}});if(!a.ok){const l=await a.json().catch(()=>({message:"请求失败"}));throw console.error("API 错误:",{endpoint:e,status:a.status,error:l}),new Error(l.message||`请求失败: ${a.status}`)}return await a.json()}async getGroups(){return await this.request("/groups")}async getAllGroups(){return await this.request("/groups/all")}async getGroup(e){return await this.request(`/groups/${e}`)}async createGroup(e,n,a){return await this.request("/groups",{method:"POST",body:JSON.stringify({name:e,description:n,members:a})})}async joinGroup(e){return await this.request(`/groups/${e}/join`,{method:"POST"})}async leaveGroup(e){return await this.request(`/groups/${e}/leave`,{method:"POST"})}async addMember(e,n){return await this.request(`/groups/${e}/members`,{method:"POST",body:JSON.stringify({userId:n})})}async removeMember(e,n){return await this.request(`/groups/${e}/members/${n}`,{method:"DELETE"})}async setMuteAll(e,n){return await this.request(`/groups/${e}/mute/all`,{method:"POST",body:JSON.stringify({enabled:n})})}async setUserMute(e,n,a){return await this.request(`/groups/${e}/mute/users/${n}`,{method:"POST",body:JSON.stringify({muted:a})})}async getAllUsers(){return await this.request("/auth/users")}async getGroupMessages(e){return await this.request(`/groups/${e}/messages`)}async randomCall(e,n=1){return await this.request(`/groups/${e}/call`,{method:"POST",body:JSON.stringify({count:n})})}async clearGroupMessages(e){return await this.request(`/groups/${e}/messages`,{method:"DELETE",body:JSON.stringify({deleteAll:!0})})}async getTasks(e){return await this.request(`/tasks/group/${e}`)}async getMyTasks(){return await this.request("/tasks/my")}async createTask(e){return await this.request("/tasks",{method:"POST",body:JSON.stringify(e)})}async updateTaskStatus(e,n){return await this.request(`/tasks/${e}/status`,{method:"PATCH",body:JSON.stringify({status:n})})}async deleteTask(e){return await this.request(`/tasks/${e}`,{method:"DELETE"})}async getDocuments(e){return await this.request(`/documents/group/${e}`)}async getDocument(e){return await this.request(`/documents/${e}`)}async createDocument(e,n,a,l=[]){return await this.request("/documents",{method:"POST",body:JSON.stringify({title:e,content:n,groupId:a,editableMembers:l})})}async updateDocument(e,n){return await this.request(`/documents/${e}`,{method:"PATCH",body:JSON.stringify({content:n})})}async updateDocumentPermissions(e,n){return await this.request(`/documents/${e}/permissions`,{method:"PATCH",body:JSON.stringify({editableMembers:n})})}async getDocumentVersions(e){return await this.request(`/documents/${e}/versions`)}async deleteDocument(e){return await this.request(`/documents/${e}`,{method:"DELETE"})}async getAuditLogs(e={},n={}){const a=new URLSearchParams;Object.keys(e).forEach(o=>{e[o]&&a.append(o,e[o])}),Object.keys(n).forEach(o=>{n[o]&&a.append(o,n[o])});const l=a.toString();return await this.request(`/audit${l?"?"+l:""}`)}async getUserActivityStats(e,n={}){const l=new URLSearchParams(n).toString();return await this.request(`/audit/user-stats/${e}${l?"?"+l:""}`)}async getDocumentEditHistory(e,n=20){return await this.request(`/audit/document-history/${e}?limit=${n}`)}async getGroupAuditLogs(e,n={},a={}){const l=new URLSearchParams;Object.keys(n).forEach(i=>{n[i]&&l.append(i,n[i])}),Object.keys(a).forEach(i=>{a[i]&&l.append(i,a[i])});const o=l.toString();return await this.request(`/audit/group/${e}${o?"?"+o:""}`)}async getAuditSummary(e={}){const a=new URLSearchParams(e).toString();return await this.request(`/audit/stats/summary${a?"?"+a:""}`)}async getAuditLogDetail(e){return await this.request(`/audit/${e}`)}async clearAuditLogs(e={}){return await this.request("/audit",{method:"DELETE",body:JSON.stringify(e)})}async uploadFile(e,n,a=""){const l=new FormData;l.append("file",n),l.append("groupId",e),a&&l.append("description",a);const o=await fetch(`${Ce}/files/upload`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:l});if(!o.ok){const i=await o.json().catch(()=>({message:"上传失败"}));throw new Error(i.message||"上传失败")}return await o.json()}async getGroupFiles(e){return await this.request(`/files/group/${e}`)}async deleteFile(e){return await this.request(`/files/${e}`,{method:"DELETE"})}getFileDownloadUrl(e){return`${Ce}/files/${e}/download?token=${this.token}`}async createPoll(e){return await this.request("/polls",{method:"POST",body:JSON.stringify(e)})}async getGroupPolls(e){return await this.request(`/polls/group/${e}`)}async getPoll(e){return await this.request(`/polls/${e}`)}async vote(e,n){return await this.request(`/polls/${e}/vote`,{method:"POST",body:JSON.stringify({optionIndexes:n})})}async endPoll(e){return await this.request(`/polls/${e}/end`,{method:"PUT"})}async deletePoll(e){return await this.request(`/polls/${e}`,{method:"DELETE"})}}function we(t){if(typeof t!="string"||!t)throw new Error("expected a non-empty string, got: "+t)}function ze(t){if(typeof t!="number")throw new Error("expected a number, got: "+t)}const jt=1,Dt=1,me="emoji",he="keyvalue",Ge="favorites",_t="tokens",pt="tokens",At="unicode",ut="count",Pt="group",Ft="order",gt="group-order",He="eTag",Te="url",Qe="skinTone",be="readonly",We="readwrite",mt="skinUnicodes",Ot="skinUnicodes",Ht="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",Nt="en";function Ut(t,e){const n=new Set,a=[];for(const l of t){const o=e(l);n.has(o)||(n.add(o),a.push(l))}return a}function et(t){return Ut(t,e=>e.unicode)}function Rt(t){function e(n,a,l){const o=a?t.createObjectStore(n,{keyPath:a}):t.createObjectStore(n);if(l)for(const[i,[S,N]]of Object.entries(l))o.createIndex(i,S,{multiEntry:N});return o}e(he),e(me,At,{[pt]:[_t,!0],[gt]:[[Pt,Ft]],[mt]:[Ot,!0]}),e(Ge,void 0,{[ut]:[""]})}const Ne={},Le={},Ie={};function yt(t,e,n){n.onerror=()=>e(n.error),n.onblocked=()=>e(new Error("IDB blocked")),n.onsuccess=()=>t(n.result)}async function qt(t){const e=await new Promise((n,a)=>{const l=indexedDB.open(t,jt);Ne[t]=l,l.onupgradeneeded=o=>{o.oldVersion<Dt&&Rt(l.result)},yt(n,a,l)});return e.onclose=()=>Ve(t),e}function Gt(t){return Le[t]||(Le[t]=qt(t)),Le[t]}function pe(t,e,n,a){return new Promise((l,o)=>{const i=t.transaction(e,n,{durability:"relaxed"}),S=typeof e=="string"?i.objectStore(e):e.map($=>i.objectStore($));let N;a(S,i,$=>{N=$}),i.oncomplete=()=>l(N),i.onerror=()=>o(i.error)})}function Ve(t){const e=Ne[t],n=e&&e.result;if(n){n.close();const a=Ie[t];if(a)for(const l of a)l()}delete Ne[t],delete Le[t],delete Ie[t]}function Wt(t){return new Promise((e,n)=>{Ve(t);const a=indexedDB.deleteDatabase(t);yt(e,n,a)})}function Vt(t,e){let n=Ie[t];n||(n=Ie[t]=[]),n.push(e)}const Kt=new Set([":D","XD",":'D","O:)",":X",":P",";P","XP",":L",":Z",":j","8D","XO","8)",":B",":O",":S",":'o","Dx","X(","D:",":C",">0)",":3","</3","<3","\\M/",":E","8#"]);function ye(t){return t.split(/[\s_]+/).map(e=>!e.match(/\w/)||Kt.has(e)?e.toLowerCase():e.replace(/[)(:,]/g,"").replace(/’/g,"'").toLowerCase()).filter(Boolean)}const Yt=2;function ht(t){return t.filter(Boolean).map(e=>e.toLowerCase()).filter(e=>e.length>=Yt)}function Jt(t){return t.map(({annotation:n,emoticon:a,group:l,order:o,shortcodes:i,skins:S,tags:N,emoji:$,version:D})=>{const H=[...new Set(ht([...(i||[]).map(ye).flat(),...(N||[]).map(ye).flat(),...ye(n),a]))].sort(),_={annotation:n,group:l,order:o,tags:N,tokens:H,unicode:$,version:D};if(a&&(_.emoticon=a),i&&(_.shortcodes=i),S){_.skinTones=[],_.skinUnicodes=[],_.skinVersions=[];for(const{tone:R,emoji:ae,version:Z}of S)_.skinTones.push(R),_.skinUnicodes.push(ae),_.skinVersions.push(Z)}return _})}function bt(t,e,n,a){t[e](n).onsuccess=l=>a&&a(l.target.result)}function ge(t,e,n){bt(t,"get",e,n)}function vt(t,e,n){bt(t,"getAll",e,n)}function Ke(t){t.commit&&t.commit()}function Xt(t,e){let n=t[0];for(let a=1;a<t.length;a++){const l=t[a];e(n)>e(l)&&(n=l)}return n}function xt(t,e){const n=Xt(t,l=>l.length),a=[];for(const l of n)t.some(o=>o.findIndex(i=>e(i)===e(l))===-1)||a.push(l);return a}async function Zt(t){return!await Ye(t,he,Te)}async function Qt(t,e,n){const[a,l]=await Promise.all([He,Te].map(o=>Ye(t,he,o)));return a===n&&l===e}async function ea(t,e){return pe(t,me,be,(a,l,o)=>{let i;const S=()=>{a.getAll(i&&IDBKeyRange.lowerBound(i,!0),50).onsuccess=N=>{const $=N.target.result;for(const D of $)if(i=D.unicode,e(D))return o(D);if($.length<50)return o();S()}};S()})}async function ft(t,e,n,a){try{const l=Jt(e);await pe(t,[me,he],We,([o,i],S)=>{let N,$,D=0;function H(){++D===2&&_()}function _(){if(!(N===a&&$===n)){o.clear();for(const R of l)o.put(R);i.put(a,He),i.put(n,Te),Ke(S)}}ge(i,He,R=>{N=R,H()}),ge(i,Te,R=>{$=R,H()})})}finally{}}async function ta(t,e){return pe(t,me,be,(n,a,l)=>{const o=IDBKeyRange.bound([e,0],[e+1,0],!1,!0);vt(n.index(gt),o,l)})}async function wt(t,e){const n=ht(ye(e));return n.length?pe(t,me,be,(a,l,o)=>{const i=[],S=()=>{i.length===n.length&&N()},N=()=>{const $=xt(i,D=>D.unicode);o($.sort((D,H)=>D.order<H.order?-1:1))};for(let $=0;$<n.length;$++){const D=n[$],H=$===n.length-1?IDBKeyRange.bound(D,D+"￿",!1,!0):IDBKeyRange.only(D);vt(a.index(pt),H,_=>{i.push(_),S()})}}):[]}async function aa(t,e){const n=await wt(t,e);return n.length?n.filter(a=>(a.shortcodes||[]).map(o=>o.toLowerCase()).includes(e.toLowerCase()))[0]||null:await ea(t,l=>(l.shortcodes||[]).includes(e.toLowerCase()))||null}async function na(t,e){return pe(t,me,be,(n,a,l)=>ge(n,e,o=>{if(o)return l(o);ge(n.index(mt),e,i=>l(i||null))}))}function Ye(t,e,n){return pe(t,e,be,(a,l,o)=>ge(a,n,o))}function sa(t,e,n,a){return pe(t,e,We,(l,o)=>{l.put(a,n),Ke(o)})}function oa(t,e){return pe(t,Ge,We,(n,a)=>ge(n,e,l=>{n.put((l||0)+1,e),Ke(a)}))}function ia(t,e,n){return n===0?[]:pe(t,[Ge,me],be,([a,l],o,i)=>{const S=[];a.index(ut).openCursor(void 0,"prev").onsuccess=N=>{const $=N.target.result;if(!$)return i(S);function D(R){if(S.push(R),S.length===n)return i(S);$.continue()}const H=$.primaryKey,_=e.byName(H);if(_)return D(_);ge(l,H,R=>{if(R)return D(R);$.continue()})}})}const ke="";function ra(t,e){const n=new Map;for(const l of t){const o=e(l);for(const i of o){let S=n;for(let $=0;$<i.length;$++){const D=i.charAt($);let H=S.get(D);H||(H=new Map,S.set(D,H)),S=H}let N=S.get(ke);N||(N=[],S.set(ke,N)),N.push(l)}}return(l,o)=>{let i=n;for(let $=0;$<l.length;$++){const D=l.charAt($),H=i.get(D);if(H)i=H;else return[]}if(o)return i.get(ke)||[];const S=[],N=[i];for(;N.length;){const D=[...N.shift().entries()].sort((H,_)=>H[0]<_[0]?-1:1);for(const[H,_]of D)H===ke?S.push(..._):N.push(_)}return S}}const da=["name","url"];function la(t){const e=t&&Array.isArray(t),n=e&&t.length&&(!t[0]||da.some(a=>!(a in t[0])));if(!e||n)throw new Error("Custom emojis are in the wrong format")}function tt(t){la(t);const e=(_,R)=>_.name.toLowerCase()<R.name.toLowerCase()?-1:1,n=t.sort(e),l=ra(t,_=>{const R=new Set;if(_.shortcodes)for(const ae of _.shortcodes)for(const Z of ye(ae))R.add(Z);return R}),o=_=>l(_,!0),i=_=>l(_,!1),S=_=>{const R=ye(_),ae=R.map((Z,se)=>(se<R.length-1?o:i)(Z));return xt(ae,Z=>Z.name).sort(e)},N=new Map,$=new Map;for(const _ of t){$.set(_.name.toLowerCase(),_);for(const R of _.shortcodes||[])N.set(R.toLowerCase(),_)}return{all:n,search:S,byShortcode:_=>N.get(_.toLowerCase()),byName:_=>$.get(_.toLowerCase())}}const ca=typeof wrappedJSObject<"u";function xe(t){if(!t)return t;if(ca&&(t=structuredClone(t)),delete t.tokens,t.skinTones){const e=t.skinTones.length;t.skins=Array(e);for(let n=0;n<e;n++)t.skins[n]={tone:t.skinTones[n],unicode:t.skinUnicodes[n],version:t.skinVersions[n]};delete t.skinTones,delete t.skinUnicodes,delete t.skinVersions}return t}function kt(t){t||console.warn("emoji-picker-element is more efficient if the dataSource server exposes an ETag header.")}const pa=["annotation","emoji","group","order","version"];function ua(t){if(!t||!Array.isArray(t)||!t[0]||typeof t[0]!="object"||pa.some(e=>!(e in t[0])))throw new Error("Emoji data is in the wrong format")}function Et(t,e){if(Math.floor(t.status/100)!==2)throw new Error("Failed to fetch: "+e+": "+t.status)}async function ga(t){const e=await fetch(t,{method:"HEAD"});Et(e,t);const n=e.headers.get("etag");return kt(n),n}async function Ue(t){const e=await fetch(t);Et(e,t);const n=e.headers.get("etag");kt(n);const a=await e.json();return ua(a),[n,a]}function ma(t){for(var e="",n=new Uint8Array(t),a=n.byteLength,l=-1;++l<a;)e+=String.fromCharCode(n[l]);return e}function ya(t){for(var e=t.length,n=new ArrayBuffer(e),a=new Uint8Array(n),l=-1;++l<e;)a[l]=t.charCodeAt(l);return n}async function Lt(t){const e=JSON.stringify(t);let n=ya(e);const a=await crypto.subtle.digest("SHA-1",n),l=ma(a);return btoa(l)}async function ha(t,e){let n,a=await ga(e);if(!a){const l=await Ue(e);a=l[0],n=l[1],a||(a=await Lt(n))}await Qt(t,e,a)||(n||(n=(await Ue(e))[1]),await ft(t,n,e,a))}async function ba(t,e){let[n,a]=await Ue(e);n||(n=await Lt(a)),await ft(t,a,e,n)}async function va(t,e){try{await ha(t,e)}catch(n){if(n.name!=="InvalidStateError")throw n}}class xa{constructor({dataSource:e=Ht,locale:n=Nt,customEmoji:a=[]}={}){this.dataSource=e,this.locale=n,this._dbName=`emoji-picker-element-${this.locale}`,this._db=void 0,this._lazyUpdate=void 0,this._custom=tt(a),this._clear=this._clear.bind(this),this._ready=this._init()}async _init(){const e=this._db=await Gt(this._dbName);Vt(this._dbName,this._clear);const n=this.dataSource;await Zt(e)?await ba(e,n):this._lazyUpdate=va(e,n)}async ready(){const e=async()=>(this._ready||(this._ready=this._init()),this._ready);await e(),this._db||await e()}async getEmojiByGroup(e){return ze(e),await this.ready(),et(await ta(this._db,e)).map(xe)}async getEmojiBySearchQuery(e){we(e),await this.ready();const n=this._custom.search(e),a=et(await wt(this._db,e)).map(xe);return[...n,...a]}async getEmojiByShortcode(e){we(e),await this.ready();const n=this._custom.byShortcode(e);return n||xe(await aa(this._db,e))}async getEmojiByUnicodeOrName(e){we(e),await this.ready();const n=this._custom.byName(e);return n||xe(await na(this._db,e))}async getPreferredSkinTone(){return await this.ready(),await Ye(this._db,he,Qe)||0}async setPreferredSkinTone(e){return ze(e),await this.ready(),sa(this._db,he,Qe,e)}async incrementFavoriteEmojiCount(e){return we(e),await this.ready(),oa(this._db,e)}async getTopFavoriteEmoji(e){return ze(e),await this.ready(),(await ia(this._db,this._custom,e)).map(xe)}set customEmoji(e){this._custom=tt(e)}get customEmoji(){return this._custom.all}async _shutdown(){await this.ready();try{await this._lazyUpdate}catch{}}_clear(){this._db=this._ready=this._lazyUpdate=void 0}async close(){await this._shutdown(),await Ve(this._dbName)}async delete(){await this._shutdown(),await Wt(this._dbName)}}const Re=[[-1,"✨","custom"],[0,"😀","smileys-emotion"],[1,"👋","people-body"],[3,"🐱","animals-nature"],[4,"🍎","food-drink"],[5,"🏠️","travel-places"],[6,"⚽","activities"],[7,"📝","objects"],[8,"⛔️","symbols"],[9,"🏁","flags"]].map(([t,e,n])=>({id:t,emoji:e,name:n})),je=Re.slice(1),fa=2,at=6,$t=typeof requestIdleCallback=="function"?requestIdleCallback:setTimeout;function nt(t){return t.unicode.includes("‍")}const wa={"🫪":17,"🫩":16,"🫨":15.1,"🫠":14,"🥲":13.1,"🥻":12.1,"🥰":11,"🤩":5,"👱‍♀️":4,"🤣":3,"👁️‍🗨️":2,"😀":1,"😐️":.7,"😃":.6},ka=1e3,Ea="🖐️",La=8,$a=["😊","😒","❤️","👍️","😍","😂","😭","☺️","😔","😩","😏","💕","🙌","😘"],Tt='"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif',Ta=(t,e)=>t<e?-1:t>e?1:0,st=(t,e)=>{const n=document.createElement("canvas");n.width=n.height=1;const a=n.getContext("2d",{willReadFrequently:!0});return a.textBaseline="top",a.font=`100px ${Tt}`,a.fillStyle=e,a.scale(.01,.01),a.fillText(t,0,0),a.getImageData(0,0,1,1).data},Ia=(t,e)=>{const n=[...t].join(","),a=[...e].join(",");return n===a&&!n.startsWith("0,0,0,")};function Sa(t){const e=st(t,"#000"),n=st(t,"#fff");return e&&n&&Ia(e,n)}function Ba(){const t=Object.entries(wa);try{for(const[e,n]of t)if(Sa(e))return n}catch{}finally{}return t[0][1]}let De;const _e=()=>(De||(De=new Promise(t=>$t(()=>t(Ba())))),De),qe=new Map,Ma="️",Ca="\uD83C",za="‍",ja=127995,Da=57339;function _a(t,e){if(e===0)return t;const n=t.indexOf(za);return n!==-1?t.substring(0,n)+String.fromCodePoint(ja+e-1)+t.substring(n):(t.endsWith(Ma)&&(t=t.substring(0,t.length-1)),t+Ca+String.fromCodePoint(Da+e-1))}function ce(t){t.preventDefault(),t.stopPropagation()}function Ae(t,e,n){return e+=t?-1:1,e<0?e=n.length-1:e>=n.length&&(e=0),e}function It(t,e){const n=new Set,a=[];for(const l of t){const o=e(l);n.has(o)||(n.add(o),a.push(l))}return a}function Aa(t,e){const n=a=>{const l={};for(const o of a)typeof o.tone=="number"&&o.version<=e&&(l[o.tone]=o.unicode);return l};return t.map(({unicode:a,skins:l,shortcodes:o,url:i,name:S,category:N,annotation:$})=>({unicode:a,name:S,shortcodes:o,url:i,category:N,annotation:$,id:a||S,skins:l&&n(l)}))}const $e=requestAnimationFrame;let Pa=typeof ResizeObserver=="function";function Fa(t,e,n){let a;Pa?(a=new ResizeObserver(n),a.observe(t)):$e(n),e.addEventListener("abort",()=>{a&&a.disconnect()})}function ot(t){{const e=document.createRange();return e.selectNode(t.firstChild),e.getBoundingClientRect().width}}let Pe;function Oa(t,e,n){let a=!0;for(const l of t){const o=n(l);if(!o)continue;const i=ot(o);typeof Pe>"u"&&(Pe=ot(e));const S=i/1.8<Pe;qe.set(l.unicode,S),S||(a=!1)}return a}function Ha(t){return It(t,e=>e)}function Na(t){t&&(t.scrollTop=0)}function fe(t,e,n){let a=t.get(e);return a||(a=n(),t.set(e,a)),a}function it(t){return""+t}function Ua(t){const e=document.createElement("template");return e.innerHTML=t,e}const Ra=new WeakMap,qa=new WeakMap,Ga=Symbol("un-keyed"),Wa="replaceChildren"in Element.prototype;function Va(t,e){Wa?t.replaceChildren(...e):(t.innerHTML="",t.append(...e))}function Ka(t,e){let n=t.firstChild,a=0;for(;n;){if(e[a]!==n)return!0;n=n.nextSibling,a++}return a!==e.length}function Ya(t,e){const{targetNode:n}=e;let{targetParentNode:a}=e,l=!1;a?l=Ka(a,t):(l=!0,e.targetNode=void 0,e.targetParentNode=a=n.parentNode),l&&Va(a,t)}function Ja(t,e){for(const n of e){const{targetNode:a,currentExpression:l,binding:{expressionIndex:o,attributeName:i,attributeValuePre:S,attributeValuePost:N}}=n,$=t[o];if(l!==$)if(n.currentExpression=$,i)if($===null)a.removeAttribute(i);else{const D=S+it($)+N;a.setAttribute(i,D)}else{let D;Array.isArray($)?Ya($,n):$ instanceof Element?(D=$,a.replaceWith(D)):a.nodeValue=it($),D&&(n.targetNode=D)}}}function Xa(t){let e="",n=!1,a=!1,l=-1;const o=new Map,i=[];let S=0;for(let $=0,D=t.length;$<D;$++){const H=t[$];if(e+=H.slice(S),$===D-1)break;for(let U=0;U<H.length;U++)switch(H.charAt(U)){case"<":{H.charAt(U+1)==="/"?i.pop():(n=!0,i.push(++l));break}case">":{n=!1,a=!1;break}case"=":{a=!0;break}}const _=i[i.length-1],R=fe(o,_,()=>[]);let ae,Z,se;if(a){const U=/(\S+)="?([^"=]*)$/.exec(H);ae=U[1],Z=U[2];const V=/^([^">]*)("?)/.exec(t[$+1]);se=V[1],e=e.slice(0,-1*U[0].length),S=V[0].length}else S=0;const le={attributeName:ae,attributeValuePre:Z,attributeValuePost:se,expressionIndex:$};R.push(le),!n&&!a&&(e+=" ")}return{template:Ua(e),elementsToBindings:o}}function rt(t,e,n){for(let a=0;a<t.length;a++){const l=t[a],o=l.attributeName?e:e.firstChild,i={binding:l,targetNode:o,targetParentNode:void 0,currentExpression:void 0};n.push(i)}}function Za(t,e){const n=[];let a;if(e.size===1&&(a=e.get(0)))rt(a,t,n);else{const l=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);let o=t,i=-1;do{const S=e.get(++i);S&&rt(S,o,n)}while(o=l.nextNode())}return n}function Qa(t){const{template:e,elementsToBindings:n}=fe(Ra,t,()=>Xa(t)),a=e.cloneNode(!0).content.firstElementChild,l=Za(a,n);return function(i){return Ja(i,l),a}}function en(t){const e=fe(qa,t,()=>new Map);let n=Ga;function a(o,...i){const S=fe(e,o,()=>new Map);return fe(S,n,()=>Qa(o))(i)}function l(o,i,S){return o.map((N,$)=>{const D=n;n=S(N);try{return i(N,$)}finally{n=D}})}return{map:l,html:a}}function tn(t,e,n,a,l,o,i,S,N){const{labelWithSkin:$,titleForEmoji:D,unicodeWithSkin:H}=n,{html:_,map:R}=en(e);function ae(U,V,Q){return R(U,(ne,re)=>_`<button role="${V?"option":"menuitem"}" aria-selected="${V?re===e.activeSearchItem:null}" aria-label="${$(ne,e.currentSkinTone)}" title="${D(ne)}" class="${"emoji"+(V&&re===e.activeSearchItem?" active":"")+(ne.unicode?"":" custom-emoji")}" id="${`${Q}-${ne.id}`}" style="${ne.unicode?null:`--custom-emoji-background: url(${JSON.stringify(ne.url)})`}">${ne.unicode?H(ne,e.currentSkinTone):""}</button>`,ne=>`${Q}-${ne.id}`)}const se=_`<section data-ref="rootElement" class="picker" aria-label="${e.i18n.regionLabel}" style="${e.pickerStyle||""}"><div class="pad-top"></div><div class="search-row"><div class="search-wrapper"><input id="search" class="search" type="search" role="combobox" enterkeyhint="search" placeholder="${e.i18n.searchLabel}" autocapitalize="none" autocomplete="off" spellcheck="true" aria-expanded="${!!(e.searchMode&&e.currentEmojis.length)}" aria-controls="search-results" aria-describedby="search-description" aria-autocomplete="list" aria-activedescendant="${e.activeSearchItemId?`emo-${e.activeSearchItemId}`:null}" data-ref="searchElement" data-on-input="onSearchInput" data-on-keydown="onSearchKeydown"><label class="sr-only" for="search">${e.i18n.searchLabel}</label> <span id="search-description" class="sr-only">${e.i18n.searchDescription}</span></div><div class="skintone-button-wrapper ${e.skinTonePickerExpandedAfterAnimation?"expanded":""}"><button id="skintone-button" class="emoji ${e.skinTonePickerExpanded?"hide-focus":""}" aria-label="${e.skinToneButtonLabel}" title="${e.skinToneButtonLabel}" aria-describedby="skintone-description" aria-haspopup="listbox" aria-expanded="${e.skinTonePickerExpanded}" aria-controls="skintone-list" data-on-click="onClickSkinToneButton">${e.skinToneButtonText||""}</button></div><span id="skintone-description" class="sr-only">${e.i18n.skinToneDescription}</span><div data-ref="skinToneDropdown" id="skintone-list" class="skintone-list hide-focus ${e.skinTonePickerExpanded?"":"hidden no-animate"}" style="transform:translateY(${e.skinTonePickerExpanded?0:"calc(-1 * var(--num-skintones) * var(--total-emoji-size))"})" role="listbox" aria-label="${e.i18n.skinTonesLabel}" aria-activedescendant="skintone-${e.activeSkinTone}" aria-hidden="${!e.skinTonePickerExpanded}" tabIndex="-1" data-on-focusout="onSkinToneOptionsFocusOut" data-on-click="onSkinToneOptionsClick" data-on-keydown="onSkinToneOptionsKeydown" data-on-keyup="onSkinToneOptionsKeyup">${R(e.skinTones,(U,V)=>_`<div id="skintone-${V}" class="emoji ${V===e.activeSkinTone?"active":""}" aria-selected="${V===e.activeSkinTone}" role="option" title="${e.i18n.skinTones[V]}" aria-label="${e.i18n.skinTones[V]}">${U}</div>`,U=>U)}</div></div><div class="nav" role="tablist" style="grid-template-columns:repeat(${e.groups.length},1fr)" aria-label="${e.i18n.categoriesLabel}" data-on-keydown="onNavKeydown" data-on-click="onNavClick">${R(e.groups,U=>_`<button role="tab" class="nav-button" aria-controls="tab-${U.id}" aria-label="${e.i18n.categories[U.name]}" aria-selected="${!e.searchMode&&e.currentGroup.id===U.id}" title="${e.i18n.categories[U.name]}" data-group-id="${U.id}"><div class="nav-emoji emoji">${U.emoji}</div></button>`,U=>U.id)}</div><div class="indicator-wrapper"><div class="indicator" style="transform:translateX(${(e.isRtl?-1:1)*e.currentGroupIndex*100}%)"></div></div><div class="message ${e.message?"":"gone"}" role="alert" aria-live="polite">${e.message||""}</div><div data-ref="tabpanelElement" class="tabpanel ${!e.databaseLoaded||e.message?"gone":""}" role="${e.searchMode?"region":"tabpanel"}" aria-label="${e.searchMode?e.i18n.searchResultsLabel:e.i18n.categories[e.currentGroup.name]}" id="${e.searchMode?null:`tab-${e.currentGroup.id}`}" tabIndex="0" data-on-click="onEmojiClick"><div data-action="calculateEmojiGridStyle">${R(e.currentEmojisWithCategories,(U,V)=>_`<div><div id="menu-label-${V}" class="category ${e.currentEmojisWithCategories.length===1&&e.currentEmojisWithCategories[0].category===""?"gone":""}" aria-hidden="true">${e.searchMode?e.i18n.searchResultsLabel:U.category?U.category:e.currentEmojisWithCategories.length>1?e.i18n.categories.custom:e.i18n.categories[e.currentGroup.name]}</div><div class="emoji-menu ${V!==0&&!e.searchMode&&e.currentGroup.id===-1?"visibility-auto":""}" style="${`--num-rows: ${Math.ceil(U.emojis.length/e.numColumns)}`}" data-action="updateOnIntersection" role="${e.searchMode?"listbox":"menu"}" aria-labelledby="menu-label-${V}" id="${e.searchMode?"search-results":null}">${ae(U.emojis,e.searchMode,"emo")}</div></div>`,U=>U.category)}</div></div><div class="favorites onscreen emoji-menu ${e.message?"gone":""}" role="menu" aria-label="${e.i18n.favoritesLabel}" data-on-click="onEmojiClick">${ae(e.currentFavorites,!1,"fav")}</div><button data-ref="baselineEmoji" aria-hidden="true" tabindex="-1" class="abs-pos hidden emoji baseline-emoji">😀</button></section>`,le=(U,V)=>{for(const Q of t.querySelectorAll(`[${U}]`))V(Q,Q.getAttribute(U))};if(N){t.appendChild(se);for(const U of["click","focusout","input","keydown","keyup"])le(`data-on-${U}`,(V,Q)=>{V.addEventListener(U,a[Q])});le("data-ref",(U,V)=>{o[V]=U}),i.addEventListener("abort",()=>{t.removeChild(se)})}le("data-action",(U,V)=>{let Q=S.get(V);Q||S.set(V,Q=new WeakSet),Q.has(U)||(Q.add(U),l[V](U))})}const Se=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t);function an(t){let e=!1,n;const a=new Map,l=new Set;let o;const i=()=>{if(e)return;const $=[...l];l.clear();try{for(const D of $)D()}finally{o=!1,l.size&&(o=!0,Se(i))}},S=new Proxy({},{get($,D){if(n){let H=a.get(D);H||(H=new Set,a.set(D,H)),H.add(n)}return $[D]},set($,D,H){if($[D]!==H){$[D]=H;const _=a.get(D);if(_){for(const R of _)l.add(R);o||(o=!0,Se(i))}}return!0}}),N=$=>{const D=()=>{const H=n;n=D;try{return $()}finally{n=H}};return D()};return t.addEventListener("abort",()=>{e=!0}),{state:S,createEffect:N}}function Fe(t,e,n){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++)if(!n(t[a],e[a]))return!1;return!0}const dt=new WeakMap;function nn(t,e,n){{const a=t.closest(".tabpanel");let l=dt.get(a);l||(l=new IntersectionObserver(n,{root:a,rootMargin:"50% 0px 50% 0px",threshold:0}),dt.set(a,l),e.addEventListener("abort",()=>{l.disconnect()})),l.observe(t)}}const Oe=[],{assign:Ee}=Object;function sn(t,e){const n={},a=new AbortController,l=a.signal,{state:o,createEffect:i}=an(l),S=new Map;Ee(o,{skinToneEmoji:void 0,i18n:void 0,database:void 0,customEmoji:void 0,customCategorySorting:void 0,emojiVersion:void 0}),Ee(o,e),Ee(o,{initialLoad:!0,currentEmojis:[],currentEmojisWithCategories:[],rawSearchText:"",searchText:"",searchMode:!1,activeSearchItem:-1,message:void 0,skinTonePickerExpanded:!1,skinTonePickerExpandedAfterAnimation:!1,currentSkinTone:0,activeSkinTone:0,skinToneButtonText:void 0,pickerStyle:void 0,skinToneButtonLabel:"",skinTones:[],currentFavorites:[],defaultFavoriteEmojis:void 0,numColumns:La,isRtl:!1,currentGroupIndex:0,groups:je,databaseLoaded:!1,activeSearchItemId:void 0}),i(()=>{o.currentGroup!==o.groups[o.currentGroupIndex]&&(o.currentGroup=o.groups[o.currentGroupIndex])});const N=s=>{t.getElementById(s).focus()},$=s=>t.getElementById(`emo-${s.id}`),D=(s,c)=>{n.rootElement.dispatchEvent(new CustomEvent(s,{detail:c,bubbles:!0,composed:!0}))},H=(s,c)=>s.id===c.id,_=(s,c)=>{const{category:v,emojis:w}=s,{category:P,emojis:p}=c;return v!==P?!1:Fe(w,p,H)},R=s=>{Fe(o.currentEmojis,s,H)||(o.currentEmojis=s)},ae=s=>{o.searchMode!==s&&(o.searchMode=s)},Z=s=>{Fe(o.currentEmojisWithCategories,s,_)||(o.currentEmojisWithCategories=s)},se=(s,c)=>c&&s.skins&&s.skins[c]||s.unicode,V={labelWithSkin:(s,c)=>Ha([s.name||se(s,c),s.annotation,...s.shortcodes||Oe].filter(Boolean)).join(", "),titleForEmoji:s=>s.annotation||(s.shortcodes||Oe).join(", "),unicodeWithSkin:se},Q={onClickSkinToneButton:B,onEmojiClick:u,onNavClick:oe,onNavKeydown:K,onSearchKeydown:O,onSkinToneOptionsClick:k,onSkinToneOptionsFocusOut:r,onSkinToneOptionsKeydown:y,onSkinToneOptionsKeyup:g,onSearchInput:d},ne={calculateEmojiGridStyle:E,updateOnIntersection:F};let re=!0;i(()=>{tn(t,o,V,Q,ne,n,l,S,re),re=!1}),o.emojiVersion||_e().then(s=>{s||(o.message=o.i18n.emojiUnsupportedMessage)}),i(()=>{async function s(){let c=!1;const v=setTimeout(()=>{c=!0,o.message=o.i18n.loadingMessage},ka);try{await o.database.ready(),o.databaseLoaded=!0}catch(w){console.error(w),o.message=o.i18n.networkErrorMessage}finally{clearTimeout(v),c&&(c=!1,o.message="")}}o.database&&s()}),i(()=>{o.pickerStyle=`
52
52
  --num-groups: ${o.groups.length};
53
53
  --indicator-opacity: ${o.searchMode?0:1};
54
54
  --num-skintones: ${at};`}),i(()=>{o.customEmoji&&o.database&&T()}),i(()=>{o.customEmoji&&o.customEmoji.length?o.groups!==Re&&(o.groups=Re):o.groups!==je&&(o.currentGroupIndex&&o.currentGroupIndex--,o.groups=je)}),i(()=>{async function s(){o.databaseLoaded&&(o.currentSkinTone=await o.database.getPreferredSkinTone())}s()}),i(()=>{o.skinTones=Array(at).fill().map((s,c)=>_a(o.skinToneEmoji,c))}),i(()=>{o.skinToneButtonText=o.skinTones[o.currentSkinTone]}),i(()=>{o.skinToneButtonLabel=o.i18n.skinToneLabel.replace("{skinTone}",o.i18n.skinTones[o.currentSkinTone])}),i(()=>{async function s(){const{database:c}=o,v=(await Promise.all($a.map(w=>c.getEmojiByUnicodeOrName(w)))).filter(Boolean);o.defaultFavoriteEmojis=v}o.databaseLoaded&&s()});function T(){const{customEmoji:s,database:c}=o,v=s||Oe;c.customEmoji!==v&&(c.customEmoji=v)}i(()=>{async function s(){T();const{database:c,defaultFavoriteEmojis:v,numColumns:w}=o,P=await c.getTopFavoriteEmoji(w),p=await I(It([...P,...v],L=>L.unicode||L.name).slice(0,w));o.currentFavorites=p}o.databaseLoaded&&o.defaultFavoriteEmojis&&s()});function E(s){Fa(s,l,()=>{{const c=getComputedStyle(n.rootElement),v=parseInt(c.getPropertyValue("--num-columns"),10),w=c.getPropertyValue("direction")==="rtl";o.numColumns=v,o.isRtl=w}})}function F(s){nn(s,l,c=>{for(const{target:v,isIntersecting:w}of c)v.classList.toggle("onscreen",w)})}i(()=>{async function s(){const{searchText:c,currentGroup:v,databaseLoaded:w,customEmoji:P}=o;if(!w)o.currentEmojis=[],o.searchMode=!1;else if(c.length>=fa){const p=await W(c);o.searchText===c&&(R(p),ae(!0))}else{const{id:p}=v;if(p!==-1||P&&P.length){const L=await z(p);o.currentGroup.id===p&&(R(L),ae(!1))}}}s()});const x=()=>{$e(()=>Na(n.tabpanelElement))};i(()=>{const{currentEmojis:s,emojiVersion:c}=o,v=s.filter(w=>w.unicode).filter(w=>nt(w)&&!qe.has(w.unicode));if(!c&&v.length)R(s),$e(()=>f(v));else{const w=c?s:s.filter(M);R(w),x()}});function f(s){Oa(s,n.baselineEmoji,$)?x():o.currentEmojis=[...o.currentEmojis]}function M(s){return!s.unicode||!nt(s)||qe.get(s.unicode)}async function A(s){const c=o.emojiVersion||await _e();return s.filter(({version:v})=>!v||v<=c)}async function I(s){return Aa(s,o.emojiVersion||await _e())}async function z(s){const c=s===-1?o.customEmoji:await o.database.getEmojiByGroup(s);return I(await A(c))}async function W(s){return I(await A(await o.database.getEmojiBySearchQuery(s)))}i(()=>{}),i(()=>{function s(){const{searchMode:v,currentEmojis:w}=o;if(v)return[{category:"",emojis:w}];const P=new Map;for(const p of w){const L=p.category||"";let j=P.get(L);j||(j=[],P.set(L,j)),j.push(p)}return[...P.entries()].map(([p,L])=>({category:p,emojis:L})).sort((p,L)=>o.customCategorySorting(p.category,L.category))}const c=s();Z(c)}),i(()=>{o.activeSearchItemId=o.activeSearchItem!==-1&&o.currentEmojis[o.activeSearchItem].id}),i(()=>{const{rawSearchText:s}=o;$t(()=>{o.searchText=(s||"").trim(),o.activeSearchItem=-1})});function O(s){if(!o.searchMode||!o.currentEmojis.length)return;const c=v=>{ce(s),o.activeSearchItem=Ae(v,o.activeSearchItem,o.currentEmojis)};switch(s.key){case"ArrowDown":return c(!1);case"ArrowUp":return c(!0);case"Enter":if(o.activeSearchItem===-1)o.activeSearchItem=0;else return ce(s),m(o.currentEmojis[o.activeSearchItem].id)}}function oe(s){const{target:c}=s,v=c.closest(".nav-button");if(!v)return;const w=parseInt(v.dataset.groupId,10);n.searchElement.value="",o.rawSearchText="",o.searchText="",o.activeSearchItem=-1,o.currentGroupIndex=o.groups.findIndex(P=>P.id===w)}function K(s){const{target:c,key:v}=s,w=P=>{P&&(ce(s),P.focus())};switch(v){case"ArrowLeft":return w(c.previousElementSibling);case"ArrowRight":return w(c.nextElementSibling);case"Home":return w(c.parentElement.firstElementChild);case"End":return w(c.parentElement.lastElementChild)}}async function h(s){const c=await o.database.getEmojiByUnicodeOrName(s),v=[...o.currentEmojis,...o.currentFavorites].find(P=>P.id===s),w=v.unicode&&se(v,o.currentSkinTone);return await o.database.incrementFavoriteEmojiCount(s),{emoji:c,skinTone:o.currentSkinTone,...w&&{unicode:w},...v.name&&{name:v.name}}}async function m(s){const c=h(s);D("emoji-click-sync",c),D("emoji-click",await c)}function u(s){const{target:c}=s;if(!c.classList.contains("emoji"))return;ce(s);const v=c.id.substring(4);m(v)}function b(s){o.currentSkinTone=s,o.skinTonePickerExpanded=!1,N("skintone-button"),D("skin-tone-change",{skinTone:s}),o.database.setPreferredSkinTone(s)}function k(s){const{target:{id:c}}=s,v=c&&c.match(/^skintone-(\d)/);if(!v)return;ce(s);const w=parseInt(v[1],10);b(w)}function B(s){o.skinTonePickerExpanded=!o.skinTonePickerExpanded,o.activeSkinTone=o.currentSkinTone,o.skinTonePickerExpanded&&(ce(s),$e(()=>N("skintone-list")))}i(()=>{o.skinTonePickerExpanded?n.skinToneDropdown.addEventListener("transitionend",()=>{o.skinTonePickerExpandedAfterAnimation=!0},{once:!0}):o.skinTonePickerExpandedAfterAnimation=!1});function y(s){if(!o.skinTonePickerExpanded)return;const c=async v=>{ce(s),o.activeSkinTone=v};switch(s.key){case"ArrowUp":return c(Ae(!0,o.activeSkinTone,o.skinTones));case"ArrowDown":return c(Ae(!1,o.activeSkinTone,o.skinTones));case"Home":return c(0);case"End":return c(o.skinTones.length-1);case"Enter":return ce(s),b(o.activeSkinTone);case"Escape":return ce(s),o.skinTonePickerExpanded=!1,N("skintone-button")}}function g(s){if(o.skinTonePickerExpanded)switch(s.key){case" ":return ce(s),b(o.activeSkinTone)}}async function r(s){const{relatedTarget:c}=s;(!c||c.id!=="skintone-list")&&(o.skinTonePickerExpanded=!1)}function d(s){o.rawSearchText=s.target.value}return{$set(s){Ee(o,s)},$destroy(){a.abort()}}}const on="https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json",rn="en";var dn={categoriesLabel:"Categories",emojiUnsupportedMessage:"Your browser does not support color emoji.",favoritesLabel:"Favorites",loadingMessage:"Loading…",networkErrorMessage:"Could not load emoji.",regionLabel:"Emoji picker",searchDescription:"When search results are available, press up or down to select and enter to choose.",searchLabel:"Search",searchResultsLabel:"Search results",skinToneDescription:"When expanded, press up or down to select and enter to choose.",skinToneLabel:"Choose a skin tone (currently {skinTone})",skinTonesLabel:"Skin tones",skinTones:["Default","Light","Medium-Light","Medium","Medium-Dark","Dark"],categories:{custom:"Custom","smileys-emotion":"Smileys and emoticons","people-body":"People and body","animals-nature":"Animals and nature","food-drink":"Food and drink","travel-places":"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}},ln=':host{--emoji-size:1.375rem;--emoji-padding:0.5rem;--category-emoji-size:var(--emoji-size);--category-emoji-padding:var(--emoji-padding);--indicator-height:3px;--input-border-radius:0.5rem;--input-border-size:1px;--input-font-size:1rem;--input-line-height:1.5;--input-padding:0.25rem;--num-columns:8;--outline-size:2px;--border-size:1px;--border-radius:0;--skintone-border-radius:1rem;--category-font-size:1rem;display:flex;width:min-content;height:400px}:host,:host(.light){color-scheme:light;--background:#fff;--border-color:#e0e0e0;--indicator-color:#385ac1;--input-border-color:#999;--input-font-color:#111;--input-placeholder-color:#999;--outline-color:#999;--category-font-color:#111;--button-active-background:#e6e6e6;--button-hover-background:#d9d9d9}:host(.dark){color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}@media (prefers-color-scheme:dark){:host{color-scheme:dark;--background:#222;--border-color:#444;--indicator-color:#5373ec;--input-border-color:#ccc;--input-font-color:#efefef;--input-placeholder-color:#ccc;--outline-color:#fff;--category-font-color:#efefef;--button-active-background:#555555;--button-hover-background:#484848}}:host([hidden]){display:none}button{margin:0;padding:0;border:0;background:0 0;box-shadow:none;-webkit-tap-highlight-color:transparent}button::-moz-focus-inner{border:0}input{padding:0;margin:0;line-height:1.15;font-family:inherit}input[type=search]{-webkit-appearance:none}:focus{outline:var(--outline-color) solid var(--outline-size);outline-offset:calc(-1*var(--outline-size))}:host([data-js-focus-visible]) :focus:not([data-focus-visible-added]){outline:0}:focus:not(:focus-visible){outline:0}.hide-focus{outline:0}*{box-sizing:border-box}.picker{contain:content;display:flex;flex-direction:column;background:var(--background);border:var(--border-size) solid var(--border-color);border-radius:var(--border-radius);width:100%;height:100%;overflow:hidden;--total-emoji-size:calc(var(--emoji-size) + (2 * var(--emoji-padding)));--total-category-emoji-size:calc(var(--category-emoji-size) + (2 * var(--category-emoji-padding)))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.hidden{opacity:0;pointer-events:none}.abs-pos{position:absolute;left:0;top:0}.gone{display:none!important}.skintone-button-wrapper,.skintone-list{background:var(--background);z-index:3}.skintone-button-wrapper.expanded{z-index:1}.skintone-list{position:absolute;inset-inline-end:0;top:0;z-index:2;overflow:visible;border-bottom:var(--border-size) solid var(--border-color);border-radius:0 0 var(--skintone-border-radius) var(--skintone-border-radius);will-change:transform;transition:transform .2s ease-in-out;transform-origin:center 0}@media (prefers-reduced-motion:reduce){.skintone-list{transition-duration:.001s}}@supports not (inset-inline-end:0){.skintone-list{right:0}}.skintone-list.no-animate{transition:none}.tabpanel{overflow-y:auto;scrollbar-gutter:stable;-webkit-overflow-scrolling:touch;will-change:transform;min-height:0;flex:1;contain:content}.emoji-menu{display:grid;grid-template-columns:repeat(var(--num-columns),var(--total-emoji-size));justify-content:space-around;align-items:flex-start;width:100%}.emoji-menu.visibility-auto{content-visibility:auto;contain-intrinsic-size:calc(var(--num-columns)*var(--total-emoji-size)) calc(var(--num-rows)*var(--total-emoji-size))}.category{padding:var(--emoji-padding);font-size:var(--category-font-size);color:var(--category-font-color)}.emoji,button.emoji{font-size:var(--emoji-size);display:flex;align-items:center;justify-content:center;border-radius:100%;height:var(--total-emoji-size);width:var(--total-emoji-size);line-height:1;overflow:hidden;font-family:var(--emoji-font-family);cursor:pointer}@media (hover:hover) and (pointer:fine){.emoji:hover,button.emoji:hover{background:var(--button-hover-background)}}.emoji.active,.emoji:active,button.emoji.active,button.emoji:active{background:var(--button-active-background)}.onscreen .custom-emoji::after{content:"";width:var(--emoji-size);height:var(--emoji-size);background-repeat:no-repeat;background-position:center center;background-size:contain;background-image:var(--custom-emoji-background)}.nav,.nav-button{align-items:center}.nav{display:grid;justify-content:space-between;contain:content}.nav-button{display:flex;justify-content:center}.nav-emoji{font-size:var(--category-emoji-size);width:var(--total-category-emoji-size);height:var(--total-category-emoji-size)}.indicator-wrapper{display:flex;border-bottom:1px solid var(--border-color)}.indicator{width:calc(100%/var(--num-groups));height:var(--indicator-height);opacity:var(--indicator-opacity);background-color:var(--indicator-color);will-change:transform,opacity;transition:opacity .1s linear,transform .25s ease-in-out}@media (prefers-reduced-motion:reduce){.indicator{will-change:opacity;transition:opacity .1s linear}}.pad-top,input.search{background:var(--background);width:100%}.pad-top{height:var(--emoji-padding);z-index:3}.search-row{display:flex;align-items:center;position:relative;padding-inline-start:var(--emoji-padding);padding-bottom:var(--emoji-padding)}.search-wrapper{flex:1;min-width:0}input.search{padding:var(--input-padding);border-radius:var(--input-border-radius);border:var(--input-border-size) solid var(--input-border-color);color:var(--input-font-color);font-size:var(--input-font-size);line-height:var(--input-line-height)}input.search::placeholder{color:var(--input-placeholder-color)}.favorites{overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:row;border-top:var(--border-size) solid var(--border-color);contain:content}.message{padding:var(--emoji-padding)}';const St=["customEmoji","customCategorySorting","database","dataSource","i18n","locale","skinToneEmoji","emojiVersion"],cn=`:host{--emoji-font-family:${Tt}}`;class Je extends HTMLElement{constructor(e){super(),this.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=ln+cn,this.shadowRoot.appendChild(n),this._ctx={locale:rn,dataSource:on,skinToneEmoji:Ea,customCategorySorting:Ta,customEmoji:null,i18n:dn,emojiVersion:null,...e};for(const a of St)a!=="database"&&Object.prototype.hasOwnProperty.call(this,a)&&(this._ctx[a]=this[a],delete this[a]);this._dbFlush()}connectedCallback(){lt(this),this._cmp||(this._cmp=sn(this.shadowRoot,this._ctx))}disconnectedCallback(){lt(this),Se(()=>{if(!this.isConnected&&this._cmp){this._cmp.$destroy(),this._cmp=void 0;const{database:e}=this._ctx;e.close().catch(n=>console.error(n))}})}static get observedAttributes(){return["locale","data-source","skin-tone-emoji","emoji-version"]}attributeChangedCallback(e,n,a){this._set(e.replace(/-([a-z])/g,(l,o)=>o.toUpperCase()),e==="emoji-version"?parseFloat(a):a)}_set(e,n){this._ctx[e]=n,this._cmp&&this._cmp.$set({[e]:n}),["locale","dataSource"].includes(e)&&this._dbFlush()}_dbCreate(){const{locale:e,dataSource:n,database:a}=this._ctx;(!a||a.locale!==e||a.dataSource!==n)&&this._set("database",new xa({locale:e,dataSource:n}))}_dbFlush(){Se(()=>this._dbCreate())}}const Bt={};for(const t of St)Bt[t]={get(){return t==="database"&&this._dbCreate(),this._ctx[t]},set(e){if(t==="database")throw new Error("database is read-only");this._set(t,e)}};Object.defineProperties(Je.prototype,Bt);function lt(t){t instanceof Je||Object.setPrototypeOf(t,customElements.get(t.tagName.toLowerCase()).prototype)}customElements.get("emoji-picker")||customElements.define("emoji-picker",Je);function pn(t,e){const n=document.getElementById("app"),a=new ct,l=new Be,o=t.id||t._id;let i=null,S=[];const N=localStorage.getItem("currentTheme")||"dark";un(N),n.innerHTML=`
package/dist/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>CollabDocChat - 协作文档聊天平台</title>
7
7
  <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
8
8
  <script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
9
- <script type="module" crossorigin src="/assets/index-SN8mu8SV.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-CZgXE9nz.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-D8ZqeoaM.css">
11
11
  </head>
12
12
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "collabdocchat",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "description": "开源的实时协作文档聊天平台 - 集成任务管理、多人文档编辑、智能点名功能",
5
5
  "main": "./server/index.js",
6
6
  "type": "module",
package/server/index.js CHANGED
@@ -121,7 +121,7 @@ app.use(notFoundHandler);
121
121
  // 错误处理中间件(必须在所有路由之后)
122
122
  app.use(errorHandler);
123
123
 
124
- const PORT = process.env.PORT || 8765;
124
+ const PORT = process.env.PORT || 3000;
125
125
  server.listen(PORT, () => {
126
126
  console.log(`\n${'='.repeat(60)}`);
127
127
  console.log(`🚀 CollabDocChat 服务器启动成功!`);
@@ -1,4 +1,4 @@
1
- const API_URL = 'http://localhost:8765/api';
1
+ const API_URL = 'http://localhost:3000/api';
2
2
 
3
3
  export class ApiService {
4
4
  constructor() {
@@ -1,4 +1,4 @@
1
- const API_URL = 'http://localhost:8765/api';
1
+ const API_URL = 'http://localhost:3000/api';
2
2
 
3
3
  export class AuthService {
4
4
  async login(username, password) {
@@ -5,7 +5,7 @@ export class WebSocketService {
5
5
  }
6
6
 
7
7
  connect(token) {
8
- this.ws = new WebSocket('ws://localhost:8765');
8
+ this.ws = new WebSocket('ws://localhost:3000');
9
9
 
10
10
  this.ws.onopen = () => {
11
11
  console.log('✅ WebSocket 连接成功');