var LichessCli=function(e){"use strict";const n=window.lichess;function t(e,t,a){return'
'+e.split(" ").map(e=>`
${e} ${n.escapeHtml(t)}
`).join("")+`
${a} `}return e.app=function(e,a){const o=e.find("input");n.userAutocomplete(o,{focus:1,friend:!0,onSelect(e){o.val("").blur(),function(e){if(!e)return;if("/"==e[0])return function(e){var a=e.split(" "),o=a[0];const s=function(e){return e.split(" ").includes(o)};s("tv follow")&&a[1]?location.href="/@/"+a[1]+"/tv":s("tv")?location.href="/tv":s("play challenge match")&&a[1]?location.href="/?user="+a[1]+"#friend":s("light dark transp")?(l=e=>e.subs.background.set(o),n.loadScript(n.jsModule("dasher")).then((function(){window.LichessDasher(document.createElement("div"),{playing:$("body").hasClass("playing")}).then(l)}))):s("stream")&&a[1]?location.href="/streamer/"+a[1]:s("help")?(n.loadCssPath("clinput.help"),$.modal("Commands
"+t("/tv /follow"," ","Watch someone play")+t("/play /challenge /match"," ","Challenge someone to play")+t("/light /dark /transp","","Change the background theme")+t("/stream","","Watch someone stream")+"Global hotkeys
"+t("s","","Search for a user")+t("/","","Type a command")+t("c","","Focus the chat input")+t("esc","","Close modals like this one"),"clinput-help")):alert(`Unknown command: "${e}". Type /help for the list of commands`);var l}(e.replace(/\//g,""));location.href="/@/"+e}(e.name||e.trim()),$("body").hasClass("clinput")&&a()}}).done((function(){o.on("blur",()=>{o.val(""),$("body").hasClass("clinput")&&a()})}))},e}({});