var Ct=s=>{throw TypeError(s)};var rt=(s,e,n)=>e.has(s)||Ct("Cannot "+n);var T=(s,e,n)=>(rt(s,e,"read from private field"),n?n.call(s):e.get(s)),re=(s,e,n)=>e.has(s)?Ct("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,n),de=(s,e,n,o)=>(rt(s,e,"write to private field"),o?o.call(s,n):e.set(s,n),n),G=(s,e,n)=>(rt(s,e,"access private method"),n);import{B as an,Z as on,a as _e,a7 as rn,w as zt,u as ln,i as Ot,b as cn,I as K,y as Lt,h as Ht,a8 as un,M as Ve,s as ke,a3 as dn,$ as hn,n as pn,K as mn,W as Qe,c as gn,d as St,l as fn,x as vn}from"./fuse-GSnTzOyH.js";import{s as le,a as vt,p as H,F as U,f as bn,al as Nt,d as ze,_ as ee,m as yn,am as xn,q as Re,c as t,k as Ce,b as wn,L as et,i as kn,D as En,u as Fn,j as At,x as Wt}from"./useTitle-KMkGka9H.js";import{e as Cn}from"./tinyld-light-PxOyhYWY.js";import"./index-dbOm7oTI.js";class zn{constructor(e,n,{tabInsertsSuggestions:o,defaultFirstOption:r}={}){this.input=e,this.list=n,this.tabInsertsSuggestions=o??!0,this.defaultFirstOption=r??!1,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=p=>Ln(p,this),this.compositionEventHandler=p=>An(p,this),this.inputHandler=this.clearSelection.bind(this),e.setAttribute("role","combobox"),e.setAttribute("aria-controls",n.id),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",It),this.indicateDefaultOption()}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",It)}indicateDefaultOption(){var e;this.defaultFirstOption&&((e=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(lt)[0])===null||e===void 0||e.setAttribute("data-combobox-option-default","true"))}navigate(e=1){const n=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(lt)[0],o=Array.from(this.list.querySelectorAll('[role="option"]')).filter(lt),r=o.indexOf(n);if(r===o.length-1&&e===1||r===0&&e===-1){this.clearSelection(),this.input.focus();return}let p=e===1?0:o.length-1;if(n&&r>=0){const v=r+e;v>=0&&v0||s.offsetHeight>0)}function An(s,e){e.isComposing=s.type==="compositionstart",document.getElementById(e.input.getAttribute("aria-controls")||"")&&e.clearSelection()}function In(s,e){$n(s,e)||(s.scrollTop=e.offsetTop)}function $n(s,e){const n=s.scrollTop,o=n+s.clientHeight,r=e.offsetTop,p=r+e.clientHeight;return r>=n&&p<=o}const Mn=/\s|\(|\[/;function Bn(s,e,n,{multiWord:o,lookBackIndex:r,lastMatchPosition:p}={multiWord:!1,lookBackIndex:0,lastMatchPosition:null}){let u=s.lastIndexOf(e,n-1);if(u===-1||u=u+e.length+1||s.lastIndexOf(` `,n-1)>u||s.lastIndexOf(".",n-1)>u)return}else if(s.lastIndexOf(" ",n-1)>u)return;const v=s[u-1];return v&&!Mn.test(v)?void 0:{text:s.substring(u+e.length,n),position:u+e.length}}class Tn extends HTMLElement{}class _n extends Event{constructor(){super("update")}}const ct=new WeakMap;var De,je,Ee,fe,Y,Be,Le,Se,ht,Ae,Ge,Ye,Ze,Pe,Fe;const yt=class yt extends Tn{constructor(n){super();re(this,Y);re(this,De,new MutationObserver(()=>G(this,Y,Ye).call(this)));re(this,je,new ResizeObserver(()=>G(this,Y,Ge).call(this)));re(this,Ee);re(this,fe);re(this,Le,0);re(this,Se,0);re(this,Ae,!1);re(this,Pe,()=>G(this,Y,Ze).call(this));re(this,Fe,n=>{G(this,Y,Be).call(this,o=>{(n.target===document||n.target===window||n.target instanceof Node&&n.target.contains(o))&&G(this,Y,Ge).call(this)})});de(this,Ee,new WeakRef(n)),de(this,fe,document.createElement("div")),T(this,fe).style.position="absolute",T(this,fe).style.pointerEvents="none",n.after(T(this,fe)),T(this,fe).appendChild(this)}static for(n){const o=ct.get(n)??new yt(n);return ct.set(n,o),o}forceUpdate(){G(this,Y,Ye).call(this),G(this,Y,Ze).call(this)}connectedCallback(){const n=T(this,Ee).deref();if(!n)return this.remove();this.style.pointerEvents="none",this.style.userSelect="none",this.style.overflow="hidden",this.style.display="block",this.style.visibility="hidden",n instanceof HTMLTextAreaElement?(this.style.whiteSpace="pre-wrap",this.style.wordWrap="break-word"):(this.style.whiteSpace="nowrap",this.style.display="table-cell",this.style.verticalAlign="middle"),this.setAttribute("aria-hidden","true"),G(this,Y,Ye).call(this),G(this,Y,Ze).call(this),T(this,De).observe(n,{attributeFilter:["style","dir"]}),T(this,je).observe(n),document.addEventListener("scroll",T(this,Fe),{capture:!0}),window.addEventListener("resize",T(this,Fe),{capture:!0}),n.addEventListener("input",T(this,Pe),{capture:!0})}disconnectedCallback(){T(this,fe).remove(),T(this,De).disconnect(),T(this,je).disconnect(),document.removeEventListener("scroll",T(this,Fe),{capture:!0}),window.removeEventListener("resize",T(this,Fe),{capture:!0});const n=T(this,Ee).deref();n&&(n.removeEventListener("input",T(this,Pe),{capture:!0}),ct.delete(n))}};De=new WeakMap,je=new WeakMap,Ee=new WeakMap,fe=new WeakMap,Y=new WeakSet,Be=function(n){const o=T(this,Ee).deref();return o?n(o):this.remove()},Le=new WeakMap,Se=new WeakMap,ht=function(){G(this,Y,Be).call(this,n=>{const o=window.getComputedStyle(n);this.style.height=o.height,this.style.width=o.width,n.clientHeight!==this.clientHeight&&(this.style.height=`calc(${o.height} + ${n.clientHeight-this.clientHeight}px)`),n.clientWidth!==this.clientWidth&&(this.style.width=`calc(${o.width} + ${n.clientWidth-this.clientWidth}px)`);const r=n.getBoundingClientRect(),p=this.getBoundingClientRect();de(this,Le,T(this,Le)+r.left-p.left),de(this,Se,T(this,Se)+r.top-p.top),this.style.transform=`translate(${T(this,Le)}px, ${T(this,Se)}px)`,this.scrollTop=n.scrollTop,this.scrollLeft=n.scrollLeft,this.dispatchEvent(new _n)})},Ae=new WeakMap,Ge=function(){T(this,Ae)||(de(this,Ae,!0),requestAnimationFrame(()=>{G(this,Y,ht).call(this),de(this,Ae,!1)}))},Ye=function(){G(this,Y,Be).call(this,n=>{const o=window.getComputedStyle(n);for(const r of Rn)this.style[r]=o[r];G(this,Y,Ge).call(this)})},Ze=function(){G(this,Y,Be).call(this,n=>{this.textContent=n.value,G(this,Y,ht).call(this)})},Pe=new WeakMap,Fe=new WeakMap;let Je=yt;const Rn=["direction","writingMode","unicodeBidi","textOrientation","boxSizing","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"];try{customElements.define("input-style-clone",Je)}catch(s){if(!(s instanceof DOMException&&s.name==="NotSupportedError"))throw s}var pe,Ie,$e,ce,mt,Ut,gt,Te;const Xe=class Xe{constructor(e,n=0,o=n){re(this,ce);re(this,pe);re(this,Ie);re(this,$e);de(this,pe,e),de(this,Ie,n),de(this,$e,o)}static fromSelection(e){const{selectionStart:n,selectionEnd:o}=e;return new Xe(e,n??void 0,o??void 0)}get collapsed(){return this.startOffset===this.endOffset}get commonAncestorContainer(){return T(this,pe)}get endContainer(){return T(this,pe)}get startContainer(){return T(this,pe)}get startOffset(){return T(this,Ie)}get endOffset(){return T(this,$e)}setStartOffset(e){de(this,Ie,G(this,ce,gt).call(this,e))}setEndOffset(e){de(this,$e,G(this,ce,gt).call(this,e))}collapse(e=!1){e?this.setEndOffset(this.startOffset):this.setStartOffset(this.endOffset)}cloneContents(){return G(this,ce,Te).call(this).cloneContents()}cloneRange(){return new Xe(T(this,pe),this.startOffset,this.endOffset)}getBoundingClientRect(){return G(this,ce,Te).call(this).getBoundingClientRect()}getClientRects(){return G(this,ce,Te).call(this).getClientRects()}toString(){return G(this,ce,Te).call(this).toString()}getStyleClone(){return T(this,ce,mt)}};pe=new WeakMap,Ie=new WeakMap,$e=new WeakMap,ce=new WeakSet,mt=function(){return Je.for(T(this,pe))},Ut=function(){return T(this,ce,mt)},gt=function(e){return Math.max(0,Math.min(e,T(this,pe).value.length))},Te=function(){const e=document.createRange(),n=T(this,ce,Ut).childNodes[0];return n&&(e.setStart(n,this.startOffset),e.setEnd(n,this.endOffset)),e};let pt=Xe;const qe=new WeakMap;class Dn{constructor(e,n){this.expander=e,this.input=n,this.combobox=null,this.menu=null,this.match=null,this.justPasted=!1,this.lookBackIndex=0,this.oninput=this.onInput.bind(this),this.onpaste=this.onPaste.bind(this),this.onkeydown=this.onKeydown.bind(this),this.oncommit=this.onCommit.bind(this),this.onmousedown=this.onMousedown.bind(this),this.onblur=this.onBlur.bind(this),this.interactingWithList=!1,n.addEventListener("paste",this.onpaste),n.addEventListener("input",this.oninput),n.addEventListener("keydown",this.onkeydown),n.addEventListener("blur",this.onblur)}destroy(){this.input.removeEventListener("paste",this.onpaste),this.input.removeEventListener("input",this.oninput),this.input.removeEventListener("keydown",this.onkeydown),this.input.removeEventListener("blur",this.onblur)}dismissMenu(){this.deactivate()&&(this.lookBackIndex=this.input.selectionEnd||this.lookBackIndex)}activate(e,n){var o,r;this.input!==document.activeElement&&this.input!==((r=(o=document.activeElement)===null||o===void 0?void 0:o.shadowRoot)===null||r===void 0?void 0:r.activeElement)||(this.deactivate(),this.menu=n,n.id||(n.id=`text-expander-${Math.floor(Math.random()*1e5).toString()}`),this.expander.append(n),this.combobox=new zn(this.input,n),this.expander.dispatchEvent(new Event("text-expander-activate")),this.positionMenu(n,e.position),this.combobox.start(),n.addEventListener("combobox-commit",this.oncommit),n.addEventListener("mousedown",this.onmousedown),this.combobox.navigate(1))}positionMenu(e,n){const o=new pt(this.input,n).getBoundingClientRect(),r={left:o.left,top:o.top+o.height},p=e.getBoundingClientRect(),u={left:r.left-p.left,top:r.top-p.top};if(u.left!==0||u.top!==0){const v=getComputedStyle(e);e.style.left=v.left?`calc(${v.left} + ${u.left}px)`:`${u.left}px`,e.style.top=v.top?`calc(${v.top} + ${u.top}px)`:`${u.top}px`}}deactivate(){const e=this.menu;return!e||!this.combobox?!1:(this.expander.dispatchEvent(new Event("text-expander-deactivate")),this.menu=null,e.removeEventListener("combobox-commit",this.oncommit),e.removeEventListener("mousedown",this.onmousedown),this.combobox.destroy(),this.combobox=null,e.remove(),!0)}onCommit({target:e}){var n;const o=e;if(!(o instanceof HTMLElement)||!this.combobox)return;const r=this.match;if(!r)return;const p=this.input.value.substring(0,r.position-r.key.length),u=this.input.value.substring(r.position+r.text.length),v={item:o,key:r.key,value:null,continue:!1};if(!this.expander.dispatchEvent(new CustomEvent("text-expander-value",{cancelable:!0,detail:v}))||!v.value)return;let R=(n=this.expander.getAttribute("suffix"))!==null&&n!==void 0?n:" ";v.continue&&(R="");const C=`${v.value}${R}`;this.input.value=p+C+u;const k=p.length+C.length;this.deactivate(),this.input.focus({preventScroll:!0}),this.input.selectionStart=k,this.input.selectionEnd=k,v.continue||(this.lookBackIndex=k,this.match=null),this.expander.dispatchEvent(new CustomEvent("text-expander-committed",{cancelable:!1,detail:{input:this.input}}))}onBlur(){if(this.interactingWithList){this.interactingWithList=!1;return}this.deactivate()}onPaste(){this.justPasted=!0}async onInput(){if(this.justPasted){this.justPasted=!1;return}const e=this.findMatch();if(e){this.match=e;const n=await this.notifyProviders(e);if(!this.match)return;n?this.activate(e,n):this.deactivate()}else this.match=null,this.deactivate()}findMatch(){const e=this.input.selectionEnd||0,n=this.input.value;e<=this.lookBackIndex&&(this.lookBackIndex=e-1);for(const{key:o,multiWord:r}of this.expander.keys){const p=Bn(n,o,e,{multiWord:r,lookBackIndex:this.lookBackIndex,lastMatchPosition:this.match?this.match.position:null});if(p)return{text:p.text,key:o,position:p.position}}}async notifyProviders(e){const n=[],o=v=>n.push(v);return this.expander.dispatchEvent(new CustomEvent("text-expander-change",{cancelable:!0,detail:{provide:o,text:e.text,key:e.key}}))?(await Promise.all(n)).filter(v=>v.matched).map(v=>v.fragment)[0]:void 0}onMousedown(){this.interactingWithList=!0}onKeydown(e){e.key==="Escape"&&(this.match=null,this.deactivate()&&(this.lookBackIndex=this.input.selectionEnd||this.lookBackIndex,e.stopImmediatePropagation(),e.preventDefault()))}}class Mt extends HTMLElement{get keys(){const e=this.getAttribute("keys"),n=e?e.split(" "):[],o=this.getAttribute("multiword"),r=o?o.split(" "):[],p=r.length===0&&this.hasAttribute("multiword");return n.map(u=>({key:u,multiWord:p||r.includes(u)}))}connectedCallback(){const e=this.querySelector('input[type="text"], textarea');if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))return;const n=new Dn(this,e);qe.set(this,n)}disconnectedCallback(){const e=qe.get(this);e&&(e.destroy(),qe.delete(this))}dismiss(){const e=qe.get(this);e&&e.dismissMenu()}}window.customElements.get("text-expander")||(window.TextExpanderElement=Mt,window.customElements.define("text-expander",Mt));function jn({onlyFirst:s=!1}={}){const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,s?void 0:"g")}const Pn=jn();function On(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(Pn,"")}const Hn=new Intl.Segmenter;function Bt(s,{countAnsiEscapeCodes:e=!1}={}){if(s===""||(e||(s=On(s)),s===""))return 0;let n=0;for(const o of Hn.segment(s))n++;return n}const Nn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20version='1.0'%20viewBox='0%200%20641%20223'%3e%3cpath%20fill='%23aaa'%20d='M86%20214c-9-1-17-4-24-8l-6-3-5-5-5-4-4-6-4-6-3-8-2-8v-27l2-9%203-9%204-6%204-6%205-5%205-5%207-3%206-4%207-2%207-2%2012-1h12l7%201%208%202%207%204%207%203%205%205%205%204-10%2010-10%209-4-3-10-5-5-1H88l-5%202-6%203-3%204-4%204-2%205-2%206v6l-1%207%201%207%202%207%203%205%202%204%204%203%204%203%205%202%206%202h9l10-1%205-2%206-3v-16H91v-27h59v54l-1%203-2%203-5%204-4%204-5%203-5%202-8%202-8%202-10%201H92l-6-1zm266-62V91h34v46h44V91h34v121h-34v-46h-44v46h-34v-61zm-182-1V90h34v121h-34v-60zm59-1V90h35l36%201%205%202c3%200%208%202%2010%204l5%202%204%205%205%204%203%207%203%207%201%2013v13l-4%206-3%207-4%204-5%205-5%202-5%203-6%202-5%201-18%201h-18v32h-34v-61zm67-2%203-2%202-4%202-5v-5l-2-4-2-4-3-2-3-3h-30v31h30l3-2zm226%2039v-24l-8-12-18-28a1751%201751%200%200%200-20-31v-2h39l7%2012%2012%2021%206%209%2013-21%2013-21h38v2l-41%2061-7%2010v48h-34v-24zM109%2066l-4-1-5-5-5-4-1-5-3-9v-5l1-5c2-7%203-10%208-15l4-4%207-2%207-2h7l6%201%205%202%205%202%203%204%204%203%202%206%202%205v13l-2%205-2%206-4%204-3%203-5%202-4%202-9%201h-9l-5-2zm22-11%204-2%203-4%202-5V34l-2-4-2-4-3-2-4-3-5-1h-6l-4%202-5%202-2%204-3%205-1%203v4l1%205%202%205%202%202%205%203%204%202h10l4-2zM37%2039V11h33l3%201%203%202%204%203%203%203%201%205%201%204v5l-1%204-3%204-3%205-4%201-3%202-11%201H49v16H37V39zm31%200%203-2%201-2%201-2v-4l-1-3-3-2-2-2H49v18h15l4-1zm107%2025a512%20512%200%200%200-19-53h14l4%2014%206%2019%201%204%201-1%207-19%205-17h9l6%2019%207%2018v-1l2-6%205-17%204-13h14v1l-4%2012-16%2041v2h-5l-5-1-6-15-6-15-1%201-3%207-6%2015-2%208h-11l-1-3zm74-25V11h42v11h-29v2l-1%205v4h29v11h-28v11h2l15%201h13v11h-43V39zm55%200V11h33l5%203%205%202%202%204%202%205v10l-2%203-1%204-5%203-5%203%205%205%208%2010%203%204h-14l-7-9-8-10h-9v19h-12V39zm33-3%202-3v-6l-3-3-2-3h-18v16h1v1h17l2-2zm26%203V11h42v11h-29l-1%206v5h29v11h-28v5l-1%205%201%201v1h30v11h-43V39zm54%200V11h17l18%201%204%202%205%203%202%204%203%204%202%206%201%206v5c-1%206-3%2012-6%2015l-3%204-5%203-5%202-17%201h-16V39zm33%2014%205-5%202-3v-6l-1-6-1-3-1-3-4-3-3-2h-5l-6-1-3%201h-3v34h9l8-1%203-2zm50-14V11h34l5%202%204%202%202%203%202%203v9l-2%202-3%204-1%201%203%203%203%204%201%203%201%204-1%204-1%204-3%203-3%203-5%201-5%201h-31V39zm34%2015%202-1v-6l-2-2-2-2h-20v13h20l2-2zm-3-22%204-2v-6l-2-1-2-2h-19v12h16l4-1zm42%2024V45l-6-9-11-17-5-8h15l4%208%207%2011%202%203%207-11%207-11h14l-11%2016-11%2017v23h-12V56z'/%3e%3c/svg%3e",bt=[["aa","Afar","Afaraf"],["ab","Abkhaz","аҧсуа бызшәа"],["ae","Avestan","avesta"],["af","Afrikaans","Afrikaans"],["ak","Akan","Akan"],["am","Amharic","አማርኛ"],["an","Aragonese","aragonés"],["ar","Arabic","اللغة العربية"],["as","Assamese","অসমীয়া"],["av","Avaric","авар мацӀ"],["ay","Aymara","aymar aru"],["az","Azerbaijani","azərbaycan dili"],["ba","Bashkir","башҡорт теле"],["be","Belarusian","беларуская мова"],["bg","Bulgarian","български език"],["bh","Bihari","भोजपुरी"],["bi","Bislama","Bislama"],["bm","Bambara","bamanankan"],["bn","Bengali","বাংলা"],["bo","Tibetan","བོད་ཡིག"],["br","Breton","brezhoneg"],["bs","Bosnian","bosanski jezik"],["ca","Catalan","Català"],["ce","Chechen","нохчийн мотт"],["ch","Chamorro","Chamoru"],["co","Corsican","corsu"],["cr","Cree","ᓀᐦᐃᔭᐍᐏᐣ"],["cs","Czech","čeština"],["cu","Old Church Slavonic","ѩзыкъ словѣньскъ"],["cv","Chuvash","чӑваш чӗлхи"],["cy","Welsh","Cymraeg"],["da","Danish","dansk"],["de","German","Deutsch"],["dv","Divehi","Dhivehi"],["dz","Dzongkha","རྫོང་ཁ"],["ee","Ewe","Eʋegbe"],["el","Greek","Ελληνικά"],["en","English","English"],["eo","Esperanto","Esperanto"],["es","Spanish","Español"],["et","Estonian","eesti"],["eu","Basque","euskara"],["fa","Persian","فارسی"],["ff","Fula","Fulfulde"],["fi","Finnish","suomi"],["fj","Fijian","Vakaviti"],["fo","Faroese","føroyskt"],["fr","French","Français"],["fy","Western Frisian","Frysk"],["ga","Irish","Gaeilge"],["gd","Scottish Gaelic","Gàidhlig"],["gl","Galician","galego"],["gu","Gujarati","ગુજરાતી"],["gv","Manx","Gaelg"],["ha","Hausa","هَوُسَ"],["he","Hebrew","עברית"],["hi","Hindi","हिन्दी"],["ho","Hiri Motu","Hiri Motu"],["hr","Croatian","Hrvatski"],["ht","Haitian","Kreyòl ayisyen"],["hu","Hungarian","magyar"],["hy","Armenian","Հայերեն"],["hz","Herero","Otjiherero"],["ia","Interlingua","Interlingua"],["id","Indonesian","Bahasa Indonesia"],["ie","Interlingue","Interlingue"],["ig","Igbo","Asụsụ Igbo"],["ii","Nuosu","ꆈꌠ꒿ Nuosuhxop"],["ik","Inupiaq","Iñupiaq"],["io","Ido","Ido"],["is","Icelandic","Íslenska"],["it","Italian","Italiano"],["iu","Inuktitut","ᐃᓄᒃᑎᑐᑦ"],["ja","Japanese","日本語"],["jv","Javanese","basa Jawa"],["ka","Georgian","ქართული"],["kg","Kongo","Kikongo"],["ki","Kikuyu","Gĩkũyũ"],["kj","Kwanyama","Kuanyama"],["kk","Kazakh","қазақ тілі"],["kl","Kalaallisut","kalaallisut"],["km","Khmer","ខេមរភាសា"],["kn","Kannada","ಕನ್ನಡ"],["ko","Korean","한국어"],["kr","Kanuri","Kanuri"],["ks","Kashmiri","कश्मीरी"],["ku","Kurmanji (Kurdish)","Kurmancî"],["kv","Komi","коми кыв"],["kw","Cornish","Kernewek"],["ky","Kyrgyz","Кыргызча"],["la","Latin","latine"],["lb","Luxembourgish","Lëtzebuergesch"],["lg","Ganda","Luganda"],["li","Limburgish","Limburgs"],["ln","Lingala","Lingála"],["lo","Lao","ລາວ"],["lt","Lithuanian","lietuvių kalba"],["lu","Luba-Katanga","Tshiluba"],["lv","Latvian","latviešu valoda"],["mg","Malagasy","fiteny malagasy"],["mh","Marshallese","Kajin M̧ajeļ"],["mi","Māori","te reo Māori"],["mk","Macedonian","македонски јазик"],["ml","Malayalam","മലയാളം"],["mn","Mongolian","Монгол хэл"],["mr","Marathi","मराठी"],["ms","Malay","Bahasa Melayu"],["mt","Maltese","Malti"],["my","Burmese","ဗမာစာ"],["na","Nauru","Ekakairũ Naoero"],["nb","Norwegian Bokmål","Norsk bokmål"],["nd","Northern Ndebele","isiNdebele"],["ne","Nepali","नेपाली"],["ng","Ndonga","Owambo"],["nl","Dutch","Nederlands"],["nn","Norwegian Nynorsk","Norsk Nynorsk"],["no","Norwegian","Norsk"],["nr","Southern Ndebele","isiNdebele"],["nv","Navajo","Diné bizaad"],["ny","Chichewa","chiCheŵa"],["oc","Occitan","occitan"],["oj","Ojibwe","ᐊᓂᔑᓈᐯᒧᐎᓐ"],["om","Oromo","Afaan Oromoo"],["or","Oriya","ଓଡ଼ିଆ"],["os","Ossetian","ирон æвзаг"],["pa","Panjabi","ਪੰਜਾਬੀ"],["pi","Pāli","पाऴि"],["pl","Polish","Polski"],["ps","Pashto","پښتو"],["pt","Portuguese","Português"],["qu","Quechua","Runa Simi"],["rm","Romansh","rumantsch grischun"],["rn","Kirundi","Ikirundi"],["ro","Romanian","Română"],["ru","Russian","Русский"],["rw","Kinyarwanda","Ikinyarwanda"],["sa","Sanskrit","संस्कृतम्"],["sc","Sardinian","sardu"],["sd","Sindhi","सिन्धी"],["se","Northern Sami","Davvisámegiella"],["sg","Sango","yângâ tî sängö"],["si","Sinhala","සිංහල"],["sk","Slovak","slovenčina"],["sl","Slovenian","slovenščina"],["sn","Shona","chiShona"],["so","Somali","Soomaaliga"],["sq","Albanian","Shqip"],["sr","Serbian","српски језик"],["ss","Swati","SiSwati"],["st","Southern Sotho","Sesotho"],["su","Sundanese","Basa Sunda"],["sv","Swedish","Svenska"],["sw","Swahili","Kiswahili"],["ta","Tamil","தமிழ்"],["te","Telugu","తెలుగు"],["tg","Tajik","тоҷикӣ"],["th","Thai","ไทย"],["ti","Tigrinya","ትግርኛ"],["tk","Turkmen","Türkmen"],["tl","Tagalog","Wikang Tagalog"],["tn","Tswana","Setswana"],["to","Tonga","faka Tonga"],["tr","Turkish","Türkçe"],["ts","Tsonga","Xitsonga"],["tt","Tatar","татар теле"],["tw","Twi","Twi"],["ty","Tahitian","Reo Tahiti"],["ug","Uyghur","ئۇيغۇرچە‎"],["uk","Ukrainian","Українська"],["ur","Urdu","اردو"],["uz","Uzbek","Ўзбек"],["ve","Venda","Tshivenḓa"],["vi","Vietnamese","Tiếng Việt"],["vo","Volapük","Volapük"],["wa","Walloon","walon"],["wo","Wolof","Wollof"],["xh","Xhosa","isiXhosa"],["yi","Yiddish","ייִדיש"],["yo","Yoruba","Yorùbá"],["za","Zhuang","Saɯ cueŋƅ"],["zh","Chinese","中文"],["zu","Zulu","isiZulu"],["zh-CN","Chinese (China)","简体中文"],["zh-HK","Chinese (Hong Kong)","繁體中文(香港)"],["zh-TW","Chinese (Taiwan)","繁體中文(臺灣)"],["zh-YUE","Cantonese","廣東話"],["ast","Asturian","Asturianu"],["chr","Cherokee","ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ"],["ckb","Sorani (Kurdish)","سۆرانی"],["cnr","Montenegrin","crnogorski"],["jbo","Lojban","la .lojban."],["kab","Kabyle","Taqbaylit"],["ldn","Láadan","Láadan"],["lfn","Lingua Franca Nova","lingua franca nova"],["sco","Scots","Scots"],["sma","Southern Sami","Åarjelsaemien Gïele"],["smj","Lule Sami","Julevsámegiella"],["szl","Silesian","ślůnsko godka"],["tok","Toki Pona","toki pona"],["xal","Kalmyk","Хальмг келн"],["zba","Balaibalan","باليبلن"],["zgh","Standard Moroccan Tamazight","ⵜⴰⵎⴰⵣⵉⵖⵜ"]],Wn="(((?:[^A-Za-z0-9@@$##\\uFFFE\\uFEFF\\uFFFF]|[\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069]|^))((https?:\\/\\/)((?:(?:(?:[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/](?:[_-]|[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/])*)?[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/]\\.)*(?:(?:[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/](?:-|[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/])*)?[^/\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$//\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000//\\uFFFE\\uFEFF\\uFFFF//\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/]\\.)(?:(?:(?:삼성|닷컴|닷넷|香格里拉|餐厅|食品|飞利浦|電訊盈科|集团|通販|购物|谷歌|诺基亚|联通|网络|网站|网店|网址|组织机构|移动|珠宝|点看|游戏|淡马锡|机构|書籍|时尚|新闻|政府|政务|招聘|手表|手机|我爱你|慈善|微博|广东|工行|家電|娱乐|天主教|大拿|大众汽车|在线|嘉里大酒店|嘉里|商标|商店|商城|公益|公司|八卦|健康|信息|佛山|企业|中文网|中信|世界|ポイント|ファッション|セール|ストア|コム|グーグル|クラウド|みんな|คอม|संगठन|नेट|कॉम|همراه|موقع|موبايلي|كوم|كاثوليك|عرب|شبكة|بيتك|بازار|العليان|ارامكو|اتصالات|ابوظبي|קום|сайт|рус|орг|онлайн|москва|ком|католик|дети|zuerich|zone|zippo|zip|zero|zara|zappos|yun|youtube|you|yokohama|yoga|yodobashi|yandex|yamaxun|yahoo|yachts|xyz|xxx|xperia|xin|xihuan|xfinity|xerox|xbox|wtf|wtc|wow|world|works|work|woodside|wolterskluwer|wme|winners|wine|windows|win|williamhill|wiki|wien|whoswho|weir|weibo|wedding|wed|website|weber|webcam|weatherchannel|weather|watches|watch|warman|wanggou|wang|walter|walmart|wales|vuelos|voyage|voto|voting|vote|volvo|volkswagen|vodka|vlaanderen|vivo|viva|vistaprint|vista|vision|visa|virgin|vip|vin|villas|viking|vig|video|viajes|vet|versicherung|vermögensberatung|vermögensberater|verisign|ventures|vegas|vanguard|vana|vacations|ups|uol|uno|university|unicom|uconnect|ubs|ubank|tvs|tushu|tunes|tui|tube|trv|trust|travelersinsurance|travelers|travelchannel|travel|training|trading|trade|toys|toyota|town|tours|total|toshiba|toray|top|tools|tokyo|today|tmall|tkmaxx|tjx|tjmaxx|tirol|tires|tips|tiffany|tienda|tickets|tiaa|theatre|theater|thd|teva|tennis|temasek|telefonica|telecity|tel|technology|tech|team|tdk|tci|taxi|tax|tattoo|tatar|tatamotors|target|taobao|talk|taipei|tab|systems|symantec|sydney|swiss|swiftcover|swatch|suzuki|surgery|surf|support|supply|supplies|sucks|style|study|studio|stream|store|storage|stockholm|stcgroup|stc|statoil|statefarm|statebank|starhub|star|staples|stada|srt|srl|spreadbetting|spot|sport|spiegel|space|soy|sony|song|solutions|solar|sohu|software|softbank|social|soccer|sncf|smile|smart|sling|skype|sky|skin|ski|site|singles|sina|silk|shriram|showtime|show|shouji|shopping|shop|shoes|shiksha|shia|shell|shaw|sharp|shangrila|sfr|sexy|sex|sew|seven|ses|services|sener|select|seek|security|secure|seat|search|scot|scor|scjohnson|science|schwarz|schule|school|scholarships|schmidt|schaeffler|scb|sca|sbs|sbi|saxo|save|sas|sarl|sapo|sap|sanofi|sandvikcoromant|sandvik|samsung|samsclub|salon|sale|sakura|safety|safe|saarland|ryukyu|rwe|run|ruhr|rugby|rsvp|room|rogers|rodeo|rocks|rocher|rmit|rip|rio|ril|rightathome|ricoh|richardli|rich|rexroth|reviews|review|restaurant|rest|republican|report|repair|rentals|rent|ren|reliance|reit|reisen|reise|rehab|redumbrella|redstone|red|recipes|realty|realtor|realestate|read|raid|radio|racing|qvc|quest|quebec|qpon|pwc|pub|prudential|pru|protection|property|properties|promo|progressive|prof|productions|prod|pro|prime|press|praxi|pramerica|post|porn|politie|poker|pohl|pnc|plus|plumbing|playstation|play|place|pizza|pioneer|pink|ping|pin|pid|pictures|pictet|pics|piaget|physio|photos|photography|photo|phone|philips|phd|pharmacy|pfizer|pet|pccw|pay|passagens|party|parts|partners|pars|paris|panerai|panasonic|pamperedchef|page|ovh|ott|otsuka|osaka|origins|orientexpress|organic|org|orange|oracle|open|ooo|onyourside|online|onl|ong|one|omega|ollo|oldnavy|olayangroup|olayan|okinawa|office|off|observer|obi|nyc|ntt|nrw|nra|nowtv|nowruz|now|norton|northwesternmutual|nokia|nissay|nissan|ninja|nikon|nike|nico|nhk|ngo|nfl|nexus|nextdirect|next|news|newholland|new|neustar|network|netflix|netbank|net|nec|nba|navy|natura|nationwide|name|nagoya|nadex|nab|mutuelle|mutual|museum|mtr|mtpc|mtn|msd|movistar|movie|mov|motorcycles|moto|moscow|mortgage|mormon|mopar|montblanc|monster|money|monash|mom|moi|moe|moda|mobily|mobile|mobi|mma|mls|mlb|mitsubishi|mit|mint|mini|mil|microsoft|miami|metlife|merckmsd|meo|menu|men|memorial|meme|melbourne|meet|media|med|mckinsey|mcdonalds|mcd|mba|mattel|maserati|marshalls|marriott|markets|marketing|market|map|mango|management|man|makeup|maison|maif|madrid|macys|luxury|luxe|lupin|lundbeck|ltda|ltd|lplfinancial|lpl|love|lotto|lotte|london|lol|loft|locus|locker|loans|loan|llp|llc|lixil|living|live|lipsy|link|linde|lincoln|limo|limited|lilly|like|lighting|lifestyle|lifeinsurance|life|lidl|liaison|lgbt|lexus|lego|legal|lefrak|leclerc|lease|lds|lawyer|law|latrobe|latino|lat|lasalle|lanxess|landrover|land|lancome|lancia|lancaster|lamer|lamborghini|ladbrokes|lacaixa|kyoto|kuokgroup|kred|krd|kpn|kpmg|kosher|komatsu|koeln|kiwi|kitchen|kindle|kinder|kim|kia|kfh|kerryproperties|kerrylogistics|kerryhotels|kddi|kaufen|juniper|juegos|jprs|jpmorgan|joy|jot|joburg|jobs|jnj|jmp|jll|jlc|jio|jewelry|jetzt|jeep|jcp|jcb|java|jaguar|iwc|iveco|itv|itau|istanbul|ist|ismaili|iselect|irish|ipiranga|investments|intuit|international|intel|int|insure|insurance|institute|ink|ing|info|infiniti|industries|inc|immobilien|immo|imdb|imamat|ikano|iinet|ifm|ieee|icu|ice|icbc|ibm|hyundai|hyatt|hughes|htc|hsbc|how|house|hotmail|hotels|hoteles|hot|hosting|host|hospital|horse|honeywell|honda|homesense|homes|homegoods|homedepot|holiday|holdings|hockey|hkt|hiv|hitachi|hisamitsu|hiphop|hgtv|hermes|here|helsinki|help|healthcare|health|hdfcbank|hdfc|hbo|haus|hangout|hamburg|hair|guru|guitars|guide|guge|gucci|guardian|group|grocery|gripe|green|gratis|graphics|grainger|gov|got|gop|google|goog|goodyear|goodhands|goo|golf|goldpoint|gold|godaddy|gmx|gmo|gmbh|gmail|globo|global|gle|glass|glade|giving|gives|gifts|gift|ggee|george|genting|gent|gea|gdn|gbiz|gay|garden|gap|games|game|gallup|gallo|gallery|gal|fyi|futbol|furniture|fund|fun|fujixerox|fujitsu|ftr|frontier|frontdoor|frogans|frl|fresenius|free|fox|foundation|forum|forsale|forex|ford|football|foodnetwork|food|foo|fly|flsmidth|flowers|florist|flir|flights|flickr|fitness|fit|fishing|fish|firmdale|firestone|fire|financial|finance|final|film|fido|fidelity|fiat|ferrero|ferrari|feedback|fedex|fast|fashion|farmers|farm|fans|fan|family|faith|fairwinds|fail|fage|extraspace|express|exposed|expert|exchange|everbank|events|eus|eurovision|etisalat|esurance|estate|esq|erni|ericsson|equipment|epson|epost|enterprises|engineering|engineer|energy|emerck|email|education|edu|edeka|eco|eat|earth|dvr|dvag|durban|dupont|duns|dunlop|duck|dubai|dtv|drive|download|dot|doosan|domains|doha|dog|dodge|doctor|docs|dnp|diy|dish|discover|discount|directory|direct|digital|diet|diamonds|dhl|dev|design|desi|dentist|dental|democrat|delta|deloitte|dell|delivery|degree|deals|dealer|deal|dds|dclk|day|datsun|dating|date|data|dance|dad|dabur|cyou|cymru|cuisinella|csc|cruises|cruise|crs|crown|cricket|creditunion|creditcard|credit|cpa|courses|coupons|coupon|country|corsica|coop|cool|cookingchannel|cooking|contractors|contact|consulting|construction|condos|comsec|computer|compare|company|community|commbank|comcast|com|cologne|college|coffee|codes|coach|clubmed|club|cloud|clothing|clinique|clinic|click|cleaning|claims|cityeats|city|citic|citi|citadel|cisco|circle|cipriani|church|chrysler|chrome|christmas|chloe|chintai|cheap|chat|chase|charity|channel|chanel|cfd|cfa|cern|ceo|center|ceb|cbs|cbre|cbn|cba|catholic|catering|cat|casino|cash|caseih|case|casa|cartier|cars|careers|career|care|cards|caravan|car|capitalone|capital|capetown|canon|cancerresearch|camp|camera|cam|calvinklein|call|cal|cafe|cab|bzh|buzz|buy|business|builders|build|bugatti|budapest|brussels|brother|broker|broadway|bridgestone|bradesco|box|boutique|bot|boston|bostik|bosch|boots|booking|book|boo|bond|bom|bofa|boehringer|boats|bnpparibas|bnl|bmw|bms|blue|bloomberg|blog|blockbuster|blanco|blackfriday|black|biz|bio|bingo|bing|bike|bid|bible|bharti|bet|bestbuy|best|berlin|bentley|beer|beauty|beats|bcn|bcg|bbva|bbt|bbc|bayern|bauhaus|basketball|baseball|bargains|barefoot|barclays|barclaycard|barcelona|bar|bank|band|bananarepublic|banamex|baidu|baby|azure|axa|aws|avianca|autos|auto|author|auspost|audio|audible|audi|auction|attorney|athleta|associates|asia|asda|arte|art|arpa|army|archi|aramco|arab|aquarelle|apple|app|apartments|aol|anz|anquan|android|analytics|amsterdam|amica|amfam|amex|americanfamily|americanexpress|alstom|alsace|ally|allstate|allfinanz|alipay|alibaba|alfaromeo|akdn|airtel|airforce|airbus|aigo|aig|agency|agakhan|africa|afl|afamilycompany|aetna|aero|aeg|adult|ads|adac|actor|active|aco|accountants|accountant|accenture|academy|abudhabi|abogado|able|abc|abbvie|abbott|abb|abarth|aarp|aaa|onion)(?=[^0-9a-zA-Z@+-]|$))|(?:(?:한국|香港|澳門|新加坡|台灣|台湾|中國|中国|გე|ລາວ|ไทย|ලංකා|ഭാരതം|ಭಾರತ|భారత్|சிங்கப்பூர்|இலங்கை|இந்தியா|ଭାରତ|ભારત|ਭਾਰਤ|ভাৰত|ভারত|বাংলা|भारोत|भारतम्|भारत|ڀارت|پاکستان|موريتانيا|مليسيا|مصر|قطر|فلسطين|عمان|عراق|سورية|سودان|تونس|بھارت|بارت|ایران|امارات|المغرب|السعودية|الجزائر|البحرين|الاردن|հայ|қаз|укр|срб|рф|мон|мкд|ею|бел|бг|ευ|ελ|zw|zm|za|yt|ye|ws|wf|vu|vn|vi|vg|ve|vc|va|uz|uy|us|um|uk|ug|ua|tz|tw|tv|tt|tr|tp|to|tn|tm|tl|tk|tj|th|tg|tf|td|tc|sz|sy|sx|sv|su|st|ss|sr|so|sn|sm|sl|sk|sj|si|sh|sg|se|sd|sc|sb|sa|rw|ru|rs|ro|re|qa|py|pw|pt|ps|pr|pn|pm|pl|pk|ph|pg|pf|pe|pa|om|nz|nu|nr|np|no|nl|ni|ng|nf|ne|nc|na|mz|my|mx|mw|mv|mu|mt|ms|mr|mq|mp|mo|mn|mm|ml|mk|mh|mg|mf|me|md|mc|ma|ly|lv|lu|lt|ls|lr|lk|li|lc|lb|la|kz|ky|kw|kr|kp|kn|km|ki|kh|kg|ke|jp|jo|jm|je|it|is|ir|iq|io|in|im|il|ie|id|hu|ht|hr|hn|hm|hk|gy|gw|gu|gt|gs|gr|gq|gp|gn|gm|gl|gi|gh|gg|gf|ge|gd|gb|ga|fr|fo|fm|fk|fj|fi|eu|et|es|er|eh|eg|ee|ec|dz|do|dm|dk|dj|de|cz|cy|cx|cw|cv|cu|cr|co|cn|cm|cl|ck|ci|ch|cg|cf|cd|cc|ca|bz|by|bw|bv|bt|bs|br|bq|bo|bn|bm|bl|bj|bi|bh|bg|bf|be|bd|bb|ba|az|ax|aw|au|at|as|ar|aq|ao|an|am|al|ai|ag|af|ae|ad|ac)(?=[^0-9a-zA-Z@+-]|$))|(?:xn--[\\-0-9a-z]+))))(?::([0-9]+))?(\\/(?:(?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*(?:\\((?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+|(?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*\\([a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+\\)[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*))\\)[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*)*[\\+\\-a-z\\u0400-\\u04FF0-9=_#\\/\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]|(?:\\((?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+|(?:[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*\\([a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+\\)[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]*))\\)))|(?:@[a-z\\u0400-\\u04FF0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF]+\\/))*)?(\\?[a-z0-9!?\\*'@\\(\\);:&=\\+\\$\\/%#\\[\\]\\-_\\.,~|]*[a-z0-9\\-_&=#\\/])?))",Un="gi",Tt={source:Wn,flags:Un};var qn={PHANPY_CLIENT_NAME:"Phanpy",PHANPY_WEBSITE:"https://phanpy.social",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",VITE_APP_ENV:"production",BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{PHANPY_IMG_ALT_API_URL:ut,PHANPY_GIPHY_API_KEY:Kn}=qn,Vn=bt.reduce((s,e)=>{const[n,o,r]=e;return s[n]={common:o,native:r},s},{}),qt={"5 minutes":5*60,"30 minutes":30*60,"1 hour":60*60,"6 hours":6*60*60,"12 hours":12*60*60,"1 day":24*60*60,"3 days":3*24*60*60,"7 days":7*24*60*60},Gn=Object.values(qt),_t=24*60*60,Rt=s=>{if(!s)return _t;const e=(new Date(s).getTime()-Date.now())/1e3;return Gn.find(n=>n>=e)||_t},ye=document.createElement("ul");ye.role="listbox";ye.className="text-expander-menu";const Yn=16,Zn=new IntersectionObserver(s=>{s.forEach(e=>{if(e.isIntersecting){const{left:n,width:o}=e.boundingClientRect,{innerWidth:r}=window;n+o>r&&(ye.style.left=r-o-Yn+"px")}})});Zn.observe(ye);const we=an([new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages],bt.map(s=>s[0]),"en"),Kt=new RegExp(Tt.source,Tt.flags),Jn=/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/gi,Xn="$2xxxxxxxxxxxxxxxxxxxxxxx";function Qn(s){return s.replace(Kt,Xn).replace(Jn,"$1@$3")}const ei=/[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i,ti=new RegExp(`(^|[^=\\/\\w])(@${ei.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,"uig"),ni=new RegExp("(^|[^=\\/\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\/\\w])","ig"),ii="[a-zA-Z0-9_]{2,}",si=new RegExp(`(^|[^=\\/\\w])(:${ii}:)(?=[^A-Za-z0-9_:]|$)`,"g"),ai=new Intl.Segmenter;function oi(s,{maxCharacters:e=1/0}){let n=s.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");const{composerCharacterCount:o}=le;if(o>e){let r="",p="";const u=ai.segment(n);for(const{segment:v,index:g}of u)g"),r+p}return n.replace(Kt,'$2$3').replace(ti,'$1$2').replace(ni,'$1$2').replace(si,'$1$2')}const ri=new Intl.RelativeTimeFormat,ft=100;function Ei({onClose:s,replyToStatus:e,editStatus:n,draftStatus:o,standalone:r,hasOpener:p}){var Ft;const{masto:u,instance:v}=vt(),[g,R]=H("default"),C=U((o==null?void 0:o.uid)||on()),k=bn(),S=k.info,Z=Nt(),{statuses:{maxCharacters:D,maxMediaAttachments:I,charactersReservedPerUrl:se}={},mediaAttachments:{supportedMimeTypes:J=[],imageSizeLimit:c,imageMatrixLimit:h,videoSizeLimit:m,videoMatrixLimit:f,videoFrameRateLimit:E}={},polls:{maxOptions:y,maxCharactersPerOption:B,maxExpiration:q,minExpiration:ue}={}}=Z||{},A=U(),X=U(),[V,W]=H("public"),[j,te]=H(!1),[O,ie]=H(ze.session.get("currentLanguage")||we),ae=U(O),[$,z]=H([]),[M,L]=H(null),N=ze.account.get("preferences")||{},Q=()=>{A.current&&A.current.dispatchEvent(new Event("input"))},oe=()=>{setTimeout(()=>{var a,l,b;A.current&&((l=(a=o==null?void 0:o.status)==null?void 0:a.startsWith)!=null&&l.call(a,` `)&&(A.current.selectionStart=0,A.current.selectionEnd=0),(b=A.current)==null||b.focus())},300)};ee(()=>{if(e){const{spoilerText:a,visibility:l,language:b,sensitive:d}=e;a&&X.current&&(X.current.value=a);const x=[...new Set([e.account.acct,...e.mentions.map(w=>w.acct)])].filter(w=>w!==S.acct);x.length>0&&(A.current.value=`${x.map(w=>`@${w}`).join(" ")} `,Q()),oe(),W(l==="public"&&N["posting:default:visibility"]?N["posting:default:visibility"]:l),ie(b||N.postingDefaultLanguage||we),te(d&&!!a)}else if(n){const{visibility:a,language:l,sensitive:b,poll:d,mediaAttachments:_}=n,x=!!(d!=null&&d.options)&&{...d,options:d.options.map(w=>(w==null?void 0:w.title)||w),expiresIn:(d==null?void 0:d.expiresIn)||Rt(d.expiresAt)};R("loading"),(async()=>{try{const w=await u.v1.statuses.$select(n.id).source.fetch(),{text:F,spoilerText:P}=w;A.current.value=F,A.current.dataset.source=F,Q(),oe(),X.current.value=P,W(a),ie(l||presf.postingDefaultLanguage||we),te(b),x&&L(x),z(_),R("default")}catch(w){alert((w==null?void 0:w.reason)||w),R("error")}})()}else oe(),N["posting:default:visibility"]&&W(N["posting:default:visibility"]),N["posting:default:language"]&&ie(N["posting:default:language"]),N["posting:default:sensitive"]&&te(N["posting:default:sensitive"]);if(o){const{status:a,spoilerText:l,visibility:b,language:d,sensitive:_,poll:x,mediaAttachments:w}=o,F=!!(x!=null&&x.options)&&{...x,options:x.options.map(P=>(P==null?void 0:P.title)||P),expiresIn:(x==null?void 0:x.expiresIn)||Rt(x.expiresAt)};A.current.value=a,Q(),oe(),l&&(X.current.value=l),b&&W(b),ie(d||N.postingDefaultLanguage||we),_!==null&&te(_),F&&L(F),w&&z(w)}},[o,n,e]);const he=U(),ve="You have unsaved changes. Discard this post?",xe=()=>{const{value:a,dataset:l}=A.current;if(g==="loading")return!1;const b=(a||"").trim().replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$","gu"),""),d=$.length>0;if(!b&&!d||$.length>0&&$.every(P=>P.id))return!0;const x=(e==null?void 0:e.account.id)===S.id,w=e&&a.trim()===`@${e.account.acct}`;return!!(!x&&w||a===(l==null?void 0:l.source))},Oe=()=>xe()?!0:confirm(ve);ee(()=>{const a=l=>{xe()||(l.preventDefault(),l.returnValue=ve)};return window.addEventListener("beforeunload",a,{capture:!0}),()=>window.removeEventListener("beforeunload",a,{capture:!0})},[]);const Yt=()=>{const{value:a}=A.current,{value:l}=X.current;return Bt(Qn(a))+Bt(l)},tt=()=>{const a=Yt();le.composerCharacterCount=a};ee(tt,[]);const xt=window.CloseWatcher,nt=U(!1);_e("esc",()=>{nt.current=!0},{enabled:!xt,enableOnFormTags:!0}),_e("esc",()=>{!r&&nt.current&&Oe()&&s(),nt.current=!1},{enabled:!xt,enableOnFormTags:!0,keyup:!0,ignoreEventWhen:a=>{const l=document.querySelectorAll("#modal-container > *"),b=!!l,d=l.length===1&&l[0].querySelector("#compose-container");return b&&!d}}),rn(()=>{!r&&Oe()&&s()},[r,Oe,s]);const wt=U({}),kt=()=>`${yn()}#${C.current}`,it=()=>{if(n||le.composerState.minimized)return;const a=kt(),l={key:a,replyTo:e?{id:e.id,account:{id:e.account.id,username:e.account.username,acct:e.account.acct}}:null,draftStatus:{uid:C.current,status:A.current.value,spoilerText:X.current.value,visibility:V,language:O,sensitive:j,poll:M,mediaAttachments:$}};!xn(l,wt.current)&&!xe()&&(zt.drafts.set(a,{...l,state:"unsaved",updatedAt:Date.now()}).then(()=>{}).catch(b=>{}),wt.current=structuredClone(l))};ln(it,5e3),ee(()=>(it(),()=>{zt.drafts.del(kt())}),[]),ee(()=>{const a=b=>{const{items:d}=b.clipboardData||b.dataTransfer,_=[];for(let x=0;x0&&$.length>=I){alert(`You can only attach up to ${I} files.`);return}if(_.length>0){b.preventDefault(),b.stopPropagation();const x=I-$.length,w=_.slice(0,x);if(w.length<=0){alert(`You can only attach up to ${I} files.`);return}const F=w.map(P=>({file:P,type:P.type,size:P.size,url:URL.createObjectURL(P),id:null,description:null}));z([...$,...F])}};window.addEventListener("paste",a);const l=b=>{b.dataTransfer.items.length>0&&(b.preventDefault(),b.stopPropagation())};return window.addEventListener("dragover",l),window.addEventListener("drop",a),()=>{window.removeEventListener("paste",a),window.removeEventListener("dragover",l),window.removeEventListener("drop",a)}},[$]);const[He,st]=H(!1),[Ne,We]=H(!1),[Zt,at]=H(!1),[me,Jt]=H(null),[Xt,Qt]=Re(()=>{const a=[],l=[],{contentTranslationHideLanguages:b=[]}=le.settings;return bt.forEach(d=>{const[_]=d;_===O||_===ae.current||_===we||b.includes(_)||me!=null&&me.length&&me.includes(_)?a.push(d):l.push(d)}),a.sort(([d,_],[x,w])=>d===O?-1:x===O?1:_.localeCompare(w)),l.sort(([d,_],[x,w])=>_.localeCompare(w)),[a,l]},[O,me]),Et=Re(()=>!!(e!=null&&e.createdAt)&&Math.floor((Date.now()-new Date(e.createdAt))/(1e3*60*60*24*30)),[e]),en=()=>{it(),le.composerState.minimized=!0};return t("div",{id:"compose-container-outer",children:[t("div",{id:"compose-container",class:r?"standalone":"",children:[t("div",{class:"compose-top",children:[(S==null?void 0:S.avatarStatic)&&t(Ot,{account:S,accountInstance:k.instanceURL,hideDisplayName:!0,useAvatarStatic:!0}),r?p&&t("button",{type:"button",class:"light pop-button",disabled:g==="loading",onClick:()=>{var a;if(!window.opener){alert("Looks like you closed the parent window.");return}if(window.opener.__STATES__.showCompose){if((a=window.opener.__STATES__.composerState)!=null&&a.publishing){alert("Looks like you already have a compose field open in the parent window and currently publishing. Please wait for it to be done and try again later.");return}if(!confirm("Looks like you already have a compose field open in the parent window. Popping in this window will discard the changes you made in the parent window. Continue?"))return}s({fn:()=>{const l={editStatus:n,replyToStatus:e,draftStatus:{uid:C.current,status:A.current.value,spoilerText:X.current.value,visibility:V,language:O,sensitive:j,poll:M,mediaAttachments:$}};window.opener.__COMPOSE__=l,window.opener.__STATES__.showCompose?(window.opener.__STATES__.showCompose=!1,setTimeout(()=>{window.opener.__STATES__.showCompose=!0},10)):window.opener.__STATES__.showCompose=!0,window.opener.__STATES__.composerState.minimized&&(window.opener.__STATES__.composerState.minimized=!1)}})},children:t(K,{icon:"popin",alt:"Pop in"})}):t("span",{class:"compose-controls",children:[t("button",{type:"button",class:"plain4 pop-button",disabled:g==="loading",onClick:()=>{cn({editStatus:n,replyToStatus:e,draftStatus:{uid:C.current,status:A.current.value,spoilerText:X.current.value,visibility:V,language:O,sensitive:j,poll:M,mediaAttachments:$}})&&s()},children:t(K,{icon:"popout",alt:"Pop out"})}),t("button",{type:"button",class:"plain4 min-button",onClick:en,children:t(K,{icon:"minimize",alt:"Minimize"})})," ",t("button",{type:"button",class:"light close-button",disabled:g==="loading",onClick:()=>{Oe()&&s()},children:t(K,{icon:"x"})})]})]}),!!e&&t("div",{class:"status-preview",children:[t(Lt,{status:e,size:"s",previewMode:!0}),t("div",{class:"status-preview-legend reply-to",children:["Replying to @",e.account.acct||e.account.username,"’s post",Et>=3&&t(Ce,{children:[" ","(",t("strong",{children:ri.format(-Et,"month")}),")"]})]})]}),!!n&&t("div",{class:"status-preview",children:[t(Lt,{status:n,size:"s",previewMode:!0}),t("div",{class:"status-preview-legend",children:"Editing source post"})]}),t("form",{ref:he,class:`form-visibility-${V}`,style:{pointerEvents:g==="loading"?"none":"auto",opacity:g==="loading"?.5:1},onKeyDown:a=>{a.key==="Enter"&&(a.ctrlKey||a.metaKey)&&he.current.dispatchEvent(new Event("submit",{cancelable:!0}))},onSubmit:a=>{a.preventDefault();const l=new FormData(a.target),b=Object.fromEntries(l.entries());let{status:d,visibility:_,sensitive:x,spoilerText:w}=b;if(x=x==="on",M){if(M.options.length<2){alert("Poll must have at least 2 options");return}if(M.options.some(F=>F==="")){alert("Some poll choices are empty");return}}$.length>0&&$.some(P=>{var ne,Me;return!((Me=(ne=P.description)==null?void 0:ne.trim)!=null&&Me.call(ne))})&&!confirm("Some media have no descriptions. Continue?")||(w=x&&w||void 0,d=d===""?void 0:d,le.composerState.publishing=!0,R("loading"),(async()=>{try{if($.length>0){const ne=$.map(ge=>{const{file:Ue,description:tn,id:nn}=ge;if(nn)return ge;{const sn=Pt({file:Ue,description:tn});return u.v2.media.create(sn).then(ot=>(ot.id&&(ge.id=ot.id),ot))}}),Me=await Promise.allSettled(ne);if(Me.some(ge=>{var Ue;return ge.status==="rejected"||!((Ue=ge.value)!=null&&Ue.id)})){le.composerState.publishing=!1,le.composerState.publishingError=!0,R("error"),Me.forEach(ge=>{ge.status==="rejected"&&alert(ge.reason||`Attachment #${i} failed`)});return}}let F={status:d,spoiler_text:w,language:O,sensitive:x,poll:M,media_ids:$.map(ne=>ne.id)};n&&Ht("@mastodon/edit-media-attributes")?F.media_attributes=$.map(ne=>({id:ne.id,description:ne.description})):n||(F.visibility=_,F.in_reply_to_id=(e==null?void 0:e.id)||void 0),F=Pt(F);let P;if(n)P=await u.v1.statuses.$select(n.id).update(F),wn(P,v,{skipThreading:!0});else try{P=await u.v1.statuses.create(F,{requestInit:{headers:{"Idempotency-Key":C.current}}})}catch{P=await u.v1.statuses.create(F)}le.composerState.minimized=!1,le.composerState.publishing=!1,R("default"),s({type:n?"edit":e?"reply":"post",newStatus:P,instance:v})}catch(F){le.composerState.publishing=!1,le.composerState.publishingError=!0,alert((F==null?void 0:F.reason)||F),R("error")}})())},children:[t("div",{class:"toolbar stretch",children:[t("input",{ref:X,type:"text",name:"spoilerText",placeholder:"Content warning",disabled:g==="loading",class:"spoiler-text-field",lang:O,spellCheck:"true",dir:"auto",style:{opacity:j?1:0,pointerEvents:j?"auto":"none"},onInput:()=>{tt()}}),t("label",{class:`toolbar-button ${j?"highlight":""}`,title:"Content warning or sensitive media",children:[t("input",{name:"sensitive",type:"checkbox",checked:j,disabled:g==="loading",onChange:a=>{var b,d;const l=a.target.checked;te(l),l?(b=X.current)==null||b.focus():(d=A.current)==null||d.focus()}}),t(K,{icon:`eye-${j?"close":"open"}`})]})," ",t("label",{class:`toolbar-button ${V!=="public"&&!j?"show-field":""} ${V!=="public"?"highlight":""}`,title:`Visibility: ${V}`,children:[t(K,{icon:un[V],alt:V}),t("select",{name:"visibility",value:V,onChange:a=>{W(a.target.value)},disabled:g==="loading"||!!n,children:[t("option",{value:"public",children:["Public ",t(K,{icon:"earth"})]}),t("option",{value:"unlisted",children:"Unlisted"}),t("option",{value:"private",children:"Followers only"}),t("option",{value:"direct",children:"Private mention"})]})]})," "]}),t(ui,{ref:A,placeholder:e?"Post your reply":n?"Edit your post":"What are you doing?",required:($==null?void 0:$.length)===0,disabled:g==="loading",lang:O,onInput:()=>{tt()},maxCharacters:D,performSearch:a=>{const{type:l,q:b,limit:d}=a;return l==="accounts"?u.v1.accounts.search.list({q:b,limit:d,resolve:!1}):u.v2.search.fetch(a)},onTrigger:a=>{(a==null?void 0:a.name)==="custom-emojis"?We({defaultSearchTerm:(a==null?void 0:a.defaultSearchTerm)||null}):(a==null?void 0:a.name)==="mention"?st({defaultSearchTerm:(a==null?void 0:a.defaultSearchTerm)||null}):(a==null?void 0:a.name)==="auto-detect-language"&&(a!=null&&a.languages)&&Jt(a.languages)}}),($==null?void 0:$.length)>0&&t("div",{class:"media-attachments",children:[$.map((a,l)=>{const{id:b,file:d}=a,_=(d==null?void 0:d.size)+(d==null?void 0:d.type)+(d==null?void 0:d.name);return t(hi,{attachment:a,disabled:g==="loading",lang:O,onDescriptionChange:x=>{z(w=>{const F=[...w];return F[l].description=x,F})},onRemove:()=>{z(x=>x.filter((w,F)=>F!==l))}},b||_||l)}),t("label",{class:"media-sensitive",children:[t("input",{name:"sensitive",type:"checkbox",checked:j,disabled:g==="loading",onChange:a=>{const l=a.target.checked;te(l)}})," ",t("span",{children:"Mark media as sensitive"})," ",t(K,{icon:`eye-${j?"close":"open"}`})]})]}),!!M&&t(pi,{lang:O,maxOptions:y,maxExpiration:q,minExpiration:ue,maxCharactersPerOption:B,poll:M,disabled:g==="loading",onInput:a=>{if(a){const l={...a};L(l)}else L(null)}}),t("div",{class:"toolbar wrap",style:{justifyContent:"flex-end"},children:[t("span",{children:[t("label",{class:"toolbar-button",children:[t("input",{type:"file",accept:J.join(","),multiple:$.length=I||!!M,onChange:a=>{const l=a.target.files;if(!l)return;const b=Array.from(l).map(d=>({file:d,type:d.type,size:d.size,url:URL.createObjectURL(d),id:null,description:null}));$.length+b.length>I?alert(`You can only attach up to ${I} files.`):z(d=>d.concat(b)),a.target.value=""}}),t(K,{icon:"attachment"})]}),y==null||y>1&&t(Ce,{children:t("button",{type:"button",class:"toolbar-button",disabled:g==="loading"||!!M||!!$.length,onClick:()=>{L({options:["",""],expiresIn:24*60*60,multiple:!1})},children:t(K,{icon:"poll",alt:"Add poll"})})}),t("button",{type:"button",class:"toolbar-button",disabled:g==="loading",onClick:()=>{We(!0)},children:t(K,{icon:"emoji2"})}),!!le.settings.composerGIFPicker&&t("button",{type:"button",class:"toolbar-button gif-picker-button",disabled:g==="loading"||$.length>=I||!!M,onClick:()=>{at(!0)},children:t("span",{children:"GIF"})})]}),t("div",{class:"spacer"}),g==="loading"?t(et,{abrupt:!0}):t(di,{maxCharacters:D,hidden:g==="loading"}),t("label",{class:`toolbar-button ${O!==ae.current||me!=null&&me.length&&!me.includes(O)?"highlight":""}`,children:[t("span",{class:"icon-text",children:(Ft=Vn[O])==null?void 0:Ft.native}),t("select",{name:"language",value:O,onChange:a=>{const{value:l}=a.target;ie(l||we),ze.session.set("currentLanguage",l||we)},disabled:g==="loading",children:[Xt.map(([a,l,b])=>t("option",{value:a,children:[l," (",b,")"]},a)),t("hr",{}),Qt.map(([a,l,b])=>t("option",{value:a,children:[l," (",b,")"]},a))]})]})," ",t("button",{type:"submit",class:"large",disabled:g==="loading",children:e?"Reply":n?"Update":"Post"})]})]})]}),He&&t(Ve,{onClick:a=>{a.target===a.currentTarget&&st(!1)},children:t(mi,{masto:u,instance:v,onClose:()=>{st(!1)},defaultSearchTerm:He==null?void 0:He.defaultSearchTerm,onSelect:a=>{const l=A.current;if(!l)return;const{selectionStart:b,selectionEnd:d}=l,_=l.value,x=_.slice(0,b),w=x?/[\s\t\n\r]$/.test(x)?"":" ":"",F=_.slice(d),P=/^[\s\t\n\r]/.test(F)?"":" ",ne=x+w+"@"+a+P+F;l.value=ne,l.selectionStart=l.selectionEnd=d+1+a.length+P.length,l.focus(),l.dispatchEvent(new Event("input"))}})}),Ne&&t(Ve,{onClick:a=>{a.target===a.currentTarget&&We(!1)},children:t(gi,{masto:u,instance:v,onClose:()=>{We(!1)},defaultSearchTerm:Ne==null?void 0:Ne.defaultSearchTerm,onSelect:a=>{const l=A.current;if(!l)return;const{selectionStart:b,selectionEnd:d}=l,_=l.value,x=_.slice(0,b),w=x?/[\s\t\n\r]$/.test(x)?"":" ":"",F=_.slice(d),P=/^[\s\t\n\r]/.test(F)?"":" ",ne=x+w+a+P+F;l.value=ne,l.selectionStart=l.selectionEnd=d+a.length+P.length,l.focus(),l.dispatchEvent(new Event("input"))}})}),Zt&&t(Ve,{onClick:a=>{a.target===a.currentTarget&&at(!1)},children:t(vi,{onClose:()=>at(!1),onSelect:({url:a,type:l,alt_text:b})=>{if($.length>=I){alert(`You can only attach up to ${I} files.`);return}(async()=>{var _,x;let d;try{d=ke({text:"Downloading GIF…",duration:-1});const w=await fetch(a,{referrerPolicy:"no-referrer"}).then(ne=>ne.blob()),F=new File([w],l==="video/mp4"?"video.mp4":"image.gif",{type:l}),P=[...$,{file:F,type:l,size:F.size,id:null,description:b||""}];z(P),(_=d==null?void 0:d.hideToast)==null||_.call(d)}catch{(x=d==null?void 0:d.hideToast)==null||x.call(d),ke("Failed to download GIF")}})()}})})]})}function Dt(s){if(!s)return;const{value:e,offsetHeight:n,scrollHeight:o,clientHeight:r}=s;if(np.visibleInPicker),r=new dn(o,{keys:["shortcode"],findAllMatches:!0});return[o,r]}const Vt=kn(li,{matchesArg:(s,e)=>s.instance===e.instance,maxAge:30*60*1e3}),ci=s=>{const e=Cn(s);return e!=null&&e.length?e.slice(0,2).map(n=>n.lang):null},ui=En((s,e)=>{var J;const{masto:n,instance:o}=vt(),[r,p]=H(((J=e.current)==null?void 0:J.value)||""),{maxCharacters:u,performSearch:v=()=>{},onTrigger:g=()=>{},...R}=s,C=U();ee(()=>{Vt(o,n).then(c=>{const[h,m]=c;C.current=m}).catch(c=>{})},[]);const k=U(),S=U("");ee(()=>{let c,h,m;return k.current&&(c=f=>{var ue;const{key:E,provide:y,text:B}=f.detail;if(S.current=B,B===""){y(Promise.resolve({matched:!1}));return}if(E===":"){const A=(ue=C.current)==null?void 0:ue.search(B,{limit:5});let X="";A.forEach(({item:V})=>{const{shortcode:W,url:j}=V;X+=`
  • ${be(W)}
  • `}),X+=`
  • More…
  • `,ye.innerHTML=X,y(Promise.resolve({matched:A.length>0,fragment:ye}));return}const q={"@":"accounts","#":"hashtags"}[E];y(new Promise(A=>{v({type:q,q:B,limit:5}).then(V=>{if(B!==S.current)return;const W=V[q]||V;let j="";W.forEach(te=>{var Q;const{name:O,avatarStatic:ie,displayName:ae,username:$,acct:z,emojis:M,history:L}=te,N=hn(ae,M);if(z)j+=`
  • ${N||$}
    @${be(z)}
  • `;else{const oe=(Q=L==null?void 0:L.reduce)==null?void 0:Q.call(L,(he,ve)=>he+ +ve.uses,0);j+=`
  • #${be(O)} ${oe?`${pn(oe)}`:""}
  • `}}),q==="accounts"&&(j+=`
  • More…
  • `),ye.innerHTML=j,A({matched:W.length>0,fragment:ye})})}))},k.current.addEventListener("text-expander-change",c),h=f=>{const{key:E,item:y}=f.detail,{value:B,more:q}=y.dataset;E===":"?(f.detail.value=B?`:${B}:`:"​",q&&(f.detail.continue=!0,setTimeout(()=>{g==null||g({name:"custom-emojis",defaultSearchTerm:q})},300))):E==="@"?(f.detail.value=B?`@${B} `:"​",q&&(f.detail.continue=!0,setTimeout(()=>{g==null||g({name:"mention",defaultSearchTerm:q})},300))):f.detail.value=`${E}${B}`},k.current.addEventListener("text-expander-value",h),m=f=>{const{input:E}=f.detail;if(p(E.value),e.current){const y=new Event("input",{bubbles:!0});e.current.dispatchEvent(y)}},k.current.addEventListener("text-expander-committed",m)),()=>{k.current&&(k.current.removeEventListener("text-expander-change",c),k.current.removeEventListener("text-expander-value",h),k.current.removeEventListener("text-expander-committed",m))}},[]),ee(()=>{const c=e.current;if(!c)return;new ResizeObserver(()=>{if(k.current){const{height:m}=c.getBoundingClientRect();k.current.style.height=m+"px"}}).observe(c)},[]);const Z=U(0),D=U(),I=mn(c=>{var f;if(!D.current)return;if(Z.current>3){D.current.innerHTML="",D.current=null,(f=I==null?void 0:I.cancel)==null||f.call(I);return}let h,m;Z.current<=3&&(h=Date.now()),D.current.innerHTML=oi(c,{maxCharacters:u})+` `,Z.current<=3&&(m=Date.now()),h&&m&&m-h>50&&Z.current++},500),se=Qe(()=>{var f,E;const c=(f=D.current)==null?void 0:f.cloneNode(!0);if(!c)return;c.querySelectorAll("mark").forEach(y=>{y.remove()});const h=(E=c.innerText)==null?void 0:E.trim();if(!h)return;const m=ci(h);m!=null&&m.length&&(g==null||g({name:"auto-detect-language",languages:m}))},2e3);return t("text-expander",{ref:k,keys:"@ # :",class:"compose-field-container",children:[t("textarea",{class:"compose-field",autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",rows:"6",cols:"50",...R,ref:e,name:"status",value:r,onKeyDown:c=>{const{key:h,target:m}=c;if(h==="Enter"&&!(c.ctrlKey||c.metaKey))try{const{value:f,selectionStart:E}=m,B=f.slice(0,E).split(` `).slice(-1)[0];if(B&&/^\s*(-|\d+\.)\s/.test(B)){const[q,ue,A,X,V]=B.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(V){c.preventDefault();const[W]=A.match(/\d+/)||[],j=W?`${+W+1}.`:"-",te=` ${ue}${j}${X}`;m.setRangeText(te,E,E);const O=E+te.length;m.setSelectionRange(O,O)}else{const W=E-B.length;m.setRangeText("",W,E)}Dt(m),m.dispatchEvent(new Event("input"))}}catch{}D.current&&(D.current.scrollTop=m.scrollTop)},onInput:c=>{var f;const{target:h}=c,m=h.value.replace(/\u200b/g,"");p(m),Dt(h),(f=s.onInput)==null||f.call(s,c),I(m),se()},style:{width:"100%",height:"4em"},onScroll:c=>{if(D.current){const{scrollTop:h}=c.target;D.current.scrollTop=h}}}),t("div",{ref:D,class:"compose-highlight","aria-hidden":"true"})]})});function di({maxCharacters:s=500,hidden:e}){const o=Fn(le).composerCharacterCount,r=s-o;return e?t("span",{class:"char-counter",hidden:!0}):t("span",{class:"char-counter",title:`${r}/${s}`,style:{"--percentage":o/s*100},children:[t("meter",{class:`${r<=-10?"explode":r<=0?"danger":r<=20?"warning":""}`,value:o,max:s}),t("span",{class:"counter",children:r})]})}function Ke(s){const e=["bytes","KB","MB","GB","TB","PB","EB","ZB","YB"];let n=0;for(;s>=1024;)s/=1024,n++;return`${s.toFixed(0).toLocaleString()} ${e[n]}`}function jt(s,e,n,o){const r=Math.sqrt(e/s),p=Math.floor(n*r),u=Math.floor(o*r);return{newWidth:p,newHeight:u}}function hi({attachment:s,disabled:e,lang:n,onDescriptionChange:o=()=>{},onRemove:r=()=>{}}){const[p,u]=H("default"),v=Ht("@mastodon/edit-media-attributes"),{type:g,id:R,file:C}=s,k=Re(()=>C?URL.createObjectURL(C):s.url,[C,s.url]),S=!!(C!=null&&C.size),Z=S?Nt():{},{mediaAttachments:{imageSizeLimit:D,imageMatrixLimit:I,videoSizeLimit:se,videoMatrixLimit:J,videoFrameRateLimit:c}={}}=Z||{},[h,m]=H(()=>S?g.startsWith("image")&&D&&C.size>D?{type:"imageSizeLimit",details:{imageSize:C.size,imageSizeLimit:D}}:g.startsWith("video")&&se&&C.size>se?{type:"videoSizeLimit",details:{videoSize:C.size,videoSizeLimit:se}}:null:null),[f,E]=H({});ee(()=>{!S||!I||(f==null?void 0:f.matrix)>I&&m({type:"imageMatrixLimit",details:{imageMatrix:f==null?void 0:f.matrix,imageMatrixLimit:I,width:f==null?void 0:f.width,height:f==null?void 0:f.height}})},[f,I,S]);const[y,B]=H({});ee(()=>{!S||!J||(y==null?void 0:y.matrix)>J&&m({type:"videoMatrixLimit",details:{videoMatrix:y==null?void 0:y.matrix,videoMatrixLimit:J,width:y==null?void 0:y.width,height:y==null?void 0:y.height}})},[y,J,S]);const[q,ue]=H(s.description),[A,X]=g.split("/"),V=Qe(o,250);ee(()=>{V(q)},[q,V]);const[W,j]=H(!1),te=U(null);ee(()=>{let z;return W&&te.current&&(z=setTimeout(()=>{te.current.focus()},100)),()=>{clearTimeout(z)}},[W]);const O=t(Ce,{children:R&&!v?t("div",{class:"media-desc",children:[t("span",{class:"tag",children:"Uploaded"}),t("p",{title:q,children:s.description||t("i",{children:"No description"})})]}):t("textarea",{ref:te,value:q||"",lang:n,placeholder:{image:"Image description",video:"Video description",audio:"Audio description"}[A],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:e||p==="loading",class:p==="loading"?"loading":"",maxlength:"1500",onInput:z=>{const{value:M}=z.target;ue(M)}})}),ie=U(null);ee(()=>()=>{var z,M;(M=(z=ie.current)==null?void 0:z.hideToast)==null||M.call(z)},[]);const ae=U(null),$=z=>{const{type:M,details:L}=z;switch(M){case"imageSizeLimit":{const{imageSize:N,imageSizeLimit:Q}=L;return`File size too large. Uploading might encounter issues. Try reduce the file size from ${Ke(N)} to ${Ke(Q)} or lower.`}case"imageMatrixLimit":{const{imageMatrix:N,imageMatrixLimit:Q,width:oe,height:he}=L,{newWidth:ve,newHeight:xe}=jt(N,Q,oe,he);return`Dimension too large. Uploading might encounter issues. Try reduce dimension from ${oe.toLocaleString()}×${he.toLocaleString()}px to ${ve.toLocaleString()}×${xe.toLocaleString()}px.`}case"videoSizeLimit":{const{videoSize:N,videoSizeLimit:Q}=L;return`File size too large. Uploading might encounter issues. Try reduce the file size from ${Ke(N)} to ${Ke(Q)} or lower.`}case"videoMatrixLimit":{const{videoMatrix:N,videoMatrixLimit:Q,width:oe,height:he}=L,{newWidth:ve,newHeight:xe}=jt(N,Q,oe,he);return`Dimension too large. Uploading might encounter issues. Try reduce dimension from ${oe.toLocaleString()}×${he.toLocaleString()}px to ${ve.toLocaleString()}×${xe.toLocaleString()}px.`}case"videoFrameRateLimit":return"Frame rate too high. Uploading might encounter issues."}};return t(Ce,{children:[t("div",{class:"media-attachment",children:[t("div",{class:"media-preview",tabIndex:"0",onClick:()=>{j(!0)},children:A==="image"?t("img",{src:k,alt:"",onLoad:z=>{if(!S)return;const{naturalWidth:M,naturalHeight:L}=z.target;E({matrix:M*L,width:M,height:L})}}):A==="video"||A==="gifv"?t("video",{src:k+"#t=0.1",playsinline:!0,muted:!0,disablePictureInPicture:!0,preload:"metadata",onLoadedMetadata:z=>{if(!S)return;const{videoWidth:M,videoHeight:L}=z.target;M&&L&&B({matrix:M*L,width:M,height:L})}}):A==="audio"?t("audio",{src:k,controls:!0}):null}),O,t("div",{class:"media-aside",children:[t("button",{type:"button",class:"plain close-button",disabled:e,onClick:r,children:t(K,{icon:"x"})}),!!h&&t("button",{type:"button",class:"media-error",title:$(h),onClick:()=>{ae.current&&ae.current.hideToast(),ae.current=ke({text:$(h),duration:1e4})},children:t(K,{icon:"alert"})})]})]}),W&&t(Ve,{onClick:z=>{z.target===z.currentTarget&&j(!1)},children:t("div",{id:"media-sheet",class:"sheet sheet-max",children:[t("button",{type:"button",class:"sheet-close",onClick:()=>{j(!1)},children:t(K,{icon:"x"})}),t("header",{children:t("h2",{children:{image:"Edit image description",video:"Edit video description",audio:"Edit audio description"}[A]})}),t("main",{tabIndex:"-1",children:[t("div",{class:"media-preview",children:A==="image"?t("img",{src:k,alt:""}):A==="video"||A==="gifv"?t("video",{src:k,playsinline:!0,controls:!0}):A==="audio"?t("audio",{src:k,controls:!0}):null}),t("div",{class:"media-form",children:[O,t("footer",{children:[A==="image"&&/^(png|jpe?g|gif|webp)$/i.test(X)&&!!le.settings.mediaAltGenerator&&!!ut&&t(gn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:t("button",{type:"button",title:"More",class:"plain",children:t(K,{icon:"more",size:"l",alt:"More"})}),children:[t(St,{disabled:p==="loading",onClick:()=>{u("loading"),ie.current=ke({text:"Generating description. Please wait...",duration:-1}),async function(){var z,M;try{const L=new FormData;L.append("image",C);const N=await fetch(ut,{method:"POST",body:L}).then(Q=>Q.json());if(N.error)throw new Error(N.error);ue(N.description)}catch(L){ke(`Failed to generate description${L!=null&&L.message?`: ${L.message}`:""}`)}finally{u("default"),(M=(z=ie.current)==null?void 0:z.hideToast)==null||M.call(z)}}()},children:[t(K,{icon:"sparkles2"}),n&&n!=="en"?t("small",{children:["Generate description…",t("br",{}),"(English)"]}):t("span",{children:"Generate description…"})]}),!!n&&n!=="en"&&t(St,{disabled:p==="loading",onClick:()=>{u("loading"),ie.current=ke({text:"Generating description. Please wait...",duration:-1}),async function(){var z,M;try{const L=new FormData;L.append("image",C);const N=`?lang=${n}`,Q=await fetch(ut+N,{method:"POST",body:L}).then(oe=>oe.json());if(Q.error)throw new Error(Q.error);ue(Q.description)}catch(L){ke(`Failed to generate description${L!=null&&L.message?`: ${L.message}`:""}`)}finally{u("default"),(M=(z=ie.current)==null?void 0:z.hideToast)==null||M.call(z)}}()},children:[t(K,{icon:"sparkles2"}),t("small",{children:["Generate description…",t("br",{}),"(",fn(n),")"," ",t("span",{class:"more-insignificant",children:"— experimental"})]})]})]}),t("button",{type:"button",class:"light block",onClick:()=>{j(!1)},disabled:p==="loading",children:"Done"})]})]})]})]})})]})}function pi({lang:s,poll:e,disabled:n,onInput:o=()=>{},maxOptions:r,maxExpiration:p,minExpiration:u,maxCharactersPerOption:v}){const{options:g,expiresIn:R,multiple:C}=e;return t("div",{class:`poll ${C?"multiple":""}`,children:[t("div",{class:"poll-choices",children:g.map((k,S)=>t("div",{class:"poll-choice",children:[t("input",{required:!0,type:"text",value:k,disabled:n,maxlength:v,placeholder:`Choice ${S+1}`,lang:s,spellCheck:"true",dir:"auto",onInput:Z=>{const{value:D}=Z.target;g[S]=D,o(e)}}),t("button",{type:"button",class:"plain2 poll-button",disabled:n||g.length<=1,onClick:()=>{g.splice(S,1),o(e)},children:t(K,{icon:"x",size:"s"})})]},S))}),t("div",{class:"poll-toolbar",children:[t("button",{type:"button",class:"plain2 poll-button",disabled:n||g.length>=r,onClick:()=>{g.push(""),o(e)},children:"+"})," ",t("label",{class:"multiple-choices",children:[t("input",{type:"checkbox",checked:C,disabled:n,onChange:k=>{const{checked:S}=k.target;e.multiple=S,o(e)}})," ","Multiple choices"]}),t("label",{class:"expires-in",children:["Duration"," ",t("select",{value:R,disabled:n,onChange:k=>{const{value:S}=k.target;e.expiresIn=S,o(e)},children:Object.entries(qt).filter(([k,S])=>S>=u&&S<=p).map(([k,S])=>t("option",{value:S,children:k},S))})]})]}),t("div",{class:"poll-toolbar",children:t("button",{type:"button",class:"plain remove-poll-button",disabled:n,onClick:()=>{o(null)},children:"Remove poll"})})]})}function be(s){return s.replace(/[&<>"']/g,function(e){return"&#"+e.charCodeAt(0)+";"})}function Pt(s){for(let e in s)(s[e]===null||s[e]===void 0)&&delete s[e];return s}function mi({onClose:s=()=>{},onSelect:e=()=>{},defaultSearchTerm:n}){const{masto:o}=vt(),[r,p]=H("default"),[u,v]=H([]),[g,R]=H({}),[C,k]=H(0),S=async c=>{if(!(c!=null&&c.length))return;const h=await vn(c,g);h&&R({...g,...h})},Z=c=>{c&&(p("loading"),(async()=>{try{const h=await o.v1.accounts.search.list({q:c,limit:40,resolve:!1});v(h),S(h),p("default")}catch{p("error")}})())},D=Qe(Z,1e3);ee(()=>{Z()},[Z]);const I=U();ee(()=>{I.current&&(I.current.focus(),I.current.value&&(I.current.selectionStart=I.current.value.length,I.current.selectionEnd=I.current.value.length))},[]),ee(()=>{n&&Z(n)},[n]);const se=c=>{const h=c.acct;e(h),s()};_e("enter",()=>{const c=u[C];c&&se(c)},{preventDefault:!0,enableOnFormTags:["input"]});const J=U();return _e("down",()=>{C{const c=J.current.querySelector(".selected");c&&c.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),_e("up",()=>{C>0?k(C-1):k(u.length-1),setTimeout(()=>{const c=J.current.querySelector(".selected");c&&c.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),t("div",{id:"mention-sheet",class:"sheet",children:[!!s&&t("button",{type:"button",class:"sheet-close",onClick:s,children:t(K,{icon:"x"})}),t("header",{children:t("form",{onSubmit:c=>{var h;c.preventDefault(),(h=D.flush)==null||h.call(D)},children:t("input",{ref:I,required:!0,type:"search",class:"block",placeholder:"Search accounts",onInput:c=>{const{value:h}=c.target;D(h)},autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:n||""})})}),t("main",{children:(u==null?void 0:u.length)>0?t("ul",{ref:J,class:`accounts-list ${r==="loading"?"loading":""}`,children:u.map((c,h)=>{const m=g[c.id];return t("li",{class:h===C?"selected":"",children:[t(Ot,{avatarSize:"xxl",account:c,relationship:m,showStats:!0,showActivity:!0}),t("button",{type:"button",class:"plain2",onClick:()=>{se(c)},children:t(K,{icon:"plus",size:"xl"})})]},c.id)})}):r==="loading"?t("div",{class:"ui-state",children:t(et,{abrupt:!0})}):r==="error"?t("div",{class:"ui-state",children:t("p",{children:"Error loading accounts"})}):null})]})}function gi({masto:s,instance:e,onClose:n=()=>{},onSelect:o=()=>{},defaultSearchTerm:r}){const[p,u]=H("default"),v=U([]),[g,R]=H([]),C=Re(()=>ze.account.get("recentlyUsedCustomEmojis")||[]),k=U();ee(()=>{u("loading"),(async()=>{try{const[h,m]=await Vt(e,s);k.current=m,R(h),u("default")}catch{u("error")}})()},[]);const S=Re(()=>{const h={"--recent--":C.filter(f=>g.find(E=>E.shortcode===f.shortcode))},m=[];return g.forEach(f=>{var E,y;if((y=(E=v.current)==null?void 0:E.push)==null||y.call(E,f),!f.category){m.push(f);return}h[f.category]||(h[f.category]=[]),h[f.category].push(f)}),m.length&&(h["--others--"]=m),h},[g]),Z=U(),[D,I]=H(null),se=At(h=>{var f,E,y;const{value:m}=h.target;if(m){const B=(f=k.current)==null?void 0:f.search(m,{limit:ft});I(B.map(q=>q.item)),(y=(E=Z.current)==null?void 0:E.scrollTo)==null||y.call(E,0,0)}else I(null)},[g]);ee(()=>{r&&(g!=null&&g.length)&&se({target:{value:r}})},[r,se,g]);const J=At(h=>{o==null||o(h),n==null||n(),queueMicrotask(()=>{let m=ze.account.get("recentlyUsedCustomEmojis")||[];const f=m.findIndex(E=>E.shortcode===h.shortcode);f!==-1?(m.splice(f,1),m.unshift(h)):(m.unshift(h),m=m.filter(E=>{var y,B;return(B=(y=v.current)==null?void 0:y.find)==null?void 0:B.call(y,q=>q.shortcode===E.shortcode)}),m=m.slice(0,10)),ze.account.set("recentlyUsedCustomEmojis",m)})},[o]),c=U();return ee(()=>{c.current&&(c.current.focus(),c.current.value&&(c.current.selectionStart=c.current.value.length,c.current.selectionEnd=c.current.value.length))},[]),t("div",{id:"custom-emojis-sheet",class:"sheet",children:[!!n&&t("button",{type:"button",class:"sheet-close",onClick:n,children:t(K,{icon:"x"})}),t("header",{children:[t("div",{children:[t("b",{children:"Custom emojis"})," ",p==="loading"?t(et,{}):t("small",{class:"insignificant",children:[" • ",e]})]}),t("form",{onSubmit:h=>{h.preventDefault();const m=D[0];m&&J(`:${m.shortcode}:`)},children:t("input",{ref:c,type:"search",placeholder:"Search emoji",onInput:se,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:r||""})})]}),t("main",{ref:Z,children:D!==null?t("ul",{class:"custom-emojis-matches custom-emojis-list",children:D.map(h=>t("li",{class:"custom-emojis-match",children:t(Gt,{emoji:h,onClick:()=>{J(`:${h.shortcode}:`)},showCode:!0})},h.shortcode))}):t("div",{class:"custom-emojis-list",children:[p==="error"&&t("div",{class:"ui-state",children:t("p",{children:"Error loading custom emojis"})}),p==="default"&&Object.entries(S).map(([h,m])=>!!(m!=null&&m.length)&&t(Ce,{children:[t("div",{class:"section-header",children:{"--recent--":"Recently used","--others--":"Others"}[h]||h}),t(fi,{emojis:m,onSelect:J})]}))]})})]})}const fi=Wt(({emojis:s,onSelect:e})=>{const[n,o]=H(ft),r=s.length>n;return t("section",{children:[s.slice(0,n).map(p=>t(Gt,{emoji:p,onClick:()=>{e(`:${p.shortcode}:`)}},p.shortcode)),r&&t("button",{type:"button",class:"plain small",onClick:()=>o(n+ft),children:[(s.length-n).toLocaleString()," more…"]})]})}),Gt=Wt(({emoji:s,onClick:e,showCode:n})=>{const o=r=>{const u=r.currentTarget.closest("main");if(u){const v=u.getBoundingClientRect(),g=r.currentTarget.getBoundingClientRect(),R=r.currentTarget.classList;g.leftv.right-88?(R.add("edge-right"),R.remove("edge-left")):R.remove("edge-left","edge-right")}};return t("button",{type:"button",className:"plain4",onClick:e,"data-title":n?void 0:s.shortcode,onPointerEnter:o,onFocus:o,children:[t("picture",{children:[!!s.staticUrl&&t("source",{srcSet:s.staticUrl,media:"(prefers-reduced-motion: reduce)"}),t("img",{className:"shortcode-emoji",src:s.url||s.staticUrl,alt:s.shortcode,width:"24",height:"24",loading:"lazy",decoding:"async"})]}),n&&t(Ce,{children:[" ",t("code",{children:s.shortcode})]})]})}),dt=20;function vi({onClose:s=()=>{},onSelect:e=()=>{}}){var S,Z,D,I,se,J;const[n,o]=H("default"),[r,p]=H([]),u=U(null),v=U(null),g=U(0),R=U(null);function C({offset:c}){var h,m,f;(h=v.current)!=null&&h.value&&(o("loading"),(f=(m=R.current)==null?void 0:m.scrollTo)==null||f.call(m,{top:0,left:0,behavior:"smooth"}),(async()=>{var E;try{const y={api_key:Kn,q:v.current.value,rating:"g",limit:dt,bundle:"messaging_non_clips",offset:c},B=await fetch("https://api.giphy.com/v1/gifs/search?"+new URLSearchParams(y),{referrerPolicy:"no-referrer"}).then(q=>q.json());g.current=((E=B.pagination)==null?void 0:E.offset)||0,p(B),o("results")}catch{o("error")}})())}ee(()=>{var c;(c=v.current)==null||c.focus()},[]);const k=Qe(()=>{C({offset:0})},1e3);return t("div",{id:"gif-picker-sheet",class:"sheet",children:[!!s&&t("button",{type:"button",class:"sheet-close",onClick:s,children:t(K,{icon:"x"})}),t("header",{children:t("form",{ref:u,onSubmit:c=>{c.preventDefault(),C({offset:0})},children:[t("input",{ref:v,type:"search",name:"q",placeholder:"Search GIFs",required:!0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",onInput:k}),t("input",{type:"image",class:"powered-button",src:Nn,width:"86",height:"30"})]})}),t("main",{ref:R,class:n==="loading"?"loading":"",children:[n==="default"&&t("div",{class:"ui-state",children:t("p",{class:"insignificant",children:"Type to search GIFs"})}),n==="loading"&&!((S=r==null?void 0:r.data)!=null&&S.length)&&t("div",{class:"ui-state",children:t(et,{abrupt:!0})}),((Z=r==null?void 0:r.data)==null?void 0:Z.length)>0?t(Ce,{children:[t("ul",{children:r.data.map(c=>{const{id:h,images:m,title:f,alt_text:E}=c,{fixed_height_small:y,fixed_height_downsampled:B,fixed_height:q,original:ue}=m,A=y!=null&&y.url?y:B!=null&&B.url?B:q;let{url:X,webp:V,width:W,height:j}=A;+j>100&&(W=W/j*100,j=100);const te=URL.parse(X),O=te.origin+te.pathname;let ie;if(V){const ae=URL.parse(V);ie=ae.origin+ae.pathname}return t("li",{children:t("button",{type:"button",onClick:()=>{const{mp4:ae,url:$}=ue,z=ae||$,M=URL.parse(z),L=M.origin+M.pathname;s(),e({url:L,type:ae?"video/mp4":"image/gif",alt_text:E||f})},children:t("figure",{style:{"--figure-width":W+"px"},children:[t("picture",{children:[ie&&t("source",{srcset:ie,type:"image/webp"}),t("img",{src:O,width:W,height:j,loading:"lazy",decoding:"async",alt:E,referrerpolicy:"no-referrer",onLoad:ae=>{ae.target.style.backgroundColor="transparent"}})]}),t("figcaption",{children:E||f})]})})},h)})}),t("p",{class:"pagination",children:[((D=r.pagination)==null?void 0:D.offset)>0&&t("button",{type:"button",class:"light small",disabled:n==="loading",onClick:()=>{var c;C({offset:((c=r.pagination)==null?void 0:c.offset)-dt})},children:[t(K,{icon:"chevron-left"}),t("span",{children:"Previous"})]}),t("span",{}),((I=r.pagination)==null?void 0:I.offset)+((se=r.pagination)==null?void 0:se.count)<((J=r.pagination)==null?void 0:J.total_count)&&t("button",{type:"button",class:"light small",disabled:n==="loading",onClick:()=>{var c;C({offset:((c=r.pagination)==null?void 0:c.offset)+dt})},children:[t("span",{children:"Next"})," ",t(K,{icon:"chevron-right"})]})]})]}):n==="results"&&t("div",{class:"ui-state",children:t("p",{children:"No results"})}),n==="error"&&t("div",{class:"ui-state",children:t("p",{children:"Error loading GIFs"})})]})]})}export{Ei as default}; //# sourceMappingURL=compose-2Y_rtJfC.js.map