4 lines
No EOL
5.5 KiB
JavaScript
4 lines
No EOL
5.5 KiB
JavaScript
import{n as e}from"./chunk.aKtaBQYM.js";import{r as t}from"./modal.BLgTTi-o.js";import{t as n}from"./lodash.daI9UflD.js";import{c as r,gn as i,n as a}from"./oauth.C4JLKGAu.js";import{t as o}from"./preload-helper.zJ_50EbN.js";import{t as s}from"./languages.q6q0orhR.js";var c=n(),l={ar:()=>o(()=>import(`./emoji-annotations/ar.C0WdH5xy.js`),[]),ca:()=>o(()=>import(`./emoji-annotations/ca.CNeNqe3P.js`),[]),cs:()=>o(()=>import(`./emoji-annotations/cs.BO8W9-jj.js`),[]),de:()=>o(()=>import(`./emoji-annotations/de.D2VnBbFt.js`),[]),en:()=>o(()=>import(`./emoji-annotations/en.D_KNv6Yw.js`),[]),es:()=>o(()=>import(`./emoji-annotations/es.C46MzXjW.js`),[]),et:()=>o(()=>import(`./emoji-annotations/et.Det91k5K.js`),[]),eu:()=>o(()=>import(`./emoji-annotations/eu.Cvp9Y63c.js`),[]),fi:()=>o(()=>import(`./emoji-annotations/fi.BxxnAYpU.js`),[]),fr:()=>o(()=>import(`./emoji-annotations/fr.BS41U5JJ.js`),[]),ga:()=>o(()=>import(`./emoji-annotations/ga.ESuEHZKl.js`),[]),he:()=>o(()=>import(`./emoji-annotations/he.CfoS-gG4.js`),[]),hu:()=>o(()=>import(`./emoji-annotations/hu.BXFnVUck.js`),[]),it:()=>o(()=>import(`./emoji-annotations/it.V9d10lLp.js`),[]),ja:()=>o(()=>import(`./emoji-annotations/ja.Dt-m5rD-.js`),[]),ja_easy:()=>o(()=>import(`./emoji-annotations/ja.Dt-m5rD-.js`),[]),ko:()=>o(()=>import(`./emoji-annotations/ko.qCDFL19U.js`),[]),nl:()=>o(()=>import(`./emoji-annotations/nl.B2IenlFE.js`),[]),pl:()=>o(()=>import(`./emoji-annotations/pl.DxxjBECj.js`),[]),pt:()=>o(()=>import(`./emoji-annotations/pt.BmciJSYs.js`),[]),ro:()=>o(()=>import(`./emoji-annotations/ro.yzctWu4x.js`),[]),ru:()=>o(()=>import(`./emoji-annotations/ru.BLE9DyAq.js`),[]),sk:()=>o(()=>import(`./emoji-annotations/sk.Dy63vbs6.js`),[]),te:()=>o(()=>import(`./emoji-annotations/te.BE2qiFNg.js`),[]),uk:()=>o(()=>import(`./emoji-annotations/uk.DYbkLgKB.js`),[]),zh:()=>o(()=>import(`./emoji-annotations/zh.By94GFYU.js`),[]),zh_Hant:()=>o(()=>import(`./emoji-annotations/zh_Hant.D6xeB4Z8.js`),[])},u=e({useEmojiStore:()=>_}),d={customEmoji:[],customEmojiFetched:!1,adminPacksLocal:null,adminPacksLocalLoading:!0,emoji:{},emojiFetched:!1,unicodeEmojiAnnotations:{},stickers:null},f=[`smileys-and-emotion`,`people-and-body`,`animals-and-nature`,`food-and-drink`,`travel-and-places`,`activities`,`objects`,`symbols`,`flags`],p=(()=>{let e=127462,t=`A`.codePointAt(0),n=Array(26);for(let r=e;r<=127487;++r){let i=String.fromCodePoint(t+r-e);n[r-e]={replacement:String.fromCodePoint(r),imageUrl:!1,displayText:`regional_indicator_`+i,displayTextI18n:{key:`emoji.regional_indicator`,args:{letter:i}}}}return n})(),m=e=>l[e]().then(e=>e.default),h=(e,t)=>{let n=Object.keys(t);return{...e,annotations:n.reduce((n,r)=>(n[r]=t[r][e.replacement],n),{})}},g=e=>(e.symbols.push(...p),e),_=t(`emoji`,{state:()=>({...d}),getters:{groupedCustomEmojis(e){let t=e=>{let t=e.tags.filter(e=>e.startsWith(`pack:`)).map(e=>{let t=e.slice(5);return{id:`custom-${t}`,text:t}});return t.length?t:[{id:`unpacked`}]};return this.customEmoji.reduce((e,n)=>(t(n).forEach(({id:t,text:r})=>{e[t]||(e[t]={id:t,text:r,image:n.imageUrl,emojis:[]}),e[t].emojis.push(n)}),e),{})},standardEmojiList(e){return f.map(e=>(this.emoji[e]||[]).map(e=>h(e,this.unicodeEmojiAnnotations))).reduce((e,t)=>e.concat(t),[])??[]},standardEmojiGroupList(e){return f.map(e=>({id:e,emojis:(this.emoji[e]||[]).map(e=>h(e,this.unicodeEmojiAnnotations))}))??[]}},actions:{setStickers(e){this.stickers=e},async getStaticEmoji(){try{let e=(await o(async()=>{let{default:e}=await import(`./emoji.C5uX9ZLF.js`);return{default:e}},[])).default,t=Object.keys(e).reduce((t,n)=>(t[n]=e[n].map(e=>({displayText:e.slug,imageUrl:!1,replacement:e.emoji})),t),{});this.emoji=g(t)}catch(e){console.warn(`Can't load static emoji
|
|
`,e)}},loadUnicodeEmojiData(e){let t=s(e);return Promise.all(t.map(async e=>{if(!this.unicodeEmojiAnnotations[e])try{let t=await m(e);this.unicodeEmojiAnnotations[e]=t}catch(t){console.warn(`Error loading unicode emoji annotations for ${e}: `,t)}}))},async getAdminPacksLocal(e){if(!e&&this.adminPacksLocal)return this.adminPacksLocal;this.adminPacksLocalLoading=!0,this.adminPacksLocal=await this.getAdminPacks(r().server,e=>i({...e,credentials:a().token}).then(({data:e})=>e)),this.adminPacksLocalLoading=!1},async getAdminPacks(e,t){return window.vuex.state.users.currentUser.rights.admin?await t({instance:e,page:1,pageSize:0}).then(n=>{let r=[];for(let i=0;i<Math.ceil(n.count/25);i++)r.push(t({instance:e,page:i,pageSize:25}).then(e=>e.packs));return Promise.all(r).then(e=>(0,c.merge)({},...e))}).then(e=>Object.keys(e).sort().reduce((t,n)=>(n.length===0||(t[n]=e[n]),t),{})).catch(e=>{console.error(e)}):void 0},async getCustomEmoji(){try{let e=await window.fetch(`/api/v1/pleroma/emoji`);if(e.ok||(e=await window.fetch(`/api/pleroma/emoji.json`)),e.ok){let t=await e.json(),n=Array.isArray(t)?Object.assign({},...t):t,i=(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase();return n>r?1:n<r?-1:0},a=(e,t)=>{let n=e===``,r=t===``;return n===r?0:n&&!r?1:-1},o=Object.entries(n).map(([e,t])=>{let n=t.image_url;return{displayText:e,imageUrl:n?r().server+n:t,tags:n?t.tags.sort((e,t)=>+(e>t)):[`utf`],replacement:`:${e}: `}}).sort((e,t)=>{let n=e=>(e.tags.filter(e=>e.startsWith(`pack:`))[0]||``).slice(5),r=n(e),o=n(t);return a(r,o)||i(r,o)||i(e.displayText,t.displayText)});this.customEmoji=o}else throw e}catch(e){console.warn(`Can't load custom emojis
|
|
`,e)}},fetchEmoji(){this.customEmojiFetched||this.getCustomEmoji().then(()=>this.customEmojiFetched=!0),this.emojiFetched||this.getStaticEmoji().then(()=>this.emojiFetched=!0)}}});export{_ as n,u as t};
|
|
//# sourceMappingURL=emoji.CKB_ooIp.js.map
|