superleap-code-editor 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{base-80a1f760-CWj2neNl.js → base-80a1f760-d1umV0jo.js} +1 -1
- package/dist/{base-80a1f760-CdDmd_MV.mjs → base-80a1f760-fVz5do-m.mjs} +1 -1
- package/dist/components/layout/editorLayout.d.ts.map +1 -1
- package/dist/{consoleHook-59e792cb-CtzG7iU5.mjs → consoleHook-59e792cb-B0kImiil.mjs} +1 -1
- package/dist/{consoleHook-59e792cb-C91AYyeB.js → consoleHook-59e792cb-DnIw4sH7.js} +1 -1
- package/dist/{index-599aeaf7-Dq5T7F7z.js → index-599aeaf7-BviABfK9.js} +1 -1
- package/dist/{index-599aeaf7-CyB8aqn2.mjs → index-599aeaf7-lJCQp6qJ.mjs} +3 -3
- package/dist/{index-DLUUmPCw.mjs → index-B0Msi189.mjs} +2 -2
- package/dist/{index-DWcLiCy2.mjs → index-BFXEz9M3.mjs} +3 -3
- package/dist/{index-BF6E5gww.mjs → index-C0WWy03d.mjs} +5 -4
- package/dist/{index-ILUXuYV2.js → index-CmIRCaeW.js} +1 -1
- package/dist/{index-BecajFqz.js → index-DomJKqdA.js} +1 -1
- package/dist/{index-Hs1gwvLk.js → index-GIzPbCRd.js} +2 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -184,12 +184,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
184
184
|
- less than the value passed to \`max\` (or ${qb} if no \`max\` prop is set)
|
|
185
185
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
186
186
|
|
|
187
|
-
Defaulting to \`null\`.`}var Dpe=dI,Epe=pI;const Ape=b.forwardRef(({value:t=0,max:e=100,className:n,color:r="primary",...i},a)=>{const o=`bg-${r}-base`;return d.jsx(Dpe,{ref:a,value:t,max:e,className:G("relative h-8 w-full overflow-hidden rounded-128 bg-fill-default-fill-gray",n),...i,children:d.jsx(Epe,{className:G("h-full transition-all",o),style:{width:`${t/e*100}%`}})})});Ape.displayName="Progress";class gI{config;files=[];constructor(e){this.config=e}async getFiles(){return this.files.length===0&&await this.loadFiles(),this.files}async getFileContent(e){if(e==="main-function")return await this.config.fetchFunction(this.config.functionId,this.config.version);throw new Error(`File ${e} not found`)}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds(),isDirty:!0})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async loadFiles(){this.files=[{id:"main-function",name:"function.js",type:"file",path:"/function.js",metadata:{language:"javascript",lastModified:new Date().getMilliseconds()}},{id:"versions",name:"versions",type:"folder",path:"/versions",children:this.config.versionList.map(e=>({id:`version-${e}`,name:`v${e}.js`,type:"file",path:`/versions/v${e}.js`,metadata:{language:"javascript"}}))}]}findFileById(e){const n=r=>{for(const i of r){if(i.id===e)return i;if(i.children){const a=n(i.children);if(a)return a}}return null};return n(this.files)}}class yI{config;files=[];constructor(e){this.config=e,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(e){if(e==="form-code")return this.config.codeContent;throw new Error(`File ${e} not found`)}async updateFileContent(e,n){if(e==="form-code"){this.config.codeContent=n;const r=this.files.find(i=>i.id===e);r&&(r.content=n,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds(),isDirty:!0})}}async getFileMetadata(e){return this.findFileById(e)?.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().getMilliseconds()}}]}findFileById(e){return Ca(this.files,e)||null}}class bI{config;originalFiles=[];newFiles=[];constructor(e){this.config=e,this.initializeFiles()}async getFiles(){return[...this.originalFiles,...this.newFiles]}async getFileContent(e){const n=this.findFileById(e);if(!n)throw new Error(`File ${e} not found`);if(n.content)return n.content;if(n.metadata&&"url"in n.metadata&&n.metadata.url)try{const r=await fetch(n.metadata.url);if(!r.ok)throw new Error(`Failed to fetch file: ${r.statusText}`);const i=await r.text();return n.content=i,i}catch(r){throw new Error(`Error fetching file content: ${r}`)}return""}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds(),isDirty:!0})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async createFile(e,n=""){const r=e.split("/").pop()||"untitled",i={id:`new-file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:r,type:"file",path:e,content:n,metadata:{language:this.getLanguageFromPath(e),lastModified:new Date().getMilliseconds(),isNew:!0}};return this.newFiles.push(i),i}async createFolder(e){const n=e.split("/").pop()||"untitled",r={id:`new-folder-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:n,type:"folder",path:e,children:[],metadata:{lastModified:new Date().getMilliseconds(),isNew:!0}};return this.newFiles.push(r),r}async deleteFile(e){this.newFiles=this.newFiles.filter(n=>n.id!==e)}async deleteFolder(e){this.newFiles=this.newFiles.filter(n=>n.id!==e)}async renameFile(e,n){const r=this.findFileById(e);r&&(r.name=n,r.path=r.path.replace(/[^/]+$/,n),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async moveFile(e,n){const r=this.findFileById(e);r&&(r.path=n,r.name=n.split("/").pop()||r.name,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}getEditorData(){const e=[...this.originalFiles,...this.newFiles],n={};return e.forEach(r=>{if(r.type==="file"&&r.content){const i=Un(r.path,r.name);n[i]=r.content}}),{files:e,fileContents:n,metadata:{lastModified:new Date().getMilliseconds(),version:"1.0.0"}}}async loadEditorData(e){this.newFiles=[],e.files.forEach(n=>{n.metadata?.isNew&&this.newFiles.push(n)}),Object.entries(e.fileContents).forEach(([n,r])=>{const i=this.findFileByPath(n);i&&(i.content=r)})}initializeFiles(){this.originalFiles=this.config.fileUrls.map((e,n)=>({id:`url-file-${n}`,name:e.name,type:"file",path:`/${e.name}`,metadata:{language:e.type,url:e.url,lastModified:new Date().getMilliseconds()}}))}findFileById(e){const n=[...this.originalFiles,...this.newFiles];return Ca(n,e)||null}findFileByPath(e){return[...this.originalFiles,...this.newFiles].find(r=>r.path===e)||null}getLanguageFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",md:"markdown",py:"python",java:"java",cpp:"cpp",c:"c"}[n||""]||"text"}}class Qpe{config;originalFiles=[];newFiles=[];changeJournal=new Map;contentCache=new Map;PROVIDER_VERSION="1.0";MAX_CACHE_SIZE=50;MAX_CACHE_MEMORY=10*1024*1024;constructor(e){this.config=e,this.initializeFiles()}async getFiles(){let e=[...this.originalFiles];for(const n of this.newFiles)this.changeJournal.get(n.id)!=="deleted"&&(e=so(n,e));return this.filterDeletedFiles(e)}filterDeletedFiles(e){return e.filter(n=>this.changeJournal.get(n.id)!=="deleted").map(n=>({...n,children:n.children?this.filterDeletedFiles(n.children):void 0}))}async getFileContent(e){if(this.contentCache.has(e))return this.contentCache.get(e);const n=this.findFileById(e);if(!n)throw new Error(`File ${e} not found`);if(n.content)return this.contentCache.set(e,n.content),this.manageCacheSize(),n.content;try{const r=this.buildFileUrl(n),i=await fetch(r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);const a=await i.text();return this.contentCache.set(e,a),this.manageCacheSize(),a}catch(r){throw new Error(`Error fetching file content: ${r}`)}}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,this.contentCache.set(e,n),this.manageCacheSize(),this.changeJournal.has(e)||this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds(),isDirty:!0})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async createFile(e,n=""){const{name:r,parentPath:i}=qO(e),a={id:`new-file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:r,type:"file",path:i,content:n,metadata:{language:this.getLanguageFromPath(e),lastModified:new Date().getMilliseconds(),providerVersion:this.PROVIDER_VERSION,isNew:!0}};return this.newFiles.push(a),this.changeJournal.set(a.id,"new"),this.contentCache.set(a.id,n),this.manageCacheSize(),a}async createFolder(e){const{name:n,parentPath:r}=qO(e),i={id:`new-folder-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:n,type:"folder",path:r,children:[],metadata:{lastModified:new Date().getMilliseconds(),providerVersion:this.PROVIDER_VERSION}};return this.newFiles.push(i),this.changeJournal.set(i.id,"new"),i}async deleteFile(e){this.changeJournal.set(e,"deleted"),this.contentCache.delete(e)}async deleteFolder(e){this.changeJournal.set(e,"deleted")}async renameFile(e,n){const r=this.findFileById(e);r&&(r.name=n,r.path=r.path.replace(/[^/]+$/,n),(r.content||this.contentCache.has(e))&&this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async moveFile(e,n){const r=this.findFileById(e);r&&(r.path=n,r.name=n.split("/").pop()||r.name,(r.content||this.contentCache.has(e))&&this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async saveAllChanges(){let e=[];const n=[],r=new Set,i=Vr(this.originalFiles);for(const o of i)this.changeJournal.has(o.id)||(e=so({...o,content:void 0},e));const a=this.changeJournal.entries();for(const[o,s]of a)if(s!=="deleted"&&(s==="new"||s==="modified")){const l=this.findFileById(o);if(!l)continue;try{l.type==="file"&&await this.uploadFile(l);const f={id:l.id,name:l.name,type:l.type,path:l.path,children:l.children,metadata:{...l.metadata,lastModified:new Date().getMilliseconds(),isNew:void 0,isDirty:void 0}};e=so(f,e),r.add(o),l.type==="file"&&this.contentCache.delete(o)}catch(f){n.push(`Failed to upload ${l.name}: ${f}`)}}return r.forEach(o=>{this.changeJournal.delete(o),this.newFiles=this.newFiles.filter(s=>s.id!==o)}),n.length>0&&console.warn(`Some uploads failed (${n.length} files):`,n),e}commitSavedChanges(e){this.originalFiles=e,this.newFiles=[],this.changeJournal.clear(),this.contentCache.clear();const n=r=>r.map(i=>({...i,content:void 0,metadata:{...i.metadata,isNew:void 0,isDirty:void 0,lastModified:new Date().getMilliseconds()},children:i.children?n(i.children):void 0}));this.originalFiles=n(this.originalFiles)}getEditorData(){const e=[...this.originalFiles,...this.newFiles],n={};return this.contentCache.forEach((r,i)=>{const a=this.findFileById(i);if(a){const o=Un(a.path,a.name);n[o]=r}}),{files:e,fileContents:n,metadata:{lastModified:new Date().getMilliseconds(),version:this.PROVIDER_VERSION}}}async loadEditorData(e){this.newFiles=[],this.changeJournal.clear(),this.contentCache.clear(),e.files.forEach(n=>{n.metadata?.isNew&&(this.newFiles.push(n),this.changeJournal.set(n.id,"new"))}),Object.entries(e.fileContents).forEach(([n,r])=>{const i=this.findFileByPath(n);i&&(this.contentCache.set(i.id,r),i.content=r)})}async uploadFile(e){if(!this.config)throw new Error("Configuration not provided");const n=await this.config.getAuthToken(),r=new FormData,i=e.content||this.contentCache.get(e.id)||"",a=new Blob([i],{type:this.getMimeTypeFromPath(e.name)});r.append("file",a,e.name),r.append("keep_file_name_unchanged","1");const o=this.buildS3Path(e.path);r.append("custom_path",o);const s=await fetch(this.config.uploadEndpoint,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Cache-Control":"no-cache"},body:r});if(!s.ok)throw new Error(`Upload failed: ${s.statusText}`)}buildFileUrl(e){if(!this.config?.base_url)throw new Error("Base URL not configured");const n=this.config.base_url.replace(/\/$/,""),i=e.path.split("/").filter(Boolean).map(o=>encodeURIComponent(o)).join("/"),a=encodeURIComponent(e.name);return`${n}/${i}${i?"/":""}${a}`}buildS3Path(e){const r=e.replace(/^\/+|\/+$/g,"").split("/");r.pop();const i=r.join("/");if(this.config?.base_url){const a=this.config.base_url.match(/\/file\/(.+)$/);if(a&&a[1])return i?`${a[1]}/${i}`:a[1]}return i}initializeFiles(){this.originalFiles=this.config?.files||[]}findFileById(e){const n=[...this.originalFiles,...this.newFiles];return Ca(n,e)||null}findFileByPath(e){return[...this.originalFiles,...this.newFiles].find(r=>r.path===e)||null}getLanguageFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",md:"markdown",py:"python",java:"java",cpp:"cpp",c:"c"}[n||""]||"text"}getMimeTypeFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"application/javascript",ts:"application/typescript",jsx:"application/javascript",tsx:"application/typescript",html:"text/html",css:"text/css",json:"application/json",md:"text/markdown",py:"text/x-python",java:"text/x-java-source",cpp:"text/x-c++src",c:"text/x-csrc",txt:"text/plain"}[n||""]||"text/plain"}manageCacheSize(){if(this.contentCache.size>this.MAX_CACHE_SIZE){const n=Array.from(this.contentCache.entries());n.slice(0,n.length-this.MAX_CACHE_SIZE).forEach(([i])=>this.contentCache.delete(i))}let e=0;for(const n of this.contentCache.values())e+=n.length*2;if(e>this.MAX_CACHE_MEMORY){const n=Array.from(this.contentCache.entries());n.slice(0,Math.floor(n.length/2)).forEach(([i])=>this.contentCache.delete(i))}}}function Hb(t){if(t.workflowConfig)return new gI(t.workflowConfig);if(t.formConfig)return new yI(t.formConfig);if(t.urlConfig)return new bI(t.urlConfig);if(t.externalFilesConfig)return new Qpe(t.externalFilesConfig);throw new Error("No valid configuration provided")}var Dt=(t=>(t.Explorer="explorer",t.Data="data",t.Functions="functions",t.Versions="versions",t.Tests="tests",t))(Dt||{});const OI=t=>{switch(t){case 1:return"number";case 4:return"number";case 5:return"string";case 6:return"boolean";case 7:return"datetime";case 8:return"date";case 9:return"time";case 11:return"email";case 14:return"string";case 15:return"select";case 16:return"multiselect";case 17:return"url";case 20:return"file";case 21:return"phone";case 22:return"number";case 23:return"currency";case 24:return"select";case 18:return"string";case 27:return"string";case 29:return"file";default:return"custom"}},Rpe=t=>{switch(t){case"text":return"string";case"long_text":return"string";case"number":return"number";case"decimal":return"number";case"date_time":return"datetime";case"date":return"date";case"time":return"time";case"currency":return"currency";case"checkbox":return"boolean";case"rating":return"number";case"phone_number":return"phone";case"relationship":return"relationship";case"file_upload":return"file";case"multi_file_upload":return"file";case"email":return"email";case"url":return"url";case"single_select":return"select";case"multi_select":return"multiselect";case"stage":return"select";case"location":return"string";case"region":return"string";default:return"custom"}},zpe=t=>{switch(t){case 1:return"one-to-one";case 2:return"one-to-many";case 3:return"many-to-one";default:return"many-to-one"}},$pe=t=>{const e=OI(t.column_data_type),n={key:t.slug,name:t.slug,displayName:t.display_name,type:e,description:t.description||t.help_text,metadata:{required:!!t.is_required,unique:!!t.is_unique,primary:!!t.is_primary,nullable:!t.is_required,defaultValue:t.default_value,constraints:t.constraints||void 0}};return t.relationship_type&&t.relation&&(n.type="relationship",n.metadata.relationship={type:zpe(t.relationship_type),target:t.relation.object_slug,foreignKey:t.relation.column_slug}),t.enum_group&&t.enum_group.values&&(n.metadata.enum={options:t.enum_group.values.map(r=>({value:r.slug,label:r.display_name,badge:r.badge_config?{color:r.badge_config.class_name,icon:r.badge_config.start_icon}:void 0})),allowMultiple:e==="multiselect"}),t.properties?.format&&(n.metadata.format=t.properties.format),n},vI=(t,e)=>{const n=t.org_object_columns?t.org_object_columns.map($pe):[];return{key:t.slug,name:t.slug,displayName:t.display_singular_name,type:"object",description:`${t.display_plural_name} - ${t.type} object`,children:n,count:e,category:t.type==="standard"?"Standard Objects":t.type==="custom"?"Custom Objects":"System Objects",metadata:{objectType:t.type,baseType:t.base_type,isHidden:!!t.is_hidden,properties:t.properties}}},Jb=(t,e)=>t.map(n=>vI(n,e?.[n.slug])),Fl=(t,e,n,r=[])=>{const i=[...r,e];let a,o,s;if(t===null)a="null";else if(t===void 0)a="undefined";else if(typeof t=="boolean")a="boolean";else if(typeof t=="number")a="number";else if(typeof t=="string")t.includes("@")&&t.includes(".")?a="email":t.startsWith("http://")||t.startsWith("https://")?a="url":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t)?a="datetime":/^\d{4}-\d{2}-\d{2}$/.test(t)?a="date":/^\d{2}:\d{2}:\d{2}$/.test(t)?a="time":a="string";else if(typeof t=="function")a="function";else if(Array.isArray(t))a="array",s=t.length,o=t.slice(0,100).map((l,f)=>Fl(l,`${e}[${f}]`,`[${f}]`,i));else if(typeof t=="object"){a="object";const l=Object.entries(t);s=l.length,o=l.map(([f,c])=>Fl(c,`${e}.${f}`,f,i))}else a="custom";return{key:i.join("."),name:e,displayName:n||e,type:a,value:a==="object"||a==="array"?void 0:t,children:o,count:s,metadata:{path:i,originalType:typeof t}}},_pe=t=>t?Array.isArray(t)&&t.length>0&&"key"in t[0]&&"type"in t[0]?t:Array.isArray(t)&&t.length>0&&typeof t[0]=="object"&&t[0]!==null&&"org_object_columns"in t[0]?Jb(t):typeof t=="object"&&t!==null&&"org_object_columns"in t?[vI(t)]:Array.isArray(t)?t.map((e,n)=>Fl(e,`item_${n}`,`Item ${n}`)):[Fl(t,"root","Root")]:[],Zpe=()=>[{key:"users",name:"users",displayName:"Users",type:"object",count:1250,category:"Core Objects",children:[{key:"users.id",name:"id",type:"number",metadata:{primary:!0,required:!0}},{key:"users.email",name:"email",type:"email",metadata:{unique:!0,required:!0}},{key:"users.profile",name:"profile",type:"object",children:[{key:"users.profile.firstName",name:"firstName",type:"string",metadata:{required:!0}},{key:"users.profile.lastName",name:"lastName",type:"string",metadata:{required:!0}},{key:"users.profile.avatar",name:"avatar",type:"file"}]},{key:"users.status",name:"status",type:"select",metadata:{enum:{options:[{value:"active",label:"Active",badge:{color:"green"}},{value:"inactive",label:"Inactive",badge:{color:"red"}},{value:"pending",label:"Pending",badge:{color:"orange"}}]}}}]},{key:"orders",name:"orders",displayName:"Orders",type:"object",count:5420,category:"Business Objects",children:[{key:"orders.id",name:"id",type:"number",metadata:{primary:!0,required:!0}},{key:"orders.userId",name:"userId",type:"relationship",metadata:{relationship:{type:"many-to-one",target:"users",foreignKey:"id"}}},{key:"orders.total",name:"total",type:"currency",metadata:{required:!0}},{key:"orders.items",name:"items",type:"array",count:3,children:[{key:"orders.items[0]",name:"[0]",type:"object",children:[{key:"orders.items[0].productId",name:"productId",type:"number"},{key:"orders.items[0].quantity",name:"quantity",type:"number"},{key:"orders.items[0].price",name:"price",type:"currency"}]}]}]}];function wI(t){switch(t){case"ts":return"typescript";case"tsx":return"typescript";case"html":return"html";case"css":return"css";case"json":return"json";case"jsx":case"js":case"javascript":return"javascript";default:return"text"}}const Kb=({value:t,onChange:e,language:n="javascript",readOnly:r=!1,loading:i=!1})=>{const a=o=>{o!==void 0&&e(o)};return d.jsx("div",{className:"h-full w-full",children:d.jsx(uA,{loading:i,height:"100%",defaultLanguage:n,language:n,defaultValue:t,value:t,onChange:a,theme:"vs-light",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0,padding:{top:16},scrollBeyondLastLine:!1,readOnly:r}})})},Ype=[{id:Dt.Explorer,icon:X.IconFolderOpen,label:"Files"},{id:Dt.Data,icon:X.IconDatabase,label:"Data"},{id:Dt.Functions,icon:X.IconCode,label:"Functions"},{id:Dt.Versions,icon:X.IconHistory,label:"Versions"},{id:Dt.Tests,icon:X.IconFlask,label:"Tests"}],Bpe=({activePanel:t,setActivePanel:e,allowedPannels:n})=>{const r=x.useMemo(()=>Ype.filter(i=>n.includes(i.id)),[n]);return d.jsx("div",{className:"border-r-1/2 border-borderColor-border-primary flex flex-col gap-8 items-center py-12 px-12 m-0",children:r.map(i=>{const a=i.icon;return d.jsx(nh,{children:d.jsxs(rh,{children:[d.jsx(ih,{asChild:!0,children:d.jsx(rt,{variant:t===i.id?"primary":"ghost",icon:d.jsx(a,{size:16}),onClick:()=>e(i.id),className:"p-8"})}),d.jsx(Mf,{align:"center",side:"right",children:i.label})]})},i.id)})})},eO=({leftPanel:t,editor:e,rightPanel:n,activePanel:r,setActivePanel:i,allowedPannels:a=[Dt.Explorer],showPreview:o=!1})=>{const[s,l]=x.useState(o?[25,40,35]:[25,75]);return d.jsxs("div",{className:"flex flex-1 overflow-hidden ",children:[d.jsx(Bpe,{activePanel:r,setActivePanel:i,allowedPannels:a}),d.jsx("div",{className:"flex-1",children:n?d.jsxs(Xi.Splitter,{style:{height:"100%"},onResize:f=>l(f),children:[d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"15%",size:s[0]?`${s[0]}%`:void 0,max:"40%",className:"bg-white border-r border-borderColor-border-primary ",style:{paddingLeft:0},collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:t})}),d.jsx(Xi.Splitter.Panel,{defaultSize:o?"40%":"75%",size:s[1]?`${s[1]}%`:void 0,min:"30%",children:e}),o&&d.jsx(Xi.Splitter.Panel,{defaultSize:"35%",size:s[2]?`${s[2]}%`:void 0,min:"20%",max:"60%",className:"bg-white !border-borderColor-border-primary",children:d.jsx("div",{className:"h-full overflow-y-auto",children:n})})]}):d.jsxs(Xi.Splitter,{style:{height:"100%"},onResize:f=>l(f),children:[d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"15%",size:s[0]?`${s[0]}%`:void 0,max:"40%",className:"bg-white border-r border-borderColor-border-primary ",style:{paddingLeft:0},collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:t})}),d.jsx(Xi.Splitter.Panel,{defaultSize:"75%",size:s[1]?`${s[1]}%`:void 0,min:"60%",children:e})]})})]})};function Wpe(t){return["html","css","json","javascript","typescript","jsx","tsx"].includes(t)}function xI(t){return[...t].sort((e,n)=>e.type==="folder"&&n.type==="file"?-1:e.type==="file"&&n.type==="folder"?1:e.name.toLowerCase().localeCompare(n.name.toLowerCase())).map(e=>({...e,children:e.children?xI(e.children):void 0}))}const SI=({activeFile:t,showPreview:e,setShowPreview:n,handleOnSave:r,hasUnsavedChanges:i=!1,className:a,extras:o})=>{const s=Wpe(t?.metadata?.language||"");return d.jsxs("div",{className:`bg-white flex items-center justify-between px-16 py-8 ${a}`,children:[d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("h1",{className:"text-semi-18 text-typography-primary-text mr-4",children:"CRM Code Editor"}),t&&d.jsx(ea,{className:"text-typography-tertiary-text",children:t.name})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[s&&d.jsx(rt,{variant:"ghost",onClick:()=>n?.(!e),title:e?"Hide Preview":"Show Preview",icon:e?d.jsx(X.IconEyeOff,{}):d.jsx(X.IconEye,{})}),d.jsx(rt,{variant:"primary",onClick:r,disabled:!i,children:"Save"}),o]})]})},MI=({item:t,depth:e=0,onItemSelect:n,getTypeIcon:r,renderItemTitle:i,findItemPath:a,organizedData:o})=>{const[s,l]=x.useState(t.isExpanded||!1),f=t.children&&t.children.length>0,c=x.useCallback(()=>{if(n){const h=a(o,t.key);h&&n(t,h)}},[n,a,o,t]),u=x.useCallback(h=>{h.stopPropagation(),l(!s)},[s]);return d.jsxs("div",{className:t.isVirtual?"opacity-60":"",children:[d.jsxs("div",{className:"flex items-center gap-2 py-1 px-2 hover:bg-neutral-surface-hover cursor-pointer rounded transition-colors",style:{paddingLeft:`${e*16+8}px`},onClick:c,children:[f?d.jsx(rt,{variant:"linkInline",size:"small",onClick:u,className:"flex items-center justify-center !text-typography-tertiary-text","aria-label":s?"Collapse":"Expand",children:s?d.jsx(X.IconChevronDown,{size:16}):d.jsx(X.IconChevronRight,{size:16})}):d.jsx("div",{className:"w-4 h-4"}),d.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[r(t.type,t.metadata),i(t)]})]}),f&&s&&d.jsx("div",{children:t.children.map(h=>d.jsx(MI,{item:h,depth:e+1,onItemSelect:n,getTypeIcon:r,renderItemTitle:i,findItemPath:a,organizedData:o},h.key))})]})},Fpe=({items:t,onItemSelect:e,getTypeIcon:n,renderItemTitle:r,findItemPath:i,className:a=""})=>d.jsx("div",{className:`data-explorer-tree ${a}`,children:t.map(o=>d.jsx(MI,{item:o,onItemSelect:e,getTypeIcon:n,renderItemTitle:r,findItemPath:i,organizedData:t},o.key))}),Xpe=({data:t=[],title:e="Data Explorer",searchPlaceholder:n="Search data...",onItemSelect:r,onRefresh:i,showMetadata:a=!0,showCounts:o=!0,groupByCategory:s=!1,sortByName:l=!1,sortOrder:f="asc",customIcons:c={},customRenderers:u={},filters:h})=>{const[p,g]=x.useState(""),[m,y]=x.useState(l),[O,v]=x.useState(f),w=x.useCallback((L,A)=>{if(c[L])return c[L];const N={size:16,className:"text-typography-tertiary-text"};switch(L){case"object":return d.jsx(X.IconDatabase,{...N});case"array":return d.jsx(X.IconList,{...N});case"string":return d.jsx(X.IconLetterT,{...N});case"number":return d.jsx(X.IconHash,{...N});case"boolean":return d.jsx(X.IconCheck,{...N});case"date":case"datetime":return d.jsx(X.IconCalendar,{...N});case"time":return d.jsx(X.IconClock,{...N});case"email":return d.jsx(X.IconMail,{...N});case"url":return d.jsx(X.IconWorld,{...N});case"phone":return d.jsx(X.IconPhone,{...N});case"currency":return d.jsx(X.IconCurrency,{...N});case"file":case"image":return d.jsx(X.IconFile,{...N});case"select":case"multiselect":case"enum":return d.jsx(X.IconTag,{...N});case"relationship":return d.jsx(X.IconLink,{...N});default:return A?.primary?d.jsx(X.IconKey,{...N,className:"text-warning-base"}):d.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-reg-10 text-typography-quaternary-text",children:"•"})}},[c]),S=x.useCallback((L,A)=>{if(A?.primary)return"text-warning-text-base font-normal";if(A?.required)return"text-info-text-base";if(A?.unique)return"text-success-text-base";switch(L){case"object":return"text-typography-secondary-text font-normal";case"relationship":return"text-purple-text-base";case"enum":case"select":case"multiselect":return"text-warning-text-base";default:return"text-typography-tertiary-text"}},[]),C=x.useCallback(L=>{if(u[L.type])return u[L.type](L);const A=L.displayName||L.name,N=[];if(a&&L.metadata){const{metadata:I}=L;I.primary&&N.push(d.jsx(ea,{color:"warning",size:"small",className:"!text-reg-10 min-w-fit",children:"PK"},"primary")),I.required&&N.push(d.jsx(ea,{color:"info",size:"small",className:"!text-reg-10 min-w-fit",children:"Required"},"required")),I.unique&&N.push(d.jsx(ea,{color:"success",size:"small",className:"!text-reg-10 min-w-fit",children:"Unique"},"unique")),I.relationship&&N.push(d.jsx(ea,{color:"default",size:"small",className:"!text-reg-10 min-w-fit",children:I.relationship.type.toUpperCase()},"relationship"))}o&&typeof L.count=="number"&&N.push(d.jsx(ea,{color:"default",size:"small",className:"!text-[10px] min-w-fit",children:L.count},"count"));const Y=d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("span",{className:`truncate ${S(L.type,L.metadata)}`,children:A}),N.length>0&&d.jsx("div",{className:"flex items-center gap-2",children:N})]});if(L.description||L.metadata){const I=d.jsxs("div",{children:[L.description&&d.jsx("div",{children:L.description}),L.metadata&&d.jsxs("div",{className:"mt-1 text-reg-12",children:[d.jsxs("div",{className:"text-reg-12",children:["Type: ",L.type]}),L.metadata.defaultValue!==void 0&&d.jsxs("div",{children:["Default: ",String(L.metadata.defaultValue)]}),L.metadata.format&&d.jsxs("div",{children:["Format: ",L.metadata.format]})]})]});return d.jsxs(rh,{children:[d.jsx(ih,{asChild:!0,children:Y}),d.jsx(Mf,{children:I})]})}return Y},[u,a,o,S]),M=x.useCallback(L=>m?[...L].sort((N,Y)=>{const I=(N.displayName||N.name).toLowerCase(),E=(Y.displayName||Y.name).toLowerCase();return O==="asc"?I.localeCompare(E):E.localeCompare(I)}).map(N=>({...N,children:N.children?M(N.children):void 0})):L,[m,O]),j=x.useMemo(()=>{const L=N=>{if(h?.types&&!h.types.includes(N.type)||h?.categories&&N.category&&!h.categories.includes(N.category)||h?.showOnlyWithChildren&&(!N.children||N.children.length===0))return!1;if(p){const Y=p.toLowerCase(),I=N.name.toLowerCase().includes(Y)||(N.displayName?.toLowerCase().includes(Y)??!1),E=N.description?.toLowerCase().includes(Y)??!1,Q=N.children?.some(R=>L(R))??!1;return I||E||Q}return!0},A=N=>N.filter(L).map(Y=>({...Y,children:Y.children?A(Y.children):void 0}));return A(t)},[t,p,h]),k=x.useCallback((L,A,N=[])=>{for(const Y of L){const I=[...N,Y.name];if(Y.key===A)return I;if(Y.children){const E=k(Y.children,A,I);if(E)return E}}return null},[]),T=x.useMemo(()=>{let L=j;if(s){const A=L.reduce((N,Y)=>{const I=Y.category||"Uncategorized";return N[I]||(N[I]=[]),N[I].push(Y),N},{});L=Object.entries(A).map(([N,Y])=>({key:`category-${N}`,name:N,displayName:N,type:"object",children:M(Y),count:Y.length}))}return M(L)},[j,s,M]);return d.jsx(nh,{children:d.jsxs(H1,{className:"h-full flex flex-col border-0 shadow-none",children:[d.jsxs(J1,{className:"flex-row items-center justify-between space-y-0 pb-2",children:[d.jsx(K1,{className:"text-semi-14 font-medium",children:e}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(rt,{variant:"ghost",startIcon:m?O==="asc"?d.jsx(X.IconSortAscending,{size:16}):d.jsx(X.IconSortDescending,{size:16}):d.jsx(X.IconSortAscending,{size:16,className:"opacity-50"}),title:m?`Sort by name (${O==="asc"?"A-Z":"Z-A"})`:"Sort by name",size:"small",onClick:()=>{m?O==="asc"?v("desc"):y(!1):(y(!0),v("asc"))},className:m?"text-info-text-base":""}),i&&d.jsx(rt,{variant:"ghost",startIcon:d.jsx(X.IconRefresh,{size:16}),title:"Refresh data",size:"small",onClick:i})]})]}),d.jsxs(ey,{className:"flex-1 flex flex-col p-0",children:[d.jsx("div",{className:"p-4 pt-0",children:d.jsx(Lf,{placeholder:n,startIcon:d.jsx(X.IconSearch,{size:16,className:"text-typography-quaternary-text"}),value:p,onChange:L=>g(L.target.value),inputSize:"small",variant:"borderless"})}),d.jsx(Lb,{}),d.jsx(bN,{className:"flex-1",children:d.jsx("div",{className:"p-8",children:d.jsx(Fpe,{items:T,onItemSelect:r,getTypeIcon:w,renderItemTitle:C,findItemPath:k})})})]})]})})},CI=t=>d.jsx(Xpe,{...t}),Gpe=(t,e)=>{x.useEffect(()=>{const n=r=>{t.every(a=>a.current&&!a.current.contains(r.target))&&e(r)};return document.addEventListener("click",n),()=>{document.removeEventListener("click",n)}},[t,e])},Vpe="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNDggNDgiIHdpZHRoPSI0ODBweCIgaGVpZ2h0PSI0ODBweCI+PHBhdGggZmlsbD0iI0U2NTEwMCIgZD0iTTQxLDVIN2wzLDM0bDE0LDRsMTQtNEw0MSw1TDQxLDVaIi8+PHBhdGggZmlsbD0iI0ZGNkQwMCIgZD0iTTI0IDhMMjQgMzkuOSAzNS4yIDM2LjcgMzcuNyA4eiIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yNCwyNXYtNGg4LjZsLTAuNywxMS41TDI0LDM1LjF2LTQuMmw0LjEtMS40bDAuMy00LjVIMjR6IE0zMi45LDE3bDAuMy00SDI0djRIMzIuOXoiLz48cGF0aCBmaWxsPSIjRUVFIiBkPSJNMjQsMzAuOXY0LjJsLTcuOS0yLjZMMTUuNywyN2g0bDAuMiwyLjVMMjQsMzAuOXogTTE5LjEsMTdIMjR2LTRoLTkuMWwwLjcsMTJIMjR2LTRoLTQuNkwxOS4xLDE3eiIvPjwvc3ZnPg==",Upe="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNDggNDgiIHdpZHRoPSI0ODBweCIgaGVpZ2h0PSI0ODBweCI+PHBhdGggZmlsbD0iIzAyNzdCRCIgZD0iTTQxLDVIN2wzLDM0bDE0LDRsMTQtNEw0MSw1TDQxLDVaIi8+PHBhdGggZmlsbD0iIzAzOUJFNSIgZD0iTTI0IDhMMjQgMzkuOSAzNS4yIDM2LjcgMzcuNyA4eiIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0zMy4xIDEzTDI0IDEzIDI0IDE3IDI4LjkgMTcgMjguNiAyMSAyNCAyMSAyNCAyNSAyOC40IDI1IDI4LjEgMjkuNSAyNCAzMC45IDI0IDM1LjEgMzEuOSAzMi41IDMyLjYgMjEgMzIuNiAyMXoiLz48cGF0aCBmaWxsPSIjRUVFIiBkPSJNMjQsMTN2NGgtOC45bC0wLjMtNEgyNHogTTE5LjQsMjFsMC4yLDRIMjR2LTRIMTkuNHogTTE5LjgsMjdoLTRsMC4zLDUuNWw3LjksMi42di00LjJsLTQuMS0xLjRMMTkuOCwyN3oiLz48L3N2Zz4=",qpe="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNDggNDgiIHdpZHRoPSI1MDBweCIgaGVpZ2h0PSI1MDBweCI+PHBhdGggZmlsbD0iI2ZmZDYwMCIgZD0iTTYsNDJWNmgzNnYzNkg2eiIvPjxwYXRoIGZpbGw9IiMwMDAwMDEiIGQ9Ik0yOS41MzggMzIuOTQ3Yy42OTIgMS4xMjQgMS40NDQgMi4yMDEgMy4wMzcgMi4yMDEgMS4zMzggMCAyLjA0LS42NjUgMi4wNC0xLjU4NSAwLTEuMTAxLS43MjYtMS40OTItMi4xOTgtMi4xMzNsLS44MDctLjM0NGMtMi4zMjktLjk4OC0zLjg3OC0yLjIyNi0zLjg3OC00Ljg0MSAwLTIuNDEgMS44NDUtNC4yNDQgNC43MjgtNC4yNDQgMi4wNTMgMCAzLjUyOC43MTEgNC41OTIgMi41NzNsLTIuNTE0IDEuNjA3Yy0uNTUzLS45ODgtMS4xNTEtMS4zNzctMi4wNzgtMS4zNzctLjk0NiAwLTEuNTQ1LjU5Ny0xLjU0NSAxLjM3NyAwIC45NjQuNiAxLjM1NCAxLjk4NSAxLjk1MWwuODA3LjM0NEMzNi40NTIgMjkuNjQ1IDM4IDMwLjgzOSAzOCAzMy41MjMgMzggMzYuNDE1IDM1LjcxNiAzOCAzMi42NSAzOGMtMi45OTkgMC00LjcwMi0xLjUwNS01LjY1LTMuMzY4TDI5LjUzOCAzMi45NDd6TTE3Ljk1MiAzMy4wMjljLjUwNi45MDYgMS4yNzUgMS42MDMgMi4zODEgMS42MDMgMS4wNTggMCAxLjY2Ny0uNDE4IDEuNjY3LTIuMDQzVjIyaDMuMzMzdjExLjEwMWMwIDMuMzY3LTEuOTUzIDQuODk5LTQuODA1IDQuODk5LTIuNTc3IDAtNC40MzctMS43NDYtNS4xOTUtMy4zNjhMMTcuOTUyIDMzLjAyOXoiLz48L3N2Zz4=",Hpe=t=>{switch(t.split(".").pop()?.toLowerCase()){case"html":case"htm":return Vpe;case"css":return Upe;case"js":case"jsx":case"mjs":case"cjs":return qpe;default:return null}};function jI({file:t,depth:e=0,activeFile:n,selectedItemId:r,onFileSelect:i,onItemSelect:a,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,handleItemUpdate:c}){console.log({file:t});const u=t.children?.some(z=>z.metadata?.isNew&&!z.name),[h,p]=x.useState(u||!0),[g,m]=x.useState(!1),[y,O]=x.useState(!1),[v,w]=x.useState(t.name),S=t.children&&t.children.length>0,C=n===t.id,M=r===t.id,j=t.metadata?.isNew,k=j&&!t.name,T=x.useRef(null),L=x.useRef(null);Gpe([L],()=>{y&&O(!1),M&&a?.(null),k&&c?.(void 0)});const A=x.useCallback(()=>{a&&a(t.id),t.type==="file"&&i(t.id)},[t.id,t.type,i,a]),N=x.useCallback(z=>{z.stopPropagation(),p(!h)},[h]),Y=x.useCallback(z=>{z.preventDefault(),z.stopPropagation(),m(!0)},[]),I=x.useCallback(()=>{O(!0),m(!1)},[]),E=x.useCallback(()=>{v.trim()&&v!==t.name&&f&&(k&&c?c({name:v}):f(t.id,v.trim()),T.current?.blur()),O(!1)},[v,t.name,t.id,f,k,c]),Q=x.useCallback(()=>{w(t.name),O(!1)},[t.name]),R=x.useCallback(()=>{l&&l(t.id),m(!1)},[t.id,l]),D=x.useCallback(()=>{if(o){const z=bu(t);o(z)}m(!1)},[t,o]),F=x.useCallback(()=>{if(s){const z=bu(t);s(z)}m(!1)},[t,s]);return d.jsxs("div",{ref:L,children:[d.jsxs("div",{className:G("flex items-center gap-2 py-1 px-2 hover:bg-primary-surface-hover border-primary-surface-hover cursor-pointer rounded transition-colors relative",(M||C)&&"text-primary-text-base border-t-1/2 border-b-1/2",C&&"bg-primary-surface",M&&"bg-primary-surface-hover",j&&"bg-success-surface"),style:{paddingLeft:`${e*16+8}px`},onClick:A,onContextMenu:Y,children:[S?d.jsx(rt,{variant:"linkInline",size:"small",onClick:N,className:"flex items-center justify-center !text-typography-tertiary-text","aria-label":h||u?"Collapse":"Expand",children:h||u?d.jsx(X.IconChevronDown,{size:16}):d.jsx(X.IconChevronRight,{size:16})}):d.jsx("div",{className:"w-4 h-4"}),d.jsxs("div",{className:"flex items-center gap-6 min-w-0 flex-1",children:[t.type==="file"?(()=>{const z=Hpe(t.name);return z?d.jsx("img",{src:z,alt:`${t.name} icon`,width:18,height:18,className:"text-typography-tertiary-text"}):d.jsx(X.IconFile,{size:16,className:"text-typography-tertiary-text"})})():d.jsx(X.IconFolderOpen,{size:16,className:"text-typography-tertiary-text"}),y||k?d.jsx("input",{ref:T,value:v,onChange:z=>w(z.target.value),onBlur:E,onKeyDown:z=>{z.key==="Enter"&&E(),z.key==="Escape"&&Q()},className:"text-semi-14 h-full bg-transparent",autoFocus:!0}):d.jsx("span",{className:`truncate ${C?"font-medium":""}`,children:t.name})]}),g&&d.jsx("div",{className:"absolute right-2 top-0 bg-white border border-borderColor-border-primary rounded-8 shadow-soft-medium z-10 min-w-32",children:d.jsxs("div",{className:"py-1",children:[t.type==="folder"&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover flex items-center gap-2",onClick:D,children:[d.jsx(X.IconFile,{size:14}),"New File"]}),d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover flex items-center gap-2",onClick:F,children:[d.jsx(X.IconFolderOpen,{size:14}),"New Folder"]}),d.jsx("div",{className:"border-t border-borderColor-border-primary my-1"})]}),d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"w-full px-3 py-1 text-left text-sm hover:bg-gray-100 flex items-center gap-2",onClick:I,children:[d.jsx(X.IconEdit,{size:14}),"Rename"]}),d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover text-error-text-base flex items-center gap-2",onClick:R,children:[d.jsx(X.IconTrash,{size:14}),"Delete"]})]})]})})]}),S&&(h||u)&&d.jsx("div",{children:t.children.map(z=>d.jsx(jI,{file:z,depth:e+1,activeFile:n,onFileSelect:i,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,onItemSelect:a,selectedItemId:r,handleItemUpdate:c},z.id))})]})}function Jpe({files:t,activeFile:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:a,onCreateFolder:o,onDeleteFile:s,onRenameFile:l,handleItemUpdate:f}){return d.jsx("div",{className:"file-explorer-tree",children:t.map(c=>d.jsx(jI,{file:c,activeFile:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:a,onCreateFolder:o,onDeleteFile:s,onRenameFile:l,handleItemUpdate:f},c.id))})}function Kpe({handleItemUpdate:t,isFileExplorerHovered:e,selectedItemData:n}){const r=a=>{a.stopPropagation();const o=n,s=o?bu(o):"";t({name:"",type:"file",path:s})},i=a=>{a.stopPropagation();const o=n,s=o?bu(o):"";t({name:"",type:"folder",path:s})};return d.jsxs(J1,{className:"flex-row items-center justify-between space-y-0 p-0 px-12",children:[d.jsx(K1,{className:"!text-med-13 text-typography-tertiary-text py-8",children:"Files"}),e&&d.jsxs("div",{className:"flex items-center ",children:[d.jsx(rt,{variant:"ghost",icon:d.jsx(X.IconFilePlus,{className:"text-typography-tertiary-text",size:16}),title:"Create new file",onClick:r}),d.jsx(rt,{variant:"ghost",icon:d.jsx(X.IconFolderPlus,{className:"text-typography-tertiary-text",size:16}),title:"Create new folder",onClick:i})]})]})}const tO=({files:t,activeFileData:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,error:a=null,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f})=>{const[c,u]=x.useState(!1),[h,p]=x.useState(),g=x.useCallback((v,w)=>{for(const S of v){if(S.id===w)return S;if(S.children){const C=g(S.children,w);if(C)return C}}},[]),m=n?g(t,n):void 0,y=x.useCallback(v=>{if(!v){p(void 0);return}p(w=>v&&w?{...w,...v}:v?{...v}:w)},[]);x.useEffect(()=>{if(h&&h.name&&h.name.trim()){const v=h.type,w=Un(h.path,h.name.trim());v==="file"?o?.(w):s?.(w),p(void 0)}},[h,o,s]);const O=x.useMemo(()=>{let v=[...t];if(h&&h.path!==void 0){const w=Un(h.path,h.name),S={id:`new-${h.type}`,name:h.name,type:h.type,path:w,children:[],metadata:{isNew:!0}};v=so(S,v)}return xI(v)},[t,h]);return d.jsx(d.Fragment,{children:d.jsxs(H1,{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),className:"h-full flex flex-col border-0 shadow-none",children:[d.jsx(Kpe,{isFileExplorerHovered:c,handleItemUpdate:y,selectedItemData:m}),d.jsx(ey,{className:"flex-1 flex flex-col p-0",children:d.jsxs("div",{className:"",children:[a&&d.jsx(aC,{title:"Error loading files",description:a,color:"error"}),d.jsx(Jpe,{files:O,activeFile:e?.id||null,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,handleItemUpdate:y})]})})]})})},kI=()=>{const t=[{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 d.jsxs("div",{className:"h-full",children:[d.jsx("div",{className:"flex items-center justify-between p-4 border-b border-borderColor-border-primary",children:d.jsx("h2",{className:"font-medium text-semi-14",children:"Function Library"})}),d.jsxs("div",{className:"p-3",children:[d.jsxs("div",{className:"relative mb-3",children:[d.jsx(X.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-typography-quaternary-text"}),d.jsx("input",{type:"text",placeholder:"Search functions...",className:"w-full pl-8 pr-3 py-2 text-semi-14 border border-borderColor-border-primary rounded-8 focus:outline-none focus:ring-2 focus:ring-primary-border"})]}),d.jsx("div",{children:t.map(e=>d.jsxs("div",{className:"p-2 border border-borderColor-border-primary rounded-8 mb-2 hover:bg-neutral-surface-hover cursor-pointer",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx(X.IconCode,{size:16,className:"mr-2 text-typography-tertiary-text"}),d.jsx("span",{className:"text-semi-14 font-medium",children:e.name})]}),d.jsx("span",{className:"text-reg-12 bg-neutral-surface px-2 py-0.5 rounded text-typography-tertiary-text",children:e.category})]}),d.jsx("p",{className:"text-reg-12 text-typography-tertiary-text mt-1",children:e.description})]},e.name))}),d.jsxs("div",{className:"mt-4 p-3 bg-neutral-surface rounded-8 border border-borderColor-border-primary flex items-center",children:[d.jsx(X.IconBook,{size:16,className:"text-typography-tertiary-text mr-2"}),d.jsx("span",{className:"text-reg-12 text-typography-tertiary-text",children:"Browse documentation for more functions and examples"})]})]})]})};var Ge="colors",Gt="sizes",he="space",e0e={gap:he,gridGap:he,columnGap:he,gridColumnGap:he,rowGap:he,gridRowGap:he,inset:he,insetBlock:he,insetBlockEnd:he,insetBlockStart:he,insetInline:he,insetInlineEnd:he,insetInlineStart:he,margin:he,marginTop:he,marginRight:he,marginBottom:he,marginLeft:he,marginBlock:he,marginBlockEnd:he,marginBlockStart:he,marginInline:he,marginInlineEnd:he,marginInlineStart:he,padding:he,paddingTop:he,paddingRight:he,paddingBottom:he,paddingLeft:he,paddingBlock:he,paddingBlockEnd:he,paddingBlockStart:he,paddingInline:he,paddingInlineEnd:he,paddingInlineStart:he,top:he,right:he,bottom:he,left:he,scrollMargin:he,scrollMarginTop:he,scrollMarginRight:he,scrollMarginBottom:he,scrollMarginLeft:he,scrollMarginX:he,scrollMarginY:he,scrollMarginBlock:he,scrollMarginBlockEnd:he,scrollMarginBlockStart:he,scrollMarginInline:he,scrollMarginInlineEnd:he,scrollMarginInlineStart:he,scrollPadding:he,scrollPaddingTop:he,scrollPaddingRight:he,scrollPaddingBottom:he,scrollPaddingLeft:he,scrollPaddingX:he,scrollPaddingY:he,scrollPaddingBlock:he,scrollPaddingBlockEnd:he,scrollPaddingBlockStart:he,scrollPaddingInline:he,scrollPaddingInlineEnd:he,scrollPaddingInlineStart:he,fontSize:"fontSizes",background:Ge,backgroundColor:Ge,backgroundImage:Ge,borderImage:Ge,border:Ge,borderBlock:Ge,borderBlockEnd:Ge,borderBlockStart:Ge,borderBottom:Ge,borderBottomColor:Ge,borderColor:Ge,borderInline:Ge,borderInlineEnd:Ge,borderInlineStart:Ge,borderLeft:Ge,borderLeftColor:Ge,borderRight:Ge,borderRightColor:Ge,borderTop:Ge,borderTopColor:Ge,caretColor:Ge,color:Ge,columnRuleColor:Ge,fill:Ge,outline:Ge,outlineColor:Ge,stroke:Ge,textDecorationColor:Ge,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:Gt,minBlockSize:Gt,maxBlockSize:Gt,inlineSize:Gt,minInlineSize:Gt,maxInlineSize:Gt,width:Gt,minWidth:Gt,maxWidth:Gt,height:Gt,minHeight:Gt,maxHeight:Gt,flexBasis:Gt,gridTemplateColumns:Gt,gridTemplateRows:Gt,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},t0e=(t,e)=>typeof e=="function"?{"()":Function.prototype.toString.call(e)}:e,Bf=()=>{const t=Object.create(null);return(e,n,...r)=>{const i=(a=>JSON.stringify(a,t0e))(e);return i in t?t[i]:t[i]=n(e,...r)}},ru=Symbol.for("sxs.internal"),nO=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),a2=t=>{for(const e in t)return!0;return!1},{hasOwnProperty:n0e}=Object.prototype,xg=t=>t.includes("-")?t:t.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),r0e=/\s+(?![^()]*\))/,qa=t=>e=>t(...typeof e=="string"?String(e).split(r0e):[e]),o2={appearance:t=>({WebkitAppearance:t,appearance:t}),backfaceVisibility:t=>({WebkitBackfaceVisibility:t,backfaceVisibility:t}),backdropFilter:t=>({WebkitBackdropFilter:t,backdropFilter:t}),backgroundClip:t=>({WebkitBackgroundClip:t,backgroundClip:t}),boxDecorationBreak:t=>({WebkitBoxDecorationBreak:t,boxDecorationBreak:t}),clipPath:t=>({WebkitClipPath:t,clipPath:t}),content:t=>({content:t.includes('"')||t.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(t)?t:`"${t}"`}),hyphens:t=>({WebkitHyphens:t,hyphens:t}),maskImage:t=>({WebkitMaskImage:t,maskImage:t}),maskSize:t=>({WebkitMaskSize:t,maskSize:t}),tabSize:t=>({MozTabSize:t,tabSize:t}),textSizeAdjust:t=>({WebkitTextSizeAdjust:t,textSizeAdjust:t}),userSelect:t=>({WebkitUserSelect:t,userSelect:t}),marginBlock:qa(((t,e)=>({marginBlockStart:t,marginBlockEnd:e||t}))),marginInline:qa(((t,e)=>({marginInlineStart:t,marginInlineEnd:e||t}))),maxSize:qa(((t,e)=>({maxBlockSize:t,maxInlineSize:e||t}))),minSize:qa(((t,e)=>({minBlockSize:t,minInlineSize:e||t}))),paddingBlock:qa(((t,e)=>({paddingBlockStart:t,paddingBlockEnd:e||t}))),paddingInline:qa(((t,e)=>({paddingInlineStart:t,paddingInlineEnd:e||t})))},g0=/([\d.]+)([^]*)/,i0e=(t,e)=>t.length?t.reduce(((n,r)=>(n.push(...e.map((i=>i.includes("&")?i.replace(/&/g,/[ +>|~]/.test(r)&&/&.*&/.test(i)?`:is(${r})`:r):r+" "+i))),n)),[]):e,a0e=(t,e)=>t in o0e&&typeof e=="string"?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,((n,r,i,a)=>r+(i==="stretch"?`-moz-available${a};${xg(t)}:${r}-webkit-fill-available`:`-moz-fit-content${a};${xg(t)}:${r}fit-content`)+a)):String(e),o0e={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},ri=t=>t?t+"-":"",LI=(t,e,n)=>t.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,((r,i,a,o,s)=>o=="$"==!!a?r:(i||o=="--"?"calc(":"")+"var(--"+(o==="$"?ri(e)+(s.includes("$")?"":ri(n))+s.replace(/\$/g,"-"):s)+")"+(i||o=="--"?"*"+(i||"")+(a||"1")+")":""))),s0e=/\s*,\s*(?![^()]*\))/,l0e=Object.prototype.toString,ro=(t,e,n,r,i)=>{let a,o,s;const l=(f,c,u)=>{let h,p;const g=m=>{for(h in m){const v=h.charCodeAt(0)===64,w=v&&Array.isArray(m[h])?m[h]:[m[h]];for(p of w){const S=/[A-Z]/.test(O=h)?O:O.replace(/-[^]/g,(M=>M[1].toUpperCase())),C=typeof p=="object"&&p&&p.toString===l0e&&(!r.utils[S]||!c.length);if(S in r.utils&&!C){const M=r.utils[S];if(M!==o){o=M,g(M(p)),o=null;continue}}else if(S in o2){const M=o2[S];if(M!==s){s=M,g(M(p)),s=null;continue}}if(v&&(y=h.slice(1)in r.media?"@media "+r.media[h.slice(1)]:h,h=y.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,((M,j,k,T,L,A)=>{const N=g0.test(j),Y=.0625*(N?-1:1),[I,E]=N?[T,j]:[j,T];return"("+(k[0]==="="?"":k[0]===">"===N?"max-":"min-")+I+":"+(k[0]!=="="&&k.length===1?E.replace(g0,((Q,R,D)=>Number(R)+Y*(k===">"?1:-1)+D)):E)+(L?") and ("+(L[0]===">"?"min-":"max-")+I+":"+(L.length===1?A.replace(g0,((Q,R,D)=>Number(R)+Y*(L===">"?-1:1)+D)):A):"")+")"}))),C){const M=v?u.concat(h):[...u],j=v?[...c]:i0e(c,h.split(s0e));a!==void 0&&i(s2(...a)),a=void 0,l(p,j,M)}else a===void 0&&(a=[[],c,u]),h=v||h.charCodeAt(0)!==36?h:`--${ri(r.prefix)}${h.slice(1).replace(/\$/g,"-")}`,p=C?p:typeof p=="number"?p&&S in f0e?String(p)+"px":String(p):LI(a0e(S,p??""),r.prefix,r.themeMap[S]),a[0].push(`${v?`${h} `:`${xg(h)}:`}${p}`)}}var y,O};g(f),a!==void 0&&i(s2(...a)),a=void 0};l(t,e,n)},s2=(t,e,n)=>`${n.map((r=>`${r}{`)).join("")}${e.length?`${e.join(",")}{`:""}${t.join(";")}${e.length?"}":""}${Array(n.length?n.length+1:0).join("}")}`,f0e={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},l2=t=>String.fromCharCode(t+(t>25?39:97)),oa=t=>(e=>{let n,r="";for(n=Math.abs(e);n>52;n=n/52|0)r=l2(n%52)+r;return l2(n%52)+r})(((e,n)=>{let r=n.length;for(;r;)e=33*e^n.charCodeAt(--r);return e})(5381,JSON.stringify(t))>>>0),sl=["themed","global","styled","onevar","resonevar","allvar","inline"],c0e=t=>{if(t.href&&!t.href.startsWith(location.origin))return!1;try{return!!t.cssRules}catch{return!1}},u0e=t=>{let e;const n=()=>{const{cssRules:i}=e.sheet;return[].map.call(i,((a,o)=>{const{cssText:s}=a;let l="";if(s.startsWith("--sxs"))return"";if(i[o-1]&&(l=i[o-1].cssText).startsWith("--sxs")){if(!a.cssRules.length)return"";for(const f in e.rules)if(e.rules[f].group===a)return`--sxs{--sxs:${[...e.rules[f].cache].join(" ")}}${s}`;return a.cssRules.length?`${l}${s}`:""}return s})).join("")},r=()=>{if(e){const{rules:s,sheet:l}=e;if(!l.deleteRule){for(;Object(Object(l.cssRules)[0]).type===3;)l.cssRules.splice(0,1);l.cssRules=[]}for(const f in s)delete s[f]}const i=Object(t).styleSheets||[];for(const s of i)if(c0e(s)){for(let l=0,f=s.cssRules;f[l];++l){const c=Object(f[l]);if(c.type!==1)continue;const u=Object(f[l+1]);if(u.type!==4)continue;++l;const{cssText:h}=c;if(!h.startsWith("--sxs"))continue;const p=h.slice(14,-3).trim().split(/\s+/),g=sl[p[0]];g&&(e||(e={sheet:s,reset:r,rules:{},toString:n}),e.rules[g]={group:u,index:l,cache:new Set(p)})}if(e)break}if(!e){const s=(l,f)=>({type:f,cssRules:[],insertRule(c,u){this.cssRules.splice(u,0,s(c,{import:3,undefined:1}[(c.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return l==="@media{}"?`@media{${[].map.call(this.cssRules,(c=>c.cssText)).join("")}}`:l}});e={sheet:t?(t.head||t).appendChild(document.createElement("style")).sheet:s("","text/css"),rules:{},reset:r,toString:n}}const{sheet:a,rules:o}=e;for(let s=sl.length-1;s>=0;--s){const l=sl[s];if(!o[l]){const f=sl[s+1],c=o[f]?o[f].index:a.cssRules.length;a.insertRule("@media{}",c),a.insertRule(`--sxs{--sxs:${s}}`,c),o[l]={group:a.cssRules[c+1],index:c,cache:new Set([s])}}d0e(o[l])}};return r(),e},d0e=t=>{const e=t.group;let n=e.cssRules.length;t.apply=r=>{try{e.insertRule(r,n),++n}catch{}}},Ws=Symbol(),h0e=Bf(),p0e=(t,e)=>h0e(t,(()=>(...n)=>{let r={type:null,composers:new Set};for(const i of n)if(i!=null)if(i[ru]){r.type==null&&(r.type=i[ru].type);for(const a of i[ru].composers)r.composers.add(a)}else i.constructor!==Object||i.$$typeof?r.type==null&&(r.type=i):r.composers.add(m0e(i,t));return r.type==null&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),g0e(t,r,e)})),m0e=({variants:t,compoundVariants:e,defaultVariants:n,...r},i)=>{const a=`${ri(i.prefix)}c-${oa(r)}`,o=[],s=[],l=Object.create(null),f=[];for(const h in n)l[h]=String(n[h]);if(typeof t=="object"&&t)for(const h in t){c=l,u=h,n0e.call(c,u)||(l[h]="undefined");const p=t[h];for(const g in p){const m={[h]:String(g)};String(g)==="undefined"&&f.push(h);const y=p[g],O=[m,y,!a2(y)];o.push(O)}}var c,u;if(typeof e=="object"&&e)for(const h of e){let{css:p,...g}=h;p=typeof p=="object"&&p||{};for(const y in g)g[y]=String(g[y]);const m=[g,p,!a2(p)];s.push(m)}return[a,r,o,s,l,f]},g0e=(t,e,n)=>{const[r,i,a,o]=y0e(e.composers),s=typeof e.type=="function"||e.type.$$typeof?(u=>{function h(){for(let p=0;p<h[Ws].length;p++){const[g,m]=h[Ws][p];u.rules[g].apply(m)}return h[Ws]=[],null}return h[Ws]=[],h.rules={},sl.forEach((p=>h.rules[p]={apply:g=>h[Ws].push([p,g])})),h})(n):null,l=(s||n).rules,f=`.${r}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,c=u=>{u=typeof u=="object"&&u||b0e;const{css:h,...p}=u,g={};for(const O in a)if(delete p[O],O in u){let v=u[O];typeof v=="object"&&v?g[O]={"@initial":a[O],...v}:(v=String(v),g[O]=v!=="undefined"||o.has(O)?v:a[O])}else g[O]=a[O];const m=new Set([...i]);for(const[O,v,w,S]of e.composers){n.rules.styled.cache.has(O)||(n.rules.styled.cache.add(O),ro(v,[`.${O}`],[],t,(j=>{l.styled.apply(j)})));const C=f2(w,g,t.media),M=f2(S,g,t.media,!0);for(const j of C)if(j!==void 0)for(const[k,T,L]of j){const A=`${O}-${oa(T)}-${k}`;m.add(A);const N=(L?n.rules.resonevar:n.rules.onevar).cache,Y=L?l.resonevar:l.onevar;N.has(A)||(N.add(A),ro(T,[`.${A}`],[],t,(I=>{Y.apply(I)})))}for(const j of M)if(j!==void 0)for(const[k,T]of j){const L=`${O}-${oa(T)}-${k}`;m.add(L),n.rules.allvar.cache.has(L)||(n.rules.allvar.cache.add(L),ro(T,[`.${L}`],[],t,(A=>{l.allvar.apply(A)})))}}if(typeof h=="object"&&h){const O=`${r}-i${oa(h)}-css`;m.add(O),n.rules.inline.cache.has(O)||(n.rules.inline.cache.add(O),ro(h,[`.${O}`],[],t,(v=>{l.inline.apply(v)})))}for(const O of String(u.className||"").trim().split(/\s+/))O&&m.add(O);const y=p.className=[...m].join(" ");return{type:e.type,className:y,selector:f,props:p,toString:()=>y,deferredInjector:s}};return nO(c,{className:r,selector:f,[ru]:e,toString:()=>(n.rules.styled.cache.has(r)||c(),r)})},y0e=t=>{let e="";const n=[],r={},i=[];for(const[a,,,,o,s]of t){e===""&&(e=a),n.push(a),i.push(...s);for(const l in o){const f=o[l];(r[l]===void 0||f!=="undefined"||s.includes(f))&&(r[l]=f)}}return[e,n,r,new Set(i)]},f2=(t,e,n,r)=>{const i=[];e:for(let[a,o,s]of t){if(s)continue;let l,f=0,c=!1;for(l in a){const u=a[l];let h=e[l];if(h!==u){if(typeof h!="object"||!h)continue e;{let p,g,m=0;for(const y in h){if(u===String(h[y])){if(y!=="@initial"){const O=y.slice(1);(g=g||[]).push(O in n?n[O]:y.replace(/^@media ?/,"")),c=!0}f+=m,p=!0}++m}if(g&&g.length&&(o={["@media "+g.join(", ")]:o}),!p)continue e}}}(i[f]=i[f]||[]).push([r?"cv":`${l}-${a[l]}`,o,c])}return i},b0e={},O0e=Bf(),v0e=(t,e)=>O0e(t,(()=>(...n)=>{const r=()=>{for(let i of n){i=typeof i=="object"&&i||{};let a=oa(i);if(!e.rules.global.cache.has(a)){if(e.rules.global.cache.add(a),"@import"in i){let o=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let s of[].concat(i["@import"]))s=s.includes('"')||s.includes("'")?s:`"${s}"`,e.sheet.insertRule(`@import ${s};`,o++);delete i["@import"]}ro(i,[],[],t,(o=>{e.rules.global.apply(o)}))}}return""};return nO(r,{toString:r})})),w0e=Bf(),x0e=(t,e)=>w0e(t,(()=>n=>{const r=`${ri(t.prefix)}k-${oa(n)}`,i=()=>{if(!e.rules.global.cache.has(r)){e.rules.global.cache.add(r);const a=[];ro(n,[],[],t,(s=>a.push(s)));const o=`@keyframes ${r}{${a.join("")}}`;e.rules.global.apply(o)}return r};return nO(i,{get name(){return i()},toString:i})})),S0e=class{constructor(t,e,n,r){this.token=t==null?"":String(t),this.value=e==null?"":String(e),this.scale=n==null?"":String(n),this.prefix=r==null?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+ri(this.prefix)+ri(this.scale)+this.token}toString(){return this.computedValue}},M0e=Bf(),C0e=(t,e)=>M0e(t,(()=>(n,r)=>{r=typeof n=="object"&&n||Object(r);const i=`.${n=(n=typeof n=="string"?n:"")||`${ri(t.prefix)}t-${oa(r)}`}`,a={},o=[];for(const l in r){a[l]={};for(const f in r[l]){const c=`--${ri(t.prefix)}${l}-${f}`,u=LI(String(r[l][f]),t.prefix,l);a[l][f]=new S0e(f,u,l,t.prefix),o.push(`${c}:${u}`)}}const s=()=>{if(o.length&&!e.rules.themed.cache.has(n)){e.rules.themed.cache.add(n);const l=`${r===t.theme?":root,":""}.${n}{${o.join(";")}}`;e.rules.themed.apply(l)}return n};return{...a,get className(){return s()},selector:i,toString:s}})),j0e=Bf(),k0e=t=>{let e=!1;const n=j0e(t,(r=>{e=!0;const i="prefix"in(r=typeof r=="object"&&r||{})?String(r.prefix):"",a=typeof r.media=="object"&&r.media||{},o=typeof r.root=="object"?r.root||null:globalThis.document||null,s=typeof r.theme=="object"&&r.theme||{},l={prefix:i,media:a,theme:s,themeMap:typeof r.themeMap=="object"&&r.themeMap||{...e0e},utils:typeof r.utils=="object"&&r.utils||{}},f=u0e(o),c={css:p0e(l,f),globalCss:v0e(l,f),keyframes:x0e(l,f),createTheme:C0e(l,f),reset(){f.reset(),c.theme.toString()},theme:{},sheet:f,config:l,prefix:i,getCssText:f.toString,toString:f.toString};return String(c.theme=c.createTheme(s)),c}));return e||n.reset(),n},c2=Object.prototype.hasOwnProperty;function u2(t,e,n){for(n of t.keys())if(bo(n,e))return n}function bo(t,e){var n,r,i;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&bo(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(i=r,i&&typeof i=="object"&&(i=u2(e,i),!i)||!e.has(i))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(i=r[0],i&&typeof i=="object"&&(i=u2(e,i),!i)||!bo(r[1],e.get(i)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(c2.call(t,n)&&++r&&!c2.call(e,n)||!(n in e)||!bo(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var L0e=/(%?)(%([sdjo]))/g;function T0e(t,e){switch(e){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const n=JSON.stringify(t);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?t:n}}}function Sg(t,...e){if(e.length===0)return t;let n=0,r=t.replace(L0e,(i,a,o,s)=>{const l=e[n],f=T0e(l,s);return a?i:(n++,f)});return n<e.length&&(r+=` ${e.slice(n).join(" ")}`),r=r.replace(/%{2,2}/g,"%"),r}var N0e=2;function I0e(t){if(!t.stack)return;const e=t.stack.split(`
|
|
187
|
+
Defaulting to \`null\`.`}var Dpe=dI,Epe=pI;const Ape=b.forwardRef(({value:t=0,max:e=100,className:n,color:r="primary",...i},a)=>{const o=`bg-${r}-base`;return d.jsx(Dpe,{ref:a,value:t,max:e,className:G("relative h-8 w-full overflow-hidden rounded-128 bg-fill-default-fill-gray",n),...i,children:d.jsx(Epe,{className:G("h-full transition-all",o),style:{width:`${t/e*100}%`}})})});Ape.displayName="Progress";class gI{config;files=[];constructor(e){this.config=e}async getFiles(){return this.files.length===0&&await this.loadFiles(),this.files}async getFileContent(e){if(e==="main-function")return await this.config.fetchFunction(this.config.functionId,this.config.version);throw new Error(`File ${e} not found`)}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds(),isDirty:!0})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async loadFiles(){this.files=[{id:"main-function",name:"function.js",type:"file",path:"/function.js",metadata:{language:"javascript",lastModified:new Date().getMilliseconds()}},{id:"versions",name:"versions",type:"folder",path:"/versions",children:this.config.versionList.map(e=>({id:`version-${e}`,name:`v${e}.js`,type:"file",path:`/versions/v${e}.js`,metadata:{language:"javascript"}}))}]}findFileById(e){const n=r=>{for(const i of r){if(i.id===e)return i;if(i.children){const a=n(i.children);if(a)return a}}return null};return n(this.files)}}class yI{config;files=[];constructor(e){this.config=e,this.initializeFiles()}async getFiles(){return this.files}async getFileContent(e){if(e==="form-code")return this.config.codeContent;throw new Error(`File ${e} not found`)}async updateFileContent(e,n){if(e==="form-code"){this.config.codeContent=n;const r=this.files.find(i=>i.id===e);r&&(r.content=n,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds(),isDirty:!0})}}async getFileMetadata(e){return this.findFileById(e)?.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().getMilliseconds()}}]}findFileById(e){return Ca(this.files,e)||null}}class bI{config;originalFiles=[];newFiles=[];constructor(e){this.config=e,this.initializeFiles()}async getFiles(){return[...this.originalFiles,...this.newFiles]}async getFileContent(e){const n=this.findFileById(e);if(!n)throw new Error(`File ${e} not found`);if(n.content)return n.content;if(n.metadata&&"url"in n.metadata&&n.metadata.url)try{const r=await fetch(n.metadata.url);if(!r.ok)throw new Error(`Failed to fetch file: ${r.statusText}`);const i=await r.text();return n.content=i,i}catch(r){throw new Error(`Error fetching file content: ${r}`)}return""}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds(),isDirty:!0})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async createFile(e,n=""){const r=e.split("/").pop()||"untitled",i={id:`new-file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:r,type:"file",path:e,content:n,metadata:{language:this.getLanguageFromPath(e),lastModified:new Date().getMilliseconds(),isNew:!0}};return this.newFiles.push(i),i}async createFolder(e){const n=e.split("/").pop()||"untitled",r={id:`new-folder-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:n,type:"folder",path:e,children:[],metadata:{lastModified:new Date().getMilliseconds(),isNew:!0}};return this.newFiles.push(r),r}async deleteFile(e){this.newFiles=this.newFiles.filter(n=>n.id!==e)}async deleteFolder(e){this.newFiles=this.newFiles.filter(n=>n.id!==e)}async renameFile(e,n){const r=this.findFileById(e);r&&(r.name=n,r.path=r.path.replace(/[^/]+$/,n),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async moveFile(e,n){const r=this.findFileById(e);r&&(r.path=n,r.name=n.split("/").pop()||r.name,r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}getEditorData(){const e=[...this.originalFiles,...this.newFiles],n={};return e.forEach(r=>{if(r.type==="file"&&r.content){const i=Un(r.path,r.name);n[i]=r.content}}),{files:e,fileContents:n,metadata:{lastModified:new Date().getMilliseconds(),version:"1.0.0"}}}async loadEditorData(e){this.newFiles=[],e.files.forEach(n=>{n.metadata?.isNew&&this.newFiles.push(n)}),Object.entries(e.fileContents).forEach(([n,r])=>{const i=this.findFileByPath(n);i&&(i.content=r)})}initializeFiles(){this.originalFiles=this.config.fileUrls.map((e,n)=>({id:`url-file-${n}`,name:e.name,type:"file",path:`/${e.name}`,metadata:{language:e.type,url:e.url,lastModified:new Date().getMilliseconds()}}))}findFileById(e){const n=[...this.originalFiles,...this.newFiles];return Ca(n,e)||null}findFileByPath(e){return[...this.originalFiles,...this.newFiles].find(r=>r.path===e)||null}getLanguageFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",md:"markdown",py:"python",java:"java",cpp:"cpp",c:"c"}[n||""]||"text"}}class Qpe{config;originalFiles=[];newFiles=[];changeJournal=new Map;contentCache=new Map;PROVIDER_VERSION="1.0";MAX_CACHE_SIZE=50;MAX_CACHE_MEMORY=10*1024*1024;constructor(e){this.config=e,this.initializeFiles()}async getFiles(){let e=[...this.originalFiles];for(const n of this.newFiles)this.changeJournal.get(n.id)!=="deleted"&&(e=so(n,e));return this.filterDeletedFiles(e)}filterDeletedFiles(e){return e.filter(n=>this.changeJournal.get(n.id)!=="deleted").map(n=>({...n,children:n.children?this.filterDeletedFiles(n.children):void 0}))}async getFileContent(e){if(this.contentCache.has(e))return this.contentCache.get(e);const n=this.findFileById(e);if(!n)throw new Error(`File ${e} not found`);if(n.content)return this.contentCache.set(e,n.content),this.manageCacheSize(),n.content;try{const r=this.buildFileUrl(n),i=await fetch(r);if(!i.ok)throw new Error(`Failed to fetch file: ${i.statusText}`);const a=await i.text();return this.contentCache.set(e,a),this.manageCacheSize(),a}catch(r){throw new Error(`Error fetching file content: ${r}`)}}async updateFileContent(e,n){const r=this.findFileById(e);r&&(r.content=n,this.contentCache.set(e,n),this.manageCacheSize(),this.changeJournal.has(e)||this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds(),isDirty:!0})}async getFileMetadata(e){return this.findFileById(e)?.metadata||{}}async createFile(e,n=""){const{name:r,parentPath:i}=qO(e),a={id:`new-file-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:r,type:"file",path:i,content:n,metadata:{language:this.getLanguageFromPath(e),lastModified:new Date().getMilliseconds(),providerVersion:this.PROVIDER_VERSION,isNew:!0}};return this.newFiles.push(a),this.changeJournal.set(a.id,"new"),this.contentCache.set(a.id,n),this.manageCacheSize(),a}async createFolder(e){const{name:n,parentPath:r}=qO(e),i={id:`new-folder-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,name:n,type:"folder",path:r,children:[],metadata:{lastModified:new Date().getMilliseconds(),providerVersion:this.PROVIDER_VERSION}};return this.newFiles.push(i),this.changeJournal.set(i.id,"new"),i}async deleteFile(e){this.changeJournal.set(e,"deleted"),this.contentCache.delete(e)}async deleteFolder(e){this.changeJournal.set(e,"deleted")}async renameFile(e,n){const r=this.findFileById(e);r&&(r.name=n,r.path=r.path.replace(/[^/]+$/,n),(r.content||this.contentCache.has(e))&&this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async moveFile(e,n){const r=this.findFileById(e);r&&(r.path=n,r.name=n.split("/").pop()||r.name,(r.content||this.contentCache.has(e))&&this.changeJournal.set(e,"modified"),r.metadata={...r.metadata,lastModified:new Date().getMilliseconds()})}async saveAllChanges(){let e=[];const n=[],r=new Set,i=Vr(this.originalFiles);for(const o of i)this.changeJournal.has(o.id)||(e=so({...o,content:void 0},e));const a=this.changeJournal.entries();for(const[o,s]of a)if(s!=="deleted"&&(s==="new"||s==="modified")){const l=this.findFileById(o);if(!l)continue;try{l.type==="file"&&await this.uploadFile(l);const f={id:l.id,name:l.name,type:l.type,path:l.path,children:l.children,metadata:{...l.metadata,lastModified:new Date().getMilliseconds(),isNew:void 0,isDirty:void 0}};e=so(f,e),r.add(o),l.type==="file"&&this.contentCache.delete(o)}catch(f){n.push(`Failed to upload ${l.name}: ${f}`)}}return r.forEach(o=>{this.changeJournal.delete(o),this.newFiles=this.newFiles.filter(s=>s.id!==o)}),n.length>0&&console.warn(`Some uploads failed (${n.length} files):`,n),e}commitSavedChanges(e){this.originalFiles=e,this.newFiles=[],this.changeJournal.clear(),this.contentCache.clear();const n=r=>r.map(i=>({...i,content:void 0,metadata:{...i.metadata,isNew:void 0,isDirty:void 0,lastModified:new Date().getMilliseconds()},children:i.children?n(i.children):void 0}));this.originalFiles=n(this.originalFiles)}getEditorData(){const e=[...this.originalFiles,...this.newFiles],n={};return this.contentCache.forEach((r,i)=>{const a=this.findFileById(i);if(a){const o=Un(a.path,a.name);n[o]=r}}),{files:e,fileContents:n,metadata:{lastModified:new Date().getMilliseconds(),version:this.PROVIDER_VERSION}}}async loadEditorData(e){this.newFiles=[],this.changeJournal.clear(),this.contentCache.clear(),e.files.forEach(n=>{n.metadata?.isNew&&(this.newFiles.push(n),this.changeJournal.set(n.id,"new"))}),Object.entries(e.fileContents).forEach(([n,r])=>{const i=this.findFileByPath(n);i&&(this.contentCache.set(i.id,r),i.content=r)})}async uploadFile(e){if(!this.config)throw new Error("Configuration not provided");const n=await this.config.getAuthToken(),r=new FormData,i=e.content||this.contentCache.get(e.id)||"",a=new Blob([i],{type:this.getMimeTypeFromPath(e.name)});r.append("file",a,e.name),r.append("keep_file_name_unchanged","1");const o=this.buildS3Path(e.path);r.append("custom_path",o);const s=await fetch(this.config.uploadEndpoint,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Cache-Control":"no-cache"},body:r});if(!s.ok)throw new Error(`Upload failed: ${s.statusText}`)}buildFileUrl(e){if(!this.config?.base_url)throw new Error("Base URL not configured");const n=this.config.base_url.replace(/\/$/,""),i=e.path.split("/").filter(Boolean).map(o=>encodeURIComponent(o)).join("/"),a=encodeURIComponent(e.name);return`${n}/${i}${i?"/":""}${a}`}buildS3Path(e){const r=e.replace(/^\/+|\/+$/g,"").split("/");r.pop();const i=r.join("/");if(this.config?.base_url){const a=this.config.base_url.match(/\/file\/(.+)$/);if(a&&a[1])return i?`${a[1]}/${i}`:a[1]}return i}initializeFiles(){this.originalFiles=this.config?.files||[]}findFileById(e){const n=[...this.originalFiles,...this.newFiles];return Ca(n,e)||null}findFileByPath(e){return[...this.originalFiles,...this.newFiles].find(r=>r.path===e)||null}getLanguageFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"javascript",ts:"typescript",jsx:"jsx",tsx:"tsx",html:"html",css:"css",json:"json",md:"markdown",py:"python",java:"java",cpp:"cpp",c:"c"}[n||""]||"text"}getMimeTypeFromPath(e){const n=e.split(".").pop()?.toLowerCase();return{js:"application/javascript",ts:"application/typescript",jsx:"application/javascript",tsx:"application/typescript",html:"text/html",css:"text/css",json:"application/json",md:"text/markdown",py:"text/x-python",java:"text/x-java-source",cpp:"text/x-c++src",c:"text/x-csrc",txt:"text/plain"}[n||""]||"text/plain"}manageCacheSize(){if(this.contentCache.size>this.MAX_CACHE_SIZE){const n=Array.from(this.contentCache.entries());n.slice(0,n.length-this.MAX_CACHE_SIZE).forEach(([i])=>this.contentCache.delete(i))}let e=0;for(const n of this.contentCache.values())e+=n.length*2;if(e>this.MAX_CACHE_MEMORY){const n=Array.from(this.contentCache.entries());n.slice(0,Math.floor(n.length/2)).forEach(([i])=>this.contentCache.delete(i))}}}function Hb(t){if(t.workflowConfig)return new gI(t.workflowConfig);if(t.formConfig)return new yI(t.formConfig);if(t.urlConfig)return new bI(t.urlConfig);if(t.externalFilesConfig)return new Qpe(t.externalFilesConfig);throw new Error("No valid configuration provided")}var Dt=(t=>(t.Explorer="explorer",t.Data="data",t.Functions="functions",t.Versions="versions",t.Tests="tests",t))(Dt||{});const OI=t=>{switch(t){case 1:return"number";case 4:return"number";case 5:return"string";case 6:return"boolean";case 7:return"datetime";case 8:return"date";case 9:return"time";case 11:return"email";case 14:return"string";case 15:return"select";case 16:return"multiselect";case 17:return"url";case 20:return"file";case 21:return"phone";case 22:return"number";case 23:return"currency";case 24:return"select";case 18:return"string";case 27:return"string";case 29:return"file";default:return"custom"}},Rpe=t=>{switch(t){case"text":return"string";case"long_text":return"string";case"number":return"number";case"decimal":return"number";case"date_time":return"datetime";case"date":return"date";case"time":return"time";case"currency":return"currency";case"checkbox":return"boolean";case"rating":return"number";case"phone_number":return"phone";case"relationship":return"relationship";case"file_upload":return"file";case"multi_file_upload":return"file";case"email":return"email";case"url":return"url";case"single_select":return"select";case"multi_select":return"multiselect";case"stage":return"select";case"location":return"string";case"region":return"string";default:return"custom"}},zpe=t=>{switch(t){case 1:return"one-to-one";case 2:return"one-to-many";case 3:return"many-to-one";default:return"many-to-one"}},$pe=t=>{const e=OI(t.column_data_type),n={key:t.slug,name:t.slug,displayName:t.display_name,type:e,description:t.description||t.help_text,metadata:{required:!!t.is_required,unique:!!t.is_unique,primary:!!t.is_primary,nullable:!t.is_required,defaultValue:t.default_value,constraints:t.constraints||void 0}};return t.relationship_type&&t.relation&&(n.type="relationship",n.metadata.relationship={type:zpe(t.relationship_type),target:t.relation.object_slug,foreignKey:t.relation.column_slug}),t.enum_group&&t.enum_group.values&&(n.metadata.enum={options:t.enum_group.values.map(r=>({value:r.slug,label:r.display_name,badge:r.badge_config?{color:r.badge_config.class_name,icon:r.badge_config.start_icon}:void 0})),allowMultiple:e==="multiselect"}),t.properties?.format&&(n.metadata.format=t.properties.format),n},vI=(t,e)=>{const n=t.org_object_columns?t.org_object_columns.map($pe):[];return{key:t.slug,name:t.slug,displayName:t.display_singular_name,type:"object",description:`${t.display_plural_name} - ${t.type} object`,children:n,count:e,category:t.type==="standard"?"Standard Objects":t.type==="custom"?"Custom Objects":"System Objects",metadata:{objectType:t.type,baseType:t.base_type,isHidden:!!t.is_hidden,properties:t.properties}}},Jb=(t,e)=>t.map(n=>vI(n,e?.[n.slug])),Fl=(t,e,n,r=[])=>{const i=[...r,e];let a,o,s;if(t===null)a="null";else if(t===void 0)a="undefined";else if(typeof t=="boolean")a="boolean";else if(typeof t=="number")a="number";else if(typeof t=="string")t.includes("@")&&t.includes(".")?a="email":t.startsWith("http://")||t.startsWith("https://")?a="url":/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t)?a="datetime":/^\d{4}-\d{2}-\d{2}$/.test(t)?a="date":/^\d{2}:\d{2}:\d{2}$/.test(t)?a="time":a="string";else if(typeof t=="function")a="function";else if(Array.isArray(t))a="array",s=t.length,o=t.slice(0,100).map((l,f)=>Fl(l,`${e}[${f}]`,`[${f}]`,i));else if(typeof t=="object"){a="object";const l=Object.entries(t);s=l.length,o=l.map(([f,c])=>Fl(c,`${e}.${f}`,f,i))}else a="custom";return{key:i.join("."),name:e,displayName:n||e,type:a,value:a==="object"||a==="array"?void 0:t,children:o,count:s,metadata:{path:i,originalType:typeof t}}},_pe=t=>t?Array.isArray(t)&&t.length>0&&"key"in t[0]&&"type"in t[0]?t:Array.isArray(t)&&t.length>0&&typeof t[0]=="object"&&t[0]!==null&&"org_object_columns"in t[0]?Jb(t):typeof t=="object"&&t!==null&&"org_object_columns"in t?[vI(t)]:Array.isArray(t)?t.map((e,n)=>Fl(e,`item_${n}`,`Item ${n}`)):[Fl(t,"root","Root")]:[],Zpe=()=>[{key:"users",name:"users",displayName:"Users",type:"object",count:1250,category:"Core Objects",children:[{key:"users.id",name:"id",type:"number",metadata:{primary:!0,required:!0}},{key:"users.email",name:"email",type:"email",metadata:{unique:!0,required:!0}},{key:"users.profile",name:"profile",type:"object",children:[{key:"users.profile.firstName",name:"firstName",type:"string",metadata:{required:!0}},{key:"users.profile.lastName",name:"lastName",type:"string",metadata:{required:!0}},{key:"users.profile.avatar",name:"avatar",type:"file"}]},{key:"users.status",name:"status",type:"select",metadata:{enum:{options:[{value:"active",label:"Active",badge:{color:"green"}},{value:"inactive",label:"Inactive",badge:{color:"red"}},{value:"pending",label:"Pending",badge:{color:"orange"}}]}}}]},{key:"orders",name:"orders",displayName:"Orders",type:"object",count:5420,category:"Business Objects",children:[{key:"orders.id",name:"id",type:"number",metadata:{primary:!0,required:!0}},{key:"orders.userId",name:"userId",type:"relationship",metadata:{relationship:{type:"many-to-one",target:"users",foreignKey:"id"}}},{key:"orders.total",name:"total",type:"currency",metadata:{required:!0}},{key:"orders.items",name:"items",type:"array",count:3,children:[{key:"orders.items[0]",name:"[0]",type:"object",children:[{key:"orders.items[0].productId",name:"productId",type:"number"},{key:"orders.items[0].quantity",name:"quantity",type:"number"},{key:"orders.items[0].price",name:"price",type:"currency"}]}]}]}];function wI(t){switch(t){case"ts":return"typescript";case"tsx":return"typescript";case"html":return"html";case"css":return"css";case"json":return"json";case"jsx":case"js":case"javascript":return"javascript";default:return"text"}}const Kb=({value:t,onChange:e,language:n="javascript",readOnly:r=!1,loading:i=!1})=>{const a=o=>{o!==void 0&&e(o)};return d.jsx("div",{className:"h-full w-full",children:d.jsx(uA,{loading:i,height:"100%",defaultLanguage:n,language:n,defaultValue:t,value:t,onChange:a,theme:"vs-light",options:{minimap:{enabled:!1},fontSize:14,wordWrap:"on",automaticLayout:!0,padding:{top:16},scrollBeyondLastLine:!1,readOnly:r}})})},Ype=[{id:Dt.Explorer,icon:X.IconFolderOpen,label:"Files"},{id:Dt.Data,icon:X.IconDatabase,label:"Data"},{id:Dt.Functions,icon:X.IconCode,label:"Functions"},{id:Dt.Versions,icon:X.IconHistory,label:"Versions"},{id:Dt.Tests,icon:X.IconFlask,label:"Tests"}],Bpe=({activePanel:t,setActivePanel:e,allowedPannels:n})=>{const r=x.useMemo(()=>Ype.filter(i=>n.includes(i.id)),[n]);return d.jsx("div",{className:"border-r-1/2 border-borderColor-border-primary flex flex-col gap-8 items-center py-12 px-12 m-0",children:r.map(i=>{const a=i.icon;return d.jsx(nh,{children:d.jsxs(rh,{children:[d.jsx(ih,{asChild:!0,children:d.jsx(rt,{variant:t===i.id?"primary":"ghost",icon:d.jsx(a,{size:16}),onClick:()=>e(i.id),className:"p-8"})}),d.jsx(Mf,{align:"center",side:"right",children:i.label})]})},i.id)})})},eO=({leftPanel:t,editor:e,rightPanel:n,activePanel:r,setActivePanel:i,allowedPannels:a=[Dt.Explorer],showPreview:o=!1})=>{const[s,l]=x.useState(o?[25,40,35]:[25,75]);return d.jsxs("div",{className:"flex flex-1 overflow-hidden ",children:[d.jsx(Bpe,{activePanel:r,setActivePanel:i,allowedPannels:a}),d.jsx("div",{className:"flex-1",children:n?d.jsxs(Xi.Splitter,{style:{height:"100%"},onResize:f=>l(f),children:[d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"15%",size:s[0]?`${s[0]}%`:void 0,max:"40%",className:"bg-white border-r border-borderColor-border-primary ",style:{paddingLeft:0},collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:t})}),d.jsx(Xi.Splitter.Panel,{defaultSize:o?"40%":"75%",size:s[1]?`${s[1]}%`:void 0,min:"30%",children:e}),o&&d.jsx(Xi.Splitter.Panel,{defaultSize:"35%",size:s[2]?`${s[2]}%`:void 0,min:"20%",max:"60%",className:"bg-white !border-borderColor-border-primary",children:d.jsx("div",{className:"h-full overflow-y-auto",children:n})})]},o?"with-preview":"without-preview"):d.jsxs(Xi.Splitter,{style:{height:"100%"},onResize:f=>l(f),children:[d.jsx(Xi.Splitter.Panel,{defaultSize:"25%",min:"15%",size:s[0]?`${s[0]}%`:void 0,max:"40%",className:"bg-white border-r border-borderColor-border-primary ",style:{paddingLeft:0},collapsible:!0,children:d.jsx("div",{className:"h-full overflow-y-auto",children:t})}),d.jsx(Xi.Splitter.Panel,{defaultSize:"75%",size:s[1]?`${s[1]}%`:void 0,min:"60%",children:e})]})})]})};function Wpe(t){return["html","css","json","javascript","typescript","jsx","tsx"].includes(t)}function xI(t){return[...t].sort((e,n)=>e.type==="folder"&&n.type==="file"?-1:e.type==="file"&&n.type==="folder"?1:e.name.toLowerCase().localeCompare(n.name.toLowerCase())).map(e=>({...e,children:e.children?xI(e.children):void 0}))}const SI=({activeFile:t,showPreview:e,setShowPreview:n,handleOnSave:r,hasUnsavedChanges:i=!1,className:a,extras:o})=>{const s=Wpe(t?.metadata?.language||"");return d.jsxs("div",{className:`bg-white flex items-center justify-between px-16 py-8 ${a}`,children:[d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("h1",{className:"text-semi-18 text-typography-primary-text mr-4",children:"CRM Code Editor"}),t&&d.jsx(ea,{className:"text-typography-tertiary-text",children:t.name})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[s&&d.jsx(rt,{variant:"ghost",onClick:()=>n?.(!e),title:e?"Hide Preview":"Show Preview",icon:e?d.jsx(X.IconEyeOff,{}):d.jsx(X.IconEye,{})}),d.jsx(rt,{variant:"primary",onClick:r,disabled:!i,children:"Save"}),o]})]})},MI=({item:t,depth:e=0,onItemSelect:n,getTypeIcon:r,renderItemTitle:i,findItemPath:a,organizedData:o})=>{const[s,l]=x.useState(t.isExpanded||!1),f=t.children&&t.children.length>0,c=x.useCallback(()=>{if(n){const h=a(o,t.key);h&&n(t,h)}},[n,a,o,t]),u=x.useCallback(h=>{h.stopPropagation(),l(!s)},[s]);return d.jsxs("div",{className:t.isVirtual?"opacity-60":"",children:[d.jsxs("div",{className:"flex items-center gap-2 py-1 px-2 hover:bg-neutral-surface-hover cursor-pointer rounded transition-colors",style:{paddingLeft:`${e*16+8}px`},onClick:c,children:[f?d.jsx(rt,{variant:"linkInline",size:"small",onClick:u,className:"flex items-center justify-center !text-typography-tertiary-text","aria-label":s?"Collapse":"Expand",children:s?d.jsx(X.IconChevronDown,{size:16}):d.jsx(X.IconChevronRight,{size:16})}):d.jsx("div",{className:"w-4 h-4"}),d.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[r(t.type,t.metadata),i(t)]})]}),f&&s&&d.jsx("div",{children:t.children.map(h=>d.jsx(MI,{item:h,depth:e+1,onItemSelect:n,getTypeIcon:r,renderItemTitle:i,findItemPath:a,organizedData:o},h.key))})]})},Fpe=({items:t,onItemSelect:e,getTypeIcon:n,renderItemTitle:r,findItemPath:i,className:a=""})=>d.jsx("div",{className:`data-explorer-tree ${a}`,children:t.map(o=>d.jsx(MI,{item:o,onItemSelect:e,getTypeIcon:n,renderItemTitle:r,findItemPath:i,organizedData:t},o.key))}),Xpe=({data:t=[],title:e="Data Explorer",searchPlaceholder:n="Search data...",onItemSelect:r,onRefresh:i,showMetadata:a=!0,showCounts:o=!0,groupByCategory:s=!1,sortByName:l=!1,sortOrder:f="asc",customIcons:c={},customRenderers:u={},filters:h})=>{const[p,g]=x.useState(""),[m,y]=x.useState(l),[O,v]=x.useState(f),w=x.useCallback((L,A)=>{if(c[L])return c[L];const N={size:16,className:"text-typography-tertiary-text"};switch(L){case"object":return d.jsx(X.IconDatabase,{...N});case"array":return d.jsx(X.IconList,{...N});case"string":return d.jsx(X.IconLetterT,{...N});case"number":return d.jsx(X.IconHash,{...N});case"boolean":return d.jsx(X.IconCheck,{...N});case"date":case"datetime":return d.jsx(X.IconCalendar,{...N});case"time":return d.jsx(X.IconClock,{...N});case"email":return d.jsx(X.IconMail,{...N});case"url":return d.jsx(X.IconWorld,{...N});case"phone":return d.jsx(X.IconPhone,{...N});case"currency":return d.jsx(X.IconCurrency,{...N});case"file":case"image":return d.jsx(X.IconFile,{...N});case"select":case"multiselect":case"enum":return d.jsx(X.IconTag,{...N});case"relationship":return d.jsx(X.IconLink,{...N});default:return A?.primary?d.jsx(X.IconKey,{...N,className:"text-warning-base"}):d.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-reg-10 text-typography-quaternary-text",children:"•"})}},[c]),S=x.useCallback((L,A)=>{if(A?.primary)return"text-warning-text-base font-normal";if(A?.required)return"text-info-text-base";if(A?.unique)return"text-success-text-base";switch(L){case"object":return"text-typography-secondary-text font-normal";case"relationship":return"text-purple-text-base";case"enum":case"select":case"multiselect":return"text-warning-text-base";default:return"text-typography-tertiary-text"}},[]),C=x.useCallback(L=>{if(u[L.type])return u[L.type](L);const A=L.displayName||L.name,N=[];if(a&&L.metadata){const{metadata:I}=L;I.primary&&N.push(d.jsx(ea,{color:"warning",size:"small",className:"!text-reg-10 min-w-fit",children:"PK"},"primary")),I.required&&N.push(d.jsx(ea,{color:"info",size:"small",className:"!text-reg-10 min-w-fit",children:"Required"},"required")),I.unique&&N.push(d.jsx(ea,{color:"success",size:"small",className:"!text-reg-10 min-w-fit",children:"Unique"},"unique")),I.relationship&&N.push(d.jsx(ea,{color:"default",size:"small",className:"!text-reg-10 min-w-fit",children:I.relationship.type.toUpperCase()},"relationship"))}o&&typeof L.count=="number"&&N.push(d.jsx(ea,{color:"default",size:"small",className:"!text-[10px] min-w-fit",children:L.count},"count"));const Y=d.jsxs("div",{className:"flex items-center gap-8",children:[d.jsx("span",{className:`truncate ${S(L.type,L.metadata)}`,children:A}),N.length>0&&d.jsx("div",{className:"flex items-center gap-2",children:N})]});if(L.description||L.metadata){const I=d.jsxs("div",{children:[L.description&&d.jsx("div",{children:L.description}),L.metadata&&d.jsxs("div",{className:"mt-1 text-reg-12",children:[d.jsxs("div",{className:"text-reg-12",children:["Type: ",L.type]}),L.metadata.defaultValue!==void 0&&d.jsxs("div",{children:["Default: ",String(L.metadata.defaultValue)]}),L.metadata.format&&d.jsxs("div",{children:["Format: ",L.metadata.format]})]})]});return d.jsxs(rh,{children:[d.jsx(ih,{asChild:!0,children:Y}),d.jsx(Mf,{children:I})]})}return Y},[u,a,o,S]),M=x.useCallback(L=>m?[...L].sort((N,Y)=>{const I=(N.displayName||N.name).toLowerCase(),E=(Y.displayName||Y.name).toLowerCase();return O==="asc"?I.localeCompare(E):E.localeCompare(I)}).map(N=>({...N,children:N.children?M(N.children):void 0})):L,[m,O]),j=x.useMemo(()=>{const L=N=>{if(h?.types&&!h.types.includes(N.type)||h?.categories&&N.category&&!h.categories.includes(N.category)||h?.showOnlyWithChildren&&(!N.children||N.children.length===0))return!1;if(p){const Y=p.toLowerCase(),I=N.name.toLowerCase().includes(Y)||(N.displayName?.toLowerCase().includes(Y)??!1),E=N.description?.toLowerCase().includes(Y)??!1,Q=N.children?.some(R=>L(R))??!1;return I||E||Q}return!0},A=N=>N.filter(L).map(Y=>({...Y,children:Y.children?A(Y.children):void 0}));return A(t)},[t,p,h]),k=x.useCallback((L,A,N=[])=>{for(const Y of L){const I=[...N,Y.name];if(Y.key===A)return I;if(Y.children){const E=k(Y.children,A,I);if(E)return E}}return null},[]),T=x.useMemo(()=>{let L=j;if(s){const A=L.reduce((N,Y)=>{const I=Y.category||"Uncategorized";return N[I]||(N[I]=[]),N[I].push(Y),N},{});L=Object.entries(A).map(([N,Y])=>({key:`category-${N}`,name:N,displayName:N,type:"object",children:M(Y),count:Y.length}))}return M(L)},[j,s,M]);return d.jsx(nh,{children:d.jsxs(H1,{className:"h-full flex flex-col border-0 shadow-none",children:[d.jsxs(J1,{className:"flex-row items-center justify-between space-y-0 pb-2",children:[d.jsx(K1,{className:"text-semi-14 font-medium",children:e}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(rt,{variant:"ghost",startIcon:m?O==="asc"?d.jsx(X.IconSortAscending,{size:16}):d.jsx(X.IconSortDescending,{size:16}):d.jsx(X.IconSortAscending,{size:16,className:"opacity-50"}),title:m?`Sort by name (${O==="asc"?"A-Z":"Z-A"})`:"Sort by name",size:"small",onClick:()=>{m?O==="asc"?v("desc"):y(!1):(y(!0),v("asc"))},className:m?"text-info-text-base":""}),i&&d.jsx(rt,{variant:"ghost",startIcon:d.jsx(X.IconRefresh,{size:16}),title:"Refresh data",size:"small",onClick:i})]})]}),d.jsxs(ey,{className:"flex-1 flex flex-col p-0",children:[d.jsx("div",{className:"p-4 pt-0",children:d.jsx(Lf,{placeholder:n,startIcon:d.jsx(X.IconSearch,{size:16,className:"text-typography-quaternary-text"}),value:p,onChange:L=>g(L.target.value),inputSize:"small",variant:"borderless"})}),d.jsx(Lb,{}),d.jsx(bN,{className:"flex-1",children:d.jsx("div",{className:"p-8",children:d.jsx(Fpe,{items:T,onItemSelect:r,getTypeIcon:w,renderItemTitle:C,findItemPath:k})})})]})]})})},CI=t=>d.jsx(Xpe,{...t}),Gpe=(t,e)=>{x.useEffect(()=>{const n=r=>{t.every(a=>a.current&&!a.current.contains(r.target))&&e(r)};return document.addEventListener("click",n),()=>{document.removeEventListener("click",n)}},[t,e])},Vpe="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNDggNDgiIHdpZHRoPSI0ODBweCIgaGVpZ2h0PSI0ODBweCI+PHBhdGggZmlsbD0iI0U2NTEwMCIgZD0iTTQxLDVIN2wzLDM0bDE0LDRsMTQtNEw0MSw1TDQxLDVaIi8+PHBhdGggZmlsbD0iI0ZGNkQwMCIgZD0iTTI0IDhMMjQgMzkuOSAzNS4yIDM2LjcgMzcuNyA4eiIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0yNCwyNXYtNGg4LjZsLTAuNywxMS41TDI0LDM1LjF2LTQuMmw0LjEtMS40bDAuMy00LjVIMjR6IE0zMi45LDE3bDAuMy00SDI0djRIMzIuOXoiLz48cGF0aCBmaWxsPSIjRUVFIiBkPSJNMjQsMzAuOXY0LjJsLTcuOS0yLjZMMTUuNywyN2g0bDAuMiwyLjVMMjQsMzAuOXogTTE5LjEsMTdIMjR2LTRoLTkuMWwwLjcsMTJIMjR2LTRoLTQuNkwxOS4xLDE3eiIvPjwvc3ZnPg==",Upe="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNDggNDgiIHdpZHRoPSI0ODBweCIgaGVpZ2h0PSI0ODBweCI+PHBhdGggZmlsbD0iIzAyNzdCRCIgZD0iTTQxLDVIN2wzLDM0bDE0LDRsMTQtNEw0MSw1TDQxLDVaIi8+PHBhdGggZmlsbD0iIzAzOUJFNSIgZD0iTTI0IDhMMjQgMzkuOSAzNS4yIDM2LjcgMzcuNyA4eiIvPjxwYXRoIGZpbGw9IiNGRkYiIGQ9Ik0zMy4xIDEzTDI0IDEzIDI0IDE3IDI4LjkgMTcgMjguNiAyMSAyNCAyMSAyNCAyNSAyOC40IDI1IDI4LjEgMjkuNSAyNCAzMC45IDI0IDM1LjEgMzEuOSAzMi41IDMyLjYgMjEgMzIuNiAyMXoiLz48cGF0aCBmaWxsPSIjRUVFIiBkPSJNMjQsMTN2NGgtOC45bC0wLjMtNEgyNHogTTE5LjQsMjFsMC4yLDRIMjR2LTRIMTkuNHogTTE5LjgsMjdoLTRsMC4zLDUuNWw3LjksMi42di00LjJsLTQuMS0xLjRMMTkuOCwyN3oiLz48L3N2Zz4=",qpe="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNDggNDgiIHdpZHRoPSI1MDBweCIgaGVpZ2h0PSI1MDBweCI+PHBhdGggZmlsbD0iI2ZmZDYwMCIgZD0iTTYsNDJWNmgzNnYzNkg2eiIvPjxwYXRoIGZpbGw9IiMwMDAwMDEiIGQ9Ik0yOS41MzggMzIuOTQ3Yy42OTIgMS4xMjQgMS40NDQgMi4yMDEgMy4wMzcgMi4yMDEgMS4zMzggMCAyLjA0LS42NjUgMi4wNC0xLjU4NSAwLTEuMTAxLS43MjYtMS40OTItMi4xOTgtMi4xMzNsLS44MDctLjM0NGMtMi4zMjktLjk4OC0zLjg3OC0yLjIyNi0zLjg3OC00Ljg0MSAwLTIuNDEgMS44NDUtNC4yNDQgNC43MjgtNC4yNDQgMi4wNTMgMCAzLjUyOC43MTEgNC41OTIgMi41NzNsLTIuNTE0IDEuNjA3Yy0uNTUzLS45ODgtMS4xNTEtMS4zNzctMi4wNzgtMS4zNzctLjk0NiAwLTEuNTQ1LjU5Ny0xLjU0NSAxLjM3NyAwIC45NjQuNiAxLjM1NCAxLjk4NSAxLjk1MWwuODA3LjM0NEMzNi40NTIgMjkuNjQ1IDM4IDMwLjgzOSAzOCAzMy41MjMgMzggMzYuNDE1IDM1LjcxNiAzOCAzMi42NSAzOGMtMi45OTkgMC00LjcwMi0xLjUwNS01LjY1LTMuMzY4TDI5LjUzOCAzMi45NDd6TTE3Ljk1MiAzMy4wMjljLjUwNi45MDYgMS4yNzUgMS42MDMgMi4zODEgMS42MDMgMS4wNTggMCAxLjY2Ny0uNDE4IDEuNjY3LTIuMDQzVjIyaDMuMzMzdjExLjEwMWMwIDMuMzY3LTEuOTUzIDQuODk5LTQuODA1IDQuODk5LTIuNTc3IDAtNC40MzctMS43NDYtNS4xOTUtMy4zNjhMMTcuOTUyIDMzLjAyOXoiLz48L3N2Zz4=",Hpe=t=>{switch(t.split(".").pop()?.toLowerCase()){case"html":case"htm":return Vpe;case"css":return Upe;case"js":case"jsx":case"mjs":case"cjs":return qpe;default:return null}};function jI({file:t,depth:e=0,activeFile:n,selectedItemId:r,onFileSelect:i,onItemSelect:a,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,handleItemUpdate:c}){console.log({file:t});const u=t.children?.some(z=>z.metadata?.isNew&&!z.name),[h,p]=x.useState(u||!0),[g,m]=x.useState(!1),[y,O]=x.useState(!1),[v,w]=x.useState(t.name),S=t.children&&t.children.length>0,C=n===t.id,M=r===t.id,j=t.metadata?.isNew,k=j&&!t.name,T=x.useRef(null),L=x.useRef(null);Gpe([L],()=>{y&&O(!1),M&&a?.(null),k&&c?.(void 0)});const A=x.useCallback(()=>{a&&a(t.id),t.type==="file"&&i(t.id)},[t.id,t.type,i,a]),N=x.useCallback(z=>{z.stopPropagation(),p(!h)},[h]),Y=x.useCallback(z=>{z.preventDefault(),z.stopPropagation(),m(!0)},[]),I=x.useCallback(()=>{O(!0),m(!1)},[]),E=x.useCallback(()=>{v.trim()&&v!==t.name&&f&&(k&&c?c({name:v}):f(t.id,v.trim()),T.current?.blur()),O(!1)},[v,t.name,t.id,f,k,c]),Q=x.useCallback(()=>{w(t.name),O(!1)},[t.name]),R=x.useCallback(()=>{l&&l(t.id),m(!1)},[t.id,l]),D=x.useCallback(()=>{if(o){const z=bu(t);o(z)}m(!1)},[t,o]),F=x.useCallback(()=>{if(s){const z=bu(t);s(z)}m(!1)},[t,s]);return d.jsxs("div",{ref:L,children:[d.jsxs("div",{className:G("flex items-center gap-2 py-1 px-2 hover:bg-primary-surface-hover border-primary-surface-hover cursor-pointer rounded transition-colors relative",(M||C)&&"text-primary-text-base border-t-1/2 border-b-1/2",C&&"bg-primary-surface",M&&"bg-primary-surface-hover",j&&"bg-success-surface"),style:{paddingLeft:`${e*16+8}px`},onClick:A,onContextMenu:Y,children:[S?d.jsx(rt,{variant:"linkInline",size:"small",onClick:N,className:"flex items-center justify-center !text-typography-tertiary-text","aria-label":h||u?"Collapse":"Expand",children:h||u?d.jsx(X.IconChevronDown,{size:16}):d.jsx(X.IconChevronRight,{size:16})}):d.jsx("div",{className:"w-4 h-4"}),d.jsxs("div",{className:"flex items-center gap-6 min-w-0 flex-1",children:[t.type==="file"?(()=>{const z=Hpe(t.name);return z?d.jsx("img",{src:z,alt:`${t.name} icon`,width:18,height:18,className:"text-typography-tertiary-text"}):d.jsx(X.IconFile,{size:16,className:"text-typography-tertiary-text"})})():d.jsx(X.IconFolderOpen,{size:16,className:"text-typography-tertiary-text"}),y||k?d.jsx("input",{ref:T,value:v,onChange:z=>w(z.target.value),onBlur:E,onKeyDown:z=>{z.key==="Enter"&&E(),z.key==="Escape"&&Q()},className:"text-semi-14 h-full bg-transparent",autoFocus:!0}):d.jsx("span",{className:`truncate ${C?"font-medium":""}`,children:t.name})]}),g&&d.jsx("div",{className:"absolute right-2 top-0 bg-white border border-borderColor-border-primary rounded-8 shadow-soft-medium z-10 min-w-32",children:d.jsxs("div",{className:"py-1",children:[t.type==="folder"&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover flex items-center gap-2",onClick:D,children:[d.jsx(X.IconFile,{size:14}),"New File"]}),d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover flex items-center gap-2",onClick:F,children:[d.jsx(X.IconFolderOpen,{size:14}),"New Folder"]}),d.jsx("div",{className:"border-t border-borderColor-border-primary my-1"})]}),d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"w-full px-3 py-1 text-left text-sm hover:bg-gray-100 flex items-center gap-2",onClick:I,children:[d.jsx(X.IconEdit,{size:14}),"Rename"]}),d.jsxs("button",{className:"w-full px-3 py-1 text-left text-semi-14 hover:bg-neutral-surface-hover text-error-text-base flex items-center gap-2",onClick:R,children:[d.jsx(X.IconTrash,{size:14}),"Delete"]})]})]})})]}),S&&(h||u)&&d.jsx("div",{children:t.children.map(z=>d.jsx(jI,{file:z,depth:e+1,activeFile:n,onFileSelect:i,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,onItemSelect:a,selectedItemId:r,handleItemUpdate:c},z.id))})]})}function Jpe({files:t,activeFile:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:a,onCreateFolder:o,onDeleteFile:s,onRenameFile:l,handleItemUpdate:f}){return d.jsx("div",{className:"file-explorer-tree",children:t.map(c=>d.jsx(jI,{file:c,activeFile:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:a,onCreateFolder:o,onDeleteFile:s,onRenameFile:l,handleItemUpdate:f},c.id))})}function Kpe({handleItemUpdate:t,isFileExplorerHovered:e,selectedItemData:n}){const r=a=>{a.stopPropagation();const o=n,s=o?bu(o):"";t({name:"",type:"file",path:s})},i=a=>{a.stopPropagation();const o=n,s=o?bu(o):"";t({name:"",type:"folder",path:s})};return d.jsxs(J1,{className:"flex-row items-center justify-between space-y-0 p-0 px-12",children:[d.jsx(K1,{className:"!text-med-13 text-typography-tertiary-text py-8",children:"Files"}),e&&d.jsxs("div",{className:"flex items-center ",children:[d.jsx(rt,{variant:"ghost",icon:d.jsx(X.IconFilePlus,{className:"text-typography-tertiary-text",size:16}),title:"Create new file",onClick:r}),d.jsx(rt,{variant:"ghost",icon:d.jsx(X.IconFolderPlus,{className:"text-typography-tertiary-text",size:16}),title:"Create new folder",onClick:i})]})]})}const tO=({files:t,activeFileData:e,selectedItemId:n,onFileSelect:r,onItemSelect:i,error:a=null,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f})=>{const[c,u]=x.useState(!1),[h,p]=x.useState(),g=x.useCallback((v,w)=>{for(const S of v){if(S.id===w)return S;if(S.children){const C=g(S.children,w);if(C)return C}}},[]),m=n?g(t,n):void 0,y=x.useCallback(v=>{if(!v){p(void 0);return}p(w=>v&&w?{...w,...v}:v?{...v}:w)},[]);x.useEffect(()=>{if(h&&h.name&&h.name.trim()){const v=h.type,w=Un(h.path,h.name.trim());v==="file"?o?.(w):s?.(w),p(void 0)}},[h,o,s]);const O=x.useMemo(()=>{let v=[...t];if(h&&h.path!==void 0){const w=Un(h.path,h.name),S={id:`new-${h.type}`,name:h.name,type:h.type,path:w,children:[],metadata:{isNew:!0}};v=so(S,v)}return xI(v)},[t,h]);return d.jsx(d.Fragment,{children:d.jsxs(H1,{onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),className:"h-full flex flex-col border-0 shadow-none",children:[d.jsx(Kpe,{isFileExplorerHovered:c,handleItemUpdate:y,selectedItemData:m}),d.jsx(ey,{className:"flex-1 flex flex-col p-0",children:d.jsxs("div",{className:"",children:[a&&d.jsx(aC,{title:"Error loading files",description:a,color:"error"}),d.jsx(Jpe,{files:O,activeFile:e?.id||null,selectedItemId:n,onFileSelect:r,onItemSelect:i,onCreateFile:o,onCreateFolder:s,onDeleteFile:l,onRenameFile:f,handleItemUpdate:y})]})})]})})},kI=()=>{const t=[{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 d.jsxs("div",{className:"h-full",children:[d.jsx("div",{className:"flex items-center justify-between p-4 border-b border-borderColor-border-primary",children:d.jsx("h2",{className:"font-medium text-semi-14",children:"Function Library"})}),d.jsxs("div",{className:"p-3",children:[d.jsxs("div",{className:"relative mb-3",children:[d.jsx(X.IconSearch,{size:16,className:"absolute left-2.5 top-2.5 text-typography-quaternary-text"}),d.jsx("input",{type:"text",placeholder:"Search functions...",className:"w-full pl-8 pr-3 py-2 text-semi-14 border border-borderColor-border-primary rounded-8 focus:outline-none focus:ring-2 focus:ring-primary-border"})]}),d.jsx("div",{children:t.map(e=>d.jsxs("div",{className:"p-2 border border-borderColor-border-primary rounded-8 mb-2 hover:bg-neutral-surface-hover cursor-pointer",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx(X.IconCode,{size:16,className:"mr-2 text-typography-tertiary-text"}),d.jsx("span",{className:"text-semi-14 font-medium",children:e.name})]}),d.jsx("span",{className:"text-reg-12 bg-neutral-surface px-2 py-0.5 rounded text-typography-tertiary-text",children:e.category})]}),d.jsx("p",{className:"text-reg-12 text-typography-tertiary-text mt-1",children:e.description})]},e.name))}),d.jsxs("div",{className:"mt-4 p-3 bg-neutral-surface rounded-8 border border-borderColor-border-primary flex items-center",children:[d.jsx(X.IconBook,{size:16,className:"text-typography-tertiary-text mr-2"}),d.jsx("span",{className:"text-reg-12 text-typography-tertiary-text",children:"Browse documentation for more functions and examples"})]})]})]})};var Ge="colors",Gt="sizes",he="space",e0e={gap:he,gridGap:he,columnGap:he,gridColumnGap:he,rowGap:he,gridRowGap:he,inset:he,insetBlock:he,insetBlockEnd:he,insetBlockStart:he,insetInline:he,insetInlineEnd:he,insetInlineStart:he,margin:he,marginTop:he,marginRight:he,marginBottom:he,marginLeft:he,marginBlock:he,marginBlockEnd:he,marginBlockStart:he,marginInline:he,marginInlineEnd:he,marginInlineStart:he,padding:he,paddingTop:he,paddingRight:he,paddingBottom:he,paddingLeft:he,paddingBlock:he,paddingBlockEnd:he,paddingBlockStart:he,paddingInline:he,paddingInlineEnd:he,paddingInlineStart:he,top:he,right:he,bottom:he,left:he,scrollMargin:he,scrollMarginTop:he,scrollMarginRight:he,scrollMarginBottom:he,scrollMarginLeft:he,scrollMarginX:he,scrollMarginY:he,scrollMarginBlock:he,scrollMarginBlockEnd:he,scrollMarginBlockStart:he,scrollMarginInline:he,scrollMarginInlineEnd:he,scrollMarginInlineStart:he,scrollPadding:he,scrollPaddingTop:he,scrollPaddingRight:he,scrollPaddingBottom:he,scrollPaddingLeft:he,scrollPaddingX:he,scrollPaddingY:he,scrollPaddingBlock:he,scrollPaddingBlockEnd:he,scrollPaddingBlockStart:he,scrollPaddingInline:he,scrollPaddingInlineEnd:he,scrollPaddingInlineStart:he,fontSize:"fontSizes",background:Ge,backgroundColor:Ge,backgroundImage:Ge,borderImage:Ge,border:Ge,borderBlock:Ge,borderBlockEnd:Ge,borderBlockStart:Ge,borderBottom:Ge,borderBottomColor:Ge,borderColor:Ge,borderInline:Ge,borderInlineEnd:Ge,borderInlineStart:Ge,borderLeft:Ge,borderLeftColor:Ge,borderRight:Ge,borderRightColor:Ge,borderTop:Ge,borderTopColor:Ge,caretColor:Ge,color:Ge,columnRuleColor:Ge,fill:Ge,outline:Ge,outlineColor:Ge,stroke:Ge,textDecorationColor:Ge,fontFamily:"fonts",fontWeight:"fontWeights",lineHeight:"lineHeights",letterSpacing:"letterSpacings",blockSize:Gt,minBlockSize:Gt,maxBlockSize:Gt,inlineSize:Gt,minInlineSize:Gt,maxInlineSize:Gt,width:Gt,minWidth:Gt,maxWidth:Gt,height:Gt,minHeight:Gt,maxHeight:Gt,flexBasis:Gt,gridTemplateColumns:Gt,gridTemplateRows:Gt,borderWidth:"borderWidths",borderTopWidth:"borderWidths",borderRightWidth:"borderWidths",borderBottomWidth:"borderWidths",borderLeftWidth:"borderWidths",borderStyle:"borderStyles",borderTopStyle:"borderStyles",borderRightStyle:"borderStyles",borderBottomStyle:"borderStyles",borderLeftStyle:"borderStyles",borderRadius:"radii",borderTopLeftRadius:"radii",borderTopRightRadius:"radii",borderBottomRightRadius:"radii",borderBottomLeftRadius:"radii",boxShadow:"shadows",textShadow:"shadows",transition:"transitions",zIndex:"zIndices"},t0e=(t,e)=>typeof e=="function"?{"()":Function.prototype.toString.call(e)}:e,Bf=()=>{const t=Object.create(null);return(e,n,...r)=>{const i=(a=>JSON.stringify(a,t0e))(e);return i in t?t[i]:t[i]=n(e,...r)}},ru=Symbol.for("sxs.internal"),nO=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),a2=t=>{for(const e in t)return!0;return!1},{hasOwnProperty:n0e}=Object.prototype,xg=t=>t.includes("-")?t:t.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())),r0e=/\s+(?![^()]*\))/,qa=t=>e=>t(...typeof e=="string"?String(e).split(r0e):[e]),o2={appearance:t=>({WebkitAppearance:t,appearance:t}),backfaceVisibility:t=>({WebkitBackfaceVisibility:t,backfaceVisibility:t}),backdropFilter:t=>({WebkitBackdropFilter:t,backdropFilter:t}),backgroundClip:t=>({WebkitBackgroundClip:t,backgroundClip:t}),boxDecorationBreak:t=>({WebkitBoxDecorationBreak:t,boxDecorationBreak:t}),clipPath:t=>({WebkitClipPath:t,clipPath:t}),content:t=>({content:t.includes('"')||t.includes("'")||/^([A-Za-z]+\([^]*|[^]*-quote|inherit|initial|none|normal|revert|unset)$/.test(t)?t:`"${t}"`}),hyphens:t=>({WebkitHyphens:t,hyphens:t}),maskImage:t=>({WebkitMaskImage:t,maskImage:t}),maskSize:t=>({WebkitMaskSize:t,maskSize:t}),tabSize:t=>({MozTabSize:t,tabSize:t}),textSizeAdjust:t=>({WebkitTextSizeAdjust:t,textSizeAdjust:t}),userSelect:t=>({WebkitUserSelect:t,userSelect:t}),marginBlock:qa(((t,e)=>({marginBlockStart:t,marginBlockEnd:e||t}))),marginInline:qa(((t,e)=>({marginInlineStart:t,marginInlineEnd:e||t}))),maxSize:qa(((t,e)=>({maxBlockSize:t,maxInlineSize:e||t}))),minSize:qa(((t,e)=>({minBlockSize:t,minInlineSize:e||t}))),paddingBlock:qa(((t,e)=>({paddingBlockStart:t,paddingBlockEnd:e||t}))),paddingInline:qa(((t,e)=>({paddingInlineStart:t,paddingInlineEnd:e||t})))},g0=/([\d.]+)([^]*)/,i0e=(t,e)=>t.length?t.reduce(((n,r)=>(n.push(...e.map((i=>i.includes("&")?i.replace(/&/g,/[ +>|~]/.test(r)&&/&.*&/.test(i)?`:is(${r})`:r):r+" "+i))),n)),[]):e,a0e=(t,e)=>t in o0e&&typeof e=="string"?e.replace(/^((?:[^]*[^\w-])?)(fit-content|stretch)((?:[^\w-][^]*)?)$/,((n,r,i,a)=>r+(i==="stretch"?`-moz-available${a};${xg(t)}:${r}-webkit-fill-available`:`-moz-fit-content${a};${xg(t)}:${r}fit-content`)+a)):String(e),o0e={blockSize:1,height:1,inlineSize:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,width:1},ri=t=>t?t+"-":"",LI=(t,e,n)=>t.replace(/([+-])?((?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?)?(\$|--)([$\w-]+)/g,((r,i,a,o,s)=>o=="$"==!!a?r:(i||o=="--"?"calc(":"")+"var(--"+(o==="$"?ri(e)+(s.includes("$")?"":ri(n))+s.replace(/\$/g,"-"):s)+")"+(i||o=="--"?"*"+(i||"")+(a||"1")+")":""))),s0e=/\s*,\s*(?![^()]*\))/,l0e=Object.prototype.toString,ro=(t,e,n,r,i)=>{let a,o,s;const l=(f,c,u)=>{let h,p;const g=m=>{for(h in m){const v=h.charCodeAt(0)===64,w=v&&Array.isArray(m[h])?m[h]:[m[h]];for(p of w){const S=/[A-Z]/.test(O=h)?O:O.replace(/-[^]/g,(M=>M[1].toUpperCase())),C=typeof p=="object"&&p&&p.toString===l0e&&(!r.utils[S]||!c.length);if(S in r.utils&&!C){const M=r.utils[S];if(M!==o){o=M,g(M(p)),o=null;continue}}else if(S in o2){const M=o2[S];if(M!==s){s=M,g(M(p)),s=null;continue}}if(v&&(y=h.slice(1)in r.media?"@media "+r.media[h.slice(1)]:h,h=y.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,((M,j,k,T,L,A)=>{const N=g0.test(j),Y=.0625*(N?-1:1),[I,E]=N?[T,j]:[j,T];return"("+(k[0]==="="?"":k[0]===">"===N?"max-":"min-")+I+":"+(k[0]!=="="&&k.length===1?E.replace(g0,((Q,R,D)=>Number(R)+Y*(k===">"?1:-1)+D)):E)+(L?") and ("+(L[0]===">"?"min-":"max-")+I+":"+(L.length===1?A.replace(g0,((Q,R,D)=>Number(R)+Y*(L===">"?-1:1)+D)):A):"")+")"}))),C){const M=v?u.concat(h):[...u],j=v?[...c]:i0e(c,h.split(s0e));a!==void 0&&i(s2(...a)),a=void 0,l(p,j,M)}else a===void 0&&(a=[[],c,u]),h=v||h.charCodeAt(0)!==36?h:`--${ri(r.prefix)}${h.slice(1).replace(/\$/g,"-")}`,p=C?p:typeof p=="number"?p&&S in f0e?String(p)+"px":String(p):LI(a0e(S,p??""),r.prefix,r.themeMap[S]),a[0].push(`${v?`${h} `:`${xg(h)}:`}${p}`)}}var y,O};g(f),a!==void 0&&i(s2(...a)),a=void 0};l(t,e,n)},s2=(t,e,n)=>`${n.map((r=>`${r}{`)).join("")}${e.length?`${e.join(",")}{`:""}${t.join(";")}${e.length?"}":""}${Array(n.length?n.length+1:0).join("}")}`,f0e={animationDelay:1,animationDuration:1,backgroundSize:1,blockSize:1,border:1,borderBlock:1,borderBlockEnd:1,borderBlockEndWidth:1,borderBlockStart:1,borderBlockStartWidth:1,borderBlockWidth:1,borderBottom:1,borderBottomLeftRadius:1,borderBottomRightRadius:1,borderBottomWidth:1,borderEndEndRadius:1,borderEndStartRadius:1,borderInlineEnd:1,borderInlineEndWidth:1,borderInlineStart:1,borderInlineStartWidth:1,borderInlineWidth:1,borderLeft:1,borderLeftWidth:1,borderRadius:1,borderRight:1,borderRightWidth:1,borderSpacing:1,borderStartEndRadius:1,borderStartStartRadius:1,borderTop:1,borderTopLeftRadius:1,borderTopRightRadius:1,borderTopWidth:1,borderWidth:1,bottom:1,columnGap:1,columnRule:1,columnRuleWidth:1,columnWidth:1,containIntrinsicSize:1,flexBasis:1,fontSize:1,gap:1,gridAutoColumns:1,gridAutoRows:1,gridTemplateColumns:1,gridTemplateRows:1,height:1,inlineSize:1,inset:1,insetBlock:1,insetBlockEnd:1,insetBlockStart:1,insetInline:1,insetInlineEnd:1,insetInlineStart:1,left:1,letterSpacing:1,margin:1,marginBlock:1,marginBlockEnd:1,marginBlockStart:1,marginBottom:1,marginInline:1,marginInlineEnd:1,marginInlineStart:1,marginLeft:1,marginRight:1,marginTop:1,maxBlockSize:1,maxHeight:1,maxInlineSize:1,maxWidth:1,minBlockSize:1,minHeight:1,minInlineSize:1,minWidth:1,offsetDistance:1,offsetRotate:1,outline:1,outlineOffset:1,outlineWidth:1,overflowClipMargin:1,padding:1,paddingBlock:1,paddingBlockEnd:1,paddingBlockStart:1,paddingBottom:1,paddingInline:1,paddingInlineEnd:1,paddingInlineStart:1,paddingLeft:1,paddingRight:1,paddingTop:1,perspective:1,right:1,rowGap:1,scrollMargin:1,scrollMarginBlock:1,scrollMarginBlockEnd:1,scrollMarginBlockStart:1,scrollMarginBottom:1,scrollMarginInline:1,scrollMarginInlineEnd:1,scrollMarginInlineStart:1,scrollMarginLeft:1,scrollMarginRight:1,scrollMarginTop:1,scrollPadding:1,scrollPaddingBlock:1,scrollPaddingBlockEnd:1,scrollPaddingBlockStart:1,scrollPaddingBottom:1,scrollPaddingInline:1,scrollPaddingInlineEnd:1,scrollPaddingInlineStart:1,scrollPaddingLeft:1,scrollPaddingRight:1,scrollPaddingTop:1,shapeMargin:1,textDecoration:1,textDecorationThickness:1,textIndent:1,textUnderlineOffset:1,top:1,transitionDelay:1,transitionDuration:1,verticalAlign:1,width:1,wordSpacing:1},l2=t=>String.fromCharCode(t+(t>25?39:97)),oa=t=>(e=>{let n,r="";for(n=Math.abs(e);n>52;n=n/52|0)r=l2(n%52)+r;return l2(n%52)+r})(((e,n)=>{let r=n.length;for(;r;)e=33*e^n.charCodeAt(--r);return e})(5381,JSON.stringify(t))>>>0),sl=["themed","global","styled","onevar","resonevar","allvar","inline"],c0e=t=>{if(t.href&&!t.href.startsWith(location.origin))return!1;try{return!!t.cssRules}catch{return!1}},u0e=t=>{let e;const n=()=>{const{cssRules:i}=e.sheet;return[].map.call(i,((a,o)=>{const{cssText:s}=a;let l="";if(s.startsWith("--sxs"))return"";if(i[o-1]&&(l=i[o-1].cssText).startsWith("--sxs")){if(!a.cssRules.length)return"";for(const f in e.rules)if(e.rules[f].group===a)return`--sxs{--sxs:${[...e.rules[f].cache].join(" ")}}${s}`;return a.cssRules.length?`${l}${s}`:""}return s})).join("")},r=()=>{if(e){const{rules:s,sheet:l}=e;if(!l.deleteRule){for(;Object(Object(l.cssRules)[0]).type===3;)l.cssRules.splice(0,1);l.cssRules=[]}for(const f in s)delete s[f]}const i=Object(t).styleSheets||[];for(const s of i)if(c0e(s)){for(let l=0,f=s.cssRules;f[l];++l){const c=Object(f[l]);if(c.type!==1)continue;const u=Object(f[l+1]);if(u.type!==4)continue;++l;const{cssText:h}=c;if(!h.startsWith("--sxs"))continue;const p=h.slice(14,-3).trim().split(/\s+/),g=sl[p[0]];g&&(e||(e={sheet:s,reset:r,rules:{},toString:n}),e.rules[g]={group:u,index:l,cache:new Set(p)})}if(e)break}if(!e){const s=(l,f)=>({type:f,cssRules:[],insertRule(c,u){this.cssRules.splice(u,0,s(c,{import:3,undefined:1}[(c.toLowerCase().match(/^@([a-z]+)/)||[])[1]]||4))},get cssText(){return l==="@media{}"?`@media{${[].map.call(this.cssRules,(c=>c.cssText)).join("")}}`:l}});e={sheet:t?(t.head||t).appendChild(document.createElement("style")).sheet:s("","text/css"),rules:{},reset:r,toString:n}}const{sheet:a,rules:o}=e;for(let s=sl.length-1;s>=0;--s){const l=sl[s];if(!o[l]){const f=sl[s+1],c=o[f]?o[f].index:a.cssRules.length;a.insertRule("@media{}",c),a.insertRule(`--sxs{--sxs:${s}}`,c),o[l]={group:a.cssRules[c+1],index:c,cache:new Set([s])}}d0e(o[l])}};return r(),e},d0e=t=>{const e=t.group;let n=e.cssRules.length;t.apply=r=>{try{e.insertRule(r,n),++n}catch{}}},Ws=Symbol(),h0e=Bf(),p0e=(t,e)=>h0e(t,(()=>(...n)=>{let r={type:null,composers:new Set};for(const i of n)if(i!=null)if(i[ru]){r.type==null&&(r.type=i[ru].type);for(const a of i[ru].composers)r.composers.add(a)}else i.constructor!==Object||i.$$typeof?r.type==null&&(r.type=i):r.composers.add(m0e(i,t));return r.type==null&&(r.type="span"),r.composers.size||r.composers.add(["PJLV",{},[],[],{},[]]),g0e(t,r,e)})),m0e=({variants:t,compoundVariants:e,defaultVariants:n,...r},i)=>{const a=`${ri(i.prefix)}c-${oa(r)}`,o=[],s=[],l=Object.create(null),f=[];for(const h in n)l[h]=String(n[h]);if(typeof t=="object"&&t)for(const h in t){c=l,u=h,n0e.call(c,u)||(l[h]="undefined");const p=t[h];for(const g in p){const m={[h]:String(g)};String(g)==="undefined"&&f.push(h);const y=p[g],O=[m,y,!a2(y)];o.push(O)}}var c,u;if(typeof e=="object"&&e)for(const h of e){let{css:p,...g}=h;p=typeof p=="object"&&p||{};for(const y in g)g[y]=String(g[y]);const m=[g,p,!a2(p)];s.push(m)}return[a,r,o,s,l,f]},g0e=(t,e,n)=>{const[r,i,a,o]=y0e(e.composers),s=typeof e.type=="function"||e.type.$$typeof?(u=>{function h(){for(let p=0;p<h[Ws].length;p++){const[g,m]=h[Ws][p];u.rules[g].apply(m)}return h[Ws]=[],null}return h[Ws]=[],h.rules={},sl.forEach((p=>h.rules[p]={apply:g=>h[Ws].push([p,g])})),h})(n):null,l=(s||n).rules,f=`.${r}${i.length>1?`:where(.${i.slice(1).join(".")})`:""}`,c=u=>{u=typeof u=="object"&&u||b0e;const{css:h,...p}=u,g={};for(const O in a)if(delete p[O],O in u){let v=u[O];typeof v=="object"&&v?g[O]={"@initial":a[O],...v}:(v=String(v),g[O]=v!=="undefined"||o.has(O)?v:a[O])}else g[O]=a[O];const m=new Set([...i]);for(const[O,v,w,S]of e.composers){n.rules.styled.cache.has(O)||(n.rules.styled.cache.add(O),ro(v,[`.${O}`],[],t,(j=>{l.styled.apply(j)})));const C=f2(w,g,t.media),M=f2(S,g,t.media,!0);for(const j of C)if(j!==void 0)for(const[k,T,L]of j){const A=`${O}-${oa(T)}-${k}`;m.add(A);const N=(L?n.rules.resonevar:n.rules.onevar).cache,Y=L?l.resonevar:l.onevar;N.has(A)||(N.add(A),ro(T,[`.${A}`],[],t,(I=>{Y.apply(I)})))}for(const j of M)if(j!==void 0)for(const[k,T]of j){const L=`${O}-${oa(T)}-${k}`;m.add(L),n.rules.allvar.cache.has(L)||(n.rules.allvar.cache.add(L),ro(T,[`.${L}`],[],t,(A=>{l.allvar.apply(A)})))}}if(typeof h=="object"&&h){const O=`${r}-i${oa(h)}-css`;m.add(O),n.rules.inline.cache.has(O)||(n.rules.inline.cache.add(O),ro(h,[`.${O}`],[],t,(v=>{l.inline.apply(v)})))}for(const O of String(u.className||"").trim().split(/\s+/))O&&m.add(O);const y=p.className=[...m].join(" ");return{type:e.type,className:y,selector:f,props:p,toString:()=>y,deferredInjector:s}};return nO(c,{className:r,selector:f,[ru]:e,toString:()=>(n.rules.styled.cache.has(r)||c(),r)})},y0e=t=>{let e="";const n=[],r={},i=[];for(const[a,,,,o,s]of t){e===""&&(e=a),n.push(a),i.push(...s);for(const l in o){const f=o[l];(r[l]===void 0||f!=="undefined"||s.includes(f))&&(r[l]=f)}}return[e,n,r,new Set(i)]},f2=(t,e,n,r)=>{const i=[];e:for(let[a,o,s]of t){if(s)continue;let l,f=0,c=!1;for(l in a){const u=a[l];let h=e[l];if(h!==u){if(typeof h!="object"||!h)continue e;{let p,g,m=0;for(const y in h){if(u===String(h[y])){if(y!=="@initial"){const O=y.slice(1);(g=g||[]).push(O in n?n[O]:y.replace(/^@media ?/,"")),c=!0}f+=m,p=!0}++m}if(g&&g.length&&(o={["@media "+g.join(", ")]:o}),!p)continue e}}}(i[f]=i[f]||[]).push([r?"cv":`${l}-${a[l]}`,o,c])}return i},b0e={},O0e=Bf(),v0e=(t,e)=>O0e(t,(()=>(...n)=>{const r=()=>{for(let i of n){i=typeof i=="object"&&i||{};let a=oa(i);if(!e.rules.global.cache.has(a)){if(e.rules.global.cache.add(a),"@import"in i){let o=[].indexOf.call(e.sheet.cssRules,e.rules.themed.group)-1;for(let s of[].concat(i["@import"]))s=s.includes('"')||s.includes("'")?s:`"${s}"`,e.sheet.insertRule(`@import ${s};`,o++);delete i["@import"]}ro(i,[],[],t,(o=>{e.rules.global.apply(o)}))}}return""};return nO(r,{toString:r})})),w0e=Bf(),x0e=(t,e)=>w0e(t,(()=>n=>{const r=`${ri(t.prefix)}k-${oa(n)}`,i=()=>{if(!e.rules.global.cache.has(r)){e.rules.global.cache.add(r);const a=[];ro(n,[],[],t,(s=>a.push(s)));const o=`@keyframes ${r}{${a.join("")}}`;e.rules.global.apply(o)}return r};return nO(i,{get name(){return i()},toString:i})})),S0e=class{constructor(t,e,n,r){this.token=t==null?"":String(t),this.value=e==null?"":String(e),this.scale=n==null?"":String(n),this.prefix=r==null?"":String(r)}get computedValue(){return"var("+this.variable+")"}get variable(){return"--"+ri(this.prefix)+ri(this.scale)+this.token}toString(){return this.computedValue}},M0e=Bf(),C0e=(t,e)=>M0e(t,(()=>(n,r)=>{r=typeof n=="object"&&n||Object(r);const i=`.${n=(n=typeof n=="string"?n:"")||`${ri(t.prefix)}t-${oa(r)}`}`,a={},o=[];for(const l in r){a[l]={};for(const f in r[l]){const c=`--${ri(t.prefix)}${l}-${f}`,u=LI(String(r[l][f]),t.prefix,l);a[l][f]=new S0e(f,u,l,t.prefix),o.push(`${c}:${u}`)}}const s=()=>{if(o.length&&!e.rules.themed.cache.has(n)){e.rules.themed.cache.add(n);const l=`${r===t.theme?":root,":""}.${n}{${o.join(";")}}`;e.rules.themed.apply(l)}return n};return{...a,get className(){return s()},selector:i,toString:s}})),j0e=Bf(),k0e=t=>{let e=!1;const n=j0e(t,(r=>{e=!0;const i="prefix"in(r=typeof r=="object"&&r||{})?String(r.prefix):"",a=typeof r.media=="object"&&r.media||{},o=typeof r.root=="object"?r.root||null:globalThis.document||null,s=typeof r.theme=="object"&&r.theme||{},l={prefix:i,media:a,theme:s,themeMap:typeof r.themeMap=="object"&&r.themeMap||{...e0e},utils:typeof r.utils=="object"&&r.utils||{}},f=u0e(o),c={css:p0e(l,f),globalCss:v0e(l,f),keyframes:x0e(l,f),createTheme:C0e(l,f),reset(){f.reset(),c.theme.toString()},theme:{},sheet:f,config:l,prefix:i,getCssText:f.toString,toString:f.toString};return String(c.theme=c.createTheme(s)),c}));return e||n.reset(),n},c2=Object.prototype.hasOwnProperty;function u2(t,e,n){for(n of t.keys())if(bo(n,e))return n}function bo(t,e){var n,r,i;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&bo(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(i=r,i&&typeof i=="object"&&(i=u2(e,i),!i)||!e.has(i))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(i=r[0],i&&typeof i=="object"&&(i=u2(e,i),!i)||!bo(r[1],e.get(i)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(c2.call(t,n)&&++r&&!c2.call(e,n)||!(n in e)||!bo(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}var L0e=/(%?)(%([sdjo]))/g;function T0e(t,e){switch(e){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const n=JSON.stringify(t);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?t:n}}}function Sg(t,...e){if(e.length===0)return t;let n=0,r=t.replace(L0e,(i,a,o,s)=>{const l=e[n],f=T0e(l,s);return a?i:(n++,f)});return n<e.length&&(r+=` ${e.slice(n).join(" ")}`),r=r.replace(/%{2,2}/g,"%"),r}var N0e=2;function I0e(t){if(!t.stack)return;const e=t.stack.split(`
|
|
188
188
|
`);e.splice(1,N0e),t.stack=e.join(`
|
|
189
189
|
`)}var P0e=class extends Error{constructor(t,...e){super(t),this.message=t,this.name="Invariant Violation",this.message=Sg(t,...e),I0e(this)}},rO=(t,e,...n)=>{if(!t)throw new P0e(e,...n)};rO.as=(t,e,n,...r)=>{if(!e)throw t.prototype.name!=null?new t(Sg(n,r)):t(Sg(n,r))};var Mg=function(t,e){return Mg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},Mg(t,e)};function D0e(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Mg(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}exports.__assign=function(){return exports.__assign=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},exports.__assign.apply(this,arguments)};function TI(t,e,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function s(c){try{f(r.next(c))}catch(u){o(u)}}function l(c){try{f(r.throw(c))}catch(u){o(u)}}function f(c){c.done?a(c.value):i(c.value).then(s,l)}f((r=r.apply(t,[])).next())})}function NI(t,e){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(c){return l([f,c])}}function l(f){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){n.label=f[1];break}if(f[0]===6&&n.label<a[1]){n.label=a[1],a=f;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(f);break}a[2]&&n.ops.pop(),n.trys.pop();continue}f=e.call(t,n)}catch(c){f=[6,c],i=0}finally{r=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function E0e(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,a;r<i;r++)(a||!(r in e))&&(a||(a=Array.prototype.slice.call(e,0,r)),a[r]=e[r]);return t.concat(a||Array.prototype.slice.call(e))}exports.SandpackLogLevel=void 0;(function(t){t[t.None=0]="None",t[t.Error=10]="Error",t[t.Warning=20]="Warning",t[t.Info=30]="Info",t[t.Debug=40]="Debug"})(exports.SandpackLogLevel||(exports.SandpackLogLevel={}));var II=function(t){return"[sandpack-client]: ".concat(t)};function iu(t,e){return e===void 0&&(e="Value is nullish"),rO(t!=null,II(e)),t}var A0e='"dependencies" was not specified - provide either a package.json or a "dependencies" value',d2='"entry" was not specified - provide either a package.json with the "main" field or an "entry" value';function PI(t,e,n){return t===void 0&&(t={}),e===void 0&&(e={}),n===void 0&&(n="/index.js"),JSON.stringify({name:"sandpack-project",main:n,dependencies:t,devDependencies:e},null,2)}function DI(t,e,n,r){var i,a,o=ba(t),s=o["/package.json"];if(!s)return iu(e,A0e),iu(r,d2),o["/package.json"]={code:PI(e,n,r)},o;if(s){var l=JSON.parse(s.code);iu(!(!e&&!l.dependencies),d2),e&&(l.dependencies=exports.__assign(exports.__assign({},(i=l.dependencies)!==null&&i!==void 0?i:{}),e??{})),n&&(l.devDependencies=exports.__assign(exports.__assign({},(a=l.devDependencies)!==null&&a!==void 0?a:{}),n??{})),r&&(l.main=r),o["/package.json"]={code:JSON.stringify(l,null,2)}}return o}function EI(t){var e;if(t.title==="SyntaxError"){var n=t.title,r=t.path,i=t.message,a=t.line,o=t.column;return{title:n,path:r,message:i,line:a,column:o}}var s=Q0e((e=t.payload)===null||e===void 0?void 0:e.frames);if(!s)return{message:t.message};var l=z0e(s),f=R0e(s),c=$0e(s._originalFileName,t.message,f,l);return{message:c,title:t.title,path:s._originalFileName,line:s._originalLineNumber,column:s._originalColumnNumber}}function Q0e(t){if(t)return t.find(function(e){return!!e._originalFileName})}function R0e(t){return t?" (".concat(t._originalLineNumber,":").concat(t._originalColumnNumber,")"):""}function z0e(t){var e=t._originalScriptCode[t._originalScriptCode.length-1],n=e.lineNumber.toString().length,r=2,i=3,a=r+n+i+t._originalColumnNumber;return t._originalScriptCode.reduce(function(o,s){var l=s.highlight?">":" ",f=s.lineNumber.toString().length===n?"".concat(s.lineNumber):" ".concat(s.lineNumber),c=s.highlight?`
|
|
190
190
|
`+" ".repeat(a)+"^":"";return o+`
|
|
191
191
|
`+l+" "+f+" | "+s.content+c},"")}function $0e(t,e,n,r){return"".concat(t,": ").concat(e).concat(n,`
|
|
192
|
-
`).concat(r)}var ba=function(t){return typeof t=="string"?t.startsWith("/")?t:"/".concat(t):Array.isArray(t)?t.map(function(e){return e.startsWith("/")?e:"/".concat(e)}):typeof t=="object"&&t!==null?Object.entries(t).reduce(function(e,n){var r=n[0],i=n[1],a=r.startsWith("/")?r:"/".concat(r);return e[a]=i,e},{}):null};function _0e(t,e,n){var r;return n===void 0&&(n={}),TI(this,void 0,void 0,function(){var i,a,o;return NI(this,function(s){switch(s.label){case 0:switch(i=(r=e.template)!==null&&r!==void 0?r:"parcel",o=i,o){case"node":return[3,1];case"static":return[3,3]}return[3,5];case 1:return[4,Promise.resolve().then(()=>require("./index-
|
|
192
|
+
`).concat(r)}var ba=function(t){return typeof t=="string"?t.startsWith("/")?t:"/".concat(t):Array.isArray(t)?t.map(function(e){return e.startsWith("/")?e:"/".concat(e)}):typeof t=="object"&&t!==null?Object.entries(t).reduce(function(e,n){var r=n[0],i=n[1],a=r.startsWith("/")?r:"/".concat(r);return e[a]=i,e},{}):null};function _0e(t,e,n){var r;return n===void 0&&(n={}),TI(this,void 0,void 0,function(){var i,a,o;return NI(this,function(s){switch(s.label){case 0:switch(i=(r=e.template)!==null&&r!==void 0?r:"parcel",o=i,o){case"node":return[3,1];case"static":return[3,3]}return[3,5];case 1:return[4,Promise.resolve().then(()=>require("./index-CmIRCaeW.js")).then(function(l){return l.SandpackNode})];case 2:return a=s.sent(),[3,7];case 3:return[4,Promise.resolve().then(()=>require("./index-599aeaf7-BviABfK9.js")).then(function(l){return l.SandpackStatic})];case 4:return a=s.sent(),[3,7];case 5:return[4,Promise.resolve().then(()=>require("./index-DomJKqdA.js")).then(function(l){return l.SandpackRuntime})];case 6:a=s.sent(),s.label=7;case 7:return[2,new a(t,e,n)]}})})}let Cg=[],AI=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e<t.length;e++)(e%2?AI:Cg).push(n=n+t[e])})();function Z0e(t){if(t<768)return!1;for(let e=0,n=Cg.length;;){let r=e+n>>1;if(t<Cg[r])n=r;else if(t>=AI[r])e=r+1;else return!0;if(e==n)return!1}}function h2(t){return t>=127462&&t<=127487}const p2=8205;function Y0e(t,e,n=!0,r=!0){return(n?QI:B0e)(t,e,r)}function QI(t,e,n){if(e==t.length)return e;e&&RI(t.charCodeAt(e))&&zI(t.charCodeAt(e-1))&&e--;let r=y0(t,e);for(e+=m2(r);e<t.length;){let i=y0(t,e);if(r==p2||i==p2||n&&Z0e(i))e+=m2(i),r=i;else if(h2(i)){let a=0,o=e-2;for(;o>=0&&h2(y0(t,o));)a++,o-=2;if(a%2==0)break;e+=2}else break}return e}function B0e(t,e,n){for(;e>0;){let r=QI(t,e-2,n);if(r<e)return r;e--}return 0}function y0(t,e){let n=t.charCodeAt(e);if(!zI(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return RI(r)?(n-55296<<10)+(r-56320)+65536:n}function RI(t){return t>=56320&&t<57344}function zI(t){return t>=55296&&t<56320}function m2(t){return t<65536?1:2}class Qe{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=Zo(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),vr.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=Zo(this,e,n);let r=[];return this.decompose(e,n,r,0),vr.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new ml(this),a=new ml(e);for(let o=n,s=n;;){if(i.next(o),a.next(o),o=0,i.lineBreak!=a.lineBreak||i.done!=a.done||i.value!=a.value)return!1;if(s+=i.value.length,i.done||s>=r)return!0}}iter(e=1){return new ml(this,e)}iterRange(e,n=this.length){return new $I(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new _I(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Qe.empty:e.length<=32?new pt(e):vr.from(pt.split(e,[]))}}class pt extends Qe{constructor(e,n=W0e(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let a=0;;a++){let o=this.text[a],s=i+o.length;if((n?r:s)>=e)return new F0e(i,s,r,o);i=s+1,r++}}decompose(e,n,r,i){let a=e<=0&&n>=this.length?this:new pt(g2(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),s=au(a.text,o.text.slice(),0,a.length);if(s.length<=32)r.push(new pt(s,o.length+a.length));else{let l=s.length>>1;r.push(new pt(s.slice(0,l)),new pt(s.slice(l)))}}else r.push(a)}replace(e,n,r){if(!(r instanceof pt))return super.replace(e,n,r);[e,n]=Zo(this,e,n);let i=au(this.text,au(r.text,g2(this.text,0,e)),n),a=this.length+r.length-(n-e);return i.length<=32?new pt(i,a):vr.from(pt.split(i,[]),a)}sliceString(e,n=this.length,r=`
|
|
193
193
|
`){[e,n]=Zo(this,e,n);let i="";for(let a=0,o=0;a<=n&&o<this.text.length;o++){let s=this.text[o],l=a+s.length;a>e&&o&&(i+=r),e<l&&n>a&&(i+=s.slice(Math.max(0,e-a),n-a)),a=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let a of e)r.push(a),i+=a.length+1,r.length==32&&(n.push(new pt(r,i)),r=[],i=-1);return i>-1&&n.push(new pt(r,i)),n}}class vr extends Qe{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let a=0;;a++){let o=this.children[a],s=i+o.length,l=r+o.lines-1;if((n?l:s)>=e)return o.lineInner(e,n,r,i);i=s+1,r=l+1}}decompose(e,n,r,i){for(let a=0,o=0;o<=n&&a<this.children.length;a++){let s=this.children[a],l=o+s.length;if(e<=l&&n>=o){let f=i&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!f?r.push(s):s.decompose(e-o,n-o,r,f)}o=l+1}}replace(e,n,r){if([e,n]=Zo(this,e,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e>=a&&n<=s){let l=o.replace(e-a,n-a,r),f=this.lines-o.lines+l.lines;if(l.lines<f>>4&&l.lines>f>>6){let c=this.children.slice();return c[i]=l,new vr(c,this.length-(n-e)+r.length)}return super.replace(a,s,l)}a=s+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
|
194
194
|
`){[e,n]=Zo(this,e,n);let i="";for(let a=0,o=0;a<this.children.length&&o<=n;a++){let s=this.children[a],l=o+s.length;o>e&&a&&(i+=r),e<l&&n>o&&(i+=s.sliceString(e-o,n-o,r)),o=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof vr))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let l=this.children[i],f=e.children[a];if(l!=f)return r+l.scanIdentical(f,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let p of e)r+=p.lines;if(r<32){let p=[];for(let g of e)g.flatten(p);return new pt(p,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],l=0,f=-1,c=[];function u(p){let g;if(p.lines>a&&p instanceof vr)for(let m of p.children)u(m);else p.lines>o&&(l>o||!l)?(h(),s.push(p)):p instanceof pt&&l&&(g=c[c.length-1])instanceof pt&&p.lines+g.lines<=32?(l+=p.lines,f+=p.length+1,c[c.length-1]=new pt(g.text.concat(p.text),g.length+1+p.length)):(l+p.lines>i&&h(),l+=p.lines,f+=p.length+1,c.push(p))}function h(){l!=0&&(s.push(c.length==1?c[0]:vr.from(c,f)),f=-1,l=c.length=0)}for(let p of e)u(p);return h(),s.length==1?s[0]:new vr(s,n)}}Qe.empty=new pt([""],0);function W0e(t){let e=-1;for(let n of t)e+=n.length+1;return e}function au(t,e,n=0,r=1e9){for(let i=0,a=0,o=!0;a<t.length&&i<=r;a++){let s=t[a],l=i+s.length;l>=n&&(l>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(e[e.length-1]+=s,o=!1):e.push(s)),i=l+1}return e}function g2(t,e,n){return au(t,[""],e,n)}class ml{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof pt?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],a=this.offsets[r],o=a>>1,s=i instanceof pt?i.text.length:i.children.length;if(o==(n>0?s:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
195
195
|
`,this;e--}else if(i instanceof pt){let l=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof pt?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class $I{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new ml(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class _I{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Qe.prototype[Symbol.iterator]=function(){return this.iter()},ml.prototype[Symbol.iterator]=$I.prototype[Symbol.iterator]=_I.prototype[Symbol.iterator]=function(){return this});class F0e{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}}function Zo(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Vt(t,e,n=!0,r=!0){return Y0e(t,e,n,r)}function X0e(t){return t>=56320&&t<57344}function G0e(t){return t>=55296&&t<56320}function Ra(t,e){let n=t.charCodeAt(e);if(!G0e(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return X0e(r)?(n-55296<<10)+(r-56320)+65536:n}function V0e(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Gh(t){return t<65536?1:2}const jg=/\r\n?|\n/;var _t=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(_t||(_t={}));class Lr{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,i=0;n<this.sections.length;){let a=this.sections[n++],o=this.sections[n++];o<0?(e(r,i,a),i+=a):i+=o,r+=a}}iterChangedRanges(e,n=!1){kg(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?e.push(r,i):e.push(i,r)}return new Lr(e)}composeDesc(e){return this.empty?e:e.empty?this:ZI(this,e)}mapDesc(e,n=!1){return e.empty?this:Lg(this,e,n)}mapPos(e,n=-1,r=_t.Simple){let i=0,a=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],l=this.sections[o++],f=i+s;if(l<0){if(f>e)return a+(e-i);a+=s}else{if(r!=_t.Simple&&f>=e&&(r==_t.TrackDel&&i<e&&f>e||r==_t.TrackBefore&&i<e||r==_t.TrackAfter&&f>e))return null;if(f>e||f==e&&n<0&&!s)return e==i||n<0?a:a+l;a+=l}i=f}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return a}touchesRange(e,n=e){for(let r=0,i=0;r<this.sections.length&&i<=n;){let a=this.sections[r++],o=this.sections[r++],s=i+a;if(o>=0&&i<=n&&s>=e)return i<e&&s>n?"cover":!0;i=s}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Lr(e)}static create(e){return new Lr(e)}}class Ct extends Lr{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return kg(this,(n,r,i,a,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return Lg(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,a=0;i<n.length;i+=2){let o=n[i],s=n[i+1];if(s>=0){n[i]=s,n[i+1]=o;let l=i>>1;for(;r.length<l;)r.push(Qe.empty);r.push(o?e.slice(a,a+o):Qe.empty)}a+=o}return new Ct(n,r)}compose(e){return this.empty?e:e.empty?this:ZI(this,e,!0)}map(e,n=!1){return e.empty?this:Lg(this,e,n,!0)}iterChanges(e,n=!1){kg(this,e,n)}get desc(){return Lr.create(this.sections)}filter(e){let n=[],r=[],i=[],a=new Xl(this);e:for(let o=0,s=0;;){let l=o==e.length?1e9:e[o++];for(;s<l||s==l&&a.len==0;){if(a.done)break e;let c=Math.min(a.len,l-s);$t(i,c,-1);let u=a.ins==-1?-1:a.off==0?a.ins:0;$t(n,c,u),u>0&&Oi(r,n,a.text),a.forward(c),s+=c}let f=e[o++];for(;s<f;){if(a.done)break e;let c=Math.min(a.len,f-s);$t(n,c,-1),$t(i,c,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(c),s+=c}}return{changes:new Ct(n,r),filtered:Lr.create(i)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let i=[],a=[],o=0,s=null;function l(c=!1){if(!c&&!i.length)return;o<n&&$t(i,n-o,-1);let u=new Ct(i,a);s=s?s.compose(u.map(s)):u,i=[],a=[],o=0}function f(c){if(Array.isArray(c))for(let u of c)f(u);else if(c instanceof Ct){if(c.length!=n)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${n})`);l(),s=s?s.compose(c.map(s)):c}else{let{from:u,to:h=u,insert:p}=c;if(u>h||u<0||h>n)throw new RangeError(`Invalid change range ${u} to ${h} (in doc of length ${n})`);let g=p?typeof p=="string"?Qe.of(p.split(r||jg)):p:Qe.empty,m=g.length;if(u==h&&m==0)return;u<o&&l(),u>o&&$t(i,u-o,-1),$t(i,h-u,m),Oi(a,i,g),o=h}}return f(e),l(!s),s}static empty(e){return new Ct(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i];if(typeof a=="number")n.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,s)=>s&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)n.push(a[0],0);else{for(;r.length<i;)r.push(Qe.empty);r[i]=Qe.of(a.slice(1)),n.push(a[0],r[i].length)}}}return new Ct(n,r)}static createSet(e,n){return new Ct(e,n)}}function $t(t,e,n,r=!1){if(e==0&&n<=0)return;let i=t.length-2;i>=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function Oi(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(Qe.empty);t.push(n)}}function kg(t,e,n){let r=t.inserted;for(let i=0,a=0,o=0;o<t.sections.length;){let s=t.sections[o++],l=t.sections[o++];if(l<0)i+=s,a+=s;else{let f=i,c=a,u=Qe.empty;for(;f+=s,c+=l,l&&r&&(u=u.append(r[o-2>>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)s=t.sections[o++],l=t.sections[o++];e(i,f,a,c,u),i=f,a=c}}}function Lg(t,e,n,r=!1){let i=[],a=r?[]:null,o=new Xl(t),s=new Xl(e);for(let l=-1;;){if(o.done&&s.len||s.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&s.ins==-1){let f=Math.min(o.len,s.len);$t(i,f,-1),o.forward(f),s.forward(f)}else if(s.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let f=s.len;for($t(i,s.ins,-1);f;){let c=Math.min(o.len,f);o.ins>=0&&l<o.i&&o.len<=c&&($t(i,0,o.ins),a&&Oi(a,i,o.text),l=o.i),o.forward(c),f-=c}s.next()}else if(o.ins>=0){let f=0,c=o.len;for(;c;)if(s.ins==-1){let u=Math.min(c,s.len);f+=u,c-=u,s.forward(u)}else if(s.ins==0&&s.len<c)c-=s.len,s.next();else break;$t(i,f,l<o.i?o.ins:0),a&&l<o.i&&Oi(a,i,o.text),l=o.i,o.forward(o.len-c)}else{if(o.done&&s.done)return a?Ct.createSet(i,a):Lr.create(i);throw new Error("Mismatched change set lengths")}}}function ZI(t,e,n=!1){let r=[],i=n?[]:null,a=new Xl(t),o=new Xl(e);for(let s=!1;;){if(a.done&&o.done)return i?Ct.createSet(r,i):Lr.create(r);if(a.ins==0)$t(r,a.len,0,s),a.next();else if(o.len==0&&!o.done)$t(r,0,o.ins,s),i&&Oi(i,r,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(a.len2,o.len),f=r.length;if(a.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;$t(r,l,c,s),i&&c&&Oi(i,r,o.text)}else o.ins==-1?($t(r,a.off?0:a.len,l,s),i&&Oi(i,r,a.textBit(l))):($t(r,a.off?0:a.len,o.off?0:o.ins,s),i&&!o.off&&Oi(i,r,o.text));s=(a.ins>l||o.ins>=0&&o.len>l)&&(s||r.length>f),a.forward2(l),o.forward(l)}}}}class Xl{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?Qe.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?Qe.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class ra{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new ra(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return re.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return re.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return re.range(e.anchor,e.head)}static create(e,n,r){return new ra(e,n,r)}}class re{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:re.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new re([this.main],0)}addRange(e,n=!0){return re.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,re.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new re(e.ranges.map(n=>ra.fromJSON(n)),e.main)}static single(e,n=e){return new re([re.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let a=e[i];if(a.empty?a.from<=r:a.from<r)return re.normalized(e.slice(),n);r=a.to}return new re(e,n)}static cursor(e,n=0,r,i){return ra.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,n,r,i){let a=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<e?ra.create(n,e,48|a):ra.create(e,n,(n>e?8:0)|a)}static normalized(e,n=0){let r=e[n];e.sort((i,a)=>i.from-a.from),n=e.indexOf(r);for(let i=1;i<e.length;i++){let a=e[i],o=e[i-1];if(a.empty?a.from<=o.to:a.from<o.to){let s=o.from,l=Math.max(a.to,o.to);i<=n&&n--,e.splice(--i,2,a.anchor>a.head?re.range(l,s):re.range(s,l))}}return new re(e,n)}}function YI(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let iO=0;class me{constructor(e,n,r,i,a){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=iO++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new me(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:aO),!!e.static,e.enables)}of(e){return new ou([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ou(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new ou(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function aO(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class ou{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=iO++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,a=this.id,o=e[a]>>1,s=this.type==2,l=!1,f=!1,c=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?f=!0:(((n=e[u.id])!==null&&n!==void 0?n:1)&1)==0&&c.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,h){if(l&&h.docChanged||f&&(h.docChanged||h.selection)||Tg(u,c)){let p=r(u);if(s?!y2(p,u.values[o],i):!i(p,u.values[o]))return u.values[o]=p,1}return 0},reconfigure:(u,h)=>{let p,g=h.config.address[a];if(g!=null){let m=ad(h,g);if(this.dependencies.every(y=>y instanceof me?h.facet(y)===u.facet(y):y instanceof cr?h.field(y,!1)==u.field(y,!1):!0)||(s?y2(p=r(u),m,i):i(p=r(u),m)))return u.values[o]=m,0}else p=r(u);return u.values[o]=p,1}}}}function y2(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Tg(t,e){let n=!1;for(let r of e)gl(t,r)&1&&(n=!0);return n}function U0e(t,e,n){let r=n.map(l=>t[l.id]),i=n.map(l=>l.type),a=r.filter(l=>!(l&1)),o=t[e.id]>>1;function s(l){let f=[];for(let c=0;c<r.length;c++){let u=ad(l,r[c]);if(i[c]==2)for(let h of u)f.push(h);else f.push(u)}return e.combine(f)}return{create(l){for(let f of r)gl(l,f);return l.values[o]=s(l),1},update(l,f){if(!Tg(l,a))return 0;let c=s(l);return e.compare(c,l.values[o])?0:(l.values[o]=c,1)},reconfigure(l,f){let c=Tg(l,r),u=f.config.facets[e.id],h=f.facet(e);if(u&&!c&&aO(n,u))return l.values[o]=h,0;let p=s(l);return e.compare(p,h)?(l.values[o]=h,0):(l.values[o]=p,1)}}}const gc=me.define({static:!0});class cr{constructor(e,n,r,i,a){this.id=e,this.createF=n,this.updateF=r,this.compareF=i,this.spec=a,this.provides=void 0}static define(e){let n=new cr(iO++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(gc).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let a=r.values[n],o=this.updateF(a,i);return this.compareF(a,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let a=r.facet(gc),o=i.facet(gc),s;return(s=a.find(l=>l.field==this))&&s!=o.find(l=>l.field==this)?(r.values[n]=s.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,gc.of({field:this,create:e})]}get extension(){return this}}const na={lowest:4,low:3,default:2,high:1,highest:0};function Fs(t){return e=>new BI(e,t)}const Vh={highest:Fs(na.highest),high:Fs(na.high),default:Fs(na.default),low:Fs(na.low),lowest:Fs(na.lowest)};class BI{constructor(e,n){this.inner=e,this.prec=n}}class Uh{of(e){return new Ng(this,e)}reconfigure(e){return Uh.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ng{constructor(e,n){this.compartment=e,this.inner=n}}class id{constructor(e,n,r,i,a,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let i=[],a=Object.create(null),o=new Map;for(let h of q0e(e,n,o))h instanceof cr?i.push(h):(a[h.facet.id]||(a[h.facet.id]=[])).push(h);let s=Object.create(null),l=[],f=[];for(let h of i)s[h.id]=f.length<<1,f.push(p=>h.slot(p));let c=r?.config.facets;for(let h in a){let p=a[h],g=p[0].facet,m=c&&c[h]||[];if(p.every(y=>y.type==0))if(s[g.id]=l.length<<1|1,aO(m,p))l.push(r.facet(g));else{let y=g.combine(p.map(O=>O.value));l.push(r&&g.compare(y,r.facet(g))?r.facet(g):y)}else{for(let y of p)y.type==0?(s[y.id]=l.length<<1|1,l.push(y.value)):(s[y.id]=f.length<<1,f.push(O=>y.dynamicSlot(O)));s[g.id]=f.length<<1,f.push(y=>U0e(y,g,p))}}let u=f.map(h=>h(s));return new id(e,o,u,s,l,a)}}function q0e(t,e,n){let r=[[],[],[],[],[]],i=new Map;function a(o,s){let l=i.get(o);if(l!=null){if(l<=s)return;let f=r[l].indexOf(o);f>-1&&r[l].splice(f,1),o instanceof Ng&&n.delete(o.compartment)}if(i.set(o,s),Array.isArray(o))for(let f of o)a(f,s);else if(o instanceof Ng){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let f=e.get(o.compartment)||o.inner;n.set(o.compartment,f),a(f,s)}else if(o instanceof BI)a(o.inner,o.prec);else if(o instanceof cr)r[s].push(o),o.provides&&a(o.provides,s);else if(o instanceof ou)r[s].push(o),o.facet.extensions&&a(o.facet.extensions,na.default);else{let f=o.extension;if(!f)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(f,s)}}return a(t,na.default),r.reduce((o,s)=>o.concat(s))}function gl(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function ad(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const WI=me.define(),Ig=me.define({combine:t=>t.some(e=>e),static:!0}),FI=me.define({combine:t=>t.length?t[0]:void 0,static:!0}),XI=me.define(),GI=me.define(),VI=me.define(),UI=me.define({combine:t=>t.length?t[0]:!1});class ir{constructor(e,n){this.type=e,this.value=n}static define(){return new H0e}}class H0e{of(e){return new ir(this,e)}}class J0e{constructor(e){this.map=e}of(e){return new Ve(this,e)}}class Ve{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Ve(this.type,n)}is(e){return this.type==e}static define(e={}){return new J0e(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let a=i.map(n);a&&r.push(a)}return r}}Ve.reconfigure=Ve.define();Ve.appendConfig=Ve.define();class xt{constructor(e,n,r,i,a,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&YI(r,n.newLength),a.some(s=>s.type==xt.time)||(this.annotations=a.concat(xt.time.of(Date.now())))}static create(e,n,r,i,a,o){return new xt(e,n,r,i,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(xt.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}xt.time=ir.define();xt.userEvent=ir.define();xt.addToHistory=ir.define();xt.remote=ir.define();function K0e(t,e){let n=[];for(let r=0,i=0;;){let a,o;if(r<t.length&&(i==e.length||e[i]>=t[r]))a=t[r++],o=t[r++];else if(i<e.length)a=e[i++],o=e[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function qI(t,e,n){var r;let i,a,o;return n?(i=e.changes,a=Ct.empty(e.changes.length),o=t.changes.compose(e.changes)):(i=e.changes.map(t.changes),a=t.changes.mapDesc(e.changes,!0),o=t.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(a):(r=t.selection)===null||r===void 0?void 0:r.map(i),effects:Ve.mapEffects(t.effects,i).concat(Ve.mapEffects(e.effects,a)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Pg(t,e,n){let r=e.selection,i=Oo(e.annotations);return e.userEvent&&(i=i.concat(xt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Ct?e.changes:Ct.of(e.changes||[],n,t.facet(FI)),selection:r&&(r instanceof re?r:re.single(r.anchor,r.head)),effects:Oo(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function HI(t,e,n){let r=Pg(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(n=!1);let o=!!e[a].sequential;r=qI(r,Pg(t,e[a],o?r.changes.newLength:t.doc.length),o)}let i=xt.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return tme(n?eme(i):i)}function eme(t){let e=t.startState,n=!0;for(let i of e.facet(XI)){let a=i(t);if(a===!1){n=!1;break}Array.isArray(a)&&(n=n===!0?a:K0e(n,a))}if(n!==!0){let i,a;if(n===!1)a=t.changes.invertedDesc,i=Ct.empty(e.doc.length);else{let o=t.changes.filter(n);i=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}t=xt.create(e,i,t.selection&&t.selection.map(a),Ve.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)}let r=e.facet(GI);for(let i=r.length-1;i>=0;i--){let a=r[i](t);a instanceof xt?t=a:Array.isArray(a)&&a.length==1&&a[0]instanceof xt?t=a[0]:t=HI(e,Oo(a),!1)}return t}function tme(t){let e=t.startState,n=e.facet(VI),r=t;for(let i=n.length-1;i>=0;i--){let a=n[i](t);a&&Object.keys(a).length&&(r=qI(r,Pg(e,a,t.changes.newLength),!0))}return r==t?t:xt.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const nme=[];function Oo(t){return t==null?nme:Array.isArray(t)?t:[t]}var Pn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Pn||(Pn={}));const rme=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Dg;try{Dg=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ime(t){if(Dg)return Dg.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||rme.test(n)))return!0}return!1}function ame(t){return e=>{if(!/\S/.test(e))return Pn.Space;if(ime(e))return Pn.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Pn.Word;return Pn.Other}}class Ze{constructor(e,n,r,i,a,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let s=0;s<this.config.dynamicSlots.length;s++)gl(this,s<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return gl(this,r),ad(this,r)}update(...e){return HI(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:i}=n;for(let s of e.effects)s.is(Uh.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,f)=>i.set(f,l)),n=null),i.set(s.value.compartment,s.value.extension)):s.is(Ve.reconfigure)?(n=null,r=s.value):s.is(Ve.appendConfig)&&(n=null,r=Oo(r).concat(s.value));let a;n?a=e.startState.values.slice():(n=id.resolve(r,i,this),a=new Ze(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,f)=>f.reconfigure(l,this),null).values);let o=e.startState.facet(Ig)?e.newSelection:e.newSelection.asSingle();new Ze(n,e.newDoc,o,a,(s,l)=>l.update(s,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:re.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),a=[r.range],o=Oo(r.effects);for(let s=1;s<n.ranges.length;s++){let l=e(n.ranges[s]),f=this.changes(l.changes),c=f.map(i);for(let h=0;h<s;h++)a[h]=a[h].map(c);let u=i.mapDesc(f,!0);a.push(l.range.map(u)),i=i.compose(c),o=Ve.mapEffects(o,c).concat(Ve.mapEffects(Oo(l.effects),u))}return{changes:i,selection:re.create(a,n.mainIndex),effects:o}}changes(e=[]){return e instanceof Ct?e:Ct.of(e,this.doc.length,this.facet(Ze.lineSeparator))}toText(e){return Qe.of(e.split(this.facet(Ze.lineSeparator)||jg))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(gl(this,n),ad(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof cr&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let a in r)if(Object.prototype.hasOwnProperty.call(e,a)){let o=r[a],s=e[a];i.push(o.init(l=>o.spec.fromJSON(s,l)))}}return Ze.create({doc:e.doc,selection:re.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=id.resolve(e.extensions||[],new Map),r=e.doc instanceof Qe?e.doc:Qe.of((e.doc||"").split(n.staticFacet(Ze.lineSeparator)||jg)),i=e.selection?e.selection instanceof re?e.selection:re.single(e.selection.anchor,e.selection.head):re.single(0);return YI(i,r.length),n.staticFacet(Ig)||(i=i.asSingle()),new Ze(n,r,i,n.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(Ze.tabSize)}get lineBreak(){return this.facet(Ze.lineSeparator)||`
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as a, C as o, D as s, E as t, F as l, G as i, r as p, m as d, H as n, p as E, P as F, T, I as x, U as m, V as c, o as v, J as y, W as u, s as P, A as C, t as D, v as f, q as L, w as g, B as w, z as I, x as R, y as W, u as A } from "./index-
|
|
1
|
+
import { l as a, C as o, D as s, E as t, F as l, G as i, r as p, m as d, H as n, p as E, P as F, T, I as x, U as m, V as c, o as v, J as y, W as u, s as P, A as C, t as D, v as f, q as L, w as g, B as w, z as I, x as R, y as W, u as A } from "./index-C0WWy03d.mjs";
|
|
2
2
|
import { Alert as H, Button as S, Splitter as U, Tooltip as V, Tree as b } from "antd";
|
|
3
3
|
export {
|
|
4
4
|
H as Alert,
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-GIzPbCRd.js"),r=require("antd");exports.CodeEditor=e.CodeEditor;exports.CodeEditorWrapper=e.CodeEditorWrapper;exports.DataExplorer=e.DataExplorer;exports.EditorLayout=e.EditorLayout;exports.FileExplorer=e.FileExplorer;exports.FormCodeEditor=e.FormCodeEditor;exports.FormFileProvider=e.FormFileProvider;exports.FunctionLibrary=e.FunctionLibrary;exports.Header=e.Header;exports.Panels=e.Panels;exports.PreviewPanel=e.PreviewPanel;exports.TestRunner=e.TestRunner;exports.URLCodeEditor=e.URLCodeEditor;exports.URLFileProvider=e.URLFileProvider;exports.VERSION=e.VERSION;exports.VersionHistory=e.VersionHistory;exports.WorkflowCodeEditor=e.WorkflowCodeEditor;exports.WorkflowFileProvider=e.WorkflowFileProvider;exports.autoConvertToExplorerData=e.autoConvertToExplorerData;exports.collectAllFiles=e.collectAllFiles;exports.convertGenericDataToExplorerItem=e.convertGenericDataToExplorerItem;exports.convertObjectsToExplorerData=e.convertObjectsToExplorerData;exports.createFileProvider=e.createFileProvider;exports.createSampleExplorerData=e.createSampleExplorerData;exports.findFileById=e.findFileById;exports.getLanguageFromExtension=e.getLanguageFromExtension;exports.mapDataTypeToExplorerType=e.mapDataTypeToExplorerType;exports.mapFieldTypeToExplorerType=e.mapFieldTypeToExplorerType;exports.useFileManager=e.useFileManager;Object.defineProperty(exports,"Alert",{enumerable:!0,get:()=>r.Alert});Object.defineProperty(exports,"Button",{enumerable:!0,get:()=>r.Button});Object.defineProperty(exports,"Splitter",{enumerable:!0,get:()=>r.Splitter});Object.defineProperty(exports,"Tooltip",{enumerable:!0,get:()=>r.Tooltip});Object.defineProperty(exports,"Tree",{enumerable:!0,get:()=>r.Tree});
|