json-edit-react 1.29.1-beta1 → 1.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -2
- package/build/index.cjs.js +1 -1
- package/build/index.esm.js +1 -1
- package/package.json +2 -3
- package/build/style.css +0 -426
package/README.md
CHANGED
|
@@ -6,11 +6,86 @@ The {{BLOCKS}} below are replaced from the equivalent blocks in the main README
|
|
|
6
6
|
`yarn prepareReadme` script is run (which also happens before publish).
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<img width="60" alt="screenshot" src="image/logo192.png" style="float:left; margin-right: 1em;">
|
|
10
|
+
|
|
11
|
+
A highly-configurable [React](https://github.com/facebook/react) component for editing or viewing JSON/object data
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [Explore the Demo](https://carlosnz.github.io/json-edit-react/) <!-- omit in toc -->
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+

|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
[](https://deepwiki.com/CarlosNZ/json-edit-react)
|
|
21
|
+
[](https://github.com/CarlosNZ/json-edit-react/discussions)
|
|
22
|
+
[](https://github.com/sponsors/CarlosNZ)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features include:
|
|
26
|
+
|
|
27
|
+
- ✅ **Easy inline editing** of individual values or whole blocks of JSON text
|
|
28
|
+
- 🔒 **Granular control** – restrict edits, deletions, or additions per element
|
|
29
|
+
- 📏 **[JSON Schema](https://json-schema.org/) validation** (using 3rd-party validation library)
|
|
30
|
+
- 🎨 **Customisable UI** — built-in or custom [themes](https://github.com/CarlosNZ/json-edit-react#themes--styles), CSS overrides or targeted classes
|
|
31
|
+
- 📦 **Self-contained** — plain HTML/CSS, so no dependence on external UI libraries
|
|
32
|
+
- 🔍 **Search & filter** — find data by key, value or custom function
|
|
33
|
+
- 🚧 **[Custom components](https://github.com/CarlosNZ/json-edit-react#custom-nodes)** — replace specific nodes with specialised components (e.g. date picker, links, images, `undefined`, `BigInt`, `Symbol`)
|
|
34
|
+
- 🌏 **[Localisation](https://github.com/CarlosNZ/json-edit-react#localisation)** — easily translate UI labels and messages
|
|
35
|
+
- 🔄 **[Drag-n-drop](https://github.com/CarlosNZ/json-edit-react#drag-n-drop)** re-ordering within objects/arrays
|
|
36
|
+
- 🎹 **[Keyboard customisation](https://github.com/CarlosNZ/json-edit-react#keyboard-customisation)** — define your own key bindings
|
|
37
|
+
- 🎮 **[External control](https://github.com/CarlosNZ/json-edit-react#external-control-1)** via callbacks and triggers
|
|
38
|
+
|
|
39
|
+
💡 Try the **[Live Demo](https://carlosnz.github.io/json-edit-react/)** to see these features in action!
|
|
40
|
+
|
|
41
|
+
<img width="392" alt="screenshot" src="image/screenshot.png">
|
|
10
42
|
|
|
11
43
|
<img width="838" alt="breaking changes" src="image/admonition_npm.png">
|
|
12
44
|
|
|
13
|
-
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
# Depending on your package manager:
|
|
49
|
+
|
|
50
|
+
npm i json-edit-react
|
|
51
|
+
# OR
|
|
52
|
+
yarn add json-edit-react
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Implementation
|
|
56
|
+
|
|
57
|
+
```jsx
|
|
58
|
+
import { JsonEditor } from 'json-edit-react'
|
|
59
|
+
|
|
60
|
+
// In your React component:
|
|
61
|
+
return (
|
|
62
|
+
<JsonEditor
|
|
63
|
+
data={ jsonData }
|
|
64
|
+
setData={ setJsonData } // optional
|
|
65
|
+
{ ...otherProps } />
|
|
66
|
+
);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
**(for end user)**
|
|
72
|
+
|
|
73
|
+
It's pretty self explanatory (click the "edit" icon to edit, etc.), but there are a few not-so-obvious ways of interacting with the editor:
|
|
74
|
+
|
|
75
|
+
- **Double-click** a value (or a key) to edit it
|
|
76
|
+
- When editing a string, use `Cmd/Ctrl/Shift-Enter` to add a new line (`Enter` submits the value)
|
|
77
|
+
- It's the opposite when editing a full object/array node (which you do by **clicking "edit"** on an object or array value) — `Enter` for new line, and `Cmd/Ctrl/Shift-Enter` for submit
|
|
78
|
+
- `Escape` to **cancel** editing
|
|
79
|
+
- When clicking the "**clipboard**" icon, holding down `Cmd/Ctrl` will copy the *path* to the selected node rather than its value
|
|
80
|
+
- When opening/closing a node, hold down "Alt/Option" to open/close *all* child nodes at once
|
|
81
|
+
- For Number inputs, **arrow-up** and **down** keys will increment/decrement the value
|
|
82
|
+
- For Boolean inputs, **space bar** will toggle the value
|
|
83
|
+
- Easily navigate to the next or previous node for editing using the `Tab`/`Shift-Tab` keys.
|
|
84
|
+
- **Drag and drop** items to change the structure or modify display order
|
|
85
|
+
- When editing is not permitted, double-clicking a string value will expand the text to the full value if it is truncated due to length (there is also a clickable "..." for long strings)
|
|
86
|
+
- **JSON text input** can accept "looser" input, if an additional JSON parsing method is provided (e.g. [JSON5](https://json5.org/)). See `jsonParse` prop.
|
|
87
|
+
|
|
88
|
+
[Have a play with the Demo app](https://carlosnz.github.io/json-edit-react/) to get a feel for it!
|
|
14
89
|
|
|
15
90
|
---
|
|
16
91
|
|
package/build/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"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){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}function a(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 i=({className:t,name:n,value:r,setValue:o,handleKeyPress:a,styles:i,textAreaRef:s})=>{if("string"!=typeof r)return null;const l="\n"===r.slice(-1)?r+".":r;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${n}_textarea`,ref:s,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:l})]})},s=e=>null!==e&&"object"==typeof e,l=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!c(r,t,n))return!1}if(!n&&r&&!c(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!d(t,r))return!1}return!0},c=(e="",t,n=d)=>{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 s(a)?c(e,l,n):n(l,e)}))},d=(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}},u=({key:e,path:t},n="")=>!!d({value:e},n)||!!t.some((e=>d({value:e},n))),p=(e,t)=>(null!=t?t:"")+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"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:h,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},f=(e,t,n="next",o)=>{const a=t.slice(0,t.length-1),i=t.slice(-1)[0];if(void 0===i)return null;const l=r(e,a),c=j(l);Array.isArray(l)||o(c,(({key:e,value:t})=>[e,t]));const d=c.findIndex((e=>e.key===i)),u=c[d+("next"===n?1:-1)];return u?s(u.value)?0===Object.keys(u.value).length?f(e,[...a,u.key],n,o):b(e,[...a,u.key],n,o):[...a,u.key]:0===a.length?null:f(e,a,n,o)},b=(e,t,n="next",o)=>{const a=r(e,t);if(!s(a))return t;const i=Array.isArray(a)?a.map(((e,t)=>t)):Object.keys(a);o(i,(e=>[e,a]));const l="next"===n?i[0]:i[i.length-1];return b(e,[...t,l],n,o)},j=e=>Array.isArray(e)?e.map(((e,t)=>({index:t,value:e,key:t}))):Object.entries(e).map((([e,t],n)=>({key:e,value:t,index:n}))),v=(e,t)=>{var n,r,o,a;const i=e.current,s=null!==(n=null==i?void 0:i.selectionStart)&&void 0!==n?n:1/0,l=null!==(r=null==i?void 0:i.selectionEnd)&&void 0!==r?r:1/0,c=(null===(o=null==i?void 0:i.textContent)||void 0===o?void 0:o.slice(0,s))+t+(null===(a=null==i?void 0:i.textContent)||void 0===a?void 0:a.slice(l));return i.value=c,null==i||i.setSelectionRange(s+1,s+1),c},x=e=>{if(e!==E){if(Array.isArray(e))return e.map((e=>x(e)));if(e&&"object"==typeof e)for(const t in e)e[t]=x(e[t]);return e}},E="__undefined__",C={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)"}},D=t.createContext({getStyles:()=>({}),icons:{}}),w=({theme:t=C,icons:n={},docRoot:r,children:o})=>{const a=O(t,r);return e.jsx(D.Provider,{value:{getStyles:(e,t)=>"function"==typeof a[e]?a[e](t):a[e],icons:n},children:o})},k=()=>t.useContext(D),O=(e,t)=>{var n,r,o,a;const i={},s=(Array.isArray(e)?e:[e]).map((e=>N(e)?S({fragments:{},styles:e},i):S(e,i))),l=S(C,{});Object.keys(l).forEach((e=>{const t=e;s.forEach((e=>{e[t]&&(l[t]=Object.assign(Object.assign({},l[t]),e[t]))}))}));const c=Object.assign({},l);return Object.entries(i).forEach((([e,t])=>{const n=e;c[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},l[n]),r)}})),"function"!=typeof(null==c?void 0:c.inputHighlight)&&(null===(n=null==c?void 0:c.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",null===(r=null==c?void 0:c.inputHighlight)||void 0===r?void 0:r.backgroundColor),"function"!=typeof(null==c?void 0:c.iconCopy)&&(null===(o=null==c?void 0:c.iconCopy)||void 0===o?void 0:o.color)&&t.style.setProperty("--jer-icon-copy-color",null===(a=null==c?void 0:c.iconCopy)||void 0===a?void 0:a.color),c},S=(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=T[e])&&void 0!==i?i:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},N=e=>!("styles"in e),T={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},A=t.createContext(null),R=({children:n,onEditEvent:r,onCollapse:o})=>{const[a,i]=t.useState(null),[s,l]=t.useState(null),[c,d]=t.useState(null),[u,m]=t.useState({path:null,pathString:null}),g=t.useRef(null),h=t.useRef("next"),y=t.useRef(null);return e.jsx(A.Provider,{value:{collapseState:a,setCollapseState:e=>{i(e),o&&null!==e&&(Array.isArray(e)?e.forEach((e=>o(e))):o(e)),null!==e&&setTimeout((()=>i(null)),2e3)},getMatchingCollapseState:e=>{if(Array.isArray(a)){for(const t of a)if(K(e,t))return t;return null}return K(e,a)?a:null},currentlyEditingElement:s,setCurrentlyEditingElement:(e,t)=>{const n="string"==typeof e||null===e?e:p(e,"key"===t?"key_":void 0);null!==s&&null!==n&&null!==g.current&&g.current(),l(n),r&&(Array.isArray(e)||null===e)&&r(e,"key"===t),g.current="function"==typeof t?t:null},areChildrenBeingEdited:e=>null!==s&&s.includes(e),previouslyEditedElement:y.current,setPreviouslyEditedElement:e=>{y.current=e},tabDirection:h.current,setTabDirection:e=>{h.current=e},previousValue:c,setPreviousValue:d,dragSource:u,setDragSource:m},children:n})},P=()=>{const e=t.useContext(A);if(!e)throw new Error("Missing Context Provider");return e},K=(e,t)=>{if(null===t)return!1;if(!t.includeChildren)return t.path.every(((t,n)=>e[n]===t))&&t.path.length===e.length;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},I="**INVALID_FUNCTION**",V=({nodeData:n,showStringQuotes:r=!0,stringTruncate:o=200,pathString:a,canEdit:i,setIsEditing:s,styles:l,translate:c,value:d,TextWrapper:u=({children:e})=>e})=>{const p=null!=d?d:n.value,[m,g]=t.useState(!1),h=r?'"':"",y=p.length>o,f=()=>{i?s(!0):g(!m)};return e.jsxs("div",{id:`${a}_display`,onDoubleClick:f,onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&f()},className:"jer-value-string",style:l,children:[h,y?m?e.jsxs(e.Fragment,{children:[e.jsx(u,{children:e.jsxs("span",{children:[p,h]})}),e.jsxs("span",{className:"jer-string-expansion jer-show-less",onClick:()=>g(!1),children:[" ",c("SHOW_LESS",n)]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(u,{children:[e.jsx("span",{children:p.slice(0,o-2).trimEnd()})," "]}),e.jsx("span",{className:"jer-string-expansion jer-ellipsis",onClick:()=>g(!0),children:"..."}),h]}):e.jsx(u,{children:`${p}${h}`})]})},M=({styles:n,pathString:r,value:o,setValue:a,handleEdit:s,handleKeyboard:l,keyboardCommon:c})=>{const d=t.useRef(null);return e.jsx(i,{className:"jer-input-text",textAreaRef:d,name:r,value:o,setValue:a,handleKeyPress:e=>{l(e,Object.assign({stringConfirm:s,stringLineBreak:()=>{const e=v(d,"\n");a(e)}},c))},styles:n})},_=t=>{var{isEditing:n,path:r,enumType:a}=t,i=o(t,["isEditing","path","enumType"]);const{getStyles:s}=k(),l=p(r),{value:c,setValue:d,nodeData:u,handleEdit:m,handleKeyboard:g,keyboardCommon:h}=i;return n&&a?e.jsxs("div",{className:"jer-select jer-select-enums",children:[e.jsx("select",{name:`${l}-value-select`,className:"jer-select-inner",onChange:e=>d(e.target.value),value:c,autoFocus:!0,onKeyDown:e=>{g(e,Object.assign({stringConfirm:m},h))},children:a.values.map((t=>e.jsx("option",{value:t,children:t},t)))}),e.jsx("span",{className:"focus"})]}):n?e.jsx(M,Object.assign({styles:s("input",u),pathString:l},i,{setValue:i.setValue})):e.jsx(V,Object.assign({pathString:l,styles:s("string",u)},i))},F=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:d}=k();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=>setTimeout((()=>e.target.select()),10),onKeyDown:e=>l(e,Object.assign({numberConfirm:i,numberUp:()=>n(Number(t)+1),numberDown:()=>n(Number(t)-1)},c)),style:Object.assign({width:String(t).length/1.5+2+"em"},d("input",s))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",s),children:t})},L=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:d}=k();return"boolean"!=typeof t?null:r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:p(o),checked:t,onChange:()=>n(!t),onKeyDown:e=>{" "===e.key&&e.preventDefault(),l(e,Object.assign({booleanConfirm:i,booleanToggle:()=>n(!t)},c))},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",s),children:String(t)})},z=(e,n)=>{const r=t.useRef(void 0),o=t.useRef(n);t.useEffect((()=>{o.current=n}),[n]);const a=e=>{o.current(e)};t.useEffect((()=>{if(window.clearTimeout(r.current),e)return r.current=window.setTimeout((()=>{window.addEventListener("keydown",a)}),100),()=>{window.clearTimeout(r.current),window.removeEventListener("keydown",a)}}),[e])},B=({value:t,isEditing:n,setIsEditing:r,handleEdit:o,nodeData:a,handleKeyboard:i,keyboardCommon:s})=>{const{getStyles:l}=k();return z(n,(e=>i(e,Object.assign({confirm:o},s)))),e.jsx("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:l("null",a),children:String(t)})},W=({value:t})=>{let n="Error!";switch(typeof t){case"string":t===I&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:n})},G=({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"})]}),Y=({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"})]}),H=({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"})}),U=({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"})]}),$=({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"})]}),Z=({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"})}),J=({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"})}),X=({name:t,nodeData:n})=>{var r,o,a,i,s,l,c;const{getStyles:d,icons:u}=k(),p={size:"1.4em",className:"jer-icon"};switch(t){case"add":return null!==(r=null==u?void 0:u.add)&&void 0!==r?r:e.jsx(G,Object.assign({},p,{style:d("iconAdd",n)}));case"edit":return null!==(o=null==u?void 0:u.edit)&&void 0!==o?o:e.jsx(Y,Object.assign({},p,{style:d("iconEdit",n)}));case"delete":return null!==(a=null==u?void 0:u.delete)&&void 0!==a?a:e.jsx(H,Object.assign({},p,{style:d("iconDelete",n),size:"1.45em"}));case"copy":return null!==(i=null==u?void 0:u.copy)&&void 0!==i?i:e.jsx(U,Object.assign({},p,{style:d("iconCopy",n),size:"1.2em"}));case"ok":return null!==(s=null==u?void 0:u.ok)&&void 0!==s?s:e.jsx($,Object.assign({},p,{style:Object.assign({fontSize:"90%"},d("iconOk",n))}));case"cancel":return null!==(l=null==u?void 0:u.cancel)&&void 0!==l?l:e.jsx(Z,Object.assign({},p,{style:Object.assign({fontSize:"130%"},d("iconCancel",n))}));case"chevron":return null!==(c=null==u?void 0:u.chevron)&&void 0!==c?c:e.jsx(J,{size:"1em",style:d("iconCollection",n)});default:return e.jsx(e.Fragment,{})}},q=({startEdit:n,handleDelete:o,handleAdd:a,enableClipboard:i,type:s,customButtons:l,nodeData:c,translate:d,keyboardControls:u,handleKeyboard:p,editConfirmRef:g,getNewKeyOptions:h,jsonStringify:y,onEditEvent:f,showIconTooltips:b})=>{const{getStyles:j}=k(),v=d("KEY_NEW",c),[x,E]=t.useState(v),[C,D]=t.useState(!1),{key:w,path:O,value:S}=c,N=Array.isArray(C),T=e=>{var t;if(f&&f(e?[...O,null]:null,e),!e)return void D(!1);const n=Object.keys(r(c.fullData,O)),o=h?null===(t=h(c))||void 0===t?void 0:t.filter((e=>!n.includes(e))):null;o&&E(""),D(null==o||o)};return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:C?1:void 0},onClick:e=>e.stopPropagation(),children:[i&&e.jsx("div",{onClick:e=>{var t;e.stopPropagation();let n,r,o="value",a="",s=null;if(i){const l=m(e);if(l&&u.clipboardModifier.includes(l)?(n=ee(O),a=n,o="path"):(n=S,a="object"==typeof n?y(S):String(n)),!navigator.clipboard)return void("function"==typeof i&&i({success:!1,value:n,stringValue:a,path:O,key:w,type:o,errorMessage:"Can't access clipboard API"}));null===(t=navigator.clipboard)||void 0===t||t.writeText(a).then((()=>r=!0)).catch((e=>{r=!1,s=e.message})).finally((()=>{"function"==typeof i&&i({success:r,errorMessage:s,value:n,stringValue:a,path:O,key:w,type:o})}))}},className:"jer-copy-pulse",title:b?d("TOOLTIP_COPY",c):"",children:e.jsx(X,{name:"copy",nodeData:c})}),n&&e.jsx("div",{onClick:n,title:b?d("TOOLTIP_EDIT",c):"",children:e.jsx(X,{name:"edit",nodeData:c})}),o&&e.jsx("div",{onClick:o,title:b?d("TOOLTIP_DELETE",c):"",children:e.jsx(X,{name:"delete",nodeData:c})}),a&&e.jsx("div",{onClick:()=>{"object"===s?T(!0):a("")},title:b?d("TOOLTIP_ADD",c):"",children:e.jsx(X,{name:"add",nodeData:c})}),null==l?void 0:l.map((({Element:t,onClick:n},r)=>e.jsx("div",{onClick:e=>n&&n(c,e),children:e.jsx(t,{nodeData:c})},r))),C&&a&&"object"===s&&e.jsxs(e.Fragment,{children:[N?e.jsxs("div",{className:"jer-select jer-select-keys",children:[e.jsxs("select",{name:"new-key-select",className:"jer-select-inner",onChange:e=>{a(e.target.value),T(!1)},defaultValue:"",autoFocus:!0,onKeyDown:e=>{p(e,{cancel:()=>T(!1)})},children:[e.jsx("option",{value:"",disabled:!0,children:C.length>0?d("KEY_SELECT",c):d("NO_KEY_OPTIONS",c)}),C.map((t=>e.jsx("option",{value:t,children:t},t)))]}),e.jsx("span",{className:"focus"})]}):e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:x,onChange:e=>E(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{p(e,{stringConfirm:()=>{a&&(T(!1),a(x),E(v))},cancel:()=>{T(!1),E(v)}})},style:j("input",c)}),e.jsx(Q,{onOk:()=>{N&&!x||(T(!1),a(x))},onCancel:()=>{T(!1)},nodeData:c,editConfirmRef:g,hideOk:N})]})]})},Q=({onOk:t,onCancel:n,nodeData:r,editConfirmRef:o,hideOk:a=!1})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[!a&&e.jsx("div",{onClick:t,ref:o,children:e.jsx(X,{name:"ok",nodeData:r})}),e.jsx("div",{onClick:n,children:e.jsx(X,{name:"cancel",nodeData:r})})]}),ee=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),te=["string","number","boolean","null","object","array"],ne=({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:f}=P(),[b,j]=t.useState(null),v=Object.assign(Object.assign({},o),{collapsed:n}),{path:x,key:E,size:C}=v,D=p(x),w=!c(v),k=!d(v),O=!u(v),S=!m(v)&&k&&null===y,N=e=>{l&&(j(e),setTimeout((()=>j(null)),h)),console.warn("Error",e)},T=t.useCallback(((e,t)=>{N(e.message),s&&s({currentData:v.fullData,errorValue:t,currentValue:r,name:E,path:x,error:e})}),[s,l]),A=y===D,R=y===`key_${D}`,K="number"==typeof x.slice(-1)[0],I={isEditing:A,isEditingKey:R,isArray:K,canEditKey:null!==a&&w&&O&&k&&!K},V=""===E&&x.length>0?g("EMPTY_STRING",v):null;return{pathString:D,nodeData:v,path:x,name:E,size:C,canEdit:w,canDelete:k,canAdd:O,canDrag:S,error:b,showError:N,onError:T,setError:j,handleEditKey:e=>{if(f(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:I,emptyStringKey:V}},re=({canDrag:n,canDragOnto:r,path:o,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=k(),{dragSource:d,setDragSource:u}=P(),[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,h]),f=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,h]),b=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}},f("below"))):null),[d,r,o.length]),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:f,BottomDropTarget:b,DropTargetPadding:({position:t,nodeData:n})=>m===t?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",n)}):null,handleDrop:j}},oe=(e,t,n,r)=>{var o,a,i;if(!t.current)return 0;const s=parseInt(null!==(o=getComputedStyle(n.current).getPropertyValue("line-height"))&&void 0!==o?o:"16px"),l=(null!==(i=null===(a=t.current)||void 0===a?void 0:a.offsetWidth)&&void 0!==i?i:0)/(.5*s),c=r(e).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/l))).reduce(((e,t)=>e+t),0)*s;return Math.min(c+30,window.innerHeight-50)},ae=({isEditingKey:t,canEditKey:n,pathString:r,path:o,name:a,arrayIndexFromOne:i,handleKeyboard:s,handleEditKey:l,handleCancel:c,handleClick:d,keyValueArray:u,styles:p,getNextOrPrevious:m,emptyStringKey:g})=>{const{setCurrentlyEditingElement:h}=P(),y="number"==typeof a?String(a+(i?1:0)):a;return t?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:r,defaultValue:y,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>s(e,{stringConfirm:()=>l(e.target.value),cancel:c,tabForward:()=>{if(l(e.target.value),u){const e=null==u?void 0:u[0][0];h(e?[...o,e]:m("next"))}else h(o)},tabBack:()=>{l(e.target.value),h(m("prev"))}}),style:{width:y.length/1.5+.5+"em"}}):e.jsxs("span",{className:"jer-key-text",style:Object.assign(Object.assign({},p),{minWidth:`${Math.min(y.length+1,5)}ch`,flexShrink:y.length>10?1:0}),onDoubleClick:()=>n&&h(o,"key"),onClick:d,children:[g?e.jsx("span",{className:"jer-empty-string",children:g}):y,""!==y||g?e.jsx("span",{className:"jer-key-colon",children:":"}):null]})},ie=n=>{const{data:r,parentData:o,onEdit:a,onDelete:i,onChange:s,onMove:c,enableClipboard:d,canDragOnto:u,restrictTypeSelection:p,searchFilter:m,searchText:g,showLabel:h,stringTruncate:y,showStringQuotes:b,arrayIndexFromOne:j,indent:v,translate:x,customNodeDefinitions:E,customNodeData:C,handleKeyboard:D,keyboardControls:w,sort:O,editConfirmRef:S,jsonStringify:N,showIconTooltips:T}=n,{getStyles:A}=k(),{setCurrentlyEditingElement:R,setCollapseState:K,previouslyEditedElement:V,setPreviouslyEditedElement:M,tabDirection:_,setTabDirection:F,previousValue:L,setPreviousValue:z}=P(),[B,W]=t.useState("function"==typeof r?I:r),{pathString:G,nodeData:Y,path:H,name:U,canEdit:$,canDelete:Z,canDrag:J,error:X,onError:ee,handleEditKey:oe,emptyStringKey:ie,derivedValues:de}=ne({props:n}),{dragSourceProps:ue,getDropTargetProps:pe,BottomDropTarget:me,DropTargetPadding:ge}=re({canDrag:J,canDragOnto:u,path:H,nodeData:Y,onMove:c,onError:ee,translate:x}),[he,ye]=t.useState(se(r,C)),fe=t.useCallback((e=>{if(!s)return void W(e);const t=s({currentData:Y.fullData,newValue:e,currentValue:B,name:U,path:H});W(t)}),[s]);t.useEffect((()=>{W("function"==typeof r?I:r),ye(se(r,C))}),[r,X]);const{CustomNode:be,customNodeProps:je,hideKey:ve,showEditTools:xe=!0,showOnEdit:Ee,showOnView:Ce,passOriginalNode:De}=C,we=[...te,...E.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],ke=t.useMemo((()=>{if("boolean"==typeof p)return p?[]:we;if(Array.isArray(p))return p;const e=p(Y);return"boolean"==typeof e?e?[]:we:e}),[Y,p]),[Oe,Se]=t.useState(((e,t)=>{var n;if("string"!=typeof e)return null;const r=t.filter((t=>t instanceof Object&&t.enum&&t.values.includes(e)&&t.matchPriority));return r.sort(((e,t)=>{var n,r;return(null!==(n=t.matchPriority)&&void 0!==n?n:0)-(null!==(r=e.matchPriority)&&void 0!==r?r:0)})),null!==(n=r[0])&&void 0!==n?n:null})(B,ke)),{isEditing:Ne}=de,Te=l("value",Y,m,g);if(Ne&&(!Te||!$)){const e=f(Y.fullData,H,_,O);R(e||V)}if(!Te)return null;const Ae=e=>{let t;if(R(null),z(null),void 0===e||(e=>e&&"object"==typeof e&&"type"in e&&"target"in e&&"preventDefault"in e&&"function"==typeof e.preventDefault)(e))switch(he){case"object":t={[x("DEFAULT_NEW_KEY",Y)]:B};break;case"array":t=null!=B?B:[];break;case"number":{const e=Number(B);t=isNaN(e)?0:e;break}default:t=B}else t=e;a(t,H).then((e=>{e&&ee({code:"UPDATE_ERROR",message:e},t)}))},Re=()=>{R(null),null===L?(W(r),z(null)):a(L,H)},{isEditingKey:Pe,canEditKey:Ke}=de,Ie=!Ne&&X,Ve=Ne&&ke.length>1,Me=("invalid"!==he||be)&&!X&&xe,_e=h&&!ve,Fe=be&&(Ne&&Ee||!Ne&&Ce),Le={value:B,parentData:o,setValue:fe,isEditing:Ne,canEdit:$,setIsEditing:$?()=>R(H):()=>{},handleEdit:Ae,handleCancel:Re,path:H,stringTruncate:y,showStringQuotes:b,nodeData:Y,enumType:Oe,translate:x,handleKeyboard:D,keyboardCommon:{cancel:Re,tabForward:()=>{F("next"),M(G);const e=f(Y.fullData,H,"next",O);e&&(Ae(),R(e))},tabBack:()=>{F("prev"),M(G);const e=f(Y.fullData,H,"prev",O);e&&(Ae(),R(e))}}},ze={canEditKey:Ke,isEditingKey:Pe,pathString:G,path:H,name:U,arrayIndexFromOne:j,handleKeyboard:D,handleEditKey:oe,handleCancel:Re,styles:A("property",Y),getNextOrPrevious:e=>f(Y.fullData,H,e,O),emptyStringKey:ie},Be=Fe?e.jsx(be,Object.assign({},n,{value:B,customNodeProps:je,setValue:fe,handleEdit:Ae,handleCancel:Re,handleKeyPress:e=>D(e,{stringConfirm:Ae,cancel:Re}),isEditing:Ne,setIsEditing:()=>R(H),getStyles:A,originalNode:De?le(r,Le):void 0,originalNodeKey:De?e.jsx(ae,Object.assign({},ze)):void 0,canEdit:$,keyboardCommon:Le.keyboardCommon,onError:ee})):le(r,Le);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:null!==o?v/2+"em":0,position:"relative"},draggable:J},ue,pe("above"),{children:[me,e.jsx(ge,{position:"above",nodeData:Y}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:U.length>10?"wrap":"nowrap"},children:[_e&&e.jsx(ae,Object.assign({},ze)),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:Be}),Ne?e.jsx(Q,{onOk:Ae,onCancel:Re,nodeData:Y,editConfirmRef:S}):Me&&e.jsx(q,{startEdit:$?()=>{z(L),R(H,Re)}:void 0,handleDelete:Z?()=>{i(B,H).then((e=>{e&&ee({code:"DELETE_ERROR",message:e},B)}))}:void 0,enableClipboard:d,translate:x,customButtons:n.customButtons,nodeData:Y,handleKeyboard:D,keyboardControls:w,editConfirmRef:S,jsonStringify:N,showIconTooltips:T}),Ve&&e.jsxs("div",{className:"jer-select jer-select-types",children:[e.jsx("select",{name:`${U}-type-select`,className:"jer-select-inner",onChange:e=>(e=>{const t=E.find((t=>t.name===e));if(t)return a(t.defaultValue,H),ye(e),Se(null),R(null),void K({path:H,collapsed:!1,includeChildren:!1});const n=ke.find((t=>t instanceof Object&&t.enum===e));if(n)return"string"==typeof B&&n.values.includes(B)||a(n.values[0],H).then((e=>{e&&(ee({code:"UPDATE_ERROR",message:e},r),R(null))})),void Se(n);const r=ce(B,e,x("DEFAULT_NEW_KEY",Y),(null==C?void 0:C.CustomNode)?x("DEFAULT_STRING",Y):void 0);["string","number","boolean"].includes(e)||R(null),a(r,H).then((e=>{e?(ee({code:"UPDATE_ERROR",message:e},r),R(null)):Se(null)}))})(e.target.value),value:Oe?Oe.enum:he,children:ke.map((t=>t instanceof Object&&"enum"in t?e.jsx("option",{value:t.enum,children:t.enum},t.enum):e.jsx("option",{value:t,children:t},t)))}),e.jsx("span",{className:"focus"})]}),Ie&&e.jsx("span",{className:"jer-error-slug",style:A("error",Y),children:X})]})]}),e.jsx(ge,{position:"below",nodeData:Y})]}))},se=(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=(t,n)=>{const r=se(t),{value:o}=n;switch(r){case"string":return e.jsx(_,Object.assign({},n,{value:o}));case"number":return e.jsx(F,Object.assign({},n,{value:o}));case"boolean":return e.jsx(L,Object.assign({},n,{value:o}));case"null":return e.jsx(B,Object.assign({},n));default:return e.jsx(W,Object.assign({},n))}},ce=(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)}},de=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[0],{element:a,wrapperElement:i,customNodeProps:s,wrapperProps:l,hideKey:c=!1,showEditTools:d=!0,showOnEdit:u=!1,showOnView:p=!0,showCollectionWrapper:m=!0}=r,g=o(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:a,CustomWrapper:i,customNodeProps:s,wrapperProps:l,hideKey:c,showEditTools:d,showOnEdit:u,showOnView:p,showCollectionWrapper:m},g)},ue=n=>{const{getStyles:r}=k(),{collapseState:o,setCollapseState:c,getMatchingCollapseState:d,currentlyEditingElement:u,setCurrentlyEditingElement:p,areChildrenBeingEdited:g,previousValue:h,setPreviousValue:y}=P(),{mainContainerRef:b,data:j,nodeData:x,parentData:E,showCollectionCount:C,onEdit:D,onAdd:w,onDelete:O,canDragOnto:S,collapseFilter:N,collapseAnimationTime:T,onMove:A,enableClipboard:R,onEditEvent:K,showIconTooltips:I,searchFilter:V,searchText:M,indent:_,sort:F,showArrayIndices:L,arrayIndexFromOne:z,defaultValue:B,newKeyOptions:W,translate:G,customNodeDefinitions:Y,customNodeData:H,jsonParse:U,jsonStringify:$,TextEditor:Z,keyboardControls:J,handleKeyboard:ee,insertAtTop:te,onCollapse:se,editConfirmRef:le,collapseClickZones:ce}=n,[pe,me]=t.useState($(j)),ge=N(x),{contentRef:he,isAnimating:ye,maxHeight:fe,collapsed:be,animateCollapse:je,cssTransitionValue:ve}=((e,n,r,o,a)=>{const[i,s]=t.useState(r?0:void 0),[l,c]=t.useState(r),d=t.useRef(!1),u=t.useRef(null),p=t.useRef(0),m=t.useRef(0),g=n/1e3+"s",h=t.useCallback((t=>{var r,i;if(l!==t){switch(window.clearTimeout(m.current),d.current=!0,t){case!0:{const e=null!==(i=null===(r=u.current)||void 0===r?void 0:r.offsetHeight)&&void 0!==i?i:0;p.current=e,s(e),setTimeout((()=>{s(0)}),5);break}case!1:s(p.current||oe(e,u,o,a))}c(!l),m.current=window.setTimeout((()=>{d.current=!1,t||s(void 0)}),n)}}),[n,l,e,o,a]);return{contentRef:u,isAnimating:d.current,animateCollapse:h,maxHeight:i,collapsed:l,cssTransitionValue:g}})(j,T,ge,b,$),{pathString:xe,nodeData:Ee,path:Ce,name:De,size:we,canEdit:ke,canDelete:Oe,canAdd:Se,canDrag:Ne,error:Te,setError:Ae,onError:Re,handleEditKey:Pe,emptyStringKey:Ke,derivedValues:Ie}=ne({props:n,collapsed:be}),{dragSourceProps:Ve,getDropTargetProps:Me,BottomDropTarget:_e,DropTargetPadding:Fe}=re({canDrag:Ne,canDragOnto:S,path:Ce,nodeData:Ee,onMove:A,onError:Re,translate:G}),Le=t.useRef(!ge),{isEditing:ze,isEditingKey:Be,isArray:We,canEditKey:Ge}=Ie;t.useEffect((()=>{me($(j))}),[j,$]),t.useEffect((()=>{const e=N(Ee)&&!ze;Le.current=!e,je(e)}),[N]),t.useEffect((()=>{if(null!==o){const e=d(Ce);e&&(Le.current=!0,je(e.collapsed))}}),[o]);const Ye=t.useRef(null),He=t.useCallback(((e,t)=>{if("function"!=typeof B)return B;const n=B(e,t);return void 0!==n?n:null}),[B]),Ue=t.useCallback((e=>W?"function"!=typeof W?W:W(e):null),[W]),{CustomNode:$e,customNodeProps:Ze,CustomWrapper:Je,wrapperProps:Xe={},hideKey:qe,showEditTools:Qe=!0,showOnEdit:et,showOnView:tt,showCollectionWrapper:nt=!0}=H,rt=g(xe);rt&&be&&je(!1);if(!(l("collection",Ee,V,M)||0===Ee.level)&&!rt)return null;const ot=Array.isArray(j)?"array":"object",at="array"===ot?{open:"[",close:"]"}:{open:"{",close:"}"},it=e=>{if("Tab"!==e.key||e.getModifierState("Shift"))ee(e,{objectConfirm:lt,cancel:dt});else{e.preventDefault();const t=v(Ye,"\t");me(t)}},st=e=>{e.stopPropagation();const t=m(e);if(t&&J.collapseModifier.includes(t))return Le.current=!0,void c({collapsed:!be,path:Ce,includeChildren:!0});u&&u.includes(xe)||(Le.current=!0,c(null),se&&se({path:Ce,collapsed:!be,includeChildren:!1}),je(!be))},lt=()=>{try{const e=U(pe);if(p(null),y(null),Ae(null),$(e)===$(j))return;D(e,Ce).then((t=>{t&&Re({code:"UPDATE_ERROR",message:t},e)}))}catch(e){Re({code:"INVALID_JSON",message:G("ERROR_INVALID_JSON",Ee)},pe)}},ct=Ce.length>0?()=>{O(j,Ce).then((e=>{e&&Re({code:"DELETE_ERROR",message:e},j)}))}:void 0,dt=()=>{p(null),null===h?(Ae(null),me($(j)),y(null)):D(h,Ce)},ut="when-closed"===C?be:C,pt=!ze&&Qe,mt=(L||!We)&&!qe&&void 0!==De,gt=$e&&(ze&&et||!ze&&tt),ht=Object.entries(j).map((([e,t])=>["array"===ot?Number(e):e,t]));"object"===ot&&F(ht,(e=>e));const yt=Le.current?ze?e.jsxs("div",{className:"jer-collection-text-edit",children:[Z?e.jsx(Z,{value:pe,onChange:me,onKeyDown:e=>ee(e,{objectConfirm:lt,cancel:dt})}):e.jsx(i,{textAreaRef:Ye,className:"jer-collection-text-area",name:xe,value:pe,setValue:me,handleKeyPress:it,styles:r("input",Ee)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(Q,{onOk:lt,onCancel:dt,nodeData:Ee,editConfirmRef:le})})]}):ht.map((([t,o],a)=>{const i={key:t,value:o,path:[...Ce,t],level:Ce.length+1,index:a,size:s(o)?Object.keys(o).length:null,parentData:j,fullData:Ee.fullData},l=de(Y,i);return e.jsx("div",{className:"jer-collection-element",style:r("collectionElement",i),children:s(o)&&!(null==l?void 0:l.renderCollectionAsValue)?e.jsx(ue,Object.assign({},n,{data:o,parentData:j,nodeData:i,showCollectionCount:C,canDragOnto:ke,customNodeData:l}),t):e.jsx(ie,Object.assign({},n,{data:o,parentData:j,nodeData:i,canDragOnto:ke,showLabel:"object"===ot||L,customNodeData:l}),t)},t)})):null,ft=!!nt&&(be&&!rt);ft||(Le.current=!0);const bt=Object.assign(Object.assign({},n),{data:j,value:j,parentData:E,nodeData:Ee,setValue:e=>a(void 0,void 0,void 0,(function*(){return yield D(e,Ce)})),handleEdit:lt,handleCancel:dt,handleKeyPress:it,isEditing:ze,setIsEditing:()=>p(Ce),getStyles:r,canDragOnto:ke,canEdit:ke,keyboardCommon:{},onError:Re}),jt=gt?e.jsx($e,Object.assign({customNodeProps:Ze},bt,{children:yt})):yt,vt=pt&&e.jsx(q,{startEdit:ke?()=>{Le.current=!0,y(null),p(Ce)}:void 0,handleAdd:Se?e=>{je(!1);const t=He(Ee,e);if("array"===ot){const e=te.array?0:j.length,n=te.array?{insert:!0}:{};w(t,[...Ce,e],n).then((e=>{e&&Re({code:"ADD_ERROR",message:e},t)}))}else if(e in j)Re({code:"KEY_EXISTS",message:G("ERROR_KEY_EXISTS",Ee)},e);else{const n=te.object?{insertBefore:0}:{};w(t,[...Ce,e],n).then((e=>{e&&Re({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:Oe?ct:void 0,enableClipboard:R,type:ot,nodeData:Ee,translate:G,customButtons:n.customButtons,keyboardControls:J,handleKeyboard:ee,getNewKeyOptions:Ue,editConfirmRef:le,jsonStringify:$,onEditEvent:K,showIconTooltips:I}),xt={canEditKey:Ge,isEditingKey:Be,pathString:xe,path:Ce,name:De,arrayIndexFromOne:z,handleKeyboard:ee,handleEditKey:Pe,handleCancel:dt,keyValueArray:ht,styles:r("property",Ee),getNextOrPrevious:e=>f(Ee.fullData,Ce,e,F),handleClick:ce.includes("property")?st:e=>e.stopPropagation(),emptyStringKey:Ke},Et=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===Ce.length?0:_/2)+"em"},r("collection",Ee)),{position:"relative"}),draggable:Ne},Ve,Me("above"),{children:[e.jsx("div",{className:"jer-clickzone",style:{width:_/2+1+"em",zIndex:10+2*Ee.level},onClick:ce.includes("left")?st:void 0}),!ze&&_e,e.jsx(Fe,{position:"above",nodeData:Ee}),nt?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:ce.includes("header")?st:void 0,children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon jer-accordion-icon"+(be?" jer-rotate-90":""),style:{zIndex:11+2*Ee.level,transition:ve},onClick:st,children:e.jsx(X,{name:"chevron",rotate:be,nodeData:Ee})}),mt&&e.jsx(ae,Object.assign({},xt)),!ze&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:r("bracket",Ee),children:at.open})]}),!ze&&ut&&e.jsx("div",{className:"jer-collection-item-count"+(ut?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},r("itemCount",Ee)),{transition:ve}),children:1===we?G("ITEM_SINGLE",Object.assign(Object.assign({},Ee),{size:1}),1):G("ITEMS_MULTIPLE",Ee,we)}),e.jsx("div",{className:"jer-brackets"+(ft?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},r("bracket",Ee)),{transition:ve}),children:at.close}),vt]}):qe?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e.jsx(ae,Object.assign({},xt)),vt]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign(Object.assign({overflowY:ft||ye?"clip":"visible",maxHeight:rt?void 0:fe},r("collectionInner",Ee)),{transition:ve}),ref:he,children:[jt,e.jsx("div",{className:ze?"jer-collection-error-row":"jer-collection-error-row-edit",children:Te&&e.jsx("span",{className:"jer-error-slug",style:r("error",Ee),children:Te})}),!ze&&nt&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},r("bracket",Ee)),{marginLeft:(_<3?-1:_<6?-.5:0)+"em"}),children:at.close})]}),e.jsx(Fe,{position:"below",nodeData:Ee})]}));return Je?e.jsx(Je,Object.assign({customNodeProps:Xe},bt,{children:Et})):Et},pe={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",KEY_SELECT:"Select key",NO_KEY_OPTIONS:"No key options",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",SHOW_LESS:"(Show less)",EMPTY_STRING:"<empty string>",TOOLTIP_COPY:"Copy to clipboard",TOOLTIP_EDIT:"Edit",TOOLTIP_DELETE:"Delete",TOOLTIP_ADD:"Add"},me=(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]:pe[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,t,r,n,o);var ge=[],he=[];!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=ge.indexOf(a);-1===i&&(i=ge.push(a)-1,he[i]={}),n=he[i]&&he[i][r]?he[i][r]:he[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-highlight-color:#b3d8ff}.jer-visible{opacity:1}.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-select-inner{text-overflow:ellipsis;width:100%}.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}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em;line-height:1.1em}.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;width:100%}.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;word-break:break-word}.jer-string-expansion{cursor:pointer;filter:saturate(50%);opacity:.6}.jer-show-less{font-size:80%}.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:.3s}.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-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-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 ye=({data:n,setData:r,rootName:o="root",onUpdate:i=()=>{},onEdit:l=i,onDelete:c=i,onAdd:d=i,onChange:u,onError:m,onEditEvent:h,showErrorMessages:f=!0,enableClipboard:b=!0,indent:j=2,collapse:v=!1,collapseAnimationTime:E=300,showCollectionCount:C=!0,restrictEdit:D=!1,restrictDelete:w=!1,restrictAdd:O=!1,restrictTypeSelection:S=!1,restrictDrag:N=!0,viewOnly:T,searchFilter:A,searchText:R,searchDebounceTime:K=350,keySort:I=!1,showArrayIndices:V=!0,arrayIndexFromOne:M=!1,showStringQuotes:_=!0,showIconTooltips:F=!1,defaultValue:L=null,newKeyOptions:z,minWidth:B=250,maxWidth:W="min(600px, 90vw)",rootFontSize:G,stringTruncate:Y=250,translations:H={},className:U,id:$,customText:Z={},customNodeDefinitions:J=[],customButtons:X=[],jsonParse:q=JSON.parse,jsonStringify:Q=(e,t)=>JSON.stringify(e,t,2),TextEditor:ee,errorMessageTimeout:te=2500,keyboardControls:ne={},externalTriggers:re,insertAtTop:oe=!1,onCollapse:ae,collapseClickZones:se=["header","left"]})=>{const{getStyles:le}=k(),{setCurrentlyEditingElement:ce}=P(),pe=t.useMemo((()=>be(v)),[v]),ge=t.useMemo((()=>me(H,Z)),[H,Z]),[he,ye]=t.useState(R),[Ee,Ce]=(({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}),De=t.useRef(null);t.useEffect((()=>{ce(null);const e=setTimeout((()=>ye(R)),K);return()=>clearTimeout(e)}),[R,K]);const we={key:o,path:[],level:0,index:0,value:Ee,size:"object"==typeof Ee&&null!==Ee?Object.keys(Ee).length:1,parentData:null,fullData:Ee},ke=(e,t)=>a(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void Ce(t.newData);const r=ve(n)?n:["error",n],[o,a]=r;if("error"===o)return Ce(t.currentData),!1===a?ge("ERROR_UPDATE",we):String(a);Ce(a)})),Oe=t.useMemo((()=>be(D,T)),[D,T]),Se=t.useMemo((()=>be(w,T)),[w,T]),Ne=t.useMemo((()=>be(O,T)),[O,T]),Te=t.useMemo((()=>be(N,T)),[N,T]),Ae=t.useMemo((()=>je(A)),[A]),Re=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})(ne)),[ne]),Pe=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}})(Re,t,e)),[Re]),Ke=t.useMemo((()=>{const e=xe(J,"stringifyReplacer");return t=>Q(t,e)}),[J,Q]),Ie=t.useMemo((()=>{const e=xe(J,"parseReviver");return t=>{const n=q(t,e);return x(n)}}),[J,q]),Ve=t.useRef(null);((e,n)=>{const{setCurrentlyEditingElement:r,currentlyEditingElement:o,setCollapseState:a}=P();t.useEffect((()=>{if(!e)return;const{collapse:t,edit:i}=e;t&&a(t);const s=!(null==i?void 0:i.path)||p(i.path)===o;switch(null==i?void 0:i.action){case"accept":s&&(n.current&&n.current.click(),r(null));break;case"cancel":s&&r(null);break;default:(null==i?void 0:i.path)&&r(i.path)}}),[e])})(re,Ve);const Me=t.useCallback(((e,t)=>{!1!==I&&("function"!=typeof I?e.sort(((e,n)=>{const r=t(e)[0],o=t(n)[0];return r<o?-1:r>o?1:0})):e.sort(((e,n)=>I(t(e),t(n)))))}),[I]),_e=de(J,we),Fe={mainContainerRef:De,name:o,nodeData:we,onEdit:(e,t)=>a(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=fe(Ee,t,e,"update");if(o!==a)return yield ke(l,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>a(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=fe(Ee,t,e,"delete");return yield ke(c,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>a(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:a,newValue:i}=fe(Ee,t,e,"add",n);return yield ke(d,{currentData:r,newData:o,currentValue:a,newValue:i,name:t.slice(-1)[0],path:t})})),onChange:u,onError:m,onEditEvent:h,showErrorMessages:f,onMove:(e,t,n)=>a(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=fe(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}=fe(o,[...s,d],a,"add",u);return yield ke(l,{currentData:r,newData:p,currentValue:a,newValue:m,name:t.slice(-1)[0],path:t})})),showCollectionCount:C,collapseFilter:pe,collapseAnimationTime:E,restrictEditFilter:Oe,restrictDeleteFilter:Se,restrictAddFilter:Ne,restrictTypeSelection:S,restrictDragFilter:Te,canDragOnto:!1,searchFilter:Ae,searchText:he,enableClipboard:b,keySort:I,sort:Me,showArrayIndices:V,arrayIndexFromOne:M,showStringQuotes:_,showIconTooltips:F,indent:j,defaultValue:L,newKeyOptions:z,stringTruncate:Y,translate:ge,customNodeDefinitions:J,customNodeData:_e,customButtons:X,parentData:null,jsonParse:Ie,jsonStringify:Ke,TextEditor:ee,errorMessageTimeout:te,handleKeyboard:Pe,keyboardControls:Re,insertAtTop:{object:!0===oe||"object"===oe,array:!0===oe||"array"===oe},onCollapse:ae,editConfirmRef:Ve,collapseClickZones:se},Le=Object.assign(Object.assign({},le("container",we)),{minWidth:B,maxWidth:W});return Le.fontSize=null!=G?G:Le.fontSize,e.jsx("div",{id:$,ref:De,className:`jer-editor-container ${null!=U?U:""}`,style:Le,children:s(Ee)&&!_e.renderCollectionAsValue?e.jsx(ue,Object.assign({data:Ee},Fe)):e.jsx(ie,Object.assign({data:Ee,showLabel:!0},Fe))})},fe=(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}},be=(e,t)=>t?()=>!0:"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,je=e=>{if(void 0!==e)return"value"===e?d:"key"===e?u:"all"===e?(e,t)=>d(e,t)||u(e,t):e},ve=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),xe=(e,t)=>{const n="stringifyReplacer"===t?[e=>void 0===e?E:e]:[];if(n.push(...e.map((e=>e[t])).filter((e=>!!e))),0!==n.length)return(e,t)=>{let r=t;for(const e of n)r=e(r);return r}},Ee=t=>{var n;const{value:r,setIsEditing:o,getStyles:a,nodeData:i}=t,s=a("string",i);return e.jsx("div",{onDoubleClick:()=>o(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&o(!0)},className:"jer-value-string jer-hyperlink",style:s,children:e.jsx("a",{href:r,target:"_blank",rel:"noreferrer",style:{color:null!==(n=s.color)&&void 0!==n?n:void 0},children:e.jsx(V,Object.assign({},t,{pathString:p(i.path),styles:s,value:i.value}))})})},Ce={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:Ee,showOnView:!0,showOnEdit:!1};exports.assign=n,exports.extract=r,exports.IconAdd=G,exports.IconCancel=Z,exports.IconChevron=J,exports.IconCopy=U,exports.IconDelete=H,exports.IconEdit=Y,exports.IconOk=$,exports.JsonEditor=n=>{var r;const[o,a]=t.useState();return t.useEffect((()=>{const e=document.documentElement;a(e)}),[]),o?e.jsx(w,{theme:null!==(r=n.theme)&&void 0!==r?r:C,icons:n.icons,docRoot:o,children:e.jsx(R,{onEditEvent:n.onEditEvent,onCollapse:n.onCollapse,children:e.jsx(ye,Object.assign({},n))})}):null},exports.LinkCustomComponent=Ee,exports.LinkCustomNodeDefinition=Ce,exports.StringDisplay=V,exports.StringEdit=M,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=C,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=s,exports.matchNode=d,exports.matchNodeKey=u,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.standardDataTypes=te,exports.toPathString=p,exports.useKeyboardListener=z;
|
|
1
|
+
"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){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}function a(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 i=({className:t,name:n,value:r,setValue:o,handleKeyPress:a,styles:i,textAreaRef:s})=>{if("string"!=typeof r)return null;const l="\n"===r.slice(-1)?r+".":r;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${n}_textarea`,ref:s,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:l})]})},s=e=>null!==e&&"object"==typeof e,l=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!c(r,t,n))return!1}if(!n&&r&&!c(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!d(t,r))return!1}return!0},c=(e="",t,n=d)=>{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 s(a)?c(e,l,n):n(l,e)}))},d=(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}},u=({key:e,path:t},n="")=>!!d({value:e},n)||!!t.some((e=>d({value:e},n))),p=(e,t)=>(null!=t?t:"")+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"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:h,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},f=(e,t,n="next",o)=>{const a=t.slice(0,t.length-1),i=t.slice(-1)[0];if(void 0===i)return null;const l=r(e,a),c=j(l);Array.isArray(l)||o(c,(({key:e,value:t})=>[e,t]));const d=c.findIndex((e=>e.key===i)),u=c[d+("next"===n?1:-1)];return u?s(u.value)?0===Object.keys(u.value).length?f(e,[...a,u.key],n,o):b(e,[...a,u.key],n,o):[...a,u.key]:0===a.length?null:f(e,a,n,o)},b=(e,t,n="next",o)=>{const a=r(e,t);if(!s(a))return t;const i=Array.isArray(a)?a.map(((e,t)=>t)):Object.keys(a);o(i,(e=>[e,a]));const l="next"===n?i[0]:i[i.length-1];return b(e,[...t,l],n,o)},j=e=>Array.isArray(e)?e.map(((e,t)=>({index:t,value:e,key:t}))):Object.entries(e).map((([e,t],n)=>({key:e,value:t,index:n}))),v=(e,t)=>{var n,r,o,a;const i=e.current,s=null!==(n=null==i?void 0:i.selectionStart)&&void 0!==n?n:1/0,l=null!==(r=null==i?void 0:i.selectionEnd)&&void 0!==r?r:1/0,c=(null===(o=null==i?void 0:i.textContent)||void 0===o?void 0:o.slice(0,s))+t+(null===(a=null==i?void 0:i.textContent)||void 0===a?void 0:a.slice(l));return i.value=c,null==i||i.setSelectionRange(s+1,s+1),c},x=e=>{if(e!==E){if(Array.isArray(e))return e.map((e=>x(e)));if(e&&"object"==typeof e)for(const t in e)e[t]=x(e[t]);return e}},E="__undefined__",C={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)"}},D=t.createContext({getStyles:()=>({}),icons:{}}),w=({theme:t=C,icons:n={},docRoot:r,children:o})=>{const a=O(t,r);return e.jsx(D.Provider,{value:{getStyles:(e,t)=>"function"==typeof a[e]?a[e](t):a[e],icons:n},children:o})},k=()=>t.useContext(D),O=(e,t)=>{var n,r,o,a;const i={},s=(Array.isArray(e)?e:[e]).map((e=>N(e)?S({fragments:{},styles:e},i):S(e,i))),l=S(C,{});Object.keys(l).forEach((e=>{const t=e;s.forEach((e=>{e[t]&&(l[t]=Object.assign(Object.assign({},l[t]),e[t]))}))}));const c=Object.assign({},l);return Object.entries(i).forEach((([e,t])=>{const n=e;c[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},l[n]),r)}})),"function"!=typeof(null==c?void 0:c.inputHighlight)&&(null===(n=null==c?void 0:c.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",null===(r=null==c?void 0:c.inputHighlight)||void 0===r?void 0:r.backgroundColor),"function"!=typeof(null==c?void 0:c.iconCopy)&&(null===(o=null==c?void 0:c.iconCopy)||void 0===o?void 0:o.color)&&t.style.setProperty("--jer-icon-copy-color",null===(a=null==c?void 0:c.iconCopy)||void 0===a?void 0:a.color),c},S=(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=T[e])&&void 0!==i?i:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=a})),o},N=e=>!("styles"in e),T={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},A=t.createContext(null),R=({children:n,onEditEvent:r,onCollapse:o})=>{const[a,i]=t.useState(null),[s,l]=t.useState(null),[c,d]=t.useState(null),[u,m]=t.useState({path:null,pathString:null}),g=t.useRef(null),h=t.useRef("next"),y=t.useRef(null);return e.jsx(A.Provider,{value:{collapseState:a,setCollapseState:e=>{i(e),o&&null!==e&&(Array.isArray(e)?e.forEach((e=>o(e))):o(e)),null!==e&&setTimeout((()=>i(null)),2e3)},getMatchingCollapseState:e=>{if(Array.isArray(a)){for(const t of a)if(K(e,t))return t;return null}return K(e,a)?a:null},currentlyEditingElement:s,setCurrentlyEditingElement:(e,t)=>{const n="string"==typeof e||null===e?e:p(e,"key"===t?"key_":void 0);null!==s&&null!==n&&null!==g.current&&g.current(),l(n),r&&(Array.isArray(e)||null===e)&&r(e,"key"===t),g.current="function"==typeof t?t:null},areChildrenBeingEdited:e=>null!==s&&s.includes(e),previouslyEditedElement:y.current,setPreviouslyEditedElement:e=>{y.current=e},tabDirection:h.current,setTabDirection:e=>{h.current=e},previousValue:c,setPreviousValue:d,dragSource:u,setDragSource:m},children:n})},P=()=>{const e=t.useContext(A);if(!e)throw new Error("Missing Context Provider");return e},K=(e,t)=>{if(null===t)return!1;if(!t.includeChildren)return t.path.every(((t,n)=>e[n]===t))&&t.path.length===e.length;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},I="**INVALID_FUNCTION**",V=({nodeData:n,showStringQuotes:r=!0,stringTruncate:o=200,pathString:a,canEdit:i,setIsEditing:s,styles:l,translate:c,value:d,TextWrapper:u=({children:e})=>e})=>{const p=null!=d?d:n.value,[m,g]=t.useState(!1),h=r?'"':"",y=p.length>o,f=()=>{i?s(!0):g(!m)};return e.jsxs("div",{id:`${a}_display`,onDoubleClick:f,onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&f()},className:"jer-value-string",style:l,children:[h,y?m?e.jsxs(e.Fragment,{children:[e.jsx(u,{children:e.jsxs("span",{children:[p,h]})}),e.jsxs("span",{className:"jer-string-expansion jer-show-less",onClick:()=>g(!1),children:[" ",c("SHOW_LESS",n)]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(u,{children:[e.jsx("span",{children:p.slice(0,o-2).trimEnd()})," "]}),e.jsx("span",{className:"jer-string-expansion jer-ellipsis",onClick:()=>g(!0),children:"..."}),h]}):e.jsx(u,{children:`${p}${h}`})]})},M=({styles:n,pathString:r,value:o,setValue:a,handleEdit:s,handleKeyboard:l,keyboardCommon:c})=>{const d=t.useRef(null);return e.jsx(i,{className:"jer-input-text",textAreaRef:d,name:r,value:o,setValue:a,handleKeyPress:e=>{l(e,Object.assign({stringConfirm:s,stringLineBreak:()=>{const e=v(d,"\n");a(e)}},c))},styles:n})},_=t=>{var{isEditing:n,path:r,enumType:a}=t,i=o(t,["isEditing","path","enumType"]);const{getStyles:s}=k(),l=p(r),{value:c,setValue:d,nodeData:u,handleEdit:m,handleKeyboard:g,keyboardCommon:h}=i;return n&&a?e.jsxs("div",{className:"jer-select jer-select-enums",children:[e.jsx("select",{name:`${l}-value-select`,className:"jer-select-inner",onChange:e=>d(e.target.value),value:c,autoFocus:!0,onKeyDown:e=>{g(e,Object.assign({stringConfirm:m},h))},children:a.values.map((t=>e.jsx("option",{value:t,children:t},t)))}),e.jsx("span",{className:"focus"})]}):n?e.jsx(M,Object.assign({styles:s("input",u),pathString:l},i,{setValue:i.setValue})):e.jsx(V,Object.assign({pathString:l,styles:s("string",u)},i))},F=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:d}=k();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=>setTimeout((()=>e.target.select()),10),onKeyDown:e=>l(e,Object.assign({numberConfirm:i,numberUp:()=>n(Number(t)+1),numberDown:()=>n(Number(t)-1)},c)),style:Object.assign({width:String(t).length/1.5+2+"em"},d("input",s))}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-number",style:d("number",s),children:t})},L=({value:t,setValue:n,isEditing:r,path:o,setIsEditing:a,handleEdit:i,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:d}=k();return"boolean"!=typeof t?null:r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:p(o),checked:t,onChange:()=>n(!t),onKeyDown:e=>{" "===e.key&&e.preventDefault(),l(e,Object.assign({booleanConfirm:i,booleanToggle:()=>n(!t)},c))},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>a(!0),className:"jer-value-boolean",style:d("boolean",s),children:String(t)})},z=(e,n)=>{const r=t.useRef(void 0),o=t.useRef(n);t.useEffect((()=>{o.current=n}),[n]);const a=e=>{o.current(e)};t.useEffect((()=>{if(window.clearTimeout(r.current),e)return r.current=window.setTimeout((()=>{window.addEventListener("keydown",a)}),100),()=>{window.clearTimeout(r.current),window.removeEventListener("keydown",a)}}),[e])},B=({value:t,isEditing:n,setIsEditing:r,handleEdit:o,nodeData:a,handleKeyboard:i,keyboardCommon:s})=>{const{getStyles:l}=k();return z(n,(e=>i(e,Object.assign({confirm:o},s)))),e.jsx("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:l("null",a),children:String(t)})},W=({value:t})=>{let n="Error!";switch(typeof t){case"string":t===I&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:n})},G=({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"})]}),Y=({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"})]}),H=({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"})}),U=({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"})]}),$=({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"})]}),Z=({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"})}),J=({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"})}),X=({name:t,nodeData:n})=>{var r,o,a,i,s,l,c;const{getStyles:d,icons:u}=k(),p={size:"1.4em",className:"jer-icon"};switch(t){case"add":return null!==(r=null==u?void 0:u.add)&&void 0!==r?r:e.jsx(G,Object.assign({},p,{style:d("iconAdd",n)}));case"edit":return null!==(o=null==u?void 0:u.edit)&&void 0!==o?o:e.jsx(Y,Object.assign({},p,{style:d("iconEdit",n)}));case"delete":return null!==(a=null==u?void 0:u.delete)&&void 0!==a?a:e.jsx(H,Object.assign({},p,{style:d("iconDelete",n),size:"1.45em"}));case"copy":return null!==(i=null==u?void 0:u.copy)&&void 0!==i?i:e.jsx(U,Object.assign({},p,{style:d("iconCopy",n),size:"1.2em"}));case"ok":return null!==(s=null==u?void 0:u.ok)&&void 0!==s?s:e.jsx($,Object.assign({},p,{style:Object.assign({fontSize:"90%"},d("iconOk",n))}));case"cancel":return null!==(l=null==u?void 0:u.cancel)&&void 0!==l?l:e.jsx(Z,Object.assign({},p,{style:Object.assign({fontSize:"130%"},d("iconCancel",n))}));case"chevron":return null!==(c=null==u?void 0:u.chevron)&&void 0!==c?c:e.jsx(J,{size:"1em",style:d("iconCollection",n)});default:return e.jsx(e.Fragment,{})}},q=({startEdit:n,handleDelete:o,handleAdd:a,enableClipboard:i,type:s,customButtons:l,nodeData:c,translate:d,keyboardControls:u,handleKeyboard:p,editConfirmRef:g,getNewKeyOptions:h,jsonStringify:y,onEditEvent:f,showIconTooltips:b})=>{const{getStyles:j}=k(),v=d("KEY_NEW",c),[x,E]=t.useState(v),[C,D]=t.useState(!1),{key:w,path:O,value:S}=c,N=Array.isArray(C),T=e=>{var t;if(f&&f(e?[...O,null]:null,e),!e)return void D(!1);const n=Object.keys(r(c.fullData,O)),o=h?null===(t=h(c))||void 0===t?void 0:t.filter((e=>!n.includes(e))):null;o&&E(""),D(null==o||o)};return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:C?1:void 0},onClick:e=>e.stopPropagation(),children:[i&&e.jsx("div",{onClick:e=>{var t;e.stopPropagation();let n,r,o="value",a="",s=null;if(i){const l=m(e);if(l&&u.clipboardModifier.includes(l)?(n=ee(O),a=n,o="path"):(n=S,a="object"==typeof n?y(S):String(n)),!navigator.clipboard)return void("function"==typeof i&&i({success:!1,value:n,stringValue:a,path:O,key:w,type:o,errorMessage:"Can't access clipboard API"}));null===(t=navigator.clipboard)||void 0===t||t.writeText(a).then((()=>r=!0)).catch((e=>{r=!1,s=e.message})).finally((()=>{"function"==typeof i&&i({success:r,errorMessage:s,value:n,stringValue:a,path:O,key:w,type:o})}))}},className:"jer-copy-pulse",title:b?d("TOOLTIP_COPY",c):"",children:e.jsx(X,{name:"copy",nodeData:c})}),n&&e.jsx("div",{onClick:n,title:b?d("TOOLTIP_EDIT",c):"",children:e.jsx(X,{name:"edit",nodeData:c})}),o&&e.jsx("div",{onClick:o,title:b?d("TOOLTIP_DELETE",c):"",children:e.jsx(X,{name:"delete",nodeData:c})}),a&&e.jsx("div",{onClick:()=>{"object"===s?T(!0):a("")},title:b?d("TOOLTIP_ADD",c):"",children:e.jsx(X,{name:"add",nodeData:c})}),null==l?void 0:l.map((({Element:t,onClick:n},r)=>e.jsx("div",{onClick:e=>n&&n(c,e),children:e.jsx(t,{nodeData:c})},r))),C&&a&&"object"===s&&e.jsxs(e.Fragment,{children:[N?e.jsxs("div",{className:"jer-select jer-select-keys",children:[e.jsxs("select",{name:"new-key-select",className:"jer-select-inner",onChange:e=>{a(e.target.value),T(!1)},defaultValue:"",autoFocus:!0,onKeyDown:e=>{p(e,{cancel:()=>T(!1)})},children:[e.jsx("option",{value:"",disabled:!0,children:C.length>0?d("KEY_SELECT",c):d("NO_KEY_OPTIONS",c)}),C.map((t=>e.jsx("option",{value:t,children:t},t)))]}),e.jsx("span",{className:"focus"})]}):e.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:x,onChange:e=>E(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{p(e,{stringConfirm:()=>{a&&(T(!1),a(x),E(v))},cancel:()=>{T(!1),E(v)}})},style:j("input",c)}),e.jsx(Q,{onOk:()=>{N&&!x||(T(!1),a(x))},onCancel:()=>{T(!1)},nodeData:c,editConfirmRef:g,hideOk:N})]})]})},Q=({onOk:t,onCancel:n,nodeData:r,editConfirmRef:o,hideOk:a=!1})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[!a&&e.jsx("div",{onClick:t,ref:o,children:e.jsx(X,{name:"ok",nodeData:r})}),e.jsx("div",{onClick:n,children:e.jsx(X,{name:"cancel",nodeData:r})})]}),ee=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),te=["string","number","boolean","null","object","array"],ne=({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:f}=P(),[b,j]=t.useState(null),v=Object.assign(Object.assign({},o),{collapsed:n}),{path:x,key:E,size:C}=v,D=p(x),w=!c(v),k=!d(v),O=!u(v),S=!m(v)&&k&&null===y,N=e=>{l&&(j(e),setTimeout((()=>j(null)),h)),console.warn("Error",e)},T=t.useCallback(((e,t)=>{N(e.message),s&&s({currentData:v.fullData,errorValue:t,currentValue:r,name:E,path:x,error:e})}),[s,l]),A=y===D,R=y===`key_${D}`,K="number"==typeof x.slice(-1)[0],I={isEditing:A,isEditingKey:R,isArray:K,canEditKey:null!==a&&w&&O&&k&&!K},V=""===E&&x.length>0?g("EMPTY_STRING",v):null;return{pathString:D,nodeData:v,path:x,name:E,size:C,canEdit:w,canDelete:k,canAdd:O,canDrag:S,error:b,showError:N,onError:T,setError:j,handleEditKey:e=>{if(f(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:I,emptyStringKey:V}},re=({canDrag:n,canDragOnto:r,path:o,nodeData:a,onMove:i,onError:s,translate:l})=>{const{getStyles:c}=k(),{dragSource:d,setDragSource:u}=P(),[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,h]),f=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,h]),b=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}},f("below"))):null),[d,r,o.length]),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:f,BottomDropTarget:b,DropTargetPadding:({position:t,nodeData:n})=>m===t?e.jsx("div",{className:"jer-drag-n-drop-padding",style:c("dropZone",n)}):null,handleDrop:j}},oe=(e,t,n,r)=>{var o,a,i;if(!t.current)return 0;const s=parseInt(null!==(o=getComputedStyle(n.current).getPropertyValue("line-height"))&&void 0!==o?o:"16px"),l=(null!==(i=null===(a=t.current)||void 0===a?void 0:a.offsetWidth)&&void 0!==i?i:0)/(.5*s),c=r(e).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/l))).reduce(((e,t)=>e+t),0)*s;return Math.min(c+30,window.innerHeight-50)},ae=({isEditingKey:t,canEditKey:n,pathString:r,path:o,name:a,arrayIndexFromOne:i,handleKeyboard:s,handleEditKey:l,handleCancel:c,handleClick:d,keyValueArray:u,styles:p,getNextOrPrevious:m,emptyStringKey:g})=>{const{setCurrentlyEditingElement:h}=P(),y="number"==typeof a?String(a+(i?1:0)):a;return t?e.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:r,defaultValue:y,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>s(e,{stringConfirm:()=>l(e.target.value),cancel:c,tabForward:()=>{if(l(e.target.value),u){const e=null==u?void 0:u[0][0];h(e?[...o,e]:m("next"))}else h(o)},tabBack:()=>{l(e.target.value),h(m("prev"))}}),style:{width:y.length/1.5+.5+"em"}}):e.jsxs("span",{className:"jer-key-text",style:Object.assign(Object.assign({},p),{minWidth:`${Math.min(y.length+1,5)}ch`,flexShrink:y.length>10?1:0}),onDoubleClick:()=>n&&h(o,"key"),onClick:d,children:[g?e.jsx("span",{className:"jer-empty-string",children:g}):y,""!==y||g?e.jsx("span",{className:"jer-key-colon",children:":"}):null]})},ie=n=>{const{data:r,parentData:o,onEdit:a,onDelete:i,onChange:s,onMove:c,enableClipboard:d,canDragOnto:u,restrictTypeSelection:p,searchFilter:m,searchText:g,showLabel:h,stringTruncate:y,showStringQuotes:b,arrayIndexFromOne:j,indent:v,translate:x,customNodeDefinitions:E,customNodeData:C,handleKeyboard:D,keyboardControls:w,sort:O,editConfirmRef:S,jsonStringify:N,showIconTooltips:T}=n,{getStyles:A}=k(),{setCurrentlyEditingElement:R,setCollapseState:K,previouslyEditedElement:V,setPreviouslyEditedElement:M,tabDirection:_,setTabDirection:F,previousValue:L,setPreviousValue:z}=P(),[B,W]=t.useState("function"==typeof r?I:r),{pathString:G,nodeData:Y,path:H,name:U,canEdit:$,canDelete:Z,canDrag:J,error:X,onError:ee,handleEditKey:oe,emptyStringKey:ie,derivedValues:de}=ne({props:n}),{dragSourceProps:ue,getDropTargetProps:pe,BottomDropTarget:me,DropTargetPadding:ge}=re({canDrag:J,canDragOnto:u,path:H,nodeData:Y,onMove:c,onError:ee,translate:x}),[he,ye]=t.useState(se(r,C)),fe=t.useCallback((e=>{if(!s)return void W(e);const t=s({currentData:Y.fullData,newValue:e,currentValue:B,name:U,path:H});W(t)}),[s]);t.useEffect((()=>{W("function"==typeof r?I:r),ye(se(r,C))}),[r,X]);const{CustomNode:be,customNodeProps:je,hideKey:ve,showEditTools:xe=!0,showOnEdit:Ee,showOnView:Ce,passOriginalNode:De}=C,we=[...te,...E.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],ke=t.useMemo((()=>{if("boolean"==typeof p)return p?[]:we;if(Array.isArray(p))return p;const e=p(Y);return"boolean"==typeof e?e?[]:we:e}),[Y,p]),[Oe,Se]=t.useState(((e,t)=>{var n;if("string"!=typeof e)return null;const r=t.filter((t=>t instanceof Object&&t.enum&&t.values.includes(e)&&t.matchPriority));return r.sort(((e,t)=>{var n,r;return(null!==(n=t.matchPriority)&&void 0!==n?n:0)-(null!==(r=e.matchPriority)&&void 0!==r?r:0)})),null!==(n=r[0])&&void 0!==n?n:null})(B,ke)),{isEditing:Ne}=de,Te=l("value",Y,m,g);if(Ne&&(!Te||!$)){const e=f(Y.fullData,H,_,O);R(e||V)}if(!Te)return null;const Ae=e=>{let t;if(R(null),z(null),void 0===e||(e=>e&&"object"==typeof e&&"type"in e&&"target"in e&&"preventDefault"in e&&"function"==typeof e.preventDefault)(e))switch(he){case"object":t={[x("DEFAULT_NEW_KEY",Y)]:B};break;case"array":t=null!=B?B:[];break;case"number":{const e=Number(B);t=isNaN(e)?0:e;break}default:t=B}else t=e;a(t,H).then((e=>{e&&ee({code:"UPDATE_ERROR",message:e},t)}))},Re=()=>{R(null),null===L?(W(r),z(null)):a(L,H)},{isEditingKey:Pe,canEditKey:Ke}=de,Ie=!Ne&&X,Ve=Ne&&ke.length>1,Me=("invalid"!==he||be)&&!X&&xe,_e=h&&!ve,Fe=be&&(Ne&&Ee||!Ne&&Ce),Le={value:B,parentData:o,setValue:fe,isEditing:Ne,canEdit:$,setIsEditing:$?()=>R(H):()=>{},handleEdit:Ae,handleCancel:Re,path:H,stringTruncate:y,showStringQuotes:b,nodeData:Y,enumType:Oe,translate:x,handleKeyboard:D,keyboardCommon:{cancel:Re,tabForward:()=>{F("next"),M(G);const e=f(Y.fullData,H,"next",O);e&&(Ae(),R(e))},tabBack:()=>{F("prev"),M(G);const e=f(Y.fullData,H,"prev",O);e&&(Ae(),R(e))}}},ze={canEditKey:Ke,isEditingKey:Pe,pathString:G,path:H,name:U,arrayIndexFromOne:j,handleKeyboard:D,handleEditKey:oe,handleCancel:Re,styles:A("property",Y),getNextOrPrevious:e=>f(Y.fullData,H,e,O),emptyStringKey:ie},Be=Fe?e.jsx(be,Object.assign({},n,{value:B,customNodeProps:je,setValue:fe,handleEdit:Ae,handleCancel:Re,handleKeyPress:e=>D(e,{stringConfirm:Ae,cancel:Re}),isEditing:Ne,setIsEditing:()=>R(H),getStyles:A,originalNode:De?le(r,Le):void 0,originalNodeKey:De?e.jsx(ae,Object.assign({},ze)):void 0,canEdit:$,keyboardCommon:Le.keyboardCommon,onError:ee})):le(r,Le);return e.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:null!==o?v/2+"em":0,position:"relative"},draggable:J},ue,pe("above"),{children:[me,e.jsx(ge,{position:"above",nodeData:Y}),e.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:U.length>10?"wrap":"nowrap"},children:[_e&&e.jsx(ae,Object.assign({},ze)),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:Be}),Ne?e.jsx(Q,{onOk:Ae,onCancel:Re,nodeData:Y,editConfirmRef:S}):Me&&e.jsx(q,{startEdit:$?()=>{z(L),R(H,Re)}:void 0,handleDelete:Z?()=>{i(B,H).then((e=>{e&&ee({code:"DELETE_ERROR",message:e},B)}))}:void 0,enableClipboard:d,translate:x,customButtons:n.customButtons,nodeData:Y,handleKeyboard:D,keyboardControls:w,editConfirmRef:S,jsonStringify:N,showIconTooltips:T}),Ve&&e.jsxs("div",{className:"jer-select jer-select-types",children:[e.jsx("select",{name:`${U}-type-select`,className:"jer-select-inner",onChange:e=>(e=>{const t=E.find((t=>t.name===e));if(t)return a(t.defaultValue,H),ye(e),Se(null),R(null),void K({path:H,collapsed:!1,includeChildren:!1});const n=ke.find((t=>t instanceof Object&&t.enum===e));if(n)return"string"==typeof B&&n.values.includes(B)||a(n.values[0],H).then((e=>{e&&(ee({code:"UPDATE_ERROR",message:e},r),R(null))})),void Se(n);const r=ce(B,e,x("DEFAULT_NEW_KEY",Y),(null==C?void 0:C.CustomNode)?x("DEFAULT_STRING",Y):void 0);["string","number","boolean"].includes(e)||R(null),a(r,H).then((e=>{e?(ee({code:"UPDATE_ERROR",message:e},r),R(null)):Se(null)}))})(e.target.value),value:Oe?Oe.enum:he,children:ke.map((t=>t instanceof Object&&"enum"in t?e.jsx("option",{value:t.enum,children:t.enum},t.enum):e.jsx("option",{value:t,children:t},t)))}),e.jsx("span",{className:"focus"})]}),Ie&&e.jsx("span",{className:"jer-error-slug",style:A("error",Y),children:X})]})]}),e.jsx(ge,{position:"below",nodeData:Y})]}))},se=(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=(t,n)=>{const r=se(t),{value:o}=n;switch(r){case"string":return e.jsx(_,Object.assign({},n,{value:o}));case"number":return e.jsx(F,Object.assign({},n,{value:o}));case"boolean":return e.jsx(L,Object.assign({},n,{value:o}));case"null":return e.jsx(B,Object.assign({},n));default:return e.jsx(W,Object.assign({},n))}},ce=(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)}},de=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[0],{element:a,wrapperElement:i,customNodeProps:s,wrapperProps:l,hideKey:c=!1,showEditTools:d=!0,showOnEdit:u=!1,showOnView:p=!0,showCollectionWrapper:m=!0}=r,g=o(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:a,CustomWrapper:i,customNodeProps:s,wrapperProps:l,hideKey:c,showEditTools:d,showOnEdit:u,showOnView:p,showCollectionWrapper:m},g)},ue=n=>{const{getStyles:r}=k(),{collapseState:o,setCollapseState:c,getMatchingCollapseState:d,currentlyEditingElement:u,setCurrentlyEditingElement:p,areChildrenBeingEdited:g,previousValue:h,setPreviousValue:y}=P(),{mainContainerRef:b,data:j,nodeData:x,parentData:E,showCollectionCount:C,onEdit:D,onAdd:w,onDelete:O,canDragOnto:S,collapseFilter:N,collapseAnimationTime:T,onMove:A,enableClipboard:R,onEditEvent:K,showIconTooltips:I,searchFilter:V,searchText:M,indent:_,sort:F,showArrayIndices:L,arrayIndexFromOne:z,defaultValue:B,newKeyOptions:W,translate:G,customNodeDefinitions:Y,customNodeData:H,jsonParse:U,jsonStringify:$,TextEditor:Z,keyboardControls:J,handleKeyboard:ee,insertAtTop:te,onCollapse:se,editConfirmRef:le,collapseClickZones:ce}=n,[pe,me]=t.useState($(j)),ge=N(x),{contentRef:he,isAnimating:ye,maxHeight:fe,collapsed:be,animateCollapse:je,cssTransitionValue:ve}=((e,n,r,o,a)=>{const[i,s]=t.useState(r?0:void 0),[l,c]=t.useState(r),d=t.useRef(!1),u=t.useRef(null),p=t.useRef(0),m=t.useRef(0),g=n/1e3+"s",h=t.useCallback((t=>{var r,i;if(l!==t){switch(window.clearTimeout(m.current),d.current=!0,t){case!0:{const e=null!==(i=null===(r=u.current)||void 0===r?void 0:r.offsetHeight)&&void 0!==i?i:0;p.current=e,s(e),setTimeout((()=>{s(0)}),5);break}case!1:s(p.current||oe(e,u,o,a))}c(!l),m.current=window.setTimeout((()=>{d.current=!1,t||s(void 0)}),n)}}),[n,l,e,o,a]);return{contentRef:u,isAnimating:d.current,animateCollapse:h,maxHeight:i,collapsed:l,cssTransitionValue:g}})(j,T,ge,b,$),{pathString:xe,nodeData:Ee,path:Ce,name:De,size:we,canEdit:ke,canDelete:Oe,canAdd:Se,canDrag:Ne,error:Te,setError:Ae,onError:Re,handleEditKey:Pe,emptyStringKey:Ke,derivedValues:Ie}=ne({props:n,collapsed:be}),{dragSourceProps:Ve,getDropTargetProps:Me,BottomDropTarget:_e,DropTargetPadding:Fe}=re({canDrag:Ne,canDragOnto:S,path:Ce,nodeData:Ee,onMove:A,onError:Re,translate:G}),Le=t.useRef(!ge),{isEditing:ze,isEditingKey:Be,isArray:We,canEditKey:Ge}=Ie;t.useEffect((()=>{me($(j))}),[j]),t.useEffect((()=>{const e=N(Ee)&&!ze;Le.current=!e,je(e)}),[N]),t.useEffect((()=>{if(null!==o){const e=d(Ce);e&&(Le.current=!0,je(e.collapsed))}}),[o]);const Ye=t.useRef(null),He=t.useCallback(((e,t)=>{if("function"!=typeof B)return B;const n=B(e,t);return void 0!==n?n:null}),[B]),Ue=t.useCallback((e=>W?"function"!=typeof W?W:W(e):null),[W]),{CustomNode:$e,customNodeProps:Ze,CustomWrapper:Je,wrapperProps:Xe={},hideKey:qe,showEditTools:Qe=!0,showOnEdit:et,showOnView:tt,showCollectionWrapper:nt=!0}=H,rt=g(xe);rt&&be&&je(!1);if(!(l("collection",Ee,V,M)||0===Ee.level)&&!rt)return null;const ot=Array.isArray(j)?"array":"object",at="array"===ot?{open:"[",close:"]"}:{open:"{",close:"}"},it=e=>{if("Tab"!==e.key||e.getModifierState("Shift"))ee(e,{objectConfirm:lt,cancel:dt});else{e.preventDefault();const t=v(Ye,"\t");me(t)}},st=e=>{e.stopPropagation();const t=m(e);if(t&&J.collapseModifier.includes(t))return Le.current=!0,void c({collapsed:!be,path:Ce,includeChildren:!0});u&&u.includes(xe)||(Le.current=!0,c(null),se&&se({path:Ce,collapsed:!be,includeChildren:!1}),je(!be))},lt=()=>{try{const e=U(pe);if(p(null),y(null),Ae(null),$(e)===$(j))return;D(e,Ce).then((t=>{t&&Re({code:"UPDATE_ERROR",message:t},e)}))}catch(e){Re({code:"INVALID_JSON",message:G("ERROR_INVALID_JSON",Ee)},pe)}},ct=Ce.length>0?()=>{O(j,Ce).then((e=>{e&&Re({code:"DELETE_ERROR",message:e},j)}))}:void 0,dt=()=>{p(null),null===h?(Ae(null),me($(j)),y(null)):D(h,Ce)},ut="when-closed"===C?be:C,pt=!ze&&Qe,mt=(L||!We)&&!qe&&void 0!==De,gt=$e&&(ze&&et||!ze&&tt),ht=Object.entries(j).map((([e,t])=>["array"===ot?Number(e):e,t]));"object"===ot&&F(ht,(e=>e));const yt=Le.current?ze?e.jsxs("div",{className:"jer-collection-text-edit",children:[Z?e.jsx(Z,{value:pe,onChange:me,onKeyDown:e=>ee(e,{objectConfirm:lt,cancel:dt})}):e.jsx(i,{textAreaRef:Ye,className:"jer-collection-text-area",name:xe,value:pe,setValue:me,handleKeyPress:it,styles:r("input",Ee)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(Q,{onOk:lt,onCancel:dt,nodeData:Ee,editConfirmRef:le})})]}):ht.map((([t,o],a)=>{const i={key:t,value:o,path:[...Ce,t],level:Ce.length+1,index:a,size:s(o)?Object.keys(o).length:null,parentData:j,fullData:Ee.fullData},l=de(Y,i);return e.jsx("div",{className:"jer-collection-element",style:r("collectionElement",i),children:s(o)&&!(null==l?void 0:l.renderCollectionAsValue)?e.jsx(ue,Object.assign({},n,{data:o,parentData:j,nodeData:i,showCollectionCount:C,canDragOnto:ke,customNodeData:l}),t):e.jsx(ie,Object.assign({},n,{data:o,parentData:j,nodeData:i,canDragOnto:ke,showLabel:"object"===ot||L,customNodeData:l}),t)},t)})):null,ft=!!nt&&(be&&!rt);ft||(Le.current=!0);const bt=Object.assign(Object.assign({},n),{data:j,value:j,parentData:E,nodeData:Ee,setValue:e=>a(void 0,void 0,void 0,(function*(){return yield D(e,Ce)})),handleEdit:lt,handleCancel:dt,handleKeyPress:it,isEditing:ze,setIsEditing:()=>p(Ce),getStyles:r,canDragOnto:ke,canEdit:ke,keyboardCommon:{},onError:Re}),jt=gt?e.jsx($e,Object.assign({customNodeProps:Ze},bt,{children:yt})):yt,vt=pt&&e.jsx(q,{startEdit:ke?()=>{Le.current=!0,y(null),p(Ce)}:void 0,handleAdd:Se?e=>{je(!1);const t=He(Ee,e);if("array"===ot){const e=te.array?0:j.length,n=te.array?{insert:!0}:{};w(t,[...Ce,e],n).then((e=>{e&&Re({code:"ADD_ERROR",message:e},t)}))}else if(e in j)Re({code:"KEY_EXISTS",message:G("ERROR_KEY_EXISTS",Ee)},e);else{const n=te.object?{insertBefore:0}:{};w(t,[...Ce,e],n).then((e=>{e&&Re({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:Oe?ct:void 0,enableClipboard:R,type:ot,nodeData:Ee,translate:G,customButtons:n.customButtons,keyboardControls:J,handleKeyboard:ee,getNewKeyOptions:Ue,editConfirmRef:le,jsonStringify:$,onEditEvent:K,showIconTooltips:I}),xt={canEditKey:Ge,isEditingKey:Be,pathString:xe,path:Ce,name:De,arrayIndexFromOne:z,handleKeyboard:ee,handleEditKey:Pe,handleCancel:dt,keyValueArray:ht,styles:r("property",Ee),getNextOrPrevious:e=>f(Ee.fullData,Ce,e,F),handleClick:ce.includes("property")?st:e=>e.stopPropagation(),emptyStringKey:Ke},Et=e.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===Ce.length?0:_/2)+"em"},r("collection",Ee)),{position:"relative"}),draggable:Ne},Ve,Me("above"),{children:[e.jsx("div",{className:"jer-clickzone",style:{width:_/2+1+"em",zIndex:10+2*Ee.level},onClick:ce.includes("left")?st:void 0}),!ze&&_e,e.jsx(Fe,{position:"above",nodeData:Ee}),nt?e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:ce.includes("header")?st:void 0,children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("div",{className:"jer-collapse-icon jer-accordion-icon"+(be?" jer-rotate-90":""),style:{zIndex:11+2*Ee.level,transition:ve},onClick:st,children:e.jsx(X,{name:"chevron",rotate:be,nodeData:Ee})}),mt&&e.jsx(ae,Object.assign({},xt)),!ze&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:r("bracket",Ee),children:at.open})]}),!ze&&ut&&e.jsx("div",{className:"jer-collection-item-count"+(ut?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},r("itemCount",Ee)),{transition:ve}),children:1===we?G("ITEM_SINGLE",Object.assign(Object.assign({},Ee),{size:1}),1):G("ITEMS_MULTIPLE",Ee,we)}),e.jsx("div",{className:"jer-brackets"+(ft?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},r("bracket",Ee)),{transition:ve}),children:at.close}),vt]}):qe?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[e.jsx(ae,Object.assign({},xt)),vt]}),e.jsxs("div",{className:"jer-collection-inner",style:Object.assign(Object.assign({overflowY:ft||ye?"clip":"visible",maxHeight:rt?void 0:fe},r("collectionInner",Ee)),{transition:ve}),ref:he,children:[jt,e.jsx("div",{className:ze?"jer-collection-error-row":"jer-collection-error-row-edit",children:Te&&e.jsx("span",{className:"jer-error-slug",style:r("error",Ee),children:Te})}),!ze&&nt&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},r("bracket",Ee)),{marginLeft:(_<3?-1:_<6?-.5:0)+"em"}),children:at.close})]}),e.jsx(Fe,{position:"below",nodeData:Ee})]}));return Je?e.jsx(Je,Object.assign({customNodeProps:Xe},bt,{children:Et})):Et},pe={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",KEY_SELECT:"Select key",NO_KEY_OPTIONS:"No key options",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",SHOW_LESS:"(Show less)",EMPTY_STRING:"<empty string>",TOOLTIP_COPY:"Copy to clipboard",TOOLTIP_EDIT:"Edit",TOOLTIP_DELETE:"Delete",TOOLTIP_ADD:"Add"},me=(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]:pe[r];return void 0===o?a:null==a?void 0:a.replace("{{count}}",String(o))})(e,t,r,n,o);var ge=[],he=[];!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=ge.indexOf(a);-1===i&&(i=ge.push(a)-1,he[i]={}),n=he[i]&&he[i][r]?he[i][r]:he[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-highlight-color:#b3d8ff}.jer-visible{opacity:1}.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-select-inner{text-overflow:ellipsis;width:100%}.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-bracket-outside{padding-left:.5em}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em;line-height:1.1em}.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;width:100%}.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;word-break:break-word}.jer-string-expansion{cursor:pointer;filter:saturate(50%);opacity:.6}.jer-show-less{font-size:80%}.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:.3s}.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-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-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 ye=(e,t)=>JSON.stringify(e,t,2),fe=({data:n,setData:r,rootName:o="root",onUpdate:i=()=>{},onEdit:l=i,onDelete:c=i,onAdd:d=i,onChange:u,onError:m,onEditEvent:h,showErrorMessages:f=!0,enableClipboard:b=!0,indent:j=2,collapse:v=!1,collapseAnimationTime:E=300,showCollectionCount:C=!0,restrictEdit:D=!1,restrictDelete:w=!1,restrictAdd:O=!1,restrictTypeSelection:S=!1,restrictDrag:N=!0,viewOnly:T,searchFilter:A,searchText:R,searchDebounceTime:K=350,keySort:I=!1,showArrayIndices:V=!0,arrayIndexFromOne:M=!1,showStringQuotes:_=!0,showIconTooltips:F=!1,defaultValue:L=null,newKeyOptions:z,minWidth:B=250,maxWidth:W="min(600px, 90vw)",rootFontSize:G,stringTruncate:Y=250,translations:H={},className:U,id:$,customText:Z={},customNodeDefinitions:J=[],customButtons:X=[],jsonParse:q=JSON.parse,jsonStringify:Q=ye,TextEditor:ee,errorMessageTimeout:te=2500,keyboardControls:ne={},externalTriggers:re,insertAtTop:oe=!1,onCollapse:ae,collapseClickZones:se=["header","left"]})=>{const{getStyles:le}=k(),{setCurrentlyEditingElement:ce}=P(),pe=t.useMemo((()=>je(v)),[v]),ge=t.useMemo((()=>me(H,Z)),[H,Z]),[he,fe]=t.useState(R),[Ce,De]=(({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}),we=t.useRef(null);t.useEffect((()=>{ce(null);const e=setTimeout((()=>fe(R)),K);return()=>clearTimeout(e)}),[R,K]);const ke={key:o,path:[],level:0,index:0,value:Ce,size:"object"==typeof Ce&&null!==Ce?Object.keys(Ce).length:1,parentData:null,fullData:Ce},Oe=(e,t)=>a(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void De(t.newData);const r=xe(n)?n:["error",n],[o,a]=r;if("error"===o)return De(t.currentData),!1===a?ge("ERROR_UPDATE",ke):String(a);De(a)})),Se=t.useMemo((()=>je(D,T)),[D,T]),Ne=t.useMemo((()=>je(w,T)),[w,T]),Te=t.useMemo((()=>je(O,T)),[O,T]),Ae=t.useMemo((()=>je(N,T)),[N,T]),Re=t.useMemo((()=>ve(A)),[A]),Pe=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})(ne)),[ne]),Ke=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}})(Pe,t,e)),[Pe]),Ie=t.useMemo((()=>{const e=Ee(J,"stringifyReplacer");return t=>Q(t,e)}),[J,Q]),Ve=t.useMemo((()=>{const e=Ee(J,"parseReviver");return t=>{const n=q(t,e);return x(n)}}),[J,q]),Me=t.useRef(null);((e,n)=>{const{setCurrentlyEditingElement:r,currentlyEditingElement:o,setCollapseState:a}=P();t.useEffect((()=>{if(!e)return;const{collapse:t,edit:i}=e;t&&a(t);const s=!(null==i?void 0:i.path)||p(i.path)===o;switch(null==i?void 0:i.action){case"accept":s&&(n.current&&n.current.click(),r(null));break;case"cancel":s&&r(null);break;default:(null==i?void 0:i.path)&&r(i.path)}}),[e])})(re,Me);const _e=t.useCallback(((e,t)=>{!1!==I&&("function"!=typeof I?e.sort(((e,n)=>{const r=t(e)[0],o=t(n)[0];return r<o?-1:r>o?1:0})):e.sort(((e,n)=>I(t(e),t(n)))))}),[I]),Fe=de(J,ke),Le={mainContainerRef:we,name:o,nodeData:ke,onEdit:(e,t)=>a(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=be(Ce,t,e,"update");if(o!==a)return yield Oe(l,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>a(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:a}=be(Ce,t,e,"delete");return yield Oe(c,{currentData:n,newData:r,currentValue:o,newValue:a,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>a(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:a,newValue:i}=be(Ce,t,e,"add",n);return yield Oe(d,{currentData:r,newData:o,currentValue:a,newValue:i,name:t.slice(-1)[0],path:t})})),onChange:u,onError:m,onEditEvent:h,showErrorMessages:f,onMove:(e,t,n)=>a(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:a}=be(Ce,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}=be(o,[...s,d],a,"add",u);return yield Oe(l,{currentData:r,newData:p,currentValue:a,newValue:m,name:t.slice(-1)[0],path:t})})),showCollectionCount:C,collapseFilter:pe,collapseAnimationTime:E,restrictEditFilter:Se,restrictDeleteFilter:Ne,restrictAddFilter:Te,restrictTypeSelection:S,restrictDragFilter:Ae,canDragOnto:!1,searchFilter:Re,searchText:he,enableClipboard:b,keySort:I,sort:_e,showArrayIndices:V,arrayIndexFromOne:M,showStringQuotes:_,showIconTooltips:F,indent:j,defaultValue:L,newKeyOptions:z,stringTruncate:Y,translate:ge,customNodeDefinitions:J,customNodeData:Fe,customButtons:X,parentData:null,jsonParse:Ve,jsonStringify:Ie,TextEditor:ee,errorMessageTimeout:te,handleKeyboard:Ke,keyboardControls:Pe,insertAtTop:{object:!0===oe||"object"===oe,array:!0===oe||"array"===oe},onCollapse:ae,editConfirmRef:Me,collapseClickZones:se},ze=Object.assign(Object.assign({},le("container",ke)),{minWidth:B,maxWidth:W});return ze.fontSize=null!=G?G:ze.fontSize,e.jsx("div",{id:$,ref:we,className:`jer-editor-container ${null!=U?U:""}`,style:ze,children:s(Ce)&&!Fe.renderCollectionAsValue?e.jsx(ue,Object.assign({data:Ce},Le)):e.jsx(ie,Object.assign({data:Ce,showLabel:!0},Le))})},be=(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}},je=(e,t)=>t?()=>!0:"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,ve=e=>{if(void 0!==e)return"value"===e?d:"key"===e?u:"all"===e?(e,t)=>d(e,t)||u(e,t):e},xe=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),Ee=(e,t)=>{const n="stringifyReplacer"===t?[e=>void 0===e?E:e]:[];if(n.push(...e.map((e=>e[t])).filter((e=>!!e))),0!==n.length)return(e,t)=>{let r=t;for(const e of n)r=e(r);return r}},Ce=t=>{var n;const{value:r,setIsEditing:o,getStyles:a,nodeData:i}=t,s=a("string",i);return e.jsx("div",{onDoubleClick:()=>o(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&o(!0)},className:"jer-value-string jer-hyperlink",style:s,children:e.jsx("a",{href:r,target:"_blank",rel:"noreferrer",style:{color:null!==(n=s.color)&&void 0!==n?n:void 0},children:e.jsx(V,Object.assign({},t,{pathString:p(i.path),styles:s,value:i.value}))})})},De={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:Ce,showOnView:!0,showOnEdit:!1};exports.assign=n,exports.extract=r,exports.IconAdd=G,exports.IconCancel=Z,exports.IconChevron=J,exports.IconCopy=U,exports.IconDelete=H,exports.IconEdit=Y,exports.IconOk=$,exports.JsonEditor=n=>{var r;const[o,a]=t.useState();return t.useEffect((()=>{const e=document.documentElement;a(e)}),[]),o?e.jsx(w,{theme:null!==(r=n.theme)&&void 0!==r?r:C,icons:n.icons,docRoot:o,children:e.jsx(R,{onEditEvent:n.onEditEvent,onCollapse:n.onCollapse,children:e.jsx(fe,Object.assign({},n))})}):null},exports.LinkCustomComponent=Ce,exports.LinkCustomNodeDefinition=De,exports.StringDisplay=V,exports.StringEdit=M,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=C,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=s,exports.matchNode=d,exports.matchNodeKey=u,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.standardDataTypes=te,exports.toPathString=p,exports.useKeyboardListener=z;
|
package/build/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createContext as r,useContext as o,useState as i,useRef as a,useEffect as l,useCallback as s,useMemo 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){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}function g(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function l(e){try{s(r.throw(e))}catch(e){i(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(a,l)}s((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const m=({className:n,name:r,value:o,setValue:i,handleKeyPress:a,styles:l,textAreaRef:s})=>{if("string"!=typeof o)return null;const c="\n"===o.slice(-1)?o+".":o;return e("div",{style:{display:"grid"},children:[t("textarea",{id:`${r}_textarea`,ref:s,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=>i(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:a}),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:c})]})},h=e=>null!==e&&"object"==typeof e,y=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!f(r,t,n))return!1}if(!n&&r&&!f(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!b(t,r))return!1}return!0},f=(e="",t,n=b)=>{const r=t.value;return Object.entries(r).some((([o,i])=>{const a=[...t.path,o],l=Object.assign(Object.assign({},t),{key:o,path:a,level:t.level+1,value:i,size:a.length,parentData:r});return h(i)?f(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}},v=({key:e,path:t},n="")=>!!b({value:e},n)||!!t.some((e=>b({value:e},n))),j=(e,t)=>(null!=t?t:"")+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,w=(e,t,n)=>{const r=e.key,o=E(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:i,modifier:a}=t;return("stringLineBreak"!==n||"Enter"!==r||"Shift"!==o||"Enter"!==i||!(null==a?void 0:a.includes("Shift")))&&(r===i&&(a===o||Array.isArray(a)&&a.includes(o)))},D={key:"Enter"},C={confirm:D,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},D),{modifier:["Meta","Shift","Control"]}),objectLineBreak:D,stringConfirm:D,stringLineBreak:Object.assign(Object.assign({},D),{modifier:["Shift"]}),numberConfirm:D,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:D,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},O=(e,t,n="next",r)=>{const o=t.slice(0,t.length-1),i=t.slice(-1)[0];if(void 0===i)return null;const a=u(e,o),l=S(a);Array.isArray(a)||r(l,(({key:e,value:t})=>[e,t]));const s=l.findIndex((e=>e.key===i)),c=l[s+("next"===n?1:-1)];return c?h(c.value)?0===Object.keys(c.value).length?O(e,[...o,c.key],n,r):k(e,[...o,c.key],n,r):[...o,c.key]:0===o.length?null:O(e,o,n,r)},k=(e,t,n="next",r)=>{const o=u(e,t);if(!h(o))return t;const i=Array.isArray(o)?o.map(((e,t)=>t)):Object.keys(o);r(i,(e=>[e,o]));const a="next"===n?i[0]:i[i.length-1];return k(e,[...t,a],n,r)},S=e=>Array.isArray(e)?e.map(((e,t)=>({index:t,value:e,key:t}))):Object.entries(e).map((([e,t],n)=>({key:e,value:t,index:n}))),N=(e,t)=>{var n,r,o,i;const a=e.current,l=null!==(n=null==a?void 0:a.selectionStart)&&void 0!==n?n:1/0,s=null!==(r=null==a?void 0:a.selectionEnd)&&void 0!==r?r:1/0,c=(null===(o=null==a?void 0:a.textContent)||void 0===o?void 0:o.slice(0,l))+t+(null===(i=null==a?void 0:a.textContent)||void 0===i?void 0:i.slice(s));return a.value=c,null==a||a.setSelectionRange(l+1,l+1),c},T=e=>{if(e!==x){if(Array.isArray(e))return e.map((e=>T(e)));if(e&&"object"==typeof e)for(const t in e)e[t]=T(e[t]);return e}},x="__undefined__",A={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)"}},P=r({getStyles:()=>({}),icons:{}}),R=({theme:e=A,icons:n={},docRoot:r,children:o})=>{const i=I(e,r);return t(P.Provider,{value:{getStyles:(e,t)=>"function"==typeof i[e]?i[e](t):i[e],icons:n},children:o})},K=()=>o(P),I=(e,t)=>{var n,r,o,i;const a={},l=(Array.isArray(e)?e:[e]).map((e=>_(e)?V({fragments:{},styles:e},a):V(e,a))),s=V(A,{});Object.keys(s).forEach((e=>{const t=e;l.forEach((e=>{e[t]&&(s[t]=Object.assign(Object.assign({},s[t]),e[t]))}))}));const c=Object.assign({},s);return Object.entries(a).forEach((([e,t])=>{const n=e;c[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},s[n]),r)}})),"function"!=typeof(null==c?void 0:c.inputHighlight)&&(null===(n=null==c?void 0:c.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",null===(r=null==c?void 0:c.inputHighlight)||void 0===r?void 0:r.backgroundColor),"function"!=typeof(null==c?void 0:c.iconCopy)&&(null===(o=null==c?void 0:c.iconCopy)||void 0===o?void 0:o.color)&&t.style.setProperty("--jer-icon-copy-color",null===(i=null==c?void 0:c.iconCopy)||void 0===i?void 0:i.color),c},V=(e,t)=>{const{fragments:n,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const i=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var i,a;if("function"==typeof o)return t[e]=o,Object.assign({},r);if("string"==typeof o){const t=null!==(i=null==n?void 0:n[o])&&void 0!==i?i:o;return"string"==typeof t?Object.assign(Object.assign({},r),{[null!==(a=F[e])&&void 0!==a?a:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=i})),o},_=e=>!("styles"in e),F={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},L=r(null),z=({children:e,onEditEvent:n,onCollapse:r})=>{const[o,l]=i(null),[s,c]=i(null),[d,u]=i(null),[p,g]=i({path:null,pathString:null}),m=a(null),h=a("next"),y=a(null);return t(L.Provider,{value:{collapseState:o,setCollapseState:e=>{l(e),r&&null!==e&&(Array.isArray(e)?e.forEach((e=>r(e))):r(e)),null!==e&&setTimeout((()=>l(null)),2e3)},getMatchingCollapseState:e=>{if(Array.isArray(o)){for(const t of o)if(B(e,t))return t;return null}return B(e,o)?o:null},currentlyEditingElement:s,setCurrentlyEditingElement:(e,t)=>{const r="string"==typeof e||null===e?e:j(e,"key"===t?"key_":void 0);null!==s&&null!==r&&null!==m.current&&m.current(),c(r),n&&(Array.isArray(e)||null===e)&&n(e,"key"===t),m.current="function"==typeof t?t:null},areChildrenBeingEdited:e=>null!==s&&s.includes(e),previouslyEditedElement:y.current,setPreviouslyEditedElement:e=>{y.current=e},tabDirection:h.current,setTabDirection:e=>{h.current=e},previousValue:d,setPreviousValue:u,dragSource:p,setDragSource:g},children:e})},M=()=>{const e=o(L);if(!e)throw new Error("Missing Context Provider");return e},B=(e,t)=>{if(null===t)return!1;if(!t.includeChildren)return t.path.every(((t,n)=>e[n]===t))&&t.path.length===e.length;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},W="**INVALID_FUNCTION**",G=({nodeData:r,showStringQuotes:o=!0,stringTruncate:a=200,pathString:l,canEdit:s,setIsEditing:c,styles:d,translate:u,value:p,TextWrapper:g=({children:e})=>e})=>{const m=null!=p?p:r.value,[h,y]=i(!1),f=o?'"':"",b=m.length>a,v=()=>{s?c(!0):y(!h)};return e("div",{id:`${l}_display`,onDoubleClick:v,onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&v()},className:"jer-value-string",style:d,children:[f,b?e(n,h?{children:[t(g,{children:e("span",{children:[m,f]})}),e("span",{className:"jer-string-expansion jer-show-less",onClick:()=>y(!1),children:[" ",u("SHOW_LESS",r)]})]}:{children:[e(g,{children:[t("span",{children:m.slice(0,a-2).trimEnd()})," "]}),t("span",{className:"jer-string-expansion jer-ellipsis",onClick:()=>y(!0),children:"..."}),f]}):t(g,{children:`${m}${f}`})]})},Y=({styles:e,pathString:n,value:r,setValue:o,handleEdit:i,handleKeyboard:l,keyboardCommon:s})=>{const c=a(null);return t(m,{className:"jer-input-text",textAreaRef:c,name:n,value:r,setValue:o,handleKeyPress:e=>{l(e,Object.assign({stringConfirm:i,stringLineBreak:()=>{const e=N(c,"\n");o(e)}},s))},styles:e})},H=n=>{var{isEditing:r,path:o,enumType:i}=n,a=p(n,["isEditing","path","enumType"]);const{getStyles:l}=K(),s=j(o),{value:c,setValue:d,nodeData:u,handleEdit:g,handleKeyboard:m,keyboardCommon:h}=a;return r&&i?e("div",{className:"jer-select jer-select-enums",children:[t("select",{name:`${s}-value-select`,className:"jer-select-inner",onChange:e=>d(e.target.value),value:c,autoFocus:!0,onKeyDown:e=>{m(e,Object.assign({stringConfirm:g},h))},children:i.values.map((e=>t("option",{value:e,children:e},e)))}),t("span",{className:"focus"})]}):r?t(Y,Object.assign({styles:l("input",u),pathString:s},a,{setValue:a.setValue})):t(G,Object.assign({pathString:s,styles:l("string",u)},a))},U=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:i,handleEdit:a,nodeData:l,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=K();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=>setTimeout((()=>e.target.select()),10),onKeyDown:t=>s(t,Object.assign({numberConfirm:a,numberUp:()=>n(Number(e)+1),numberDown:()=>n(Number(e)-1)},c)),style:Object.assign({width:String(e).length/1.5+2+"em"},d("input",l))}):t("span",{onDoubleClick:()=>i(!0),className:"jer-value-number",style:d("number",l),children:e})},$=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:i,handleEdit:a,nodeData:l,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=K();return"boolean"!=typeof e?null:r?t("input",{className:"jer-input-boolean",type:"checkbox",name:j(o),checked:e,onChange:()=>n(!e),onKeyDown:t=>{" "===t.key&&t.preventDefault(),s(t,Object.assign({booleanConfirm:a,booleanToggle:()=>n(!e)},c))},autoFocus:!0}):t("span",{onDoubleClick:()=>i(!0),className:"jer-value-boolean",style:d("boolean",l),children:String(e)})},Z=(e,t)=>{const n=a(void 0),r=a(t);l((()=>{r.current=t}),[t]);const o=e=>{r.current(e)};l((()=>{if(window.clearTimeout(n.current),e)return n.current=window.setTimeout((()=>{window.addEventListener("keydown",o)}),100),()=>{window.clearTimeout(n.current),window.removeEventListener("keydown",o)}}),[e])},X=({value:e,isEditing:n,setIsEditing:r,handleEdit:o,nodeData:i,handleKeyboard:a,keyboardCommon:l})=>{const{getStyles:s}=K();return Z(n,(e=>a(e,Object.assign({confirm:o},l)))),t("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:s("null",i),children:String(e)})},J=({value:e})=>{let n="Error!";switch(typeof e){case"string":e===W&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return t("span",{className:"jer-value-invalid",children:n})},Q=({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"})]}),q=({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"})]}),ee=({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"})}),te=({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"})]}),ne=({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"})]}),re=({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"})}),oe=({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"})}),ie=({name:e,nodeData:r})=>{var o,i,a,l,s,c,d;const{getStyles:u,icons:p}=K(),g={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(o=null==p?void 0:p.add)&&void 0!==o?o:t(Q,Object.assign({},g,{style:u("iconAdd",r)}));case"edit":return null!==(i=null==p?void 0:p.edit)&&void 0!==i?i:t(q,Object.assign({},g,{style:u("iconEdit",r)}));case"delete":return null!==(a=null==p?void 0:p.delete)&&void 0!==a?a:t(ee,Object.assign({},g,{style:u("iconDelete",r),size:"1.45em"}));case"copy":return null!==(l=null==p?void 0:p.copy)&&void 0!==l?l:t(te,Object.assign({},g,{style:u("iconCopy",r),size:"1.2em"}));case"ok":return null!==(s=null==p?void 0:p.ok)&&void 0!==s?s:t(ne,Object.assign({},g,{style:Object.assign({fontSize:"90%"},u("iconOk",r))}));case"cancel":return null!==(c=null==p?void 0:p.cancel)&&void 0!==c?c:t(re,Object.assign({},g,{style:Object.assign({fontSize:"130%"},u("iconCancel",r))}));case"chevron":return null!==(d=null==p?void 0:p.chevron)&&void 0!==d?d:t(oe,{size:"1em",style:u("iconCollection",r)});default:return t(n,{})}},ae=({startEdit:r,handleDelete:o,handleAdd:a,enableClipboard:l,type:s,customButtons:c,nodeData:d,translate:p,keyboardControls:g,handleKeyboard:m,editConfirmRef:h,getNewKeyOptions:y,jsonStringify:f,onEditEvent:b,showIconTooltips:v})=>{const{getStyles:j}=K(),w=p("KEY_NEW",d),[D,C]=i(w),[O,k]=i(!1),{key:S,path:N,value:T}=d,x=Array.isArray(O),A=e=>{var t;if(b&&b(e?[...N,null]:null,e),!e)return void k(!1);const n=Object.keys(u(d.fullData,N)),r=y?null===(t=y(d))||void 0===t?void 0:t.filter((e=>!n.includes(e))):null;r&&C(""),k(null==r||r)};return e("div",{className:"jer-edit-buttons",style:{opacity:O?1:void 0},onClick:e=>e.stopPropagation(),children:[l&&t("div",{onClick:e=>{var t;e.stopPropagation();let n,r,o="value",i="",a=null;if(l){const s=E(e);if(s&&g.clipboardModifier.includes(s)?(n=se(N),i=n,o="path"):(n=T,i="object"==typeof n?f(T):String(n)),!navigator.clipboard)return void("function"==typeof l&&l({success:!1,value:n,stringValue:i,path:N,key:S,type:o,errorMessage:"Can't access clipboard API"}));null===(t=navigator.clipboard)||void 0===t||t.writeText(i).then((()=>r=!0)).catch((e=>{r=!1,a=e.message})).finally((()=>{"function"==typeof l&&l({success:r,errorMessage:a,value:n,stringValue:i,path:N,key:S,type:o})}))}},className:"jer-copy-pulse",title:v?p("TOOLTIP_COPY",d):"",children:t(ie,{name:"copy",nodeData:d})}),r&&t("div",{onClick:r,title:v?p("TOOLTIP_EDIT",d):"",children:t(ie,{name:"edit",nodeData:d})}),o&&t("div",{onClick:o,title:v?p("TOOLTIP_DELETE",d):"",children:t(ie,{name:"delete",nodeData:d})}),a&&t("div",{onClick:()=>{"object"===s?A(!0):a("")},title:v?p("TOOLTIP_ADD",d):"",children:t(ie,{name:"add",nodeData:d})}),null==c?void 0:c.map((({Element:e,onClick:n},r)=>t("div",{onClick:e=>n&&n(d,e),children:t(e,{nodeData:d})},r))),O&&a&&"object"===s&&e(n,{children:[x?e("div",{className:"jer-select jer-select-keys",children:[e("select",{name:"new-key-select",className:"jer-select-inner",onChange:e=>{a(e.target.value),A(!1)},defaultValue:"",autoFocus:!0,onKeyDown:e=>{m(e,{cancel:()=>A(!1)})},children:[t("option",{value:"",disabled:!0,children:O.length>0?p("KEY_SELECT",d):p("NO_KEY_OPTIONS",d)}),O.map((e=>t("option",{value:e,children:e},e)))]}),t("span",{className:"focus"})]}):t("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:D,onChange:e=>C(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{m(e,{stringConfirm:()=>{a&&(A(!1),a(D),C(w))},cancel:()=>{A(!1),C(w)}})},style:j("input",d)}),t(le,{onOk:()=>{x&&!D||(A(!1),a(D))},onCancel:()=>{A(!1)},nodeData:d,editConfirmRef:h,hideOk:x})]})]})},le=({onOk:n,onCancel:r,nodeData:o,editConfirmRef:i,hideOk:a=!1})=>e("div",{className:"jer-confirm-buttons",children:[!a&&t("div",{onClick:n,ref:i,children:t(ie,{name:"ok",nodeData:o})}),t("div",{onClick:r,children:t(ie,{name:"cancel",nodeData:o})})]}),se=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),ce=["string","number","boolean","null","object","array"],de=({props:e,collapsed:t})=>{const{data:n,nodeData:r,parentData:o,onEdit:a,onError:l,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:m,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:f}=M(),[b,v]=i(null),E=Object.assign(Object.assign({},r),{collapsed:t}),{path:w,key:D,size:C}=E,O=j(w),k=!d(E),S=!u(E),N=!p(E),T=!g(E)&&S&&null===y,x=e=>{c&&(v(e),setTimeout((()=>v(null)),h)),console.warn("Error",e)},A=s(((e,t)=>{x(e.message),l&&l({currentData:E.fullData,errorValue:t,currentValue:n,name:D,path:w,error:e})}),[l,c]),P=y===O,R=y===`key_${O}`,K="number"==typeof w.slice(-1)[0],I={isEditing:P,isEditingKey:R,isArray:K,canEditKey:null!==o&&k&&N&&S&&!K},V=""===D&&w.length>0?m("EMPTY_STRING",E):null;return{pathString:O,nodeData:E,path:w,name:D,size:C,canEdit:k,canDelete:S,canAdd:N,canDrag:T,error:b,showError:x,onError:A,setError:v,handleEditKey:e=>{if(f(null),D===e)return;if(!o)return;const t=w.slice(0,-1);if(Object.keys(o).includes(e))return void A({code:"KEY_EXISTS",message:m("ERROR_KEY_EXISTS",E)},e);const n=Object.fromEntries(Object.entries(o).map((([t,n])=>t===D?[e,n]:[t,n])));a(n,t).then((t=>{t&&A({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:I,emptyStringKey:V}},ue=({canDrag:e,canDragOnto:n,path:r,nodeData:o,onMove:a,onError:l,translate:s})=>{const{getStyles:d}=K(),{dragSource:u,setDragSource:p}=M(),[g,m]=i(!1),h=j(r),y=c((()=>e?{onDragStart:e=>{e.stopPropagation(),p({path:r,pathString:h})},onDragEnd:e=>{e.stopPropagation(),p({path:null,pathString:null})}}:{}),[e,h]),f=c((()=>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,h]),b=c((()=>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}},f("below"))):null),[u,n,r.length]),v=e=>{var t,n;const i=null===(t=u.path)||void 0===t?void 0:t.slice(-1)[0],c=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&&c!==d?l({code:"KEY_EXISTS",message:s("ERROR_KEY_EXISTS",o)},i):a(u.path,r,e).then((e=>{e&&l({code:"UPDATE_ERROR",message:e},o.value)}))};return{dragSourceProps:y,getDropTargetProps:f,BottomDropTarget:b,DropTargetPadding:({position:e,nodeData:n})=>g===e?t("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",n)}):null,handleDrop:v}},pe=(e,t,n,r)=>{var o,i,a;if(!t.current)return 0;const l=parseInt(null!==(o=getComputedStyle(n.current).getPropertyValue("line-height"))&&void 0!==o?o:"16px"),s=(null!==(a=null===(i=t.current)||void 0===i?void 0:i.offsetWidth)&&void 0!==a?a:0)/(.5*l),c=r(e).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/s))).reduce(((e,t)=>e+t),0)*l;return Math.min(c+30,window.innerHeight-50)},ge=({isEditingKey:n,canEditKey:r,pathString:o,path:i,name:a,arrayIndexFromOne:l,handleKeyboard:s,handleEditKey:c,handleCancel:d,handleClick:u,keyValueArray:p,styles:g,getNextOrPrevious:m,emptyStringKey:h})=>{const{setCurrentlyEditingElement:y}=M(),f="number"==typeof a?String(a+(l?1:0)):a;return n?t("input",{className:"jer-input-text jer-key-edit",type:"text",name:o,defaultValue:f,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>s(e,{stringConfirm:()=>c(e.target.value),cancel:d,tabForward:()=>{if(c(e.target.value),p){const e=null==p?void 0:p[0][0];y(e?[...i,e]:m("next"))}else y(i)},tabBack:()=>{c(e.target.value),y(m("prev"))}}),style:{width:f.length/1.5+.5+"em"}}):e("span",{className:"jer-key-text",style:Object.assign(Object.assign({},g),{minWidth:`${Math.min(f.length+1,5)}ch`,flexShrink:f.length>10?1:0}),onDoubleClick:()=>r&&y(i,"key"),onClick:u,children:[h?t("span",{className:"jer-empty-string",children:h}):f,""!==f||h?t("span",{className:"jer-key-colon",children:":"}):null]})},me=n=>{const{data:r,parentData:o,onEdit:a,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:m,restrictTypeSelection:h,searchFilter:f,searchText:b,showLabel:v,stringTruncate:j,showStringQuotes:E,arrayIndexFromOne:w,indent:D,translate:C,customNodeDefinitions:k,customNodeData:S,handleKeyboard:N,keyboardControls:T,sort:x,editConfirmRef:A,jsonStringify:P,showIconTooltips:R}=n,{getStyles:I}=K(),{setCurrentlyEditingElement:V,setCollapseState:_,previouslyEditedElement:F,setPreviouslyEditedElement:L,tabDirection:z,setTabDirection:B,previousValue:G,setPreviousValue:Y}=M(),[H,U]=i("function"==typeof r?W:r),{pathString:$,nodeData:Z,path:X,name:J,canEdit:Q,canDelete:q,canDrag:ee,error:te,onError:ne,handleEditKey:re,emptyStringKey:oe,derivedValues:ie}=de({props:n}),{dragSourceProps:se,getDropTargetProps:pe,BottomDropTarget:me,DropTargetPadding:be}=ue({canDrag:ee,canDragOnto:m,path:X,nodeData:Z,onMove:p,onError:ne,translate:C}),[ve,je]=i(he(r,S)),Ee=s((e=>{if(!u)return void U(e);const t=u({currentData:Z.fullData,newValue:e,currentValue:H,name:J,path:X});U(t)}),[u]);l((()=>{U("function"==typeof r?W:r),je(he(r,S))}),[r,te]);const{CustomNode:we,customNodeProps:De,hideKey:Ce,showEditTools:Oe=!0,showOnEdit:ke,showOnView:Se,passOriginalNode:Ne}=S,Te=[...ce,...k.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],xe=c((()=>{if("boolean"==typeof h)return h?[]:Te;if(Array.isArray(h))return h;const e=h(Z);return"boolean"==typeof e?e?[]:Te:e}),[Z,h]),[Ae,Pe]=i(((e,t)=>{var n;if("string"!=typeof e)return null;const r=t.filter((t=>t instanceof Object&&t.enum&&t.values.includes(e)&&t.matchPriority));return r.sort(((e,t)=>{var n,r;return(null!==(n=t.matchPriority)&&void 0!==n?n:0)-(null!==(r=e.matchPriority)&&void 0!==r?r:0)})),null!==(n=r[0])&&void 0!==n?n:null})(H,xe)),{isEditing:Re}=ie,Ke=y("value",Z,f,b);if(Re&&(!Ke||!Q)){const e=O(Z.fullData,X,z,x);V(e||F)}if(!Ke)return null;const Ie=e=>{let t;if(V(null),Y(null),void 0===e||(e=>e&&"object"==typeof e&&"type"in e&&"target"in e&&"preventDefault"in e&&"function"==typeof e.preventDefault)(e))switch(ve){case"object":t={[C("DEFAULT_NEW_KEY",Z)]:H};break;case"array":t=null!=H?H:[];break;case"number":{const e=Number(H);t=isNaN(e)?0:e;break}default:t=H}else t=e;a(t,X).then((e=>{e&&ne({code:"UPDATE_ERROR",message:e},t)}))},Ve=()=>{V(null),null===G?(U(r),Y(null)):a(G,X)},{isEditingKey:_e,canEditKey:Fe}=ie,Le=!Re&&te,ze=Re&&xe.length>1,Me=("invalid"!==ve||we)&&!te&&Oe,Be=v&&!Ce,We=we&&(Re&&ke||!Re&&Se),Ge={value:H,parentData:o,setValue:Ee,isEditing:Re,canEdit:Q,setIsEditing:Q?()=>V(X):()=>{},handleEdit:Ie,handleCancel:Ve,path:X,stringTruncate:j,showStringQuotes:E,nodeData:Z,enumType:Ae,translate:C,handleKeyboard:N,keyboardCommon:{cancel:Ve,tabForward:()=>{B("next"),L($);const e=O(Z.fullData,X,"next",x);e&&(Ie(),V(e))},tabBack:()=>{B("prev"),L($);const e=O(Z.fullData,X,"prev",x);e&&(Ie(),V(e))}}},Ye={canEditKey:Fe,isEditingKey:_e,pathString:$,path:X,name:J,arrayIndexFromOne:w,handleKeyboard:N,handleEditKey:re,handleCancel:Ve,styles:I("property",Z),getNextOrPrevious:e=>O(Z.fullData,X,e,x),emptyStringKey:oe},He=We?t(we,Object.assign({},n,{value:H,customNodeProps:De,setValue:Ee,handleEdit:Ie,handleCancel:Ve,handleKeyPress:e=>N(e,{stringConfirm:Ie,cancel:Ve}),isEditing:Re,setIsEditing:()=>V(X),getStyles:I,originalNode:Ne?ye(r,Ge):void 0,originalNodeKey:Ne?t(ge,Object.assign({},Ye)):void 0,canEdit:Q,keyboardCommon:Ge.keyboardCommon,onError:ne})):ye(r,Ge);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:null!==o?D/2+"em":0,position:"relative"},draggable:ee},se,pe("above"),{children:[me,t(be,{position:"above",nodeData:Z}),e("div",{className:"jer-value-main-row",style:{flexWrap:J.length>10?"wrap":"nowrap"},children:[Be&&t(ge,Object.assign({},Ye)),e("div",{className:"jer-value-and-buttons",children:[t("div",{className:"jer-input-component",children:He}),Re?t(le,{onOk:Ie,onCancel:Ve,nodeData:Z,editConfirmRef:A}):Me&&t(ae,{startEdit:Q?()=>{Y(G),V(X,Ve)}:void 0,handleDelete:q?()=>{d(H,X).then((e=>{e&&ne({code:"DELETE_ERROR",message:e},H)}))}:void 0,enableClipboard:g,translate:C,customButtons:n.customButtons,nodeData:Z,handleKeyboard:N,keyboardControls:T,editConfirmRef:A,jsonStringify:P,showIconTooltips:R}),ze&&e("div",{className:"jer-select jer-select-types",children:[t("select",{name:`${J}-type-select`,className:"jer-select-inner",onChange:e=>(e=>{const t=k.find((t=>t.name===e));if(t)return a(t.defaultValue,X),je(e),Pe(null),V(null),void _({path:X,collapsed:!1,includeChildren:!1});const n=xe.find((t=>t instanceof Object&&t.enum===e));if(n)return"string"==typeof H&&n.values.includes(H)||a(n.values[0],X).then((e=>{e&&(ne({code:"UPDATE_ERROR",message:e},r),V(null))})),void Pe(n);const r=fe(H,e,C("DEFAULT_NEW_KEY",Z),(null==S?void 0:S.CustomNode)?C("DEFAULT_STRING",Z):void 0);["string","number","boolean"].includes(e)||V(null),a(r,X).then((e=>{e?(ne({code:"UPDATE_ERROR",message:e},r),V(null)):Pe(null)}))})(e.target.value),value:Ae?Ae.enum:ve,children:xe.map((e=>e instanceof Object&&"enum"in e?t("option",{value:e.enum,children:e.enum},e.enum):t("option",{value:e,children:e},e)))}),t("span",{className:"focus"})]}),Le&&t("span",{className:"jer-error-slug",style:I("error",Z),children:te})]})]}),t(be,{position:"below",nodeData:Z})]}))},he=(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",ye=(e,n)=>{const r=he(e),{value:o}=n;switch(r){case"string":return t(H,Object.assign({},n,{value:o}));case"number":return t(U,Object.assign({},n,{value:o}));case"boolean":return t($,Object.assign({},n,{value:o}));case"null":return t(X,Object.assign({},n));default:return t(J,Object.assign({},n))}},fe=(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)}},be=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[0],{element:o,wrapperElement:i,customNodeProps:a,wrapperProps:l,hideKey:s=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:g=!0}=r,m=p(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:i,customNodeProps:a,wrapperProps:l,hideKey:s,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:g},m)},ve=r=>{const{getStyles:o}=K(),{collapseState:c,setCollapseState:d,getMatchingCollapseState:u,currentlyEditingElement:p,setCurrentlyEditingElement:f,areChildrenBeingEdited:b,previousValue:v,setPreviousValue:j}=M(),{mainContainerRef:w,data:D,nodeData:C,parentData:k,showCollectionCount:S,onEdit:T,onAdd:x,onDelete:A,canDragOnto:P,collapseFilter:R,collapseAnimationTime:I,onMove:V,enableClipboard:_,onEditEvent:F,showIconTooltips:L,searchFilter:z,searchText:B,indent:W,sort:G,showArrayIndices:Y,arrayIndexFromOne:H,defaultValue:U,newKeyOptions:$,translate:Z,customNodeDefinitions:X,customNodeData:J,jsonParse:Q,jsonStringify:q,TextEditor:ee,keyboardControls:te,handleKeyboard:ne,insertAtTop:re,onCollapse:oe,editConfirmRef:se,collapseClickZones:ce}=r,[he,ye]=i(q(D)),fe=R(C),{contentRef:je,isAnimating:Ee,maxHeight:we,collapsed:De,animateCollapse:Ce,cssTransitionValue:Oe}=((e,t,n,r,o)=>{const[l,c]=i(n?0:void 0),[d,u]=i(n),p=a(!1),g=a(null),m=a(0),h=a(0),y=t/1e3+"s",f=s((n=>{var i,a;if(d!==n){switch(window.clearTimeout(h.current),p.current=!0,n){case!0:{const e=null!==(a=null===(i=g.current)||void 0===i?void 0:i.offsetHeight)&&void 0!==a?a:0;m.current=e,c(e),setTimeout((()=>{c(0)}),5);break}case!1:c(m.current||pe(e,g,r,o))}u(!d),h.current=window.setTimeout((()=>{p.current=!1,n||c(void 0)}),t)}}),[t,d,e,r,o]);return{contentRef:g,isAnimating:p.current,animateCollapse:f,maxHeight:l,collapsed:d,cssTransitionValue:y}})(D,I,fe,w,q),{pathString:ke,nodeData:Se,path:Ne,name:Te,size:xe,canEdit:Ae,canDelete:Pe,canAdd:Re,canDrag:Ke,error:Ie,setError:Ve,onError:_e,handleEditKey:Fe,emptyStringKey:Le,derivedValues:ze}=de({props:r,collapsed:De}),{dragSourceProps:Me,getDropTargetProps:Be,BottomDropTarget:We,DropTargetPadding:Ge}=ue({canDrag:Ke,canDragOnto:P,path:Ne,nodeData:Se,onMove:V,onError:_e,translate:Z}),Ye=a(!fe),{isEditing:He,isEditingKey:Ue,isArray:$e,canEditKey:Ze}=ze;l((()=>{ye(q(D))}),[D,q]),l((()=>{const e=R(Se)&&!He;Ye.current=!e,Ce(e)}),[R]),l((()=>{if(null!==c){const e=u(Ne);e&&(Ye.current=!0,Ce(e.collapsed))}}),[c]);const Xe=a(null),Je=s(((e,t)=>{if("function"!=typeof U)return U;const n=U(e,t);return void 0!==n?n:null}),[U]),Qe=s((e=>$?"function"!=typeof $?$:$(e):null),[$]),{CustomNode:qe,customNodeProps:et,CustomWrapper:tt,wrapperProps:nt={},hideKey:rt,showEditTools:ot=!0,showOnEdit:it,showOnView:at,showCollectionWrapper:lt=!0}=J,st=b(ke);st&&De&&Ce(!1);if(!(y("collection",Se,z,B)||0===Se.level)&&!st)return null;const ct=Array.isArray(D)?"array":"object",dt="array"===ct?{open:"[",close:"]"}:{open:"{",close:"}"},ut=e=>{if("Tab"!==e.key||e.getModifierState("Shift"))ne(e,{objectConfirm:gt,cancel:ht});else{e.preventDefault();const t=N(Xe,"\t");ye(t)}},pt=e=>{e.stopPropagation();const t=E(e);if(t&&te.collapseModifier.includes(t))return Ye.current=!0,void d({collapsed:!De,path:Ne,includeChildren:!0});p&&p.includes(ke)||(Ye.current=!0,d(null),oe&&oe({path:Ne,collapsed:!De,includeChildren:!1}),Ce(!De))},gt=()=>{try{const e=Q(he);if(f(null),j(null),Ve(null),q(e)===q(D))return;T(e,Ne).then((t=>{t&&_e({code:"UPDATE_ERROR",message:t},e)}))}catch(e){_e({code:"INVALID_JSON",message:Z("ERROR_INVALID_JSON",Se)},he)}},mt=Ne.length>0?()=>{A(D,Ne).then((e=>{e&&_e({code:"DELETE_ERROR",message:e},D)}))}:void 0,ht=()=>{f(null),null===v?(Ve(null),ye(q(D)),j(null)):T(v,Ne)},yt="when-closed"===S?De:S,ft=!He&&ot,bt=(Y||!$e)&&!rt&&void 0!==Te,vt=qe&&(He&&it||!He&&at),jt=Object.entries(D).map((([e,t])=>["array"===ct?Number(e):e,t]));"object"===ct&&G(jt,(e=>e));const Et=Ye.current?He?e("div",{className:"jer-collection-text-edit",children:[ee?t(ee,{value:he,onChange:ye,onKeyDown:e=>ne(e,{objectConfirm:gt,cancel:ht})}):t(m,{textAreaRef:Xe,className:"jer-collection-text-area",name:ke,value:he,setValue:ye,handleKeyPress:ut,styles:o("input",Se)}),t("div",{className:"jer-collection-input-button-row",children:t(le,{onOk:gt,onCancel:ht,nodeData:Se,editConfirmRef:se})})]}):jt.map((([e,n],i)=>{const a={key:e,value:n,path:[...Ne,e],level:Ne.length+1,index:i,size:h(n)?Object.keys(n).length:null,parentData:D,fullData:Se.fullData},l=be(X,a);return t("div",{className:"jer-collection-element",style:o("collectionElement",a),children:h(n)&&!(null==l?void 0:l.renderCollectionAsValue)?t(ve,Object.assign({},r,{data:n,parentData:D,nodeData:a,showCollectionCount:S,canDragOnto:Ae,customNodeData:l}),e):t(me,Object.assign({},r,{data:n,parentData:D,nodeData:a,canDragOnto:Ae,showLabel:"object"===ct||Y,customNodeData:l}),e)},e)})):null,wt=!!lt&&(De&&!st);wt||(Ye.current=!0);const Dt=Object.assign(Object.assign({},r),{data:D,value:D,parentData:k,nodeData:Se,setValue:e=>g(void 0,void 0,void 0,(function*(){return yield T(e,Ne)})),handleEdit:gt,handleCancel:ht,handleKeyPress:ut,isEditing:He,setIsEditing:()=>f(Ne),getStyles:o,canDragOnto:Ae,canEdit:Ae,keyboardCommon:{},onError:_e}),Ct=vt?t(qe,Object.assign({customNodeProps:et},Dt,{children:Et})):Et,Ot=ft&&t(ae,{startEdit:Ae?()=>{Ye.current=!0,j(null),f(Ne)}:void 0,handleAdd:Re?e=>{Ce(!1);const t=Je(Se,e);if("array"===ct){const e=re.array?0:D.length,n=re.array?{insert:!0}:{};x(t,[...Ne,e],n).then((e=>{e&&_e({code:"ADD_ERROR",message:e},t)}))}else if(e in D)_e({code:"KEY_EXISTS",message:Z("ERROR_KEY_EXISTS",Se)},e);else{const n=re.object?{insertBefore:0}:{};x(t,[...Ne,e],n).then((e=>{e&&_e({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:Pe?mt:void 0,enableClipboard:_,type:ct,nodeData:Se,translate:Z,customButtons:r.customButtons,keyboardControls:te,handleKeyboard:ne,getNewKeyOptions:Qe,editConfirmRef:se,jsonStringify:q,onEditEvent:F,showIconTooltips:L}),kt={canEditKey:Ze,isEditingKey:Ue,pathString:ke,path:Ne,name:Te,arrayIndexFromOne:H,handleKeyboard:ne,handleEditKey:Fe,handleCancel:ht,keyValueArray:jt,styles:o("property",Se),getNextOrPrevious:e=>O(Se.fullData,Ne,e,G),handleClick:ce.includes("property")?pt:e=>e.stopPropagation(),emptyStringKey:Le},St=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===Ne.length?0:W/2)+"em"},o("collection",Se)),{position:"relative"}),draggable:Ke},Me,Be("above"),{children:[t("div",{className:"jer-clickzone",style:{width:W/2+1+"em",zIndex:10+2*Se.level},onClick:ce.includes("left")?pt:void 0}),!He&&We,t(Ge,{position:"above",nodeData:Se}),lt?e("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:ce.includes("header")?pt:void 0,children:[e("div",{className:"jer-collection-name",children:[t("div",{className:"jer-collapse-icon jer-accordion-icon"+(De?" jer-rotate-90":""),style:{zIndex:11+2*Se.level,transition:Oe},onClick:pt,children:t(ie,{name:"chevron",rotate:De,nodeData:Se})}),bt&&t(ge,Object.assign({},kt)),!He&&t("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",Se),children:dt.open})]}),!He&&yt&&t("div",{className:"jer-collection-item-count"+(yt?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},o("itemCount",Se)),{transition:Oe}),children:1===xe?Z("ITEM_SINGLE",Object.assign(Object.assign({},Se),{size:1}),1):Z("ITEMS_MULTIPLE",Se,xe)}),t("div",{className:"jer-brackets"+(wt?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},o("bracket",Se)),{transition:Oe}),children:dt.close}),Ot]}):rt?t(n,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[t(ge,Object.assign({},kt)),Ot]}),e("div",{className:"jer-collection-inner",style:Object.assign(Object.assign({overflowY:wt||Ee?"clip":"visible",maxHeight:st?void 0:we},o("collectionInner",Se)),{transition:Oe}),ref:je,children:[Ct,t("div",{className:He?"jer-collection-error-row":"jer-collection-error-row-edit",children:Ie&&t("span",{className:"jer-error-slug",style:o("error",Se),children:Ie})}),!He&<&&t("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},o("bracket",Se)),{marginLeft:(W<3?-1:W<6?-.5:0)+"em"}),children:dt.close})]}),t(Ge,{position:"below",nodeData:Se})]}));return tt?t(tt,Object.assign({customNodeProps:nt},Dt,{children:St})):St},je={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",KEY_SELECT:"Select key",NO_KEY_OPTIONS:"No key options",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",SHOW_LESS:"(Show less)",EMPTY_STRING:"<empty string>",TOOLTIP_COPY:"Copy to clipboard",TOOLTIP_EDIT:"Edit",TOOLTIP_DELETE:"Delete",TOOLTIP_ADD:"Add"},Ee=(e,t)=>(n,r,o)=>((e,t,n,r,o)=>{if(t[r]){const e=t[r](n);if(null!==e)return e}const i=r in e?e[r]:je[r];return void 0===o?i:null==i?void 0:i.replace("{{count}}",String(o))})(e,t,r,n,o);var we=[],De=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,i="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var a=we.indexOf(i);-1===a&&(a=we.push(i)-1,De[a]={}),n=De[a]&&De[a][r]?De[a][r]:De[a][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 a="prepend"===r?"afterbegin":"beforeend";return i.insertAdjacentElement(a,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-highlight-color:#b3d8ff}.jer-visible{opacity:1}.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-select-inner{text-overflow:ellipsis;width:100%}.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}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em;line-height:1.1em}.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;width:100%}.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;word-break:break-word}.jer-string-expansion{cursor:pointer;filter:saturate(50%);opacity:.6}.jer-show-less{font-size:80%}.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:.3s}.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-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-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 Ce=({data:e,setData:n,rootName:r="root",onUpdate:o=()=>{},onEdit:d=o,onDelete:u=o,onAdd:p=o,onChange:m,onError:y,onEditEvent:f,showErrorMessages:b=!0,enableClipboard:v=!0,indent:E=2,collapse:D=!1,collapseAnimationTime:O=300,showCollectionCount:k=!0,restrictEdit:S=!1,restrictDelete:N=!1,restrictAdd:x=!1,restrictTypeSelection:A=!1,restrictDrag:P=!0,viewOnly:R,searchFilter:I,searchText:V,searchDebounceTime:_=350,keySort:F=!1,showArrayIndices:L=!0,arrayIndexFromOne:z=!1,showStringQuotes:B=!0,showIconTooltips:W=!1,defaultValue:G=null,newKeyOptions:Y,minWidth:H=250,maxWidth:U="min(600px, 90vw)",rootFontSize:$,stringTruncate:Z=250,translations:X={},className:J,id:Q,customText:q={},customNodeDefinitions:ee=[],customButtons:te=[],jsonParse:ne=JSON.parse,jsonStringify:re=(e,t)=>JSON.stringify(e,t,2),TextEditor:oe,errorMessageTimeout:ie=2500,keyboardControls:ae={},externalTriggers:le,insertAtTop:se=!1,onCollapse:ce,collapseClickZones:de=["header","left"]})=>{const{getStyles:ue}=K(),{setCurrentlyEditingElement:pe}=M(),ge=c((()=>Se(D)),[D]),he=c((()=>Ee(X,q)),[X,q]),[ye,fe]=i(V),[je,we]=(({setData:e,data:t})=>{const[n,r]=i(e?void 0:t),o=s((t=>{e?e(t):r(t)}),[e]);return l((()=>{e||r(t)}),[t]),[e?t:n,o]})({setData:n,data:e}),De=a(null);l((()=>{pe(null);const e=setTimeout((()=>fe(V)),_);return()=>clearTimeout(e)}),[V,_]);const Ce={key:r,path:[],level:0,index:0,value:je,size:"object"==typeof je&&null!==je?Object.keys(je).length:1,parentData:null,fullData:je},Oe=(e,t)=>g(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void we(t.newData);const r=Te(n)?n:["error",n],[o,i]=r;if("error"===o)return we(t.currentData),!1===i?he("ERROR_UPDATE",Ce):String(i);we(i)})),Ae=c((()=>Se(S,R)),[S,R]),Pe=c((()=>Se(N,R)),[N,R]),Re=c((()=>Se(x,R)),[x,R]),Ke=c((()=>Se(P,R)),[P,R]),Ie=c((()=>Ne(I)),[I]),Ve=c((()=>(e=>{const t=Object.assign({},C);for(const n of Object.keys(C)){const r=n;if(e[r]){const o=e[r],i=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(o)?o:[o]:"string"==typeof o?{key:o}:o;t[r]=i,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})(ae)),[ae]),_e=s(((e,t)=>((e,t,n)=>{const r=Object.entries(t);for(const[t,o]of r)if(w(n,e[t],t)){n.preventDefault(),o();break}})(Ve,t,e)),[Ve]),Fe=c((()=>{const e=xe(ee,"stringifyReplacer");return t=>re(t,e)}),[ee,re]),Le=c((()=>{const e=xe(ee,"parseReviver");return t=>{const n=ne(t,e);return T(n)}}),[ee,ne]),ze=a(null);((e,t)=>{const{setCurrentlyEditingElement:n,currentlyEditingElement:r,setCollapseState:o}=M();l((()=>{if(!e)return;const{collapse:i,edit:a}=e;i&&o(i);const l=!(null==a?void 0:a.path)||j(a.path)===r;switch(null==a?void 0:a.action){case"accept":l&&(t.current&&t.current.click(),n(null));break;case"cancel":l&&n(null);break;default:(null==a?void 0:a.path)&&n(a.path)}}),[e])})(le,ze);const Me=s(((e,t)=>{!1!==F&&("function"!=typeof F?e.sort(((e,n)=>{const r=t(e)[0],o=t(n)[0];return r<o?-1:r>o?1:0})):e.sort(((e,n)=>F(t(e),t(n)))))}),[F]),Be=be(ee,Ce),We={mainContainerRef:De,name:r,nodeData:Ce,onEdit:(e,t)=>g(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:i}=ke(je,t,e,"update");if(o!==i)return yield Oe(d,{currentData:n,newData:r,currentValue:o,newValue:i,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>g(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:i}=ke(je,t,e,"delete");return yield Oe(u,{currentData:n,newData:r,currentValue:o,newValue:i,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>g(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:i,newValue:a}=ke(je,t,e,"add",n);return yield Oe(p,{currentData:r,newData:o,currentValue:i,newValue:a,name:t.slice(-1)[0],path:t})})),onChange:m,onError:y,onEditEvent:f,showErrorMessages:b,onMove:(e,t,n)=>g(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:i}=ke(je,e,"","delete"),a=e.slice(-1)[0],l=t.slice(0,-1),s=t.slice(-1)[0];let c="number"==typeof s?"above"===n?s:s+1:"number"==typeof a?`arr_${a}`:a;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof a&&"number"==typeof c&&a<c&&(c-=1);const u="number"==typeof c?{insert:!0}:"above"===n?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=ke(o,[...l,c],i,"add",u);return yield Oe(d,{currentData:r,newData:p,currentValue:i,newValue:g,name:t.slice(-1)[0],path:t})})),showCollectionCount:k,collapseFilter:ge,collapseAnimationTime:O,restrictEditFilter:Ae,restrictDeleteFilter:Pe,restrictAddFilter:Re,restrictTypeSelection:A,restrictDragFilter:Ke,canDragOnto:!1,searchFilter:Ie,searchText:ye,enableClipboard:v,keySort:F,sort:Me,showArrayIndices:L,arrayIndexFromOne:z,showStringQuotes:B,showIconTooltips:W,indent:E,defaultValue:G,newKeyOptions:Y,stringTruncate:Z,translate:he,customNodeDefinitions:ee,customNodeData:Be,customButtons:te,parentData:null,jsonParse:Le,jsonStringify:Fe,TextEditor:oe,errorMessageTimeout:ie,handleKeyboard:_e,keyboardControls:Ve,insertAtTop:{object:!0===se||"object"===se,array:!0===se||"array"===se},onCollapse:ce,editConfirmRef:ze,collapseClickZones:de},Ge=Object.assign(Object.assign({},ue("container",Ce)),{minWidth:H,maxWidth:U});return Ge.fontSize=null!=$?$:Ge.fontSize,t("div",{id:Q,ref:De,className:`jer-editor-container ${null!=J?J:""}`,style:Ge,children:h(je)&&!Be.renderCollectionAsValue?t(ve,Object.assign({data:je},We)):t(me,Object.assign({data:je,showLabel:!0},We))})},Oe=e=>{var n;const[r,o]=i();return l((()=>{const e=document.documentElement;o(e)}),[]),r?t(R,{theme:null!==(n=e.theme)&&void 0!==n?n:A,icons:e.icons,docRoot:r,children:t(z,{onEditEvent:e.onEditEvent,onCollapse:e.onCollapse,children:t(Ce,Object.assign({},e))})}):null},ke=(e,t,n,r,o={})=>{if(0===t.length)return{currentData:e,newData:n,currentValue:e,newValue:n};const i=Object.assign({remove:"delete"===r},o),a="add"!==r?u(e,t):void 0;return{currentData:e,newData:d(e,t,n,i),currentValue:a,newValue:"delete"!==r?n:void 0}},Se=(e,t)=>t?()=>!0:"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,Ne=e=>{if(void 0!==e)return"value"===e?b:"key"===e?v:"all"===e?(e,t)=>b(e,t)||v(e,t):e},Te=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),xe=(e,t)=>{const n="stringifyReplacer"===t?[e=>void 0===e?x:e]:[];if(n.push(...e.map((e=>e[t])).filter((e=>!!e))),0!==n.length)return(e,t)=>{let r=t;for(const e of n)r=e(r);return r}},Ae=e=>{var n;const{value:r,setIsEditing:o,getStyles:i,nodeData:a}=e,l=i("string",a);return t("div",{onDoubleClick:()=>o(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&o(!0)},className:"jer-value-string jer-hyperlink",style:l,children:t("a",{href:r,target:"_blank",rel:"noreferrer",style:{color:null!==(n=l.color)&&void 0!==n?n:void 0},children:t(G,Object.assign({},e,{pathString:j(a.path),styles:l,value:a.value}))})})},Pe={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:Ae,showOnView:!0,showOnEdit:!1},Re={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)"}},Ke={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"}},Ie={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"}},Ve={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"}},_e={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"}},Fe={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{Q as IconAdd,re as IconCancel,oe as IconChevron,te as IconCopy,ee as IconDelete,q as IconEdit,ne as IconOk,Oe as JsonEditor,Ae as LinkCustomComponent,Pe as LinkCustomNodeDefinition,G as StringDisplay,Y as StringEdit,_e as candyWrapperTheme,A as defaultTheme,Re as githubDarkTheme,Ke as githubLightTheme,h as isCollection,b as matchNode,v as matchNodeKey,Ie as monoDarkTheme,Ve as monoLightTheme,Fe as psychedelicTheme,ce as standardDataTypes,j as toPathString,Z as useKeyboardListener};
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{createContext as r,useContext as o,useState as i,useRef as a,useEffect as l,useCallback as s,useMemo 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){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}function g(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function l(e){try{s(r.throw(e))}catch(e){i(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(a,l)}s((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const m=({className:n,name:r,value:o,setValue:i,handleKeyPress:a,styles:l,textAreaRef:s})=>{if("string"!=typeof o)return null;const c="\n"===o.slice(-1)?o+".":o;return e("div",{style:{display:"grid"},children:[t("textarea",{id:`${r}_textarea`,ref:s,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=>i(e.target.value),autoFocus:!0,onFocus:e=>{o.length<40&&e.target.select()},onKeyDown:a}),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:c})]})},h=e=>null!==e&&"object"==typeof e,y=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!f(r,t,n))return!1}if(!n&&r&&!f(r,t))return!1;break;case"value":if(n&&!n(t,r))return!1;if(!n&&r&&!b(t,r))return!1}return!0},f=(e="",t,n=b)=>{const r=t.value;return Object.entries(r).some((([o,i])=>{const a=[...t.path,o],l=Object.assign(Object.assign({},t),{key:o,path:a,level:t.level+1,value:i,size:a.length,parentData:r});return h(i)?f(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}},v=({key:e,path:t},n="")=>!!b({value:e},n)||!!t.some((e=>b({value:e},n))),j=(e,t)=>(null!=t?t:"")+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,w=(e,t,n)=>{const r=e.key,o=E(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:i,modifier:a}=t;return("stringLineBreak"!==n||"Enter"!==r||"Shift"!==o||"Enter"!==i||!(null==a?void 0:a.includes("Shift")))&&(r===i&&(a===o||Array.isArray(a)&&a.includes(o)))},D={key:"Enter"},C={confirm:D,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},D),{modifier:["Meta","Shift","Control"]}),objectLineBreak:D,stringConfirm:D,stringLineBreak:Object.assign(Object.assign({},D),{modifier:["Shift"]}),numberConfirm:D,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:D,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},O=(e,t,n="next",r)=>{const o=t.slice(0,t.length-1),i=t.slice(-1)[0];if(void 0===i)return null;const a=u(e,o),l=S(a);Array.isArray(a)||r(l,(({key:e,value:t})=>[e,t]));const s=l.findIndex((e=>e.key===i)),c=l[s+("next"===n?1:-1)];return c?h(c.value)?0===Object.keys(c.value).length?O(e,[...o,c.key],n,r):k(e,[...o,c.key],n,r):[...o,c.key]:0===o.length?null:O(e,o,n,r)},k=(e,t,n="next",r)=>{const o=u(e,t);if(!h(o))return t;const i=Array.isArray(o)?o.map(((e,t)=>t)):Object.keys(o);r(i,(e=>[e,o]));const a="next"===n?i[0]:i[i.length-1];return k(e,[...t,a],n,r)},S=e=>Array.isArray(e)?e.map(((e,t)=>({index:t,value:e,key:t}))):Object.entries(e).map((([e,t],n)=>({key:e,value:t,index:n}))),N=(e,t)=>{var n,r,o,i;const a=e.current,l=null!==(n=null==a?void 0:a.selectionStart)&&void 0!==n?n:1/0,s=null!==(r=null==a?void 0:a.selectionEnd)&&void 0!==r?r:1/0,c=(null===(o=null==a?void 0:a.textContent)||void 0===o?void 0:o.slice(0,l))+t+(null===(i=null==a?void 0:a.textContent)||void 0===i?void 0:i.slice(s));return a.value=c,null==a||a.setSelectionRange(l+1,l+1),c},T=e=>{if(e!==x){if(Array.isArray(e))return e.map((e=>T(e)));if(e&&"object"==typeof e)for(const t in e)e[t]=T(e[t]);return e}},x="__undefined__",A={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)"}},P=r({getStyles:()=>({}),icons:{}}),R=({theme:e=A,icons:n={},docRoot:r,children:o})=>{const i=I(e,r);return t(P.Provider,{value:{getStyles:(e,t)=>"function"==typeof i[e]?i[e](t):i[e],icons:n},children:o})},K=()=>o(P),I=(e,t)=>{var n,r,o,i;const a={},l=(Array.isArray(e)?e:[e]).map((e=>_(e)?V({fragments:{},styles:e},a):V(e,a))),s=V(A,{});Object.keys(s).forEach((e=>{const t=e;l.forEach((e=>{e[t]&&(s[t]=Object.assign(Object.assign({},s[t]),e[t]))}))}));const c=Object.assign({},s);return Object.entries(a).forEach((([e,t])=>{const n=e;c[n]=e=>{const r=t(e)||{};return Object.assign(Object.assign({},s[n]),r)}})),"function"!=typeof(null==c?void 0:c.inputHighlight)&&(null===(n=null==c?void 0:c.inputHighlight)||void 0===n?void 0:n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",null===(r=null==c?void 0:c.inputHighlight)||void 0===r?void 0:r.backgroundColor),"function"!=typeof(null==c?void 0:c.iconCopy)&&(null===(o=null==c?void 0:c.iconCopy)||void 0===o?void 0:o.color)&&t.style.setProperty("--jer-icon-copy-color",null===(i=null==c?void 0:c.iconCopy)||void 0===i?void 0:i.color),c},V=(e,t)=>{const{fragments:n,styles:r}=e,o={};return Object.entries(r).forEach((([e,r])=>{const i=(Array.isArray(r)?r:[r]).reduce(((r,o)=>{var i,a;if("function"==typeof o)return t[e]=o,Object.assign({},r);if("string"==typeof o){const t=null!==(i=null==n?void 0:n[o])&&void 0!==i?i:o;return"string"==typeof t?Object.assign(Object.assign({},r),{[null!==(a=F[e])&&void 0!==a?a:"color"]:t}):Object.assign(Object.assign({},r),t)}return Object.assign(Object.assign({},r),o)}),{});o[e]=i})),o},_=e=>!("styles"in e),F={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},L=r(null),z=({children:e,onEditEvent:n,onCollapse:r})=>{const[o,l]=i(null),[s,c]=i(null),[d,u]=i(null),[p,g]=i({path:null,pathString:null}),m=a(null),h=a("next"),y=a(null);return t(L.Provider,{value:{collapseState:o,setCollapseState:e=>{l(e),r&&null!==e&&(Array.isArray(e)?e.forEach((e=>r(e))):r(e)),null!==e&&setTimeout((()=>l(null)),2e3)},getMatchingCollapseState:e=>{if(Array.isArray(o)){for(const t of o)if(B(e,t))return t;return null}return B(e,o)?o:null},currentlyEditingElement:s,setCurrentlyEditingElement:(e,t)=>{const r="string"==typeof e||null===e?e:j(e,"key"===t?"key_":void 0);null!==s&&null!==r&&null!==m.current&&m.current(),c(r),n&&(Array.isArray(e)||null===e)&&n(e,"key"===t),m.current="function"==typeof t?t:null},areChildrenBeingEdited:e=>null!==s&&s.includes(e),previouslyEditedElement:y.current,setPreviouslyEditedElement:e=>{y.current=e},tabDirection:h.current,setTabDirection:e=>{h.current=e},previousValue:d,setPreviousValue:u,dragSource:p,setDragSource:g},children:e})},M=()=>{const e=o(L);if(!e)throw new Error("Missing Context Provider");return e},B=(e,t)=>{if(null===t)return!1;if(!t.includeChildren)return t.path.every(((t,n)=>e[n]===t))&&t.path.length===e.length;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},W="**INVALID_FUNCTION**",G=({nodeData:r,showStringQuotes:o=!0,stringTruncate:a=200,pathString:l,canEdit:s,setIsEditing:c,styles:d,translate:u,value:p,TextWrapper:g=({children:e})=>e})=>{const m=null!=p?p:r.value,[h,y]=i(!1),f=o?'"':"",b=m.length>a,v=()=>{s?c(!0):y(!h)};return e("div",{id:`${l}_display`,onDoubleClick:v,onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&v()},className:"jer-value-string",style:d,children:[f,b?e(n,h?{children:[t(g,{children:e("span",{children:[m,f]})}),e("span",{className:"jer-string-expansion jer-show-less",onClick:()=>y(!1),children:[" ",u("SHOW_LESS",r)]})]}:{children:[e(g,{children:[t("span",{children:m.slice(0,a-2).trimEnd()})," "]}),t("span",{className:"jer-string-expansion jer-ellipsis",onClick:()=>y(!0),children:"..."}),f]}):t(g,{children:`${m}${f}`})]})},Y=({styles:e,pathString:n,value:r,setValue:o,handleEdit:i,handleKeyboard:l,keyboardCommon:s})=>{const c=a(null);return t(m,{className:"jer-input-text",textAreaRef:c,name:n,value:r,setValue:o,handleKeyPress:e=>{l(e,Object.assign({stringConfirm:i,stringLineBreak:()=>{const e=N(c,"\n");o(e)}},s))},styles:e})},H=n=>{var{isEditing:r,path:o,enumType:i}=n,a=p(n,["isEditing","path","enumType"]);const{getStyles:l}=K(),s=j(o),{value:c,setValue:d,nodeData:u,handleEdit:g,handleKeyboard:m,keyboardCommon:h}=a;return r&&i?e("div",{className:"jer-select jer-select-enums",children:[t("select",{name:`${s}-value-select`,className:"jer-select-inner",onChange:e=>d(e.target.value),value:c,autoFocus:!0,onKeyDown:e=>{m(e,Object.assign({stringConfirm:g},h))},children:i.values.map((e=>t("option",{value:e,children:e},e)))}),t("span",{className:"focus"})]}):r?t(Y,Object.assign({styles:l("input",u),pathString:s},a,{setValue:a.setValue})):t(G,Object.assign({pathString:s,styles:l("string",u)},a))},U=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:i,handleEdit:a,nodeData:l,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=K();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=>setTimeout((()=>e.target.select()),10),onKeyDown:t=>s(t,Object.assign({numberConfirm:a,numberUp:()=>n(Number(e)+1),numberDown:()=>n(Number(e)-1)},c)),style:Object.assign({width:String(e).length/1.5+2+"em"},d("input",l))}):t("span",{onDoubleClick:()=>i(!0),className:"jer-value-number",style:d("number",l),children:e})},$=({value:e,setValue:n,isEditing:r,path:o,setIsEditing:i,handleEdit:a,nodeData:l,handleKeyboard:s,keyboardCommon:c})=>{const{getStyles:d}=K();return"boolean"!=typeof e?null:r?t("input",{className:"jer-input-boolean",type:"checkbox",name:j(o),checked:e,onChange:()=>n(!e),onKeyDown:t=>{" "===t.key&&t.preventDefault(),s(t,Object.assign({booleanConfirm:a,booleanToggle:()=>n(!e)},c))},autoFocus:!0}):t("span",{onDoubleClick:()=>i(!0),className:"jer-value-boolean",style:d("boolean",l),children:String(e)})},Z=(e,t)=>{const n=a(void 0),r=a(t);l((()=>{r.current=t}),[t]);const o=e=>{r.current(e)};l((()=>{if(window.clearTimeout(n.current),e)return n.current=window.setTimeout((()=>{window.addEventListener("keydown",o)}),100),()=>{window.clearTimeout(n.current),window.removeEventListener("keydown",o)}}),[e])},X=({value:e,isEditing:n,setIsEditing:r,handleEdit:o,nodeData:i,handleKeyboard:a,keyboardCommon:l})=>{const{getStyles:s}=K();return Z(n,(e=>a(e,Object.assign({confirm:o},l)))),t("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:s("null",i),children:String(e)})},J=({value:e})=>{let n="Error!";switch(typeof e){case"string":e===W&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return t("span",{className:"jer-value-invalid",children:n})},Q=({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"})]}),q=({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"})]}),ee=({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"})}),te=({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"})]}),ne=({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"})]}),re=({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"})}),oe=({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"})}),ie=({name:e,nodeData:r})=>{var o,i,a,l,s,c,d;const{getStyles:u,icons:p}=K(),g={size:"1.4em",className:"jer-icon"};switch(e){case"add":return null!==(o=null==p?void 0:p.add)&&void 0!==o?o:t(Q,Object.assign({},g,{style:u("iconAdd",r)}));case"edit":return null!==(i=null==p?void 0:p.edit)&&void 0!==i?i:t(q,Object.assign({},g,{style:u("iconEdit",r)}));case"delete":return null!==(a=null==p?void 0:p.delete)&&void 0!==a?a:t(ee,Object.assign({},g,{style:u("iconDelete",r),size:"1.45em"}));case"copy":return null!==(l=null==p?void 0:p.copy)&&void 0!==l?l:t(te,Object.assign({},g,{style:u("iconCopy",r),size:"1.2em"}));case"ok":return null!==(s=null==p?void 0:p.ok)&&void 0!==s?s:t(ne,Object.assign({},g,{style:Object.assign({fontSize:"90%"},u("iconOk",r))}));case"cancel":return null!==(c=null==p?void 0:p.cancel)&&void 0!==c?c:t(re,Object.assign({},g,{style:Object.assign({fontSize:"130%"},u("iconCancel",r))}));case"chevron":return null!==(d=null==p?void 0:p.chevron)&&void 0!==d?d:t(oe,{size:"1em",style:u("iconCollection",r)});default:return t(n,{})}},ae=({startEdit:r,handleDelete:o,handleAdd:a,enableClipboard:l,type:s,customButtons:c,nodeData:d,translate:p,keyboardControls:g,handleKeyboard:m,editConfirmRef:h,getNewKeyOptions:y,jsonStringify:f,onEditEvent:b,showIconTooltips:v})=>{const{getStyles:j}=K(),w=p("KEY_NEW",d),[D,C]=i(w),[O,k]=i(!1),{key:S,path:N,value:T}=d,x=Array.isArray(O),A=e=>{var t;if(b&&b(e?[...N,null]:null,e),!e)return void k(!1);const n=Object.keys(u(d.fullData,N)),r=y?null===(t=y(d))||void 0===t?void 0:t.filter((e=>!n.includes(e))):null;r&&C(""),k(null==r||r)};return e("div",{className:"jer-edit-buttons",style:{opacity:O?1:void 0},onClick:e=>e.stopPropagation(),children:[l&&t("div",{onClick:e=>{var t;e.stopPropagation();let n,r,o="value",i="",a=null;if(l){const s=E(e);if(s&&g.clipboardModifier.includes(s)?(n=se(N),i=n,o="path"):(n=T,i="object"==typeof n?f(T):String(n)),!navigator.clipboard)return void("function"==typeof l&&l({success:!1,value:n,stringValue:i,path:N,key:S,type:o,errorMessage:"Can't access clipboard API"}));null===(t=navigator.clipboard)||void 0===t||t.writeText(i).then((()=>r=!0)).catch((e=>{r=!1,a=e.message})).finally((()=>{"function"==typeof l&&l({success:r,errorMessage:a,value:n,stringValue:i,path:N,key:S,type:o})}))}},className:"jer-copy-pulse",title:v?p("TOOLTIP_COPY",d):"",children:t(ie,{name:"copy",nodeData:d})}),r&&t("div",{onClick:r,title:v?p("TOOLTIP_EDIT",d):"",children:t(ie,{name:"edit",nodeData:d})}),o&&t("div",{onClick:o,title:v?p("TOOLTIP_DELETE",d):"",children:t(ie,{name:"delete",nodeData:d})}),a&&t("div",{onClick:()=>{"object"===s?A(!0):a("")},title:v?p("TOOLTIP_ADD",d):"",children:t(ie,{name:"add",nodeData:d})}),null==c?void 0:c.map((({Element:e,onClick:n},r)=>t("div",{onClick:e=>n&&n(d,e),children:t(e,{nodeData:d})},r))),O&&a&&"object"===s&&e(n,{children:[x?e("div",{className:"jer-select jer-select-keys",children:[e("select",{name:"new-key-select",className:"jer-select-inner",onChange:e=>{a(e.target.value),A(!1)},defaultValue:"",autoFocus:!0,onKeyDown:e=>{m(e,{cancel:()=>A(!1)})},children:[t("option",{value:"",disabled:!0,children:O.length>0?p("KEY_SELECT",d):p("NO_KEY_OPTIONS",d)}),O.map((e=>t("option",{value:e,children:e},e)))]}),t("span",{className:"focus"})]}):t("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:D,onChange:e=>C(e.target.value),autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>{m(e,{stringConfirm:()=>{a&&(A(!1),a(D),C(w))},cancel:()=>{A(!1),C(w)}})},style:j("input",d)}),t(le,{onOk:()=>{x&&!D||(A(!1),a(D))},onCancel:()=>{A(!1)},nodeData:d,editConfirmRef:h,hideOk:x})]})]})},le=({onOk:n,onCancel:r,nodeData:o,editConfirmRef:i,hideOk:a=!1})=>e("div",{className:"jer-confirm-buttons",children:[!a&&t("div",{onClick:n,ref:i,children:t(ie,{name:"ok",nodeData:o})}),t("div",{onClick:r,children:t(ie,{name:"cancel",nodeData:o})})]}),se=e=>e.reduce(((e,t)=>"number"==typeof t?`${e}[${t}]`:""===e?t:`${e}.${t}`),""),ce=["string","number","boolean","null","object","array"],de=({props:e,collapsed:t})=>{const{data:n,nodeData:r,parentData:o,onEdit:a,onError:l,showErrorMessages:c,restrictEditFilter:d,restrictDeleteFilter:u,restrictAddFilter:p,restrictDragFilter:g,translate:m,errorMessageTimeout:h}=e,{currentlyEditingElement:y,setCurrentlyEditingElement:f}=M(),[b,v]=i(null),E=Object.assign(Object.assign({},r),{collapsed:t}),{path:w,key:D,size:C}=E,O=j(w),k=!d(E),S=!u(E),N=!p(E),T=!g(E)&&S&&null===y,x=e=>{c&&(v(e),setTimeout((()=>v(null)),h)),console.warn("Error",e)},A=s(((e,t)=>{x(e.message),l&&l({currentData:E.fullData,errorValue:t,currentValue:n,name:D,path:w,error:e})}),[l,c]),P=y===O,R=y===`key_${O}`,K="number"==typeof w.slice(-1)[0],I={isEditing:P,isEditingKey:R,isArray:K,canEditKey:null!==o&&k&&N&&S&&!K},V=""===D&&w.length>0?m("EMPTY_STRING",E):null;return{pathString:O,nodeData:E,path:w,name:D,size:C,canEdit:k,canDelete:S,canAdd:N,canDrag:T,error:b,showError:x,onError:A,setError:v,handleEditKey:e=>{if(f(null),D===e)return;if(!o)return;const t=w.slice(0,-1);if(Object.keys(o).includes(e))return void A({code:"KEY_EXISTS",message:m("ERROR_KEY_EXISTS",E)},e);const n=Object.fromEntries(Object.entries(o).map((([t,n])=>t===D?[e,n]:[t,n])));a(n,t).then((t=>{t&&A({code:"UPDATE_ERROR",message:t},e)}))},derivedValues:I,emptyStringKey:V}},ue=({canDrag:e,canDragOnto:n,path:r,nodeData:o,onMove:a,onError:l,translate:s})=>{const{getStyles:d}=K(),{dragSource:u,setDragSource:p}=M(),[g,m]=i(!1),h=j(r),y=c((()=>e?{onDragStart:e=>{e.stopPropagation(),p({path:r,pathString:h})},onDragEnd:e=>{e.stopPropagation(),p({path:null,pathString:null})}}:{}),[e,h]),f=c((()=>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,h]),b=c((()=>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}},f("below"))):null),[u,n,r.length]),v=e=>{var t,n;const i=null===(t=u.path)||void 0===t?void 0:t.slice(-1)[0],c=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&&c!==d?l({code:"KEY_EXISTS",message:s("ERROR_KEY_EXISTS",o)},i):a(u.path,r,e).then((e=>{e&&l({code:"UPDATE_ERROR",message:e},o.value)}))};return{dragSourceProps:y,getDropTargetProps:f,BottomDropTarget:b,DropTargetPadding:({position:e,nodeData:n})=>g===e?t("div",{className:"jer-drag-n-drop-padding",style:d("dropZone",n)}):null,handleDrop:v}},pe=(e,t,n,r)=>{var o,i,a;if(!t.current)return 0;const l=parseInt(null!==(o=getComputedStyle(n.current).getPropertyValue("line-height"))&&void 0!==o?o:"16px"),s=(null!==(a=null===(i=t.current)||void 0===i?void 0:i.offsetWidth)&&void 0!==a?a:0)/(.5*l),c=r(e).replace(/\\n/g,"\n").split("\n").map((e=>Math.ceil(e.length/s))).reduce(((e,t)=>e+t),0)*l;return Math.min(c+30,window.innerHeight-50)},ge=({isEditingKey:n,canEditKey:r,pathString:o,path:i,name:a,arrayIndexFromOne:l,handleKeyboard:s,handleEditKey:c,handleCancel:d,handleClick:u,keyValueArray:p,styles:g,getNextOrPrevious:m,emptyStringKey:h})=>{const{setCurrentlyEditingElement:y}=M(),f="number"==typeof a?String(a+(l?1:0)):a;return n?t("input",{className:"jer-input-text jer-key-edit",type:"text",name:o,defaultValue:f,autoFocus:!0,onFocus:e=>e.target.select(),onKeyDown:e=>s(e,{stringConfirm:()=>c(e.target.value),cancel:d,tabForward:()=>{if(c(e.target.value),p){const e=null==p?void 0:p[0][0];y(e?[...i,e]:m("next"))}else y(i)},tabBack:()=>{c(e.target.value),y(m("prev"))}}),style:{width:f.length/1.5+.5+"em"}}):e("span",{className:"jer-key-text",style:Object.assign(Object.assign({},g),{minWidth:`${Math.min(f.length+1,5)}ch`,flexShrink:f.length>10?1:0}),onDoubleClick:()=>r&&y(i,"key"),onClick:u,children:[h?t("span",{className:"jer-empty-string",children:h}):f,""!==f||h?t("span",{className:"jer-key-colon",children:":"}):null]})},me=n=>{const{data:r,parentData:o,onEdit:a,onDelete:d,onChange:u,onMove:p,enableClipboard:g,canDragOnto:m,restrictTypeSelection:h,searchFilter:f,searchText:b,showLabel:v,stringTruncate:j,showStringQuotes:E,arrayIndexFromOne:w,indent:D,translate:C,customNodeDefinitions:k,customNodeData:S,handleKeyboard:N,keyboardControls:T,sort:x,editConfirmRef:A,jsonStringify:P,showIconTooltips:R}=n,{getStyles:I}=K(),{setCurrentlyEditingElement:V,setCollapseState:_,previouslyEditedElement:F,setPreviouslyEditedElement:L,tabDirection:z,setTabDirection:B,previousValue:G,setPreviousValue:Y}=M(),[H,U]=i("function"==typeof r?W:r),{pathString:$,nodeData:Z,path:X,name:J,canEdit:Q,canDelete:q,canDrag:ee,error:te,onError:ne,handleEditKey:re,emptyStringKey:oe,derivedValues:ie}=de({props:n}),{dragSourceProps:se,getDropTargetProps:pe,BottomDropTarget:me,DropTargetPadding:be}=ue({canDrag:ee,canDragOnto:m,path:X,nodeData:Z,onMove:p,onError:ne,translate:C}),[ve,je]=i(he(r,S)),Ee=s((e=>{if(!u)return void U(e);const t=u({currentData:Z.fullData,newValue:e,currentValue:H,name:J,path:X});U(t)}),[u]);l((()=>{U("function"==typeof r?W:r),je(he(r,S))}),[r,te]);const{CustomNode:we,customNodeProps:De,hideKey:Ce,showEditTools:Oe=!0,showOnEdit:ke,showOnView:Se,passOriginalNode:Ne}=S,Te=[...ce,...k.filter((({showInTypesSelector:e=!1,name:t})=>e&&!!t)).map((({name:e})=>e))],xe=c((()=>{if("boolean"==typeof h)return h?[]:Te;if(Array.isArray(h))return h;const e=h(Z);return"boolean"==typeof e?e?[]:Te:e}),[Z,h]),[Ae,Pe]=i(((e,t)=>{var n;if("string"!=typeof e)return null;const r=t.filter((t=>t instanceof Object&&t.enum&&t.values.includes(e)&&t.matchPriority));return r.sort(((e,t)=>{var n,r;return(null!==(n=t.matchPriority)&&void 0!==n?n:0)-(null!==(r=e.matchPriority)&&void 0!==r?r:0)})),null!==(n=r[0])&&void 0!==n?n:null})(H,xe)),{isEditing:Re}=ie,Ke=y("value",Z,f,b);if(Re&&(!Ke||!Q)){const e=O(Z.fullData,X,z,x);V(e||F)}if(!Ke)return null;const Ie=e=>{let t;if(V(null),Y(null),void 0===e||(e=>e&&"object"==typeof e&&"type"in e&&"target"in e&&"preventDefault"in e&&"function"==typeof e.preventDefault)(e))switch(ve){case"object":t={[C("DEFAULT_NEW_KEY",Z)]:H};break;case"array":t=null!=H?H:[];break;case"number":{const e=Number(H);t=isNaN(e)?0:e;break}default:t=H}else t=e;a(t,X).then((e=>{e&&ne({code:"UPDATE_ERROR",message:e},t)}))},Ve=()=>{V(null),null===G?(U(r),Y(null)):a(G,X)},{isEditingKey:_e,canEditKey:Fe}=ie,Le=!Re&&te,ze=Re&&xe.length>1,Me=("invalid"!==ve||we)&&!te&&Oe,Be=v&&!Ce,We=we&&(Re&&ke||!Re&&Se),Ge={value:H,parentData:o,setValue:Ee,isEditing:Re,canEdit:Q,setIsEditing:Q?()=>V(X):()=>{},handleEdit:Ie,handleCancel:Ve,path:X,stringTruncate:j,showStringQuotes:E,nodeData:Z,enumType:Ae,translate:C,handleKeyboard:N,keyboardCommon:{cancel:Ve,tabForward:()=>{B("next"),L($);const e=O(Z.fullData,X,"next",x);e&&(Ie(),V(e))},tabBack:()=>{B("prev"),L($);const e=O(Z.fullData,X,"prev",x);e&&(Ie(),V(e))}}},Ye={canEditKey:Fe,isEditingKey:_e,pathString:$,path:X,name:J,arrayIndexFromOne:w,handleKeyboard:N,handleEditKey:re,handleCancel:Ve,styles:I("property",Z),getNextOrPrevious:e=>O(Z.fullData,X,e,x),emptyStringKey:oe},He=We?t(we,Object.assign({},n,{value:H,customNodeProps:De,setValue:Ee,handleEdit:Ie,handleCancel:Ve,handleKeyPress:e=>N(e,{stringConfirm:Ie,cancel:Ve}),isEditing:Re,setIsEditing:()=>V(X),getStyles:I,originalNode:Ne?ye(r,Ge):void 0,originalNodeKey:Ne?t(ge,Object.assign({},Ye)):void 0,canEdit:Q,keyboardCommon:Ge.keyboardCommon,onError:ne})):ye(r,Ge);return e("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:null!==o?D/2+"em":0,position:"relative"},draggable:ee},se,pe("above"),{children:[me,t(be,{position:"above",nodeData:Z}),e("div",{className:"jer-value-main-row",style:{flexWrap:J.length>10?"wrap":"nowrap"},children:[Be&&t(ge,Object.assign({},Ye)),e("div",{className:"jer-value-and-buttons",children:[t("div",{className:"jer-input-component",children:He}),Re?t(le,{onOk:Ie,onCancel:Ve,nodeData:Z,editConfirmRef:A}):Me&&t(ae,{startEdit:Q?()=>{Y(G),V(X,Ve)}:void 0,handleDelete:q?()=>{d(H,X).then((e=>{e&&ne({code:"DELETE_ERROR",message:e},H)}))}:void 0,enableClipboard:g,translate:C,customButtons:n.customButtons,nodeData:Z,handleKeyboard:N,keyboardControls:T,editConfirmRef:A,jsonStringify:P,showIconTooltips:R}),ze&&e("div",{className:"jer-select jer-select-types",children:[t("select",{name:`${J}-type-select`,className:"jer-select-inner",onChange:e=>(e=>{const t=k.find((t=>t.name===e));if(t)return a(t.defaultValue,X),je(e),Pe(null),V(null),void _({path:X,collapsed:!1,includeChildren:!1});const n=xe.find((t=>t instanceof Object&&t.enum===e));if(n)return"string"==typeof H&&n.values.includes(H)||a(n.values[0],X).then((e=>{e&&(ne({code:"UPDATE_ERROR",message:e},r),V(null))})),void Pe(n);const r=fe(H,e,C("DEFAULT_NEW_KEY",Z),(null==S?void 0:S.CustomNode)?C("DEFAULT_STRING",Z):void 0);["string","number","boolean"].includes(e)||V(null),a(r,X).then((e=>{e?(ne({code:"UPDATE_ERROR",message:e},r),V(null)):Pe(null)}))})(e.target.value),value:Ae?Ae.enum:ve,children:xe.map((e=>e instanceof Object&&"enum"in e?t("option",{value:e.enum,children:e.enum},e.enum):t("option",{value:e,children:e},e)))}),t("span",{className:"focus"})]}),Le&&t("span",{className:"jer-error-slug",style:I("error",Z),children:te})]})]}),t(be,{position:"below",nodeData:Z})]}))},he=(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",ye=(e,n)=>{const r=he(e),{value:o}=n;switch(r){case"string":return t(H,Object.assign({},n,{value:o}));case"number":return t(U,Object.assign({},n,{value:o}));case"boolean":return t($,Object.assign({},n,{value:o}));case"null":return t(X,Object.assign({},n));default:return t(J,Object.assign({},n))}},fe=(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)}},be=(e=[],t)=>{const n=e.filter((({condition:e})=>e(t)));if(0===n.length)return{};const r=n[0],{element:o,wrapperElement:i,customNodeProps:a,wrapperProps:l,hideKey:s=!1,showEditTools:c=!0,showOnEdit:d=!1,showOnView:u=!0,showCollectionWrapper:g=!0}=r,m=p(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:i,customNodeProps:a,wrapperProps:l,hideKey:s,showEditTools:c,showOnEdit:d,showOnView:u,showCollectionWrapper:g},m)},ve=r=>{const{getStyles:o}=K(),{collapseState:c,setCollapseState:d,getMatchingCollapseState:u,currentlyEditingElement:p,setCurrentlyEditingElement:f,areChildrenBeingEdited:b,previousValue:v,setPreviousValue:j}=M(),{mainContainerRef:w,data:D,nodeData:C,parentData:k,showCollectionCount:S,onEdit:T,onAdd:x,onDelete:A,canDragOnto:P,collapseFilter:R,collapseAnimationTime:I,onMove:V,enableClipboard:_,onEditEvent:F,showIconTooltips:L,searchFilter:z,searchText:B,indent:W,sort:G,showArrayIndices:Y,arrayIndexFromOne:H,defaultValue:U,newKeyOptions:$,translate:Z,customNodeDefinitions:X,customNodeData:J,jsonParse:Q,jsonStringify:q,TextEditor:ee,keyboardControls:te,handleKeyboard:ne,insertAtTop:re,onCollapse:oe,editConfirmRef:se,collapseClickZones:ce}=r,[he,ye]=i(q(D)),fe=R(C),{contentRef:je,isAnimating:Ee,maxHeight:we,collapsed:De,animateCollapse:Ce,cssTransitionValue:Oe}=((e,t,n,r,o)=>{const[l,c]=i(n?0:void 0),[d,u]=i(n),p=a(!1),g=a(null),m=a(0),h=a(0),y=t/1e3+"s",f=s((n=>{var i,a;if(d!==n){switch(window.clearTimeout(h.current),p.current=!0,n){case!0:{const e=null!==(a=null===(i=g.current)||void 0===i?void 0:i.offsetHeight)&&void 0!==a?a:0;m.current=e,c(e),setTimeout((()=>{c(0)}),5);break}case!1:c(m.current||pe(e,g,r,o))}u(!d),h.current=window.setTimeout((()=>{p.current=!1,n||c(void 0)}),t)}}),[t,d,e,r,o]);return{contentRef:g,isAnimating:p.current,animateCollapse:f,maxHeight:l,collapsed:d,cssTransitionValue:y}})(D,I,fe,w,q),{pathString:ke,nodeData:Se,path:Ne,name:Te,size:xe,canEdit:Ae,canDelete:Pe,canAdd:Re,canDrag:Ke,error:Ie,setError:Ve,onError:_e,handleEditKey:Fe,emptyStringKey:Le,derivedValues:ze}=de({props:r,collapsed:De}),{dragSourceProps:Me,getDropTargetProps:Be,BottomDropTarget:We,DropTargetPadding:Ge}=ue({canDrag:Ke,canDragOnto:P,path:Ne,nodeData:Se,onMove:V,onError:_e,translate:Z}),Ye=a(!fe),{isEditing:He,isEditingKey:Ue,isArray:$e,canEditKey:Ze}=ze;l((()=>{ye(q(D))}),[D]),l((()=>{const e=R(Se)&&!He;Ye.current=!e,Ce(e)}),[R]),l((()=>{if(null!==c){const e=u(Ne);e&&(Ye.current=!0,Ce(e.collapsed))}}),[c]);const Xe=a(null),Je=s(((e,t)=>{if("function"!=typeof U)return U;const n=U(e,t);return void 0!==n?n:null}),[U]),Qe=s((e=>$?"function"!=typeof $?$:$(e):null),[$]),{CustomNode:qe,customNodeProps:et,CustomWrapper:tt,wrapperProps:nt={},hideKey:rt,showEditTools:ot=!0,showOnEdit:it,showOnView:at,showCollectionWrapper:lt=!0}=J,st=b(ke);st&&De&&Ce(!1);if(!(y("collection",Se,z,B)||0===Se.level)&&!st)return null;const ct=Array.isArray(D)?"array":"object",dt="array"===ct?{open:"[",close:"]"}:{open:"{",close:"}"},ut=e=>{if("Tab"!==e.key||e.getModifierState("Shift"))ne(e,{objectConfirm:gt,cancel:ht});else{e.preventDefault();const t=N(Xe,"\t");ye(t)}},pt=e=>{e.stopPropagation();const t=E(e);if(t&&te.collapseModifier.includes(t))return Ye.current=!0,void d({collapsed:!De,path:Ne,includeChildren:!0});p&&p.includes(ke)||(Ye.current=!0,d(null),oe&&oe({path:Ne,collapsed:!De,includeChildren:!1}),Ce(!De))},gt=()=>{try{const e=Q(he);if(f(null),j(null),Ve(null),q(e)===q(D))return;T(e,Ne).then((t=>{t&&_e({code:"UPDATE_ERROR",message:t},e)}))}catch(e){_e({code:"INVALID_JSON",message:Z("ERROR_INVALID_JSON",Se)},he)}},mt=Ne.length>0?()=>{A(D,Ne).then((e=>{e&&_e({code:"DELETE_ERROR",message:e},D)}))}:void 0,ht=()=>{f(null),null===v?(Ve(null),ye(q(D)),j(null)):T(v,Ne)},yt="when-closed"===S?De:S,ft=!He&&ot,bt=(Y||!$e)&&!rt&&void 0!==Te,vt=qe&&(He&&it||!He&&at),jt=Object.entries(D).map((([e,t])=>["array"===ct?Number(e):e,t]));"object"===ct&&G(jt,(e=>e));const Et=Ye.current?He?e("div",{className:"jer-collection-text-edit",children:[ee?t(ee,{value:he,onChange:ye,onKeyDown:e=>ne(e,{objectConfirm:gt,cancel:ht})}):t(m,{textAreaRef:Xe,className:"jer-collection-text-area",name:ke,value:he,setValue:ye,handleKeyPress:ut,styles:o("input",Se)}),t("div",{className:"jer-collection-input-button-row",children:t(le,{onOk:gt,onCancel:ht,nodeData:Se,editConfirmRef:se})})]}):jt.map((([e,n],i)=>{const a={key:e,value:n,path:[...Ne,e],level:Ne.length+1,index:i,size:h(n)?Object.keys(n).length:null,parentData:D,fullData:Se.fullData},l=be(X,a);return t("div",{className:"jer-collection-element",style:o("collectionElement",a),children:h(n)&&!(null==l?void 0:l.renderCollectionAsValue)?t(ve,Object.assign({},r,{data:n,parentData:D,nodeData:a,showCollectionCount:S,canDragOnto:Ae,customNodeData:l}),e):t(me,Object.assign({},r,{data:n,parentData:D,nodeData:a,canDragOnto:Ae,showLabel:"object"===ct||Y,customNodeData:l}),e)},e)})):null,wt=!!lt&&(De&&!st);wt||(Ye.current=!0);const Dt=Object.assign(Object.assign({},r),{data:D,value:D,parentData:k,nodeData:Se,setValue:e=>g(void 0,void 0,void 0,(function*(){return yield T(e,Ne)})),handleEdit:gt,handleCancel:ht,handleKeyPress:ut,isEditing:He,setIsEditing:()=>f(Ne),getStyles:o,canDragOnto:Ae,canEdit:Ae,keyboardCommon:{},onError:_e}),Ct=vt?t(qe,Object.assign({customNodeProps:et},Dt,{children:Et})):Et,Ot=ft&&t(ae,{startEdit:Ae?()=>{Ye.current=!0,j(null),f(Ne)}:void 0,handleAdd:Re?e=>{Ce(!1);const t=Je(Se,e);if("array"===ct){const e=re.array?0:D.length,n=re.array?{insert:!0}:{};x(t,[...Ne,e],n).then((e=>{e&&_e({code:"ADD_ERROR",message:e},t)}))}else if(e in D)_e({code:"KEY_EXISTS",message:Z("ERROR_KEY_EXISTS",Se)},e);else{const n=re.object?{insertBefore:0}:{};x(t,[...Ne,e],n).then((e=>{e&&_e({code:"ADD_ERROR",message:e},t)}))}}:void 0,handleDelete:Pe?mt:void 0,enableClipboard:_,type:ct,nodeData:Se,translate:Z,customButtons:r.customButtons,keyboardControls:te,handleKeyboard:ne,getNewKeyOptions:Qe,editConfirmRef:se,jsonStringify:q,onEditEvent:F,showIconTooltips:L}),kt={canEditKey:Ze,isEditingKey:Ue,pathString:ke,path:Ne,name:Te,arrayIndexFromOne:H,handleKeyboard:ne,handleEditKey:Fe,handleCancel:ht,keyValueArray:jt,styles:o("property",Se),getNextOrPrevious:e=>O(Se.fullData,Ne,e,G),handleClick:ce.includes("property")?pt:e=>e.stopPropagation(),emptyStringKey:Le},St=e("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(0===Ne.length?0:W/2)+"em"},o("collection",Se)),{position:"relative"}),draggable:Ke},Me,Be("above"),{children:[t("div",{className:"jer-clickzone",style:{width:W/2+1+"em",zIndex:10+2*Se.level},onClick:ce.includes("left")?pt:void 0}),!He&&We,t(Ge,{position:"above",nodeData:Se}),lt?e("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:ce.includes("header")?pt:void 0,children:[e("div",{className:"jer-collection-name",children:[t("div",{className:"jer-collapse-icon jer-accordion-icon"+(De?" jer-rotate-90":""),style:{zIndex:11+2*Se.level,transition:Oe},onClick:pt,children:t(ie,{name:"chevron",rotate:De,nodeData:Se})}),bt&&t(ge,Object.assign({},kt)),!He&&t("span",{className:"jer-brackets jer-bracket-open",style:o("bracket",Se),children:dt.open})]}),!He&&yt&&t("div",{className:"jer-collection-item-count"+(yt?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},o("itemCount",Se)),{transition:Oe}),children:1===xe?Z("ITEM_SINGLE",Object.assign(Object.assign({},Se),{size:1}),1):Z("ITEMS_MULTIPLE",Se,xe)}),t("div",{className:"jer-brackets"+(wt?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},o("bracket",Se)),{transition:Oe}),children:dt.close}),Ot]}):rt?t(n,{}):e("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[t(ge,Object.assign({},kt)),Ot]}),e("div",{className:"jer-collection-inner",style:Object.assign(Object.assign({overflowY:wt||Ee?"clip":"visible",maxHeight:st?void 0:we},o("collectionInner",Se)),{transition:Oe}),ref:je,children:[Ct,t("div",{className:He?"jer-collection-error-row":"jer-collection-error-row-edit",children:Ie&&t("span",{className:"jer-error-slug",style:o("error",Se),children:Ie})}),!He&<&&t("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},o("bracket",Se)),{marginLeft:(W<3?-1:W<6?-.5:0)+"em"}),children:dt.close})]}),t(Ge,{position:"below",nodeData:Se})]}));return tt?t(tt,Object.assign({customNodeProps:nt},Dt,{children:St})):St},je={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",KEY_SELECT:"Select key",NO_KEY_OPTIONS:"No key options",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",SHOW_LESS:"(Show less)",EMPTY_STRING:"<empty string>",TOOLTIP_COPY:"Copy to clipboard",TOOLTIP_EDIT:"Edit",TOOLTIP_DELETE:"Delete",TOOLTIP_ADD:"Add"},Ee=(e,t)=>(n,r,o)=>((e,t,n,r,o)=>{if(t[r]){const e=t[r](n);if(null!==e)return e}const i=r in e?e[r]:je[r];return void 0===o?i:null==i?void 0:i.replace("{{count}}",String(o))})(e,t,r,n,o);var we=[],De=[];!function(e,t){if(e&&"undefined"!=typeof document){var n,r=!0===t.prepend?"prepend":"append",o=!0===t.singleTag,i="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var a=we.indexOf(i);-1===a&&(a=we.push(i)-1,De[a]={}),n=De[a]&&De[a][r]?De[a][r]:De[a][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 a="prepend"===r?"afterbegin":"beforeend";return i.insertAdjacentElement(a,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-highlight-color:#b3d8ff}.jer-visible{opacity:1}.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-select-inner{text-overflow:ellipsis;width:100%}.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-bracket-outside{padding-left:.5em}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em;line-height:1.1em}.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;width:100%}.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;word-break:break-word}.jer-string-expansion{cursor:pointer;filter:saturate(50%);opacity:.6}.jer-show-less{font-size:80%}.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:.3s}.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-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-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 Ce=(e,t)=>JSON.stringify(e,t,2),Oe=({data:e,setData:n,rootName:r="root",onUpdate:o=()=>{},onEdit:d=o,onDelete:u=o,onAdd:p=o,onChange:m,onError:y,onEditEvent:f,showErrorMessages:b=!0,enableClipboard:v=!0,indent:E=2,collapse:D=!1,collapseAnimationTime:O=300,showCollectionCount:k=!0,restrictEdit:S=!1,restrictDelete:N=!1,restrictAdd:x=!1,restrictTypeSelection:A=!1,restrictDrag:P=!0,viewOnly:R,searchFilter:I,searchText:V,searchDebounceTime:_=350,keySort:F=!1,showArrayIndices:L=!0,arrayIndexFromOne:z=!1,showStringQuotes:B=!0,showIconTooltips:W=!1,defaultValue:G=null,newKeyOptions:Y,minWidth:H=250,maxWidth:U="min(600px, 90vw)",rootFontSize:$,stringTruncate:Z=250,translations:X={},className:J,id:Q,customText:q={},customNodeDefinitions:ee=[],customButtons:te=[],jsonParse:ne=JSON.parse,jsonStringify:re=Ce,TextEditor:oe,errorMessageTimeout:ie=2500,keyboardControls:ae={},externalTriggers:le,insertAtTop:se=!1,onCollapse:ce,collapseClickZones:de=["header","left"]})=>{const{getStyles:ue}=K(),{setCurrentlyEditingElement:pe}=M(),ge=c((()=>Ne(D)),[D]),he=c((()=>Ee(X,q)),[X,q]),[ye,fe]=i(V),[je,we]=(({setData:e,data:t})=>{const[n,r]=i(e?void 0:t),o=s((t=>{e?e(t):r(t)}),[e]);return l((()=>{e||r(t)}),[t]),[e?t:n,o]})({setData:n,data:e}),De=a(null);l((()=>{pe(null);const e=setTimeout((()=>fe(V)),_);return()=>clearTimeout(e)}),[V,_]);const Oe={key:r,path:[],level:0,index:0,value:je,size:"object"==typeof je&&null!==je?Object.keys(je).length:1,parentData:null,fullData:je},ke=(e,t)=>g(void 0,void 0,void 0,(function*(){const n=yield e(t);if(!0===n||void 0===n)return void we(t.newData);const r=xe(n)?n:["error",n],[o,i]=r;if("error"===o)return we(t.currentData),!1===i?he("ERROR_UPDATE",Oe):String(i);we(i)})),Pe=c((()=>Ne(S,R)),[S,R]),Re=c((()=>Ne(N,R)),[N,R]),Ke=c((()=>Ne(x,R)),[x,R]),Ie=c((()=>Ne(P,R)),[P,R]),Ve=c((()=>Te(I)),[I]),_e=c((()=>(e=>{const t=Object.assign({},C);for(const n of Object.keys(C)){const r=n;if(e[r]){const o=e[r],i=["clipboardModifier","collapseModifier"].includes(n)?Array.isArray(o)?o:[o]:"string"==typeof o?{key:o}:o;t[r]=i,["stringConfirm","numberConfirm","booleanConfirm"].forEach((n=>{!e[n]&&e.confirm&&(t[n]=t.confirm)}))}}return t})(ae)),[ae]),Fe=s(((e,t)=>((e,t,n)=>{const r=Object.entries(t);for(const[t,o]of r)if(w(n,e[t],t)){n.preventDefault(),o();break}})(_e,t,e)),[_e]),Le=c((()=>{const e=Ae(ee,"stringifyReplacer");return t=>re(t,e)}),[ee,re]),ze=c((()=>{const e=Ae(ee,"parseReviver");return t=>{const n=ne(t,e);return T(n)}}),[ee,ne]),Me=a(null);((e,t)=>{const{setCurrentlyEditingElement:n,currentlyEditingElement:r,setCollapseState:o}=M();l((()=>{if(!e)return;const{collapse:i,edit:a}=e;i&&o(i);const l=!(null==a?void 0:a.path)||j(a.path)===r;switch(null==a?void 0:a.action){case"accept":l&&(t.current&&t.current.click(),n(null));break;case"cancel":l&&n(null);break;default:(null==a?void 0:a.path)&&n(a.path)}}),[e])})(le,Me);const Be=s(((e,t)=>{!1!==F&&("function"!=typeof F?e.sort(((e,n)=>{const r=t(e)[0],o=t(n)[0];return r<o?-1:r>o?1:0})):e.sort(((e,n)=>F(t(e),t(n)))))}),[F]),We=be(ee,Oe),Ge={mainContainerRef:De,name:r,nodeData:Oe,onEdit:(e,t)=>g(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:i}=Se(je,t,e,"update");if(o!==i)return yield ke(d,{currentData:n,newData:r,currentValue:o,newValue:i,name:t.slice(-1)[0],path:t})})),onDelete:(e,t)=>g(void 0,void 0,void 0,(function*(){const{currentData:n,newData:r,currentValue:o,newValue:i}=Se(je,t,e,"delete");return yield ke(u,{currentData:n,newData:r,currentValue:o,newValue:i,name:t.slice(-1)[0],path:t})})),onAdd:(e,t,n)=>g(void 0,void 0,void 0,(function*(){const{currentData:r,newData:o,currentValue:i,newValue:a}=Se(je,t,e,"add",n);return yield ke(p,{currentData:r,newData:o,currentValue:i,newValue:a,name:t.slice(-1)[0],path:t})})),onChange:m,onError:y,onEditEvent:f,showErrorMessages:b,onMove:(e,t,n)=>g(void 0,void 0,void 0,(function*(){if(null===e)return;const{currentData:r,newData:o,currentValue:i}=Se(je,e,"","delete"),a=e.slice(-1)[0],l=t.slice(0,-1),s=t.slice(-1)[0];let c="number"==typeof s?"above"===n?s:s+1:"number"==typeof a?`arr_${a}`:a;e.slice(0,-1).join(".")===t.slice(0,-1).join(".")&&"number"==typeof a&&"number"==typeof c&&a<c&&(c-=1);const u="number"==typeof c?{insert:!0}:"above"===n?{insertBefore:s}:{insertAfter:s},{newData:p,newValue:g}=Se(o,[...l,c],i,"add",u);return yield ke(d,{currentData:r,newData:p,currentValue:i,newValue:g,name:t.slice(-1)[0],path:t})})),showCollectionCount:k,collapseFilter:ge,collapseAnimationTime:O,restrictEditFilter:Pe,restrictDeleteFilter:Re,restrictAddFilter:Ke,restrictTypeSelection:A,restrictDragFilter:Ie,canDragOnto:!1,searchFilter:Ve,searchText:ye,enableClipboard:v,keySort:F,sort:Be,showArrayIndices:L,arrayIndexFromOne:z,showStringQuotes:B,showIconTooltips:W,indent:E,defaultValue:G,newKeyOptions:Y,stringTruncate:Z,translate:he,customNodeDefinitions:ee,customNodeData:We,customButtons:te,parentData:null,jsonParse:ze,jsonStringify:Le,TextEditor:oe,errorMessageTimeout:ie,handleKeyboard:Fe,keyboardControls:_e,insertAtTop:{object:!0===se||"object"===se,array:!0===se||"array"===se},onCollapse:ce,editConfirmRef:Me,collapseClickZones:de},Ye=Object.assign(Object.assign({},ue("container",Oe)),{minWidth:H,maxWidth:U});return Ye.fontSize=null!=$?$:Ye.fontSize,t("div",{id:Q,ref:De,className:`jer-editor-container ${null!=J?J:""}`,style:Ye,children:h(je)&&!We.renderCollectionAsValue?t(ve,Object.assign({data:je},Ge)):t(me,Object.assign({data:je,showLabel:!0},Ge))})},ke=e=>{var n;const[r,o]=i();return l((()=>{const e=document.documentElement;o(e)}),[]),r?t(R,{theme:null!==(n=e.theme)&&void 0!==n?n:A,icons:e.icons,docRoot:r,children:t(z,{onEditEvent:e.onEditEvent,onCollapse:e.onCollapse,children:t(Oe,Object.assign({},e))})}):null},Se=(e,t,n,r,o={})=>{if(0===t.length)return{currentData:e,newData:n,currentValue:e,newValue:n};const i=Object.assign({remove:"delete"===r},o),a="add"!==r?u(e,t):void 0;return{currentData:e,newData:d(e,t,n,i),currentValue:a,newValue:"delete"!==r?n:void 0}},Ne=(e,t)=>t?()=>!0:"boolean"==typeof e?()=>e:"number"==typeof e?({level:t})=>t>=e:e,Te=e=>{if(void 0!==e)return"value"===e?b:"key"===e?v:"all"===e?(e,t)=>b(e,t)||v(e,t):e},xe=e=>Array.isArray(e)&&2===e.length&&["error","value"].includes(e[0]),Ae=(e,t)=>{const n="stringifyReplacer"===t?[e=>void 0===e?x:e]:[];if(n.push(...e.map((e=>e[t])).filter((e=>!!e))),0!==n.length)return(e,t)=>{let r=t;for(const e of n)r=e(r);return r}},Pe=e=>{var n;const{value:r,setIsEditing:o,getStyles:i,nodeData:a}=e,l=i("string",a);return t("div",{onDoubleClick:()=>o(!0),onClick:e=>{(e.getModifierState("Control")||e.getModifierState("Meta"))&&o(!0)},className:"jer-value-string jer-hyperlink",style:l,children:t("a",{href:r,target:"_blank",rel:"noreferrer",style:{color:null!==(n=l.color)&&void 0!==n?n:void 0},children:t(G,Object.assign({},e,{pathString:j(a.path),styles:l,value:a.value}))})})},Re={condition:({value:e})=>"string"==typeof e&&/^https?:\/\/.+\..+$/.test(e),element:Pe,showOnView:!0,showOnEdit:!1},Ke={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)"}},Ie={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"}},Ve={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"}},_e={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"}},Fe={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"}},Le={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{Q as IconAdd,re as IconCancel,oe as IconChevron,te as IconCopy,ee as IconDelete,q as IconEdit,ne as IconOk,ke as JsonEditor,Pe as LinkCustomComponent,Re as LinkCustomNodeDefinition,G as StringDisplay,Y as StringEdit,Fe as candyWrapperTheme,A as defaultTheme,Ke as githubDarkTheme,Ie as githubLightTheme,h as isCollection,b as matchNode,v as matchNodeKey,Ve as monoDarkTheme,_e as monoLightTheme,Le as psychedelicTheme,ce as standardDataTypes,j as toPathString,Z as useKeyboardListener};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-edit-react",
|
|
3
|
-
"version": "1.29.1
|
|
3
|
+
"version": "1.29.1",
|
|
4
4
|
"description": "React component for editing or viewing JSON/object data",
|
|
5
5
|
"main": "build/index.cjs.js",
|
|
6
6
|
"module": "build/index.esm.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"object-property-assigner": "^1.3.5",
|
|
47
|
-
"object-property-extractor": "^1.0.
|
|
47
|
+
"object-property-extractor": "^1.0.14"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@eslint/js": "^9.24.0",
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"react-dom": "^19.1.0",
|
|
65
65
|
"rollup": "^4.10.0",
|
|
66
66
|
"rollup-plugin-bundle-size": "^1.0.3",
|
|
67
|
-
"rollup-plugin-copy": "^3.5.0",
|
|
68
67
|
"rollup-plugin-delete": "^3.0.1",
|
|
69
68
|
"rollup-plugin-dts": "^6.1.0",
|
|
70
69
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
package/build/style.css
DELETED
|
@@ -1,426 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--jer-select-border: #b6b6b6;
|
|
3
|
-
--jer-select-focus: #777;
|
|
4
|
-
--jer-select-arrow: #777;
|
|
5
|
-
--jer-form-border: 1px solid #ededf0;
|
|
6
|
-
--jer-form-border-focus: 1px solid #e2e2e2;
|
|
7
|
-
--jer-highlight-color: #b3d8ff;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.jer-visible {
|
|
11
|
-
opacity: 1;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.jer-hidden {
|
|
15
|
-
opacity: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/* Select styled as per:
|
|
19
|
-
https://moderncss.dev/custom-select-styles-with-pure-css/
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
.jer-select select {
|
|
23
|
-
-webkit-appearance: none;
|
|
24
|
-
-moz-appearance: none;
|
|
25
|
-
appearance: none;
|
|
26
|
-
background-color: transparent;
|
|
27
|
-
border: none;
|
|
28
|
-
padding: 0 1em 0 0;
|
|
29
|
-
margin: 0;
|
|
30
|
-
/* width: 100%; */
|
|
31
|
-
font-family: inherit;
|
|
32
|
-
font-size: 0.8em;
|
|
33
|
-
color: black;
|
|
34
|
-
cursor: inherit;
|
|
35
|
-
line-height: inherit;
|
|
36
|
-
z-index: 1;
|
|
37
|
-
outline: none;
|
|
38
|
-
}
|
|
39
|
-
select::-ms-expand {
|
|
40
|
-
display: none;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.jer-select {
|
|
44
|
-
display: grid;
|
|
45
|
-
grid-template-areas: 'select';
|
|
46
|
-
align-items: center;
|
|
47
|
-
position: relative;
|
|
48
|
-
min-width: 12ch;
|
|
49
|
-
max-width: 15ch;
|
|
50
|
-
border: 1px solid var(--jer-select-border);
|
|
51
|
-
border-radius: 0.25em;
|
|
52
|
-
padding: 0.25em 0.5em;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
line-height: 1.1;
|
|
55
|
-
background-color: #fff;
|
|
56
|
-
background-image: linear-gradient(to top, #f9f9f9, #fff 33%);
|
|
57
|
-
}
|
|
58
|
-
.jer-select select,
|
|
59
|
-
.jer-select::after {
|
|
60
|
-
grid-area: select;
|
|
61
|
-
}
|
|
62
|
-
.jer-select:not(.jer-select--multiple)::after {
|
|
63
|
-
content: '';
|
|
64
|
-
justify-self: end;
|
|
65
|
-
width: 0.8em;
|
|
66
|
-
height: 0.5em;
|
|
67
|
-
background-color: var(--jer-select-arrow);
|
|
68
|
-
clip-path: polygon(100% 0%, 0 0%, 50% 100%);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
select:focus + .focus {
|
|
72
|
-
position: absolute;
|
|
73
|
-
top: -1px;
|
|
74
|
-
left: -1px;
|
|
75
|
-
right: -1px;
|
|
76
|
-
bottom: -1px;
|
|
77
|
-
border: 1px solid var(--jer-select-focus);
|
|
78
|
-
border-radius: inherit;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.jer-select-inner {
|
|
82
|
-
width: 100%;
|
|
83
|
-
text-overflow: ellipsis;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.jer-editor-container {
|
|
87
|
-
position: relative;
|
|
88
|
-
font-size: 16px;
|
|
89
|
-
line-height: 1;
|
|
90
|
-
padding: 1em;
|
|
91
|
-
padding-left: 2em;
|
|
92
|
-
/* margin-top: 1em; */
|
|
93
|
-
/* margin-bottom: 1em; */
|
|
94
|
-
border-radius: 0.5em;
|
|
95
|
-
text-align: left;
|
|
96
|
-
/* border: 1px solid green; */
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.jer-editor-container textarea {
|
|
100
|
-
color: var(--jer-input-color);
|
|
101
|
-
border: var(--jer-form-border);
|
|
102
|
-
border-radius: 0.3em;
|
|
103
|
-
outline: none;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.jer-editor-container textarea:focus {
|
|
107
|
-
border: var(--jer-form-border-focus);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.jer-editor-container input {
|
|
111
|
-
border: var(--jer-form-border);
|
|
112
|
-
border-radius: 0.3em;
|
|
113
|
-
outline: none;
|
|
114
|
-
font-family: inherit;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.jer-editor-container input:focus {
|
|
118
|
-
border: var(--jer-form-border-focus);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/* Input highlighted text */
|
|
122
|
-
.jer-editor-container ::selection {
|
|
123
|
-
background-color: var(--jer-highlight-color);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/* .jer-editor-container select {
|
|
127
|
-
color: red;
|
|
128
|
-
} */
|
|
129
|
-
|
|
130
|
-
/* .jer-component {
|
|
131
|
-
} */
|
|
132
|
-
|
|
133
|
-
.jer-collection-header-row,
|
|
134
|
-
.jer-value-main-row {
|
|
135
|
-
display: flex;
|
|
136
|
-
min-height: 1.7em;
|
|
137
|
-
gap: 0.3em;
|
|
138
|
-
align-items: center;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.jer-collection-header-row {
|
|
142
|
-
display: flex;
|
|
143
|
-
flex-wrap: wrap;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/* .jer-brackets {
|
|
147
|
-
} */
|
|
148
|
-
|
|
149
|
-
/* .jer-bracket-outside {
|
|
150
|
-
} */
|
|
151
|
-
|
|
152
|
-
/* .jer-collection-item-count {
|
|
153
|
-
} */
|
|
154
|
-
|
|
155
|
-
.jer-collapse-icon {
|
|
156
|
-
position: absolute;
|
|
157
|
-
left: -1.2em;
|
|
158
|
-
top: 0.35em;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.jer-collection-inner {
|
|
162
|
-
position: relative;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.jer-collection-text-edit {
|
|
166
|
-
display: flex;
|
|
167
|
-
flex-direction: column;
|
|
168
|
-
gap: 0.3em;
|
|
169
|
-
align-items: flex-start;
|
|
170
|
-
line-height: 1.1em;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.jer-collection-text-area {
|
|
174
|
-
resize: both;
|
|
175
|
-
padding-top: 0.2em;
|
|
176
|
-
padding-left: 0.5em;
|
|
177
|
-
padding-right: 0.5em;
|
|
178
|
-
padding-bottom: 0;
|
|
179
|
-
overflow: hidden;
|
|
180
|
-
max-height: 40em;
|
|
181
|
-
font-family: inherit;
|
|
182
|
-
font-size: 0.85em;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.jer-collection-input-button-row {
|
|
186
|
-
display: flex;
|
|
187
|
-
justify-content: flex-end;
|
|
188
|
-
width: 100%;
|
|
189
|
-
font-size: 150%;
|
|
190
|
-
margin-top: 0.4em;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/* .jer-collection-element {
|
|
194
|
-
} */
|
|
195
|
-
|
|
196
|
-
.jer-collection-error-row {
|
|
197
|
-
position: absolute;
|
|
198
|
-
bottom: 0.5em;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/* .jer-collection-error-row-edit {
|
|
202
|
-
} */
|
|
203
|
-
|
|
204
|
-
.jer-error-slug {
|
|
205
|
-
margin-left: 1em;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.jer-value-component {
|
|
209
|
-
position: relative;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.jer-value-main-row {
|
|
213
|
-
display: flex;
|
|
214
|
-
gap: 0;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.jer-value-and-buttons {
|
|
218
|
-
display: flex;
|
|
219
|
-
justify-content: flex-start;
|
|
220
|
-
align-items: center;
|
|
221
|
-
padding-left: 0.5em;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.jer-value-error-row {
|
|
225
|
-
position: absolute;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.jer-value-string {
|
|
229
|
-
line-height: 1.3em;
|
|
230
|
-
white-space: pre-wrap;
|
|
231
|
-
overflow-wrap: anywhere;
|
|
232
|
-
word-break: break-word;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.jer-string-expansion {
|
|
236
|
-
cursor: pointer;
|
|
237
|
-
opacity: 0.6;
|
|
238
|
-
filter: saturate(50%);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.jer-show-less {
|
|
242
|
-
font-size: 80%;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.jer-hyperlink {
|
|
246
|
-
text-decoration: underline;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.jer-input-text {
|
|
250
|
-
resize: none;
|
|
251
|
-
margin: 0;
|
|
252
|
-
height: 1.4em;
|
|
253
|
-
padding-left: 0.5em;
|
|
254
|
-
padding-right: 0.5em;
|
|
255
|
-
padding-top: 0.25em;
|
|
256
|
-
padding-bottom: 0.2em;
|
|
257
|
-
min-width: 6em;
|
|
258
|
-
overflow: hidden;
|
|
259
|
-
line-height: 1.2em;
|
|
260
|
-
font-family: inherit;
|
|
261
|
-
font-size: 0.9em;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/* .jer-value-number {
|
|
265
|
-
} */
|
|
266
|
-
|
|
267
|
-
/* .jer-value-boolean {
|
|
268
|
-
} */
|
|
269
|
-
|
|
270
|
-
.jer-input-boolean {
|
|
271
|
-
transform: scale(1.5);
|
|
272
|
-
margin-left: 0.3em;
|
|
273
|
-
margin-right: 0.3em;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/* .jer-value-null {
|
|
277
|
-
} */
|
|
278
|
-
|
|
279
|
-
/* .jer-value-object {
|
|
280
|
-
} */
|
|
281
|
-
|
|
282
|
-
.jer-key-text {
|
|
283
|
-
word-break: break-word;
|
|
284
|
-
line-height: 1.1em;
|
|
285
|
-
white-space: pre-wrap;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
.jer-key-edit {
|
|
289
|
-
padding: 0 0.3em;
|
|
290
|
-
font-size: inherit;
|
|
291
|
-
font-size: 0.9em;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/* .jer-value-array {
|
|
295
|
-
} */
|
|
296
|
-
|
|
297
|
-
.jer-value-invalid {
|
|
298
|
-
opacity: 0.5;
|
|
299
|
-
font-style: italic;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
.jer-input-number {
|
|
303
|
-
min-width: 3em;
|
|
304
|
-
font-size: 90%;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/* .jer-input-component {
|
|
308
|
-
} */
|
|
309
|
-
|
|
310
|
-
.jer-edit-buttons,
|
|
311
|
-
.jer-confirm-buttons {
|
|
312
|
-
display: flex;
|
|
313
|
-
align-items: center;
|
|
314
|
-
cursor: pointer;
|
|
315
|
-
height: 1em;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
.jer-input-buttons {
|
|
319
|
-
gap: 0.4em;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
.jer-edit-buttons {
|
|
323
|
-
gap: 0.4em;
|
|
324
|
-
margin-left: 0.5em;
|
|
325
|
-
opacity: 0;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.jer-confirm-buttons {
|
|
329
|
-
gap: 0.2em;
|
|
330
|
-
margin-left: 0.4em;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
.jer-edit-buttons:hover {
|
|
334
|
-
opacity: 1;
|
|
335
|
-
position: relative;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.jer-collection-header-row:hover > .jer-edit-buttons {
|
|
339
|
-
opacity: 1;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.jer-value-main-row:hover > .jer-edit-buttons {
|
|
343
|
-
opacity: 1;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.jer-value-and-buttons:hover > .jer-edit-buttons {
|
|
347
|
-
opacity: 1;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/* .jer-input-buttons {
|
|
351
|
-
} */
|
|
352
|
-
|
|
353
|
-
.jer-copy-pulse {
|
|
354
|
-
position: relative;
|
|
355
|
-
transition: 0.3s;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.jer-copy-pulse:hover {
|
|
359
|
-
opacity: 0.85;
|
|
360
|
-
transition: 0.3s;
|
|
361
|
-
transform: scale(1.2);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.jer-copy-pulse:after {
|
|
365
|
-
content: '';
|
|
366
|
-
display: block;
|
|
367
|
-
position: absolute;
|
|
368
|
-
border-radius: 50%;
|
|
369
|
-
left: 0;
|
|
370
|
-
top: 0;
|
|
371
|
-
width: 100%;
|
|
372
|
-
height: 100%;
|
|
373
|
-
opacity: 0;
|
|
374
|
-
transition: all 0.5s;
|
|
375
|
-
box-shadow: 0 0 15px 5px var(--jer-icon-copy-color);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
.jer-copy-pulse:active:after {
|
|
379
|
-
box-shadow: 0 0 0 0 var(--jer-icon-copy-color);
|
|
380
|
-
position: absolute;
|
|
381
|
-
border-radius: 4em;
|
|
382
|
-
left: 0;
|
|
383
|
-
top: 0;
|
|
384
|
-
opacity: 1;
|
|
385
|
-
transition: 0s;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
.jer-copy-pulse:active {
|
|
389
|
-
top: 0.07em;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
.jer-rotate-90 {
|
|
393
|
-
transform: rotate(-90deg);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
.jer-accordion-icon {
|
|
397
|
-
/* font-size: '2em'; */
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
.jer-icon:hover {
|
|
401
|
-
opacity: 0.85;
|
|
402
|
-
transition: 0.3s;
|
|
403
|
-
transform: scale(1.2);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/* For displaying keys that are purely <empty string> "" */
|
|
407
|
-
.jer-empty-string {
|
|
408
|
-
font-style: italic;
|
|
409
|
-
font-size: 90%;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.jer-drag-n-drop-padding {
|
|
413
|
-
height: 0.5em;
|
|
414
|
-
border: 1px dashed #e0e0e0;
|
|
415
|
-
border-radius: 0.3em;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/* Region to left of Collection node contents that is clickable to
|
|
419
|
-
collapse/expand node*/
|
|
420
|
-
.jer-clickzone {
|
|
421
|
-
position: absolute;
|
|
422
|
-
left: -1em;
|
|
423
|
-
top: 1.2em;
|
|
424
|
-
/* border: 1px solid red; */
|
|
425
|
-
height: calc(100% - 0.8em);
|
|
426
|
-
}
|