g.length));n+=1){let n=(0,m.Og)(g,t,p);if(n||h.length<=1){let r=h.filter((0,c.jE)(g));if((0,m.fN)(g,a)&&1===r.length&&(n||!r[0].is_usergroup))return(0,s.getGenericLogger)().info("AUTOSLUG",`Inserting real mention, only a single matching result (${r[0].id}). ${h.length} total results`),b=(0,c.KX)(r[0]),{id:r[0].id,label:b,globalIndex:u,length:1!==h.length||n?g.length:y.length,formats:f,type:"mention"};if((0,m.fN)(g,a)&&r.length>1){(0,s.getGenericLogger)().info("AUTOSLUG",`${r.length} matching results, trying to break tie using frecency`);let t=e?(0,d.Zh)(e,{query:a,list:r}):[];if(t&&t.length>1&&t[0].rawFrecencyScore-t[1].rawFrecencyScore>=30){let e=(0,o.A)(r,{id:t[0].id});return b=e?(0,c.KX)(e):"",(0,s.getGenericLogger)().info("AUTOSLUG",`Inserting real mention, tie was broken using frecency (${t[0].id}=${t[0].rawFrecencyScore};${t[1].id}=${t[1].rawFrecencyScore})`),{id:e?.id||"",label:b,globalIndex:u,length:1!==h.length||n?g.length:y.length,formats:f,type:"mention"}}}if(n)return(0,s.getGenericLogger)().info("AUTOSLUG",`Inserting maybe-mention mention, expanded mention to cover name (${h.length} total results)`),y.label=t.substr(p,g.length),y.length=g.length,y}}return(0,s.getGenericLogger)().info("AUTOSLUG",`Fallback: Inserting maybe-mention (${h.length} total results)`),y}},0x2023d94c1:(e,t,a)=>{"use strict";a.d(t,{A:()=>getPotentialMentionMatches});var n=a(0xb77a689a),r=a(0xec9d0658),i=a(0x14d2ae7bc),l=a(0x504b7e5),o=a(0x5a228fbb),s=a(0xa326966e),c=a(0xe7cb9732),d=a(0x222762a83),m=a(0x2398accc);let u=i.Nb.concat(["@","#","`","$","%","^","&","+","=","|",'"',"/"]),p=u.filter(e=>"."!==e).map(e=>`\\${e}`).join("|"),h=u.filter(e=>"_"!==e).map(e=>`\\${e}`).join("|"),_=RegExp(`(?:^|\\s)(?:[\\{|\\[|\\(|<|>|\\*|_|\\/|"|\u{201C}|\u{2018}|'|:]?)([@\uFF20].*?)(?=\\s|'s|\u{2018}s|\u{2019}s|\u{2026}|${p}|$)`,"g"),f=RegExp(`(?:^|\\s)(?:[\\{|\\[|\\(|<|>|\\*|_|\\/|"|\u{201C}|\u{2018}|'|:]?)([@\uFF20#\uFF03].*?)(?=\\s|'s|\u{2018}s|\u{2019}s|\u{2026}|${h}|$)`,"g"),b=RegExp(`[\\.|\\s|${p}]+$`),g=RegExp(`(${(0,r.A)().source})`,"g");function getPotentialMentionMatches(e,{useChannelTagging:t=!1}={}){if(!e)return[];let a=0,r=[],i=t?f:_;return(0,l.A)(e,(e,l)=>{if((0,c.A)(l)||!(0,m.A)(e)||(0,s.A)(e)||(0,d.Ay)(e)){a+=(0,o.A)(e);return}(0,n.A)(e.insert)&&e.insert.replace(i,(i,l,o)=>{let s=o,c=l,d=i.indexOf("@");d>0&&(s+=d);let m=i.indexOf("\uFF20");if(m>0&&(s+=m),t){let e=i.indexOf("#");e>0&&(s+=e);let t=i.indexOf("\uFF03");t>0&&(s+=t)}let u=l.length;c=l.replace(b,"");let p=t?c.replace(/^[@\uFF20#\uFF03]/,""):c.replace(/^[@\uFF20]/,"");p.length&&r.push({type:t&&["#","\uFF03"].includes(l.charAt(0))?"channel":"member",text:(0,n.A)(e.insert)?e.insert:"",matchLength:u,label:c,labelWithoutPrefix:p,localIndex:s,globalIndex:s+a})}),(0,n.A)(e.insert)&&e.insert.replace(g,(t,i,l,o)=>{let s=o,c=t.indexOf(":");c>0&&(s+=c);let d=i.length,m=i.replace(/:/g,"");if(!m.length)return;let u=/^:[0-9]+:$/.test(t),p=(0,n.A)(e.insert)?e.insert.substring(0,o):"",h=/(^|\s)[0-9]+$/.test(p);u&&h||r.push({type:"emoji",text:(0,n.A)(e.insert)?e.insert:"",matchLength:d,label:i,labelWithoutPrefix:m,localIndex:s,globalIndex:s+a})}),a+=(0,o.A)(e)}),r}},0xd925f8ca:(e,t,a)=>{"use strict";a.d(t,{A:()=>BaseTextyClass});var n=a(0x1e33662b),r=a.n(n),i=a(0x21f3c49e8),l=a(0x1feee1711),o=a(0x2416351a6),s=a(0xb77a689a),c=a(0xec1862de),d=a(0x1cbdfeceb),m=a(0x206c7a40f),u=a(0xb5e49867),p=a(0x18f2150ea),h=a(0x106809bc6),_=a(0xd4e00a1e),f=a(0x118cdcdea),b=a.n(f),g=a(0x4e47e388),y=a(0x62a17882),A=a(0x1daf4b9c),x=a(0x10e0f5452),E=a(0x3e6dd1df),C=a(0xe32a2cad),k=a(0x8cffd252),v=a(0x20bafd237),S=a(0x20b4dda68),I=a(0x25245e851),w=a(0x7efc6bfa);let T=S.Az-1;function getRelativeIndent(e,t,a){let n=0;e?.forEach(e=>{(0,I.A)(e)&&(n+=1)});let r=t?.indent||0,i=a?.indent||0,l=Math.min(r+i,T);return 2===n&&(l=i>=r?0:r),l}function convertDeltaToBlockFormat({delta:e,format:t,omitFinalBlockFormattingLine:a=!1}){let n=new(b());e?.eachLine((a,r)=>{if(n=n.concat(a),t?.list&&r?.list){let a=getRelativeIndent(e,t,r);n=n.concat(new(b())().insert(`
`,{...r,indent:a}))}else if(t?.blockquote&&r?.list){let a=getRelativeIndent(e,t,r);n=n.concat(new(b())().insert(`
`,{blockquote:!1,border:1,list:r.list,indent:a}))}else n=t?.blockquote&&r?.["code-block"]?n.concat(new(b())().insert(`
`,{blockquote:!1,border:1,"code-block":!0})):n.concat(new(b())().insert(`
`,t))}),t&&t["code-block"]&&(n=n.compose((0,w.A)(n)));let r=!0;if(t?.list||t?.blockquote){let e=0!==n.length()&&n.slice(n.length()-1)||new(b()),a=(0,v.A)(e?.ops),i=a?.attributes,{list:l,indent:o,border:s}=i||{},c=i?.["code-block"],d=t?.indent||0,m=l&&(0,p.A)(s)&&s>0,u=c&&(0,p.A)(s)&&s>0;r=!(l&&(0,p.A)(o)&&o>0&&o>d)&&!m&&!u}if(a&&r||!t){let e=n.length();n=n.slice(0,e-1)}return n}var N=a(0x52bf7626),M=a(0x1ff9f7c84),R=a(0xd40f768d),P=a(0x4e9c6d0d);let L="TEXTY",O=["code-block","blockquote","list","indent","border","header"],addAttributes=(e,t)=>{!e||(0,i.A)(t)||Object.keys(t).forEach(a=>{let n=t[a];(0,l.A)(n)||(0,o.A)(n)||e.setAttribute(a,n)})},hideElFromScreenReaders=e=>{e&&addAttributes(e,{"aria-hidden":!0,tabindex:-1})},buildAutoSlugOptions=(e,t)=>(!!t.forceAutoslugginEnabled||!t.singleLineInput)&&!!t&&!!t.modules&&!!t.modules.tabcomplete&&{getTeamId:t.getTeamId||d.A,getChannelId:t.getChannelId||d.A,enableBroadcastKeywords:t.enableBroadcastKeywords,isAutocompleteOpen:t.isAutocompleteOpen,includeAllBroadcastKeywords:t.includeAllBroadcastKeywords,getUserHighlightWords:t.getUserHighlightWords,promiseToSearchMembers:t.promiseToSearchMembers,promiseToSearchChannels:t.promiseToSearchChannels,promiseToSearchEmoji:t.promiseToSearchEmoji,onMentionReplace:t.onMentionReplace||d.A,useWysiwyg:e.useWysiwyg,usePlainTextMode:t.usePlainTextMode,useChannelTagging:t.useChannelTagging,inlineEmojiIsEnabled:t.inlineEmojiIsEnabled};let BaseTextyClass=class BaseTextyClass{isInComposition;lastSelection;Quill;quill;element;placeholder;nextTextChangeCallbackSource;useWysiwyg;window;options;Parchment;constructor(e,t,a){if(!e||"DIV"!==e.tagName)throw Error('Texty: param "element" must be