1
0
forked from osmarks/potatOS
potatOS/copy-cat/index-ca473d95.js

13 lines
5.0 KiB
JavaScript
Raw Normal View History

2023-11-12 14:57:16 +00:00
/**
* copy-cat: Copyright SquidDev 2023
*
* - @squid-dev/cc-web-term: Copyright SquidDev (BSD-3-Clause)
* - jszip: Copyright Stuart Knightley ((MIT OR GPL-3.0-or-later))
* - preact: Copyright (MIT)
* - setimmediate: Copyright YuzuJS (MIT)
* - style-inject: Copyright EGOIST (MIT)
* - tslib: Copyright Microsoft Corp. (0BSD)
*
* @license
*/define(["exports","vs/editor/editor.main","./persist-7dd7de50"],function(e,o,l){"use strict";let n;o.languages.register({id:"luax",aliases:["LuaX","LuaX","luax"],extensions:[".lua"]}),o.languages.setLanguageConfiguration("luax",{comments:{lineComment:"--",blockComment:["--[[","]]"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"'",close:"'"},{open:'"',close:'"'}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:'"',close:'"'}],indentationRules:{increaseIndentPattern:/((\b(else|function|then|do|repeat)\b((?!\b(end|until)\b).)*)|(\{\s*))$/,decreaseIndentPattern:/^\s*((\b(elseif|else|end|until)\b)|(\})|(\)))/}}),o.languages.setMonarchTokensProvider("luax",{defaultToken:"",tokenPostfix:".lua",keywords:["and","break","do","else","elseif","end","false","for","function","goto","if","in","local","nil","not","or","repeat","return","then","true","until","while"],brackets:[{token:"delimiter.bracket",open:"{",close:"}"},{token:"delimiter.array",open:"[",close:"]"},{token:"delimiter.parenthesis",open:"(",close:")"}],operators:["+","-","*","/","%","^","#","==","~=","<=",">=","<",">","=",";",":",",",".","..","..."],symbols:/[=><!~?:&|+\-*/^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,tokenizer:{root:[[/[a-zA-Z_]\w*/,{cases:{"@keywords":{token:"keyword.$0"},"@default":"identifier"}}],{include:"@whitespace"},[/(,)(\s*)([a-zA-Z_]\w*)(\s*)(:)(?!:)/,["delimiter","","key","","delimiter"]],[/({)(\s*)([a-zA-Z_]\w*)(\s*)(:)(?!:)/,["@brackets","","key","","delimiter"]],[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F_]*[0-9a-fA-F]/,"number.hex"],[/\d+?/,"number"],[/[;,.]/,"delimiter"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'/,"string2","@string.'"],[/"/,"string",'@string."']],whitespace:[[/[ \t\r\n]+/,""],[/--\[([=]*)\[/,"comment","@comment.$1"],[/--.*$/,"comment"]],comment:[[/[^\]]+/,"comment"],[/\]([=]*)\]/,{cases:{"$1==$S2":{token:"comment",next:"@pop"},"@default":"comment"}}],[/./,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]]}});let r=()=>null!=n?n:n=fetch("https://tweaked.cc/index.json").then(e=>e.json()).catch(e=>(console.error("Failed to fetch index",e),null)),t=e=>l.__awaiter(void 0,void 0,void 0,function*(){var o;if(e.match(/\.[A-Z]/))return null;let l=yield r();return l?null!==(o=l[e])&&void 0!==o?o:l[`_G.${e}`]:null}),s=/[A-za-z_][\w.]*$/,i=/^[\w.]*/;o.languages.registerHoverProvider("luax",{provideHover:(e,n)=>l.__awaiter(void 0,void 0,void 0,function*(){var l,r,a,c;let u=e.getLineContent(n.lineNumber),d=null!==(r=null===(l=u.substring(0,n.column).match(s))||void 0===l?void 0:l[0])&&void 0!==r?r:"",m=null!==(c=null===(a=u.substring(n.column).match(i))||void 0===a?void 0:a[0])&&void 0!==c?c:"",g=d+m;if(!g)return;let p=yield t(g);if(!p||"module"!=p["module-kind"])return null;let f=[{value:`\`${p.name}\``}];return p.summary&&f.push({value:p.summary}),f.push({value:`[View full documentation](https://tweaked.cc/${p.url})`}),{range:new o.Range(n.lineNumber,n.column-d.length,n.lineNumber,n.column+m.length),contents:f}})});let a=e=>({red:(e>>16&255)/255,green:(e>>8&255)/255,blue:(255&e)/255,alpha:1}),c={"colors.white":a(15790320),"colors.orange":a(15905331),"colors.magenta":a(15040472),"colors.lightBlue":a(10072818),"colors.yellow":a(14605932),"colors.lime":a(8375321),"colors.pink":a(15905484),"colors.gray":a(5000268),"colors.lightGray":a(10066329),"colors.cyan":a(5020082),"colors.purple":a(11691749),"colors.blue":a(3368652),"colors.brown":a(8349260),"colors.green":a(5744206),"colors.red":a(13388876),"colors.black":a(1118481),"colours.white":a(15790320),"colours.orange":a(15905331),"colours.magenta":a(15040472),"colours.lightBlue":a(10072818),"colours.yellow":a(14605932),"colours.lime":a(837