@notmrabhi/flowforge 0.1.27 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { useMemo as P, useState as T, useRef as M, useEffect as de, useCallback as te } from "react";
2
2
  import { useFormik as ke } from "formik";
3
- import { k as pe, C as Ne, g as oe, a as ue, b as ie, v as se, E as ze, d as Te, V as we } from "./index-hrOZNB2l.js";
3
+ import { k as pe, C as Ne, g as oe, a as ue, b as ie, v as se, E as ze, d as Te, V as we } from "./index-DOlwEmVL.js";
4
4
  import { jsxs as t, Fragment as q, jsx as e } from "react/jsx-runtime";
5
5
  import { Box as n, Collapse as Ie, Tooltip as A, Dialog as he, Typography as S, IconButton as Y, Stepper as Fe, Step as Oe, StepLabel as Re, Drawer as Ee, Chip as We, Divider as Ae } from "@mui/material";
6
6
  import { MdCheck as G, MdClose as _, MdAdd as J, MdArrowBack as fe, MdEdit as De, MdDeleteOutline as Pe, MdSettings as be, MdArrowForward as Me } from "react-icons/md";
@@ -1 +1 @@
1
- "use strict";const h=require("react"),re=require("formik"),N=require("./index-yqsiFHGg.js"),e=require("react/jsx-runtime"),o=require("@mui/material"),S=require("react-icons/md"),ie=require("react-icons/fa6");function ae({schema:l,initialValues:s,onSubmit:d,showErrorsImmediately:a=!1}){const r=l.fields??[],t=h.useMemo(()=>N.buildValidationSchema(r),[r]),p=h.useMemo(()=>{if(a)return r.reduce((u,v)=>{const g=N.resolveFieldKey(v);return g&&(u[g]=!0),u},{})},[r,a]),[i,c]=h.useState({}),[m,y]=h.useState({}),B=h.useRef(s);h.useEffect(()=>{B.current!==s&&(B.current=s,c({}),y({}))},[s]);const x=re.useFormik({initialValues:s,validationSchema:t,initialTouched:p,validateOnMount:a,validateOnChange:!0,validateOnBlur:!0,enableReinitialize:!0,onSubmit:async u=>{const v=N.buildEvaluationPayload({values:u,conditionConfig:m});await d(u,v)}}),n=h.useCallback(()=>{x.submitForm()},[x]),f=h.useCallback(u=>{x.resetForm(u?{values:u}:void 0),c({}),y({})},[x]);return{values:x.values,errors:x.errors,isValid:x.isValid,isDirty:x.dirty,isSubmitting:x.isSubmitting,formulaConfig:i,conditionConfig:m,submit:n,reset:f,setFieldValue:x.setFieldValue,_schema:l,_formik:x,_formulaConfig:i,_onFormulaConfigChange:c,_conditionConfig:m,_onConditionConfigChange:y}}const Z=N.FlowForgeRegistry.getTypeOptions(),j="form-control font-14",b="text-14 text-dark fw-medium mb-1 align-items-center d-flex gap-1",F={fontSize:10,fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:.6,marginBottom:8,display:"block"},ce=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object (sub-fields)"},{value:"array",label:"Array (nested)"}],de=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}];function xe({value:l,onChange:s}){const d=l??12;return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:"Column width"}),e.jsx(o.Box,{sx:{display:"flex",gap:.5},children:de.map(a=>e.jsx(o.Tooltip,{title:`colSpan: ${a.value}`,placement:"top",children:e.jsx(o.Box,{component:"button",onClick:()=>s(a.value),sx:{flex:1,border:"1px solid",borderColor:d===a.value?"#6366f1":"#dee2e6",borderRadius:"6px",cursor:"pointer",bgcolor:d===a.value?"#eef2ff":"#fff",color:d===a.value?"#6366f1":"#6c757d",fontSize:11,fontWeight:600,py:.6,px:0,"&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:a.label})},a.value))}),e.jsx(o.Box,{sx:{display:"flex",gap:"3px",mt:.75},children:Array.from({length:12}).map((a,r)=>e.jsx(o.Box,{sx:{flex:1,height:4,borderRadius:"2px",bgcolor:r<d?"#6366f1":"#e2e8f0",transition:"background 0.12s"}},r))})]})}function Q({options:l=[],onChange:s}){function d(a,r,t){s(l.map((p,i)=>i===a?{...p,[r]:t}:p))}return e.jsxs(o.Box,{children:[e.jsxs("span",{className:b,children:["Options ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:l.map((a,r)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{className:j,style:{flex:1},placeholder:"Label",value:a.label,onChange:t=>d(r,"label",t.target.value)}),e.jsx("input",{className:j,style:{flex:1},placeholder:"Value",value:a.value,onChange:t=>d(r,"value",t.target.value)}),e.jsx(o.Box,{component:"button",onClick:()=>s(l.filter((t,p)=>p!==r)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]},r))}),e.jsxs(o.Box,{component:"button",onClick:()=>s([...l,{label:"",value:""}]),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[e.jsx(S.MdAdd,{size:13})," Add option"]})]})}const ee=[{value:"operator",label:"Operator (predefined)"},{value:"select",label:"Select"},{value:"text",label:"Text"}];function pe({col:l,onChange:s,onDelete:d}){const a=l.type==="select",r=l.type==="operator";return e.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"7px",p:1.25,bgcolor:"#fff",display:"flex",flexDirection:"column",gap:1},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:r?"#fef9c3":"#eef2ff",color:r?"#92400e":"#6366f1",flexShrink:0},children:r?"OPERATOR":l.type.toUpperCase()}),e.jsx(o.Box,{sx:{fontSize:12,fontWeight:600,color:"#0f172a",flex:1},children:l.label||l.id||"Unnamed"}),e.jsx(o.Box,{component:"button",onClick:d,sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Column type"}),e.jsx("select",{value:l.type,onChange:t=>s({...l,type:t.target.value,options:void 0}),className:j,style:{cursor:"pointer"},children:ee.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Column key ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:`${j} ${l.id?"":"border-danger"}`,value:l.id,onChange:t=>s({...l,id:t.target.value}),placeholder:"e.g. field, operator, value"}),!l.id&&e.jsx("span",{style:{fontSize:10,color:"#dc3545"},children:"Required — used as data key"})]})]}),!r&&e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Label"}),e.jsx("input",{className:j,value:l.label??"",onChange:t=>s({...l,label:t.target.value||void 0}),placeholder:"Column label"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Placeholder"}),e.jsx("input",{className:j,value:l.placeholder??"",onChange:t=>s({...l,placeholder:t.target.value||void 0}),placeholder:"Hint…"})]})]}),a&&e.jsx(Q,{options:l.options??[],onChange:t=>s({...l,options:t})}),r&&e.jsx(o.Box,{sx:{bgcolor:"#fefce8",border:"1px solid #fef08a",borderRadius:"6px",px:1.25,py:.75},children:e.jsx(o.Box,{sx:{fontSize:11,color:"#78350f"},children:"Predefined: equals, not equals, contains, starts with, ends with, is present, is not present, greater than, less than…"})}),!r&&e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:`formula-${l.id}`,checked:!!l.formula,onChange:t=>s({...l,formula:t.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),e.jsx("label",{htmlFor:`formula-${l.id}`,className:b,style:{margin:0,cursor:"pointer"},children:"Formula input (chip editor)"})]})]})}function ue({condition:l,onChange:s}){const d=!!l;function a(){s(d?void 0:{fields:[]})}function r(i){if(!l)return;const c=i==="operator"?"operator":l.fields.filter(m=>m.type!=="operator").length===0?"field":"value";s({...l,fields:[...l.fields,{id:c,type:i}]})}function t(i,c){if(!l)return;const m=[...l.fields];m[i]=c,s({...l,fields:m})}function p(i){l&&s({...l,fields:l.fields.filter((c,m)=>m!==i)})}return e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75,mb:d?1.25:0},children:[e.jsx("input",{type:"checkbox",id:"enable-condition",checked:d,onChange:a,style:{cursor:"pointer",width:14,height:14}}),e.jsx("span",{style:{...F,margin:0,color:d?"#6366f1":"#94a3b8"},children:"Condition row"})]}),d&&l&&e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[l.fields.map((i,c)=>e.jsx(pe,{col:i,onChange:m=>t(c,m),onDelete:()=>p(c)},c)),e.jsx(o.Box,{sx:{display:"flex",gap:.5},children:ee.map(i=>e.jsxs(o.Box,{component:"button",onClick:()=>r(i.value),sx:{flex:1,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,py:.5,borderRadius:"6px",color:i.value==="operator"?"#92400e":"#6366f1","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:["+ ",i.value==="operator"?"Operator":i.label.split(" ")[0]]},i.value))}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:"allow-groups",checked:!!l.allowGroups,onChange:i=>s({...l,allowGroups:i.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),e.jsx("label",{htmlFor:"allow-groups",className:b,style:{margin:0,cursor:"pointer"},children:"Allow nested groups"})]}),l.allowGroups&&e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("label",{className:b,style:{margin:0},children:"Max depth"}),e.jsx("input",{type:"number",min:1,max:5,className:j,style:{width:60,textAlign:"center"},value:l.maxGroupDepth??"",onChange:i=>s({...l,maxGroupDepth:i.target.value?Number(i.target.value):void 0}),placeholder:"∞"})]})]})]})]})}function E({id:l,label:s,checked:d,onChange:a}){return e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:l,checked:d,onChange:r=>a(r.target.checked),style:{cursor:"pointer",width:14,height:14,flexShrink:0}}),e.jsx("label",{htmlFor:l,className:b,style:{margin:0,cursor:"pointer"},children:s})]})}function he({views:l=[],onChange:s}){function d(r,t,p){s(l.map((i,c)=>c===r?{...i,[t]:p}:i))}function a(){const r=`tab${l.length+1}`;s([...l,{id:r,label:`Tab ${l.length+1}`}])}return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:"Views"}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:l.map((r,t)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{className:j,style:{flex:1},placeholder:"Label",value:r.label,onChange:p=>d(t,"label",p.target.value)}),e.jsx("input",{className:j,style:{flex:1},placeholder:"ID (no spaces)",value:r.id,onChange:p=>d(t,"id",p.target.value.replace(/\s/g,"_"))}),e.jsx(o.Box,{component:"button",onClick:()=>s(l.filter((p,i)=>i!==t)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]},t))}),e.jsxs(o.Box,{component:"button",onClick:a,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[e.jsx(S.MdAdd,{size:13})," Add view"]})]})}function _({label:l,value:s,options:d,onChange:a}){return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:l}),e.jsx(o.Box,{sx:{display:"flex",border:"1px solid #dee2e6",borderRadius:"7px",overflow:"hidden"},children:d.map(r=>e.jsx(o.Box,{component:"button",onClick:()=>a(r.value),sx:{flex:1,border:"none",borderRight:"1px solid #dee2e6",cursor:"pointer",fontSize:12,fontWeight:600,py:.6,bgcolor:s===r.value?"#eef2ff":"#fff",color:s===r.value?"#6366f1":"#6c757d","&:last-child":{borderRight:"none"},"&:hover":{bgcolor:"#f5f3ff"}},children:r.label},r.value))})]})}function le({field:l,onChange:s,onSave:d,onCancel:a,noFooter:r}){const[t,p]=h.useState(!1),i=l.id??l.name??"",c=l,m=l.type==="select"||l.type==="descriptive-select"||l.type==="radio-group",y=N.FlowForgeRegistry.get(l.type),B=y==null?void 0:y.configSchema;function x(n,f){s({...l,[n]:f})}return e.jsxs(e.Fragment,{children:[e.jsxs(o.Box,{sx:{flex:1,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.75},children:[e.jsxs(o.Box,{children:[e.jsx("span",{style:F,children:"Required"}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Type"}),e.jsx("select",{value:l.type,onChange:n=>x("type",n.target.value),className:j,style:{cursor:"pointer"},children:Z.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:l.type==="tabs"?"1fr":"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Field ID ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:j,value:l.id??l.name??"",onChange:n=>x("id",n.target.value),placeholder:"e.g. email"})]}),l.type!=="tabs"&&e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Label ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:j,value:l.label??"",onChange:n=>x("label",n.target.value),placeholder:"Display label"})]})]}),l.type!=="tabs"&&e.jsx(xe,{value:l.colSpan,onChange:n=>x("colSpan",n===12?void 0:n)})]})]}),B&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx("span",{style:F,children:"Specific Settings"}),e.jsx(N.FlowForm,{schema:{layout:"flat",compact:!0,fields:B.fields},initialValues:l,onValuesChange:n=>s({...l,...n}),onSubmit:()=>{}})]}),l.type==="tabs"&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx("span",{style:F,children:"Content"}),e.jsx(he,{views:(c.tabs??[]).map(n=>({id:n.id,label:n.label})),onChange:n=>{const f=c.tabs??[],u=n.map(v=>{const g=f.find(w=>w.id===v.id);return g?{...g,...v}:{...v,fields:[]}});s({...l,tabs:u})}}),e.jsx("span",{style:{...F,marginTop:4},children:"Interaction"}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Disabled"}),e.jsx("input",{className:j,value:c.disabledExpr??"",onChange:n=>s({...l,disabledExpr:n.target.value||void 0}),placeholder:"false"})]}),e.jsx("span",{style:{...F,marginTop:4},children:"Appearance"}),e.jsx(_,{label:"Alignment",value:c.alignment??"left",options:[{value:"left",label:"|←"},{value:"center-left",label:"←|"},{value:"center",label:"|·|"},{value:"center-right",label:"|→"},{value:"right",label:"→|"}],onChange:n=>s({...l,alignment:n})}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Hidden"}),e.jsx("input",{className:j,value:c.hiddenExpr??"",onChange:n=>s({...l,hiddenExpr:n.target.value||void 0}),placeholder:"false"})]}),e.jsx(_,{label:"Variant",value:c.variant??"line",options:[{value:"pill",label:"Pill"},{value:"line",label:"Line"}],onChange:n=>s({...l,variant:n})}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Active color"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.activeColor??"#6366f1",onChange:n=>s({...l,activeColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.activeColor??"",onChange:n=>s({...l,activeColor:n.target.value||void 0}),placeholder:"#6366f1",style:{flex:1}})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Active text"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.activeTextColor??"#ffffff",onChange:n=>s({...l,activeTextColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.activeTextColor??"",onChange:n=>s({...l,activeTextColor:n.target.value||void 0}),placeholder:"auto",style:{flex:1}})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Inactive text"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.inactiveTextColor??"#64748b",onChange:n=>s({...l,inactiveTextColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.inactiveTextColor??"",onChange:n=>s({...l,inactiveTextColor:n.target.value||void 0}),placeholder:"#64748b",style:{flex:1}})]})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Styles"}),e.jsx("input",{className:j,value:c.styles??"",onChange:n=>s({...l,styles:n.target.value||void 0}),placeholder:"None"})]}),e.jsx("span",{style:{...F,marginTop:4},children:"Spacing"}),e.jsx(_,{label:"Height",value:c.height??"auto",options:[{value:"auto",label:"Auto"},{value:"fixed",label:"Fixed"}],onChange:n=>s({...l,height:n})}),e.jsx(_,{label:"Margin",value:c.margin??"normal",options:[{value:"normal",label:"Normal"},{value:"none",label:"None"}],onChange:n=>s({...l,margin:n})})]}),m&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx("span",{style:F,children:"Options"}),e.jsx(Q,{options:c.options??[],onChange:n=>s({...l,options:n})})]}),l.type==="array"&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{style:F,children:"Array settings"}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item type"}),e.jsx("select",{className:j,style:{cursor:"pointer"},value:c.itemType??"text",onChange:n=>s({...l,itemType:n.target.value}),children:ce.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item label"}),e.jsx("input",{className:j,value:c.itemLabel??"",onChange:n=>s({...l,itemLabel:n.target.value||void 0}),placeholder:'e.g. "Member"'})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Add button label"}),e.jsx("input",{className:j,value:c.addLabel??"",onChange:n=>s({...l,addLabel:n.target.value||void 0}),placeholder:"Add item"})]})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Min items"}),e.jsx("input",{type:"number",min:0,className:j,value:c.minItems??"",onChange:n=>s({...l,minItems:n.target.value?Number(n.target.value):void 0}),placeholder:"0"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Max items"}),e.jsx("input",{type:"number",min:1,className:j,value:c.maxItems??"",onChange:n=>s({...l,maxItems:n.target.value?Number(n.target.value):void 0}),placeholder:"∞"})]})]}),!["object","array","select"].includes(c.itemType??"text")&&e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item placeholder"}),e.jsx("input",{className:j,value:c.itemPlaceholder??"",onChange:n=>s({...l,itemPlaceholder:n.target.value||void 0}),placeholder:"Enter value…"})]})]}),e.jsx(ue,{condition:l.condition,onChange:n=>s({...l,condition:n})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx(o.Box,{component:"button",onClick:()=>p(n=>!n),sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:.5,p:0,mb:t?1.25:0},children:e.jsxs("span",{style:{...F,margin:0,color:t?"#6366f1":"#94a3b8"},children:[t?"▾":"▸"," Optional settings"]})}),e.jsx(o.Collapse,{in:t,children:e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Placeholder"}),e.jsx("input",{className:j,value:l.placeholder??"",onChange:n=>x("placeholder",n.target.value||void 0),placeholder:"Hint text…"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Helper text"}),e.jsx("input",{className:j,value:l.helperText??"",onChange:n=>x("helperText",n.target.value||void 0),placeholder:"Description…"})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Info tooltip"}),e.jsx("input",{className:j,value:l.info??"",onChange:n=>x("info",n.target.value||void 0),placeholder:"Shown in ℹ tooltip"})]}),e.jsxs(o.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1.5},children:[e.jsx(E,{id:`${i}-req`,label:"Required",checked:!!l.required,onChange:n=>x("required",n||void 0)}),e.jsx(E,{id:`${i}-dis`,label:"Disabled",checked:!!l.disabled,onChange:n=>x("disabled",n||void 0)}),e.jsx(E,{id:`${i}-hid`,label:"Hidden",checked:!!l.hidden,onChange:n=>x("hidden",n||void 0)}),e.jsx(E,{id:`${i}-opt`,label:"Show optional",checked:!!l.showOptional,onChange:n=>x("showOptional",n||void 0)}),e.jsx(E,{id:`${i}-div`,label:"Divider after",checked:!!l.dividerAfter,onChange:n=>x("dividerAfter",n||void 0)}),e.jsx(E,{id:`${i}-frm`,label:"Formula input",checked:!!l.formula,onChange:n=>x("formula",n||void 0)})]})]})})]})]}),!r&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",gap:1,justifyContent:"flex-end",bgcolor:"#f8fafc",flexShrink:0},children:[e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:d,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Save"]})]})]})}const L={text:"#0f172a",textMuted:"#64748b",borderInput:"rgba(0,0,0,0.23)",bg:"#ffffff"},fe={md:"6px"},oe={sm:11,md:13},G={width:"100%",fontSize:oe.md,fontFamily:"inherit",padding:"8px 12px",border:`1px solid ${L.borderInput}`,borderRadius:fe.md,outline:"none",background:L.bg,color:L.text,boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"};function X(){return{type:"text",id:"",label:"",colSpan:12}}function be(l){return l.type==="object"||l.type==="array"||l.type==="schema"}function me(l){if(l.type==="object")return"Child Fields";if(l.type==="schema")return"Schema Fields";const s=l.itemType??"text";return s==="object"?"Item Fields":s==="select"?"Item Options":"Item Config"}function ge({field:l,onChange:s}){var r;const d=l,a=d.itemType??"text";if(l.type==="object")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields nested inside this object. Each child field can itself be an object or array."}),e.jsx(W,{value:l.children??[],onChange:t=>s({...l,children:t}),label:"Child fields"})]});if(l.type==="schema")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields inside this schema. When the form is filled, their values are collected into a single object as this field's value."}),e.jsx(W,{value:l.children??[],onChange:t=>s({...l,children:t}),label:"Schema fields"})]});if(l.type==="array"){if(a==="object")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields for each item in the array. Each item will be an object with these fields."}),e.jsx(W,{value:d.itemFields??[],onChange:t=>s({...l,itemFields:t}),label:"Item fields"})]});if(a==="select"){const t=d.itemOptions??[];return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Options available in each select item."}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:t.map((p,i)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{style:{...G,flex:1,padding:"6px 10px"},placeholder:"Label",value:p.label,onChange:c=>{const m=t.map((y,B)=>B===i?{...y,label:c.target.value}:y);s({...l,itemOptions:m})}}),e.jsx("input",{style:{...G,flex:1,padding:"6px 10px"},placeholder:"Value",value:p.value,onChange:c=>{const m=t.map((y,B)=>B===i?{...y,value:c.target.value}:y);s({...l,itemOptions:m})}}),e.jsx(o.Box,{component:"button",onClick:()=>s({...l,itemOptions:t.filter((c,m)=>m!==i)}),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:"✕"})]},i))}),e.jsx(o.Box,{component:"button",onClick:()=>s({...l,itemOptions:[...t,{label:"",value:""}]}),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%",justifyContent:"center","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:"+ Add option"})]})}if(a==="array"){const t=((r=d.itemSchema)==null?void 0:r.itemType)??"text",p=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object"}];return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Each item is itself an array. Configure the type of items inside the nested array."}),e.jsx("label",{style:{fontSize:oe.sm,fontWeight:600,color:L.textMuted,display:"block",marginBottom:3},children:"Nested item type"}),e.jsx("select",{style:{...G,padding:"6px 10px",cursor:"pointer"},value:t,onChange:i=>s({...l,itemSchema:{...d.itemSchema??{},itemType:i.target.value}}),children:p.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]})}return e.jsx(o.Box,{sx:{p:2.5},children:e.jsxs(o.Box,{sx:{border:"1.5px dashed #e2e8f0",borderRadius:"8px",py:3,textAlign:"center"},children:[e.jsxs(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:["No extra configuration needed for ",e.jsx("strong",{children:a})," items."]}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#cbd5e1",mt:.5},children:"Item placeholder and labels are set in the previous step."})]})})}return null}function je({field:l}){var p;const[s,d]=h.useState({}),a=l.id??l.name??"preview",r=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}],t=l.colSpan&&l.colSpan<12?((p=r.find(i=>i.value===l.colSpan))==null?void 0:p.label)??l.colSpan:"Full";return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:2,px:1.25,py:.75,bgcolor:"#f0fdf4",border:"1px solid #bbf7d0",borderRadius:"7px"},children:[e.jsx(o.Typography,{sx:{fontSize:11,color:"#15803d",fontWeight:500,flex:1},children:"Live preview — interact to test the field"}),e.jsxs(o.Typography,{sx:{fontSize:11,color:"#64748b"},children:["Width: ",t]})]}),e.jsx(N.FlowForm,{schema:{layout:"flat",fields:[l]},initialValues:{[a]:l.type==="array"?[]:l.type==="object"||l.type==="schema"?{}:""},onSubmit:()=>{},conditionConfig:s,onConditionConfigChange:d})]})}function J({open:l,initial:s,onSave:d,onClose:a,editMode:r=!1}){const[t,p]=h.useState(1),[i,c]=h.useState(()=>s??X());function m(){c(s??X()),p(1)}const y=be(i),B=y?3:2,x=y?["Configure",me(i),"Preview"]:["Configure","Preview"],n=!!(i.id||i.name)&&!!i.type;function f(){p(k=>Math.min(k+1,B))}function u(){p(k=>Math.max(k-1,1))}function v(){d(i),a()}const g=t-1,w=t===B,T=y&&t===3||!y&&t===2;return e.jsxs(o.Dialog,{open:l,onClose:a,TransitionProps:{onEnter:m},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"90vh"}},children:[e.jsxs(o.Box,{sx:{px:2.5,pt:1.75,pb:0,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:1.5},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a",flex:1},children:r?"Edit Field":"Add Field"}),e.jsx(o.IconButton,{size:"small",onClick:a,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})]}),e.jsx(o.Stepper,{activeStep:g,sx:{pb:1.5},children:x.map((k,R)=>e.jsx(o.Step,{completed:g>R,children:e.jsx(o.StepLabel,{children:k})},k))})]}),e.jsxs(o.Box,{sx:{flex:1,overflowY:"auto"},children:[t===1&&e.jsx(le,{field:i,onChange:c,onSave:f,onCancel:a,noFooter:!0}),t===2&&y&&e.jsx(ge,{field:i,onChange:c}),T&&e.jsx(je,{field:i})]}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[t>1&&e.jsxs(o.Box,{component:"button",onClick:u,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:500,color:"#6c757d",px:0,"&:hover":{color:"#0f172a"}},children:[e.jsx(S.MdArrowBack,{size:14})," Back"]}),e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),w?e.jsxs(o.Box,{component:"button",onClick:v,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," ",r?"Save changes":"Add field"]}):e.jsx(o.Box,{component:"button",onClick:f,disabled:!n,sx:{border:"none",cursor:n?"pointer":"not-allowed",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:n?"#6366f1":"#c7d2fe",color:"#fff","&:hover":{bgcolor:n?"#4f46e5":"#c7d2fe"}},children:"Next →"})]})]})}function ye({field:l,index:s,total:d,onEdit:a,onDelete:r,onMoveUp:t,onMoveDown:p}){const i=l.label||l.id||l.name||"Untitled",c=l.id??l.name??"";return e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff"},children:[e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.25,color:"#cbd5e1"},children:[e.jsx(o.Box,{component:"button",onClick:t,disabled:s===0,sx:{background:"none",border:"none",p:0,cursor:s===0?"default":"pointer",color:s===0?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:s===0?"#e2e8f0":"#475569"}},children:"▲"}),e.jsx(o.Box,{component:"button",onClick:p,disabled:s===d-1,sx:{background:"none",border:"none",p:0,cursor:s===d-1?"default":"pointer",color:s===d-1?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:s===d-1?"#e2e8f0":"#475569"}},children:"▼"})]}),e.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:"#eef2ff",color:"#6366f1",flexShrink:0},children:l.type}),e.jsxs(o.Box,{sx:{flex:1,minWidth:0},children:[e.jsxs(o.Typography,{sx:{fontSize:13,fontWeight:600,color:"#0f172a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[i,l.required&&e.jsx(o.Box,{component:"span",sx:{color:"#dc3545",ml:.25},children:"*"})]}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8",fontFamily:"monospace"},children:c})]}),e.jsx(o.Tooltip,{title:"Edit field",placement:"top",children:e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#f1f5f9",color:"#475569"}},children:e.jsx(S.MdEdit,{size:14})})}),e.jsx(o.Tooltip,{title:"Remove field",placement:"top",children:e.jsx(o.Box,{component:"button",onClick:r,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#fee2e2",color:"#dc2626"}},children:e.jsx(S.MdDeleteOutline,{size:16})})})]})}function ve({open:l,value:s,onSave:d,onClose:a}){const[r,t]=h.useState(s),[p,i]=h.useState(null);function c(){t(s),i(null)}function m(f){t(u=>u.filter((v,g)=>g!==f))}function y(f,u){t(v=>{const g=[...v],w=f+u;return w<0||w>=g.length?v:([g[f],g[w]]=[g[w],g[f]],g)})}function B(f){p!==null&&(t(u=>{const v=[...u];return v[p]=f,v}),i(null))}function x(){d(r),a()}const n=JSON.stringify(r)!==JSON.stringify(s);return e.jsxs(e.Fragment,{children:[e.jsxs(o.Dialog,{open:l,onClose:a,TransitionProps:{onEnter:c},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"85vh"}},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2.5,py:1.75,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[e.jsxs(o.Box,{sx:{flex:1},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:"Edit Schema"}),e.jsxs(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:[r.length," field",r.length!==1?"s":""," defined"]})]}),e.jsx(o.IconButton,{size:"small",onClick:a,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})]}),e.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:r.length===0?e.jsx(o.Box,{sx:{border:"1.5px dashed rgba(0,0,0,0.12)",borderRadius:"8px",py:4,textAlign:"center"},children:e.jsx(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:"No fields defined yet"})}):e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.75},children:r.map((f,u)=>e.jsx(ye,{field:f,index:u,total:r.length,onEdit:()=>i(u),onDelete:()=>m(u),onMoveUp:()=>y(u,-1),onMoveDown:()=>y(u,1)},`${f.id??f.name}-${u}`))})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[n?e.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:x,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Done"]})]})]}),p!==null&&e.jsx(J,{open:p!==null,initial:r[p],onSave:B,onClose:()=>i(null),editMode:!0})]})}function se(l){const s={};for(const d of l){const a=d.id??d.name??"";a&&(d.type==="array"?s[a]=[]:d.type==="object"||d.type==="schema"?s[a]=se(d.children??[]):s[a]="")}return s}function W({value:l,onChange:s,suggestions:d,label:a="Fields",onPayload:r,validate:t=!0,onValidityChange:p,variableGroups:i,initialValues:c,initialFormulaConfig:m,initialConditionConfig:y}){const[B,x]=h.useState(!1),[n,f]=h.useState(!1),[u,v]=h.useState(null),[g,w]=h.useState(m??{}),[T,k]=h.useState(y??{}),R=h.useRef(c??{}),A=h.useMemo(()=>se(l),[l]),$=h.useMemo(()=>c&&Object.keys(c).length>0?{...A,...c}:A,[A,c]),M=h.useMemo(()=>t?N.buildValidationSchema(l):void 0,[t,l]);h.useEffect(()=>{r&&r({schema:l,formulaConfig:g,conditionConfig:T,conditionExpressions:N.serializeConditionExpressions(T),values:R.current,evaluationPayload:N.buildEvaluationPayload({values:R.current,conditionConfig:T})})},[T,g,l]);const V=h.useCallback(z=>{R.current=z,r&&r({schema:l,formulaConfig:g,conditionConfig:T,conditionExpressions:N.serializeConditionExpressions(T),values:z,evaluationPayload:N.buildEvaluationPayload({values:z,conditionConfig:T})})},[l,g,T,r]);function P(z){s([...l,z])}function q(z){if(!u)return;const{containerFieldId:D,tabId:H}=u,U=l.map(I=>{if((I.id??I.name)!==D)return I;const Y=I.tabs??[];return{...I,tabs:Y.map(O=>O.id===H?{...O,fields:[...O.fields??[],z]}:O)}});s(U),v(null)}function C(z,D,H){const U=l.map(I=>{if((I.id??I.name)!==z)return I;const Y=I.tabs??[];return{...I,tabs:Y.map(O=>O.id===D?{...O,fields:(O.fields??[]).filter((Be,te)=>te!==H)}:O)}});s(U)}const ne=h.useMemo(()=>({openAddFieldDialog:(z,D)=>v({containerFieldId:z,tabId:D}),removeFieldFromTab:C}),[l,s]),K=e.jsxs("div",{className:"schema-builder-root",children:[l.length>0&&e.jsx("div",{className:"schema-builder-header",children:e.jsxs("div",{className:"schema-builder-actions",children:[e.jsx(o.Tooltip,{title:"Edit schema",placement:"top",children:e.jsxs("button",{className:"sb-btn sb-btn-outline",onClick:()=>f(!0),children:[e.jsx(S.MdSettings,{size:13})," Edit Schema"]})}),e.jsx(o.Tooltip,{title:"Add a new field",placement:"top",children:e.jsxs("button",{className:"sb-btn sb-btn-primary",onClick:()=>x(!0),children:[e.jsx(S.MdAdd,{size:14})," Add Field"]})})]})}),l.length>0?e.jsx(N.TabsEditContext.Provider,{value:ne,children:e.jsx(N.FlowForm,{schema:{layout:"flat",fields:l},initialValues:$,onSubmit:()=>{},validationSchema:M,onValidityChange:p,onValuesChange:r?V:void 0,formulaConfig:g,onFormulaConfigChange:w,conditionConfig:T,onConditionConfigChange:k})}):e.jsxs("div",{className:"schema-builder-empty-state",children:[e.jsx(ie.FaWpforms,{size:40,className:"schema-builder-empty-icon"}),e.jsx("p",{className:"schema-builder-empty-title",children:"Tell us what fields should be in the list, and assign values to them."}),e.jsx("div",{className:"schema-builder-empty-actions",children:e.jsx("button",{className:"btn",onClick:()=>x(!0),children:"Add field"})})]}),e.jsx(J,{open:B,onSave:P,onClose:()=>x(!1)}),e.jsx(ve,{open:n,value:l,onSave:s,onClose:()=>f(!1)}),e.jsx(J,{open:!!u,onSave:q,onClose:()=>v(null)})]});return i?e.jsxs(N.VariablePickerProvider,{groups:i,children:[e.jsx(N.VariablePicker,{width:260,mode:"popover"}),K]}):K}function Ce({fields:l,onOpen:s}){return e.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff",overflow:"hidden"},children:[l.length>0?e.jsx(o.Box,{sx:{px:1.5,py:1.25,display:"flex",flexWrap:"wrap",gap:.5},children:l.map((d,a)=>{const r=d.id??d.name??"";return e.jsx(o.Tooltip,{title:`${d.type} · ${r}`,placement:"top",children:e.jsx(o.Chip,{label:d.label||r,size:"small",sx:{fontSize:11,fontWeight:500,height:22,bgcolor:"#f1f5f9",color:"#334155",border:"1px solid #e2e8f0","& .MuiChip-label":{px:1}}})},a)})}):e.jsx(o.Box,{sx:{px:1.5,py:1.5},children:e.jsx(o.Typography,{sx:{fontSize:12,color:"#94a3b8"},children:"No fields defined yet"})}),e.jsx(o.Divider,{sx:{borderColor:"#f1f5f9"}}),e.jsxs(o.Box,{onClick:s,sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1,cursor:"pointer","&:hover":{bgcolor:"#f8fafc"},transition:"background 0.12s"},children:[l.length===0?e.jsx(S.MdAdd,{size:14,color:"#6366f1"}):e.jsx(S.MdSettings,{size:13,color:"#6366f1"}),e.jsx(o.Typography,{sx:{fontSize:12,fontWeight:600,color:"#6366f1",flex:1},children:l.length===0?"Add fields":"Configure fields"}),e.jsx(S.MdArrowForward,{size:13,color:"#94a3b8"})]})]})}function Se({value:l,onChange:s,suggestions:d,onPayload:a,onDone:r,validate:t,onValidityChange:p,label:i="Fields",drawerTitle:c="Configure Fields",drawerWidth:m=580}){const[y,B]=h.useState(!1),[x,n]=h.useState({type:"list"}),[f,u]=h.useState(l),v=h.useRef(null),g=h.useRef(void 0),w=h.useRef(void 0),T=h.useRef(void 0),[k,R]=h.useState(null);function A(){u(l),n({type:"list"}),B(!0)}function $(){const C=v.current;C&&(g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig),s(f),B(!1),r==null||r(f,C)}function M(){const C=v.current;C&&(g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig),u(l),B(!1)}function V(){if(x.type!=="edit"||!k)return;const C=[...f];C[x.index]=k,u(C),n({type:"list"}),R(null)}function P(){n({type:"list"}),R(null)}const q=JSON.stringify(f)!==JSON.stringify(l);return x.type==="edit"&&f[x.index],e.jsxs(e.Fragment,{children:[e.jsxs(o.Box,{children:[e.jsx(o.Typography,{sx:{fontSize:12,fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:.5,mb:.75},children:i}),e.jsx(Ce,{fields:l,onOpen:A})]}),e.jsxs(o.Drawer,{anchor:"right",open:y,onClose:M,PaperProps:{sx:{width:m,display:"flex",flexDirection:"column",boxShadow:"-4px 0 24px rgba(0,0,0,0.12)",overflow:"hidden"}},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2,py:1.5,borderBottom:"1px solid #e2e8f0",flexShrink:0,gap:1},children:[x.type==="edit"&&e.jsx(o.Tooltip,{title:"Back to fields",placement:"bottom",children:e.jsx(o.IconButton,{size:"small",onClick:P,sx:{color:"#64748b"},children:e.jsx(S.MdArrowBack,{size:17})})}),e.jsxs(o.Box,{sx:{flex:1},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:x.type==="edit"?(k==null?void 0:k.label)||(k==null?void 0:k.id)||"Edit field":c}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:x.type==="edit"?"Configure field properties":`${f.length} field${f.length!==1?"s":""} defined`})]}),x.type==="list"&&e.jsx(o.Tooltip,{title:"Close",placement:"bottom",children:e.jsx(o.IconButton,{size:"small",onClick:M,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})})]}),x.type==="list"&&e.jsxs(e.Fragment,{children:[e.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:e.jsx(W,{value:f,onChange:u,suggestions:d,onPayload:C=>{v.current=C,g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig,a==null||a(C)},validate:t,onValidityChange:p,label:i,initialValues:g.current,initialFormulaConfig:w.current,initialConditionConfig:T.current})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[q?e.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:M,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:$,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Done"]})]})]}),x.type==="edit"&&k&&e.jsx(le,{field:k,onChange:R,onSave:V,onCancel:P})]})]})}exports.FIELD_TYPE_OPTIONS=Z;exports.SchemaBuilder=W;exports.SchemaBuilderDrawer=Se;exports.useFlowForm=ae;
1
+ "use strict";const h=require("react"),re=require("formik"),N=require("./index-CdqkWMbb.js"),e=require("react/jsx-runtime"),o=require("@mui/material"),S=require("react-icons/md"),ie=require("react-icons/fa6");function ae({schema:l,initialValues:s,onSubmit:d,showErrorsImmediately:a=!1}){const r=l.fields??[],t=h.useMemo(()=>N.buildValidationSchema(r),[r]),p=h.useMemo(()=>{if(a)return r.reduce((u,v)=>{const g=N.resolveFieldKey(v);return g&&(u[g]=!0),u},{})},[r,a]),[i,c]=h.useState({}),[m,y]=h.useState({}),B=h.useRef(s);h.useEffect(()=>{B.current!==s&&(B.current=s,c({}),y({}))},[s]);const x=re.useFormik({initialValues:s,validationSchema:t,initialTouched:p,validateOnMount:a,validateOnChange:!0,validateOnBlur:!0,enableReinitialize:!0,onSubmit:async u=>{const v=N.buildEvaluationPayload({values:u,conditionConfig:m});await d(u,v)}}),n=h.useCallback(()=>{x.submitForm()},[x]),f=h.useCallback(u=>{x.resetForm(u?{values:u}:void 0),c({}),y({})},[x]);return{values:x.values,errors:x.errors,isValid:x.isValid,isDirty:x.dirty,isSubmitting:x.isSubmitting,formulaConfig:i,conditionConfig:m,submit:n,reset:f,setFieldValue:x.setFieldValue,_schema:l,_formik:x,_formulaConfig:i,_onFormulaConfigChange:c,_conditionConfig:m,_onConditionConfigChange:y}}const Z=N.FlowForgeRegistry.getTypeOptions(),j="form-control font-14",b="text-14 text-dark fw-medium mb-1 align-items-center d-flex gap-1",F={fontSize:10,fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:.6,marginBottom:8,display:"block"},ce=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object (sub-fields)"},{value:"array",label:"Array (nested)"}],de=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}];function xe({value:l,onChange:s}){const d=l??12;return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:"Column width"}),e.jsx(o.Box,{sx:{display:"flex",gap:.5},children:de.map(a=>e.jsx(o.Tooltip,{title:`colSpan: ${a.value}`,placement:"top",children:e.jsx(o.Box,{component:"button",onClick:()=>s(a.value),sx:{flex:1,border:"1px solid",borderColor:d===a.value?"#6366f1":"#dee2e6",borderRadius:"6px",cursor:"pointer",bgcolor:d===a.value?"#eef2ff":"#fff",color:d===a.value?"#6366f1":"#6c757d",fontSize:11,fontWeight:600,py:.6,px:0,"&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:a.label})},a.value))}),e.jsx(o.Box,{sx:{display:"flex",gap:"3px",mt:.75},children:Array.from({length:12}).map((a,r)=>e.jsx(o.Box,{sx:{flex:1,height:4,borderRadius:"2px",bgcolor:r<d?"#6366f1":"#e2e8f0",transition:"background 0.12s"}},r))})]})}function Q({options:l=[],onChange:s}){function d(a,r,t){s(l.map((p,i)=>i===a?{...p,[r]:t}:p))}return e.jsxs(o.Box,{children:[e.jsxs("span",{className:b,children:["Options ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:l.map((a,r)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{className:j,style:{flex:1},placeholder:"Label",value:a.label,onChange:t=>d(r,"label",t.target.value)}),e.jsx("input",{className:j,style:{flex:1},placeholder:"Value",value:a.value,onChange:t=>d(r,"value",t.target.value)}),e.jsx(o.Box,{component:"button",onClick:()=>s(l.filter((t,p)=>p!==r)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]},r))}),e.jsxs(o.Box,{component:"button",onClick:()=>s([...l,{label:"",value:""}]),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[e.jsx(S.MdAdd,{size:13})," Add option"]})]})}const ee=[{value:"operator",label:"Operator (predefined)"},{value:"select",label:"Select"},{value:"text",label:"Text"}];function pe({col:l,onChange:s,onDelete:d}){const a=l.type==="select",r=l.type==="operator";return e.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"7px",p:1.25,bgcolor:"#fff",display:"flex",flexDirection:"column",gap:1},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:r?"#fef9c3":"#eef2ff",color:r?"#92400e":"#6366f1",flexShrink:0},children:r?"OPERATOR":l.type.toUpperCase()}),e.jsx(o.Box,{sx:{fontSize:12,fontWeight:600,color:"#0f172a",flex:1},children:l.label||l.id||"Unnamed"}),e.jsx(o.Box,{component:"button",onClick:d,sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Column type"}),e.jsx("select",{value:l.type,onChange:t=>s({...l,type:t.target.value,options:void 0}),className:j,style:{cursor:"pointer"},children:ee.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))})]}),e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Column key ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:`${j} ${l.id?"":"border-danger"}`,value:l.id,onChange:t=>s({...l,id:t.target.value}),placeholder:"e.g. field, operator, value"}),!l.id&&e.jsx("span",{style:{fontSize:10,color:"#dc3545"},children:"Required — used as data key"})]})]}),!r&&e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Label"}),e.jsx("input",{className:j,value:l.label??"",onChange:t=>s({...l,label:t.target.value||void 0}),placeholder:"Column label"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Placeholder"}),e.jsx("input",{className:j,value:l.placeholder??"",onChange:t=>s({...l,placeholder:t.target.value||void 0}),placeholder:"Hint…"})]})]}),a&&e.jsx(Q,{options:l.options??[],onChange:t=>s({...l,options:t})}),r&&e.jsx(o.Box,{sx:{bgcolor:"#fefce8",border:"1px solid #fef08a",borderRadius:"6px",px:1.25,py:.75},children:e.jsx(o.Box,{sx:{fontSize:11,color:"#78350f"},children:"Predefined: equals, not equals, contains, starts with, ends with, is present, is not present, greater than, less than…"})}),!r&&e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:`formula-${l.id}`,checked:!!l.formula,onChange:t=>s({...l,formula:t.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),e.jsx("label",{htmlFor:`formula-${l.id}`,className:b,style:{margin:0,cursor:"pointer"},children:"Formula input (chip editor)"})]})]})}function ue({condition:l,onChange:s}){const d=!!l;function a(){s(d?void 0:{fields:[]})}function r(i){if(!l)return;const c=i==="operator"?"operator":l.fields.filter(m=>m.type!=="operator").length===0?"field":"value";s({...l,fields:[...l.fields,{id:c,type:i}]})}function t(i,c){if(!l)return;const m=[...l.fields];m[i]=c,s({...l,fields:m})}function p(i){l&&s({...l,fields:l.fields.filter((c,m)=>m!==i)})}return e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75,mb:d?1.25:0},children:[e.jsx("input",{type:"checkbox",id:"enable-condition",checked:d,onChange:a,style:{cursor:"pointer",width:14,height:14}}),e.jsx("span",{style:{...F,margin:0,color:d?"#6366f1":"#94a3b8"},children:"Condition row"})]}),d&&l&&e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[l.fields.map((i,c)=>e.jsx(pe,{col:i,onChange:m=>t(c,m),onDelete:()=>p(c)},c)),e.jsx(o.Box,{sx:{display:"flex",gap:.5},children:ee.map(i=>e.jsxs(o.Box,{component:"button",onClick:()=>r(i.value),sx:{flex:1,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,py:.5,borderRadius:"6px",color:i.value==="operator"?"#92400e":"#6366f1","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:["+ ",i.value==="operator"?"Operator":i.label.split(" ")[0]]},i.value))}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:2,flexWrap:"wrap"},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:"allow-groups",checked:!!l.allowGroups,onChange:i=>s({...l,allowGroups:i.target.checked||void 0}),style:{cursor:"pointer",width:14,height:14}}),e.jsx("label",{htmlFor:"allow-groups",className:b,style:{margin:0,cursor:"pointer"},children:"Allow nested groups"})]}),l.allowGroups&&e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("label",{className:b,style:{margin:0},children:"Max depth"}),e.jsx("input",{type:"number",min:1,max:5,className:j,style:{width:60,textAlign:"center"},value:l.maxGroupDepth??"",onChange:i=>s({...l,maxGroupDepth:i.target.value?Number(i.target.value):void 0}),placeholder:"∞"})]})]})]})]})}function E({id:l,label:s,checked:d,onChange:a}){return e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[e.jsx("input",{type:"checkbox",id:l,checked:d,onChange:r=>a(r.target.checked),style:{cursor:"pointer",width:14,height:14,flexShrink:0}}),e.jsx("label",{htmlFor:l,className:b,style:{margin:0,cursor:"pointer"},children:s})]})}function he({views:l=[],onChange:s}){function d(r,t,p){s(l.map((i,c)=>c===r?{...i,[t]:p}:i))}function a(){const r=`tab${l.length+1}`;s([...l,{id:r,label:`Tab ${l.length+1}`}])}return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:"Views"}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:l.map((r,t)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{className:j,style:{flex:1},placeholder:"Label",value:r.label,onChange:p=>d(t,"label",p.target.value)}),e.jsx("input",{className:j,style:{flex:1},placeholder:"ID (no spaces)",value:r.id,onChange:p=>d(t,"id",p.target.value.replace(/\s/g,"_"))}),e.jsx(o.Box,{component:"button",onClick:()=>s(l.filter((p,i)=>i!==t)),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:e.jsx(S.MdClose,{size:13})})]},t))}),e.jsxs(o.Box,{component:"button",onClick:a,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:[e.jsx(S.MdAdd,{size:13})," Add view"]})]})}function _({label:l,value:s,options:d,onChange:a}){return e.jsxs(o.Box,{children:[e.jsx("span",{className:b,children:l}),e.jsx(o.Box,{sx:{display:"flex",border:"1px solid #dee2e6",borderRadius:"7px",overflow:"hidden"},children:d.map(r=>e.jsx(o.Box,{component:"button",onClick:()=>a(r.value),sx:{flex:1,border:"none",borderRight:"1px solid #dee2e6",cursor:"pointer",fontSize:12,fontWeight:600,py:.6,bgcolor:s===r.value?"#eef2ff":"#fff",color:s===r.value?"#6366f1":"#6c757d","&:last-child":{borderRight:"none"},"&:hover":{bgcolor:"#f5f3ff"}},children:r.label},r.value))})]})}function le({field:l,onChange:s,onSave:d,onCancel:a,noFooter:r}){const[t,p]=h.useState(!1),i=l.id??l.name??"",c=l,m=l.type==="select"||l.type==="descriptive-select"||l.type==="radio-group",y=N.FlowForgeRegistry.get(l.type),B=y==null?void 0:y.configSchema;function x(n,f){s({...l,[n]:f})}return e.jsxs(e.Fragment,{children:[e.jsxs(o.Box,{sx:{flex:1,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.75},children:[e.jsxs(o.Box,{children:[e.jsx("span",{style:F,children:"Required"}),e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Type"}),e.jsx("select",{value:l.type,onChange:n=>x("type",n.target.value),className:j,style:{cursor:"pointer"},children:Z.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:l.type==="tabs"?"1fr":"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Field ID ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:j,value:l.id??l.name??"",onChange:n=>x("id",n.target.value),placeholder:"e.g. email"})]}),l.type!=="tabs"&&e.jsxs(o.Box,{children:[e.jsxs("label",{className:b,children:["Label ",e.jsx("span",{style:{color:"#dc3545"},children:"*"})]}),e.jsx("input",{className:j,value:l.label??"",onChange:n=>x("label",n.target.value),placeholder:"Display label"})]})]}),l.type!=="tabs"&&e.jsx(xe,{value:l.colSpan,onChange:n=>x("colSpan",n===12?void 0:n)})]})]}),B&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx("span",{style:F,children:"Specific Settings"}),e.jsx(N.FlowForm,{schema:{layout:"flat",compact:!0,fields:B.fields},initialValues:l,onValuesChange:n=>s({...l,...n}),onSubmit:()=>{}})]}),l.type==="tabs"&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx("span",{style:F,children:"Content"}),e.jsx(he,{views:(c.tabs??[]).map(n=>({id:n.id,label:n.label})),onChange:n=>{const f=c.tabs??[],u=n.map(v=>{const g=f.find(w=>w.id===v.id);return g?{...g,...v}:{...v,fields:[]}});s({...l,tabs:u})}}),e.jsx("span",{style:{...F,marginTop:4},children:"Interaction"}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Disabled"}),e.jsx("input",{className:j,value:c.disabledExpr??"",onChange:n=>s({...l,disabledExpr:n.target.value||void 0}),placeholder:"false"})]}),e.jsx("span",{style:{...F,marginTop:4},children:"Appearance"}),e.jsx(_,{label:"Alignment",value:c.alignment??"left",options:[{value:"left",label:"|←"},{value:"center-left",label:"←|"},{value:"center",label:"|·|"},{value:"center-right",label:"|→"},{value:"right",label:"→|"}],onChange:n=>s({...l,alignment:n})}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Hidden"}),e.jsx("input",{className:j,value:c.hiddenExpr??"",onChange:n=>s({...l,hiddenExpr:n.target.value||void 0}),placeholder:"false"})]}),e.jsx(_,{label:"Variant",value:c.variant??"line",options:[{value:"pill",label:"Pill"},{value:"line",label:"Line"}],onChange:n=>s({...l,variant:n})}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Active color"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.activeColor??"#6366f1",onChange:n=>s({...l,activeColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.activeColor??"",onChange:n=>s({...l,activeColor:n.target.value||void 0}),placeholder:"#6366f1",style:{flex:1}})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Active text"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.activeTextColor??"#ffffff",onChange:n=>s({...l,activeTextColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.activeTextColor??"",onChange:n=>s({...l,activeTextColor:n.target.value||void 0}),placeholder:"auto",style:{flex:1}})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Inactive text"}),e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx("input",{type:"color",value:c.inactiveTextColor??"#64748b",onChange:n=>s({...l,inactiveTextColor:n.target.value}),style:{width:28,height:28,border:"1px solid #dee2e6",borderRadius:6,cursor:"pointer",padding:2,background:"#fff"}}),e.jsx("input",{className:j,value:c.inactiveTextColor??"",onChange:n=>s({...l,inactiveTextColor:n.target.value||void 0}),placeholder:"#64748b",style:{flex:1}})]})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Styles"}),e.jsx("input",{className:j,value:c.styles??"",onChange:n=>s({...l,styles:n.target.value||void 0}),placeholder:"None"})]}),e.jsx("span",{style:{...F,marginTop:4},children:"Spacing"}),e.jsx(_,{label:"Height",value:c.height??"auto",options:[{value:"auto",label:"Auto"},{value:"fixed",label:"Fixed"}],onChange:n=>s({...l,height:n})}),e.jsx(_,{label:"Margin",value:c.margin??"normal",options:[{value:"normal",label:"Normal"},{value:"none",label:"None"}],onChange:n=>s({...l,margin:n})})]}),m&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx("span",{style:F,children:"Options"}),e.jsx(Q,{options:c.options??[],onChange:n=>s({...l,options:n})})]}),l.type==="array"&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{style:F,children:"Array settings"}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item type"}),e.jsx("select",{className:j,style:{cursor:"pointer"},value:c.itemType??"text",onChange:n=>s({...l,itemType:n.target.value}),children:ce.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item label"}),e.jsx("input",{className:j,value:c.itemLabel??"",onChange:n=>s({...l,itemLabel:n.target.value||void 0}),placeholder:'e.g. "Member"'})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Add button label"}),e.jsx("input",{className:j,value:c.addLabel??"",onChange:n=>s({...l,addLabel:n.target.value||void 0}),placeholder:"Add item"})]})]}),e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Min items"}),e.jsx("input",{type:"number",min:0,className:j,value:c.minItems??"",onChange:n=>s({...l,minItems:n.target.value?Number(n.target.value):void 0}),placeholder:"0"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Max items"}),e.jsx("input",{type:"number",min:1,className:j,value:c.maxItems??"",onChange:n=>s({...l,maxItems:n.target.value?Number(n.target.value):void 0}),placeholder:"∞"})]})]}),!["object","array","select"].includes(c.itemType??"text")&&e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Item placeholder"}),e.jsx("input",{className:j,value:c.itemPlaceholder??"",onChange:n=>s({...l,itemPlaceholder:n.target.value||void 0}),placeholder:"Enter value…"})]})]}),e.jsx(ue,{condition:l.condition,onChange:n=>s({...l,condition:n})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",pt:1.5},children:[e.jsx(o.Box,{component:"button",onClick:()=>p(n=>!n),sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:.5,p:0,mb:t?1.25:0},children:e.jsxs("span",{style:{...F,margin:0,color:t?"#6366f1":"#94a3b8"},children:[t?"▾":"▸"," Optional settings"]})}),e.jsx(o.Collapse,{in:t,children:e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[e.jsxs(o.Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Placeholder"}),e.jsx("input",{className:j,value:l.placeholder??"",onChange:n=>x("placeholder",n.target.value||void 0),placeholder:"Hint text…"})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Helper text"}),e.jsx("input",{className:j,value:l.helperText??"",onChange:n=>x("helperText",n.target.value||void 0),placeholder:"Description…"})]})]}),e.jsxs(o.Box,{children:[e.jsx("label",{className:b,children:"Info tooltip"}),e.jsx("input",{className:j,value:l.info??"",onChange:n=>x("info",n.target.value||void 0),placeholder:"Shown in ℹ tooltip"})]}),e.jsxs(o.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1.5},children:[e.jsx(E,{id:`${i}-req`,label:"Required",checked:!!l.required,onChange:n=>x("required",n||void 0)}),e.jsx(E,{id:`${i}-dis`,label:"Disabled",checked:!!l.disabled,onChange:n=>x("disabled",n||void 0)}),e.jsx(E,{id:`${i}-hid`,label:"Hidden",checked:!!l.hidden,onChange:n=>x("hidden",n||void 0)}),e.jsx(E,{id:`${i}-opt`,label:"Show optional",checked:!!l.showOptional,onChange:n=>x("showOptional",n||void 0)}),e.jsx(E,{id:`${i}-div`,label:"Divider after",checked:!!l.dividerAfter,onChange:n=>x("dividerAfter",n||void 0)}),e.jsx(E,{id:`${i}-frm`,label:"Formula input",checked:!!l.formula,onChange:n=>x("formula",n||void 0)})]})]})})]})]}),!r&&e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",gap:1,justifyContent:"flex-end",bgcolor:"#f8fafc",flexShrink:0},children:[e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:d,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Save"]})]})]})}const L={text:"#0f172a",textMuted:"#64748b",borderInput:"rgba(0,0,0,0.23)",bg:"#ffffff"},fe={md:"6px"},oe={sm:11,md:13},G={width:"100%",fontSize:oe.md,fontFamily:"inherit",padding:"8px 12px",border:`1px solid ${L.borderInput}`,borderRadius:fe.md,outline:"none",background:L.bg,color:L.text,boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s"};function X(){return{type:"text",id:"",label:"",colSpan:12}}function be(l){return l.type==="object"||l.type==="array"||l.type==="schema"}function me(l){if(l.type==="object")return"Child Fields";if(l.type==="schema")return"Schema Fields";const s=l.itemType??"text";return s==="object"?"Item Fields":s==="select"?"Item Options":"Item Config"}function ge({field:l,onChange:s}){var r;const d=l,a=d.itemType??"text";if(l.type==="object")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields nested inside this object. Each child field can itself be an object or array."}),e.jsx(W,{value:l.children??[],onChange:t=>s({...l,children:t}),label:"Child fields"})]});if(l.type==="schema")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields inside this schema. When the form is filled, their values are collected into a single object as this field's value."}),e.jsx(W,{value:l.children??[],onChange:t=>s({...l,children:t}),label:"Schema fields"})]});if(l.type==="array"){if(a==="object")return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Define the fields for each item in the array. Each item will be an object with these fields."}),e.jsx(W,{value:d.itemFields??[],onChange:t=>s({...l,itemFields:t}),label:"Item fields"})]});if(a==="select"){const t=d.itemOptions??[];return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Options available in each select item."}),e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,mb:.75},children:t.map((p,i)=>e.jsxs(o.Box,{sx:{display:"flex",gap:.5,alignItems:"center"},children:[e.jsx("input",{style:{...G,flex:1,padding:"6px 10px"},placeholder:"Label",value:p.label,onChange:c=>{const m=t.map((y,B)=>B===i?{...y,label:c.target.value}:y);s({...l,itemOptions:m})}}),e.jsx("input",{style:{...G,flex:1,padding:"6px 10px"},placeholder:"Value",value:p.value,onChange:c=>{const m=t.map((y,B)=>B===i?{...y,value:c.target.value}:y);s({...l,itemOptions:m})}}),e.jsx(o.Box,{component:"button",onClick:()=>s({...l,itemOptions:t.filter((c,m)=>m!==i)}),sx:{background:"none",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",p:.25,"&:hover":{color:"#dc2626"}},children:"✕"})]},i))}),e.jsx(o.Box,{component:"button",onClick:()=>s({...l,itemOptions:[...t,{label:"",value:""}]}),sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"1px dashed #dee2e6",cursor:"pointer",fontSize:11,fontWeight:600,px:1,py:.5,borderRadius:"6px",color:"#6366f1",width:"100%",justifyContent:"center","&:hover":{borderColor:"#6366f1",bgcolor:"#f5f3ff"}},children:"+ Add option"})]})}if(a==="array"){const t=((r=d.itemSchema)==null?void 0:r.itemType)??"text",p=[{value:"text",label:"Text"},{value:"number",label:"Number"},{value:"email",label:"Email"},{value:"url",label:"URL"},{value:"password",label:"Password"},{value:"select",label:"Select"},{value:"object",label:"Object"}];return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsx(o.Typography,{sx:{fontSize:12,color:"#64748b",mb:2},children:"Each item is itself an array. Configure the type of items inside the nested array."}),e.jsx("label",{style:{fontSize:oe.sm,fontWeight:600,color:L.textMuted,display:"block",marginBottom:3},children:"Nested item type"}),e.jsx("select",{style:{...G,padding:"6px 10px",cursor:"pointer"},value:t,onChange:i=>s({...l,itemSchema:{...d.itemSchema??{},itemType:i.target.value}}),children:p.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]})}return e.jsx(o.Box,{sx:{p:2.5},children:e.jsxs(o.Box,{sx:{border:"1.5px dashed #e2e8f0",borderRadius:"8px",py:3,textAlign:"center"},children:[e.jsxs(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:["No extra configuration needed for ",e.jsx("strong",{children:a})," items."]}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#cbd5e1",mt:.5},children:"Item placeholder and labels are set in the previous step."})]})})}return null}function je({field:l}){var p;const[s,d]=h.useState({}),a=l.id??l.name??"preview",r=[{value:3,label:"1/4"},{value:4,label:"1/3"},{value:6,label:"1/2"},{value:8,label:"2/3"},{value:12,label:"Full"}],t=l.colSpan&&l.colSpan<12?((p=r.find(i=>i.value===l.colSpan))==null?void 0:p.label)??l.colSpan:"Full";return e.jsxs(o.Box,{sx:{p:2.5},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:2,px:1.25,py:.75,bgcolor:"#f0fdf4",border:"1px solid #bbf7d0",borderRadius:"7px"},children:[e.jsx(o.Typography,{sx:{fontSize:11,color:"#15803d",fontWeight:500,flex:1},children:"Live preview — interact to test the field"}),e.jsxs(o.Typography,{sx:{fontSize:11,color:"#64748b"},children:["Width: ",t]})]}),e.jsx(N.FlowForm,{schema:{layout:"flat",fields:[l]},initialValues:{[a]:l.type==="array"?[]:l.type==="object"||l.type==="schema"?{}:""},onSubmit:()=>{},conditionConfig:s,onConditionConfigChange:d})]})}function J({open:l,initial:s,onSave:d,onClose:a,editMode:r=!1}){const[t,p]=h.useState(1),[i,c]=h.useState(()=>s??X());function m(){c(s??X()),p(1)}const y=be(i),B=y?3:2,x=y?["Configure",me(i),"Preview"]:["Configure","Preview"],n=!!(i.id||i.name)&&!!i.type;function f(){p(k=>Math.min(k+1,B))}function u(){p(k=>Math.max(k-1,1))}function v(){d(i),a()}const g=t-1,w=t===B,T=y&&t===3||!y&&t===2;return e.jsxs(o.Dialog,{open:l,onClose:a,TransitionProps:{onEnter:m},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"90vh"}},children:[e.jsxs(o.Box,{sx:{px:2.5,pt:1.75,pb:0,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",mb:1.5},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a",flex:1},children:r?"Edit Field":"Add Field"}),e.jsx(o.IconButton,{size:"small",onClick:a,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})]}),e.jsx(o.Stepper,{activeStep:g,sx:{pb:1.5},children:x.map((k,R)=>e.jsx(o.Step,{completed:g>R,children:e.jsx(o.StepLabel,{children:k})},k))})]}),e.jsxs(o.Box,{sx:{flex:1,overflowY:"auto"},children:[t===1&&e.jsx(le,{field:i,onChange:c,onSave:f,onCancel:a,noFooter:!0}),t===2&&y&&e.jsx(ge,{field:i,onChange:c}),T&&e.jsx(je,{field:i})]}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[t>1&&e.jsxs(o.Box,{component:"button",onClick:u,sx:{display:"flex",alignItems:"center",gap:.5,background:"none",border:"none",cursor:"pointer",fontSize:13,fontWeight:500,color:"#6c757d",px:0,"&:hover":{color:"#0f172a"}},children:[e.jsx(S.MdArrowBack,{size:14})," Back"]}),e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),w?e.jsxs(o.Box,{component:"button",onClick:v,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," ",r?"Save changes":"Add field"]}):e.jsx(o.Box,{component:"button",onClick:f,disabled:!n,sx:{border:"none",cursor:n?"pointer":"not-allowed",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:n?"#6366f1":"#c7d2fe",color:"#fff","&:hover":{bgcolor:n?"#4f46e5":"#c7d2fe"}},children:"Next →"})]})]})}function ye({field:l,index:s,total:d,onEdit:a,onDelete:r,onMoveUp:t,onMoveDown:p}){const i=l.label||l.id||l.name||"Untitled",c=l.id??l.name??"";return e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.5,py:1,border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff"},children:[e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.25,color:"#cbd5e1"},children:[e.jsx(o.Box,{component:"button",onClick:t,disabled:s===0,sx:{background:"none",border:"none",p:0,cursor:s===0?"default":"pointer",color:s===0?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:s===0?"#e2e8f0":"#475569"}},children:"▲"}),e.jsx(o.Box,{component:"button",onClick:p,disabled:s===d-1,sx:{background:"none",border:"none",p:0,cursor:s===d-1?"default":"pointer",color:s===d-1?"#e2e8f0":"#94a3b8",lineHeight:1,fontSize:10,"&:hover":{color:s===d-1?"#e2e8f0":"#475569"}},children:"▼"})]}),e.jsx(o.Box,{sx:{fontSize:10,fontWeight:700,px:.75,py:.2,borderRadius:"4px",bgcolor:"#eef2ff",color:"#6366f1",flexShrink:0},children:l.type}),e.jsxs(o.Box,{sx:{flex:1,minWidth:0},children:[e.jsxs(o.Typography,{sx:{fontSize:13,fontWeight:600,color:"#0f172a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[i,l.required&&e.jsx(o.Box,{component:"span",sx:{color:"#dc3545",ml:.25},children:"*"})]}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8",fontFamily:"monospace"},children:c})]}),e.jsx(o.Tooltip,{title:"Edit field",placement:"top",children:e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#f1f5f9",color:"#475569"}},children:e.jsx(S.MdEdit,{size:14})})}),e.jsx(o.Tooltip,{title:"Remove field",placement:"top",children:e.jsx(o.Box,{component:"button",onClick:r,sx:{background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"6px",p:0,color:"#94a3b8","&:hover":{bgcolor:"#fee2e2",color:"#dc2626"}},children:e.jsx(S.MdDeleteOutline,{size:16})})})]})}function ve({open:l,value:s,onSave:d,onClose:a}){const[r,t]=h.useState(s),[p,i]=h.useState(null);function c(){t(s),i(null)}function m(f){t(u=>u.filter((v,g)=>g!==f))}function y(f,u){t(v=>{const g=[...v],w=f+u;return w<0||w>=g.length?v:([g[f],g[w]]=[g[w],g[f]],g)})}function B(f){p!==null&&(t(u=>{const v=[...u];return v[p]=f,v}),i(null))}function x(){d(r),a()}const n=JSON.stringify(r)!==JSON.stringify(s);return e.jsxs(e.Fragment,{children:[e.jsxs(o.Dialog,{open:l,onClose:a,TransitionProps:{onEnter:c},maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column",maxHeight:"85vh"}},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2.5,py:1.75,borderBottom:"1px solid #e2e8f0",flexShrink:0},children:[e.jsxs(o.Box,{sx:{flex:1},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:"Edit Schema"}),e.jsxs(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:[r.length," field",r.length!==1?"s":""," defined"]})]}),e.jsx(o.IconButton,{size:"small",onClick:a,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})]}),e.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:r.length===0?e.jsx(o.Box,{sx:{border:"1.5px dashed rgba(0,0,0,0.12)",borderRadius:"8px",py:4,textAlign:"center"},children:e.jsx(o.Typography,{sx:{fontSize:13,color:"#94a3b8"},children:"No fields defined yet"})}):e.jsx(o.Box,{sx:{display:"flex",flexDirection:"column",gap:.75},children:r.map((f,u)=>e.jsx(ye,{field:f,index:u,total:r.length,onEdit:()=>i(u),onDelete:()=>m(u),onMoveUp:()=>y(u,-1),onMoveDown:()=>y(u,1)},`${f.id??f.name}-${u}`))})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[n?e.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:a,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:x,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Done"]})]})]}),p!==null&&e.jsx(J,{open:p!==null,initial:r[p],onSave:B,onClose:()=>i(null),editMode:!0})]})}function se(l){const s={};for(const d of l){const a=d.id??d.name??"";a&&(d.type==="array"?s[a]=[]:d.type==="object"||d.type==="schema"?s[a]=se(d.children??[]):s[a]="")}return s}function W({value:l,onChange:s,suggestions:d,label:a="Fields",onPayload:r,validate:t=!0,onValidityChange:p,variableGroups:i,initialValues:c,initialFormulaConfig:m,initialConditionConfig:y}){const[B,x]=h.useState(!1),[n,f]=h.useState(!1),[u,v]=h.useState(null),[g,w]=h.useState(m??{}),[T,k]=h.useState(y??{}),R=h.useRef(c??{}),A=h.useMemo(()=>se(l),[l]),$=h.useMemo(()=>c&&Object.keys(c).length>0?{...A,...c}:A,[A,c]),M=h.useMemo(()=>t?N.buildValidationSchema(l):void 0,[t,l]);h.useEffect(()=>{r&&r({schema:l,formulaConfig:g,conditionConfig:T,conditionExpressions:N.serializeConditionExpressions(T),values:R.current,evaluationPayload:N.buildEvaluationPayload({values:R.current,conditionConfig:T})})},[T,g,l]);const V=h.useCallback(z=>{R.current=z,r&&r({schema:l,formulaConfig:g,conditionConfig:T,conditionExpressions:N.serializeConditionExpressions(T),values:z,evaluationPayload:N.buildEvaluationPayload({values:z,conditionConfig:T})})},[l,g,T,r]);function P(z){s([...l,z])}function q(z){if(!u)return;const{containerFieldId:D,tabId:H}=u,U=l.map(I=>{if((I.id??I.name)!==D)return I;const Y=I.tabs??[];return{...I,tabs:Y.map(O=>O.id===H?{...O,fields:[...O.fields??[],z]}:O)}});s(U),v(null)}function C(z,D,H){const U=l.map(I=>{if((I.id??I.name)!==z)return I;const Y=I.tabs??[];return{...I,tabs:Y.map(O=>O.id===D?{...O,fields:(O.fields??[]).filter((Be,te)=>te!==H)}:O)}});s(U)}const ne=h.useMemo(()=>({openAddFieldDialog:(z,D)=>v({containerFieldId:z,tabId:D}),removeFieldFromTab:C}),[l,s]),K=e.jsxs("div",{className:"schema-builder-root",children:[l.length>0&&e.jsx("div",{className:"schema-builder-header",children:e.jsxs("div",{className:"schema-builder-actions",children:[e.jsx(o.Tooltip,{title:"Edit schema",placement:"top",children:e.jsxs("button",{className:"sb-btn sb-btn-outline",onClick:()=>f(!0),children:[e.jsx(S.MdSettings,{size:13})," Edit Schema"]})}),e.jsx(o.Tooltip,{title:"Add a new field",placement:"top",children:e.jsxs("button",{className:"sb-btn sb-btn-primary",onClick:()=>x(!0),children:[e.jsx(S.MdAdd,{size:14})," Add Field"]})})]})}),l.length>0?e.jsx(N.TabsEditContext.Provider,{value:ne,children:e.jsx(N.FlowForm,{schema:{layout:"flat",fields:l},initialValues:$,onSubmit:()=>{},validationSchema:M,onValidityChange:p,onValuesChange:r?V:void 0,formulaConfig:g,onFormulaConfigChange:w,conditionConfig:T,onConditionConfigChange:k})}):e.jsxs("div",{className:"schema-builder-empty-state",children:[e.jsx(ie.FaWpforms,{size:40,className:"schema-builder-empty-icon"}),e.jsx("p",{className:"schema-builder-empty-title",children:"Tell us what fields should be in the list, and assign values to them."}),e.jsx("div",{className:"schema-builder-empty-actions",children:e.jsx("button",{className:"btn",onClick:()=>x(!0),children:"Add field"})})]}),e.jsx(J,{open:B,onSave:P,onClose:()=>x(!1)}),e.jsx(ve,{open:n,value:l,onSave:s,onClose:()=>f(!1)}),e.jsx(J,{open:!!u,onSave:q,onClose:()=>v(null)})]});return i?e.jsxs(N.VariablePickerProvider,{groups:i,children:[e.jsx(N.VariablePicker,{width:260,mode:"popover"}),K]}):K}function Ce({fields:l,onOpen:s}){return e.jsxs(o.Box,{sx:{border:"1px solid #e2e8f0",borderRadius:"8px",bgcolor:"#fff",overflow:"hidden"},children:[l.length>0?e.jsx(o.Box,{sx:{px:1.5,py:1.25,display:"flex",flexWrap:"wrap",gap:.5},children:l.map((d,a)=>{const r=d.id??d.name??"";return e.jsx(o.Tooltip,{title:`${d.type} · ${r}`,placement:"top",children:e.jsx(o.Chip,{label:d.label||r,size:"small",sx:{fontSize:11,fontWeight:500,height:22,bgcolor:"#f1f5f9",color:"#334155",border:"1px solid #e2e8f0","& .MuiChip-label":{px:1}}})},a)})}):e.jsx(o.Box,{sx:{px:1.5,py:1.5},children:e.jsx(o.Typography,{sx:{fontSize:12,color:"#94a3b8"},children:"No fields defined yet"})}),e.jsx(o.Divider,{sx:{borderColor:"#f1f5f9"}}),e.jsxs(o.Box,{onClick:s,sx:{display:"flex",alignItems:"center",gap:.75,px:1.5,py:1,cursor:"pointer","&:hover":{bgcolor:"#f8fafc"},transition:"background 0.12s"},children:[l.length===0?e.jsx(S.MdAdd,{size:14,color:"#6366f1"}):e.jsx(S.MdSettings,{size:13,color:"#6366f1"}),e.jsx(o.Typography,{sx:{fontSize:12,fontWeight:600,color:"#6366f1",flex:1},children:l.length===0?"Add fields":"Configure fields"}),e.jsx(S.MdArrowForward,{size:13,color:"#94a3b8"})]})]})}function Se({value:l,onChange:s,suggestions:d,onPayload:a,onDone:r,validate:t,onValidityChange:p,label:i="Fields",drawerTitle:c="Configure Fields",drawerWidth:m=580}){const[y,B]=h.useState(!1),[x,n]=h.useState({type:"list"}),[f,u]=h.useState(l),v=h.useRef(null),g=h.useRef(void 0),w=h.useRef(void 0),T=h.useRef(void 0),[k,R]=h.useState(null);function A(){u(l),n({type:"list"}),B(!0)}function $(){const C=v.current;C&&(g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig),s(f),B(!1),r==null||r(f,C)}function M(){const C=v.current;C&&(g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig),u(l),B(!1)}function V(){if(x.type!=="edit"||!k)return;const C=[...f];C[x.index]=k,u(C),n({type:"list"}),R(null)}function P(){n({type:"list"}),R(null)}const q=JSON.stringify(f)!==JSON.stringify(l);return x.type==="edit"&&f[x.index],e.jsxs(e.Fragment,{children:[e.jsxs(o.Box,{children:[e.jsx(o.Typography,{sx:{fontSize:12,fontWeight:700,color:"#64748b",textTransform:"uppercase",letterSpacing:.5,mb:.75},children:i}),e.jsx(Ce,{fields:l,onOpen:A})]}),e.jsxs(o.Drawer,{anchor:"right",open:y,onClose:M,PaperProps:{sx:{width:m,display:"flex",flexDirection:"column",boxShadow:"-4px 0 24px rgba(0,0,0,0.12)",overflow:"hidden"}},children:[e.jsxs(o.Box,{sx:{display:"flex",alignItems:"center",px:2,py:1.5,borderBottom:"1px solid #e2e8f0",flexShrink:0,gap:1},children:[x.type==="edit"&&e.jsx(o.Tooltip,{title:"Back to fields",placement:"bottom",children:e.jsx(o.IconButton,{size:"small",onClick:P,sx:{color:"#64748b"},children:e.jsx(S.MdArrowBack,{size:17})})}),e.jsxs(o.Box,{sx:{flex:1},children:[e.jsx(o.Typography,{sx:{fontSize:14,fontWeight:700,color:"#0f172a"},children:x.type==="edit"?(k==null?void 0:k.label)||(k==null?void 0:k.id)||"Edit field":c}),e.jsx(o.Typography,{sx:{fontSize:11,color:"#94a3b8"},children:x.type==="edit"?"Configure field properties":`${f.length} field${f.length!==1?"s":""} defined`})]}),x.type==="list"&&e.jsx(o.Tooltip,{title:"Close",placement:"bottom",children:e.jsx(o.IconButton,{size:"small",onClick:M,sx:{color:"#94a3b8"},children:e.jsx(S.MdClose,{size:17})})})]}),x.type==="list"&&e.jsxs(e.Fragment,{children:[e.jsx(o.Box,{sx:{flex:1,overflowY:"auto",p:2.5},children:e.jsx(W,{value:f,onChange:u,suggestions:d,onPayload:C=>{v.current=C,g.current=C.values,w.current=C.formulaConfig,T.current=C.conditionConfig,a==null||a(C)},validate:t,onValidityChange:p,label:i,initialValues:g.current,initialFormulaConfig:w.current,initialConditionConfig:T.current})}),e.jsxs(o.Box,{sx:{borderTop:"1px solid #e2e8f0",px:2.5,py:1.5,display:"flex",alignItems:"center",gap:1,flexShrink:0,bgcolor:"#f8fafc"},children:[q?e.jsx(o.Typography,{sx:{fontSize:11,color:"#f59e0b",fontWeight:500,flex:1},children:"Unsaved changes"}):e.jsx(o.Box,{sx:{flex:1}}),e.jsx(o.Box,{component:"button",onClick:M,sx:{background:"none",border:"1px solid #dee2e6",cursor:"pointer",fontSize:13,fontWeight:500,px:2,py:.75,borderRadius:"7px",color:"#6c757d","&:hover":{bgcolor:"#f8f9fa"}},children:"Cancel"}),e.jsxs(o.Box,{component:"button",onClick:$,sx:{border:"none",cursor:"pointer",fontSize:13,fontWeight:600,px:2.5,py:.75,borderRadius:"7px",bgcolor:"#6366f1",color:"#fff",display:"flex",alignItems:"center",gap:.75,"&:hover":{bgcolor:"#4f46e5"}},children:[e.jsx(S.MdCheck,{size:15})," Done"]})]})]}),x.type==="edit"&&k&&e.jsx(le,{field:k,onChange:R,onSave:V,onCancel:P})]})]})}exports.FIELD_TYPE_OPTIONS=Z;exports.SchemaBuilder=W;exports.SchemaBuilderDrawer=Se;exports.useFlowForm=ae;
package/dist/canvas.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./templateSkeletons-BNtzXJdi.js"),t=require("./messages-O9Tw_XXR.js"),r=require("./bpmn-CcuE2X_Q.js"),e=require("./GatewayBranchEdge-9YF32wwN.js");exports.FlowForgeCanvas=o.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=o.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=o.FlowForgeCanvas;exports.WorkflowExecutionHistory=o.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=o.WorkflowTemplateLibrary;exports.accessRequestSkeleton=o.accessRequestSkeleton;exports.offboardingSkeleton=o.offboardingSkeleton;exports.userOnboardingSkeleton=o.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=o.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=t.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=r.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=r.saveWorkflowToBpmn;exports.ActionNode=e.ActionNode;exports.ApprovalNode=e.ApprovalNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.RestApiNode=e.RestApiNode;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.WebhookTriggerNode=e.WebhookTriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./templateSkeletons-B812HjgI.js"),t=require("./messages-O9Tw_XXR.js"),r=require("./bpmn-CcuE2X_Q.js"),e=require("./GatewayBranchEdge-9YF32wwN.js");exports.FlowForgeCanvas=o.FlowForgeCanvas;exports.SubWorkflowPreviewDrawer=o.SubWorkflowPreviewDrawer;exports.WorkflowCanvas=o.FlowForgeCanvas;exports.WorkflowExecutionHistory=o.WorkflowExecutionHistory;exports.WorkflowTemplateLibrary=o.WorkflowTemplateLibrary;exports.accessRequestSkeleton=o.accessRequestSkeleton;exports.offboardingSkeleton=o.offboardingSkeleton;exports.userOnboardingSkeleton=o.userOnboardingSkeleton;exports.webhookIntegrationSkeleton=o.webhookIntegrationSkeleton;exports.defaultFlowForgeMessages=t.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=r.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=r.saveWorkflowToBpmn;exports.ActionNode=e.ActionNode;exports.ApprovalNode=e.ApprovalNode;exports.EdgeWithPlusLabel=e.EdgeWithPlusLabel;exports.EndNode=e.EndNode;exports.FilterNode=e.FilterNode;exports.RestApiNode=e.RestApiNode;exports.StartNode=e.StartNode;exports.TriggerNode=e.TriggerNode;exports.WebhookTriggerNode=e.WebhookTriggerNode;exports.builtInNodeTypes=e.builtInNodeTypes;
package/dist/canvas.js CHANGED
@@ -1,4 +1,4 @@
1
- import { F as a, S as s, F as r, W as t, a as l, b as n, o as d, u as i, w as f } from "./templateSkeletons-DpLE0ZiP.js";
1
+ import { F as a, S as s, F as r, W as t, a as l, b as n, o as d, u as i, w as f } from "./templateSkeletons-H4iJHjxv.js";
2
2
  import { d as w } from "./messages-CO299wPN.js";
3
3
  import { l as p, s as b } from "./bpmn-CtfWDaOY.js";
4
4
  import { A as F, b as N, E as m, c as u, F as S, R as T, S as c, T as v, W as x, e as A } from "./GatewayBranchEdge-Dxoy5B1A.js";
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-BrJBVztu.js"),o=require("./index-CUQQVdoY.js"),s=require("./messages-O9Tw_XXR.js"),t=require("./bpmn-CcuE2X_Q.js"),e=require("./subWorkflowDescriptor-JDKi2INh.js");exports.NodeTypeRegistry=r.NodeTypeRegistry;exports.nodeTypeRegistry=r.nodeTypeRegistry;exports.TemplateRegistry=o.TemplateRegistry;exports.templateRegistry=o.templateRegistry;exports.defaultFlowForgeMessages=s.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=t.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=t.saveWorkflowToBpmn;exports.baseNodeDefaults=e.baseNodeDefaults;exports.conditionBranchDescriptor=e.conditionBranchDescriptor;exports.defineNode=e.defineNode;exports.endEventDescriptor=e.endEventDescriptor;exports.makeSubWorkflowDescriptor=e.makeSubWorkflowDescriptor;exports.notificationDescriptor=e.notificationDescriptor;exports.restApiDescriptor=e.restApiDescriptor;exports.startEventDescriptor=e.startEventDescriptor;exports.subWorkflowDescriptor=e.subWorkflowDescriptor;exports.webhookTriggerDescriptor=e.webhookTriggerDescriptor;exports.webhookTriggerTemplate=e.webhookTriggerTemplate;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./nodeRegistry.cjs"),r=require("./templateRegistry.cjs"),t=require("./messages-O9Tw_XXR.js"),o=require("./bpmn-CcuE2X_Q.js");exports.NodeTypeRegistry=e.NodeTypeRegistry;exports.baseNodeDefaults=e.baseNodeDefaults;exports.conditionBranchDescriptor=e.conditionBranchDescriptor;exports.defineNode=e.defineNode;exports.endEventDescriptor=e.endEventDescriptor;exports.makeSubWorkflowDescriptor=e.makeSubWorkflowDescriptor;exports.nodeTypeRegistry=e.nodeTypeRegistry;exports.notificationDescriptor=e.notificationDescriptor;exports.restApiDescriptor=e.restApiDescriptor;exports.startEventDescriptor=e.startEventDescriptor;exports.subWorkflowDescriptor=e.subWorkflowDescriptor;exports.webhookTriggerDescriptor=e.webhookTriggerDescriptor;exports.webhookTriggerTemplate=e.webhookTriggerTemplate;exports.TemplateRegistry=r.TemplateRegistry;exports.templateRegistry=r.templateRegistry;exports.defaultFlowForgeMessages=t.defaultFlowForgeMessages;exports.loadWorkflowFromBpmn=o.loadWorkflowFromBpmn;exports.saveWorkflowToBpmn=o.saveWorkflowToBpmn;
package/dist/core.js CHANGED
@@ -1,25 +1,24 @@
1
- import { NodeTypeRegistry as o, nodeTypeRegistry as s } from "./index-Dcur-XJ9.js";
2
- import { TemplateRegistry as a, templateRegistry as i } from "./index-BeZylHBB.js";
3
- import { d as f } from "./messages-CO299wPN.js";
4
- import { l as n, s as c } from "./bpmn-CtfWDaOY.js";
5
- import { b as d, c as g, d as D, e as w, m as k, n as T, r as b, s as y, a as x, w as u, f as R } from "./subWorkflowDescriptor-DYOYgBzX.js";
1
+ import { NodeTypeRegistry as r, baseNodeDefaults as t, conditionBranchDescriptor as s, defineNode as i, endEventDescriptor as p, makeSubWorkflowDescriptor as a, nodeTypeRegistry as f, notificationDescriptor as l, restApiDescriptor as n, startEventDescriptor as c, subWorkflowDescriptor as m, webhookTriggerDescriptor as d, webhookTriggerTemplate as g } from "./nodeRegistry.js";
2
+ import { TemplateRegistry as k, templateRegistry as w } from "./templateRegistry.js";
3
+ import { d as y } from "./messages-CO299wPN.js";
4
+ import { l as u, s as x } from "./bpmn-CtfWDaOY.js";
6
5
  export {
7
- o as NodeTypeRegistry,
8
- a as TemplateRegistry,
9
- d as baseNodeDefaults,
10
- g as conditionBranchDescriptor,
11
- f as defaultFlowForgeMessages,
12
- D as defineNode,
13
- w as endEventDescriptor,
14
- n as loadWorkflowFromBpmn,
15
- k as makeSubWorkflowDescriptor,
16
- s as nodeTypeRegistry,
17
- T as notificationDescriptor,
18
- b as restApiDescriptor,
19
- c as saveWorkflowToBpmn,
20
- y as startEventDescriptor,
21
- x as subWorkflowDescriptor,
22
- i as templateRegistry,
23
- u as webhookTriggerDescriptor,
24
- R as webhookTriggerTemplate
6
+ r as NodeTypeRegistry,
7
+ k as TemplateRegistry,
8
+ t as baseNodeDefaults,
9
+ s as conditionBranchDescriptor,
10
+ y as defaultFlowForgeMessages,
11
+ i as defineNode,
12
+ p as endEventDescriptor,
13
+ u as loadWorkflowFromBpmn,
14
+ a as makeSubWorkflowDescriptor,
15
+ f as nodeTypeRegistry,
16
+ l as notificationDescriptor,
17
+ n as restApiDescriptor,
18
+ x as saveWorkflowToBpmn,
19
+ c as startEventDescriptor,
20
+ m as subWorkflowDescriptor,
21
+ w as templateRegistry,
22
+ d as webhookTriggerDescriptor,
23
+ g as webhookTriggerTemplate
25
24
  };
package/dist/form.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-yqsiFHGg.js"),r=require("./SchemaBuilderDrawer-D-Ib5uUe.js");require("react/jsx-runtime");require("react");require("@mui/material");require("react-icons/md");exports.DynamicFormRenderer=e.DynamicFormRenderer;exports.FF=e.FF;exports.FlowForgeRegistry=e.FlowForgeRegistry;exports.FlowForm=e.FlowForm;exports.FormulaInput=e.FormulaInput;exports.InfiniteSelectField=e.InfiniteSelectField;exports.TablePickerField=e.TablePickerField;exports.VariablePicker=e.VariablePicker;exports.VariablePickerProvider=e.VariablePickerProvider;exports.astHasRefs=e.astHasRefs;exports.astToTokens=e.astToTokens;exports.buildEvaluationPayload=e.buildEvaluationPayload;exports.buildFieldConfig=e.buildFieldConfig;exports.buildFormulaPath=e.buildFormulaPath;exports.buildSelectStyles=e.buildSelectStyles;exports.buildValidationSchema=e.buildValidationSchema;exports.errorTextStyle=e.errorTextStyle;exports.extractLabel=e.extractLabel;exports.fieldRegistry=e.fieldRegistry;exports.hasFormulaTokens=e.hasFormulaTokens;exports.helperTextStyle=e.helperTextStyle;exports.inputStyle=e.inputStyle;exports.isFormula=e.isFormula;exports.parseToAST=e.parseToAST;exports.serializeAST=e.serializeAST;exports.serializeASTAsConfig=e.serializeASTAsConfig;exports.serializeConditionExpressions=e.serializeConditionExpressions;exports.stripFormulaTokens=e.stripFormulaTokens;exports.tokenize=e.tokenize;exports.unwrapFormula=e.unwrapFormula;exports.useVariablePickerContext=e.useVariablePickerContext;exports.wrapFormula=e.wrapFormula;exports.FIELD_TYPE_OPTIONS=r.FIELD_TYPE_OPTIONS;exports.SchemaBuilder=r.SchemaBuilder;exports.SchemaBuilderDrawer=r.SchemaBuilderDrawer;exports.useFlowForm=r.useFlowForm;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CdqkWMbb.js"),r=require("./SchemaBuilderDrawer-DIcUsNDy.js");require("react/jsx-runtime");require("react");require("@mui/material");require("react-icons/md");exports.DynamicFormRenderer=e.DynamicFormRenderer;exports.FF=e.FF;exports.FlowForgeRegistry=e.FlowForgeRegistry;exports.FlowForm=e.FlowForm;exports.FormulaInput=e.FormulaInput;exports.InfiniteSelectField=e.InfiniteSelectField;exports.TablePickerField=e.TablePickerField;exports.VariablePicker=e.VariablePicker;exports.VariablePickerProvider=e.VariablePickerProvider;exports.astHasRefs=e.astHasRefs;exports.astToTokens=e.astToTokens;exports.buildEvaluationPayload=e.buildEvaluationPayload;exports.buildFieldConfig=e.buildFieldConfig;exports.buildFormulaPath=e.buildFormulaPath;exports.buildSelectStyles=e.buildSelectStyles;exports.buildValidationSchema=e.buildValidationSchema;exports.errorTextStyle=e.errorTextStyle;exports.extractLabel=e.extractLabel;exports.fieldRegistry=e.fieldRegistry;exports.hasFormulaTokens=e.hasFormulaTokens;exports.helperTextStyle=e.helperTextStyle;exports.inputStyle=e.inputStyle;exports.isFormula=e.isFormula;exports.parseToAST=e.parseToAST;exports.serializeAST=e.serializeAST;exports.serializeASTAsConfig=e.serializeASTAsConfig;exports.serializeConditionExpressions=e.serializeConditionExpressions;exports.stripFormulaTokens=e.stripFormulaTokens;exports.tokenize=e.tokenize;exports.unwrapFormula=e.unwrapFormula;exports.useVariablePickerContext=e.useVariablePickerContext;exports.wrapFormula=e.wrapFormula;exports.FIELD_TYPE_OPTIONS=r.FIELD_TYPE_OPTIONS;exports.SchemaBuilder=r.SchemaBuilder;exports.SchemaBuilderDrawer=r.SchemaBuilderDrawer;exports.useFlowForm=r.useFlowForm;
package/dist/form.d.ts CHANGED
@@ -181,7 +181,7 @@ declare interface ControlledProps extends FormulaProps {
181
181
  }
182
182
 
183
183
  /** @deprecated Use FlowForm */
184
- export declare const DynamicFormRenderer: typeof FlowForm;
184
+ export declare const DynamicFormRenderer: default_2.ForwardRefExoticComponent<FlowFormProps & default_2.RefAttributes<FlowFormHandle>>;
185
185
 
186
186
  /** @deprecated Use FlowFormProps */
187
187
  export declare type DynamicFormRendererProps = FlowFormProps;
@@ -382,7 +382,31 @@ export declare interface FlowForgeFieldDefinition {
382
382
 
383
383
  export declare const FlowForgeRegistry: Registry;
384
384
 
385
- export declare function FlowForm(props: FlowFormProps): JSX_2.Element;
385
+ export declare const FlowForm: default_2.ForwardRefExoticComponent<FlowFormProps & default_2.RefAttributes<FlowFormHandle>>;
386
+
387
+ /**
388
+ * Imperative API exposed via `ref` on `<FlowForm>`. Lets a host drive Save
389
+ * from a footer button outside the form without writing forwardRef
390
+ * boilerplate per-section. See README for the canonical pattern.
391
+ */
392
+ export declare interface FlowFormHandle {
393
+ /**
394
+ * Touch every field, validate the form, and (when valid) call `onSave`
395
+ * with the full payload. Returns `{ isValid, values, errors }` so the
396
+ * caller can also branch off the result directly.
397
+ */
398
+ save: () => Promise<SaveResult>;
399
+ /** Reset to initial values + clear touched/errors. */
400
+ reset: () => void;
401
+ /** Run validation and return errors without touching fields. */
402
+ validate: () => Promise<Record<string, unknown>>;
403
+ /** Push server-side errors back into formik state for display. */
404
+ setErrors: (errors: Record<string, unknown>) => void;
405
+ /** Read the current values. Includes the conditionConfig sidecar. */
406
+ getValues: () => Record<string, unknown>;
407
+ /** Programmatic write — useful for pre-filling on edit. */
408
+ setValues: (values: Record<string, unknown>) => void;
409
+ }
386
410
 
387
411
  export declare interface FlowFormInstance {
388
412
  values: Record<string, unknown>;
@@ -477,6 +501,24 @@ declare interface FormulaProps {
477
501
  /** Active per-field condition guards. Key = field pathPrefix. */
478
502
  conditionConfig?: ConditionConfig;
479
503
  onConditionConfigChange?: (config: ConditionConfig) => void;
504
+ /**
505
+ * Key under `formik.values` where conditionConfig is auto-roundtripped
506
+ * when the host doesn't supply explicit `conditionConfig` /
507
+ * `onConditionConfigChange`. Defaults to `_conditionConfig`.
508
+ */
509
+ conditionConfigKey?: string;
510
+ /**
511
+ * Called by `flowFormRef.current.save()` once validation passes.
512
+ * Receives the full payload (formik values incl. conditionConfig sidecar)
513
+ * + a meta object with `isValid` / `errors`.
514
+ *
515
+ * Available in controlled AND uncontrolled mode. In uncontrolled mode it
516
+ * runs in addition to `onSubmit`.
517
+ */
518
+ onSave?: (values: Record<string, unknown>, meta: {
519
+ isValid: boolean;
520
+ errors: Record<string, unknown>;
521
+ }) => void;
480
522
  }
481
523
 
482
524
  export declare type FormulaToken = TextToken | ChipToken;
@@ -598,6 +640,19 @@ declare class Registry {
598
640
  }>;
599
641
  }
600
642
 
643
+ /**
644
+ * Result of `FlowFormHandle.save()`.
645
+ * - `isValid`: true when no validation errors
646
+ * - `values`: the latest formik values (includes conditionConfig sidecar
647
+ * under `_conditionConfig` by default, configurable via prop)
648
+ * - `errors`: per-path validation errors (empty object when isValid)
649
+ */
650
+ export declare interface SaveResult {
651
+ isValid: boolean;
652
+ values: Record<string, unknown>;
653
+ errors: Record<string, unknown>;
654
+ }
655
+
601
656
  export declare function SchemaBuilder({ value, onChange, suggestions, label, onPayload, validate, onValidityChange, variableGroups, initialValues: initialValuesProp, initialFormulaConfig, initialConditionConfig, }: SchemaBuilderProps): JSX_2.Element;
602
657
 
603
658
  export declare function SchemaBuilderDrawer({ value, onChange, suggestions, onPayload, onDone, validate, onValidityChange, label, drawerTitle, drawerWidth, }: SchemaBuilderDrawerProps): JSX_2.Element;
package/dist/form.js CHANGED
@@ -1,5 +1,5 @@
1
- import { D as o, F as t, a as u, b as F, c as m, I as n, T as d, V as p, d as S, e as T, f as c, g as b, h as k, i as y, j as P, k as f, l as x, m as h, n as w, o as g, p as z, q as A, r as I, s as V, t as C, u as D, v as E, w as R, x as v, y as B, z as L, A as O } from "./index-hrOZNB2l.js";
2
- import { F as j, S as q, a as H, u as N } from "./SchemaBuilderDrawer-DlneLRLs.js";
1
+ import { D as o, F as t, a as u, b as F, c as m, I as n, T as d, V as p, d as S, e as T, f as c, g as b, h as k, i as y, j as P, k as f, l as x, m as h, n as w, o as g, p as z, q as A, r as I, s as V, t as C, u as D, v as E, w as R, x as v, y as B, z as L, A as O } from "./index-DOlwEmVL.js";
2
+ import { F as j, S as q, a as H, u as N } from "./SchemaBuilderDrawer-BoNzFwsl.js";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material";
@@ -1,4 +1,4 @@
1
- import { H as ct, J as Fe } from "./index-hrOZNB2l.js";
1
+ import { H as ct, J as Fe } from "./index-DOlwEmVL.js";
2
2
  import Ue from "react";
3
3
  import He from "react-dom";
4
4
  function $e(S, R) {
@@ -1,4 +1,4 @@
1
- import { _ as Nn, G as qn } from "./index-hrOZNB2l.js";
1
+ import { _ as Nn, G as qn } from "./index-DOlwEmVL.js";
2
2
  import { useState as ae, useLayoutEffect as Vn, useEffect as ce, forwardRef as Hn, useRef as Un, useImperativeHandle as zn, useCallback as Gn } from "react";
3
3
  import { E as m, b as x, Q as Pt, U as Ft, X as Ae, S as et, T as Ve, F as ge, e as Re, Y as tt, j as Nt, i as nt, Z as te, _, d as F, $ as Kn, a0 as $n, A as rt, r as $e, n as Jn, a1 as Je, m as qt, a2 as it, a3 as _n, a4 as Vt, P as Qn, c as jn, a as Yn, V as Ht, D as v, a5 as ue, a6 as Ut, f as Zn, C as T, a7 as b, a8 as Xn, a9 as er, W as tr, aa as nr, ab as rr, ac as ir, ad as or, ae as sr, af as lr, ag as ar, ah as cr, ai as zt, aj as hr, ak as ur, al as fr, am as dr, k as Gt, an as mr, ao as gr, v as f, ap as pr } from "./index-BnzttJ4w.js";
4
4
  import { aq as Xo, ar as es, as as ts, at as ns, au as rs, av as is, aw as os, ax as ss, M as ls, ay as as, az as cs, R as hs, h as us, aA as fs, aB as ds, aC as ms, aD as gs, aE as ps, g as ys, aF as ks, aG as xs, aH as Ss, aI as bs, aJ as Cs, aK as vs, aL as Ms, l as As, s as Ls } from "./index-BnzttJ4w.js";
@@ -1,4 +1,4 @@
1
- "use strict";const ct=require("./index-yqsiFHGg.js"),Fe=require("react"),Ue=require("react-dom");function He(S,R){for(var b=0;b<R.length;b++){const s=R[b];if(typeof s!="string"&&!Array.isArray(s)){for(const d in s)if(d!=="default"&&!(d in S)){const w=Object.getOwnPropertyDescriptor(s,d);w&&Object.defineProperty(S,d,w.get?w:{enumerable:!0,get:()=>s[d]})}}}return Object.freeze(Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}))}function $e(){this.__data__=[],this.size=0}var Ke=$e;function ze(S,R){return S===R||S!==S&&R!==R}var Ae=ze,Ge=Ae;function Ve(S,R){for(var b=S.length;b--;)if(Ge(S[b][0],R))return b;return-1}var Lt=Ve,We=Lt,Ze=Array.prototype,Ye=Ze.splice;function Xe(S){var R=this.__data__,b=We(R,S);if(b<0)return!1;var s=R.length-1;return b==s?R.pop():Ye.call(R,b,1),--this.size,!0}var Qe=Xe,Je=Lt;function tn(S){var R=this.__data__,b=Je(R,S);return b<0?void 0:R[b][1]}var en=tn,nn=Lt;function rn(S){return nn(this.__data__,S)>-1}var on=rn,an=Lt;function ln(S,R){var b=this.__data__,s=an(b,S);return s<0?(++this.size,b.push([S,R])):b[s][1]=R,this}var un=ln,sn=Ke,fn=Qe,cn=en,hn=on,dn=un;function mt(S){var R=-1,b=S==null?0:S.length;for(this.clear();++R<b;){var s=S[R];this.set(s[0],s[1])}}mt.prototype.clear=sn;mt.prototype.delete=fn;mt.prototype.get=cn;mt.prototype.has=hn;mt.prototype.set=dn;var qt=mt,vn=qt;function pn(){this.__data__=new vn,this.size=0}var yn=pn;function gn(S){var R=this.__data__,b=R.delete(S);return this.size=R.size,b}var mn=gn;function bn(S){return this.__data__.get(S)}var _n=bn;function On(S){return this.__data__.has(S)}var En=On,An=typeof ct.commonjsGlobal=="object"&&ct.commonjsGlobal&&ct.commonjsGlobal.Object===Object&&ct.commonjsGlobal,we=An,wn=we,Tn=typeof self=="object"&&self&&self.Object===Object&&self,kn=wn||Tn||Function("return this")(),pt=kn,Nn=pt,Sn=Nn.Symbol,Gt=Sn,Zt=Gt,Te=Object.prototype,xn=Te.hasOwnProperty,Pn=Te.toString,wt=Zt?Zt.toStringTag:void 0;function Ln(S){var R=xn.call(S,wt),b=S[wt];try{S[wt]=void 0;var s=!0}catch{}var d=Pn.call(S);return s&&(R?S[wt]=b:delete S[wt]),d}var qn=Ln,Rn=Object.prototype,jn=Rn.toString;function In(S){return jn.call(S)}var Mn=In,Yt=Gt,Dn=qn,Bn=Mn,Cn="[object Null]",Fn="[object Undefined]",Xt=Yt?Yt.toStringTag:void 0;function Un(S){return S==null?S===void 0?Fn:Cn:Xt&&Xt in Object(S)?Dn(S):Bn(S)}var Rt=Un;function Hn(S){var R=typeof S;return S!=null&&(R=="object"||R=="function")}var ke=Hn,$n=Rt,Kn=ke,zn="[object AsyncFunction]",Gn="[object Function]",Vn="[object GeneratorFunction]",Wn="[object Proxy]";function Zn(S){if(!Kn(S))return!1;var R=$n(S);return R==Gn||R==Vn||R==zn||R==Wn}var Ne=Zn,Yn=pt,Xn=Yn["__core-js_shared__"],Qn=Xn,Bt=Qn,Qt=function(){var S=/[^.]+$/.exec(Bt&&Bt.keys&&Bt.keys.IE_PROTO||"");return S?"Symbol(src)_1."+S:""}();function Jn(S){return!!Qt&&Qt in S}var tr=Jn,er=Function.prototype,nr=er.toString;function rr(S){if(S!=null){try{return nr.call(S)}catch{}try{return S+""}catch{}}return""}var Se=rr,ir=Ne,or=tr,ar=ke,lr=Se,ur=/[\\^$.*+?()[\]{}|]/g,sr=/^\[object .+?Constructor\]$/,fr=Function.prototype,cr=Object.prototype,hr=fr.toString,dr=cr.hasOwnProperty,vr=RegExp("^"+hr.call(dr).replace(ur,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function pr(S){if(!ar(S)||or(S))return!1;var R=ir(S)?vr:sr;return R.test(lr(S))}var yr=pr;function gr(S,R){return S==null?void 0:S[R]}var mr=gr,br=yr,_r=mr;function Or(S,R){var b=_r(S,R);return br(b)?b:void 0}var bt=Or,Er=bt,Ar=pt,wr=Er(Ar,"Map"),Vt=wr,Tr=bt,kr=Tr(Object,"create"),jt=kr,Jt=jt;function Nr(){this.__data__=Jt?Jt(null):{},this.size=0}var Sr=Nr;function xr(S){var R=this.has(S)&&delete this.__data__[S];return this.size-=R?1:0,R}var Pr=xr,Lr=jt,qr="__lodash_hash_undefined__",Rr=Object.prototype,jr=Rr.hasOwnProperty;function Ir(S){var R=this.__data__;if(Lr){var b=R[S];return b===qr?void 0:b}return jr.call(R,S)?R[S]:void 0}var Mr=Ir,Dr=jt,Br=Object.prototype,Cr=Br.hasOwnProperty;function Fr(S){var R=this.__data__;return Dr?R[S]!==void 0:Cr.call(R,S)}var Ur=Fr,Hr=jt,$r="__lodash_hash_undefined__";function Kr(S,R){var b=this.__data__;return this.size+=this.has(S)?0:1,b[S]=Hr&&R===void 0?$r:R,this}var zr=Kr,Gr=Sr,Vr=Pr,Wr=Mr,Zr=Ur,Yr=zr;function _t(S){var R=-1,b=S==null?0:S.length;for(this.clear();++R<b;){var s=S[R];this.set(s[0],s[1])}}_t.prototype.clear=Gr;_t.prototype.delete=Vr;_t.prototype.get=Wr;_t.prototype.has=Zr;_t.prototype.set=Yr;var Xr=_t,te=Xr,Qr=qt,Jr=Vt;function ti(){this.size=0,this.__data__={hash:new te,map:new(Jr||Qr),string:new te}}var ei=ti;function ni(S){var R=typeof S;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?S!=="__proto__":S===null}var ri=ni,ii=ri;function oi(S,R){var b=S.__data__;return ii(R)?b[typeof R=="string"?"string":"hash"]:b.map}var It=oi,ai=It;function li(S){var R=ai(this,S).delete(S);return this.size-=R?1:0,R}var ui=li,si=It;function fi(S){return si(this,S).get(S)}var ci=fi,hi=It;function di(S){return hi(this,S).has(S)}var vi=di,pi=It;function yi(S,R){var b=pi(this,S),s=b.size;return b.set(S,R),this.size+=b.size==s?0:1,this}var gi=yi,mi=ei,bi=ui,_i=ci,Oi=vi,Ei=gi;function Ot(S){var R=-1,b=S==null?0:S.length;for(this.clear();++R<b;){var s=S[R];this.set(s[0],s[1])}}Ot.prototype.clear=mi;Ot.prototype.delete=bi;Ot.prototype.get=_i;Ot.prototype.has=Oi;Ot.prototype.set=Ei;var xe=Ot,Ai=qt,wi=Vt,Ti=xe,ki=200;function Ni(S,R){var b=this.__data__;if(b instanceof Ai){var s=b.__data__;if(!wi||s.length<ki-1)return s.push([S,R]),this.size=++b.size,this;b=this.__data__=new Ti(s)}return b.set(S,R),this.size=b.size,this}var Si=Ni,xi=qt,Pi=yn,Li=mn,qi=_n,Ri=En,ji=Si;function Et(S){var R=this.__data__=new xi(S);this.size=R.size}Et.prototype.clear=Pi;Et.prototype.delete=Li;Et.prototype.get=qi;Et.prototype.has=Ri;Et.prototype.set=ji;var Ii=Et,Mi="__lodash_hash_undefined__";function Di(S){return this.__data__.set(S,Mi),this}var Bi=Di;function Ci(S){return this.__data__.has(S)}var Fi=Ci,Ui=xe,Hi=Bi,$i=Fi;function Nt(S){var R=-1,b=S==null?0:S.length;for(this.__data__=new Ui;++R<b;)this.add(S[R])}Nt.prototype.add=Nt.prototype.push=Hi;Nt.prototype.has=$i;var Ki=Nt;function zi(S,R){for(var b=-1,s=S==null?0:S.length;++b<s;)if(R(S[b],b,S))return!0;return!1}var Gi=zi;function Vi(S,R){return S.has(R)}var Wi=Vi,Zi=Ki,Yi=Gi,Xi=Wi,Qi=1,Ji=2;function to(S,R,b,s,d,w){var A=b&Qi,_=S.length,v=R.length;if(_!=v&&!(A&&v>_))return!1;var y=w.get(S),h=w.get(R);if(y&&h)return y==R&&h==S;var o=-1,t=!0,e=b&Ji?new Zi:void 0;for(w.set(S,R),w.set(R,S);++o<_;){var u=S[o],a=R[o];if(s)var l=A?s(a,u,o,R,S,w):s(u,a,o,S,R,w);if(l!==void 0){if(l)continue;t=!1;break}if(e){if(!Yi(R,function(r,i){if(!Xi(e,i)&&(u===r||d(u,r,b,s,w)))return e.push(i)})){t=!1;break}}else if(!(u===a||d(u,a,b,s,w))){t=!1;break}}return w.delete(S),w.delete(R),t}var Pe=to,eo=pt,no=eo.Uint8Array,ro=no;function io(S){var R=-1,b=Array(S.size);return S.forEach(function(s,d){b[++R]=[d,s]}),b}var oo=io;function ao(S){var R=-1,b=Array(S.size);return S.forEach(function(s){b[++R]=s}),b}var lo=ao,ee=Gt,ne=ro,uo=Ae,so=Pe,fo=oo,co=lo,ho=1,vo=2,po="[object Boolean]",yo="[object Date]",go="[object Error]",mo="[object Map]",bo="[object Number]",_o="[object RegExp]",Oo="[object Set]",Eo="[object String]",Ao="[object Symbol]",wo="[object ArrayBuffer]",To="[object DataView]",re=ee?ee.prototype:void 0,Ct=re?re.valueOf:void 0;function ko(S,R,b,s,d,w,A){switch(b){case To:if(S.byteLength!=R.byteLength||S.byteOffset!=R.byteOffset)return!1;S=S.buffer,R=R.buffer;case wo:return!(S.byteLength!=R.byteLength||!w(new ne(S),new ne(R)));case po:case yo:case bo:return uo(+S,+R);case go:return S.name==R.name&&S.message==R.message;case _o:case Eo:return S==R+"";case mo:var _=fo;case Oo:var v=s&ho;if(_||(_=co),S.size!=R.size&&!v)return!1;var y=A.get(S);if(y)return y==R;s|=vo,A.set(S,R);var h=so(_(S),_(R),s,d,w,A);return A.delete(S),h;case Ao:if(Ct)return Ct.call(S)==Ct.call(R)}return!1}var No=ko;function So(S,R){for(var b=-1,s=R.length,d=S.length;++b<s;)S[d+b]=R[b];return S}var xo=So,Po=Array.isArray,Wt=Po,Lo=xo,qo=Wt;function Ro(S,R,b){var s=R(S);return qo(S)?s:Lo(s,b(S))}var jo=Ro;function Io(S,R){for(var b=-1,s=S==null?0:S.length,d=0,w=[];++b<s;){var A=S[b];R(A,b,S)&&(w[d++]=A)}return w}var Mo=Io;function Do(){return[]}var Bo=Do,Co=Mo,Fo=Bo,Uo=Object.prototype,Ho=Uo.propertyIsEnumerable,ie=Object.getOwnPropertySymbols,$o=ie?function(S){return S==null?[]:(S=Object(S),Co(ie(S),function(R){return Ho.call(S,R)}))}:Fo,Ko=$o;function zo(S,R){for(var b=-1,s=Array(S);++b<S;)s[b]=R(b);return s}var Go=zo;function Vo(S){return S!=null&&typeof S=="object"}var Mt=Vo,Wo=Rt,Zo=Mt,Yo="[object Arguments]";function Xo(S){return Zo(S)&&Wo(S)==Yo}var Qo=Xo,oe=Qo,Jo=Mt,Le=Object.prototype,ta=Le.hasOwnProperty,ea=Le.propertyIsEnumerable,na=oe(function(){return arguments}())?oe:function(S){return Jo(S)&&ta.call(S,"callee")&&!ea.call(S,"callee")},ra=na,St={exports:{}};function ia(){return!1}var oa=ia;St.exports;(function(S,R){var b=pt,s=oa,d=R&&!R.nodeType&&R,w=d&&!0&&S&&!S.nodeType&&S,A=w&&w.exports===d,_=A?b.Buffer:void 0,v=_?_.isBuffer:void 0,y=v||s;S.exports=y})(St,St.exports);var qe=St.exports,aa=9007199254740991,la=/^(?:0|[1-9]\d*)$/;function ua(S,R){var b=typeof S;return R=R??aa,!!R&&(b=="number"||b!="symbol"&&la.test(S))&&S>-1&&S%1==0&&S<R}var sa=ua,fa=9007199254740991;function ca(S){return typeof S=="number"&&S>-1&&S%1==0&&S<=fa}var Re=ca,ha=Rt,da=Re,va=Mt,pa="[object Arguments]",ya="[object Array]",ga="[object Boolean]",ma="[object Date]",ba="[object Error]",_a="[object Function]",Oa="[object Map]",Ea="[object Number]",Aa="[object Object]",wa="[object RegExp]",Ta="[object Set]",ka="[object String]",Na="[object WeakMap]",Sa="[object ArrayBuffer]",xa="[object DataView]",Pa="[object Float32Array]",La="[object Float64Array]",qa="[object Int8Array]",Ra="[object Int16Array]",ja="[object Int32Array]",Ia="[object Uint8Array]",Ma="[object Uint8ClampedArray]",Da="[object Uint16Array]",Ba="[object Uint32Array]",at={};at[Pa]=at[La]=at[qa]=at[Ra]=at[ja]=at[Ia]=at[Ma]=at[Da]=at[Ba]=!0;at[pa]=at[ya]=at[Sa]=at[ga]=at[xa]=at[ma]=at[ba]=at[_a]=at[Oa]=at[Ea]=at[Aa]=at[wa]=at[Ta]=at[ka]=at[Na]=!1;function Ca(S){return va(S)&&da(S.length)&&!!at[ha(S)]}var Fa=Ca;function Ua(S){return function(R){return S(R)}}var Ha=Ua,xt={exports:{}};xt.exports;(function(S,R){var b=we,s=R&&!R.nodeType&&R,d=s&&!0&&S&&!S.nodeType&&S,w=d&&d.exports===s,A=w&&b.process,_=function(){try{var v=d&&d.require&&d.require("util").types;return v||A&&A.binding&&A.binding("util")}catch{}}();S.exports=_})(xt,xt.exports);var $a=xt.exports,Ka=Fa,za=Ha,ae=$a,le=ae&&ae.isTypedArray,Ga=le?za(le):Ka,je=Ga,Va=Go,Wa=ra,Za=Wt,Ya=qe,Xa=sa,Qa=je,Ja=Object.prototype,tl=Ja.hasOwnProperty;function el(S,R){var b=Za(S),s=!b&&Wa(S),d=!b&&!s&&Ya(S),w=!b&&!s&&!d&&Qa(S),A=b||s||d||w,_=A?Va(S.length,String):[],v=_.length;for(var y in S)(R||tl.call(S,y))&&!(A&&(y=="length"||d&&(y=="offset"||y=="parent")||w&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||Xa(y,v)))&&_.push(y);return _}var nl=el,rl=Object.prototype;function il(S){var R=S&&S.constructor,b=typeof R=="function"&&R.prototype||rl;return S===b}var ol=il;function al(S,R){return function(b){return S(R(b))}}var ll=al,ul=ll,sl=ul(Object.keys,Object),fl=sl,cl=ol,hl=fl,dl=Object.prototype,vl=dl.hasOwnProperty;function pl(S){if(!cl(S))return hl(S);var R=[];for(var b in Object(S))vl.call(S,b)&&b!="constructor"&&R.push(b);return R}var yl=pl,gl=Ne,ml=Re;function bl(S){return S!=null&&ml(S.length)&&!gl(S)}var _l=bl,Ol=nl,El=yl,Al=_l;function wl(S){return Al(S)?Ol(S):El(S)}var Tl=wl,kl=jo,Nl=Ko,Sl=Tl;function xl(S){return kl(S,Sl,Nl)}var Pl=xl,ue=Pl,Ll=1,ql=Object.prototype,Rl=ql.hasOwnProperty;function jl(S,R,b,s,d,w){var A=b&Ll,_=ue(S),v=_.length,y=ue(R),h=y.length;if(v!=h&&!A)return!1;for(var o=v;o--;){var t=_[o];if(!(A?t in R:Rl.call(R,t)))return!1}var e=w.get(S),u=w.get(R);if(e&&u)return e==R&&u==S;var a=!0;w.set(S,R),w.set(R,S);for(var l=A;++o<v;){t=_[o];var r=S[t],i=R[t];if(s)var f=A?s(i,r,t,R,S,w):s(r,i,t,S,R,w);if(!(f===void 0?r===i||d(r,i,b,s,w):f)){a=!1;break}l||(l=t=="constructor")}if(a&&!l){var n=S.constructor,c=R.constructor;n!=c&&"constructor"in S&&"constructor"in R&&!(typeof n=="function"&&n instanceof n&&typeof c=="function"&&c instanceof c)&&(a=!1)}return w.delete(S),w.delete(R),a}var Il=jl,Ml=bt,Dl=pt,Bl=Ml(Dl,"DataView"),Cl=Bl,Fl=bt,Ul=pt,Hl=Fl(Ul,"Promise"),$l=Hl,Kl=bt,zl=pt,Gl=Kl(zl,"Set"),Vl=Gl,Wl=bt,Zl=pt,Yl=Wl(Zl,"WeakMap"),Xl=Yl,Ut=Cl,Ht=Vt,$t=$l,Kt=Vl,zt=Xl,Ie=Rt,At=Se,se="[object Map]",Ql="[object Object]",fe="[object Promise]",ce="[object Set]",he="[object WeakMap]",de="[object DataView]",Jl=At(Ut),tu=At(Ht),eu=At($t),nu=At(Kt),ru=At(zt),gt=Ie;(Ut&&gt(new Ut(new ArrayBuffer(1)))!=de||Ht&&gt(new Ht)!=se||$t&&gt($t.resolve())!=fe||Kt&&gt(new Kt)!=ce||zt&&gt(new zt)!=he)&&(gt=function(S){var R=Ie(S),b=R==Ql?S.constructor:void 0,s=b?At(b):"";if(s)switch(s){case Jl:return de;case tu:return se;case eu:return fe;case nu:return ce;case ru:return he}return R});var iu=gt,Ft=Ii,ou=Pe,au=No,lu=Il,ve=iu,pe=Wt,ye=qe,uu=je,su=1,ge="[object Arguments]",me="[object Array]",kt="[object Object]",fu=Object.prototype,be=fu.hasOwnProperty;function cu(S,R,b,s,d,w){var A=pe(S),_=pe(R),v=A?me:ve(S),y=_?me:ve(R);v=v==ge?kt:v,y=y==ge?kt:y;var h=v==kt,o=y==kt,t=v==y;if(t&&ye(S)){if(!ye(R))return!1;A=!0,h=!1}if(t&&!h)return w||(w=new Ft),A||uu(S)?ou(S,R,b,s,d,w):au(S,R,v,b,s,d,w);if(!(b&su)){var e=h&&be.call(S,"__wrapped__"),u=o&&be.call(R,"__wrapped__");if(e||u){var a=e?S.value():S,l=u?R.value():R;return w||(w=new Ft),d(a,l,b,s,w)}}return t?(w||(w=new Ft),lu(S,R,b,s,d,w)):!1}var hu=cu,du=hu,_e=Mt;function Me(S,R,b,s,d){return S===R?!0:S==null||R==null||!_e(S)&&!_e(R)?S!==S&&R!==R:du(S,R,b,s,Me,d)}var vu=Me,pu=vu;function yu(S,R){return pu(S,R)}var gu=yu,De={exports:{}};/*!
1
+ "use strict";const ct=require("./index-CdqkWMbb.js"),Fe=require("react"),Ue=require("react-dom");function He(S,R){for(var b=0;b<R.length;b++){const s=R[b];if(typeof s!="string"&&!Array.isArray(s)){for(const d in s)if(d!=="default"&&!(d in S)){const w=Object.getOwnPropertyDescriptor(s,d);w&&Object.defineProperty(S,d,w.get?w:{enumerable:!0,get:()=>s[d]})}}}return Object.freeze(Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}))}function $e(){this.__data__=[],this.size=0}var Ke=$e;function ze(S,R){return S===R||S!==S&&R!==R}var Ae=ze,Ge=Ae;function Ve(S,R){for(var b=S.length;b--;)if(Ge(S[b][0],R))return b;return-1}var Lt=Ve,We=Lt,Ze=Array.prototype,Ye=Ze.splice;function Xe(S){var R=this.__data__,b=We(R,S);if(b<0)return!1;var s=R.length-1;return b==s?R.pop():Ye.call(R,b,1),--this.size,!0}var Qe=Xe,Je=Lt;function tn(S){var R=this.__data__,b=Je(R,S);return b<0?void 0:R[b][1]}var en=tn,nn=Lt;function rn(S){return nn(this.__data__,S)>-1}var on=rn,an=Lt;function ln(S,R){var b=this.__data__,s=an(b,S);return s<0?(++this.size,b.push([S,R])):b[s][1]=R,this}var un=ln,sn=Ke,fn=Qe,cn=en,hn=on,dn=un;function mt(S){var R=-1,b=S==null?0:S.length;for(this.clear();++R<b;){var s=S[R];this.set(s[0],s[1])}}mt.prototype.clear=sn;mt.prototype.delete=fn;mt.prototype.get=cn;mt.prototype.has=hn;mt.prototype.set=dn;var qt=mt,vn=qt;function pn(){this.__data__=new vn,this.size=0}var yn=pn;function gn(S){var R=this.__data__,b=R.delete(S);return this.size=R.size,b}var mn=gn;function bn(S){return this.__data__.get(S)}var _n=bn;function On(S){return this.__data__.has(S)}var En=On,An=typeof ct.commonjsGlobal=="object"&&ct.commonjsGlobal&&ct.commonjsGlobal.Object===Object&&ct.commonjsGlobal,we=An,wn=we,Tn=typeof self=="object"&&self&&self.Object===Object&&self,kn=wn||Tn||Function("return this")(),pt=kn,Nn=pt,Sn=Nn.Symbol,Gt=Sn,Zt=Gt,Te=Object.prototype,xn=Te.hasOwnProperty,Pn=Te.toString,wt=Zt?Zt.toStringTag:void 0;function Ln(S){var R=xn.call(S,wt),b=S[wt];try{S[wt]=void 0;var s=!0}catch{}var d=Pn.call(S);return s&&(R?S[wt]=b:delete S[wt]),d}var qn=Ln,Rn=Object.prototype,jn=Rn.toString;function In(S){return jn.call(S)}var Mn=In,Yt=Gt,Dn=qn,Bn=Mn,Cn="[object Null]",Fn="[object Undefined]",Xt=Yt?Yt.toStringTag:void 0;function Un(S){return S==null?S===void 0?Fn:Cn:Xt&&Xt in Object(S)?Dn(S):Bn(S)}var Rt=Un;function Hn(S){var R=typeof S;return S!=null&&(R=="object"||R=="function")}var ke=Hn,$n=Rt,Kn=ke,zn="[object AsyncFunction]",Gn="[object Function]",Vn="[object GeneratorFunction]",Wn="[object Proxy]";function Zn(S){if(!Kn(S))return!1;var R=$n(S);return R==Gn||R==Vn||R==zn||R==Wn}var Ne=Zn,Yn=pt,Xn=Yn["__core-js_shared__"],Qn=Xn,Bt=Qn,Qt=function(){var S=/[^.]+$/.exec(Bt&&Bt.keys&&Bt.keys.IE_PROTO||"");return S?"Symbol(src)_1."+S:""}();function Jn(S){return!!Qt&&Qt in S}var tr=Jn,er=Function.prototype,nr=er.toString;function rr(S){if(S!=null){try{return nr.call(S)}catch{}try{return S+""}catch{}}return""}var Se=rr,ir=Ne,or=tr,ar=ke,lr=Se,ur=/[\\^$.*+?()[\]{}|]/g,sr=/^\[object .+?Constructor\]$/,fr=Function.prototype,cr=Object.prototype,hr=fr.toString,dr=cr.hasOwnProperty,vr=RegExp("^"+hr.call(dr).replace(ur,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function pr(S){if(!ar(S)||or(S))return!1;var R=ir(S)?vr:sr;return R.test(lr(S))}var yr=pr;function gr(S,R){return S==null?void 0:S[R]}var mr=gr,br=yr,_r=mr;function Or(S,R){var b=_r(S,R);return br(b)?b:void 0}var bt=Or,Er=bt,Ar=pt,wr=Er(Ar,"Map"),Vt=wr,Tr=bt,kr=Tr(Object,"create"),jt=kr,Jt=jt;function Nr(){this.__data__=Jt?Jt(null):{},this.size=0}var Sr=Nr;function xr(S){var R=this.has(S)&&delete this.__data__[S];return this.size-=R?1:0,R}var Pr=xr,Lr=jt,qr="__lodash_hash_undefined__",Rr=Object.prototype,jr=Rr.hasOwnProperty;function Ir(S){var R=this.__data__;if(Lr){var b=R[S];return b===qr?void 0:b}return jr.call(R,S)?R[S]:void 0}var Mr=Ir,Dr=jt,Br=Object.prototype,Cr=Br.hasOwnProperty;function Fr(S){var R=this.__data__;return Dr?R[S]!==void 0:Cr.call(R,S)}var Ur=Fr,Hr=jt,$r="__lodash_hash_undefined__";function Kr(S,R){var b=this.__data__;return this.size+=this.has(S)?0:1,b[S]=Hr&&R===void 0?$r:R,this}var zr=Kr,Gr=Sr,Vr=Pr,Wr=Mr,Zr=Ur,Yr=zr;function _t(S){var R=-1,b=S==null?0:S.length;for(this.clear();++R<b;){var s=S[R];this.set(s[0],s[1])}}_t.prototype.clear=Gr;_t.prototype.delete=Vr;_t.prototype.get=Wr;_t.prototype.has=Zr;_t.prototype.set=Yr;var Xr=_t,te=Xr,Qr=qt,Jr=Vt;function ti(){this.size=0,this.__data__={hash:new te,map:new(Jr||Qr),string:new te}}var ei=ti;function ni(S){var R=typeof S;return R=="string"||R=="number"||R=="symbol"||R=="boolean"?S!=="__proto__":S===null}var ri=ni,ii=ri;function oi(S,R){var b=S.__data__;return ii(R)?b[typeof R=="string"?"string":"hash"]:b.map}var It=oi,ai=It;function li(S){var R=ai(this,S).delete(S);return this.size-=R?1:0,R}var ui=li,si=It;function fi(S){return si(this,S).get(S)}var ci=fi,hi=It;function di(S){return hi(this,S).has(S)}var vi=di,pi=It;function yi(S,R){var b=pi(this,S),s=b.size;return b.set(S,R),this.size+=b.size==s?0:1,this}var gi=yi,mi=ei,bi=ui,_i=ci,Oi=vi,Ei=gi;function Ot(S){var R=-1,b=S==null?0:S.length;for(this.clear();++R<b;){var s=S[R];this.set(s[0],s[1])}}Ot.prototype.clear=mi;Ot.prototype.delete=bi;Ot.prototype.get=_i;Ot.prototype.has=Oi;Ot.prototype.set=Ei;var xe=Ot,Ai=qt,wi=Vt,Ti=xe,ki=200;function Ni(S,R){var b=this.__data__;if(b instanceof Ai){var s=b.__data__;if(!wi||s.length<ki-1)return s.push([S,R]),this.size=++b.size,this;b=this.__data__=new Ti(s)}return b.set(S,R),this.size=b.size,this}var Si=Ni,xi=qt,Pi=yn,Li=mn,qi=_n,Ri=En,ji=Si;function Et(S){var R=this.__data__=new xi(S);this.size=R.size}Et.prototype.clear=Pi;Et.prototype.delete=Li;Et.prototype.get=qi;Et.prototype.has=Ri;Et.prototype.set=ji;var Ii=Et,Mi="__lodash_hash_undefined__";function Di(S){return this.__data__.set(S,Mi),this}var Bi=Di;function Ci(S){return this.__data__.has(S)}var Fi=Ci,Ui=xe,Hi=Bi,$i=Fi;function Nt(S){var R=-1,b=S==null?0:S.length;for(this.__data__=new Ui;++R<b;)this.add(S[R])}Nt.prototype.add=Nt.prototype.push=Hi;Nt.prototype.has=$i;var Ki=Nt;function zi(S,R){for(var b=-1,s=S==null?0:S.length;++b<s;)if(R(S[b],b,S))return!0;return!1}var Gi=zi;function Vi(S,R){return S.has(R)}var Wi=Vi,Zi=Ki,Yi=Gi,Xi=Wi,Qi=1,Ji=2;function to(S,R,b,s,d,w){var A=b&Qi,_=S.length,v=R.length;if(_!=v&&!(A&&v>_))return!1;var y=w.get(S),h=w.get(R);if(y&&h)return y==R&&h==S;var o=-1,t=!0,e=b&Ji?new Zi:void 0;for(w.set(S,R),w.set(R,S);++o<_;){var u=S[o],a=R[o];if(s)var l=A?s(a,u,o,R,S,w):s(u,a,o,S,R,w);if(l!==void 0){if(l)continue;t=!1;break}if(e){if(!Yi(R,function(r,i){if(!Xi(e,i)&&(u===r||d(u,r,b,s,w)))return e.push(i)})){t=!1;break}}else if(!(u===a||d(u,a,b,s,w))){t=!1;break}}return w.delete(S),w.delete(R),t}var Pe=to,eo=pt,no=eo.Uint8Array,ro=no;function io(S){var R=-1,b=Array(S.size);return S.forEach(function(s,d){b[++R]=[d,s]}),b}var oo=io;function ao(S){var R=-1,b=Array(S.size);return S.forEach(function(s){b[++R]=s}),b}var lo=ao,ee=Gt,ne=ro,uo=Ae,so=Pe,fo=oo,co=lo,ho=1,vo=2,po="[object Boolean]",yo="[object Date]",go="[object Error]",mo="[object Map]",bo="[object Number]",_o="[object RegExp]",Oo="[object Set]",Eo="[object String]",Ao="[object Symbol]",wo="[object ArrayBuffer]",To="[object DataView]",re=ee?ee.prototype:void 0,Ct=re?re.valueOf:void 0;function ko(S,R,b,s,d,w,A){switch(b){case To:if(S.byteLength!=R.byteLength||S.byteOffset!=R.byteOffset)return!1;S=S.buffer,R=R.buffer;case wo:return!(S.byteLength!=R.byteLength||!w(new ne(S),new ne(R)));case po:case yo:case bo:return uo(+S,+R);case go:return S.name==R.name&&S.message==R.message;case _o:case Eo:return S==R+"";case mo:var _=fo;case Oo:var v=s&ho;if(_||(_=co),S.size!=R.size&&!v)return!1;var y=A.get(S);if(y)return y==R;s|=vo,A.set(S,R);var h=so(_(S),_(R),s,d,w,A);return A.delete(S),h;case Ao:if(Ct)return Ct.call(S)==Ct.call(R)}return!1}var No=ko;function So(S,R){for(var b=-1,s=R.length,d=S.length;++b<s;)S[d+b]=R[b];return S}var xo=So,Po=Array.isArray,Wt=Po,Lo=xo,qo=Wt;function Ro(S,R,b){var s=R(S);return qo(S)?s:Lo(s,b(S))}var jo=Ro;function Io(S,R){for(var b=-1,s=S==null?0:S.length,d=0,w=[];++b<s;){var A=S[b];R(A,b,S)&&(w[d++]=A)}return w}var Mo=Io;function Do(){return[]}var Bo=Do,Co=Mo,Fo=Bo,Uo=Object.prototype,Ho=Uo.propertyIsEnumerable,ie=Object.getOwnPropertySymbols,$o=ie?function(S){return S==null?[]:(S=Object(S),Co(ie(S),function(R){return Ho.call(S,R)}))}:Fo,Ko=$o;function zo(S,R){for(var b=-1,s=Array(S);++b<S;)s[b]=R(b);return s}var Go=zo;function Vo(S){return S!=null&&typeof S=="object"}var Mt=Vo,Wo=Rt,Zo=Mt,Yo="[object Arguments]";function Xo(S){return Zo(S)&&Wo(S)==Yo}var Qo=Xo,oe=Qo,Jo=Mt,Le=Object.prototype,ta=Le.hasOwnProperty,ea=Le.propertyIsEnumerable,na=oe(function(){return arguments}())?oe:function(S){return Jo(S)&&ta.call(S,"callee")&&!ea.call(S,"callee")},ra=na,St={exports:{}};function ia(){return!1}var oa=ia;St.exports;(function(S,R){var b=pt,s=oa,d=R&&!R.nodeType&&R,w=d&&!0&&S&&!S.nodeType&&S,A=w&&w.exports===d,_=A?b.Buffer:void 0,v=_?_.isBuffer:void 0,y=v||s;S.exports=y})(St,St.exports);var qe=St.exports,aa=9007199254740991,la=/^(?:0|[1-9]\d*)$/;function ua(S,R){var b=typeof S;return R=R??aa,!!R&&(b=="number"||b!="symbol"&&la.test(S))&&S>-1&&S%1==0&&S<R}var sa=ua,fa=9007199254740991;function ca(S){return typeof S=="number"&&S>-1&&S%1==0&&S<=fa}var Re=ca,ha=Rt,da=Re,va=Mt,pa="[object Arguments]",ya="[object Array]",ga="[object Boolean]",ma="[object Date]",ba="[object Error]",_a="[object Function]",Oa="[object Map]",Ea="[object Number]",Aa="[object Object]",wa="[object RegExp]",Ta="[object Set]",ka="[object String]",Na="[object WeakMap]",Sa="[object ArrayBuffer]",xa="[object DataView]",Pa="[object Float32Array]",La="[object Float64Array]",qa="[object Int8Array]",Ra="[object Int16Array]",ja="[object Int32Array]",Ia="[object Uint8Array]",Ma="[object Uint8ClampedArray]",Da="[object Uint16Array]",Ba="[object Uint32Array]",at={};at[Pa]=at[La]=at[qa]=at[Ra]=at[ja]=at[Ia]=at[Ma]=at[Da]=at[Ba]=!0;at[pa]=at[ya]=at[Sa]=at[ga]=at[xa]=at[ma]=at[ba]=at[_a]=at[Oa]=at[Ea]=at[Aa]=at[wa]=at[Ta]=at[ka]=at[Na]=!1;function Ca(S){return va(S)&&da(S.length)&&!!at[ha(S)]}var Fa=Ca;function Ua(S){return function(R){return S(R)}}var Ha=Ua,xt={exports:{}};xt.exports;(function(S,R){var b=we,s=R&&!R.nodeType&&R,d=s&&!0&&S&&!S.nodeType&&S,w=d&&d.exports===s,A=w&&b.process,_=function(){try{var v=d&&d.require&&d.require("util").types;return v||A&&A.binding&&A.binding("util")}catch{}}();S.exports=_})(xt,xt.exports);var $a=xt.exports,Ka=Fa,za=Ha,ae=$a,le=ae&&ae.isTypedArray,Ga=le?za(le):Ka,je=Ga,Va=Go,Wa=ra,Za=Wt,Ya=qe,Xa=sa,Qa=je,Ja=Object.prototype,tl=Ja.hasOwnProperty;function el(S,R){var b=Za(S),s=!b&&Wa(S),d=!b&&!s&&Ya(S),w=!b&&!s&&!d&&Qa(S),A=b||s||d||w,_=A?Va(S.length,String):[],v=_.length;for(var y in S)(R||tl.call(S,y))&&!(A&&(y=="length"||d&&(y=="offset"||y=="parent")||w&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||Xa(y,v)))&&_.push(y);return _}var nl=el,rl=Object.prototype;function il(S){var R=S&&S.constructor,b=typeof R=="function"&&R.prototype||rl;return S===b}var ol=il;function al(S,R){return function(b){return S(R(b))}}var ll=al,ul=ll,sl=ul(Object.keys,Object),fl=sl,cl=ol,hl=fl,dl=Object.prototype,vl=dl.hasOwnProperty;function pl(S){if(!cl(S))return hl(S);var R=[];for(var b in Object(S))vl.call(S,b)&&b!="constructor"&&R.push(b);return R}var yl=pl,gl=Ne,ml=Re;function bl(S){return S!=null&&ml(S.length)&&!gl(S)}var _l=bl,Ol=nl,El=yl,Al=_l;function wl(S){return Al(S)?Ol(S):El(S)}var Tl=wl,kl=jo,Nl=Ko,Sl=Tl;function xl(S){return kl(S,Sl,Nl)}var Pl=xl,ue=Pl,Ll=1,ql=Object.prototype,Rl=ql.hasOwnProperty;function jl(S,R,b,s,d,w){var A=b&Ll,_=ue(S),v=_.length,y=ue(R),h=y.length;if(v!=h&&!A)return!1;for(var o=v;o--;){var t=_[o];if(!(A?t in R:Rl.call(R,t)))return!1}var e=w.get(S),u=w.get(R);if(e&&u)return e==R&&u==S;var a=!0;w.set(S,R),w.set(R,S);for(var l=A;++o<v;){t=_[o];var r=S[t],i=R[t];if(s)var f=A?s(i,r,t,R,S,w):s(r,i,t,S,R,w);if(!(f===void 0?r===i||d(r,i,b,s,w):f)){a=!1;break}l||(l=t=="constructor")}if(a&&!l){var n=S.constructor,c=R.constructor;n!=c&&"constructor"in S&&"constructor"in R&&!(typeof n=="function"&&n instanceof n&&typeof c=="function"&&c instanceof c)&&(a=!1)}return w.delete(S),w.delete(R),a}var Il=jl,Ml=bt,Dl=pt,Bl=Ml(Dl,"DataView"),Cl=Bl,Fl=bt,Ul=pt,Hl=Fl(Ul,"Promise"),$l=Hl,Kl=bt,zl=pt,Gl=Kl(zl,"Set"),Vl=Gl,Wl=bt,Zl=pt,Yl=Wl(Zl,"WeakMap"),Xl=Yl,Ut=Cl,Ht=Vt,$t=$l,Kt=Vl,zt=Xl,Ie=Rt,At=Se,se="[object Map]",Ql="[object Object]",fe="[object Promise]",ce="[object Set]",he="[object WeakMap]",de="[object DataView]",Jl=At(Ut),tu=At(Ht),eu=At($t),nu=At(Kt),ru=At(zt),gt=Ie;(Ut&&gt(new Ut(new ArrayBuffer(1)))!=de||Ht&&gt(new Ht)!=se||$t&&gt($t.resolve())!=fe||Kt&&gt(new Kt)!=ce||zt&&gt(new zt)!=he)&&(gt=function(S){var R=Ie(S),b=R==Ql?S.constructor:void 0,s=b?At(b):"";if(s)switch(s){case Jl:return de;case tu:return se;case eu:return fe;case nu:return ce;case ru:return he}return R});var iu=gt,Ft=Ii,ou=Pe,au=No,lu=Il,ve=iu,pe=Wt,ye=qe,uu=je,su=1,ge="[object Arguments]",me="[object Array]",kt="[object Object]",fu=Object.prototype,be=fu.hasOwnProperty;function cu(S,R,b,s,d,w){var A=pe(S),_=pe(R),v=A?me:ve(S),y=_?me:ve(R);v=v==ge?kt:v,y=y==ge?kt:y;var h=v==kt,o=y==kt,t=v==y;if(t&&ye(S)){if(!ye(R))return!1;A=!0,h=!1}if(t&&!h)return w||(w=new Ft),A||uu(S)?ou(S,R,b,s,d,w):au(S,R,v,b,s,d,w);if(!(b&su)){var e=h&&be.call(S,"__wrapped__"),u=o&&be.call(R,"__wrapped__");if(e||u){var a=e?S.value():S,l=u?R.value():R;return w||(w=new Ft),d(a,l,b,s,w)}}return t?(w||(w=new Ft),lu(S,R,b,s,d,w)):!1}var hu=cu,du=hu,_e=Mt;function Me(S,R,b,s,d){return S===R?!0:S==null||R==null||!_e(S)&&!_e(R)?S!==S&&R!==R:du(S,R,b,s,Me,d)}var vu=Me,pu=vu;function yu(S,R){return pu(S,R)}var gu=yu,De={exports:{}};/*!
2
2
  * Quill Editor v1.3.7
3
3
  * https://quilljs.com/
4
4
  * Copyright (c) 2014, Jason Chen