phanpy-cz/assets/compose-oSeoicVc.js

27 lines
81 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Bt=s=>{throw TypeError(s)};var pt=(s,t,n)=>t.has(s)||Bt("Cannot "+n);var I=(s,t,n)=>(pt(s,t,"read from private field"),n?n.call(s):t.get(s)),re=(s,t,n)=>t.has(s)?Bt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,n),me=(s,t,n,a)=>(pt(s,t,"write to private field"),a?a.call(s,n):t.set(s,n),n),Q=(s,t,n)=>(pt(s,t,"access private method"),n);import{i as ge,z as mn,s as oe,V as gn,f as Ke,a as Ct,h as U,A as G,M as fn,aA as Yt,d as Se,y as ne,w as vn,aB as bn,j as Pe,c as e,T as V,b as xn,k as De,v as st,q as yn,P as wn,u as kn,r as Tt,x as Zt}from"./useTitle-SRT6j-GL.js";import{j as Ee,F as En,_ as Fn,a as Oe,a8 as Cn,x as Rt,u as zn,k as Xt,b as _n,I as Z,z as Dt,i as Jt,a9 as Ln,l as xt,M as Je,s as Ce,a4 as An,a0 as Sn,q as In,O as Mn,X as at,c as Bn,d as $t,y as Tn}from"./fuse-MwQ_F2cO.js";import{e as Rn}from"./tinyld-light-PxOyhYWY.js";class Dn{constructor(t,n,{tabInsertsSuggestions:a,defaultFirstOption:c}={}){this.input=t,this.list=n,this.tabInsertsSuggestions=a??!0,this.defaultFirstOption=c??!1,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=o=>$n(o,this),this.compositionEventHandler=o=>On(o,this),this.inputHandler=this.clearSelection.bind(this),t.setAttribute("role","combobox"),t.setAttribute("aria-controls",n.id),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-autocomplete","list"),t.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",jt),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",jt)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(mt)[0])===null||t===void 0||t.setAttribute("data-combobox-option-default","true"))}navigate(t=1){const n=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(mt)[0],a=Array.from(this.list.querySelectorAll('[role="option"]')).filter(mt),c=a.indexOf(n);if(c===a.length-1&&t===1||c===0&&t===-1){this.clearSelection(),this.input.focus();return}let o=t===1?0:a.length-1;if(n&&c>=0){const y=c+t;y>=0&&y<a.length&&(o=y)}const l=a[o];if(l)for(const y of a)y.removeAttribute("data-combobox-option-default"),l===y?(this.input.setAttribute("aria-activedescendant",l.id),l.setAttribute("aria-selected","true"),Pn(this.list,l)):y.removeAttribute("aria-selected")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const t of this.list.querySelectorAll('[aria-selected="true"]'))t.removeAttribute("aria-selected");this.indicateDefaultOption()}}function $n(s,t){if(!(s.shiftKey||s.metaKey||s.altKey)&&!(!t.ctrlBindings&&s.ctrlKey)&&!t.isComposing)switch(s.key){case"Enter":Ot(t.input,t.list)&&s.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&Ot(t.input,t.list)&&s.preventDefault();break;case"Escape":t.clearSelection();break;case"ArrowDown":t.navigate(1),s.preventDefault();break;case"ArrowUp":t.navigate(-1),s.preventDefault();break;case"n":t.ctrlBindings&&s.ctrlKey&&(t.navigate(1),s.preventDefault());break;case"p":t.ctrlBindings&&s.ctrlKey&&(t.navigate(-1),s.preventDefault());break;default:if(s.ctrlKey)break;t.clearSelection()}}function jt(s){if(!(s.target instanceof Element))return;const t=s.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&jn(t)}function Ot(s,t){const n=t.querySelector('[aria-selected="true"], [data-combobox-option-default="true"]');return n?(n.getAttribute("aria-disabled")==="true"||n.click(),!0):!1}function jn(s){s.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}function mt(s){return!s.hidden&&!(s instanceof HTMLInputElement&&s.type==="hidden")&&(s.offsetWidth>0||s.offsetHeight>0)}function On(s,t){t.isComposing=s.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function Pn(s,t){Hn(s,t)||(s.scrollTop=t.offsetTop)}function Hn(s,t){const n=s.scrollTop,a=n+s.clientHeight,c=t.offsetTop,o=c+t.clientHeight;return c>=n&&o<=a}const Nn=/\s|\(|\[/;function qn(s,t,n,{multiWord:a,lookBackIndex:c,lastMatchPosition:o}={multiWord:!1,lookBackIndex:0,lastMatchPosition:null}){let l=s.lastIndexOf(t,n-1);if(l===-1||l<c)return;if(a){if(o!=null){if(o===l)return;l=o-t.length}if(s[l+1]===" "&&n>=l+t.length+1||s.lastIndexOf(`
`,n-1)>l||s.lastIndexOf(".",n-1)>l)return}else if(s.lastIndexOf(" ",n-1)>l)return;const y=s[l-1];return y&&!Nn.test(y)?void 0:{text:s.substring(l+t.length,n),position:l+t.length}}class Kn extends HTMLElement{}class Wn extends Event{constructor(){super("update")}}const gt=new WeakMap;var He,Ne,ze,ye,ee,$e,Ie,Me,yt,Be,Qe,et,tt,qe,_e;const _t=class _t extends Kn{constructor(n){super();re(this,ee);re(this,He,new MutationObserver(()=>Q(this,ee,et).call(this)));re(this,Ne,new ResizeObserver(()=>Q(this,ee,Qe).call(this)));re(this,ze);re(this,ye);re(this,Ie,0);re(this,Me,0);re(this,Be,!1);re(this,qe,()=>Q(this,ee,tt).call(this));re(this,_e,n=>{Q(this,ee,$e).call(this,a=>{(n.target===document||n.target===window||n.target instanceof Node&&n.target.contains(a))&&Q(this,ee,Qe).call(this)})});me(this,ze,new WeakRef(n)),me(this,ye,document.createElement("div")),I(this,ye).style.position="absolute",I(this,ye).style.pointerEvents="none",n.after(I(this,ye)),I(this,ye).appendChild(this)}static for(n){const a=gt.get(n)??new _t(n);return gt.set(n,a),a}forceUpdate(){Q(this,ee,et).call(this),Q(this,ee,tt).call(this)}connectedCallback(){const n=I(this,ze).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"),Q(this,ee,et).call(this),Q(this,ee,tt).call(this),I(this,He).observe(n,{attributeFilter:["style","dir"]}),I(this,Ne).observe(n),document.addEventListener("scroll",I(this,_e),{capture:!0}),window.addEventListener("resize",I(this,_e),{capture:!0}),n.addEventListener("input",I(this,qe),{capture:!0})}disconnectedCallback(){I(this,ye).remove(),I(this,He).disconnect(),I(this,Ne).disconnect(),document.removeEventListener("scroll",I(this,_e),{capture:!0}),window.removeEventListener("resize",I(this,_e),{capture:!0});const n=I(this,ze).deref();n&&(n.removeEventListener("input",I(this,qe),{capture:!0}),gt.delete(n))}};He=new WeakMap,Ne=new WeakMap,ze=new WeakMap,ye=new WeakMap,ee=new WeakSet,$e=function(n){const a=I(this,ze).deref();return a?n(a):this.remove()},Ie=new WeakMap,Me=new WeakMap,yt=function(){Q(this,ee,$e).call(this,n=>{const a=window.getComputedStyle(n);this.style.height=a.height,this.style.width=a.width,n.clientHeight!==this.clientHeight&&(this.style.height=`calc(${a.height} + ${n.clientHeight-this.clientHeight}px)`),n.clientWidth!==this.clientWidth&&(this.style.width=`calc(${a.width} + ${n.clientWidth-this.clientWidth}px)`);const c=n.getBoundingClientRect(),o=this.getBoundingClientRect();me(this,Ie,I(this,Ie)+c.left-o.left),me(this,Me,I(this,Me)+c.top-o.top),this.style.transform=`translate(${I(this,Ie)}px, ${I(this,Me)}px)`,this.scrollTop=n.scrollTop,this.scrollLeft=n.scrollLeft,this.dispatchEvent(new Wn)})},Be=new WeakMap,Qe=function(){I(this,Be)||(me(this,Be,!0),requestAnimationFrame(()=>{Q(this,ee,yt).call(this),me(this,Be,!1)}))},et=function(){Q(this,ee,$e).call(this,n=>{const a=window.getComputedStyle(n);for(const c of Un)this.style[c]=a[c];Q(this,ee,Qe).call(this)})},tt=function(){Q(this,ee,$e).call(this,n=>{this.textContent=n.value,Q(this,ee,yt).call(this)})},qe=new WeakMap,_e=new WeakMap;let nt=_t;const Un=["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",nt)}catch(s){if(!(s instanceof DOMException&&s.name==="NotSupportedError"))throw s}var be,Te,Re,le,kt,Qt,Et,je;const it=class it{constructor(t,n=0,a=n){re(this,le);re(this,be);re(this,Te);re(this,Re);me(this,be,t),me(this,Te,n),me(this,Re,a)}static fromSelection(t){const{selectionStart:n,selectionEnd:a}=t;return new it(t,n??void 0,a??void 0)}get collapsed(){return this.startOffset===this.endOffset}get commonAncestorContainer(){return I(this,be)}get endContainer(){return I(this,be)}get startContainer(){return I(this,be)}get startOffset(){return I(this,Te)}get endOffset(){return I(this,Re)}setStartOffset(t){me(this,Te,Q(this,le,Et).call(this,t))}setEndOffset(t){me(this,Re,Q(this,le,Et).call(this,t))}collapse(t=!1){t?this.setEndOffset(this.startOffset):this.setStartOffset(this.endOffset)}cloneContents(){return Q(this,le,je).call(this).cloneContents()}cloneRange(){return new it(I(this,be),this.startOffset,this.endOffset)}getBoundingClientRect(){return Q(this,le,je).call(this).getBoundingClientRect()}getClientRects(){return Q(this,le,je).call(this).getClientRects()}toString(){return Q(this,le,je).call(this).toString()}getStyleClone(){return I(this,le,kt)}};be=new WeakMap,Te=new WeakMap,Re=new WeakMap,le=new WeakSet,kt=function(){return nt.for(I(this,be))},Qt=function(){return I(this,le,kt)},Et=function(t){return Math.max(0,Math.min(t,I(this,be).value.length))},je=function(){const t=document.createRange(),n=I(this,le,Qt).childNodes[0];return n&&(t.setStart(n,this.startOffset),t.setEnd(n,this.endOffset)),t};let wt=it;const Ze=new WeakMap;class Vn{constructor(t,n){this.expander=t,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(t,n){var a,c;this.input!==document.activeElement&&this.input!==((c=(a=document.activeElement)===null||a===void 0?void 0:a.shadowRoot)===null||c===void 0?void 0:c.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 Dn(this.input,n),this.expander.dispatchEvent(new Event("text-expander-activate")),this.positionMenu(n,t.position),this.combobox.start(),n.addEventListener("combobox-commit",this.oncommit),n.addEventListener("mousedown",this.onmousedown),this.combobox.navigate(1))}positionMenu(t,n){const a=new wt(this.input,n).getBoundingClientRect(),c={left:a.left,top:a.top+a.height},o=t.getBoundingClientRect(),l={left:c.left-o.left,top:c.top-o.top};if(l.left!==0||l.top!==0){const y=getComputedStyle(t);t.style.left=y.left?`calc(${y.left} + ${l.left}px)`:`${l.left}px`,t.style.top=y.top?`calc(${y.top} + ${l.top}px)`:`${l.top}px`}}deactivate(){const t=this.menu;return!t||!this.combobox?!1:(this.expander.dispatchEvent(new Event("text-expander-deactivate")),this.menu=null,t.removeEventListener("combobox-commit",this.oncommit),t.removeEventListener("mousedown",this.onmousedown),this.combobox.destroy(),this.combobox=null,t.remove(),!0)}onCommit({target:t}){var n;const a=t;if(!(a instanceof HTMLElement)||!this.combobox)return;const c=this.match;if(!c)return;const o=this.input.value.substring(0,c.position-c.key.length),l=this.input.value.substring(c.position+c.text.length),y={item:a,key:c.key,value:null,continue:!1};if(!this.expander.dispatchEvent(new CustomEvent("text-expander-value",{cancelable:!0,detail:y}))||!y.value)return;let M=(n=this.expander.getAttribute("suffix"))!==null&&n!==void 0?n:" ";y.continue&&(M="");const F=`${y.value}${M}`;this.input.value=o+F+l;const v=o.length+F.length;this.deactivate(),this.input.focus({preventScroll:!0}),this.input.selectionStart=v,this.input.selectionEnd=v,y.continue||(this.lookBackIndex=v,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 t=this.findMatch();if(t){this.match=t;const n=await this.notifyProviders(t);if(!this.match)return;n?this.activate(t,n):this.deactivate()}else this.match=null,this.deactivate()}findMatch(){const t=this.input.selectionEnd||0,n=this.input.value;t<=this.lookBackIndex&&(this.lookBackIndex=t-1);for(const{key:a,multiWord:c}of this.expander.keys){const o=qn(n,a,t,{multiWord:c,lookBackIndex:this.lookBackIndex,lastMatchPosition:this.match?this.match.position:null});if(o)return{text:o.text,key:a,position:o.position}}}async notifyProviders(t){const n=[],a=y=>n.push(y);return this.expander.dispatchEvent(new CustomEvent("text-expander-change",{cancelable:!0,detail:{provide:a,text:t.text,key:t.key}}))?(await Promise.all(n)).filter(y=>y.matched).map(y=>y.fragment)[0]:void 0}onMousedown(){this.interactingWithList=!0}onKeydown(t){t.key==="Escape"&&(this.match=null,this.deactivate()&&(this.lookBackIndex=this.input.selectionEnd||this.lookBackIndex,t.stopImmediatePropagation(),t.preventDefault()))}}class Pt extends HTMLElement{get keys(){const t=this.getAttribute("keys"),n=t?t.split(" "):[],a=this.getAttribute("multiword"),c=a?a.split(" "):[],o=c.length===0&&this.hasAttribute("multiword");return n.map(l=>({key:l,multiWord:o||c.includes(l)}))}connectedCallback(){const t=this.querySelector('input[type="text"], textarea');if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement))return;const n=new Vn(this,t);Ze.set(this,n)}disconnectedCallback(){const t=Ze.get(this);t&&(t.destroy(),Ze.delete(this))}dismiss(){const t=Ze.get(this);t&&t.dismissMenu()}}window.customElements.get("text-expander")||(window.TextExpanderElement=Pt,window.customElements.define("text-expander",Pt));function Gn({onlyFirst:s=!1}={}){const t=["[\\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(t,s?void 0:"g")}const Yn=Gn();function Zn(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(Yn,"")}const Xn=new Intl.Segmenter;function Ht(s,{countAnsiEscapeCodes:t=!1}={}){if(s===""||(t||(s=Zn(s)),s===""))return 0;let n=0;for(const a of Xn.segment(s))n++;return n}const Jn="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",zt=[["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"],["ms-Arab","Jawi Malay","بهاس ملايو"],["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","Punjabi","ਪੰਜਾਬੀ"],["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"],["csb","Kashubian","Kaszëbsczi"],["jbo","Lojban","la .lojban."],["kab","Kabyle","Taqbaylit"],["ldn","Láadan","Láadan"],["lfn","Lingua Franca Nova","lingua franca nova"],["moh","Mohawk","Kanienʼkéha"],["nds","Low German","Plattdüütsch"],["pdc","Pennsylvania Dutch","Pennsilfaani-Deitsch"],["sco","Scots","Scots"],["sma","Southern Sami","Åarjelsaemien Gïele"],["smj","Lule Sami","Julevsámegiella"],["szl","Silesian","ślůnsko godka"],["tok","Toki Pona","toki pona"],["vai","Vai","ꕙꔤ"],["xal","Kalmyk","Хальмг келн"],["zba","Balaibalan","باليبلن"],["zgh","Standard Moroccan Tamazight","ⵜⴰⵎⴰⵣⵉⵖⵜ"]],Qn="(((?:[^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\\-_&=#\\/])?))",ei="gi",Nt={source:Qn,flags:ei},qt=["byte","kilobyte","megabyte","gigabyte","terabyte","petabyte"];function Xe(s){const t=Math.min(Math.floor(Math.log2(s)/10),qt.length-1),n=s/1024**t;return ge.number(n,{style:"unit",unit:qt[t],unitDisplay:"narrow",maximumFractionDigits:0})}const ti={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",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",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:ft,PHANPY_GIPHY_API_KEY:ni}=ti,ii=zt.reduce((s,t)=>{const[n,a,c]=t;return s[n]={common:a,native:c},s},{}),en={300:Ee(5,"minute"),1800:Ee(30,"minute"),3600:Ee(1,"hour"),21600:Ee(6,"hour"),86400:Ee(1,"day"),259200:Ee(3,"day"),604800:Ee(1,"week")},si=Object.keys(en),Kt=24*60*60,Wt=s=>{if(!s)return Kt;const t=(new Date(s).getTime()-Date.now())/1e3;return si.find(n=>n>=t)||Kt},ke=document.createElement("ul");ke.role="listbox";ke.className="text-expander-menu";const ai=16,ri=new IntersectionObserver(s=>{s.forEach(t=>{if(t.isIntersecting){const{left:n,width:a}=t.boundingClientRect,{innerWidth:c}=window;if(n+a>c){const o=En()?"right":"left";ke.style[o]=c-a-ai+"px"}}})});ri.observe(ke);const Fe=mn([new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages],zt.map(s=>s[0]),"en"),tn=new RegExp(Nt.source,Nt.flags),oi=/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/gi,li="$2xxxxxxxxxxxxxxxxxxxxxxx";function ci(s){return s.replace(tn,li).replace(oi,"$1@$3")}const ui=/[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i,di=new RegExp(`(^|[^=\\/\\w])(@${ui.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,"uig"),hi=new RegExp("(^|[^=\\/\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\/\\w])","ig"),pi="[a-zA-Z0-9_]{2,}",mi=new RegExp(`(^|[^=\\/\\w])(:${pi}:)(?=[^A-Za-z0-9_:]|$)`,"g"),gi=new Intl.Segmenter;function vt(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function fi(s,{maxCharacters:t=1/0}){const{composerCharacterCount:n}=oe;if(n>t){let a="",c="";const o=gi.segment(s);for(const{segment:l,index:y}of o)y<t?a+=l:c+=l;return c&&(c='<mark class="compose-highlight-exceeded">'+vt(c)+"</mark>"),vt(a)+c}return vt(s).replace(tn,'$2<mark class="compose-highlight-url">$3</mark>').replace(di,'$1<mark class="compose-highlight-mention">$2</mark>').replace(hi,'$1<mark class="compose-highlight-hashtag">$2</mark>').replace(mi,'$1<mark class="compose-highlight-emoji-shortcode">$2</mark>')}const vi=gn(s=>new Intl.RelativeTimeFormat(s||void 0)),Ft=100;function Mi({onClose:s,replyToStatus:t,editStatus:n,draftStatus:a,standalone:c,hasOpener:o}){var Mt;const{i18n:l}=Ke(),y=vi(l.locale),{masto:E,instance:M}=Ct(),[F,v]=U("default"),B=G((a==null?void 0:a.uid)||Fn()),L=fn(),T=L.info,j=Yt(),{statuses:{maxCharacters:ie,maxMediaAttachments:O,charactersReservedPerUrl:p}={},mediaAttachments:{supportedMimeTypes:d=[],imageSizeLimit:m,imageMatrixLimit:w,videoSizeLimit:f,videoMatrixLimit:R,videoFrameRateLimit:k}={},polls:{maxOptions:K,maxCharactersPerOption:ae,maxExpiration:ce,minExpiration:X}={}}=j||{},$=G(),W=G(),[H,te]=U("public"),[Y,ue]=U(!1),[P,se]=U(Se.session.get("currentLanguage")||Fe),fe=G(P),[g,S]=U([]),[z,J]=U(null),N=Se.account.get("preferences")||{},de=()=>{$.current&&$.current.dispatchEvent(new Event("input"))},pe=()=>{setTimeout(()=>{var r,u,x;$.current&&((u=(r=a==null?void 0:a.status)==null?void 0:r.startsWith)!=null&&u.call(r,`
`)&&($.current.selectionStart=0,$.current.selectionEnd=0),(x=$.current)==null||x.focus())},300)};ne(()=>{var r,u;if(t){const{spoilerText:x,visibility:h,language:A,sensitive:C}=t;x&&W.current&&(W.current.value=x);const b=[...new Set([t.account.acct,...t.mentions.map(_=>_.acct)])].filter(_=>_!==T.acct);b.length>0&&($.current.value=`${b.map(_=>`@${_}`).join(" ")} `,de()),pe(),te(h==="public"&&N["posting:default:visibility"]?N["posting:default:visibility"].toLowerCase():h),se(A||((r=N["posting:default:language"])==null?void 0:r.toLowerCase())||Fe),ue(C&&!!x)}else if(n){const{visibility:x,language:h,sensitive:A,poll:C,mediaAttachments:D}=n,b=!!(C!=null&&C.options)&&{...C,options:C.options.map(_=>(_==null?void 0:_.title)||_),expiresIn:(C==null?void 0:C.expiresIn)||Wt(C.expiresAt)};v("loading"),(async()=>{var _;try{const q=await E.v1.statuses.$select(n.id).source.fetch(),{text:he,spoilerText:ve}=q;$.current.value=he,$.current.dataset.source=he,de(),pe(),W.current.value=ve,te(x),se(h||((_=N["posting:default:language"])==null?void 0:_.toLowerCase())||Fe),ue(A),b&&J(b),S(D),v("default")}catch(q){alert((q==null?void 0:q.reason)||q),v("error")}})()}else pe(),N["posting:default:visibility"]&&te(N["posting:default:visibility"].toLowerCase()),N["posting:default:language"]&&se(N["posting:default:language"].toLowerCase()),N["posting:default:sensitive"]&&ue(!!N["posting:default:sensitive"]);if(a){const{status:x,spoilerText:h,visibility:A,language:C,sensitive:D,poll:b,mediaAttachments:_}=a,q=!!(b!=null&&b.options)&&{...b,options:b.options.map(he=>(he==null?void 0:he.title)||he),expiresIn:(b==null?void 0:b.expiresIn)||Wt(b.expiresAt)};$.current.value=x,de(),pe(),h&&(W.current.value=h),A&&te(A),se(C||((u=N["posting:default:language"])==null?void 0:u.toLowerCase())||Fe),D!==null&&ue(D),q&&J(q),_&&S(_)}},[a,n,t]);const Le=G(),Ae=l._({id:"hR9gtK"}),rt=()=>{const{value:r,dataset:u}=$.current;if(F==="loading")return!1;const x=(r||"").trim().replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$","gu"),""),h=g.length>0;if(!x&&!h||g.length>0&&g.every(_=>_.id))return!0;const C=(t==null?void 0:t.account.id)===T.id,D=t&&r.trim()===`@${t.account.acct}`;return!!(!C&&D||r===(u==null?void 0:u.source))},We=()=>rt()?!0:confirm(Ae);ne(()=>{const r=u=>{rt()||(u.preventDefault(),u.returnValue=Ae)};return window.addEventListener("beforeunload",r,{capture:!0}),()=>window.removeEventListener("beforeunload",r,{capture:!0})},[]);const an=()=>{const{value:r}=$.current,{value:u}=W.current;return Ht(ci(r))+Ht(u)},ot=()=>{const r=an();oe.composerCharacterCount=r};ne(ot,[]);const Lt=window.CloseWatcher,lt=G(!1);Oe("esc",()=>{lt.current=!0},{enabled:!Lt,enableOnFormTags:!0}),Oe("esc",()=>{!c&&lt.current&&We()&&s(),lt.current=!1},{enabled:!Lt,enableOnFormTags:!0,keyup:!0,ignoreEventWhen:r=>{const u=document.querySelectorAll("#modal-container > *"),x=!!u,h=u.length===1&&u[0].querySelector("#compose-container");return x&&!h}}),Cn(()=>{!c&&We()&&s()},[c,We,s]);const At=G({}),St=()=>`${vn()}#${B.current}`,ct=()=>{if(n||oe.composerState.minimized)return;const r=St(),u={key:r,replyTo:t?{id:t.id,account:{id:t.account.id,username:t.account.username,acct:t.account.acct}}:null,draftStatus:{uid:B.current,status:$.current.value,spoilerText:W.current.value,visibility:H,language:P,sensitive:Y,poll:z,mediaAttachments:g}};!bn(u,At.current)&&!rt()&&(Rt.drafts.set(r,{...u,state:"unsaved",updatedAt:Date.now()}).then(()=>{}).catch(x=>{}),At.current=structuredClone(u))};zn(ct,5e3),ne(()=>(ct(),()=>{Rt.drafts.del(St())}),[]),ne(()=>{const r=x=>{const{items:h}=x.clipboardData||x.dataTransfer,A=[];for(let C=0;C<h.length;C++){const D=h[C];if(D.kind==="file"){const b=D.getAsFile();b&&d.includes(b.type)&&A.push(b)}}if(A.length>0&&g.length>=O){alert(l._({id:"ctFhjs",values:{maxMediaAttachments:O}}));return}if(A.length>0){x.preventDefault(),x.stopPropagation();const C=O-g.length,D=A.slice(0,C);if(D.length<=0){alert(l._({id:"ctFhjs",values:{maxMediaAttachments:O}}));return}const b=D.map(_=>({file:_,type:_.type,size:_.size,url:URL.createObjectURL(_),id:null,description:null}));S([...g,...b])}};window.addEventListener("paste",r);const u=x=>{x.dataTransfer.items.length>0&&(x.preventDefault(),x.stopPropagation())};return window.addEventListener("dragover",u),window.addEventListener("drop",r),()=>{window.removeEventListener("paste",r),window.removeEventListener("dragover",u),window.removeEventListener("drop",r)}},[g]);const[Ue,ut]=U(!1),[Ve,Ge]=U(!1),[rn,dt]=U(!1),[xe,on]=U(null),[ln,cn]=Pe(()=>{const r=[],u=[],{contentTranslationHideLanguages:x=[]}=oe.settings;return zt.forEach(h=>{const[A]=h;A===P||A===fe.current||A===Fe||x.includes(A)||xe!=null&&xe.length&&xe.includes(A)?r.push(h):u.push(h)}),r.sort(([h,A],[C,D])=>h===P?-1:C===P?1:A.localeCompare(D)),u.sort(([h,A],[C,D])=>A.localeCompare(D)),[r,u]},[P,xe]),It=Pe(()=>!!(t!=null&&t.createdAt)&&Math.floor((Date.now()-new Date(t.createdAt))/(1e3*60*60*24*30)),[t]),un=()=>{ct(),oe.composerState.minimized=!0};return e("div",{id:"compose-container-outer",children:[e("div",{id:"compose-container",class:c?"standalone":"",children:[e("div",{class:"compose-top",children:[(T==null?void 0:T.avatarStatic)&&e(Xt,{account:T,accountInstance:L.instanceURL,hideDisplayName:!0,useAvatarStatic:!0}),c?o&&e("button",{type:"button",class:"light pop-button",disabled:F==="loading",onClick:()=>{var r;if(!window.opener){alert(l._({id:"qiPXgY"}));return}if(window.opener.__STATES__.showCompose){if((r=window.opener.__STATES__.composerState)!=null&&r.publishing){alert(l._({id:"Z2l5Bt"}));return}let u=l._({id:"AB/GtR"});if(!confirm(u))return}s({fn:()=>{const u={editStatus:n,replyToStatus:t,draftStatus:{uid:B.current,status:$.current.value,spoilerText:W.current.value,visibility:H,language:P,sensitive:Y,poll:z,mediaAttachments:g}};window.opener.__COMPOSE__=u,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:e(Z,{icon:"popin",alt:l._({id:"/5ZKeE"})})}):e("span",{class:"compose-controls",children:[e("button",{type:"button",class:"plain4 pop-button",disabled:F==="loading",onClick:()=>{_n({editStatus:n,replyToStatus:t,draftStatus:{uid:B.current,status:$.current.value,spoilerText:W.current.value,visibility:H,language:P,sensitive:Y,poll:z,mediaAttachments:g}})&&s()},children:e(Z,{icon:"popout",alt:l._({id:"JsU2En"})})}),e("button",{type:"button",class:"plain4 min-button",onClick:un,children:e(Z,{icon:"minimize",alt:l._({id:"3TSz9S"})})})," ",e("button",{type:"button",class:"light close-button",disabled:F==="loading",onClick:()=>{We()&&s()},children:e(Z,{icon:"x",alt:l._({id:"yz7wBu"})})})]})]}),!!t&&e("div",{class:"status-preview",children:[e(Dt,{status:t,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend reply-to",children:It>0?e(V,{id:"Q1Huya",values:{0:t.account.acct||t.account.username,1:y.format(-It,"month")},components:{0:e("strong",{})}}):e(V,{id:"dwLCPZ",values:{0:t.account.acct||t.account.username}})})]}),!!n&&e("div",{class:"status-preview",children:[e(Dt,{status:n,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend",children:e(V,{id:"wKtOLH"})})]}),e("form",{ref:Le,class:`form-visibility-${H}`,style:{pointerEvents:F==="loading"?"none":"auto",opacity:F==="loading"?.5:1},onKeyDown:r=>{r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&Le.current.dispatchEvent(new Event("submit",{cancelable:!0}))},onSubmit:r=>{r.preventDefault();const u=new FormData(r.target),x=Object.fromEntries(u.entries());let{status:h,visibility:A,sensitive:C,spoilerText:D}=x;if(C=C==="on",z){if(z.options.length<2){alert(l._({id:"zhrMYj"}));return}if(z.options.some(b=>b==="")){alert(l._({id:"uNVxXX"}));return}}g.length>0&&g.some(_=>{var q,he;return!((he=(q=_.description)==null?void 0:q.trim)!=null&&he.call(q))})&&!confirm(l._({id:"MQYucx"}))||(D=C&&D||void 0,h=h===""?void 0:h,oe.composerState.publishing=!0,v("loading"),(async()=>{try{if(g.length>0){const q=g.map(ve=>{const{file:Ye,description:dn,id:hn}=ve;if(hn)return ve;{const pn=Gt({file:Ye,description:dn});return E.v2.media.create(pn).then(ht=>(ht.id&&(ve.id=ht.id),ht))}}),he=await Promise.allSettled(q);if(he.some(ve=>{var Ye;return ve.status==="rejected"||!((Ye=ve.value)!=null&&Ye.id)})){oe.composerState.publishing=!1,oe.composerState.publishingError=!0,v("error"),he.forEach(ve=>{ve.status==="rejected"&&alert(ve.reason||l._({id:"eIiurD",values:{i}}))});return}}let b={status:h,spoiler_text:D,language:P,sensitive:C,poll:z,media_ids:g.map(q=>q.id)};n&&Jt("@mastodon/edit-media-attributes")?b.media_attributes=g.map(q=>({id:q.id,description:q.description})):n||(b.visibility=A,b.in_reply_to_id=(t==null?void 0:t.id)||void 0),b=Gt(b);let _;if(n)_=await E.v1.statuses.$select(n.id).update(b),xn(_,M,{skipThreading:!0});else try{_=await E.v1.statuses.create(b,{requestInit:{headers:{"Idempotency-Key":B.current}}})}catch{_=await E.v1.statuses.create(b)}oe.composerState.minimized=!1,oe.composerState.publishing=!1,v("default"),s({type:n?"edit":t?"reply":"post",newStatus:_,instance:M})}catch(b){oe.composerState.publishing=!1,oe.composerState.publishingError=!0,alert((b==null?void 0:b.reason)||b),v("error")}})())},children:[e("div",{class:"toolbar stretch",children:[e("input",{ref:W,type:"text",name:"spoilerText",placeholder:l._({id:"gnKo7f"}),disabled:F==="loading",class:"spoiler-text-field",lang:P,spellCheck:"true",dir:"auto",style:{opacity:Y?1:0,pointerEvents:Y?"auto":"none"},onInput:()=>{ot()}}),e("label",{class:`toolbar-button ${Y?"highlight":""}`,title:l._({id:"zKu2Aq"}),children:[e("input",{name:"sensitive",type:"checkbox",checked:Y,disabled:F==="loading",onChange:r=>{var x,h;const u=r.target.checked;ue(u),u?(x=W.current)==null||x.focus():(h=$.current)==null||h.focus()}}),e(Z,{icon:`eye-${Y?"close":"open"}`})]})," ",e("label",{class:`toolbar-button ${H!=="public"&&!Y?"show-field":""} ${H!=="public"?"highlight":""}`,title:`Visibility: ${H}`,children:[e(Z,{icon:Ln[H],alt:H}),e("select",{name:"visibility",value:H,onChange:r=>{te(r.target.value)},disabled:F==="loading"||!!n,dir:"auto",children:[e("option",{value:"public",children:e(V,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(V,{id:"WDcQq9"})}),e("option",{value:"private",children:e(V,{id:"o34OrG"})}),e("option",{value:"direct",children:e(V,{id:"IV4QaU"})})]})]})," "]}),e(yi,{ref:$,placeholder:t?l._({id:"Sjj+EN"}):n?l._({id:"qzVesX"}):l._({id:"owpNF1"}),required:(g==null?void 0:g.length)===0,disabled:F==="loading",lang:P,onInput:()=>{ot()},maxCharacters:ie,performSearch:r=>{const{type:u,q:x,limit:h}=r;return u==="accounts"?E.v1.accounts.search.list({q:x,limit:h,resolve:!1}):E.v2.search.fetch(r)},onTrigger:r=>{(r==null?void 0:r.name)==="custom-emojis"?Ge({defaultSearchTerm:(r==null?void 0:r.defaultSearchTerm)||null}):(r==null?void 0:r.name)==="mention"?ut({defaultSearchTerm:(r==null?void 0:r.defaultSearchTerm)||null}):(r==null?void 0:r.name)==="auto-detect-language"&&(r!=null&&r.languages)&&on(r.languages)}}),(g==null?void 0:g.length)>0&&e("div",{class:"media-attachments",children:[g.map((r,u)=>{const{id:x,file:h}=r,A=(h==null?void 0:h.size)+(h==null?void 0:h.type)+(h==null?void 0:h.name);return e(ki,{attachment:r,disabled:F==="loading",lang:P,onDescriptionChange:C=>{S(D=>{const b=[...D];return b[u].description=C,b})},onRemove:()=>{S(C=>C.filter((D,b)=>b!==u))}},x||A||u)}),e("label",{class:"media-sensitive",children:[e("input",{name:"sensitive",type:"checkbox",checked:Y,disabled:F==="loading",onChange:r=>{const u=r.target.checked;ue(u)}})," ",e("span",{children:e(V,{id:"jER18a"})})," ",e(Z,{icon:`eye-${Y?"close":"open"}`})]})]}),!!z&&e(Ei,{lang:P,maxOptions:K,maxExpiration:ce,minExpiration:X,maxCharactersPerOption:ae,poll:z,disabled:F==="loading",onInput:r=>{if(r){const u={...r};J(u)}else J(null)}}),e("div",{class:"toolbar wrap",style:{justifyContent:"flex-end"},children:[e("span",{children:[e("label",{class:"toolbar-button",children:[e("input",{type:"file",accept:d.join(","),multiple:g.length<O-1,disabled:F==="loading"||g.length>=O||!!z,onChange:r=>{const u=r.target.files;if(!u)return;const x=Array.from(u).map(h=>({file:h,type:h.type,size:h.size,url:URL.createObjectURL(h),id:null,description:null}));g.length+x.length>O?alert(l._({id:"ctFhjs",values:{maxMediaAttachments:O}})):S(h=>h.concat(x)),r.target.value=""}}),e(Z,{icon:"attachment"})]}),K==null||K>1&&e(De,{children:e("button",{type:"button",class:"toolbar-button",disabled:F==="loading"||!!z||!!g.length,onClick:()=>{J({options:["",""],expiresIn:24*60*60,multiple:!1})},children:e(Z,{icon:"poll",alt:l._({id:"cZJ92q"})})})}),e("button",{type:"button",class:"toolbar-button",disabled:F==="loading",onClick:()=>{Ge(!0)},children:e(Z,{icon:"emoji2",alt:l._({id:"ggiJLM"})})}),!!oe.settings.composerGIFPicker&&e("button",{type:"button",class:"toolbar-button gif-picker-button",disabled:F==="loading"||g.length>=O||!!z,onClick:()=>{dt(!0)},children:e("span",{children:"GIF"})})]}),e("div",{class:"spacer"}),F==="loading"?e(st,{abrupt:!0}):e(wi,{maxCharacters:ie,hidden:F==="loading"}),e("label",{class:`toolbar-button ${P!==fe.current||xe!=null&&xe.length&&!xe.includes(P)?"highlight":""}`,children:[e("span",{class:"icon-text",children:(Mt=ii[P])==null?void 0:Mt.native}),e("select",{name:"language",value:P,onChange:r=>{const{value:u}=r.target;se(u||Fe),Se.session.set("currentLanguage",u||Fe)},disabled:F==="loading",dir:"auto",children:[ln.map(([r,u,x])=>{const h=xt({code:r,fallback:u});return e("option",{value:r,children:h!==x?`${x} - ${h}`:h},r)}),e("hr",{}),cn.map(([r,u,x])=>{const h=xt({code:r,fallback:u});return e("option",{value:r,children:h!==x?`${x} - ${h}`:h},r)})]})]})," ",e("button",{type:"submit",class:"large",disabled:F==="loading",children:t?l._({id:"ImOQa9"}):n?l._({id:"EkH9pt"}):l._({id:"GMe2XV"})})]})]})]}),Ue&&e(Je,{onClick:r=>{r.target===r.currentTarget&&ut(!1)},children:e(Fi,{masto:E,instance:M,onClose:()=>{ut(!1)},defaultSearchTerm:Ue==null?void 0:Ue.defaultSearchTerm,onSelect:r=>{const u=$.current;if(!u)return;const{selectionStart:x,selectionEnd:h}=u,A=u.value,C=A.slice(0,x),D=C?/[\s\t\n\r]$/.test(C)?"":" ":"",b=A.slice(h),_=/^[\s\t\n\r]/.test(b)?"":" ",q=C+D+"@"+r+_+b;u.value=q,u.selectionStart=u.selectionEnd=h+1+r.length+_.length,u.focus(),u.dispatchEvent(new Event("input"))}})}),Ve&&e(Je,{onClick:r=>{r.target===r.currentTarget&&Ge(!1)},children:e(Ci,{masto:E,instance:M,onClose:()=>{Ge(!1)},defaultSearchTerm:Ve==null?void 0:Ve.defaultSearchTerm,onSelect:r=>{const u=$.current;if(!u)return;const{selectionStart:x,selectionEnd:h}=u,A=u.value,C=A.slice(0,x),D=C?/[\s\t\n\r]$/.test(C)?"":" ":"",b=A.slice(h),_=/^[\s\t\n\r]/.test(b)?"":" ",q=C+D+r+_+b;u.value=q,u.selectionStart=u.selectionEnd=h+r.length+_.length,u.focus(),u.dispatchEvent(new Event("input"))}})}),rn&&e(Je,{onClick:r=>{r.target===r.currentTarget&&dt(!1)},children:e(_i,{onClose:()=>dt(!1),onSelect:({url:r,type:u,alt_text:x})=>{if(g.length>=O){alert(l._({id:"ctFhjs",values:{maxMediaAttachments:O}}));return}(async()=>{var A,C;let h;try{h=Ce({text:l._({id:"/Cw4Tx"}),duration:-1});const D=await fetch(r,{referrerPolicy:"no-referrer"}).then(q=>q.blob()),b=new File([D],u==="video/mp4"?"video.mp4":"image.gif",{type:u}),_=[...g,{file:b,type:u,size:b.size,id:null,description:x||""}];S(_),(A=h==null?void 0:h.hideToast)==null||A.call(h)}catch{(C=h==null?void 0:h.hideToast)==null||C.call(h),Ce(l._({id:"VKDnAx"}))}})()}})})]})}function Ut(s){if(!s)return;const{value:t,offsetHeight:n,scrollHeight:a,clientHeight:c}=s;if(n<window.innerHeight){const o=n-c,l=t?a+o+"px":null;s.style.height=l}}async function bi(s,t){const a=(await t.v1.customEmojis.list()).filter(o=>o.visibleInPicker),c=new An(a,{keys:["shortcode"],findAllMatches:!0});return[a,c]}const nn=yn(bi,{matchesArg:(s,t)=>s.instance===t.instance,maxAge:30*60*1e3}),xi=s=>{const t=Rn(s);return t!=null&&t.length?t.slice(0,2).map(n=>n.lang):null},yi=wn((s,t)=>{var O;const{masto:n,instance:a}=Ct(),[c,o]=U(((O=t.current)==null?void 0:O.value)||""),{maxCharacters:l,performSearch:y=()=>{},onTrigger:E=()=>{},...M}=s,F=G();ne(()=>{nn(a,n).then(p=>{const[d,m]=p;F.current=m}).catch(p=>{})},[]);const v=G(),B=G("");ne(()=>{let p,d,m;return v.current&&(p=w=>{var ae;const{key:f,provide:R,text:k}=w.detail;if(B.current=k,k===""){R(Promise.resolve({matched:!1}));return}if(f===":"){const ce=(ae=F.current)==null?void 0:ae.search(k,{limit:5});let X="";ce.forEach(({item:$})=>{const{shortcode:W,url:H}=$;X+=`
<li role="option" data-value="${we(W)}">
<img src="${we(H)}" width="16" height="16" alt="" loading="lazy" />
${we(W)}
</li>`}),X+=`<li role="option" data-value="" data-more="${k}">${ge._({id:"24misb"})}</li>`,ke.innerHTML=X,R(Promise.resolve({matched:ce.length>0,fragment:ke}));return}const K={"@":"accounts","#":"hashtags"}[f];R(new Promise(ce=>{y({type:K,q:k,limit:5}).then($=>{if(k!==B.current)return;const W=$[K]||$;let H="";W.forEach(te=>{var J;const{name:Y,avatarStatic:ue,displayName:P,username:se,acct:fe,emojis:g,history:S}=te,z=Sn(P,g);if(fe)H+=`
<li role="option" data-value="${we(fe)}">
<span class="avatar">
<img src="${we(ue)}" width="16" height="16" alt="" loading="lazy" />
</span>
<span>
<b>${z||se}</b>
<br><span class="bidi-isolate">@${we(fe)}</span>
</span>
</li>
`;else{const N=(J=S==null?void 0:S.reduce)==null?void 0:J.call(S,(de,pe)=>de+ +pe.uses,0);H+=`
<li role="option" data-value="${we(Y)}">
<span class="grow">#<b>${we(Y)}</b></span>
${N?`<span class="count">${In(N)}</span>`:""}
</li>
`}}),K==="accounts"&&(H+=`<li role="option" data-value="" data-more="${k}">${ge._({id:"24misb"})}</li>`),ke.innerHTML=H,ce({matched:W.length>0,fragment:ke})})}))},v.current.addEventListener("text-expander-change",p),d=w=>{const{key:f,item:R}=w.detail,{value:k,more:K}=R.dataset;f===":"?(w.detail.value=k?`:${k}:`:"",K&&(w.detail.continue=!0,setTimeout(()=>{E==null||E({name:"custom-emojis",defaultSearchTerm:K})},300))):f==="@"?(w.detail.value=k?`@${k} `:"",K&&(w.detail.continue=!0,setTimeout(()=>{E==null||E({name:"mention",defaultSearchTerm:K})},300))):w.detail.value=`${f}${k}`},v.current.addEventListener("text-expander-value",d),m=w=>{const{input:f}=w.detail;if(o(f.value),t.current){const R=new Event("input",{bubbles:!0});t.current.dispatchEvent(R)}},v.current.addEventListener("text-expander-committed",m)),()=>{v.current&&(v.current.removeEventListener("text-expander-change",p),v.current.removeEventListener("text-expander-value",d),v.current.removeEventListener("text-expander-committed",m))}},[]),ne(()=>{const p=t.current;if(!p)return;new ResizeObserver(()=>{if(v.current){const{height:m}=p.getBoundingClientRect();v.current.style.height=m+"px"}}).observe(p)},[]);const L=G(0),T=G(),j=Mn(p=>{var w;if(!T.current)return;if(L.current>3){T.current.innerHTML="",T.current=null,(w=j==null?void 0:j.cancel)==null||w.call(j);return}let d,m;L.current<=3&&(d=Date.now()),T.current.innerHTML=fi(p,{maxCharacters:l})+`
`,L.current<=3&&(m=Date.now()),d&&m&&m-d>50&&L.current++},500),ie=at(()=>{var w,f;const p=(w=T.current)==null?void 0:w.cloneNode(!0);if(!p)return;p.querySelectorAll("mark").forEach(R=>{R.remove()});const d=(f=p.innerText)==null?void 0:f.trim();if(!d)return;const m=xi(d);m!=null&&m.length&&(E==null||E({name:"auto-detect-language",languages:m}))},2e3);return e("text-expander",{ref:v,keys:"@ # :",class:"compose-field-container",children:[e("textarea",{class:"compose-field",autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",rows:"6",cols:"50",...M,ref:t,name:"status",value:c,onKeyDown:p=>{const{key:d,target:m}=p;if(d==="Enter"&&!(p.ctrlKey||p.metaKey))try{const{value:w,selectionStart:f}=m,k=w.slice(0,f).split(`
`).slice(-1)[0];if(k&&/^\s*(-|\d+\.)\s/.test(k)){const[K,ae,ce,X,$]=k.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if($){p.preventDefault();const[W]=ce.match(/\d+/)||[],H=W?`${+W+1}.`:"-",te=`
${ae}${H}${X}`;m.setRangeText(te,f,f);const Y=f+te.length;m.setSelectionRange(Y,Y)}else{const W=f-k.length;m.setRangeText("",W,f)}Ut(m),m.dispatchEvent(new Event("input"))}}catch{}T.current&&(T.current.scrollTop=m.scrollTop)},onInput:p=>{var w;const{target:d}=p,m=d.value.replace(/\u200b/g,"");o(m),Ut(d),(w=s.onInput)==null||w.call(s,p),j(m),ie()},style:{width:"100%",height:"4em"},onScroll:p=>{if(T.current){const{scrollTop:d}=p.target;T.current.scrollTop=d}}}),e("div",{ref:T,class:"compose-highlight","aria-hidden":"true"})]})});function wi({maxCharacters:s=500,hidden:t}){const a=kn(oe).composerCharacterCount,c=s-a;return t?e("span",{class:"char-counter",hidden:!0}):e("span",{class:"char-counter",title:`${c}/${s}`,style:{"--percentage":a/s*100},children:[e("meter",{class:`${c<=-10?"explode":c<=0?"danger":c<=20?"warning":""}`,value:a,max:s}),e("span",{class:"counter",children:c})]})}function Vt(s,t,n,a){const c=Math.sqrt(t/s),o=Math.floor(n*c),l=Math.floor(a*c);return{newWidth:o,newHeight:l}}function ki({attachment:s,disabled:t,lang:n,onDescriptionChange:a=()=>{},onRemove:c=()=>{}}){const{i18n:o}=Ke(),[l,y]=U("default"),E=Jt("@mastodon/edit-media-attributes"),{type:M,id:F,file:v}=s,B=Pe(()=>v?URL.createObjectURL(v):s.url,[v,s.url]),L=!!(v!=null&&v.size),T=L?Yt():{},{mediaAttachments:{imageSizeLimit:j,imageMatrixLimit:ie,videoSizeLimit:O,videoMatrixLimit:p,videoFrameRateLimit:d}={}}=T||{},[m,w]=U(()=>L?M.startsWith("image")&&j&&v.size>j?{type:"imageSizeLimit",details:{imageSize:v.size,imageSizeLimit:j}}:M.startsWith("video")&&O&&v.size>O?{type:"videoSizeLimit",details:{videoSize:v.size,videoSizeLimit:O}}:null:null),[f,R]=U({});ne(()=>{!L||!ie||(f==null?void 0:f.matrix)>ie&&w({type:"imageMatrixLimit",details:{imageMatrix:f==null?void 0:f.matrix,imageMatrixLimit:ie,width:f==null?void 0:f.width,height:f==null?void 0:f.height}})},[f,ie,L]);const[k,K]=U({});ne(()=>{!L||!p||(k==null?void 0:k.matrix)>p&&w({type:"videoMatrixLimit",details:{videoMatrix:k==null?void 0:k.matrix,videoMatrixLimit:p,width:k==null?void 0:k.width,height:k==null?void 0:k.height}})},[k,p,L]);const[ae,ce]=U(s.description),[X,$]=M.split("/"),W=at(a,250);ne(()=>{W(ae)},[ae,W]);const[H,te]=U(!1),Y=G(null);ne(()=>{let g;return H&&Y.current&&(g=setTimeout(()=>{Y.current.focus()},100)),()=>{clearTimeout(g)}},[H]);const ue=e(De,{children:F&&!E?e("div",{class:"media-desc",children:[e("span",{class:"tag",children:e(V,{id:"3wG7HI"})}),e("p",{title:ae,children:s.description||e("i",{children:"No description"})})]}):e("textarea",{ref:Y,value:ae||"",lang:n,placeholder:{image:o._({id:"Lh8B0N"}),video:o._({id:"mN4S+e"}),audio:o._({id:"ieZytw"})}[X],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:t||l==="loading",class:l==="loading"?"loading":"",maxlength:"1500",onInput:g=>{const{value:S}=g.target;ce(S)}})}),P=G(null);ne(()=>()=>{var g,S;(S=(g=P.current)==null?void 0:g.hideToast)==null||S.call(g)},[]);const se=G(null),fe=g=>{const{type:S,details:z}=g;switch(S){case"imageSizeLimit":{const{imageSize:J,imageSizeLimit:N}=z;return o._({id:"d83/LB",values:{0:Xe(J),1:Xe(N)}})}case"imageMatrixLimit":{const{imageMatrix:J,imageMatrixLimit:N,width:de,height:pe}=z,{newWidth:Le,newHeight:Ae}=Vt(J,N,de,pe);return o._({id:"DuvOX/",values:{0:o.number(de),1:o.number(pe),2:o.number(Le),3:o.number(Ae)}})}case"videoSizeLimit":{const{videoSize:J,videoSizeLimit:N}=z;return o._({id:"d83/LB",values:{0:Xe(J),1:Xe(N)}})}case"videoMatrixLimit":{const{videoMatrix:J,videoMatrixLimit:N,width:de,height:pe}=z,{newWidth:Le,newHeight:Ae}=Vt(J,N,de,pe);return o._({id:"DuvOX/",values:{0:o.number(de),1:o.number(pe),2:o.number(Le),3:o.number(Ae)}})}case"videoFrameRateLimit":return o._({id:"S1fBwy"})}};return e(De,{children:[e("div",{class:"media-attachment",children:[e("div",{class:"media-preview",tabIndex:"0",onClick:()=>{te(!0)},children:X==="image"?e("img",{src:B,alt:"",onLoad:g=>{if(!L)return;const{naturalWidth:S,naturalHeight:z}=g.target;R({matrix:S*z,width:S,height:z})}}):X==="video"||X==="gifv"?e("video",{src:B+"#t=0.1",playsinline:!0,muted:!0,disablePictureInPicture:!0,preload:"metadata",onLoadedMetadata:g=>{if(!L)return;const{videoWidth:S,videoHeight:z}=g.target;S&&z&&K({matrix:S*z,width:S,height:z})}}):X==="audio"?e("audio",{src:B,controls:!0}):null}),ue,e("div",{class:"media-aside",children:[e("button",{type:"button",class:"plain close-button",disabled:t,onClick:c,children:e(Z,{icon:"x",alt:o._({id:"t/YqKh"})})}),!!m&&e("button",{type:"button",class:"media-error",title:fe(m),onClick:()=>{se.current&&se.current.hideToast(),se.current=Ce({text:fe(m),duration:1e4})},children:e(Z,{icon:"alert",alt:o._({id:"SlfejT"})})})]})]}),H&&e(Je,{onClose:()=>{te(!1)},children:e("div",{id:"media-sheet",class:"sheet sheet-max",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>{te(!1)},children:e(Z,{icon:"x",alt:o._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:{image:o._({id:"oMslIB"}),video:o._({id:"WZw+zB"}),audio:o._({id:"KMtgtM"})}[X]})}),e("main",{tabIndex:"-1",children:[e("div",{class:"media-preview",children:X==="image"?e("img",{src:B,alt:""}):X==="video"||X==="gifv"?e("video",{src:B,playsinline:!0,controls:!0}):X==="audio"?e("audio",{src:B,controls:!0}):null}),e("div",{class:"media-form",children:[ue,e("footer",{children:[X==="image"&&/^(png|jpe?g|gif|webp)$/i.test($)&&!!oe.settings.mediaAltGenerator&&!!ft&&e(Bn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:e(Z,{icon:"more",size:"l",alt:o._({id:"2FYpfJ"})})}),children:[e($t,{disabled:l==="loading",onClick:()=>{y("loading"),P.current=Ce({text:o._({id:"8zsp51"}),duration:-1}),async function(){var g,S;try{const z=new FormData;z.append("image",v);const J=await fetch(ft,{method:"POST",body:z}).then(N=>N.json());if(J.error)throw new Error(J.error);ce(J.description)}catch(z){Ce(z.message?o._({id:"wy0Iwj",values:{0:z.message}}):o._({id:"xhYfVj"}))}finally{y("default"),(S=(g=P.current)==null?void 0:g.hideToast)==null||S.call(g)}}()},children:[e(Z,{icon:"sparkles2"}),n&&n!=="en"?e("small",{children:[e(V,{id:"o5sTJw"}),e("br",{}),"(English)"]}):e("span",{children:e(V,{id:"o5sTJw"})})]}),!!n&&n!=="en"&&e($t,{disabled:l==="loading",onClick:()=>{y("loading"),P.current=Ce({text:o._({id:"8zsp51"}),duration:-1}),async function(){var g,S;try{const z=new FormData;z.append("image",v);const J=`?lang=${n}`,N=await fetch(ft+J,{method:"POST",body:z}).then(de=>de.json());if(N.error)throw new Error(N.error);ce(N.description)}catch(z){Ce(o._({id:"eNTGfp",values:{0:z!=null&&z.message?`: ${z.message}`:""}}))}finally{y("default"),(S=(g=P.current)==null?void 0:g.hideToast)==null||S.call(g)}}()},children:[e(Z,{icon:"sparkles2"}),e("small",{children:[e(V,{id:"o5sTJw"}),e("br",{}),e(V,{id:"m+pAEQ",values:{0:xt(n)},components:{0:e("span",{class:"more-insignificant"})}})]})]})]}),e("button",{type:"button",class:"light block",onClick:()=>{te(!1)},disabled:l==="loading",children:e(V,{id:"DPfwMq"})})]})]})]})]})})]})}function Ei({lang:s,poll:t,disabled:n,onInput:a=()=>{},maxOptions:c,maxExpiration:o,minExpiration:l,maxCharactersPerOption:y}){const{_:E}=Ke(),{options:M,expiresIn:F,multiple:v}=t;return e("div",{class:`poll ${v?"multiple":""}`,children:[e("div",{class:"poll-choices",children:M.map((B,L)=>e("div",{class:"poll-choice",children:[e("input",{required:!0,type:"text",value:B,disabled:n,maxlength:y,placeholder:ge._({id:"LDUSXg",values:{0:L+1}}),lang:s,spellCheck:"true",dir:"auto",onInput:T=>{const{value:j}=T.target;M[L]=j,a(t)}}),e("button",{type:"button",class:"plain2 poll-button",disabled:n||M.length<=1,onClick:()=>{M.splice(L,1),a(t)},children:e(Z,{icon:"x",size:"s",alt:ge._({id:"t/YqKh"})})})]},L))}),e("div",{class:"poll-toolbar",children:[e("button",{type:"button",class:"plain2 poll-button",disabled:n||M.length>=c,onClick:()=>{M.push(""),a(t)},children:"+"})," ",e("label",{class:"multiple-choices",children:[e("input",{type:"checkbox",checked:v,disabled:n,onChange:B=>{const{checked:L}=B.target;t.multiple=L,a(t)}})," ",e(V,{id:"T57mm9"})]}),e("label",{class:"expires-in",children:[e(V,{id:"lkz6PL"})," ",e("select",{value:F,disabled:n,onChange:B=>{const{value:L}=B.target;t.expiresIn=L,a(t)},children:Object.entries(en).filter(([B])=>B>=l&&B<=o).map(([B,L])=>e("option",{value:B,children:L()},B))})]})]}),e("div",{class:"poll-toolbar",children:e("button",{type:"button",class:"plain remove-poll-button",disabled:n,onClick:()=>{a(null)},children:e(V,{id:"CDpQAX"})})})]})}function we(s){return s.replace(/[&<>"']/g,function(t){return"&#"+t.charCodeAt(0)+";"})}function Gt(s){for(let t in s)(s[t]===null||s[t]===void 0)&&delete s[t];return s}function Fi({onClose:s=()=>{},onSelect:t=()=>{},defaultSearchTerm:n}){const{masto:a}=Ct(),[c,o]=U("default"),[l,y]=U([]),[E,M]=U({}),[F,v]=U(0),B=async p=>{if(!(p!=null&&p.length))return;const d=await Tn(p,E);d&&M({...E,...d})},L=p=>{p&&(o("loading"),(async()=>{try{const d=await a.v1.accounts.search.list({q:p,limit:40,resolve:!1});y(d),B(d),o("default")}catch{o("error")}})())},T=at(L,1e3);ne(()=>{L()},[L]);const j=G();ne(()=>{j.current&&(j.current.focus(),j.current.value&&(j.current.selectionStart=j.current.value.length,j.current.selectionEnd=j.current.value.length))},[]),ne(()=>{n&&L(n)},[n]);const ie=p=>{const d=p.acct;t(d),s()};Oe("enter",()=>{const p=l[F];p&&ie(p)},{preventDefault:!0,enableOnFormTags:["input"]});const O=G();return Oe("down",()=>{F<l.length-1?v(F+1):v(0),setTimeout(()=>{const p=O.current.querySelector(".selected");p&&p.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),Oe("up",()=>{F>0?v(F-1):v(l.length-1),setTimeout(()=>{const p=O.current.querySelector(".selected");p&&p.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),e("div",{id:"mention-sheet",class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(Z,{icon:"x",alt:ge._({id:"yz7wBu"})})}),e("header",{children:e("form",{onSubmit:p=>{var d;p.preventDefault(),(d=T.flush)==null||d.call(T)},children:e("input",{ref:j,required:!0,type:"search",class:"block",placeholder:ge._({id:"eH1bqp"}),onInput:p=>{const{value:d}=p.target;T(d)},autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:n||""})})}),e("main",{children:(l==null?void 0:l.length)>0?e("ul",{ref:O,class:`accounts-list ${c==="loading"?"loading":""}`,children:l.map((p,d)=>{const m=E[p.id];return e("li",{class:d===F?"selected":"",children:[e(Xt,{avatarSize:"xxl",account:p,relationship:m,showStats:!0,showActivity:!0}),e("button",{type:"button",class:"plain2",onClick:()=>{ie(p)},children:e(Z,{icon:"plus",size:"xl",alt:ge._({id:"m16xKo"})})})]},p.id)})}):c==="loading"?e("div",{class:"ui-state",children:e(st,{abrupt:!0})}):c==="error"?e("div",{class:"ui-state",children:e("p",{children:e(V,{id:"AThL/k"})})}):null})]})}function Ci({masto:s,instance:t,onClose:n=()=>{},onSelect:a=()=>{},defaultSearchTerm:c}){const[o,l]=U("default"),y=G([]),[E,M]=U([]),F=Pe(()=>Se.account.get("recentlyUsedCustomEmojis")||[]),v=G();ne(()=>{l("loading"),(async()=>{try{const[d,m]=await nn(t,s);v.current=m,M(d),l("default")}catch{l("error")}})()},[]);const B=Pe(()=>{const d={"--recent--":F.filter(w=>E.find(f=>f.shortcode===w.shortcode))},m=[];return E.forEach(w=>{var f,R;if((R=(f=y.current)==null?void 0:f.push)==null||R.call(f,w),!w.category){m.push(w);return}d[w.category]||(d[w.category]=[]),d[w.category].push(w)}),m.length&&(d["--others--"]=m),d},[E]),L=G(),[T,j]=U(null),ie=Tt(d=>{var w,f,R;const{value:m}=d.target;if(m){const k=(w=v.current)==null?void 0:w.search(m,{limit:Ft});j(k.map(K=>K.item)),(R=(f=L.current)==null?void 0:f.scrollTo)==null||R.call(f,0,0)}else j(null)},[E]);ne(()=>{c&&(E!=null&&E.length)&&ie({target:{value:c}})},[c,ie,E]);const O=Tt(d=>{a==null||a(d),n==null||n(),queueMicrotask(()=>{let m=Se.account.get("recentlyUsedCustomEmojis")||[];const w=m.findIndex(f=>f.shortcode===d.shortcode);w!==-1?(m.splice(w,1),m.unshift(d)):(m.unshift(d),m=m.filter(f=>{var R,k;return(k=(R=y.current)==null?void 0:R.find)==null?void 0:k.call(R,K=>K.shortcode===f.shortcode)}),m=m.slice(0,10)),Se.account.set("recentlyUsedCustomEmojis",m)})},[a]),p=G();return ne(()=>{p.current&&(p.current.focus(),p.current.value&&(p.current.selectionStart=p.current.value.length,p.current.selectionEnd=p.current.value.length))},[]),e("div",{id:"custom-emojis-sheet",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(Z,{icon:"x",alt:ge._({id:"yz7wBu"})})}),e("header",{children:[e("div",{children:[e("b",{children:e(V,{id:"8i6Ueo"})})," ",o==="loading"?e(st,{}):e("small",{class:"insignificant",children:[" • ",t]})]}),e("form",{onSubmit:d=>{d.preventDefault();const m=T[0];m&&O(`:${m.shortcode}:`)},children:e("input",{ref:p,type:"search",placeholder:ge._({id:"EarrCe"}),onInput:ie,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:c||""})})]}),e("main",{ref:L,children:T!==null?e("ul",{class:"custom-emojis-matches custom-emojis-list",children:T.map(d=>e("li",{class:"custom-emojis-match",children:e(sn,{emoji:d,onClick:()=>{O(`:${d.shortcode}:`)},showCode:!0})},d.shortcode))}):e("div",{class:"custom-emojis-list",children:[o==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(V,{id:"Kzwsg2"})})}),o==="default"&&Object.entries(B).map(([d,m])=>!!(m!=null&&m.length)&&e(De,{children:[e("div",{class:"section-header",children:{"--recent--":ge._({id:"uabU9X"}),"--others--":ge._({id:"NuKR0h"})}[d]||d}),e(zi,{emojis:m,onSelect:O})]}))]})})]})}const zi=Zt(({emojis:s,onSelect:t})=>{const{i18n:n}=Ke(),[a,c]=U(Ft),o=s.length>a;return e("section",{children:[s.slice(0,a).map(l=>e(sn,{emoji:l,onClick:()=>{t(`:${l.shortcode}:`)}},l.shortcode)),o&&e("button",{type:"button",class:"plain small",onClick:()=>c(a+Ft),children:e(V,{id:"iAB71E",values:{0:n.number(s.length-a)}})})]})}),sn=Zt(({emoji:s,onClick:t,showCode:n})=>{const a=c=>{const l=c.currentTarget.closest("main");if(l){const y=l.getBoundingClientRect(),E=c.currentTarget.getBoundingClientRect(),M=c.currentTarget.classList;E.left<y.left+88?(M.add("edge-left"),M.remove("edge-right")):E.right>y.right-88?(M.add("edge-right"),M.remove("edge-left")):M.remove("edge-left","edge-right")}};return e("button",{type:"button",className:"plain4",onClick:t,"data-title":n?void 0:s.shortcode,onPointerEnter:a,onFocus:a,children:[e("picture",{children:[!!s.staticUrl&&e("source",{srcSet:s.staticUrl,media:"(prefers-reduced-motion: reduce)"}),e("img",{className:"shortcode-emoji",src:s.url||s.staticUrl,alt:s.shortcode,width:"24",height:"24",loading:"lazy",decoding:"async"})]}),n&&e(De,{children:[" ",e("code",{children:s.shortcode})]})]})}),bt=20;function _i({onClose:s=()=>{},onSelect:t=()=>{}}){var L,T,j,ie,O,p;const{i18n:n}=Ke(),[a,c]=U("default"),[o,l]=U([]),y=G(null),E=G(null),M=G(0),F=G(null);function v({offset:d}){var m,w,f;(m=E.current)!=null&&m.value&&(c("loading"),(f=(w=F.current)==null?void 0:w.scrollTo)==null||f.call(w,{top:0,left:0,behavior:"smooth"}),(async()=>{var R;try{const k={api_key:ni,q:E.current.value,rating:"g",limit:bt,bundle:"messaging_non_clips",offset:d,lang:n.locale||"en"},K=await fetch("https://api.giphy.com/v1/gifs/search?"+new URLSearchParams(k),{referrerPolicy:"no-referrer"}).then(ae=>ae.json());M.current=((R=K.pagination)==null?void 0:R.offset)||0,l(K),c("results")}catch{c("error")}})())}ne(()=>{var d;(d=E.current)==null||d.focus()},[]);const B=at(()=>{v({offset:0})},1e3);return e("div",{id:"gif-picker-sheet",class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(Z,{icon:"x",alt:n._({id:"yz7wBu"})})}),e("header",{children:e("form",{ref:y,onSubmit:d=>{d.preventDefault(),v({offset:0})},children:[e("input",{ref:E,type:"search",name:"q",placeholder:n._({id:"wxlF9B"}),required:!0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",onInput:B}),e("input",{type:"image",class:"powered-button",src:Jn,width:"86",height:"30",alt:n._({id:"c1Q/eU"})})]})}),e("main",{ref:F,class:a==="loading"?"loading":"",children:[a==="default"&&e("div",{class:"ui-state",children:e("p",{class:"insignificant",children:e(V,{id:"9KEidY"})})}),a==="loading"&&!((L=o==null?void 0:o.data)!=null&&L.length)&&e("div",{class:"ui-state",children:e(st,{abrupt:!0})}),((T=o==null?void 0:o.data)==null?void 0:T.length)>0?e(De,{children:[e("ul",{children:o.data.map(d=>{const{id:m,images:w,title:f,alt_text:R}=d,{fixed_height_small:k,fixed_height_downsampled:K,fixed_height:ae,original:ce}=w,X=k!=null&&k.url?k:K!=null&&K.url?K:ae;let{url:$,webp:W,width:H,height:te}=X;+te>100&&(H=H/te*100,te=100);const Y=URL.parse($),ue=Y.origin+Y.pathname;let P;if(W){const se=URL.parse(W);P=se.origin+se.pathname}return e("li",{children:e("button",{type:"button",onClick:()=>{const{mp4:se,url:fe}=ce,g=se||fe,S=URL.parse(g),z=S.origin+S.pathname;s(),t({url:z,type:se?"video/mp4":"image/gif",alt_text:R||f})},children:e("figure",{style:{"--figure-width":H+"px"},children:[e("picture",{children:[P&&e("source",{srcset:P,type:"image/webp"}),e("img",{src:ue,width:H,height:te,loading:"lazy",decoding:"async",alt:R,referrerpolicy:"no-referrer",onLoad:se=>{se.target.style.backgroundColor="transparent"}})]}),e("figcaption",{children:R||f})]})})},m)})}),e("p",{class:"pagination",children:[((j=o.pagination)==null?void 0:j.offset)>0&&e("button",{type:"button",class:"light small",disabled:a==="loading",onClick:()=>{var d;v({offset:((d=o.pagination)==null?void 0:d.offset)-bt})},children:[e(Z,{icon:"chevron-left"}),e("span",{children:e(V,{id:"DHhJ7s"})})]}),e("span",{}),((ie=o.pagination)==null?void 0:ie.offset)+((O=o.pagination)==null?void 0:O.count)<((p=o.pagination)==null?void 0:p.total_count)&&e("button",{type:"button",class:"light small",disabled:a==="loading",onClick:()=>{var d;v({offset:((d=o.pagination)==null?void 0:d.offset)+bt})},children:[e("span",{children:e(V,{id:"hXzOVo"})})," ",e(Z,{icon:"chevron-right"})]})]})]}):a==="results"&&e("div",{class:"ui-state",children:e("p",{children:"No results"})}),a==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(V,{id:"PbFw9n"})})})]})]})}export{Mi as default};
//# sourceMappingURL=compose-oSeoicVc.js.map