solace-agent-mesh 1.6.1__py3-none-any.whl → 1.6.2__py3-none-any.whl

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.

Potentially problematic release.


This version of solace-agent-mesh might be problematic. Click here for more details.

Files changed (122) hide show
  1. solace_agent_mesh/agent/adk/app_llm_agent.py +26 -0
  2. solace_agent_mesh/agent/adk/artifacts/filesystem_artifact_service.py +1 -1
  3. solace_agent_mesh/agent/adk/embed_resolving_mcp_toolset.py +135 -31
  4. solace_agent_mesh/agent/adk/models/lite_llm.py +5 -0
  5. solace_agent_mesh/agent/adk/runner.py +10 -12
  6. solace_agent_mesh/agent/adk/services.py +50 -14
  7. solace_agent_mesh/agent/adk/setup.py +66 -38
  8. solace_agent_mesh/agent/protocol/event_handlers.py +243 -122
  9. solace_agent_mesh/agent/proxies/a2a/app.py +3 -2
  10. solace_agent_mesh/agent/proxies/base/app.py +3 -2
  11. solace_agent_mesh/agent/sac/app.py +43 -2
  12. solace_agent_mesh/agent/sac/component.py +200 -72
  13. solace_agent_mesh/agent/sac/task_execution_context.py +35 -4
  14. solace_agent_mesh/agent/tools/tool_config_types.py +3 -0
  15. solace_agent_mesh/agent/utils/artifact_helpers.py +1 -1
  16. solace_agent_mesh/assets/docs/404.html +3 -3
  17. solace_agent_mesh/assets/docs/assets/js/240a0364.c39f8388.js +1 -0
  18. solace_agent_mesh/assets/docs/assets/js/631738c7.7c4594c9.js +1 -0
  19. solace_agent_mesh/assets/docs/assets/js/66d4869e.830d443f.js +1 -0
  20. solace_agent_mesh/assets/docs/assets/js/71da7b71.ddbdfbe2.js +1 -0
  21. solace_agent_mesh/assets/docs/assets/js/e92d0134.4f395c6b.js +1 -0
  22. solace_agent_mesh/assets/docs/assets/js/f284c35a.720d2ef2.js +1 -0
  23. solace_agent_mesh/assets/docs/assets/js/main.d1643f0b.js +2 -0
  24. solace_agent_mesh/assets/docs/assets/js/runtime~main.97f920d4.js +1 -0
  25. solace_agent_mesh/assets/docs/docs/documentation/components/agents/index.html +3 -3
  26. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/artifact-management/index.html +3 -3
  27. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/audio-tools/index.html +3 -3
  28. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/data-analysis-tools/index.html +3 -3
  29. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/embeds/index.html +3 -3
  30. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/index.html +3 -3
  31. solace_agent_mesh/assets/docs/docs/documentation/components/cli/index.html +3 -3
  32. solace_agent_mesh/assets/docs/docs/documentation/components/gateways/index.html +3 -3
  33. solace_agent_mesh/assets/docs/docs/documentation/components/index.html +3 -3
  34. solace_agent_mesh/assets/docs/docs/documentation/components/orchestrator/index.html +3 -3
  35. solace_agent_mesh/assets/docs/docs/documentation/components/plugins/index.html +3 -3
  36. solace_agent_mesh/assets/docs/docs/documentation/components/proxies/index.html +3 -3
  37. solace_agent_mesh/assets/docs/docs/documentation/deploying/debugging/index.html +4 -25
  38. solace_agent_mesh/assets/docs/docs/documentation/deploying/deployment-options/index.html +4 -4
  39. solace_agent_mesh/assets/docs/docs/documentation/deploying/index.html +4 -4
  40. solace_agent_mesh/assets/docs/docs/documentation/deploying/logging/index.html +76 -0
  41. solace_agent_mesh/assets/docs/docs/documentation/deploying/observability/index.html +5 -4
  42. solace_agent_mesh/assets/docs/docs/documentation/developing/create-agents/index.html +3 -3
  43. solace_agent_mesh/assets/docs/docs/documentation/developing/create-gateways/index.html +3 -3
  44. solace_agent_mesh/assets/docs/docs/documentation/developing/creating-python-tools/index.html +3 -3
  45. solace_agent_mesh/assets/docs/docs/documentation/developing/creating-service-providers/index.html +3 -3
  46. solace_agent_mesh/assets/docs/docs/documentation/developing/evaluations/index.html +3 -3
  47. solace_agent_mesh/assets/docs/docs/documentation/developing/index.html +3 -3
  48. solace_agent_mesh/assets/docs/docs/documentation/developing/structure/index.html +3 -3
  49. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/bedrock-agents/index.html +3 -3
  50. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/custom-agent/index.html +3 -3
  51. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/event-mesh-gateway/index.html +3 -3
  52. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mcp-integration/index.html +3 -3
  53. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mongodb-integration/index.html +3 -3
  54. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rag-integration/index.html +3 -3
  55. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rest-gateway/index.html +3 -3
  56. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/slack-integration/index.html +3 -3
  57. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/sql-database/index.html +3 -3
  58. solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +3 -3
  59. solace_agent_mesh/assets/docs/docs/documentation/enterprise/installation/index.html +3 -3
  60. solace_agent_mesh/assets/docs/docs/documentation/enterprise/rbac-setup-guide/index.html +3 -3
  61. solace_agent_mesh/assets/docs/docs/documentation/enterprise/single-sign-on/index.html +3 -3
  62. solace_agent_mesh/assets/docs/docs/documentation/getting-started/architecture/index.html +3 -3
  63. solace_agent_mesh/assets/docs/docs/documentation/getting-started/index.html +3 -3
  64. solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
  65. solace_agent_mesh/assets/docs/docs/documentation/getting-started/try-agent-mesh/index.html +3 -3
  66. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/configurations/index.html +3 -6
  67. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/index.html +3 -3
  68. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/installation/index.html +3 -3
  69. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/large_language_models/index.html +3 -3
  70. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/run-project/index.html +3 -3
  71. solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-gateway-upgrade-to-0.3.0/index.html +3 -3
  72. solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-technical-migration-map/index.html +3 -3
  73. solace_agent_mesh/assets/docs/lunr-index-1761663789856.json +1 -0
  74. solace_agent_mesh/assets/docs/lunr-index.json +1 -1
  75. solace_agent_mesh/assets/docs/search-doc-1761663789856.json +1 -0
  76. solace_agent_mesh/assets/docs/search-doc.json +1 -1
  77. solace_agent_mesh/assets/docs/sitemap.xml +1 -1
  78. solace_agent_mesh/cli/__init__.py +1 -1
  79. solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-BTf6dqwp.js → authCallback-D4_RMYRh.js} +1 -1
  80. solace_agent_mesh/client/webui/frontend/static/assets/{client-CaY59VuC.js → client-UZ3qU6Bq.js} +1 -1
  81. solace_agent_mesh/client/webui/frontend/static/assets/main--3yJYl7S.css +1 -0
  82. solace_agent_mesh/client/webui/frontend/static/assets/main-DojKHS49.js +342 -0
  83. solace_agent_mesh/client/webui/frontend/static/assets/{vendor-BEmvJSYz.js → vendor-DSqhjwq_.js} +1 -1
  84. solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
  85. solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
  86. solace_agent_mesh/common/a2a/events.py +2 -1
  87. solace_agent_mesh/common/sac/sam_component_base.py +24 -18
  88. solace_agent_mesh/common/utils/pydantic_utils.py +90 -3
  89. solace_agent_mesh/gateway/base/component.py +12 -8
  90. solace_agent_mesh/gateway/http_sse/app.py +7 -0
  91. solace_agent_mesh/gateway/http_sse/component.py +17 -9
  92. solace_agent_mesh/gateway/http_sse/dependencies.py +83 -59
  93. solace_agent_mesh/gateway/http_sse/main.py +3 -2
  94. solace_agent_mesh/gateway/http_sse/routers/agent_cards.py +1 -1
  95. solace_agent_mesh/gateway/http_sse/routers/auth.py +103 -6
  96. solace_agent_mesh/gateway/http_sse/routers/config.py +1 -1
  97. solace_agent_mesh/gateway/http_sse/routers/sessions.py +1 -1
  98. solace_agent_mesh/gateway/http_sse/routers/sse.py +15 -5
  99. solace_agent_mesh/gateway/http_sse/routers/tasks.py +3 -3
  100. solace_agent_mesh/gateway/http_sse/routers/visualization.py +90 -8
  101. solace_agent_mesh/gateway/http_sse/services/session_service.py +1 -1
  102. solace_agent_mesh/gateway/http_sse/session_manager.py +15 -15
  103. solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +16 -1
  104. solace_agent_mesh/gateway/http_sse/sse_manager.py +15 -6
  105. solace_agent_mesh/templates/logging_config_template.ini +2 -2
  106. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/METADATA +2 -2
  107. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/RECORD +111 -109
  108. solace_agent_mesh/assets/docs/assets/js/240a0364.7eac6021.js +0 -1
  109. solace_agent_mesh/assets/docs/assets/js/631738c7.a8b1ef8b.js +0 -1
  110. solace_agent_mesh/assets/docs/assets/js/71da7b71.38583438.js +0 -1
  111. solace_agent_mesh/assets/docs/assets/js/e92d0134.cf6d6522.js +0 -1
  112. solace_agent_mesh/assets/docs/assets/js/f284c35a.42f59cdd.js +0 -1
  113. solace_agent_mesh/assets/docs/assets/js/main.b12eac43.js +0 -2
  114. solace_agent_mesh/assets/docs/assets/js/runtime~main.e268214e.js +0 -1
  115. solace_agent_mesh/assets/docs/lunr-index-1761248203150.json +0 -1
  116. solace_agent_mesh/assets/docs/search-doc-1761248203150.json +0 -1
  117. solace_agent_mesh/client/webui/frontend/static/assets/main-B32noGmR.js +0 -342
  118. solace_agent_mesh/client/webui/frontend/static/assets/main-DHJKSW1S.css +0 -1
  119. /solace_agent_mesh/assets/docs/assets/js/{main.b12eac43.js.LICENSE.txt → main.d1643f0b.js.LICENSE.txt} +0 -0
  120. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/WHEEL +0 -0
  121. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/entry_points.txt +0 -0
  122. {solace_agent_mesh-1.6.1.dist-info → solace_agent_mesh-1.6.2.dist-info}/licenses/LICENSE +0 -0
@@ -402,4 +402,4 @@ In object: ${JSON.stringify(e)}`)};function Pc(e,t){var n={};for(var r in e)Obje
402
402
  `?n+".":n;return _.jsxs("div",{style:{display:"grid"},children:[_.jsx("textarea",{id:`${t}_textarea`,ref:s,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},o),rows:1,className:e,name:`${t}_textarea`,value:n,onChange:c=>r(c.target.value),autoFocus:!0,onFocus:c=>{n.length<40&&c.target.select()},onKeyDown:i}),_.jsx("span",{className:e,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"},o),children:l})]})},gn=e=>e!==null&&typeof e=="object",$c=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!so(r,t,n))return!1}if(!n&&r&&!so(r,t))return!1;break;case"value":if(n&&!n(t,r)||!n&&r&&!mn(t,r))return!1}return!0},so=(e="",t,n=mn)=>{const r=t.value;return Object.entries(r).some((([i,o])=>{const s=[...t.path,i],l=Object.assign(Object.assign({},t),{key:i,path:s,level:t.level+1,value:o,size:s.length,parentData:r});return gn(o)?so(e,l,n):n(l,e)}))},mn=(e,t="")=>{const{value:n}=e;if(n===null&&"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())||t==="1":"false".includes(t.toLowerCase())||t==="0";default:return!1}},ka=({key:e,path:t},n="")=>!!mn({value:e},n)||!!t.some((r=>mn({value:r},n))),Ft=(e,t)=>(t??"")+e.map((n=>n===""?"\0":n)).join("."),$o=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,f1=(e,t,n)=>{const r=e.key,i=$o(e);if(Array.isArray(t))return!!i&&t.includes(i);const{key:o,modifier:s}=t;return(n!=="stringLineBreak"||r!=="Enter"||i!=="Shift"||o!=="Enter"||!(s!=null&&s.includes("Shift")))&&r===o&&(s===i||Array.isArray(s)&&s.includes(i))},At={key:"Enter"},Sa={confirm:At,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},At),{modifier:["Meta","Shift","Control"]}),objectLineBreak:At,stringConfirm:At,stringLineBreak:Object.assign(Object.assign({},At),{modifier:["Shift"]}),numberConfirm:At,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:At,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},Dt=(e,t,n="next",r)=>{const i=t.slice(0,t.length-1),o=t.slice(-1)[0];if(o===void 0)return null;const s=pn(e,i),l=d1(s);Array.isArray(s)||r(l,(({key:u,value:d})=>[u,d]));const c=l.findIndex((u=>u.key===o)),a=l[c+(n==="next"?1:-1)];return a?gn(a.value)?Object.keys(a.value).length===0?Dt(e,[...i,a.key],n,r):Lc(e,[...i,a.key],n,r):[...i,a.key]:i.length===0?null:Dt(e,i,n,r)},Lc=(e,t,n="next",r)=>{const i=pn(e,t);if(!gn(i))return t;const o=Array.isArray(i)?i.map(((l,c)=>c)):Object.keys(i);r(o,(l=>[l,i]));const s=n==="next"?o[0]:o[o.length-1];return Lc(e,[...t,s],n,r)},d1=e=>Array.isArray(e)?e.map(((t,n)=>({index:n,value:t,key:n}))):Object.entries(e).map((([t,n],r)=>({key:t,value:n,index:r}))),zc=(e,t)=>{var n,r,i,o;const s=e.current,l=(n=s==null?void 0:s.selectionStart)!==null&&n!==void 0?n:1/0,c=(r=s==null?void 0:s.selectionEnd)!==null&&r!==void 0?r:1/0,a=((i=s==null?void 0:s.textContent)===null||i===void 0?void 0:i.slice(0,l))+t+((o=s==null?void 0:s.textContent)===null||o===void 0?void 0:o.slice(c));return s.value=a,s==null||s.setSelectionRange(l+1,l+1),a},ao=e=>{if(e!==Hc){if(Array.isArray(e))return e.map((t=>ao(t)));if(e&&typeof e=="object")for(const t in e)e[t]=ao(e[t]);return e}},Hc="__​undefined__",Lo={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)"}},Vc=A.createContext({getStyles:()=>({}),icons:{}}),h1=({theme:e=Lo,icons:t={},docRoot:n,children:r})=>{const i=p1(e,n);return _.jsx(Vc.Provider,{value:{getStyles:(o,s)=>typeof i[o]=="function"?i[o](s):i[o],icons:t},children:r})},at=()=>A.useContext(Vc),p1=(e,t)=>{var n,r,i,o;const s={},l=(Array.isArray(e)?e:[e]).map((u=>g1(u)?Vi({fragments:{},styles:u},s):Vi(u,s))),c=Vi(Lo,{});Object.keys(c).forEach((u=>{const d=u;l.forEach((f=>{f[d]&&(c[d]=Object.assign(Object.assign({},c[d]),f[d]))}))}));const a=Object.assign({},c);return Object.entries(s).forEach((([u,d])=>{const f=u;a[f]=h=>{const p=d(h)||{};return Object.assign(Object.assign({},c[f]),p)}})),typeof(a==null?void 0:a.inputHighlight)!="function"&&(!((n=a==null?void 0:a.inputHighlight)===null||n===void 0)&&n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",(r=a==null?void 0:a.inputHighlight)===null||r===void 0?void 0:r.backgroundColor),typeof(a==null?void 0:a.iconCopy)!="function"&&(!((i=a==null?void 0:a.iconCopy)===null||i===void 0)&&i.color)&&t.style.setProperty("--jer-icon-copy-color",(o=a==null?void 0:a.iconCopy)===null||o===void 0?void 0:o.color),a},Vi=(e,t)=>{const{fragments:n,styles:r}=e,i={};return Object.entries(r).forEach((([o,s])=>{const l=(Array.isArray(s)?s:[s]).reduce(((c,a)=>{var u,d;if(typeof a=="function")return t[o]=a,Object.assign({},c);if(typeof a=="string"){const f=(u=n==null?void 0:n[a])!==null&&u!==void 0?u:a;return typeof f=="string"?Object.assign(Object.assign({},c),{[(d=m1[o])!==null&&d!==void 0?d:"color"]:f}):Object.assign(Object.assign({},c),f)}return Object.assign(Object.assign({},c),a)}),{});i[o]=l})),i},g1=e=>!("styles"in e),m1={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},Bc=A.createContext(null),y1=({children:e,onEditEvent:t,onCollapse:n})=>{const[r,i]=A.useState(null),[o,s]=A.useState(null),[l,c]=A.useState(null),[a,u]=A.useState({path:null,pathString:null}),d=A.useRef(null),f=A.useRef("next"),h=A.useRef(null);return _.jsx(Bc.Provider,{value:{collapseState:r,setCollapseState:p=>{i(p),n&&p!==null&&(Array.isArray(p)?p.forEach((m=>n(m))):n(p)),p!==null&&setTimeout((()=>i(null)),2e3)},getMatchingCollapseState:p=>{if(Array.isArray(r)){for(const m of r)if(Ca(p,m))return m;return null}return Ca(p,r)?r:null},currentlyEditingElement:o,setCurrentlyEditingElement:(p,m)=>{const v=typeof p=="string"||p===null?p:Ft(p,m==="key"?"key_":void 0);o!==null&&v!==null&&d.current!==null&&d.current(),s(v),t&&(Array.isArray(p)||p===null)&&t(p,m==="key"),d.current=typeof m=="function"?m:null},areChildrenBeingEdited:p=>o!==null&&o.includes(p),previouslyEditedElement:h.current,setPreviouslyEditedElement:p=>{h.current=p},tabDirection:f.current,setTabDirection:p=>{f.current=p},previousValue:l,setPreviousValue:c,dragSource:a,setDragSource:u},children:e})},Vt=()=>{const e=A.useContext(Bc);if(!e)throw new Error("Missing Context Provider");return e},Ca=(e,t)=>{if(t===null)return!1;if(!t.includeChildren)return t.path.every(((n,r)=>e[r]===n))&&t.path.length===e.length;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},lo="**INVALID_FUNCTION**",v1=({nodeData:e,showStringQuotes:t=!0,stringTruncate:n=200,pathString:r,canEdit:i,setIsEditing:o,styles:s,translate:l,value:c,TextWrapper:a=({children:u})=>u})=>{const u=c??e.value,[d,f]=A.useState(!1),h=t?'"':"",p=u.length>n,m=()=>{i?o(!0):f(!d)};return _.jsxs("div",{id:`${r}_display`,onDoubleClick:m,onClick:v=>{(v.getModifierState("Control")||v.getModifierState("Meta"))&&m()},className:"jer-value-string",style:s,children:[h,p?_.jsxs(_.Fragment,d?{children:[_.jsx(a,{children:_.jsxs("span",{children:[u,h]})}),_.jsxs("span",{className:"jer-string-expansion jer-show-less",onClick:()=>f(!1),children:[" ",l("SHOW_LESS",e)]})]}:{children:[_.jsxs(a,{children:[_.jsx("span",{children:u.slice(0,n-2).trimEnd()})," "]}),_.jsx("span",{className:"jer-string-expansion jer-ellipsis",onClick:()=>f(!0),children:"..."}),h]}):_.jsx(a,{children:`${u}${h}`})]})},x1=({styles:e,pathString:t,value:n,setValue:r,handleEdit:i,handleKeyboard:o,keyboardCommon:s})=>{const l=A.useRef(null);return _.jsx(Ic,{className:"jer-input-text",textAreaRef:l,name:t,value:n,setValue:r,handleKeyPress:c=>{o(c,Object.assign({stringConfirm:i,stringLineBreak:()=>{const a=zc(l,`
403
403
  `);r(a)}},s))},styles:e})},w1=e=>{var{isEditing:t,path:n,enumType:r}=e,i=Pc(e,["isEditing","path","enumType"]);const{getStyles:o}=at(),s=Ft(n),{value:l,setValue:c,nodeData:a,handleEdit:u,handleKeyboard:d,keyboardCommon:f}=i;return t&&r?_.jsxs("div",{className:"jer-select jer-select-enums",children:[_.jsx("select",{name:`${s}-value-select`,className:"jer-select-inner",onChange:h=>c(h.target.value),value:l,autoFocus:!0,onKeyDown:h=>{d(h,Object.assign({stringConfirm:u},f))},children:r.values.map((h=>_.jsx("option",{value:h,children:h},h)))}),_.jsx("span",{className:"focus"})]}):t?_.jsx(x1,Object.assign({styles:o("input",a),pathString:s},i,{setValue:i.setValue})):_.jsx(v1,Object.assign({pathString:s,styles:o("string",a)},i))},b1=({value:e,setValue:t,isEditing:n,path:r,setIsEditing:i,handleEdit:o,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:a}=at();return n?_.jsx("input",{className:"jer-input-number",type:"text",name:Ft(r),value:e,onChange:u=>t(u.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:u=>setTimeout((()=>u.target.select()),10),onKeyDown:u=>l(u,Object.assign({numberConfirm:o,numberUp:()=>t(Number(e)+1),numberDown:()=>t(Number(e)-1)},c)),style:Object.assign({width:String(e).length/1.5+2+"em"},a("input",s))}):_.jsx("span",{onDoubleClick:()=>i(!0),className:"jer-value-number",style:a("number",s),children:e})},E1=({value:e,setValue:t,isEditing:n,path:r,setIsEditing:i,handleEdit:o,nodeData:s,handleKeyboard:l,keyboardCommon:c})=>{const{getStyles:a}=at();return typeof e!="boolean"?null:n?_.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:Ft(r),checked:e,onChange:()=>t(!e),onKeyDown:u=>{u.key===" "&&u.preventDefault(),l(u,Object.assign({booleanConfirm:o,booleanToggle:()=>t(!e)},c))},autoFocus:!0}):_.jsx("span",{onDoubleClick:()=>i(!0),className:"jer-value-boolean",style:a("boolean",s),children:String(e)})},_1=(e,t)=>{const n=A.useRef(void 0),r=A.useRef(t);A.useEffect((()=>{r.current=t}),[t]);const i=o=>{r.current(o)};A.useEffect((()=>{if(window.clearTimeout(n.current),e)return n.current=window.setTimeout((()=>{window.addEventListener("keydown",i)}),100),()=>{window.clearTimeout(n.current),window.removeEventListener("keydown",i)}}),[e])},k1=({value:e,isEditing:t,setIsEditing:n,handleEdit:r,nodeData:i,handleKeyboard:o,keyboardCommon:s})=>{const{getStyles:l}=at();return _1(t,(c=>o(c,Object.assign({confirm:r},s)))),_.jsx("div",{onDoubleClick:()=>n(!0),className:"jer-value-null",style:l("null",i),children:String(e)})},S1=({value:e})=>{let t="Error!";switch(typeof e){case"string":e===lo&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return _.jsx("span",{className:"jer-value-invalid",children:t})},C1=({size:e,style:t,className:n})=>_.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:n,style:t,children:[_.jsx("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),_.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"})]}),N1=({size:e,style:t,className:n})=>_.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:n,style:t,transform:"translate(0, 0.5)",children:[_.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"}),_.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"})]}),T1=({size:e,style:t,className:n})=>_.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:n,style:t,children:_.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"})}),A1=({size:e,style:t,className:n})=>_.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:e,height:e,className:n,style:t,children:[_.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"}),_.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"}),_.jsx("path",{d:"M15 10l-4 4 4 4"})]}),R1=({size:e,style:t,className:n})=>_.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:e,height:e,className:n,style:t,children:[_.jsx("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),_.jsx("path",{d:"M22 4L12 14.01l-3-3"})]}),j1=({size:e,style:t,className:n})=>_.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:n,style:t,children:_.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"})}),M1=({size:e,style:t,className:n})=>_.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:n,style:t,children:_.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"})}),Ot=({name:e,nodeData:t})=>{var n,r,i,o,s,l,c;const{getStyles:a,icons:u}=at(),d={size:"1.4em",className:"jer-icon"};switch(e){case"add":return(n=u==null?void 0:u.add)!==null&&n!==void 0?n:_.jsx(C1,Object.assign({},d,{style:a("iconAdd",t)}));case"edit":return(r=u==null?void 0:u.edit)!==null&&r!==void 0?r:_.jsx(N1,Object.assign({},d,{style:a("iconEdit",t)}));case"delete":return(i=u==null?void 0:u.delete)!==null&&i!==void 0?i:_.jsx(T1,Object.assign({},d,{style:a("iconDelete",t),size:"1.45em"}));case"copy":return(o=u==null?void 0:u.copy)!==null&&o!==void 0?o:_.jsx(A1,Object.assign({},d,{style:a("iconCopy",t),size:"1.2em"}));case"ok":return(s=u==null?void 0:u.ok)!==null&&s!==void 0?s:_.jsx(R1,Object.assign({},d,{style:Object.assign({fontSize:"90%"},a("iconOk",t))}));case"cancel":return(l=u==null?void 0:u.cancel)!==null&&l!==void 0?l:_.jsx(j1,Object.assign({},d,{style:Object.assign({fontSize:"130%"},a("iconCancel",t))}));case"chevron":return(c=u==null?void 0:u.chevron)!==null&&c!==void 0?c:_.jsx(M1,{size:"1em",style:a("iconCollection",t)});default:return _.jsx(_.Fragment,{})}},Fc=({startEdit:e,handleDelete:t,handleAdd:n,enableClipboard:r,type:i,customButtons:o,nodeData:s,translate:l,keyboardControls:c,handleKeyboard:a,editConfirmRef:u,getNewKeyOptions:d,jsonStringify:f,onEditEvent:h,showIconTooltips:p})=>{const{getStyles:m}=at(),v=l("KEY_NEW",s),[w,C]=A.useState(v),[y,k]=A.useState(!1),{key:g,path:x,value:S}=s,R=Array.isArray(y),M=z=>{var H;if(h&&h(z?[...x,null]:null,z),!z)return void k(!1);const I=Object.keys(pn(s.fullData,x)),P=d?(H=d(s))===null||H===void 0?void 0:H.filter((E=>!I.includes(E))):null;P&&C(""),k(P==null||P)};return _.jsxs("div",{className:"jer-edit-buttons",style:{opacity:y?1:void 0},onClick:z=>z.stopPropagation(),children:[r&&_.jsx("div",{onClick:z=>{var H;z.stopPropagation();let I,P,E="value",j="",T=null;if(r){const D=$o(z);if(D&&c.clipboardModifier.includes(D)?(I=D1(x),j=I,E="path"):(I=S,j=typeof I=="object"?f(S):String(I)),!navigator.clipboard)return void(typeof r=="function"&&r({success:!1,value:I,stringValue:j,path:x,key:g,type:E,errorMessage:"Can't access clipboard API"}));(H=navigator.clipboard)===null||H===void 0||H.writeText(j).then((()=>P=!0)).catch(($=>{P=!1,T=$.message})).finally((()=>{typeof r=="function"&&r({success:P,errorMessage:T,value:I,stringValue:j,path:x,key:g,type:E})}))}},className:"jer-copy-pulse",title:p?l("TOOLTIP_COPY",s):"",children:_.jsx(Ot,{name:"copy",nodeData:s})}),e&&_.jsx("div",{onClick:e,title:p?l("TOOLTIP_EDIT",s):"",children:_.jsx(Ot,{name:"edit",nodeData:s})}),t&&_.jsx("div",{onClick:t,title:p?l("TOOLTIP_DELETE",s):"",children:_.jsx(Ot,{name:"delete",nodeData:s})}),n&&_.jsx("div",{onClick:()=>{i==="object"?M(!0):n("")},title:p?l("TOOLTIP_ADD",s):"",children:_.jsx(Ot,{name:"add",nodeData:s})}),o==null?void 0:o.map((({Element:z,onClick:H},I)=>_.jsx("div",{onClick:P=>H&&H(s,P),children:_.jsx(z,{nodeData:s})},I))),y&&n&&i==="object"&&_.jsxs(_.Fragment,{children:[R?_.jsxs("div",{className:"jer-select jer-select-keys",children:[_.jsxs("select",{name:"new-key-select",className:"jer-select-inner",onChange:z=>{n(z.target.value),M(!1)},defaultValue:"",autoFocus:!0,onKeyDown:z=>{a(z,{cancel:()=>M(!1)})},children:[_.jsx("option",{value:"",disabled:!0,children:y.length>0?l("KEY_SELECT",s):l("NO_KEY_OPTIONS",s)}),y.map((z=>_.jsx("option",{value:z,children:z},z)))]}),_.jsx("span",{className:"focus"})]}):_.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:w,onChange:z=>C(z.target.value),autoFocus:!0,onFocus:z=>z.target.select(),onKeyDown:z=>{a(z,{stringConfirm:()=>{n&&(M(!1),n(w),C(v))},cancel:()=>{M(!1),C(v)}})},style:m("input",s)}),_.jsx(zo,{onOk:()=>{R&&!w||(M(!1),n(w))},onCancel:()=>{M(!1)},nodeData:s,editConfirmRef:u,hideOk:R})]})]})},zo=({onOk:e,onCancel:t,nodeData:n,editConfirmRef:r,hideOk:i=!1})=>_.jsxs("div",{className:"jer-confirm-buttons",children:[!i&&_.jsx("div",{onClick:e,ref:r,children:_.jsx(Ot,{name:"ok",nodeData:n})}),_.jsx("div",{onClick:t,children:_.jsx(Ot,{name:"cancel",nodeData:n})})]}),D1=e=>e.reduce(((t,n)=>typeof n=="number"?`${t}[${n}]`:t===""?n:`${t}.${n}`),""),O1=["string","number","boolean","null","object","array"],qc=({props:e,collapsed:t})=>{const{data:n,nodeData:r,parentData:i,onEdit:o,onError:s,showErrorMessages:l,restrictEditFilter:c,restrictDeleteFilter:a,restrictAddFilter:u,restrictDragFilter:d,translate:f,errorMessageTimeout:h}=e,{currentlyEditingElement:p,setCurrentlyEditingElement:m}=Vt(),[v,w]=A.useState(null),C=Object.assign(Object.assign({},r),{collapsed:t}),{path:y,key:k,size:g}=C,x=Ft(y),S=!c(C),R=!a(C),M=!u(C),z=!d(C)&&R&&p===null,H=$=>{l&&(w($),setTimeout((()=>w(null)),h)),console.warn("Error",$)},I=A.useCallback((($,O)=>{H($.message),s&&s({currentData:C.fullData,errorValue:O,currentValue:n,name:k,path:y,error:$})}),[s,l]),P=p===x,E=p===`key_${x}`,j=typeof y.slice(-1)[0]=="number",T={isEditing:P,isEditingKey:E,isArray:j,canEditKey:i!==null&&S&&M&&R&&!j},D=k===""&&y.length>0?f("EMPTY_STRING",C):null;return{pathString:x,nodeData:C,path:y,name:k,size:g,canEdit:S,canDelete:R,canAdd:M,canDrag:z,error:v,showError:H,onError:I,setError:w,handleEditKey:$=>{if(m(null),k===$||!i)return;const O=y.slice(0,-1);if(Object.keys(i).includes($))return void I({code:"KEY_EXISTS",message:f("ERROR_KEY_EXISTS",C)},$);const b=Object.fromEntries(Object.entries(i).map((([N,L])=>N===k?[$,L]:[N,L])));o(b,O).then((N=>{N&&I({code:"UPDATE_ERROR",message:N},$)}))},derivedValues:T,emptyStringKey:D}},Yc=({canDrag:e,canDragOnto:t,path:n,nodeData:r,onMove:i,onError:o,translate:s})=>{const{getStyles:l}=at(),{dragSource:c,setDragSource:a}=Vt(),[u,d]=A.useState(!1),f=Ft(n),h=A.useMemo((()=>e?{onDragStart:w=>{w.stopPropagation(),a({path:n,pathString:f})},onDragEnd:w=>{w.stopPropagation(),a({path:null,pathString:null})}}:{}),[e,f]),p=A.useMemo((()=>w=>t?{onDragOver:C=>{C.stopPropagation(),C.preventDefault()},onDrop:C=>{C.stopPropagation(),v(w),a({path:null,pathString:null}),d(!1)},onDragEnter:C=>{var y;C.stopPropagation(),f.startsWith((y=c.pathString)!==null&&y!==void 0?y:"")||d(w)},onDragExit:C=>{C.stopPropagation(),d(!1)}}:{}),[c,t,f]),m=A.useMemo((()=>t&&c.pathString!==null?_.jsx("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:n.length}},p("below"))):null),[c,t,n.length]),v=w=>{var C,y;const k=(C=c.path)===null||C===void 0?void 0:C.slice(-1)[0],g=(y=c.path)===null||y===void 0?void 0:y.slice(0,-1).join("."),x=n.slice(0,-1).join(""),{parentData:S}=r;typeof k=="string"&&S&&!Array.isArray(S)&&Object.keys(S).includes(k)&&k in S&&g!==x?o({code:"KEY_EXISTS",message:s("ERROR_KEY_EXISTS",r)},k):i(c.path,n,w).then((R=>{R&&o({code:"UPDATE_ERROR",message:R},r.value)}))};return{dragSourceProps:h,getDropTargetProps:p,BottomDropTarget:m,DropTargetPadding:({position:w,nodeData:C})=>u===w?_.jsx("div",{className:"jer-drag-n-drop-padding",style:l("dropZone",C)}):null,handleDrop:v}},P1=(e,t,n,r)=>{var i,o,s;if(!t.current)return 0;const l=parseInt((i=getComputedStyle(n.current).getPropertyValue("line-height"))!==null&&i!==void 0?i:"16px"),c=((s=(o=t.current)===null||o===void 0?void 0:o.offsetWidth)!==null&&s!==void 0?s:0)/(.5*l),a=r(e).replace(/\\n/g,`
404
404
  `).split(`
405
- `).map((u=>Math.ceil(u.length/c))).reduce(((u,d)=>u+d),0)*l;return Math.min(a+30,window.innerHeight-50)},ti=({isEditingKey:e,canEditKey:t,pathString:n,path:r,name:i,handleKeyboard:o,handleEditKey:s,handleCancel:l,handleClick:c,keyValueArray:a,styles:u,getNextOrPrevious:d,emptyStringKey:f})=>{const{setCurrentlyEditingElement:h}=Vt();return e?_.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:n,defaultValue:i,autoFocus:!0,onFocus:p=>p.target.select(),onKeyDown:p=>o(p,{stringConfirm:()=>s(p.target.value),cancel:l,tabForward:()=>{if(s(p.target.value),a){const m=a==null?void 0:a[0][0];h(m?[...r,m]:d("next"))}else h(r)},tabBack:()=>{s(p.target.value),h(d("prev"))}}),style:{width:String(i).length/1.5+.5+"em"}}):_.jsxs("span",{className:"jer-key-text",style:Object.assign(Object.assign({},u),{minWidth:`${Math.min(String(i).length+1,5)}ch`,flexShrink:i.length>10?1:0}),onDoubleClick:()=>t&&h(r,"key"),onClick:c,children:[f?_.jsx("span",{className:"jer-empty-string",children:f}):i,i!==""||f?_.jsx("span",{className:"jer-key-colon",children:":"}):null]})},Xc=e=>{const{data:t,parentData:n,onEdit:r,onDelete:i,onChange:o,onMove:s,enableClipboard:l,canDragOnto:c,restrictTypeSelection:a,searchFilter:u,searchText:d,showLabel:f,stringTruncate:h,showStringQuotes:p,indent:m,translate:v,customNodeDefinitions:w,customNodeData:C,handleKeyboard:y,keyboardControls:k,sort:g,editConfirmRef:x,jsonStringify:S,showIconTooltips:R}=e,{getStyles:M}=at(),{setCurrentlyEditingElement:z,setCollapseState:H,previouslyEditedElement:I,setPreviouslyEditedElement:P,tabDirection:E,setTabDirection:j,previousValue:T,setPreviousValue:D}=Vt(),[$,O]=A.useState(typeof t=="function"?lo:t),{pathString:b,nodeData:N,path:L,name:V,canEdit:F,canDelete:Y,canDrag:q,error:X,onError:B,handleEditKey:U,emptyStringKey:oe,derivedValues:re}=qc({props:e}),{dragSourceProps:Q,getDropTargetProps:J,BottomDropTarget:W,DropTargetPadding:ue}=Yc({canDrag:q,canDragOnto:c,path:L,nodeData:N,onMove:s,onError:B,translate:v}),[fe,_e]=A.useState(co(t,C)),le=A.useCallback((G=>{if(!o)return void O(G);const ne=o({currentData:N.fullData,newValue:G,currentValue:$,name:V,path:L});O(ne)}),[o]);A.useEffect((()=>{O(typeof t=="function"?lo:t),_e(co(t,C))}),[t,X]);const{CustomNode:ye,customNodeProps:ke,hideKey:Ve,showEditTools:Me=!0,showOnEdit:Ie,showOnView:Xe,passOriginalNode:Ge}=C,$e=[...O1,...w.filter((({showInTypesSelector:G=!1,name:ne})=>G&&!!ne)).map((({name:G})=>G))],Oe=A.useMemo((()=>{if(typeof a=="boolean")return a?[]:$e;if(Array.isArray(a))return a;const G=a(N);return typeof G=="boolean"?G?[]:$e:G}),[N,a]),[Re,lt]=A.useState(((G,ne)=>{var ge;if(typeof G!="string")return null;const je=ne.filter((Se=>Se instanceof Object&&Se.enum&&Se.values.includes(G)&&Se.matchPriority));return je.sort(((Se,Ae)=>{var ut,ft;return((ut=Ae.matchPriority)!==null&&ut!==void 0?ut:0)-((ft=Se.matchPriority)!==null&&ft!==void 0?ft:0)})),(ge=je[0])!==null&&ge!==void 0?ge:null})($,Oe)),{isEditing:Ne}=re,vt=$c("value",N,u,d);if(Ne&&(!vt||!F)){const G=Dt(N.fullData,L,E,g);z(G||I)}if(!vt)return null;const Ue=G=>{let ne;if(z(null),D(null),G===void 0||(ge=>ge&&typeof ge=="object"&&"type"in ge&&"target"in ge&&"preventDefault"in ge&&typeof ge.preventDefault=="function")(G))switch(fe){case"object":ne={[v("DEFAULT_NEW_KEY",N)]:$};break;case"array":ne=$??[];break;case"number":{const ge=Number($);ne=isNaN(ge)?0:ge;break}default:ne=$}else ne=G;r(ne,L).then((ge=>{ge&&B({code:"UPDATE_ERROR",message:ge},ne)}))},Be=()=>{z(null),T===null?(O(t),D(null)):r(T,L)},{isEditingKey:xt,canEditKey:wt}=re,Le=!Ne&&X,Te=Ne&&Oe.length>1,ct=(fe!=="invalid"||ye)&&!X&&Me,ie=f&&!Ve,te=ye&&(Ne&&Ie||!Ne&&Xe),ce={value:$,parentData:n,setValue:le,isEditing:Ne,canEdit:F,setIsEditing:F?()=>z(L):()=>{},handleEdit:Ue,handleCancel:Be,path:L,stringTruncate:h,showStringQuotes:p,nodeData:N,enumType:Re,translate:v,handleKeyboard:y,keyboardCommon:{cancel:Be,tabForward:()=>{j("next"),P(b);const G=Dt(N.fullData,L,"next",g);G&&(Ue(),z(G))},tabBack:()=>{j("prev"),P(b);const G=Dt(N.fullData,L,"prev",g);G&&(Ue(),z(G))}}},pe={canEditKey:wt,isEditingKey:xt,pathString:b,path:L,name:V,handleKeyboard:y,handleEditKey:U,handleCancel:Be,styles:M("property",N),getNextOrPrevious:G=>Dt(N.fullData,L,G,g),emptyStringKey:oe},he=te?_.jsx(ye,Object.assign({},e,{value:$,customNodeProps:ke,setValue:le,handleEdit:Ue,handleCancel:Be,handleKeyPress:G=>y(G,{stringConfirm:Ue,cancel:Be}),isEditing:Ne,setIsEditing:()=>z(L),getStyles:M,originalNode:Ge?Na(t,ce):void 0,originalNodeKey:Ge?_.jsx(ti,Object.assign({},pe)):void 0,canEdit:F,keyboardCommon:ce.keyboardCommon,onError:B})):Na(t,ce);return _.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:n!==null?m/2+"em":0,position:"relative"},draggable:q},Q,J("above"),{children:[W,_.jsx(ue,{position:"above",nodeData:N}),_.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:V.length>10?"wrap":"nowrap"},children:[ie&&_.jsx(ti,Object.assign({},pe)),_.jsxs("div",{className:"jer-value-and-buttons",children:[_.jsx("div",{className:"jer-input-component",children:he}),Ne?_.jsx(zo,{onOk:Ue,onCancel:Be,nodeData:N,editConfirmRef:x}):ct&&_.jsx(Fc,{startEdit:F?()=>{D(T),z(L,Be)}:void 0,handleDelete:Y?()=>{i($,L).then((G=>{G&&B({code:"DELETE_ERROR",message:G},$)}))}:void 0,enableClipboard:l,translate:v,customButtons:e.customButtons,nodeData:N,handleKeyboard:y,keyboardControls:k,editConfirmRef:x,jsonStringify:S,showIconTooltips:R}),Te&&_.jsxs("div",{className:"jer-select jer-select-types",children:[_.jsx("select",{name:`${V}-type-select`,className:"jer-select-inner",onChange:G=>(ne=>{const ge=w.find((Ae=>Ae.name===ne));if(ge)return r(ge.defaultValue,L),_e(ne),lt(null),z(null),void H({path:L,collapsed:!1,includeChildren:!1});const je=Oe.find((Ae=>Ae instanceof Object&&Ae.enum===ne));if(je)return typeof $=="string"&&je.values.includes($)||r(je.values[0],L).then((Ae=>{Ae&&(B({code:"UPDATE_ERROR",message:Ae},Se),z(null))})),void lt(je);const Se=I1($,ne,v("DEFAULT_NEW_KEY",N),C!=null&&C.CustomNode?v("DEFAULT_STRING",N):void 0);["string","number","boolean"].includes(ne)||z(null),r(Se,L).then((Ae=>{Ae?(B({code:"UPDATE_ERROR",message:Ae},Se),z(null)):lt(null)}))})(G.target.value),value:Re?Re.enum:fe,children:Oe.map((G=>G instanceof Object&&"enum"in G?_.jsx("option",{value:G.enum,children:G.enum},G.enum):_.jsx("option",{value:G,children:G},G)))}),_.jsx("span",{className:"focus"})]}),Le&&_.jsx("span",{className:"jer-error-slug",style:M("error",N),children:X})]})]}),_.jsx(ue,{position:"below",nodeData:N})]}))},co=(e,t)=>t!=null&&t.CustomNode&&(t!=null&&t.name)&&t.showInTypesSelector?t.name:typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":e===null?"null":"invalid",Na=(e,t)=>{const n=co(e),{value:r}=t;switch(n){case"string":return _.jsx(w1,Object.assign({},t,{value:r}));case"number":return _.jsx(b1,Object.assign({},t,{value:r}));case"boolean":return _.jsx(E1,Object.assign({},t,{value:r}));case"null":return _.jsx(k1,Object.assign({},t));default:return _.jsx(S1,Object.assign({},t))}},I1=(e,t,n,r)=>{switch(t){case"string":return r??String(e);case"number":{const i=Number(e);return isNaN(i)?0:i}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},Gc=(e=[],t)=>{const n=e.filter((({condition:p})=>p(t)));if(n.length===0)return{};const r=n[0],{element:i,wrapperElement:o,customNodeProps:s,wrapperProps:l,hideKey:c=!1,showEditTools:a=!0,showOnEdit:u=!1,showOnView:d=!0,showCollectionWrapper:f=!0}=r,h=Pc(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:i,CustomWrapper:o,customNodeProps:s,wrapperProps:l,hideKey:c,showEditTools:a,showOnEdit:u,showOnView:d,showCollectionWrapper:f},h)},Uc=e=>{const{getStyles:t}=at(),{collapseState:n,setCollapseState:r,getMatchingCollapseState:i,currentlyEditingElement:o,setCurrentlyEditingElement:s,areChildrenBeingEdited:l,previousValue:c,setPreviousValue:a}=Vt(),{mainContainerRef:u,data:d,nodeData:f,parentData:h,showCollectionCount:p,onEdit:m,onAdd:v,onDelete:w,canDragOnto:C,collapseFilter:y,collapseAnimationTime:k,onMove:g,enableClipboard:x,onEditEvent:S,showIconTooltips:R,searchFilter:M,searchText:z,indent:H,sort:I,showArrayIndices:P,defaultValue:E,newKeyOptions:j,translate:T,customNodeDefinitions:D,customNodeData:$,jsonParse:O,jsonStringify:b,TextEditor:N,keyboardControls:L,handleKeyboard:V,insertAtTop:F,onCollapse:Y,editConfirmRef:q,collapseClickZones:X}=e,[B,U]=A.useState(b(d)),oe=y(f),{contentRef:re,isAnimating:Q,maxHeight:J,collapsed:W,animateCollapse:ue,cssTransitionValue:fe}=((Z,ve,Fe,ze,We)=>{const[vr,Gt]=A.useState(Fe?0:void 0),[Ut,wi]=A.useState(Fe),kn=A.useRef(!1),Sn=A.useRef(null),xr=A.useRef(0),wr=A.useRef(0),bi=ve/1e3+"s",Wt=A.useCallback((Cn=>{var Nn,Tn;if(Ut!==Cn){switch(window.clearTimeout(wr.current),kn.current=!0,Cn){case!0:{const Kt=(Tn=(Nn=Sn.current)===null||Nn===void 0?void 0:Nn.offsetHeight)!==null&&Tn!==void 0?Tn:0;xr.current=Kt,Gt(Kt),setTimeout((()=>{Gt(0)}),5);break}case!1:Gt(xr.current||P1(Z,Sn,ze,We))}wi(!Ut),wr.current=window.setTimeout((()=>{kn.current=!1,Cn||Gt(void 0)}),ve)}}),[ve,Ut,Z,ze,We]);return{contentRef:Sn,isAnimating:kn.current,animateCollapse:Wt,maxHeight:vr,collapsed:Ut,cssTransitionValue:bi}})(d,k,oe,u,b),{pathString:_e,nodeData:le,path:ye,name:ke,size:Ve,canEdit:Me,canDelete:Ie,canAdd:Xe,canDrag:Ge,error:$e,setError:Oe,onError:Re,handleEditKey:lt,emptyStringKey:Ne,derivedValues:vt}=qc({props:e,collapsed:W}),{dragSourceProps:Ue,getDropTargetProps:Be,BottomDropTarget:xt,DropTargetPadding:wt}=Yc({canDrag:Ge,canDragOnto:C,path:ye,nodeData:le,onMove:g,onError:Re,translate:T}),Le=A.useRef(!oe),{isEditing:Te,isEditingKey:ct,isArray:ie,canEditKey:te}=vt;A.useEffect((()=>{U(b(d))}),[d,b]),A.useEffect((()=>{const Z=y(le)&&!Te;Le.current=!Z,ue(Z)}),[y]),A.useEffect((()=>{if(n!==null){const Z=i(ye);Z&&(Le.current=!0,ue(Z.collapsed))}}),[n]);const ce=A.useRef(null),pe=A.useCallback(((Z,ve)=>{if(typeof E!="function")return E;const Fe=E(Z,ve);return Fe!==void 0?Fe:null}),[E]),he=A.useCallback((Z=>j?typeof j!="function"?j:j(Z):null),[j]),{CustomNode:G,customNodeProps:ne,CustomWrapper:ge,wrapperProps:je={},hideKey:Se,showEditTools:Ae=!0,showOnEdit:ut,showOnView:ft,showCollectionWrapper:vn=!0}=$,qt=l(_e);if(qt&&W&&ue(!1),!($c("collection",le,M,z)||le.level===0)&&!qt)return null;const bt=Array.isArray(d)?"array":"object",xn=bt==="array"?{open:"[",close:"]"}:{open:"{",close:"}"},fr=Z=>{if(Z.key!=="Tab"||Z.getModifierState("Shift"))V(Z,{objectConfirm:Xt,cancel:Ct});else{Z.preventDefault();const ve=zc(ce," ");U(ve)}},Yt=Z=>{Z.stopPropagation();const ve=$o(Z);if(ve&&L.collapseModifier.includes(ve))return Le.current=!0,void r({collapsed:!W,path:ye,includeChildren:!0});o&&o.includes(_e)||(Le.current=!0,r(null),Y&&Y({path:ye,collapsed:!W,includeChildren:!1}),ue(!W))},Xt=()=>{try{const Z=O(B);if(s(null),a(null),Oe(null),b(Z)===b(d))return;m(Z,ye).then((ve=>{ve&&Re({code:"UPDATE_ERROR",message:ve},Z)}))}catch{Re({code:"INVALID_JSON",message:T("ERROR_INVALID_JSON",le)},B)}},yi=ye.length>0?()=>{w(d,ye).then((Z=>{Z&&Re({code:"DELETE_ERROR",message:Z},d)}))}:void 0,Ct=()=>{s(null),c===null?(Oe(null),U(b(d)),a(null)):m(c,ye)},wn=p==="when-closed"?W:p,dr=!Te&&Ae,hr=(P||!ie)&&!Se&&ke!==void 0,vi=G&&(Te&&ut||!Te&&ft),bn=Object.entries(d).map((([Z,ve])=>[bt==="array"?Number(Z):Z,ve]));bt==="object"&&I(bn,(Z=>Z));const pr=Le.current?Te?_.jsxs("div",{className:"jer-collection-text-edit",children:[N?_.jsx(N,{value:B,onChange:U,onKeyDown:Z=>V(Z,{objectConfirm:Xt,cancel:Ct})}):_.jsx(Ic,{textAreaRef:ce,className:"jer-collection-text-area",name:_e,value:B,setValue:U,handleKeyPress:fr,styles:t("input",le)}),_.jsx("div",{className:"jer-collection-input-button-row",children:_.jsx(zo,{onOk:Xt,onCancel:Ct,nodeData:le,editConfirmRef:q})})]}):bn.map((([Z,ve],Fe)=>{const ze={key:Z,value:ve,path:[...ye,Z],level:ye.length+1,index:Fe,size:gn(ve)?Object.keys(ve).length:null,parentData:d,fullData:le.fullData},We=Gc(D,ze);return _.jsx("div",{className:"jer-collection-element",style:t("collectionElement",ze),children:gn(ve)&&!(We!=null&&We.renderCollectionAsValue)?_.jsx(Uc,Object.assign({},e,{data:ve,parentData:d,nodeData:ze,showCollectionCount:p,canDragOnto:Me,customNodeData:We}),Z):_.jsx(Xc,Object.assign({},e,{data:ve,parentData:d,nodeData:ze,canDragOnto:Me,showLabel:bt==="object"||P,customNodeData:We}),Z)},Z)})):null,En=!!vn&&W&&!qt;En||(Le.current=!0);const gr=Object.assign(Object.assign({},e),{data:d,value:d,parentData:h,nodeData:le,setValue:Z=>tn(void 0,void 0,void 0,(function*(){return yield m(Z,ye)})),handleEdit:Xt,handleCancel:Ct,handleKeyPress:fr,isEditing:Te,setIsEditing:()=>s(ye),getStyles:t,canDragOnto:Me,canEdit:Me,keyboardCommon:{},onError:Re}),xi=vi?_.jsx(G,Object.assign({customNodeProps:ne},gr,{children:pr})):pr,_n=dr&&_.jsx(Fc,{startEdit:Me?()=>{Le.current=!0,a(null),s(ye)}:void 0,handleAdd:Xe?Z=>{ue(!1);const ve=pe(le,Z);if(bt==="array"){const Fe=F.array?0:d.length,ze=F.array?{insert:!0}:{};v(ve,[...ye,Fe],ze).then((We=>{We&&Re({code:"ADD_ERROR",message:We},ve)}))}else if(Z in d)Re({code:"KEY_EXISTS",message:T("ERROR_KEY_EXISTS",le)},Z);else{const Fe=F.object?{insertBefore:0}:{};v(ve,[...ye,Z],Fe).then((ze=>{ze&&Re({code:"ADD_ERROR",message:ze},ve)}))}}:void 0,handleDelete:Ie?yi:void 0,enableClipboard:x,type:bt,nodeData:le,translate:T,customButtons:e.customButtons,keyboardControls:L,handleKeyboard:V,getNewKeyOptions:he,editConfirmRef:q,jsonStringify:b,onEditEvent:S,showIconTooltips:R}),mr={canEditKey:te,isEditingKey:ct,pathString:_e,path:ye,name:ke,handleKeyboard:V,handleEditKey:lt,handleCancel:Ct,keyValueArray:bn,styles:t("property",le),getNextOrPrevious:Z=>Dt(le.fullData,ye,Z,I),handleClick:X.includes("property")?Yt:Z=>Z.stopPropagation(),emptyStringKey:Ne},yr=_.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(ye.length===0?0:H/2)+"em"},t("collection",le)),{position:"relative"}),draggable:Ge},Ue,Be("above"),{children:[_.jsx("div",{className:"jer-clickzone",style:{width:H/2+1+"em",zIndex:10+2*le.level},onClick:X.includes("left")?Yt:void 0}),!Te&&xt,_.jsx(wt,{position:"above",nodeData:le}),vn?_.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:X.includes("header")?Yt:void 0,children:[_.jsxs("div",{className:"jer-collection-name",children:[_.jsx("div",{className:"jer-collapse-icon jer-accordion-icon"+(W?" jer-rotate-90":""),style:{zIndex:11+2*le.level,transition:fe},onClick:Yt,children:_.jsx(Ot,{name:"chevron",rotate:W,nodeData:le})}),hr&&_.jsx(ti,Object.assign({},mr)),!Te&&_.jsx("span",{className:"jer-brackets jer-bracket-open",style:t("bracket",le),children:xn.open})]}),!Te&&wn&&_.jsx("div",{className:"jer-collection-item-count"+(wn?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},t("itemCount",le)),{transition:fe}),children:Ve===1?T("ITEM_SINGLE",Object.assign(Object.assign({},le),{size:1}),1):T("ITEMS_MULTIPLE",le,Ve)}),_.jsx("div",{className:"jer-brackets"+(En?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},t("bracket",le)),{transition:fe}),children:xn.close}),_n]}):Se?_.jsx(_.Fragment,{}):_.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[_.jsx(ti,Object.assign({},mr)),_n]}),_.jsxs("div",{className:"jer-collection-inner",style:Object.assign(Object.assign({overflowY:En||Q?"clip":"visible",maxHeight:qt?void 0:J},t("collectionInner",le)),{transition:fe}),ref:re,children:[xi,_.jsx("div",{className:Te?"jer-collection-error-row":"jer-collection-error-row-edit",children:$e&&_.jsx("span",{className:"jer-error-slug",style:t("error",le),children:$e})}),!Te&&vn&&_.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},t("bracket",le)),{marginLeft:(H<3?-1:H<6?-.5:0)+"em"}),children:xn.close})]}),_.jsx(wt,{position:"below",nodeData:le})]}));return ge?_.jsx(ge,Object.assign({customNodeProps:je},gr,{children:yr})):yr},$1={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"},L1=(e,t)=>(n,r,i)=>((o,s,l,c,a)=>{if(s[c]){const d=s[c](l);if(d!==null)return d}const u=c in o?o[c]:$1[c];return a===void 0?u:u==null?void 0:u.replace("{{count}}",String(a))})(e,t,r,n,i);var Ta=[],zn=[];(function(e,t){if(e&&typeof document<"u"){var n,r=t.prepend===!0?"prepend":"append",i=t.singleTag===!0,o=typeof t.container=="string"?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(i){var s=Ta.indexOf(o);s===-1&&(s=Ta.push(o)-1,zn[s]={}),n=zn[s]&&zn[s][r]?zn[s][r]:zn[s][r]=l()}else n=l();e.charCodeAt(0)===65279&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function l(){var c=document.createElement("style");if(c.setAttribute("type","text/css"),t.attributes)for(var a=Object.keys(t.attributes),u=0;u<a.length;u++)c.setAttribute(a[u],t.attributes[a[u]]);var d=r==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(d,c),c}})(':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 z1=({data:e,setData:t,rootName:n="root",onUpdate:r=()=>{},onEdit:i=r,onDelete:o=r,onAdd:s=r,onChange:l,onError:c,onEditEvent:a,showErrorMessages:u=!0,enableClipboard:d=!0,indent:f=2,collapse:h=!1,collapseAnimationTime:p=300,showCollectionCount:m=!0,restrictEdit:v=!1,restrictDelete:w=!1,restrictAdd:C=!1,restrictTypeSelection:y=!1,restrictDrag:k=!0,viewOnly:g,searchFilter:x,searchText:S,searchDebounceTime:R=350,keySort:M=!1,showArrayIndices:z=!0,showStringQuotes:H=!0,showIconTooltips:I=!1,defaultValue:P=null,newKeyOptions:E,minWidth:j=250,maxWidth:T="min(600px, 90vw)",rootFontSize:D,stringTruncate:$=250,translations:O={},className:b,id:N,customText:L={},customNodeDefinitions:V=[],customButtons:F=[],jsonParse:Y=JSON.parse,jsonStringify:q=(W,ue)=>JSON.stringify(W,ue,2),TextEditor:X,errorMessageTimeout:B=2500,keyboardControls:U={},externalTriggers:oe,insertAtTop:re=!1,onCollapse:Q,collapseClickZones:J=["header","left"]})=>{const{getStyles:W}=at(),{setCurrentlyEditingElement:ue}=Vt(),fe=A.useMemo((()=>Vn(h)),[h]),_e=A.useMemo((()=>L1(O,L)),[O,L]),[le,ye]=A.useState(S),[ke,Ve]=(({setData:ie,data:te})=>{const[ce,pe]=A.useState(ie?void 0:te),he=A.useCallback((G=>{ie?ie(G):pe(G)}),[ie]);return A.useEffect((()=>{ie||pe(te)}),[te]),[ie?te:ce,he]})({setData:t,data:e}),Me=A.useRef(null);A.useEffect((()=>{ue(null);const ie=setTimeout((()=>ye(S)),R);return()=>clearTimeout(ie)}),[S,R]);const Ie={key:n,path:[],level:0,index:0,value:ke,size:typeof ke=="object"&&ke!==null?Object.keys(ke).length:1,parentData:null,fullData:ke},Xe=(ie,te)=>tn(void 0,void 0,void 0,(function*(){const ce=yield ie(te);if(ce===!0||ce===void 0)return void Ve(te.newData);const pe=V1(ce)?ce:["error",ce],[he,G]=pe;if(he==="error")return Ve(te.currentData),G===!1?_e("ERROR_UPDATE",Ie):String(G);Ve(G)})),Ge=A.useMemo((()=>Vn(v,g)),[v,g]),$e=A.useMemo((()=>Vn(w,g)),[w,g]),Oe=A.useMemo((()=>Vn(C,g)),[C,g]),Re=A.useMemo((()=>Vn(k,g)),[k,g]),lt=A.useMemo((()=>H1(x)),[x]),Ne=A.useMemo((()=>(ie=>{const te=Object.assign({},Sa);for(const ce of Object.keys(Sa)){const pe=ce;if(ie[pe]){const he=ie[pe],G=["clipboardModifier","collapseModifier"].includes(ce)?Array.isArray(he)?he:[he]:typeof he=="string"?{key:he}:he;te[pe]=G,["stringConfirm","numberConfirm","booleanConfirm"].forEach((ne=>{!ie[ne]&&ie.confirm&&(te[ne]=te.confirm)}))}}return te})(U)),[U]),vt=A.useCallback(((ie,te)=>((ce,pe,he)=>{const G=Object.entries(pe);for(const[ne,ge]of G)if(f1(he,ce[ne],ne)){he.preventDefault(),ge();break}})(Ne,te,ie)),[Ne]),Ue=A.useMemo((()=>{const ie=Aa(V,"stringifyReplacer");return te=>q(te,ie)}),[V,q]),Be=A.useMemo((()=>{const ie=Aa(V,"parseReviver");return te=>{const ce=Y(te,ie);return ao(ce)}}),[V,Y]),xt=A.useRef(null);((ie,te)=>{const{setCurrentlyEditingElement:ce,currentlyEditingElement:pe,setCollapseState:he}=Vt();A.useEffect((()=>{if(!ie)return;const{collapse:G,edit:ne}=ie;G&&he(G);const ge=!(ne!=null&&ne.path)||Ft(ne.path)===pe;switch(ne==null?void 0:ne.action){case"accept":ge&&(te.current&&te.current.click(),ce(null));break;case"cancel":ge&&ce(null);break;default:ne!=null&&ne.path&&ce(ne.path)}}),[ie])})(oe,xt);const wt=A.useCallback(((ie,te)=>{M!==!1&&(typeof M!="function"?ie.sort(((ce,pe)=>{const he=te(ce)[0],G=te(pe)[0];return he<G?-1:he>G?1:0})):ie.sort(((ce,pe)=>M(te(ce),te(pe)))))}),[M]),Le=Gc(V,Ie),Te={mainContainerRef:Me,name:n,nodeData:Ie,onEdit:(ie,te)=>tn(void 0,void 0,void 0,(function*(){const{currentData:ce,newData:pe,currentValue:he,newValue:G}=Hn(ke,te,ie,"update");if(he!==G)return yield Xe(i,{currentData:ce,newData:pe,currentValue:he,newValue:G,name:te.slice(-1)[0],path:te})})),onDelete:(ie,te)=>tn(void 0,void 0,void 0,(function*(){const{currentData:ce,newData:pe,currentValue:he,newValue:G}=Hn(ke,te,ie,"delete");return yield Xe(o,{currentData:ce,newData:pe,currentValue:he,newValue:G,name:te.slice(-1)[0],path:te})})),onAdd:(ie,te,ce)=>tn(void 0,void 0,void 0,(function*(){const{currentData:pe,newData:he,currentValue:G,newValue:ne}=Hn(ke,te,ie,"add",ce);return yield Xe(s,{currentData:pe,newData:he,currentValue:G,newValue:ne,name:te.slice(-1)[0],path:te})})),onChange:l,onError:c,onEditEvent:a,showErrorMessages:u,onMove:(ie,te,ce)=>tn(void 0,void 0,void 0,(function*(){if(ie===null)return;const{currentData:pe,newData:he,currentValue:G}=Hn(ke,ie,"","delete"),ne=ie.slice(-1)[0],ge=te.slice(0,-1),je=te.slice(-1)[0];let Se=typeof je=="number"?ce==="above"?je:je+1:typeof ne=="number"?`arr_${ne}`:ne;ie.slice(0,-1).join(".")===te.slice(0,-1).join(".")&&typeof ne=="number"&&typeof Se=="number"&&ne<Se&&(Se-=1);const Ae=typeof Se=="number"?{insert:!0}:ce==="above"?{insertBefore:je}:{insertAfter:je},{newData:ut,newValue:ft}=Hn(he,[...ge,Se],G,"add",Ae);return yield Xe(i,{currentData:pe,newData:ut,currentValue:G,newValue:ft,name:te.slice(-1)[0],path:te})})),showCollectionCount:m,collapseFilter:fe,collapseAnimationTime:p,restrictEditFilter:Ge,restrictDeleteFilter:$e,restrictAddFilter:Oe,restrictTypeSelection:y,restrictDragFilter:Re,canDragOnto:!1,searchFilter:lt,searchText:le,enableClipboard:d,keySort:M,sort:wt,showArrayIndices:z,showStringQuotes:H,showIconTooltips:I,indent:f,defaultValue:P,newKeyOptions:E,stringTruncate:$,translate:_e,customNodeDefinitions:V,customNodeData:Le,customButtons:F,parentData:null,jsonParse:Be,jsonStringify:Ue,TextEditor:X,errorMessageTimeout:B,handleKeyboard:vt,keyboardControls:Ne,insertAtTop:{object:re===!0||re==="object",array:re===!0||re==="array"},onCollapse:Q,editConfirmRef:xt,collapseClickZones:J},ct=Object.assign(Object.assign({},W("container",Ie)),{minWidth:j,maxWidth:T});return ct.fontSize=D??ct.fontSize,_.jsx("div",{id:N,ref:Me,className:`jer-editor-container ${b??""}`,style:ct,children:gn(ke)&&!Le.renderCollectionAsValue?_.jsx(Uc,Object.assign({data:ke},Te)):_.jsx(Xc,Object.assign({data:ke,showLabel:!0},Te))})},Jv=e=>{var t;const[n,r]=A.useState();return A.useEffect((()=>{const i=document.documentElement;r(i)}),[]),n?_.jsx(h1,{theme:(t=e.theme)!==null&&t!==void 0?t:Lo,icons:e.icons,docRoot:n,children:_.jsx(y1,{onEditEvent:e.onEditEvent,onCollapse:e.onCollapse,children:_.jsx(z1,Object.assign({},e))})}):null},Hn=(e,t,n,r,i={})=>{if(t.length===0)return{currentData:e,newData:n,currentValue:e,newValue:n};const o=Object.assign({remove:r==="delete"},i),s=r!=="add"?pn(e,t):void 0;return{currentData:e,newData:s1(e,t,n,o),currentValue:s,newValue:r!=="delete"?n:void 0}},Vn=(e,t)=>t?()=>!0:typeof e=="boolean"?()=>e:typeof e=="number"?({level:n})=>n>=e:e,H1=e=>{if(e!==void 0)return e==="value"?mn:e==="key"?ka:e==="all"?(t,n)=>mn(t,n)||ka(t,n):e},V1=e=>Array.isArray(e)&&e.length===2&&["error","value"].includes(e[0]),Aa=(e,t)=>{const n=t==="stringifyReplacer"?[r=>r===void 0?Hc:r]:[];if(n.push(...e.map((r=>r[t])).filter((r=>!!r))),n.length!==0)return(r,i)=>{let o=i;for(const s of n)o=s(o);return o}};export{xv as $,X1 as A,U1 as B,J1 as C,sv as D,av as E,mv as F,jv as G,G1 as H,wv as I,lv as J,Tv as K,_v as L,kv as M,Cv as N,Mv as O,Av as P,Pv as Q,F1 as R,Dv as S,zv as T,Nv as U,Hl as V,Jr as W,qv as X,ee as Y,Ev as Z,Sv as _,ou as a,Ov as a0,$v as a1,Xv as a2,iv as a3,Fv as a4,jy as a5,Wv as a6,Kv as a7,Po as a8,Uv as a9,Zv as aa,Qv as ab,pi as ac,Kr as ad,Iv as ae,K1 as af,ev as ag,yv as ah,bv as ai,W1 as aj,Z1 as ak,Yv as al,vv as am,Jv as an,yn as ao,iu as ap,Y1 as b,q1 as c,Ra as d,Q1 as e,tv as f,nv as g,hv as h,pv as i,_ as j,gv as k,fv as l,uv as m,dv as n,cv as o,ov as p,Lv as q,A as r,Rv as s,Hv as t,Vv as u,xe as v,Gv as w,ld as x,rv as y,Bv as z};
405
+ `).map((u=>Math.ceil(u.length/c))).reduce(((u,d)=>u+d),0)*l;return Math.min(a+30,window.innerHeight-50)},ti=({isEditingKey:e,canEditKey:t,pathString:n,path:r,name:i,handleKeyboard:o,handleEditKey:s,handleCancel:l,handleClick:c,keyValueArray:a,styles:u,getNextOrPrevious:d,emptyStringKey:f})=>{const{setCurrentlyEditingElement:h}=Vt();return e?_.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:n,defaultValue:i,autoFocus:!0,onFocus:p=>p.target.select(),onKeyDown:p=>o(p,{stringConfirm:()=>s(p.target.value),cancel:l,tabForward:()=>{if(s(p.target.value),a){const m=a==null?void 0:a[0][0];h(m?[...r,m]:d("next"))}else h(r)},tabBack:()=>{s(p.target.value),h(d("prev"))}}),style:{width:String(i).length/1.5+.5+"em"}}):_.jsxs("span",{className:"jer-key-text",style:Object.assign(Object.assign({},u),{minWidth:`${Math.min(String(i).length+1,5)}ch`,flexShrink:i.length>10?1:0}),onDoubleClick:()=>t&&h(r,"key"),onClick:c,children:[f?_.jsx("span",{className:"jer-empty-string",children:f}):i,i!==""||f?_.jsx("span",{className:"jer-key-colon",children:":"}):null]})},Xc=e=>{const{data:t,parentData:n,onEdit:r,onDelete:i,onChange:o,onMove:s,enableClipboard:l,canDragOnto:c,restrictTypeSelection:a,searchFilter:u,searchText:d,showLabel:f,stringTruncate:h,showStringQuotes:p,indent:m,translate:v,customNodeDefinitions:w,customNodeData:C,handleKeyboard:y,keyboardControls:k,sort:g,editConfirmRef:x,jsonStringify:S,showIconTooltips:R}=e,{getStyles:M}=at(),{setCurrentlyEditingElement:z,setCollapseState:H,previouslyEditedElement:I,setPreviouslyEditedElement:P,tabDirection:E,setTabDirection:j,previousValue:T,setPreviousValue:D}=Vt(),[$,O]=A.useState(typeof t=="function"?lo:t),{pathString:b,nodeData:N,path:L,name:V,canEdit:F,canDelete:Y,canDrag:q,error:X,onError:B,handleEditKey:U,emptyStringKey:oe,derivedValues:re}=qc({props:e}),{dragSourceProps:Q,getDropTargetProps:J,BottomDropTarget:W,DropTargetPadding:ue}=Yc({canDrag:q,canDragOnto:c,path:L,nodeData:N,onMove:s,onError:B,translate:v}),[fe,_e]=A.useState(co(t,C)),le=A.useCallback((G=>{if(!o)return void O(G);const ne=o({currentData:N.fullData,newValue:G,currentValue:$,name:V,path:L});O(ne)}),[o]);A.useEffect((()=>{O(typeof t=="function"?lo:t),_e(co(t,C))}),[t,X]);const{CustomNode:ye,customNodeProps:ke,hideKey:Ve,showEditTools:Me=!0,showOnEdit:Ie,showOnView:Xe,passOriginalNode:Ge}=C,$e=[...O1,...w.filter((({showInTypesSelector:G=!1,name:ne})=>G&&!!ne)).map((({name:G})=>G))],Oe=A.useMemo((()=>{if(typeof a=="boolean")return a?[]:$e;if(Array.isArray(a))return a;const G=a(N);return typeof G=="boolean"?G?[]:$e:G}),[N,a]),[Re,lt]=A.useState(((G,ne)=>{var ge;if(typeof G!="string")return null;const je=ne.filter((Se=>Se instanceof Object&&Se.enum&&Se.values.includes(G)&&Se.matchPriority));return je.sort(((Se,Ae)=>{var ut,ft;return((ut=Ae.matchPriority)!==null&&ut!==void 0?ut:0)-((ft=Se.matchPriority)!==null&&ft!==void 0?ft:0)})),(ge=je[0])!==null&&ge!==void 0?ge:null})($,Oe)),{isEditing:Ne}=re,vt=$c("value",N,u,d);if(Ne&&(!vt||!F)){const G=Dt(N.fullData,L,E,g);z(G||I)}if(!vt)return null;const Ue=G=>{let ne;if(z(null),D(null),G===void 0||(ge=>ge&&typeof ge=="object"&&"type"in ge&&"target"in ge&&"preventDefault"in ge&&typeof ge.preventDefault=="function")(G))switch(fe){case"object":ne={[v("DEFAULT_NEW_KEY",N)]:$};break;case"array":ne=$??[];break;case"number":{const ge=Number($);ne=isNaN(ge)?0:ge;break}default:ne=$}else ne=G;r(ne,L).then((ge=>{ge&&B({code:"UPDATE_ERROR",message:ge},ne)}))},Be=()=>{z(null),T===null?(O(t),D(null)):r(T,L)},{isEditingKey:xt,canEditKey:wt}=re,Le=!Ne&&X,Te=Ne&&Oe.length>1,ct=(fe!=="invalid"||ye)&&!X&&Me,ie=f&&!Ve,te=ye&&(Ne&&Ie||!Ne&&Xe),ce={value:$,parentData:n,setValue:le,isEditing:Ne,canEdit:F,setIsEditing:F?()=>z(L):()=>{},handleEdit:Ue,handleCancel:Be,path:L,stringTruncate:h,showStringQuotes:p,nodeData:N,enumType:Re,translate:v,handleKeyboard:y,keyboardCommon:{cancel:Be,tabForward:()=>{j("next"),P(b);const G=Dt(N.fullData,L,"next",g);G&&(Ue(),z(G))},tabBack:()=>{j("prev"),P(b);const G=Dt(N.fullData,L,"prev",g);G&&(Ue(),z(G))}}},pe={canEditKey:wt,isEditingKey:xt,pathString:b,path:L,name:V,handleKeyboard:y,handleEditKey:U,handleCancel:Be,styles:M("property",N),getNextOrPrevious:G=>Dt(N.fullData,L,G,g),emptyStringKey:oe},he=te?_.jsx(ye,Object.assign({},e,{value:$,customNodeProps:ke,setValue:le,handleEdit:Ue,handleCancel:Be,handleKeyPress:G=>y(G,{stringConfirm:Ue,cancel:Be}),isEditing:Ne,setIsEditing:()=>z(L),getStyles:M,originalNode:Ge?Na(t,ce):void 0,originalNodeKey:Ge?_.jsx(ti,Object.assign({},pe)):void 0,canEdit:F,keyboardCommon:ce.keyboardCommon,onError:B})):Na(t,ce);return _.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:n!==null?m/2+"em":0,position:"relative"},draggable:q},Q,J("above"),{children:[W,_.jsx(ue,{position:"above",nodeData:N}),_.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:V.length>10?"wrap":"nowrap"},children:[ie&&_.jsx(ti,Object.assign({},pe)),_.jsxs("div",{className:"jer-value-and-buttons",children:[_.jsx("div",{className:"jer-input-component",children:he}),Ne?_.jsx(zo,{onOk:Ue,onCancel:Be,nodeData:N,editConfirmRef:x}):ct&&_.jsx(Fc,{startEdit:F?()=>{D(T),z(L,Be)}:void 0,handleDelete:Y?()=>{i($,L).then((G=>{G&&B({code:"DELETE_ERROR",message:G},$)}))}:void 0,enableClipboard:l,translate:v,customButtons:e.customButtons,nodeData:N,handleKeyboard:y,keyboardControls:k,editConfirmRef:x,jsonStringify:S,showIconTooltips:R}),Te&&_.jsxs("div",{className:"jer-select jer-select-types",children:[_.jsx("select",{name:`${V}-type-select`,className:"jer-select-inner",onChange:G=>(ne=>{const ge=w.find((Ae=>Ae.name===ne));if(ge)return r(ge.defaultValue,L),_e(ne),lt(null),z(null),void H({path:L,collapsed:!1,includeChildren:!1});const je=Oe.find((Ae=>Ae instanceof Object&&Ae.enum===ne));if(je)return typeof $=="string"&&je.values.includes($)||r(je.values[0],L).then((Ae=>{Ae&&(B({code:"UPDATE_ERROR",message:Ae},Se),z(null))})),void lt(je);const Se=I1($,ne,v("DEFAULT_NEW_KEY",N),C!=null&&C.CustomNode?v("DEFAULT_STRING",N):void 0);["string","number","boolean"].includes(ne)||z(null),r(Se,L).then((Ae=>{Ae?(B({code:"UPDATE_ERROR",message:Ae},Se),z(null)):lt(null)}))})(G.target.value),value:Re?Re.enum:fe,children:Oe.map((G=>G instanceof Object&&"enum"in G?_.jsx("option",{value:G.enum,children:G.enum},G.enum):_.jsx("option",{value:G,children:G},G)))}),_.jsx("span",{className:"focus"})]}),Le&&_.jsx("span",{className:"jer-error-slug",style:M("error",N),children:X})]})]}),_.jsx(ue,{position:"below",nodeData:N})]}))},co=(e,t)=>t!=null&&t.CustomNode&&(t!=null&&t.name)&&t.showInTypesSelector?t.name:typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":e===null?"null":"invalid",Na=(e,t)=>{const n=co(e),{value:r}=t;switch(n){case"string":return _.jsx(w1,Object.assign({},t,{value:r}));case"number":return _.jsx(b1,Object.assign({},t,{value:r}));case"boolean":return _.jsx(E1,Object.assign({},t,{value:r}));case"null":return _.jsx(k1,Object.assign({},t));default:return _.jsx(S1,Object.assign({},t))}},I1=(e,t,n,r)=>{switch(t){case"string":return r??String(e);case"number":{const i=Number(e);return isNaN(i)?0:i}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},Gc=(e=[],t)=>{const n=e.filter((({condition:p})=>p(t)));if(n.length===0)return{};const r=n[0],{element:i,wrapperElement:o,customNodeProps:s,wrapperProps:l,hideKey:c=!1,showEditTools:a=!0,showOnEdit:u=!1,showOnView:d=!0,showCollectionWrapper:f=!0}=r,h=Pc(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:i,CustomWrapper:o,customNodeProps:s,wrapperProps:l,hideKey:c,showEditTools:a,showOnEdit:u,showOnView:d,showCollectionWrapper:f},h)},Uc=e=>{const{getStyles:t}=at(),{collapseState:n,setCollapseState:r,getMatchingCollapseState:i,currentlyEditingElement:o,setCurrentlyEditingElement:s,areChildrenBeingEdited:l,previousValue:c,setPreviousValue:a}=Vt(),{mainContainerRef:u,data:d,nodeData:f,parentData:h,showCollectionCount:p,onEdit:m,onAdd:v,onDelete:w,canDragOnto:C,collapseFilter:y,collapseAnimationTime:k,onMove:g,enableClipboard:x,onEditEvent:S,showIconTooltips:R,searchFilter:M,searchText:z,indent:H,sort:I,showArrayIndices:P,defaultValue:E,newKeyOptions:j,translate:T,customNodeDefinitions:D,customNodeData:$,jsonParse:O,jsonStringify:b,TextEditor:N,keyboardControls:L,handleKeyboard:V,insertAtTop:F,onCollapse:Y,editConfirmRef:q,collapseClickZones:X}=e,[B,U]=A.useState(b(d)),oe=y(f),{contentRef:re,isAnimating:Q,maxHeight:J,collapsed:W,animateCollapse:ue,cssTransitionValue:fe}=((Z,ve,Fe,ze,We)=>{const[vr,Gt]=A.useState(Fe?0:void 0),[Ut,wi]=A.useState(Fe),kn=A.useRef(!1),Sn=A.useRef(null),xr=A.useRef(0),wr=A.useRef(0),bi=ve/1e3+"s",Wt=A.useCallback((Cn=>{var Nn,Tn;if(Ut!==Cn){switch(window.clearTimeout(wr.current),kn.current=!0,Cn){case!0:{const Kt=(Tn=(Nn=Sn.current)===null||Nn===void 0?void 0:Nn.offsetHeight)!==null&&Tn!==void 0?Tn:0;xr.current=Kt,Gt(Kt),setTimeout((()=>{Gt(0)}),5);break}case!1:Gt(xr.current||P1(Z,Sn,ze,We))}wi(!Ut),wr.current=window.setTimeout((()=>{kn.current=!1,Cn||Gt(void 0)}),ve)}}),[ve,Ut,Z,ze,We]);return{contentRef:Sn,isAnimating:kn.current,animateCollapse:Wt,maxHeight:vr,collapsed:Ut,cssTransitionValue:bi}})(d,k,oe,u,b),{pathString:_e,nodeData:le,path:ye,name:ke,size:Ve,canEdit:Me,canDelete:Ie,canAdd:Xe,canDrag:Ge,error:$e,setError:Oe,onError:Re,handleEditKey:lt,emptyStringKey:Ne,derivedValues:vt}=qc({props:e,collapsed:W}),{dragSourceProps:Ue,getDropTargetProps:Be,BottomDropTarget:xt,DropTargetPadding:wt}=Yc({canDrag:Ge,canDragOnto:C,path:ye,nodeData:le,onMove:g,onError:Re,translate:T}),Le=A.useRef(!oe),{isEditing:Te,isEditingKey:ct,isArray:ie,canEditKey:te}=vt;A.useEffect((()=>{U(b(d))}),[d,b]),A.useEffect((()=>{const Z=y(le)&&!Te;Le.current=!Z,ue(Z)}),[y]),A.useEffect((()=>{if(n!==null){const Z=i(ye);Z&&(Le.current=!0,ue(Z.collapsed))}}),[n]);const ce=A.useRef(null),pe=A.useCallback(((Z,ve)=>{if(typeof E!="function")return E;const Fe=E(Z,ve);return Fe!==void 0?Fe:null}),[E]),he=A.useCallback((Z=>j?typeof j!="function"?j:j(Z):null),[j]),{CustomNode:G,customNodeProps:ne,CustomWrapper:ge,wrapperProps:je={},hideKey:Se,showEditTools:Ae=!0,showOnEdit:ut,showOnView:ft,showCollectionWrapper:vn=!0}=$,qt=l(_e);if(qt&&W&&ue(!1),!($c("collection",le,M,z)||le.level===0)&&!qt)return null;const bt=Array.isArray(d)?"array":"object",xn=bt==="array"?{open:"[",close:"]"}:{open:"{",close:"}"},fr=Z=>{if(Z.key!=="Tab"||Z.getModifierState("Shift"))V(Z,{objectConfirm:Xt,cancel:Ct});else{Z.preventDefault();const ve=zc(ce," ");U(ve)}},Yt=Z=>{Z.stopPropagation();const ve=$o(Z);if(ve&&L.collapseModifier.includes(ve))return Le.current=!0,void r({collapsed:!W,path:ye,includeChildren:!0});o&&o.includes(_e)||(Le.current=!0,r(null),Y&&Y({path:ye,collapsed:!W,includeChildren:!1}),ue(!W))},Xt=()=>{try{const Z=O(B);if(s(null),a(null),Oe(null),b(Z)===b(d))return;m(Z,ye).then((ve=>{ve&&Re({code:"UPDATE_ERROR",message:ve},Z)}))}catch{Re({code:"INVALID_JSON",message:T("ERROR_INVALID_JSON",le)},B)}},yi=ye.length>0?()=>{w(d,ye).then((Z=>{Z&&Re({code:"DELETE_ERROR",message:Z},d)}))}:void 0,Ct=()=>{s(null),c===null?(Oe(null),U(b(d)),a(null)):m(c,ye)},wn=p==="when-closed"?W:p,dr=!Te&&Ae,hr=(P||!ie)&&!Se&&ke!==void 0,vi=G&&(Te&&ut||!Te&&ft),bn=Object.entries(d).map((([Z,ve])=>[bt==="array"?Number(Z):Z,ve]));bt==="object"&&I(bn,(Z=>Z));const pr=Le.current?Te?_.jsxs("div",{className:"jer-collection-text-edit",children:[N?_.jsx(N,{value:B,onChange:U,onKeyDown:Z=>V(Z,{objectConfirm:Xt,cancel:Ct})}):_.jsx(Ic,{textAreaRef:ce,className:"jer-collection-text-area",name:_e,value:B,setValue:U,handleKeyPress:fr,styles:t("input",le)}),_.jsx("div",{className:"jer-collection-input-button-row",children:_.jsx(zo,{onOk:Xt,onCancel:Ct,nodeData:le,editConfirmRef:q})})]}):bn.map((([Z,ve],Fe)=>{const ze={key:Z,value:ve,path:[...ye,Z],level:ye.length+1,index:Fe,size:gn(ve)?Object.keys(ve).length:null,parentData:d,fullData:le.fullData},We=Gc(D,ze);return _.jsx("div",{className:"jer-collection-element",style:t("collectionElement",ze),children:gn(ve)&&!(We!=null&&We.renderCollectionAsValue)?_.jsx(Uc,Object.assign({},e,{data:ve,parentData:d,nodeData:ze,showCollectionCount:p,canDragOnto:Me,customNodeData:We}),Z):_.jsx(Xc,Object.assign({},e,{data:ve,parentData:d,nodeData:ze,canDragOnto:Me,showLabel:bt==="object"||P,customNodeData:We}),Z)},Z)})):null,En=!!vn&&W&&!qt;En||(Le.current=!0);const gr=Object.assign(Object.assign({},e),{data:d,value:d,parentData:h,nodeData:le,setValue:Z=>tn(void 0,void 0,void 0,(function*(){return yield m(Z,ye)})),handleEdit:Xt,handleCancel:Ct,handleKeyPress:fr,isEditing:Te,setIsEditing:()=>s(ye),getStyles:t,canDragOnto:Me,canEdit:Me,keyboardCommon:{},onError:Re}),xi=vi?_.jsx(G,Object.assign({customNodeProps:ne},gr,{children:pr})):pr,_n=dr&&_.jsx(Fc,{startEdit:Me?()=>{Le.current=!0,a(null),s(ye)}:void 0,handleAdd:Xe?Z=>{ue(!1);const ve=pe(le,Z);if(bt==="array"){const Fe=F.array?0:d.length,ze=F.array?{insert:!0}:{};v(ve,[...ye,Fe],ze).then((We=>{We&&Re({code:"ADD_ERROR",message:We},ve)}))}else if(Z in d)Re({code:"KEY_EXISTS",message:T("ERROR_KEY_EXISTS",le)},Z);else{const Fe=F.object?{insertBefore:0}:{};v(ve,[...ye,Z],Fe).then((ze=>{ze&&Re({code:"ADD_ERROR",message:ze},ve)}))}}:void 0,handleDelete:Ie?yi:void 0,enableClipboard:x,type:bt,nodeData:le,translate:T,customButtons:e.customButtons,keyboardControls:L,handleKeyboard:V,getNewKeyOptions:he,editConfirmRef:q,jsonStringify:b,onEditEvent:S,showIconTooltips:R}),mr={canEditKey:te,isEditingKey:ct,pathString:_e,path:ye,name:ke,handleKeyboard:V,handleEditKey:lt,handleCancel:Ct,keyValueArray:bn,styles:t("property",le),getNextOrPrevious:Z=>Dt(le.fullData,ye,Z,I),handleClick:X.includes("property")?Yt:Z=>Z.stopPropagation(),emptyStringKey:Ne},yr=_.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(ye.length===0?0:H/2)+"em"},t("collection",le)),{position:"relative"}),draggable:Ge},Ue,Be("above"),{children:[_.jsx("div",{className:"jer-clickzone",style:{width:H/2+1+"em",zIndex:10+2*le.level},onClick:X.includes("left")?Yt:void 0}),!Te&&xt,_.jsx(wt,{position:"above",nodeData:le}),vn?_.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:X.includes("header")?Yt:void 0,children:[_.jsxs("div",{className:"jer-collection-name",children:[_.jsx("div",{className:"jer-collapse-icon jer-accordion-icon"+(W?" jer-rotate-90":""),style:{zIndex:11+2*le.level,transition:fe},onClick:Yt,children:_.jsx(Ot,{name:"chevron",rotate:W,nodeData:le})}),hr&&_.jsx(ti,Object.assign({},mr)),!Te&&_.jsx("span",{className:"jer-brackets jer-bracket-open",style:t("bracket",le),children:xn.open})]}),!Te&&wn&&_.jsx("div",{className:"jer-collection-item-count"+(wn?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},t("itemCount",le)),{transition:fe}),children:Ve===1?T("ITEM_SINGLE",Object.assign(Object.assign({},le),{size:1}),1):T("ITEMS_MULTIPLE",le,Ve)}),_.jsx("div",{className:"jer-brackets"+(En?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},t("bracket",le)),{transition:fe}),children:xn.close}),_n]}):Se?_.jsx(_.Fragment,{}):_.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[_.jsx(ti,Object.assign({},mr)),_n]}),_.jsxs("div",{className:"jer-collection-inner",style:Object.assign(Object.assign({overflowY:En||Q?"clip":"visible",maxHeight:qt?void 0:J},t("collectionInner",le)),{transition:fe}),ref:re,children:[xi,_.jsx("div",{className:Te?"jer-collection-error-row":"jer-collection-error-row-edit",children:$e&&_.jsx("span",{className:"jer-error-slug",style:t("error",le),children:$e})}),!Te&&vn&&_.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},t("bracket",le)),{marginLeft:(H<3?-1:H<6?-.5:0)+"em"}),children:xn.close})]}),_.jsx(wt,{position:"below",nodeData:le})]}));return ge?_.jsx(ge,Object.assign({customNodeProps:je},gr,{children:yr})):yr},$1={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"},L1=(e,t)=>(n,r,i)=>((o,s,l,c,a)=>{if(s[c]){const d=s[c](l);if(d!==null)return d}const u=c in o?o[c]:$1[c];return a===void 0?u:u==null?void 0:u.replace("{{count}}",String(a))})(e,t,r,n,i);var Ta=[],zn=[];(function(e,t){if(e&&typeof document<"u"){var n,r=t.prepend===!0?"prepend":"append",i=t.singleTag===!0,o=typeof t.container=="string"?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(i){var s=Ta.indexOf(o);s===-1&&(s=Ta.push(o)-1,zn[s]={}),n=zn[s]&&zn[s][r]?zn[s][r]:zn[s][r]=l()}else n=l();e.charCodeAt(0)===65279&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function l(){var c=document.createElement("style");if(c.setAttribute("type","text/css"),t.attributes)for(var a=Object.keys(t.attributes),u=0;u<a.length;u++)c.setAttribute(a[u],t.attributes[a[u]]);var d=r==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(d,c),c}})(':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 z1=({data:e,setData:t,rootName:n="root",onUpdate:r=()=>{},onEdit:i=r,onDelete:o=r,onAdd:s=r,onChange:l,onError:c,onEditEvent:a,showErrorMessages:u=!0,enableClipboard:d=!0,indent:f=2,collapse:h=!1,collapseAnimationTime:p=300,showCollectionCount:m=!0,restrictEdit:v=!1,restrictDelete:w=!1,restrictAdd:C=!1,restrictTypeSelection:y=!1,restrictDrag:k=!0,viewOnly:g,searchFilter:x,searchText:S,searchDebounceTime:R=350,keySort:M=!1,showArrayIndices:z=!0,showStringQuotes:H=!0,showIconTooltips:I=!1,defaultValue:P=null,newKeyOptions:E,minWidth:j=250,maxWidth:T="min(600px, 90vw)",rootFontSize:D,stringTruncate:$=250,translations:O={},className:b,id:N,customText:L={},customNodeDefinitions:V=[],customButtons:F=[],jsonParse:Y=JSON.parse,jsonStringify:q=(W,ue)=>JSON.stringify(W,ue,2),TextEditor:X,errorMessageTimeout:B=2500,keyboardControls:U={},externalTriggers:oe,insertAtTop:re=!1,onCollapse:Q,collapseClickZones:J=["header","left"]})=>{const{getStyles:W}=at(),{setCurrentlyEditingElement:ue}=Vt(),fe=A.useMemo((()=>Vn(h)),[h]),_e=A.useMemo((()=>L1(O,L)),[O,L]),[le,ye]=A.useState(S),[ke,Ve]=(({setData:ie,data:te})=>{const[ce,pe]=A.useState(ie?void 0:te),he=A.useCallback((G=>{ie?ie(G):pe(G)}),[ie]);return A.useEffect((()=>{ie||pe(te)}),[te]),[ie?te:ce,he]})({setData:t,data:e}),Me=A.useRef(null);A.useEffect((()=>{ue(null);const ie=setTimeout((()=>ye(S)),R);return()=>clearTimeout(ie)}),[S,R]);const Ie={key:n,path:[],level:0,index:0,value:ke,size:typeof ke=="object"&&ke!==null?Object.keys(ke).length:1,parentData:null,fullData:ke},Xe=(ie,te)=>tn(void 0,void 0,void 0,(function*(){const ce=yield ie(te);if(ce===!0||ce===void 0)return void Ve(te.newData);const pe=V1(ce)?ce:["error",ce],[he,G]=pe;if(he==="error")return Ve(te.currentData),G===!1?_e("ERROR_UPDATE",Ie):String(G);Ve(G)})),Ge=A.useMemo((()=>Vn(v,g)),[v,g]),$e=A.useMemo((()=>Vn(w,g)),[w,g]),Oe=A.useMemo((()=>Vn(C,g)),[C,g]),Re=A.useMemo((()=>Vn(k,g)),[k,g]),lt=A.useMemo((()=>H1(x)),[x]),Ne=A.useMemo((()=>(ie=>{const te=Object.assign({},Sa);for(const ce of Object.keys(Sa)){const pe=ce;if(ie[pe]){const he=ie[pe],G=["clipboardModifier","collapseModifier"].includes(ce)?Array.isArray(he)?he:[he]:typeof he=="string"?{key:he}:he;te[pe]=G,["stringConfirm","numberConfirm","booleanConfirm"].forEach((ne=>{!ie[ne]&&ie.confirm&&(te[ne]=te.confirm)}))}}return te})(U)),[U]),vt=A.useCallback(((ie,te)=>((ce,pe,he)=>{const G=Object.entries(pe);for(const[ne,ge]of G)if(f1(he,ce[ne],ne)){he.preventDefault(),ge();break}})(Ne,te,ie)),[Ne]),Ue=A.useMemo((()=>{const ie=Aa(V,"stringifyReplacer");return te=>q(te,ie)}),[V,q]),Be=A.useMemo((()=>{const ie=Aa(V,"parseReviver");return te=>{const ce=Y(te,ie);return ao(ce)}}),[V,Y]),xt=A.useRef(null);((ie,te)=>{const{setCurrentlyEditingElement:ce,currentlyEditingElement:pe,setCollapseState:he}=Vt();A.useEffect((()=>{if(!ie)return;const{collapse:G,edit:ne}=ie;G&&he(G);const ge=!(ne!=null&&ne.path)||Ft(ne.path)===pe;switch(ne==null?void 0:ne.action){case"accept":ge&&(te.current&&te.current.click(),ce(null));break;case"cancel":ge&&ce(null);break;default:ne!=null&&ne.path&&ce(ne.path)}}),[ie])})(oe,xt);const wt=A.useCallback(((ie,te)=>{M!==!1&&(typeof M!="function"?ie.sort(((ce,pe)=>{const he=te(ce)[0],G=te(pe)[0];return he<G?-1:he>G?1:0})):ie.sort(((ce,pe)=>M(te(ce),te(pe)))))}),[M]),Le=Gc(V,Ie),Te={mainContainerRef:Me,name:n,nodeData:Ie,onEdit:(ie,te)=>tn(void 0,void 0,void 0,(function*(){const{currentData:ce,newData:pe,currentValue:he,newValue:G}=Hn(ke,te,ie,"update");if(he!==G)return yield Xe(i,{currentData:ce,newData:pe,currentValue:he,newValue:G,name:te.slice(-1)[0],path:te})})),onDelete:(ie,te)=>tn(void 0,void 0,void 0,(function*(){const{currentData:ce,newData:pe,currentValue:he,newValue:G}=Hn(ke,te,ie,"delete");return yield Xe(o,{currentData:ce,newData:pe,currentValue:he,newValue:G,name:te.slice(-1)[0],path:te})})),onAdd:(ie,te,ce)=>tn(void 0,void 0,void 0,(function*(){const{currentData:pe,newData:he,currentValue:G,newValue:ne}=Hn(ke,te,ie,"add",ce);return yield Xe(s,{currentData:pe,newData:he,currentValue:G,newValue:ne,name:te.slice(-1)[0],path:te})})),onChange:l,onError:c,onEditEvent:a,showErrorMessages:u,onMove:(ie,te,ce)=>tn(void 0,void 0,void 0,(function*(){if(ie===null)return;const{currentData:pe,newData:he,currentValue:G}=Hn(ke,ie,"","delete"),ne=ie.slice(-1)[0],ge=te.slice(0,-1),je=te.slice(-1)[0];let Se=typeof je=="number"?ce==="above"?je:je+1:typeof ne=="number"?`arr_${ne}`:ne;ie.slice(0,-1).join(".")===te.slice(0,-1).join(".")&&typeof ne=="number"&&typeof Se=="number"&&ne<Se&&(Se-=1);const Ae=typeof Se=="number"?{insert:!0}:ce==="above"?{insertBefore:je}:{insertAfter:je},{newData:ut,newValue:ft}=Hn(he,[...ge,Se],G,"add",Ae);return yield Xe(i,{currentData:pe,newData:ut,currentValue:G,newValue:ft,name:te.slice(-1)[0],path:te})})),showCollectionCount:m,collapseFilter:fe,collapseAnimationTime:p,restrictEditFilter:Ge,restrictDeleteFilter:$e,restrictAddFilter:Oe,restrictTypeSelection:y,restrictDragFilter:Re,canDragOnto:!1,searchFilter:lt,searchText:le,enableClipboard:d,keySort:M,sort:wt,showArrayIndices:z,showStringQuotes:H,showIconTooltips:I,indent:f,defaultValue:P,newKeyOptions:E,stringTruncate:$,translate:_e,customNodeDefinitions:V,customNodeData:Le,customButtons:F,parentData:null,jsonParse:Be,jsonStringify:Ue,TextEditor:X,errorMessageTimeout:B,handleKeyboard:vt,keyboardControls:Ne,insertAtTop:{object:re===!0||re==="object",array:re===!0||re==="array"},onCollapse:Q,editConfirmRef:xt,collapseClickZones:J},ct=Object.assign(Object.assign({},W("container",Ie)),{minWidth:j,maxWidth:T});return ct.fontSize=D??ct.fontSize,_.jsx("div",{id:N,ref:Me,className:`jer-editor-container ${b??""}`,style:ct,children:gn(ke)&&!Le.renderCollectionAsValue?_.jsx(Uc,Object.assign({data:ke},Te)):_.jsx(Xc,Object.assign({data:ke,showLabel:!0},Te))})},Jv=e=>{var t;const[n,r]=A.useState();return A.useEffect((()=>{const i=document.documentElement;r(i)}),[]),n?_.jsx(h1,{theme:(t=e.theme)!==null&&t!==void 0?t:Lo,icons:e.icons,docRoot:n,children:_.jsx(y1,{onEditEvent:e.onEditEvent,onCollapse:e.onCollapse,children:_.jsx(z1,Object.assign({},e))})}):null},Hn=(e,t,n,r,i={})=>{if(t.length===0)return{currentData:e,newData:n,currentValue:e,newValue:n};const o=Object.assign({remove:r==="delete"},i),s=r!=="add"?pn(e,t):void 0;return{currentData:e,newData:s1(e,t,n,o),currentValue:s,newValue:r!=="delete"?n:void 0}},Vn=(e,t)=>t?()=>!0:typeof e=="boolean"?()=>e:typeof e=="number"?({level:n})=>n>=e:e,H1=e=>{if(e!==void 0)return e==="value"?mn:e==="key"?ka:e==="all"?(t,n)=>mn(t,n)||ka(t,n):e},V1=e=>Array.isArray(e)&&e.length===2&&["error","value"].includes(e[0]),Aa=(e,t)=>{const n=t==="stringifyReplacer"?[r=>r===void 0?Hc:r]:[];if(n.push(...e.map((r=>r[t])).filter((r=>!!r))),n.length!==0)return(r,i)=>{let o=i;for(const s of n)o=s(o);return o}};export{Mv as $,X1 as A,U1 as B,J1 as C,sv as D,av as E,mv as F,yv as G,zv as H,wv as I,Lv as J,bv as K,_v as L,Rv as M,Cv as N,Hv as O,Av as P,kv as Q,F1 as R,Dv as S,Bv as T,Vv as U,jv as V,Yv as W,qv as X,G1 as Y,lv as Z,Tv as _,ou as a,Pv as a0,Nv as a1,Hl as a2,Jr as a3,ee as a4,Sv as a5,xv as a6,Ov as a7,$v as a8,Xv as a9,iv as aa,Fv as ab,jy as ac,Wv as ad,Kv as ae,Po as af,Uv as ag,Zv as ah,Qv as ai,pi as aj,Kr as ak,Iv as al,ev as am,Jv as an,yn as ao,iu as ap,Y1 as b,q1 as c,Ra as d,Q1 as e,tv as f,nv as g,hv as h,pv as i,_ as j,gv as k,fv as l,uv as m,dv as n,cv as o,ov as p,K1 as q,A as r,W1 as s,Ev as t,Z1 as u,xe as v,Gv as w,ld as x,rv as y,vv as z};
@@ -5,9 +5,9 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/assets/favicon-BLgzUch9.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Solace Agent Mesh</title>
8
- <script type="module" crossorigin src="/assets/authCallback-BTf6dqwp.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/vendor-BEmvJSYz.js">
10
- <link rel="modulepreload" crossorigin href="/assets/client-CaY59VuC.js">
8
+ <script type="module" crossorigin src="/assets/authCallback-D4_RMYRh.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/vendor-DSqhjwq_.js">
10
+ <link rel="modulepreload" crossorigin href="/assets/client-UZ3qU6Bq.js">
11
11
  </head>
12
12
  <body>
13
13
  <div id="root"></div>
@@ -5,10 +5,10 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/assets/favicon-BLgzUch9.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Solace Agent Mesh</title>
8
- <script type="module" crossorigin src="/assets/main-B32noGmR.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/vendor-BEmvJSYz.js">
10
- <link rel="modulepreload" crossorigin href="/assets/client-CaY59VuC.js">
11
- <link rel="stylesheet" crossorigin href="/assets/main-DHJKSW1S.css">
8
+ <script type="module" crossorigin src="/assets/main-DojKHS49.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/vendor-DSqhjwq_.js">
10
+ <link rel="modulepreload" crossorigin href="/assets/client-UZ3qU6Bq.js">
11
+ <link rel="stylesheet" crossorigin href="/assets/main--3yJYl7S.css">
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
@@ -66,6 +66,7 @@ def create_status_update(
66
66
  message: Message,
67
67
  is_final: bool = False,
68
68
  metadata: Optional[Dict[str, Any]] = None,
69
+ state: TaskState = TaskState.working,
69
70
  ) -> TaskStatusUpdateEvent:
70
71
  """
71
72
  Creates a new TaskStatusUpdateEvent.
@@ -81,7 +82,7 @@ def create_status_update(
81
82
  A new `TaskStatusUpdateEvent` object.
82
83
  """
83
84
  task_status = task_helpers.create_task_status(
84
- state=TaskState.working,
85
+ state=state,
85
86
  message=message,
86
87
  )
87
88
  return TaskStatusUpdateEvent(
@@ -15,6 +15,7 @@ from ..exceptions import MessageSizeExceededError
15
15
  from ..utils.message_utils import validate_message_size
16
16
 
17
17
  log = logging.getLogger(__name__)
18
+ trace_logger = logging.getLogger("sam_trace")
18
19
 
19
20
 
20
21
  class SamComponentBase(ComponentBase, abc.ABC):
@@ -64,7 +65,7 @@ class SamComponentBase(ComponentBase, abc.ABC):
64
65
  # Trust Manager integration (enterprise feature) - initialized as part of _late_init
65
66
  self.trust_manager: Optional[Any] = None
66
67
 
67
- log.info("%s SamComponentBase initialized successfully.", self.log_identifier)
68
+ log.info("%s Initialized SamComponentBase", self.log_identifier)
68
69
 
69
70
  def add_timer(
70
71
  self,
@@ -350,7 +351,10 @@ class SamComponentBase(ComponentBase, abc.ABC):
350
351
  """Helper to publish A2A messages via the SAC App with size validation."""
351
352
  try:
352
353
  log.debug(
353
- f"{self.log_identifier} [publish_a2a_message] Starting - topic: {topic}, payload keys: {list(payload.keys()) if isinstance(payload, dict) else 'not_dict'}"
354
+ "%s [publish_a2a_message] Starting - topic: %s, payload keys: %s",
355
+ self.log_identifier,
356
+ topic,
357
+ list(payload.keys()) if isinstance(payload, dict) else "not_dict"
354
358
  )
355
359
 
356
360
  # Validate message size
@@ -363,14 +367,14 @@ class SamComponentBase(ComponentBase, abc.ABC):
363
367
  f"Message size validation failed: payload size ({actual_size} bytes) "
364
368
  f"exceeds maximum allowed size ({self.max_message_size_bytes} bytes)"
365
369
  )
366
- log.error("%s %s", self.log_identifier, error_msg)
370
+ log.error("%s [publish_a2a_message] %s", self.log_identifier, error_msg)
367
371
  raise MessageSizeExceededError(
368
372
  actual_size, self.max_message_size_bytes, error_msg
369
373
  )
370
374
 
371
375
  # Debug logging to show message size when publishing
372
376
  log.debug(
373
- "%s Publishing message to topic %s (size: %d bytes)",
377
+ "%s [publish_a2a_message] Publishing message to topic %s (size: %d bytes)",
374
378
  self.log_identifier,
375
379
  topic,
376
380
  actual_size,
@@ -379,7 +383,8 @@ class SamComponentBase(ComponentBase, abc.ABC):
379
383
  app = self.get_app()
380
384
  if app:
381
385
  log.debug(
382
- f"{self.log_identifier} [publish_a2a_message] Got app instance, about to call app.send_message"
386
+ "%s [publish_a2a_message] Got app instance, about to call app.send_message",
387
+ self.log_identifier
383
388
  )
384
389
 
385
390
  # Conditionally log to invocation monitor if it exists (i.e., on an agent)
@@ -391,19 +396,24 @@ class SamComponentBase(ComponentBase, abc.ABC):
391
396
  component_identifier=self.log_identifier,
392
397
  )
393
398
 
394
- log.debug(
395
- f"{self.log_identifier} [publish_a2a_message] About to call app.send_message with payload: {payload}"
396
- )
397
- log.debug(
398
- f"{self.log_identifier} [publish_a2a_message] App send_message params - topic: {topic}, user_properties: {user_properties}"
399
- )
399
+ if trace_logger.isEnabledFor(logging.DEBUG):
400
+ trace_logger.debug(
401
+ "%s [publish_a2a_message] About to call app.send_message on topic '%s'\nwith payload: %s\nwith user_properties: %s",
402
+ self.log_identifier, topic, payload, user_properties
403
+ )
404
+ else:
405
+ log.debug(
406
+ "%s [publish_a2a_message] About to call app.send_message on topic '%s' (for more details, enable TRACE logging)",
407
+ self.log_identifier, topic
408
+ )
400
409
 
401
410
  app.send_message(
402
411
  payload=payload, topic=topic, user_properties=user_properties
403
412
  )
404
413
 
405
414
  log.debug(
406
- f"{self.log_identifier} [publish_a2a_message] Successfully called app.send_message"
415
+ "%s [publish_a2a_message] Successfully called app.send_message on topic '%s'",
416
+ self.log_identifier, topic
407
417
  )
408
418
  else:
409
419
  log.error(
@@ -434,15 +444,11 @@ class SamComponentBase(ComponentBase, abc.ABC):
434
444
  main_task = None
435
445
  try:
436
446
  log.info(
437
- "%s Starting _async_setup_and_run as an asyncio task.",
447
+ "%s Starting _async_setup_and_run as an asyncio task. Will run event loop forever (or until stop_signal).",
438
448
  self.log_identifier,
439
449
  )
440
450
  main_task = self._async_loop.create_task(self._async_setup_and_run())
441
451
 
442
- log.info(
443
- "%s Running asyncio event loop forever (or until stop_signal).",
444
- self.log_identifier,
445
- )
446
452
  self._async_loop.run_forever()
447
453
 
448
454
  except Exception as e:
@@ -630,7 +636,7 @@ class SamComponentBase(ComponentBase, abc.ABC):
630
636
  event_loop=self.get_async_loop(),
631
637
  )
632
638
  log.info(
633
- "%s Trust Manager initialized successfully", self.log_identifier
639
+ "%s Initialized Trust Manager", self.log_identifier
634
640
  )
635
641
  except Exception as e:
636
642
  log.error(
@@ -1,6 +1,7 @@
1
1
  """Provides a Pydantic BaseModel for SAM configuration with dict-like access."""
2
- from pydantic import BaseModel
3
- from typing import Any, Dict, Type, TypeVar
2
+ from pydantic import BaseModel, ValidationError
3
+ from typing import Any, TypeVar, Union, get_args, get_origin
4
+ from types import UnionType
4
5
 
5
6
  T = TypeVar("T", bound="SamConfigBase")
6
7
 
@@ -13,7 +14,7 @@ class SamConfigBase(BaseModel):
13
14
  """
14
15
 
15
16
  @classmethod
16
- def model_validate_and_clean(cls: Type[T], obj: Any) -> T:
17
+ def model_validate_and_clean(cls: type[T], obj: Any) -> T:
17
18
  """
18
19
  Validates a dictionary, first removing any keys with None values.
19
20
  This allows Pydantic's default values to be applied correctly when
@@ -24,6 +25,92 @@ class SamConfigBase(BaseModel):
24
25
  return cls.model_validate(cleaned_obj)
25
26
  return cls.model_validate(obj)
26
27
 
28
+ @classmethod
29
+ def format_validation_error_message(cls: type[T], error: ValidationError, app_name: str | None, agent_name: str | None = None) -> str:
30
+ """
31
+ Formats Pydantic validation error messages into a clear, actionable format.
32
+
33
+ Example output:
34
+ ---- Configuration validation failed for 'my-agent-app' ----
35
+
36
+ Agent Name: AgentConfig
37
+
38
+ ERROR 1:
39
+ Missing required field: 'namespace'
40
+ Location: app_config.namespace
41
+ Description: Absolute topic prefix for A2A communication (e.g., 'myorg/dev')
42
+
43
+ ---- Please update your YAML configuration ----
44
+ """
45
+
46
+ error_lines = [
47
+ f"\n---- Configuration validation failed for {app_name or 'UNKNOWN'} ----",
48
+ ""
49
+ ]
50
+
51
+ if agent_name:
52
+ error_lines.append(f" Agent Name: {agent_name}\n")
53
+
54
+ def get_nested_field_description(model_class: type[BaseModel], path: list[str | int]) -> str | None:
55
+ """Recursively get field description from nested models"""
56
+ if not path:
57
+ return None
58
+
59
+ current_field = path[0]
60
+ if str(current_field) not in model_class.model_fields:
61
+ return None
62
+
63
+ field_info = model_class.model_fields[str(current_field)]
64
+
65
+ if len(path) == 1:
66
+ return field_info.description
67
+
68
+ annotation = field_info.annotation
69
+
70
+ # Handle Optional/Union types
71
+ if annotation is not None:
72
+ origin = get_origin(annotation)
73
+ if origin is Union or origin is UnionType:
74
+ types = get_args(annotation)
75
+ annotation = next((t for t in types if t is not type(None)), None)
76
+ elif origin is list:
77
+ inner_type = get_args(annotation)[0]
78
+ if len(path) > 1 and isinstance(path[1], int):
79
+ if isinstance(inner_type, type) and issubclass(inner_type, BaseModel):
80
+ return get_nested_field_description(inner_type, path[2:])
81
+ return None
82
+ annotation = inner_type
83
+
84
+ if annotation is not None and isinstance(annotation, type) and issubclass(annotation, BaseModel):
85
+ return get_nested_field_description(annotation, path[1:])
86
+
87
+ return None
88
+
89
+
90
+ for index, err in enumerate(error.errors()):
91
+ error_type = err.get('type')
92
+ loc = err['loc']
93
+ msg = err['msg']
94
+
95
+ error_lines.append(f"ERROR {index + 1}:")
96
+
97
+ absolute_path = '.'.join(str(item) for item in loc)
98
+ description = get_nested_field_description(cls, list(loc))
99
+ if error_type == 'missing':
100
+ error_lines.extend([
101
+ f" Missing required field: '{loc[-1]}'",
102
+ ])
103
+ else:
104
+ error_lines.extend([
105
+ f" Error: {msg}",
106
+ ])
107
+ error_lines.append(f" Location: app_config.{absolute_path}")
108
+ error_lines.append(f" Description: {description or 'UNKNOWN'}")
109
+ error_lines.append("")
110
+
111
+ error_lines.append('---- Please update your YAML configuration ----')
112
+ return '\n'.join(error_lines) + "\n"
113
+
27
114
  def get(self, key: str, default: Any = None) -> Any:
28
115
  """Provides dict-like .get() method."""
29
116
  return getattr(self, key, default)
@@ -160,7 +160,7 @@ class BaseGatewayComponent(SamComponentBase):
160
160
  )
161
161
 
162
162
  log.info(
163
- "%s Base Gateway Component initialized successfully.", self.log_identifier
163
+ "%s Initialized Base Gateway Component.", self.log_identifier
164
164
  )
165
165
 
166
166
  async def authenticate_and_enrich_user(
@@ -208,6 +208,8 @@ class BaseGatewayComponent(SamComponentBase):
208
208
  user_identity: Any,
209
209
  is_streaming: bool = True,
210
210
  api_version: str = "v2",
211
+ task_id_override: str | None = None,
212
+ metadata: dict[str, Any] | None = None,
211
213
  ) -> str:
212
214
  log_id_prefix = f"{self.log_identifier}[SubmitA2ATask]"
213
215
  log.info(
@@ -241,7 +243,7 @@ class BaseGatewayComponent(SamComponentBase):
241
243
  user_config = await config_resolver.resolve_user_config(
242
244
  user_identity, gateway_context, {}
243
245
  )
244
- log.info(
246
+ log.debug(
245
247
  "%s Resolved user configuration for user_identity '%s': %s",
246
248
  log_id_prefix,
247
249
  user_identity.get("id"),
@@ -307,9 +309,15 @@ class BaseGatewayComponent(SamComponentBase):
307
309
  log_id_prefix,
308
310
  len(invoked_artifacts),
309
311
  )
312
+
313
+ if metadata:
314
+ a2a_metadata.update(metadata)
310
315
 
311
316
  # This correlation ID is used by the gateway to track the task
312
- task_id = f"gdk-task-{uuid.uuid4().hex}"
317
+ if task_id_override:
318
+ task_id = task_id_override
319
+ else:
320
+ task_id = f"gdk-task-{uuid.uuid4().hex}"
313
321
 
314
322
  prepared_a2a_parts = await self._prepare_parts_for_publishing(
315
323
  parts=a2a_parts,
@@ -1166,10 +1174,6 @@ class BaseGatewayComponent(SamComponentBase):
1166
1174
  )
1167
1175
  self._start_listener()
1168
1176
 
1169
- log.info(
1170
- "%s Starting _message_processor_loop as an asyncio task.",
1171
- self.log_identifier,
1172
- )
1173
1177
  await self._message_processor_loop()
1174
1178
 
1175
1179
  def _pre_async_cleanup(self) -> None:
@@ -1197,7 +1201,7 @@ class BaseGatewayComponent(SamComponentBase):
1197
1201
  self.internal_event_queue.put(None)
1198
1202
 
1199
1203
  async def _message_processor_loop(self):
1200
- log.info("%s Starting message processor loop...", self.log_identifier)
1204
+ log.debug("%s Starting message processor loop as an asyncio task...", self.log_identifier)
1201
1205
  loop = self.get_async_loop()
1202
1206
 
1203
1207
  while not self.stop_signal.is_set():
@@ -89,6 +89,13 @@ class WebUIBackendApp(BaseGatewayApp):
89
89
  "default": "",
90
90
  "description": "General guidelines on how agent responses should be structured, to be optionally used by agents.",
91
91
  },
92
+ {
93
+ "name": "model",
94
+ "required": False,
95
+ "type": "dict",
96
+ "default": None,
97
+ "description": "The model to use for the WebUI gateway.",
98
+ },
92
99
  {
93
100
  "name": "frontend_welcome_message",
94
101
  "required": False,