From 9b9d473d53fb40ad76a9aba59c66315c05562a51 Mon Sep 17 00:00:00 2001 From: archos Date: Sat, 16 Nov 2024 11:51:00 +0100 Subject: [PATCH] =?UTF-8?q?nov=C3=A1=20verze?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/compose-N6HS-39B.js | 26 ++++ assets/compose-N6HS-39B.js.map | 1 + assets/compose-Skgn-tKU.js | 2 + assets/compose-Skgn-tKU.js.map | 1 + assets/fuse-zg_VFt4r.js | 181 ++++++++++++++++++++++++++ assets/fuse-zg_VFt4r.js.map | 1 + assets/locales/ca-ES-BcTj8rqU.js | 2 + assets/locales/ca-ES-BcTj8rqU.js.map | 1 + assets/locales/lt-LT-HUvegYIh.js | 2 + assets/locales/lt-LT-HUvegYIh.js.map | 1 + assets/locales/th-TH-I0ZFgNKi.js.map | 2 +- assets/locales/uk-UA-yT-mrLP3.js | 2 + assets/locales/uk-UA-yT-mrLP3.js.map | 1 + assets/main-qoIDehIT.js | 34 +++++ assets/main-qoIDehIT.js.map | 1 + assets/polyfill-force-h0i4IMU6.js | 3 + assets/polyfill-force-h0i4IMU6.js.map | 1 + assets/useTitle-TK72setz.js | 38 ++++++ assets/useTitle-TK72setz.js.map | 1 + compose/index.html | 4 +- index.html | 6 +- version.json | 2 +- 22 files changed, 306 insertions(+), 7 deletions(-) create mode 100644 assets/compose-N6HS-39B.js create mode 100644 assets/compose-N6HS-39B.js.map create mode 100644 assets/compose-Skgn-tKU.js create mode 100644 assets/compose-Skgn-tKU.js.map create mode 100644 assets/fuse-zg_VFt4r.js create mode 100644 assets/fuse-zg_VFt4r.js.map create mode 100644 assets/locales/ca-ES-BcTj8rqU.js create mode 100644 assets/locales/ca-ES-BcTj8rqU.js.map create mode 100644 assets/locales/lt-LT-HUvegYIh.js create mode 100644 assets/locales/lt-LT-HUvegYIh.js.map create mode 100644 assets/locales/uk-UA-yT-mrLP3.js create mode 100644 assets/locales/uk-UA-yT-mrLP3.js.map create mode 100644 assets/main-qoIDehIT.js create mode 100644 assets/main-qoIDehIT.js.map create mode 100644 assets/polyfill-force-h0i4IMU6.js create mode 100644 assets/polyfill-force-h0i4IMU6.js.map create mode 100644 assets/useTitle-TK72setz.js create mode 100644 assets/useTitle-TK72setz.js.map diff --git a/assets/compose-N6HS-39B.js b/assets/compose-N6HS-39B.js new file mode 100644 index 0000000..4a74520 --- /dev/null +++ b/assets/compose-N6HS-39B.js @@ -0,0 +1,26 @@ +var Dt=s=>{throw TypeError(s)};var mt=(s,t,n)=>t.has(s)||Dt("Cannot "+n);var M=(s,t,n)=>(mt(s,t,"read from private field"),n?n.call(s):t.get(s)),oe=(s,t,n)=>t.has(s)?Dt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,n),me=(s,t,n,a)=>(mt(s,t,"write to private field"),a?a.call(s,n):t.set(s,n),n),Y=(s,t,n)=>(mt(s,t,"access private method"),n);import{z as fn,s as le,V as Xt,j as qe,a as _t,h as K,A as V,M as vn,aE as Jt,d as Se,y as te,x as bn,aF as xn,l as je,c as e,T as q,b as yn,f as Pe,w as at,r as wn,af as kn,i as ve,P as En,u as Fn,t as $t,C as Qt}from"./useTitle-TK72setz.js";import{j as Fe,G as Cn,$ as zn,a as $e,a9 as _n,y as jt,u as Ln,m as en,b as An,I as Z,B as Pt,i as Je,aa as Sn,l as yt,M as Qe,s as ze,a5 as In,a1 as Bn,r as Mn,Q as Tn,Y as rt,p as Ze,c as Rn,d as Ot,z as Dn}from"./fuse-zg_VFt4r.js";class $n{constructor(t,n,{tabInsertsSuggestions:a,defaultFirstOption:c}={}){this.input=t,this.list=n,this.tabInsertsSuggestions=a??!0,this.defaultFirstOption=c??!1,this.isComposing=!1,n.id||(n.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=l=>jn(l,this),this.compositionEventHandler=l=>On(l,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",Ht),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",Ht)}indicateDefaultOption(){var t;this.defaultFirstOption&&((t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(gt)[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(gt)[0],a=Array.from(this.list.querySelectorAll('[role="option"]')).filter(gt),c=a.indexOf(n);if(c===a.length-1&&t===1||c===0&&t===-1){this.clearSelection(),this.input.focus();return}let l=t===1?0:a.length-1;if(n&&c>=0){const y=c+t;y>=0&&y0||s.offsetHeight>0)}function On(s,t){t.isComposing=s.type==="compositionstart",document.getElementById(t.input.getAttribute("aria-controls")||"")&&t.clearSelection()}function Hn(s,t){Nn(s,t)||(s.scrollTop=t.offsetTop)}function Nn(s,t){const n=s.scrollTop,a=n+s.clientHeight,c=t.offsetTop,l=c+t.clientHeight;return c>=n&&l<=a}const Kn=/\s|\(|\[/;function qn(s,t,n,{multiWord:a,lookBackIndex:c,lastMatchPosition:l}={multiWord:!1,lookBackIndex:0,lastMatchPosition:null}){let o=s.lastIndexOf(t,n-1);if(o===-1||o=o+t.length+1||s.lastIndexOf(` +`,n-1)>o||s.lastIndexOf(".",n-1)>o)return}else if(s.lastIndexOf(" ",n-1)>o)return;const y=s[o-1];return y&&!Kn.test(y)?void 0:{text:s.substring(o+t.length,n),position:o+t.length}}class Wn extends HTMLElement{}class Un extends Event{constructor(){super("update")}}const ft=new WeakMap;var Oe,He,Ne,ye,W,wt,Ae,Ie,Be,kt,Me,et,tt,nt,Ke,_e;const At=class At extends Wn{constructor(){super(...arguments);oe(this,W);oe(this,Oe,new MutationObserver(()=>Y(this,W,tt).call(this)));oe(this,He,new ResizeObserver(()=>Y(this,W,et).call(this)));oe(this,Ne);oe(this,ye);oe(this,Ie,0);oe(this,Be,0);oe(this,Me,!1);oe(this,Ke,()=>Y(this,W,nt).call(this));oe(this,_e,n=>{Y(this,W,Ae).call(this,a=>{(n.target===document||n.target===window||n.target instanceof Node&&n.target.contains(a))&&Y(this,W,et).call(this)})})}static for(n){let a=ft.get(n);return a||(a=new At,a.connect(n),ft.set(n,a)),a}connect(n){me(this,Ne,new WeakRef(n)),me(this,ye,document.createElement("div")),M(this,ye).style.position="absolute",M(this,ye).style.pointerEvents="none",n.after(M(this,ye)),M(this,ye).appendChild(this)}forceUpdate(){Y(this,W,tt).call(this),Y(this,W,nt).call(this)}connectedCallback(){Y(this,W,Ae).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"),Y(this,W,tt).call(this),Y(this,W,nt).call(this),M(this,Oe).observe(n,{attributeFilter:["style","dir"]}),M(this,He).observe(n),document.addEventListener("scroll",M(this,_e),{capture:!0}),window.addEventListener("resize",M(this,_e),{capture:!0}),n.addEventListener("input",M(this,Ke),{capture:!0})})}disconnectedCallback(){var a;(a=M(this,ye))==null||a.remove(),M(this,Oe).disconnect(),M(this,He).disconnect(),document.removeEventListener("scroll",M(this,_e),{capture:!0}),window.removeEventListener("resize",M(this,_e),{capture:!0});const n=M(this,W,wt);n&&(n.removeEventListener("input",M(this,Ke),{capture:!0}),ft.delete(n))}};Oe=new WeakMap,He=new WeakMap,Ne=new WeakMap,ye=new WeakMap,W=new WeakSet,wt=function(){var n;return(n=M(this,Ne))==null?void 0:n.deref()},Ae=function(n){const a=M(this,W,wt);return a?n(a):this.remove()},Ie=new WeakMap,Be=new WeakMap,kt=function(){Y(this,W,Ae).call(this,n=>{const a=window.getComputedStyle(n);this.style.height=a.height,this.style.width=a.width,n.clientHeight!==this.clientHeight&&(this.style.height=`calc(${a.height} + ${n.clientHeight-this.clientHeight}px)`),n.clientWidth!==this.clientWidth&&(this.style.width=`calc(${a.width} + ${n.clientWidth-this.clientWidth}px)`);const c=n.getBoundingClientRect(),l=this.getBoundingClientRect();me(this,Ie,M(this,Ie)+c.left-l.left),me(this,Be,M(this,Be)+c.top-l.top),this.style.transform=`translate(${M(this,Ie)}px, ${M(this,Be)}px)`,this.scrollTop=n.scrollTop,this.scrollLeft=n.scrollLeft,this.dispatchEvent(new Un)})},Me=new WeakMap,et=function(){M(this,Me)||(me(this,Me,!0),requestAnimationFrame(()=>{Y(this,W,kt).call(this),me(this,Me,!1)}))},tt=function(){Y(this,W,Ae).call(this,n=>{const a=window.getComputedStyle(n);for(const c of Vn)this.style[c]=a[c];Y(this,W,et).call(this)})},nt=function(){Y(this,W,Ae).call(this,n=>{this.textContent=n.value,Y(this,W,kt).call(this)})},Ke=new WeakMap,_e=new WeakMap;let it=At;const Vn=["direction","writingMode","unicodeBidi","textOrientation","boxSizing","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"];try{customElements.define("input-style-clone",it)}catch(s){if(!(s instanceof DOMException&&s.name==="NotSupportedError"))throw s}var be,Te,Re,ce,Ft,tn,Ct,De;const st=class st{constructor(t,n=0,a=n){oe(this,ce);oe(this,be);oe(this,Te);oe(this,Re);me(this,be,t),me(this,Te,n),me(this,Re,a)}static fromSelection(t){const{selectionStart:n,selectionEnd:a}=t;return new st(t,n??void 0,a??void 0)}get collapsed(){return this.startOffset===this.endOffset}get commonAncestorContainer(){return M(this,be)}get endContainer(){return M(this,be)}get startContainer(){return M(this,be)}get startOffset(){return M(this,Te)}get endOffset(){return M(this,Re)}setStartOffset(t){me(this,Te,Y(this,ce,Ct).call(this,t))}setEndOffset(t){me(this,Re,Y(this,ce,Ct).call(this,t))}collapse(t=!1){t?this.setEndOffset(this.startOffset):this.setStartOffset(this.endOffset)}cloneContents(){return Y(this,ce,De).call(this).cloneContents()}cloneRange(){return new st(M(this,be),this.startOffset,this.endOffset)}getBoundingClientRect(){return Y(this,ce,De).call(this).getBoundingClientRect()}getClientRects(){return Y(this,ce,De).call(this).getClientRects()}toString(){return Y(this,ce,De).call(this).toString()}getStyleClone(){return M(this,ce,Ft)}};be=new WeakMap,Te=new WeakMap,Re=new WeakMap,ce=new WeakSet,Ft=function(){return it.for(M(this,be))},tn=function(){return M(this,ce,Ft)},Ct=function(t){return Math.max(0,Math.min(t,M(this,be).value.length))},De=function(){const t=document.createRange(),n=M(this,ce,tn).childNodes[0];return n&&(t.setStart(n,this.startOffset),t.setEnd(n,this.endOffset)),t};let Et=st;const Xe=new WeakMap;class Gn{constructor(t,n){this.expander=t,this.input=n,this.combobox=null,this.menu=null,this.match=null,this.justPasted=!1,this.lookBackIndex=0,this.oninput=this.onInput.bind(this),this.onpaste=this.onPaste.bind(this),this.onkeydown=this.onKeydown.bind(this),this.oncommit=this.onCommit.bind(this),this.onmousedown=this.onMousedown.bind(this),this.onblur=this.onBlur.bind(this),this.interactingWithList=!1,n.addEventListener("paste",this.onpaste),n.addEventListener("input",this.oninput),n.addEventListener("keydown",this.onkeydown),n.addEventListener("blur",this.onblur)}destroy(){this.input.removeEventListener("paste",this.onpaste),this.input.removeEventListener("input",this.oninput),this.input.removeEventListener("keydown",this.onkeydown),this.input.removeEventListener("blur",this.onblur)}dismissMenu(){this.deactivate()&&(this.lookBackIndex=this.input.selectionEnd||this.lookBackIndex)}activate(t,n){var a,c;this.input!==document.activeElement&&this.input!==((c=(a=document.activeElement)===null||a===void 0?void 0:a.shadowRoot)===null||c===void 0?void 0:c.activeElement)||(this.deactivate(),this.menu=n,n.id||(n.id=`text-expander-${Math.floor(Math.random()*1e5).toString()}`),this.expander.append(n),this.combobox=new $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 Et(this.input,n).getBoundingClientRect(),c={left:a.left,top:a.top+a.height},l=t.getBoundingClientRect(),o={left:c.left-l.left,top:c.top-l.top};if(o.left!==0||o.top!==0){const y=getComputedStyle(t);t.style.left=y.left?`calc(${y.left} + ${o.left}px)`:`${o.left}px`,t.style.top=y.top?`calc(${y.top} + ${o.top}px)`:`${o.top}px`}}deactivate(){const t=this.menu;return!t||!this.combobox?!1:(this.expander.dispatchEvent(new Event("text-expander-deactivate")),this.menu=null,t.removeEventListener("combobox-commit",this.oncommit),t.removeEventListener("mousedown",this.onmousedown),this.combobox.destroy(),this.combobox=null,t.remove(),!0)}onCommit({target:t}){var n;const a=t;if(!(a instanceof HTMLElement)||!this.combobox)return;const c=this.match;if(!c)return;const l=this.input.value.substring(0,c.position-c.key.length),o=this.input.value.substring(c.position+c.text.length),y={item:a,key:c.key,value:null,continue:!1};if(!this.expander.dispatchEvent(new CustomEvent("text-expander-value",{cancelable:!0,detail:y}))||!y.value)return;let z=(n=this.expander.getAttribute("suffix"))!==null&&n!==void 0?n:" ";y.continue&&(z="");const N=`${y.value}${z}`;this.input.value=l+N+o;const g=l.length+N.length;this.deactivate(),this.input.focus({preventScroll:!0}),this.input.selectionStart=g,this.input.selectionEnd=g,y.continue||(this.lookBackIndex=g,this.match=null),this.expander.dispatchEvent(new CustomEvent("text-expander-committed",{cancelable:!1,detail:{input:this.input}}))}onBlur(){if(this.interactingWithList){this.interactingWithList=!1;return}this.deactivate()}onPaste(){this.justPasted=!0}async onInput(){if(this.justPasted){this.justPasted=!1;return}const t=this.findMatch();if(t){this.match=t;const n=await this.notifyProviders(t);if(!this.match)return;n?this.activate(t,n):this.deactivate()}else this.match=null,this.deactivate()}findMatch(){const t=this.input.selectionEnd||0,n=this.input.value;t<=this.lookBackIndex&&(this.lookBackIndex=t-1);for(const{key:a,multiWord:c}of this.expander.keys){const l=qn(n,a,t,{multiWord:c,lookBackIndex:this.lookBackIndex,lastMatchPosition:this.match?this.match.position:null});if(l)return{text:l.text,key:a,position:l.position}}}async notifyProviders(t){const n=[],a=y=>n.push(y);return this.expander.dispatchEvent(new CustomEvent("text-expander-change",{cancelable:!0,detail:{provide:a,text:t.text,key:t.key}}))?(await Promise.all(n)).filter(y=>y.matched).map(y=>y.fragment)[0]:void 0}onMousedown(){this.interactingWithList=!0}onKeydown(t){t.key==="Escape"&&(this.match=null,this.deactivate()&&(this.lookBackIndex=this.input.selectionEnd||this.lookBackIndex,t.stopImmediatePropagation(),t.preventDefault()))}}class Kt extends HTMLElement{get keys(){const t=this.getAttribute("keys"),n=t?t.split(" "):[],a=this.getAttribute("multiword"),c=a?a.split(" "):[],l=c.length===0&&this.hasAttribute("multiword");return n.map(o=>({key:o,multiWord:l||c.includes(o)}))}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 Gn(this,t);Xe.set(this,n)}disconnectedCallback(){const t=Xe.get(this);t&&(t.destroy(),Xe.delete(this))}dismiss(){const t=Xe.get(this);t&&t.dismissMenu()}}window.customElements.get("text-expander")||(window.TextExpanderElement=Kt,window.customElements.define("text-expander",Kt));function Yn({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 Zn=Yn();function Xn(s){if(typeof s!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof s}\``);return s.replace(Zn,"")}const Jn=new Intl.Segmenter;function qt(s,{countAnsiEscapeCodes:t=!1}={}){if(s===""||(t||(s=Xn(s)),s===""))return 0;let n=0;for(const a of Jn.segment(s))n++;return n}const Qn="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",Lt=[["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","ⵜⴰⵎⴰⵣⵉⵖⵜ"]],ei="(((?:[^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\\-_&=#\\/])?))",ti="gi",Wt={source:ei,flags:ti},ni={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:vt,PHANPY_GIPHY_API_KEY:ii}=ni,si=Lt.reduce((s,t)=>{const[n,a,c]=t;return s[n]={common:a,native:c},s},{}),nn={300:Fe(5,"minute"),1800:Fe(30,"minute"),3600:Fe(1,"hour"),21600:Fe(6,"hour"),86400:Fe(1,"day"),259200:Fe(3,"day"),604800:Fe(1,"week")},ai=Object.keys(nn),Ut=24*60*60,Vt=s=>{if(!s)return Ut;const t=(new Date(s).getTime()-Date.now())/1e3;return ai.find(n=>n>=t)||Ut},Ee=document.createElement("ul");Ee.role="listbox";Ee.className="text-expander-menu";const ri=16,oi=new IntersectionObserver(s=>{s.forEach(t=>{if(t.isIntersecting){const{left:n,width:a}=t.boundingClientRect,{innerWidth:c}=window;if(n+a>c){const l=Cn()?"right":"left";Ee.style[l]=c-a-ri+"px"}}})});oi.observe(Ee);const Ce=fn([new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages],Lt.map(s=>s[0]),"en"),sn=new RegExp(Wt.source,Wt.flags),li=/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/gi,ci="$2xxxxxxxxxxxxxxxxxxxxxxx";function ui(s){return s.replace(sn,ci).replace(li,"$1@$3")}const di=/[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i,hi=new RegExp(`(^|[^=\\/\\w])(@${di.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,"uig"),pi=new RegExp("(^|[^=\\/\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\/\\w])","ig"),mi="[a-zA-Z0-9_]{2,}",gi=new RegExp(`(^|[^=\\/\\w])(:${mi}:)(?=[^A-Za-z0-9_:]|$)`,"g"),fi=new Intl.Segmenter;function bt(s){return s.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function vi(s,{maxCharacters:t=1/0}){const{composerCharacterCount:n}=le;if(n>t){let a="",c="";const l=fi.segment(s);for(const{segment:o,index:y}of l)y"),bt(a)+c}return bt(s).replace(sn,'$2$3').replace(hi,'$1$2').replace(pi,'$1$2').replace(gi,'$1$2')}const bi=Xt(s=>new Intl.RelativeTimeFormat(s||void 0)),xi=Xt(s=>new Intl.ListFormat(s||void 0)),zt=100;function Mi({onClose:s,replyToStatus:t,editStatus:n,draftStatus:a,standalone:c,hasOpener:l}){var Rt;const{i18n:o}=qe(),y=bi(o.locale),_=xi(o.locale),{masto:z,instance:N}=_t(),[g,B]=K("default"),C=V((a==null?void 0:a.uid)||zn()),$=vn(),T=$.info,ne=Jt(),{statuses:{maxCharacters:ee,maxMediaAttachments:u,charactersReservedPerUrl:h}={},mediaAttachments:{supportedMimeTypes:m,imageSizeLimit:w,imageMatrixLimit:f,videoSizeLimit:j,videoMatrixLimit:k,videoFrameRateLimit:G}={},polls:{maxOptions:re,maxCharactersPerOption:ue,maxExpiration:X,minExpiration:pe}={}}=ne||{},S=V(),O=V(),[U,ie]=K("public"),[se,ae]=K(!1),[D,de]=K(Se.session.get("currentLanguage")||Ce),R=V(D),[v,L]=K([]),[P,J]=K(null),Q=Se.account.get("preferences")||{},ge=()=>{S.current&&S.current.dispatchEvent(new Event("input"))},we=()=>{setTimeout(()=>{var r,d,x;S.current&&((d=(r=a==null?void 0:a.status)==null?void 0:r.startsWith)!=null&&d.call(r,` +`)&&(S.current.selectionStart=0,S.current.selectionEnd=0),(x=S.current)==null||x.focus())},300)};te(()=>{var r,d;if(t){const{spoilerText:x,visibility:p,language:A,sensitive:F}=t;x&&O.current&&(O.current.value=x);const b=[...new Set([t.account.acct,...t.mentions.map(E=>E.acct)])].filter(E=>E!==T.acct);b.length>0&&(S.current.value=`${b.map(E=>`@${E}`).join(" ")} `,ge()),we(),ie(p==="public"&&Q["posting:default:visibility"]?Q["posting:default:visibility"].toLowerCase():p),de(A||((r=Q["posting:default:language"])==null?void 0:r.toLowerCase())||Ce),ae(F&&!!x)}else if(n){const{visibility:x,language:p,sensitive:A,poll:F,mediaAttachments:I}=n,b=!!(F!=null&&F.options)&&{...F,options:F.options.map(E=>(E==null?void 0:E.title)||E),expiresIn:(F==null?void 0:F.expiresIn)||Vt(F.expiresAt)};B("loading"),(async()=>{var E;try{const H=await z.v1.statuses.$select(n.id).source.fetch(),{text:he,spoilerText:fe}=H;S.current.value=he,S.current.dataset.source=he,ge(),we(),O.current.value=fe,ie(x),de(p||((E=Q["posting:default:language"])==null?void 0:E.toLowerCase())||Ce),ae(A),b&&J(b),L(I),B("default")}catch(H){alert((H==null?void 0:H.reason)||H),B("error")}})()}else we(),Q["posting:default:visibility"]&&ie(Q["posting:default:visibility"].toLowerCase()),Q["posting:default:language"]&&de(Q["posting:default:language"].toLowerCase()),Q["posting:default:sensitive"]&&ae(!!Q["posting:default:sensitive"]);if(a){const{status:x,spoilerText:p,visibility:A,language:F,sensitive:I,poll:b,mediaAttachments:E}=a,H=!!(b!=null&&b.options)&&{...b,options:b.options.map(he=>(he==null?void 0:he.title)||he),expiresIn:(b==null?void 0:b.expiresIn)||Vt(b.expiresAt)};S.current.value=x,ge(),we(),p&&(O.current.value=p),A&&ie(A),de(F||((d=Q["posting:default:language"])==null?void 0:d.toLowerCase())||Ce),I!==null&&ae(I),H&&J(H),E&&L(E)}},[a,n,t]);const Le=V(),St=o._({id:"hR9gtK"}),ot=()=>{const{value:r,dataset:d}=S.current;if(g==="loading")return!1;const x=(r||"").trim().replace(new RegExp("^\\p{White_Space}+|\\p{White_Space}+$","gu"),""),p=v.length>0;if(!x&&!p||v.length>0&&v.every(E=>E.id))return!0;const F=(t==null?void 0:t.account.id)===T.id,I=t&&r.trim()===`@${t.account.acct}`;return!!(!F&&I||r===(d==null?void 0:d.source))},We=()=>ot()?!0:confirm(St);te(()=>{const r=d=>{ot()||(d.preventDefault(),d.returnValue=St)};return window.addEventListener("beforeunload",r,{capture:!0}),()=>window.removeEventListener("beforeunload",r,{capture:!0})},[]);const on=()=>{const{value:r}=S.current,{value:d}=O.current;return qt(ui(r))+qt(d)},lt=()=>{const r=on();le.composerCharacterCount=r};te(lt,[]);const It=window.CloseWatcher,ct=V(!1);$e("esc",()=>{ct.current=!0},{enabled:!It,enableOnFormTags:!0}),$e("esc",()=>{!c&&ct.current&&We()&&s(),ct.current=!1},{enabled:!It,enableOnFormTags:!0,keyup:!0,ignoreEventWhen:r=>{const d=document.querySelectorAll("#modal-container > *"),x=!!d,p=d.length===1&&d[0].querySelector("#compose-container");return x&&!p}}),_n(()=>{!c&&We()&&s()},[c,We,s]);const Bt=V({}),Mt=()=>`${bn()}#${C.current}`,ut=()=>{if(n||le.composerState.minimized)return;const r=Mt(),d={key:r,replyTo:t?{id:t.id,account:{id:t.account.id,username:t.account.username,acct:t.account.acct}}:null,draftStatus:{uid:C.current,status:S.current.value,spoilerText:O.current.value,visibility:U,language:D,sensitive:se,poll:P,mediaAttachments:v}};!xn(d,Bt.current)&&!ot()&&(jt.drafts.set(r,{...d,state:"unsaved",updatedAt:Date.now()}).then(()=>{}).catch(x=>{}),Bt.current=structuredClone(d))};Ln(ut,5e3),te(()=>(ut(),()=>{jt.drafts.del(Mt())}),[]),te(()=>{const r=x=>{const{items:p}=x.clipboardData||x.dataTransfer,A=[],F=[];for(let I=0;I0&&alert(o._({id:"rpXAF6",values:{0:F.length,1:F[0].name,2:_.format(F.map(I=>I.name))}})),A.length>0&&v.length>=u){alert(o._({id:"ctFhjs",values:{maxMediaAttachments:u}}));return}if(A.length>0){x.preventDefault(),x.stopPropagation();let I=A;if(u!==void 0){const E=u-v.length;if(I=I.slice(0,E),I.length<=0){alert(o._({id:"ctFhjs",values:{maxMediaAttachments:u}}));return}}const b=I.map(E=>({file:E,type:E.type,size:E.size,url:URL.createObjectURL(E),id:null,description:null}));L([...v,...b])}};window.addEventListener("paste",r);const d=x=>{x.dataTransfer.items.length>0&&(x.preventDefault(),x.stopPropagation())};return window.addEventListener("dragover",d),window.addEventListener("drop",r),()=>{window.removeEventListener("paste",r),window.removeEventListener("dragover",d),window.removeEventListener("drop",r)}},[v]);const[Ue,dt]=K(!1),[Ve,Ge]=K(!1),[ln,ht]=K(!1),[xe,cn]=K(null),[un,dn]=je(()=>{const r=[],d=[],{contentTranslationHideLanguages:x=[]}=le.settings;return Lt.forEach(p=>{const[A]=p;A===D||A===R.current||A===Ce||x.includes(A)||xe!=null&&xe.length&&xe.includes(A)?r.push(p):d.push(p)}),r.sort(([p,A],[F,I])=>p===D?-1:F===D?1:A.localeCompare(I)),d.sort(([p,A],[F,I])=>A.localeCompare(I)),[r,d]},[D,xe]),Tt=je(()=>!!(t!=null&&t.createdAt)&&Math.floor((Date.now()-new Date(t.createdAt))/(1e3*60*60*24*30)),[t]),hn=()=>{ut(),le.composerState.minimized=!0};return e("div",{id:"compose-container-outer",children:[e("div",{id:"compose-container",class:c?"standalone":"",children:[e("div",{class:"compose-top",children:[(T==null?void 0:T.avatarStatic)&&e(en,{account:T,accountInstance:$.instanceURL,hideDisplayName:!0,useAvatarStatic:!0}),c?l&&e("button",{type:"button",class:"light pop-button",disabled:g==="loading",onClick:()=>{var r;if(!window.opener){alert(o._({id:"qiPXgY"}));return}if(window.opener.__STATES__.showCompose){if((r=window.opener.__STATES__.composerState)!=null&&r.publishing){alert(o._({id:"Z2l5Bt"}));return}let d=o._({id:"AB/GtR"});if(!confirm(d))return}s({fn:()=>{const d={editStatus:n,replyToStatus:t,draftStatus:{uid:C.current,status:S.current.value,spoilerText:O.current.value,visibility:U,language:D,sensitive:se,poll:P,mediaAttachments:v}};window.opener.__COMPOSE__=d,window.opener.__STATES__.showCompose?(window.opener.__STATES__.showCompose=!1,setTimeout(()=>{window.opener.__STATES__.showCompose=!0},10)):window.opener.__STATES__.showCompose=!0,window.opener.__STATES__.composerState.minimized&&(window.opener.__STATES__.composerState.minimized=!1)}})},children:e(Z,{icon:"popin",alt:o._({id:"/5ZKeE"})})}):e("span",{class:"compose-controls",children:[e("button",{type:"button",class:"plain4 pop-button",disabled:g==="loading",onClick:()=>{An({editStatus:n,replyToStatus:t,draftStatus:{uid:C.current,status:S.current.value,spoilerText:O.current.value,visibility:U,language:D,sensitive:se,poll:P,mediaAttachments:v}})&&s()},children:e(Z,{icon:"popout",alt:o._({id:"JsU2En"})})}),e("button",{type:"button",class:"plain4 min-button",onClick:hn,children:e(Z,{icon:"minimize",alt:o._({id:"3TSz9S"})})})," ",e("button",{type:"button",class:"light close-button",disabled:g==="loading",onClick:()=>{We()&&s()},children:e(Z,{icon:"x",alt:o._({id:"yz7wBu"})})})]})]}),!!t&&e("div",{class:"status-preview",children:[e(Pt,{status:t,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend reply-to",children:Tt>0?e(q,{id:"Q1Huya",values:{0:t.account.acct||t.account.username,1:y.format(-Tt,"month")},components:{0:e("strong",{})}}):e(q,{id:"dwLCPZ",values:{0:t.account.acct||t.account.username}})})]}),!!n&&e("div",{class:"status-preview",children:[e(Pt,{status:n,size:"s",previewMode:!0}),e("div",{class:"status-preview-legend",children:e(q,{id:"wKtOLH"})})]}),e("form",{ref:Le,class:`form-visibility-${U}`,style:{pointerEvents:g==="loading"?"none":"auto",opacity:g==="loading"?.5:1},onKeyDown:r=>{r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&Le.current.dispatchEvent(new Event("submit",{cancelable:!0}))},onSubmit:r=>{r.preventDefault();const d=new FormData(r.target),x=Object.fromEntries(d.entries());let{status:p,visibility:A,sensitive:F,spoilerText:I}=x;if(F=F==="on",P){if(P.options.length<2){alert(o._({id:"zhrMYj"}));return}if(P.options.some(b=>b==="")){alert(o._({id:"uNVxXX"}));return}}v.length>0&&v.some(E=>{var H,he;return!((he=(H=E.description)==null?void 0:H.trim)!=null&&he.call(H))})&&!confirm(o._({id:"MQYucx"}))||(I=F&&I||void 0,p=p===""?void 0:p,le.composerState.publishing=!0,B("loading"),(async()=>{try{if(v.length>0){const H=v.map(fe=>{const{file:Ye,description:pn,id:mn}=fe;if(mn)return fe;{const gn=Zt({file:Ye,description:pn});return z.v2.media.create(gn).then(pt=>(pt.id&&(fe.id=pt.id),pt))}}),he=await Promise.allSettled(H);if(he.some(fe=>{var Ye;return fe.status==="rejected"||!((Ye=fe.value)!=null&&Ye.id)})){le.composerState.publishing=!1,le.composerState.publishingError=!0,B("error"),he.forEach(fe=>{fe.status==="rejected"&&alert(fe.reason||o._({id:"eIiurD",values:{i}}))});return}}let b={status:p,spoiler_text:I,language:D,sensitive:F,poll:P,media_ids:v.map(H=>H.id)};n&&Je("@mastodon/edit-media-attributes")?b.media_attributes=v.map(H=>({id:H.id,description:H.description})):n||(b.visibility=A,b.in_reply_to_id=(t==null?void 0:t.id)||void 0),b=Zt(b);let E;if(n)E=await z.v1.statuses.$select(n.id).update(b),yn(E,N,{skipThreading:!0});else try{E=await z.v1.statuses.create(b,{requestInit:{headers:{"Idempotency-Key":C.current}}})}catch{E=await z.v1.statuses.create(b)}le.composerState.minimized=!1,le.composerState.publishing=!1,B("default"),s({type:n?"edit":t?"reply":"post",newStatus:E,instance:N})}catch(b){le.composerState.publishing=!1,le.composerState.publishingError=!0,alert((b==null?void 0:b.reason)||b),B("error")}})())},children:[e("div",{class:"toolbar stretch",children:[e("input",{ref:O,type:"text",name:"spoilerText",placeholder:o._({id:"gnKo7f"}),disabled:g==="loading",class:"spoiler-text-field",lang:D,spellCheck:"true",dir:"auto",style:{opacity:se?1:0,pointerEvents:se?"auto":"none"},onInput:()=>{lt()}}),e("label",{class:`toolbar-button ${se?"highlight":""}`,title:o._({id:"zKu2Aq"}),children:[e("input",{name:"sensitive",type:"checkbox",checked:se,disabled:g==="loading",onChange:r=>{var x,p;const d=r.target.checked;ae(d),d?(x=O.current)==null||x.focus():(p=S.current)==null||p.focus()}}),e(Z,{icon:`eye-${se?"close":"open"}`})]})," ",e("label",{class:`toolbar-button ${U!=="public"&&!se?"show-field":""} ${U!=="public"?"highlight":""}`,title:U,children:[e(Z,{icon:Sn[U],alt:U}),e("select",{name:"visibility",value:U,onChange:r=>{ie(r.target.value)},disabled:g==="loading"||!!n,dir:"auto",children:[e("option",{value:"public",children:e(q,{id:"7d1a0d"})}),(Je("@pleroma/local-visibility-post")||Je("@akkoma/local-visibility-post"))&&e("option",{value:"local",children:e(q,{id:"d5zxa4"})}),e("option",{value:"unlisted",children:e(q,{id:"WDcQq9"})}),e("option",{value:"private",children:e(q,{id:"o34OrG"})}),e("option",{value:"direct",children:e(q,{id:"IV4QaU"})})]})]})," "]}),e(ki,{ref:S,placeholder:t?o._({id:"Sjj+EN"}):n?o._({id:"qzVesX"}):o._({id:"owpNF1"}),required:(v==null?void 0:v.length)===0,disabled:g==="loading",lang:D,onInput:()=>{lt()},maxCharacters:ee,performSearch:r=>{const{type:d,q:x,limit:p}=r;return d==="accounts"?z.v1.accounts.search.list({q:x,limit:p,resolve:!1}):z.v2.search.fetch(r)},onTrigger:r=>{(r==null?void 0:r.name)==="custom-emojis"?Ge({defaultSearchTerm:(r==null?void 0:r.defaultSearchTerm)||null}):(r==null?void 0:r.name)==="mention"?dt({defaultSearchTerm:(r==null?void 0:r.defaultSearchTerm)||null}):(r==null?void 0:r.name)==="auto-detect-language"&&(r!=null&&r.languages)&&cn(r.languages)}}),(v==null?void 0:v.length)>0&&e("div",{class:"media-attachments",children:[v.map((r,d)=>{const{id:x,file:p}=r,A=(p==null?void 0:p.size)+(p==null?void 0:p.type)+(p==null?void 0:p.name);return e(Fi,{attachment:r,disabled:g==="loading",lang:D,onDescriptionChange:F=>{L(I=>{const b=[...I];return b[d]={...b[d],description:F},b})},onRemove:()=>{L(F=>F.filter((I,b)=>b!==d))}},x||A||d)}),e("label",{class:"media-sensitive",children:[e("input",{name:"sensitive",type:"checkbox",checked:se,disabled:g==="loading",onChange:r=>{const d=r.target.checked;ae(d)}})," ",e("span",{children:e(q,{id:"jER18a"})})," ",e(Z,{icon:`eye-${se?"close":"open"}`})]})]}),!!P&&e(Ci,{lang:D,maxOptions:re,maxExpiration:X,minExpiration:pe,maxCharactersPerOption:ue,poll:P,disabled:g==="loading",onInput:r=>{if(r){const d={...r};J(d)}else J(null)}}),e("div",{class:"toolbar wrap",style:{justifyContent:"flex-end"},children:[e("span",{children:[e("label",{class:"toolbar-button",children:[e("input",{type:"file",accept:m==null?void 0:m.join(","),multiple:u===void 0||u-v>=2,disabled:g==="loading"||v.length>=u||!!P,onChange:r=>{const d=r.target.files;if(!d)return;const x=Array.from(d).map(p=>({file:p,type:p.type,size:p.size,url:URL.createObjectURL(p),id:null,description:null}));v.length+x.length>u?alert(o._({id:"ctFhjs",values:{maxMediaAttachments:u}})):L(p=>p.concat(x)),r.target.value=""}}),e(Z,{icon:"attachment"})]}),re==null||re>1&&e(Pe,{children:e("button",{type:"button",class:"toolbar-button",disabled:g==="loading"||!!P||!!v.length,onClick:()=>{J({options:["",""],expiresIn:24*60*60,multiple:!1})},children:e(Z,{icon:"poll",alt:o._({id:"cZJ92q"})})})}),e("button",{type:"button",class:"toolbar-button",disabled:g==="loading",onClick:()=>{Ge(!0)},children:e(Z,{icon:"emoji2",alt:o._({id:"ggiJLM"})})}),!!le.settings.composerGIFPicker&&e("button",{type:"button",class:"toolbar-button gif-picker-button",disabled:g==="loading"||u!==void 0&&v.length>=u||!!P,onClick:()=>{ht(!0)},children:e("span",{children:"GIF"})})]}),e("div",{class:"spacer"}),g==="loading"?e(at,{abrupt:!0}):e(Ei,{maxCharacters:ee,hidden:g==="loading"}),e("label",{class:`toolbar-button ${D!==R.current||xe!=null&&xe.length&&!xe.includes(D)?"highlight":""}`,children:[e("span",{class:"icon-text",children:(Rt=si[D])==null?void 0:Rt.native}),e("select",{name:"language",value:D,onChange:r=>{const{value:d}=r.target;de(d||Ce),Se.session.set("currentLanguage",d||Ce)},disabled:g==="loading",dir:"auto",children:[un.map(([r,d,x])=>{const p=yt({code:r,fallback:d});return e("option",{value:r,children:p!==x?`${x} - ${p}`:p},r)}),e("hr",{}),dn.map(([r,d,x])=>{const p=yt({code:r,fallback:d});return e("option",{value:r,children:p!==x?`${x} - ${p}`:p},r)})]})]})," ",e("button",{type:"submit",class:"large",disabled:g==="loading",children:t?o._({id:"ImOQa9"}):n?o._({id:"EkH9pt"}):o._({id:"GMe2XV"})})]})]})]}),Ue&&e(Qe,{onClick:r=>{r.target===r.currentTarget&&dt(!1)},children:e(zi,{masto:z,instance:N,onClose:()=>{dt(!1)},defaultSearchTerm:Ue==null?void 0:Ue.defaultSearchTerm,onSelect:r=>{const d=S.current;if(!d)return;const{selectionStart:x,selectionEnd:p}=d,A=d.value,F=A.slice(0,x),I=F?/[\s\t\n\r]$/.test(F)?"":" ":"",b=A.slice(p),E=/^[\s\t\n\r]/.test(b)?"":" ",H=F+I+"@"+r+E+b;d.value=H,d.selectionStart=d.selectionEnd=p+1+r.length+E.length,d.focus(),d.dispatchEvent(new Event("input"))}})}),Ve&&e(Qe,{onClick:r=>{r.target===r.currentTarget&&Ge(!1)},children:e(_i,{masto:z,instance:N,onClose:()=>{Ge(!1)},defaultSearchTerm:Ve==null?void 0:Ve.defaultSearchTerm,onSelect:r=>{const d=S.current;if(!d)return;const{selectionStart:x,selectionEnd:p}=d,A=d.value,F=A.slice(0,x),I=F?/[\s\t\n\r]$/.test(F)?"":" ":"",b=A.slice(p),E=/^[\s\t\n\r]/.test(b)?"":" ",H=F+I+r+E+b;d.value=H,d.selectionStart=d.selectionEnd=p+r.length+E.length,d.focus(),d.dispatchEvent(new Event("input"))}})}),ln&&e(Qe,{onClick:r=>{r.target===r.currentTarget&&ht(!1)},children:e(Ai,{onClose:()=>ht(!1),onSelect:({url:r,type:d,alt_text:x})=>{if(v.length>=u){alert(o._({id:"ctFhjs",values:{maxMediaAttachments:u}}));return}(async()=>{var A,F;let p;try{p=ze({text:o._({id:"/Cw4Tx"}),duration:-1});const I=await fetch(r,{referrerPolicy:"no-referrer"}).then(H=>H.blob()),b=new File([I],d==="video/mp4"?"video.mp4":"image.gif",{type:d}),E=[...v,{file:b,type:d,size:b.size,id:null,description:x||""}];L(E),(A=p==null?void 0:p.hideToast)==null||A.call(p)}catch{(F=p==null?void 0:p.hideToast)==null||F.call(p),ze(o._({id:"VKDnAx"}))}})()}})})]})}function Gt(s){if(!s)return;const{value:t,offsetHeight:n,scrollHeight:a,clientHeight:c}=s;if(nl.visibleInPicker),c=new In(a,{keys:["shortcode"],findAllMatches:!0});return[a,c]}const an=wn(yi,{matchesArg:(s,t)=>s.instance===t.instance,maxAge:30*60*1e3}),wi=async s=>{const{detectAll:t}=await kn(async()=>{const{detectAll:a}=await import("./tinyld-light-tbgyvj3S.js");return{detectAll:a}},[],import.meta.url),n=t(s);return n!=null&&n.length?n.slice(0,2).map(a=>a.lang):null},ki=En((s,t)=>{var ee;const{masto:n,instance:a}=_t(),[c,l]=K(((ee=t.current)==null?void 0:ee.value)||""),{maxCharacters:o,performSearch:y=()=>{},onTrigger:_=()=>{},...z}=s,N=V();te(()=>{an(a,n).then(u=>{const[h,m]=u;N.current=m}).catch(u=>{})},[]);const g=V(),B=V("");te(()=>{let u,h,m;return g.current&&(u=w=>{var re;const{key:f,provide:j,text:k}=w.detail;if(B.current=k,k===""){j(Promise.resolve({matched:!1}));return}if(f===":"){const ue=(re=N.current)==null?void 0:re.search(k,{limit:5});let X="";ue.forEach(({item:pe})=>{const{shortcode:S,url:O}=pe;X+=` +
  • + + ${ke(S)} +
  • `}),X+=`
  • ${ve._({id:"24misb"})}
  • `,Ee.innerHTML=X,j(Promise.resolve({matched:ue.length>0,fragment:Ee}));return}const G={"@":"accounts","#":"hashtags"}[f];j(new Promise(ue=>{y({type:G,q:k,limit:5}).then(pe=>{if(k!==B.current)return;const S=pe[G]||pe;let O="";S.forEach(U=>{var P;const{name:ie,avatarStatic:se,displayName:ae,username:D,acct:de,emojis:R,history:v}=U,L=Bn(ae,R);if(de)O+=` +
  • + + + + + ${L||D} +
    @${ke(de)} +
    +
  • + `;else{const J=(P=v==null?void 0:v.reduce)==null?void 0:P.call(v,(Q,ge)=>Q+ +ge.uses,0);O+=` +
  • + #${ke(ie)} + ${J?`${Mn(J)}`:""} +
  • + `}}),G==="accounts"&&(O+=`
  • ${ve._({id:"24misb"})}
  • `),Ee.innerHTML=O,ue({matched:S.length>0,fragment:Ee})})}))},g.current.addEventListener("text-expander-change",u),h=w=>{const{key:f,item:j}=w.detail,{value:k,more:G}=j.dataset;f===":"?(w.detail.value=k?`:${k}:`:"​",G&&(w.detail.continue=!0,setTimeout(()=>{_==null||_({name:"custom-emojis",defaultSearchTerm:G})},300))):f==="@"?(w.detail.value=k?`@${k} `:"​",G&&(w.detail.continue=!0,setTimeout(()=>{_==null||_({name:"mention",defaultSearchTerm:G})},300))):w.detail.value=`${f}${k}`},g.current.addEventListener("text-expander-value",h),m=w=>{const{input:f}=w.detail;if(l(f.value),t.current){const j=new Event("input",{bubbles:!0});t.current.dispatchEvent(j)}},g.current.addEventListener("text-expander-committed",m)),()=>{g.current&&(g.current.removeEventListener("text-expander-change",u),g.current.removeEventListener("text-expander-value",h),g.current.removeEventListener("text-expander-committed",m))}},[]),te(()=>{const u=t.current;if(!u)return;new ResizeObserver(()=>{if(g.current){const{height:m}=u.getBoundingClientRect();g.current.style.height=m+"px"}}).observe(u)},[]);const C=V(0),$=V(),T=Tn(u=>{var w;if(!$.current)return;if(C.current>3){$.current.innerHTML="",$.current=null,(w=T==null?void 0:T.cancel)==null||w.call(T);return}let h,m;C.current<=3&&(h=Date.now()),$.current.innerHTML=vi(u,{maxCharacters:o})+` +`,C.current<=3&&(m=Date.now()),h&&m&&m-h>50&&C.current++},500),ne=rt(()=>{var m,w;const u=(m=$.current)==null?void 0:m.cloneNode(!0);if(!u)return;u.querySelectorAll("mark").forEach(f=>{f.remove()});const h=(w=u.innerText)==null?void 0:w.trim();h&&(async()=>{const f=await wi(h);f!=null&&f.length&&(_==null||_({name:"auto-detect-language",languages:f}))})()},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",...z,ref:t,name:"status",value:c,onKeyDown:u=>{const{key:h,target:m}=u;if(h==="Enter"&&!(u.ctrlKey||u.metaKey))try{const{value:w,selectionStart:f}=m,k=w.slice(0,f).split(` +`).slice(-1)[0];if(k&&/^\s*(-|\d+\.)\s/.test(k)){const[G,re,ue,X,pe]=k.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(pe){u.preventDefault();const[S]=ue.match(/\d+/)||[],O=S?`${+S+1}.`:"-",U=` +${re}${O}${X}`;m.setRangeText(U,f,f);const ie=f+U.length;m.setSelectionRange(ie,ie)}else{const S=f-k.length;m.setRangeText("",S,f)}Gt(m),m.dispatchEvent(new Event("input"))}}catch{}$.current&&($.current.scrollTop=m.scrollTop)},onInput:u=>{var w;const{target:h}=u,m=h.value.replace(/\u200b/g,"");l(m),Gt(h),(w=s.onInput)==null||w.call(s,u),T(m),ne()},style:{width:"100%",height:"4em"},onScroll:u=>{if($.current){const{scrollTop:h}=u.target;$.current.scrollTop=h}}}),e("div",{ref:$,class:"compose-highlight","aria-hidden":"true"})]})});function Ei({maxCharacters:s=500,hidden:t}){const a=Fn(le).composerCharacterCount,c=s-a;return t?e("span",{class:"char-counter",hidden:!0}):e("span",{class:"char-counter",title:`${c}/${s}`,style:{"--percentage":a/s*100},children:[e("meter",{class:`${c<=-10?"explode":c<=0?"danger":c<=20?"warning":""}`,value:a,max:s}),e("span",{class:"counter",children:c})]})}function Yt(s,t,n,a){const c=Math.sqrt(t/s),l=Math.floor(n*c),o=Math.floor(a*c);return{newWidth:l,newHeight:o}}function Fi({attachment:s,disabled:t,lang:n,onDescriptionChange:a=()=>{},onRemove:c=()=>{}}){const{i18n:l}=qe(),[o,y]=K("default"),_=Je("@mastodon/edit-media-attributes"),{type:z,id:N,file:g}=s,B=je(()=>g?URL.createObjectURL(g):s.url,[g,s.url]),C=!!(g!=null&&g.size),$=C?Jt():{},{mediaAttachments:{imageSizeLimit:T,imageMatrixLimit:ne,videoSizeLimit:ee,videoMatrixLimit:u,videoFrameRateLimit:h}={}}=$||{},[m,w]=K(()=>C?z.startsWith("image")&&T&&g.size>T?{type:"imageSizeLimit",details:{imageSize:g.size,imageSizeLimit:T}}:z.startsWith("video")&&ee&&g.size>ee?{type:"videoSizeLimit",details:{videoSize:g.size,videoSizeLimit:ee}}:null:null),[f,j]=K({});te(()=>{!C||!ne||(f==null?void 0:f.matrix)>ne&&w({type:"imageMatrixLimit",details:{imageMatrix:f==null?void 0:f.matrix,imageMatrixLimit:ne,width:f==null?void 0:f.width,height:f==null?void 0:f.height}})},[f,ne,C]);const[k,G]=K({});te(()=>{!C||!u||(k==null?void 0:k.matrix)>u&&w({type:"videoMatrixLimit",details:{videoMatrix:k==null?void 0:k.matrix,videoMatrixLimit:u,width:k==null?void 0:k.width,height:k==null?void 0:k.height}})},[k,u,C]);const[re,ue]=K(s.description),[X,pe]=z.split("/"),S=rt(a,250);te(()=>{S(re)},[re,S]);const[O,U]=K(!1),ie=V(null);te(()=>{let R;return O&&ie.current&&(R=setTimeout(()=>{ie.current.focus()},100)),()=>{clearTimeout(R)}},[O]);const se=e(Pe,{children:N&&!_?e("div",{class:"media-desc",children:[e("span",{class:"tag",children:e(q,{id:"3wG7HI"})}),e("p",{title:re,children:s.description||e("i",{children:"No description"})})]}):e("textarea",{ref:ie,value:re||"",lang:n,placeholder:{image:l._({id:"Lh8B0N"}),video:l._({id:"mN4S+e"}),audio:l._({id:"ieZytw"})}[X],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:t||o==="loading",class:o==="loading"?"loading":"",maxlength:"1500",onInput:R=>{const{value:v}=R.target;ue(v)}})}),ae=V(null);te(()=>()=>{var R,v;(v=(R=ae.current)==null?void 0:R.hideToast)==null||v.call(R)},[]);const D=V(null),de=R=>{const{type:v,details:L}=R;switch(v){case"imageSizeLimit":{const{imageSize:P,imageSizeLimit:J}=L;return l._({id:"d83/LB",values:{0:Ze(P),1:Ze(J)}})}case"imageMatrixLimit":{const{imageMatrix:P,imageMatrixLimit:J,width:Q,height:ge}=L,{newWidth:we,newHeight:Le}=Yt(P,J,Q,ge);return l._({id:"DuvOX/",values:{0:l.number(Q),1:l.number(ge),2:l.number(we),3:l.number(Le)}})}case"videoSizeLimit":{const{videoSize:P,videoSizeLimit:J}=L;return l._({id:"d83/LB",values:{0:Ze(P),1:Ze(J)}})}case"videoMatrixLimit":{const{videoMatrix:P,videoMatrixLimit:J,width:Q,height:ge}=L,{newWidth:we,newHeight:Le}=Yt(P,J,Q,ge);return l._({id:"DuvOX/",values:{0:l.number(Q),1:l.number(ge),2:l.number(we),3:l.number(Le)}})}case"videoFrameRateLimit":return l._({id:"S1fBwy"})}};return e(Pe,{children:[e("div",{class:"media-attachment",children:[e("div",{class:"media-preview",tabIndex:"0",onClick:()=>{U(!0)},children:X==="image"?e("img",{src:B,alt:"",onLoad:R=>{if(!C)return;const{naturalWidth:v,naturalHeight:L}=R.target;j({matrix:v*L,width:v,height:L})}}):X==="video"||X==="gifv"?e("video",{src:B+"#t=0.1",playsinline:!0,muted:!0,disablePictureInPicture:!0,preload:"metadata",onLoadedMetadata:R=>{if(!C)return;const{videoWidth:v,videoHeight:L}=R.target;v&&L&&G({matrix:v*L,width:v,height:L})}}):X==="audio"?e("audio",{src:B,controls:!0}):null}),se,e("div",{class:"media-aside",children:[e("button",{type:"button",class:"plain close-button",disabled:t,onClick:c,children:e(Z,{icon:"x",alt:l._({id:"t/YqKh"})})}),!!m&&e("button",{type:"button",class:"media-error",title:de(m),onClick:()=>{D.current&&D.current.hideToast(),D.current=ze({text:de(m),duration:1e4})},children:e(Z,{icon:"alert",alt:l._({id:"SlfejT"})})})]})]}),O&&e(Qe,{onClose:()=>{U(!1)},children:e("div",{id:"media-sheet",class:"sheet sheet-max",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>{U(!1)},children:e(Z,{icon:"x",alt:l._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:{image:l._({id:"oMslIB"}),video:l._({id:"WZw+zB"}),audio:l._({id:"KMtgtM"})}[X]})}),e("main",{tabIndex:"-1",children:[e("div",{class:"media-preview",children:X==="image"?e("img",{src:B,alt:""}):X==="video"||X==="gifv"?e("video",{src:B,playsinline:!0,controls:!0}):X==="audio"?e("audio",{src:B,controls:!0}):null}),e("div",{class:"media-form",children:[se,e("footer",{children:[X==="image"&&/^(png|jpe?g|gif|webp)$/i.test(pe)&&!!le.settings.mediaAltGenerator&&!!vt&&e(Rn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:e(Z,{icon:"more",size:"l",alt:l._({id:"2FYpfJ"})})}),children:[e(Ot,{disabled:o==="loading",onClick:()=>{y("loading"),ae.current=ze({text:l._({id:"8zsp51"}),duration:-1}),async function(){var R,v;try{const L=new FormData;L.append("image",g);const P=await fetch(vt,{method:"POST",body:L}).then(J=>J.json());if(P.error)throw new Error(P.error);ue(P.description)}catch(L){ze(L.message?l._({id:"wy0Iwj",values:{0:L.message}}):l._({id:"xhYfVj"}))}finally{y("default"),(v=(R=ae.current)==null?void 0:R.hideToast)==null||v.call(R)}}()},children:[e(Z,{icon:"sparkles2"}),n&&n!=="en"?e("small",{children:[e(q,{id:"o5sTJw"}),e("br",{}),"(English)"]}):e("span",{children:e(q,{id:"o5sTJw"})})]}),!!n&&n!=="en"&&e(Ot,{disabled:o==="loading",onClick:()=>{y("loading"),ae.current=ze({text:l._({id:"8zsp51"}),duration:-1}),async function(){var R,v;try{const L=new FormData;L.append("image",g);const P=`?lang=${n}`,J=await fetch(vt+P,{method:"POST",body:L}).then(Q=>Q.json());if(J.error)throw new Error(J.error);ue(J.description)}catch(L){ze(l._({id:"eNTGfp",values:{0:L!=null&&L.message?`: ${L.message}`:""}}))}finally{y("default"),(v=(R=ae.current)==null?void 0:R.hideToast)==null||v.call(R)}}()},children:[e(Z,{icon:"sparkles2"}),e("small",{children:[e(q,{id:"o5sTJw"}),e("br",{}),e(q,{id:"m+pAEQ",values:{0:yt(n)},components:{0:e("span",{class:"more-insignificant"})}})]})]})]}),e("button",{type:"button",class:"light block",onClick:()=>{U(!1)},disabled:o==="loading",children:e(q,{id:"DPfwMq"})})]})]})]})]})})]})}function Ci({lang:s,poll:t,disabled:n,onInput:a=()=>{},maxOptions:c,maxExpiration:l,minExpiration:o,maxCharactersPerOption:y}){const{_}=qe(),{options:z,expiresIn:N,multiple:g}=t;return e("div",{class:`poll ${g?"multiple":""}`,children:[e("div",{class:"poll-choices",children:z.map((B,C)=>e("div",{class:"poll-choice",children:[e("input",{required:!0,type:"text",value:B,disabled:n,maxlength:y,placeholder:ve._({id:"LDUSXg",values:{0:C+1}}),lang:s,spellCheck:"true",dir:"auto",onInput:$=>{const{value:T}=$.target;z[C]=T,a(t)}}),e("button",{type:"button",class:"plain2 poll-button",disabled:n||z.length<=1,onClick:()=>{z.splice(C,1),a(t)},children:e(Z,{icon:"x",size:"s",alt:ve._({id:"t/YqKh"})})})]},C))}),e("div",{class:"poll-toolbar",children:[e("button",{type:"button",class:"plain2 poll-button",disabled:n||z.length>=c,onClick:()=>{z.push(""),a(t)},children:"+"})," ",e("label",{class:"multiple-choices",children:[e("input",{type:"checkbox",checked:g,disabled:n,onChange:B=>{const{checked:C}=B.target;t.multiple=C,a(t)}})," ",e(q,{id:"T57mm9"})]}),e("label",{class:"expires-in",children:[e(q,{id:"lkz6PL"})," ",e("select",{value:N,disabled:n,onChange:B=>{const{value:C}=B.target;t.expiresIn=C,a(t)},children:Object.entries(nn).filter(([B])=>B>=o&&B<=l).map(([B,C])=>e("option",{value:B,children:C()},B))})]})]}),e("div",{class:"poll-toolbar",children:e("button",{type:"button",class:"plain remove-poll-button",disabled:n,onClick:()=>{a(null)},children:e(q,{id:"CDpQAX"})})})]})}function ke(s){return s.replace(/[&<>"']/g,function(t){return"&#"+t.charCodeAt(0)+";"})}function Zt(s){for(let t in s)(s[t]===null||s[t]===void 0)&&delete s[t];return s}function zi({onClose:s=()=>{},onSelect:t=()=>{},defaultSearchTerm:n}){const{masto:a}=_t(),[c,l]=K("default"),[o,y]=K([]),[_,z]=K({}),[N,g]=K(0),B=async u=>{if(!(u!=null&&u.length))return;const h=await Dn(u,_);h&&z({..._,...h})},C=u=>{u&&(l("loading"),(async()=>{try{const h=await a.v1.accounts.search.list({q:u,limit:40,resolve:!1});y(h),B(h),l("default")}catch{l("error")}})())},$=rt(C,1e3);te(()=>{C()},[C]);const T=V();te(()=>{T.current&&(T.current.focus(),T.current.value&&(T.current.selectionStart=T.current.value.length,T.current.selectionEnd=T.current.value.length))},[]),te(()=>{n&&C(n)},[n]);const ne=u=>{const h=u.acct;t(h),s()};$e("enter",()=>{const u=o[N];u&&ne(u)},{preventDefault:!0,enableOnFormTags:["input"]});const ee=V();return $e("down",()=>{N{const u=ee.current.querySelector(".selected");u&&u.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),$e("up",()=>{N>0?g(N-1):g(o.length-1),setTimeout(()=>{const u=ee.current.querySelector(".selected");u&&u.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},1)},{preventDefault:!0,enableOnFormTags:["input"]}),e("div",{id:"mention-sheet",class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(Z,{icon:"x",alt:ve._({id:"yz7wBu"})})}),e("header",{children:e("form",{onSubmit:u=>{var h;u.preventDefault(),(h=$.flush)==null||h.call($)},children:e("input",{ref:T,required:!0,type:"search",class:"block",placeholder:ve._({id:"eH1bqp"}),onInput:u=>{const{value:h}=u.target;$(h)},autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:n||""})})}),e("main",{children:(o==null?void 0:o.length)>0?e("ul",{ref:ee,class:`accounts-list ${c==="loading"?"loading":""}`,children:o.map((u,h)=>{const m=_[u.id];return e("li",{class:h===N?"selected":"",children:[e(en,{avatarSize:"xxl",account:u,relationship:m,showStats:!0,showActivity:!0}),e("button",{type:"button",class:"plain2",onClick:()=>{ne(u)},children:e(Z,{icon:"plus",size:"xl",alt:ve._({id:"m16xKo"})})})]},u.id)})}):c==="loading"?e("div",{class:"ui-state",children:e(at,{abrupt:!0})}):c==="error"?e("div",{class:"ui-state",children:e("p",{children:e(q,{id:"AThL/k"})})}):null})]})}function _i({masto:s,instance:t,onClose:n=()=>{},onSelect:a=()=>{},defaultSearchTerm:c}){const[l,o]=K("default"),y=V([]),[_,z]=K([]),N=je(()=>Se.account.get("recentlyUsedCustomEmojis")||[]),g=V();te(()=>{o("loading"),(async()=>{try{const[h,m]=await an(t,s);g.current=m,z(h),o("default")}catch{o("error")}})()},[]);const B=je(()=>{const h={"--recent--":N.filter(w=>_.find(f=>f.shortcode===w.shortcode))},m=[];return _.forEach(w=>{var f,j;if((j=(f=y.current)==null?void 0:f.push)==null||j.call(f,w),!w.category){m.push(w);return}h[w.category]||(h[w.category]=[]),h[w.category].push(w)}),m.length&&(h["--others--"]=m),h},[_]),C=V(),[$,T]=K(null),ne=$t(h=>{var w,f,j;const{value:m}=h.target;if(m){const k=(w=g.current)==null?void 0:w.search(m,{limit:zt});T(k.map(G=>G.item)),(j=(f=C.current)==null?void 0:f.scrollTo)==null||j.call(f,0,0)}else T(null)},[_]);te(()=>{c&&(_!=null&&_.length)&&ne({target:{value:c}})},[c,ne,_]);const ee=$t(h=>{a==null||a(h),n==null||n(),queueMicrotask(()=>{let m=Se.account.get("recentlyUsedCustomEmojis")||[];const w=m.findIndex(f=>f.shortcode===h.shortcode);w!==-1?(m.splice(w,1),m.unshift(h)):(m.unshift(h),m=m.filter(f=>{var j,k;return(k=(j=y.current)==null?void 0:j.find)==null?void 0:k.call(j,G=>G.shortcode===f.shortcode)}),m=m.slice(0,10)),Se.account.set("recentlyUsedCustomEmojis",m)})},[a]),u=V();return te(()=>{u.current&&(u.current.focus(),u.current.value&&(u.current.selectionStart=u.current.value.length,u.current.selectionEnd=u.current.value.length))},[]),e("div",{id:"custom-emojis-sheet",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(Z,{icon:"x",alt:ve._({id:"yz7wBu"})})}),e("header",{children:[e("div",{children:[e("b",{children:e(q,{id:"8i6Ueo"})})," ",l==="loading"?e(at,{}):e("small",{class:"insignificant",children:[" • ",t]})]}),e("form",{onSubmit:h=>{h.preventDefault();const m=$[0];m&&ee(`:${m.shortcode}:`)},children:e("input",{ref:u,type:"search",placeholder:ve._({id:"EarrCe"}),onInput:ne,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",defaultValue:c||""})})]}),e("main",{ref:C,children:$!==null?e("ul",{class:"custom-emojis-matches custom-emojis-list",children:$.map(h=>e("li",{class:"custom-emojis-match",children:e(rn,{emoji:h,onClick:()=>{ee(`:${h.shortcode}:`)},showCode:!0})},h.shortcode))}):e("div",{class:"custom-emojis-list",children:[l==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(q,{id:"Kzwsg2"})})}),l==="default"&&Object.entries(B).map(([h,m])=>!!(m!=null&&m.length)&&e("div",{class:"section-container",children:[e("div",{class:"section-header",children:{"--recent--":ve._({id:"uabU9X"}),"--others--":ve._({id:"NuKR0h"})}[h]||h}),e(Li,{emojis:m,onSelect:ee})]}))]})})]})}const Li=Qt(({emojis:s,onSelect:t})=>{const{i18n:n}=qe(),[a,c]=K(zt),l=s.length>a;return e("section",{children:[s.slice(0,a).map(o=>e(rn,{emoji:o,onClick:()=>{t(`:${o.shortcode}:`)}},o.shortcode)),l&&e("button",{type:"button",class:"plain small",onClick:()=>c(a+zt),children:e(q,{id:"iAB71E",values:{0:n.number(s.length-a)}})})]})}),rn=Qt(({emoji:s,onClick:t,showCode:n})=>{const a=c=>{const o=c.currentTarget.closest("main");if(o){const y=o.getBoundingClientRect(),_=c.currentTarget.getBoundingClientRect(),z=c.currentTarget.classList;_.lefty.right-88?(z.add("edge-right"),z.remove("edge-left")):z.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(Pe,{children:[" ",e("code",{children:s.shortcode})]})]})}),xt=20;function Ai({onClose:s=()=>{},onSelect:t=()=>{}}){var C,$,T,ne,ee,u;const{i18n:n}=qe(),[a,c]=K("default"),[l,o]=K([]),y=V(null),_=V(null),z=V(0),N=V(null);function g({offset:h}){var m,w,f;(m=_.current)!=null&&m.value&&(c("loading"),(f=(w=N.current)==null?void 0:w.scrollTo)==null||f.call(w,{top:0,left:0,behavior:"smooth"}),(async()=>{var j;try{const k={api_key:ii,q:_.current.value,rating:"g",limit:xt,bundle:"messaging_non_clips",offset:h,lang:n.locale||"en"},G=await fetch("https://api.giphy.com/v1/gifs/search?"+new URLSearchParams(k),{referrerPolicy:"no-referrer"}).then(re=>re.json());z.current=((j=G.pagination)==null?void 0:j.offset)||0,o(G),c("results")}catch{c("error")}})())}te(()=>{var h;(h=_.current)==null||h.focus()},[]);const B=rt(()=>{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(Z,{icon:"x",alt:n._({id:"yz7wBu"})})}),e("header",{children:e("form",{ref:y,onSubmit:h=>{h.preventDefault(),g({offset:0})},children:[e("input",{ref:_,type:"search",name:"q",placeholder:n._({id:"wxlF9B"}),required:!0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",dir:"auto",onInput:B}),e("input",{type:"image",class:"powered-button",src:Qn,width:"86",height:"30",alt:n._({id:"c1Q/eU"})})]})}),e("main",{ref:N,class:a==="loading"?"loading":"",children:[a==="default"&&e("div",{class:"ui-state",children:e("p",{class:"insignificant",children:e(q,{id:"9KEidY"})})}),a==="loading"&&!((C=l==null?void 0:l.data)!=null&&C.length)&&e("div",{class:"ui-state",children:e(at,{abrupt:!0})}),(($=l==null?void 0:l.data)==null?void 0:$.length)>0?e(Pe,{children:[e("ul",{children:l.data.map(h=>{const{id:m,images:w,title:f,alt_text:j}=h,{fixed_height_small:k,fixed_height_downsampled:G,fixed_height:re,original:ue}=w,X=k!=null&&k.url?k:G!=null&&G.url?G:re;let{url:pe,webp:S,width:O,height:U}=X;+U>100&&(O=O/U*100,U=100);const ie=URL.parse(pe),se=ie.origin+ie.pathname;let ae;if(S){const D=URL.parse(S);ae=D.origin+D.pathname}return e("li",{children:e("button",{type:"button",onClick:()=>{const{mp4:D,url:de}=ue,R=D||de,v=URL.parse(R),L=v.origin+v.pathname;s(),t({url:L,type:D?"video/mp4":"image/gif",alt_text:j||f})},children:e("figure",{style:{"--figure-width":O+"px"},children:[e("picture",{children:[ae&&e("source",{srcset:ae,type:"image/webp"}),e("img",{src:se,width:O,height:U,loading:"lazy",decoding:"async",alt:j,referrerpolicy:"no-referrer",onLoad:D=>{D.target.style.backgroundColor="transparent"}})]}),e("figcaption",{children:j||f})]})})},m)})}),e("p",{class:"pagination",children:[((T=l.pagination)==null?void 0:T.offset)>0&&e("button",{type:"button",class:"light small",disabled:a==="loading",onClick:()=>{var h;g({offset:((h=l.pagination)==null?void 0:h.offset)-xt})},children:[e(Z,{icon:"chevron-left"}),e("span",{children:e(q,{id:"DHhJ7s"})})]}),e("span",{}),((ne=l.pagination)==null?void 0:ne.offset)+((ee=l.pagination)==null?void 0:ee.count)<((u=l.pagination)==null?void 0:u.total_count)&&e("button",{type:"button",class:"light small",disabled:a==="loading",onClick:()=>{var h;g({offset:((h=l.pagination)==null?void 0:h.offset)+xt})},children:[e("span",{children:e(q,{id:"hXzOVo"})})," ",e(Z,{icon:"chevron-right"})]})]})]}):a==="results"&&e("div",{class:"ui-state",children:e("p",{children:"No results"})}),a==="error"&&e("div",{class:"ui-state",children:e("p",{children:e(q,{id:"PbFw9n"})})})]})]})}export{Mi as default}; +//# sourceMappingURL=compose-N6HS-39B.js.map diff --git a/assets/compose-N6HS-39B.js.map b/assets/compose-N6HS-39B.js.map new file mode 100644 index 0000000..5b3ee29 --- /dev/null +++ b/assets/compose-N6HS-39B.js.map @@ -0,0 +1 @@ +{"version":3,"mappings":"g2BAAe,MAAMA,EAAS,CAC1B,YAAYC,EAAOC,EAAM,CAAE,sBAAAC,EAAuB,mBAAAC,CAAoB,EAAG,GAAI,CACzE,KAAK,MAAQH,EACb,KAAK,KAAOC,EACZ,KAAK,sBAAwBC,GAA6F,GAC1H,KAAK,mBAAqBC,GAAoF,GAC9G,KAAK,YAAc,GACdF,EAAK,KACNA,EAAK,GAAK,YAAY,KAAK,OAAM,EAAG,SAAQ,EAAG,MAAM,EAAG,CAAC,CAAC,IAE9D,KAAK,aAAe,CAAC,CAAC,UAAU,UAAU,MAAM,WAAW,EAC3D,KAAK,qBAAuBG,GAASC,GAAiBD,EAA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AA,UACJ,OACP,iBAAAjM,EAAA,IAGN,EACO,UAAAiM,EAAA,WACC,UAAAyU,IAAAvU,EAAA,UACDzO,UACC,kBACC,EAAAyO,EAAA,OACJ1O,eAAE,OAAA+U,EAAA,eAAkB,iBAAC,IAAAR,EACxB,6BACE,OAAAjY,GAAA,CAERA,EAAA,0CAAWgkB,EAAkC,EAAwB,CACtD,EAAA5R,EAAA,cACA,SAAA6F,GAAA9C,CAAA,GACT,CAAS,EAAe5C,CACtB,EAAA3E,CAAA,EAAiC,EAChC,EAAAsE,EAAA,KAGNjI,MAAY,aACA,YAAA8Z,EAAA9P,EAAA,yBAAA8P,EAAA,WAAA7R,EAAA,UAAUK,KACnBH,SAAc,oBAAE,SAAAnI,IAAA,UAGnBgK,YAAwB,OACvB1B,EACE,CACG0B,aAAahN,aAAbgN,cAA0B,QAAAoR,EACnB,EAAEzX,EAAIuY,eAAQhR,oBAAO8C,YAAaiO,cAClC,YACJE,EACAC,GACAC,+JACAO,cACF,MAAIV,cACJ,aAAqCvU,UAKjC,mBAAEA,GAAK4U,mDAAMvgB,CAAOwS,EAAO,SAAI8N,WAC/B,WAAejT,EAAA,CACjBrN,WACS,GACX,MAAAmM,EAAAU,EAAA,CACM2T,oBACAC,GACFC,GACJ,GACQO,kBAAcC,EAAU,OACfD,iBACjB,SAAA9U,EAAA,KACA,qBACE,CAAAG,CACE,GAAAtI,IACO,SAAAmI,EAAA,wBAEG,SAAAA,EAAA,KAAE2U,yBAAKnV,EACb,EACM6U,GACAC,GACE,EACC","names":["Combobox","input","list","tabInsertsSuggestions","defaultFirstOption","event","keyboardBindings","trackComposition","commitWithElement","_a","visible","indexDiff","focusEl","els","focusIndex","indexOfItem","newIndex","target","el","scrollTo","combobox","commit","fireCommitEvent","container","inViewport","element","scrollTop","containerBottom","top","bottom","boundary","query","text","key","cursor","multiWord","lookBackIndex","lastMatchPosition","keyIndex","pre","CustomHTMLElement","InputStyleCloneUpdateEvent","CloneRegistry","_InputStyleCloneElement","__privateAdd","_InputStyleCloneElement_instances","_styleObserver","__privateMethod","updateStyles_fn","_resizeObserver","requestUpdateLayout_fn","_inputRef","_container","_xOffset","_yOffset","_isLayoutUpdating","_onInput","updateText_fn","_onDocumentScrollOrResize","usingInput_fn","clone","__privateSet","__privateGet","input_get","fn","updateLayout_fn","inputStyle","inputRect","cloneRect","prop","propertiesToCopy","InputStyleCloneElement","e","_InputRange","startOffset","endOffset","_InputRange_instances","_inputElement","_startOffset","_endOffset","selectionStart","selectionEnd","offset","clampOffset_fn","toStart","createCloneRange_fn","styleClone_get","cloneElement_get","range","textNode","InputRange","states","TextExpander","expander","match","menu","_b","position","caretRect","targetPosition","currentPosition","delta","currentStyle","item","beginning","remaining","detail","suffix","value","found","providers","provide","result","x","TextExpanderElement","keysAttr","keys","multiWordAttr","globalMultiWord","state","ansiRegex","onlyFirst","pattern","regex","stripAnsi","string","segmenter","stringLength","countAnsiEscapeCodes","length","_","poweredByGiphyURL","PHANPY_IMG_ALT_API_URL","IMG_ALT_API_URL","PHANPY_GIPHY_API_KEY","GIPHY_API_KEY","import","supportedLanguagesMap","supportedLanguages","reduce","acc","l","code","common","native","expiryOptions","i18nDuration","expirySeconds","Object","oneDay","expiresInFromExpiresAt","expiresAt","Date","getTime","now","find","s","document","createElement","role","className","windowMargin","observer","IntersectionObserver","entries","forEach","entry","isIntersecting","left","width","boundingClientRect","innerWidth","window","insetInlineStart","isRTL","style","observe","DEFAULT_LANG","localeMatch","Intl","DateTimeFormat","resolvedOptions","locale","navigator","languages","map","urlRegexObj","RegExp","urlRegex","source","flags","usernameRegex","urlPlaceholder","countableText","inputText","replace","USERNAME_RE","MENTION_RE","HASHTAG_RE","SHORTCODE_RE_FRAGMENT","SCAN_RE","Segmenter","escapeHTML","highlightText","maxCharacters","Infinity","composerCharacterCount","withinLimitHTML","exceedLimitHTML","htmlSegments","segment","index","RTF","mem","RelativeTimeFormat","undefined","LF","ListFormat","CUSTOM_EMOJIS_COUNT","Compose","onClose","replyToStatus","editStatus","draftStatus","standalone","hasOpener","i18n","useLingui","rtf","lf","console","masto","instance","uiState","setUIState","useState","UID","uid","log","currentAccount","currentAccountInfo","maxMediaAttachments","charactersReservedPerUrl","imageMatrixLimit","supportedMimeTypes","imageSizeLimit","videoSizeLimit","videoMatrixLimit","videoFrameRateLimit","maxExpiration","maxOptions","maxCharactersPerOption","minExpiration","spoilerTextRef","useRef","textareaRef","store","prevLanguage","language","sensitive","setMediaAttachments","setLanguage","oninputTextarea","poll","account","focusTextarea","dispatchEvent","setTimeout","spoilerText","useEffect","visibility2","language2","sensitive2","visibility","current","m","allMentions","prefs","setSensitive","poll2","mediaAttachments","options","expiresIn","statusSource","dataset","mediaAttachments2","setVisibility","composablePoll","status","o","formRef","canClose","id","hasValue","hasMediaAttachments","isSelf","hasOnlyAcct","confirmClose","hasIDMediaAttachments","beforeUnloadCopy","handleBeforeUnload","sameWithSource","getCharCount","updateCharCount","supportsCloseWatcher","useHotkeys","yes","addEventListener","capture","modals","hasModal","hasOnlyComposer","prevBackgroundDraft","count","escDownRef","ignoreEventWhen","useCloseWatcher","draftKey","getCurrentAccountNS","backgroundDraft","useInterval","db","handleItems","username","acct","i2","items","unsupportedFiles","i18n2","drafts","set","updatedAt","f","debug","error","files","clipboardData","max","file","alert","mediaFiles","allowedFiles","1","2","handleDragover","setShowMentionPicker","showEmoji2Picker","showGIFPicker","useMemo","contentTranslationHideLanguages","autoDetectedLanguages","topLanguages","restLanguages","commonB","type","size","url","codeA","commonA","codeB","onMinimize","saveUnsavedDraft","_jsxs","dataTransfer","_jsx","showMentionPicker","topSupportedLanguages","children","class","confirmText","passData","__STATES__","opener","composerState","Icon","settings","sort","avatarStatic","disabled","onClick","Status","replyToStatusMonthsAgo","Trans","formData","components","0","media","onKeyDown","onSubmit","description","params2","res","attachment","results","mediaPromises","hasNoDescriptions","params","removeNullUndefined","newStatus","saveStatus","i","e2","media_attributes","in_reply_to_id","statuses","visibilityIconsMap","opacity","pointerEvents","checked","onChange","icon","title","limit","action","setShowEmoji2Picker","setAutoDetectedLanguages","Textarea","ref","placeholder","fileID","newAttachments","attachments","j","performSearch","q","v1","resolve","v2","fetch","onTrigger","defaultSearchTerm","Poll","newPoll","setPoll","onDescriptionChange","onInput","_Fragment","accept","setShowGIFPicker","Loader","CharCountMeter","commonText","localeCode2Text","restSupportedLanguages","textarea","textBeforeMention","spaceAfterMention","textAfterMention","newText","Modal","CustomEmojisModal","emojiShortcode","textBeforeEmoji","spaceBeforeEmoji","spaceAfterEmoji","textAfterEmoji","GIFPickerModal","alt_text","theToast","showToast","onSelect","autoResizeTextarea","scrollHeight","clientHeight","offsetHeight","height","_getCustomEmojis","visibleEmojis","searcher","getCustomEmojis","pmem","blob","keyArg","newMediaAttachments","lang","props","textareaProps","searcherRef","r","handleChange","text2","emojis","filter","Fuse","matchesArg","cacheKeyArg","emoji","detectLangs","shortcode","detectAll","langs","encodeHTML","forwardRef","html","textExpanderTextRef","history","displayNameWithEmoji","emojifyText","displayName","search","total","cur","name","shortenNumber","Promise","matched","then","v","more","textExpanderRef","handleValue","handleCommited","setText","slowHighlightPerf","composeHighlightRef","start","end","debouncedAutoDetectLanguage","useDebouncedCallback","dom","mark","resizeObserver","throttleHighlightText","lastLine","bullet","postSpaces","anything","number","newBullet","pos","dir","rows","cols","hidden","charCount","leftChars","ctrlKey","setRangeText","setSelectionRange","scaleDimension","matrix","matrixLimit","scalingFactor","newHeight","newWidth","MediaAttachment","supportsEdit","supports","onScroll","configuration","getCurrentInstanceConfiguration","maxError","setMaxError","checkMaxError","snapStates","imageMatrix","Math","videoMatrix","setDescription","debouncedOnDescriptionChange","timer","details","setImageMatrix","setVideoMatrix","toastRef","showModal","imageSizeLimit2","descTextarea","prettyBytes","videoSize","videoSizeLimit2","videoMatrixLimit2","videoMatrix2","maxErrorToast","maxErrorText","err","imageSize","suffixType","naturalWidth","naturalHeight","3","videoWidth","videoHeight","values","setShowModal","src","onLoad","onLoadedMetadata","onRemove","alt","subtype","Menu2","MenuItem","body","response","zIndex","menuButton","append","multiple","option","required","label","splice","str","char","obj","push","MentionModal","api","accounts","setAccounts","relationshipsMap","setRelationshipsMap","setSelectedIndex","accounts2","fetchRelationships","relationships","loadAccounts","inputRef","filterShortcodes","searchTerm","bLower","aStartsWith","bStartsWith","aContains","bothContain","bContains","socialAddress","selectedAccount","selectedIndex","selectAccount","listRef","selectedItem","loadRelationships","term","debouncedLoadAccounts","enableOnFormTags","relationship","AccountBlock","customEmojisList","recentlyUsedCustomEmojis","customEmojisCatList","emojisCat","customEmojis","othersCat","matches","setMatches","_c","scrollableRef","onFind","onSelectEmoji","useCallback","recentlyUsedCustomEmojis2","recentlyUsedEmojiIndex","emoji2","setCustomEmojis","category","queueMicrotask","CustomEmojisList","memo","setMax","CustomEmojiButton","showMore","showCode","parent","selfRect","rect","targetClassList","addEdges","GIFS_PER_PAGE","slice","fetchGIFs","qRef","closest","currentTarget","remove","debouncedOnInput","onPointerEnter","staticUrl","decoding","setResults","currentOffset","gif","images","fixed_height_small","fixed_height_downsampled","fixed_height","theImage","webp","urlObj","strippedURL","strippedWebP","preventDefault","original","theURL","mp4","url2","strippedURL2","webpObj","parse"],"ignoreList":[0,1,2,3,4],"sources":["../../node_modules/@github/combobox-nav/dist/index.js","../../node_modules/@github/text-expander-element/dist/index.js","../../node_modules/ansi-regex/index.js","../../node_modules/strip-ansi/index.js","../../node_modules/string-length/index.js","../../src/assets/powered-by-giphy.svg","../../src/components/compose.jsx"],"sourcesContent":["export default class Combobox {\n constructor(input, list, { tabInsertsSuggestions, defaultFirstOption } = {}) {\n this.input = input;\n this.list = list;\n this.tabInsertsSuggestions = tabInsertsSuggestions !== null && tabInsertsSuggestions !== void 0 ? tabInsertsSuggestions : true;\n this.defaultFirstOption = defaultFirstOption !== null && defaultFirstOption !== void 0 ? defaultFirstOption : false;\n this.isComposing = false;\n if (!list.id) {\n list.id = `combobox-${Math.random().toString().slice(2, 6)}`;\n }\n this.ctrlBindings = !!navigator.userAgent.match(/Macintosh/);\n this.keyboardEventHandler = event => keyboardBindings(event, this);\n this.compositionEventHandler = event => trackComposition(event, this);\n this.inputHandler = this.clearSelection.bind(this);\n input.setAttribute('role', 'combobox');\n input.setAttribute('aria-controls', list.id);\n input.setAttribute('aria-expanded', 'false');\n input.setAttribute('aria-autocomplete', 'list');\n input.setAttribute('aria-haspopup', 'listbox');\n }\n destroy() {\n this.clearSelection();\n this.stop();\n this.input.removeAttribute('role');\n this.input.removeAttribute('aria-controls');\n this.input.removeAttribute('aria-expanded');\n this.input.removeAttribute('aria-autocomplete');\n this.input.removeAttribute('aria-haspopup');\n }\n start() {\n this.input.setAttribute('aria-expanded', 'true');\n this.input.addEventListener('compositionstart', this.compositionEventHandler);\n this.input.addEventListener('compositionend', this.compositionEventHandler);\n this.input.addEventListener('input', this.inputHandler);\n this.input.addEventListener('keydown', this.keyboardEventHandler);\n this.list.addEventListener('click', commitWithElement);\n this.indicateDefaultOption();\n }\n stop() {\n this.clearSelection();\n this.input.setAttribute('aria-expanded', 'false');\n this.input.removeEventListener('compositionstart', this.compositionEventHandler);\n this.input.removeEventListener('compositionend', this.compositionEventHandler);\n this.input.removeEventListener('input', this.inputHandler);\n this.input.removeEventListener('keydown', this.keyboardEventHandler);\n this.list.removeEventListener('click', commitWithElement);\n }\n indicateDefaultOption() {\n var _a;\n if (this.defaultFirstOption) {\n (_a = Array.from(this.list.querySelectorAll('[role=\"option\"]:not([aria-disabled=\"true\"])'))\n .filter(visible)[0]) === null || _a === void 0 ? void 0 : _a.setAttribute('data-combobox-option-default', 'true');\n }\n }\n navigate(indexDiff = 1) {\n const focusEl = Array.from(this.list.querySelectorAll('[aria-selected=\"true\"]')).filter(visible)[0];\n const els = Array.from(this.list.querySelectorAll('[role=\"option\"]')).filter(visible);\n const focusIndex = els.indexOf(focusEl);\n if ((focusIndex === els.length - 1 && indexDiff === 1) || (focusIndex === 0 && indexDiff === -1)) {\n this.clearSelection();\n this.input.focus();\n return;\n }\n let indexOfItem = indexDiff === 1 ? 0 : els.length - 1;\n if (focusEl && focusIndex >= 0) {\n const newIndex = focusIndex + indexDiff;\n if (newIndex >= 0 && newIndex < els.length)\n indexOfItem = newIndex;\n }\n const target = els[indexOfItem];\n if (!target)\n return;\n for (const el of els) {\n el.removeAttribute('data-combobox-option-default');\n if (target === el) {\n this.input.setAttribute('aria-activedescendant', target.id);\n target.setAttribute('aria-selected', 'true');\n scrollTo(this.list, target);\n }\n else {\n el.removeAttribute('aria-selected');\n }\n }\n }\n clearSelection() {\n this.input.removeAttribute('aria-activedescendant');\n for (const el of this.list.querySelectorAll('[aria-selected=\"true\"]')) {\n el.removeAttribute('aria-selected');\n }\n this.indicateDefaultOption();\n }\n}\nfunction keyboardBindings(event, combobox) {\n if (event.shiftKey || event.metaKey || event.altKey)\n return;\n if (!combobox.ctrlBindings && event.ctrlKey)\n return;\n if (combobox.isComposing)\n return;\n switch (event.key) {\n case 'Enter':\n if (commit(combobox.input, combobox.list)) {\n event.preventDefault();\n }\n break;\n case 'Tab':\n if (combobox.tabInsertsSuggestions && commit(combobox.input, combobox.list)) {\n event.preventDefault();\n }\n break;\n case 'Escape':\n combobox.clearSelection();\n break;\n case 'ArrowDown':\n combobox.navigate(1);\n event.preventDefault();\n break;\n case 'ArrowUp':\n combobox.navigate(-1);\n event.preventDefault();\n break;\n case 'n':\n if (combobox.ctrlBindings && event.ctrlKey) {\n combobox.navigate(1);\n event.preventDefault();\n }\n break;\n case 'p':\n if (combobox.ctrlBindings && event.ctrlKey) {\n combobox.navigate(-1);\n event.preventDefault();\n }\n break;\n default:\n if (event.ctrlKey)\n break;\n combobox.clearSelection();\n }\n}\nfunction commitWithElement(event) {\n if (!(event.target instanceof Element))\n return;\n const target = event.target.closest('[role=\"option\"]');\n if (!target)\n return;\n if (target.getAttribute('aria-disabled') === 'true')\n return;\n fireCommitEvent(target);\n}\nfunction commit(input, list) {\n const target = list.querySelector('[aria-selected=\"true\"], [data-combobox-option-default=\"true\"]');\n if (!target)\n return false;\n if (target.getAttribute('aria-disabled') === 'true')\n return true;\n target.click();\n return true;\n}\nfunction fireCommitEvent(target) {\n target.dispatchEvent(new CustomEvent('combobox-commit', { bubbles: true }));\n}\nfunction visible(el) {\n return (!el.hidden &&\n !(el instanceof HTMLInputElement && el.type === 'hidden') &&\n (el.offsetWidth > 0 || el.offsetHeight > 0));\n}\nfunction trackComposition(event, combobox) {\n combobox.isComposing = event.type === 'compositionstart';\n const list = document.getElementById(combobox.input.getAttribute('aria-controls') || '');\n if (!list)\n return;\n combobox.clearSelection();\n}\nfunction scrollTo(container, target) {\n if (!inViewport(container, target)) {\n container.scrollTop = target.offsetTop;\n }\n}\nfunction inViewport(container, element) {\n const scrollTop = container.scrollTop;\n const containerBottom = scrollTop + container.clientHeight;\n const top = element.offsetTop;\n const bottom = top + element.clientHeight;\n return top >= scrollTop && bottom <= containerBottom;\n}\n","import Combobox from '@github/combobox-nav';\n\nconst boundary = /\\s|\\(|\\[/;\nfunction query(text, key, cursor, { multiWord, lookBackIndex, lastMatchPosition } = {\n multiWord: false,\n lookBackIndex: 0,\n lastMatchPosition: null\n}) {\n let keyIndex = text.lastIndexOf(key, cursor - 1);\n if (keyIndex === -1)\n return;\n if (keyIndex < lookBackIndex)\n return;\n if (multiWord) {\n if (lastMatchPosition != null) {\n if (lastMatchPosition === keyIndex)\n return;\n keyIndex = lastMatchPosition - key.length;\n }\n const charAfterKey = text[keyIndex + 1];\n if (charAfterKey === ' ' && cursor >= keyIndex + key.length + 1)\n return;\n const newLineIndex = text.lastIndexOf('\\n', cursor - 1);\n if (newLineIndex > keyIndex)\n return;\n const dotIndex = text.lastIndexOf('.', cursor - 1);\n if (dotIndex > keyIndex)\n return;\n }\n else {\n const spaceIndex = text.lastIndexOf(' ', cursor - 1);\n if (spaceIndex > keyIndex)\n return;\n }\n const pre = text[keyIndex - 1];\n if (pre && !boundary.test(pre))\n return;\n const queryString = text.substring(keyIndex + key.length, cursor);\n return {\n text: queryString,\n position: keyIndex + key.length\n };\n}\n\n/**\n * A custom element is implemented as a class which extends HTMLElement (in the\n * case of autonomous elements) or the interface you want to customize (in the\n * case of customized built-in elements).\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#custom_element_lifecycle_callbacks\n */\nclass CustomHTMLElement extends HTMLElement {\n}\n\nclass InputStyleCloneUpdateEvent extends Event {\n constructor() {\n super(\"update\");\n }\n}\nconst CloneRegistry = new WeakMap();\n/**\n * Create an element that exactly matches an input pixel-for-pixel and automatically stays in sync with it. This\n * is a non-interactive overlay on to the input and can be used to affect the visual appearance of the input\n * without modifying its behavior. The clone element is hidden by default.\n *\n * This lower level API powers the `InputRange` but provides more advanced functionality including event updates.\n *\n * Emits `update` events whenever anything is recalculated: when the layout changes, when the user scrolls, when the\n * input is updated, etc. This event may be emitted more than once per change.\n *\n * @note There may be cases in which the clone cannot observe changes to the input and fails to automatically update.\n * For example, if the `value` property on the input is written to directly, no `input` event is emitted by the input\n * and the clone does not automatically update. In these cases, `forceUpdate` can be used to manually trigger an update.\n */\n// PRIOR ART: This approach was adapted from the following MIT-licensed sources:\n// - primer/react (Copyright (c) 2018 GitHub, Inc.): https://github.com/primer/react/blob/a0db832302702b869aa22b0c4049ad9305ef631f/src/drafts/utils/character-coordinates.ts\n// - component/textarea-caret-position (Copyright (c) 2015 Jonathan Ong me@jongleberry.com): https://github.com/component/textarea-caret-position/blob/b5db7a7e47dd149c2a66276183c69234e4dabe30/index.js\n// - koddsson/textarea-caret-position (Copyright (c) 2015 Jonathan Ong me@jongleberry.com): https://github.com/koddsson/textarea-caret-position/blob/eba40ec8488eed4d77815f109af22e1d9c0751d3/index.js\nclass InputStyleCloneElement extends CustomHTMLElement {\n #styleObserver = new MutationObserver(() => this.#updateStyles());\n #resizeObserver = new ResizeObserver(() => this.#requestUpdateLayout());\n // This class is unique in that it will prevent itself from getting garbage collected because of the subscribed\n // observers (if never detached). Because of this, we want to avoid preventing the existence of this class from also\n // preventing the garbage collection of the associated input. This also allows us to automatically detach if the\n // input gets collected.\n #inputRef;\n #container;\n /**\n * Get the clone for an input, reusing an existing one if available. This avoids creating unecessary clones, which\n * have a performance cost due to their high-frequency event-based updates. Because these elements are shared, they\n * should be mutated with caution.\n *\n * Upon initial creation the clone element will automatically be inserted into the DOM and begin observing the\n * linked input. Only one clone per input can ever exist at a time.\n * @param input The target input to clone.\n */\n static for(input) {\n let clone = CloneRegistry.get(input);\n if (!clone) {\n clone = new InputStyleCloneElement();\n clone.connect(input);\n CloneRegistry.set(input, clone);\n }\n return clone;\n }\n /**\n * Connect this instance to a target input element and insert this instance into the DOM in the correct location.\n *\n * NOTE: calling the static `for` method is nearly always preferable as it will reuse an existing clone if available.\n * However, if reusing clones is problematic (ie, if the clone needs to be mutated), a clone can be constructed\n * directly with `new InputStyleCloneElement()` and then bound to an input and inserted into the DOM with\n * `clone.connect(target)`.\n */\n connect(input) {\n this.#inputRef = new WeakRef(input);\n // We want position:absolute so it doesn't take space in the layout, but that doesn't work with display:table-cell\n // used in the HTMLInputElement approach. So we need a wrapper.\n this.#container = document.createElement(\"div\");\n this.#container.style.position = \"absolute\";\n this.#container.style.pointerEvents = \"none\";\n input.after(this.#container);\n this.#container.appendChild(this);\n }\n /**\n * Force a recalculation. Will emit an `update` event. This is typically not needed unless the input has changed in\n * an unobservable way, eg by directly writing to the `value` property.\n */\n forceUpdate() {\n this.#updateStyles();\n this.#updateText();\n }\n /** @private */\n connectedCallback() {\n this.#usingInput((input) => {\n this.style.pointerEvents = \"none\";\n this.style.userSelect = \"none\";\n this.style.overflow = \"hidden\";\n this.style.display = \"block\";\n // Important not to use display:none which would not render the content at all\n this.style.visibility = \"hidden\";\n if (input instanceof HTMLTextAreaElement) {\n this.style.whiteSpace = \"pre-wrap\";\n this.style.wordWrap = \"break-word\";\n }\n else {\n this.style.whiteSpace = \"nowrap\";\n // text in single-line inputs is vertically centered\n this.style.display = \"table-cell\";\n this.style.verticalAlign = \"middle\";\n }\n this.setAttribute(\"aria-hidden\", \"true\");\n this.#updateStyles();\n this.#updateText();\n this.#styleObserver.observe(input, {\n attributeFilter: [\n \"style\",\n \"dir\", // users can right-click in some browsers to change the text direction dynamically\n ],\n });\n this.#resizeObserver.observe(input);\n document.addEventListener(\"scroll\", this.#onDocumentScrollOrResize, { capture: true });\n window.addEventListener(\"resize\", this.#onDocumentScrollOrResize, { capture: true });\n // capture so this happens first, so other things can respond to `input` events after this data updates\n input.addEventListener(\"input\", this.#onInput, { capture: true });\n });\n }\n /** @private */\n disconnectedCallback() {\n this.#container?.remove();\n this.#styleObserver.disconnect();\n this.#resizeObserver.disconnect();\n document.removeEventListener(\"scroll\", this.#onDocumentScrollOrResize, { capture: true });\n window.removeEventListener(\"resize\", this.#onDocumentScrollOrResize, { capture: true });\n // Can't use `usingInput` here since that could infinitely recurse\n const input = this.#input;\n if (input) {\n input.removeEventListener(\"input\", this.#onInput, { capture: true });\n CloneRegistry.delete(input);\n }\n }\n // --- private ---\n get #input() {\n return this.#inputRef?.deref();\n }\n /** Perform `fn` using the `input` if it is still available. If not, clean up the clone instead. */\n #usingInput(fn) {\n const input = this.#input;\n if (!input)\n return this.remove();\n return fn(input);\n }\n /** Current relative x-adjustment in pixels, executed via CSS transform. */\n #xOffset = 0;\n /** Current relative y-adjustment in pixels, executed via CSS transform. */\n #yOffset = 0;\n /**\n * Update only geometric properties without recalculating styles. Typically call `#requestUpdateLayout` instead to\n * only update once per animation frame.\n */\n #updateLayout() {\n // This runs often, so keep it as fast as possible! Avoid all unecessary updates.\n this.#usingInput((input) => {\n const inputStyle = window.getComputedStyle(input);\n this.style.height = inputStyle.height;\n this.style.width = inputStyle.width;\n // Immediately re-adjust for browser inconsistencies in scrollbar handling, if necessary\n if (input.clientHeight !== this.clientHeight)\n this.style.height = `calc(${inputStyle.height} + ${input.clientHeight - this.clientHeight}px)`;\n if (input.clientWidth !== this.clientWidth)\n this.style.width = `calc(${inputStyle.width} + ${input.clientWidth - this.clientWidth}px)`;\n // Position on top of the input\n const inputRect = input.getBoundingClientRect();\n const cloneRect = this.getBoundingClientRect();\n this.#xOffset = this.#xOffset + inputRect.left - cloneRect.left;\n this.#yOffset = this.#yOffset + inputRect.top - cloneRect.top;\n this.style.transform = `translate(${this.#xOffset}px, ${this.#yOffset}px)`;\n this.scrollTop = input.scrollTop;\n this.scrollLeft = input.scrollLeft;\n this.dispatchEvent(new InputStyleCloneUpdateEvent());\n });\n }\n #isLayoutUpdating = false;\n /** Request a layout update. Will only happen once per animation frame, to avoid unecessary updates. */\n #requestUpdateLayout() {\n if (this.#isLayoutUpdating)\n return;\n this.#isLayoutUpdating = true;\n requestAnimationFrame(() => {\n this.#updateLayout();\n this.#isLayoutUpdating = false;\n });\n }\n /** Update the styles of the clone based on the styles of the input, then request a layout update. */\n #updateStyles() {\n this.#usingInput((input) => {\n const inputStyle = window.getComputedStyle(input);\n for (const prop of propertiesToCopy)\n this.style[prop] = inputStyle[prop];\n this.#requestUpdateLayout();\n });\n }\n /**\n * Update the text content of the clone based on the text content of the input. Triggers a layout update in case the\n * text update caused scrolling.\n */\n #updateText() {\n this.#usingInput((input) => {\n this.textContent = input.value;\n // This is often unecessary on a pure text update, but text updates could potentially cause layout updates like\n // scrolling or resizing. And we run the update on _every frame_ when scrolling, so this isn't that expensive.\n // We don't requestUpdateLayout here because this one should happen synchronously, so that clients can react\n // within their own `input` event handlers.\n this.#updateLayout();\n });\n }\n #onInput = () => this.#updateText();\n #onDocumentScrollOrResize = (event) => {\n this.#usingInput((input) => {\n if (event.target === document ||\n event.target === window ||\n (event.target instanceof Node && event.target.contains(input)))\n this.#requestUpdateLayout();\n });\n };\n}\n// Note that some browsers, such as Firefox, do not concatenate properties\n// into their shorthand (e.g. padding-top, padding-bottom etc. -> padding),\n// so we have to list every single property explicitly.\nconst propertiesToCopy = [\n // RTL / vertical writing modes support:\n \"direction\",\n \"writingMode\",\n \"unicodeBidi\",\n \"textOrientation\",\n \"boxSizing\",\n \"borderTopWidth\",\n \"borderRightWidth\",\n \"borderBottomWidth\",\n \"borderLeftWidth\",\n \"borderStyle\",\n \"paddingTop\",\n \"paddingRight\",\n \"paddingBottom\",\n \"paddingLeft\",\n // https://developer.mozilla.org/en-US/docs/Web/CSS/font\n \"fontStyle\",\n \"fontVariant\",\n \"fontWeight\",\n \"fontStretch\",\n \"fontSize\",\n \"fontSizeAdjust\",\n \"lineHeight\",\n \"fontFamily\",\n \"textAlign\",\n \"textTransform\",\n \"textIndent\",\n \"textDecoration\",\n \"letterSpacing\",\n \"wordSpacing\",\n \"tabSize\",\n \"MozTabSize\",\n];\n// Inspired by https://github.com/github/catalyst/blob/dc284dcf4f82329a9cac5c867462a8fa529b6c40/src/register.ts\ntry {\n customElements.define(\"input-style-clone\", InputStyleCloneElement);\n}\ncatch (e) {\n // Throws DOMException with NotSupportedError if already defined\n if (!(e instanceof DOMException && e.name === \"NotSupportedError\"))\n throw e;\n}\n\nclass InputRange {\n #inputElement;\n #startOffset;\n #endOffset;\n /**\n * Construct a new `InputRange`.\n * @param element The target input element that contains the content for the range.\n * @param startOffset The inclusive 0-based start index for the range. Will be adjusted to fit in the input contents.\n * @param endOffset The exclusive 0-based end index for the range. Will be adjusted to fit in the input contents.\n */\n constructor(element, startOffset = 0, endOffset = startOffset) {\n this.#inputElement = element;\n this.#startOffset = startOffset;\n this.#endOffset = endOffset;\n }\n /**\n * Create a new range from the current user selection. If the input is not focused, the range will just be the start\n * of the input (offsets `0` to `0`).\n *\n * This can be used to get the caret coordinates: if the resulting range is `collapsed`, the location of the\n * `getBoundingClientRect` will be the location of the caret caret (note, however, that the width will be `0` in\n * this case).\n */\n static fromSelection(input) {\n const { selectionStart, selectionEnd } = input;\n return new InputRange(input, selectionStart ?? undefined, selectionEnd ?? undefined);\n }\n /** Returns true if the start is equal to the end of this range. */\n get collapsed() {\n return this.startOffset === this.endOffset;\n }\n /** Always returns the containing input element. */\n get commonAncestorContainer() {\n return this.#inputElement;\n }\n /** Always returns the containing input element. */\n get endContainer() {\n return this.#inputElement;\n }\n /** Always returns the containing input element. */\n get startContainer() {\n return this.#inputElement;\n }\n get startOffset() {\n return this.#startOffset;\n }\n get endOffset() {\n return this.#endOffset;\n }\n /** Update the inclusive start offset. Will be adjusted to fit within the content size. */\n setStartOffset(offset) {\n this.#startOffset = this.#clampOffset(offset);\n }\n /** Update the exclusive end offset. Will be adjusted to fit within the content size. */\n setEndOffset(offset) {\n this.#endOffset = this.#clampOffset(offset);\n }\n /**\n * Collapse this range to one side.\n * @param toStart If `true`, will collapse to the start side. Otherwise, will collapse to the end.\n */\n collapse(toStart = false) {\n if (toStart)\n this.setEndOffset(this.startOffset);\n else\n this.setStartOffset(this.endOffset);\n }\n /** Returns a `DocumentFragment` containing a new `Text` node containing the content in the range. */\n cloneContents() {\n return this.#createCloneRange().cloneContents();\n }\n /** Create a copy of this range. */\n cloneRange() {\n return new InputRange(this.#inputElement, this.startOffset, this.endOffset);\n }\n /**\n * Obtain one rect that contains the entire contents of the range. If the range spans multiple lines, this box will\n * contain all pieces of the range but may also contain some space outside the range.\n * @see https://iansan5653.github.io/dom-input-range/demos/playground/\n */\n getBoundingClientRect() {\n return this.#createCloneRange().getBoundingClientRect();\n }\n /**\n * Obtain the rects that contain contents of this range. If the range spans multiple lines, there will be multiple\n * bounding boxes. These boxes can be used, for example, to draw a highlight over the range.\n * @see https://iansan5653.github.io/dom-input-range/demos/playground/\n */\n getClientRects() {\n return this.#createCloneRange().getClientRects();\n }\n /** Get the contents of the range as a string. */\n toString() {\n return this.#createCloneRange().toString();\n }\n /**\n * Get the underlying `InputStyleClone` instance powering these calculations. This can be used to listen for\n * updates to trigger layout recalculation.\n */\n getStyleClone() {\n return this.#styleClone;\n }\n // --- private ---\n get #styleClone() {\n return InputStyleCloneElement.for(this.#inputElement);\n }\n get #cloneElement() {\n return this.#styleClone;\n }\n #clampOffset(offset) {\n return Math.max(0, Math.min(offset, this.#inputElement.value.length));\n }\n #createCloneRange() {\n // It's tempting to create a single Range and reuse it across the lifetime of the class. However, this wouldn't be\n // accurate because the contents of the input can change and the contents of the range would become stale. So we\n // must create a new range every time we need it.\n const range = document.createRange();\n const textNode = this.#cloneElement.childNodes[0];\n if (textNode) {\n range.setStart(textNode, this.startOffset);\n range.setEnd(textNode, this.endOffset);\n }\n return range;\n }\n}\n\nconst states = new WeakMap();\nclass TextExpander {\n constructor(expander, input) {\n this.expander = expander;\n this.input = input;\n this.combobox = null;\n this.menu = null;\n this.match = null;\n this.justPasted = false;\n this.lookBackIndex = 0;\n this.oninput = this.onInput.bind(this);\n this.onpaste = this.onPaste.bind(this);\n this.onkeydown = this.onKeydown.bind(this);\n this.oncommit = this.onCommit.bind(this);\n this.onmousedown = this.onMousedown.bind(this);\n this.onblur = this.onBlur.bind(this);\n this.interactingWithList = false;\n input.addEventListener('paste', this.onpaste);\n input.addEventListener('input', this.oninput);\n input.addEventListener('keydown', this.onkeydown);\n input.addEventListener('blur', this.onblur);\n }\n destroy() {\n this.input.removeEventListener('paste', this.onpaste);\n this.input.removeEventListener('input', this.oninput);\n this.input.removeEventListener('keydown', this.onkeydown);\n this.input.removeEventListener('blur', this.onblur);\n }\n dismissMenu() {\n if (this.deactivate()) {\n this.lookBackIndex = this.input.selectionEnd || this.lookBackIndex;\n }\n }\n activate(match, menu) {\n var _a, _b;\n if (this.input !== document.activeElement && this.input !== ((_b = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.activeElement)) {\n return;\n }\n this.deactivate();\n this.menu = menu;\n if (!menu.id)\n menu.id = `text-expander-${Math.floor(Math.random() * 100000).toString()}`;\n this.expander.append(menu);\n this.combobox = new Combobox(this.input, menu);\n this.expander.dispatchEvent(new Event('text-expander-activate'));\n this.positionMenu(menu, match.position);\n this.combobox.start();\n menu.addEventListener('combobox-commit', this.oncommit);\n menu.addEventListener('mousedown', this.onmousedown);\n this.combobox.navigate(1);\n }\n positionMenu(menu, position) {\n const caretRect = new InputRange(this.input, position).getBoundingClientRect();\n const targetPosition = { left: caretRect.left, top: caretRect.top + caretRect.height };\n const currentPosition = menu.getBoundingClientRect();\n const delta = {\n left: targetPosition.left - currentPosition.left,\n top: targetPosition.top - currentPosition.top\n };\n if (delta.left !== 0 || delta.top !== 0) {\n const currentStyle = getComputedStyle(menu);\n menu.style.left = currentStyle.left ? `calc(${currentStyle.left} + ${delta.left}px)` : `${delta.left}px`;\n menu.style.top = currentStyle.top ? `calc(${currentStyle.top} + ${delta.top}px)` : `${delta.top}px`;\n }\n }\n deactivate() {\n const menu = this.menu;\n if (!menu || !this.combobox)\n return false;\n this.expander.dispatchEvent(new Event('text-expander-deactivate'));\n this.menu = null;\n menu.removeEventListener('combobox-commit', this.oncommit);\n menu.removeEventListener('mousedown', this.onmousedown);\n this.combobox.destroy();\n this.combobox = null;\n menu.remove();\n return true;\n }\n onCommit({ target }) {\n var _a;\n const item = target;\n if (!(item instanceof HTMLElement))\n return;\n if (!this.combobox)\n return;\n const match = this.match;\n if (!match)\n return;\n const beginning = this.input.value.substring(0, match.position - match.key.length);\n const remaining = this.input.value.substring(match.position + match.text.length);\n const detail = { item, key: match.key, value: null, continue: false };\n const canceled = !this.expander.dispatchEvent(new CustomEvent('text-expander-value', { cancelable: true, detail }));\n if (canceled)\n return;\n if (!detail.value)\n return;\n let suffix = (_a = this.expander.getAttribute('suffix')) !== null && _a !== void 0 ? _a : ' ';\n if (detail.continue) {\n suffix = '';\n }\n const value = `${detail.value}${suffix}`;\n this.input.value = beginning + value + remaining;\n const cursor = beginning.length + value.length;\n this.deactivate();\n this.input.focus({\n preventScroll: true\n });\n this.input.selectionStart = cursor;\n this.input.selectionEnd = cursor;\n if (!detail.continue) {\n this.lookBackIndex = cursor;\n this.match = null;\n }\n this.expander.dispatchEvent(new CustomEvent('text-expander-committed', { cancelable: false, detail: { input: this.input } }));\n }\n onBlur() {\n if (this.interactingWithList) {\n this.interactingWithList = false;\n return;\n }\n this.deactivate();\n }\n onPaste() {\n this.justPasted = true;\n }\n async onInput() {\n if (this.justPasted) {\n this.justPasted = false;\n return;\n }\n const match = this.findMatch();\n if (match) {\n this.match = match;\n const menu = await this.notifyProviders(match);\n if (!this.match)\n return;\n if (menu) {\n this.activate(match, menu);\n }\n else {\n this.deactivate();\n }\n }\n else {\n this.match = null;\n this.deactivate();\n }\n }\n findMatch() {\n const cursor = this.input.selectionEnd || 0;\n const text = this.input.value;\n if (cursor <= this.lookBackIndex) {\n this.lookBackIndex = cursor - 1;\n }\n for (const { key, multiWord } of this.expander.keys) {\n const found = query(text, key, cursor, {\n multiWord,\n lookBackIndex: this.lookBackIndex,\n lastMatchPosition: this.match ? this.match.position : null\n });\n if (found) {\n return { text: found.text, key, position: found.position };\n }\n }\n }\n async notifyProviders(match) {\n const providers = [];\n const provide = (result) => providers.push(result);\n const canceled = !this.expander.dispatchEvent(new CustomEvent('text-expander-change', { cancelable: true, detail: { provide, text: match.text, key: match.key } }));\n if (canceled)\n return;\n const all = await Promise.all(providers);\n const fragments = all.filter(x => x.matched).map(x => x.fragment);\n return fragments[0];\n }\n onMousedown() {\n this.interactingWithList = true;\n }\n onKeydown(event) {\n if (event.key === 'Escape') {\n this.match = null;\n if (this.deactivate()) {\n this.lookBackIndex = this.input.selectionEnd || this.lookBackIndex;\n event.stopImmediatePropagation();\n event.preventDefault();\n }\n }\n }\n}\nclass TextExpanderElement extends HTMLElement {\n get keys() {\n const keysAttr = this.getAttribute('keys');\n const keys = keysAttr ? keysAttr.split(' ') : [];\n const multiWordAttr = this.getAttribute('multiword');\n const multiWord = multiWordAttr ? multiWordAttr.split(' ') : [];\n const globalMultiWord = multiWord.length === 0 && this.hasAttribute('multiword');\n return keys.map(key => ({ key, multiWord: globalMultiWord || multiWord.includes(key) }));\n }\n set keys(value) {\n this.setAttribute('keys', value);\n }\n connectedCallback() {\n const input = this.querySelector('input[type=\"text\"], textarea');\n if (!(input instanceof HTMLInputElement || input instanceof HTMLTextAreaElement))\n return;\n const state = new TextExpander(this, input);\n states.set(this, state);\n }\n disconnectedCallback() {\n const state = states.get(this);\n if (!state)\n return;\n state.destroy();\n states.delete(this);\n }\n dismiss() {\n const state = states.get(this);\n if (!state)\n return;\n state.dismissMenu();\n }\n}\n\nif (!window.customElements.get('text-expander')) {\n window.TextExpanderElement = TextExpanderElement;\n window.customElements.define('text-expander', TextExpanderElement);\n}\n\nexport { TextExpanderElement as default };\n","export default function ansiRegex({onlyFirst = false} = {}) {\n\tconst pattern = [\n\t '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)',\n\t\t'(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-ntqry=><~]))'\n\t].join('|');\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n","import ansiRegex from 'ansi-regex';\n\nconst regex = ansiRegex();\n\nexport default function stripAnsi(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof string}\\``);\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn string.replace(regex, '');\n}\n","import stripAnsi from 'strip-ansi';\n\nconst segmenter = new Intl.Segmenter();\n\nexport default function stringLength(string, {countAnsiEscapeCodes = false} = {}) {\n\tif (string === '') {\n\t\treturn 0;\n\t}\n\n\tif (!countAnsiEscapeCodes) {\n\t\tstring = stripAnsi(string);\n\t}\n\n\tif (string === '') {\n\t\treturn 0;\n\t}\n\n\tlet length = 0;\n\n\tfor (const _ of segmenter.segment(string)) { // eslint-disable-line no-unused-vars\n\t\tlength++;\n\t}\n\n\treturn length;\n}\n","export default \"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\"","import './compose.css';\nimport '@github/text-expander-element';\n\nimport { msg, plural, t, Trans } from '@lingui/macro';\nimport { useLingui } from '@lingui/react';\nimport { MenuItem } from '@szhsin/react-menu';\nimport { deepEqual } from 'fast-equals';\nimport Fuse from 'fuse.js';\nimport { forwardRef, memo } from 'preact/compat';\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks';\nimport { useHotkeys } from 'react-hotkeys-hook';\nimport stringLength from 'string-length';\n// import { detectAll } from 'tinyld/light';\nimport { uid } from 'uid/single';\nimport { useDebouncedCallback, useThrottledCallback } from 'use-debounce';\nimport { useSnapshot } from 'valtio';\n\nimport poweredByGiphyURL from '../assets/powered-by-giphy.svg';\n\nimport Menu2 from '../components/menu2';\nimport supportedLanguages from '../data/status-supported-languages';\nimport urlRegex from '../data/url-regex';\nimport { api } from '../utils/api';\nimport db from '../utils/db';\nimport emojifyText from '../utils/emojify-text';\nimport i18nDuration from '../utils/i18n-duration';\nimport isRTL from '../utils/is-rtl';\nimport localeMatch from '../utils/locale-match';\nimport localeCode2Text from '../utils/localeCode2Text';\nimport mem from '../utils/mem';\nimport openCompose from '../utils/open-compose';\nimport pmem from '../utils/pmem';\nimport prettyBytes from '../utils/pretty-bytes';\nimport { fetchRelationships } from '../utils/relationships';\nimport shortenNumber from '../utils/shorten-number';\nimport showToast from '../utils/show-toast';\nimport states, { saveStatus } from '../utils/states';\nimport store from '../utils/store';\nimport {\n getCurrentAccount,\n getCurrentAccountNS,\n getCurrentInstance,\n getCurrentInstanceConfiguration,\n} from '../utils/store-utils';\nimport supports from '../utils/supports';\nimport useCloseWatcher from '../utils/useCloseWatcher';\nimport useInterval from '../utils/useInterval';\nimport visibilityIconsMap from '../utils/visibility-icons-map';\n\nimport AccountBlock from './account-block';\n// import Avatar from './avatar';\nimport Icon from './icon';\nimport Loader from './loader';\nimport Modal from './modal';\nimport Status from './status';\n\nconst {\n PHANPY_IMG_ALT_API_URL: IMG_ALT_API_URL,\n PHANPY_GIPHY_API_KEY: GIPHY_API_KEY,\n} = import.meta.env;\n\nconst supportedLanguagesMap = supportedLanguages.reduce((acc, l) => {\n const [code, common, native] = l;\n acc[code] = {\n common,\n native,\n };\n return acc;\n}, {});\n\n/* NOTES:\n - Max character limit includes BOTH status text and Content Warning text\n*/\n\nconst expiryOptions = {\n 300: i18nDuration(5, 'minute'),\n 1_800: i18nDuration(30, 'minute'),\n 3_600: i18nDuration(1, 'hour'),\n 21_600: i18nDuration(6, 'hour'),\n 86_400: i18nDuration(1, 'day'),\n 259_200: i18nDuration(3, 'day'),\n 604_800: i18nDuration(1, 'week'),\n};\nconst expirySeconds = Object.keys(expiryOptions);\nconst oneDay = 24 * 60 * 60;\n\nconst expiresInFromExpiresAt = (expiresAt) => {\n if (!expiresAt) return oneDay;\n const delta = (new Date(expiresAt).getTime() - Date.now()) / 1000;\n return expirySeconds.find((s) => s >= delta) || oneDay;\n};\n\nconst menu = document.createElement('ul');\nmenu.role = 'listbox';\nmenu.className = 'text-expander-menu';\n\n// Set IntersectionObserver on menu, reposition it because text-expander doesn't handle it\nconst windowMargin = 16;\nconst observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n const { left, width } = entry.boundingClientRect;\n const { innerWidth } = window;\n if (left + width > innerWidth) {\n const insetInlineStart = isRTL() ? 'right' : 'left';\n menu.style[insetInlineStart] = innerWidth - width - windowMargin + 'px';\n }\n }\n });\n});\nobserver.observe(menu);\n\nconst DEFAULT_LANG = localeMatch(\n [new Intl.DateTimeFormat().resolvedOptions().locale, ...navigator.languages],\n supportedLanguages.map((l) => l[0]),\n 'en',\n);\n\n// https://github.com/mastodon/mastodon/blob/c4a429ed47e85a6bbf0d470a41cc2f64cf120c19/app/javascript/mastodon/features/compose/util/counter.js\nconst urlRegexObj = new RegExp(urlRegex.source, urlRegex.flags);\nconst usernameRegex = /(^|[^\\/\\w])@(([a-z0-9_]+)@[a-z0-9\\.\\-]+[a-z0-9]+)/gi;\nconst urlPlaceholder = '$2xxxxxxxxxxxxxxxxxxxxxxx';\nfunction countableText(inputText) {\n return inputText\n .replace(urlRegexObj, urlPlaceholder)\n .replace(usernameRegex, '$1@$3');\n}\n\n// https://github.com/mastodon/mastodon/blob/c03bd2a238741a012aa4b98dc4902d6cf948ab63/app/models/account.rb#L69\nconst USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i;\nconst MENTION_RE = new RegExp(\n `(^|[^=\\\\/\\\\w])(@${USERNAME_RE.source}(?:@[\\\\p{L}\\\\w.-]+[\\\\w]+)?)`,\n 'uig',\n);\n\n// AI-generated, all other regexes are too complicated\nconst HASHTAG_RE = new RegExp(\n `(^|[^=\\\\/\\\\w])(#[a-z0-9_]+([a-z0-9_.]+[a-z0-9_]+)?)(?![\\\\/\\\\w])`,\n 'ig',\n);\n\n// https://github.com/mastodon/mastodon/blob/23e32a4b3031d1da8b911e0145d61b4dd47c4f96/app/models/custom_emoji.rb#L31\nconst SHORTCODE_RE_FRAGMENT = '[a-zA-Z0-9_]{2,}';\nconst SCAN_RE = new RegExp(\n `(^|[^=\\\\/\\\\w])(:${SHORTCODE_RE_FRAGMENT}:)(?=[^A-Za-z0-9_:]|$)`,\n 'g',\n);\n\nconst segmenter = new Intl.Segmenter();\nfunction escapeHTML(text) {\n return text\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\nfunction highlightText(text, { maxCharacters = Infinity }) {\n // Exceeded characters limit\n const { composerCharacterCount } = states;\n if (composerCharacterCount > maxCharacters) {\n // Highlight exceeded characters\n let withinLimitHTML = '',\n exceedLimitHTML = '';\n const htmlSegments = segmenter.segment(text);\n for (const { segment, index } of htmlSegments) {\n if (index < maxCharacters) {\n withinLimitHTML += segment;\n } else {\n exceedLimitHTML += segment;\n }\n }\n if (exceedLimitHTML) {\n exceedLimitHTML =\n '' +\n escapeHTML(exceedLimitHTML) +\n '';\n }\n return escapeHTML(withinLimitHTML) + exceedLimitHTML;\n }\n\n return escapeHTML(text)\n .replace(urlRegexObj, '$2$3') // URLs\n .replace(MENTION_RE, '$1$2') // Mentions\n .replace(HASHTAG_RE, '$1$2') // Hashtags\n .replace(\n SCAN_RE,\n '$1$2',\n ); // Emoji shortcodes\n}\n\n// const rtf = new Intl.RelativeTimeFormat();\nconst RTF = mem((locale) => new Intl.RelativeTimeFormat(locale || undefined));\nconst LF = mem((locale) => new Intl.ListFormat(locale || undefined));\n\nconst CUSTOM_EMOJIS_COUNT = 100;\n\nfunction Compose({\n onClose,\n replyToStatus,\n editStatus,\n draftStatus,\n standalone,\n hasOpener,\n}) {\n const { i18n } = useLingui();\n const rtf = RTF(i18n.locale);\n const lf = LF(i18n.locale);\n\n console.warn('RENDER COMPOSER');\n const { masto, instance } = api();\n const [uiState, setUIState] = useState('default');\n const UID = useRef(draftStatus?.uid || uid());\n console.log('Compose UID', UID.current);\n\n const currentAccount = getCurrentAccount();\n const currentAccountInfo = currentAccount.info;\n\n const configuration = getCurrentInstanceConfiguration();\n console.log('⚙️ Configuration', configuration);\n\n const {\n statuses: {\n maxCharacters,\n maxMediaAttachments, // Beware: it can be undefined!\n charactersReservedPerUrl,\n } = {},\n mediaAttachments: {\n supportedMimeTypes,\n imageSizeLimit,\n imageMatrixLimit,\n videoSizeLimit,\n videoMatrixLimit,\n videoFrameRateLimit,\n } = {},\n polls: {\n maxOptions,\n maxCharactersPerOption,\n maxExpiration,\n minExpiration,\n } = {},\n } = configuration || {};\n\n const textareaRef = useRef();\n const spoilerTextRef = useRef();\n const [visibility, setVisibility] = useState('public');\n const [sensitive, setSensitive] = useState(false);\n const [language, setLanguage] = useState(\n store.session.get('currentLanguage') || DEFAULT_LANG,\n );\n const prevLanguage = useRef(language);\n const [mediaAttachments, setMediaAttachments] = useState([]);\n const [poll, setPoll] = useState(null);\n\n const prefs = store.account.get('preferences') || {};\n\n const oninputTextarea = () => {\n if (!textareaRef.current) return;\n textareaRef.current.dispatchEvent(new Event('input'));\n };\n const focusTextarea = () => {\n setTimeout(() => {\n if (!textareaRef.current) return;\n // status starts with newline, focus on first position\n if (draftStatus?.status?.startsWith?.('\\n')) {\n textareaRef.current.selectionStart = 0;\n textareaRef.current.selectionEnd = 0;\n }\n console.debug('FOCUS textarea');\n textareaRef.current?.focus();\n }, 300);\n };\n\n useEffect(() => {\n if (replyToStatus) {\n const { spoilerText, visibility, language, sensitive } = replyToStatus;\n if (spoilerText && spoilerTextRef.current) {\n spoilerTextRef.current.value = spoilerText;\n }\n const mentions = new Set([\n replyToStatus.account.acct,\n ...replyToStatus.mentions.map((m) => m.acct),\n ]);\n const allMentions = [...mentions].filter(\n (m) => m !== currentAccountInfo.acct,\n );\n if (allMentions.length > 0) {\n textareaRef.current.value = `${allMentions\n .map((m) => `@${m}`)\n .join(' ')} `;\n oninputTextarea();\n }\n focusTextarea();\n setVisibility(\n visibility === 'public' && prefs['posting:default:visibility']\n ? prefs['posting:default:visibility'].toLowerCase()\n : visibility,\n );\n setLanguage(\n language ||\n prefs['posting:default:language']?.toLowerCase() ||\n DEFAULT_LANG,\n );\n setSensitive(sensitive && !!spoilerText);\n } else if (editStatus) {\n const { visibility, language, sensitive, poll, mediaAttachments } =\n editStatus;\n const composablePoll = !!poll?.options && {\n ...poll,\n options: poll.options.map((o) => o?.title || o),\n expiresIn: poll?.expiresIn || expiresInFromExpiresAt(poll.expiresAt),\n };\n setUIState('loading');\n (async () => {\n try {\n const statusSource = await masto.v1.statuses\n .$select(editStatus.id)\n .source.fetch();\n console.log({ statusSource });\n const { text, spoilerText } = statusSource;\n textareaRef.current.value = text;\n textareaRef.current.dataset.source = text;\n oninputTextarea();\n focusTextarea();\n spoilerTextRef.current.value = spoilerText;\n setVisibility(visibility);\n setLanguage(\n language ||\n prefs['posting:default:language']?.toLowerCase() ||\n DEFAULT_LANG,\n );\n setSensitive(sensitive);\n if (composablePoll) setPoll(composablePoll);\n setMediaAttachments(mediaAttachments);\n setUIState('default');\n } catch (e) {\n console.error(e);\n alert(e?.reason || e);\n setUIState('error');\n }\n })();\n } else {\n focusTextarea();\n console.log('Apply prefs', prefs);\n if (prefs['posting:default:visibility']) {\n setVisibility(prefs['posting:default:visibility'].toLowerCase());\n }\n if (prefs['posting:default:language']) {\n setLanguage(prefs['posting:default:language'].toLowerCase());\n }\n if (prefs['posting:default:sensitive']) {\n setSensitive(!!prefs['posting:default:sensitive']);\n }\n }\n if (draftStatus) {\n const {\n status,\n spoilerText,\n visibility,\n language,\n sensitive,\n poll,\n mediaAttachments,\n } = draftStatus;\n const composablePoll = !!poll?.options && {\n ...poll,\n options: poll.options.map((o) => o?.title || o),\n expiresIn: poll?.expiresIn || expiresInFromExpiresAt(poll.expiresAt),\n };\n textareaRef.current.value = status;\n oninputTextarea();\n focusTextarea();\n if (spoilerText) spoilerTextRef.current.value = spoilerText;\n if (visibility) setVisibility(visibility);\n setLanguage(\n language ||\n prefs['posting:default:language']?.toLowerCase() ||\n DEFAULT_LANG,\n );\n if (sensitive !== null) setSensitive(sensitive);\n if (composablePoll) setPoll(composablePoll);\n if (mediaAttachments) setMediaAttachments(mediaAttachments);\n }\n }, [draftStatus, editStatus, replyToStatus]);\n\n const formRef = useRef();\n\n const beforeUnloadCopy = t`You have unsaved changes. Discard this post?`;\n const canClose = () => {\n const { value, dataset } = textareaRef.current;\n\n // check if loading\n if (uiState === 'loading') {\n console.log('canClose', { uiState });\n return false;\n }\n\n // check for status and media attachments\n const hasValue = (value || '')\n .trim()\n .replace(/^\\p{White_Space}+|\\p{White_Space}+$/gu, '');\n const hasMediaAttachments = mediaAttachments.length > 0;\n if (!hasValue && !hasMediaAttachments) {\n console.log('canClose', { value, mediaAttachments });\n return true;\n }\n\n // check if all media attachments have IDs\n const hasIDMediaAttachments =\n mediaAttachments.length > 0 &&\n mediaAttachments.every((media) => media.id);\n if (hasIDMediaAttachments) {\n console.log('canClose', { hasIDMediaAttachments });\n return true;\n }\n\n // check if status contains only \"@acct\", if replying\n const isSelf = replyToStatus?.account.id === currentAccountInfo.id;\n const hasOnlyAcct =\n replyToStatus && value.trim() === `@${replyToStatus.account.acct}`;\n // TODO: check for mentions, or maybe just generic \"@username\", including multiple mentions like \"@username1@username2\"\n if (!isSelf && hasOnlyAcct) {\n console.log('canClose', { isSelf, hasOnlyAcct });\n return true;\n }\n\n // check if status is same with source\n const sameWithSource = value === dataset?.source;\n if (sameWithSource) {\n console.log('canClose', { sameWithSource });\n return true;\n }\n\n console.log('canClose', {\n value,\n hasMediaAttachments,\n hasIDMediaAttachments,\n poll,\n isSelf,\n hasOnlyAcct,\n sameWithSource,\n uiState,\n });\n\n return false;\n };\n\n const confirmClose = () => {\n if (!canClose()) {\n const yes = confirm(beforeUnloadCopy);\n return yes;\n }\n return true;\n };\n\n useEffect(() => {\n // Show warning if user tries to close window with unsaved changes\n const handleBeforeUnload = (e) => {\n if (!canClose()) {\n e.preventDefault();\n e.returnValue = beforeUnloadCopy;\n }\n };\n window.addEventListener('beforeunload', handleBeforeUnload, {\n capture: true,\n });\n return () =>\n window.removeEventListener('beforeunload', handleBeforeUnload, {\n capture: true,\n });\n }, []);\n\n const getCharCount = () => {\n const { value } = textareaRef.current;\n const { value: spoilerText } = spoilerTextRef.current;\n return stringLength(countableText(value)) + stringLength(spoilerText);\n };\n const updateCharCount = () => {\n const count = getCharCount();\n states.composerCharacterCount = count;\n };\n useEffect(updateCharCount, []);\n\n const supportsCloseWatcher = window.CloseWatcher;\n const escDownRef = useRef(false);\n useHotkeys(\n 'esc',\n () => {\n escDownRef.current = true;\n // This won't be true if this event is already handled and not propagated 🤞\n },\n {\n enabled: !supportsCloseWatcher,\n enableOnFormTags: true,\n },\n );\n useHotkeys(\n 'esc',\n () => {\n if (!standalone && escDownRef.current && confirmClose()) {\n onClose();\n }\n escDownRef.current = false;\n },\n {\n enabled: !supportsCloseWatcher,\n enableOnFormTags: true,\n // Use keyup because Esc keydown will close the confirm dialog on Safari\n keyup: true,\n ignoreEventWhen: (e) => {\n const modals = document.querySelectorAll('#modal-container > *');\n const hasModal = !!modals;\n const hasOnlyComposer =\n modals.length === 1 && modals[0].querySelector('#compose-container');\n return hasModal && !hasOnlyComposer;\n },\n },\n );\n useCloseWatcher(() => {\n if (!standalone && confirmClose()) {\n onClose();\n }\n }, [standalone, confirmClose, onClose]);\n\n const prevBackgroundDraft = useRef({});\n const draftKey = () => {\n const ns = getCurrentAccountNS();\n return `${ns}#${UID.current}`;\n };\n const saveUnsavedDraft = () => {\n // Not enabling this for editing status\n // I don't think this warrant a draft mode for a status that's already posted\n // Maybe it could be a big edit change but it should be rare\n if (editStatus) return;\n if (states.composerState.minimized) return;\n const key = draftKey();\n const backgroundDraft = {\n key,\n replyTo: replyToStatus\n ? {\n /* Smaller payload of replyToStatus. Reasons:\n - No point storing whole thing\n - Could have media attachments\n - Could be deleted/edited later\n */\n id: replyToStatus.id,\n account: {\n id: replyToStatus.account.id,\n username: replyToStatus.account.username,\n acct: replyToStatus.account.acct,\n },\n }\n : null,\n draftStatus: {\n uid: UID.current,\n status: textareaRef.current.value,\n spoilerText: spoilerTextRef.current.value,\n visibility,\n language,\n sensitive,\n poll,\n mediaAttachments,\n },\n };\n if (\n !deepEqual(backgroundDraft, prevBackgroundDraft.current) &&\n !canClose()\n ) {\n console.debug('not equal', backgroundDraft, prevBackgroundDraft.current);\n db.drafts\n .set(key, {\n ...backgroundDraft,\n state: 'unsaved',\n updatedAt: Date.now(),\n })\n .then(() => {\n console.debug('DRAFT saved', key, backgroundDraft);\n })\n .catch((e) => {\n console.error('DRAFT failed', key, e);\n });\n prevBackgroundDraft.current = structuredClone(backgroundDraft);\n }\n };\n useInterval(saveUnsavedDraft, 5000); // background save every 5s\n useEffect(() => {\n saveUnsavedDraft();\n // If unmounted, means user discarded the draft\n // Also means pop-out 🙈, but it's okay because the pop-out will persist the ID and re-create the draft\n return () => {\n db.drafts.del(draftKey());\n };\n }, []);\n\n useEffect(() => {\n const handleItems = (e) => {\n const { items } = e.clipboardData || e.dataTransfer;\n const files = [];\n const unsupportedFiles = [];\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n if (item.kind === 'file') {\n const file = item.getAsFile();\n if (\n supportedMimeTypes !== undefined &&\n !supportedMimeTypes.includes(file.type)\n ) {\n unsupportedFiles.push(file);\n } else {\n files.push(file);\n }\n }\n }\n if (unsupportedFiles.length > 0) {\n alert(\n plural(unsupportedFiles.length, {\n one: `File ${unsupportedFiles[0].name} is not supported.`,\n other: `Files ${lf.format(\n unsupportedFiles.map((f) => f.name),\n )} are not supported.`,\n }),\n );\n }\n if (files.length > 0 && mediaAttachments.length >= maxMediaAttachments) {\n alert(\n plural(maxMediaAttachments, {\n one: 'You can only attach up to 1 file.',\n other: 'You can only attach up to # files.',\n }),\n );\n return;\n }\n console.log({ files });\n if (files.length > 0) {\n e.preventDefault();\n e.stopPropagation();\n // Auto-cut-off files to avoid exceeding maxMediaAttachments\n let allowedFiles = files;\n if (maxMediaAttachments !== undefined) {\n const max = maxMediaAttachments - mediaAttachments.length;\n allowedFiles = allowedFiles.slice(0, max);\n if (allowedFiles.length <= 0) {\n alert(\n plural(maxMediaAttachments, {\n one: 'You can only attach up to 1 file.',\n other: 'You can only attach up to # files.',\n }),\n );\n return;\n }\n }\n const mediaFiles = allowedFiles.map((file) => ({\n file,\n type: file.type,\n size: file.size,\n url: URL.createObjectURL(file),\n id: null,\n description: null,\n }));\n setMediaAttachments([...mediaAttachments, ...mediaFiles]);\n }\n };\n window.addEventListener('paste', handleItems);\n const handleDragover = (e) => {\n // Prevent default if there's files\n if (e.dataTransfer.items.length > 0) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n window.addEventListener('dragover', handleDragover);\n window.addEventListener('drop', handleItems);\n return () => {\n window.removeEventListener('paste', handleItems);\n window.removeEventListener('dragover', handleDragover);\n window.removeEventListener('drop', handleItems);\n };\n }, [mediaAttachments]);\n\n const [showMentionPicker, setShowMentionPicker] = useState(false);\n const [showEmoji2Picker, setShowEmoji2Picker] = useState(false);\n const [showGIFPicker, setShowGIFPicker] = useState(false);\n\n const [autoDetectedLanguages, setAutoDetectedLanguages] = useState(null);\n const [topSupportedLanguages, restSupportedLanguages] = useMemo(() => {\n const topLanguages = [];\n const restLanguages = [];\n const { contentTranslationHideLanguages = [] } = states.settings;\n supportedLanguages.forEach((l) => {\n const [code] = l;\n if (\n code === language ||\n code === prevLanguage.current ||\n code === DEFAULT_LANG ||\n contentTranslationHideLanguages.includes(code) ||\n (autoDetectedLanguages?.length && autoDetectedLanguages.includes(code))\n ) {\n topLanguages.push(l);\n } else {\n restLanguages.push(l);\n }\n });\n topLanguages.sort(([codeA, commonA], [codeB, commonB]) => {\n if (codeA === language) return -1;\n if (codeB === language) return 1;\n return commonA.localeCompare(commonB);\n });\n restLanguages.sort(([codeA, commonA], [codeB, commonB]) =>\n commonA.localeCompare(commonB),\n );\n return [topLanguages, restLanguages];\n }, [language, autoDetectedLanguages]);\n\n const replyToStatusMonthsAgo = useMemo(\n () =>\n !!replyToStatus?.createdAt &&\n Math.floor(\n (Date.now() - new Date(replyToStatus.createdAt)) /\n (1000 * 60 * 60 * 24 * 30),\n ),\n [replyToStatus],\n );\n\n const onMinimize = () => {\n saveUnsavedDraft();\n states.composerState.minimized = true;\n };\n\n return (\n
    \n
    \n
    \n {currentAccountInfo?.avatarStatic && (\n // \n \n )}\n {!standalone ? (\n \n {\n // If there are non-ID media attachments (not yet uploaded), show confirmation dialog because they are not going to be passed to the new window\n // const containNonIDMediaAttachments =\n // mediaAttachments.length > 0 &&\n // mediaAttachments.some((media) => !media.id);\n // if (containNonIDMediaAttachments) {\n // const yes = confirm(\n // 'You have media attachments that are not yet uploaded. Opening a new window will discard them and you will need to re-attach them. Are you sure you want to continue?',\n // );\n // if (!yes) {\n // return;\n // }\n // }\n\n // const mediaAttachmentsWithIDs = mediaAttachments.filter(\n // (media) => media.id,\n // );\n\n const newWin = openCompose({\n editStatus,\n replyToStatus,\n draftStatus: {\n uid: UID.current,\n status: textareaRef.current.value,\n spoilerText: spoilerTextRef.current.value,\n visibility,\n language,\n sensitive,\n poll,\n mediaAttachments,\n },\n });\n\n if (!newWin) {\n return;\n }\n\n onClose();\n }}\n >\n \n \n \n \n {' '}\n {\n if (confirmClose()) {\n onClose();\n }\n }}\n >\n \n \n \n ) : (\n hasOpener && (\n {\n // If there are non-ID media attachments (not yet uploaded), show confirmation dialog because they are not going to be passed to the new window\n // const containNonIDMediaAttachments =\n // mediaAttachments.length > 0 &&\n // mediaAttachments.some((media) => !media.id);\n // if (containNonIDMediaAttachments) {\n // const yes = confirm(\n // 'You have media attachments that are not yet uploaded. Opening a new window will discard them and you will need to re-attach them. Are you sure you want to continue?',\n // );\n // if (!yes) {\n // return;\n // }\n // }\n\n if (!window.opener) {\n alert(t`Looks like you closed the parent window.`);\n return;\n }\n\n if (window.opener.__STATES__.showCompose) {\n if (window.opener.__STATES__.composerState?.publishing) {\n alert(\n t`Looks like you already have a compose field open in the parent window and currently publishing. Please wait for it to be done and try again later.`,\n );\n return;\n }\n\n let confirmText = t`Looks like you already have a compose field open in the parent window. Popping in this window will discard the changes you made in the parent window. Continue?`;\n const yes = confirm(confirmText);\n if (!yes) return;\n }\n\n // const mediaAttachmentsWithIDs = mediaAttachments.filter(\n // (media) => media.id,\n // );\n\n onClose({\n fn: () => {\n const passData = {\n editStatus,\n replyToStatus,\n draftStatus: {\n uid: UID.current,\n status: textareaRef.current.value,\n spoilerText: spoilerTextRef.current.value,\n visibility,\n language,\n sensitive,\n poll,\n mediaAttachments,\n },\n };\n window.opener.__COMPOSE__ = passData; // Pass it here instead of `showCompose` due to some weird proxy issue again\n if (window.opener.__STATES__.showCompose) {\n window.opener.__STATES__.showCompose = false;\n setTimeout(() => {\n window.opener.__STATES__.showCompose = true;\n }, 10);\n } else {\n window.opener.__STATES__.showCompose = true;\n }\n if (window.opener.__STATES__.composerState.minimized) {\n // Maximize it\n window.opener.__STATES__.composerState.minimized = false;\n }\n },\n });\n }}\n >\n \n \n )\n )}\n
    \n {!!replyToStatus && (\n
    \n \n
    \n {replyToStatusMonthsAgo > 0 ? (\n \n Replying to @\n {replyToStatus.account.acct || replyToStatus.account.username}\n ’s post (\n \n {rtf.format(-replyToStatusMonthsAgo, 'month')}\n \n )\n \n ) : (\n \n Replying to @\n {replyToStatus.account.acct || replyToStatus.account.username}\n ’s post\n \n )}\n
    \n
    \n )}\n {!!editStatus && (\n
    \n \n
    \n Editing source post\n
    \n
    \n )}\n {\n if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {\n formRef.current.dispatchEvent(\n new Event('submit', { cancelable: true }),\n );\n }\n }}\n onSubmit={(e) => {\n e.preventDefault();\n\n const formData = new FormData(e.target);\n const entries = Object.fromEntries(formData.entries());\n console.log('ENTRIES', entries);\n let { status, visibility, sensitive, spoilerText } = entries;\n\n // Pre-cleanup\n sensitive = sensitive === 'on'; // checkboxes return \"on\" if checked\n\n // Validation\n /* Let the backend validate this\n if (stringLength(status) > maxCharacters) {\n alert(`Status is too long! Max characters: ${maxCharacters}`);\n return;\n }\n if (\n sensitive &&\n stringLength(status) + stringLength(spoilerText) > maxCharacters\n ) {\n alert(\n `Status and content warning is too long! Max characters: ${maxCharacters}`,\n );\n return;\n }\n */\n if (poll) {\n if (poll.options.length < 2) {\n alert(t`Poll must have at least 2 options`);\n return;\n }\n if (poll.options.some((option) => option === '')) {\n alert(t`Some poll choices are empty`);\n return;\n }\n }\n // TODO: check for URLs and use `charactersReservedPerUrl` to calculate max characters\n\n if (mediaAttachments.length > 0) {\n // If there are media attachments, check if they have no descriptions\n const hasNoDescriptions = mediaAttachments.some(\n (media) => !media.description?.trim?.(),\n );\n if (hasNoDescriptions) {\n const yes = confirm(\n t`Some media have no descriptions. Continue?`,\n );\n if (!yes) return;\n }\n }\n\n // Post-cleanup\n spoilerText = (sensitive && spoilerText) || undefined;\n status = status === '' ? undefined : status;\n\n // states.composerState.minimized = true;\n states.composerState.publishing = true;\n setUIState('loading');\n (async () => {\n try {\n console.log('MEDIA ATTACHMENTS', mediaAttachments);\n if (mediaAttachments.length > 0) {\n // Upload media attachments first\n const mediaPromises = mediaAttachments.map((attachment) => {\n const { file, description, id } = attachment;\n console.log('UPLOADING', attachment);\n if (id) {\n // If already uploaded\n return attachment;\n } else {\n const params = removeNullUndefined({\n file,\n description,\n });\n return masto.v2.media.create(params).then((res) => {\n if (res.id) {\n attachment.id = res.id;\n }\n return res;\n });\n }\n });\n const results = await Promise.allSettled(mediaPromises);\n\n // If any failed, return\n if (\n results.some((result) => {\n return result.status === 'rejected' || !result.value?.id;\n })\n ) {\n states.composerState.publishing = false;\n states.composerState.publishingError = true;\n setUIState('error');\n // Alert all the reasons\n results.forEach((result) => {\n if (result.status === 'rejected') {\n console.error(result);\n alert(result.reason || t`Attachment #${i} failed`);\n }\n });\n return;\n }\n\n console.log({ results, mediaAttachments });\n }\n\n /* NOTE:\n Using snakecase here because masto.js's `isObject` returns false for `params`, ONLY happens when opening in pop-out window. This is maybe due to `window.masto` variable being passed from the parent window. The check that failed is `x.constructor === Object`, so maybe the `Object` in new window is different than parent window's?\n Code: https://github.com/neet/masto.js/blob/dd0d649067b6a2b6e60fbb0a96597c373a255b00/src/serializers/is-object.ts#L2\n\n // TODO: Note above is no longer true in Masto.js v6. Revisit this.\n */\n let params = {\n status,\n // spoilerText,\n spoiler_text: spoilerText,\n language,\n sensitive,\n poll,\n // mediaIds: mediaAttachments.map((attachment) => attachment.id),\n media_ids: mediaAttachments.map(\n (attachment) => attachment.id,\n ),\n };\n if (editStatus && supports('@mastodon/edit-media-attributes')) {\n params.media_attributes = mediaAttachments.map(\n (attachment) => {\n return {\n id: attachment.id,\n description: attachment.description,\n // focus\n // thumbnail\n };\n },\n );\n } else if (!editStatus) {\n params.visibility = visibility;\n // params.inReplyToId = replyToStatus?.id || undefined;\n params.in_reply_to_id = replyToStatus?.id || undefined;\n }\n params = removeNullUndefined(params);\n console.log('POST', params);\n\n let newStatus;\n if (editStatus) {\n newStatus = await masto.v1.statuses\n .$select(editStatus.id)\n .update(params);\n saveStatus(newStatus, instance, {\n skipThreading: true,\n });\n } else {\n try {\n newStatus = await masto.v1.statuses.create(params, {\n requestInit: {\n headers: {\n 'Idempotency-Key': UID.current,\n },\n },\n });\n } catch (_) {\n // If idempotency key fails, try again without it\n newStatus = await masto.v1.statuses.create(params);\n }\n }\n states.composerState.minimized = false;\n states.composerState.publishing = false;\n setUIState('default');\n\n // Close\n onClose({\n // type: post, reply, edit\n type: editStatus ? 'edit' : replyToStatus ? 'reply' : 'post',\n newStatus,\n instance,\n });\n } catch (e) {\n states.composerState.publishing = false;\n states.composerState.publishingError = true;\n console.error(e);\n alert(e?.reason || e);\n setUIState('error');\n }\n })();\n }}\n >\n
    \n {\n updateCharCount();\n }}\n />\n \n {\n const sensitive = e.target.checked;\n setSensitive(sensitive);\n if (sensitive) {\n spoilerTextRef.current?.focus();\n } else {\n textareaRef.current?.focus();\n }\n }}\n />\n \n {' '}\n \n \n {\n setVisibility(e.target.value);\n }}\n disabled={uiState === 'loading' || !!editStatus}\n dir=\"auto\"\n >\n \n {(supports('@pleroma/local-visibility-post') ||\n supports('@akkoma/local-visibility-post')) && (\n \n )}\n \n \n \n \n {' '}\n
    \n {\n updateCharCount();\n }}\n maxCharacters={maxCharacters}\n performSearch={(params) => {\n const { type, q, limit } = params;\n if (type === 'accounts') {\n return masto.v1.accounts.search.list({\n q,\n limit,\n resolve: false,\n });\n }\n return masto.v2.search.fetch(params);\n }}\n onTrigger={(action) => {\n if (action?.name === 'custom-emojis') {\n setShowEmoji2Picker({\n defaultSearchTerm: action?.defaultSearchTerm || null,\n });\n } else if (action?.name === 'mention') {\n setShowMentionPicker({\n defaultSearchTerm: action?.defaultSearchTerm || null,\n });\n } else if (\n action?.name === 'auto-detect-language' &&\n action?.languages\n ) {\n setAutoDetectedLanguages(action.languages);\n }\n }}\n />\n {mediaAttachments?.length > 0 && (\n
    \n {mediaAttachments.map((attachment, i) => {\n const { id, file } = attachment;\n const fileID = file?.size + file?.type + file?.name;\n return (\n {\n setMediaAttachments((attachments) => {\n const newAttachments = [...attachments];\n newAttachments[i] = {\n ...newAttachments[i],\n description: value,\n };\n return newAttachments;\n });\n }}\n onRemove={() => {\n setMediaAttachments((attachments) => {\n return attachments.filter((_, j) => j !== i);\n });\n }}\n />\n );\n })}\n \n
    \n )}\n {!!poll && (\n {\n if (poll) {\n const newPoll = { ...poll };\n setPoll(newPoll);\n } else {\n setPoll(null);\n }\n }}\n />\n )}\n \n \n \n {/* If maxOptions is not defined or defined and is greater than 1, show poll button */}\n {maxOptions == null ||\n (maxOptions > 1 && (\n <>\n {\n setPoll({\n options: ['', ''],\n expiresIn: 24 * 60 * 60, // 1 day\n multiple: false,\n });\n }}\n >\n \n \n \n ))}\n {/* {\n setShowMentionPicker(true);\n }}\n >\n \n */}\n {\n setShowEmoji2Picker(true);\n }}\n >\n \n \n {!!states.settings.composerGIFPicker && (\n = maxMediaAttachments) ||\n !!poll\n }\n onClick={() => {\n setShowGIFPicker(true);\n }}\n >\n GIF\n \n )}\n \n
    \n {uiState === 'loading' ? (\n \n ) : (\n
    \n \n
    \n {showMentionPicker && (\n {\n if (e.target === e.currentTarget) {\n setShowMentionPicker(false);\n }\n }}\n >\n {\n setShowMentionPicker(false);\n }}\n defaultSearchTerm={showMentionPicker?.defaultSearchTerm}\n onSelect={(socialAddress) => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n const { selectionStart, selectionEnd } = textarea;\n const text = textarea.value;\n const textBeforeMention = text.slice(0, selectionStart);\n const spaceBeforeMention = textBeforeMention\n ? /[\\s\\t\\n\\r]$/.test(textBeforeMention)\n ? ''\n : ' '\n : '';\n const textAfterMention = text.slice(selectionEnd);\n const spaceAfterMention = /^[\\s\\t\\n\\r]/.test(textAfterMention)\n ? ''\n : ' ';\n const newText =\n textBeforeMention +\n spaceBeforeMention +\n '@' +\n socialAddress +\n spaceAfterMention +\n textAfterMention;\n textarea.value = newText;\n textarea.selectionStart = textarea.selectionEnd =\n selectionEnd +\n 1 +\n socialAddress.length +\n spaceAfterMention.length;\n textarea.focus();\n textarea.dispatchEvent(new Event('input'));\n }}\n />\n \n )}\n {showEmoji2Picker && (\n {\n if (e.target === e.currentTarget) {\n setShowEmoji2Picker(false);\n }\n }}\n >\n {\n setShowEmoji2Picker(false);\n }}\n defaultSearchTerm={showEmoji2Picker?.defaultSearchTerm}\n onSelect={(emojiShortcode) => {\n const textarea = textareaRef.current;\n if (!textarea) return;\n const { selectionStart, selectionEnd } = textarea;\n const text = textarea.value;\n const textBeforeEmoji = text.slice(0, selectionStart);\n const spaceBeforeEmoji = textBeforeEmoji\n ? /[\\s\\t\\n\\r]$/.test(textBeforeEmoji)\n ? ''\n : ' '\n : '';\n const textAfterEmoji = text.slice(selectionEnd);\n const spaceAfterEmoji = /^[\\s\\t\\n\\r]/.test(textAfterEmoji)\n ? ''\n : ' ';\n const newText =\n textBeforeEmoji +\n spaceBeforeEmoji +\n emojiShortcode +\n spaceAfterEmoji +\n textAfterEmoji;\n textarea.value = newText;\n textarea.selectionStart = textarea.selectionEnd =\n selectionEnd + emojiShortcode.length + spaceAfterEmoji.length;\n textarea.focus();\n textarea.dispatchEvent(new Event('input'));\n }}\n />\n \n )}\n {showGIFPicker && (\n {\n if (e.target === e.currentTarget) {\n setShowGIFPicker(false);\n }\n }}\n >\n setShowGIFPicker(false)}\n onSelect={({ url, type, alt_text }) => {\n console.log('GIF URL', url);\n if (mediaAttachments.length >= maxMediaAttachments) {\n alert(\n plural(maxMediaAttachments, {\n one: 'You can only attach up to 1 file.',\n other: 'You can only attach up to # files.',\n }),\n );\n return;\n }\n // Download the GIF and insert it as media attachment\n (async () => {\n let theToast;\n try {\n theToast = showToast({\n text: t`Downloading GIF…`,\n duration: -1,\n });\n const blob = await fetch(url, {\n referrerPolicy: 'no-referrer',\n }).then((res) => res.blob());\n const file = new File(\n [blob],\n type === 'video/mp4' ? 'video.mp4' : 'image.gif',\n {\n type,\n },\n );\n const newMediaAttachments = [\n ...mediaAttachments,\n {\n file,\n type,\n size: file.size,\n id: null,\n description: alt_text || '',\n },\n ];\n setMediaAttachments(newMediaAttachments);\n theToast?.hideToast?.();\n } catch (err) {\n console.error(err);\n theToast?.hideToast?.();\n showToast(t`Failed to download GIF`);\n }\n })();\n }}\n />\n \n )}\n
    \n );\n}\n\nfunction autoResizeTextarea(textarea) {\n if (!textarea) return;\n const { value, offsetHeight, scrollHeight, clientHeight } = textarea;\n if (offsetHeight < window.innerHeight) {\n // NOTE: This check is needed because the offsetHeight return 50000 (really large number) on first render\n // No idea why it does that, will re-investigate in far future\n const offset = offsetHeight - clientHeight;\n const height = value ? scrollHeight + offset + 'px' : null;\n textarea.style.height = height;\n }\n}\n\nasync function _getCustomEmojis(instance, masto) {\n const emojis = await masto.v1.customEmojis.list();\n const visibleEmojis = emojis.filter((e) => e.visibleInPicker);\n const searcher = new Fuse(visibleEmojis, {\n keys: ['shortcode'],\n findAllMatches: true,\n });\n return [visibleEmojis, searcher];\n}\nconst getCustomEmojis = pmem(_getCustomEmojis, {\n // Limit by time to reduce memory usage\n // Cached by instance\n matchesArg: (cacheKeyArg, keyArg) => cacheKeyArg.instance === keyArg.instance,\n maxAge: 30 * 60 * 1000, // 30 minutes\n});\n\nconst detectLangs = async (text) => {\n const { detectAll } = await import('tinyld/light');\n const langs = detectAll(text);\n if (langs?.length) {\n // return max 2\n return langs.slice(0, 2).map((lang) => lang.lang);\n }\n return null;\n};\n\nconst Textarea = forwardRef((props, ref) => {\n const { masto, instance } = api();\n const [text, setText] = useState(ref.current?.value || '');\n const {\n maxCharacters,\n performSearch = () => {},\n onTrigger = () => {},\n ...textareaProps\n } = props;\n // const snapStates = useSnapshot(states);\n // const charCount = snapStates.composerCharacterCount;\n\n // const customEmojis = useRef();\n const searcherRef = useRef();\n useEffect(() => {\n getCustomEmojis(instance, masto)\n .then((r) => {\n const [emojis, searcher] = r;\n searcherRef.current = searcher;\n })\n .catch((e) => {\n console.error(e);\n });\n }, []);\n\n const textExpanderRef = useRef();\n const textExpanderTextRef = useRef('');\n useEffect(() => {\n let handleChange, handleValue, handleCommited;\n if (textExpanderRef.current) {\n handleChange = (e) => {\n // console.log('text-expander-change', e);\n const { key, provide, text } = e.detail;\n textExpanderTextRef.current = text;\n\n if (text === '') {\n provide(\n Promise.resolve({\n matched: false,\n }),\n );\n return;\n }\n\n if (key === ':') {\n // const emojis = customEmojis.current.filter((emoji) =>\n // emoji.shortcode.startsWith(text),\n // );\n // const emojis = filterShortcodes(customEmojis.current, text);\n const results = searcherRef.current?.search(text, {\n limit: 5,\n });\n let html = '';\n results.forEach(({ item: emoji }) => {\n const { shortcode, url } = emoji;\n html += `\n
  • \n \"\" \n ${encodeHTML(shortcode)}\n
  • `;\n });\n html += `
  • ${t`More…`}
  • `;\n // console.log({ emojis, html });\n menu.innerHTML = html;\n provide(\n Promise.resolve({\n matched: results.length > 0,\n fragment: menu,\n }),\n );\n return;\n }\n\n const type = {\n '@': 'accounts',\n '#': 'hashtags',\n }[key];\n provide(\n new Promise((resolve) => {\n const searchResults = performSearch({\n type,\n q: text,\n limit: 5,\n });\n searchResults.then((value) => {\n if (text !== textExpanderTextRef.current) {\n return;\n }\n console.log({ value, type, v: value[type] });\n const results = value[type] || value;\n console.log('RESULTS', value, results);\n let html = '';\n results.forEach((result) => {\n const {\n name,\n avatarStatic,\n displayName,\n username,\n acct,\n emojis,\n history,\n } = result;\n const displayNameWithEmoji = emojifyText(displayName, emojis);\n // const item = menuItem.cloneNode();\n if (acct) {\n html += `\n
  • \n \n \"\"\n \n \n ${displayNameWithEmoji || username}\n
    @${encodeHTML(\n acct,\n )}\n
    \n
  • \n `;\n } else {\n const total = history?.reduce?.(\n (acc, cur) => acc + +cur.uses,\n 0,\n );\n html += `\n
  • \n #${encodeHTML(name)}\n ${\n total\n ? `${shortenNumber(total)}`\n : ''\n }\n
  • \n `;\n }\n });\n if (type === 'accounts') {\n html += `
  • ${t`More…`}
  • `;\n }\n menu.innerHTML = html;\n console.log('MENU', results, menu);\n resolve({\n matched: results.length > 0,\n fragment: menu,\n });\n });\n }),\n );\n };\n\n textExpanderRef.current.addEventListener(\n 'text-expander-change',\n handleChange,\n );\n\n handleValue = (e) => {\n const { key, item } = e.detail;\n const { value, more } = item.dataset;\n if (key === ':') {\n e.detail.value = value ? `:${value}:` : '​'; // zero-width space\n if (more) {\n // Prevent adding space after the above value\n e.detail.continue = true;\n\n setTimeout(() => {\n onTrigger?.({\n name: 'custom-emojis',\n defaultSearchTerm: more,\n });\n }, 300);\n }\n } else if (key === '@') {\n e.detail.value = value ? `@${value} ` : '​'; // zero-width space\n if (more) {\n e.detail.continue = true;\n setTimeout(() => {\n onTrigger?.({\n name: 'mention',\n defaultSearchTerm: more,\n });\n }, 300);\n }\n } else {\n e.detail.value = `${key}${value}`;\n }\n };\n\n textExpanderRef.current.addEventListener(\n 'text-expander-value',\n handleValue,\n );\n\n handleCommited = (e) => {\n const { input } = e.detail;\n setText(input.value);\n // fire input event\n if (ref.current) {\n const event = new Event('input', { bubbles: true });\n ref.current.dispatchEvent(event);\n }\n };\n\n textExpanderRef.current.addEventListener(\n 'text-expander-committed',\n handleCommited,\n );\n }\n\n return () => {\n if (textExpanderRef.current) {\n textExpanderRef.current.removeEventListener(\n 'text-expander-change',\n handleChange,\n );\n textExpanderRef.current.removeEventListener(\n 'text-expander-value',\n handleValue,\n );\n textExpanderRef.current.removeEventListener(\n 'text-expander-committed',\n handleCommited,\n );\n }\n };\n }, []);\n\n useEffect(() => {\n // Resize observer for textarea\n const textarea = ref.current;\n if (!textarea) return;\n const resizeObserver = new ResizeObserver(() => {\n // Get height of textarea, set height to textExpander\n if (textExpanderRef.current) {\n const { height } = textarea.getBoundingClientRect();\n textExpanderRef.current.style.height = height + 'px';\n }\n });\n resizeObserver.observe(textarea);\n }, []);\n\n const slowHighlightPerf = useRef(0); // increment if slow\n const composeHighlightRef = useRef();\n const throttleHighlightText = useThrottledCallback((text) => {\n if (!composeHighlightRef.current) return;\n if (slowHighlightPerf.current > 3) {\n // After 3 times of lag, disable highlighting\n composeHighlightRef.current.innerHTML = '';\n composeHighlightRef.current = null; // Destroy the whole thing\n throttleHighlightText?.cancel?.();\n return;\n }\n let start;\n let end;\n if (slowHighlightPerf.current <= 3) start = Date.now();\n composeHighlightRef.current.innerHTML =\n highlightText(text, {\n maxCharacters,\n }) + '\\n';\n if (slowHighlightPerf.current <= 3) end = Date.now();\n console.debug('HIGHLIGHT PERF', { start, end, diff: end - start });\n if (start && end && end - start > 50) {\n // if slow, increment\n slowHighlightPerf.current++;\n }\n // Newline to prevent multiple line breaks at the end from being collapsed, no idea why\n }, 500);\n\n const debouncedAutoDetectLanguage = useDebouncedCallback(() => {\n // Make use of the highlightRef to get the DOM\n // Clone the dom\n const dom = composeHighlightRef.current?.cloneNode(true);\n if (!dom) return;\n // Remove mark\n dom.querySelectorAll('mark').forEach((mark) => {\n mark.remove();\n });\n const text = dom.innerText?.trim();\n if (!text) return;\n (async () => {\n const langs = await detectLangs(text);\n if (langs?.length) {\n onTrigger?.({\n name: 'auto-detect-language',\n languages: langs,\n });\n }\n })();\n }, 2000);\n\n return (\n \n {\n // Get line before cursor position after pressing 'Enter'\n const { key, target } = e;\n if (key === 'Enter' && !(e.ctrlKey || e.metaKey)) {\n try {\n const { value, selectionStart } = target;\n const textBeforeCursor = value.slice(0, selectionStart);\n const lastLine = textBeforeCursor.split('\\n').slice(-1)[0];\n if (lastLine) {\n // If line starts with \"- \" or \"12. \"\n if (/^\\s*(-|\\d+\\.)\\s/.test(lastLine)) {\n // insert \"- \" at cursor position\n const [_, preSpaces, bullet, postSpaces, anything] =\n lastLine.match(/^(\\s*)(-|\\d+\\.)(\\s+)(.+)?/) || [];\n if (anything) {\n e.preventDefault();\n const [number] = bullet.match(/\\d+/) || [];\n const newBullet = number ? `${+number + 1}.` : '-';\n const text = `\\n${preSpaces}${newBullet}${postSpaces}`;\n target.setRangeText(text, selectionStart, selectionStart);\n const pos = selectionStart + text.length;\n target.setSelectionRange(pos, pos);\n } else {\n // trim the line before the cursor, then insert new line\n const pos = selectionStart - lastLine.length;\n target.setRangeText('', pos, selectionStart);\n }\n autoResizeTextarea(target);\n target.dispatchEvent(new Event('input'));\n }\n }\n } catch (e) {\n // silent fail\n console.error(e);\n }\n }\n if (composeHighlightRef.current) {\n composeHighlightRef.current.scrollTop = target.scrollTop;\n }\n }}\n onInput={(e) => {\n const { target } = e;\n // Replace zero-width space\n const text = target.value.replace(/\\u200b/g, '');\n setText(text);\n autoResizeTextarea(target);\n props.onInput?.(e);\n throttleHighlightText(text);\n debouncedAutoDetectLanguage();\n }}\n style={{\n width: '100%',\n height: '4em',\n // '--text-weight': (1 + charCount / 140).toFixed(1) || 1,\n }}\n onScroll={(e) => {\n if (composeHighlightRef.current) {\n const { scrollTop } = e.target;\n composeHighlightRef.current.scrollTop = scrollTop;\n }\n }}\n />\n \n \n );\n});\n\nfunction CharCountMeter({ maxCharacters = 500, hidden }) {\n const snapStates = useSnapshot(states);\n const charCount = snapStates.composerCharacterCount;\n const leftChars = maxCharacters - charCount;\n if (hidden) {\n return \n );\n}\n\nfunction scaleDimension(matrix, matrixLimit, width, height) {\n // matrix = number of pixels\n // matrixLimit = max number of pixels\n // Calculate new width and height, downsize to within the limit, preserve aspect ratio, no decimals\n const scalingFactor = Math.sqrt(matrixLimit / matrix);\n const newWidth = Math.floor(width * scalingFactor);\n const newHeight = Math.floor(height * scalingFactor);\n return { newWidth, newHeight };\n}\n\nfunction MediaAttachment({\n attachment,\n disabled,\n lang,\n onDescriptionChange = () => {},\n onRemove = () => {},\n}) {\n const { i18n } = useLingui();\n const [uiState, setUIState] = useState('default');\n const supportsEdit = supports('@mastodon/edit-media-attributes');\n const { type, id, file } = attachment;\n const url = useMemo(\n () => (file ? URL.createObjectURL(file) : attachment.url),\n [file, attachment.url],\n );\n console.log({ attachment });\n\n const checkMaxError = !!file?.size;\n const configuration = checkMaxError ? getCurrentInstanceConfiguration() : {};\n const {\n mediaAttachments: {\n imageSizeLimit,\n imageMatrixLimit,\n videoSizeLimit,\n videoMatrixLimit,\n videoFrameRateLimit,\n } = {},\n } = configuration || {};\n\n const [maxError, setMaxError] = useState(() => {\n if (!checkMaxError) return null;\n if (\n type.startsWith('image') &&\n imageSizeLimit &&\n file.size > imageSizeLimit\n ) {\n return {\n type: 'imageSizeLimit',\n details: {\n imageSize: file.size,\n imageSizeLimit,\n },\n };\n } else if (\n type.startsWith('video') &&\n videoSizeLimit &&\n file.size > videoSizeLimit\n ) {\n return {\n type: 'videoSizeLimit',\n details: {\n videoSize: file.size,\n videoSizeLimit,\n },\n };\n }\n return null;\n });\n\n const [imageMatrix, setImageMatrix] = useState({});\n useEffect(() => {\n if (!checkMaxError || !imageMatrixLimit) return;\n if (imageMatrix?.matrix > imageMatrixLimit) {\n setMaxError({\n type: 'imageMatrixLimit',\n details: {\n imageMatrix: imageMatrix?.matrix,\n imageMatrixLimit,\n width: imageMatrix?.width,\n height: imageMatrix?.height,\n },\n });\n }\n }, [imageMatrix, imageMatrixLimit, checkMaxError]);\n\n const [videoMatrix, setVideoMatrix] = useState({});\n useEffect(() => {\n if (!checkMaxError || !videoMatrixLimit) return;\n if (videoMatrix?.matrix > videoMatrixLimit) {\n setMaxError({\n type: 'videoMatrixLimit',\n details: {\n videoMatrix: videoMatrix?.matrix,\n videoMatrixLimit,\n width: videoMatrix?.width,\n height: videoMatrix?.height,\n },\n });\n }\n }, [videoMatrix, videoMatrixLimit, checkMaxError]);\n\n const [description, setDescription] = useState(attachment.description);\n const [suffixType, subtype] = type.split('/');\n const debouncedOnDescriptionChange = useDebouncedCallback(\n onDescriptionChange,\n 250,\n );\n useEffect(() => {\n debouncedOnDescriptionChange(description);\n }, [description, debouncedOnDescriptionChange]);\n\n const [showModal, setShowModal] = useState(false);\n const textareaRef = useRef(null);\n useEffect(() => {\n let timer;\n if (showModal && textareaRef.current) {\n timer = setTimeout(() => {\n textareaRef.current.focus();\n }, 100);\n }\n return () => {\n clearTimeout(timer);\n };\n }, [showModal]);\n\n const descTextarea = (\n <>\n {!!id && !supportsEdit ? (\n
    \n \n Uploaded\n \n

    \n {attachment.description || No description}\n

    \n
    \n ) : (\n {\n const { value } = e.target;\n setDescription(value);\n // debouncedOnDescriptionChange(value);\n }}\n >\n )}\n \n );\n\n const toastRef = useRef(null);\n useEffect(() => {\n return () => {\n toastRef.current?.hideToast?.();\n };\n }, []);\n\n const maxErrorToast = useRef(null);\n\n const maxErrorText = (err) => {\n const { type, details } = err;\n switch (type) {\n case 'imageSizeLimit': {\n const { imageSize, imageSizeLimit } = details;\n return t`File size too large. Uploading might encounter issues. Try reduce the file size from ${prettyBytes(\n imageSize,\n )} to ${prettyBytes(imageSizeLimit)} or lower.`;\n }\n case 'imageMatrixLimit': {\n const { imageMatrix, imageMatrixLimit, width, height } = details;\n const { newWidth, newHeight } = scaleDimension(\n imageMatrix,\n imageMatrixLimit,\n width,\n height,\n );\n return t`Dimension too large. Uploading might encounter issues. Try reduce dimension from ${i18n.number(\n width,\n )}×${i18n.number(height)}px to ${i18n.number(newWidth)}×${i18n.number(\n newHeight,\n )}px.`;\n }\n case 'videoSizeLimit': {\n const { videoSize, videoSizeLimit } = details;\n return t`File size too large. Uploading might encounter issues. Try reduce the file size from ${prettyBytes(\n videoSize,\n )} to ${prettyBytes(videoSizeLimit)} or lower.`;\n }\n case 'videoMatrixLimit': {\n const { videoMatrix, videoMatrixLimit, width, height } = details;\n const { newWidth, newHeight } = scaleDimension(\n videoMatrix,\n videoMatrixLimit,\n width,\n height,\n );\n return t`Dimension too large. Uploading might encounter issues. Try reduce dimension from ${i18n.number(\n width,\n )}×${i18n.number(height)}px to ${i18n.number(newWidth)}×${i18n.number(\n newHeight,\n )}px.`;\n }\n case 'videoFrameRateLimit': {\n // Not possible to detect this on client-side for now\n return t`Frame rate too high. Uploading might encounter issues.`;\n }\n }\n };\n\n return (\n <>\n
    \n {\n setShowModal(true);\n }}\n >\n {suffixType === 'image' ? (\n {\n if (!checkMaxError) return;\n const { naturalWidth, naturalHeight } = e.target;\n setImageMatrix({\n matrix: naturalWidth * naturalHeight,\n width: naturalWidth,\n height: naturalHeight,\n });\n }}\n />\n ) : suffixType === 'video' || suffixType === 'gifv' ? (\n {\n if (!checkMaxError) return;\n const { videoWidth, videoHeight } = e.target;\n if (videoWidth && videoHeight) {\n setVideoMatrix({\n matrix: videoWidth * videoHeight,\n width: videoWidth,\n height: videoHeight,\n });\n }\n }}\n />\n ) : suffixType === 'audio' ? (\n
    \n {descTextarea}\n
    \n \n \n \n {!!maxError && (\n {\n if (maxErrorToast.current) {\n maxErrorToast.current.hideToast();\n }\n maxErrorToast.current = showToast({\n text: maxErrorText(maxError),\n duration: 10_000,\n });\n }}\n >\n \n \n )}\n
    \n \n {showModal && (\n {\n setShowModal(false);\n }}\n >\n
    \n {\n setShowModal(false);\n }}\n >\n \n \n
    \n

    \n {\n {\n image: t`Edit image description`,\n video: t`Edit video description`,\n audio: t`Edit audio description`,\n }[suffixType]\n }\n

    \n
    \n
    \n
    \n {suffixType === 'image' ? (\n \"\"\n ) : suffixType === 'video' || suffixType === 'gifv' ? (\n
    \n
    \n {descTextarea}\n
    \n {suffixType === 'image' &&\n /^(png|jpe?g|gif|webp)$/i.test(subtype) &&\n !!states.settings.mediaAltGenerator &&\n !!IMG_ALT_API_URL && (\n \n \n \n }\n >\n {\n setUIState('loading');\n toastRef.current = showToast({\n text: t`Generating description. Please wait…`,\n duration: -1,\n });\n // POST with multipart\n (async function () {\n try {\n const body = new FormData();\n body.append('image', file);\n const response = await fetch(IMG_ALT_API_URL, {\n method: 'POST',\n body,\n }).then((r) => r.json());\n if (response.error) {\n throw new Error(response.error);\n }\n setDescription(response.description);\n } catch (e) {\n console.error(e);\n showToast(\n e.message\n ? t`Failed to generate description: ${e.message}`\n : t`Failed to generate description`,\n );\n } finally {\n setUIState('default');\n toastRef.current?.hideToast?.();\n }\n })();\n }}\n >\n \n {lang && lang !== 'en' ? (\n \n Generate description…\n
    \n (English)\n
    \n ) : (\n \n Generate description…\n \n )}\n \n {!!lang && lang !== 'en' && (\n {\n setUIState('loading');\n toastRef.current = showToast({\n text: t`Generating description. Please wait…`,\n duration: -1,\n });\n // POST with multipart\n (async function () {\n try {\n const body = new FormData();\n body.append('image', file);\n const params = `?lang=${lang}`;\n const response = await fetch(\n IMG_ALT_API_URL + params,\n {\n method: 'POST',\n body,\n },\n ).then((r) => r.json());\n if (response.error) {\n throw new Error(response.error);\n }\n setDescription(response.description);\n } catch (e) {\n console.error(e);\n showToast(\n t`Failed to generate description${\n e?.message ? `: ${e.message}` : ''\n }`,\n );\n } finally {\n setUIState('default');\n toastRef.current?.hideToast?.();\n }\n })();\n }}\n >\n \n \n Generate description…\n
    \n \n ({localeCode2Text(lang)}){' '}\n \n — experimental\n \n \n
    \n \n )}\n \n )}\n {\n setShowModal(false);\n }}\n disabled={uiState === 'loading'}\n >\n Done\n \n
    \n
    \n
    \n
    \n \n )}\n \n );\n}\n\nfunction Poll({\n lang,\n poll,\n disabled,\n onInput = () => {},\n maxOptions,\n maxExpiration,\n minExpiration,\n maxCharactersPerOption,\n}) {\n const { _ } = useLingui();\n const { options, expiresIn, multiple } = poll;\n\n return (\n
    \n
    \n {options.map((option, i) => (\n
    \n {\n const { value } = e.target;\n options[i] = value;\n onInput(poll);\n }}\n />\n {\n options.splice(i, 1);\n onInput(poll);\n }}\n >\n \n \n
    \n ))}\n
    \n
    \n = maxOptions}\n onClick={() => {\n options.push('');\n onInput(poll);\n }}\n >\n +\n {' '}\n \n \n
    \n
    \n {\n onInput(null);\n }}\n >\n Remove poll\n \n
    \n
    \n );\n}\n\nfunction filterShortcodes(emojis, searchTerm) {\n searchTerm = searchTerm.toLowerCase();\n\n // Return an array of shortcodes that start with or contain the search term, sorted by relevance and limited to the first 5\n return emojis\n .sort((a, b) => {\n let aLower = a.shortcode.toLowerCase();\n let bLower = b.shortcode.toLowerCase();\n\n let aStartsWith = aLower.startsWith(searchTerm);\n let bStartsWith = bLower.startsWith(searchTerm);\n let aContains = aLower.includes(searchTerm);\n let bContains = bLower.includes(searchTerm);\n let bothStartWith = aStartsWith && bStartsWith;\n let bothContain = aContains && bContains;\n\n return bothStartWith\n ? a.length - b.length\n : aStartsWith\n ? -1\n : bStartsWith\n ? 1\n : bothContain\n ? a.length - b.length\n : aContains\n ? -1\n : bContains\n ? 1\n : 0;\n })\n .slice(0, 5);\n}\n\nfunction encodeHTML(str) {\n return str.replace(/[&<>\"']/g, function (char) {\n return '&#' + char.charCodeAt(0) + ';';\n });\n}\n\nfunction removeNullUndefined(obj) {\n for (let key in obj) {\n if (obj[key] === null || obj[key] === undefined) {\n delete obj[key];\n }\n }\n return obj;\n}\n\nfunction MentionModal({\n onClose = () => {},\n onSelect = () => {},\n defaultSearchTerm,\n}) {\n const { masto } = api();\n const [uiState, setUIState] = useState('default');\n const [accounts, setAccounts] = useState([]);\n const [relationshipsMap, setRelationshipsMap] = useState({});\n\n const [selectedIndex, setSelectedIndex] = useState(0);\n\n const loadRelationships = async (accounts) => {\n if (!accounts?.length) return;\n const relationships = await fetchRelationships(accounts, relationshipsMap);\n if (relationships) {\n setRelationshipsMap({\n ...relationshipsMap,\n ...relationships,\n });\n }\n };\n\n const loadAccounts = (term) => {\n if (!term) return;\n setUIState('loading');\n (async () => {\n try {\n const accounts = await masto.v1.accounts.search.list({\n q: term,\n limit: 40,\n resolve: false,\n });\n setAccounts(accounts);\n loadRelationships(accounts);\n setUIState('default');\n } catch (e) {\n setUIState('error');\n console.error(e);\n }\n })();\n };\n\n const debouncedLoadAccounts = useDebouncedCallback(loadAccounts, 1000);\n\n useEffect(() => {\n loadAccounts();\n }, [loadAccounts]);\n\n const inputRef = useRef();\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n // Put cursor at the end\n if (inputRef.current.value) {\n inputRef.current.selectionStart = inputRef.current.value.length;\n inputRef.current.selectionEnd = inputRef.current.value.length;\n }\n }\n }, []);\n\n useEffect(() => {\n if (defaultSearchTerm) {\n loadAccounts(defaultSearchTerm);\n }\n }, [defaultSearchTerm]);\n\n const selectAccount = (account) => {\n const socialAddress = account.acct;\n onSelect(socialAddress);\n onClose();\n };\n\n useHotkeys(\n 'enter',\n () => {\n const selectedAccount = accounts[selectedIndex];\n if (selectedAccount) {\n selectAccount(selectedAccount);\n }\n },\n {\n preventDefault: true,\n enableOnFormTags: ['input'],\n },\n );\n\n const listRef = useRef();\n useHotkeys(\n 'down',\n () => {\n if (selectedIndex < accounts.length - 1) {\n setSelectedIndex(selectedIndex + 1);\n } else {\n setSelectedIndex(0);\n }\n setTimeout(() => {\n const selectedItem = listRef.current.querySelector('.selected');\n if (selectedItem) {\n selectedItem.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n }, 1);\n },\n {\n preventDefault: true,\n enableOnFormTags: ['input'],\n },\n );\n\n useHotkeys(\n 'up',\n () => {\n if (selectedIndex > 0) {\n setSelectedIndex(selectedIndex - 1);\n } else {\n setSelectedIndex(accounts.length - 1);\n }\n setTimeout(() => {\n const selectedItem = listRef.current.querySelector('.selected');\n if (selectedItem) {\n selectedItem.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n }\n }, 1);\n },\n {\n preventDefault: true,\n enableOnFormTags: ['input'],\n },\n );\n\n return (\n
    \n {!!onClose && (\n \n )}\n
    \n {\n e.preventDefault();\n debouncedLoadAccounts.flush?.();\n // const searchTerm = inputRef.current.value;\n // debouncedLoadAccounts(searchTerm);\n }}\n >\n {\n const { value } = e.target;\n debouncedLoadAccounts(value);\n }}\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellCheck=\"false\"\n dir=\"auto\"\n defaultValue={defaultSearchTerm || ''}\n />\n \n
    \n
    \n {accounts?.length > 0 ? (\n \n {accounts.map((account, i) => {\n const relationship = relationshipsMap[account.id];\n return (\n \n \n {\n selectAccount(account);\n }}\n >\n \n \n \n );\n })}\n \n ) : uiState === 'loading' ? (\n
    \n \n
    \n ) : uiState === 'error' ? (\n
    \n

    \n Error loading accounts\n

    \n
    \n ) : null}\n
    \n
    \n );\n}\n\nfunction CustomEmojisModal({\n masto,\n instance,\n onClose = () => {},\n onSelect = () => {},\n defaultSearchTerm,\n}) {\n const [uiState, setUIState] = useState('default');\n const customEmojisList = useRef([]);\n const [customEmojis, setCustomEmojis] = useState([]);\n const recentlyUsedCustomEmojis = useMemo(\n () => store.account.get('recentlyUsedCustomEmojis') || [],\n );\n const searcherRef = useRef();\n useEffect(() => {\n setUIState('loading');\n (async () => {\n try {\n const [emojis, searcher] = await getCustomEmojis(instance, masto);\n console.log('emojis', emojis);\n searcherRef.current = searcher;\n setCustomEmojis(emojis);\n setUIState('default');\n } catch (e) {\n setUIState('error');\n console.error(e);\n }\n })();\n }, []);\n\n const customEmojisCatList = useMemo(() => {\n // Group emojis by category\n const emojisCat = {\n '--recent--': recentlyUsedCustomEmojis.filter((emoji) =>\n customEmojis.find((e) => e.shortcode === emoji.shortcode),\n ),\n };\n const othersCat = [];\n customEmojis.forEach((emoji) => {\n customEmojisList.current?.push?.(emoji);\n if (!emoji.category) {\n othersCat.push(emoji);\n return;\n }\n if (!emojisCat[emoji.category]) {\n emojisCat[emoji.category] = [];\n }\n emojisCat[emoji.category].push(emoji);\n });\n if (othersCat.length) {\n emojisCat['--others--'] = othersCat;\n }\n return emojisCat;\n }, [customEmojis]);\n\n const scrollableRef = useRef();\n const [matches, setMatches] = useState(null);\n const onFind = useCallback(\n (e) => {\n const { value } = e.target;\n if (value) {\n const results = searcherRef.current?.search(value, {\n limit: CUSTOM_EMOJIS_COUNT,\n });\n setMatches(results.map((r) => r.item));\n scrollableRef.current?.scrollTo?.(0, 0);\n } else {\n setMatches(null);\n }\n },\n [customEmojis],\n );\n useEffect(() => {\n if (defaultSearchTerm && customEmojis?.length) {\n onFind({ target: { value: defaultSearchTerm } });\n }\n }, [defaultSearchTerm, onFind, customEmojis]);\n\n const onSelectEmoji = useCallback(\n (emoji) => {\n onSelect?.(emoji);\n onClose?.();\n\n queueMicrotask(() => {\n let recentlyUsedCustomEmojis =\n store.account.get('recentlyUsedCustomEmojis') || [];\n const recentlyUsedEmojiIndex = recentlyUsedCustomEmojis.findIndex(\n (e) => e.shortcode === emoji.shortcode,\n );\n if (recentlyUsedEmojiIndex !== -1) {\n // Move emoji to index 0\n recentlyUsedCustomEmojis.splice(recentlyUsedEmojiIndex, 1);\n recentlyUsedCustomEmojis.unshift(emoji);\n } else {\n recentlyUsedCustomEmojis.unshift(emoji);\n // Remove unavailable ones\n recentlyUsedCustomEmojis = recentlyUsedCustomEmojis.filter((e) =>\n customEmojisList.current?.find?.(\n (emoji) => emoji.shortcode === e.shortcode,\n ),\n );\n // Limit to 10\n recentlyUsedCustomEmojis = recentlyUsedCustomEmojis.slice(0, 10);\n }\n\n // Store back\n store.account.set('recentlyUsedCustomEmojis', recentlyUsedCustomEmojis);\n });\n },\n [onSelect],\n );\n\n const inputRef = useRef();\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n // Put cursor at the end\n if (inputRef.current.value) {\n inputRef.current.selectionStart = inputRef.current.value.length;\n inputRef.current.selectionEnd = inputRef.current.value.length;\n }\n }\n }, []);\n\n return (\n
    \n {!!onClose && (\n \n )}\n
    \n
    \n \n Custom emojis\n {' '}\n {uiState === 'loading' ? (\n \n ) : (\n • {instance}\n )}\n
    \n {\n e.preventDefault();\n const emoji = matches[0];\n if (emoji) {\n onSelectEmoji(`:${emoji.shortcode}:`);\n }\n }}\n >\n \n \n
    \n
    \n {matches !== null ? (\n
      \n {matches.map((emoji) => (\n
    • \n {\n onSelectEmoji(`:${emoji.shortcode}:`);\n }}\n showCode\n />\n
    • \n ))}\n
    \n ) : (\n
    \n {uiState === 'error' && (\n
    \n

    \n Error loading custom emojis\n

    \n
    \n )}\n {uiState === 'default' &&\n Object.entries(customEmojisCatList).map(\n ([category, emojis]) =>\n !!emojis?.length && (\n
    \n
    \n {{\n '--recent--': t`Recently used`,\n '--others--': t`Others`,\n }[category] || category}\n
    \n \n
    \n ),\n )}\n
    \n )}\n
    \n
    \n );\n}\n\nconst CustomEmojisList = memo(({ emojis, onSelect }) => {\n const { i18n } = useLingui();\n const [max, setMax] = useState(CUSTOM_EMOJIS_COUNT);\n const showMore = emojis.length > max;\n return (\n
    \n {emojis.slice(0, max).map((emoji) => (\n {\n onSelect(`:${emoji.shortcode}:`);\n }}\n />\n ))}\n {showMore && (\n setMax(max + CUSTOM_EMOJIS_COUNT)}\n >\n {i18n.number(emojis.length - max)} more…\n \n )}\n
    \n );\n});\n\nconst CustomEmojiButton = memo(({ emoji, onClick, showCode }) => {\n const addEdges = (e) => {\n // Add edge-left or edge-right class based on self position relative to scrollable parent\n // If near left edge, add edge-left, if near right edge, add edge-right\n const buffer = 88;\n const parent = e.currentTarget.closest('main');\n if (parent) {\n const rect = parent.getBoundingClientRect();\n const selfRect = e.currentTarget.getBoundingClientRect();\n const targetClassList = e.currentTarget.classList;\n if (selfRect.left < rect.left + buffer) {\n targetClassList.add('edge-left');\n targetClassList.remove('edge-right');\n } else if (selfRect.right > rect.right - buffer) {\n targetClassList.add('edge-right');\n targetClassList.remove('edge-left');\n } else {\n targetClassList.remove('edge-left', 'edge-right');\n }\n }\n };\n\n return (\n \n \n {!!emoji.staticUrl && (\n \n )}\n \n \n {showCode && (\n <>\n {' '}\n {emoji.shortcode}\n \n )}\n \n );\n});\n\nconst GIFS_PER_PAGE = 20;\nfunction GIFPickerModal({ onClose = () => {}, onSelect = () => {} }) {\n const { i18n } = useLingui();\n const [uiState, setUIState] = useState('default');\n const [results, setResults] = useState([]);\n const formRef = useRef(null);\n const qRef = useRef(null);\n const currentOffset = useRef(0);\n const scrollableRef = useRef(null);\n\n function fetchGIFs({ offset }) {\n console.log('fetchGIFs', { offset });\n if (!qRef.current?.value) return;\n setUIState('loading');\n scrollableRef.current?.scrollTo?.({\n top: 0,\n left: 0,\n behavior: 'smooth',\n });\n (async () => {\n try {\n const query = {\n api_key: GIPHY_API_KEY,\n q: qRef.current.value,\n rating: 'g',\n limit: GIFS_PER_PAGE,\n bundle: 'messaging_non_clips',\n offset,\n lang: i18n.locale || 'en',\n };\n const response = await fetch(\n 'https://api.giphy.com/v1/gifs/search?' + new URLSearchParams(query),\n {\n referrerPolicy: 'no-referrer',\n },\n ).then((r) => r.json());\n currentOffset.current = response.pagination?.offset || 0;\n setResults(response);\n setUIState('results');\n } catch (e) {\n setUIState('error');\n console.error(e);\n }\n })();\n }\n\n useEffect(() => {\n qRef.current?.focus();\n }, []);\n\n const debouncedOnInput = useDebouncedCallback(() => {\n fetchGIFs({ offset: 0 });\n }, 1000);\n\n return (\n
    \n {!!onClose && (\n \n )}\n
    \n {\n e.preventDefault();\n fetchGIFs({ offset: 0 });\n }}\n >\n \n \n \n
    \n
    \n {uiState === 'default' && (\n
    \n

    \n Type to search GIFs\n

    \n
    \n )}\n {uiState === 'loading' && !results?.data?.length && (\n
    \n \n
    \n )}\n {results?.data?.length > 0 ? (\n <>\n
      \n {results.data.map((gif) => {\n const { id, images, title, alt_text } = gif;\n const {\n fixed_height_small,\n fixed_height_downsampled,\n fixed_height,\n original,\n } = images;\n const theImage = fixed_height_small?.url\n ? fixed_height_small\n : fixed_height_downsampled?.url\n ? fixed_height_downsampled\n : fixed_height;\n let { url, webp, width, height } = theImage;\n if (+height > 100) {\n width = (width / height) * 100;\n height = 100;\n }\n const urlObj = URL.parse(url);\n const strippedURL = urlObj.origin + urlObj.pathname;\n let strippedWebP;\n if (webp) {\n const webpObj = URL.parse(webp);\n strippedWebP = webpObj.origin + webpObj.pathname;\n }\n return (\n
    • \n {\n const { mp4, url } = original;\n const theURL = mp4 || url;\n const urlObj = URL.parse(theURL);\n const strippedURL = urlObj.origin + urlObj.pathname;\n onClose();\n onSelect({\n url: strippedURL,\n type: mp4 ? 'video/mp4' : 'image/gif',\n alt_text: alt_text || title,\n });\n }}\n >\n \n \n {strippedWebP && (\n \n )}\n {\n e.target.style.backgroundColor = 'transparent';\n }}\n />\n \n
      {alt_text || title}
      \n \n \n
    • \n );\n })}\n
    \n

    \n {results.pagination?.offset > 0 && (\n {\n fetchGIFs({\n offset: results.pagination?.offset - GIFS_PER_PAGE,\n });\n }}\n >\n \n \n Previous\n \n \n )}\n \n {results.pagination?.offset + results.pagination?.count <\n results.pagination?.total_count && (\n {\n fetchGIFs({\n offset: results.pagination?.offset + GIFS_PER_PAGE,\n });\n }}\n >\n \n Next\n {' '}\n \n \n )}\n

    \n \n ) : (\n uiState === 'results' && (\n
    \n

    No results

    \n
    \n )\n )}\n {uiState === 'error' && (\n
    \n

    \n Error loading GIFs\n

    \n
    \n )}\n
    \n
    \n );\n}\n\nexport default Compose;\n"],"file":"assets/compose-N6HS-39B.js"} \ No newline at end of file diff --git a/assets/compose-Skgn-tKU.js b/assets/compose-Skgn-tKU.js new file mode 100644 index 0000000..98b4f5b --- /dev/null +++ b/assets/compose-Skgn-tKU.js @@ -0,0 +1,2 @@ +import{a9 as _,h as l,i as o,U as g,M as v,a3 as T,y as u,T as t,c as e,I as m,w as y,aa as I,ac as C}from"./useTitle-TK72setz.js";_();window.opener&&(console=window.opener.console);function x(){var d,r;const[s,p]=l("default"),[a,w]=l(null),{editStatus:c,replyToStatus:i,draftStatus:f}=window.__COMPOSE__||{};return g(c?o._({id:"Txus+H"}):i?o._({id:"03vjxE",values:{0:((d=i.account)==null?void 0:d.acct)||((r=i.account)==null?void 0:r.username)}}):o._({id:"QOhkyl"})),u(()=>{const n=v();w(!!n),n&&T()},[]),u(()=>{if(s==="closed"){try{window.opener.focus()}catch{}window.close()}},[s]),s==="closed"?e("div",{class:"box",children:[e("p",{children:e(t,{id:"mBdQnV"})}),e("p",{children:e("button",{onClick:()=>{window.close()},children:e(t,{id:"rf8fiC"})})})]}):a===!1?e("div",{class:"box",children:[e("h1",{children:e(t,{id:"SlfejT"})}),e("p",{children:e(t,{id:"D3vX+9"})}),e("p",{children:e("a",{href:"/",children:e(t,{id:"iWpEwy"})})})]}):a?e(m,{editStatus:c,replyToStatus:i,draftStatus:f,standalone:!0,hasOpener:window.opener,onClose:n=>{const{newStatus:h,fn:S=()=>{}}=n||{};try{h&&window.opener.__STATES__.reloadStatusPage++,S(),p("closed")}catch{}}}):e("div",{class:"box",children:e(y,{})})}C(e(I,{i18n:o,children:e(x,{})}),document.getElementById("app-standalone")); +//# sourceMappingURL=compose-Skgn-tKU.js.map diff --git a/assets/compose-Skgn-tKU.js.map b/assets/compose-Skgn-tKU.js.map new file mode 100644 index 0000000..a623e3d --- /dev/null +++ b/assets/compose-Skgn-tKU.js.map @@ -0,0 +1 @@ +{"version":3,"file":"compose-Skgn-tKU.js","sources":["../../src/compose.jsx"],"sourcesContent":["import './index.css';\nimport './app.css';\nimport './polyfills';\n\nimport { i18n } from '@lingui/core';\nimport { t, Trans } from '@lingui/macro';\nimport { I18nProvider } from '@lingui/react';\nimport { render } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\n\nimport ComposeSuspense from './components/compose-suspense';\nimport Loader from './components/loader';\nimport { initActivateLang } from './utils/lang';\nimport { initStates } from './utils/states';\nimport { getCurrentAccount, setCurrentAccountID } from './utils/store-utils';\nimport useTitle from './utils/useTitle';\n\ninitActivateLang();\n\nif (window.opener) {\n console = window.opener.console;\n}\n\nfunction App() {\n const [uiState, setUIState] = useState('default');\n const [isLoggedIn, setIsLoggedIn] = useState(null);\n\n const { editStatus, replyToStatus, draftStatus } = window.__COMPOSE__ || {};\n\n useTitle(\n editStatus\n ? t`Editing source status`\n : replyToStatus\n ? t`Replying to @${\n replyToStatus.account?.acct || replyToStatus.account?.username\n }`\n : t`Compose`,\n );\n\n useEffect(() => {\n const account = getCurrentAccount();\n setIsLoggedIn(!!account);\n if (account) {\n initStates();\n }\n }, []);\n\n useEffect(() => {\n if (uiState === 'closed') {\n try {\n // Focus parent window\n window.opener.focus();\n } catch (e) {}\n window.close();\n }\n }, [uiState]);\n\n if (uiState === 'closed') {\n return (\n
    \n

    \n You may close this page now.\n

    \n

    \n {\n window.close();\n }}\n >\n Close window\n \n

    \n
    \n );\n }\n\n console.debug('OPEN COMPOSE');\n\n if (isLoggedIn === false) {\n return (\n
    \n

    \n Error\n

    \n

    \n Login required.\n

    \n

    \n \n Go home\n \n

    \n
    \n );\n }\n\n if (isLoggedIn) {\n return (\n {\n const { newStatus, fn = () => {} } = results || {};\n try {\n if (newStatus) {\n window.opener.__STATES__.reloadStatusPage++;\n }\n fn();\n setUIState('closed');\n } catch (e) {}\n }}\n />\n );\n }\n\n return (\n
    \n \n
    \n );\n}\n\nrender(\n \n \n ,\n document.getElementById('app-standalone'),\n);\n"],"names":["initActivateLang","window","opener","console","App","uiState","setUIState","useState","isLoggedIn","setIsLoggedIn","editStatus","replyToStatus","draftStatus","__COMPOSE__","useTitle","i18n","_","id","values","0","account","acct","username","useEffect","getCurrentAccount","initStates","focus","close","_jsxs","class","children","_jsx","Trans","onClick","href","ComposeSuspense","standalone","hasOpener","newStatus","results","fn","Loader","render","I18nProvider"],"mappings":"mIAiBAA,IAEIC,OAAOC,SACTC,QAAUF,OAAOC,OAAOC,SAG1B,SAASC,GAAM,SACb,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAS,SAAS,EAC1C,CAACC,EAAYC,CAAa,EAAIF,EAAS,IAAI,EAE3C,CAAEG,WAAAA,EAAYC,cAAAA,EAAeC,YAAAA,CAAAA,EAAgBX,OAAOY,aAAe,GA8BzE,OA5BAC,EACEJ,EAAUK,EAAAC,EACN,CAAAC,GAAA,QAAuB,CAAA,EACvBN,EAAaI,EAAAC,EACb,CAAAC,GAAA,SAAAC,OAAA,CAAAC,IACER,EAAAA,EAAcS,UAAdT,YAAAA,EAAuBU,SAAQV,EAAAA,EAAcS,UAAdT,YAAAA,EAAuBW,SAAQ,CAC/D,GAACP,EAAAC,EACF,CAAAC,GAAA,QAAS,CAAA,CACf,EAEAM,EAAU,IAAM,CACd,MAAMH,EAAUI,IACFf,EAAA,CAAC,CAACW,CAAO,EACnBA,GACSK,GAEf,EAAG,CAAE,CAAA,EAELF,EAAU,IAAM,CACd,GAAIlB,IAAY,SAAU,CACpB,GAAA,CAEFJ,OAAOC,OAAOwB,aACJ,CAAC,CACbzB,OAAO0B,MAAM,CACf,CAAA,EACC,CAACtB,CAAO,CAAC,EAERA,IAAY,SAEZuB,EAAA,MAAA,CAAKC,MAAM,MAAKC,UACdC,EAAA,IAAA,CAAAD,SACEC,EAAAC,EAAA,CAAAf,GAAA,QAAA,CAA0C,CAAA,CACzC,EACHc,EAAA,IAAA,CAAAD,SACEC,EAAA,SAAA,CACEE,QAASA,IAAM,CACbhC,OAAO0B,MAAM,CACf,EAAEG,SAEFC,EAAAC,EAAA,CAAAf,GAAA,QAAA,CAA0B,CAAA,CACpB,CAAA,CACP,CAAC,CAAA,CACD,EAITd,IAA4B,WAEF,CACxB,YACO0B,SAAM,CAAAE,EAAA,KAAA,CAAKD,SACdC,EAAAC,EAAA,CAAAF,GAAAA,QACE,CAAA,CAAA,CAAA,EAAmBC,EAAA,IAAA,CAErBA,SAAAA,EAAAC,EAAA,CAAAF,GAAAA,QACE,CAAA,CAAA,CAAA,EAA6BC,EAAA,IAAA,CAE/BA,SAAAA,EAAA,IAAA,CAAAD,KAAAA,IACKI,SAAKH,EAAAC,EAAA,CAAGF,GAAAA,QACT,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAC,CACrB,CAAA,EAIXtB,EAEgBuB,EAAAI,EAAA,CACd,WAAAzB,EAEIA,cAAAA,EACAC,YAAAA,EACAC,WAAAA,GACAwB,UAAU,OAAA,OACVC,WAAkBnC,OAEV,UAAAoC,EAAEA,GAAAA,EAAAA,IAAAA,EAAsB,EAACC,GAAA,CAAA,EAAE,GAAIA,CACjCD,GACF,OAAe,OAAA,WAAA,mBAEfE,IACGlC,EAAA,QAAA,CACHA,MAAAA,EACW,CAAA,CACf,EAGNyB,EAAA,MAAA,CAEA,YACOF,SAAME,EAAAU,EAAA,EAAA,CAAA,CAAA,CACA,CAGfC,EAAAX,EAAAY,EAAA,CAEAD,KAAAA,EACgB3B,SAAAA,EAAAA,EAAAA,EAAAA,CAAAA,CAAAA,EACZgB,SAAAA,eAAM,gBAAA,CAAA"} \ No newline at end of file diff --git a/assets/fuse-zg_VFt4r.js b/assets/fuse-zg_VFt4r.js new file mode 100644 index 0000000..1498d44 --- /dev/null +++ b/assets/fuse-zg_VFt4r.js @@ -0,0 +1,181 @@ +import{ad as lt,Q as ze,c as r,h as Z,t as Me,A as $,_ as Zt,y as ee,ae as xa,E as gr,i as S,af as I,ag as Sa,ah as io,ai as ka,l as ae,P as Ct,p as ji,aj as Ia,ak as Ki,O as Wi,f as F,C as Jt,V as Oe,q as Aa,s as B,al as Ca,j as po,a as so,z as bn,B as Pa,am as La,T as O,an as Zi,ao as Ma,ap as Gi,r as mo,w as qi,g as vr,aq as Ra,ar as Ne,as as Oa,at as Da,au as Un,J as it,u as In,d as Jr,b as ft,W as Yi,av as $a,aw as Na,ax as Fa}from"./useTitle-TK72setz.js";function Yo(){return Yo=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var Za=function(t,n,o){o===void 0&&(o=!1);var i=n.alt,s=n.meta,a=n.mod,c=n.shift,l=n.ctrl,u=n.keys,d=t.key,f=t.code,p=t.ctrlKey,h=t.metaKey,m=t.shiftKey,g=t.altKey,_=pt(f),T=d.toLowerCase();if(!(u!=null&&u.includes(_))&&!(u!=null&&u.includes(T))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(_))return!1;if(!o){if(i===!g&&T!=="alt"||c===!m&&T!=="shift")return!1;if(a){if(!h&&!p)return!1}else if(s===!h&&T!=="meta"&&T!=="os"||l===!p&&T!=="ctrl"&&T!=="control")return!1}return u&&u.length===1&&(u.includes(T)||u.includes(_))?!0:u?Ha(u):!u},Ga=lt(void 0),qa=function(){return ze(Ga)};function ts(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,o){return n&&ts(e[o],t[o])},!0):e===t}var Ya=lt({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Xa=function(){return ze(Ya)};function Qa(e){var t=$(void 0);return ts(t.current,e)||(t.current=e),t.current}var ei=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},Ja=typeof window<"u"?Zt:ee;function Bt(e,t,n,o){var i=Z(null),s=i[0],a=i[1],c=$(!1),l=n instanceof Array?o instanceof Array?void 0:o:n,u=_r(e)?e.join(l==null?void 0:l.splitKey):e,d=n instanceof Array?n:o instanceof Array?o:void 0,f=Me(t,d??[]),p=$(f);d?p.current=f:p.current=t;var h=Qa(l),m=Xa(),g=m.enabledScopes,_=qa();return Ja(function(){if(!((h==null?void 0:h.enabled)===!1||!Wa(g,h==null?void 0:h.scopes))){var T=function(b,k){var D;if(k===void 0&&(k=!1),!(ja(b)&&!es(b,h==null?void 0:h.enableOnFormTags))){if(s!==null){var L=s.getRootNode();if((L instanceof Document||L instanceof ShadowRoot)&&L.activeElement!==s&&!s.contains(L.activeElement)){ei(b);return}}(D=b.target)!=null&&D.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Io(u,h==null?void 0:h.splitKey).forEach(function(A){var C,R=Ao(A,h==null?void 0:h.combinationKey);if(Za(b,R,h==null?void 0:h.ignoreModifiers)||(C=R.keys)!=null&&C.includes("*")){if(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(b)||k&&c.current)return;if(Ba(b,R,h==null?void 0:h.preventDefault),!Ua(b,R,h==null?void 0:h.enabled)){ei(b);return}p.current(b,R),k||(c.current=!0)}})}},y=function(b){b.key!==void 0&&(Qi(pt(b.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&T(b))},w=function(b){b.key!==void 0&&(Ji(pt(b.code)),c.current=!1,h!=null&&h.keyup&&T(b,!0))},E=s||(l==null?void 0:l.document)||document;return E.addEventListener("keyup",w),E.addEventListener("keydown",y),_&&Io(u,h==null?void 0:h.splitKey).forEach(function(x){return _.addHotkey(Ao(x,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){E.removeEventListener("keyup",w),E.removeEventListener("keydown",y),_&&Io(u,h==null?void 0:h.splitKey).forEach(function(x){return _.removeHotkey(Ao(x,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[s,u,h,g]),a}var yr={exports:{}};/*! + * Toastify js 1.12.0 + * https://github.com/apvarun/toastify-js + * @license MIT licensed + * + * Copyright (C) 2018 Varun A P + */var Hf=yr.exports;(function(e){(function(t,n){e.exports?e.exports=n():t.Toastify=n()})(xa,function(t){var n=function(a){return new n.lib.init(a)},o="1.12.0";n.defaults={oldestFirst:!0,text:"Toastify is awesome!",node:void 0,duration:3e3,selector:void 0,callback:function(){},destination:void 0,newWindow:!1,close:!1,gravity:"toastify-top",positionLeft:!1,position:"",backgroundColor:"",avatar:"",className:"",stopOnFocus:!0,onClick:function(){},offset:{x:0,y:0},escapeMarkup:!0,ariaLive:"polite",style:{background:""}},n.lib=n.prototype={toastify:o,constructor:n,init:function(a){return a||(a={}),this.options={},this.toastElement=null,this.options.text=a.text||n.defaults.text,this.options.node=a.node||n.defaults.node,this.options.duration=a.duration===0?0:a.duration||n.defaults.duration,this.options.selector=a.selector||n.defaults.selector,this.options.callback=a.callback||n.defaults.callback,this.options.destination=a.destination||n.defaults.destination,this.options.newWindow=a.newWindow||n.defaults.newWindow,this.options.close=a.close||n.defaults.close,this.options.gravity=a.gravity==="bottom"?"toastify-bottom":n.defaults.gravity,this.options.positionLeft=a.positionLeft||n.defaults.positionLeft,this.options.position=a.position||n.defaults.position,this.options.backgroundColor=a.backgroundColor||n.defaults.backgroundColor,this.options.avatar=a.avatar||n.defaults.avatar,this.options.className=a.className||n.defaults.className,this.options.stopOnFocus=a.stopOnFocus===void 0?n.defaults.stopOnFocus:a.stopOnFocus,this.options.onClick=a.onClick||n.defaults.onClick,this.options.offset=a.offset||n.defaults.offset,this.options.escapeMarkup=a.escapeMarkup!==void 0?a.escapeMarkup:n.defaults.escapeMarkup,this.options.ariaLive=a.ariaLive||n.defaults.ariaLive,this.options.style=a.style||n.defaults.style,a.backgroundColor&&(this.options.style.background=a.backgroundColor),this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var a=document.createElement("div");a.className="toastify on "+this.options.className,this.options.position?a.className+=" toastify-"+this.options.position:this.options.positionLeft===!0?(a.className+=" toastify-left",console.warn("Property `positionLeft` will be depreciated in further versions. Please use `position` instead.")):a.className+=" toastify-right",a.className+=" "+this.options.gravity,this.options.backgroundColor&&console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');for(var c in this.options.style)a.style[c]=this.options.style[c];if(this.options.ariaLive&&a.setAttribute("aria-live",this.options.ariaLive),this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)a.appendChild(this.options.node);else if(this.options.escapeMarkup?a.innerText=this.options.text:a.innerHTML=this.options.text,this.options.avatar!==""){var l=document.createElement("img");l.src=this.options.avatar,l.className="toastify-avatar",this.options.position=="left"||this.options.positionLeft===!0?a.appendChild(l):a.insertAdjacentElement("afterbegin",l)}if(this.options.close===!0){var u=document.createElement("button");u.type="button",u.setAttribute("aria-label","Close"),u.className="toast-close",u.innerHTML="✖",u.addEventListener("click",(function(_){_.stopPropagation(),this.removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)}).bind(this));var d=window.innerWidth>0?window.innerWidth:screen.width;(this.options.position=="left"||this.options.positionLeft===!0)&&d>360?a.insertAdjacentElement("afterbegin",u):a.appendChild(u)}if(this.options.stopOnFocus&&this.options.duration>0){var f=this;a.addEventListener("mouseover",function(_){window.clearTimeout(a.timeOutValue)}),a.addEventListener("mouseleave",function(){a.timeOutValue=window.setTimeout(function(){f.removeElement(a)},f.options.duration)})}if(typeof this.options.destination<"u"&&a.addEventListener("click",(function(_){_.stopPropagation(),this.options.newWindow===!0?window.open(this.options.destination,"_blank"):window.location=this.options.destination}).bind(this)),typeof this.options.onClick=="function"&&typeof this.options.destination>"u"&&a.addEventListener("click",(function(_){_.stopPropagation(),this.options.onClick()}).bind(this)),typeof this.options.offset=="object"){var p=i("x",this.options),h=i("y",this.options),m=this.options.position=="left"?p:"-"+p,g=this.options.gravity=="toastify-top"?h:"-"+h;a.style.transform="translate("+m+","+g+")"}return a},showToast:function(){this.toastElement=this.buildToast();var a;if(typeof this.options.selector=="string"?a=document.getElementById(this.options.selector):this.options.selector instanceof HTMLElement||typeof ShadowRoot<"u"&&this.options.selector instanceof ShadowRoot?a=this.options.selector:a=document.body,!a)throw"Root element is not defined";var c=n.defaults.oldestFirst?a.firstChild:a.lastChild;return a.insertBefore(this.toastElement,c),n.reposition(),this.options.duration>0&&(this.toastElement.timeOutValue=window.setTimeout((function(){this.removeElement(this.toastElement)}).bind(this),this.options.duration)),this},hideToast:function(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this.removeElement(this.toastElement)},removeElement:function(a){a.className=a.className.replace(" on",""),window.setTimeout((function(){this.options.node&&this.options.node.parentNode&&this.options.node.parentNode.removeChild(this.options.node),a.parentNode&&a.parentNode.removeChild(a),this.options.callback.call(a),n.reposition()}).bind(this),400)}},n.reposition=function(){for(var a={top:15,bottom:15},c={top:15,bottom:15},l={top:15,bottom:15},u=document.getElementsByClassName("toastify"),d,f=0;f0?window.innerWidth:screen.width;m<=360?(u[f].style[d]=l[d]+"px",l[d]+=p+h):s(u[f],"toastify-left")===!0?(u[f].style[d]=a[d]+"px",a[d]+=p+h):(u[f].style[d]=c[d]+"px",c[d]+=p+h)}return this};function i(a,c){return c.offset[a]?isNaN(c.offset[a])?c.offset[a]:c.offset[a]+"px":"0px"}function s(a,c){return!a||typeof c!="string"?!1:!!(a.className&&a.className.trim().split(/\s+/gi).indexOf(c)>-1)}return n.lib.init.prototype=n.lib,n})})(yr);var ec=yr.exports;const tc=gr(ec);window._showToast=Re;function Re(e){typeof e=="string"&&(e={text:e});const{onClick:t,delay:n,...o}=e,i=tc({className:`${t||e.destination?"shiny-pill":""}`,gravity:"bottom",position:"center",...o,onClick:()=>{t==null||t(i)}});return n?setTimeout(()=>{i.showToast()},n):i.showToast(),i}function Bf(e,t,n,o){const i=$(e);ee(()=>{i.current=e},[e,n]),ee(()=>{!o||t===null||t===!1||i.current()},[o]),ee(()=>{if(t===null||t===!1)return;const a=setInterval(()=>i.current(),t);return()=>clearInterval(a)},[t])}function nc(e){const t=URL.parse("/compose/",window.location),{width:n,height:o}=window.screen,i=Math.max(0,(n-600)/2),s=Math.max(0,(o-450)/2),a=Math.min(n,600),c=Math.min(o,450),l=(e==null?void 0:e.uid)||Math.random(),u=window.open(t,"compose"+l,`width=${a},height=${c},left=${i},top=${s}`);return u?u.__COMPOSE__=e:alert(S._({id:"4S86wI"})),u}const oc=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function rc(){if(oc){const e=document.createElement("input");e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.opacity="0",document.body.appendChild(e),e.focus(),setTimeout(()=>{document.body.removeChild(e)},500)}}const ns={x:()=>I(()=>import("./icons/close-line-YTE7hIJE.js"),[],import.meta.url),heart:()=>I(()=>import("./icons/heart-line-VwvWYh8h.js"),[],import.meta.url),bookmark:()=>I(()=>import("./icons/bookmark-line-D6jQ7QFs.js"),[],import.meta.url),"check-circle":()=>I(()=>import("./icons/check-circle-line-sE41WGxF.js"),[],import.meta.url),"x-circle":()=>I(()=>import("./icons/close-circle-line-qd3g541O.js"),[],import.meta.url),transfer:()=>I(()=>import("./icons/transfer-4-line-Q9QJoxz3.js"),[],import.meta.url),rocket:()=>I(()=>import("./icons/rocket-line-rZbVYYCZ.js"),[],import.meta.url),"arrow-left":{module:()=>I(()=>import("./icons/arrow-left-line-_YC6-XGG.js"),[],import.meta.url),rtl:!0},"arrow-right":{module:()=>I(()=>import("./icons/arrow-right-line-PypiEqpu.js"),[],import.meta.url),rtl:!0},"arrow-up":()=>I(()=>import("./icons/arrow-up-line-fcuKqhVE.js"),[],import.meta.url),"arrow-down":()=>I(()=>import("./icons/arrow-down-line-0TRJUP_K.js"),[],import.meta.url),earth:()=>I(()=>import("./icons/earth-line-t1Um8wpQ.js"),[],import.meta.url),lock:()=>I(()=>import("./icons/lock-line-0jNHqZpm.js"),[],import.meta.url),unlock:()=>I(()=>import("./icons/unlock-line-w3piJMVb.js"),[],import.meta.url),"eye-close":()=>I(()=>import("./icons/eye-close-line-lBiePPv9.js"),[],import.meta.url),"eye-open":()=>I(()=>import("./icons/eye-2-line-vz_Kw-rK.js"),[],import.meta.url),message:()=>I(()=>import("./icons/mail-line-5XLS6FEo.js"),[],import.meta.url),comment:{module:()=>I(()=>import("./icons/chat-3-line-F0xcdpXY.js"),[],import.meta.url),rtl:!0},comment2:{module:()=>I(()=>import("./icons/comment-2-line-xEXuT-Ip.js"),[],import.meta.url),rtl:!0},home:()=>I(()=>import("./icons/home-3-line-qJiZhXUH.js"),[],import.meta.url),notification:()=>I(()=>import("./icons/notification-line-olNPLtgS.js"),[],import.meta.url),follow:()=>I(()=>import("./icons/user-follow-line-k_GCWTtp.js"),[],import.meta.url),"follow-add":()=>I(()=>import("./icons/user-add-line-zzW9OULB.js"),[],import.meta.url),poll:[()=>I(()=>import("./icons/chart-bar-line-5r_DfN2w.js"),[],import.meta.url),"90deg"],pencil:()=>I(()=>import("./icons/pencil-line-bKXqElLR.js"),[],import.meta.url),quill:()=>I(()=>import("./icons/quill-pen-line-h_5-FsGz.js"),[],import.meta.url),at:()=>I(()=>import("./icons/at-line-9vJS_Hnl.js"),[],import.meta.url),attachment:()=>I(()=>import("./icons/attachment-line-C2PUa1Ke.js"),[],import.meta.url),upload:()=>I(()=>import("./icons/upload-3-line-Qsjvubiw.js"),[],import.meta.url),gear:()=>I(()=>import("./icons/settings-3-line-kt4MSpRv.js"),[],import.meta.url),more:()=>I(()=>import("./icons/more-3-line-wUD-Yhmj.js"),[],import.meta.url),more2:()=>I(()=>import("./icons/more-1-fill-je1-slyh.js"),[],import.meta.url),external:{module:()=>I(()=>import("./icons/external-link-line-8nOOkmFu.js"),[],import.meta.url),rtl:!0},popout:{module:()=>I(()=>import("./icons/external-link-line-8nOOkmFu.js"),[],import.meta.url),rtl:!0},popin:{module:()=>I(()=>import("./icons/external-link-line-8nOOkmFu.js"),[],import.meta.url),rotate:"180deg",rtl:!0},plus:()=>I(()=>import("./icons/add-circle-line--O-MfyNy.js"),[],import.meta.url),"chevron-left":{module:()=>I(()=>import("./icons/left-line-Jck0yVmC.js"),[],import.meta.url),rtl:!0},"chevron-right":{module:()=>I(()=>import("./icons/right-line-7VBoqLdz.js"),[],import.meta.url),rtl:!0},"chevron-down":()=>I(()=>import("./icons/down-line-9PeS5YhF.js"),[],import.meta.url),reply:{module:()=>I(()=>import("./icons/share-forward-line-4jL-2Q4u.js"),[],import.meta.url),rotate:"180deg",flip:"horizontal",rtl:!0},thread:()=>I(()=>import("./icons/route-line-2YYy3958.js"),[],import.meta.url),group:{module:()=>I(()=>import("./icons/group-line-JvhJklhQ.js"),[],import.meta.url),rtl:!0},bot:()=>I(()=>import("./icons/android-2-line-uPwvVubH.js"),[],import.meta.url),menu:()=>I(()=>import("./icons/rows-4-line-SxGPYpTa.js"),[],import.meta.url),list:{module:()=>I(()=>import("./icons/list-check-line-qNqx9Mm4.js"),[],import.meta.url),rtl:!0},search:()=>I(()=>import("./icons/search-2-line-G39AynEw.js"),[],import.meta.url),hashtag:()=>I(()=>import("./icons/hashtag-line-SS3QMu1R.js"),[],import.meta.url),info:()=>I(()=>import("./icons/information-line-8SOch6cR.js"),[],import.meta.url),shortcut:()=>I(()=>import("./icons/lightning-line-JMYUlCZM.js"),[],import.meta.url),user:()=>I(()=>import("./icons/user-4-line-zT_bpOrS.js"),[],import.meta.url),following:()=>I(()=>import("./icons/walk-line-CF7a5s4t.js"),[],import.meta.url),pin:()=>I(()=>import("./icons/pin-line-ULyRQyWZ.js"),[],import.meta.url),unpin:[()=>I(()=>import("./icons/pin-line-ULyRQyWZ.js"),[],import.meta.url),"180deg"],bus:()=>I(()=>import("./icons/bus-2-line-XuQdDZ_w.js"),[],import.meta.url),link:()=>I(()=>import("./icons/link-2-line-BUqp1EwN.js"),[],import.meta.url),history:()=>I(()=>import("./icons/history-line-yoG7K8wL.js"),[],import.meta.url),share:()=>I(()=>import("./icons/share-2-line-PYo-zN94.js"),[],import.meta.url),sparkles:()=>I(()=>import("./icons/sparkles-line-wjZWGZ1a.js"),[],import.meta.url),sparkles2:()=>I(()=>import("./icons/sparkles-2-line-g2FqdZ0R.js"),[],import.meta.url),exit:{module:()=>I(()=>import("./icons/exit-line-l-1uUgI7.js"),[],import.meta.url),rtl:!0},translate:()=>I(()=>import("./icons/translate-line-HpDtlqS2.js"),[],import.meta.url),play:()=>I(()=>import("./icons/play-fill-Ey-zv2eL.js"),[],import.meta.url),trash:()=>I(()=>import("./icons/delete-2-line-pjUduCFs.js"),[],import.meta.url),mute:{module:()=>I(()=>import("./icons/volume-mute-line-WthBoXru.js"),[],import.meta.url),rtl:!0},unmute:{module:()=>I(()=>import("./icons/volume-line-PZujbN8h.js"),[],import.meta.url),rtl:!0},block:()=>I(()=>import("./icons/forbid-circle-line-3FxopGoP.js"),[],import.meta.url),unblock:[()=>I(()=>import("./icons/forbid-circle-line-3FxopGoP.js"),[],import.meta.url),"180deg"],flag:()=>I(()=>import("./icons/flag-1-line-xvcg7G7Q.js"),[],import.meta.url),time:()=>I(()=>import("./icons/time-line-ThP0kTRr.js"),[],import.meta.url),refresh:()=>I(()=>import("./icons/refresh-2-line-t42qqclb.js"),[],import.meta.url),emoji2:()=>I(()=>import("./icons/emoji-2-line--uNVc2IC.js"),[],import.meta.url),filter:()=>I(()=>import("./icons/filter-2-line-KyjbFYlO.js"),[],import.meta.url),filters:()=>I(()=>import("./icons/filter-line-1KEfnWDm.js"),[],import.meta.url),chart:()=>I(()=>import("./icons/chart-line-line-pHaLt6yC.js"),[],import.meta.url),react:()=>I(()=>import("./icons/react-line-YfZPqZem.js"),[],import.meta.url),layout4:{module:()=>I(()=>import("./icons/layout-4-line-FOdnyEcZ.js"),[],import.meta.url),rtl:!0},layout5:()=>I(()=>import("./icons/layout-5-line-9Kks7dle.js"),[],import.meta.url),announce:{module:()=>I(()=>import("./icons/announcement-line-MSlAmDH1.js"),[],import.meta.url),rtl:!0},alert:()=>I(()=>import("./icons/alert-line-zyc6hy8V.js"),[],import.meta.url),round:()=>I(()=>import("./icons/round-fill-a0rplSmV.js"),[],import.meta.url),"arrow-up-circle":()=>I(()=>import("./icons/arrow-up-circle-line-e3kZqEZN.js"),[],import.meta.url),"arrow-down-circle":()=>I(()=>import("./icons/arrow-down-circle-line-mpqFtRtO.js"),[],import.meta.url),clipboard:{module:()=>I(()=>import("./icons/clipboard-line-9F_Yeo71.js"),[],import.meta.url),rtl:!0},"account-edit":()=>I(()=>import("./icons/user-edit-line-9VnWCh0X.js"),[],import.meta.url),"account-warning":()=>I(()=>import("./icons/user-warning-line-gL3RGb1N.js"),[],import.meta.url),keyboard:()=>I(()=>import("./icons/keyboard-line-10AZQcVH.js"),[],import.meta.url),cloud:()=>I(()=>import("./icons/cloud-line-abe0HgFS.js"),[],import.meta.url),month:{module:()=>I(()=>import("./icons/calendar-month-line-VoXZVWAe.js"),[],import.meta.url),rtl:!0},media:()=>I(()=>import("./icons/photo-album-line--GdJqjfq.js"),[],import.meta.url),speak:()=>I(()=>import("./icons/radar-line-ndI8IhOG.js"),[],import.meta.url),building:()=>I(()=>import("./icons/building-5-line-ew7lu83B.js"),[],import.meta.url),history2:{module:()=>I(()=>import("./icons/history-2-line-3yIVzoWo.js"),[],import.meta.url),rtl:!0},document:()=>I(()=>import("./icons/document-line--D6ooZg1.js"),[],import.meta.url),"arrows-right":{module:()=>I(()=>import("./icons/arrows-right-line-HF4HILdT.js"),[],import.meta.url),rtl:!0},code:()=>I(()=>import("./icons/code-line-h4RWLaak.js"),[],import.meta.url),copy:()=>I(()=>import("./icons/copy-2-line-mPSDKieb.js"),[],import.meta.url),quote:{module:()=>I(()=>import("./icons/quote-left-line-NQzeELMO.js"),[],import.meta.url),rtl:!0},settings:()=>I(()=>import("./icons/settings-6-line-ZgCBilgF.js"),[],import.meta.url),"heart-break":()=>I(()=>import("./icons/heart-crack-line-P3DoKfTT.js"),[],import.meta.url),"user-x":()=>I(()=>import("./icons/user-x-line-zIdph-gu.js"),[],import.meta.url),minimize:()=>I(()=>import("./icons/arrows-down-line-ovOF9r0o.js"),[],import.meta.url)},ic={s:12,m:16,l:20,xl:24,xxl:32},ti={},sc=Sa(function({width:e,height:t,body:n,rotate:o,flip:i}){return r("svg",{viewBox:`0 0 ${e} ${t}`,dangerouslySetInnerHTML:{__html:n},style:{transform:`${o?`rotate(${o})`:""} ${i?"scaleX(-1)":""}`}})},{isShallowEqual:!0,maxSize:Object.keys(ns).length,matchesArg:(e,t)=>e.icon===t.icon&&e.body===t.body});function M({icon:e,size:t="m",alt:n,title:o,class:i="",style:s={}}){if(!e)return null;const a=ic[t];let c=ns[e];if(!c)return null;let l,u,d=!1;Array.isArray(c)?[c,l,u]=c:typeof c=="object"&&({rotate:l,flip:u,rtl:d}=c,c=c.module);const[f,p]=Z(ti[e]),h=$(e);return ee(()=>{f&&h.current===e||((async()=>{const m=await c();p(m.default),ti[e]=m.default})(),h.current=e)},[e]),r("span",{class:`icon ${i} ${d?"rtl-flip":""}`,title:o||n,style:{width:`${a}px`,height:`${a}px`,...s},"data-icon":e,children:f&&r(sc,{icon:e,width:f.width,height:f.height,body:f.body,rotate:l,flip:u})})}function ac(e,t=[]){!e||typeof e!="function"||ee(()=>{const n=new CloseWatcher;return n.addEventListener("close",e),()=>{n.destroy()}},t)}const cc=window.CloseWatcher?ac:()=>{},lc=document.getElementById("modal-container");function Xo({children:e,onClose:t,onClick:n,class:o,minimized:i}){if(!e)return null;const s=$();ee(()=>{let u=setTimeout(()=>{var f;const d=(f=s.current)==null?void 0:f.querySelector('[tabindex="-1"]');d&&d.focus()},100);return()=>clearTimeout(u)},[]);const a=window.CloseWatcher,c=Bt("esc",()=>{setTimeout(()=>{t==null||t()},0)},{enabled:!a&&!!t,keydown:!1,keyup:!0},[t]);cc(t,[t]),ee(()=>{const u=document.querySelectorAll(".deck-container");if(i){const d=u[u.length-1];d&&d.tabIndex===-1&&d.focus()}else e?u.forEach(d=>{d.setAttribute("inert","")}):u.forEach(d=>{d.removeAttribute("inert")});return()=>{u.forEach(d=>{d.removeAttribute("inert")})}},[e,i]);const l=r("div",{ref:u=>{var d;s.current=u,c(((d=u==null?void 0:u.querySelector)==null?void 0:d.call(u,'[tabindex="-1"]'))||u)},className:o,onClick:u=>{n==null||n(u),u.target===u.currentTarget&&(t==null||t(u))},tabIndex:i?0:"-1",inert:i,onFocus:u=>{var d,f;try{if(u.target===u.currentTarget){const p=(d=s.current)==null?void 0:d.querySelector('[tabindex="-1"]'),h=!!p&&((f=getComputedStyle(p))==null?void 0:f.pointerEvents)!=="none";p&&h&&p.focus()}}catch{}},children:e});return io(l,lc)}var br={exports:{}},uc="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",dc=uc;var fc=dc;function os(){}function rs(){}rs.resetWarningCache=os;var hc=function(){function e(o,i,s,a,c,l){if(l!==fc){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:rs,resetWarningCache:os};return n.PropTypes=n,n};var Uf=br.exports;if(0)var jf,Kf;else br.exports=hc();var j=br.exports;const Tr=e=>!!e&&e[0]==="o",Qo=ka||(e=>e());const Tn=(e,t)=>e===!0||!!(e&&e[t]),Ve=(e,t)=>typeof e=="function"?e(t):e,pc="_szhsinMenu",mc=e=>e[pc];const en=(e,t)=>(t&&Object.keys(t).forEach(n=>{const o=e[n],i=t[n];typeof i=="function"&&o?e[n]=(...s)=>{i(...s),o(...s)}:e[n]=i}),e),gc=e=>{if(typeof e!="string")return{top:0,right:0,bottom:0,left:0};const t=e.trim().split(/\s+/,4).map(parseFloat),n=isNaN(t[0])?0:t[0],o=isNaN(t[1])?n:t[1];return{top:n,right:o,bottom:isNaN(t[2])?n:t[2],left:isNaN(t[3])?o:t[3]}},Co=e=>{for(;e;){if(e=e.parentNode,!e||e===document.body||!e.parentNode)return;const{overflow:t,overflowX:n,overflowY:o}=getComputedStyle(e);if(/auto|scroll|overlay|hidden/.test(t+o+n))return e}};function go(e,t){return{"aria-disabled":e||void 0,tabIndex:t?0:-1}}function ni(e,t){for(let n=0;n({[e?`${e}ClassName`:"className"]:j.oneOfType([j.string,j.func])}),_c={className:j.string,...vc("menu"),arrowProps:j.object,focusProps:j.object,menuStyle:j.object,arrow:j.bool,setDownOverflow:j.bool,gap:j.number,shift:j.number,align:j.oneOf(["start","center","end"]),direction:j.oneOf(["left","right","top","bottom"]),position:j.oneOf(["auto","anchor","initial"]),overflow:j.oneOf(["auto","visible","hidden"])},Wf={..._c,containerProps:j.object,initialMounted:j.bool,unmountOnClose:j.bool,transition:j.oneOfType([j.bool,j.exact({open:j.bool,close:j.bool,item:j.bool})]),transitionTimeout:j.number,boundingBoxRef:j.object,boundingBoxPadding:j.string,reposition:j.oneOf(["auto","initial"]),repositionFlag:j.oneOfType([j.string,j.number]),viewScroll:j.oneOf(["auto","close","initial"]),submenuOpenDelay:j.number,submenuCloseDelay:j.number,portal:j.oneOfType([j.bool,j.exact({target:j.object,stablePosition:j.bool})]),theming:j.string,onItemClick:j.func},Zf={instanceRef:j.oneOfType([j.object,j.func]),onMenuChange:j.func},et=({block:e,element:t,modifiers:n,className:o})=>ae(()=>{const i=t?`${e}__${t}`:e;let s=i;n&&Object.keys(n).forEach(c=>{const l=n[c];l&&(s+=` ${i}--${l===!0?c:`${c}-${l}`}`)});let a=typeof o=="function"?o(n):o;return typeof a=="string"&&(a=a.trim(),a&&(s+=` ${a}`)),s},[e,t,n,o]),yc="szh-menu-container",Je="szh-menu";const bc="arrow",wr="item",Tc="divider",wc="header",Ec="group",xc="submenu";const is=lt(),Er=lt({}),ao=lt({}),xr=lt({}),Sc=lt({}),vo=lt({}),Fe=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),we=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),wn=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),jt=Object.freeze({FIRST:"first",LAST:"last"}),kc=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),Po="absolute",En="none",Sr="menuitem";const Ic=({className:e,containerRef:t,containerProps:n,children:o,isOpen:i,theming:s,transition:a,onClose:c})=>{const l=Tn(a,"item");return r("div",{...en({onKeyDown:({key:f})=>{switch(f){case Fe.ESC:Ve(c,{key:f,reason:wn.CANCEL});break}},onBlur:f=>{i&&!f.currentTarget.contains(f.relatedTarget)&&Ve(c,{reason:wn.BLUR})}},n),className:et({block:yc,modifiers:ae(()=>({theme:s,itemTransition:l}),[s,l]),className:e}),style:{position:"absolute",...n==null?void 0:n.style},ref:t,children:o})},Ac=()=>{let e,t=0;return{toggle:n=>{n?t++:t--,t=Math.max(t,0)},on:(n,o,i)=>{t?e||(e=setTimeout(()=>{e=0,o()},n)):i==null||i()},off:()=>{e&&(clearTimeout(e),e=0)}}},Cc=(e,t)=>{const[n,o]=Z(),s=$({items:[],hoverIndex:-1,sorted:!1}).current,a=Me((l,u)=>{const{items:d}=s;if(!l)s.items=[];else if(u)d.push(l);else{const f=d.indexOf(l);f>-1&&(d.splice(f,1),l.contains(document.activeElement)&&(t.current.focus(),o()))}s.hoverIndex=-1,s.sorted=!1},[s,t]),c=Me((l,u,d)=>{const{items:f,hoverIndex:p}=s,h=()=>{if(s.sorted)return;const _=e.current.querySelectorAll(".szh-menu__item");f.sort((T,y)=>ni(_,T)-ni(_,y)),s.sorted=!0};let m=-1,g;switch(l){case we.RESET:break;case we.SET:g=u;break;case we.UNSET:g=_=>_===u?void 0:_;break;case we.FIRST:h(),m=0,g=f[m];break;case we.LAST:h(),m=f.length-1,g=f[m];break;case we.SET_INDEX:h(),m=d,g=f[m];break;case we.INCREASE:h(),m=p,m<0&&(m=f.indexOf(u)),m++,m>=f.length&&(m=0),g=f[m];break;case we.DECREASE:h(),m=p,m<0&&(m=f.indexOf(u)),m--,m<0&&(m=f.length-1),g=f[m];break;default:}g||(m=-1),o(g),s.hoverIndex=m},[e,s]);return{hoverItem:n,dispatch:c,updateItems:a}},oi=(e,t)=>Math.round(e)===t?e:t,ss=e=>{const t=e.getBoundingClientRect();return t.width=oi(t.width,e.offsetWidth),t.height=oi(t.height,e.offsetHeight),t},Pc=(e,t,n,o)=>{const i=ss(t.current),s=e.current.getBoundingClientRect(),a=n===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:n.getBoundingClientRect(),c=gc(o),l=m=>m+s.left-a.left-c.left,u=m=>m+s.left+i.width-a.right+c.right,d=m=>m+s.top-a.top-c.top,f=m=>m+s.top+i.height-a.bottom+c.bottom;return{menuRect:i,containerRect:s,getLeftOverflow:l,getRightOverflow:u,getTopOverflow:d,getBottomOverflow:f,confineHorizontally:m=>{let g=l(m);if(g<0)m-=g;else{const _=u(m);_>0&&(m-=_,g=l(m),g<0&&(m-=g))}return m},confineVertically:m=>{let g=d(m);if(g<0)m-=g;else{const _=f(m);_>0&&(m-=_,g=d(m),g<0&&(m-=g))}return m}}},Lc=({arrowRef:e,menuY:t,anchorRect:n,containerRect:o,menuRect:i})=>{let s=n.top-o.top-t+n.height/2;const a=e.current.offsetHeight*1.25;return s=Math.max(a,s),s=Math.min(s,i.height-a),s},Mc=({anchorRect:e,containerRect:t,menuRect:n,placeLeftorRightY:o,placeLeftX:i,placeRightX:s,getLeftOverflow:a,getRightOverflow:c,confineHorizontally:l,confineVertically:u,arrowRef:d,arrow:f,direction:p,position:h})=>{let m=p,g=o;h!=="initial"&&(g=u(g),h==="anchor"&&(g=Math.min(g,e.bottom-t.top),g=Math.max(g,e.top-t.top-n.height)));let _,T,y;return m==="left"?(_=i,h!=="initial"&&(T=a(_),T<0&&(y=c(s),(y<=0||-T>y)&&(_=s,m="right")))):(_=s,h!=="initial"&&(y=c(_),y>0&&(T=a(i),(T>=0||-T{let s=n.left-o.left-t+n.width/2;const a=e.current.offsetWidth*1.25;return s=Math.max(a,s),s=Math.min(s,i.width-a),s},Oc=({anchorRect:e,containerRect:t,menuRect:n,placeToporBottomX:o,placeTopY:i,placeBottomY:s,getTopOverflow:a,getBottomOverflow:c,confineHorizontally:l,confineVertically:u,arrowRef:d,arrow:f,direction:p,position:h})=>{let m=p==="top"?"top":"bottom",g=o;h!=="initial"&&(g=l(g),h==="anchor"&&(g=Math.min(g,e.right-t.left),g=Math.max(g,e.left-t.left-n.width)));let _,T,y;return m==="top"?(_=i,h!=="initial"&&(T=a(_),T<0&&(y=c(s),(y<=0||-T>y)&&(_=s,m="bottom")))):(_=s,h!=="initial"&&(y=c(_),y>0&&(T=a(i),(T>=0||-T{const{menuRect:u,containerRect:d}=l,f=n==="left"||n==="right";let p=f?o:i,h=f?i:o;if(e){const x=c.current;f?p+=x.offsetWidth:h+=x.offsetHeight}const m=a.left-d.left-u.width-p,g=a.right-d.left+p,_=a.top-d.top-u.height-h,T=a.bottom-d.top+h;let y,w;t==="end"?(y=a.right-d.left-u.width,w=a.bottom-d.top-u.height):t==="center"?(y=a.left-d.left-(u.width-a.width)/2,w=a.top-d.top-(u.height-a.height)/2):(y=a.left-d.left,w=a.top-d.top),y+=p,w+=h;const E={...l,anchorRect:a,placeLeftX:m,placeRightX:g,placeLeftorRightY:w,placeTopY:_,placeBottomY:T,placeToporBottomX:y,arrowRef:c,arrow:e,direction:n,position:s};switch(n){case"left":case"right":return Mc(E);case"top":case"bottom":default:return Oc(E)}},Kt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Zt:ee;function ri(e,t){typeof e=="function"?e(t):e.current=t}const tn=(e,t)=>ae(()=>e?t?n=>{ri(e,n),ri(t,n)}:e:t,[e,t]),ii=-9999,as=({ariaLabel:e,menuClassName:t,menuStyle:n,arrow:o,arrowProps:i={},anchorPoint:s,anchorRef:a,containerRef:c,containerProps:l,focusProps:u,externalRef:d,parentScrollingRef:f,align:p="start",direction:h="bottom",position:m="auto",overflow:g="visible",setDownOverflow:_,repositionFlag:T,captureFocus:y=!0,state:w,endTransition:E,isDisabled:x,menuItemFocus:b,gap:k=0,shift:D=0,children:L,onClose:A,...C})=>{const[R,W]=Z({x:ii,y:ii}),[U,oe]=Z({}),[Q,re]=Z(),[q,ie]=Z(h),[ce]=Z(Ac),[se,H]=ji(X=>X+1,1),{transition:fe,boundingBoxRef:ne,boundingBoxPadding:Ee,rootMenuRef:ye,rootAnchorRef:xe,scrollNodesRef:De,reposition:Ie,viewScroll:$e,submenuCloseDelay:Ce}=ze(vo),{submenuCtx:he,reposSubmenu:N=T}=ze(ao),ge=$(null),Ge=$(),Lt=$(),V=$(!1),{hoverItem:le,dispatch:z,updateItems:J}=Cc(ge,Ge),Y=Tr(w),be=Tn(fe,"open"),te=Tn(fe,"close"),pe=De.current,Mt=X=>{switch(X.key){case Fe.HOME:z(we.FIRST);break;case Fe.END:z(we.LAST);break;case Fe.UP:z(we.DECREASE,le);break;case Fe.DOWN:z(we.INCREASE,le);break;case Fe.SPACE:X.target&&X.target.className.indexOf(Je)!==-1&&X.preventDefault();return;default:return}X.preventDefault(),X.stopPropagation()},Be=()=>{w==="closing"&&re(),Ve(E)},Ae=X=>{X.stopPropagation(),ce.on(Ce,()=>{z(we.RESET),Ge.current.focus()})},Pe=X=>{X.target===X.currentTarget&&ce.off()},ve=Me(X=>{var _e;const Te=a?(_e=a.current)==null?void 0:_e.getBoundingClientRect():s?{left:s.x,right:s.x,top:s.y,bottom:s.y,width:0,height:0}:null;if(!Te)return;pe.menu||(pe.menu=(ne?ne.current:Co(ye.current))||window);const He=Pc(c,ge,pe.menu,Ee);let{arrowX:Se,arrowY:nt,x:Ln,y:bt,computedDirection:qe}=Dc({arrow:o,align:p,direction:h,gap:k,shift:D,position:m,anchorRect:Te,arrowRef:Lt,positionHelpers:He});const{menuRect:Mn}=He,Ue=Mn.height;if(!X&&g!=="visible"){const{getTopOverflow:Tt,getBottomOverflow:bo}=He;let wt,de;const Et=bo(bt);if(Et>0)wt=Ue-Et,de=Et;else{const Ot=Tt(bt);Ot<0&&(wt=Ue+Ot,de=0-Ot,wt>=0&&(bt-=Ot))}wt>=0&&re({height:wt,overflowAmt:de})}o&&oe({x:Se,y:nt}),W({x:Ln,y:bt}),ie(qe)},[o,p,Ee,h,k,D,m,g,s,a,c,ne,ye,pe]);Kt(()=>{Y&&(ve(),V.current&&H()),V.current=Y},[Y,ve,N]),Kt(()=>{Q&&!_&&(ge.current.scrollTop=0)},[Q,_]),Kt(()=>J,[J]),ee(()=>{let{menu:X}=pe;if(!Y||!X)return;if(X=X.addEventListener?X:window,!pe.anchors){pe.anchors=[];let Se=Co(xe&&xe.current);for(;Se&&Se!==X;)pe.anchors.push(Se),Se=Co(Se)}let _e=$e;if(pe.anchors.length&&_e==="initial"&&(_e="auto"),_e==="initial")return;const Te=()=>{_e==="auto"?Qo(()=>ve(!0)):Ve(A,{reason:wn.SCROLL})},He=pe.anchors.concat($e!=="initial"?X:[]);return He.forEach(Se=>Se.addEventListener("scroll",Te)),()=>He.forEach(Se=>Se.removeEventListener("scroll",Te))},[xe,pe,Y,A,$e,ve]);const Le=!!Q&&Q.overflowAmt>0;ee(()=>{if(Le||!Y||!f)return;const X=()=>Qo(ve),_e=f.current;return _e.addEventListener("scroll",X),()=>_e.removeEventListener("scroll",X)},[Y,Le,f,ve]),ee(()=>{if(!Y||typeof ResizeObserver!="function"||Ie==="initial")return;const X=[],_e=new ResizeObserver(Se=>Se.forEach(({target:nt})=>{X.indexOf(nt)<0?X.push(nt):Ia(()=>{ve(),H()})})),Te={box:"border-box"};_e.observe(ge.current,Te);const He=a==null?void 0:a.current;return He&&_e.observe(He,Te),()=>_e.disconnect()},[Y,Ie,a,ve]),ee(()=>{if(!Y){z(we.RESET),te||re();return}const{position:X,alwaysUpdate:_e}=b||{},Te=()=>{X===jt.FIRST?z(we.FIRST):X===jt.LAST?z(we.LAST):X>=-1&&z(we.SET_INDEX,void 0,X)};if(_e)Te();else if(y){const He=setTimeout(()=>{const Se=ge.current;Se&&!Se.contains(document.activeElement)&&(Ge.current.focus(),Te())},be?170:100);return()=>clearTimeout(He)}},[Y,be,te,y,b,z]);const Cn=ae(()=>({isParentOpen:Y,submenuCtx:ce,dispatch:z,updateItems:J}),[Y,ce,z,J]);let dt,_t;Q&&(_?_t=Q.overflowAmt:dt=Q.height);const yo=ae(()=>({reposSubmenu:se,submenuCtx:ce,overflow:g,overflowAmt:_t,parentMenuRef:ge,parentDir:q}),[se,ce,g,_t,q]),me=dt>=0?{maxHeight:dt,overflow:g}:void 0,Rt=ae(()=>({state:w,align:p,dir:q}),[w,p,q]),yt=ae(()=>({dir:q}),[q]),tt=et({block:Je,element:bc,modifiers:yt,className:i.className}),Pn=r("ul",{role:"menu","aria-label":e,...go(x),...en({onPointerEnter:he==null?void 0:he.off,onPointerMove:Ae,onPointerLeave:Pe,onKeyDown:Mt,onAnimationEnd:Be},C),ref:tn(d,ge),className:et({block:Je,modifiers:Rt,className:t}),style:{...n,...me,margin:0,display:w==="closed"?"none":void 0,position:Po,left:R.x,top:R.y},children:[r("li",{tabIndex:-1,role:En,style:{position:Po,left:0,top:0,display:"block",outline:"none"},ref:Ge,...u}),o&&r("li",{role:En,...i,className:tt,style:{display:"block",position:Po,left:U.x,top:U.y,...i.style},ref:Lt}),r(ao.Provider,{value:yo,children:r(Er.Provider,{value:Cn,children:r(is.Provider,{value:le,children:Ve(L,Rt)})})})]});return l?r(Ic,{...l,isOpen:Y,children:Pn}):Pn},cs=Ct(function({"aria-label":t,className:n,containerProps:o,initialMounted:i,unmountOnClose:s,transition:a,transitionTimeout:c,boundingBoxRef:l,boundingBoxPadding:u,reposition:d="auto",submenuOpenDelay:f=300,submenuCloseDelay:p=150,viewScroll:h="initial",portal:m,theming:g,onItemClick:_,...T},y){const w=$(null),E=$({}),{anchorRef:x,state:b,onClose:k}=T,D=ae(()=>({initialMounted:i,unmountOnClose:s,transition:a,transitionTimeout:c,boundingBoxRef:l,boundingBoxPadding:u,rootMenuRef:w,rootAnchorRef:x,scrollNodesRef:E,reposition:d,viewScroll:h,submenuOpenDelay:f,submenuCloseDelay:p}),[i,s,a,c,x,l,u,d,h,f,p]),L=ae(()=>({handleClick(C,R){C.stopPropagation||Ve(_,C);let W=C.keepOpen;W===void 0&&(W=R&&C.key===Fe.SPACE),W||Ve(k,{value:C.value,key:C.key,reason:wn.CLICK})},handleClose(C){Ve(k,{key:C,reason:wn.CLICK})}}),[_,k]);if(!b)return null;const A=r(vo.Provider,{value:D,children:r(xr.Provider,{value:L,children:r(as,{...T,ariaLabel:t||"Menu",externalRef:y,containerRef:w,containerProps:{className:n,containerRef:w,containerProps:o,theming:g,transition:a,onClose:k}})})});return m===!0&&typeof document<"u"?io(A,document.body):m?m.target?io(A,m.target):m.stablePosition?null:A:A}),Jo=0,er=1,co=2,lo=3,uo=4,$c=5,ls=6,Nc=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],us=e=>({_s:e,status:Nc[e],isEnter:euo}),tr=e=>e?ls:$c,Fc=(e,t)=>{switch(e){case er:case Jo:return co;case uo:case lo:return tr(t)}},zc=e=>typeof e=="object"?[e.enter,e.exit]:[e,e],si=(e,t,n,o,i)=>{clearTimeout(o.current);const s=us(e);t(s),n.current=s,i&&i({current:s})},Vc=({enter:e=!0,exit:t=!0,preEnter:n,preExit:o,timeout:i,initialEntered:s,mountOnEnter:a,unmountOnExit:c,onStateChange:l}={})=>{const[u,d]=Z(()=>us(s?co:tr(a))),f=$(u),p=$(),[h,m]=zc(i),g=Me(()=>{const T=Fc(f.current._s,c);T&&si(T,d,f,p,l)},[l,c]),_=Me(T=>{const y=E=>{switch(si(E,d,f,p,l),E){case er:h>=0&&(p.current=setTimeout(g,h));break;case uo:m>=0&&(p.current=setTimeout(g,m));break;case Jo:case lo:p.current=setTimeout(()=>y(E+1),0);break}},w=f.current.isEnter;typeof T!="boolean"&&(T=!w),T?!w&&y(e?n?Jo:er:co):w&&y(t?o?lo:uo:tr(c))},[g,l,e,t,n,o,h,m,c]);return ee(()=>()=>clearTimeout(p.current),[]),[u,_,g]};const Hc=({initialOpen:e,initialMounted:t,unmountOnClose:n,transition:o,transitionTimeout:i=500}={})=>{const[{status:s},a,c]=Vc({initialEntered:e,mountOnEnter:!t,unmountOnExit:n,timeout:i,enter:Tn(o,"open"),exit:Tn(o,"close")});return[{state:kc[s],endTransition:c},a]},ds=e=>{const[t,n]=Hc(e),[o,i]=Z(),s=(a,c)=>{i({position:a,alwaysUpdate:c}),n(!0)};return[{menuItemFocus:o,...t},n,s]},Bc=(e,t)=>{const[n]=Z({});return{onMouseDown:()=>{n.v=e&&e!=="closed"},onClick:o=>n.v?n.v=!1:t(!0,o)}},fs=(e,t)=>{const n=$(t);ee(()=>{n.current!==t&&Ve(e,{open:t}),n.current=t},[e,t])},Uc=Ct(function({"aria-label":t,captureFocus:n,initialOpen:o,menuButton:i,instanceRef:s,onMenuChange:a,...c},l){const[u,d,f]=ds(c),{state:p}=u,h=Tr(p),m=$(null),g=Bc(p,(x,b)=>f(b.detail?void 0:jt.FIRST)),_=Me(x=>{d(!1),x.key&&m.current.focus()},[d]),T=x=>{switch(x.key){case Fe.UP:f(jt.LAST);break;case Fe.DOWN:f(jt.FIRST);break;default:return}x.preventDefault()},y=Ve(i,{open:h});if(!y||!y.type)throw new Error("Menu requires a menuButton prop.");const w={ref:tn(y.ref,m),...en({onKeyDown:T,...g},y.props)};mc(y.type)==="MenuButton"&&(w.isOpen=h);const E=Ki(y,w);return fs(a,h),Wi(s,()=>({openMenu:f,closeMenu:()=>d(!1)})),r(F,{children:[E,r(cs,{...c,...u,"aria-label":t||(typeof y.props.children=="string"?y.props.children:"Menu"),anchorRef:m,ref:l,onClose:_})]})}),kr=(e,t)=>{const n=Jt(t),o=Ct((i,s)=>{const a=$(null);return r(n,{...i,itemRef:a,externalRef:s,isHovering:ze(is)===a.current})});return o.displayName=`WithHovering(${e})`,o},hs=(e,t,n)=>{Kt(()=>{if(e)return;const o=t.current;return n(o,!0),()=>{n(o)}},[e,t,n])},jc=kr("SubMenu",function({"aria-label":t,className:n,disabled:o,direction:i,label:s,openTrigger:a,onMenuChange:c,isHovering:l,instanceRef:u,itemRef:d,captureFocus:f,repositionFlag:p,itemProps:h={},...m}){const g=ze(vo),{rootMenuRef:_,submenuOpenDelay:T,submenuCloseDelay:y}=g,{parentMenuRef:w,parentDir:E,overflow:x}=ze(ao),{isParentOpen:b,submenuCtx:k,dispatch:D,updateItems:L}=ze(Er),A=x!=="visible",[C,R,W]=ds(g),{state:U}=C,oe=!!o,Q=Tr(U),re=$(null),[q]=Z({v:0}),ie=()=>{k.off(),q.v&&(clearTimeout(q.v),q.v=0)},ce=(...N)=>{ie(),se(),!oe&&W(...N)},se=()=>!l&&!oe&&D(we.SET,d.current),H=N=>{se(),a||(q.v=setTimeout(()=>Qo(ce),Math.max(N,0)))},fe=N=>{oe||(N.stopPropagation(),!(q.v||Q)&&k.on(y,()=>H(T-y),()=>H(T)))},ne=()=>{ie(),Q||D(we.UNSET,d.current)},Ee=N=>{if(l)switch(N.key){case Fe.ENTER:N.preventDefault();case Fe.SPACE:case Fe.RIGHT:a!=="none"&&ce(jt.FIRST)}},ye=N=>{let ge=!1;switch(N.key){case Fe.LEFT:Q&&(d.current.focus(),R(!1),ge=!0);break;case Fe.RIGHT:Q||(ge=!0);break}ge&&(N.preventDefault(),N.stopPropagation())};hs(oe,d,L),fs(c,Q),ee(()=>k.toggle(Q),[k,Q]),ee(()=>()=>clearTimeout(q.v),[q]),ee(()=>{l&&b?d.current.focus():R(!1)},[l,b,R,d]),Wi(u,()=>({openMenu:(...N)=>{b&&ce(...N)},closeMenu:()=>{Q&&(d.current.focus(),R(!1))}}));const xe=ae(()=>({open:Q,hover:l,disabled:oe,submenu:!0}),[Q,l,oe]),{ref:De,className:Ie,...$e}=h,Ce=en({onPointerEnter:k.off,onPointerMove:fe,onPointerLeave:ne,onKeyDown:Ee,onClick:()=>a!=="none"&&ce()},$e),he=()=>{const N=r(as,{...m,...C,ariaLabel:t||(typeof s=="string"?s:"Submenu"),anchorRef:d,containerRef:A?_:re,direction:i||(E==="right"||E==="left"?E:"right"),parentScrollingRef:A&&w,isDisabled:oe}),ge=_.current;return A&&ge?io(N,ge):N};return r("li",{className:et({block:Je,element:xc,className:n}),style:{position:"relative"},role:En,ref:re,onKeyDown:ye,children:[r("div",{role:Sr,"aria-haspopup":!0,"aria-expanded":Q,...go(oe,l),...Ce,ref:tn(De,d),className:et({block:Je,element:wr,modifiers:xe,className:Ie}),children:ae(()=>Ve(s,xe),[s,xe])}),U&&he()]})}),ps=(e,t,n,o)=>{const{submenuCloseDelay:i}=ze(vo),{isParentOpen:s,submenuCtx:a,dispatch:c,updateItems:l}=ze(Er),u=()=>{!n&&!o&&c(we.SET,e.current)},d=()=>{!o&&c(we.UNSET,e.current)},f=m=>{n&&!m.currentTarget.contains(m.relatedTarget)&&d()},p=m=>{o||(m.stopPropagation(),a.on(i,u,u))},h=(m,g)=>{a.off(),!g&&d()};return hs(o,e,l),ee(()=>{n&&s&&t.current&&t.current.focus()},[t,n,s]),{setHover:u,onBlur:f,onPointerMove:p,onPointerLeave:h}},ke=kr("MenuItem",function({className:t,value:n,href:o,type:i,checked:s,disabled:a,children:c,onClick:l,isHovering:u,itemRef:d,externalRef:f,...p}){const h=!!a,{setHover:m,...g}=ps(d,d,u,h),_=ze(xr),T=ze(Sc),y=i==="radio",w=i==="checkbox",E=!!o&&!h&&!y&&!w,x=y?T.value===n:w?!!s:!1,b=C=>{if(h){C.stopPropagation(),C.preventDefault();return}const R={value:n,syntheticEvent:C};C.key!==void 0&&(R.key=C.key),w&&(R.checked=!x),y&&(R.name=T.name),Ve(l,R),y&&Ve(T.onRadioChange,R),_.handleClick(R,w||y)},k=C=>{if(u)switch(C.key){case Fe.ENTER:C.preventDefault();case Fe.SPACE:E?d.current.click():b(C)}},D=ae(()=>({type:i,disabled:h,hover:u,checked:x,anchor:E}),[i,h,u,x,E]),L=en({...g,onPointerDown:m,onKeyDown:k,onClick:b},p),A={role:y?"menuitemradio":w?"menuitemcheckbox":Sr,"aria-checked":y||w?x:void 0,...go(h,u),...L,ref:tn(f,d),className:et({block:Je,element:wr,modifiers:D,className:t}),children:ae(()=>Ve(c,D),[c,D])};return E?r("li",{role:En,children:r("a",{href:o,...A})}):r("li",{...A})}),Kc=kr("FocusableItem",function({className:t,disabled:n,children:o,isHovering:i,itemRef:s,externalRef:a,...c}){const l=!!n,u=$(null),{setHover:d,onPointerLeave:f,...p}=ps(s,u,i,l),{handleClose:h}=ze(xr),m=ae(()=>({disabled:l,hover:i,focusable:!0}),[l,i]),g=ae(()=>Ve(o,{...m,ref:u,closeMenu:h}),[o,m,h]),_=en({...p,onPointerLeave:T=>f(T,!0),onFocus:d},c);return r("li",{role:Sr,...go(l),..._,ref:tn(a,s),className:et({block:Je,element:wr,modifiers:m,className:t}),children:g})}),an=Jt(Ct(function({className:t,...n},o){return r("li",{role:"separator",...n,ref:o,className:et({block:Je,element:Tc,className:t})})})),Gf=Jt(Ct(function({className:t,...n},o){return r("li",{role:En,...n,ref:o,className:et({block:Je,element:wc,className:t})})})),qf=Ct(function({className:t,style:n,takeOverflow:o,...i},s){const a=$(null),[c,l]=Z(),{overflow:u,overflowAmt:d}=ze(ao);return Kt(()=>{let f;o&&d>=0&&(f=ss(a.current).height-d,f<0&&(f=0)),l(f>=0?{maxHeight:f,overflow:u}:void 0)},[o,u,d]),Kt(()=>{c&&(a.current.scrollTop=0)},[c]),r("div",{...i,ref:tn(s,a),className:et({block:Je,element:Ec,className:t}),style:{...n,...c}})});const ai={s:16,m:20,l:24,xl:32,xxl:50,xxxl:64},cn={},fn=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),to=fn.getContext("2d",{willReadFrequently:!0});to.imageSmoothingEnabled=!1;const Wc=/missing\.png$/;function Zc({url:e,size:t,alt:n="",squircle:o,...i}){t=ai[t]||t||ai.m;const s=$(),a=Wc.test(e);return r("span",{ref:s,class:`avatar ${o?"squircle":""} ${cn[e]?"has-alpha":""}`,style:{width:t,height:t},title:n,...i,children:!!e&&r("img",{src:e,width:t,height:t,alt:n,loading:"lazy",decoding:"async",fetchPriority:"low",crossOrigin:cn[e]===void 0&&!a?"anonymous":void 0,onError:c=>{c.target.crossOrigin&&(c.target.crossOrigin=null,c.target.src=e)},onLoad:c=>{s.current&&(s.current.dataset.loaded=!0),cn[e]===void 0&&(a||setTimeout(()=>{try{const{width:l,height:u}=c.target;fn.width!==l&&(fn.width=l),fn.height!==u&&(fn.height=u),to.drawImage(c.target,0,0);const d=to.getImageData(0,0,l,u),f=d.data.filter((p,h)=>h%4===3&&p<=128).length/(d.data.length/4)>.1;f&&s.current.classList.add("has-alpha"),cn[e]=f,to.clearRect(0,0,l,u)}catch{cn[e]=!1}},1))}})})}const st=Oe(Zc),Gt=Ct((e,t)=>{var c;let n;try{n=Aa()}catch{}let o=(location.hash||"").replace(/^#/,"").trim();o===""&&(o="/");const{to:i,...s}=e;if(o&&o!=="/"&&o.includes("?")){const l=URL.parse(o,location.origin);if((c=l==null?void 0:l.searchParams)!=null&&c.size){const u=Array.from(l.searchParams.entries()).map(([d,f])=>`${d}=${encodeURIComponent(f)}`).join("&");o=l.pathname+"?"+u}}const a=o===i||decodeURIComponent(o)===i;return r("a",{ref:t,href:`#${i}`,...s,class:`${e.class||""} ${a?"is-active":""}`,onClick:l=>{var u,d,f;(d=(u=l.currentTarget)==null?void 0:u.parentNode)!=null&&d.closest("a")&&l.stopPropagation(),n&&(B.prevLocation=n),(f=e.onClick)==null||f.call(e,l)}})});let nr=!1;const Gc=new MutationObserver(e=>{e.forEach(t=>{if(t.type==="attributes"){const{dir:n}=t.target;n==="rtl"?nr=!0:nr=!1}})});Gc.observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]});function or(){return nr}const qc=document.documentElement,jn=getComputedStyle(qc),Yc=8;let ms=[0,0,0,0];function gs(){const e=jn.getPropertyValue("--sai-top"),t=jn.getPropertyValue("--sai-right"),n=jn.getPropertyValue("--sai-bottom"),o=jn.getPropertyValue("--sai-left");ms=[Math.max(0,parseInt(e,10)),Math.max(0,parseInt(t,10)),Math.max(0,parseInt(n,10)),Math.max(0,parseInt(o,10))]}requestAnimationFrame(gs);function vs(e=[]){return ms.map((n,o)=>(n||Yc)+(e[o]||0)).join(" ")}CSS.supports("top: env(safe-area-inset-top)")&&window.addEventListener("resize",gs,{passive:!0});function Xc(){const[e,t]=Z({width:null,height:null});return Zt(()=>{const n=()=>{t({width:window.innerWidth,height:window.innerHeight})};return n(),window.addEventListener("resize",n,{passive:!0}),()=>{window.removeEventListener("resize",n)}},[]),e}function _s(e){const{containerProps:t,instanceRef:n,align:o}=e,i=Xc(),s=n!=null&&n.current?n:$(),a=or()?o==="end"?"start":o==="start"?"end":o:o;return r(Uc,{boundingBoxPadding:vs(),repositionFlag:`${i.width}x${i.height}`,unmountOnClose:!0,...e,align:a,instanceRef:s,containerProps:{onClick:c=>{var l,u,d;c.target===c.currentTarget&&((u=(l=s.current)==null?void 0:l.closeMenu)==null||u.call(l)),(d=t==null?void 0:t.onClick)==null||d.call(t,c)},...t}})}function Qc(e){const t=$();return r(jc,{...e,instanceRef:t,itemProps:{onPointerMove:n=>{var o,i;n.pointerType==="touch"&&((i=(o=t.current)==null?void 0:o.openMenu)==null||i.call(o))},onPointerLeave:n=>{var o,i;n.pointerType==="touch"&&((i=(o=t.current)==null?void 0:o.openMenu)==null||i.call(o))},...e.itemProps}})}function Lo({subMenu:e=!1,confirm:t=!0,confirmLabel:n,menuItemClassName:o,menuFooter:i,menuExtras:s,...a}){const{children:c,onClick:l,...u}=a;return t?r(e?Qc:_s,{openTrigger:"clickOnly",direction:"bottom",overflow:"auto",gap:-8,shift:8,menuClassName:"menu-emphasized",...u,menuButton:e?void 0:c,label:e?c:void 0,children:[r(ke,{className:o,onClick:l,children:n}),s,i]}):e?r(ke,{...a}):l?Ca(c,{onClick:l}):c}function ci(e){const{className:t,disabled:n,...o}=e;return r(Kc,{className:t,disabled:n,children:({ref:i,closeMenu:s})=>r(Gt,{...o,ref:i,onClick:({detail:a})=>s(a===0?"Enter":void 0)})})}function rr({staticUrl:e,alt:t,url:n}){return r("picture",{children:[e&&r("source",{srcset:e,media:"(prefers-reduced-motion: reduce)"}),r("img",{src:n,alt:t,class:"shortcode-emoji emoji",width:"16",height:"16",loading:"lazy",decoding:"async",fetchPriority:"low"},t||n)]})}const Jc=Oe(e=>new RegExp(`:(${e.join("|")}):`,"g"));function el({text:e,emojis:t}){if(!e)return"";if(!(t!=null&&t.length)||e.indexOf(":")===-1)return e;const n=Jc(t.map(i=>i.shortcode));return e.split(n).map((i,s)=>{const a=t.find(c=>c.shortcode===i);if(a){const{url:c,staticUrl:l}=a;return r(rr,{staticUrl:l,alt:i,url:c},i+"-"+s)}return i})}const qt=Oe(el),tl=Oe(e=>{const t={sensitivity:"base"};try{return new Intl.Collator(e||void 0,t)}catch{return new Intl.Collator(void 0,t)}}),nl=/([^@]+)(@.+)/i,ol=/(\:(\w|\+|\-)+\:)(?=|[\!\.\?]|$)/g,rl=/\s+/g,il=/[^a-z0-9@\.]/gi;function sl({account:e,instance:t,showAvatar:n,showAcct:o,short:i,external:s,onClick:a}){const{i18n:c}=po(),{acct:l,avatar:u,avatarStatic:d,id:f,url:p,displayName:h,emojis:m,bot:g,username:_}=e,[T,y,w]=l.match(nl)||[,l];t||(t=so().instance);const E=_.toLowerCase().trim(),x=(h||"").toLowerCase().trim(),b=x.replace(ol,"").replace(rl,""),k=b.replace(il,""),D=!i&&(E===x||E===b||E===k||tl(c.locale).compare(E,b)===0)||k===l.toLowerCase();return r("a",{class:`name-text ${o?"show-acct":""} ${i?"short":""}`,href:p,target:s?"_blank":null,title:h?`${h} (${w?"":"@"}${l})`:`${w?"":"@"}${l}`,onClick:L=>{if(!s&&!L.shiftKey){if(L.preventDefault(),L.stopPropagation(),a)return a(L);if(L.metaKey||L.ctrlKey||L.shiftKey||L.which===2){const A=`#/${t}/a/${f}`;window.open(A,"_blank");return}B.showAccount={account:e,instance:t}}},children:[n&&r(F,{children:[r(st,{url:d||u,squircle:g})," "]}),h&&!i?r(F,{children:[r("b",{dir:"auto",children:r(qt,{text:h,emojis:m})}),!o&&!D&&r(F,{children:[" ",r("i",{class:"bidi-isolate",children:["@",_]})]})]}):i?r("i",{children:_}):r("b",{children:_}),o&&r(F,{children:[r("br",{}),r("i",{class:"bidi-isolate",children:[w?"":"@",y,!!w&&r("span",{class:"ib",children:w})]})]})]})}const gt=Oe(sl),Kn={"zh-YUE":"YUE",zh_HANT:"zh-Hant"},Mo=Oe(e=>new Intl.DisplayNames(e||void 0,{type:"language"}));function al(e){let t,n;typeof e=="object"&&({code:e,locale:t,fallback:n}=e);try{const o=Mo(t||S.locale).of(e);if(o!==e)return o;if(!n){const i=Mo(e).of(e);if(i!==e)return i}return n||""}catch{if(Kn[e])try{const i=Mo(Kn[t]||t||S.locale).of(Kn[e]);return i!==Kn[e]?i:n||""}catch{}return n||""}}const ln=Oe(al);function li(e){if(e instanceof Date)return!isNaN(e.getTime());{const t=new Date(e);return!isNaN(t.getTime())}}const cl=Oe(()=>new Intl.DateTimeFormat().resolvedOptions().locale),ui=Oe((e,t={})=>{const n=e.replace(/-[a-z]+$/i,""),o=bn([n],[cl()],e);try{return new Intl.DateTimeFormat(o,t)}catch{}try{return new Intl.DateTimeFormat(e,t)}catch{}return new Intl.DateTimeFormat(void 0,t)}),ll=Oe(e=>new Intl.RelativeTimeFormat(e||void 0)),Yt=60,Xt=60*Yt,ir=24*Xt,ul=e=>{const t=ll(S.locale),n=(e.getTime()-Date.now())/1e3,o=Math.abs(n);return o{const t=(Date.now()-e.getTime())/1e3;return tl+1,0),i=ae(()=>new Date(e),[e]),[s,a,c]=ae(()=>{if(!li(i))return[""+e,"",""];let l;if(t==="micro"){const u=new Date;(u.getTime()-i.getTime())/1e3/ir<=1?l=dl(i):u.getFullYear()===i.getFullYear()?l=ui(S.locale,{year:void 0,month:"short",day:"numeric"}).format(i):l=ui(S.locale,{dateStyle:"short"}).format(i)}return l||(l=ul(i)),[l,i.toISOString(),i.toLocaleString()]},[i,t,n]);return ee(()=>{if(!li(i))return;let l,u;function d(){u=requestAnimationFrame(()=>{o(),f()})}function f(){const p=(Date.now()-i.getTime())/1e3;p{clearTimeout(l),cancelAnimationFrame(u)}},[]),r("time",{datetime:a,title:c,children:s})}const fl=[{code:"af",name:"Afrikaans"},{code:"sq",name:"Albanian"},{code:"am",name:"Amharic"},{code:"ar",name:"Arabic"},{code:"hy",name:"Armenian"},{code:"as",name:"Assamese"},{code:"ay",name:"Aymara"},{code:"az",name:"Azerbaijani"},{code:"bm",name:"Bambara"},{code:"eu",name:"Basque"},{code:"be",name:"Belarusian"},{code:"bn",name:"Bengali"},{code:"bho",name:"Bhojpuri"},{code:"bs",name:"Bosnian"},{code:"bg",name:"Bulgarian"},{code:"ca",name:"Catalan"},{code:"ceb",name:"Cebuano"},{code:"ny",name:"Chichewa"},{code:"zh",name:"Chinese"},{code:"zh_HANT",name:"Chinese (Traditional)"},{code:"co",name:"Corsican"},{code:"hr",name:"Croatian"},{code:"cs",name:"Czech"},{code:"da",name:"Danish"},{code:"dv",name:"Dhivehi"},{code:"doi",name:"Dogri"},{code:"nl",name:"Dutch"},{code:"en",name:"English"},{code:"eo",name:"Esperanto"},{code:"et",name:"Estonian"},{code:"ee",name:"Ewe"},{code:"tl",name:"Filipino"},{code:"fi",name:"Finnish"},{code:"fr",name:"French"},{code:"fy",name:"Frisian"},{code:"gl",name:"Galician"},{code:"ka",name:"Georgian"},{code:"de",name:"German"},{code:"el",name:"Greek"},{code:"gn",name:"Guarani"},{code:"gu",name:"Gujarati"},{code:"ht",name:"Haitian Creole"},{code:"ha",name:"Hausa"},{code:"haw",name:"Hawaiian"},{code:"iw",name:"Hebrew"},{code:"hi",name:"Hindi"},{code:"hmn",name:"Hmong"},{code:"hu",name:"Hungarian"},{code:"is",name:"Icelandic"},{code:"ig",name:"Igbo"},{code:"ilo",name:"Ilocano"},{code:"id",name:"Indonesian"},{code:"ga",name:"Irish"},{code:"it",name:"Italian"},{code:"ja",name:"Japanese"},{code:"jw",name:"Javanese"},{code:"kn",name:"Kannada"},{code:"kk",name:"Kazakh"},{code:"km",name:"Khmer"},{code:"rw",name:"Kinyarwanda"},{code:"gom",name:"Konkani"},{code:"ko",name:"Korean"},{code:"kri",name:"Krio"},{code:"ku",name:"Kurdish (Kurmanji)"},{code:"ckb",name:"Kurdish (Sorani)"},{code:"ky",name:"Kyrgyz"},{code:"lo",name:"Lao"},{code:"la",name:"Latin"},{code:"lv",name:"Latvian"},{code:"ln",name:"Lingala"},{code:"lt",name:"Lithuanian"},{code:"lg",name:"Luganda"},{code:"lb",name:"Luxembourgish"},{code:"mk",name:"Macedonian"},{code:"mai",name:"Maithili"},{code:"mg",name:"Malagasy"},{code:"ms",name:"Malay"},{code:"ml",name:"Malayalam"},{code:"mt",name:"Maltese"},{code:"mi",name:"Maori"},{code:"mr",name:"Marathi"},{code:"mni-Mtei",name:"Meiteilon (Manipuri)"},{code:"lus",name:"Mizo"},{code:"mn",name:"Mongolian"},{code:"my",name:"Myanmar (Burmese)"},{code:"ne",name:"Nepali"},{code:"no",name:"Norwegian"},{code:"or",name:"Odia (Oriya)"},{code:"om",name:"Oromo"},{code:"ps",name:"Pashto"},{code:"fa",name:"Persian"},{code:"pl",name:"Polish"},{code:"pt",name:"Portuguese"},{code:"pa",name:"Punjabi"},{code:"qu",name:"Quechua"},{code:"ro",name:"Romanian"},{code:"ru",name:"Russian"},{code:"sm",name:"Samoan"},{code:"sa",name:"Sanskrit"},{code:"gd",name:"Scots Gaelic"},{code:"nso",name:"Sepedi"},{code:"sr",name:"Serbian"},{code:"st",name:"Sesotho"},{code:"sn",name:"Shona"},{code:"sd",name:"Sindhi"},{code:"si",name:"Sinhala"},{code:"sk",name:"Slovak"},{code:"sl",name:"Slovenian"},{code:"so",name:"Somali"},{code:"es",name:"Spanish"},{code:"su",name:"Sundanese"},{code:"sw",name:"Swahili"},{code:"sv",name:"Swedish"},{code:"tg",name:"Tajik"},{code:"ta",name:"Tamil"},{code:"tt",name:"Tatar"},{code:"te",name:"Telugu"},{code:"th",name:"Thai"},{code:"ti",name:"Tigrinya"},{code:"ts",name:"Tsonga"},{code:"tr",name:"Turkish"},{code:"tk",name:"Turkmen"},{code:"ak",name:"Twi"},{code:"uk",name:"Ukrainian"},{code:"ur",name:"Urdu"},{code:"ug",name:"Uyghur"},{code:"uz",name:"Uzbek"},{code:"vi",name:"Vietnamese"},{code:"cy",name:"Welsh"},{code:"xh",name:"Xhosa"},{code:"yi",name:"Yiddish"},{code:"yo",name:"Yoruba"},{code:"zu",name:"Zulu"}],hl=Oe(()=>[new Intl.DateTimeFormat().resolvedOptions().locale,...navigator.languages]),pl=()=>bn(hl(),fl.map(e=>e.code.replace("_","-")),"en");function ys(e=!1){if(e){const{contentTranslationTargetLanguage:t}=B.settings;if(t)return t}return pl()}const di=["byte","kilobyte","megabyte","gigabyte","terabyte","petabyte"];function Yf(e){const t=Math.min(Math.floor(Math.log2(e)/10),di.length-1),n=e/1024**t;return S.number(n,{style:"unit",unit:di[t],unitDisplay:"narrow",maximumFractionDigits:0})}const ml=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,fo=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(ml);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},fi=e=>e==="*"||e==="x"||e==="X",hi=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},gl=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],vl=(e,t)=>{if(fi(e)||fi(t))return 0;const[n,o]=gl(hi(e),hi(t));return n>o?1:n{for(let n=0;n{const n=fo(e),o=fo(t),i=n.pop(),s=o.pop(),a=Ut(n,o);return a!==0?a:i&&s?Ut(i.split("."),s.split(".")):i||s?i?-1:1:0},yl=(e,t,n)=>{bl(n);const o=_l(e,t);return bs[n].includes(o)},bs={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},pi=Object.keys(bs),bl=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(pi.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${pi.join("|")}`)},no=(e,t)=>{if(t=t.replace(/([><=]+)\s+/g,"$1"),t.includes("||"))return t.split("||").some(_=>no(e,_));if(t.includes(" - ")){const[_,T]=t.split(" - ",2);return no(e,`>=${_} <=${T}`)}else if(t.includes(" "))return t.trim().replace(/\s{2,}/g," ").split(" ").every(_=>no(e,_));const n=t.match(/^([<>=~^]+)/),o=n?n[1]:"=";if(o!=="^"&&o!=="~")return yl(e,t,o);const[i,s,a,,c]=fo(e),[l,u,d,,f]=fo(t),p=[i,s,a],h=[l,u??"x",d??"x"];if(f&&(!c||Ut(p,h)!==0||Ut(c.split("."),f.split("."))===-1))return!1;const m=h.findIndex(_=>_!=="0")+1,g=o==="~"?2:m>1?m:1;return!(Ut(p.slice(0,g),h.slice(0,g))!==0||Ut(p.slice(g),h.slice(g))===-1)};const Tl={"@mastodon/edit-media-attributes":">=4.1","@mastodon/list-exclusive":">=4.2","@gotosocial/list-exclusive":">=0.17","@mastodon/filtered-notifications":"~4.3 || >=4.3","@mastodon/fetch-multiple-statuses":"~4.3 || >=4.3","@mastodon/trending-link-posts":"~4.3 || >=4.3","@mastodon/grouped-notifications":"~4.3 || >=4.3"},Ro=/pixelfed/i,ot=/^(?!.*pixelfed).*$/i,wl=/pleroma/i,El=/akkoma/i;const mi={"@mastodon/lists":ot,"@mastodon/filters":ot,"@mastodon/mentions":ot,"@mastodon/trending-hashtags":ot,"@mastodon/trending-links":ot,"@mastodon/post-bookmark":ot,"@mastodon/post-edit":ot,"@mastodon/profile-edit":ot,"@mastodon/profile-private-note":ot,"@pixelfed/trending":Ro,"@pixelfed/home-include-reblogs":Ro,"@pixelfed/global-feed":Ro,"@pleroma/local-visibility-post":wl,"@akkoma/local-visibility-post":El},Wn={};function Zn(e){var t,n;try{let{version:o,domain:i}=Pa(),s=((n=(t=La())==null?void 0:t.software)==null?void 0:n.name)||"mastodon";s==="hometown"&&(s="mastodon");const a=`${i}-${e}`;if(Wn[a])return Wn[a];if(mi[e])return Wn[a]=mi[e].test(o);const c=Tl[e];if(!c)return!1;const u=e.match(/^@([a-z]+)\//)[1]===s.toLowerCase();return Wn[a]=u&&no(o,c,{includePrerelease:!0,loose:!0})}catch{return!1}}const Wt=2147483647,Ye=36,Ir=1,xn=26,xl=38,Sl=700,Ts=72,ws=128,Es="-",kl=/^xn--/,Il=/[^\0-\x7F]/,Al=/[\x2E\u3002\uFF0E\uFF61]/g,Cl={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Oo=Ye-Ir,Xe=Math.floor,Do=String.fromCharCode;function ht(e){throw new RangeError(Cl[e])}function Pl(e,t){const n=[];let o=e.length;for(;o--;)n[o]=t(e[o]);return n}function xs(e,t){const n=e.split("@");let o="";n.length>1&&(o=n[0]+"@",e=n[1]),e=e.replace(Al,".");const i=e.split("."),s=Pl(i,t).join(".");return o+s}function Ss(e){const t=[];let n=0;const o=e.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...e),Ml=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:Ye},gi=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},ks=function(e,t,n){let o=0;for(e=n?Xe(e/Sl):e>>1,e+=Xe(e/t);e>Oo*xn>>1;o+=Ye)e=Xe(e/Oo);return Xe(o+(Oo+1)*e/(e+xl))},Is=function(e){const t=[],n=e.length;let o=0,i=ws,s=Ts,a=e.lastIndexOf(Es);a<0&&(a=0);for(let c=0;c=128&&ht("not-basic"),t.push(e.charCodeAt(c));for(let c=a>0?a+1:0;c=n&&ht("invalid-input");const p=Ml(e.charCodeAt(c++));p>=Ye&&ht("invalid-input"),p>Xe((Wt-o)/d)&&ht("overflow"),o+=p*d;const h=f<=s?Ir:f>=s+xn?xn:f-s;if(pXe(Wt/m)&&ht("overflow"),d*=m}const u=t.length+1;s=ks(o-l,u,l==0),Xe(o/u)>Wt-i&&ht("overflow"),i+=Xe(o/u),o%=u,t.splice(o++,0,i)}return String.fromCodePoint(...t)},As=function(e){const t=[];e=Ss(e);const n=e.length;let o=ws,i=0,s=Ts;for(const l of e)l<128&&t.push(Do(l));const a=t.length;let c=a;for(a&&t.push(Es);c=o&&dXe((Wt-i)/u)&&ht("overflow"),i+=(l-o)*u,o=l;for(const d of e)if(dWt&&ht("overflow"),d===o){let f=i;for(let p=Ye;;p+=Ye){const h=p<=s?Ir:p>=s+xn?xn:p-s;if(f{const{shortcode:o,staticUrl:i,url:s}=n;e=e.replace(new RegExp(`:${o}:`,"g"),`:${o}:`)}),e):""}const Ft=document.createElement("div"),Dl=["u-url","mention","hashtag"],$l=/[&<>]/g;function $o(e){return e.replace($l,t=>({"&":"&","<":"<",">":">"})[t])}const Nl=/{}}=t;let s=e;const a=ql(s,o),c=Nl.test(s),l=s.includes("```");if(c){const d=a.querySelectorAll('a:not([target="_blank"])');for(const p of d)p.setAttribute("target","_blank");const f=a.querySelectorAll("a[class]");for(const p of f)for(const h of p.classList)Dl.includes(h)||p.classList.remove(h)}if(c){const d=a.querySelectorAll("a[href]");for(const f of d)Fl.test(f.textContent.trim())&&(f.classList.add("has-url-text"),eu(f))}if(c){const d=a.querySelectorAll("a[href]"),f=[];for(const p of d){const h=p.innerText.trim(),m=p.querySelector("*");if(zl.test(h)){const[g,_,T]=h.split("@");m||(!f.some(([y])=>y===_)||f.some(([y,w])=>y===_&&w===T)?(p.innerHTML=`@${_}`,f.push([_,T])):p.innerHTML=`@${_}@${T}`),p.classList.add("mention")}Vl.test(h)&&(m||(p.innerHTML=`#${h.slice(1)}`),p.classList.add("mention","hashtag"))}}let u;if(s.includes(":")&&(n!=null&&n.length)){u=Fo(a);for(const d of u){let f=$o(d.nodeValue);f=sr(f,n),Ft.innerHTML=f,d.replaceWith(...Ft.childNodes)}}if(l){const d=[...a.querySelectorAll("p")].filter(f=>Hl.test(f.innerText.trim()));for(const f of d){const p=document.createElement("pre");for(const h of f.querySelectorAll("br"))h.replaceWith(` +`);p.innerHTML=`${f.innerHTML.trim()}`,f.replaceWith(p)}}if(l){const f=[...a.querySelectorAll("p")].filter(p=>Bl.test(p.innerText));for(const p of f){const h=[p];let m=!1,g=p;for(;g.nextElementSibling;){const _=g.nextElementSibling;if(_&&_.tagName==="P")if(Ul.test(_.innerText)){h.push(_),m=!0;break}else h.push(_);else break;g=_}if(m){const _=document.createElement("pre");for(const y of h)for(const w of y.querySelectorAll("br"))w.replaceWith(` +`);const T=h.map(y=>y.innerHTML).join(` + +`);_.innerHTML=`${T}`,p.replaceWith(_);for(const y of h)y.remove()}}}if(s.includes("`")){u=Fo(a);for(const d of u){let f=$o(d.nodeValue);jl.test(f)&&(f=f.replaceAll(Gl,"$1")),Ft.innerHTML=f,d.replaceWith(...Ft.childNodes)}}if(Kl.test(s)){u=Fo(a,{rejectFilter:["A"]});for(const d of u){let f=$o(d.nodeValue);Wl.test(f)&&(f=f.replaceAll(Zl,'$1')),Ft.innerHTML=f,d.replaceWith(...Ft.childNodes)}}if(s.includes("#")){let d=null;const f=[...a.querySelectorAll("p")].filter((p,h)=>{let m=0;for(let g=0;g3||m>1&&d&&h===d+1)return d=h,!0});if(f!=null&&f.length)for(const p of f)p.classList.add("hashtag-stuffing"),p.title=p.innerText}if(s.includes("i(a)),o?a:a.innerHTML}const Ps=Oe(Yl),Xl=["STYLE","IMG","VIDEO","AUDIO","AREA","MAP","TRACK","EMBED","IFRAME","OBJECT","PICTURE","PORTAL","SOURCE","SVG","MATH","CANVAS","NOSCRIPT","SCRIPT","INPUT","OPTION","TEXTAREA","SLOT","TEMPLATE"],Ql=Object.fromEntries(Xl.map(e=>[e,!0])),Jl=/^(https?:\/\/(www\.)?|xmpp:)/,No=30;function eu(e){var t;if(!(!e||(t=e.querySelector)!=null&&t.call(e,"*")))try{const n=e.innerText.trim(),o=(n.match(Jl)||[])[0]||"";if(!o)return;const i=n.slice(o.length,o.length+No),s=n.slice(o.length+No),a=n.slice(o.length).length>No;e.innerHTML=`${i}`}catch{}}function Fo(e,t={}){var a;const n=[],o=Object.assign({},Ql,(a=t.rejectFilter)==null?void 0:a.reduce((c,l)=>(c[l]=!0,c),{})),i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(c){return o[c.parentNode.nodeName]?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}},!1);let s;for(;s=i.nextNode();)n.push(s);return n}const zt=document.createElement("div");function tu(e,t){if(!e)return"";const{preProcess:n}=t||{};return zt.innerHTML=e.replace(/<\/p>/g,`

    + +`).replace(/<\/li>/g,` +`),zt.querySelectorAll("br").forEach(o=>{o.replaceWith(` +`)}),n==null||n(zt),zt.querySelectorAll(".invisible").forEach(o=>{o.remove()}),zt.querySelectorAll(".ellipsis").forEach(o=>{o.append("...")}),zt.innerText.replace(/[\r\n]{3,}/g,` + +`).trim()}const _o=Oe(tu);function nu(e){const{mentions:t=[],instance:n,previewMode:o,statusURL:i}=e||{};return s=>{var d,f;let{target:a}=s;if(a=a.closest("a"),!a||s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.which===2)return;const c=(d=a.previousSibling)==null?void 0:d.textContent,l=c==null?void 0:c.endsWith("@"),u=a.innerText.startsWith("@");if((a.classList.contains("u-url")||a.classList.contains("mention"))&&u||l&&!u){const p=(a.querySelector("span")||a).innerText.trim(),h=p.replace(/^@/,""),m=a.getAttribute("href"),g=t.find(_=>_.url===m)||t.find(_=>_.acct===h||_.username===h);if(g)s.preventDefault(),s.stopPropagation(),B.showAccount={account:g.acct,instance:n};else if(!/^http/i.test(p)){s.preventDefault(),s.stopPropagation();const _=a.getAttribute("href");B.showAccount={account:_,instance:n}}}else if(!o){const p=c==null?void 0:c.endsWith("#");if(a.classList.contains("hashtag")||p){s.preventDefault(),s.stopPropagation();const h=a.innerText.replace(/^#/,"").trim(),m=n?`#/${n}/t/${h}`:`#/t/${h}`;location.hash=m}else(f=B.unfurledLinks[a.href])!=null&&f.url&&i!==a.href&&(s.preventDefault(),s.stopPropagation(),B.prevLocation={pathname:location.hash.replace(/^#/,"")},location.hash=`#${B.unfurledLinks[a.href].url}`)}}}function Xf(e,t){return()=>S.number(e,{style:"unit",unit:t,unitDisplay:"long"})}const ou=Oe(()=>new Intl.DateTimeFormat().resolvedOptions().locale),ru=e=>{const{locale:t,dateYear:n,hideTime:o,formatOpts:i,forceOpts:s}=e||{},a=t.replace(/-[a-z]+$/i,""),c=bn([a],[ou],t),l=new Date().getFullYear(),u=s||{year:n===l?void 0:"numeric",month:"short",day:"numeric",hour:o?void 0:"numeric",minute:o?void 0:"numeric",...i};try{return Intl.DateTimeFormat(c,u)}catch{}try{return Intl.DateTimeFormat(t,u)}catch{}return Intl.DateTimeFormat(void 0,u)},iu=Oe(ru);function Sn(e,t){return e instanceof Date||(e=new Date(e)),iu({dateYear:e.getFullYear(),locale:S.locale,...t}).format(e)}function rt(e){try{return S.number(e,{notation:"compact",roundingMode:"floor"})}catch{return e}}const vi=5e3;function Gn(e){if(e||(e=!0),B.showCompose){B.composerState.minimized?Re({duration:vi,text:S._({id:"/4fHR1"})}):Re({duration:vi,text:S._({id:"vvl08N"})});return}rc(),B.showCompose=e}function Qf({skeleton:e,account:t,avatarSize:n="xl",useAvatarStatic:o=!1,instance:i,external:s,internal:a,onClick:c,showActivity:l=!1,showStats:u=!1,accountInstance:d,hideDisplayName:f=!1,relationship:p={},excludeRelationshipAttrs:h=[]}){if(e)return r("div",{class:"account-block skeleton",children:[r(st,{size:n}),r("span",{children:[r("b",{children:"████████"}),r("br",{}),r("span",{class:"account-block-acct",children:"██████"})]})]});if(!t)return null;const{id:m,acct:g,avatar:_,avatarStatic:T,displayName:y,username:w,emojis:E,url:x,statusesCount:b,lastStatusAt:k,bot:D,fields:L,note:A,group:C,followersCount:R,createdAt:W,locked:U}=t;let[oe,Q,re]=g.match(/([^@]+)(@.+)/i)||[,g];d&&(re=`@${d}`);const q=L==null?void 0:L.find(se=>!!se.verifiedAt&&!!se.value),ie={};for(const se in p)h.includes(se)||(ie[se]=p[se]);const ce=ie.following||ie.followedBy||ie.requested;return r("a",{class:"account-block",href:x,target:s?"_blank":null,title:re?g:`@${g}`,onClick:se=>{if(!s){if(se.preventDefault(),c)return c(se);a?location.hash=`/${i}/a/${m}`:B.showAccount={account:t,instance:i}}},children:[r("div",{class:"avatar-container",children:r(st,{url:o?T:_||T,size:n,squircle:D})}),r("span",{class:"account-block-content",children:[!f&&r(F,{children:y?r("b",{children:r(qt,{text:y,emojis:E})}):r("b",{children:w})})," ",r("span",{class:"account-block-acct bidi-isolate",children:[re?"":"@",Q,r("wbr",{}),re,U&&r(F,{children:[" ",r(M,{icon:"lock",size:"s",alt:S._({id:"G2fuEb"})})]})]}),l&&r("div",{class:"account-block-stats",children:[r(O,{id:"ajzDof",values:{0:rt(b)}}),!!k&&r(F,{children:[" ","·"," ",r(O,{id:"f8bJ3C",values:{0:Sn(k,{hideTime:!0})}})]})]}),u&&r("div",{class:"account-block-stats",children:[D&&r(F,{children:r("span",{class:"tag collapsed",children:[r(M,{icon:"bot"})," ",r(O,{id:"9Vdq+j"})]})}),!!C&&r(F,{children:r("span",{class:"tag collapsed",children:[r(M,{icon:"group"})," ",r(O,{id:"L8fEEm"})]})}),ce&&r("div",{class:"shazam-container-horizontal",children:r("div",{class:"shazam-container-inner",children:ie.following&&ie.followedBy?r("span",{class:"tag minimal",children:r(O,{id:"7oRLbi"})}):ie.requested?r("span",{class:"tag minimal",children:r(O,{id:"Yx0Ud8"})}):ie.following?r("span",{class:"tag minimal",children:r(O,{id:"y6sq5j"})}):ie.followedBy?r("span",{class:"tag minimal",children:r(O,{id:"p3UO/y"})}):null})},p.id),!!R&&r("span",{class:"ib",children:r(O,{id:"Mn1E9C",values:{followersCount:R}})}),!!q&&r("span",{class:"verified-field",children:[r(M,{icon:"check-circle",size:"s",alt:S._({id:"QDEWii"})})," ",r("span",{dangerouslySetInnerHTML:{__html:Ps(q.value,{emojis:E})}})]}),!D&&!C&&!ce&&!R&&!q&&!!W&&r("span",{class:"created-at",children:r(O,{id:"PCcEFZ",values:{0:Sn(W,{hideTime:!0})},components:{0:r("time",{datetime:W})}})})]})]})]})}var Ls={};function Ze(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var su=Ze;Ze.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};Ze.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};Ze.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},n),this._options.unref&&this._timer.unref(),!0};Ze.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Ze.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};Ze.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};Ze.prototype.start=Ze.prototype.try;Ze.prototype.errors=function(){return this._errors};Ze.prototype.attempts=function(){return this._attempts};Ze.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,o=0;o=n&&(t=i,n=a)}return t};(function(e){var t=su;e.operation=function(n){var o=e.timeouts(n);return new t(o,{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(n){if(n instanceof Array)return[].concat(n);var o={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var i in n)o[i]=n[i];if(o.minTimeout>o.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var s=[],a=0;alu.call(e)==="[object Error]",du=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed"]);function fu(e){return e&&uu(e)&&e.name==="TypeError"&&typeof e.message=="string"?e.message==="Load failed"?e.stack===void 0:du.has(e.message):!1}class hu extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const _i=(e,t,n)=>{const o=n.retries-(t-1);return e.attemptNumber=t,e.retriesLeft=o,e};async function pu(e,t){return new Promise((n,o)=>{t={onFailedAttempt(){},retries:10,shouldRetry:()=>!0,...t};const i=cu.operation(t),s=()=>{var c;i.stop(),o((c=t.signal)==null?void 0:c.reason)};t.signal&&!t.signal.aborted&&t.signal.addEventListener("abort",s,{once:!0});const a=()=>{var c;(c=t.signal)==null||c.removeEventListener("abort",s),i.stop()};i.attempt(async c=>{try{const l=await e(c);a(),n(l)}catch(l){try{if(!(l instanceof Error))throw new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`);if(l instanceof hu)throw l.originalError;if(l instanceof TypeError&&!fu(l))throw l;if(_i(l,c,t),await t.shouldRetry(l)||(i.stop(),o(l)),await t.onFailedAttempt(l),!i.retry(l))throw i.mainError()}catch(u){_i(u,c,t),a(),o(u)}}})})}const mu=[{code:"auto",name:"Detect"},{code:"af",name:"Afrikaans"},{code:"sq",name:"Albanian"},{code:"am",name:"Amharic"},{code:"ar",name:"Arabic"},{code:"hy",name:"Armenian"},{code:"as",name:"Assamese"},{code:"ay",name:"Aymara"},{code:"az",name:"Azerbaijani"},{code:"bm",name:"Bambara"},{code:"eu",name:"Basque"},{code:"be",name:"Belarusian"},{code:"bn",name:"Bengali"},{code:"bho",name:"Bhojpuri"},{code:"bs",name:"Bosnian"},{code:"bg",name:"Bulgarian"},{code:"ca",name:"Catalan"},{code:"ceb",name:"Cebuano"},{code:"ny",name:"Chichewa"},{code:"zh",name:"Chinese"},{code:"co",name:"Corsican"},{code:"hr",name:"Croatian"},{code:"cs",name:"Czech"},{code:"da",name:"Danish"},{code:"dv",name:"Dhivehi"},{code:"doi",name:"Dogri"},{code:"nl",name:"Dutch"},{code:"en",name:"English"},{code:"eo",name:"Esperanto"},{code:"et",name:"Estonian"},{code:"ee",name:"Ewe"},{code:"tl",name:"Filipino"},{code:"fi",name:"Finnish"},{code:"fr",name:"French"},{code:"fy",name:"Frisian"},{code:"gl",name:"Galician"},{code:"ka",name:"Georgian"},{code:"de",name:"German"},{code:"el",name:"Greek"},{code:"gn",name:"Guarani"},{code:"gu",name:"Gujarati"},{code:"ht",name:"Haitian Creole"},{code:"ha",name:"Hausa"},{code:"haw",name:"Hawaiian"},{code:"iw",name:"Hebrew"},{code:"hi",name:"Hindi"},{code:"hmn",name:"Hmong"},{code:"hu",name:"Hungarian"},{code:"is",name:"Icelandic"},{code:"ig",name:"Igbo"},{code:"ilo",name:"Ilocano"},{code:"id",name:"Indonesian"},{code:"ga",name:"Irish"},{code:"it",name:"Italian"},{code:"ja",name:"Japanese"},{code:"jw",name:"Javanese"},{code:"kn",name:"Kannada"},{code:"kk",name:"Kazakh"},{code:"km",name:"Khmer"},{code:"rw",name:"Kinyarwanda"},{code:"gom",name:"Konkani"},{code:"ko",name:"Korean"},{code:"kri",name:"Krio"},{code:"ku",name:"Kurdish (Kurmanji)"},{code:"ckb",name:"Kurdish (Sorani)"},{code:"ky",name:"Kyrgyz"},{code:"lo",name:"Lao"},{code:"la",name:"Latin"},{code:"lv",name:"Latvian"},{code:"ln",name:"Lingala"},{code:"lt",name:"Lithuanian"},{code:"lg",name:"Luganda"},{code:"lb",name:"Luxembourgish"},{code:"mk",name:"Macedonian"},{code:"mai",name:"Maithili"},{code:"mg",name:"Malagasy"},{code:"ms",name:"Malay"},{code:"ml",name:"Malayalam"},{code:"mt",name:"Maltese"},{code:"mi",name:"Maori"},{code:"mr",name:"Marathi"},{code:"mni-Mtei",name:"Meiteilon (Manipuri)"},{code:"lus",name:"Mizo"},{code:"mn",name:"Mongolian"},{code:"my",name:"Myanmar (Burmese)"},{code:"ne",name:"Nepali"},{code:"no",name:"Norwegian"},{code:"or",name:"Odia (Oriya)"},{code:"om",name:"Oromo"},{code:"ps",name:"Pashto"},{code:"fa",name:"Persian"},{code:"pl",name:"Polish"},{code:"pt",name:"Portuguese"},{code:"pa",name:"Punjabi"},{code:"qu",name:"Quechua"},{code:"ro",name:"Romanian"},{code:"ru",name:"Russian"},{code:"sm",name:"Samoan"},{code:"sa",name:"Sanskrit"},{code:"gd",name:"Scots Gaelic"},{code:"nso",name:"Sepedi"},{code:"sr",name:"Serbian"},{code:"st",name:"Sesotho"},{code:"sn",name:"Shona"},{code:"sd",name:"Sindhi"},{code:"si",name:"Sinhala"},{code:"sk",name:"Slovak"},{code:"sl",name:"Slovenian"},{code:"so",name:"Somali"},{code:"es",name:"Spanish"},{code:"su",name:"Sundanese"},{code:"sw",name:"Swahili"},{code:"sv",name:"Swedish"},{code:"tg",name:"Tajik"},{code:"ta",name:"Tamil"},{code:"tt",name:"Tatar"},{code:"te",name:"Telugu"},{code:"th",name:"Thai"},{code:"ti",name:"Tigrinya"},{code:"ts",name:"Tsonga"},{code:"tr",name:"Turkish"},{code:"tk",name:"Turkmen"},{code:"ak",name:"Twi"},{code:"uk",name:"Ukrainian"},{code:"ur",name:"Urdu"},{code:"ug",name:"Uyghur"},{code:"uz",name:"Uzbek"},{code:"vi",name:"Vietnamese"},{code:"cy",name:"Welsh"},{code:"xh",name:"Xhosa"},{code:"yi",name:"Yiddish"},{code:"yo",name:"Yoruba"},{code:"zu",name:"Zulu"}];var gu=Object.defineProperty,vu=(e,t,n)=>t in e?gu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qn=(e,t,n)=>vu(e,typeof t!="symbol"?t+"":t,n),ar=new Map,Yn=new WeakMap,yi=0,_u=void 0;function yu(e){return e?(Yn.has(e)||(yi+=1,Yn.set(e,yi.toString())),Yn.get(e)):"0"}function bu(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?yu(e.root):e[t]}`).toString()}function Tu(e){const t=bu(e);let n=ar.get(t);if(!n){const o=new Map;let i;const s=new IntersectionObserver(a=>{a.forEach(c=>{var l;const u=c.isIntersecting&&i.some(d=>c.intersectionRatio>=d);e.trackVisibility&&typeof c.isVisible>"u"&&(c.isVisible=u),(l=o.get(c.target))==null||l.forEach(d=>{d(u,c)})})},e);i=s.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:s,elements:o},ar.set(t,n)}return n}function Ms(e,t,n={},o=_u){if(typeof window.IntersectionObserver>"u"&&o!==void 0){const l=e.getBoundingClientRect();return t(o,{isIntersecting:o,target:e,intersectionRatio:typeof n.threshold=="number"?n.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:i,observer:s,elements:a}=Tu(n),c=a.get(e)||[];return a.has(e)||a.set(e,c),c.push(t),s.observe(e),function(){c.splice(c.indexOf(t),1),c.length===0&&(a.delete(e),s.unobserve(e)),a.size===0&&(s.disconnect(),ar.delete(i))}}function wu(e){return typeof e.children!="function"}var Jf=class extends Zi{constructor(e){super(e),qn(this,"node",null),qn(this,"_unobserveCb",null),qn(this,"handleNode",t=>{this.node&&(this.unobserve(),!t&&!this.props.triggerOnce&&!this.props.skip&&this.setState({inView:!!this.props.initialInView,entry:void 0})),this.node=t||null,this.observeNode()}),qn(this,"handleChange",(t,n)=>{t&&this.props.triggerOnce&&this.unobserve(),wu(this.props)||this.setState({inView:t,entry:n}),this.props.onChange&&this.props.onChange(t,n)}),this.state={inView:!!e.initialInView,entry:void 0}}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(e){(e.rootMargin!==this.props.rootMargin||e.root!==this.props.root||e.threshold!==this.props.threshold||e.skip!==this.props.skip||e.trackVisibility!==this.props.trackVisibility||e.delay!==this.props.delay)&&(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:e,root:t,rootMargin:n,trackVisibility:o,delay:i,fallbackInView:s}=this.props;this._unobserveCb=Ms(this.node,this.handleChange,{threshold:e,root:t,rootMargin:n,trackVisibility:o,delay:i},s)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if(typeof e=="function"){const{inView:h,entry:m}=this.state;return e({inView:h,entry:m,ref:this.handleNode})}const{as:t,triggerOnce:n,threshold:o,root:i,rootMargin:s,onChange:a,skip:c,trackVisibility:l,delay:u,initialInView:d,fallbackInView:f,...p}=this.props;return Ma(t||"div",{ref:this.handleNode,...p},e)}};function Eu({threshold:e,delay:t,trackVisibility:n,rootMargin:o,root:i,triggerOnce:s,skip:a,initialInView:c,fallbackInView:l,onChange:u}={}){var d;const[f,p]=Z(null),h=$(),[m,g]=Z({inView:!!c,entry:void 0});h.current=u,ee(()=>{if(a||!f)return;let w;return w=Ms(f,(E,x)=>{g({inView:E,entry:x}),h.current&&h.current(E,x),x.isIntersecting&&s&&w&&(w(),w=void 0)},{root:i,rootMargin:o,threshold:e,trackVisibility:n,delay:t},l),()=>{w&&w()}},[Array.isArray(e)?e.toString():e,f,i,o,s,a,n,l,t]);const _=(d=m.entry)==null?void 0:d.target,T=$();!f&&_&&!s&&!a&&T.current!==_&&(T.current=_,g({inView:!!c,entry:void 0}));const y=[p,m.inView,m.entry];return y.ref=y[0],y.inView=y[1],y.entry=y[2],y}const bi=48,zo={};function Rs({id:e,children:t}){const n=$(),o=!!zo[e],[i,s]=Z(!1),[a,c]=Z(o||!1),{ref:l}=Eu({root:null,rootMargin:`-${bi}px 0px 0px 0px`,trackVisibility:!0,delay:1e3,onChange:u=>{u&&(s(!0),e&&(zo[e]=!0))},triggerOnce:!0,skip:a||i});return ee(()=>{if(!n.current)return;const u=n.current.getBoundingClientRect();u.bottom>bi&&(u.top{let i=gn[Vo];return fetch(`https://${i}/api/v1/${t}/${n}/${encodeURIComponent(e)}`).then(s=>{if(!s.ok)throw new Error(s.statusText);return s.json()}).then(s=>{var a;return{provider:"lingva",content:s.translation,detectedSourceLanguage:(a=s.info)==null?void 0:a.detectedSource,info:s.info}})},{retries:3,onFailedAttempt:i=>{Vo=(Vo+1)%gn.length}})}const Os=1e3*60*60,Ds=mo(ku,{maxAge:Os}),Iu=mo(Su(Ds),{maxAge:Os});function Au({forceTranslate:e,sourceLanguage:t,onTranslate:n,text:o="",mini:i,autoDetected:s}){const a=ys(!0),[c,l]=Z("default"),[u,d]=Z(null),[f,p]=Z(null),[h,m]=Z(null),g=$(),_=t?ln(t):null,T=ln(a),y=$("auto");n||(n=i?Iu:Ds);const w=async()=>{var E,x;l("loading");try{const{content:b,detectedSourceLanguage:k,provider:D,error:L,...A}=await n(o,y.current,a);if(b){if(k){const C=ln(k);m(C)}if(D==="lingva"){const C=(x=(E=A==null?void 0:A.info)==null?void 0:E.pronunciation)==null?void 0:x.query;C&&d(C)}p(b),l("default"),!i&&b.trim()!==o.trim()&&(g.current.open=!0,g.current.scrollIntoView({behavior:"smooth",block:"nearest"}))}else l("error")}catch{l("error")}};return ee(()=>{e&&w()},[e]),i?f&&f.trim()!==o.trim()&&h!==T?r(Rs,{children:r("div",{class:"status-translation-block-mini",children:[r(M,{icon:"translate",alt:S._({id:"zVJKbG",values:{sourceLangText:_}})}),r("output",{lang:a,dir:"auto",title:u||"",children:f})]})}):null:r("div",{class:"status-translation-block",onClick:E=>{E.preventDefault()},children:r("details",{ref:g,children:[r("summary",{children:r("button",{type:"button",onClick:async E=>{E.preventDefault(),E.stopPropagation(),g.current.open=!g.current.open,c!=="loading"&&(f||w())},children:[r(M,{icon:"translate"})," ",r("span",{children:c==="loading"?S._({id:"Zxkt/v"}):t&&_&&!h?s?S._({id:"R20Yf9",values:{sourceLangText:_}}):S._({id:"h8zDAI",values:{sourceLangText:_}}):S._({id:"pi8x/S"})})]})}),r("div",{class:"translated-block",children:[r("div",{class:"translation-info insignificant",children:[r("select",{class:"translated-source-select",disabled:c==="loading",onChange:E=>{y.current=E.target.value,w()},children:mu.map(E=>{const x=ln({code:E.code,fallback:E.name}),b=ln({code:E.code,locale:E.code}),k=x!==b;return r("option",{value:E.code,children:E.code==="auto"?S._({id:"Bze3gr",values:{0:h??"…"}}):k?`${b} - ${x}`:b})})})," ",r("span",{children:["→ ",T]}),r(qi,{abrupt:!0,hidden:c!=="loading"})]}),c==="error"?r("p",{class:"ui-state",children:r(O,{id:"m5LihO"})}):!!f&&r(F,{children:[r("output",{class:"translated-content",lang:a,dir:"auto",children:f}),!!u&&r("output",{class:"translated-pronunciation-content",tabIndex:-1,onClick:E=>{E.target.classList.toggle("expand")},children:u})]})]})]})})}const Cu=gn!=null&&gn.length?Au:()=>null;function ut(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function $s(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const o=ut(n);return(i,s)=>o.then(a=>s(a.transaction(t,i).objectStore(t)))}let Ho;function Pt(){return Ho||(Ho=$s("keyval-store","keyval")),Ho}function Pu(e,t=Pt()){return t("readonly",n=>ut(n.get(e)))}function Lu(e,t,n=Pt()){return n("readwrite",o=>(o.put(t,e),ut(o.transaction)))}function Mu(e,t=Pt()){return t("readonly",n=>Promise.all(e.map(o=>ut(n.get(o)))))}function Ru(e,t=Pt()){return t("readwrite",n=>(n.delete(e),ut(n.transaction)))}function Ou(e,t=Pt()){return t("readwrite",n=>(e.forEach(o=>n.delete(o)),ut(n.transaction)))}function Du(e=Pt()){return e("readwrite",t=>(t.clear(),ut(t.transaction)))}function $u(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},ut(e.transaction)}function Nu(e=Pt()){return e("readonly",t=>{if(t.getAllKeys)return ut(t.getAllKeys());const n=[];return $u(t,o=>n.push(o.key)).then(()=>n)})}function wi(e,t){const n=$s(e,t);return{set:(o,i)=>Lu(o,i,n),get:o=>Pu(o,n),getMany:o=>Mu(o,n),del:o=>Ru(o,n),delMany:o=>Ou(o,n),clear:()=>Du(n),keys:()=>Nu(n)}}const eh={drafts:wi("drafts-db","drafts-store"),catchup:wi("catchup-db","catchup-store")};async function th(e,t={}){if(!(e!=null&&e.length))return;const{masto:n}=so(),o=vr(),i=e.reduce((s,a)=>(!s.includes(a.id)&&!t[a.id]&&a.id!==o&&s.push(a.id),s),[]);if(!i.length)return null;try{return(await n.v1.accounts.relationships.fetch({id:i})).reduce((c,l)=>(c[l.id]=l,c),{})}catch{return null}}class Ke extends HTMLElement{constructor(){super(),this.isIframeLoaded=!1,this.setupDom()}static get observedAttributes(){return["videoid","playlistid"]}connectedCallback(){this.addEventListener("pointerover",Ke.warmConnections,{once:!0}),this.addEventListener("click",()=>this.addIframe())}get videoId(){return encodeURIComponent(this.getAttribute("videoid")||"")}set videoId(t){this.setAttribute("videoid",t)}get playlistId(){return encodeURIComponent(this.getAttribute("playlistid")||"")}set playlistId(t){this.setAttribute("playlistid",t)}get videoTitle(){return this.getAttribute("videotitle")||"Video"}set videoTitle(t){this.setAttribute("videotitle",t)}get videoPlay(){return this.getAttribute("videoPlay")||"Play"}set videoPlay(t){this.setAttribute("videoPlay",t)}get videoStartAt(){return this.getAttribute("videoStartAt")||"0"}get autoLoad(){return this.hasAttribute("autoload")}get noCookie(){return this.hasAttribute("nocookie")}get posterQuality(){return this.getAttribute("posterquality")||"hqdefault"}get posterLoading(){return this.getAttribute("posterloading")||"lazy"}get params(){return`start=${this.videoStartAt}&${this.getAttribute("params")}`}set params(t){this.setAttribute("params",t)}setupDom(){const t=this.attachShadow({mode:"open"});let n="";window.liteYouTubeNonce&&(n=`nonce="${window.liteYouTubeNonce}"`),t.innerHTML=` + +
    + + + + + + +
    + `,this.domRefFrame=t.querySelector("#frame"),this.domRefImg={fallback:t.querySelector("#fallbackPlaceholder"),webp:t.querySelector("#webpPlaceholder"),jpeg:t.querySelector("#jpegPlaceholder")},this.domRefPlayButton=t.querySelector("#playButton")}setupComponent(){this.initImagePlaceholder(),this.domRefPlayButton.setAttribute("aria-label",`${this.videoPlay}: ${this.videoTitle}`),this.setAttribute("title",`${this.videoPlay}: ${this.videoTitle}`),(this.autoLoad||this.isYouTubeShort())&&this.initIntersectionObserver()}attributeChangedCallback(t,n,o){switch(t){case"videoid":case"playlistid":case"videoTitle":case"videoPlay":{n!==o&&(this.setupComponent(),this.domRefFrame.classList.contains("activated")&&(this.domRefFrame.classList.remove("activated"),this.shadowRoot.querySelector("iframe").remove(),this.isIframeLoaded=!1));break}default:break}}addIframe(t=!1){if(!this.isIframeLoaded){let n=t?0:1;const o=this.noCookie?"-nocookie":"";let i;this.playlistId?i=`?listType=playlist&list=${this.playlistId}&`:i=`${this.videoId}?`,this.isYouTubeShort()&&(this.params=`loop=1&mute=1&modestbranding=1&playsinline=1&rel=0&enablejsapi=1&playlist=${this.videoId}`,n=1);const s=` +`;this.domRefFrame.insertAdjacentHTML("beforeend",s),this.domRefFrame.classList.add("activated"),this.isIframeLoaded=!0,this.attemptShortAutoPlay(),this.dispatchEvent(new CustomEvent("liteYoutubeIframeLoaded",{detail:{videoId:this.videoId},bubbles:!0,cancelable:!0}))}}initImagePlaceholder(){var o,i;const t=`https://i.ytimg.com/vi_webp/${this.videoId}/${this.posterQuality}.webp`,n=`https://i.ytimg.com/vi/${this.videoId}/${this.posterQuality}.jpg`;this.domRefImg.fallback.loading=this.posterLoading,this.domRefImg.webp.srcset=t,this.domRefImg.jpeg.srcset=n,this.domRefImg.fallback.src=n,this.domRefImg.fallback.setAttribute("aria-label",`${this.videoPlay}: ${this.videoTitle}`),(i=(o=this.domRefImg)==null?void 0:o.fallback)==null||i.setAttribute("alt",`${this.videoPlay}: ${this.videoTitle}`)}initIntersectionObserver(){const t={root:null,rootMargin:"0px",threshold:0};new IntersectionObserver((o,i)=>{o.forEach(s=>{s.isIntersecting&&!this.isIframeLoaded&&(Ke.warmConnections(),this.addIframe(!0),i.unobserve(this))})},t).observe(this)}attemptShortAutoPlay(){this.isYouTubeShort()&&setTimeout(()=>{var t,n;(n=(t=this.shadowRoot.querySelector("iframe"))==null?void 0:t.contentWindow)==null||n.postMessage('{"event":"command","func":"playVideo","args":""}',"*")},2e3)}isYouTubeShort(){return this.getAttribute("short")===""&&window.matchMedia("(max-width: 40em)").matches}static addPrefetch(t,n){const o=document.createElement("link");o.rel=t,o.href=n,o.crossOrigin="true",document.head.append(o)}static warmConnections(){Ke.isPreconnected||window.liteYouTubeIsPreconnected||(Ke.addPrefetch("preconnect","https://i.ytimg.com/"),Ke.addPrefetch("preconnect","https://s.ytimg.com"),Ke.addPrefetch("preconnect","https://www.youtube.com"),Ke.addPrefetch("preconnect","https://www.google.com"),Ke.addPrefetch("preconnect","https://googleads.g.doubleclick.net"),Ke.addPrefetch("preconnect","https://static.doubleclick.net"),Ke.isPreconnected=!0,window.liteYouTubeIsPreconnected=!0)}}Ke.isPreconnected=!1;customElements.define("lite-youtube",Ke);const Ns=new Uint8Array(128);for(let e=0;e<83;e++)Ns["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~".charCodeAt(e)]=e;const oo=(e,t,n)=>{let o=0;for(;te>10.31475?Fs(e/Vs+.052132,2.4):e/zs,Bo=e=>~~(e>1227e-8?Vs*Fs(e,.416666)-13.025:e*zs+1),vn=e=>(e<0?-1:1)*e*e,Ei=e=>{for(e+=kn/2;e>kn;)e-=Fu;const t=1.27323954*e-.405284735*vn(e);return .225*(vn(t)-t)+t};function Ar(e){const t=oo(e,2,6);return[t>>16,t>>8&255,t&255]}function Vu(e,t,n,o){const i=oo(e,0,1),s=i%9+1,a=~~(i/9)+1,c=s*a;let l=0,u=0,d=0,f=0,p=0,h=0,m=0,g=0,_=0,T=0,y=0,w=0;const E=(oo(e,1,2)+1)/13446*(o|1),x=new Float64Array(c*3),b=Ar(e);for(l=0;l<3;l++)x[l]=zu(b[l]);for(l=1;l{const n=t.char||" ",o=t.count||2;let i=0;const s=[];return e.reverse().reduce((a,c)=>{s.length&&i&&s[i]&&s[i]===c.substring(1,s[i].length+1)&&(s.splice(i,1),i--);const u=[`${n.repeat(i?i*o:0)}${c}`,...a];return c.substring(0,2)==="e.trim().replace(/(^(\s|\t)+|(( |\t)+)$)/gm,""),Uu=e=>{const t=Hs(e).split(` +`),n=[];let o="";for(let i=0;i")){n.push(`${o}${s.slice(0,-2)} />`),o="";continue}if(s.endsWith(">")){n.push(`${o}${s.startsWith(">")||s.startsWith("<")?"":" "}${s}`),o="";continue}o+=o.length?` ${s}`:s}return n};var ju={mergeAttributesWithElements:Uu,removeEmptyLines:Hs};const Ku=Bu,{mergeAttributesWithElements:Wu}=ju,Zu=(e,t={})=>{const n=Wu(e);return Ku(n,t)};var Gu=Zu;const qu=gr(Gu);var hn=(e=>(e.Mouse="mouse",e.Touch="touch",e.Pointer="pointer",e))(hn||{}),pn=(e=>(e.CancelledByMovement="cancelled-by-movement",e.CancelledByRelease="cancelled-by-release",e.CancelledOutsideElement="cancelled-outside-element",e))(pn||{});const Bs=()=>typeof window=="object"?(window==null?void 0:window.PointerEvent)??null:null,Yu=()=>typeof window=="object"?(window==null?void 0:window.TouchEvent)??null:null;function Us(e){const{nativeEvent:t}=e,n=Yu();return n&&t instanceof n||"touches"in e}function js(e){const t=Bs();return e.nativeEvent instanceof MouseEvent&&!(t&&e.nativeEvent instanceof t)}function Ks(e){const{nativeEvent:t}=e;if(!t)return!1;const n=Bs();return n&&t instanceof n||"pointerId"in t}function xi(e){return js(e)||Us(e)||Ks(e)}function Si(e){return Us(e)?{x:e.touches[0].pageX,y:e.touches[0].pageY}:js(e)||Ks(e)?{x:e.pageX,y:e.pageY}:null}function Xu(e){return{target:e.target,currentTarget:e.currentTarget,nativeEvent:e,persist:()=>{}}}function Ws(e,{threshold:t=400,captureEvent:n=!1,detect:o=hn.Pointer,cancelOnMovement:i=!1,cancelOutsideElement:s=!0,filterEvents:a,onStart:c,onMove:l,onFinish:u,onCancel:d}={}){const f=$(!1),p=$(!1),h=$(),m=$(),g=$(e),_=$(null),T=Me(x=>b=>{p.current||xi(b)&&(a!==void 0&&!a(b)||(n&&b.persist(),c==null||c(b,{context:x}),_.current=Si(b),p.current=!0,h.current=b.currentTarget,m.current=setTimeout(()=>{g.current&&(g.current(b,{context:x}),f.current=!0)},t)))},[n,a,c,t]),y=Me(x=>(b,k)=>{xi(b)&&p.current&&(_.current=null,n&&b.persist(),f.current?u==null||u(b,{context:x}):p.current&&(d==null||d(b,{context:x,reason:k??pn.CancelledByRelease})),f.current=!1,p.current=!1,m.current!==void 0&&clearTimeout(m.current))},[n,u,d]),w=Me(x=>b=>{if(l==null||l(b,{context:x}),i!==!1&&_.current){const k=Si(b);if(k){const D=i===!0?25:i,L={x:Math.abs(k.x-_.current.x),y:Math.abs(k.y-_.current.y)};(L.x>D||L.y>D)&&y(x)(b,pn.CancelledByMovement)}}},[y,i,l]),E=Me(x=>{if(e===null)return{};switch(o){case hn.Mouse:{const b={onMouseDown:T(x),onMouseMove:w(x),onMouseUp:y(x)};return s&&(b.onMouseLeave=k=>{y(x)(k,pn.CancelledOutsideElement)}),b}case hn.Touch:return{onTouchStart:T(x),onTouchMove:w(x),onTouchEnd:y(x)};case hn.Pointer:{const b={onPointerDown:T(x),onPointerMove:w(x),onPointerUp:y(x)};return s&&(b.onPointerLeave=k=>y(x)(k,pn.CancelledOutsideElement)),b}}},[e,y,s,o,w,T]);return ee(()=>{if(!window)return;function x(b){const k=Xu(b);y()(k)}return window.addEventListener("mouseup",x),window.addEventListener("touchend",x),window.addEventListener("pointerup",x),()=>{window.removeEventListener("mouseup",x),window.removeEventListener("touchend",x),window.removeEventListener("pointerup",x)}},[y]),ee(()=>()=>{m.current!==void 0&&clearTimeout(m.current)},[]),ee(()=>{g.current=e},[e]),E}function Qu({poll:e,lang:t,readOnly:n,refresh:o=()=>{},votePoll:i=()=>{}}){const[s,a]=Z("default"),{expired:c,expiresAt:l,id:u,multiple:d,options:f,ownVotes:p,voted:h,votersCount:m,votesCount:g,emojis:_}=e,T=!!l&&new Date(l),y=d?m:g;let w=0;y<=1e3?w=0:y<=1e4?w=1:y<=1e5&&(w=2);const[E,x]=Z(!1),b=f.every(k=>k.votesCount!==null);return r("div",{lang:t,dir:"auto",class:`poll ${n?"read-only":""} ${s==="loading"?"loading":""}`,children:[E&&b||h||c?r(F,{children:[r("div",{class:"poll-options",children:f.map((k,D)=>{const{title:L,votesCount:A}=k,C=y?A/y:0,R=C?C.toLocaleString(S.locale||void 0,{style:"percent",maximumFractionDigits:w}):"0%",W=A>0&&A===Math.max(...f.map(U=>U.votesCount));return r("div",{class:`poll-option poll-result ${W?"poll-option-leading":""}`,style:{"--percentage":`${C*100}%`},children:[r("div",{class:"poll-option-title",children:[r("span",{children:r(qt,{text:L,emojis:_})}),h&&p.includes(D)&&r(F,{children:[" ",r(M,{icon:"check-circle",alt:S._({id:"IeO7us"})})]})]}),r("div",{class:"poll-option-votes",title:S._({id:"+syLpm",values:{optionVotesCount:A}}),children:R})]},`${D}-${L}-${A}`)})}),!c&&!h&&r("button",{class:"poll-vote-button plain2",disabled:s==="loading",onClick:k=>{k.preventDefault(),x(!1)},children:[r(M,{icon:"arrow-left",size:"s"})," ",r(O,{id:"L96xSt"})]})]}):r("form",{onSubmit:async k=>{k.preventDefault();const D=k.target,L=new FormData(D),A=[];L.forEach((C,R)=>{R==="poll"&&A.push(C)}),A.length&&(a("loading"),await i(A),a("default"))},children:[r("div",{class:"poll-options",children:f.map((k,D)=>{const{title:L}=k;return r("div",{class:"poll-option",children:r("label",{class:"poll-label",children:[r("input",{type:d?"checkbox":"radio",name:"poll",value:D,disabled:s==="loading",readOnly:n}),r("span",{class:"poll-option-title",children:r(qt,{text:L,emojis:_})})]})})})}),!n&&r("button",{class:"poll-vote-button",type:"submit",disabled:s==="loading",children:r(O,{id:"lQXQKs"})})]}),r("p",{class:"poll-meta",children:[!c&&!n&&r("button",{type:"button",class:"plain small",disabled:s==="loading",onClick:k=>{k.preventDefault(),a("loading"),(async()=>(await o(),a("default")))()},title:S._({id:"lCF0wC"}),children:r(M,{icon:"refresh",alt:S._({id:"lCF0wC"})})}),!h&&!c&&!n&&b&&r("button",{type:"button",class:"plain small",disabled:s==="loading",onClick:k=>{k.preventDefault(),x(!E)},title:E?S._({id:"L96xSt"}):S._({id:"zCjei3"}),children:[r(M,{icon:E?"eye-open":"eye-close",alt:E?S._({id:"L96xSt"}):S._({id:"zCjei3"})})," "]}),!c&&!n&&" ",r(O,{id:"k7v0Rh",values:{0:rt(g),1:rt(g),votesCount:g},components:{0:r("span",{title:g}),1:r("span",{title:g})}}),!!m&&m!==g&&r(F,{children:[" ","•"," ",r(O,{id:"jf1i1L",values:{0:rt(m),1:rt(m),votersCount:m},components:{0:r("span",{title:m}),1:r("span",{title:m})}})]})," ","•"," ",c?T?r(O,{id:"5LwCCI",components:{0:r(at,{datetime:T})}}):S._({id:"237hSL"}):T?r(O,{id:"ooHDPY",components:{0:r(at,{datetime:T})}}):S._({id:"O2tNG0"})]})]})}const Zs=lt();function Ju(e,t){if(!(e!=null&&e.length))return!1;const n=e.filter(s=>{const{filter:a}=s,c=a.context.includes(t);return c?a.expiresAt?new Date(a.expiresAt)>new Date:c:!1});if(!n.length)return!1;if(n.some(s=>s.filter.filterAction==="hide"))return{action:"hide"};if(n.some(s=>s.filter.filterAction==="warn")){const s=n.map(a=>a.filter.title);return{action:"warn",titles:s,titlesStr:s.join(" • ")}}return!1}const Cr=Oe(Ju);function ed(e,t,n){var a;const{filtered:o}=e;if(!(o!=null&&o.length)||n&&((a=e.account)==null?void 0:a.id)===n)return!0;const s=Cr(o,t);return s?s.action!=="hide":!0}function nh(e,t){if(!(e!=null&&e.length))return[];if(!t)return e;const n=vr();return e.filter(o=>ed(o,t,n))}const Uo=document.createElement("div");function jo(e){return e?(Uo.innerHTML=e,Uo.querySelectorAll(".invisible").forEach(t=>{t.remove()}),Uo.innerText.length):0}const mn="speechSynthesis"in window;function ki(e,t){if(mn)try{speechSynthesis.speaking&&speechSynthesis.cancel();const n=new SpeechSynthesisUtterance(e);t&&(n.lang=t),speechSynthesis.speak(n)}catch(n){alert(n)}}function Gs(e){var a;const{spoilerText:t,content:n,poll:o,mediaAttachments:i}=e;let s="";return t!=null&&t.trim()?s+=t:s+=_o(n),s=s.trim(),(a=o==null?void 0:o.options)!=null&&a.length&&(s+=` + +📊: +${o.options.map(c=>`${o.multiple?"▪️":"•"} ${c.title}`).join(` +`)}`),i!=null&&i.length&&(s+=" "+i.map(c=>({image:"🖼️",gifv:"🎞️",video:"📹",audio:"🎵",unknown:""})[c.type]||"").join("")),s}function td(e,t,n){var o=this,i=$(null),s=$(0),a=$(null),c=$([]),l=$(),u=$(),d=$(e),f=$(!0);d.current=e;var p=typeof window<"u",h=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var m=!!(n=n||{}).leading,g=!("trailing"in n)||!!n.trailing,_="maxWait"in n,T="debounceOnServer"in n&&!!n.debounceOnServer,y=_?Math.max(+n.maxWait||0,t):null;ee(function(){return f.current=!0,function(){f.current=!1}},[]);var w=ae(function(){var E=function(A){var C=c.current,R=l.current;return c.current=l.current=null,s.current=A,u.current=d.current.apply(R,C)},x=function(A,C){h&&cancelAnimationFrame(a.current),a.current=h?requestAnimationFrame(A):setTimeout(A,C)},b=function(A){if(!f.current)return!1;var C=A-i.current;return!i.current||C>=t||C<0||_&&A-s.current>=y},k=function(A){return a.current=null,g&&c.current?E(A):(c.current=l.current=null,u.current)},D=function A(){var C=Date.now();if(b(C))return k(C);if(f.current){var R=t-(C-i.current),W=_?Math.min(R,y-(C-s.current)):R;x(A,W)}},L=function(){if(p||T){var A=Date.now(),C=b(A);if(c.current=[].slice.call(arguments),l.current=o,i.current=A,C){if(!a.current&&f.current)return s.current=i.current,x(D,t),m?E(i.current):u.current;if(_)return x(D,t),E(i.current)}return a.current||x(D,t),u.current}};return L.cancel=function(){a.current&&(h?cancelAnimationFrame(a.current):clearTimeout(a.current)),s.current=0,c.current=i.current=l.current=a.current=null},L.isPending=function(){return!!a.current},L.flush=function(){return a.current?k(Date.now()):u.current},L},[m,_,t,y,g,h,p,T]);return w}function nd(e,t,n){var o=n===void 0?{}:n,i=o.leading,s=o.trailing;return td(e,t,{maxWait:t,leading:i===void 0||i,trailing:s===void 0||s})}function od(e,t){var n=$(null),o=$(null);o.current=t;var i=$(null);ee(function(){s()});var s=Me(function(){var a=i.current,c=o.current,l=a||(c?c instanceof Element?c:c.current:null);n.current&&n.current.element===l&&n.current.subscriber===e||(n.current&&n.current.cleanup&&n.current.cleanup(),n.current={element:l,subscriber:e,cleanup:l?e(l):void 0})},[e]);return ee(function(){return function(){n.current&&n.current.cleanup&&(n.current.cleanup(),n.current=null)}},[]),Me(function(a){i.current=a,s()},[s])}function Ii(e,t,n){return e[t]?e[t][0]?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function rd(e){e===void 0&&(e={});var t=e.onResize,n=$(void 0);n.current=t;var o=e.round||Math.round,i=$(),s=Z({width:void 0,height:void 0}),a=s[0],c=s[1],l=$(!1);ee(function(){return l.current=!1,function(){l.current=!0}},[]);var u=$({width:void 0,height:void 0}),d=od(Me(function(f){return(!i.current||i.current.box!==e.box||i.current.round!==o)&&(i.current={box:e.box,round:o,instance:new ResizeObserver(function(p){var h=p[0],m=e.box==="border-box"?"borderBoxSize":e.box==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",g=Ii(h,m,"inlineSize"),_=Ii(h,m,"blockSize"),T=g?o(g):void 0,y=_?o(_):void 0;if(u.current.width!==T||u.current.height!==y){var w={width:T,height:y};u.current.width=T,u.current.height=y,n.current?n.current(w):l.current||c(w)}})}),i.current.instance.observe(f,{box:e.box}),function(){i.current&&i.current.instance.unobserve(f)}},[e.box,o]),e.ref);return ae(function(){return{ref:d,width:a.width,height:a.height}},[d,a.width,a.height])}function ro({className:e="truncated"}={}){const t=$(),n=nd(({height:o})=>{if(t.current){const{scrollHeight:i}=t.current;let s=i>o;if(s){const{height:a,maxHeight:c}=getComputedStyle(t.current),l=parseInt(c||a,10);s=i>l}t.current.classList.toggle(e,s)}},300);return rd({ref:t,box:"border-box",onResize:n}),t}const _n={public:"earth",unlisted:"group",private:"lock",direct:"message",local:"building"};var qs="kvfysmfp",Ys="ufhsfnkm",id=".".concat(qs,"{overflow:hidden;touch-action:none}.").concat(Ys,"{transform-origin: 0 0}"),sd=typeof window>"u",ad=function(){return!sd&&("ontouchstart"in window||navigator.maxTouchPoints>0)};var cd=function(e){var t=e.x,n=e.y,o=e.scale;return"scale3d(".concat(o,",").concat(o,", 1) translate3d(").concat(t,"px, ").concat(n,"px, 0)")};var ld=Math.min,ud=Math.max;function Ai(e){var t=e.containerDimension,n=e.childDimension,o=e.padding,i=e.centerContained,s=n-t;return s+2*o<=0&&i?[s/2,s/2]:[ld(s+o,0)-o,ud(0,s+o)]}var Ci=function(e,t){return t?"".concat(e," ").concat(t):e},Xn=Math.abs,dd=Math.min,fd=Math.sqrt,Xs=typeof window>"u",hd=Xs?!1:/(Mac)/i.test(navigator.platform),Vt=function(e){return e==="drag"},un=function(e){return e==="zoom"},pd=function(e){return hd&&e.ctrlKey},dn=function(e){e.stopPropagation(),e.preventDefault()},Pi=function(e,t){var n=e.x-t.x,o=e.y-t.y;return fd(n*n+o*o)},md=function(e,t){var n=Pi(e[0],e[1]),o=Pi(t[0],t[1]);return o/n},gd=function(e,t){return e>t-.01&&et?t:n},bd=function(e){return!(e.ctrlKey||e.metaKey)},Td=function(e){if(e){var t=e.offsetWidth,n=e.offsetHeight;if(t&&n)return{width:t,height:n};var o=getComputedStyle(e),i=parseFloat(o.width),s=parseFloat(o.height);if(s&&i)return{width:i,height:s}}return{width:0,height:0}},wd=function(e,t){return{x:t.x-e.x,y:t.y-e.y}},Ed=function(e,t){return e.x===t.x&&e.y===t.y},kt=function(){},Jn={x:0,y:0},Mi=function(e){Ra(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n._prevDragMovePoint=null,n._containerObserver=null,n._fingers=0,n._firstMove=!0,n._initialOffset=Ne({},Jn),n._interaction=null,n._isDoubleTap=!1,n._isOffsetsSet=!1,n._lastDragPosition=null,n._lastScale=1,n._lastTouchStart=0,n._lastZoomCenter=null,n._listenMouseMove=!1,n._nthZoom=0,n._offset=Ne({},Jn),n._startOffset=Ne({},Jn),n._startTouches=null,n._updatePlaned=!1,n._wheelTimeOut=null,n._zoomFactor=1,n._initialZoomFactor=1,n._draggingPoint=Ne({},Jn),n._ignoreNextClick=!1,n._containerRef=Oa(),n._handleClick=function(o){n._ignoreNextClick&&(n._ignoreNextClick=!1,o.stopPropagation())},n._onResize=function(){var o;!((o=n._containerRef)===null||o===void 0)&&o.current&&(n._updateInitialZoomFactor(),n._setupOffsets(),n._update())},n._handlerOnTouchEnd=n._handlerIfEnable(function(o){n._fingers=o.touches.length,n.props.shouldCancelHandledTouchEndEvents&&(un(n._interaction)||Vt(n._interaction)&&(n._startOffset.x!==n._offset.x||n._startOffset.y!==n._offset.y))&&dn(o),Vt(n._interaction)&&!n._enoughToDrag()&&n._handleClick(o),n._updateInteraction(o)}),n._handlerOnTouchStart=n._handlerIfEnable(function(o){n._firstMove=!0,n._fingers=o.touches.length,n._detectDoubleTap(o)}),n._handlerOnTouchMove=n._handlerIfEnable(function(o){n._isDoubleTap||(n._collectInertia(o),n._firstMove?(n._updateInteraction(o),n._interaction&&dn(o),n._startOffset=Ne({},n._offset),n._startTouches=Qn(o.touches)):(un(n._interaction)?n._startTouches&&n._startTouches.length===2&&o.touches.length===2&&n._handleZoom(o,md(n._startTouches,Qn(o.touches))):Vt(n._interaction)&&n._handleDrag(o),n._interaction&&(dn(o),n._update())),n._firstMove=!1)}),n._handlerWheel=function(o){if(!n.props.shouldInterceptWheel(o)){dn(o);var i=o.pageX,s=o.pageY,a=o.deltaY,c=o.deltaMode,l=1;(pd(o)||c===1)&&(l=15);var u={touches:[{pageX:i,pageY:s}]},d=n._getOffsetByFirstTouch(u),f=a*l;n._stopAnimation(),n._scaleTo(n._zoomFactor-f/n.props.wheelScaleFactor,d),n._update(),clearTimeout(n._wheelTimeOut),n._wheelTimeOut=setTimeout(function(){return n._sanitize()},100)}},n._handlers=n.props.isTouch()?[["touchstart",n._handlerOnTouchStart],["touchend",n._handlerOnTouchEnd],["touchmove",n._handlerOnTouchMove]]:[["mousemove",n.simulate(n._handlerOnTouchMove),n.props._document],["mouseup",n.simulate(n._handlerOnTouchEnd),n.props._document],["mousedown",n.simulate(n._handlerOnTouchStart)],["click",n._handleClick],["wheel",n._handlerWheel]],n}return t.prototype._handleDragStart=function(n){this._ignoreNextClick=!0,this.props.onDragStart(),this._stopAnimation(),this._resetInertia(),this._lastDragPosition=null,this._hasInteraction=!0,this._draggingPoint=this._offset,this._handleDrag(n)},t.prototype._handleDrag=function(n){var o=this._getOffsetByFirstTouch(n);this._enoughToDrag()?this._drag(o,this._lastDragPosition):this._virtualDrag(o,this._lastDragPosition),this._offset=this._sanitizeOffset(this._offset),this._lastDragPosition=o},t.prototype._resetInertia=function(){this._velocity=null,this._prevDragMovePoint=null},t.prototype._realizeInertia=function(){var n=this,o=this.props,i=o.inertiaFriction,s=o.inertia;if(!(!s||!this._velocity)){var a=this._velocity,c=a.x,l=a.y;if(c||l){this._stopAnimation(),this._resetInertia();var u=function(){if(c*=i,l*=i,!c&&!l)return n._stopAnimation();var d=Ne({},n._offset);if(n._addOffset({x:c,y:l}),n._offset=n._sanitizeOffset(n._offset),Ed(d,n._offset))return n._stopAnimation();n._update({isAnimation:!0})};this._animate(u,{duration:9999})}}},t.prototype._collectInertia=function(n){var o=n.touches;if(this.props.inertia){var i=Qn(o)[0],s=this._prevDragMovePoint;s&&(this._velocity=wd(i,s)),this._prevDragMovePoint=i}},t.prototype._handleDragEnd=function(){this.props.onDragEnd(),this._end(),this._realizeInertia()},t.prototype._handleZoomStart=function(){this.props.onZoomStart(),this._stopAnimation(),this._lastScale=1,this._nthZoom=0,this._lastZoomCenter=null,this._hasInteraction=!0},t.prototype._handleZoom=function(n,o){var i=yd(this._getOffsetTouches(n)),s=o/this._lastScale;this._lastScale=o,this._nthZoom+=1,this._nthZoom>3&&(this._scale(s,i),this._drag(i,this._lastZoomCenter),this.props.enforceBoundsDuringZoom&&(this._offset=this._sanitizeOffset(this._offset))),this._lastZoomCenter=i},t.prototype._handleZoomEnd=function(){this.props.onZoomEnd(),this._end()},t.prototype._handleDoubleTap=function(n){var o=this;if(!(this._hasInteraction||this.props.tapZoomFactor===0)){var i=this.props.doubleTapZoomOutOnMaxScale&&this._zoomFactor===this.props.maxZoom||this.props.doubleTapToggleZoom&&this._zoomFactor>1;this.props.onDoubleTap(),this._ignoreNextClick=!0;var s=this._zoomFactor+this.props.tapZoomFactor,a=this._zoomFactor,c=function(u){o._scaleTo(a+u*(s-a),l)},l=this._getOffsetByFirstTouch(n);this._isDoubleTap=!0,a>s&&(l=this._getCurrentZoomCenter()),i?this._zoomOutAnimation():this._animate(c)}},t.prototype._computeInitialOffset=function(){var n=this._getContainerRect(),o=this._getChildSize(),i=o.width,s=o.height,a=-Xn(i*this._getInitialZoomFactor()-n.width)/2,c=-Xn(s*this._getInitialZoomFactor()-n.height)/2;this._initialOffset={x:a,y:c}},t.prototype._resetOffset=function(){this._offset=Ne({},this._initialOffset)},t.prototype._setupOffsets=function(){this.props.setOffsetsOnce&&this._isOffsetsSet||(this._isOffsetsSet=!0,this._computeInitialOffset(),this._resetOffset())},t.prototype._sanitizeOffset=function(n){var o=this._getContainerRect(),i=this._getChildSize(),s=i.width,a=i.height,c=s*this._getInitialZoomFactor()*this._zoomFactor,l=a*this._getInitialZoomFactor()*this._zoomFactor,u=Ai({containerDimension:o.width,childDimension:c,padding:this.props.horizontalPadding,centerContained:this.props.centerContained}),d=u[0],f=u[1],p=Ai({containerDimension:o.height,childDimension:l,padding:this.props.verticalPadding,centerContained:this.props.centerContained}),h=p[0],m=p[1];return{x:Ko(d,f,n.x),y:Ko(h,m,n.y)}},t.prototype.alignCenter=function(n){var o=this,i=Ne({duration:250,animated:!0},n),s=i.x,a=i.y,c=i.scale,l=i.animated,u=i.duration,d=s*this._initialZoomFactor,f=a*this._initialZoomFactor,p=this._zoomFactor,h=Ne({},this._offset),m=this._getContainerRect(),g={x:m.width/2,y:m.height/2};if(this._zoomFactor=1,this._offset={x:-(g.x-d),y:-(g.y-f)},this._scaleTo(c,g),this._stopAnimation(),!l)return this._update();var _=this._zoomFactor-p,T={x:this._offset.x-h.x,y:this._offset.y-h.y};this._zoomFactor=p,this._offset=Ne({},h);var y=function(w){var E=h.x+T.x*w,x=h.y+T.y*w;o._zoomFactor=p+_*w,o._offset=o._sanitizeOffset({x:E,y:x}),o._update()};this._animate(y,{callback:function(){return o._sanitize()},duration:u})},t.prototype.scaleTo=function(n){var o=this,i=Ne({duration:250,animated:!0},n),s=i.x,a=i.y,c=i.scale,l=i.animated,u=i.duration,d=this._zoomFactor,f=Ne({},this._offset);if(this._zoomFactor=1,this._offset={x:0,y:0},this._scaleTo(c,{x:s,y:a}),this._stopAnimation(),!l)return this._update();var p=this._zoomFactor-d,h={x:this._offset.x-f.x,y:this._offset.y-f.y};this._zoomFactor=d,this._offset=Ne({},f);var m=function(g){var _=f.x+h.x*g,T=f.y+h.y*g;o._zoomFactor=d+p*g,o._offset={x:_,y:T},o._update()};this._animate(m,{callback:function(){return o._sanitize()},duration:u})},t.prototype._scaleTo=function(n,o){this._scale(n/this._zoomFactor,o),this._offset=this._sanitizeOffset(this._offset)},t.prototype._scale=function(n,o){n=this._scaleZoomFactor(n),this._addOffset({x:(n-1)*(o.x+this._offset.x),y:(n-1)*(o.y+this._offset.y)}),this.props.onZoomUpdate()},t.prototype._scaleZoomFactor=function(n){var o=this._zoomFactor;return this._zoomFactor*=n,this._zoomFactor=Ko(this.props.minZoom,this.props.maxZoom,this._zoomFactor),this._zoomFactor/o},t.prototype._canDrag=function(){return this.props.draggableUnZoomed||!gd(this._zoomFactor,1)},t.prototype._drag=function(n,o){if(o){var i=-(n.y-o.y),s=-(n.x-o.x);this.props.lockDragAxis?Xn(s)>Xn(i)?this._addOffset({x:s,y:0}):this._addOffset({y:i,x:0}):this._addOffset({x:s,y:i}),this.props.onDragUpdate()}},t.prototype._virtualDrag=function(n,o){if(o){var i=-(n.y-o.y),s=-(n.x-o.x);this._draggingPoint={x:s+this._draggingPoint.x,y:i+this._draggingPoint.y}}},t.prototype._addOffset=function(n){var o=this._offset,i=o.x,s=o.y;this._offset={x:i+n.x,y:s+n.y}},t.prototype._sanitize=function(){this._zoomFactor=u?(n(1),i._stopAnimation(),l(),i._update()):(p=c(p),n(p),i._update({isAnimation:!0}),requestAnimationFrame(d))}};this._inAnimation=!0,requestAnimationFrame(d)},t.prototype._stopAnimation=function(){this._inAnimation=!1},t.prototype._end=function(){this._hasInteraction=!1,this._sanitize(),this._update()},t.prototype._getContainerRect=function(){var n=this._containerRef.current;return n.getBoundingClientRect()},t.prototype._getChildSize=function(){var n=this._containerRef.current;return Td(n==null?void 0:n.firstElementChild)},t.prototype._updateInitialZoomFactor=function(){var n=this._getContainerRect(),o=this._getChildSize(),i=n.width/o.width,s=n.height/o.height;this._initialZoomFactor=dd(i,s)},t.prototype._bindEvents=function(){var n=this,o=this._containerRef.current;window.ResizeObserver?(this._containerObserver=new ResizeObserver(this._onResize),this._containerObserver.observe(o)):window.addEventListener("resize",this._onResize),this._handlers.forEach(function(i){var s=i[0],a=i[1],c=i[2];(c||o).addEventListener(s,a,!0)}),Array.from(o.querySelectorAll("img")).forEach(function(i){return i.addEventListener("load",n._onResize)})},t.prototype._unSubscribe=function(){var n=this,o=this._containerRef.current;this._containerObserver&&(this._containerObserver.disconnect(),this._containerObserver=null),window.removeEventListener("resize",this._onResize),this._handlers.forEach(function(i){var s=i[0],a=i[1],c=i[2];(c||o).removeEventListener(s,a,!0)}),Array.from(o.querySelectorAll("img")).forEach(function(i){return i.removeEventListener("load",n._onResize)})},t.prototype._update=function(n){var o=this;if(!this._updatePlaned){var i=function(){var s=o._getInitialZoomFactor()*o._zoomFactor,a=-o._offset.x/s,c=-o._offset.y/s;o.props.onUpdate({scale:s,x:a,y:c})};if(n!=null&&n.isAnimation)return i();this._updatePlaned=!0,requestAnimationFrame(function(){o._updatePlaned=!1,i()})}},t.prototype._handlerIfEnable=function(n){var o=this;return function(){for(var i=[],s=0;so?n-o:o-n},t.prototype._enoughToDrag=function(){return this._distanceBetweenNumbers(this._startOffset.x,this._draggingPoint.x)>5||this._distanceBetweenNumbers(this._startOffset.y,this._draggingPoint.y)>5},t.prototype._updateInteraction=function(n){var o=this._fingers;if(o===2)return this._setInteraction("zoom",n);if(o===1&&this._canDrag())return this._setInteraction("drag",n);this._setInteraction(null,n)},t.prototype._detectDoubleTap=function(n){var o=new Date().getTime();this._fingers>1&&(this._lastTouchStart=0),o-this._lastTouchStart<300?(dn(n),this._handleDoubleTap(n),un(this._interaction)?this._handleZoomEnd():Vt(this._interaction)&&this._handleDragEnd()):this._isDoubleTap=!1,this._fingers===1&&(this._lastTouchStart=o)},t.prototype.simulate=function(n){var o=this;return function(i){var s=i.pageX,a=i.pageY,c=i.type,l=c==="mouseup",u=c==="mousedown";u&&(i.preventDefault(),o._listenMouseMove=!0),o._listenMouseMove&&(i.touches=l?[]:[{pageX:s,pageY:a}],n(i)),l&&(o._listenMouseMove=!1)}},t.prototype.componentDidMount=function(){this._bindEvents(),this._update()},t.prototype.componentWillUnmount=function(){this._stopAnimation(),this._unSubscribe()},t.prototype.render=function(){var n=this.props,o=n.children,i=n.containerProps,s=Da.only(o),a=i||{};return Un.createElement(Un.Fragment,null,Un.createElement("style",null,id),Un.createElement("div",Ne({},a,{ref:this._containerRef,className:Ci(qs,a.className)}),Ki(s,{className:Ci(Ys,s.props.className)})))},t.defaultProps={animationDuration:250,draggableUnZoomed:!0,enforceBoundsDuringZoom:!1,centerContained:!1,enabled:!0,inertia:!0,inertiaFriction:.96,horizontalPadding:0,isTouch:ad,lockDragAxis:!1,maxZoom:5,minZoom:.5,onDoubleTap:kt,onDragEnd:kt,onDragStart:kt,onDragUpdate:kt,onZoomEnd:kt,onZoomStart:kt,onZoomUpdate:kt,setOffsetsOnce:!1,shouldInterceptWheel:bd,shouldCancelHandledTouchEndEvents:!1,tapZoomFactor:1,verticalPadding:0,wheelScaleFactor:1500,zoomOutFactor:1.3,doubleTapZoomOutOnMaxScale:!1,doubleTapToggleZoom:!1,_document:Xs?null:window.document},t}(Zi);if(0)var oh,rh,ih,sh,ah,ch,lh;function Wo(e){if(!e)return;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),o=Math.round(e%60);return t===0?`${n}:${o.toString().padStart(2,"0")}`:`${t}:${n.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`}const xd=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),Sd="ALT",Zo=e=>{const{alt:t,lang:n,index:o,...i}=e;return!t||!t.trim()?null:r("button",{type:"button",class:"alt-badge clickable",...i,onClick:s=>{s.stopPropagation(),s.preventDefault(),B.showMediaAlt={alt:t,lang:n}},title:S._({id:"5gfDMm"}),children:[Sd,!!o&&r("sup",{children:o})]})},kd=140,Id=280,Qs=Oe(e=>e!=null&&e.length?e.length>kd||/[\n\r].*[\n\r]/.test(e.trim()):!1);function Ad({class:e="",media:t,to:n,lang:o,showOriginal:i,autoAnimate:s,showCaption:a,allowLongerCaption:c,altIndex:l,checkAspectRatio:u=!0,onClick:d=()=>{}}){let{blurhash:f,description:p,meta:h,previewRemoteUrl:m,previewUrl:g,remoteUrl:_,url:T,type:y}=t;/no\-preview\./i.test(g)&&(g=null);const{original:w={},small:E,focus:x}=h||{},b=i?w==null?void 0:w.width:(E==null?void 0:E.width)||(w==null?void 0:w.width),k=i?w==null?void 0:w.height:(E==null?void 0:E.height)||(w==null?void 0:w.height),D=i?T:g||T,L=i?_:m||_,A=b&&k,C=A?b>k?"landscape":"portrait":null,R=f?Ar(f):null,W=$();let U;if(x){const V=(x.x+1)/2*100,le=(1-x.y)/2*100;U=`${V.toFixed(0)}% ${le.toFixed(0)}%`}const oe=$(),Q=Me(({x:V,y:le,scale:z})=>{const{current:J}=oe;if(J){const Y=cd({x:V,y:le,scale:z});z===1?J.style.removeProperty("transform"):J.style.setProperty("transform",Y),J.closest(".media-zoom").style.touchAction=z<=1.01?"pan-x":""}},[]),[re,q]=Z(!1),ie={enabled:re,draggableUnZoomed:!1,inertiaFriction:.9,tapZoomFactor:2,doubleTapToggleZoom:!0,containerProps:{className:"media-zoom",style:{overflow:"visible"}},onUpdate:Q},ce=ae(()=>n?V=>r(Gt,{to:n,...V}):"div",[n]),se=L?Cd(L):null,H=y==="unknown"&&se&&/\.(mp4|m4r|m4v|mov|webm)$/i.test(se.pathname),fe=y==="unknown"&&se&&/\.(mp3|ogg|wav|m4a|m4p|m4b)$/i.test(se.pathname),ne=y==="image"||y==="unknown"&&g&&!H&&!fe,Ee=$(),[ye,xe]=Z(!1);Zt(()=>{if(!ne||!i||!Ee.current)return;const{offsetWidth:V,offsetHeight:le}=Ee.current,z=b{const{children:le,...z}=V;return r("figure",{...z,children:[le,r("figcaption",{class:"media-caption",lang:o,dir:"auto",onClick:J=>{J.preventDefault(),J.stopPropagation(),B.showMediaAlt={alt:p,lang:o}},children:p})]})}:F,[Ge,Lt]=Z(void 0);if(ne)return ie.containerProps.style.display="inherit",Zt(()=>{xd&&i&&(async()=>{try{await fetch(D,{mode:"no-cors"}),oe.current.src=D}catch{}})()},[D]),r(ge,{children:r(ce,{ref:Ee,class:`media media-image ${e}`,onClick:d,"data-orientation":C,"data-has-alt":!N||void 0,"data-has-natural-aspect-ratio":Ge||void 0,style:i?{backgroundImage:`url(${g})`,backgroundSize:ye?`${b}px ${k}px`:void 0,...$e}:Ce,children:i?r(Mi,{...ie,children:r("img",{ref:oe,src:D,alt:p,width:b,height:k,"data-orientation":C,loading:"eager",decoding:"sync",onLoad:V=>{V.target.closest(".media-image").style.backgroundImage="",V.target.closest(".media-zoom").style.display="",q(!0)},onError:V=>{const{src:le}=V.target;le===D&&L&&D!==L&&(V.target.src=L)}})}):r(F,{children:[r("img",{src:D,alt:N?"":p,width:b,height:k,"data-orientation":C,loading:"lazy",style:{objectPosition:U||"center","--anim-duration":`${Math.min(Math.max(Math.max(b,k)/100,5),120)}s`},onLoad:V=>{V.target.dataset.loaded=!0;const le=V.target.closest(".media");if(!A&&le){const{naturalWidth:z,naturalHeight:J}=V.target;le.dataset.orientation=z>J?"landscape":"portrait",le.style.setProperty("--width",`${z}px`),le.style.setProperty("--height",`${J}px`),le.style.aspectRatio=`${z}/${J}`}if(u&&le){const{clientWidth:z,clientHeight:J,naturalWidth:Y,naturalHeight:be}=V.target;if(z&&J&&Y&&be)if(Y<88||be<88)le.dataset.hasSmallDimension=!0;else{const pe=be*z/Y;Math.abs(pe-J)<5&&Lt(!0)}}},onError:V=>{const{src:le}=V.target;le===D&&D!==L&&(V.target.src=L)}}),!N&&r(Zo,{alt:p,lang:o,index:l})]})})});if(y==="gifv"||y==="video"||H){const V=w.duration>0,le=w.duration<31,z=y==="gifv"&&le,J=w.duration<61,Y=Wo(w.duration),be=!i&&!s&&z,te=!i&&s&&z,pe=w.duration>5,Mt=` + + `,Be=` + + `;return r(ge,{children:r(ce,{class:`media ${e} media-${z?"gif":"video"} ${te?"media-contain":""} ${be?"media-hover-animate":""}`,"data-orientation":C,"data-formatted-duration":i?void 0:Y,"data-label":z&&!i&&!te?"GIF":void 0,"data-has-alt":!N||void 0,style:!i&&Ce,onClick:Ae=>{if(be)try{W.current.pause()}catch{}d(Ae)},onMouseEnter:()=>{if(be)try{W.current.play()}catch{}},onMouseLeave:()=>{if(be)try{W.current.pause()}catch{}},onFocus:()=>{if(be)try{W.current.play()}catch{}},onBlur:()=>{if(be)try{W.current.pause()}catch{}},children:[i||te?z&&i?r(Mi,{...ie,enabled:!0,children:r("div",{ref:oe,dangerouslySetInnerHTML:{__html:Mt}})}):z?r("div",{class:"video-container",dangerouslySetInnerHTML:{__html:Mt}}):r("div",{class:"video-container",dangerouslySetInnerHTML:{__html:Be}}):z?r("video",{ref:W,src:T,poster:g,width:b,height:k,"data-orientation":C,preload:"auto",playsinline:!0,loop:!0,muted:!0,onTimeUpdate:pe?Ae=>{const{target:Pe}=Ae,ve=Pe==null?void 0:Pe.closest(".media-gif");if(ve){const Le=Pe.currentTime/Pe.duration*100;ve.style.setProperty("--progress",`${Le}%`)}}:void 0}):r(F,{children:[g?r("img",{src:g,alt:N?"":p,width:b,height:k,"data-orientation":C,loading:"lazy",decoding:"async",onLoad:Ae=>{if(!A){const Pe=Ae.target.closest(".media");if(Pe){const{naturalHeight:ve,naturalWidth:Le}=Ae.target;Pe.dataset.orientation=Le>ve?"landscape":"portrait",Pe.style.setProperty("--width",`${Le}px`),Pe.style.setProperty("--height",`${ve}px`),Pe.style.aspectRatio=`${Le}/${ve}`}}}}):r("video",{src:T+"#t=0.1",width:b,height:k,"data-orientation":C,preload:"metadata",muted:!0,disablePictureInPicture:!0,onLoadedMetadata:Ae=>{if(!V){const{duration:Pe}=Ae.target;if(Pe){const ve=Wo(Pe),Le=Ae.target.closest(".media-video");Le&&(Le.dataset.formattedDuration=ve)}}}}),r("div",{class:"media-play",children:r(M,{icon:"play",size:"xl",alt:"▶"})})]}),!i&&!N&&r(Zo,{alt:p,lang:o,index:l})]})})}else if(y==="audio"||fe){const V=Wo(w.duration);return r(ge,{children:r(ce,{class:`media media-audio ${e}`,"data-formatted-duration":i?void 0:V,"data-has-alt":!N||void 0,onClick:d,style:!i&&Ce,children:[i?r("audio",{src:_||T,preload:"none",controls:!0,autoPlay:!0}):g?r("img",{src:g,alt:N?"":p,width:b,height:k,"data-orientation":C,loading:"lazy",onError:le=>{var z,J;try{(J=(z=le.target)==null?void 0:z.remove)==null||J.call(z)}catch{}}}):null,!i&&r(F,{children:[r("div",{class:"media-play",children:r(M,{icon:"play",size:"xl",alt:"▶"})}),!N&&r(Zo,{alt:p,lang:o,index:l})]})]})})}}function Cd(e){return URL.parse(e,location.origin)}const cr=Jt(Ad,(e,t)=>{const n=e.media||{},o=t.media||{};return(n==null?void 0:n.id)===(o==null?void 0:o.id)&&n.url===o.url&&e.to===t.to&&e.class===t.class}),Pd=280,Ld=140,Md=Gi({limit:1,interval:1e3});function Rd(e,t){return t.v1.accounts.$select(e).fetch()}const Od=mo(Md(Rd)),At={public:{id:"7d1a0d"},local:{id:"d5zxa4"},unlisted:{id:"WDcQq9"},private:{id:"o34OrG"},direct:{id:"IV4QaU"}},Dd=window.ontouchstart!==void 0&&/iPad|iPhone|iPod/.test(navigator.userAgent),$d=new Intl.RelativeTimeFormat,Ri=80;function Nd(e){var t;return(t=e==null?void 0:e.options)!=null&&t.length?`📊: +${e.options.map(n=>`- ${n.title}${n.votesCount>=0?` (${n.votesCount})`:""}`).join(` +`)}`:""}function Go(e){const{spoilerText:t,content:n,poll:o}=e;return(t?`${t} + +`:"")+_o(n)+Nd(o)}function Fd(e){return!e||(e=e.trim(),!e)?!1:!!_o(e,{preProcess:n=>{for(const o of n.querySelectorAll(".mention, pre, code, a:has(.invisible)"))o.remove()}})}function zd(e){return _o(e,{preProcess:t=>{for(const n of t.querySelectorAll(".mention, .hashtag, pre, code, a:has(.invisible)"))n.remove();for(const n of t.querySelectorAll("a")){const o=n.innerText.trim();(o.startsWith("https://")||o.startsWith("http://"))&&n.remove()}}})}const Vd=/^http/i,Oi=({post:e,instance:t,previewMode:n})=>{const{content:o,emojis:i,language:s,mentions:a,url:c}=e,l=$();return Zt(()=>{if(!l.current)return;const u=Ps(o,{emojis:i,returnDOM:!0});for(const d of u.querySelectorAll('a.u-url[target="_blank"]'))Vd.test(d.innerText.trim())||d.removeAttribute("target");l.current.replaceChildren(u.cloneNode(!0))},[o,i.length]),r("div",{ref:l,lang:s,dir:"auto",class:"inner-content",onClick:nu({mentions:a,instance:t,previewMode:n,statusURL:c})})},Hd={s:"small",m:"medium",l:"large"},Bd=mo(async e=>{const{detectAll:t}=await I(async()=>{const{detectAll:i}=await import("./tinyld-light-tbgyvj3S.js");return{detectAll:i}},[],import.meta.url);if(e=e==null?void 0:e.trim(),(e==null?void 0:e.length)>500)return null;const o=t(e)[0];return o!=null&&o.lang&&(o==null?void 0:o.accuracy)>.5?o.lang:null}),yn={id:"8fZueG"},lr={},Di=(e,t=[])=>{if(!e)return!1;const n=ys(!0),o=e!==n&&!bn([e],[n])&&!t.find(i=>e===i||bn([e],[i]));return lr[e+t]=!0,o};function Qt({statusID:e,status:t,instance:n,size:o="m",contentTextWeight:i,readOnly:s,enableCommentHint:a,withinContext:c,skeleton:l,enableTranslate:u,forceTranslate:d,previewMode:f,onMediaClick:p,quoted:h,onStatusLinkClick:m=()=>{},showFollowedTags:g,allowContextMenu:_,showActionsBar:T,showReplyParent:y,mediaFirst:w}){var qr,Yr,Xr,Qr;const{_:E}=po();if(l)return r("div",{class:`status skeleton ${w?"status-media-first small":""}`,children:[!w&&r(st,{size:"xxl"}),r("div",{class:"container",children:[r("div",{class:"meta",children:[(o==="s"||w)&&r(st,{size:"m"})," ███ ████████"]}),r("div",{class:"content-container",children:[w&&r("div",{class:"media-first-container"}),r("div",{class:`content ${w?"media-first-content":""}`,children:r("p",{children:"████ ████████"})})]})]})]});const{masto:x,instance:b,authenticated:k}=so({instance:n}),{instance:D}=so(),L=b===D;let A=it(e||(t==null?void 0:t.id),b);const C=In(B);if(t||(t=C.statuses[A]||C.statuses[e],A=it(t==null?void 0:t.id,b)),!t)return null;const{account:{acct:R,avatar:W,avatarStatic:U,id:oe,url:Q,displayName:re,username:q,emojis:ie,bot:ce,group:se},id:H,repliesCount:fe,reblogged:ne,reblogsCount:Ee,favourited:ye,favouritesCount:xe,bookmarked:De,poll:Ie,muted:$e,sensitive:Ce,spoilerText:he,visibility:N,language:ge,editedAt:Ge,filtered:Lt,card:V,createdAt:le,inReplyToId:z,inReplyToAccountId:J,content:Y,mentions:be,mediaAttachments:te,reblog:pe,uri:Mt,url:Be,emojis:Ae,tags:Pe,pinned:ve,_deleted:Le,_pinned:Cn,emojiReactions:dt}=t,[_t,yo]=Z(null);ee(()=>{if(!Y||ge||_t)return;let v;return v=setTimeout(async()=>{let P=await Bd(zd(Y));yo(P)},1e3),()=>clearTimeout(v)},[Y,ge]);const me=ge||_t,Rt=!!(te!=null&&te.length);w&&Rt&&(o="s");const yt=ae(()=>vr(),[]),tt=ae(()=>yt&&yt===oe,[oe,yt]),Pn=ze(Zs),X=!tt&&!s&&!f&&Cr(Lt,Pn);if((X==null?void 0:X.action)==="hide")return null;const _e=v=>{v.shiftKey};if(o!=="l"&&X)return r(Xd,{status:t,filterInfo:X,instance:b,containerProps:{onMouseEnter:_e},showFollowedTags:!0,quoted:h});const Te=new Date(le),He=new Date(Ge);let Se=be==null?void 0:be.find(v=>v.id===J);!Se&&J===H&&(Se={url:Q,username:q,displayName:re});const[nt,Ln]=Z(Se);if(!c&&!nt&&J){const v=B.accounts[J];v?Ln(v):Od(J,x).then(P=>{Ln(P),B.accounts[P.id]=P}).catch(P=>{})}const bt=J===yt||(be==null?void 0:be.find(v=>v.id===yt)),qe=ae(()=>!!(Jr.account.get("preferences")||{})["reading:expand:spoilers"],[]),Mn=ae(()=>{var P;return((P=(Jr.account.get("preferences")||{})["reading:expand:media"])==null?void 0:P.toLowerCase())||"default"},[]),Ue=f||qe||!!C.spoilers[H],Tt=f||Mn==="show_all"||!!C.spoilersMedia[H];if(pe)return se?r("div",{"data-state-post-id":A,class:"status-group",onMouseEnter:_e,children:[r("div",{class:"status-pre-meta",children:[r(M,{icon:"group",size:"l",alt:S._({id:"L8fEEm"})})," ",r(gt,{account:t.account,instance:b,showAvatar:!0})]}),r(Qt,{status:e?null:pe,statusID:e?pe.id:null,instance:b,size:o,contentTextWeight:i,readOnly:s,mediaFirst:w})]}):r("div",{"data-state-post-id":A,class:"status-reblog",onMouseEnter:_e,children:[r("div",{class:"status-pre-meta",children:[r(M,{icon:"rocket",size:"l"})," ",r(O,{id:"DlhB4J",components:{0:r(gt,{account:t.account,instance:b,showAvatar:!0}),1:r("span",{})}})]}),r(Qt,{status:e?null:pe,statusID:e?pe.id:null,instance:b,size:o,contentTextWeight:i,readOnly:s,enableCommentHint:!0,mediaFirst:w})]});const bo=Me(({children:v})=>r("div",{"data-state-post-id":A,class:"status-followed-tags",onMouseEnter:_e,children:[r("div",{class:"status-pre-meta",children:[r(M,{icon:"hashtag",size:"l"})," ",C.statusFollowedTags[A].slice(0,3).map(P=>r(Gt,{to:b?`/${b}/t/${P}`:`/t/${P}`,class:"status-followed-tag-item",children:P},P))]}),v]}),[A,b,C.statusFollowedTags[A]]),wt=g&&((qr=C.statusFollowedTags[A])!=null&&qr.length)?bo:F,de=o==="l",[Et,Ot]=Z(d),{contentTranslation:To,contentTranslationAutoInline:Lr}=C.settings;To||(u=!1);const Mr=ae(()=>{if(!To||!Lr||s||c&&!de||f||he||Ce||Ie||V||te!=null&&te.length)return!1;const v=jo(Y);return v>0&&v<=Ld},[To,Lr,s,c,de,f,he,Ce,Ie,V,te,Y]),[wo,Rn]=Z(!1),[ua,Eo]=Z(!1),Rr=ro(),Or=ro(),da=ro(),Dt=$(null),On=S._({id:"7jyUKe"}),Dr=Me(()=>Math.max(Math.round((he.length+jo(Y))/140)||1,1),[he,Y]),$r=Sn(Te),Nr=Ge&&Sn(He);let nn=k&&N!=="direct"&&N!=="private";N==="private"&&tt&&(nn=!0);const Dn=v=>{var P;if(!L||!k)return alert(On);(v!=null&&v.shiftKey||(P=v==null?void 0:v.syntheticEvent)!=null&&P.shiftKey)&&nc({replyToStatus:t})||Gn({replyToStatus:t})},Fr=ae(()=>te.some(v=>{var P,G;return!((G=(P=v.description)==null?void 0:P.trim)!=null&&G.call(P))}),[te]),zr=ae(()=>Math.floor((new Date-Te)/(1e3*60*60*24*30)),[Te]),xo=async()=>{if(!L||!k)return alert(On),!1;try{if(B.statuses[A]={...t,reblogged:!ne,reblogsCount:Ee+(ne?-1:1)},ne){const v=await x.v1.statuses.$select(H).unreblog();ft(v,b)}else{const v=await x.v1.statuses.$select(H).reblog();ft(v,b)}return!0}catch{return B.statuses[A]=t,!1}},Vr=async()=>{if(!L||!k)return alert(On),!1;try{if(B.statuses[A]={...t,favourited:!ye,favouritesCount:xe+(ye?-1:1)},ye){const v=await x.v1.statuses.$select(H).unfavourite();ft(v,b)}else{const v=await x.v1.statuses.$select(H).favourite();ft(v,b)}return!0}catch{return B.statuses[A]=t,!1}},So=async()=>{try{const v=await Vr();!de&&v&&Re(ye?S._({id:"sZvpIt",values:{0:q||R}}):S._({id:"yUngDO",values:{0:q||R}}))}catch{}},Hr=async()=>{if(Zn("@mastodon/post-bookmark")){if(!L||!k)return alert(On),!1;try{if(B.statuses[A]={...t,bookmarked:!De},De){const v=await x.v1.statuses.$select(H).unbookmark();ft(v,b)}else{const v=await x.v1.statuses.$select(H).bookmark();ft(v,b)}return!0}catch{return B.statuses[A]=t,!1}}},Br=async()=>{try{const v=await Hr();!de&&v&&Re(De?S._({id:"lWQguj",values:{0:q||R}}):S._({id:"Fb2K8h",values:{0:q||R}}))}catch{}},on=C.settings.contentTranslationHideLanguages||[],[$t,fa]=Z(lr[me+on]?Di(me,on):!1);ee(()=>{if(!me||$t||lr[me+on])return;let v=setTimeout(()=>{const P=Di(me,on);P&&fa(P)},1);return()=>clearTimeout(v)},[me,$t,on]);const Ur=$(),jr=$();async function ha(v){var ue,je,Nt,ko;v&&(Ur.current=x.v1.statuses.$select(e).rebloggedBy.list({limit:Ri}),jr.current=x.v1.statuses.$select(e).favouritedBy.list({limit:Ri}));const[{value:P},{value:G}]=await Promise.allSettled([Ur.current.next(),jr.current.next()]);if((ue=P.value)!=null&&ue.length||(je=G.value)!=null&&je.length){const xt=[];return(Nt=P.value)!=null&&Nt.length&&xt.push(...P.value.map(St=>(St._types=["reblog"],St))),(ko=G.value)!=null&&ko.length&&xt.push(...G.value.map(St=>(St._types=["favourite"],St))),{value:xt,done:P.done&&G.done}}return{value:[],done:!0}}const pa=$(),Kr=["public","unlisted"].includes(N),ma=["public","unlisted","private"].includes(N),Wr=r(F,{children:[!de&&L&&r(F,{children:r("div",{class:"menu-control-group-horizontal status-menu",children:[r(ke,{onClick:Dn,children:[r(M,{icon:"comment"}),r("span",{children:fe>0?rt(fe):S._({id:"ImOQa9"})})]}),r(Lo,{subMenu:!0,confirmLabel:r(F,{children:[r(M,{icon:"rocket"}),r("span",{children:ne?S._({id:"QzzGsY"}):S._({id:"kulphB"})})]}),className:`menu-reblog ${ne?"checked":""}`,menuExtras:r(ke,{onClick:()=>{Gn({draftStatus:{status:` +${Be}`}})},children:[r(M,{icon:"quote"}),r("span",{children:r(O,{id:"ZhhOwV"})})]}),menuFooter:Fr&&!ne?r("div",{class:"footer",children:[r(M,{icon:"alert"}),r(O,{id:"MB+wJL"})]}):zr>=3&&r("div",{class:"footer",children:[r(M,{icon:"info"}),r("span",{children:r(O,{id:"dBme/4",values:{0:$d.format(-zr,"month")},components:{0:r("strong",{})}})})]}),disabled:!nn,onClick:async()=>{try{const v=await xo();!de&&v&&Re(ne?S._({id:"bpDheH",values:{0:q||R}}):S._({id:"dbNZdP",values:{0:q||R}}))}catch{}},children:[r(M,{icon:"rocket"}),r("span",{children:Ee>0?rt(Ee):ne?S._({id:"QzzGsY"}):S._({id:"PiVIlD"})})]}),r(ke,{onClick:So,className:`menu-favourite ${ye?"checked":""}`,children:[r(M,{icon:"heart"}),r("span",{children:xe>0?rt(xe):ye?S._({id:"OcUmcH"}):S._({id:"W9FRBT"})})]}),Zn("@mastodon/post-bookmark")&&r(ke,{onClick:Br,className:`menu-bookmark ${De?"checked":""}`,children:[r(M,{icon:"bookmark"}),r("span",{children:De?S._({id:"q8EQYI"}):S._({id:"PZlHt8"})})]})]})}),!de&&L&&(de||T)&&r(an,{}),(de||T)&&r(F,{children:r(ke,{onClick:()=>{B.showGenericAccounts={heading:S._({id:"+XOeb+"}),fetchAccounts:ha,instance:b,showReactions:!0,postID:A}},children:[r(M,{icon:"react"}),r("span",{children:r(O,{id:"+XOeb+"})})]})}),!w&&r(F,{children:[(u||!me||$t)&&r(an,{}),u?r("div",{class:mn?"menu-horizontal":"",children:[r(ke,{disabled:Et,onClick:()=>{Ot(!0)},children:[r(M,{icon:"translate"}),r("span",{children:r(O,{id:"pi8x/S"})})]}),mn&&r(ke,{onClick:()=>{const v=Go(t);v&&ki(v,me)},children:[r(M,{icon:"speak"}),r("span",{children:r(O,{id:"yIBLq8"})})]})]}):(!me||$t)&&r("div",{class:mn?"menu-horizontal":"",children:[r(ci,{to:`${b?`/${b}`:""}/s/${H}?translate=1`,children:[r(M,{icon:"translate"}),r("span",{children:r(O,{id:"pi8x/S"})})]}),mn&&r(ke,{onClick:()=>{const v=Go(t);v&&ki(v,me)},children:[r(M,{icon:"speak"}),r("span",{children:r(O,{id:"yIBLq8"})})]})]})]}),(!de&&L||u||!me||$t)&&r(an,{}),!de&&r(F,{children:r(ci,{to:b?`/${b}/s/${H}`:`/s/${H}`,onClick:v=>{m(v,t)},children:[r(M,{icon:"arrows-right"}),r("small",{children:[r(O,{id:"8MkSAW",values:{0:q||R},components:{0:r("span",{class:"bidi-isolate"})}}),r("br",{}),r("span",{class:"more-insignificant",children:[E(At[N])," • ",$r]})]})]})}),!!Ge&&r(F,{children:r(ke,{onClick:()=>{Rn(H)},children:[r(M,{icon:"history"}),r("small",{children:[r(O,{id:"QL+7Jw"}),r("br",{}),r("span",{class:"more-insignificant",children:r(O,{id:"DuJJm9",values:{editedDateText:Nr}})})]})]})}),r(ke,{href:Be,target:"_blank",children:[r(M,{icon:"external"}),r("small",{class:"menu-double-lines",style:{maxWidth:"16em"},children:qd(Be)})]}),r("div",{class:"menu-horizontal",children:[r(ke,{onClick:()=>{try{navigator.clipboard.writeText(Be),Re(S._({id:"edWbV6"}))}catch{Re(S._({id:"W1ewR0"}))}},children:[r(M,{icon:"link"}),r("span",{children:r(O,{id:"he3ygx"})})]}),Kr&&(navigator==null?void 0:navigator.share)&&((Yr=navigator==null?void 0:navigator.canShare)==null?void 0:Yr.call(navigator,{url:Be}))&&r(ke,{onClick:()=>{try{navigator.share({url:Be})}catch{alert(S._({id:"TtG3Uh"}))}},children:[r(M,{icon:"share"}),r("span",{children:r(O,{id:"LFKLqp"})})]})]}),Kr&&de&&r(ke,{onClick:()=>{Eo(!0)},children:[r(M,{icon:"code"}),r("span",{children:r(O,{id:"jdVwsS"})})]}),(tt||bt)&&r(an,{}),(tt||bt)&&r(ke,{onClick:async()=>{try{const v=await x.v1.statuses.$select(H)[$e?"unmute":"mute"]();ft(v,b),Re($e?S._({id:"Pm+5jw"}):S._({id:"ywB7JM"}))}catch{Re($e?S._({id:"c6jxNY"}):S._({id:"8SN9kN"}))}},children:$e?r(F,{children:[r(M,{icon:"unmute"}),r("span",{children:r(O,{id:"i51zUR"})})]}):r(F,{children:[r(M,{icon:"mute"}),r("span",{children:r(O,{id:"OiUYO5"})})]})}),tt&&ma&&r(ke,{onClick:async()=>{try{const v=await x.v1.statuses.$select(H)[ve?"unpin":"pin"]();ft(v,b),Re(ve?S._({id:"Yx809+"}):S._({id:"S6P6E+"}))}catch{Re(ve?S._({id:"A6cs15"}):S._({id:"vgUfWO"}))}},children:ve?r(F,{children:[r(M,{icon:"unpin"}),r("span",{children:r(O,{id:"XQMQZw"})})]}):r(F,{children:[r(M,{icon:"pin"}),r("span",{children:r(O,{id:"lfHLsx"})})]})}),tt&&r("div",{class:"menu-horizontal",children:[Zn("@mastodon/post-edit")&&r(ke,{onClick:()=>{Gn({editStatus:t})},children:[r(M,{icon:"pencil"}),r("span",{children:r(O,{id:"ePK91l"})})]}),de&&r(Lo,{subMenu:!0,confirmLabel:r(F,{children:[r(M,{icon:"trash"}),r("span",{children:r(O,{id:"FbPNuJ"})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{(async()=>{try{await x.v1.statuses.$select(H).remove();const v=Yi(H,b);v._deleted=!0,Re(S._({id:"KiyvHV"}))}catch{Re(S._({id:"Yb6p2q"}))}})()},children:[r(M,{icon:"trash"}),r("span",{children:r(O,{id:"Jb6/SB"})})]})]}),!tt&&de&&r(F,{children:[r(an,{}),r(ke,{className:"danger",onClick:()=>{B.showReportModal={account:t.account,post:t}},children:[r(M,{icon:"flag"}),r("span",{children:r(O,{id:"7PQAMY"})})]})]})]}),Zr=$(),[$n,rn]=Z(!1),[Nn,Fn]=Z({}),zn=_||!de&&!f&&!Le&&!h,ga=Ws(Dd&&zn?v=>{var je;if(v.pointerType==="mouse")return;const{clientX:P,clientY:G}=((je=v.touches)==null?void 0:je[0])||v,ue=v.target.closest("a");ue&&Dt.current.contains(ue)&&!ue.getAttribute("href").startsWith("#")||(v.preventDefault(),Fn({anchorPoint:{x:P,y:G},direction:"right"}),rn(!0))}:null,{threshold:600,captureEvent:!0,detect:"touch",cancelOnMovement:2}),Vn=!s&&!f&&!h,va=Bt("r, shift+r",Dn,{enabled:Vn}),_a=Bt("f, l",So,{enabled:Vn}),ya=Bt("d",Br,{enabled:Vn}),ba=Bt("shift+b",()=>{(async()=>{try{const v=await xo();!de&&v&&Re(ne?S._({id:"bpDheH",values:{0:q||R}}):S._({id:"dbNZdP",values:{0:q||R}}))}catch{}})()},{enabled:Vn&&nn}),Ta=Bt("x",v=>{const P=document.activeElement.closest(".status-link, .status-focus");if(P){const G=P.querySelector(".spoiler-button:not(.spoiling)");if(G)v.stopPropagation(),G.click();else{const ue=P.querySelector(".spoiler-media-button:not(.spoiling)");ue&&(v.stopPropagation(),ue.click())}}}),Hn=te.slice(0,de?void 0:4),Bn=te.length>1&&Hn.some(v=>!!v.description&&!Qs(v.description)),wa=ae(()=>{if(!Bn)return null;const v=[];return Hn.forEach((P,G)=>{if(!P.description)return;const ue=v.findIndex(je=>je.media.description===P.description);ue===-1?v.push({media:P,indices:[G]}):v[ue].indices.push(G)}),v.map(({media:P,indices:G})=>r("div",{"data-caption-index":G.map(ue=>ue+1).join(" "),onClick:ue=>{ue.preventDefault(),ue.stopPropagation(),B.showMediaAlt={alt:P.description,lang:me}},title:P.description,children:[r("sup",{children:G.map(ue=>ue+1).join(" ")})," ",P.description]},P.id))},[Bn,Hn,me]),sn=ae(()=>{var v;return!!z&&J===((v=t.account)==null?void 0:v.id)||!!C.statusThreadNumber[A]},[z,J,(Xr=t.account)==null?void 0:Xr.id,C.statusThreadNumber[A]]),Ea=ae(()=>a&&!sn&&!c&&!z&&N==="public"&&fe>0,[a,sn,c,z,fe,N]),Gr=ae(()=>{if(V||Ie||Ce||he||te!=null&&te.length||sn||c||z||fe<=0||!/[???︖❓❔⁇⁈⁉¿‽؟]/.test(Y))return!1;const G=jo(Y);if(G>0&&G<=Pd)return!0},[V,Ie,Ce,he,te,pe,sn,c,z,fe,Y]);return r(wt,{children:[y&&!!(z&&J)&&r(Yd,{sKey:A}),r("article",{"data-state-post-id":A,ref:v=>{var G;Dt.current=v;const P=((G=v==null?void 0:v.closest)==null?void 0:G.call(v,".timeline-item, .timeline-item-alt, .status-link, .status-focus"))||v;va(P),_a(P),ya(P),ba(P),Ta(P)},tabindex:"-1",class:`status ${!c&&z&&nt?"status-reply-to":""} visibility-${N} ${Cn?"status-pinned":""} ${Hd[o]} ${Le?"status-deleted":""} ${h?"status-card":""} ${$n?"status-menu-open":""} ${w&&Rt?"status-media-first":""}`,onMouseEnter:_e,onContextMenu:v=>{var ue,je;if(!zn||v.metaKey)return;const P=v.target.closest("a");if(P&&Dt.current.contains(P)&&!P.getAttribute("href").startsWith("#"))return;const G=(ue=window.getSelection)==null?void 0:ue.call(window);if(G.toString().length>0){const{anchorNode:Nt}=G;if((je=Dt.current)!=null&&je.contains(Nt))return}v.preventDefault(),Fn({anchorPoint:{x:v.clientX,y:v.clientY},direction:"right"}),rn(!0)},...zn?ga():{},children:[zn&&r(cs,{ref:Zr,state:$n?"open":void 0,...Nn,onClose:v=>{var P,G,ue;rn(!1),(v==null?void 0:v.reason)==="click"&&((ue=(G=(P=Dt.current)==null?void 0:P.closest("[tabindex]"))==null?void 0:G.focus)==null||ue.call(G))},portal:{target:document.body},containerProps:{style:{zIndex:1001},onClick:()=>{var v,P;(P=(v=Zr.current)==null?void 0:v.closeMenu)==null||P.call(v)}},overflow:"auto",boundingBoxPadding:vs(),unmountOnClose:!0,children:Wr}),T&&o!=="l"&&!f&&!s&&!Le&&!h&&r("div",{class:`status-actions ${$n==="actions-bar"?"open":""}`,ref:pa,children:[r(Ht,{size:"s",title:S._({id:"ImOQa9"}),alt:S._({id:"ImOQa9"}),class:"reply-button",icon:"comment",iconSize:"m",onClick:Dn}),r(Ht,{size:"s",checked:ye,title:[S._({id:"W9FRBT"}),S._({id:"OcUmcH"})],alt:[S._({id:"W9FRBT"}),S._({id:"8ab1sR"})],class:"favourite-button",icon:"heart",iconSize:"m",count:xe,onClick:So}),r("button",{type:"button",title:S._({id:"2FYpfJ"}),class:"plain more-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),Fn({anchorRef:{current:v.currentTarget},align:"start",direction:"left",gap:0,shift:-8}),rn("actions-bar")},children:r(M,{icon:"more2",size:"m",alt:S._({id:"2FYpfJ"})})})]}),o!=="l"&&r("div",{class:"status-badge",children:[ne&&r(M,{class:"reblog",icon:"rocket",size:"s",alt:S._({id:"b7T5Zj"})}),ye&&r(M,{class:"favourite",icon:"heart",size:"s",alt:S._({id:"8ab1sR"})}),De&&r(M,{class:"bookmark",icon:"bookmark",size:"s",alt:S._({id:"1C/9Sa"})}),Cn&&r(M,{class:"pin",icon:"pin",size:"s",alt:S._({id:"kNiQp6"})})]}),o!=="s"&&r("a",{href:Q,tabindex:"-1",title:`@${R}`,onClick:v=>{v.preventDefault(),v.stopPropagation(),B.showAccount={account:t.account,instance:b}},children:r(st,{url:U||W,size:"xxl",squircle:ce})}),r("div",{class:"container",children:[r("div",{class:"meta",children:[r("span",{class:"meta-name",children:r(gt,{account:t.account,instance:b,showAvatar:o==="s",showAcct:de})})," ",o!=="l"&&(Le?r("span",{class:"status-deleted-tag",children:r(O,{id:"vGjmyl"})}):Be&&!f&&!s&&!h?r(Gt,{to:b?`/${b}/s/${H}`:`/s/${H}`,onClick:v=>{v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||v.which===2||(v.preventDefault(),v.stopPropagation(),m==null||m(v,t),Fn({anchorRef:{current:v.currentTarget},align:"end",direction:"bottom",gap:4}),rn(!0))},class:`time ${$n&&(Nn!=null&&Nn.anchorRef)?"is-open":""}`,children:[Ea&&!Gr?r(M,{icon:"comment2",size:"s",alt:S._({id:"RXmXDR",values:{repliesCount:fe}})}):N!=="public"&&N!=="direct"&&r(M,{icon:_n[N],alt:E(At[N]),size:"s"})," ",r(at,{datetime:Te,format:"micro"}),!f&&!s&&r(M,{icon:"more2",class:"more",alt:S._({id:"2FYpfJ"})})]}):r("span",{class:"time",children:[N!=="public"&&N!=="direct"&&r(F,{children:[r(M,{icon:_n[N],alt:E(At[N]),size:"s"})," "]}),r(at,{datetime:Te,format:"micro"})]}))]}),N==="direct"&&r(F,{children:[r("div",{class:"status-direct-badge",children:r(O,{id:"IV4QaU"})})," "]}),!c&&r(F,{children:sn?r("div",{class:"status-thread-badge",children:[r(M,{icon:"thread",size:"s"}),r(O,{id:"lQ8zCz",values:{0:C.statusThreadNumber[A]?` ${C.statusThreadNumber[A]}/X`:""}})]}):!!z&&!!nt&&(!!he||!be.find(v=>v.id===J))&&r("div",{class:"status-reply-badge",children:[r(M,{icon:"reply"})," ",r(gt,{account:nt,instance:b,short:!0})]})}),r("div",{class:`content-container ${he||Ce?"has-spoiler":""} ${Ue?"show-spoiler":""} ${Tt?"show-media":""}`,"data-content-text-weight":i?Dr():null,style:(de||i)&&{"--content-text-weight":Dr()},children:w&&Rt?r(F,{children:[(!!he||!!Ce)&&!qe&&r(F,{children:[!!he&&r("span",{class:"spoiler-content media-first-spoiler-content",lang:me,dir:"auto",ref:Rr,"data-read-more":E(yn),children:[r(qt,{text:he,emojis:Ae})," "]}),r("button",{class:`light spoiler-button media-first-spoiler-button ${Ue?"spoiling":""}`,type:"button",onClick:v=>{v.preventDefault(),v.stopPropagation(),Ue?(delete B.spoilers[H],qe||delete B.spoilersMedia[H]):(B.spoilers[H]=!0,qe||(B.spoilersMedia[H]=!0))},children:[r(M,{icon:Ue?"eye-open":"eye-close"})," ",Ue?S._({id:"6lGV3K"}):S._({id:"lqBX03"})]})]}),r(jd,{mediaAttachments:te,language:me,postID:H,instance:b}),!!Y&&r("div",{class:"media-first-content content",ref:Or,children:r(Oi,{post:t,instance:b,previewMode:f})})]}):r(F,{children:[!!he&&r(F,{children:[r("div",{class:"content spoiler-content",lang:me,dir:"auto",ref:Rr,"data-read-more":E(yn),children:r("p",{children:r(qt,{text:he,emojis:Ae})})}),qe||f?r("div",{class:"spoiler-divider",children:[r(M,{icon:"eye-open"})," ",r(O,{id:"gnKo7f"})]}):r("button",{class:`light spoiler-button ${Ue?"spoiling":""}`,type:"button",onClick:v=>{v.preventDefault(),v.stopPropagation(),Ue?(delete B.spoilers[H],qe||delete B.spoilersMedia[H]):(B.spoilers[H]=!0,qe||(B.spoilersMedia[H]=!0))},children:[r(M,{icon:Ue?"eye-open":"eye-close"})," ",Ue?S._({id:"6lGV3K"}):S._({id:"lqBX03"})]})]}),!!Y&&r("div",{class:"content",ref:Or,"data-read-more":E(yn),inert:he&&!Ue?!0:void 0,children:[r(Oi,{post:t,instance:b,previewMode:f}),r(Qd,{id:H,instance:b,level:h})]}),!!Ie&&r(Qu,{lang:me,poll:Ie,readOnly:s||!L||!k,onUpdate:v=>{B.statuses[A].poll=v},refresh:()=>x.v1.polls.$select(Ie.id).fetch().then(v=>{B.statuses[A].poll=v}).catch(v=>{}),votePoll:v=>x.v1.polls.$select(Ie.id).votes.create({choices:v}).then(P=>{B.statuses[A].poll=P}).catch(P=>{})}),((u||Mr)&&Fd(Y)&&$t||Et)&&r(Cu,{forceTranslate:Et||Mr,mini:!de&&!c,sourceLanguage:me,autoDetected:_t,text:Go(t)}),!f&&Ce&&!!te.length&&Mn!=="show_all"&&r("button",{class:`plain spoiler-media-button ${Tt?"spoiling":""}`,type:"button",hidden:!qe&&!!he,onClick:v=>{v.preventDefault(),v.stopPropagation(),Tt?delete B.spoilersMedia[H]:B.spoilersMedia[H]=!0},children:[r(M,{icon:Tt?"eye-open":"eye-close"})," ",Tt?S._({id:"6lGV3K"}):S._({id:"9ZCilh"})]}),!!te.length&&(te.length>1&&(de||c&&o==="m")?r("div",{class:"media-large-container",children:te.map((v,P)=>r("div",{class:"media-container media-eq1",children:r(cr,{media:v,autoAnimate:!0,showCaption:!0,allowLongerCaption:!Y,lang:me,to:`/${b}/s/${H}?${c?"media":"media-only"}=${P+1}`,onClick:p?G=>p(G,P,v,t):void 0})},v.id))}):r(Ud,{lang:me,enabled:Bn,captionChildren:wa,children:r("div",{ref:da,class:`media-container media-eq${te.length} ${te.length>2?"media-gt2":""} ${te.length>4?"media-gt4":""}`,children:Hn.map((v,P)=>r(cr,{media:v,autoAnimate:de,showCaption:te.length===1,allowLongerCaption:!Y&&te.length===1,lang:me,altIndex:Bn&&!!v.description&&P+1,to:`/${b}/s/${H}?${c?"media":"media-only"}=${P+1}`,onClick:p?G=>{p(G,P,v,t)}:void 0,checkAspectRatio:te.length===1},v.id))})})),!!V&&/^https/i.test(V==null?void 0:V.url)&&!Ce&&!he&&!Ie&&!te.length&&!C.statusQuotes[A]&&r(Wd,{card:V,selfReferential:(V==null?void 0:V.url)===t.url||(V==null?void 0:V.url)===t.uri,selfAuthor:(Qr=V==null?void 0:V.authors)==null?void 0:Qr.some(v=>{var P;return((P=v.account)==null?void 0:P.url)===Q}),instance:D})]})}),!de&&Gr&&r("div",{class:"content-comment-hint insignificant",children:[r(M,{icon:"comment2",alt:S._({id:"N8UzTV"})})," ",fe]}),de&&r(F,{children:[r("div",{class:"extra-meta",children:Le?r("span",{class:"status-deleted-tag",children:r(O,{id:"vGjmyl"})}):r(F,{children:[r("span",{children:E(At[N])})," •"," ",r("a",{href:Be,target:"_blank",rel:"noopener noreferrer",children:[new Date().getTime()-Te.getTime()<864e5&&r(F,{children:[r(at,{datetime:Te,format:"micro"})," ","‒"," "]}),r("time",{class:"created",datetime:Te.toISOString(),title:Te.toLocaleString(),children:$r})]}),Ge&&r(F,{children:[" ","• ",r(M,{icon:"pencil",alt:S._({id:"MRZxAn"})})," ",r("time",{tabIndex:"0",class:"edited",datetime:He.toISOString(),onClick:()=>{Rn(H)},children:Nr})]})]})}),!!(dt!=null&&dt.length)&&r("div",{class:"emoji-reactions",children:dt.map(v=>{const{name:P,count:G,me:ue,url:je,staticUrl:Nt}=v;if(je)return r("span",{class:`emoji-reaction tag ${ue?"":"insignificant"}`,children:[r(rr,{alt:P,url:je,staticUrl:Nt})," ",G]});if(/^:.+?:$/.test(P)){const xt=Ae.find(St=>St.shortcode===P.replace(/^:/,"").replace(/:$/,""));if(xt)return r("span",{class:`emoji-reaction tag ${ue?"":"insignificant"}`,children:[r(rr,{alt:P,url:xt.url,staticUrl:xt.staticUrl})," ",G]})}return r("span",{class:`emoji-reaction tag ${ue?"":"insignificant"}`,children:[P," ",G]})})}),r("div",{class:`actions ${Le?"disabled":""}`,children:[r("div",{class:"action has-count",children:r(Ht,{title:S._({id:"ImOQa9"}),alt:S._({id:"VbyRUy"}),class:"reply-button",icon:"comment",count:fe,onClick:Dn})}),r(Lo,{disabled:!nn,onClick:xo,confirmLabel:r(F,{children:[r(M,{icon:"rocket"}),r("span",{children:ne?S._({id:"QzzGsY"}):S._({id:"kulphB"})})]}),menuExtras:r(ke,{onClick:()=>{Gn({draftStatus:{status:` +${Be}`}})},children:[r(M,{icon:"quote"}),r("span",{children:r(O,{id:"ZhhOwV"})})]}),menuFooter:Fr&&!ne&&r("div",{class:"footer",children:[r(M,{icon:"alert"}),r(O,{id:"MB+wJL"})]}),children:r("div",{class:"action has-count",children:r(Ht,{checked:ne,title:[S._({id:"kulphB"}),S._({id:"QzzGsY"})],alt:[S._({id:"kulphB"}),S._({id:"b7T5Zj"})],class:"reblog-button",icon:"rocket",count:Ee,disabled:!nn})})}),r("div",{class:"action has-count",children:r(Ht,{checked:ye,title:[S._({id:"W9FRBT"}),S._({id:"OcUmcH"})],alt:[S._({id:"W9FRBT"}),S._({id:"8ab1sR"})],class:"favourite-button",icon:"heart",count:xe,onClick:Vr})}),Zn("@mastodon/post-bookmark")&&r("div",{class:"action",children:r(Ht,{checked:De,title:[S._({id:"PZlHt8"}),S._({id:"q8EQYI"})],alt:[S._({id:"PZlHt8"}),S._({id:"1C/9Sa"})],class:"bookmark-button",icon:"bookmark",onClick:Hr})}),r(_s,{portal:{target:document.querySelector(".status-deck")||document.body},align:"end",gap:4,overflow:"auto",viewScroll:"close",menuButton:r("div",{class:"action",children:r("button",{type:"button",title:S._({id:"2FYpfJ"}),class:"plain more-button",children:r(M,{icon:"more",size:"l",alt:S._({id:"2FYpfJ"})})})}),children:Wr})]})]})]}),!!wo&&r(Xo,{onClick:v=>{v.target===v.currentTarget&&Rn(!1)},children:r(Zd,{statusID:wo,instance:b,fetchStatusHistory:()=>x.v1.statuses.$select(wo).history.list(),onClose:()=>{var v;Rn(!1),(v=Dt.current)==null||v.focus()}})}),!!ua&&r(Xo,{onClick:v=>{v.target===v.currentTarget&&Eo(!1)},children:r(Gd,{post:t,instance:b,onClose:()=>{Eo(!1)}})})]})]})}function Ud(e){const{enabled:t,children:n,lang:o,captionChildren:i}=e;return!t||!i?n:r("figure",{class:"media-figure-multiple",children:[n,r("figcaption",{lang:o,dir:"auto",children:i})]})}function jd(e){const{mediaAttachments:t,language:n,postID:o,instance:i}=e,s=t.length>1,a=$(),[c,l]=Z(0);return ee(()=>{let u=()=>{const{clientWidth:d,scrollLeft:f}=a.current,p=Math.round(Math.abs(f)/d);l(p)};return a.current&&a.current.addEventListener("scroll",u,{passive:!0}),()=>{a.current&&a.current.removeEventListener("scroll",u)}},[]),r(F,{children:[r("div",{class:"media-first-container",children:[r("div",{class:"media-first-carousel",ref:a,children:t.map((u,d)=>r("div",{class:"media-first-item",children:r(cr,{media:u,lang:n,to:`/${i}/s/${o}?media=${d+1}`})},u.id))}),s&&r("div",{class:"media-carousel-controls",children:[r("div",{class:"carousel-indexer",children:[c+1,"/",t.length]}),r("label",{class:"media-carousel-button",children:r("button",{type:"button",class:"carousel-button",hidden:c===0,onClick:u=>{u.preventDefault(),u.stopPropagation(),a.current.focus(),a.current.scrollTo({left:a.current.clientWidth*(c-1)*(or()?-1:1),behavior:"smooth"})},children:r(M,{icon:"arrow-left"})})}),r("label",{class:"media-carousel-button",children:r("button",{type:"button",class:"carousel-button",hidden:c===t.length-1,onClick:u=>{u.preventDefault(),u.stopPropagation(),a.current.focus(),a.current.scrollTo({left:a.current.clientWidth*(c+1)*(or()?-1:1),behavior:"smooth"})},children:r(M,{icon:"arrow-right"})})})]})]}),s&&r("div",{class:"media-carousel-dots",style:{"--dots-count":t.length},children:t.map((u,d)=>r("span",{class:`carousel-dot ${d===c?"active":""}`},u.id))})]})}function $i(e){return Cs.toUnicode(URL.parse(e).hostname.replace(/^www\./,"").replace(/\/$/,""))}function Ni(e){return["x.com","twitter.com","threads.net","bsky.app"].includes(e)}function Kd({authors:e,hidden:t,children:n}){var i,s;if(t||!((s=(i=e==null?void 0:e[0])==null?void 0:i.account)!=null&&s.id))return n;const o=e[0].account;return r("div",{class:"card-byline",children:[n,r("div",{class:"card-byline-author",children:[r(M,{icon:"link",size:"s"})," ",r("small",{children:r(O,{id:"4LHHK6",components:{0:r(gt,{account:o,showAvatar:!0})}})})]})]})}function Wd({card:e,selfReferential:t,selfAuthor:n,instance:o}){var Q;const i=In(B),{blurhash:s,title:a,description:c,html:l,providerName:u,providerUrl:d,authorName:f,authorUrl:p,width:h,height:m,image:g,imageDescription:_,url:T,type:y,embedUrl:w,language:E,publishedAt:x,authors:b}=e,k=a||u||f,L=h/m>=1.2?"large":"",[A,C]=Z(null);if(ee(()=>{k&&g&&!t&&$a(T)&&Na(o,T).then(re=>{if(!re)return;const{id:q,url:ie}=re;C("#"+ie)})},[k,g,t]),i.unfurledLinks[T])return null;const R=/`;\n this.domRefFrame.insertAdjacentHTML('beforeend', iframeHTML);\n this.domRefFrame.classList.add('activated');\n this.isIframeLoaded = true;\n this.attemptShortAutoPlay();\n this.dispatchEvent(new CustomEvent('liteYoutubeIframeLoaded', {\n detail: {\n videoId: this.videoId,\n },\n bubbles: true,\n cancelable: true,\n }));\n }\n }\n initImagePlaceholder() {\n const posterUrlWebp = `https://i.ytimg.com/vi_webp/${this.videoId}/${this.posterQuality}.webp`;\n const posterUrlJpeg = `https://i.ytimg.com/vi/${this.videoId}/${this.posterQuality}.jpg`;\n this.domRefImg.fallback.loading = this.posterLoading;\n this.domRefImg.webp.srcset = posterUrlWebp;\n this.domRefImg.jpeg.srcset = posterUrlJpeg;\n this.domRefImg.fallback.src = posterUrlJpeg;\n this.domRefImg.fallback.setAttribute('aria-label', `${this.videoPlay}: ${this.videoTitle}`);\n this.domRefImg?.fallback?.setAttribute('alt', `${this.videoPlay}: ${this.videoTitle}`);\n }\n initIntersectionObserver() {\n const options = {\n root: null,\n rootMargin: '0px',\n threshold: 0,\n };\n const observer = new IntersectionObserver((entries, observer) => {\n entries.forEach(entry => {\n if (entry.isIntersecting && !this.isIframeLoaded) {\n LiteYTEmbed.warmConnections();\n this.addIframe(true);\n observer.unobserve(this);\n }\n });\n }, options);\n observer.observe(this);\n }\n attemptShortAutoPlay() {\n if (this.isYouTubeShort()) {\n setTimeout(() => {\n this.shadowRoot\n .querySelector('iframe')\n ?.contentWindow?.postMessage('{\"event\":\"command\",\"func\":\"' + 'playVideo' + '\",\"args\":\"\"}', '*');\n }, 2000);\n }\n }\n isYouTubeShort() {\n return (this.getAttribute('short') === '' &&\n window.matchMedia('(max-width: 40em)').matches);\n }\n static addPrefetch(kind, url) {\n const linkElem = document.createElement('link');\n linkElem.rel = kind;\n linkElem.href = url;\n linkElem.crossOrigin = 'true';\n document.head.append(linkElem);\n }\n static warmConnections() {\n if (LiteYTEmbed.isPreconnected || window.liteYouTubeIsPreconnected)\n return;\n LiteYTEmbed.addPrefetch('preconnect', 'https://i.ytimg.com/');\n LiteYTEmbed.addPrefetch('preconnect', 'https://s.ytimg.com');\n LiteYTEmbed.addPrefetch('preconnect', 'https://www.youtube.com');\n LiteYTEmbed.addPrefetch('preconnect', 'https://www.google.com');\n LiteYTEmbed.addPrefetch('preconnect', 'https://googleads.g.doubleclick.net');\n LiteYTEmbed.addPrefetch('preconnect', 'https://static.doubleclick.net');\n LiteYTEmbed.isPreconnected = true;\n window.liteYouTubeIsPreconnected = true;\n }\n}\nLiteYTEmbed.isPreconnected = false;\ncustomElements.define('lite-youtube', LiteYTEmbed);\n//# sourceMappingURL=lite-youtube.js.map","const digitLookup = new Uint8Array(128);\nfor (let i = 0; i < 83; i++) {\n digitLookup[\n '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~'.charCodeAt(\n i,\n )\n ] = i;\n}\nconst decode83 = (str, start, end) => {\n let value = 0;\n while (start < end) {\n value *= 83;\n value += digitLookup[str.charCodeAt(start++)];\n }\n return value;\n};\n\nconst pow = Math.pow;\nconst PI = Math.PI;\nconst PI2 = PI * 2;\n\nconst d = 3294.6;\nconst e = 269.025;\nconst sRGBToLinear = (value) =>\n value > 10.31475 ? pow(value / e + 0.052132, 2.4) : value / d;\n\nconst linearTosRGB = (v) =>\n ~~(v > 0.00001227 ? e * pow(v, 0.416666) - 13.025 : v * d + 1);\n\nconst signSqr = (x) => (x < 0 ? -1 : 1) * x * x;\n\n/**\n * Fast approximate cosine implementation\n * Based on FTrig https://github.com/netcell/FTrig\n */\nconst fastCos = (x) => {\n x += PI / 2;\n while (x > PI) {\n x -= PI2;\n }\n const cos = 1.27323954 * x - 0.405284735 * signSqr(x);\n return 0.225 * (signSqr(cos) - cos) + cos;\n};\n\n/**\n * Extracts average color from BlurHash image\n * @param {string} blurHash BlurHash image string\n * @returns {[number, number, number]}\n */\nexport function getBlurHashAverageColor(blurHash) {\n const val = decode83(blurHash, 2, 6);\n return [val >> 16, (val >> 8) & 255, val & 255];\n}\n\n/**\n * Decodes BlurHash image\n * @param {string} blurHash BlurHash image string\n * @param {number} width Output image width\n * @param {number} height Output image height\n * @param {?number} punch\n * @returns {Uint8ClampedArray}\n */\nexport function decodeBlurHash(blurHash, width, height, punch) {\n const sizeFlag = decode83(blurHash, 0, 1);\n const numX = (sizeFlag % 9) + 1;\n const numY = ~~(sizeFlag / 9) + 1;\n const size = numX * numY;\n\n let i = 0,\n j = 0,\n x = 0,\n y = 0,\n r = 0,\n g = 0,\n b = 0,\n basis = 0,\n basisY = 0,\n colorIndex = 0,\n pixelIndex = 0,\n value = 0;\n\n const maximumValue = ((decode83(blurHash, 1, 2) + 1) / 13446) * (punch | 1);\n\n const colors = new Float64Array(size * 3);\n\n const averageColor = getBlurHashAverageColor(blurHash);\n for (i = 0; i < 3; i++) {\n colors[i] = sRGBToLinear(averageColor[i]);\n }\n\n for (i = 1; i < size; i++) {\n value = decode83(blurHash, 4 + i * 2, 6 + i * 2);\n colors[i * 3] = signSqr(~~(value / 361) - 9) * maximumValue;\n colors[i * 3 + 1] = signSqr((~~(value / 19) % 19) - 9) * maximumValue;\n colors[i * 3 + 2] = signSqr((value % 19) - 9) * maximumValue;\n }\n\n const cosinesY = new Float64Array(numY * height);\n const cosinesX = new Float64Array(numX * width);\n for (j = 0; j < numY; j++) {\n for (y = 0; y < height; y++) {\n cosinesY[j * height + y] = fastCos((PI * y * j) / height);\n }\n }\n for (i = 0; i < numX; i++) {\n for (x = 0; x < width; x++) {\n cosinesX[i * width + x] = fastCos((PI * x * i) / width);\n }\n }\n\n const bytesPerRow = width * 4;\n const pixels = new Uint8ClampedArray(bytesPerRow * height);\n\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n r = g = b = 0;\n for (j = 0; j < numY; j++) {\n basisY = cosinesY[j * height + y];\n for (i = 0; i < numX; i++) {\n basis = cosinesX[i * width + x] * basisY;\n colorIndex = (i + j * numX) * 3;\n r += colors[colorIndex] * basis;\n g += colors[colorIndex + 1] * basis;\n b += colors[colorIndex + 2] * basis;\n }\n }\n\n pixelIndex = 4 * x + y * bytesPerRow;\n pixels[pixelIndex] = linearTosRGB(r);\n pixels[pixelIndex + 1] = linearTosRGB(g);\n pixels[pixelIndex + 2] = linearTosRGB(b);\n pixels[pixelIndex + 3] = 255; // alpha\n }\n }\n return pixels;\n}\n","/**\n * @param {string[]} splittedHtml\n * @param {{ char?: string; count?: number}} options\n * @returns {string}\n */\nconst addIndentation = (splittedHtml, options = {}) => {\n const char = options.char || ' '\n const count = options.count || 2\n\n let level = 0\n const opened = []\n\n return splittedHtml.reverse().reduce((indented, elTag) => {\n if (opened.length\n && level\n && opened[level]\n /* if current element tag is the same as previously opened one */\n && opened[level] === elTag.substring(1, opened[level].length + 1)\n ) {\n opened.splice(level, 1)\n level--\n }\n\n const indentation = char.repeat(level ? level * count : 0)\n\n const newIndented = [\n `${indentation}${elTag}`,\n ...indented,\n ]\n\n // if current element tag is closing tag\n // add it to opened elements\n if (elTag.substring(0, 2) === ' (\n // Replace\n // - 1 or more spaces or tabs at the start of line\n // - 1 or more spaces or tabs at the end of line\n // - empty lines\n // with empty string\n nonFormattedString.trim().replace(/(^(\\s|\\t)+|(( |\\t)+)$)/gm, '')\n)\n\n/**\n * @param {string} markup\n * @returns {string[]} Array of strings splitted on new lines without empty lines\n */\nconst mergeAttributesWithElements = (markup) => {\n const splittedMarkup = removeEmptyLines(markup).split('\\n')\n\n const mergedLines = []\n let currentElement = ''\n for (let i = 0; i < splittedMarkup.length; i += 1) {\n const line = splittedMarkup[i]\n\n // If line is closing element/tag separate closing tag from rest of the line with space\n if (line.endsWith('/>')) {\n mergedLines.push(`${currentElement}${line.slice(0, -2)} />`)\n currentElement = ''\n // eslint-disable-next-line no-continue\n continue\n }\n\n if (line.endsWith('>')) {\n mergedLines.push(`${currentElement}${\n line.startsWith('>') || line.startsWith('<') ? '' : ' '\n }${line}`)\n currentElement = ''\n // eslint-disable-next-line no-continue\n continue\n }\n\n currentElement += currentElement.length ? ` ${line}` : line\n }\n\n return mergedLines\n}\n\nmodule.exports = {\n mergeAttributesWithElements,\n removeEmptyLines,\n}\n","const addIndentation = require('./utils/addIndentation')\nconst { mergeAttributesWithElements } = require('./utils/toLines')\n\n/**\n * @param {string} markup\n * @param {{ char?: string; count?: number }} options\n * @returns {string}\n */\nconst prettify = (markup, options = {}) => {\n const splitted = mergeAttributesWithElements(markup)\n\n return addIndentation(splitted, options)\n}\n\nmodule.exports = prettify\n","import { useRef as s, useCallback as h, useEffect as g } from \"react\";\nvar l = /* @__PURE__ */ ((e) => (e.Mouse = \"mouse\", e.Touch = \"touch\", e.Pointer = \"pointer\", e))(l || {}), d = /* @__PURE__ */ ((e) => (e.CancelledByMovement = \"cancelled-by-movement\", e.CancelledByRelease = \"cancelled-by-release\", e.CancelledOutsideElement = \"cancelled-outside-element\", e))(d || {});\nconst A = () => typeof window == \"object\" ? window?.PointerEvent ?? null : null, z = () => typeof window == \"object\" ? window?.TouchEvent ?? null : null;\nfunction U(e) {\n const { nativeEvent: t } = e, u = z();\n return u && t instanceof u || \"touches\" in e;\n}\nfunction X(e) {\n const t = A();\n return e.nativeEvent instanceof MouseEvent && !(t && e.nativeEvent instanceof t);\n}\nfunction Y(e) {\n const { nativeEvent: t } = e;\n if (!t)\n return !1;\n const u = A();\n return u && t instanceof u || \"pointerId\" in t;\n}\nfunction R(e) {\n return X(e) || U(e) || Y(e);\n}\nfunction j(e) {\n return U(e) ? {\n x: e.touches[0].pageX,\n y: e.touches[0].pageY\n } : X(e) || Y(e) ? {\n x: e.pageX,\n y: e.pageY\n } : null;\n}\nfunction G(e) {\n return {\n target: e.target,\n currentTarget: e.currentTarget,\n nativeEvent: e,\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n persist: () => {\n }\n };\n}\nfunction J(e, {\n threshold: t = 400,\n captureEvent: u = !1,\n detect: y = l.Pointer,\n cancelOnMovement: w = !1,\n cancelOutsideElement: v = !0,\n filterEvents: p,\n onStart: M,\n onMove: C,\n onFinish: L,\n onCancel: b\n} = {}) {\n const P = s(!1), c = s(!1), I = s(), a = s(), T = s(e), f = s(null), E = h(\n (n) => (r) => {\n c.current || R(r) && (p !== void 0 && !p(r) || (u && r.persist(), M?.(r, { context: n }), f.current = j(r), c.current = !0, I.current = r.currentTarget, a.current = setTimeout(() => {\n T.current && (T.current(r, { context: n }), P.current = !0);\n }, t)));\n },\n [u, p, M, t]\n ), i = h(\n (n) => (r, o) => {\n R(r) && c.current && (f.current = null, u && r.persist(), P.current ? L?.(r, { context: n }) : c.current && b?.(r, { context: n, reason: o ?? d.CancelledByRelease }), P.current = !1, c.current = !1, a.current !== void 0 && clearTimeout(a.current));\n },\n [u, L, b]\n ), m = h(\n (n) => (r) => {\n if (C?.(r, { context: n }), w !== !1 && f.current) {\n const o = j(r);\n if (o) {\n const B = w === !0 ? 25 : w, D = {\n x: Math.abs(o.x - f.current.x),\n y: Math.abs(o.y - f.current.y)\n };\n (D.x > B || D.y > B) && i(n)(r, d.CancelledByMovement);\n }\n }\n },\n [i, w, C]\n ), q = h(\n (n) => {\n if (e === null)\n return {};\n switch (y) {\n case l.Mouse: {\n const r = {\n onMouseDown: E(n),\n onMouseMove: m(n),\n onMouseUp: i(n)\n };\n return v && (r.onMouseLeave = (o) => {\n i(n)(o, d.CancelledOutsideElement);\n }), r;\n }\n case l.Touch:\n return {\n onTouchStart: E(n),\n onTouchMove: m(n),\n onTouchEnd: i(n)\n };\n case l.Pointer: {\n const r = {\n onPointerDown: E(n),\n onPointerMove: m(n),\n onPointerUp: i(n)\n };\n return v && (r.onPointerLeave = (o) => i(n)(o, d.CancelledOutsideElement)), r;\n }\n }\n },\n [e, i, v, y, m, E]\n );\n return g(() => {\n if (!window)\n return;\n function n(r) {\n const o = G(r);\n i()(o);\n }\n return window.addEventListener(\"mouseup\", n), window.addEventListener(\"touchend\", n), window.addEventListener(\"pointerup\", n), () => {\n window.removeEventListener(\"mouseup\", n), window.removeEventListener(\"touchend\", n), window.removeEventListener(\"pointerup\", n);\n };\n }, [i]), g(\n () => () => {\n a.current !== void 0 && clearTimeout(a.current);\n },\n []\n ), g(() => {\n T.current = e;\n }, [e]), q;\n}\nexport {\n d as LongPressCallbackReason,\n l as LongPressEventType,\n J as useLongPress\n};\n","import { Plural, plural, t, Trans } from '@lingui/macro';\nimport { useState } from 'preact/hooks';\n\nimport shortenNumber from '../utils/shorten-number';\n\nimport EmojiText from './emoji-text';\nimport Icon from './icon';\nimport RelativeTime from './relative-time';\n\nexport default function Poll({\n poll,\n lang,\n readOnly,\n refresh = () => {},\n votePoll = () => {},\n}) {\n const [uiState, setUIState] = useState('default');\n const {\n expired,\n expiresAt,\n id,\n multiple,\n options,\n ownVotes,\n voted,\n votersCount,\n votesCount,\n emojis,\n } = poll;\n const expiresAtDate = !!expiresAt && new Date(expiresAt); // Update poll at point of expiry\n // NOTE: Disable this because setTimeout runs immediately if delay is too large\n // https://stackoverflow.com/a/56718027/20838\n // useEffect(() => {\n // let timeout;\n // if (!expired && expiresAtDate) {\n // const ms = expiresAtDate.getTime() - Date.now() + 1; // +1 to give it a little buffer\n // if (ms > 0) {\n // timeout = setTimeout(() => {\n // setUIState('loading');\n // (async () => {\n // // await refresh();\n // setUIState('default');\n // })();\n // }, ms);\n // }\n // }\n // return () => {\n // clearTimeout(timeout);\n // };\n // }, [expired, expiresAtDate]);\n\n const pollVotesCount = multiple ? votersCount : votesCount;\n let roundPrecision = 0;\n\n if (pollVotesCount <= 1000) {\n roundPrecision = 0;\n } else if (pollVotesCount <= 10000) {\n roundPrecision = 1;\n } else if (pollVotesCount <= 100000) {\n roundPrecision = 2;\n }\n\n const [showResults, setShowResults] = useState(false);\n const optionsHaveVoteCounts = options.every((o) => o.votesCount !== null);\n\n return (\n \n {(showResults && optionsHaveVoteCounts) || voted || expired ? (\n <>\n
    \n {options.map((option, i) => {\n const { title, votesCount: optionVotesCount } = option;\n const ratio = pollVotesCount\n ? optionVotesCount / pollVotesCount\n : 0;\n const percentage = ratio\n ? ratio.toLocaleString(i18n.locale || undefined, {\n style: 'percent',\n maximumFractionDigits: roundPrecision,\n })\n : '0%';\n\n const isLeading =\n optionVotesCount > 0 &&\n optionVotesCount ===\n Math.max(...options.map((o) => o.votesCount));\n return (\n \n
    \n \n \n \n {voted && ownVotes.includes(i) && (\n <>\n {' '}\n \n \n )}\n
    \n \n {percentage}\n
    \n \n );\n })}\n \n {!expired && !voted && (\n {\n e.preventDefault();\n setShowResults(false);\n }}\n >\n Hide results\n \n )}\n \n ) : (\n {\n e.preventDefault();\n const form = e.target;\n const formData = new FormData(form);\n const choices = [];\n formData.forEach((value, key) => {\n if (key === 'poll') {\n choices.push(value);\n }\n });\n if (!choices.length) return;\n setUIState('loading');\n await votePoll(choices);\n setUIState('default');\n }}\n >\n
    \n {options.map((option, i) => {\n const { title } = option;\n return (\n
    \n \n
    \n );\n })}\n
    \n {!readOnly && (\n \n Vote\n \n )}\n \n )}\n

    \n {!expired && !readOnly && (\n {\n e.preventDefault();\n setUIState('loading');\n\n (async () => {\n await refresh();\n setUIState('default');\n })();\n }}\n title={t`Refresh`}\n >\n \n \n )}\n {!voted && !expired && !readOnly && optionsHaveVoteCounts && (\n {\n e.preventDefault();\n setShowResults(!showResults);\n }}\n title={showResults ? t`Hide results` : t`Show results`}\n >\n {' '}\n \n )}\n {!expired && !readOnly && ' '}\n \n {shortenNumber(votesCount)} vote\n \n }\n other={\n \n {shortenNumber(votesCount)} votes\n \n }\n />\n {!!votersCount && votersCount !== votesCount && (\n <>\n {' '}\n •{' '}\n \n {shortenNumber(votersCount)}{' '}\n voter\n \n }\n other={\n \n {shortenNumber(votersCount)}{' '}\n voters\n \n }\n />\n \n )}{' '}\n •{' '}\n {expired ? (\n !!expiresAtDate ? (\n \n Ended \n \n ) : (\n t`Ended`\n )\n ) : !!expiresAtDate ? (\n \n Ending \n \n ) : (\n t`Ending`\n )}\n

    \n \n );\n}\n","import { createContext } from 'preact';\n\nconst FilterContext = createContext();\nexport default FilterContext;\n","import mem from './mem';\nimport { getCurrentAccountID } from './store-utils';\n\nfunction _isFiltered(filtered, filterContext) {\n if (!filtered?.length) return false;\n const appliedFilters = filtered.filter((f) => {\n const { filter } = f;\n const hasContext = filter.context.includes(filterContext);\n if (!hasContext) return false;\n if (!filter.expiresAt) return hasContext;\n return new Date(filter.expiresAt) > new Date();\n });\n if (!appliedFilters.length) return false;\n const isHidden = appliedFilters.some((f) => f.filter.filterAction === 'hide');\n if (isHidden)\n return {\n action: 'hide',\n };\n const isWarn = appliedFilters.some((f) => f.filter.filterAction === 'warn');\n if (isWarn) {\n const filterTitles = appliedFilters.map((f) => f.filter.title);\n return {\n action: 'warn',\n titles: filterTitles,\n titlesStr: filterTitles.join(' • '),\n };\n }\n return false;\n}\nexport const isFiltered = mem(_isFiltered);\n\nexport function filteredItem(item, filterContext, currentAccountID) {\n const { filtered } = item;\n if (!filtered?.length) return true;\n const isSelf = currentAccountID && item.account?.id === currentAccountID;\n if (isSelf) return true;\n const filterState = isFiltered(filtered, filterContext);\n if (!filterState) return true;\n if (filterState.action === 'hide') return false;\n // item._filtered = filterState;\n return true;\n}\nexport function filteredItems(items, filterContext) {\n if (!items?.length) return [];\n if (!filterContext) return items;\n const currentAccountID = getCurrentAccountID();\n return items.filter((item) =>\n filteredItem(item, filterContext, currentAccountID),\n );\n}\n","const div = document.createElement('div');\nexport default function htmlContentLength(html) {\n if (!html) return 0;\n div.innerHTML = html;\n // .invisible spans for links\n // e.g. https://mastodon.social\n div.querySelectorAll('.invisible').forEach((el) => {\n el.remove();\n });\n return div.innerText.length;\n}\n","export const supportsTTS = 'speechSynthesis' in window;\n\nexport function speak(text, lang) {\n if (!supportsTTS) return;\n try {\n if (speechSynthesis.speaking) {\n speechSynthesis.cancel();\n }\n const utterance = new SpeechSynthesisUtterance(text);\n if (lang) utterance.lang = lang;\n speechSynthesis.speak(utterance);\n } catch (e) {\n alert(e);\n }\n}\n","import getHTMLText from './getHTMLText';\n\nfunction statusPeek(status) {\n const { spoilerText, content, poll, mediaAttachments } = status;\n let text = '';\n if (spoilerText?.trim()) {\n text += spoilerText;\n } else {\n text += getHTMLText(content);\n }\n text = text.trim();\n if (poll?.options?.length) {\n text += `\\n\\n📊:\\n${poll.options\n .map((o) => `${poll.multiple ? '▪️' : '•'} ${o.title}`)\n .join('\\n')}`;\n }\n if (mediaAttachments?.length) {\n text +=\n ' ' +\n mediaAttachments\n .map(\n (m) =>\n ({\n image: '🖼️',\n gifv: '🎞️',\n video: '📹',\n audio: '🎵',\n unknown: '',\n }[m.type] || ''),\n )\n .join('');\n }\n return text;\n}\n\nexport default statusPeek;\n","import{useRef as r,useEffect as n,useMemo as t,useState as e,useCallback as u}from\"react\";function c(e,u,c){var i=this,a=r(null),o=r(0),f=r(null),l=r([]),v=r(),m=r(),d=r(e),g=r(!0);d.current=e;var p=\"undefined\"!=typeof window,w=!u&&0!==u&&p;if(\"function\"!=typeof e)throw new TypeError(\"Expected a function\");u=+u||0;var s=!!(c=c||{}).leading,x=!(\"trailing\"in c)||!!c.trailing,h=\"maxWait\"in c,y=\"debounceOnServer\"in c&&!!c.debounceOnServer,F=h?Math.max(+c.maxWait||0,u):null;n(function(){return g.current=!0,function(){g.current=!1}},[]);var A=t(function(){var r=function(r){var n=l.current,t=v.current;return l.current=v.current=null,o.current=r,m.current=d.current.apply(t,n)},n=function(r,n){w&&cancelAnimationFrame(f.current),f.current=w?requestAnimationFrame(r):setTimeout(r,n)},t=function(r){if(!g.current)return!1;var n=r-a.current;return!a.current||n>=u||n<0||h&&r-o.current>=F},e=function(n){return f.current=null,x&&l.current?r(n):(l.current=v.current=null,m.current)},c=function r(){var c=Date.now();if(t(c))return e(c);if(g.current){var i=u-(c-a.current),f=h?Math.min(i,F-(c-o.current)):i;n(r,f)}},A=function(){if(p||y){var e=Date.now(),d=t(e);if(l.current=[].slice.call(arguments),v.current=i,a.current=e,d){if(!f.current&&g.current)return o.current=a.current,n(c,u),s?r(a.current):m.current;if(h)return n(c,u),r(a.current)}return f.current||n(c,u),m.current}};return A.cancel=function(){f.current&&(w?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=v.current=f.current=null},A.isPending=function(){return!!f.current},A.flush=function(){return f.current?e(Date.now()):m.current},A},[s,h,u,F,x,w,p,y]);return A}function i(r,n){return r===n}function a(n,t,a){var o=a&&a.equalityFn||i,f=r(n),l=e({})[1],v=c(u(function(r){f.current=r,l({})},[l]),t,a),m=r(n);return o(m.current,n)||(v(n),m.current=n),[f.current,v]}function o(r,n,t){var e=void 0===t?{}:t,u=e.leading,i=e.trailing;return c(r,n,{maxWait:n,leading:void 0===u||u,trailing:void 0===i||i})}export{a as useDebounce,c as useDebouncedCallback,o as useThrottledCallback};\n//# sourceMappingURL=index.module.js.map\n","import { useRef, useEffect, useCallback, useState, useMemo } from 'react';\n\n// This could've been more streamlined with internal state instead of abusing\n// refs to such extent, but then composing hooks and components could not opt out of unnecessary renders.\nfunction useResolvedElement(subscriber, refOrElement) {\n var lastReportRef = useRef(null);\n var refOrElementRef = useRef(null);\n refOrElementRef.current = refOrElement;\n var cbElementRef = useRef(null); // Calling re-evaluation after each render without using a dep array,\n // as the ref object's current value could've changed since the last render.\n\n useEffect(function () {\n evaluateSubscription();\n });\n var evaluateSubscription = useCallback(function () {\n var cbElement = cbElementRef.current;\n var refOrElement = refOrElementRef.current; // Ugly ternary. But smaller than an if-else block.\n\n var element = cbElement ? cbElement : refOrElement ? refOrElement instanceof Element ? refOrElement : refOrElement.current : null;\n\n if (lastReportRef.current && lastReportRef.current.element === element && lastReportRef.current.subscriber === subscriber) {\n return;\n }\n\n if (lastReportRef.current && lastReportRef.current.cleanup) {\n lastReportRef.current.cleanup();\n }\n\n lastReportRef.current = {\n element: element,\n subscriber: subscriber,\n // Only calling the subscriber, if there's an actual element to report.\n // Setting cleanup to undefined unless a subscriber returns one, as an existing cleanup function would've been just called.\n cleanup: element ? subscriber(element) : undefined\n };\n }, [subscriber]); // making sure we call the cleanup function on unmount\n\n useEffect(function () {\n return function () {\n if (lastReportRef.current && lastReportRef.current.cleanup) {\n lastReportRef.current.cleanup();\n lastReportRef.current = null;\n }\n };\n }, []);\n return useCallback(function (element) {\n cbElementRef.current = element;\n evaluateSubscription();\n }, [evaluateSubscription]);\n}\n\n// We're only using the first element of the size sequences, until future versions of the spec solidify on how\n// exactly it'll be used for fragments in multi-column scenarios:\n// From the spec:\n// > The box size properties are exposed as FrozenArray in order to support elements that have multiple fragments,\n// > which occur in multi-column scenarios. However the current definitions of content rect and border box do not\n// > mention how those boxes are affected by multi-column layout. In this spec, there will only be a single\n// > ResizeObserverSize returned in the FrozenArray, which will correspond to the dimensions of the first column.\n// > A future version of this spec will extend the returned FrozenArray to contain the per-fragment size information.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface)\n//\n// Also, testing these new box options revealed that in both Chrome and FF everything is returned in the callback,\n// regardless of the \"box\" option.\n// The spec states the following on this:\n// > This does not have any impact on which box dimensions are returned to the defined callback when the event\n// > is fired, it solely defines which box the author wishes to observe layout changes on.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)\n// I'm not exactly clear on what this means, especially when you consider a later section stating the following:\n// > This section is non-normative. An author may desire to observe more than one CSS box.\n// > In this case, author will need to use multiple ResizeObservers.\n// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)\n// Which is clearly not how current browser implementations behave, and seems to contradict the previous quote.\n// For this reason I decided to only return the requested size,\n// even though it seems we have access to results for all box types.\n// This also means that we get to keep the current api, being able to return a simple { width, height } pair,\n// regardless of box option.\nfunction extractSize(entry, boxProp, sizeType) {\n if (!entry[boxProp]) {\n if (boxProp === \"contentBoxSize\") {\n // The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec.\n // See the 6th step in the description for the RO algorithm:\n // https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h\n // > Set this.contentRect to logical this.contentBoxSize given target and observedBox of \"content-box\".\n // In real browser implementations of course these objects differ, but the width/height values should be equivalent.\n return entry.contentRect[sizeType === \"inlineSize\" ? \"width\" : \"height\"];\n }\n\n return undefined;\n } // A couple bytes smaller than calling Array.isArray() and just as effective here.\n\n\n return entry[boxProp][0] ? entry[boxProp][0][sizeType] : // TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current\n // behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.\n // @ts-ignore\n entry[boxProp][sizeType];\n}\n\nfunction useResizeObserver(opts) {\n if (opts === void 0) {\n opts = {};\n }\n\n // Saving the callback as a ref. With this, I don't need to put onResize in the\n // effect dep array, and just passing in an anonymous function without memoising\n // will not reinstantiate the hook's ResizeObserver.\n var onResize = opts.onResize;\n var onResizeRef = useRef(undefined);\n onResizeRef.current = onResize;\n var round = opts.round || Math.round; // Using a single instance throughout the hook's lifetime\n\n var resizeObserverRef = useRef();\n\n var _useState = useState({\n width: undefined,\n height: undefined\n }),\n size = _useState[0],\n setSize = _useState[1]; // In certain edge cases the RO might want to report a size change just after\n // the component unmounted.\n\n\n var didUnmount = useRef(false);\n useEffect(function () {\n didUnmount.current = false;\n return function () {\n didUnmount.current = true;\n };\n }, []); // Using a ref to track the previous width / height to avoid unnecessary renders.\n\n var previous = useRef({\n width: undefined,\n height: undefined\n }); // This block is kinda like a useEffect, only it's called whenever a new\n // element could be resolved based on the ref option. It also has a cleanup\n // function.\n\n var refCallback = useResolvedElement(useCallback(function (element) {\n // We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe.\n // This instance is also recreated when the `box` option changes, so that a new observation is fired if there was a previously observed element with a different box option.\n if (!resizeObserverRef.current || resizeObserverRef.current.box !== opts.box || resizeObserverRef.current.round !== round) {\n resizeObserverRef.current = {\n box: opts.box,\n round: round,\n instance: new ResizeObserver(function (entries) {\n var entry = entries[0];\n var boxProp = opts.box === \"border-box\" ? \"borderBoxSize\" : opts.box === \"device-pixel-content-box\" ? \"devicePixelContentBoxSize\" : \"contentBoxSize\";\n var reportedWidth = extractSize(entry, boxProp, \"inlineSize\");\n var reportedHeight = extractSize(entry, boxProp, \"blockSize\");\n var newWidth = reportedWidth ? round(reportedWidth) : undefined;\n var newHeight = reportedHeight ? round(reportedHeight) : undefined;\n\n if (previous.current.width !== newWidth || previous.current.height !== newHeight) {\n var newSize = {\n width: newWidth,\n height: newHeight\n };\n previous.current.width = newWidth;\n previous.current.height = newHeight;\n\n if (onResizeRef.current) {\n onResizeRef.current(newSize);\n } else {\n if (!didUnmount.current) {\n setSize(newSize);\n }\n }\n }\n })\n };\n }\n\n resizeObserverRef.current.instance.observe(element, {\n box: opts.box\n });\n return function () {\n if (resizeObserverRef.current) {\n resizeObserverRef.current.instance.unobserve(element);\n }\n };\n }, [opts.box, round]), opts.ref);\n return useMemo(function () {\n return {\n ref: refCallback,\n width: size.width,\n height: size.height\n };\n }, [refCallback, size.width, size.height]);\n}\n\nexport { useResizeObserver as default };\n","import { useRef } from 'preact/hooks';\nimport { useThrottledCallback } from 'use-debounce';\nimport useResizeObserver from 'use-resize-observer';\n\nexport default function useTruncated({ className = 'truncated' } = {}) {\n const ref = useRef();\n const onResize = useThrottledCallback(({ height }) => {\n if (ref.current) {\n const { scrollHeight } = ref.current;\n let truncated = scrollHeight > height;\n if (truncated) {\n const { height: _height, maxHeight } = getComputedStyle(ref.current);\n const computedHeight = parseInt(maxHeight || _height, 10);\n truncated = scrollHeight > computedHeight;\n }\n ref.current.classList.toggle(className, truncated);\n }\n }, 300);\n useResizeObserver({\n ref,\n box: 'border-box',\n onResize,\n });\n return ref;\n}\n","export default {\n public: 'earth',\n unlisted: 'group',\n private: 'lock',\n direct: 'message',\n local: 'building',\n};\n","export var styleRoot = 'kvfysmfp';\nexport var styleChild = 'ufhsfnkm';\nexport var styles = \".\".concat(styleRoot, \"{overflow:hidden;touch-action:none}.\").concat(styleChild, \"{transform-origin: 0 0}\");\n","var isSsr = typeof window === 'undefined';\nexport var isTouch = function () {\n return !isSsr && ('ontouchstart' in window || navigator.maxTouchPoints > 0);\n};\nexport var make2dTransformValue = function (_a) {\n var x = _a.x, y = _a.y, scale = _a.scale;\n return \"scale(\".concat(scale, \") translate(\").concat(x, \"px, \").concat(y, \"px)\");\n};\nexport var make3dTransformValue = function (_a) {\n var x = _a.x, y = _a.y, scale = _a.scale;\n return \"scale3d(\".concat(scale, \",\").concat(scale, \", 1) translate3d(\").concat(x, \"px, \").concat(y, \"px, 0)\");\n};\nexport var hasTranslate3DSupport = function () {\n var css = !isSsr && window.CSS;\n return css && css.supports && css.supports('transform', 'translate3d(0,0,0)');\n};\n","var min = Math.min, max = Math.max;\nexport function getOffsetBounds(_a) {\n var containerDimension = _a.containerDimension, childDimension = _a.childDimension, padding = _a.padding, centerContained = _a.centerContained;\n var diff = childDimension - containerDimension;\n if (diff + 2 * padding <= 0 && centerContained) {\n return [diff / 2, diff / 2];\n }\n else {\n return [min(diff + padding, 0) - padding, max(0, diff + padding)];\n }\n}\n","import { __assign, __extends } from \"tslib\";\nimport React, { Component, createRef, Children, cloneElement } from 'react';\nimport { styleRoot, styleChild, styles } from './styles.css';\nimport { isTouch } from '../utils';\nimport { getOffsetBounds } from './getOffsetBounds';\nvar classnames = function (base, other) {\n return other ? \"\".concat(base, \" \").concat(other) : base;\n};\nvar abs = Math.abs, min = Math.min, sqrt = Math.sqrt;\nvar isSsr = typeof window === 'undefined';\nvar isMac = isSsr ? false : /(Mac)/i.test(navigator.platform);\nvar isDragInteraction = function (i) { return i === 'drag'; };\nvar isZoomInteraction = function (i) { return i === 'zoom'; };\nvar isZoomGesture = function (wheelEvent) { return isMac && wheelEvent.ctrlKey; };\nvar cancelEvent = function (event) {\n event.stopPropagation();\n event.preventDefault();\n};\nvar getDistance = function (a, b) {\n var x = a.x - b.x;\n var y = a.y - b.y;\n return sqrt(x * x + y * y);\n};\nvar calculateScale = function (startTouches, endTouches) {\n var startDistance = getDistance(startTouches[0], startTouches[1]);\n var endDistance = getDistance(endTouches[0], endTouches[1]);\n return endDistance / startDistance;\n};\nvar isCloseTo = function (value, expected) {\n return value > expected - 0.01 && value < expected + 0.01;\n};\nvar swing = function (p) { return -Math.cos(p * Math.PI) / 2 + 0.5; };\nvar getPointByPageCoordinates = function (touch) { return ({\n x: touch.pageX,\n y: touch.pageY,\n}); };\nvar getPageCoordinatesByTouches = function (touches) {\n return Array.from(touches).map(getPointByPageCoordinates);\n};\nvar sum = function (a, b) { return a + b; };\nvar getVectorAvg = function (vectors) { return ({\n x: vectors.map(function (_a) {\n var x = _a.x;\n return x;\n }).reduce(sum, 0) / vectors.length,\n y: vectors.map(function (_a) {\n var y = _a.y;\n return y;\n }).reduce(sum, 0) / vectors.length,\n}); };\nvar clamp = function (min, max, value) {\n return value < min ? min : value > max ? max : value;\n};\nvar shouldInterceptWheel = function (event) {\n return !(event.ctrlKey || event.metaKey);\n};\nvar getElementSize = function (element) {\n if (element) {\n var offsetWidth = element.offsetWidth, offsetHeight = element.offsetHeight;\n // Any DOMElement\n if (offsetWidth && offsetHeight) {\n return { width: offsetWidth, height: offsetHeight };\n }\n // Svg support\n var style = getComputedStyle(element);\n var width = parseFloat(style.width);\n var height = parseFloat(style.height);\n if (height && width) {\n return { width: width, height: height };\n }\n }\n return { width: 0, height: 0 };\n};\nvar calculateVelocity = function (startPoint, endPoint) { return ({\n x: endPoint.x - startPoint.x,\n y: endPoint.y - startPoint.y,\n}); };\nvar comparePoints = function (p1, p2) { return p1.x === p2.x && p1.y === p2.y; };\nvar noup = function () { };\nvar zeroPoint = { x: 0, y: 0 };\nvar PinchZoom = /** @class */ (function (_super) {\n __extends(PinchZoom, _super);\n function PinchZoom() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._prevDragMovePoint = null;\n _this._containerObserver = null;\n _this._fingers = 0;\n _this._firstMove = true;\n _this._initialOffset = __assign({}, zeroPoint);\n _this._interaction = null;\n _this._isDoubleTap = false;\n _this._isOffsetsSet = false;\n _this._lastDragPosition = null;\n _this._lastScale = 1;\n _this._lastTouchStart = 0;\n _this._lastZoomCenter = null;\n _this._listenMouseMove = false;\n _this._nthZoom = 0;\n _this._offset = __assign({}, zeroPoint);\n _this._startOffset = __assign({}, zeroPoint);\n _this._startTouches = null;\n _this._updatePlaned = false;\n _this._wheelTimeOut = null;\n _this._zoomFactor = 1;\n _this._initialZoomFactor = 1;\n _this._draggingPoint = __assign({}, zeroPoint);\n // It help reduce behavior difference between touch and mouse events\n _this._ignoreNextClick = false;\n // @ts-ignore\n _this._containerRef = createRef();\n _this._handleClick = function (clickEvent) {\n if (_this._ignoreNextClick) {\n _this._ignoreNextClick = false;\n clickEvent.stopPropagation();\n }\n };\n _this._onResize = function () {\n var _a;\n if ((_a = _this._containerRef) === null || _a === void 0 ? void 0 : _a.current) {\n _this._updateInitialZoomFactor();\n _this._setupOffsets();\n _this._update();\n }\n };\n _this._handlerOnTouchEnd = _this._handlerIfEnable(function (touchEndEvent) {\n _this._fingers = touchEndEvent.touches.length;\n if (_this.props.shouldCancelHandledTouchEndEvents &&\n (isZoomInteraction(_this._interaction) ||\n (isDragInteraction(_this._interaction) &&\n (_this._startOffset.x !== _this._offset.x ||\n _this._startOffset.y !== _this._offset.y)))) {\n cancelEvent(touchEndEvent);\n }\n if (isDragInteraction(_this._interaction) && !_this._enoughToDrag()) {\n _this._handleClick(touchEndEvent);\n }\n _this._updateInteraction(touchEndEvent);\n });\n _this._handlerOnTouchStart = _this._handlerIfEnable(function (touchStartEvent) {\n _this._firstMove = true;\n _this._fingers = touchStartEvent.touches.length;\n _this._detectDoubleTap(touchStartEvent);\n });\n _this._handlerOnTouchMove = _this._handlerIfEnable(function (touchMoveEvent) {\n if (_this._isDoubleTap) {\n return;\n }\n _this._collectInertia(touchMoveEvent);\n if (_this._firstMove) {\n _this._updateInteraction(touchMoveEvent);\n if (_this._interaction) {\n cancelEvent(touchMoveEvent);\n }\n _this._startOffset = __assign({}, _this._offset);\n _this._startTouches = getPageCoordinatesByTouches(touchMoveEvent.touches);\n }\n else {\n if (isZoomInteraction(_this._interaction)) {\n if (_this._startTouches &&\n _this._startTouches.length === 2 &&\n touchMoveEvent.touches.length === 2) {\n _this._handleZoom(touchMoveEvent, calculateScale(_this._startTouches, getPageCoordinatesByTouches(touchMoveEvent.touches)));\n }\n }\n else if (isDragInteraction(_this._interaction)) {\n _this._handleDrag(touchMoveEvent);\n }\n if (_this._interaction) {\n cancelEvent(touchMoveEvent);\n _this._update();\n }\n }\n _this._firstMove = false;\n });\n _this._handlerWheel = function (wheelEvent) {\n if (_this.props.shouldInterceptWheel(wheelEvent)) {\n return;\n }\n cancelEvent(wheelEvent);\n var pageX = wheelEvent.pageX, pageY = wheelEvent.pageY, deltaY = wheelEvent.deltaY, deltaMode = wheelEvent.deltaMode;\n var scaleDelta = 1;\n if (isZoomGesture(wheelEvent) || deltaMode === 1) {\n scaleDelta = 15;\n }\n var likeTouchEvent = {\n touches: [\n // @ts-ignore\n { pageX: pageX, pageY: pageY },\n ],\n };\n var center = _this._getOffsetByFirstTouch(likeTouchEvent);\n var dScale = deltaY * scaleDelta;\n _this._stopAnimation();\n _this._scaleTo(_this._zoomFactor - dScale / _this.props.wheelScaleFactor, center);\n _this._update();\n clearTimeout(\n // @ts-ignore\n _this._wheelTimeOut);\n _this._wheelTimeOut = setTimeout(function () { return _this._sanitize(); }, 100);\n };\n // @ts-ignore\n _this._handlers = _this.props.isTouch()\n ? [\n ['touchstart', _this._handlerOnTouchStart],\n ['touchend', _this._handlerOnTouchEnd],\n ['touchmove', _this._handlerOnTouchMove],\n ]\n : [\n [\n 'mousemove',\n _this.simulate(_this._handlerOnTouchMove),\n _this.props._document,\n ],\n [\n 'mouseup',\n _this.simulate(_this._handlerOnTouchEnd),\n _this.props._document,\n ],\n ['mousedown', _this.simulate(_this._handlerOnTouchStart)],\n ['click', _this._handleClick],\n ['wheel', _this._handlerWheel],\n ];\n return _this;\n }\n PinchZoom.prototype._handleDragStart = function (event) {\n this._ignoreNextClick = true;\n this.props.onDragStart();\n this._stopAnimation();\n this._resetInertia();\n this._lastDragPosition = null;\n this._hasInteraction = true;\n this._draggingPoint = this._offset;\n this._handleDrag(event);\n };\n PinchZoom.prototype._handleDrag = function (event) {\n var touch = this._getOffsetByFirstTouch(event);\n if (this._enoughToDrag()) {\n this._drag(touch, this._lastDragPosition);\n }\n else {\n this._virtualDrag(touch, this._lastDragPosition);\n }\n this._offset = this._sanitizeOffset(this._offset);\n this._lastDragPosition = touch;\n };\n PinchZoom.prototype._resetInertia = function () {\n this._velocity = null;\n this._prevDragMovePoint = null;\n };\n PinchZoom.prototype._realizeInertia = function () {\n var _this = this;\n var _a = this.props, inertiaFriction = _a.inertiaFriction, inertia = _a.inertia;\n if (!inertia || !this._velocity) {\n return;\n }\n var _b = this._velocity, x = _b.x, y = _b.y;\n if (x || y) {\n this._stopAnimation();\n this._resetInertia();\n var renderFrame = function () {\n x *= inertiaFriction;\n y *= inertiaFriction;\n if (!x && !y) {\n return _this._stopAnimation();\n }\n var prevOffset = __assign({}, _this._offset);\n _this._addOffset({ x: x, y: y });\n _this._offset = _this._sanitizeOffset(_this._offset);\n if (comparePoints(prevOffset, _this._offset)) {\n return _this._stopAnimation();\n }\n _this._update({ isAnimation: true });\n };\n this._animate(renderFrame, { duration: 9999 });\n }\n };\n PinchZoom.prototype._collectInertia = function (_a) {\n var touches = _a.touches;\n if (!this.props.inertia) {\n return;\n }\n var currentCoordinates = getPageCoordinatesByTouches(touches)[0];\n var prevPoint = this._prevDragMovePoint;\n if (prevPoint) {\n this._velocity = calculateVelocity(currentCoordinates, prevPoint);\n }\n this._prevDragMovePoint = currentCoordinates;\n };\n PinchZoom.prototype._handleDragEnd = function () {\n this.props.onDragEnd();\n this._end();\n this._realizeInertia();\n };\n PinchZoom.prototype._handleZoomStart = function () {\n this.props.onZoomStart();\n this._stopAnimation();\n this._lastScale = 1;\n this._nthZoom = 0;\n this._lastZoomCenter = null;\n this._hasInteraction = true;\n };\n PinchZoom.prototype._handleZoom = function (event, newScale) {\n var touchCenter = getVectorAvg(this._getOffsetTouches(event));\n var scale = newScale / this._lastScale;\n this._lastScale = newScale;\n // The first touch events are thrown away since they are not precise\n this._nthZoom += 1;\n if (this._nthZoom > 3) {\n this._scale(scale, touchCenter);\n this._drag(touchCenter, this._lastZoomCenter);\n if (this.props.enforceBoundsDuringZoom) {\n this._offset = this._sanitizeOffset(this._offset);\n }\n }\n this._lastZoomCenter = touchCenter;\n };\n PinchZoom.prototype._handleZoomEnd = function () {\n this.props.onZoomEnd();\n this._end();\n };\n PinchZoom.prototype._handleDoubleTap = function (event) {\n var _this = this;\n if (this._hasInteraction || this.props.tapZoomFactor === 0) {\n return;\n }\n var needZoomOut = (this.props.doubleTapZoomOutOnMaxScale &&\n this._zoomFactor === this.props.maxZoom) ||\n (this.props.doubleTapToggleZoom && this._zoomFactor > 1);\n this.props.onDoubleTap();\n this._ignoreNextClick = true;\n var zoomFactor = this._zoomFactor + this.props.tapZoomFactor;\n var startZoomFactor = this._zoomFactor;\n var updateProgress = function (progress) {\n _this._scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);\n };\n var center = this._getOffsetByFirstTouch(event);\n this._isDoubleTap = true;\n if (startZoomFactor > zoomFactor) {\n center = this._getCurrentZoomCenter();\n }\n needZoomOut ? this._zoomOutAnimation() : this._animate(updateProgress);\n };\n PinchZoom.prototype._computeInitialOffset = function () {\n var rect = this._getContainerRect();\n var _a = this._getChildSize(), width = _a.width, height = _a.height;\n var x = -abs(width * this._getInitialZoomFactor() - rect.width) / 2;\n var y = -abs(height * this._getInitialZoomFactor() - rect.height) / 2;\n this._initialOffset = { x: x, y: y };\n };\n PinchZoom.prototype._resetOffset = function () {\n this._offset = __assign({}, this._initialOffset);\n };\n PinchZoom.prototype._setupOffsets = function () {\n if (this.props.setOffsetsOnce && this._isOffsetsSet) {\n return;\n }\n this._isOffsetsSet = true;\n this._computeInitialOffset();\n this._resetOffset();\n };\n PinchZoom.prototype._sanitizeOffset = function (offset) {\n var rect = this._getContainerRect();\n var _a = this._getChildSize(), width = _a.width, height = _a.height;\n var elWidth = width * this._getInitialZoomFactor() * this._zoomFactor;\n var elHeight = height * this._getInitialZoomFactor() * this._zoomFactor;\n var _b = getOffsetBounds({\n containerDimension: rect.width,\n childDimension: elWidth,\n padding: this.props.horizontalPadding,\n centerContained: this.props.centerContained,\n }), minOffsetX = _b[0], maxOffsetX = _b[1];\n var _c = getOffsetBounds({\n containerDimension: rect.height,\n childDimension: elHeight,\n padding: this.props.verticalPadding,\n centerContained: this.props.centerContained,\n }), minOffsetY = _c[0], maxOffsetY = _c[1];\n return {\n x: clamp(minOffsetX, maxOffsetX, offset.x),\n y: clamp(minOffsetY, maxOffsetY, offset.y),\n };\n };\n PinchZoom.prototype.alignCenter = function (options) {\n var _this = this;\n var _a = __assign({ duration: 250, animated: true }, options), __x = _a.x, __y = _a.y, scale = _a.scale, animated = _a.animated, duration = _a.duration;\n // Bug-Fix: https://github.com/retyui/react-quick-pinch-zoom/issues/58\n var x = __x * this._initialZoomFactor;\n var y = __y * this._initialZoomFactor;\n var startZoomFactor = this._zoomFactor;\n var startOffset = __assign({}, this._offset);\n var rect = this._getContainerRect();\n var containerCenter = { x: rect.width / 2, y: rect.height / 2 };\n this._zoomFactor = 1;\n this._offset = { x: -(containerCenter.x - x), y: -(containerCenter.y - y) };\n this._scaleTo(scale, containerCenter);\n this._stopAnimation();\n if (!animated) {\n return this._update();\n }\n var diffZoomFactor = this._zoomFactor - startZoomFactor;\n var diffOffset = {\n x: this._offset.x - startOffset.x,\n y: this._offset.y - startOffset.y,\n };\n this._zoomFactor = startZoomFactor;\n this._offset = __assign({}, startOffset);\n var updateFrame = function (progress) {\n var x = startOffset.x + diffOffset.x * progress;\n var y = startOffset.y + diffOffset.y * progress;\n _this._zoomFactor = startZoomFactor + diffZoomFactor * progress;\n _this._offset = _this._sanitizeOffset({ x: x, y: y });\n _this._update();\n };\n this._animate(updateFrame, {\n callback: function () { return _this._sanitize(); },\n duration: duration,\n });\n };\n PinchZoom.prototype.scaleTo = function (options) {\n var _this = this;\n var _a = __assign({ duration: 250, animated: true }, options), x = _a.x, y = _a.y, scale = _a.scale, animated = _a.animated, duration = _a.duration;\n var startZoomFactor = this._zoomFactor;\n var startOffset = __assign({}, this._offset);\n this._zoomFactor = 1;\n this._offset = { x: 0, y: 0 };\n this._scaleTo(scale, { x: x, y: y });\n this._stopAnimation();\n if (!animated) {\n return this._update();\n }\n var diffZoomFactor = this._zoomFactor - startZoomFactor;\n var diffOffset = {\n x: this._offset.x - startOffset.x,\n y: this._offset.y - startOffset.y,\n };\n this._zoomFactor = startZoomFactor;\n this._offset = __assign({}, startOffset);\n var updateFrame = function (progress) {\n var x = startOffset.x + diffOffset.x * progress;\n var y = startOffset.y + diffOffset.y * progress;\n _this._zoomFactor = startZoomFactor + diffZoomFactor * progress;\n _this._offset = { x: x, y: y };\n _this._update();\n };\n this._animate(updateFrame, { callback: function () { return _this._sanitize(); }, duration: duration });\n };\n PinchZoom.prototype._scaleTo = function (zoomFactor, center) {\n this._scale(zoomFactor / this._zoomFactor, center);\n this._offset = this._sanitizeOffset(this._offset);\n };\n PinchZoom.prototype._scale = function (scale, center) {\n scale = this._scaleZoomFactor(scale);\n this._addOffset({\n x: (scale - 1) * (center.x + this._offset.x),\n y: (scale - 1) * (center.y + this._offset.y),\n });\n this.props.onZoomUpdate();\n };\n PinchZoom.prototype._scaleZoomFactor = function (scale) {\n var originalZoomFactor = this._zoomFactor;\n this._zoomFactor *= scale;\n this._zoomFactor = clamp(this.props.minZoom, this.props.maxZoom, this._zoomFactor);\n return this._zoomFactor / originalZoomFactor;\n };\n PinchZoom.prototype._canDrag = function () {\n return this.props.draggableUnZoomed || !isCloseTo(this._zoomFactor, 1);\n };\n PinchZoom.prototype._drag = function (center, lastCenter) {\n if (lastCenter) {\n var y = -(center.y - lastCenter.y);\n var x = -(center.x - lastCenter.x);\n if (!this.props.lockDragAxis) {\n this._addOffset({\n x: x,\n y: y,\n });\n }\n else {\n // lock scroll to position that was changed the most\n if (abs(x) > abs(y)) {\n this._addOffset({\n x: x,\n y: 0,\n });\n }\n else {\n this._addOffset({\n y: y,\n x: 0,\n });\n }\n }\n this.props.onDragUpdate();\n }\n };\n PinchZoom.prototype._virtualDrag = function (center, lastCenter) {\n if (lastCenter) {\n var y = -(center.y - lastCenter.y);\n var x = -(center.x - lastCenter.x);\n this._draggingPoint = {\n x: x + this._draggingPoint.x,\n y: y + this._draggingPoint.y,\n };\n }\n };\n PinchZoom.prototype._addOffset = function (offset) {\n var _a = this._offset, x = _a.x, y = _a.y;\n this._offset = {\n x: x + offset.x,\n y: y + offset.y,\n };\n };\n PinchZoom.prototype._sanitize = function () {\n if (this._zoomFactor < this.props.zoomOutFactor) {\n this._resetInertia();\n this._zoomOutAnimation();\n }\n else if (this._isInsaneOffset()) {\n this._sanitizeOffsetAnimation();\n }\n };\n PinchZoom.prototype._isInsaneOffset = function () {\n var offset = this._offset;\n var sanitizedOffset = this._sanitizeOffset(offset);\n return sanitizedOffset.x !== offset.x || sanitizedOffset.y !== offset.y;\n };\n PinchZoom.prototype._sanitizeOffsetAnimation = function () {\n var _this = this;\n var targetOffset = this._sanitizeOffset(this._offset);\n var startOffset = __assign({}, this._offset);\n var updateProgress = function (progress) {\n var x = startOffset.x + progress * (targetOffset.x - startOffset.x);\n var y = startOffset.y + progress * (targetOffset.y - startOffset.y);\n _this._offset = { x: x, y: y };\n _this._update();\n };\n this._animate(updateProgress);\n };\n PinchZoom.prototype._zoomOutAnimation = function () {\n var _this = this;\n if (this._zoomFactor === 1) {\n return;\n }\n var startZoomFactor = this._zoomFactor;\n var zoomFactor = 1;\n var center = this._getCurrentZoomCenter();\n var updateProgress = function (progress) {\n var scaleFactor = startZoomFactor + progress * (zoomFactor - startZoomFactor);\n _this._scaleTo(scaleFactor, center);\n };\n this._animate(updateProgress);\n };\n PinchZoom.prototype._getInitialZoomFactor = function () {\n return this._initialZoomFactor;\n };\n PinchZoom.prototype._getCurrentZoomCenter = function () {\n var _a = this._offset, x = _a.x, y = _a.y;\n var offsetLeft = x - this._initialOffset.x;\n var offsetTop = y - this._initialOffset.y;\n return {\n x: -1 * x - offsetLeft / (1 / this._zoomFactor - 1),\n y: -1 * y - offsetTop / (1 / this._zoomFactor - 1),\n };\n };\n PinchZoom.prototype._getOffsetByFirstTouch = function (event) {\n return this._getOffsetTouches(event)[0];\n };\n PinchZoom.prototype._getOffsetTouches = function (event) {\n var _document = this.props._document;\n var _html = _document.documentElement;\n var _body = _document.body;\n var _a = this._getContainerRect(), top = _a.top, left = _a.left;\n var scrollTop = _html.scrollTop || _body.scrollTop;\n var scrollLeft = _html.scrollLeft || _body.scrollLeft;\n var posTop = top + scrollTop;\n var posLeft = left + scrollLeft;\n return getPageCoordinatesByTouches(event.touches).map(function (_a) {\n var x = _a.x, y = _a.y;\n return ({\n x: x - posLeft,\n y: y - posTop,\n });\n });\n };\n PinchZoom.prototype._animate = function (frameFn, options) {\n var _this = this;\n var startTime = new Date().getTime();\n var _a = __assign({ timeFn: swing, callback: function () { }, duration: this.props.animationDuration }, options), timeFn = _a.timeFn, callback = _a.callback, duration = _a.duration;\n var renderFrame = function () {\n if (!_this._inAnimation) {\n return;\n }\n var frameTime = new Date().getTime() - startTime;\n var progress = frameTime / duration;\n if (frameTime >= duration) {\n frameFn(1);\n _this._stopAnimation();\n callback();\n _this._update();\n }\n else {\n progress = timeFn(progress);\n frameFn(progress);\n _this._update({ isAnimation: true });\n requestAnimationFrame(renderFrame);\n }\n };\n this._inAnimation = true;\n requestAnimationFrame(renderFrame);\n };\n PinchZoom.prototype._stopAnimation = function () {\n this._inAnimation = false;\n };\n PinchZoom.prototype._end = function () {\n this._hasInteraction = false;\n this._sanitize();\n this._update();\n };\n PinchZoom.prototype._getContainerRect = function () {\n var div = this._containerRef.current;\n return div.getBoundingClientRect();\n };\n PinchZoom.prototype._getChildSize = function () {\n var div = this._containerRef.current;\n return getElementSize(div === null || div === void 0 ? void 0 : div.firstElementChild);\n };\n PinchZoom.prototype._updateInitialZoomFactor = function () {\n var rect = this._getContainerRect();\n var size = this._getChildSize();\n var xZoomFactor = rect.width / size.width;\n var yZoomFactor = rect.height / size.height;\n this._initialZoomFactor = min(xZoomFactor, yZoomFactor);\n };\n PinchZoom.prototype._bindEvents = function () {\n var _this = this;\n var div = this._containerRef.current;\n if (window.ResizeObserver) {\n this._containerObserver = new ResizeObserver(this._onResize);\n this._containerObserver.observe(div);\n }\n else {\n window.addEventListener('resize', this._onResize);\n }\n this._handlers.forEach(function (_a) {\n var eventName = _a[0], fn = _a[1], target = _a[2];\n (target || div).addEventListener(eventName, fn, true);\n });\n Array.from(div.querySelectorAll('img')).forEach(function (img) {\n return img.addEventListener('load', _this._onResize);\n });\n };\n PinchZoom.prototype._unSubscribe = function () {\n var _this = this;\n var div = this._containerRef.current;\n if (this._containerObserver) {\n this._containerObserver.disconnect();\n this._containerObserver = null;\n }\n window.removeEventListener('resize', this._onResize);\n this._handlers.forEach(function (_a) {\n var eventName = _a[0], fn = _a[1], target = _a[2];\n (target || div).removeEventListener(eventName, fn, true);\n });\n Array.from(div.querySelectorAll('img')).forEach(function (img) {\n return img.removeEventListener('load', _this._onResize);\n });\n };\n PinchZoom.prototype._update = function (options) {\n var _this = this;\n if (this._updatePlaned) {\n return;\n }\n var updateFrame = function () {\n var scale = _this._getInitialZoomFactor() * _this._zoomFactor;\n var x = -_this._offset.x / scale;\n var y = -_this._offset.y / scale;\n _this.props.onUpdate({ scale: scale, x: x, y: y });\n };\n if (options === null || options === void 0 ? void 0 : options.isAnimation) {\n return updateFrame();\n }\n this._updatePlaned = true;\n requestAnimationFrame(function () {\n _this._updatePlaned = false;\n updateFrame();\n });\n };\n PinchZoom.prototype._handlerIfEnable = function (fn) {\n var _this = this;\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (_this.props.enabled) {\n fn.apply(void 0, args);\n }\n };\n };\n PinchZoom.prototype._setInteraction = function (newInteraction, event) {\n var interaction = this._interaction;\n if (interaction !== newInteraction) {\n if (interaction && !newInteraction) {\n if (isZoomInteraction(interaction)) {\n this._handleZoomEnd();\n }\n else if (isDragInteraction(interaction)) {\n this._handleDragEnd();\n }\n }\n if (isZoomInteraction(newInteraction)) {\n this._handleZoomStart();\n }\n else if (isDragInteraction(newInteraction)) {\n this._handleDragStart(event);\n }\n }\n this._interaction = newInteraction;\n };\n PinchZoom.prototype._distanceBetweenNumbers = function (a, b) {\n return a > b ? a - b : b - a;\n };\n PinchZoom.prototype._enoughToDrag = function () {\n if (this._distanceBetweenNumbers(this._startOffset.x, this._draggingPoint.x) >\n 5 ||\n this._distanceBetweenNumbers(this._startOffset.y, this._draggingPoint.y) >\n 5)\n return true;\n return false;\n };\n PinchZoom.prototype._updateInteraction = function (event) {\n var fingers = this._fingers;\n if (fingers === 2) {\n return this._setInteraction('zoom', event);\n }\n if (fingers === 1 && this._canDrag()) {\n return this._setInteraction('drag', event);\n }\n this._setInteraction(null, event);\n };\n PinchZoom.prototype._detectDoubleTap = function (event) {\n var time = new Date().getTime();\n if (this._fingers > 1) {\n this._lastTouchStart = 0;\n }\n if (time - this._lastTouchStart < 300) {\n cancelEvent(event);\n this._handleDoubleTap(event);\n if (isZoomInteraction(this._interaction)) {\n this._handleZoomEnd();\n }\n else if (isDragInteraction(this._interaction)) {\n this._handleDragEnd();\n }\n }\n else {\n this._isDoubleTap = false;\n }\n if (this._fingers === 1) {\n this._lastTouchStart = time;\n }\n };\n PinchZoom.prototype.simulate = function (fn) {\n var _this = this;\n return function (mouseEvent) {\n var pageX = mouseEvent.pageX, pageY = mouseEvent.pageY, type = mouseEvent.type;\n var isEnd = type === 'mouseup';\n var isStart = type === 'mousedown';\n if (isStart) {\n mouseEvent.preventDefault();\n _this._listenMouseMove = true;\n }\n if (_this._listenMouseMove) {\n // @ts-ignore\n mouseEvent.touches = isEnd ? [] : [{ pageX: pageX, pageY: pageY }];\n fn(\n // @ts-ignore\n mouseEvent);\n }\n if (isEnd) {\n _this._listenMouseMove = false;\n }\n };\n };\n PinchZoom.prototype.componentDidMount = function () {\n this._bindEvents();\n this._update();\n };\n PinchZoom.prototype.componentWillUnmount = function () {\n this._stopAnimation();\n this._unSubscribe();\n };\n PinchZoom.prototype.render = function () {\n var _a = this.props, children = _a.children, containerProps = _a.containerProps;\n var child = Children.only(children);\n var props = containerProps || {};\n return (React.createElement(React.Fragment, null,\n React.createElement(\"style\", null, styles),\n React.createElement(\"div\", __assign({}, props, { ref: this._containerRef, className: classnames(styleRoot, props.className) }), cloneElement(child, {\n className: classnames(styleChild, child.props.className),\n }))));\n };\n PinchZoom.defaultProps = {\n animationDuration: 250,\n draggableUnZoomed: true,\n enforceBoundsDuringZoom: false,\n centerContained: false,\n enabled: true,\n inertia: true,\n inertiaFriction: 0.96,\n horizontalPadding: 0,\n isTouch: isTouch,\n lockDragAxis: false,\n maxZoom: 5,\n minZoom: 0.5,\n onDoubleTap: noup,\n onDragEnd: noup,\n onDragStart: noup,\n onDragUpdate: noup,\n onZoomEnd: noup,\n onZoomStart: noup,\n onZoomUpdate: noup,\n setOffsetsOnce: false,\n shouldInterceptWheel: shouldInterceptWheel,\n shouldCancelHandledTouchEndEvents: false,\n tapZoomFactor: 1,\n verticalPadding: 0,\n wheelScaleFactor: 1500,\n zoomOutFactor: 1.3,\n doubleTapZoomOutOnMaxScale: false,\n doubleTapToggleZoom: false,\n // @ts-expect-error\n _document: isSsr ? null : window.document,\n };\n return PinchZoom;\n}(Component));\nif (process.env.NODE_ENV !== 'production') {\n var _a = require('prop-types'), any = _a.any, element = _a.element, object = _a.object, number = _a.number, func = _a.func, bool = _a.bool;\n // @ts-ignore\n PinchZoom.propTypes = {\n children: element,\n containerProps: object,\n wheelScaleFactor: number,\n animationDuration: number,\n draggableUnZoomed: bool,\n enforceBoundsDuringZoom: bool,\n centerContained: bool,\n enabled: bool,\n horizontalPadding: number,\n lockDragAxis: bool,\n onUpdate: func.isRequired,\n maxZoom: number,\n minZoom: number,\n onDoubleTap: func,\n onDragEnd: func,\n onDragStart: func,\n onDragUpdate: func,\n onZoomEnd: func,\n onZoomStart: func,\n onZoomUpdate: func,\n setOffsetsOnce: bool,\n tapZoomFactor: number,\n verticalPadding: number,\n zoomOutFactor: number,\n doubleTapZoomOutOnMaxScale: bool,\n doubleTapToggleZoom: bool,\n isTouch: func,\n _document: any,\n };\n}\nexport default PinchZoom;\n","export default function formatDuration(time) {\n if (!time) return;\n let hours = Math.floor(time / 3600);\n let minutes = Math.floor((time % 3600) / 60);\n let seconds = Math.round(time % 60);\n\n if (hours === 0) {\n return `${minutes}:${seconds.toString().padStart(2, '0')}`;\n } else {\n return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds\n .toString()\n .padStart(2, '0')}`;\n }\n}\n","import { t, Trans } from '@lingui/macro';\nimport { getBlurHashAverageColor } from 'fast-blurhash';\nimport { Fragment } from 'preact';\nimport { memo } from 'preact/compat';\nimport {\n useCallback,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks';\nimport QuickPinchZoom, { make3dTransformValue } from 'react-quick-pinch-zoom';\n\nimport formatDuration from '../utils/format-duration';\nimport mem from '../utils/mem';\nimport states from '../utils/states';\n\nimport Icon from './icon';\nimport Link from './link';\n\nconst isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // https://stackoverflow.com/a/23522755\n\n/*\nMedia type\n===\nunknown = unsupported or unrecognized file type\nimage = Static image\ngifv = Looping, soundless animation\nvideo = Video clip\naudio = Audio track\n*/\n\nconst dataAltLabel = 'ALT';\nconst AltBadge = (props) => {\n const { alt, lang, index, ...rest } = props;\n if (!alt || !alt.trim()) return null;\n return (\n {\n e.stopPropagation();\n e.preventDefault();\n states.showMediaAlt = {\n alt,\n lang,\n };\n }}\n title={t`Media description`}\n >\n {dataAltLabel}\n {!!index && {index}}\n \n );\n};\n\nconst MEDIA_CAPTION_LIMIT = 140;\nconst MEDIA_CAPTION_LIMIT_LONGER = 280;\nexport const isMediaCaptionLong = mem((caption) =>\n caption?.length\n ? caption.length > MEDIA_CAPTION_LIMIT ||\n /[\\n\\r].*[\\n\\r]/.test(caption.trim())\n : false,\n);\n\nfunction Media({\n class: className = '',\n media,\n to,\n lang,\n showOriginal,\n autoAnimate,\n showCaption,\n allowLongerCaption,\n altIndex,\n checkAspectRatio = true,\n onClick = () => {},\n}) {\n let {\n blurhash,\n description,\n meta,\n previewRemoteUrl,\n previewUrl,\n remoteUrl,\n url,\n type,\n } = media;\n if (/no\\-preview\\./i.test(previewUrl)) {\n previewUrl = null;\n }\n const { original = {}, small, focus } = meta || {};\n\n const width = showOriginal\n ? original?.width\n : small?.width || original?.width;\n const height = showOriginal\n ? original?.height\n : small?.height || original?.height;\n const mediaURL = showOriginal ? url : previewUrl || url;\n const remoteMediaURL = showOriginal\n ? remoteUrl\n : previewRemoteUrl || remoteUrl;\n const hasDimensions = width && height;\n const orientation = hasDimensions\n ? width > height\n ? 'landscape'\n : 'portrait'\n : null;\n\n const rgbAverageColor = blurhash ? getBlurHashAverageColor(blurhash) : null;\n\n const videoRef = useRef();\n\n let focalPosition;\n if (focus) {\n // Convert focal point to CSS background position\n // Formula from jquery-focuspoint\n // x = -1, y = 1 => 0% 0%\n // x = 0, y = 0 => 50% 50%\n // x = 1, y = -1 => 100% 100%\n const x = ((focus.x + 1) / 2) * 100;\n const y = ((1 - focus.y) / 2) * 100;\n focalPosition = `${x.toFixed(0)}% ${y.toFixed(0)}%`;\n }\n\n const mediaRef = useRef();\n const onUpdate = useCallback(({ x, y, scale }) => {\n const { current: media } = mediaRef;\n\n if (media) {\n const value = make3dTransformValue({ x, y, scale });\n\n if (scale === 1) {\n media.style.removeProperty('transform');\n } else {\n media.style.setProperty('transform', value);\n }\n\n media.closest('.media-zoom').style.touchAction =\n scale <= 1.01 ? 'pan-x' : '';\n }\n }, []);\n\n const [pinchZoomEnabled, setPinchZoomEnabled] = useState(false);\n const quickPinchZoomProps = {\n enabled: pinchZoomEnabled,\n draggableUnZoomed: false,\n inertiaFriction: 0.9,\n tapZoomFactor: 2,\n doubleTapToggleZoom: true,\n containerProps: {\n className: 'media-zoom',\n style: {\n overflow: 'visible',\n // width: 'inherit',\n // height: 'inherit',\n // justifyContent: 'inherit',\n // alignItems: 'inherit',\n // display: 'inherit',\n },\n },\n onUpdate,\n };\n\n const Parent = useMemo(\n () => (to ? (props) => : 'div'),\n [to],\n );\n\n const remoteMediaURLObj = remoteMediaURL ? getURLObj(remoteMediaURL) : null;\n const isVideoMaybe =\n type === 'unknown' &&\n remoteMediaURLObj &&\n /\\.(mp4|m4r|m4v|mov|webm)$/i.test(remoteMediaURLObj.pathname);\n const isAudioMaybe =\n type === 'unknown' &&\n remoteMediaURLObj &&\n /\\.(mp3|ogg|wav|m4a|m4p|m4b)$/i.test(remoteMediaURLObj.pathname);\n const isImage =\n type === 'image' ||\n (type === 'unknown' && previewUrl && !isVideoMaybe && !isAudioMaybe);\n\n const parentRef = useRef();\n const [imageSmallerThanParent, setImageSmallerThanParent] = useState(false);\n useLayoutEffect(() => {\n if (!isImage) return;\n if (!showOriginal) return;\n if (!parentRef.current) return;\n const { offsetWidth, offsetHeight } = parentRef.current;\n const smaller = width < offsetWidth && height < offsetHeight;\n if (smaller) setImageSmallerThanParent(smaller);\n }, [width, height]);\n\n const maxAspectHeight =\n window.innerHeight * (orientation === 'portrait' ? 0.45 : 0.33);\n const maxHeight = orientation === 'portrait' ? 0 : 160;\n const averageColorStyle = {\n '--average-color': rgbAverageColor && `rgb(${rgbAverageColor.join(',')})`,\n };\n const mediaStyles =\n width && height\n ? {\n '--width': `${width}px`,\n '--height': `${height}px`,\n // Calculate '--aspectWidth' based on aspect ratio calculated from '--width' and '--height', max height has to be 160px\n '--aspectWidth': `${\n (width / height) * Math.max(maxHeight, maxAspectHeight)\n }px`,\n aspectRatio: `${width} / ${height}`,\n ...averageColorStyle,\n }\n : {\n ...averageColorStyle,\n };\n\n const longDesc = isMediaCaptionLong(description);\n let showInlineDesc =\n !!showCaption && !showOriginal && !!description && !longDesc;\n if (\n allowLongerCaption &&\n !showInlineDesc &&\n description?.length <= MEDIA_CAPTION_LIMIT_LONGER\n ) {\n showInlineDesc = true;\n }\n const Figure = !showInlineDesc\n ? Fragment\n : (props) => {\n const { children, ...restProps } = props;\n return (\n
    \n {children}\n {\n e.preventDefault();\n e.stopPropagation();\n states.showMediaAlt = {\n alt: description,\n lang,\n };\n }}\n >\n {description}\n \n
    \n );\n };\n\n const [hasNaturalAspectRatio, setHasNaturalAspectRatio] = useState(undefined);\n\n if (isImage) {\n // Note: type: unknown might not have width/height\n quickPinchZoomProps.containerProps.style.display = 'inherit';\n\n useLayoutEffect(() => {\n if (!isSafari) return;\n if (!showOriginal) return;\n (async () => {\n try {\n await fetch(mediaURL, { mode: 'no-cors' });\n mediaRef.current.src = mediaURL;\n } catch (e) {\n // Ignore\n }\n })();\n }, [mediaURL]);\n\n return (\n
    \n \n {showOriginal ? (\n \n {\n e.target.closest('.media-image').style.backgroundImage = '';\n e.target.closest('.media-zoom').style.display = '';\n setPinchZoomEnabled(true);\n }}\n onError={(e) => {\n const { src } = e.target;\n if (\n src === mediaURL &&\n remoteMediaURL &&\n mediaURL !== remoteMediaURL\n ) {\n e.target.src = remoteMediaURL;\n }\n }}\n />\n \n ) : (\n <>\n {\n // e.target.closest('.media-image').style.backgroundImage = '';\n e.target.dataset.loaded = true;\n const $media = e.target.closest('.media');\n if (!hasDimensions && $media) {\n const { naturalWidth, naturalHeight } = e.target;\n $media.dataset.orientation =\n naturalWidth > naturalHeight ? 'landscape' : 'portrait';\n $media.style.setProperty('--width', `${naturalWidth}px`);\n $media.style.setProperty('--height', `${naturalHeight}px`);\n $media.style.aspectRatio = `${naturalWidth}/${naturalHeight}`;\n }\n\n // Check natural aspect ratio vs display aspect ratio\n if (checkAspectRatio && $media) {\n const {\n clientWidth,\n clientHeight,\n naturalWidth,\n naturalHeight,\n } = e.target;\n if (\n clientWidth &&\n clientHeight &&\n naturalWidth &&\n naturalHeight\n ) {\n const minDimension = 88;\n if (\n naturalWidth < minDimension ||\n naturalHeight < minDimension\n ) {\n $media.dataset.hasSmallDimension = true;\n } else {\n const displayNaturalHeight =\n (naturalHeight * clientWidth) / naturalWidth;\n const almostSimilarHeight =\n Math.abs(displayNaturalHeight - clientHeight) < 5;\n\n if (almostSimilarHeight) {\n setHasNaturalAspectRatio(true);\n }\n }\n }\n }\n }}\n onError={(e) => {\n const { src } = e.target;\n if (src === mediaURL && mediaURL !== remoteMediaURL) {\n e.target.src = remoteMediaURL;\n }\n }}\n />\n {!showInlineDesc && (\n \n )}\n \n )}\n \n
    \n );\n } else if (type === 'gifv' || type === 'video' || isVideoMaybe) {\n const hasDuration = original.duration > 0;\n const shortDuration = original.duration < 31;\n const isGIF = type === 'gifv' && shortDuration;\n // If GIF is too long, treat it as a video\n const loopable = original.duration < 61;\n const formattedDuration = formatDuration(original.duration);\n const hoverAnimate = !showOriginal && !autoAnimate && isGIF;\n const autoGIFAnimate = !showOriginal && autoAnimate && isGIF;\n const showProgress = original.duration > 5;\n\n // This string is only for autoplay + muted to work on Mobile Safari\n const gifHTML = `\n \n `;\n\n const videoHTML = `\n \n `;\n\n return (\n
    \n {\n if (hoverAnimate) {\n try {\n videoRef.current.pause();\n } catch (e) {}\n }\n onClick(e);\n }}\n onMouseEnter={() => {\n if (hoverAnimate) {\n try {\n videoRef.current.play();\n } catch (e) {}\n }\n }}\n onMouseLeave={() => {\n if (hoverAnimate) {\n try {\n videoRef.current.pause();\n } catch (e) {}\n }\n }}\n onFocus={() => {\n if (hoverAnimate) {\n try {\n videoRef.current.play();\n } catch (e) {}\n }\n }}\n onBlur={() => {\n if (hoverAnimate) {\n try {\n videoRef.current.pause();\n } catch (e) {}\n }\n }}\n >\n {showOriginal || autoGIFAnimate ? (\n isGIF && showOriginal ? (\n \n \n \n ) : isGIF ? (\n \n ) : (\n \n )\n ) : isGIF ? (\n {\n const { target } = e;\n const container = target?.closest('.media-gif');\n if (container) {\n const percentage =\n (target.currentTime / target.duration) * 100;\n container.style.setProperty(\n '--progress',\n `${percentage}%`,\n );\n }\n }\n : undefined\n }\n />\n ) : (\n <>\n {previewUrl ? (\n {\n if (!hasDimensions) {\n const $media = e.target.closest('.media');\n if ($media) {\n const { naturalHeight, naturalWidth } = e.target;\n $media.dataset.orientation =\n naturalWidth > naturalHeight\n ? 'landscape'\n : 'portrait';\n $media.style.setProperty(\n '--width',\n `${naturalWidth}px`,\n );\n $media.style.setProperty(\n '--height',\n `${naturalHeight}px`,\n );\n $media.style.aspectRatio = `${naturalWidth}/${naturalHeight}`;\n }\n }\n }}\n />\n ) : (\n {\n if (!hasDuration) {\n const { duration } = e.target;\n if (duration) {\n const formattedDuration = formatDuration(duration);\n const container = e.target.closest('.media-video');\n if (container) {\n container.dataset.formattedDuration =\n formattedDuration;\n }\n }\n }\n }}\n />\n )}\n
    \n \n
    \n \n )}\n {!showOriginal && !showInlineDesc && (\n \n )}\n \n
    \n );\n } else if (type === 'audio' || isAudioMaybe) {\n const formattedDuration = formatDuration(original.duration);\n return (\n
    \n \n {showOriginal ? (\n
    \n );\n }\n}\n\nfunction getURLObj(url) {\n // Fake base URL if url doesn't have https:// prefix\n return URL.parse(url, location.origin);\n}\n\nexport default memo(Media, (oldProps, newProps) => {\n const oldMedia = oldProps.media || {};\n const newMedia = newProps.media || {};\n\n return (\n oldMedia?.id === newMedia?.id &&\n oldMedia.url === newMedia.url &&\n oldProps.to === newProps.to &&\n oldProps.class === newProps.class\n );\n});\n","import './status.css';\nimport '@justinribeiro/lite-youtube';\n\nimport { msg, plural, Plural, t, Trans } from '@lingui/macro';\nimport { useLingui } from '@lingui/react';\nimport {\n ControlledMenu,\n Menu,\n MenuDivider,\n MenuHeader,\n MenuItem,\n} from '@szhsin/react-menu';\nimport { decodeBlurHash, getBlurHashAverageColor } from 'fast-blurhash';\nimport { shallowEqual } from 'fast-equals';\nimport prettify from 'html-prettify';\nimport pThrottle from 'p-throttle';\nimport { Fragment } from 'preact';\nimport { memo } from 'preact/compat';\nimport {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'preact/hooks';\nimport punycode from 'punycode/';\nimport { useHotkeys } from 'react-hotkeys-hook';\n// import { detectAll } from 'tinyld/light';\nimport { useLongPress } from 'use-long-press';\nimport { useSnapshot } from 'valtio';\n\nimport CustomEmoji from '../components/custom-emoji';\nimport EmojiText from '../components/emoji-text';\nimport LazyShazam from '../components/lazy-shazam';\nimport Loader from '../components/loader';\nimport MenuConfirm from '../components/menu-confirm';\nimport Menu2 from '../components/menu2';\nimport Modal from '../components/modal';\nimport NameText from '../components/name-text';\nimport Poll from '../components/poll';\nimport { api } from '../utils/api';\nimport emojifyText from '../utils/emojify-text';\nimport enhanceContent from '../utils/enhance-content';\nimport FilterContext from '../utils/filter-context';\nimport { isFiltered } from '../utils/filters';\nimport getTranslateTargetLanguage from '../utils/get-translate-target-language';\nimport getHTMLText from '../utils/getHTMLText';\nimport handleContentLinks from '../utils/handle-content-links';\nimport htmlContentLength from '../utils/html-content-length';\nimport isRTL from '../utils/is-rtl';\nimport isMastodonLinkMaybe from '../utils/isMastodonLinkMaybe';\nimport localeMatch from '../utils/locale-match';\nimport niceDateTime from '../utils/nice-date-time';\nimport openCompose from '../utils/open-compose';\nimport pmem from '../utils/pmem';\nimport safeBoundingBoxPadding from '../utils/safe-bounding-box-padding';\nimport shortenNumber from '../utils/shorten-number';\nimport showCompose from '../utils/show-compose';\nimport showToast from '../utils/show-toast';\nimport { speak, supportsTTS } from '../utils/speech';\nimport states, { getStatus, saveStatus, statusKey } from '../utils/states';\nimport statusPeek from '../utils/status-peek';\nimport store from '../utils/store';\nimport { getCurrentAccountID } from '../utils/store-utils';\nimport supports from '../utils/supports';\nimport unfurlMastodonLink from '../utils/unfurl-link';\nimport useTruncated from '../utils/useTruncated';\nimport visibilityIconsMap from '../utils/visibility-icons-map';\n\nimport Avatar from './avatar';\nimport Icon from './icon';\nimport Link from './link';\nimport Media, { isMediaCaptionLong } from './media';\nimport MenuLink from './menu-link';\nimport RelativeTime from './relative-time';\nimport TranslationBlock from './translation-block';\n\nconst SHOW_COMMENT_COUNT_LIMIT = 280;\nconst INLINE_TRANSLATE_LIMIT = 140;\n\nconst throttle = pThrottle({\n limit: 1,\n interval: 1000,\n});\nfunction fetchAccount(id, masto) {\n return masto.v1.accounts.$select(id).fetch();\n}\nconst memFetchAccount = pmem(throttle(fetchAccount));\n\nconst visibilityText = {\n public: msg`Public`,\n local: msg`Local`,\n unlisted: msg`Unlisted`,\n private: msg`Followers only`,\n direct: msg`Private mention`,\n};\n\nconst isIOS =\n window.ontouchstart !== undefined &&\n /iPad|iPhone|iPod/.test(navigator.userAgent);\n\nconst rtf = new Intl.RelativeTimeFormat();\n\nconst REACTIONS_LIMIT = 80;\n\nfunction getPollText(poll) {\n if (!poll?.options?.length) return '';\n return `📊:\\n${poll.options\n .map(\n (option) =>\n `- ${option.title}${\n option.votesCount >= 0 ? ` (${option.votesCount})` : ''\n }`,\n )\n .join('\\n')}`;\n}\nfunction getPostText(status) {\n const { spoilerText, content, poll } = status;\n return (\n (spoilerText ? `${spoilerText}\\n\\n` : '') +\n getHTMLText(content) +\n getPollText(poll)\n );\n}\n\nfunction isTranslateble(content) {\n if (!content) return false;\n content = content.trim();\n if (!content) return false;\n const text = getHTMLText(content, {\n preProcess: (dom) => {\n // Remove .mention, pre, code, a:has(.invisible)\n for (const a of dom.querySelectorAll(\n '.mention, pre, code, a:has(.invisible)',\n )) {\n a.remove();\n }\n },\n });\n return !!text;\n}\n\nfunction getHTMLTextForDetectLang(content) {\n return getHTMLText(content, {\n preProcess: (dom) => {\n // Remove anything that can skew the language detection\n\n // Remove .mention, .hashtag, pre, code, a:has(.invisible)\n for (const a of dom.querySelectorAll(\n '.mention, .hashtag, pre, code, a:has(.invisible)',\n )) {\n a.remove();\n }\n\n // Remove links that contains text that starts with https?://\n for (const a of dom.querySelectorAll('a')) {\n const text = a.innerText.trim();\n if (text.startsWith('https://') || text.startsWith('http://')) {\n a.remove();\n }\n }\n },\n });\n}\n\nconst HTTP_REGEX = /^http/i;\nconst PostContent =\n /*memo(*/\n ({ post, instance, previewMode }) => {\n const { content, emojis, language, mentions, url } = post;\n\n const divRef = useRef();\n useLayoutEffect(() => {\n if (!divRef.current) return;\n const dom = enhanceContent(content, {\n emojis,\n returnDOM: true,\n });\n // Remove target=\"_blank\" from links\n for (const a of dom.querySelectorAll('a.u-url[target=\"_blank\"]')) {\n if (!HTTP_REGEX.test(a.innerText.trim())) {\n a.removeAttribute('target');\n }\n }\n divRef.current.replaceChildren(dom.cloneNode(true));\n }, [content, emojis.length]);\n\n return (\n {\n // // Remove target=\"_blank\" from links\n // dom.querySelectorAll('a.u-url[target=\"_blank\"]').forEach((a) => {\n // if (!/http/i.test(a.innerText.trim())) {\n // a.removeAttribute('target');\n // }\n // });\n // },\n // }),\n // }}\n />\n );\n }; /*,\n (oldProps, newProps) => {\n const { post: oldPost } = oldProps;\n const { post: newPost } = newProps;\n return oldPost.content === newPost.content;\n },\n);*/\n\nconst SIZE_CLASS = {\n s: 'small',\n m: 'medium',\n l: 'large',\n};\n\nconst detectLang = pmem(async (text) => {\n const { detectAll } = await import('tinyld/light');\n text = text?.trim();\n\n // Ref: https://github.com/komodojp/tinyld/blob/develop/docs/benchmark.md\n // 500 should be enough for now, also the default max chars for Mastodon\n if (text?.length > 500) {\n return null;\n }\n const langs = detectAll(text);\n const lang = langs[0];\n if (lang?.lang && lang?.accuracy > 0.5) {\n // If > 50% accurate, use it\n // It can be accurate if < 50% but better be safe\n // Though > 50% also can be inaccurate 🤷‍♂️\n return lang.lang;\n }\n return null;\n});\n\nconst readMoreText = msg`Read more →`;\n\n// All this work just to make sure this only lazy-run once\n// Because first run is slow due to intl-localematcher\nconst DIFFERENT_LANG_CHECK = {};\nconst checkDifferentLanguage = (\n language,\n contentTranslationHideLanguages = [],\n) => {\n if (!language) return false;\n const targetLanguage = getTranslateTargetLanguage(true);\n const different =\n language !== targetLanguage &&\n !localeMatch([language], [targetLanguage]) &&\n !contentTranslationHideLanguages.find(\n (l) => language === l || localeMatch([language], [l]),\n );\n DIFFERENT_LANG_CHECK[language + contentTranslationHideLanguages] = true;\n return different;\n};\n\nfunction Status({\n statusID,\n status,\n instance: propInstance,\n size = 'm',\n contentTextWeight,\n readOnly,\n enableCommentHint,\n withinContext,\n skeleton,\n enableTranslate,\n forceTranslate: _forceTranslate,\n previewMode,\n // allowFilters,\n onMediaClick,\n quoted,\n onStatusLinkClick = () => {},\n showFollowedTags,\n allowContextMenu,\n showActionsBar,\n showReplyParent,\n mediaFirst,\n}) {\n const { _ } = useLingui();\n\n if (skeleton) {\n return (\n \n {!mediaFirst && }\n
    \n
    \n {(size === 's' || mediaFirst) && } ███ ████████\n
    \n
    \n {mediaFirst &&
    }\n
    \n

    ████ ████████

    \n
    \n
    \n
    \n
    \n );\n }\n const { masto, instance, authenticated } = api({ instance: propInstance });\n const { instance: currentInstance } = api();\n const sameInstance = instance === currentInstance;\n\n let sKey = statusKey(statusID || status?.id, instance);\n const snapStates = useSnapshot(states);\n if (!status) {\n status = snapStates.statuses[sKey] || snapStates.statuses[statusID];\n sKey = statusKey(status?.id, instance);\n }\n if (!status) {\n return null;\n }\n\n const {\n account: {\n acct,\n avatar,\n avatarStatic,\n id: accountId,\n url: accountURL,\n displayName,\n username,\n emojis: accountEmojis,\n bot,\n group,\n },\n id,\n repliesCount,\n reblogged,\n reblogsCount,\n favourited,\n favouritesCount,\n bookmarked,\n poll,\n muted,\n sensitive,\n spoilerText,\n visibility, // public, unlisted, private, direct\n language: _language,\n editedAt,\n filtered,\n card,\n createdAt,\n inReplyToId,\n inReplyToAccountId,\n content,\n mentions,\n mediaAttachments,\n reblog,\n uri,\n url,\n emojis,\n tags,\n pinned,\n // Non-API props\n _deleted,\n _pinned,\n // _filtered,\n // Non-Mastodon\n emojiReactions,\n } = status;\n\n const [languageAutoDetected, setLanguageAutoDetected] = useState(null);\n useEffect(() => {\n if (!content) return;\n if (_language) return;\n if (languageAutoDetected) return;\n let timer;\n timer = setTimeout(async () => {\n let detected = await detectLang(getHTMLTextForDetectLang(content));\n setLanguageAutoDetected(detected);\n }, 1000);\n return () => clearTimeout(timer);\n }, [content, _language]);\n const language = _language || languageAutoDetected;\n\n // if (!mediaAttachments?.length) mediaFirst = false;\n const hasMediaAttachments = !!mediaAttachments?.length;\n if (mediaFirst && hasMediaAttachments) size = 's';\n\n const currentAccount = useMemo(() => {\n return getCurrentAccountID();\n }, []);\n const isSelf = useMemo(() => {\n return currentAccount && currentAccount === accountId;\n }, [accountId, currentAccount]);\n\n const filterContext = useContext(FilterContext);\n const filterInfo =\n !isSelf && !readOnly && !previewMode && isFiltered(filtered, filterContext);\n\n if (filterInfo?.action === 'hide') {\n return null;\n }\n\n console.debug('RENDER Status', id, status?.account.displayName, quoted);\n\n const debugHover = (e) => {\n if (e.shiftKey) {\n console.log({\n ...status,\n });\n }\n };\n\n if (/*allowFilters && */ size !== 'l' && filterInfo) {\n return (\n \n );\n }\n\n const createdAtDate = new Date(createdAt);\n const editedAtDate = new Date(editedAt);\n\n let inReplyToAccountRef = mentions?.find(\n (mention) => mention.id === inReplyToAccountId,\n );\n if (!inReplyToAccountRef && inReplyToAccountId === id) {\n inReplyToAccountRef = { url: accountURL, username, displayName };\n }\n const [inReplyToAccount, setInReplyToAccount] = useState(inReplyToAccountRef);\n if (!withinContext && !inReplyToAccount && inReplyToAccountId) {\n const account = states.accounts[inReplyToAccountId];\n if (account) {\n setInReplyToAccount(account);\n } else {\n memFetchAccount(inReplyToAccountId, masto)\n .then((account) => {\n setInReplyToAccount(account);\n states.accounts[account.id] = account;\n })\n .catch((e) => {});\n }\n }\n const mentionSelf =\n inReplyToAccountId === currentAccount ||\n mentions?.find((mention) => mention.id === currentAccount);\n\n const readingExpandSpoilers = useMemo(() => {\n const prefs = store.account.get('preferences') || {};\n return !!prefs['reading:expand:spoilers'];\n }, []);\n const readingExpandMedia = useMemo(() => {\n // default | show_all | hide_all\n // Ignore hide_all because it means hide *ALL* media including non-sensitive ones\n const prefs = store.account.get('preferences') || {};\n return prefs['reading:expand:media']?.toLowerCase() || 'default';\n }, []);\n // FOR TESTING:\n // const readingExpandSpoilers = true;\n // const readingExpandMedia = 'show_all';\n const showSpoiler =\n previewMode || readingExpandSpoilers || !!snapStates.spoilers[id];\n const showSpoilerMedia =\n previewMode ||\n readingExpandMedia === 'show_all' ||\n !!snapStates.spoilersMedia[id];\n\n if (reblog) {\n // If has statusID, means useItemID (cached in states)\n\n if (group) {\n return (\n \n
    \n {' '}\n \n
    \n \n \n );\n }\n\n return (\n \n
    \n {' '}\n \n {' '}\n boosted\n \n
    \n \n \n );\n }\n\n // Check followedTags\n const FollowedTagsParent = useCallback(\n ({ children }) => (\n \n
    \n {' '}\n {snapStates.statusFollowedTags[sKey].slice(0, 3).map((tag) => (\n \n {tag}\n \n ))}\n
    \n {children}\n \n ),\n [sKey, instance, snapStates.statusFollowedTags[sKey]],\n );\n const StatusParent =\n showFollowedTags && !!snapStates.statusFollowedTags[sKey]?.length\n ? FollowedTagsParent\n : Fragment;\n\n const isSizeLarge = size === 'l';\n\n const [forceTranslate, setForceTranslate] = useState(_forceTranslate);\n // const targetLanguage = getTranslateTargetLanguage(true);\n // const contentTranslationHideLanguages =\n // snapStates.settings.contentTranslationHideLanguages || [];\n const { contentTranslation, contentTranslationAutoInline } =\n snapStates.settings;\n if (!contentTranslation) enableTranslate = false;\n const inlineTranslate = useMemo(() => {\n if (\n !contentTranslation ||\n !contentTranslationAutoInline ||\n readOnly ||\n (withinContext && !isSizeLarge) ||\n previewMode ||\n spoilerText ||\n sensitive ||\n poll ||\n card ||\n mediaAttachments?.length\n ) {\n return false;\n }\n const contentLength = htmlContentLength(content);\n return contentLength > 0 && contentLength <= INLINE_TRANSLATE_LIMIT;\n }, [\n contentTranslation,\n contentTranslationAutoInline,\n readOnly,\n withinContext,\n isSizeLarge,\n previewMode,\n spoilerText,\n sensitive,\n poll,\n card,\n mediaAttachments,\n content,\n ]);\n\n const [showEdited, setShowEdited] = useState(false);\n const [showEmbed, setShowEmbed] = useState(false);\n\n const spoilerContentRef = useTruncated();\n const contentRef = useTruncated();\n const mediaContainerRef = useTruncated();\n\n const statusRef = useRef(null);\n\n const unauthInteractionErrorMessage = t`Sorry, your current logged-in instance can't interact with this post from another instance.`;\n\n const textWeight = useCallback(\n () =>\n Math.max(\n Math.round((spoilerText.length + htmlContentLength(content)) / 140) ||\n 1,\n 1,\n ),\n [spoilerText, content],\n );\n\n const createdDateText = niceDateTime(createdAtDate);\n const editedDateText = editedAt && niceDateTime(editedAtDate);\n\n // Can boost if:\n // - authenticated AND\n // - visibility != direct OR\n // - visibility = private AND isSelf\n let canBoost =\n authenticated && visibility !== 'direct' && visibility !== 'private';\n if (visibility === 'private' && isSelf) {\n canBoost = true;\n }\n\n const replyStatus = (e) => {\n if (!sameInstance || !authenticated) {\n return alert(unauthInteractionErrorMessage);\n }\n // syntheticEvent comes from MenuItem\n if (e?.shiftKey || e?.syntheticEvent?.shiftKey) {\n const newWin = openCompose({\n replyToStatus: status,\n });\n if (newWin) return;\n }\n showCompose({\n replyToStatus: status,\n });\n };\n\n // Check if media has no descriptions\n const mediaNoDesc = useMemo(() => {\n return mediaAttachments.some(\n (attachment) => !attachment.description?.trim?.(),\n );\n }, [mediaAttachments]);\n\n const statusMonthsAgo = useMemo(() => {\n return Math.floor(\n (new Date() - createdAtDate) / (1000 * 60 * 60 * 24 * 30),\n );\n }, [createdAtDate]);\n\n // const boostStatus = async () => {\n // if (!sameInstance || !authenticated) {\n // alert(unauthInteractionErrorMessage);\n // return false;\n // }\n // try {\n // if (!reblogged) {\n // let confirmText = 'Boost this post?';\n // if (mediaNoDesc) {\n // confirmText += '\\n\\n⚠️ Some media have no descriptions.';\n // }\n // const yes = confirm(confirmText);\n // if (!yes) {\n // return false;\n // }\n // }\n // // Optimistic\n // states.statuses[sKey] = {\n // ...status,\n // reblogged: !reblogged,\n // reblogsCount: reblogsCount + (reblogged ? -1 : 1),\n // };\n // if (reblogged) {\n // const newStatus = await masto.v1.statuses.$select(id).unreblog();\n // saveStatus(newStatus, instance);\n // return true;\n // } else {\n // const newStatus = await masto.v1.statuses.$select(id).reblog();\n // saveStatus(newStatus, instance);\n // return true;\n // }\n // } catch (e) {\n // console.error(e);\n // // Revert optimistism\n // states.statuses[sKey] = status;\n // return false;\n // }\n // };\n const confirmBoostStatus = async () => {\n if (!sameInstance || !authenticated) {\n alert(unauthInteractionErrorMessage);\n return false;\n }\n try {\n // Optimistic\n states.statuses[sKey] = {\n ...status,\n reblogged: !reblogged,\n reblogsCount: reblogsCount + (reblogged ? -1 : 1),\n };\n if (reblogged) {\n const newStatus = await masto.v1.statuses.$select(id).unreblog();\n saveStatus(newStatus, instance);\n } else {\n const newStatus = await masto.v1.statuses.$select(id).reblog();\n saveStatus(newStatus, instance);\n }\n return true;\n } catch (e) {\n console.error(e);\n // Revert optimistism\n states.statuses[sKey] = status;\n return false;\n }\n };\n\n const favouriteStatus = async () => {\n if (!sameInstance || !authenticated) {\n alert(unauthInteractionErrorMessage);\n return false;\n }\n try {\n // Optimistic\n states.statuses[sKey] = {\n ...status,\n favourited: !favourited,\n favouritesCount: favouritesCount + (favourited ? -1 : 1),\n };\n if (favourited) {\n const newStatus = await masto.v1.statuses.$select(id).unfavourite();\n saveStatus(newStatus, instance);\n } else {\n const newStatus = await masto.v1.statuses.$select(id).favourite();\n saveStatus(newStatus, instance);\n }\n return true;\n } catch (e) {\n console.error(e);\n // Revert optimistism\n states.statuses[sKey] = status;\n return false;\n }\n };\n const favouriteStatusNotify = async () => {\n try {\n const done = await favouriteStatus();\n if (!isSizeLarge && done) {\n showToast(\n favourited\n ? t`Unliked @${username || acct}'s post`\n : t`Liked @${username || acct}'s post`,\n );\n }\n } catch (e) {}\n };\n\n const bookmarkStatus = async () => {\n if (!supports('@mastodon/post-bookmark')) return;\n if (!sameInstance || !authenticated) {\n alert(unauthInteractionErrorMessage);\n return false;\n }\n try {\n // Optimistic\n states.statuses[sKey] = {\n ...status,\n bookmarked: !bookmarked,\n };\n if (bookmarked) {\n const newStatus = await masto.v1.statuses.$select(id).unbookmark();\n saveStatus(newStatus, instance);\n } else {\n const newStatus = await masto.v1.statuses.$select(id).bookmark();\n saveStatus(newStatus, instance);\n }\n return true;\n } catch (e) {\n console.error(e);\n // Revert optimistism\n states.statuses[sKey] = status;\n return false;\n }\n };\n const bookmarkStatusNotify = async () => {\n try {\n const done = await bookmarkStatus();\n if (!isSizeLarge && done) {\n showToast(\n bookmarked\n ? t`Unbookmarked @${username || acct}'s post`\n : t`Bookmarked @${username || acct}'s post`,\n );\n }\n } catch (e) {}\n };\n\n // const differentLanguage =\n // !!language &&\n // language !== targetLanguage &&\n // !localeMatch([language], [targetLanguage]) &&\n // !contentTranslationHideLanguages.find(\n // (l) => language === l || localeMatch([language], [l]),\n // );\n const contentTranslationHideLanguages =\n snapStates.settings.contentTranslationHideLanguages || [];\n const [differentLanguage, setDifferentLanguage] = useState(\n DIFFERENT_LANG_CHECK[language + contentTranslationHideLanguages]\n ? checkDifferentLanguage(language, contentTranslationHideLanguages)\n : false,\n );\n useEffect(() => {\n if (\n !language ||\n differentLanguage ||\n DIFFERENT_LANG_CHECK[language + contentTranslationHideLanguages]\n ) {\n return;\n }\n let timeout = setTimeout(() => {\n const different = checkDifferentLanguage(\n language,\n contentTranslationHideLanguages,\n );\n if (different) setDifferentLanguage(different);\n }, 1);\n return () => clearTimeout(timeout);\n }, [language, differentLanguage, contentTranslationHideLanguages]);\n\n const reblogIterator = useRef();\n const favouriteIterator = useRef();\n async function fetchBoostedLikedByAccounts(firstLoad) {\n if (firstLoad) {\n reblogIterator.current = masto.v1.statuses\n .$select(statusID)\n .rebloggedBy.list({\n limit: REACTIONS_LIMIT,\n });\n favouriteIterator.current = masto.v1.statuses\n .$select(statusID)\n .favouritedBy.list({\n limit: REACTIONS_LIMIT,\n });\n }\n const [{ value: reblogResults }, { value: favouriteResults }] =\n await Promise.allSettled([\n reblogIterator.current.next(),\n favouriteIterator.current.next(),\n ]);\n if (reblogResults.value?.length || favouriteResults.value?.length) {\n const accounts = [];\n if (reblogResults.value?.length) {\n accounts.push(\n ...reblogResults.value.map((a) => {\n a._types = ['reblog'];\n return a;\n }),\n );\n }\n if (favouriteResults.value?.length) {\n accounts.push(\n ...favouriteResults.value.map((a) => {\n a._types = ['favourite'];\n return a;\n }),\n );\n }\n return {\n value: accounts,\n done: reblogResults.done && favouriteResults.done,\n };\n }\n return {\n value: [],\n done: true,\n };\n }\n\n const actionsRef = useRef();\n const isPublic = ['public', 'unlisted'].includes(visibility);\n const isPinnable = ['public', 'unlisted', 'private'].includes(visibility);\n const StatusMenuItems = (\n <>\n {!isSizeLarge && sameInstance && (\n <>\n
    \n \n \n \n {repliesCount > 0 ? shortenNumber(repliesCount) : t`Reply`}\n \n \n \n \n {reblogged ? t`Unboost` : t`Boost`}\n \n }\n className={`menu-reblog ${reblogged ? 'checked' : ''}`}\n menuExtras={\n {\n showCompose({\n draftStatus: {\n status: `\\n${url}`,\n },\n });\n }}\n >\n \n \n Quote\n \n \n }\n menuFooter={\n mediaNoDesc && !reblogged ? (\n
    \n \n Some media have no descriptions.\n
    \n ) : (\n statusMonthsAgo >= 3 && (\n
    \n \n \n \n Old post (\n \n {rtf.format(-statusMonthsAgo, 'month')}\n \n )\n \n \n
    \n )\n )\n }\n disabled={!canBoost}\n onClick={async () => {\n try {\n const done = await confirmBoostStatus();\n if (!isSizeLarge && done) {\n showToast(\n reblogged\n ? t`Unboosted @${username || acct}'s post`\n : t`Boosted @${username || acct}'s post`,\n );\n }\n } catch (e) {}\n }}\n >\n \n \n {reblogsCount > 0\n ? shortenNumber(reblogsCount)\n : reblogged\n ? t`Unboost`\n : t`Boost…`}\n \n \n \n \n \n {favouritesCount > 0\n ? shortenNumber(favouritesCount)\n : favourited\n ? t`Unlike`\n : t`Like`}\n \n \n {supports('@mastodon/post-bookmark') && (\n \n \n {bookmarked ? t`Unbookmark` : t`Bookmark`}\n \n )}\n
    \n \n )}\n {!isSizeLarge && sameInstance && (isSizeLarge || showActionsBar) && (\n \n )}\n {(isSizeLarge || showActionsBar) && (\n <>\n {\n states.showGenericAccounts = {\n heading: t`Boosted/Liked by…`,\n fetchAccounts: fetchBoostedLikedByAccounts,\n instance,\n showReactions: true,\n postID: sKey,\n };\n }}\n >\n \n \n Boosted/Liked by…\n \n \n \n )}\n {!mediaFirst && (\n <>\n {(enableTranslate || !language || differentLanguage) && (\n \n )}\n {enableTranslate ? (\n
    \n {\n setForceTranslate(true);\n }}\n >\n \n \n Translate\n \n \n {supportsTTS && (\n {\n const postText = getPostText(status);\n if (postText) {\n speak(postText, language);\n }\n }}\n >\n \n \n Speak\n \n \n )}\n
    \n ) : (\n (!language || differentLanguage) && (\n
    \n \n \n \n Translate\n \n \n {supportsTTS && (\n {\n const postText = getPostText(status);\n if (postText) {\n speak(postText, language);\n }\n }}\n >\n \n \n Speak\n \n \n )}\n
    \n )\n )}\n \n )}\n {((!isSizeLarge && sameInstance) ||\n enableTranslate ||\n !language ||\n differentLanguage) && }\n {!isSizeLarge && (\n <>\n {\n onStatusLinkClick(e, status);\n }}\n >\n \n \n \n View post by{' '}\n @{username || acct}\n \n
    \n \n {_(visibilityText[visibility])} • {createdDateText}\n \n
    \n \n \n )}\n {!!editedAt && (\n <>\n {\n setShowEdited(id);\n }}\n >\n \n \n Show Edit History\n
    \n \n Edited: {editedDateText}\n \n
    \n \n \n )}\n \n \n \n {nicePostURL(url)}\n \n \n
    \n {\n // Copy url to clipboard\n try {\n navigator.clipboard.writeText(url);\n showToast(t`Link copied`);\n } catch (e) {\n console.error(e);\n showToast(t`Unable to copy link`);\n }\n }}\n >\n \n \n Copy\n \n \n {isPublic &&\n navigator?.share &&\n navigator?.canShare?.({\n url,\n }) && (\n {\n try {\n navigator.share({\n url,\n });\n } catch (e) {\n console.error(e);\n alert(t`Sharing doesn't seem to work.`);\n }\n }}\n >\n \n \n Share…\n \n \n )}\n
    \n {isPublic && isSizeLarge && (\n {\n setShowEmbed(true);\n }}\n >\n \n \n Embed post\n \n \n )}\n {(isSelf || mentionSelf) && }\n {(isSelf || mentionSelf) && (\n {\n try {\n const newStatus = await masto.v1.statuses\n .$select(id)\n [muted ? 'unmute' : 'mute']();\n saveStatus(newStatus, instance);\n showToast(\n muted ? t`Conversation unmuted` : t`Conversation muted`,\n );\n } catch (e) {\n console.error(e);\n showToast(\n muted\n ? t`Unable to unmute conversation`\n : t`Unable to mute conversation`,\n );\n }\n }}\n >\n {muted ? (\n <>\n \n \n Unmute conversation\n \n \n ) : (\n <>\n \n \n Mute conversation\n \n \n )}\n \n )}\n {isSelf && isPinnable && (\n {\n try {\n const newStatus = await masto.v1.statuses\n .$select(id)\n [pinned ? 'unpin' : 'pin']();\n saveStatus(newStatus, instance);\n showToast(\n pinned\n ? t`Post unpinned from profile`\n : t`Post pinned to profile`,\n );\n } catch (e) {\n console.error(e);\n showToast(\n pinned ? t`Unable to unpin post` : t`Unable to pin post`,\n );\n }\n }}\n >\n {pinned ? (\n <>\n \n \n Unpin from profile\n \n \n ) : (\n <>\n \n \n Pin to profile\n \n \n )}\n \n )}\n {isSelf && (\n
    \n {supports('@mastodon/post-edit') && (\n {\n showCompose({\n editStatus: status,\n });\n }}\n >\n \n \n Edit\n \n \n )}\n {isSizeLarge && (\n \n \n \n Delete this post?\n \n \n }\n itemProps={{\n className: 'danger',\n }}\n menuItemClassName=\"danger\"\n onClick={() => {\n // const yes = confirm('Delete this post?');\n // if (yes) {\n (async () => {\n try {\n await masto.v1.statuses.$select(id).remove();\n const cachedStatus = getStatus(id, instance);\n cachedStatus._deleted = true;\n showToast(t`Post deleted`);\n } catch (e) {\n console.error(e);\n showToast(t`Unable to delete post`);\n }\n })();\n // }\n }}\n >\n \n \n Delete…\n \n \n )}\n
    \n )}\n {!isSelf && isSizeLarge && (\n <>\n \n {\n states.showReportModal = {\n account: status.account,\n post: status,\n };\n }}\n >\n \n \n Report post…\n \n \n \n )}\n \n );\n\n const contextMenuRef = useRef();\n const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);\n const [contextMenuProps, setContextMenuProps] = useState({});\n\n const showContextMenu =\n allowContextMenu || (!isSizeLarge && !previewMode && !_deleted && !quoted);\n\n // Only iOS/iPadOS browsers don't support contextmenu\n // Some comments report iPadOS might support contextmenu if a mouse is connected\n const bindLongPressContext = useLongPress(\n isIOS && showContextMenu\n ? (e) => {\n if (e.pointerType === 'mouse') return;\n // There's 'pen' too, but not sure if contextmenu event would trigger from a pen\n\n const { clientX, clientY } = e.touches?.[0] || e;\n // link detection copied from onContextMenu because here it works\n const link = e.target.closest('a');\n if (\n link &&\n statusRef.current.contains(link) &&\n !link.getAttribute('href').startsWith('#')\n )\n return;\n e.preventDefault();\n setContextMenuProps({\n anchorPoint: {\n x: clientX,\n y: clientY,\n },\n direction: 'right',\n });\n setIsContextMenuOpen(true);\n }\n : null,\n {\n threshold: 600,\n captureEvent: true,\n detect: 'touch',\n cancelOnMovement: 2, // true allows movement of up to 25 pixels\n },\n );\n\n const hotkeysEnabled = !readOnly && !previewMode && !quoted;\n const rRef = useHotkeys('r, shift+r', replyStatus, {\n enabled: hotkeysEnabled,\n });\n const fRef = useHotkeys('f, l', favouriteStatusNotify, {\n enabled: hotkeysEnabled,\n });\n const dRef = useHotkeys('d', bookmarkStatusNotify, {\n enabled: hotkeysEnabled,\n });\n const bRef = useHotkeys(\n 'shift+b',\n () => {\n (async () => {\n try {\n const done = await confirmBoostStatus();\n if (!isSizeLarge && done) {\n showToast(\n reblogged\n ? t`Unboosted @${username || acct}'s post`\n : t`Boosted @${username || acct}'s post`,\n );\n }\n } catch (e) {}\n })();\n },\n {\n enabled: hotkeysEnabled && canBoost,\n },\n );\n const xRef = useHotkeys('x', (e) => {\n const activeStatus = document.activeElement.closest(\n '.status-link, .status-focus',\n );\n if (activeStatus) {\n const spoilerButton = activeStatus.querySelector(\n '.spoiler-button:not(.spoiling)',\n );\n if (spoilerButton) {\n e.stopPropagation();\n spoilerButton.click();\n } else {\n const spoilerMediaButton = activeStatus.querySelector(\n '.spoiler-media-button:not(.spoiling)',\n );\n if (spoilerMediaButton) {\n e.stopPropagation();\n spoilerMediaButton.click();\n }\n }\n }\n });\n\n const displayedMediaAttachments = mediaAttachments.slice(\n 0,\n isSizeLarge ? undefined : 4,\n );\n const showMultipleMediaCaptions =\n mediaAttachments.length > 1 &&\n displayedMediaAttachments.some(\n (media) => !!media.description && !isMediaCaptionLong(media.description),\n );\n const captionChildren = useMemo(() => {\n if (!showMultipleMediaCaptions) return null;\n const attachments = [];\n displayedMediaAttachments.forEach((media, i) => {\n if (!media.description) return;\n const index = attachments.findIndex(\n (attachment) => attachment.media.description === media.description,\n );\n if (index === -1) {\n attachments.push({\n media,\n indices: [i],\n });\n } else {\n attachments[index].indices.push(i);\n }\n });\n return attachments.map(({ media, indices }) => (\n i + 1).join(' ')}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n states.showMediaAlt = {\n alt: media.description,\n lang: language,\n };\n }}\n title={media.description}\n >\n {indices.map((i) => i + 1).join(' ')} {media.description}\n \n ));\n\n // return displayedMediaAttachments.map(\n // (media, i) =>\n // !!media.description && (\n // {\n // e.preventDefault();\n // e.stopPropagation();\n // states.showMediaAlt = {\n // alt: media.description,\n // lang: language,\n // };\n // }}\n // title={media.description}\n // >\n // {i + 1} {media.description}\n // \n // ),\n // );\n }, [showMultipleMediaCaptions, displayedMediaAttachments, language]);\n\n const isThread = useMemo(() => {\n return (\n (!!inReplyToId && inReplyToAccountId === status.account?.id) ||\n !!snapStates.statusThreadNumber[sKey]\n );\n }, [\n inReplyToId,\n inReplyToAccountId,\n status.account?.id,\n snapStates.statusThreadNumber[sKey],\n ]);\n\n const showCommentHint = useMemo(() => {\n return (\n enableCommentHint &&\n !isThread &&\n !withinContext &&\n !inReplyToId &&\n visibility === 'public' &&\n repliesCount > 0\n );\n }, [\n enableCommentHint,\n isThread,\n withinContext,\n inReplyToId,\n repliesCount,\n visibility,\n ]);\n const showCommentCount = useMemo(() => {\n if (\n card ||\n poll ||\n sensitive ||\n spoilerText ||\n mediaAttachments?.length ||\n isThread ||\n withinContext ||\n inReplyToId ||\n repliesCount <= 0\n ) {\n return false;\n }\n const questionRegex = /[???︖❓❔⁇⁈⁉¿‽؟]/;\n const containsQuestion = questionRegex.test(content);\n if (!containsQuestion) return false;\n const contentLength = htmlContentLength(content);\n if (contentLength > 0 && contentLength <= SHOW_COMMENT_COUNT_LIMIT) {\n return true;\n }\n }, [\n card,\n poll,\n sensitive,\n spoilerText,\n mediaAttachments,\n reblog,\n isThread,\n withinContext,\n inReplyToId,\n repliesCount,\n content,\n ]);\n\n return (\n \n {showReplyParent && !!(inReplyToId && inReplyToAccountId) && (\n \n )}\n {\n statusRef.current = node;\n // Use parent node if it's in focus\n // Use case: \n // When navigating (j/k), the is focused instead of \n // Hotkey binding doesn't bubble up thus this hack\n const nodeRef =\n node?.closest?.(\n '.timeline-item, .timeline-item-alt, .status-link, .status-focus',\n ) || node;\n rRef(nodeRef);\n fRef(nodeRef);\n dRef(nodeRef);\n bRef(nodeRef);\n xRef(nodeRef);\n }}\n tabindex=\"-1\"\n class={`status ${\n !withinContext && inReplyToId && inReplyToAccount\n ? 'status-reply-to'\n : ''\n } visibility-${visibility} ${_pinned ? 'status-pinned' : ''} ${\n SIZE_CLASS[size]\n } ${_deleted ? 'status-deleted' : ''} ${quoted ? 'status-card' : ''} ${\n isContextMenuOpen ? 'status-menu-open' : ''\n } ${mediaFirst && hasMediaAttachments ? 'status-media-first' : ''}`}\n onMouseEnter={debugHover}\n onContextMenu={(e) => {\n if (!showContextMenu) return;\n if (e.metaKey) return;\n // console.log('context menu', e);\n const link = e.target.closest('a');\n if (\n link &&\n statusRef.current.contains(link) &&\n !link.getAttribute('href').startsWith('#')\n )\n return;\n\n // If there's selected text, don't show custom context menu\n const selection = window.getSelection?.();\n if (selection.toString().length > 0) {\n const { anchorNode } = selection;\n if (statusRef.current?.contains(anchorNode)) {\n return;\n }\n }\n e.preventDefault();\n setContextMenuProps({\n anchorPoint: {\n x: e.clientX,\n y: e.clientY,\n },\n direction: 'right',\n });\n setIsContextMenuOpen(true);\n }}\n {...(showContextMenu ? bindLongPressContext() : {})}\n >\n {showContextMenu && (\n {\n setIsContextMenuOpen(false);\n // statusRef.current?.focus?.();\n if (e?.reason === 'click') {\n statusRef.current?.closest('[tabindex]')?.focus?.();\n }\n }}\n portal={{\n target: document.body,\n }}\n containerProps={{\n style: {\n // Higher than the backdrop\n zIndex: 1001,\n },\n onClick: () => {\n contextMenuRef.current?.closeMenu?.();\n },\n }}\n overflow=\"auto\"\n boundingBoxPadding={safeBoundingBoxPadding()}\n unmountOnClose\n >\n {StatusMenuItems}\n \n )}\n {showActionsBar &&\n size !== 'l' &&\n !previewMode &&\n !readOnly &&\n !_deleted &&\n !quoted && (\n \n \n \n {\n e.preventDefault();\n e.stopPropagation();\n setContextMenuProps({\n anchorRef: {\n current: e.currentTarget,\n },\n align: 'start',\n direction: 'left',\n gap: 0,\n shift: -8,\n });\n setIsContextMenuOpen('actions-bar');\n }}\n >\n \n \n \n )}\n {size !== 'l' && (\n
    \n {reblogged && (\n \n )}\n {favourited && (\n \n )}\n {bookmarked && (\n \n )}\n {_pinned && (\n \n )}\n
    \n )}\n {size !== 's' && (\n {\n e.preventDefault();\n e.stopPropagation();\n states.showAccount = {\n account: status.account,\n instance,\n };\n }}\n >\n \n
    \n )}\n
    \n
    \n \n \n \n {/* {inReplyToAccount && !withinContext && size !== 's' && (\n <>\n {' '}\n \n {' '}\n \n \n \n )} */}\n {/* */}{' '}\n {size !== 'l' &&\n (_deleted ? (\n \n Deleted\n \n ) : url && !previewMode && !readOnly && !quoted ? (\n {\n if (\n e.metaKey ||\n e.ctrlKey ||\n e.shiftKey ||\n e.altKey ||\n e.which === 2\n ) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n onStatusLinkClick?.(e, status);\n setContextMenuProps({\n anchorRef: {\n current: e.currentTarget,\n },\n align: 'end',\n direction: 'bottom',\n gap: 4,\n });\n setIsContextMenuOpen(true);\n }}\n class={`time ${\n isContextMenuOpen && contextMenuProps?.anchorRef\n ? 'is-open'\n : ''\n }`}\n >\n {showCommentHint && !showCommentCount ? (\n \n ) : (\n visibility !== 'public' &&\n visibility !== 'direct' && (\n \n )\n )}{' '}\n \n {!previewMode && !readOnly && (\n \n )}\n \n ) : (\n // {\n // if (e.target === e.currentTarget)\n // menuInstanceRef.current?.closeMenu?.();\n // },\n // }}\n // align=\"end\"\n // gap={4}\n // overflow=\"auto\"\n // viewScroll=\"close\"\n // boundingBoxPadding=\"8 8 8 8\"\n // unmountOnClose\n // menuButton={({ open }) => (\n // {\n // e.preventDefault();\n // e.stopPropagation();\n // onStatusLinkClick?.(e, status);\n // }}\n // class={`time ${open ? 'is-open' : ''}`}\n // >\n // {' '}\n // \n // \n // )}\n // >\n // {StatusMenuItems}\n // \n \n {visibility !== 'public' && visibility !== 'direct' && (\n <>\n {' '}\n \n )}\n \n \n ))}\n
    \n {visibility === 'direct' && (\n <>\n
    \n Private mention\n
    {' '}\n \n )}\n {!withinContext && (\n <>\n {isThread ? (\n
    \n \n \n Thread\n {snapStates.statusThreadNumber[sKey]\n ? ` ${snapStates.statusThreadNumber[sKey]}/X`\n : ''}\n \n
    \n ) : (\n !!inReplyToId &&\n !!inReplyToAccount &&\n (!!spoilerText ||\n !mentions.find((mention) => {\n return mention.id === inReplyToAccountId;\n })) && (\n
    \n {' '}\n \n
    \n )\n )}\n \n )}\n \n {mediaFirst && hasMediaAttachments ? (\n <>\n {(!!spoilerText || !!sensitive) && !readingExpandSpoilers && (\n <>\n {!!spoilerText && (\n \n {' '}\n \n )}\n {\n e.preventDefault();\n e.stopPropagation();\n if (showSpoiler) {\n delete states.spoilers[id];\n if (!readingExpandSpoilers) {\n delete states.spoilersMedia[id];\n }\n } else {\n states.spoilers[id] = true;\n if (!readingExpandSpoilers) {\n states.spoilersMedia[id] = true;\n }\n }\n }}\n >\n {' '}\n {showSpoiler ? t`Show less` : t`Show content`}\n \n \n )}\n \n {!!content && (\n
    \n \n
    \n )}\n \n ) : (\n <>\n {!!spoilerText && (\n <>\n \n

    \n \n

    \n
    \n {readingExpandSpoilers || previewMode ? (\n
    \n Content warning\n
    \n ) : (\n {\n e.preventDefault();\n e.stopPropagation();\n if (showSpoiler) {\n delete states.spoilers[id];\n if (!readingExpandSpoilers) {\n delete states.spoilersMedia[id];\n }\n } else {\n states.spoilers[id] = true;\n if (!readingExpandSpoilers) {\n states.spoilersMedia[id] = true;\n }\n }\n }}\n >\n {' '}\n {showSpoiler ? t`Show less` : t`Show content`}\n \n )}\n \n )}\n {!!content && (\n \n \n \n \n )}\n {!!poll && (\n {\n states.statuses[sKey].poll = newPoll;\n }}\n refresh={() => {\n return masto.v1.polls\n .$select(poll.id)\n .fetch()\n .then((pollResponse) => {\n states.statuses[sKey].poll = pollResponse;\n })\n .catch((e) => {}); // Silently fail\n }}\n votePoll={(choices) => {\n return masto.v1.polls\n .$select(poll.id)\n .votes.create({\n choices,\n })\n .then((pollResponse) => {\n states.statuses[sKey].poll = pollResponse;\n })\n .catch((e) => {}); // Silently fail\n }}\n />\n )}\n {(((enableTranslate || inlineTranslate) &&\n isTranslateble(content) &&\n differentLanguage) ||\n forceTranslate) && (\n \n )}\n {!previewMode &&\n sensitive &&\n !!mediaAttachments.length &&\n readingExpandMedia !== 'show_all' && (\n
    \n );\n}\n\nfunction MultipleMediaFigure(props) {\n const { enabled, children, lang, captionChildren } = props;\n if (!enabled || !captionChildren) return children;\n return (\n
    \n {children}\n
    \n {captionChildren}\n
    \n
    \n );\n}\n\nfunction MediaFirstContainer(props) {\n const { mediaAttachments, language, postID, instance } = props;\n const moreThanOne = mediaAttachments.length > 1;\n\n const carouselRef = useRef();\n const [currentIndex, setCurrentIndex] = useState(0);\n\n useEffect(() => {\n let handleScroll = () => {\n const { clientWidth, scrollLeft } = carouselRef.current;\n const index = Math.round(Math.abs(scrollLeft) / clientWidth);\n setCurrentIndex(index);\n };\n if (carouselRef.current) {\n carouselRef.current.addEventListener('scroll', handleScroll, {\n passive: true,\n });\n }\n return () => {\n if (carouselRef.current) {\n carouselRef.current.removeEventListener('scroll', handleScroll);\n }\n };\n }, []);\n\n return (\n <>\n
    \n
    \n {mediaAttachments.map((media, i) => (\n
    \n \n
    \n ))}\n
    \n {moreThanOne && (\n \n )}\n
    \n {moreThanOne && (\n \n {mediaAttachments.map((media, i) => (\n \n ))}\n \n )}\n \n );\n}\n\nfunction getDomain(url) {\n return punycode.toUnicode(\n URL.parse(url)\n .hostname.replace(/^www\\./, '')\n .replace(/\\/$/, ''),\n );\n}\n\n// \"Post\": Quote post + card link preview combo\n// Assume all links from these domains are \"posts\"\n// Mastodon links are \"posts\" too but they are converted to real quote posts and there's too many domains to check\n// This is just \"Progressive Enhancement\"\nfunction isCardPost(domain) {\n return ['x.com', 'twitter.com', 'threads.net', 'bsky.app'].includes(domain);\n}\n\nfunction Byline({ authors, hidden, children }) {\n if (hidden) return children;\n if (!authors?.[0]?.account?.id) return children;\n const author = authors[0].account;\n\n return (\n \n );\n}\n\nfunction Card({ card, selfReferential, selfAuthor, instance }) {\n const snapStates = useSnapshot(states);\n const {\n blurhash,\n title,\n description,\n html,\n providerName,\n providerUrl,\n authorName,\n authorUrl,\n width,\n height,\n image,\n imageDescription,\n url,\n type,\n embedUrl,\n language,\n publishedAt,\n authors,\n } = card;\n\n /* type\n link = Link OEmbed\n photo = Photo OEmbed\n video = Video OEmbed\n rich = iframe OEmbed. Not currently accepted, so won’t show up in practice.\n */\n\n const hasText = title || providerName || authorName;\n const isLandscape = width / height >= 1.2;\n const size = isLandscape ? 'large' : '';\n\n const [cardStatusURL, setCardStatusURL] = useState(null);\n // const [cardStatusID, setCardStatusID] = useState(null);\n useEffect(() => {\n if (hasText && image && !selfReferential && isMastodonLinkMaybe(url)) {\n unfurlMastodonLink(instance, url).then((result) => {\n if (!result) return;\n const { id, url } = result;\n setCardStatusURL('#' + url);\n\n // NOTE: This is for quote post\n // (async () => {\n // const { masto } = api({ instance });\n // const status = await masto.v1.statuses.$select(id).fetch();\n // saveStatus(status, instance);\n // setCardStatusID(id);\n // })();\n });\n }\n }, [hasText, image, selfReferential]);\n\n // if (cardStatusID) {\n // return (\n // \n // );\n // }\n\n if (snapStates.unfurledLinks[url]) return null;\n\n const hasIframeHTML = /