PageSourceSearch

https://skyfree.io/assets/custom-fields-DyYwMO2Y.js

js skyfree.io collected 2026-10-10 02:45:48 UTC 40,632 bytes, 13 lines download raw bytes

1import{d as Xe,f as Je,c as Ie,r as l,u as Ze,j as e,b as k,o as hs}from"./index-CyVA1wZG.js";import{b as es,b3 as He,b4 as Ge,e as m,bh as ps,bi as fs,bk as js,n as _,P as re,D as Te,o as ke,p as Se,q as De,r as qe,s as E,t as Oe,g as ss,h as ts,i as is,j as ls,k as d,aT as as,_ as rs,$ as ns,a0 as os,a1 as cs,l as gs,aK as ue,a9 as vs,aa as ys,ab as bs,ac as We}from"./impersonation-banner-D_-on_xF.js";import{u as ds}from"./usePlanLimit-C82xDx5H.js";import{f as Re}from"./timezone-utils-Di2WsDPr.js";import{T as ms}from"./textarea-BAAzCWx0.js";import{C as Ye}from"./checkbox-Bz5Ppm-b.js";import{L as Ns}from"./loading-DfhTHglN.js";import{T as Fs,a as ws,b as we,c as G,d as Cs,e as p}from"./table-vgAu5oIo.js";import{R as _e}from"./resource-page-DZ083Zl8.js";import{T as xe}from"./trash-C0cniiE4.js";import{S as Pe}from"./square-pen-DRDG8PZg.js";import{L as he}from"./list-tree-BljQWPPB.js";import{R as us}from"./refresh-cw-bmXc0t69.js";import{c as Ts}from"./App-CWO1MySO.js";import{N as ks}from"./nova-resource-page-tJJ4o3y3.js";import{N as Ss}from"./nova-toolbar-5pG5vU1q.js";import{N as Ds}from"./nova-status-tiles-CdCILmr5.js";import{N as qs}from"./nova-bulk-action-bar-Dwr-guG7.js";import{a as Ve,N as Os,b as Rs}from"./date-time-picker-Cq4LNC5d.js";import{N as xs}from"./nova-empty-state-BKte_8-o.js";import{N as Ps}from"./nova-pagination-2PP_Mw-p.js";import{a as Is}from"./nova-page-loading-skeleton-BazY73MQ.js";import"./tabs-BSv5s0B5.js";import{N as As,a as Es,b as Ls,c as Ms}from"./nova-table-columns-C66BCWpB.js";import{E as $s}from"./ellipsis-Dquka5Nr.js";import"./index-Cjkq8cs_.js";import"./format-cwji8z7Q.js";import"./subDays-DPIRz014.js";import"./page-shell-Dh0kFaWJ.js";import"./useDocForPage-BGLLPY-H.js";import"./library-toolbar-CnTpXEG9.js";import"./page-stat-_AnloxDa.js";import"./minimize-2-N7svW4OO.js";import"./filter-CenHxjh1.js";import"./calendar-DeeSB-aS.js";import"./clock-UctaHBkk.js";import"./calendar-UomhDNlY.js";import"./skeleton-B2sPiNj4.js";const Qe=()=>e.jsxs(we,{className:"animate-pulse",children:[e.jsx(p,{children:e.jsx("div",{className:"h-4 w-32 rounded bg-surface-strong"})}),e.jsx(p,{children:e.jsx("div",{className:"h-4 w-24 rounded bg-surface-strong"})}),e.jsx(p,{children:e.jsx("div",{className:"h-4 w-16 rounded bg-surface-strong"})}),e.jsx(p,{children:e.jsx("div",{className:"h-4 w-24 rounded bg-surface-strong"})}),e.jsx(p,{children:e.jsx("div",{className:"h-8 w-24 rounded bg-surface-strong"})})]}),zs=({onCreateClick:a})=>{const{t:f}=Ie();return e.jsx(He,{className:"border-dashed border-2 border-line-strong",children:e.jsxs(Ge,{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[e.jsx("div",{className:"rounded-full bg-surface-subtle p-6 mb-4",children:e.jsx(he,{className:"h-12 w-12 text-content-muted"})}),e.jsx("h3",{className:"text-xl font-semibold mb-2 text-content",children:f("customFields.noFields")}),e.jsx("p",{className:"text-content-tertiary mb-6 max-w-sm",children:f("customFields.noFieldsDesc")}),e.jsxs(m,{className:"bg-green-600 hover:bg-green-700 text-white",onClick:a,children:[e.jsx(re,{className:"mr-2",size:16})," ",f("customFields.createFirst")]})]})})};function Bs(){const{toast:a}=es(),{user:f,isLoading:Ae}=Xe(),X=Je(),{t:s}=Ie(),[j,Ee]=l.useState([]),[C,pe]=l.useState(!0),[Le,J]=l.useState(!1),[Me,S]=l.useState(!1),[N,Z]=l.useState(!1),[u,F]=l.useState(!1),[R,$e]=l.useState(""),[fe,je]=l.useState(null),[x,L]=l.useState([]),[ze,M]=l.useState(!1),[ee,ge]=l.useState(""),[g,ve]=l.useState("text"),[ne,$]=l.useState(""),[v,z]=l.useState(""),[ye,B]=l.useState(!1),[oe,Y]=l.useState(null),[D,P]=l.useState(1),[K,be]=l.useState(5),{limit:y,isLoading:se,checkAndProceed:V}=ds("custom-field"),{data:te}=Ze({queryKey:["/api/channels/active"],queryFn:async()=>{const i=await k("GET","/api/channels/active");return i.ok?await i.json():null},enabled:!Ae&&!!f}),q=async()=>{if(te?.id)try{pe(!0);const n=await(await k("GET",`/api/custom-fields?channelId=${te?.id}`)).json();Ee(n||[])}catch(i){console.error(i),a({title:s("common.error"),description:s("customFields.error.loadFailed"),variant:"destructive"})}finally{pe(!1)}};l.useEffect(()=>{te?.id&&q()},[te?.id]),l.useEffect(()=>{P(1)},[R,K]);const U=l.useMemo(()=>j.filter(i=>{const n=R.toLowerCase().trim();return n?i.fieldName.toLowerCase().includes(n)||i.fieldType.toLowerCase().includes(n):!0}).sort((i,n)=>(i.displayOrder??0)-(n.displayOrder??0)||i.fieldName.localeCompare(n.fieldName)),[j,R]),T=l.useMemo(()=>{const i=j.length,n=j.filter(c=>c.isRequired).length,A=i-n;return{total:i,required:n,optional:A}},[j]),I=Math.max(1,Math.ceil(U.length/K)||1);l.useEffect(()=>{D>I&&P(I)},[D,I]);const Q=(D-1)*K,w=U.slice(Q,Q+K),W=Math.min(K,5),ce=w.length<W?[...w,...Array.from({length:W-w.length},()=>null)]:w,de=8,H=i=>{i?(Z(!0),Y(i.id),ge(i.fieldName),ve(i.fieldType),$(i.fieldOptions?.join(`
2`)||""),z(String(i.displayOrder??0)),B(i.isRequired)):(Z(!1),Y(null),ge(""),ve("text"),$(""),z(""),B(!1)),J(!0)},ie=()=>{J(!1),Z(!1),Y(null),ge(""),ve("text"),$(""),z(""),B(!1)},me=async()=>
2{if(!ee.trim())return a({title:s("common.error"),description:s("customFields.validation.nameRequired"),variant:"destructive"});if(!g)return a({title:s("common.error"),description:s("customFields.validation.typeRequired"),variant:"destructive"});const i=g==="dropdown"||g==="label"?ne.split(`
3`).map(c=>c.trim()).filter(Boolean):null;if(i){const c=new Set,ae=new Set;for(const t of i)c.has(t)&&ae.add(t),c.add(t);if(ae.size>0)return a({title:s("common.error"),description:s("customFields.validation.duplicateOptions",{values:Array.from(ae).join(", ")}),variant:"destructive"})}let n;if(v.trim()!==""){const c=Number(v.trim());if(!Number.isInteger(c)||c<0)return a({title:s("common.error"),description:s("customFields.validation.priorityInvalid"),variant:"destructive"});n=c}const A={fieldName:ee,fieldType:g,fieldOptions:i,isRequired:ye,channelId:te?.id,...n!==void 0?{displayOrder:n}:{}};F(!0);try{let c;if(N&&oe?c=await k("PUT",`/api/custom-fields/${oe}`,A):c=await k("POST","/api/custom-fields",A),c.ok)a({title:s("common.success"),description:s(N?"customFields.success.updated":"customFields.success.created")}),ie(),X.invalidateQueries({queryKey:["/api/custom-fields"]}),q();else{const ae=await c.json();a({title:s("common.error"),description:ae.message||s(N?"customFields.error.updateFailed":"customFields.error.createFailed"),variant:"destructive"})}}catch(c){console.error(c),a({title:s("common.error"),description:s(N?"customFields.error.updateFailed":"customFields.error.createFailed"),variant:"destructive"})}finally{F(!1)}},le=i=>{je(i),S(!0)},Ce=async()=>{if(fe){F(!0);try{const i=await k("DELETE",`/api/custom-fields/${fe}`);if(i.ok)a({title:s("common.success"),description:s("customFields.success.deleted")}),S(!1),je(null),X.invalidateQueries({queryKey:["/api/custom-fields"]}),q();else{const n=await i.json();a({title:s("common.error"),description:n.message||s("customFields.error.deleteFailed"),variant:"destructive"})}}catch(i){console.error(i),a({title:s("common.error"),description:s("customFields.error.deleteFailed"),variant:"destructive"})}finally{F(!1)}}},O=w.map(i=>i?.id).filter(Boolean),Ne=O.length>0&&O.every(i=>x.includes(i)),Be=()=>{L(Ne?i=>i.filter(n=>!O.includes(n)):i=>Array.from(new Set([...i,...O])))},Fe=i=>{L(n=>n.includes(i)?n.filter(A=>A!==i):[...n,i])},Ke=async()=>{if(x.length!==0){F(!0);try{const i=x.map(c=>k("DELETE",`/api/custom-fields/${c}`));(await Promise.all(i)).every(c=>c.ok)?(a({title:s("common.success"),description:`${x.length} field(s) deleted successfully`}),M(!1),L([]),X.invalidateQueries({queryKey:["/api/custom-fields"]}),q()):a({title:s("common.error"),description:s("customfields.failedToDeleteSomeFields"),variant:"destructive"})}catch(i){console.error(i),a({title:s("common.error"),description:s("customfields.failedToDeleteFields"),variant:"destructive"})}finally{F(!1)}}};return C?e.jsx(_e,{title:s("customFields.title"),subtitle:s("customFields.subtitle"),padding:"comfortable",spacing:!1,contentClassName:"flex items-center justify-center",children:e.jsx(Ns,{})}):e.jsxs(_e,{title:s("customFields.title"),subtitle:s("customFields.subtitle"),padding:"roomy",spacing:!1,contentClassName:"space-y-6",stats:[{label:s("customFields.title"),value:T.total,description:s("customfields.totalCustomFields"),icon:e.jsx(he,{}),tone:"info"},{label:s("customfields.required"),value:T.required,description:s("customfields.fieldsRequiredOnCreate"),icon:e.jsx(Ts,{}),tone:"success"},{label:s("customfields.optional"),value:T.optional,description:s("customfields.fieldsNotRequired"),icon:e.jsx(gs,{}),tone:"warning"}],library:{title:s("customfields.fieldLibrary"),description:s("customfields.searchAndManageCustomFields"),search:{value:R,onChange:i=>$e(i),placeholder:s("common.search")},filters:e.jsxs(m,{variant:"outline",size:"sm",className:"px-2.5",onClick:q,disabled:C,children:[e.jsx(us,{className:`h-4 w-4 text-green-600 ${C?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline ml-1.5 text-xs",children:s("common.refresh")??"Refresh"})]}),actions:e.jsx(rs,{children:e.jsxs(ns,{children:[e.jsx(os,{asChild:!0,children:e.jsxs(m,{className:"btn-primary-gradient text-white",size:"sm",onClick:()=>V(()=>H()),disabled:se||!y?.allowed,children:[e.jsx(re,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline ml-1.5 text-xs",children:s("customFields.addField")}),y&&e.jsxs("span",{className:"text-xs ml-1.5 opacity-75",children:["(",y.current,"/",y.limit,")"]})]})}),e.jsx(cs,{side:"bottom",className:"bg-surface text-content border border-line z-50",children:se?e.jsx("p",{className:"text-sm",children:s("customfields.loadingPlanInfo")}):y?.allowed?e.jsx("p",{className:"text-sm",children:s("customfields.createANewCustomField")}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold text-red-600",children:s("customfields.upgradeYourPlan")}),y&&e.jsxs("p",{className:"text-xs text-content-secondary",children:["Used: ",y.current,"/",y.limit]})]})})]})})},children:[x.length>0&&e.jsx(He,{className:"border-tint-info-border bg-tint-info",children:e.jsx(Ge,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[x.length," field(s) selected"]}),e.jsxs(m,{variant:"outline",size:"sm",className:"text-red-600 text-xs sm:text-sm",onClick:()=>M(!0),children:[e.jsx(xe,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 mr-1.5 sm:mr-2"}),"Delete Selected"]})]})})}),!C&&j.length===0&&!R?e.jsx(zs,{onCreateClick:()=>H()}):e.jsxs(e.Fragment,{children:[e.jsxs(He,{className:"shadow-sm overflow-hidden flex flex-col lg:flex-1 lg:overflow-hidden hidden sm:block",children:[e.jsxs(ps,{className:"flex-shrink-0",children:[e.jsx(fs,{children:s("inbox.customFields")}),e.jsx(js,{children:s("customfields.manageYourCustomFieldsForContactsAndFlows")})]}),e.jsxs(Ge,{className:"flex flex-col p-0 lg:flex-1 lg:overflow-hidden",children:[e.jsx("div",{className:"flex-1 overflow-visible sm:overflow-auto px-4 sm:px-6 py-4 sm:py-0 scrollbar-thin",children:e.jsxs(Fs,{className:"min-w-full",children:[e.jsx(ws,{children:e.jsxs(we,{children:[e.jsx(G,{className:"w-12",children:e.jsx("input",{type:"checkbox",className:"rounded border-line-strong",checked:Ne,onChange:Be})}),e.jsx(G,{className:"w-16",children:"No"}),e.jsx(G,{className:"w-24",children:s("customFields.priority")}),e.jsx(G,{children:s("customFields.fieldName")}),e.jsx(G,{children:s("customFields.fieldKey")}),e.jsx(G,{children:s("customFields.fieldType")}),e.jsx(G,{children:s("customFields.isRequired")}),e.jsx(G,{children:s("common.date")}),e.jsx(G,{className:"text-center",children:s("common.actions")})]})}),e.jsx(Cs,{children:C?e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsx(Qe,{}),e.jsx(Qe,{})]}):U.length===0?e.jsx(we,{children:e.jsx(p,{colSpan:9,className:"text-center py-8 text-muted-foreground",children:s("customFields.noFields")})}):ce.map((i,n)=>i?e.jsxs(we,{children:[e.jsx(p,{className:"w-12",children:e.jsx("input",{type:"checkbox",className:"rounded border-line-strong",checked:x.includes(i.id),onChange:()=>Fe(i.id)})}),e.jsx(p,{className:"w-16",children:e.jsx("span",{className:"text-muted-foreground",children:Q+n+1})}),e.jsx(p,{children:e.jsx(_,{variant:"outline",children:i.displayOrder??0})}),e.jsx(p,{className:"font-medium",children:i.fieldName}),e.jsx(p,{children:e.jsx("code",{className:"rounded bg-surface-subtle px-1.5 py-0.5 text-xs text-content-secondary",children:i.fieldKey||"-"})}),e.jsx(p,{children:e.jsx(_,{variant:"secondary",children:s(`customFields.fieldTypes.${i.fieldType}`)})}),e.jsx(p,{children:i.isRequired?e.jsx(_,{variant:"destructive",children:s("common.yes")}):e.jsx(_,{variant:"outline",children:s("common.no")})}),e.jsx(p,{children:Re(i.createdAt,f?.timezone||"UTC")}),e.jsx(p,{children:e.jsxs("div",{className:"flex gap-2 justify-center",children:[e.jsx(m,{variant:"outline",size:"sm",className:"px-2",onClick:()=>H(i),title:s("common.edit"),children:e.jsx(Pe,{className:"h-4 w-4"})}),e.jsx(m,{variant:"outline",size:"sm",className:"px-2",onClick:()=>le(i.id),title:s("customfields.delete"),children:e.jsx(xe,{className:"h-4 w-4 text-red-500"})})]})})]},i.id):e.jsx(we,{className:"h-[60px] border-0 [&>*]:border-0",children:Array.from({length:de+1}).map((A,c)=>e.jsx(p,{className:"text-transparent border-0",children:"-"},`placeholder-${n}-${c}`))},`placeholder-${n}`))})]})}),e.jsxs("div",{className:"flex-shrink-0 w-full px-4 sm:px-6 py-4 border-t flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-content-secondary",children:[e.jsxs("span",{children:["Showing ",U.length===0?0:Q+1," to ",Math.min(Q+w.length,U.length)," of ",U.length," fields"]}),e.jsx("select",{value:K,onChange:i=>
3{be(Number(i.target.value)),P(1)},className:"border rounded-md px-2 py-1 text-sm focus:outline-none focus:ring-1 focus:ring-green-500",children:[5,10,20,50,100].map(i=>e.jsx("option",{value:i,children:i},i))})]}),e.jsxs("div",{className:"flex items-center gap-3 text-sm text-content-secondary",children:[e.jsxs("button",{onClick:()=>P(Math.max(D-1,1)),disabled:D===1,className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-line bg-surface text-content-secondary hover:bg-surface-muted disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx("span",{className:"text-lg leading-none",children:"‹"}),"Previous"]}),e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-line bg-surface",children:[e.jsx("span",{className:"font-semibold text-content-secondary",children:D}),e.jsx("span",{className:"text-content-tertiary",children:"/"}),e.jsx("span",{className:"text-content-secondary",children:Math.max(I,1)})]}),e.jsxs("button",{onClick:()=>P(Math.min(D+1,I||1)),disabled:D===I||I===0,className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-line bg-surface text-content-secondary hover:bg-surface-muted disabled:opacity-50 disabled:cursor-not-allowed",children:["Next",e.jsx("span",{className:"text-lg leading-none",children:"›"})]})]})]})]})]}),e.jsx("div",{className:"sm:hidden space-y-3",children:C?[1,2,3].map(i=>e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4 shadow-sm animate-pulse",children:[e.jsx("div",{className:"h-4 w-1/2 roun
3ded bg-surface-strong"}),e.jsx("div",{className:"mt-3 h-4 w-1/3 rounded bg-surface-strong"}),e.jsx("div",{className:"mt-3 h-4 w-1/4 rounded bg-surface-strong"})]},`field-skeleton-${i}`)):U.length===0?e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-6 text-center shadow-sm",children:[e.jsx(he,{className:"mx-auto h-10 w-10 text-content-muted"}),e.jsx("p",{className:"mt-3 text-base font-medium text-content",children:s("customFields.noFields")}),e.jsx("p",{className:"mt-1 text-sm text-content-tertiary",children:s("customFields.noFieldsDesc")}),e.jsxs(m,{className:"mt-4 w-full",onClick:()=>H(),children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),s("customFields.addField")]})]}):w.map((i,n)=>e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-base font-semibold text-content",children:i.fieldName}),e.jsxs("p",{className:"text-xs text-content-tertiary",children:["#",Q+n+1]}),i.fieldKey&&e.jsx("code",{className:"mt-1 inline-block rounded bg-surface-subtle px-1.5 py-0.5 text-xs text-content-secondary",children:i.fieldKey}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-sm text-content-secondary",children:[e.jsxs(_,{variant:"outline",children:[s("customFields.priority"),": ",i.displayOrder??0]}),e.jsx(_,{variant:"secondary",children:s(`customFields.fieldTypes.${i.fieldType}`)}),i.isRequired?e.jsx(_,{variant:"destructive",children:s("common.yes")}):e.jsx(_,{variant:"outline",children:s("common.no")})]}),e.jsx("p",{className:"mt-2 text-xs text-content-tertiary",children:Re(i.createdAt,f?.timezone||"UTC")})]}),e.jsx("input",{type:"checkbox",className:"mt-1 h-5 w-5 rounded border-line-strong",checked:x.includes(i.id),onChange:()=>Fe(i.id)})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[e.jsxs(m,{variant:"outline",size:"sm",className:"flex-1 min-w-[120px]",onClick:()=>H(i),children:[e.jsx(Pe,{className:"mr-2 h-4 w-4"}),s("common.edit")]}),e.jsxs(m,{variant:"outline",size:"sm",className:"flex-1 min-w-[120px] text-red-600",onClick:()=>le(i.id),children:[e.jsx(xe,{className:"mr-2 h-4 w-4"}),s("common.delete")]})]})]},`field-card-${i.id}`))})]}),e.jsx(Te,{open:Le,onOpenChange:J,children:e.jsxs(ke,{children:[e.jsxs(Se,{children:[e.jsx(De,{children:s(N?"common.edit":"customFields.addField")}),e.jsx(qe,{children:s("customFields.subtitle")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-sm",children:s("customFields.fieldName")}),e.jsx(Oe,{value:ee,onChange:i=>ge(i.target.value),placeholder:s("customfields.eGCompany")})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-sm",children:s("customFields.priority")}),e.jsx(Oe,{type:"number",min:0,step:1,value:v,onChange:i=>z(i.target.value),placeholder:"0"}),e.jsx("p",{className:"mt-1 text-xs text-content-tertiary",children:s("customFields.priorityHelp")})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-sm",children:s("customFields.fieldType")}),e.jsxs(ss,{value:g,onValueChange:ve,children:[e.jsx(ts,{children:e.jsx(is,{placeholder:s("customFields.fieldType")})}),e.jsxs(ls,{children:[e.jsx(d,{value:"text",children:s("customFields.fieldTypes.text")}),e.jsx(d,{value:"number",children:s("customFields.fieldTypes.number")}),e.jsx(d,{value:"email",children:s("customFields.fieldTypes.email")}),e.jsx(d,{value:"phone",children:s("customFields.fieldTypes.phone")}),e.jsx(d,{value:"date",children:s("customFields.fieldTypes.date")}),e.jsx(d,{value:"time",children:s("customFields.fieldTypes.time")}),e.jsx(d,{value:"datetime",children:s("customFields.fieldTypes.datetime")}),e.jsx(d,{value:"url",children:s("customFields.fieldTypes.url")}),e.jsx(d,{value:"image",children:s("customFields.fieldTypes.image")}),e.jsx(d,{value:"video",children:s("customFields.fieldTypes.video")}),e.jsx(d,{value:"file",children:s("customFields.fieldTypes.file")}),e.jsx(d,{value:"label",children:s("customFields.fieldTypes.label")}),e.jsx(d,{value:"dropdown",children:s("customFields.fieldTypes.dropdown")})]})]})]}),(g==="dropdown"||g==="label")&&e.jsxs("div",{children:[e.jsx(E,{className:"text-sm",children:g==="label"?"Allowed services / products (one per line)":"Options (one per line)"}),e.jsx(ms,{value:ne,onChange:i=>$(i.target.value),placeholder:g==="label"?`Service A
4Service B
5Service C`:`Option A
6Option B
7Option C`,rows:5}),g==="label"&&e.jsx("p",{className:"mt-2 text-xs text-content-tertiary",children:"Team members will search and select only from this allowed list. Multiple selections are supported."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ye,{id:"isRequired",checked:ye,onCheckedChange:i=>B(!!i)}),e.jsx(E,{htmlFor:"isRequired",className:"text-sm",children:s("customFields.isRequired")})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 mt-4",children:[e.jsx(m,{variant:"outline",onClick:ie,children:s("common.cancel")}),e.jsx(m,{onClick:me,disabled:u,children:s(u?"common.saving":"common.save")})]})]})}),Me&&as.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",style:{padding:"1rem"},onClick:()=>!u&&S(!1),children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>!u&&S(!1)}),e.jsxs("div",{className:"relative bg-surface rounded-lg flex flex-col shadow-lg",style:{width:"calc(100vw - 2rem)",maxWidth:"400px",overflow:"hidden",boxSizing:"border-box"},onClick:i=>i.stopPropagation(),children:[e.jsxs("div",{className:"px-4 sm:px-5 py-3 sm:py-4 border-b border-line flex-shrink-0",children:[e.jsx("h2",{className:"text-lg font-semibold text-content",children:s("customFields.delete.title")}),e.jsx("p",{className:"text-sm text-content-tertiary mt-1",children:s("customFields.delete.description")})]}),e.jsxs("div",{className:"px-4 sm:px-5 py-3 sm:py-4 flex-shrink-0 flex gap-3 border-t border-line",children:[e.jsx(m,{variant:"outline",className:"flex-1",onClick:()=>S(!1),disabled:u,children:s("common.cancel")}),e.jsx(m,{variant:"destructive",className:"flex-1",onClick:Ce,disabled:u,children:s(u?"customFields.delete.deleting":"customFields.delete.confirm")})]})]})]}),document.body),e.jsx(Te,{open:ze,onOpenChange:M,children:e.jsxs(ke,{children:[e.jsxs(Se,{children:[e.jsxs(De,{children:["Delete ",x.length," field(s)?"]}),e.jsx(qe,{children:"This action cannot be undone. The selected fields will be permanently deleted."})]}),e.jsxs("div",{className:"flex justify-end gap-3 mt-4",children:[e.jsx(m,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),e.jsx(m,{variant:"destructive",onClick:Ke,disabled:u,children:u?"Deleting...":"Delete Fields"})]})]})})]})}const Ks=({onCreateClick:a})=>{const{t:f}=Ie();return e.jsx(xs,{icon:e.jsx(he,{className:"h-6 w-6"}),title:f("customFields.noFields"),description:f("customFields.noFieldsDesc"),action:e.jsxs(Ve,{onClick:a,children:[e.jsx(re,{className:"h-4 w-4"})," ",f("customFields.createFirst")]})})};function Us(){const{toast:a}=es(),{user:f,isLoading:Ae}=Xe(),X=Je(),{t:s}=Ie(),[j,Ee]=l.useState([]),[C,pe]=l.useState(!0),[Le,J]=l.useState(!1),[Me,S]=l.useState(!1),[N,Z]=l.useState(!1),[u,F]=l.useState(!1),[R,$e]=l.useState(""),[fe,je]=l.useState(null),[x,L]=l.useState([]),[ze,M]=l.useState(!1),[ee,ge]=l.useState(null),[g,ve]=l.useState("asc"),[ne,$]=l.useState(""),[v,z]=l.useState("text"),[
7ye,B]=l.useState(""),[oe,Y]=l.useState(""),[D,P]=l.useState(!1),[K,be]=l.useState(null),[y,se]=l.useState(1),[V,te]=l.useState(10),[q,U]=l.useState("all"),{limit:T,isLoading:I,checkAndProceed:Q}=ds("custom-field"),{data:w}=Ze({queryKey:["/api/channels/active"],queryFn:async()=>{const t=await k("GET","/api/channels/active");return t.ok?await t.json():null},enabled:!Ae&&!!f}),W=async()=>{if(w?.id)try{pe(!0);const r=await(await k("GET",`/api/custom-fields?channelId=${w?.id}`)).json();Ee(r||[])}catch(t){console.error(t),a({title:s("common.error"),description:s("customFields.error.loadFailed"),variant:"destructive"})}finally{pe(!1)}};l.useEffect(()=>{w?.id&&W()},[w?.id]),l.useEffect(()=>{se(1)},[R,V,q]);const ce=l.useMemo(()=>j.filter(t=>{if(q==="required"&&!t.isRequired||q==="optional"&&t.isRequired)return!1;const r=R.toLowerCase().trim();return r?t.fieldName.toLowerCase().includes(r)||t.fieldType.toLowerCase().includes(r):!0}),[j,R,q]),de=l.useMemo(()=>{if(!ee)return[...ce].sort((r,h)=>(r.displayOrder??0)-(h.displayOrder??0)||r.fieldName.localeCompare(h.fieldName));const t=[...ce];return t.sort((r,h)=>{let o="",b="";switch(ee){case"fieldName":o=r.fieldName,b=h.fieldName;break;case"fieldKey":o=r.fieldKey||"",b=h.fieldKey||"";break;case"fieldType":o=r.fieldType,b=h.fieldType;break;case"isRequired":o=r.isRequired?1:0,b=h.isRequired?1:0;break;case"date":o=new Date(r.createdAt).getTime(),b=new Date(h.createdAt).getTime();break;default:o=r.fieldName,b=h.fieldName;break}return o<b?g==="asc"?-1:1:o>b?g==="asc"?1:-1:0}),t},[ce,ee,g]),H=l.useMemo(()=>{const t=j.length,r=j.filter(o=>o.isRequired).length,h=t-r;return{total:t,required:r,optional:h}},[j]),ie=Math.max(1,Math.ceil(de.length/V)||1);l.useEffect(()=>{y>ie&&se(ie)},[y,ie]);const me=(y-1)*V,le=de.slice(me,me+V),Ce=de.length;Math.min(me+le.length,Ce);const O=t=>{t?(Z(!0),be(t.id),$(t.fieldName),z(t.fieldType),B(t.fieldOptions?.join(`
8`)||""),Y(String(t.displayOrder??0)),P(t.isRequired)):(Z(!1),be(null),$(""),z("text"),B(""),Y(""),P(!1)),J(!0)},Ne=()=>{J(!1),Z(!1),be(null),$(""),z("text"),B(""),Y(""),P(!1)},Be=async()=>{if(!ne.trim())return a({title:s("common.error"),description:s("customFields.validation.nameRequired"),variant:"destructive"});if(!v)return a({title:s("common.error"),description:s("customFields.validation.typeRequired"),variant:"destructive"});const t=v==="dropdown"||v==="label"?ye.split(`
9`).map(o=>o.trim()).filter(Boolean):null;if(t){const o=new Set,b=new Set;for(const Ue of t)o.has(Ue)&&b.add(Ue),o.add(Ue);if(b.size>0)return a({title:s("common.error"),description:s("customFields.validation.duplicateOptions",{values:Array.from(b).join(", ")}),variant:"destructive"})}let r;if(oe.trim()!==""){const o=Number(oe.trim());if(!Number.isInteger(o)||o<0)return a({title:s("common.error"),description:s("customFields.validation.priorityInvalid"),variant:"destructive"});r=o}const h={fieldName:ne,fieldType:v,fieldOptions:t,isRequired:D,channelId:w?.id,...r!==void 0?{displayOrder:r}:{}};F(!0);try{let o;if(N&&K?o=await k("PUT",`/api/custom-fields/${K}`,h):o=await k("POST","/api/custom-fields",h),o.ok)a({title:s("common.success"),description:s(N?"customFields.success.updated":"customFields.success.created")}),Ne(),X.invalidateQueries({queryKey:["/api/custom-fields"]}),W();else{const b=await o.json();a({title:s("common.error"),description:b.message||s(N?"customFields.error.updateFailed":"customFields.error.createFailed"),variant:"destructive"})}}catch(o){console.error(o),a({title:s("common.error"),description:s(N?"customFields.error.updateFailed":"customFields.error.createFailed"),variant:"destructive"})}finally{F(!1)}},Fe=t=>{je(t),S(!0)},Ke=async()=>{if(fe){F(!0);try{const t=await k("DELETE",`/api/custom-fields/${fe}`);if(t.ok)a({title:s("common.success"),description:s("customFields.success.deleted")}),S(!1),je(null),X.invalidateQueries({queryKey:["/api/custom-fields"]}),W();else{const r=await t.json();a({title:s("common.error"),description:r.message||s("customFields.error.deleteFailed"),variant:"destructive"})}}catch(t){console.error(t),a({title:s("common.error"),description:s("customFields.error.deleteFailed"),variant:"destructive"})}finally{F(!1)}}},i=le.map(t=>
9t?.id).filter(Boolean),n=i.length>0&&i.every(t=>x.includes(t)),A=()=>{L(n?t=>t.filter(r=>!i.includes(r)):t=>Array.from(new Set([...t,...i])))},c=t=>{L(r=>r.includes(t)?r.filter(h=>h!==t):[...r,t])},ae=async()=>{if(x.length!==0){F(!0);try{const t=x.map(o=>k("DELETE",`/api/custom-fields/${o}`));(await Promise.all(t)).every(o=>o.ok)?(a({title:s("common.success"),description:`${x.length} field(s) deleted successfully`}),M(!1),L([]),X.invalidateQueries({queryKey:["/api/custom-fields"]}),W()):a({title:s("common.error"),description:s("customfields.failedToDeleteSomeFields"),variant:"destructive"})}catch(t){console.error(t),a({title:s("common.error"),description:s("customfields.failedToDeleteFields"),variant:"destructive"})}finally{F(!1)}}};return C?e.jsx(Is,{title:s("customFields.title"),subtitle:s("customFields.subtitle"),docPath:"workspace/contacts/custom-fields",actions:e.jsxs(Ve,{onClick:()=>Q(()=>O()),children:[e.jsx(re,{className:"h-4 w-4"})," ",s("customFields.addField")]}),statCount:3,columns:5}):e.jsxs(ks,{title:s("customFields.title"),subtitle:s("customFields.subtitle"),searchPlaceholder:s("common.search"),onSearch:$e,panel:!1,actions:e.jsx(rs,{children:e.jsxs(ns,{children:[e.jsx(os,{asChild:!0,children:e.jsx("div",{children:e.jsxs(Ve,{onClick:()=>Q(()=>O()),disabled:I||!T?.allowed,children:[e.jsx(re,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:s("customFields.addField")}),T&&e.jsxs("span",{className:"text-xs opacity-75",children:["(",T.current,"/",T.limit,")"]})]})})}),e.jsx(cs,{side:"bottom",children:I?e.jsx("p",{className:"text-sm",children:s("customfields.loadingPlanInfo")}):T?.allowed?e.jsx("p",{className:"text-sm",children:s("customfields.createANewCustomField")}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold text-tint-danger-fg-soft",children:s("customfields.upgradeYourPlan")}),T&&e.jsxs("p",{className:"text-xs text-content-secondary",children:["Used: ",T.current,"/",T.limit]})]})})]})}),filters:e.jsx(Ds,{items:[{id:"all",label:s("customFields.title"),value:H.total},{id:"required",label:s("customfields.required"),value:H.required},{id:"optional",label:s("customfields.optional"),value:H.optional}],value:q,onChange:t=>U(t)}),toolbar:e.jsx(Ss,{actions:e.jsxs(m,{variant:"outline",size:"sm",className:"h-9 rounded-lg border border-line bg-surface px-3 hover:bg-surface-muted",onClick:W,disabled:C,children:[e.jsx(us,{className:`h-4 w-4 text-content-tertiary ${C?"animate-spin":""}`}),e.jsx("span",{className:"ml-1.5 text-sm font-medium",children:s("common.refresh")??"Refresh"})]})}),children:[e.jsx(qs,{count:x.length,label:`${x.length} field(s) selected`,actions:e.jsxs(Os,{className:"text-tint-danger-fg-soft",onClick:()=>M(!0),children:[e.jsx(xe,{className:"h-3.5 w-3.5"}),"Delete Selected"]})}),!C&&j.length===0&&!R?e.jsx(Ks,{onCreateClick:()=>O()}):de.length===0?e.jsx(xs,{icon:e.jsx(he,{className:"h-6 w-6"}),title:s("customFields.noFields"),description:j.length===0?s("customFields.noFieldsDesc"):s("customFields.noFields")}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden sm:block overflow-x-auto",children:e.jsxs("table",{className:"nova-table w-full min-w-[900px] border-collapse text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(As,{checked:n,onChange:A}),e.jsx(Es,{}),e.jsx("th",{children:s("customFields.priority")}),e.jsx("th",{children:s("customFields.fieldName")}),e.jsx("th",{children:s("customFields.fieldKey")}),e.jsx("th",{children:s("customFields.fieldType")}),e.jsx("th",{children:s("customFields.isRequired")}),e.jsx("th",{children:s("common.date")}),e.jsx("th",{className:"w-12 text-right",children:e.jsx("span",{className:"sr-only",children:s("common.actions")})})]})}),e.jsx("tbody",{children:le.map((t,r)=>e.jsxs("tr",{className:"group cursor-pointer",children:[e.jsx(Ls,{checked:x.includes(t.id),onChange:()=>c(t.id)}),e.jsx(Ms,{page:y,pageSize:V,index:r}),e.jsx("td",{children:e.jsx(ue,{tone:"neutral",children:t.displayOrder??0})}),e.jsx("td",{children:e.jsx("div",{className:"truncate text-[15px] font-semibold tracking-[-0.01em] text-[var(--nova-text-primary)]",style:{fontFamily:'-apple-system, "system-ui", "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:t.fieldName})}),e.jsx("td",{children:e.jsx("code",{className:"rounded border border-[var(--nova-border)] bg-[var(--nova-hover-bg)] px-2 py-0.5 text-xs text-[var(--nova-text-secondary)]",children:t.fieldKey||"-"})}),e.jsx("td",{children:e.jsx(ue,{tone:t.fieldType==="text"?"success":t.fieldType==="number"?"info":t.fieldType==="email"?"warning":t.fieldType==="phone"?"accent":t.fieldType==="date"?"info":"neutral",children:s(`customFields.fieldTypes.${t.fieldType}`)})}),e.jsx("td",{children:e.jsx(ue,{tone:t.isRequired?"success":"neutral",children:t.isRequired?"Yes":"No"})}),e.jsx("td",{className:"whitespace-nowrap",children:Re(t.createdAt,f?.timezone||"UTC")}),e.jsx("td",{className:"text-right opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",onClick:h=>h.stopPropagation(),children:e.jsxs(vs,{children:[e.jsx(ys,{asChild:!0,children:e.jsx(Rs,{className:"h-8 w-8 border border-[var(--nova-border)] bg-[var(--nova-panel-bg)] shadow-none hover:bg-[var(--nova-hover-bg)]","aria-label":s("common.actions"),children:e.jsx($s,{className:"h-4 w-4 stroke-[1.9]"})})}),e.jsxs(bs,{align:"end",className:"w-56 rounded-lg border border-[var(--nova-border)] bg-[var(--nova-panel-bg)] p-1 shadow-lg",children:[e.jsxs(We,{onClick:()=>O(t),className:"gap-2.5 px-3 py-2 text-[14px] font-normal leading-5 text-[var(--nova-text-primary)] hover:bg-[var(--nova-hover-bg)] focus:bg-[var(--nova-hover-bg)]",style:{fontFamily:'-apple-system, "system-ui", "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:[e.jsx(Pe,{className:"h-4 w-4 shrink-0 stroke-[1.9] text-[var(--nova-text-icon)]"}),s("common.edit")]}),e.jsxs(We,{className:"gap-2.5 px-3 py-2 text-[14px] font-normal leading-5 text-[#C0321C] hover:bg-[var(--nova-hover-bg)] focus:bg-[var(--nova-hover-bg)] focus:text-[#C0321C]",style:{fontFamily:'-apple-system, "system-ui", "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},onClick:()=>Fe(t.id),children:[e.jsx(xe,{className:"h-4 w-4 shrink-0 stroke-[1.9] text-[#C0321C]"}),s("customfields.delete")]})]})]})})]},t.id))})]})}),e.jsx(Ps,{page:y,totalPages:Math.max(ie,1),total:Ce,pageSize:V,onPageChange:se,onPageSizeChange:t=>{te(t),se(1)}}),e.jsx("div",{className:"sm:hidden space-y-3",children:C?[1,2,3].map(t=>e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4 shadow-sm animate-pulse",children:[e.jsx("div",{className:"h-4 w-1/2 roun
9ded bg-surface-strong"}),e.jsx("div",{className:"mt-3 h-4 w-1/3 rounded bg-surface-strong"}),e.jsx("div",{className:"mt-3 h-4 w-1/4 rounded bg-surface-strong"})]},`field-skeleton-${t}`)):ce.length===0?e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-6 text-center shadow-sm",children:[e.jsx(he,{className:"mx-auto h-10 w-10 text-content-muted"}),e.jsx("p",{className:"mt-3 text-base font-medium text-content",children:s("customFields.noFields")}),e.jsx("p",{className:"mt-1 text-sm text-content-tertiary",children:s("customFields.noFieldsDesc")}),e.jsxs(m,{className:"mt-4 w-full",onClick:()=>O(),children:[e.jsx(re,{className:"mr-2 h-4 w-4"}),s("customFields.addField")]})]}):le.map((t,r)=>e.jsxs("div",{className:"rounded-lg border border-line bg-surface p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-base font-semibold text-content",children:t.fieldName}),e.jsxs("p",{className:"text-xs text-content-tertiary",children:["#",me+r+1]}),t.fieldKey&&e.jsx("code",{className:"mt-1 inline-block rounded bg-surface-subtle px-1.5 py-0.5 text-xs text-content-secondary",children:t.fieldKey}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-sm text-content-secondary",children:[e.jsxs(ue,{tone:"neutral",children:[s("customFields.priority"),": ",t.displayOrder??0]}),e.jsx(ue,{tone:t.fieldType==="text"?"success":t.fieldType==="number"?"info":t.fieldType==="email"?"warning":t.fieldType==="phone"?"accent":t.fieldType==="date"?"info":"neutral",children:s(`customFields.fieldTypes.${t.fieldType}`)}),e.jsx(ue,{tone:t.isRequired?"success":"neutral",children:t.isRequired?s("common.yes"):s("common.no")})]}),e.jsx("p",{className:"mt-2 text-xs text-content-tertiary",children:Re(t.createdAt,f?.timezone||"UTC")})]}),e.jsx(Ye,{checked:x.includes(t.id),onCheckedChange:()=>c(t.id),className:"mt-1 border-[var(--nova-border)] data-[state=checked]:border-[var(--nova-accent)] data-[state=checked]:bg-[var(--nova-accent)] data-[state=checked]:text-white"})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[e.jsxs(m,{variant:"outline",size:"sm",className:"flex-1 min-w-[120px]",onClick:()=>O(t),children:[e.jsx(Pe,{className:"mr-2 h-4 w-4"}),s("common.edit")]}),e.jsxs(m,{variant:"outline",size:"sm",className:"flex-1 min-w-[120px] text-tint-danger-fg-soft",onClick:()=>Fe(t.id),children:[e.jsx(xe,{className:"mr-2 h-4 w-4"}),s("common.delete")]})]})]},`field-card-${t.id}`))})]}),e.jsx(Te,{open:Le,onOpenChange:J,children:e.jsxs(ke,{children:[e.jsxs(Se,{children:[e.jsx(De,{children:s(N?"common.edit":"customFields.addField")}),e.jsx(qe,{children:s("customFields.subtitle")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(E,{className:"text-sm",children:s("customFields.fieldName")}),e.jsx(Oe,{value:ne,onChange:t=>$(t.target.value),placeholder:s("customfields.eGCompany")})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-sm",children:s("customFields.priority")}),e.jsx(Oe,{type:"number",min:0,step:1,value:oe,onChange:t=>Y(t.target.value),placeholder:"0"}),e.jsx("p",{className:"mt-1 text-xs text-content-tertiary",children:s("customFields.priorityHelp")})]}),e.jsxs("div",{children:[e.jsx(E,{className:"text-sm",children:s("customFields.fieldType")}),e.jsxs(ss,{value:v,onValueChange:z,children:[e.jsx(ts,{children:e.jsx(is,{placeholder:s("customFields.fieldType")})}),e.jsxs(ls,{children:[e.jsx(d,{value:"text",children:s("customFields.fieldTypes.text")}),e.jsx(d,{value:"number",children:s("customFields.fieldTypes.number")}),e.jsx(d,{value:"email",children:s("customFields.fieldTypes.email")}),e.jsx(d,{value:"phone",children:s("customFields.fieldTypes.phone")}),e.jsx(d,{value:"date",children:s("customFields.fieldTypes.date")}),e.jsx(d,{value:"time",children:s("customFields.fieldTypes.time")}),e.jsx(d,{value:"datetime",children:s("customFields.fieldTypes.datetime")}),e.jsx(d,{value:"url",children:s("customFields.fieldTypes.url")}),e.jsx(d,{value:"image",children:s("customFields.fieldTypes.image")}),e.jsx(d,{value:"video",children:s("customFields.fieldTypes.video")}),e.jsx(d,{value:"file",children:s("customFields.fieldTypes.file")}),e.jsx(d,{value:"label",children:s("customFields.fieldTypes.label")}),e.jsx(d,{value:"dropdown",children:s("customFields.fieldTypes.dropdown")})]})]})]}),(v==="dropdown"||v==="label")&&e.jsxs("div",{children:[e.jsx(E,{className:"text-sm",children:v==="label"?"Allowed services / products (one per line)":"Options (one per line)"}),e.jsx(ms,{value:ye,onChange:t=>B(t.target.value),placeholder:v==="label"?`Service A
10Service B
11Service C`:`Option A
12Option B
13Option C`,rows:5}),v==="label"&&e.jsx("p",{className:"mt-2 text-xs text-content-tertiary",children:"Team members will search and select only from this allowed list. Multiple selections are supported."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ye,{id:"isRequired",checked:D,onCheckedChange:t=>P(!!t)}),e.jsx(E,{htmlFor:"isRequired",className:"text-sm",children:s("customFields.isRequired")})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 mt-4",children:[e.jsx(m,{variant:"outline",onClick:Ne,children:s("common.cancel")}),e.jsx(m,{onClick:Be,disabled:u,children:s(u?"common.saving":"common.save")})]})]})}),Me&&as.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center",style:{padding:"1rem"},onClick:()=>!u&&S(!1),children:[e.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>!u&&S(!1)}),e.jsxs("div",{className:"relative bg-surface rounded-lg flex flex-col shadow-lg",style:{width:"calc(100vw - 2rem)",maxWidth:"400px",overflow:"hidden",boxSizing:"border-box"},onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"px-4 sm:px-5 py-3 sm:py-4 border-b border-line flex-shrink-0",children:[e.jsx("h2",{className:"text-lg font-semibold text-content",children:s("customFields.delete.title")}),e.jsx("p",{className:"text-sm text-content-tertiary mt-1",children:s("customFields.delete.description")})]}),e.jsxs("div",{className:"px-4 sm:px-5 py-3 sm:py-4 flex-shrink-0 flex gap-3 border-t border-line",children:[e.jsx(m,{variant:"outline",className:"flex-1",onClick:()=>S(!1),disabled:u,children:s("common.cancel")}),e.jsx(m,{variant:"destructive",className:"flex-1",onClick:Ke,disabled:u,children:s(u?"customFields.delete.deleting":"customFields.delete.confirm")})]})]})]}),document.body),e.jsx(Te,{open:ze,onOpenChange:M,children:e.jsxs(ke,{children:[e.jsxs(Se,{children:[e.jsxs(De,{children:["Delete ",x.length," field(s)?"]}),e.jsx(qe,{children:"This action cannot be undone. The selected fields will be permanently deleted."})]}),e.jsxs("div",{className:"flex justify-end gap-3 mt-4",children:[e.jsx(m,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),e.jsx(m,{variant:"destructive",onClick:ae,disabled:u,children:u?"Deleting...":"Delete Fields"})]})]})})]})}function St(){const{isNova:a}=hs();return a?e.jsx(Us,{}):e.jsx(Bs,{})}export{St as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.