2017-07-04 01:23:32 +08:00
/ * !
* jsoneditor . js
*
* @ brief
* JSONEditor is a web - based tool to view , edit , format , and validate JSON .
* It has various modes such as a tree editor , a code editor , and a plain text
* editor .
*
* Supported browsers : Chrome , Firefox , Safari , Opera , Internet Explorer 8 +
*
* @ license
* Licensed under the Apache License , Version 2.0 ( the "License" ) ; you may not
* use this file except in compliance with the License . You may obtain a copy
* of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS , WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . See the
* License for the specific language governing permissions and limitations under
* the License .
*
* Copyright ( c ) 2011 - 2017 Jos de Jong , http : //jsoneditoronline.org
*
* @ author Jos de Jong , < wjosdejong @ gmail . com >
2017-12-28 23:20:32 +08:00
* @ version 5.13 . 1
2017-12-28 22:53:24 +08:00
* @ date 2017 - 12 - 28
2017-07-04 01:23:32 +08:00
* /
2017-12-19 03:42:48 +08:00
! function ( e , t ) { "object" == typeof exports && "object" == typeof module ? module . exports = t ( ) : "function" == typeof define && define . amd ? define ( [ ] , t ) : "object" == typeof exports ? exports . JSONEditor = t ( ) : e . JSONEditor = t ( ) } ( this , function ( ) { return function ( e ) { function t ( n ) { if ( i [ n ] ) return i [ n ] . exports ; var r = i [ n ] = { exports : { } , id : n , loaded : ! 1 } ; return e [ n ] . call ( r . exports , r , r . exports , t ) , r . loaded = ! 0 , r . exports } var i = { } ; return t . m = e , t . c = i , t . p = "" , t ( 0 ) } ( [ function ( e , t , i ) { "use strict" ; function n ( e , t , i ) { if ( ! ( this instanceof n ) ) throw new Error ( 'JSONEditor constructor called without "new".' ) ; var r = a . getInternetExplorerVersion ( ) ; if ( - 1 != r && r < 9 ) throw new Error ( "Unsupported browser, IE9 or newer required. Please install the newest version of your browser." ) ; if ( t && ( t . error && ( console . warn ( 'Option "error" has been renamed to "onError"' ) , t . onError = t . error , delete t . error ) , t . change && ( console . warn ( 'Option "change" has been renamed to "onChange"' ) , t . onChange = t . change , delete t . change ) , t . editable && ( console . warn ( 'Option "editable" has been renamed to "onEditable"' ) , t . onEditable = t . editable , delete t . editable ) , t ) ) { var o = [ "ajv" , "schema" , "schemaRefs" , "templates" , "ace" , "theme" , "autocomplete" , "onChange" , "onEditable" , "onError" , "onModeChange" , "escapeUnicode" , "history" , "search" , "mode" , "modes" , "name" , "indentation" , "sortObjectKeys" , "navigationBar" , "statusBar" ] ; Object . keys ( t ) . forEach ( function ( e ) { - 1 === o . indexOf ( e ) && console . warn ( 'Unknown option "' + e + '". This option will be ignored' ) } ) } arguments . length && this . _create ( e , t , i ) } var r ; try { r = i ( 1 ) } catch ( e ) { } var o = i ( 51 ) , s = i ( 64 ) , a = i ( 54 ) ; n . modes = { } , n . prototype . DEBOUNCE _INTERVAL = 150 , n . prototype . _create = function ( e , t , i ) { this . container = e , this . options = t || { } , this . json = i || { } ; var n = this . options . mode || this . options . modes && this . options . modes [ 0 ] || "tree" ; this . setMode ( n ) } , n . prototype . destroy = function ( ) { } , n . prototype . set = function ( e ) { this . json = e } , n . prototype . get = function ( ) { return this . json } , n . prototype . setText = function ( e ) { this . json = a . parse ( e ) } , n . prototype . getText = function ( ) { return JSON . stringify ( this . json ) } , n . prototype . setName = function ( e ) { this . options || ( this . options = { } ) , this . options . name = e } , n . prototype . getName = function ( ) { return this . options && this . options . name } , n . prototype . setMode = function ( e ) { var t , i , r = this . container , o = a . extend ( { } , this . options ) , s = o . mode ; o . mode = e ; var l = n . modes [ e ] ; if ( ! l ) throw new Error ( 'Unknown mode "' + o . mode + '"' ) ; try { var c = "text" == l . data ; if ( i = this . getName ( ) , t = this [ c ? "getText" : "get" ] ( ) , this . destroy ( ) , a . clear ( this ) , a . extend ( this , l . mixin ) , this . create ( r , o ) , this . setName ( i ) , this [ c ? "setText" : "set" ] ( t ) , "function" == typeof l . load ) try { l . load . call ( this ) } catch ( e ) { console . error ( e ) } if ( "function" == typeof o . onModeChange && e !== s ) try { o . onModeChange ( e , s ) } catch ( e ) { console . error ( e ) } } catch ( e ) { this . _onError ( e ) } } , n . prototype . getMode = function ( ) { return this . options . mode } , n . prototype . _onError = function ( e ) { if ( ! this . options || "function" != typeof this . options . onError ) throw e ; this . options . onError ( e ) } , n . prototype . setSchema = function ( e , t ) { if ( e ) { var i ; try { i = this . options . ajv || r ( { allErrors : ! 0 , verbose : ! 0 } ) } catch ( e ) { console . warn ( "Failed to create an instance of Ajv, JSON Schema validation is not available. Please use a JSONEditor bundle including Ajv, or pass an instance of Ajv as via the configuration option `ajv`." ) } if ( i ) { if ( t ) { for ( var n in t ) i . removeSchema ( n ) , t [ n ] && i . addSchema ( t [ n ] , n ) ; this . options . schemaRefs = t } this . validateSchema = i . compile ( e ) , this . options . schema = e , this . validate ( ) } this . refresh ( ) } else this . validateSchema = null , this . options . schema = null , this . options . schemaRefs = null , this . validate ( ) , this . refresh ( ) } , n . prototype . validate = function ( ) { } , n . prototype . refresh = function ( ) { } , n . registerMode = function ( e ) { var t , i ; if ( a . isArray ( e ) ) for ( t = 0 ; t < e . length ; t ++ ) n . registerMode ( e [ t ] ) ; else { if ( ! ( "mode" in e ) ) throw new Error ( 'Property "mode" missing' ) ; if ( ! ( "mixin" in e ) ) throw new Error ( 'Property "mixin" missing' ) ; if ( ! ( "data" in e ) ) throw new Error ( 'Property "data" missing' ) ; var r = e . mode ; if ( r in n . modes ) throw new Error ( 'Mode "' + r + '" already registered' ) ; if ( "function" != typeof e . mixin . create ) throw new Error ( 'Required function "create" missing on mixin' ) ; var o = [ "setMode" , "registerMode" , "modes" ] ; for ( t = 0 ; t < o . length ; t ++ ) if
2017-12-28 23:20:32 +08:00
if ( n += " if ( " + h + e . util . getProperty ( C ) + " !== undefined " , v && ( n += " && Object.prototype.hasOwnProperty.call(" + h + ", '" + e . util . escapeQuotes ( C ) + "') " ) , c ) { n += " && ( " ; var E = y ; if ( E ) for ( var b , F = - 1 , x = E . length - 1 ; F < x ; ) { b = E [ F += 1 ] , F && ( n += " || " ) ; var S = e . util . getProperty ( b ) , $ = h + S ; n += " ( ( " + $ + " === undefined " , v && ( n += " || ! Object.prototype.hasOwnProperty.call(" + h + ", '" + e . util . escapeQuotes ( b ) + "') " ) , n += ") && (missing" + r + " = " + e . util . toQuotedString ( e . opts . jsonPointers ? b : S ) + ") ) " } n += ")) { " ; var D = "missing" + r , k = "' + " + D + " + '" ; e . opts . _errorDataPathProperty && ( e . errorPath = e . opts . jsonPointers ? e . util . getPathExpr ( A , D , ! 0 ) : A + " + " + D ) ; var B = B || [ ] ; B . push ( n ) , n = "" , ! 1 !== e . createErrors ? ( n += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + e . errorPath + " , schemaPath: " + e . util . toQuotedString ( l ) + " , params: { property: '" + e . util . escapeQuotes ( C ) + "', missingProperty: '" + k + "', depsCount: " + y . length + ", deps: '" + e . util . escapeQuotes ( 1 == y . length ? y [ 0 ] : y . join ( ", " ) ) + "' } " , ! 1 !== e . opts . messages && ( n += " , message: 'should have " , 1 == y . length ? n += "property " + e . util . escapeQuotes ( y [ 0 ] ) : n += "properties " + e . util . escapeQuotes ( y . join ( ", " ) ) , n += " when property " + e . util . escapeQuotes ( C ) + " is present' " ) , e . opts . verbose && ( n += " , schema: validate.schema" + a + " , parentSchema: validate.schema" + e . schemaPath + " , data: " + h + " " ) , n += " } " ) : n += " {} " ; var _ = n ; n = B . pop ( ) , ! e . compositeRule && c ? e . async ? n += " throw new ValidationError([" + _ + "]); " : n += " validate.errors = [" + _ + "]; return false; " : n += " var err = " + _ + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; " } else { n += " ) { " ; var L = y ; if ( L ) for ( var b , R = - 1 , T = L . length - 1 ; R < T ; ) { b = L [ R += 1 ] ; var S = e . util . getProperty ( b ) , k = e . util . escapeQuotes ( b ) , $ = h + S ; e . opts . _errorDataPathProperty && ( e . errorPath = e . util . getPath ( A , b , e . opts . jsonPointers ) ) , n += " if ( " + $ + " === undefined " , v && ( n += " || ! Object.prototype.hasOwnProperty.call(" + h + ", '" + e . util . escapeQuotes ( b ) + "') " ) , n += ") { var err = " , ! 1 !== e . createErrors ? ( n += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + e . errorPath + " , schemaPath: " + e . util . toQuotedString ( l ) + " , params: { property: '" + e . util . escapeQuotes ( C ) + "', missingProperty: '" + k + "', depsCount: " + y . length + ", deps: '" + e . util . escapeQuotes ( 1 == y . length ? y [ 0 ] : y . join ( ", " ) ) + "' } " , ! 1 !== e . opts . messages && ( n += " , message: 'should have " , 1 == y . length ? n += "property " + e . util . escapeQuotes ( y [ 0 ] ) : n += "properties " + e . util . escapeQuotes ( y . join ( ", " ) ) , n += " when property " + e . util . escapeQuotes ( C ) + " is present' " ) , e . opts . verbose && ( n += " , schema: validate.schema" + a + " , parentSchema: validate.schema" + e . schemaPath + " , data: " + h + " " ) , n += " } " ) : n += " {} " , n += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } " } } n += " } " , c && ( f += "}" , n += " else { " ) } e . errorPath = A ; var P = d . baseId ; for ( var C in m ) { var w = m [ C ] ; e . util . schemaHasRules ( w , e . RULES . all ) && ( n += " " + p + " = true; if ( " + h + e . util . getProperty ( C ) + " !== undefined " , v && ( n += " && Object.prototype.hasOwnProperty.call(" + h + ", '" + e . util . escapeQuotes ( C ) + "') " ) , n += ") { " , d . schema = w , d . schemaPath = a + e . util . getProperty ( C ) , d . errSchemaPath = l + "/" + e . util . escapeFragment ( C ) , n += " " + e . validate ( d ) + " " , d . baseId = P , n += " } " , c && ( n += " if (" + p + ") { " , f += "}" ) ) } return c && ( n += " " + f + " if (" + u + " == errors) {" ) , n = e . util . cleanUpCode ( n ) } } , function ( e , t ) { "use strict" ; e . exports = function ( e , t , i ) { var n = " " , r = e . level , o = e . dataLevel , s = e . schema [ t ] , a = e . schemaPath + e . util . getProperty ( t ) , l = e . errSchemaPath + "/" + t , c = ! e . opts . allErrors , h = "data" + ( o || "" ) , u = "valid" + r , d = e . opts . $data && s && s . $data ; d && ( n += " var schema" + r + " = " + e . util . getData ( s . $data , o , e . dataPathArr ) + "; " ) ; var f = "i" + r , p = "schema" + r ; d || ( n += " var " + p + " = validate.schema" + a + ";" ) , n += "var " + u + ";" , d && ( n += " if (schema" + r + " === undefined) " + u + " = true; else if (!Array.isArray(schema" + r + ")) " + u + " = false; else {" ) , n += u + " = false;for (var " + f + "=0; " + f + "<" + p + ".length; " + f + "++) if (equal(" + h + ", " + p + "[" + f + "])) { " + u + " = true; break; }" , d && ( n += " } " ) , n += " if (!" + u + ") { " ; var m = m || [ ] ; m . push ( n ) , n = "" , ! 1 !== e . createErrors ? ( n += " { keyword: 'enum' , dataPath: (dataPath || '') + " + e . errorPath + " , schemaPath: " + e . util . toQuotedString ( l ) + " , params: { allowedValues: schema" + r + " } " ,
2017-12-28 22:53:24 +08:00
; i && n && ( this . multiselection . nodes = this . _findTopLevelNodes ( i , n ) , this . select ( this . multiselection . nodes ) ) } } , d . _onMultiSelectEnd = function ( e ) { this . multiselection . nodes [ 0 ] && this . multiselection . nodes [ 0 ] . dom . menu . focus ( ) , this . multiselection . start = null , this . multiselection . end = null , this . mousemove && ( h . removeEventListener ( window , "mousemove" , this . mousemove ) , delete this . mousemove ) , this . mouseup && ( h . removeEventListener ( window , "mouseup" , this . mouseup ) , delete this . mouseup ) } , d . deselect = function ( e ) { this . multiselection . nodes . forEach ( function ( e ) { e . setSelected ( ! 1 ) } ) , this . multiselection . nodes = [ ] , e && ( this . multiselection . start = null , this . multiselection . end = null ) } , d . select = function ( e ) { if ( ! Array . isArray ( e ) ) return this . select ( [ e ] ) ; if ( e ) { this . deselect ( ) , this . multiselection . nodes = e . slice ( 0 ) ; var t = e [ 0 ] ; e . forEach ( function ( e ) { e . setSelected ( ! 0 , e === t ) } ) } } , d . _findTopLevelNodes = function ( e , t ) { for ( var i = e . getNodePath ( ) , n = t . getNodePath ( ) , r = 0 ; r < i . length && i [ r ] === n [ r ] ; ) r ++ ; var o = i [ r - 1 ] , s = i [ r ] , a = n [ r ] ; if ( s && a || ( o . parent ? ( s = o , a = o , o = o . parent ) : ( s = o . childs [ 0 ] , a = o . childs [ o . childs . length - 1 ] ) ) , o && s && a ) { var l = o . childs . indexOf ( s ) , c = o . childs . indexOf ( a ) , h = Math . min ( l , c ) , u = Math . max ( l , c ) ; return o . childs . slice ( h , u + 1 ) } return [ ] } , d . _onKeyDown = function ( e ) { var t = e . which || e . keyCode , i = e . altKey , n = e . ctrlKey , r = e . metaKey , o = e . shiftKey , s = ! 1 ; if ( 9 == t ) { var a = this ; setTimeout ( function ( ) { h . selectContentEditable ( a . focusTarget ) } , 0 ) } if ( this . searchBox ) if ( n && 70 == t ) this . searchBox . dom . search . focus ( ) , this . searchBox . dom . search . select ( ) , s = ! 0 ; else if ( 114 == t || n && 71 == t ) { o ? this . searchBox . previous ( ! 0 ) : this . searchBox . next ( ! 0 ) , s = ! 0 } if ( this . history && ( n && ! o && 90 == t ? ( this . _onUndo ( ) , s = ! 0 ) : n && o && 90 == t && ( this . _onRedo ( ) , s = ! 0 ) ) , this . options . autocomplete && ! s && ! ( n || i || r || 1 != e . key . length && 8 != t && 46 != t ) ) { s = ! 1 ; var c = "" ; e . target . className . indexOf ( "jsoneditor-value" ) >= 0 && ( c = "value" ) , e . target . className . indexOf ( "jsoneditor-field" ) >= 0 && ( c = "field" ) ; var u = l . getNodeFromTarget ( e . target ) ; setTimeout ( function ( e , t ) { if ( t . innerText . length > 0 ) { var i = this . options . autocomplete . getOptions ( t . innerText , e . getPath ( ) , c , e . editor ) ; "function" == typeof i . then ? i . then ( function ( e ) { e . options ? this . autocomplete . show ( t , e . startFrom , e . options ) : this . autocomplete . show ( t , 0 , e ) } . bind ( this ) ) : i . options ? this . autocomplete . show ( t , i . startFrom , i . options ) : this . autocomplete . show ( t , 0 , i ) } else this . autocomplete . hideDropDown ( ) } . bind ( this , u , e . target ) , 50 ) } s && ( e . preventDefault ( ) , e . stopPropagation ( ) ) } , d . _createTable = function ( ) { var e = document . createElement ( "div" ) ; e . className = "jsoneditor-outer" , this . options . navigationBar && h . addClassName ( e , "has-nav-bar" ) , this . contentOuter = e , this . content = document . createElement ( "div" ) , this . content . className = "jsoneditor-tree" , e . appendChild ( this . content ) , this . table = document . createElement ( "table" ) , this . table . className = "jsoneditor-tree" , this . content . appendChild ( this . table ) ; var t ; this . colgroupContent = document . createElement ( "colgroup" ) , "tree" === this . options . mode && ( t = document . createElement ( "col" ) , t . width = "24px" , this . colgroupContent . appendChild ( t ) ) , t = document . createElement ( "col" ) , t . width = "24px" , this . colgroupContent . appendChild ( t ) , t = document . createElement ( "col" ) , this . colgroupContent . appendChild ( t ) , this . table . appendChild ( this . colgroupContent ) , this . tbody = document . createElement ( "tbody" ) , this . table . appendChild ( this . tbody ) , this . frame . appendChild ( e ) } , d . showContextMenu = function ( e , t ) { var i = [ ] , n = this ; i . push ( { text : "Duplicate" , title : "Duplicate selected fields (Ctrl+D)" , className : "jsoneditor-duplicate" , click : function ( ) { l . onDuplicate ( n . multiselection . nodes ) } } ) , i . push ( { text : "Remove" , title : "Remove selected fields (Ctrl+Del)" , className : "jsoneditor-remove" , click : function ( ) { l . onRemove ( n . multiselection . nodes ) } } ) , new s ( i , { close : t } ) . show ( e , this . content ) } , e . exports = [ { mode : "tree" , mixin : d , data : "json" } , { mode : "view" , mixin : d , data : "json" } , { mode : "form" , mixin : d , data : "json" } ] } , function ( e , t ) { "use strict" ; function i ( ) { this . locked = ! 1 } i . prototype . highlight = function ( e ) { this . locked || ( this . node != e && ( this . node && this . node . setHighlight ( ! 1 ) , this . node = e , this . node . setHighlight ( ! 0 ) ) , this . _cancelUnhighlight ( ) ) } , i . prototype . unhighlight = function ( ) { if ( ! this . locked ) { var e = this ; this . node && ( this . _cancelUnhighlight ( ) , this . u
this . editor . _onAction ( "moveNodes" , { nodes : y , oldBeforeNode : c , newBeforeNode : t , oldSelection : s , newSelection : this . editor . getSelection ( ) } ) ) , v = ! 0 ) ; else if ( 39 == d ) { if ( g && ! m ) { var k = this . _nextElement ( f ) ; k && this . focus ( this . _getElementName ( k ) ) , v = ! 0 } else if ( g && m && w ) { D = A . getDom ( ) ; var B = D . previousSibling ; B && ( t = n . getNodeFromTarget ( B ) ) && t . parent && t instanceof l && ! t . isVisible ( ) && ( s = this . editor . getSelection ( ) , c = C . _nextSibling ( ) , y . forEach ( function ( e ) { t . parent . moveBefore ( e , t ) } ) , this . focus ( n . focusElement || this . _getElementName ( f ) ) , this . editor . _onAction ( "moveNodes" , { nodes : y , oldBeforeNode : c , newBeforeNode : t , oldSelection : s , newSelection : this . editor . getSelection ( ) } ) ) } } else if ( 40 == d ) if ( g && ! m ) i = this . _nextNode ( ) , i && ( this . editor . deselect ( ! 0 ) , i . focus ( n . focusElement || this . _getElementName ( f ) ) ) , v = ! 0 ; else if ( ! g && p && m && w ) i = this . _nextNode ( ) , i && ( u = this . editor . multiselection , u . start = u . start || this , u . end = i , h = this . editor . _findTopLevelNodes ( u . start , u . end ) , this . editor . select ( h ) , i . focus ( "field" ) ) , v = ! 0 ; else if ( g && m && w ) { i = C . expanded ? C . append ? C . append . _nextNode ( ) : void 0 : C . _nextNode ( ) ; var _ = i && ( i . _nextNode ( ) || i . parent . append ) ; _ && _ . parent && ( s = this . editor . getSelection ( ) , c = C . _nextSibling ( ) , y . forEach ( function ( e ) { _ . parent . moveBefore ( e , _ ) } ) , this . focus ( n . focusElement || this . _getElementName ( f ) ) , this . editor . _onAction ( "moveNodes" , { nodes : y , oldBeforeNode : c , newBeforeNode : _ , oldSelection : s , newSelection : this . editor . getSelection ( ) } ) ) , v = ! 0 } v && ( e . preventDefault ( ) , e . stopPropagation ( ) ) } , n . prototype . _onExpand = function ( e ) { if ( e ) { var t = this . dom . tr . parentNode , i = t . parentNode , n = i . scrollTop ; i . removeChild ( t ) } this . expanded ? this . collapse ( e ) : this . expand ( e ) , e && ( i . appendChild ( t ) , i . scrollTop = n ) } , n . onRemove = function ( e ) { if ( ! Array . isArray ( e ) ) return n . onRemove ( [ e ] ) ; if ( e && e . length > 0 ) { var t = e [ 0 ] , i = t . parent , r = t . editor , o = t . getIndex ( ) ; r . highlighter . unhighlight ( ) ; var s = r . getSelection ( ) ; n . blurNodes ( e ) ; var a = r . getSelection ( ) ; e . forEach ( function ( e ) { e . parent . _remove ( e ) } ) , r . _onAction ( "removeNodes" , { nodes : e . slice ( 0 ) , parent : i , index : o , oldSelection : s , newSelection : a } ) } } , n . onDuplicate = function ( e ) { if ( ! Array . isArray ( e ) ) return n . onDuplicate ( [ e ] ) ; if ( e && e . length > 0 ) { var t = e [ e . length - 1 ] , i = t . parent , r = t . editor ; r . deselect ( r . multiselection . nodes ) ; var o = r . getSelection ( ) , s = t , a = e . map ( function ( e ) { var t = e . clone ( ) ; return i . insertAfter ( t , s ) , s = t , t } ) ; 1 === e . length ? a [ 0 ] . focus ( ) : r . select ( a ) ; var l = r . getSelection ( ) ; r . _onAction ( "duplicateNodes" , { afterNode : t , nodes : a , parent : i , oldSelection : o , newSelection : l } ) } } , n . prototype . _onInsertBefore = function ( e , t , i ) { var r = this . editor . getSelection ( ) , o = new n ( this . editor , { field : void 0 != e ? e : "" , value : void 0 != t ? t : "" , type : i } ) ; o . expand ( ! 0 ) , this . parent . insertBefore ( o , this ) , this . editor . highlighter . unhighlight ( ) , o . focus ( "field" ) ; var s = this . editor . getSelection ( ) ; this . editor . _onAction ( "insertBeforeNodes" , { nodes : [ o ] , beforeNode : this , parent : this . parent , oldSelection : r , newSelection : s } ) } , n . prototype . _onInsertAfter = function ( e , t , i ) { var r = this . editor . getSelection ( ) , o = new n ( this . editor , { field : void 0 != e ? e : "" , value : void 0 != t ? t : "" , type : i } ) ; o . expand ( ! 0 ) , this . parent . insertAfter ( o , this ) , this . editor . highlighter . unhighlight ( ) , o . focus ( "field" ) ; var s = this . editor . getSelection ( ) ; this . editor . _onAction ( "insertAfterNodes" , { nodes : [ o ] , afterNode : this , parent : this . parent , oldSelection : r , newSelection : s } ) } , n . prototype . _onAppend = function ( e , t , i ) { var r = this . editor . getSelection ( ) , o = new n ( this . editor , { field : void 0 != e ? e : "" , value : void 0 != t ? t : "" , type : i } ) ; o . expand ( ! 0 ) , this . parent . appendChild ( o ) , this . editor . highlighter . unhighlight ( ) , o . focus ( "field" ) ; var s = this . editor . getSelection ( ) ; this . editor . _onAction ( "appendNodes" , { nodes : [ o ] , parent : this . parent , oldSelection : r , newSelection : s } ) } , n . prototype . _onChangeType = function ( e ) { var t = this . type ; if ( e != t ) { var i = this . editor . getSelection ( ) ; this . changeType ( e ) ; var n = this . editor . getSelection ( ) ; this . editor . _onAction ( "changeType" , { node : this , oldType : t , newType : e , oldSelection : i , newSelection : n } ) } } , n . prototype . sort = function ( e ) { if ( this . _hasChilds ( ) ) { var t = "desc" == e ? - 1 : 1 , i = "array" == this . type ? "value" : "field" ; this . hideChilds ( ) ; var n = this . childs , o = this . sortOrder ; this . childs = this . childs . concat ( ) , this . childs . sort ( function ( e , n ) { return t * r ( e [ i ] , n [ i ] ) } ) , this . sort
t . onCommandKey ( null , l . shift | l . option , a . left ) ; break ; case 3 : t . onCommandKey ( null , l . shift , a . left ) } } } } ; document . addEventListener ( "selectionchange" , V ) , t . on ( "destroy" , function ( ) { document . removeEventListener ( "selectionchange" , V ) } ) } } ; t . TextInput = u } ) , ace . define ( "ace/keyboard/textinput" , [ "require" , "exports" , "module" , "ace/lib/event" , "ace/lib/useragent" , "ace/lib/dom" , "ace/lib/lang" , "ace/keyboard/textinput_ios" ] , function ( e , t , i ) { "use strict" ; var n = e ( "../lib/event" ) , r = e ( "../lib/useragent" ) , o = e ( "../lib/dom" ) , s = e ( "../lib/lang" ) , a = r . isChrome < 18 , l = r . isIE , c = e ( "./textinput_ios" ) . TextInput , h = function ( e , t ) { function i ( e ) { if ( ! g ) { if ( g = ! 0 , F ) var t = 0 , i = e ? 0 : d . value . length - 1 ; else var t = e ? 2 : 1 , i = 2 ; try { d . setSelectionRange ( t , i ) } catch ( e ) { } g = ! 1 } } function h ( ) { g || ( d . value = f , r . isWebKit && C . schedule ( ) ) } function u ( ) { clearTimeout ( O ) , O = setTimeout ( function ( ) { v && ( d . style . cssText = v , v = "" ) , null == t . renderer . $keepTextAreaAtCursor && ( t . renderer . $keepTextAreaAtCursor = ! 0 , t . renderer . $moveTextAreaToCursor ( ) ) } , 0 ) } if ( r . isIOS ) return c . call ( this , e , t ) ; var d = o . createElement ( "textarea" ) ; d . className = "ace_text-input" , d . setAttribute ( "wrap" , "off" ) , d . setAttribute ( "autocorrect" , "off" ) , d . setAttribute ( "autocapitalize" , "off" ) , d . setAttribute ( "spellcheck" , ! 1 ) , d . style . opacity = "0" , e . insertBefore ( d , e . firstChild ) ; var f = "\u2028\u2028" , p = ! 1 , m = ! 1 , g = ! 1 , v = "" , w = ! 0 ; try { var y = document . activeElement === d } catch ( e ) { } n . addListener ( d , "blur" , function ( e ) { t . onBlur ( e ) , y = ! 1 } ) , n . addListener ( d , "focus" , function ( e ) { y = ! 0 , t . onFocus ( e ) , i ( ) } ) , this . focus = function ( ) { if ( v ) return d . focus ( ) ; var e = d . style . top ; d . style . position = "fixed" , d . style . top = "0px" , d . focus ( ) , setTimeout ( function ( ) { d . style . position = "" , "0px" == d . style . top && ( d . style . top = e ) } , 0 ) } , this . blur = function ( ) { d . blur ( ) } , this . isFocused = function ( ) { return y } ; var A = s . delayedCall ( function ( ) { y && i ( w ) } ) , C = s . delayedCall ( function ( ) { g || ( d . value = f , y && i ( ) ) } ) ; r . isWebKit || t . addEventListener ( "changeSelection" , function ( ) { t . selection . isEmpty ( ) != w && ( w = ! w , A . schedule ( ) ) } ) , h ( ) , y && t . onFocus ( ) ; var E = function ( e ) { return 0 === e . selectionStart && e . selectionEnd === e . value . length } , b = function ( e ) { p ? p = ! 1 : E ( d ) ? ( t . selectAll ( ) , i ( ) ) : F && i ( t . selection . isEmpty ( ) ) } , F = null ; this . setInputHandler = function ( e ) { F = e } , this . getInputHandler = function ( ) { return F } ; var x = ! 1 , S = function ( e ) { F && ( e = F ( e ) , F = null ) , m ? ( i ( ) , e && t . onPaste ( e ) , m = ! 1 ) : e == f . charAt ( 0 ) ? x ? t . execCommand ( "del" , { source : "ace" } ) : t . execCommand ( "backspace" , { source : "ace" } ) : ( e . substring ( 0 , 2 ) == f ? e = e . substr ( 2 ) : e . charAt ( 0 ) == f . charAt ( 0 ) ? e = e . substr ( 1 ) : e . charAt ( e . length - 1 ) == f . charAt ( 0 ) && ( e = e . slice ( 0 , - 1 ) ) , e . charAt ( e . length - 1 ) == f . charAt ( 0 ) && ( e = e . slice ( 0 , - 1 ) ) , e && t . onTextInput ( e ) ) , x && ( x = ! 1 ) } , $ = function ( e ) { if ( ! g ) { var t = d . value ; S ( t ) , h ( ) } } , D = function ( e , t , i ) { var n = e . clipboardData || window . clipboardData ; if ( n && ! a ) { var r = l || i ? "Text" : "text/plain" ; try { return t ? ! 1 !== n . setData ( r , t ) : n . getData ( r ) } catch ( e ) { if ( ! i ) return D ( e , t , ! 0 ) } } } , k = function ( e , r ) { var o = t . getCopyText ( ) ; if ( ! o ) return n . preventDefault ( e ) ; D ( e , o ) ? ( r ? t . onCut ( ) : t . onCopy ( ) , n . preventDefault ( e ) ) : ( p = ! 0 , d . value = o , d . select ( ) , setTimeout ( function ( ) { p = ! 1 , h ( ) , i ( ) , r ? t . onCut ( ) : t . onCopy ( ) } ) ) } , B = function ( e ) { k ( e , ! 0 ) } , _ = function ( e ) { k ( e , ! 1 ) } , L = function ( e ) { var o = D ( e ) ; "string" == typeof o ? ( o && t . onPaste ( o , e ) , r . isIE && setTimeout ( i ) , n . preventDefault ( e ) ) : ( d . value = "" , m = ! 0 ) } ; n . addCommandKeyListener ( d , t . onCommandKey . bind ( t ) ) , n . addListener ( d , "select" , b ) , n . addListener ( d , "input" , $ ) , n . addListener ( d , "cut" , B ) , n . addListener ( d , "copy" , _ ) , n . addListener ( d , "paste" , L ) , "oncut" in d && "oncopy" in d && "onpaste" in d || n . addListener ( e , "keydown" , function ( e ) { if ( ( ! r . isMac || e . metaKey ) && e . ctrlKey ) switch ( e . keyCode ) { case 67 : _ ( e ) ; break ; case 86 : L ( e ) ; break ; case 88 : B ( e ) } } ) ; var R = function ( e ) { g || ! t . onCompositionStart || t . $readOnly || ( g = { } , g . canUndo = t . session . $undoManager , t . onCompositionStart ( ) , setTimeout ( T , 0 ) , t . on ( "mousedown" , P ) , g . canUndo && ! t . selection . isEmpty ( ) && ( t . insert ( "" ) , t . session . markUndoGroup ( ) , t . selection . clearSelection ( ) ) , t . session . markUndoGroup ( ) ) } , T = function ( ) { if ( g && t . onCompositionUpdate && ! t . $readOnly ) { var e = d . value . replace ( /\u2028/g , "" ) ; if ( g . lastValue !== e && ( t . onCompositionUpdate ( e ) , g . lastValue && t . undo ( ) , g . canUndo && ( g . lastValue = e ) , g . lastValue ) ) { var i = t . selection . getRange ( ) ; t . insert ( g . lastValue ) , t . sess
} , t = function ( e , t ) { return t . shift ( ) , t . shift ( ) || "start" } ; this . normalizeRules = function ( ) { function i ( o ) { var s = r [ o ] ; s . processed = ! 0 ; for ( var a = 0 ; a < s . length ; a ++ ) { var l = s [ a ] , c = null ; Array . isArray ( l ) && ( c = l , l = { } ) , ! l . regex && l . start && ( l . regex = l . start , l . next || ( l . next = [ ] ) , l . next . push ( { defaultToken : l . token } , { token : l . token + ".end" , regex : l . end || l . start , next : "pop" } ) , l . token = l . token + ".start" , l . push = ! 0 ) ; var h = l . next || l . push ; if ( h && Array . isArray ( h ) ) { var u = l . stateName ; u || ( u = l . token , "string" != typeof u && ( u = u [ 0 ] || "" ) , r [ u ] && ( u += n ++ ) ) , r [ u ] = h , l . next = u , i ( u ) } else "pop" == h && ( l . next = t ) ; if ( l . push && ( l . nextState = l . next || l . push , l . next = e , delete l . push ) , l . rules ) for ( var d in l . rules ) r [ d ] ? r [ d ] . push && r [ d ] . push . apply ( r [ d ] , l . rules [ d ] ) : r [ d ] = l . rules [ d ] ; var f = "string" == typeof l ? l : l . include ; if ( f && ( c = Array . isArray ( f ) ? f . map ( function ( e ) { return r [ e ] } ) : r [ f ] ) , c ) { var p = [ a , 1 ] . concat ( c ) ; l . noEscape && ( p = p . filter ( function ( e ) { return ! e . next } ) ) , s . splice . apply ( s , p ) , a -- } l . keywordMap && ( l . token = this . createKeywordMapper ( l . keywordMap , l . defaultToken || "text" , l . caseInsensitive ) , delete l . defaultToken ) } } var n = 0 , r = this . $rules ; Object . keys ( r ) . forEach ( i , this ) } , this . createKeywordMapper = function ( e , t , i , n ) { var r = Object . create ( null ) ; return Object . keys ( e ) . forEach ( function ( t ) { var o = e [ t ] ; i && ( o = o . toLowerCase ( ) ) ; for ( var s = o . split ( n || "|" ) , a = s . length ; a -- ; ) r [ s [ a ] ] = t } ) , Object . getPrototypeOf ( r ) && ( r . _ _proto _ _ = null ) , this . $keywordList = Object . keys ( r ) , e = null , i ? function ( e ) { return r [ e . toLowerCase ( ) ] || t } : function ( e ) { return r [ e ] || t } } , this . getKeywords = function ( ) { return this . $keywords } } ) . call ( r . prototype ) , t . TextHighlightRules = r } ) , ace . define ( "ace/mode/behaviour" , [ "require" , "exports" , "module" ] , function ( e , t , i ) { "use strict" ; var n = function ( ) { this . $behaviours = { } } ; ( function ( ) { this . add = function ( e , t , i ) { switch ( void 0 ) { case this . $behaviours : this . $behaviours = { } ; case this . $behaviours [ e ] : this . $behaviours [ e ] = { } } this . $behaviours [ e ] [ t ] = i } , this . addBehaviours = function ( e ) { for ( var t in e ) for ( var i in e [ t ] ) this . add ( t , i , e [ t ] [ i ] ) } , this . remove = function ( e ) { this . $behaviours && this . $behaviours [ e ] && delete this . $behaviours [ e ] } , this . inherit = function ( e , t ) { if ( "function" == typeof e ) var i = ( new e ) . getBehaviours ( t ) ; else var i = e . getBehaviours ( t ) ; this . addBehaviours ( i ) } , this . getBehaviours = function ( e ) { if ( e ) { for ( var t = { } , i = 0 ; i < e . length ; i ++ ) this . $behaviours [ e [ i ] ] && ( t [ e [ i ] ] = this . $behaviours [ e [ i ] ] ) ; return t } return this . $behaviours } } ) . call ( n . prototype ) , t . Behaviour = n } ) , ace . define ( "ace/token_iterator" , [ "require" , "exports" , "module" , "ace/range" ] , function ( e , t , i ) { "use strict" ; var n = e ( "./range" ) . Range , r = function ( e , t , i ) { this . $session = e , this . $row = t , this . $rowTokens = e . getTokens ( t ) ; var n = e . getTokenAt ( t , i ) ; this . $tokenIndex = n ? n . index : - 1 } ; ( function ( ) { this . stepBackward = function ( ) { for ( this . $tokenIndex -= 1 ; this . $tokenIndex < 0 ; ) { if ( this . $row -= 1 , this . $row < 0 ) return this . $row = 0 , null ; this . $rowTokens = this . $session . getTokens ( this . $row ) , this . $tokenIndex = this . $rowTokens . length - 1 } return this . $rowTokens [ this . $tokenIndex ] } , this . stepForward = function ( ) { this . $tokenIndex += 1 ; for ( var e ; this . $tokenIndex >= this . $rowTokens . length ; ) { if ( this . $row += 1 , e || ( e = this . $session . getLength ( ) ) , this . $row >= e ) return this . $row = e - 1 , null ; this . $rowTokens = this . $session . getTokens ( this . $row ) , this . $tokenIndex = 0 } return this . $rowTokens [ this . $tokenIndex ] } , this . getCurrentToken = function ( ) { return this . $rowTokens [ this . $tokenIndex ] } , this . getCurrentTokenRow = function ( ) { return this . $row } , this . getCurrentTokenColumn = function ( ) { var e = this . $rowTokens , t = this . $tokenIndex , i = e [ t ] . start ; if ( void 0 !== i ) return i ; for ( i = 0 ; t > 0 ; ) t -= 1 , i += e [ t ] . value . length ; return i } , this . getCurrentTokenPosition = function ( ) { return { row : this . $row , column : this . getCurrentTokenColumn ( ) } } , this . getCurrentTokenRange = function ( ) { var e = this . $rowTokens [ this . $tokenIndex ] , t = this . getCurrentTokenColumn ( ) ; return new n ( this . $row , t , this . $row , t + e . value . length ) } } ) . call ( r . prototype ) , t . TokenIterator = r } ) , ace . define ( "ace/mode/behaviour/cstyle" , [ "require" , "exports" , "module" , "ace/lib/oop" , "ace/mode/behaviour" , "ace/token_iterator" , "ace/lib/lang" ] , function ( e , t , i ) { "use strict" ; var n , r = e ( "../../lib/oop" ) , o = e ( "../behaviour" ) . Behaviour , s = e ( "../../token_iterator" ) . TokenIterator , a = e ( "../../lib/lang" ) , l = [ "text" , " paren . rpa
; for ( var p = 0 ; p < n . length ; p ++ ) { var m = n [ p ] ; if ( c == m . start . row ) { m . addFold ( i ) , r = ! 0 ; break } if ( a == m . end . row ) { if ( m . addFold ( i ) , r = ! 0 , ! i . sameRow ) { var g = n [ p + 1 ] ; if ( g && g . start . row == c ) { m . merge ( g ) ; break } } break } if ( c <= m . start . row ) break } return r || ( m = this . $addFoldLine ( new o ( this . $foldData , i ) ) ) , this . $useWrapMode ? this . $updateWrapData ( m . start . row , m . start . row ) : this . $updateRowLengthCache ( m . start . row , m . start . row ) , this . $modified = ! 0 , this . _signal ( "changeFold" , { data : i , action : "add" } ) , i } , this . addFolds = function ( e ) { e . forEach ( function ( e ) { this . addFold ( e ) } , this ) } , this . removeFold = function ( e ) { var t = e . foldLine , i = t . start . row , n = t . end . row , r = this . $foldData , o = t . folds ; if ( 1 == o . length ) r . splice ( r . indexOf ( t ) , 1 ) ; else if ( t . range . isEnd ( e . end . row , e . end . column ) ) o . pop ( ) , t . end . row = o [ o . length - 1 ] . end . row , t . end . column = o [ o . length - 1 ] . end . column ; else if ( t . range . isStart ( e . start . row , e . start . column ) ) o . shift ( ) , t . start . row = o [ 0 ] . start . row , t . start . column = o [ 0 ] . start . column ; else if ( e . sameRow ) o . splice ( o . indexOf ( e ) , 1 ) ; else { var s = t . split ( e . start . row , e . start . column ) ; o = s . folds , o . shift ( ) , s . start . row = o [ 0 ] . start . row , s . start . column = o [ 0 ] . start . column } this . $updating || ( this . $useWrapMode ? this . $updateWrapData ( i , n ) : this . $updateRowLengthCache ( i , n ) ) , this . $modified = ! 0 , this . _signal ( "changeFold" , { data : e , action : "remove" } ) } , this . removeFolds = function ( e ) { for ( var t = [ ] , i = 0 ; i < e . length ; i ++ ) t . push ( e [ i ] ) ; t . forEach ( function ( e ) { this . removeFold ( e ) } , this ) , this . $modified = ! 0 } , this . expandFold = function ( e ) { this . removeFold ( e ) , e . subFolds . forEach ( function ( t ) { e . restoreRange ( t ) , this . addFold ( t ) } , this ) , e . collapseChildren > 0 && this . foldAll ( e . start . row + 1 , e . end . row , e . collapseChildren - 1 ) , e . subFolds = [ ] } , this . expandFolds = function ( e ) { e . forEach ( function ( e ) { this . expandFold ( e ) } , this ) } , this . unfold = function ( e , t ) { var i , n ; if ( null == e ? ( i = new r ( 0 , 0 , this . getLength ( ) , 0 ) , t = ! 0 ) : i = "number" == typeof e ? new r ( e , 0 , e , this . getLine ( e ) . length ) : "row" in e ? r . fromPoints ( e , e ) : e , n = this . getFoldsInRangeList ( i ) , t ) this . removeFolds ( n ) ; else for ( var o = n ; o . length ; ) this . expandFolds ( o ) , o = this . getFoldsInRangeList ( i ) ; if ( n . length ) return n } , this . isRowFolded = function ( e , t ) { return ! ! this . getFoldLine ( e , t ) } , this . getRowFoldEnd = function ( e , t ) { var i = this . getFoldLine ( e , t ) ; return i ? i . end . row : e } , this . getRowFoldStart = function ( e , t ) { var i = this . getFoldLine ( e , t ) ; return i ? i . start . row : e } , this . getFoldDisplayLine = function ( e , t , i , n , r ) { null == n && ( n = e . start . row ) , null == r && ( r = 0 ) , null == t && ( t = e . end . row ) , null == i && ( i = this . getLine ( t ) . length ) ; var o = this . doc , s = "" ; return e . walk ( function ( e , t , i , a ) { if ( ! ( t < n ) ) { if ( t == n ) { if ( i < r ) return ; a = Math . max ( r , a ) } s += null != e ? e : o . getLine ( t ) . substring ( a , i ) } } , t , i ) , s } , this . getDisplayLine = function ( e , t , i , n ) { var r = this . getFoldLine ( e ) ; if ( r ) return this . getFoldDisplayLine ( r , e , t , i , n ) ; var o ; return o = this . doc . getLine ( e ) , o . substring ( n || 0 , t || o . length ) } , this . $cloneFoldData = function ( ) { var e = [ ] ; return e = this . $foldData . map ( function ( t ) { var i = t . folds . map ( function ( e ) { return e . clone ( ) } ) ; return new o ( e , i ) } ) } , this . toggleFold = function ( e ) { var t , i , n = this . selection , r = n . getRange ( ) ; if ( r . isEmpty ( ) ) { var o = r . start ; if ( t = this . getFoldAt ( o . row , o . column ) ) return void this . expandFold ( t ) ; ( i = this . findMatchingBracket ( o ) ) ? 1 == r . comparePoint ( i ) ? r . end = i : ( r . start = i , r . start . column ++ , r . end . column -- ) : ( i = this . findMatchingBracket ( { row : o . row , column : o . column + 1 } ) ) ? ( 1 == r . comparePoint ( i ) ? r . end = i : r . start = i , r . start . column ++ ) : r = this . getCommentFoldRange ( o . row , o . column ) || r } else { var s = this . getFoldsInRange ( r ) ; if ( e && s . length ) return void this . expandFolds ( s ) ; 1 == s . length && ( t = s [ 0 ] ) } if ( t || ( t = this . getFoldAt ( r . start . row , r . start . column ) ) , t && t . range . toString ( ) == r . toString ( ) ) return void this . expandFold ( t ) ; var a = "..." ; if ( ! r . isMultiLine ( ) ) { if ( a = this . getTextRange ( r ) , a . length < 4 ) return ; a = a . trim ( ) . substring ( 0 , 2 ) + ".." } this . addFold ( a , r ) } , this . getCommentFoldRange = function ( e , t , i ) { var n = new a ( this , e , t ) , o = n . getCurrentToken ( ) , s = o . type ; if ( o && /^comment|string/ . test ( s ) ) { s = s . match ( /comment|string/ ) [ 0 ] , "comment" == s && ( s += "|doc-start" ) ; var l = new RegExp ( s ) , c = new r ; if ( 1 != i ) { do { o = n . stepBackward ( ) } while ( o && l . test ( o . type ) ) ; n . stepForward ( ) } if ( c . start . row = n . getCurrentTokenRow ( ) , c . start . column = n . getCurrentTokenColumn ( ) + 2 , n = new a ( this , e , t ) , - 1 != i ) { var h = - 1 ; do { if ( o = n . stepForward ( ) , - 1 == h ) { var u = this . ge
scrollTop : this . renderer . scrollTop } , this . curOp . command . name && void 0 !== this . curOp . command . scrollIntoView && this . $blockScrolling ++ } , this . endOperation = function ( e ) { if ( this . curOp ) { if ( e && ! 1 === e . returnValue ) return this . curOp = null ; this . _signal ( "beforeEndOperation" ) ; var t = this . curOp . command ; t . name && this . $blockScrolling > 0 && this . $blockScrolling -- ; var i = t && t . scrollIntoView ; if ( i ) { switch ( i ) { case "center-animate" : i = "animate" ; case "center" : this . renderer . scrollCursorIntoView ( null , . 5 ) ; break ; case "animate" : case "cursor" : this . renderer . scrollCursorIntoView ( ) ; break ; case "selectionPart" : var n = this . selection . getRange ( ) , r = this . renderer . layerConfig ; ( n . start . row >= r . lastRow || n . end . row <= r . firstRow ) && this . renderer . scrollSelectionIntoView ( this . selection . anchor , this . selection . lead ) } "animate" == i && this . renderer . animateScrolling ( this . curOp . scrollTop ) } this . prevOp = this . curOp , this . curOp = null } } , this . $mergeableCommands = [ "backspace" , "del" , "insertstring" ] , this . $historyTracker = function ( e ) { if ( this . $mergeUndoDeltas ) { var t = this . prevOp , i = this . $mergeableCommands , n = t . command && e . command . name == t . command . name ; if ( "insertstring" == e . command . name ) { var r = e . args ; void 0 === this . mergeNextCommand && ( this . mergeNextCommand = ! 0 ) , n = n && this . mergeNextCommand && ( ! /\s/ . test ( r ) || /\s/ . test ( t . args ) ) , this . mergeNextCommand = ! 0 } else n = n && - 1 !== i . indexOf ( e . command . name ) ; "always" != this . $mergeUndoDeltas && Date . now ( ) - this . sequenceStartTime > 2e3 && ( n = ! 1 ) , n ? this . session . mergeUndoDeltas = ! 0 : - 1 !== i . indexOf ( e . command . name ) && ( this . sequenceStartTime = Date . now ( ) ) } } , this . setKeyboardHandler = function ( e , t ) { if ( e && "string" == typeof e ) { this . $keybindingId = e ; var i = this ; v . loadModule ( [ "keybinding" , e ] , function ( n ) { i . $keybindingId == e && i . keyBinding . setKeyboardHandler ( n && n . handler ) , t && t ( ) } ) } else this . $keybindingId = null , this . keyBinding . setKeyboardHandler ( e ) , t && t ( ) } , this . getKeyboardHandler = function ( ) { return this . keyBinding . getKeyboardHandler ( ) } , this . setSession = function ( e ) { if ( this . session != e ) { this . curOp && this . endOperation ( ) , this . curOp = { } ; var t = this . session ; if ( t ) { this . session . off ( "change" , this . $onDocumentChange ) , this . session . off ( "changeMode" , this . $onChangeMode ) , this . session . off ( "tokenizerUpdate" , this . $onTokenizerUpdate ) , this . session . off ( "changeTabSize" , this . $onChangeTabSize ) , this . session . off ( "changeWrapLimit" , this . $onChangeWrapLimit ) , this . session . off ( "changeWrapMode" , this . $onChangeWrapMode ) , this . session . off ( "changeFold" , this . $onChangeFold ) , this . session . off ( "changeFrontMarker" , this . $onChangeFrontMarker ) , this . session . off ( "changeBackMarker" , this . $onChangeBackMarker ) , this . session . off ( "changeBreakpoint" , this . $onChangeBreakpoint ) , this . session . off ( "changeAnnotation" , this . $onChangeAnnotation ) , this . session . off ( "changeOverwrite" , this . $onCursorChange ) , this . session . off ( "changeScrollTop" , this . $onScrollTopChange ) , this . session . off ( "changeScrollLeft" , this . $onScrollLeftChange ) ; var i = this . session . getSelection ( ) ; i . off ( "changeCursor" , this . $onCursorChange ) , i . off ( "changeSelection" , this . $onSelectionChange ) } this . session = e , e ? ( this . $onDocumentChange = this . onDocumentChange . bind ( this ) , e . on ( "change" , this . $onDocumentChange ) , this . renderer . setSession ( e ) , this . $onChangeMode = this . onChangeMode . bind ( this ) , e . on ( "changeMode" , this . $onChangeMode ) , this . $onTokenizerUpdate = this . onTokenizerUpdate . bind ( this ) , e . on ( "tokenizerUpdate" , this . $onTokenizerUpdate ) , this . $onChangeTabSize = this . renderer . onChangeTabSize . bind ( this . renderer ) , e . on ( "changeTabSize" , this . $onChangeTabSize ) , this . $onChangeWrapLimit = this . onChangeWrapLimit . bind ( this ) , e . on ( "changeWrapLimit" , this . $onChangeWrapLimit ) , this . $onChangeWrapMode = this . onChangeWrapMode . bind ( this ) , e . on ( "changeWrapMode" , this . $onChangeWrapMode ) , this . $onChangeFold = this . onChangeFold . bind ( this ) , e . on ( "changeFold" , this . $onChangeFold ) , this . $onChangeFrontMarker = this . onChangeFrontMarker . bind ( this ) , this . session . on ( "changeFrontMarker" , this . $onChangeFrontMarker ) , this . $onChangeBackMarker = this . onChangeBackMarker . bind ( this ) , this . session . on ( "changeBackMarker" , this . $onChangeBackMarker ) , this . $onChangeBreakpoint = this . onChangeBreakpoint . bind ( this ) , this . session . on ( "changeBreakpoint" , this . $onChangeBreakpoint ) , this . $onChangeAnnotation = this . onChangeAnnotation . bind ( this ) , this . session .
2017-11-22 23:20:51 +08:00
; r . importCssString ( '.ace_editor {\tposition: relative;\toverflow: hidden;\tfont: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;\tdirection: ltr;\ttext-align: left;\t-webkit-tap-highlight-color: rgba(0, 0, 0, 0);\t}\t.ace_scroller {\tposition: absolute;\toverflow: hidden;\ttop: 0;\tbottom: 0;\tbackground-color: inherit;\t-ms-user-select: none;\t-moz-user-select: none;\t-webkit-user-select: none;\tuser-select: none;\tcursor: text;\t}\t.ace_content {\tposition: absolute;\t-moz-box-sizing: border-box;\t-webkit-box-sizing: border-box;\tbox-sizing: border-box;\tmin-width: 100%;\t}\t.ace_dragging .ace_scroller:before{\tposition: absolute;\ttop: 0;\tleft: 0;\tright: 0;\tbottom: 0;\tcontent: \'\' ; \ tbackground : rgba ( 250 , 250 , 250 , 0.01 ) ; \ tz - index : 1000 ; \ t } \ t . ace _dragging . ace _dark . ace _scroller : before { \ tbackground : rgba ( 0 , 0 , 0 , 0.01 ) ; \ t } \ t . ace _selecting , . ace _selecting * { \ tcursor : text ! important ; \ t } \ t . ace _gutter { \ tposition : absolute ; \ toverflow : hidden ; \ twidth : auto ; \ ttop : 0 ; \ tbottom : 0 ; \ tleft : 0 ; \ tcursor : default ; \ tz - index : 4 ; \ t - ms - user - select : none ; \ t - moz - user - select : none ; \ t - webkit - user - select : none ; \ tuser - select : none ; \ t } \ t . ace _gutter - active - line { \ tposition : absolute ; \ tleft : 0 ; \ tright : 0 ; \ t } \ t . ace _scroller . ace _scroll - left { \ tbox - shadow : 17 px 0 16 px - 16 px rgba ( 0 , 0 , 0 , 0.4 ) inset ; \ t } \ t . ace _gutter - cell { \ tpadding - left : 19 px ; \ tpadding - right : 6 px ; \ tbackground - repeat : no - repeat ; \ t } \ t . ace _gutter - cell . ace _error { \ tbackground - image : url ( "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==" ) ; \ tbackground - repeat : no - repeat ; \ tbackground - position : 2 px center ; \ t } \ t . ace _gutter - cell . ace _warning { \ tbackground - image : url ( "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==" ) ; \ tbackground - position : 2 px center ; \ t } \ t . ace _gutter - cell . ace _info { \ tbackground - image : url ( "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=" ) ; \ tbackground - position : 2 px center ; \ t } \ t . ace _dark . ace _gutter - cell . ace _info { \ tbackground - image : url ( "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC" ) ; \ t } \ t . ace _scrollbar { \ tposition : absolute ; \ tright : 0 ; \ tbottom : 0 ; \ tz - index : 6 ; \ t } \ t . ace _scrollbar - inner { \ tposition : absolute ; \ tcursor : text ; \ tleft : 0 ; \ ttop : 0 ; \ t } \ t . ace _scrollbar - v { \ toverflow - x : hidden ; \ toverflow - y : scroll ; \ ttop : 0 ; \ t
this . alignCursors = function ( ) { var e = this . session , t = e . multiSelect , i = t . ranges , n = - 1 , r = i . filter ( function ( e ) { if ( e . cursor . row == n ) return ! 0 ; n = e . cursor . row } ) ; if ( i . length && r . length != i . length - 1 ) { r . forEach ( function ( e ) { t . substractPoint ( e . cursor ) } ) ; var o = 0 , s = 1 / 0 , a = i . map ( function ( t ) { var i = t . cursor , n = e . getLine ( i . row ) , r = n . substr ( i . column ) . search ( /\S/g ) ; return - 1 == r && ( r = 0 ) , i . column > o && ( o = i . column ) , r < s && ( s = r ) , r } ) ; i . forEach ( function ( t , i ) { var n = t . cursor , r = o - n . column , c = a [ i ] - s ; r > c ? e . insert ( n , d . stringRepeat ( " " , r - c ) ) : e . remove ( new l ( n . row , n . column , n . row , n . column - r + c ) ) , t . start . column = t . end . column = o , t . start . row = t . end . row = n . row , t . cursor = t . end } ) , t . fromOrientedRange ( i [ 0 ] ) , this . renderer . updateCursor ( ) , this . renderer . updateBackMarkers ( ) } else { var c = this . selection . getRange ( ) , h = c . start . row , u = c . end . row , f = h == u ; if ( f ) { var p , m = this . session . getLength ( ) ; do { p = this . session . getLine ( u ) } while ( /[=:]/ . test ( p ) && ++ u < m ) ; do { p = this . session . getLine ( h ) } while ( /[=:]/ . test ( p ) && -- h > 0 ) ; h < 0 && ( h = 0 ) , u >= m && ( u = m - 1 ) } var g = this . session . removeFullLines ( h , u ) ; g = this . $reAlignText ( g , f ) , this . session . insert ( { row : h , column : 0 } , g . join ( "\n" ) + "\n" ) , f || ( c . start . column = 0 , c . end . column = g [ g . length - 1 ] . length ) , this . selection . setRange ( c ) } } , this . $reAlignText = function ( e , t ) { function i ( e ) { return d . stringRepeat ( " " , e ) } function n ( e ) { return e [ 2 ] ? i ( s ) + e [ 2 ] + i ( a - e [ 2 ] . length + l ) + e [ 4 ] . replace ( /^([=:])\s+/ , "$1 " ) : e [ 0 ] } function r ( e ) { return e [ 2 ] ? i ( s + a - e [ 2 ] . length ) + e [ 2 ] + i ( l , " " ) + e [ 4 ] . replace ( /^([=:])\s+/ , "$1 " ) : e [ 0 ] } function o ( e ) { return e [ 2 ] ? i ( s ) + e [ 2 ] + i ( l ) + e [ 4 ] . replace ( /^([=:])\s+/ , "$1 " ) : e [ 0 ] } var s , a , l , c = ! 0 , h = ! 0 ; return e . map ( function ( e ) { var t = e . match ( /(\s*)(.*?)(\s*)([=:].*)/ ) ; return t ? null == s ? ( s = t [ 1 ] . length , a = t [ 2 ] . length , l = t [ 3 ] . length , t ) : ( s + a + l != t [ 1 ] . length + t [ 2 ] . length + t [ 3 ] . length && ( h = ! 1 ) , s != t [ 1 ] . length && ( c = ! 1 ) , s > t [ 1 ] . length && ( s = t [ 1 ] . length ) , a < t [ 2 ] . length && ( a = t [ 2 ] . length ) , l > t [ 3 ] . length && ( l = t [ 3 ] . length ) , t ) : [ e ] } ) . map ( t ? n : c ? h ? r : n : o ) } } ) . call ( v . prototype ) , t . onSessionChange = function ( e ) { var t = e . session ; t && ! t . multiSelect && ( t . $selectionMarkers = [ ] , t . selection . $initRangeList ( ) , t . multiSelect = t . selection ) , this . multiSelect = t && t . multiSelect ; var i = e . oldSession ; i && ( i . multiSelect . off ( "addRange" , this . $onAddRange ) , i . multiSelect . off ( "removeRange" , this . $onRemoveRange ) , i . multiSelect . off ( "multiSelect" , this . $onMultiSelect ) , i . multiSelect . off ( "singleSelect" , this . $onSingleSelect ) , i . multiSelect . lead . off ( "change" , this . $checkMultiselectChange ) , i . multiSelect . anchor . off ( "change" , this . $checkMultiselectChange ) ) , t && ( t . multiSelect . on ( "addRange" , this . $onAddRange ) , t . multiSelect . on ( "removeRange" , this . $onRemoveRange ) , t . multiSelect . on ( "multiSelect" , this . $onMultiSelect ) , t . multiSelect . on ( "singleSelect" , this . $onSingleSelect ) , t . multiSelect . lead . on ( "change" , this . $checkMultiselectChange ) , t . multiSelect . anchor . on ( "change" , this . $checkMultiselectChange ) ) , t && this . inMultiSelectMode != t . selection . inMultiSelectMode && ( t . selection . inMultiSelectMode ? this . $onMultiSelect ( ) : this . $onSingleSelect ( ) ) } , t . MultiSelect = o , e ( "./config" ) . defineOptions ( v . prototype , "editor" , { enableMultiselect : { set : function ( e ) { o ( this ) , e ? ( this . on ( "changeSession" , this . $multiselectOnSessionChange ) , this . on ( "mousedown" , h ) ) : ( this . off ( "changeSession" , this . $multiselectOnSessionChange ) , this . off ( "mousedown" , h ) ) } , value : ! 0 } , enableBlockSelect : { set : function ( e ) { this . $blockSelectEnabled = e } , value : ! 0 } } ) } ) , ace . define ( "ace/mode/folding/fold_mode" , [ "require" , "exports" , "module" , "ace/range" ] , function ( e , t , i ) { "use strict" ; var n = e ( "../../range" ) . Range , r = t . FoldMode = function ( ) { } ; ( function ( ) { this . foldingStartMarker = null , this . foldingStopMarker = null , this . getFoldWidget = function ( e , t , i ) { var n = e . getLine ( i ) ; return this . foldingStartMarker . test ( n ) ? "start" : "markbeginend" == t && this . foldingStopMarker && this . foldingStopMarker . test ( n ) ? "end" : "" } , this . getFoldWidgetRange = function ( e , t , i ) { return null } , this . indentationBlock = function ( e , t , i ) { var r = e . getLine ( t ) , o = r . search ( /\S/ ) ; if ( - 1 != o ) { for ( var s = i || r . length , a = e . getLength ( ) , l = t , c = t ; ++ t < a ; ) { var h = e . getLine ( t ) . search ( /\S/ ) ; if ( - 1 != h ) { if ( h <= o ) break ; c = t } } if ( c > l ) { var u = e . getLine ( c ) . length ; return new n ( l , s , c , u ) } } } , this . openingBracketBlock = function ( e , t , i , r , o ) { var s = { row : i , column : r + 1 } , a = e . $findClosingBracket ( t , s , o ) ; if ( a ) { var l
e . exports . src = ' "no use strict" ; ! function ( window ) { function resolveModuleId ( id , paths ) { for ( var testPath = id , tail = "" ; testPath ; ) { var alias = paths [ testPath ] ; if ( "string" == typeof alias ) return alias + tail ; if ( alias ) return alias . location . replace ( /\\/ * $ / , "/" ) + ( tail || alias . main || alias . name ) ; if ( alias === ! 1 ) return "" ; var i = testPath . lastIndexOf ( "/" ) ; if ( - 1 === i ) break ; tail = testPath . substr ( i ) + tail , testPath = testPath . slice ( 0 , i ) } return id } if ( ! ( void 0 !== window . window && window . document || window . acequire && window . define ) ) { window . console || ( window . console = function ( ) { var msgs = Array . prototype . slice . call ( arguments , 0 ) ; postMessage ( { type : "log" , data : msgs } ) } , window . console . error = window . console . warn = window . console . log = window . console . trace = window . console ) , window . window = window , window . ace = window , window . onerror = function ( message , file , line , col , err ) { postMessage ( { type : "error" , data : { message : message , data : err . data , file : file , line : line , col : col , stack : err . stack } } ) } , window . normalizeModule = function ( parentId , moduleName ) { if ( - 1 !== moduleName . indexOf ( "!" ) ) { var chunks = moduleName . split ( "!" ) ; return window . normalizeModule ( parentId , chunks [ 0 ] ) + "!" + window . normalizeModule ( parentId , chunks [ 1 ] ) } if ( "." == moduleName . charAt ( 0 ) ) { var base = parentId . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) ; for ( moduleName = ( base ? base + "/" : "" ) + moduleName ; - 1 !== moduleName . indexOf ( "." ) && previous != moduleName ; ) { var previous = moduleName ; moduleName = moduleName . replace ( /^\\.\\/ / , "" ) . replace ( /\\/ \ \ . \ \ //,"/").replace(/[^\\/]+\\/\\.\\.\\//,"")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error("worker.js acequire() accepts only (parentId, id) as arguments");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log("unable to load "+id);var path=resolveModuleId(id,window.acequire.tlns);return".js"!=path.slice(-3)&&(path+=".js"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,"string"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),"function"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=["require","exports","module"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case"require":return req;case"exports":return module.exports;case"module":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire("ace/lib/event_emitter").EventEmitter,oop=window.acequire("ace/lib/oop"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:"call",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:"event",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error("Unknown command:"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire("ace/lib/es5-shim"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}}(this),ace.define("ace/lib/oop",["require","exports","module"],function(acequire,exports){"use strict"
2017-07-04 01:23:32 +08:00
//# sourceMappingURL=jsoneditor.map