superleap-code-editor 1.0.7 → 1.0.8

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.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { CodeEditorConfig } from "../types/fileTypes";
2
+ import { type CodeEditorConfig } from "../types/fileTypes";
3
3
  interface CodeEditorWrapperProps {
4
4
  config: CodeEditorConfig;
5
5
  rightPanel?: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"codeEditorWrapper.d.ts","sourceRoot":"","sources":["../../src/components/codeEditorWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAK3D,UAAU,sBAAsB;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAwD9D,CAAC;AAKF,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxE,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC7D,CAkBA,CAAC;AAGF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAkBA,CAAC;AAGF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IACnC,QAAQ,EAAE,KAAK,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;KAC7D,CAAC,CAAC;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B,CAQA,CAAC"}
1
+ {"version":3,"file":"codeEditorWrapper.d.ts","sourceRoot":"","sources":["../../src/components/codeEditorWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAU,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKnE,UAAU,sBAAsB;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAwD9D,CAAC;AAKF,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxE,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC7D,CAkBA,CAAC;AAGF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAkBA,CAAC;AAGF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IACnC,QAAQ,EAAE,KAAK,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;KAC7D,CAAC,CAAC;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B,CAQA,CAAC"}
@@ -4,8 +4,8 @@ interface EditorLayoutProps {
4
4
  leftPanel: React.ReactNode;
5
5
  editor: React.ReactNode;
6
6
  rightPanel: React.ReactNode | false;
7
- activePanel: string;
8
- setActivePanel: (panel: string) => void;
7
+ activePanel: Panels;
8
+ setActivePanel: (panel: Panels) => void;
9
9
  allowedPannels?: Panels[];
10
10
  }
11
11
  export declare const EditorLayout: React.FC<EditorLayoutProps>;
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import { Panels } from "../../types/fileTypes";
3
3
  interface SidebarProps {
4
- activePanel: string;
5
- setActivePanel: (panel: string) => void;
4
+ activePanel: Panels;
5
+ setActivePanel: (panel: Panels) => void;
6
6
  allowedPannels: Panels[];
7
7
  }
8
8
  export declare const Sidebar: React.FC<SidebarProps>;
package/dist/index.cjs.js CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var _e;function wt(){if(_e)return $;_e=1;var i=w,r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,c=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g={key:!0,ref:!0,__self:!0,__source:!0};function j(C,v,R){var d,F={},S=null,O=null;R!==void 0&&(S=""+R),v.key!==void 0&&(S=""+v.key),v.ref!==void 0&&(O=v.ref);for(d in v)o.call(v,d)&&!g.hasOwnProperty(d)&&(F[d]=v[d]);if(C&&C.defaultProps)for(d in v=C.defaultProps,v)F[d]===void 0&&(F[d]=v[d]);return{$$typeof:r,type:C,key:S,ref:O,props:F,_owner:c.current}}return $.Fragment=s,$.jsx=j,$.jsxs=j,$}var M={};/**
9
+ */var _e;function wt(){if(_e)return $;_e=1;var i=w,r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,c=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g={key:!0,ref:!0,__self:!0,__source:!0};function j(C,v,R){var d,F={},S=null,I=null;R!==void 0&&(S=""+R),v.key!==void 0&&(S=""+v.key),v.ref!==void 0&&(I=v.ref);for(d in v)o.call(v,d)&&!g.hasOwnProperty(d)&&(F[d]=v[d]);if(C&&C.defaultProps)for(d in v=C.defaultProps,v)F[d]===void 0&&(F[d]=v[d]);return{$$typeof:r,type:C,key:S,ref:I,props:F,_owner:c.current}}return $.Fragment=s,$.jsx=j,$.jsxs=j,$}var M={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Te;function Nt(){return Te||(Te=1,process.env.NODE_ENV!=="production"&&(function(){var i=w,r=Symbol.for("react.element"),s=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),j=Symbol.for("react.provider"),C=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),B=Symbol.iterator,G="@@iterator";function K(e){if(e===null||typeof e!="object")return null;var n=B&&e[B]||e[G];return typeof n=="function"?n:null}var b=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(e){{for(var n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];We("error",e,a)}}function We(e,n,a){{var l=b.ReactDebugCurrentFrame,m=l.getStackAddendum();m!==""&&(n+="%s",a=a.concat([m]));var x=a.map(function(f){return String(f)});x.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,x)}}var Ye=!1,Ue=!1,qe=!1,He=!1,Je=!1,se;se=Symbol.for("react.module.reference");function Ge(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===g||Je||e===c||e===R||e===d||He||e===O||Ye||Ue||qe||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===F||e.$$typeof===j||e.$$typeof===C||e.$$typeof===v||e.$$typeof===se||e.getModuleId!==void 0))}function Ke(e,n,a){var l=e.displayName;if(l)return l;var m=n.displayName||n.name||"";return m!==""?a+"("+m+")":a}function ae(e){return e.displayName||"Context"}function k(e){if(e==null)return null;if(typeof e.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case s:return"Portal";case g:return"Profiler";case c:return"StrictMode";case R:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case C:var n=e;return ae(n)+".Consumer";case j:var a=e;return ae(a._context)+".Provider";case v:return Ke(e,e.render,"ForwardRef");case F:var l=e.displayName||null;return l!==null?l:k(e.type)||"Memo";case S:{var m=e,x=m._payload,f=m._init;try{return k(f(x))}catch{return null}}}return null}var D=Object.assign,L=0,ie,oe,le,ce,de,ue,fe;function me(){}me.__reactDisabledLog=!0;function Xe(){{if(L===0){ie=console.log,oe=console.info,le=console.warn,ce=console.error,de=console.group,ue=console.groupCollapsed,fe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:me,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}L++}}function Ze(){{if(L--,L===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:ie}),info:D({},e,{value:oe}),warn:D({},e,{value:le}),error:D({},e,{value:ce}),group:D({},e,{value:de}),groupCollapsed:D({},e,{value:ue}),groupEnd:D({},e,{value:fe})})}L<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=b.ReactCurrentDispatcher,Z;function V(e,n,a){{if(Z===void 0)try{throw Error()}catch(m){var l=m.stack.trim().match(/\n( *(at )?)/);Z=l&&l[1]||""}return`
17
+ */var Te;function Nt(){return Te||(Te=1,process.env.NODE_ENV!=="production"&&(function(){var i=w,r=Symbol.for("react.element"),s=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),j=Symbol.for("react.provider"),C=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),B=Symbol.iterator,G="@@iterator";function K(e){if(e===null||typeof e!="object")return null;var n=B&&e[B]||e[G];return typeof n=="function"?n:null}var b=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(e){{for(var n=arguments.length,a=new Array(n>1?n-1:0),l=1;l<n;l++)a[l-1]=arguments[l];We("error",e,a)}}function We(e,n,a){{var l=b.ReactDebugCurrentFrame,m=l.getStackAddendum();m!==""&&(n+="%s",a=a.concat([m]));var x=a.map(function(f){return String(f)});x.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,x)}}var Ye=!1,Ue=!1,qe=!1,He=!1,Je=!1,se;se=Symbol.for("react.module.reference");function Ge(e){return!!(typeof e=="string"||typeof e=="function"||e===o||e===g||Je||e===c||e===R||e===d||He||e===I||Ye||Ue||qe||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===F||e.$$typeof===j||e.$$typeof===C||e.$$typeof===v||e.$$typeof===se||e.getModuleId!==void 0))}function Ke(e,n,a){var l=e.displayName;if(l)return l;var m=n.displayName||n.name||"";return m!==""?a+"("+m+")":a}function ae(e){return e.displayName||"Context"}function k(e){if(e==null)return null;if(typeof e.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case o:return"Fragment";case s:return"Portal";case g:return"Profiler";case c:return"StrictMode";case R:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case C:var n=e;return ae(n)+".Consumer";case j:var a=e;return ae(a._context)+".Provider";case v:return Ke(e,e.render,"ForwardRef");case F:var l=e.displayName||null;return l!==null?l:k(e.type)||"Memo";case S:{var m=e,x=m._payload,f=m._init;try{return k(f(x))}catch{return null}}}return null}var D=Object.assign,L=0,ie,oe,le,ce,de,ue,fe;function me(){}me.__reactDisabledLog=!0;function Xe(){{if(L===0){ie=console.log,oe=console.info,le=console.warn,ce=console.error,de=console.group,ue=console.groupCollapsed,fe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:me,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}L++}}function Ze(){{if(L--,L===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:ie}),info:D({},e,{value:oe}),warn:D({},e,{value:le}),error:D({},e,{value:ce}),group:D({},e,{value:de}),groupCollapsed:D({},e,{value:ue}),groupEnd:D({},e,{value:fe})})}L<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=b.ReactCurrentDispatcher,Z;function V(e,n,a){{if(Z===void 0)try{throw Error()}catch(m){var l=m.stack.trim().match(/\n( *(at )?)/);Z=l&&l[1]||""}return`
18
18
  `+Z+e}}var Q=!1,W;{var Qe=typeof WeakMap=="function"?WeakMap:Map;W=new Qe}function he(e,n){if(!e||Q)return"";{var a=W.get(e);if(a!==void 0)return a}var l;Q=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var x;x=X.current,X.current=null,Xe();try{if(n){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(P){l=P}Reflect.construct(e,[],f)}else{try{f.call()}catch(P){l=P}e.call(f.prototype)}}else{try{throw Error()}catch(P){l=P}e()}}catch(P){if(P&&l&&typeof P.stack=="string"){for(var u=P.stack.split(`
19
19
  `),_=l.stack.split(`
20
20
  `),y=u.length-1,E=_.length-1;y>=1&&E>=0&&u[y]!==_[E];)E--;for(;y>=1&&E>=0;y--,E--)if(u[y]!==_[E]){if(y!==1||E!==1)do if(y--,E--,E<0||u[y]!==_[E]){var T=`
@@ -22,7 +22,7 @@
22
22
 
23
23
  Check the render method of \``+e+"`."}return""}}function ht(e){return""}var Ne={};function pt(e){{var n=we();if(!n){var a=typeof e=="string"?e:e.displayName||e.name;a&&(n=`
24
24
 
25
- Check the top-level render call using <`+a+">.")}return n}}function Ce(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=pt(n);if(Ne[a])return;Ne[a]=!0;var l="";e&&e._owner&&e._owner!==te.current&&(l=" It was passed a child from "+k(e._owner.type)+"."),A(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,l),A(null)}}function Fe(e,n){{if(typeof e!="object")return;if(ee(e))for(var a=0;a<e.length;a++){var l=e[a];ne(l)&&Ce(l,n)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var m=K(e);if(typeof m=="function"&&m!==e.entries)for(var x=m.call(e),f;!(f=x.next()).done;)ne(f.value)&&Ce(f.value,n)}}}function xt(e){{var n=e.type;if(n==null||typeof n=="string")return;var a;if(typeof n=="function")a=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===v||n.$$typeof===F))a=n.propTypes;else return;if(a){var l=k(n);rt(a,e.props,"prop",l,e)}else if(n.PropTypes!==void 0&&!re){re=!0;var m=k(n);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function vt(e){{for(var n=Object.keys(e.props),a=0;a<n.length;a++){var l=n[a];if(l!=="children"&&l!=="key"){A(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",l),A(null);break}}e.ref!==null&&(A(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}function Re(e,n,a,l,m,x){{var f=Ge(e);if(!f){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var _=ht();_?u+=_:u+=we();var y;e===null?y="null":ee(e)?y="array":e!==void 0&&e.$$typeof===r?(y="<"+(k(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,u)}var E=mt(e,n,a,m,x);if(E==null)return E;if(f){var T=n.children;if(T!==void 0)if(l)if(ee(T)){for(var z=0;z<T.length;z++)Fe(T[z],e);Object.freeze&&Object.freeze(T)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Fe(T,e)}return e===o?vt(E):xt(E),E}}function bt(e,n,a){return Re(e,n,a,!0)}function gt(e,n,a){return Re(e,n,a,!1)}var yt=gt,jt=bt;M.Fragment=o,M.jsx=yt,M.jsxs=jt})()),M}var Pe;function Ct(){return Pe||(Pe=1,process.env.NODE_ENV==="production"?H.exports=wt():H.exports=Nt()),H.exports}var t=Ct();function Oe(i){const[r,s]=w.useState([]),[o,c]=w.useState(null),[g,j]=w.useState(""),[C,v]=w.useState(!1),[R,d]=w.useState(null),F=w.useCallback(async()=>{try{v(!0),d(null);const b=await i.getFiles();if(s(b),!o&&b.length>0){const p=Ie(b);p&&c(p.id)}}catch(b){d(b instanceof Error?b.message:"Failed to load files")}finally{v(!1)}},[i,o]),S=w.useCallback(async b=>{try{v(!0),d(null);const p=await i.getFileContent(b);j(p)}catch(p){d(p instanceof Error?p.message:"Failed to load file content"),j("")}finally{v(!1)}},[i]),O=w.useCallback(async b=>{if(o)try{d(null),await i.updateFileContent(o,b),j(b),s(p=>De(p,o,{content:b}))}catch(p){d(p instanceof Error?p.message:"Failed to update file content")}},[o,i]),B=w.useCallback(b=>{c(b),S(b)},[S]),G=w.useCallback(()=>{F()},[F]),K=w.useCallback(b=>ke(r,b),[r]);return w.useEffect(()=>{F()},[F]),w.useEffect(()=>{o&&S(o)},[o,S]),{files:r,activeFile:o,fileContent:g,loading:C,error:R,setActiveFile:B,updateFileContent:O,refreshFiles:G,getFileById:K}}function Ie(i){for(const r of i){if(r.type==="file")return r;if(r.children){const s=Ie(r.children);if(s)return s}}return null}function ke(i,r){for(const s of i){if(s.id===r)return s;if(s.children){const o=ke(s.children,r);if(o)return o}}return null}function De(i,r,s){return i.map(o=>o.id===r?{...o,...s}:o.children?{...o,children:De(o.children,r,s)}:o)}class Ae{config;files=[];constructor(r){this.config=r}async getFiles(){return this.files.length===0&&await this.loadFiles(),this.files}async getFileContent(r){if(r==="main-function")return await this.config.fetchFunction(this.config.functionId,this.config.version);throw new Error(`File ${r} not found`)}async updateFileContent(r,s){const o=this.findFileById(r);o&&(o.content=s),console.log(`Updated file ${r} with content:`,s)}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}async loadFiles(){this.files=[{id:"main-function",name:"function.js",type:"file",path:"/function.js",metadata:{language:"javascript",lastModified:new Date}},{id:"versions",name:"versions",type:"folder",path:"/versions",children:this.config.versionList.map(r=>({id:`version-${r}`,name:`v${r}.js`,type:"file",path:`/versions/v${r}.js`,metadata:{language:"javascript"}}))}]}findFileById(r){const s=o=>{for(const c of o){if(c.id===r)return c;if(c.children){const g=s(c.children);if(g)return g}}return null};return s(this.files)}}class ze{config;files=[];constructor(r){this.config=r,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(r){if(r==="form-code")return this.config.codeContent;throw new Error(`File ${r} not found`)}async updateFileContent(r,s){if(r==="form-code"){this.config.codeContent=s;const o=this.files.find(c=>c.id===r);o&&(o.content=s)}}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}initializeFiles(){this.files=[{id:"form-code",name:this.config.fileName||"code.js",type:"file",path:`/${this.config.fileName||"code.js"}`,content:this.config.codeContent,metadata:{language:this.config.language||"javascript",lastModified:new Date}}]}findFileById(r){return this.files.find(s=>s.id===r)||null}}class Le{config;files=[];constructor(r){this.config=r,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(r){const s=this.findFileById(r);if(!s||!s.metadata?.url)throw new Error(`File ${r} not found`);try{const o=await fetch(s.metadata.url);if(!o.ok)throw new Error(`Failed to fetch file: ${o.statusText}`);return await o.text()}catch(o){throw new Error(`Error fetching file content: ${o}`)}}async updateFileContent(r,s){console.log(`Would save file ${r} content to backend:`,s);const o=this.findFileById(r);o&&(o.content=s)}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}initializeFiles(){this.files=this.config.fileUrls.map((r,s)=>({id:`url-file-${s}`,name:r.name,type:"file",path:`/${r.name}`,metadata:{language:r.type,url:r.url,lastModified:new Date}}))}findFileById(r){return this.files.find(s=>s.id===r)||null}}function $e(i){if(i.workflowConfig)return new Ae(i.workflowConfig);if(i.formConfig)return new ze(i.formConfig);if(i.urlConfig)return new Le(i.urlConfig);throw new Error("No valid configuration provided")}const Me=({value:i,onChange:r,language:s="javascript",filename:o,readOnly:c=!1,loading:g=!1})=>{const j=C=>{C!==void 0&&r(C)};return t.jsx("div",{className:"h-full w-full",children:t.jsx(Et,{height:"100%",defaultLanguage:s,defaultValue:i,onChange:j,theme:"vs-light",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0,padding:{top:16},scrollBeyondLastLine:!1,readOnly:c}})})};var I=(i=>(i.Explorer="explorer",i.Data="data",i.Functions="functions",i.Versions="versions",i.Tests="tests",i))(I||{});const Ft=[{id:I.Explorer,icon:h.IconFolderOpen,label:"Files"},{id:I.Data,icon:h.IconDatabase,label:"Data"},{id:I.Functions,icon:h.IconCode,label:"Functions"},{id:I.Versions,icon:h.IconHistory,label:"Versions"},{id:I.Tests,icon:h.IconFlask,label:"Tests"}],Rt=({activePanel:i,setActivePanel:r,allowedPannels:s})=>{const o=w.useMemo(()=>Ft.filter(c=>s.includes(c.id)),[s]);return t.jsxs("div",{className:"w-14 border-r border-slate-200 bg-white flex flex-col gap-4 items-center py-4",children:[o.map(c=>{const g=c.icon;return t.jsx(N.Tooltip,{title:c.label,placement:"right",children:t.jsx(N.Button,{type:i===c.id?"primary":"text",icon:t.jsx(g,{size:16}),onClick:()=>r(c.id)})},c.id)}),t.jsx("div",{className:"mt-auto",children:t.jsx(N.Tooltip,{title:"Settings",placement:"right",children:t.jsx(N.Button,{type:"text",icon:t.jsx(h.IconSettings,{size:20})})})})]})},Be=({leftPanel:i,editor:r,rightPanel:s,activePanel:o,setActivePanel:c,allowedPannels:g=[I.Explorer]})=>t.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[t.jsx(Rt,{activePanel:o,setActivePanel:c,allowedPannels:g}),t.jsx("div",{className:"flex-1",children:s?t.jsxs(N.Splitter,{style:{height:"100%"},onResize:j=>console.log(j),children:[t.jsx(N.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-slate-200",collapsible:!0,children:t.jsx("div",{className:"h-full overflow-y-auto",children:i})}),t.jsx(N.Splitter.Panel,{defaultSize:"50%",min:"30%",children:r}),t.jsx(N.Splitter.Panel,{defaultSize:"25%",min:"20%",max:"50%",className:"bg-white border-l border-slate-200",children:t.jsx("div",{className:"h-full overflow-y-auto",children:s})})]}):t.jsxs(N.Splitter,{style:{height:"100%"},children:[t.jsx(N.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-slate-200",children:t.jsx("div",{className:"h-full overflow-y-auto",children:i})}),t.jsx(N.Splitter.Panel,{defaultSize:"75%",min:"60%",children:r})]})})]}),Ve=({files:i,activeFile:r,onFileSelect:s,loading:o=!1,error:c=null,onRefresh:g})=>{const j=R=>R.map(d=>({title:d.name,key:d.id,icon:d.type==="file"?t.jsx(h.IconFile,{size:16,className:"text-slate-500 flex"}):t.jsx(h.IconFolderOpen,{size:16,className:"text-slate-500 flex"}),isLeaf:d.type==="file",children:d.children?j(d.children):void 0,metadata:d.metadata})),C=j(i),v=(R,d)=>{d?.node.isLeaf&&d.node.key&&s(d.node.key)};return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Files"}),t.jsx("div",{className:"flex items-center gap-2",children:g&&t.jsx(N.Button,{type:"text",icon:t.jsx(h.IconPlus,{size:16}),onClick:g,loading:o,title:"Refresh files"})})]}),t.jsxs("div",{className:"p-2",children:[c&&t.jsx(N.Alert,{message:"Error loading files",description:c,type:"error",className:"mb-2"}),t.jsx(N.Tree,{treeData:C,onSelect:v,selectedKeys:r?[r]:[],showIcon:!0,defaultExpandAll:!0,showLine:!0,className:"file-explorer-tree"})]})]})},J=({config:i,rightPanel:r=!1})=>{const s=w.useMemo(()=>$e(i),[i]);console.log({config:i});const{files:o,activeFile:c,fileContent:g,loading:j,error:C,setActiveFile:v,updateFileContent:R,refreshFiles:d,getFileById:F}=Oe(s),S=c?F(c):null,O=S?.metadata?.language||"javascript";return t.jsx(Be,{leftPanel:t.jsx(Ve,{files:o,activeFile:c,onFileSelect:v,loading:j,error:C,onRefresh:d}),editor:t.jsx(Me,{value:g,onChange:R,language:O,filename:S?.name,readOnly:i.settings?.readOnly,loading:j}),rightPanel:r,activePanel:"explorer",setActivePanel:()=>{}})},St=({functionId:i,version:r,versionList:s,fetchFunction:o,fetchVersionList:c})=>{const g={workflowConfig:{functionId:i,version:r,versionList:s,fetchFunction:o,fetchVersionList:c}};return t.jsx(J,{config:g})},_t=({codeContent:i,fileName:r="code.js",language:s="javascript",readOnly:o=!1})=>{const c={formConfig:{codeContent:i,fileName:r,language:s},settings:{readOnly:o}};return t.jsx(J,{config:c})},Tt=({fileUrls:i,rightPanel:r})=>{const s={urlConfig:{fileUrls:i}};return t.jsx(J,{config:s,rightPanel:r})},Pt=({activeFile:i,showPreview:r,setShowPreview:s})=>t.jsxs("div",{className:"h-14 border-b border-slate-200 bg-white px-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-slate-900 mr-4",children:"CRM Code Editor"}),t.jsx("span",{className:"text-sm text-slate-500 px-2 py-1 bg-slate-100 rounded-md",children:i})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",onClick:()=>s(!r),title:r?"Hide Preview":"Show Preview",children:r?t.jsx(h.IconEyeOff,{size:18}):t.jsx(h.IconEye,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Version History",children:t.jsx(h.IconHistory,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Run Code",children:t.jsx(h.IconPlayerPlay,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Export",children:t.jsx(h.IconDownload,{size:18})}),t.jsxs("button",{className:"ml-2 px-3 py-1.5 bg-slate-900 text-white rounded-md flex items-center text-sm hover:bg-slate-800",children:[t.jsx(h.IconDeviceFloppy,{size:16,className:"mr-1.5"})," Save"]}),t.jsxs("div",{className:"ml-2 px-3 py-1.5 bg-emerald-100 text-emerald-800 rounded-md flex items-center text-sm",children:[t.jsx("span",{className:"w-2 h-2 bg-emerald-500 rounded-full mr-1.5"})," ","Draft"]})]})]}),Ot=()=>{const i=[{name:"Lead",fields:["id","name","email","phone","status","createdAt"],expanded:!0},{name:"Contact",fields:["id","firstName","lastName","email","phone"],expanded:!1},{name:"Account",fields:["id","name","industry","website","employees"],expanded:!1},{name:"Opportunity",fields:["id","name","amount","stage","closeDate"],expanded:!1}];return t.jsxs("div",{className:"h-full",children:[t.jsx("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:t.jsx("h2",{className:"font-medium text-sm",children:"Data Explorer"})}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"relative mb-3",children:[t.jsx(h.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-slate-400"}),t.jsx("input",{type:"text",placeholder:"Search objects...",className:"w-full pl-8 pr-3 py-2 text-sm border border-slate-200 rounded-md focus:outline-none focus:ring-2 focus:ring-slate-300"})]}),t.jsx("div",{children:i.map(r=>t.jsxs("div",{className:"mb-1",children:[t.jsxs("div",{className:"flex items-center p-2 hover:bg-slate-50 rounded-md cursor-pointer",children:[t.jsx(h.IconChevronRight,{size:16,className:`mr-1 text-slate-400 transition-transform ${r.expanded?"rotate-90":""}`}),t.jsx(h.IconDatabase,{size:16,className:"mr-2 text-slate-500"}),t.jsx("span",{className:"text-sm font-medium",children:r.name})]}),r.expanded&&t.jsx("div",{className:"ml-7 border-l border-slate-200 pl-2",children:r.fields.map(s=>t.jsx("div",{className:"flex items-center p-1.5 hover:bg-slate-50 rounded-md cursor-pointer",children:t.jsx("span",{className:"text-xs text-slate-600",children:s})},s))})]},r.name))})]})]})},It=()=>{const i=[{name:"formatCurrency",description:"Format a number as currency",category:"Formatting"},{name:"calculateDiscount",description:"Calculate discount based on amount",category:"Calculations"},{name:"getLeadData",description:"Fetch lead data from CRM",category:"Data Access"},{name:"updateContact",description:"Update contact information",category:"Data Modification"},{name:"sendEmail",description:"Send an email to a contact",category:"Communication"},{name:"validateEmail",description:"Validate email format",category:"Validation"}];return t.jsxs("div",{className:"h-full",children:[t.jsx("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:t.jsx("h2",{className:"font-medium text-sm",children:"Function Library"})}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"relative mb-3",children:[t.jsx(h.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-slate-400"}),t.jsx("input",{type:"text",placeholder:"Search functions...",className:"w-full pl-8 pr-3 py-2 text-sm border border-slate-200 rounded-md focus:outline-none focus:ring-2 focus:ring-slate-300"})]}),t.jsx("div",{children:i.map(r=>t.jsxs("div",{className:"p-2 border border-slate-200 rounded-md mb-2 hover:bg-slate-50 cursor-pointer",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx(h.IconCode,{size:16,className:"mr-2 text-slate-500"}),t.jsx("span",{className:"text-sm font-medium",children:r.name})]}),t.jsx("span",{className:"text-xs bg-slate-100 px-2 py-0.5 rounded text-slate-600",children:r.category})]}),t.jsx("p",{className:"text-xs text-slate-500 mt-1",children:r.description})]},r.name))}),t.jsxs("div",{className:"mt-4 p-3 bg-slate-50 rounded-md border border-slate-200 flex items-center",children:[t.jsx(h.IconBook,{size:16,className:"text-slate-500 mr-2"}),t.jsx("span",{className:"text-xs text-slate-600",children:"Browse documentation for more functions and examples"})]})]})]})},kt=({code:i})=>{const[r,s]=w.useState(null),[o,c]=w.useState(!1),g="body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; padding: 1rem; }",C=(d=>d.replace(/import\s+.*axios.*from\s+['"]axios['"];?/g,"// Axios imports removed for preview").replace(/axios\./g,"/* axios. */").replace(/fetch\(/g,"/* fetch( */"))(i),v=`
25
+ Check the top-level render call using <`+a+">.")}return n}}function Ce(e,n){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=pt(n);if(Ne[a])return;Ne[a]=!0;var l="";e&&e._owner&&e._owner!==te.current&&(l=" It was passed a child from "+k(e._owner.type)+"."),A(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,l),A(null)}}function Fe(e,n){{if(typeof e!="object")return;if(ee(e))for(var a=0;a<e.length;a++){var l=e[a];ne(l)&&Ce(l,n)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var m=K(e);if(typeof m=="function"&&m!==e.entries)for(var x=m.call(e),f;!(f=x.next()).done;)ne(f.value)&&Ce(f.value,n)}}}function xt(e){{var n=e.type;if(n==null||typeof n=="string")return;var a;if(typeof n=="function")a=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===v||n.$$typeof===F))a=n.propTypes;else return;if(a){var l=k(n);rt(a,e.props,"prop",l,e)}else if(n.PropTypes!==void 0&&!re){re=!0;var m=k(n);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",m||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function vt(e){{for(var n=Object.keys(e.props),a=0;a<n.length;a++){var l=n[a];if(l!=="children"&&l!=="key"){A(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",l),A(null);break}}e.ref!==null&&(A(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}function Re(e,n,a,l,m,x){{var f=Ge(e);if(!f){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var _=ht();_?u+=_:u+=we();var y;e===null?y="null":ee(e)?y="array":e!==void 0&&e.$$typeof===r?(y="<"+(k(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):y=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",y,u)}var E=mt(e,n,a,m,x);if(E==null)return E;if(f){var T=n.children;if(T!==void 0)if(l)if(ee(T)){for(var z=0;z<T.length;z++)Fe(T[z],e);Object.freeze&&Object.freeze(T)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Fe(T,e)}return e===o?vt(E):xt(E),E}}function bt(e,n,a){return Re(e,n,a,!0)}function gt(e,n,a){return Re(e,n,a,!1)}var yt=gt,jt=bt;M.Fragment=o,M.jsx=yt,M.jsxs=jt})()),M}var Pe;function Ct(){return Pe||(Pe=1,process.env.NODE_ENV==="production"?H.exports=wt():H.exports=Nt()),H.exports}var t=Ct();function Oe(i){const[r,s]=w.useState([]),[o,c]=w.useState(null),[g,j]=w.useState(""),[C,v]=w.useState(!1),[R,d]=w.useState(null),F=w.useCallback(async()=>{try{v(!0),d(null);const b=await i.getFiles();if(s(b),!o&&b.length>0){const p=Ie(b);p&&c(p.id)}}catch(b){d(b instanceof Error?b.message:"Failed to load files")}finally{v(!1)}},[i,o]),S=w.useCallback(async b=>{try{v(!0),d(null);const p=await i.getFileContent(b);j(p)}catch(p){d(p instanceof Error?p.message:"Failed to load file content"),j("")}finally{v(!1)}},[i]),I=w.useCallback(async b=>{if(o)try{d(null),await i.updateFileContent(o,b),j(b),s(p=>De(p,o,{content:b}))}catch(p){d(p instanceof Error?p.message:"Failed to update file content")}},[o,i]),B=w.useCallback(b=>{c(b),S(b)},[S]),G=w.useCallback(()=>{F()},[F]),K=w.useCallback(b=>ke(r,b),[r]);return w.useEffect(()=>{F()},[F]),w.useEffect(()=>{o&&S(o)},[o,S]),{files:r,activeFile:o,fileContent:g,loading:C,error:R,setActiveFile:B,updateFileContent:I,refreshFiles:G,getFileById:K}}function Ie(i){for(const r of i){if(r.type==="file")return r;if(r.children){const s=Ie(r.children);if(s)return s}}return null}function ke(i,r){for(const s of i){if(s.id===r)return s;if(s.children){const o=ke(s.children,r);if(o)return o}}return null}function De(i,r,s){return i.map(o=>o.id===r?{...o,...s}:o.children?{...o,children:De(o.children,r,s)}:o)}class Ae{config;files=[];constructor(r){this.config=r}async getFiles(){return this.files.length===0&&await this.loadFiles(),this.files}async getFileContent(r){if(r==="main-function")return await this.config.fetchFunction(this.config.functionId,this.config.version);throw new Error(`File ${r} not found`)}async updateFileContent(r,s){const o=this.findFileById(r);o&&(o.content=s),console.log(`Updated file ${r} with content:`,s)}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}async loadFiles(){this.files=[{id:"main-function",name:"function.js",type:"file",path:"/function.js",metadata:{language:"javascript",lastModified:new Date}},{id:"versions",name:"versions",type:"folder",path:"/versions",children:this.config.versionList.map(r=>({id:`version-${r}`,name:`v${r}.js`,type:"file",path:`/versions/v${r}.js`,metadata:{language:"javascript"}}))}]}findFileById(r){const s=o=>{for(const c of o){if(c.id===r)return c;if(c.children){const g=s(c.children);if(g)return g}}return null};return s(this.files)}}class ze{config;files=[];constructor(r){this.config=r,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(r){if(r==="form-code")return this.config.codeContent;throw new Error(`File ${r} not found`)}async updateFileContent(r,s){if(r==="form-code"){this.config.codeContent=s;const o=this.files.find(c=>c.id===r);o&&(o.content=s)}}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}initializeFiles(){this.files=[{id:"form-code",name:this.config.fileName||"code.js",type:"file",path:`/${this.config.fileName||"code.js"}`,content:this.config.codeContent,metadata:{language:this.config.language||"javascript",lastModified:new Date}}]}findFileById(r){return this.files.find(s=>s.id===r)||null}}class Le{config;files=[];constructor(r){this.config=r,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(r){const s=this.findFileById(r);if(!s||!s.metadata?.url)throw new Error(`File ${r} not found`);try{const o=await fetch(s.metadata.url);if(!o.ok)throw new Error(`Failed to fetch file: ${o.statusText}`);return await o.text()}catch(o){throw new Error(`Error fetching file content: ${o}`)}}async updateFileContent(r,s){console.log(`Would save file ${r} content to backend:`,s);const o=this.findFileById(r);o&&(o.content=s)}async getFileMetadata(r){return this.findFileById(r)?.metadata||{}}initializeFiles(){this.files=this.config.fileUrls.map((r,s)=>({id:`url-file-${s}`,name:r.name,type:"file",path:`/${r.name}`,metadata:{language:r.type,url:r.url,lastModified:new Date}}))}findFileById(r){return this.files.find(s=>s.id===r)||null}}function $e(i){if(i.workflowConfig)return new Ae(i.workflowConfig);if(i.formConfig)return new ze(i.formConfig);if(i.urlConfig)return new Le(i.urlConfig);throw new Error("No valid configuration provided")}var O=(i=>(i.Explorer="explorer",i.Data="data",i.Functions="functions",i.Versions="versions",i.Tests="tests",i))(O||{});const Me=({value:i,onChange:r,language:s="javascript",filename:o,readOnly:c=!1,loading:g=!1})=>{const j=C=>{C!==void 0&&r(C)};return t.jsx("div",{className:"h-full w-full",children:t.jsx(Et,{height:"100%",defaultLanguage:s,defaultValue:i,onChange:j,theme:"vs-light",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0,padding:{top:16},scrollBeyondLastLine:!1,readOnly:c}})})},Ft=[{id:O.Explorer,icon:h.IconFolderOpen,label:"Files"},{id:O.Data,icon:h.IconDatabase,label:"Data"},{id:O.Functions,icon:h.IconCode,label:"Functions"},{id:O.Versions,icon:h.IconHistory,label:"Versions"},{id:O.Tests,icon:h.IconFlask,label:"Tests"}],Rt=({activePanel:i,setActivePanel:r,allowedPannels:s})=>{const o=w.useMemo(()=>Ft.filter(c=>s.includes(c.id)),[s]);return t.jsxs("div",{className:"w-14 border-r border-slate-200 bg-white flex flex-col gap-4 items-center py-4",children:[o.map(c=>{const g=c.icon;return t.jsx(N.Tooltip,{title:c.label,placement:"right",children:t.jsx(N.Button,{type:i===c.id?"primary":"text",icon:t.jsx(g,{size:16}),onClick:()=>r(c.id)})},c.id)}),t.jsx("div",{className:"mt-auto",children:t.jsx(N.Tooltip,{title:"Settings",placement:"right",children:t.jsx(N.Button,{type:"text",icon:t.jsx(h.IconSettings,{size:20})})})})]})},Be=({leftPanel:i,editor:r,rightPanel:s,activePanel:o,setActivePanel:c,allowedPannels:g=[O.Explorer]})=>t.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[t.jsx(Rt,{activePanel:o,setActivePanel:c,allowedPannels:g}),t.jsx("div",{className:"flex-1",children:s?t.jsxs(N.Splitter,{style:{height:"100%"},onResize:j=>console.log(j),children:[t.jsx(N.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-slate-200",collapsible:!0,children:t.jsx("div",{className:"h-full overflow-y-auto",children:i})}),t.jsx(N.Splitter.Panel,{defaultSize:"50%",min:"30%",children:r}),t.jsx(N.Splitter.Panel,{defaultSize:"25%",min:"20%",max:"50%",className:"bg-white border-l border-slate-200",children:t.jsx("div",{className:"h-full overflow-y-auto",children:s})})]}):t.jsxs(N.Splitter,{style:{height:"100%"},children:[t.jsx(N.Splitter.Panel,{defaultSize:"25%",min:"15%",max:"40%",className:"bg-white border-r border-slate-200",children:t.jsx("div",{className:"h-full overflow-y-auto",children:i})}),t.jsx(N.Splitter.Panel,{defaultSize:"75%",min:"60%",children:r})]})})]}),Ve=({files:i,activeFile:r,onFileSelect:s,loading:o=!1,error:c=null,onRefresh:g})=>{const j=R=>R.map(d=>({title:d.name,key:d.id,icon:d.type==="file"?t.jsx(h.IconFile,{size:16,className:"text-slate-500 flex"}):t.jsx(h.IconFolderOpen,{size:16,className:"text-slate-500 flex"}),isLeaf:d.type==="file",children:d.children?j(d.children):void 0,metadata:d.metadata})),C=j(i),v=(R,d)=>{d?.node.isLeaf&&d.node.key&&s(d.node.key)};return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Files"}),t.jsx("div",{className:"flex items-center gap-2",children:g&&t.jsx(N.Button,{type:"text",icon:t.jsx(h.IconPlus,{size:16}),onClick:g,loading:o,title:"Refresh files"})})]}),t.jsxs("div",{className:"p-2",children:[c&&t.jsx(N.Alert,{message:"Error loading files",description:c,type:"error",className:"mb-2"}),t.jsx(N.Tree,{treeData:C,onSelect:v,selectedKeys:r?[r]:[],showIcon:!0,defaultExpandAll:!0,showLine:!0,className:"file-explorer-tree"})]})]})},J=({config:i,rightPanel:r=!1})=>{const s=w.useMemo(()=>$e(i),[i]);console.log({config:i});const{files:o,activeFile:c,fileContent:g,loading:j,error:C,setActiveFile:v,updateFileContent:R,refreshFiles:d,getFileById:F}=Oe(s),S=c?F(c):null,I=S?.metadata?.language||"javascript";return t.jsx(Be,{leftPanel:t.jsx(Ve,{files:o,activeFile:c,onFileSelect:v,loading:j,error:C,onRefresh:d}),editor:t.jsx(Me,{value:g,onChange:R,language:I,filename:S?.name,readOnly:i.settings?.readOnly,loading:j}),rightPanel:r,activePanel:O.Explorer,setActivePanel:()=>{}})},St=({functionId:i,version:r,versionList:s,fetchFunction:o,fetchVersionList:c})=>{const g={workflowConfig:{functionId:i,version:r,versionList:s,fetchFunction:o,fetchVersionList:c}};return t.jsx(J,{config:g})},_t=({codeContent:i,fileName:r="code.js",language:s="javascript",readOnly:o=!1})=>{const c={formConfig:{codeContent:i,fileName:r,language:s},settings:{readOnly:o}};return t.jsx(J,{config:c})},Tt=({fileUrls:i,rightPanel:r})=>{const s={urlConfig:{fileUrls:i}};return t.jsx(J,{config:s,rightPanel:r})},Pt=({activeFile:i,showPreview:r,setShowPreview:s})=>t.jsxs("div",{className:"h-14 border-b border-slate-200 bg-white px-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-slate-900 mr-4",children:"CRM Code Editor"}),t.jsx("span",{className:"text-sm text-slate-500 px-2 py-1 bg-slate-100 rounded-md",children:i})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",onClick:()=>s(!r),title:r?"Hide Preview":"Show Preview",children:r?t.jsx(h.IconEyeOff,{size:18}):t.jsx(h.IconEye,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Version History",children:t.jsx(h.IconHistory,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Run Code",children:t.jsx(h.IconPlayerPlay,{size:18})}),t.jsx("button",{className:"p-1.5 hover:bg-slate-100 rounded-md text-slate-600",title:"Export",children:t.jsx(h.IconDownload,{size:18})}),t.jsxs("button",{className:"ml-2 px-3 py-1.5 bg-slate-900 text-white rounded-md flex items-center text-sm hover:bg-slate-800",children:[t.jsx(h.IconDeviceFloppy,{size:16,className:"mr-1.5"})," Save"]}),t.jsxs("div",{className:"ml-2 px-3 py-1.5 bg-emerald-100 text-emerald-800 rounded-md flex items-center text-sm",children:[t.jsx("span",{className:"w-2 h-2 bg-emerald-500 rounded-full mr-1.5"})," ","Draft"]})]})]}),Ot=()=>{const i=[{name:"Lead",fields:["id","name","email","phone","status","createdAt"],expanded:!0},{name:"Contact",fields:["id","firstName","lastName","email","phone"],expanded:!1},{name:"Account",fields:["id","name","industry","website","employees"],expanded:!1},{name:"Opportunity",fields:["id","name","amount","stage","closeDate"],expanded:!1}];return t.jsxs("div",{className:"h-full",children:[t.jsx("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:t.jsx("h2",{className:"font-medium text-sm",children:"Data Explorer"})}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"relative mb-3",children:[t.jsx(h.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-slate-400"}),t.jsx("input",{type:"text",placeholder:"Search objects...",className:"w-full pl-8 pr-3 py-2 text-sm border border-slate-200 rounded-md focus:outline-none focus:ring-2 focus:ring-slate-300"})]}),t.jsx("div",{children:i.map(r=>t.jsxs("div",{className:"mb-1",children:[t.jsxs("div",{className:"flex items-center p-2 hover:bg-slate-50 rounded-md cursor-pointer",children:[t.jsx(h.IconChevronRight,{size:16,className:`mr-1 text-slate-400 transition-transform ${r.expanded?"rotate-90":""}`}),t.jsx(h.IconDatabase,{size:16,className:"mr-2 text-slate-500"}),t.jsx("span",{className:"text-sm font-medium",children:r.name})]}),r.expanded&&t.jsx("div",{className:"ml-7 border-l border-slate-200 pl-2",children:r.fields.map(s=>t.jsx("div",{className:"flex items-center p-1.5 hover:bg-slate-50 rounded-md cursor-pointer",children:t.jsx("span",{className:"text-xs text-slate-600",children:s})},s))})]},r.name))})]})]})},It=()=>{const i=[{name:"formatCurrency",description:"Format a number as currency",category:"Formatting"},{name:"calculateDiscount",description:"Calculate discount based on amount",category:"Calculations"},{name:"getLeadData",description:"Fetch lead data from CRM",category:"Data Access"},{name:"updateContact",description:"Update contact information",category:"Data Modification"},{name:"sendEmail",description:"Send an email to a contact",category:"Communication"},{name:"validateEmail",description:"Validate email format",category:"Validation"}];return t.jsxs("div",{className:"h-full",children:[t.jsx("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:t.jsx("h2",{className:"font-medium text-sm",children:"Function Library"})}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"relative mb-3",children:[t.jsx(h.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-slate-400"}),t.jsx("input",{type:"text",placeholder:"Search functions...",className:"w-full pl-8 pr-3 py-2 text-sm border border-slate-200 rounded-md focus:outline-none focus:ring-2 focus:ring-slate-300"})]}),t.jsx("div",{children:i.map(r=>t.jsxs("div",{className:"p-2 border border-slate-200 rounded-md mb-2 hover:bg-slate-50 cursor-pointer",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx(h.IconCode,{size:16,className:"mr-2 text-slate-500"}),t.jsx("span",{className:"text-sm font-medium",children:r.name})]}),t.jsx("span",{className:"text-xs bg-slate-100 px-2 py-0.5 rounded text-slate-600",children:r.category})]}),t.jsx("p",{className:"text-xs text-slate-500 mt-1",children:r.description})]},r.name))}),t.jsxs("div",{className:"mt-4 p-3 bg-slate-50 rounded-md border border-slate-200 flex items-center",children:[t.jsx(h.IconBook,{size:16,className:"text-slate-500 mr-2"}),t.jsx("span",{className:"text-xs text-slate-600",children:"Browse documentation for more functions and examples"})]})]})]})},kt=({code:i})=>{const[r,s]=w.useState(null),[o,c]=w.useState(!1),g="body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; padding: 1rem; }",C=(d=>d.replace(/import\s+.*axios.*from\s+['"]axios['"];?/g,"// Axios imports removed for preview").replace(/axios\./g,"/* axios. */").replace(/fetch\(/g,"/* fetch( */"))(i),v=`
26
26
  <!DOCTYPE html>
27
27
  <html>
28
28
  <head>
@@ -51,4 +51,4 @@ Check the top-level render call using <`+a+">.")}return n}}function Ce(e,n){{if(
51
51
  <\/script>
52
52
  </body>
53
53
  </html>
54
- `,R=()=>{c(!0),s(null),setTimeout(()=>c(!1),300)};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Preview"}),t.jsx("button",{className:"p-1 hover:bg-slate-100 rounded-md",onClick:R,children:t.jsx(h.IconRefresh,{size:16,className:o?"animate-spin":""})})]}),t.jsx("div",{className:"flex-1 bg-white overflow-auto",children:r?t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-md flex items-start",children:[t.jsx(h.IconAlertTriangle,{size:16,className:"text-red-500 mr-2 mt-0.5"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-red-800",children:"Preview Error"}),t.jsx("p",{className:"text-xs text-red-600",children:r})]})]}):t.jsx("iframe",{title:"Preview",className:"w-full h-full",srcDoc:v,sandbox:"allow-scripts",onError:()=>s("Failed to load preview")})})]})},Dt=()=>{const i=[{id:"1",name:"Should format currency correctly",status:"passed",duration:"12ms"},{id:"2",name:"Should calculate discount",status:"passed",duration:"8ms"},{id:"3",name:"Should validate email format",status:"failed",duration:"5ms",error:"Expected true but received false"},{id:"4",name:"Should handle empty input",status:"passed",duration:"3ms"}];return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Test Runner"}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("button",{className:"p-1 hover:bg-slate-100 rounded-md mr-1",children:t.jsx(h.IconSettings,{size:14})}),t.jsxs("button",{className:"bg-slate-900 text-white text-xs px-2 py-1 rounded-md flex items-center",children:[t.jsx(h.IconPlayerPlay,{size:12,className:"mr-1"})," Run Tests"]})]})]}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"mb-3 p-2 bg-slate-50 rounded-md border border-slate-200",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-medium",children:"Test Summary"}),t.jsx("span",{className:"text-xs",children:"3 passed, 1 failed, 4 total"})]}),t.jsx("div",{className:"w-full h-2 bg-slate-200 rounded-full mt-2 overflow-hidden",children:t.jsx("div",{className:"h-full bg-emerald-500",style:{width:"75%"}})})]}),t.jsx("div",{children:i.map(r=>t.jsxs("div",{className:`p-2 mb-2 rounded-md ${r.status==="failed"?"bg-red-50 border border-red-100":"bg-slate-50 border border-slate-200"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[r.status==="passed"?t.jsx(h.IconCircleCheck,{size:16,className:"text-emerald-500 mr-2"}):t.jsx(h.IconCircleX,{size:16,className:"text-red-500 mr-2"}),t.jsx("span",{className:"text-sm",children:r.name})]}),t.jsx("span",{className:"text-xs text-slate-500",children:r.duration})]}),r.error&&t.jsx("div",{className:"mt-2 text-xs text-red-600 bg-red-50 p-2 rounded",children:r.error})]},r.id))}),t.jsx("div",{className:"mt-4",children:t.jsx("button",{className:"w-full py-2 border border-dashed border-slate-300 rounded-md text-sm text-slate-500 hover:bg-slate-50",children:"+ Add New Test Case"})})]})]})},At=()=>{const i=[{id:"v1",name:"Initial version",author:"John Doe",timestamp:"Today, 2:30 PM",current:!0},{id:"v2",name:"Added form validation",author:"John Doe",timestamp:"Today, 1:15 PM",current:!1},{id:"v3",name:"Fixed API integration",author:"Sarah Smith",timestamp:"Yesterday, 4:45 PM",current:!1},{id:"v4",name:"Initial setup",author:"Sarah Smith",timestamp:"Yesterday, 11:30 AM",current:!1}];return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Version History"}),t.jsx("button",{className:"text-xs text-slate-500 hover:text-slate-800",children:"Save Version"})]}),t.jsx("div",{className:"p-2",children:i.map(r=>t.jsxs("div",{className:`p-3 mb-2 rounded-md ${r.current?"bg-slate-100 border border-slate-200":"hover:bg-slate-50 cursor-pointer"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-medium",children:r.name}),r.current&&t.jsx("span",{className:"text-xs bg-emerald-100 text-emerald-800 px-2 py-0.5 rounded",children:"Current"})]}),t.jsxs("div",{className:"flex items-center mt-1 text-xs text-slate-500",children:[t.jsx(h.IconUser,{size:12,className:"mr-1"}),t.jsx("span",{className:"mr-3",children:r.author}),t.jsx(h.IconClock,{size:12,className:"mr-1"}),t.jsx("span",{children:r.timestamp})]}),!r.current&&t.jsx("div",{className:"mt-2",children:t.jsxs("button",{className:"text-xs flex items-center text-slate-600 hover:text-slate-900",children:[t.jsx(h.IconRotate,{size:12,className:"mr-1"})," Restore this version"]})})]},r.id))})]})},zt="1.0.0";Object.defineProperty(exports,"Alert",{enumerable:!0,get:()=>N.Alert});Object.defineProperty(exports,"Button",{enumerable:!0,get:()=>N.Button});Object.defineProperty(exports,"Splitter",{enumerable:!0,get:()=>N.Splitter});Object.defineProperty(exports,"Tooltip",{enumerable:!0,get:()=>N.Tooltip});Object.defineProperty(exports,"Tree",{enumerable:!0,get:()=>N.Tree});exports.CodeEditor=Me;exports.CodeEditorWrapper=J;exports.DataExplorer=Ot;exports.EditorLayout=Be;exports.FileExplorer=Ve;exports.FormCodeEditor=_t;exports.FormFileProvider=ze;exports.FunctionLibrary=It;exports.Header=Pt;exports.Panels=I;exports.PreviewPanel=kt;exports.TestRunner=Dt;exports.URLCodeEditor=Tt;exports.URLFileProvider=Le;exports.VERSION=zt;exports.VersionHistory=At;exports.WorkflowCodeEditor=St;exports.WorkflowFileProvider=Ae;exports.createFileProvider=$e;exports.useFileManager=Oe;
54
+ `,R=()=>{c(!0),s(null),setTimeout(()=>c(!1),300)};return t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Preview"}),t.jsx("button",{className:"p-1 hover:bg-slate-100 rounded-md",onClick:R,children:t.jsx(h.IconRefresh,{size:16,className:o?"animate-spin":""})})]}),t.jsx("div",{className:"flex-1 bg-white overflow-auto",children:r?t.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded-md flex items-start",children:[t.jsx(h.IconAlertTriangle,{size:16,className:"text-red-500 mr-2 mt-0.5"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-red-800",children:"Preview Error"}),t.jsx("p",{className:"text-xs text-red-600",children:r})]})]}):t.jsx("iframe",{title:"Preview",className:"w-full h-full",srcDoc:v,sandbox:"allow-scripts",onError:()=>s("Failed to load preview")})})]})},Dt=()=>{const i=[{id:"1",name:"Should format currency correctly",status:"passed",duration:"12ms"},{id:"2",name:"Should calculate discount",status:"passed",duration:"8ms"},{id:"3",name:"Should validate email format",status:"failed",duration:"5ms",error:"Expected true but received false"},{id:"4",name:"Should handle empty input",status:"passed",duration:"3ms"}];return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Test Runner"}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("button",{className:"p-1 hover:bg-slate-100 rounded-md mr-1",children:t.jsx(h.IconSettings,{size:14})}),t.jsxs("button",{className:"bg-slate-900 text-white text-xs px-2 py-1 rounded-md flex items-center",children:[t.jsx(h.IconPlayerPlay,{size:12,className:"mr-1"})," Run Tests"]})]})]}),t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"mb-3 p-2 bg-slate-50 rounded-md border border-slate-200",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-medium",children:"Test Summary"}),t.jsx("span",{className:"text-xs",children:"3 passed, 1 failed, 4 total"})]}),t.jsx("div",{className:"w-full h-2 bg-slate-200 rounded-full mt-2 overflow-hidden",children:t.jsx("div",{className:"h-full bg-emerald-500",style:{width:"75%"}})})]}),t.jsx("div",{children:i.map(r=>t.jsxs("div",{className:`p-2 mb-2 rounded-md ${r.status==="failed"?"bg-red-50 border border-red-100":"bg-slate-50 border border-slate-200"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center",children:[r.status==="passed"?t.jsx(h.IconCircleCheck,{size:16,className:"text-emerald-500 mr-2"}):t.jsx(h.IconCircleX,{size:16,className:"text-red-500 mr-2"}),t.jsx("span",{className:"text-sm",children:r.name})]}),t.jsx("span",{className:"text-xs text-slate-500",children:r.duration})]}),r.error&&t.jsx("div",{className:"mt-2 text-xs text-red-600 bg-red-50 p-2 rounded",children:r.error})]},r.id))}),t.jsx("div",{className:"mt-4",children:t.jsx("button",{className:"w-full py-2 border border-dashed border-slate-300 rounded-md text-sm text-slate-500 hover:bg-slate-50",children:"+ Add New Test Case"})})]})]})},At=()=>{const i=[{id:"v1",name:"Initial version",author:"John Doe",timestamp:"Today, 2:30 PM",current:!0},{id:"v2",name:"Added form validation",author:"John Doe",timestamp:"Today, 1:15 PM",current:!1},{id:"v3",name:"Fixed API integration",author:"Sarah Smith",timestamp:"Yesterday, 4:45 PM",current:!1},{id:"v4",name:"Initial setup",author:"Sarah Smith",timestamp:"Yesterday, 11:30 AM",current:!1}];return t.jsxs("div",{className:"h-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-slate-200",children:[t.jsx("h2",{className:"font-medium text-sm",children:"Version History"}),t.jsx("button",{className:"text-xs text-slate-500 hover:text-slate-800",children:"Save Version"})]}),t.jsx("div",{className:"p-2",children:i.map(r=>t.jsxs("div",{className:`p-3 mb-2 rounded-md ${r.current?"bg-slate-100 border border-slate-200":"hover:bg-slate-50 cursor-pointer"}`,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-medium",children:r.name}),r.current&&t.jsx("span",{className:"text-xs bg-emerald-100 text-emerald-800 px-2 py-0.5 rounded",children:"Current"})]}),t.jsxs("div",{className:"flex items-center mt-1 text-xs text-slate-500",children:[t.jsx(h.IconUser,{size:12,className:"mr-1"}),t.jsx("span",{className:"mr-3",children:r.author}),t.jsx(h.IconClock,{size:12,className:"mr-1"}),t.jsx("span",{children:r.timestamp})]}),!r.current&&t.jsx("div",{className:"mt-2",children:t.jsxs("button",{className:"text-xs flex items-center text-slate-600 hover:text-slate-900",children:[t.jsx(h.IconRotate,{size:12,className:"mr-1"})," Restore this version"]})})]},r.id))})]})},zt="1.0.0";Object.defineProperty(exports,"Alert",{enumerable:!0,get:()=>N.Alert});Object.defineProperty(exports,"Button",{enumerable:!0,get:()=>N.Button});Object.defineProperty(exports,"Splitter",{enumerable:!0,get:()=>N.Splitter});Object.defineProperty(exports,"Tooltip",{enumerable:!0,get:()=>N.Tooltip});Object.defineProperty(exports,"Tree",{enumerable:!0,get:()=>N.Tree});exports.CodeEditor=Me;exports.CodeEditorWrapper=J;exports.DataExplorer=Ot;exports.EditorLayout=Be;exports.FileExplorer=Ve;exports.FormCodeEditor=_t;exports.FormFileProvider=ze;exports.FunctionLibrary=It;exports.Header=Pt;exports.Panels=O;exports.PreviewPanel=kt;exports.TestRunner=Dt;exports.URLCodeEditor=Tt;exports.URLFileProvider=Le;exports.VERSION=zt;exports.VersionHistory=At;exports.WorkflowCodeEditor=St;exports.WorkflowFileProvider=Ae;exports.createFileProvider=$e;exports.useFileManager=Oe;
package/dist/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- import se, { useState as I, useCallback as z, useEffect as Pe, useMemo as Ct } from "react";
1
+ import se, { useState as k, useCallback as z, useEffect as Pe, useMemo as Ct } from "react";
2
2
  import Ft from "@monaco-editor/react";
3
- import { Tooltip as Oe, Button as ne, Splitter as O, Alert as Rt, Tree as _t } from "antd";
3
+ import { Tooltip as Oe, Button as ne, Splitter as I, Alert as Rt, Tree as _t } from "antd";
4
4
  import { Alert as yr, Button as jr, Splitter as wr, Tooltip as Er, Tree as Nr } from "antd";
5
5
  import { IconFolderOpen as Ae, IconDatabase as ze, IconCode as $e, IconHistory as Le, IconFlask as Tt, IconSettings as Me, IconPlus as St, IconFile as Pt, IconEyeOff as Ot, IconEye as It, IconPlayerPlay as Be, IconDownload as kt, IconDeviceFloppy as Dt, IconSearch as Ve, IconChevronRight as At, IconBook as zt, IconRefresh as $t, IconAlertTriangle as Lt, IconCircleCheck as Mt, IconCircleX as Bt, IconUser as Vt, IconClock as Wt, IconRotate as Yt } from "@tabler/icons-react";
6
6
  var H = { exports: {} }, L = {};
@@ -84,7 +84,7 @@ function qt() {
84
84
  function oe(e) {
85
85
  return e.displayName || "Context";
86
86
  }
87
- function S(e) {
87
+ function P(e) {
88
88
  if (e == null)
89
89
  return null;
90
90
  if (typeof e.tag == "number" && h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
@@ -117,11 +117,11 @@ function qt() {
117
117
  return Qe(e, e.render, "ForwardRef");
118
118
  case E:
119
119
  var l = e.displayName || null;
120
- return l !== null ? l : S(e.type) || "Memo";
120
+ return l !== null ? l : P(e.type) || "Memo";
121
121
  case C: {
122
122
  var m = e, p = m._payload, f = m._init;
123
123
  try {
124
- return S(f(p));
124
+ return P(f(p));
125
125
  } catch {
126
126
  return null;
127
127
  }
@@ -129,7 +129,7 @@ function qt() {
129
129
  }
130
130
  return null;
131
131
  }
132
- var P = Object.assign, $ = 0, le, ce, de, ue, fe, me, he;
132
+ var O = Object.assign, $ = 0, le, ce, de, ue, fe, me, he;
133
133
  function pe() {
134
134
  }
135
135
  pe.__reactDisabledLog = !0;
@@ -165,25 +165,25 @@ function qt() {
165
165
  writable: !0
166
166
  };
167
167
  Object.defineProperties(console, {
168
- log: P({}, e, {
168
+ log: O({}, e, {
169
169
  value: le
170
170
  }),
171
- info: P({}, e, {
171
+ info: O({}, e, {
172
172
  value: ce
173
173
  }),
174
- warn: P({}, e, {
174
+ warn: O({}, e, {
175
175
  value: de
176
176
  }),
177
- error: P({}, e, {
177
+ error: O({}, e, {
178
178
  value: ue
179
179
  }),
180
- group: P({}, e, {
180
+ group: O({}, e, {
181
181
  value: fe
182
182
  }),
183
- groupCollapsed: P({}, e, {
183
+ groupCollapsed: O({}, e, {
184
184
  value: me
185
185
  }),
186
- groupEnd: P({}, e, {
186
+ groupEnd: O({}, e, {
187
187
  value: he
188
188
  })
189
189
  });
@@ -478,7 +478,7 @@ function qt() {
478
478
  function Ce() {
479
479
  {
480
480
  if (ee.current) {
481
- var e = S(ee.current.type);
481
+ var e = P(ee.current.type);
482
482
  if (e)
483
483
  return `
484
484
 
@@ -513,7 +513,7 @@ Check the top-level render call using <` + a + ">.");
513
513
  return;
514
514
  Fe[a] = !0;
515
515
  var l = "";
516
- e && e._owner && e._owner !== ee.current && (l = " It was passed a child from " + S(e._owner.type) + "."), D(e), h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, l), D(null);
516
+ e && e._owner && e._owner !== ee.current && (l = " It was passed a child from " + P(e._owner.type) + "."), D(e), h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, l), D(null);
517
517
  }
518
518
  }
519
519
  function _e(e, n) {
@@ -550,11 +550,11 @@ Check the top-level render call using <` + a + ">.");
550
550
  else
551
551
  return;
552
552
  if (a) {
553
- var l = S(n);
553
+ var l = P(n);
554
554
  at(a, e.props, "prop", l, e);
555
555
  } else if (n.PropTypes !== void 0 && !te) {
556
556
  te = !0;
557
- var m = S(n);
557
+ var m = P(n);
558
558
  h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", m || "Unknown");
559
559
  }
560
560
  typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
@@ -581,7 +581,7 @@ Check the top-level render call using <` + a + ">.");
581
581
  var F = vt();
582
582
  F ? u += F : u += Ce();
583
583
  var b;
584
- e === null ? b = "null" : Q(e) ? b = "array" : e !== void 0 && e.$$typeof === r ? (b = "<" + (S(e.type) || "Unknown") + " />", u = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, u);
584
+ e === null ? b = "null" : Q(e) ? b = "array" : e !== void 0 && e.$$typeof === r ? (b = "<" + (P(e.type) || "Unknown") + " />", u = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, u);
585
585
  }
586
586
  var j = xt(e, n, a, m, p);
587
587
  if (j == null)
@@ -618,7 +618,7 @@ function Ht() {
618
618
  }
619
619
  var t = Ht();
620
620
  function Jt(i) {
621
- const [r, s] = I([]), [o, c] = I(null), [g, y] = I(""), [w, x] = I(!1), [N, d] = I(null), E = z(async () => {
621
+ const [r, s] = k([]), [o, c] = k(null), [g, y] = k(""), [w, x] = k(!1), [N, d] = k(null), E = z(async () => {
622
622
  try {
623
623
  x(!0), d(null);
624
624
  const v = await i.getFiles();
@@ -880,6 +880,7 @@ function Zt(i) {
880
880
  return new Xt(i.urlConfig);
881
881
  throw new Error("No valid configuration provided");
882
882
  }
883
+ var S = /* @__PURE__ */ ((i) => (i.Explorer = "explorer", i.Data = "data", i.Functions = "functions", i.Versions = "versions", i.Tests = "tests", i))(S || {});
883
884
  const Qt = ({
884
885
  value: i,
885
886
  onChange: r,
@@ -914,31 +915,29 @@ const Qt = ({
914
915
  }
915
916
  }
916
917
  ) });
917
- };
918
- var k = /* @__PURE__ */ ((i) => (i.Explorer = "explorer", i.Data = "data", i.Functions = "functions", i.Versions = "versions", i.Tests = "tests", i))(k || {});
919
- const er = [
918
+ }, er = [
920
919
  {
921
- id: k.Explorer,
920
+ id: S.Explorer,
922
921
  icon: Ae,
923
922
  label: "Files"
924
923
  },
925
924
  {
926
- id: k.Data,
925
+ id: S.Data,
927
926
  icon: ze,
928
927
  label: "Data"
929
928
  },
930
929
  {
931
- id: k.Functions,
930
+ id: S.Functions,
932
931
  icon: $e,
933
932
  label: "Functions"
934
933
  },
935
934
  {
936
- id: k.Versions,
935
+ id: S.Versions,
937
936
  icon: Le,
938
937
  label: "Versions"
939
938
  },
940
939
  {
941
- id: k.Tests,
940
+ id: S.Tests,
942
941
  icon: Tt,
943
942
  label: "Tests"
944
943
  }
@@ -971,7 +970,7 @@ const er = [
971
970
  rightPanel: s,
972
971
  activePanel: o,
973
972
  setActivePanel: c,
974
- allowedPannels: g = [k.Explorer]
973
+ allowedPannels: g = [S.Explorer]
975
974
  }) => /* @__PURE__ */ t.jsxs("div", { className: "flex flex-1 overflow-hidden", children: [
976
975
  /* @__PURE__ */ t.jsx(
977
976
  tr,
@@ -982,13 +981,13 @@ const er = [
982
981
  }
983
982
  ),
984
983
  /* @__PURE__ */ t.jsx("div", { className: "flex-1", children: s ? /* @__PURE__ */ t.jsxs(
985
- O,
984
+ I,
986
985
  {
987
986
  style: { height: "100%" },
988
987
  onResize: (y) => console.log(y),
989
988
  children: [
990
989
  /* @__PURE__ */ t.jsx(
991
- O.Panel,
990
+ I.Panel,
992
991
  {
993
992
  defaultSize: "25%",
994
993
  min: "15%",
@@ -998,9 +997,9 @@ const er = [
998
997
  children: /* @__PURE__ */ t.jsx("div", { className: "h-full overflow-y-auto", children: i })
999
998
  }
1000
999
  ),
1001
- /* @__PURE__ */ t.jsx(O.Panel, { defaultSize: "50%", min: "30%", children: r }),
1000
+ /* @__PURE__ */ t.jsx(I.Panel, { defaultSize: "50%", min: "30%", children: r }),
1002
1001
  /* @__PURE__ */ t.jsx(
1003
- O.Panel,
1002
+ I.Panel,
1004
1003
  {
1005
1004
  defaultSize: "25%",
1006
1005
  min: "20%",
@@ -1011,9 +1010,9 @@ const er = [
1011
1010
  )
1012
1011
  ]
1013
1012
  }
1014
- ) : /* @__PURE__ */ t.jsxs(O, { style: { height: "100%" }, children: [
1013
+ ) : /* @__PURE__ */ t.jsxs(I, { style: { height: "100%" }, children: [
1015
1014
  /* @__PURE__ */ t.jsx(
1016
- O.Panel,
1015
+ I.Panel,
1017
1016
  {
1018
1017
  defaultSize: "25%",
1019
1018
  min: "15%",
@@ -1022,7 +1021,7 @@ const er = [
1022
1021
  children: /* @__PURE__ */ t.jsx("div", { className: "h-full overflow-y-auto", children: i })
1023
1022
  }
1024
1023
  ),
1025
- /* @__PURE__ */ t.jsx(O.Panel, { defaultSize: "75%", min: "60%", children: r })
1024
+ /* @__PURE__ */ t.jsx(I.Panel, { defaultSize: "75%", min: "60%", children: r })
1026
1025
  ] }) })
1027
1026
  ] }), nr = ({
1028
1027
  files: i,
@@ -1126,7 +1125,7 @@ const er = [
1126
1125
  }
1127
1126
  ),
1128
1127
  rightPanel: r,
1129
- activePanel: "explorer",
1128
+ activePanel: S.Explorer,
1130
1129
  setActivePanel: () => {
1131
1130
  }
1132
1131
  }
@@ -1368,7 +1367,7 @@ const er = [
1368
1367
  ] })
1369
1368
  ] });
1370
1369
  }, hr = ({ code: i }) => {
1371
- const [r, s] = I(null), [o, c] = I(!1), g = "body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; padding: 1rem; }", w = ((d) => d.replace(
1370
+ const [r, s] = k(null), [o, c] = k(!1), g = "body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; padding: 1rem; }", w = ((d) => d.replace(
1372
1371
  /import\s+.*axios.*from\s+['"]axios['"];?/g,
1373
1372
  "// Axios imports removed for preview"
1374
1373
  ).replace(/axios\./g, "/* axios. */").replace(/fetch\(/g, "/* fetch( */"))(i), x = `
@@ -1586,7 +1585,7 @@ export {
1586
1585
  Kt as FormFileProvider,
1587
1586
  mr as FunctionLibrary,
1588
1587
  ur as Header,
1589
- k as Panels,
1588
+ S as Panels,
1590
1589
  hr as PreviewPanel,
1591
1590
  wr as Splitter,
1592
1591
  pr as TestRunner,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superleap-code-editor",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A flexible, reusable code editor component with multiple file handling modes",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",