/
githubmirror
/
vgstation13
Обзор
Документация
Войти
/
githubmirror
/
vgstation13
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
Bleeding-Edge
code/modules/tooltip/eta.min.js
7 строк
9 KB
mentgah
Hopefully fixes tooltips once and for all (#38307)
07 сен 2025, 07:50
Не верифицирован
07 сен 2025, 07:50
1c7ba3a
Код
Авторство
О чём код?
/** * Minified by jsDelivr using Terser v5.19.2. * Original file: /npm/eta@3.5.0/dist/eta.umd.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("node:path"),require("node:fs")):"function"==typeof define&&define.amd?define(["exports","node:path","node:fs"],e):e((t=t||self).eta={},t.path,t.fs)}(this,(function(t,e,n){function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,e}var i=s(e),r=s(n);class a{constructor(t){this.cache=void 0,this.cache=t}define(t,e){this.cache[t]=e}get(t){return this.cache[t]}remove(t){delete this.cache[t]}reset(){this.cache={}}load(t){this.cache={...this.cache,...t}}}class c extends Error{constructor(t){super(t),this.name="Eta Error"}}class o extends c{constructor(t){super(t),this.name="EtaParser Error"}}class l extends c{constructor(t){super(t),this.name="EtaRuntime Error"}}class h extends c{constructor(t){super(t),this.name="EtaFileResolution Error"}}class u extends c{constructor(t){super(t),this.name="EtaNameResolution Error"}}function f(t,e,n){const s=e.slice(0,n).split(/\n/),i=s.length,r=s[i-1].length+1;throw t+=" at line "+i+" col "+r+":\n\n "+e.split(/\n/)[i-1]+"\n "+Array(r).join(" ")+"^",new o(t)}function p(t,e,n,s){const i=e.split("\n"),r=Math.max(n-3,0),a=Math.min(i.length,n+3),c=s,o=i.slice(r,a).map((function(t,e){const s=e+r+1;return(s==n?" >> ":" ")+s+"| "+t})).join("\n"),h=new l((c?c+":"+n+"\n":"line "+n+"\n")+o+"\n\n"+t.message);throw h.name=t.name,h}const d=async function(){}.constructor;function g(t,e){const n=this.config,s=e&&e.async?d:Function;try{return new s(n.varName,"options",this.compileToString.call(this,t,e))}catch(n){throw n instanceof SyntaxError?new o("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+this.compileToString.call(this,t,e)+"\n"):n}}function m(t,e){const n=this.config,s=e&&e.async,i=this.compileBody,r=this.parse.call(this,t);let a=`${n.functionHeader}\nlet include = (template, data) => this.render(template, data, options);\nlet includeAsync = (template, data) => this.renderAsync(template, data, options);\n\nlet __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${n.debug?', line: 1, templateStr: "'+t.replace(/\\|"/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n")+'"':""}};\n\nfunction layout(path, data) {\n __eta.layout = path;\n __eta.layoutData = data;\n}${n.debug?"try {":""}${n.useWith?"with("+n.varName+"||{}){":""}\n\n${i.call(this,r)}\nif (__eta.layout) {\n __eta.res = ${s?"await includeAsync":"include"} (__eta.layout, {...${n.varName}, body: __eta.res, ...__eta.layoutData});\n}\n${n.useWith?"}":""}${n.debug?"} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }":""}\nreturn __eta.res;\n`;if(n.plugins)for(let t=0;t<n.plugins.length;t++){const e=n.plugins[t];e.processFnString&&(a=e.processFnString(a,n))}return a}function x(t){const e=this.config;let n=0;const s=t.length;let i="";for(;n<s;n++){const s=t[n];if("string"==typeof s){i+="__eta.res+='"+s+"'\n"}else{const t=s.t;let n=s.val||"";e.debug&&(i+="__eta.line="+s.lineNo+"\n"),"r"===t?(e.autoFilter&&(n="__eta.f("+n+")"),i+="__eta.res+="+n+"\n"):"i"===t?(e.autoFilter&&(n="__eta.f("+n+")"),e.autoEscape&&(n="__eta.e("+n+")"),i+="__eta.res+="+n+"\n"):"e"===t&&(i+=n+"\n")}}return i}const y={"&":"&","<":"<",">":">",'"':""","'":"'"};function _(t){return y[t]}const E={autoEscape:!0,autoFilter:!1,autoTrim:[!1,"nl"],cache:!1,cacheFilepaths:!0,debug:!1,escapeFunction:function(t){const e=String(t);return/[&<>"']/.test(e)?e.replace(/[&<>"']/g,_):e},filterFunction:t=>String(t),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it",defaultExtension:".eta"},w=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,v=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,F=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function S(t){return t.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function $(t,e){return t.slice(0,e).split("\n").length}function A(t){const e=this.config;let n=[],s=!1,i=0;const r=e.parse;if(e.plugins)for(let n=0;n<e.plugins.length;n++){const s=e.plugins[n];s.processTemplate&&(t=s.processTemplate(t,e))}function a(t,i){t&&(t=function(t,e,n,s){let i,r;return Array.isArray(e.autoTrim)?(i=e.autoTrim[1],r=e.autoTrim[0]):i=r=e.autoTrim,(n||!1===n)&&(i=n),(s||!1===s)&&(r=s),r||i?"slurp"===i&&"slurp"===r?t.trim():("_"===i||"slurp"===i?t=t.trimStart():"-"!==i&&"nl"!==i||(t=t.replace(/^(?:\r\n|\n|\r)/,"")),"_"===r||"slurp"===r?t=t.trimEnd():"-"!==r&&"nl"!==r||(t=t.replace(/(?:\r\n|\n|\r)$/,"")),t):t}(t,e,s,i),t&&(t=t.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),n.push(t)))}e.rmWhitespace&&(t=t.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")),w.lastIndex=0,v.lastIndex=0,F.lastIndex=0;const c=[r.exec,r.interpolate,r.raw].reduce((function(t,e){return t&&e?t+"|"+S(e):e?S(e):t}),""),o=new RegExp(S(e.tags[0])+"(-|_)?\\s*("+c+")?\\s*","g"),l=new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?"+S(e.tags[1])+")","g");let h;for(;h=o.exec(t);){const c=t.slice(i,h.index);i=h[0].length+h.index;const u=h[1],p=h[2]||"";let d;a(c,u),l.lastIndex=i;let g=!1;for(;d=l.exec(t);){if(d[1]){const e=t.slice(i,d.index);o.lastIndex=i=l.lastIndex,s=d[2];g={t:p===r.exec?"e":p===r.raw?"r":p===r.interpolate?"i":"",val:e};break}{const e=d[0];if("/*"===e){const e=t.indexOf("*/",l.lastIndex);-1===e&&f("unclosed comment",t,d.index),l.lastIndex=e}else if("'"===e){v.lastIndex=d.index;v.exec(t)?l.lastIndex=v.lastIndex:f("unclosed string",t,d.index)}else if('"'===e){F.lastIndex=d.index;F.exec(t)?l.lastIndex=F.lastIndex:f("unclosed string",t,d.index)}else if("`"===e){w.lastIndex=d.index;w.exec(t)?l.lastIndex=w.lastIndex:f("unclosed string",t,d.index)}}}g?(e.debug&&(g.lineNo=$(t,h.index)),n.push(g)):f("unclosed tag",t,h.index)}if(a(t.slice(i,t.length),!1),e.plugins)for(let t=0;t<e.plugins.length;t++){const s=e.plugins[t];s.processAST&&(n=s.processAST(n,e))}return n}function I(t,e){const n=e&&e.async?this.templatesAsync:this.templatesSync;if(this.resolvePath&&this.readFile&&!t.startsWith("@")){const t=e.filepath,s=n.get(t);if(this.config.cache&&s)return s;{const s=this.readFile(t),i=this.compile(s,e);return this.config.cache&&n.define(t,i),i}}{const e=n.get(t);if(e)return e;throw new u("Failed to get template '"+t+"'")}}function b(t,e,n){let s;const i={...n,async:!1};"string"==typeof t?(this.resolvePath&&this.readFile&&!t.startsWith("@")&&(i.filepath=this.resolvePath(t,i)),s=I.call(this,t,i)):s=t;return s.call(this,e,i)}function T(t,e,n){let s;const i={...n,async:!0};"string"==typeof t?(this.resolvePath&&this.readFile&&!t.startsWith("@")&&(i.filepath=this.resolvePath(t,i)),s=I.call(this,t,i)):s=t;const r=s.call(this,e,i);return Promise.resolve(r)}function P(t,e){const n=this.compile(t,{async:!1});return b.call(this,n,e)}function j(t,e){const n=this.compile(t,{async:!0});return T.call(this,n,e)}class N{constructor(t){this.config=void 0,this.RuntimeErr=p,this.compile=g,this.compileToString=m,this.compileBody=x,this.parse=A,this.render=b,this.renderAsync=T,this.renderString=P,this.renderStringAsync=j,this.filepathCache={},this.templatesSync=new a({}),this.templatesAsync=new a({}),this.resolvePath=null,this.readFile=null,this.config=t?{...E,...t}:{...E}}configure(t){this.config={...this.config,...t}}withConfig(t){return{...this,config:{...this.config,...t}}}loadTemplate(t,e,n){if("string"==typeof e){(n&&n.async?this.templatesAsync:this.templatesSync).define(t,this.compile(e,n))}else{let s=this.templatesSync;("AsyncFunction"===e.constructor.name||n&&n.async)&&(s=this.templatesAsync),s.define(t,e)}}}function R(t){let e="";try{e=r.readFileSync(t,"utf8")}catch(e){throw"ENOENT"===(null==e?void 0:e.code)?new h(`Could not find template: ${t}`):e}return e}function W(t,e){let n="";const s=this.config.views;if(!s)throw new h("Views directory is not defined");const r=e&&e.filepath,a=void 0===this.config.defaultExtension?".eta":this.config.defaultExtension,c=JSON.stringify({filename:r,path:t,views:this.config.views});if(t+=i.extname(t)?"":a,r){if(this.config.cacheFilepaths&&this.filepathCache[c])return this.filepathCache[c];const e=O.exec(t);if(e&&e.length){const e=t.replace(/^\/*|^\\*/,"");n=i.join(s,e)}else n=i.join(i.dirname(r),t)}else n=i.join(s,t);if(function(t,e){const n=i.relative(t,e);return n&&!n.startsWith("..")&&!i.isAbsolute(n)}(s,n))return r&&this.config.cacheFilepaths&&(this.filepathCache[c]=n),n;throw new h(`Template '${t}' is not in the views directory`)}const O=/^\\|^\//;t.Eta=class extends N{constructor(...t){super(...t),this.readFile=R,this.resolvePath=W}},t.EtaError=c,t.EtaFileResolutionError=h,t.EtaNameResolutionError=u,t.EtaParseError=o,t.EtaRuntimeError=l}));