2023-05-18 22:35:34 +00:00
'use strict' ; var $jscomp = $jscomp || { } ; $jscomp . scope = { } ; $jscomp . arrayIteratorImpl = function ( a ) { var b = 0 ; return function ( ) { return b < a . length ? { done : ! 1 , value : a [ b ++ ] } : { done : ! 0 } } } ; $jscomp . arrayIterator = function ( a ) { return { next : $jscomp . arrayIteratorImpl ( a ) } } ; $jscomp . makeIterator = function ( a ) { var b = "undefined" != typeof Symbol && Symbol . iterator && a [ Symbol . iterator ] ; if ( b ) return b . call ( a ) ; if ( "number" == typeof a . length ) return $jscomp . arrayIterator ( a ) ; throw Error ( String ( a ) + " is not an iterable or ArrayLike" ) ; } ;
$jscomp . arrayFromIterator = function ( a ) { for ( var b , c = [ ] ; ! ( b = a . next ( ) ) . done ; ) c . push ( b . value ) ; return c } ; $jscomp . arrayFromIterable = function ( a ) { return a instanceof Array ? a : $jscomp . arrayFromIterator ( $jscomp . makeIterator ( a ) ) } ; $jscomp . owns = function ( a , b ) { return Object . prototype . hasOwnProperty . call ( a , b ) } ; $jscomp . ASSUME _ES5 = ! 1 ; $jscomp . ASSUME _NO _NATIVE _MAP = ! 1 ; $jscomp . ASSUME _NO _NATIVE _SET = ! 1 ; $jscomp . SIMPLE _FROUND _POLYFILL = ! 1 ; $jscomp . ISOLATE _POLYFILLS = ! 1 ; $jscomp . FORCE _POLYFILL _PROMISE = ! 1 ;
$jscomp . FORCE _POLYFILL _PROMISE _WHEN _NO _UNHANDLED _REJECTION = ! 1 ; $jscomp . defineProperty = $jscomp . ASSUME _ES5 || "function" == typeof Object . defineProperties ? Object . defineProperty : function ( a , b , c ) { if ( a == Array . prototype || a == Object . prototype ) return a ; a [ b ] = c . value ; return a } ;
$jscomp . getGlobal = function ( a ) { a = [ "object" == typeof globalThis && globalThis , a , "object" == typeof window && window , "object" == typeof self && self , "object" == typeof global && global ] ; for ( var b = 0 ; b < a . length ; ++ b ) { var c = a [ b ] ; if ( c && c . Math == Math ) return c } throw Error ( "Cannot find global object" ) ; } ; $jscomp . global = $jscomp . getGlobal ( this ) ; $jscomp . IS _SYMBOL _NATIVE = "function" === typeof Symbol && "symbol" === typeof Symbol ( "x" ) ; $jscomp . TRUST _ES6 _POLYFILLS = ! $jscomp . ISOLATE _POLYFILLS || $jscomp . IS _SYMBOL _NATIVE ; $jscomp . polyfills = { } ;
$jscomp . propertyToPolyfillSymbol = { } ; $jscomp . POLYFILL _PREFIX = "$jscp$" ; var $jscomp$lookupPolyfilledValue = function ( a , b , c ) { if ( ! c || null != a ) { c = $jscomp . propertyToPolyfillSymbol [ b ] ; if ( null == c ) return a [ b ] ; c = a [ c ] ; return void 0 !== c ? c : a [ b ] } } ; $jscomp . polyfill = function ( a , b , c , d ) { b && ( $jscomp . ISOLATE _POLYFILLS ? $jscomp . polyfillIsolated ( a , b , c , d ) : $jscomp . polyfillUnisolated ( a , b , c , d ) ) } ;
$jscomp . polyfillUnisolated = function ( a , b , c , d ) { c = $jscomp . global ; a = a . split ( "." ) ; for ( d = 0 ; d < a . length - 1 ; d ++ ) { var e = a [ d ] ; if ( ! ( e in c ) ) return ; c = c [ e ] } a = a [ a . length - 1 ] ; d = c [ a ] ; b = b ( d ) ; b != d && null != b && $jscomp . defineProperty ( c , a , { configurable : ! 0 , writable : ! 0 , value : b } ) } ;
$jscomp . polyfillIsolated = function ( a , b , c , d ) { var e = a . split ( "." ) ; a = 1 === e . length ; d = e [ 0 ] ; d = ! a && d in $jscomp . polyfills ? $jscomp . polyfills : $jscomp . global ; for ( var f = 0 ; f < e . length - 1 ; f ++ ) { var g = e [ f ] ; if ( ! ( g in d ) ) return ; d = d [ g ] } e = e [ e . length - 1 ] ; c = $jscomp . IS _SYMBOL _NATIVE && "es6" === c ? d [ e ] : null ; b = b ( c ) ; null != b && ( a ? $jscomp . defineProperty ( $jscomp . polyfills , e , { configurable : ! 0 , writable : ! 0 , value : b } ) : b !== c && ( void 0 === $jscomp . propertyToPolyfillSymbol [ e ] && ( c = 1E9 * Math . random ( ) >>> 0 , $jscomp . propertyToPolyfillSymbol [ e ] = $jscomp . IS _SYMBOL _NATIVE ?
$jscomp . global . Symbol ( e ) : $jscomp . POLYFILL _PREFIX + c + "$" + e ) , $jscomp . defineProperty ( d , $jscomp . propertyToPolyfillSymbol [ e ] , { configurable : ! 0 , writable : ! 0 , value : b } ) ) ) } ; $jscomp . assign = $jscomp . TRUST _ES6 _POLYFILLS && "function" == typeof Object . assign ? Object . assign : function ( a , b ) { for ( var c = 1 ; c < arguments . length ; c ++ ) { var d = arguments [ c ] ; if ( d ) for ( var e in d ) $jscomp . owns ( d , e ) && ( a [ e ] = d [ e ] ) } return a } ; $jscomp . polyfill ( "Object.assign" , function ( a ) { return a || $jscomp . assign } , "es6" , "es3" ) ;
$jscomp . underscoreProtoCanBeSet = function ( ) { var a = { a : ! 0 } , b = { } ; try { return b . _ _proto _ _ = a , b . a } catch ( c ) { } return ! 1 } ; $jscomp . setPrototypeOf = $jscomp . TRUST _ES6 _POLYFILLS && "function" == typeof Object . setPrototypeOf ? Object . setPrototypeOf : $jscomp . underscoreProtoCanBeSet ( ) ? function ( a , b ) { a . _ _proto _ _ = b ; if ( a . _ _proto _ _ !== b ) throw new TypeError ( a + " is not extensible" ) ; return a } : null ; $jscomp . generator = { } ;
$jscomp . generator . ensureIteratorResultIsObject _ = function ( a ) { if ( ! ( a instanceof Object ) ) throw new TypeError ( "Iterator result " + a + " is not an object" ) ; } ; $jscomp . generator . Context = function ( ) { this . isRunning _ = ! 1 ; this . yieldAllIterator _ = null ; this . yieldResult = void 0 ; this . nextAddress = 1 ; this . finallyAddress _ = this . catchAddress _ = 0 ; this . finallyContexts _ = this . abruptCompletion _ = null } ;
$jscomp . generator . Context . prototype . start _ = function ( ) { if ( this . isRunning _ ) throw new TypeError ( "Generator is already running" ) ; this . isRunning _ = ! 0 } ; $jscomp . generator . Context . prototype . stop _ = function ( ) { this . isRunning _ = ! 1 } ; $jscomp . generator . Context . prototype . jumpToErrorHandler _ = function ( ) { this . nextAddress = this . catchAddress _ || this . finallyAddress _ } ; $jscomp . generator . Context . prototype . next _ = function ( a ) { this . yieldResult = a } ;
$jscomp . generator . Context . prototype . throw _ = function ( a ) { this . abruptCompletion _ = { exception : a , isException : ! 0 } ; this . jumpToErrorHandler _ ( ) } ; $jscomp . generator . Context . prototype . return = function ( a ) { this . abruptCompletion _ = { return : a } ; this . nextAddress = this . finallyAddress _ } ; $jscomp . generator . Context . prototype . jumpThroughFinallyBlocks = function ( a ) { this . abruptCompletion _ = { jumpTo : a } ; this . nextAddress = this . finallyAddress _ } ; $jscomp . generator . Context . prototype . yield = function ( a , b ) { this . nextAddress = b ; return { value : a } } ;
$jscomp . generator . Context . prototype . yieldAll = function ( a , b ) { a = $jscomp . makeIterator ( a ) ; var c = a . next ( ) ; $jscomp . generator . ensureIteratorResultIsObject _ ( c ) ; if ( c . done ) this . yieldResult = c . value , this . nextAddress = b ; else return this . yieldAllIterator _ = a , this . yield ( c . value , b ) } ; $jscomp . generator . Context . prototype . jumpTo = function ( a ) { this . nextAddress = a } ; $jscomp . generator . Context . prototype . jumpToEnd = function ( ) { this . nextAddress = 0 } ;
$jscomp . generator . Context . prototype . setCatchFinallyBlocks = function ( a , b ) { this . catchAddress _ = a ; void 0 != b && ( this . finallyAddress _ = b ) } ; $jscomp . generator . Context . prototype . setFinallyBlock = function ( a ) { this . catchAddress _ = 0 ; this . finallyAddress _ = a || 0 } ; $jscomp . generator . Context . prototype . leaveTryBlock = function ( a , b ) { this . nextAddress = a ; this . catchAddress _ = b || 0 } ;
$jscomp . generator . Context . prototype . enterCatchBlock = function ( a ) { this . catchAddress _ = a || 0 ; a = this . abruptCompletion _ . exception ; this . abruptCompletion _ = null ; return a } ; $jscomp . generator . Context . prototype . enterFinallyBlock = function ( a , b , c ) { c ? this . finallyContexts _ [ c ] = this . abruptCompletion _ : this . finallyContexts _ = [ this . abruptCompletion _ ] ; this . catchAddress _ = a || 0 ; this . finallyAddress _ = b || 0 } ;
$jscomp . generator . Context . prototype . leaveFinallyBlock = function ( a , b ) { b = this . finallyContexts _ . splice ( b || 0 ) [ 0 ] ; if ( b = this . abruptCompletion _ = this . abruptCompletion _ || b ) { if ( b . isException ) return this . jumpToErrorHandler _ ( ) ; void 0 != b . jumpTo && this . finallyAddress _ < b . jumpTo ? ( this . nextAddress = b . jumpTo , this . abruptCompletion _ = null ) : this . nextAddress = this . finallyAddress _ } else this . nextAddress = a } ; $jscomp . generator . Context . prototype . forIn = function ( a ) { return new $jscomp . generator . Context . PropertyIterator ( a ) } ;
$jscomp . generator . Context . PropertyIterator = function ( a ) { this . object _ = a ; this . properties _ = [ ] ; for ( var b in a ) this . properties _ . push ( b ) ; this . properties _ . reverse ( ) } ; $jscomp . generator . Context . PropertyIterator . prototype . getNext = function ( ) { for ( ; 0 < this . properties _ . length ; ) { var a = this . properties _ . pop ( ) ; if ( a in this . object _ ) return a } return null } ; $jscomp . generator . Engine _ = function ( a ) { this . context _ = new $jscomp . generator . Context ; this . program _ = a } ;
$jscomp . generator . Engine _ . prototype . next _ = function ( a ) { this . context _ . start _ ( ) ; if ( this . context _ . yieldAllIterator _ ) return this . yieldAllStep _ ( this . context _ . yieldAllIterator _ . next , a , this . context _ . next _ ) ; this . context _ . next _ ( a ) ; return this . nextStep _ ( ) } ;
$jscomp . generator . Engine _ . prototype . return _ = function ( a ) { this . context _ . start _ ( ) ; var b = this . context _ . yieldAllIterator _ ; if ( b ) return this . yieldAllStep _ ( "return" in b ? b [ "return" ] : function ( c ) { return { value : c , done : ! 0 } } , a , this . context _ . return ) ; this . context _ . return ( a ) ; return this . nextStep _ ( ) } ;
$jscomp . generator . Engine _ . prototype . throw _ = function ( a ) { this . context _ . start _ ( ) ; if ( this . context _ . yieldAllIterator _ ) return this . yieldAllStep _ ( this . context _ . yieldAllIterator _ [ "throw" ] , a , this . context _ . next _ ) ; this . context _ . throw _ ( a ) ; return this . nextStep _ ( ) } ;
$jscomp . generator . Engine _ . prototype . yieldAllStep _ = function ( a , b , c ) { try { var d = a . call ( this . context _ . yieldAllIterator _ , b ) ; $jscomp . generator . ensureIteratorResultIsObject _ ( d ) ; if ( ! d . done ) return this . context _ . stop _ ( ) , d ; var e = d . value } catch ( f ) { return this . context _ . yieldAllIterator _ = null , this . context _ . throw _ ( f ) , this . nextStep _ ( ) } this . context _ . yieldAllIterator _ = null ; c . call ( this . context _ , e ) ; return this . nextStep _ ( ) } ;
$jscomp . generator . Engine _ . prototype . nextStep _ = function ( ) { for ( ; this . context _ . nextAddress ; ) try { var a = this . program _ ( this . context _ ) ; if ( a ) return this . context _ . stop _ ( ) , { value : a . value , done : ! 1 } } catch ( b ) { this . context _ . yieldResult = void 0 , this . context _ . throw _ ( b ) } this . context _ . stop _ ( ) ; if ( this . context _ . abruptCompletion _ ) { a = this . context _ . abruptCompletion _ ; this . context _ . abruptCompletion _ = null ; if ( a . isException ) throw a . exception ; return { value : a . return , done : ! 0 } } return { value : void 0 , done : ! 0 } } ;
$jscomp . generator . Generator _ = function ( a ) { this . next = function ( b ) { return a . next _ ( b ) } ; this . throw = function ( b ) { return a . throw _ ( b ) } ; this . return = function ( b ) { return a . return _ ( b ) } ; this [ Symbol . iterator ] = function ( ) { return this } } ; $jscomp . generator . createGenerator = function ( a , b ) { b = new $jscomp . generator . Generator _ ( new $jscomp . generator . Engine _ ( b ) ) ; $jscomp . setPrototypeOf && a . prototype && $jscomp . setPrototypeOf ( b , a . prototype ) ; return b } ;
$jscomp . asyncExecutePromiseGenerator = function ( a ) { function b ( d ) { return a . next ( d ) } function c ( d ) { return a . throw ( d ) } return new Promise ( function ( d , e ) { function f ( g ) { g . done ? d ( g . value ) : Promise . resolve ( g . value ) . then ( b , c ) . then ( f , e ) } f ( a . next ( ) ) } ) } ; $jscomp . asyncExecutePromiseGeneratorFunction = function ( a ) { return $jscomp . asyncExecutePromiseGenerator ( a ( ) ) } ; $jscomp . asyncExecutePromiseGeneratorProgram = function ( a ) { return $jscomp . asyncExecutePromiseGenerator ( new $jscomp . generator . Generator _ ( new $jscomp . generator . Engine _ ( a ) ) ) } ;
$jscomp . getRestArguments = function ( ) { for ( var a = Number ( this ) , b = [ ] , c = a ; c < arguments . length ; c ++ ) b [ c - a ] = arguments [ c ] ; return b } ;
function initApp ( ) { var a , b ; return $jscomp . asyncExecutePromiseGeneratorProgram ( function ( c ) { if ( 1 == c . nextAddress ) return b = null == ( a = ( new URL ( window . location . href ) ) . searchParams . get ( "view" ) ) ? void 0 : a . toLowerCase ( ) , c . yield ( initEditor ( b ) , 2 ) ; if ( 3 != c . nextAddress ) { var d = analyseUrl ( window . location . href ) , e , f = null == ( e = document . editor ) ? void 0 : e . getValue ( ) , g ; document . appData = Object . assign ( { } , null == ( g = window . opener ) ? void 0 : g . document . appData ) ; 0 === Object . keys ( document . appData ) . length && ( document . appData = { encodedDiagram : d . encodedDiagram ,
index : d . index , numberOfDiagramPages : f ? getNumberOfDiagramPagesFromCode ( f ) : 1 } ) ; initTheme ( ) ; initAppCommunication ( ) ; return c . yield ( initPreview ( b ) , 3 ) } initModals ( b ) ; document . editor && ( document . editor . focus ( ) , "SyfFKj2rKt3CoKnELR1Io4ZDoSa70000" == document . appData . encodedDiagram && document . editor . setSelection ( { startLineNumber : 2 , endLineNumber : 2 , startColumn : 1 , endColumn : 21 } ) ) ; document . appConfig . autoRefreshState = "complete" ; c . jumpToEnd ( ) } ) } window . onload = initApp ;
var $jscomp$destructuring$var0 = function ( ) { return { setEditorValue : function ( a , b , c ) { c = void 0 === c ? { } : c ; var d = void 0 === c . forceMoveMarkers ? void 0 : c . forceMoveMarkers ; ( void 0 === c . suppressEditorChangedMessage ? 0 : c . suppressEditorChangedMessage ) && a === document . editor && suppressNextMessage ( "editor" ) ; a . executeEdits ( "" , [ { range : a . getModel ( ) . getFullModelRange ( ) , text : b , forceMoveMarkers : d } ] ) } , initEditor : function ( a ) { function b ( ) { return new Promise ( function ( g , m ) { require . config ( { paths : { vs : "webjars/monaco-editor/0.36.1/min/vs" } } ) ;
require ( [ "vs/editor/editor.main" ] , g ) } ) } function c ( ) { function g ( t , p , k ) { function n ( ) { document . appConfig . autoRefreshState = "started" ; var r = getNumberOfDiagramPagesFromCode ( t ) , u = document . appData . index ; void 0 === u || 1 === r ? u = void 0 : u >= r && ( u = r - 1 ) ; makeRequest ( "POST" , "coder" , { data : t } ) . then ( function ( v ) { sendMessage ( { sender : p , data : { encodedDiagram : v , numberOfDiagramPages : r , index : u } , synchronize : ! 0 } ) } ) } k = void 0 === k ? ! 0 : k ; var q = function ( ) { return function ( ) { var r = document . editor . getModel ( ) ; m = m || new PlantUmlLanguageFeatures ;
m . validateCode ( r ) . then ( function ( u ) { return monaco . editor . setModelMarkers ( r , "plantuml" , u ) } ) } } ( ) ; p && k && n ( ) ; q ( ) } var m , l = monaco . editor . createModel ( function ( ) { var t = document . getElementById ( "initCode" ) , p = t . value ; t . remove ( ) ; return p } ( ) , "apex" , monaco . Uri . parse ( "inmemory://plantuml" ) ) , h = 0 ; l . onDidChangeContent ( function ( ) { clearTimeout ( h ) ; document . appConfig . autoRefreshState = "waiting" ; h = setTimeout ( function ( ) { return g ( l . getValue ( ) , "editor" ) } , document . appConfig . editorWatcherTimeout ) } ) ; return l } function d ( ) { return { get : function ( ) { } ,
getBoolean : function ( g ) { return "expandSuggestionDocs" === g } , getNumber : function ( ) { return 0 } , remove : function ( ) { } , store : function ( ) { } , onWillSaveState : function ( ) { } , onDidChangeStorage : function ( ) { } , onDidChangeValue : function ( ) { } } } var e , f ; return $jscomp . asyncExecutePromiseGeneratorProgram ( function ( g ) { if ( 1 == g . nextAddress ) return g . yield ( b ( ) , 2 ) ; "previewer" !== a && ( e = c ( ) , f = d ( ) , document . editor = monaco . editor . create ( document . getElementById ( "monaco-editor" ) , Object . assign ( { } , { model : e } , document . appConfig . editorCreateOptions ) ,
{ storageService : f } ) , document . addEventListener ( "resize" , function ( ) { return document . editor . layout ( ) } ) , initEditorUrlInput ( ) , initEditorMenu ( ) ) ; g . jumpToEnd ( ) } ) } } } ( ) , setEditorValue = $jscomp$destructuring$var0 . setEditorValue , initEditor = $jscomp$destructuring$var0 . initEditor ;
function initEditorMenu ( ) { document . getElementById ( "menu-item-editor-code-copy" ) . addEventListener ( "click" , function ( ) { var a = document . editor . getModel ( ) . getFullModelRange ( ) ; document . editor . focus ( ) ; document . editor . setSelection ( a ) ; a = document . editor . getValue ( ) ; var b ; null == ( b = navigator . clipboard ) || b . writeText ( a ) . catch ( function ( ) { } ) } ) }
var $jscomp$destructuring$var3 = function ( ) { function a ( b , c , d ) { var e = void 0 === c ? { } : c ; c = void 0 === e . encodedDiagram ? void 0 : e . encodedDiagram ; e = void 0 === e . index ? void 0 : e . index ; d = void 0 === d ? { } : d ; if ( b || c ) ( void 0 === d . suppressEditorChangedMessage ? 0 : d . suppressEditorChangedMessage ) && suppressNextMessage ( "url" ) , document . getElementById ( "url" ) . value = b ? b : resolvePath ( buildUrl ( "png" , c , e ) ) } return { setUrlValue : a , initEditorUrlInput : function ( ) { var b = document . getElementById ( "url" ) ; a ( resolvePath ( b . value ) ) ; b . addEventListener ( "change" ,
function ( c ) { var d , e ; return $jscomp . asyncExecutePromiseGeneratorProgram ( function ( f ) { if ( 1 == f . nextAddress ) return document . appConfig . autoRefreshState = "started" , c . target . title = c . target . value , d = analyseUrl ( c . target . value ) , f . yield ( makeRequest ( "GET" , "coder/" + d . encodedDiagram ) , 2 ) ; e = f . yieldResult ; setEditorValue ( document . editor , e , { suppressEditorChangedMessage : ! 0 } ) ; sendMessage ( { sender : "url" , data : { encodedDiagram : d . encodedDiagram , index : d . index } , synchronize : ! 0 } ) ; f . jumpToEnd ( ) } ) } ) ; document . getElementById ( "url-copy-btn" ) . addEventListener ( "click" ,
function ( ) { b . focus ( ) ; b . select ( ) ; var c ; null == ( c = navigator . clipboard ) || c . writeText ( b . value ) . catch ( function ( ) { } ) } ) } } } ( ) , setUrlValue = $jscomp$destructuring$var3 . setUrlValue , initEditorUrlInput = $jscomp$destructuring$var3 . initEditorUrlInput ;
function initDiagramExport ( ) { function a ( ) { setVisibility ( document . getElementById ( "diagram-export" ) , ! 0 , ! 0 ) ; var f = document . editor . getValue ( ) ; f = Array . from ( f . matchAll ( /^\s*@start[a-zA-Z]*\s+([a-zA-Z-_\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df ]+)\s*$/gm ) , function ( g ) { return g [ 1 ] } ) [ 0 ] || "diagram" ; d . value = f + ".puml" ; e . value = "code" ; d . focus ( ) } function b ( f ) { var g = f . lastIndexOf ( "." ) ; return 1 > g ? { name : f , ext : null } : g === f . length - 1 ? { name : f . slice ( 0 , - 1 ) , ext : null } : { name : f . substring ( 0 , g ) , ext : f . substring ( g + 1 ) } } function c ( f ) { if ( ! f ) return f ;
f = f . toLowerCase ( ) ; switch ( f ) { case "puml" : case "plantuml" : case "code" : return "code" ; case "ascii" : return "txt" ; default : return f } } var d = document . getElementById ( "download-name" ) , e = document . getElementById ( "download-type" ) ; registerModalListener ( "diagram-export" , a ) ; d . addEventListener ( "change" , function ( f ) { f = b ( f . target . value ) . ext ; if ( f = c ( f ) ) e . value = f } ) ; e . addEventListener ( "change" , function ( f ) { f = f . target . value ; a : switch ( f ) { case "epstext" : f = "eps" ; break a ; case "code" : f = "puml" } var g = b ( d . value ) . name ; d . value = g + "." + f } ) ;
document . getElementById ( "diagram-export-ok-btn" ) . addEventListener ( "click" , function ( ) { var f = d . value , g = e . value , m = document . createElement ( "a" ) ; m . download = f ; "code" === g ? ( f = document . editor . getValue ( ) , m . href = "data:," + encodeURIComponent ( f ) ) : m . href = void 0 !== document . appData . index ? g + "/" + document . appData . index + "/" + document . appData . encodedDiagram : g + "/" + document . appData . encodedDiagram ; m . click ( ) } ) ; window . addEventListener ( "keydown" , function ( f ) { "s" === f . key && ( isMac ? f . metaKey : f . ctrlKey ) && ( f . preventDefault ( ) , isModalOpen ( "diagram-export" ) ||
a ( ) ) } , ! 1 ) }
function initDiagramImport ( ) { function a ( h ) { h = void 0 === h ? ! 0 : h ; setVisibility ( f , ! 0 , ! 0 ) ; f . dataset . isOpenManually = h . toString ( ) ; g . value = "" ; c ( g ) } function b ( ) { g . value = "" ; c ( g ) ; f . removeAttribute ( "data-is-open-manually" ) ; setVisibility ( f , ! 1 ) } function c ( h ) { l . innerText = "" ; var t ; m . disabled = 1 > ( null == ( t = h . files ) ? void 0 : t . length ) } function d ( h ) { function t ( k ) { var n = k . name , q = k . type ; k = [ "plain" , "text" , "plantuml" , "puml" ] ; if ( 0 < k . filter ( function ( u ) { return - 1 !== q . toLowerCase ( ) . indexOf ( u ) } ) . length ) return ! 0 ; if ( - 1 === n . indexOf ( "." ) ) return ! 1 ;
var r = n . substring ( n . lastIndexOf ( "." ) + 1 ) . toLowerCase ( ) ; k = [ "txt" , "puml" , "plantuml" ] ; return 0 < k . filter ( function ( u ) { return r === u } ) . length } var p = function ( k ) { var n = k . name , q = k . type ; k = [ "png" , "svg" ] ; var r = k . filter ( function ( v ) { return - 1 !== q . toLowerCase ( ) . indexOf ( v ) } ) [ 0 ] ; if ( r ) return r ; if ( - 1 !== n . indexOf ( "." ) ) { var u = n . substring ( n . lastIndexOf ( "." ) + 1 ) . toLowerCase ( ) ; return k . filter ( function ( v ) { return u === v } ) [ 0 ] } } ( h ) ; h = void 0 === p ? t ( h ) : ! 1 ; p || h || ( l . innerText = "File not supported. Only PNG and SVG diagram images as well as PlantUML code text files are supported." ) ;
return { type : p , isDiagramCode : h , valid : p || h } } function e ( h , t ) { function p ( k ) { var n = new FormData ; n . append ( "diagram" , k , k . name ) ; return makeRequest ( "POST" , "metadata" , { data : n , responseType : "json" , headers : { Accept : "application/json" } } ) } f . classList . add ( "wait" ) ; return ( new Promise ( function ( k , n ) { if ( t . type ) p ( h ) . then ( function ( r ) { setEditorValue ( document . editor , r . decoded ) ; k ( ) } , function ( r ) { r = r . response ; l . innerText = r . message || r ; n ( ) } ) ; else if ( t . isDiagramCode ) { var q = new FileReader ; q . onload = function ( r ) { setEditorValue ( document . editor ,
r . target . result ) } ; q . readAsText ( h ) ; k ( ) } else l . innerText = "File not supported. Only PNG and SVG diagram images as well as PlantUML code text files are supported." , n ( ) } ) ) . then ( function ( ) { return b ( ) } , function ( ) { } ) . finally ( function ( ) { return f . classList . remove ( "wait" ) } ) } var f = document . getElementById ( "diagram-import" ) , g = document . getElementById ( "diagram-import-input" ) , m = document . getElementById ( "diagram-import-ok-btn" ) , l = document . getElementById ( "diagram-import-error-message" ) ; window . addEventListener ( "dragenter" ,
function ( h ) { h . stopPropagation ( ) ; h . preventDefault ( ) ; isVisible ( f ) || a ( ! 1 ) } , ! 1 ) ; g . addEventListener ( "dragenter" , function ( h ) { return h . target . classList . add ( "drop-able" ) } , ! 1 ) ; g . addEventListener ( "dragover" , function ( h ) { h . stopPropagation ( ) ; h . preventDefault ( ) ; null !== h . dataTransfer && ( h . dataTransfer . dropEffect = "copy" ) } , ! 1 ) ; g . addEventListener ( "dragexit" , function ( h ) { return h . target . classList . remove ( "drop-able" ) } , ! 1 ) ; g . addEventListener ( "drop" , function ( h ) { function t ( ) { h . stopPropagation ( ) ; h . preventDefault ( ) } var p = h . dataTransfer . files ||
2023-06-09 12:51:26 +00:00
h . target . files ; if ( ! p || 1 > p . length ) return t ( ) ; p = p [ 0 ] ; var k = d ( p ) ; if ( ! k . valid ) return t ( ) ; "true" !== f . dataset . isOpenManually && ( t ( ) , e ( p , k ) ) } , ! 1 ) ; g . addEventListener ( "change" , function ( h ) { return c ( h . target ) } ) ; m . addEventListener ( "click" , function ( ) { var h = g . files [ 0 ] ; e ( h , d ( h ) ) } ) ; registerModalListener ( "diagram-import" , a , b ) }
2023-05-18 22:35:34 +00:00
var $jscomp$destructuring$var16 = function ( ) { var a = { } ; return { registerModalListener : function ( b , c , d ) { a [ b ] = { fnOpen : c , fnClose : d } } , openModal : function ( b ) { var c = $jscomp . getRestArguments . apply ( 1 , arguments ) , d , e = null == ( d = a [ b ] ) ? void 0 : d . fnOpen ; e ? e . apply ( null , $jscomp . arrayFromIterable ( c ) ) : setVisibility ( document . getElementById ( b ) , ! 0 , ! 0 ) } , closeModal : function ( b ) { var c = $jscomp . getRestArguments . apply ( 1 , arguments ) , d , e = null == ( d = a [ b ] ) ? void 0 : d . fnClose ; e ? e . apply ( null , $jscomp . arrayFromIterable ( c ) ) : setVisibility ( document . getElementById ( b ) ,
! 1 ) } } } ( ) , registerModalListener = $jscomp$destructuring$var16 . registerModalListener , openModal = $jscomp$destructuring$var16 . openModal , closeModal = $jscomp$destructuring$var16 . closeModal ;
2023-06-09 12:51:26 +00:00
function initModals ( a ) { function b ( c ) { "Escape" === c . key || "Esc" === c . key ? ( c . preventDefault ( ) , closeModal ( c . target . closest ( ".modal" ) . id ) ) : "Enter" === c . key && ( c . preventDefault ( ) , ( c = c . target . closest ( ".modal" ) . querySelector ( 'input.ok[type\x3d"button"]' ) ) && ! c . disabled && c . click ( ) ) } document . querySelectorAll ( ".modal" ) . forEach ( function ( c ) { c . addEventListener ( "keydown" , b , ! 1 ) } ) ; initSettings ( ) ; "previewer" !== a && ( initDiagramExport ( ) , initDiagramImport ( ) ) }
function isModalOpen ( a ) { return isVisible ( document . getElementById ( a ) ) } function closeAllModals ( ) { document . querySelectorAll ( ".modal" ) . forEach ( function ( a ) { return closeModal ( a . id ) } ) }
2023-05-18 22:35:34 +00:00
function initSettings ( ) { function a ( ) { setVisibility ( document . getElementById ( "settings" ) , ! 0 , ! 0 ) ; b . value = document . appConfig . theme ; c . value = document . appConfig . diagramPreviewType ; d . value = document . appConfig . editorWatcherTimeout ; setEditorValue ( document . settingsEditor , JSON . stringify ( document . appConfig . editorCreateOptions , null , " " ) ) } var b = document . getElementById ( "theme" ) , c = document . getElementById ( "diagramPreviewType" ) , d = document . getElementById ( "editorWatcherTimeout" ) ; document . settingsEditor = monaco . editor . create ( document . getElementById ( "settings-monaco-editor" ) ,
Object . assign ( { } , { language : "json" } , document . appConfig . editorCreateOptions ) ) ; b . addEventListener ( "change" , function ( e ) { e = e . target . value ; var f = document . settingsEditor . getValue ( ) ; setEditorValue ( document . settingsEditor , f . replace ( new RegExp ( '("theme"\\s*:\\s*)"' + ( "dark" === e ? "vs" : "vs-dark" ) + '"' , "gm" ) , '$1"' + ( "dark" === e ? "vs-dark" : "vs" ) + '"' ) ) } ) ; document . getElementById ( "settings-ok-btn" ) . addEventListener ( "click" , function ( ) { var e = Object . assign ( { } , document . appConfig ) ; e . theme = b . value ; e . editorWatcherTimeout = d . value ;
e . diagramPreviewType = c . value ; e . editorCreateOptions = JSON . parse ( document . settingsEditor . getValue ( ) ) ; updateConfig ( e ) ; closeModal ( "settings" ) } ) ; window . addEventListener ( "keydown" , function ( e ) { "," === e . key && ( isMac ? e . metaKey : e . ctrlKey ) && ( e . preventDefault ( ) , isModalOpen ( "settings" ) || a ( ) ) } , ! 1 ) ; registerModalListener ( "settings" , a ) }
function initializeDiagram ( ) { return $jscomp . asyncExecutePromiseGeneratorProgram ( function ( a ) { if ( "png" !== document . appConfig . diagramPreviewType ) return a . return ( setDiagram ( document . appConfig . diagramPreviewType , document . appData . encodedDiagram , document . appData . index ) ) ; a . jumpToEnd ( ) } ) }
2023-06-12 19:53:23 +00:00
function setDiagram ( a , b , c ) { function d ( k , n , q ) { return $jscomp . asyncExecutePromiseGeneratorProgram ( function ( r ) { return r . return ( makeRequest ( "GET" , buildUrl ( k , n , q ) ) ) } ) } var e , f , g , m , l , h , t , p ; return $jscomp . asyncExecutePromiseGeneratorProgram ( function ( k ) { switch ( k . nextAddress ) { case 1 : e = document . getElementById ( "diagram" ) ; f = document . getElementById ( "diagram-png" ) ; g = document . getElementById ( "diagram-txt" ) ; m = document . getElementById ( "diagram-pdf" ) ; k . setCatchFinallyBlocks ( 2 ) ; if ( "png" === a ) return f . src = buildUrl ( "png" ,
b , c ) , k . yield ( d ( "map" , b , c ) , 11 ) ; if ( "svg" === a ) return k . yield ( d ( "svg" , b , c ) , 10 ) ; if ( "txt" !== a ) { if ( "pdf" === a ) m . data = buildUrl ( "pdf" , b , c ) ; else return l = "unknown diagram type: " + a , ( console . error || console . log ) ( l ) , k . return ( Promise . reject ( l ) ) ; k . jumpTo ( 5 ) ; break } h = g ; return k . yield ( d ( "txt" , b , c ) , 9 ) ; case 9 : h . innerHTML = k . yieldResult ; k . jumpTo ( 5 ) ; break ; case 10 : t = k . yieldResult ; var n = document . getElementById ( "diagram-svg" ) , q = document . createElement ( "div" ) ; q . innerHTML = t ; q = q . querySelector ( "svg" ) ; q . id = "diagram-svg" ; q . classList =
n . classList ; q . style . cssText = n . style . cssText ; n . parentNode . replaceChild ( q , n ) ; k . jumpTo ( 5 ) ; break ; case 11 : if ( p = k . yieldResult , n = document . getElementById ( "plantuml_map" ) , q = document . getElementById ( "map-diagram-link" ) , p ) { var r = document . createElement ( "div" ) ; r . innerHTML = p ; n . parentNode . replaceChild ( r . firstChild , n ) ; setVisibility ( q , ! 0 ) } else removeChildren ( n ) , setVisibility ( q , ! 1 ) ; case 5 : n = document . getElementById ( "plantuml_map" ) ; q = document . getElementById ( "diagram-svg" ) ; e . setAttribute ( "data-diagram-type" , a ) ; setVisibility ( f ,
"png" === a ) ; setVisibility ( n , "png" === a ) ; setVisibility ( q , "svg" === a ) ; setVisibility ( g , "txt" === a ) ; setVisibility ( m , "pdf" === a ) ; k . leaveTryBlock ( 0 ) ; break ; case 2 : k . enterCatchBlock ( ) , k . jumpToEnd ( ) } } ) } function getNumberOfDiagramPagesFromCode ( a ) { var b ; return ( null == ( b = a . match ( /^\s*newpage\s?.*$/gm ) ) ? void 0 : b . length ) + 1 || 1 }
function updatePaginatorSelection ( ) { var a = document . getElementById ( "paginator" ) , b = document . appData . index ; if ( void 0 === b || a . childNodes . length <= b ) for ( a = $jscomp . makeIterator ( a . childNodes ) , b = a . next ( ) ; ! b . done ; b = a . next ( ) ) b . value . checked = ! 1 ; else a . childNodes [ b ] . checked = ! 0 }
2023-05-18 22:35:34 +00:00
var updatePaginator = function ( ) { function a ( b , c ) { for ( ; b . childElementCount > c ; ) b . removeChild ( b . lastChild ) ; for ( ; b . childElementCount < c ; ) { var d = document . createElement ( "input" ) ; d . name = "paginator" ; d . type = "radio" ; d . value = b . childElementCount ; d . addEventListener ( "click" , function ( e ) { sendMessage ( { sender : "paginator" , data : { index : e . target . value } , synchronize : ! 0 } ) } ) ; b . appendChild ( d ) } } return function ( ) { var b = document . getElementById ( "paginator" ) , c = document . appData . numberOfDiagramPages ; 1 < c ? ( a ( b , c ) , setVisibility ( b , ! 0 ) ) :
setVisibility ( b , ! 1 ) } } ( ) ; function initializePaginator ( ) { 1 < document . appData . numberOfDiagramPages && ( updatePaginator ( ) , updatePaginatorSelection ( ) ) }
function initPreview ( a ) { function b ( ) { setVisibility ( e , ! 1 ) ; setVisibility ( f , window . opener ) ; g && ( g . style . width = "100%" ) ; m && setVisibility ( m , ! 1 ) } function c ( ) { setVisibility ( e , ! 0 ) ; setVisibility ( f , ! 1 ) ; g && g . style . removeProperty ( "width" ) ; m && setVisibility ( m , ! 0 ) } function d ( ) { var l = new URL ( window . location . href ) ; l . searchParams . set ( "view" , "previewer" ) ; if ( l = window . open ( l , "PlantUML Diagram Previewer" , "popup" ) ) l . onbeforeunload = c , b ( ) } var e , f , g , m ; return $jscomp . asyncExecutePromiseGeneratorProgram ( function ( l ) { if ( 1 == l . nextAddress ) return e =
document . getElementById ( "btn-undock" ) , f = document . getElementById ( "btn-dock" ) , g = document . getElementById ( "editor-main-container" ) , m = document . getElementById ( "previewer-main-container" ) , e . addEventListener ( "click" , d ) , l . yield ( initializeDiagram ( ) , 2 ) ; initializePaginator ( ) ; [ "previewer" , "editor" ] . includes ( a ) && b ( ) ; l . jumpToEnd ( ) } ) }
var $jscomp$destructuring$var17 = function ( ) { var a = function ( ) { var c = [ ] ; return { suppressNextMessage : function ( d , e ) { c . push ( { sender : d , condition : e } ) } , isMessageSuppressed : function ( d ) { for ( var e = 0 ; e < c . length ; e ++ ) { var f = c [ e ] ; if ( ! f . sender || f . sender === d . sender ) if ( ! f . condition || f . condition ( d ) ) return c . splice ( e , 1 ) , ! 0 } return ! 1 } } } ( ) , b = a . isMessageSuppressed ; return { sendMessage : function ( c ) { b ( c ) || ( new BroadcastChannel ( "plantuml-server" ) ) . postMessage ( c ) } , suppressNextMessage : a . suppressNextMessage , initAppCommunication : function ( ) { ( new BroadcastChannel ( "plantuml-server" ) ) . onmessage =
function ( c ) { function d ( m ) { var l , h , t , p , k , n ; return $jscomp . asyncExecutePromiseGeneratorProgram ( function ( q ) { if ( 1 == q . nextAddress ) return document . appConfig . autoRefreshState = "syncing" , l = document . appData . encodedDiagram , h = document . appData . index , "url" !== m && document . getElementById ( "url" ) && setUrlValue ( void 0 , { encodedDiagram : l , index : h } , { suppressEditorChangedMessage : ! 0 } ) , q . yield ( setDiagram ( document . appConfig . diagramPreviewType , l , h ) , 2 ) ; t = $jscomp . makeIterator ( document . getElementsByClassName ( "diagram-link" ) ) ; for ( p =
t . next ( ) ; ! p . done ; p = t . next ( ) ) k = p . value , k . href = buildUrl ( k . dataset . imgType , l , h ) ; n = replaceUrl ( window . location . href , l , h ) . url ; history . replaceState ( history . stat , document . title , n ) ; document . appConfig . autoRefreshState = "complete" ; q . jumpToEnd ( ) } ) } var e , f , g ; return $jscomp . asyncExecutePromiseGeneratorProgram ( function ( m ) { if ( 1 == m . nextAddress ) { e = c . data . data ; f = c . data . force || ! 1 ; if ( e && 0 !== Object . keys ( e ) . length ) { var l = { } ; "encodedDiagram" in e && e . encodedDiagram !== document . appData . encodedDiagram && ( document . appData . encodedDiagram =
e . encodedDiagram , l . diagram = ! 0 ) ; "index" in e && e . index !== document . appData . index && ( document . appData . index = e . index , l . index = ! 0 ) ; "numberOfDiagramPages" in e && e . numberOfDiagramPages !== document . appData . numberOfDiagramPages && ( document . appData . numberOfDiagramPages = e . numberOfDiagramPages , l . numberOfDiagramPages = ! 0 ) ; "appConfig" in e && e . appConfig !== document . appConfig && ( document . appConfig = e . appConfig , l . appConfig = ! 0 ) } else l = { } ; g = l ; return ! 0 !== c . data . synchronize ? m . jumpTo ( 2 ) : f || g . diagram || g . index || g . appConfig ? m . yield ( d ( c . data . sender ) ,
3 ) : m . jumpTo ( 3 ) } 2 != m . nextAddress && ( ( f || g . numberOfDiagramPages ) && updatePaginator ( ) , ( f || g . numberOfDiagramPages || g . index ) && updatePaginatorSelection ( ) , g . appConfig && applyConfig ( ) ) ; ! 0 === c . data . reload && window . location . reload ( ) ; m . jumpToEnd ( ) } ) } } } } ( ) , sendMessage = $jscomp$destructuring$var17 . sendMessage , suppressNextMessage = $jscomp$destructuring$var17 . suppressNextMessage , initAppCommunication = $jscomp$destructuring$var17 . initAppCommunication ;
function makeRequest ( a , b , c ) { c = void 0 === c ? { } : c ; return PlantUmlLanguageFeatures . makeRequest ( a , b , { data : void 0 === c . data ? null : c . data , headers : void 0 === c . headers ? { "Content-Type" : "text/plain" } : c . headers , responseType : void 0 === c . responseType ? "text" : c . responseType , baseUrl : void 0 === c . baseUrl ? "" : c . baseUrl } ) }
var $jscomp$destructuring$var21 = function ( ) { var a = { changeEventsEnabled : ! 0 , autoRefreshState : "disabled" , theme : void 0 , diagramPreviewType : "png" , editorWatcherTimeout : 500 , editorCreateOptions : { automaticLayout : ! 0 , fixedOverflowWidgets : ! 0 , minimap : { enabled : ! 1 } , scrollbar : { alwaysConsumeMouseWheel : ! 1 } , scrollBeyondLastLine : ! 1 , tabSize : 2 , theme : "vs" } } , b ; document . appConfig = Object . assign ( { } , null == ( b = window . opener ) ? void 0 : b . document . appConfig ) ; 0 === Object . keys ( document . appConfig ) . length && ( document . appConfig = JSON . parse ( localStorage . getItem ( "document.appConfig" ) ) ||
a ) ; return { applyConfig : function ( ) { setTheme ( document . appConfig . theme ) ; var c ; null == ( c = document . editor ) || c . updateOptions ( document . appConfig . editorCreateOptions ) ; var d ; null == ( d = document . settingsEditor ) || d . updateOptions ( document . appConfig . editorCreateOptions ) } , updateConfig : function ( c ) { localStorage . setItem ( "document.appConfig" , JSON . stringify ( c ) ) ; sendMessage ( { sender : "config" , data : { appConfig : c } , synchronize : ! 0 } ) } } } ( ) , applyConfig = $jscomp$destructuring$var21 . applyConfig , updateConfig = $jscomp$destructuring$var21 . updateConfig ;
function removeChildren ( a ) { a . replaceChildren ? a . replaceChildren ( ) : a . innerHTML = "" } function isVisible ( a ) { return null !== a . offsetParent } function setVisibility ( a , b , c ) { c = void 0 === c ? ! 1 : c ; b ? ( a . style . removeProperty ( "display" ) , c && a . focus ( ) ) : a . style . display = "none" } var isMac = function ( ) { var a , b , c ; return ( ( null == ( a = navigator ) ? void 0 : null == ( b = a . userAgentData ) ? void 0 : b . platform ) || ( null == ( c = navigator ) ? void 0 : c . platform ) || "unknown" ) . match ( "Mac" ) } ( ) ;
function setTheme ( a ) { document . documentElement . setAttribute ( "data-theme" , a ) }
function initTheme ( ) { function a ( d ) { "dark" === d && "vs" === document . appConfig . editorCreateOptions . theme && ( document . appConfig . editorCreateOptions . theme = "vs-dark" ) ; "light" === d && "vs-dark" === document . appConfig . editorCreateOptions . theme && ( document . appConfig . editorCreateOptions . theme = "vs" ) } var b = document . appConfig , c ; ( c = document . appConfig . theme ) || ( c = window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches ? "dark" : window . matchMedia ( "(prefers-color-scheme: light)" ) . matches ? "light" : void 0 ) ; b . theme = c || "light" ; setTheme ( document . appConfig . theme ) ;
a ( document . appConfig . theme ) ; window . matchMedia ( "(prefers-color-scheme: dark)" ) . addEventListener ( "change" , function ( d ) { d = d . matches ? "dark" : "light" ; document . appConfig . theme = d ; a ( d ) ; updateConfig ( document . appConfig ) } ) } function resolvePath ( a ) { return PlantUmlLanguageFeatures . absolutePath ( a ) }
function prepareUrl ( a ) { a instanceof URL || ( a = new URL ( resolvePath ( a ) ) ) ; var b = ( new URL ( ( document . querySelector ( "base" ) || { } ) . href || window . location . origin ) ) . pathname ; "/" === b . slice ( - 1 ) && ( b = b . slice ( 0 , - 1 ) ) ; b = a . pathname . startsWith ( b ) ? a . pathname . slice ( b . length ) : a . pathname ; var c = /\/\w+(?:\/(\d+))?(?:\/([^/]+))?\/?$/gm . exec ( b ) ; return [ a , b , { idx : c [ 1 ] , encoded : c [ 2 ] } ] }
function analyseUrl ( a ) { var b = $jscomp . makeIterator ( prepareUrl ( a ) ) ; a = b . next ( ) . value ; b . next ( ) ; b = b . next ( ) . value ; return { index : b . idx , encodedDiagram : b . encoded || a . searchParams . get ( "url" ) } }
function replaceUrl ( a , b , c ) { var d = $jscomp . makeIterator ( prepareUrl ( a ) ) ; a = d . next ( ) . value ; var e = d . next ( ) . value ; d = d . next ( ) . value . encoded ; var f = e . slice ( 1 ) ; f = f . slice ( 0 , f . indexOf ( "/" ) ) ; c && 0 <= c && ( f += "/" + c ) ; d && ( f += "/" + b ) ; "/" === e . slice ( - 1 ) && ( f += "/" ) ; a . pathname = ( new URL ( resolvePath ( f ) ) ) . pathname ; a . searchParams . get ( "url" ) && a . searchParams . set ( "url" , b ) ; return { url : a , pathname : f } } function buildUrl ( a , b , c ) { c && 0 <= c && ( a += "/" + c ) ; return a + ( "/" + b ) } ;