import{S as X,i as Z,s as ee,E as te,a2 as G,a3 as Q,m as w,h as v,n as y,a4 as ae,b as M,J as b,O as $e,$ as U,D as se,F as re,q as x,r as B,u as H,w as ke,U as we,k as T,y as V,a as L,l as D,z,c as j,A as O,V as Ee,g as C,v as Y,f as J,d as S,B as R,a0 as ge,C as Ce,K as le,R as W,e as oe,a5 as ye,H as ie,a6 as Se}from"../chunks/index.224851d7.js";import{g as Te}from"../chunks/navigation.6c9a524e.js";import{T as De,a as Ie,e as Ne,C as Ae,q as xe,d as Be,b as Me,t as Pe,c as Ve,f as ze,g as Oe}from"../chunks/Commands.7700196d.js";import{T as ve}from"../chunks/TrashCan.e59ed4ef.js";import{T as Re}from"../chunks/JSONSchemaForm.cab38fde.js";import{u as Le}from"../chunks/urlHashStore.b3058edb.js";import{c as ne,S as be}from"../chunks/utils.2fa053fd.js";import{I as ce}from"../chunks/InProgress.26146721.js";import{M as je}from"../chunks/Modal.67c6d9e8.js";function fe(a){let e,n;return{c(){e=G("title"),n=x(a[1])},l(t){e=Q(t,"title",{});var l=w(e);n=B(l,a[1]),l.forEach(v)},m(t,l){M(t,e,l),b(e,n)},p(t,l){l&2&&H(n,t[1])},d(t){t&&v(e)}}}function qe(a){let e,n,t,l=a[1]&&fe(a),m=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:a[0]},{height:a[0]},a[2],a[3]],d={};for(let c=0;c{n(5,e=te(te({},e),re(i))),n(3,d=se(e,m)),"size"in i&&n(0,c=i.size),"title"in i&&n(1,f=i.title)},a.$$.update=()=>{n(4,t=e["aria-label"]||e["aria-labelledby"]||f),n(2,l={"aria-hidden":t?void 0:!0,role:t?"img":void 0,focusable:Number(e.tabindex)===0?!0:void 0})},e=re(e),[c,f,l,d,t]}class Ue extends X{constructor(e){super(),Z(this,e,He,qe,ee,{size:0,title:1})}}function ue(a,e,n){const t=a.slice();return t[6]=e[n],t}function me(a){let e,n,t=a[6].text+"",l,m,d,c,f,i,p,_;c=new ve({props:{size:16}});function r(){return a[5](a[6])}return{c(){e=T("div"),n=T("span"),l=x(t),m=L(),d=T("button"),V(c.$$.fragment),f=L(),this.h()},l(s){e=D(s,"DIV",{class:!0});var o=w(e);n=D(o,"SPAN",{class:!0});var h=w(n);l=B(h,t),h.forEach(v),m=j(o),d=D(o,"BUTTON",{title:!0,class:!0});var I=w(d);z(c.$$.fragment,I),I.forEach(v),f=j(o),o.forEach(v),this.h()},h(){y(n,"class","shrink"),y(d,"title","Remove sample"),y(d,"class","shrink-0 opacity-50 hover:text-red-400 hover:opacity-100"),y(e,"class","flex w-full justify-between gap-x-2 border-b border-gray-200 p-2 hover:bg-gray-50")},m(s,o){M(s,e,o),b(e,n),b(n,l),b(e,m),b(e,d),O(c,d,null),b(e,f),i=!0,p||(_=le(d,"click",r),p=!0)},p(s,o){a=s,(!i||o&1)&&t!==(t=a[6].text+"")&&H(l,t)},i(s){i||(C(c.$$.fragment,s),i=!0)},o(s){S(c.$$.fragment,s),i=!1},d(s){s&&v(e),R(c),p=!1,_()}}}function Fe(a){let e,n,t,l,m,d;function c(r){a[3](r)}let f={labelText:"Add example"};a[1]!==void 0&&(f.value=a[1]),n=new Re({props:f}),ke.push(()=>we(n,"value",c)),n.$on("keydown",a[4]);let i=[...a[0]].reverse(),p=[];for(let r=0;rS(p[r],1,1,()=>{p[r]=null});return{c(){e=T("div"),V(n.$$.fragment),l=L(),m=T("div");for(let r=0;rt=!1)),n.$set(o),s&5){i=[...r[0]].reverse();let h;for(h=0;h{i.key==="Enter"&&(m("add",l),n(1,l=""))},f=i=>m("remove",i.id);return a.$$set=i=>{"data"in i&&n(0,t=i.data)},[t,l,m,d,c,f]}class pe extends X{constructor(e){super(),Z(this,e,Ke,Fe,ee,{data:0})}}function Ye(a){let e,n,t,l,m,d=a[1].length+"",c,f,i,p,_,r,s,o,h,I=a[0].length+"",q,E,N,$,u;return l=new De({}),p=new pe({props:{data:a[1]}}),p.$on("remove",a[6]),p.$on("add",a[7]),o=new Ie({}),$=new pe({props:{data:a[0]}}),$.$on("remove",a[8]),$.$on("add",a[9]),{c(){e=T("div"),n=T("div"),t=T("span"),V(l.$$.fragment),m=x(" Positive ("),c=x(d),f=x(" examples)"),i=L(),V(p.$$.fragment),_=L(),r=T("div"),s=T("span"),V(o.$$.fragment),h=x("Negative ("),q=x(I),E=x(" examples)"),N=L(),V($.$$.fragment),this.h()},l(g){e=D(g,"DIV",{class:!0});var k=w(e);n=D(k,"DIV",{class:!0});var A=w(n);t=D(A,"SPAN",{class:!0});var P=w(t);z(l.$$.fragment,P),m=B(P," Positive ("),c=B(P,d),f=B(P," examples)"),P.forEach(v),i=j(A),z(p.$$.fragment,A),A.forEach(v),_=j(k),r=D(k,"DIV",{class:!0});var F=w(r);s=D(F,"SPAN",{class:!0});var K=w(s);z(o.$$.fragment,K),h=B(K,"Negative ("),q=B(K,I),E=B(K," examples)"),K.forEach(v),N=j(F),z($.$$.fragment,F),F.forEach(v),k.forEach(v),this.h()},h(){y(t,"class","flex items-center gap-x-2 text-lg"),y(n,"class","flex w-1/2 flex-col gap-y-4"),y(s,"class","flex items-center gap-x-2 text-lg"),y(r,"class","flex w-1/2 flex-col gap-y-4"),y(e,"class","flex h-full gap-x-4")},m(g,k){M(g,e,k),b(e,n),b(n,t),O(l,t,null),b(t,m),b(t,c),b(t,f),b(n,i),O(p,n,null),b(e,_),b(e,r),b(r,s),O(o,s,null),b(s,h),b(s,q),b(s,E),b(r,N),O($,r,null),u=!0},p(g,[k]){(!u||k&2)&&d!==(d=g[1].length+"")&&H(c,d);const A={};k&2&&(A.data=g[1]),p.$set(A),(!u||k&1)&&I!==(I=g[0].length+"")&&H(q,I);const P={};k&1&&(P.data=g[0]),$.$set(P)},i(g){u||(C(l.$$.fragment,g),C(p.$$.fragment,g),C(o.$$.fragment,g),C($.$$.fragment,g),u=!0)},o(g){S(l.$$.fragment,g),S(p.$$.fragment,g),S(o.$$.fragment,g),S($.$$.fragment,g),u=!1},d(g){g&&v(e),R(l),R(p),R(o),R($)}}}function Je(a,e,n){let t,l,m,{concept:d}=e;const c=Ne();W(a,c,o=>n(10,m=o));function f(o){!d.namespace||!d.concept_name||m.mutate([d.namespace,d.concept_name,{remove:[o]}])}function i(o,h){!d.namespace||!d.concept_name||m.mutate([d.namespace,d.concept_name,{insert:[{text:o,label:h}]}])}const p=o=>f(o.detail),_=o=>i(o.detail,!0),r=o=>f(o.detail),s=o=>i(o.detail,!1);return a.$$set=o=>{"concept"in o&&n(5,d=o.concept)},a.$$.update=()=>{a.$$.dirty&32&&n(1,t=Object.values(d.data).filter(o=>o.label==!0)),a.$$.dirty&32&&n(0,l=Object.values(d.data).filter(o=>o.label==!1))},[l,t,c,f,i,d,p,_,r,s]}class Ge extends X{constructor(e){super(),Z(this,e,Je,Ye,ee,{concept:5})}}function de(a,e,n){const t=a.slice();return t[16]=e[n],t}function Qe(a){let e,n,t,l,m,d,c,f=a[4].data,i=[];for(let _=0;_S(i[_],1,1,()=>{i[_]=null});return t=new Ue({}),{c(){for(let _=0;_{h[k]=null}),J()),~t?(l=h[t],l?l.p(u,g):(l=h[t]=o[t](u),l.c()),C(l,1),l.m(n,null)):l=null);let A=c;c=N(u),c===A?~c&&E[c].p(u,g):(f&&(Y(),S(E[A],1,1,()=>{E[A]=null}),J()),~c?(f=E[c],f?f.p(u,g):(f=E[c]=q[c](u),f.c()),C(f,1),f.m(d,null)):f=null),u[1]?$?($.p(u,g),g&2&&C($,1)):($=he(u),$.c(),C($,1),$.m(r.parentNode,r)):$&&(Y(),S($,1,1,()=>{$=null}),J())},i(u){s||(C(l),C(f),C(p.$$.fragment,u),C($),s=!0)},o(u){S(l),S(f),S(p.$$.fragment,u),S($),s=!1},d(u){u&&v(e),~t&&h[t].d(),~c&&E[c].d(),u&&v(i),R(p,u),u&&v(_),$&&$.d(u),u&&v(r)}}}function lt(a,e,n){let t,l,m,d,c,f=U,i=()=>(f(),f=ye(t,u=>n(5,c=u)),t);W(a,Le,u=>n(10,m=u)),a.$$.on_destroy.push(()=>f());let p,_,r=null;const s=xe();W(a,s,u=>n(4,d=u));const o=Be();W(a,o,u=>n(3,l=u));function h(){if(r==null)return;const{namespace:u,name:g}=r;l.mutate([u,g],{onSuccess:()=>{var k;for(const[A,P]of Object.entries(ze)){const F=(k=Se(Oe[A]).selectRowsSchema)==null?void 0:k.data;P.deleteConcept(u,g,F)}n(1,r=null)}})}const I=u=>n(1,r={namespace:u.namespace,name:u.name}),q=()=>Pe({command:Ve.CreateConcept,onCreate:u=>Te(ne(u.detail.namespace,u.detail.name))}),E=()=>n(1,r=null),N=()=>n(1,r=null),$=()=>h();return a.$$.update=()=>{a.$$.dirty&1024&&m.onHashChange("/(?.+)/(?.+)",u=>{n(9,p=u.namespace),n(0,_=u.conceptName)}),a.$$.dirty&513&&i(n(2,t=p&&_?Me(p,_):void 0))},[_,r,t,l,d,c,s,o,h,p,m,I,q,E,N,$]}class pt extends X{constructor(e){super(),Z(this,e,lt,nt,ee,{})}}export{pt as component};