!function(e,t){"object"==typeofexports&&"object"==typeofmodule?module.exports=t():"function"==typeofdefine&&define.amd?define([],t):"object"==typeofexports?exports.JSONEditor=t():e.JSONEditor=t()}(window,function(){returnn={},o.m=i=[function(e,t,i){"use strict";i(6);varo,n=["en","pt-BR","zh-CN","tr"],r={en:{array:"Array",auto:"Auto",appendText:"Append",appendTitle:"Append a new field with type 'auto' after this field (Ctrl+Shift+Ins)",appendSubmenuTitle:"Select the type of the field to be appended",appendTitleAuto:"Append a new field with type 'auto' (Ctrl+Shift+Ins)",ascending:"Ascending",ascendingTitle:"Sort the childs of this ${type} in ascending order",actionsMenu:"Click to open the actions menu (Ctrl+M)",collapseAll:"Collapse all fields",descending:"Descending",descendingTitle:"Sort the childs of this ${type} in descending order",drag:"Drag to move this field (Alt+Shift+Arrows)",duplicateKey:"duplicate key",duplicateText:"Duplicate",duplicateTitle:"Duplicate selected fields (Ctrl+D)",duplicateField:"Duplicate this field (Ctrl+D)",duplicateFieldError:"Duplicate field name",cannotParseFieldError:"Cannot parse field into JSON",cannotParseValueError:"Cannot parse value into JSON",empty:"empty",expandAll:"Expand all fields",expandTitle:"Click to expand/collapse this field (Ctrl+E). \nCtrl+Click to expand/collapse including all childs.",insert:"Insert",insertTitle:"Insert a new field with type 'auto' before this field (Ctrl+Ins)",insertSub:"Select the type of the field to be inserted",object:"Object",ok:"Ok",redo:"Redo (Ctrl+Shift+Z)",removeText:"Remove",removeTitle:"Remove selected fields (Ctrl+Del)",removeField:"Remove this field (Ctrl+Del)",selectNode:"Select a node...",showAll:"show all",showMore:"show more",showMoreStatus:"displaying ${visibleChilds} of ${totalChilds} items.",sort:"Sort",sortTitle:"Sort the childs of this ${type}",sortTitleShort:"Sort contents",sortFieldLabel:"Field:",sortDirectionLabel:"Direction:",sortFieldTitle:"Select the nested field by which to sort the array or object",sortAscending:"Ascending",sortAscendingTitle:"Sort the selected field in ascending order",sortDescending:"Descending",sortDescendingTitle:"Sort the selected field in descending order",string:"String",transform:"Transform",transformTitle:"Filter, sort, or transform the childs of this ${type}",transformTitleShort:"Filter, sort, or transform contents",extract:"Extract",extractTitle:"Extract this ${type}",transformQueryTitle:"Enter a JMESPath query",transformWizardLabel:"Wizard",transformWizardFilter:"Filter",transformWizardSortBy:"Sort by",transformWizardSelectFields:"Select fields",transformQueryLabel:"Query",transformPreviewLabel:"Preview",type:"Type",typeTitle:"Change the type of this field",openUrl:"Ctrl+Click or Ctrl+Enter to open url in new window",undo:"Undo last action (Ctrl+Z)",validationCannotMove:"Cannot move a field into a child of itself",autoType:'Field type "auto". The field type is automatically determined from the value and can be a string, number, boolean, or null.',objectType:'Field type "object". An object contains an unordered set of key/value pairs.',arrayType:'Field type "array". An array contains an ordered collection of values.',stringType:'Field type "string". Field type is not determined from the value, but always returned as string.',modeCodeText:"Code",modeCodeTitle:"Switch to code highlighter",modeFormText:"Form",modeFormTitle:"Switch to form editor",modeTextText:"Text",modeTextTitle:"Switch to plain text editor",modeTreeText:"Tree",modeTreeTitle:"Switch to tree editor",modeViewText:"View",modeViewTitle:"Switch to tree view",examples:"Examples",default:"Default"},"zh-CN":{array:"数组",auto:"自动",appendText:"追加",appendTitle:"在此字段后追加一个类型为“auto”的新字段 (Ctrl+Shift+Ins)",appendSubmenuTitle:"选择要追加的字段类型",appendTitleAuto:"追加类型为“auto”的新字段 (Ctrl+Shift+Ins)",ascending:"升序",ascendingTitle:"升序排列${type}的子节点",actionsMenu:"点击打开动作菜单(Ctrl+M)",collapseAll:"缩进所有字段",descending:"降序"
)thrownewError("Node not found");e.setParent(this),e.fieldEditable="object"==this.type,this.childs.splice(i,0,e)}if(this.expanded){varn=e.getDom(),o=t.getDom(),r=o?o.parentNode:void0;o&&r&&r.insertBefore(n,o),e.showChilds(),this.showChilds()}this.updateDom({updateIndexes:!0}),e.updateDom({recurse:!0})}},D.prototype.insertAfter=function(e,t){if(this._hasChilds()){vari=this.childs.indexOf(t),n=this.childs[i+1];n?this.insertBefore(e,n):this.appendChild(e)}},D.prototype.search=function(t,i){Array.isArray(i)||(i=[]);vare=t?t.toLowerCase():void0;deletethis.searchField,deletethis.searchValue,void0!==this.field&&i.length<=this.MAX_SEARCH_RESULTS&&(-1!==String(this.field).toLowerCase().indexOf(e)&&(this.searchField=!0,i.push({node:this,elem:"field"})),this._updateDomField());this._hasChilds()?this.childs&&this.childs.forEach(function(e){e.search(t,i)}):void0!==this.value&&i.length<=this.MAX_SEARCH_RESULTS&&(-1!==String(this.value).toLowerCase().indexOf(e)&&(this.searchValue=!0,i.push({node:this,elem:"value"})),this._updateDomValue());returni},D.prototype.scrollTo=function(e){this.expandPathToNode(),this.dom.tr&&this.dom.tr.parentNode&&this.editor.scrollTo(this.dom.tr.offsetTop,e)},D.prototype.expandPathToNode=function(){for(vare=this;e&&e.parent;){for(vart="array"===e.parent.type?e.index:e.parent.childs.indexOf(e);e.parent.visibleChilds<t+1;)e.parent.visibleChilds+=this.getMaxVisibleChilds();e.parent.expand(!1),e=e.parent}},D.focusElement=void0,D.prototype.focus=function(e){if(D.focusElement=e,this.dom.tr&&this.dom.tr.parentNode){vart=this.dom;switch(e){case"drag":t.drag?t.drag.focus():t.menu.focus();break;case"menu":t.menu.focus();break;case"expand":this._hasChilds()?t.expand.focus():t.field&&this.fieldEditable?(t.field.focus(),A.selectContentEditable(t.field)):t.value&&!this._hasChilds()?(t.value.focus(),A.selectContentEditable(t.value)):t.menu.focus();break;case"field":t.field&&this.fieldEditable?(t.field.focus(),A.selectContentEditable(t.field)):t.value&&!this._hasChilds()?(t.value.focus(),A.selectContentEditable(t.value)):this._hasChilds()?t.expand.focus():t.menu.focus();break;case"value":default:t.select?t.select.focus():t.value&&!this._hasChilds()?(t.value.focus(),A.selectContentEditable(t.value)):t.field&&this.fieldEditable?(t.field.focus(),A.selectContentEditable(t.field)):this._hasChilds()?t.expand.focus():t.menu.focus()}}},D.select=function(e){setTimeout(function(){A.selectContentEditable(e)},0)},D.prototype.containsNode=function(e){if(this==e)return!0;vart=this.childs;if(t)for(vari=0,n=t.length;i<n;i++)if(t[i].containsNode(e))return!0;return!1},D.prototype.removeChild=function(e,t){if(this.childs){vari=this.childs.indexOf(e);if(-1!==i){i<this.visibleChilds&&this.expanded&&this.visibleChilds--,e.hide(),deletee.searchField,deletee.searchValue;varn=this.childs.splice(i,1)[0];returnn.parent=null,!1!==t&&this.updateDom({updateIndexes:!0}),n}}},D.prototype._remove=function(e){this.removeChild(e)},D.prototype.changeType=function(e){vart=this.type;if(t!=e){if("string"!=e&&"auto"!=e||"string"!=t&&"auto"!=t){vari=this._detachFromDom();this.clearDom(),"object"==(this.type=e)?(this.childs||(this.childs=[]),this.childs.forEach(function(e){e.clearDom(),deletee.index,e.fieldEditable=!0,null==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,this._attachToDom(i)}elsethis.type=e;"auto"!=e&&"string"!=e||(this.value="string"==e?String(this.value):A.parseString(String(this.value)),this.focus()),this.updateDom({updateIndexes:!0})}},D.prototype.deepEqual=function(e){vart;if("array"===this.type){if(!Array.isArray(e))return!1;if(this.childs.length!==e.length)return!1;for(t=0;t<this.childs.length;t++)if(!this.childs[t].deepEqual(e[t]))return!1}elseif("object"===this.type){if("object"!=typeofe||!e)return!1;vari={},n=0;for(t=0;t<this.childs.length;t++){varo=this.childs[t];if(!i[o.field]){if(i[o.field]=!0,n++,!(o.fiel
this.opened&&!this.el.multiple&&this.close())},d.prototype.select=function(n){vare=this.items[n],t=[].slice.call(this.el.options),i=this.options[n];if(this.el.multiple){if(l.includes(this.selectedIndexes,n))return!1;if(this.config.maxSelections&&this.tags.length===this.config.maxSelections)returnthis.setMessage("A maximum of "+this.config.maxSelections+" items can be selected.",!0),!1;this.selectedValues.push(i.value),this.selectedIndexes.push(n),function(e){varc,h=this,i=document.createDocumentFragment(),t=this.options[e.idx],n=this.data?this.data[e.idx]:t,o=this.customSelected?this.config.renderSelection(n):t.textContent,r=l.createElement("li",{class:"selectr-tag",html:o}),s=l.createElement("button",{class:"selectr-tag-remove",type:"button"});if(r.appendChild(s),r.idx=e.idx,r.tag=t.value,this.tags.push(r),this.config.sortSelected){vara=this.tags.slice();c=function(e,n){e.replace(/(\d+)|(\D+)/g,function(e,t,i){n.push([t||1/0,i||""])})},a.sort(function(e,t){vari,n,o=[],r=[];for(!0===h.config.sortSelected?(i=e.tag,n=t.tag):"text"===h.config.sortSelected&&(i=e.textContent,n=t.textContent),c(i,o),c(n,r);o.length&&r.length;){vars=o.shift(),a=r.shift(),l=s[0]-a[0]||s[1].localeCompare(a[1]);if(l)returnl}returno.length-r.length}),l.each(a,function(e,t){i.appendChild(t)}),this.label.innerHTML=""}elsei.appendChild(r);this.config.taggable?this.label.insertBefore(i,this.input.parentNode):this.label.appendChild(i)}.call(this,e)}else{varo=this.data?this.data[n]:i;this.label.innerHTML=this.customSelected?this.config.renderSelection(o):i.textContent,this.selectedValue=i.value,this.selectedIndex=n,l.each(this.options,function(e,t){vari=this.items[e];e!==n&&(i&&l.removeClass(i,"selected"),t.selected=!1,t.removeAttribute("selected"))},this)}l.includes(t,i)||this.el.add(i),e.setAttribute("aria-selected",!0),l.addClass(e,"selected"),l.addClass(this.container,"has-selected"),i.selected=!0,i.setAttribute("selected",""),this.emit("selectr.change",i),this.emit("selectr.select",i)},d.prototype.deselect=function(e,t){vari=this.items[e],n=this.options[e];if(this.el.multiple){varo=this.selectedIndexes.indexOf(e);this.selectedIndexes.splice(o,1);varr=this.selectedValues.indexOf(n.value);this.selectedValues.splice(r,1),function(i){varn=!1;l.each(this.tags,function(e,t){t.idx===i.idx&&(n=t)},this),n&&(this.label.removeChild(n),this.tags.splice(this.tags.indexOf(n),1))}.call(this,i),this.tags.length||l.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,l.removeClass(this.container,"has-selected")}this.items[e].setAttribute("aria-selected",!1),l.removeClass(this.items[e],"selected"),n.selected=!1,n.removeAttribute("selected"),this.emit("selectr.change",null),this.emit("selectr.deselect",n)},d.prototype.setValue=function(i){varn=Array.isArray(i);if(n||(i=i.toString().trim()),!this.el.multiple&&n)return!1;l.each(this.options,function(e,t){(n&&l.includes(i.toString(),t.value)||t.value===i)&&this.change(t.idx)},this)},d.prototype.getValue=function(e,t){varn;if(this.el.multiple)e?this.selectedIndexes.length&&(n={values:[]},l.each(this.selectedIndexes,function(e,t){vari=this.options[t];n.values[e]={value:i.value,text:i.textContent}},this)):n=this.selectedValues.slice();elseif(e){vari=this.options[this.selectedIndex];n={value:i.value,text:i.textContent}}elsen=this.selectedValue;returne&&t&&(n=JSON.stringify(n)),n},d.prototype.add=function(i,n){if(i){if(this.data=this.data||[],this.items=this.items||[],this.options=this.options||[],Array.isArray(i))l.each(i,function(e,t){this.add(t,n)},this);elseif("[object Object]"===Object.prototype.toString.call(i)){if(n){varo=!1;if(l.each(this.options,function(e,t){t.value.toLowerCase()===i.value.toLowerCase()&&(o=!0)}),o)return!1}vare=l.createElement("option",i);returnthis.data.push(i),this.options.push(e),e.idx=0<this.options.length?this.options.length-1:0,h.call(this,e),i.selected&&this.select(e.idx),e}returnthis.setPlaceholder(),this.confi