File size: 9,771 Bytes
b708786
1
2
import{S as ie,i as ce,s as fe,E as W,a2 as Y,a3 as F,m as $,h as _,n as S,a4 as Z,b as M,J as v,O as _e,$ as P,D as x,F as ee,q as N,r as z,u as K,k as B,a as O,y as R,e as te,l as T,c as j,z as L,A as V,d as A,f as J,g as C,B as q,R as Q,v as G,a5 as de,K as ue,a0 as he,H as ne,a6 as ge}from"../chunks/index.d6a3d821.js";import{g as be}from"../chunks/navigation.237d0057.js";import{C as ve,q as ke,d as we,a as Ce,t as $e,b as ye,c as Ee,e as Se,f as Ae}from"../chunks/ConceptView.aac099b5.js";import{u as Be}from"../chunks/urlHashStore.b081783b.js";import{c as X,S as me}from"../chunks/utils.c5a61a40.js";import{I as le,T as Te}from"../chunks/TrashCan.dd2b985e.js";import{M as Me}from"../chunks/Modal.a017af0f.js";function ae(a){let e,n;return{c(){e=Y("title"),n=N(a[1])},l(t){e=F(t,"title",{});var l=$(e);n=z(l,a[1]),l.forEach(_)},m(t,l){M(t,e,l),v(e,n)},p(t,l){l&2&&K(n,t[1])},d(t){t&&_(e)}}}function Ne(a){let e,n,t,l=a[1]&&ae(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]],p={};for(let o=0;o<m.length;o+=1)p=W(p,m[o]);return{c(){e=Y("svg"),l&&l.c(),n=Y("path"),t=Y("path"),this.h()},l(o){e=F(o,"svg",{xmlns:!0,viewBox:!0,fill:!0,preserveAspectRatio:!0,width:!0,height:!0});var r=$(e);l&&l.l(r),n=F(r,"path",{d:!0}),$(n).forEach(_),t=F(r,"path",{d:!0}),$(t).forEach(_),r.forEach(_),this.h()},h(){S(n,"d","M16,4c6.6,0,12,5.4,12,12s-5.4,12-12,12S4,22.6,4,16S9.4,4,16,4 M16,2C8.3,2,2,8.3,2,16s6.3,14,14,14s14-6.3,14-14	S23.7,2,16,2z"),S(t,"d","M24 15L17 15 17 8 15 8 15 15 8 15 8 17 15 17 15 24 17 24 17 17 24 17z"),Z(e,p)},m(o,r){M(o,e,r),l&&l.m(e,null),v(e,n),v(e,t)},p(o,[r]){o[1]?l?l.p(o,r):(l=ae(o),l.c(),l.m(e,n)):l&&(l.d(1),l=null),Z(e,p=_e(m,[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},r&1&&{width:o[0]},r&1&&{height:o[0]},r&4&&o[2],r&8&&o[3]]))},i:P,o:P,d(o){o&&_(e),l&&l.d()}}}function ze(a,e,n){let t,l;const m=["size","title"];let p=x(e,m),{size:o=16}=e,{title:r=void 0}=e;return a.$$set=f=>{n(5,e=W(W({},e),ee(f))),n(3,p=x(e,m)),"size"in f&&n(0,o=f.size),"title"in f&&n(1,r=f.title)},a.$$.update=()=>{n(4,t=e["aria-label"]||e["aria-labelledby"]||r),n(2,l={"aria-hidden":t?void 0:!0,role:t?"img":void 0,focusable:Number(e.tabindex)===0?!0:void 0})},e=ee(e),[o,r,l,p,t]}class Ie extends ie{constructor(e){super(),ce(this,e,ze,Ne,fe,{size:0,title:1})}}function se(a,e,n){const t=a.slice();return t[16]=e[n],t}function De(a){let e,n,t,l,m,p,o,r=a[4].data,f=[];for(let c=0;c<r.length;c+=1)f[c]=re(se(a,r,c));const b=c=>A(f[c],1,1,()=>{f[c]=null});return t=new Ie({}),{c(){for(let c=0;c<f.length;c+=1)f[c].c();e=O(),n=B("button"),R(t.$$.fragment),l=N(" Add Concept"),this.h()},l(c){for(let i=0;i<f.length;i+=1)f[i].l(c);e=j(c),n=T(c,"BUTTON",{class:!0});var u=$(n);L(t.$$.fragment,u),l=z(u," Add Concept"),u.forEach(_),this.h()},h(){S(n,"class","mt-4 flex w-full items-center gap-x-1 px-4 py-2 text-left text-sm text-gray-500 hover:text-blue-500")},m(c,u){for(let i=0;i<f.length;i+=1)f[i]&&f[i].m(c,u);M(c,e,u),M(c,n,u),V(t,n,null),v(n,l),m=!0,p||(o=ue(n,"click",a[12]),p=!0)},p(c,u){if(u&19){r=c[4].data;let i;for(i=0;i<r.length;i+=1){const d=se(c,r,i);f[i]?(f[i].p(d,u),C(f[i],1)):(f[i]=re(d),f[i].c(),C(f[i],1),f[i].m(e.parentNode,e))}for(G(),i=r.length;i<f.length;i+=1)b(i);J()}},i(c){if(!m){for(let u=0;u<r.length;u+=1)C(f[u]);C(t.$$.fragment,c),m=!0}},o(c){f=f.filter(Boolean);for(let u=0;u<f.length;u+=1)A(f[u]);A(t.$$.fragment,c),m=!1},d(c){he(f,c),c&&_(e),c&&_(n),q(t),p=!1,o()}}}function Pe(a){let e,n;return e=new me({}),{c(){R(e.$$.fragment)},l(t){L(e.$$.fragment,t)},m(t,l){V(e,t,l),n=!0},p:P,i(t){n||(C(e.$$.fragment,t),n=!0)},o(t){A(e.$$.fragment,t),n=!1},d(t){q(e,t)}}}function re(a){let e,n,t,l=a[16].namespace+"",m,p,o,r=a[16].name+"",f,b,c,u,i,d,w,D;i=new Te({props:{size:16}});function H(){return a[11](a[16])}return{c(){e=B("div"),n=B("a"),t=B("span"),m=N(l),p=N(" / "),o=B("span"),f=N(r),c=O(),u=B("button"),R(i.$$.fragment),this.h()},l(k){e=T(k,"DIV",{class:!0});var y=$(e);n=T(y,"A",{href:!0,class:!0});var h=$(n);t=T(h,"SPAN",{class:!0});var s=$(t);m=z(s,l),p=z(s," / "),s.forEach(_),o=T(h,"SPAN",{});var g=$(o);f=z(g,r),g.forEach(_),h.forEach(_),c=j(y),u=T(y,"BUTTON",{title:!0,class:!0});var E=$(u);L(i.$$.fragment,E),E.forEach(_),y.forEach(_),this.h()},h(){S(t,"class","opacity-50"),S(n,"href",b=X(a[16].namespace,a[16].name)),S(n,"class","flex w-full flex-row items-center whitespace-pre px-4 py-2"),S(u,"title","Remove concept"),S(u,"class","p-3 opacity-50 hover:text-red-400 hover:opacity-100"),S(e,"class","flex justify-between border-b border-gray-200 hover:bg-gray-100"),ne(e,"bg-blue-100",a[16].name===a[0])},m(k,y){M(k,e,y),v(e,n),v(n,t),v(t,m),v(t,p),v(n,o),v(o,f),v(e,c),v(e,u),V(i,u,null),d=!0,w||(D=ue(u,"click",H),w=!0)},p(k,y){a=k,(!d||y&16)&&l!==(l=a[16].namespace+"")&&K(m,l),(!d||y&16)&&r!==(r=a[16].name+"")&&K(f,r),(!d||y&16&&b!==(b=X(a[16].namespace,a[16].name)))&&S(n,"href",b),(!d||y&17)&&ne(e,"bg-blue-100",a[16].name===a[0])},i(k){d||(C(i.$$.fragment,k),d=!0)},o(k){A(i.$$.fragment,k),d=!1},d(k){k&&_(e),q(i),w=!1,D()}}}function Re(a){let e,n;return e=new Ee({props:{concept:a[5].data}}),{c(){R(e.$$.fragment)},l(t){L(e.$$.fragment,t)},m(t,l){V(e,t,l),n=!0},p(t,l){const m={};l&32&&(m.concept=t[5].data),e.$set(m)},i(t){n||(C(e.$$.fragment,t),n=!0)},o(t){A(e.$$.fragment,t),n=!1},d(t){q(e,t)}}}function Le(a){let e,n=a[5].error.message+"",t;return{c(){e=B("p"),t=N(n)},l(l){e=T(l,"P",{});var m=$(e);t=z(m,n),m.forEach(_)},m(l,m){M(l,e,m),v(e,t)},p(l,m){m&32&&n!==(n=l[5].error.message+"")&&K(t,n)},i:P,o:P,d(l){l&&_(e)}}}function Ve(a){let e,n;return e=new me({}),{c(){R(e.$$.fragment)},l(t){L(e.$$.fragment,t)},m(t,l){V(e,t,l),n=!0},p:P,i(t){n||(C(e.$$.fragment,t),n=!0)},o(t){A(e.$$.fragment,t),n=!1},d(t){q(e,t)}}}function oe(a){let e,n;return e=new Me({props:{danger:!0,open:!0,modalHeading:"Delete concept",primaryButtonText:"Delete",primaryButtonIcon:a[3].isLoading?le:void 0,secondaryButtonText:"Cancel",$$slots:{default:[qe]},$$scope:{ctx:a}}}),e.$on("click:button--secondary",a[13]),e.$on("close",a[14]),e.$on("submit",a[15]),{c(){R(e.$$.fragment)},l(t){L(e.$$.fragment,t)},m(t,l){V(e,t,l),n=!0},p(t,l){const m={};l&8&&(m.primaryButtonIcon=t[3].isLoading?le:void 0),l&524290&&(m.$$scope={dirty:l,ctx:t}),e.$set(m)},i(t){n||(C(e.$$.fragment,t),n=!0)},o(t){A(e.$$.fragment,t),n=!1},d(t){q(e,t)}}}function qe(a){let e,n,t,l=a[1].namespace+"",m,p,o=a[1].name+"",r,f,b,c,u;return{c(){e=B("p"),n=N("Confirm deleting "),t=B("code"),m=N(l),p=N("/"),r=N(o),f=N(" ?"),b=O(),c=B("p"),u=N("This is a permanent action and cannot be undone."),this.h()},l(i){e=T(i,"P",{class:!0});var d=$(e);n=z(d,"Confirm deleting "),t=T(d,"CODE",{});var w=$(t);m=z(w,l),p=z(w,"/"),r=z(w,o),w.forEach(_),f=z(d," ?"),d.forEach(_),b=j(i),c=T(i,"P",{class:!0});var D=$(c);u=z(D,"This is a permanent action and cannot be undone."),D.forEach(_),this.h()},h(){S(e,"class","!text-lg"),S(c,"class","mt-2")},m(i,d){M(i,e,d),v(e,n),v(e,t),v(t,m),v(t,p),v(t,r),v(e,f),M(i,b,d),M(i,c,d),v(c,u)},p(i,d){d&2&&l!==(l=i[1].namespace+"")&&K(m,l),d&2&&o!==(o=i[1].name+"")&&K(r,o)},d(i){i&&_(e),i&&_(b),i&&_(c)}}}function He(a){let e,n,t,l,m,p,o,r,f,b,c,u,i;const d=[Pe,De],w=[];function D(s,g){return s[4].isLoading?0:s[4].isSuccess?1:-1}~(t=D(a))&&(l=w[t]=d[t](a));const H=[Ve,Le,Re],k=[];function y(s,g){var E,I,U;return(E=s[5])!=null&&E.isLoading?0:(I=s[5])!=null&&I.isError?1:(U=s[5])!=null&&U.isSuccess?2:-1}~(o=y(a))&&(r=k[o]=H[o](a)),b=new ve({});let h=a[1]&&oe(a);return{c(){e=B("div"),n=B("div"),l&&l.c(),m=O(),p=B("div"),r&&r.c(),f=O(),R(b.$$.fragment),c=O(),h&&h.c(),u=te(),this.h()},l(s){e=T(s,"DIV",{class:!0});var g=$(e);n=T(g,"DIV",{class:!0});var E=$(n);l&&l.l(E),E.forEach(_),m=j(g),p=T(g,"DIV",{class:!0});var I=$(p);r&&r.l(I),I.forEach(_),g.forEach(_),f=j(s),L(b.$$.fragment,s),c=j(s),h&&h.l(s),u=te(),this.h()},h(){S(n,"class","flex h-full w-72 flex-col border-r border-gray-200"),S(p,"class","flex h-full w-full overflow-y-auto p-4"),S(e,"class","flex h-full w-full")},m(s,g){M(s,e,g),v(e,n),~t&&w[t].m(n,null),v(e,m),v(e,p),~o&&k[o].m(p,null),M(s,f,g),V(b,s,g),M(s,c,g),h&&h.m(s,g),M(s,u,g),i=!0},p(s,[g]){let E=t;t=D(s),t===E?~t&&w[t].p(s,g):(l&&(G(),A(w[E],1,1,()=>{w[E]=null}),J()),~t?(l=w[t],l?l.p(s,g):(l=w[t]=d[t](s),l.c()),C(l,1),l.m(n,null)):l=null);let I=o;o=y(s),o===I?~o&&k[o].p(s,g):(r&&(G(),A(k[I],1,1,()=>{k[I]=null}),J()),~o?(r=k[o],r?r.p(s,g):(r=k[o]=H[o](s),r.c()),C(r,1),r.m(p,null)):r=null),s[1]?h?(h.p(s,g),g&2&&C(h,1)):(h=oe(s),h.c(),C(h,1),h.m(u.parentNode,u)):h&&(G(),A(h,1,1,()=>{h=null}),J())},i(s){i||(C(l),C(r),C(b.$$.fragment,s),C(h),i=!0)},o(s){A(l),A(r),A(b.$$.fragment,s),A(h),i=!1},d(s){s&&_(e),~t&&w[t].d(),~o&&k[o].d(),s&&_(f),q(b,s),s&&_(c),h&&h.d(s),s&&_(u)}}}function Oe(a,e,n){let t,l,m,p,o,r=P,f=()=>(r(),r=de(t,s=>n(5,o=s)),t);Q(a,Be,s=>n(10,m=s)),a.$$.on_destroy.push(()=>r());let b,c,u=null;const i=ke();Q(a,i,s=>n(4,p=s));const d=we();Q(a,d,s=>n(3,l=s));function w(){if(u==null)return;const{namespace:s,name:g}=u;l.mutate([s,g],{onSuccess:()=>{var E;for(const[I,U]of Object.entries(Se)){const pe=(E=ge(Ae[I]).selectRowsSchema)==null?void 0:E.data;U.deleteConcept(s,g,pe)}n(1,u=null)}})}const D=s=>n(1,u={namespace:s.namespace,name:s.name}),H=()=>$e({command:ye.CreateConcept,onCreate:s=>be(X(s.detail.namespace,s.detail.name))}),k=()=>n(1,u=null),y=()=>n(1,u=null),h=()=>w();return a.$$.update=()=>{a.$$.dirty&1024&&m.onHashChange("/(?<namespace>.+)/(?<conceptName>.+)",s=>{n(9,b=s.namespace),n(0,c=s.conceptName)}),a.$$.dirty&513&&f(n(2,t=b&&c?Ce(b,c):void 0))},[c,u,t,l,p,o,i,d,w,b,m,D,H,k,y,h]}class Qe extends ie{constructor(e){super(),ce(this,e,Oe,He,fe,{})}}export{Qe as component};