/*! * 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-2019 Jos de Jong, http://jsoneditoronline.org * * @author Jos de Jong, * @version 5.32.1 * @date 2019-03-28 */ !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 o=i[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.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 o=c.getInternetExplorerVersion();if(-1!=o&&o<9)throw new Error("Unsupported browser, IE9 or newer required. Please install the newest version of your browser.");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.onChangeJSON&&("text"===t.mode||"code"===t.mode||t.modes&&(-1!==t.modes.indexOf("text")||-1!==t.modes.indexOf("code")))&&console.warn('Option "onChangeJSON" is not applicable to modes "text" and "code". Use "onChangeText" or "onChange" instead.'),t&&Object.keys(t).forEach(function(e){-1===n.VALID_OPTIONS.indexOf(e)&&console.warn('Unknown option "'+e+'". This option will be ignored')})),arguments.length&&this._create(e,t,i)}var o;try{o=i(!function(){var e=new Error('Cannot find module "ajv"');throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}var r=i(1),s=i(5),a=i(6),l=i(29),c=i(12);"undefined"==typeof Promise&&console.error("Promise undefined. Please load a Promise polyfill in the browser in order to use JSONEditor"),n.modes={},n.prototype.DEBOUNCE_INTERVAL=150,n.VALID_OPTIONS=["ajv","schema","schemaRefs","templates","ace","theme","autocomplete","onChange","onChangeJSON","onChangeText","onEditable","onError","onEvent","onModeChange","onNodeName","onValidate","onCreateMenu","onSelectionChange","onTextSelectionChange","onClassName","colorPicker","onColorPicker","timestampTag","escapeUnicode","history","search","mode","modes","name","indentation","sortObjectKeys","navigationBar","statusBar","mainMenuBar","languages","language","enableSort","enableTransform","maxVisibleChilds"],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=c.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){if(e!==this.options.mode||!this.create){var t,i,o=this.container,r=c.extend({},this.options),s=r.mode;r.mode=e;var a=n.modes[e];if(!a)throw new Error('Unknown mode "'+r.mode+'"');try{var l="text"==a.data;if(i=this.getName(),t=this[l?"getText":"get"](),this.destroy(),c.clear(this),c.extend(this,a.mixin),this.create(o,r),this.setName(i),this[l?"setText":"set"](t),"function"==typeof a.load)try{a.load.call(this)}catch(e){console.error(e)}if("function"==typeof r.onModeChange&&e!==s)try{r.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||o({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(c.isArray(e))for(t=0;tc)break;var h=this.getFoldWidgetRange(e,"all",t);if(h){if(h.start.row<=r)break;if(h.isMultiLine())t=h.end.row;else if(n==c)break}a=t}}return new o(r,s,a,e.getLine(a).length)},this.getCommentRegionBlock=function(e,t,i){for(var n=t.search(/\s*$/),r=e.getLength(),s=i,a=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,l=1;++is)return new o(s,n,h,t.length)}}.call(s.prototype)}),ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"],function(e,t,n){"use strict";var o=e("../lib/oop"),r=e("./text").Mode,s=e("./json_highlight_rules").JsonHighlightRules,a=e("./matching_brace_outdent").MatchingBraceOutdent,l=e("./behaviour/cstyle").CstyleBehaviour,c=e("./folding/cstyle").FoldMode,h=e("../worker/worker_client").WorkerClient,d=function(){this.HighlightRules=s,this.$outdent=new a,this.$behaviour=new l,this.foldingRules=new c};o.inherits(d,r),function(){this.getNextLineIndent=function(e,t,i){var n=this.$getIndent(t);if("start"==e){t.match(/^.*[\{\(\[]\s*$/)&&(n+=i)}return n},this.checkOutdent=function(e,t,i){return this.$outdent.checkOutdent(t,i)},this.autoOutdent=function(e,t,i){this.$outdent.autoOutdent(t,i)},this.createWorker=function(e){var t=new h(["ace"],i(3),"JsonWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/json"}.call(d.prototype),t.Mode=d})},function(e,t){e.exports.id="ace/mode/json_worker",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";exports.inherits=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})},exports.mixin=function(obj,mixin){for(var key in mixin)obj[key]=mixin[key];return obj},exports.implement=function(proto,mixin){exports.mixin(proto,mixin)}}),ace.define("ace/range",["require","exports","module"],function(acequire,exports){"use strict";var comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},Range=function(startRow,startColumn,endRow,endColumn){this.start={row:startRow,column:startColumn},this.end={row:endRow,column:endColumn}};(function(){this.isEqual=function(range){return this.start.row===range.start.row&&this.end.row===range.end.row&&this.start.column===range.start.column&&this.end.column===range.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(row,column){return 0==this.compare(row,column)},this.compareRange=function(range){var cmp,end=range.end,start=range.start;return cmp=this.compare(end.row,end.column),1==cmp?(cmp=this.compare(start.row,start.column),1==cmp?2:0==cmp?1:0):-1==cmp?-2:(cmp=this.compare(start.row,start.column),-1==cmp?-1:1==cmp?42:0)},this.comparePoint=function(p){return this.compare(p.row,p.column)},this.containsRange=function(range){return 0==this.comparePoint(range.start)&&0==this.comparePoint(range.end)},this.intersects=function(range){var cmp=this.compareRange(range);return-1==cmp||0==cmp||1==cmp},this.isEnd=function(row,column){return this.end.row==row&&this.end.column==column},this.isStart=function(row,column){return this.start.row==row&&this.start.column==column},this.setStart=function(row,column){"object"==typeof row?(this.start.column=row.column,this.start.row=row.row):(this.start.row=row,this.start.column=column)},this.setEnd=function(row,column){"object"==typeof row?(this.end.column=row.column,this.end.row=row.row):(this.end.row=row,this.end.column=column)},this.inside=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)||this.isStart(row,column)?!1:!0:!1},this.insideStart=function(row,column){return 0==this.compare(row,column)?this.isEnd(row,column)?!1:!0:!1},this.insideEnd=function(row,column){return 0==this.compare(row,column)?this.isStart(row,column)?!1:!0:!1},this.compare=function(row,column){return this.isMultiLine()||row!==this.start.row?this.start.row>row?-1:row>this.end.row?1:this.start.row===row?column>=this.start.column?0:-1:this.end.row===row?this.end.column>=column?0:1:0:this.start.column>column?-1:column>this.end.column?1:0},this.compareStart=function(row,column){return this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.compareEnd=function(row,column){return this.end.row==row&&this.end.column==column?1:this.compare(row,column)},this.compareInside=function(row,column){return this.end.row==row&&this.end.column==column?1:this.start.row==row&&this.start.column==column?-1:this.compare(row,column)},this.clipRows=function(firstRow,lastRow){if(this.end.row>lastRow)var end={row:lastRow+1,column:0};else if(firstRow>this.end.row)var end={row:firstRow,column:0};if(this.start.row>lastRow)var start={row:lastRow+1,column:0};else if(firstRow>this.start.row)var start={row:firstRow,column:0};return Range.fromPoints(start||this.start,end||this.end)},this.extend=function(row,column){var cmp=this.compare(row,column);if(0==cmp)return this;if(-1==cmp)var start={row:row,column:column};else var end={row:row,column:column};return Range.fromPoints(start||this.start,end||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return Range.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new Range(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new Range(this.start.row,0,this.end.row,0)},this.toScreenRange=function(session){var screenPosStart=session.documentToScreenPosition(this.start),screenPosEnd=session.documentToScreenPosition(this.end);return new Range(screenPosStart.row,screenPosStart.column,screenPosEnd.row,screenPosEnd.column)},this.moveBy=function(row,column){this.start.row+=row,this.start.column+=column,this.end.row+=row,this.end.column+=column}}).call(Range.prototype),Range.fromPoints=function(start,end){return new Range(start.row,start.column,end.row,end.column)},Range.comparePoints=comparePoints,Range.comparePoints=function(p1,p2){return p1.row-p2.row||p1.column-p2.column},exports.Range=Range}),ace.define("ace/apply_delta",["require","exports","module"],function(acequire,exports){"use strict";exports.applyDelta=function(docLines,delta){var row=delta.start.row,startColumn=delta.start.column,line=docLines[row]||"";switch(delta.action){case"insert":var lines=delta.lines;if(1===lines.length)docLines[row]=line.substring(0,startColumn)+delta.lines[0]+line.substring(startColumn);else{var args=[row,1].concat(delta.lines);docLines.splice.apply(docLines,args),docLines[row]=line.substring(0,startColumn)+docLines[row],docLines[row+delta.lines.length-1]+=line.substring(startColumn)}break;case"remove":var endColumn=delta.end.column,endRow=delta.end.row;row===endRow?docLines[row]=line.substring(0,startColumn)+line.substring(endColumn):docLines.splice(row,endRow-row+1,line.substring(0,startColumn)+docLines[endRow].substring(endColumn))}}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(acequire,exports){"use strict";var EventEmitter={},stopPropagation=function(){this.propagationStopped=!0},preventDefault=function(){this.defaultPrevented=!0};EventEmitter._emit=EventEmitter._dispatchEvent=function(eventName,e){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var listeners=this._eventRegistry[eventName]||[],defaultHandler=this._defaultHandlers[eventName];if(listeners.length||defaultHandler){"object"==typeof e&&e||(e={}),e.type||(e.type=eventName),e.stopPropagation||(e.stopPropagation=stopPropagation),e.preventDefault||(e.preventDefault=preventDefault),listeners=listeners.slice();for(var i=0;listeners.length>i&&(listeners[i](e,this),!e.propagationStopped);i++);return defaultHandler&&!e.defaultPrevented?defaultHandler(e,this):void 0}},EventEmitter._signal=function(eventName,e){var listeners=(this._eventRegistry||{})[eventName];if(listeners){listeners=listeners.slice();for(var i=0;listeners.length>i;i++)listeners[i](e,this)}},EventEmitter.once=function(eventName,callback){var _self=this;callback&&this.addEventListener(eventName,function newCallback(){_self.removeEventListener(eventName,newCallback),callback.apply(null,arguments)})},EventEmitter.setDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers||(handlers=this._defaultHandlers={_disabled_:{}}),handlers[eventName]){var old=handlers[eventName],disabled=handlers._disabled_[eventName];disabled||(handlers._disabled_[eventName]=disabled=[]),disabled.push(old);var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}handlers[eventName]=callback},EventEmitter.removeDefaultHandler=function(eventName,callback){var handlers=this._defaultHandlers;if(handlers){var disabled=handlers._disabled_[eventName];if(handlers[eventName]==callback)handlers[eventName],disabled&&this.setDefaultHandler(eventName,disabled.pop());else if(disabled){var i=disabled.indexOf(callback);-1!=i&&disabled.splice(i,1)}}},EventEmitter.on=EventEmitter.addEventListener=function(eventName,callback,capturing){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];return listeners||(listeners=this._eventRegistry[eventName]=[]),-1==listeners.indexOf(callback)&&listeners[capturing?"unshift":"push"](callback),callback},EventEmitter.off=EventEmitter.removeListener=EventEmitter.removeEventListener=function(eventName,callback){this._eventRegistry=this._eventRegistry||{};var listeners=this._eventRegistry[eventName];if(listeners){var index=listeners.indexOf(callback);-1!==index&&listeners.splice(index,1)}},EventEmitter.removeAllListeners=function(eventName){this._eventRegistry&&(this._eventRegistry[eventName]=[])},exports.EventEmitter=EventEmitter}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(acequire,exports){"use strict";var oop=acequire("./lib/oop"),EventEmitter=acequire("./lib/event_emitter").EventEmitter,Anchor=exports.Anchor=function(doc,row,column){this.$onChange=this.onChange.bind(this),this.attach(doc),column===void 0?this.setPosition(row.row,row.column):this.setPosition(row,column)};(function(){function $pointsInOrder(point1,point2,equalPointsInOrder){var bColIsAfter=equalPointsInOrder?point1.column<=point2.column:point1.columnthis.row)){var point=$getTransformedPoint(delta,{row:this.row,column:this.column},this.$insertRight);this.setPosition(point.row,point.column,!0)}},this.setPosition=function(row,column,noClip){var pos;if(pos=noClip?{row:row,column:column}:this.$clipPositionToDocument(row,column),this.row!=pos.row||this.column!=pos.column){var old={row:this.row,column:this.column};this.row=pos.row,this.column=pos.column,this._signal("change",{old:old,value:pos})}},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(doc){this.document=doc||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(row,column){var pos={};return row>=this.document.getLength()?(pos.row=Math.max(0,this.document.getLength()-1),pos.column=this.document.getLine(pos.row).length):0>row?(pos.row=0,pos.column=0):(pos.row=row,pos.column=Math.min(this.document.getLine(pos.row).length,Math.max(0,column))),0>column&&(pos.column=0),pos}}).call(Anchor.prototype)}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(acequire,exports){"use strict";var oop=acequire("./lib/oop"),applyDelta=acequire("./apply_delta").applyDelta,EventEmitter=acequire("./lib/event_emitter").EventEmitter,Range=acequire("./range").Range,Anchor=acequire("./anchor").Anchor,Document=function(textOrLines){this.$lines=[""],0===textOrLines.length?this.$lines=[""]:Array.isArray(textOrLines)?this.insertMergedLines({row:0,column:0},textOrLines):this.insert({row:0,column:0},textOrLines)};(function(){oop.implement(this,EventEmitter),this.setValue=function(text){var len=this.getLength()-1;this.remove(new Range(0,0,len,this.getLine(len).length)),this.insert({row:0,column:0},text)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(row,column){return new Anchor(this,row,column)},this.$split=0==="aaa".split(/a/).length?function(text){return text.replace(/\\r\\n|\\r/g,"\\n").split("\\n")}:function(text){return text.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(text){var match=text.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=match?match[1]:"\\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\\r\\n";case"unix":return"\\n";default:return this.$autoNewLine||"\\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(newLineMode){this.$newLineMode!==newLineMode&&(this.$newLineMode=newLineMode,this._signal("changeNewLineMode"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(text){return"\\r\\n"==text||"\\r"==text||"\\n"==text},this.getLine=function(row){return this.$lines[row]||""},this.getLines=function(firstRow,lastRow){return this.$lines.slice(firstRow,lastRow+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(range){return this.getLinesForRange(range).join(this.getNewLineCharacter())},this.getLinesForRange=function(range){var lines;if(range.start.row===range.end.row)lines=[this.getLine(range.start.row).substring(range.start.column,range.end.column)];else{lines=this.getLines(range.start.row,range.end.row),lines[0]=(lines[0]||"").substring(range.start.column);var l=lines.length-1;range.end.row-range.start.row==l&&(lines[l]=lines[l].substring(0,range.end.column))}return lines},this.insertLines=function(row,lines){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(row,lines)},this.removeLines=function(firstRow,lastRow){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(firstRow,lastRow)},this.insertNewLine=function(position){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, [\'\', \'\']) instead."),this.insertMergedLines(position,["",""])},this.insert=function(position,text){return 1>=this.getLength()&&this.$detectNewLine(text),this.insertMergedLines(position,this.$split(text))},this.insertInLine=function(position,text){var start=this.clippedPos(position.row,position.column),end=this.pos(position.row,position.column+text.length);return this.applyDelta({start:start,end:end,action:"insert",lines:[text]},!0),this.clonePos(end)},this.clippedPos=function(row,column){var length=this.getLength();void 0===row?row=length:0>row?row=0:row>=length&&(row=length-1,column=void 0);var line=this.getLine(row);return void 0==column&&(column=line.length),column=Math.min(Math.max(column,0),line.length),{row:row,column:column}},this.clonePos=function(pos){return{row:pos.row,column:pos.column}},this.pos=function(row,column){return{row:row,column:column}},this.$clipPosition=function(position){var length=this.getLength();return position.row>=length?(position.row=Math.max(0,length-1),position.column=this.getLine(length-1).length):(position.row=Math.max(0,position.row),position.column=Math.min(Math.max(position.column,0),this.getLine(position.row).length)),position},this.insertFullLines=function(row,lines){row=Math.min(Math.max(row,0),this.getLength());var column=0;this.getLength()>row?(lines=lines.concat([""]),column=0):(lines=[""].concat(lines),row--,column=this.$lines[row].length),this.insertMergedLines({row:row,column:column},lines)},this.insertMergedLines=function(position,lines){var start=this.clippedPos(position.row,position.column),end={row:start.row+lines.length-1,column:(1==lines.length?start.column:0)+lines[lines.length-1].length};return this.applyDelta({start:start,end:end,action:"insert",lines:lines}),this.clonePos(end)},this.remove=function(range){var start=this.clippedPos(range.start.row,range.start.column),end=this.clippedPos(range.end.row,range.end.column);return this.applyDelta({start:start,end:end,action:"remove",lines:this.getLinesForRange({start:start,end:end})}),this.clonePos(start)},this.removeInLine=function(row,startColumn,endColumn){var start=this.clippedPos(row,startColumn),end=this.clippedPos(row,endColumn);return this.applyDelta({start:start,end:end,action:"remove",lines:this.getLinesForRange({start:start,end:end})},!0),this.clonePos(start)},this.removeFullLines=function(firstRow,lastRow){firstRow=Math.min(Math.max(0,firstRow),this.getLength()-1),lastRow=Math.min(Math.max(0,lastRow),this.getLength()-1);var deleteFirstNewLine=lastRow==this.getLength()-1&&firstRow>0,deleteLastNewLine=this.getLength()-1>lastRow,startRow=deleteFirstNewLine?firstRow-1:firstRow,startCol=deleteFirstNewLine?this.getLine(startRow).length:0,endRow=deleteLastNewLine?lastRow+1:lastRow,endCol=deleteLastNewLine?0:this.getLine(endRow).length,range=new Range(startRow,startCol,endRow,endCol),deletedLines=this.$lines.slice(firstRow,lastRow+1);return this.applyDelta({start:range.start,end:range.end,action:"remove",lines:this.getLinesForRange(range)}),deletedLines},this.removeNewLine=function(row){this.getLength()-1>row&&row>=0&&this.applyDelta({start:this.pos(row,this.getLine(row).length),end:this.pos(row+1,0),action:"remove",lines:["",""]})},this.replace=function(range,text){if(range instanceof Range||(range=Range.fromPoints(range.start,range.end)),0===text.length&&range.isEmpty())return range.start;if(text==this.getTextRange(range))return range.end;this.remove(range);var end;return end=text?this.insert(range.start,text):range.start},this.applyDeltas=function(deltas){for(var i=0;deltas.length>i;i++)this.applyDelta(deltas[i])},this.revertDeltas=function(deltas){for(var i=deltas.length-1;i>=0;i--)this.revertDelta(deltas[i])},this.applyDelta=function(delta,doNotValidate){var isInsert="insert"==delta.action;(isInsert?1>=delta.lines.length&&!delta.lines[0]:!Range.comparePoints(delta.start,delta.end))||(isInsert&&delta.lines.length>2e4&&this.$splitAndapplyLargeDelta(delta,2e4),applyDelta(this.$lines,delta,doNotValidate),this._signal("change",delta))},this.$splitAndapplyLargeDelta=function(delta,MAX){for(var lines=delta.lines,l=lines.length,row=delta.start.row,column=delta.start.column,from=0,to=0;;){from=to,to+=MAX-1;var chunk=lines.slice(from,to);if(to>l){delta.lines=chunk,delta.start.row=row+from,delta.start.column=column;break}chunk.push(""),this.applyDelta({start:this.pos(row+from,column),end:this.pos(row+to,column=0),action:delta.action,lines:chunk},!0)}},this.revertDelta=function(delta){this.applyDelta({start:this.clonePos(delta.start),end:this.clonePos(delta.end),action:"insert"==delta.action?"remove":"insert",lines:delta.lines.slice()})},this.indexToPosition=function(index,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,i=startRow||0,l=lines.length;l>i;i++)if(index-=lines[i].length+newlineLength,0>index)return{row:i,column:index+lines[i].length+newlineLength};return{row:l-1,column:lines[l-1].length}},this.positionToIndex=function(pos,startRow){for(var lines=this.$lines||this.getAllLines(),newlineLength=this.getNewLineCharacter().length,index=0,row=Math.min(pos.row,lines.length),i=startRow||0;row>i;++i)index+=lines[i].length+newlineLength;return index+pos.column}}).call(Document.prototype),exports.Document=Document}),ace.define("ace/lib/lang",["require","exports","module"],function(acequire,exports){"use strict";exports.last=function(a){return a[a.length-1]},exports.stringReverse=function(string){return string.split("").reverse().join("")},exports.stringRepeat=function(string,count){for(var result="";count>0;)1&count&&(result+=string),(count>>=1)&&(string+=string);return result};var trimBeginRegexp=/^\\s\\s*/,trimEndRegexp=/\\s\\s*$/;exports.stringTrimLeft=function(string){return string.replace(trimBeginRegexp,"")},exports.stringTrimRight=function(string){return string.replace(trimEndRegexp,"")},exports.copyObject=function(obj){var copy={};for(var key in obj)copy[key]=obj[key];return copy},exports.copyArray=function(array){for(var copy=[],i=0,l=array.length;l>i;i++)copy[i]=array[i]&&"object"==typeof array[i]?this.copyObject(array[i]):array[i];return copy},exports.deepCopy=function deepCopy(obj){if("object"!=typeof obj||!obj)return obj;var copy;if(Array.isArray(obj)){copy=[];for(var key=0;obj.length>key;key++)copy[key]=deepCopy(obj[key]);return copy}if("[object Object]"!==Object.prototype.toString.call(obj))return obj;copy={};for(var key in obj)copy[key]=deepCopy(obj[key]);return copy},exports.arrayToMap=function(arr){for(var map={},i=0;arr.length>i;i++)map[arr[i]]=1;return map},exports.createMap=function(props){var map=Object.create(null);for(var i in props)map[i]=props[i];return map},exports.arrayRemove=function(array,value){for(var i=0;array.length>=i;i++)value===array[i]&&array.splice(i,1)},exports.escapeRegExp=function(str){return str.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,"\\\\$1")},exports.escapeHTML=function(str){return str.replace(/&/g,"&").replace(/"/g,""").replace(/\'/g,"'").replace(/i;i+=2){if(Array.isArray(data[i+1]))var d={action:"insert",start:data[i],lines:data[i+1]};else var d={action:"remove",start:data[i],end:data[i+1]};doc.applyDelta(d,!0)}return _self.$timeout?deferredUpdate.schedule(_self.$timeout):(_self.onUpdate(),void 0)})};(function(){this.$timeout=500,this.setTimeout=function(timeout){this.$timeout=timeout},this.setValue=function(value){this.doc.setValue(value),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(callbackId){this.sender.callback(this.doc.getValue(),callbackId)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(Mirror.prototype)}),ace.define("ace/mode/json/json_parse",["require","exports","module"],function(){"use strict";var at,ch,text,value,escapee={\'"\':\'"\',"\\\\":"\\\\","/":"/",b:"\\b",f:"\\f",n:"\\n",r:"\\r",t:"\t"},error=function(m){throw{name:"SyntaxError",message:m,at:at,text:text}},next=function(c){return c&&c!==ch&&error("Expected \'"+c+"\' instead of \'"+ch+"\'"),ch=text.charAt(at),at+=1,ch},number=function(){var number,string="";for("-"===ch&&(string="-",next("-"));ch>="0"&&"9">=ch;)string+=ch,next();if("."===ch)for(string+=".";next()&&ch>="0"&&"9">=ch;)string+=ch;if("e"===ch||"E"===ch)for(string+=ch,next(),("-"===ch||"+"===ch)&&(string+=ch,next());ch>="0"&&"9">=ch;)string+=ch,next();return number=+string,isNaN(number)?(error("Bad number"),void 0):number},string=function(){var hex,i,uffff,string="";if(\'"\'===ch)for(;next();){if(\'"\'===ch)return next(),string;if("\\\\"===ch)if(next(),"u"===ch){for(uffff=0,i=0;4>i&&(hex=parseInt(next(),16),isFinite(hex));i+=1)uffff=16*uffff+hex;string+=String.fromCharCode(uffff)}else{if("string"!=typeof escapee[ch])break;string+=escapee[ch]}else string+=ch}error("Bad string")},white=function(){for(;ch&&" ">=ch;)next()},word=function(){switch(ch){case"t":return next("t"),next("r"),next("u"),next("e"),!0;case"f":return next("f"),next("a"),next("l"),next("s"),next("e"),!1;case"n":return next("n"),next("u"),next("l"),next("l"),null}error("Unexpected \'"+ch+"\'")},array=function(){var array=[];if("["===ch){if(next("["),white(),"]"===ch)return next("]"),array;for(;ch;){if(array.push(value()),white(),"]"===ch)return next("]"),array;next(","),white()}}error("Bad array")},object=function(){var key,object={};if("{"===ch){if(next("{"),white(),"}"===ch)return next("}"),object;for(;ch;){if(key=string(),white(),next(":"),Object.hasOwnProperty.call(object,key)&&error(\'Duplicate key "\'+key+\'"\'),object[key]=value(),white(),"}"===ch)return next("}"),object;next(","),white()}}error("Bad object")};return value=function(){switch(white(),ch){case"{":return object();case"[":return array();case\'"\':return string();case"-":return number();default:return ch>="0"&&"9">=ch?number():word()}},function(source,reviver){var result;return text=source,at=0,ch=" ",result=value(),white(),ch&&error("Syntax error"),"function"==typeof reviver?function walk(holder,key){var k,v,value=holder[key];if(value&&"object"==typeof value)for(k in value)Object.hasOwnProperty.call(value,k)&&(v=walk(value,k),void 0!==v?value[k]=v:delete value[k]);return reviver.call(holder,key,value)}({"":result},""):result}}),ace.define("ace/mode/json_worker",["require","exports","module","ace/lib/oop","ace/worker/mirror","ace/mode/json/json_parse"],function(acequire,exports){"use strict";var oop=acequire("../lib/oop"),Mirror=acequire("../worker/mirror").Mirror,parse=acequire("./json/json_parse"),JsonWorker=exports.JsonWorker=function(sender){Mirror.call(this,sender),this.setTimeout(200)};oop.inherits(JsonWorker,Mirror),function(){this.onUpdate=function(){var value=this.doc.getValue(),errors=[];try{value&&parse(value)}catch(e){var pos=this.doc.indexToPosition(e.at-1);errors.push({row:pos.row,column:pos.column,text:e.message,type:"error"})}this.sender.emit("annotate",errors)}}.call(JsonWorker.prototype)}),ace.define("ace/lib/es5-shim",["require","exports","module"],function(){function Empty(){}function doesDefinePropertyWork(object){try{return Object.defineProperty(object,"sentinel",{}),"sentinel"in object}catch(exception){}}function toInteger(n){return n=+n,n!==n?n=0:0!==n&&n!==1/0&&n!==-(1/0)&&(n=(n>0||-1)*Math.floor(Math.abs(n))),n}Function.prototype.bind||(Function.prototype.bind=function(that){var target=this;if("function"!=typeof target)throw new TypeError("Function.prototype.bind called on incompatible "+target);var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));return Object(result)===result?result:this}return target.apply(that,args.concat(slice.call(arguments)))};return target.prototype&&(Empty.prototype=target.prototype,bound.prototype=new Empty,Empty.prototype=null),bound});var defineGetter,defineSetter,lookupGetter,lookupSetter,supportsAccessors,call=Function.prototype.call,prototypeOfArray=Array.prototype,prototypeOfObject=Object.prototype,slice=prototypeOfArray.slice,_toString=call.bind(prototypeOfObject.toString),owns=call.bind(prototypeOfObject.hasOwnProperty);if((supportsAccessors=owns(prototypeOfObject,"__defineGetter__"))&&(defineGetter=call.bind(prototypeOfObject.__defineGetter__),defineSetter=call.bind(prototypeOfObject.__defineSetter__),lookupGetter=call.bind(prototypeOfObject.__lookupGetter__),lookupSetter=call.bind(prototypeOfObject.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function makeArray(l){var a=Array(l+2);return a[0]=a[1]=0,a}var lengthBefore,array=[];return array.splice.apply(array,makeArray(20)),array.splice.apply(array,makeArray(26)),lengthBefore=array.length,array.splice(5,0,"XXX"),lengthBefore+1==array.length,lengthBefore+1==array.length?!0:void 0\n}()){var array_splice=Array.prototype.splice;Array.prototype.splice=function(start,deleteCount){return arguments.length?array_splice.apply(this,[void 0===start?0:start,void 0===deleteCount?this.length-start:deleteCount].concat(slice.call(arguments,2))):[]}}else Array.prototype.splice=function(pos,removeCount){var length=this.length;pos>0?pos>length&&(pos=length):void 0==pos?pos=0:0>pos&&(pos=Math.max(length+pos,0)),length>pos+removeCount||(removeCount=length-pos);var removed=this.slice(pos,pos+removeCount),insert=slice.call(arguments,2),add=insert.length;if(pos===length)add&&this.push.apply(this,insert);else{var remove=Math.min(removeCount,length-pos),tailOldPos=pos+remove,tailNewPos=tailOldPos+add-remove,tailCount=length-tailOldPos,lengthAfterRemove=length-remove;if(tailOldPos>tailNewPos)for(var i=0;tailCount>i;++i)this[tailNewPos+i]=this[tailOldPos+i];else if(tailNewPos>tailOldPos)for(i=tailCount;i--;)this[tailNewPos+i]=this[tailOldPos+i];if(add&&pos===lengthAfterRemove)this.length=lengthAfterRemove,this.push.apply(this,insert);else for(this.length=lengthAfterRemove+add,i=0;add>i;++i)this[pos+i]=insert[i]}return removed};Array.isArray||(Array.isArray=function(obj){return"[object Array]"==_toString(obj)});var boxedString=Object("a"),splitString="a"!=boxedString[0]||!(0 in boxedString);if(Array.prototype.forEach||(Array.prototype.forEach=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,thisp=arguments[1],i=-1,length=self.length>>>0;if("[object Function]"!=_toString(fun))throw new TypeError;for(;length>++i;)i in self&&fun.call(thisp,self[i],i,object)}),Array.prototype.map||(Array.prototype.map=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0,result=Array(length),thisp=arguments[1];if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");for(var i=0;length>i;i++)i in self&&(result[i]=fun.call(thisp,self[i],i,object));return result}),Array.prototype.filter||(Array.prototype.filter=function(fun){var value,object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0,result=[],thisp=arguments[1];if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");for(var i=0;length>i;i++)i in self&&(value=self[i],fun.call(thisp,value,i,object)&&result.push(value));return result}),Array.prototype.every||(Array.prototype.every=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");for(var i=0;length>i;i++)if(i in self&&!fun.call(thisp,self[i],i,object))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0,thisp=arguments[1];if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");for(var i=0;length>i;i++)if(i in self&&fun.call(thisp,self[i],i,object))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0;if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");if(!length&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var result,i=0;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i++];break}if(++i>=length)throw new TypeError("reduce of empty array with no initial value")}for(;length>i;i++)i in self&&(result=fun.call(void 0,result,self[i],i,object));return result}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(fun){var object=toObject(this),self=splitString&&"[object String]"==_toString(this)?this.split(""):object,length=self.length>>>0;if("[object Function]"!=_toString(fun))throw new TypeError(fun+" is not a function");if(!length&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var result,i=length-1;if(arguments.length>=2)result=arguments[1];else for(;;){if(i in self){result=self[i--];break}if(0>--i)throw new TypeError("reduceRight of empty array with no initial value")}do i in this&&(result=fun.call(void 0,result,self[i],i,object));while(i--);return result}),Array.prototype.indexOf&&-1==[0,1].indexOf(1,2)||(Array.prototype.indexOf=function(sought){var self=splitString&&"[object String]"==_toString(this)?this.split(""):toObject(this),length=self.length>>>0;if(!length)return-1;var i=0;for(arguments.length>1&&(i=toInteger(arguments[1])),i=i>=0?i:Math.max(0,length+i);length>i;i++)if(i in self&&self[i]===sought)return i;return-1}),Array.prototype.lastIndexOf&&-1==[0,1].lastIndexOf(0,-3)||(Array.prototype.lastIndexOf=function(sought){var self=splitString&&"[object String]"==_toString(this)?this.split(""):toObject(this),length=self.length>>>0;if(!length)return-1;var i=length-1;for(arguments.length>1&&(i=Math.min(i,toInteger(arguments[1]))),i=i>=0?i:length-Math.abs(i);i>=0;i--)if(i in self&&sought===self[i])return i;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(object){return object.__proto__||(object.constructor?object.constructor.prototype:prototypeOfObject)}),!Object.getOwnPropertyDescriptor){var ERR_NON_OBJECT="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(object,property){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT+object);if(owns(object,property)){var descriptor,getter,setter;if(descriptor={enumerable:!0,configurable:!0},supportsAccessors){var prototype=object.__proto__;object.__proto__=prototypeOfObject;var getter=lookupGetter(object,property),setter=lookupSetter(object,property);if(object.__proto__=prototype,getter||setter)return getter&&(descriptor.get=getter),setter&&(descriptor.set=setter),descriptor}return descriptor.value=object[property],descriptor}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(object){return Object.keys(object)}),!Object.create){var createEmpty;createEmpty=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var empty={};for(var i in empty)empty[i]=null;return empty.constructor=empty.hasOwnProperty=empty.propertyIsEnumerable=empty.isPrototypeOf=empty.toLocaleString=empty.toString=empty.valueOf=empty.__proto__=null,empty},Object.create=function(prototype,properties){var object;if(null===prototype)object=createEmpty();else{if("object"!=typeof prototype)throw new TypeError("typeof prototype["+typeof prototype+"] != \'object\'");var Type=function(){};Type.prototype=prototype,object=new Type,object.__proto__=prototype}return void 0!==properties&&Object.defineProperties(object,properties),object}}if(Object.defineProperty){var definePropertyWorksOnObject=doesDefinePropertyWork({}),definePropertyWorksOnDom="undefined"==typeof document||doesDefinePropertyWork(document.createElement("div"));if(!definePropertyWorksOnObject||!definePropertyWorksOnDom)var definePropertyFallback=Object.defineProperty}if(!Object.defineProperty||definePropertyFallback){var ERR_NON_OBJECT_DESCRIPTOR="Property description must be an object: ",ERR_NON_OBJECT_TARGET="Object.defineProperty called on non-object: ",ERR_ACCESSORS_NOT_SUPPORTED="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(object,property,descriptor){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError(ERR_NON_OBJECT_TARGET+object);if("object"!=typeof descriptor&&"function"!=typeof descriptor||null===descriptor)throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR+descriptor);if(definePropertyFallback)try{return definePropertyFallback.call(Object,object,property,descriptor)}catch(exception){}if(owns(descriptor,"value"))if(supportsAccessors&&(lookupGetter(object,property)||lookupSetter(object,property))){var prototype=object.__proto__;object.__proto__=prototypeOfObject,delete object[property],object[property]=descriptor.value,object.__proto__=prototype}else object[property]=descriptor.value;else{if(!supportsAccessors)throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);owns(descriptor,"get")&&defineGetter(object,property,descriptor.get),owns(descriptor,"set")&&defineSetter(object,property,descriptor.set)}return object}}Object.defineProperties||(Object.defineProperties=function(object,properties){for(var property in properties)owns(properties,property)&&Object.defineProperty(object,property,properties[property]);return object}),Object.seal||(Object.seal=function(object){return object}),Object.freeze||(Object.freeze=function(object){return object});try{Object.freeze(function(){})}catch(exception){Object.freeze=function(freezeObject){return function(object){return"function"==typeof object?object:freezeObject(object)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(object){return object}),Object.isSealed||(Object.isSealed=function(){return!1}),Object.isFrozen||(Object.isFrozen=function(){return!1}),Object.isExtensible||(Object.isExtensible=function(object){if(Object(object)===object)throw new TypeError;for(var name="";owns(object,name);)name+="?";object[name]=!0;var returnValue=owns(object,name);return delete object[name],returnValue}),!Object.keys){var hasDontEnumBug=!0,dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;for(var key in{toString:null})hasDontEnumBug=!1;Object.keys=function(object){if("object"!=typeof object&&"function"!=typeof object||null===object)throw new TypeError("Object.keys called on a non-object");var keys=[];for(var name in object)owns(object,name)&&keys.push(name);if(hasDontEnumBug)for(var i=0,ii=dontEnumsLength;ii>i;i++){var dontEnum=dontEnums[i];owns(object,dontEnum)&&keys.push(dontEnum)}return keys}}Date.now||(Date.now=function(){return(new Date).getTime()});var ws="\t\\n\v\\f\\r   ᠎              \\u2028\\u2029\ufeff";if(!String.prototype.trim||ws.trim()){ws="["+ws+"]";var trimBeginRegexp=RegExp("^"+ws+ws+"*"),trimEndRegexp=RegExp(ws+ws+"*$");String.prototype.trim=function(){return(this+"").replace(trimBeginRegexp,"").replace(trimEndRegexp,"")}}var toObject=function(o){if(null==o)throw new TypeError("can\'t convert "+o+" to object");return Object(o)}});'},function(e,t){ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"],function(e,t,i){"use strict";var n=e("../lib/dom"),o=e("../lib/lang"),r=e("../lib/event"),s=e("../keyboard/hash_handler").HashHandler,a=e("../lib/keys");n.importCssString('\t.ace_search {\tbackground-color: #ddd;\tcolor: #666;\tborder: 1px solid #cbcbcb;\tborder-top: 0 none;\toverflow: hidden;\tmargin: 0;\tpadding: 4px 6px 0 4px;\tposition: absolute;\ttop: 0;\tz-index: 99;\twhite-space: normal;\t}\t.ace_search.left {\tborder-left: 0 none;\tborder-radius: 0px 0px 5px 0px;\tleft: 0;\t}\t.ace_search.right {\tborder-radius: 0px 0px 0px 5px;\tborder-right: 0 none;\tright: 0;\t}\t.ace_search_form, .ace_replace_form {\tmargin: 0 20px 4px 0;\toverflow: hidden;\tline-height: 1.9;\t}\t.ace_replace_form {\tmargin-right: 0;\t}\t.ace_search_form.ace_nomatch {\toutline: 1px solid red;\t}\t.ace_search_field {\tborder-radius: 3px 0 0 3px;\tbackground-color: white;\tcolor: black;\tborder: 1px solid #cbcbcb;\tborder-right: 0 none;\tbox-sizing: border-box!important;\toutline: 0;\tpadding: 0;\tfont-size: inherit;\tmargin: 0;\tline-height: inherit;\tpadding: 0 6px;\tmin-width: 17em;\tvertical-align: top;\t}\t.ace_searchbtn {\tborder: 1px solid #cbcbcb;\tline-height: inherit;\tdisplay: inline-block;\tpadding: 0 6px;\tbackground: #fff;\tborder-right: 0 none;\tborder-left: 1px solid #dcdcdc;\tcursor: pointer;\tmargin: 0;\tposition: relative;\tbox-sizing: content-box!important;\tcolor: #666;\t}\t.ace_searchbtn:last-child {\tborder-radius: 0 3px 3px 0;\tborder-right: 1px solid #cbcbcb;\t}\t.ace_searchbtn:disabled {\tbackground: none;\tcursor: default;\t}\t.ace_searchbtn:hover {\tbackground-color: #eef1f6;\t}\t.ace_searchbtn.prev, .ace_searchbtn.next {\tpadding: 0px 0.7em\t}\t.ace_searchbtn.prev:after, .ace_searchbtn.next:after {\tcontent: "";\tborder: solid 2px #888;\twidth: 0.5em;\theight: 0.5em;\tborder-width: 2px 0 0 2px;\tdisplay:inline-block;\ttransform: rotate(-45deg);\t}\t.ace_searchbtn.next:after {\tborder-width: 0 2px 2px 0 ;\t}\t.ace_searchbtn_close {\tbackground: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\tborder-radius: 50%;\tborder: 0 none;\tcolor: #656565;\tcursor: pointer;\tfont: 16px/16px Arial;\tpadding: 0;\theight: 14px;\twidth: 14px;\ttop: 9px;\tright: 7px;\tposition: absolute;\t}\t.ace_searchbtn_close:hover {\tbackground-color: #656565;\tbackground-position: 50% 100%;\tcolor: white;\t}\t.ace_button {\tmargin-left: 2px;\tcursor: pointer;\t-webkit-user-select: none;\t-moz-user-select: none;\t-o-user-select: none;\t-ms-user-select: none;\tuser-select: none;\toverflow: hidden;\topacity: 0.7;\tborder: 1px solid rgba(100,100,100,0.23);\tpadding: 1px;\tbox-sizing: border-box!important;\tcolor: black;\t}\t.ace_button:hover {\tbackground-color: #eee;\topacity:1;\t}\t.ace_button:active {\tbackground-color: #ddd;\t}\t.ace_button.checked {\tborder-color: #3399ff;\topacity:1;\t}\t.ace_search_options{\tmargin-bottom: 3px;\ttext-align: right;\t-webkit-user-select: none;\t-moz-user-select: none;\t-o-user-select: none;\t-ms-user-select: none;\tuser-select: none;\tclear: both;\t}\t.ace_search_counter {\tfloat: left;\tfont-family: arial;\tpadding: 0 8px;\t}',"ace_searchbox");var l=''.replace(/> +/g,">"),c=function(e,t,i){var o=n.createElement("div");o.innerHTML=l,this.element=o.firstChild,this.setSession=this.setSession.bind(this),this.$init(),this.setEditor(e)};(function(){this.setEditor=function(e){e.searchBox=this,e.renderer.scroller.appendChild(this.element),this.editor=e},this.setSession=function(e){this.searchRange=null,this.$syncOptions(!0)},this.$initElements=function(e){this.searchBox=e.querySelector(".ace_search_form"),this.replaceBox=e.querySelector(".ace_replace_form"),this.searchOption=e.querySelector("[action=searchInSelection]"),this.replaceOption=e.querySelector("[action=toggleReplace]"),this.regExpOption=e.querySelector("[action=toggleRegexpMode]"),this.caseSensitiveOption=e.querySelector("[action=toggleCaseSensitive]"),this.wholeWordOption=e.querySelector("[action=toggleWholeWords]"),this.searchInput=this.searchBox.querySelector(".ace_search_field"),this.replaceInput=this.replaceBox.querySelector(".ace_search_field"),this.searchCounter=e.querySelector(".ace_search_counter")},this.$init=function(){var e=this.element;this.$initElements(e);var t=this;r.addListener(e,"mousedown",function(e){setTimeout(function(){t.activeInput.focus()},0),r.stopPropagation(e)}),r.addListener(e,"click",function(e){var i=e.target||e.srcElement,n=i.getAttribute("action");n&&t[n]?t[n]():t.$searchBarKb.commands[n]&&t.$searchBarKb.commands[n].exec(t),r.stopPropagation(e)}),r.addCommandKeyListener(e,function(e,i,n){var o=a.keyCodeToString(n),s=t.$searchBarKb.findKeyCommand(i,o);s&&s.exec&&(s.exec(t),r.stopEvent(e))}),this.$onChange=o.delayedCall(function(){t.find(!1,!1)}),r.addListener(this.searchInput,"input",function(){t.$onChange.schedule(20)}),r.addListener(this.searchInput,"focus",function(){t.activeInput=t.searchInput,t.searchInput.value&&t.highlight()}),r.addListener(this.replaceInput,"focus",function(){t.activeInput=t.replaceInput,t.searchInput.value&&t.highlight()})},this.$closeSearchBarKb=new s([{bindKey:"Esc",name:"closeSearchBar",exec:function(e){e.searchBox.hide()}}]),this.$searchBarKb=new s,this.$searchBarKb.bindKeys({"Ctrl-f|Command-f":function(e){var t=e.isReplace=!e.isReplace;e.replaceBox.style.display=t?"":"none",e.replaceOption.checked=!1,e.$syncOptions(),e.searchInput.focus()},"Ctrl-H|Command-Option-F":function(e){e.replaceOption.checked=!0,e.$syncOptions(),e.replaceInput.focus()},"Ctrl-G|Command-G":function(e){e.findNext()},"Ctrl-Shift-G|Command-Shift-G":function(e){e.findPrev()},esc:function(e){setTimeout(function(){e.hide()})},Return:function(e){e.activeInput==e.replaceInput&&e.replace(),e.findNext()},"Shift-Return":function(e){e.activeInput==e.replaceInput&&e.replace(),e.findPrev()},"Alt-Return":function(e){e.activeInput==e.replaceInput&&e.replaceAll(),e.findAll()},Tab:function(e){(e.activeInput==e.replaceInput?e.searchInput:e.replaceInput).focus()}}),this.$searchBarKb.addCommands([{name:"toggleRegexpMode",bindKey:{win:"Alt-R|Alt-/",mac:"Ctrl-Alt-R|Ctrl-Alt-/"},exec:function(e){e.regExpOption.checked=!e.regExpOption.checked,e.$syncOptions()}},{name:"toggleCaseSensitive",bindKey:{win:"Alt-C|Alt-I",mac:"Ctrl-Alt-R|Ctrl-Alt-I"},exec:function(e){e.caseSensitiveOption.checked=!e.caseSensitiveOption.checked,e.$syncOptions()}},{name:"toggleWholeWords",bindKey:{win:"Alt-B|Alt-W",mac:"Ctrl-Alt-B|Ctrl-Alt-W"},exec:function(e){e.wholeWordOption.checked=!e.wholeWordOption.checked,e.$syncOptions()}},{name:"toggleReplace",exec:function(e){e.replaceOption.checked=!e.replaceOption.checked,e.$syncOptions()}},{name:"searchInSelection",exec:function(e){e.searchOption.checked=!e.searchRange,e.setSearchRange(e.searchOption.checked&&e.editor.getSelectionRange()),e.$syncOptions()}}]),this.setSearchRange=function(e){this.searchRange=e,e?this.searchRangeMarker=this.editor.session.addMarker(e,"ace_active-line"):this.searchRangeMarker&&(this.editor.session.removeMarker(this.searchRangeMarker),this.searchRangeMarker=null)},this.$syncOptions=function(e){n.setCssClass(this.replaceOption,"checked",this.searchRange),n.setCssClass(this.searchOption,"checked",this.searchOption.checked),this.replaceOption.textContent=this.replaceOption.checked?"-":"+",n.setCssClass(this.regExpOption,"checked",this.regExpOption.checked),n.setCssClass(this.wholeWordOption,"checked",this.wholeWordOption.checked),n.setCssClass(this.caseSensitiveOption,"checked",this.caseSensitiveOption.checked),this.replaceBox.style.display=this.replaceOption.checked?"":"none",this.find(!1,!1,e)},this.highlight=function(e){this.editor.session.highlight(e||this.editor.$search.$options.re),this.editor.renderer.updateBackMarkers()},this.find=function(e,t,i){var o=this.editor.find(this.searchInput.value,{skipCurrent:e,backwards:t,wrap:!0,regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked,preventScroll:i,range:this.searchRange}),r=!o&&this.searchInput.value;n.setCssClass(this.searchBox,"ace_nomatch",r),this.editor._emit("findSearchBox",{match:!r}),this.highlight(),this.updateCounter()},this.updateCounter=function(){var e=this.editor,t=e.$search.$options.re,i=0,n=0;if(t){var o=this.searchRange?e.session.getTextRange(this.searchRange):e.getValue(),r=e.session.doc.positionToIndex(e.selection.anchor);this.searchRange&&(r-=e.session.doc.positionToIndex(this.searchRange.start));for(var s,a=t.lastIndex=0;(s=t.exec(o))&&(i++,a=s.index,a<=r&&n++,!(i>999))&&(s[0]||(t.lastIndex=a+=1,!(a>=o.length))););}this.searchCounter.textContent=n+" of "+(i>999?"999+":i)},this.findNext=function(){this.find(!0,!1)},this.findPrev=function(){this.find(!0,!0)},this.findAll=function(){var e=this.editor.findAll(this.searchInput.value,{regExp:this.regExpOption.checked, caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked}),t=!e&&this.searchInput.value;n.setCssClass(this.searchBox,"ace_nomatch",t),this.editor._emit("findSearchBox",{match:!t}),this.highlight(),this.hide()},this.replace=function(){this.editor.getReadOnly()||this.editor.replace(this.replaceInput.value)},this.replaceAndFindNext=function(){this.editor.getReadOnly()||(this.editor.replace(this.replaceInput.value),this.findNext())},this.replaceAll=function(){this.editor.getReadOnly()||this.editor.replaceAll(this.replaceInput.value)},this.hide=function(){this.active=!1,this.setSearchRange(null),this.editor.off("changeSession",this.setSession),this.element.style.display="none",this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb),this.editor.focus()},this.show=function(e,t){this.active=!0,this.editor.on("changeSession",this.setSession),this.element.style.display="",this.replaceOption.checked=t,e&&(this.searchInput.value=e),this.searchInput.focus(),this.searchInput.select(),this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb),this.$syncOptions(!0)},this.isFocused=function(){var e=document.activeElement;return e==this.searchInput||e==this.replaceInput}}).call(c.prototype),t.SearchBox=c,t.Search=function(e,t){(e.searchBox||new c(e)).show(e.session.getTextRange(),t)}}),function(){ace.acequire(["ace/ext/searchbox"],function(){})}()},function(e,t,i){var n;if(window.Picker)n=window.Picker;else try{n=i(!function(){var e=new Error('Cannot find module "vanilla-picker/dist/vanilla-picker"');throw e.code="MODULE_NOT_FOUND",e}())}catch(e){}e.exports=n},function(e,t,i){"use strict";var n=i(5),o=i(7),r=i(8),s=i(9),a=i(10),l=i(17),c=i(18),h=i(27),d=i(12),u=i(28),p=i(23),f=i(25),m=i(16).translate,g=i(16).setLanguages,v=i(16).setLanguage,y=document.body,b={};b.create=function(e,t){if(!e)throw new Error("No container element provided.");this.container=e,this.dom={},this.highlighter=new o,this.selection=void 0,this.multiselection={nodes:[]},this.validateSchema=null,this.validationSequence=0,this.errorNodes=[],this.node=null,this.focusTarget=null,this._setOptions(t),t.autocomplete&&(this.autocomplete=new u(t.autocomplete)),this.options.history&&"view"!==this.options.mode&&(this.history=new r(this)),this._createFrame(),this._createTable()},b.destroy=function(){this.frame&&this.container&&this.frame.parentNode==this.container&&(this.container.removeChild(this.frame),this.frame=null),this.container=null,this.dom=null,this.clear(),this.node=null,this.focusTarget=null,this.selection=null,this.multiselection=null,this.errorNodes=null,this.validateSchema=null,this._debouncedValidate=null,this.history&&(this.history.destroy(),this.history=null),this.searchBox&&(this.searchBox.destroy(),this.searchBox=null),this.modeSwitcher&&(this.modeSwitcher.destroy(),this.modeSwitcher=null)},b._setOptions=function(e){if(this.options={search:!0,history:!0,mode:"tree",name:void 0,schema:null,schemaRefs:null,autocomplete:null,navigationBar:!0,mainMenuBar:!0,onSelectionChange:null,colorPicker:!0,onColorPicker:function(e,t,i){n?new n({parent:e,color:t,popup:"bottom",onDone:function(e){var t=e.rgba[3],n=1===t?e.hex.substr(0,7):e.hex;i(n)}}).show():console.warn("Cannot open color picker: the `vanilla-picker` library is not included in the bundle. Either use the full bundle or implement your own color picker using `onColorPicker`.")},timestampTag:!0,onEvent:null,enableSort:!0,enableTransform:!0},e)for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.setSchema(this.options.schema,this.options.schemaRefs),this._debouncedValidate=d.debounce(this.validate.bind(this),this.DEBOUNCE_INTERVAL),e.onSelectionChange&&this.onSelectionChange(e.onSelectionChange),g(this.options.languages),v(this.options.language)},b.set=function(e){if(e instanceof Function||void 0===e)this.clear();else{this.content.removeChild(this.table);var t={field:this.options.name,value:e},i=new c(this,t);this._setRoot(i),this.validate();this.node.expand(!1),this.content.appendChild(this.table)}this.history&&this.history.clear(),this.searchBox&&this.searchBox.clear()},b.update=function(e){if(!this.node.deepEqual(e)){var t=this.getSelection();if(this.onChangeDisabled=!0,this.node.update(e),this.onChangeDisabled=!1,this.validate(),this.searchBox&&!this.searchBox.isEmpty()&&this.searchBox.forceSearch(),t&&t.start&&t.end){var i=this.node.findNodeByPath(t.start.path),n=this.node.findNodeByPath(t.end.path);i&&n?this.setSelection(t.start,t.end):this.setSelection({},{})}else this.setSelection({},{})}},b.get=function(){if(this.focusTarget){var e=c.getNodeFromTarget(this.focusTarget);e&&e.blur()}return this.node?this.node.getValue():void 0},b.getText=function(){return JSON.stringify(this.get())},b.setText=function(e){try{this.set(d.parse(e))}catch(i){var t=d.sanitize(e);this.set(d.parse(t))}},b.updateText=function(e){try{this.update(d.parse(e))}catch(i){var t=d.sanitize(e);this.update(d.parse(t))}},b.setName=function(e){this.options.name=e,this.node&&this.node.updateField(this.options.name)},b.getName=function(){return this.options.name},b.focus=function(){var e=this.scrollableContent.querySelector("[contenteditable=true]");e?e.focus():this.node.dom.expand?this.node.dom.expand.focus():this.node.dom.menu?this.node.dom.menu.focus():(e=this.frame.querySelector("button"))&&e.focus()},b.clear=function(){this.node&&(this.node.hide(),delete this.node),this.treePath&&this.treePath.reset()},b._setRoot=function(e){this.clear(),this.node=e,this.tbody.appendChild(e.getDom())},b.search=function(e){var t;return this.node?(this.content.removeChild(this.table),t=this.node.search(e),this.content.appendChild(this.table)):t=[],t},b.expandAll=function(){this.node&&(this.content.removeChild(this.table),this.node.expand(),this.content.appendChild(this.table))},b.collapseAll=function(){this.node&&(this.content.removeChild(this.table),this.node.collapse(),this.content.appendChild(this.table))},b._onAction=function(e,t){this.history&&this.history.add(e,t),this._onChange()},b._onChange=function(){if(!this.onChangeDisabled){if(this.selection=this.getDomSelection(),this._debouncedValidate(),this.treePath){var e=this.selection?this.node.findNodeByInternalPath(this.selection.path):this.multiselection?this.multiselection.nodes[0]:void 0;e?this._updateTreePath(e.getNodePath()):this.treePath.reset()}if(this.options.onChange)try{this.options.onChange()}catch(e){console.error("Error in onChange callback: ",e)}if(this.options.onChangeJSON)try{this.options.onChangeJSON(this.get())}catch(e){console.error("Error in onChangeJSON callback: ",e)}if(this.options.onChangeText)try{this.options.onChangeText(this.getText())}catch(e){console.error("Error in onChangeText callback: ",e)}if(this.options.onClassName&&this.node.recursivelyUpdateCssClassesOnNodes(),this.options.onNodeName&&this.node.childs)try{this.node.recursivelyUpdateNodeName()}catch(e){console.error("Error in onNodeName callback: ",e)}}},b.validate=function(){var e=this.node;if(e){var t=e.getValue(),i=e.validate(),n=[];if(this.validateSchema){this.validateSchema(t)||(n=this.validateSchema.errors.map(function(e){return d.improveSchemaError(e)}).map(function(t){return{node:e.findNode(t.dataPath),error:t}}).filter(function(e){return null!=e.node}))}try{this.validationSequence++;var o=this,r=this.validationSequence;this._validateCustom(t).then(function(e){if(r===o.validationSequence){var t=[].concat(i,n,e||[]);o._renderValidationErrors(t)}}).catch(function(e){console.error(e)})}catch(e){console.error(e)}}},b._renderValidationErrors=function(e){this.errorNodes&&this.errorNodes.forEach(function(e){e.setError(null)});var t=e.reduce(function(e,t){return t.node.findParents().filter(function(t){return!e.some(function(e){return e[0]===t})}).map(function(e){return[e,t.node]}).concat(e)},[]);this.errorNodes=t.map(function(e){return{node:e[0],child:e[1],error:{message:"object"===e[0].type?"Contains invalid properties":"Contains invalid items"}}}).concat(e).map(function(e){return e.node.setError(e.error,e.child),e.node})},b._validateCustom=function(e){try{if(this.options.onValidate){var t=this.node,i=this.options.onValidate(e);return(d.isPromise(i)?i:Promise.resolve(i)).then(function(e){return Array.isArray(e)?e.filter(function(e){var t=d.isValidValidationError(e);return t||console.warn('Ignoring a custom validation error with invalid structure. Expected structure: {path: [...], message: "..."}. Actual error:',e),t}).map(function(e){var i;try{i=e&&e.path?t.findNodeByPath(e.path):null}catch(e){}return i||console.warn("Ignoring validation error: node not found. Path:",e.path,"Error:",e),{node:i,error:e}}).filter(function(e){return e&&e.node&&e.error&&e.error.message}):null})}}catch(e){return Promise.reject(e)}return Promise.resolve(null)},b.refresh=function(){this.node&&this.node.updateDom({recurse:!0})},b.startAutoScroll=function(e){var t=this,i=this.scrollableContent,n=d.getAbsoluteTop(i),o=i.clientHeight,r=n+o;e0?this.autoScrollStep=(n+24-e)/3:e>r-24&&o+i.scrollTop0?this.multiselection.nodes.map(function(e){return e.getInternalPath()}):null,scrollTop:this.scrollableContent?this.scrollableContent.scrollTop:0}},b.scrollTo=function(e,t){var i=this.scrollableContent;if(i){var n=this;n.animateTimeout&&(clearTimeout(n.animateTimeout),delete n.animateTimeout),n.animateCallback&&(n.animateCallback(!1),delete n.animateCallback);var o=i.clientHeight,r=i.scrollHeight-o,s=Math.min(Math.max(e-o/4,0),r),a=function(){var e=i.scrollTop,o=s-e;Math.abs(o)>3?(i.scrollTop+=o/3,n.animateCallback=t,n.animateTimeout=setTimeout(a,50)):(t&&t(!0),i.scrollTop=s,delete n.animateTimeout,delete n.animateCallback)};a()}else t&&t(!1)},b._createFrame=function(){function e(e){t._onEvent&&t._onEvent(e)}this.frame=document.createElement("div"),this.frame.className="jsoneditor jsoneditor-mode-"+this.options.mode,this.container.appendChild(this.frame),this.contentOuter=document.createElement("div"),this.contentOuter.className="jsoneditor-outer";var t=this;if(this.frame.onclick=function(t){var i=t.target;e(t),"BUTTON"==i.nodeName&&t.preventDefault()},this.frame.oninput=e,this.frame.onchange=e,this.frame.onkeydown=e,this.frame.onkeyup=e,this.frame.oncut=e,this.frame.onpaste=e,this.frame.onmousedown=e,this.frame.onmouseup=e,this.frame.onmouseover=e,this.frame.onmouseout=e,d.addEventListener(this.frame,"focus",e,!0),d.addEventListener(this.frame,"blur",e,!0),this.frame.onfocusin=e,this.frame.onfocusout=e,this.options.mainMenuBar){d.addClassName(this.contentOuter,"has-main-menu-bar"),this.menu=document.createElement("div"),this.menu.className="jsoneditor-menu",this.frame.appendChild(this.menu);var i=document.createElement("button");i.type="button",i.className="jsoneditor-expand-all",i.title=m("expandAll"),i.onclick=function(){t.expandAll()},this.menu.appendChild(i);var n=document.createElement("button");if(n.type="button",n.title=m("collapseAll"),n.className="jsoneditor-collapse-all",n.onclick=function(){t.collapseAll()},this.menu.appendChild(n),this.options.enableSort){var o=document.createElement("button");o.type="button",o.className="jsoneditor-sort",o.title=m("sortTitleShort"),o.onclick=function(){var e=t.options.modalAnchor||y;p(t.node,e)},this.menu.appendChild(o)}if(this.options.enableTransform){var r=document.createElement("button");r.type="button",r.title=m("transformTitleShort"),r.className="jsoneditor-transform",r.onclick=function(){var e=t.options.modalAnchor||y;f(t.node,e)},this.menu.appendChild(r)}if(this.history){var a=document.createElement("button");a.type="button",a.className="jsoneditor-undo jsoneditor-separator",a.title=m("undo"),a.onclick=function(){t._onUndo()},this.menu.appendChild(a),this.dom.undo=a;var c=document.createElement("button");c.type="button",c.className="jsoneditor-redo",c.title=m("redo"),c.onclick=function(){t._onRedo()},this.menu.appendChild(c),this.dom.redo=c,this.history.onChange=function(){a.disabled=!t.history.canUndo(),c.disabled=!t.history.canRedo()},this.history.onChange()}if(this.options&&this.options.modes&&this.options.modes.length){var u=this;this.modeSwitcher=new h(this.menu,this.options.modes,this.options.mode,function(e){u.setMode(e),u.modeSwitcher.focus()})}this.options.search&&(this.searchBox=new s(this,this.menu))}this.options.navigationBar&&(this.navBar=document.createElement("div"),this.navBar.className="jsoneditor-navigation-bar nav-bar-empty",this.frame.appendChild(this.navBar),this.treePath=new l(this.navBar,this.frame),this.treePath.onSectionSelected(this._onTreePathSectionSelected.bind(this)),this.treePath.onContextMenuItemSelected(this._onTreePathMenuItemSelected.bind(this)))},b._onUndo=function(){this.history&&(this.history.undo(),this._onChange())},b._onRedo=function(){this.history&&(this.history.redo(),this._onChange())},b._onEvent=function(e){if(!c.targetIsColorPicker(e.target)){"keydown"===e.type&&this._onKeyDown(e),"focus"===e.type&&(this.focusTarget=e.target),"mousedown"===e.type&&this._startDragDistance(e),"mousemove"!==e.type&&"mouseup"!==e.type&&"click"!==e.type||this._updateDragDistance(e);var t=c.getNodeFromTarget(e.target);if(t&&this.options&&this.options.navigationBar&&t&&("keydown"===e.type||"mousedown"===e.type)){var i=this;setTimeout(function(){i._updateTreePath(t.getNodePath())})}if(t&&t.selected){if("click"===e.type){if(e.target===t.dom.menu)return void this.showContextMenu(e.target);e.hasMoved||this.deselect()}"mousedown"===e.type&&c.onDragStart(this.multiselection.nodes,e)}else"mousedown"===e.type&&d.hasParentNode(e.target,this.content)&&(this.deselect(),t&&e.target===t.dom.drag?c.onDragStart(t,e):(!t||e.target!==t.dom.field&&e.target!==t.dom.value&&e.target!==t.dom.select)&&this._onMultiSelectStart(e));t&&t.onEvent(e)}},b._updateTreePath=function(e){function t(e){return e.parent?"array"===e.parent.type?e.index:e.field:e.type}if(e&&e.length){d.removeClassName(this.navBar,"nav-bar-empty");var i=[];e.forEach(function(e){var n={name:t(e),node:e,children:[]};e.childs&&e.childs.length&&e.childs.forEach(function(e){n.children.push({name:t(e),node:e})}),i.push(n)}),this.treePath.setPath(i)}else d.addClassName(this.navBar,"nav-bar-empty")},b._onTreePathSectionSelected=function(e){e&&e.node&&(e.node.expandTo(),e.node.focus())},b._onTreePathMenuItemSelected=function(e,t){if(e&&e.children.length){var i=e.children.find(function(e){return e.name===t});i&&i.node&&(this._updateTreePath(i.node.getNodePath()),i.node.expandTo(),i.node.focus())}},b._startDragDistance=function(e){this.dragDistanceEvent={initialTarget:e.target,initialPageX:e.pageX,initialPageY:e.pageY,dragDistance:0,hasMoved:!1}},b._updateDragDistance=function(e){this.dragDistanceEvent||this._startDragDistance(e);var t=e.pageX-this.dragDistanceEvent.initialPageX,i=e.pageY-this.dragDistanceEvent.initialPageY;return this.dragDistanceEvent.dragDistance=Math.sqrt(t*t+i*i),this.dragDistanceEvent.hasMoved=this.dragDistanceEvent.hasMoved||this.dragDistanceEvent.dragDistance>10,e.dragDistance=this.dragDistanceEvent.dragDistance,e.hasMoved=this.dragDistanceEvent.hasMoved,e.dragDistance},b._onMultiSelectStart=function(e){var t=c.getNodeFromTarget(e.target);if("tree"===this.options.mode&&void 0===this.options.onEditable){this.multiselection={start:t||null,end:null,nodes:[]},this._startDragDistance(e);var i=this;this.mousemove||(this.mousemove=d.addEventListener(window,"mousemove",function(e){i._onMultiSelect(e)})),this.mouseup||(this.mouseup=d.addEventListener(window,"mouseup",function(e){i._onMultiSelectEnd(e)})),e.preventDefault()}},b._onMultiSelect=function(e){if(e.preventDefault(),this._updateDragDistance(e),e.hasMoved){var t=c.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 o=this.multiselection.nodes[0];this.multiselection.start===o||this.multiselection.start.isDescendantOf(o)?this.multiselection.direction="down":this.multiselection.direction="up"}this.select(this.multiselection.nodes)}}},b._onMultiSelectEnd=function(){this.multiselection.nodes[0]&&this.multiselection.nodes[0].dom.menu.focus(),this.multiselection.start=null,this.multiselection.end=null,this.mousemove&&(d.removeEventListener(window,"mousemove",this.mousemove),delete this.mousemove),this.mouseup&&(d.removeEventListener(window,"mouseup",this.mouseup),delete this.mouseup)},b.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()},b.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)}}},b._findTopLevelNodes=function(e,t){for(var i=e.getNodePath(),n=t.getNodePath(),o=0;o=0&&(l="value"),e.target.className.indexOf("jsoneditor-field")>=0&&(l="field");var h=c.getNodeFromTarget(e.target);setTimeout(function(e,t){if(t.innerText.length>0){var i=this.options.autocomplete.getOptions(t.innerText,e.getPath(),l,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,h,e.target),50)}s&&(e.preventDefault(),e.stopPropagation())},b._createTable=function(){this.options.navigationBar&&d.addClassName(this.contentOuter,"has-nav-bar"),this.scrollableContent=document.createElement("div"),this.scrollableContent.className="jsoneditor-tree",this.contentOuter.appendChild(this.scrollableContent),this.content=document.createElement("div"),this.content.className="jsoneditor-tree-inner",this.scrollableContent.appendChild(this.content),this.table=document.createElement("table"),this.table.className="jsoneditor-tree",this.content.appendChild(this.table);var e;this.colgroupContent=document.createElement("colgroup"),"tree"===this.options.mode&&(e=document.createElement("col"),e.width="24px",this.colgroupContent.appendChild(e)),e=document.createElement("col"),e.width="24px",this.colgroupContent.appendChild(e),e=document.createElement("col"),this.colgroupContent.appendChild(e),this.table.appendChild(this.colgroupContent),this.tbody=document.createElement("tbody"),this.table.appendChild(this.tbody),this.frame.appendChild(this.contentOuter)},b.showContextMenu=function(e,t){var i=[],n=this.multiselection.nodes.slice();i.push({text:m("duplicateText"),title:m("duplicateTitle"),className:"jsoneditor-duplicate",click:function(){c.onDuplicate(n)}}),i.push({text:m("remove"),title:m("removeTitle"),className:"jsoneditor-remove",click:function(){c.onRemove(n)}}),this.editor.options.onCreateMenu&&(i=this.editor.options.onCreateMenu(i,{path:node.getPath()})),new a(i,{close:t}).show(e,this.frame)},b.getSelection=function(){var e={start:null,end:null};if(this.multiselection.nodes&&this.multiselection.nodes.length&&this.multiselection.nodes.length){var t=this.multiselection.nodes[0],i=this.multiselection.nodes[this.multiselection.nodes.length-1];"down"===this.multiselection.direction?(e.start=t.serialize(),e.end=i.serialize()):(e.start=i.serialize(),e.end=t.serialize())}return e},b.onSelectionChange=function(e){"function"==typeof e&&(this._selectionChangedHandler=d.debounce(e,this.DEBOUNCE_INTERVAL))},b.setSelection=function(e,t){e&&e.dom&&e.range&&(console.warn("setSelection/getSelection usage for text selection is deprecated and should not be used, see documentation for supported selection options"),this.setDomSelection(e));var i=this._getNodeInstancesByRange(e,t);i.forEach(function(e){e.expandTo()}),this.select(i)},b._getNodeInstancesByRange=function(e,t){var i,n;e&&e.path&&(i=this.node.findNodeByPath(e.path),t&&t.path&&(n=this.node.findNodeByPath(t.path)));var o=[];if(i instanceof c)if(n instanceof c&&n!==i)if(i.parent===n.parent){var e,t;i.getIndex()=0},i.prototype.canRedo=function(){return this.indexthis.results.length-1&&(t=0),this._setActiveResult(t,e)}},i.prototype.previous=function(e){if(void 0!=this.results){var t=this.results.length-1,i=void 0!=this.resultIndex?this.resultIndex-1:t;i<0&&(i=t),this._setActiveResult(i,e)}},i.prototype._setActiveResult=function(e,t){if(this.activeResult){var i=this.activeResult.node;"field"==this.activeResult.elem?delete i.searchFieldActive:delete i.searchValueActive,i.updateDom()}if(!this.results||!this.results[e])return this.resultIndex=void 0,void(this.activeResult=void 0);this.resultIndex=e;var n=this.results[this.resultIndex].node,o=this.results[this.resultIndex].elem;"field"==o?n.searchFieldActive=!0:n.searchValueActive=!0,this.activeResult=this.results[this.resultIndex],n.updateDom(),n.scrollTo(function(){t&&n.focus(o)})},i.prototype._clearDelay=function(){void 0!=this.timeout&&(clearTimeout(this.timeout),delete this.timeout)},i.prototype._onDelayedSearch=function(e){this._clearDelay();var t=this;this.timeout=setTimeout(function(e){t._onSearch()},this.delay)},i.prototype._onSearch=function(e){this._clearDelay();var t=this.dom.search.value,i=t.length>0?t:void 0;if(i!==this.lastText||e){this.lastText=i,this.results=this.editor.search(i);var n=this.results[0]?this.results[0].node.MAX_SEARCH_RESULTS:1/0,o=0;if(this.activeResult)for(var r=0;rn?n+"+ results":s+" results"}else this.dom.results.innerHTML=""}},i.prototype._onKeyDown=function(e){var t=e.which;27==t?(this.dom.search.value="",this._onSearch(),e.preventDefault(),e.stopPropagation()):13==t&&(e.ctrlKey?this._onSearch(!0):e.shiftKey?this.previous():this.next(),e.preventDefault(),e.stopPropagation())},i.prototype._onKeyUp=function(e){var t=e.keyCode;27!=t&&13!=t&&this._onDelayedSearch(e)},i.prototype.clear=function(){this.dom.search.value="",this._onSearch()},i.prototype.forceSearch=function(){this._onSearch(!0)},i.prototype.isEmpty=function(){return""===this.dom.search.value},i.prototype.destroy=function(){this.editor=null,this.dom.container.removeChild(this.dom.table),this.dom=null,this.results=null,this.activeResult=null,this._clearDelay()},e.exports=i},function(e,t,i){"use strict";function n(e,t){function i(e,t,o){o.forEach(function(o){if("separator"==o.type){var r=document.createElement("div");r.className="jsoneditor-separator",l=document.createElement("li"),l.appendChild(r),e.appendChild(l)}else{var a={},l=document.createElement("li");e.appendChild(l);var c=document.createElement("button");if(c.type="button",c.className=o.className,a.button=c,o.title&&(c.title=o.title),o.click&&(c.onclick=function(e){e.preventDefault(),n.hide(),o.click()}),l.appendChild(c),o.submenu){var h=document.createElement("div");h.className="jsoneditor-icon",c.appendChild(h);var d=document.createElement("div");d.className="jsoneditor-text"+(o.click?"":" jsoneditor-right-margin"),d.appendChild(document.createTextNode(o.text)),c.appendChild(d);var u;if(o.click){c.className+=" jsoneditor-default";var p=document.createElement("button");p.type="button",a.buttonExpand=p,p.className="jsoneditor-expand",p.innerHTML='
',l.appendChild(p),o.submenuTitle&&(p.title=o.submenuTitle),u=p}else{var f=document.createElement("div");f.className="jsoneditor-expand",c.appendChild(f),u=c}u.onclick=function(e){e.preventDefault(),n._onExpandItem(a),u.focus()};var m=[];a.subItems=m;var g=document.createElement("ul");a.ul=g,g.className="jsoneditor-menu",g.style.height="0",l.appendChild(g),i(g,m,o.submenu)}else c.innerHTML='
'+s(o.text)+"
";t.push(a)}})}this.dom={};var n=this,o=this.dom;this.anchor=void 0,this.items=e,this.eventListeners={},this.selection=void 0,this.onClose=t?t.close:void 0;var r=document.createElement("div");r.className="jsoneditor-contextmenu-root",o.root=r;var a=document.createElement("div");a.className="jsoneditor-contextmenu",o.menu=a,r.appendChild(a);var l=document.createElement("ul");l.className="jsoneditor-menu",a.appendChild(l),o.list=l,o.items=[];var c=document.createElement("button");c.type="button",o.focusButton=c;var h=document.createElement("li");h.style.overflow="hidden",h.style.height="0",h.appendChild(c),l.appendChild(h),i(l,this.dom.items,e),this.maxHeight=0,e.forEach(function(t){var i=24*(e.length+(t.submenu?t.submenu.length:0));n.maxHeight=Math.max(n.maxHeight,i)})}var o=i(11).createAbsoluteAnchor,r=i(12),s=i(16).translate;n.prototype._getVisibleButtons=function(){var e=[],t=this;return this.dom.items.forEach(function(i){e.push(i.button),i.buttonExpand&&e.push(i.buttonExpand),i.subItems&&i==t.expandedItem&&i.subItems.forEach(function(t){e.push(t.button),t.buttonExpand&&e.push(t.buttonExpand)})}),e},n.visibleMenu=void 0,n.prototype.show=function(e,t,i){this.hide();var s=!0,a=e.parentNode,l=e.getBoundingClientRect(),c=a.getBoundingClientRect(),h=t.getBoundingClientRect(),d=this;this.dom.absoluteAnchor=o(e,t,function(){d.hide()}),l.bottom+this.maxHeighth.top&&(s=!1);var u=i?0:l.top-c.top;if(s){var p=e.offsetHeight;this.dom.menu.style.left="0",this.dom.menu.style.top=u+p+"px",this.dom.menu.style.bottom=""}else this.dom.menu.style.left="0",this.dom.menu.style.top="",this.dom.menu.style.bottom="0px";this.dom.absoluteAnchor.appendChild(this.dom.root),this.selection=r.getSelection(),this.anchor=e,setTimeout(function(){d.dom.focusButton.focus()},0),n.visibleMenu&&n.visibleMenu.hide(),n.visibleMenu=this},n.prototype.hide=function(){this.dom.absoluteAnchor&&(this.dom.absoluteAnchor.destroy(),delete this.dom.absoluteAnchor),this.dom.root.parentNode&&(this.dom.root.parentNode.removeChild(this.dom.root),this.onClose&&this.onClose()),n.visibleMenu==this&&(n.visibleMenu=void 0)},n.prototype._onExpandItem=function(e){var t=this,i=e==this.expandedItem,n=this.expandedItem;if(n&&(n.ul.style.height="0",n.ul.style.padding="",setTimeout(function(){t.expandedItem!=n&&(n.ul.style.display="",r.removeClassName(n.ul.parentNode,"jsoneditor-selected"))},300),this.expandedItem=void 0),!i){var o=e.ul;o.style.display="block";o.clientHeight;setTimeout(function(){if(t.expandedItem==e){for(var i=0,n=0;n=" "&&h<=" "||" "===h||" "===h||" "===h?(s.push(" "),a++):"'"===h?r("'"):'"'===h?r('"'):"`"===h?r("´"):"‘"===h?r("’"):"“"===h?r("”"):","===h&&-1!==["]","}"].indexOf(function(){for(var t=a+1;t=0;){var t=s[e];if(!o(t))return t;e--}return""}())?function(){for(var e=["null","true","false"],i="",n=t(),o=/[a-zA-Z_$\d]/;o.test(n);)i+=n,a++,n=t();-1===e.indexOf(i)?s.push('"'+i+'"'):s.push(i)}():(s.push(h),a++)}return s.join("")},t.escapeUnicodeChars=function(e){return e.replace(/[\u007F-\uFFFF]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})},t.validate=function(e){void 0!==n?n.parse(e):JSON.parse(e)},t.extend=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},t.clear=function(e){for(var t in e)e.hasOwnProperty(t)&&delete e[t];return e},t.type=function(e){return null===e?"null":void 0===e?"undefined":e instanceof Number||"number"==typeof e?"number":e instanceof String||"string"==typeof e?"string":e instanceof Boolean||"boolean"==typeof e?"boolean":e instanceof RegExp||"regexp"==typeof e?"regexp":t.isArray(e)?"array":"object"};var s=/^https?:\/\/\S+$/;t.isUrl=function(e){return("string"==typeof e||e instanceof String)&&s.test(e)},t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.getAbsoluteLeft=function(e){return e.getBoundingClientRect().left+window.pageXOffset||document.scrollLeft||0},t.getAbsoluteTop=function(e){return e.getBoundingClientRect().top+window.pageYOffset||document.scrollTop||0},t.addClassName=function(e,t){var i=e.className.split(" ");-1==i.indexOf(t)&&(i.push(t),e.className=i.join(" "))},t.removeAllClassNames=function(e){e.className=""},t.removeClassName=function(e,t){var i=e.className.split(" "),n=i.indexOf(t);-1!=n&&(i.splice(n,1),e.className=i.join(" "))},t.stripFormatting=function(e){for(var i=e.childNodes,n=0,o=i.length;n=0;a--){var l=s[a];!0===l.specified&&r.removeAttribute(l.name)}t.stripFormatting(r)}},t.setEndOfContentEditable=function(e){var t,i;document.createRange&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),i=window.getSelection(),i.removeAllRanges(),i.addRange(t))},t.selectContentEditable=function(e){if(e&&"DIV"==e.nodeName){var t,i;window.getSelection&&document.createRange&&(i=document.createRange(),i.selectNodeContents(e),t=window.getSelection(),t.removeAllRanges(),t.addRange(i))}},t.getSelection=function(){if(window.getSelection){var e=window.getSelection();if(e.getRangeAt&&e.rangeCount)return e.getRangeAt(0)}return null},t.setSelection=function(e){if(e&&window.getSelection){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)}},t.getSelectionOffset=function(){var e=t.getSelection();return e&&"startOffset"in e&&"endOffset"in e&&e.startContainer&&e.startContainer==e.endContainer?{startOffset:e.startOffset,endOffset:e.endOffset,container:e.startContainer.parentNode}:null},t.setSelectionOffset=function(e){if(document.createRange&&window.getSelection){if(window.getSelection()){var i=document.createRange();e.container.firstChild||e.container.appendChild(document.createTextNode("")),i.setStart(e.container.firstChild,e.startOffset),i.setEnd(e.container.firstChild,e.endOffset),t.setSelection(i)}}},t.getInnerText=function(e,i){if(void 0==i&&(i={text:"",flush:function(){var e=this.text;return this.text="",e},set:function(e){this.text=e}}),e.nodeValue)return i.flush()+e.nodeValue;if(e.hasChildNodes()){for(var n=e.childNodes,o="",r=0,s=n.length;r0&&"["===e[n]))throw new Error('Invalid JSON path: unexpected character "'+e[n]+'" at index '+n);if(n++,"'"===e[n]||'"'===e[n]){var o=e[n];if(n++,i.push(t(o)),e[n]!==o)throw new Error("Invalid JSON path: closing quote ' expected at index "+n);n++}else{var r=t("]").trim();if(0===r.length)throw new Error("Invalid JSON path: array value expected at index "+n);r="*"===r?r:JSON.parse(r),i.push(r)}if("]"!==e[n])throw new Error("Invalid JSON path: closing bracket ] expected at index "+n);n++}return i},t.stringifyPath=function(e){return e.map(function(e){return"number"==typeof e?"["+e+"]":"string"==typeof e&&e.match(/^[A-Za-z0-9_$]+$/)?"."+e:'["'+e+'"]'}).join("")},t.improveSchemaError=function(e){if("enum"===e.keyword&&Array.isArray(e.schema)){var t=e.schema;if(t){if(t=t.map(function(e){return JSON.stringify(e)}),t.length>5){var i=["("+(t.length-5)+" more...)"];t=t.slice(0,5),t.push(i)}e.message="should be equal to one of: "+t.join(", ")}}return"additionalProperties"===e.keyword&&(e.message="should NOT have additional property: "+e.params.additionalProperty),e},t.isPromise=function(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isValidValidationError=function(e){return"object"==typeof e&&Array.isArray(e.path)&&"string"==typeof e.message},t.insideRect=function(e,t,i){var n=void 0!==i?i:0;return t.left-n>=e.left&&t.right+n<=e.right&&t.top-n>=e.top&&t.bottom+n<=e.bottom},t.debounce=function(e,t,i){var n;return function(){var o=this,r=arguments,s=function(){n=null,i||e.apply(o,r)},a=i&&!n;clearTimeout(n),n=setTimeout(s,t),a&&e.apply(o,r)}},t.textDiff=function(e,t){for(var i=t.length,n=0,o=e.length,r=t.length;t.charAt(n)===e.charAt(n)&&nn&&o>0;)r--,o--;return{start:n,end:r}},t.getInputSelection=function(e){function t(t){var i=e.value.substring(0,t);return{row:(i.match(/\n/g)||[]).length+1,column:i.length-i.lastIndexOf("\n")}}var i,n,o,r,s,a=0,l=0;return"number"==typeof e.selectionStart&&"number"==typeof e.selectionEnd?(a=e.selectionStart,l=e.selectionEnd):(n=document.selection.createRange())&&n.parentElement()==e&&(r=e.value.length,i=e.value.replace(/\r\n/g,"\n"),o=e.createTextRange(),o.moveToBookmark(n.getBookmark()),s=e.createTextRange(),s.collapse(!1),o.compareEndPoints("StartToEnd",s)>-1?a=l=r:(a=-o.moveStart("character",-r),a+=i.slice(0,a).split("\n").length-1,o.compareEndPoints("EndToEnd",s)>-1?l=r:(l=-o.moveEnd("character",-r),l+=i.slice(0,l).split("\n").length-1))),{startIndex:a,endIndex:l,start:t(a),end:t(l)}},t.getIndexForPosition=function(e,t,i){var n=e.value||"";if(t>0&&i>0){var o=n.split("\n",t);t=Math.min(o.length,t),i=Math.min(o[t-1].length,i-1);var r=1==t?i:i+1;return o.slice(0,t-1).join("\n").length+r}return-1},t.getPositionForPath=function(e,t){var i,n=this,r=[];if(!t||!t.length)return r;try{i=o.parse(e)}catch(e){return r}return t.forEach(function(e){var t=n.parsePath(e),o=t.length?"/"+t.join("/"):"",s=i.pointers[o];s&&r.push({path:e,line:s.key?s.key.line:s.value?s.value.line:0,column:s.key?s.key.column:s.value?s.value.column:0})}),r},t.getColorCSS=function(e){var t=document.createElement("div");return t.style.color=e,t.style.color.split(/\s+/).join("").toLowerCase()||null},t.isValidColor=function(e){return!!t.getColorCSS(e)},t.makeFieldTooltip=function(e,t){if(!e)return"";var i="";return e.title&&(i+=e.title),e.description&&(i.length>0&&(i+="\n"),i+=e.description),e.default&&(i.length>0&&(i+="\n\n"),i+=r("default",void 0,t)+"\n",i+=JSON.stringify(e.default,null,2)),Array.isArray(e.examples)&&e.examples.length>0&&(i.length>0&&(i+="\n\n"),i+=r("examples",void 0,t)+"\n",e.examples.forEach(function(t,n){i+=JSON.stringify(t,null,2),n!==e.examples.length-1&&(i+="\n")})),i}},function(e,t){"undefined"!=typeof Element&&function(){function e(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!=this.parentNode&&this.parentNode.removeChild(this)}})}"undefined"!=typeof Element&&e(Element.prototype),"undefined"!=typeof CharacterData&&e(CharacterData.prototype),"undefined"!=typeof DocumentType&&e(DocumentType.prototype)}(),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),Array.prototype.find||(Array.prototype.find=function(e){for(var t=0;t2&&w.push("'"+this.terminals_[y]+"'");var C="";C=this.lexer.showPosition?"Parse error on line "+(l+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+w.join(", ")+", got '"+this.terminals_[p]+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(C,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:u,expected:w})}if(3==h){if(1==p)throw new Error(C||"Parsing halted.");c=this.lexer.yyleng,a=this.lexer.yytext,l=this.lexer.yylineno,u=this.lexer.yylloc,p=t()}for(;;){if(d.toString()in s[m])break;if(0==m)throw new Error(C||"Parsing halted.");!function(e){n.length=n.length-2*e,o.length=o.length-e,r.length=r.length-e}(1),m=n[n.length-1]}f=p,p=d,m=n[n.length-1],g=s[m]&&s[m][d],h=3}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+p);switch(g[0]){case 1:n.push(p),o.push(this.lexer.yytext),r.push(this.lexer.yylloc),n.push(g[1]),p=null,f?(p=f,f=null):(c=this.lexer.yyleng,a=this.lexer.yytext,l=this.lexer.yylineno,u=this.lexer.yylloc,h>0&&h--);break;case 2:if(b=this.productions_[g[1]][1],_.$=o[o.length-b],_._$={first_line:r[r.length-(b||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(b||1)].first_column,last_column:r[r.length-1].last_column},void 0!==(v=this.performAction.call(_,a,c,l,this.yy,g[1],o,r)))return v;b&&(n=n.slice(0,-1*b*2),o=o.slice(0,-1*b),r=r.slice(0,-1*b)),n.push(this.productions_[g[1]][0]),o.push(_.$),r.push(_._$),x=s[n[n.length-2]][n[n.length-1]],n.push(x);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parseError)throw new Error(e);this.yy.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e,e.match(/\n/)&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},less:function(e){this._input=this.match.slice(e)+this._input},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,i,n,o;this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),s=0;st[0].length)||(t=i,n=s,this.options.flex));s++);return t?(o=t[0].match(/\n.*/g),o&&(this.yylineno+=o.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:o?o[o.length-1].length-1:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,r[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e||void 0):""===this._input?this.EOF:void this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)}};return e.options={},e.performAction=function(e,t,i,n){switch(i){case 0:break;case 1:return 6;case 2:return t.yytext=t.yytext.substr(1,t.yyleng-2),4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},e.rules=[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt\/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],e.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},e}();return e.lexer=t,e}();t.parser=n,t.parse=n.parse.bind(n)},function(e,t){"use strict";function i(e){return a.indexOf(typeof e)>=0}function n(e){return'"'+(e=e.replace(l,"\\$&").replace(h,"\\f").replace(c,"\\b").replace(d,"\\n").replace(u,"\\r").replace(p,"\\t"))+'"'}function o(e){return e.replace(f,"~0").replace(m,"~1")}var r={b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",'"':'"',"/":"/","\\":"\\"},s="a".charCodeAt();t.parse=function(e){function t(t,o){i();var r;m(t,"value");var s=d();switch(s){case"t":h("rue"),r=!0;break;case"f":h("alse"),r=!1;break;case"n":h("ull"),r=null;break;case'"':r=n();break;case"[":r=l(t);break;case"{":r=c(t);break;default:u(),"-0123456789".indexOf(s)>=0?r=a():y()}return m(t,"valueEnd"),i(),o&&E="a"&&i<="f"?t+=i.charCodeAt()-s+10:i>="0"&&i<="9"?t+=+i:b()}return String.fromCharCode(t)}function f(){for(var t="";e[E]>="0"&&e[E]<="9";)t+=d();if(t.length)return t;x(),y()}function m(e,t){g(e,t,v())}function g(e,t,i){w[e]=w[e]||{},w[e][t]=i}function v(){return{line:_,column:C,pos:E}}function y(){throw new SyntaxError("Unexpected token "+e[E]+" in JSON at position "+E)}function b(){u(),y()}function x(){if(E>=e.length)throw new SyntaxError("Unexpected end of JSON input")}var w={},_=0,C=0,E=0;return{data:t("",!0),pointers:w}},t.stringify=function(e,t,r){function s(e,t,h){switch(c(h,"value"),typeof e){case"number":case"boolean":a(""+e);break;case"string":a(n(e));break;case"object":null===e?a("null"):"function"==typeof e.toJSON?a(n(e.toJSON())):Array.isArray(e)?function(){if(e.length){a("[");for(var n=t+1,o=0;o10?10:r<0?0:Math.floor(r);r=f&&h(f," "),d=f,u=f;break;case"string":r=r.slice(0,10),d=0,u=0;for(var m=0;m0;){var n=t.shift();if("number"==typeof n){if("array"!==i.type)throw new Error("Cannot get child node at index "+n+": node is no array");i=i.childs[n]}else{if("object"!==i.type)throw new Error("Cannot get child node "+n+": node is no object");i=i.childs.filter(function(e){return e.field===n})[0]}}return i},n.prototype.findParents=function(){for(var e=[],t=this.parent;t;)e.unshift(t),t=t.parent;return e},n.prototype.setError=function(e,t){this.error=e,this.errorChild=t,this.dom&&this.dom.tr&&this.updateError()},n.prototype.updateError=function(){var e=this.error,t=this.dom.tdError;if(e&&this.dom&&this.dom.tr){f.addClassName(this.dom.tr,"jsoneditor-validation-error"),t||(t=document.createElement("td"),this.dom.tdError=t,this.dom.tdValue.parentNode.appendChild(t));var i=document.createElement("div");i.className="jsoneditor-popover jsoneditor-right",i.appendChild(document.createTextNode(e.message));var n=document.createElement("button");n.type="button",n.className="jsoneditor-button jsoneditor-schema-error",n.appendChild(i),n.onmouseover=n.onfocus=function(){for(var e=["right","above","below","left"],t=0;t=e.length;a--)this.removeChild(this.childs[a],!1)}else if("object"===this.type){for(this.childs||(this.childs=[]),a=this.childs.length-1;a>=0;a--)e.hasOwnProperty(this.childs[a].field)||this.removeChild(this.childs[a],!1);s=0;for(var c in e)e.hasOwnProperty(c)&&(i=e[c],void 0===i||i instanceof Function||(o=this.findChildByProperty(c),o?(o.setField(c,!0),o.setValue(i)):(o=new n(this.editor,{field:c,value:i}),r=s=e.childs.length;s--)this.removeChild(this.childs[s],!1)}else if("object"===e.type){for(this.childs||(this.childs=[]),r=0;r=e.childs.length;s--)this.removeChild(this.childs[s],!1)}else this.hideChilds(),delete this.append,delete this.showMore,delete this.expanded,delete this.childs,this.value=e.value;Array.isArray(a)!==Array.isArray(this.childs)&&this.recreateDom(),this.updateDom({updateIndexes:!0}),this.previousValue=this.value},n.prototype.recreateDom=function(){if(this.dom&&this.dom.tr&&this.dom.tr.parentNode){var e=this._detachFromDom();this.clearDom(),this._attachToDom(e)}else this.clearDom()},n.prototype.getValue=function(){if("array"==this.type){var e=[];return this.childs.forEach(function(t){e.push(t.getValue())}),e}if("object"==this.type){var t={};return this.childs.forEach(function(e){t[e.getField()]=e.getValue()}),t}return void 0===this.value&&this._getDomValue(),this.value},n.prototype.getInternalValue=function(){return"array"===this.type?{type:this.type,childs:this.childs.map(function(e){return e.getInternalValue()})}:"object"===this.type?{type:this.type,childs:this.childs.map(function(e){return{field:e.getField(),value:e.getInternalValue()}})}:(void 0===this.value&&this._getDomValue(),{type:this.type,value:this.value})},n.prototype.getLevel=function(){return this.parent?this.parent.getLevel()+1:0},n.prototype.getNodePath=function(){var e=this.parent?this.parent.getNodePath():[];return e.push(this),e},n.prototype.clone=function(){var e=new n(this.editor);if(e.type=this.type,e.field=this.field,e.fieldInnerText=this.fieldInnerText,e.fieldEditable=this.fieldEditable,e.previousField=this.previousField,e.value=this.value,e.valueInnerText=this.valueInnerText,e.previousValue=this.previousValue,e.expanded=this.expanded,e.visibleChilds=this.visibleChilds,this.childs){var t=[];this.childs.forEach(function(i){var n=i.clone();n.setParent(e),t.push(n)}),e.childs=t}else e.childs=void 0;return e},n.prototype.expand=function(e){this.childs&&(this.expanded=!0,this.dom.expand&&(this.dom.expand.className="jsoneditor-button jsoneditor-expanded"),this.showChilds(),!1!==e&&this.childs.forEach(function(t){t.expand(e)}))},n.prototype.collapse=function(e){this.childs&&(this.hideChilds(),!1!==e&&this.childs.forEach(function(t){t.collapse(e)}),this.dom.expand&&(this.dom.expand.className="jsoneditor-button jsoneditor-collapsed"),this.expanded=!1)},n.prototype.showChilds=function(){if(this.childs&&this.expanded){var e=this.dom.tr,t=e?e.parentNode:void 0;if(t){var i=this.getAppendDom();if(!i.parentNode){var n=e.nextSibling;n?t.insertBefore(i,n):t.appendChild(i)}for(var o=Math.min(this.childs.length,this.visibleChilds),n=this._getNextTr(),r=0;rthis.visibleChilds){var o=this.childs[this.visibleChilds-1];this.insertBefore(e,o)}else this.appendChild(e);else this.insertBefore(e,t);i&&i.removeChild(n)}},n.prototype.insertBefore=function(e,t){if(this._hasChilds()){if(this.visibleChilds++,"object"===this.type&&void 0==e.field&&e.setField(""),t===this.append)e.setParent(this),e.fieldEditable="object"==this.type,this.childs.push(e);else{var i=this.childs.indexOf(t);if(-1==i)throw new Error("Node not found");e.setParent(this),e.fieldEditable="object"==this.type,this.childs.splice(i,0,e)}if(this.expanded){var n=e.getDom(),o=t.getDom(),r=o?o.parentNode:void 0;o&&r&&r.insertBefore(n,o),e.showChilds(),this.showChilds()}this.updateDom({updateIndexes:!0}),e.updateDom({recurse:!0})}},n.prototype.insertAfter=function(e,t){if(this._hasChilds()){var i=this.childs.indexOf(t),n=this.childs[i+1];n?this.insertBefore(e,n):this.appendChild(e)}},n.prototype.search=function(e,t){Array.isArray(t)||(t=[]);var i,n=e?e.toLowerCase():void 0;if(delete this.searchField,delete this.searchValue,void 0!==this.field&&t.length<=this.MAX_SEARCH_RESULTS){i=String(this.field).toLowerCase().indexOf(n),-1!==i&&(this.searchField=!0,t.push({node:this,elem:"field"})),this._updateDomField()}if(this._hasChilds())this.childs&&this.childs.forEach(function(i){i.search(e,t)});else if(void 0!==this.value&&t.length<=this.MAX_SEARCH_RESULTS){var o=String(this.value).toLowerCase();i=o.indexOf(n),-1!==i&&(this.searchValue=!0,t.push({node:this,elem:"value"})),this._updateDomValue()}return t},n.prototype.scrollTo=function(e){this.expandPathToNode(),this.dom.tr&&this.dom.tr.parentNode&&this.editor.scrollTo(this.dom.tr.offsetTop,e)},n.prototype.expandPathToNode=function(){for(var e=this;e&&e.parent;){for(var t="array"===e.parent.type?e.index:e.parent.childs.indexOf(e);e.parent.visibleChilds9466848e5&&!isNaN(new Date(i).valueOf())?(this.dom.date||(this.dom.date=document.createElement("div"),this.dom.date.className="jsoneditor-date",this.dom.value.parentNode.appendChild(this.dom.date)),this.dom.date.innerHTML=new Date(i).toISOString(),this.dom.date.title=new Date(i).toString()):this.dom.date&&(this.dom.date.parentNode.removeChild(this.dom.date),delete this.dom.date),f.stripFormatting(e),this._updateDomDefault()}},n.prototype._deleteDomColor=function(){this.dom.color&&(this.dom.tdColor.parentNode.removeChild(this.dom.tdColor),delete this.dom.tdColor,delete this.dom.color,this.dom.value.style.color="")},n.prototype._updateDomField=function(){var e=this.dom.field;if(e){var t=f.makeFieldTooltip(this.schema,this.editor.options.language);t&&(e.title=t);""==String(this.field)&&"array"!=this.parent.type?f.addClassName(e,"jsoneditor-empty"):f.removeClassName(e,"jsoneditor-empty"),this.searchFieldActive?f.addClassName(e,"jsoneditor-highlight-active"):f.removeClassName(e,"jsoneditor-highlight-active"),this.searchField?f.addClassName(e,"jsoneditor-highlight"):f.removeClassName(e,"jsoneditor-highlight"),f.stripFormatting(e)}},n.prototype._getDomField=function(e){if(this.dom.field&&this.fieldEditable&&(this.fieldInnerText=f.getInnerText(this.dom.field)),void 0!=this.fieldInnerText)try{var t=this._unescapeHTML(this.fieldInnerText);t!==this.field&&(this.field=t,this._debouncedOnChangeField())}catch(t){if(this.field=void 0,!0!==e)throw t}},n.prototype._updateDomDefault=function(){this.schema&&void 0!==this.schema.default&&!this._hasChilds()&&(this.value===this.schema.default?this.dom.select?this.dom.value.removeAttribute("title"):(this.dom.value.title=m("default"),this.dom.value.classList.add("jsoneditor-is-default"),this.dom.value.classList.remove("jsoneditor-is-not-default")):(this.dom.value.removeAttribute("title"),this.dom.value.classList.remove("jsoneditor-is-default"),this.dom.value.classList.add("jsoneditor-is-not-default")))},n.prototype.validate=function(){var e=[];if("object"===this.type){for(var t={},i=[],n=0;n0&&(e=this.childs.filter(function(e){return-1!==i.indexOf(e.field)}).map(function(e){return{node:e,error:{message:m("duplicateKey")+' "'+e.field+'"'}}}))}if(this.childs)for(var n=0;n0&&(e=e.concat(r))}return e},n.prototype.clearDom=function(){this.dom={}},n.prototype.getDom=function(){var e=this.dom;if(e.tr)return e.tr;if(this._updateEditability(),e.tr=document.createElement("tr"),e.tr.node=this,"tree"===this.editor.options.mode){var t=document.createElement("td");if(this.editable.field&&this.parent){var i=document.createElement("button");i.type="button",e.drag=i,i.className="jsoneditor-button jsoneditor-dragarea",i.title=m("drag"),t.appendChild(i)}e.tr.appendChild(t);var n=document.createElement("td"),o=document.createElement("button");o.type="button",e.menu=o,o.className="jsoneditor-button jsoneditor-contextmenu",o.title=m("actionsMenu"),n.appendChild(e.menu),e.tr.appendChild(n)}var r=document.createElement("td");return e.tr.appendChild(r),e.tree=this._createDomTree(),r.appendChild(e.tree),this.updateDom({updateIndexes:!0}),e.tr},n.prototype.isVisible=function(){return this.dom&&this.dom.tr&&this.dom.tr.parentNode||!1},n.onDragStart=function(e,t){if(!Array.isArray(e))return n.onDragStart([e],t);if(0!==e.length){var i=e[0],r=e[e.length-1],s=i.parent,a=n.getNodeFromTarget(t.target),l=i.editor,c=f.getAbsoluteTop(a.dom.tr)-f.getAbsoluteTop(i.dom.tr);l.mousemove||(l.mousemove=f.addEventListener(window,"mousemove",function(t){n.onDrag(e,t)})),l.mouseup||(l.mouseup=f.addEventListener(window,"mouseup",function(t){n.onDragEnd(e,t)})),l.highlighter.lock(),l.drag={oldCursor:document.body.style.cursor,oldSelection:l.getDomSelection(),oldPaths:e.map(o),oldParent:s,oldNextNode:s.childs[r.getIndex()+1]||s.append,oldParentPathRedo:s.getInternalPath(),oldIndexRedo:i.getIndex(),mouseX:t.pageX,offsetY:c,level:i.getLevel()},document.body.style.cursor="move",t.preventDefault()}},n.onDrag=function(e,t){if(!Array.isArray(e))return n.onDrag([e],t);if(0!==e.length){var i,o,r,s,a,l,c,h,d,u,p,m,g,y,b=e[0].editor,x=t.pageY-b.drag.offsetY,w=t.pageX,_=!1,C=e[0];if(i=C.dom.tr,d=f.getAbsoluteTop(i),m=i.offsetHeight,xu+m&&(c=void 0)),c&&(e.forEach(function(e){c.parent.moveBefore(e,c)}),_=!0)}else{var E=e[e.length-1];if(a=E.expanded&&E.append?E.append.getDom():E.dom.tr,s=a?a.nextSibling:void 0){p=f.getAbsoluteTop(s),r=s;do{h=n.getNodeFromTarget(r),r&&(g=r.nextSibling?f.getAbsoluteTop(r.nextSibling):0,y=r?g-p:0,h&&h.parent.childs.length==e.length&&h.parent.childs[e.length-1]==E&&(d+=27),r=r.nextSibling)}while(r&&x>d+y);if(h&&h.parent){var S=w-b.drag.mouseX,T=Math.round(S/24/2),k=b.drag.level+T,N=h.getLevel();for(o=h.dom.tr&&h.dom.tr.previousSibling;N0)return i[0].enum}return null},n._findSchema=function(e,t,i){var o=e,r=o,s=e.oneOf||e.anyOf||e.allOf;s||(s=[e]);for(var a=0;a0?null: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&&f.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-button jsoneditor-expanded":"jsoneditor-button jsoneditor-collapsed",e.title=m("expandTitle")):(e.className="jsoneditor-button 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 o=document.createElement("td");o.className="jsoneditor-tree",n.appendChild(o),e.expand=this._createDomExpandButton(),o.appendChild(e.expand),e.tdExpand=o;var r=document.createElement("td");r.className="jsoneditor-tree",n.appendChild(r),e.field=this._createDomField(),r.appendChild(e.field),e.tdField=r;var s=document.createElement("td");s.className="jsoneditor-tree",n.appendChild(s),"object"!=this.type&&"array"!=this.type&&(s.appendChild(document.createTextNode(":")),s.className="jsoneditor-separator"),e.tdSeparator=s;var a=document.createElement("td");return a.className="jsoneditor-tree",n.appendChild(a),e.value=this._createDomValue(),a.appendChild(e.value),e.tdValue=a,t},n.prototype.onEvent=function(e){var t=e.type,i=e.target||e.srcElement,n=this.dom,o=this,r=this._hasChilds();if("function"==typeof this.editor.options.onEvent&&this._onEvent(e),i!=n.drag&&i!=n.menu||("mouseover"==t?this.editor.highlighter.highlight(this):"mouseout"==t&&this.editor.highlighter.unhighlight()),"click"==t&&i==n.menu){var s=o.editor.highlighter;s.highlight(o),s.lock(),f.addClassName(n.menu,"jsoneditor-selected"),this.showContextMenu(n.menu,function(){f.removeClassName(n.menu,"jsoneditor-selected"),s.unlock(),s.unhighlight()})}if("click"==t&&(i==n.expand||("view"===o.editor.options.mode||"form"===o.editor.options.mode)&&"DIV"===i.nodeName)&&r){var a=e.ctrlKey;this._onExpand(a)}"click"!==t||e.target!==o.dom.tdColor&&e.target!==o.dom.color||this._showColorPicker(),"change"==t&&i==n.checkbox&&(this.dom.value.innerHTML=!this.value,this._getDomValue(),this._updateDomDefault()),"change"==t&&i==n.select&&(this.dom.value.innerHTML=n.select.value,this._getDomValue(),this._updateDomValue());var l=n.value;if(i==l)switch(t){case"blur":case"change":this._getDomValue(!0),this._updateDomValue(),this.value&&(l.innerHTML=this._escapeHTML(this.value));break;case"input":this._getDomValue(!0),this._updateDomValue();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getDomSelection();break;case"click":e.ctrlKey&&this.editable.value&&f.isUrl(this.value)&&(e.preventDefault(),window.open(this.value,"_blank"));break;case"keyup":this._getDomValue(!0),this._updateDomValue();break;case"cut":case"paste":setTimeout(function(){o._getDomValue(!0),o._updateDomValue()},1)}var c=n.field;if(i==c)switch(t){case"blur":case"change":this._getDomField(!0),this._updateDomField(),this.field&&(c.innerHTML=this._escapeHTML(this.field));break;case"input":this._getDomField(!0),this._updateSchema(),this._updateDomField(),this._updateDomValue();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getDomSelection();break;case"keyup":this._getDomField(!0),this._updateDomField();break;case"cut":case"paste":setTimeout(function(){o._getDomField(!0),o._updateDomField()},1)}var h=n.tree;if(h&&i==h.parentNode&&"click"==t&&!e.hasMoved){(void 0!=e.offsetX?e.offsetX<24*(this.getLevel()+1):e.pageX0?this.editor.multiselection.nodes:[this],T=S[0],k=S[S.length-1];if(13==y){if(b==this.dom.value)this.editable.value&&!e.ctrlKey||f.isUrl(this.value)&&(window.open(this.value,"_blank"),C=!0);else if(b==this.dom.expand){var N=this._hasChilds();if(N){var j=e.ctrlKey;this._onExpand(j),b.focus(),C=!0}}}else if(68==y)x&&E&&(n.onDuplicate(S),C=!0);else if(69==y)x&&(this._onExpand(w),b.focus(),C=!0);else if(77==y&&E)x&&(this.showContextMenu(b),C=!0);else if(46==y&&E)x&&(n.onRemove(S),C=!0);else if(45==y&&E)x&&!w?(this._onInsertBefore(),C=!0):x&&w&&(this._onInsertAfter(),C=!0);else if(35==y){if(_){var I=this._lastNode();I&&I.focus(n.focusElement||this._getElementName(b)),C=!0}}else if(36==y){if(_){var O=this._firstNode();O&&O.focus(n.focusElement||this._getElementName(b)),C=!0}}else if(37==y){if(_&&!w){var P=this._previousElement(b);P&&this.focus(this._getElementName(P)),C=!0}else if(_&&w&&E){if(k.expanded){var A=k.getAppendDom();o=A?A.nextSibling:void 0}else{var D=k.getDom();o=D.nextSibling}o&&(i=n.getNodeFromTarget(o),s=o.nextSibling,M=n.getNodeFromTarget(s),i&&i instanceof v&&1!=k.parent.childs.length&&M&&M.parent&&(a=this.editor.getDomSelection(),c=T.parent,l=c.childs[k.getIndex()+1]||c.append,h=T.getIndex(),d=M.getIndex(),u=c.getInternalPath(),p=M.parent.getInternalPath(),S.forEach(function(e){M.parent.moveBefore(e,M)}),this.focus(n.focusElement||this._getElementName(b)),this.editor._onAction("moveNodes",{count:S.length,fieldNames:S.map(r),oldParentPath:c.getInternalPath(),newParentPath:T.parent.getInternalPath(),oldIndex:l.getIndex(),newIndex:T.getIndex(),oldIndexRedo:h,newIndexRedo:d,oldParentPathRedo:u,newParentPathRedo:p,oldSelection:a,newSelection:this.editor.getDomSelection()})))}}else if(38==y)_&&!w?(t=this._previousNode(),t&&(this.editor.deselect(!0),t.focus(n.focusElement||this._getElementName(b))),C=!0):!_&&x&&w&&E?(t=this._previousNode(),t&&(g=this.editor.multiselection,g.start=g.start||this,g.end=t,m=this.editor._findTopLevelNodes(g.start,g.end),this.editor.select(m),t.focus("field")),C=!0):_&&w&&E&&(t=T._previousNode(),t&&t.parent&&(a=this.editor.getDomSelection(),c=T.parent,l=c.childs[k.getIndex()+1]||c.append,h=T.getIndex(),d=t.getIndex(),u=c.getInternalPath(),p=t.parent.getInternalPath(),S.forEach(function(e){t.parent.moveBefore(e,t)}),this.focus(n.focusElement||this._getElementName(b)),this.editor._onAction("moveNodes",{count:S.length,fieldNames:S.map(r),oldParentPath:c.getInternalPath(),newParentPath:T.parent.getInternalPath(),oldIndex:l.getIndex(),newIndex:T.getIndex(),oldIndexRedo:h,newIndexRedo:d,oldParentPathRedo:u,newParentPathRedo:p,oldSelection:a,newSelection:this.editor.getDomSelection()})),C=!0);else if(39==y){if(_&&!w){var R=this._nextElement(b);R&&this.focus(this._getElementName(R)),C=!0}else if(_&&w&&E){D=T.getDom();var L=D.previousSibling;L&&(t=n.getNodeFromTarget(L))&&t.parent&&!t.isVisible()&&(a=this.editor.getDomSelection(),c=T.parent,l=c.childs[k.getIndex()+1]||c.append,h=T.getIndex(),d=t.getIndex(),u=c.getInternalPath(),p=t.parent.getInternalPath(),S.forEach(function(e){t.parent.moveBefore(e,t)}),this.focus(n.focusElement||this._getElementName(b)),this.editor._onAction("moveNodes",{count:S.length,fieldNames:S.map(r),oldParentPath:c.getInternalPath(),newParentPath:T.parent.getInternalPath(),oldIndex:l.getIndex(),newIndex:T.getIndex(),oldIndexRedo:h,newIndexRedo:d,oldParentPathRedo:u,newParentPathRedo:p,oldSelection:a,newSelection:this.editor.getDomSelection()}))}}else if(40==y)if(_&&!w)i=this._nextNode(),i&&(this.editor.deselect(!0),i.focus(n.focusElement||this._getElementName(b))),C=!0;else if(!_&&x&&w&&E)i=this._nextNode(),i&&(g=this.editor.multiselection,g.start=g.start||this,g.end=i,m=this.editor._findTopLevelNodes(g.start,g.end),this.editor.select(m),i.focus("field")),C=!0;else if(_&&w&&E){i=k.expanded?k.append?k.append._nextNode():void 0:k._nextNode(),i&&!i.isVisible()&&(i=i.parent.showMore),i&&i instanceof v&&(i=k);var M=i&&(i._nextNode()||i.parent.append);M&&M.parent&&(a=this.editor.getDomSelection(),c=T.parent,l=c.childs[k.getIndex()+1]||c.append,h=T.getIndex(),d=M.getIndex(),u=c.getInternalPath(),p=M.parent.getInternalPath(),S.forEach(function(e){M.parent.moveBefore(e,M)}),this.focus(n.focusElement||this._getElementName(b)),this.editor._onAction("moveNodes",{count:S.length,fieldNames:S.map(r),oldParentPath:c.getInternalPath(),newParentPath:T.parent.getInternalPath(),oldParentPathRedo:u,newParentPathRedo:p,oldIndexRedo:h,newIndexRedo:d,oldIndex:l.getIndex(),newIndex:T.getIndex(),oldSelection:a,newSelection:this.editor.getDomSelection()})),C=!0}C&&(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.prototype._showColorPicker=function(){if("function"==typeof this.editor.options.onColorPicker&&this.dom.color){var e=this;e._deleteDomColor(),e.updateDom();var t=l(this.dom.color,this.editor.frame);this.editor.options.onColorPicker(t,this.value,function(t){"string"==typeof t&&t!==e.value&&(e._deleteDomColor(),e.value=t,e.updateDom(),e._debouncedOnChangeValue())})}},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,s=t.getIndex();r.highlighter.unhighlight();var a=r.getDomSelection();n.blurNodes(e);var l=r.getDomSelection(),c=e.map(o);e.forEach(function(e){e.parent._remove(e)}),r._onAction("removeNodes",{nodes:e,paths:c,parentPath:i.getInternalPath(),index:s,oldSelection:a,newSelection:l})}},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 s=r.getDomSelection(),a=t,l=e.map(function(e){var t=e.clone();return i.insertAfter(t,a),a=t,t});1===e.length?l[0].focus():r.select(l);var c=r.getDomSelection();r._onAction("duplicateNodes",{paths:e.map(o),clonePaths:l.map(o),afterPath:t.getInternalPath(),parentPath:i.getInternalPath(),oldSelection:s,newSelection:c})}},n.prototype._onInsertBefore=function(e,t,i){var o=this.editor.getDomSelection(),r=new n(this.editor,{field:void 0!=e?e:"",value:void 0!=t?t:"",type:i});r.expand(!0);var s=this.getInternalPath();this.parent.insertBefore(r,this),this.editor.highlighter.unhighlight(),r.focus("field");var a=this.editor.getDomSelection();this.editor._onAction("insertBeforeNodes",{nodes:[r],paths:[r.getInternalPath()],beforePath:s,parentPath:this.parent.getInternalPath(),oldSelection:o,newSelection:a})},n.prototype._onInsertAfter=function(e,t,i){var o=this.editor.getDomSelection(),r=new n(this.editor,{field:void 0!=e?e:"",value:void 0!=t?t:"",type:i});r.expand(!0),this.parent.insertAfter(r,this),this.editor.highlighter.unhighlight(),r.focus("field");var s=this.editor.getDomSelection();this.editor._onAction("insertAfterNodes",{nodes:[r],paths:[r.getInternalPath()],afterPath:this.getInternalPath(),parentPath:this.parent.getInternalPath(),oldSelection:o,newSelection:s})},n.prototype._onAppend=function(e,t,i){var o=this.editor.getDomSelection(),r=new n(this.editor,{field:void 0!=e?e:"",value:void 0!=t?t:"",type:i});r.expand(!0),this.parent.appendChild(r),this.editor.highlighter.unhighlight(),r.focus("field");var s=this.editor.getDomSelection();this.editor._onAction("appendNodes",{nodes:[r],paths:[r.getInternalPath()],parentPath:this.parent.getInternalPath(),oldSelection:o,newSelection:s})},n.prototype._onChangeType=function(e){var t=this.type;if(e!=t){var i=this.editor.getDomSelection();this.changeType(e);var n=this.editor.getDomSelection();this.editor._onAction("changeType",{path:this.getInternalPath(),oldType:t,newType:e,oldSelection:i,newSelection:n})}},n.prototype.sort=function(e,t){if(this._hasChilds()){this.hideChilds();var i=this.childs;this.childs=this.childs.concat();var n="desc"===t?-1:1;"object"===this.type?this.childs.sort(function(e,t){return n*a(e.field,t.field)}):this.childs.sort(function(t,i){var o=t.getNestedChild(e),r=i.getNestedChild(e);if(!o)return n;if(!r)return-n;var s=o.value,l=r.value;return"string"!=typeof s&&"string"!=typeof l?s>l?n:s/g,">").replace(/ /g,"  ").replace(/^ /," ").replace(/ $/," "),i=JSON.stringify(t),n=i.substring(1,i.length-1);return!0===this.editor.options.escapeUnicode&&(n=f.escapeUnicodeChars(n)),n},n.prototype._unescapeHTML=function(e){var t='"'+this._escapeJSON(e)+'"';return f.parse(t).replace(/</g,"<").replace(/>/g,">").replace(/ |\u00A0/g," ").replace(/&/g,"&")},n.prototype._escapeJSON=function(e){for(var t="",i=0;i="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e}function a(e){return e>="0"&&e<="9"||"-"===e}function l(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"_"===e}function c(){}function h(){}function d(e){this.runtime=e}function u(e){this._interpreter=e,this.functionTable={abs:{_func:this._functionAbs,_signature:[{types:[v]}]},avg:{_func:this._functionAvg,_signature:[{types:[C]}]},ceil:{_func:this._functionCeil,_signature:[{types:[v]}]},contains:{_func:this._functionContains,_signature:[{types:[b,x]},{types:[y]}]},ends_with:{_func:this._functionEndsWith,_signature:[{types:[b]},{types:[b]}]},floor:{_func:this._functionFloor,_signature:[{types:[v]}]},length:{_func:this._functionLength,_signature:[{types:[b,x,w]}]},map:{_func:this._functionMap,_signature:[{types:[_]},{types:[x]}]},max:{_func:this._functionMax,_signature:[{types:[C,E]}]},merge:{_func:this._functionMerge,_signature:[{types:[w],variadic:!0}]},max_by:{_func:this._functionMaxBy,_signature:[{types:[x]},{types:[_]}]},sum:{_func:this._functionSum,_signature:[{types:[C]}]},starts_with:{_func:this._functionStartsWith,_signature:[{types:[b]},{types:[b]}]},min:{_func:this._functionMin,_signature:[{types:[C,E]}]},min_by:{_func:this._functionMinBy,_signature:[{types:[x]},{types:[_]}]},type:{_func:this._functionType,_signature:[{types:[y]}]},keys:{_func:this._functionKeys,_signature:[{types:[w]}]},values:{_func:this._functionValues,_signature:[{types:[w]}]},sort:{_func:this._functionSort,_signature:[{types:[E,C]}]},sort_by:{_func:this._functionSortBy,_signature:[{types:[x]},{types:[_]}]},join:{_func:this._functionJoin,_signature:[{types:[b]},{types:[E]}]},reverse:{_func:this._functionReverse,_signature:[{types:[b,x]}]},to_array:{_func:this._functionToArray,_signature:[{types:[y]}]},to_string:{_func:this._functionToString,_signature:[{types:[y]}]},to_number:{_func:this._functionToNumber,_signature:[{types:[y]}]},not_null:{_func:this._functionNotNull,_signature:[{types:[y],variadic:!0}]}}}function p(e){return(new h).parse(e)}function f(e){return(new c).tokenize(e)}function m(e,t){var i=new h,n=new u,o=new d(n);n._interpreter=o;var r=i.parse(t);return o.search(r,e)}var g;g="function"==typeof String.prototype.trimLeft?function(e){return e.trimLeft()}:function(e){return e.match(/^\s*(.*)/)[1]};var v=0,y=1,b=2,x=3,w=4,_=6,C=8,E=9,S={".":"Dot","*":"Star",",":"Comma",":":"Colon","{":"Lbrace","}":"Rbrace","]":"Rbracket","(":"Lparen",")":"Rparen","@":"Current"},T={"<":!0,">":!0,"=":!0,"!":!0},k={" ":!0,"\t":!0,"\n":!0};c.prototype={tokenize:function(e){var t=[];this._current=0;for(var i,n,o;this._current"===i?"="===e[this._current]?(this._current++,{type:"GTE",value:">=",start:t}):{type:"GT",value:">",start:t}:"="===i&&"="===e[this._current]?(this._current++,{type:"EQ",value:"==",start:t}):void 0},_consumeLiteral:function(e){this._current++;for(var t,i=this._current,n=e.length;"`"!==e[this._current]&&this._current=0)return!0;if(i.indexOf(e)>=0)return!0;if(!(n.indexOf(e[0])>=0))return!1;try{return JSON.parse(e),!0}catch(e){return!1}}};var N={};N.EOF=0,N.UnquotedIdentifier=0,N.QuotedIdentifier=0,N.Rbracket=0,N.Rparen=0,N.Comma=0,N.Rbrace=0,N.Number=0,N.Current=0,N.Expref=0,N.Pipe=1,N.Or=2,N.And=3,N.EQ=5,N.GT=5,N.LT=5,N.GTE=5,N.LTE=5,N.NE=5,N.Flatten=9,N.Star=20,N.Filter=21,N.Dot=40,N.Not=45,N.Lbrace=50,N.Lbracket=55,N.Lparen=60,h.prototype={parse:function(e){this._loadTokens(e),this.index=0;var t=this.expression(0);if("EOF"!==this._lookahead(0)){var i=this._lookaheadToken(0),n=new Error("Unexpected token type: "+i.type+", value: "+i.value);throw n.name="ParserError",n}return t},_loadTokens:function(e){var t=new c,i=t.tokenize(e);i.push({type:"EOF",value:"",start:e.length}),this.tokens=i},expression:function(e){var t=this._lookaheadToken(0);this._advance();for(var i=this.nud(t),n=this._lookahead(0);e=0?this.expression(e):"Lbracket"===t?(this._match("Lbracket"),this._parseMultiselectList()):"Lbrace"===t?(this._match("Lbrace"),this._parseMultiselectHash()):void 0},_parseProjectionRHS:function(e){var t;if(N[this._lookahead(0)]<10)t={type:"Identity"};else if("Lbracket"===this._lookahead(0))t=this.expression(e);else if("Filter"===this._lookahead(0))t=this.expression(e);else{if("Dot"!==this._lookahead(0)){var i=this._lookaheadToken(0),n=new Error("Sytanx error, unexpected token: "+i.value+"("+i.type+")");throw n.name="ParserError",n}this._match("Dot"),t=this._parseDotRHS(e)}return t},_parseMultiselectList:function(){for(var e=[];"Rbracket"!==this._lookahead(0);){var t=this.expression(0);if(e.push(t),"Comma"===this._lookahead(0)&&(this._match("Comma"),"Rbracket"===this._lookahead(0)))throw new Error("Unexpected token Rbracket")}return this._match("Rbracket"),{type:"MultiSelectList",children:e}},_parseMultiselectHash:function(){for(var e,t,i,n,o=[],r=["UnquotedIdentifier","QuotedIdentifier"];;){if(e=this._lookaheadToken(0),r.indexOf(e.type)<0)throw new Error("Expecting an identifier token, got: "+e.type);if(t=e.value,this._advance(),this._match("Colon"),i=this.expression(0),n={type:"KeyValuePair",name:t,value:i},o.push(n),"Comma"===this._lookahead(0))this._match("Comma");else if("Rbrace"===this._lookahead(0)){this._match("Rbrace");break}}return{type:"MultiSelectHash",children:o}}},d.prototype={search:function(e,t){return this.visit(e,t)},visit:function(e,s){var a,l,c,h,d,u,p,f,m;switch(e.type){case"Field":return null===s?null:i(s)?(u=s[e.name],void 0===u?null:u):null;case"Subexpression":for(c=this.visit(e.children[0],s),m=1;m0)for(m=b;mx;m+=w)c.push(s[m]);return c;case"Projection":var _=this.visit(e.children[0],s);if(!t(_))return null;for(f=[],m=0;m<_.length;m++)null!==(l=this.visit(e.children[1],_[m]))&&f.push(l);return f;case"ValueProjection":if(_=this.visit(e.children[0],s),!i(_))return null;f=[];var C=r(_);for(m=0;md;break;case"GTE":c=h>=d;break;case"LT":c=h=e&&(t=i<0?e-1:e),t}},u.prototype={callFunction:function(e,t){var i=this.functionTable[e];if(void 0===i)throw new Error("Unknown function: "+e+"()");return this._validateArgs(e,t,i._signature),i._func.call(this,t)},_validateArgs:function(e,t,i){var n;if(i[i.length-1].variadic){if(t.length=0;n--)i+=t[n];return i}var o=e[0].slice(0);return o.reverse(),o},_functionAbs:function(e){return Math.abs(e[0])},_functionCeil:function(e){return Math.ceil(e[0])},_functionAvg:function(e){for(var t=0,i=e[0],n=0;n=0},_functionFloor:function(e){return Math.floor(e[0])},_functionLength:function(e){return i(e[0])?Object.keys(e[0]).length:e[0].length},_functionMap:function(e){for(var t=[],i=this._interpreter,n=e[0],o=e[1],r=0;r0){if(this._getTypeName(e[0][0])===v)return Math.max.apply(Math,e[0]);for(var t=e[0],i=t[0],n=1;n0){if(this._getTypeName(e[0][0])===v)return Math.min.apply(Math,e[0]);for(var t=e[0],i=t[0],n=1;na?1:ss&&(s=i,t=o[a]);return t},_functionMinBy:function(e){for(var t,i,n=e[1],o=e[0],r=this.createKeyFunction(n,[v,b]),s=1/0,a=0;am)return 1}for(var g=0,v=Math.max(u.length,p.length);go)return 1}return 0}},function(e,t,i){"use strict";function n(e){function t(e){this.editor=e,this.dom={}}return t.prototype=new e,t.prototype.getDom=function(){var e=this.dom;if(e.tr)return e.tr;this._updateEditability();var t=document.createElement("tr");if(t.className="jsoneditor-append",t.node=this,e.tr=t,"tree"===this.editor.options.mode){e.tdDrag=document.createElement("td");var i=document.createElement("td");e.tdMenu=i;var n=document.createElement("button");n.type="button",n.className="jsoneditor-button jsoneditor-contextmenu",n.title="Click to open the actions menu (Ctrl+M)",e.menu=n,i.appendChild(e.menu)}var o=document.createElement("td"),r=document.createElement("div");return r.innerHTML="("+s("empty")+")",r.className="jsoneditor-readonly",o.appendChild(r),e.td=o,e.text=r,this.updateDom(),t},t.prototype.getPath=function(){return null},t.prototype.getIndex=function(){return null},t.prototype.updateDom=function(e){var t=this.dom,i=t.td;i&&(i.style.paddingLeft=24*this.getLevel()+26+"px");var n=t.text;n&&(n.innerHTML="("+s("empty")+" "+this.parent.type+")");var o=t.tr;this.isVisible()?t.tr.firstChild||(t.tdDrag&&o.appendChild(t.tdDrag),t.tdMenu&&o.appendChild(t.tdMenu),o.appendChild(i)):t.tr.firstChild&&(t.tdDrag&&o.removeChild(t.tdDrag),t.tdMenu&&o.removeChild(t.tdMenu),o.removeChild(i))},t.prototype.isVisible=function(){return 0==this.parent.childs.length},t.prototype.showContextMenu=function(t,i){var n=this,o=e.TYPE_TITLES,a=[{text:s("auto"),className:"jsoneditor-type-auto",title:o.auto,click:function(){n._onAppend("","","auto")}},{text:s("array"),className:"jsoneditor-type-array",title:o.array,click:function(){n._onAppend("",[])}},{text:s("object"),className:"jsoneditor-type-object",title:o.object,click:function(){n._onAppend("",{})}},{text:s("string"),className:"jsoneditor-type-string",title:o.string,click:function(){n._onAppend("","","string")}}];n.addTemplates(a,!0);var l=[{text:s("appendText"),title:s("appendTitleAuto"),submenuTitle:s("appendSubmenuTitle"),className:"jsoneditor-insert",click:function(){n._onAppend("","","auto")},submenu:a}];this.editor.options.onCreateMenu&&(l=this.editor.options.onCreateMenu(l,{path:n.getPath()})),new r(l,{close:i}).show(t,this.editor.content)},t.prototype.onEvent=function(e){var t=e.type,i=e.target||e.srcElement,n=this.dom;if(i==n.menu&&("mouseover"==t?this.editor.highlighter.highlight(this.parent):"mouseout"==t&&this.editor.highlighter.unhighlight()),"click"==t&&i==n.menu){var r=this.editor.highlighter;r.highlight(this.parent),r.lock(),o.addClassName(n.menu,"jsoneditor-selected"),this.showContextMenu(n.menu,function(){o.removeClassName(n.menu,"jsoneditor-selected"),r.unlock(),r.unhighlight()})}"keydown"==t&&this.onKeyDown(e)},t}var o=i(12),r=i(10),s=i(16).translate;e.exports=n},function(e,t,i){"use strict";function n(e){function t(e,t){this.editor=e,this.parent=t,this.dom={}}return t.prototype=new e,t.prototype.getDom=function(){if(this.dom.tr)return this.dom.tr;if(this._updateEditability(),!this.dom.tr){var e=this,t=this.parent,i=document.createElement("a");i.appendChild(document.createTextNode(o("showMore"))),i.href="#",i.onclick=function(i){return t.visibleChilds=Math.floor(t.visibleChilds/t.getMaxVisibleChilds()+1)*t.getMaxVisibleChilds(),e.updateDom(),t.showChilds(),i.preventDefault(),!1};var n=document.createElement("a");n.appendChild(document.createTextNode(o("showAll"))),n.href="#",n.onclick=function(i){return t.visibleChilds=1/0,e.updateDom(),t.showChilds(),i.preventDefault(),!1};var r=document.createElement("div"),s=document.createTextNode(this._getShowMoreText());r.className="jsoneditor-show-more",r.appendChild(s),r.appendChild(i),r.appendChild(document.createTextNode(". ")),r.appendChild(n),r.appendChild(document.createTextNode(". "));var a=document.createElement("td");a.appendChild(r);var l=document.createElement("tr");"tree"===this.editor.options.mode&&(l.appendChild(document.createElement("td")),l.appendChild(document.createElement("td"))),l.appendChild(a),l.className="jsoneditor-show-more",this.dom.tr=l,this.dom.moreContents=r,this.dom.moreText=s}return this.updateDom(),this.dom.tr},t.prototype.updateDom=function(e){if(this.isVisible()){if(this.dom.tr.node=this.parent.childs[this.parent.visibleChilds],!this.dom.tr.parentNode){var t=this.parent._getNextTr();t&&t.parentNode.insertBefore(this.dom.tr,t)}this.dom.moreText.nodeValue=this._getShowMoreText(),this.dom.moreContents.style.marginLeft=24*(this.getLevel()+1)+"px"}else this.dom.tr&&this.dom.tr.parentNode&&this.dom.tr.parentNode.removeChild(this.dom.tr)},t.prototype._getShowMoreText=function(){return o("showMoreStatus",{visibleChilds:this.parent.visibleChilds,totalChilds:this.parent.childs.length})+" "},t.prototype.isVisible=function(){return this.parent.expanded&&this.parent.childs.length>this.parent.visibleChilds},t.prototype.onEvent=function(e){"keydown"===e.type&&this.onKeyDown(e)},t}var o=i(16).translate;e.exports=n},function(e,t,i){function n(e,t){var i='
'+r("sort")+"
"+r("sortFieldLabel")+'
'+r("sortDirectionLabel")+'
';o({parent:t,content:i,overlayClass:"jsoneditor-modal-overlay",modalClass:"jsoneditor-modal jsoneditor-modal-sort"}).afterCreate(function(t){function i(e){s.value=e,s.className="jsoneditor-button-group jsoneditor-button-group-value-"+s.value}var n=t.modalElem().querySelector("form"),o=t.modalElem().querySelector("#ok"),r=t.modalElem().querySelector("#field"),s=t.modalElem().querySelector("#direction"),a="array"===e.type?e.getChildPaths():["."];a.forEach(function(e){var t=document.createElement("option");t.text=e,t.value=e,r.appendChild(t)}),r.value=e.sortedBy?e.sortedBy.path:a[0],i(e.sortedBy?e.sortedBy.direction:"asc"),s.onclick=function(e){i(e.target.getAttribute("data-value"))},o.onclick=function(i){i.preventDefault(),i.stopPropagation(),t.close();var n=r.value,o="."===n?[]:n.split(".").slice(1);e.sortedBy={path:n,direction:s.value},e.sort(o,s.value)},n&&(n.onsubmit=o.onclick)}).afterClose(function(e){e.destroy()}).show()}var o=i(24),r=i(16).translate;e.exports=n},function(e,t,i){var n,o,r;!function(i,s){"use strict";o=[],n=s,void 0!==(r="function"==typeof n?n.apply(t,o):n)&&(e.exports=r)}(0,function(){"use strict";function e(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType}function t(e){return"string"==typeof e}function i(){var e=[];return{watch:e.push.bind(e),trigger:function(t,i){for(var n=!0,o={detail:i,preventDefault:function(){n=!1}},r=0;r
'+a("transform")+'

Enter a JMESPath query to filter, sort, or transform the JSON data.
To learn JMESPath, go to the interactive tutorial.

'+a("transformWizardLabel")+'
'+a("transformWizardFilter")+'
'+a("transformWizardSortBy")+'
'+a("transformWizardSelectFields")+'
'+a("transformQueryLabel")+'
'+a("transformPreviewLabel")+'
';r({parent:t,content:n,overlayClass:"jsoneditor-modal-overlay",modalClass:"jsoneditor-modal jsoneditor-modal-transform",focus:!1}).afterCreate(function(t){function n(e){return"."===e[0]?"."===e?"@":e.slice(1):e}function r(){if(p.value&&f.value&&m.value){var t=p.value,i=JSON.stringify(e._stringCast(m.value));b.value="[? "+t+" "+f.value+" `"+i+"`]"}else b.value="[*]";if(g.value&&v.value){var n=g.value;"desc"===v.value?b.value+=" | reverse(sort_by(@, &"+n+"))":b.value+=" | sort_by(@, &"+n+")"}if(y.value){for(var o=[],r=0;r1&&(b.value+=".{"+o.map(function(e){var t=e.split(".");return t[t.length-1]+": "+e}).join(", ")+"}")}k()}function a(){try{var e=o.search(i,b.value),t=JSON.stringify(e,null,2).split("\n");t.length>c&&(t=t.slice(0,c).concat(["..."])),x.className="jsoneditor-transform-preview",x.value=t.join("\n"),u.disabled=!1}catch(e){x.className="jsoneditor-transform-preview jsoneditor-error",x.value=e.toString(),u.disabled=!0}}var h=t.modalElem(),d=h.querySelector("#wizard"),u=h.querySelector("#ok"),p=h.querySelector("#filterField"),f=h.querySelector("#filterRelation"),m=h.querySelector("#filterValue"),g=h.querySelector("#sortField"),v=h.querySelector("#sortOrder"),y=h.querySelector("#selectFields"),b=h.querySelector("#query"),x=h.querySelector("#preview");Array.isArray(i)||(d.style.display="none",d.parentNode.style.fontStyle="italic",d.parentNode.appendChild(document.createTextNode("(wizard not available for objects, only for arrays)"))),e.getChildPaths().forEach(function(e){var t=n(e),i=document.createElement("option");i.text=t,i.value=t,p.appendChild(i);var o=document.createElement("option");o.text=t,o.value=t,g.appendChild(o)});var w=e.getChildPaths(!0).filter(function(e){return"."!==e});w.length>0?w.forEach(function(e){var t=n(e),i=document.createElement("option");i.text=t,i.value=t,y.appendChild(i)}):h.querySelector("#selectFieldsPart").style.display="none";var _=new s(p,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"field..."}),C=new s(f,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"compare..."}),E=new s(g,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"field..."}),S=new s(v,{defaultSelected:!1,clearable:!0,allowDeselect:!0,placeholder:"order..."}),T=new s(y,{multiple:!0,clearable:!0,defaultSelected:!1});_.on("selectr.change",r),C.on("selectr.change",r),m.oninput=r,E.on("selectr.change",r),S.on("selectr.change",r),T.on("selectr.change",r),h.querySelector(".pico-modal-contents").onclick=function(e){e.preventDefault()},b.value=Array.isArray(i)?"[*]":"@";var k=l(a,300);b.oninput=k,k(),u.onclick=function(i){i.preventDefault(),i.stopPropagation(),t.close(),e.transform(b.value)},setTimeout(function(){b.select(),b.focus(),b.selectionStart=3,b.selectionEnd=3})}).afterClose(function(e){e.destroy()}).show()}var o=i(19),r=i(24),s=i(26),a=i(16).translate,l=i(12).debounce,c=100;e.exports=n},function(e,t){"use strict";function i(e,t){return e.hasOwnProperty(t)&&(!0===e[t]||e[t].length)}function n(e,t,i){e.parentNode?e.parentNode.parentNode||t.appendChild(e.parentNode):t.appendChild(e),s.removeClass(e,"excluded"),i||(e.innerHTML=e.textContent)}var o={defaultSelected:!0,width:"auto",disabled:!1,searchable:!0,clearable:!1,sortSelected:!1,allowDeselect:!1,closeOnScroll:!1,nativeDropdown:!1,placeholder:"Select an option...",taggable:!1,tagPlaceholder:"Enter a tag..."},r=function(){};r.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){this._events=this._events||{},e in this._events!=!1&&this._events[e].splice(this._events[e].indexOf(t),1)},emit:function(e){if(this._events=this._events||{},e in this._events!=!1)for(var t=0;t-1},truncate:function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}},a=function(){if(this.items.length){var e=document.createDocumentFragment();if(this.config.pagination){var t=this.pages.slice(0,this.pageIndex);s.each(t,function(t,i){s.each(i,function(t,i){n(i,e,this.customOption)},this)},this)}else s.each(this.items,function(t,i){n(i,e,this.customOption)},this);e.childElementCount&&(s.removeClass(this.items[this.navIndex],"active"),this.navIndex=e.querySelector(".selectr-option").idx,s.addClass(this.items[this.navIndex],"active")),this.tree.appendChild(e)}},l=function(e){var t=e.target;this.container.contains(t)||!this.opened&&!s.hasClass(this.container,"notice")||this.close()},c=function(e,t){t=t||e;var i=this.customOption?this.config.renderOption(t):e.textContent,n=s.createElement("li",{class:"selectr-option",html:i,role:"treeitem","aria-selected":!1});return n.idx=e.idx,this.items.push(n),e.defaultSelected&&this.defaultSelected.push(e.idx),e.disabled&&(n.disabled=!0,s.addClass(n,"disabled")),n},h=function(){this.requiresPagination=this.config.pagination&&this.config.pagination>0,i(this.config,"width")&&(s.isInt(this.config.width)?this.width=this.config.width+"px":"auto"===this.config.width?this.width="100%":s.includes(this.config.width,"%")&&(this.width=this.config.width)),this.container=s.createElement("div",{class:"selectr-container"}),this.config.customClass&&s.addClass(this.container,this.config.customClass),this.mobileDevice?s.addClass(this.container,"selectr-mobile"):s.addClass(this.container,"selectr-desktop"),this.el.tabIndex=-1,this.config.nativeDropdown||this.mobileDevice?s.addClass(this.el,"selectr-visible"):s.addClass(this.el,"selectr-hidden"),this.selected=s.createElement("div",{class:"selectr-selected",disabled:this.disabled,tabIndex:1,"aria-expanded":!1}),this.label=s.createElement(this.el.multiple?"ul":"span",{class:"selectr-label"});var e=s.createElement("div",{class:"selectr-options-container"});if(this.tree=s.createElement("ul",{class:"selectr-options",role:"tree","aria-hidden":!0,"aria-expanded":!1}),this.notice=s.createElement("div",{class:"selectr-notice"}),this.el.setAttribute("aria-hidden",!0),this.disabled&&(this.el.disabled=!0),this.el.multiple&&(s.addClass(this.label,"selectr-tags"),s.addClass(this.container,"multiple"),this.tags=[],this.selectedValues=this.getSelectedProperties("value"),this.selectedIndexes=this.getSelectedProperties("idx")),this.selected.appendChild(this.label),this.config.clearable&&(this.selectClear=s.createElement("button",{class:"selectr-clear",type:"button"}),this.container.appendChild(this.selectClear),s.addClass(this.container,"clearable")),this.config.taggable){var t=s.createElement("li",{class:"input-tag"});this.input=s.createElement("input",{class:"selectr-tag-input",placeholder:this.config.tagPlaceholder,tagIndex:0,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox",type:"search"}),t.appendChild(this.input),this.label.appendChild(t),s.addClass(this.container,"taggable"),this.tagSeperators=[","],this.config.tagSeperators&&(this.tagSeperators=this.tagSeperators.concat(this.config.tagSeperators))}this.config.searchable&&(this.input=s.createElement("input",{class:"selectr-input",tagIndex:-1,autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"textbox",type:"search"}),this.inputClear=s.createElement("button",{class:"selectr-input-clear",type:"button"}),this.inputContainer=s.createElement("div",{class:"selectr-input-container"}),this.inputContainer.appendChild(this.input),this.inputContainer.appendChild(this.inputClear),e.appendChild(this.inputContainer)),e.appendChild(this.notice),e.appendChild(this.tree),this.items=[],this.options=[],this.el.options.length&&(this.options=[].slice.call(this.el.options));var n=!1,o=0;if(this.el.children.length&&s.each(this.el.children,function(e,t){"OPTGROUP"===t.nodeName?(n=s.createElement("ul",{class:"selectr-optgroup",role:"group",html:"
  • "+t.label+"
  • "}),s.each(t.children,function(e,t){t.idx=o,n.appendChild(c.call(this,t,n)),o++},this)):(t.idx=o,c.call(this,t),o++)},this),this.config.data&&Array.isArray(this.config.data)){this.data=[];var r,a=!1;n=!1,o=0,s.each(this.config.data,function(e,t){i(t,"children")?(a=s.createElement("optgroup",{label:t.text}),n=s.createElement("ul",{class:"selectr-optgroup",role:"group",html:"
  • "+t.text+"
  • "}),s.each(t.children,function(e,t){r=new Option(t.text,t.value,!1,t.hasOwnProperty("selected")&&!0===t.selected),r.disabled=i(t,"disabled"),this.options.push(r),a.appendChild(r),r.idx=o,n.appendChild(c.call(this,r,t)),this.data[o]=t,o++},this)):(r=new Option(t.text,t.value,!1,t.hasOwnProperty("selected")&&!0===t.selected),r.disabled=i(t,"disabled"),this.options.push(r),r.idx=o,c.call(this,r,t),this.data[o]=t,o++)},this)}this.setSelected(!0);var l;this.navIndex=0;for(var h=0;h0)&&this.change(this.navIndex);var t,i=this.items[this.navIndex];switch(e.which){case 38:t=0,this.navIndex>0&&this.navIndex--;break;case 40:t=1,this.navIndexthis.tree.lastElementChild.idx){this.navIndex=this.tree.lastElementChild.idx;break}if(this.navIndexthis.optsRect.top+this.optsRect.height&&(this.tree.scrollTop=this.tree.scrollTop+(n.top+n.height-(this.optsRect.top+this.optsRect.height))),this.navIndex===this.tree.childElementCount-1&&this.requiresPagination&&f.call(this)):0===this.navIndex?this.tree.scrollTop=0:n.top-this.optsRect.top<0&&(this.tree.scrollTop=this.tree.scrollTop+(n.top-this.optsRect.top)),i&&s.removeClass(i,"active"),s.addClass(this.items[this.navIndex],"active")},u=function(e){var t,i=this,n=document.createDocumentFragment(),o=this.options[e.idx],r=this.data?this.data[e.idx]:o,a=this.customSelected?this.config.renderSelection(r):o.textContent,l=s.createElement("li",{class:"selectr-tag",html:a}),c=s.createElement("button",{class:"selectr-tag-remove",type:"button"});if(l.appendChild(c),l.idx=e.idx,l.tag=o.value,this.tags.push(l),this.config.sortSelected){var h=this.tags.slice();t=function(e,t){e.replace(/(\d+)|(\D+)/g,function(e,i,n){t.push([i||1/0,n||""])})},h.sort(function(e,n){var o,r,s=[],a=[];for(!0===i.config.sortSelected?(o=e.tag,r=n.tag):"text"===i.config.sortSelected&&(o=e.textContent,r=n.textContent),t(o,s),t(r,a);s.length&&a.length;){var l=s.shift(),c=a.shift(),h=l[0]-c[0]||l[1].localeCompare(c[1]);if(h)return h}return s.length-a.length}),s.each(h,function(e,t){n.appendChild(t)}),this.label.innerHTML=""}else n.appendChild(l);this.config.taggable?this.label.insertBefore(n,this.input.parentNode):this.label.appendChild(n)},p=function(e){var t=!1;s.each(this.tags,function(i,n){n.idx===e.idx&&(t=n)},this),t&&(this.label.removeChild(t),this.tags.splice(this.tags.indexOf(t),1))},f=function(){var e=this.tree;if(e.scrollTop>=e.scrollHeight-e.offsetHeight&&this.pageIndex"+i[0]+"")},v=function(e,t){if(t=t||{},!e)throw new Error("You must supply either a HTMLSelectElement or a CSS3 selector string.");if(this.el=e,"string"==typeof e&&(this.el=document.querySelector(e)),null===this.el)throw new Error("The element you passed to Selectr can not be found.");if("select"!==this.el.nodeName.toLowerCase())throw new Error("The element you passed to Selectr is not a HTMLSelectElement.");this.render(t)};v.prototype.render=function(e){if(!this.rendered){this.config=s.extend(o,e),this.originalType=this.el.type,this.originalIndex=this.el.tabIndex,this.defaultSelected=[],this.originalOptionCount=this.el.options.length,(this.config.multiple||this.config.taggable)&&(this.el.multiple=!0),this.disabled=i(this.config,"disabled"),this.opened=!1,this.config.taggable&&(this.config.searchable=!1),this.navigating=!1,this.mobileDevice=!1,/Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile/i.test(navigator.userAgent)&&(this.mobileDevice=!0),this.customOption=this.config.hasOwnProperty("renderOption")&&"function"==typeof this.config.renderOption,this.customSelected=this.config.hasOwnProperty("renderSelection")&&"function"==typeof this.config.renderSelection,r.mixin(this),h.call(this),this.bindEvents(),this.update(),this.optsRect=s.rect(this.tree),this.rendered=!0,this.el.multiple||(this.el.selectedIndex=this.selectedIndex);var t=this;setTimeout(function(){t.emit("selectr.init")},20)}},v.prototype.getSelected=function(){return this.el.querySelectorAll("option:checked")},v.prototype.getSelectedProperties=function(e){var t=this.getSelected();return[].slice.call(t).map(function(t){return t[e]}).filter(function(e){return null!==e&&void 0!==e})},v.prototype.bindEvents=function(){var e=this;if(this.events={},this.events.dismiss=l.bind(this),this.events.navigate=d.bind(this),this.events.reset=this.reset.bind(this),this.config.nativeDropdown||this.mobileDevice){this.container.addEventListener("touchstart",function(t){t.changedTouches[0].target===e.el&&e.toggle()}),(this.config.nativeDropdown||this.mobileDevice)&&this.container.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation(),t.target===e.el&&e.toggle()});var t=function(e,t){for(var i,n=[],o=e.slice(0),r=0;r-1?o.splice(i,1):n.push(t[r]);return[n,o]};this.el.addEventListener("change",function(i){if(e.el.multiple){var n=e.getSelectedProperties("idx"),o=t(e.selectedIndexes,n);s.each(o[0],function(t,i){e.select(i)},e),s.each(o[1],function(t,i){e.deselect(i)},e)}else e.el.selectedIndex>-1&&e.select(e.el.selectedIndex)})}this.config.nativeDropdown&&this.container.addEventListener("keydown",function(t){"Enter"===t.key&&e.selected===document.activeElement&&(e.toggle(),setTimeout(function(){e.el.focus()},200))}),this.selected.addEventListener("click",function(t){e.disabled||e.toggle(),t.preventDefault(),t.stopPropagation()}),this.label.addEventListener("click",function(t){s.hasClass(t.target,"selectr-tag-remove")&&e.deselect(t.target.parentNode.idx)}),this.selectClear&&this.selectClear.addEventListener("click",this.clear.bind(this)),this.tree.addEventListener("mousedown",function(e){e.preventDefault()}),this.tree.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();var i=s.closest(t.target,function(e){return e&&s.hasClass(e,"selectr-option")});i&&(s.hasClass(i,"disabled")||(s.hasClass(i,"selected")?(e.el.multiple||!e.el.multiple&&e.config.allowDeselect)&&e.deselect(i.idx):e.select(i.idx),e.opened&&!e.el.multiple&&e.close()))}),this.tree.addEventListener("mouseover",function(t){s.hasClass(t.target,"selectr-option")&&(s.hasClass(t.target,"disabled")||(s.removeClass(e.items[e.navIndex],"active"),s.addClass(t.target,"active"),e.navIndex=[].slice.call(e.items).indexOf(t.target)))}),this.config.searchable&&(this.input.addEventListener("focus",function(t){e.searching=!0}),this.input.addEventListener("blur",function(t){e.searching=!1}),this.input.addEventListener("keyup",function(t){e.search(),e.config.taggable||(this.value.length?s.addClass(this.parentNode,"active"):s.removeClass(this.parentNode,"active"))}),this.inputClear.addEventListener("click",function(t){e.input.value=null,m.call(e),e.tree.childElementCount||a.call(e)})),this.config.taggable&&this.input.addEventListener("keyup",function(t){if(e.search(),e.config.taggable&&this.value.length){var i=this.value.trim();if(13===t.which||s.includes(e.tagSeperators,t.key)){s.each(e.tagSeperators,function(e,t){i=i.replace(t,"")});e.add({value:i,text:i,selected:!0},!0)?(e.close(),m.call(e)):(this.value="",e.setMessage("That tag is already in use."))}}}),this.update=s.debounce(function(){e.opened&&e.config.closeOnScroll&&e.close(),e.width&&(e.container.style.width=e.width),e.invert()},50),this.requiresPagination&&(this.paginateItems=s.debounce(function(){f.call(this)},50),this.tree.addEventListener("scroll",this.paginateItems.bind(this))),document.addEventListener("click",this.events.dismiss),window.addEventListener("keydown",this.events.navigate),window.addEventListener("resize",this.update),window.addEventListener("scroll",this.update),this.el.form&&this.el.form.addEventListener("reset",this.events.reset)},v.prototype.setSelected=function(e){if(this.config.data||this.el.multiple||!this.el.options.length||(0===this.el.selectedIndex&&(this.el.options[0].defaultSelected||this.config.defaultSelected||(this.el.selectedIndex=-1)),this.selectedIndex=this.el.selectedIndex,this.selectedIndex>-1&&this.select(this.selectedIndex)),this.config.multiple&&"select-one"===this.originalType&&!this.config.data&&this.el.options[0].selected&&!this.el.options[0].defaultSelected&&(this.el.options[0].selected=!1),s.each(this.options,function(e,t){t.selected&&t.defaultSelected&&this.select(t.idx)},this),this.config.selectedValue&&this.setValue(this.config.selectedValue),this.config.data){!this.el.multiple&&this.config.defaultSelected&&this.el.selectedIndex<0&&this.select(0);var t=0;s.each(this.config.data,function(e,n){i(n,"children")?s.each(n.children,function(e,i){i.hasOwnProperty("selected")&&!0===i.selected&&this.select(t),t++},this):(n.hasOwnProperty("selected")&&!0===n.selected&&this.select(t),t++)},this)}},v.prototype.destroy=function(){this.rendered&&(this.emit("selectr.destroy"),"select-one"===this.originalType&&(this.el.multiple=!1),this.config.data&&(this.el.innerHTML=""),s.removeClass(this.el,"selectr-hidden"),this.el.form&&s.off(this.el.form,"reset",this.events.reset),s.off(document,"click",this.events.dismiss),s.off(document,"keydown",this.events.navigate),s.off(window,"resize",this.update),s.off(window,"scroll",this.update),this.container.parentNode.replaceChild(this.el,this.container),this.rendered=!1)},v.prototype.change=function(e){var t=this.items[e],i=this.options[e];i.disabled||(i.selected&&s.hasClass(t,"selected")?this.deselect(e):this.select(e),this.opened&&!this.el.multiple&&this.close())},v.prototype.select=function(e){var t=this.items[e],i=[].slice.call(this.el.options),n=this.options[e];if(this.el.multiple){if(s.includes(this.selectedIndexes,e))return!1;if(this.config.maxSelections&&this.tags.length===this.config.maxSelections)return this.setMessage("A maximum of "+this.config.maxSelections+" items can be selected.",!0),!1;this.selectedValues.push(n.value),this.selectedIndexes.push(e),u.call(this,t)}else{var o=this.data?this.data[e]:n;this.label.innerHTML=this.customSelected?this.config.renderSelection(o):n.textContent,this.selectedValue=n.value,this.selectedIndex=e,s.each(this.options,function(t,i){var n=this.items[t];t!==e&&(n&&s.removeClass(n,"selected"),i.selected=!1,i.removeAttribute("selected"))},this)}s.includes(i,n)||this.el.add(n),t.setAttribute("aria-selected",!0),s.addClass(t,"selected"),s.addClass(this.container,"has-selected"),n.selected=!0,n.setAttribute("selected",""),this.emit("selectr.change",n),this.emit("selectr.select",n)},v.prototype.deselect=function(e,t){var i=this.items[e],n=this.options[e];if(this.el.multiple){var o=this.selectedIndexes.indexOf(e);this.selectedIndexes.splice(o,1);var r=this.selectedValues.indexOf(n.value);this.selectedValues.splice(r,1),p.call(this,i),this.tags.length||s.removeClass(this.container,"has-selected")}else{if(!t&&!this.config.clearable&&!this.config.allowDeselect)return!1;this.label.innerHTML="",this.selectedValue=null,this.el.selectedIndex=this.selectedIndex=-1,s.removeClass(this.container,"has-selected")}this.items[e].setAttribute("aria-selected",!1),s.removeClass(this.items[e],"selected"),n.selected=!1,n.removeAttribute("selected"),this.emit("selectr.change",null),this.emit("selectr.deselect",n)},v.prototype.setValue=function(e){var t=Array.isArray(e);if(t||(e=e.toString().trim()),!this.el.multiple&&t)return!1;s.each(this.options,function(i,n){(t&&s.includes(e.toString(),n.value)||n.value===e)&&this.change(n.idx)},this)},v.prototype.getValue=function(e,t){var i;if(this.el.multiple)e?this.selectedIndexes.length&&(i={},i.values=[],s.each(this.selectedIndexes,function(e,t){var n=this.options[t];i.values[e]={value:n.value,text:n.textContent}},this)):i=this.selectedValues.slice();else if(e){var n=this.options[this.selectedIndex];i={value:n.value,text:n.textContent}}else i=this.selectedValue;return e&&t&&(i=JSON.stringify(i)),i},v.prototype.add=function(e,t){if(e){if(this.data=this.data||[],this.items=this.items||[],this.options=this.options||[],Array.isArray(e))s.each(e,function(e,i){this.add(i,t)},this);else if("[object Object]"===Object.prototype.toString.call(e)){if(t){var i=!1;if(s.each(this.options,function(t,n){n.value.toLowerCase()===e.value.toLowerCase()&&(i=!0)}),i)return!1}var n=s.createElement("option",e);return this.data.push(e),this.options.push(n),n.idx=this.options.length>0?this.options.length-1:0,c.call(this,n),e.selected&&this.select(n.idx),n}return this.setPlaceholder(),this.config.pagination&&this.paginate(),!0}},v.prototype.remove=function(e){var t=[];if(Array.isArray(e)?s.each(e,function(i,n){s.isInt(n)?t.push(this.getOptionByIndex(n)):"string"==typeof e&&t.push(this.getOptionByValue(n))},this):s.isInt(e)?t.push(this.getOptionByIndex(e)):"string"==typeof e&&t.push(this.getOptionByValue(e)),t.length){var i;s.each(t,function(e,t){i=t.idx,this.el.remove(t),this.options.splice(i,1);var n=this.items[i].parentNode;n&&n.removeChild(this.items[i]),this.items.splice(i,1),s.each(this.options,function(e,t){t.idx=e,this.items[e].idx=e},this)},this),this.setPlaceholder(),this.config.pagination&&this.paginate()}},v.prototype.removeAll=function(){this.clear(!0),s.each(this.el.options,function(e,t){this.el.remove(t)},this),s.truncate(this.tree),this.items=[],this.options=[],this.data=[],this.navIndex=0,this.requiresPagination&&(this.requiresPagination=!1,this.pageIndex=1,this.pages=[]),this.setPlaceholder()},v.prototype.search=function(e){if(!this.navigating){e=e||this.input.value;var t=document.createDocumentFragment();if(this.removeMessage(),s.truncate(this.tree),e.length>1)if(s.each(this.options,function(i,o){var r=this.items[o.idx];s.includes(o.textContent.toLowerCase(),e.toLowerCase())&&!o.disabled?(n(r,t,this.customOption),s.removeClass(r,"excluded"),this.customOption||(r.innerHTML=g(e,o))):s.addClass(r,"excluded")},this),t.childElementCount){var i=this.items[this.navIndex],o=t.firstElementChild;s.removeClass(i,"active"),this.navIndex=o.idx,s.addClass(o,"active")}else this.config.taggable||this.setMessage("no results.");else a.call(this);this.tree.appendChild(t)}},v.prototype.toggle=function(){this.disabled||(this.opened?this.close():this.open())},v.prototype.open=function(){var e=this;return!!this.options.length&&(this.opened||this.emit("selectr.open"),this.opened=!0,this.mobileDevice||this.config.nativeDropdown?(s.addClass(this.container,"native-open"),void(this.config.data&&s.each(this.options,function(e,t){this.el.add(t)},this))):(s.addClass(this.container,"open"), a.call(this),this.invert(),this.tree.scrollTop=0,s.removeClass(this.container,"notice"),this.selected.setAttribute("aria-expanded",!0),this.tree.setAttribute("aria-hidden",!1),this.tree.setAttribute("aria-expanded",!0),void(this.config.searchable&&!this.config.taggable&&setTimeout(function(){e.input.focus(),e.input.tabIndex=0},10))))},v.prototype.close=function(){if(this.opened&&this.emit("selectr.close"),this.opened=!1,this.mobileDevice||this.config.nativeDropdown)return void s.removeClass(this.container,"native-open");var e=s.hasClass(this.container,"notice");this.config.searchable&&!e&&(this.input.blur(),this.input.tabIndex=-1,this.searching=!1),e&&(s.removeClass(this.container,"notice"),this.notice.textContent=""),s.removeClass(this.container,"open"),s.removeClass(this.container,"native-open"),this.selected.setAttribute("aria-expanded",!1),this.tree.setAttribute("aria-hidden",!0),this.tree.setAttribute("aria-expanded",!1),s.truncate(this.tree),m.call(this)},v.prototype.enable=function(){this.disabled=!1,this.el.disabled=!1,this.selected.tabIndex=this.originalIndex,this.el.multiple&&s.each(this.tags,function(e,t){t.lastElementChild.tabIndex=0}),s.removeClass(this.container,"selectr-disabled")},v.prototype.disable=function(e){e||(this.el.disabled=!0),this.selected.tabIndex=-1,this.el.multiple&&s.each(this.tags,function(e,t){t.lastElementChild.tabIndex=-1}),this.disabled=!0,s.addClass(this.container,"selectr-disabled")},v.prototype.reset=function(){this.disabled||(this.clear(),this.setSelected(!0),s.each(this.defaultSelected,function(e,t){this.select(t)},this),this.emit("selectr.reset"))},v.prototype.clear=function(e){if(this.el.multiple){if(this.selectedIndexes.length){var t=this.selectedIndexes.slice();s.each(t,function(e,t){this.deselect(t)},this)}}else this.selectedIndex>-1&&this.deselect(this.selectedIndex,e);this.emit("selectr.clear")},v.prototype.serialise=function(e){var t=[];return s.each(this.options,function(e,i){var n={value:i.value,text:i.textContent};i.selected&&(n.selected=!0),i.disabled&&(n.disabled=!0),t[e]=n}),e?JSON.stringify(t):t},v.prototype.serialize=function(e){return this.serialise(e)},v.prototype.setPlaceholder=function(e){e=e||this.config.placeholder||this.el.getAttribute("placeholder"),this.options.length||(e="No options available"),this.placeEl.innerHTML=e},v.prototype.paginate=function(){if(this.items.length){var e=this;return this.pages=this.items.map(function(t,i){return i%e.config.pagination==0?e.items.slice(i,i+e.config.pagination):null}).filter(function(e){return e}),this.pages}},v.prototype.setMessage=function(e,t){t&&this.close(),s.addClass(this.container,"notice"),this.notice.textContent=e},v.prototype.removeMessage=function(){s.removeClass(this.container,"notice"),this.notice.innerHTML=""},v.prototype.invert=function(){var e=s.rect(this.selected),t=this.tree.parentNode.offsetHeight,i=window.innerHeight;e.top+e.height+t>i?(s.addClass(this.container,"inverted"),this.isInverted=!0):(s.removeClass(this.container,"inverted"),this.isInverted=!1),this.optsRect=s.rect(this.tree)},v.prototype.getOptionByIndex=function(e){return this.options[e]},v.prototype.getOptionByValue=function(e){for(var t=!1,i=0,n=this.options.length;i/g,">"),a.getBoundingClientRect().right}e=e||{},e.confirmKeys=e.confirmKeys||[39,35,9],e.caseSensitive=e.caseSensitive||!1;var n="",o="",r=document.createElement("div");r.style.position="relative",r.style.outline="0",r.style.border="0",r.style.margin="0",r.style.padding="0";var s=document.createElement("div");s.className="autocomplete dropdown",s.style.position="absolute",s.style.visibility="hidden";var a,l,c={onArrowDown:function(){},onArrowUp:function(){},onEnter:function(){},onTab:function(){},startFrom:0,options:[],element:null,elementHint:null,elementStyle:null,wrapper:r,show:function(e,t,i){this.startFrom=t,this.wrapper.remove(),this.elementHint&&(this.elementHint.remove(),this.elementHint=null),""==n&&(n=window.getComputedStyle(e).getPropertyValue("font-size")),""==o&&(o=window.getComputedStyle(e).getPropertyValue("font-family"));e.getBoundingClientRect().right,e.getBoundingClientRect().left;s.style.marginLeft="0",s.style.marginTop=e.getBoundingClientRect().height+"px",this.options=i,this.element!=e&&(this.element=e,this.elementStyle={zIndex:this.element.style.zIndex,position:this.element.style.position,backgroundColor:this.element.style.backgroundColor,borderColor:this.element.style.borderColor}),this.element.style.zIndex=3,this.element.style.position="relative",this.element.style.backgroundColor="transparent",this.element.style.borderColor="transparent",this.elementHint=e.cloneNode(),this.elementHint.className="autocomplete hint",this.elementHint.style.zIndex=2,this.elementHint.style.position="absolute",this.elementHint.onfocus=function(){this.element.focus()}.bind(this),this.element.addEventListener&&(this.element.removeEventListener("keydown",d),this.element.addEventListener("keydown",d,!1),this.element.removeEventListener("blur",u),this.element.addEventListener("blur",u,!1)),r.appendChild(this.elementHint),r.appendChild(s),e.parentElement.appendChild(r),this.repaint(e)},setText:function(e){this.element.innerText=e},getText:function(){return this.element.innerText},hideDropDown:function(){this.wrapper.remove(),this.elementHint&&(this.elementHint.remove(),this.elementHint=null,h.hide(),this.element.style.zIndex=this.elementStyle.zIndex,this.element.style.position=this.elementStyle.position,this.element.style.backgroundColor=this.elementStyle.backgroundColor,this.element.style.borderColor=this.elementStyle.borderColor)},repaint:function(t){var n=t.innerText;n=n.replace("\n","");var o=(this.startFrom,this.options,this.options.length),r=n.substring(this.startFrom);l=n.substring(0,this.startFrom);for(var a=0;a"+r[f].substring(i.length)+"",n.push(m),t.appendChild(m)}0!==n.length&&(1===n.length&&(i.toLowerCase()===n[0].__hint.toLowerCase()&&!e.caseSensitive||i===n[0].__hint&&e.caseSensitive)||n.length<2||(c.highlight(0),u>3*p?(t.style.maxHeight=u+"px",t.style.top="",t.style.bottom="100%"):(t.style.top="100%",t.style.bottom="",t.style.maxHeight=p+"px"),t.style.visibility="visible"))},highlight:function(e){-1!=r&&n[r]&&(n[r].className="item"),n[e].className="item hover",r=e},move:function(e){return"hidden"===t.style.visibility?"":o+e===-1||o+e===n.length?n[o].__hint:(o+=e,c.highlight(o),n[o].__hint)},onmouseselection:function(){}};return c}(s,c),d=function(i){i=i||window.event;var n=i.keyCode;if(null!=this.elementHint&&33!=n&&34!=n){if(27==n)return c.hideDropDown(),c.element.focus(),i.preventDefault(),void i.stopPropagation();var o=this.element.innerText;o=o.replace("\n","");this.startFrom;if(e.confirmKeys.indexOf(n)>=0)return 9==n&&0==this.elementHint.innerText.length&&c.onTab(),void(this.elementHint.innerText.length>0&&this.element.innerText!=this.elementHint.realInnerText&&(this.element.innerText=this.elementHint.realInnerText,c.hideDropDown(),t(this.element),9==n&&(c.element.focus(),i.preventDefault(),i.stopPropagation())));if(13!=n){if(40==n){var r=o.substring(this.startFrom),a=h.move(1);return""==a&&c.onArrowDown(),this.elementHint.innerText=l+r+a.substring(r.length),this.elementHint.realInnerText=l+a,i.preventDefault(),void i.stopPropagation()}if(38==n){var r=o.substring(this.startFrom),a=h.move(-1);return""==a&&c.onArrowUp(),this.elementHint.innerText=l+r+a.substring(r.length),this.elementHint.realInnerText=l+a,i.preventDefault(),void i.stopPropagation()}}else if(0==this.elementHint.innerText.length)c.onEnter();else{var d="hidden"==s.style.visibility;if(h.hide(),d)return c.hideDropDown(),c.element.focus(),void c.onEnter();this.element.innerText=this.elementHint.realInnerText,c.hideDropDown(),t(this.element),i.preventDefault(),i.stopPropagation()}}}.bind(c),u=function(e){c.hideDropDown()}.bind(c);return h.onmouseselection=function(e,i){i.element.innerText=i.elementHint.innerText=l+e,i.hideDropDown(),window.setTimeout(function(){i.element.focus(),t(i.element)},1)},c}e.exports=i},function(e,t,i){"use strict";function n(){try{this.format()}catch(e){}}var o=i(1),r=i(27),s=i(12),a={};a.create=function(e,t){t=t||{},void 0===t.statusBar&&(t.statusBar=!0),t.mainMenuBar=!1!==t.mainMenuBar,this.options=t,t.indentation?this.indentation=Number(t.indentation):this.indentation=2;var n=t.ace?t.ace:o;if(this.mode="code"==t.mode?"code":"text","code"==this.mode&&void 0===n&&(this.mode="text",console.warn("Failed to load Ace editor, falling back to plain text mode. Please use a JSONEditor bundle including Ace, or pass Ace as via the configuration option `ace`.")),this.theme=t.theme||"ace/theme/jsoneditor","ace/theme/jsoneditor"===this.theme&&n)try{i(30)}catch(e){console.error(e)}t.onTextSelectionChange&&this.onTextSelectionChange(t.onTextSelectionChange);var a=this;if(this.container=e,this.dom={},this.aceEditor=void 0,this.textarea=void 0,this.validateSchema=null,this.validationSequence=0,this.annotations=[],this.errorTableVisible=void 0,this._debouncedValidate=s.debounce(this.validate.bind(this),this.DEBOUNCE_INTERVAL),this.width=e.clientWidth,this.height=e.clientHeight,this.frame=document.createElement("div"),this.frame.className="jsoneditor jsoneditor-mode-"+this.options.mode,this.frame.onclick=function(e){e.preventDefault()},this.frame.onkeydown=function(e){a._onKeyDown(e)},this.content=document.createElement("div"),this.content.className="jsoneditor-outer",this.options.mainMenuBar){s.addClassName(this.content,"has-main-menu-bar"),this.menu=document.createElement("div"),this.menu.className="jsoneditor-menu",this.frame.appendChild(this.menu);var l=document.createElement("button");l.type="button",l.className="jsoneditor-format",l.title="Format JSON data, with proper indentation and line feeds (Ctrl+\\)",this.menu.appendChild(l),l.onclick=function(){try{a.format(),a._onChange()}catch(e){a._onError(e)}};var c=document.createElement("button");c.type="button",c.className="jsoneditor-compact",c.title="Compact JSON data, remove all whitespaces (Ctrl+Shift+\\)",this.menu.appendChild(c),c.onclick=function(){try{a.compact(),a._onChange()}catch(e){a._onError(e)}};var h=document.createElement("button");if(h.type="button",h.className="jsoneditor-repair",h.title="Repair JSON: fix quotes and escape characters, remove comments and JSONP notation, turn JavaScript objects into JSON.",this.menu.appendChild(h),h.onclick=function(){try{a.repair(),a._onChange()}catch(e){a._onError(e)}},this.options&&this.options.modes&&this.options.modes.length&&(this.modeSwitcher=new r(this.menu,this.options.modes,this.options.mode,function(e){a.setMode(e),a.modeSwitcher.focus()})),"code"==this.mode){var d=document.createElement("a");d.appendChild(document.createTextNode("powered by ace")),d.href="http://ace.ajax.org",d.target="_blank",d.className="jsoneditor-poweredBy",d.onclick=function(){window.open(d.href,d.target)},this.menu.appendChild(d)}}var u={},p=this.options.onEditable&&typeof("function"===this.options.onEditable)&&!this.options.onEditable(u);if(this.frame.appendChild(this.content),this.container.appendChild(this.frame),"code"==this.mode){this.editorDom=document.createElement("div"),this.editorDom.style.height="100%",this.editorDom.style.width="100%",this.content.appendChild(this.editorDom);var f=n.edit(this.editorDom),m=f.getSession();f.$blockScrolling=1/0,f.setTheme(this.theme),f.setOptions({readOnly:p}),f.setShowPrintMargin(!1),f.setFontSize(13),m.setMode("ace/mode/json"),m.setTabSize(this.indentation),m.setUseSoftTabs(!0),m.setUseWrapMode(!0);var g=m.setAnnotations;m.setAnnotations=function(e){g.call(this,e&&e.length?e:a.annotations)},f.commands.bindKey("Ctrl-L",null),f.commands.bindKey("Command-L",null),this.aceEditor=f,this.hasOwnProperty("editor")||Object.defineProperty(this,"editor",{get:function(){return console.warn('Property "editor" has been renamed to "aceEditor".'),a.aceEditor},set:function(e){console.warn('Property "editor" has been renamed to "aceEditor".'),a.aceEditor=e}}),f.on("change",this._onChange.bind(this)),f.on("changeSelection",this._onSelect.bind(this))}else{var v=document.createElement("textarea");v.className="jsoneditor-text",v.spellcheck=!1,this.content.appendChild(v),this.textarea=v,this.textarea.readOnly=p,null===this.textarea.oninput?this.textarea.oninput=this._onChange.bind(this):this.textarea.onchange=this._onChange.bind(this),v.onselect=this._onSelect.bind(this),v.onmousedown=this._onMouseDown.bind(this),v.onblur=this._onBlur.bind(this)}var y=document.createElement("div");y.className="jsoneditor-validation-errors-container",this.dom.validationErrorsContainer=y,this.frame.appendChild(y);var b=document.createElement("div");if(b.style.display="none",b.className="jsoneditor-additional-errors fadein",b.innerHTML="Scroll for more ▿",this.dom.additionalErrorsIndication=b,y.appendChild(b),t.statusBar){s.addClassName(this.content,"has-status-bar"),this.curserInfoElements={};var x=document.createElement("div");this.dom.statusBar=x,x.className="jsoneditor-statusbar",this.frame.appendChild(x);var w=document.createElement("span");w.className="jsoneditor-curserinfo-label",w.innerText="Ln:";var _=document.createElement("span");_.className="jsoneditor-curserinfo-val",_.innerText="1",x.appendChild(w),x.appendChild(_);var C=document.createElement("span");C.className="jsoneditor-curserinfo-label",C.innerText="Col:";var E=document.createElement("span");E.className="jsoneditor-curserinfo-val",E.innerText="1",x.appendChild(C),x.appendChild(E),this.curserInfoElements.colVal=E,this.curserInfoElements.lnVal=_;var S=document.createElement("span");S.className="jsoneditor-curserinfo-label",S.innerText="characters selected",S.style.display="none";var T=document.createElement("span");T.className="jsoneditor-curserinfo-count",T.innerText="0",T.style.display="none",this.curserInfoElements.countLabel=S,this.curserInfoElements.countVal=T,x.appendChild(T),x.appendChild(S);var k=document.createElement("span");k.className="jsoneditor-validation-error-icon",k.style.display="none";var N=document.createElement("span");N.className="jsoneditor-validation-error-count",N.style.display="none",this.validationErrorIndication={validationErrorIcon:k,validationErrorCount:N},x.appendChild(N),x.appendChild(k),this.parseErrorIndication=document.createElement("span"),this.parseErrorIndication.className="jsoneditor-parse-error-icon",this.parseErrorIndication.style.display="none",x.appendChild(this.parseErrorIndication)}this.setSchema(this.options.schema,this.options.schemaRefs)},a._onChange=function(){if(!this.onChangeDisabled){if(this._debouncedValidate(),this.options.onChange)try{this.options.onChange()}catch(e){console.error("Error in onChange callback: ",e)}if(this.options.onChangeText)try{this.options.onChangeText(this.getText())}catch(e){console.error("Error in onChangeText callback: ",e)}}},a._onSelect=function(){this._updateCursorInfo(),this._emitSelectionChange()},a._onKeyDown=function(e){var t=e.which||e.keyCode,i=!1;220==t&&e.ctrlKey&&(e.shiftKey?(this.compact(),this._onChange()):(this.format(),this._onChange()),i=!0),i&&(e.preventDefault(),e.stopPropagation()),this._updateCursorInfo(),this._emitSelectionChange()},a._onMouseDown=function(){this._updateCursorInfo(),this._emitSelectionChange()},a._onBlur=function(){var e=this;setTimeout(function(){e.isFocused||(e._updateCursorInfo(),e._emitSelectionChange()),e.isFocused=!1})},a._updateCursorInfo=function(){function e(){o.curserInfoElements.countVal.innerText!==n&&(o.curserInfoElements.countVal.innerText=n,o.curserInfoElements.countVal.style.display=n?"inline":"none",o.curserInfoElements.countLabel.style.display=n?"inline":"none"),o.curserInfoElements.lnVal.innerText=t,o.curserInfoElements.colVal.innerText=i}var t,i,n,o=this;if(this.textarea)setTimeout(function(){var r=s.getInputSelection(o.textarea);r.startIndex!==r.endIndex&&(n=r.endIndex-r.startIndex),n&&o.cursorInfo&&o.cursorInfo.line===r.end.row&&o.cursorInfo.column===r.end.column?(t=r.start.row,i=r.start.column):(t=r.end.row,i=r.end.column),o.cursorInfo={line:t,column:i,count:n},o.options.statusBar&&e()},0);else if(this.aceEditor&&this.curserInfoElements){var r=this.aceEditor.getCursorPosition(),a=this.aceEditor.getSelectedText();t=r.row+1,i=r.column+1,n=a.length,o.cursorInfo={line:t,column:i,count:n},this.options.statusBar&&e()}},a._emitSelectionChange=function(){if(this._selectionChangedHandler){var e=this.getTextSelection();this._selectionChangedHandler(e.start,e.end,e.text)}},a._refreshAnnotations=function(){var e=this.aceEditor&&this.aceEditor.getSession();if(e){var t=e.getAnnotations().filter(function(e){return"error"===e.type});e.setAnnotations(t)}},a.destroy=function(){this.aceEditor&&(this.aceEditor.destroy(),this.aceEditor=null),this.frame&&this.container&&this.frame.parentNode==this.container&&this.container.removeChild(this.frame),this.modeSwitcher&&(this.modeSwitcher.destroy(),this.modeSwitcher=null),this.textarea=null,this._debouncedValidate=null},a.compact=function(){var e=this.get(),t=JSON.stringify(e);this.setText(t)},a.format=function(){var e=this.get(),t=JSON.stringify(e,null,this.indentation);this.setText(t)},a.repair=function(){var e=this.getText(),t=s.sanitize(e);this.setText(t)},a.focus=function(){this.textarea&&this.textarea.focus(),this.aceEditor&&this.aceEditor.focus()},a.resize=function(){if(this.aceEditor){this.aceEditor.resize(!1)}},a.set=function(e){this.setText(JSON.stringify(e,null,this.indentation))},a.update=function(e){this.updateText(JSON.stringify(e,null,this.indentation))},a.get=function(){var e,t=this.getText();try{e=s.parse(t)}catch(i){t=s.sanitize(t),e=s.parse(t)}return e},a.getText=function(){return this.textarea?this.textarea.value:this.aceEditor?this.aceEditor.getValue():""},a.setText=function(e){var t;t=!0===this.options.escapeUnicode?s.escapeUnicodeChars(e):e,this.textarea&&(this.textarea.value=t),this.aceEditor&&(this.onChangeDisabled=!0,this.aceEditor.setValue(t,-1),this.onChangeDisabled=!1),this._debouncedValidate()},a.updateText=function(e){this.getText()!==e&&(this.onChangeDisabled=!0,this.setText(e),this.onChangeDisabled=!1)},a.validate=function(){var e,t=!1,i=[],n=[];try{e=this.get(),this.parseErrorIndication&&(this.parseErrorIndication.style.display="none"),t=!0}catch(e){if(this.getText()){this.parseErrorIndication&&(this.parseErrorIndication.style.display="block");var o,r=/\w*line\s*(\d+)\w*/g.exec(e.message);r&&(o=+r[1]),this.parseErrorIndication&&(this.parseErrorIndication.title=isNaN(o)?"parse error - check that the json is valid":"parse error on line "+o),n.push({type:"error",message:e.message.replace(/\n/g,"
    "),line:o})}}if(t){if(this.validateSchema){this.validateSchema(e)||(i=this.validateSchema.errors.map(function(e){return e.type="validation",s.improveSchemaError(e)}))}try{this.validationSequence++;var a=this,l=this.validationSequence;this._validateCustom(e).then(function(e){if(l===a.validationSequence){var t=i.concat(n||[]).concat(e||[]);a._renderErrors(t)}}).catch(function(e){console.error(e)})}catch(e){console.error(e)}}else this._renderErrors(n||[],!0)},a._validateCustom=function(e){if(this.options.onValidate)try{var t=this.options.onValidate(e);return(s.isPromise(t)?t:Promise.resolve(t)).then(function(e){return Array.isArray(e)?e.filter(function(e){var t=s.isValidValidationError(e);return t||console.warn('Ignoring a custom validation error with invalid structure. Expected structure: {path: [...], message: "..."}. Actual error:',e),t}).map(function(e){return{dataPath:s.stringifyPath(e.path),message:e.message}}):null})}catch(e){return Promise.reject(e)}return Promise.resolve(null)},a._renderErrors=function(e,t){var i=this,n=0;this.errorTableVisible=void 0===this.errorTableVisible?!this.aceEditor:this.errorTableVisible,this.dom.validationErrors&&(this.dom.validationErrors.parentNode.removeChild(this.dom.validationErrors),this.dom.validationErrors=null,this.dom.additionalErrorsIndication.style.display="none",this.content.style.marginBottom="",this.content.style.paddingBottom="");var o=this.getText(),r=[];e.reduce(function(e,t){return-1===e.indexOf(t.dataPath)&&e.push(t.dataPath),e},r);var a=s.getPositionForPath(o,r);if(e.length>0)if(this.aceEditor&&(this.annotations=a.map(function(t){var i=e.filter(function(e){return e.dataPath===t.path}),n=i.map(function(e){return e.message}).join("\n");return n?{row:t.line,column:t.column,text:"Schema validation error"+(1!==i.length?"s":"")+": \n"+n,type:"warning",source:"jsoneditor"}:{}}),this._refreshAnnotations()),t?!this.aceEditor:this.errorTableVisible){var l=document.createElement("div");l.innerHTML='
    ';var c=l.getElementsByTagName("tbody")[0];e.forEach(function(e){var t;t="string"==typeof e?'
    '+e+"
    ":""+(e.dataPath||"")+""+e.message+"";var o;if(isNaN(e.line)){if(e.dataPath){var r=a.find(function(t){return t.path===e.dataPath});r&&(o=r.line+1)}}else o=e.line;var s=document.createElement("tr");s.className=isNaN(o)?"":"jump-to-line","error"===e.type?s.className+=" parse-error":(s.className+=" validation-error",++n),s.innerHTML=''+(isNaN(o)?"":"Ln "+o)+""+t,s.onclick=function(){i.isFocused=!0,isNaN(o)||i.setTextSelection({row:o,column:1},{row:o,column:1e3})},c.appendChild(s)}),this.dom.validationErrors=l,this.dom.validationErrorsContainer.appendChild(l),this.dom.additionalErrorsIndication.title=e.length+" errors total",this.dom.validationErrorsContainer.clientHeight0&&0===i.dom.validationErrorsContainer.scrollTop?"block":"none"}):this.dom.validationErrorsContainer.onscroll=void 0;var h=this.dom.validationErrorsContainer.clientHeight+(this.dom.statusBar?this.dom.statusBar.clientHeight:0);this.content.style.marginBottom=-h+"px",this.content.style.paddingBottom=h+"px"}else n=e.reduce(function(e,t){return"validation"===t.type?++e:e},0);else this.aceEditor&&(this.annotations=[],this._refreshAnnotations());if(this.options.statusBar){n=n||this.annotations.length;var d=!!n;this.validationErrorIndication.validationErrorIcon.style.display=d?"inline":"none",this.validationErrorIndication.validationErrorCount.style.display=d?"inline":"none",d&&(this.validationErrorIndication.validationErrorCount.innerText=n,this.validationErrorIndication.validationErrorIcon.title=n+" schema validation error(s) found",this.validationErrorIndication.validationErrorCount.onclick=this.validationErrorIndication.validationErrorIcon.onclick=this._toggleErrorTableVisibility.bind(this))}if(this.aceEditor){this.aceEditor.resize(!1)}},a._toggleErrorTableVisibility=function(){this.errorTableVisible=!this.errorTableVisible,this.validate()},a.getTextSelection=function(){var e={};if(this.textarea){var t=s.getInputSelection(this.textarea);return this.cursorInfo&&this.cursorInfo.line===t.end.row&&this.cursorInfo.column===t.end.column?(e.start=t.end,e.end=t.start):e=t,{start:e.start,end:e.end,text:this.textarea.value.substring(t.startIndex,t.endIndex)}}if(this.aceEditor){var i=this.aceEditor.getSelection(),n=this.aceEditor.getSelectedText(),o=i.getRange(),r=i.getSelectionLead();return r.row===o.end.row&&r.column===o.end.column?e=o:(e.start=o.end,e.end=o.start),{start:{row:e.start.row+1,column:e.start.column+1},end:{row:e.end.row+1,column:e.end.column+1},text:n}}},a.onTextSelectionChange=function(e){"function"==typeof e&&(this._selectionChangedHandler=s.debounce(e,this.DEBOUNCE_INTERVAL))},a.setTextSelection=function(e,t){if(e&&t)if(this.textarea){var i=s.getIndexForPosition(this.textarea,e.row,e.column),n=s.getIndexForPosition(this.textarea,t.row,t.column);if(i>-1&&n>-1){if(this.textarea.setSelectionRange)this.textarea.focus(),this.textarea.setSelectionRange(i,n);else if(this.textarea.createTextRange){var o=this.textarea.createTextRange();o.collapse(!0),o.moveEnd("character",n),o.moveStart("character",i),o.select()}var r=(this.textarea.value.match(/\n/g)||[]).length+1,a=this.textarea.scrollHeight/r,l=e.row*a;this.textarea.scrollTop=l>this.textarea.clientHeight?l-this.textarea.clientHeight/2:0}}else if(this.aceEditor){var o={start:{row:e.row-1,column:e.column-1},end:{row:t.row-1,column:t.column-1}};this.aceEditor.selection.setRange(o),this.aceEditor.scrollToLine(e.row-1,!0)}},e.exports=[{mode:"text",mixin:a,data:"text",load:n},{mode:"code",mixin:a,data:"text",load:n}]},function(e,t){ace.define("ace/theme/jsoneditor",["require","exports","module","ace/lib/dom"],function(e,t,i){t.isDark=!1,t.cssClass="ace-jsoneditor",t.cssText='.ace-jsoneditor .ace_gutter {\tbackground: #ebebeb;\tcolor: #333\t}\t\t.ace-jsoneditor.ace_editor {\tfont-family: "dejavu sans mono", "droid sans mono", consolas, monaco, "lucida console", "courier new", courier, monospace, sans-serif;\tline-height: 1.3;\tbackground-color: #fff;\t}\t.ace-jsoneditor .ace_print-margin {\twidth: 1px;\tbackground: #e8e8e8\t}\t.ace-jsoneditor .ace_scroller {\tbackground-color: #FFFFFF\t}\t.ace-jsoneditor .ace_text-layer {\tcolor: gray\t}\t.ace-jsoneditor .ace_variable {\tcolor: #1a1a1a\t}\t.ace-jsoneditor .ace_cursor {\tborder-left: 2px solid #000000\t}\t.ace-jsoneditor .ace_overwrite-cursors .ace_cursor {\tborder-left: 0px;\tborder-bottom: 1px solid #000000\t}\t.ace-jsoneditor .ace_marker-layer .ace_selection {\tbackground: lightgray\t}\t.ace-jsoneditor.ace_multiselect .ace_selection.ace_start {\tbox-shadow: 0 0 3px 0px #FFFFFF;\tborder-radius: 2px\t}\t.ace-jsoneditor .ace_marker-layer .ace_step {\tbackground: rgb(255, 255, 0)\t}\t.ace-jsoneditor .ace_marker-layer .ace_bracket {\tmargin: -1px 0 0 -1px;\tborder: 1px solid #BFBFBF\t}\t.ace-jsoneditor .ace_marker-layer .ace_active-line {\tbackground: #FFFBD1\t}\t.ace-jsoneditor .ace_gutter-active-line {\tbackground-color : #dcdcdc\t}\t.ace-jsoneditor .ace_marker-layer .ace_selected-word {\tborder: 1px solid lightgray\t}\t.ace-jsoneditor .ace_invisible {\tcolor: #BFBFBF\t}\t.ace-jsoneditor .ace_keyword,\t.ace-jsoneditor .ace_meta,\t.ace-jsoneditor .ace_support.ace_constant.ace_property-value {\tcolor: #AF956F\t}\t.ace-jsoneditor .ace_keyword.ace_operator {\tcolor: #484848\t}\t.ace-jsoneditor .ace_keyword.ace_other.ace_unit {\tcolor: #96DC5F\t}\t.ace-jsoneditor .ace_constant.ace_language {\tcolor: darkorange\t}\t.ace-jsoneditor .ace_constant.ace_numeric {\tcolor: red\t}\t.ace-jsoneditor .ace_constant.ace_character.ace_entity {\tcolor: #BF78CC\t}\t.ace-jsoneditor .ace_invalid {\tcolor: #FFFFFF;\tbackground-color: #FF002A;\t}\t.ace-jsoneditor .ace_fold {\tbackground-color: #AF956F;\tborder-color: #000000\t}\t.ace-jsoneditor .ace_storage,\t.ace-jsoneditor .ace_support.ace_class,\t.ace-jsoneditor .ace_support.ace_function,\t.ace-jsoneditor .ace_support.ace_other,\t.ace-jsoneditor .ace_support.ace_type {\tcolor: #C52727\t}\t.ace-jsoneditor .ace_string {\tcolor: green\t}\t.ace-jsoneditor .ace_comment {\tcolor: #BCC8BA\t}\t.ace-jsoneditor .ace_entity.ace_name.ace_tag,\t.ace-jsoneditor .ace_entity.ace_other.ace_attribute-name {\tcolor: #606060\t}\t.ace-jsoneditor .ace_markup.ace_underline {\ttext-decoration: underline\t}\t.ace-jsoneditor .ace_indent-guide {\tbackground: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y\t}',e("../lib/dom").importCssString(t.cssText,t.cssClass)})}])}); //# sourceMappingURL=jsoneditor-minimalist.map