import{a as z,j as e,w as i,t as R,V as D,k as V,y as E,_ as G,cS as q,aL as I,p as y,z as N,aU as f,bd as x,be as C,aq as L,b0 as J,a$ as W,bz as K,ba as Q,bs as X}from"./main-162.js";import{C as Y}from"./bf-424-108.js";import{I as O}from"./bf-553-160.js";import{R as Z}from"./bf-243-83.js";function te({label:w,className:b,children:a}){const{css:d}=z();return e.jsxs("div",{className:`${d(i.flxcb,i.mt2)} ${b}`,children:[e.jsx("span",{className:d(i.fw500),children:w}),e.jsx("div",{children:a})]})}const re=[{label:100,value:"100"},{label:200,value:"200"},{label:300,value:"300"},{label:400,value:"400"},{label:500,value:"500"},{label:600,value:"600"},{label:700,value:"700"},{label:800,value:"800"},{label:900,value:"900"},{label:"Normal",value:"normal"},{label:"Bold",value:"bold"},{label:"Bolder",value:"bolder"},{label:"Lighter",value:"lighter"}],ne=[{label:"Normal",value:"normal"},{label:"Italic",value:"italic"},{label:"Oblique",value:"oblique"}],ce=[{label:"Normal",value:"normal"},{label:"Nowrap",value:"nowrap"},{label:"Pre",value:"pre"},{label:"Pre wrap",value:"pre-wrap"},{label:"Pre line",value:"pre-line"},{label:"Break spaces",value:"break-spaces"},{label:"Inherit",value:"inherit"},{label:"Initial",value:"initial"},{label:"Revert",value:"revert"},{label:"Unset",value:"unset"}],ie=[{label:"Normal",value:"normal"},{label:"Break word",value:"break-word"},{label:"Inherit",value:"inherit"},{label:"Initial",value:"initial"}];function oe({title:w,stateObjName:b,propertyPath:a,subtitle:d,value:s,objectPaths:B,modalType:m,modalId:o,deleteable:g,delPropertyHandler:S,allowImportant:F,hslaPaths:A,fldKey:T}){const{css:r}=z(),{element:h,fieldKey:u}=R(),l=D(L),_=D(J),[p,H]=V(W),[n,k]=V(K),U=()=>{switch(b){case"themeColors":H(c=>y(c,t=>{t[`${a}`]=""})),f(x(h,u,`Clear ${a}`,"",{themeColors:C("themeColors")}));break;case"themeVars":_(c=>y(c,t=>{t[`${a}`]=""})),f(x(h,u,`Clear ${a}`,"",{themeVars:C("themeVars")}));break;case"styles":l(c=>y(c,t=>{Array.isArray(a)?a.map($=>N(t,$,"")):N(t,a,"")})),Array.isArray(a)?f(x(h,u,`${a[0]} Clear`,"",{styles:C("styles")})):f(x(h,u,`${a} Clear`,"",{styles:C("styles")}));break}},M=(()=>{var $;let c=s,t=s;return($=s==null?void 0:s.match(/(var)/gi))!=null&&$[0]&&(c=s.replace(/\(|var|,.*|\)|(!important)|\s/gi,""),t=p[c]),t!=null&&t.match(/(!important)/gi)&&(t=t==null?void 0:t.replace(/(!important)/gi,"")),{str:c,val:t}})();return e.jsxs("div",{className:r(i.flxcb,i.mt2,v.containerHover),children:[e.jsxs("div",{className:r(i.flxc,g&&i.ml1),children:[g&&e.jsx("button",{title:"Delete Property",onClick:S,className:`${r(v.delBtn)} delete-btn`,type:"button","data-testid":`${o}-delete-btn`,children:e.jsx(E,{size:"14"})}),e.jsx("span",{className:r(i.fw500),children:G(w)})]}),e.jsxs("div",{className:r(i.flxc),children:[e.jsx(Z,{id:o,stateObjName:b,propertyPath:a}),F&&s&&e.jsx(O,{className:r({mr:3}),stateObjName:b,propertyPath:a,id:o}),e.jsxs("div",{className:r(v.preview_wrp,n.id===o&&v.active),title:M.val||`Add ${w}`,children:[e.jsxs("button",{onClick:c=>q(c,k,{component:"filter-color",subtitle:d,action:{type:m},value:s,id:o,objectPaths:B,stateObjName:b,propertyPath:a,hslaPaths:A,fldKey:T}),type:"button",className:r(v.pickrBtn),"data-testid":`${o}-modal-btn`,children:[e.jsx(Y,{bg:M.val,h:24,w:24,className:r(i.mr2)}),e.jsx("span",{className:r(v.clrVal),children:M.val||"Pick Color"})]}),s&&e.jsx("button",{title:"Clear Value",onClick:U,className:r(v.clearBtn),type:"button","aria-label":"Clear Color","data-testid":`${o}-clear-btn`,children:e.jsx(I,{size:"12"})})]})]})]})}const v={delBtn:{se:20,flx:"center",b:"none",p:0,mr:1,tn:".2s all",curp:1,brs:"50%",tm:"scale(0)",bd:"none",cr:"var(--red-100-61)",pn:"absolute",lt:-15,":hover":{bd:"#ffd0d0",cr:"#460000"}},containerHover:{"&:hover .delete-btn":{tm:"scale(1)"}},preview_wrp:{bd:"var(--white-0-95)",w:130,mnw:130,brs:10,p:3,flx:"center-between",":hover":{bs:"0 0 0 1px var(--white-0-83)"}},clearBtn:{brs:"50%",p:4,w:17,h:17,b:"none",flx:"center",bd:"transparent",cr:"var(--white-0-50)",curp:1,":hover":{cr:"var(--black-0)",bd:"#d3d1d1"}},pickrBtn:{b:"none",curp:1,flx:"center",bd:"transparent",p:0},clrVal:{w:73,ws:"nowrap",textOverflow:"ellipsis",ta:"left",ow:"hidden"},active:{focusShadow:1}};function be({subtitle:w,action:b,value:a,objectPaths:d,id:s,allowImportant:B}){const{css:m}=z(),{element:o,fieldKey:g}=R(),[S,F]=V(K),[A,T]=V(L),[r,h]=V(W),{object:u,paths:l}=d,_=Q(A,l==null?void 0:l.filter),p=()=>{let n="";return u==="themeColors"&&(n=r[l.filter]),(n===""||n===null)&&(n=X(r,_)),n},H=()=>{switch(u){case"styles":T(n=>y(n,k=>{N(k,l==null?void 0:l.filter,"")})),f(x(o,g,`Clear ${l==null?void 0:l.filter}`,"",{styles:C("styles")}));break;case"themeColors":h(n=>y(n,k=>{N(k,l==null?void 0:l.filter,"")})),f(x(o,g,`Clear ${l==null?void 0:l.filter}`,"",{themeColors:C("themeColors")}));break}};return e.jsxs("div",{className:m(i.flxc,{cg:3}),children:[B&&p()&&e.jsx(O,{id:s,propertyPath:l==null?void 0:l.filter}),e.jsxs("div",{title:p()||"Configure",className:m(j.preview_wrp,S.id===s&&j.active),children:[e.jsx("button",{onClick:n=>q(n,F,{component:s,width:250,subtitle:w,action:b,value:a,objectPaths:d,id:s}),type:"button",className:m(j.pickrBtn),"data-testid":`${s}-model-btn`,children:e.jsx("span",{className:m(j.clrVal),children:p()||"Configure"})}),p()&&e.jsx("button",{title:"Clear Value",onClick:H,className:m(j.clearBtn),type:"button","aria-label":"Clear Filter","data-testid":`${s}-clear-btn`,children:e.jsx(I,{size:"10"})})]})]})}const j={preview_wrp:{bd:"var(--white-0-95)",w:130,mnw:130,brs:10,p:7,pr:"3px !important",flx:"center-between",h:30,":hover":{bs:"0 0 0 1px var(--white-0-83)"}},preview:{w:25,h:25,b:"1px solid gray",brs:7,curp:1,mr:7},clearBtn:{brs:"50%",p:4,w:17,h:17,b:"none",flx:"center",bd:"transparent",cr:"var(--white-0-50)",curp:1,":hover":{cr:"var(--black-0)",bd:"#d3d1d1"}},pickrBtn:{b:"none",curp:1,bd:"transparent",ws:"nowrap",to:"ellipsis",p:0,h:28,w:94,dy:"block",ow:"hidden",ta:"start"},clrVal:{w:80,ws:"nowrap",textOverflow:"ellipsis",ow:"hidden",ta:"left"},active:{focusShadow:1}};export{oe as F,te as T,ne as a,ie as b,ce as c,be as d,re as s};