From 6530382a6675e6ae940871eb41f83c432993731b Mon Sep 17 00:00:00 2001 From: SergeyMi37 Date: Sat, 29 Oct 2022 11:07:32 +0300 Subject: [PATCH] add UDL classes version 4.9.5 and fix module.xml --- build/cls/WebTerminal/Analytics.cls | 24 ++ build/cls/WebTerminal/Autocomplete.cls | 84 +++++ build/cls/WebTerminal/Common.cls | 131 ++++++++ build/cls/WebTerminal/Core.cls | 389 ++++++++++++++++++++++ build/cls/WebTerminal/Engine.cls | 260 +++++++++++++++ build/cls/WebTerminal/ErrorDecomposer.cls | 56 ++++ build/cls/WebTerminal/Handlers.cls | 296 ++++++++++++++++ build/cls/WebTerminal/Installer.cls | 273 +++++++++++++++ build/cls/WebTerminal/Router.cls | 79 +++++ build/cls/WebTerminal/StaticContent.cls | 86 +++++ build/cls/WebTerminal/Trace.cls | 145 ++++++++ build/cls/WebTerminal/Updater.cls | 136 ++++++++ module.xml | 2 +- 13 files changed, 1960 insertions(+), 1 deletion(-) create mode 100644 build/cls/WebTerminal/Analytics.cls create mode 100644 build/cls/WebTerminal/Autocomplete.cls create mode 100644 build/cls/WebTerminal/Common.cls create mode 100644 build/cls/WebTerminal/Core.cls create mode 100644 build/cls/WebTerminal/Engine.cls create mode 100644 build/cls/WebTerminal/ErrorDecomposer.cls create mode 100644 build/cls/WebTerminal/Handlers.cls create mode 100644 build/cls/WebTerminal/Installer.cls create mode 100644 build/cls/WebTerminal/Router.cls create mode 100644 build/cls/WebTerminal/StaticContent.cls create mode 100644 build/cls/WebTerminal/Trace.cls create mode 100644 build/cls/WebTerminal/Updater.cls diff --git a/build/cls/WebTerminal/Analytics.cls b/build/cls/WebTerminal/Analytics.cls new file mode 100644 index 0000000..e2c9464 --- /dev/null +++ b/build/cls/WebTerminal/Analytics.cls @@ -0,0 +1,24 @@ +/// This class includes methods which collect WebTerminal's analytics such as error and installation reports. +Class WebTerminal.Analytics +{ + +/// This method sends a report about installation status, including error message if any errors happened. +ClassMethod ReportInstallStatus(status As %Status = 1, type As %String = "Install") As %Status +{ + set req = ##class(%Net.HttpRequest).%New() + set req.Server = "www.google-analytics.com" + do req.EntityBody.Write("v=1&tid=UA-83005064-2&cid="_##class(%SYS.System).InstanceGUID() + _"&ds=web&an=WebTerminal&av="_##class(WebTerminal.Installer).#VERSION + _"&t=event&aiid="_$ZCONVERT($zv, "O", "URL")_"&ec="_$ZCONVERT(type, "O", "URL")_"&ea=" + _$case($$$ISOK(status), 1: "Success", : "Failure")_"&el=" + _$ZCONVERT($System.Status.GetErrorText(status), "O", "URL")) + try { + return req.Post("/collect") + } catch e { + write "Unable to send analytics to " _ req.Server _ ", skipping analytics collection." + return $$$OK + } +} + +} + diff --git a/build/cls/WebTerminal/Autocomplete.cls b/build/cls/WebTerminal/Autocomplete.cls new file mode 100644 index 0000000..4668c00 --- /dev/null +++ b/build/cls/WebTerminal/Autocomplete.cls @@ -0,0 +1,84 @@ +Class WebTerminal.Autocomplete Extends Common +{ + +/// Returns a comma-delimited string of globals names in the namespace, which begin from "beginning". +ClassMethod GetGlobals(namespace As %String = "%SYS", beginning As %String = "") As %String +{ + set result = "" + set pattern = beginning _ "*" + new $Namespace + set $Namespace = namespace + set rset = ##class(%ResultSet).%New("%SYS.GlobalQuery:NameSpaceList") + do rset.Execute($Namespace, pattern, 1) + while (rset.Next()) { + set result = result _ $case(result = "", 1:"", :",") _ rset.GetData(1) + } + return result +} + +/// Returns a comma-delimited string of class names in the namespace, which begin from "beginning". +ClassMethod GetClass(namespace As %String = "%SYS", beginning As %String = "") As %String +{ + new $Namespace + set $Namespace = namespace + set pattern = $REPLACE(beginning, "%", "!%") _ "%" + &sql(select LIST(ID) into :ids from %Dictionary.CompiledClass where ID like :pattern ESCAPE '!' and deployed <> 2) + return ids +} + +/// Returns a comma-delimited string of public class members (accessible through ##class() construction) in the class of namespace. +ClassMethod GetPublicClassMembers(namespace As %String = "%SYS", className As %String = "", beginning As %String = "") As %String +{ + new $Namespace + set $Namespace = namespace + set pattern = $REPLACE(beginning, "%", "!%") _ "%" + &sql(select LIST(Name) into :names from %Dictionary.CompiledMethod WHERE parent=:className AND ClassMethod=1 AND Name like :pattern ESCAPE '!') + return names +} + +/// Returns a comma-delimited string of class members in the class of namespace. +ClassMethod GetClassMembers(namespace As %String = "%SYS", className As %String = "", beginning As %String = "", methodsOnly = "") As %String +{ + new $Namespace + set $Namespace = namespace + if $EXTRACT(beginning, 1) = "#" { + set ps = ..GetParameters(namespace, className, $EXTRACT(beginning, 2, $LENGTH(beginning))) + return:(ps = "") ps + return "#"_$REPLACE(ps, ",", ",#") + } + set pattern = $REPLACE(beginning, "%", "!%") _ "%" + set props = "" + &sql(select LIST(Name) into :methods from %Dictionary.CompiledMethod WHERE parent=:className AND Private = 0 AND Name like :pattern ESCAPE '!') + if (methodsOnly = "") { + &sql(select LIST(Name) into :props from %Dictionary.CompiledProperty WHERE parent=:className AND Name like :pattern ESCAPE '!') + } + return $case((methods '= "") && (props '= ""), 1: methods _ "," _ props, : methods _ props) +} + +/// Returns a comma-delimited string of class members in the class of namespace. +ClassMethod GetParameters(namespace As %String = "%SYS", className As %String = "", beginning As %String = "") As %String +{ + new $Namespace + set $Namespace = namespace + set pattern = $REPLACE(beginning, "%", "!%") _ "%" + &sql(select LIST(Name) into :names from %Dictionary.CompiledParameter WHERE parent=:className AND Name like :pattern ESCAPE '!') + return names +} + +/// Returns a comma-delimited string of routine names in the namespace, which begin from "beginning". +ClassMethod GetRoutines(namespace As %String = "%SYS", beginning As %String = "") As %String +{ + set result = "" + set pattern = beginning _ "*.*" + new $Namespace + set $Namespace = namespace + set rset = ##class(%ResultSet).%New("%Library.Routine:RoutineList") + do rset.Execute(pattern, , , $Namespace) + while (rset.Next()) { + set result = result _ $case(result = "", 1:"", :",") _ $PIECE(rset.GetData(1), ".", 1, *-1) + } + return result +} + +} + diff --git a/build/cls/WebTerminal/Common.cls b/build/cls/WebTerminal/Common.cls new file mode 100644 index 0000000..d90416d --- /dev/null +++ b/build/cls/WebTerminal/Common.cls @@ -0,0 +1,131 @@ +Include %sySystem + +Class WebTerminal.Common +{ + +/// Interprocess communication cannot handle big messages at once, so they need to be split. +Parameter ChunkSize = 45; + +/// Send the chunk of data to another process. The process need to receive the chunk with the +/// appropriate function ReceiveChunk. Consider event length less than 44 characters long. +ClassMethod SendChunk(pid As %Numeric, flag As %String, data As %String = "") As %Status +{ + set pos = 1 + set len = $LENGTH(data) + 1 // send the last empty message if the data size = ChunkSize + for { + try { + set st = $system.Event.Signal( + pid, + $LB(flag, $EXTRACT(data, pos, pos + ..#ChunkSize - 1)) + ) + } catch (e) { return $$$NOTOK } + if (st '= 1) { return $$$NOTOK } + set pos = pos + ..#ChunkSize + if (pos > len) { quit } + } + return $$$OK +} + +/// Receives the chunk of data from another process. Returns the $LISTBUILD string which contains +/// flag at the first position and string at the second. This method also terminates the process +/// if the parent process is gone. +ClassMethod ReceiveChunk(timeout As %Numeric = -1, masterProcess = 0) As %String +{ + set flag = "" + set str = "" + set status = -1 + for { + set message = $system.Event.WaitMsg("", $Case(timeout = -1, 1: 1, :timeout)) + set status = $LISTGET(message, 1) + set data = $LISTGET(message, 2) + if (status <= 0) { + if ($ZPARENT '= 0) && ('$data(^$Job($ZPARENT))) { + do $system.Process.Terminate($JOB, 0) + return $LISTBUILD("e", $LISTBUILD("", "Parent process "_$JOB_" is gone"), -1) + } + if masterProcess && ($ZCHILD '= 0) && ('$data(^$Job($ZCHILD))) { + return $LISTBUILD("e", $LISTBUILD("", "Child process "_$ZCHILD_" is gone"), -1) + } + } + if (data = "") && (timeout = 0) quit + if (status <= 0) { + set:(timeout = 0) timeout = 1 + continue + } + set flag = $LISTGET(data, 1) + set m = $LISTGET(data, 2) + set str = str _ m + if (timeout = 0) set timeout = 1 + quit:($LENGTH(m) '= ..#ChunkSize) + } + return $LISTBUILD(flag, str, status) +} + +/// Returns the contents of the proxy object to the current device in JSON format.
+/// This method is called when a proxy object is used in conjunction with +/// the %ZEN.Auxiliary.jsonProvider component.
+/// format is a flags string to control output formatting options.
+/// The following character option codes are supported:
+/// 1-9 : indent with this number of spaces (4 is the default with the 'i' format specifier)
+/// a - output null arrays/objects
+/// b - line break before opening { of objects
+/// c - output the Caché-specific "_class" and "_id" properties (if a child property is an instance of a concrete object class)
+/// e - output empty object properties
+/// i - indent with 4 spaces unless 't' or 1-9
+/// l - output empty lists
+/// n - newline (lf)
+/// o - output empty arrays/objects
+/// q - output numeric values unquoted even when they come from a non-numeric property
+/// s - use strict JSON output - NOTE: special care should be taken when sending data to a browser, as using this flag +/// may expose you to cross site scripting (XSS) vulnerabilities if the data is sent inside <script> tags. Zen uses +/// this technique extensively, so this flag should NOT be specified for jsonProviders in Zen pages.
+/// t - indent with tab character
+/// u - output pre-converted to UTF-8 instead of in native internal format
+/// w - Windows-style cr/lf newline
+ClassMethod GetJSONString(obj As %ZEN.proxyObject, format As %String = "aeos") As %String [ ProcedureBlock = 0 ] +{ + set tOldIORedirected = ##class(%Device).ReDirectIO() + set tOldMnemonic = ##class(%Device).GetMnemonicRoutine() + set tOldIO = $io + try { + set str = "" + use $io::("^" _ $ZNAME) + do ##class(%Device).ReDirectIO(1) + do ##class(%ZEN.Auxiliary.jsonProvider).%ObjectToJSON(obj,,,format) + } catch ex { + set str = "" + } + if (tOldMnemonic '= "") { + use tOldIO::("^" _ tOldMnemonic) + } else { + use tOldIO + } + do ##class(%Device).ReDirectIO(tOldIORedirected) + return str + +rchr(c) + quit +rstr(sz,to) + quit +wchr(s) + do output($char(s)) + quit +wff() + do output($char(12)) + quit +wnl() + do output($char(13,10)) + quit +wstr(s) + do output(s) + quit +wtab(s) + do output($char(9)) + quit +output(s) + set str = str _ s + quit +} + +} + diff --git a/build/cls/WebTerminal/Core.cls b/build/cls/WebTerminal/Core.cls new file mode 100644 index 0000000..c7a3573 --- /dev/null +++ b/build/cls/WebTerminal/Core.cls @@ -0,0 +1,389 @@ +/// Web Terminal version 4.9.5 core. +/// The core class which handles client requests and executes ObjectScript code. +/// All writes used here are used for $X and $Y compatibility, but they actually do not +/// write any code to the screen. +Class WebTerminal.Core Extends Common [ Not ProcedureBlock ] +{ + +/// Write and read redirects used when redirecting i/o. +/// Each of the redirects signals to $ZPARENT process the $LISTBUILD string. +/// There is several actions defined in the WebTerminal.Engine handler class for received list. +/// "o" is for output. Resulting with $lb("o", {string}) +/// "r" is for reading string. Resulting with $lb("r", {length}, {timeout}) +/// "rc" is for reading char. Resulting with $lb("rc", {timeout}) +/// "end" symbolizes that execution end is reached. Resulting with $lb("end", {error message}) +Method redirects() [ Private, ProcedureBlock = 0 ] +{ +wstr(str) + do ##class(%Device).ReDirectIO($$$NO) + write str + do ##class(%Device).ReDirectIO($$$YES) + quit ##class(WebTerminal.Common).SendChunk($ZPARENT, "o", str) + +wchr(c) + do ##class(%Device).ReDirectIO($$$NO) + write $CHAR(c) + do ##class(%Device).ReDirectIO($$$YES) + quit ##class(WebTerminal.Common).SendChunk($ZPARENT, "o", $CHAR(c)) + +wnl + do ##class(%Device).ReDirectIO($$$NO) + write ! + do ##class(%Device).ReDirectIO($$$YES) + quit ##class(WebTerminal.Common).SendChunk($ZPARENT, "o", $CHAR(13, 10)) + +wff + do ##class(%Device).ReDirectIO($$$NO) + set $X = 0 + set $Y = 0 + do ##class(%Device).ReDirectIO($$$YES) + quit ##class(WebTerminal.Common).SendChunk($ZPARENT, "o", $CHAR(12)) + +wtab(s) + do ##class(%Device).ReDirectIO($$$NO) + set $x = s + do ##class(%Device).ReDirectIO($$$YES) + quit ##class(WebTerminal.Common).SendChunk($ZPARENT, "o", $CHAR(27) _ "[" _ (s + 1) _ "G") + +rstr(length = 32656, timeout = 86400) + do ##class(WebTerminal.Common).SendChunk($ZPARENT, "r", $lb(length, timeout)) + quit $LISTGET(##class(WebTerminal.Common).ReceiveChunk(), 2) + +rchr(timeout = 86400) + do ##class(WebTerminal.Common).SendChunk($ZPARENT, "c", timeout) + quit $LISTGET(##class(WebTerminal.Common).ReceiveChunk(), 2) + +erdx s $x=0 q +erdy s $y=0 q +APC ; Application program command + w $c(27)_"_" + q +BEL ; Ring the bell + w $c(7) + q +CBT(%1) ; Cursor backward tabulation %1 tab stops + s %1=+$g(%1,1) w $c(27,91)_%1_"Z" s $zt="erdx",$x=$x+7\8-%1*8 + q +CCH ; Cancel character + w $c(27)_"T" + q +CHA(%1) ; Cursor horizontal absolute (move to column %1) + s %1=+$g(%1,1) w $c(27,91)_%1_"G" s $zt="erdx",$x=%1-1 + q +CHT(%1) ; Cursor horizontal tabulation (forward %1 tab stops) + s %1=+$g(%1,1) w $c(27,91)_%1_"I" s $zt="erdx",$x=$x\8+%1*8 + q +CNL(%1) ; Cursor next line (cursor down %1 lines) + s %1=+$g(%1,1) w $c(27,91)_%1_"E" s $zt="erdy",$y=$y+%1 + q +CPL(%1) ; Cursor preceding line (cursor up %1 lines) + s %1=+$g(%1,1) w $c(27,91)_%1_"F" s $zt="erdy",$y=$y-%1 + q +CPR ; Cursor position report (return in $KEY) + n %1 w $c(27,91)_"6n" r %1 + q +CTC(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Cursor tabulation control + n %i,%p s %p="" + f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_%i) + w $c(27,91)_%p_"W" + q +CUB(%1) ; Cursor backward %1 columns + s %1=+$g(%1,1) w $c(27,91)_%1_"D" s $zt="erdx",$x=$x-%1 + q +CUD(%1) ; Cursor down %1 lines + s %1=+$g(%1,1) w $c(27,91)_%1_"B" s $zt="erdy",$y=$y+%1 + q +CUF(%1) ; Cursor forward %1 columns + s %1=+$g(%1,1) w $c(27,91)_%1_"C" s $zt="erdx",$x=$x+%1 + q +CUP(%2,%1) ; Cursor position (column %1, line %2) + s %1=+$g(%1,1),%2=+$g(%2,1) w $c(27,91)_%2_";"_%1_"H" + s $zt="ecup",$x=%1-1,$zt="erdy",$y=%2-1 q +ecup s $x=0,$zt="erdy",$y=%2-1 + q +CUU(%1) ; Cursor up %1 lines + s %1=+$g(%1,1) w $c(27,91)_%1_"A" s $zt="erdy",$y=$y-%1 + q +CVT(%1) ; Cursor vertical tabulation + w $c(27,91)_+$g(%1,1)_"Y" + q +DA ; Device attributes - return in $KEY + n %1,%2,%3 s %3="" u $i:("":"+S") + w $c(27,91)_"c" r %1 s %2=$k f r *%1 s %3=%3_$c(%1) q:%1=99 + s $k=%2_%3 u $i:("":"-S") + q +DAQ(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Define area qualification + n %i,%p s %p="" + f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_i) + w $c(27,91)_%p_"o" + q +DCH(%1) ; Delete %1 characters + w $c(27,91)_+$g(%1,1)_"P" + q +DCS ; Device control string + w $c(27)_"P" + q +DL(%1) ; Delete %1 lines + w $c(27,91)_+$g(%1,1)_"M" + q +DMI ; Disable manual input + q +DSR(%1) ; Device status report - type %1 - return in $KEY + n %2 w $c(27,91)_+$g(%1,5)_"n" r %2 + q +EA(%1) ; Erase in area + w $c(27,91)_+$g(%1,1)_"O" + q +ECH(%1) ; Erase %1 characters + w $c(27,91)_+$g(%1,1)_"X" + q +ED(%1) ; Erase in display (%1=0 cursor-to-end,1 begin-to-cursor,2 entire scr) + w $c(27,91)_+$g(%1)_"J" + q +EF(%1) ; Erase in field + w $c(27,91)_+$g(%1,1)_"N" + q +EL(%1) ; Erase in line (%1=0 cursor-to-end, 1 begin-to-cursor, 2 entire line) + w $c(27,91)_+$g(%1)_"K" + q +EMI ; Enable manual input + q +EPA ; End of protected area + w $c(27)_"W" + q +ESA ; End of selected area + w $c(27)_"G" + q +FNT ; Font selection + q +GSM ; Graphic size modification + q +GSS ; Graphic size selection + q +HPA(%1) ; Horizontal position attribute (cursor to column %1) + s %1=+$g(%1,1) w $c(27,91)_%1_"`" s $zt="erdx",$x=%1-1 + q +HPR(%1) ; Horizontal position relative (cursor forward %1 columns) + s %1=+$g(%1,1) w $c(27,91)_%1_"a" s $zt="erdx",$x=$x+%1 + q +HTJ ; Horizontal tab with justify + w $c(27)_"I" + q +HTS ; Horizontal tabulation set + w $c(27)_"H" + q +HVP(%1,%2) ; Horizontal and vertical position (column %1, line %2) + s %1=+$g(%1,1),%2=+$g(%2,1) w $c(27,91)_%2_";"_%1_"f" + s $zt="ehvp",$x=%1-1,$zt="erdy",$y=%2-1 q +ehvp s $x=0,$zt="erdy",$y=%2-1 + q +ICH(%1) ; Insert %1 characters + w $c(27,91)_+$g(%1,1)_"@" + q +IL(%1) ; Insert %1 lines + w $c(27,91)_+$g(%1,1),"L" + q +IND ; Index + w $c(27)_"D" s $y=$y+1 + q +INT ; Interrupt + w $c(27,91)_"a" + q +JFY ; Justify + q +MC ; Media copy + w $c(27,91)_"i" + q +MW ; Message waiting + w $c(27)_"U" + q +NEL ; Next line + w $c(27)_"E" s $x=0,$y=$y+1 + q +NP(%1) ; Next page (advance %1 pages of terminal display memory) + w $c(27,91)_+$g(%1,1)_"U" + q +OSC ; Operating system command + w $c(27)_"]" + q +PLD ; Partial line down + w $c(27)_"K" + q +PLU ; Partial line up + w $c(27)_"L" + q +PM ; Privacy message + w $c(27)_"^" + q +PP(%1) ; Preceding page (backup %1 pages of terminal display memory) + w $c(27,91)_+$g(%1,1)_"V" + q +PU1 ; Private use one + w $c(27)_"Q" + q +PU2 ; Private use two + w $c(27)_"R" + q +QUAD ; QUAD + q +REP ; Repeat + w $c(27,91)_"b" + q +RI ; Reverse index + w $c(27)_"M" s $zt="erdy",$y=$y-1 + q +RIS ; Reset to initial state + w $c(27)_"c" s $x=0,$y=0 + q +RM(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Reset mode + n %i,%p s %p="" + f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_%i) + w $c(27,91)_%p_"l" + q +SEM ; Select editing extent mode + w $c(27,91)_"Q" + q +SGR(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Select graphic rendition %1 thru %9 + n %i,%p s %p="" + f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_%i) + w $c(27,91)_%p_"m" + q +SL ; Scroll left + q +SM(%1,%2,%3,%4,%5,%6,%7,%8,%9) ; Set mode + n %i,%p s %p="" + f %i=1:1:9 i $d(@("%"_%i)) s %p=%p_$e(";",%p'="")_@("%"_%i) + w $c(27,91)_%p_"h" + q +SPA ; Start of protected area + w $c(27)_"V" + q +SPI ; Spacing increment + q +SR ; Scroll right + q +SS2 ; Single shift two + w $c(27)_"N" + q +SS3 ; Single shift three + w $c(27)_"O" + q +SSA ; Start of selected area + w $c(27)_"F" + q +ST ; String terminator + w $c(27)_"\" + q +STS ; Set transmit state + w $c(27)_"S" + q +SU ; Scroll up + w $c(27,91)_"S" + q +TBC ; Tabulation clear + w $c(27,91)_"g" + q +TSS ; Thin space specification + q +VPA(%1) ; Vertical position attribute (move to row %1 at same column) + s %1=+$g(%1,1) w $c(27,91)_%1_"d" s $zt="erdy",$y=%1-1 + q +VPR(%1) ; Vertical position relative (move down %1 lines at same column) + s %1=+$g(%1,1) w $c(27,91)_%1_"e" s $zt="erdy",$y=$y+%1 + q +VTS ; Vertical tabulation sets + w $c(27)_"J" + q +} + +ClassMethod VarList() As %String [ ProcedureBlock = 1 ] +{ + if $data(%) + new % set %=$select($test:$LISTBUILD("%"),1:"") + set:$data(%0) %=%_$LISTBUILD("%0") + new %0 set %0="%0" + for { + set %0=$ORDER(@%0) + quit:%0="" + set %=%_$LISTBUILD(%0, $IsObject(@%0), @%0) + } + return % +} + +/// Retrieves a command text from the parent process. +/// Terminates itself if the parent process is dead. +ClassMethod WaitCommand() As %String [ ProcedureBlock = 1 ] +{ + for { + set data = ..ReceiveChunk() + set flag = $LISTGET(data, 1) + if (flag = "m") { // message + return $LISTGET(data, 2) + } elseif (flag = "a") { // autocomplete + do ##class(WebTerminal.Common).SendChunk($ZPARENT, "a", ..VarList()) + } else { // end or unexpected + do $system.Process.Terminate($JOB, 2) + return "" + } + } +} + +/// Starts new terminal loop. Must be called with JOB command. +ClassMethod Loop(startupRoutine As %String = "") As %Status +{ + if ($ZPARENT = 0) { + write "This method is for JOB use only." + return 0 + } + open "terminal"::"^%X364" + use $io::"^" _ $ZName + if (startupRoutine '= "") { + return ..StartupRoutine(startupRoutine) + } + kill // Kill any temporary variables ProcedureBlock may have. + // Procedure block will hold only user-defined variables, so any declarations here may + // potentially influence user experience. Do not add any set expressions in this procedure block + for { + do ..StartExecMode() + try { + xecute ..WaitCommand() + } catch { + do ..EndExecMode($ZERROR) + continue + } + do ..EndExecMode() + } + return $$$OK +} + +ClassMethod StartupRoutine(routineName = "") As %Status +{ + do ..StartExecMode() + try { + do @routineName + } catch { + do ..EndExecMode($ZERROR) + return $$$OK + } + do ..EndExecMode() + return $$$OK +} + +ClassMethod StartExecMode() +{ + write ! // Y pos shift + do ##class(%Device).ReDirectIO($$$YES) + do $System.Util.SetInterruptEnable($$$YES) +} + +ClassMethod EndExecMode(error = "") +{ + use $io::"^" _ $ZName + do $System.Util.SetInterruptEnable($$$NO) + do ##class(%Device).ReDirectIO($$$NO) + write ! // Y pos shift + do ..SendChunk($ZPARENT, "e", $LISTBUILD($NAMESPACE, error)) +} + +} + diff --git a/build/cls/WebTerminal/Engine.cls b/build/cls/WebTerminal/Engine.cls new file mode 100644 index 0000000..61312fe --- /dev/null +++ b/build/cls/WebTerminal/Engine.cls @@ -0,0 +1,260 @@ +/// Web Terminal version 4.9.5 WebSocket client. +/// This class represents a connected client via WebSocket. +Class WebTerminal.Engine Extends (%CSP.WebSocket, Common, Trace, Autocomplete) +{ + +/// Timeout in minutes when connection key expires. +Parameter WSKEYEXPIRES = 3600; + +/// How long to wait for authorization key when connection established +Parameter AuthorizationTimeout = 5; + +Property CurrentNamespace As %String; + +Property InitialZName As %String; + +Property InitialZNamespace As %String; + +/// The process ID of the terminal core. +Property corePID As %Numeric [ InitialExpression = 0 ]; + +/// The last known namespace in child process. +Property childNamespace As %String; + +Property StartupRoutine As %String; + +/// Output flag +Property echo As %Boolean [ InitialExpression = 1 ]; + +/// flag which enables output buffering +Property bufferOutput As %Boolean [ InitialExpression = 0 ]; + +/// Used to buffer the output ("o" flag) when bufferOutput flag is set +Property outputBuffer As %Stream.TmpCharacter [ InitialExpression = {##class(%Stream.TmpCharacter).%New()} ]; + +/// Output flag +Property handler As %Boolean [ InitialExpression = 0, Private ]; + +Method GetMessage(timeout As %Integer = 86400) As %ZEN.proxyObject +{ + #define err(%e, %s) if (%e '= $$$OK) { set obj = ##class(%ZEN.proxyObject).%New() set obj.error = %s return obj } + set data = ..Read(, .st, timeout) + return:((st = $$$CSPWebSocketTimeout) || (st = $$$CSPWebSocketClosed)) "" + $$$err(st, "%wsReadErr: "_$System.Status.GetErrorText(st)) + set st = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(data, , .obj, 1) + $$$err(st, "%wsParseErr: "_$System.Status.GetErrorText(st)) + return obj +} + +/// Do not remove this method in future versions of WebTerminal, it is used by update. +Method Send(handler As %String = "", data = "") As %Status +{ + if (handler = "o") && (..bufferOutput = 1) { + do ..outputBuffer.Write(data) + return $$$OK + } + return:((handler = "o") && (..echo = 0)) $$$OK + return:(handler = "o") ..Write("o"_data) // Enables 2013.2 support (no JSON) + set obj = ##class(%ZEN.proxyObject).%New() + set obj.h = handler + if (..handler '= 0) { + set obj."_cb" = ..handler + } + set obj.d = data + return ..Write(..GetJSONString(obj)) +} + +Method OnPreServer() As %Status +{ + set ..InitialZName = $zname + set ..InitialZNamespace = $znspace + quit $$$OK +} + +Method OnPostServer() As %Status +{ + if (..corePID '= 0) { + do ..SendChunk(..corePID, "e") + } + quit $$$OK +} + +ClassMethod WriteToFile(filename As %String, data As %String) As %Status +{ + set file=##class(%File).%New(filename) + do file.Open("WSN") + do file.WriteLine(data) + do file.Close() +} + +Method ExecuteSQL(query As %String = "") As %Status +{ + set tStatement = ##class(%SQL.Statement).%New() + set qStatus = tStatement.%Prepare(query) + if qStatus'=1 { + write $System.Status.DisplayError(qStatus) + } else { + set rset = tStatement.%Execute() + do rset.%Display() + } + quit $$$OK +} + +/// This method performs the authorization and login to WebTerminal. +/// It returns a list with data (see Router.Auth method), which is used then to set up the +/// initial values for the client. +Method RequireAuthorization() As %List +{ + set data = ..GetMessage(..#AuthorizationTimeout) + return:(data = "") $LB("%wsReadErr") + return:('$IsObject(data.d)) $LB($case(data.error = "", 1: "Unresolved WS message format", :data.error)) + return:(data.d.key = "") $LB("Missing key") + + set authKey = data.d.key + set key = $ORDER(^WebTerminal("AuthUser", "")) + set list = "" + while (key '= "") { + set lb = $GET(^WebTerminal("AuthUser", key)) + if ((lb '= "") && (key = authKey)) { + set list = lb + } + set time = $LISTGET(lb, 2) + if (time '= "") && ($System.SQL.DATEDIFF("s", time, $h) > ..#WSKEYEXPIRES) { + kill ^WebTerminal("AuthUser", key) + } + set key = $ORDER(^WebTerminal("AuthUser", key)) + } + + if (list = "") { // not found + return $LB("Invalid key") + } + + set username = $LISTGET(list, 1) + set namespace = $LISTGET(list, 3) + set ns = $Namespace + + znspace "%SYS" + do ##class(Security.Users).Get(username, .userProps) + znspace ns + + set namespace = $case(namespace, "":userProps("NameSpace"), :namespace) + + if ($get(userProps("Routine")) '= "") { + set ..StartupRoutine = userProps("Routine") + } + + if $get(userProps("Enabled")) '= 1 { + return $LB("User " _ username _ " is not enabled in the system") + } + + set $LIST(list, 3) = namespace + set loginStatus = $System.Security.Login(username) + + if (loginStatus '= 1) { + return $LB($System.Status.GetErrorText(loginStatus)) + } + + return $LB("", list) +} + +/// See WebTerminal.Handlers +Method ProcessRequest(handler As %String, data) As %Status [ Private ] +{ + try { + return $CLASSMETHOD("WebTerminal.Handlers", handler, $this, data) + } catch (e) { + set ..echo = 1 + return e.AsSystemError() + } +} + +/// Main method for every new client. +Method ClientLoop() As %Status [ Private ] +{ + job ##class(WebTerminal.Core).Loop(..StartupRoutine):($NAMESPACE):5 + if ($TEST '= 1) { // $TEST=0 for JOB only when timeouted + do ..Send("error", "%noJob") + return $$$NOTOK + } + set ..corePID = $ZCHILD + set ..childNamespace = $NAMESPACE + if (..StartupRoutine = "") { + do ..Send("prompt", ..childNamespace) + } else { + set message = ##class(%ZEN.proxyObject).%New() + set status = $CLASSMETHOD("WebTerminal.Handlers", "Execute", $this, "", 1) + goto loopEnd + } + //try { // temp + for { + set message = ..GetMessage() + quit:(message = "") // if client is gone, finish looping + if (message.error '= "") { + if (message.error '[ "ERROR #7951") { // don't try and send message if it was a WS close error + set st = ..Send("error", message.error) + } + quit + } + if (message."_cb" '= "") { set ..handler = message."_cb" } + set status = ..ProcessRequest(message.h, message.d) + set ..handler = 0 + set ..echo = 1 + if (status '= "") && (status '= $$$OK) { + set eType = $EXTRACT(status, 1, 1) + do ..Send("oLocalized", $C(13,10) _ $case(eType = 0, 1: $System.Status.GetErrorText(status), :status)) + continue + } + } +loopEnd + //} catch (e) { do ..Send("o", $System.Status.GetErrorText(e)) } // temp + return $$$OK +} + +/// This method sends basic login info to the user. Use this method to set client variables +/// during the WebTerminal initialization. +/// authList See Router.Auth method. +Method SendLoginInfo(authList As %List) +{ + set obj = ##class(%ZEN.proxyObject).%New() + set obj.username = $USERNAME + set obj.name = $get(^WebTerminal("Name")) + set obj.cleanStart = $ListGet(authList, 4) + set obj.system = $SYSTEM + set obj.firstLaunch = ($get(^WebTerminal("FirstLaunch"), 1) '= 0) + set obj.InstanceGUID = ##class(%SYS.System).InstanceGUID() + set obj.zv = $ZVersion + set ^WebTerminal("FirstLaunch") = 0 + do ..Send("init", obj) +} + +/// Triggered when new connection established. +Method Server() As %Status +{ + set authRes = ..RequireAuthorization() + set authMessage = $ListGet(authRes, 1) + if (authMessage = "") { + set authList = $ListGet(authRes, 2) // see Router.Auth method + set namespace = $ListGet(authList, 3) + if (namespace '= "") && (namespace '= $Namespace) { + try { + znspace namespace + } catch (e) { + do ..Send("oLocalized", + $Char(27) _ "[31m%unNS(" _ namespace _ ")"_ $Char(27) _ "[0m" _ $Char(13,10) + ) + } + } + set ..CurrentNamespace = $Namespace + do ..SendLoginInfo(authList) + do ..ClientLoop() + do ..Send("oLocalized", "%wsNormalClose"_$C(13,10)) + } else { + do ..Send("oLocalized", "%wsRefuse(" _ authMessage _ ")") + } + do ..EndServer() + set %session.EndSession = 1 + quit $$$OK +} + +} + diff --git a/build/cls/WebTerminal/ErrorDecomposer.cls b/build/cls/WebTerminal/ErrorDecomposer.cls new file mode 100644 index 0000000..e02f5b8 --- /dev/null +++ b/build/cls/WebTerminal/ErrorDecomposer.cls @@ -0,0 +1,56 @@ +Class WebTerminal.ErrorDecomposer +{ + +Parameter LINES As %Numeric = 5; + +/// Takes $ZERROR function result. +/// Returns either simple string or %ZEN.proxyObject representing the error details. +ClassMethod DecomposeError(err As %String = "", ns As %String = "") +{ + new $namespace + if (ns '= "") { + try { + set $namespace = ns + } catch (e) { + return err + } + } + return:($FIND(err, "<") '= 2) err + set startPos = $FIND(err, ">") + return:(startPos = 0) err + set spacePos = $FIND(err, " ") - 1 + return:(spacePos = startPos) err + set label = $EXTRACT(err, startPos, $case(spacePos = -1, 1:999, :spacePos-1)) + return:(label = "") err + try { + set obj = ##class(%ZEN.proxyObject).%New() + set obj.zerror = err + set plusPos = $FIND(label, "+") + set cPos = $FIND(label, "^") + if (plusPos = 0) || (cPos = 0) { + set obj.source = $TEXT(@label) + set obj.line = 0 + return obj + } + set line = +$EXTRACT(label, plusPos, cPos - 2) + set part1 = $EXTRACT(label, 1, plusPos - 1) + set part2 = $EXTRACT(label, cPos - 1, *) + set range = ..#LINES \ 2 + set obj.source = "" + set obj.line = 0 + for i=line-range:1:line+range { + continue:(i < 1) + set label = part1 _ i _ part2 + set text = $TEXT(@label) + set:(text '= "") obj.source = obj.source _ $case(obj.source = "", 1: "", :$C(10)) _ text + set:((text '= "") && (i < line)) obj.line = obj.line + 1 + } + return obj + } catch (e) { + return err + } + return err +} + +} + diff --git a/build/cls/WebTerminal/Handlers.cls b/build/cls/WebTerminal/Handlers.cls new file mode 100644 index 0000000..e1e3034 --- /dev/null +++ b/build/cls/WebTerminal/Handlers.cls @@ -0,0 +1,296 @@ +/// Web Terminal version 4.9.5 WebSocket handlers class. +/// This class describes handlers for WebSocket client. Each handler method takes WS client instance +/// as a first argument, and a given data as second. For example, handler for "execute" +/// command will be names as "HandleExecute". Note that all the processing is synchronous and it +/// blocks the WebSocket input while processing. +/// This class is inherited by WebTerminal.Engine class. +/// Methods must return positive status or an error if one happened. +/// Method must take two arguments, the first is the WebTerminal.Engine instance, and data as second +Class WebTerminal.Handlers +{ + +/// data can be either string or %ZEN.proxyObject. In case of proxyObject, the command is hold in +/// data.command property, and it may have some other control properties. +ClassMethod Execute(client As WebTerminal.Engine, data, bareStart As %Boolean = 0) As %Status +{ + if (bareStart) goto loop + if $IsObject(data) { + set command = data.command + if (data.echo = 0) { + set client.echo = 0 + } + if (data.bufferOutput = 1) { + set client.bufferOutput = 1 + } + } else { + set command = data + } + do client.Send("o", $CHAR(13, 10)) + do client.SendChunk(client.corePID, "m", command) +loop + for { + set message = client.ReceiveChunk(0, 1) // read from WebSocket as well: timeout = 0 + if ($LISTGET(message, 3) < 0) { + return $$$ERROR($$$GeneralError, "%cpTerm") + } + set flag = $LISTGET(message, 1) + if (flag = "") { // if there is no messages from the child process executing the task, + set mes = client.GetMessage(0) // look at the incoming WebSocket messages + if (mes '= "") && (mes.h = "Interrupt") { // and if the interrupt has been sent + do $System.Util.SendInterrupt(client.corePID) // interrupt the child process + } else { // else hang for a while to prevent "waiting" process from loading CPU + hang 0.05 + } + continue + } + set chunk = $LISTGET(message, 2) + if (flag = "o") { + do client.Send("o", chunk) + } elseif (flag = "r") { + set obj = ##class(%ZEN.proxyObject).%New() + set obj.length = $LISTGET(chunk, 1) + set obj.timeout = $LISTGET(chunk, 2) + do client.Send("readString", obj) + set mes = client.GetMessage() + if (mes.h = "Interrupt") { + do $System.Util.SendInterrupt(client.corePID) + } else { + do client.SendChunk(client.corePID, "m", mes.d) + } + } elseif (flag = "c") { + set obj = ##class(%ZEN.proxyObject).%New() + set obj.timeout = chunk + do client.Send("readChar", obj) + set mes = client.GetMessage() + if (mes.h = "Interrupt") { + do $System.Util.SendInterrupt(client.corePID) + } else { + do client.SendChunk(client.corePID, "m", mes.d) + } + } elseif (flag = "e") { + set err = "" + if $ListValid(chunk) { + if ($LISTGET(chunk, 1) '= "") { + set client.childNamespace = $LISTGET(chunk, 1) + } + if ($LISTGET(chunk, 2) '= "") { + set err = $LISTGET(chunk, 2) + } + } + if $IsObject(data) && (data.bufferOutput = 1) { + do client.outputBuffer.Write(err) + quit // break for loop + } + if (err '= "") { + do client.Send( + "execError", + ##class(ErrorDecomposer).DecomposeError(err, client.childNamespace) + ) + } + quit // break for loop + } else { // unknown response - just send it to the client + do client.Send("o", chunk) + } + } + do client.Send("o", $CHAR(13, 10)) + if $IsObject(data) { + if (data.echo = 0) { + set client.echo = 1 + } + if (data.bufferOutput = 1) { + set client.bufferOutput = 0 + set str = "" + while ('client.outputBuffer.AtEnd) { + set str = str _ client.outputBuffer.Read() + } + do client.Send("promptCallback", str) + do client.outputBuffer.Clear() + } + } + do:('($IsObject(data) && (data.prompt = 0)) && '(bareStart = 1)) client.Send("prompt", client.childNamespace) + return $$$OK +} + +ClassMethod Update(client As WebTerminal.Engine, URL As %String) +{ + set st = ##class(WebTerminal.Updater).Update(client, URL) + do:($$$ISERR(st)) ##class(WebTerminal.Analytics).ReportInstallStatus(st) + return st +} + +ClassMethod LocalAutocomplete(client As WebTerminal.Engine, data) +{ + do client.SendChunk(client.corePID, "a") + set list = $LISTGET(client.ReceiveChunk(, 1), 2) + set obj = ##class(%ZEN.proxyObject).%New() + for i=3:3:$LISTLENGTH(list) { + set obj2 = ##class(%ZEN.proxyObject).%New() + set obj2.isOref = $LISTGET(list, i - 1) + set obj2.value = $LISTGET(list, i) + set $PROPERTY(obj, $LISTGET(list, i - 2)) = obj2 + } + do client.Send("ac", obj) + return $$$OK +} + +ClassMethod GlobalAutocomplete(client As WebTerminal.Engine, part As %String) As %Status +{ + do client.Send(, ##class(WebTerminal.Autocomplete).GetGlobals(client.childNamespace, part)) + return $$$OK +} + +ClassMethod ClassAutocomplete(client As WebTerminal.Engine, part As %String) As %Status +{ + do client.Send(, ##class(WebTerminal.Autocomplete).GetClass(client.childNamespace, part)) + return $$$OK +} + +ClassMethod RoutineAutocomplete(client As WebTerminal.Engine, part As %String) As %Status +{ + do client.Send(, ##class(WebTerminal.Autocomplete).GetRoutines(client.childNamespace, part)) + return $$$OK +} + +ClassMethod ClassMemberAutocomplete(client As WebTerminal.Engine, data As %ZEN.proxyObject) As %Status +{ + do client.Send(, ##class(WebTerminal.Autocomplete).GetPublicClassMembers(client.childNamespace, data.className, data.part)) + return $$$OK +} + +ClassMethod MemberAutocomplete(client As WebTerminal.Engine, data As %ZEN.proxyObject) As %Status +{ + do client.SendChunk(client.corePID, "a") + set list = $LISTGET(client.ReceiveChunk(, 1), 2) + set isOref = 0 + set value = "" + for i=3:3:$LISTLENGTH(list) { + if $LISTGET(list, i - 2) = data.variable { + set isOref = $LISTGET(list, i - 1) + set value = $LISTGET(list, i) + quit + } + } + if isOref { + do client.Send(, ##class(WebTerminal.Autocomplete).GetClassMembers( + client.childNamespace, $PIECE(value, "@", 2), data.part, data.methodsOnly + )) + } else { + do client.Send(, 0) + } + return $$$OK +} + +ClassMethod ParameterAutocomplete(client As WebTerminal.Engine, data As %ZEN.proxyObject) As %Status +{ + do client.Send(, ##class(WebTerminal.Autocomplete).GetParameters(client.childNamespace, data.className, data.part)) + return $$$OK +} + +ClassMethod serverNameConfigSet(client As WebTerminal.Engine, value As %String = "") As %Status +{ + set ^WebTerminal("Name") = value + do client.Send(, 1) + return $$$OK +} + +ClassMethod SQL(client As WebTerminal.Engine, data As %ZEN.proxyObject = "") As %Status +{ + new $Namespace + set $Namespace = client.childNamespace + set sql = data.sql + set max = $case(data.max = "", 1: 777, :data.max) + set obj = ##class(%ZEN.proxyObject).%New() + + SET tStatement = ##class(%SQL.Statement).%New() + SET st = tStatement.%Prepare(sql) + if (st '= $$$OK) { + set obj.error = "%badSQL("_$System.Status.GetErrorText(st)_")" + return client.Send(, obj) + } + SET rset = tStatement.%Execute() + if (rset.%SQLCODE '= 0) { + set obj.error = "%sqlErr(SQLCODE="_rset.%SQLCODE_"; "_rset.%Message_")" + return client.Send(, obj) + } + + set headers = ##class(%ListOfDataTypes).%New() + for i=1:1:tStatement.%Metadata.columns.Count() { + do headers.Insert(tStatement.%Metadata.columns.GetAt(i).colName) + } + + set dt = ##class(%ListOfDataTypes).%New() + while rset.%Next() { + if (rset.%ROWCOUNT > max) quit + set line = ##class(%ListOfDataTypes).%New() + for i=1:1:headers.Count() { + do line.Insert(rset.%GetData(i)) + } + do dt.Insert(line) + } + + set:(dt.Count() > 0) obj.data = dt + set:(headers.Count() > 0) obj.headers = headers + + do client.Send(, obj) + return $$$OK +} + +ClassMethod Trace(client As WebTerminal.Engine, data As %ZEN.proxyObject = "") As %Status +{ + set obj = ##class(%ZEN.proxyObject).%New() + set obj.OK = 1 + set obj.started = client.Trace(data) + if (obj.started '= 1) { + set obj.stopped = client.StopTracing(data) + if (obj.stopped '= 1) { + set obj.OK = 0 + } + } + do client.Send(, obj) + return $$$OK +} + +ClassMethod StopTracing(client As WebTerminal.Engine, data As %ZEN.proxyObject = "") As %Status +{ + set obj = ##class(%ZEN.proxyObject).%New() + set obj.OK = $LISTLENGTH(client.Watches) > 0 + while ($LISTLENGTH(client.Watches) > 0) { + set stopped = client.StopTracing($LIST(client.Watches, 1)) + } + do client.Send(, obj) + return $$$OK +} + +ClassMethod TracingStatus(client As WebTerminal.Engine, data As %ZEN.proxyObject = "") As %Status +{ + set obj = ##class(%ZEN.proxyObject).%New() + set oldWatch = client.Watches + set obj.changes = client.CheckTracing() + set obj.stop = ##class(%ZEN.proxyObject).%New() + if ($LENGTH(oldWatch) > $LENGTH(client.Watches)) { + for i=1:1:$LISTLENGTH(oldWatch) { + if ($LISTFIND(client.Watches, $LISTGET(oldWatch, i)) = 0) { + set $PROPERTY(obj.stop, $LISTGET(oldWatch, i)) = 1 + } + } + } + do client.Send(, obj) + return $$$OK +} + +ClassMethod Auth(client As WebTerminal.Engine, data As %ZEN.proxyObject = "") As %Status +{ + // This method is implemented in Engine class. In case of auth is off, this method handles + // the auth request and never respond (like when you send something to /dev/null). + return $$$OK +} + +ClassMethod Interrupt(client As WebTerminal.Engine, data As %ZEN.proxyObject = "") As %Status +{ + // The interrupt behavior is implemented in Execute class method. When the user presses Ctrl+C + // in normal mode, we will do *nothing*. + return $$$OK +} + +} + diff --git a/build/cls/WebTerminal/Installer.cls b/build/cls/WebTerminal/Installer.cls new file mode 100644 index 0000000..d46faf9 --- /dev/null +++ b/build/cls/WebTerminal/Installer.cls @@ -0,0 +1,273 @@ +/// Importing this class will install Cache WEB Terminal properly. +Class WebTerminal.Installer Extends %Projection.AbstractProjection [ DependsOn = Router ] +{ + +Parameter DispatchClass = "WebTerminal.Router"; + +Parameter ResourceName = "%WebTerminal"; + +Parameter RoleName = "WebTerminal"; + +Projection Reference As Installer; + +Parameter VERSION = "4.9.5"; + +/// Cache or IRIS +Parameter iscProductBase = {$piece($zversion," ")}; + +ClassMethod RegisterWebApplication(name As %String, spec) As %Status +{ + new $Namespace + set $Namespace = "%SYS" + set st = $$$OK + if ('##class(Security.Applications).Exists(name)) { + write !,"Creating WEB application """_name_"""..." + set st = ##class(Security.Applications).Create(name, .spec) + write !, "WEB application """_name_""" is created." + } else { // ensure configuration matches in case of updating from old terminal versions + write !, "Updating web application """_name_"""..." + set st = ##class(Security.Applications).Modify(name, .spec) + write !, "WEB application """_name_""" is updated." + } + return st +} + +ClassMethod RemoveWebApplication(name As %String) +{ + new $Namespace + set $Namespace = "%SYS" + set st = $$$OK + if (##class(Security.Applications).Exists(name)) { + do ##class(Security.Applications).Get(name, .props) + if (props("DispatchClass") '= ..#DispatchClass) && (name = "/terminal") { + write !, "Won't delete WEB-application """_name_""" because it does not refer to dispatch class anymore." + } else { + write !, "Deleting WEB application """_name_"""..." + set st = ##class(Security.Applications).Delete(name) + write !, "WEB application """_name_""" was successfully deleted." + } + } + return st +} + +ClassMethod ReportInstallStatus(st, ns = {^WebTerminal("HomeNamespace")}) As %Status +{ + set $Namespace = ns + if (st '= 1) { + do $System.Status.DisplayError(st) + } + set status = ##class(WebTerminal.Analytics).ReportInstallStatus(st) + set $Namespace = "%SYS" + return status +} + +/// This method is invoked when a class is compiled. +ClassMethod CreateProjection(cls As %String, ByRef params) As %Status +{ + new $Namespace + set ns = $Namespace // ought to be package home namespace! + set ^WebTerminal("HomeNamespace") = ns + set ^WebTerminal("FirstLaunch") = 1 + write !, "Installing WebTerminal application to " _ ns + set dbdir = $$$defdir + try { + set $Namespace = "%SYS" + } catch (e) { + set mes = " The user " _ $Username _ " has no privileges" + _ " to enter the %SYS namespace. Please, log in as a privileged user" + _ " to set up the WebTerminal application." + set err = $$$ERROR($$$GeneralError, mes) + do ..ReportInstallStatus(err, ns) + return err + } + + set cspProperties("AutheEnabled") = $$$AutheCache + set cspProperties("NameSpace") = ns + set cspProperties("Description") = "A WEB application for Cache WEB Terminal." + set cspProperties("IsNameSpaceDefault") = $$$NO + set cspProperties("DispatchClass") = ..#DispatchClass + set st = ..RegisterWebApplication("/terminal", .cspProperties) + do:($$$ISERR(st)) ..ReportInstallStatus(st, ns) + return:$$$ISERR(st) st + + set cspProperties("AutheEnabled") = $$$AutheUnauthenticated + set cspProperties("Description") = "An application representing the open socket for /terminal application." + set cspProperties("DispatchClass") = "" + + set requiredRole = $case(..#iscProductBase = "IRIS", 1: "%DB_IRISSYS", : "%DB_CACHESYS") + set roles = ..GetDBRole(dbdir) + set extractedRoles = $case($get(roles) '= "", 1: ":" _ roles, : "") + set cspProperties("MatchRoles") = ":" _ $case( + $find(extractedRoles, requiredRole) = 0, + 1: requiredRole _ extractedRoles, + : requiredRole + ) + write !, "Assigning role " _ requiredRole _ " to a web application; resulting roles: " _ cspProperties("MatchRoles") + + set st = ..RegisterWebApplication("/terminalsocket", .cspProperties) + do:($$$ISERR(st)) ..ReportInstallStatus(st, ns) + return:$$$ISERR(st) st + + do ..CreateAllNamespace() + + write !, "Mapping %WebTerminal package into all namespaces:" + set st = ..Map(ns) + if ($$$ISERR(st)) { + do ..ReportInstallStatus(st, ns) + } else { + write !, "WebTerminal package successfully mapped into all namespaces." + do ..ReportInstallStatus(1, ns) + } + + if (##class(Security.Resources).Exists(..#ResourceName) = 0) { + set st = ##class(Security.Resources).Create(..#ResourceName, + "Grants access to WebTerminal if set up.", "") + } + + if (##class(Security.Roles).Exists(..#RoleName) = 0) { + set st = ##class(Security.Roles).Create(..#RoleName, + "WebTerminal user role which may grant access to WebTerminal application if set up.", + "%WebTerminal:RWU") + } + + return st +} + +/// This method is invoked when a class is 'uncompiled'. +ClassMethod RemoveProjection(cls As %String, ByRef params, recompile As %Boolean) As %Status +{ + new $Namespace + + write:(recompile) !, "Recompiling WebTerminal, skipping the deletion..." + return:(recompile) $$$OK + + set ns = $get(^WebTerminal("HomeNamespace"), $Namespace) + write !, "Uninstalling WebTerminal application from ", ns + zn "%SYS" + set st = ..RemoveWebApplication("/terminal") + do:($$$ISERR(st)) ..ReportInstallStatus(st, ns) + return:($$$ISERR(st)) st + set st = ..RemoveWebApplication("/terminalsocket") + do:($$$ISERR(st)) ..ReportInstallStatus(st, ns) + return:($$$ISERR(st)) st + if (##class(Security.Resources).Exists(..#ResourceName) = 1) { + set st = ##class(Security.Resources).Delete(..#ResourceName) + do:($$$ISERR(st)) ..ReportInstallStatus(st, ns) + return:($$$ISERR(st)) st + } + if (##class(Security.Roles).Exists(..#RoleName) = 1) { + set st = ##class(Security.Roles).Delete(..#RoleName) + do:($$$ISERR(st)) ..ReportInstallStatus(st, ns) + return:($$$ISERR(st)) st + } + + kill:st ^WebTerminal + write !, "Global ^WebTerminal removed." + + write !, "Unmapping %WebTerminal package from all namespaces:" + set st = ..UnMap(ns) + if ($$$ISERR(st)) { + do ..ReportInstallStatus(st, ns) + } else { + write !, "Unmapping complete." + } + + return st +} + +ClassMethod GetDBRole(directory As %String) As %String +{ + return:'$d(directory) "" + new $Namespace + set $Namespace = "%SYS" + #dim db As SYS.Database + set db = ##class(SYS.Database).%OpenId(directory) + if $Isobject(db) { + set resource = db.ResourceName + set role = resource // I'm assuming that default role exists (@eduard93) + } else { + set role = "" + } + return role +} + +ClassMethod CreateAllNamespace() As %Status +{ + + new $Namespace + set $Namespace = "%SYS" + set ns = "%All" + set st = $$$OK + + if ('##Class(Config.Namespaces).Exists(ns)) { + + set dbPrefix = $case(..#iscProductBase = "IRIS", 1: "IRIS", : "CACHE") + set Properties("Globals") = dbPrefix _ "TEMP" + set Properties("Library") = dbPrefix _ "LIB" + set Properties("Routines") = dbPrefix _ "TEMP" + set Properties("SysGlobals") = dbPrefix _ "SYS" + set Properties("SysRoutines") = dbPrefix _ "SYS" + set Properties("TempGlobals") = dbPrefix _ "TEMP" + + set st = ##Class(Config.Namespaces).Create(ns, .Properties) + if ($$$ISERR(st)) { + do $System.Status.DisplayError(st) + } else { + write !, "%All namespace is created." + } + + } + + return st +} + +ClassMethod Map(fromNS = "") As %Status +{ + new $Namespace + set $Namespace = "%SYS" + set st = $$$OK + + set mapTo = $LISTBUILD("%All", "SAMPLES", "DOCBOOK") + do ##Class(Config.Namespaces).Get(fromNS, .InstallNSProps) + set Properties("Database") = $get(InstallNSProps("Routines")) + set ptr = 0 + while $LISTNEXT(mapTo, ptr, namespace) { + continue:(fromNS = namespace) + continue:('##Class(Config.Namespaces).Exists(namespace)) + write " ", namespace + if ('##Class(Config.MapPackages).Exists(namespace, "WebTerminal")) { + set st1 = ##Class(Config.MapPackages).Create(namespace, "WebTerminal", .Properties) + } + if ('##Class(Config.MapGlobals).Exists(namespace, "WebTerminal")) { + set st2 = ##Class(Config.MapGlobals).Create(namespace, "WebTerminal", .Properties) + } + set st = $$$ADDSC(st,$$$ADDSC($get(st1,$$$OK),$get(st2,$$$OK))) + } + return st +} + +ClassMethod UnMap(fromNS As %String) As %Status +{ + new $Namespace + set $Namespace = "%SYS" + set st = $$$OK + + set mapTo = $LISTBUILD("%All", "SAMPLES", "DOCBOOK") + set ptr = 0 + while $LISTNEXT(mapTo, ptr, namespace) { + continue:(fromNS = namespace) + continue:('##Class(Config.Namespaces).Exists(namespace)) + write " ", namespace + if (##Class(Config.MapPackages).Exists(namespace, "WebTerminal")) { + set st1 = ##Class(Config.MapPackages).Delete(namespace, "WebTerminal", .Properties) + } + if (##Class(Config.MapGlobals).Exists(namespace, "WebTerminal")) { + set st2 = ##Class(Config.MapGlobals).Delete(namespace, "WebTerminal", .Properties) + } + set st = $$$ADDSC(st,$$$ADDSC($get(st1,$$$OK),$get(st2,$$$OK))) + } + return st +} + +} + diff --git a/build/cls/WebTerminal/Router.cls b/build/cls/WebTerminal/Router.cls new file mode 100644 index 0000000..23f5c25 --- /dev/null +++ b/build/cls/WebTerminal/Router.cls @@ -0,0 +1,79 @@ +/// The REST interface: class that routes HTTP requests +Class WebTerminal.Router Extends %CSP.REST [ CompileAfter = StaticContent ] +{ + +XData UrlMap +{ + + + + + + + + +} + +/// Calls StaticContent.Write method or sends not modified header. Type have to be "css" or "js" +ClassMethod WriteStatic(type As %String, ContentType As %String = "") [ Private ] +{ + #define CompileTime ##Expression("""" _ $zd($h, 11) _ ", "_ $zdt($NOW(0), 2,1) _ " GMT""") + set %response.CharSet = "utf-8" + set %response.ContentType = $case(type, + "css": "text/css", + "js": "text/javascript", + "html": "text/html", + : $case(ContentType="", 1:"text/plain", :ContentType) + ) + do %response.SetHeader("Last-Modified", $$$CompileTime) + + if (%request.GetCgiEnv("HTTP_IF_MODIFIED_SINCE")=$$$CompileTime) { + set %response.Status = "304 Not Modified" + } else { + do ##class(StaticContent).Write(type) + } +} + +ClassMethod Auth() As %Status +{ + set cookie = $System.Encryption.Base64Encode(%session.Key) + set ^WebTerminal("AuthUser", cookie) = $LB( // authList + $Username, // username + $Horolog, // granting ticket date + $Get(%request.Data("ns", 1), $Get(%request.Data("NS", 1))), + $Get(%request.Data("clean", 1), 0) '= 0 + ) + write "{""key"":""" _ cookie _ """}" + return $$$OK +} + +/// Method writes application CSS. +ClassMethod GetCss() As %Status +{ + do ..WriteStatic("css") + return $$$OK +} + +/// Method writes application theme. +ClassMethod GetTheme(Theme As %String) As %Status +{ + do ..WriteStatic("Theme"_$REPLACE(Theme, ".css", ""),"text/css") + return $$$OK +} + +/// Method writes application JavaScript. +ClassMethod GetJs() As %Status +{ + do ..WriteStatic("js") + return $$$OK +} + +/// Method writes application HTML. +ClassMethod Index() As %Status +{ + do ..WriteStatic("html") + return $$$OK +} + +} + diff --git a/build/cls/WebTerminal/StaticContent.cls b/build/cls/WebTerminal/StaticContent.cls new file mode 100644 index 0000000..5671a5e --- /dev/null +++ b/build/cls/WebTerminal/StaticContent.cls @@ -0,0 +1,86 @@ +/// This class holds whole application static content like scripts and styles. +/// Do not edit this file - use external tool to generate it. +Class WebTerminal.StaticContent +{ + +/// Write the contents of xData tag +ClassMethod Write(Const As %String) As %Status +{ + set obj = ##class(%Dictionary.CompiledXData).%OpenId("WebTerminal.StaticContent||"_Const) + return:(obj = "") $$$OK + set xdata = obj.Data + set status = ##class(%XML.TextReader).ParseStream(xdata, .textreader) + while textreader.Read() { if (textreader.NodeType="chars") { + write textreader.Value + } } + return $$$OK +} + +XData Themecache +{ + + + +} + +XData html +{ + + + + + + Caché WEB Terminal + + + + + + + + + + + + + + + + ]]> + +} + +XData css +{ + +.indicator{position:fixed;right:13px;top:7px;border:3px solid #fff;border-radius:30px;height:30px;margin:-15px 0 0 -15px;opacity:0;width:30px;animation:b infinite 1s}.terminal table{border-collapse:collapse;border:1px solid #666}.terminal table td,.terminal table th{padding:2px;border:1px solid #666}.terminal table td:nth-child(2n-1),.terminal table th:nth-child(2n-1){background:#222}.terminal table th{font-weight:700}a{color:#00ce00}.terminal .output .line .g.m1{font-weight:900}.terminal .output .line .g.m2{opacity:.7}.terminal .output .line .g.m3{font-style:italic}.terminal .output .line .g.m4{text-decoration:underline}.terminal .output .line .g.m5{animation:a infinite 1s}.terminal .output .line .g.m7{-khtml-filter:invert(100%);-moz-filter:invert(100%);-o-filter:invert(100%);-ms-filter:invert(100%);filter:invert(100%)}.terminal .output .line .g.m8{opacity:0}.terminal .output .line .g.hint{opacity:.5}.terminal .output .line .g.m30{color:#000}.terminal .output .line .g.m31{color:red}.terminal .output .line .g.m32{color:green}.terminal .output .line .g.m33{color:#ff0}.terminal .output .line .g.m34{color:#00f}.terminal .output .line .g.m35{color:#f0f}.terminal .output .line .g.m36{color:cyan}.terminal .output .line .g.m37{color:#fff}.terminal .output .line .g.m40{background-color:#000}.terminal .output .line .g.m41{background-color:red}.terminal .output .line .g.m42{background-color:green}.terminal .output .line .g.m43{background-color:#ff0}.terminal .output .line .g.m44{background-color:#00f}.terminal .output .line .g.m45{background-color:#f0f}.terminal .output .line .g.m46{background-color:cyan}.terminal .output .line .g.m47{background-color:#fff}.terminal .output .line .g.keyword{color:#4898ff}.terminal .output .line .g.string{color:#00c700}.terminal .output .line .g.constant{color:cyan}.terminal .output .line .g.special{color:#ff0}.terminal .output .line .g.variable{color:#ffa07a}.terminal .output .line .g.selected{color:#fff;background-color:#4169e1}.terminal .output .line .g.argument{color:#da7cff}.terminal .output .line .g.error{display:inline-block;position:relative}.terminal .output .line .g.error:after{content:"";position:absolute;display:block;bottom:0;left:0;width:100%;height:0;border-top:1px dashed red}.terminal .output .line .g.wrong{color:red}.terminal .output .line .g.global{color:#ef6913}.terminal .output .line .g.classname{color:cyan}@keyframes a{0%{-khtml-filter:invert(0);-moz-filter:invert(0);-o-filter:invert(0);-ms-filter:invert(0);filter:invert(0)}50%{-khtml-filter:invert(100%);-moz-filter:invert(100%);-o-filter:invert(100%);-ms-filter:invert(100%);filter:invert(100%)}to{-khtml-filter:invert(0);-moz-filter:invert(0);-o-filter:invert(0);-ms-filter:invert(0);filter:invert(0)}}@keyframes b{0%{transform:scale(.1);-o-transform:scale(.1);-ms-transform:scale(.1);-moz-transform:scale(.1);-webkit-transform:scale(.1);opacity:0}50%{opacity:1}to{transform:scale(.5);-o-transform:scale(.5);-ms-transform:scale(.5);-moz-transform:scale(.5);-webkit-transform:scale(.5);opacity:0}}.terminal .hintBox{position:absolute;left:0;top:0;width:300px;max-width:75%;height:0;overflow:visible;z-index:100}.terminal .hintBox>div{position:absolute;transition:all .3s ease;color:gray;border-radius:10px}]]> + +} + +XData js +{ + +i;)a.call(e,r=o[i++])&&t.push(r);return t}},{"./_object-gops":79,"./_object-keys":82,"./_object-pie":83}],34:[function(e,t,n){function d(e,t,n){var r,o,a,i=e&d.F,s=e&d.G,l=e&d.P,u=e&d.B,c=s?v:e&d.S?v[t]||(v[t]={}):(v[t]||{})[g],f=s?y:y[t]||(y[t]={}),p=f[g]||(f[g]={});for(r in n=s?t:n)o=((a=!i&&c&&void 0!==c[r])?c:n)[r],a=u&&a?m(o,v):l&&"function"==typeof o?m(Function.call,o):o,c&&h(c,r,o,e&d.U),f[r]!=o&&_(f,r,a),l&&p[r]!=o&&(p[r]=o)}var v=e("./_global"),y=e("./_core"),_=e("./_hide"),h=e("./_redefine"),m=e("./_ctx"),g="prototype";v.core=y,d.F=1,d.G=2,d.S=4,d.P=8,d.B=16,d.W=32,d.U=64,d.R=128,t.exports=d},{"./_core":24,"./_ctx":26,"./_global":42,"./_hide":44,"./_redefine":93}],35:[function(e,t,n){var r=e("./_wks")("match");t.exports=function(t){var n=/./;try{"/./"[t](n)}catch(e){try{return n[r]=!1,!"/./"[t](n)}catch(e){}}return!0}},{"./_wks":130}],36:[function(e,t,n){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],37:[function(e,t,n){"use strict";e("./es6.regexp.exec");var r,l=e("./_redefine"),u=e("./_hide"),c=e("./_fails"),f=e("./_defined"),p=e("./_wks"),d=e("./_regexp-exec"),v=p("species"),y=!c(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}),_=(r=(e=/(?:)/).exec,e.exec=function(){return r.apply(this,arguments)},2===(e="ab".split(e)).length&&"a"===e[0]&&"b"===e[1]);t.exports=function(n,e,t){var a,r,o=p(n),i=!c(function(){var e={};return e[o]=function(){return 7},7!=""[n](e)}),s=i?!c(function(){var e=!1,t=/a/;return t.exec=function(){return e=!0,null},"split"===n&&(t.constructor={},t.constructor[v]=function(){return t}),t[o](""),!e}):void 0;i&&s&&("replace"!==n||y)&&("split"!==n||_)||(a=/./[o],t=(s=t(f,o,""[n],function(e,t,n,r,o){return t.exec===d?i&&!o?{done:!0,value:a.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}))[0],r=s[1], + l(String.prototype,n,t),u(RegExp.prototype,o,2==e?function(e,t){return r.call(e,this,t)}:function(e){return r.call(e,this)}))}},{"./_defined":29,"./_fails":36,"./_hide":44,"./_redefine":93,"./_regexp-exec":95,"./_wks":130,"./es6.regexp.exec":227}],38:[function(e,t,n){"use strict";var r=e("./_an-object");t.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},{"./_an-object":8}],39:[function(e,t,n){"use strict";var v=e("./_is-array"),y=e("./_is-object"),_=e("./_to-length"),h=e("./_ctx"),m=e("./_wks")("isConcatSpreadable");t.exports=function e(t,n,r,o,a,i,s,l){for(var u,c,f=a,p=0,d=!!s&&h(s,l,3);pdocument.F=Object<\/script>"),e.close(),u=e.F;t--;)delete u[l][i[t]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(r[l]=o(e),n=new r,r[l]=null,n[s]=e):n=u(),void 0===t?n:a(n,t)}},{"./_an-object":8,"./_dom-create":31,"./_enum-bug-keys":32,"./_html":45,"./_object-dps":74,"./_shared-key":103}],73:[function(e,t,n){var r=e("./_an-object"),o=e("./_ie8-dom-define"),a=e("./_to-primitive"),i=Object.defineProperty;n.f=e("./_descriptors")?Object.defineProperty:function(e,t,n){if(r(e),t=a(t,!0),r(n),o)try{return i(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},{"./_an-object":8,"./_descriptors":30,"./_ie8-dom-define":46,"./_to-primitive":121}],74:[function(e,t,n){var i=e("./_object-dp"),s=e("./_an-object"),l=e("./_object-keys");t.exports=e("./_descriptors")?Object.defineProperties:function(e,t){s(e);for(var n,r=l(t),o=r.length,a=0;ao;)!i(r,n=t[o++])||~l(a,n)||a.push(n);return a}},{"./_array-includes":12,"./_has":43,"./_shared-key":103,"./_to-iobject":118}],82:[function(e,t,n){var r=e("./_object-keys-internal"),o=e("./_enum-bug-keys");t.exports=Object.keys||function(e){return r(e,o)}},{"./_enum-bug-keys":32,"./_object-keys-internal":81}],83:[function(e,t,n){n.f={}.propertyIsEnumerable},{}],84:[function(e,t,n){var o=e("./_export"),a=e("./_core"),i=e("./_fails");t.exports=function(e,t){var n=(a.Object||{})[e]||Object[e],r={};r[e]=t(n),o(o.S+o.F*i(function(){n(1)}),"Object",r)}},{"./_core":24,"./_export":34,"./_fails":36}],85:[function(e,t,n){var l=e("./_descriptors"),u=e("./_object-keys"),c=e("./_to-iobject"),f=e("./_object-pie").f;t.exports=function(s){return function(e){for(var t,n=c(e),r=u(n),o=r.length,a=0,i=[];a>>0||(a.test(e)?16:10))}:r},{"./_global":42,"./_string-trim":112,"./_string-ws":113}],89:[function(e,t,n){t.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},{}],90:[function(e,t,n){var r=e("./_an-object"),o=e("./_is-object"),a=e("./_new-promise-capability");t.exports=function(e,t){if(r(e),o(t)&&t.constructor===e)return t;e=a.f(e);return(0,e.resolve)(t),e.promise}},{"./_an-object":8,"./_is-object":53,"./_new-promise-capability":70}],91:[function(e,t,n){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],92:[function(e,t,n){var o=e("./_redefine");t.exports=function(e,t,n){for(var r in t)o(e,r,t[r],n);return e}},{"./_redefine":93}],93:[function(e,t,n){var a=e("./_global"),i=e("./_hide"),s=e("./_has"),l=e("./_uid")("src"),r=e("./_function-to-string"),o="toString",u=(""+r).split(o);e("./_core").inspectSource=function(e){return r.call(e)},(t.exports=function(e,t,n,r){var o="function"==typeof n;o&&!s(n,"name")&&i(n,"name",t),e[t]!==n&&(o&&!s(n,l)&&i(n,l,e[t]?""+e[t]:u.join(String(t))),e===a?e[t]=n:r?e[t]?e[t]=n:i(e,t,n):(delete e[t],i(e,t,n)))})(Function.prototype,o,function(){return"function"==typeof this&&this[l]||r.call(this)})},{"./_core":24,"./_function-to-string":41,"./_global":42,"./_has":43,"./_hide":44,"./_uid":125}],94:[function(e,t,n){"use strict";var r=e("./_classof"),o=RegExp.prototype.exec;t.exports=function(e,t){var n=e.exec;if("function"==typeof n){n=n.call(e,t);if("object"!=typeof n)throw new TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==r(e))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(e,t)}},{"./_classof":18}],95:[function(e,t,n){"use strict";var r,o,i=e("./_flags"),s=RegExp.prototype.exec,l=String.prototype.replace,e=s,u="lastIndex",c=(r=/a/,o=/b*/g,s.call(r,"a"),s.call(o,"a"),0!==r[u]||0!==o[u]),f=void 0!==/()??/.exec("")[1];t.exports=e=c||f?function(e){var t,n,r,o,a=this;return f&&(n=new RegExp("^"+a.source+"$(?!\\s)",i.call(a))),c&&(t=a[u]),r=s.call(a,e),c&&r&&(a[u]=a.global?r.index+r[0].length:t),f&&r&&1"+e+""}var o=e("./_export"),a=e("./_fails"),i=e("./_defined"),s=/"/g;t.exports=function(t,e){var n={};n[t]=e(r),o(o.P+o.F*a(function(){var e=""[t]('"');return e!==e.toLowerCase()||3t&&(o=o.slice(0,t)),r?o+e:e+o}},{"./_defined":29,"./_string-repeat":111,"./_to-length":119}],111:[function(e,t,n){"use strict";var o=e("./_to-integer"),a=e("./_defined");t.exports=function(e){var t=String(a(this)),n="",r=o(e);if(r<0||r==1/0)throw RangeError("Count can't be negative");for(;0>>=1)&&(t+=t))1&r&&(n+=t);return n}},{"./_defined":29,"./_to-integer":117}],112:[function(e,t,n){function r(e,t,n){var r={},o=i(function(){return!!s[e]()||"\u200b\x85"!="\u200b\x85"[e]()}),t=r[e]=o?t(c):s[e];n&&(r[n]=t),a(a.P+a.F*o,"String",r)}var a=e("./_export"),o=e("./_defined"),i=e("./_fails"),s=e("./_string-ws"),e="["+s+"]",l=RegExp("^"+e+e+"*"),u=RegExp(e+e+"*$"),c=r.trim=function(e,t){return e=String(o(e)),1&t&&(e=e.replace(l,"")),e=2&t?e.replace(u,""):e};t.exports=r},{"./_defined":29,"./_export":34,"./_fails":36,"./_string-ws":113}],113:[function(e,t,n){t.exports="\t\n\v\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff"},{}],114:[function(e,t,n){function r(){var e,t=+this;h.hasOwnProperty(t)&&(e=h[t],delete h[t],e())}function o(e){r.call(e.data)}var a,i=e("./_ctx"),s=e("./_invoke"),l=e("./_html"),u=e("./_dom-create"),c=e("./_global"),f=c.process,p=c.setImmediate,d=c.clearImmediate,v=c.MessageChannel,y=c.Dispatch,_=0,h={},m="onreadystatechange";p&&d||(p=function(e){for(var t=[],n=1;n>1,u=23===t?x(2,-24)-x(2,-77):0,c=0,f=e<0||0===e&&1/e<0?1:0;for((e=W(e))!=e||e===g?(o=e!=e?1:0,r=n):(r=B(Y(e)/z),e*(a=x(2,-r))<1&&(r--,a*=2),2<=(e+=1<=r+l?u/a:u*x(2,1-l))*a&&(r++,a/=2),n<=r+l?(o=0,r=n):1<=r+l?(o=(e*a-1)*x(2,t),r+=l):(o=e*x(2,l-1)*x(2,t),r=0));8<=t;i[c++]=255&o,o/=256,t-=8);for(r=r<>1,s=o-7,l=n-1,o=e[l--],u=127&o;for(o>>=7;0>=-s,s+=t;0>8&255]}function O(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]}function q(e){return S(e,52,8)}function X(e){return S(e,23,4)}function P(e,t,n){G(e[d],t,{get:function(){return this[n]}})}function L(e,t,n,r){n=c(+n);if(n+t>e[j])throw m(v);var o=e[w]._b,n=n+e[A],e=o.slice(n,n+t);return r?e:e.reverse()}function M(e,t,n,r,o,a){n=c(+n);if(n+t>e[j])throw m(v);for(var i=e[w]._b,s=n+e[A],l=r(+o),u=0;uV;)(T=R[V++])in y||a(y,T,b[T]);D||(s.constructor=y)}var u=new _(new y(2)),K=_[d].setInt8;u.setInt8(0,2147483648),u.setInt8(1,2147483649),!u.getInt8(0)&&u.getInt8(1)||i(_[d],{setInt8:function(e,t){K.call(this,e,t<<24>>24)},setUint8:function(e,t){K.call(this,e,t<<24>>24)}},!0)}else y=function(e){l(this,y,f);e=c(e);this._b=U.call(new Array(e),0),this[j]=e},_=function(e,t,n){l(this,_,p),l(e,y,p);var r=e[j],t=F(t);if(t<0||r>24},getUint8:function(e){return L(this,1,e)[0]},getInt16:function(e){e=L(this,2,e,arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(e){e=L(this,2,e,arguments[1]);return e[1]<<8|e[0]},getInt32:function(e){return E(L(this,4,e,arguments[1]))},getUint32:function(e){return E(L(this,4,e,arguments[1]))>>>0},getFloat32:function(e){return k(L(this,4,e,arguments[1]),23,4)},getFloat64:function(e){return k(L(this,8,e,arguments[1]),52,8)},setInt8:function(e,t){M(this,1,e,I,t)},setUint8:function(e,t){M(this,1,e,I,t)},setInt16:function(e,t){M(this,2,e,C,t,arguments[2])},setUint16:function(e,t){M(this,2,e,C,t,arguments[2])},setInt32:function(e,t){M(this,4,e,O,t,arguments[2])},setUint32:function(e,t){M(this,4,e,O,t,arguments[2])},setFloat32:function(e,t){M(this,4,e,X,t,arguments[2])},setFloat64:function(e,t){M(this,8,e,q,t,arguments[2])}});e(y,f),e(_,p),a(_[d],o.VIEW,!0),t[f]=y,t[p]=_},{"./_an-instance":7,"./_array-fill":10,"./_descriptors":30,"./_fails":36,"./_global":42,"./_hide":44,"./_library":61,"./_object-dp":73,"./_object-gopn":78,"./_redefine-all":92,"./_set-to-string-tag":102,"./_to-index":116,"./_to-integer":117,"./_to-length":119,"./_typed":124}],124:[function(e,t,n){for(var r,o=e("./_global"),a=e("./_hide"),e=e("./_uid"),i=e("typed_array"),s=e("view"),e=!(!o.ArrayBuffer||!o.DataView),l=e,u=0,c="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");u<9;)(r=o[c[u++]])?(a(r.prototype,i,!0),a(r.prototype,s,!0)):l=!1;t.exports={ABV:e,CONSTR:l,TYPED:i,VIEW:s}},{"./_global":42,"./_hide":44,"./_uid":125}],125:[function(e,t,n){var r=0,o=Math.random();t.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+o).toString(36))}},{}],126:[function(e,t,n){e=e("./_global").navigator;t.exports=e&&e.userAgent||""},{"./_global":42}],127:[function(e,t,n){var r=e("./_is-object");t.exports=function(e,t){if(r(e)&&e._t===t)return e;throw TypeError("Incompatible receiver, "+t+" required!")}},{"./_is-object":53}],128:[function(e,t,n){var r=e("./_global"),o=e("./_core"),a=e("./_library"),i=e("./_wks-ext"),s=e("./_object-dp").f;t.exports=function(e){var t=o.Symbol||(o.Symbol=!a&&r.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:i.f(e)})}},{"./_core":24,"./_global":42,"./_library":61,"./_object-dp":73,"./_wks-ext":129}],129:[function(e,t,n){n.f=e("./_wks")},{"./_wks":130}],130:[function(e,t,n){var r=e("./_shared")("wks"),o=e("./_uid"),a=e("./_global").Symbol,i="function"==typeof a;(t.exports=function(e){return r[e]||(r[e]=i&&a[e]||(i?a:o)("Symbol."+e))}).store=r},{"./_global":42,"./_shared":104,"./_uid":125}],131:[function(e,t,n){var r=e("./_classof"),o=e("./_wks")("iterator"),a=e("./_iterators");t.exports=e("./_core").getIteratorMethod=function(e){if(null!=e)return e[o]||e["@@iterator"]||a[r(e)]}},{"./_classof":18,"./_core":24,"./_iterators":60,"./_wks":130}],132:[function(e,t,n){var r=e("./_export"),o=e("./_replacer")(/[\\^$*+?.()|[\]{}]/g,"\\$&");r(r.S,"RegExp",{escape:function(e){return o(e)}})},{"./_export":34,"./_replacer":96}],133:[function(e,t,n){var r=e("./_export");r(r.P,"Array",{copyWithin:e("./_array-copy-within")}),e("./_add-to-unscopables")("copyWithin")},{"./_add-to-unscopables":5,"./_array-copy-within":9,"./_export":34}],134:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_array-methods")(4);r(r.P+r.F*!e("./_strict-method")([].every,!0),"Array",{every:function(e){return o(this,e,arguments[1])}})},{"./_array-methods":13,"./_export":34,"./_strict-method":106}],135:[function(e,t,n){var r=e("./_export");r(r.P,"Array",{fill:e("./_array-fill")}),e("./_add-to-unscopables")("fill")},{"./_add-to-unscopables":5,"./_array-fill":10,"./_export":34}],136:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_array-methods")(2);r(r.P+r.F*!e("./_strict-method")([].filter,!0),"Array",{filter:function(e){return o(this,e,arguments[1])}})},{"./_array-methods":13,"./_export":34,"./_strict-method":106}],137:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_array-methods")(6),a="findIndex",i=!0;a in[]&&Array(1)[a](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(e){return o(this,e,1=e.length?(this._t=void 0,o(1)):o(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values"),a.Arguments=a.Array,r("keys"),r("values"),r("entries")},{"./_add-to-unscopables":5,"./_iter-define":57,"./_iter-step":59,"./_iterators":60,"./_to-iobject":118}],144:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_to-iobject"),a=[].join;r(r.P+r.F*(e("./_iobject")!=Object||!e("./_strict-method")(a)),"Array",{join:function(e){return a.call(o(this),void 0===e?",":e)}})},{"./_export":34,"./_iobject":49,"./_strict-method":106,"./_to-iobject":118}],145:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_to-iobject"),a=e("./_to-integer"),i=e("./_to-length"),s=[].lastIndexOf,l=!!s&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(l||!e("./_strict-method")(s)),"Array",{lastIndexOf:function(e){if(l)return s.apply(this,arguments)||0;var t=o(this),n=i(t.length),r=n-1;for((r=1>>=0)?31-Math.floor(Math.log(e+.5)*Math.LOG2E):32}})},{"./_export":34}],168:[function(e,t,n){var e=e("./_export"),r=Math.exp;e(e.S,"Math",{cosh:function(e){return(r(e=+e)+r(-e))/2}})},{"./_export":34}],169:[function(e,t,n){var r=e("./_export"),e=e("./_math-expm1");r(r.S+r.F*(e!=Math.expm1),"Math",{expm1:e})},{"./_export":34,"./_math-expm1":62}],170:[function(e,t,n){var r=e("./_export");r(r.S,"Math",{fround:e("./_math-fround")})},{"./_export":34,"./_math-fround":63}],171:[function(e,t,n){var e=e("./_export"),l=Math.abs;e(e.S,"Math",{hypot:function(e,t){for(var n,r,o=0,a=0,i=arguments.length,s=0;a>>16)*o+r*(n&t>>>16)<<16>>>0)}})},{"./_export":34,"./_fails":36}],173:[function(e,t,n){e=e("./_export");e(e.S,"Math",{log10:function(e){return Math.log(e)*Math.LOG10E}})},{"./_export":34}],174:[function(e,t,n){var r=e("./_export");r(r.S,"Math",{log1p:e("./_math-log1p")})},{"./_export":34,"./_math-log1p":64}],175:[function(e,t,n){e=e("./_export");e(e.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},{"./_export":34}],176:[function(e,t,n){var r=e("./_export");r(r.S,"Math",{sign:e("./_math-sign")})},{"./_export":34,"./_math-sign":66}],177:[function(e,t,n){var r=e("./_export"),o=e("./_math-expm1"),a=Math.exp;r(r.S+r.F*e("./_fails")(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(e){return Math.abs(e=+e)<1?(o(e)-o(-e))/2:(a(e-1)-a(-e-1))*(Math.E/2)}})},{"./_export":34,"./_fails":36,"./_math-expm1":62}],178:[function(e,t,n){var r=e("./_export"),o=e("./_math-expm1"),a=Math.exp;r(r.S,"Math",{tanh:function(e){var t=o(e=+e),n=o(-e);return t==1/0?1:n==1/0?-1:(t-n)/(a(e)+a(-e))}})},{"./_export":34,"./_math-expm1":62}],179:[function(e,t,n){e=e("./_export");e(e.S,"Math",{trunc:function(e){return(0w;w++)a(y,g=x[w])&&!a(b,g)&&p(b,g,f(y,g));(b.prototype=_).constructor=b,e("./_redefine")(o,v,b)}},{"./_cof":19,"./_descriptors":30,"./_fails":36,"./_global":42,"./_has":43,"./_inherit-if-required":47,"./_object-create":72,"./_object-dp":73,"./_object-gopd":76,"./_object-gopn":78,"./_redefine":93,"./_string-trim":112,"./_to-primitive":121}],181:[function(e,t,n){e=e("./_export");e(e.S,"Number",{EPSILON:Math.pow(2,-52)})},{"./_export":34}],182:[function(e,t,n){var r=e("./_export"),o=e("./_global").isFinite;r(r.S,"Number",{isFinite:function(e){return"number"==typeof e&&o(e)}})},{"./_export":34,"./_global":42}],183:[function(e,t,n){var r=e("./_export");r(r.S,"Number",{isInteger:e("./_is-integer")})},{"./_export":34,"./_is-integer":52}],184:[function(e,t,n){e=e("./_export");e(e.S,"Number",{isNaN:function(e){return e!=e}})},{"./_export":34}],185:[function(e,t,n){var r=e("./_export"),o=e("./_is-integer"),a=Math.abs;r(r.S,"Number",{isSafeInteger:function(e){return o(e)&&a(e)<=9007199254740991}})},{"./_export":34,"./_is-integer":52}],186:[function(e,t,n){e=e("./_export");e(e.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{"./_export":34}],187:[function(e,t,n){e=e("./_export");e(e.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{"./_export":34}],188:[function(e,t,n){var r=e("./_export"),e=e("./_parse-float");r(r.S+r.F*(Number.parseFloat!=e),"Number",{parseFloat:e})},{"./_export":34,"./_parse-float":87}],189:[function(e,t,n){var r=e("./_export"),e=e("./_parse-int");r(r.S+r.F*(Number.parseInt!=e),"Number",{parseInt:e})},{"./_export":34,"./_parse-int":88}],190:[function(e,t,n){"use strict";function i(e,t){for(var n=-1,r=t;++n<6;)r+=e*d[n],d[n]=r%1e7,r=a(r/1e7)}function s(e){for(var t=6,n=0;0<=--t;)n+=d[t],d[t]=a(n/e),n=n%e*1e7}function l(){for(var e,t=6,n="";0<=--t;)""===n&&0!==t&&0===d[t]||(e=String(d[t]),n=""===n?e:n+p.call("0",7-e.length)+e);return n}function u(e,t,n){return 0===t?n:t%2==1?u(e,t-1,n*e):u(e*e,t/2,n)}var r=e("./_export"),c=e("./_to-integer"),f=e("./_a-number-value"),p=e("./_string-repeat"),o=1..toFixed,a=Math.floor,d=[0,0,0,0,0,0],v="Number.toFixed: incorrect invocation!";r(r.P+r.F*(!!o&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==0xde0b6b3a7640080.toFixed(0))||!e("./_fails")(function(){o.call({})})),"Number",{toFixed:function(e){var t,n,r=f(this,v),e=c(e),o="",a="0";if(e<0||20e;)t(r[e++]);f._c=[],f._n=!1,n&&!f._h&&(o=f,_.call(p,function(){var e,t,n=o._v,r=L(o);if(r&&(e=g(function(){I?A.emit("unhandledRejection",n,o):(t=p.onunhandledrejection)?t({promise:o,reason:n}):(t=p.console)&&t.error&&t.error("Unhandled promise rejection",n)}),o._h=I||L(o)?2:1),o._a=void 0,r&&e.e)throw e.v}))}))},L=function(e){return 1!==e._h&&0===(e._a||e._c).length},M=function(e){var t=this; + t._d||(t._d=!0,(t=t._w||t)._v=e,t._s=2,t._a||(t._a=t._c.slice()),P(t,!0))},T=function(e){var n,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===e)throw j("Promise can't be resolved itself");(n=O(e))?h(function(){var t={_w:r,_d:!1};try{n.call(e,l(T,t,1),l(M,t,1))}catch(e){M.call(t,e)}}):(r._v=e,r._s=1,P(r,!1))}catch(e){M.call({_w:r,_d:!1},e)}}};S||(E=function(e){d(this,E,w,"_h"),f(e),t.call(this);try{e(l(T,this,1),l(M,this,1))}catch(e){M.call(this,e)}},(t=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n("./_redefine-all")(E.prototype,{then:function(e,t){var n=C(y(this,E));return n.ok="function"!=typeof e||e,n.fail="function"==typeof t&&t,n.domain=I?A.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&P(this,!1),n.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new t;this.promise=e,this.resolve=l(T,e,1),this.reject=l(M,e,1)},m.f=C=function(e){return e===E||e===i?new a:o(e)}),u(u.G+u.W+u.F*!S,{Promise:E}),n("./_set-to-string-tag")(E,w),n("./_set-species")(w),i=n("./_core")[w],u(u.S+u.F*!S,w,{reject:function(e){var t=C(this);return(0,t.reject)(e),t.promise}}),u(u.S+u.F*(s||!S),w,{resolve:function(e){return x(s&&this===i?E:this,e)}}),u(u.S+u.F*!(S&&n("./_iter-detect")(function(e){E.all(e).catch(r)})),w,{all:function(e){var i=this,t=C(i),s=t.resolve,l=t.reject,n=g(function(){var r=[],o=0,a=1;v(e,!1,function(e){var t=o++,n=!1;r.push(void 0),a++,i.resolve(e).then(function(e){n||(n=!0,r[t]=e,--a||s(r))},l)}),--a||s(r)});return n.e&&l(n.v),t.promise},race:function(e){var t=this,n=C(t),r=n.reject,o=g(function(){v(e,!1,function(e){t.resolve(e).then(n.resolve,r)})});return o.e&&r(o.v),n.promise}})},{"./_a-function":3,"./_an-instance":7,"./_classof":18,"./_core":24,"./_ctx":26,"./_export":34,"./_for-of":40,"./_global":42,"./_is-object":53,"./_iter-detect":58,"./_library":61,"./_microtask":69,"./_new-promise-capability":70,"./_perform":89,"./_promise-resolve":90,"./_redefine-all":92,"./_set-species":101,"./_set-to-string-tag":102,"./_species-constructor":105,"./_task":114,"./_user-agent":126,"./_wks":130}],212:[function(e,t,n){var r=e("./_export"),o=e("./_a-function"),a=e("./_an-object"),i=(e("./_global").Reflect||{}).apply,s=Function.apply;r(r.S+r.F*!e("./_fails")(function(){i(function(){})}),"Reflect",{apply:function(e,t,n){e=o(e),n=a(n);return i?i(e,t,n):s.call(e,t,n)}})},{"./_a-function":3,"./_an-object":8,"./_export":34,"./_fails":36,"./_global":42}],213:[function(e,t,n){var r=e("./_export"),o=e("./_object-create"),a=e("./_a-function"),i=e("./_an-object"),s=e("./_is-object"),l=e("./_fails"),u=e("./_bind"),c=(e("./_global").Reflect||{}).construct,f=l(function(){function e(){}return!(c(function(){},[],e)instanceof e)}),p=!l(function(){c(function(){})});r(r.S+r.F*(f||p),"Reflect",{construct:function(e,t){a(e),i(t);var n=arguments.length<3?e:a(arguments[2]);if(p&&!f)return c(e,t,n);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var r=[null];return r.push.apply(r,t),new(u.apply(e,r))}r=n.prototype,n=o(s(r)?r:Object.prototype),r=Function.apply.call(e,n,t);return s(r)?r:n}})},{"./_a-function":3,"./_an-object":8,"./_bind":17,"./_export":34,"./_fails":36,"./_global":42,"./_is-object":53,"./_object-create":72}],214:[function(e,t,n){var r=e("./_object-dp"),o=e("./_export"),a=e("./_an-object"),i=e("./_to-primitive");o(o.S+o.F*e("./_fails")(function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(e,t,n){a(e),t=i(t,!0),a(n);try{return r.f(e,t,n),!0}catch(e){return!1}}})},{"./_an-object":8,"./_export":34,"./_fails":36,"./_object-dp":73,"./_to-primitive":121}],215:[function(e,t,n){var r=e("./_export"),o=e("./_object-gopd").f,a=e("./_an-object");r(r.S,"Reflect",{deleteProperty:function(e,t){var n=o(a(e),t);return!(n&&!n.configurable)&&delete e[t]}})},{"./_an-object":8,"./_export":34,"./_object-gopd":76}],216:[function(e,t,n){"use strict";function r(e){this._t=a(e),this._i=0;var t,n=this._k=[];for(t in e)n.push(t)}var o=e("./_export"),a=e("./_an-object");e("./_iter-create")(r,"Object",function(){var e,t=this._k;do{if(this._i>=t.length)return{value:void 0,done:!0}}while(!((e=t[this._i++])in this._t));return{value:e,done:!1}}),o(o.S,"Reflect",{enumerate:function(e){return new r(e)}})},{"./_an-object":8,"./_export":34,"./_iter-create":56}],217:[function(e,t,n){var r=e("./_object-gopd"),o=e("./_export"),a=e("./_an-object");o(o.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return r.f(a(e),t)}})},{"./_an-object":8,"./_export":34,"./_object-gopd":76}],218:[function(e,t,n){var r=e("./_export"),o=e("./_object-gpo"),a=e("./_an-object");r(r.S,"Reflect",{getPrototypeOf:function(e){return o(a(e))}})},{"./_an-object":8,"./_export":34,"./_object-gpo":80}],219:[function(e,t,n){var a=e("./_object-gopd"),i=e("./_object-gpo"),s=e("./_has"),r=e("./_export"),l=e("./_is-object"),u=e("./_an-object");r(r.S,"Reflect",{get:function e(t,n){var r,o=arguments.length<3?t:arguments[2];return u(t)===o?t[n]:(r=a.f(t,n))?s(r,"value")?r.value:void 0!==r.get?r.get.call(o):void 0:l(r=i(t))?e(r,n,o):void 0}})},{"./_an-object":8,"./_export":34,"./_has":43,"./_is-object":53,"./_object-gopd":76,"./_object-gpo":80}],220:[function(e,t,n){e=e("./_export");e(e.S,"Reflect",{has:function(e,t){return t in e}})},{"./_export":34}],221:[function(e,t,n){var r=e("./_export"),o=e("./_an-object"),a=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(e){return o(e),!a||a(e)}})},{"./_an-object":8,"./_export":34}],222:[function(e,t,n){var r=e("./_export");r(r.S,"Reflect",{ownKeys:e("./_own-keys")})},{"./_export":34,"./_own-keys":86}],223:[function(e,t,n){var r=e("./_export"),o=e("./_an-object"),a=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(e){o(e);try{return a&&a(e),!0}catch(e){return!1}}})},{"./_an-object":8,"./_export":34}],224:[function(e,t,n){var r=e("./_export"),o=e("./_set-proto");o&&r(r.S,"Reflect",{setPrototypeOf:function(e,t){o.check(e,t);try{return o.set(e,t),!0}catch(e){return!1}}})},{"./_export":34,"./_set-proto":100}],225:[function(e,t,n){var s=e("./_object-dp"),l=e("./_object-gopd"),u=e("./_object-gpo"),c=e("./_has"),r=e("./_export"),f=e("./_property-desc"),p=e("./_an-object"),d=e("./_is-object");r(r.S,"Reflect",{set:function e(t,n,r){var o,a=arguments.length<4?t:arguments[3],i=l.f(p(t),n);if(!i){if(d(o=u(t)))return e(o,n,r,a);i=f(0)}if(c(i,"value")){if(!1===i.writable||!d(a))return!1;if(o=l.f(a,n)){if(o.get||o.set||!1===o.writable)return!1;o.value=r,s.f(a,n,o)}else s.f(a,n,f(0,r));return!0}return void 0!==i.set&&(i.set.call(a,r),!0)}})},{"./_an-object":8,"./_export":34,"./_has":43,"./_is-object":53,"./_object-dp":73,"./_object-gopd":76,"./_object-gpo":80,"./_property-desc":91}],226:[function(e,t,n){var r=e("./_global"),a=e("./_inherit-if-required"),o=e("./_object-dp").f,i=e("./_object-gopn").f,s=e("./_is-regexp"),l=e("./_flags"),u=v=r.RegExp,c=v.prototype,f=/a/g,p=/a/g,d=new v(f)!==f;if(e("./_descriptors")&&(!d||e("./_fails")(function(){return p[e("./_wks")("match")]=!1,v(f)!=f||v(p)==p||"/a/i"!=v(f,"i")}))){for(var v=function(e,t){var n=this instanceof v,r=s(e),o=void 0===t;return!n&&r&&e.constructor===v&&o?e:a(d?new u(r&&!o?e.source:e,t):u((r=e instanceof v)?e.source:e,r&&o?l.call(e):t),n?this:c,v)},y=i(u),_=0;y.length>_;)!function(t){t in v||o(v,t,{configurable:!0,get:function(){return u[t]},set:function(e){u[t]=e}})}(y[_++]);(c.constructor=v).prototype=c,e("./_redefine")(r,"RegExp",v)}e("./_set-species")("RegExp")},{"./_descriptors":30,"./_fails":36,"./_flags":38,"./_global":42,"./_inherit-if-required":47,"./_is-regexp":54,"./_object-dp":73,"./_object-gopn":78,"./_redefine":93,"./_set-species":101,"./_wks":130}],227:[function(e,t,n){"use strict";var r=e("./_regexp-exec");e("./_export")({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},{"./_export":34,"./_regexp-exec":95}],228:[function(e,t,n){e("./_descriptors")&&"g"!=/./g.flags&&e("./_object-dp").f(RegExp.prototype,"flags",{configurable:!0,get:e("./_flags")})},{"./_descriptors":30,"./_flags":38,"./_object-dp":73}],229:[function(e,t,n){"use strict";var c=e("./_an-object"),f=e("./_to-length"),p=e("./_advance-string-index"),d=e("./_regexp-exec-abstract");e("./_fix-re-wks")("match",1,function(r,o,l,u){return[function(e){var t=r(this),n=null==e?void 0:e[o];return void 0!==n?n.call(e,t):new RegExp(e)[o](String(t))},function(e){var t=u(l,e,this);if(t.done)return t.value;var n=c(e),r=String(this);if(!n.global)return d(n,r);for(var o=n.unicode,a=[],i=n.lastIndex=0;null!==(s=d(n,r));){var s=String(s[0]);""===(a[i]=s)&&(n.lastIndex=p(r,f(n.lastIndex),o)),i++}return 0===i?null:a}]})},{"./_advance-string-index":6,"./_an-object":8,"./_fix-re-wks":37,"./_regexp-exec-abstract":94,"./_to-length":119}],230:[function(e,t,n){"use strict";var w=e("./_an-object"),j=e("./_to-object"),A=e("./_to-length"),S=e("./_to-integer"),k=e("./_advance-string-index"),E=e("./_regexp-exec-abstract"),I=Math.max,C=Math.min,O=Math.floor,P=/\$([$&`']|\d\d?|<[^>]*>)/g,L=/\$([$&`']|\d\d?)/g;e("./_fix-re-wks")("replace",2,function(o,a,b,x){return[function(e,t){var n=o(this),r=null==e?void 0:e[a];return void 0!==r?r.call(e,n,t):b.call(String(n),e,t)},function(e,t){var n=x(b,e,this,t);if(n.done)return n.value;for(var r,o=w(e),a=String(this),i="function"==typeof t,s=(i||(t=String(t)),o.global),l=(s&&(r=o.unicode,o.lastIndex=0),[]);null!==(d=E(o,a))&&(l.push(d),s);)""===String(d[0])&&(o.lastIndex=k(a,A(o.lastIndex),r));for(var u,c="",f=0,p=0;p>>0,c=new RegExp(e.source,s+"g");(r=p.call(c,n))&&!(l<(o=c[A])&&(i.push(n.slice(l,r.index)),1=u));)c[A]===r.index&&c[A]++;return l===n[j]?!a&&c.test("")||i.push(""):i.push(n.slice(l)),i[j]>u?i.slice(0,u):i}:"0"[i](void 0,0)[j]?function(e,t){return void 0===e&&0===t?[]:v.call(this,e,t)}:v;return[function(e,t){var n=o(this),r=null==e?void 0:e[a];return void 0!==r?r.call(e,n,t):_.call(String(n),e,t)},function(e,t){var n=y(_,e,this,t,_!==v);if(n.done)return n.value;var n=h(e),r=String(this),e=m(n,RegExp),o=n.unicode,a=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.unicode?"u":"")+(k?"y":"g"),i=new e(k?n:"^(?:"+n.source+")",a),s=void 0===t?S:t>>>0;if(0==s)return[];if(0===r.length)return null===x(i,r)?[r]:[];for(var l=0,u=0,c=[];u>10),t%1024+56320))}return n.join("")}})},{"./_export":34,"./_to-absolute-index":115}],245:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_string-context"),a="includes";r(r.P+r.F*e("./_fails-is-regexp")(a),"String",{includes:function(e){return!!~o(this,e,a).indexOf(e,1=e.length?{value:void 0,done:!0}:(e=r(e,t),this._i+=e.length,{value:e,done:!1})})},{"./_iter-define":57,"./_string-at":107}],248:[function(e,t,n){"use strict";e("./_string-html")("link",function(t){return function(e){return t(this,"a","href",e)}})},{"./_string-html":109}],249:[function(e,t,n){var r=e("./_export"),i=e("./_to-iobject"),s=e("./_to-length");r(r.S,"String",{raw:function(e){for(var t=i(e.raw),n=s(t.length),r=arguments.length,o=[],a=0;ao;)l(I,t=n[o++])||t==k||t==H||r.push(t);return r}function i(e){for(var t,n=e===O,r=Z(n?C:_(e)),o=[],a=0;r.length>a;)!l(I,t=r[a++])||n&&!l(O,t)||o.push(I[t]);return o}var s=e("./_global"),l=e("./_has"),u=e("./_descriptors"),c=e("./_export"),F=e("./_redefine"),H=e("./_meta").KEY,f=e("./_fails"),p=e("./_shared"),d=e("./_set-to-string-tag"),G=e("./_uid"),v=e("./_wks"),U=e("./_wks-ext"),W=e("./_wks-define"),B=e("./_enum-keys"),Y=e("./_is-array"),y=e("./_an-object"),z=e("./_is-object"),q=e("./_to-object"),_=e("./_to-iobject"),h=e("./_to-primitive"),m=e("./_property-desc"),g=e("./_object-create"),X=e("./_object-gopn-ext"),V=e("./_object-gopd"),b=e("./_object-gops"),K=e("./_object-dp"),Q=e("./_object-keys"),J=V.f,x=K.f,Z=X.f,w=s.Symbol,j=s.JSON,A=j&&j.stringify,S="prototype",k=v("_hidden"),$=v("toPrimitive"),ee={}.propertyIsEnumerable,E=p("symbol-registry"),I=p("symbols"),C=p("op-symbols"),O=Object[S],p="function"==typeof w&&!!b.f,P=s.QObject,L=!P||!P[S]||!P[S].findChild,M=u&&f(function(){return 7!=g(x({},"a",{get:function(){return x(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=J(O,t);r&&delete O[t],x(e,t,n),r&&e!==O&&x(O,t,r)}:x,T=p&&"symbol"==typeof w.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof w},R=function(e,t,n){return e===O&&R(C,t,n),y(e),t=h(t,!0),y(n),l(I,t)?(n.enumerable?(l(e,k)&&e[k][t]&&(e[k][t]=!1),n=g(n,{enumerable:m(0,!1)})):(l(e,k)||x(e,k,m(1,{})),e[k][t]=!0),M(e,t,n)):x(e,t,n)};p||(F((w=function(){if(this instanceof w)throw TypeError("Symbol is not a constructor!");var t=G(0ne;)v(te[ne++]);for(var re=Q(v.store),oe=0;re.length>oe;)W(re[oe++]);c(c.S+c.F*!p,"Symbol",{for:function(e){return l(E,e+="")?E[e]:E[e]=w(e)},keyFor:function(e){if(!T(e))throw TypeError(e+" is not a symbol!");for(var t in E)if(E[t]===e)return t},useSetter:function(){L=!0},useSimple:function(){L=!1}}),c(c.S+c.F*!p,"Object",{create:function(e,t){return void 0===t?g(e):n(g(e),t)},defineProperty:R,defineProperties:n,getOwnPropertyDescriptor:o,getOwnPropertyNames:a,getOwnPropertySymbols:i});P=f(function(){b.f(1)});c(c.S+c.F*P,"Object",{getOwnPropertySymbols:function(e){return b.f(q(e))}}),j&&c(c.S+c.F*(!p||f(function(){var e=w();return"[null]"!=A([e])||"{}"!=A({a:e})||"{}"!=A(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],o=1;o>>=0,n>>>=0;return(t>>>0)+(r>>>0)+((e&n|(e|n)&~(e+n>>>0))>>>31)|0}})},{"./_export":34}],285:[function(e,t,n){e=e("./_export");e(e.S,"Math",{imulh:function(e,t){var e=+e,t=+t,n=65535&e,r=65535&t,e=e>>16,t=t>>16,r=(e*r>>>0)+(n*r>>>16);return e*t+(r>>16)+((n*t>>>0)+(65535&r)>>16)}})},{"./_export":34}],286:[function(e,t,n){e=e("./_export");e(e.S,"Math",{isubh:function(e,t,n,r){e>>>=0,n>>>=0;return(t>>>0)-(r>>>0)-((~e&n|~(e^n)&e-n>>>0)>>>31)|0}})},{"./_export":34}],287:[function(e,t,n){e=e("./_export");e(e.S,"Math",{RAD_PER_DEG:180/Math.PI})},{"./_export":34}],288:[function(e,t,n){var e=e("./_export"),r=Math.PI/180;e(e.S,"Math",{radians:function(e){return e*r}})},{"./_export":34}],289:[function(e,t,n){var r=e( + "./_export");r(r.S,"Math",{scale:e("./_math-scale")})},{"./_export":34,"./_math-scale":65}],290:[function(e,t,n){e=e("./_export");e(e.S,"Math",{signbit:function(e){return(e=+e)!=e?e:0==e?1/e==1/0:0>>16,t=t>>>16,r=(e*r>>>0)+(n*r>>>16);return e*t+(r>>>16)+((n*t>>>0)+(65535&r)>>>16)}})},{"./_export":34}],292:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_to-object"),a=e("./_a-function"),i=e("./_object-dp");e("./_descriptors")&&r(r.P+e("./_object-forced-pam"),"Object",{__defineGetter__:function(e,t){i.f(o(this),e,{get:a(t),enumerable:!0,configurable:!0})}})},{"./_a-function":3,"./_descriptors":30,"./_export":34,"./_object-dp":73,"./_object-forced-pam":75,"./_to-object":120}],293:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_to-object"),a=e("./_a-function"),i=e("./_object-dp");e("./_descriptors")&&r(r.P+e("./_object-forced-pam"),"Object",{__defineSetter__:function(e,t){i.f(o(this),e,{set:a(t),enumerable:!0,configurable:!0})}})},{"./_a-function":3,"./_descriptors":30,"./_export":34,"./_object-dp":73,"./_object-forced-pam":75,"./_to-object":120}],294:[function(e,t,n){var r=e("./_export"),o=e("./_object-to-array")(!0);r(r.S,"Object",{entries:function(e){return o(e)}})},{"./_export":34,"./_object-to-array":85}],295:[function(e,t,n){var r=e("./_export"),l=e("./_own-keys"),u=e("./_to-iobject"),c=e("./_object-gopd"),f=e("./_create-property");r(r.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,n,r=u(e),o=c.f,a=l(r),i={},s=0;a.length>s;)void 0!==(n=o(r,t=a[s++]))&&f(i,t,n);return i}})},{"./_create-property":25,"./_export":34,"./_object-gopd":76,"./_own-keys":86,"./_to-iobject":118}],296:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_to-object"),a=e("./_to-primitive"),i=e("./_object-gpo"),s=e("./_object-gopd").f;e("./_descriptors")&&r(r.P+e("./_object-forced-pam"),"Object",{__lookupGetter__:function(e){var t,n=o(this),r=a(e,!0);do{if(t=s(n,r))return t.get}while(n=i(n))}})},{"./_descriptors":30,"./_export":34,"./_object-forced-pam":75,"./_object-gopd":76,"./_object-gpo":80,"./_to-object":120,"./_to-primitive":121}],297:[function(e,t,n){"use strict";var r=e("./_export"),o=e("./_to-object"),a=e("./_to-primitive"),i=e("./_object-gpo"),s=e("./_object-gopd").f;e("./_descriptors")&&r(r.P+e("./_object-forced-pam"),"Object",{__lookupSetter__:function(e){var t,n=o(this),r=a(e,!0);do{if(t=s(n,r))return t.set}while(n=i(n))}})},{"./_descriptors":30,"./_export":34,"./_object-forced-pam":75,"./_object-gopd":76,"./_object-gpo":80,"./_to-object":120,"./_to-primitive":121}],298:[function(e,t,n){var r=e("./_export"),o=e("./_object-to-array")(!1);r(r.S,"Object",{values:function(e){return o(e)}})},{"./_export":34,"./_object-to-array":85}],299:[function(e,t,n){"use strict";function o(e){return null==e?void 0:d(e)}function a(e){var t=e._c;t&&(e._c=void 0,t())}function i(e){return void 0===e._o}function s(e){i(e)||(e._o=void 0,a(e))}function r(t,e){v(t),this._c=void 0,this._o=t,t=new b(this);try{var n=e(t),r=n;null!=n&&("function"==typeof n.unsubscribe?n=function(){r.unsubscribe()}:d(n),this._c=n)}catch(e){return void t.error(e)}i(this)&&a(this)}var l=e("./_export"),u=e("./_global"),c=e("./_core"),f=e("./_microtask")(),p=e("./_wks")("observable"),d=e("./_a-function"),v=e("./_an-object"),y=e("./_an-instance"),_=e("./_redefine-all"),h=e("./_hide"),m=e("./_for-of"),g=m.RETURN,b=(r.prototype=_({},{unsubscribe:function(){s(this)}}),function(e){this._s=e}),x=(b.prototype=_({},{next:function(e){var t=this._s;if(!i(t)){var n=t._o;try{var r=o(n.next);if(r)return r.call(n,e)}catch(e){try{s(t)}finally{throw e}}}},error:function(e){var t=this._s;if(i(t))throw e;var n=t._o;t._o=void 0;try{var r=o(n.error);if(!r)throw e;e=r.call(n,e)}catch(e){try{a(t)}finally{throw e}}return a(t),e},complete:function(e){var t=this._s;if(!i(t)){var n=t._o;t._o=void 0;try{var r=o(n.complete);e=r?r.call(n,e):void 0}catch(e){try{a(t)}finally{throw e}}return a(t),e}}}),function(e){y(this,x,"Observable","_f")._f=d(e)});_(x.prototype,{subscribe:function(e){return new r(e,this._f)},forEach:function(r){var o=this;return new(c.Promise||u.Promise)(function(e,t){d(r);var n=o.subscribe({next:function(e){try{return r(e)}catch(e){t(e),n.unsubscribe()}},error:t,complete:e})})}}),_(x,{from:function(e){var t,n="function"==typeof this?this:x,r=o(v(e)[p]);return r?(t=v(r.call(e))).constructor===n?t:new n(function(e){return t.subscribe(e)}):new n(function(t){var n=!1;return f(function(){if(!n){try{if(m(e,!1,function(e){if(t.next(e),n)return g})===g)return}catch(e){if(n)throw e;return void t.error(e)}t.complete()}}),function(){n=!0}})},of:function(){for(var e=0,t=arguments.length,r=new Array(t);et.maxVariantLength&&(t.maxVariantLength=e.length),{value:e,element:null}}),this.variants.length?(this.update(),this.show()):this.hide()},i.prototype.reset=function(){this.element.textContent="",this.variants=[],this.variant=0,this.lastSeek=0,this.maxVariantLength=0,this.firstDisplay=!0},i.prototype.get=function(){return(this.variants[this.variant]||{}).value||""},i.prototype.next=function(){var e=this.variant;this.variant=(this.variant+(0",e.headers.join(""),"",e.data.slice(0,t).map(function(e){return""+(e||[]).join("")+""}).join(""),"",e.data.length>=t?''+s.get("sqlMaxRows",t)+"":0===e.data.length?''+s.get("sqlNoData")+"":"",""],i.printLine("\r\n\x1b!"+e.join("")+"")),a.prompt(c.NAMESPACE+":SQL > ")})}}},{"../config":337,"../index":340,"../localization":349,"../output":356,"../server":360,"./index":345,"./special":346}],344:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.get=function(){var e=0=S?T():(k=i,(0,F.showSuggestions)(t&&0o&&(o=n.length);return o+=2,c.print(u.get("availConfLoc")+"\r\n"),t(r,o,!1),c.print(u.get("availConfGlob")+"\r\n"),t(r,o,!0),void c.print(u.get("confHintSet")+"\r\n")}e.filter(function(e){return"global"===e.class})[0]?a.reset():e.length<5?c.print(u.get("confHintSet")+"\r\n"):(r=e.filter(function(e){return"variable"===e.class})[0],e=e.filter(function(e){return"constant"===e.class||"string"===e.class})[0],r&&e?""!==(r=a.set(r.value,"string"===e.class?e.value.substr(1,e.value.length-2):e.value))&&c.print(r+"\r\n"):c.print(u.get("confHintSet")+"\r\n"))},favorite:function(e){if(e.length<4){var t=p.list();if(0s&&(s=n.length);for(r in c.print("\x1b[1m"+o+"\x1b[0m\x1b["+s+"G \x1b[1m"+a+"\x1b[0m\r\n"),i)c.print("\x1b[(constant)m"+r+"\x1b[0m\x1b["+s+"G= "+i[r]+"\r\n");c.newLine()}c.print(u.get("favDesc")+"\r\n")}else{var l;"delete"===e[3].value?e[4]&&" "===e[4].value&&e[5]?(t=p.clear(e[5].value),c.print(u.get("favDel"+(t?"OK":"NotOK"),e[5].value)+"\r\n")):(p.clear(),c.print(u.get("favDel")+"\r\n")):(e.length<6&&((l=p.get(e[3].value))?setTimeout(function(){return f.setValue(l)},1):c.print(u.get("noFav",e[3].value)+"\r\n")),(o=e.slice(5).map(function(e){return e.value}).join(""))&&e[3].value&&(p.set(e[3].value,o),c.print(u.get("favSet",e[3].value)+"\r\n")))}},info:function(){c.print(u.get("info")+"\r\n")},logout:function(){var e=void 0;try{e=document.execCommand("ClearAuthenticationCache")}catch(e){}(e=e||function(e){if(e)return!!e&&(e.open("HEAD",location.href,!0,"logout",(new Date).getTime().toString()),e.send(""),!0)}(window.XMLHttpRequest?new window.XMLHttpRequest:window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):null))?(c.printLine(u.get("logOut")),location.reload()):c.printLine(u.get("unLogOut"))},sql:function(){var e=o.MODE!==r.Terminal.prototype.MODE_SQL;return o.MODE=e?r.Terminal.prototype.MODE_SQL:r.Terminal.prototype.MODE_PROMPT,e?f.prompt(o.NAMESPACE+":SQL > "):(0,l.prompt)(o.NAMESPACE),!1},trace:function(e){var t,n;if(e.length<4)return c.print(u.get("tracingUsage")+"\r\n"),void((t=s.getList())&&c.print(u.get("traceSight",t)+"\r\n"));"stop"===e[3].value?i.send("StopTracing",{},function(){var e=0 %s",ru:"WebTerminal \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f... %s -> %s"},rSerUpd:{en:"Requesting server to update...",ru:"\u041f\u0440\u043e\u0441\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f..."},sUpdSt:{en:"Update started, please, \x1b[4mdo not close this window\x1b[0m.",ru:"\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \x1b[4m\u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u043e \u043e\u043a\u043d\u043e.\x1b[0m"},sUpdRURL:{en:"Requesting %s",ru:"\u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c %s"},sUpdGetOK:{en:"Response downloaded.",ru:"\u041e\u0442\u0432\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d."},sUpdSCode:{en:"Unable to update WebTerminal: HTTPS request ended with the code %s.",ru:"\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u0435\u0431-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b: HTTPS-\u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0441 \u043a\u043e\u0434\u043e\u043c %s."},sUpdWTF:{en:"Writing WebTerminal's new version a temporary file...",ru:"\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0432\u0435\u0431-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b..."},sUpdErr:{en:"Update \x1b[31mfailed\x1b[0m! Error: %s",ru:"\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \x1b[31m\u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c\x1b[0m! \u041e\u0448\u0438\u0431\u043a\u0430: %s"},sUpdRes:{en:"Update failed. Possibly, the new WebTerminal version is not compatible with your system anymore, or the update was not tested for this system. Please report this issue \x1b!URL=https://github.com/intersystems-community/webterminal/issues (here) and attach the update log. You can try waiting some time (finite or infinite) until this problem is identified and fixed.", + ru:"\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0432\u0435\u0431-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u0430 \u0441 \u0432\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0434\u043b\u044f \u043d\u0435\u0451. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 \x1b!URL=https://github.com/intersystems-community/webterminal/issues (\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443) \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0432 \u043b\u043e\u0433 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0438\u043b\u0438 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435), \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0430 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430."},sUpdBack:{en:"Backing up current version to %s...",ru:"\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u0443\u044e \u043a\u043e\u043f\u0438\u044e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 %s..."},sUpdRemLoad:{en:"Deleting old version and importing a new one...",ru:"\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0448\u043b\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u0443\u044e..."},sUpdNoFile:{en:"No file %s",ru:"\u041d\u0435\u0442 \u0444\u0430\u0439\u043b\u0430 %s"},sUpdCleanLog:{en:"Deleting log file %s...",ru:"\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u043b\u043e\u0433\u0430\u043c\u0438 %s..."},sUpdClean:{en:"Deleting temporary file %s...",ru:"\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b %s..."},sUpdDone:{en:"Update completed! Please, \x1b!URL=javascript:location.reload() (reload) the page.",ru:"\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e! \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \x1b!URL=javascript:location.reload() (\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u0435) \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443."},askEnSpec:{en:"Please, enter the special command. Try entering \x1b[(special)m/help\x1b[0m first.",ru:"\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u041d\u0430\u0447\u043d\u0438\u0442\u0435 \u0441 \u0432\u0432\u043e\u0434\u0430 \x1b[(special)m/help\x1b[0m, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440."},noSpecComm:{en:"There is no special command \x1b[(special)m/%s\x1b[0m. Please, enter \x1b[(special)m/help\x1b[0m to get a list of available commands.",ru:"\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \x1b[(special)m/%s\x1b[0m \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \x1b[(special)m/help\x1b[0m \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434."},help:{en:"\x1b[1mCach\xe9 WEB Terminal \x1b[(keyword)mv4.9.5\x1b[0m\n\r\n\r\x1b[4mAvailable commands:\x1b[0m\n\r\x1b[(special)m/help\x1b[0m\x1b[20GDisplay the short documentation (like you just did).\n\r\x1b[(special)m/clear\x1b[0m\x1b[20GClears the screen and all the history.\n\r\x1b[(special)m/config\x1b[0m ...\x1b[20GAllows you to configure WebTerminal's behavior. Enter this command to get more information.\n\r\x1b[(special)m/favorite\x1b[0m ...\x1b[20GAllows you to save or restore any frequently used commands. Enter this command to get more information.\n\r\x1b[(special)m/info\x1b[0m\x1b[20GShow the information about the WebTerminal project.\n\r\x1b[(special)m/logout\x1b[0m\x1b[20GLog out the current WebTerminal user and prompt for the authentication again.\n\r\x1b[(special)m/sql\x1b[0m\x1b[20GSwitches terminal to SQL mode. Type SQL commands instead of ObjectScript. To exit SQL mode, enter this command again.\n\r\x1b[(special)m/trace\x1b[0m ...\x1b[20GEnables global/file tracing. Type this command to get more information.\n\r\x1b[(special)m/update\x1b[0m\x1b[20GChecks for available updates.\n\r\n\r\x1b[4mKeys:\x1b[0m\n\r\x1b[(special)mCtrl + C\x1b[0m\x1b[20GInterrupt the command execution.\n\r\x1b[(special)mTAB\x1b[0m\x1b[20GComplete the input with proposed autocomplete variant.\n\r\x1b[(special)mRight/left CTRL\x1b[0m\x1b[20GSwitch autocomplete variant when multiple are available.\n\r\n\rPress \x1b!URL=http://intersystems-community.github.io/webterminal/#docs (here) to see the full documentation.",ru:"\x1b[1mCach\xe9 WEB Terminal \x1b[(keyword)mv4.9.5\x1b[0m\n\r\n\r\x1b[4m\u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:\x1b[0m\n\r\x1b[(special)m/help\x1b[0m\x1b[20G\u041e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e (\u043a\u0430\u043a \u0432\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438).\n\r\x1b[(special)m/clear\x1b[0m\x1b[20G\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u044d\u043a\u0440\u0430\u043d \u0438 \u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u044e.\n\r\x1b[(special)m/config\x1b[0m ...\x1b[20G\u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0435\u0431-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.\n\r\x1b[(special)m/favorite\x1b[0m ...\x1b[20G\u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.\n\r\x1b[(special)m/info\x1b[0m\x1b[20G\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0440\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u0435\u0431-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430.\n\r\x1b[(special)m/logout\x1b[0m\x1b[20G\u0412\u044b\u0439\u0442\u0438 \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u0435\u0430\u043d\u0441\u0430 \u0438 \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0439\u0442\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e.\n\r\x1b[(special)m/sql\x1b[0m\x1b[20G\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 \u0440\u0435\u0436\u0438\u043c SQL. \u0414\u0430\u043b\u0435\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u0435 SQL \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u043c\u0435\u0441\u0442\u043e ObjectScript. \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u0440\u0435\u0436\u0438\u043c\u0430 SQL, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0435\u0449\u0451 \u0440\u0430\u0437.\n\r\x1b[(special)m/trace\x1b[0m ...\x1b[20G\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443 \u0433\u043b\u043e\u0431\u0430\u043b\u0430/\u0444\u0430\u0439\u043b\u0430. \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.\n\r\x1b[(special)m/update\x1b[0m\x1b[20G\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439.\n\r\n\r\x1b[4m\u041a\u043b\u0430\u0432\u0438\u0448\u0438:\x1b[0m\n\r\x1b[(special)mCtrl + C\x1b[0m\x1b[20G\u041f\u0440\u0435\u0440\u0432\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b.\n\r\x1b[(special)mTAB\x1b[0m\x1b[20G\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0432\u0432\u043e\u0434 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c.\n\r\x1b[(special)m\u041f\u0440\u0430\u0432\u044b\u0439/\u043b\u0435\u0432\u044b\u0439 CTRL\x1b[0m\x1b[20G\u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0438\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e.\n\r\n\r\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \x1b!URL=http://intersystems-community.github.io/webterminal/#docs (\u0437\u0434\u0435\u0441\u044c) \u0447\u0442\u043e\u0431\u044b \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043b\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439."},info:{en:"Cach\xe9 WEB Terminal v4.9.5\n\rAuthor:\x1b[32G\x1b!URL=https://nikita.tk (Nikita Savchenko) (ZitRo)\n\rWebsite:\x1b[32G\x1b!URL=https://intersystems-community.github.io/webterminal (GitHub Pages)\n\rDocumentation:\x1b[32G\x1b!URL=http://intersystems-community.github.io/webterminal/#docs (GitHub Pages)\n\rRepository:\x1b[32G\x1b!URL=https://github.com/intersystems-community/webterminal (GitHub)\n\rBug/Feature Tracker:\x1b[32G\x1b!URL=https://github.com/intersystems-community/webterminal/issues (GitHub)\n\r2013-"+(new Date).getFullYear()+" \xa9 Nikita Savchenko",ru:"Cach\xe9 WEB Terminal v4.9.5\n\r\u0410\u0432\u0442\u043e\u0440:\x1b[32G\x1b!URL=https://nikita.tk (\u041d\u0438\u043a\u0438\u0442\u0430 \u0421\u0430\u0432\u0447\u0435\u043d\u043a\u043e) (ZitRo)\n\r\u0412\u0435\u0431\u0441\u0430\u0439\u0442:\x1b[32G\x1b!URL=https://intersystems-community.github.io/webterminal (\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430)\n\r\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f:\x1b[32G\x1b!URL=http://intersystems-community.github.io/webterminal/#docs (\u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430)\n\r\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439:\x1b[32G\x1b!URL=https://github.com/intersystems-community/webterminal (GitHub)\n\r\u0411\u0430\u0433/\u0424\u0438\u0447 \u0442\u0440\u0435\u043a\u0435\u0440:\x1b[32G\x1b!URL=https://github.com/intersystems-community/webterminal/issues (GitHub)\n\r2013-"+(new Date).getFullYear()+" \xa9 \u041d\u0438\u043a\u0438\u0442\u0430 \u0421\u0430\u0432\u0447\u0435\u043d\u043a\u043e"},beforeInit:{en:"Terminal load complete. Getting auth key...",ru:"\u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438..."},unSerRes:{en:"Unknown server response: %s",ru:"\u041d\u0435\u043e\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430: %s"},wsRefuse:{en:"Server refused WebSocket connection with the next message: %s",ru:"\u0421\u0435\u0440\u0432\u0435\u0440 \u043e\u0442\u043a\u043b\u043e\u043d\u0438\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 WebSocket \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c: %s"},wsReadErr:{en:"WebSocket read error",ru:"\u041e\u0448\u0438\u0431\u043a\u0430 WebSocket \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438"},wsParseErr:{en:"WebSocket message parse error",ru:"\u041e\u0448\u0431\u0438\u043a\u0430 \u0434\u0435\u0441\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 WebSocket-\u0444\u0440\u0435\u0439\u043c\u0430"},wsAbnormal:{en:"WebSocket abnormal exit occurred",ru:"\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043d\u0435\u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 WebSocket-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f"},availConfLoc:{en:"WebTerminal's local configuration (persists in the browser):", + ru:"\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u0435\u0431-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 (\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435):"},availConfGlob:{en:"WebTerminal's global configuration (persists on the server):",ru:"\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u0435\u0431-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 (\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435):"},confHintSet:{en:"To change any option, enter \x1b[(special)m/config\x1b[0m \x1b[(variable)mkey\x1b[0m = \x1b[(constant)mvalue\x1b[0m. Enter \x1b[(special)m/config\x1b[0m \x1b[(global)mdefault\x1b[0m to reset \x1b[4mlocal\x1b[0m configuration.",ru:"\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u043f\u0446\u0438\u044e, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \x1b[(special)m/config\x1b[0m \x1b[(variable)m\u043a\u043b\u044e\u0447\x1b[0m = \x1b[(constant)m\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\x1b[0m. \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \x1b[(special)m/config\x1b[0m \x1b[(global)mdefault\x1b[0m \u0447\u0442\u043e\u0431\u044b \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c \x1b[4m\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e\x1b[0m \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e."},confNoKey:{en:"No option \x1b[(variable)m%s\x1b[0m.",ru:"\u041d\u0435\u0442 \u043e\u043f\u0446\u0438\u0438 \x1b[(variable)m%s\x1b[0m."},confInvVal:{en:"Invalid value for \x1b[(variable)m%s\x1b[0m. Only the next values available: %s",ru:"\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \x1b[(variable)m%s\x1b[0m. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: %s"},firstLaunchMessage:{en:"Welcome to WebTerminal! Type \x1b[(special)m/help\x1b[0m special command to see how to use all the features.",ru:"\u0414\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u0432 \u0432\u0435\u0431-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b! \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \x1b[(special)m/help\x1b[0m \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u043e\u0431\u043e \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445."},badSQL:{en:"Mistake in SQL statement, %s",ru:"\u041e\u0448\u0438\u0431\u043a\u0430 \u0432 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0435, %s"},sqlErr:{en:"SQL Error, %s",ru:"SQL \u043e\u0448\u0438\u0431\u043a\u0430, %s"},sqlMaxRows:{en:"The maximum number of rows displayed is %s. Adjust the limit by typing /config sqlMaxResults = 100500 if you need more.",ru:"\u0412\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c %s \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432. \u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043b\u0438\u043c\u0438\u0442, \u043d\u0430\u0431\u0440\u0430\u0432 /config sqlMaxResults = 100500."},sqlNoData:{en:"Nothing to display",ru:"\u0422\u0443\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442"},tracingUsage:{en:"To watch for changes in file, enter \x1b[(special)m/trace\x1b[0m \x1b[(string)m/path/to/file\x1b[0m.\r\nFor changes in global dimentions use \x1b[(special)m/trace\x1b[0m \x1b[(global)m^globalName\x1b[0m.\r\nTo stop watching for changes, enter \x1b[(special)m/trace\x1b[0m \x1b[(global)mstop\x1b[0m.",ru:"\u0427\u0442\u043e\u0431\u044b \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \x1b[(special)m/trace\x1b[0m \x1b[(string)m/path/to/file\x1b[0m.\r\n\u0414\u043b\u044f \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0437\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u043c\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \x1b[(special)m/trace\x1b[0m \x1b[(global)m^globalName\x1b[0m.\r\n\u0427\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \x1b[(special)m/trace\x1b[0m \x1b[(global)mstop\x1b[0m."},traceStopOK:{en:"Tracing stopped.",ru:"\u0412\u0441\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b."},traceStopNotOK:{en:"Nothing is being traced.",ru:"\u041d\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439."},traceBad:{en:"Unable to trace %s.",ru:"\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c %s."},traceStart:{en:"Starting tracing %s.",ru:"\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 %s."},traceStop:{en:"Stopping tracing %s.",ru:"\u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 %s."},traceSight:{en:"Currently tracing %s.",ru:"\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0437\u0430 %s."},favDesc:{en:"To save the command, enter \x1b[(special)m/favorite\x1b[0m \x1b[(constant)mname\x1b[0m \x1b[(keyword)mdo\x1b[0m \x1b[(string)many ObjectScript code\x1b[0m.\r\nTo load the command, enter \x1b[(special)m/favorite\x1b[0m \x1b[(constant)mname\x1b[0m.\r\nTo delete saved commands, use \x1b[(special)m/favorite\x1b[0m \x1b[(wrong)mdelete\x1b[0m \x1b[(constant)mname\x1b[0m.\r\nTo delete all saved commands, use just \x1b[(special)m/favorite\x1b[0m \x1b[(wrong)mdelete\x1b[0m.",ru:"\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \x1b[(special)m/favorite\x1b[0m \x1b[(constant)m\u0438\u043c\u044f\x1b[0m \x1b[(keyword)mdo\x1b[0m \x1b[(string)m\u043b\u044e\u0431\u043e\u0439 ObjectScript \u043a\u043e\u0434\x1b[0m.\r\n\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \x1b[(special)m/favorite\x1b[0m \x1b[(constant)m\u0438\u043c\u044f\x1b[0m.\r\n\u0427\u0442\u043e\u0431\u044b \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \x1b[(special)m/favorite\x1b[0m \x1b[(wrong)mdelete\x1b[0m \x1b[(constant)m\u0438\u043c\u044f\x1b[0m.\r\n\u0427\u0442\u043e\u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \x1b[(special)m/favorite\x1b[0m \x1b[(wrong)mdelete\x1b[0m."},favs:{en:"Saved commands:",ru:"\u0421\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:"},favSet:{en:"Command \x1b[(constant)m%s\x1b[0m saved.",ru:"\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \x1b[(constant)m%s\x1b[0m \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430."},favDelOK:{en:"Command \x1b[(constant)m%s\x1b[0m deleted.",ru:"\u041a\u043e\u043c\u043c\u0430\u043d\u0434\u0430 \x1b[(constant)m%s\x1b[0m \u0443\u0434\u0430\u043b\u0435\u043d\u0430."},favDelNotOK:{en:"No \x1b[(constant)m%s\x1b[0m command.",ru:"\u041a\u043e\u043c\u043c\u0430\u043d\u0434\u0430 \x1b[(constant)m%s\x1b[0m \u043d\u0435 \u0431\u044b\u043b\u0430 \u0437\u0430\u0434\u0430\u043d\u0430."},favDel:{en:"All commands are deleted.",ru:"\u0412\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u0434\u0430\u043b\u0435\u043d\u044b."},favKey:{en:"Name",ru:"\u0418\u043c\u044f"},favVal:{en:"Value",ru:"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435"},noFav:{en:"Command \x1b[(constant)m%s\x1b[0m has never been saved.",ru:"\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \x1b[(constant)m%s\x1b[0m \u043d\u0435 \u0431\u044b\u043b\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0440\u0430\u043d\u0435\u0435."},jsErr:{en:"JavaScript error occurred: %s",ru:"\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 JavaScript: %s"},wsNormalClose:{en:"Session ended.",ru:"\u0421\u0435\u0441\u0441\u0438\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u0430."},logOut:{en:"Logging out...",ru:"\u0412\u044b\u0445\u043e\u0434\u0438\u043c..."},unLogOut:{en:"Your browser is too old or too weird to support log out functionality. Please, restart the browser manually.",ru:"\u0412\u0430\u0448 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0438\u043b\u0438 \u0441\u0442\u0430\u0440\u044b\u0439, \u0438 \u043e\u043d \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0445\u043e\u0434\u0430. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0432\u0440\u0443\u0447\u043d\u0443\u044e."},unNS:{en:"Unable to change namespace to %s.",ru:"\u041d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043d\u0430 %s."},cpTerm:{en:"Terminal process was terminated.",ru:"\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0431\u044b\u043b \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d."}}},{}],349:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.LOCALES=void 0,n.getLocales=f,n.suggestLocale=d,n.getLocale=function(){var e=r.get(s);i.length||(n.LOCALES=i=f());e&&-1!==i.indexOf(e)||(e=navigator.language,-1===i.indexOf(e)&&(e=l));return e},n.setLocale=function(e){return-1!==i.indexOf(e)?(c=e,r.set(s,e),!0):((0,o.printLine)(v("noLocale",e)),!1)},n.get=v,n.parse=function r(e){for(var t=arguments.length,o=Array(1r[o])return 1;if(n[o]+r[o])return 1;if(+n[o]<+r[o])return}return r.length>n.length}u.get("updateCheck")&&c()},{"../config":337,"../index":340,"../input":345,"../lib":347,"../localization":349,"../output":356,"./update":351}],351:[function(e,t,n){"use strict";var r=l(e("../index")),o=l(e("../output")),a=l(e("../input")),i=l(e("../localization")),s=l(e("../server"));function l(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var u=!1;window.updateTerminal=function(e,t){u||(t=t.replace(/^http:/,"https:"),u=!0,a.hideInput(),o.printLine(i.get( + "updStart",r.VERSION,e)),o.printLine("URL: "+t),o.printLine(i.get("rSerUpd")),s.send("Update",t))}},{"../index":340,"../input":345,"../localization":349,"../output":356,"../server":360}],352:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.LINE_CLASS_NAME=void 0,n.Line=o;var i=e("./index"),r=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}}(e("../elements"));n.LINE_CLASS_NAME="line";function o(e){this._lineElement=document.createElement("div"),this._lineElement.className="line",this.text="",this.INDEX=e,this.HTML_LINE=!1,this.HTMLRendered=!1,this.graphicProperties=[],this.setIndex(e),this._lineElement.style.height=i.SYMBOL_HEIGHT+"px",r.output.appendChild(this._lineElement)}function a(e,t){for(var n=["g"],r=[],o="span",a=[],i=0;i{![^]*(?=<\\/HTML>)}":function(e){var e=r(e,1)[0],t=o.getCurrentLine(),e=(t.setHTML(e),t.INDEX+Math.ceil(t.getHeight()/o.SYMBOL_HEIGHT));o.getLineByIndex(e),o.setCursorYToLineIndex(e),o.setCursorX(1)}};n.default=f},{"../input/caret":342,"../server":360,"./const":353,"./index":356}],355:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ESC_CHARS_MASK=void 0,n.applyEscapeSequence=a;var e=e("./esc"),r=(e=e)&&e.__esModule?e:{default:e};var o,l={};for(o in r.default)!function(e,t){for(var n=0e[2]&&(a=a.slice(0,e[2])),l=e[3],c=e[4],!y&&_.length>e[5]&&(_=_.slice(0,e[5]))}()&&(u=p=0,d=!1,o[c]&&("string"==typeof o[c].value&&(l+=o[c].value.length),h<=c&&(o[c].class="error"),c++),a=[],i=[],w=o[c]?o[c].value.length:1,!y&&l<=t&&t",class:"special"}},244],[{type:5,value:{value:"&",class:"special"}},245],[{type:5,value:{value:"|",class:"special"}},246],[{type:5,value:{value:"[",class:"special"}},247],[{type:5,value:{value:"]",class:"special"}},247],[{type:5,value:{value:"#",class:"special"}},247],[null,0]],[[{type:5,value:{value:"=",class:"special"}},247],[{type:5,value:{value:">",class:"special"}},247],[{type:5,value:{value:"<",class:"special"}},247]],[[{type:5,value:{value:"=",class:"special"}},247],[null,247]],[[{type:5,value:{value:"&",class:"special"}},247],[null,247]],[[{type:5,value:{value:"|",class:"special"}},247]],[[{type:1},37,0],[null,37,0]],[[{type:2,value:{class:"variable",type:"variable"}},250],[{type:5,value:{value:"%",class:"variable",type:"variable"}},249]],[[{type:2,value:{class:"variable",type:"variable"}},250]],[[{type:5,value:{value:"("}},251],[null,255]],[[{type:1},252,253],[null,252,253]],[[{type:5,value:{value:".",class:"argument"}},294],[{type:5,value:{value:","}},295],[null,37,296]],[[{type:1},254],[null,254]],[[{type:5,value:{value:")"}},255]],[[{type:5,value:{value:".",type:"*"}},256,255],[null,0]],[[{type:5,value:{value:"%",type:"member"}},263],[{type:5,value:{value:"#",type:"member"}},263],[null,263]],[[{type:2,value:{class:"global",type:"global"}},258]],[[{type:5,value:{value:".",class:"global",type:"global"}},257],[null,259]],[[{type:5,value:{value:"("}},260],[null,0]],[[{type:1},202,261],[null,202,261]],[[{type:1},262],[null,262]],[[{type:5,value:{value:")"}},0]],[[{type:2,value:{type:"member"}},264]],[[{type:5,value:{value:"("}},265],[null,0]],[[{type:1},202,266],[null,202,266]],[[{type:1},267],[null,267]],[[{type:5,value:{value:")"}},0]],[[{type:5,value:{value:"#",class:"special"}},269]],[[{type:2,value:{CI:!0,value:"class",class:"special"}},270],[{type:2,value:{CI:!0,value:"super",class:"special"}},276]],[[{type:5,value:{value:"(",class:"special"}},271]],[[{type:5,value:{value:"%",type:"classname",class:"classname"}},272],[null,272]],[[{type:2,value:{type:"classname",class:"classname"}},273]],[[{type:5,value:{value:".",type:"classname",class:"classname"}},272],[{type:5,value:{value:")",class:"special",type:"*"}},274]],[[{type:5,value:{value:".",type:"*"}},275,0]],[[{type:5,value:{value:"#",type:"parameter",class:"keyword"}},282],[{type:5,value:{value:"%",type:"publicClassMember",class:"keyword"}},283],[null,283]],[[{type:5,value:{value:"(",class:"special"}},202,277]],[[{type:5,value:{value:")",class:"special"}},0]],[[{type:2,value:{CI:!0,value:"system",class:"special"}},279]],[[{type:5,value:{value:".",type:"classname",class:"classname"}},280]],[[{type:2,value:{type:"classname",class:"classname"}},281]],[[{type:5,value:{value:".",type:"*"}},275,0]],[[{type:2,value:{type:"parameter",class:"keyword"}},0]],[[{type:2,value:{type:"publicClassMember",class:"keyword"}},284]],[[{type:5,value:{value:"("}},285]],[[{type:1},202,286],[null,202,286]],[[{type:1},287],[null,287]],[[{type:5,value:{value:")"}},0]],[[{type:2,value:{CI:!0,class:"keyword",value:"ascii"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"bit"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"bitcount"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"bitfind"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"bitlogic"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"char"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"classmethod"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"classname"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"compile"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"data"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"decimal"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"double"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"extract"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"factor"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"find"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"fnumber"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"get"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"increment"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"inumber"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"isobject"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"isvaliddouble"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"isvalidnum"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"justify"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"length"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"lb"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listbuild"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listdata"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listfind"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listfromstring"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listget"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listlength"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listnext"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listsame"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listtostring"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listupdate"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"listvalid"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"list"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"locate"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"match"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"method"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"name"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"nconvert"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"next"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"normalize"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"now"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"number"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"order"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"parameter"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"piece"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"prefetchoff"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"prefetchon"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"property"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"qlength"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"qsubscript"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"query"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"random"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"replace"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"reverse"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"sconvert"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"sequence"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"sortbegin"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"sortend"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"stack"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"text"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"translate"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"view"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"wascii"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"wchar"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"wextract"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"wfind"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"wiswide"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"wlength"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"wreverse"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"xecute"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"xecute"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zabs"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zarccos"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zarcsin"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zarctan"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zcos"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zcot"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zcsc"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zdate"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zdateh"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zdatetime"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zdatetimeh"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zexp"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zhex"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zln"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zlog"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zpower"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zsec"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zsin"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"zsqr"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"ztan"}}, + 290],[{type:2,value:{CI:!0,class:"keyword",value:"ztime"}},290],[{type:2,value:{CI:!0,class:"keyword",value:"ztimeh"}},290],[{type:2,value:{CI:!0,class:"keyword"}},290],[{type:5,value:{value:"$",class:"keyword"}},289],[null,290]],[[{type:2,value:{class:"keyword"}},290]],[[{type:5,value:{value:"("}},291],[null,0]],[[{type:1},202,292],[null,202,292]],[[{type:1},293],[null,293]],[[{type:5,value:{value:")"}},0]],[[{type:2,value:{class:"argument"}},296]],[[{type:1},252],[null,252]],[[{type:5,value:{value:","}},297],[null,0]],[[{type:1},252],[null,252]],[[{type:5,value:{value:"/",class:"special"}},2,0],[{type:2,value:{CI:!0,value:"delete",class:"keyword"}},299],[{type:2,value:{CI:!0,value:"update",class:"keyword"}},301],[{type:2,value:{CI:!0,value:"select",class:"keyword"}},303],[{type:2,value:{CI:!0,value:"call",class:"keyword"}},305]],[[{type:1},300,0]],[[null,338,374]],[[{type:1},302,0]],[[null,316,360]],[[{type:1},304,0]],[[{type:2,value:{CI:!0,value:"top",class:"keyword"}},323],[null,326]],[[{type:1},306,0]],[[null,316,317]],[[{type:2,value:{class:"variable",type:"sqlFieldName"}},308]],[[{type:5,value:{value:"."}},309],[null,310]],[[{type:2,value:{class:"variable",type:"sqlFieldName"}},310]],[[{type:1},311],[null,311]],[[{type:5,value:{value:"-"}},312],[null,0]],[[{type:5,value:{value:">"}},313]],[[{type:1},314],[null,314]],[[{type:2,value:{class:"variable",type:"sqlFieldName"}},315]],[[{type:1},311],[null,311]],[[{type:5,value:{value:"%",type:"sqlClassname",class:"classname"}},378],[null,378]],[[{type:5,value:{value:"_",type:"sqlClassname",class:"classname"}},317],[{type:2,value:{CI:!0,type:"sqlClassname",class:"classname"}},317],[null,318]],[[{type:5,value:{value:"("}},319]],[[{type:1},320,321],[null,320,321]],[[{type:5,value:{value:"("}},383],[{type:4},387],[{type:5,value:{value:"'",class:"string"}},386],[null,387]],[[{type:1},322],[null,322]],[[{type:5,value:{value:")"}},0]],[[{type:1},324]],[[{type:4},325]],[[{type:1},326]],[[{type:5,value:{value:"*",class:"special"}},337],[{type:2,value:{CI:!0,value:"avg",class:"keyword"}},327],[{type:2,value:{CI:!0,value:"count",class:"keyword"}},327],[{type:2,value:{CI:!0,value:"max",class:"keyword"}},327],[{type:2,value:{CI:!0,value:"min",class:"keyword"}},327],[null,307,331]],[[{type:5,value:{value:"("}},328]],[[{type:1},307,329],[null,307,329]],[[{type:1},330],[null,330]],[[{type:5,value:{value:")"}},337]],[[{type:2,value:{CI:!0,value:"as",class:"keyword"}},332],[null,335]],[[{type:1},333]],[[{type:2,value:{class:"variable"}},334]],[[{type:1},335],[null,335]],[[{type:5,value:{value:","}},336],[null,337]],[[{type:1},326],[null,326]],[[{type:1},338,339]],[[{type:2,value:{CI:!0,value:"from",class:"keyword"}},377]],[[{type:1},340],[null,340]],[[{type:2,value:{CI:!0,value:"order",class:"keyword"}},341,0],[{type:2,value:{CI:!0,value:"where",class:"keyword"}},342],[{type:2,value:{class:"variable"}},346],[null,0]],[[{type:1},351]],[[{type:1},343,344]],[[{type:4},409],[{type:2,value:{CI:!0,value:"null",class:"constant"}},409],[{type:5,value:{value:"("}},390],[{type:2,value:{CI:!0,value:"not",class:"keyword"}},400],[{type:5,value:{value:"'",class:"string"}},401],[{type:2,value:{CI:!0,value:"char",class:"keyword",type:"sqlFunc"}},402],[{type:2,value:{CI:!0,value:"ascii",class:"keyword",type:"sqlFunc"}},402],[{type:2,value:{class:"variable",type:"sqlFieldName"}},406]],[[{type:1},345],[null,345]],[[{type:2,value:{CI:!0,value:"order",class:"keyword"}},341,0],[null,0]],[[{type:1},347]],[[{type:2,value:{CI:!0,value:"order",class:"keyword"}},341,0],[{type:2,value:{CI:!0,value:"where",class:"keyword"}},348],[null,0]],[[{type:1},343,349]],[[{type:1},350],[null,350]],[[{type:2,value:{CI:!0,value:"order",class:"keyword"}},341,0],[null,0]],[[{type:2,value:{CI:!0,value:"by",class:"keyword"}},352]],[[{type:1},353]],[[{type:2,value:{class:"variable",type:"sqlFieldName"}},354]],[[{type:1},355],[null,355]],[[{type:2,value:{CI:!0,value:"desc",class:"keyword"}},356],[{type:2,value:{CI:!0,value:"asc",class:"keyword"}},357],[null,358]],[[{type:1},358],[null,358]],[[{type:1},358],[null,358]],[[{type:5,value:{value:","}},359],[null,0]],[[{type:1},353],[null,353]],[[{type:1},361]],[[{type:2,value:{CI:!0,value:"set",class:"keyword"}},364],[{type:2,value:{class:"variable"}},362]],[[{type:1},363]],[[{type:2,value:{CI:!0,value:"set",class:"keyword"}},364]],[[{type:1},365]],[[{type:2,value:{type:"sqlFieldName",class:"variable"}},366]],[[{type:1},367],[null,367]],[[{type:5,value:{value:"="}},368]],[[{type:1},343,369],[null,343,369]],[[{type:1},370],[null,370]],[[{type:5,value:{value:","}},371],[null,372]],[[{type:1},365],[null,365]],[[{type:2,value:{CI:!0,value:"where",class:"keyword"}},373]],[[{type:1},343,0]],[[{type:1},375]],[[{type:2,value:{CI:!0,value:"where",class:"keyword"}},376]],[[{type:1},343,0]],[[{type:1},316,0]],[[{type:2,value:{type:"sqlClassname",class:"classname"}},379]],[[{type:5,value:{value:"_",type:"sqlClassname",class:"classname"}},378],[{type:5,value:{value:".",type:"sqlClassname",class:"classname"}},380]],[[{type:2,value:{CI:!0,type:"sqlClassname",class:"classname"}},381]],[[{type:5,value:{value:"_",type:"sqlClassname",class:"classname"}},382],[null,0]],[[{type:2,value:{CI:!0,type:"sqlClassname",class:"classname"}},0]],[[{type:1},320,384],[null,320,384]],[[{type:1},385],[null,385]],[[{type:5,value:{value:")"}},387]],[[{type:5,value:{value:"'",class:"string"}},387],[{type:4,value:{class:"string"}},386],[{type:2,value:{class:"string"}},386],[{type:3,value:{class:"string"}},386],[{type:5,value:{class:"string"}},386],[{type:1},386]],[[{type:1},388],[null,388]],[[{type:5,value:{value:","}},389],[null,0]],[[{type:1},320],[null,320]],[[{type:1},391],[null,391]],[[{type:2,value:{CI:!0,value:"delete",class:"keyword"}},392],[{type:2,value:{CI:!0,value:"update",class:"keyword"}},394],[{type:2,value:{CI:!0,value:"select",class:"keyword"}},396],[null,343,398]],[[{type:1},300,393]],[[{type:1},399],[null,399]],[[{type:1},302,395]],[[{type:1},399],[null,399]],[[{type:1},304,397]],[[{type:1},399],[null,399]],[[{type:1},399],[null,399]],[[{type:5,value:{value:")"}},409]],[[{type:1},343,409],[null,343,409]],[[{type:5,value:{value:"'",class:"string"}},409],[{type:4,value:{class:"string"}},401],[{type:2,value:{class:"string"}},401],[{type:3,value:{class:"string"}},401],[{type:5,value:{class:"string"}},401],[{type:1},401]],[[{type:5,value:{value:"("}},403]],[[{type:1},343,404],[null,343,404]],[[{type:1},405],[null,405]],[[{type:5,value:{value:")"}},409]],[[{type:5,value:{value:"_",class:"variable",type:"sqlFieldName"}},407],[{type:5,value:{value:".",class:"variable",type:"sqlFieldName"}},408],[null,409]],[[{type:2,value:{class:"variable",type:"sqlFieldName"}},409]],[[{type:2,value:{class:"variable",type:"sqlFieldName"}},406]],[[{type:1},410],[null,410]],[[{type:5,value:{value:"+"}},412],[{type:5,value:{value:"-"}},412],[{type:5,value:{value:"*"}},412],[{type:5,value:{value:"/"}},412],[{type:5,value:{value:"="}},412],[{type:5,value:"<"},411],[{type:5,value:">"},411],[{type:2,value:{CI:!0,value:"and",class:"keyword"}},412],[{type:2,value:{CI:!0,value:"like",class:"keyword"}},412],[{type:2,value:{CI:!0,value:"or",class:"keyword"}},412],[{type:2,value:{CI:!0,value:"is",class:"keyword"}},412],[null,0]],[[{type:5,value:{value:"="}},412],[null,412]],[[{type:1},343,0],[null,343,0]]]),T=e({CWTInput:1,CWTSpecial:2,OSCommand:4,globalBody:20,postCondition:22,doArgument:31,expression:37,termSpecial:38,variable:50,deviceParameters:58,setExpression:75,variableListExpression:100,argumentList:202,class:206,jsonValue:207,jsonObjectBody:213,jsonArrayBody:218,function:240,nonEmptyArgumentList:252,member:256,classStatic:275,SQLMode:298,SQLDelete:300,SQLUpdate:302,SQLSelect:304,SQLCall:306,SQLVar:307,SQLClassName:316,SQLCallArgList:320,SQLFrom:338,SQLOrder:341,SQLExpression:343})}.call(this)}.call(this,t("_process"))},{"../autocomplete":335,"./pushdownAutomaton":358,_process:331}],358:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I=(n.getAutomaton=function(){return{automaton:function(e){var t,n=e.slice();for(t in n)if(n[t])for(var r in n[t]=n[t].slice(),n[t])n[t][r]=n[t][r].slice();n[0]=[[!1,0]];for(var o=1;oo&&--n[a][i][1],parseInt(n[a][i][2])>o&&--n[a][i][2];if(!l)for(var s in u)u[s]>o&&--u[s];n.splice(o,1),o--}return l=!0,n}(o),ruleMappings:u}},n.rule=function(e){var t=new i;return t.ruleName=e,t},n.TYPE_WHITESPACE=1),C=n.TYPE_ID=2,O=n.TYPE_STRING=3,P=n.TYPE_CONSTANT=4,L=n.TYPE_CHAR=5,M=n.TYPE_EXIT=6,T=n.TYPE_MERGE=7,R=n.TYPE_ANY=8,N=n.TYPE_CALL=9,D=n.TYPE_BRANCH=10,F=n.TYPE_OPT_WHITESPACE=11,H=n.TYPE_TRY_CALL=12,G=n.TYPE_ALL=13,U=n.TYPE_NONE=14,W=n.TYPE_SPLIT=15,o=[],l=!1,u={};function a(e){return e instanceof i?e:new i(!0)}function i(e){this.built=e||!1,this.ruleName="",this.chain=[]}function s(n){return function(e){var t=a(this);return t.chain.push({type:n,value:n!==L&&n!==C||"object"===(void 0===e?"undefined":r(e))?e:void 0===e?{}:{value:e}}),t}}n.branch=i.prototype.branch=s(D),n.call=i.prototype.call=s(N),n.char=i.prototype.char=s(L),n.string=i.prototype.string=s(O),n.id=i.prototype.id=s(C),n.any=i.prototype.any=s(R),n.all=i.prototype.all=s(G),n.none=i.prototype.none=s(U),n.whitespace=i.prototype.whitespace=s(I),n.optWhitespace=i.prototype.optWhitespace=s(F),n.constant=i.prototype.constant=s(P),n.tryCall=s(H),i.prototype.end=function(){this.built||this.buildTable()},n.merge=i.prototype.merge=function(){var e=a(this);return e.chain.push({type:T}),e.built||e.buildTable(),e},n.exit=i.prototype.exit=function(){var e=a(this);return e.chain.push({type:M}),e.built||e.buildTable(),e},n.split=i.prototype.split=function(){for(var e=a(this),t=[],n=0;n ",{},function(e){o.send("Execute",e)})},n.promptCallback=function(e){a.promptCallback(e)},n.execError=function(){var e=0)/,"\x1b[31m$1\x1b[0m"),t=e.replace(/z\w+\+[0-9]+\^WebTerminal\.\w+\.[0-9]+/,"");return{string:t,internal:t.length!==e.length}}},{"../analytics":333,"../config":337,"../index":340,"../input":345,"../localization":349,"../output":356,"./index":360}],360:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.connect=_,n.send=j;var r=e("../output"),o=e("../localization"),a=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}}(e("./handlers"));var i="WebTerminal.Engine.cls",s=1e4,l=!1,u=void 0,c=[],f=0,p=void 0,d=1,v={},y={};function _(e){clearTimeout(f),f=0,u=new WebSocket(("https:"===location.protocol?"wss:":"ws:" + )+"//"+location.hostname+":"+(location.port||("https:"===location.protocol?"443":"80"))+(location.pathname.includes("/terminal")?location.pathname.replace(/\/terminal.*/,"/terminalsocket"):"/terminalsocket")+"/"+encodeURIComponent(i)),e&&(y=e),u.addEventListener("open",h),u.addEventListener("close",b),u.addEventListener("error",m),u.addEventListener("message",function(t){if("o"===t.data[0])x({h:"o",d:t.data.slice(1)});else{var e=void 0;try{e=JSON.parse(t.data)}catch(e){return void(0,r.printLine)((0,o.get)("serParseErr",t.data))}x(e)}})}function h(){l=!0,j("Auth",y),w()}function m(e){(0,r.printLine)((0,o.get)("wsErr",e.data||e))}function g(){(0,r.printLine)((0,o.get)("plRefPageSes")),c.unshift(p),_()}function b(e){l=!1,1e3!==e.code&&1005!==e.code?((0,r.printLine)("\r\n"+(0,o.get)("wsConnLost",e.code,e.reason?" "+e.reason:"")),(0,r.printLine)((0,o.get)("reConn",s/1e3)),f=setTimeout(g,s)):(0,r.printLine)((0,o.get)("seeYou"))}function x(e){e=0 + +} + +} + diff --git a/build/cls/WebTerminal/Trace.cls b/build/cls/WebTerminal/Trace.cls new file mode 100644 index 0000000..e4738c9 --- /dev/null +++ b/build/cls/WebTerminal/Trace.cls @@ -0,0 +1,145 @@ +Class WebTerminal.Trace Extends Common +{ + +/// Property is used to store watching files/globals. +Property Watches As %List; + +/// Watch position in file or global +Property WatchesCaret As %Numeric [ MultiDimensional ]; + +/// Checks for correct watch source and sets watch target to ..Watches +/// Returns status of this operation +Method Trace(name) As %Status +{ + set s = $CHAR(0) + set watches = s _ $LISTTOSTRING(..Watches, s) _ s + if ($FIND(watches, s_name_s) '= 0) return 0 // if watch already defined + + if ($EXTRACT(name,1,1) = "^") { // watching global + set g = 0 + try { + if (($data(@name)) '= 0) set g = 1 + } catch { } + set $ZERROR = "" + if (g = 1) { + set ..Watches = ..Watches _ $LISTBUILD(name) + set ..WatchesCaret(name, 0) = $QUERY(@name@(""), -1) // last + set ..WatchesCaret(name, 1) = "?" + return 1 + } + } else { // watch file + if (##class(%File).Exists(name)) { + set ..Watches = ..Watches _ $LISTBUILD(name) + set file = ##class(%File).%New(name) + set ..WatchesCaret(name,0) = file.Size // current watch cursor position + set ..WatchesCaret(name,1) = file.DateModified + return 1 + } + } + + return 0 +} + +/// Removes watch from watches list +/// Returns success status +Method StopTracing(name) As %Status +{ + set s = $CHAR(0) + set watches = s _ $LISTTOSTRING(..Watches,s) _ s + set newWatches = $REPLACE(watches, s_name_s, s) + set ..Watches = $LISTFROMSTRING($EXTRACT(newWatches, 2, *-1), s) + if (watches '= newWatches) { + kill ..WatchesCaret(name) + } + return watches '= newWatches +} + +/// Returns a list current watches +Method ListWatches() As %String +{ + set no = 0 + set s = "Watching: " _ $CHAR(10) + while $LISTNEXT(..Watches, no, value) { + set s = s_"(pos: "_..WatchesCaret(value,0)_ + "; mod: "_..WatchesCaret(value,1)_") "_value_$CHAR(10) + } + return s +} + +/// Return null string if global hadn't been updated +/// This method watches only for tail of global and detects if global still alive +Method GetTraceGlobalModified(watch) As %List +{ + set data = "" + if ($data(@watch)=0) { + do ..StopTracing(watch) + return $lb($C(27)_"[(wrong)m[D]"_$C(27)_"[0m", $C(13, 10)) + } + for { + set query = $QUERY(@..WatchesCaret(watch,0)) + quit:query="" + set ..WatchesCaret(watch,0) = query + set data = data _ $case(data = "", 1: "", :$CHAR(13, 10)) _ @query + } + return $lb($C(27)_"[(special)m[M]"_$C(27)_"[0m", data) +} + +Method GetTraceFileModified(watch) As %String +{ + set file=##class(%File).%New(watch) + set size = file.Size + set modDate = file.DateModified + set output = "" + if (size < 0) { // file had been deleted + do ..StopTracing(watch) + return $lb($C(27)_"[(wrong)m[D]"_$C(27)_"[0m", $C(13, 10)) + } + + if (size > ..WatchesCaret(watch, 0)) { + + set stream = ##class(%Stream.FileCharacter).%New() + set sc = stream.LinkToFile(watch) + do stream.MoveTo(..WatchesCaret(watch, 0) + 1) + set read = stream.Read(size - ..WatchesCaret(watch, 0)) + set output = output _ read + set ..WatchesCaret(watch, 0) = size + set ..WatchesCaret(watch, 1) = file.DateModified + return $lb($C(27)_"[(constant)m[A]"_$C(27)_"[0m", output) + + } elseif ((size < ..WatchesCaret(watch, 0)) || (file.DateModified '= ..WatchesCaret(watch, 1))) { + + set output = output _ "Size change: " _ (size - ..WatchesCaret(watch, 0)) + set ..WatchesCaret(watch, 0) = size + set ..WatchesCaret(watch, 1) = file.DateModified + return $lb($C(27)_"[(special)m[M]"_$C(27)_"[0m", output) + + } // else file not changed + + return $lb("", "") +} + +Method CheckTracing() As %String +{ + set no = 0 + set data = "" + set overall = "" + set watchList = ..Watches // do not remove or simplify: ..Watches can be modified + while $LISTNEXT(watchList, no, value) { + set global = $EXTRACT(value, 1, 1) = "^" + if global { + set data = ..GetTraceGlobalModified(value) + } else { + set data = ..GetTraceFileModified(value) + } + if ($LISTGET(data, 2) '= "") { + set overall = $LISTGET(data, 1) _ " " _ $C(27) _ "[2m" _ $ZDATETIME($NOW(),1,1) + _ $C(27) _ "[0m " _ $C(27) _ "[(" _ $case(global, 1: "global", :"string") _ ")m" + _ value _ $C(27) _ "[0m" _ $CHAR(13, 10) _ $LISTGET(data, 2) _ $CHAR(13, 10) + } + set data = "" + } + return overall +} + +} + diff --git a/build/cls/WebTerminal/Updater.cls b/build/cls/WebTerminal/Updater.cls new file mode 100644 index 0000000..925037a --- /dev/null +++ b/build/cls/WebTerminal/Updater.cls @@ -0,0 +1,136 @@ +/// Web Terminal version 4.9.5 update module class. +/// This class represents update mechanism for WebTerminal. Internet connection is required to +/// update WebTerminal. +Class WebTerminal.Updater +{ + +/// SSL configuration name used for HTTPS requests. +Parameter SSLConfigName = "WebTerminalSSL"; + +ClassMethod GetSSLConfigurationName() As %String +{ + new $namespace + zn "%SYS" + if ('##class(Security.SSLConfigs).Exists(..#SSLConfigName)) { + set st = ##class(Security.SSLConfigs).Create(..#SSLConfigName) + return:(st '= 1) "UnableToCreateSSLConfig:"_$System.Status.GetErrorText(st) + } + return ..#SSLConfigName +} + +ClassMethod WriteAndDelete(client As WebTerminal.Engine, file As %String) As %Status +{ + if ##class(%File).Exists(file) { + set stream = ##class(%Stream.FileCharacter).%New() + set sc = stream.LinkToFile(file) + while 'stream.AtEnd { + do client.Send("o", stream.Read()_$CHAR(13, 10)) + } + do client.Send("oLocalized", "%sUpdCleanLog("_file_")"_$CHAR(13, 10)) + do ##class(%File).Delete(file) + } else { + do client.Send("oLocalized", "%sUpdNoFile") + } + return $$$OK +} + +ClassMethod Stop(client As WebTerminal.Engine, status As %Status) As %Status +{ + if ($$$ISERR(status)) { + do client.Send("oLocalized", "%sUpdErr("_$System.Status.GetErrorText(status)_")"_$C(13, 10)) + } + return status +} + +ClassMethod Update(client As WebTerminal.Engine, URL As %String) As %Status +{ + do client.Send("oLocalized", "%sUpdSt"_$CHAR(13, 10)) + set request = ##class(%Net.HttpRequest).%New() + set request.Server = $PIECE(URL, "/", 3) + set request.Location = $PIECE(URL, "/", 4, *) + set request.Https = 1 + set request.SSLConfiguration = ..GetSSLConfigurationName() + do client.Send("oLocalized", "%sUpdRURL(https://"_request.Server_"/"_request.Location_")"_$CHAR(13, 10)) + set status = request.Get() + do client.Send("oLocalized", "%sUpdGetOK"_$CHAR(13, 10)) + return:(status '= $$$OK) status + + if (request.HttpResponse.StatusCode '= 200) { + do client.Send("oLocalized", "%sUpdSCode("_request.HttpResponse.StatusCode_")"_$CHAR(13, 10)) + return $$$ERROR($$$GeneralError, "HTTP "_request.HttpResponse.StatusCode) + } + + do client.Send("oLocalized", "%sUpdWTF"_$CHAR(13, 10)) + set tempFile = ##class(%File).TempFilename("xml") + set file = ##class(%File).%New(tempFile) + do file.Open("NW") + set data = request.HttpResponse.Data + if (($IsObject(data)) && (data.%IsA("%Stream.Object"))) { + while 'data.AtEnd { + set chunk = data.Read(data.Size) + do file.Write(chunk) + } + } else { + do file.Write(data) + } + do file.Close() + + set backupFile = ##class(%File).TempFilename("xml") + do client.Send("oLocalized", "%sUpdBack("_backupFile_")"_$CHAR(13, 10)) + + set logFile = ##class(%File).TempFilename("txt") + set io = $IO + + open logFile:("NW") + use logFile + set exportStatus = $System.OBJ.Export("WebTerminal.*.CLS", backupFile) + close logFile + use io + + do ..WriteAndDelete(client, logFile) + if ($$$ISERR(exportStatus)) { + do ##class(WebTerminal.Analytics).ReportInstallStatus(exportStatus, "Update") + return ..Stop(client, exportStatus) + } + do client.Send("oLocalized", "%sUpdRemLoad"_$CHAR(13, 10)) + + open logFile:("NW") + use logFile + write $C(27)_"[2m" + do $System.OBJ.DeletePackage("WebTerminal") + write $C(27)_"[0m", ! + set loadStatus = $SYSTEM.OBJ.Load(tempFile, "c") + + // At this moment WebTerminal's code can be broken, totally changed or deleted. Do not call + // WebTerminal's methods until terminal is restored / fully updated + + if '$$$ISOK(loadStatus) { // roll back + write !, $C(27)_"[(wrong)m==FAILED=="_$C(27)_"[0m", !, + $System.Status.GetErrorText(loadStatus), !, !, + $C(27)_"[(special)m==RESTORING=="_$C(27)_"[0m", ! + do $SYSTEM.OBJ.Load(backupFile, "c") + } + + // end + + close logFile + use io + do ..WriteAndDelete(client, logFile) + + do client.Send("oLocalized", "%sUpdClean("_tempFile_")"_$CHAR(13, 10)) + do ##class(%File).Delete(tempFile) + do client.Send("oLocalized", "%sUpdClean("_backupFile_")"_$CHAR(13, 10, 13, 10)) + do ##class(%File).Delete(backupFile) + if '$$$ISOK(loadStatus) { + do ..Stop(client, loadStatus) + do client.Send("oLocalized", $CHAR(13, 10)_"%sUpdRes"_$CHAR(13, 10)) + } + do client.Send("oLocalized", "%sUpdDone"_$CHAR(13, 10)) + + do ##class(WebTerminal.Analytics).ReportInstallStatus(loadStatus, "Update") + + return $$$OK +} + +} + diff --git a/module.xml b/module.xml index 5f33d00..be4eba4 100644 --- a/module.xml +++ b/module.xml @@ -1,6 +1,6 @@ - + webterminal 4.9.5