json-edit-react
Advanced tools
Comparing version 1.18.0 to 1.19.0-beta1
@@ -1,1 +0,1 @@ | ||
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("object-property-assigner"),o=require("object-property-extractor");function r(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{l(o.next(e))}catch(e){a(e)}}function s(e){try{l(o.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}l((o=o.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const a=({className:t,name:n,value:o,setValue:r,handleKeyPress:a,styles:i})=>{if("string"!=typeof o)return null;const s="\n"===o.slice(-1)?o+".":o;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${n}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},i),rows:1,className:t,name:`${n}_textarea`,value:o,onChange:e=>r(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:a}),e.jsx("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"},i),children:s})]})},i=e=>null!==e&&"object"==typeof e,s=(e,t,n,o="")=>{if(!n&&!o)return!0;switch(e){case"collection":if(n){if(n(t,o))return!0;if(!l(o,t,n))return!1}if(!n&&o&&!l(o,t))return!1;break;case"value":if(n&&!n(t,o))return!1;if(!n&&o&&!c(t,o))return!1}return!0},l=(e="",t,n=c)=>{const o=t.value;return Object.entries(o).some((([r,a])=>{const s=[...t.path,r],c=Object.assign(Object.assign({},t),{key:r,path:s,level:t.level+1,value:a,size:s.length,parentData:o});return i(a)?l(e,c,n):n(c,e)}))},c=(e,t="")=>{const{value:n}=e;if(null===n&&"null".includes(t.toLowerCase()))return!0;switch(typeof n){case"string":return n.toLowerCase().includes(t.toLowerCase());case"number":return!!String(n).includes(t);case"boolean":return n?"true".includes(t.toLowerCase())||"1"===t:"false".includes(t.toLowerCase())||"0"===t;default:return!1}},d=({key:e,path:t},n="")=>!!c({value:e},n)||!!t.some((e=>c({value:e},n))),u=(e,t=200)=>"string"==typeof e?e.length<t?e:`${e.slice(0,t-2).trim()}...`:e,p=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),m=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,g=(e,t,n)=>{const o=e.key,r=m(e);if(Array.isArray(t))return!!r&&t.includes(r);const{key:a,modifier:i}=t;return("stringLineBreak"!==n||"Enter"!==o||"Shift"!==r||"Enter"!==a||!(null==i?void 0:i.includes("Shift")))&&(o===a&&(i===r||Array.isArray(i)&&i.includes(r)))},h={key:"Enter"},y={confirm:h,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},h),{modifier:["Meta","Shift","Control"]}),objectLineBreak:h,stringConfirm:h,stringLineBreak:Object.assign(Object.assign({},h),{modifier:["Shift"]}),numberConfirm:h,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},booleanConfirm:h,clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},b={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:{pale:{color:"#A8DADC"},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"}}},f=b.default,j=t.createContext({getStyles:()=>({}),icons:{}}),v=({theme:t="default",icons:n={},children:o})=>{const r=E(t);return e.jsx(j.Provider,{value:{getStyles:(e,t)=>"function"==typeof r[e]?r[e](t):r[e],icons:n},children:o})},x=()=>t.useContext(j),E=e=>{var t,n,o,r;const a={},i=(Array.isArray(e)?e:[e]).map((t=>"default"===e?{}:"string"==typeof t?D(b[t],a):w(t)?D({fragments:{},styles:t},a):D(t,a))),s=D(f,{});Object.keys(s).forEach((e=>{const t=e;i.forEach((e=>{e[t]&&(s[t]=Object.assign(Object.assign({},s[t]),e[t]))}))}));const l=Object.assign({},s);return Object.entries(a).forEach((([e,t])=>{const n=e;l[n]=e=>{const o=t(e)||{};return Object.assign(Object.assign({},s[n]),o)}})),"function"!=typeof(null==l?void 0:l.inputHighlight)&&(null===(t=null==l?void 0:l.inputHighlight)||void 0===t?void 0:t.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(n=null==l?void 0:l.inputHighlight)||void 0===n?void 0:n.backgroundColor),"function"!=typeof(null==l?void 0:l.iconCopy)&&(null===(o=null==l?void 0:l.iconCopy)||void 0===o?void 0:o.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(r=null==l?void 0:l.iconCopy)||void 0===r?void 0:r.color),l},D=(e,t)=>{const{fragments:n,styles:o}=e,r={};return Object.entries(o).forEach((([e,o])=>{const a=(Array.isArray(o)?o:[o]).reduce(((o,r)=>{var a;if("function"==typeof r)return t[e]=r,Object.assign({},o);if("string"==typeof r){const t=null!==(a=null==n?void 0:n[r])&&void 0!==a?a:r;return"string"==typeof t?Object.assign(Object.assign({},o),{[C[e]]:t}):Object.assign(Object.assign({},o),t)}return Object.assign(Object.assign({},o),r)}),{});r[e]=a})),r},w=e=>!("styles"in e),C={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"},k="**INVALID_FUNCTION**",S=({value:t,setValue:n,isEditing:o,path:r,setIsEditing:i,handleEdit:s,handleCancel:l,stringTruncate:c,showStringQuotes:d,nodeData:m,handleKeyboard:g})=>{const{getStyles:h}=x(),y=p(r),b=d?'"':"";return o?e.jsx(a,{className:"jer-input-text",name:y,value:t,setValue:n,isEditing:o,handleKeyPress:e=>{g(e,{stringConfirm:s,cancel:l,stringLineBreak:()=>{var o,r;const a=document.getElementById(`${y}_textarea`);if(a){const i=null!==(o=null==a?void 0:a.selectionStart)&&void 0!==o?o:1/0,s=null!==(r=null==a?void 0:a.selectionEnd)&&void 0!==r?r:1/0,l=t.slice(0,i),c=t.slice(s);e.target.value=l+"\n"+c,a.setSelectionRange(i+1,i+1),n(l+"\n"+c)}}})},styles:h("input",m)}):e.jsxs("div",{id:`${y}_display`,onDoubleClick:()=>i(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&i(!0)},className:"jer-value-string",style:h("string",m),children:[b,u(t,c),b]})},O=({value:t,setValue:n,isEditing:o,path:r,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l,handleKeyboard:c})=>{const{getStyles:d}=x();return o?e.jsx("input",{className:"jer-input-number",type:"text",name:p(r),value:t,onChange:e=>n(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>c(e,{numberConfirm:i,cancel:s,numberUp:()=>n(Number(t)+1),numberDown:()=>n(Number(t)-1)}),style:Object.assign({width:String(t).length/1.5+2+"em"},d("input",l))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",l),children:t})},N=({value:t,setValue:n,isEditing:o,path:r,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l,handleKeyboard:c})=>{const{getStyles:d}=x();return o?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:p(r),checked:t,onChange:()=>n(!t),onKeyDown:e=>c(e,{booleanConfirm:i,cancel:s}),autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",l),children:String(t)})},A=({value:n,isEditing:o,setIsEditing:r,handleEdit:a,handleCancel:i,nodeData:s,handleKeyboard:l})=>{const{getStyles:c}=x();t.useEffect((()=>(o&&document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d))),[o]);const d=e=>l(e,{confirm:a,cancel:i});return e.jsx("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:c("null",s),children:String(n)})},T=({value:t})=>{let n="Error!";switch(typeof t){case"string":t===k&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:n})},M=({size:t,style:n,className:o})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:n,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"})]}),P=({size:t,style:n,className:o})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:n,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"})]}),R=({size:t,style:n,className:o})=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:n,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"})}),V=({size:t,style:n,className:o})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:n,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"})]}),z=({size:t,style:n,className:o})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:o,style:n,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"})]}),F=({size:t,style:n,className:o})=>e.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:o,style:n,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"})}),I=({size:t,style:n,className:o})=>e.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:t,height:t,className:o,style:n,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"})}),K=({name:t,nodeData:n,rotate:o})=>{var r,a,i,s,l,c,d;const{getStyles:u,icons:p}=x(),m={size:"1.4em",className:"jer-icon"};switch(t){case"add":return null!==(r=null==p?void 0:p.add)&&void 0!==r?r:e.jsx(M,Object.assign({},m,{style:u("iconAdd",n)}));case"edit":return null!==(a=null==p?void 0:p.edit)&&void 0!==a?a:e.jsx(P,Object.assign({},m,{style:u("iconEdit",n)}));case"delete":return null!==(i=null==p?void 0:p.delete)&&void 0!==i?i:e.jsx(R,Object.assign({},m,{style:u("iconDelete",n),size:"1.45em"}));case"copy":return null!==(s=null==p?void 0:p.copy)&&void 0!==s?s:e.jsx(V,Object.assign({},m,{style:u("iconCopy",n),size:"1.2em"}));case"ok":return null!==(l=null==p?void 0:p.ok)&&void 0!==l?l:e.jsx(z,Object.assign({},m,{style:Object.assign({fontSize:"90%"},u("iconOk",n))}));case"cancel":return null!==(c=null==p?void 0:p.cancel)&&void 0!==c?c:e.jsx(F,Object.assign({},m,{style:Object.assign({fontSize:"130%"},u("iconCancel",n))}));case"chevron":return null!==(d=null==p?void 0:p.chevron)&&void 0!==d?d:e.jsx(I,{size:"1em",style:u("iconCollection",n)});default:return e.jsx(e.Fragment,{})}},L=({startEdit:n,handleDelete:o,handleAdd:r,enableClipboard:a,type:i,customButtons:s,nodeData:l,translate:c,keyboardControls:d,handleKeyboard:u})=>{const{getStyles:p}=x(),g=c("KEY_NEW",l),[h,y]=t.useState(!1),[b,f]=t.useState(g),{key:j,path:v,value:E}=l;return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:h?1:void 0},children:[a&&e.jsx("div",{onClick:e=>{e.stopPropagation();let t,n="value",o="";if(a){const r=m(e);r&&d.clipboardModifier.includes(r)?(t=B(v),o=t,n="path"):(t=E,o=i?JSON.stringify(E,null,2):String(t)),navigator.clipboard.writeText(o)}"function"==typeof a&&a({value:t,stringValue:o,path:v,key:j,type:n})},className:"jer-copy-pulse",children:e.jsx(K,{name:"copy",nodeData:l})}),n&&e.jsx("div",{onClick:e=>{e.stopPropagation(),n()},children:e.jsx(K,{name:"edit",nodeData:l})}),o&&e.jsx("div",{onClick:e=>{e.stopPropagation(),o()},children:e.jsx(K,{name:"delete",nodeData:l})}),r&&e.jsx("div",{onClick:e=>{e.stopPropagation(),"object"===i?y(!0):r("")},children:e.jsx(K,{name:"add",nodeData:l})}),null==s?void 0:s.map((({Element:t,onClick:n},o)=>e.jsx("div",{onClick:e=>n(l,e),children:e.jsx(t,{})},o))),h&&r&&"object"===i&&e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:b,onChange:e=>f(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{u(e,{stringConfirm:()=>{r&&(y(!1),r(b),f(g))},cancel:()=>{y(!1),f(g)}})},style:p("input",l)}),e.jsx(_,{onOk:e=>{b&&(e.stopPropagation(),y(!1),r(b))},onCancel:e=>{e.stopPropagation(),y(!1)},nodeData:l})]})]})},_=({onOk:t,onCancel:n,nodeData:o})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[e.jsx("div",{onClick:t,children:e.jsx(K,{name:"ok",nodeData:o})}),e.jsx("div",{onClick:n,children:e.jsx(K,{name:"cancel",nodeData:o})})]}),B=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),W=["string","number","boolean","null","object","array"],G=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const o=n[0],{element:r,wrapperElement:a,customNodeProps:i,wrapperProps:s,hideKey:l=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:p=!0}=o,m=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(o,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:r,CustomWrapper:a,customNodeProps:i,wrapperProps:s,hideKey:l,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:p},m)},U=t.createContext({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),H=({children:n})=>{const[o,r]=t.useState(null),[a,i]=t.useState(null),[s,l]=t.useState({path:null,pathString:null});return e.jsx(U.Provider,{value:{collapseState:o,setCollapseState:e=>{r(e),null!==e&&setTimeout((()=>r(null)),2e3)},doesPathMatch:e=>{if(null===o)return!1;for(const[t,n]of o.path.entries())if(n!==e[t])return!1;return!0},currentlyEditingElement:a,setCurrentlyEditingElement:i,areChildrenBeingEdited:e=>null!==a&&a.includes(e),dragSource:s,setDragSource:l},children:n})},Y=()=>t.useContext(U),$=({props:e,collapsed:n})=>{const{data:o,nodeData:r,parentData:a,onEdit:i,onError:s,showErrorMessages:l,restrictEditFilter:c,restrictDeleteFilter:d,restrictAddFilter:u,restrictDragFilter:m,translate:g,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:b}=Y(),[f,j]=t.useState(null),v=Object.assign(Object.assign({},r),{collapsed:n}),{path:x,key:E,size:D}=v,w=p(x),C=t.useMemo((()=>!c(v)),[v]),k=t.useMemo((()=>!d(v)),[v]),S=t.useMemo((()=>!u(v)),[v]),O=t.useMemo((()=>!m(v)&&k&&null===y),[v]),N=e=>{l&&(j(e),setTimeout((()=>j(null)),h)),console.warn("Error",e)},A=t.useMemo((()=>(e,t)=>{N(e.message),s&&s({currentData:v.fullData,errorValue:t,currentValue:o,name:E,path:x,error:e})}),[s,l]),T=y===w,M=y===`key_${w}`,P="number"==typeof x.slice(-1)[0];return{pathString:w,nodeData:v,path:x,name:E,size:D,canEdit:C,canDelete:k,canAdd:S,canDrag:O,error:f,showError:N,onError:A,setError:j,handleEditKey:e=>{if(b(null),E===e)return;if(!a)return;const t=x.slice(0,-1);if(Object.keys(a).includes(e))return void A({code:"KEY_EXISTS",message:g("ERROR_KEY_EXISTS",v)},e);const n=Object.fromEntries(Object.entries(a).map((([t,n])=>t===E?[e,n]:[t,n])));i(n,t).then((t=>{t&&A({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:{isEditing:T,isEditingKey:M,isArray:P,canEditKey:null!==a&&C&&S&&k&&!P}}},J=({canDrag:n,canDragOnto:o,path:r,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=x(),{dragSource:d,setDragSource:u}=Y(),[m,g]=t.useState(!1),h=p(r),y=t.useMemo((()=>n?{onDragStart:e=>{e.stopPropagation(),u({path:r,pathString:h})},onDragEnd:e=>{e.stopPropagation(),u({path:null,pathString:null})}}:{}),[n]),b=t.useMemo((()=>e=>o?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:t=>{t.stopPropagation(),j(e),u({path:null,pathString:null}),g(!1)},onDragEnter:t=>{var n;t.stopPropagation(),h.startsWith(null!==(n=d.pathString)&&void 0!==n?n:"")||g(e)},onDragExit:e=>{e.stopPropagation(),g(!1)}}:{}),[d,o]),f=t.useMemo((()=>o&&null!==d.pathString?e.jsx("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:r.length}},b("below"))):null),[d,o]),j=e=>{var t,n;const o=null===(t=d.path)||void 0===t?void 0:t.slice(-1)[0],c=null===(n=d.path)||void 0===n?void 0:n.slice(0,-1).join("."),u=r.slice(0,-1).join(""),{parentData:p}=a;"string"==typeof o&&p&&!Array.isArray(p)&&Object.keys(p).includes(o)&&o in p&&c!==u?s({code:"KEY_EXISTS",message:l("ERROR_KEY_EXISTS",a)},o):i(d.path,r,e).then((e=>{e&&s({code:"UPDATE_ERROR",message:e},a.value)}))};return{dragSourceProps:y,getDropTargetProps:b,BottomDropTarget:f,DropTargetPadding:({position:t,nodeData:n})=>m===t?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",n)}):null,handleDrop:j}},X=(e,t)=>{var n,o;const r=document.getElementsByClassName("jer-editor-container"),a=parseInt(r.length>0?getComputedStyle(r[0]).getPropertyValue("line-height"):"16px"),i=(null!==(o=null===(n=t.current)||void 0===n?void 0:n.offsetWidth)&&void 0!==o?o:0)/(.5*a),s=JSON.stringify(e,null,2).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/i))).reduce(((e,t)=>e+t),0)*a;return Math.min(s+30,window.innerHeight-50)},Z=n=>{const{data:o,parentData:r,onEdit:a,onDelete:i,onChange:l,onMove:c,enableClipboard:d,canDragOnto:u,restrictTypeSelection:p,searchFilter:m,searchText:g,showLabel:h,stringTruncate:y,showStringQuotes:b,indent:f,translate:j,customNodeDefinitions:v,handleKeyboard:E,keyboardControls:D}=n,{getStyles:w}=x(),{setCurrentlyEditingElement:C,setCollapseState:S}=Y(),[O,N]=t.useState("function"==typeof o?k:o),{pathString:A,nodeData:T,path:M,name:P,canEdit:R,canDelete:V,canDrag:z,error:F,onError:I,handleEditKey:K,derivedValues:B}=$({props:n}),{dragSourceProps:U,getDropTargetProps:H,BottomDropTarget:X,DropTargetPadding:Z}=J({canDrag:z,canDragOnto:u,path:M,nodeData:T,onMove:c,onError:I,translate:j}),te=G(v,T),[ne,oe]=t.useState(q(o,te)),re=t.useCallback((e=>{if(!l)return void N(e);const t=l({currentData:T.fullData,newValue:e,currentValue:O,name:P,path:M});N(t)}),[l]);t.useEffect((()=>{N("function"==typeof o?k:o),oe(q(o,te))}),[o,F]);const{CustomNode:ae,customNodeProps:ie,hideKey:se,showEditTools:le=!0,showOnEdit:ce,showOnView:de}=te,ue=[...W,...v.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],pe=t.useMemo((()=>{if("boolean"==typeof p)return p?[]:ue;if(Array.isArray(p))return p;const e=p(T);return"boolean"==typeof e?e?[]:ue:e}),[T,p]);if(!s("value",T,m,g))return null;const me=()=>{let e;switch(C(null),ne){case"object":e={[j("DEFAULT_NEW_KEY",T)]:O};break;case"array":e=null!=O?O:[];break;case"number":{const t=Number(O);e=isNaN(t)?0:t;break}default:e=O}a(e,M).then((t=>{t&&I({code:"UPDATE_ERROR",message:t},e)}))},ge=()=>{C(null),N(o),oe(q(o,te))},{isEditing:he,isEditingKey:ye,canEditKey:be}=B,fe=!he&&F,je=he&&pe.length>0,ve="invalid"!==ne&&!F&&le,xe=h&&ye,Ee=h&&!ye&&!se,De={value:O,parentData:r,setValue:re,isEditing:he,setIsEditing:R?()=>C(A):()=>{},handleEdit:me,handleCancel:ge,path:M,stringTruncate:y,showStringQuotes:b,nodeData:T,translate:j,handleKeyboard:E},we=ae&&(he&&ce||!he&&de)?e.jsx(ae,Object.assign({},n,{value:O,customNodeProps:ie,setValue:re,handleEdit:me,handleCancel:ge,handleKeyPress:e=>E(e,{stringConfirm:me,cancel:ge}),isEditing:he,setIsEditing:()=>C(A),getStyles:w})):Q(q(o),De);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:f/2+"em",position:"relative"},draggable:z},U,H("above"),{children:[X,e.jsx(Z,{position:"above",nodeData:T}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:P.length>10?"wrap":"nowrap"},children:[Ee&&e.jsx("span",{className:"jer-key-text",style:Object.assign(Object.assign({},w("property",T)),{minWidth:`${Math.min(String(P).length+1,5)}ch`,flexShrink:P.length>10?1:0}),onDoubleClick:()=>be&&C(`key_${A}`),children:""===P?e.jsx("span",{className:M.length>0?"jer-empty-string":void 0}):`${P}:`}),xe&&e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:A,defaultValue:P,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>E(e,{stringConfirm:()=>K(e.target.value),cancel:ge}),style:{width:String(P).length/1.5+.5+"em"}}),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:we}),he?e.jsx(_,{onOk:me,onCancel:ge,nodeData:T}):ve&&e.jsx(L,{startEdit:R?()=>C(A):void 0,handleDelete:V?()=>{i(O,M).then((e=>{e&&I({code:"DELETE_ERROR",message:e},O)}))}:void 0,enableClipboard:d,translate:j,customButtons:n.customButtons,nodeData:T,handleKeyboard:E,keyboardControls:D}),je&&e.jsxs("div",{className:"jer-select",children:[e.jsx("select",{name:`${P}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const t=v.find((t=>t.name===e));if(t)a(t.defaultValue,M),oe(e),C(null),S({path:M,collapsed:!1});else{const t=ee(O,e,j("DEFAULT_NEW_KEY",T),(null==te?void 0:te.CustomNode)?j("DEFAULT_STRING",T):void 0);re(t),a(t,M).then((e=>{e&&(I({code:"UPDATE_ERROR",message:e},t),C(null))}))}})(e.target.value),value:ne,children:pe.map((t=>e.jsx("option",{value:t,children:t},t)))}),e.jsx("span",{className:"focus"})]}),fe&&e.jsx("span",{className:"jer-error-slug",style:w("error",T),children:F})]})]}),e.jsx(Z,{position:"below",nodeData:T})]}))},q=(e,t)=>(null==t?void 0:t.CustomNode)&&(null==t?void 0:t.name)&&t.showInTypesSelector?t.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",Q=(t,n)=>{const o=n.value;switch(t){case"string":return e.jsx(S,Object.assign({},n,{value:o}));case"number":return e.jsx(O,Object.assign({},n,{value:o}));case"boolean":return e.jsx(N,Object.assign({},n,{value:o}));case"null":return e.jsx(A,Object.assign({},n));default:return e.jsx(T,Object.assign({},n))}},ee=(e,t,n,o)=>{switch(t){case"string":return null!=o?o:String(e);case"number":{const t=Number(e);return isNaN(t)?0:t}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},te=n=>{const{getStyles:l}=x(),{collapseState:c,setCollapseState:d,doesPathMatch:u,currentlyEditingElement:p,setCurrentlyEditingElement:g,areChildrenBeingEdited:h}=Y(),{data:y,nodeData:b,parentData:f,showCollectionCount:j,onEdit:v,onAdd:E,onDelete:D,canDragOnto:w,collapseFilter:C,collapseAnimationTime:k,onMove:S,enableClipboard:O,searchFilter:N,searchText:A,indent:T,keySort:M,showArrayIndices:P,defaultValue:R,translate:V,customNodeDefinitions:z,jsonParse:F,jsonStringify:I,keyboardControls:B,handleKeyboard:W}=n,[U,H]=t.useState(I(y)),q=C(b),{contentRef:Q,isAnimating:ee,maxHeight:ne,collapsed:oe,animateCollapse:re}=((e,n,o)=>{const[r,a]=t.useState(o?0:void 0),[i,s]=t.useState(o),l=t.useRef(!1),c=t.useRef(null),d=t.useRef(0),u=t.useRef();return{contentRef:c,isAnimating:l.current,animateCollapse:t=>{var o,r;if(i!==t){switch(window.clearTimeout(u.current),l.current=!0,t){case!0:{const e=null!==(r=null===(o=c.current)||void 0===o?void 0:o.offsetHeight)&&void 0!==r?r:0;d.current=e,a(e),setTimeout((()=>{a(0)}),5);break}case!1:a(d.current||X(e,c))}s(!i),u.current=window.setTimeout((()=>{l.current=!1,t||a(void 0)}),n)}},maxHeight:r,collapsed:i}})(y,k,q),{pathString:ae,nodeData:ie,path:se,name:le,size:ce,canEdit:de,canDelete:ue,canAdd:pe,canDrag:me,error:ge,setError:he,onError:ye,handleEditKey:be,derivedValues:fe}=$({props:n,collapsed:oe}),{dragSourceProps:je,getDropTargetProps:ve,BottomDropTarget:xe,DropTargetPadding:Ee}=J({canDrag:me,canDragOnto:w,path:se,nodeData:ie,onMove:S,onError:ye,translate:V}),De=t.useRef(!q);t.useEffect((()=>{H(I(y))}),[y]),t.useEffect((()=>{const e=C(ie)&&!fe.isEditing;De.current=!e,re(e)}),[C]),t.useEffect((()=>{null!==c&&u(se)&&(De.current=!0,re(c.collapsed))}),[c]);const we=t.useMemo((()=>(e,t)=>"function"!=typeof R?R:R(e,t)),[R]),{CustomNode:Ce,customNodeProps:ke,CustomWrapper:Se,wrapperProps:Oe={},hideKey:Ne,showEditTools:Ae=!0,showOnEdit:Te,showOnView:Me,showCollectionWrapper:Pe=!0}=t.useMemo((()=>G(z,ie)),[]);if(!s("collection",ie,N,A)&&ie.level>0)return null;const Re=Array.isArray(y)?"array":"object",Ve="array"===Re?{open:"[",close:"]"}:{open:"{",close:"}"},ze=e=>W(e,{objectConfirm:Ie,cancel:Le}),Fe=e=>{const t=m(e);if(t&&B.collapseModifier.includes(t))return De.current=!0,void d({collapsed:!oe,path:se});p&&p.includes(ae)||(De.current=!0,d(null),re(!oe))},Ie=()=>{try{const e=F(U);if(g(null),he(null),JSON.stringify(e)===JSON.stringify(y))return;v(e,se).then((t=>{t&&ye({code:"UPDATE_ERROR",message:t},e)}))}catch(e){ye({code:"INVALID_JSON",message:V("ERROR_INVALID_JSON",ie)},U)}},Ke=se.length>0?()=>{D(y,se).then((e=>{e&&ye({code:"DELETE_ERROR",message:e},o(y,se))}))}:void 0,Le=()=>{g(null),he(null),H(I(y))},{isEditing:_e,isEditingKey:Be,isArray:We,canEditKey:Ge}=fe,Ue="when-closed"===j?oe:j,He=!_e&&Ae,Ye=(P||!We)&&!Ne&&void 0!==le,$e=Ce&&(_e&&Te||!_e&&Me),Je=M&&"object"===Re,Xe=Object.entries(y).map((([e,t])=>["array"===Re?Number(e):e,t]));Je&&Xe.sort("function"==typeof M?(e,t)=>M(e[0],t[0]):void 0);const Ze=De.current?_e?e.jsx("div",{className:"jer-collection-text-edit",children:e.jsxs("div",{children:[e.jsx(a,{className:"jer-collection-text-area",name:ae,value:U,setValue:H,isEditing:_e,handleKeyPress:ze,styles:l("input",ie)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(_,{onOk:Ie,onCancel:Le,nodeData:ie})})]})}):Xe.map((([t,o],r)=>{const a={key:t,value:o,path:[...se,t],level:se.length+1,index:r,size:i(o)?Object.keys(o).length:1,parentData:y,fullData:ie.fullData};return e.jsx("div",{className:"jer-collection-element",style:l("collectionElement",a),children:i(o)?e.jsx(te,Object.assign({},n,{data:o,parentData:y,nodeData:a,showCollectionCount:j,canDragOnto:de}),t):e.jsx(Z,Object.assign({},n,{data:o,parentData:y,nodeData:a,canDragOnto:de,showLabel:"object"===Re||P}),t)},t)})):null,qe=!!Pe&&oe;qe||(De.current=!0);const Qe=Object.assign(Object.assign({},n),{data:y,value:y,parentData:f,nodeData:ie,setValue:e=>r(void 0,void 0,void 0,(function*(){return yield v(e,se)})),handleEdit:Ie,handleCancel:Le,handleKeyPress:ze,isEditing:_e,setIsEditing:()=>g(ae),getStyles:l,canDragOnto:de}),et=$e?e.jsx(Ce,Object.assign({customNodeProps:ke},Qe,{children:Ze})):Ze,tt=Be?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:ae,defaultValue:le,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>W(e,{stringConfirm:()=>be(e.target.value),cancel:Le}),style:{width:String(le).length/1.5+.5+"em"}}):Ye&&e.jsx("span",{className:"jer-key-text",style:l("property",ie),onClick:e=>e.stopPropagation(),onDoubleClick:()=>Ge&&g(`key_${ae}`),children:""===le?e.jsx("span",{className:se.length>0?"jer-empty-string":void 0}):`${le}:`}),nt=He&&e.jsx(L,{startEdit:de?()=>{De.current=!0,g(ae)}:void 0,handleAdd:pe?e=>{re(!1);const t=we(ie,e);"array"===Re?E(t,[...se,y.length]).then((e=>{e&&ye({code:"ADD_ERROR",message:e},t)})):e in y?ye({code:"KEY_EXISTS",message:V("ERROR_KEY_EXISTS",ie)},e):E(t,[...se,e]).then((e=>{e&&ye({code:"ADD_ERROR",message:e},t)}))}:void 0,handleDelete:ue?Ke:void 0,enableClipboard:O,type:Re,nodeData:ie,translate:V,customButtons:n.customButtons,keyboardControls:B,handleKeyboard:W}),ot=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===se.length?0:T/2)+"em"},l("collection",ie)),{position:"relative"}),draggable:me},je,ve("above"),{children:[e.jsx("div",{className:"jer-clickzone",style:{width:T/2+1+"em",zIndex:10+2*ie.level},onClick:e=>Fe(e)}),!_e&&xe,e.jsx(Ee,{position:"above",nodeData:ie}),Pe?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:e=>Fe(e),children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon jer-accordion-icon"+(oe?" jer-rotate-90":""),style:{zIndex:11+2*ie.level},onClick:e=>Fe(e),children:e.jsx(K,{name:"chevron",rotate:oe,nodeData:ie})}),tt,!_e&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:l("bracket",ie),children:Ve.open})]}),!_e&&Ue&&e.jsx("div",{className:"jer-collection-item-count"+(Ue?" jer-visible":" jer-hidden"),style:l("itemCount",ie),children:1===ce?V("ITEM_SINGLE",Object.assign(Object.assign({},ie),{size:1}),1):V("ITEMS_MULTIPLE",ie,ce)}),e.jsx("div",{className:"jer-brackets"+(qe?" jer-visible":" jer-hidden"),style:l("bracket",ie),children:Ve.close}),nt]}):Ne?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[tt,nt]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign({overflowY:qe||ee?"clip":"visible",maxHeight:h(ae)?void 0:ne},l("collectionInner",ie)),ref:Q,children:[et,e.jsx("div",{className:_e?"jer-collection-error-row":"jer-collection-error-row-edit",children:ge&&e.jsx("span",{className:"jer-error-slug",style:l("error",ie),children:ge})}),!_e&&Pe&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},l("bracket",ie)),{marginLeft:(T<3?-1:T<6?-.5:0)+"em"}),children:Ve.close})]}),e.jsx(Ee,{position:"below",nodeData:ie})]}));return Se?e.jsx(Se,Object.assign({customNodeProps:Oe},Qe,{children:ot})):ot},ne={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"},oe=(e,t)=>(n,o,r)=>((e,t,n,o,r)=>{if(t[o]){const e=t[o](n);if(null!==e)return e}const a=o in e?e[o]:ne[o];return void 0===r?a:null==a?void 0:a.replace("{{count}}",String(r))})(e,t,o,n,r);var re=[],ae=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,o=!0===t.prepend?"prepend":"append",r=!0===t.singleTag,a="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(r){var i=re.indexOf(a);-1===i&&(i=re.push(a)-1,ae[i]={}),n=ae[i]&&ae[i][o]?ae[i][o]:ae[i][o]=s()}else n=s();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),r=0;r<n.length;r++)e.setAttribute(n[r],t.attributes[n[r]]);var i="prepend"===o?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-expand-transition-time:0.3s;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden,.jer-visible{transition:var(--jer-expand-transition-time)}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative;transition:var(--jer-expand-transition-time)}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:transform var(--jer-expand-transition-time)}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-accordion-icon,.jer-rotate-90{transition:transform var(--jer-expand-transition-time)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string:after{content:"<empty string>:";font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}',{});const ie=({data:n,setData:o,rootName:a="root",onUpdate:s=(()=>{}),onEdit:l=s,onDelete:c=s,onAdd:d=s,onChange:u,onError:p,showErrorMessages:m=!0,enableClipboard:h=!0,indent:b=2,collapse:f=!1,collapseAnimationTime:j=300,showCollectionCount:v=!0,restrictEdit:E=!1,restrictDelete:D=!1,restrictAdd:w=!1,restrictTypeSelection:C=!1,restrictDrag:k=!0,searchFilter:S,searchText:O,searchDebounceTime:N=350,keySort:A=!1,showArrayIndices:T=!0,showStringQuotes:M=!0,defaultValue:P=null,minWidth:R=250,maxWidth:V="min(600px, 90vw)",rootFontSize:z,stringTruncate:F=250,translations:I={},className:K,id:L,customText:_={},customNodeDefinitions:B=[],customButtons:W=[],jsonParse:G=JSON.parse,jsonStringify:U=(e=>JSON.stringify(e,null,2)),errorMessageTimeout:H=2500,keyboardControls:Y={}})=>{const{getStyles:$}=x(),J=t.useCallback(le(f),[f]),X=t.useCallback(oe(I,_),[I,_]),[q,Q]=t.useState(O),[ee,ne]=(({setData:e,data:n})=>{const[o,r]=t.useState(e?void 0:n),a=t.useCallback((t=>{e?e(t):r(t)}),[e]);return t.useEffect((()=>{e||r(n)}),[n]),[e?n:o,a]})({setData:o,data:n}),re=document.querySelector(":root"),ae=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(ae)!==j&&(null==re||re.style.setProperty("--jer-expand-transition-time",j/1e3+"s")),t.useEffect((()=>{const e=setTimeout((()=>Q(O)),N);return()=>clearTimeout(e)}),[O,N]);const ie={key:a,path:[],level:0,index:0,value:ee,size:"object"==typeof ee&&null!==ee?Object.keys(ee).length:1,parentData:null,fullData:ee},ue=(e,t)=>r(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void ne(t.newData);const o=de(n)?n:["error",n],[r,a]=o;if("error"===r)return ne(t.currentData),!1===a?X("ERROR_UPDATE",ie):String(a);ne(a)})),pe=t.useMemo((()=>le(E)),[E]),me=t.useMemo((()=>le(D)),[D]),ge=t.useMemo((()=>le(w)),[w]),he=t.useMemo((()=>le(k)),[k]),ye=t.useMemo((()=>ce(S)),[S]),be=t.useMemo((()=>(e=>{const t=Object.assign({},y);for(const n of Object.keys(y)){const o=n;if(e[o]){const r=e[o],a=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(r)?r:[r]:"string"==typeof r?{key:r}:r;t[o]=a,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})(Y)),[Y]),fe=t.useCallback(((e,t)=>((e,t,n)=>{const o=Object.entries(t);for(const[t,r]of o)if(g(n,e[t],t)){n.preventDefault(),r();break}})(be,t,e)),[Y]),je={name:a,nodeData:ie,onEdit:(e,t)=>r(void 0,void 0,void 0,(function*(){const{currentData:n,newData:o,currentValue:r,newValue:a}=se(ee,t,e,"update");if(r!==a)return yield ue(l,{currentData:n,newData:o,currentValue:r,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>r(void 0,void 0,void 0,(function*(){const{currentData:n,newData:o,currentValue:r,newValue:a}=se(ee,t,e,"delete");return yield ue(c,{currentData:n,newData:o,currentValue:r,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t)=>r(void 0,void 0,void 0,(function*(){const{currentData:n,newData:o,currentValue:r,newValue:a}=se(ee,t,e,"add");return yield ue(d,{currentData:n,newData:o,currentValue:r,newValue:a,name:t.slice(-1)[0],path:t})})),onChange:u,onError:p,showErrorMessages:m,onMove:(e,t,n)=>r(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:o,newData:r,currentValue:a}=se(ee,e,"","delete"),i=e.slice(-1)[0],s=t.slice(0,-1),c=t.slice(-1)[0];let d="number"==typeof c?"above"===n?c:c+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===n?{insertBefore:c}:{insertAfter:c},{newData:p,newValue:m}=se(r,[...s,d],a,"add",u);return yield ue(l,{currentData:o,newData:p,currentValue:a,newValue:m,name:t.slice(-1)[0],path:t})})),showCollectionCount:v,collapseFilter:J,collapseAnimationTime:j,restrictEditFilter:pe,restrictDeleteFilter:me,restrictAddFilter:ge,restrictTypeSelection:C,restrictDragFilter:he,canDragOnto:!1,searchFilter:ye,searchText:q,enableClipboard:h,keySort:A,showArrayIndices:T,showStringQuotes:M,indent:b,defaultValue:P,stringTruncate:F,translate:X,customNodeDefinitions:B,customButtons:W,parentData:null,jsonParse:G,jsonStringify:U,errorMessageTimeout:H,handleKeyboard:fe,keyboardControls:be},ve=Object.assign(Object.assign({},$("container",ie)),{minWidth:R,maxWidth:V});return ve.fontSize=null!=z?z:ve.fontSize,e.jsx("div",{id:L,className:"jer-editor-container "+K,style:ve,children:i(ee)?e.jsx(te,Object.assign({data:ee},je)):e.jsx(Z,Object.assign({data:ee,showLabel:!0},je))})},se=(e,t,r,a,i={})=>{if(0===t.length)return{currentData:e,newData:r,currentValue:e,newValue:r};const s=Object.assign({remove:"delete"===a},i),l="add"!==a?o(e,t):void 0;return{currentData:e,newData:n(e,t,r,s),currentValue:l,newValue:"delete"!==a?r:void 0}},le=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,ce=e=>{if(void 0!==e)return"value"===e?c:"key"===e?d:"all"===e?(e,t)=>c(e,t)||d(e,t):e},de=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),ue=({value:t,setIsEditing:n,getStyles:o,customNodeProps:r,nodeData:a})=>{var i,s;const l=null!==(i=null==r?void 0:r.stringTruncate)&&void 0!==i?i:100,c=o("string",a);return e.jsx("div",{onDoubleClick:()=>n(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&n(!0)},className:"jer-value-string jer-hyperlink",style:c,children:e.jsxs("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:null!==(s=c.color)&&void 0!==s?s:void 0},children:['"',u(t,l),'"']})})},pe={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:ue,showOnView:!0,showOnEdit:!1};exports.assign=n,exports.extract=o,exports.IconAdd=M,exports.IconCancel=F,exports.IconChevron=I,exports.IconCopy=V,exports.IconDelete=R,exports.IconEdit=P,exports.IconOk=z,exports.JsonEditor=t=>e.jsx(v,{theme:t.theme,icons:t.icons,children:e.jsx(H,{children:e.jsx(ie,Object.assign({},t))})}),exports.LinkCustomComponent=ue,exports.LinkCustomNodeDefinition=pe,exports.isCollection=i,exports.matchNode=c,exports.matchNodeKey=d,exports.themes=b,exports.truncate=u; | ||
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("object-property-assigner"),r=require("object-property-extractor");function o(e,t,n,r){return new(n||(n=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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const a=({className:t,name:n,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:`${n}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},i),rows:1,className:t,name:`${n}_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: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"},i),children:s})]})},i=e=>null!==e&&"object"==typeof e,s=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!l(r,t,n))return!1}if(!n&&r&&!l(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!c(t,r))return!1}return!0},l=(e="",t,n=c)=>{const r=t.value;return Object.entries(r).some((([o,a])=>{const s=[...t.path,o],c=Object.assign(Object.assign({},t),{key:o,path:s,level:t.level+1,value:a,size:s.length,parentData:r});return i(a)?l(e,c,n):n(c,e)}))},c=(e,t="")=>{const{value:n}=e;if(null===n&&"null".includes(t.toLowerCase()))return!0;switch(typeof n){case"string":return n.toLowerCase().includes(t.toLowerCase());case"number":return!!String(n).includes(t);case"boolean":return n?"true".includes(t.toLowerCase())||"1"===t:"false".includes(t.toLowerCase())||"0"===t;default:return!1}},d=({key:e,path:t},n="")=>!!c({value:e},n)||!!t.some((e=>c({value:e},n))),u=(e,t=200)=>"string"==typeof e?e.length<t?e:`${e.slice(0,t-2).trim()}...`:e,p=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),m=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,g=(e,t,n)=>{const r=e.key,o=m(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:a,modifier:i}=t;return("stringLineBreak"!==n||"Enter"!==r||"Shift"!==o||"Enter"!==a||!(null==i?void 0:i.includes("Shift")))&&(r===a&&(i===o||Array.isArray(i)&&i.includes(o)))},h={key:"Enter"},y={confirm:h,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},h),{modifier:["Meta","Shift","Control"]}),objectLineBreak:h,stringConfirm:h,stringLineBreak:Object.assign(Object.assign({},h),{modifier:["Shift"]}),numberConfirm:h,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},booleanConfirm:h,clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},b={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)"}},f=t.createContext({getStyles:()=>({}),icons:{}}),j=({theme:t=b,icons:n={},children:r})=>{const o=x(t);return e.jsx(f.Provider,{value:{getStyles:(e,t)=>"function"==typeof o[e]?o[e](t):o[e],icons:n},children:r})},v=()=>t.useContext(f),x=e=>{var t,n,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((e=>D(e)?E({fragments:{},styles:e},a):E(e,a))),s=E(b,{});Object.keys(s).forEach((e=>{const t=e;i.forEach((e=>{e[t]&&(s[t]=Object.assign(Object.assign({},s[t]),e[t]))}))}));const l=Object.assign({},s);return Object.entries(a).forEach((([e,t])=>{const n=e;l[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},s[n]),r)}})),"function"!=typeof(null==l?void 0:l.inputHighlight)&&(null===(t=null==l?void 0:l.inputHighlight)||void 0===t?void 0:t.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(n=null==l?void 0:l.inputHighlight)||void 0===n?void 0:n.backgroundColor),"function"!=typeof(null==l?void 0:l.iconCopy)&&(null===(r=null==l?void 0:l.iconCopy)||void 0===r?void 0:r.color)&&document.documentElement.style.setProperty("--jer-icon-copy-color",null===(o=null==l?void 0:l.iconCopy)||void 0===o?void 0:o.color),l},E=(e,t)=>{const{fragments:n,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a,i;if("function"==typeof o)return t[e]=o,Object.assign({},r);if("string"==typeof o){const t=null!==(a=null==n?void 0:n[o])&&void 0!==a?a:o;return"string"==typeof t?Object.assign(Object.assign({},r),{[null!==(i=w[e])&&void 0!==i?i:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},D=e=>!("styles"in e),w={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},C=t.createContext({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),k=({children:n})=>{const[r,o]=t.useState(null),[a,i]=t.useState(null),[s,l]=t.useState({path:null,pathString:null});return e.jsx(C.Provider,{value:{collapseState:r,setCollapseState:e=>{o(e),null!==e&&setTimeout((()=>o(null)),2e3)},doesPathMatch:e=>{if(null===r)return!1;for(const[t,n]of r.path.entries())if(n!==e[t])return!1;return!0},currentlyEditingElement:a,setCurrentlyEditingElement:i,areChildrenBeingEdited:e=>null!==a&&a.includes(e),dragSource:s,setDragSource:l},children:n})},S=()=>t.useContext(C),O="**INVALID_FUNCTION**",N=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:i,handleEdit:s,handleCancel:l,stringTruncate:c,showStringQuotes:d,nodeData:m,handleKeyboard:g})=>{const{getStyles:h}=v(),y=p(o),b=d?'"':"";return r?e.jsx(a,{className:"jer-input-text",name:y,value:t,setValue:n,isEditing:r,handleKeyPress:e=>{g(e,{stringConfirm:s,cancel:l,stringLineBreak:()=>{var r,o;const a=document.getElementById(`${y}_textarea`);if(a){const i=null!==(r=null==a?void 0:a.selectionStart)&&void 0!==r?r:1/0,s=null!==(o=null==a?void 0:a.selectionEnd)&&void 0!==o?o:1/0,l=t.slice(0,i),c=t.slice(s);e.target.value=l+"\n"+c,a.setSelectionRange(i+1,i+1),n(l+"\n"+c)}}})},styles:h("input",m)}):e.jsxs("div",{id:`${y}_display`,onDoubleClick:()=>i(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&i(!0)},className:"jer-value-string",style:h("string",m),children:[b,u(t,c),b]})},A=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l,handleKeyboard:c})=>{const{getStyles:d}=v();return r?e.jsx("input",{className:"jer-input-number",type:"text",name:p(o),value:t,onChange:e=>n(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>c(e,{numberConfirm:i,cancel:s,numberUp:()=>n(Number(t)+1),numberDown:()=>n(Number(t)-1)}),style:Object.assign({width:String(t).length/1.5+2+"em"},d("input",l))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",l),children:t})},T=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:s,nodeData:l,handleKeyboard:c})=>{const{getStyles:d}=v();return r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:p(o),checked:t,onChange:()=>n(!t),onKeyDown:e=>c(e,{booleanConfirm:i,cancel:s}),autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",l),children:String(t)})},M=({value:n,isEditing:r,setIsEditing:o,handleEdit:a,handleCancel:i,nodeData:s,handleKeyboard:l})=>{const{getStyles:c}=v();t.useEffect((()=>(r&&document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d))),[r]);const d=e=>l(e,{confirm:a,cancel:i});return e.jsx("div",{onDoubleClick:()=>o(!0),className:"jer-value-null",style:c("null",s),children:String(n)})},P=({value:t})=>{let n="Error!";switch(typeof t){case"string":t===O&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:n})},R=({size:t,style:n,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})]}),V=({size:t,style:n,className:r})=>e.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})]}),z=({size:t,style:n,className:r})=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})}),F=({size:t,style:n,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:r,style:n,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"})]}),I=({size:t,style:n,className:r})=>e.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:t,height:t,className:r,style:n,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"})]}),K=({size:t,style:n,className:r})=>e.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:t,height:t,className:r,style:n,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"})}),L=({size:t,style:n,className:r})=>e.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:t,height:t,className:r,style:n,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"})}),_=({name:t,nodeData:n,rotate:r})=>{var o,a,i,s,l,c,d;const{getStyles:u,icons:p}=v(),m={size:"1.4em",className:"jer-icon"};switch(t){case"add":return null!==(o=null==p?void 0:p.add)&&void 0!==o?o:e.jsx(R,Object.assign({},m,{style:u("iconAdd",n)}));case"edit":return null!==(a=null==p?void 0:p.edit)&&void 0!==a?a:e.jsx(V,Object.assign({},m,{style:u("iconEdit",n)}));case"delete":return null!==(i=null==p?void 0:p.delete)&&void 0!==i?i:e.jsx(z,Object.assign({},m,{style:u("iconDelete",n),size:"1.45em"}));case"copy":return null!==(s=null==p?void 0:p.copy)&&void 0!==s?s:e.jsx(F,Object.assign({},m,{style:u("iconCopy",n),size:"1.2em"}));case"ok":return null!==(l=null==p?void 0:p.ok)&&void 0!==l?l:e.jsx(I,Object.assign({},m,{style:Object.assign({fontSize:"90%"},u("iconOk",n))}));case"cancel":return null!==(c=null==p?void 0:p.cancel)&&void 0!==c?c:e.jsx(K,Object.assign({},m,{style:Object.assign({fontSize:"130%"},u("iconCancel",n))}));case"chevron":return null!==(d=null==p?void 0:p.chevron)&&void 0!==d?d:e.jsx(L,{size:"1em",style:u("iconCollection",n)});default:return e.jsx(e.Fragment,{})}},B=({startEdit:n,handleDelete:r,handleAdd:o,enableClipboard:a,type:i,customButtons:s,nodeData:l,translate:c,keyboardControls:d,handleKeyboard:u})=>{const{getStyles:p}=v(),g=c("KEY_NEW",l),[h,y]=t.useState(!1),[b,f]=t.useState(g),{key:j,path:x,value:E}=l;return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:h?1:void 0},children:[a&&e.jsx("div",{onClick:e=>{e.stopPropagation();let t,n="value",r="";if(a){const o=m(e);o&&d.clipboardModifier.includes(o)?(t=G(x),r=t,n="path"):(t=E,r=i?JSON.stringify(E,null,2):String(t)),navigator.clipboard.writeText(r)}"function"==typeof a&&a({value:t,stringValue:r,path:x,key:j,type:n})},className:"jer-copy-pulse",children:e.jsx(_,{name:"copy",nodeData:l})}),n&&e.jsx("div",{onClick:e=>{e.stopPropagation(),n()},children:e.jsx(_,{name:"edit",nodeData:l})}),r&&e.jsx("div",{onClick:e=>{e.stopPropagation(),r()},children:e.jsx(_,{name:"delete",nodeData:l})}),o&&e.jsx("div",{onClick:e=>{e.stopPropagation(),"object"===i?y(!0):o("")},children:e.jsx(_,{name:"add",nodeData:l})}),null==s?void 0:s.map((({Element:t,onClick:n},r)=>e.jsx("div",{onClick:e=>n(l,e),children:e.jsx(t,{})},r))),h&&o&&"object"===i&&e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:b,onChange:e=>f(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{u(e,{stringConfirm:()=>{o&&(y(!1),o(b),f(g))},cancel:()=>{y(!1),f(g)}})},style:p("input",l)}),e.jsx(W,{onOk:e=>{b&&(e.stopPropagation(),y(!1),o(b))},onCancel:e=>{e.stopPropagation(),y(!1)},nodeData:l})]})]})},W=({onOk:t,onCancel:n,nodeData:r})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[e.jsx("div",{onClick:t,children:e.jsx(_,{name:"ok",nodeData:r})}),e.jsx("div",{onClick:n,children:e.jsx(_,{name:"cancel",nodeData:r})})]}),G=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),U=["string","number","boolean","null","object","array"],H=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[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,m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(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},m)},Y=({props:e,collapsed:n})=>{const{data:r,nodeData:o,parentData:a,onEdit:i,onError:s,showErrorMessages:l,restrictEditFilter:c,restrictDeleteFilter:d,restrictAddFilter:u,restrictDragFilter:m,translate:g,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:b}=S(),[f,j]=t.useState(null),v=Object.assign(Object.assign({},o),{collapsed:n}),{path:x,key:E,size:D}=v,w=p(x),C=t.useMemo((()=>!c(v)),[v]),k=t.useMemo((()=>!d(v)),[v]),O=t.useMemo((()=>!u(v)),[v]),N=t.useMemo((()=>!m(v)&&k&&null===y),[v]),A=e=>{l&&(j(e),setTimeout((()=>j(null)),h)),console.warn("Error",e)},T=t.useMemo((()=>(e,t)=>{A(e.message),s&&s({currentData:v.fullData,errorValue:t,currentValue:r,name:E,path:x,error:e})}),[s,l]),M=y===w,P=y===`key_${w}`,R="number"==typeof x.slice(-1)[0];return{pathString:w,nodeData:v,path:x,name:E,size:D,canEdit:C,canDelete:k,canAdd:O,canDrag:N,error:f,showError:A,onError:T,setError:j,handleEditKey:e=>{if(b(null),E===e)return;if(!a)return;const t=x.slice(0,-1);if(Object.keys(a).includes(e))return void T({code:"KEY_EXISTS",message:g("ERROR_KEY_EXISTS",v)},e);const n=Object.fromEntries(Object.entries(a).map((([t,n])=>t===E?[e,n]:[t,n])));i(n,t).then((t=>{t&&T({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:{isEditing:M,isEditingKey:P,isArray:R,canEditKey:null!==a&&C&&O&&k&&!R}}},$=({canDrag:n,canDragOnto:r,path:o,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=v(),{dragSource:d,setDragSource:u}=S(),[m,g]=t.useState(!1),h=p(o),y=t.useMemo((()=>n?{onDragStart:e=>{e.stopPropagation(),u({path:o,pathString:h})},onDragEnd:e=>{e.stopPropagation(),u({path:null,pathString:null})}}:{}),[n]),b=t.useMemo((()=>e=>r?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:t=>{t.stopPropagation(),j(e),u({path:null,pathString:null}),g(!1)},onDragEnter:t=>{var n;t.stopPropagation(),h.startsWith(null!==(n=d.pathString)&&void 0!==n?n:"")||g(e)},onDragExit:e=>{e.stopPropagation(),g(!1)}}:{}),[d,r]),f=t.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}},b("below"))):null),[d,r]),j=e=>{var t,n;const r=null===(t=d.path)||void 0===t?void 0:t.slice(-1)[0],c=null===(n=d.path)||void 0===n?void 0:n.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:b,BottomDropTarget:f,DropTargetPadding:({position:t,nodeData:n})=>m===t?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",n)}):null,handleDrop:j}},J=(e,t)=>{var n,r;const o=document.getElementsByClassName("jer-editor-container"),a=parseInt(o.length>0?getComputedStyle(o[0]).getPropertyValue("line-height"):"16px"),i=(null!==(r=null===(n=t.current)||void 0===n?void 0:n.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,t)=>e+t),0)*a;return Math.min(s+30,window.innerHeight-50)},X=n=>{const{data:r,parentData:o,onEdit:a,onDelete:i,onChange:l,onMove:c,enableClipboard:d,canDragOnto:u,restrictTypeSelection:p,searchFilter:m,searchText:g,showLabel:h,stringTruncate:y,showStringQuotes:b,indent:f,translate:j,customNodeDefinitions:x,handleKeyboard:E,keyboardControls:D}=n,{getStyles:w}=v(),{setCurrentlyEditingElement:C,setCollapseState:k}=S(),[N,A]=t.useState("function"==typeof r?O:r),{pathString:T,nodeData:M,path:P,name:R,canEdit:V,canDelete:z,canDrag:F,error:I,onError:K,handleEditKey:L,derivedValues:_}=Y({props:n}),{dragSourceProps:G,getDropTargetProps:J,BottomDropTarget:X,DropTargetPadding:ee}=$({canDrag:F,canDragOnto:u,path:P,nodeData:M,onMove:c,onError:K,translate:j}),te=H(x,M),[ne,re]=t.useState(Z(r,te)),oe=t.useCallback((e=>{if(!l)return void A(e);const t=l({currentData:M.fullData,newValue:e,currentValue:N,name:R,path:P});A(t)}),[l]);t.useEffect((()=>{A("function"==typeof r?O:r),re(Z(r,te))}),[r,I]);const{CustomNode:ae,customNodeProps:ie,hideKey:se,showEditTools:le=!0,showOnEdit:ce,showOnView:de}=te,ue=[...U,...x.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],pe=t.useMemo((()=>{if("boolean"==typeof p)return p?[]:ue;if(Array.isArray(p))return p;const e=p(M);return"boolean"==typeof e?e?[]:ue:e}),[M,p]);if(!s("value",M,m,g))return null;const me=()=>{let e;switch(C(null),ne){case"object":e={[j("DEFAULT_NEW_KEY",M)]:N};break;case"array":e=null!=N?N:[];break;case"number":{const t=Number(N);e=isNaN(t)?0:t;break}default:e=N}a(e,P).then((t=>{t&&K({code:"UPDATE_ERROR",message:t},e)}))},ge=()=>{C(null),A(r),re(Z(r,te))},{isEditing:he,isEditingKey:ye,canEditKey:be}=_,fe=!he&&I,je=he&&pe.length>0,ve="invalid"!==ne&&!I&&le,xe=h&&ye,Ee=h&&!ye&&!se,De={value:N,parentData:o,setValue:oe,isEditing:he,setIsEditing:V?()=>C(T):()=>{},handleEdit:me,handleCancel:ge,path:P,stringTruncate:y,showStringQuotes:b,nodeData:M,translate:j,handleKeyboard:E},we=ae&&(he&&ce||!he&&de)?e.jsx(ae,Object.assign({},n,{value:N,customNodeProps:ie,setValue:oe,handleEdit:me,handleCancel:ge,handleKeyPress:e=>E(e,{stringConfirm:me,cancel:ge}),isEditing:he,setIsEditing:()=>C(T),getStyles:w})):q(Z(r),De);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:f/2+"em",position:"relative"},draggable:F},G,J("above"),{children:[X,e.jsx(ee,{position:"above",nodeData:M}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:R.length>10?"wrap":"nowrap"},children:[Ee&&e.jsx("span",{className:"jer-key-text",style:Object.assign(Object.assign({},w("property",M)),{minWidth:`${Math.min(String(R).length+1,5)}ch`,flexShrink:R.length>10?1:0}),onDoubleClick:()=>be&&C(`key_${T}`),children:""===R?e.jsx("span",{className:P.length>0?"jer-empty-string":void 0}):`${R}:`}),xe&&e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:T,defaultValue:R,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>E(e,{stringConfirm:()=>L(e.target.value),cancel:ge}),style:{width:String(R).length/1.5+.5+"em"}}),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:we}),he?e.jsx(W,{onOk:me,onCancel:ge,nodeData:M}):ve&&e.jsx(B,{startEdit:V?()=>C(T):void 0,handleDelete:z?()=>{i(N,P).then((e=>{e&&K({code:"DELETE_ERROR",message:e},N)}))}:void 0,enableClipboard:d,translate:j,customButtons:n.customButtons,nodeData:M,handleKeyboard:E,keyboardControls:D}),je&&e.jsxs("div",{className:"jer-select",children:[e.jsx("select",{name:`${R}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const t=x.find((t=>t.name===e));if(t)a(t.defaultValue,P),re(e),C(null),k({path:P,collapsed:!1});else{const t=Q(N,e,j("DEFAULT_NEW_KEY",M),(null==te?void 0:te.CustomNode)?j("DEFAULT_STRING",M):void 0);oe(t),a(t,P).then((e=>{e&&(K({code:"UPDATE_ERROR",message:e},t),C(null))}))}})(e.target.value),value:ne,children:pe.map((t=>e.jsx("option",{value:t,children:t},t)))}),e.jsx("span",{className:"focus"})]}),fe&&e.jsx("span",{className:"jer-error-slug",style:w("error",M),children:I})]})]}),e.jsx(ee,{position:"below",nodeData:M})]}))},Z=(e,t)=>(null==t?void 0:t.CustomNode)&&(null==t?void 0:t.name)&&t.showInTypesSelector?t.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",q=(t,n)=>{const r=n.value;switch(t){case"string":return e.jsx(N,Object.assign({},n,{value:r}));case"number":return e.jsx(A,Object.assign({},n,{value:r}));case"boolean":return e.jsx(T,Object.assign({},n,{value:r}));case"null":return e.jsx(M,Object.assign({},n));default:return e.jsx(P,Object.assign({},n))}},Q=(e,t,n,r)=>{switch(t){case"string":return null!=r?r:String(e);case"number":{const t=Number(e);return isNaN(t)?0:t}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},ee=n=>{const{getStyles:l}=v(),{collapseState:c,setCollapseState:d,doesPathMatch:u,currentlyEditingElement:p,setCurrentlyEditingElement:g,areChildrenBeingEdited:h}=S(),{data:y,nodeData:b,parentData:f,showCollectionCount:j,onEdit:x,onAdd:E,onDelete:D,canDragOnto:w,collapseFilter:C,collapseAnimationTime:k,onMove:O,enableClipboard:N,searchFilter:A,searchText:T,indent:M,keySort:P,showArrayIndices:R,defaultValue:V,translate:z,customNodeDefinitions:F,jsonParse:I,jsonStringify:K,keyboardControls:L,handleKeyboard:G,insertAtTop:U}=n,[Z,q]=t.useState(K(y)),Q=C(b),{contentRef:te,isAnimating:ne,maxHeight:re,collapsed:oe,animateCollapse:ae}=((e,n,r)=>{const[o,a]=t.useState(r?0:void 0),[i,s]=t.useState(r),l=t.useRef(!1),c=t.useRef(null),d=t.useRef(0),u=t.useRef();return{contentRef:c,isAnimating:l.current,animateCollapse:t=>{var r,o;if(i!==t){switch(window.clearTimeout(u.current),l.current=!0,t){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||J(e,c))}s(!i),u.current=window.setTimeout((()=>{l.current=!1,t||a(void 0)}),n)}},maxHeight:o,collapsed:i}})(y,k,Q),{pathString:ie,nodeData:se,path:le,name:ce,size:de,canEdit:ue,canDelete:pe,canAdd:me,canDrag:ge,error:he,setError:ye,onError:be,handleEditKey:fe,derivedValues:je}=Y({props:n,collapsed:oe}),{dragSourceProps:ve,getDropTargetProps:xe,BottomDropTarget:Ee,DropTargetPadding:De}=$({canDrag:ge,canDragOnto:w,path:le,nodeData:se,onMove:O,onError:be,translate:z}),we=t.useRef(!Q);t.useEffect((()=>{q(K(y))}),[y]),t.useEffect((()=>{const e=C(se)&&!je.isEditing;we.current=!e,ae(e)}),[C]),t.useEffect((()=>{null!==c&&u(le)&&(we.current=!0,ae(c.collapsed))}),[c]);const Ce=t.useMemo((()=>(e,t)=>"function"!=typeof V?V:V(e,t)),[V]),{CustomNode:ke,customNodeProps:Se,CustomWrapper:Oe,wrapperProps:Ne={},hideKey:Ae,showEditTools:Te=!0,showOnEdit:Me,showOnView:Pe,showCollectionWrapper:Re=!0}=t.useMemo((()=>H(F,se)),[]);if(!s("collection",se,A,T)&&se.level>0)return null;const Ve=Array.isArray(y)?"array":"object",ze="array"===Ve?{open:"[",close:"]"}:{open:"{",close:"}"},Fe=e=>G(e,{objectConfirm:Ke,cancel:_e}),Ie=e=>{const t=m(e);if(t&&L.collapseModifier.includes(t))return we.current=!0,void d({collapsed:!oe,path:le});p&&p.includes(ie)||(we.current=!0,d(null),ae(!oe))},Ke=()=>{try{const e=I(Z);if(g(null),ye(null),JSON.stringify(e)===JSON.stringify(y))return;x(e,le).then((t=>{t&&be({code:"UPDATE_ERROR",message:t},e)}))}catch(e){be({code:"INVALID_JSON",message:z("ERROR_INVALID_JSON",se)},Z)}},Le=le.length>0?()=>{D(y,le).then((e=>{e&&be({code:"DELETE_ERROR",message:e},r(y,le))}))}:void 0,_e=()=>{g(null),ye(null),q(K(y))},{isEditing:Be,isEditingKey:We,isArray:Ge,canEditKey:Ue}=je,He="when-closed"===j?oe:j,Ye=!Be&&Te,$e=(R||!Ge)&&!Ae&&void 0!==ce,Je=ke&&(Be&&Me||!Be&&Pe),Xe=P&&"object"===Ve,Ze=Object.entries(y).map((([e,t])=>["array"===Ve?Number(e):e,t]));Xe&&Ze.sort("function"==typeof P?(e,t)=>P(e[0],t[0]):void 0);const qe=we.current?Be?e.jsx("div",{className:"jer-collection-text-edit",children:e.jsxs("div",{children:[e.jsx(a,{className:"jer-collection-text-area",name:ie,value:Z,setValue:q,isEditing:Be,handleKeyPress:Fe,styles:l("input",se)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(W,{onOk:Ke,onCancel:_e,nodeData:se})})]})}):Ze.map((([t,r],o)=>{const a={key:t,value:r,path:[...le,t],level:le.length+1,index:o,size:i(r)?Object.keys(r).length:1,parentData:y,fullData:se.fullData};return e.jsx("div",{className:"jer-collection-element",style:l("collectionElement",a),children:i(r)?e.jsx(ee,Object.assign({},n,{data:r,parentData:y,nodeData:a,showCollectionCount:j,canDragOnto:ue}),t):e.jsx(X,Object.assign({},n,{data:r,parentData:y,nodeData:a,canDragOnto:ue,showLabel:"object"===Ve||R}),t)},t)})):null,Qe=!!Re&&oe;Qe||(we.current=!0);const et=Object.assign(Object.assign({},n),{data:y,value:y,parentData:f,nodeData:se,setValue:e=>o(void 0,void 0,void 0,(function*(){return yield x(e,le)})),handleEdit:Ke,handleCancel:_e,handleKeyPress:Fe,isEditing:Be,setIsEditing:()=>g(ie),getStyles:l,canDragOnto:ue}),tt=Je?e.jsx(ke,Object.assign({customNodeProps:Se},et,{children:qe})):qe,nt=We?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:ie,defaultValue:ce,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>G(e,{stringConfirm:()=>fe(e.target.value),cancel:_e}),style:{width:String(ce).length/1.5+.5+"em"}}):$e&&e.jsx("span",{className:"jer-key-text",style:l("property",se),onClick:e=>e.stopPropagation(),onDoubleClick:()=>Ue&&g(`key_${ie}`),children:""===ce?e.jsx("span",{className:le.length>0?"jer-empty-string":void 0}):`${ce}:`}),rt=Ye&&e.jsx(B,{startEdit:ue?()=>{we.current=!0,g(ie)}:void 0,handleAdd:me?e=>{ae(!1);const t=Ce(se,e);if("array"===Ve){const e=U.array?0:y.length,n=U.array?{insert:!0}:{};E(t,[...le,e],n).then((e=>{e&&be({code:"ADD_ERROR",message:e},t)}))}else if(e in y)be({code:"KEY_EXISTS",message:z("ERROR_KEY_EXISTS",se)},e);else{const n=U.object?{insertBefore:0}:{};E(t,[...le,e],n).then((e=>{e&&be({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:pe?Le:void 0,enableClipboard:N,type:Ve,nodeData:se,translate:z,customButtons:n.customButtons,keyboardControls:L,handleKeyboard:G}),ot=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===le.length?0:M/2)+"em"},l("collection",se)),{position:"relative"}),draggable:ge},ve,xe("above"),{children:[e.jsx("div",{className:"jer-clickzone",style:{width:M/2+1+"em",zIndex:10+2*se.level},onClick:e=>Ie(e)}),!Be&&Ee,e.jsx(De,{position:"above",nodeData:se}),Re?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:e=>Ie(e),children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon jer-accordion-icon"+(oe?" jer-rotate-90":""),style:{zIndex:11+2*se.level},onClick:e=>Ie(e),children:e.jsx(_,{name:"chevron",rotate:oe,nodeData:se})}),nt,!Be&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:l("bracket",se),children:ze.open})]}),!Be&&He&&e.jsx("div",{className:"jer-collection-item-count"+(He?" jer-visible":" jer-hidden"),style:l("itemCount",se),children:1===de?z("ITEM_SINGLE",Object.assign(Object.assign({},se),{size:1}),1):z("ITEMS_MULTIPLE",se,de)}),e.jsx("div",{className:"jer-brackets"+(Qe?" jer-visible":" jer-hidden"),style:l("bracket",se),children:ze.close}),rt]}):Ae?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[nt,rt]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign({overflowY:Qe||ne?"clip":"visible",maxHeight:h(ie)?void 0:re},l("collectionInner",se)),ref:te,children:[tt,e.jsx("div",{className:Be?"jer-collection-error-row":"jer-collection-error-row-edit",children:he&&e.jsx("span",{className:"jer-error-slug",style:l("error",se),children:he})}),!Be&&Re&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},l("bracket",se)),{marginLeft:(M<3?-1:M<6?-.5:0)+"em"}),children:ze.close})]}),e.jsx(De,{position:"below",nodeData:se})]}));return Oe?e.jsx(Oe,Object.assign({customNodeProps:Ne},et,{children:ot})):ot},te={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,t)=>(n,r,o)=>((e,t,n,r,o)=>{if(t[r]){const e=t[r](n);if(null!==e)return e}const a=r in e?e[r]:te[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,t,r,n,o);var re=[],oe=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,a="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var i=re.indexOf(a);-1===i&&(i=re.push(a)-1,oe[i]={}),n=oe[i]&&oe[i][r]?oe[i][r]:oe[i][r]=s()}else n=s();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function s(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-expand-transition-time:0.3s;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden,.jer-visible{transition:var(--jer-expand-transition-time)}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative;transition:var(--jer-expand-transition-time)}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:transform var(--jer-expand-transition-time)}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-accordion-icon,.jer-rotate-90{transition:transform var(--jer-expand-transition-time)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string:after{content:"<empty string>:";font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}',{});const ae=({data:n,setData:r,rootName:a="root",onUpdate:s=(()=>{}),onEdit:l=s,onDelete:c=s,onAdd:d=s,onChange:u,onError:p,showErrorMessages:m=!0,enableClipboard:h=!0,indent:b=2,collapse:f=!1,collapseAnimationTime:j=300,showCollectionCount:x=!0,restrictEdit:E=!1,restrictDelete:D=!1,restrictAdd:w=!1,restrictTypeSelection:C=!1,restrictDrag:k=!0,searchFilter:S,searchText:O,searchDebounceTime:N=350,keySort:A=!1,showArrayIndices:T=!0,showStringQuotes:M=!0,defaultValue:P=null,minWidth:R=250,maxWidth:V="min(600px, 90vw)",rootFontSize:z,stringTruncate:F=250,translations:I={},className:K,id:L,customText:_={},customNodeDefinitions:B=[],customButtons:W=[],jsonParse:G=JSON.parse,jsonStringify:U=(e=>JSON.stringify(e,null,2)),errorMessageTimeout:H=2500,keyboardControls:Y={},insertAtTop:$=!1})=>{const{getStyles:J}=v(),Z=t.useCallback(se(f),[f]),q=t.useCallback(ne(I,_),[I,_]),[Q,te]=t.useState(O),[re,oe]=(({setData:e,data:n})=>{const[r,o]=t.useState(e?void 0:n),a=t.useCallback((t=>{e?e(t):o(t)}),[e]);return t.useEffect((()=>{e||o(n)}),[n]),[e?n:r,a]})({setData:r,data:n}),ae=document.querySelector(":root"),de=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(de)!==j&&(null==ae||ae.style.setProperty("--jer-expand-transition-time",j/1e3+"s")),t.useEffect((()=>{const e=setTimeout((()=>te(O)),N);return()=>clearTimeout(e)}),[O,N]);const ue={key:a,path:[],level:0,index:0,value:re,size:"object"==typeof re&&null!==re?Object.keys(re).length:1,parentData:null,fullData:re},pe=(e,t)=>o(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void oe(t.newData);const r=ce(n)?n:["error",n],[o,a]=r;if("error"===o)return oe(t.currentData),!1===a?q("ERROR_UPDATE",ue):String(a);oe(a)})),me=t.useMemo((()=>se(E)),[E]),ge=t.useMemo((()=>se(D)),[D]),he=t.useMemo((()=>se(w)),[w]),ye=t.useMemo((()=>se(k)),[k]),be=t.useMemo((()=>le(S)),[S]),fe=t.useMemo((()=>(e=>{const t=Object.assign({},y);for(const n of Object.keys(y)){const r=n;if(e[r]){const o=e[r],a=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(o)?o:[o]:"string"==typeof o?{key:o}:o;t[r]=a,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})(Y)),[Y]),je=t.useCallback(((e,t)=>((e,t,n)=>{const r=Object.entries(t);for(const[t,o]of r)if(g(n,e[t],t)){n.preventDefault(),o();break}})(fe,t,e)),[Y]),ve={name:a,nodeData:ue,onEdit:(e,t)=>o(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=ie(re,t,e,"update");if(o!==a)return yield pe(l,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>o(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=ie(re,t,e,"delete");return yield pe(c,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>o(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:a,newValue:i}=ie(re,t,e,"add",n);return yield pe(d,{currentData:r,newData:o,currentValue:a,newValue:i,name:t.slice(-1)[0],path:t})})),onChange:u,onError:p,showErrorMessages:m,onMove:(e,t,n)=>o(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=ie(re,e,"","delete"),i=e.slice(-1)[0],s=t.slice(0,-1),c=t.slice(-1)[0];let d="number"==typeof c?"above"===n?c:c+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===n?{insertBefore:c}:{insertAfter:c},{newData:p,newValue:m}=ie(o,[...s,d],a,"add",u);return yield pe(l,{currentData:r,newData:p,currentValue:a,newValue:m,name:t.slice(-1)[0],path:t})})),showCollectionCount:x,collapseFilter:Z,collapseAnimationTime:j,restrictEditFilter:me,restrictDeleteFilter:ge,restrictAddFilter:he,restrictTypeSelection:C,restrictDragFilter:ye,canDragOnto:!1,searchFilter:be,searchText:Q,enableClipboard:h,keySort:A,showArrayIndices:T,showStringQuotes:M,indent:b,defaultValue:P,stringTruncate:F,translate:q,customNodeDefinitions:B,customButtons:W,parentData:null,jsonParse:G,jsonStringify:U,errorMessageTimeout:H,handleKeyboard:je,keyboardControls:fe,insertAtTop:{object:!0===$||"object"===$,array:!0===$||"array"===$}},xe=Object.assign(Object.assign({},J("container",ue)),{minWidth:R,maxWidth:V});return xe.fontSize=null!=z?z:xe.fontSize,e.jsx("div",{id:L,className:"jer-editor-container "+K,style:xe,children:i(re)?e.jsx(ee,Object.assign({data:re},ve)):e.jsx(X,Object.assign({data:re,showLabel:!0},ve))})},ie=(e,t,o,a,i={})=>{if(0===t.length)return{currentData:e,newData:o,currentValue:e,newValue:o};const s=Object.assign({remove:"delete"===a},i),l="add"!==a?r(e,t):void 0;return{currentData:e,newData:n(e,t,o,s),currentValue:l,newValue:"delete"!==a?o:void 0}},se=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,le=e=>{if(void 0!==e)return"value"===e?c:"key"===e?d:"all"===e?(e,t)=>c(e,t)||d(e,t):e},ce=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),de=({value:t,setIsEditing:n,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:()=>n(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&n(!0)},className:"jer-value-string jer-hyperlink",style:c,children:e.jsxs("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:null!==(s=c.color)&&void 0!==s?s:void 0},children:['"',u(t,l),'"']})})},ue={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:de,showOnView:!0,showOnEdit:!1};exports.assign=n,exports.extract=r,exports.IconAdd=R,exports.IconCancel=K,exports.IconChevron=L,exports.IconCopy=F,exports.IconDelete=z,exports.IconEdit=V,exports.IconOk=I,exports.JsonEditor=t=>{var n;return e.jsx(j,{theme:null!==(n=t.theme)&&void 0!==n?n:b,icons:t.icons,children:e.jsx(k,{children:e.jsx(ae,Object.assign({},t))})})},exports.LinkCustomComponent=de,exports.LinkCustomNodeDefinition=ue,exports.candyWrapperTheme={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"}},exports.defaultTheme=b,exports.githubDarkTheme={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)"}},exports.githubLightTheme={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"}},exports.isCollection=i,exports.matchNode=c,exports.matchNodeKey=d,exports.monoDarkTheme={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"}},exports.monoLightTheme={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"}},exports.psychedelicTheme={displayName:"Psychedelic",fragments:{pale:{color:"#A8DADC"},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"}},exports.truncate=u; |
import React$1 from 'react'; | ||
import { Options } from 'object-property-assigner'; | ||
export { default as assign } from 'object-property-assigner'; | ||
@@ -65,2 +66,3 @@ export { default as extract } from 'object-property-extractor'; | ||
keyboardControls?: KeyboardControls; | ||
insertAtTop?: boolean | 'array' | 'object'; | ||
} | ||
@@ -124,3 +126,3 @@ declare const DataTypes: readonly ["string", "number", "boolean", "null", "object", "array"]; | ||
type CompareFunction = (a: string, b: string) => number; | ||
type InternalUpdateFunction = (value: unknown, path: CollectionKey[]) => Promise<string | void>; | ||
type InternalUpdateFunction = (value: unknown, path: CollectionKey[], options?: Options) => Promise<string | void>; | ||
type Position = 'above' | 'below'; | ||
@@ -202,2 +204,6 @@ type InternalMoveFunction = (source: CollectionKey[] | null, dest: CollectionKey[], position: Position) => Promise<string | void>; | ||
jsonStringify: (data: JsonData) => string; | ||
insertAtTop: { | ||
object: boolean; | ||
array: boolean; | ||
}; | ||
} | ||
@@ -257,8 +263,7 @@ type ValueData = string | number | boolean; | ||
} | ||
type ThemeName = 'default' | 'githubDark' | 'githubLight' | 'monoDark' | 'monoLight' | 'candyWrapper' | 'psychedelic'; | ||
type ThemeInput = ThemeName | Theme | Partial<ThemeStyles> | Array<ThemeName | Theme | Partial<ThemeStyles>>; | ||
type ThemeInput = Theme | Partial<ThemeStyles> | Array<Theme | Partial<ThemeStyles>>; | ||
declare const JsonEditor: React$1.FC<JsonEditorProps>; | ||
declare const themes: Record<ThemeName, Theme>; | ||
declare const defaultTheme: Theme; | ||
@@ -288,2 +293,9 @@ interface IconProps { | ||
export { CollectionNodeProps, CompareFunction, CopyFunction, CustomNodeDefinition, CustomNodeProps, CustomTextDefinitions, CustomTextFunction, DataType, DefaultValueFunction, FilterFunction, IconAdd, IconCancel, IconChevron, IconCopy, IconDelete, IconEdit, IconOk, IconReplacements, JerError, JsonData, JsonEditor, JsonEditorProps, KeyboardControls, LinkCustomComponent, LinkCustomNodeDefinition, LocalisedStrings, NodeData, OnChangeFunction, OnErrorFunction, SearchFilterFunction, Theme, ThemeInput, ThemeName, ThemeStyles, TranslateFunction, TypeFilterFunction, UpdateFunction, ValueNodeProps, isCollection, matchNode, matchNodeKey, themes, truncate }; | ||
declare const githubDarkTheme: Theme; | ||
declare const githubLightTheme: Theme; | ||
declare const monoDarkTheme: Theme; | ||
declare const monoLightTheme: Theme; | ||
declare const candyWrapperTheme: Theme; | ||
declare const psychedelicTheme: Theme; | ||
export { CollectionNodeProps, CompareFunction, CopyFunction, CustomNodeDefinition, CustomNodeProps, CustomTextDefinitions, CustomTextFunction, DataType, DefaultValueFunction, FilterFunction, IconAdd, IconCancel, IconChevron, IconCopy, IconDelete, IconEdit, IconOk, IconReplacements, JerError, JsonData, JsonEditor, JsonEditorProps, KeyboardControls, LinkCustomComponent, LinkCustomNodeDefinition, LocalisedStrings, NodeData, OnChangeFunction, OnErrorFunction, SearchFilterFunction, Theme, ThemeInput, ThemeStyles, TranslateFunction, TypeFilterFunction, UpdateFunction, ValueNodeProps, candyWrapperTheme, defaultTheme, githubDarkTheme, githubLightTheme, isCollection, matchNode, matchNodeKey, monoDarkTheme, monoLightTheme, psychedelicTheme, truncate }; |
@@ -1,1 +0,1 @@ | ||
import{jsxs as e,jsx as t,Fragment as n}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,t,n,r){return new(n||(n=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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}s((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const g=({className:n,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:[t("textarea",{id:`${r}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},l),rows:1,className:n,name:`${r}_textarea`,value:o,onChange:e=>a(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:i}),t("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"},l),children:s})]})},m=e=>null!==e&&"object"==typeof e,h=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!y(r,t,n))return!1}if(!n&&r&&!y(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!b(t,r))return!1}return!0},y=(e="",t,n=b)=>{const r=t.value;return Object.entries(r).some((([o,a])=>{const i=[...t.path,o],l=Object.assign(Object.assign({},t),{key:o,path:i,level:t.level+1,value:a,size:i.length,parentData:r});return m(a)?y(e,l,n):n(l,e)}))},b=(e,t="")=>{const{value:n}=e;if(null===n&&"null".includes(t.toLowerCase()))return!0;switch(typeof n){case"string":return n.toLowerCase().includes(t.toLowerCase());case"number":return!!String(n).includes(t);case"boolean":return n?"true".includes(t.toLowerCase())||"1"===t:"false".includes(t.toLowerCase())||"0"===t;default:return!1}},f=({key:e,path:t},n="")=>!!b({value:e},n)||!!t.some((e=>b({value:e},n))),v=(e,t=200)=>"string"==typeof e?e.length<t?e:`${e.slice(0,t-2).trim()}...`:e,j=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),E=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,D=(e,t,n)=>{const r=e.key,o=E(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:a,modifier:i}=t;return("stringLineBreak"!==n||"Enter"!==r||"Shift"!==o||"Enter"!==a||!(null==i?void 0:i.includes("Shift")))&&(r===a&&(i===o||Array.isArray(i)&&i.includes(o)))},w={key:"Enter"},C={confirm:w,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},w),{modifier:["Meta","Shift","Control"]}),objectLineBreak:w,stringConfirm:w,stringLineBreak:Object.assign(Object.assign({},w),{modifier:["Shift"]}),numberConfirm:w,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},booleanConfirm:w,clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},k={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:{pale:{color:"#A8DADC"},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"}}},O=k.default,S=r({getStyles:()=>({}),icons:{}}),N=({theme:e="default",icons:n={},children:r})=>{const o=A(e);return t(S.Provider,{value:{getStyles:(e,t)=>"function"==typeof o[e]?o[e](t):o[e],icons:n},children:r})},x=()=>o(S),A=e=>{var t,n,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((t=>"default"===e?{}:"string"==typeof t?T(k[t],a):P(t)?T({fragments:{},styles:t},a):T(t,a))),l=T(O,{});Object.keys(l).forEach((e=>{const t=e;i.forEach((e=>{e[t]&&(l[t]=Object.assign(Object.assign({},l[t]),e[t]))}))}));const s=Object.assign({},l);return Object.entries(a).forEach((([e,t])=>{const n=e;s[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},l[n]),r)}})),"function"!=typeof(null==s?void 0:s.inputHighlight)&&(null===(t=null==s?void 0:s.inputHighlight)||void 0===t?void 0:t.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(n=null==s?void 0:s.inputHighlight)||void 0===n?void 0:n.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},T=(e,t)=>{const{fragments:n,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 t[e]=o,Object.assign({},r);if("string"==typeof o){const t=null!==(a=null==n?void 0:n[o])&&void 0!==a?a:o;return"string"==typeof t?Object.assign(Object.assign({},r),{[R[e]]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},P=e=>!("styles"in e),R={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"},V="**INVALID_FUNCTION**",z=({value:n,setValue:r,isEditing:o,path:a,setIsEditing:i,handleEdit:l,handleCancel:s,stringTruncate:c,showStringQuotes:d,nodeData:u,handleKeyboard:p})=>{const{getStyles:m}=x(),h=j(a),y=d?'"':"";return o?t(g,{className:"jer-input-text",name:h,value:n,setValue:r,isEditing:o,handleKeyPress:e=>{p(e,{stringConfirm:l,cancel:s,stringLineBreak:()=>{var t,o;const a=document.getElementById(`${h}_textarea`);if(a){const i=null!==(t=null==a?void 0:a.selectionStart)&&void 0!==t?t:1/0,l=null!==(o=null==a?void 0:a.selectionEnd)&&void 0!==o?o:1/0,s=n.slice(0,i),c=n.slice(l);e.target.value=s+"\n"+c,a.setSelectionRange(i+1,i+1),r(s+"\n"+c)}}})},styles:m("input",u)}):e("div",{id:`${h}_display`,onDoubleClick:()=>i(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&i(!0)},className:"jer-value-string",style:m("string",u),children:[y,v(n,c),y]})},F=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s,handleKeyboard:c})=>{const{getStyles:d}=x();return r?t("input",{className:"jer-input-number",type:"text",name:j(o),value:e,onChange:e=>n(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:t=>c(t,{numberConfirm:i,cancel:l,numberUp:()=>n(Number(e)+1),numberDown:()=>n(Number(e)-1)}),style:Object.assign({width:String(e).length/1.5+2+"em"},d("input",s))}):t("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",s),children:e})},M=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s,handleKeyboard:c})=>{const{getStyles:d}=x();return r?t("input",{className:"jer-input-boolean",type:"checkbox",name:j(o),checked:e,onChange:()=>n(!e),onKeyDown:e=>c(e,{booleanConfirm:i,cancel:l}),autoFocus:!0}):t("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",s),children:String(e)})},K=({value:e,isEditing:n,setIsEditing:r,handleEdit:o,handleCancel:i,nodeData:l,handleKeyboard:s})=>{const{getStyles:c}=x();a((()=>(n&&document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d))),[n]);const d=e=>s(e,{confirm:o,cancel:i});return t("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:c("null",l),children:String(e)})},_=({value:e})=>{let n="Error!";switch(typeof e){case"string":e===V&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return t("span",{className:"jer-value-invalid",children:n})},L=({size:n,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:o,style:r,children:[t("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),t("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"})]}),I=({size:n,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:o,style:r,transform:"translate(0, 0.5)",children:[t("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"}),t("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"})]}),B=({size:e,style:n,className:r})=>t("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),W=({size:n,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:o,style:r,children:[t("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"}),t("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),t("path",{d:"M15 10l-4 4 4 4"})]}),G=({size:n,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:o,style:r,children:[t("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),t("path",{d:"M22 4L12 14.01l-3-3"})]}),U=({size:e,style:n,className:r})=>t("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),H=({size:e,style:n,className:r})=>t("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),Y=({name:e,nodeData:r,rotate:o})=>{var a,i,l,s,c,d,u;const{getStyles:p,icons:g}=x(),m={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(a=null==g?void 0:g.add)&&void 0!==a?a:t(L,Object.assign({},m,{style:p("iconAdd",r)}));case"edit":return null!==(i=null==g?void 0:g.edit)&&void 0!==i?i:t(I,Object.assign({},m,{style:p("iconEdit",r)}));case"delete":return null!==(l=null==g?void 0:g.delete)&&void 0!==l?l:t(B,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:t(W,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:t(G,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:t(U,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:t(H,{size:"1em",style:p("iconCollection",r)});default:return t(n,{})}},$=({startEdit:r,handleDelete:o,handleAdd:a,enableClipboard:l,type:s,customButtons:c,nodeData:d,translate:u,keyboardControls:p,handleKeyboard:g})=>{const{getStyles:m}=x(),h=u("KEY_NEW",d),[y,b]=i(!1),[f,v]=i(h),{key:j,path:D,value:w}=d;return e("div",{className:"jer-edit-buttons",style:{opacity:y?1:void 0},children:[l&&t("div",{onClick:e=>{e.stopPropagation();let t,n="value",r="";if(l){const o=E(e);o&&p.clipboardModifier.includes(o)?(t=X(D),r=t,n="path"):(t=w,r=s?JSON.stringify(w,null,2):String(t)),navigator.clipboard.writeText(r)}"function"==typeof l&&l({value:t,stringValue:r,path:D,key:j,type:n})},className:"jer-copy-pulse",children:t(Y,{name:"copy",nodeData:d})}),r&&t("div",{onClick:e=>{e.stopPropagation(),r()},children:t(Y,{name:"edit",nodeData:d})}),o&&t("div",{onClick:e=>{e.stopPropagation(),o()},children:t(Y,{name:"delete",nodeData:d})}),a&&t("div",{onClick:e=>{e.stopPropagation(),"object"===s?b(!0):a("")},children:t(Y,{name:"add",nodeData:d})}),null==c?void 0:c.map((({Element:e,onClick:n},r)=>t("div",{onClick:e=>n(d,e),children:t(e,{})},r))),y&&a&&"object"===s&&e(n,{children:[t("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:f,onChange:e=>v(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{g(e,{stringConfirm:()=>{a&&(b(!1),a(f),v(h))},cancel:()=>{b(!1),v(h)}})},style:m("input",d)}),t(J,{onOk:e=>{f&&(e.stopPropagation(),b(!1),a(f))},onCancel:e=>{e.stopPropagation(),b(!1)},nodeData:d})]})]})},J=({onOk:n,onCancel:r,nodeData:o})=>e("div",{className:"jer-confirm-buttons",children:[t("div",{onClick:n,children:t(Y,{name:"ok",nodeData:o})}),t("div",{onClick:r,children:t(Y,{name:"cancel",nodeData:o})})]}),X=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),Z=["string","number","boolean","null","object","array"],Q=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[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,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(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)},q=r({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),ee=({children:e})=>{const[n,r]=i(null),[o,a]=i(null),[l,s]=i({path:null,pathString:null});return t(q.Provider,{value:{collapseState:n,setCollapseState:e=>{r(e),null!==e&&setTimeout((()=>r(null)),2e3)},doesPathMatch:e=>{if(null===n)return!1;for(const[t,r]of n.path.entries())if(r!==e[t])return!1;return!0},currentlyEditingElement:o,setCurrentlyEditingElement:a,areChildrenBeingEdited:e=>null!==o&&o.includes(e),dragSource:l,setDragSource:s},children:e})},te=()=>o(q),ne=({props:e,collapsed:t})=>{const{data:n,nodeData:r,parentData:o,onEdit:a,onError:s,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:m,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:b}=te(),[f,v]=i(null),E=Object.assign(Object.assign({},r),{collapsed:t}),{path:D,key:w,size:C}=E,k=j(D),O=l((()=>!d(E)),[E]),S=l((()=>!u(E)),[E]),N=l((()=>!p(E)),[E]),x=l((()=>!g(E)&&S&&null===y),[E]),A=e=>{c&&(v(e),setTimeout((()=>v(null)),h)),console.warn("Error",e)},T=l((()=>(e,t)=>{A(e.message),s&&s({currentData:E.fullData,errorValue:t,currentValue:n,name:w,path:D,error:e})}),[s,c]),P=y===k,R=y===`key_${k}`,V="number"==typeof D.slice(-1)[0];return{pathString:k,nodeData:E,path:D,name:w,size:C,canEdit:O,canDelete:S,canAdd:N,canDrag:x,error:f,showError:A,onError:T,setError:v,handleEditKey:e=>{if(b(null),w===e)return;if(!o)return;const t=D.slice(0,-1);if(Object.keys(o).includes(e))return void T({code:"KEY_EXISTS",message:m("ERROR_KEY_EXISTS",E)},e);const n=Object.fromEntries(Object.entries(o).map((([t,n])=>t===w?[e,n]:[t,n])));a(n,t).then((t=>{t&&T({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:{isEditing:P,isEditingKey:R,isArray:V,canEditKey:null!==o&&O&&N&&S&&!V}}},re=({canDrag:e,canDragOnto:n,path:r,nodeData:o,onMove:a,onError:s,translate:c})=>{const{getStyles:d}=x(),{dragSource:u,setDragSource:p}=te(),[g,m]=i(!1),h=j(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=>n?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:t=>{t.stopPropagation(),v(e),p({path:null,pathString:null}),m(!1)},onDragEnter:t=>{var n;t.stopPropagation(),h.startsWith(null!==(n=u.pathString)&&void 0!==n?n:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[u,n]),f=l((()=>n&&null!==u.pathString?t("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:r.length}},b("below"))):null),[u,n]),v=e=>{var t,n;const i=null===(t=u.path)||void 0===t?void 0:t.slice(-1)[0],l=null===(n=u.path)||void 0===n?void 0:n.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:n})=>g===e?t("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",n)}):null,handleDrop:v}},oe=(e,t)=>{var n,r;const o=document.getElementsByClassName("jer-editor-container"),a=parseInt(o.length>0?getComputedStyle(o[0]).getPropertyValue("line-height"):"16px"),i=(null!==(r=null===(n=t.current)||void 0===n?void 0:n.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,t)=>e+t),0)*a;return Math.min(l+30,window.innerHeight-50)},ae=n=>{const{data:r,parentData:o,onEdit:c,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:m,restrictTypeSelection:y,searchFilter:b,searchText:f,showLabel:v,stringTruncate:j,showStringQuotes:E,indent:D,translate:w,customNodeDefinitions:C,handleKeyboard:k,keyboardControls:O}=n,{getStyles:S}=x(),{setCurrentlyEditingElement:N,setCollapseState:A}=te(),[T,P]=i("function"==typeof r?V:r),{pathString:R,nodeData:z,path:F,name:M,canEdit:K,canDelete:_,canDrag:L,error:I,onError:B,handleEditKey:W,derivedValues:G}=ne({props:n}),{dragSourceProps:U,getDropTargetProps:H,BottomDropTarget:Y,DropTargetPadding:X}=re({canDrag:L,canDragOnto:m,path:F,nodeData:z,onMove:p,onError:B,translate:w}),q=Q(C,z),[ee,oe]=i(ie(r,q)),ae=s((e=>{if(!u)return void P(e);const t=u({currentData:z.fullData,newValue:e,currentValue:T,name:M,path:F});P(t)}),[u]);a((()=>{P("function"==typeof r?V:r),oe(ie(r,q))}),[r,I]);const{CustomNode:ce,customNodeProps:de,hideKey:ue,showEditTools:pe=!0,showOnEdit:ge,showOnView:me}=q,he=[...Z,...C.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],ye=l((()=>{if("boolean"==typeof y)return y?[]:he;if(Array.isArray(y))return y;const e=y(z);return"boolean"==typeof e?e?[]:he:e}),[z,y]);if(!h("value",z,b,f))return null;const be=()=>{let e;switch(N(null),ee){case"object":e={[w("DEFAULT_NEW_KEY",z)]:T};break;case"array":e=null!=T?T:[];break;case"number":{const t=Number(T);e=isNaN(t)?0:t;break}default:e=T}c(e,F).then((t=>{t&&B({code:"UPDATE_ERROR",message:t},e)}))},fe=()=>{N(null),P(r),oe(ie(r,q))},{isEditing:ve,isEditingKey:je,canEditKey:Ee}=G,De=!ve&&I,we=ve&&ye.length>0,Ce="invalid"!==ee&&!I&&pe,ke=v&&je,Oe=v&&!je&&!ue,Se={value:T,parentData:o,setValue:ae,isEditing:ve,setIsEditing:K?()=>N(R):()=>{},handleEdit:be,handleCancel:fe,path:F,stringTruncate:j,showStringQuotes:E,nodeData:z,translate:w,handleKeyboard:k},Ne=ce&&(ve&&ge||!ve&&me)?t(ce,Object.assign({},n,{value:T,customNodeProps:de,setValue:ae,handleEdit:be,handleCancel:fe,handleKeyPress:e=>k(e,{stringConfirm:be,cancel:fe}),isEditing:ve,setIsEditing:()=>N(R),getStyles:S})):le(ie(r),Se);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:D/2+"em",position:"relative"},draggable:L},U,H("above"),{children:[Y,t(X,{position:"above",nodeData:z}),e("div",{className:"jer-value-main-row",style:{flexWrap:M.length>10?"wrap":"nowrap"},children:[Oe&&t("span",{className:"jer-key-text",style:Object.assign(Object.assign({},S("property",z)),{minWidth:`${Math.min(String(M).length+1,5)}ch`,flexShrink:M.length>10?1:0}),onDoubleClick:()=>Ee&&N(`key_${R}`),children:""===M?t("span",{className:F.length>0?"jer-empty-string":void 0}):`${M}:`}),ke&&t("input",{className:"jer-input-text jer-key-edit",type:"text",name:R,defaultValue:M,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>k(e,{stringConfirm:()=>W(e.target.value),cancel:fe}),style:{width:String(M).length/1.5+.5+"em"}}),e("div",{className:"jer-value-and-buttons",children:[t("div",{className:"jer-input-component",children:Ne}),ve?t(J,{onOk:be,onCancel:fe,nodeData:z}):Ce&&t($,{startEdit:K?()=>N(R):void 0,handleDelete:_?()=>{d(T,F).then((e=>{e&&B({code:"DELETE_ERROR",message:e},T)}))}:void 0,enableClipboard:g,translate:w,customButtons:n.customButtons,nodeData:z,handleKeyboard:k,keyboardControls:O}),we&&e("div",{className:"jer-select",children:[t("select",{name:`${M}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const t=C.find((t=>t.name===e));if(t)c(t.defaultValue,F),oe(e),N(null),A({path:F,collapsed:!1});else{const t=se(T,e,w("DEFAULT_NEW_KEY",z),(null==q?void 0:q.CustomNode)?w("DEFAULT_STRING",z):void 0);ae(t),c(t,F).then((e=>{e&&(B({code:"UPDATE_ERROR",message:e},t),N(null))}))}})(e.target.value),value:ee,children:ye.map((e=>t("option",{value:e,children:e},e)))}),t("span",{className:"focus"})]}),De&&t("span",{className:"jer-error-slug",style:S("error",z),children:I})]})]}),t(X,{position:"below",nodeData:z})]}))},ie=(e,t)=>(null==t?void 0:t.CustomNode)&&(null==t?void 0:t.name)&&t.showInTypesSelector?t.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",le=(e,n)=>{const r=n.value;switch(e){case"string":return t(z,Object.assign({},n,{value:r}));case"number":return t(F,Object.assign({},n,{value:r}));case"boolean":return t(M,Object.assign({},n,{value:r}));case"null":return t(K,Object.assign({},n));default:return t(_,Object.assign({},n))}},se=(e,t,n,r)=>{switch(t){case"string":return null!=r?r:String(e);case"number":{const t=Number(e);return isNaN(t)?0:t}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},ce=r=>{const{getStyles:o}=x(),{collapseState:s,setCollapseState:d,doesPathMatch:y,currentlyEditingElement:b,setCurrentlyEditingElement:f,areChildrenBeingEdited:v}=te(),{data:j,nodeData:D,parentData:w,showCollectionCount:C,onEdit:k,onAdd:O,onDelete:S,canDragOnto:N,collapseFilter:A,collapseAnimationTime:T,onMove:P,enableClipboard:R,searchFilter:V,searchText:z,indent:F,keySort:M,showArrayIndices:K,defaultValue:_,translate:L,customNodeDefinitions:I,jsonParse:B,jsonStringify:W,keyboardControls:G,handleKeyboard:U}=r,[H,X]=i(W(j)),Z=A(D),{contentRef:q,isAnimating:ee,maxHeight:ie,collapsed:le,animateCollapse:se}=((e,t,n)=>{const[r,o]=i(n?0:void 0),[a,l]=i(n),s=c(!1),d=c(null),u=c(0),p=c();return{contentRef:d,isAnimating:s.current,animateCollapse:n=>{var r,i;if(a!==n){switch(window.clearTimeout(p.current),s.current=!0,n){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||oe(e,d))}l(!a),p.current=window.setTimeout((()=>{s.current=!1,n||o(void 0)}),t)}},maxHeight:r,collapsed:a}})(j,T,Z),{pathString:de,nodeData:ue,path:pe,name:ge,size:me,canEdit:he,canDelete:ye,canAdd:be,canDrag:fe,error:ve,setError:je,onError:Ee,handleEditKey:De,derivedValues:we}=ne({props:r,collapsed:le}),{dragSourceProps:Ce,getDropTargetProps:ke,BottomDropTarget:Oe,DropTargetPadding:Se}=re({canDrag:fe,canDragOnto:N,path:pe,nodeData:ue,onMove:P,onError:Ee,translate:L}),Ne=c(!Z);a((()=>{X(W(j))}),[j]),a((()=>{const e=A(ue)&&!we.isEditing;Ne.current=!e,se(e)}),[A]),a((()=>{null!==s&&y(pe)&&(Ne.current=!0,se(s.collapsed))}),[s]);const xe=l((()=>(e,t)=>"function"!=typeof _?_:_(e,t)),[_]),{CustomNode:Ae,customNodeProps:Te,CustomWrapper:Pe,wrapperProps:Re={},hideKey:Ve,showEditTools:ze=!0,showOnEdit:Fe,showOnView:Me,showCollectionWrapper:Ke=!0}=l((()=>Q(I,ue)),[]);if(!h("collection",ue,V,z)&&ue.level>0)return null;const _e=Array.isArray(j)?"array":"object",Le="array"===_e?{open:"[",close:"]"}:{open:"{",close:"}"},Ie=e=>U(e,{objectConfirm:We,cancel:Ue}),Be=e=>{const t=E(e);if(t&&G.collapseModifier.includes(t))return Ne.current=!0,void d({collapsed:!le,path:pe});b&&b.includes(de)||(Ne.current=!0,d(null),se(!le))},We=()=>{try{const e=B(H);if(f(null),je(null),JSON.stringify(e)===JSON.stringify(j))return;k(e,pe).then((t=>{t&&Ee({code:"UPDATE_ERROR",message:t},e)}))}catch(e){Ee({code:"INVALID_JSON",message:L("ERROR_INVALID_JSON",ue)},H)}},Ge=pe.length>0?()=>{S(j,pe).then((e=>{e&&Ee({code:"DELETE_ERROR",message:e},u(j,pe))}))}:void 0,Ue=()=>{f(null),je(null),X(W(j))},{isEditing:He,isEditingKey:Ye,isArray:$e,canEditKey:Je}=we,Xe="when-closed"===C?le:C,Ze=!He&&ze,Qe=(K||!$e)&&!Ve&&void 0!==ge,qe=Ae&&(He&&Fe||!He&&Me),et=M&&"object"===_e,tt=Object.entries(j).map((([e,t])=>["array"===_e?Number(e):e,t]));et&&tt.sort("function"==typeof M?(e,t)=>M(e[0],t[0]):void 0);const nt=Ne.current?He?t("div",{className:"jer-collection-text-edit",children:e("div",{children:[t(g,{className:"jer-collection-text-area",name:de,value:H,setValue:X,isEditing:He,handleKeyPress:Ie,styles:o("input",ue)}),t("div",{className:"jer-collection-input-button-row",children:t(J,{onOk:We,onCancel:Ue,nodeData:ue})})]})}):tt.map((([e,n],a)=>{const i={key:e,value:n,path:[...pe,e],level:pe.length+1,index:a,size:m(n)?Object.keys(n).length:1,parentData:j,fullData:ue.fullData};return t("div",{className:"jer-collection-element",style:o("collectionElement",i),children:m(n)?t(ce,Object.assign({},r,{data:n,parentData:j,nodeData:i,showCollectionCount:C,canDragOnto:he}),e):t(ae,Object.assign({},r,{data:n,parentData:j,nodeData:i,canDragOnto:he,showLabel:"object"===_e||K}),e)},e)})):null,rt=!!Ke&≤rt||(Ne.current=!0);const ot=Object.assign(Object.assign({},r),{data:j,value:j,parentData:w,nodeData:ue,setValue:e=>p(void 0,void 0,void 0,(function*(){return yield k(e,pe)})),handleEdit:We,handleCancel:Ue,handleKeyPress:Ie,isEditing:He,setIsEditing:()=>f(de),getStyles:o,canDragOnto:he}),at=qe?t(Ae,Object.assign({customNodeProps:Te},ot,{children:nt})):nt,it=Ye?t("input",{className:"jer-input-text jer-key-edit",type:"text",name:de,defaultValue:ge,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>U(e,{stringConfirm:()=>De(e.target.value),cancel:Ue}),style:{width:String(ge).length/1.5+.5+"em"}}):Qe&&t("span",{className:"jer-key-text",style:o("property",ue),onClick:e=>e.stopPropagation(),onDoubleClick:()=>Je&&f(`key_${de}`),children:""===ge?t("span",{className:pe.length>0?"jer-empty-string":void 0}):`${ge}:`}),lt=Ze&&t($,{startEdit:he?()=>{Ne.current=!0,f(de)}:void 0,handleAdd:be?e=>{se(!1);const t=xe(ue,e);"array"===_e?O(t,[...pe,j.length]).then((e=>{e&&Ee({code:"ADD_ERROR",message:e},t)})):e in j?Ee({code:"KEY_EXISTS",message:L("ERROR_KEY_EXISTS",ue)},e):O(t,[...pe,e]).then((e=>{e&&Ee({code:"ADD_ERROR",message:e},t)}))}:void 0,handleDelete:ye?Ge:void 0,enableClipboard:R,type:_e,nodeData:ue,translate:L,customButtons:r.customButtons,keyboardControls:G,handleKeyboard:U}),st=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===pe.length?0:F/2)+"em"},o("collection",ue)),{position:"relative"}),draggable:fe},Ce,ke("above"),{children:[t("div",{className:"jer-clickzone",style:{width:F/2+1+"em",zIndex:10+2*ue.level},onClick:e=>Be(e)}),!He&&Oe,t(Se,{position:"above",nodeData:ue}),Ke?e("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:e=>Be(e),children:[e("div",{className:"jer-collection-name",children:[t("div",{className:"jer-collapse-icon jer-accordion-icon"+(le?" jer-rotate-90":""),style:{zIndex:11+2*ue.level},onClick:e=>Be(e),children:t(Y,{name:"chevron",rotate:le,nodeData:ue})}),it,!He&&t("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",ue),children:Le.open})]}),!He&&Xe&&t("div",{className:"jer-collection-item-count"+(Xe?" jer-visible":" jer-hidden"),style:o("itemCount",ue),children:1===me?L("ITEM_SINGLE",Object.assign(Object.assign({},ue),{size:1}),1):L("ITEMS_MULTIPLE",ue,me)}),t("div",{className:"jer-brackets"+(rt?" jer-visible":" jer-hidden"),style:o("bracket",ue),children:Le.close}),lt]}):Ve?t(n,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[it,lt]}),e("div",{className:"jer-collection-inner",style:Object.assign({overflowY:rt||ee?"clip":"visible",maxHeight:v(de)?void 0:ie},o("collectionInner",ue)),ref:q,children:[at,t("div",{className:He?"jer-collection-error-row":"jer-collection-error-row-edit",children:ve&&t("span",{className:"jer-error-slug",style:o("error",ue),children:ve})}),!He&&Ke&&t("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},o("bracket",ue)),{marginLeft:(F<3?-1:F<6?-.5:0)+"em"}),children:Le.close})]}),t(Se,{position:"below",nodeData:ue})]}));return Pe?t(Pe,Object.assign({customNodeProps:Re},ot,{children:st})):st},de={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"},ue=(e,t)=>(n,r,o)=>((e,t,n,r,o)=>{if(t[r]){const e=t[r](n);if(null!==e)return e}const a=r in e?e[r]:de[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,t,r,n,o);var pe=[],ge=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,a="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var i=pe.indexOf(a);-1===i&&(i=pe.push(a)-1,ge[i]={}),n=ge[i]&&ge[i][r]?ge[i][r]:ge[i][r]=l()}else n=l();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function l(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-expand-transition-time:0.3s;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden,.jer-visible{transition:var(--jer-expand-transition-time)}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative;transition:var(--jer-expand-transition-time)}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:transform var(--jer-expand-transition-time)}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-accordion-icon,.jer-rotate-90{transition:transform var(--jer-expand-transition-time)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string:after{content:"<empty string>:";font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}',{});const me=({data:e,setData:n,rootName:r="root",onUpdate:o=(()=>{}),onEdit:c=o,onDelete:d=o,onAdd:u=o,onChange:g,onError:h,showErrorMessages:y=!0,enableClipboard:b=!0,indent:f=2,collapse:v=!1,collapseAnimationTime:j=300,showCollectionCount:E=!0,restrictEdit:w=!1,restrictDelete:k=!1,restrictAdd:O=!1,restrictTypeSelection:S=!1,restrictDrag:N=!0,searchFilter:A,searchText:T,searchDebounceTime:P=350,keySort:R=!1,showArrayIndices:V=!0,showStringQuotes:z=!0,defaultValue:F=null,minWidth:M=250,maxWidth:K="min(600px, 90vw)",rootFontSize:_,stringTruncate:L=250,translations:I={},className:B,id:W,customText:G={},customNodeDefinitions:U=[],customButtons:H=[],jsonParse:Y=JSON.parse,jsonStringify:$=(e=>JSON.stringify(e,null,2)),errorMessageTimeout:J=2500,keyboardControls:X={}})=>{const{getStyles:Z}=x(),Q=s(be(v),[v]),q=s(ue(I,G),[I,G]),[ee,te]=i(T),[ne,re]=(({setData:e,data:t})=>{const[n,r]=i(e?void 0:t),o=s((t=>{e?e(t):r(t)}),[e]);return a((()=>{e||r(t)}),[t]),[e?t:n,o]})({setData:n,data:e}),oe=document.querySelector(":root"),ie=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(ie)!==j&&(null==oe||oe.style.setProperty("--jer-expand-transition-time",j/1e3+"s")),a((()=>{const e=setTimeout((()=>te(T)),P);return()=>clearTimeout(e)}),[T,P]);const le={key:r,path:[],level:0,index:0,value:ne,size:"object"==typeof ne&&null!==ne?Object.keys(ne).length:1,parentData:null,fullData:ne},se=(e,t)=>p(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void re(t.newData);const r=ve(n)?n:["error",n],[o,a]=r;if("error"===o)return re(t.currentData),!1===a?q("ERROR_UPDATE",le):String(a);re(a)})),de=l((()=>be(w)),[w]),pe=l((()=>be(k)),[k]),ge=l((()=>be(O)),[O]),me=l((()=>be(N)),[N]),he=l((()=>fe(A)),[A]),je=l((()=>(e=>{const t=Object.assign({},C);for(const n of Object.keys(C)){const r=n;if(e[r]){const o=e[r],a=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(o)?o:[o]:"string"==typeof o?{key:o}:o;t[r]=a,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})(X)),[X]),Ee=s(((e,t)=>((e,t,n)=>{const r=Object.entries(t);for(const[t,o]of r)if(D(n,e[t],t)){n.preventDefault(),o();break}})(je,t,e)),[X]),De={name:r,nodeData:le,onEdit:(e,t)=>p(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=ye(ne,t,e,"update");if(o!==a)return yield se(c,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>p(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=ye(ne,t,e,"delete");return yield se(d,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t)=>p(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=ye(ne,t,e,"add");return yield se(u,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onChange:g,onError:h,showErrorMessages:y,onMove:(e,t,n)=>p(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=ye(ne,e,"","delete"),i=e.slice(-1)[0],l=t.slice(0,-1),s=t.slice(-1)[0];let d="number"==typeof s?"above"===n?s:s+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===n?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=ye(o,[...l,d],a,"add",u);return yield se(c,{currentData:r,newData:p,currentValue:a,newValue:g,name:t.slice(-1)[0],path:t})})),showCollectionCount:E,collapseFilter:Q,collapseAnimationTime:j,restrictEditFilter:de,restrictDeleteFilter:pe,restrictAddFilter:ge,restrictTypeSelection:S,restrictDragFilter:me,canDragOnto:!1,searchFilter:he,searchText:ee,enableClipboard:b,keySort:R,showArrayIndices:V,showStringQuotes:z,indent:f,defaultValue:F,stringTruncate:L,translate:q,customNodeDefinitions:U,customButtons:H,parentData:null,jsonParse:Y,jsonStringify:$,errorMessageTimeout:J,handleKeyboard:Ee,keyboardControls:je},we=Object.assign(Object.assign({},Z("container",le)),{minWidth:M,maxWidth:K});return we.fontSize=null!=_?_:we.fontSize,t("div",{id:W,className:"jer-editor-container "+B,style:we,children:m(ne)?t(ce,Object.assign({data:ne},De)):t(ae,Object.assign({data:ne,showLabel:!0},De))})},he=e=>t(N,{theme:e.theme,icons:e.icons,children:t(ee,{children:t(me,Object.assign({},e))})}),ye=(e,t,n,r,o={})=>{if(0===t.length)return{currentData:e,newData:n,currentValue:e,newValue:n};const a=Object.assign({remove:"delete"===r},o),i="add"!==r?u(e,t):void 0;return{currentData:e,newData:d(e,t,n,a),currentValue:i,newValue:"delete"!==r?n:void 0}},be=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,fe=e=>{if(void 0!==e)return"value"===e?b:"key"===e?f:"all"===e?(e,t)=>b(e,t)||f(e,t):e},ve=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),je=({value:n,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 t("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:n,target:"_blank",rel:"noreferrer",style:{color:null!==(s=d.color)&&void 0!==s?s:void 0},children:['"',v(n,c),'"']})})},Ee={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:je,showOnView:!0,showOnEdit:!1};export{L as IconAdd,U as IconCancel,H as IconChevron,W as IconCopy,B as IconDelete,I as IconEdit,G as IconOk,he as JsonEditor,je as LinkCustomComponent,Ee as LinkCustomNodeDefinition,m as isCollection,b as matchNode,f as matchNodeKey,k as themes,v as truncate}; | ||
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createContext as r,useContext as o,useState as a,useEffect 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,t,n,r){return new(n||(n=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 t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}s((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const g=({className:n,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:[t("textarea",{id:`${r}_textarea`,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},l),rows:1,className:n,name:`${r}_textarea`,value:o,onChange:e=>a(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:i}),t("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"},l),children:s})]})},m=e=>null!==e&&"object"==typeof e,h=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!y(r,t,n))return!1}if(!n&&r&&!y(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!b(t,r))return!1}return!0},y=(e="",t,n=b)=>{const r=t.value;return Object.entries(r).some((([o,a])=>{const i=[...t.path,o],l=Object.assign(Object.assign({},t),{key:o,path:i,level:t.level+1,value:a,size:i.length,parentData:r});return m(a)?y(e,l,n):n(l,e)}))},b=(e,t="")=>{const{value:n}=e;if(null===n&&"null".includes(t.toLowerCase()))return!0;switch(typeof n){case"string":return n.toLowerCase().includes(t.toLowerCase());case"number":return!!String(n).includes(t);case"boolean":return n?"true".includes(t.toLowerCase())||"1"===t:"false".includes(t.toLowerCase())||"0"===t;default:return!1}},f=({key:e,path:t},n="")=>!!b({value:e},n)||!!t.some((e=>b({value:e},n))),v=(e,t=200)=>"string"==typeof e?e.length<t?e:`${e.slice(0,t-2).trim()}...`:e,j=e=>e.map((e=>""===e?String.fromCharCode(0):e)).join("."),E=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,D=(e,t,n)=>{const r=e.key,o=E(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:a,modifier:i}=t;return("stringLineBreak"!==n||"Enter"!==r||"Shift"!==o||"Enter"!==a||!(null==i?void 0:i.includes("Shift")))&&(r===a&&(i===o||Array.isArray(i)&&i.includes(o)))},w={key:"Enter"},C={confirm:w,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},w),{modifier:["Meta","Shift","Control"]}),objectLineBreak:w,stringConfirm:w,stringLineBreak:Object.assign(Object.assign({},w),{modifier:["Shift"]}),numberConfirm:w,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},booleanConfirm:w,clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},k={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)"}},O=r({getStyles:()=>({}),icons:{}}),S=({theme:e=k,icons:n={},children:r})=>{const o=x(e);return t(O.Provider,{value:{getStyles:(e,t)=>"function"==typeof o[e]?o[e](t):o[e],icons:n},children:r})},N=()=>o(O),x=e=>{var t,n,r,o;const a={},i=(Array.isArray(e)?e:[e]).map((e=>T(e)?A({fragments:{},styles:e},a):A(e,a))),l=A(k,{});Object.keys(l).forEach((e=>{const t=e;i.forEach((e=>{e[t]&&(l[t]=Object.assign(Object.assign({},l[t]),e[t]))}))}));const s=Object.assign({},l);return Object.entries(a).forEach((([e,t])=>{const n=e;s[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},l[n]),r)}})),"function"!=typeof(null==s?void 0:s.inputHighlight)&&(null===(t=null==s?void 0:s.inputHighlight)||void 0===t?void 0:t.backgroundColor)&&document.documentElement.style.setProperty("--jer-highlight-color",null===(n=null==s?void 0:s.inputHighlight)||void 0===n?void 0:n.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},A=(e,t)=>{const{fragments:n,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const a=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var a,i;if("function"==typeof o)return t[e]=o,Object.assign({},r);if("string"==typeof o){const t=null!==(a=null==n?void 0:n[o])&&void 0!==a?a:o;return"string"==typeof t?Object.assign(Object.assign({},r),{[null!==(i=P[e])&&void 0!==i?i:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},T=e=>!("styles"in e),P={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},R=r({collapseState:null,setCollapseState:()=>{},doesPathMatch:()=>!1,currentlyEditingElement:null,setCurrentlyEditingElement:()=>{},areChildrenBeingEdited:()=>!1,dragSource:{path:null,pathString:null},setDragSource:()=>{}}),V=({children:e})=>{const[n,r]=a(null),[o,i]=a(null),[l,s]=a({path:null,pathString:null});return t(R.Provider,{value:{collapseState:n,setCollapseState:e=>{r(e),null!==e&&setTimeout((()=>r(null)),2e3)},doesPathMatch:e=>{if(null===n)return!1;for(const[t,r]of n.path.entries())if(r!==e[t])return!1;return!0},currentlyEditingElement:o,setCurrentlyEditingElement:i,areChildrenBeingEdited:e=>null!==o&&o.includes(e),dragSource:l,setDragSource:s},children:e})},z=()=>o(R),F="**INVALID_FUNCTION**",M=({value:n,setValue:r,isEditing:o,path:a,setIsEditing:i,handleEdit:l,handleCancel:s,stringTruncate:c,showStringQuotes:d,nodeData:u,handleKeyboard:p})=>{const{getStyles:m}=N(),h=j(a),y=d?'"':"";return o?t(g,{className:"jer-input-text",name:h,value:n,setValue:r,isEditing:o,handleKeyPress:e=>{p(e,{stringConfirm:l,cancel:s,stringLineBreak:()=>{var t,o;const a=document.getElementById(`${h}_textarea`);if(a){const i=null!==(t=null==a?void 0:a.selectionStart)&&void 0!==t?t:1/0,l=null!==(o=null==a?void 0:a.selectionEnd)&&void 0!==o?o:1/0,s=n.slice(0,i),c=n.slice(l);e.target.value=s+"\n"+c,a.setSelectionRange(i+1,i+1),r(s+"\n"+c)}}})},styles:m("input",u)}):e("div",{id:`${h}_display`,onDoubleClick:()=>i(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&i(!0)},className:"jer-value-string",style:m("string",u),children:[y,v(n,c),y]})},K=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s,handleKeyboard:c})=>{const{getStyles:d}=N();return r?t("input",{className:"jer-input-number",type:"text",name:j(o),value:e,onChange:e=>n(e.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:t=>c(t,{numberConfirm:i,cancel:l,numberUp:()=>n(Number(e)+1),numberDown:()=>n(Number(e)-1)}),style:Object.assign({width:String(e).length/1.5+2+"em"},d("input",s))}):t("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",s),children:e})},_=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,handleCancel:l,nodeData:s,handleKeyboard:c})=>{const{getStyles:d}=N();return r?t("input",{className:"jer-input-boolean",type:"checkbox",name:j(o),checked:e,onChange:()=>n(!e),onKeyDown:e=>c(e,{booleanConfirm:i,cancel:l}),autoFocus:!0}):t("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",s),children:String(e)})},I=({value:e,isEditing:n,setIsEditing:r,handleEdit:o,handleCancel:a,nodeData:l,handleKeyboard:s})=>{const{getStyles:c}=N();i((()=>(n&&document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d))),[n]);const d=e=>s(e,{confirm:o,cancel:a});return t("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:c("null",l),children:String(e)})},L=({value:e})=>{let n="Error!";switch(typeof e){case"string":e===F&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return t("span",{className:"jer-value-invalid",children:n})},B=({size:n,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:o,style:r,children:[t("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),t("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"})]}),W=({size:n,style:r,className:o})=>e("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:n,height:n,className:o,style:r,transform:"translate(0, 0.5)",children:[t("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"}),t("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"})]}),G=({size:e,style:n,className:r})=>t("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),U=({size:n,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:o,style:r,children:[t("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"}),t("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),t("path",{d:"M15 10l-4 4 4 4"})]}),H=({size:n,style:r,className:o})=>e("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:n,height:n,className:o,style:r,children:[t("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),t("path",{d:"M22 4L12 14.01l-3-3"})]}),Y=({size:e,style:n,className:r})=>t("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),$=({size:e,style:n,className:r})=>t("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:r,style:n,children:t("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"})}),J=({name:e,nodeData:r,rotate:o})=>{var a,i,l,s,c,d,u;const{getStyles:p,icons:g}=N(),m={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(a=null==g?void 0:g.add)&&void 0!==a?a:t(B,Object.assign({},m,{style:p("iconAdd",r)}));case"edit":return null!==(i=null==g?void 0:g.edit)&&void 0!==i?i:t(W,Object.assign({},m,{style:p("iconEdit",r)}));case"delete":return null!==(l=null==g?void 0:g.delete)&&void 0!==l?l:t(G,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:t(U,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:t(H,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:t(Y,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:t($,{size:"1em",style:p("iconCollection",r)});default:return t(n,{})}},X=({startEdit:r,handleDelete:o,handleAdd:i,enableClipboard:l,type:s,customButtons:c,nodeData:d,translate:u,keyboardControls:p,handleKeyboard:g})=>{const{getStyles:m}=N(),h=u("KEY_NEW",d),[y,b]=a(!1),[f,v]=a(h),{key:j,path:D,value:w}=d;return e("div",{className:"jer-edit-buttons",style:{opacity:y?1:void 0},children:[l&&t("div",{onClick:e=>{e.stopPropagation();let t,n="value",r="";if(l){const o=E(e);o&&p.clipboardModifier.includes(o)?(t=Q(D),r=t,n="path"):(t=w,r=s?JSON.stringify(w,null,2):String(t)),navigator.clipboard.writeText(r)}"function"==typeof l&&l({value:t,stringValue:r,path:D,key:j,type:n})},className:"jer-copy-pulse",children:t(J,{name:"copy",nodeData:d})}),r&&t("div",{onClick:e=>{e.stopPropagation(),r()},children:t(J,{name:"edit",nodeData:d})}),o&&t("div",{onClick:e=>{e.stopPropagation(),o()},children:t(J,{name:"delete",nodeData:d})}),i&&t("div",{onClick:e=>{e.stopPropagation(),"object"===s?b(!0):i("")},children:t(J,{name:"add",nodeData:d})}),null==c?void 0:c.map((({Element:e,onClick:n},r)=>t("div",{onClick:e=>n(d,e),children:t(e,{})},r))),y&&i&&"object"===s&&e(n,{children:[t("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:f,onChange:e=>v(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{g(e,{stringConfirm:()=>{i&&(b(!1),i(f),v(h))},cancel:()=>{b(!1),v(h)}})},style:m("input",d)}),t(Z,{onOk:e=>{f&&(e.stopPropagation(),b(!1),i(f))},onCancel:e=>{e.stopPropagation(),b(!1)},nodeData:d})]})]})},Z=({onOk:n,onCancel:r,nodeData:o})=>e("div",{className:"jer-confirm-buttons",children:[t("div",{onClick:n,children:t(J,{name:"ok",nodeData:o})}),t("div",{onClick:r,children:t(J,{name:"cancel",nodeData:o})})]}),Q=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),q=["string","number","boolean","null","object","array"],ee=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[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,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(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)},te=({props:e,collapsed:t})=>{const{data:n,nodeData:r,parentData:o,onEdit:i,onError:s,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:m,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:b}=z(),[f,v]=a(null),E=Object.assign(Object.assign({},r),{collapsed:t}),{path:D,key:w,size:C}=E,k=j(D),O=l((()=>!d(E)),[E]),S=l((()=>!u(E)),[E]),N=l((()=>!p(E)),[E]),x=l((()=>!g(E)&&S&&null===y),[E]),A=e=>{c&&(v(e),setTimeout((()=>v(null)),h)),console.warn("Error",e)},T=l((()=>(e,t)=>{A(e.message),s&&s({currentData:E.fullData,errorValue:t,currentValue:n,name:w,path:D,error:e})}),[s,c]),P=y===k,R=y===`key_${k}`,V="number"==typeof D.slice(-1)[0];return{pathString:k,nodeData:E,path:D,name:w,size:C,canEdit:O,canDelete:S,canAdd:N,canDrag:x,error:f,showError:A,onError:T,setError:v,handleEditKey:e=>{if(b(null),w===e)return;if(!o)return;const t=D.slice(0,-1);if(Object.keys(o).includes(e))return void T({code:"KEY_EXISTS",message:m("ERROR_KEY_EXISTS",E)},e);const n=Object.fromEntries(Object.entries(o).map((([t,n])=>t===w?[e,n]:[t,n])));i(n,t).then((t=>{t&&T({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:{isEditing:P,isEditingKey:R,isArray:V,canEditKey:null!==o&&O&&N&&S&&!V}}},ne=({canDrag:e,canDragOnto:n,path:r,nodeData:o,onMove:i,onError:s,translate:c})=>{const{getStyles:d}=N(),{dragSource:u,setDragSource:p}=z(),[g,m]=a(!1),h=j(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=>n?{onDragOver:e=>{e.stopPropagation(),e.preventDefault()},onDrop:t=>{t.stopPropagation(),v(e),p({path:null,pathString:null}),m(!1)},onDragEnter:t=>{var n;t.stopPropagation(),h.startsWith(null!==(n=u.pathString)&&void 0!==n?n:"")||m(e)},onDragExit:e=>{e.stopPropagation(),m(!1)}}:{}),[u,n]),f=l((()=>n&&null!==u.pathString?t("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:r.length}},b("below"))):null),[u,n]),v=e=>{var t,n;const a=null===(t=u.path)||void 0===t?void 0:t.slice(-1)[0],l=null===(n=u.path)||void 0===n?void 0:n.slice(0,-1).join("."),d=r.slice(0,-1).join(""),{parentData:p}=o;"string"==typeof a&&p&&!Array.isArray(p)&&Object.keys(p).includes(a)&&a in p&&l!==d?s({code:"KEY_EXISTS",message:c("ERROR_KEY_EXISTS",o)},a):i(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:n})=>g===e?t("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",n)}):null,handleDrop:v}},re=(e,t)=>{var n,r;const o=document.getElementsByClassName("jer-editor-container"),a=parseInt(o.length>0?getComputedStyle(o[0]).getPropertyValue("line-height"):"16px"),i=(null!==(r=null===(n=t.current)||void 0===n?void 0:n.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,t)=>e+t),0)*a;return Math.min(l+30,window.innerHeight-50)},oe=n=>{const{data:r,parentData:o,onEdit:c,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:m,restrictTypeSelection:y,searchFilter:b,searchText:f,showLabel:v,stringTruncate:j,showStringQuotes:E,indent:D,translate:w,customNodeDefinitions:C,handleKeyboard:k,keyboardControls:O}=n,{getStyles:S}=N(),{setCurrentlyEditingElement:x,setCollapseState:A}=z(),[T,P]=a("function"==typeof r?F:r),{pathString:R,nodeData:V,path:M,name:K,canEdit:_,canDelete:I,canDrag:L,error:B,onError:W,handleEditKey:G,derivedValues:U}=te({props:n}),{dragSourceProps:H,getDropTargetProps:Y,BottomDropTarget:$,DropTargetPadding:J}=ne({canDrag:L,canDragOnto:m,path:M,nodeData:V,onMove:p,onError:W,translate:w}),Q=ee(C,V),[re,oe]=a(ae(r,Q)),se=s((e=>{if(!u)return void P(e);const t=u({currentData:V.fullData,newValue:e,currentValue:T,name:K,path:M});P(t)}),[u]);i((()=>{P("function"==typeof r?F:r),oe(ae(r,Q))}),[r,B]);const{CustomNode:ce,customNodeProps:de,hideKey:ue,showEditTools:pe=!0,showOnEdit:ge,showOnView:me}=Q,he=[...q,...C.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],ye=l((()=>{if("boolean"==typeof y)return y?[]:he;if(Array.isArray(y))return y;const e=y(V);return"boolean"==typeof e?e?[]:he:e}),[V,y]);if(!h("value",V,b,f))return null;const be=()=>{let e;switch(x(null),re){case"object":e={[w("DEFAULT_NEW_KEY",V)]:T};break;case"array":e=null!=T?T:[];break;case"number":{const t=Number(T);e=isNaN(t)?0:t;break}default:e=T}c(e,M).then((t=>{t&&W({code:"UPDATE_ERROR",message:t},e)}))},fe=()=>{x(null),P(r),oe(ae(r,Q))},{isEditing:ve,isEditingKey:je,canEditKey:Ee}=U,De=!ve&&B,we=ve&&ye.length>0,Ce="invalid"!==re&&!B&&pe,ke=v&&je,Oe=v&&!je&&!ue,Se={value:T,parentData:o,setValue:se,isEditing:ve,setIsEditing:_?()=>x(R):()=>{},handleEdit:be,handleCancel:fe,path:M,stringTruncate:j,showStringQuotes:E,nodeData:V,translate:w,handleKeyboard:k},Ne=ce&&(ve&&ge||!ve&&me)?t(ce,Object.assign({},n,{value:T,customNodeProps:de,setValue:se,handleEdit:be,handleCancel:fe,handleKeyPress:e=>k(e,{stringConfirm:be,cancel:fe}),isEditing:ve,setIsEditing:()=>x(R),getStyles:S})):ie(ae(r),Se);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:D/2+"em",position:"relative"},draggable:L},H,Y("above"),{children:[$,t(J,{position:"above",nodeData:V}),e("div",{className:"jer-value-main-row",style:{flexWrap:K.length>10?"wrap":"nowrap"},children:[Oe&&t("span",{className:"jer-key-text",style:Object.assign(Object.assign({},S("property",V)),{minWidth:`${Math.min(String(K).length+1,5)}ch`,flexShrink:K.length>10?1:0}),onDoubleClick:()=>Ee&&x(`key_${R}`),children:""===K?t("span",{className:M.length>0?"jer-empty-string":void 0}):`${K}:`}),ke&&t("input",{className:"jer-input-text jer-key-edit",type:"text",name:R,defaultValue:K,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>k(e,{stringConfirm:()=>G(e.target.value),cancel:fe}),style:{width:String(K).length/1.5+.5+"em"}}),e("div",{className:"jer-value-and-buttons",children:[t("div",{className:"jer-input-component",children:Ne}),ve?t(Z,{onOk:be,onCancel:fe,nodeData:V}):Ce&&t(X,{startEdit:_?()=>x(R):void 0,handleDelete:I?()=>{d(T,M).then((e=>{e&&W({code:"DELETE_ERROR",message:e},T)}))}:void 0,enableClipboard:g,translate:w,customButtons:n.customButtons,nodeData:V,handleKeyboard:k,keyboardControls:O}),we&&e("div",{className:"jer-select",children:[t("select",{name:`${K}-type-select`,className:"jer-type-select",onChange:e=>(e=>{const t=C.find((t=>t.name===e));if(t)c(t.defaultValue,M),oe(e),x(null),A({path:M,collapsed:!1});else{const t=le(T,e,w("DEFAULT_NEW_KEY",V),(null==Q?void 0:Q.CustomNode)?w("DEFAULT_STRING",V):void 0);se(t),c(t,M).then((e=>{e&&(W({code:"UPDATE_ERROR",message:e},t),x(null))}))}})(e.target.value),value:re,children:ye.map((e=>t("option",{value:e,children:e},e)))}),t("span",{className:"focus"})]}),De&&t("span",{className:"jer-error-slug",style:S("error",V),children:B})]})]}),t(J,{position:"below",nodeData:V})]}))},ae=(e,t)=>(null==t?void 0:t.CustomNode)&&(null==t?void 0:t.name)&&t.showInTypesSelector?t.name:"string"==typeof e?"string":"number"==typeof e?"number":"boolean"==typeof e?"boolean":null===e?"null":"invalid",ie=(e,n)=>{const r=n.value;switch(e){case"string":return t(M,Object.assign({},n,{value:r}));case"number":return t(K,Object.assign({},n,{value:r}));case"boolean":return t(_,Object.assign({},n,{value:r}));case"null":return t(I,Object.assign({},n));default:return t(L,Object.assign({},n))}},le=(e,t,n,r)=>{switch(t){case"string":return null!=r?r:String(e);case"number":{const t=Number(e);return isNaN(t)?0:t}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},se=r=>{const{getStyles:o}=N(),{collapseState:s,setCollapseState:d,doesPathMatch:y,currentlyEditingElement:b,setCurrentlyEditingElement:f,areChildrenBeingEdited:v}=z(),{data:j,nodeData:D,parentData:w,showCollectionCount:C,onEdit:k,onAdd:O,onDelete:S,canDragOnto:x,collapseFilter:A,collapseAnimationTime:T,onMove:P,enableClipboard:R,searchFilter:V,searchText:F,indent:M,keySort:K,showArrayIndices:_,defaultValue:I,translate:L,customNodeDefinitions:B,jsonParse:W,jsonStringify:G,keyboardControls:U,handleKeyboard:H,insertAtTop:Y}=r,[$,Q]=a(G(j)),q=A(D),{contentRef:ae,isAnimating:ie,maxHeight:le,collapsed:ce,animateCollapse:de}=((e,t,n)=>{const[r,o]=a(n?0:void 0),[i,l]=a(n),s=c(!1),d=c(null),u=c(0),p=c();return{contentRef:d,isAnimating:s.current,animateCollapse:n=>{var r,a;if(i!==n){switch(window.clearTimeout(p.current),s.current=!0,n){case!0:{const e=null!==(a=null===(r=d.current)||void 0===r?void 0:r.offsetHeight)&&void 0!==a?a:0;u.current=e,o(e),setTimeout((()=>{o(0)}),5);break}case!1:o(u.current||re(e,d))}l(!i),p.current=window.setTimeout((()=>{s.current=!1,n||o(void 0)}),t)}},maxHeight:r,collapsed:i}})(j,T,q),{pathString:ue,nodeData:pe,path:ge,name:me,size:he,canEdit:ye,canDelete:be,canAdd:fe,canDrag:ve,error:je,setError:Ee,onError:De,handleEditKey:we,derivedValues:Ce}=te({props:r,collapsed:ce}),{dragSourceProps:ke,getDropTargetProps:Oe,BottomDropTarget:Se,DropTargetPadding:Ne}=ne({canDrag:ve,canDragOnto:x,path:ge,nodeData:pe,onMove:P,onError:De,translate:L}),xe=c(!q);i((()=>{Q(G(j))}),[j]),i((()=>{const e=A(pe)&&!Ce.isEditing;xe.current=!e,de(e)}),[A]),i((()=>{null!==s&&y(ge)&&(xe.current=!0,de(s.collapsed))}),[s]);const Ae=l((()=>(e,t)=>"function"!=typeof I?I:I(e,t)),[I]),{CustomNode:Te,customNodeProps:Pe,CustomWrapper:Re,wrapperProps:Ve={},hideKey:ze,showEditTools:Fe=!0,showOnEdit:Me,showOnView:Ke,showCollectionWrapper:_e=!0}=l((()=>ee(B,pe)),[]);if(!h("collection",pe,V,F)&&pe.level>0)return null;const Ie=Array.isArray(j)?"array":"object",Le="array"===Ie?{open:"[",close:"]"}:{open:"{",close:"}"},Be=e=>H(e,{objectConfirm:Ge,cancel:He}),We=e=>{const t=E(e);if(t&&U.collapseModifier.includes(t))return xe.current=!0,void d({collapsed:!ce,path:ge});b&&b.includes(ue)||(xe.current=!0,d(null),de(!ce))},Ge=()=>{try{const e=W($);if(f(null),Ee(null),JSON.stringify(e)===JSON.stringify(j))return;k(e,ge).then((t=>{t&&De({code:"UPDATE_ERROR",message:t},e)}))}catch(e){De({code:"INVALID_JSON",message:L("ERROR_INVALID_JSON",pe)},$)}},Ue=ge.length>0?()=>{S(j,ge).then((e=>{e&&De({code:"DELETE_ERROR",message:e},u(j,ge))}))}:void 0,He=()=>{f(null),Ee(null),Q(G(j))},{isEditing:Ye,isEditingKey:$e,isArray:Je,canEditKey:Xe}=Ce,Ze="when-closed"===C?ce:C,Qe=!Ye&&Fe,qe=(_||!Je)&&!ze&&void 0!==me,et=Te&&(Ye&&Me||!Ye&&Ke),tt=K&&"object"===Ie,nt=Object.entries(j).map((([e,t])=>["array"===Ie?Number(e):e,t]));tt&&nt.sort("function"==typeof K?(e,t)=>K(e[0],t[0]):void 0);const rt=xe.current?Ye?t("div",{className:"jer-collection-text-edit",children:e("div",{children:[t(g,{className:"jer-collection-text-area",name:ue,value:$,setValue:Q,isEditing:Ye,handleKeyPress:Be,styles:o("input",pe)}),t("div",{className:"jer-collection-input-button-row",children:t(Z,{onOk:Ge,onCancel:He,nodeData:pe})})]})}):nt.map((([e,n],a)=>{const i={key:e,value:n,path:[...ge,e],level:ge.length+1,index:a,size:m(n)?Object.keys(n).length:1,parentData:j,fullData:pe.fullData};return t("div",{className:"jer-collection-element",style:o("collectionElement",i),children:m(n)?t(se,Object.assign({},r,{data:n,parentData:j,nodeData:i,showCollectionCount:C,canDragOnto:ye}),e):t(oe,Object.assign({},r,{data:n,parentData:j,nodeData:i,canDragOnto:ye,showLabel:"object"===Ie||_}),e)},e)})):null,ot=!!_e&&ce;ot||(xe.current=!0);const at=Object.assign(Object.assign({},r),{data:j,value:j,parentData:w,nodeData:pe,setValue:e=>p(void 0,void 0,void 0,(function*(){return yield k(e,ge)})),handleEdit:Ge,handleCancel:He,handleKeyPress:Be,isEditing:Ye,setIsEditing:()=>f(ue),getStyles:o,canDragOnto:ye}),it=et?t(Te,Object.assign({customNodeProps:Pe},at,{children:rt})):rt,lt=$e?t("input",{className:"jer-input-text jer-key-edit",type:"text",name:ue,defaultValue:me,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>H(e,{stringConfirm:()=>we(e.target.value),cancel:He}),style:{width:String(me).length/1.5+.5+"em"}}):qe&&t("span",{className:"jer-key-text",style:o("property",pe),onClick:e=>e.stopPropagation(),onDoubleClick:()=>Xe&&f(`key_${ue}`),children:""===me?t("span",{className:ge.length>0?"jer-empty-string":void 0}):`${me}:`}),st=Qe&&t(X,{startEdit:ye?()=>{xe.current=!0,f(ue)}:void 0,handleAdd:fe?e=>{de(!1);const t=Ae(pe,e);if("array"===Ie){const e=Y.array?0:j.length,n=Y.array?{insert:!0}:{};O(t,[...ge,e],n).then((e=>{e&&De({code:"ADD_ERROR",message:e},t)}))}else if(e in j)De({code:"KEY_EXISTS",message:L("ERROR_KEY_EXISTS",pe)},e);else{const n=Y.object?{insertBefore:0}:{};O(t,[...ge,e],n).then((e=>{e&&De({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:be?Ue:void 0,enableClipboard:R,type:Ie,nodeData:pe,translate:L,customButtons:r.customButtons,keyboardControls:U,handleKeyboard:H}),ct=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===ge.length?0:M/2)+"em"},o("collection",pe)),{position:"relative"}),draggable:ve},ke,Oe("above"),{children:[t("div",{className:"jer-clickzone",style:{width:M/2+1+"em",zIndex:10+2*pe.level},onClick:e=>We(e)}),!Ye&&Se,t(Ne,{position:"above",nodeData:pe}),_e?e("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:e=>We(e),children:[e("div",{className:"jer-collection-name",children:[t("div",{className:"jer-collapse-icon jer-accordion-icon"+(ce?" jer-rotate-90":""),style:{zIndex:11+2*pe.level},onClick:e=>We(e),children:t(J,{name:"chevron",rotate:ce,nodeData:pe})}),lt,!Ye&&t("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",pe),children:Le.open})]}),!Ye&&Ze&&t("div",{className:"jer-collection-item-count"+(Ze?" jer-visible":" jer-hidden"),style:o("itemCount",pe),children:1===he?L("ITEM_SINGLE",Object.assign(Object.assign({},pe),{size:1}),1):L("ITEMS_MULTIPLE",pe,he)}),t("div",{className:"jer-brackets"+(ot?" jer-visible":" jer-hidden"),style:o("bracket",pe),children:Le.close}),st]}):ze?t(n,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[lt,st]}),e("div",{className:"jer-collection-inner",style:Object.assign({overflowY:ot||ie?"clip":"visible",maxHeight:v(ue)?void 0:le},o("collectionInner",pe)),ref:ae,children:[it,t("div",{className:Ye?"jer-collection-error-row":"jer-collection-error-row-edit",children:je&&t("span",{className:"jer-error-slug",style:o("error",pe),children:je})}),!Ye&&_e&&t("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},o("bracket",pe)),{marginLeft:(M<3?-1:M<6?-.5:0)+"em"}),children:Le.close})]}),t(Ne,{position:"below",nodeData:pe})]}));return Re?t(Re,Object.assign({customNodeProps:Ve},at,{children:ct})):ct},ce={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"},de=(e,t)=>(n,r,o)=>((e,t,n,r,o)=>{if(t[r]){const e=t[r](n);if(null!==e)return e}const a=r in e?e[r]:ce[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,t,r,n,o);var ue=[],pe=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,a="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var i=ue.indexOf(a);-1===i&&(i=ue.push(a)-1,pe[i]={}),n=pe[i]&&pe[i][r]?pe[i][r]:pe[i][r]=l()}else n=l();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function l(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),o=0;o<n.length;o++)e.setAttribute(n[o],t.attributes[n[o]]);var i="prepend"===r?"afterbegin":"beforeend";return a.insertAdjacentElement(i,e),e}}(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-expand-transition-time:0.3s;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden,.jer-visible{transition:var(--jer-expand-transition-time)}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative;transition:var(--jer-expand-transition-time)}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:transform var(--jer-expand-transition-time)}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-accordion-icon,.jer-rotate-90{transition:transform var(--jer-expand-transition-time)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string:after{content:"<empty string>:";font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}',{});const ge=({data:e,setData:n,rootName:r="root",onUpdate:o=(()=>{}),onEdit:c=o,onDelete:d=o,onAdd:u=o,onChange:g,onError:h,showErrorMessages:y=!0,enableClipboard:b=!0,indent:f=2,collapse:v=!1,collapseAnimationTime:j=300,showCollectionCount:E=!0,restrictEdit:w=!1,restrictDelete:k=!1,restrictAdd:O=!1,restrictTypeSelection:S=!1,restrictDrag:x=!0,searchFilter:A,searchText:T,searchDebounceTime:P=350,keySort:R=!1,showArrayIndices:V=!0,showStringQuotes:z=!0,defaultValue:F=null,minWidth:M=250,maxWidth:K="min(600px, 90vw)",rootFontSize:_,stringTruncate:I=250,translations:L={},className:B,id:W,customText:G={},customNodeDefinitions:U=[],customButtons:H=[],jsonParse:Y=JSON.parse,jsonStringify:$=(e=>JSON.stringify(e,null,2)),errorMessageTimeout:J=2500,keyboardControls:X={},insertAtTop:Z=!1})=>{const{getStyles:Q}=N(),q=s(ye(v),[v]),ee=s(de(L,G),[L,G]),[te,ne]=a(T),[re,ae]=(({setData:e,data:t})=>{const[n,r]=a(e?void 0:t),o=s((t=>{e?e(t):r(t)}),[e]);return i((()=>{e||r(t)}),[t]),[e?t:n,o]})({setData:n,data:e}),ie=document.querySelector(":root"),le=getComputedStyle(document.documentElement).getPropertyValue("--jer-expand-transition-time");1e3*parseFloat(le)!==j&&(null==ie||ie.style.setProperty("--jer-expand-transition-time",j/1e3+"s")),i((()=>{const e=setTimeout((()=>ne(T)),P);return()=>clearTimeout(e)}),[T,P]);const ce={key:r,path:[],level:0,index:0,value:re,size:"object"==typeof re&&null!==re?Object.keys(re).length:1,parentData:null,fullData:re},ue=(e,t)=>p(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void ae(t.newData);const r=fe(n)?n:["error",n],[o,a]=r;if("error"===o)return ae(t.currentData),!1===a?ee("ERROR_UPDATE",ce):String(a);ae(a)})),pe=l((()=>ye(w)),[w]),ge=l((()=>ye(k)),[k]),me=l((()=>ye(O)),[O]),ve=l((()=>ye(x)),[x]),je=l((()=>be(A)),[A]),Ee=l((()=>(e=>{const t=Object.assign({},C);for(const n of Object.keys(C)){const r=n;if(e[r]){const o=e[r],a=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(o)?o:[o]:"string"==typeof o?{key:o}:o;t[r]=a,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})(X)),[X]),De=s(((e,t)=>((e,t,n)=>{const r=Object.entries(t);for(const[t,o]of r)if(D(n,e[t],t)){n.preventDefault(),o();break}})(Ee,t,e)),[X]),we={name:r,nodeData:ce,onEdit:(e,t)=>p(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=he(re,t,e,"update");if(o!==a)return yield ue(c,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>p(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=he(re,t,e,"delete");return yield ue(d,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>p(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:a,newValue:i}=he(re,t,e,"add",n);return yield ue(u,{currentData:r,newData:o,currentValue:a,newValue:i,name:t.slice(-1)[0],path:t})})),onChange:g,onError:h,showErrorMessages:y,onMove:(e,t,n)=>p(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=he(re,e,"","delete"),i=e.slice(-1)[0],l=t.slice(0,-1),s=t.slice(-1)[0];let d="number"==typeof s?"above"===n?s:s+1:"number"==typeof i?`arr_${i}`:i;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof i&&"number"==typeof d&&i<d&&(d-=1);const u="number"==typeof d?{insert:!0}:"above"===n?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=he(o,[...l,d],a,"add",u);return yield ue(c,{currentData:r,newData:p,currentValue:a,newValue:g,name:t.slice(-1)[0],path:t})})),showCollectionCount:E,collapseFilter:q,collapseAnimationTime:j,restrictEditFilter:pe,restrictDeleteFilter:ge,restrictAddFilter:me,restrictTypeSelection:S,restrictDragFilter:ve,canDragOnto:!1,searchFilter:je,searchText:te,enableClipboard:b,keySort:R,showArrayIndices:V,showStringQuotes:z,indent:f,defaultValue:F,stringTruncate:I,translate:ee,customNodeDefinitions:U,customButtons:H,parentData:null,jsonParse:Y,jsonStringify:$,errorMessageTimeout:J,handleKeyboard:De,keyboardControls:Ee,insertAtTop:{object:!0===Z||"object"===Z,array:!0===Z||"array"===Z}},Ce=Object.assign(Object.assign({},Q("container",ce)),{minWidth:M,maxWidth:K});return Ce.fontSize=null!=_?_:Ce.fontSize,t("div",{id:W,className:"jer-editor-container "+B,style:Ce,children:m(re)?t(se,Object.assign({data:re},we)):t(oe,Object.assign({data:re,showLabel:!0},we))})},me=e=>{var n;return t(S,{theme:null!==(n=e.theme)&&void 0!==n?n:k,icons:e.icons,children:t(V,{children:t(ge,Object.assign({},e))})})},he=(e,t,n,r,o={})=>{if(0===t.length)return{currentData:e,newData:n,currentValue:e,newValue:n};const a=Object.assign({remove:"delete"===r},o),i="add"!==r?u(e,t):void 0;return{currentData:e,newData:d(e,t,n,a),currentValue:i,newValue:"delete"!==r?n:void 0}},ye=e=>"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,be=e=>{if(void 0!==e)return"value"===e?b:"key"===e?f:"all"===e?(e,t)=>b(e,t)||f(e,t):e},fe=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),ve=({value:n,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 t("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:n,target:"_blank",rel:"noreferrer",style:{color:null!==(s=d.color)&&void 0!==s?s:void 0},children:['"',v(n,c),'"']})})},je={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:ve,showOnView:!0,showOnEdit:!1},Ee={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)"}},De={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"}},we={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"}},Ce={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"}},ke={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"}},Oe={displayName:"Psychedelic",fragments:{pale:{color:"#A8DADC"},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"}};export{B as IconAdd,Y as IconCancel,$ as IconChevron,U as IconCopy,G as IconDelete,W as IconEdit,H as IconOk,me as JsonEditor,ve as LinkCustomComponent,je as LinkCustomNodeDefinition,ke as candyWrapperTheme,k as defaultTheme,Ee as githubDarkTheme,De as githubLightTheme,m as isCollection,b as matchNode,f as matchNodeKey,we as monoDarkTheme,Ce as monoLightTheme,Oe as psychedelicTheme,v as truncate}; |
{ | ||
"name": "json-edit-react", | ||
"version": "1.18.0", | ||
"version": "1.19.0-beta1", | ||
"description": "React component for editing or viewing JSON/object data", | ||
"main": "build/index.cjs.js", | ||
"module": "build/index.esm.js", | ||
"types": "build/index.d.ts", | ||
"sideEffects": false, | ||
"types": "build/index.d.ts", | ||
"exports": { | ||
@@ -43,4 +43,4 @@ ".": { | ||
"dependencies": { | ||
"object-property-assigner": "^1.3.1", | ||
"object-property-extractor": "^1.0.12" | ||
"object-property-assigner": "^1.3.5", | ||
"object-property-extractor": "^1.0.13" | ||
}, | ||
@@ -47,0 +47,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
173775
644
835
3
1