27 lines
85 KiB
JavaScript
27 lines
85 KiB
JavaScript
var Xt=s=>{throw TypeError(s)};var kt=(s,t,n)=>t.has(s)||Xt("Cannot "+n);var B=(s,t,n)=>(kt(s,t,"read from private field"),n?n.call(s):t.get(s)),de=(s,t,n)=>t.has(s)?Xt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,n),be=(s,t,n,a)=>(kt(s,t,"write to private field"),a?a.call(s,n):t.set(s,n),n),te=(s,t,n)=>(kt(s,t,"access private method"),n);import{x as $n,s as ce,V as vn,u as Se,a as Mt,h as H,A as q,K as Pn,aF as bn,e as Me,y as se,w as On,aG as Hn,r as Ne,j as We,d as e,T as K,N as Nn,k as Ue,v as ht,b as Kn,p as qn,aj as Wn,c as Un,q as Qt,M as xn}from"./useTitle-C_BZYcuR.js";import{q as _e,O as Vn,$ as Gn,a as qe,ac as Yn,B as en,u as Zn,ad as Jn,ae as Xn,v as yn,I as $,b as Qn,F as tn,af as ei,m as at,a8 as ti,a7 as ni,i as wn,f as ze,l as At,h as ot,s as Be,a6 as ii,ag as nn,a2 as si,y as ai,X as oi,Z as pt,p as it,D as ri}from"./ScheduledAtField-ely_oZde.js";class li{constructor(t,n,{tabInsertsSuggestions:a,defaultFirstOption:l}={}){this.input=t,this.list=n,this.tabInsertsSuggestions=a??!0,this.defaultFirstOption=l??!1,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=d=>ci(d,this),this.compositionEventHandler=d=>di(d,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",sn),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",sn)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(Et)[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(Et)[0],a=Array.from(this.list.querySelectorAll('[role="option"]')).filter(Et),l=a.indexOf(n);if(l===a.length-1&&t===1||l===0&&t===-1){this.clearSelection(),this.input.focus();return}let d=t===1?0:a.length-1;if(n&&l>=0){const h=l+t;h>=0&&h<a.length&&(d=h)}const r=a[d];if(r)for(const h of a)h.removeAttribute("data-combobox-option-default"),r===h?(this.input.setAttribute("aria-activedescendant",r.id),r.setAttribute("aria-selected","true"),hi(this.list,r)):h.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 ci(s,t){if(!(s.shiftKey||s.metaKey||s.altKey)&&!(!t.ctrlBindings&&s.ctrlKey)&&!t.isComposing)switch(s.key){case"Enter":an(t.input,t.list)&&s.preventDefault();break;case"Tab":t.tabInsertsSuggestions&&an(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 sn(s){if(!(s.target instanceof Element))return;const t=s.target.closest('[role="option"]');t&&t.getAttribute("aria-disabled")!=="true"&&ui(t)}function an(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 ui(s){s.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0}))}function Et(s){return!s.hidden&&!(s instanceof HTMLInputElement&&s.type==="hidden")&&(s.offsetWidth>0||s.offsetHeight>0)}function di(s,t){t.isComposing=s.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function hi(s,t){pi(s,t)||(s.scrollTop=t.offsetTop)}function pi(s,t){const n=s.scrollTop,a=n+s.clientHeight,l=t.offsetTop,d=l+t.clientHeight;return l>=n&&d<=a}const mi=/\s|\(|\[/;function gi(s,t,n,{multiWord:a,lookBackIndex:l,lastMatchPosition:d}={multiWord:!1,lookBackIndex:0,lastMatchPosition:null}){let r=s.lastIndexOf(t,n-1);if(r===-1||r<l)return;if(a){if(d!=null){if(d===r)return;r=d-t.length}if(s[r+1]===" "&&n>=r+t.length+1||s.lastIndexOf(`
|
||
`,n-1)>r||s.lastIndexOf(".",n-1)>r)return}else if(s.lastIndexOf(" ",n-1)>r)return;const h=s[r-1];return h&&!mi.test(h)?void 0:{text:s.substring(r+t.length,n),position:r+t.length}}class fi extends HTMLElement{}class vi extends Event{constructor(){super("update")}}const Ft=new WeakMap;var Ve,Ge,Ye,Ce,G,St,De,Re,je,_t,$e,rt,lt,ct,Ze,Te;const jt=class jt extends fi{constructor(){super(...arguments);de(this,G);de(this,Ve,new MutationObserver(()=>te(this,G,lt).call(this)));de(this,Ge,new ResizeObserver(()=>te(this,G,rt).call(this)));de(this,Ye);de(this,Ce);de(this,Re,0);de(this,je,0);de(this,$e,!1);de(this,Ze,()=>te(this,G,ct).call(this));de(this,Te,n=>{te(this,G,De).call(this,a=>{(n.target===document||n.target===window||n.target instanceof Node&&n.target.contains(a))&&te(this,G,rt).call(this)})})}static for(n){let a=Ft.get(n);return a||(a=new jt,a.connect(n),Ft.set(n,a)),a}connect(n){be(this,Ye,new WeakRef(n)),be(this,Ce,document.createElement("div")),B(this,Ce).style.position="absolute",B(this,Ce).style.pointerEvents="none",n.after(B(this,Ce)),B(this,Ce).appendChild(this)}forceUpdate(){te(this,G,lt).call(this),te(this,G,ct).call(this)}connectedCallback(){te(this,G,De).call(this,n=>{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"),te(this,G,lt).call(this),te(this,G,ct).call(this),B(this,Ve).observe(n,{attributeFilter:["style","dir"]}),B(this,Ge).observe(n),document.addEventListener("scroll",B(this,Te),{capture:!0}),window.addEventListener("resize",B(this,Te),{capture:!0}),n.addEventListener("input",B(this,Ze),{capture:!0})})}disconnectedCallback(){var a;(a=B(this,Ce))==null||a.remove(),B(this,Ve).disconnect(),B(this,Ge).disconnect(),document.removeEventListener("scroll",B(this,Te),{capture:!0}),window.removeEventListener("resize",B(this,Te),{capture:!0});const n=B(this,G,St);n&&(n.removeEventListener("input",B(this,Ze),{capture:!0}),Ft.delete(n))}};Ve=new WeakMap,Ge=new WeakMap,Ye=new WeakMap,Ce=new WeakMap,G=new WeakSet,St=function(){var n;return(n=B(this,Ye))==null?void 0:n.deref()},De=function(n){const a=B(this,G,St);return a?n(a):this.remove()},Re=new WeakMap,je=new WeakMap,_t=function(){te(this,G,De).call(this,n=>{const a=window.getComputedStyle(n);this.style.height=a.height,this.style.width=a.width,n.clientHeight!==this.clientHeight&&(this.style.height=`calc(${a.height} + ${n.clientHeight-this.clientHeight}px)`),n.clientWidth!==this.clientWidth&&(this.style.width=`calc(${a.width} + ${n.clientWidth-this.clientWidth}px)`);const l=n.getBoundingClientRect(),d=this.getBoundingClientRect();be(this,Re,B(this,Re)+l.left-d.left),be(this,je,B(this,je)+l.top-d.top),this.style.transform=`translate(${B(this,Re)}px, ${B(this,je)}px)`,this.scrollTop=n.scrollTop,this.scrollLeft=n.scrollLeft,this.dispatchEvent(new vi)})},$e=new WeakMap,rt=function(){B(this,$e)||(be(this,$e,!0),requestAnimationFrame(()=>{te(this,G,_t).call(this),be(this,$e,!1)}))},lt=function(){te(this,G,De).call(this,n=>{const a=window.getComputedStyle(n);for(const l of bi)this.style[l]=a[l];te(this,G,rt).call(this)})},ct=function(){te(this,G,De).call(this,n=>{this.textContent=n.value,te(this,G,_t).call(this)})},Ze=new WeakMap,Te=new WeakMap;let ut=jt;const bi=["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",ut)}catch(s){if(!(s instanceof DOMException&&s.name==="NotSupportedError"))throw s}var ke,Pe,Oe,he,Bt,kn,Tt,Ke;const dt=class dt{constructor(t,n=0,a=n){de(this,he);de(this,ke);de(this,Pe);de(this,Oe);be(this,ke,t),be(this,Pe,n),be(this,Oe,a)}static fromSelection(t){const{selectionStart:n,selectionEnd:a}=t;return new dt(t,n??void 0,a??void 0)}get collapsed(){return this.startOffset===this.endOffset}get commonAncestorContainer(){return B(this,ke)}get endContainer(){return B(this,ke)}get startContainer(){return B(this,ke)}get startOffset(){return B(this,Pe)}get endOffset(){return B(this,Oe)}setStartOffset(t){be(this,Pe,te(this,he,Tt).call(this,t))}setEndOffset(t){be(this,Oe,te(this,he,Tt).call(this,t))}collapse(t=!1){t?this.setEndOffset(this.startOffset):this.setStartOffset(this.endOffset)}cloneContents(){return te(this,he,Ke).call(this).cloneContents()}cloneRange(){return new dt(B(this,ke),this.startOffset,this.endOffset)}getBoundingClientRect(){return te(this,he,Ke).call(this).getBoundingClientRect()}getClientRects(){return te(this,he,Ke).call(this).getClientRects()}toString(){return te(this,he,Ke).call(this).toString()}getStyleClone(){return B(this,he,Bt)}};ke=new WeakMap,Pe=new WeakMap,Oe=new WeakMap,he=new WeakSet,Bt=function(){return ut.for(B(this,ke))},kn=function(){return B(this,he,Bt)},Tt=function(t){return Math.max(0,Math.min(t,B(this,ke).value.length))},Ke=function(){const t=document.createRange(),n=B(this,he,kn).childNodes[0];return n&&(t.setStart(n,this.startOffset),t.setEnd(n,this.endOffset)),t};let It=dt;const st=new WeakMap;class xi{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,l;this.input!==document.activeElement&&this.input!==((l=(a=document.activeElement)===null||a===void 0?void 0:a.shadowRoot)===null||l===void 0?void 0:l.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 li(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 It(this.input,n).getBoundingClientRect(),l={left:a.left,top:a.top+a.height},d=t.getBoundingClientRect(),r={left:l.left-d.left,top:l.top-d.top};if(r.left!==0||r.top!==0){const h=getComputedStyle(t);t.style.left=h.left?`calc(${h.left} + ${r.left}px)`:`${r.left}px`,t.style.top=h.top?`calc(${h.top} + ${r.top}px)`:`${r.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 l=this.match;if(!l)return;const d=this.input.value.substring(0,l.position-l.key.length),r=this.input.value.substring(l.position+l.text.length),h={item:a,key:l.key,value:null,continue:!1};if(!this.expander.dispatchEvent(new CustomEvent("text-expander-value",{cancelable:!0,detail:h}))||!h.value)return;let v=(n=this.expander.getAttribute("suffix"))!==null&&n!==void 0?n:" ";h.continue&&(v="");const ae=`${h.value}${v}`;this.input.value=d+ae+r;const T=d.length+ae.length;this.deactivate(),this.input.focus({preventScroll:!0}),this.input.selectionStart=T,this.input.selectionEnd=T,h.continue||(this.lookBackIndex=T,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:l}of this.expander.keys){const d=gi(n,a,t,{multiWord:l,lookBackIndex:this.lookBackIndex,lastMatchPosition:this.match?this.match.position:null});if(d)return{text:d.text,key:a,position:d.position}}}async notifyProviders(t){const n=[],a=b=>n.push(b),l=new CustomEvent("text-expander-change",{cancelable:!0,detail:{provide:a,text:t.text,key:t.key}});return this.expander.dispatchEvent(l)?(await Promise.all(n)).filter(b=>b.matched).map(b=>b.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 on extends HTMLElement{get keys(){const t=this.getAttribute("keys"),n=t?t.split(" "):[],a=this.getAttribute("multiword"),l=a?a.split(" "):[],d=l.length===0&&this.hasAttribute("multiword");return n.map(r=>({key:r,multiWord:d||l.includes(r)}))}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 xi(this,t);st.set(this,n)}disconnectedCallback(){const t=st.get(this);t&&(t.destroy(),st.delete(this))}dismiss(){const t=st.get(this);t&&t.dismissMenu()}}window.customElements.get("text-expander")||(window.TextExpanderElement=on,window.customElements.define("text-expander",on));function yi({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 wi=yi();function ki(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(wi,"")}const Ei=new Intl.Segmenter;function rn(s,{countAnsiEscapeCodes:t=!1}={}){if(s===""||(t||(s=ki(s)),s===""))return 0;let n=0;for(const a of Ei.segment(s))n++;return n}const Fi="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",Rt=[["aa","Afar","Afaraf"],["ab","Abkhaz","аҧсуа бызшәа"],["ae","Avestan","avesta"],["af","Afrikaans","Afrikaans"],["ak","Akan","Akan"],["am","Amharic","አማርኛ"],["an","Aragonese","aragonés"],["ar","Arabic","اللغة العربية"],["as","Assamese","অসমীয়া"],["av","Avaric","авар мацӀ"],["ay","Aymara","aymar aru"],["az","Azerbaijani","azərbaycan dili"],["ba","Bashkir","башҡорт теле"],["be","Belarusian","беларуская мова"],["bg","Bulgarian","български език"],["bh","Bihari","भोजपुरी"],["bi","Bislama","Bislama"],["bm","Bambara","bamanankan"],["bn","Bengali","বাংলা"],["bo","Tibetan","བོད་ཡིག"],["br","Breton","brezhoneg"],["bs","Bosnian","bosanski jezik"],["ca","Catalan","Català"],["ce","Chechen","нохчийн мотт"],["ch","Chamorro","Chamoru"],["co","Corsican","corsu"],["cr","Cree","ᓀᐦᐃᔭᐍᐏᐣ"],["cs","Czech","čeština"],["cu","Old Church Slavonic","ѩзыкъ словѣньскъ"],["cv","Chuvash","чӑваш чӗлхи"],["cy","Welsh","Cymraeg"],["da","Danish","dansk"],["de","German","Deutsch"],["dv","Divehi","Dhivehi"],["dz","Dzongkha","རྫོང་ཁ"],["ee","Ewe","Eʋegbe"],["el","Greek","Ελληνικά"],["en","English","English"],["eo","Esperanto","Esperanto"],["es","Spanish","Español"],["et","Estonian","eesti"],["eu","Basque","euskara"],["fa","Persian","فارسی"],["ff","Fula","Fulfulde"],["fi","Finnish","suomi"],["fj","Fijian","Vakaviti"],["fo","Faroese","føroyskt"],["fr","French","Français"],["fy","Western Frisian","Frysk"],["ga","Irish","Gaeilge"],["gd","Scottish Gaelic","Gàidhlig"],["gl","Galician","galego"],["gu","Gujarati","ગુજરાતી"],["gv","Manx","Gaelg"],["ha","Hausa","هَوُسَ"],["he","Hebrew","עברית"],["hi","Hindi","हिन्दी"],["ho","Hiri Motu","Hiri Motu"],["hr","Croatian","Hrvatski"],["ht","Haitian","Kreyòl ayisyen"],["hu","Hungarian","magyar"],["hy","Armenian","Հայերեն"],["hz","Herero","Otjiherero"],["ia","Interlingua","Interlingua"],["id","Indonesian","Bahasa Indonesia"],["ie","Interlingue","Interlingue"],["ig","Igbo","Asụsụ Igbo"],["ii","Nuosu","ꆈꌠ꒿ Nuosuhxop"],["ik","Inupiaq","Iñupiaq"],["io","Ido","Ido"],["is","Icelandic","Íslenska"],["it","Italian","Italiano"],["iu","Inuktitut","ᐃᓄᒃᑎᑐᑦ"],["ja","Japanese","日本語"],["jv","Javanese","basa Jawa"],["ka","Georgian","ქართული"],["kg","Kongo","Kikongo"],["ki","Kikuyu","Gĩkũyũ"],["kj","Kwanyama","Kuanyama"],["kk","Kazakh","қазақ тілі"],["kl","Kalaallisut","kalaallisut"],["km","Khmer","ខេមរភាសា"],["kn","Kannada","ಕನ್ನಡ"],["ko","Korean","한국어"],["kr","Kanuri","Kanuri"],["ks","Kashmiri","कश्मीरी"],["ku","Kurmanji (Kurdish)","Kurmancî"],["kv","Komi","коми кыв"],["kw","Cornish","Kernewek"],["ky","Kyrgyz","Кыргызча"],["la","Latin","latine"],["lb","Luxembourgish","Lëtzebuergesch"],["lg","Ganda","Luganda"],["li","Limburgish","Limburgs"],["ln","Lingala","Lingála"],["lo","Lao","ລາວ"],["lt","Lithuanian","lietuvių kalba"],["lu","Luba-Katanga","Tshiluba"],["lv","Latvian","latviešu valoda"],["mg","Malagasy","fiteny malagasy"],["mh","Marshallese","Kajin M̧ajeļ"],["mi","Māori","te reo Māori"],["mk","Macedonian","македонски јазик"],["ml","Malayalam","മലയാളം"],["mn","Mongolian","Монгол хэл"],["mr","Marathi","मराठी"],["ms","Malay","Bahasa Melayu"],["ms-Arab","Jawi Malay","بهاس ملايو"],["mt","Maltese","Malti"],["my","Burmese","ဗမာစာ"],["na","Nauru","Ekakairũ Naoero"],["nb","Norwegian Bokmål","Norsk bokmål"],["nd","Northern Ndebele","isiNdebele"],["ne","Nepali","नेपाली"],["ng","Ndonga","Owambo"],["nl","Dutch","Nederlands"],["nn","Norwegian Nynorsk","Norsk Nynorsk"],["no","Norwegian","Norsk"],["nr","Southern Ndebele","isiNdebele"],["nv","Navajo","Diné bizaad"],["ny","Chichewa","chiCheŵa"],["oc","Occitan","occitan"],["oj","Ojibwe","ᐊᓂᔑᓈᐯᒧᐎᓐ"],["om","Oromo","Afaan Oromoo"],["or","Oriya","ଓଡ଼ିଆ"],["os","Ossetian","ирон æвзаг"],["pa","Punjabi","ਪੰਜਾਬੀ"],["pi","Pāli","पाऴि"],["pl","Polish","Polski"],["ps","Pashto","پښتو"],["pt","Portuguese","Português"],["qu","Quechua","Runa Simi"],["rm","Romansh","rumantsch grischun"],["rn","Kirundi","Ikirundi"],["ro","Romanian","Română"],["ru","Russian","Русский"],["rw","Kinyarwanda","Ikinyarwanda"],["sa","Sanskrit","संस्कृतम्"],["sc","Sardinian","sardu"],["sd","Sindhi","सिन्धी"],["se","Northern Sami","Davvisámegiella"],["sg","Sango","yângâ tî sängö"],["si","Sinhala","සිංහල"],["sk","Slovak","slovenčina"],["sl","Slovenian","slovenščina"],["sn","Shona","chiShona"],["so","Somali","Soomaaliga"],["sq","Albanian","Shqip"],["sr","Serbian","српски језик"],["ss","Swati","SiSwati"],["st","Southern Sotho","Sesotho"],["su","Sundanese","Basa Sunda"],["sv","Swedish","Svenska"],["sw","Swahili","Kiswahili"],["ta","Tamil","தமிழ்"],["te","Telugu","తెలుగు"],["tg","Tajik","тоҷикӣ"],["th","Thai","ไทย"],["ti","Tigrinya","ትግርኛ"],["tk","Turkmen","Türkmen"],["tl","Tagalog","Wikang Tagalog"],["tn","Tswana","Setswana"],["to","Tonga","faka Tonga"],["tr","Turkish","Türkçe"],["ts","Tsonga","Xitsonga"],["tt","Tatar","татар теле"],["tw","Twi","Twi"],["ty","Tahitian","Reo Tahiti"],["ug","Uyghur","ئۇيغۇرچە"],["uk","Ukrainian","Українська"],["ur","Urdu","اردو"],["uz","Uzbek","Ўзбек"],["ve","Venda","Tshivenḓa"],["vi","Vietnamese","Tiếng Việt"],["vo","Volapük","Volapük"],["wa","Walloon","walon"],["wo","Wolof","Wollof"],["xh","Xhosa","isiXhosa"],["yi","Yiddish","ייִדיש"],["yo","Yoruba","Yorùbá"],["za","Zhuang","Saɯ cueŋƅ"],["zh","Chinese","中文"],["zu","Zulu","isiZulu"],["zh-CN","Chinese (China)","简体中文"],["zh-HK","Chinese (Hong Kong)","繁體中文(香港)"],["zh-TW","Chinese (Taiwan)","繁體中文(臺灣)"],["zh-YUE","Cantonese","廣東話"],["ast","Asturian","Asturianu"],["chr","Cherokee","ᏣᎳᎩ ᎦᏬᏂᎯᏍᏗ"],["ckb","Sorani (Kurdish)","سۆرانی"],["cnr","Montenegrin","crnogorski"],["csb","Kashubian","Kaszëbsczi"],["jbo","Lojban","la .lojban."],["kab","Kabyle","Taqbaylit"],["ldn","Láadan","Láadan"],["lfn","Lingua Franca Nova","lingua franca nova"],["moh","Mohawk","Kanienʼkéha"],["nds","Low German","Plattdüütsch"],["pdc","Pennsylvania Dutch","Pennsilfaani-Deitsch"],["sco","Scots","Scots"],["sma","Southern Sami","Åarjelsaemien Gïele"],["smj","Lule Sami","Julevsámegiella"],["szl","Silesian","ślůnsko godka"],["tok","Toki Pona","toki pona"],["vai","Vai","ꕙꔤ"],["xal","Kalmyk","Хальмг келн"],["zba","Balaibalan","باليبلن"],["zgh","Standard Moroccan Tamazight","ⵜⴰⵎⴰⵣⵉⵖⵜ"]],Ci="(((?:[^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\\-_&=#\\/])?))",Li="gi",ln={source:Ci,flags:Li},zi={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:Ct,PHANPY_GIPHY_API_KEY:Ai}=zi,Si=Rt.reduce((s,t)=>{const[n,a,l]=t;return s[n]={common:a,native:l},s},{}),En={300:_e(5,"minute"),1800:_e(30,"minute"),3600:_e(1,"hour"),21600:_e(6,"hour"),86400:_e(1,"day"),259200:_e(3,"day"),604800:_e(1,"week")},_i=Object.keys(En),cn=24*60*60,un=s=>{if(!s)return cn;const t=(new Date(s).getTime()-Date.now())/1e3;return _i.find(n=>n>=t)||cn},Ae=document.createElement("ul");Ae.role="listbox";Ae.className="text-expander-menu";const Ii=16,Bi=new IntersectionObserver(s=>{s.forEach(t=>{if(t.isIntersecting){const{left:n,width:a}=t.boundingClientRect,{innerWidth:l}=window;if(n+a>l){const d=Vn()?"right":"left";Ae.style[d]=l-a-Ii+"px"}}})});Bi.observe(Ae);const Ie=$n([new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages],Rt.map(s=>s[0]),"en"),Fn=new RegExp(ln.source,ln.flags),Ti=/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/gi,Di="$2xxxxxxxxxxxxxxxxxxxxxxx";function Mi(s){return s.replace(Fn,Di).replace(Ti,"$1@$3")}const Ri=/[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i,ji=new RegExp(`(^|[^=\\/\\w])(@${Ri.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,"uig"),$i=new RegExp("(^|[^=\\/\\w])(#[\\p{L}\\p{N}_]+([\\p{L}\\p{N}_.]+[\\p{L}\\p{N}_]+)?)(?![\\/\\w])","iug"),Pi="[a-zA-Z0-9_]{2,}",Oi=new RegExp(`(^|[^=\\/\\w])(:${Pi}:)(?=[^A-Za-z0-9_:]|$)`,"g"),Hi=new Intl.Segmenter;function Lt(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ni(s,{maxCharacters:t=1/0}){const{composerCharacterCount:n}=ce;if(n>t){let a="",l="";const d=Hi.segment(s);for(const{segment:r,index:h}of d)h<t?a+=r:l+=r;return l&&(l='<mark class="compose-highlight-exceeded">'+Lt(l)+"</mark>"),Lt(a)+l}return Lt(s).replace(Fn,'$2<mark class="compose-highlight-url">$3</mark>').replace(ji,'$1<mark class="compose-highlight-mention">$2</mark>').replace($i,'$1<mark class="compose-highlight-hashtag">$2</mark>').replace(Oi,'$1<mark class="compose-highlight-emoji-shortcode">$2</mark>')}const Ki=vn(s=>new Intl.RelativeTimeFormat(s||void 0)),qi=vn(s=>new Intl.ListFormat(s||void 0)),Dt=100,xe={camera:{id:"TbrCz2"},media:{id:"MfJ43d"},customEmoji:{id:"ggiJLM"},gif:{id:"Fm6c4W"},poll:{id:"cZJ92q"},scheduledPost:{id:"sX3iLV"}};function ss({onClose:s,replyToStatus:t,editStatus:n,draftStatus:a,standalone:l,hasOpener:d}){var Jt;const{i18n:r,_:h,_:b}=Se(),v=Ki(r.locale),ae=qi(r.locale),{masto:T,instance:g}=Mt(),[y,R]=H("default"),W=q((a==null?void 0:a.uid)||Gn()),j=Pn(),N=j.info,oe=bn(),{statuses:{maxCharacters:k,maxMediaAttachments:c,charactersReservedPerUrl:f}={},mediaAttachments:{supportedMimeTypes:m,imageSizeLimit:w,imageMatrixLimit:D,videoSizeLimit:L,videoMatrixLimit:X,videoFrameRateLimit:ne}={},polls:{maxOptions:Q,maxCharactersPerOption:U,maxExpiration:ye,minExpiration:pe}={}}=oe||{},re=m==null?void 0:m.filter(o=>/^(image|video)/i.test(o)),S=q(),Y=q(),[Z,ie]=H("public"),[V,ge]=H(!1),[C,P]=H(Me.session.get("currentLanguage")||Ie),M=q(C),[E,O]=H([]),[J,me]=H(null),[ue,we]=H(null),fe=Me.account.get("preferences")||{},mt=()=>{S.current&&S.current.dispatchEvent(new Event("input"))},Je=()=>{setTimeout(()=>{var o,u,F;S.current&&((u=(o=a==null?void 0:a.status)==null?void 0:o.startsWith)!=null&&u.call(o,`
|
||
`)&&(S.current.selectionStart=0,S.current.selectionEnd=0),(F=S.current)==null||F.focus())},300)};se(()=>{var o,u;if(t){const{spoilerText:F,visibility:p,language:_,sensitive:z}=t;F&&Y.current&&(Y.current.value=F);const A=[...new Set([t.account.acct,...t.mentions.map(x=>x.acct)])].filter(x=>x!==N.acct);A.length>0&&(S.current.value=`${A.map(x=>`@${x}`).join(" ")} `,mt()),Je(),ie(p==="public"&&fe["posting:default:visibility"]?fe["posting:default:visibility"].toLowerCase():p),P(_||((o=fe["posting:default:language"])==null?void 0:o.toLowerCase())||Ie),ge(z&&!!F)}else if(n){const{visibility:F,language:p,sensitive:_,poll:z,mediaAttachments:I}=n,A=!!(z!=null&&z.options)&&{...z,options:z.options.map(x=>(x==null?void 0:x.title)||x),expiresIn:(z==null?void 0:z.expiresIn)||un(z.expiresAt)};R("loading"),(async()=>{var x;try{const ee=await T.v1.statuses.$select(n.id).source.fetch(),{text:le,spoilerText:ve}=ee;S.current.value=le,S.current.dataset.source=le,mt(),Je(),Y.current.value=ve,ie(F),P(p||((x=fe["posting:default:language"])==null?void 0:x.toLowerCase())||Ie),ge(_),A&&me(A),O(I),R("default")}catch(ee){alert((ee==null?void 0:ee.reason)||ee),R("error")}})()}else Je(),fe["posting:default:visibility"]&&ie(fe["posting:default:visibility"].toLowerCase()),fe["posting:default:language"]&&P(fe["posting:default:language"].toLowerCase()),fe["posting:default:sensitive"]&&ge(!!fe["posting:default:sensitive"]);if(a){const{status:F,spoilerText:p,visibility:_,language:z,sensitive:I,poll:A,mediaAttachments:x,scheduledAt:ee}=a,le=!!(A!=null&&A.options)&&{...A,options:A.options.map(ve=>(ve==null?void 0:ve.title)||ve),expiresIn:(A==null?void 0:A.expiresIn)||un(A.expiresAt)};S.current.value=F,mt(),Je(),p&&(Y.current.value=p),_&&ie(_),P(z||((u=fe["posting:default:language"])==null?void 0:u.toLowerCase())||Ie),I!==null&&ge(I),le&&me(le),x&&O(x),ee&&we(ee)}},[a,n,t]);const $t=q(),Pt=b({id:"hR9gtK"}),gt=()=>{const{value:o,dataset:u}=S.current;if(y==="loading")return!1;const F=(o||"").trim().replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$","gu"),""),p=E.length>0;if(!F&&!p||E.length>0&&E.every(x=>x.id))return!0;const z=(t==null?void 0:t.account.id)===N.id,I=t&&o.trim()===`@${t.account.acct}`;return!!(!z&&I||o===(u==null?void 0:u.source))},ft=()=>gt()?!0:confirm(Pt);se(()=>{const o=u=>{gt()||(u.preventDefault(),u.returnValue=Pt)};return window.addEventListener("beforeunload",o,{capture:!0}),()=>window.removeEventListener("beforeunload",o,{capture:!0})},[]);const zn=()=>{const{value:o}=S.current,{value:u}=Y.current;return rn(Mi(o))+rn(u)},vt=()=>{const o=zn();ce.composerCharacterCount=o};se(vt,[]);const Ot=window.CloseWatcher,bt=q(!1);qe("esc",()=>{bt.current=!0},{enabled:!Ot,enableOnFormTags:!0}),qe("esc",()=>{!l&&bt.current&&ft()&&s(),bt.current=!1},{enabled:!Ot,enableOnFormTags:!0,keyup:!0,ignoreEventWhen:()=>{const o=document.querySelectorAll("#modal-container > *"),u=!!o,F=o.length===1&&o[0].querySelector("#compose-container");return u&&!F}}),Yn(()=>{!l&&ft()&&s()},[]);const Ht=q({}),Nt=()=>`${On()}#${W.current}`,xt=()=>{if(n||ce.composerState.minimized)return;const o=Nt(),u={key:o,replyTo:t?{id:t.id,account:{id:t.account.id,username:t.account.username,acct:t.account.acct}}:null,draftStatus:{uid:W.current,status:S.current.value,spoilerText:Y.current.value,visibility:Z,language:C,sensitive:V,poll:J,mediaAttachments:E,scheduledAt:ue}};!Hn(u,Ht.current)&&!gt()&&(en.drafts.set(o,{...u,state:"unsaved",updatedAt:Date.now()}).then(()=>{}).catch(F=>{}),Ht.current=structuredClone(u))};Zn(xt,5e3),se(()=>(xt(),()=>{en.drafts.del(Nt())}),[]),se(()=>{const o=F=>{const{items:p}=F.clipboardData||F.dataTransfer,_=[],z=[];for(let I=0;I<p.length;I++){const A=p[I];if(A.kind==="file"){const x=A.getAsFile();m!==void 0&&!m.includes(x.type)?z.push(x):_.push(x)}}if(z.length>0&&alert(Ne._({id:"rpXAF6",values:{0:z.length,1:z[0].name,2:ae.format(z.map(I=>I.name))}})),_.length>0&&E.length>=c){alert(Ne._({id:"ctFhjs",values:{maxMediaAttachments:c}}));return}if(_.length>0){F.preventDefault(),F.stopPropagation();let I=_;if(c!==void 0){const x=c-E.length;if(I=I.slice(0,x),I.length<=0){alert(Ne._({id:"ctFhjs",values:{maxMediaAttachments:c}}));return}}const A=I.map(x=>({file:x,type:x.type,size:x.size,url:URL.createObjectURL(x),id:null,description:null}));O([...E,...A])}};window.addEventListener("paste",o);const u=F=>{F.dataTransfer.items.length>0&&(F.preventDefault(),F.stopPropagation())};return window.addEventListener("dragover",u),window.addEventListener("drop",o),()=>{window.removeEventListener("paste",o),window.removeEventListener("dragover",u),window.removeEventListener("drop",o)}},[E]);const[Xe,yt]=H(!1),[Qe,He]=H(!1),[An,et]=H(!1),[Ee,Sn]=H(null),[_n,In]=We(()=>{const o=[],u=[],{contentTranslationHideLanguages:F=[]}=ce.settings;return Rt.forEach(p=>{const[_]=p;_===C||_===M.current||_===Ie||F.includes(_)||Ee!=null&&Ee.length&&Ee.includes(_)?o.push(p):u.push(p)}),o.sort(([p,_],[z,I])=>p===C?-1:z===C?1:_.localeCompare(I)),u.sort(([p,_],[z,I])=>_.localeCompare(I)),[o,u]},[C,Ee]),Kt=We(()=>!!(t!=null&&t.createdAt)&&Math.floor((Date.now()-new Date(t.createdAt))/(1e3*60*60*24*30)),[t]),Bn=()=>{xt(),ce.composerState.minimized=!0},qt=y==="loading"||c!==void 0&&E.length>=c||!!J,Wt=Q==null||Q>1,Ut=y==="loading"||!!J||!!E.length,Vt=()=>{me({options:["",""],expiresIn:24*60*60,multiple:!1})},tt=q(),[Tn,Dn]=H(!1);Jn({ref:tt,box:"border-box",onResize:({width:o})=>{const{scrollWidth:u}=tt.current,F=u>o,p=o<84;Dn(p||F),tt.current.hidden=p}});const Gt=!n,Yt=y==="loading"||!!ue,Zt=()=>{const o=new Date(Date.now()+Xn);we(o)};return e("div",{id:"compose-container-outer",children:[e("div",{id:"compose-container",class:l?"standalone":"",children:[e("div",{class:"compose-top",children:[(N==null?void 0:N.avatarStatic)&&e(yn,{account:N,accountInstance:j.instanceURL,hideDisplayName:!0,useAvatarStatic:!0}),l?d&&e("button",{type:"button",class:"light pop-button",disabled:y==="loading",onClick:()=>{var o;if(!window.opener){alert(b({id:"qiPXgY"}));return}if(window.opener.__STATES__.showCompose){if((o=window.opener.__STATES__.composerState)!=null&&o.publishing){alert(b({id:"Z2l5Bt"}));return}let u=b({id:"AB/GtR"});if(!confirm(u))return}s({fn:()=>{const u={editStatus:n,replyToStatus:t,draftStatus:{uid:W.current,status:S.current.value,spoilerText:Y.current.value,visibility:Z,language:C,sensitive:V,poll:J,mediaAttachments:E,scheduledAt:ue}};window.opener.__COMPOSE__=u,window.opener.__STATES__.showCompose?(window.opener.__STATES__.showCompose=!1,setTimeout(()=>{window.opener.__STATES__.showCompose=!0},10)):window.opener.__STATES__.showCompose=!0,window.opener.__STATES__.composerState.minimized&&(window.opener.__STATES__.composerState.minimized=!1)}})},children:e($,{icon:"popin",alt:b({id:"/5ZKeE"})})}):e("span",{class:"compose-controls",children:[e("button",{type:"button",class:"plain4 pop-button",disabled:y==="loading",onClick:()=>{Qn({editStatus:n,replyToStatus:t,draftStatus:{uid:W.current,status:S.current.value,spoilerText:Y.current.value,visibility:Z,language:C,sensitive:V,poll:J,mediaAttachments:E,scheduledAt:ue}})&&s()},children:e($,{icon:"popout",alt:b({id:"JsU2En"})})}),e("button",{type:"button",class:"plain4 min-button",onClick:Bn,children:e($,{icon:"minimize",alt:b({id:"3TSz9S"})})})," ",e("button",{type:"button",class:"light close-button",disabled:y==="loading",onClick:()=>{ft()&&s()},children:e($,{icon:"x",alt:b({id:"yz7wBu"})})})]})]}),!!t&&e("div",{class:"status-preview",children:[e(tn,{status:t,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend reply-to",children:Kt>0?e(K,{id:"Q1Huya",values:{0:t.account.acct||t.account.username,1:v.format(-Kt,"month")},components:{0:e("strong",{})}}):e(K,{id:"dwLCPZ",values:{0:t.account.acct||t.account.username}})})]}),!!n&&e("div",{class:"status-preview",children:[e(tn,{status:n,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend",children:e(K,{id:"wKtOLH"})})]}),e("form",{ref:$t,class:`form-visibility-${Z}`,style:{pointerEvents:y==="loading"?"none":"auto",opacity:y==="loading"?.5:1},onKeyDown:o=>{o.key==="Enter"&&(o.ctrlKey||o.metaKey)&&$t.current.dispatchEvent(new Event("submit",{cancelable:!0}))},onSubmit:o=>{o.preventDefault();const u=new FormData(o.target),F=Object.fromEntries(u.entries());let{status:p,visibility:_,sensitive:z,spoilerText:I,scheduledAt:A}=F;if(z=z==="on",A=A?new Date(A).toISOString():void 0,J){if(J.options.length<2){alert(b({id:"zhrMYj"}));return}if(J.options.some(x=>x==="")){alert(b({id:"uNVxXX"}));return}}E.length>0&&E.some(ee=>{var le,ve;return!((ve=(le=ee.description)==null?void 0:le.trim)!=null&&ve.call(le))})&&!confirm(b({id:"MQYucx"}))||(I=z&&I||void 0,p=p===""?void 0:p,ce.composerState.publishing=!0,R("loading"),(async()=>{try{if(E.length>0){const le=E.map(Fe=>{const{file:nt,description:Mn,id:Rn}=Fe;if(Rn)return Fe;{const jn=fn({file:nt,description:Mn});return T.v2.media.create(jn).then(wt=>(wt.id&&(Fe.id=wt.id),wt))}}),ve=await Promise.allSettled(le);if(ve.some(Fe=>{var nt;return Fe.status==="rejected"||!((nt=Fe.value)!=null&&nt.id)})){ce.composerState.publishing=!1,ce.composerState.publishingError=!0,R("error"),ve.forEach(Fe=>{Fe.status==="rejected"&&alert(Fe.reason||b({id:"eIiurD",values:{i}}))});return}}let x={status:p,spoiler_text:I,language:C,sensitive:z,poll:J,media_ids:E.map(le=>le.id)};n&&at("@mastodon/edit-media-attributes")?x.media_attributes=E.map(le=>({id:le.id,description:le.description})):n||(x.visibility=_,x.in_reply_to_id=(t==null?void 0:t.id)||void 0,x.scheduled_at=A),x=fn(x);let ee;if(n)ee=await T.v1.statuses.$select(n.id).update(x),Kn(ee,g,{skipThreading:!0});else try{ee=await T.v1.statuses.create(x,{requestInit:{headers:{"Idempotency-Key":W.current}}})}catch{ee=await T.v1.statuses.create(x)}ce.composerState.minimized=!1,ce.composerState.publishing=!1,R("default"),s({type:n?"edit":t?"reply":"post",newStatus:ee,instance:g,scheduledAt:A})}catch(x){ce.composerState.publishing=!1,ce.composerState.publishingError=!0,alert((x==null?void 0:x.reason)||x),R("error")}})())},children:[e("div",{class:"toolbar stretch",children:[e("input",{ref:Y,type:"text",name:"spoilerText",placeholder:b({id:"gnKo7f"}),disabled:y==="loading",class:"spoiler-text-field",lang:C,spellCheck:"true",dir:"auto",style:{opacity:V?1:0,pointerEvents:V?"auto":"none"},onInput:()=>{vt()}}),e("label",{class:`toolbar-button ${V?"highlight":""}`,title:b({id:"zKu2Aq"}),children:[e("input",{name:"sensitive",type:"checkbox",checked:V,disabled:y==="loading",onChange:o=>{var F,p;const u=o.target.checked;ge(u),u?(F=Y.current)==null||F.focus():(p=S.current)==null||p.focus()}}),e($,{icon:`eye-${V?"close":"open"}`})]})," ",e("label",{class:`toolbar-button ${Z!=="public"&&!V?"show-field":""} ${Z!=="public"?"highlight":""}`,title:Z,children:[e($,{icon:ei[Z],alt:Z}),e("select",{name:"visibility",value:Z,onChange:o=>{ie(o.target.value)},disabled:y==="loading"||!!n,dir:"auto",children:[e("option",{value:"public",children:e(K,{id:"7d1a0d"})}),(at("@pleroma/local-visibility-post")||at("@akkoma/local-visibility-post"))&&e("option",{value:"local",children:e(K,{id:"d5zxa4"})}),e("option",{value:"unlisted",children:e(K,{id:"WDcQq9"})}),e("option",{value:"private",children:e(K,{id:"o34OrG"})}),e("option",{value:"direct",children:e(K,{id:"IV4QaU"})})]})]})," "]}),e(Vi,{ref:S,placeholder:b(t?{id:"Sjj+EN"}:n?{id:"qzVesX"}:{id:"owpNF1"}),required:(E==null?void 0:E.length)===0,disabled:y==="loading",lang:C,onInput:()=>{vt()},maxCharacters:k,performSearch:o=>{const{type:u,q:F,limit:p}=o;return u==="accounts"?T.v1.accounts.search.list({q:F,limit:p,resolve:!1}):T.v2.search.fetch(o)},onTrigger:o=>{(o==null?void 0:o.name)==="custom-emojis"?He({defaultSearchTerm:(o==null?void 0:o.defaultSearchTerm)||null}):(o==null?void 0:o.name)==="mention"?yt({defaultSearchTerm:(o==null?void 0:o.defaultSearchTerm)||null}):(o==null?void 0:o.name)==="auto-detect-language"&&(o!=null&&o.languages)&&Sn(o.languages)}}),(E==null?void 0:E.length)>0&&e("div",{class:"media-attachments",children:[E.map((o,u)=>{const{id:F,file:p}=o,_=(p==null?void 0:p.size)+(p==null?void 0:p.type)+(p==null?void 0:p.name);return e(Yi,{attachment:o,disabled:y==="loading",lang:C,onDescriptionChange:z=>{O(I=>{const A=[...I];return A[u]={...A[u],description:z},A})},onRemove:()=>{O(z=>z.filter((I,A)=>A!==u))}},F||_||u)}),e("label",{class:"media-sensitive",children:[e("input",{name:"sensitive",type:"checkbox",checked:V,disabled:y==="loading",onChange:o=>{const u=o.target.checked;ge(u)}})," ",e("span",{children:e(K,{id:"jER18a"})})," ",e($,{icon:`eye-${V?"close":"open"}`})]})]}),!!J&&e(Zi,{lang:C,maxOptions:Q,maxExpiration:ye,minExpiration:pe,maxCharactersPerOption:U,poll:J,disabled:y==="loading",onInput:o=>{if(o){const u={...o};me(u)}else me(null)}}),ue&&e("div",{class:"toolbar scheduled-at",children:[e("button",{type:"button",class:"plain4 small",onClick:()=>{we(null)},children:e($,{icon:"x"})}),e("label",{children:[e(K,{id:"GKuKcZ",components:{0:e(ti,{scheduledAt:ue,setScheduledAt:we})}}),e("br",{}),e("small",{children:ni()})]})]}),e("div",{class:"toolbar compose-footer",children:[e("span",{class:"add-toolbar-button-group spacer",children:[Tn&&e(wn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},menuButton:({open:o})=>e("button",{type:"button",class:`toolbar-button add-button ${o?"active":""}`,children:e($,{icon:"plus",title:b({id:"m16xKo"})})}),children:[dn&&e(ze,{className:"compose-menu-add-media",children:[e("label",{class:"compose-menu-add-media-field",children:e(hn,{hidden:!0,supportedMimeTypes:re,disabled:y==="loading"||E.length>=c||!!J,setMediaAttachments:O})}),e($,{icon:"camera"})," ",e("span",{children:h(xe.camera)})]}),e(ze,{className:"compose-menu-add-media",children:[e("label",{class:"compose-menu-add-media-field",children:e(pn,{hidden:!0,supportedMimeTypes:m,maxMediaAttachments:c,mediaAttachments:E,disabled:y==="loading"||E.length>=c||!!J,setMediaAttachments:O})}),e($,{icon:"media"})," ",e("span",{children:h(xe.media)})]}),e(ze,{onClick:()=>{He(!0)},children:[e($,{icon:"emoji2"})," ",e("span",{children:h(xe.customEmoji)})]}),!!ce.settings.composerGIFPicker&&e(ze,{disabled:qt,onClick:()=>{et(!0)},children:[e("span",{class:"icon icon-gif",role:"img"}),e("span",{children:h(xe.gif)})]}),Wt&&e(ze,{disabled:Ut,onClick:Vt,children:[e($,{icon:"poll"})," ",e("span",{children:h(xe.poll)})]}),Gt&&e(ze,{disabled:Yt,onClick:Zt,children:[e($,{icon:"schedule"})," ",e("span",{children:h(xe.scheduledPost)})]})]}),e("span",{class:"add-sub-toolbar-button-group",ref:tt,children:[dn&&e("label",{class:"toolbar-button",children:[e(hn,{supportedMimeTypes:re,mediaAttachments:E,disabled:y==="loading"||E.length>=c||!!J,setMediaAttachments:O}),e($,{icon:"camera",alt:h(xe.camera)})]}),e("label",{class:"toolbar-button",children:[e(pn,{supportedMimeTypes:m,maxMediaAttachments:c,mediaAttachments:E,disabled:y==="loading"||E.length>=c||!!J,setMediaAttachments:O}),e($,{icon:"media",alt:h(xe.media)})]}),e("button",{type:"button",class:"toolbar-button",disabled:y==="loading",onClick:()=>{He(!0)},children:e($,{icon:"emoji2",alt:h(xe.customEmoji)})}),!!ce.settings.composerGIFPicker&&e("button",{type:"button",class:"toolbar-button gif-picker-button",disabled:qt,onClick:()=>{et(!0)},children:e("span",{class:"icon icon-gif","aria-label":h(xe.gif)})}),Wt&&e(Ue,{children:e("button",{type:"button",class:"toolbar-button",disabled:Ut,onClick:Vt,children:e($,{icon:"poll",alt:h(xe.poll)})})}),Gt&&e("button",{type:"button",class:`toolbar-button ${ue?"highlight":""}`,disabled:Yt,onClick:Zt,children:e($,{icon:"schedule",alt:h(xe.scheduledPost)})})]})]}),y==="loading"?e(ht,{abrupt:!0}):e(Gi,{maxCharacters:k,hidden:y==="loading"}),e("label",{class:`toolbar-button ${C!==M.current||Ee!=null&&Ee.length&&!Ee.includes(C)?"highlight":""}`,children:[e("span",{class:"icon-text",children:(Jt=Si[C])==null?void 0:Jt.native}),e("select",{name:"language",value:C,onChange:o=>{const{value:u}=o.target;P(u||Ie),Me.session.set("currentLanguage",u||Ie)},disabled:y==="loading",dir:"auto",children:[_n.map(([o,u,F])=>{const p=At({code:o,fallback:u});return e("option",{value:o,children:p!==F?`${F} - ${p}`:p},o)}),e("hr",{}),In.map(([o,u,F])=>{const p=At({code:o,fallback:u});return e("option",{value:o,children:p!==F?`${F} - ${p}`:p},o)})]})]})," ",e("button",{type:"submit",disabled:y==="loading",children:b(ue?{id:"gmB6oO"}:t?{id:"ImOQa9"}:n?{id:"EkH9pt"}:{id:"GMe2XV"})})]})]})]}),Xe&&e(ot,{onClose:()=>{yt(!1)},children:e(Ji,{masto:T,instance:g,onClose:()=>{yt(!1)},defaultSearchTerm:Xe==null?void 0:Xe.defaultSearchTerm,onSelect:o=>{const u=S.current;if(!u)return;const{selectionStart:F,selectionEnd:p}=u,_=u.value,z=_.slice(0,F),I=z?/[\s\t\n\r]$/.test(z)?"":" ":"",A=_.slice(p),x=/^[\s\t\n\r]/.test(A)?"":" ",ee=z+I+"@"+o+x+A;u.value=ee,u.selectionStart=u.selectionEnd=p+1+o.length+x.length,u.focus(),u.dispatchEvent(new Event("input"))}})}),Qe&&e(ot,{onClose:()=>{He(!1)},children:e(Xi,{masto:T,instance:g,onClose:()=>{He(!1)},defaultSearchTerm:Qe==null?void 0:Qe.defaultSearchTerm,onSelect:o=>{const u=S.current;if(!u)return;const{selectionStart:F,selectionEnd:p}=u,_=u.value,z=_.slice(0,F),I=z?/[\s\t\n\r]$/.test(z)?"":" ":"",A=_.slice(p),x=/^[\s\t\n\r]/.test(A)?"":" ",ee=z+I+o+x+A;u.value=ee,u.selectionStart=u.selectionEnd=p+o.length+x.length,u.focus(),u.dispatchEvent(new Event("input"))}})}),An&&e(ot,{onClose:()=>{et(!1)},children:e(es,{onClose:()=>et(!1),onSelect:({url:o,type:u,alt_text:F})=>{if(E.length>=c){alert(Ne._({id:"ctFhjs",values:{maxMediaAttachments:c}}));return}(async()=>{var _,z;let p;try{p=Be({text:b({id:"/Cw4Tx"}),duration:-1});const I=await fetch(o,{referrerPolicy:"no-referrer"}).then(ee=>ee.blob()),A=new File([I],u==="video/mp4"?"video.mp4":"image.gif",{type:u}),x=[...E,{file:A,type:u,size:A.size,id:null,description:F||""}];O(x),(_=p==null?void 0:p.hideToast)==null||_.call(p)}catch{(z=p==null?void 0:p.hideToast)==null||z.call(p),Be(b({id:"VKDnAx"}))}})()}})})]})}const dn="capture"in document.createElement("input");function hn({hidden:s,disabled:t=!1,supportedMimeTypes:n,setMediaAttachments:a}){return e("input",{type:"file",hidden:s,accept:n==null?void 0:n.join(","),capture:"environment",disabled:t,onChange:l=>{const d=l.target.files;if(!d)return;const r=Array.from(d)[0];r&&(a(h=>[...h,{file:r,type:r.type,size:r.size,url:URL.createObjectURL(r),id:null,description:null}]),l.target.value=null)}})}function pn({hidden:s,supportedMimeTypes:t,maxMediaAttachments:n,mediaAttachments:a,disabled:l=!1,setMediaAttachments:d}){return e("input",{type:"file",hidden:s,accept:t==null?void 0:t.join(","),multiple:n===void 0||n-a>=2,disabled:l,onChange:r=>{const h=r.target.files;if(!h)return;const b=Array.from(h).map(v=>({file:v,type:v.type,size:v.size,url:URL.createObjectURL(v),id:null,description:null}));a.length+b.length>n?alert(Ne._({id:"ctFhjs",values:{maxMediaAttachments:n}})):d(v=>v.concat(b)),r.target.value=""}})}function mn(s){if(!s)return;const{value:t,offsetHeight:n,scrollHeight:a,clientHeight:l}=s;if(n<window.innerHeight){const d=n-l,r=t?a+d+"px":null;s.style.height=r}}async function Wi(s,t){const a=(await t.v1.customEmojis.list()).filter(d=>d.visibleInPicker),l=new ii(a,{keys:["shortcode"],findAllMatches:!0});return[a,l]}const Cn=qn(Wi,{matchesArg:(s,t)=>s.instance===t.instance,maxAge:30*60*1e3}),Ui=async s=>{if(nn){const a=await nn.detect(s);if(a!=null&&a.length)return a.slice(0,2).map(l=>l.detectedLanguage)}const{detectAll:t}=await Wn(async()=>{const{detectAll:a}=await import("./tinyld-light-CT4H0yPw.js");return{detectAll:a}},[],import.meta.url),n=t(s);return n!=null&&n.length?n.slice(0,2).map(a=>a.lang):null},Vi=Nn((s,t)=>{var k;const{_:n}=Se(),{masto:a,instance:l}=Mt(),[d,r]=H(((k=t.current)==null?void 0:k.value)||""),{maxCharacters:h,performSearch:b=()=>{},onTrigger:v=()=>{},...ae}=s,T=q();se(()=>{Cn(l,a).then(c=>{const[f,m]=c;T.current=m}).catch(c=>{})},[]);const g=q(),y=q(""),R=q(!1);se(()=>{let c,f,m,w,D;return g.current&&(c=L=>{var ye;const{key:X,provide:ne,text:Q}=L.detail;if(y.current=Q,Q===""){ne(Promise.resolve({matched:!1}));return}if(X===":"){const pe=(ye=T.current)==null?void 0:ye.search(Q,{limit:5});let re="";pe.forEach(({item:S})=>{const{shortcode:Y,url:Z}=S;re+=`
|
||
<li role="option" data-value="${Le(Y)}">
|
||
<img src="${Le(Z)}" width="16" height="16" alt="" loading="lazy" />
|
||
${Le(Y)}
|
||
</li>`}),re+=`<li role="option" data-value="" data-more="${Q}">${n({id:"24misb"})}</li>`,Ae.innerHTML=re,ne(Promise.resolve({matched:pe.length>0,fragment:Ae}));return}const U={"@":"accounts","#":"hashtags"}[X];ne(new Promise(pe=>{b({type:U,q:Q,limit:5}).then(S=>{if(Q!==y.current)return;const Y=S[U]||S;let Z="";Y.forEach(ie=>{var me;const{name:V,avatarStatic:ge,displayName:C,username:P,acct:M,emojis:E,history:O}=ie,J=si(C,E);if(M)Z+=`
|
||
<li role="option" data-value="${Le(M)}">
|
||
<span class="avatar">
|
||
<img src="${Le(ge)}" width="16" height="16" alt="" loading="lazy" />
|
||
</span>
|
||
<span>
|
||
<b>${J||P}</b>
|
||
<br><span class="bidi-isolate">@${Le(M)}</span>
|
||
</span>
|
||
</li>
|
||
`;else{const ue=(me=O==null?void 0:O.reduce)==null?void 0:me.call(O,(we,fe)=>we+ +fe.uses,0);Z+=`
|
||
<li role="option" data-value="${Le(V)}">
|
||
<span class="grow">#<b>${Le(V)}</b></span>
|
||
${ue?`<span class="count">${ai(ue)}</span>`:""}
|
||
</li>
|
||
`}}),U==="accounts"&&(Z+=`<li role="option" data-value="" data-more="${Q}">${n({id:"24misb"})}</li>`),Ae.innerHTML=Z,pe({matched:Y.length>0,fragment:Ae})})}))},g.current.addEventListener("text-expander-change",c),f=L=>{const{key:X,item:ne}=L.detail,{value:Q,more:U}=ne.dataset;X===":"?(L.detail.value=Q?`:${Q}:`:"",U&&(L.detail.continue=!0,setTimeout(()=>{v==null||v({name:"custom-emojis",defaultSearchTerm:U})},300))):X==="@"?(L.detail.value=Q?`@${Q} `:"",U&&(L.detail.continue=!0,setTimeout(()=>{v==null||v({name:"mention",defaultSearchTerm:U})},300))):L.detail.value=`${X}${Q}`},g.current.addEventListener("text-expander-value",f),m=L=>{const{input:X}=L.detail;if(r(X.value),t.current){const ne=new Event("input",{bubbles:!0});t.current.dispatchEvent(ne)}},g.current.addEventListener("text-expander-committed",m),w=()=>{R.current=!0},g.current.addEventListener("text-expander-activate",w),D=()=>{R.current=!1},g.current.addEventListener("text-expander-deactivate",D)),()=>{g.current&&(g.current.removeEventListener("text-expander-change",c),g.current.removeEventListener("text-expander-value",f),g.current.removeEventListener("text-expander-committed",m),g.current.removeEventListener("text-expander-activate",w),g.current.removeEventListener("text-expander-deactivate",D))}},[]),se(()=>{const c=t.current;if(!c)return;new ResizeObserver(()=>{if(g.current){const{height:m}=c.getBoundingClientRect();g.current.style.height=m+"px"}}).observe(c)},[]);const W=q(0),j=q(),N=oi(c=>{var w;if(!j.current)return;if(W.current>3){j.current.innerHTML="",j.current=null,(w=N==null?void 0:N.cancel)==null||w.call(N);return}let f,m;W.current<=3&&(f=Date.now()),j.current.innerHTML=Ni(c,{maxCharacters:h})+`
|
||
`,W.current<=3&&(m=Date.now()),f&&m&&m-f>50&&W.current++},500),oe=pt(()=>{var m,w;const c=(m=j.current)==null?void 0:m.cloneNode(!0);if(!c)return;c.querySelectorAll("mark").forEach(D=>{D.remove()});const f=(w=c.innerText)==null?void 0:w.trim();f&&(async()=>{const D=await Ui(f);D!=null&&D.length&&(v==null||v({name:"auto-detect-language",languages:D}))})()},2e3);return e("text-expander",{ref:g,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",...ae,ref:t,name:"status",value:d,onKeyDown:c=>{const{key:f,target:m}=c,w=R.current;if(f==="Enter"&&!(c.ctrlKey||c.metaKey||w))try{const{value:D,selectionStart:L}=m,ne=D.slice(0,L).split(`
|
||
`).slice(-1)[0];if(ne&&/^\s*(-|\d+\.)\s/.test(ne)){const[Q,U,ye,pe,re]=ne.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(re){c.preventDefault();const[S]=ye.match(/\d+/)||[],Y=S?`${+S+1}.`:"-",Z=`
|
||
${U}${Y}${pe}`;m.setRangeText(Z,L,L);const ie=L+Z.length;m.setSelectionRange(ie,ie)}else{const S=L-ne.length;m.setRangeText("",S,L)}mn(m),m.dispatchEvent(new Event("input"))}}catch{}j.current&&(j.current.scrollTop=m.scrollTop)},onInput:c=>{var w;const{target:f}=c,m=f.value.replace(/\u200b/g,"");r(m),mn(f),(w=s.onInput)==null||w.call(s,c),N(m),oe()},style:{width:"100%",height:"4em"},onScroll:c=>{if(j.current){const{scrollTop:f}=c.target;j.current.scrollTop=f}}}),e("div",{ref:j,class:"compose-highlight","aria-hidden":"true"})]})});function Gi({maxCharacters:s=500,hidden:t}){const a=Un(ce).composerCharacterCount,l=s-a;return t?e("span",{class:"char-counter",hidden:!0}):e("span",{class:"char-counter",title:`${l}/${s}`,style:{"--percentage":a/s*100},children:[e("meter",{class:`${l<=-10?"explode":l<=0?"danger":l<=20?"warning":""}`,value:a,max:s}),e("span",{class:"counter",children:l})]})}function gn(s,t,n,a){const l=Math.sqrt(t/s),d=Math.floor(n*l),r=Math.floor(a*l);return{newWidth:d,newHeight:r}}function Yi({attachment:s,disabled:t,lang:n,onDescriptionChange:a=()=>{},onRemove:l=()=>{}}){const{i18n:d,_:r}=Se(),[h,b]=H("default"),v=at("@mastodon/edit-media-attributes"),{type:ae,id:T,file:g}=s,y=We(()=>g?URL.createObjectURL(g):s.url,[g,s.url]),R=!!(g!=null&&g.size),W=R?bn():{},{mediaAttachments:{imageSizeLimit:j,imageMatrixLimit:N,videoSizeLimit:oe,videoMatrixLimit:k,videoFrameRateLimit:c}={}}=W||{},[f,m]=H(()=>R?ae.startsWith("image")&&j&&g.size>j?{type:"imageSizeLimit",details:{imageSize:g.size,imageSizeLimit:j}}:ae.startsWith("video")&&oe&&g.size>oe?{type:"videoSizeLimit",details:{videoSize:g.size,videoSizeLimit:oe}}:null:null),[w,D]=H({});se(()=>{!R||!N||(w==null?void 0:w.matrix)>N&&m({type:"imageMatrixLimit",details:{imageMatrix:w==null?void 0:w.matrix,imageMatrixLimit:N,width:w==null?void 0:w.width,height:w==null?void 0:w.height}})},[w,N,R]);const[L,X]=H({});se(()=>{!R||!k||(L==null?void 0:L.matrix)>k&&m({type:"videoMatrixLimit",details:{videoMatrix:L==null?void 0:L.matrix,videoMatrixLimit:k,width:L==null?void 0:L.width,height:L==null?void 0:L.height}})},[L,k,R]);const[ne,Q]=H(s.description),[U,ye]=ae.split("/"),pe=pt(a,250);se(()=>{pe(ne)},[ne,pe]);const[re,S]=H(!1),Y=q(null);se(()=>{let C;return re&&Y.current&&(C=setTimeout(()=>{Y.current.focus()},100)),()=>{clearTimeout(C)}},[re]);const Z=e(Ue,{children:T&&!v?e("div",{class:"media-desc",children:[e("span",{class:"tag",children:e(K,{id:"3wG7HI"})}),e("p",{title:ne,children:s.description||e("i",{children:"No description"})})]}):e("textarea",{ref:Y,value:ne||"",lang:n,placeholder:{image:r({id:"Lh8B0N"}),video:r({id:"mN4S+e"}),audio:r({id:"ieZytw"})}[U],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:t||h==="loading",class:h==="loading"?"loading":"",maxlength:"1500",onInput:C=>{const{value:P}=C.target;Q(P)}})}),ie=q(null);se(()=>()=>{var C,P;(P=(C=ie.current)==null?void 0:C.hideToast)==null||P.call(C)},[]);const V=q(null),ge=C=>{const{type:P,details:M}=C;switch(P){case"imageSizeLimit":{const{imageSize:E,imageSizeLimit:O}=M;return r({id:"d83/LB",values:{0:it(E),1:it(O)}})}case"imageMatrixLimit":{const{imageMatrix:E,imageMatrixLimit:O,width:J,height:me}=M,{newWidth:ue,newHeight:we}=gn(E,O,J,me);return r({id:"TQrVea",values:{2:d.number(J),3:d.number(me),4:d.number(ue),5:d.number(we)}})}case"videoSizeLimit":{const{videoSize:E,videoSizeLimit:O}=M;return r({id:"J5GTer",values:{6:it(E),7:it(O)}})}case"videoMatrixLimit":{const{videoMatrix:E,videoMatrixLimit:O,width:J,height:me}=M,{newWidth:ue,newHeight:we}=gn(E,O,J,me);return r({id:"OG73zj",values:{8:d.number(J),9:d.number(me),10:d.number(ue),11:d.number(we)}})}case"videoFrameRateLimit":return r({id:"S1fBwy"})}};return e(Ue,{children:[e("div",{class:"media-attachment",children:[e("div",{class:"media-preview",tabIndex:"0",onClick:()=>{S(!0)},children:U==="image"?e("img",{src:y,alt:"",onLoad:C=>{if(!R)return;const{naturalWidth:P,naturalHeight:M}=C.target;D({matrix:P*M,width:P,height:M})}}):U==="video"||U==="gifv"?e("video",{src:y+"#t=0.1",playsinline:!0,muted:!0,disablePictureInPicture:!0,preload:"metadata",onLoadedMetadata:C=>{if(!R)return;const{videoWidth:P,videoHeight:M}=C.target;P&&M&&X({matrix:P*M,width:P,height:M})}}):U==="audio"?e("audio",{src:y,controls:!0}):null}),Z,e("div",{class:"media-aside",children:[e("button",{type:"button",class:"plain close-button",disabled:t,onClick:l,children:e($,{icon:"x",alt:r({id:"t/YqKh"})})}),!!f&&e("button",{type:"button",class:"media-error",title:ge(f),onClick:()=>{V.current&&V.current.hideToast(),V.current=Be({text:ge(f),duration:1e4})},children:e($,{icon:"alert",alt:r({id:"SlfejT"})})})]})]}),re&&e(ot,{onClose:()=>{S(!1)},children:e("div",{id:"media-sheet",class:"sheet sheet-max",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>{S(!1)},children:e($,{icon:"x",alt:r({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:{image:r({id:"oMslIB"}),video:r({id:"WZw+zB"}),audio:r({id:"KMtgtM"})}[U]})}),e("main",{tabIndex:"-1",children:[e("div",{class:"media-preview",children:U==="image"?e("img",{src:y,alt:""}):U==="video"||U==="gifv"?e("video",{src:y,playsinline:!0,controls:!0}):U==="audio"?e("audio",{src:y,controls:!0}):null}),e("div",{class:"media-form",children:[Z,e("footer",{children:[U==="image"&&/^(png|jpe?g|gif|webp)$/i.test(ye)&&!!ce.settings.mediaAltGenerator&&!!Ct&&e(wn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:e($,{icon:"more",size:"l",alt:r({id:"2FYpfJ"})})}),children:[e(ze,{disabled:h==="loading",onClick:()=>{b("loading"),ie.current=Be({text:r({id:"8zsp51"}),duration:-1}),async function(){var C,P;try{const M=new FormData;M.append("image",g);const E=await fetch(Ct,{method:"POST",body:M}).then(O=>O.json());if(E.error)throw new Error(E.error);Q(E.description)}catch(M){Be(M.message?r({id:"jnKLR+",values:{12:M.message}}):r({id:"xhYfVj"}))}finally{b("default"),(P=(C=ie.current)==null?void 0:C.hideToast)==null||P.call(C)}}()},children:[e($,{icon:"sparkles2"}),n&&n!=="en"?e("small",{children:[e(K,{id:"o5sTJw"}),e("br",{}),"(English)"]}):e("span",{children:e(K,{id:"o5sTJw"})})]}),!!n&&n!=="en"&&e(ze,{disabled:h==="loading",onClick:()=>{b("loading"),ie.current=Be({text:r({id:"8zsp51"}),duration:-1}),async function(){var C,P;try{const M=new FormData;M.append("image",g);const E=`?lang=${n}`,O=await fetch(Ct+E,{method:"POST",body:M}).then(J=>J.json());if(O.error)throw new Error(O.error);Q(O.description)}catch(M){Be(r({id:"kZwVke",values:{13:M!=null&&M.message?`: ${M.message}`:""}}))}finally{b("default"),(P=(C=ie.current)==null?void 0:C.hideToast)==null||P.call(C)}}()},children:[e($,{icon:"sparkles2"}),e("small",{children:[e(K,{id:"o5sTJw"}),e("br",{}),e(K,{id:"m+pAEQ",values:{0:At(n)},components:{0:e("span",{class:"more-insignificant"})}})]})]})]}),e("button",{type:"button",class:"light block",onClick:()=>{S(!1)},disabled:h==="loading",children:e(K,{id:"DPfwMq"})})]})]})]})]})})]})}function Zi({lang:s,poll:t,disabled:n,onInput:a=()=>{},maxOptions:l,maxExpiration:d,minExpiration:r,maxCharactersPerOption:h}){const{_:b}=Se(),{options:v,expiresIn:ae,multiple:T}=t;return e("div",{class:`poll ${T?"multiple":""}`,children:[e("div",{class:"poll-choices",children:v.map((g,y)=>e("div",{class:"poll-choice",children:[e("input",{required:!0,type:"text",value:g,disabled:n,maxlength:h,placeholder:b({id:"LDUSXg",values:{0:y+1}}),lang:s,spellCheck:"true",dir:"auto",onInput:R=>{const{value:W}=R.target;v[y]=W,a(t)}}),e("button",{type:"button",class:"plain2 poll-button",disabled:n||v.length<=1,onClick:()=>{v.splice(y,1),a(t)},children:e($,{icon:"x",size:"s",alt:b({id:"t/YqKh"})})})]},y))}),e("div",{class:"poll-toolbar",children:[e("button",{type:"button",class:"plain2 poll-button",disabled:n||v.length>=l,onClick:()=>{v.push(""),a(t)},children:"+"})," ",e("label",{class:"multiple-choices",children:[e("input",{type:"checkbox",checked:T,disabled:n,onChange:g=>{const{checked:y}=g.target;t.multiple=y,a(t)}})," ",e(K,{id:"T57mm9"})]}),e("label",{class:"expires-in",children:[e(K,{id:"lkz6PL"})," ",e("select",{value:ae,disabled:n,onChange:g=>{const{value:y}=g.target;t.expiresIn=y,a(t)},children:Object.entries(En).filter(([g])=>g>=r&&g<=d).map(([g,y])=>e("option",{value:g,children:y()},g))})]})]}),e("div",{class:"poll-toolbar",children:e("button",{type:"button",class:"plain remove-poll-button",disabled:n,onClick:()=>{a(null)},children:e(K,{id:"CDpQAX"})})})]})}function Le(s){return s.replace(/[&<>"']/g,function(t){return"&#"+t.charCodeAt(0)+";"})}function fn(s){for(let t in s)(s[t]===null||s[t]===void 0)&&delete s[t];return s}function Ji({onClose:s=()=>{},onSelect:t=()=>{},defaultSearchTerm:n}){const{_:a}=Se(),{masto:l}=Mt(),[d,r]=H("default"),[h,b]=H([]),[v,ae]=H({}),[T,g]=H(0),y=async k=>{if(!(k!=null&&k.length))return;const c=await ri(k,v);c&&ae({...v,...c})},R=k=>{k&&(r("loading"),(async()=>{try{const c=await l.v1.accounts.search.list({q:k,limit:40,resolve:!1});b(c),y(c),r("default")}catch{r("error")}})())},W=pt(R,1e3);se(()=>{R()},[R]);const j=q();se(()=>{j.current&&(j.current.focus(),j.current.value&&(j.current.selectionStart=j.current.value.length,j.current.selectionEnd=j.current.value.length))},[]),se(()=>{n&&R(n)},[n]);const N=k=>{const c=k.acct;t(c),s()};qe("enter",()=>{const k=h[T];k&&N(k)},{preventDefault:!0,enableOnFormTags:["input"]});const oe=q();return qe("down",()=>{T<h.length-1?g(T+1):g(0),setTimeout(()=>{const k=oe.current.querySelector(".selected");k&&k.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),qe("up",()=>{T>0?g(T-1):g(h.length-1),setTimeout(()=>{const k=oe.current.querySelector(".selected");k&&k.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),e("div",{id:"mention-sheet",class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e($,{icon:"x",alt:a({id:"yz7wBu"})})}),e("header",{children:e("form",{onSubmit:k=>{var c;k.preventDefault(),(c=W.flush)==null||c.call(W)},children:e("input",{ref:j,required:!0,type:"search",class:"block",placeholder:a({id:"eH1bqp"}),onInput:k=>{const{value:c}=k.target;W(c)},autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:n||""})})}),e("main",{children:(h==null?void 0:h.length)>0?e("ul",{ref:oe,class:`accounts-list ${d==="loading"?"loading":""}`,children:h.map((k,c)=>{const f=v[k.id];return e("li",{class:c===T?"selected":"",children:[e(yn,{avatarSize:"xxl",account:k,relationship:f,showStats:!0,showActivity:!0}),e("button",{type:"button",class:"plain2",onClick:()=>{N(k)},children:e($,{icon:"plus",size:"xl",alt:a({id:"m16xKo"})})})]},k.id)})}):d==="loading"?e("div",{class:"ui-state",children:e(ht,{abrupt:!0})}):d==="error"?e("div",{class:"ui-state",children:e("p",{children:e(K,{id:"AThL/k"})})}):null})]})}function Xi({masto:s,instance:t,onClose:n=()=>{},onSelect:a=()=>{},defaultSearchTerm:l}){const{_:d}=Se(),[r,h]=H("default"),b=q([]),[v,ae]=H([]),T=We(()=>Me.account.get("recentlyUsedCustomEmojis")||[]),g=q();se(()=>{h("loading"),(async()=>{try{const[c,f]=await Cn(t,s);g.current=f,ae(c),h("default")}catch{h("error")}})()},[]);const y=We(()=>{const c={"--recent--":T.filter(m=>v.find(w=>w.shortcode===m.shortcode))},f=[];return v.forEach(m=>{var w,D;if((D=(w=b.current)==null?void 0:w.push)==null||D.call(w,m),!m.category){f.push(m);return}c[m.category]||(c[m.category]=[]),c[m.category].push(m)}),f.length&&(c["--others--"]=f),c},[v]),R=q(),[W,j]=H(null),N=Qt(c=>{var m,w,D;const{value:f}=c.target;if(f){const L=(m=g.current)==null?void 0:m.search(f,{limit:Dt});j(L.map(X=>X.item)),(D=(w=R.current)==null?void 0:w.scrollTo)==null||D.call(w,0,0)}else j(null)},[v]);se(()=>{l&&(v!=null&&v.length)&&N({target:{value:l}})},[l,N,v]);const oe=Qt(c=>{a==null||a(c),n==null||n(),queueMicrotask(()=>{let f=Me.account.get("recentlyUsedCustomEmojis")||[];const m=f.findIndex(w=>w.shortcode===c.shortcode);m!==-1?(f.splice(m,1),f.unshift(c)):(f.unshift(c),f=f.filter(w=>{var D,L;return(L=(D=b.current)==null?void 0:D.find)==null?void 0:L.call(D,X=>X.shortcode===w.shortcode)}),f=f.slice(0,10)),Me.account.set("recentlyUsedCustomEmojis",f)})},[a]),k=q();return se(()=>{k.current&&(k.current.focus(),k.current.value&&(k.current.selectionStart=k.current.value.length,k.current.selectionEnd=k.current.value.length))},[]),e("div",{id:"custom-emojis-sheet",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e($,{icon:"x",alt:d({id:"yz7wBu"})})}),e("header",{children:[e("div",{children:[e("b",{children:e(K,{id:"8i6Ueo"})})," ",r==="loading"?e(ht,{}):e("small",{class:"insignificant",children:[" • ",t]})]}),e("form",{onSubmit:c=>{c.preventDefault();const f=W[0];f&&oe(`:${f.shortcode}:`)},children:e("input",{ref:k,type:"search",placeholder:d({id:"EarrCe"}),onInput:N,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:l||""})})]}),e("main",{ref:R,children:W!==null?e("ul",{class:"custom-emojis-matches custom-emojis-list",children:W.map(c=>e("li",{class:"custom-emojis-match",children:e(Ln,{emoji:c,onClick:()=>{oe(`:${c.shortcode}:`)},showCode:!0})},c.shortcode))}):e("div",{class:"custom-emojis-list",children:[r==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(K,{id:"Kzwsg2"})})}),r==="default"&&Object.entries(y).map(([c,f])=>!!(f!=null&&f.length)&&e("div",{class:"section-container",children:[e("div",{class:"section-header",children:{"--recent--":d({id:"uabU9X"}),"--others--":d({id:"NuKR0h"})}[c]||c}),e(Qi,{emojis:f,onSelect:oe})]}))]})})]})}const Qi=xn(({emojis:s,onSelect:t})=>{const{i18n:n}=Se(),[a,l]=H(Dt),d=s.length>a;return e("section",{children:[s.slice(0,a).map(r=>e(Ln,{emoji:r,onClick:()=>{t(`:${r.shortcode}:`)}},r.shortcode)),d&&e("button",{type:"button",class:"plain small",onClick:()=>l(a+Dt),children:e(K,{id:"iAB71E",values:{0:n.number(s.length-a)}})})]})}),Ln=xn(({emoji:s,onClick:t,showCode:n})=>{const a=l=>{const r=l.currentTarget.closest("main");if(r){const h=r.getBoundingClientRect(),b=l.currentTarget.getBoundingClientRect(),v=l.currentTarget.classList;b.left<h.left+88?(v.add("edge-left"),v.remove("edge-right")):b.right>h.right-88?(v.add("edge-right"),v.remove("edge-left")):v.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(Ue,{children:[" ",e("code",{children:s.shortcode})]})]})}),zt=20;function es({onClose:s=()=>{},onSelect:t=()=>{}}){var R,W,j,N,oe,k;const{i18n:n,_:a}=Se(),[l,d]=H("default"),[r,h]=H([]),b=q(null),v=q(null),ae=q(0),T=q(null);function g({offset:c}){var f,m,w;(f=v.current)!=null&&f.value&&(d("loading"),(w=(m=T.current)==null?void 0:m.scrollTo)==null||w.call(m,{top:0,left:0,behavior:"smooth"}),(async()=>{var D;try{const L={api_key:Ai,q:v.current.value,rating:"g",limit:zt,bundle:"messaging_non_clips",offset:c,lang:n.locale||"en"},X=await fetch("https://api.giphy.com/v1/gifs/search?"+new URLSearchParams(L),{referrerPolicy:"no-referrer"}).then(ne=>ne.json());ae.current=((D=X.pagination)==null?void 0:D.offset)||0,h(X),d("results")}catch{d("error")}})())}se(()=>{var c;(c=v.current)==null||c.focus()},[]);const y=pt(()=>{g({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($,{icon:"x",alt:a({id:"yz7wBu"})})}),e("header",{children:e("form",{ref:b,onSubmit:c=>{c.preventDefault(),g({offset:0})},children:[e("input",{ref:v,type:"search",name:"q",placeholder:a({id:"wxlF9B"}),required:!0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",onInput:y}),e("input",{type:"image",class:"powered-button",src:Fi,width:"86",height:"30",alt:a({id:"c1Q/eU"})})]})}),e("main",{ref:T,class:l==="loading"?"loading":"",children:[l==="default"&&e("div",{class:"ui-state",children:e("p",{class:"insignificant",children:e(K,{id:"9KEidY"})})}),l==="loading"&&!((R=r==null?void 0:r.data)!=null&&R.length)&&e("div",{class:"ui-state",children:e(ht,{abrupt:!0})}),((W=r==null?void 0:r.data)==null?void 0:W.length)>0?e(Ue,{children:[e("ul",{children:r.data.map(c=>{const{id:f,images:m,title:w,alt_text:D}=c,{fixed_height_small:L,fixed_height_downsampled:X,fixed_height:ne,original:Q}=m,U=L!=null&&L.url?L:X!=null&&X.url?X:ne;let{url:ye,webp:pe,width:re,height:S}=U;+S>100&&(re=re/S*100,S=100);const Y=URL.parse(ye),Z=Y.origin+Y.pathname;let ie;if(pe){const V=URL.parse(pe);ie=V.origin+V.pathname}return e("li",{children:e("button",{type:"button",onClick:()=>{const{mp4:V,url:ge}=Q,C=V||ge,P=URL.parse(C),M=P.origin+P.pathname;s(),t({url:M,type:V?"video/mp4":"image/gif",alt_text:D||w})},children:e("figure",{style:{"--figure-width":re+"px"},children:[e("picture",{children:[ie&&e("source",{srcset:ie,type:"image/webp"}),e("img",{src:Z,width:re,height:S,loading:"lazy",decoding:"async",alt:D,referrerpolicy:"no-referrer",onLoad:V=>{V.target.style.backgroundColor="transparent"}})]}),e("figcaption",{children:D||w})]})})},f)})}),e("p",{class:"pagination",children:[((j=r.pagination)==null?void 0:j.offset)>0&&e("button",{type:"button",class:"light small",disabled:l==="loading",onClick:()=>{var c;g({offset:((c=r.pagination)==null?void 0:c.offset)-zt})},children:[e($,{icon:"chevron-left"}),e("span",{children:e(K,{id:"DHhJ7s"})})]}),e("span",{}),((N=r.pagination)==null?void 0:N.offset)+((oe=r.pagination)==null?void 0:oe.count)<((k=r.pagination)==null?void 0:k.total_count)&&e("button",{type:"button",class:"light small",disabled:l==="loading",onClick:()=>{var c;g({offset:((c=r.pagination)==null?void 0:c.offset)+zt})},children:[e("span",{children:e(K,{id:"hXzOVo"})})," ",e($,{icon:"chevron-right"})]})]})]}):l==="results"&&e("div",{class:"ui-state",children:e("p",{children:"No results"})}),l==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(K,{id:"PbFw9n"})})})]})]})}export{ss as default};
|
||
//# sourceMappingURL=compose-Cc1vo2Eb.js.map
|