(()=>{"use strict";function e(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let t={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function s(e){t=e}const n={exec:()=>null};function i(e,t=""){let s="string"==typeof e?e:e.source;const n={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(r.caret,"$1"),s=s.replace(e,i),n},getRegex:()=>new RegExp(s,t)};return n}const r={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},o=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,a=/(?:[*+-]|\d{1,9}[.)])/,l=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,c=i(l).replace(/bull/g,a).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),h=i(l).replace(/bull/g,a).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),p=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,u=/(?!\s*\])(?:\\.|[^\[\]\\])+/,d=i(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",u).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),g=i(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,a).getRegex(),f="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",m=/|$))/,k=i("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",m).replace("tag",f).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),x=i(p).replace("hr",o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",f).getRegex(),b={blockquote:i(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",x).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:d,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:o,html:k,lheading:c,list:g,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:x,table:n,text:/^[^\n]+/},y=i("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",f).getRegex(),w={...b,lheading:h,table:y,paragraph:i(p).replace("hr",o).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",y).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",f).getRegex()},v={...b,html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",m).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:n,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:i(p).replace("hr",o).replace("heading"," *#{1,6} *[^\n]").replace("lheading",c).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},S=/^( {2,}|\\)\n(?!\s*$)/,$=/[\p{P}\p{S}]/u,L=/[\s\p{P}\p{S}]/u,R=/[^\s\p{P}\p{S}]/u,C=i(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,L).getRegex(),O=/(?!~)[\p{P}\p{S}]/u,T=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,E=i(T,"u").replace(/punct/g,$).getRegex(),A=i(T,"u").replace(/punct/g,O).getRegex(),P="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",N=i(P,"gu").replace(/notPunctSpace/g,R).replace(/punctSpace/g,L).replace(/punct/g,$).getRegex(),I=i(P,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,O).getRegex(),_=i("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,R).replace(/punctSpace/g,L).replace(/punct/g,$).getRegex(),j=i(/\\(punct)/,"gu").replace(/punct/g,$).getRegex(),z=i(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),D=i(m).replace("(?:--\x3e|$)","--\x3e").getRegex(),M=i("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",D).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),F=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,B=i(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",F).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),H=i(/^!?\[(label)\]\[(ref)\]/).replace("label",F).replace("ref",u).getRegex(),q=i(/^!?\[(ref)\](?:\[\])?/).replace("ref",u).getRegex(),V={_backpedal:n,anyPunctuation:j,autolink:z,blockSkip:/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,br:S,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:n,emStrongLDelim:E,emStrongRDelimAst:N,emStrongRDelimUnd:_,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:B,nolink:q,punctuation:C,reflink:H,reflinkSearch:i("reflink|nolink(?!\\()","g").replace("reflink",H).replace("nolink",q).getRegex(),tag:M,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},W=e=>G[e];function Y(e,t){if(t){if(r.escapeTest.test(e))return e.replace(r.escapeReplace,W)}else if(r.escapeTestNoEncode.test(e))return e.replace(r.escapeReplaceNoEncode,W);return e}function X(e){try{e=encodeURI(e).replace(r.percentDecode,"%")}catch{return null}return e}function ee(e,t){const s=e.replace(r.findPipe,((e,t,s)=>{let n=!1,i=t;for(;--i>=0&&"\\"===s[i];)n=!n;return n?"|":" |"})).split(r.splitPipe);let n=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:te(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],s=function(e,t,s){const n=e.match(s.other.indentCodeCompensation);if(null===n)return t;const i=n[1];return t.split("\n").map((e=>{const t=e.match(s.other.beginningSpace);if(null===t)return e;const[n]=t;return n.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){const t=te(e,"#");this.options.pedantic?e=t.trim():t&&!this.rules.other.endingSpaceChar.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:te(t[0],"\n")}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=te(t[0],"\n").split("\n"),s="",n="";const i=[];for(;e.length>0;){let t=!1;const r=[];let o;for(o=0;o1,i={type:"list",raw:"",ordered:n,start:n?+s.slice(0,-1):"",loose:!1,items:[]};s=n?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=n?s:"[*+-]");const r=this.rules.other.listItemRegex(s);let o=!1;for(;e;){let s=!1,n="",a="";if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;n=t[0],e=e.substring(n.length);let l=t[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=!l.trim(),p=0;if(this.options.pedantic?(p=2,a=l.trimStart()):h?p=t[1].length+1:(p=t[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,a=l.slice(p),p+=t[1].length),h&&this.rules.other.blankLine.test(c)&&(n+=c+"\n",e=e.substring(c.length+1),s=!0),!s){const t=this.rules.other.nextBulletRegex(p),s=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),r=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p);for(;e;){const u=e.split("\n",1)[0];let d;if(c=u,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),d=c):d=c.replace(this.rules.other.tabCharGlobal," "),i.test(c))break;if(r.test(c))break;if(o.test(c))break;if(t.test(c))break;if(s.test(c))break;if(d.search(this.rules.other.nonSpaceChar)>=p||!c.trim())a+="\n"+d.slice(p);else{if(h)break;if(l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4)break;if(i.test(l))break;if(r.test(l))break;if(s.test(l))break;a+="\n"+c}h||c.trim()||(h=!0),n+=u+"\n",e=e.substring(u.length+1),l=d.slice(p)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(n)&&(o=!0));let u,d=null;this.options.gfm&&(d=this.rules.other.listIsTask.exec(a),d&&(u="[ ] "!==d[0],a=a.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:n,task:!!d,checked:u,loose:!1,text:a,tokens:[]}),i.raw+=n}const a=i.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e"space"===e.type)),s=t.length>0&&t.some((e=>this.rules.other.anyLine.test(e.raw)));i.loose=s}if(i.loose)for(let e=0;e({text:e,tokens:this.lexer.inline(e),header:!1,align:r.align[t]}))));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;const t=te(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let s=0;for(let n=0;n0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){const s=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,s).trim(),t[3]=""}}let s=t[2],n="";if(this.options.pedantic){const e=this.rules.other.pedanticHrefTitle.exec(s);e&&(s=e[1],n=e[3])}else n=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(s=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?s.slice(1):s.slice(1,-1)),se(t,{href:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s,title:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n},t[0],this.lexer,this.rules)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){const e=t[(s[2]||s[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){const e=s[0].charAt(0);return{type:"text",raw:e,text:e}}return se(s,e,s[0],this.lexer,this.rules)}}emStrong(e,t,s=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n)return;if(n[3]&&s.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const s=[...n[0]].length-1;let i,r,o=s,a=0;const l="*"===n[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+s);null!=(n=l.exec(t));){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i)continue;if(r=[...i].length,n[3]||n[4]){o+=r;continue}if((n[5]||n[6])&&s%3&&!((s+r)%3)){a+=r;continue}if(o-=r,o>0)continue;r=Math.min(r,r+o+a);const t=[...n[0]][0].length,l=e.slice(0,s+n.index+t+r);if(Math.min(s,r)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," ");const s=this.rules.other.nonSpaceChar.test(e),n=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return s&&n&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,s;return"@"===t[2]?(e=t[1],s="mailto:"+e):(e=t[1],s=e),{type:"link",raw:t[0],text:e,href:s,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,s;if("@"===t[2])e=t[0],s="mailto:"+e;else{let n;do{n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(n!==t[0]);e=t[0],s="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:s,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}}class ie{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||t,this.options.tokenizer=this.options.tokenizer||new ne,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const s={other:r,block:J.normal,inline:Q.normal};this.options.pedantic?(s.block=J.pedantic,s.inline=Q.pedantic):this.options.gfm&&(s.block=J.gfm,this.options.breaks?s.inline=Q.breaks:s.inline=Q.gfm),this.tokenizer.rules=s}static get rules(){return{block:J,inline:Q}}static lex(e,t){return new ie(t).lex(e)}static lexInline(e,t){return new ie(t).inlineTokens(e)}lex(e){e=e.replace(r.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0))))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);const s=t.at(-1);1===n.raw.length&&void 0!==s?s.raw+="\n":t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);const s=t.at(-1);"paragraph"===s?.type||"text"===s?.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.at(-1).src=s.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);const s=t.at(-1);"paragraph"===s?.type||"text"===s?.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0;const s=e.slice(1);let n;this.options.extensions.startBlock.forEach((e=>{n=e.call({lexer:this},s),"number"==typeof n&&n>=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(i))){const r=t.at(-1);s&&"paragraph"===r?.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(n),s=i.length!==e.length,e=e.substring(n.raw.length)}else if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);const s=t.at(-1);"text"===s?.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(n)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let s=e,n=null;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(n=this.tokenizer.rules.inline.reflinkSearch.exec(s));)e.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(n=this.tokenizer.rules.inline.anyPunctuation.exec(s));)s=s.slice(0,n.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(n=this.tokenizer.rules.inline.blockSkip.exec(s));)s=s.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,r="";for(;e;){let n;if(i||(r=""),i=!1,this.options.extensions?.inline?.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0))))continue;if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);const s=t.at(-1);"text"===n.type&&"text"===s?.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,s,r)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0;const s=e.slice(1);let n;this.options.extensions.startInline.forEach((e=>{n=e.call({lexer:this},s),"number"==typeof n&&n>=0&&(t=Math.min(t,n))})),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(o)){e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(r=n.raw.slice(-1)),i=!0;const s=t.at(-1);"text"===s?.type?(s.raw+=n.raw,s.text+=n.text):t.push(n)}else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return t}}class re{options;parser;constructor(e){this.options=e||t}space(e){return""}code({text:e,lang:t,escaped:s}){const n=(t||"").match(r.notSpaceStart)?.[0],i=e.replace(r.endingNewline,"")+"\n";return n?'
'+(s?i:Y(i,!0))+"
\n":"
"+(s?i:Y(i,!0))+"
\n"}blockquote({tokens:e}){return`
\n${this.parser.parse(e)}
\n`}html({text:e}){return e}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)}\n`}hr(e){return"
\n"}list(e){const t=e.ordered,s=e.start;let n="";for(let t=0;t\n"+n+"\n"}listitem(e){let t="";if(e.task){const s=this.checkbox({checked:!!e.checked});e.loose?"paragraph"===e.tokens[0]?.type?(e.tokens[0].text=s+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=s+" "+Y(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:s+" ",text:s+" ",escaped:!0}):t+=s+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`
  • ${t}
  • \n`}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    \n`}table(e){let t="",s="";for(let t=0;t${n}`),"\n\n"+t+"\n"+n+"
    \n"}tablerow({text:e}){return`\n${e}\n`}tablecell(e){const t=this.parser.parseInline(e.tokens),s=e.header?"th":"td";return(e.align?`<${s} align="${e.align}">`:`<${s}>`)+t+`\n`}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${Y(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:s}){const n=this.parser.parseInline(s),i=X(e);if(null===i)return n;let r='
    ",r}image({href:e,title:t,text:s,tokens:n}){n&&(s=this.parser.parseInline(n,this.parser.textRenderer));const i=X(e);if(null===i)return Y(s);let r=`${s}{const i=e[n].flat(1/0);s=s.concat(this.walkTokens(i,t))})):e.tokens&&(s=s.concat(this.walkTokens(e.tokens,t)))}}return s}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const s={...e};if(s.async=this.defaults.async||s.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const s=t.renderers[e.name];t.renderers[e.name]=s?function(...t){let n=e.renderer.apply(this,t);return!1===n&&(n=s.apply(this,t)),n}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const s=t[e.level];s?s.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),s.extensions=t),e.renderer){const t=this.defaults.renderer||new re(this.defaults);for(const s in e.renderer){if(!(s in t))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;const n=s,i=e.renderer[n],r=t[n];t[n]=(...e)=>{let s=i.apply(t,e);return!1===s&&(s=r.apply(t,e)),s||""}}s.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new ne(this.defaults);for(const s in e.tokenizer){if(!(s in t))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const n=s,i=e.tokenizer[n],r=t[n];t[n]=(...e)=>{let s=i.apply(t,e);return!1===s&&(s=r.apply(t,e)),s}}s.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new le;for(const s in e.hooks){if(!(s in t))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;const n=s,i=e.hooks[n],r=t[n];le.passThroughHooks.has(s)?t[n]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then((e=>r.call(t,e)));const s=i.call(t,e);return r.call(t,s)}:t[n]=(...e)=>{let s=i.apply(t,e);return!1===s&&(s=r.apply(t,e)),s}}s.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,n=e.walkTokens;s.walkTokens=function(e){let s=[];return s.push(n.call(this,e)),t&&(s=s.concat(t.call(this,e))),s}}this.defaults={...this.defaults,...s}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ie.lex(e,t??this.defaults)}parser(e,t){return ae.parse(e,t??this.defaults)}parseMarkdown(e){return(t,s)=>{const n={...s},i={...this.defaults,...n},r=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===n.async)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==t)return r(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);const o=i.hooks?i.hooks.provideLexer():e?ie.lex:ie.lexInline,a=i.hooks?i.hooks.provideParser():e?ae.parse:ae.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(t):t).then((e=>o(e,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>a(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(r);try{i.hooks&&(t=i.hooks.preprocess(t));let e=o(t,i);i.hooks&&(e=i.hooks.processAllTokens(e)),i.walkTokens&&this.walkTokens(e,i.walkTokens);let s=a(e,i);return i.hooks&&(s=i.hooks.postprocess(s)),s}catch(e){return r(e)}}}onError(e,t){return s=>{if(s.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="

    An error occurred:

    "+Y(s.message+"",!0)+"
    ";return t?Promise.resolve(e):e}if(t)return Promise.reject(s);throw s}}};function he(e,t){return ce.parse(e,t)}he.options=he.setOptions=function(e){return ce.setOptions(e),he.defaults=ce.defaults,s(he.defaults),he},he.getDefaults=e,he.defaults=t,he.use=function(...e){return ce.use(...e),he.defaults=ce.defaults,s(he.defaults),he},he.walkTokens=function(e,t){return ce.walkTokens(e,t)},he.parseInline=ce.parseInline,he.Parser=ae,he.parser=ae.parse,he.Renderer=re,he.TextRenderer=oe,he.Lexer=ie,he.lexer=ie.lex,he.Tokenizer=ne,he.Hooks=le,he.parse=he;he.options,he.setOptions,he.use,he.walkTokens,he.parseInline,ae.parse,ie.lex;const pe=e=>"string"==typeof e,ue=()=>{let e,t;const s=new Promise(((s,n)=>{e=s,t=n}));return s.resolve=e,s.reject=t,s},de=e=>null==e?"":""+e,ge=/###/g,fe=e=>e&&e.indexOf("###")>-1?e.replace(ge,"."):e,me=e=>!e||pe(e),ke=(e,t,s)=>{const n=pe(t)?t.split("."):t;let i=0;for(;i{const{obj:n,k:i}=ke(e,t,Object);if(void 0!==n||1===t.length)return void(n[i]=s);let r=t[t.length-1],o=t.slice(0,t.length-1),a=ke(e,o,Object);for(;void 0===a.obj&&o.length;)r=`${o[o.length-1]}.${r}`,o=o.slice(0,o.length-1),a=ke(e,o,Object),a?.obj&&void 0!==a.obj[`${a.k}.${r}`]&&(a.obj=void 0);a.obj[`${a.k}.${r}`]=s},be=(e,t)=>{const{obj:s,k:n}=ke(e,t);if(s&&Object.prototype.hasOwnProperty.call(s,n))return s[n]},ye=(e,t,s)=>{for(const n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?pe(e[n])||e[n]instanceof String||pe(t[n])||t[n]instanceof String?s&&(e[n]=t[n]):ye(e[n],t[n],s):e[n]=t[n]);return e},we=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var ve={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Se=e=>pe(e)?e.replace(/[&<>"'\/]/g,(e=>ve[e])):e;const $e=[" ",",","?","!",";"],Le=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}(20),Re=function(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const n=t.split(s);let i=e;for(let e=0;e-1&&oe?.replace("_","-"),Oe={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class Te{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Oe,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),s=0;s{this.observers[e]||(this.observers[e]=new Map);const s=this.observers[e].get(t)||0;this.observers[e].set(t,s+1)})),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),n=1;n{let[t,n]=e;for(let e=0;e{let[n,i]=t;for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,r=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],s&&(Array.isArray(s)?o.push(...s):pe(s)&&i?o.push(...s.split(i)):o.push(s)));const a=be(this.data,o);return!a&&!t&&!s&&e.indexOf(".")>-1&&(e=o[0],t=o[1],s=o.slice(2).join(".")),!a&&r&&pe(s)?Re(this.data?.[e]?.[t],s,i):a}addResource(e,t,s,n){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const r=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator;let o=[e,t];s&&(o=o.concat(r?s.split(r):s)),e.indexOf(".")>-1&&(o=e.split("."),n=t,t=o[1]),this.addNamespaces(t),xe(this.data,o,n),i.silent||this.emit("added",e,t,s,n)}addResources(e,t,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const n in s)(pe(s[n])||Array.isArray(s[n]))&&this.addResource(e,t,n,s[n],{silent:!0});n.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,n,i){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),n=s,s=t,t=o[1]),this.addNamespaces(t);let a=be(this.data,o)||{};r.skipCopy||(s=JSON.parse(JSON.stringify(s))),n?ye(a,s,i):a={...a,...s},xe(this.data,o,a),r.silent||this.emit("added",e,t,s)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((e=>t[e]&&Object.keys(t[e]).length>0))}toJSON(){return this.data}}var Ne={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,s,n,i){return e.forEach((e=>{t=this.processors[e]?.process(t,s,n,i)??t})),t}};const Ie={},_e=e=>!pe(e)&&"boolean"!=typeof e&&"number"!=typeof e;class je extends Ae{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),((e,t,s)=>{e.forEach((e=>{t[e]&&(s[e]=t[e])}))})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=Ee.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const s=this.resolve(e,t);return void 0!==s?.res}extractFromKey(e,t){let s=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===s&&(s=":");const n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let i=t.ns||this.options.defaultNS||[];const r=s&&e.indexOf(s)>-1,o=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,s)=>{t=t||"",s=s||"";const n=$e.filter((e=>t.indexOf(e)<0&&s.indexOf(e)<0));if(0===n.length)return!0;const i=Le.getRegExp(`(${n.map((e=>"?"===e?"\\?":e)).join("|")})`);let r=!i.test(e);if(!r){const t=e.indexOf(s);t>0&&!i.test(e.substring(0,t))&&(r=!0)}return r})(e,s,n));if(r&&!o){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:pe(i)?[i]:i};const r=e.split(s);(s!==n||s===n&&this.options.ns.indexOf(r[0])>-1)&&(i=r.shift()),e=r.join(n)}return{key:e,namespaces:pe(i)?[i]:i}}translate(e,t,s){if("object"!=typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof options&&(t={...t}),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const n=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:r,namespaces:o}=this.extractFromKey(e[e.length-1],t),a=o[o.length-1],l=t.lng||this.language,c=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===l?.toLowerCase()){if(c){const e=t.nsSeparator||this.options.nsSeparator;return n?{res:`${a}${e}${r}`,usedKey:r,exactUsedKey:r,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:`${a}${e}${r}`}return n?{res:r,usedKey:r,exactUsedKey:r,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:r}const h=this.resolve(e,t);let p=h?.res;const u=h?.usedKey||r,d=h?.exactUsedKey||r,g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,f=!this.i18nFormat||this.i18nFormat.handleAsObject,m=void 0!==t.count&&!pe(t.count),k=je.hasDefaultValue(t),x=m?this.pluralResolver.getSuffix(l,t.count,t):"",b=t.ordinal&&m?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",y=m&&!t.ordinal&&0===t.count,w=y&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${x}`]||t[`defaultValue${b}`]||t.defaultValue;let v=p;f&&!p&&k&&(v=w);const S=_e(v),$=Object.prototype.toString.apply(v);if(!(f&&v&&S&&["[object Number]","[object Function]","[object RegExp]"].indexOf($)<0)||pe(g)&&Array.isArray(v))if(f&&pe(g)&&Array.isArray(p))p=p.join(g),p&&(p=this.extendTranslation(p,e,t,s));else{let n=!1,o=!1;!this.isValidLookup(p)&&k&&(n=!0,p=w),this.isValidLookup(p)||(o=!0,p=r);const c=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:p,u=k&&w!==p&&this.options.updateMissing;if(o||n||u){if(this.logger.log(u?"updateKey":"missingKey",l,a,r,u?w:p),i){const e=this.resolve(r,{...t,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const s=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&s&&s[0])for(let t=0;t{const i=k&&n!==p?n:c;this.options.missingKeyHandler?this.options.missingKeyHandler(e,a,s,i,u,t):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,a,s,i,u,t),this.emit("missingKey",e,a,s,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&m?e.forEach((e=>{const s=this.pluralResolver.getSuffixes(e,t);y&&t[`defaultValue${this.options.pluralSeparator}zero`]&&s.indexOf(`${this.options.pluralSeparator}zero`)<0&&s.push(`${this.options.pluralSeparator}zero`),s.forEach((s=>{n([e],r+s,t[`defaultValue${s}`]||w)}))})):n(e,r,w))}p=this.extendTranslation(p,e,t,h,s),o&&p===r&&this.options.appendNamespaceToMissingKey&&(p=`${a}:${r}`),(o||n)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}:${r}`:r,n?p:void 0))}else{if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(u,v,{...t,ns:o}):`key '${r} (${this.language})' returned an object instead of string.`;return n?(h.res=e,h.usedParams=this.getUsedParamsDetails(t),h):e}if(i){const e=Array.isArray(v),s=e?[]:{},n=e?d:u;for(const e in v)if(Object.prototype.hasOwnProperty.call(v,e)){const r=`${n}${i}${e}`;s[e]=k&&!p?this.translate(r,{...t,defaultValue:_e(w)?w[e]:void 0,joinArrays:!1,ns:o}):this.translate(r,{...t,joinArrays:!1,ns:o}),s[e]===r&&(s[e]=v[e])}p=s}}return n?(h.res=p,h.usedParams=this.getUsedParamsDetails(t),h):p}extendTranslation(e,t,s,n,i){var r=this;if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const o=pe(e)&&(void 0!==s?.interpolation?.skipOnVariables?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(o){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let l=s.replace&&!pe(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,s.lng||this.language||n.usedLng,s),o){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(s.nest=!1)}!s.lng&&n&&n.res&&(s.lng=this.language||n.usedLng),!1!==s.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,n=new Array(e),o=0;o1&&void 0!==arguments[1]?arguments[1]:{};return pe(e)&&(e=[e]),e.forEach((e=>{if(this.isValidLookup(t))return;const a=this.extractFromKey(e,o),l=a.key;s=l;let c=a.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const h=void 0!==o.count&&!pe(o.count),p=h&&!o.ordinal&&0===o.count,u=void 0!==o.context&&(pe(o.context)||"number"==typeof o.context)&&""!==o.context,d=o.lngs?o.lngs:this.languageUtils.toResolveHierarchy(o.lng||this.language,o.fallbackLng);c.forEach((e=>{this.isValidLookup(t)||(r=e,Ie[`${d[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(r)||(Ie[`${d[0]}-${e}`]=!0,this.logger.warn(`key "${s}" for languages "${d.join(", ")}" won't get resolved as namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),d.forEach((s=>{if(this.isValidLookup(t))return;i=s;const r=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(r,l,s,e,o);else{let e;h&&(e=this.pluralResolver.getSuffix(s,o.count,o));const t=`${this.options.pluralSeparator}zero`,n=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(r.push(l+e),o.ordinal&&0===e.indexOf(n)&&r.push(l+e.replace(n,this.options.pluralSeparator)),p&&r.push(l+t)),u){const s=`${l}${this.options.contextSeparator}${o.context}`;r.push(s),h&&(r.push(s+e),o.ordinal&&0===e.indexOf(n)&&r.push(s+e.replace(n,this.options.pluralSeparator)),p&&r.push(s+t))}}let a;for(;a=r.pop();)this.isValidLookup(t)||(n=a,t=this.getResource(s,e,a,o))})))}))})),{res:t,usedKey:s,exactUsedKey:n,usedLng:i,usedNS:r}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,s,n):this.resourceStore.getResource(e,t,s,n)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=e.replace&&!pe(e.replace);let n=s?e.replace:e;if(s&&void 0!==e.count&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!s){n={...n};for(const e of t)delete n[e]}return n}static hasDefaultValue(e){const t="defaultValue";for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,12)&&void 0!==e[s])return!0;return!1}}class ze{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ee.create("languageUtils")}getScriptPartFromCode(e){if(!(e=Ce(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=Ce(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(pe(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach((e=>{if(t)return;const s=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(s)||(t=s)})),!t&&this.options.supportedLngs&&e.forEach((e=>{if(t)return;const s=this.getScriptPartFromCode(e);if(this.isSupportedCode(s))return t=s;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find((e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0))})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),pe(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){const s=this.getFallbackCodes(t||this.options.fallbackLng||[],e),n=[],i=e=>{e&&(this.isSupportedCode(e)?n.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return pe(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):pe(e)&&i(this.formatLanguageCode(e)),s.forEach((e=>{n.indexOf(e)<0&&i(this.formatLanguageCode(e))})),n}}const De={zero:0,one:1,two:2,few:3,many:4,other:5},Me={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class Fe{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=Ee.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=Ce("dev"===e?"en":e),n=t.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:s,type:n});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let r;try{r=new Intl.PluralRules(s,{type:n})}catch(s){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Me;if(!e.match(/-|_/))return Me;const n=this.languageUtils.getLanguagePartFromCode(e);r=this.getRule(n,t)}return this.pluralRulesCache[i]=r,r}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),s?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,s).map((e=>`${t}${e}`))}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),s?s.resolvedOptions().pluralCategories.sort(((e,t)=>De[e]-De[t])).map((e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`)):[]}getSuffix(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getRule(e,s);return n?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${n.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,s))}}const Be=function(e,t,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=((e,t,s)=>{const n=be(e,s);return void 0!==n?n:be(t,s)})(e,t,s);return!r&&i&&pe(s)&&(r=Re(e,s,n),void 0===r&&(r=Re(t,s,n))),r},He=e=>e.replace(/\$/g,"$$$$");class qe{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=Ee.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:s,useRawValueToEscape:n,prefix:i,prefixEscaped:r,suffix:o,suffixEscaped:a,formatSeparator:l,unescapeSuffix:c,unescapePrefix:h,nestingPrefix:p,nestingPrefixEscaped:u,nestingSuffix:d,nestingSuffixEscaped:g,nestingOptionsSeparator:f,maxReplaces:m,alwaysFormat:k}=e.interpolation;this.escape=void 0!==t?t:Se,this.escapeValue=void 0===s||s,this.useRawValueToEscape=void 0!==n&&n,this.prefix=i?we(i):r||"{{",this.suffix=o?we(o):a||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=p?we(p):u||we("$t("),this.nestingSuffix=d?we(d):g||we(")"),this.nestingOptionsSeparator=f||",",this.maxReplaces=m||1e3,this.alwaysFormat=void 0!==k&&k,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,s,n){let i,r,o;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const i=Be(t,a,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,s,{...n,...t,interpolationkey:e}):i}const i=e.split(this.formatSeparator),r=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Be(t,a,r,this.options.keySeparator,this.options.ignoreJSONStructure),o,s,{...n,...t,interpolationkey:r})};this.resetRegExp();const c=n?.missingInterpolationHandler||this.options.missingInterpolationHandler,h=void 0!==n?.interpolation?.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>He(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?He(this.escape(e)):He(e)}].forEach((t=>{for(o=0;i=t.regex.exec(e);){const s=i[1].trim();if(r=l(s),void 0===r)if("function"==typeof c){const t=c(e,i,n);r=pe(t)?t:""}else if(n&&Object.prototype.hasOwnProperty.call(n,s))r="";else{if(h){r=i[0];continue}this.logger.warn(`missed to pass in variable ${s} for interpolating ${e}`),r=""}else pe(r)||this.useRawValueToEscape||(r=de(r));const a=t.safeValue(r);if(e=e.replace(i[0],a),h?(t.regex.lastIndex+=r.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}})),e}nest(e,t){let s,n,i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=(e,t)=>{const s=this.nestingOptionsSeparator;if(e.indexOf(s)<0)return e;const n=e.split(new RegExp(`${s}[ ]*{`));let r=`{${n[1]}`;e=n[0],r=this.interpolate(r,i);const o=r.match(/'/g),a=r.match(/"/g);((o?.length??0)%2==0&&!a||a.length%2!=0)&&(r=r.replace(/'/g,'"'));try{i=JSON.parse(r),t&&(i={...t,...i})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${s}${r}`}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,e};for(;s=this.nestingRegexp.exec(e);){let a=[];i={...r},i=i.replace&&!pe(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;let l=!1;if(-1!==s[0].indexOf(this.formatSeparator)&&!/{.*}/.test(s[1])){const e=s[1].split(this.formatSeparator).map((e=>e.trim()));s[1]=e.shift(),a=e,l=!0}if(n=t(o.call(this,s[1].trim(),i),i),n&&s[0]===e&&!pe(n))return n;pe(n)||(n=de(n)),n||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),n=""),l&&(n=a.reduce(((e,t)=>this.format(e,t,r.lng,{...r,interpolationkey:s[1].trim()})),n.trim())),e=e.replace(s[0],n),this.regexp.lastIndex=0}return e}}const Ve=e=>{const t={};return(s,n,i)=>{let r=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(r={...r,[i.interpolationkey]:void 0});const o=n+JSON.stringify(r);let a=t[o];return a||(a=e(Ce(n),i),t[o]=a),a(s)}};class Ue{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=Ee.create("formatter"),this.options=e,this.formats={number:Ve(((e,t)=>{const s=new Intl.NumberFormat(e,{...t});return e=>s.format(e)})),currency:Ve(((e,t)=>{const s=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>s.format(e)})),datetime:Ve(((e,t)=>{const s=new Intl.DateTimeFormat(e,{...t});return e=>s.format(e)})),relativetime:Ve(((e,t)=>{const s=new Intl.RelativeTimeFormat(e,{...t});return e=>s.format(e,t.range||"day")})),list:Ve(((e,t)=>{const s=new Intl.ListFormat(e,{...t});return e=>s.format(e)}))},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Ve(t)}format(e,t,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find((e=>e.indexOf(")")>-1))){const e=i.findIndex((e=>e.indexOf(")")>-1));i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce(((e,t)=>{const{formatName:i,formatOptions:r}=(e=>{let t=e.toLowerCase().trim();const s={};if(e.indexOf("(")>-1){const n=e.split("(");t=n[0].toLowerCase().trim();const i=n[1].substring(0,n[1].length-1);"currency"===t&&i.indexOf(":")<0?s.currency||(s.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?s.range||(s.range=i.trim()):i.split(";").forEach((e=>{if(e){const[t,...n]=e.split(":"),i=n.join(":").trim().replace(/^'+|'+$/g,""),r=t.trim();s[r]||(s[r]=i),"false"===i&&(s[r]=!1),"true"===i&&(s[r]=!0),isNaN(i)||(s[r]=parseInt(i,10))}}))}return{formatName:t,formatOptions:s}})(t);if(this.formats[i]){let t=e;try{const o=n?.formatParams?.[n.interpolationkey]||{},a=o.locale||o.lng||n.locale||n.lng||s;t=this.formats[i](e,a,{...r,...n,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e}),e)}}class Ke extends Ae{constructor(e,t,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=n,this.logger=Ee.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(s,n.backend,n)}queueLoad(e,t,s,n){const i={},r={},o={},a={};return e.forEach((e=>{let n=!0;t.forEach((t=>{const o=`${e}|${t}`;!s.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(1===this.state[o]?void 0===r[o]&&(r[o]=!0):(this.state[o]=1,n=!1,void 0===r[o]&&(r[o]=!0),void 0===i[o]&&(i[o]=!0),void 0===a[t]&&(a[t]=!0)))})),n||(o[e]=!0)})),(Object.keys(i).length||Object.keys(r).length)&&this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(i),pending:Object.keys(r),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(a)}}loaded(e,t,s){const n=e.split("|"),i=n[0],r=n[1];t&&this.emit("failedLoading",i,r,t),!t&&s&&this.store.addResourceBundle(i,r,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);const o={};this.queue.forEach((s=>{((e,t,s)=>{const{obj:n,k:i}=ke(e,t,Object);n[i]=n[i]||[],n[i].push(s)})(s.loaded,[i],r),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(s,e),t&&s.errors.push(t),0!==s.pendingCount||s.done||(Object.keys(s.loaded).forEach((e=>{o[e]||(o[e]={});const t=s.loaded[e];t.length&&t.forEach((t=>{void 0===o[e][t]&&(o[e][t]=!0)}))})),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())})),this.emit("loaded",o),this.queue=this.queue.filter((e=>!e.done))}read(e,t,s){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,r=arguments.length>5?arguments[5]:void 0;if(!e.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:s,tried:n,wait:i,callback:r});this.readingCalls++;const o=(o,a)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}o&&a&&n{this.read.call(this,e,t,s,n+1,2*i,r)}),i):r(o,a)},a=this.backend[s].bind(this.backend);if(2!==a.length)return a(e,t,o);try{const s=a(e,t);s&&"function"==typeof s.then?s.then((e=>o(null,e))).catch(o):o(null,s)}catch(e){o(e)}}prepareLoading(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();pe(e)&&(e=this.languageUtils.toResolveHierarchy(e)),pe(t)&&(t=[t]);const i=this.queueLoad(e,t,s,n);if(!i.toLoad.length)return i.pending.length||n(),null;i.toLoad.forEach((e=>{this.loadOne(e)}))}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const s=e.split("|"),n=s[0],i=s[1];this.read(n,i,"read",void 0,void 0,((s,r)=>{s&&this.logger.warn(`${t}loading namespace ${i} for language ${n} failed`,s),!s&&r&&this.logger.log(`${t}loaded namespace ${i} for language ${n}`,r),this.loaded(e,s,r)}))}saveMissing(e,t,s,n,i){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(t)){if(null!=s&&""!==s){if(this.backend?.create){const a={...r,isUpdate:i},l=this.backend.create.bind(this.backend);if(l.length<6)try{let i;i=5===l.length?l(e,t,s,n,a):l(e,t,s,n),i&&"function"==typeof i.then?i.then((e=>o(null,e))).catch(o):o(null,i)}catch(e){o(e)}else l(e,t,s,n,o,a)}e&&e[0]&&this.store.addResource(e[0],t,s,n)}}else this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const Ze=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),pe(e[1])&&(t.defaultValue=e[1]),pe(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const s=e[3]||e[2];Object.keys(s).forEach((e=>{t[e]=s[e]}))}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Je=e=>(pe(e.ns)&&(e.ns=[e.ns]),pe(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),pe(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),Qe=()=>{};class Ge extends Ae{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var s;if(super(),this.options=Je(e),this.services={},this.logger=Ee,this.modules={external:[]},s=this,Object.getOwnPropertyNames(Object.getPrototypeOf(s)).forEach((e=>{"function"==typeof s[e]&&(s[e]=s[e].bind(s))})),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout((()=>{this.init(e,t)}),0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof t&&(s=t,t={}),null==t.defaultNS&&t.ns&&(pe(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const n=Ze();this.options={...n,...this.options,...Je(t)},this.options.interpolation={...n.interpolation,...this.options.interpolation},void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator);const i=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?Ee.init(i(this.modules.logger),this.options):Ee.init(null,this.options),t=this.modules.formatter?this.modules.formatter:Ue;const s=new ze(this.options);this.store=new Pe(this.options.resources,this.options);const r=this.services;r.logger=Ee,r.resourceStore=this.store,r.languageUtils=s,r.pluralResolver=new Fe(s,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format||(r.formatter=i(t),r.formatter.init(r,this.options),this.options.interpolation.format=r.formatter.format.bind(r.formatter)),r.interpolator=new qe(this.options),r.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},r.backendConnector=new Ke(i(this.modules.backend),r.resourceStore,r,this.options),r.backendConnector.on("*",(function(t){for(var s=arguments.length,n=new Array(s>1?s-1:0),i=1;i1?s-1:0),i=1;i{e.init&&e.init(this)}))}if(this.format=this.options.interpolation.format,s||(s=Qe),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((t=>{this[t]=function(){return e.store[t](...arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((t=>{this[t]=function(){return e.store[t](...arguments),e}}));const r=ue(),o=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),r.resolve(t),s(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?o():setTimeout(o,0),r}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe;const s=pe(e)?e:this.language;if("function"==typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===s?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],n=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach((t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)}))};if(s)n(s);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e=>n(e)))}this.options.preload?.forEach?.((e=>n(e))),this.services.backendConnector.load(e,this.options.ns,(e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)}))}else t(null)}reloadResources(e,t,s){const n=ue();return"function"==typeof e&&(s=e,e=void 0),"function"==typeof t&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=Qe),this.services.backendConnector.reload(e,t,(e=>{n.resolve(),s(e)})),n}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Ne.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){var s=this;this.isLanguageChangingTo=e;const n=ue();this.emit("languageChanging",e);const i=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},r=(r,o)=>{o?this.isLanguageChangingTo===e&&(i(o),this.translator.changeLanguage(o),this.isLanguageChangingTo=void 0,this.emit("languageChanged",o),this.logger.log("languageChanged",o)):this.isLanguageChangingTo=void 0,n.resolve((function(){return s.t(...arguments)})),t&&t(r,(function(){return s.t(...arguments)}))},o=t=>{e||t||!this.services.languageDetector||(t=[]);const s=pe(t)?t:t&&t[0],n=this.store.hasLanguageSomeTranslations(s)?s:this.services.languageUtils.getBestMatchFromCodes(pe(t)?[t]:t);n&&(this.language||i(n),this.translator.language||this.translator.changeLanguage(n),this.services.languageDetector?.cacheUserLanguage?.(n)),this.loadResources(n,(e=>{r(e,n)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),n}getFixedT(e,t,s){var n=this;const i=function(e,t){let r;if("object"!=typeof t){for(var o=arguments.length,a=new Array(o>2?o-2:0),l=2;l`${r.keyPrefix}${c}${e}`)):r.keyPrefix?`${r.keyPrefix}${c}${e}`:e,n.t(h,r)};return pe(e)?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=s,i}t(){for(var e=arguments.length,t=new Array(e),s=0;s1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const s=t.lng||this.resolvedLanguage||this.languages[0],n=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===s.toLowerCase())return!0;const r=(e,t)=>{const s=this.services.backendConnector.state[`${e}|${t}`];return-1===s||0===s||2===s};if(t.precheck){const e=t.precheck(this,r);if(void 0!==e)return e}return!!this.hasResourceBundle(s,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!r(s,e)||n&&!r(i,e)))}loadNamespaces(e,t){const s=ue();return this.options.ns?(pe(e)&&(e=[e]),e.forEach((e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)})),this.loadResources((e=>{s.resolve(),t&&t(e)})),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){const s=ue();pe(e)&&(e=[e]);const n=this.options.preload||[],i=e.filter((e=>n.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e)));return i.length?(this.options.preload=n.concat(i),this.loadResources((e=>{s.resolve(),t&&t(e)})),s):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services?.languageUtils||new ze(Ze());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new Ge(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe;const s=e.forkResourceStore;s&&delete e.forkResourceStore;const n={...this.options,...e,isClone:!0},i=new Ge(n);void 0===e.debug&&void 0===e.prefix||(i.logger=i.logger.clone(e));if(["store","services","language"].forEach((e=>{i[e]=this[e]})),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},s){const e=Object.keys(this.store.data).reduce(((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce(((s,n)=>(s[n]={...e[t][n]},s)),e[t]),e)),{});i.store=new Pe(e,n),i.services.resourceStore=i.store}return i.translator=new je(i.services,n),i.translator.on("*",(function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),n=1;n{yt(),Xe&&Xe.removeChild(t)}));const n=document.createElement("p");n.textContent=Ye("support"),n.style.marginTop="0.375rem",n.style.fontSize="1rem",n.style.fontWeight="bold",n.style.color="peru",n.style.lineHeight="2rem",n.style.marginRight="0.75rem",n.style.overflow="hidden",n.style.textOverflow="ellipsis",n.style.whiteSpace="nowrap",n.style.marginBottom="0";const i=document.createElement("p");i.innerHTML=e,i.style.overflow="hidden",i.style.lineHeight="1.25rem",i.style.wordBreak="break-word",i.style.color="#7f7f7f",i.style.maxHeight="2.5rem",i.style.fontSize="small",i.style.marginTop="0";const r=document.createElement("button");r.style.width="4rem",r.style.cursor="pointer",r.style.outline="none",r.style.border="none",r.style.background="none";const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("stroke-width","2"),o.setAttribute("stroke","rgba(31,41,55)"),o.setAttribute("fill","none"),o.style.width="1.75rem",o.style.height="1.75rem";const a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("d","M6 18L18 6M6 6l12 12"),a.setAttribute("stroke-linejoin","round"),a.setAttribute("stroke-linecap","round"),o.appendChild(a),r.appendChild(o),s.appendChild(n),s.appendChild(i),t.appendChild(s),t.appendChild(r);const l=document.querySelector("#lsw_chat_popup");Xe&&l&&"none"==l.style.display&&(Xe.appendChild(t),setTimeout((()=>{Xe&&Xe.removeChild(t)}),5e3)),r.addEventListener("click",(()=>{Xe&&Xe.removeChild(t)}))}},tt="https://apid.launchstrategies.ru";let st,nt=!1,it=new et;new class{report(e){fetch("https://apid.launchstrategies.ru/widget/bug",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}};const rt=document.createElement("div");function ot(e,t="",s){let n="";if("object"==typeof t){if(t.date){let e=new Date(t.date);n=`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`}t=t.text||""}const i=document.createElement("div");i.style.position="relative",i.className="flex mb-3"+(s?" justify-end":"");const r=document.createElement("div");r.style.position="relative",r.style.paddingBottom="0.9em",r.style.paddingRight="3em",r.classList.add("text-"+(s?"white":"black"),"rounded-lg","py-2","px-4","max-w-[70%]"),s?r.classList.add("bg-gray-800"):r.style.backgroundColor="#E6EAF2",r.innerHTML=function(e){return e.replace(/\+?\d[\d\-\(\) ]{9,}\d/g,(e=>`
    ${e}`))}(t),i.appendChild(r),e.appendChild(i),e.scrollTop=e.scrollHeight;const o=document.createElement("div");return o.innerHTML=n,o.classList.add("clock"),r.appendChild(o),i}async function at(e,t){const s=mt;if(s){if(kt&&(kt.value=""),"object"==typeof e&&e instanceof EventSource){let t,n;return e.addEventListener("textCreated",(()=>{t=ot(s)})),e.addEventListener("typing",(()=>{n=ot(s,rt.outerHTML)})),e.addEventListener("textDelta",(({data:e})=>{const n=t.querySelector("div");n&&(n.innerHTML=he.parse(n.innerText+e).toString(),s.scrollTop=s.scrollHeight)})),void e.addEventListener("messageDone",(({data:i})=>{if(n?.parentNode&&n.parentNode.removeChild(n),e.close(),i)try{const e=JSON.parse(i);let n="";if(!e?.content?.length)return;(n=e.content[0].text.value)||(n="Что-то пошло не так. Попробуйте позже пожалуйста."),t?.querySelector("div")?t.querySelector("div").innerHTML=he.parse(n).toString():t=ot(s,{text:n,date:(new Date).valueOf()}),it.newMessageNotify(n),async function(e,t){let s=!1;const n="string"==typeof e?e:e.content,i=localStorage.getItem("aiwi_messages"),r=i?JSON.parse(i):[];r.length&&(s=!0),r.push({role:t?"user":"assistant",content:n,date:"string"==typeof e?(new Date).valueOf():e.date}),localStorage.setItem("aiwi_messages",JSON.stringify(r));const o=localStorage.getItem("aiwi_thread_id");s&&o&&await fetch(`${tt}/widget/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({thread:o})}).then((e=>e.json())).catch((e=>console.error("error chat notify",e.message)))}(n)}catch(e){console.error("error processing message",e)}}))}("string"!=typeof e&&e?e:[{role:t?"user":"assistant",content:e,date:(new Date).valueOf()}]).forEach((t=>{let n="user"==t.role;if(t.content&&ot(s,{text:he.parse(t.content).toString(),date:t.date},n),e){const s=localStorage.getItem("aiwi_messages"),i=s?JSON.parse(s):[];i.push({role:n?"user":"assistant",content:t.content,date:(new Date).valueOf()}),"string"==typeof e&&localStorage.setItem("aiwi_messages",JSON.stringify(i))}}))}else console.log("chatMessages div not found")}async function lt(){if(st&&st.readyState!==st.CLOSED)return;const e=localStorage.getItem("aiwi_thread_id");e&&(st=new EventSource(`${tt}/widget/listen/`+e),st.addEventListener("operatorMessage",(({data:e})=>{nt=!0,it.newMessageNotify(e),at(e)})),st.addEventListener("operatorDisconnected",(({data:e})=>{nt=!1})),st.onerror=e=>{console.error("tonnel err",e),st.close(),setTimeout((()=>{lt()}),3e3)})}async function ct(){const e=localStorage.getItem("aiwi_thread_id"),t=localStorage.getItem("aiwi_messages");if(e)return t&&(mt&&(mt.innerHTML=""),console.log("exist message",t),at(JSON.parse(t))),t?null:e;const s=new Headers;s.append("Content-Type","application/json");const n=JSON.stringify({messages:[{role:"assistant",content:"Вас приветствует ИИ ассистент Инновационной клиники косметологии в Bunt Clinic"}],assistant_id:"67caa3d85fb4f384e6a24d64"}),i=await fetch(`${tt}/assistants/threads`,{method:"POST",headers:s,body:n}).then((e=>e.json())).catch((e=>console.log("error",e)));return i?.id?(localStorage.setItem("aiwi_thread_id",i.id),st&&st.close(),lt(),i.id):void 0}rt.classList.add("typing-indicator"),rt.classList.add("flex"),rt.classList.add("items-center"),rt.classList.add("space-x-1"),rt.innerHTML='
    \n
    \n
    ';class ht{static sendEvent(e){const t="Ya"in window?window.Ya._metrika.getCounters().map((e=>e.id)):null;t?.length&&t.map((t=>{"ym"in window&&window.ym(t,"reachGoal",e)}))}static openChat(e="LSChat_Client_open_chat"){this.sendEvent(e)}static sendMessage(e="LSChat_Client_send_message"){this.sendEvent(e)}static sendLead(e="LSChat_Client_send_lead"){this.sendEvent(e)}static sendWhatsapp(e="LSChat_Client_click_whatsapp"){this.sendEvent(e)}static sendVk(e="LSChat_Client_click_vk"){this.sendEvent(e)}static sendPhone(e="LSChat_Client_click_phone"){this.sendEvent(e)}static sendTelegram(e="LSChat_Client_click_telegram"){this.sendEvent(e)}}let pt=document.createElement("div");new et;const ut="-25,10".split(",").map((e=>Number(e))),dt="#1f2937";let gt;const ft=new Map,mt=document.createElement("div"),kt=document.createElement("textarea");const xt=function(){const e=document.createElement("div");Object.assign(e.style,{position:"relative",height:"4em",width:"4em"}),e.classList.add("animate");for(let t=0;t<3;t++){const t=document.createElement("div");t.classList.add("lsw_waves"),e.appendChild(t)}const t=document.createElement("li");let s=window.matchMedia("(hover: none) and (pointer: coarse)").matches,n=!1;t.addEventListener("click",(e=>{if(!s)return yt(),void(n=!1);n?(n=!1,yt()):(wt(),n=!0,e.preventDefault())})),Object.assign(t.style,{backgroundColor:dt,borderRadius:"9999px",display:"flex",justifyContent:"center",alignItems:"center",cursor:"pointer",width:"4em",height:"4em",position:"absolute",zIndex:100});const i="http://www.w3.org/2000/svg",r=document.createElementNS(i,"svg");r.setAttribute("xmlns",i),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke","currentColor"),r.setAttribute("stroke-width","2"),Object.assign(r.style,{width:"2.5em",height:"2.5em",color:"white"});const o=document.createElementNS(i,"path");o.setAttribute("stroke-linecap","round"),o.setAttribute("stroke-linejoin","round"),o.setAttribute("d","M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"),r.appendChild(o),t.appendChild(r);const a=document.createElement("ul");return a.appendChild(t),Object.assign(a.style,{padding:0,margin:0}),e.appendChild(a),e}(),bt=document.createElement("div");async function yt(){if(bt.style.display="none"==bt.style.display?"flex":"none","none"!=bt.style.display){pt.style.display="none",ht.openChat(),xt&&xt.classList.remove("animate"),kt.focus();const e=await ct();mt.childNodes.length&&!e||(console.log("add message to chat"),at("Вас приветствует ИИ ассистент Инновационной клиники косметологии в Bunt Clinic"))}else xt&&xt.classList.add("animate")}function wt(){if(gt)for(let e=1;e4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};s&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+60*s*1e3)),n&&(i.domain=n),document.cookie=function(e,t){const s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{path:"/"};let n=`${e}=${encodeURIComponent(t)}`;if(s.maxAge>0){const e=s.maxAge-0;if(Number.isNaN(e))throw new Error("maxAge should be a Number");n+=`; Max-Age=${Math.floor(e)}`}if(s.domain){if(!$t.test(s.domain))throw new TypeError("option domain is invalid");n+=`; Domain=${s.domain}`}if(s.path){if(!$t.test(s.path))throw new TypeError("option path is invalid");n+=`; Path=${s.path}`}if(s.expires){if("function"!=typeof s.expires.toUTCString)throw new TypeError("option expires is invalid");n+=`; Expires=${s.expires.toUTCString()}`}if(s.httpOnly&&(n+="; HttpOnly"),s.secure&&(n+="; Secure"),s.sameSite)switch("string"==typeof s.sameSite?s.sameSite.toLowerCase():s.sameSite){case!0:n+="; SameSite=Strict";break;case"lax":n+="; SameSite=Lax";break;case"strict":n+="; SameSite=Strict";break;case"none":n+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return n}(e,encodeURIComponent(t),i)},read(e){const t=`${e}=`,s=document.cookie.split(";");for(let e=0;e-1&&(e=window.location.hash.substring(window.location.hash.indexOf("?")));const n=e.substring(1).split("&");for(let e=0;e0){n[e].substring(0,i)===s&&(t=n[e].substring(i+1))}}}return t}};let Ot=null;const Tt=()=>{if(null!==Ot)return Ot;try{if(Ot="undefined"!=typeof window&&null!==window.localStorage,!Ot)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){Ot=!1}return Ot};var Et={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Tt())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:s}=t;s&&Tt()&&window.localStorage.setItem(s,e)}};let At=null;const Pt=()=>{if(null!==At)return At;try{if(At="undefined"!=typeof window&&null!==window.sessionStorage,!At)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){At=!1}return At};var Nt={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&Pt())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:s}=t;s&&Pt()&&window.sessionStorage.setItem(s,e)}},It={name:"navigator",lookup(e){const t=[];if("undefined"!=typeof navigator){const{languages:e,userLanguage:s,language:n}=navigator;if(e)for(let s=0;s0?t:void 0}},_t={name:"htmlTag",lookup(e){let t,{htmlTag:s}=e;const n=s||("undefined"!=typeof document?document.documentElement:null);return n&&"function"==typeof n.getAttribute&&(t=n.getAttribute("lang")),t}},jt={name:"path",lookup(e){let{lookupFromPathIndex:t}=e;if("undefined"==typeof window)return;const s=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(s))return;const n="number"==typeof t?t:0;return s[n]?.replace("/","")}},zt={name:"subdomain",lookup(e){let{lookupFromSubdomainIndex:t}=e;const s="number"==typeof t?t+1:1,n="undefined"!=typeof window&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(n)return n[s]}};let Dt=!1;try{document.cookie,Dt=!0}catch(e){}const Mt=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Dt||Mt.splice(1,1);class Ft{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,t)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{languageUtils:{}},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=function(e){return St.call(vt.call(arguments,1),(t=>{if(t)for(const s in t)void 0===e[s]&&(e[s]=t[s])})),e}(t,this.options||{},{order:Mt,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=e=>e.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(Rt),this.addDetector(Ct),this.addDetector(Et),this.addDetector(Nt),this.addDetector(It),this.addDetector(_t),this.addDetector(jt),this.addDetector(zt)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.order,t=[];return e.forEach((e=>{if(this.detectors[e]){let s=this.detectors[e].lookup(this.options);s&&"string"==typeof s&&(s=[s]),s&&(t=t.concat(s))}})),t=t.filter((e=>{return null!=e&&!("string"==typeof(t=e)&&[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some((e=>e.test(t))));var t})).map((e=>this.options.convertDetectedLanguage(e))),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.caches;t&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||t.forEach((t=>{this.detectors[t]&&this.detectors[t].cacheUserLanguage(e,this.options)})))}}Ft.type="languageDetector";We.use(Ft).init({resources:{en:{translation:{phone:"Phone",callAsk:"Let us call you back and explain everything",thanks:"Thank you!",waitCall:"Awaiting call!",workTechs:"Powered by technologies",haveQues:"Do you have any questions?",supportChat:"Support Chat",send:"Send",inputMessage:"Enter a message...",callMe:"Call me",support:"Поддержка"}},ru:{translation:{phone:"Телефон",callAsk:"Давайте мы перезвоним вам и все расскажем",thanks:"Благодарим!",waitCall:"Ожидайте звонка!",workTechs:"Работает на технологиях",haveQues:"У вас есть вопросы?",supportChat:"Чат поддержки",send:"Отправить",inputMessage:"Введите сообщение...",callMe:"Жду звонка",support:"Поддержка"}},ee:{translation:{telefon:"Telefon",callAsk:"Lubame teile tagasi helistada ja kõik selgeks rääkida",thanks:"Täname!",waitCall:"Oodake kõnet!",workTechs:"Töötab tehnoloogiatel",haveQues:"Kas teil on küsimusi?",supportChat:"Tugivestluse chat",send:"Saada",inputMessage:"Sisestage sõnum...",callMe:"Helista mulle",support:"Tugi"}}},detection:{convertDetectedLanguage:e=>/ru/i.test(e)?"ru":/ee|et/i.test(e)?"ee":"en"}}),function(){if(Xe)return Xe;const e="-25,10".split(",").map((e=>Number(e)));e[1]+=73,Xe=document.createElement("div"),Xe.style.display="flex",Xe.style.flexDirection="column",Xe.style[e[0]>0?"left":"right"]=Math.abs(e[0])+"px",Xe.style[e[1]>0?"bottom":"top"]=Math.abs(e[1])+"px",Xe.style.position="fixed",Xe.style.zIndex="500",document.body.appendChild(Xe)}()})();