!function(e,t){"object"==typeofexports&&"object"==typeofmodule?module.exports=t():"function"==typeofdefine&&define.amd?define(t):"object"==typeofexports?exports.JSONEditor=t():e.JSONEditor=t()}(this,function(){returnfunction(e){functiont(n){if(i[n])returni[n].exports;varo=i[n]={exports:{},id:n,loaded:!1};returne[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}vari={};returnt.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){varn,o;n=[i(1),i(2),i(3)],o=function(e,t,i){functionn(e,t,o){if(!(thisinstanceofn))thrownewError('JSONEditor constructor called without "new".');vars=i.getInternetExplorerVersion();if(-1!=s&&9>s)thrownewError("Unsupported browser, IE9 or newer required. Please install the newest version of your browser.");arguments.length&&this._create(e,t,o)}returnn.modes={},n.prototype._create=function(e,t,i){this.container=e,this.options=t||{},this.json=i||{};varn=this.options.mode||"tree";this.setMode(n)},n.prototype._delete=function(){},n.prototype.set=function(e){this.json=e},n.prototype.get=function(){returnthis.json},n.prototype.setText=function(e){this.json=i.parse(e)},n.prototype.getText=function(){returnJSON.stringify(this.json)},n.prototype.setName=function(e){this.options||(this.options={}),this.options.name=e},n.prototype.getName=function(){returnthis.options&&this.options.name},n.prototype.setMode=function(e){vart,o,s=this.container,r=i.extend({},this.options);r.mode=e;vara=n.modes[e];if(!a)thrownewError('Unknown mode "'+r.mode+'"');try{vard="text"==a.data;if(o=this.getName(),t=this[d?"getText":"get"](),this._delete(),i.clear(this),i.extend(this,a.mixin),this.create(s,r),this.setName(o),this[d?"setText":"set"](t),"function"==typeofa.load)try{a.load.call(this)}catch(l){}}catch(l){this._onError(l)}},n.prototype._onError=function(e){if("function"==typeofthis.onError&&(i.log("WARNING: JSONEditor.onError is deprecated. Use options.error instead."),this.onError(e)),!this.options||"function"!=typeofthis.options.error)throwe;this.options.error(e)},n.registerMode=function(e){vart,o;if(i.isArray(e))for(t=0;t<e.length;t++)n.registerMode(e[t]);else{if(!("mode"ine))thrownewError('Property "mode" missing');if(!("mixin"ine))thrownewError('Property "mixin" missing');if(!("data"ine))thrownewError('Property "data" missing');vars=e.mode;if(sinn.modes)thrownewError('Mode "'+s+'" already registered');if("function"!=typeofe.mixin.create)thrownewError('Required function "create" missing on mixin');varr=["setMode","registerMode","modes"];for(t=0;t<r.length;t++)if(o=r[t],oine.mixin)thrownewError('Reserved property "'+o+'" not allowed in mixin');n.modes[s]=e}},n.registerMode(e),n.registerMode(t),n}.apply(null,n),!(void0!==o&&(e.exports=o))},function(e,t,i){varn,o;n=[i(4),i(5),i(6),i(7),i(8),i(3)],o=function(e,t,i,n,o,s){varr={};r.create=function(i,n){if(!i)thrownewError("No container element provided.");this.container=i,this.dom={},this.highlighter=newe,this.selection=void0,this._setOptions(n),this.options.history&&!this.mode.view&&(this.history=newt(this)),this._createFrame(),this._createTable()},r._delete=function(){this.frame&&this.container&&this.frame.parentNode==this.container&&this.container.removeChild(this.frame)},r._setOptions=function(e){if(this.options={search:!0,history:!0,mode:"tree",name:void0},e)for(vartine)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.mode={edit:"view"!=this.options.mode&&"form"!=this.options.mode,view:"view"==this.options.mode,form:"form"==this.options.mode}};vara=void0,d=null;returnr.set=function(e,t){if(t&&(s.log('Warning: second parameter "name" is deprecated. Use setName(name) instead.'),this.options.name=t),einstanceofFunction||void0===e)this.clear();else{this.content.removeChild(this.table);vari={field:this.options.name,value:e},o=newn(this,i);this._setRoot(o);varr=!1;this.node.expand(r),this.content.appendChild(this.table)}this.history&&this.history.clear()},r.get=function(){returna&&a.blur(),this.node?this.node.getValue():void0},r.getText=function(){returnJSON.stringify(this.get())},r.setText=function(e){t
returnthis.updateDom({updateIndexes:!0}),i}}returnvoid0},n.prototype._remove=function(e){this.removeChild(e)},n.prototype.changeType=function(e){vart=this.type;if(t!=e){if("string"!=e&&"auto"!=e||"string"!=t&&"auto"!=t){vari,n=this.dom.tr?this.dom.tr.parentNode:void0;i=this.expanded?this.getAppend():this.getDom();varo=i&&i.parentNode?i.nextSibling:void0;this.hide(),this.clearDom(),this.type=e,"object"==e?(this.childs||(this.childs=[]),this.childs.forEach(function(e){e.clearDom(),deletee.index,e.fieldEditable=!0,void0==e.field&&(e.field="")}),("string"==t||"auto"==t)&&(this.expanded=!0)):"array"==e?(this.childs||(this.childs=[]),this.childs.forEach(function(e,t){e.clearDom(),e.fieldEditable=!1,e.index=t}),("string"==t||"auto"==t)&&(this.expanded=!0)):this.expanded=!1,n&&(o?n.insertBefore(this.getDom(),o):n.appendChild(this.getDom())),this.showChilds()}elsethis.type=e;("auto"==e||"string"==e)&&(this.value="string"==e?String(this.value):this._stringCast(String(this.value)),this.focus()),this.updateDom({updateIndexes:!0})}},n.prototype._getDomValue=function(e){if(this.dom.value&&"array"!=this.type&&"object"!=this.type&&(this.valueInnerText=i.getInnerText(this.dom.value)),void0!=this.valueInnerText)try{vart;if("string"==this.type)t=this._unescapeHTML(this.valueInnerText);else{varn=this._unescapeHTML(this.valueInnerText);t=this._stringCast(n)}if(t!==this.value){varo=this.value;this.value=t,this.editor._onAction("editValue",{node:this,oldValue:o,newValue:t,oldSelection:this.editor.selection,newSelection:this.editor.getSelection()})}}catch(s){if(this.value=void0,1!=e)throws}},n.prototype._updateDomValue=function(){vare=this.dom.value;if(e){vart=this.value,n="auto"==this.type?i.type(t):this.type,o="string"==n&&i.isUrl(t),s="";s=o&&!this.editor.mode.edit?"":"string"==n?"green":"number"==n?"red":"boolean"==n?"darkorange":this._hasChilds()?"":null===t?"#004ED0":"black",e.style.color=s;varr=""==String(this.value)&&"array"!=this.type&&"object"!=this.type;if(r?i.addClassName(e,"empty"):i.removeClassName(e,"empty"),o?i.addClassName(e,"url"):i.removeClassName(e,"url"),"array"==n||"object"==n){vara=this.childs?this.childs.length:0;e.title=this.type+" containing "+a+" items"}else"string"==n&&i.isUrl(t)?this.editor.mode.edit&&(e.title="Ctrl+Click or Ctrl+Enter to open url in new window"):e.title="";this.searchValueActive?i.addClassName(e,"highlight-active"):i.removeClassName(e,"highlight-active"),this.searchValue?i.addClassName(e,"highlight"):i.removeClassName(e,"highlight"),i.stripFormatting(e)}},n.prototype._updateDomField=function(){vare=this.dom.field;if(e){vart=""==String(this.field)&&"array"!=this.parent.type;t?i.addClassName(e,"empty"):i.removeClassName(e,"empty"),this.searchFieldActive?i.addClassName(e,"highlight-active"):i.removeClassName(e,"highlight-active"),this.searchField?i.addClassName(e,"highlight"):i.removeClassName(e,"highlight"),i.stripFormatting(e)}},n.prototype._getDomField=function(e){if(this.dom.field&&this.fieldEditable&&(this.fieldInnerText=i.getInnerText(this.dom.field)),void0!=this.fieldInnerText)try{vart=this._unescapeHTML(this.fieldInnerText);if(t!==this.field){varn=this.field;this.field=t,this.editor._onAction("editField",{node:this,oldValue:n,newValue:t,oldSelection:this.editor.selection,newSelection:this.editor.getSelection()})}}catch(o){if(this.field=void0,1!=e)throwo}},n.prototype.clearDom=function(){this.dom={}},n.prototype.getDom=function(){vare=this.dom;if(e.tr)returne.tr;if(e.tr=document.createElement("tr"),e.tr.node=this,this.editor.mode.edit){vart=document.createElement("td");if(this.parent){vari=document.createElement("button");e.drag=i,i.className="dragarea",i.title="Drag to move this field (Alt+Shift+Arrows)",t.appendChild(i)}e.tr.appendChild(t);varn=document.createElement("td"),o=document.createElement("button");e.menu=o,o.className="contextmenu",o.title="Click to open the actions menu (Ctrl+M)",n.appendChild(e.menu),e.tr.appendChild(n)}vars=document.createElement("td");returne.tr.appendChild(s),e.tree=this._createDomTree(),s.appendChild(e.tree),this.updateDom({