UNPKG

@pardnchiu/nanojson

Version:

NanoJSON is a lightweight JSON editing library built on pure JavaScript and native APIs. Can be easily embedded into websites.

2 lines (1 loc) 15.9 kB
!function(){const t=window,e=document,i=String,s=Number,n=Boolean,l=Array,r=Object,o=(DocumentFragment,Blob),h=URL,a=Math,c=Date,d=setTimeout,f=JSON,u=confirm,p=parseFloat,v=isNaN,w=FileReader,y=File,g=fetch,m=Promise,b=/\.([\w_-]+)?/gi,C=/\#([\w_-]+)?/i,A=/^\w+(?=[\#\.]*)/i,k="then",x="click",j="parse",H="true",z="false",F="add",M="appendChild",V="class",$="section",S="key",O="stringify",N="label",L="target",T="color",B="fill",D="insert",E="collapseable",R="createDocumentFragment",U="contentEditable",J="replaceChildren",I="toLowerCase",P="beforeRender",q="beforeUpdate",_="beforeDestroy",G="rendered",K="updated",Y="button",Q="destroyed",W="type",X="script",Z="createTextNode",tt="console",et="onchange",it="oninput",st="body",nt="apply",lt="src",rt="void",ot="title",ht="error",at="now",ct="render",dt="remove",ft="dataset",ut="display",pt="float",vt="dom",wt="input",yt="textarea",gt="height",mt="img",bt="parent",Ct="onclick",At="inner",kt="isArray",xt="length",jt="map",Ht="match",zt="number",Ft="object",Mt="replace",Vt="keys",$t="placeholder",St="source",Ot="style",Nt="string",Lt="selected",Tt="checked",Bt="background",Dt="option",Et="temp",Rt="test",Ut="textContent",Jt="trim",It="update",Pt="value",qt="width",_t="collapsed",Gt="array",Kt="boolean",Yt="reset",Qt="import",Wt="export",Xt="children",Zt="push",te="editor",ee="getElementById",ie="nextElementSibling",se="link",ne="rel",le="href",re="as",oe="backgroundColor",he=V+"List",ae="createElement",ce="hasOwnProperty",de=At+"HTML",fe=At+"Text",ue="setAttribute",pe=[Nt,zt,Kt,Gt,Ft],ve="https://cdn.jsdelivr.net/npm/@pardnchiu/nanojson@0.3.4/dist/NanoJSON.css",we="NanoJSON\nGitHub: https://github.com/pardnchiu/NanoJSON\nCreator: Pardn Chiu\nLicense: Proprietary",ye={[P]:P,[q]:q,[_]:_,[G]:G,[K]:K,[Q]:Q};for(let t of[Ae(se,{[ne]:"preconnect",[le]:"https://cdn.jsdelivr.net"}),Ae(se,{[ne]:"preload",[le]:ve,[re]:Ot}),Ae(se,{[ne]:"stylesheet",[le]:ve})])e.head[M](t);document.addEventListener("DOMContentLoaded",(t=>{ze("%c"+we,"line-height: 1.75rem; font-size: 0.875rem;")}));const ge={number:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5.5 15v-4.5H4V9h3v6H5.5zM9 15v-2.5c0-.283.096-.52.287-.713A.967.967 0 0110 11.5h2v-1H9V9h3.5c.283 0 .52.096.713.287.191.192.287.43.287.713v1.5c0 .283-.096.52-.287.713a.968.968 0 01-.713.287h-2v1h3V15H9zm6 0v-1.5h3v-1h-2v-1h2v-1h-3V9h3.5c.283 0 .52.096.712.287.192.192.288.43.288.713v4c0 .283-.096.52-.288.713A.968.968 0 0118.5 15H15z" fill="#5F6368"/></svg>',string:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17 15a.968.968 0 01-.712-.287A.968.968 0 0116 14v-4c0-.283.096-.52.288-.713A.968.968 0 0117 9h3c.283 0 .52.096.712.287.192.192.288.43.288.713v1h-1.5v-.5h-2v3h2V13H21v1c0 .283-.096.52-.288.713A.968.968 0 0120 15h-3zm-7.5 0V9h4c.283 0 .52.096.713.287.191.192.287.43.287.713v1c0 .283-.096.52-.287.713A.968.968 0 0113.5 12c.283 0 .52.096.713.287.191.192.287.43.287.713v1c0 .283-.096.52-.287.713A.968.968 0 0113.5 15h-4zm1.5-3.75h2v-.75h-2v.75zm0 2.25h2v-.75h-2v.75zM3 15v-5c0-.283.096-.52.288-.713A.968.968 0 014 9h3c.283 0 .52.096.713.287.191.192.287.43.287.713v5H6.5v-1.5h-2V15H3zm1.5-3h2v-1.5h-2V12z" fill="#5F6368"/></svg>',object:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M13.5 18v-1.5h2.25c.213 0 .39-.072.534-.216a.726.726 0 00.216-.534v-1.5c0-.475.137-.906.413-1.294A2.233 2.233 0 0118 12.131v-.262a2.233 2.233 0 01-1.087-.825A2.184 2.184 0 0116.5 9.75v-1.5a.726.726 0 00-.216-.534.726.726 0 00-.534-.216H13.5V6h2.25a2.17 2.17 0 011.594.656c.437.438.656.969.656 1.594v1.5c0 .213.072.39.216.534a.726.726 0 00.534.216h.75v3h-.75a.726.726 0 00-.534.216.726.726 0 00-.216.534v1.5a2.17 2.17 0 01-.656 1.594A2.17 2.17 0 0115.75 18H13.5zm-5.25 0a2.17 2.17 0 01-1.594-.656A2.17 2.17 0 016 15.75v-1.5a.726.726 0 00-.216-.534.726.726 0 00-.534-.216H4.5v-3h.75c.213 0 .39-.072.534-.216A.726.726 0 006 9.75v-1.5c0-.625.219-1.156.656-1.594A2.17 2.17 0 018.25 6h2.25v1.5H8.25a.726.726 0 00-.534.216.726.726 0 00-.216.534v1.5c0 .475-.138.906-.412 1.294A2.233 2.233 0 016 11.869v.262c.45.163.813.438 1.088.825.274.388.412.819.412 1.294v1.5c0 .213.072.39.216.534a.726.726 0 00.534.216h2.25V18H8.25z" fill="#5F6368"/></svg>',array:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M14.625 19v-1.75h2.625V6.75h-2.625V5H19v14h-4.375zM5 19V5h4.375v1.75H6.75v10.5h2.625V19H5z" fill="#5F6368"/></svg>',boolean:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M7.91 16.818c-1.365 0-2.524-.477-3.478-1.432C3.477 14.432 3 13.273 3 11.91c0-1.364.477-2.523 1.432-3.477C5.386 7.477 6.545 7 7.909 7h8.182c1.363 0 2.523.477 3.477 1.432.955.954 1.432 2.114 1.432 3.477 0 1.364-.477 2.523-1.432 3.477-.954.955-2.114 1.432-3.477 1.432H7.909zm0-1.636h8.18c.9 0 1.671-.32 2.312-.962.641-.64.962-1.41.962-2.31 0-.9-.32-1.671-.962-2.312a3.151 3.151 0 00-2.311-.962H7.909c-.9 0-1.67.32-2.311.962a3.151 3.151 0 00-.962 2.311c0 .9.32 1.67.962 2.311.64.641 1.411.962 2.311.962zm8.18-.818c.683 0 1.262-.239 1.74-.716a2.367 2.367 0 00.716-1.739c0-.682-.24-1.261-.716-1.739a2.367 2.367 0 00-1.74-.715c-.68 0-1.26.238-1.738.716a2.367 2.367 0 00-.716 1.738c0 .682.239 1.261.716 1.739a2.367 2.367 0 001.739.716z" fill="#5F6368"/></svg>',right:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M10 18V6l6 6-6 6z" fill="#5F6368"/></svg>',folder:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4 20c-.55 0-1.02-.196-1.413-.587A1.926 1.926 0 012 18V6c0-.55.196-1.02.587-1.412A1.926 1.926 0 014 4h6l2 2h8c.55 0 1.02.196 1.413.588.391.391.587.862.587 1.412H11.175l-2-2H4v12l2.4-8h17.1l-2.575 8.575a1.95 1.95 0 01-.738 1.038A1.985 1.985 0 0119 20H4zm2.1-2H19l1.8-6H7.9l-1.8 6z" fill="#5F6368"/></svg>',add:'<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><path d="M11 13H5v-2h6V5h2v6h6v2h-6v6h-2v-6z" fill="#5F6368"/></svg>',download:'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 16l-5-5 1.4-1.45 2.6 2.6V4h2v8.15l2.6-2.6L17 11l-5 5zm-6 4c-.55 0-1.02-.196-1.412-.587A1.926 1.926 0 014 18v-3h2v3h12v-3h2v3c0 .55-.196 1.02-.587 1.413A1.926 1.926 0 0118 20H6z" fill="#5F6368"/></svg>',clear:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M17.25 18H22v2h-6.75l2-2zm-12.5 2l-2.125-2.125c-.383-.383-.58-.858-.587-1.425-.009-.567.179-1.05.562-1.45l11-11.4c.383-.4.854-.6 1.412-.6.559 0 1.03.192 1.413.575L21.4 8.55c.383.383.575.858.575 1.425 0 .567-.192 1.042-.575 1.425L13 20H4.75zm7.4-2L20 9.95 15.05 5 4 16.4 5.6 18h6.55z" fill="#5F6368"/></svg>'};new Map;function me(t={}){let e;if(typeof t===Ft&&t[ce](vt)){e=t[vt];for(const i of r[Vt](t))i!==vt&&(e[i]=e=>t[i](e));return e}}function be(t,e,i){if({[Ft]:1,[Gt]:1}[t[W][I]()]&&!t[_t])return Ae($,{[V]:"pd-json-editor-nested-child"},[...t[Xt][jt](((t,i)=>e(t,i))),me({[vt]:Ae(Y+".child-add",ge[F]),[Ct]:i})])}function Ce(t){const e={[Ft]:1,[Gt]:1}[t[W][I]()];return me({[vt]:Ae(Y,{[ft]:{[E]:e?1:0,[_t]:t[_t]?1:0}},e?ge.right:null),[Ct]:e?e=>t.setCollapsed():t=>{}})}function Ae(t="",i,s){const n=((t[Ht](A)||[])[0]||"")[Jt](),o=((t[Ht](C)||[])[1]||"")[Jt](),h=(b[Rt](t)?t[Ht](b):[])[jt]((t=>t[Mt](/^\./,"")));if(n[xt]<1)return;let a,c,d=t===Et,f=d?e[R]():e[ae](n);if(95!=we[xt])return f;o[xt]>0&&(f.id=o);for(const t of h)f[he][F](t);if(null==i&&null!=s&&([i,s]=[s,null]),null!=i&&null!=s)[a,c]=[i,s];else if(null==s)typeof i===Nt||typeof i===zt||l[kt](i)?c=i:a=i;else if(null==i)return f;return(()=>{if(typeof a===Ft&&null!=a)for(const t in a){if(!a[ce](t))continue;const e=a[t];if({[Pt]:1,[fe]:1,[de]:1,[Ut]:1,[U]:1,[Lt]:1,[Tt]:1}[t])f[t]=e;else if({[ut]:1,[T]:1,[oe]:1,[Bt]:1,[qt]:1,[gt]:1,[pt]:1}[t])f[Ot][t]=e;else if(t===ft&&typeof e===Ft)for(const t of r[Vt](e))f[ft][t]=e[t];else null!=e&&f[ue](t,e)}})(),(()=>{if(null==c)return;const t=typeof c===Ft;if(l[kt](c)){for(let t of c){const i=t instanceof Element;typeof t===Nt||typeof t===zt?d?f[M](e[Z](t)):f[de]+=t:i&&f[M](t)}return}if(t)return;const i=c,s=n===wt,r=n===yt;n===mt||n===St?f[lt]=i:r||s?f[Pt]=i:d?f[M](e[Z](c)):f[de]=i})(),f}function ke(t){return new m((async(e,i)=>{if(null!=t)if(t instanceof y){const i=new w;i.onload=i=>{try{e(f[j](i[L].result))}catch(i){He(`Failed to parse JSON from file ${t.name}: ${i}`),e({})}},i.readAsText(t)}else typeof t===Ft?e(t):typeof t===Nt?await g(t)[k]((t=>t.text()))[k]((t=>{try{e(f[j](t))}catch(t){throw t}})).catch((i=>{He(`Failed to fetch data from ${t}: ${i}`),e({})})):(He(`Invalid data type: ${t} (${typeof t})`),e({}));else e({})}))}function xe(t){return l[kt](t)?Gt:typeof t===Ft?Ft:typeof t===Kt?Kt:typeof t===zt?zt:Nt}function je(t,e,i,s){function n(t){return t[Mt](/\n/g,"")}function l(e){const i=e[L];i[Pt]=i[ie][de]=n(i[Pt]),t[S]=n(i[Pt])[Jt]()}return i?Ae("span.array-index",e):Ae(N,[me({[vt]:Ae("textarea#key-"+t.id,{[$t]:"KEY"},t[S][Mt](/\n/g,"")),[it]:t=>{l(t),s[It]((()=>{}))},[et]:t=>{l(t)}}),Ae("pre",n(t[S]))])}function He(...t){const i=Ae(X,`${tt}.${ht}.${nt}(${rt} 0, ${f[O](t)});`);e[st][M](i),i[dt]()}function ze(...t){const i=Ae(X,`${tt}.log.${nt}(${rt} 0, ${f[O](t)});`);e[st][M](i),i[dt]()}function Fe(t,e){if(t[W][I]()===zt){const l=/[^\d\-\.]/g,r=p(t[Pt]);function s(t){return v(t)?"":i(t)[Mt](/\s/g,"")[Mt](l,"")}return Ae(N,[me({[vt]:Ae("textarea#value-"+t.id,{[$t]:"NUM"},s(r)),[it]:i=>{const n=i[L];n[Pt]=n[ie][de]=s(n[Pt]),t[Pt]=s(n[Pt]),e[It]((()=>{}))},[et]:e=>{const i=e[L];i[Pt]=i[ie][de]=s(i[Pt]),t[Pt]=s(i[Pt])}}),Ae("pre",s(r))])}if(t[W][I]()===Kt)return t[Pt][Jt]()[xt]<1&&(t[Pt]=H),me({[vt]:Ae("select#value-"+t.id,[Ae(Dt,{[Pt]:H,[Lt]:t[Pt]===H},H),Ae(Dt,{[Pt]:z,[Lt]:t[Pt]===z},z)]),[et]:i=>{t[Pt]=i[L][Pt],e[It]((()=>{}))}});{const o={[Ft]:1,[Gt]:1}[t[W][I]()];function n(t){return t[Mt](/\n/g,"<br>")}return Ae(N,{display:o?"none":"block"},[me({[vt]:Ae("textarea#value-"+t.id,{[$t]:"VAL"},t[Pt]),[it]:i=>{const s=i[L];s[ie][de]=n(s[Pt]),t[Pt]=s[Pt],e[It]((()=>{}))},[et]:e=>{const i=e[L];i[ie][de]=n(i[Pt]),t[Pt]=i[Pt]}}),Ae("pre",n(t[Pt]))])}}t.JSONEditor=class{children=[];body;editor;button=[];#t;#e=!1;#i="Object";get type(){return this.#i}constructor(t={}){"object"==typeof t?this.#s(t):He("Failed to load config.")}async#s(t={}){this[te]=Ae("section");const i=t.when??{},s=t[ot]??"",l=t.description??"",r=n(null==t[B]?1:t[B])?1:0;let o=null!=t[Y]&&typeof t[Y]===Ft?t[Y]:{[Qt]:1,[Wt]:1,[Yt]:1};o[Yt]=o[Yt]??1,o[Qt]=o[Qt]??1,o[Wt]=o[Wt]??1,this.#t=new Ve({[P]:i[ye[P]],[G]:i[ye[G]],[q]:i[ye[q]],[K]:i[ye[K]],[_]:i[ye[_]],[Q]:i[ye[Q]]});let h=await ke(t.file??t.json??t.path);this.children=this.#n(h);let a=Ae("temp",[Math.max(s[xt],l[xt])>0?Ae("header",[s[xt]>0?Ae("strong",s):null,l[xt]>0?Ae("p",l):null]):null,this[te],Ae("footer",[me({[vt]:Ae(Y,{[ot]:"Add row"},ge[F]),[Ct]:t=>this[D]()}),n(o[Qt])?me({[vt]:Ae(Y,{[ot]:"Open file"},ge.folder),[Ct]:t=>t[L][ie][x]()}):null,n(o[Qt])?me({[vt]:Ae(wt,{[W]:"file",accept:".json",[ut]:"none"}),[et]:t=>this[Qt](t[L].files[0])}):null,n(o[Wt])?me({[vt]:Ae(Y,{[ot]:"Download file"},ge.download),[Ct]:t=>{u("Download?")&&this[Wt]()}}):null,n(o[Yt])?me({[vt]:Ae(Y,{[ot]:"清空"},ge.clear),[Ct]:t=>{u("Reset?")&&this[Qt]({})}}):null])]);const c="pd-json-editor";null==t.id?(this[st]=Ae($+"."+c),this[st][M](a)):(this[st]=e[ee](t.id),this[st][he][F](c),this[st][J](...a[Xt])),this[st][ft][B]=r,this[Xt][xt]<1&&this[D](),this.#t[ct]((async()=>{this[ct](),this.#e=!0}))}#l(t){return t.render()}#n(t,e=null){const s=[];if(l[kt](t))for(let n of t){const t=xe(n),l=new Me({[W]:t,[bt]:e??this,[te]:this,lifecycle:this.#t});t===Ft&&null!=n||t===Gt?l[Xt]=this.#n(n,l):l[Pt]=i(n),s[Zt](l)}else for(const[n,l]of r.entries(t)){const t=xe(l),r=new Me({[S]:n,[W]:t,[bt]:e??this,[te]:this,lifecycle:this.#t});t===Ft&&null!=l||t===Gt?r[Xt]=this.#n(l,r):r[Pt]=null==l?"":i(l),s[Zt](r)}return s}render(t=!1){let e=Ae("temp",this[Xt].map((t=>this.#l(t))));this[te][J](...e[Xt]),this.#e&&t&&this.#t[It]((()=>{}))}insert(){this[Xt][Zt](new Me({[bt]:this,[te]:this,lifecycle:this.#t})),this[ct]()}get json(){const t={};for(let e of this[Xt])e[S]&&(t[e[S]||0]=e.json);return f[O](t,null,4)}async import(t){let e=await ke(t);this.children=this.#n(e),this[ct](!0)}reset(){this[Qt]({})}export(){const t={};for(let e of this[Xt])(e.key||1===this[Xt][xt])&&(t[e.key||0]=e.json);const i=new o([f[O](t,null,4)],{[W]:"application/json"}),s=h.createObjectURL(i),n=Ae("a",{href:s,download:`JSONEditor-${c[at]()}.json`});e[st][M](n),n[x](),e[st].removeChild(n),h.revokeObjectURL(s)}};class Me{key="";type="string";value="";parent;children=[];collapsed=!1;#r;#o;#t;constructor(t={}){"object"==typeof t?(this.id=function(t=64){let e="";for(let i=0;i<t;i++)e+="abcdefghijklmnopqrstuvwxyz0123456789".charAt(a.floor(36*a.random()));return e}(),this[S]=t[S]??this[S],this[W]=t[W]??this[W],this[Pt]=t[Pt]??this[Pt],this[bt]=t[bt]??this[bt],this[Xt]=t[Xt]??this[Xt],this[_t]=t[_t]??this[_t],this.#o=t.editor,this.#t=t.lifecycle):He("Failed to load config form editor node.")}render(){return this.#l()}addChild(){this.#h()}updateChild(){this.#l(),this.#a()}setCollapsed(){this[_t]=!this[_t],this.#l()}get json(){return this.#c()}#a(){this.#t[It]((t=>{}))}#l(){let t=Ae("section.pd-json-editor-child",[Ae("section.pair-wrapper",[Ae($+"#"+this.id+".input-group",[Ce(this),je(this,this.parent.children.indexOf(this),this.parent.type===Gt,this.#t),Ae("span",":"),(i=this,Ae(N,[i[W][I]()===zt?ge[zt]:i[W][I]()===Kt?ge[Kt]:i[W][I]()===Gt?ge[Gt]:i[W][I]()===Ft?ge[Ft]:ge[Nt],me({[vt]:Ae("select",[...pe[jt]((t=>Ae(Dt,{[Pt]:t,[Lt]:t===i[W]},t)))]),[et]:t=>{if(i[W]=t[L][Pt],{[Ft]:1,[Gt]:1}[t[L][Pt][I]()])i[Pt]="",0===i[Xt][xt]&&i.addChild();else if(t[L][Pt][I]()===zt){const t=p(i[Pt]);i[Pt]=v(t)?"":t}else i[Pt]="",i[Xt]=[];i.updateChild(),e[ee]("value-"+i.id).focus()}})])),Fe(this,this.#t),me({[vt]:Ae(Y,ge[F]),[Ct]:t=>{u("Remove?")&&this.#d()}})]),be(this,((t,e)=>{let i=t.#l();return i[ft].last=e===this.children.length-1?1:0,i}),(()=>{this.#h()}))])]);var i;return this.#r&&this.#r.parentElement.replaceChild(t,this.#r),this.#r=t,this.#r}#h(){const t=new Me({[bt]:this,[te]:this.#o,lifecycle:this.#t});this[Xt][Zt](t);const e=this.#r.querySelector("section.pd-json-editor-nested-child");if(null!=e){const i=e.children[e.children.length-1];for(let t of i.parentElement.children)t.dataset.last=0;const s=t.#l();s.dataset.last=1,e.insertBefore(s,i)}this.#a()}#d(){if(!this[bt])return;const t=this[bt][Xt].indexOf(this);if(-1===t)return;const e=this.#r.previousElementSibling;"1"===this.#r.dataset.last&&null!=e&&(e.dataset.last=1),this[bt][Xt].splice(t,1),this.#r[dt](),this.#a()}#c(){if(!this[bt])return;if(this[W]===Gt)return this[Xt][jt]((t=>t.#c()));if(this[W]===Ft){const t={};for(let e of this[Xt])(e[S]||this[bt][W]===Gt)&&(t[e[S]||r[Vt](t)[xt]]=e.#c());return t}let t=this[Pt];return this[W]===Kt?t="true"===t[I]():this[W]===zt&&(t=s(t)),t}}class Ve{#f;#u;#p;#v;#w;#y;#g;#m;#b;constructor(t={}){this.#f=t[ye[P]]||void 0,this.#u=t[ye[G]]||void 0,this.#p=t[ye[q]]||void 0,this.#v=t[ye[K]]||void 0,this.#w=t[ye[_]]||void 0,this.#y=t[ye[Q]]||void 0}async#C(t){return new m(((e,i)=>{e(!1!==t())}))}#A(t){t(!1)}async render(t){this.#g=c[at](),null!=this.#f&&!1===await this.#C(this.#f)||(await t(),this.#m=c[at]()-this.#g,ze(`Rendered in ${this.#m}ms.`),null!=this.#u&&this.#A(this.#u))}async update(t){clearTimeout(this.#b),this.#b=d((async()=>{this.#g=c[at](),null!=this.#p&&!1===await this.#C(this.#p)||(await t(),this.#m=c[at]()-this.#g,ze(`Updated in ${this.#m}ms.`),null!=this.#v&&this.#A(this.#v))}),300)}async destroy(t){this.#g=c[at](),null!=this.#w&&!1===await this.#C(this.#w)||(await t(),this.#m=c[at]()-this.#g,ze(`Destroyed in ${this.#m}ms.`),null!=this.#y&&this.#A(this.#y))}}}("undefined"==typeof window?window={}:window);export const JSONEditor = window.JSONEditor;