import{m as d,o as p,r as s,R as e,b as E,E as f,G as x,K as g,a as c}from"./rpcWorker-CVTx5FIM.js";import{j as h}from"./jexlStrings-BvI4ajTx.js";const y=d()({dialogContent:{width:"80em"},textAreaFont:{fontFamily:"Courier New"},error:{color:"red",fontSize:"0.8em"}});function F(a){h.stringToJexlExpression(a)}const C=p(function({model:a,handleClose:l}){const{classes:n}=y(),{activeFilters:u}=a,[r,m]=s.useState(u.join(`
`)),[o,i]=s.useState();return s.useEffect(()=>{try{r.split(`
`).map(t=>t.trim()).filter(t=>!!t).map(t=>{F(t.trim())}),i(void 0)}catch(t){console.error(t),i(t)}},[r]),e.createElement(E.Dialog,{maxWidth:"xl",open:!0,onClose:l,title:"Add track filters"},e.createElement(f,null,e.createElement("div",null,"Add filters, in jexl format, one per line, starting with the string jexl:. Examples:"," ",e.createElement("ul",null,e.createElement("li",null,e.createElement("code",null,"jexl:get(feature,'name')=='BRCA1'")," - show only feature where the name attribute is BRCA1"),e.createElement("li",null,e.createElement("code",null,"jexl:get(feature,'type')=='gene'")," - show only gene type features in a GFF that has many other feature types"),e.createElement("li",null,e.createElement("code",null,"jexl:get(feature,'score') > 400")," - show only features that have a score greater than 400"))),o?e.createElement("p",{className:n.error},`${o}`):null,e.createElement(x,{variant:"outlined",multiline:!0,minRows:5,maxRows:10,className:n.dialogContent,fullWidth:!0,value:r,onChange:t=>{m(t.target.value)},slotProps:{input:{classes:{input:n.textAreaFont}}}})),e.createElement(g,null,e.createElement(c,{variant:"contained",color:"primary",type:"submit",autoFocus:!0,disabled:!!o,onClick:()=>{a.setJexlFilters(r.split(`
`)),l()}},"Submit"),e.createElement(c,{variant:"contained",color:"secondary",onClick:()=>{l()}},"Cancel")))});export{C as default};
