pankosmia-rcl 0.4.20 → 0.4.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -282,6 +282,6 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
282
282
  10.59L10 14.17L17.59 6.58L19 8L10 17Z`}))},_w=function(){return $.createElement(Hs,null,$.createElement("path",{d:"M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"}))},Lw=function(){return $.createElement(Hs,null,$.createElement("path",{d:`M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,
283
283
  6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,
284
284
  13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z`}))},Bw=function(){return $.createElement(Hs,null,$.createElement("path",{d:`M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,
285
- 0 22,12A10,10 0 0,0 12,2Z`}))},Fw={default:void 0,success:$.createElement(Dw,null),warning:$.createElement(_w,null),error:$.createElement(Lw,null),info:$.createElement(Bw,null)},Oo={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:Fw,anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:pf,transitionDuration:{enter:225,exit:195}},zw=function(t,o){var r=function(s){return typeof s=="number"||s===null};return r(t)?t:r(o)?o:Oo.autoHideDuration},Vw=function(t,o){var r=function(s,a){return a.some(function(l){return typeof s===l})};return r(t,["string","number"])?t:r(t,["object"])?st({},Oo.transitionDuration,{},r(o,["object"])&&o,{},t):r(o,["string","number"])?o:r(o,["object"])?st({},Oo.transitionDuration,{},o):Oo.transitionDuration},Ww=function(t,o){return function(r,i){return i===void 0&&(i=!1),i?st({},Oo[r],{},o[r],{},t[r]):r==="autoHideDuration"?zw(t.autoHideDuration,o.autoHideDuration):r==="transitionDuration"?Vw(t.transitionDuration,o.transitionDuration):t[r]||o[r]||Oo[r]}};function ii(e){return Object.entries(e).reduce(function(t,o){var r,i=o[0],s=o[1];return st({},t,(r={},r[i]=Ll(s),r))},{})}var nr={SnackbarContainer:"notistack-SnackbarContainer",Snackbar:"notistack-Snackbar",CollapseWrapper:"notistack-CollapseWrapper",MuiContent:"notistack-MuiContent",MuiContentVariant:function(t){return"notistack-MuiContent-"+t}},ff=ii({root:{height:0},entered:{height:"auto"}}),Wl="0px",Ul=175,mf=$.forwardRef(function(e,t){var o=e.children,r=e.in,i=e.onExited,s=$.useRef(null),a=$.useRef(null),l=zl(t,a),c=function(){return s.current?s.current.clientHeight:0},d=function(f){f.style.height=Wl},u=function(f){var C=c(),T=Ws({timeout:Ul,mode:"enter"}),E=T.duration,v=T.easing;f.style.transitionDuration=typeof E=="string"?E:E+"ms",f.style.height=C+"px",f.style.transitionTimingFunction=v||""},m=function(f){f.style.height="auto"},h=function(f){f.style.height=c()+"px"},y=function(f){cf(f);var C=Ws({timeout:Ul,mode:"exit"}),T=C.duration,E=C.easing;f.style.transitionDuration=typeof T=="string"?T:T+"ms",f.style.height=Wl,f.style.transitionTimingFunction=E||""};return $.createElement(Fl,{in:r,unmountOnExit:!0,onEnter:d,onEntered:m,onEntering:u,onExit:h,onExited:i,onExiting:y,nodeRef:a,timeout:Ul},function(g,f){return $.createElement("div",Object.assign({ref:l,className:To(ff.root,g==="entered"&&ff.entered),style:st({pointerEvents:"all",overflow:"hidden",minHeight:Wl,transition:tr("height")},g==="entered"&&{overflow:"visible"},{},g==="exited"&&!r&&{visibility:"hidden"})},f),$.createElement("div",{ref:s,className:nr.CollapseWrapper,style:{display:"flex",width:"100%"}},o))})});mf.displayName="Collapse";var hf={right:"left",left:"right",bottom:"up",top:"down"},Uw=function(t){return t.horizontal!=="center"?hf[t.horizontal]:hf[t.vertical]},Hw=function(t){return"anchorOrigin"+Bl(t)},qw=function(t){t===void 0&&(t={});var o={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(t).filter(function(r){return!o[r]}).reduce(function(r,i){var s;return st({},r,(s={},s[i]=t[i],s))},{})},Gw=function(){};function si(e,t){return e.reduce(function(o,r){return r==null?o:function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];var c=[].concat(a);t&&c.indexOf(t)===-1&&c.push(t),o.apply(this,c),r.apply(this,c)}},Gw)}var Yw=typeof window<"u"?$.useLayoutEffect:$.useEffect;function gf(e){var t=$.useRef(e);return Yw(function(){t.current=e}),$.useCallback(function(){return t.current.apply(void 0,arguments)},[])}var bf=$.forwardRef(function(e,t){var o=e.children,r=e.className,i=e.autoHideDuration,s=e.disableWindowBlurListener,a=s===void 0?!1:s,l=e.onClose,c=e.id,d=e.open,u=e.SnackbarProps,m=u===void 0?{}:u,h=$.useRef(),y=gf(function(){l&&l.apply(void 0,arguments)}),g=gf(function(v){!l||v==null||(h.current&&clearTimeout(h.current),h.current=setTimeout(function(){y(null,"timeout",c)},v))});$.useEffect(function(){return d&&g(i),function(){h.current&&clearTimeout(h.current)}},[d,i,g]);var f=function(){h.current&&clearTimeout(h.current)},C=$.useCallback(function(){i!=null&&g(i*.5)},[i,g]),T=function(w){m.onMouseEnter&&m.onMouseEnter(w),f()},E=function(w){m.onMouseLeave&&m.onMouseLeave(w),C()};return $.useEffect(function(){if(!a&&d)return window.addEventListener("focus",C),window.addEventListener("blur",f),function(){window.removeEventListener("focus",C),window.removeEventListener("blur",f)}},[a,C,d]),$.createElement("div",Object.assign({ref:t},m,{className:To(nr.Snackbar,r),onMouseEnter:T,onMouseLeave:E}),o)});bf.displayName="Snackbar";var Hl,Kw=ii({root:(Hl={display:"flex",flexWrap:"wrap",flexGrow:1},Hl[Eo.upSm]={flexGrow:"initial",minWidth:"288px"},Hl)}),yf=$.forwardRef(function(e,t){var o=e.className,r=oi(e,["className"]);return $.createElement("div",Object.assign({ref:t,className:To(Kw.root,o)},r))});yf.displayName="SnackbarContent";var ai=ii({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:8*2.5+"px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),vf="notistack-snackbar",xf=$.forwardRef(function(e,t){var o=e.id,r=e.message,i=e.action,s=e.iconVariant,a=e.variant,l=e.hideIconVariant,c=e.style,d=e.className,u=s[a],m=i;return typeof m=="function"&&(m=m(o)),$.createElement(yf,{ref:t,role:"alert","aria-describedby":vf,style:c,className:To(nr.MuiContent,nr.MuiContentVariant(a),ai.root,ai[a],d,!l&&u&&ai.lessPadding)},$.createElement("div",{id:vf,className:ai.message},l?null:u,r),m&&$.createElement("div",{className:ai.action},m))});xf.displayName="MaterialDesignContent";var Cf=$.memo(xf),Xw=ii({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),Jw=function(t){var o=$.useRef(),r=$.useState(!0),i=r[0],s=r[1],a=si([t.snack.onClose,t.onClose]),l=function(){t.snack.requestClose&&a(null,"instructed",t.snack.id)},c=$.useCallback(function(){o.current=setTimeout(function(){s(function(R){return!R})},125)},[]);$.useEffect(function(){return function(){o.current&&clearTimeout(o.current)}},[]);var d=t.snack,u=t.classes,m=t.Component,h=m===void 0?Cf:m,y=$.useMemo(function(){return qw(u)},[u]),g=d.open,f=d.SnackbarProps,C=d.TransitionComponent,T=d.TransitionProps,E=d.transitionDuration,v=d.disableWindowBlurListener,w=d.content,S=oi(d,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),P=st({direction:Uw(S.anchorOrigin),timeout:E},T),O=w;typeof O=="function"&&(O=O(S.id,S.message));var k=["onEnter","onEntered","onExit","onExited"].reduce(function(R,b){var j;return st({},R,(j={},j[b]=si([t.snack[b],t[b]],S.id),j))},{});return $.createElement(mf,{in:i,onExited:k.onExited},$.createElement(bf,{open:g,id:S.id,disableWindowBlurListener:v,autoHideDuration:S.autoHideDuration,className:To(Xw.wrappedRoot,y.root,y[Hw(S.anchorOrigin)]),SnackbarProps:f,onClose:a},$.createElement(C,Object.assign({},P,{appear:!0,in:g,onExit:k.onExit,onExited:c,onEnter:k.onEnter,onEntered:si([k.onEntered,l],S.id)}),O||$.createElement(h,Object.assign({},S)))))},li,ql,qs,Gs,Gl,Ln={view:{default:20},snackbar:{default:6,dense:2}},Sf="."+nr.CollapseWrapper,Yl=16,Ys=ii({root:(li={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:tr(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},li[Sf]={padding:Ln.snackbar.default+"px 0px",transition:"padding 300ms ease 0ms"},li.maxWidth="calc(100% - "+Ln.view.default*2+"px)",li[Eo.downXs]={width:"100%",maxWidth:"calc(100% - "+Yl*2+"px)"},li),rootDense:(ql={},ql[Sf]={padding:Ln.snackbar.dense+"px 0px"},ql),top:{top:Ln.view.default-Ln.snackbar.default+"px",flexDirection:"column"},bottom:{bottom:Ln.view.default-Ln.snackbar.default+"px",flexDirection:"column-reverse"},left:(qs={left:Ln.view.default+"px"},qs[Eo.upSm]={alignItems:"flex-start"},qs[Eo.downXs]={left:Yl+"px"},qs),right:(Gs={right:Ln.view.default+"px"},Gs[Eo.upSm]={alignItems:"flex-end"},Gs[Eo.downXs]={right:Yl+"px"},Gs),center:(Gl={left:"50%",transform:"translateX(-50%)"},Gl[Eo.upSm]={alignItems:"center"},Gl)}),Zw=function(t){var o=t.classes,r=o===void 0?{}:o,i=t.anchorOrigin,s=t.dense,a=t.children,l=To(nr.SnackbarContainer,Ys[i.vertical],Ys[i.horizontal],Ys.root,r.containerRoot,r["containerAnchorOrigin"+Bl(i)],s&&Ys.rootDense);return $.createElement("div",{className:l},a)},Qw=$.memo(Zw),e1=process.env.NODE_ENV!=="production",t1={NO_PERSIST_ALL:"Reached maxSnack while all enqueued snackbars have 'persist' flag. Notistack will dismiss the oldest snackbar anyway to allow other ones in the queue to be presented."},n1=(function(e){if(e1){var t=t1[e];typeof console<"u"&&console.error("WARNING - notistack: "+t);try{throw new Error(t)}catch{}}}),Tf=function(t){var o=typeof t=="string"||$.isValidElement(t);return!o},mn,wf=(function(e){tf(t,e);function t(r){var i;return i=e.call(this,r)||this,i.enqueueSnackbar=function(s,a){if(a===void 0&&(a={}),s==null)throw new Error("enqueueSnackbar called with invalid argument");var l=Tf(s)?s:a,c=Tf(s)?s.message:s,d=l.key,u=l.preventDuplicate,m=oi(l,["key","preventDuplicate"]),h=zs(d),y=h?d:new Date().getTime()+Math.random(),g=Ww(m,i.props),f=st({id:y},m,{message:c,open:!0,entered:!1,requestClose:!1,persist:g("persist"),action:g("action"),content:g("content"),variant:g("variant"),anchorOrigin:g("anchorOrigin"),disableWindowBlurListener:g("disableWindowBlurListener"),autoHideDuration:g("autoHideDuration"),hideIconVariant:g("hideIconVariant"),TransitionComponent:g("TransitionComponent"),transitionDuration:g("transitionDuration"),TransitionProps:g("TransitionProps",!0),iconVariant:g("iconVariant",!0),style:g("style",!0),SnackbarProps:g("SnackbarProps",!0),className:To(i.props.className,m.className)});return f.persist&&(f.autoHideDuration=void 0),i.setState(function(C){if(u===void 0&&i.props.preventDuplicate||u){var T=function(S){return h?S.id===y:S.message===c},E=C.queue.findIndex(T)>-1,v=C.snacks.findIndex(T)>-1;if(E||v)return C}return i.handleDisplaySnack(st({},C,{queue:[].concat(C.queue,[f])}))}),y},i.handleDisplaySnack=function(s){var a=s.snacks;return a.length>=i.maxSnack?i.handleDismissOldest(s):i.processQueue(s)},i.processQueue=function(s){var a=s.queue,l=s.snacks;return a.length>0?st({},s,{snacks:[].concat(l,[a[0]]),queue:a.slice(1,a.length)}):s},i.handleDismissOldest=function(s){if(s.snacks.some(function(u){return!u.open||u.requestClose}))return s;var a=!1,l=!1,c=s.snacks.reduce(function(u,m){return u+(m.open&&m.persist?1:0)},0);c===i.maxSnack&&(process.env.NODE_ENV!=="production"&&n1("NO_PERSIST_ALL"),l=!0);var d=s.snacks.map(function(u){return!a&&(!u.persist||l)?(a=!0,u.entered?(u.onClose&&u.onClose(null,"maxsnack",u.id),i.props.onClose&&i.props.onClose(null,"maxsnack",u.id),st({},u,{open:!1})):st({},u,{requestClose:!0})):st({},u)});return st({},s,{snacks:d})},i.handleEnteredSnack=function(s,a,l){if(!zs(l))throw new Error("handleEnteredSnack Cannot be called with undefined key");i.setState(function(c){var d=c.snacks;return{snacks:d.map(function(u){return u.id===l?st({},u,{entered:!0}):st({},u)})}})},i.handleCloseSnack=function(s,a,l){i.props.onClose&&i.props.onClose(s,a,l);var c=l===void 0;i.setState(function(d){var u=d.snacks,m=d.queue;return{snacks:u.map(function(h){return!c&&h.id!==l?st({},h):h.entered?st({},h,{open:!1}):st({},h,{requestClose:!0})}),queue:m.filter(function(h){return h.id!==l})}})},i.closeSnackbar=function(s){var a=i.state.snacks.find(function(l){return l.id===s});zs(s)&&a&&a.onClose&&a.onClose(null,"instructed",s),i.handleCloseSnack(null,"instructed",s)},i.handleExitedSnack=function(s,a){if(!zs(a))throw new Error("handleExitedSnack Cannot be called with undefined key");i.setState(function(l){var c=i.processQueue(st({},l,{snacks:l.snacks.filter(function(d){return d.id!==a})}));return c.queue.length===0?c:i.handleDismissOldest(c)})},mn=i.enqueueSnackbar,i.closeSnackbar,i.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:i.enqueueSnackbar.bind(nf(i)),closeSnackbar:i.closeSnackbar.bind(nf(i))}},i}var o=t.prototype;return o.render=function(){var i=this,s=this.state.contextValue,a=this.props,l=a.domRoot,c=a.children,d=a.dense,u=d===void 0?!1:d,m=a.Components,h=m===void 0?{}:m,y=a.classes,g=this.state.snacks.reduce(function(C,T){var E,v=Bl(T.anchorOrigin),w=C[v]||[];return st({},C,(E={},E[v]=[].concat(w,[T]),E))},{}),f=Object.keys(g).map(function(C){var T=g[C],E=T[0];return $.createElement(Qw,{key:C,dense:u,anchorOrigin:E.anchorOrigin,classes:y},T.map(function(v){return $.createElement(Jw,{key:v.id,snack:v,classes:y,Component:h[v.variant],onClose:i.handleCloseSnack,onEnter:i.props.onEnter,onExit:i.props.onExit,onExited:si([i.handleExitedSnack,i.props.onExited],v.id),onEntered:si([i.handleEnteredSnack,i.props.onEntered],v.id)})}))});return $.createElement(rf.Provider,{value:s},c,l?un.createPortal(f,l):f)},ef(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||Oo.maxSnack}}]),t})($.Component),o1=(function(){return $.useContext(rf)});const r1=ut(p.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"BlockOutlined"),i1=ut(p.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check"),s1=ut(p.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"RadioButtonUnchecked"),a1=async(e,t)=>{const o=await kt("/api/burrito/metadata/summaries",t.current);e(o.json)};function l1({downloadedType:e="org",downloadFunction:t,sources:o,showColumnFilters:r,tableTitle:i,sx:s,theme:a,preSelected:l=[],topicsFilter:c=["pushing2sb","tc-ready"],showFilterButtons:d}){const{i18nRef:u}=$.useContext(Jt),{debugRef:m}=$.useContext(Jo),[h,y]=$.useState(0),g=$.useRef(0),[f,C]=$.useState([]),[T,E]=$.useState(null),[v,w]=$.useState({}),[S,P]=$.useState(!0),O=$.useRef(null),[k,R]=$.useState(0),[b,j]=$.useState(!1),{sourceWhitelist:N,filterExample:M,listMode:z}=$.useMemo(()=>{if(Array.isArray(o))return{listMode:!1,sourceWhitelist:o,filterExample:o.map(([A,Q,Y])=>({label:Q,icon:Y||p.jsx(s1,{}),filter:q=>!0}))};if(o&&typeof o=="object"){const A=[];for(const[Q,Y]of Object.entries(o))for(const q of Object.keys(Y))A.push([`${Q}/${q}`,q]);return{listMode:!0,sourceWhitelist:A,filterExample:[]}}return{listMode:!1,sourceWhitelist:[],filterExample:[]}},[o]);$.useEffect(()=>{M.length>0&&h===null&&y(0)},[M,h]),$.useEffect(()=>{if(!O.current)return;const A=new ResizeObserver(Q=>{for(const Y of Q)R(Y.contentRect.height)});return A.observe(O.current),()=>A.disconnect()},[M]);const F=$.useMemo(()=>{var A;return h!==null?(A=M[h])==null?void 0:A.filter:null},[h,M]);$.useEffect(()=>{(async()=>{P(!0),E(null);const Q=++g.current;a1(w,m);let Y=[];if(z)for(let q=0;q<N.length;q++){let U=N[q],_=U[0].split("/"),G;if(e==="org"&&(G=await kt(`/api/gitea/remote-repos/${U[0]}`,m.current)),e==="user"&&(G=await kt(`/api/gitea/user-remote-repos/${U[0]}`,m.current)),Q!==g.current)return;if(G.ok&&G.json.length>0)if(z){const H=G.json.filter(ne=>o[_[0]][_[1]].includes(ne.name)).map(ne=>({...ne,source:U[0]}));Y=[...Y,...H]}else{const H=G.json.map(ne=>({...ne,source:U[0]}));Y=[...Y,...H]}}else{let q=N[h],U=q[0].split("/"),_;if(e==="org"&&(_=await kt(`/api/gitea/remote-repos/${q[0]}`,m.current)),e==="user"&&(_=await kt(`/api/gitea/user-remote-repos/${q[0]}`,m.current)),Q!==g.current)return;if(_.ok&&_.json.length>0)if(z){const G=_.json.filter(H=>o[U[0]][U[1]].includes(H.name)).map(H=>({...H,source:q[0]}));Y=[...Y,...G]}else{const G=_.json.map(H=>({...H,source:q[0]}));Y=[...Y,...G]}}Y.length>0?(P(!1),j(!1),C(Y)):(P(!1),j(!0),mn(fe("library:pankosmia-rcl:catalog_empty",u.current),{variant:"error"}))})()},[N,h]),$.useEffect(()=>{if(f.length===0)return;(async()=>{const Q={};for(const Y of f)if(v[`${Y.source}/${Y.name}`]){const U=v[`${Y.source}/${Y.name}`].timestamp,_=Date.parse(Y.updated_at)/1e3;Q[`${Y.source}/${Y.name}`]=_-U>0?"updatable":"downloaded"}else Q[`${Y.source}/${Y.name}`]="notDownloaded";E(Q)})()},[f,v]);const L=$.useCallback(async(A,Q,Y)=>{E(U=>({...U,[Q]:"downloading"})),mn(`${fe("pages:core-remote-resources:downloading",u.current)} ${A.row.abbreviation}`,{variant:"info"});let q;q=await t(A,Q,Y),q.ok?(mn(`${A.row.abbreviation} ${fe(Y==="clone"?"pages:core-remote-resources:downloaded":"pages:core-remote-resources:updated",u.current)}`,{variant:"success"}),E(U=>({...U,[Q]:"downloaded"}))):(mn(`${A.row.abbreviation} ${fe("pages:core-remote-resources:failed",u.current)} : ${q.error} (${q.status})`,{variant:"error"}),E(U=>({...U,[Q]:"notDownloaded"})))},[]),X=$.useMemo(()=>[{field:"resourceCode",headerName:fe("library:pankosmia-rcl:row_resource_code",u.current),flex:.5,minWidth:140},{field:"language",headerName:fe("library:pankosmia-rcl:row_language",u.current),flex:.5,minWidth:120},{field:"description",headerName:fe("library:pankosmia-rcl:row_description",u.current),flex:2,minWidth:130},{field:"type",headerName:fe("library:pankosmia-rcl:row_type",u.current),flex:1.5,minWidth:80},{field:"download",sortable:!1,headerName:fe("library:pankosmia-rcl:row_download",u.current),flex:.5,minWidth:120,renderCell:A=>{const Q=`${A.row.source}/${A.row.name}`,Y=T==null?void 0:T[Q],q=Y==="updatable",U=Y==="downloading",_=Y==="downloaded"||!Y;return p.jsx(wn,{onClick:G=>{G.stopPropagation(),L(A,Q,q?"fetch":"clone")},loading:U,disabled:_,children:_?p.jsx(ww,{}):q?p.jsx(Ew,{}):p.jsx(Xp,{})})}}],[u,T,L]),J=$.useMemo(()=>f.filter(A=>A.flavor).map(A=>({...A,id:`${A.source}/${A.name}`,url:A.latest_zip,metadata_types:A.metadata_types,resourceCode:A.abbreviation.toUpperCase(),language:A.language_code,description:A.description,flavor:A.flavor,flavorType:A.flavor_type,clone_url:A.clone_url,ingredients:A.ingredients,topics:A.topics,type:fe(`flavors:names:${A.flavor_type}/${A.flavor}`,u.current)})).filter(A=>A.metadata_types==="rc"&&A.topics.some(Q=>c.includes(Q))||A.metadata_types==="sb"||!1),[f,u]),W=[{label:"Download selected",icon:Xp,action:(A,Q)=>{if(!T)return;Q.filter(q=>A.selectedIds.includes(q.id)).forEach(q=>{const U=`${q.source}/${q.name}`;T[U]==="notDownloaded"?L({row:q},U,"clone"):T[U]==="updatable"&&L({row:q},U,"fetch")})}}],B=a?{theme:a}:{};return p.jsxs(ot,{...B,sx:{height:"100%"},children:[(M==null?void 0:M.length)>0&&d&&p.jsx(Ko,{ref:O,direction:"row",spacing:0,alignItems:"center",sx:{mb:1},children:M.map((A,Q)=>{const Y=h===Q,q=Q===0,U=Q===M.length-1;return p.jsx(ps,{label:A.label,onClick:()=>y(Q),color:"primary",variant:Y?"filled":"outlined",icon:Y?p.jsx(i1,{}):A.icon,sx:{borderRadius:0,height:40,border:"1px solid",borderColor:"primary.main",...!q&&{borderLeft:"none"},...q&&{borderTopLeftRadius:"20px",borderBottomLeftRadius:"20px"},...U&&{borderTopRightRadius:"20px",borderBottomRightRadius:"20px"},"& .MuiChip-icon":{width:20,marginLeft:"8px",marginRight:"-4px"},...Y&&{zIndex:1,borderColor:"primary.main"}}},A.label)})}),!S&&!b?p.jsx(ot,{sx:{height:k>0?`calc(100% - ${k+8}px)`:"100%"},children:p.jsx(Kp,{columns:X,rows:J,tableTitle:i,groupOperations:z?W:null,defaultFilter:F,showColumnFilters:r,preSelections:l,sx:{...s,height:"100%","& .MuiTableBody-root .MuiTableRow-root:nth-of-type(even) .MuiTableCell-root":{backgroundColor:A=>ke(A.palette.primary.main,.05)}}})}):!b&&p.jsx(ot,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:p.jsx(jr,{})}),b&&p.jsx(ot,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:p.jsxs(xt,{children:[" ",fe("library:pankosmia-rcl:catalog_empty",u.current)]})})]})}function Kl({data:e,titleLabel:t,getOptionLabel:o,value:r,setValue:i}){return p.jsx(Fd,{value:r,onChange:(s,a)=>{i(a)},options:e,getOptionLabel:o,sx:{width:"100%"},renderInput:s=>p.jsx(Rn,{...s,label:t})})}const Ks=$.createContext({product:null,setProduct:()=>{}});function c1({currentId:e}){const[t,o]=$.useState("auto"),[r,i]=$.useState(!1),s=$.useRef(null),[a,l]=$.useState(!1),[c,d]=$.useState([]),{i18nRef:u}=$.useContext(Jt),{enabledRef:m}=$.useContext(So),{debugRef:h}=$.useContext(Jo),{productRef:y}=$.useContext(Ks);$.useEffect(()=>{(async()=>{const E=await kt("/api/list-clients",h.current);E.ok&&d(E.json.filter(v=>!v.exclude_from_menu&&(h.current||!v.requires.debug)))})().then()},[h.current]);const g=T=>{kt(`/api/debug/${h.current?"disable":"enable"}`).then(()=>{T.stopPropagation(),T.preventDefault()})};$.useEffect(()=>{let T;if(a&&!r)return T=setTimeout(()=>{if(s.current){const E=s.current.clientWidth;E>0&&(o(`${E}px`),i(!0))}},50),()=>clearTimeout(T)},[a,r]);let f=y&&y.current&&y.current.os==="android",C=f?"30px":"0px";return p.jsxs(ot,{sx:{m:0,mr:2},children:[p.jsx(wn,{onClick:T=>l(!0),children:p.jsx(Up,{sx:{color:"#FFF"}})}),p.jsx(gl,{open:a,onClose:()=>l(!1),sx:{width:"100%",height:"100%",overflow:"hidden"},children:p.jsxs(ot,{sx:{display:"flex",flexDirection:"column",minWidth:"16rem",overflow:"hidden",minHeight:f?"calc(100vh - 60px)":"100vh",m:0,p:0,paddingTop:C,paddingBottom:C},role:"presentation",children:[p.jsx(vo,{sx:{width:"100%"},children:c.map((T,E)=>T.id===e?p.jsx(xo,{disablePadding:!0,onClick:()=>l(!1),children:p.jsx(Pn,{selected:!0,children:p.jsx($n,{primary:fe(`pages:${T.id}:title`,u.current)})})},E):p.jsx(xo,{disablePadding:!0,children:p.jsx(Pn,{disabled:T.requires.net&&!m.current,onClick:()=>{window.location.href=T.url},children:p.jsx($n,{primary:fe(`pages:${T.id}:title`,u.current)})})},E))}),p.jsx(ot,{sx:{flexGrow:1}}),p.jsxs(vo,{sx:{width:"100%"},children:[p.jsx(xo,{disablePadding:!0,children:p.jsx(Pn,{selected:e.includes("settings"),onClick:()=>{window.location.href="/clients/settings"},children:p.jsx($n,{primary:fe("pages:core-settings:title",u.current)})})}),p.jsxs(Pn,{onClick:g,children:[p.jsx($n,{primary:fe("components:header:beta_mode",u.current)}),p.jsx(_s,{edge:"end",onChange:g,checked:h.current})]})]})]})})]})}function Ef({titleKey:e,widget:t,currentId:o,theme:r,showInternetSwitch:i=!0}){var y,g,f;const{i18nRef:s}=$.useContext(Jt),{clientConfigRef:a}=$.useContext(Fs),{enabledRef:l}=$.useContext(So),c=((f=(g=(y=a.current._global)==null?void 0:y.find(C=>C.id==="internetConfig"))==null?void 0:g.fields.find(C=>C.id==="internetConnectionAccess"))==null?void 0:f.value)??!0;$.useEffect(()=>{const C=fe("branding:software:name",s.current),T=fe(e,s.current);document.title=`${T} - ${C}`});const d=r?ts:$.Fragment,u=r?{theme:r}:{};let{product:m}=$.useContext(Ks),h=m&&m.os==="android";return p.jsx(d,{...u,children:p.jsx(ot,{display:"flex-start",sx:{flexGrow:1,m:0,p:0},children:p.jsx(Qa,{position:"static",sx:{m:0,p:0,paddingTop:h?"30px":"0px"},children:p.jsxs(ni,{variant:"dense",sx:{m:0,p:0},children:[p.jsx(c1,{currentId:o}),e&&e.length>0&&p.jsx(xt,{variant:"h6",sx:{m:0,p:0},children:fe(e,s.current)}),p.jsx(ot,{sx:{flexGrow:1,m:0,p:0},children:t}),p.jsx(ot,{sx:{m:0,p:0},children:c&&i&&p.jsx(_l,{netEnabled:l.current,i18n:s.current,isAndroid:!0})})]})})})})}async function u1(e,t){const o=e.getReader();let r;for(;!(r=await o.read()).done;)t(r.value)}function d1(e){let t,o,r,i=!1;return function(a){t===void 0?(t=a,o=0,r=-1):t=f1(t,a);const l=t.length;let c=0;for(;o<l;){i&&(t[o]===10&&(c=++o),i=!1);let d=-1;for(;o<l&&d===-1;++o)switch(t[o]){case 58:r===-1&&(r=o-c);break;case 13:i=!0;case 10:d=o;break}if(d===-1)break;e(t.subarray(c,d),r),c=o,r=-1}c===l?t=void 0:c!==0&&(t=t.subarray(c),o-=c)}}function p1(e,t,o){let r=Of();const i=new TextDecoder;return function(a,l){if(a.length===0)o==null||o(r),r=Of();else if(l>0){const c=i.decode(a.subarray(0,l)),d=l+(a[l+1]===32?2:1),u=i.decode(a.subarray(d));switch(c){case"data":r.data=r.data?r.data+`
285
+ 0 22,12A10,10 0 0,0 12,2Z`}))},Fw={default:void 0,success:$.createElement(Dw,null),warning:$.createElement(_w,null),error:$.createElement(Lw,null),info:$.createElement(Bw,null)},Oo={maxSnack:3,persist:!1,hideIconVariant:!1,disableWindowBlurListener:!1,variant:"default",autoHideDuration:5e3,iconVariant:Fw,anchorOrigin:{vertical:"bottom",horizontal:"left"},TransitionComponent:pf,transitionDuration:{enter:225,exit:195}},zw=function(t,o){var r=function(s){return typeof s=="number"||s===null};return r(t)?t:r(o)?o:Oo.autoHideDuration},Vw=function(t,o){var r=function(s,a){return a.some(function(l){return typeof s===l})};return r(t,["string","number"])?t:r(t,["object"])?st({},Oo.transitionDuration,{},r(o,["object"])&&o,{},t):r(o,["string","number"])?o:r(o,["object"])?st({},Oo.transitionDuration,{},o):Oo.transitionDuration},Ww=function(t,o){return function(r,i){return i===void 0&&(i=!1),i?st({},Oo[r],{},o[r],{},t[r]):r==="autoHideDuration"?zw(t.autoHideDuration,o.autoHideDuration):r==="transitionDuration"?Vw(t.transitionDuration,o.transitionDuration):t[r]||o[r]||Oo[r]}};function ii(e){return Object.entries(e).reduce(function(t,o){var r,i=o[0],s=o[1];return st({},t,(r={},r[i]=Ll(s),r))},{})}var nr={SnackbarContainer:"notistack-SnackbarContainer",Snackbar:"notistack-Snackbar",CollapseWrapper:"notistack-CollapseWrapper",MuiContent:"notistack-MuiContent",MuiContentVariant:function(t){return"notistack-MuiContent-"+t}},ff=ii({root:{height:0},entered:{height:"auto"}}),Wl="0px",Ul=175,mf=$.forwardRef(function(e,t){var o=e.children,r=e.in,i=e.onExited,s=$.useRef(null),a=$.useRef(null),l=zl(t,a),c=function(){return s.current?s.current.clientHeight:0},d=function(f){f.style.height=Wl},u=function(f){var C=c(),T=Ws({timeout:Ul,mode:"enter"}),E=T.duration,v=T.easing;f.style.transitionDuration=typeof E=="string"?E:E+"ms",f.style.height=C+"px",f.style.transitionTimingFunction=v||""},m=function(f){f.style.height="auto"},h=function(f){f.style.height=c()+"px"},y=function(f){cf(f);var C=Ws({timeout:Ul,mode:"exit"}),T=C.duration,E=C.easing;f.style.transitionDuration=typeof T=="string"?T:T+"ms",f.style.height=Wl,f.style.transitionTimingFunction=E||""};return $.createElement(Fl,{in:r,unmountOnExit:!0,onEnter:d,onEntered:m,onEntering:u,onExit:h,onExited:i,onExiting:y,nodeRef:a,timeout:Ul},function(g,f){return $.createElement("div",Object.assign({ref:l,className:To(ff.root,g==="entered"&&ff.entered),style:st({pointerEvents:"all",overflow:"hidden",minHeight:Wl,transition:tr("height")},g==="entered"&&{overflow:"visible"},{},g==="exited"&&!r&&{visibility:"hidden"})},f),$.createElement("div",{ref:s,className:nr.CollapseWrapper,style:{display:"flex",width:"100%"}},o))})});mf.displayName="Collapse";var hf={right:"left",left:"right",bottom:"up",top:"down"},Uw=function(t){return t.horizontal!=="center"?hf[t.horizontal]:hf[t.vertical]},Hw=function(t){return"anchorOrigin"+Bl(t)},qw=function(t){t===void 0&&(t={});var o={containerRoot:!0,containerAnchorOriginTopCenter:!0,containerAnchorOriginBottomCenter:!0,containerAnchorOriginTopRight:!0,containerAnchorOriginBottomRight:!0,containerAnchorOriginTopLeft:!0,containerAnchorOriginBottomLeft:!0};return Object.keys(t).filter(function(r){return!o[r]}).reduce(function(r,i){var s;return st({},r,(s={},s[i]=t[i],s))},{})},Gw=function(){};function si(e,t){return e.reduce(function(o,r){return r==null?o:function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];var c=[].concat(a);t&&c.indexOf(t)===-1&&c.push(t),o.apply(this,c),r.apply(this,c)}},Gw)}var Yw=typeof window<"u"?$.useLayoutEffect:$.useEffect;function gf(e){var t=$.useRef(e);return Yw(function(){t.current=e}),$.useCallback(function(){return t.current.apply(void 0,arguments)},[])}var bf=$.forwardRef(function(e,t){var o=e.children,r=e.className,i=e.autoHideDuration,s=e.disableWindowBlurListener,a=s===void 0?!1:s,l=e.onClose,c=e.id,d=e.open,u=e.SnackbarProps,m=u===void 0?{}:u,h=$.useRef(),y=gf(function(){l&&l.apply(void 0,arguments)}),g=gf(function(v){!l||v==null||(h.current&&clearTimeout(h.current),h.current=setTimeout(function(){y(null,"timeout",c)},v))});$.useEffect(function(){return d&&g(i),function(){h.current&&clearTimeout(h.current)}},[d,i,g]);var f=function(){h.current&&clearTimeout(h.current)},C=$.useCallback(function(){i!=null&&g(i*.5)},[i,g]),T=function(w){m.onMouseEnter&&m.onMouseEnter(w),f()},E=function(w){m.onMouseLeave&&m.onMouseLeave(w),C()};return $.useEffect(function(){if(!a&&d)return window.addEventListener("focus",C),window.addEventListener("blur",f),function(){window.removeEventListener("focus",C),window.removeEventListener("blur",f)}},[a,C,d]),$.createElement("div",Object.assign({ref:t},m,{className:To(nr.Snackbar,r),onMouseEnter:T,onMouseLeave:E}),o)});bf.displayName="Snackbar";var Hl,Kw=ii({root:(Hl={display:"flex",flexWrap:"wrap",flexGrow:1},Hl[Eo.upSm]={flexGrow:"initial",minWidth:"288px"},Hl)}),yf=$.forwardRef(function(e,t){var o=e.className,r=oi(e,["className"]);return $.createElement("div",Object.assign({ref:t,className:To(Kw.root,o)},r))});yf.displayName="SnackbarContent";var ai=ii({root:{backgroundColor:"#313131",fontSize:"0.875rem",lineHeight:1.43,letterSpacing:"0.01071em",color:"#fff",alignItems:"center",padding:"6px 16px",borderRadius:"4px",boxShadow:"0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)"},lessPadding:{paddingLeft:8*2.5+"px"},default:{backgroundColor:"#313131"},success:{backgroundColor:"#43a047"},error:{backgroundColor:"#d32f2f"},warning:{backgroundColor:"#ff9800"},info:{backgroundColor:"#2196f3"},message:{display:"flex",alignItems:"center",padding:"8px 0"},action:{display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:"16px",marginRight:"-8px"}}),vf="notistack-snackbar",xf=$.forwardRef(function(e,t){var o=e.id,r=e.message,i=e.action,s=e.iconVariant,a=e.variant,l=e.hideIconVariant,c=e.style,d=e.className,u=s[a],m=i;return typeof m=="function"&&(m=m(o)),$.createElement(yf,{ref:t,role:"alert","aria-describedby":vf,style:c,className:To(nr.MuiContent,nr.MuiContentVariant(a),ai.root,ai[a],d,!l&&u&&ai.lessPadding)},$.createElement("div",{id:vf,className:ai.message},l?null:u,r),m&&$.createElement("div",{className:ai.action},m))});xf.displayName="MaterialDesignContent";var Cf=$.memo(xf),Xw=ii({wrappedRoot:{width:"100%",position:"relative",transform:"translateX(0)",top:0,right:0,bottom:0,left:0,minWidth:"288px"}}),Jw=function(t){var o=$.useRef(),r=$.useState(!0),i=r[0],s=r[1],a=si([t.snack.onClose,t.onClose]),l=function(){t.snack.requestClose&&a(null,"instructed",t.snack.id)},c=$.useCallback(function(){o.current=setTimeout(function(){s(function(R){return!R})},125)},[]);$.useEffect(function(){return function(){o.current&&clearTimeout(o.current)}},[]);var d=t.snack,u=t.classes,m=t.Component,h=m===void 0?Cf:m,y=$.useMemo(function(){return qw(u)},[u]),g=d.open,f=d.SnackbarProps,C=d.TransitionComponent,T=d.TransitionProps,E=d.transitionDuration,v=d.disableWindowBlurListener,w=d.content,S=oi(d,["open","SnackbarProps","TransitionComponent","TransitionProps","transitionDuration","disableWindowBlurListener","content","entered","requestClose","onEnter","onEntered","onExit","onExited"]),P=st({direction:Uw(S.anchorOrigin),timeout:E},T),O=w;typeof O=="function"&&(O=O(S.id,S.message));var k=["onEnter","onEntered","onExit","onExited"].reduce(function(R,b){var j;return st({},R,(j={},j[b]=si([t.snack[b],t[b]],S.id),j))},{});return $.createElement(mf,{in:i,onExited:k.onExited},$.createElement(bf,{open:g,id:S.id,disableWindowBlurListener:v,autoHideDuration:S.autoHideDuration,className:To(Xw.wrappedRoot,y.root,y[Hw(S.anchorOrigin)]),SnackbarProps:f,onClose:a},$.createElement(C,Object.assign({},P,{appear:!0,in:g,onExit:k.onExit,onExited:c,onEnter:k.onEnter,onEntered:si([k.onEntered,l],S.id)}),O||$.createElement(h,Object.assign({},S)))))},li,ql,qs,Gs,Gl,Ln={view:{default:20},snackbar:{default:6,dense:2}},Sf="."+nr.CollapseWrapper,Yl=16,Ys=ii({root:(li={boxSizing:"border-box",display:"flex",maxHeight:"100%",position:"fixed",zIndex:1400,height:"auto",width:"auto",transition:tr(["top","right","bottom","left","max-width"],{duration:300,easing:"ease"}),pointerEvents:"none"},li[Sf]={padding:Ln.snackbar.default+"px 0px",transition:"padding 300ms ease 0ms"},li.maxWidth="calc(100% - "+Ln.view.default*2+"px)",li[Eo.downXs]={width:"100%",maxWidth:"calc(100% - "+Yl*2+"px)"},li),rootDense:(ql={},ql[Sf]={padding:Ln.snackbar.dense+"px 0px"},ql),top:{top:Ln.view.default-Ln.snackbar.default+"px",flexDirection:"column"},bottom:{bottom:Ln.view.default-Ln.snackbar.default+"px",flexDirection:"column-reverse"},left:(qs={left:Ln.view.default+"px"},qs[Eo.upSm]={alignItems:"flex-start"},qs[Eo.downXs]={left:Yl+"px"},qs),right:(Gs={right:Ln.view.default+"px"},Gs[Eo.upSm]={alignItems:"flex-end"},Gs[Eo.downXs]={right:Yl+"px"},Gs),center:(Gl={left:"50%",transform:"translateX(-50%)"},Gl[Eo.upSm]={alignItems:"center"},Gl)}),Zw=function(t){var o=t.classes,r=o===void 0?{}:o,i=t.anchorOrigin,s=t.dense,a=t.children,l=To(nr.SnackbarContainer,Ys[i.vertical],Ys[i.horizontal],Ys.root,r.containerRoot,r["containerAnchorOrigin"+Bl(i)],s&&Ys.rootDense);return $.createElement("div",{className:l},a)},Qw=$.memo(Zw),e1=process.env.NODE_ENV!=="production",t1={NO_PERSIST_ALL:"Reached maxSnack while all enqueued snackbars have 'persist' flag. Notistack will dismiss the oldest snackbar anyway to allow other ones in the queue to be presented."},n1=(function(e){if(e1){var t=t1[e];typeof console<"u"&&console.error("WARNING - notistack: "+t);try{throw new Error(t)}catch{}}}),Tf=function(t){var o=typeof t=="string"||$.isValidElement(t);return!o},mn,wf=(function(e){tf(t,e);function t(r){var i;return i=e.call(this,r)||this,i.enqueueSnackbar=function(s,a){if(a===void 0&&(a={}),s==null)throw new Error("enqueueSnackbar called with invalid argument");var l=Tf(s)?s:a,c=Tf(s)?s.message:s,d=l.key,u=l.preventDuplicate,m=oi(l,["key","preventDuplicate"]),h=zs(d),y=h?d:new Date().getTime()+Math.random(),g=Ww(m,i.props),f=st({id:y},m,{message:c,open:!0,entered:!1,requestClose:!1,persist:g("persist"),action:g("action"),content:g("content"),variant:g("variant"),anchorOrigin:g("anchorOrigin"),disableWindowBlurListener:g("disableWindowBlurListener"),autoHideDuration:g("autoHideDuration"),hideIconVariant:g("hideIconVariant"),TransitionComponent:g("TransitionComponent"),transitionDuration:g("transitionDuration"),TransitionProps:g("TransitionProps",!0),iconVariant:g("iconVariant",!0),style:g("style",!0),SnackbarProps:g("SnackbarProps",!0),className:To(i.props.className,m.className)});return f.persist&&(f.autoHideDuration=void 0),i.setState(function(C){if(u===void 0&&i.props.preventDuplicate||u){var T=function(S){return h?S.id===y:S.message===c},E=C.queue.findIndex(T)>-1,v=C.snacks.findIndex(T)>-1;if(E||v)return C}return i.handleDisplaySnack(st({},C,{queue:[].concat(C.queue,[f])}))}),y},i.handleDisplaySnack=function(s){var a=s.snacks;return a.length>=i.maxSnack?i.handleDismissOldest(s):i.processQueue(s)},i.processQueue=function(s){var a=s.queue,l=s.snacks;return a.length>0?st({},s,{snacks:[].concat(l,[a[0]]),queue:a.slice(1,a.length)}):s},i.handleDismissOldest=function(s){if(s.snacks.some(function(u){return!u.open||u.requestClose}))return s;var a=!1,l=!1,c=s.snacks.reduce(function(u,m){return u+(m.open&&m.persist?1:0)},0);c===i.maxSnack&&(process.env.NODE_ENV!=="production"&&n1("NO_PERSIST_ALL"),l=!0);var d=s.snacks.map(function(u){return!a&&(!u.persist||l)?(a=!0,u.entered?(u.onClose&&u.onClose(null,"maxsnack",u.id),i.props.onClose&&i.props.onClose(null,"maxsnack",u.id),st({},u,{open:!1})):st({},u,{requestClose:!0})):st({},u)});return st({},s,{snacks:d})},i.handleEnteredSnack=function(s,a,l){if(!zs(l))throw new Error("handleEnteredSnack Cannot be called with undefined key");i.setState(function(c){var d=c.snacks;return{snacks:d.map(function(u){return u.id===l?st({},u,{entered:!0}):st({},u)})}})},i.handleCloseSnack=function(s,a,l){i.props.onClose&&i.props.onClose(s,a,l);var c=l===void 0;i.setState(function(d){var u=d.snacks,m=d.queue;return{snacks:u.map(function(h){return!c&&h.id!==l?st({},h):h.entered?st({},h,{open:!1}):st({},h,{requestClose:!0})}),queue:m.filter(function(h){return h.id!==l})}})},i.closeSnackbar=function(s){var a=i.state.snacks.find(function(l){return l.id===s});zs(s)&&a&&a.onClose&&a.onClose(null,"instructed",s),i.handleCloseSnack(null,"instructed",s)},i.handleExitedSnack=function(s,a){if(!zs(a))throw new Error("handleExitedSnack Cannot be called with undefined key");i.setState(function(l){var c=i.processQueue(st({},l,{snacks:l.snacks.filter(function(d){return d.id!==a})}));return c.queue.length===0?c:i.handleDismissOldest(c)})},mn=i.enqueueSnackbar,i.closeSnackbar,i.state={snacks:[],queue:[],contextValue:{enqueueSnackbar:i.enqueueSnackbar.bind(nf(i)),closeSnackbar:i.closeSnackbar.bind(nf(i))}},i}var o=t.prototype;return o.render=function(){var i=this,s=this.state.contextValue,a=this.props,l=a.domRoot,c=a.children,d=a.dense,u=d===void 0?!1:d,m=a.Components,h=m===void 0?{}:m,y=a.classes,g=this.state.snacks.reduce(function(C,T){var E,v=Bl(T.anchorOrigin),w=C[v]||[];return st({},C,(E={},E[v]=[].concat(w,[T]),E))},{}),f=Object.keys(g).map(function(C){var T=g[C],E=T[0];return $.createElement(Qw,{key:C,dense:u,anchorOrigin:E.anchorOrigin,classes:y},T.map(function(v){return $.createElement(Jw,{key:v.id,snack:v,classes:y,Component:h[v.variant],onClose:i.handleCloseSnack,onEnter:i.props.onEnter,onExit:i.props.onExit,onExited:si([i.handleExitedSnack,i.props.onExited],v.id),onEntered:si([i.handleEnteredSnack,i.props.onEntered],v.id)})}))});return $.createElement(rf.Provider,{value:s},c,l?un.createPortal(f,l):f)},ef(t,[{key:"maxSnack",get:function(){return this.props.maxSnack||Oo.maxSnack}}]),t})($.Component),o1=(function(){return $.useContext(rf)});const r1=ut(p.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"BlockOutlined"),i1=ut(p.jsx("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check"),s1=ut(p.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"RadioButtonUnchecked"),a1=async(e,t)=>{const o=await kt("/api/burrito/metadata/summaries",t.current);e(o.json)};function l1({downloadedType:e="org",downloadFunction:t,sources:o,showColumnFilters:r,tableTitle:i,sx:s,theme:a,preSelected:l=[],topicsFilter:c=["pushing2sb","tc-ready"],showFilterButtons:d}){const{i18nRef:u}=$.useContext(Jt),{debugRef:m}=$.useContext(Jo),[h,y]=$.useState(0),g=$.useRef(0),[f,C]=$.useState([]),[T,E]=$.useState(null),[v,w]=$.useState({}),[S,P]=$.useState(!0),O=$.useRef(null),[k,R]=$.useState(0),[b,j]=$.useState(!1),{sourceWhitelist:N,filterExample:M,listMode:z}=$.useMemo(()=>{if(Array.isArray(o))return{listMode:!1,sourceWhitelist:o,filterExample:o.map(([A,Q,Y])=>({label:Q,icon:Y||p.jsx(s1,{}),filter:q=>!0}))};if(o&&typeof o=="object"){const A=[];for(const[Q,Y]of Object.entries(o))for(const q of Object.keys(Y))A.push([`${Q}/${q}`,q]);return{listMode:!0,sourceWhitelist:A,filterExample:[]}}return{listMode:!1,sourceWhitelist:[],filterExample:[]}},[o]);$.useEffect(()=>{M.length>0&&h===null&&y(0)},[M,h]),$.useEffect(()=>{if(!O.current)return;const A=new ResizeObserver(Q=>{for(const Y of Q)R(Y.contentRect.height)});return A.observe(O.current),()=>A.disconnect()},[M]);const F=$.useMemo(()=>{var A;return h!==null?(A=M[h])==null?void 0:A.filter:null},[h,M]);$.useEffect(()=>{(async()=>{P(!0),E(null);const Q=++g.current;a1(w,m);let Y=[];if(z)for(let q=0;q<N.length;q++){let U=N[q],_=U[0].split("/"),G;if(e==="org"&&(G=await kt(`/api/gitea/remote-repos/${U[0]}`,m.current)),e==="user"&&(G=await kt(`/api/gitea/user-remote-repos/${U[0]}`,m.current)),Q!==g.current)return;if(G.ok&&G.json.length>0)if(z){const H=G.json.filter(ne=>o[_[0]][_[1]].includes(ne.name)).map(ne=>({...ne,source:U[0]}));Y=[...Y,...H]}else{const H=G.json.map(ne=>({...ne,source:U[0]}));Y=[...Y,...H]}}else{let q=N[h],U=q[0].split("/"),_;if(e==="org"&&(_=await kt(`/api/gitea/remote-repos/${q[0]}`,m.current)),e==="user"&&(_=await kt(`/api/gitea/user-remote-repos/${q[0]}`,m.current)),Q!==g.current)return;if(_.ok&&_.json.length>0)if(z){const G=_.json.filter(H=>o[U[0]][U[1]].includes(H.name)).map(H=>({...H,source:q[0]}));Y=[...Y,...G]}else{const G=_.json.map(H=>({...H,source:q[0]}));Y=[...Y,...G]}}Y.length>0?(P(!1),j(!1),C(Y)):(P(!1),j(!0),mn(fe("library:pankosmia-rcl:catalog_empty",u.current),{variant:"error"}))})()},[N,h]),$.useEffect(()=>{if(f.length===0)return;(async()=>{const Q={};for(const Y of f)if(v[`${Y.source}/${Y.name}`]){const U=v[`${Y.source}/${Y.name}`].timestamp,_=Date.parse(Y.updated_at)/1e3;Q[`${Y.source}/${Y.name}`]=_-U>0?"updatable":"downloaded"}else Q[`${Y.source}/${Y.name}`]="notDownloaded";E(Q)})()},[f,v]);const L=$.useCallback(async(A,Q,Y)=>{E(U=>({...U,[Q]:"downloading"})),mn(`${fe("pages:core-remote-resources:downloading",u.current)} ${A.row.abbreviation}`,{variant:"info"});let q;q=await t(A,Q,Y),q.ok?(mn(`${A.row.abbreviation} ${fe(Y==="clone"?"pages:core-remote-resources:downloaded":"pages:core-remote-resources:updated",u.current)}`,{variant:"success"}),E(U=>({...U,[Q]:"downloaded"}))):(mn(`${A.row.abbreviation} ${fe("pages:core-remote-resources:failed",u.current)} : ${q.error} (${q.status})`,{variant:"error"}),E(U=>({...U,[Q]:"notDownloaded"})))},[]),X=$.useMemo(()=>[{field:"resourceCode",headerName:fe("library:pankosmia-rcl:row_resource_code",u.current),flex:.5,minWidth:140},{field:"language",headerName:fe("library:pankosmia-rcl:row_language",u.current),flex:.5,minWidth:120},{field:"description",headerName:fe("library:pankosmia-rcl:row_description",u.current),flex:2,minWidth:130},{field:"type",headerName:fe("library:pankosmia-rcl:row_type",u.current),flex:1.5,minWidth:80},{field:"download",sortable:!1,headerName:fe("library:pankosmia-rcl:row_download",u.current),flex:.5,minWidth:120,renderCell:A=>{const Q=`${A.row.source}/${A.row.name}`,Y=T==null?void 0:T[Q],q=Y==="updatable",U=Y==="downloading",_=Y==="downloaded"||!Y;return p.jsx(wn,{onClick:G=>{G.stopPropagation(),L(A,Q,q?"fetch":"clone")},loading:U,disabled:_,children:_?p.jsx(ww,{}):q?p.jsx(Ew,{}):p.jsx(Xp,{})})}}],[u,T,L]),J=$.useMemo(()=>f.filter(A=>A.flavor).map(A=>({...A,id:`${A.source}/${A.name}`,url:A.latest_zip,metadata_types:A.metadata_types,resourceCode:A.abbreviation.toUpperCase(),language:A.language_code,description:A.description,flavor:A.flavor,flavorType:A.flavor_type,clone_url:A.clone_url,ingredients:A.ingredients,topics:A.topics,type:fe(`flavors:names:${A.flavor_type}/${A.flavor}`,u.current)})).filter(A=>A.metadata_types==="rc"&&A.topics.some(Q=>c.includes(Q))||A.metadata_types==="sb"||!1),[f,u]),W=[{label:"Download selected",icon:Xp,action:(A,Q)=>{if(!T)return;Q.filter(q=>A.selectedIds.includes(q.id)).forEach(q=>{const U=`${q.source}/${q.name}`;T[U]==="notDownloaded"?L({row:q},U,"clone"):T[U]==="updatable"&&L({row:q},U,"fetch")})}}],B=a?{theme:a}:{};return p.jsxs(ot,{...B,sx:{height:"100%"},children:[(M==null?void 0:M.length)>0&&d&&p.jsx(Ko,{ref:O,direction:"row",spacing:0,alignItems:"center",sx:{mb:1},children:M.map((A,Q)=>{const Y=h===Q,q=Q===0,U=Q===M.length-1;return p.jsx(ps,{label:A.label,onClick:()=>y(Q),color:"primary",variant:Y?"filled":"outlined",icon:Y?p.jsx(i1,{}):A.icon,sx:{borderRadius:0,height:40,border:"1px solid",borderColor:"primary.main",...!q&&{borderLeft:"none"},...q&&{borderTopLeftRadius:"20px",borderBottomLeftRadius:"20px"},...U&&{borderTopRightRadius:"20px",borderBottomRightRadius:"20px"},"& .MuiChip-icon":{width:20,marginLeft:"8px",marginRight:"-4px"},...Y&&{zIndex:1,borderColor:"primary.main"}}},A.label)})}),!S&&!b?p.jsx(ot,{sx:{height:k>0?`calc(100% - ${k+8}px)`:"100%"},children:p.jsx(Kp,{columns:X,rows:J,tableTitle:i,groupOperations:z?W:null,defaultFilter:F,showColumnFilters:r,preSelections:l,sx:{...s,height:"100%","& .MuiTableBody-root .MuiTableRow-root:nth-of-type(even) .MuiTableCell-root":{backgroundColor:A=>ke(A.palette.primary.main,.05)}}})}):!b&&p.jsx(ot,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:p.jsx(jr,{})}),b&&p.jsx(ot,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:p.jsxs(xt,{children:[" ",fe("library:pankosmia-rcl:catalog_empty",u.current)]})})]})}function Kl({data:e,titleLabel:t,getOptionLabel:o,value:r,setValue:i}){return p.jsx(Fd,{value:r,onChange:(s,a)=>{i(a)},options:e,getOptionLabel:o,sx:{width:"100%"},renderInput:s=>p.jsx(Rn,{...s,label:t})})}const Ks=$.createContext({product:null,setProduct:()=>{}});function c1({currentId:e}){const[t,o]=$.useState("auto"),[r,i]=$.useState(!1),s=$.useRef(null),[a,l]=$.useState(!1),[c,d]=$.useState([]),{i18nRef:u}=$.useContext(Jt),{enabledRef:m}=$.useContext(So),{debugRef:h}=$.useContext(Jo),{productRef:y}=$.useContext(Ks);$.useEffect(()=>{(async()=>{const E=await kt("/api/list-clients",h.current);E.ok&&d(E.json.filter(v=>!v.exclude_from_menu&&(h.current||!v.requires.debug)))})().then()},[h.current]);const g=T=>{kt(`/api/debug/${h.current?"disable":"enable"}`).then(()=>{T.stopPropagation(),T.preventDefault()})};$.useEffect(()=>{let T;if(a&&!r)return T=setTimeout(()=>{if(s.current){const E=s.current.clientWidth;E>0&&(o(`${E}px`),i(!0))}},50),()=>clearTimeout(T)},[a,r]);let f=y&&y.current&&y.current.os==="android",C=f?"30px":"0px";return p.jsxs(ot,{sx:{m:0,mr:2},children:[p.jsx(wn,{onClick:T=>l(!0),children:p.jsx(Up,{sx:{color:"#FFF"}})}),p.jsx(gl,{open:a,onClose:()=>l(!1),sx:{width:"100%",height:"100%",overflow:"hidden"},children:p.jsxs(ot,{sx:{display:"flex",flexDirection:"column",minWidth:"16rem",overflow:"hidden",minHeight:f?"calc(100vh - 60px)":"100vh",m:0,p:0,paddingTop:C,paddingBottom:C},role:"presentation",children:[p.jsx(vo,{sx:{width:"100%"},children:c.map((T,E)=>T.id===e?p.jsx(xo,{disablePadding:!0,onClick:()=>l(!1),children:p.jsx(Pn,{selected:!0,children:p.jsx($n,{primary:fe(`pages:${T.id}:title`,u.current)})})},E):p.jsx(xo,{disablePadding:!0,children:p.jsx(Pn,{disabled:T.requires.net&&!m.current,onClick:()=>{window.location.href=T.url},children:p.jsx($n,{primary:fe(`pages:${T.id}:title`,u.current)})})},E))}),p.jsx(ot,{sx:{flexGrow:1}}),p.jsxs(vo,{sx:{width:"100%"},children:[p.jsx(xo,{disablePadding:!0,children:p.jsx(Pn,{selected:e.includes("settings"),onClick:()=>{window.location.href="/clients/settings"},children:p.jsx($n,{primary:fe("pages:core-settings:title",u.current)})})}),p.jsxs(Pn,{onClick:g,children:[p.jsx($n,{primary:fe("components:header:beta_mode",u.current)}),p.jsx(_s,{edge:"end",onChange:g,checked:h.current})]})]})]})})]})}function Ef({titleKey:e,widget:t,currentId:o,theme:r,showInternetSwitch:i=!0}){var y,g,f;const{i18nRef:s}=$.useContext(Jt),{clientConfigRef:a}=$.useContext(Fs),{enabledRef:l}=$.useContext(So),c=((f=(g=(y=a.current._global)==null?void 0:y.find(C=>C.id==="internetConfig"))==null?void 0:g.fields.find(C=>C.id==="internetConnectionAccess"))==null?void 0:f.value)??!0;$.useEffect(()=>{const C=fe("branding:software:name",s.current),T=fe(e,s.current);document.title=`${T} - ${C}`});const d=r?ts:$.Fragment,u=r?{theme:r}:{};let{product:m}=$.useContext(Ks),h=m&&m.os==="android";return p.jsx(d,{...u,children:p.jsx(ot,{display:"flex-start",sx:{flexGrow:1,m:0,p:0},children:p.jsx(Qa,{position:"static",sx:{m:0,p:0,paddingTop:h?"30px":"0px"},children:p.jsxs(ni,{variant:"dense",sx:{m:0,p:0},children:[p.jsx(c1,{currentId:o}),e&&e.length>0&&p.jsx(xt,{variant:"h6",sx:{m:0,p:0},children:fe(e,s.current)}),p.jsx(ot,{sx:{flexGrow:1,m:0,p:0},children:t}),p.jsx(ot,{sx:{m:0,p:0},children:c&&i&&p.jsx(_l,{netEnabled:l.current,i18n:s.current,isAndroid:h})})]})})})})}async function u1(e,t){const o=e.getReader();let r;for(;!(r=await o.read()).done;)t(r.value)}function d1(e){let t,o,r,i=!1;return function(a){t===void 0?(t=a,o=0,r=-1):t=f1(t,a);const l=t.length;let c=0;for(;o<l;){i&&(t[o]===10&&(c=++o),i=!1);let d=-1;for(;o<l&&d===-1;++o)switch(t[o]){case 58:r===-1&&(r=o-c);break;case 13:i=!0;case 10:d=o;break}if(d===-1)break;e(t.subarray(c,d),r),c=o,r=-1}c===l?t=void 0:c!==0&&(t=t.subarray(c),o-=c)}}function p1(e,t,o){let r=Of();const i=new TextDecoder;return function(a,l){if(a.length===0)o==null||o(r),r=Of();else if(l>0){const c=i.decode(a.subarray(0,l)),d=l+(a[l+1]===32?2:1),u=i.decode(a.subarray(d));switch(c){case"data":r.data=r.data?r.data+`
286
286
  `+u:u;break;case"event":r.event=u;break;case"id":e(r.id=u);break;case"retry":const m=parseInt(u,10);isNaN(m)||t(r.retry=m);break}}}}function f1(e,t){const o=new Uint8Array(e.length+t.length);return o.set(e),o.set(t,e.length),o}function Of(){return{data:"",event:"",id:"",retry:void 0}}var m1=function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(o[r[i]]=e[r[i]]);return o};const Xl="text/event-stream",h1=1e3,kf="last-event-id";function g1(e,t){var{signal:o,headers:r,onopen:i,onmessage:s,onclose:a,onerror:l,openWhenHidden:c,fetch:d}=t,u=m1(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((m,h)=>{const y=Object.assign({},r);y.accept||(y.accept=Xl);let g;function f(){g.abort(),document.hidden||S()}c||document.addEventListener("visibilitychange",f);let C=h1,T=0;function E(){document.removeEventListener("visibilitychange",f),window.clearTimeout(T),g.abort()}o==null||o.addEventListener("abort",()=>{E(),m()});const v=d??window.fetch,w=i??b1;async function S(){var P;g=new AbortController;try{const O=await v(e,Object.assign(Object.assign({},u),{headers:y,signal:g.signal}));await w(O),await u1(O.body,d1(p1(k=>{k?y[kf]=k:delete y[kf]},k=>{C=k},s))),a==null||a(),E(),m()}catch(O){if(!g.signal.aborted)try{const k=(P=l==null?void 0:l(O))!==null&&P!==void 0?P:C;window.clearTimeout(T),T=window.setTimeout(S,k)}catch(k){E(),h(k)}}}S()})}function b1(e){const t=e.headers.get("content-type");if(!(t!=null&&t.startsWith(Xl)))throw new Error(`Expected content-type to be ${Xl}, Actual: ${t}`)}const Pf=$.createContext({auth:!1,setAuth:()=>{}}),$f=$.createContext({typography:{},setTypography:()=>{}}),Rf=$.createContext({currentProject:null,setCurrentProject:()=>{}}),jf=$.createContext({systemBcv:!1,setSystemBcv:()=>{}}),If=$.createContext({messages:[],setMessages:()=>{}}),Nf=$.createContext({clientInterfaces:{},setClientInterfaces:()=>{}}),Mf=$.createContext({snippet:{},setSnippet:()=>{}}),Af=$.createContext({word:{},setWord:()=>{}});function y1(){return p.jsx(ot,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",width:"100%"},children:p.jsx(jr,{})})}function Df({children:e,netValue:t,debugValue:o,bcvValue:r,i18nValue:i,authValue:s,typographyValue:a,currentProjectValue:l,clientConfigValue:c,clientInterfacesValue:d,snippetValue:u,wordValue:m,productValue:h}){const[y,g]=$.useState([]),f={messages:y,setMessages:g},{enqueueSnackbar:C}=o1();$.useEffect(()=>{const w=S=>{const P=S.split("--");P.length===4&&C(`${P[2]} => ${P[3]}`,{variant:P[0],anchorOrigin:{vertical:"bottom",horizontal:"right"}})};y.length>0&&(y.forEach(S=>w(S)),g([]))},[y,C]);const[T,E]=$.useState({palette:{primary:{main:"#666"},secondary:{main:"#888"}}});$.useEffect(()=>{T.palette&&T.palette.primary&&T.palette.primary.main&&T.palette.primary.main==="#666"&&Bs({url:"/api/app-resources/themes/default.json",setter:E}).then()},[T.palette]);const v=Qi({components:{MuiFab:{styleOverrides:{root:{textTransform:"none"}}},MuiButton:{styleOverrides:{root:{textTransform:"none"}}},MuiTab:{styleOverrides:{root:{textTransform:"none"}}},MuiToggleButton:{styleOverrides:{root:{textTransform:"none"}}}}},T);return p.jsx(ts,{theme:v,children:p.jsx(Fs.Provider,{value:c,children:p.jsx(Nf.Provider,{value:d,children:p.jsx(Jt.Provider,{value:i,children:p.jsx(Mf.Provider,{value:u,children:p.jsx(Af.Provider,{value:m,children:p.jsx($f.Provider,{value:a,children:p.jsx(Pf.Provider,{value:s,children:p.jsx(Rf.Provider,{value:l,children:p.jsx(jf.Provider,{value:r,children:p.jsx(If.Provider,{value:f,children:p.jsx(Jo.Provider,{value:o,children:p.jsx(Ks.Provider,{value:h,children:p.jsx(So.Provider,{value:t,children:p.jsx(ot,{sx:{height:"100vh",overflow:"hidden"},children:!i||Object.keys(i.i18n).length===0?p.jsx(y1,{}):e})})})})})})})})})})})})})})})}var Xs={exports:{}},v1=Xs.exports,_f;function x1(){return _f||(_f=1,(function(e,t){(function(o,r,i){e.exports=i()})("dcopy",v1,function(){return function(r){if(/number|string|boolean/.test(typeof r))return r;if(r instanceof Date)return new Date(r.getTime());var i=r instanceof Array?[]:{};return s(r,i),i;function s(a,l){for(var c in a){var d=a[c];if(d instanceof Date){var u=new Date(d.getTime());o(l,c,u)}else if(d instanceof Function){var u=d;o(l,c,u)}else if(d instanceof Array){var u=[],m=o(l,c,u);s(d,m)}else if(d instanceof Object){var u={},m=o(l,c,u);s(d,m)}else{var u=d;o(l,c,u)}}}};function o(r,i,s){if(r instanceof Array)return r.push(s),r[r.length-1];if(r instanceof Object)return r[i]=s,r[i]}})})(Xs)),Xs.exports}var C1=x1();const S1=Ql(C1);function Lf({children:e}){const[t,o]=$.useState(!1),r=$.useRef(t),i=ie=>{r.current=ie,o(ie)},[s,a]=$.useState(!1),l=$.useRef(s),c=ie=>{l.current=ie,a(ie)},[d,u]=$.useState({}),m=$.useRef(d),h=ie=>{m.current=ie,u(ie)},[y,g]=$.useState({bookCode:"TIT",chapterNum:1,verseNum:1,endVerseNum:1}),f=$.useRef(y),C=ie=>{f.current=ie,g(ie)},[T,E]=$.useState({}),v=$.useRef(T),w=ie=>{v.current=ie,E(ie)},[S,P]=$.useState({font_set:"Pankosmia-CardoPankosmia-EzraSILPankosmia-PadaukPankosmia-AwamiNastaliqPankosmia-NotoNastaliqUrduPankosmia-GentiumPlus",size:"medium",direction:"ltr"}),O=$.useRef(S),k=ie=>{O.current=ie,P(ie)},[R,b]=$.useState(null),j=$.useRef(R),N=ie=>{j.current=ie,b(ie)},[M,z]=$.useState({}),F=$.useRef(M),L=ie=>{F.current=ie,z(ie)},X=async()=>{await kt("/api/client-config").then(ie=>ie.json).then(ie=>L(ie)).catch(ie=>console.error("Error :",ie))},[J,W]=$.useState({}),B=$.useRef(J),A=ie=>{B.current=ie,W(ie)},[Q,Y]=$.useState(null),q=$.useRef(Q),U=ie=>{q.current=ie,Y(ie)},[_,G]=$.useState(null),H=$.useRef(_),ne=ie=>{H.current=ie,G(ie)},[se,ce]=$.useState(null),D=$.useRef(se),Ee=ie=>{D.current=ie,ce(ie)},de=async()=>{await kt("/api/client-interfaces").then(ie=>ie.json).then(ie=>A(ie)).catch(ie=>console.error("Error :",ie))},Ce=async()=>{const ie=await kt("/api/i18n/flat",l.current);ie.ok?w(ie.json):mn(`Could not load i18n: ${ie.error}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})},We=async()=>{const ie=await kt("/api/settings/typography",l.current);ie.ok?k(ie.json):mn(`Could not load typography: ${ie.error}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})},ue=async()=>{const ie=await kt("/api/version",l.current);ie.ok?Ee(ie.json):mn(`Could not load version for product: ${ie.error}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})},Ae=async()=>{const ie=await kt("/api/app-state/alignment",l.current);if(ie.ok){const $e=ie.json.snippet,he=ie.json.word;$e!==q.current&&U($e),JSON.stringify(he)!==JSON.stringify(H.current)&&ne(he)}else mn(`Could not load alignment: ${ie.error}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})};$.useEffect(()=>{Ce().then(),Ae().then(),We().then(),X().then(),de().then(),ue().then()},[]),$.useEffect(()=>{(async()=>{const $e=await kt("/api/navigation/bcv",l.current);if($e.ok){const he=$e.json;C({bookCode:he.book_code,chapterNum:he.chapter,verseNum:he.verse})}else mn(`Could not load bcv: ${$e.error}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})})().then()},[]);const Te=ie=>{const $e=ie.data.split("--");if($e.length===4){const he=$e[1]==="enabled";he!==r.current&&i(he);const Dt=$e[3]==="enabled";Dt!==l.current&&c(Dt)}},_e=ie=>{const $e=ie.data.split("--");if($e.length===4){const he={bookCode:$e[0],chapterNum:parseInt($e[1]),verseNum:parseInt($e[2]),endVerseNum:parseInt($e[3])};(he.bookCode!==f.current.bookCode||he.chapterNum!==f.current.chapterNum||he.verseNum!==f.current.verseNum||he.endVerseNum!==f.current.endVerseNum)&&C(he)}},Be=ie=>{const $e=ie.data.split("--");if($e.length===3){const he={font_set:$e[0],size:$e[1],direction:$e[2]};(he.font_set!==O.current.font_set||he.size!==O.current.size||he.direction!==O.current.direction)&&k(he)}},me=()=>{Ce().then()},at=ie=>{try{const $e=S1(m.current),[he,Dt,Mt]=ie.data.split("--");if(["true","false"].includes(Mt)){const cn=Mt==="true";(!(he in $e)||!("isActive"in $e[he])||cn!==$e[he].isActive)&&($e[he]={endpoint:Dt,isActive:cn},h($e))}}catch($e){console.log(`Auth Error: ${$e}, data: ${ie.data}`)}},ze=ie=>{if(ie.data===null)j.current!==null&&N(null);else{const $e=ie.data.split("--");if($e.length===3){let he={source:$e[0],organization:$e[1],project:$e[2]};(!j.current||he.source!==j.current.source||he.organization!==j.current.organization||he.project!==j.current.project)&&N(he)}else N(null)}},ft=ie=>{const $e=ie.data.split("--");$e.length===4&&mn(`${$e[2]} => ${$e[3]}`,{variant:$e[0],anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:$e[0]==="error"})},bt=()=>{Ae().then()};$.useEffect(()=>{const ie=new AbortController;return(async()=>{await g1("/api/notifications",{method:"GET",headers:{Accept:"text/event-stream"},onopen(he){he.ok&&he.status===200||he.status>=400&&he.status<500&&he.status!==429&&console.log("Error from SSE",he.status)},onmessage(he){he.event==="misc"?ft(he):he.event==="status"?Te(he):he.event==="bcv"?_e(he):he.event==="auth"?at(he):he.event==="languages"?me():he.event==="typography"?Be(he):he.event==="current_project"?ze(he):he.event==="alignment"&&bt()},onclose(){console.log("SSE connection closed by the server")},onerror(he){console.log("There was an error from the SSE server",he)}})})(),()=>ie.abort()},[]);const dt={enableNet:t,setEnableNet:i,enabledRef:r},Ue={debug:s,setDebug:c,debugRef:l},De={systemBcv:y,setSystemBcv:C,bcvRef:f},Ie={auth:d,setAuth:h,authRef:m},Se={i18n:T,setI18n:w,i18nRef:v},Ye={typography:S,setTypography:k,typographyRef:O},He={currentProject:R,setCurrentProject:N,currentProjectRef:j},St={clientInterfaces:J,setClientInterfaces:A,clientInterfacesRef:B},jt={snippet:Q,setSnippet:U,snippetRef:q},pe={word:_,setWord:ne,wordRef:H},Le={clientConfig:M,setClientConfig:L,clientConfigRef:F};l.current&&console.log("Rerender Spa");const Ge={product:se,setProduct:Ee,productRef:D},Pt=Z(Cf)(()=>({"&.notistack-MuiContent-error":{backgroundColor:"#FDEDED",color:"#D32F2F"},"&.notistack-MuiContent-info":{backgroundColor:"#E5F6FD",color:"#0288D1"},"&.notistack-MuiContent-warning":{backgroundColor:"#FFF4E5",color:"#EF6C00"},"&.notistack-MuiContent-success":{backgroundColor:"#EDF7ED",color:"#2E7D32"}}));return p.jsx(wf,{Components:{error:Pt,info:Pt,warning:Pt,success:Pt},maxSnack:6,children:p.jsx(Df,{netValue:dt,debugValue:Ue,i18nValue:Se,bcvValue:De,authValue:Ie,typographyValue:Ye,currentProjectValue:He,clientConfigValue:Le,clientInterfacesValue:St,snippetValue:jt,wordValue:pe,productValue:Ge,children:e})})}function Bf({children:e}){return p.jsx(wf,{maxSnack:3,children:p.jsx(Lf,{children:e})})}function Ff({titleKey:e,widget:t,margin:o=0,children:r,requireNet:i=!1,currentId:s}){const{enableNet:a}=$.useContext(So),{i18nRef:l}=$.useContext(Jt);return i&&!a?p.jsx(ot,{sx:{m:0,height:"100%",overflowX:"hidden",overflowY:"auto"},children:p.jsx(gt,{container:!0,alignItems:"center",justifyContent:"center",sx:{minHeight:"100vh"},children:p.jsxs(gt,{item:!0,display:"flex",flexDirection:"column",alignItems:"center",rowSpacing:.5,children:[p.jsx(r1,{sx:{fontSize:80},color:"warning"}),p.jsx("p",{children:fe("components:framework:no_entry_if_offline",l.current)})]})})}):p.jsxs(p.Fragment,{children:[p.jsx(ot,{children:p.jsx(Ef,{titleKey:e||null,widget:t||null,currentId:s})}),p.jsx(ot,{sx:{m:o,overflowX:"hidden",overflowY:"auto"},children:r})]})}function T1({children:e,titleKey:t,requireNet:o,currentId:r,widget:i,margin:s}){return p.jsx(Bf,{children:p.jsx(Ff,{titleKey:t,requireNet:o,currentId:r,widget:i||null,margin:s||0,children:e})})}const w1=$.createContext({languages:!1,setLanguages:()=>{}});function E1({currentLanguage:e,setCurrentLanguage:t,setIsValid:o,open:r=!0}){const[i,s]=$.useState("BCP47List"),[a,l]=$.useState(!1),{i18nRef:c}=$.useContext(Jt),[d,u]=$.useState(!0),[m,h]=$.useState(!1),[y,g]=$.useState(""),[f,C]=$.useState([]),[T,E]=$.useState({}),[v,w]=$.useState(!0),S=/^x-[a-z]{3}$/;$.useEffect(()=>{r&&Bs({url:"/api/git/list-local-repos",setter:C}).then()},[r]),$.useEffect(()=>{r&&Bs({url:"/api/app-resources/lookups/bcp47-language_codes.json",setter:E}).then()},[r]);const P=Object.entries(T).map(([k,R])=>({language_code:k,language_name:R.en}));$.useEffect(()=>{e.language_code&&o(!a)},[a]),$.useEffect(()=>{v&&Object.keys(T).length>0&&(e.language_code&&(T[e.language_code]?t({language_code:e.language_code,language_name:T[e.language_code].en}):(t({language_code:`x-${e.language_code}`,language_name:`x-${e.language_code}`.toUpperCase()}),s("customLanguage"))),w(!1))},[T,v,P]),$.useEffect(()=>{y&&kt(`/api/burrito/metadata/summary/${y}`).then(k=>k.json).then(k=>t({...e,language_code:k.language_code,language_name:k.language_name})).catch(k=>console.error("Error :",k))},[r,y]);const O=f.filter(k=>d&&k.startsWith("_local_")||m&&k.startsWith("git"));return p.jsxs(p.Fragment,{children:[p.jsxs(Wr,{children:[p.jsx($s,{id:"demo-radio-buttons-group-label",children:fe("library:pankosmia-rcl:choose_language",c.current)}),p.jsxs(yp,{row:!0,value:i,onChange:k=>{s(k.target.value),t({language_code:"",language_name:""})},"aria-labelledby":"demo-radio-buttons-group-label",name:"radio-buttons-group",children:[p.jsx(Jn,{value:"BCP47List",control:p.jsx(Ns,{}),label:fe("library:pankosmia-rcl:lang_code_bcp47_list",c.current)}),p.jsx(Jn,{value:"burrito",control:p.jsx(Ns,{}),label:fe("library:pankosmia-rcl:lang_code_burrito",c.current)}),p.jsx(Jn,{value:"customLanguage",control:p.jsx(Ns,{}),label:fe("library:pankosmia-rcl:lang_code_custom_language",c.current)})]})]}),i==="BCP47List"&&p.jsxs(gt,{container:!0,spacing:2,children:[p.jsx(gt,{item:!0,size:12,children:p.jsx(xt,{children:fe("library:pankosmia-rcl:description_bcp47_list",c.current)})}),p.jsx(gt,{item:!0,size:6,children:T&&p.jsx(Kl,{value:e.language_code??null,setValue:k=>{var R;return t({language_code:k,language_name:((R=T[k])==null?void 0:R.en)??""})},data:Object.keys(T),getOptionLabel:k=>{var R,b;return(R=T[k])!=null&&R.en?`${(b=T[k])==null?void 0:b.en} (${k})`:""},titleLabel:`${fe("library:pankosmia-rcl:language",c.current)} *`})}),p.jsx(gt,{item:!0,size:6,children:p.jsx(Rn,{disabled:!0,id:"language_code",sx:{width:"100%"},label:fe("library:pankosmia-rcl:lang_code",c.current),value:e?e.language_code:null})})]}),i==="burrito"&&p.jsxs(gt,{container:!0,spacing:1,justifyItems:"flex-end",alignItems:"stretch",children:[p.jsx(xt,{children:fe("library:pankosmia-rcl:description_lang_code_burrito",c.current)}),p.jsxs(gt,{item:!0,size:12,children:[p.jsx($s,{children:fe("library:pankosmia-rcl:title_section_burrito",c.current)}),p.jsxs(Hr,{row:!0,required:!0,children:[p.jsx(Jn,{control:p.jsx(yo,{color:"secondary",checked:d,onChange:()=>u(!d),defaultChecked:!0}),label:fe("library:pankosmia-rcl:local_project",c.current)}),p.jsx(Jn,{control:p.jsx(yo,{color:"secondary",checked:m,onChange:()=>h(!m)}),label:fe("library:pankosmia-rcl:burrito_resources",c.current)})]})]}),p.jsx(gt,{item:!0,size:12,children:p.jsx(Kl,{data:O,setValue:g,getOptionLabel:k=>`${k}`,titleLabel:`${fe("library:pankosmia-rcl:document",c.current)} *`})}),p.jsx(gt,{item:!0,size:6,children:p.jsx(Rn,{disabled:!0,id:"language_name",sx:{width:"100%"},label:fe("library:pankosmia-rcl:lang_name",c.current),value:e?e.language_name:null})}),p.jsx(gt,{item:!0,size:6,children:p.jsx(Rn,{disabled:!0,id:"language_code",sx:{width:"100%"},label:fe("library:pankosmia-rcl:lang_code",c.current),value:e?e.language_code:null})})]}),i==="customLanguage"&&p.jsxs(gt,{container:!0,spacing:1,justifyItems:"flex-end",alignItems:"stretch",children:[p.jsx(gt,{item:!0,size:12,children:p.jsx(xt,{children:fe("library:pankosmia-rcl:description_custom_language",c.current)})}),p.jsx(gt,{item:!0,size:6,children:p.jsx(Rn,{id:"language_name",required:!0,sx:{width:"100%"},label:fe("library:pankosmia-rcl:lang_name",c.current),value:e?e.language_name:null,onChange:k=>{const R=k.target.value;t({...e,language_name:R})}})}),p.jsx(gt,{item:!0,size:6,children:p.jsx(Rn,{id:"language_code",placeholder:"x-abc",error:a,helperText:fe("library:pankosmia-rcl:helper_language_code",c.current),required:!0,sx:{width:"100%"},label:fe("library:pankosmia-rcl:lang_code",c.current),value:e?e.language_code:null,onChange:k=>{const R=k.target.value.toLocaleLowerCase();t({...e,language_code:R}),l(R.length>0&&!S.test(R))}})})]})]})}const Js={select:{background:"white"},inputLabel:{}};function Jl(e){const{listItem:t}=e,o={menuItem:{display:"flex",justifyContent:"space-between",color:"Black"}};return p.jsx("div",{style:o.menuItem,children:p.jsx("div",{style:o.menuItem,children:p.jsx(xt,{style:{width:"100%"},noWrap:!0,variant:"body2",component:"div",children:t})})})}Jl.propTypes={listItem:Pi.PropTypes.shape({index:Pi.PropTypes.objectOf(Pi.PropTypes.string)})};function O1({isOpen:e,versification:t,setVersification:o}){const{i18nRef:r}=$.useContext(Jt),[i,s]=$.useState([]),[a,l]=$.useState(!1),c=()=>l(d=>!d);return $.useEffect(()=>{e&&Bs({url:"/api/content-utils/versifications",setter:s}).then()},[e]),p.jsxs(Ko,{spacing:1,children:[p.jsxs(xt,{variant:"body1",children:[" ",fe("library:pankosmia-rcl:choose_versification",r.current)," "]}),p.jsxs(Ko,{spacing:0,children:[p.jsx(xt,{variant:"body2",sx:{display:"-webkit-box",WebkitLineClamp:a?"unset":1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:fe("library:pankosmia-rcl:text_versification",r.current)}),p.jsx(bo,{onClick:c,color:"secondary",size:"small",disableRipple:!0,sx:{alignSelf:"flex-start",p:0,minWidth:0,textTransform:"none",fontSize:"0.8rem",fontWeight:400,"&:hover":{background:"none",textDecoration:"underline"}},children:fe(a?"library:pankosmia-rcl:show_less":"library:pankosmia-rcl:show_more",r.current)})]}),p.jsxs(Wr,{sx:{width:"100%"},children:[p.jsx(js,{id:"booksVersification-label",required:!0,htmlFor:"booksVersification",sx:Js.inputLabel,children:fe("library:pankosmia-rcl:versification_scheme",r.current)}),p.jsx(Zr,{variant:"outlined",required:!0,labelId:"booksVersification-label",name:"booksVersification",inputProps:{id:"bookVersification"},value:t,label:fe("library:pankosmia-rcl:versification_scheme",r.current),onChange:d=>{o(d.target.value)},sx:Js.select,children:i.map((d,u)=>p.jsx(Tl,{value:d,dense:!0,children:p.jsx(Jl,{listItem:`${d.toUpperCase()} - ${fe(`scripture:versifications:${d}`,r.current)}`})},u))}),p.jsxs(bl,{children:[" ",fe("library:pankosmia-rcl:helper_versification",r.current)]})]})]})}function k1({bookCode:e,setBookCode:t,bookAbbr:o,setBookAbbr:r,bookTitle:i,setBookTitle:s,bookCodes:a,showVersification:l,setShowVersification:c,bookProject:d,addVerses:u=!0}){var E,v,w,S,P,O,k,R;const{i18nRef:m}=$.useContext(Jt),[h,y]=$.useState(!0),[g,f]=$.useState({});$.useEffect(()=>{kt("/api/client-config").then(b=>b.json).then(b=>f(b)).catch(b=>console.error("Error :",b))},[]);const C=((S=(w=(v=(E=g==null?void 0:g["core-contenthandler_text_translation"])==null?void 0:E.find(b=>b.id==="config"))==null?void 0:v.fields)==null?void 0:w.find(b=>b.id==="protestantBooksOnlyCheckbox"))==null?void 0:S.value)!==!1,T=((R=(k=(O=(P=g==null?void 0:g["core-contenthandler_text_translation"])==null?void 0:P.find(b=>b.id==="config"))==null?void 0:O.fields)==null?void 0:k.find(b=>b.id==="protestantBooksOnlyDefaultChecked"))==null?void 0:R.value)!==!1;return $.useEffect(()=>{y(T)},[T]),p.jsx(p.Fragment,{children:p.jsxs(gt,{container:!0,spacing:1,justifyItems:"flex-end",alignItems:"stretch",children:[p.jsx(gt,{item:!0,size:4,children:p.jsxs(Wr,{sx:{width:"100%"},children:[p.jsx(js,{id:"bookCode-label",required:!0,htmlFor:"bookCode",sx:Js.inputLabel,children:fe("library:pankosmia-rcl:book_code",m.current)}),p.jsx(Zr,{variant:"outlined",labelId:"bookCode-label",name:"bookCode",inputProps:{id:"bookCode"},value:e,label:fe("library:pankosmia-rcl:book_code",m.current),onChange:b=>{t(b.target.value),r(["1","2","3"].includes(b.target.value[0])?b.target.value.slice(0,2)+b.target.value[2].toLowerCase():b.target.value[0]+b.target.value.slice(1).toLowerCase()),s(fe(`scripture:books:${b.target.value}`,m.current))},sx:Js.select,children:(h?a.slice(0,66):a).map((b,j)=>p.jsx(Tl,{value:b,dense:!0,disabled:d?d.includes(b):!1,children:p.jsx(Jl,{listItem:`${b} - ${fe(`scripture:books:${b}`,m.current)}`})},j))})]})}),p.jsx(gt,{item:!0,size:4,children:p.jsx(Rn,{id:"bookAbbr",required:!0,sx:{width:"100%"},label:fe("library:pankosmia-rcl:book_abbr",m.current),value:o,onChange:b=>{r(b.target.value)}})}),p.jsx(gt,{item:!0,size:4,children:p.jsx(Rn,{id:"bookTitle",required:!0,sx:{width:"100%"},label:fe("library:pankosmia-rcl:book_title",m.current),value:i,onChange:b=>{s(b.target.value)}})}),C&&p.jsx(Hr,{children:p.jsx(Jn,{control:p.jsx(yo,{color:"secondary",checked:h,onChange:()=>y(!h)}),label:fe("library:pankosmia-rcl:protestant_books_only",m.current)})}),u&&p.jsx(Hr,{children:p.jsx(Jn,{control:p.jsx(yo,{color:"secondary",checked:!0,disabled:!0,onChange:()=>c(!l)}),label:fe("library:pankosmia-rcl:add_versification_checkbox",m.current)})})]})})}function P1({steps:e,initialStep:t=0,renderStepContent:o,isStepValid:r,handleCreate:i,handleClose:s,requiredFieldsLabel:a,primaryButtonVariant:l,primaryActionKey:c,secondaryButtonVariant:d,secondaryActionKey:u,primaryAction:m,secondaryAction:h,isLeftStepperButtonDisabled:y}){const g=Math.min(Math.max(t-1,0),e.length-1),[f,C]=$.useState(g),[T,E]=$.useState(new Set),{i18nRef:v}=$.useContext(Jt),w=O=>T.has(O),S=async()=>{let O=T;if(w(f)&&(O=new Set(O.values()),O.delete(f)),f===e.length-1){try{await i()}catch(k){console.error("Error create project",k)}return}C(k=>k+1),E(O)},P=()=>{C(O=>O-1)};return p.jsxs(p.Fragment,{children:[p.jsx(Pp,{sx:{position:"sticky"},activeStep:f,children:e.map((O,k)=>{const R={},b={};return w(k)&&(R.completed=!1),p.jsx(wp,{...R,children:p.jsx(jl,{...b,children:O})},O)})}),f!==e.length&&p.jsxs(p.Fragment,{children:[a&&p.jsx(hl,{variant:"subtitle2",sx:{padding:"16px 0px"},children:fe("library:pankosmia-rcl:required_field",v.current)}),o(f)]}),p.jsxs(Os,{sx:{justifyContent:"space-between",padding:"16px 0px 0px"},children:[p.jsx(bo,{sx:{padding:0},color:d||"inherit",onClick:f===0?s:h||P,disabled:y&&f===0,children:f===0?`${fe(`${u||"library:pankosmia-rcl:cancel"}`,v.current)}`:`${fe("library:pankosmia-rcl:back_button",v.current)}`}),p.jsx(bo,{sx:{padding:0},color:l||"inherit",onClick:m||S,disabled:!r(f),children:f===e.length-1?`${fe(`${c||"library:pankosmia-rcl:create"}`,v.current)}`:`${fe("library:pankosmia-rcl:next_button",v.current)}`})]})]})}const $1={palette:{primary:{main:"#666"},secondary:{main:"#888"}}};function R1({isAndroid:e,children:t}){return p.jsx(ot,{sx:{mb:2,position:"fixed",top:e?"94px":"64px",left:e?"30px":0,bottom:e?"30px":0,right:e?"30px":0,overflow:"auto",width:e?"calc(100% - 60px)":"100%"},children:t})}Ne.AppWrapper=Df,Ne.AppbarHamburger=bw,Ne.ButtonInfo=Wp,Ne.Header=Ef,Ne.InternetSwitch=_l,Ne.InternetWarningDialog=zp,Ne.PanBookPicker=k1,Ne.PanDialog=yw,Ne.PanDialogActions=vw,Ne.PanDownload=l1,Ne.PanFilteredMenu=Kl,Ne.PanLanguagePicker=E1,Ne.PanStepperPicker=P1,Ne.PanTable=Kp,Ne.PanVersificationPicker=O1,Ne.ScrollableBody=R1,Ne.SpSpa=T1,Ne.SpSpaPage=Ff,Ne.Spa=Lf,Ne.SpaContainer=Bf,Ne.authContext=Pf,Ne.bcvContext=jf,Ne.clientConfigContext=Fs,Ne.clientInterfacesContext=Nf,Ne.currentProjectContext=Rf,Ne.debugContext=Jo,Ne.fallbackTheme=$1,Ne.i18nContext=Jt,Ne.languagesContext=w1,Ne.messagesContext=If,Ne.netContext=So,Ne.productContext=Ks,Ne.snippetContext=Mf,Ne.typographyContext=$f,Ne.wordContext=Af,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})}));
287
287
  //# sourceMappingURL=pankosmia-rcl.umd.js.map