26 lines
82 KiB
JavaScript
26 lines
82 KiB
JavaScript
import{G as on,s as se,$ as $t,u as ye,a as nt,d as D,A as $,R as rn,aP as Pt,n as Le,t as ln,y as X,F as cn,aQ as un,z as Ae,l as ze,e,T as j,S as dn,k as Te,E as Pe,b as hn,p as pn,a8 as mn,c as gn,q as wt,M as Kt}from"./useTitle-BuJm5pdu.js";import{q as we,K as fn,$ as vn,w as Se,ad as bn,D as kt,u as yn,ae as xn,af as wn,t as Ot,I as M,a as kn,F as Et,ag as En,m as Re,a8 as Fn,a7 as Cn,h as Ht,e as ve,l as et,g as je,s as Ee,a6 as An,ah as Ft,a2 as Ln,y as Sn,X as zn,Z as Ke,p as Be,B as Tn}from"./ScheduledAtField-DOwsX15z.js";class _n{constructor(t,n,{tabInsertsSuggestions:a,defaultFirstOption:r}={}){this.input=t,this.list=n,this.tabInsertsSuggestions=a??!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=>In(p,this),this.compositionEventHandler=p=>Bn(p,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",Ct),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",Ct)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(Ye)[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(Ye)[0],a=Array.from(this.list.querySelectorAll('[role="option"]')).filter(Ye),r=a.indexOf(n);if(r===a.length-1&&t===1||r===0&&t===-1){this.clearSelection(),this.input.focus();return}let p=t===1?0:a.length-1;if(n&&r>=0){const u=r+t;u>=0&&u<a.length&&(p=u)}const l=a[p];if(l)for(const u of a)u.removeAttribute("data-combobox-option-default"),l===u?(this.input.setAttribute("aria-activedescendant",l.id),l.setAttribute("aria-selected","true"),Dn(this.list,l)):u.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 In(s,t){if(!(s.shiftKey||s.metaKey||s.altKey)&&!(!t.ctrlBindings&&s.ctrlKey)&&!t.isComposing)switch(s.key){case"Enter":At(t.input,t.list)&&s.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&At(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 Ct(s){if(!(s.target instanceof Element))return;const t=s.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&Mn(t)}function At(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 Mn(s){s.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}function Ye(s){return!s.hidden&&!(s instanceof HTMLInputElement&&s.type==="hidden")&&(s.offsetWidth>0||s.offsetHeight>0)}function Bn(s,t){t.isComposing=s.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function Dn(s,t){Rn(s,t)||(s.scrollTop=t.offsetTop)}function Rn(s,t){const n=s.scrollTop,a=n+s.clientHeight,r=t.offsetTop,p=r+t.clientHeight;return r>=n&&p<=a}const jn=/\s|\(|\[/;function $n(s,t,n,{multiWord:a,lookBackIndex:r,lastMatchPosition:p}={multiWord:!1,lookBackIndex:0,lastMatchPosition:null}){let l=s.lastIndexOf(t,n-1);if(l===-1||l<r)return;if(a){if(p!=null){if(p===l)return;l=p-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 u=s[l-1];return u&&!jn.test(u)?void 0:{text:s.substring(l+t.length,n),position:l+t.length}}class Pn extends Event{constructor(){super("update")}}const Ze=new WeakMap;class it extends EventTarget{#t=new MutationObserver(()=>this.#h());#s=new ResizeObserver(()=>this.#d());#a;#n=document.createElement("div");#e=document.createElement("div");static for(t){let n=Ze.get(t);return n||(n=new it(t),Ze.set(t,n)),n}constructor(t){super(),this.#a=new WeakRef(t),this.#n.style.position="absolute",this.#n.style.pointerEvents="none",this.#n.setAttribute("aria-hidden","true"),this.#n.appendChild(this.#e),this.#e.style.pointerEvents="none",this.#e.style.userSelect="none",this.#e.style.overflow="hidden",this.#e.style.display="block",this.#e.style.visibility="hidden",t instanceof HTMLTextAreaElement?(this.#e.style.whiteSpace="pre-wrap",this.#e.style.wordWrap="break-word"):(this.#e.style.whiteSpace="nowrap",this.#e.style.display="table-cell",this.#e.style.verticalAlign="middle"),t.after(this.#n),this.#h(),this.#p(),this.#t.observe(t,{attributeFilter:["style","dir"]}),this.#s.observe(t),document.addEventListener("scroll",this.#r,{capture:!0}),window.addEventListener("resize",this.#r,{capture:!0}),t.addEventListener("input",this.#g,{capture:!0})}get element(){return this.#e}forceUpdate(){this.#h(),this.#p()}disconnect(){this.#n?.remove(),this.#t.disconnect(),this.#s.disconnect(),document.removeEventListener("scroll",this.#r,{capture:!0}),window.removeEventListener("resize",this.#r,{capture:!0});const t=this.#o;t&&(t.removeEventListener("input",this.#g,{capture:!0}),Ze.delete(t))}get#o(){return this.#a?.deref()}#i(t){const n=this.#o;return n?t(n):this.disconnect()}#l=0;#c=0;#m(){this.#i(t=>{const n=window.getComputedStyle(t);this.#e.style.height=n.height,this.#e.style.width=n.width,t.clientHeight!==this.#e.clientHeight&&(this.#e.style.height=`calc(${n.height} + ${t.clientHeight-this.#e.clientHeight}px)`),t.clientWidth!==this.#e.clientWidth&&(this.#e.style.width=`calc(${n.width} + ${t.clientWidth-this.#e.clientWidth}px)`);const a=t.getBoundingClientRect(),r=this.#e.getBoundingClientRect();this.#l=this.#l+a.left-r.left,this.#c=this.#c+a.top-r.top,this.#e.style.transform=`translate(${this.#l}px, ${this.#c}px)`,this.#e.scrollTop=t.scrollTop,this.#e.scrollLeft=t.scrollLeft,this.dispatchEvent(new Pn)})}#u=!1;#d(){this.#u||(this.#u=!0,requestAnimationFrame(()=>{this.#m(),this.#u=!1}))}#h(){this.#i(t=>{const n=window.getComputedStyle(t);for(const a of Kn)this.#e.style[a]=n[a];this.#d()})}#p(){this.#i(t=>{this.#e.textContent=t.value,this.#m()})}#g=()=>this.#p();#r=t=>{this.#i(n=>{(t.target===document||t.target===window||t.target instanceof Node&&t.target.contains(n))&&this.#d()})}}const Kn=["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"];class $e{#t;#s;#a;constructor(t,n=0,a=n){this.#t=t,this.#s=n,this.#a=a}static fromSelection(t){const{selectionStart:n,selectionEnd:a}=t;return new $e(t,n??void 0,a??void 0)}get collapsed(){return this.startOffset===this.endOffset}get commonAncestorContainer(){return this.#t}get endContainer(){return this.#t}get startContainer(){return this.#t}get startOffset(){return this.#s}get endOffset(){return this.#a}setStartOffset(t){this.#s=this.#o(t)}setEndOffset(t){this.#a=this.#o(t)}collapse(t=!1){t?this.setEndOffset(this.startOffset):this.setStartOffset(this.endOffset)}cloneContents(){return this.#i().cloneContents()}cloneRange(){return new $e(this.#t,this.startOffset,this.endOffset)}getBoundingClientRect(){return this.#i().getBoundingClientRect()}getClientRects(){return this.#i().getClientRects()}toString(){return this.#i().toString()}getStyleClone(){return this.#n}get#n(){return it.for(this.#t)}get#e(){return this.#n}#o(t){return Math.max(0,Math.min(t,this.#t.value.length))}#i(){const t=document.createRange(),n=this.#e.element.childNodes[0];return n&&(t.setStart(n,this.startOffset),t.setEnd(n,this.endOffset)),t}}const De=new WeakMap;class On{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,r;this.input!==document.activeElement&&this.input!==((r=(a=document.activeElement)===null||a===void 0?void 0:a.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,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 $e(this.input,n).getBoundingClientRect(),r={left:a.left,top:a.top+a.height},p=t.getBoundingClientRect(),l={left:r.left-p.left,top:r.top-p.top};if(l.left!==0||l.top!==0){const u=getComputedStyle(t);t.style.left=u.left?`calc(${u.left} + ${l.left}px)`:`${l.left}px`,t.style.top=u.top?`calc(${u.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 r=this.match;if(!r)return;const p=this.input.value.substring(0,r.position-r.key.length),l=this.input.value.substring(r.position+r.text.length),u={item:a,key:r.key,value:null,continue:!1};if(!this.expander.dispatchEvent(new CustomEvent("text-expander-value",{cancelable:!0,detail:u}))||!u.value)return;let b=(n=this.expander.getAttribute("suffix"))!==null&&n!==void 0?n:" ";u.continue&&(b="");const Q=`${u.value}${b}`;this.input.value=p+Q+l;const A=p.length+Q.length;this.deactivate(),this.input.focus({preventScroll:!0}),this.input.selectionStart=A,this.input.selectionEnd=A,u.continue||(this.lookBackIndex=A,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:r}of this.expander.keys){const p=$n(n,a,t,{multiWord:r,lookBackIndex:this.lookBackIndex,lastMatchPosition:this.match?this.match.position:null});if(p)return{text:p.text,key:a,position:p.position}}}async notifyProviders(t){const n=[],a=g=>n.push(g),r=new CustomEvent("text-expander-change",{cancelable:!0,detail:{provide:a,text:t.text,key:t.key}});return this.expander.dispatchEvent(r)?(await Promise.all(n)).filter(g=>g.matched).map(g=>g.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 Lt extends HTMLElement{get keys(){const t=this.getAttribute("keys"),n=t?t.split(" "):[],a=this.getAttribute("multiword"),r=a?a.split(" "):[],p=r.length===0&&this.hasAttribute("multiword");return n.map(l=>({key:l,multiWord:p||r.includes(l)}))}set keys(t){this.setAttribute("keys",t)}connectedCallback(){const t=this.querySelector('input[type="text"], textarea');if(!(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement))return;const n=new On(this,t);De.set(this,n)}disconnectedCallback(){const t=De.get(this);t&&(t.destroy(),De.delete(this))}dismiss(){const t=De.get(this);t&&t.dismissMenu()}}window.customElements.get("text-expander")||(window.TextExpanderElement=Lt,window.customElements.define("text-expander",Lt));function Hn({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 Nn=Hn();function qn(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(Nn,"")}const Wn=new Intl.Segmenter;function St(s,{countAnsiEscapeCodes:t=!1}={}){if(s===""||(t||(s=qn(s)),s===""))return 0;let n=0;for(const a of Wn.segment(s))n++;return n}const Un="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",st=[["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","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"],["gsw","Swiss German","Schwiizertütsch"],["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","ⵜⴰⵎⴰⵣⵉⵖⵜ"]],Vn="(((?:[^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\\-_&=#\\/])?))",Gn="gi",zt={source:Vn,flags:Gn},Yn={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_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:Xe,PHANPY_GIPHY_API_KEY:Zn}=Yn,Xn=st.reduce((s,t)=>{const[n,a,r]=t;return s[n]={common:a,native:r},s},{}),Nt={300:we(5,"minute"),1800:we(30,"minute"),3600:we(1,"hour"),21600:we(6,"hour"),86400:we(1,"day"),259200:we(3,"day"),604800:we(1,"week")},Jn=Object.keys(Nt),Tt=24*60*60,_t=s=>{if(!s)return Tt;const t=(new Date(s).getTime()-Date.now())/1e3;return Jn.find(n=>n>=t)||Tt},be=document.createElement("ul");be.role="listbox";be.className="text-expander-menu";const Qn=16,ei=new IntersectionObserver(s=>{s.forEach(t=>{if(t.isIntersecting){const{left:n,width:a}=t.boundingClientRect,{innerWidth:r}=window;if(n+a>r){const p=fn()?"right":"left";be.style[p]=r-a-Qn+"px"}}})});ei.observe(be);const ke=on([new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages],st.map(s=>s[0]),"en"),qt=new RegExp(zt.source,zt.flags),ti=/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/gi,ni="$2xxxxxxxxxxxxxxxxxxxxxxx";function ii(s){return s.replace(qt,ni).replace(ti,"$1@$3")}const si=/[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i,ai=new RegExp(`(^|[^=\\/\\w])(@${si.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,"uig"),oi=new RegExp("(^|[^=\\/\\w])(#[\\p{L}\\p{N}_]+([\\p{L}\\p{N}_.]+[\\p{L}\\p{N}_]+)?)(?![\\/\\w])","iug"),ri="[a-zA-Z0-9_]{2,}",li=new RegExp(`(^|[^=\\/\\w])(:${ri}:)(?=[^A-Za-z0-9_:]|$)`,"g"),ci=new Intl.Segmenter;function Je(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ui(s,{maxCharacters:t=1/0}){const{composerCharacterCount:n}=se;if(n>t){let a="",r="";const p=ci.segment(s);for(const{segment:l,index:u}of p)u<t?a+=l:r+=l;return r&&(r='<mark class="compose-highlight-exceeded">'+Je(r)+"</mark>"),Je(a)+r}return Je(s).replace(qt,'$2<mark class="compose-highlight-url">$3</mark>').replace(ai,'$1<mark class="compose-highlight-mention">$2</mark>').replace(oi,'$1<mark class="compose-highlight-hashtag">$2</mark>').replace(li,'$1<mark class="compose-highlight-emoji-shortcode">$2</mark>')}const di=$t(s=>new Intl.RelativeTimeFormat(s||void 0)),hi=$t(s=>new Intl.ListFormat(s||void 0)),tt=100,de={camera:{id:"TbrCz2"},media:{id:"MfJ43d"},customEmoji:{id:"ggiJLM"},gif:{id:"Fm6c4W"},poll:{id:"cZJ92q"},scheduledPost:{id:"sX3iLV"}};function Ci({onClose:s,replyToStatus:t,editStatus:n,draftStatus:a,standalone:r,hasOpener:p}){const{i18n:l,_:u,_:g}=ye(),b=di(l.locale),Q=hi(l.locale),{masto:A,instance:y}=nt(),[f,S]=D("default"),z=$(a?.uid||vn()),T=rn(),H=T.info,V=Pt(),{statuses:{maxCharacters:c,maxMediaAttachments:d,charactersReservedPerUrl:m}={},mediaAttachments:{supportedMimeTypes:_,imageSizeLimit:G,imageMatrixLimit:R,videoSizeLimit:ae,videoMatrixLimit:P,videoFrameRateLimit:q,descriptionLimit:Y}={},polls:{maxOptions:ie,maxCharactersPerOption:K,maxExpiration:J,minExpiration:ee}={}}=V||{},te=_?.filter(o=>/^(image|video)/i.test(o)),I=$(),W=$(),[oe,le]=D("public"),[ne,ce]=D(!1),[E,O]=D(Le.session.get("currentLanguage")||ke),U=$(E),[k,Z]=D([]),[N,he]=D(null),[ue,ge]=D(null),pe=ln(),Oe=()=>{I.current&&I.current.dispatchEvent(new Event("input"))},_e=()=>{setTimeout(()=>{I.current&&(/^\n|\s/.test(a?.status)&&(I.current.selectionStart=0,I.current.selectionEnd=0),I.current?.focus())},300)};X(()=>{if(t){const{spoilerText:o,visibility:h,language:F,sensitive:v}=t;o&&W.current&&(W.current.value=o);const x=[...new Set([t.account.acct,...t.mentions.map(w=>w.acct)])].filter(w=>w!==H.acct);x.length>0&&(I.current.value=`${x.map(w=>`@${w}`).join(" ")} `,Oe()),_e(),le(h==="public"&&pe["posting:default:visibility"]?pe["posting:default:visibility"].toLowerCase():h),O(F||pe["posting:default:language"]?.toLowerCase()||ke),ce(v&&!!o)}else if(n){const{visibility:o,language:h,sensitive:F,poll:v,mediaAttachments:L}=n,x=!!v?.options&&{...v,options:v.options.map(w=>w?.title||w),expiresIn:v?.expiresIn||_t(v.expiresAt)};S("loading"),(async()=>{try{const w=await A.v1.statuses.$select(n.id).source.fetch(),{text:B,spoilerText:C}=w;I.current.value=B,I.current.dataset.source=B,Oe(),_e(),W.current.value=C,le(o),O(h||pe["posting:default:language"]?.toLowerCase()||ke),ce(F),x&&he(x),Z(L),S("default")}catch(w){alert(w?.reason||w),S("error")}})()}else _e(),pe["posting:default:visibility"]&&le(pe["posting:default:visibility"].toLowerCase()),pe["posting:default:language"]&&O(pe["posting:default:language"].toLowerCase()),pe["posting:default:sensitive"]&&ce(!!pe["posting:default:sensitive"]);if(a){const{status:o,spoilerText:h,visibility:F,language:v,sensitive:L,poll:x,mediaAttachments:w,scheduledAt:B}=a,C=!!x?.options&&{...x,options:x.options.map(re=>re?.title||re),expiresIn:x?.expiresIn||_t(x.expiresAt)};I.current.value=o,Oe(),_e(),h&&(W.current.value=h),F&&le(F),O(v||pe["posting:default:language"]?.toLowerCase()||ke),L!==null&&ce(L),C&&he(C),w&&Z(w),B&&ge(B)}},[a,n,t]);const at=$(),ot=g({id:"hR9gtK"}),He=()=>{const{value:o,dataset:h}=I.current;if(f==="loading")return!1;const F=(o||"").trim().replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$","gu"),""),v=k.length>0;if(!F&&!v||k.length>0&&k.every(C=>C.id))return!0;const x=t?.account.id===H.id,w=t&&o.trim()===`@${t.account.acct}`;return!!(!x&&w||o===h?.source)},Ne=()=>He()?!0:confirm(ot);X(()=>{const o=h=>{He()||(h.preventDefault(),h.returnValue=ot)};return window.addEventListener("beforeunload",o,{capture:!0}),()=>window.removeEventListener("beforeunload",o,{capture:!0})},[]);const Vt=()=>{const{value:o}=I.current,{value:h}=W.current;return St(ii(o))+St(h)},qe=()=>{const o=Vt();se.composerCharacterCount=o};X(qe,[]);const rt=window.CloseWatcher,We=$(!1);Se("esc",()=>{We.current=!0},{enabled:!rt,enableOnFormTags:!0,useKey:!0,ignoreEventWhen:o=>o.metaKey||o.ctrlKey||o.altKey||o.shiftKey}),Se("esc",()=>{!r&&We.current&&Ne()&&s(),We.current=!1},{enabled:!rt,enableOnFormTags:!0,keyup:!0,ignoreEventWhen:o=>{const h=document.querySelectorAll("#modal-container > *"),F=!!h,v=h.length===1&&h[0].querySelector("#compose-container");return F&&!v||o.metaKey||o.ctrlKey||o.altKey||o.shiftKey},useKey:!0}),bn(()=>{!r&&Ne()&&s()},[]);const lt=$({}),ct=()=>`${cn()}#${z.current}`,Ue=()=>{if(n||se.composerState.minimized)return;const o=ct(),h={key:o,replyTo:t?{id:t.id,account:{id:t.account.id,username:t.account.username,acct:t.account.acct}}:null,draftStatus:{uid:z.current,status:I.current.value,spoilerText:W.current.value,visibility:oe,language:E,sensitive:ne,poll:N,mediaAttachments:k,scheduledAt:ue}};!un(h,lt.current)&&!He()&&(kt.drafts.set(o,{...h,state:"unsaved",updatedAt:Date.now()}).then(()=>{}).catch(F=>{}),lt.current=structuredClone(h))};yn(Ue,5e3),X(()=>(Ue(),()=>{kt.drafts.del(ct())}),[]),X(()=>{const o=F=>{const{items:v}=F.clipboardData||F.dataTransfer,L=[],x=[];for(let w=0;w<v.length;w++){const B=v[w];if(B.kind==="file"){const C=B.getAsFile();_!==void 0&&!_.includes(C.type)?x.push(C):L.push(C)}}if(x.length>0&&alert(Ae._({id:"rpXAF6",values:{0:x.length,1:x[0].name,2:Q.format(x.map(w=>w.name))}})),L.length>0&&k.length>=d){alert(Ae._({id:"ctFhjs",values:{maxMediaAttachments:d}}));return}if(L.length>0){F.preventDefault(),F.stopPropagation();let w=L;if(d!==void 0){const C=d-k.length;if(w=w.slice(0,C),w.length<=0){alert(Ae._({id:"ctFhjs",values:{maxMediaAttachments:d}}));return}}const B=w.map(C=>({file:C,type:C.type,size:C.size,url:URL.createObjectURL(C),id:null,description:null}));Z([...k,...B])}};window.addEventListener("paste",o);const h=F=>{F.dataTransfer.items.length>0&&(F.preventDefault(),F.stopPropagation())};return window.addEventListener("dragover",h),window.addEventListener("drop",o),()=>{window.removeEventListener("paste",o),window.removeEventListener("dragover",h),window.removeEventListener("drop",o)}},[k]);const[ut,Ve]=D(!1),[dt,Fe]=D(!1),[Gt,Ie]=D(!1),[Ce,Yt]=D(null),[Zt,Xt]=ze(()=>{const o=[],h=[],{contentTranslationHideLanguages:F=[]}=se.settings;return st.forEach(v=>{const[L]=v;L===E||L===U.current||L===ke||F.includes(L)||Ce?.length&&Ce.includes(L)?o.push(v):h.push(v)}),o.sort(([v,L],[x,w])=>v===E?-1:x===E?1:L.localeCompare(w)),h.sort(([v,L],[x,w])=>L.localeCompare(w)),[o,h]},[E,Ce]),ht=ze(()=>!!t?.createdAt&&Math.floor((Date.now()-new Date(t.createdAt))/(1e3*60*60*24*30)),[t]),Jt=()=>{Ue(),se.composerState.minimized=!0},pt=f==="loading"||d!==void 0&&k.length>=d||!!N,mt=ie==null||ie>1,gt=f==="loading"||!!N||!!k.length,ft=()=>{he({options:["",""],expiresIn:24*60*60,multiple:!1})},Me=$(),[Qt,en]=D(!1);xn({ref:Me,box:"border-box",onResize:({width:o})=>{const{scrollWidth:h}=Me.current,F=h>o,v=o<84;en(v||F),Me.current.hidden=v}});const vt=!n,bt=f==="loading"||!!ue,yt=()=>{const o=new Date(Date.now()+wn);ge(o)};return e("div",{id:"compose-container-outer",children:[e("div",{id:"compose-container",class:r?"standalone":"",children:[e("div",{class:"compose-top",children:[H?.avatarStatic&&e(Ot,{account:H,accountInstance:T.instanceURL,hideDisplayName:!0,useAvatarStatic:!0}),r?p&&e("button",{type:"button",class:"light pop-button",disabled:f==="loading",onClick:()=>{if(!window.opener){alert(g({id:"qiPXgY"}));return}if(window.opener.__STATES__.showCompose){if(window.opener.__STATES__.composerState?.publishing){alert(g({id:"Z2l5Bt"}));return}let o=g({id:"AB/GtR"});if(!confirm(o))return}s({fn:()=>{const o={editStatus:n,replyToStatus:t,draftStatus:{uid:z.current,status:I.current.value,spoilerText:W.current.value,visibility:oe,language:E,sensitive:ne,poll:N,mediaAttachments:k,scheduledAt:ue}};window.opener.__COMPOSE__=o,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(M,{icon:"popin",alt:g({id:"/5ZKeE"})})}):e("span",{class:"compose-controls",children:[e("button",{type:"button",class:"plain4 pop-button",disabled:f==="loading",onClick:()=>{kn({editStatus:n,replyToStatus:t,draftStatus:{uid:z.current,status:I.current.value,spoilerText:W.current.value,visibility:oe,language:E,sensitive:ne,poll:N,mediaAttachments:k,scheduledAt:ue}})&&s()},children:e(M,{icon:"popout",alt:g({id:"JsU2En"})})}),e("button",{type:"button",class:"plain4 min-button",onClick:Jt,children:e(M,{icon:"minimize",alt:g({id:"3TSz9S"})})})," ",e("button",{type:"button",class:"light close-button",disabled:f==="loading",onClick:()=>{Ne()&&s()},children:e(M,{icon:"x",alt:g({id:"yz7wBu"})})})]})]}),!!t&&e("div",{class:"status-preview",children:[e(Et,{status:t,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend reply-to",children:ht>0?e(j,{id:"Q1Huya",values:{0:t.account.acct||t.account.username,1:b.format(-ht,"month")},components:{0:e("strong",{})}}):e(j,{id:"dwLCPZ",values:{0:t.account.acct||t.account.username}})})]}),!!n&&e("div",{class:"status-preview",children:[e(Et,{status:n,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend",children:e(j,{id:"wKtOLH"})})]}),e("form",{ref:at,class:`form-visibility-${oe}`,style:{pointerEvents:f==="loading"?"none":"auto",opacity:f==="loading"?.5:1},onKeyDown:o=>{o.key==="Enter"&&(o.ctrlKey||o.metaKey)&&at.current.dispatchEvent(new Event("submit",{cancelable:!0}))},onSubmit:o=>{o.preventDefault();const h=new FormData(o.target),F=Object.fromEntries(h.entries());let{status:v,visibility:L,sensitive:x,spoilerText:w,scheduledAt:B}=F;if(x=x==="on",B=B?new Date(B).toISOString():void 0,N){if(N.options.length<2){alert(g({id:"zhrMYj"}));return}if(N.options.some(C=>C==="")){alert(g({id:"uNVxXX"}));return}}k.length>0&&k.some(re=>!re.description?.trim?.())&&!confirm(g({id:"MQYucx"}))||(w=x&&w||void 0,v=v===""?void 0:v,se.composerState.publishing=!0,S("loading"),(async()=>{try{if(k.length>0){const xe=k.map(me=>{const{file:tn,description:nn,id:sn}=me;if(sn)return me;{const an=jt({file:tn,description:nn});return A.v2.media.create(an).then(Ge=>(Ge.id&&(me.id=Ge.id),Ge))}}),xt=await Promise.allSettled(xe);if(xt.some(me=>me.status==="rejected"||!me.value?.id)){se.composerState.publishing=!1,se.composerState.publishingError=!0,S("error"),xt.forEach(me=>{me.status==="rejected"&&alert(me.reason||g({id:"eIiurD",values:{i}}))});return}}let C={status:v,spoiler_text:w,language:E,sensitive:x,poll:N,media_ids:k.map(xe=>xe.id)};n&&Re("@mastodon/edit-media-attributes")?C.media_attributes=k.map(xe=>({id:xe.id,description:xe.description})):n||(C.visibility=L,C.in_reply_to_id=t?.id||void 0,C.scheduled_at=B),C=jt(C);let re;if(n)re=await A.v1.statuses.$select(n.id).update(C),hn(re,y,{skipThreading:!0});else try{re=await A.v1.statuses.create(C,{requestInit:{headers:{"Idempotency-Key":z.current}}})}catch{re=await A.v1.statuses.create(C)}se.composerState.minimized=!1,se.composerState.publishing=!1,S("default"),s({type:n?"edit":t?"reply":"post",newStatus:re,instance:y,scheduledAt:B})}catch(C){se.composerState.publishing=!1,se.composerState.publishingError=!0,alert(C?.reason||C),S("error")}})())},children:[e("div",{class:"toolbar stretch",children:[e("input",{ref:W,type:"text",name:"spoilerText",placeholder:g({id:"gnKo7f"}),disabled:f==="loading",class:"spoiler-text-field",lang:E,spellCheck:"true",dir:"auto",style:{opacity:ne?1:0,pointerEvents:ne?"auto":"none"},onInput:()=>{qe()}}),e("label",{class:`toolbar-button ${ne?"highlight":""}`,title:g({id:"zKu2Aq"}),children:[e("input",{name:"sensitive",type:"checkbox",checked:ne,disabled:f==="loading",onChange:o=>{const h=o.target.checked;ce(h),h?W.current?.focus():I.current?.focus()}}),e(M,{icon:`eye-${ne?"close":"open"}`})]})," ",e("label",{class:`toolbar-button ${oe!=="public"&&!ne?"show-field":""} ${oe!=="public"?"highlight":""}`,title:oe,children:[e(M,{icon:En[oe],alt:oe}),e("select",{name:"visibility",value:oe,onChange:o=>{le(o.target.value)},disabled:f==="loading"||!!n,dir:"auto",children:[e("option",{value:"public",children:e(j,{id:"7d1a0d"})}),(Re("@pleroma/local-visibility-post")||Re("@akkoma/local-visibility-post"))&&e("option",{value:"local",children:e(j,{id:"d5zxa4"})}),e("option",{value:"unlisted",children:e(j,{id:"WDcQq9"})}),e("option",{value:"private",children:e(j,{id:"o34OrG"})}),e("option",{value:"direct",children:e(j,{id:"IV4QaU"})})]})]})," "]}),e(gi,{ref:I,placeholder:g(t?{id:"Sjj+EN"}:n?{id:"qzVesX"}:{id:"owpNF1"}),required:k?.length===0,disabled:f==="loading",lang:E,onInput:()=>{qe()},maxCharacters:c,performSearch:o=>{const{type:h,q:F,limit:v}=o;return h==="accounts"?A.v1.accounts.search.list({q:F,limit:v,resolve:!1}):A.v2.search.list(o)},onTrigger:o=>{o?.name==="custom-emojis"?Fe({defaultSearchTerm:o?.defaultSearchTerm||null}):o?.name==="mention"?Ve({defaultSearchTerm:o?.defaultSearchTerm||null}):o?.name==="auto-detect-language"&&o?.languages&&Yt(o.languages)}}),k?.length>0&&e("div",{class:"media-attachments",children:[k.map((o,h)=>{const{id:F,file:v}=o,L=v?.size+v?.type+v?.name;return e(vi,{attachment:o,disabled:f==="loading",lang:E,descriptionLimit:Y,onDescriptionChange:x=>{Z(w=>{const B=[...w];return B[h]={...B[h],description:x},B})},onRemove:()=>{Z(x=>x.filter((w,B)=>B!==h))}},F||L||h)}),e("label",{class:"media-sensitive",children:[e("input",{name:"sensitive",type:"checkbox",checked:ne,disabled:f==="loading",onChange:o=>{const h=o.target.checked;ce(h)}})," ",e("span",{children:e(j,{id:"jER18a"})})," ",e(M,{icon:`eye-${ne?"close":"open"}`})]})]}),!!N&&e(bi,{lang:E,maxOptions:ie,maxExpiration:J,minExpiration:ee,maxCharactersPerOption:K,poll:N,disabled:f==="loading",onInput:o=>{if(o){const h={...o};he(h)}else he(null)}}),ue&&e("div",{class:"toolbar scheduled-at",children:[e("button",{type:"button",class:"plain4 small",onClick:()=>{ge(null)},children:e(M,{icon:"x"})}),e("label",{children:[e(j,{id:"GKuKcZ",components:{0:e(Fn,{scheduledAt:ue,setScheduledAt:ge})}}),e("br",{}),e("small",{children:Cn()})]})]}),e("div",{class:"toolbar compose-footer",children:[e("span",{class:"add-toolbar-button-group spacer",children:[Qt&&e(Ht,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},menuButton:({open:o})=>e("button",{type:"button",class:`toolbar-button add-button ${o?"active":""}`,children:e(M,{icon:"plus",title:g({id:"m16xKo"})})}),children:[It&&e(ve,{className:"compose-menu-add-media",children:[e("label",{class:"compose-menu-add-media-field",children:e(Mt,{hidden:!0,supportedMimeTypes:te,disabled:f==="loading"||k.length>=d||!!N,setMediaAttachments:Z})}),e(M,{icon:"camera"})," ",e("span",{children:u(de.camera)})]}),e(ve,{className:"compose-menu-add-media",children:[e("label",{class:"compose-menu-add-media-field",children:e(Bt,{hidden:!0,supportedMimeTypes:_,maxMediaAttachments:d,mediaAttachments:k,disabled:f==="loading"||k.length>=d||!!N,setMediaAttachments:Z})}),e(M,{icon:"media"})," ",e("span",{children:u(de.media)})]}),e(ve,{onClick:()=>{Fe(!0)},children:[e(M,{icon:"emoji2"})," ",e("span",{children:u(de.customEmoji)})]}),!!se.settings.composerGIFPicker&&e(ve,{disabled:pt,onClick:()=>{Ie(!0)},children:[e("span",{class:"icon icon-gif",role:"img"}),e("span",{children:u(de.gif)})]}),mt&&e(ve,{disabled:gt,onClick:ft,children:[e(M,{icon:"poll"})," ",e("span",{children:u(de.poll)})]}),vt&&e(ve,{disabled:bt,onClick:yt,children:[e(M,{icon:"schedule"})," ",e("span",{children:u(de.scheduledPost)})]})]}),e("span",{class:"add-sub-toolbar-button-group",ref:Me,children:[It&&e("label",{class:"toolbar-button",children:[e(Mt,{supportedMimeTypes:te,mediaAttachments:k,disabled:f==="loading"||k.length>=d||!!N,setMediaAttachments:Z}),e(M,{icon:"camera",alt:u(de.camera)})]}),e("label",{class:"toolbar-button",children:[e(Bt,{supportedMimeTypes:_,maxMediaAttachments:d,mediaAttachments:k,disabled:f==="loading"||k.length>=d||!!N,setMediaAttachments:Z}),e(M,{icon:"media",alt:u(de.media)})]}),e("button",{type:"button",class:"toolbar-button",disabled:f==="loading",onClick:()=>{Fe(!0)},children:e(M,{icon:"emoji2",alt:u(de.customEmoji)})}),!!se.settings.composerGIFPicker&&e("button",{type:"button",class:"toolbar-button gif-picker-button",disabled:pt,onClick:()=>{Ie(!0)},children:e("span",{class:"icon icon-gif","aria-label":u(de.gif)})}),mt&&e(Te,{children:e("button",{type:"button",class:"toolbar-button",disabled:gt,onClick:ft,children:e(M,{icon:"poll",alt:u(de.poll)})})}),vt&&e("button",{type:"button",class:`toolbar-button ${ue?"highlight":""}`,disabled:bt,onClick:yt,children:e(M,{icon:"schedule",alt:u(de.scheduledPost)})})]})]}),f==="loading"?e(Pe,{abrupt:!0}):e(fi,{maxCharacters:c,hidden:f==="loading"}),e("label",{class:`toolbar-button ${E!==U.current||Ce?.length&&!Ce.includes(E)?"highlight":""}`,children:[e("span",{class:"icon-text",children:Xn[E]?.native}),e("select",{name:"language",value:E,onChange:o=>{const{value:h}=o.target;O(h||ke),Le.session.set("currentLanguage",h||ke)},disabled:f==="loading",dir:"auto",children:[Zt.map(([o,h,F])=>{const v=et({code:o,fallback:h});return e("option",{value:o,children:v!==F?`${F} - ${v}`:v},o)}),e("hr",{}),Xt.map(([o,h,F])=>{const v=et({code:o,fallback:h});return e("option",{value:o,children:v!==F?`${F} - ${v}`:v},o)})]})]})," ",e("button",{type:"submit",disabled:f==="loading",children:g(ue?{id:"gmB6oO"}:t?{id:"ImOQa9"}:n?{id:"EkH9pt"}:{id:"GMe2XV"})})]})]})]}),ut&&e(je,{onClose:()=>{Ve(!1)},children:e(yi,{masto:A,instance:y,onClose:()=>{Ve(!1)},defaultSearchTerm:ut?.defaultSearchTerm,onSelect:o=>{const h=I.current;if(!h)return;const{selectionStart:F,selectionEnd:v}=h,L=h.value;let x=L.slice(0,F);x=x.replace(/\u200B$/,"");const w=x?/[\s\t\n\r]$/.test(x)?"":" ":"",B=L.slice(v),C=/^[\s\t\n\r]/.test(B)?"":" ",re=x+w+"@"+o+C+B;h.value=re,h.selectionStart=h.selectionEnd=v+1+o.length+C.length,h.focus(),h.dispatchEvent(new Event("input"))}})}),dt&&e(je,{onClose:()=>{Fe(!1)},children:e(xi,{masto:A,instance:y,onClose:()=>{Fe(!1)},defaultSearchTerm:dt?.defaultSearchTerm,onSelect:o=>{const h=I.current;if(!h)return;const{selectionStart:F,selectionEnd:v}=h,L=h.value;let x=L.slice(0,F);x=x.replace(/\u200B$/,"");const w=x?/[\s\t\n\r]$/.test(x)?"":" ":"",B=L.slice(v),C=/^[\s\t\n\r]/.test(B)?"":" ",re=x+w+o+C+B;h.value=re,h.selectionStart=h.selectionEnd=v+o.length+C.length,h.focus(),h.dispatchEvent(new Event("input"))}})}),Gt&&e(je,{onClose:()=>{Ie(!1)},children:e(ki,{onClose:()=>Ie(!1),onSelect:({url:o,type:h,alt_text:F})=>{if(k.length>=d){alert(Ae._({id:"ctFhjs",values:{maxMediaAttachments:d}}));return}(async()=>{let v;try{v=Ee({text:g({id:"/Cw4Tx"}),duration:-1});const L=await fetch(o,{referrerPolicy:"no-referrer"}).then(B=>B.blob()),x=new File([L],h==="video/mp4"?"video.mp4":"image.gif",{type:h}),w=[...k,{file:x,type:h,size:x.size,id:null,description:F||""}];Z(w),v?.hideToast?.()}catch{v?.hideToast?.(),Ee(g({id:"VKDnAx"}))}})()}})})]})}const It="capture"in document.createElement("input");function Mt({hidden:s,disabled:t=!1,supportedMimeTypes:n,setMediaAttachments:a}){return e("input",{type:"file",hidden:s,accept:n?.join(","),capture:"environment",disabled:t,onChange:r=>{const p=r.target.files;if(!p)return;const l=Array.from(p)[0];l&&(a(u=>[...u,{file:l,type:l.type,size:l.size,url:URL.createObjectURL(l),id:null,description:null}]),r.target.value=null)}})}function Bt({hidden:s,supportedMimeTypes:t,maxMediaAttachments:n,mediaAttachments:a,disabled:r=!1,setMediaAttachments:p}){return e("input",{type:"file",hidden:s,accept:t?.join(","),multiple:n===void 0||n-a>=2,disabled:r,onChange:l=>{const u=l.target.files;if(!u)return;const g=Array.from(u).map(b=>({file:b,type:b.type,size:b.size,url:URL.createObjectURL(b),id:null,description:null}));a.length+g.length>n?alert(Ae._({id:"ctFhjs",values:{maxMediaAttachments:n}})):p(b=>b.concat(g)),l.target.value=""}})}function Dt(s){if(!s)return;const{value:t,offsetHeight:n,scrollHeight:a,clientHeight:r}=s;if(n<window.innerHeight){const p=n-r,l=t?a+p+"px":null;s.style.height=l}}async function pi(s,t){const a=(await t.v1.customEmojis.list()).filter(p=>p.visibleInPicker),r=new An(a,{keys:["shortcode"],findAllMatches:!0});return[a,r]}const Wt=pn(pi,{matchesArg:(s,t)=>s.instance===t.instance,maxAge:30*60*1e3}),mi=async s=>{if(Ft){const a=await Ft.detect(s);if(a?.length)return a.slice(0,2).map(r=>r.detectedLanguage)}const{detectAll:t}=await mn(async()=>{const{detectAll:a}=await import("./tinyld.light.node-D9KYf3Y3.js");return{detectAll:a}},[],import.meta.url),n=t(s);return n?.length?n.slice(0,2).map(a=>a.lang):null},gi=dn((s,t)=>{const{_:n}=ye(),{masto:a,instance:r}=nt(),[p,l]=D(t.current?.value||""),{maxCharacters:u,performSearch:g=()=>{},onTrigger:b=()=>{},...Q}=s,A=$();X(()=>{Wt(r,a).then(c=>{const[d,m]=c;A.current=m}).catch(c=>{})},[]);const y=$(),f=$(""),S=$(!1);X(()=>{let c,d,m,_,G;return y.current&&(c=R=>{const{key:ae,provide:P,text:q}=R.detail;if(f.current=q,q===""){P(Promise.resolve({matched:!1}));return}if(ae===":"){const ie=A.current?.search(q,{limit:5});let K="";ie.forEach(({item:J})=>{const{shortcode:ee,url:te}=J;K+=`
|
||
<li role="option" data-value="${fe(ee)}">
|
||
<img src="${fe(te)}" width="16" height="16" alt="" loading="lazy" />
|
||
${fe(ee)}
|
||
</li>`}),K+=`<li role="option" data-value="" data-more="${q}">${n({id:"24misb"})}</li>`,be.innerHTML=K,P(Promise.resolve({matched:ie.length>0,fragment:be}));return}const Y={"@":"accounts","#":"hashtags"}[ae];P(new Promise(ie=>{g({type:Y,q,limit:5}).then(J=>{if(q!==f.current)return;const ee=J[Y]||J;let te="";ee.forEach(I=>{const{name:W,avatarStatic:oe,displayName:le,username:ne,acct:ce,emojis:E,history:O}=I,U=Ln(le,E);if(ce)te+=`
|
||
<li role="option" data-value="${fe(ce)}">
|
||
<span class="avatar">
|
||
<img src="${fe(oe)}" width="16" height="16" alt="" loading="lazy" />
|
||
</span>
|
||
<span>
|
||
<b>${U||ne}</b>
|
||
<br><span class="bidi-isolate">@${fe(ce)}</span>
|
||
</span>
|
||
</li>
|
||
`;else{const k=O?.reduce?.((Z,N)=>Z+ +N.uses,0);te+=`
|
||
<li role="option" data-value="${fe(W)}">
|
||
<span class="grow">#<b>${fe(W)}</b></span>
|
||
${k?`<span class="count">${Sn(k)}</span>`:""}
|
||
</li>
|
||
`}}),Y==="accounts"&&(te+=`<li role="option" data-value="" data-more="${q}">${n({id:"24misb"})}</li>`),be.innerHTML=te,ie({matched:ee.length>0,fragment:be})})}))},y.current.addEventListener("text-expander-change",c),d=R=>{const{key:ae,item:P}=R.detail,{value:q,more:Y}=P.dataset;ae===":"?(R.detail.value=q?`:${q}:`:"",Y&&(R.detail.continue=!0,setTimeout(()=>{b?.({name:"custom-emojis",defaultSearchTerm:Y})},300))):ae==="@"?(R.detail.value=q?`@${q}`:"",Y&&(R.detail.continue=!0,setTimeout(()=>{b?.({name:"mention",defaultSearchTerm:Y})},300))):R.detail.value=`${ae}${q}`},y.current.addEventListener("text-expander-value",d),m=R=>{const{input:ae}=R.detail;if(l(ae.value),t.current){const P=new Event("input",{bubbles:!0});t.current.dispatchEvent(P)}},y.current.addEventListener("text-expander-committed",m),_=()=>{S.current=!0},y.current.addEventListener("text-expander-activate",_),G=()=>{S.current=!1},y.current.addEventListener("text-expander-deactivate",G)),()=>{y.current&&(y.current.removeEventListener("text-expander-change",c),y.current.removeEventListener("text-expander-value",d),y.current.removeEventListener("text-expander-committed",m),y.current.removeEventListener("text-expander-activate",_),y.current.removeEventListener("text-expander-deactivate",G))}},[]),X(()=>{const c=t.current;if(!c)return;new ResizeObserver(()=>{if(y.current){const{height:m}=c.getBoundingClientRect();y.current.style.height=m+"px"}}).observe(c)},[]);const z=$(0),T=$(),H=zn(c=>{if(!T.current)return;if(z.current>3){T.current.innerHTML="",T.current=null,H?.cancel?.();return}let d,m;z.current<=3&&(d=Date.now()),T.current.innerHTML=ui(c,{maxCharacters:u})+`
|
||
`,z.current<=3&&(m=Date.now()),d&&m&&m-d>50&&z.current++},500),V=Ke(()=>{const c=T.current?.cloneNode(!0);if(!c)return;c.querySelectorAll("mark").forEach(m=>{m.remove()});const d=c.innerText?.trim();d&&(async()=>{const m=await mi(d);m?.length&&b?.({name:"auto-detect-language",languages:m})})()},2e3);return e("text-expander",{ref:y,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",...Q,ref:t,name:"status",value:p,onKeyDown:c=>{const{key:d,target:m}=c,_=S.current;if(d==="Enter"&&!(c.ctrlKey||c.metaKey||_)&&!c.isComposing)try{const{value:G,selectionStart:R}=m,P=G.slice(0,R).split(`
|
||
`).slice(-1)[0];if(P&&/^\s*(-|\d+\.)\s/.test(P)){const[q,Y,ie,K,J]=P.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(J){c.preventDefault();const[ee]=ie.match(/\d+/)||[],te=ee?`${+ee+1}.`:"-",I=`
|
||
${Y}${te}${K}`;m.setRangeText(I,R,R);const W=R+I.length;m.setSelectionRange(W,W)}else{const ee=R-P.length;m.setRangeText("",ee,R)}Dt(m),m.dispatchEvent(new Event("input"))}}catch{}T.current&&(T.current.scrollTop=m.scrollTop)},onInput:c=>{const{target:d}=c,m=d.value;l(m),Dt(d),s.onInput?.(c),H(m),V()},style:{width:"100%",height:"4em"},onScroll:c=>{if(T.current){const{scrollTop:d}=c.target;T.current.scrollTop=d}}}),e("div",{ref:T,class:"compose-highlight","aria-hidden":"true"})]})});function fi({maxCharacters:s=500,hidden:t}){const a=gn(se).composerCharacterCount,r=s-a;return t?e("span",{class:"char-counter",hidden:!0}):e("span",{class:"char-counter",title:`${r}/${s}`,style:{"--percentage":a/s*100},children:[e("meter",{class:`${r<=-10?"explode":r<=0?"danger":r<=20?"warning":""}`,value:a,max:s}),e("span",{class:"counter",children:r})]})}function Rt(s,t,n,a){const r=Math.sqrt(t/s),p=Math.floor(n*r),l=Math.floor(a*r);return{newWidth:p,newHeight:l}}function vi({attachment:s,disabled:t,lang:n,descriptionLimit:a=1500,onDescriptionChange:r=()=>{},onRemove:p=()=>{}}){const{i18n:l,_:u}=ye(),[g,b]=D("default"),Q=Re("@mastodon/edit-media-attributes"),{type:A,id:y,file:f}=s,S=ze(()=>f?URL.createObjectURL(f):s.url,[f,s.url]),z=!!f?.size,T=z?Pt():{},{mediaAttachments:{imageSizeLimit:H,imageMatrixLimit:V,videoSizeLimit:c,videoMatrixLimit:d,videoFrameRateLimit:m}={}}=T||{},[_,G]=D(()=>z?A.startsWith("image")&&H&&f.size>H?{type:"imageSizeLimit",details:{imageSize:f.size,imageSizeLimit:H}}:A.startsWith("video")&&c&&f.size>c?{type:"videoSizeLimit",details:{videoSize:f.size,videoSizeLimit:c}}:null:null),[R,ae]=D({});X(()=>{!z||!V||R?.matrix>V&&G({type:"imageMatrixLimit",details:{imageMatrix:R?.matrix,imageMatrixLimit:V,width:R?.width,height:R?.height}})},[R,V,z]);const[P,q]=D({});X(()=>{!z||!d||P?.matrix>d&&G({type:"videoMatrixLimit",details:{videoMatrix:P?.matrix,videoMatrixLimit:d,width:P?.width,height:P?.height}})},[P,d,z]);const[Y,ie]=D(s.description),[K,J]=A.split("/"),ee=Ke(r,250);X(()=>{ee(Y)},[Y,ee]);const[te,I]=D(!1),W=$(null);X(()=>{let E;return te&&W.current&&(E=setTimeout(()=>{W.current.focus()},100)),()=>{clearTimeout(E)}},[te]);const oe=e(Te,{children:y&&!Q?e("div",{class:"media-desc",children:[e("span",{class:"tag",children:e(j,{id:"3wG7HI"})}),e("p",{title:Y,children:s.description||e("i",{children:"No description"})})]}):e("textarea",{ref:W,value:Y||"",lang:n,placeholder:{image:u({id:"Lh8B0N"}),video:u({id:"mN4S+e"}),audio:u({id:"ieZytw"})}[K],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:t||g==="loading",class:g==="loading"?"loading":"",maxlength:a,onInput:E=>{const{value:O}=E.target;ie(O)}})}),le=$(null);X(()=>()=>{le.current?.hideToast?.()},[]);const ne=$(null),ce=E=>{const{type:O,details:U}=E;switch(O){case"imageSizeLimit":{const{imageSize:k,imageSizeLimit:Z}=U;return u({id:"d83/LB",values:{0:Be(k),1:Be(Z)}})}case"imageMatrixLimit":{const{imageMatrix:k,imageMatrixLimit:Z,width:N,height:he}=U,{newWidth:ue,newHeight:ge}=Rt(k,Z,N,he);return u({id:"DuvOX/",values:{0:l.number(N),1:l.number(he),2:l.number(ue),3:l.number(ge)}})}case"videoSizeLimit":{const{videoSize:k,videoSizeLimit:Z}=U;return u({id:"d83/LB",values:{0:Be(k),1:Be(Z)}})}case"videoMatrixLimit":{const{videoMatrix:k,videoMatrixLimit:Z,width:N,height:he}=U,{newWidth:ue,newHeight:ge}=Rt(k,Z,N,he);return u({id:"DuvOX/",values:{0:l.number(N),1:l.number(he),2:l.number(ue),3:l.number(ge)}})}case"videoFrameRateLimit":return u({id:"S1fBwy"})}};return e(Te,{children:[e("div",{class:"media-attachment",children:[e("div",{class:"media-preview",tabIndex:"0",onClick:()=>{I(!0)},children:K==="image"?e("img",{src:S,alt:"",onLoad:E=>{if(!z)return;const{naturalWidth:O,naturalHeight:U}=E.target;ae({matrix:O*U,width:O,height:U})}}):K==="video"||K==="gifv"?e("video",{src:S+"#t=0.1",playsinline:!0,muted:!0,disablePictureInPicture:!0,preload:"metadata",onLoadedMetadata:E=>{if(!z)return;const{videoWidth:O,videoHeight:U}=E.target;O&&U&&q({matrix:O*U,width:O,height:U})}}):K==="audio"?e("audio",{src:S,controls:!0}):null}),oe,e("div",{class:"media-aside",children:[e("button",{type:"button",class:"plain close-button",disabled:t,onClick:p,children:e(M,{icon:"x",alt:u({id:"t/YqKh"})})}),!!_&&e("button",{type:"button",class:"media-error",title:ce(_),onClick:()=>{ne.current&&ne.current.hideToast(),ne.current=Ee({text:ce(_),duration:1e4})},children:e(M,{icon:"alert",alt:u({id:"SlfejT"})})})]})]}),te&&e(je,{onClose:()=>{I(!1)},children:e("div",{id:"media-sheet",class:"sheet sheet-max",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>{I(!1)},children:e(M,{icon:"x",alt:u({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:{image:u({id:"oMslIB"}),video:u({id:"WZw+zB"}),audio:u({id:"KMtgtM"})}[K]})}),e("main",{tabIndex:"-1",children:[e("div",{class:"media-preview",children:K==="image"?e("img",{src:S,alt:""}):K==="video"||K==="gifv"?e("video",{src:S,playsinline:!0,controls:!0}):K==="audio"?e("audio",{src:S,controls:!0}):null}),e("div",{class:"media-form",children:[oe,e("footer",{children:[K==="image"&&/^(png|jpe?g|gif|webp)$/i.test(J)&&!!se.settings.mediaAltGenerator&&!!Xe&&e(Ht,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:e(M,{icon:"more",size:"l",alt:u({id:"2FYpfJ"})})}),children:[e(ve,{disabled:g==="loading",onClick:()=>{b("loading"),le.current=Ee({text:u({id:"8zsp51"}),duration:-1}),async function(){try{const E=new FormData;E.append("image",f);const O=await fetch(Xe,{method:"POST",body:E}).then(U=>U.json());if(O.error)throw new Error(O.error);ie(O.description)}catch(E){Ee(E.message?u({id:"wy0Iwj",values:{0:E.message}}):u({id:"xhYfVj"}))}finally{b("default"),le.current?.hideToast?.()}}()},children:[e(M,{icon:"sparkles2"}),n&&n!=="en"?e("small",{children:[e(j,{id:"o5sTJw"}),e("br",{}),"(English)"]}):e("span",{children:e(j,{id:"o5sTJw"})})]}),!!n&&n!=="en"&&e(ve,{disabled:g==="loading",onClick:()=>{b("loading"),le.current=Ee({text:u({id:"8zsp51"}),duration:-1}),async function(){try{const E=new FormData;E.append("image",f);const O=`?lang=${n}`,U=await fetch(Xe+O,{method:"POST",body:E}).then(k=>k.json());if(U.error)throw new Error(U.error);ie(U.description)}catch(E){Ee(u({id:"eNTGfp",values:{0:E?.message?`: ${E.message}`:""}}))}finally{b("default"),le.current?.hideToast?.()}}()},children:[e(M,{icon:"sparkles2"}),e("small",{children:[e(j,{id:"o5sTJw"}),e("br",{}),e(j,{id:"m+pAEQ",values:{0:et(n)},components:{0:e("span",{class:"more-insignificant"})}})]})]})]}),e("button",{type:"button",class:"light block",onClick:()=>{I(!1)},disabled:g==="loading",children:e(j,{id:"DPfwMq"})})]})]})]})]})})]})}function bi({lang:s,poll:t,disabled:n,onInput:a=()=>{},maxOptions:r,maxExpiration:p,minExpiration:l,maxCharactersPerOption:u}){const{_:g}=ye(),{options:b,expiresIn:Q,multiple:A}=t;return e("div",{class:`poll ${A?"multiple":""}`,children:[e("div",{class:"poll-choices",children:b.map((y,f)=>e("div",{class:"poll-choice",children:[e("input",{required:!0,type:"text",value:y,disabled:n,maxlength:u,placeholder:g({id:"LDUSXg",values:{0:f+1}}),lang:s,spellCheck:"true",dir:"auto",onInput:S=>{const{value:z}=S.target;b[f]=z,a(t)}}),e("button",{type:"button",class:"plain2 poll-button",disabled:n||b.length<=1,onClick:()=>{b.splice(f,1),a(t)},children:e(M,{icon:"x",size:"s",alt:g({id:"t/YqKh"})})})]},f))}),e("div",{class:"poll-toolbar",children:[e("button",{type:"button",class:"plain2 poll-button",disabled:n||b.length>=r,onClick:()=>{b.push(""),a(t)},children:"+"})," ",e("label",{class:"multiple-choices",children:[e("input",{type:"checkbox",checked:A,disabled:n,onChange:y=>{const{checked:f}=y.target;t.multiple=f,a(t)}})," ",e(j,{id:"T57mm9"})]}),e("label",{class:"expires-in",children:[e(j,{id:"lkz6PL"})," ",e("select",{value:Q,disabled:n,onChange:y=>{const{value:f}=y.target;t.expiresIn=f,a(t)},children:Object.entries(Nt).filter(([y])=>y>=l&&y<=p).map(([y,f])=>e("option",{value:y,children:f()},y))})]})]}),e("div",{class:"poll-toolbar",children:e("button",{type:"button",class:"plain remove-poll-button",disabled:n,onClick:()=>{a(null)},children:e(j,{id:"CDpQAX"})})})]})}function fe(s){return s.replace(/[&<>"']/g,function(t){return"&#"+t.charCodeAt(0)+";"})}function jt(s){for(let t in s)(s[t]===null||s[t]===void 0)&&delete s[t];return s}function yi({onClose:s=()=>{},onSelect:t=()=>{},defaultSearchTerm:n}){const{_:a}=ye(),{masto:r}=nt(),[p,l]=D("default"),[u,g]=D([]),[b,Q]=D({}),[A,y]=D(0),f=async c=>{if(!c?.length)return;const d=await Tn(c,b);d&&Q({...b,...d})},S=c=>{c&&(l("loading"),(async()=>{try{const d=await r.v1.accounts.search.list({q:c,limit:40,resolve:!1});g(d),f(d),l("default")}catch{l("error")}})())},z=Ke(S,1e3);X(()=>{S()},[S]);const T=$();X(()=>{T.current&&(T.current.focus(),T.current.value&&(T.current.selectionStart=T.current.value.length,T.current.selectionEnd=T.current.value.length))},[]),X(()=>{n&&S(n)},[n]);const H=c=>{const d=c.acct;t(d),s()};Se("enter",()=>{const c=u[A];c&&H(c)},{preventDefault:!0,enableOnFormTags:["input"],useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey});const V=$();return Se("down",()=>{A<u.length-1?y(A+1):y(0),setTimeout(()=>{const c=V.current.querySelector(".selected");c&&c.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"],useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey}),Se("up",()=>{A>0?y(A-1):y(u.length-1),setTimeout(()=>{const c=V.current.querySelector(".selected");c&&c.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"],useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey}),e("div",{id:"mention-sheet",class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(M,{icon:"x",alt:a({id:"yz7wBu"})})}),e("header",{children:e("form",{onSubmit:c=>{c.preventDefault(),z.flush?.()},children:e("input",{ref:T,required:!0,type:"search",class:"block",placeholder:a({id:"eH1bqp"}),onInput:c=>{const{value:d}=c.target;z(d)},autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:n||""})})}),e("main",{children:u?.length>0?e("ul",{ref:V,class:`accounts-list ${p==="loading"?"loading":""}`,children:u.map((c,d)=>{const m=b[c.id];return e("li",{class:d===A?"selected":"",children:[e(Ot,{avatarSize:"xxl",account:c,relationship:m,showStats:!0,showActivity:!0}),e("button",{type:"button",class:"plain2",onClick:()=>{H(c)},children:e(M,{icon:"plus",size:"xl",alt:a({id:"m16xKo"})})})]},c.id)})}):p==="loading"?e("div",{class:"ui-state",children:e(Pe,{abrupt:!0})}):p==="error"?e("div",{class:"ui-state",children:e("p",{children:e(j,{id:"AThL/k"})})}):null})]})}function xi({masto:s,instance:t,onClose:n=()=>{},onSelect:a=()=>{},defaultSearchTerm:r}){const{_:p}=ye(),[l,u]=D("default"),g=$([]),[b,Q]=D([]),A=ze(()=>Le.account.get("recentlyUsedCustomEmojis")||[]),y=$();X(()=>{u("loading"),(async()=>{try{const[d,m]=await Wt(t,s);y.current=m,Q(d),u("default")}catch{u("error")}})()},[]);const f=ze(()=>{const d={"--recent--":A.filter(_=>b.find(G=>G.shortcode===_.shortcode))},m=[];return b.forEach(_=>{if(g.current?.push?.(_),!_.category){m.push(_);return}d[_.category]||(d[_.category]=[]),d[_.category].push(_)}),m.length&&(d["--others--"]=m),d},[b]),S=$(),[z,T]=D(null),H=wt(d=>{const{value:m}=d.target;if(m){const _=y.current?.search(m,{limit:tt});T(_.map(G=>G.item)),S.current?.scrollTo?.(0,0)}else T(null)},[b]);X(()=>{r&&b?.length&&H({target:{value:r}})},[r,H,b]);const V=wt(d=>{a?.(d),n?.(),queueMicrotask(()=>{let m=Le.account.get("recentlyUsedCustomEmojis")||[];const _=m.findIndex(G=>G.shortcode===d.shortcode);_!==-1?(m.splice(_,1),m.unshift(d)):(m.unshift(d),m=m.filter(G=>g.current?.find?.(R=>R.shortcode===G.shortcode)),m=m.slice(0,10)),Le.account.set("recentlyUsedCustomEmojis",m)})},[a]),c=$();return X(()=>{c.current&&(c.current.focus(),c.current.value&&(c.current.selectionStart=c.current.value.length,c.current.selectionEnd=c.current.value.length))},[]),e("div",{id:"custom-emojis-sheet",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(M,{icon:"x",alt:p({id:"yz7wBu"})})}),e("header",{children:[e("div",{children:[e("b",{children:e(j,{id:"8i6Ueo"})})," ",l==="loading"?e(Pe,{}):e("small",{class:"insignificant",children:[" • ",t]})]}),e("form",{onSubmit:d=>{d.preventDefault();const m=z[0];m&&V(`:${m.shortcode}:`)},children:e("input",{ref:c,type:"search",placeholder:p({id:"EarrCe"}),onInput:H,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:r||""})})]}),e("main",{ref:S,children:z!==null?e("ul",{class:"custom-emojis-matches custom-emojis-list",children:z.map(d=>e("li",{class:"custom-emojis-match",children:e(Ut,{emoji:d,onClick:()=>{V(`:${d.shortcode}:`)},showCode:!0})},d.shortcode))}):e("div",{class:"custom-emojis-list",children:[l==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(j,{id:"Kzwsg2"})})}),l==="default"&&Object.entries(f).map(([d,m])=>!!m?.length&&e("div",{class:"section-container",children:[e("div",{class:"section-header",children:{"--recent--":p({id:"uabU9X"}),"--others--":p({id:"NuKR0h"})}[d]||d}),e(wi,{emojis:m,onSelect:V})]}))]})})]})}const wi=Kt(({emojis:s,onSelect:t})=>{const{i18n:n}=ye(),[a,r]=D(tt),p=s.length>a;return e("section",{children:[s.slice(0,a).map(l=>e(Ut,{emoji:l,onClick:()=>{t(`:${l.shortcode}:`)}},l.shortcode)),p&&e("button",{type:"button",class:"plain small",onClick:()=>r(a+tt),children:e(j,{id:"iAB71E",values:{0:n.number(s.length-a)}})})]})}),Ut=Kt(({emoji:s,onClick:t,showCode:n})=>{const a=r=>{const l=r.currentTarget.closest("main");if(l){const u=l.getBoundingClientRect(),g=r.currentTarget.getBoundingClientRect(),b=r.currentTarget.classList;g.left<u.left+88?(b.add("edge-left"),b.remove("edge-right")):g.right>u.right-88?(b.add("edge-right"),b.remove("edge-left")):b.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(Te,{children:[" ",e("code",{children:s.shortcode})]})]})}),Qe=20;function ki({onClose:s=()=>{},onSelect:t=()=>{}}){const{i18n:n,_:a}=ye(),[r,p]=D("default"),[l,u]=D([]),g=$(null),b=$(null),Q=$(0),A=$(null);function y({offset:S}){b.current?.value&&(p("loading"),A.current?.scrollTo?.({top:0,left:0,behavior:"smooth"}),(async()=>{try{const z={api_key:Zn,q:b.current.value,rating:"g",limit:Qe,bundle:"messaging_non_clips",offset:S,lang:n.locale||"en"},T=await fetch("https://api.giphy.com/v1/gifs/search?"+new URLSearchParams(z),{referrerPolicy:"no-referrer"}).then(H=>H.json());Q.current=T.pagination?.offset||0,u(T),p("results")}catch{p("error")}})())}X(()=>{b.current?.focus()},[]);const f=Ke(()=>{y({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(M,{icon:"x",alt:a({id:"yz7wBu"})})}),e("header",{children:e("form",{ref:g,onSubmit:S=>{S.preventDefault(),y({offset:0})},children:[e("input",{ref:b,type:"search",name:"q",placeholder:a({id:"wxlF9B"}),required:!0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",onInput:f}),e("input",{type:"image",class:"powered-button",src:Un,width:"86",height:"30",alt:a({id:"c1Q/eU"})})]})}),e("main",{ref:A,class:r==="loading"?"loading":"",children:[r==="default"&&e("div",{class:"ui-state",children:e("p",{class:"insignificant",children:e(j,{id:"9KEidY"})})}),r==="loading"&&!l?.data?.length&&e("div",{class:"ui-state",children:e(Pe,{abrupt:!0})}),l?.data?.length>0?e(Te,{children:[e("ul",{children:l.data.map(S=>{const{id:z,images:T,title:H,alt_text:V}=S,{fixed_height_small:c,fixed_height_downsampled:d,fixed_height:m,original:_}=T,G=c?.url?c:d?.url?d:m;let{url:R,webp:ae,width:P,height:q}=G;+q>100&&(P=P/q*100,q=100);const Y=URL.parse(R),ie=Y.origin+Y.pathname;let K;if(ae){const J=URL.parse(ae);K=J.origin+J.pathname}return e("li",{children:e("button",{type:"button",onClick:()=>{const{mp4:J,url:ee}=_,te=J||ee,I=URL.parse(te),W=I.origin+I.pathname;s(),t({url:W,type:J?"video/mp4":"image/gif",alt_text:V||H})},children:e("figure",{style:{"--figure-width":P+"px"},children:[e("picture",{children:[K&&e("source",{srcset:K,type:"image/webp"}),e("img",{src:ie,width:P,height:q,loading:"lazy",decoding:"async",alt:V,referrerpolicy:"no-referrer",onLoad:J=>{J.target.style.backgroundColor="transparent"}})]}),e("figcaption",{children:V||H})]})})},z)})}),e("p",{class:"pagination",children:[l.pagination?.offset>0&&e("button",{type:"button",class:"light small",disabled:r==="loading",onClick:()=>{y({offset:l.pagination?.offset-Qe})},children:[e(M,{icon:"chevron-left"}),e("span",{children:e(j,{id:"DHhJ7s"})})]}),e("span",{}),l.pagination?.offset+l.pagination?.count<l.pagination?.total_count&&e("button",{type:"button",class:"light small",disabled:r==="loading",onClick:()=>{y({offset:l.pagination?.offset+Qe})},children:[e("span",{children:e(j,{id:"hXzOVo"})})," ",e(M,{icon:"chevron-right"})]})]})]}):r==="results"&&e("div",{class:"ui-state",children:e("p",{children:"No results"})}),r==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(j,{id:"PbFw9n"})})})]})]})}export{Ci as default};
|
||
//# sourceMappingURL=compose-nGhUPJqD.js.map
|