27 lines
81 KiB
JavaScript
27 lines
81 KiB
JavaScript
var mt=(s,e,n)=>{if(!e.has(s))throw TypeError("Cannot "+n)};var T=(s,e,n)=>(mt(s,e,"read from private field"),n?n.call(s):e.get(s)),G=(s,e,n)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,n)},ce=(s,e,n,o)=>(mt(s,e,"write to private field"),o?o.call(s,n):e.set(s,n),n);var Y=(s,e,n)=>(mt(s,e,"access private method"),n);import{p as H,t as dn,F as W,_ as ee,u as je,Z as hn,q as Pe,b as t,k as Ce,E as pn,ao as mn,n as gn,o as ot,m as fn,a as vn,M as $t,g as Bt,x as Kt}from"./vendor-GrW-f9CX.js";import{v as bn,P as yn,p as Tt,u as xn,e as Vt,a as wn,I as K,r as _t,d as Gt,Q as kn,M as Qe,s as xe,K as En,j as Fn,b as Cn,l as zn,q as Ln}from"./status-FORkhePO.js";import{s as re,a as Ft,e as An,A as Yt,c as ze,f as Sn,b as In,L as rt,p as Mn}from"./useTitle-dCp14HlU.js";class $n{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=>Bn(p,this),this.compositionEventHandler=p=>_n(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",Rt),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",Rt)}indicateDefaultOption(){var e;this.defaultFirstOption&&((e=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(gt)[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(gt)[0],o=Array.from(this.list.querySelectorAll('[role="option"]')).filter(gt),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&&v<o.length&&(p=v)}const u=o[p];if(u)for(const v of o)v.removeAttribute("data-combobox-option-default"),u===v?(this.input.setAttribute("aria-activedescendant",u.id),u.setAttribute("aria-selected","true"),Rn(this.list,u)):v.removeAttribute("aria-selected")}clearSelection(){this.input.removeAttribute("aria-activedescendant");for(const e of this.list.querySelectorAll('[aria-selected="true"]'))e.removeAttribute("aria-selected");this.indicateDefaultOption()}}function Bn(s,e){if(!(s.shiftKey||s.metaKey||s.altKey)&&!(!e.ctrlBindings&&s.ctrlKey)&&!e.isComposing)switch(s.key){case"Enter":Dt(e.input,e.list)&&s.preventDefault();break;case"Tab":e.tabInsertsSuggestions&&Dt(e.input,e.list)&&s.preventDefault();break;case"Escape":e.clearSelection();break;case"ArrowDown":e.navigate(1),s.preventDefault();break;case"ArrowUp":e.navigate(-1),s.preventDefault();break;case"n":e.ctrlBindings&&s.ctrlKey&&(e.navigate(1),s.preventDefault());break;case"p":e.ctrlBindings&&s.ctrlKey&&(e.navigate(-1),s.preventDefault());break;default:if(s.ctrlKey)break;e.clearSelection()}}function Rt(s){if(!(s.target instanceof Element))return;const e=s.target.closest('[role="option"]');e&&e.getAttribute("aria-disabled")!=="true"&&Tn(e)}function Dt(s,e){const n=e.querySelector('[aria-selected="true"], [data-combobox-option-default="true"]');return n?(n.getAttribute("aria-disabled")==="true"||n.click(),!0):!1}function Tn(s){s.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}function gt(s){return!s.hidden&&!(s instanceof HTMLInputElement&&s.type==="hidden")&&(s.offsetWidth>0||s.offsetHeight>0)}function _n(s,e){e.isComposing=s.type==="compositionstart",document.getElementById(e.input.getAttribute("aria-controls")||"")&&e.clearSelection()}function Rn(s,e){Dn(s,e)||(s.scrollTop=e.offsetTop)}function Dn(s,e){const n=s.scrollTop,o=n+s.clientHeight,r=e.offsetTop,p=r+e.clientHeight;return r>=n&&p<=o}const jn=/\s|\(|\[/;function Pn(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<r)return;if(o){if(p!=null){if(p===u)return;u=p-e.length}if(s[u+1]===" "&&n>=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&&!jn.test(v)?void 0:{text:s.substring(u+e.length,n),position:u+e.length}}class On extends HTMLElement{}class Hn extends Event{constructor(){super("update")}}const ft=new WeakMap;var Oe,He,we,me,ke,Re,Le,Ae,Ne,yt,Se,Ie,et,Me,tt,$e,nt,Ue,Ee;const zt=class zt extends On{constructor(n){super();G(this,ke);G(this,Ne);G(this,Ie);G(this,Me);G(this,$e);G(this,Oe,new MutationObserver(()=>Y(this,Me,tt).call(this)));G(this,He,new ResizeObserver(()=>Y(this,Ie,et).call(this)));G(this,we,void 0);G(this,me,void 0);G(this,Le,0);G(this,Ae,0);G(this,Se,!1);G(this,Ue,()=>Y(this,$e,nt).call(this));G(this,Ee,n=>{Y(this,ke,Re).call(this,o=>{(n.target===document||n.target===window||n.target instanceof Node&&n.target.contains(o))&&Y(this,Ie,et).call(this)})});ce(this,we,new WeakRef(n)),ce(this,me,document.createElement("div")),T(this,me).style.position="absolute",T(this,me).style.pointerEvents="none",n.after(T(this,me)),T(this,me).appendChild(this)}static for(n){const o=ft.get(n)??new zt(n);return ft.set(n,o),o}forceUpdate(){Y(this,Me,tt).call(this),Y(this,$e,nt).call(this)}connectedCallback(){const n=T(this,we).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"),Y(this,Me,tt).call(this),Y(this,$e,nt).call(this),T(this,Oe).observe(n,{attributeFilter:["style","dir"]}),T(this,He).observe(n),document.addEventListener("scroll",T(this,Ee),{capture:!0}),window.addEventListener("resize",T(this,Ee),{capture:!0}),n.addEventListener("input",T(this,Ue),{capture:!0})}disconnectedCallback(){T(this,me).remove(),T(this,Oe).disconnect(),T(this,He).disconnect(),document.removeEventListener("scroll",T(this,Ee),{capture:!0}),window.removeEventListener("resize",T(this,Ee),{capture:!0});const n=T(this,we).deref();n&&(n.removeEventListener("input",T(this,Ue),{capture:!0}),ft.delete(n))}};Oe=new WeakMap,He=new WeakMap,we=new WeakMap,me=new WeakMap,ke=new WeakSet,Re=function(n){const o=T(this,we).deref();return o?n(o):this.remove()},Le=new WeakMap,Ae=new WeakMap,Ne=new WeakSet,yt=function(){Y(this,ke,Re).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();ce(this,Le,T(this,Le)+r.left-p.left),ce(this,Ae,T(this,Ae)+r.top-p.top),this.style.transform=`translate(${T(this,Le)}px, ${T(this,Ae)}px)`,this.scrollTop=n.scrollTop,this.scrollLeft=n.scrollLeft,this.dispatchEvent(new Hn)})},Se=new WeakMap,Ie=new WeakSet,et=function(){T(this,Se)||(ce(this,Se,!0),requestAnimationFrame(()=>{Y(this,Ne,yt).call(this),ce(this,Se,!1)}))},Me=new WeakSet,tt=function(){Y(this,ke,Re).call(this,n=>{const o=window.getComputedStyle(n);for(const r of Nn)this.style[r]=o[r];Y(this,Ie,et).call(this)})},$e=new WeakSet,nt=function(){Y(this,ke,Re).call(this,n=>{this.textContent=n.value,Y(this,Ne,yt).call(this)})},Ue=new WeakMap,Ee=new WeakMap;let it=zt;const Nn=["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",it)}catch(s){if(!(s instanceof DOMException&&s.name==="NotSupportedError"))throw s}var de,Be,Te,We,wt,st,Zt,qe,kt,Fe,De;const at=class at{constructor(e,n=0,o=n){G(this,We);G(this,st);G(this,qe);G(this,Fe);G(this,de,void 0);G(this,Be,void 0);G(this,Te,void 0);ce(this,de,e),ce(this,Be,n),ce(this,Te,o)}static fromSelection(e){const{selectionStart:n,selectionEnd:o}=e;return new at(e,n??void 0,o??void 0)}get collapsed(){return this.startOffset===this.endOffset}get commonAncestorContainer(){return T(this,de)}get endContainer(){return T(this,de)}get startContainer(){return T(this,de)}get startOffset(){return T(this,Be)}get endOffset(){return T(this,Te)}setStartOffset(e){ce(this,Be,Y(this,qe,kt).call(this,e))}setEndOffset(e){ce(this,Te,Y(this,qe,kt).call(this,e))}collapse(e=!1){e?this.setEndOffset(this.startOffset):this.setStartOffset(this.endOffset)}cloneContents(){return Y(this,Fe,De).call(this).cloneContents()}cloneRange(){return new at(T(this,de),this.startOffset,this.endOffset)}getBoundingClientRect(){return Y(this,Fe,De).call(this).getBoundingClientRect()}getClientRects(){return Y(this,Fe,De).call(this).getClientRects()}toString(){return Y(this,Fe,De).call(this).toString()}getStyleClone(){return T(this,We,wt)}};de=new WeakMap,Be=new WeakMap,Te=new WeakMap,We=new WeakSet,wt=function(){return it.for(T(this,de))},st=new WeakSet,Zt=function(){return T(this,We,wt)},qe=new WeakSet,kt=function(e){return Math.max(0,Math.min(e,T(this,de).value.length))},Fe=new WeakSet,De=function(){const e=document.createRange(),n=T(this,st,Zt).childNodes[0];return n&&(e.setStart(n,this.startOffset),e.setEnd(n,this.endOffset)),e};let xt=at;const Je=new WeakMap;class Un{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 $n(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 xt(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=Pn(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 jt 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 Un(this,e);Je.set(this,n)}disconnectedCallback(){const e=Je.get(this);e&&(e.destroy(),Je.delete(this))}dismiss(){const e=Je.get(this);e&&e.dismissMenu()}}window.customElements.get("text-expander")||(window.TextExpanderElement=jt,window.customElements.define("text-expander",jt));function Wn({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 qn=Wn();function Kn(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(qn,"")}const Vn=new Intl.Segmenter;function Pt(s,{countAnsiEscapeCodes:e=!1}={}){if(s===""||(e||(s=Kn(s)),s===""))return 0;let n=0;for(const o of Vn.segment(s))n++;return n}const Gn="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",Ct=[["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","ⵜⴰⵎⴰⵣⵉⵖⵜ"]],Yn="(((?:[^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\\-_&=#\\/])?))",Zn="gi",Ot={source:Yn,flags:Zn};var Jn={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:vt,PHANPY_GIPHY_API_KEY:Xn}=Jn,Qn=Ct.reduce((s,e)=>{const[n,o,r]=e;return s[n]={common:o,native:r},s},{}),Jt={"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},ei=Object.values(Jt),Ht=24*60*60,Nt=s=>{if(!s)return Ht;const e=(new Date(s).getTime()-Date.now())/1e3;return ei.find(n=>n>=e)||Ht},ve=document.createElement("ul");ve.role="listbox";ve.className="text-expander-menu";const ti=16,ni=new IntersectionObserver(s=>{s.forEach(e=>{if(e.isIntersecting){const{left:n,width:o}=e.boundingClientRect,{innerWidth:r}=window;n+o>r&&(ve.style.left=r-o-ti+"px")}})});ni.observe(ve);const ye=bn([new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages],Ct.map(s=>s[0]),"en"),Xt=new RegExp(Ot.source,Ot.flags),ii=/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/gi,si="$2xxxxxxxxxxxxxxxxxxxxxxx";function ai(s){return s.replace(Xt,si).replace(ii,"$1@$3")}const oi=/[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i,ri=new RegExp(`(^|[^=\\/\\w])(@${oi.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,"uig"),li=new RegExp("(^|[^=\\/\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\/\\w])","ig"),ci="[a-zA-Z0-9_]{2,}",ui=new RegExp(`(^|[^=\\/\\w])(:${ci}:)(?=[^A-Za-z0-9_:]|$)`,"g"),di=new Intl.Segmenter;function hi(s,{maxCharacters:e=1/0}){let n=s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");const{composerCharacterCount:o}=re;if(o>e){let r="",p="";const u=di.segment(n);for(const{segment:v,index:g}of u)g<e?r+=v:p+=v;return p&&(p='<mark class="compose-highlight-exceeded">'+p+"</mark>"),r+p}return n.replace(Xt,'$2<mark class="compose-highlight-url">$3</mark>').replace(ri,'$1<mark class="compose-highlight-mention">$2</mark>').replace(li,'$1<mark class="compose-highlight-hashtag">$2</mark>').replace(ui,'$1<mark class="compose-highlight-emoji-shortcode">$2</mark>')}const pi=new Intl.RelativeTimeFormat,Et=100;function Ai({onClose:s,replyToStatus:e,editStatus:n,draftStatus:o,standalone:r,hasOpener:p}){var Mt;const{masto:u,instance:v}=Ft(),[g,R]=H("default"),C=W((o==null?void 0:o.uid)||dn()),k=An(),A=k.info,Z=Yt(),{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:le}={}}=Z||{},S=W(),X=W(),[V,U]=H("public"),[j,te]=H(!1),[O,ie]=H(ze.session.get("currentLanguage")||ye),ae=W(O),[M,z]=H([]),[$,L]=H(null),N=ze.account.get("preferences")||{},Q=()=>{S.current&&S.current.dispatchEvent(new Event("input"))},oe=()=>{setTimeout(()=>{var a,l,b;S.current&&((l=(a=o==null?void 0:o.status)==null?void 0:a.startsWith)!=null&&l.call(a,`
|
||
`)&&(S.current.selectionStart=0,S.current.selectionEnd=0),(b=S.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!==A.acct);x.length>0&&(S.current.value=`${x.map(w=>`@${w}`).join(" ")} `,Q()),oe(),U(l==="public"&&N["posting:default:visibility"]?N["posting:default:visibility"]:l),ie(b||N.postingDefaultLanguage||ye),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)||Nt(d.expiresAt)};R("loading"),(async()=>{try{const w=await u.v1.statuses.$select(n.id).source.fetch(),{text:F,spoilerText:P}=w;S.current.value=F,S.current.dataset.source=F,Q(),oe(),X.current.value=P,U(a),ie(l||presf.postingDefaultLanguage||ye),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"]&&U(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)||Nt(x.expiresAt)};S.current.value=a,Q(),oe(),l&&(X.current.value=l),b&&U(b),ie(d||N.postingDefaultLanguage||ye),_!==null&&te(_),F&&L(F),w&&z(w)}},[o,n,e]);const ue=W(),ge="You have unsaved changes. Discard this post?",be=()=>{const{value:a,dataset:l}=S.current;if(g==="loading")return!1;const b=(a||"").trim().replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$","gu"),""),d=M.length>0;if(!b&&!d||M.length>0&&M.every(P=>P.id))return!0;const x=(e==null?void 0:e.account.id)===A.id,w=e&&a.trim()===`@${e.account.acct}`;return!!(!x&&w||a===(l==null?void 0:l.source))},Ke=()=>be()?!0:confirm(ge);ee(()=>{const a=l=>{be()||(l.preventDefault(),l.returnValue=ge)};return window.addEventListener("beforeunload",a,{capture:!0}),()=>window.removeEventListener("beforeunload",a,{capture:!0})},[]);const tn=()=>{const{value:a}=S.current,{value:l}=X.current;return Pt(ai(a))+Pt(l)},lt=()=>{const a=tn();re.composerCharacterCount=a};ee(lt,[]);const Lt=window.CloseWatcher,ct=W(!1);je("esc",()=>{ct.current=!0},{enabled:!Lt,enableOnFormTags:!0}),je("esc",()=>{!r&&ct.current&&Ke()&&s(),ct.current=!1},{enabled:!Lt,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}}),yn(()=>{!r&&Ke()&&s()},[r,Ke,s]);const At=W({}),St=()=>`${Sn()}#${C.current}`,ut=()=>{if(n||re.composerState.minimized)return;const a=St(),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:S.current.value,spoilerText:X.current.value,visibility:V,language:O,sensitive:j,poll:$,mediaAttachments:M}};!hn(l,At.current)&&!be()&&(Tt.drafts.set(a,{...l,state:"unsaved",updatedAt:Date.now()}).then(()=>{}).catch(b=>{}),At.current=structuredClone(l))};xn(ut,5e3),ee(()=>(ut(),()=>{Tt.drafts.del(St())}),[]),ee(()=>{const a=b=>{const{items:d}=b.clipboardData||b.dataTransfer,_=[];for(let x=0;x<d.length;x++){const w=d[x];if(w.kind==="file"){const F=w.getAsFile();F&&J.includes(F.type)&&_.push(F)}}if(_.length>0&&M.length>=I){alert(`You can only attach up to ${I} files.`);return}if(_.length>0){b.preventDefault(),b.stopPropagation();const x=I-M.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([...M,...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)}},[M]);const[Ve,dt]=H(!1),[Ge,Ye]=H(!1),[nn,ht]=H(!1),[he,sn]=H(null),[an,on]=Pe(()=>{const a=[],l=[],{contentTranslationHideLanguages:b=[]}=re.settings;return Ct.forEach(d=>{const[_]=d;_===O||_===ae.current||_===ye||b.includes(_)||he!=null&&he.length&&he.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,he]),It=Pe(()=>!!(e!=null&&e.createdAt)&&Math.floor((Date.now()-new Date(e.createdAt))/(1e3*60*60*24*30)),[e]),rn=()=>{ut(),re.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:[(A==null?void 0:A.avatarStatic)&&t(Vt,{account:A,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:S.current.value,spoilerText:X.current.value,visibility:V,language:O,sensitive:j,poll:$,mediaAttachments:M}};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:()=>{wn({editStatus:n,replyToStatus:e,draftStatus:{uid:C.current,status:S.current.value,spoilerText:X.current.value,visibility:V,language:O,sensitive:j,poll:$,mediaAttachments:M}})&&s()},children:t(K,{icon:"popout",alt:"Pop out"})}),t("button",{type:"button",class:"plain4 min-button",onClick:rn,children:t(K,{icon:"minimize",alt:"Minimize"})})," ",t("button",{type:"button",class:"light close-button",disabled:g==="loading",onClick:()=>{Ke()&&s()},children:t(K,{icon:"x"})})]})]}),!!e&&t("div",{class:"status-preview",children:[t(_t,{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",It>=3&&t(Ce,{children:[" ","(",t("strong",{children:pi.format(-It,"month")}),")"]})]})]}),!!n&&t("div",{class:"status-preview",children:[t(_t,{status:n,size:"s",previewMode:!0}),t("div",{class:"status-preview-legend",children:"Editing source post"})]}),t("form",{ref:ue,class:`form-visibility-${V}`,style:{pointerEvents:g==="loading"?"none":"auto",opacity:g==="loading"?.5:1},onKeyDown:a=>{a.key==="Enter"&&(a.ctrlKey||a.metaKey)&&ue.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",$){if($.options.length<2){alert("Poll must have at least 2 options");return}if($.options.some(F=>F==="")){alert("Some poll choices are empty");return}}M.length>0&&M.some(P=>{var ne,_e;return!((_e=(ne=P.description)==null?void 0:ne.trim)!=null&&_e.call(ne))})&&!confirm("Some media have no descriptions. Continue?")||(w=x&&w||void 0,d=d===""?void 0:d,re.composerState.publishing=!0,R("loading"),(async()=>{try{if(M.length>0){const ne=M.map(pe=>{const{file:Ze,description:ln,id:cn}=pe;if(cn)return pe;{const un=qt({file:Ze,description:ln});return u.v2.media.create(un).then(pt=>(pt.id&&(pe.id=pt.id),pt))}}),_e=await Promise.allSettled(ne);if(_e.some(pe=>{var Ze;return pe.status==="rejected"||!((Ze=pe.value)!=null&&Ze.id)})){re.composerState.publishing=!1,re.composerState.publishingError=!0,R("error"),_e.forEach(pe=>{pe.status==="rejected"&&alert(pe.reason||`Attachment #${i} failed`)});return}}let F={status:d,spoiler_text:w,language:O,sensitive:x,poll:$,media_ids:M.map(ne=>ne.id)};n&&Gt("@mastodon/edit-media-attributes")?F.media_attributes=M.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=qt(F);let P;if(n)P=await u.v1.statuses.$select(n.id).update(F),In(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)}re.composerState.minimized=!1,re.composerState.publishing=!1,R("default"),s({type:n?"edit":e?"reply":"post",newStatus:P,instance:v})}catch(F){re.composerState.publishing=!1,re.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:()=>{lt()}}),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=S.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:kn[V],alt:V}),t("select",{name:"visibility",value:V,onChange:a=>{U(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(fi,{ref:S,placeholder:e?"Post your reply":n?"Edit your post":"What are you doing?",required:(M==null?void 0:M.length)===0,disabled:g==="loading",lang:O,onInput:()=>{lt()},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"?Ye({defaultSearchTerm:(a==null?void 0:a.defaultSearchTerm)||null}):(a==null?void 0:a.name)==="mention"?dt({defaultSearchTerm:(a==null?void 0:a.defaultSearchTerm)||null}):(a==null?void 0:a.name)==="auto-detect-language"&&(a!=null&&a.languages)&&sn(a.languages)}}),(M==null?void 0:M.length)>0&&t("div",{class:"media-attachments",children:[M.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(bi,{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"}`})]})]}),!!$&&t(yi,{lang:O,maxOptions:y,maxExpiration:q,minExpiration:le,maxCharactersPerOption:B,poll:$,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:M.length<I-1,disabled:g==="loading"||M.length>=I||!!$,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}));M.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:()=>{Ye(!0)},children:t(K,{icon:"emoji2"})}),!!re.settings.composerGIFPicker&&t("button",{type:"button",class:"toolbar-button gif-picker-button",disabled:g==="loading"||M.length>=I||!!$,onClick:()=>{ht(!0)},children:t("span",{children:"GIF"})})]}),t("div",{class:"spacer"}),g==="loading"?t(rt,{abrupt:!0}):t(vi,{maxCharacters:D,hidden:g==="loading"}),t("label",{class:`toolbar-button ${O!==ae.current||he!=null&&he.length&&!he.includes(O)?"highlight":""}`,children:[t("span",{class:"icon-text",children:(Mt=Qn[O])==null?void 0:Mt.native}),t("select",{name:"language",value:O,onChange:a=>{const{value:l}=a.target;ie(l||ye),ze.session.set("currentLanguage",l||ye)},disabled:g==="loading",children:[an.map(([a,l,b])=>t("option",{value:a,children:[l," (",b,")"]},a)),t("hr",{}),on.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"})]})]})]}),Ve&&t(Qe,{onClick:a=>{a.target===a.currentTarget&&dt(!1)},children:t(xi,{masto:u,instance:v,onClose:()=>{dt(!1)},defaultSearchTerm:Ve==null?void 0:Ve.defaultSearchTerm,onSelect:a=>{const l=S.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"))}})}),Ge&&t(Qe,{onClick:a=>{a.target===a.currentTarget&&Ye(!1)},children:t(wi,{masto:u,instance:v,onClose:()=>{Ye(!1)},defaultSearchTerm:Ge==null?void 0:Ge.defaultSearchTerm,onSelect:a=>{const l=S.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"))}})}),nn&&t(Qe,{onClick:a=>{a.target===a.currentTarget&&ht(!1)},children:t(Ei,{onClose:()=>ht(!1),onSelect:({url:a,type:l,alt_text:b})=>{if(M.length>=I){alert(`You can only attach up to ${I} files.`);return}(async()=>{var _,x;let d;try{d=xe({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=[...M,{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),xe("Failed to download GIF")}})()}})})]})}function Ut(s){if(!s)return;const{value:e,offsetHeight:n,scrollHeight:o,clientHeight:r}=s;if(n<window.innerHeight){const p=n-r,u=e?o+p+"px":null;s.style.height=u}}async function mi(s,e){const o=(await e.v1.customEmojis.list()).filter(p=>p.visibleInPicker),r=new pn(o,{keys:["shortcode"],findAllMatches:!0});return[o,r]}const Qt=Mn(mi,{matchesArg:(s,e)=>s.instance===e.instance,maxAge:30*60*1e3}),gi=s=>{const e=mn(s);return e!=null&&e.length?e.slice(0,2).map(n=>n.lang):null},fi=fn((s,e)=>{var J;const{masto:n,instance:o}=Ft(),[r,p]=H(((J=e.current)==null?void 0:J.value)||""),{maxCharacters:u,performSearch:v=()=>{},onTrigger:g=()=>{},...R}=s,C=W();ee(()=>{Qt(o,n).then(c=>{const[h,m]=c;C.current=m}).catch(c=>{})},[]);const k=W(),A=W("");ee(()=>{let c,h,m;return k.current&&(c=f=>{var le;const{key:E,provide:y,text:B}=f.detail;if(A.current=B,B===""){y(Promise.resolve({matched:!1}));return}if(E===":"){const S=(le=C.current)==null?void 0:le.search(B,{limit:5});let X="";S.forEach(({item:V})=>{const{shortcode:U,url:j}=V;X+=`
|
||
<li role="option" data-value="${fe(U)}">
|
||
<img src="${fe(j)}" width="16" height="16" alt="" loading="lazy" />
|
||
${fe(U)}
|
||
</li>`}),X+=`<li role="option" data-value="" data-more="${B}">More…</li>`,ve.innerHTML=X,y(Promise.resolve({matched:S.length>0,fragment:ve}));return}const q={"@":"accounts","#":"hashtags"}[E];y(new Promise(S=>{v({type:q,q:B,limit:5}).then(V=>{if(B!==A.current)return;const U=V[q]||V;let j="";U.forEach(te=>{var Q;const{name:O,avatarStatic:ie,displayName:ae,username:M,acct:z,emojis:$,history:L}=te,N=En(ae,$);if(z)j+=`
|
||
<li role="option" data-value="${fe(z)}">
|
||
<span class="avatar">
|
||
<img src="${fe(ie)}" width="16" height="16" alt="" loading="lazy" />
|
||
</span>
|
||
<span>
|
||
<b>${N||M}</b>
|
||
<br>@${fe(z)}
|
||
</span>
|
||
</li>
|
||
`;else{const oe=(Q=L==null?void 0:L.reduce)==null?void 0:Q.call(L,(ue,ge)=>ue+ +ge.uses,0);j+=`
|
||
<li role="option" data-value="${fe(O)}">
|
||
<span class="grow">#<b>${fe(O)}</b></span>
|
||
${oe?`<span class="count">${Fn(oe)}</span>`:""}
|
||
</li>
|
||
`}}),q==="accounts"&&(j+=`<li role="option" data-value="" data-more="${B}">More…</li>`),ve.innerHTML=j,S({matched:U.length>0,fragment:ve})})}))},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=W(0),D=W(),I=gn(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=hi(c,{maxCharacters:u})+`
|
||
`,Z.current<=3&&(m=Date.now()),h&&m&&m-h>50&&Z.current++},500),se=ot(()=>{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=gi(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,le,S,X,V]=B.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(V){c.preventDefault();const[U]=S.match(/\d+/)||[],j=U?`${+U+1}.`:"-",te=`
|
||
${le}${j}${X}`;m.setRangeText(te,E,E);const O=E+te.length;m.setSelectionRange(O,O)}else{const U=E-B.length;m.setRangeText("",U,E)}Ut(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),Ut(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 vi({maxCharacters:s=500,hidden:e}){const o=vn(re).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 Xe(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 Wt(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 bi({attachment:s,disabled:e,lang:n,onDescriptionChange:o=()=>{},onRemove:r=()=>{}}){const[p,u]=H("default"),v=Gt("@mastodon/edit-media-attributes"),{type:g,id:R,file:C}=s,k=Pe(()=>C?URL.createObjectURL(C):s.url,[C,s.url]),A=!!(C!=null&&C.size),Z=A?Yt():{},{mediaAttachments:{imageSizeLimit:D,imageMatrixLimit:I,videoSizeLimit:se,videoMatrixLimit:J,videoFrameRateLimit:c}={}}=Z||{},[h,m]=H(()=>A?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(()=>{!A||!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,A]);const[y,B]=H({});ee(()=>{!A||!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,A]);const[q,le]=H(s.description),[S,X]=g.split("/"),V=ot(o,250);ee(()=>{V(q)},[q,V]);const[U,j]=H(!1),te=W(null);ee(()=>{let z;return U&&te.current&&(z=setTimeout(()=>{te.current.focus()},100)),()=>{clearTimeout(z)}},[U]);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"}[S],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:e||p==="loading",class:p==="loading"?"loading":"",maxlength:"1500",onInput:z=>{const{value:$}=z.target;le($)}})}),ie=W(null);ee(()=>()=>{var z,$;($=(z=ie.current)==null?void 0:z.hideToast)==null||$.call(z)},[]);const ae=W(null),M=z=>{const{type:$,details:L}=z;switch($){case"imageSizeLimit":{const{imageSize:N,imageSizeLimit:Q}=L;return`File size too large. Uploading might encounter issues. Try reduce the file size from ${Xe(N)} to ${Xe(Q)} or lower.`}case"imageMatrixLimit":{const{imageMatrix:N,imageMatrixLimit:Q,width:oe,height:ue}=L,{newWidth:ge,newHeight:be}=Wt(N,Q,oe,ue);return`Dimension too large. Uploading might encounter issues. Try reduce dimension from ${oe.toLocaleString()}×${ue.toLocaleString()}px to ${ge.toLocaleString()}×${be.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 ${Xe(N)} to ${Xe(Q)} or lower.`}case"videoMatrixLimit":{const{videoMatrix:N,videoMatrixLimit:Q,width:oe,height:ue}=L,{newWidth:ge,newHeight:be}=Wt(N,Q,oe,ue);return`Dimension too large. Uploading might encounter issues. Try reduce dimension from ${oe.toLocaleString()}×${ue.toLocaleString()}px to ${ge.toLocaleString()}×${be.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:S==="image"?t("img",{src:k,alt:"",onLoad:z=>{if(!A)return;const{naturalWidth:$,naturalHeight:L}=z.target;E({matrix:$*L,width:$,height:L})}}):S==="video"||S==="gifv"?t("video",{src:k+"#t=0.1",playsinline:!0,muted:!0,disablePictureInPicture:!0,preload:"metadata",onLoadedMetadata:z=>{if(!A)return;const{videoWidth:$,videoHeight:L}=z.target;$&&L&&B({matrix:$*L,width:$,height:L})}}):S==="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:M(h),onClick:()=>{ae.current&&ae.current.hideToast(),ae.current=xe({text:M(h),duration:1e4})},children:t(K,{icon:"alert"})})]})]}),U&&t(Qe,{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"}[S]})}),t("main",{tabIndex:"-1",children:[t("div",{class:"media-preview",children:S==="image"?t("img",{src:k,alt:""}):S==="video"||S==="gifv"?t("video",{src:k,playsinline:!0,controls:!0}):S==="audio"?t("audio",{src:k,controls:!0}):null}),t("div",{class:"media-form",children:[O,t("footer",{children:[S==="image"&&/^(png|jpe?g|gif|webp)$/i.test(X)&&!!re.settings.mediaAltGenerator&&!!vt&&t(Cn,{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($t,{disabled:p==="loading",onClick:()=>{u("loading"),ie.current=xe({text:"Generating description. Please wait...",duration:-1}),async function(){var z,$;try{const L=new FormData;L.append("image",C);const N=await fetch(vt,{method:"POST",body:L}).then(Q=>Q.json());if(N.error)throw new Error(N.error);le(N.description)}catch(L){xe(`Failed to generate description${L!=null&&L.message?`: ${L.message}`:""}`)}finally{u("default"),($=(z=ie.current)==null?void 0:z.hideToast)==null||$.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($t,{disabled:p==="loading",onClick:()=>{u("loading"),ie.current=xe({text:"Generating description. Please wait...",duration:-1}),async function(){var z,$;try{const L=new FormData;L.append("image",C);const N=`?lang=${n}`,Q=await fetch(vt+N,{method:"POST",body:L}).then(oe=>oe.json());if(Q.error)throw new Error(Q.error);le(Q.description)}catch(L){xe(`Failed to generate description${L!=null&&L.message?`: ${L.message}`:""}`)}finally{u("default"),($=(z=ie.current)==null?void 0:z.hideToast)==null||$.call(z)}}()},children:[t(K,{icon:"sparkles2"}),t("small",{children:["Generate description…",t("br",{}),"(",zn(n),")"," ",t("span",{class:"more-insignificant",children:"— experimental"})]})]})]}),t("button",{type:"button",class:"light block",onClick:()=>{j(!1)},disabled:p==="loading",children:"Done"})]})]})]})]})})]})}function yi({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,A)=>t("div",{class:"poll-choice",children:[t("input",{required:!0,type:"text",value:k,disabled:n,maxlength:v,placeholder:`Choice ${A+1}`,lang:s,spellCheck:"true",dir:"auto",onInput:Z=>{const{value:D}=Z.target;g[A]=D,o(e)}}),t("button",{type:"button",class:"plain2 poll-button",disabled:n||g.length<=1,onClick:()=>{g.splice(A,1),o(e)},children:t(K,{icon:"x",size:"s"})})]},A))}),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:A}=k.target;e.multiple=A,o(e)}})," ","Multiple choices"]}),t("label",{class:"expires-in",children:["Duration"," ",t("select",{value:R,disabled:n,onChange:k=>{const{value:A}=k.target;e.expiresIn=A,o(e)},children:Object.entries(Jt).filter(([k,A])=>A>=u&&A<=p).map(([k,A])=>t("option",{value:A,children:k},A))})]})]}),t("div",{class:"poll-toolbar",children:t("button",{type:"button",class:"plain remove-poll-button",disabled:n,onClick:()=>{o(null)},children:"Remove poll"})})]})}function fe(s){return s.replace(/[&<>"']/g,function(e){return"&#"+e.charCodeAt(0)+";"})}function qt(s){for(let e in s)(s[e]===null||s[e]===void 0)&&delete s[e];return s}function xi({onClose:s=()=>{},onSelect:e=()=>{},defaultSearchTerm:n}){const{masto:o}=Ft(),[r,p]=H("default"),[u,v]=H([]),[g,R]=H({}),[C,k]=H(0),A=async c=>{if(!(c!=null&&c.length))return;const h=await Ln(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),A(h),p("default")}catch{p("error")}})())},D=ot(Z,1e3);ee(()=>{Z()},[Z]);const I=W();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()};je("enter",()=>{const c=u[C];c&&se(c)},{preventDefault:!0,enableOnFormTags:["input"]});const J=W();return je("down",()=>{C<u.length-1?k(C+1):k(0),setTimeout(()=>{const c=J.current.querySelector(".selected");c&&c.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),je("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(Vt,{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(rt,{abrupt:!0})}):r==="error"?t("div",{class:"ui-state",children:t("p",{children:"Error loading accounts"})}):null})]})}function wi({masto:s,instance:e,onClose:n=()=>{},onSelect:o=()=>{},defaultSearchTerm:r}){const[p,u]=H("default"),v=W([]),[g,R]=H([]),C=Pe(()=>ze.account.get("recentlyUsedCustomEmojis")||[]),k=W();ee(()=>{u("loading"),(async()=>{try{const[h,m]=await Qt(e,s);k.current=m,R(h),u("default")}catch{u("error")}})()},[]);const A=Pe(()=>{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=W(),[D,I]=H(null),se=Bt(h=>{var f,E,y;const{value:m}=h.target;if(m){const B=(f=k.current)==null?void 0:f.search(m,{limit:Et});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=Bt(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=W();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(rt,{}):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(en,{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(A).map(([h,m])=>!!(m!=null&&m.length)&&t(Ce,{children:[t("div",{class:"section-header",children:{"--recent--":"Recently used","--others--":"Others"}[h]||h}),t(ki,{emojis:m,onSelect:J})]}))]})})]})}const ki=Kt(({emojis:s,onSelect:e})=>{const[n,o]=H(Et),r=s.length>n;return t("section",{children:[s.slice(0,n).map(p=>t(en,{emoji:p,onClick:()=>{e(`:${p.shortcode}:`)}},p.shortcode)),r&&t("button",{type:"button",class:"plain small",onClick:()=>o(n+Et),children:[(s.length-n).toLocaleString()," more…"]})]})}),en=Kt(({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.left<v.left+88?(R.add("edge-left"),R.remove("edge-right")):g.right>v.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})]})]})}),bt=20;function Ei({onClose:s=()=>{},onSelect:e=()=>{}}){var A,Z,D,I,se,J;const[n,o]=H("default"),[r,p]=H([]),u=W(null),v=W(null),g=W(0),R=W(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:Xn,q:v.current.value,rating:"g",limit:bt,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=ot(()=>{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:Gn,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"&&!((A=r==null?void 0:r.data)!=null&&A.length)&&t("div",{class:"ui-state",children:t(rt,{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:le}=m,S=y!=null&&y.url?y:B!=null&&B.url?B:q;let{url:X,webp:V,width:U,height:j}=S;+j>100&&(U=U/j*100,j=100);const te=new URL(X),O=te.origin+te.pathname;let ie;if(V){const ae=new URL(V);ie=ae.origin+ae.pathname}return t("li",{children:t("button",{type:"button",onClick:()=>{const{mp4:ae,url:M}=le,z=ae||M,$=new URL(z),L=$.origin+$.pathname;s(),e({url:L,type:ae?"video/mp4":"image/gif",alt_text:E||f})},children:t("figure",{style:{"--figure-width":U+"px"},children:[t("picture",{children:[ie&&t("source",{srcset:ie,type:"image/webp"}),t("img",{src:O,width:U,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)-bt})},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)+bt})},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{Ai as default};
|
||
//# sourceMappingURL=compose-W5mt71Ut.js.map
|