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 >
2018-05-23 15:50:53 +08:00
* @ version 5.16 . 0
* @ date 2018 - 05 - 23
2017-07-04 01:23:32 +08:00
* /
2018-05-23 15:50:53 +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" , "onSelectionChange" , "onTextSelectionChange" , "escapeUnicode" , "history" , "search" , "mode" , "modes" , "name" , "indentation" , "sortObjectKeys" , "navigationBar" , "statusBar" , "languages" , "language" ] ; 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 ( 66 ) , 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' )
; for ( var C in g ) if ( y = g [ C ] , y . length ) { 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 = u . 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 += ") { " , u . schema = w , u . schemaPath = a + e . util . getProperty ( C ) , u . errSchemaPath = l + "/" + e . util . escapeFragment ( C ) , n += " " + e . validate ( u ) + " " , u . baseId = P , n += " } " , c && ( n += " if (" + p + ") { " , f += "}" ) ) } return c && ( n += " " + f + " if (" + d + " == 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 || "" ) , d = "valid" + r , u = e . opts . $data && s && s . $data ; u && ( n += " var schema" + r + " = " + e . util . getData ( s . $data , o , e . dataPathArr ) + "; " ) ; var f = "i" + r , p = "schema" + r ; u || ( n += " var " + p + " = validate.schema" + a + ";" ) , n += "var " + d + ";" , u && ( n += " if (schema" + r + " === undefined) " + d + " = true; else if (!Array.isArray(schema" + r + ")) " + d + " = false; else {" ) , n += d + " = false;for (var " + f + "=0; " + f + "<" + p + ".length; " + f + "++) if (equal(" + h + ", " + p + "[" + f + "])) { " + d + " = true; break; }" , u && ( n += " } " ) , n += " if (!" + d + ") { " ; var m = m || [ ] ; m . push ( n ) , n = "" , ! 1 !== e . createErrors ? ( n += " { keyword: 'enum' , dataPath: (dataPath || '') + " + e . errorPath + " , schemaPath: " + e . util . toQuotedString ( l ) + " , param
m . _onMultiSelect = function ( e ) { if ( e . preventDefault ( ) , this . _updateDragDistance ( e ) , e . hasMoved ) { var t = l . getNodeFromTarget ( e . target ) ; t && ( null == this . multiselection . start && ( this . multiselection . start = t ) , this . multiselection . end = t ) , this . deselect ( ) ; var i = this . multiselection . start , n = this . multiselection . end || this . multiselection . start ; if ( i && n ) { if ( this . multiselection . nodes = this . _findTopLevelNodes ( i , n ) , this . multiselection . nodes && this . multiselection . nodes . length ) { var r = this . multiselection . nodes [ 0 ] ; this . multiselection . start === r || this . multiselection . start . isDescendantOf ( r ) ? this . multiselection . direction = "down" : this . multiselection . direction = "up" } this . select ( this . multiselection . nodes ) } } } , m . _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 ) } , m . deselect = function ( e ) { var t = ! ! this . multiselection . nodes . length ; this . multiselection . nodes . forEach ( function ( e ) { e . setSelected ( ! 1 ) } ) , this . multiselection . nodes = [ ] , e && ( this . multiselection . start = null , this . multiselection . end = null ) , t && this . _selectionChangedHandler && this . _selectionChangedHandler ( ) } , m . 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 ] ; if ( e . forEach ( function ( e ) { e . expandPathToNode ( ) , e . setSelected ( ! 0 , e === t ) } ) , this . _selectionChangedHandler ) { var i = this . getSelection ( ) ; this . _selectionChangedHandler ( i . start , i . end ) } } } , m . _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 ) , d = Math . max ( l , c ) ; return o . childs . slice ( h , d + 1 ) } return [ ] } , m . _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 d = 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 ) ; null === i ? this . autocomplete . hideDropDown ( ) : "function" == typeof i . then ? i . then ( function ( e ) { null === e ? this . autocomplete . hideDropDown ( ) : 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 , d , e . target ) , 50 ) } s && ( e . preventDefault ( ) , e . stopPropagation ( ) ) } , m . _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 . appendC
t . setHighlight ( e ) } ) ) } , n . prototype . setSelected = function ( e , t ) { this . selected = e , this . dom . tr && ( e ? l . addClassName ( this . dom . tr , "jsoneditor-selected" ) : l . removeClassName ( this . dom . tr , "jsoneditor-selected" ) , t ? l . addClassName ( this . dom . tr , "jsoneditor-first" ) : l . removeClassName ( this . dom . tr , "jsoneditor-first" ) , this . append && this . append . setSelected ( e ) , this . showMore && this . showMore . setSelected ( e ) , this . childs && this . childs . forEach ( function ( t ) { t . setSelected ( e ) } ) ) } , n . prototype . updateValue = function ( e ) { this . value = e , this . updateDom ( ) } , n . prototype . updateField = function ( e ) { this . field = e , this . updateDom ( ) } , n . prototype . updateDom = function ( e ) { var t = this . dom . tree ; t && ( t . style . marginLeft = 24 * this . getLevel ( ) + "px" ) ; var i = this . dom . field ; if ( i ) { this . fieldEditable ? ( i . contentEditable = this . editable . field , i . spellcheck = ! 1 , i . className = "jsoneditor-field" ) : i . className = "jsoneditor-readonly" ; var n ; n = void 0 != this . index ? this . index : void 0 != this . field ? this . field : this . _hasChilds ( ) ? this . type : "" , i . innerHTML = this . _escapeHTML ( n ) , this . _updateSchema ( ) } var r = this . dom . value ; if ( r ) { var o = this . childs ? this . childs . length : 0 ; "array" == this . type ? ( r . innerHTML = "[" + o + "]" , l . addClassName ( this . dom . tr , "jsoneditor-expandable" ) ) : "object" == this . type ? ( r . innerHTML = "{" + o + "}" , l . addClassName ( this . dom . tr , "jsoneditor-expandable" ) ) : ( r . innerHTML = this . _escapeHTML ( this . value ) , l . removeClassName ( this . dom . tr , "jsoneditor-expandable" ) ) } this . _updateDomField ( ) , this . _updateDomValue ( ) , e && ! 0 === e . updateIndexes && this . _updateDomIndexes ( ) , e && ! 0 === e . recurse && this . childs && this . childs . forEach ( function ( t ) { t . updateDom ( e ) } ) , this . error && this . updateError ( ) , this . append && this . append . updateDom ( ) , this . showMore && this . showMore . updateDom ( ) } , n . prototype . _updateSchema = function ( ) { this . editor && this . editor . options && ( this . schema = this . editor . options . schema ? n . _findSchema ( this . editor . options . schema , this . getPath ( ) ) : null , this . schema ? this . enum = n . _findEnum ( this . schema ) : delete this . enum ) } , n . _findEnum = function ( e ) { if ( e . enum ) return e . enum ; var t = e . oneOf || e . anyOf || e . allOf ; if ( t ) { var i = t . filter ( function ( e ) { return e . enum } ) ; if ( i . length > 0 ) return i [ 0 ] . enum } return null } , n . _findSchema = function ( e , t ) { var i = e , r = i , o = e . oneOf || e . anyOf || e . allOf ; o || ( o = [ e ] ) ; for ( var s = 0 ; s < o . length ; s ++ ) { i = o [ s ] ; for ( var a = 0 ; a < t . length && i ; a ++ ) { var l = t [ a ] ; if ( "string" == typeof l && i . patternProperties && a == t . length - 1 ) for ( var c in i . patternProperties ) r = n . _findSchema ( i . patternProperties [ c ] , t . slice ( a , t . length ) ) ; else i . items && i . items . properties ? ( i = i . items . properties [ l ] ) && ( r = n . _findSchema ( i , t . slice ( a , t . length ) ) ) : "string" == typeof l && i . properties ? ( i = i . properties [ l ] || null ) && ( r = n . _findSchema ( i , t . slice ( a , t . length ) ) ) : "number" == typeof l && i . items && ( i = i . items ) && ( r = n . _findSchema ( i , t . slice ( a , t . length ) ) ) } } return r } , n . prototype . _updateDomIndexes = function ( ) { var e = this . dom . value , t = this . childs ; e && t && ( "array" == this . type ? t . forEach ( function ( e , t ) { e . index = t ; var i = e . dom . field ; i && ( i . innerHTML = t ) } ) : "object" == this . type && t . forEach ( function ( e ) { void 0 != e . index && ( delete e . index , void 0 == e . field && ( e . field = "" ) ) } ) ) } , n . prototype . _createDomValue = function ( ) { var e ; return "array" == this . type ? ( e = document . createElement ( "div" ) , e . innerHTML = "[...]" ) : "object" == this . type ? ( e = document . createElement ( "div" ) , e . innerHTML = "{...}" ) : ! this . editable . value && l . isUrl ( this . value ) ? ( e = document . createElement ( "a" ) , e . href = this . value , e . innerHTML = this . _escapeHTML ( this . value ) ) : ( e = document . createElement ( "div" ) , e . contentEditable = this . editable . value , e . spellcheck = ! 1 , e . innerHTML = this . _escapeHTML ( this . value ) ) , e } , n . prototype . _createDomExpandButton = function ( ) { var e = document . createElement ( "button" ) ; return e . type = "button" , this . _hasChilds ( ) ? ( e . className = this . expanded ? "jsoneditor-expanded" : "jsoneditor-collapsed" , e . title = c ( "expandTitle" ) ) : ( e . className = "jsoneditor-invisible" , e . title = "" ) , e } , n . prototype . _createDomTree = function ( ) { var e = this . dom , t = document . createElement ( "table" ) , i = document . createElement ( "tbody" ) ; t . style . borderCollapse = "collapse" , t . className = "jsoneditor-values" , t . appendChild ( i ) ; var n = document . createElement ( "tr" ) ; i . appendChild ( n ) ; var r = document . createElement ( "td" ) ; r . className = "jsoneditor-tree" , n . appendChild ( r ) , e . expand = this . _createDomExpandButton ( ) , r . appendChild ( e . expand ) , e . tdExpand = r ; v
var r = "location" in t ? t . location : t . keyLocation ; if ( 3 === r && ( e ( t , n , - i ) , t . defaultPrevented ) ) return } if ( s . isChromeOS && 8 & n ) { if ( e ( t , n , i ) , t . defaultPrevented ) return ; n &= - 9 } return ! ! ( n || i in o . FUNCTION _KEYS || i in o . PRINTABLE _KEYS ) && e ( t , n , i ) } function r ( ) { a = Object . create ( null ) } var o = e ( "./keys" ) , s = e ( "./useragent" ) , a = null , l = 0 ; t . addListener = function ( e , t , i ) { if ( e . addEventListener ) return e . addEventListener ( t , i , ! 1 ) ; if ( e . attachEvent ) { var n = function ( ) { i . call ( e , window . event ) } ; i . _wrapper = n , e . attachEvent ( "on" + t , n ) } } , t . removeListener = function ( e , t , i ) { if ( e . removeEventListener ) return e . removeEventListener ( t , i , ! 1 ) ; e . detachEvent && e . detachEvent ( "on" + t , i . _wrapper || i ) } , t . stopEvent = function ( e ) { return t . stopPropagation ( e ) , t . preventDefault ( e ) , ! 1 } , t . stopPropagation = function ( e ) { e . stopPropagation ? e . stopPropagation ( ) : e . cancelBubble = ! 0 } , t . preventDefault = function ( e ) { e . preventDefault ? e . preventDefault ( ) : e . returnValue = ! 1 } , t . getButton = function ( e ) { return "dblclick" == e . type ? 0 : "contextmenu" == e . type || s . isMac && e . ctrlKey && ! e . altKey && ! e . shiftKey ? 2 : e . preventDefault ? e . button : { 1 : 0 , 2 : 2 , 4 : 1 } [ e . button ] } , t . capture = function ( e , i , n ) { function r ( e ) { i && i ( e ) , n && n ( e ) , t . removeListener ( document , "mousemove" , i , ! 0 ) , t . removeListener ( document , "mouseup" , r , ! 0 ) , t . removeListener ( document , "dragstart" , r , ! 0 ) } return t . addListener ( document , "mousemove" , i , ! 0 ) , t . addListener ( document , "mouseup" , r , ! 0 ) , t . addListener ( document , "dragstart" , r , ! 0 ) , r } , t . addTouchMoveListener = function ( e , i ) { var n , r ; t . addListener ( e , "touchstart" , function ( e ) { var t = e . touches , i = t [ 0 ] ; n = i . clientX , r = i . clientY } ) , t . addListener ( e , "touchmove" , function ( e ) { var t = e . touches ; if ( ! ( t . length > 1 ) ) { var o = t [ 0 ] ; e . wheelX = n - o . clientX , e . wheelY = r - o . clientY , n = o . clientX , r = o . clientY , i ( e ) } } ) } , t . addMouseWheelListener = function ( e , i ) { "onmousewheel" in e ? t . addListener ( e , "mousewheel" , function ( e ) { void 0 !== e . wheelDeltaX ? ( e . wheelX = - e . wheelDeltaX / 8 , e . wheelY = - e . wheelDeltaY / 8 ) : ( e . wheelX = 0 , e . wheelY = - e . wheelDelta / 8 ) , i ( e ) } ) : "onwheel" in e ? t . addListener ( e , "wheel" , function ( e ) { switch ( e . deltaMode ) { case e . DOM _DELTA _PIXEL : e . wheelX = . 35 * e . deltaX || 0 , e . wheelY = . 35 * e . deltaY || 0 ; break ; case e . DOM _DELTA _LINE : case e . DOM _DELTA _PAGE : e . wheelX = 5 * ( e . deltaX || 0 ) , e . wheelY = 5 * ( e . deltaY || 0 ) } i ( e ) } ) : t . addListener ( e , "DOMMouseScroll" , function ( e ) { e . axis && e . axis == e . HORIZONTAL _AXIS ? ( e . wheelX = 5 * ( e . detail || 0 ) , e . wheelY = 0 ) : ( e . wheelX = 0 , e . wheelY = 5 * ( e . detail || 0 ) ) , i ( e ) } ) } , t . addMultiMouseDownListener = function ( e , i , n , r ) { function o ( e ) { if ( 0 !== t . getButton ( e ) ? d = 0 : e . detail > 1 ? ++ d > 4 && ( d = 1 ) : d = 1 , s . isIE ) { var o = Math . abs ( e . clientX - l ) > 5 || Math . abs ( e . clientY - c ) > 5 ; h && ! o || ( d = 1 ) , h && clearTimeout ( h ) , h = setTimeout ( function ( ) { h = null } , i [ d - 1 ] || 600 ) , 1 == d && ( l = e . clientX , c = e . clientY ) } if ( e . _clicks = d , n [ r ] ( "mousedown" , e ) , d > 4 ) d = 0 ; else if ( d > 1 ) return n [ r ] ( u [ d ] , e ) } function a ( e ) { d = 2 , h && clearTimeout ( h ) , h = setTimeout ( function ( ) { h = null } , i [ d - 1 ] || 600 ) , n [ r ] ( "mousedown" , e ) , n [ r ] ( u [ d ] , e ) } var l , c , h , d = 0 , u = { 2 : "dblclick" , 3 : "tripleclick" , 4 : "quadclick" } ; Array . isArray ( e ) || ( e = [ e ] ) , e . forEach ( function ( e ) { t . addListener ( e , "mousedown" , o ) , s . isOldIE && t . addListener ( e , "dblclick" , a ) } ) } ; var c = ! s . isMac || ! s . isOpera || "KeyboardEvent" in window ? function ( e ) { return 0 | ( e . ctrlKey ? 1 : 0 ) | ( e . altKey ? 2 : 0 ) | ( e . shiftKey ? 4 : 0 ) | ( e . metaKey ? 8 : 0 ) } : function ( e ) { return 0 | ( e . metaKey ? 1 : 0 ) | ( e . altKey ? 2 : 0 ) | ( e . shiftKey ? 4 : 0 ) | ( e . ctrlKey ? 8 : 0 ) } ; if ( t . getModifierString = function ( e ) { return o . KEY _MODS [ c ( e ) ] } , t . addCommandKeyListener = function ( e , i ) { var o = t . addListener ; if ( s . isOldGecko || s . isOpera && ! ( "KeyboardEvent" in window ) ) { var l = null ; o ( e , "keydown" , function ( e ) { l = e . keyCode } ) , o ( e , "keypress" , function ( e ) { return n ( i , e , l ) } ) } else { var c = null ; o ( e , "keydown" , function ( e ) { a [ e . keyCode ] = ( a [ e . keyCode ] || 0 ) + 1 ; var t = n ( i , e , e . keyCode ) ; return c = e . defaultPrevented , t } ) , o ( e , "keypress" , function ( e ) { c && ( e . ctrlKey || e . altKey || e . shiftKey || e . metaKey ) && ( t . stopEvent ( e ) , c = null ) } ) , o ( e , "keyup" , function ( e ) { a [ e . keyCode ] = null } ) , a || ( r ( ) , o ( window , "focus" , r ) ) } } , "object" == typeof window && window . postMessage && ! s . isOldIE ) { t . nextTick = function ( e , i ) { i = i || window ; t . addListener ( i , "message" , function n ( r ) { "zero-timeout-message-1" == r . data && ( t . stopPropagation ( r ) , t . removeListener ( i , "message" , n ) , e ( ) ) } ) , i . postMessage ( "zero-timeout-message-1" , "*" ) } } t . nextFrame = "object" == typeof window && ( window . requestAnim
this . $moveSelection ( this . moveCursorWordRight ) } , this . selectWordLeft = function ( ) { this . $moveSelection ( this . moveCursorWordLeft ) } , this . getWordRange = function ( e , t ) { if ( void 0 === t ) { var i = e || this . lead ; e = i . row , t = i . column } return this . session . getWordRange ( e , t ) } , this . selectWord = function ( ) { this . setSelectionRange ( this . getWordRange ( ) ) } , this . selectAWord = function ( ) { var e = this . getCursor ( ) , t = this . session . getAWordRange ( e . row , e . column ) ; this . setSelectionRange ( t ) } , this . getLineRange = function ( e , t ) { var i , n = "number" == typeof e ? e : this . lead . row , r = this . session . getFoldLine ( n ) ; return r ? ( n = r . start . row , i = r . end . row ) : i = n , ! 0 === t ? new s ( n , 0 , i , this . session . getLine ( i ) . length ) : new s ( n , 0 , i + 1 , 0 ) } , this . selectLine = function ( ) { this . setSelectionRange ( this . getLineRange ( ) ) } , this . moveCursorUp = function ( ) { this . moveCursorBy ( - 1 , 0 ) } , this . moveCursorDown = function ( ) { this . moveCursorBy ( 1 , 0 ) } , this . wouldMoveIntoSoftTab = function ( e , t , i ) { var n = e . column , r = e . column + t ; return i < 0 && ( n = e . column - t , r = e . column ) , this . session . isTabStop ( e ) && this . doc . getLine ( e . row ) . slice ( n , r ) . split ( " " ) . length - 1 == t } , this . moveCursorLeft = function ( ) { var e , t = this . lead . getPosition ( ) ; if ( e = this . session . getFoldAt ( t . row , t . column , - 1 ) ) this . moveCursorTo ( e . start . row , e . start . column ) ; else if ( 0 === t . column ) t . row > 0 && this . moveCursorTo ( t . row - 1 , this . doc . getLine ( t . row - 1 ) . length ) ; else { var i = this . session . getTabSize ( ) ; this . wouldMoveIntoSoftTab ( t , i , - 1 ) && ! this . session . getNavigateWithinSoftTabs ( ) ? this . moveCursorBy ( 0 , - i ) : this . moveCursorBy ( 0 , - 1 ) } } , this . moveCursorRight = function ( ) { var e , t = this . lead . getPosition ( ) ; if ( e = this . session . getFoldAt ( t . row , t . column , 1 ) ) this . moveCursorTo ( e . end . row , e . end . column ) ; else if ( this . lead . column == this . doc . getLine ( this . lead . row ) . length ) this . lead . row < this . doc . getLength ( ) - 1 && this . moveCursorTo ( this . lead . row + 1 , 0 ) ; else { var i = this . session . getTabSize ( ) , t = this . lead ; this . wouldMoveIntoSoftTab ( t , i , 1 ) && ! this . session . getNavigateWithinSoftTabs ( ) ? this . moveCursorBy ( 0 , i ) : this . moveCursorBy ( 0 , 1 ) } } , this . moveCursorLineStart = function ( ) { var e = this . lead . row , t = this . lead . column , i = this . session . documentToScreenRow ( e , t ) , n = this . session . screenToDocumentPosition ( i , 0 ) , r = this . session . getDisplayLine ( e , null , n . row , n . column ) , o = r . match ( /^\s*/ ) ; o [ 0 ] . length == t || this . session . $useEmacsStyleLineStart || ( n . column += o [ 0 ] . length ) , this . moveCursorToPosition ( n ) } , this . moveCursorLineEnd = function ( ) { var e = this . lead , t = this . session . getDocumentLastRowColumnPosition ( e . row , e . column ) ; if ( this . lead . column == t . column ) { var i = this . session . getLine ( t . row ) ; if ( t . column == i . length ) { var n = i . search ( /\s+$/ ) ; n > 0 && ( t . column = n ) } } this . moveCursorTo ( t . row , t . column ) } , this . moveCursorFileEnd = function ( ) { var e = this . doc . getLength ( ) - 1 , t = this . doc . getLine ( e ) . length ; this . moveCursorTo ( e , t ) } , this . moveCursorFileStart = function ( ) { this . moveCursorTo ( 0 , 0 ) } , this . moveCursorLongWordRight = function ( ) { var e = this . lead . row , t = this . lead . column , i = this . doc . getLine ( e ) , n = i . substring ( t ) ; this . session . nonTokenRe . lastIndex = 0 , this . session . tokenRe . lastIndex = 0 ; var r = this . session . getFoldAt ( e , t , 1 ) ; return r ? void this . moveCursorTo ( r . end . row , r . end . column ) : ( this . session . nonTokenRe . exec ( n ) && ( t += this . session . nonTokenRe . lastIndex , this . session . nonTokenRe . lastIndex = 0 , n = i . substring ( t ) ) , t >= i . length ? ( this . moveCursorTo ( e , i . length ) , this . moveCursorRight ( ) , void ( e < this . doc . getLength ( ) - 1 && this . moveCursorWordRight ( ) ) ) : ( this . session . tokenRe . exec ( n ) && ( t += this . session . tokenRe . lastIndex , this . session . tokenRe . lastIndex = 0 ) , void this . moveCursorTo ( e , t ) ) ) } , this . moveCursorLongWordLeft = function ( ) { var e , t = this . lead . row , i = this . lead . column ; if ( e = this . session . getFoldAt ( t , i , - 1 ) ) return void this . moveCursorTo ( e . start . row , e . start . column ) ; var n = this . session . getFoldStringAt ( t , i , - 1 ) ; null == n && ( n = this . doc . getLine ( t ) . substring ( 0 , i ) ) ; var o = r . stringReverse ( n ) ; if ( this . session . nonTokenRe . lastIndex = 0 , this . session . tokenRe . lastIndex = 0 , this . session . nonTokenRe . exec ( o ) && ( i -= this . session . nonTokenRe . lastIndex , o = o . slice ( this . session . nonTokenRe . lastIndex ) , this . session . nonTokenRe . lastIndex = 0 ) , i <= 0 ) return this . moveCursorTo ( t , 0 ) , this . moveCursorLeft ( ) , void ( t > 0 && this . moveCursorWordLeft ( ) ) ; this . session . tokenRe . exec ( o ) && ( i -= this . session . tokenRe . lastIndex , this . session . tokenRe . lastIndex = 0 ) , this . moveCursorTo ( t , i ) }
; var s = r . getLength ( ) , a = 0 ; for ( i . running = ! 1 ; t < s ; ) { i . $tokenizeRow ( t ) , n = t ; do { t ++ } while ( i . lines [ t ] ) ; if ( ++ a % 5 == 0 && new Date - e > 20 ) { i . running = setTimeout ( i . $worker , 20 ) ; break } } i . currentLine = t , - 1 == n && ( n = t ) , o <= n && i . fireUpdateEvent ( o , n ) } } } ; ( function ( ) { n . implement ( this , r ) , this . setTokenizer = function ( e ) { this . tokenizer = e , this . lines = [ ] , this . states = [ ] , this . start ( 0 ) } , this . setDocument = function ( e ) { this . doc = e , this . lines = [ ] , this . states = [ ] , this . stop ( ) } , this . fireUpdateEvent = function ( e , t ) { var i = { first : e , last : t } ; this . _signal ( "update" , { data : i } ) } , this . start = function ( e ) { this . currentLine = Math . min ( e || 0 , this . currentLine , this . doc . getLength ( ) ) , this . lines . splice ( this . currentLine , this . lines . length ) , this . states . splice ( this . currentLine , this . states . length ) , this . stop ( ) , this . running = setTimeout ( this . $worker , 700 ) } , this . scheduleStart = function ( ) { this . running || ( this . running = setTimeout ( this . $worker , 700 ) ) } , this . $updateOnChange = function ( e ) { var t = e . start . row , i = e . end . row - t ; if ( 0 === i ) this . lines [ t ] = null ; else if ( "remove" == e . action ) this . lines . splice ( t , i + 1 , null ) , this . states . splice ( t , i + 1 , null ) ; else { var n = Array ( i + 1 ) ; n . unshift ( t , 1 ) , this . lines . splice . apply ( this . lines , n ) , this . states . splice . apply ( this . states , n ) } this . currentLine = Math . min ( t , this . currentLine , this . doc . getLength ( ) ) , this . stop ( ) } , this . stop = function ( ) { this . running && clearTimeout ( this . running ) , this . running = ! 1 } , this . getTokens = function ( e ) { return this . lines [ e ] || this . $tokenizeRow ( e ) } , this . getState = function ( e ) { return this . currentLine == e && this . $tokenizeRow ( e ) , this . states [ e ] || "start" } , this . $tokenizeRow = function ( e ) { var t = this . doc . getLine ( e ) , i = this . states [ e - 1 ] , n = this . tokenizer . getLineTokens ( t , i , e ) ; return this . states [ e ] + "" != n . state + "" ? ( this . states [ e ] = n . state , this . lines [ e + 1 ] = null , this . currentLine > e + 1 && ( this . currentLine = e + 1 ) ) : this . currentLine == e && ( this . currentLine = e + 1 ) , this . lines [ e ] = n . tokens } } ) . call ( o . prototype ) , t . BackgroundTokenizer = o } ) , ace . define ( "ace/search_highlight" , [ "require" , "exports" , "module" , "ace/lib/lang" , "ace/lib/oop" , "ace/range" ] , function ( e , t , i ) { "use strict" ; var n = e ( "./lib/lang" ) , r = ( e ( "./lib/oop" ) , e ( "./range" ) . Range ) , o = function ( e , t , i ) { this . setRegexp ( e ) , this . clazz = t , this . type = i || "text" } ; ( function ( ) { this . MAX _RANGES = 500 , this . setRegexp = function ( e ) { this . regExp + "" != e + "" && ( this . regExp = e , this . cache = [ ] ) } , this . update = function ( e , t , i , o ) { if ( this . regExp ) for ( var s = o . firstRow , a = o . lastRow , l = s ; l <= a ; l ++ ) { var c = this . cache [ l ] ; null == c && ( c = n . getMatchOffsets ( i . getLine ( l ) , this . regExp ) , c . length > this . MAX _RANGES && ( c = c . slice ( 0 , this . MAX _RANGES ) ) , c = c . map ( function ( e ) { return new r ( l , e . offset , l , e . offset + e . length ) } ) , this . cache [ l ] = c . length ? c : "" ) ; for ( var h = c . length ; h -- ; ) t . drawSingleLineMarker ( e , c [ h ] . toScreenRange ( i ) , this . clazz , o ) } } } ) . call ( o . prototype ) , t . SearchHighlight = o } ) , ace . define ( "ace/edit_session/fold_line" , [ "require" , "exports" , "module" , "ace/range" ] , function ( e , t , i ) { "use strict" ; function n ( e , t ) { this . foldData = e , Array . isArray ( t ) ? this . folds = t : t = this . folds = [ t ] ; var i = t [ t . length - 1 ] ; this . range = new r ( t [ 0 ] . start . row , t [ 0 ] . start . column , i . end . row , i . end . column ) , this . start = this . range . start , this . end = this . range . end , this . folds . forEach ( function ( e ) { e . setFoldLine ( this ) } , this ) } var r = e ( "../range" ) . Range ; ( function ( ) { this . shiftRow = function ( e ) { this . start . row += e , this . end . row += e , this . folds . forEach ( function ( t ) { t . start . row += e , t . end . row += e } ) } , this . addFold = function ( e ) { if ( e . sameRow ) { if ( e . start . row < this . startRow || e . endRow > this . endRow ) throw new Error ( "Can't add a fold to this FoldLine as it has no connection" ) ; this . folds . push ( e ) , this . folds . sort ( function ( e , t ) { return - e . range . compareEnd ( t . start . row , t . start . column ) } ) , this . range . compareEnd ( e . start . row , e . start . column ) > 0 ? ( this . end . row = e . end . row , this . end . column = e . end . column ) : this . range . compareStart ( e . end . row , e . end . column ) < 0 && ( this . start . row = e . start . row , this . start . column = e . start . column ) } else if ( e . start . row == this . end . row ) this . folds . push ( e ) , this . end . row = e . end . row , this . end . column = e . end . column ; else { if ( e . end . row != this . start . row ) throw new Error ( "Trying to add fold to FoldRow that doesn't have a matching row" ) ; this . folds . unshift ( e ) , this . start . row = e . start . row , this . start . column = e . start . column } e . foldLine = this } , this . containsRow = function ( e ) { return e >= this . start . ro
bindKey : n ( "Alt-Left|Home" , "Command-Left|Home|Ctrl-A" ) , exec : function ( e ) { e . navigateLineStart ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "selectleft" , bindKey : n ( "Shift-Left" , "Shift-Left|Ctrl-Shift-B" ) , exec : function ( e ) { e . getSelection ( ) . selectLeft ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "gotoleft" , bindKey : n ( "Left" , "Left|Ctrl-B" ) , exec : function ( e , t ) { e . navigateLeft ( t . times ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "selectwordright" , bindKey : n ( "Ctrl-Shift-Right" , "Option-Shift-Right" ) , exec : function ( e ) { e . getSelection ( ) . selectWordRight ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "gotowordright" , bindKey : n ( "Ctrl-Right" , "Option-Right" ) , exec : function ( e ) { e . navigateWordRight ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "selecttolineend" , bindKey : n ( "Alt-Shift-Right" , "Command-Shift-Right|Shift-End|Ctrl-Shift-E" ) , exec : function ( e ) { e . getSelection ( ) . selectLineEnd ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "gotolineend" , bindKey : n ( "Alt-Right|End" , "Command-Right|End|Ctrl-E" ) , exec : function ( e ) { e . navigateLineEnd ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "selectright" , bindKey : n ( "Shift-Right" , "Shift-Right" ) , exec : function ( e ) { e . getSelection ( ) . selectRight ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "gotoright" , bindKey : n ( "Right" , "Right|Ctrl-F" ) , exec : function ( e , t ) { e . navigateRight ( t . times ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "selectpagedown" , bindKey : "Shift-PageDown" , exec : function ( e ) { e . selectPageDown ( ) } , readOnly : ! 0 } , { name : "pagedown" , bindKey : n ( null , "Option-PageDown" ) , exec : function ( e ) { e . scrollPageDown ( ) } , readOnly : ! 0 } , { name : "gotopagedown" , bindKey : n ( "PageDown" , "PageDown|Ctrl-V" ) , exec : function ( e ) { e . gotoPageDown ( ) } , readOnly : ! 0 } , { name : "selectpageup" , bindKey : "Shift-PageUp" , exec : function ( e ) { e . selectPageUp ( ) } , readOnly : ! 0 } , { name : "pageup" , bindKey : n ( null , "Option-PageUp" ) , exec : function ( e ) { e . scrollPageUp ( ) } , readOnly : ! 0 } , { name : "gotopageup" , bindKey : "PageUp" , exec : function ( e ) { e . gotoPageUp ( ) } , readOnly : ! 0 } , { name : "scrollup" , bindKey : n ( "Ctrl-Up" , null ) , exec : function ( e ) { e . renderer . scrollBy ( 0 , - 2 * e . renderer . layerConfig . lineHeight ) } , readOnly : ! 0 } , { name : "scrolldown" , bindKey : n ( "Ctrl-Down" , null ) , exec : function ( e ) { e . renderer . scrollBy ( 0 , 2 * e . renderer . layerConfig . lineHeight ) } , readOnly : ! 0 } , { name : "selectlinestart" , bindKey : "Shift-Home" , exec : function ( e ) { e . getSelection ( ) . selectLineStart ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "selectlineend" , bindKey : "Shift-End" , exec : function ( e ) { e . getSelection ( ) . selectLineEnd ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "togglerecording" , bindKey : n ( "Ctrl-Alt-E" , "Command-Option-E" ) , exec : function ( e ) { e . commands . toggleRecording ( e ) } , readOnly : ! 0 } , { name : "replaymacro" , bindKey : n ( "Ctrl-Shift-E" , "Command-Shift-E" ) , exec : function ( e ) { e . commands . replay ( e ) } , readOnly : ! 0 } , { name : "jumptomatching" , bindKey : n ( "Ctrl-P" , "Ctrl-P" ) , exec : function ( e ) { e . jumpToMatching ( ) } , multiSelectAction : "forEach" , scrollIntoView : "animate" , readOnly : ! 0 } , { name : "selecttomatching" , bindKey : n ( "Ctrl-Shift-P" , "Ctrl-Shift-P" ) , exec : function ( e ) { e . jumpToMatching ( ! 0 ) } , multiSelectAction : "forEach" , scrollIntoView : "animate" , readOnly : ! 0 } , { name : "expandToMatching" , bindKey : n ( "Ctrl-Shift-M" , "Ctrl-Shift-M" ) , exec : function ( e ) { e . jumpToMatching ( ! 0 , ! 0 ) } , multiSelectAction : "forEach" , scrollIntoView : "animate" , readOnly : ! 0 } , { name : "passKeysToBrowser" , bindKey : n ( null , null ) , exec : function ( ) { } , passEvent : ! 0 , readOnly : ! 0 } , { name : "copy" , exec : function ( e ) { } , readOnly : ! 0 } , { name : "cut" , exec : function ( e ) { var t = e . getSelectionRange ( ) ; e . _emit ( "cut" , t ) , e . selection . isEmpty ( ) || ( e . session . remove ( t ) , e . clearSelection ( ) ) } , scrollIntoView : "cursor" , multiSelectAction : "forEach" } , { name : "paste" , exec : function ( e , t ) { e . $handlePaste ( t ) } , scrollIntoView : "cursor" } , { name : "removeline" , bindKey : n ( "Ctrl-D" , "Command-D" ) , exec : function ( e ) { e . removeLines ( ) } , scrollIntoView : "cursor" , multiSelectAction : "forEachLine" } , { name : "duplicateSelection" , bindKey : n ( "Ctrl-Shift-D"
return t + n . length } , this . renderIndentGuide = function ( e , t , i ) { var n = t . search ( this . $indentGuideRe ) ; return n <= 0 || n >= i ? t : " " == t [ 0 ] ? ( n -= n % this . tabSize , e . push ( o . stringRepeat ( this . $tabStrings [ " " ] , n / this . tabSize ) ) , t . substr ( n ) ) : "\t" == t [ 0 ] ? ( e . push ( o . stringRepeat ( this . $tabStrings [ "\t" ] , n ) ) , t . substr ( n ) ) : t } , this . $renderWrappedLine = function ( e , t , i , n ) { for ( var r = 0 , s = 0 , a = i [ 0 ] , l = 0 , c = 0 ; c < t . length ; c ++ ) { var h = t [ c ] , d = h . value ; if ( 0 == c && this . displayIndentGuides ) { if ( r = d . length , ! ( d = this . renderIndentGuide ( e , d , a ) ) ) continue ; r -= d . length } if ( r + d . length < a ) l = this . $renderToken ( e , l , h , d ) , r += d . length ; else { for ( ; r + d . length >= a ; ) l = this . $renderToken ( e , l , h , d . substring ( 0 , a - r ) ) , d = d . substring ( a - r ) , r = a , n || e . push ( "</div>" , "<div class='ace_line' style='height:" , this . config . lineHeight , "px'>" ) , e . push ( o . stringRepeat ( " " , i . indent ) ) , s ++ , l = 0 , a = i [ s ] || Number . MAX _VALUE ; 0 != d . length && ( r += d . length , l = this . $renderToken ( e , l , h , d ) ) } } } , this . $renderSimpleLine = function ( e , t ) { var i = 0 , n = t [ 0 ] , r = n . value ; this . displayIndentGuides && ( r = this . renderIndentGuide ( e , r ) ) , r && ( i = this . $renderToken ( e , i , n , r ) ) ; for ( var o = 1 ; o < t . length ; o ++ ) n = t [ o ] , r = n . value , i = this . $renderToken ( e , i , n , r ) } , this . $renderLine = function ( e , t , i , n ) { if ( n || 0 == n || ( n = this . session . getFoldLine ( t ) ) , n ) var r = this . $getFoldLineTokens ( t , n ) ; else var r = this . session . getTokens ( t ) ; if ( i || e . push ( "<div class='ace_line' style='height:" , this . config . lineHeight * ( this . $useLineGroups ( ) ? 1 : this . session . getRowLength ( t ) ) , "px'>" ) , r . length ) { var o = this . session . getRowSplitData ( t ) ; o && o . length ? this . $renderWrappedLine ( e , r , o , i ) : this . $renderSimpleLine ( e , r ) } this . showInvisibles && ( n && ( t = n . end . row ) , e . push ( "<span class='ace_invisible ace_invisible_eol'>" , t == this . session . getLength ( ) - 1 ? this . EOF _CHAR : this . EOL _CHAR , "</span>" ) ) , i || e . push ( "</div>" ) } , this . $getFoldLineTokens = function ( e , t ) { function i ( e , t , i ) { for ( var n = 0 , o = 0 ; o + e [ n ] . value . length < t ; ) if ( o += e [ n ] . value . length , ++ n == e . length ) return ; if ( o != t ) { var s = e [ n ] . value . substring ( t - o ) ; s . length > i - t && ( s = s . substring ( 0 , i - t ) ) , r . push ( { type : e [ n ] . type , value : s } ) , o = t + s . length , n += 1 } for ( ; o < i && n < e . length ; ) { var s = e [ n ] . value ; s . length + o > i ? r . push ( { type : e [ n ] . type , value : s . substring ( 0 , i - o ) } ) : r . push ( e [ n ] ) , o += s . length , n += 1 } } var n = this . session , r = [ ] , o = n . getTokens ( e ) ; return t . walk ( function ( e , t , s , a , l ) { null != e ? r . push ( { type : "fold" , value : e } ) : ( l && ( o = n . getTokens ( t ) ) , o . length && i ( o , a , s ) ) } , t . end . row , this . session . getLine ( t . end . row ) . length ) , r } , this . $useLineGroups = function ( ) { return this . session . getUseWrapMode ( ) } , this . destroy = function ( ) { clearInterval ( this . $pollSizeChangesTimer ) , this . $measureNode && this . $measureNode . parentNode . removeChild ( this . $measureNode ) , delete this . $measureNode } } ) . call ( a . prototype ) , t . Text = a } ) , ace . define ( "ace/layer/cursor" , [ "require" , "exports" , "module" , "ace/lib/dom" ] , function ( e , t , i ) { "use strict" ; var n , r = e ( "../lib/dom" ) , o = function ( e ) { this . element = r . createElement ( "div" ) , this . element . className = "ace_layer ace_cursor-layer" , e . appendChild ( this . element ) , void 0 === n && ( n = ! ( "opacity" in this . element . style ) ) , this . isVisible = ! 1 , this . isBlinking = ! 0 , this . blinkInterval = 1e3 , this . smoothBlinking = ! 1 , this . cursors = [ ] , this . cursor = this . addCursor ( ) , r . addCssClass ( this . element , "ace_hidden-cursors" ) , this . $updateCursors = ( n ? this . $updateVisibility : this . $updateOpacity ) . bind ( this ) } ; ( function ( ) { this . $updateVisibility = function ( e ) { for ( var t = this . cursors , i = t . length ; i -- ; ) t [ i ] . style . visibility = e ? "" : "hidden" } , this . $updateOpacity = function ( e ) { for ( var t = this . cursors , i = t . length ; i -- ; ) t [ i ] . style . opacity = e ? "" : "0" } , this . $padding = 0 , this . setPadding = function ( e ) { this . $padding = e } , this . setSession = function ( e ) { this . session = e } , this . setBlinking = function ( e ) { e != this . isBlinking && ( this . isBlinking = e , this . restartTimer ( ) ) } , this . setBlinkInterval = function ( e ) { e != this . blinkInterval && ( this . blinkInterval = e , this . restartTimer ( ) ) } , this . setSmoothBlinking = function ( e ) { e == this . smoothBlinking || n || ( this . smoothBlinking = e , r . setCssClass ( this . element , "ace_smooth-blinking" , e ) , this . $updateCursors ( ! 0 ) , this . $updateCursors = this . $updateOpacity . bind ( this ) , this . restartTimer ( ) ) } , this . addCursor = function ( ) { var e = r . createElement ( "div" ) ; return e . className = "ace_cursor" , this . element . appendChild ( e ) , this . cursors . push ( e ) , e } , this . removeCursor = function ( ) { if ( this . cursors . lengt
mac : "Ctrl-Alt-Left" } , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "selectMoreAfter" , exec : function ( e ) { e . selectMore ( 1 ) } , bindKey : { win : "Ctrl-Alt-Right" , mac : "Ctrl-Alt-Right" } , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "selectNextBefore" , exec : function ( e ) { e . selectMore ( - 1 , ! 0 ) } , bindKey : { win : "Ctrl-Alt-Shift-Left" , mac : "Ctrl-Alt-Shift-Left" } , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "selectNextAfter" , exec : function ( e ) { e . selectMore ( 1 , ! 0 ) } , bindKey : { win : "Ctrl-Alt-Shift-Right" , mac : "Ctrl-Alt-Shift-Right" } , scrollIntoView : "cursor" , readOnly : ! 0 } , { name : "splitIntoLines" , exec : function ( e ) { e . multiSelect . splitIntoLines ( ) } , bindKey : { win : "Ctrl-Alt-L" , mac : "Ctrl-Alt-L" } , readOnly : ! 0 } , { name : "alignCursors" , exec : function ( e ) { e . alignCursors ( ) } , bindKey : { win : "Ctrl-Alt-A" , mac : "Ctrl-Alt-A" } , scrollIntoView : "cursor" } , { name : "findAll" , exec : function ( e ) { e . findAll ( ) } , bindKey : { win : "Ctrl-Alt-K" , mac : "Ctrl-Alt-G" } , scrollIntoView : "cursor" , readOnly : ! 0 } ] , t . multiSelectCommands = [ { name : "singleSelection" , bindKey : "esc" , exec : function ( e ) { e . exitMultiSelectMode ( ) } , scrollIntoView : "cursor" , readOnly : ! 0 , isAvailable : function ( e ) { return e && e . inMultiSelectMode } } ] ; var n = e ( "../keyboard/hash_handler" ) . HashHandler ; t . keyboardHandler = new n ( t . multiSelectCommands ) } ) , ace . define ( "ace/multi_select" , [ "require" , "exports" , "module" , "ace/range_list" , "ace/range" , "ace/selection" , "ace/mouse/multi_select_handler" , "ace/lib/event" , "ace/lib/lang" , "ace/commands/multi_select_commands" , "ace/search" , "ace/edit_session" , "ace/editor" , "ace/config" ] , function ( e , t , i ) { function n ( e , t , i ) { return m . $options . wrap = ! 0 , m . $options . needle = t , m . $options . backwards = - 1 == i , m . find ( e ) } function r ( e , t ) { return e . row == t . row && e . column == t . column } function o ( e ) { e . $multiselectOnSessionChange || ( e . $onAddRange = e . $onAddRange . bind ( e ) , e . $onRemoveRange = e . $onRemoveRange . bind ( e ) , e . $onMultiSelect = e . $onMultiSelect . bind ( e ) , e . $onSingleSelect = e . $onSingleSelect . bind ( e ) , e . $multiselectOnSessionChange = t . onSessionChange . bind ( e ) , e . $checkMultiselectChange = e . $checkMultiselectChange . bind ( e ) , e . $multiselectOnSessionChange ( e ) , e . on ( "changeSession" , e . $multiselectOnSessionChange ) , e . on ( "mousedown" , h ) , e . commands . addCommands ( f . defaultCommands ) , s ( e ) ) } function s ( e ) { function t ( t ) { n && ( e . renderer . setMouseCursor ( "" ) , n = ! 1 ) } var i = e . textInput . getElement ( ) , n = ! 1 ; d . addListener ( i , "keydown" , function ( i ) { var r = 18 == i . keyCode && ! ( i . ctrlKey || i . shiftKey || i . metaKey ) ; e . $blockSelectEnabled && r ? n || ( e . renderer . setMouseCursor ( "crosshair" ) , n = ! 0 ) : n && t ( ) } ) , d . addListener ( i , "keyup" , t ) , d . addListener ( i , "blur" , t ) } var a = e ( "./range_list" ) . RangeList , l = e ( "./range" ) . Range , c = e ( "./selection" ) . Selection , h = e ( "./mouse/multi_select_handler" ) . onMouseDown , d = e ( "./lib/event" ) , u = e ( "./lib/lang" ) , f = e ( "./commands/multi_select_commands" ) ; t . commands = f . defaultCommands . concat ( f . multiSelectCommands ) ; var p = e ( "./search" ) . Search , m = new p , g = e ( "./edit_session" ) . EditSession ; ( function ( ) { this . getSelectionMarkers = function ( ) { return this . $selectionMarkers } } ) . call ( g . prototype ) , function ( ) { this . ranges = null , this . rangeList = null , this . addRange = function ( e , t ) { if ( e ) { if ( ! this . inMultiSelectMode && 0 === this . rangeCount ) { var i = this . toOrientedRange ( ) ; if ( this . rangeList . add ( i ) , this . rangeList . add ( e ) , 2 != this . rangeList . ranges . length ) return this . rangeList . removeAll ( ) , t || this . fromOrientedRange ( e ) ; this . rangeList . removeAll ( ) , this . rangeList . add ( i ) , this . $onAddRange ( i ) } e . cursor || ( e . cursor = e . end ) ; var n = this . rangeList . add ( e ) ; return this . $onAddRange ( e ) , n . length && this . $onRemoveRange ( n ) , this . rangeCount > 1 && ! this . inMultiSelectMode && ( this . _signal ( "multiSelect" ) , this . inMultiSelectMode = ! 0 , this . session . $undoSelect = ! 1 , this . rangeList . attach ( this . session ) ) , t || this . fromOrientedRange ( e ) } } , this . toSingleRange = function ( e ) { e = e || this . ranges [ 0 ] ; var t = this . rangeList . removeAll ( ) ; t . length && this . $onRemoveRange ( t ) , e && this . fromOrientedRange ( e ) } , this . substractPoint = function ( e ) { var t = this . rangeList . substractPoint ( e ) ; if ( t ) return this . $onRemoveRange ( t ) , t [ 0 ] } , this . mergeOverlappingRanges = function ( ) { var e = this . rangeList . merge ( ) ; e . length ? this . $onRemoveRange ( e ) : this . ranges [ 0 ] && this . fromOrientedRange ( this . ranges [ 0 ] ) } , this . $onAddRange = function ( e ) { this . rangeCount = this . rangeList . ranges . length , this . ranges . unshift ( e ) , this . _sign
2018-01-19 03:48:31 +08:00
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