Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-edit-react

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-edit-react - npm Package Compare versions

Comparing version 1.15.9 to 1.15.10-rc1

2

build/index.cjs.js

@@ -1,1 +0,1 @@

"use strict";var e=require("react/jsx-runtime"),n=require("react"),t=require("object-property-assigner"),r=require("object-property-extractor");function o(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,s)}l((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var a=[],i=[];!function(e,n){if(e&&"undefined"!=typeof document){var t,r=!0===n.prepend?"prepend":"append",o=!0===n.singleTag,s="string"==typeof n.container?document.querySelector(n.container):document.getElementsByTagName("head")[0];if(o){var l=a.indexOf(s);-1===l&&(l=a.push(s)-1,i[l]={}),t=i[l]&&i[l][r]?i[l][r]:i[l][r]=c()}else t=c();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),n.attributes)for(var t=Object.keys(n.attributes),o=0;o<t.length;o++)e.setAttribute(t[o],n.attributes[t[o]]);var a="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(a,e),e}}(":root {\n --jer-select-border: #b6b6b6;\n --jer-select-focus: #777;\n --jer-select-arrow: #777;\n --jer-form-border: 1px solid #ededf0;\n --jer-form-border-focus: 1px solid #e2e2e2;\n --jer-expand-transition-time: 0.3s;\n --jer-highlight-color: #b3d8ff;\n}\n\n.jer-visible {\n opacity: 1;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-hidden {\n opacity: 0;\n transition: var(--jer-expand-transition-time);\n}\n\n/* Select styled as per:\nhttps://moderncss.dev/custom-select-styles-with-pure-css/\n*/\n\n.jer-select select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: transparent;\n border: none;\n padding: 0 1em 0 0;\n margin: 0;\n /* width: 100%; */\n font-family: inherit;\n font-size: 0.8em;\n color: black;\n cursor: inherit;\n line-height: inherit;\n z-index: 1;\n outline: none;\n}\nselect::-ms-expand {\n display: none;\n}\n\n.jer-select {\n display: grid;\n grid-template-areas: 'select';\n align-items: center;\n position: relative;\n min-width: 12ch;\n max-width: 15ch;\n border: 1px solid var(--jer-select-border);\n border-radius: 0.25em;\n padding: 0.25em 0.5em;\n cursor: pointer;\n line-height: 1.1;\n background-color: #fff;\n background-image: linear-gradient(to top, #f9f9f9, #fff 33%);\n}\n.jer-select select,\n.jer-select::after {\n grid-area: select;\n}\n.jer-select:not(.jer-select--multiple)::after {\n content: '';\n justify-self: end;\n width: 0.8em;\n height: 0.5em;\n background-color: var(--jer-select-arrow);\n -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n}\n\nselect:focus + .focus {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n border: 1px solid var(--jer-select-focus);\n border-radius: inherit;\n}\n\n.jer-editor-container {\n position: relative;\n font-size: 16px;\n line-height: 1;\n padding: 1em;\n padding-left: 2em;\n /* margin-top: 1em; */\n /* margin-bottom: 1em; */\n border-radius: 0.5em;\n text-align: left;\n}\n\n.jer-editor-container textarea {\n color: var(--jer-input-color);\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n}\n\n.jer-editor-container textarea:focus {\n border: var(--jer-form-border-focus);\n}\n\n.jer-editor-container input {\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n font-family: inherit;\n}\n\n.jer-editor-container input:focus {\n border: var(--jer-form-border-focus);\n}\n\n/* Input highlighted text */\n.jer-editor-container ::selection {\n background-color: var(--jer-highlight-color);\n}\n\n/* .jer-editor-container select {\n color: red;\n} */\n\n/* .jer-component {\n} */\n\n.jer-collection-header-row,\n.jer-value-main-row {\n display: flex;\n min-height: 1.7em;\n gap: 0.3em;\n align-items: center;\n}\n\n.jer-collection-header-row {\n display: flex;\n flex-wrap: wrap;\n}\n\n/* .jer-brackets {\n} */\n\n/* .jer-bracket-outside {\n} */\n\n/* .jer-collection-item-count {\n} */\n\n.jer-collapse-icon {\n position: absolute;\n left: -1.2em;\n top: 0.35em;\n}\n\n.jer-collection-inner {\n position: relative;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-collection-text-edit {\n display: flex;\n flex-direction: column;\n gap: 0.3em;\n align-items: flex-start;\n}\n\n.jer-collection-text-area {\n resize: both;\n padding-top: 0.2em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-bottom: 0;\n overflow: hidden;\n max-height: 40em;\n font-family: inherit;\n font-size: 0.85em;\n}\n\n.jer-collection-input-button-row {\n display: flex;\n justify-content: flex-end;\n font-size: 150%;\n margin-top: 0.4em;\n}\n\n/* .jer-collection-element {\n} */\n\n.jer-collection-error-row {\n position: absolute;\n bottom: 0.5em;\n}\n\n/* .jer-collection-error-row-edit {\n} */\n\n.jer-error-slug {\n margin-left: 1em;\n}\n\n.jer-value-component {\n position: relative;\n}\n\n.jer-value-main-row {\n display: flex;\n gap: 0;\n}\n\n.jer-value-and-buttons {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-left: 0.5em;\n}\n\n.jer-value-error-row {\n position: absolute;\n}\n\n.jer-value-string {\n line-height: 1.3em;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.jer-hyperlink {\n text-decoration: underline;\n}\n\n.jer-input-text {\n resize: none;\n margin: 0;\n height: 1.4em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-top: 0.25em;\n padding-bottom: 0.2em;\n min-width: 6em;\n overflow: hidden;\n line-height: 1.2em;\n font-family: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-number {\n} */\n\n/* .jer-value-boolean {\n} */\n\n.jer-input-boolean {\n transform: scale(1.5);\n margin-left: 0.3em;\n margin-right: 0.3em;\n}\n\n/* .jer-value-null {\n} */\n\n/* .jer-value-object {\n} */\n\n.jer-key-text {\n word-break: break-word;\n line-height: 1.1em;\n white-space: pre-wrap;\n}\n\n.jer-key-edit {\n padding: 0 0.3em;\n font-size: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-array {\n} */\n\n.jer-value-invalid {\n opacity: 0.5;\n font-style: italic;\n}\n\n.jer-input-number {\n min-width: 3em;\n font-size: 90%;\n}\n\n/* .jer-input-component {\n} */\n\n.jer-edit-buttons,\n.jer-confirm-buttons {\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 1em;\n}\n\n.jer-input-buttons {\n gap: 0.4em;\n}\n\n.jer-edit-buttons {\n gap: 0.4em;\n margin-left: 0.5em;\n opacity: 0;\n}\n\n.jer-confirm-buttons {\n gap: 0.2em;\n margin-left: 0.4em;\n}\n\n.jer-edit-buttons:hover {\n opacity: 1;\n position: relative;\n}\n\n.jer-collection-header-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-main-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-and-buttons:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n/* .jer-input-buttons {\n} */\n\n.jer-copy-pulse {\n position: relative;\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-copy-pulse:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n.jer-copy-pulse:after {\n content: '';\n display: block;\n position: absolute;\n border-radius: 50%;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: all 0.5s;\n box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);\n}\n\n.jer-copy-pulse:active:after {\n box-shadow: 0 0 0 0 var(--jer-icon-copy-color);\n position: absolute;\n border-radius: 4em;\n left: 0;\n top: 0;\n opacity: 1;\n transition: 0s;\n}\n\n.jer-copy-pulse:active {\n top: 0.07em;\n}\n\n.jer-rotate-90 {\n transform: rotate(-90deg);\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-accordion-icon {\n /* font-size: '2em'; */\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-icon:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n/* For displaying keys that are purely <empty string> \"\" */\n.jer-empty-string::after {\n content: '<empty string>';\n font-style: italic;\n font-size: 90%;\n}\n\n.jer-drag-n-drop-padding {\n height: 0.5em;\n border: 1px dashed #e0e0e0;\n border-radius: 0.3em;\n}\n",{});const s=({className:n,name:t,value:r,setValue:o,handleKeyPress:a,styles:i})=>{if("string"!=typeof r)return null;const s="\n"===r.slice(-1)?r+".":r;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${t}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},i),rows:1,className:n,name:`${t}_textarea`,value:r,onChange:e=>o(e.target.value),autoFocus:!0,onFocus:e=>{r.length<40&&e.target.select()},onKeyDown:a}),e.jsx("span",{className:n,style:Object.assign({visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent"},i),children:s})]})},l={default:{displayName:"Default",fragments:{edit:"rgb(42, 161, 152)"},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},collection:{},collectionInner:{},collectionElement:{},dropZone:{},property:"#292929",bracket:{color:"rgb(0, 43, 54)",fontWeight:"bold"},itemCount:{color:"rgba(0, 0, 0, 0.3)",fontStyle:"italic"},string:"rgb(203, 75, 22)",number:"rgb(38, 139, 210)",boolean:"green",null:{color:"rgb(220, 50, 47)",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"rgb(0, 43, 54)",iconEdit:"edit",iconDelete:"rgb(203, 75, 22)",iconAdd:"edit",iconCopy:"rgb(38, 139, 210)",iconOk:"green",iconCancel:"rgb(203, 75, 22)"}},githubDark:{displayName:"Github Dark",styles:{container:{backgroundColor:"#0d1117",color:"white"},dropZone:"rgba(165, 214, 255, 0.17)",property:"#E6EDF3",bracket:"#56d364",itemCount:"#8B949E",string:"#A5D6FF",number:"#D2A8FF",boolean:{color:"#FF7B72",fontSize:"90%",fontWeight:"bold"},null:"green",iconCollection:"#D2A8FF",iconEdit:"#D2A8FF",iconDelete:"rgb(203, 75, 22)",iconAdd:"rgb(203, 75, 22)",iconCopy:"#A5D6FF",iconOk:"#56d364",iconCancel:"rgb(203, 75, 22)"}},githubLight:{displayName:"Github Light",styles:{container:"white",property:"#1F2328",bracket:"#00802e",itemCount:"#8B949E",string:"#0A3069",number:"#953800",boolean:{color:"#CF222E",fontSize:"90%",fontWeight:"bold"},null:"#FF7B72",iconCollection:"#8250DF",iconEdit:"#8250DF",iconDelete:"rgb(203, 75, 22)",iconAdd:"#8250DF",iconCopy:"#57606A"}},monoDark:{displayName:"Black & White",fragments:{lightText:{color:"white"},midGrey:"#5c5c5c"},styles:{container:["lightText",{backgroundColor:"black"}],dropZone:"#e0e0e029",property:"lightText",bracket:"midGrey",itemCount:"#4a4a4a",string:"#a8a8a8",number:"#666666",boolean:{color:"#848484",fontStyle:"italic"},null:"#333333",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},monoLight:{fragments:{midGrey:"#a3a3a3"},displayName:"White & Black",styles:{container:"white",property:"black",bracket:"midGrey",itemCount:"#b5b5b5",string:"#575757",number:"#999999",boolean:{color:"#7b7b7b",fontStyle:"italic"},null:"#cccccc",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},candyWrapper:{displayName:"Candy Wrapper",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},darkBlue:{color:"#2B2D42"}},styles:{container:"minty",property:"pop",dropZone:"#eb121217",bracket:"dark",itemCount:"pale",string:"mid",number:["darkBlue",{fontSize:"85%"}],boolean:["mid",{fontStyle:"italic",fontWeight:"bold",fontSize:"80%"}],null:["#cccccc",{fontWeight:"bold"}],input:{border:"1px solid rgb(115, 194, 198)"},iconCollection:"#1D3557",iconEdit:"#457B9D",iconDelete:"#E63946",iconAdd:"#2B2D42",iconCopy:"#1D3557",iconCancel:"#E63946"}},psychedelic:{displayName:"Psychedelic",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},fluroYellow:"rgb(242, 228, 21)",fluroGreen:"rgb(68, 255, 62)",hotPink:"#f7379a"},styles:{container:{backgroundColor:"unset",background:"linear-gradient(90deg, hsla(333, 100%, 53%, 1) 0%, hsla(33, 94%, 57%, 1) 100%)",color:"black"},dropZone:"fluroYellow",property:"black",bracket:"fluroYellow",itemCount:["pale",{opacity:.7}],string:"white",number:["#33d9ff",{fontSize:"90%",fontWeight:"bold"}],boolean:["fluroGreen",{fontWeight:"bold",fontSize:"80%"}],null:["black",{fontWeight:"bold",opacity:.3,backgroundColor:"rgb(255, 255, 255, 0.5)",padding:"0 0.4em",borderRadius:"0.4em"}],iconCollection:"fluroYellow",iconEdit:["black"],iconDelete:["white",{opacity:.5}],iconAdd:["white",{opacity:.5}],iconCopy:"rgb(32, 84, 242)",iconOk:"fluroGreen",iconCancel:"hotPink"}}},c=l.default,d=n.createContext({getStyles:()=>({}),icons:{}}),u=({theme:n="default",icons:t={},children:r})=>{const o=g(n);return e.jsx(d.Provider,{value:{getStyles:(e,n)=>"function"==typeof o[e]?o[e](n):o[e],icons:t},children:r})},p=()=>n.useContext(d),g=e=>{var n,t,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((n=>"default"===e?{}:"string"==typeof n?m(l[n],a):h(n)?m({fragments:{},styles:n},a):m(n,a))),s=m(c,{});Object.keys(s).forEach((e=>{const n=e;i.forEach((e=>{e[n]&&(s[n]=Object.assign(Object.assign({},s[n]),e[n]))}))}));const d=Object.assign({},s);return Object.entries(a).forEach((([e,n])=>{const t=e;d[t]=e=>{const r=n(e)||{};return Object.assign(Object.assign({},s[t]),r)}})),"function"!=typeof(null==d?void 0:d.inputHighlight)&&(null===(n=null==d?void 0:d.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(t=null==d?void 0:d.inputHighlight)||void 0===t?void 0:t.backgroundColor),"function"!=typeof(null==d?void 0:d.iconCopy)&&(null===(r=null==d?void 0:d.iconCopy)||void 0===r?void 0:r.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(o=null==d?void 0:d.iconCopy)||void 0===o?void 0:o.color),d},m=(e,n)=>{const{fragments:t,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a;if("function"==typeof o)return n[e]=o,Object.assign({},r);if("string"==typeof o){const n=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:o;return"string"==typeof n?Object.assign(Object.assign({},r),{[y[e]]:n}):Object.assign(Object.assign({},r),n)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},h=e=>!("styles"in e),y={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",property:"color",bracket:"color",itemCount:"color",string:"color",number:"color",boolean:"color",null:"color",input:"color",inputHighlight:"backgroundColor",error:"color",iconCollection:"color",iconEdit:"color",iconDelete:"color",iconAdd:"color",iconCopy:"color",iconOk:"color",iconCancel:"color"},j="**INVALID_FUNCTION**",b=(e,n=200)=>"string"==typeof e?e.length<n?e:`${e.slice(0,n-2).trim()}...`:e,f=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),v=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,stringTruncate:c,showStringQuotes:d,nodeData:u})=>{const{getStyles:g}=p(),m=f(o),h=d?'"':"";return r?e.jsx(s,{className:"jer-input-text",name:m,value:n,setValue:t,isEditing:r,handleKeyPress:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&l():i()},styles:g("input",u)}):e.jsxs("div",{id:`${m}_display`,onDoubleClick:()=>a(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&a(!0)},className:"jer-value-string",style:g("string",u),children:[h,b(n,c),h]})},E=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l})=>{const{getStyles:c}=p();return r?e.jsx("input",{className:"jer-input-number",type:"text",name:f(o),value:n,onChange:e=>t(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{switch(e.key){case"Enter":i();break;case"Escape":s();break;case"ArrowUp":e.preventDefault(),t(Number(n)+1);break;case"ArrowDown":e.preventDefault(),t(Number(n)-1)}},style:Object.assign({width:String(n).length/1.5+2+"em"},c("input",l))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:c("number",l),children:n})},x=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l})=>{const{getStyles:c}=p();return r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:f(o),checked:n,onChange:()=>t(!n),onKeyDown:e=>{"Enter"===e.key?i():"Escape"===e.key&&s()},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:c("boolean",l),children:String(n)})},D=({value:t,isEditing:r,setIsEditing:o,handleEdit:a,handleCancel:i,nodeData:s})=>{const{getStyles:l}=p();n.useEffect((()=>(r&&document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c))),[r]);const c=e=>{"Enter"===e.key?a():"Escape"===e.key&&i()};return e.jsx("div",{onDoubleClick:()=>o(!0),className:"jer-value-null",style:l("null",s),children:String(t)})},w=({value:n})=>{let t="Error!";switch(typeof n){case"string":n===j&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:t})},k=({size:n,style:t,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),e.jsx("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]}),C=({size:n,style:t,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,transform:"translate(0, 0.5)",children:[e.jsx("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),e.jsx("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),S=({size:n,style:t,className:r})=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"})}),O=({size:n,style:t,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),e.jsx("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),e.jsx("path",{d:"M15 10l-4 4 4 4"})]}),N=({size:n,style:t,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),e.jsx("path",{d:"M22 4L12 14.01l-3-3"})]}),A=({size:n,style:t,className:r})=>e.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"})}),T=({size:n,style:t,className:r})=>e.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})}),R=({name:n,nodeData:t,rotate:r})=>{var o,a,i,s,l,c,d;const{getStyles:u,icons:g}=p(),m={size:"1.4em",className:"jer-icon"};switch(n){case"add":return null!==(o=null==g?void 0:g.add)&&void 0!==o?o:e.jsx(k,Object.assign({},m,{style:u("iconAdd",t)}));case"edit":return null!==(a=null==g?void 0:g.edit)&&void 0!==a?a:e.jsx(C,Object.assign({},m,{style:u("iconEdit",t)}));case"delete":return null!==(i=null==g?void 0:g.delete)&&void 0!==i?i:e.jsx(S,Object.assign({},m,{style:u("iconDelete",t),size:"1.45em"}));case"copy":return null!==(s=null==g?void 0:g.copy)&&void 0!==s?s:e.jsx(O,Object.assign({},m,{style:u("iconCopy",t),size:"1.2em"}));case"ok":return null!==(l=null==g?void 0:g.ok)&&void 0!==l?l:e.jsx(N,Object.assign({},m,{style:Object.assign({fontSize:"90%"},u("iconOk",t))}));case"cancel":return null!==(c=null==g?void 0:g.cancel)&&void 0!==c?c:e.jsx(A,Object.assign({},m,{style:Object.assign({fontSize:"130%"},u("iconCancel",t))}));case"chevron":return null!==(d=null==g?void 0:g.chevron)&&void 0!==d?d:e.jsx(T,{className:"jer-accordion-icon"+(r?" jer-rotate-90":""),size:"1em",style:u("iconCollection",t)});default:return e.jsx(e.Fragment,{})}},F=({startEdit:t,handleDelete:r,handleAdd:o,enableClipboard:a,type:i,nodeData:s,translate:l})=>{const{getStyles:c}=p(),d=l("KEY_NEW",s),[u,g]=n.useState(!1),[m,h]=n.useState(d),{key:y,path:j,value:b}=s;return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:u?1:void 0},children:[a&&e.jsx("div",{onClick:e=>{let n,t="value",r="";if(a){if(!0===(e.ctrlKey||e.metaKey))n=V(j),r=n,t="path";else n=b,r=i?JSON.stringify(b,null,2):String(n);navigator.clipboard.writeText(r)}"function"==typeof a&&a({value:n,stringValue:r,path:j,key:y,type:t})},className:"jer-copy-pulse",children:e.jsx(R,{name:"copy",nodeData:s})}),t&&e.jsx("div",{onClick:t,children:e.jsx(R,{name:"edit",nodeData:s})}),r&&e.jsx("div",{onClick:r,children:e.jsx(R,{name:"delete",nodeData:s})}),o&&e.jsx("div",{onClick:()=>{"object"===i?g(!0):o("")},children:e.jsx(R,{name:"add",nodeData:s})}),u&&o&&"object"===i&&e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:m,onChange:e=>h(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&o?(g(!1),o(m),h(d)):"Escape"===e.key&&(g(!1),h(d))},style:c("input",s)}),e.jsx(P,{onOk:()=>{m&&(g(!1),o(m))},onCancel:()=>{g(!1)},nodeData:s})]})]})},P=({onOk:n,onCancel:t,nodeData:r})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[e.jsx("div",{onClick:n,children:e.jsx(R,{name:"ok",nodeData:r})}),e.jsx("div",{onClick:t,children:e.jsx(R,{name:"cancel",nodeData:r})})]}),V=e=>e.reduce(((e,n)=>"number"==typeof n?`${e}[${n}]`:""===e?n:`${e}.${n}`),""),M=["string","number","boolean","null","object","array"],z=(e=[],n)=>{const t=e.filter((({condition:e})=>e(n)));if(0===t.length)return{};const r=t[0],{element:o,wrapperElement:a,customNodeProps:i,wrapperProps:s,hideKey:l=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:p=!0}=r,g=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:a,customNodeProps:i,wrapperProps:s,hideKey:l,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:p},g)},I=e=>null!==e&&"object"==typeof e,_=(e,n,t,r="")=>{if(!t&&!r)return!0;switch(e){case"collection":if(t){if(t(n,r))return!0;if(!L(r,n,t))return!1}if(!t&&r&&!L(r,n))return!1;break;case"value":if(t&&!t(n,r))return!1;if(!t&&r&&!K(n,r))return!1}return!0},L=(e="",n,t=K)=>{const r=n.value;return Object.entries(r).some((([o,a])=>{const i=[...n.path,o],s=Object.assign(Object.assign({},n),{key:o,path:i,level:n.level+1,value:a,size:i.length,parentData:r});return I(a)?L(e,s,t):t(s,e)}))},K=(e,n="")=>{const{value:t}=e;if(null===t&&"null".includes(n.toLowerCase()))return!0;switch(typeof t){case"string":return t.toLowerCase().includes(n.toLowerCase());case"number":return!!String(t).includes(n);case"boolean":return t?"true".includes(n.toLowerCase())||"1"===n:"false".includes(n.toLowerCase())||"0"===n;default:return!1}},W=({key:e,path:n},t="")=>!!K({value:e},t)||!!n.some((e=>K({value:e},t))),B=n.createContext({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),G=({children:t})=>{const[r,o]=n.useState(null),[a,i]=n.useState(null),[s,l]=n.useState({path:null,pathString:null});return e.jsx(B.Provider,{value:{collapseState:r,setCollapseState:e=>{o(e),null!==e&&setTimeout((()=>o(null)),2e3)},doesPathMatch:e=>{if(null===r)return!1;for(const[n,t]of r.path.entries())if(t!==e[n])return!1;return!0},currentlyEditingElement:a,setCurrentlyEditingElement:i,areChildrenBeingEdited:e=>null!==a&&a.includes(e),dragSource:s,setDragSource:l},children:t})},H=()=>n.useContext(B),U=({props:e,collapsed:t})=>{const{data:r,nodeData:o,parentData:a,onEdit:i,onError:s,showErrorMessages:l,restrictEditFilter:c,restrictDeleteFilter:d,restrictAddFilter:u,restrictDragFilter:p,translate:g}=e,{currentlyEditingElement:m,setCurrentlyEditingElement:h}=H(),[y,j]=n.useState(null),b=Object.assign(Object.assign({},o),{collapsed:t}),{path:v,key:E,size:x}=b,D=f(v),w=n.useMemo((()=>!c(b)),[b]),k=n.useMemo((()=>!d(b)),[b]),C=n.useMemo((()=>!u(b)),[b]),S=n.useMemo((()=>!p(b)&&k&&null===m),[b]),O=e=>{l&&(j(e),setTimeout((()=>j(null)),2500)),console.warn("Error",e)},N=n.useMemo((()=>(e,n)=>{O(e.message),s&&s({currentData:b.fullData,errorValue:n,currentValue:r,name:E,path:v,error:e})}),[s,l]),A=m===D,T=m===`key_${D}`,R="number"==typeof v.slice(-1)[0];return{pathString:D,nodeData:b,path:v,name:E,size:x,canEdit:w,canDelete:k,canAdd:C,canDrag:S,error:y,showError:O,onError:N,setError:j,handleEditKey:e=>{if(h(null),E===e)return;if(!a)return;const n=v.slice(0,-1);if(Object.keys(a).includes(e))return void N({code:"KEY_EXISTS",message:g("ERROR_KEY_EXISTS",b)},e);const t=Object.fromEntries(Object.entries(a).map((([n,t])=>n===E?[e,t]:[n,t])));i(t,n).then((n=>{n&&N({code:"UPDATE_ERROR",message:n},e)}))},derivedValues:{isEditing:A,isEditingKey:T,isArray:R,canEditKey:null!==a&&w&&C&&k&&!R}}},Y=({canDrag:t,canDragOnto:r,path:o,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=p(),{dragSource:d,setDragSource:u}=H(),[g,m]=n.useState(!1),h=f(o),y=n.useMemo((()=>t?{onDragStart:e=>{e.stopPropagation(),u({path:o,pathString:h})},onDragEnd:e=>{e.stopPropagation(),u({path:null,pathString:null})}}:{}),[t]),j=n.useMemo((()=>e=>r?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:n=>{n.stopPropagation(),v(e),u({path:null,pathString:null}),m(!1)},onDragEnter:n=>{var t;n.stopPropagation(),h.startsWith(null!==(t=d.pathString)&&void 0!==t?t:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[d,r]),b=n.useMemo((()=>r&&null!==d.pathString?e.jsx("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:o.length}},j("below"))):null),[d,r]),v=e=>{var n,t;const r=null===(n=d.path)||void 0===n?void 0:n.slice(-1)[0],c=null===(t=d.path)||void 0===t?void 0:t.slice(0,-1).join("."),u=o.slice(0,-1).join(""),{parentData:p}=a;"string"==typeof r&&p&&!Array.isArray(p)&&Object.keys(p).includes(r)&&r in p&&c!==u?s({code:"KEY_EXISTS",message:l("ERROR_KEY_EXISTS",a)},r):i(d.path,o,e).then((e=>{e&&s({code:"UPDATE_ERROR",message:e},a.value)}))};return{dragSourceProps:y,getDropTargetProps:j,BottomDropTarget:b,DropTargetPadding:({position:n,nodeData:t})=>g===n?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",t)}):null,handleDrop:v}},$=(e,n)=>{var t,r;const o=document.getElementsByClassName("jer-editor-container"),a=parseInt(o.length>0?getComputedStyle(o[0]).getPropertyValue("line-height"):"16px"),i=(null!==(r=null===(t=n.current)||void 0===t?void 0:t.offsetWidth)&&void 0!==r?r:0)/(.5*a),s=JSON.stringify(e,null,2).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/i))).reduce(((e,n)=>e+n),0)*a;return Math.min(s+30,window.innerHeight-50)},J=t=>{const{data:r,parentData:o,onEdit:a,onDelete:i,onChange:s,onMove:l,enableClipboard:c,canDragOnto:d,restrictTypeSelection:u,searchFilter:g,searchText:m,showLabel:h,stringTruncate:y,showStringQuotes:b,indent:f,translate:v,customNodeDefinitions:E}=t,{getStyles:x}=p(),{setCurrentlyEditingElement:D,setCollapseState:w}=H(),[k,C]=n.useState("function"==typeof r?j:r),{pathString:S,nodeData:O,path:N,name:A,canEdit:T,canDelete:R,canDrag:V,error:I,onError:L,handleEditKey:K,derivedValues:W}=U({props:t}),{dragSourceProps:B,getDropTargetProps:G,BottomDropTarget:$,DropTargetPadding:J}=Y({canDrag:V,canDragOnto:d,path:N,nodeData:O,onMove:l,onError:L,translate:v}),Q=z(E,O),[ee,ne]=n.useState(X(r,Q)),te=n.useCallback((e=>{if(!s)return void C(e);const n=s({currentData:O.fullData,newValue:e,currentValue:k,name:A,path:N});C(n)}),[s]);n.useEffect((()=>{C("function"==typeof r?j:r),ne(X(r,Q))}),[r,I]);const{CustomNode:re,customNodeProps:oe,hideKey:ae,showEditTools:ie=!0,showOnEdit:se,showOnView:le}=Q,ce=[...M,...E.filter((({showInTypesSelector:e=!1,name:n})=>e&&!!n)).map((({name:e})=>e))],de=n.useMemo((()=>{if("boolean"==typeof u)return u?[]:ce;if(Array.isArray(u))return u;const e=u(O);return"boolean"==typeof e?e?[]:ce:e}),[O,u]);if(!_("value",O,g,m))return null;const ue=()=>{let e;switch(D(null),ee){case"object":e={[v("DEFAULT_NEW_KEY",O)]:k};break;case"array":e=null!=k?k:[];break;case"number":{const n=Number(k);e=isNaN(n)?0:n;break}default:e=k}a(e,N).then((n=>{n&&L({code:"UPDATE_ERROR",message:n},e)}))},pe=()=>{D(null),C(r),ne(X(r,Q))},{isEditing:ge,isEditingKey:me,canEditKey:he}=W,ye=!ge&&I,je=ge&&de.length>0,be="invalid"!==ee&&!I&&ie,fe=h&&me,ve=h&&!me&&!ae,Ee={value:k,parentData:o,setValue:te,isEditing:ge,setIsEditing:T?()=>D(S):()=>{},handleEdit:ue,handleCancel:pe,path:N,stringTruncate:y,showStringQuotes:b,nodeData:O,translate:v},xe=re&&(ge&&se||!ge&&le)?e.jsx(re,Object.assign({},t,{value:k,customNodeProps:oe,setValue:te,handleEdit:ue,handleCancel:pe,handleKeyPress:e=>{"Enter"===e.key?ue():"Escape"===e.key&&pe()},isEditing:ge,setIsEditing:()=>D(S),getStyles:x})):Z(X(r),Ee);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:f/2+"em",position:"relative"},draggable:V},B,G("above"),{children:[$,e.jsx(J,{position:"above",nodeData:O}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:A.length>10?"wrap":"nowrap"},children:[ve&&e.jsxs("span",{className:"jer-key-text",style:Object.assign(Object.assign({},x("property",O)),{minWidth:`${Math.min(String(A).length+1,5)}ch`,flexShrink:A.length>10?1:0}),onDoubleClick:()=>he&&D(`key_${S}`),children:[""===A?e.jsx("span",{className:"jer-empty-string"}):A,":"]}),fe&&e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:S,defaultValue:A,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?K(e.target.value):"Escape"===e.key&&pe()},style:{width:String(A).length/1.5+.5+"em"}}),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:xe}),ge?e.jsx(P,{onOk:ue,onCancel:pe,nodeData:O}):be&&e.jsx(F,{startEdit:T?()=>D(S):void 0,handleDelete:R?()=>{i(k,N).then((e=>{e&&L({code:"DELETE_ERROR",message:e},k)}))}:void 0,enableClipboard:c,translate:v,nodeData:O}),je&&e.jsxs("div",{className:"jer-select",children:[e.jsx("select",{name:`${A}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const n=E.find((n=>n.name===e));if(n)a(n.defaultValue,N),ne(e),D(null),w({path:N,collapsed:!1});else{const n=q(k,e,v("DEFAULT_NEW_KEY",O),(null==Q?void 0:Q.CustomNode)?v("DEFAULT_STRING",O):void 0);te(n),a(n,N).then((e=>{e&&(L({code:"UPDATE_ERROR",message:e},n),D(null))}))}})(e.target.value),value:ee,children:de.map((n=>e.jsx("option",{value:n,children:n},n)))}),e.jsx("span",{className:"focus"})]}),ye&&e.jsx("span",{className:"jer-error-slug",style:x("error",O),children:I})]})]}),e.jsx(J,{position:"below",nodeData:O})]}))},X=(e,n)=>(null==n?void 0:n.CustomNode)&&(null==n?void 0:n.name)&&n.showInTypesSelector?n.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",Z=(n,t)=>{const r=t.value;switch(n){case"string":return e.jsx(v,Object.assign({},t,{value:r}));case"number":return e.jsx(E,Object.assign({},t,{value:r}));case"boolean":return e.jsx(x,Object.assign({},t,{value:r}));case"null":return e.jsx(D,Object.assign({},t));default:return e.jsx(w,Object.assign({},t))}},q=(e,n,t,r)=>{switch(n){case"string":return null!=r?r:String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;case"null":return null;case"object":return{[t]:e};case"array":return[e];default:return String(e)}},Q=t=>{const{getStyles:a}=p(),{collapseState:i,setCollapseState:l,doesPathMatch:c,currentlyEditingElement:d,setCurrentlyEditingElement:u,areChildrenBeingEdited:g}=H(),{data:m,nodeData:h,parentData:y,showCollectionCount:j,onEdit:b,onAdd:f,onDelete:v,canDragOnto:E,collapseFilter:x,collapseAnimationTime:D,onMove:w,enableClipboard:k,searchFilter:C,searchText:S,indent:O,keySort:N,showArrayIndices:A,defaultValue:T,translate:V,customNodeDefinitions:M,jsonParse:L,jsonStringify:K}=t,[W,B]=n.useState(K(m)),G=x(h),{contentRef:X,isAnimating:Z,maxHeight:q,collapsed:ee,animateCollapse:ne}=((e,t,r)=>{const[o,a]=n.useState(r?0:void 0),[i,s]=n.useState(r),l=n.useRef(!1),c=n.useRef(null),d=n.useRef(0),u=n.useRef();return{contentRef:c,isAnimating:l.current,animateCollapse:n=>{var r,o;if(i!==n){switch(window.clearTimeout(u.current),l.current=!0,n){case!0:{const e=null!==(o=null===(r=c.current)||void 0===r?void 0:r.offsetHeight)&&void 0!==o?o:0;d.current=e,a(e),setTimeout((()=>{a(0)}),5);break}case!1:a(d.current||$(e,c))}s(!i),u.current=window.setTimeout((()=>{l.current=!1,n||a(void 0)}),t)}},maxHeight:o,collapsed:i}})(m,D,G),{pathString:te,nodeData:re,path:oe,name:ae,size:ie,canEdit:se,canDelete:le,canAdd:ce,canDrag:de,error:ue,setError:pe,onError:ge,handleEditKey:me,derivedValues:he}=U({props:t,collapsed:ee}),{dragSourceProps:ye,getDropTargetProps:je,BottomDropTarget:be,DropTargetPadding:fe}=Y({canDrag:de,canDragOnto:E,path:oe,nodeData:re,onMove:w,onError:ge,translate:V}),ve=n.useRef(!G);n.useEffect((()=>{B(K(m))}),[m]),n.useEffect((()=>{const e=x(re)&&!he.isEditing;ve.current=!e,ne(e)}),[x]),n.useEffect((()=>{null!==i&&c(oe)&&(ve.current=!0,ne(i.collapsed))}),[i]);const Ee=n.useMemo((()=>e=>"function"!=typeof T?T:T(e)),[T]),{CustomNode:xe,customNodeProps:De,CustomWrapper:we,wrapperProps:ke={},hideKey:Ce,showEditTools:Se=!0,showOnEdit:Oe,showOnView:Ne,showCollectionWrapper:Ae=!0}=n.useMemo((()=>z(M,re)),[]);if(!_("collection",re,C,S)&&re.level>0)return null;const Te=Array.isArray(m)?"array":"object",Re="array"===Te?{open:"[",close:"]"}:{open:"{",close:"}"},Fe=e=>{"Enter"===e.key&&(e.metaKey||e.shiftKey||e.ctrlKey)?Pe():"Escape"===e.key&&Me()},Pe=()=>{try{const e=L(W);if(u(null),pe(null),JSON.stringify(e)===JSON.stringify(m))return;b(e,oe).then((n=>{n&&ge({code:"UPDATE_ERROR",message:n},e)}))}catch(e){ge({code:"INVALID_JSON",message:V("ERROR_INVALID_JSON",re)},W)}},Ve=oe.length>0?()=>{v(m,oe).then((e=>{e&&ge({code:"DELETE_ERROR",message:e},r(m,oe))}))}:void 0,Me=()=>{u(null),pe(null),B(K(m))},{isEditing:ze,isEditingKey:Ie,isArray:_e,canEditKey:Le}=he,Ke="when-closed"===j?ee:j,We=!ze&&Se,Be=(A||!_e)&&!Ce&&void 0!==ae,Ge=xe&&(ze&&Oe||!ze&&Ne),He=N&&"object"===Te,Ue=Object.entries(m).map((([e,n])=>["array"===Te?Number(e):e,n]));He&&Ue.sort("function"==typeof N?(e,n)=>N(e[0],n[0]):void 0);const Ye=ve.current?ze?e.jsx("div",{className:"jer-collection-text-edit",children:e.jsxs("div",{children:[e.jsx(s,{className:"jer-collection-text-area",name:te,value:W,setValue:B,isEditing:ze,handleKeyPress:Fe,styles:a("input",re)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(P,{onOk:Pe,onCancel:Me,nodeData:re})})]})}):Ue.map((([n,r],o)=>{const i={key:n,value:r,path:[...oe,n],level:oe.length+1,index:o,size:I(r)?Object.keys(r).length:1,parentData:m,fullData:re.fullData};return e.jsx("div",{className:"jer-collection-element",style:a("collectionElement",i),children:I(r)?e.jsx(Q,Object.assign({},t,{data:r,parentData:m,nodeData:i,showCollectionCount:j,canDragOnto:se}),n):e.jsx(J,Object.assign({},t,{data:r,parentData:m,nodeData:i,canDragOnto:se,showLabel:"object"===Te||A}),n)},n)})):null,$e=!!Ae&&ee;$e||(ve.current=!0);const Je=Object.assign(Object.assign({},t),{data:m,value:m,parentData:y,nodeData:re,setValue:e=>o(void 0,void 0,void 0,(function*(){return yield b(e,oe)})),handleEdit:Pe,handleCancel:Me,handleKeyPress:Fe,isEditing:ze,setIsEditing:()=>u(te),getStyles:a,canDragOnto:se}),Xe=Ge?e.jsx(xe,Object.assign({customNodeProps:De},Je,{children:Ye})):Ye,Ze=Ie?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:te,defaultValue:ae,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?me(e.target.value):"Escape"===e.key&&Me()},style:{width:String(ae).length/1.5+.5+"em"}}):Be&&e.jsx("span",{className:"jer-key-text",style:a("property",re),onDoubleClick:()=>Le&&u(`key_${te}`),children:""===ae?e.jsx("span",{className:oe.length>0?"jer-empty-string":void 0}):`${ae}:`}),qe=We&&e.jsx(F,{startEdit:se?()=>{ve.current=!0,u(te)}:void 0,handleAdd:ce?e=>{ne(!1);const n=Ee(re);"array"===Te?f(n,[...oe,m.length]).then((e=>{e&&ge({code:"ADD_ERROR",message:e},n)})):e in m?ge({code:"KEY_EXISTS",message:V("ERROR_KEY_EXISTS",re)},e):f(n,[...oe,e]).then((e=>{e&&ge({code:"ADD_ERROR",message:e},n)}))}:void 0,handleDelete:le?Ve:void 0,enableClipboard:k,type:Te,nodeData:re,translate:V}),Qe=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===oe.length?0:O/2)+"em"},a("collection",re)),{position:"relative"}),draggable:de},ye,je("above"),{children:[!ze&&be,e.jsx(fe,{position:"above",nodeData:re}),Ae?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon",onClick:e=>(e=>{if(e.getModifierState("Alt"))return ve.current=!0,void l({collapsed:!ee,path:oe});d&&d.includes(te)||(ve.current=!0,l(null),ne(!ee))})(e),children:e.jsx(R,{name:"chevron",rotate:ee,nodeData:re})}),Ze,!ze&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:a("bracket",re),children:Re.open})]}),!ze&&Ke&&e.jsx("div",{className:"jer-collection-item-count"+(Ke?" jer-visible":" jer-hidden"),style:a("itemCount",re),children:1===ie?V("ITEM_SINGLE",Object.assign(Object.assign({},re),{size:1}),1):V("ITEMS_MULTIPLE",re,ie)}),e.jsx("div",{className:"jer-brackets"+($e?" jer-visible":" jer-hidden"),style:a("bracket",re),children:Re.close}),qe]}):Ce?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[Ze,qe]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign({overflowY:$e||Z?"clip":"visible",maxHeight:g(te)?void 0:q},a("collectionInner",re)),ref:X,children:[Xe,e.jsx("div",{className:ze?"jer-collection-error-row":"jer-collection-error-row-edit",children:ue&&e.jsx("span",{className:"jer-error-slug",style:a("error",re),children:ue})}),!ze&&Ae&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},a("bracket",re)),{marginLeft:(O<3?-1:O<6?-.5:0)+"em"}),children:Re.close})]}),e.jsx(fe,{position:"below",nodeData:re})]}));return we?e.jsx(we,Object.assign({customNodeProps:ke},Je,{children:Qe})):Qe},ee={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",DEFAULT_STRING:"New data!",DEFAULT_NEW_KEY:"key"},ne=(e,n)=>(t,r,o)=>((e,n,t,r,o)=>{if(n[r]){const e=n[r](t);if(null!==e)return e}const a=r in e?e[r]:ee[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,n,r,t,o),te=({data:t,setData:r,rootName:a="root",onUpdate:i=(()=>{}),onEdit:s=i,onDelete:l=i,onAdd:c=i,onChange:d,onError:u,showErrorMessages:g=!0,enableClipboard:m=!0,indent:h=2,collapse:y=!1,collapseAnimationTime:j=300,showCollectionCount:b=!0,restrictEdit:f=!1,restrictDelete:v=!1,restrictAdd:E=!1,restrictTypeSelection:x=!1,restrictDrag:D=!0,searchFilter:w,searchText:k,searchDebounceTime:C=350,keySort:S=!1,showArrayIndices:O=!0,showStringQuotes:N=!0,defaultValue:A=null,minWidth:T=250,maxWidth:R="min(600px, 90vw)",rootFontSize:F,stringTruncate:P=250,translations:V={},className:M,id:z,customText:_={},customNodeDefinitions:L=[],jsonParse:K=JSON.parse,jsonStringify:W=(e=>JSON.stringify(e,null,2))})=>{const{getStyles:B}=p(),G=n.useCallback(oe(y),[y]),H=n.useCallback(ne(V,_),[V,_]),[U,Y]=n.useState(k),[$,X]=(({setData:e,data:t})=>{const[r,o]=n.useState(e?void 0:t),a=n.useCallback((n=>{e?e(n):o(n)}),[e]);return n.useEffect((()=>{e||o(t)}),[t]),[e?t:r,a]})({setData:r,data:t}),Z=document.querySelector(":root"),q=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(q)!==j&&(null==Z||Z.style.setProperty("--jer-expand-transition-time",j/1e3+"s")),n.useEffect((()=>{const e=setTimeout((()=>Y(k)),C);return()=>clearTimeout(e)}),[k,C]);const ee={key:a,path:[],level:0,index:0,value:$,size:"object"==typeof $&&null!==$?Object.keys($).length:1,parentData:null,fullData:$},te=(e,n)=>o(void 0,void 0,void 0,(function*(){const t=yield e(n);if(!0===t||void 0===t)return void X(n.newData);const r=ie(t)?t:["error",t],[o,a]=r;if("error"===o)return X(n.currentData),!1===a?H("ERROR_UPDATE",ee):String(a);X(a)})),se=n.useMemo((()=>oe(f)),[f]),le=n.useMemo((()=>oe(v)),[v]),ce=n.useMemo((()=>oe(E)),[E]),de=n.useMemo((()=>oe(D)),[D]),ue=n.useMemo((()=>ae(w)),[w]),pe={name:a,nodeData:ee,onEdit:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=re($,n,e,"update");if(o!==a)return yield te(s,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onDelete:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=re($,n,e,"delete");return yield te(l,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onAdd:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=re($,n,e,"add");return yield te(c,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onChange:d,onError:u,showErrorMessages:g,onMove:(e,n,t)=>o(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=re($,e,"","delete"),i=e.slice(-1)[0],l=n.slice(0,-1),c=n.slice(-1)[0];let d="number"==typeof c?"above"===t?c:c+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===n.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===t?{insertBefore:c}:{insertAfter:c},{newData:p,newValue:g}=re(o,[...l,d],a,"add",u);return yield te(s,{currentData:r,newData:p,currentValue:a,newValue:g,name:n.slice(-1)[0],path:n})})),showCollectionCount:b,collapseFilter:G,collapseAnimationTime:j,restrictEditFilter:se,restrictDeleteFilter:le,restrictAddFilter:ce,restrictTypeSelection:x,restrictDragFilter:de,canDragOnto:!1,searchFilter:ue,searchText:U,enableClipboard:m,keySort:S,showArrayIndices:O,showStringQuotes:N,indent:h,defaultValue:A,stringTruncate:P,translate:H,customNodeDefinitions:L,parentData:null,jsonParse:K,jsonStringify:W},ge=Object.assign(Object.assign({},B("container",ee)),{minWidth:T,maxWidth:R});return ge.fontSize=null!=F?F:ge.fontSize,e.jsx("div",{id:z,className:"jer-editor-container "+M,style:ge,children:I($)?e.jsx(Q,Object.assign({data:$},pe)):e.jsx(J,Object.assign({data:$,showLabel:!0},pe))})},re=(e,n,o,a,i={})=>{if(0===n.length)return{currentData:e,newData:o,currentValue:e,newValue:o};const s=Object.assign({remove:"delete"===a},i),l="add"!==a?r(e,n):void 0;return{currentData:e,newData:t(e,n,o,s),currentValue:l,newValue:"delete"!==a?o:void 0}},oe=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:n})=>n>=e:e,ae=e=>{if(void 0!==e)return"value"===e?K:"key"===e?W:"all"===e?(e,n)=>K(e,n)||W(e,n):e},ie=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),se=({value:n,setIsEditing:t,getStyles:r,customNodeProps:o,nodeData:a})=>{var i,s;const l=null!==(i=null==o?void 0:o.stringTruncate)&&void 0!==i?i:100,c=r("string",a);return e.jsx("div",{onDoubleClick:()=>t(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&t(!0)},className:"jer-value-string jer-hyperlink",style:c,children:e.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",style:{color:null!==(s=c.color)&&void 0!==s?s:void 0},children:['"',b(n,l),'"']})})},le={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:se,showOnView:!0,showOnEdit:!1};exports.assign=t,exports.extract=r,exports.IconAdd=k,exports.IconCancel=A,exports.IconChevron=T,exports.IconCopy=O,exports.IconDelete=S,exports.IconEdit=C,exports.IconOk=N,exports.JsonEditor=n=>e.jsx(u,{theme:n.theme,icons:n.icons,children:e.jsx(G,{children:e.jsx(te,Object.assign({},n))})}),exports.LinkCustomComponent=se,exports.LinkCustomNodeDefinition=le,exports.isCollection=I,exports.matchNode=K,exports.matchNodeKey=W,exports.themes=l,exports.truncate=b;
"use strict";var e=require("react/jsx-runtime"),n=require("react"),t=require("object-property-assigner"),r=require("object-property-extractor");function o(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,s)}l((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var a=[],i=[];!function(e,n){if(e&&"undefined"!=typeof document){var t,r=!0===n.prepend?"prepend":"append",o=!0===n.singleTag,s="string"==typeof n.container?document.querySelector(n.container):document.getElementsByTagName("head")[0];if(o){var l=a.indexOf(s);-1===l&&(l=a.push(s)-1,i[l]={}),t=i[l]&&i[l][r]?i[l][r]:i[l][r]=c()}else t=c();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),n.attributes)for(var t=Object.keys(n.attributes),o=0;o<t.length;o++)e.setAttribute(t[o],n.attributes[t[o]]);var a="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(a,e),e}}(":root {\n --jer-select-border: #b6b6b6;\n --jer-select-focus: #777;\n --jer-select-arrow: #777;\n --jer-form-border: 1px solid #ededf0;\n --jer-form-border-focus: 1px solid #e2e2e2;\n --jer-expand-transition-time: 0.3s;\n --jer-highlight-color: #b3d8ff;\n}\n\n.jer-visible {\n opacity: 1;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-hidden {\n opacity: 0;\n transition: var(--jer-expand-transition-time);\n}\n\n/* Select styled as per:\nhttps://moderncss.dev/custom-select-styles-with-pure-css/\n*/\n\n.jer-select select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: transparent;\n border: none;\n padding: 0 1em 0 0;\n margin: 0;\n /* width: 100%; */\n font-family: inherit;\n font-size: 0.8em;\n color: black;\n cursor: inherit;\n line-height: inherit;\n z-index: 1;\n outline: none;\n}\nselect::-ms-expand {\n display: none;\n}\n\n.jer-select {\n display: grid;\n grid-template-areas: 'select';\n align-items: center;\n position: relative;\n min-width: 12ch;\n max-width: 15ch;\n border: 1px solid var(--jer-select-border);\n border-radius: 0.25em;\n padding: 0.25em 0.5em;\n cursor: pointer;\n line-height: 1.1;\n background-color: #fff;\n background-image: linear-gradient(to top, #f9f9f9, #fff 33%);\n}\n.jer-select select,\n.jer-select::after {\n grid-area: select;\n}\n.jer-select:not(.jer-select--multiple)::after {\n content: '';\n justify-self: end;\n width: 0.8em;\n height: 0.5em;\n background-color: var(--jer-select-arrow);\n -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n}\n\nselect:focus + .focus {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n border: 1px solid var(--jer-select-focus);\n border-radius: inherit;\n}\n\n.jer-editor-container {\n position: relative;\n font-size: 16px;\n line-height: 1;\n padding: 1em;\n padding-left: 2em;\n /* margin-top: 1em; */\n /* margin-bottom: 1em; */\n border-radius: 0.5em;\n text-align: left;\n}\n\n.jer-editor-container textarea {\n color: var(--jer-input-color);\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n}\n\n.jer-editor-container textarea:focus {\n border: var(--jer-form-border-focus);\n}\n\n.jer-editor-container input {\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n font-family: inherit;\n}\n\n.jer-editor-container input:focus {\n border: var(--jer-form-border-focus);\n}\n\n/* Input highlighted text */\n.jer-editor-container ::selection {\n background-color: var(--jer-highlight-color);\n}\n\n/* .jer-editor-container select {\n color: red;\n} */\n\n/* .jer-component {\n} */\n\n.jer-collection-header-row,\n.jer-value-main-row {\n display: flex;\n min-height: 1.7em;\n gap: 0.3em;\n align-items: center;\n}\n\n.jer-collection-header-row {\n display: flex;\n flex-wrap: wrap;\n}\n\n/* .jer-brackets {\n} */\n\n/* .jer-bracket-outside {\n} */\n\n/* .jer-collection-item-count {\n} */\n\n.jer-collapse-icon {\n position: absolute;\n left: -1.2em;\n top: 0.35em;\n}\n\n.jer-collection-inner {\n position: relative;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-collection-text-edit {\n display: flex;\n flex-direction: column;\n gap: 0.3em;\n align-items: flex-start;\n}\n\n.jer-collection-text-area {\n resize: both;\n padding-top: 0.2em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-bottom: 0;\n overflow: hidden;\n max-height: 40em;\n font-family: inherit;\n font-size: 0.85em;\n}\n\n.jer-collection-input-button-row {\n display: flex;\n justify-content: flex-end;\n font-size: 150%;\n margin-top: 0.4em;\n}\n\n/* .jer-collection-element {\n} */\n\n.jer-collection-error-row {\n position: absolute;\n bottom: 0.5em;\n}\n\n/* .jer-collection-error-row-edit {\n} */\n\n.jer-error-slug {\n margin-left: 1em;\n}\n\n.jer-value-component {\n position: relative;\n}\n\n.jer-value-main-row {\n display: flex;\n gap: 0;\n}\n\n.jer-value-and-buttons {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-left: 0.5em;\n}\n\n.jer-value-error-row {\n position: absolute;\n}\n\n.jer-value-string {\n line-height: 1.3em;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.jer-hyperlink {\n text-decoration: underline;\n}\n\n.jer-input-text {\n resize: none;\n margin: 0;\n height: 1.4em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-top: 0.25em;\n padding-bottom: 0.2em;\n min-width: 6em;\n overflow: hidden;\n line-height: 1.2em;\n font-family: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-number {\n} */\n\n/* .jer-value-boolean {\n} */\n\n.jer-input-boolean {\n transform: scale(1.5);\n margin-left: 0.3em;\n margin-right: 0.3em;\n}\n\n/* .jer-value-null {\n} */\n\n/* .jer-value-object {\n} */\n\n.jer-key-text {\n word-break: break-word;\n line-height: 1.1em;\n white-space: pre-wrap;\n}\n\n.jer-key-edit {\n padding: 0 0.3em;\n font-size: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-array {\n} */\n\n.jer-value-invalid {\n opacity: 0.5;\n font-style: italic;\n}\n\n.jer-input-number {\n min-width: 3em;\n font-size: 90%;\n}\n\n/* .jer-input-component {\n} */\n\n.jer-edit-buttons,\n.jer-confirm-buttons {\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 1em;\n}\n\n.jer-input-buttons {\n gap: 0.4em;\n}\n\n.jer-edit-buttons {\n gap: 0.4em;\n margin-left: 0.5em;\n opacity: 0;\n}\n\n.jer-confirm-buttons {\n gap: 0.2em;\n margin-left: 0.4em;\n}\n\n.jer-edit-buttons:hover {\n opacity: 1;\n position: relative;\n}\n\n.jer-collection-header-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-main-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-and-buttons:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n/* .jer-input-buttons {\n} */\n\n.jer-copy-pulse {\n position: relative;\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-copy-pulse:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n.jer-copy-pulse:after {\n content: '';\n display: block;\n position: absolute;\n border-radius: 50%;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: all 0.5s;\n box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);\n}\n\n.jer-copy-pulse:active:after {\n box-shadow: 0 0 0 0 var(--jer-icon-copy-color);\n position: absolute;\n border-radius: 4em;\n left: 0;\n top: 0;\n opacity: 1;\n transition: 0s;\n}\n\n.jer-copy-pulse:active {\n top: 0.07em;\n}\n\n.jer-rotate-90 {\n transform: rotate(-90deg);\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-accordion-icon {\n /* font-size: '2em'; */\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-icon:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n/* For displaying keys that are purely <empty string> \"\" */\n.jer-empty-string::after {\n content: '<empty string>';\n font-style: italic;\n font-size: 90%;\n}\n\n.jer-drag-n-drop-padding {\n height: 0.5em;\n border: 1px dashed #e0e0e0;\n border-radius: 0.3em;\n}\n",{});const s=({className:n,name:t,value:r,setValue:o,handleKeyPress:a,styles:i})=>{if("string"!=typeof r)return null;const s="\n"===r.slice(-1)?r+".":r;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${t}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},i),rows:1,className:n,name:`${t}_textarea`,value:r,onChange:e=>o(e.target.value),autoFocus:!0,onFocus:e=>{r.length<40&&e.target.select()},onKeyDown:a}),e.jsx("span",{className:n,style:Object.assign({visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent"},i),children:s})]})},l={default:{displayName:"Default",fragments:{edit:"rgb(42, 161, 152)"},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},collection:{},collectionInner:{},collectionElement:{},dropZone:{},property:"#292929",bracket:{color:"rgb(0, 43, 54)",fontWeight:"bold"},itemCount:{color:"rgba(0, 0, 0, 0.3)",fontStyle:"italic"},string:"rgb(203, 75, 22)",number:"rgb(38, 139, 210)",boolean:"green",null:{color:"rgb(220, 50, 47)",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"rgb(0, 43, 54)",iconEdit:"edit",iconDelete:"rgb(203, 75, 22)",iconAdd:"edit",iconCopy:"rgb(38, 139, 210)",iconOk:"green",iconCancel:"rgb(203, 75, 22)"}},githubDark:{displayName:"Github Dark",styles:{container:{backgroundColor:"#0d1117",color:"white"},dropZone:"rgba(165, 214, 255, 0.17)",property:"#E6EDF3",bracket:"#56d364",itemCount:"#8B949E",string:"#A5D6FF",number:"#D2A8FF",boolean:{color:"#FF7B72",fontSize:"90%",fontWeight:"bold"},null:"green",iconCollection:"#D2A8FF",iconEdit:"#D2A8FF",iconDelete:"rgb(203, 75, 22)",iconAdd:"rgb(203, 75, 22)",iconCopy:"#A5D6FF",iconOk:"#56d364",iconCancel:"rgb(203, 75, 22)"}},githubLight:{displayName:"Github Light",styles:{container:"white",property:"#1F2328",bracket:"#00802e",itemCount:"#8B949E",string:"#0A3069",number:"#953800",boolean:{color:"#CF222E",fontSize:"90%",fontWeight:"bold"},null:"#FF7B72",iconCollection:"#8250DF",iconEdit:"#8250DF",iconDelete:"rgb(203, 75, 22)",iconAdd:"#8250DF",iconCopy:"#57606A"}},monoDark:{displayName:"Black & White",fragments:{lightText:{color:"white"},midGrey:"#5c5c5c"},styles:{container:["lightText",{backgroundColor:"black"}],dropZone:"#e0e0e029",property:"lightText",bracket:"midGrey",itemCount:"#4a4a4a",string:"#a8a8a8",number:"#666666",boolean:{color:"#848484",fontStyle:"italic"},null:"#333333",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},monoLight:{fragments:{midGrey:"#a3a3a3"},displayName:"White & Black",styles:{container:"white",property:"black",bracket:"midGrey",itemCount:"#b5b5b5",string:"#575757",number:"#999999",boolean:{color:"#7b7b7b",fontStyle:"italic"},null:"#cccccc",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},candyWrapper:{displayName:"Candy Wrapper",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},darkBlue:{color:"#2B2D42"}},styles:{container:"minty",property:"pop",dropZone:"#eb121217",bracket:"dark",itemCount:"pale",string:"mid",number:["darkBlue",{fontSize:"85%"}],boolean:["mid",{fontStyle:"italic",fontWeight:"bold",fontSize:"80%"}],null:["#cccccc",{fontWeight:"bold"}],input:{border:"1px solid rgb(115, 194, 198)"},iconCollection:"#1D3557",iconEdit:"#457B9D",iconDelete:"#E63946",iconAdd:"#2B2D42",iconCopy:"#1D3557",iconCancel:"#E63946"}},psychedelic:{displayName:"Psychedelic",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},fluroYellow:"rgb(242, 228, 21)",fluroGreen:"rgb(68, 255, 62)",hotPink:"#f7379a"},styles:{container:{backgroundColor:"unset",background:"linear-gradient(90deg, hsla(333, 100%, 53%, 1) 0%, hsla(33, 94%, 57%, 1) 100%)",color:"black"},dropZone:"fluroYellow",property:"black",bracket:"fluroYellow",itemCount:["pale",{opacity:.7}],string:"white",number:["#33d9ff",{fontSize:"90%",fontWeight:"bold"}],boolean:["fluroGreen",{fontWeight:"bold",fontSize:"80%"}],null:["black",{fontWeight:"bold",opacity:.3,backgroundColor:"rgb(255, 255, 255, 0.5)",padding:"0 0.4em",borderRadius:"0.4em"}],iconCollection:"fluroYellow",iconEdit:["black"],iconDelete:["white",{opacity:.5}],iconAdd:["white",{opacity:.5}],iconCopy:"rgb(32, 84, 242)",iconOk:"fluroGreen",iconCancel:"hotPink"}}},c=l.default,d=n.createContext({getStyles:()=>({}),icons:{}}),u=({theme:n="default",icons:t={},children:r})=>{const o=g(n);return e.jsx(d.Provider,{value:{getStyles:(e,n)=>"function"==typeof o[e]?o[e](n):o[e],icons:t},children:r})},p=()=>n.useContext(d),g=e=>{var n,t,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((n=>"default"===e?{}:"string"==typeof n?m(l[n],a):h(n)?m({fragments:{},styles:n},a):m(n,a))),s=m(c,{});Object.keys(s).forEach((e=>{const n=e;i.forEach((e=>{e[n]&&(s[n]=Object.assign(Object.assign({},s[n]),e[n]))}))}));const d=Object.assign({},s);return Object.entries(a).forEach((([e,n])=>{const t=e;d[t]=e=>{const r=n(e)||{};return Object.assign(Object.assign({},s[t]),r)}})),"function"!=typeof(null==d?void 0:d.inputHighlight)&&(null===(n=null==d?void 0:d.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(t=null==d?void 0:d.inputHighlight)||void 0===t?void 0:t.backgroundColor),"function"!=typeof(null==d?void 0:d.iconCopy)&&(null===(r=null==d?void 0:d.iconCopy)||void 0===r?void 0:r.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(o=null==d?void 0:d.iconCopy)||void 0===o?void 0:o.color),d},m=(e,n)=>{const{fragments:t,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a;if("function"==typeof o)return n[e]=o,Object.assign({},r);if("string"==typeof o){const n=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:o;return"string"==typeof n?Object.assign(Object.assign({},r),{[y[e]]:n}):Object.assign(Object.assign({},r),n)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},h=e=>!("styles"in e),y={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",property:"color",bracket:"color",itemCount:"color",string:"color",number:"color",boolean:"color",null:"color",input:"color",inputHighlight:"backgroundColor",error:"color",iconCollection:"color",iconEdit:"color",iconDelete:"color",iconAdd:"color",iconCopy:"color",iconOk:"color",iconCancel:"color"},j="**INVALID_FUNCTION**",b=(e,n=200)=>"string"==typeof e?e.length<n?e:`${e.slice(0,n-2).trim()}...`:e,f=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),v=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,stringTruncate:c,showStringQuotes:d,nodeData:u})=>{const{getStyles:g}=p(),m=f(o),h=d?'"':"";return r?e.jsx(s,{className:"jer-input-text",name:m,value:n,setValue:t,isEditing:r,handleKeyPress:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&l():i()},styles:g("input",u)}):e.jsxs("div",{id:`${m}_display`,onDoubleClick:()=>a(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&a(!0)},className:"jer-value-string",style:g("string",u),children:[h,b(n,c),h]})},x=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l})=>{const{getStyles:c}=p();return r?e.jsx("input",{className:"jer-input-number",type:"text",name:f(o),value:n,onChange:e=>t(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{switch(e.key){case"Enter":i();break;case"Escape":s();break;case"ArrowUp":e.preventDefault(),t(Number(n)+1);break;case"ArrowDown":e.preventDefault(),t(Number(n)-1)}},style:Object.assign({width:String(n).length/1.5+2+"em"},c("input",l))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:c("number",l),children:n})},E=({value:n,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l})=>{const{getStyles:c}=p();return r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:f(o),checked:n,onChange:()=>t(!n),onKeyDown:e=>{"Enter"===e.key?i():"Escape"===e.key&&s()},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:c("boolean",l),children:String(n)})},D=({value:t,isEditing:r,setIsEditing:o,handleEdit:a,handleCancel:i,nodeData:s})=>{const{getStyles:l}=p();n.useEffect((()=>(r&&document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c))),[r]);const c=e=>{"Enter"===e.key?a():"Escape"===e.key&&i()};return e.jsx("div",{onDoubleClick:()=>o(!0),className:"jer-value-null",style:l("null",s),children:String(t)})},w=({value:n})=>{let t="Error!";switch(typeof n){case"string":n===j&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:t})},k=({size:n,style:t,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),e.jsx("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]}),C=({size:n,style:t,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,transform:"translate(0, 0.5)",children:[e.jsx("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),e.jsx("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),S=({size:n,style:t,className:r})=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"})}),O=({size:n,style:t,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),e.jsx("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),e.jsx("path",{d:"M15 10l-4 4 4 4"})]}),N=({size:n,style:t,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:r,style:t,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),e.jsx("path",{d:"M22 4L12 14.01l-3-3"})]}),A=({size:n,style:t,className:r})=>e.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"})}),T=({size:n,style:t,className:r})=>e.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:n,height:n,className:r,style:t,children:e.jsx("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})}),R=({name:n,nodeData:t,rotate:r})=>{var o,a,i,s,l,c,d;const{getStyles:u,icons:g}=p(),m={size:"1.4em",className:"jer-icon"};switch(n){case"add":return null!==(o=null==g?void 0:g.add)&&void 0!==o?o:e.jsx(k,Object.assign({},m,{style:u("iconAdd",t)}));case"edit":return null!==(a=null==g?void 0:g.edit)&&void 0!==a?a:e.jsx(C,Object.assign({},m,{style:u("iconEdit",t)}));case"delete":return null!==(i=null==g?void 0:g.delete)&&void 0!==i?i:e.jsx(S,Object.assign({},m,{style:u("iconDelete",t),size:"1.45em"}));case"copy":return null!==(s=null==g?void 0:g.copy)&&void 0!==s?s:e.jsx(O,Object.assign({},m,{style:u("iconCopy",t),size:"1.2em"}));case"ok":return null!==(l=null==g?void 0:g.ok)&&void 0!==l?l:e.jsx(N,Object.assign({},m,{style:Object.assign({fontSize:"90%"},u("iconOk",t))}));case"cancel":return null!==(c=null==g?void 0:g.cancel)&&void 0!==c?c:e.jsx(A,Object.assign({},m,{style:Object.assign({fontSize:"130%"},u("iconCancel",t))}));case"chevron":return null!==(d=null==g?void 0:g.chevron)&&void 0!==d?d:e.jsx(T,{className:"jer-accordion-icon"+(r?" jer-rotate-90":""),size:"1em",style:u("iconCollection",t)});default:return e.jsx(e.Fragment,{})}},F=({startEdit:t,handleDelete:r,handleAdd:o,enableClipboard:a,type:i,customButtons:s,nodeData:l,translate:c})=>{const{getStyles:d}=p(),u=c("KEY_NEW",l),[g,m]=n.useState(!1),[h,y]=n.useState(u),{key:j,path:b,value:f}=l;return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:g?1:void 0},children:[a&&e.jsx("div",{onClick:e=>{let n,t="value",r="";if(a){if(!0===(e.ctrlKey||e.metaKey))n=V(b),r=n,t="path";else n=f,r=i?JSON.stringify(f,null,2):String(n);navigator.clipboard.writeText(r)}"function"==typeof a&&a({value:n,stringValue:r,path:b,key:j,type:t})},className:"jer-copy-pulse",children:e.jsx(R,{name:"copy",nodeData:l})}),t&&e.jsx("div",{onClick:t,children:e.jsx(R,{name:"edit",nodeData:l})}),r&&e.jsx("div",{onClick:r,children:e.jsx(R,{name:"delete",nodeData:l})}),o&&e.jsx("div",{onClick:()=>{"object"===i?m(!0):o("")},children:e.jsx(R,{name:"add",nodeData:l})}),null==s?void 0:s.map((({Element:n,onClick:t},r)=>e.jsx("div",{onClick:e=>t(l,e),children:e.jsx(n,{})},r))),g&&o&&"object"===i&&e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:h,onChange:e=>y(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&o?(m(!1),o(h),y(u)):"Escape"===e.key&&(m(!1),y(u))},style:d("input",l)}),e.jsx(P,{onOk:()=>{h&&(m(!1),o(h))},onCancel:()=>{m(!1)},nodeData:l})]})]})},P=({onOk:n,onCancel:t,nodeData:r})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[e.jsx("div",{onClick:n,children:e.jsx(R,{name:"ok",nodeData:r})}),e.jsx("div",{onClick:t,children:e.jsx(R,{name:"cancel",nodeData:r})})]}),V=e=>e.reduce(((e,n)=>"number"==typeof n?`${e}[${n}]`:""===e?n:`${e}.${n}`),""),M=["string","number","boolean","null","object","array"],z=(e=[],n)=>{const t=e.filter((({condition:e})=>e(n)));if(0===t.length)return{};const r=t[0],{element:o,wrapperElement:a,customNodeProps:i,wrapperProps:s,hideKey:l=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:p=!0}=r,g=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:a,customNodeProps:i,wrapperProps:s,hideKey:l,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:p},g)},I=e=>null!==e&&"object"==typeof e,_=(e,n,t,r="")=>{if(!t&&!r)return!0;switch(e){case"collection":if(t){if(t(n,r))return!0;if(!L(r,n,t))return!1}if(!t&&r&&!L(r,n))return!1;break;case"value":if(t&&!t(n,r))return!1;if(!t&&r&&!K(n,r))return!1}return!0},L=(e="",n,t=K)=>{const r=n.value;return Object.entries(r).some((([o,a])=>{const i=[...n.path,o],s=Object.assign(Object.assign({},n),{key:o,path:i,level:n.level+1,value:a,size:i.length,parentData:r});return I(a)?L(e,s,t):t(s,e)}))},K=(e,n="")=>{const{value:t}=e;if(null===t&&"null".includes(n.toLowerCase()))return!0;switch(typeof t){case"string":return t.toLowerCase().includes(n.toLowerCase());case"number":return!!String(t).includes(n);case"boolean":return t?"true".includes(n.toLowerCase())||"1"===n:"false".includes(n.toLowerCase())||"0"===n;default:return!1}},B=({key:e,path:n},t="")=>!!K({value:e},t)||!!n.some((e=>K({value:e},t))),W=n.createContext({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),G=({children:t})=>{const[r,o]=n.useState(null),[a,i]=n.useState(null),[s,l]=n.useState({path:null,pathString:null});return e.jsx(W.Provider,{value:{collapseState:r,setCollapseState:e=>{o(e),null!==e&&setTimeout((()=>o(null)),2e3)},doesPathMatch:e=>{if(null===r)return!1;for(const[n,t]of r.path.entries())if(t!==e[n])return!1;return!0},currentlyEditingElement:a,setCurrentlyEditingElement:i,areChildrenBeingEdited:e=>null!==a&&a.includes(e),dragSource:s,setDragSource:l},children:t})},H=()=>n.useContext(W),U=({props:e,collapsed:t})=>{const{data:r,nodeData:o,parentData:a,onEdit:i,onError:s,showErrorMessages:l,restrictEditFilter:c,restrictDeleteFilter:d,restrictAddFilter:u,restrictDragFilter:p,translate:g}=e,{currentlyEditingElement:m,setCurrentlyEditingElement:h}=H(),[y,j]=n.useState(null),b=Object.assign(Object.assign({},o),{collapsed:t}),{path:v,key:x,size:E}=b,D=f(v),w=n.useMemo((()=>!c(b)),[b]),k=n.useMemo((()=>!d(b)),[b]),C=n.useMemo((()=>!u(b)),[b]),S=n.useMemo((()=>!p(b)&&k&&null===m),[b]),O=e=>{l&&(j(e),setTimeout((()=>j(null)),2500)),console.warn("Error",e)},N=n.useMemo((()=>(e,n)=>{O(e.message),s&&s({currentData:b.fullData,errorValue:n,currentValue:r,name:x,path:v,error:e})}),[s,l]),A=m===D,T=m===`key_${D}`,R="number"==typeof v.slice(-1)[0];return{pathString:D,nodeData:b,path:v,name:x,size:E,canEdit:w,canDelete:k,canAdd:C,canDrag:S,error:y,showError:O,onError:N,setError:j,handleEditKey:e=>{if(h(null),x===e)return;if(!a)return;const n=v.slice(0,-1);if(Object.keys(a).includes(e))return void N({code:"KEY_EXISTS",message:g("ERROR_KEY_EXISTS",b)},e);const t=Object.fromEntries(Object.entries(a).map((([n,t])=>n===x?[e,t]:[n,t])));i(t,n).then((n=>{n&&N({code:"UPDATE_ERROR",message:n},e)}))},derivedValues:{isEditing:A,isEditingKey:T,isArray:R,canEditKey:null!==a&&w&&C&&k&&!R}}},Y=({canDrag:t,canDragOnto:r,path:o,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=p(),{dragSource:d,setDragSource:u}=H(),[g,m]=n.useState(!1),h=f(o),y=n.useMemo((()=>t?{onDragStart:e=>{e.stopPropagation(),u({path:o,pathString:h})},onDragEnd:e=>{e.stopPropagation(),u({path:null,pathString:null})}}:{}),[t]),j=n.useMemo((()=>e=>r?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:n=>{n.stopPropagation(),v(e),u({path:null,pathString:null}),m(!1)},onDragEnter:n=>{var t;n.stopPropagation(),h.startsWith(null!==(t=d.pathString)&&void 0!==t?t:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[d,r]),b=n.useMemo((()=>r&&null!==d.pathString?e.jsx("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:o.length}},j("below"))):null),[d,r]),v=e=>{var n,t;const r=null===(n=d.path)||void 0===n?void 0:n.slice(-1)[0],c=null===(t=d.path)||void 0===t?void 0:t.slice(0,-1).join("."),u=o.slice(0,-1).join(""),{parentData:p}=a;"string"==typeof r&&p&&!Array.isArray(p)&&Object.keys(p).includes(r)&&r in p&&c!==u?s({code:"KEY_EXISTS",message:l("ERROR_KEY_EXISTS",a)},r):i(d.path,o,e).then((e=>{e&&s({code:"UPDATE_ERROR",message:e},a.value)}))};return{dragSourceProps:y,getDropTargetProps:j,BottomDropTarget:b,DropTargetPadding:({position:n,nodeData:t})=>g===n?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",t)}):null,handleDrop:v}},$=(e,n)=>{var t,r;const o=document.getElementsByClassName("jer-editor-container"),a=parseInt(o.length>0?getComputedStyle(o[0]).getPropertyValue("line-height"):"16px"),i=(null!==(r=null===(t=n.current)||void 0===t?void 0:t.offsetWidth)&&void 0!==r?r:0)/(.5*a),s=JSON.stringify(e,null,2).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/i))).reduce(((e,n)=>e+n),0)*a;return Math.min(s+30,window.innerHeight-50)},J=t=>{const{data:r,parentData:o,onEdit:a,onDelete:i,onChange:s,onMove:l,enableClipboard:c,canDragOnto:d,restrictTypeSelection:u,searchFilter:g,searchText:m,showLabel:h,stringTruncate:y,showStringQuotes:b,indent:f,translate:v,customNodeDefinitions:x}=t,{getStyles:E}=p(),{setCurrentlyEditingElement:D,setCollapseState:w}=H(),[k,C]=n.useState("function"==typeof r?j:r),{pathString:S,nodeData:O,path:N,name:A,canEdit:T,canDelete:R,canDrag:V,error:I,onError:L,handleEditKey:K,derivedValues:B}=U({props:t}),{dragSourceProps:W,getDropTargetProps:G,BottomDropTarget:$,DropTargetPadding:J}=Y({canDrag:V,canDragOnto:d,path:N,nodeData:O,onMove:l,onError:L,translate:v}),Q=z(x,O),[ee,ne]=n.useState(X(r,Q)),te=n.useCallback((e=>{if(!s)return void C(e);const n=s({currentData:O.fullData,newValue:e,currentValue:k,name:A,path:N});C(n)}),[s]);n.useEffect((()=>{C("function"==typeof r?j:r),ne(X(r,Q))}),[r,I]);const{CustomNode:re,customNodeProps:oe,hideKey:ae,showEditTools:ie=!0,showOnEdit:se,showOnView:le}=Q,ce=[...M,...x.filter((({showInTypesSelector:e=!1,name:n})=>e&&!!n)).map((({name:e})=>e))],de=n.useMemo((()=>{if("boolean"==typeof u)return u?[]:ce;if(Array.isArray(u))return u;const e=u(O);return"boolean"==typeof e?e?[]:ce:e}),[O,u]);if(!_("value",O,g,m))return null;const ue=()=>{let e;switch(D(null),ee){case"object":e={[v("DEFAULT_NEW_KEY",O)]:k};break;case"array":e=null!=k?k:[];break;case"number":{const n=Number(k);e=isNaN(n)?0:n;break}default:e=k}a(e,N).then((n=>{n&&L({code:"UPDATE_ERROR",message:n},e)}))},pe=()=>{D(null),C(r),ne(X(r,Q))},{isEditing:ge,isEditingKey:me,canEditKey:he}=B,ye=!ge&&I,je=ge&&de.length>0,be="invalid"!==ee&&!I&&ie,fe=h&&me,ve=h&&!me&&!ae,xe={value:k,parentData:o,setValue:te,isEditing:ge,setIsEditing:T?()=>D(S):()=>{},handleEdit:ue,handleCancel:pe,path:N,stringTruncate:y,showStringQuotes:b,nodeData:O,translate:v},Ee=re&&(ge&&se||!ge&&le)?e.jsx(re,Object.assign({},t,{value:k,customNodeProps:oe,setValue:te,handleEdit:ue,handleCancel:pe,handleKeyPress:e=>{"Enter"===e.key?ue():"Escape"===e.key&&pe()},isEditing:ge,setIsEditing:()=>D(S),getStyles:E})):Z(X(r),xe);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:f/2+"em",position:"relative"},draggable:V},W,G("above"),{children:[$,e.jsx(J,{position:"above",nodeData:O}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:A.length>10?"wrap":"nowrap"},children:[ve&&e.jsxs("span",{className:"jer-key-text",style:Object.assign(Object.assign({},E("property",O)),{minWidth:`${Math.min(String(A).length+1,5)}ch`,flexShrink:A.length>10?1:0}),onDoubleClick:()=>he&&D(`key_${S}`),children:[""===A?e.jsx("span",{className:"jer-empty-string"}):A,":"]}),fe&&e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:S,defaultValue:A,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?K(e.target.value):"Escape"===e.key&&pe()},style:{width:String(A).length/1.5+.5+"em"}}),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:Ee}),ge?e.jsx(P,{onOk:ue,onCancel:pe,nodeData:O}):be&&e.jsx(F,{startEdit:T?()=>D(S):void 0,handleDelete:R?()=>{i(k,N).then((e=>{e&&L({code:"DELETE_ERROR",message:e},k)}))}:void 0,enableClipboard:c,translate:v,customButtons:t.customButtons,nodeData:O}),je&&e.jsxs("div",{className:"jer-select",children:[e.jsx("select",{name:`${A}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const n=x.find((n=>n.name===e));if(n)a(n.defaultValue,N),ne(e),D(null),w({path:N,collapsed:!1});else{const n=q(k,e,v("DEFAULT_NEW_KEY",O),(null==Q?void 0:Q.CustomNode)?v("DEFAULT_STRING",O):void 0);te(n),a(n,N).then((e=>{e&&(L({code:"UPDATE_ERROR",message:e},n),D(null))}))}})(e.target.value),value:ee,children:de.map((n=>e.jsx("option",{value:n,children:n},n)))}),e.jsx("span",{className:"focus"})]}),ye&&e.jsx("span",{className:"jer-error-slug",style:E("error",O),children:I})]})]}),e.jsx(J,{position:"below",nodeData:O})]}))},X=(e,n)=>(null==n?void 0:n.CustomNode)&&(null==n?void 0:n.name)&&n.showInTypesSelector?n.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",Z=(n,t)=>{const r=t.value;switch(n){case"string":return e.jsx(v,Object.assign({},t,{value:r}));case"number":return e.jsx(x,Object.assign({},t,{value:r}));case"boolean":return e.jsx(E,Object.assign({},t,{value:r}));case"null":return e.jsx(D,Object.assign({},t));default:return e.jsx(w,Object.assign({},t))}},q=(e,n,t,r)=>{switch(n){case"string":return null!=r?r:String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;case"null":return null;case"object":return{[t]:e};case"array":return[e];default:return String(e)}},Q=t=>{const{getStyles:a}=p(),{collapseState:i,setCollapseState:l,doesPathMatch:c,currentlyEditingElement:d,setCurrentlyEditingElement:u,areChildrenBeingEdited:g}=H(),{data:m,nodeData:h,parentData:y,showCollectionCount:j,onEdit:b,onAdd:f,onDelete:v,canDragOnto:x,collapseFilter:E,collapseAnimationTime:D,onMove:w,enableClipboard:k,searchFilter:C,searchText:S,indent:O,keySort:N,showArrayIndices:A,defaultValue:T,translate:V,customNodeDefinitions:M,jsonParse:L,jsonStringify:K}=t,[B,W]=n.useState(K(m)),G=E(h),{contentRef:X,isAnimating:Z,maxHeight:q,collapsed:ee,animateCollapse:ne}=((e,t,r)=>{const[o,a]=n.useState(r?0:void 0),[i,s]=n.useState(r),l=n.useRef(!1),c=n.useRef(null),d=n.useRef(0),u=n.useRef();return{contentRef:c,isAnimating:l.current,animateCollapse:n=>{var r,o;if(i!==n){switch(window.clearTimeout(u.current),l.current=!0,n){case!0:{const e=null!==(o=null===(r=c.current)||void 0===r?void 0:r.offsetHeight)&&void 0!==o?o:0;d.current=e,a(e),setTimeout((()=>{a(0)}),5);break}case!1:a(d.current||$(e,c))}s(!i),u.current=window.setTimeout((()=>{l.current=!1,n||a(void 0)}),t)}},maxHeight:o,collapsed:i}})(m,D,G),{pathString:te,nodeData:re,path:oe,name:ae,size:ie,canEdit:se,canDelete:le,canAdd:ce,canDrag:de,error:ue,setError:pe,onError:ge,handleEditKey:me,derivedValues:he}=U({props:t,collapsed:ee}),{dragSourceProps:ye,getDropTargetProps:je,BottomDropTarget:be,DropTargetPadding:fe}=Y({canDrag:de,canDragOnto:x,path:oe,nodeData:re,onMove:w,onError:ge,translate:V}),ve=n.useRef(!G);n.useEffect((()=>{W(K(m))}),[m]),n.useEffect((()=>{const e=E(re)&&!he.isEditing;ve.current=!e,ne(e)}),[E]),n.useEffect((()=>{null!==i&&c(oe)&&(ve.current=!0,ne(i.collapsed))}),[i]);const xe=n.useMemo((()=>e=>"function"!=typeof T?T:T(e)),[T]),{CustomNode:Ee,customNodeProps:De,CustomWrapper:we,wrapperProps:ke={},hideKey:Ce,showEditTools:Se=!0,showOnEdit:Oe,showOnView:Ne,showCollectionWrapper:Ae=!0}=n.useMemo((()=>z(M,re)),[]);if(!_("collection",re,C,S)&&re.level>0)return null;const Te=Array.isArray(m)?"array":"object",Re="array"===Te?{open:"[",close:"]"}:{open:"{",close:"}"},Fe=e=>{"Enter"===e.key&&(e.metaKey||e.shiftKey||e.ctrlKey)?Pe():"Escape"===e.key&&Me()},Pe=()=>{try{const e=L(B);if(u(null),pe(null),JSON.stringify(e)===JSON.stringify(m))return;b(e,oe).then((n=>{n&&ge({code:"UPDATE_ERROR",message:n},e)}))}catch(e){ge({code:"INVALID_JSON",message:V("ERROR_INVALID_JSON",re)},B)}},Ve=oe.length>0?()=>{v(m,oe).then((e=>{e&&ge({code:"DELETE_ERROR",message:e},r(m,oe))}))}:void 0,Me=()=>{u(null),pe(null),W(K(m))},{isEditing:ze,isEditingKey:Ie,isArray:_e,canEditKey:Le}=he,Ke="when-closed"===j?ee:j,Be=!ze&&Se,We=(A||!_e)&&!Ce&&void 0!==ae,Ge=Ee&&(ze&&Oe||!ze&&Ne),He=N&&"object"===Te,Ue=Object.entries(m).map((([e,n])=>["array"===Te?Number(e):e,n]));He&&Ue.sort("function"==typeof N?(e,n)=>N(e[0],n[0]):void 0);const Ye=ve.current?ze?e.jsx("div",{className:"jer-collection-text-edit",children:e.jsxs("div",{children:[e.jsx(s,{className:"jer-collection-text-area",name:te,value:B,setValue:W,isEditing:ze,handleKeyPress:Fe,styles:a("input",re)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(P,{onOk:Pe,onCancel:Me,nodeData:re})})]})}):Ue.map((([n,r],o)=>{const i={key:n,value:r,path:[...oe,n],level:oe.length+1,index:o,size:I(r)?Object.keys(r).length:1,parentData:m,fullData:re.fullData};return e.jsx("div",{className:"jer-collection-element",style:a("collectionElement",i),children:I(r)?e.jsx(Q,Object.assign({},t,{data:r,parentData:m,nodeData:i,showCollectionCount:j,canDragOnto:se}),n):e.jsx(J,Object.assign({},t,{data:r,parentData:m,nodeData:i,canDragOnto:se,showLabel:"object"===Te||A}),n)},n)})):null,$e=!!Ae&&ee;$e||(ve.current=!0);const Je=Object.assign(Object.assign({},t),{data:m,value:m,parentData:y,nodeData:re,setValue:e=>o(void 0,void 0,void 0,(function*(){return yield b(e,oe)})),handleEdit:Pe,handleCancel:Me,handleKeyPress:Fe,isEditing:ze,setIsEditing:()=>u(te),getStyles:a,canDragOnto:se}),Xe=Ge?e.jsx(Ee,Object.assign({customNodeProps:De},Je,{children:Ye})):Ye,Ze=Ie?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:te,defaultValue:ae,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?me(e.target.value):"Escape"===e.key&&Me()},style:{width:String(ae).length/1.5+.5+"em"}}):We&&e.jsx("span",{className:"jer-key-text",style:a("property",re),onDoubleClick:()=>Le&&u(`key_${te}`),children:""===ae?e.jsx("span",{className:oe.length>0?"jer-empty-string":void 0}):`${ae}:`}),qe=Be&&e.jsx(F,{startEdit:se?()=>{ve.current=!0,u(te)}:void 0,handleAdd:ce?e=>{ne(!1);const n=xe(re);"array"===Te?f(n,[...oe,m.length]).then((e=>{e&&ge({code:"ADD_ERROR",message:e},n)})):e in m?ge({code:"KEY_EXISTS",message:V("ERROR_KEY_EXISTS",re)},e):f(n,[...oe,e]).then((e=>{e&&ge({code:"ADD_ERROR",message:e},n)}))}:void 0,handleDelete:le?Ve:void 0,enableClipboard:k,type:Te,nodeData:re,translate:V,customButtons:t.customButtons}),Qe=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===oe.length?0:O/2)+"em"},a("collection",re)),{position:"relative"}),draggable:de},ye,je("above"),{children:[!ze&&be,e.jsx(fe,{position:"above",nodeData:re}),Ae?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon",onClick:e=>(e=>{if(e.getModifierState("Alt"))return ve.current=!0,void l({collapsed:!ee,path:oe});d&&d.includes(te)||(ve.current=!0,l(null),ne(!ee))})(e),children:e.jsx(R,{name:"chevron",rotate:ee,nodeData:re})}),Ze,!ze&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:a("bracket",re),children:Re.open})]}),!ze&&Ke&&e.jsx("div",{className:"jer-collection-item-count"+(Ke?" jer-visible":" jer-hidden"),style:a("itemCount",re),children:1===ie?V("ITEM_SINGLE",Object.assign(Object.assign({},re),{size:1}),1):V("ITEMS_MULTIPLE",re,ie)}),e.jsx("div",{className:"jer-brackets"+($e?" jer-visible":" jer-hidden"),style:a("bracket",re),children:Re.close}),qe]}):Ce?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[Ze,qe]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign({overflowY:$e||Z?"clip":"visible",maxHeight:g(te)?void 0:q},a("collectionInner",re)),ref:X,children:[Xe,e.jsx("div",{className:ze?"jer-collection-error-row":"jer-collection-error-row-edit",children:ue&&e.jsx("span",{className:"jer-error-slug",style:a("error",re),children:ue})}),!ze&&Ae&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},a("bracket",re)),{marginLeft:(O<3?-1:O<6?-.5:0)+"em"}),children:Re.close})]}),e.jsx(fe,{position:"below",nodeData:re})]}));return we?e.jsx(we,Object.assign({customNodeProps:ke},Je,{children:Qe})):Qe},ee={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",DEFAULT_STRING:"New data!",DEFAULT_NEW_KEY:"key"},ne=(e,n)=>(t,r,o)=>((e,n,t,r,o)=>{if(n[r]){const e=n[r](t);if(null!==e)return e}const a=r in e?e[r]:ee[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,n,r,t,o),te=({data:t,setData:r,rootName:a="root",onUpdate:i=(()=>{}),onEdit:s=i,onDelete:l=i,onAdd:c=i,onChange:d,onError:u,showErrorMessages:g=!0,enableClipboard:m=!0,indent:h=2,collapse:y=!1,collapseAnimationTime:j=300,showCollectionCount:b=!0,restrictEdit:f=!1,restrictDelete:v=!1,restrictAdd:x=!1,restrictTypeSelection:E=!1,restrictDrag:D=!0,searchFilter:w,searchText:k,searchDebounceTime:C=350,keySort:S=!1,showArrayIndices:O=!0,showStringQuotes:N=!0,defaultValue:A=null,minWidth:T=250,maxWidth:R="min(600px, 90vw)",rootFontSize:F,stringTruncate:P=250,translations:V={},className:M,id:z,customText:_={},customNodeDefinitions:L=[],customButtons:K=[],jsonParse:B=JSON.parse,jsonStringify:W=(e=>JSON.stringify(e,null,2))})=>{const{getStyles:G}=p(),H=n.useCallback(oe(y),[y]),U=n.useCallback(ne(V,_),[V,_]),[Y,$]=n.useState(k),[X,Z]=(({setData:e,data:t})=>{const[r,o]=n.useState(e?void 0:t),a=n.useCallback((n=>{e?e(n):o(n)}),[e]);return n.useEffect((()=>{e||o(t)}),[t]),[e?t:r,a]})({setData:r,data:t}),q=document.querySelector(":root"),ee=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(ee)!==j&&(null==q||q.style.setProperty("--jer-expand-transition-time",j/1e3+"s")),n.useEffect((()=>{const e=setTimeout((()=>$(k)),C);return()=>clearTimeout(e)}),[k,C]);const te={key:a,path:[],level:0,index:0,value:X,size:"object"==typeof X&&null!==X?Object.keys(X).length:1,parentData:null,fullData:X},se=(e,n)=>o(void 0,void 0,void 0,(function*(){const t=yield e(n);if(!0===t||void 0===t)return void Z(n.newData);const r=ie(t)?t:["error",t],[o,a]=r;if("error"===o)return Z(n.currentData),!1===a?U("ERROR_UPDATE",te):String(a);Z(a)})),le=n.useMemo((()=>oe(f)),[f]),ce=n.useMemo((()=>oe(v)),[v]),de=n.useMemo((()=>oe(x)),[x]),ue=n.useMemo((()=>oe(D)),[D]),pe=n.useMemo((()=>ae(w)),[w]),ge={name:a,nodeData:te,onEdit:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=re(X,n,e,"update");if(o!==a)return yield se(s,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onDelete:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=re(X,n,e,"delete");return yield se(l,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onAdd:(e,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=re(X,n,e,"add");return yield se(c,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onChange:d,onError:u,showErrorMessages:g,onMove:(e,n,t)=>o(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=re(X,e,"","delete"),i=e.slice(-1)[0],l=n.slice(0,-1),c=n.slice(-1)[0];let d="number"==typeof c?"above"===t?c:c+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===n.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===t?{insertBefore:c}:{insertAfter:c},{newData:p,newValue:g}=re(o,[...l,d],a,"add",u);return yield se(s,{currentData:r,newData:p,currentValue:a,newValue:g,name:n.slice(-1)[0],path:n})})),showCollectionCount:b,collapseFilter:H,collapseAnimationTime:j,restrictEditFilter:le,restrictDeleteFilter:ce,restrictAddFilter:de,restrictTypeSelection:E,restrictDragFilter:ue,canDragOnto:!1,searchFilter:pe,searchText:Y,enableClipboard:m,keySort:S,showArrayIndices:O,showStringQuotes:N,indent:h,defaultValue:A,stringTruncate:P,translate:U,customNodeDefinitions:L,customButtons:K,parentData:null,jsonParse:B,jsonStringify:W},me=Object.assign(Object.assign({},G("container",te)),{minWidth:T,maxWidth:R});return me.fontSize=null!=F?F:me.fontSize,e.jsx("div",{id:z,className:"jer-editor-container "+M,style:me,children:I(X)?e.jsx(Q,Object.assign({data:X},ge)):e.jsx(J,Object.assign({data:X,showLabel:!0},ge))})},re=(e,n,o,a,i={})=>{if(0===n.length)return{currentData:e,newData:o,currentValue:e,newValue:o};const s=Object.assign({remove:"delete"===a},i),l="add"!==a?r(e,n):void 0;return{currentData:e,newData:t(e,n,o,s),currentValue:l,newValue:"delete"!==a?o:void 0}},oe=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:n})=>n>=e:e,ae=e=>{if(void 0!==e)return"value"===e?K:"key"===e?B:"all"===e?(e,n)=>K(e,n)||B(e,n):e},ie=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),se=({value:n,setIsEditing:t,getStyles:r,customNodeProps:o,nodeData:a})=>{var i,s;const l=null!==(i=null==o?void 0:o.stringTruncate)&&void 0!==i?i:100,c=r("string",a);return e.jsx("div",{onDoubleClick:()=>t(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&t(!0)},className:"jer-value-string jer-hyperlink",style:c,children:e.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",style:{color:null!==(s=c.color)&&void 0!==s?s:void 0},children:['"',b(n,l),'"']})})},le={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:se,showOnView:!0,showOnEdit:!1};exports.assign=t,exports.extract=r,exports.IconAdd=k,exports.IconCancel=A,exports.IconChevron=T,exports.IconCopy=O,exports.IconDelete=S,exports.IconEdit=C,exports.IconOk=N,exports.JsonEditor=n=>e.jsx(u,{theme:n.theme,icons:n.icons,children:e.jsx(G,{children:e.jsx(te,Object.assign({},n))})}),exports.LinkCustomComponent=se,exports.LinkCustomNodeDefinition=le,exports.isCollection=I,exports.matchNode=K,exports.matchNodeKey=B,exports.themes=l,exports.truncate=b;

@@ -61,2 +61,3 @@ /// <reference types="react" />

customText?: CustomTextDefinitions;
customButtons?: CustomButtonDefinition[];
jsonParse?: (input: string) => JsonData;

@@ -158,2 +159,3 @@ jsonStringify?: (input: JsonData) => string;

customNodeDefinitions: CustomNodeDefinition[];
customButtons: CustomButtonDefinition[];
}

@@ -211,2 +213,6 @@ interface CollectionNodeProps extends BaseNodeProps {

}>;
interface CustomButtonDefinition {
Element: React.FC;
onClick: (nodeData: NodeData, e: React.MouseEvent) => void;
}
declare const themeableElements: readonly ["container", "collection", "collectionInner", "collectionElement", "dropZone", "property", "bracket", "itemCount", "string", "number", "boolean", "null", "input", "inputHighlight", "error", "iconCollection", "iconEdit", "iconDelete", "iconAdd", "iconCopy", "iconOk", "iconCancel"];

@@ -213,0 +219,0 @@ type ThemeableElement = (typeof themeableElements)[number];

@@ -1,1 +0,1 @@

import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import{createContext as r,useContext as o,useEffect as a,useState as i,useMemo as l,useCallback as s,useRef as c}from"react";import d from"object-property-assigner";export{default as assign}from"object-property-assigner";import u from"object-property-extractor";export{default as extract}from"object-property-extractor";function p(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function l(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,l)}s((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var g=[],m=[];!function(e,n){if(e&&"undefined"!=typeof document){var t,r=!0===n.prepend?"prepend":"append",o=!0===n.singleTag,a="string"==typeof n.container?document.querySelector(n.container):document.getElementsByTagName("head")[0];if(o){var i=g.indexOf(a);-1===i&&(i=g.push(a)-1,m[i]={}),t=m[i]&&m[i][r]?m[i][r]:m[i][r]=l()}else t=l();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function l(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),n.attributes)for(var t=Object.keys(n.attributes),o=0;o<t.length;o++)e.setAttribute(t[o],n.attributes[t[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(":root {\n --jer-select-border: #b6b6b6;\n --jer-select-focus: #777;\n --jer-select-arrow: #777;\n --jer-form-border: 1px solid #ededf0;\n --jer-form-border-focus: 1px solid #e2e2e2;\n --jer-expand-transition-time: 0.3s;\n --jer-highlight-color: #b3d8ff;\n}\n\n.jer-visible {\n opacity: 1;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-hidden {\n opacity: 0;\n transition: var(--jer-expand-transition-time);\n}\n\n/* Select styled as per:\nhttps://moderncss.dev/custom-select-styles-with-pure-css/\n*/\n\n.jer-select select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: transparent;\n border: none;\n padding: 0 1em 0 0;\n margin: 0;\n /* width: 100%; */\n font-family: inherit;\n font-size: 0.8em;\n color: black;\n cursor: inherit;\n line-height: inherit;\n z-index: 1;\n outline: none;\n}\nselect::-ms-expand {\n display: none;\n}\n\n.jer-select {\n display: grid;\n grid-template-areas: 'select';\n align-items: center;\n position: relative;\n min-width: 12ch;\n max-width: 15ch;\n border: 1px solid var(--jer-select-border);\n border-radius: 0.25em;\n padding: 0.25em 0.5em;\n cursor: pointer;\n line-height: 1.1;\n background-color: #fff;\n background-image: linear-gradient(to top, #f9f9f9, #fff 33%);\n}\n.jer-select select,\n.jer-select::after {\n grid-area: select;\n}\n.jer-select:not(.jer-select--multiple)::after {\n content: '';\n justify-self: end;\n width: 0.8em;\n height: 0.5em;\n background-color: var(--jer-select-arrow);\n -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n}\n\nselect:focus + .focus {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n border: 1px solid var(--jer-select-focus);\n border-radius: inherit;\n}\n\n.jer-editor-container {\n position: relative;\n font-size: 16px;\n line-height: 1;\n padding: 1em;\n padding-left: 2em;\n /* margin-top: 1em; */\n /* margin-bottom: 1em; */\n border-radius: 0.5em;\n text-align: left;\n}\n\n.jer-editor-container textarea {\n color: var(--jer-input-color);\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n}\n\n.jer-editor-container textarea:focus {\n border: var(--jer-form-border-focus);\n}\n\n.jer-editor-container input {\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n font-family: inherit;\n}\n\n.jer-editor-container input:focus {\n border: var(--jer-form-border-focus);\n}\n\n/* Input highlighted text */\n.jer-editor-container ::selection {\n background-color: var(--jer-highlight-color);\n}\n\n/* .jer-editor-container select {\n color: red;\n} */\n\n/* .jer-component {\n} */\n\n.jer-collection-header-row,\n.jer-value-main-row {\n display: flex;\n min-height: 1.7em;\n gap: 0.3em;\n align-items: center;\n}\n\n.jer-collection-header-row {\n display: flex;\n flex-wrap: wrap;\n}\n\n/* .jer-brackets {\n} */\n\n/* .jer-bracket-outside {\n} */\n\n/* .jer-collection-item-count {\n} */\n\n.jer-collapse-icon {\n position: absolute;\n left: -1.2em;\n top: 0.35em;\n}\n\n.jer-collection-inner {\n position: relative;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-collection-text-edit {\n display: flex;\n flex-direction: column;\n gap: 0.3em;\n align-items: flex-start;\n}\n\n.jer-collection-text-area {\n resize: both;\n padding-top: 0.2em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-bottom: 0;\n overflow: hidden;\n max-height: 40em;\n font-family: inherit;\n font-size: 0.85em;\n}\n\n.jer-collection-input-button-row {\n display: flex;\n justify-content: flex-end;\n font-size: 150%;\n margin-top: 0.4em;\n}\n\n/* .jer-collection-element {\n} */\n\n.jer-collection-error-row {\n position: absolute;\n bottom: 0.5em;\n}\n\n/* .jer-collection-error-row-edit {\n} */\n\n.jer-error-slug {\n margin-left: 1em;\n}\n\n.jer-value-component {\n position: relative;\n}\n\n.jer-value-main-row {\n display: flex;\n gap: 0;\n}\n\n.jer-value-and-buttons {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-left: 0.5em;\n}\n\n.jer-value-error-row {\n position: absolute;\n}\n\n.jer-value-string {\n line-height: 1.3em;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.jer-hyperlink {\n text-decoration: underline;\n}\n\n.jer-input-text {\n resize: none;\n margin: 0;\n height: 1.4em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-top: 0.25em;\n padding-bottom: 0.2em;\n min-width: 6em;\n overflow: hidden;\n line-height: 1.2em;\n font-family: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-number {\n} */\n\n/* .jer-value-boolean {\n} */\n\n.jer-input-boolean {\n transform: scale(1.5);\n margin-left: 0.3em;\n margin-right: 0.3em;\n}\n\n/* .jer-value-null {\n} */\n\n/* .jer-value-object {\n} */\n\n.jer-key-text {\n word-break: break-word;\n line-height: 1.1em;\n white-space: pre-wrap;\n}\n\n.jer-key-edit {\n padding: 0 0.3em;\n font-size: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-array {\n} */\n\n.jer-value-invalid {\n opacity: 0.5;\n font-style: italic;\n}\n\n.jer-input-number {\n min-width: 3em;\n font-size: 90%;\n}\n\n/* .jer-input-component {\n} */\n\n.jer-edit-buttons,\n.jer-confirm-buttons {\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 1em;\n}\n\n.jer-input-buttons {\n gap: 0.4em;\n}\n\n.jer-edit-buttons {\n gap: 0.4em;\n margin-left: 0.5em;\n opacity: 0;\n}\n\n.jer-confirm-buttons {\n gap: 0.2em;\n margin-left: 0.4em;\n}\n\n.jer-edit-buttons:hover {\n opacity: 1;\n position: relative;\n}\n\n.jer-collection-header-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-main-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-and-buttons:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n/* .jer-input-buttons {\n} */\n\n.jer-copy-pulse {\n position: relative;\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-copy-pulse:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n.jer-copy-pulse:after {\n content: '';\n display: block;\n position: absolute;\n border-radius: 50%;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: all 0.5s;\n box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);\n}\n\n.jer-copy-pulse:active:after {\n box-shadow: 0 0 0 0 var(--jer-icon-copy-color);\n position: absolute;\n border-radius: 4em;\n left: 0;\n top: 0;\n opacity: 1;\n transition: 0s;\n}\n\n.jer-copy-pulse:active {\n top: 0.07em;\n}\n\n.jer-rotate-90 {\n transform: rotate(-90deg);\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-accordion-icon {\n /* font-size: '2em'; */\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-icon:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n/* For displaying keys that are purely <empty string> \"\" */\n.jer-empty-string::after {\n content: '<empty string>';\n font-style: italic;\n font-size: 90%;\n}\n\n.jer-drag-n-drop-padding {\n height: 0.5em;\n border: 1px dashed #e0e0e0;\n border-radius: 0.3em;\n}\n",{});const h=({className:t,name:r,value:o,setValue:a,handleKeyPress:i,styles:l})=>{if("string"!=typeof o)return null;const s="\n"===o.slice(-1)?o+".":o;return e("div",{style:{display:"grid"},children:[n("textarea",{id:`${r}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},l),rows:1,className:t,name:`${r}_textarea`,value:o,onChange:e=>a(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:i}),n("span",{className:t,style:Object.assign({visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent"},l),children:s})]})},y={default:{displayName:"Default",fragments:{edit:"rgb(42, 161, 152)"},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},collection:{},collectionInner:{},collectionElement:{},dropZone:{},property:"#292929",bracket:{color:"rgb(0, 43, 54)",fontWeight:"bold"},itemCount:{color:"rgba(0, 0, 0, 0.3)",fontStyle:"italic"},string:"rgb(203, 75, 22)",number:"rgb(38, 139, 210)",boolean:"green",null:{color:"rgb(220, 50, 47)",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"rgb(0, 43, 54)",iconEdit:"edit",iconDelete:"rgb(203, 75, 22)",iconAdd:"edit",iconCopy:"rgb(38, 139, 210)",iconOk:"green",iconCancel:"rgb(203, 75, 22)"}},githubDark:{displayName:"Github Dark",styles:{container:{backgroundColor:"#0d1117",color:"white"},dropZone:"rgba(165, 214, 255, 0.17)",property:"#E6EDF3",bracket:"#56d364",itemCount:"#8B949E",string:"#A5D6FF",number:"#D2A8FF",boolean:{color:"#FF7B72",fontSize:"90%",fontWeight:"bold"},null:"green",iconCollection:"#D2A8FF",iconEdit:"#D2A8FF",iconDelete:"rgb(203, 75, 22)",iconAdd:"rgb(203, 75, 22)",iconCopy:"#A5D6FF",iconOk:"#56d364",iconCancel:"rgb(203, 75, 22)"}},githubLight:{displayName:"Github Light",styles:{container:"white",property:"#1F2328",bracket:"#00802e",itemCount:"#8B949E",string:"#0A3069",number:"#953800",boolean:{color:"#CF222E",fontSize:"90%",fontWeight:"bold"},null:"#FF7B72",iconCollection:"#8250DF",iconEdit:"#8250DF",iconDelete:"rgb(203, 75, 22)",iconAdd:"#8250DF",iconCopy:"#57606A"}},monoDark:{displayName:"Black & White",fragments:{lightText:{color:"white"},midGrey:"#5c5c5c"},styles:{container:["lightText",{backgroundColor:"black"}],dropZone:"#e0e0e029",property:"lightText",bracket:"midGrey",itemCount:"#4a4a4a",string:"#a8a8a8",number:"#666666",boolean:{color:"#848484",fontStyle:"italic"},null:"#333333",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},monoLight:{fragments:{midGrey:"#a3a3a3"},displayName:"White & Black",styles:{container:"white",property:"black",bracket:"midGrey",itemCount:"#b5b5b5",string:"#575757",number:"#999999",boolean:{color:"#7b7b7b",fontStyle:"italic"},null:"#cccccc",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},candyWrapper:{displayName:"Candy Wrapper",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},darkBlue:{color:"#2B2D42"}},styles:{container:"minty",property:"pop",dropZone:"#eb121217",bracket:"dark",itemCount:"pale",string:"mid",number:["darkBlue",{fontSize:"85%"}],boolean:["mid",{fontStyle:"italic",fontWeight:"bold",fontSize:"80%"}],null:["#cccccc",{fontWeight:"bold"}],input:{border:"1px solid rgb(115, 194, 198)"},iconCollection:"#1D3557",iconEdit:"#457B9D",iconDelete:"#E63946",iconAdd:"#2B2D42",iconCopy:"#1D3557",iconCancel:"#E63946"}},psychedelic:{displayName:"Psychedelic",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},fluroYellow:"rgb(242, 228, 21)",fluroGreen:"rgb(68, 255, 62)",hotPink:"#f7379a"},styles:{container:{backgroundColor:"unset",background:"linear-gradient(90deg, hsla(333, 100%, 53%, 1) 0%, hsla(33, 94%, 57%, 1) 100%)",color:"black"},dropZone:"fluroYellow",property:"black",bracket:"fluroYellow",itemCount:["pale",{opacity:.7}],string:"white",number:["#33d9ff",{fontSize:"90%",fontWeight:"bold"}],boolean:["fluroGreen",{fontWeight:"bold",fontSize:"80%"}],null:["black",{fontWeight:"bold",opacity:.3,backgroundColor:"rgb(255, 255, 255, 0.5)",padding:"0 0.4em",borderRadius:"0.4em"}],iconCollection:"fluroYellow",iconEdit:["black"],iconDelete:["white",{opacity:.5}],iconAdd:["white",{opacity:.5}],iconCopy:"rgb(32, 84, 242)",iconOk:"fluroGreen",iconCancel:"hotPink"}}},b=y.default,f=r({getStyles:()=>({}),icons:{}}),v=({theme:e="default",icons:t={},children:r})=>{const o=E(e);return n(f.Provider,{value:{getStyles:(e,n)=>"function"==typeof o[e]?o[e](n):o[e],icons:t},children:r})},j=()=>o(f),E=e=>{var n,t,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((n=>"default"===e?{}:"string"==typeof n?D(y[n],a):w(n)?D({fragments:{},styles:n},a):D(n,a))),l=D(b,{});Object.keys(l).forEach((e=>{const n=e;i.forEach((e=>{e[n]&&(l[n]=Object.assign(Object.assign({},l[n]),e[n]))}))}));const s=Object.assign({},l);return Object.entries(a).forEach((([e,n])=>{const t=e;s[t]=e=>{const r=n(e)||{};return Object.assign(Object.assign({},l[t]),r)}})),"function"!=typeof(null==s?void 0:s.inputHighlight)&&(null===(n=null==s?void 0:s.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(t=null==s?void 0:s.inputHighlight)||void 0===t?void 0:t.backgroundColor),"function"!=typeof(null==s?void 0:s.iconCopy)&&(null===(r=null==s?void 0:s.iconCopy)||void 0===r?void 0:r.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(o=null==s?void 0:s.iconCopy)||void 0===o?void 0:o.color),s},D=(e,n)=>{const{fragments:t,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a;if("function"==typeof o)return n[e]=o,Object.assign({},r);if("string"==typeof o){const n=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:o;return"string"==typeof n?Object.assign(Object.assign({},r),{[k[e]]:n}):Object.assign(Object.assign({},r),n)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},w=e=>!("styles"in e),k={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",property:"color",bracket:"color",itemCount:"color",string:"color",number:"color",boolean:"color",null:"color",input:"color",inputHighlight:"backgroundColor",error:"color",iconCollection:"color",iconEdit:"color",iconDelete:"color",iconAdd:"color",iconCopy:"color",iconOk:"color",iconCancel:"color"},C="**INVALID_FUNCTION**",O=(e,n=200)=>"string"==typeof e?e.length<n?e:`${e.slice(0,n-2).trim()}...`:e,S=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),N=({value:t,setValue:r,isEditing:o,path:a,setIsEditing:i,handleEdit:l,handleCancel:s,stringTruncate:c,showStringQuotes:d,nodeData:u})=>{const{getStyles:p}=j(),g=S(a),m=d?'"':"";return o?n(h,{className:"jer-input-text",name:g,value:t,setValue:r,isEditing:o,handleKeyPress:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&s():l()},styles:p("input",u)}):e("div",{id:`${g}_display`,onDoubleClick:()=>i(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&i(!0)},className:"jer-value-string",style:p("string",u),children:[m,O(t,c),m]})},x=({value:e,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s})=>{const{getStyles:c}=j();return r?n("input",{className:"jer-input-number",type:"text",name:S(o),value:e,onChange:e=>t(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:n=>{switch(n.key){case"Enter":i();break;case"Escape":l();break;case"ArrowUp":n.preventDefault(),t(Number(e)+1);break;case"ArrowDown":n.preventDefault(),t(Number(e)-1)}},style:Object.assign({width:String(e).length/1.5+2+"em"},c("input",s))}):n("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:c("number",s),children:e})},A=({value:e,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s})=>{const{getStyles:c}=j();return r?n("input",{className:"jer-input-boolean",type:"checkbox",name:S(o),checked:e,onChange:()=>t(!e),onKeyDown:e=>{"Enter"===e.key?i():"Escape"===e.key&&l()},autoFocus:!0}):n("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:c("boolean",s),children:String(e)})},T=({value:e,isEditing:t,setIsEditing:r,handleEdit:o,handleCancel:i,nodeData:l})=>{const{getStyles:s}=j();a((()=>(t&&document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c))),[t]);const c=e=>{"Enter"===e.key?o():"Escape"===e.key&&i()};return n("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:s("null",l),children:String(e)})},P=({value:e})=>{let t="Error!";switch(typeof e){case"string":e===C&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return n("span",{className:"jer-value-invalid",children:t})},V=({size:t,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:r,children:[n("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),n("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]}),R=({size:t,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:r,transform:"translate(0, 0.5)",children:[n("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),n("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),F=({size:e,style:t,className:r})=>n("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"})}),z=({size:t,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:r,children:[n("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),n("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),n("path",{d:"M15 10l-4 4 4 4"})]}),_=({size:t,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:r,children:[n("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),n("path",{d:"M22 4L12 14.01l-3-3"})]}),I=({size:e,style:t,className:r})=>n("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"})}),L=({size:e,style:t,className:r})=>n("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})}),M=({name:e,nodeData:r,rotate:o})=>{var a,i,l,s,c,d,u;const{getStyles:p,icons:g}=j(),m={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(a=null==g?void 0:g.add)&&void 0!==a?a:n(V,Object.assign({},m,{style:p("iconAdd",r)}));case"edit":return null!==(i=null==g?void 0:g.edit)&&void 0!==i?i:n(R,Object.assign({},m,{style:p("iconEdit",r)}));case"delete":return null!==(l=null==g?void 0:g.delete)&&void 0!==l?l:n(F,Object.assign({},m,{style:p("iconDelete",r),size:"1.45em"}));case"copy":return null!==(s=null==g?void 0:g.copy)&&void 0!==s?s:n(z,Object.assign({},m,{style:p("iconCopy",r),size:"1.2em"}));case"ok":return null!==(c=null==g?void 0:g.ok)&&void 0!==c?c:n(_,Object.assign({},m,{style:Object.assign({fontSize:"90%"},p("iconOk",r))}));case"cancel":return null!==(d=null==g?void 0:g.cancel)&&void 0!==d?d:n(I,Object.assign({},m,{style:Object.assign({fontSize:"130%"},p("iconCancel",r))}));case"chevron":return null!==(u=null==g?void 0:g.chevron)&&void 0!==u?u:n(L,{className:"jer-accordion-icon"+(o?" jer-rotate-90":""),size:"1em",style:p("iconCollection",r)});default:return n(t,{})}},K=({startEdit:r,handleDelete:o,handleAdd:a,enableClipboard:l,type:s,nodeData:c,translate:d})=>{const{getStyles:u}=j(),p=d("KEY_NEW",c),[g,m]=i(!1),[h,y]=i(p),{key:b,path:f,value:v}=c;return e("div",{className:"jer-edit-buttons",style:{opacity:g?1:void 0},children:[l&&n("div",{onClick:e=>{let n,t="value",r="";if(l){if(!0===(e.ctrlKey||e.metaKey))n=B(f),r=n,t="path";else n=v,r=s?JSON.stringify(v,null,2):String(n);navigator.clipboard.writeText(r)}"function"==typeof l&&l({value:n,stringValue:r,path:f,key:b,type:t})},className:"jer-copy-pulse",children:n(M,{name:"copy",nodeData:c})}),r&&n("div",{onClick:r,children:n(M,{name:"edit",nodeData:c})}),o&&n("div",{onClick:o,children:n(M,{name:"delete",nodeData:c})}),a&&n("div",{onClick:()=>{"object"===s?m(!0):a("")},children:n(M,{name:"add",nodeData:c})}),g&&a&&"object"===s&&e(t,{children:[n("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:h,onChange:e=>y(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&a?(m(!1),a(h),y(p)):"Escape"===e.key&&(m(!1),y(p))},style:u("input",c)}),n(W,{onOk:()=>{h&&(m(!1),a(h))},onCancel:()=>{m(!1)},nodeData:c})]})]})},W=({onOk:t,onCancel:r,nodeData:o})=>e("div",{className:"jer-confirm-buttons",children:[n("div",{onClick:t,children:n(M,{name:"ok",nodeData:o})}),n("div",{onClick:r,children:n(M,{name:"cancel",nodeData:o})})]}),B=e=>e.reduce(((e,n)=>"number"==typeof n?`${e}[${n}]`:""===e?n:`${e}.${n}`),""),G=["string","number","boolean","null","object","array"],H=(e=[],n)=>{const t=e.filter((({condition:e})=>e(n)));if(0===t.length)return{};const r=t[0],{element:o,wrapperElement:a,customNodeProps:i,wrapperProps:l,hideKey:s=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:p=!0}=r,g=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:a,customNodeProps:i,wrapperProps:l,hideKey:s,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:p},g)},U=e=>null!==e&&"object"==typeof e,Y=(e,n,t,r="")=>{if(!t&&!r)return!0;switch(e){case"collection":if(t){if(t(n,r))return!0;if(!$(r,n,t))return!1}if(!t&&r&&!$(r,n))return!1;break;case"value":if(t&&!t(n,r))return!1;if(!t&&r&&!J(n,r))return!1}return!0},$=(e="",n,t=J)=>{const r=n.value;return Object.entries(r).some((([o,a])=>{const i=[...n.path,o],l=Object.assign(Object.assign({},n),{key:o,path:i,level:n.level+1,value:a,size:i.length,parentData:r});return U(a)?$(e,l,t):t(l,e)}))},J=(e,n="")=>{const{value:t}=e;if(null===t&&"null".includes(n.toLowerCase()))return!0;switch(typeof t){case"string":return t.toLowerCase().includes(n.toLowerCase());case"number":return!!String(t).includes(n);case"boolean":return t?"true".includes(n.toLowerCase())||"1"===n:"false".includes(n.toLowerCase())||"0"===n;default:return!1}},X=({key:e,path:n},t="")=>!!J({value:e},t)||!!n.some((e=>J({value:e},t))),Z=r({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),Q=({children:e})=>{const[t,r]=i(null),[o,a]=i(null),[l,s]=i({path:null,pathString:null});return n(Z.Provider,{value:{collapseState:t,setCollapseState:e=>{r(e),null!==e&&setTimeout((()=>r(null)),2e3)},doesPathMatch:e=>{if(null===t)return!1;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},currentlyEditingElement:o,setCurrentlyEditingElement:a,areChildrenBeingEdited:e=>null!==o&&o.includes(e),dragSource:l,setDragSource:s},children:e})},q=()=>o(Z),ee=({props:e,collapsed:n})=>{const{data:t,nodeData:r,parentData:o,onEdit:a,onError:s,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:m}=e,{currentlyEditingElement:h,setCurrentlyEditingElement:y}=q(),[b,f]=i(null),v=Object.assign(Object.assign({},r),{collapsed:n}),{path:j,key:E,size:D}=v,w=S(j),k=l((()=>!d(v)),[v]),C=l((()=>!u(v)),[v]),O=l((()=>!p(v)),[v]),N=l((()=>!g(v)&&C&&null===h),[v]),x=e=>{c&&(f(e),setTimeout((()=>f(null)),2500)),console.warn("Error",e)},A=l((()=>(e,n)=>{x(e.message),s&&s({currentData:v.fullData,errorValue:n,currentValue:t,name:E,path:j,error:e})}),[s,c]),T=h===w,P=h===`key_${w}`,V="number"==typeof j.slice(-1)[0];return{pathString:w,nodeData:v,path:j,name:E,size:D,canEdit:k,canDelete:C,canAdd:O,canDrag:N,error:b,showError:x,onError:A,setError:f,handleEditKey:e=>{if(y(null),E===e)return;if(!o)return;const n=j.slice(0,-1);if(Object.keys(o).includes(e))return void A({code:"KEY_EXISTS",message:m("ERROR_KEY_EXISTS",v)},e);const t=Object.fromEntries(Object.entries(o).map((([n,t])=>n===E?[e,t]:[n,t])));a(t,n).then((n=>{n&&A({code:"UPDATE_ERROR",message:n},e)}))},derivedValues:{isEditing:T,isEditingKey:P,isArray:V,canEditKey:null!==o&&k&&O&&C&&!V}}},ne=({canDrag:e,canDragOnto:t,path:r,nodeData:o,onMove:a,onError:s,translate:c})=>{const{getStyles:d}=j(),{dragSource:u,setDragSource:p}=q(),[g,m]=i(!1),h=S(r),y=l((()=>e?{onDragStart:e=>{e.stopPropagation(),p({path:r,pathString:h})},onDragEnd:e=>{e.stopPropagation(),p({path:null,pathString:null})}}:{}),[e]),b=l((()=>e=>t?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:n=>{n.stopPropagation(),v(e),p({path:null,pathString:null}),m(!1)},onDragEnter:n=>{var t;n.stopPropagation(),h.startsWith(null!==(t=u.pathString)&&void 0!==t?t:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[u,t]),f=l((()=>t&&null!==u.pathString?n("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:r.length}},b("below"))):null),[u,t]),v=e=>{var n,t;const i=null===(n=u.path)||void 0===n?void 0:n.slice(-1)[0],l=null===(t=u.path)||void 0===t?void 0:t.slice(0,-1).join("."),d=r.slice(0,-1).join(""),{parentData:p}=o;"string"==typeof i&&p&&!Array.isArray(p)&&Object.keys(p).includes(i)&&i in p&&l!==d?s({code:"KEY_EXISTS",message:c("ERROR_KEY_EXISTS",o)},i):a(u.path,r,e).then((e=>{e&&s({code:"UPDATE_ERROR",message:e},o.value)}))};return{dragSourceProps:y,getDropTargetProps:b,BottomDropTarget:f,DropTargetPadding:({position:e,nodeData:t})=>g===e?n("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",t)}):null,handleDrop:v}},te=(e,n)=>{var t,r;const o=document.getElementsByClassName("jer-editor-container"),a=parseInt(o.length>0?getComputedStyle(o[0]).getPropertyValue("line-height"):"16px"),i=(null!==(r=null===(t=n.current)||void 0===t?void 0:t.offsetWidth)&&void 0!==r?r:0)/(.5*a),l=JSON.stringify(e,null,2).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/i))).reduce(((e,n)=>e+n),0)*a;return Math.min(l+30,window.innerHeight-50)},re=t=>{const{data:r,parentData:o,onEdit:c,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:m,restrictTypeSelection:h,searchFilter:y,searchText:b,showLabel:f,stringTruncate:v,showStringQuotes:E,indent:D,translate:w,customNodeDefinitions:k}=t,{getStyles:O}=j(),{setCurrentlyEditingElement:S,setCollapseState:N}=q(),[x,A]=i("function"==typeof r?C:r),{pathString:T,nodeData:P,path:V,name:R,canEdit:F,canDelete:z,canDrag:_,error:I,onError:L,handleEditKey:M,derivedValues:B}=ee({props:t}),{dragSourceProps:U,getDropTargetProps:$,BottomDropTarget:J,DropTargetPadding:X}=ne({canDrag:_,canDragOnto:m,path:V,nodeData:P,onMove:p,onError:L,translate:w}),Z=H(k,P),[Q,te]=i(oe(r,Z)),re=s((e=>{if(!u)return void A(e);const n=u({currentData:P.fullData,newValue:e,currentValue:x,name:R,path:V});A(n)}),[u]);a((()=>{A("function"==typeof r?C:r),te(oe(r,Z))}),[r,I]);const{CustomNode:le,customNodeProps:se,hideKey:ce,showEditTools:de=!0,showOnEdit:ue,showOnView:pe}=Z,ge=[...G,...k.filter((({showInTypesSelector:e=!1,name:n})=>e&&!!n)).map((({name:e})=>e))],me=l((()=>{if("boolean"==typeof h)return h?[]:ge;if(Array.isArray(h))return h;const e=h(P);return"boolean"==typeof e?e?[]:ge:e}),[P,h]);if(!Y("value",P,y,b))return null;const he=()=>{let e;switch(S(null),Q){case"object":e={[w("DEFAULT_NEW_KEY",P)]:x};break;case"array":e=null!=x?x:[];break;case"number":{const n=Number(x);e=isNaN(n)?0:n;break}default:e=x}c(e,V).then((n=>{n&&L({code:"UPDATE_ERROR",message:n},e)}))},ye=()=>{S(null),A(r),te(oe(r,Z))},{isEditing:be,isEditingKey:fe,canEditKey:ve}=B,je=!be&&I,Ee=be&&me.length>0,De="invalid"!==Q&&!I&&de,we=f&&fe,ke=f&&!fe&&!ce,Ce={value:x,parentData:o,setValue:re,isEditing:be,setIsEditing:F?()=>S(T):()=>{},handleEdit:he,handleCancel:ye,path:V,stringTruncate:v,showStringQuotes:E,nodeData:P,translate:w},Oe=le&&(be&&ue||!be&&pe)?n(le,Object.assign({},t,{value:x,customNodeProps:se,setValue:re,handleEdit:he,handleCancel:ye,handleKeyPress:e=>{"Enter"===e.key?he():"Escape"===e.key&&ye()},isEditing:be,setIsEditing:()=>S(T),getStyles:O})):ae(oe(r),Ce);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:D/2+"em",position:"relative"},draggable:_},U,$("above"),{children:[J,n(X,{position:"above",nodeData:P}),e("div",{className:"jer-value-main-row",style:{flexWrap:R.length>10?"wrap":"nowrap"},children:[ke&&e("span",{className:"jer-key-text",style:Object.assign(Object.assign({},O("property",P)),{minWidth:`${Math.min(String(R).length+1,5)}ch`,flexShrink:R.length>10?1:0}),onDoubleClick:()=>ve&&S(`key_${T}`),children:[""===R?n("span",{className:"jer-empty-string"}):R,":"]}),we&&n("input",{className:"jer-input-text jer-key-edit",type:"text",name:T,defaultValue:R,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?M(e.target.value):"Escape"===e.key&&ye()},style:{width:String(R).length/1.5+.5+"em"}}),e("div",{className:"jer-value-and-buttons",children:[n("div",{className:"jer-input-component",children:Oe}),be?n(W,{onOk:he,onCancel:ye,nodeData:P}):De&&n(K,{startEdit:F?()=>S(T):void 0,handleDelete:z?()=>{d(x,V).then((e=>{e&&L({code:"DELETE_ERROR",message:e},x)}))}:void 0,enableClipboard:g,translate:w,nodeData:P}),Ee&&e("div",{className:"jer-select",children:[n("select",{name:`${R}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const n=k.find((n=>n.name===e));if(n)c(n.defaultValue,V),te(e),S(null),N({path:V,collapsed:!1});else{const n=ie(x,e,w("DEFAULT_NEW_KEY",P),(null==Z?void 0:Z.CustomNode)?w("DEFAULT_STRING",P):void 0);re(n),c(n,V).then((e=>{e&&(L({code:"UPDATE_ERROR",message:e},n),S(null))}))}})(e.target.value),value:Q,children:me.map((e=>n("option",{value:e,children:e},e)))}),n("span",{className:"focus"})]}),je&&n("span",{className:"jer-error-slug",style:O("error",P),children:I})]})]}),n(X,{position:"below",nodeData:P})]}))},oe=(e,n)=>(null==n?void 0:n.CustomNode)&&(null==n?void 0:n.name)&&n.showInTypesSelector?n.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",ae=(e,t)=>{const r=t.value;switch(e){case"string":return n(N,Object.assign({},t,{value:r}));case"number":return n(x,Object.assign({},t,{value:r}));case"boolean":return n(A,Object.assign({},t,{value:r}));case"null":return n(T,Object.assign({},t));default:return n(P,Object.assign({},t))}},ie=(e,n,t,r)=>{switch(n){case"string":return null!=r?r:String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;case"null":return null;case"object":return{[t]:e};case"array":return[e];default:return String(e)}},le=r=>{const{getStyles:o}=j(),{collapseState:s,setCollapseState:d,doesPathMatch:g,currentlyEditingElement:m,setCurrentlyEditingElement:y,areChildrenBeingEdited:b}=q(),{data:f,nodeData:v,parentData:E,showCollectionCount:D,onEdit:w,onAdd:k,onDelete:C,canDragOnto:O,collapseFilter:S,collapseAnimationTime:N,onMove:x,enableClipboard:A,searchFilter:T,searchText:P,indent:V,keySort:R,showArrayIndices:F,defaultValue:z,translate:_,customNodeDefinitions:I,jsonParse:L,jsonStringify:B}=r,[G,$]=i(B(f)),J=S(v),{contentRef:X,isAnimating:Z,maxHeight:Q,collapsed:oe,animateCollapse:ae}=((e,n,t)=>{const[r,o]=i(t?0:void 0),[a,l]=i(t),s=c(!1),d=c(null),u=c(0),p=c();return{contentRef:d,isAnimating:s.current,animateCollapse:t=>{var r,i;if(a!==t){switch(window.clearTimeout(p.current),s.current=!0,t){case!0:{const e=null!==(i=null===(r=d.current)||void 0===r?void 0:r.offsetHeight)&&void 0!==i?i:0;u.current=e,o(e),setTimeout((()=>{o(0)}),5);break}case!1:o(u.current||te(e,d))}l(!a),p.current=window.setTimeout((()=>{s.current=!1,t||o(void 0)}),n)}},maxHeight:r,collapsed:a}})(f,N,J),{pathString:ie,nodeData:se,path:ce,name:de,size:ue,canEdit:pe,canDelete:ge,canAdd:me,canDrag:he,error:ye,setError:be,onError:fe,handleEditKey:ve,derivedValues:je}=ee({props:r,collapsed:oe}),{dragSourceProps:Ee,getDropTargetProps:De,BottomDropTarget:we,DropTargetPadding:ke}=ne({canDrag:he,canDragOnto:O,path:ce,nodeData:se,onMove:x,onError:fe,translate:_}),Ce=c(!J);a((()=>{$(B(f))}),[f]),a((()=>{const e=S(se)&&!je.isEditing;Ce.current=!e,ae(e)}),[S]),a((()=>{null!==s&&g(ce)&&(Ce.current=!0,ae(s.collapsed))}),[s]);const Oe=l((()=>e=>"function"!=typeof z?z:z(e)),[z]),{CustomNode:Se,customNodeProps:Ne,CustomWrapper:xe,wrapperProps:Ae={},hideKey:Te,showEditTools:Pe=!0,showOnEdit:Ve,showOnView:Re,showCollectionWrapper:Fe=!0}=l((()=>H(I,se)),[]);if(!Y("collection",se,T,P)&&se.level>0)return null;const ze=Array.isArray(f)?"array":"object",_e="array"===ze?{open:"[",close:"]"}:{open:"{",close:"}"},Ie=e=>{"Enter"===e.key&&(e.metaKey||e.shiftKey||e.ctrlKey)?Le():"Escape"===e.key&&Ke()},Le=()=>{try{const e=L(G);if(y(null),be(null),JSON.stringify(e)===JSON.stringify(f))return;w(e,ce).then((n=>{n&&fe({code:"UPDATE_ERROR",message:n},e)}))}catch(e){fe({code:"INVALID_JSON",message:_("ERROR_INVALID_JSON",se)},G)}},Me=ce.length>0?()=>{C(f,ce).then((e=>{e&&fe({code:"DELETE_ERROR",message:e},u(f,ce))}))}:void 0,Ke=()=>{y(null),be(null),$(B(f))},{isEditing:We,isEditingKey:Be,isArray:Ge,canEditKey:He}=je,Ue="when-closed"===D?oe:D,Ye=!We&&Pe,$e=(F||!Ge)&&!Te&&void 0!==de,Je=Se&&(We&&Ve||!We&&Re),Xe=R&&"object"===ze,Ze=Object.entries(f).map((([e,n])=>["array"===ze?Number(e):e,n]));Xe&&Ze.sort("function"==typeof R?(e,n)=>R(e[0],n[0]):void 0);const Qe=Ce.current?We?n("div",{className:"jer-collection-text-edit",children:e("div",{children:[n(h,{className:"jer-collection-text-area",name:ie,value:G,setValue:$,isEditing:We,handleKeyPress:Ie,styles:o("input",se)}),n("div",{className:"jer-collection-input-button-row",children:n(W,{onOk:Le,onCancel:Ke,nodeData:se})})]})}):Ze.map((([e,t],a)=>{const i={key:e,value:t,path:[...ce,e],level:ce.length+1,index:a,size:U(t)?Object.keys(t).length:1,parentData:f,fullData:se.fullData};return n("div",{className:"jer-collection-element",style:o("collectionElement",i),children:U(t)?n(le,Object.assign({},r,{data:t,parentData:f,nodeData:i,showCollectionCount:D,canDragOnto:pe}),e):n(re,Object.assign({},r,{data:t,parentData:f,nodeData:i,canDragOnto:pe,showLabel:"object"===ze||F}),e)},e)})):null,qe=!!Fe&&oe;qe||(Ce.current=!0);const en=Object.assign(Object.assign({},r),{data:f,value:f,parentData:E,nodeData:se,setValue:e=>p(void 0,void 0,void 0,(function*(){return yield w(e,ce)})),handleEdit:Le,handleCancel:Ke,handleKeyPress:Ie,isEditing:We,setIsEditing:()=>y(ie),getStyles:o,canDragOnto:pe}),nn=Je?n(Se,Object.assign({customNodeProps:Ne},en,{children:Qe})):Qe,tn=Be?n("input",{className:"jer-input-text jer-key-edit",type:"text",name:ie,defaultValue:de,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?ve(e.target.value):"Escape"===e.key&&Ke()},style:{width:String(de).length/1.5+.5+"em"}}):$e&&n("span",{className:"jer-key-text",style:o("property",se),onDoubleClick:()=>He&&y(`key_${ie}`),children:""===de?n("span",{className:ce.length>0?"jer-empty-string":void 0}):`${de}:`}),rn=Ye&&n(K,{startEdit:pe?()=>{Ce.current=!0,y(ie)}:void 0,handleAdd:me?e=>{ae(!1);const n=Oe(se);"array"===ze?k(n,[...ce,f.length]).then((e=>{e&&fe({code:"ADD_ERROR",message:e},n)})):e in f?fe({code:"KEY_EXISTS",message:_("ERROR_KEY_EXISTS",se)},e):k(n,[...ce,e]).then((e=>{e&&fe({code:"ADD_ERROR",message:e},n)}))}:void 0,handleDelete:ge?Me:void 0,enableClipboard:A,type:ze,nodeData:se,translate:_}),on=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===ce.length?0:V/2)+"em"},o("collection",se)),{position:"relative"}),draggable:he},Ee,De("above"),{children:[!We&&we,n(ke,{position:"above",nodeData:se}),Fe?e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e("div",{className:"jer-collection-name",children:[n("div",{className:"jer-collapse-icon",onClick:e=>(e=>{if(e.getModifierState("Alt"))return Ce.current=!0,void d({collapsed:!oe,path:ce});m&&m.includes(ie)||(Ce.current=!0,d(null),ae(!oe))})(e),children:n(M,{name:"chevron",rotate:oe,nodeData:se})}),tn,!We&&n("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",se),children:_e.open})]}),!We&&Ue&&n("div",{className:"jer-collection-item-count"+(Ue?" jer-visible":" jer-hidden"),style:o("itemCount",se),children:1===ue?_("ITEM_SINGLE",Object.assign(Object.assign({},se),{size:1}),1):_("ITEMS_MULTIPLE",se,ue)}),n("div",{className:"jer-brackets"+(qe?" jer-visible":" jer-hidden"),style:o("bracket",se),children:_e.close}),rn]}):Te?n(t,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[tn,rn]}),e("div",{className:"jer-collection-inner",style:Object.assign({overflowY:qe||Z?"clip":"visible",maxHeight:b(ie)?void 0:Q},o("collectionInner",se)),ref:X,children:[nn,n("div",{className:We?"jer-collection-error-row":"jer-collection-error-row-edit",children:ye&&n("span",{className:"jer-error-slug",style:o("error",se),children:ye})}),!We&&Fe&&n("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},o("bracket",se)),{marginLeft:(V<3?-1:V<6?-.5:0)+"em"}),children:_e.close})]}),n(ke,{position:"below",nodeData:se})]}));return xe?n(xe,Object.assign({customNodeProps:Ae},en,{children:on})):on},se={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",DEFAULT_STRING:"New data!",DEFAULT_NEW_KEY:"key"},ce=(e,n)=>(t,r,o)=>((e,n,t,r,o)=>{if(n[r]){const e=n[r](t);if(null!==e)return e}const a=r in e?e[r]:se[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,n,r,t,o),de=({data:e,setData:t,rootName:r="root",onUpdate:o=(()=>{}),onEdit:c=o,onDelete:d=o,onAdd:u=o,onChange:g,onError:m,showErrorMessages:h=!0,enableClipboard:y=!0,indent:b=2,collapse:f=!1,collapseAnimationTime:v=300,showCollectionCount:E=!0,restrictEdit:D=!1,restrictDelete:w=!1,restrictAdd:k=!1,restrictTypeSelection:C=!1,restrictDrag:O=!0,searchFilter:S,searchText:N,searchDebounceTime:x=350,keySort:A=!1,showArrayIndices:T=!0,showStringQuotes:P=!0,defaultValue:V=null,minWidth:R=250,maxWidth:F="min(600px, 90vw)",rootFontSize:z,stringTruncate:_=250,translations:I={},className:L,id:M,customText:K={},customNodeDefinitions:W=[],jsonParse:B=JSON.parse,jsonStringify:G=(e=>JSON.stringify(e,null,2))})=>{const{getStyles:H}=j(),Y=s(ge(f),[f]),$=s(ce(I,K),[I,K]),[J,X]=i(N),[Z,Q]=(({setData:e,data:n})=>{const[t,r]=i(e?void 0:n),o=s((n=>{e?e(n):r(n)}),[e]);return a((()=>{e||r(n)}),[n]),[e?n:t,o]})({setData:t,data:e}),q=document.querySelector(":root"),ee=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(ee)!==v&&(null==q||q.style.setProperty("--jer-expand-transition-time",v/1e3+"s")),a((()=>{const e=setTimeout((()=>X(N)),x);return()=>clearTimeout(e)}),[N,x]);const ne={key:r,path:[],level:0,index:0,value:Z,size:"object"==typeof Z&&null!==Z?Object.keys(Z).length:1,parentData:null,fullData:Z},te=(e,n)=>p(void 0,void 0,void 0,(function*(){const t=yield e(n);if(!0===t||void 0===t)return void Q(n.newData);const r=he(t)?t:["error",t],[o,a]=r;if("error"===o)return Q(n.currentData),!1===a?$("ERROR_UPDATE",ne):String(a);Q(a)})),oe=l((()=>ge(D)),[D]),ae=l((()=>ge(w)),[w]),ie=l((()=>ge(k)),[k]),se=l((()=>ge(O)),[O]),de=l((()=>me(S)),[S]),ue={name:r,nodeData:ne,onEdit:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=pe(Z,n,e,"update");if(o!==a)return yield te(c,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onDelete:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=pe(Z,n,e,"delete");return yield te(d,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onAdd:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=pe(Z,n,e,"add");return yield te(u,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onChange:g,onError:m,showErrorMessages:h,onMove:(e,n,t)=>p(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=pe(Z,e,"","delete"),i=e.slice(-1)[0],l=n.slice(0,-1),s=n.slice(-1)[0];let d="number"==typeof s?"above"===t?s:s+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===n.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===t?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=pe(o,[...l,d],a,"add",u);return yield te(c,{currentData:r,newData:p,currentValue:a,newValue:g,name:n.slice(-1)[0],path:n})})),showCollectionCount:E,collapseFilter:Y,collapseAnimationTime:v,restrictEditFilter:oe,restrictDeleteFilter:ae,restrictAddFilter:ie,restrictTypeSelection:C,restrictDragFilter:se,canDragOnto:!1,searchFilter:de,searchText:J,enableClipboard:y,keySort:A,showArrayIndices:T,showStringQuotes:P,indent:b,defaultValue:V,stringTruncate:_,translate:$,customNodeDefinitions:W,parentData:null,jsonParse:B,jsonStringify:G},ye=Object.assign(Object.assign({},H("container",ne)),{minWidth:R,maxWidth:F});return ye.fontSize=null!=z?z:ye.fontSize,n("div",{id:M,className:"jer-editor-container "+L,style:ye,children:U(Z)?n(le,Object.assign({data:Z},ue)):n(re,Object.assign({data:Z,showLabel:!0},ue))})},ue=e=>n(v,{theme:e.theme,icons:e.icons,children:n(Q,{children:n(de,Object.assign({},e))})}),pe=(e,n,t,r,o={})=>{if(0===n.length)return{currentData:e,newData:t,currentValue:e,newValue:t};const a=Object.assign({remove:"delete"===r},o),i="add"!==r?u(e,n):void 0;return{currentData:e,newData:d(e,n,t,a),currentValue:i,newValue:"delete"!==r?t:void 0}},ge=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:n})=>n>=e:e,me=e=>{if(void 0!==e)return"value"===e?J:"key"===e?X:"all"===e?(e,n)=>J(e,n)||X(e,n):e},he=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),ye=({value:t,setIsEditing:r,getStyles:o,customNodeProps:a,nodeData:i})=>{var l,s;const c=null!==(l=null==a?void 0:a.stringTruncate)&&void 0!==l?l:100,d=o("string",i);return n("div",{onDoubleClick:()=>r(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&r(!0)},className:"jer-value-string jer-hyperlink",style:d,children:e("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:null!==(s=d.color)&&void 0!==s?s:void 0},children:['"',O(t,c),'"']})})},be={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:ye,showOnView:!0,showOnEdit:!1};export{V as IconAdd,I as IconCancel,L as IconChevron,z as IconCopy,F as IconDelete,R as IconEdit,_ as IconOk,ue as JsonEditor,ye as LinkCustomComponent,be as LinkCustomNodeDefinition,U as isCollection,J as matchNode,X as matchNodeKey,y as themes,O as truncate};
import{jsxs as e,jsx as n,Fragment as t}from"react/jsx-runtime";import{createContext as r,useContext as o,useEffect as a,useState as i,useMemo as l,useCallback as s,useRef as c}from"react";import d from"object-property-assigner";export{default as assign}from"object-property-assigner";import u from"object-property-extractor";export{default as extract}from"object-property-extractor";function p(e,n,t,r){return new(t||(t=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function l(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,l)}s((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var g=[],m=[];!function(e,n){if(e&&"undefined"!=typeof document){var t,r=!0===n.prepend?"prepend":"append",o=!0===n.singleTag,a="string"==typeof n.container?document.querySelector(n.container):document.getElementsByTagName("head")[0];if(o){var i=g.indexOf(a);-1===i&&(i=g.push(a)-1,m[i]={}),t=m[i]&&m[i][r]?m[i][r]:m[i][r]=l()}else t=l();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function l(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),n.attributes)for(var t=Object.keys(n.attributes),o=0;o<t.length;o++)e.setAttribute(t[o],n.attributes[t[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(":root {\n --jer-select-border: #b6b6b6;\n --jer-select-focus: #777;\n --jer-select-arrow: #777;\n --jer-form-border: 1px solid #ededf0;\n --jer-form-border-focus: 1px solid #e2e2e2;\n --jer-expand-transition-time: 0.3s;\n --jer-highlight-color: #b3d8ff;\n}\n\n.jer-visible {\n opacity: 1;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-hidden {\n opacity: 0;\n transition: var(--jer-expand-transition-time);\n}\n\n/* Select styled as per:\nhttps://moderncss.dev/custom-select-styles-with-pure-css/\n*/\n\n.jer-select select {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background-color: transparent;\n border: none;\n padding: 0 1em 0 0;\n margin: 0;\n /* width: 100%; */\n font-family: inherit;\n font-size: 0.8em;\n color: black;\n cursor: inherit;\n line-height: inherit;\n z-index: 1;\n outline: none;\n}\nselect::-ms-expand {\n display: none;\n}\n\n.jer-select {\n display: grid;\n grid-template-areas: 'select';\n align-items: center;\n position: relative;\n min-width: 12ch;\n max-width: 15ch;\n border: 1px solid var(--jer-select-border);\n border-radius: 0.25em;\n padding: 0.25em 0.5em;\n cursor: pointer;\n line-height: 1.1;\n background-color: #fff;\n background-image: linear-gradient(to top, #f9f9f9, #fff 33%);\n}\n.jer-select select,\n.jer-select::after {\n grid-area: select;\n}\n.jer-select:not(.jer-select--multiple)::after {\n content: '';\n justify-self: end;\n width: 0.8em;\n height: 0.5em;\n background-color: var(--jer-select-arrow);\n -webkit-clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n clip-path: polygon(100% 0%, 0 0%, 50% 100%);\n}\n\nselect:focus + .focus {\n position: absolute;\n top: -1px;\n left: -1px;\n right: -1px;\n bottom: -1px;\n border: 1px solid var(--jer-select-focus);\n border-radius: inherit;\n}\n\n.jer-editor-container {\n position: relative;\n font-size: 16px;\n line-height: 1;\n padding: 1em;\n padding-left: 2em;\n /* margin-top: 1em; */\n /* margin-bottom: 1em; */\n border-radius: 0.5em;\n text-align: left;\n}\n\n.jer-editor-container textarea {\n color: var(--jer-input-color);\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n}\n\n.jer-editor-container textarea:focus {\n border: var(--jer-form-border-focus);\n}\n\n.jer-editor-container input {\n border: var(--jer-form-border);\n border-radius: 0.3em;\n outline: none;\n font-family: inherit;\n}\n\n.jer-editor-container input:focus {\n border: var(--jer-form-border-focus);\n}\n\n/* Input highlighted text */\n.jer-editor-container ::selection {\n background-color: var(--jer-highlight-color);\n}\n\n/* .jer-editor-container select {\n color: red;\n} */\n\n/* .jer-component {\n} */\n\n.jer-collection-header-row,\n.jer-value-main-row {\n display: flex;\n min-height: 1.7em;\n gap: 0.3em;\n align-items: center;\n}\n\n.jer-collection-header-row {\n display: flex;\n flex-wrap: wrap;\n}\n\n/* .jer-brackets {\n} */\n\n/* .jer-bracket-outside {\n} */\n\n/* .jer-collection-item-count {\n} */\n\n.jer-collapse-icon {\n position: absolute;\n left: -1.2em;\n top: 0.35em;\n}\n\n.jer-collection-inner {\n position: relative;\n transition: var(--jer-expand-transition-time);\n}\n\n.jer-collection-text-edit {\n display: flex;\n flex-direction: column;\n gap: 0.3em;\n align-items: flex-start;\n}\n\n.jer-collection-text-area {\n resize: both;\n padding-top: 0.2em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-bottom: 0;\n overflow: hidden;\n max-height: 40em;\n font-family: inherit;\n font-size: 0.85em;\n}\n\n.jer-collection-input-button-row {\n display: flex;\n justify-content: flex-end;\n font-size: 150%;\n margin-top: 0.4em;\n}\n\n/* .jer-collection-element {\n} */\n\n.jer-collection-error-row {\n position: absolute;\n bottom: 0.5em;\n}\n\n/* .jer-collection-error-row-edit {\n} */\n\n.jer-error-slug {\n margin-left: 1em;\n}\n\n.jer-value-component {\n position: relative;\n}\n\n.jer-value-main-row {\n display: flex;\n gap: 0;\n}\n\n.jer-value-and-buttons {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n padding-left: 0.5em;\n}\n\n.jer-value-error-row {\n position: absolute;\n}\n\n.jer-value-string {\n line-height: 1.3em;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.jer-hyperlink {\n text-decoration: underline;\n}\n\n.jer-input-text {\n resize: none;\n margin: 0;\n height: 1.4em;\n padding-left: 0.5em;\n padding-right: 0.5em;\n padding-top: 0.25em;\n padding-bottom: 0.2em;\n min-width: 6em;\n overflow: hidden;\n line-height: 1.2em;\n font-family: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-number {\n} */\n\n/* .jer-value-boolean {\n} */\n\n.jer-input-boolean {\n transform: scale(1.5);\n margin-left: 0.3em;\n margin-right: 0.3em;\n}\n\n/* .jer-value-null {\n} */\n\n/* .jer-value-object {\n} */\n\n.jer-key-text {\n word-break: break-word;\n line-height: 1.1em;\n white-space: pre-wrap;\n}\n\n.jer-key-edit {\n padding: 0 0.3em;\n font-size: inherit;\n font-size: 0.9em;\n}\n\n/* .jer-value-array {\n} */\n\n.jer-value-invalid {\n opacity: 0.5;\n font-style: italic;\n}\n\n.jer-input-number {\n min-width: 3em;\n font-size: 90%;\n}\n\n/* .jer-input-component {\n} */\n\n.jer-edit-buttons,\n.jer-confirm-buttons {\n display: flex;\n align-items: center;\n cursor: pointer;\n height: 1em;\n}\n\n.jer-input-buttons {\n gap: 0.4em;\n}\n\n.jer-edit-buttons {\n gap: 0.4em;\n margin-left: 0.5em;\n opacity: 0;\n}\n\n.jer-confirm-buttons {\n gap: 0.2em;\n margin-left: 0.4em;\n}\n\n.jer-edit-buttons:hover {\n opacity: 1;\n position: relative;\n}\n\n.jer-collection-header-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-main-row:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n.jer-value-and-buttons:hover > .jer-edit-buttons {\n opacity: 1;\n}\n\n/* .jer-input-buttons {\n} */\n\n.jer-copy-pulse {\n position: relative;\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-copy-pulse:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n.jer-copy-pulse:after {\n content: '';\n display: block;\n position: absolute;\n border-radius: 50%;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0;\n transition: all 0.5s;\n box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);\n}\n\n.jer-copy-pulse:active:after {\n box-shadow: 0 0 0 0 var(--jer-icon-copy-color);\n position: absolute;\n border-radius: 4em;\n left: 0;\n top: 0;\n opacity: 1;\n transition: 0s;\n}\n\n.jer-copy-pulse:active {\n top: 0.07em;\n}\n\n.jer-rotate-90 {\n transform: rotate(-90deg);\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-accordion-icon {\n /* font-size: '2em'; */\n transition: transform var(--jer-expand-transition-time);\n}\n\n.jer-icon:hover {\n opacity: 0.85;\n transition: 0.3s;\n transform: scale(1.2);\n}\n\n/* For displaying keys that are purely <empty string> \"\" */\n.jer-empty-string::after {\n content: '<empty string>';\n font-style: italic;\n font-size: 90%;\n}\n\n.jer-drag-n-drop-padding {\n height: 0.5em;\n border: 1px dashed #e0e0e0;\n border-radius: 0.3em;\n}\n",{});const h=({className:t,name:r,value:o,setValue:a,handleKeyPress:i,styles:l})=>{if("string"!=typeof o)return null;const s="\n"===o.slice(-1)?o+".":o;return e("div",{style:{display:"grid"},children:[n("textarea",{id:`${r}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},l),rows:1,className:t,name:`${r}_textarea`,value:o,onChange:e=>a(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:i}),n("span",{className:t,style:Object.assign({visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent"},l),children:s})]})},y={default:{displayName:"Default",fragments:{edit:"rgb(42, 161, 152)"},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},collection:{},collectionInner:{},collectionElement:{},dropZone:{},property:"#292929",bracket:{color:"rgb(0, 43, 54)",fontWeight:"bold"},itemCount:{color:"rgba(0, 0, 0, 0.3)",fontStyle:"italic"},string:"rgb(203, 75, 22)",number:"rgb(38, 139, 210)",boolean:"green",null:{color:"rgb(220, 50, 47)",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"rgb(0, 43, 54)",iconEdit:"edit",iconDelete:"rgb(203, 75, 22)",iconAdd:"edit",iconCopy:"rgb(38, 139, 210)",iconOk:"green",iconCancel:"rgb(203, 75, 22)"}},githubDark:{displayName:"Github Dark",styles:{container:{backgroundColor:"#0d1117",color:"white"},dropZone:"rgba(165, 214, 255, 0.17)",property:"#E6EDF3",bracket:"#56d364",itemCount:"#8B949E",string:"#A5D6FF",number:"#D2A8FF",boolean:{color:"#FF7B72",fontSize:"90%",fontWeight:"bold"},null:"green",iconCollection:"#D2A8FF",iconEdit:"#D2A8FF",iconDelete:"rgb(203, 75, 22)",iconAdd:"rgb(203, 75, 22)",iconCopy:"#A5D6FF",iconOk:"#56d364",iconCancel:"rgb(203, 75, 22)"}},githubLight:{displayName:"Github Light",styles:{container:"white",property:"#1F2328",bracket:"#00802e",itemCount:"#8B949E",string:"#0A3069",number:"#953800",boolean:{color:"#CF222E",fontSize:"90%",fontWeight:"bold"},null:"#FF7B72",iconCollection:"#8250DF",iconEdit:"#8250DF",iconDelete:"rgb(203, 75, 22)",iconAdd:"#8250DF",iconCopy:"#57606A"}},monoDark:{displayName:"Black & White",fragments:{lightText:{color:"white"},midGrey:"#5c5c5c"},styles:{container:["lightText",{backgroundColor:"black"}],dropZone:"#e0e0e029",property:"lightText",bracket:"midGrey",itemCount:"#4a4a4a",string:"#a8a8a8",number:"#666666",boolean:{color:"#848484",fontStyle:"italic"},null:"#333333",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},monoLight:{fragments:{midGrey:"#a3a3a3"},displayName:"White & Black",styles:{container:"white",property:"black",bracket:"midGrey",itemCount:"#b5b5b5",string:"#575757",number:"#999999",boolean:{color:"#7b7b7b",fontStyle:"italic"},null:"#cccccc",iconCollection:"midGrey",iconEdit:"midGrey",iconDelete:"midGrey",iconAdd:"midGrey",iconCopy:"midGrey",iconOk:"midGrey",iconCancel:"midGrey"}},candyWrapper:{displayName:"Candy Wrapper",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},darkBlue:{color:"#2B2D42"}},styles:{container:"minty",property:"pop",dropZone:"#eb121217",bracket:"dark",itemCount:"pale",string:"mid",number:["darkBlue",{fontSize:"85%"}],boolean:["mid",{fontStyle:"italic",fontWeight:"bold",fontSize:"80%"}],null:["#cccccc",{fontWeight:"bold"}],input:{border:"1px solid rgb(115, 194, 198)"},iconCollection:"#1D3557",iconEdit:"#457B9D",iconDelete:"#E63946",iconAdd:"#2B2D42",iconCopy:"#1D3557",iconCancel:"#E63946"}},psychedelic:{displayName:"Psychedelic",fragments:{minty:{backgroundColor:"#F1FAEE"},pale:{color:"#A8DADC"},mid:{color:"#457B9D"},dark:{color:"#1D3557"},pop:{color:"#E63946"},fluroYellow:"rgb(242, 228, 21)",fluroGreen:"rgb(68, 255, 62)",hotPink:"#f7379a"},styles:{container:{backgroundColor:"unset",background:"linear-gradient(90deg, hsla(333, 100%, 53%, 1) 0%, hsla(33, 94%, 57%, 1) 100%)",color:"black"},dropZone:"fluroYellow",property:"black",bracket:"fluroYellow",itemCount:["pale",{opacity:.7}],string:"white",number:["#33d9ff",{fontSize:"90%",fontWeight:"bold"}],boolean:["fluroGreen",{fontWeight:"bold",fontSize:"80%"}],null:["black",{fontWeight:"bold",opacity:.3,backgroundColor:"rgb(255, 255, 255, 0.5)",padding:"0 0.4em",borderRadius:"0.4em"}],iconCollection:"fluroYellow",iconEdit:["black"],iconDelete:["white",{opacity:.5}],iconAdd:["white",{opacity:.5}],iconCopy:"rgb(32, 84, 242)",iconOk:"fluroGreen",iconCancel:"hotPink"}}},b=y.default,f=r({getStyles:()=>({}),icons:{}}),v=({theme:e="default",icons:t={},children:r})=>{const o=E(e);return n(f.Provider,{value:{getStyles:(e,n)=>"function"==typeof o[e]?o[e](n):o[e],icons:t},children:r})},j=()=>o(f),E=e=>{var n,t,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((n=>"default"===e?{}:"string"==typeof n?D(y[n],a):w(n)?D({fragments:{},styles:n},a):D(n,a))),l=D(b,{});Object.keys(l).forEach((e=>{const n=e;i.forEach((e=>{e[n]&&(l[n]=Object.assign(Object.assign({},l[n]),e[n]))}))}));const s=Object.assign({},l);return Object.entries(a).forEach((([e,n])=>{const t=e;s[t]=e=>{const r=n(e)||{};return Object.assign(Object.assign({},l[t]),r)}})),"function"!=typeof(null==s?void 0:s.inputHighlight)&&(null===(n=null==s?void 0:s.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(t=null==s?void 0:s.inputHighlight)||void 0===t?void 0:t.backgroundColor),"function"!=typeof(null==s?void 0:s.iconCopy)&&(null===(r=null==s?void 0:s.iconCopy)||void 0===r?void 0:r.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(o=null==s?void 0:s.iconCopy)||void 0===o?void 0:o.color),s},D=(e,n)=>{const{fragments:t,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a;if("function"==typeof o)return n[e]=o,Object.assign({},r);if("string"==typeof o){const n=null!==(a=null==t?void 0:t[o])&&void 0!==a?a:o;return"string"==typeof n?Object.assign(Object.assign({},r),{[k[e]]:n}):Object.assign(Object.assign({},r),n)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},w=e=>!("styles"in e),k={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",property:"color",bracket:"color",itemCount:"color",string:"color",number:"color",boolean:"color",null:"color",input:"color",inputHighlight:"backgroundColor",error:"color",iconCollection:"color",iconEdit:"color",iconDelete:"color",iconAdd:"color",iconCopy:"color",iconOk:"color",iconCancel:"color"},C="**INVALID_FUNCTION**",O=(e,n=200)=>"string"==typeof e?e.length<n?e:`${e.slice(0,n-2).trim()}...`:e,S=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),N=({value:t,setValue:r,isEditing:o,path:a,setIsEditing:i,handleEdit:l,handleCancel:s,stringTruncate:c,showStringQuotes:d,nodeData:u})=>{const{getStyles:p}=j(),g=S(a),m=d?'"':"";return o?n(h,{className:"jer-input-text",name:g,value:t,setValue:r,isEditing:o,handleKeyPress:e=>{"Enter"!==e.key||e.shiftKey?"Escape"===e.key&&s():l()},styles:p("input",u)}):e("div",{id:`${g}_display`,onDoubleClick:()=>i(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&i(!0)},className:"jer-value-string",style:p("string",u),children:[m,O(t,c),m]})},x=({value:e,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s})=>{const{getStyles:c}=j();return r?n("input",{className:"jer-input-number",type:"text",name:S(o),value:e,onChange:e=>t(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:n=>{switch(n.key){case"Enter":i();break;case"Escape":l();break;case"ArrowUp":n.preventDefault(),t(Number(e)+1);break;case"ArrowDown":n.preventDefault(),t(Number(e)-1)}},style:Object.assign({width:String(e).length/1.5+2+"em"},c("input",s))}):n("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:c("number",s),children:e})},A=({value:e,setValue:t,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s})=>{const{getStyles:c}=j();return r?n("input",{className:"jer-input-boolean",type:"checkbox",name:S(o),checked:e,onChange:()=>t(!e),onKeyDown:e=>{"Enter"===e.key?i():"Escape"===e.key&&l()},autoFocus:!0}):n("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:c("boolean",s),children:String(e)})},T=({value:e,isEditing:t,setIsEditing:r,handleEdit:o,handleCancel:i,nodeData:l})=>{const{getStyles:s}=j();a((()=>(t&&document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c))),[t]);const c=e=>{"Enter"===e.key?o():"Escape"===e.key&&i()};return n("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:s("null",l),children:String(e)})},P=({value:e})=>{let t="Error!";switch(typeof e){case"string":e===C&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return n("span",{className:"jer-value-invalid",children:t})},V=({size:t,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:r,children:[n("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),n("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]}),R=({size:t,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:r,transform:"translate(0, 0.5)",children:[n("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),n("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),F=({size:e,style:t,className:r})=>n("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"})}),z=({size:t,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:r,children:[n("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),n("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),n("path",{d:"M15 10l-4 4 4 4"})]}),_=({size:t,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:r,children:[n("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),n("path",{d:"M22 4L12 14.01l-3-3"})]}),I=({size:e,style:t,className:r})=>n("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"})}),L=({size:e,style:t,className:r})=>n("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:r,style:t,children:n("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})}),M=({name:e,nodeData:r,rotate:o})=>{var a,i,l,s,c,d,u;const{getStyles:p,icons:g}=j(),m={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(a=null==g?void 0:g.add)&&void 0!==a?a:n(V,Object.assign({},m,{style:p("iconAdd",r)}));case"edit":return null!==(i=null==g?void 0:g.edit)&&void 0!==i?i:n(R,Object.assign({},m,{style:p("iconEdit",r)}));case"delete":return null!==(l=null==g?void 0:g.delete)&&void 0!==l?l:n(F,Object.assign({},m,{style:p("iconDelete",r),size:"1.45em"}));case"copy":return null!==(s=null==g?void 0:g.copy)&&void 0!==s?s:n(z,Object.assign({},m,{style:p("iconCopy",r),size:"1.2em"}));case"ok":return null!==(c=null==g?void 0:g.ok)&&void 0!==c?c:n(_,Object.assign({},m,{style:Object.assign({fontSize:"90%"},p("iconOk",r))}));case"cancel":return null!==(d=null==g?void 0:g.cancel)&&void 0!==d?d:n(I,Object.assign({},m,{style:Object.assign({fontSize:"130%"},p("iconCancel",r))}));case"chevron":return null!==(u=null==g?void 0:g.chevron)&&void 0!==u?u:n(L,{className:"jer-accordion-icon"+(o?" jer-rotate-90":""),size:"1em",style:p("iconCollection",r)});default:return n(t,{})}},K=({startEdit:r,handleDelete:o,handleAdd:a,enableClipboard:l,type:s,customButtons:c,nodeData:d,translate:u})=>{const{getStyles:p}=j(),g=u("KEY_NEW",d),[m,h]=i(!1),[y,b]=i(g),{key:f,path:v,value:E}=d;return e("div",{className:"jer-edit-buttons",style:{opacity:m?1:void 0},children:[l&&n("div",{onClick:e=>{let n,t="value",r="";if(l){if(!0===(e.ctrlKey||e.metaKey))n=W(v),r=n,t="path";else n=E,r=s?JSON.stringify(E,null,2):String(n);navigator.clipboard.writeText(r)}"function"==typeof l&&l({value:n,stringValue:r,path:v,key:f,type:t})},className:"jer-copy-pulse",children:n(M,{name:"copy",nodeData:d})}),r&&n("div",{onClick:r,children:n(M,{name:"edit",nodeData:d})}),o&&n("div",{onClick:o,children:n(M,{name:"delete",nodeData:d})}),a&&n("div",{onClick:()=>{"object"===s?h(!0):a("")},children:n(M,{name:"add",nodeData:d})}),null==c?void 0:c.map((({Element:e,onClick:t},r)=>n("div",{onClick:e=>t(d,e),children:n(e,{})},r))),m&&a&&"object"===s&&e(t,{children:[n("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:y,onChange:e=>b(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key&&a?(h(!1),a(y),b(g)):"Escape"===e.key&&(h(!1),b(g))},style:p("input",d)}),n(B,{onOk:()=>{y&&(h(!1),a(y))},onCancel:()=>{h(!1)},nodeData:d})]})]})},B=({onOk:t,onCancel:r,nodeData:o})=>e("div",{className:"jer-confirm-buttons",children:[n("div",{onClick:t,children:n(M,{name:"ok",nodeData:o})}),n("div",{onClick:r,children:n(M,{name:"cancel",nodeData:o})})]}),W=e=>e.reduce(((e,n)=>"number"==typeof n?`${e}[${n}]`:""===e?n:`${e}.${n}`),""),G=["string","number","boolean","null","object","array"],H=(e=[],n)=>{const t=e.filter((({condition:e})=>e(n)));if(0===t.length)return{};const r=t[0],{element:o,wrapperElement:a,customNodeProps:i,wrapperProps:l,hideKey:s=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:p=!0}=r,g=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:a,customNodeProps:i,wrapperProps:l,hideKey:s,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:p},g)},U=e=>null!==e&&"object"==typeof e,Y=(e,n,t,r="")=>{if(!t&&!r)return!0;switch(e){case"collection":if(t){if(t(n,r))return!0;if(!$(r,n,t))return!1}if(!t&&r&&!$(r,n))return!1;break;case"value":if(t&&!t(n,r))return!1;if(!t&&r&&!J(n,r))return!1}return!0},$=(e="",n,t=J)=>{const r=n.value;return Object.entries(r).some((([o,a])=>{const i=[...n.path,o],l=Object.assign(Object.assign({},n),{key:o,path:i,level:n.level+1,value:a,size:i.length,parentData:r});return U(a)?$(e,l,t):t(l,e)}))},J=(e,n="")=>{const{value:t}=e;if(null===t&&"null".includes(n.toLowerCase()))return!0;switch(typeof t){case"string":return t.toLowerCase().includes(n.toLowerCase());case"number":return!!String(t).includes(n);case"boolean":return t?"true".includes(n.toLowerCase())||"1"===n:"false".includes(n.toLowerCase())||"0"===n;default:return!1}},X=({key:e,path:n},t="")=>!!J({value:e},t)||!!n.some((e=>J({value:e},t))),Z=r({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),Q=({children:e})=>{const[t,r]=i(null),[o,a]=i(null),[l,s]=i({path:null,pathString:null});return n(Z.Provider,{value:{collapseState:t,setCollapseState:e=>{r(e),null!==e&&setTimeout((()=>r(null)),2e3)},doesPathMatch:e=>{if(null===t)return!1;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},currentlyEditingElement:o,setCurrentlyEditingElement:a,areChildrenBeingEdited:e=>null!==o&&o.includes(e),dragSource:l,setDragSource:s},children:e})},q=()=>o(Z),ee=({props:e,collapsed:n})=>{const{data:t,nodeData:r,parentData:o,onEdit:a,onError:s,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:m}=e,{currentlyEditingElement:h,setCurrentlyEditingElement:y}=q(),[b,f]=i(null),v=Object.assign(Object.assign({},r),{collapsed:n}),{path:j,key:E,size:D}=v,w=S(j),k=l((()=>!d(v)),[v]),C=l((()=>!u(v)),[v]),O=l((()=>!p(v)),[v]),N=l((()=>!g(v)&&C&&null===h),[v]),x=e=>{c&&(f(e),setTimeout((()=>f(null)),2500)),console.warn("Error",e)},A=l((()=>(e,n)=>{x(e.message),s&&s({currentData:v.fullData,errorValue:n,currentValue:t,name:E,path:j,error:e})}),[s,c]),T=h===w,P=h===`key_${w}`,V="number"==typeof j.slice(-1)[0];return{pathString:w,nodeData:v,path:j,name:E,size:D,canEdit:k,canDelete:C,canAdd:O,canDrag:N,error:b,showError:x,onError:A,setError:f,handleEditKey:e=>{if(y(null),E===e)return;if(!o)return;const n=j.slice(0,-1);if(Object.keys(o).includes(e))return void A({code:"KEY_EXISTS",message:m("ERROR_KEY_EXISTS",v)},e);const t=Object.fromEntries(Object.entries(o).map((([n,t])=>n===E?[e,t]:[n,t])));a(t,n).then((n=>{n&&A({code:"UPDATE_ERROR",message:n},e)}))},derivedValues:{isEditing:T,isEditingKey:P,isArray:V,canEditKey:null!==o&&k&&O&&C&&!V}}},ne=({canDrag:e,canDragOnto:t,path:r,nodeData:o,onMove:a,onError:s,translate:c})=>{const{getStyles:d}=j(),{dragSource:u,setDragSource:p}=q(),[g,m]=i(!1),h=S(r),y=l((()=>e?{onDragStart:e=>{e.stopPropagation(),p({path:r,pathString:h})},onDragEnd:e=>{e.stopPropagation(),p({path:null,pathString:null})}}:{}),[e]),b=l((()=>e=>t?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:n=>{n.stopPropagation(),v(e),p({path:null,pathString:null}),m(!1)},onDragEnter:n=>{var t;n.stopPropagation(),h.startsWith(null!==(t=u.pathString)&&void 0!==t?t:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[u,t]),f=l((()=>t&&null!==u.pathString?n("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:r.length}},b("below"))):null),[u,t]),v=e=>{var n,t;const i=null===(n=u.path)||void 0===n?void 0:n.slice(-1)[0],l=null===(t=u.path)||void 0===t?void 0:t.slice(0,-1).join("."),d=r.slice(0,-1).join(""),{parentData:p}=o;"string"==typeof i&&p&&!Array.isArray(p)&&Object.keys(p).includes(i)&&i in p&&l!==d?s({code:"KEY_EXISTS",message:c("ERROR_KEY_EXISTS",o)},i):a(u.path,r,e).then((e=>{e&&s({code:"UPDATE_ERROR",message:e},o.value)}))};return{dragSourceProps:y,getDropTargetProps:b,BottomDropTarget:f,DropTargetPadding:({position:e,nodeData:t})=>g===e?n("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",t)}):null,handleDrop:v}},te=(e,n)=>{var t,r;const o=document.getElementsByClassName("jer-editor-container"),a=parseInt(o.length>0?getComputedStyle(o[0]).getPropertyValue("line-height"):"16px"),i=(null!==(r=null===(t=n.current)||void 0===t?void 0:t.offsetWidth)&&void 0!==r?r:0)/(.5*a),l=JSON.stringify(e,null,2).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/i))).reduce(((e,n)=>e+n),0)*a;return Math.min(l+30,window.innerHeight-50)},re=t=>{const{data:r,parentData:o,onEdit:c,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:m,restrictTypeSelection:h,searchFilter:y,searchText:b,showLabel:f,stringTruncate:v,showStringQuotes:E,indent:D,translate:w,customNodeDefinitions:k}=t,{getStyles:O}=j(),{setCurrentlyEditingElement:S,setCollapseState:N}=q(),[x,A]=i("function"==typeof r?C:r),{pathString:T,nodeData:P,path:V,name:R,canEdit:F,canDelete:z,canDrag:_,error:I,onError:L,handleEditKey:M,derivedValues:W}=ee({props:t}),{dragSourceProps:U,getDropTargetProps:$,BottomDropTarget:J,DropTargetPadding:X}=ne({canDrag:_,canDragOnto:m,path:V,nodeData:P,onMove:p,onError:L,translate:w}),Z=H(k,P),[Q,te]=i(oe(r,Z)),re=s((e=>{if(!u)return void A(e);const n=u({currentData:P.fullData,newValue:e,currentValue:x,name:R,path:V});A(n)}),[u]);a((()=>{A("function"==typeof r?C:r),te(oe(r,Z))}),[r,I]);const{CustomNode:le,customNodeProps:se,hideKey:ce,showEditTools:de=!0,showOnEdit:ue,showOnView:pe}=Z,ge=[...G,...k.filter((({showInTypesSelector:e=!1,name:n})=>e&&!!n)).map((({name:e})=>e))],me=l((()=>{if("boolean"==typeof h)return h?[]:ge;if(Array.isArray(h))return h;const e=h(P);return"boolean"==typeof e?e?[]:ge:e}),[P,h]);if(!Y("value",P,y,b))return null;const he=()=>{let e;switch(S(null),Q){case"object":e={[w("DEFAULT_NEW_KEY",P)]:x};break;case"array":e=null!=x?x:[];break;case"number":{const n=Number(x);e=isNaN(n)?0:n;break}default:e=x}c(e,V).then((n=>{n&&L({code:"UPDATE_ERROR",message:n},e)}))},ye=()=>{S(null),A(r),te(oe(r,Z))},{isEditing:be,isEditingKey:fe,canEditKey:ve}=W,je=!be&&I,Ee=be&&me.length>0,De="invalid"!==Q&&!I&&de,we=f&&fe,ke=f&&!fe&&!ce,Ce={value:x,parentData:o,setValue:re,isEditing:be,setIsEditing:F?()=>S(T):()=>{},handleEdit:he,handleCancel:ye,path:V,stringTruncate:v,showStringQuotes:E,nodeData:P,translate:w},Oe=le&&(be&&ue||!be&&pe)?n(le,Object.assign({},t,{value:x,customNodeProps:se,setValue:re,handleEdit:he,handleCancel:ye,handleKeyPress:e=>{"Enter"===e.key?he():"Escape"===e.key&&ye()},isEditing:be,setIsEditing:()=>S(T),getStyles:O})):ae(oe(r),Ce);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:D/2+"em",position:"relative"},draggable:_},U,$("above"),{children:[J,n(X,{position:"above",nodeData:P}),e("div",{className:"jer-value-main-row",style:{flexWrap:R.length>10?"wrap":"nowrap"},children:[ke&&e("span",{className:"jer-key-text",style:Object.assign(Object.assign({},O("property",P)),{minWidth:`${Math.min(String(R).length+1,5)}ch`,flexShrink:R.length>10?1:0}),onDoubleClick:()=>ve&&S(`key_${T}`),children:[""===R?n("span",{className:"jer-empty-string"}):R,":"]}),we&&n("input",{className:"jer-input-text jer-key-edit",type:"text",name:T,defaultValue:R,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?M(e.target.value):"Escape"===e.key&&ye()},style:{width:String(R).length/1.5+.5+"em"}}),e("div",{className:"jer-value-and-buttons",children:[n("div",{className:"jer-input-component",children:Oe}),be?n(B,{onOk:he,onCancel:ye,nodeData:P}):De&&n(K,{startEdit:F?()=>S(T):void 0,handleDelete:z?()=>{d(x,V).then((e=>{e&&L({code:"DELETE_ERROR",message:e},x)}))}:void 0,enableClipboard:g,translate:w,customButtons:t.customButtons,nodeData:P}),Ee&&e("div",{className:"jer-select",children:[n("select",{name:`${R}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const n=k.find((n=>n.name===e));if(n)c(n.defaultValue,V),te(e),S(null),N({path:V,collapsed:!1});else{const n=ie(x,e,w("DEFAULT_NEW_KEY",P),(null==Z?void 0:Z.CustomNode)?w("DEFAULT_STRING",P):void 0);re(n),c(n,V).then((e=>{e&&(L({code:"UPDATE_ERROR",message:e},n),S(null))}))}})(e.target.value),value:Q,children:me.map((e=>n("option",{value:e,children:e},e)))}),n("span",{className:"focus"})]}),je&&n("span",{className:"jer-error-slug",style:O("error",P),children:I})]})]}),n(X,{position:"below",nodeData:P})]}))},oe=(e,n)=>(null==n?void 0:n.CustomNode)&&(null==n?void 0:n.name)&&n.showInTypesSelector?n.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",ae=(e,t)=>{const r=t.value;switch(e){case"string":return n(N,Object.assign({},t,{value:r}));case"number":return n(x,Object.assign({},t,{value:r}));case"boolean":return n(A,Object.assign({},t,{value:r}));case"null":return n(T,Object.assign({},t));default:return n(P,Object.assign({},t))}},ie=(e,n,t,r)=>{switch(n){case"string":return null!=r?r:String(e);case"number":{const n=Number(e);return isNaN(n)?0:n}case"boolean":return!!e;case"null":return null;case"object":return{[t]:e};case"array":return[e];default:return String(e)}},le=r=>{const{getStyles:o}=j(),{collapseState:s,setCollapseState:d,doesPathMatch:g,currentlyEditingElement:m,setCurrentlyEditingElement:y,areChildrenBeingEdited:b}=q(),{data:f,nodeData:v,parentData:E,showCollectionCount:D,onEdit:w,onAdd:k,onDelete:C,canDragOnto:O,collapseFilter:S,collapseAnimationTime:N,onMove:x,enableClipboard:A,searchFilter:T,searchText:P,indent:V,keySort:R,showArrayIndices:F,defaultValue:z,translate:_,customNodeDefinitions:I,jsonParse:L,jsonStringify:W}=r,[G,$]=i(W(f)),J=S(v),{contentRef:X,isAnimating:Z,maxHeight:Q,collapsed:oe,animateCollapse:ae}=((e,n,t)=>{const[r,o]=i(t?0:void 0),[a,l]=i(t),s=c(!1),d=c(null),u=c(0),p=c();return{contentRef:d,isAnimating:s.current,animateCollapse:t=>{var r,i;if(a!==t){switch(window.clearTimeout(p.current),s.current=!0,t){case!0:{const e=null!==(i=null===(r=d.current)||void 0===r?void 0:r.offsetHeight)&&void 0!==i?i:0;u.current=e,o(e),setTimeout((()=>{o(0)}),5);break}case!1:o(u.current||te(e,d))}l(!a),p.current=window.setTimeout((()=>{s.current=!1,t||o(void 0)}),n)}},maxHeight:r,collapsed:a}})(f,N,J),{pathString:ie,nodeData:se,path:ce,name:de,size:ue,canEdit:pe,canDelete:ge,canAdd:me,canDrag:he,error:ye,setError:be,onError:fe,handleEditKey:ve,derivedValues:je}=ee({props:r,collapsed:oe}),{dragSourceProps:Ee,getDropTargetProps:De,BottomDropTarget:we,DropTargetPadding:ke}=ne({canDrag:he,canDragOnto:O,path:ce,nodeData:se,onMove:x,onError:fe,translate:_}),Ce=c(!J);a((()=>{$(W(f))}),[f]),a((()=>{const e=S(se)&&!je.isEditing;Ce.current=!e,ae(e)}),[S]),a((()=>{null!==s&&g(ce)&&(Ce.current=!0,ae(s.collapsed))}),[s]);const Oe=l((()=>e=>"function"!=typeof z?z:z(e)),[z]),{CustomNode:Se,customNodeProps:Ne,CustomWrapper:xe,wrapperProps:Ae={},hideKey:Te,showEditTools:Pe=!0,showOnEdit:Ve,showOnView:Re,showCollectionWrapper:Fe=!0}=l((()=>H(I,se)),[]);if(!Y("collection",se,T,P)&&se.level>0)return null;const ze=Array.isArray(f)?"array":"object",_e="array"===ze?{open:"[",close:"]"}:{open:"{",close:"}"},Ie=e=>{"Enter"===e.key&&(e.metaKey||e.shiftKey||e.ctrlKey)?Le():"Escape"===e.key&&Ke()},Le=()=>{try{const e=L(G);if(y(null),be(null),JSON.stringify(e)===JSON.stringify(f))return;w(e,ce).then((n=>{n&&fe({code:"UPDATE_ERROR",message:n},e)}))}catch(e){fe({code:"INVALID_JSON",message:_("ERROR_INVALID_JSON",se)},G)}},Me=ce.length>0?()=>{C(f,ce).then((e=>{e&&fe({code:"DELETE_ERROR",message:e},u(f,ce))}))}:void 0,Ke=()=>{y(null),be(null),$(W(f))},{isEditing:Be,isEditingKey:We,isArray:Ge,canEditKey:He}=je,Ue="when-closed"===D?oe:D,Ye=!Be&&Pe,$e=(F||!Ge)&&!Te&&void 0!==de,Je=Se&&(Be&&Ve||!Be&&Re),Xe=R&&"object"===ze,Ze=Object.entries(f).map((([e,n])=>["array"===ze?Number(e):e,n]));Xe&&Ze.sort("function"==typeof R?(e,n)=>R(e[0],n[0]):void 0);const Qe=Ce.current?Be?n("div",{className:"jer-collection-text-edit",children:e("div",{children:[n(h,{className:"jer-collection-text-area",name:ie,value:G,setValue:$,isEditing:Be,handleKeyPress:Ie,styles:o("input",se)}),n("div",{className:"jer-collection-input-button-row",children:n(B,{onOk:Le,onCancel:Ke,nodeData:se})})]})}):Ze.map((([e,t],a)=>{const i={key:e,value:t,path:[...ce,e],level:ce.length+1,index:a,size:U(t)?Object.keys(t).length:1,parentData:f,fullData:se.fullData};return n("div",{className:"jer-collection-element",style:o("collectionElement",i),children:U(t)?n(le,Object.assign({},r,{data:t,parentData:f,nodeData:i,showCollectionCount:D,canDragOnto:pe}),e):n(re,Object.assign({},r,{data:t,parentData:f,nodeData:i,canDragOnto:pe,showLabel:"object"===ze||F}),e)},e)})):null,qe=!!Fe&&oe;qe||(Ce.current=!0);const en=Object.assign(Object.assign({},r),{data:f,value:f,parentData:E,nodeData:se,setValue:e=>p(void 0,void 0,void 0,(function*(){return yield w(e,ce)})),handleEdit:Le,handleCancel:Ke,handleKeyPress:Ie,isEditing:Be,setIsEditing:()=>y(ie),getStyles:o,canDragOnto:pe}),nn=Je?n(Se,Object.assign({customNodeProps:Ne},en,{children:Qe})):Qe,tn=We?n("input",{className:"jer-input-text jer-key-edit",type:"text",name:ie,defaultValue:de,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{"Enter"===e.key?ve(e.target.value):"Escape"===e.key&&Ke()},style:{width:String(de).length/1.5+.5+"em"}}):$e&&n("span",{className:"jer-key-text",style:o("property",se),onDoubleClick:()=>He&&y(`key_${ie}`),children:""===de?n("span",{className:ce.length>0?"jer-empty-string":void 0}):`${de}:`}),rn=Ye&&n(K,{startEdit:pe?()=>{Ce.current=!0,y(ie)}:void 0,handleAdd:me?e=>{ae(!1);const n=Oe(se);"array"===ze?k(n,[...ce,f.length]).then((e=>{e&&fe({code:"ADD_ERROR",message:e},n)})):e in f?fe({code:"KEY_EXISTS",message:_("ERROR_KEY_EXISTS",se)},e):k(n,[...ce,e]).then((e=>{e&&fe({code:"ADD_ERROR",message:e},n)}))}:void 0,handleDelete:ge?Me:void 0,enableClipboard:A,type:ze,nodeData:se,translate:_,customButtons:r.customButtons}),on=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===ce.length?0:V/2)+"em"},o("collection",se)),{position:"relative"}),draggable:he},Ee,De("above"),{children:[!Be&&we,n(ke,{position:"above",nodeData:se}),Fe?e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e("div",{className:"jer-collection-name",children:[n("div",{className:"jer-collapse-icon",onClick:e=>(e=>{if(e.getModifierState("Alt"))return Ce.current=!0,void d({collapsed:!oe,path:ce});m&&m.includes(ie)||(Ce.current=!0,d(null),ae(!oe))})(e),children:n(M,{name:"chevron",rotate:oe,nodeData:se})}),tn,!Be&&n("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",se),children:_e.open})]}),!Be&&Ue&&n("div",{className:"jer-collection-item-count"+(Ue?" jer-visible":" jer-hidden"),style:o("itemCount",se),children:1===ue?_("ITEM_SINGLE",Object.assign(Object.assign({},se),{size:1}),1):_("ITEMS_MULTIPLE",se,ue)}),n("div",{className:"jer-brackets"+(qe?" jer-visible":" jer-hidden"),style:o("bracket",se),children:_e.close}),rn]}):Te?n(t,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[tn,rn]}),e("div",{className:"jer-collection-inner",style:Object.assign({overflowY:qe||Z?"clip":"visible",maxHeight:b(ie)?void 0:Q},o("collectionInner",se)),ref:X,children:[nn,n("div",{className:Be?"jer-collection-error-row":"jer-collection-error-row-edit",children:ye&&n("span",{className:"jer-error-slug",style:o("error",se),children:ye})}),!Be&&Fe&&n("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},o("bracket",se)),{marginLeft:(V<3?-1:V<6?-.5:0)+"em"}),children:_e.close})]}),n(ke,{position:"below",nodeData:se})]}));return xe?n(xe,Object.assign({customNodeProps:Ae},en,{children:on})):on},se={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",DEFAULT_STRING:"New data!",DEFAULT_NEW_KEY:"key"},ce=(e,n)=>(t,r,o)=>((e,n,t,r,o)=>{if(n[r]){const e=n[r](t);if(null!==e)return e}const a=r in e?e[r]:se[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,n,r,t,o),de=({data:e,setData:t,rootName:r="root",onUpdate:o=(()=>{}),onEdit:c=o,onDelete:d=o,onAdd:u=o,onChange:g,onError:m,showErrorMessages:h=!0,enableClipboard:y=!0,indent:b=2,collapse:f=!1,collapseAnimationTime:v=300,showCollectionCount:E=!0,restrictEdit:D=!1,restrictDelete:w=!1,restrictAdd:k=!1,restrictTypeSelection:C=!1,restrictDrag:O=!0,searchFilter:S,searchText:N,searchDebounceTime:x=350,keySort:A=!1,showArrayIndices:T=!0,showStringQuotes:P=!0,defaultValue:V=null,minWidth:R=250,maxWidth:F="min(600px, 90vw)",rootFontSize:z,stringTruncate:_=250,translations:I={},className:L,id:M,customText:K={},customNodeDefinitions:B=[],customButtons:W=[],jsonParse:G=JSON.parse,jsonStringify:H=(e=>JSON.stringify(e,null,2))})=>{const{getStyles:Y}=j(),$=s(ge(f),[f]),J=s(ce(I,K),[I,K]),[X,Z]=i(N),[Q,q]=(({setData:e,data:n})=>{const[t,r]=i(e?void 0:n),o=s((n=>{e?e(n):r(n)}),[e]);return a((()=>{e||r(n)}),[n]),[e?n:t,o]})({setData:t,data:e}),ee=document.querySelector(":root"),ne=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(ne)!==v&&(null==ee||ee.style.setProperty("--jer-expand-transition-time",v/1e3+"s")),a((()=>{const e=setTimeout((()=>Z(N)),x);return()=>clearTimeout(e)}),[N,x]);const te={key:r,path:[],level:0,index:0,value:Q,size:"object"==typeof Q&&null!==Q?Object.keys(Q).length:1,parentData:null,fullData:Q},oe=(e,n)=>p(void 0,void 0,void 0,(function*(){const t=yield e(n);if(!0===t||void 0===t)return void q(n.newData);const r=he(t)?t:["error",t],[o,a]=r;if("error"===o)return q(n.currentData),!1===a?J("ERROR_UPDATE",te):String(a);q(a)})),ae=l((()=>ge(D)),[D]),ie=l((()=>ge(w)),[w]),se=l((()=>ge(k)),[k]),de=l((()=>ge(O)),[O]),ue=l((()=>me(S)),[S]),ye={name:r,nodeData:te,onEdit:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=pe(Q,n,e,"update");if(o!==a)return yield oe(c,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onDelete:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=pe(Q,n,e,"delete");return yield oe(d,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onAdd:(e,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:t,newData:r,currentValue:o,newValue:a}=pe(Q,n,e,"add");return yield oe(u,{currentData:t,newData:r,currentValue:o,newValue:a,name:n.slice(-1)[0],path:n})})),onChange:g,onError:m,showErrorMessages:h,onMove:(e,n,t)=>p(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=pe(Q,e,"","delete"),i=e.slice(-1)[0],l=n.slice(0,-1),s=n.slice(-1)[0];let d="number"==typeof s?"above"===t?s:s+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===n.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===t?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=pe(o,[...l,d],a,"add",u);return yield oe(c,{currentData:r,newData:p,currentValue:a,newValue:g,name:n.slice(-1)[0],path:n})})),showCollectionCount:E,collapseFilter:$,collapseAnimationTime:v,restrictEditFilter:ae,restrictDeleteFilter:ie,restrictAddFilter:se,restrictTypeSelection:C,restrictDragFilter:de,canDragOnto:!1,searchFilter:ue,searchText:X,enableClipboard:y,keySort:A,showArrayIndices:T,showStringQuotes:P,indent:b,defaultValue:V,stringTruncate:_,translate:J,customNodeDefinitions:B,customButtons:W,parentData:null,jsonParse:G,jsonStringify:H},be=Object.assign(Object.assign({},Y("container",te)),{minWidth:R,maxWidth:F});return be.fontSize=null!=z?z:be.fontSize,n("div",{id:M,className:"jer-editor-container "+L,style:be,children:U(Q)?n(le,Object.assign({data:Q},ye)):n(re,Object.assign({data:Q,showLabel:!0},ye))})},ue=e=>n(v,{theme:e.theme,icons:e.icons,children:n(Q,{children:n(de,Object.assign({},e))})}),pe=(e,n,t,r,o={})=>{if(0===n.length)return{currentData:e,newData:t,currentValue:e,newValue:t};const a=Object.assign({remove:"delete"===r},o),i="add"!==r?u(e,n):void 0;return{currentData:e,newData:d(e,n,t,a),currentValue:i,newValue:"delete"!==r?t:void 0}},ge=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:n})=>n>=e:e,me=e=>{if(void 0!==e)return"value"===e?J:"key"===e?X:"all"===e?(e,n)=>J(e,n)||X(e,n):e},he=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),ye=({value:t,setIsEditing:r,getStyles:o,customNodeProps:a,nodeData:i})=>{var l,s;const c=null!==(l=null==a?void 0:a.stringTruncate)&&void 0!==l?l:100,d=o("string",i);return n("div",{onDoubleClick:()=>r(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&r(!0)},className:"jer-value-string jer-hyperlink",style:d,children:e("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:null!==(s=d.color)&&void 0!==s?s:void 0},children:['"',O(t,c),'"']})})},be={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:ye,showOnView:!0,showOnEdit:!1};export{V as IconAdd,I as IconCancel,L as IconChevron,z as IconCopy,F as IconDelete,R as IconEdit,_ as IconOk,ue as JsonEditor,ye as LinkCustomComponent,be as LinkCustomNodeDefinition,U as isCollection,J as matchNode,X as matchNodeKey,y as themes,O as truncate};
{
"name": "json-edit-react",
"version": "1.15.9",
"version": "1.15.10-rc1",
"description": "React component for editing or viewing JSON/object data",

@@ -5,0 +5,0 @@ "main": "build/index.cjs.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc