smart-energy-monitor/software/dashboard/grafana/csv/Node-RED_files/red.min.js

18 lines
874 KiB
JavaScript
Raw Permalink Normal View History

2023-02-27 17:21:01 +01:00
/**
* Copyright OpenJS Foundation and other contributors, https://openjsf.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
!function(){var o;!window.MSInputMethodContext||!document.documentMode||(window.DOMTokenList.prototype.toggle=function(e,t){1===arguments.length&&(t=!this.contains(e)),this[t?"add":"remove"](e)},"classList"in SVGElement.prototype||Object.defineProperty(SVGElement.prototype,"classList",Object.getOwnPropertyDescriptor(HTMLElement.prototype,"classList")),"children"in SVGElement.prototype||Object.defineProperty(SVGElement.prototype,"children",Object.getOwnPropertyDescriptor(HTMLElement.prototype,"children")),Array.from=function(){if(1<arguments.length)throw new Error("Node-RED's IE11 Array.from polyfill doesn't support multiple arguments");var e=arguments[0],t=[];if(e.forEach)e.forEach(function(e){t.push(e)});else for(var o=0;o<e.length;o++)t.push(arrayList[o]);return t},0===new Set([0]).size&&(o=Set,(Set=function(e){var t=new o;return e&&e.forEach(t.add,t),t}).prototype=o.prototype,Set.prototype.constructor=Set))}(),jQuery.propHooks.disabled={set:function(e,t){e.disabled!==t&&((e.disabled=t)?$(e).trigger("disabled"):$(e).trigger("enabled"))}};var RED=function(){function i(){f.reportProgress(RED._("event.loadPlugins"),10),$.ajax({headers:{Accept:"application/json"},cache:!1,url:"plugins",success:function(e){f.reportProgress(RED._("event.loadPlugins"),13),RED.i18n.loadPluginCatalogs(function(){var i,e;i=function(){f.reportProgress(RED._("event.loadPalette"),20),$.ajax({headers:{Accept:"application/json"},cache:!1,url:"nodes",success:function(e){RED.nodes.setNodeList(e),f.reportProgress(RED._("event.loadNodeCatalogs"),25),RED.i18n.loadNodeCatalogs(function(){r(t)})}})},f.reportProgress(RED._("event.loadPlugins",{count:""}),17),e=localStorage.getItem("editor-language")||RED.i18n.detectLanguage(),$.ajax({headers:{Accept:"text/html","Accept-Language":e},cache:!1,url:"plugins",success:function(e){var o=e.trim().split(/(?=<!-- --- \[red-plugin:\S+\] --- -->)/),n=(o.length,function(){var e,t;0===o.length?i():(e=o.shift(),t=n,a(e,/<!-- --- \[red-plugin:(\S+)\] --- -->/.exec(e.trim()),"#red-ui-editor-plugin-configs",t))});n()}})})}})}function a(e,t,i,a){var s;a=a||function(){},t?(s=t[1],RED._loadingModule=s):s="unknown";try{var r=!1,d=$("<div>"+e+"</div>"),o=d.find("script"),l=o.length;o.each(function(e,t){var o,n=$(t).attr("src");n&&!/^\s*(https?:|\/|\.)/.test(n)?($(t).remove(),(o=document.createElement("script")).onload=function(){0===--l&&($(i).append(d),delete RED._loadingModule,a())},"module"===$(t).attr("type")&&(o.type="module"),$(i).append(o),o.src=RED.settings.apiRootUrl+n,r=!0):((/\/ace.js$/.test(n)||/\/ext-language_tools.js$/.test(n))&&(console.warn("Blocked attempt to load",n,"by",s),$(t).remove()),l--)}),r||($(i).append(d),delete RED._loadingModule,a())}catch(e){RED.notify(RED._("notification.errors.failedToAppendNode",{module:s,error:e.toString()}),{type:"error",timeout:1e4}),console.log("["+s+"] "+e.toString()),delete RED._loadingModule,a()}}function s(e,t){a(e,/<!-- --- \[red-module:(\S+)\] --- -->/.exec(e.trim()),"#red-ui-editor-node-configs",t)}function r(t){$.ajax({headers:{Accept:"application/json"},cache:!1,url:"icons",success:function(e){RED.nodes.setIconSets(e),t&&t()}})}function t(){f.reportProgress(RED._("event.loadNodes",{count:""}),30);var e=localStorage.getItem("editor-language")||RED.i18n.detectLanguage();$.ajax({headers:{Accept:"text/html","Accept-Language":e},cache:!1,url:"nodes",success:function(e){var t=e.trim().split(/(?=<!-- --- \[red-module:\S+\] --- -->)/),o=t.length,n=function(){f.reportProgress(RED._("event.loadNodes",{count:o-t.length+"/"+o}),30+(o-t.length)/o*40),0===t.length?($("#red-ui-editor").i18n(),$("#red-ui-palette > .red-ui-palette-spinner").hide(),$(".red-ui-palette-scroll").removeClass("hide"),$("#red-ui-palette-search").removeClass("hide"),RED.settings.theme("projects.enabled",!1)?RED.projects.refresh(function(t){d(function(){RED.sidebar.info.refresh();var e=!1;t||(RED.menu.setDisabled("menu-item-projects-open",!0),RED.menu.setDisabled("menu-item-projects-settings",!0),!1!==t&&(e=!0)),l(e)})}):d(function(){RED.sidebar.info.refresh(),l()})):s(t.shift(),n)};n()}})}function d(a){f.repo
</dl>`}},{name:"description",level:"inline",start(e){if(!e)return null;e=e.match(/:/g);return e&&e.index},tokenizer(e,t){if(!e)return null;const o=/^:([^:\n]+)\(([^:\n]+)\).*?:([^:\n]*)(?:\n|$)/.exec(e);return o?{type:"description",raw:o[0],dt:this.lexer.inlineTokens(o[1].trim()),types:this.lexer.inlineTokens(o[2].trim()),dd:this.lexer.inlineTokens(o[3].trim())}:void 0},renderer(e){return`
<dt>${this.parser.parseInline(e.dt)}<span class="property-type">${this.parser.parseInline(e.types)}</span></dt><dd>${this.parser.parseInline(e.dd)}</dd>`},childTokens:["dt","dd"],walkTokens(e){"strong"===e.type&&(e.text+=" walked")}}]});var V={},r={};function J(e,t,o,n){if(t&&0<t.length){if(""===e&&void 0===o)return!0;for(var i=0;i<t.length;i++){var a=t[i];if(0===a.indexOf(e)&&("."===a[e.length]||"["===a[e.length])){if(void 0===o||"["!==a[e.length])return!0;var a=a.substring(e.length),a=/\[(\d+)\]/.exec(a);if(a)return o<=(a=parseInt(a[1]))&&a<=n}}}return!1}function q(e,t,o,n,i,a){var s=r[o]&&r[o][n]&&r[o][n].number||a||"dec";i?(s="dec"===s?13===t.toString().length&&t<=2147483647e3?"dateMS":10===t.toString().length&&t<=2147483647?"dateS":"hex":"dateMS"===s||"dateS"==s?13===t.toString().length&&t<=2147483647e3?"dateML":10===t.toString().length&&t<=2147483647?"dateL":"hex":"dateML"===s||"dateL"==s?"hex":"dec",r[o]=r[o]||{},r[o][n]=r[o][n]||{},r[o][n].number=s):void 0!==a&&(r[o]=r[o]||{},r[o][n]=r[o][n]||{},r[o][n].number=s),"dec"===s?e.text(""+t):"dateMS"===s?e.text(new Date(t).toISOString()):"dateS"===s?e.text(new Date(1e3*t).toISOString()):"dateML"===s?(i=new Date(t),e.text(i.toLocaleString()+" [UTC"+(i.getTimezoneOffset()/-60<=0?"":"+")+i.getTimezoneOffset()/-60+"]")):"dateL"===s?(a=new Date(1e3*t),e.text(a.toLocaleString()+" [UTC"+(a.getTimezoneOffset()/-60<=0?"":"+")+a.getTimezoneOffset()/-60+"]")):"hex"===s&&e.text("0x"+t.toString(16))}function W(e,t,o,n,i){var a=r[o]&&r[o][n]&&r[o][n].buffer||"raw";i&&(a="raw"===a?"string":"raw",r[o]=r[o]||{},r[o][n]=r[o][n]||{},r[o][n].buffer=a),"raw"===a?(t.text("raw"),e.removeClass("red-ui-debug-msg-buffer-string").addClass("red-ui-debug-msg-buffer-raw")):"string"===a&&(t.text("string"),e.addClass("red-ui-debug-msg-buffer-string").removeClass("red-ui-debug-msg-buffer-raw"))}function g(e,t){t=new Error(t);return t.code=e,t}function K(e,t){var o=e.length;if(0===o)throw g("INVALID_EXPR","Invalid property expression: zero-length");for(var n,i,a=[],s=0,r=!1,d=!1,l=0;l<o;l++){var c=e[l];if(r){if(c===n){if(l-s==0)throw g("INVALID_EXPR","Invalid property expression: zero-length string at position "+s);if(a.push(e.substring(s,l)),d&&!/\]/.test(e[l+1]))throw g("INVALID_EXPR","Invalid property expression: unexpected array expression at position "+s);if(!d&&l+1!==o&&!/[\[\.]/.test(e[l+1]))throw g("INVALID_EXPR","Invalid property expression: unexpected "+e[l+1]+" expression at position "+(l+1));s=l+1,r=!1}}else if("'"===c||'"'===c){if(l!=s)throw g("INVALID_EXPR","Invalid property expression: unexpected "+c+" at position "+l);r=!0,n=c,s=l+1}else if("."===c){if(0===l)throw g("INVALID_EXPR","Invalid property expression: unexpected . at position 0");if(s!=l&&(i=e.substring(s,l),/^\d+$/.test(i)?a.push(parseInt(i)):a.push(i)),l===o-1)throw g("INVALID_EXPR","Invalid property expression: unterminated expression");if(!/[a-z0-9\$\_]/i.test(e[l+1]))throw g("INVALID_EXPR","Invalid property expression: unexpected "+e[l+1]+" at position "+(l+1));s=l+1}else if("["===c){if(0===l)throw g("INVALID_EXPR","Invalid property expression: unexpected "+c+" at position "+l);if(s!=l&&a.push(e.substring(s,l)),l===o-1)throw g("INVALID_EXPR","Invalid property expression: unterminated expression");if(/^msg[.\[]/.test(e.substring(l+1))){for(var u,p=1,f=!1,h=l+1;h<o;h++)if(/["']/.test(e[h])&&(f?e[h]===u&&(f=!1):(f=!0,u=e[h])),"["===e[h]?p++:"]"===e[h]&&p--,0===p)try{t?a.push(H(t,e.substring(l+1,h))):a.push(K(e.substring(l+1,h),t)),d=!1,s=(l=h)+1;break}catch(e){throw g("INVALID_EXPR","Invalid expression started at position "+(l+1))}if(0<p)throw g("INVALID_EXPR","Invalid property expression: unmatched '[' at position "+l)}else{if(!/["'\d]/.test(e[l+1]))throw g("INVALID_EXPR","Invalid property expression: unexpected "+e[l+1]+" at position "+(l+1));s=l+1,d=!0}}else if("]"===c){if(!d)throw g("INVALID_EXPR","Invalid property expression: unexpected "+c+" at position "+l);if(s!=l){if(i=e.substring(s,l),!/^\d+$/.test(i))throw g("INVALID_EXPR","Invalid property expression: unexpected array expression at position "+s);a.push(parseInt