pankosmia-rcl 0.8.20 → 0.8.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.
@@ -269,6 +269,6 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
269
269
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
270
270
  * See the License for the specific language governing permissions and
271
271
  * limitations under the License.
272
- */var Ua;function sh(){return Ua||(Ua=1,(function(e,t){var n;function r(s,a){var c=[],u=0;function p(g){return c.push(g),a}function f(){return c[u++]}return{tokenize:function(g){return g.replace(s,p)},detokenize:function(g){return g.replace(new RegExp("("+a+")","g"),f)}}}function o(){var s="`TMP`",a="`TMPLTR`",c="`TMPRTL`",u="`NOFLIP_SINGLE`",p="`NOFLIP_CLASS`",f="`COMMENT`",g="[^\\u0020-\\u007e]",b="(?:(?:\\\\[0-9a-f]{1,6})(?:\\r\\n|\\s)?)",m="(?:[0-9]*\\.[0-9]+|[0-9]+)",x="(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)",h="direction\\s*:\\s*",C="[!#$%&*-~]",E=`['"]?\\s*`,w="(^|[^a-zA-Z])",T="[^\\}]*?",P="\\/\\*\\!?\\s*@noflip\\s*\\*\\/",_="\\/\\*[^*]*\\*+([^\\/*][^*]*\\*+)*\\/",O="(?:"+b+"|\\\\[^\\r\\n\\f0-9a-f])",$="(?:[_a-z]|"+g+"|"+O+")",j="(?:[_a-z0-9-]|"+g+"|"+O+")",B="-?"+$+j+"*",z=m+"(?:\\s*"+x+"|"+B+")?",S="((?:-?"+z+")|(?:inherit|auto))",d="(?:-?"+m+"(?:\\s*"+x+")?)",A="(?:\\+|\\-|\\*|\\/)",R="(?:\\(|\\)|\\t| )",D="(?:"+R+"|"+d+"|"+A+"){3,}",G="(?:calc\\((?:"+D+")\\))",J="((?:-?"+z+")|(?:inherit|auto)|"+G+")",oe="((?:margin|padding|border-width)\\s*:\\s*)",ie="((?:-color|border-style)\\s*:\\s*)",V="(#?"+j+"+|(?:rgba?|hsla?)\\([ \\d.,%-]+\\))",k="(?:"+C+"|"+g+"|"+O+")*?",q="(?![a-zA-Z])",K="(?!("+j+`|\\r?\\n|\\s|#|\\:|\\.|\\,|\\+|>|~|\\(|\\)|\\[|\\]|=|\\*=|~=|\\^=|'[^']*'|"[^"]*"|`+f+")*?{)",M="(?!"+k+E+"\\))",Q="(?="+k+E+"\\))",N="(\\s*(?:!important\\s*)?[;}])",I=/`TMP`/g,U=/`TMPLTR`/g,X=/`TMPRTL`/g,ne=new RegExp(_,"gi"),te=new RegExp("("+P+K+"[^;}]+;?)","gi"),Y=new RegExp("("+P+T+"})","gi"),ke=new RegExp("("+h+")ltr","gi"),Re=new RegExp("("+h+")rtl","gi"),ot=new RegExp(w+"(left)"+q+M+K,"gi"),$t=new RegExp(w+"(right)"+q+M+K,"gi"),yt=new RegExp(w+"(left)"+Q,"gi"),bt=new RegExp(w+"(right)"+Q,"gi"),Me=/(:dir\( *)ltr( *\))/g,lt=/(:dir\( *)rtl( *\))/g,et=new RegExp(w+"(ltr)"+Q,"gi"),tt=new RegExp(w+"(rtl)"+Q,"gi"),Ut=new RegExp(w+"([ns]?)e-resize","gi"),It=new RegExp(w+"([ns]?)w-resize","gi"),Pt=new RegExp(oe+J+"(\\s+)"+J+"(\\s+)"+J+"(\\s+)"+J+N,"gi"),Ot=new RegExp(ie+V+"(\\s+)"+V+"(\\s+)"+V+"(\\s+)"+V+N,"gi"),Rt=new RegExp("(background(?:-position)?\\s*:\\s*(?:[^:;}\\s]+\\s+)*?)("+z+")","gi"),Mt=new RegExp("(background-position-x\\s*:\\s*)(-?"+m+"%)","gi"),At=new RegExp("(border-radius\\s*:\\s*)"+S+"(?:(?:\\s+"+S+")(?:\\s+"+S+")?(?:\\s+"+S+")?)?(?:(?:(?:\\s*\\/\\s*)"+S+")(?:\\s+"+S+")?(?:\\s+"+S+")?(?:\\s+"+S+")?)?"+N,"gi"),Se=new RegExp("(box-shadow\\s*:\\s*(?:inset\\s*)?)"+S,"gi"),be=new RegExp("(text-shadow\\s*:\\s*)"+S+"(\\s*)"+V,"gi"),We=new RegExp("(text-shadow\\s*:\\s*)"+V+"(\\s*)"+S,"gi"),Fe=new RegExp("(text-shadow\\s*:\\s*)"+S,"gi"),ce=new RegExp("(transform\\s*:[^;}]*)(translateX\\s*\\(\\s*)"+S+"(\\s*\\))","gi"),On=new RegExp("(transform\\s*:[^;}]*)(translate\\s*\\(\\s*)"+S+"((?:\\s*,\\s*"+S+"){0,2}\\s*\\))","gi");function Nr(se,H,re){var ee,Ne;return H.split("(").length>H.split(")").length?se:(re.slice(-1)==="%"&&(ee=re.indexOf("."),ee!==-1?(Ne=re.length-ee-2,re=100-parseFloat(re),re=re.toFixed(Ne)+"%"):re=100-parseFloat(re)+"%"),H+re)}function Rn(se){switch(se.length){case 4:se=[se[1],se[0],se[3],se[2]];break;case 3:se=[se[1],se[0],se[1],se[2]];break;case 2:se=[se[1],se[0]];break;case 1:se=[se[0]];break}return se.join(" ")}function as(se,H){var re,ee=[].slice.call(arguments),Ne=ee.slice(2,6).filter(function(cs){return cs}),Bt=ee.slice(6,10).filter(function(cs){return cs}),Vr=ee[10]||"";return Bt.length?re=Rn(Ne)+" / "+Rn(Bt):re=Rn(Ne),H+re+Vr}function Mn(se){return parseFloat(se)===0?se:se[0]==="-"?se.slice(1):"-"+se}function Dr(se,H,re){return H+Mn(re)}function Lr(se,H,re,ee,Ne){return H+re+Mn(ee)+Ne}function Fr(se,H,re,ee,Ne){return H+re+ee+Mn(Ne)}return{transform:function(se,H){var re=new r(te,u),ee=new r(Y,p),Ne=new r(ne,f);return se=Ne.tokenize(ee.tokenize(re.tokenize(se.replace("`","%60")))),H.transformDirInUrl&&(se=se.replace(Me,"$1"+a+"$2").replace(lt,"$1"+c+"$2").replace(et,"$1"+s).replace(tt,"$1ltr").replace(I,"rtl").replace(U,"ltr").replace(X,"rtl")),H.transformEdgeInUrl&&(se=se.replace(yt,"$1"+s).replace(bt,"$1left").replace(I,"right")),se=se.replace(ke,"$1"+s).replace(Re,"$1ltr").replace(I,"rtl").replace(ot,"$1"+s).replace($t,"$1left").replace(I,"right").replace(Ut,"$1$2"+s).replace(It,"$1$2e-resize").replace(I,"w-resize").replace(At,as).replace(Se,Dr).replace(be,Fr).replace(We,Fr).replace(Fe,Dr).replace(ce,Lr).replace(On,Lr).replace(Pt,"$1$2$3$8$5$6$7$4$9").replace(Ot,"$1$2$3$8$5$6$7$4$9").replace(Rt,Nr).replace(Mt,Nr),se=re.detokenize(ee.detokenize(Ne.detokenize(se))),se}}}n=new o,e.exports?t.transform=function(s,a,c){var u;return typeof a=="object"?u=a:(u={},typeof a=="boolean"&&(u.transformDirInUrl=a),typeof c=="boolean"&&(u.transformEdgeInUrl=c)),n.transform(s,u)}:typeof window<"u"&&(window.cssjanus=n)})(Rr,Rr.exports)),Rr.exports}var ih=sh();const ah=zr(ih);function qa(e,t,n){switch(e.type){case Wp:case Ko:case Go:return e.return=e.return||e.value;case En:e.value=Array.isArray(e.props)?e.props.join(","):e.props,Array.isArray(e.children)&&e.children.forEach(function(o){o.type===Go&&(o.children=o.value)})}var r=za(Array.prototype.concat(e.children),qa);return ct(r)?e.return=e.value+"{"+r+"}":""}function Ya(e,t,n,r){if(e.type===Aa||e.type===Up||e.type===En&&(!e.parent||e.parent.type===zp||e.parent.type===En)){var o=ah.transform(qa(e));e.children=o?rh(o)[0].children:[],e.return=""}}Object.defineProperty(Ya,"name",{value:"stylisRTLPlugin"});function Ha(){return i.jsx(l.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",width:"100%"},children:i.jsx(l.CircularProgress,{})})}function Ga({children:e,netValue:t,debugValue:n,bcvValue:r,i18nValue:o,authValue:s,typographyValue:a,currentProjectValue:c,clientConfigValue:u,clientInterfacesValue:p,snippetValue:f,wordValue:g,productValue:b,betaValue:m}){var S,d;const[x,h]=v.useState([]),C={messages:x,setMessages:h},{enqueueSnackbar:E}=qe.useSnackbar(),[w,T]=v.useState(""),[P,_]=v.useState(null),[O,$]=v.useState({palette:{primary:{main:"#666"},secondary:{main:"#888"}}}),[j,B]=v.useState(null);v.useEffect(()=>{Nn({url:"/api/app-resources/themes/default.json",setter:$}).catch(A=>{console.error("Failed to load Pankosmia theme:",A)})},[]),v.useEffect(()=>{let A={};document.fonts.ready.then(()=>{document.fonts.forEach(R=>{const D=R.family.replace(/['"]/g,"").trim().replace(/\s+/g," ");A[D.replaceAll(" ","")]=D}),_(A)})},[]),v.useEffect(()=>{if(P){let A=[],R={},D=a.typographyRef.current.font_set.split("Pankosmia");D.shift(),D=D.map(G=>"Pankosmia"+G),Object.entries(P).forEach(([G,J])=>{let oe=D.indexOf(G);oe>=0&&(R[oe]=J)});for(let G=0;G<Object.keys(D).length;G++)R[G]&&A.push(R[G]);T(A)}},[(S=a.typographyRef.current)==null?void 0:S.font_set,P]),v.useEffect(()=>{const A=R=>{const D=R.split("--");D.length===4&&E(`${D[2]} => ${D[3]}`,{variant:D[0],anchorOrigin:{vertical:"bottom",horizontal:"right"}})};x.length>0&&(x.forEach(R=>A(R)),h([]))},[x,E]),v.useEffect(()=>{var D;const A=((D=a==null?void 0:a.typography)==null?void 0:D.direction)==="rtl"?"rtl":"ltr",R=yr({direction:A,typography:{...O.typography||{},fontFamily:w.length?w.join(","):"inherit"},components:{MuiCssBaseline:{styleOverrides:{html:{fontFamily:w.length?w.join(","):void 0},body:{fontFamily:w.length?w.join(","):void 0},"#root":{fontFamily:w.length?w.join(","):void 0},"*, *::before, *::after":{fontFamily:"inherit"}}},MuiFab:{styleOverrides:{root:{textTransform:"none"}}},MuiButton:{styleOverrides:{root:{textTransform:"none"}}},MuiTab:{styleOverrides:{root:{textTransform:"none"}}},MuiToggleButton:{styleOverrides:{root:{textTransform:"none"}}}}},O);B(R)},[O,w,(d=a==null?void 0:a.typography)==null?void 0:d.direction]),console.log(j);const z=v.useMemo(()=>j?j.direction==="rtl"?ri({key:"muirtl",stylisPlugins:[Wa,Ya]}):ri({key:"mui",stylisPlugins:[Wa]}):null,[j]);return v.useEffect(()=>{j!=null&&j.direction&&(document.documentElement.dir=j.direction)},[j==null?void 0:j.direction]),!j||!z?i.jsx(Ha,{}):i.jsx(Ue.CacheProvider,{value:z,children:i.jsxs(Kf,{theme:j,children:[i.jsx(l.CssBaseline,{}),i.jsx(jr.Provider,{value:m,children:i.jsx(Tr.Provider,{value:u,children:i.jsx(Oa.Provider,{value:p,children:i.jsx(ve.Provider,{value:o,children:i.jsx(Ra.Provider,{value:f,children:i.jsx(Ma.Provider,{value:g,children:i.jsx(_a.Provider,{value:a,children:i.jsx(ja.Provider,{value:s,children:i.jsx($a.Provider,{value:c,children:i.jsx(Ia.Provider,{value:r,children:i.jsx(Pa.Provider,{value:C,children:i.jsx(xt.Provider,{value:n,children:i.jsx(Er.Provider,{value:b,children:i.jsx(ut.Provider,{value:t,children:i.jsx(l.Box,{sx:{height:"100vh",overflow:"hidden"},children:!o||!o.i18n||Object.keys(o.i18n).length===0?i.jsx(Ha,{}):e})})})})})})})})})})})})})})})]})})}var Mr={exports:{}},ch=Mr.exports,Ka;function lh(){return Ka||(Ka=1,(function(e,t){(function(n,r,o){e.exports=o()})("dcopy",ch,function(){return function(r){if(/number|string|boolean/.test(typeof r))return r;if(r instanceof Date)return new Date(r.getTime());var o=r instanceof Array?[]:{};return s(r,o),o;function s(a,c){for(var u in a){var p=a[u];if(p instanceof Date){var f=new Date(p.getTime());n(c,u,f)}else if(p instanceof Function){var f=p;n(c,u,f)}else if(p instanceof Array){var f=[],g=n(c,u,f);s(p,g)}else if(p instanceof Object){var f={},g=n(c,u,f);s(p,g)}else{var f=p;n(c,u,f)}}}};function n(r,o,s){if(r instanceof Array)return r.push(s),r[r.length-1];if(r instanceof Object)return r[o]=s,r[o]}})})(Mr)),Mr.exports}var uh=lh();const dh=zr(uh);function Xa({children:e}){const[t,n]=v.useState(!1),r=v.useRef(t),o=H=>{r.current=H,n(H)},[s,a]=v.useState(!1),c=v.useRef(s),u=H=>{c.current=H,a(H)},[p,f]=v.useState(!1),g=v.useRef(p),b=H=>{g.current=H,f(H)},[m,x]=v.useState({}),h=v.useRef(m),C=H=>{h.current=H,x(H)},[E,w]=v.useState({bookCode:"TIT",chapterNum:1,verseNum:1,endVerseNum:1}),T=v.useRef(E),P=H=>{T.current=H,w(H)},[_,O]=v.useState({}),$=v.useRef(_),j=H=>{$.current=H,O(H)},[B,z]=v.useState({font_set:"Pankosmia-CardoPankosmia-EzraSILPankosmia-PadaukPankosmia-AwamiNastaliqPankosmia-NotoNastaliqUrduPankosmia-GentiumPlus",size:"medium",direction:"ltr"}),S=v.useRef(B),d=H=>{S.current=H,z(H)},[A,R]=v.useState(null),D=v.useRef(A),G=H=>{D.current=H,R(H)},[J,oe]=v.useState({}),ie=v.useRef(J),V=H=>{ie.current=H,oe(H)},k=async()=>{await Ee("/api/client-config").then(H=>H.json).then(H=>V(H)).catch(H=>console.error("Error :",H))},[q,K]=v.useState({}),M=v.useRef(q),Q=H=>{M.current=H,K(H)},[N,I]=v.useState(null),U=v.useRef(N),X=H=>{U.current=H,I(H)},[ne,te]=v.useState(null),Y=v.useRef(ne),ke=H=>{Y.current=H,te(H)},[Re,ot]=v.useState(null),$t=v.useRef(Re),yt=H=>{$t.current=H,ot(H)},bt=async()=>{await Ee("/api/client-interfaces").then(H=>H.json).then(H=>Q(H)).catch(H=>console.error("Error :",H))},Me=async()=>{const H=await Ee("/api/i18n/flat",c.current);H.ok?j(H.json):qe.enqueueSnackbar(`Could not load i18n: ${H.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})},lt=async()=>{const H=await Ee("/api/settings/typography",c.current);H.ok?d(H.json):qe.enqueueSnackbar(`Could not load typography: ${H.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})},et=async()=>{const H=await Ee("/api/version",c.current);H.ok?yt(H.json):qe.enqueueSnackbar(`Could not load version for product: ${H.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})},tt=async()=>{const H=await Ee("/api/app-state/alignment",c.current);if(H.ok){const re=H.json.snippet,ee=H.json.word;re!==U.current&&X(re),JSON.stringify(ee)!==JSON.stringify(Y.current)&&ke(ee)}else qe.enqueueSnackbar(`Could not load alignment: ${H.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})};v.useEffect(()=>{Me().then(),tt().then(),lt().then(),k().then(),bt().then(),et().then()},[]),v.useEffect(()=>{(async()=>{const re=await Ee("/api/navigation/bcv",c.current);if(re.ok){const ee=re.json;P({bookCode:ee.book_code,chapterNum:ee.chapter,verseNum:ee.verse})}else qe.enqueueSnackbar(`Could not load bcv: ${re.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})})().then()},[]);const Ut=H=>{const re=H.data.split("--");if(re.length===6){const ee=re[1]==="enabled";ee!==r.current&&o(ee);const Ne=re[3]==="enabled";Ne!==c.current&&u(Ne);const Bt=re[5]==="enabled";Bt!==g.current&&b(Bt)}},It=H=>{const re=H.data.split("--");if(re.length===4){const ee={bookCode:re[0],chapterNum:parseInt(re[1]),verseNum:parseInt(re[2]),endVerseNum:parseInt(re[3])};(ee.bookCode!==T.current.bookCode||ee.chapterNum!==T.current.chapterNum||ee.verseNum!==T.current.verseNum||ee.endVerseNum!==T.current.endVerseNum)&&P(ee)}},Pt=H=>{const re=H.data.split("--");if(re.length===3){const ee={font_set:re[0],size:re[1],direction:re[2]};(ee.font_set!==S.current.font_set||ee.size!==S.current.size||ee.direction!==S.current.direction)&&d(ee)}},Ot=()=>{Me().then()},Rt=H=>{try{const re=dh(h.current),[ee,Ne,Bt]=H.data.split("--");if(["true","false"].includes(Bt)){const Vr=Bt==="true";(!(ee in re)||!("isActive"in re[ee])||Vr!==re[ee].isActive)&&(re[ee]={endpoint:Ne,isActive:Vr},C(re))}}catch(re){console.log(`Auth Error: ${re}, data: ${H.data}`)}},Mt=H=>{if(H.data===null)D.current!==null&&G(null);else{const re=H.data.split("--");if(re.length===3){let ee={source:re[0],organization:re[1],project:re[2]};(!D.current||ee.source!==D.current.source||ee.organization!==D.current.organization||ee.project!==D.current.project)&&G(ee)}else G(null)}},At=()=>{tt().then()};v.useEffect(()=>{const H=new AbortController;return(async()=>{await Fp("/api/notifications",{method:"GET",headers:{Accept:"text/event-stream"},onopen(ee){ee.ok&&ee.status===200||ee.status>=400&&ee.status<500&&ee.status!==429&&console.log("Error from SSE",ee.status)},onmessage(ee){ee.event==="misc"?miscHandler(ee):ee.event==="status"?Ut(ee):ee.event==="bcv"?It(ee):ee.event==="auth"?Rt(ee):ee.event==="languages"?Ot():ee.event==="typography"?Pt(ee):ee.event==="current_project"?Mt(ee):ee.event==="alignment"&&At()},onclose(){console.log("SSE connection closed by the server")},onerror(ee){console.log("There was an error from the SSE server",ee)}})})(),()=>H.abort()},[]);const Se={enableNet:t,setEnableNet:o,enabledRef:r},be={debug:s,setDebug:u,debugRef:c},We={beta:p,setBeta:b,betaRef:g},Fe={systemBcv:E,setSystemBcv:P,bcvRef:T},ce={auth:m,setAuth:C,authRef:h},On={i18n:_,setI18n:j,i18nRef:$},Nr={typography:B,setTypography:d,typographyRef:S},Rn={currentProject:A,setCurrentProject:G,currentProjectRef:D},as={clientInterfaces:q,setClientInterfaces:Q,clientInterfacesRef:M},Mn={snippet:N,setSnippet:X,snippetRef:U},Dr={word:ne,setWord:ke,wordRef:Y},Lr={clientConfig:J,setClientConfig:V,clientConfigRef:ie},Fr={product:Re,setProduct:yt,productRef:$t},se=Ge(qe.MaterialDesignContent)(()=>({"&.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 i.jsx(qe.SnackbarProvider,{Components:{error:se,info:se,warning:se,success:se},maxSnack:6,children:i.jsx(Ga,{netValue:Se,debugValue:be,i18nValue:On,bcvValue:Fe,authValue:ce,typographyValue:Nr,currentProjectValue:Rn,clientConfigValue:Lr,clientInterfacesValue:as,snippetValue:Mn,wordValue:Dr,productValue:Fr,betaValue:We,children:e})})}function Qa({children:e}){return i.jsx(qe.SnackbarProvider,{maxSnack:3,children:i.jsx(Xa,{children:e})})}function Ja({titleKey:e,widget:t,margin:n=0,children:r,requireNet:o=!1,currentId:s}){const{enableNet:a}=v.useContext(ut),{i18nRef:c}=v.useContext(ve);return o&&!a?i.jsx(l.Box,{sx:{m:0,height:"100%",overflowX:"hidden",overflowY:"auto"},children:i.jsx(l.Grid,{container:!0,sx:{alignItems:"center",justifyContent:"center",minHeight:"100vh"},children:i.jsxs(l.Grid,{rowSpacing:.5,sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[i.jsx(Cp,{sx:{fontSize:80},color:"warning"}),i.jsx("p",{children:W("components:framework:no_entry_if_offline",c.current)})]})})}):i.jsxs(i.Fragment,{children:[i.jsx(l.Box,{children:i.jsx(Ta,{titleKey:e||null,widget:t||null,currentId:s})}),i.jsx(l.Box,{sx:{m:n,overflowX:"hidden",overflowY:"auto"},children:r})]})}function fh({children:e,titleKey:t,requireNet:n,currentId:r,widget:o,margin:s}){return i.jsx(Qa,{children:i.jsx(Ja,{titleKey:t,requireNet:n,currentId:r,widget:o||null,margin:s||0,children:e})})}const ph=v.createContext({languages:!1,setLanguages:()=>{}}),Ar={select:{background:"white"},inputLabel:{}};function es(e){const{listItem:t}=e,n={menuItem:{display:"flex",justifyContent:"space-between",color:"Black"}};return i.jsx("div",{style:n.menuItem,children:i.jsx("div",{style:n.menuItem,children:i.jsx(l.Typography,{style:{width:"100%"},noWrap:!0,variant:"body2",component:"div",children:t})})})}es.propTypes={listItem:Fn.PropTypes.shape({index:Fn.PropTypes.objectOf(Fn.PropTypes.string)})};function hh({isOpen:e,versification:t,setVersification:n}){const{i18nRef:r}=v.useContext(ve),[o,s]=v.useState([]),[a,c]=v.useState(!1),u=()=>c(p=>!p);return v.useEffect(()=>{e&&Nn({url:"/api/content-utils/versifications",setter:s}).then()},[e]),i.jsxs(l.Stack,{spacing:1,children:[i.jsxs(l.Typography,{variant:"body1",children:[" ",W("library:pankosmia-rcl:choose_versification",r.current)," "]}),i.jsxs(l.Stack,{spacing:0,children:[i.jsx(l.Typography,{variant:"body2",sx:{display:"-webkit-box",WebkitLineClamp:a?"unset":1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:W("library:pankosmia-rcl:text_versification",r.current)}),i.jsx(l.Button,{onClick:u,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:W(a?"library:pankosmia-rcl:show_less":"library:pankosmia-rcl:show_more",r.current)})]}),i.jsxs(l.FormControl,{sx:{width:"100%"},children:[i.jsx(l.InputLabel,{id:"booksVersification-label",required:!0,htmlFor:"booksVersification",sx:Ar.inputLabel,children:W("library:pankosmia-rcl:versification_scheme",r.current)}),i.jsx(l.Select,{variant:"outlined",required:!0,labelId:"booksVersification-label",name:"booksVersification",inputProps:{id:"bookVersification"},value:t,label:W("library:pankosmia-rcl:versification_scheme",r.current),onChange:p=>{n(p.target.value)},sx:Ar.select,children:o.map((p,f)=>i.jsx(l.MenuItem,{value:p,dense:!0,children:i.jsx(es,{listItem:`${p.toUpperCase()} - ${W(`scripture:versifications:${p}`,r.current)}`})},f))}),i.jsxs(l.FormHelperText,{children:[" ",W("library:pankosmia-rcl:helper_versification",r.current)]})]})]})}function mh({bookCode:e,setBookCode:t,bookAbbr:n,setBookAbbr:r,bookTitle:o,setBookTitle:s,bookCodes:a,showVersification:c,setShowVersification:u,bookProject:p,addVerses:f=!0}){var w,T,P,_,O,$,j,B;const{i18nRef:g}=v.useContext(ve),[b,m]=v.useState(!0),[x,h]=v.useState({});v.useEffect(()=>{Ee("/api/client-config").then(z=>z.json).then(z=>h(z)).catch(z=>console.error("Error :",z))},[]);const C=((_=(P=(T=(w=x==null?void 0:x["core-contenthandler_text_translation"])==null?void 0:w.find(z=>z.id==="config"))==null?void 0:T.fields)==null?void 0:P.find(z=>z.id==="protestantBooksOnlyCheckbox"))==null?void 0:_.value)!==!1,E=((B=(j=($=(O=x==null?void 0:x["core-contenthandler_text_translation"])==null?void 0:O.find(z=>z.id==="config"))==null?void 0:$.fields)==null?void 0:j.find(z=>z.id==="protestantBooksOnlyDefaultChecked"))==null?void 0:B.value)!==!1;return v.useEffect(()=>{m(E)},[E]),i.jsx(i.Fragment,{children:i.jsxs(l.Grid,{container:!0,spacing:1,sx:{justifyItems:"flex-end",alignItems:"stretch"},children:[i.jsx(l.Grid,{size:4,children:i.jsxs(l.FormControl,{sx:{width:"100%"},children:[i.jsx(l.InputLabel,{id:"bookCode-label",required:!0,htmlFor:"bookCode",sx:Ar.inputLabel,children:W("library:pankosmia-rcl:book_code",g.current)}),i.jsx(l.Select,{variant:"outlined",labelId:"bookCode-label",name:"bookCode",inputProps:{id:"bookCode"},value:e,label:W("library:pankosmia-rcl:book_code",g.current),onChange:z=>{t(z.target.value),r(["1","2","3"].includes(z.target.value[0])?z.target.value.slice(0,2)+z.target.value[2].toLowerCase():z.target.value[0]+z.target.value.slice(1).toLowerCase()),s(W(`scripture:books:${z.target.value}`,g.current))},sx:Ar.select,children:(b?a.slice(0,66):a).map((z,S)=>i.jsx(l.MenuItem,{value:z,dense:!0,disabled:p?p.includes(z):!1,children:i.jsx(es,{listItem:`${z} - ${W(`scripture:books:${z}`,g.current)}`})},S))})]})}),i.jsx(l.Grid,{size:4,children:i.jsx(l.TextField,{id:"bookAbbr",required:!0,sx:{width:"100%"},label:W("library:pankosmia-rcl:book_abbr",g.current),value:n,onChange:z=>{r(z.target.value)}})}),i.jsx(l.Grid,{size:4,children:i.jsx(l.TextField,{id:"bookTitle",required:!0,sx:{width:"100%"},label:W("library:pankosmia-rcl:book_title",g.current),value:o,onChange:z=>{s(z.target.value)}})}),C&&i.jsx(l.FormGroup,{children:i.jsx(l.FormControlLabel,{control:i.jsx(l.Checkbox,{color:"secondary",checked:b,onChange:()=>m(!b)}),label:W("library:pankosmia-rcl:protestant_books_only",g.current)})}),f&&i.jsx(l.FormGroup,{children:i.jsx(l.FormControlLabel,{control:i.jsx(l.Checkbox,{color:"secondary",checked:!0,disabled:!0,onChange:()=>u(!c)}),label:W("library:pankosmia-rcl:add_versification_checkbox",g.current)})})]})})}function gh({steps:e,initialStep:t=0,renderStepContent:n,isStepValid:r,handleCreate:o,handleClose:s,requiredFieldsLabel:a,primaryButtonVariant:c,primaryActionKey:u,secondaryButtonVariant:p,secondaryActionKey:f,primaryAction:g,secondaryAction:b,isLeftStepperButtonDisabled:m,CustomHeader:x,isInDialogue:h=!1}){const C=Math.min(Math.max(t-1,0),e.length-1),[E,w]=v.useState(C),[T,P]=v.useState(new Set),{i18nRef:_}=v.useContext(ve),O=v.useRef(null),[$,j]=v.useState(0);v.useEffect(()=>{const d=O.current;if(!d)return;const A=()=>{j(d.getBoundingClientRect().height)};A();const R=new ResizeObserver(A);return R.observe(d),()=>R.disconnect()},[]);const B=d=>T.has(d),z=async()=>{let d=T;if(B(E)&&(d=new Set(d.values()),d.delete(E)),E===e.length-1){try{await o()}catch(A){console.error("Error create project",A)}return}w(A=>A+1),P(d)},S=()=>{w(d=>d-1)};return i.jsxs(i.Fragment,{children:[i.jsx(l.Stepper,{sx:{position:"sticky"},activeStep:E,children:e.map((d,A)=>{const R={},D={};return B(A)&&(R.completed=!1),i.jsx(l.Step,{...R,children:i.jsx(l.StepLabel,{...D,children:d})},d)})}),i.jsxs(l.Box,{ref:O,children:[x&&i.jsx(x,{}),a&&i.jsx(l.DialogContentText,{variant:"subtitle2",sx:{padding:"16px 0px"},children:W("library:pankosmia-rcl:required_field",_.current)})]}),i.jsx(l.Box,{sx:{maxHeight:h?`calc(100% - 64px - ${$}px)`:"100vh",overflowY:"auto",overflowX:"hidden"},children:E!==e.length&&i.jsx(i.Fragment,{children:n(E)})}),i.jsxs(l.DialogActions,{sx:{justifyContent:"space-between",padding:"16px 0px 0px"},children:[i.jsx(l.Button,{sx:{padding:0},color:p||"inherit",onClick:E===0?s:b||S,disabled:m&&E===0,children:E===0?`${W(`${f||"library:pankosmia-rcl:cancel"}`,_.current)}`:`${W("library:pankosmia-rcl:back_button",_.current)}`}),i.jsx(l.Button,{sx:{padding:0},color:c||"inherit",onClick:g||z,disabled:!r(E),children:E===e.length-1?`${W(`${u||"library:pankosmia-rcl:create"}`,_.current)}`:`${W("library:pankosmia-rcl:next_button",_.current)}`})]})]})}const yh={palette:{primary:{main:"#666"},secondary:{main:"#888"}}};function bh({isAndroid:e,children:t}){return i.jsx(l.Box,{sx:{mb:2,position:"fixed",top:e?"78px":"48px",left:e?"30px":0,bottom:e?"30px":0,right:e?"30px":0,overflow:"auto",width:e?"calc(100% - 60px)":"100%"},children:t})}const xh=v.forwardRef(function({href:t,netEnabled:n,children:r,...o},s){return i.jsx("a",{ref:s,href:n?t:void 0,target:n?"_blank":void 0,rel:"noopener noreferrer",style:n?void 0:{color:"inherit",textDecoration:"none",cursor:"default"},...o,children:r})});function Za({titleSection:e,children:t}){return i.jsxs(l.Stack,{spacing:1,children:[i.jsx(l.Typography,{variant:"body1",sx:{fontWeight:"bold"},children:e}),i.jsx(l.Stack,{spacing:1,children:t})]})}const vh={unavailable:"download_unavailable",checking:"download_checking",idle:"download",downloading:"download_downloading",complete:"download_installed",error:"download_retry"},Ch={ffmpeg:{check:"checkFfmpegInstalled",onProgress:"onFfmpegDownloadProgress",onComplete:"onFfmpegDownloadComplete",download:"downloadFfmpeg"},firefox:{check:"checkFirefoxInstalled",onProgress:"onDownloadProgress",onComplete:"onDownloadComplete",download:"downloadFirefox"}};function ec({asset:e,actionButtonPlugin:t}){const{i18nRef:n}=v.useContext(ve),{enabledRef:r}=v.useContext(ut),[o,s]=v.useState("checking"),[a,c]=v.useState(null),[u,p]=v.useState(null),f=!!window.electronAPI,g=Ch[e];v.useEffect(()=>{if(!f||!g)return;let x=!1;return window.electronAPI[g.check]().then(h=>{x||s(h?"complete":"idle")}),()=>{x=!0}},[e]),v.useEffect(()=>{if(!f||!g)return;const x=window.electronAPI[g.onProgress](C=>{typeof C=="number"&&!Number.isNaN(C)&&c(Math.max(0,Math.min(100,C)))}),h=window.electronAPI[g.onComplete]((C,E)=>{s(C?"complete":"error"),p(C?null:E||null),C&&(c(100),t&&setTimeout(()=>{t==null||t()},1e3))});return()=>{x(),h()}},[e]);const b=()=>{!f||!g||(s("downloading"),c(null),p(null),window.electronAPI[g.download]())},m=typeof a=="number";return i.jsxs(i.Fragment,{children:[i.jsx(l.Tooltip,{title:!f||!r.current&&W("library:pankosmia-rcl:tooltip_offline_mode",n.current),children:i.jsx("span",{style:{alignSelf:"center"},children:i.jsx(l.Button,{size:"medium",variant:"contained",startIcon:o==="complete"?i.jsx(Sp,{}):o==="error"?i.jsx(Tp,{}):i.jsx(Ip,{}),onClick:b,disabled:o==="checking"||o==="downloading"||o==="complete"||!f||!r.current,title:W(f?"library:pankosmia-rcl:download":"library:pankosmia-rcl:download_unavailable_tip",n.current),children:W(`library:pankosmia-rcl:${vh[o==="checking"&&!f?"unavailable":o]}`,n.current)})})}),o==="downloading"&&i.jsxs(i.Fragment,{children:[i.jsx(l.LinearProgress,{variant:m?"determinate":"indeterminate",value:m?a:void 0}),i.jsx(l.Typography,{variant:"body2",children:m?`${Math.round(a)}% ${W("library:pankosmia-rcl:download_percent_complete",n.current)}`:W("library:pankosmia-rcl:download_downloading",n.current)})]}),o==="error"&&i.jsxs(l.Typography,{variant:"body2",color:"error",children:[W("library:pankosmia-rcl:download_failed",n.current),u?`: ${u}`:"","."]})]})}function tc({titleLabel:e,isOpen:t,closeFn:n,children:r,actionsButtonArray:o,requiredFieldsLabel:s=!1,dividers:a=!1}){const c=l.useTheme(),{i18nRef:u}=v.useContext(ve);return i.jsxs(l.Dialog,{onClose:()=>n(),open:t,sx:{overflow:"hidden"},slotProps:{sx:{overflow:"hidden !important",display:"flex",flexDirection:"column"},paper:{component:"form",sx:{width:"auto",minWidth:"280px"}}},onKeyDown:p=>{var g,b;if(p.key!=="Enter")return;const f=o==null?void 0:o[1];(g=f==null?void 0:f.props)!=null&&g.actionFn&&!((b=f.props)!=null&&b.isDisabled)&&(p.preventDefault(),f.props.actionFn())},maxWidth:"sm",fullWidth:!1,children:[i.jsx(l.DialogTitle,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:i.jsx(l.Typography,{variant:"h6",sx:{color:c.palette.primary},component:"div",children:e})}),a&&i.jsx(l.Divider,{}),s&&i.jsx(l.Box,{sx:{paddingTop:a?"16px":"0px",paddingBottom:"16px",px:3},children:i.jsx(l.Typography,{variant:"subtitle2",children:W("library:pankosmia-rcl:required_field",u.current)})}),i.jsx(l.DialogContent,{sx:{paddingTop:s?"0px":"16px",paddingBottom:2},children:r}),a&&i.jsx(l.Divider,{}),i.jsx(l.DialogActions,{children:o&&o.map(p=>p)})]})}function Br({actionFn:e,actionLabel:t,closeFn:n,closeLabel:r,isDisabled:o,closeOnAction:s=!0,onlyCloseButton:a=!1,actionVariant:c,closeVariant:u,isLoading:p,loadingLabel:f}){return[i.jsx(kr,{actionFn:n,isDisabled:!1,label:r,variant:u,isLoading:p,loadingLabel:f}),a?null:i.jsx(kr,{actionFn:()=>{e(),s&&n()},isDisabled:o,label:t,variant:c})]}function Sh({isOpen:e,closeFn:t,asset:n,actionButtonPlugin:r}){const{i18nRef:o}=v.useContext(ve);return i.jsx(tc,{titleLabel:W("library:pankosmia-rcl:Firefox_not_installed",o.current),isOpen:e,closeFn:()=>t(),actionsButtonArray:Br({closeFn:()=>t(),closeLabel:W("library:pankosmia-rcl:cancel",o.current),onlyCloseButton:!0}),children:i.jsxs(l.Stack,{spacing:2,justifyContent:"center",alignItems:"center",sx:{width:"100%"},children:[n==="firefox"&&i.jsx(l.Typography,{variant:"body1",children:W("library:pankosmia-rcl:need_pdf_engine",o.current)}),n==="ffmpeg"&&i.jsx(l.Typography,{variant:"body1",children:W("library:pankosmia-rcl:need_ffmpeg",o.current)}),i.jsx(ec,{asset:n,actionButtonPlugin:r})]})})}function ts({titleLabel:e,isOpen:t,closeFn:n,children:r,actionsButtonArray:o,requiredFieldsLabel:s=!1}){const a=l.useTheme(),c=l.useMediaQuery(a.breakpoints.down("sm")),{i18nRef:u}=v.useContext(ve);return i.jsxs(l.Dialog,{fullScreen:c,open:t,sx:{overflow:"hidden"},onKeyDown:p=>{var g,b;if(p.key!=="Enter")return;const f=o==null?void 0:o[1];(g=f==null?void 0:f.props)!=null&&g.actionFn&&!((b=f.props)!=null&&b.isDisabled)&&(p.preventDefault(),f.props.actionFn())},slotProps:{sx:{overflow:"hidden !important",display:"flex",flexDirection:"column"},paper:{component:"form"}},maxWidth:"sm",fullWidth:!0,children:[i.jsxs(l.DialogTitle,{sx:{backgroundColor:a.palette.primary.main,display:"flex",flexDirection:"row",alignItems:"center"},children:[c&&i.jsx(l.IconButton,{sx:{color:a.palette.primary.contrastText},onClick:()=>{n()},children:i.jsx(ba,{})}),i.jsx(l.Typography,{variant:"h6",sx:{color:a.palette.primary.contrastText},component:"div",children:e}),o&&c&&o[1]&&v.cloneElement(o[1],{sx:{...o[1].props.sx,marginInlineStart:"auto",color:`${a.palette.primary.contrastText} !important`}})]}),s&&i.jsx(l.Box,{sx:{paddingTop:2,px:3},children:i.jsx(l.Typography,{variant:"subtitle2",children:W("library:pankosmia-rcl:required_field",u.current)})}),i.jsx(l.DialogContent,{sx:{py:"16px !important"},children:r}),!c&&i.jsx(l.Divider,{}),!c&&i.jsx(l.DialogActions,{children:o&&o.map(p=>p)})]})}function wh({isOpen:e,setIsOpen:t,theme:n,children:r}){return i.jsx(l.SwipeableDrawer,{anchor:"bottom",open:e,onOpen:()=>{},onClose:()=>t(!1),swipeAreaWidth:40,PaperProps:{sx:{width:"100%",boxSizing:"border-box",overflow:"hidden"}},children:i.jsxs(l.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[i.jsx(l.Box,{sx:{width:"100%",paddingY:"22px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx(l.Box,{sx:{width:32,height:4,borderRadius:2,backgroundColor:n.palette.action.active}})}),i.jsx(l.Box,{sx:{display:"flex",flexDirection:"column",overflow:"auto"},children:i.jsx(l.MenuList,{sx:{marginX:"16px",marginBottom:2},children:r})})]})})}function Th({isOpen:e,setIsOpen:t,children:n,anchorEl:r}){return i.jsx(l.Menu,{onClose:()=>t(!1),anchorEl:r,open:e,children:n})}function ns({isOpen:e,setIsOpen:t,anchorEl:n,children:r}){const o=l.useTheme();return l.useMediaQuery(o.breakpoints.down("sm"))?i.jsx(wh,{theme:o,isOpen:e,setIsOpen:t,children:r}):i.jsx(Th,{anchorEl:n,isOpen:e,setIsOpen:t,children:r})}function kh(e){return wt("MuiIconButton",e)}const nc=Tt("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge","loading","loadingIndicator","loadingWrapper"]),Eh=e=>{const{classes:t,disabled:n,color:r,edge:o,size:s,loading:a}=e,c={root:["root",a&&"loading",n&&"disabled",r!=="default"&&`color${De(r)}`,o&&`edge${De(o)}`,`size${De(s)}`],loadingIndicator:["loadingIndicator"],loadingWrapper:["loadingWrapper"]};return qt(c,kh,t)},jh=Ge(Oo,{name:"MuiIconButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!=="default"&&t[`color${De(n.color)}`],n.edge&&t[`edge${De(n.edge)}`],t[`size${De(n.size)}`]]}})(Et(({theme:e})=>({textAlign:"center",flex:"0 0 auto",fontSize:e.typography.pxToRem(24),padding:8,borderRadius:"50%",color:(e.vars||e).palette.action.active,...Cr(e,"background-color",{duration:e.transitions.duration.shortest}),variants:[{props:t=>!t.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:"var(--IconButton-hoverBg)","@media (hover: none)":{backgroundColor:"transparent"}}}},{props:{edge:"start"},style:{marginLeft:-12}},{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:{edge:"end"},style:{marginRight:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}}]})),Et(({theme:e})=>({variants:[{props:{color:"inherit"},style:{color:"inherit"}},...Object.entries(e.palette).filter(Ro()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main,"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:"small"},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:"large"},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${nc.disabled}`]:{backgroundColor:"transparent",color:(e.vars||e).palette.action.disabled},[`&.${nc.loading}`]:{color:"transparent"}}))),_h=Ge("span",{name:"MuiIconButton",slot:"LoadingIndicator"})(({theme:e})=>({display:"none",position:"absolute",visibility:"visible",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:"flex"}}]})),rc=F.forwardRef(function(t,n){const r=Vt({props:t,name:"MuiIconButton"}),{edge:o=!1,children:s,className:a,color:c="default",disabled:u=!1,disableFocusRipple:p=!1,size:f="medium",id:g,loading:b=null,loadingIndicator:m,...x}=r,h=Ti(g),C=m??i.jsx(qo,{"aria-labelledby":h,color:"inherit",size:16}),E={...r,edge:o,color:c,disabled:u,disableFocusRipple:p,loading:b,loadingIndicator:C,size:f},w=Eh(E);return i.jsxs(jh,{id:b?h:g,className:Ae(w.root,a),centerRipple:!0,internalNativeButton:!0,focusRipple:!p,disabled:u||b,ref:n,...x,ownerState:E,children:[typeof b=="boolean"&&i.jsx("span",{className:w.loadingWrapper,style:{display:"contents"},children:i.jsx(_h,{className:w.loadingIndicator,ownerState:E,children:b&&C})}),s]})});process.env.NODE_ENV!=="production"&&(rc.propTypes={children:Qr(y.node,e=>F.Children.toArray(e.children).some(n=>F.isValidElement(n)&&n.props.onClick)?new Error(["MUI: You are providing an onClick event listener to a child of a button element.","Prefer applying it to the IconButton directly.","This guarantees that the whole <button> will be responsive to click events."].join(`
272
+ */var Ua;function sh(){return Ua||(Ua=1,(function(e,t){var n;function r(s,a){var c=[],u=0;function p(g){return c.push(g),a}function f(){return c[u++]}return{tokenize:function(g){return g.replace(s,p)},detokenize:function(g){return g.replace(new RegExp("("+a+")","g"),f)}}}function o(){var s="`TMP`",a="`TMPLTR`",c="`TMPRTL`",u="`NOFLIP_SINGLE`",p="`NOFLIP_CLASS`",f="`COMMENT`",g="[^\\u0020-\\u007e]",b="(?:(?:\\\\[0-9a-f]{1,6})(?:\\r\\n|\\s)?)",m="(?:[0-9]*\\.[0-9]+|[0-9]+)",x="(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)",h="direction\\s*:\\s*",C="[!#$%&*-~]",E=`['"]?\\s*`,w="(^|[^a-zA-Z])",T="[^\\}]*?",P="\\/\\*\\!?\\s*@noflip\\s*\\*\\/",_="\\/\\*[^*]*\\*+([^\\/*][^*]*\\*+)*\\/",O="(?:"+b+"|\\\\[^\\r\\n\\f0-9a-f])",$="(?:[_a-z]|"+g+"|"+O+")",j="(?:[_a-z0-9-]|"+g+"|"+O+")",B="-?"+$+j+"*",z=m+"(?:\\s*"+x+"|"+B+")?",S="((?:-?"+z+")|(?:inherit|auto))",d="(?:-?"+m+"(?:\\s*"+x+")?)",A="(?:\\+|\\-|\\*|\\/)",R="(?:\\(|\\)|\\t| )",D="(?:"+R+"|"+d+"|"+A+"){3,}",G="(?:calc\\((?:"+D+")\\))",J="((?:-?"+z+")|(?:inherit|auto)|"+G+")",oe="((?:margin|padding|border-width)\\s*:\\s*)",ie="((?:-color|border-style)\\s*:\\s*)",V="(#?"+j+"+|(?:rgba?|hsla?)\\([ \\d.,%-]+\\))",k="(?:"+C+"|"+g+"|"+O+")*?",q="(?![a-zA-Z])",K="(?!("+j+`|\\r?\\n|\\s|#|\\:|\\.|\\,|\\+|>|~|\\(|\\)|\\[|\\]|=|\\*=|~=|\\^=|'[^']*'|"[^"]*"|`+f+")*?{)",M="(?!"+k+E+"\\))",Q="(?="+k+E+"\\))",N="(\\s*(?:!important\\s*)?[;}])",I=/`TMP`/g,U=/`TMPLTR`/g,X=/`TMPRTL`/g,ne=new RegExp(_,"gi"),te=new RegExp("("+P+K+"[^;}]+;?)","gi"),Y=new RegExp("("+P+T+"})","gi"),ke=new RegExp("("+h+")ltr","gi"),Re=new RegExp("("+h+")rtl","gi"),ot=new RegExp(w+"(left)"+q+M+K,"gi"),$t=new RegExp(w+"(right)"+q+M+K,"gi"),yt=new RegExp(w+"(left)"+Q,"gi"),bt=new RegExp(w+"(right)"+Q,"gi"),Me=/(:dir\( *)ltr( *\))/g,lt=/(:dir\( *)rtl( *\))/g,et=new RegExp(w+"(ltr)"+Q,"gi"),tt=new RegExp(w+"(rtl)"+Q,"gi"),Ut=new RegExp(w+"([ns]?)e-resize","gi"),It=new RegExp(w+"([ns]?)w-resize","gi"),Pt=new RegExp(oe+J+"(\\s+)"+J+"(\\s+)"+J+"(\\s+)"+J+N,"gi"),Ot=new RegExp(ie+V+"(\\s+)"+V+"(\\s+)"+V+"(\\s+)"+V+N,"gi"),Rt=new RegExp("(background(?:-position)?\\s*:\\s*(?:[^:;}\\s]+\\s+)*?)("+z+")","gi"),Mt=new RegExp("(background-position-x\\s*:\\s*)(-?"+m+"%)","gi"),At=new RegExp("(border-radius\\s*:\\s*)"+S+"(?:(?:\\s+"+S+")(?:\\s+"+S+")?(?:\\s+"+S+")?)?(?:(?:(?:\\s*\\/\\s*)"+S+")(?:\\s+"+S+")?(?:\\s+"+S+")?(?:\\s+"+S+")?)?"+N,"gi"),Se=new RegExp("(box-shadow\\s*:\\s*(?:inset\\s*)?)"+S,"gi"),be=new RegExp("(text-shadow\\s*:\\s*)"+S+"(\\s*)"+V,"gi"),We=new RegExp("(text-shadow\\s*:\\s*)"+V+"(\\s*)"+S,"gi"),Fe=new RegExp("(text-shadow\\s*:\\s*)"+S,"gi"),ce=new RegExp("(transform\\s*:[^;}]*)(translateX\\s*\\(\\s*)"+S+"(\\s*\\))","gi"),On=new RegExp("(transform\\s*:[^;}]*)(translate\\s*\\(\\s*)"+S+"((?:\\s*,\\s*"+S+"){0,2}\\s*\\))","gi");function Nr(se,H,re){var ee,Ne;return H.split("(").length>H.split(")").length?se:(re.slice(-1)==="%"&&(ee=re.indexOf("."),ee!==-1?(Ne=re.length-ee-2,re=100-parseFloat(re),re=re.toFixed(Ne)+"%"):re=100-parseFloat(re)+"%"),H+re)}function Rn(se){switch(se.length){case 4:se=[se[1],se[0],se[3],se[2]];break;case 3:se=[se[1],se[0],se[1],se[2]];break;case 2:se=[se[1],se[0]];break;case 1:se=[se[0]];break}return se.join(" ")}function as(se,H){var re,ee=[].slice.call(arguments),Ne=ee.slice(2,6).filter(function(cs){return cs}),Bt=ee.slice(6,10).filter(function(cs){return cs}),Vr=ee[10]||"";return Bt.length?re=Rn(Ne)+" / "+Rn(Bt):re=Rn(Ne),H+re+Vr}function Mn(se){return parseFloat(se)===0?se:se[0]==="-"?se.slice(1):"-"+se}function Dr(se,H,re){return H+Mn(re)}function Lr(se,H,re,ee,Ne){return H+re+Mn(ee)+Ne}function Fr(se,H,re,ee,Ne){return H+re+ee+Mn(Ne)}return{transform:function(se,H){var re=new r(te,u),ee=new r(Y,p),Ne=new r(ne,f);return se=Ne.tokenize(ee.tokenize(re.tokenize(se.replace("`","%60")))),H.transformDirInUrl&&(se=se.replace(Me,"$1"+a+"$2").replace(lt,"$1"+c+"$2").replace(et,"$1"+s).replace(tt,"$1ltr").replace(I,"rtl").replace(U,"ltr").replace(X,"rtl")),H.transformEdgeInUrl&&(se=se.replace(yt,"$1"+s).replace(bt,"$1left").replace(I,"right")),se=se.replace(ke,"$1"+s).replace(Re,"$1ltr").replace(I,"rtl").replace(ot,"$1"+s).replace($t,"$1left").replace(I,"right").replace(Ut,"$1$2"+s).replace(It,"$1$2e-resize").replace(I,"w-resize").replace(At,as).replace(Se,Dr).replace(be,Fr).replace(We,Fr).replace(Fe,Dr).replace(ce,Lr).replace(On,Lr).replace(Pt,"$1$2$3$8$5$6$7$4$9").replace(Ot,"$1$2$3$8$5$6$7$4$9").replace(Rt,Nr).replace(Mt,Nr),se=re.detokenize(ee.detokenize(Ne.detokenize(se))),se}}}n=new o,e.exports?t.transform=function(s,a,c){var u;return typeof a=="object"?u=a:(u={},typeof a=="boolean"&&(u.transformDirInUrl=a),typeof c=="boolean"&&(u.transformEdgeInUrl=c)),n.transform(s,u)}:typeof window<"u"&&(window.cssjanus=n)})(Rr,Rr.exports)),Rr.exports}var ih=sh();const ah=zr(ih);function qa(e,t,n){switch(e.type){case Wp:case Ko:case Go:return e.return=e.return||e.value;case En:e.value=Array.isArray(e.props)?e.props.join(","):e.props,Array.isArray(e.children)&&e.children.forEach(function(o){o.type===Go&&(o.children=o.value)})}var r=za(Array.prototype.concat(e.children),qa);return ct(r)?e.return=e.value+"{"+r+"}":""}function Ya(e,t,n,r){if(e.type===Aa||e.type===Up||e.type===En&&(!e.parent||e.parent.type===zp||e.parent.type===En)){var o=ah.transform(qa(e));e.children=o?rh(o)[0].children:[],e.return=""}}Object.defineProperty(Ya,"name",{value:"stylisRTLPlugin"});function Ha(){return i.jsx(l.Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",width:"100%"},children:i.jsx(l.CircularProgress,{})})}function Ga({children:e,netValue:t,debugValue:n,bcvValue:r,i18nValue:o,authValue:s,typographyValue:a,currentProjectValue:c,clientConfigValue:u,clientInterfacesValue:p,snippetValue:f,wordValue:g,productValue:b,betaValue:m}){var S,d;const[x,h]=v.useState([]),C={messages:x,setMessages:h},{enqueueSnackbar:E}=qe.useSnackbar(),[w,T]=v.useState(""),[P,_]=v.useState(null),[O,$]=v.useState({palette:{primary:{main:"#666"},secondary:{main:"#888"}}}),[j,B]=v.useState(null);v.useEffect(()=>{Nn({url:"/api/app-resources/themes/default.json",setter:$}).catch(A=>{console.error("Failed to load Pankosmia theme:",A)})},[]),v.useEffect(()=>{let A={};document.fonts.ready.then(()=>{document.fonts.forEach(R=>{const D=R.family.replace(/['"]/g,"").trim().replace(/\s+/g," ");A[D.replaceAll(" ","")]=D}),_(A)})},[]),v.useEffect(()=>{if(P){let A=[],R={},D=a.typographyRef.current.font_set.split("Pankosmia");D.shift(),D=D.map(G=>"Pankosmia"+G),Object.entries(P).forEach(([G,J])=>{let oe=D.indexOf(G);oe>=0&&(R[oe]=J)});for(let G=0;G<Object.keys(D).length;G++)R[G]&&A.push(R[G]);T(A)}},[(S=a.typographyRef.current)==null?void 0:S.font_set,P]),v.useEffect(()=>{const A=R=>{const D=R.split("--");D.length===4&&E(`${D[2]} => ${D[3]}`,{variant:D[0],anchorOrigin:{vertical:"bottom",horizontal:"right"}})};x.length>0&&(x.forEach(R=>A(R)),h([]))},[x,E]),v.useEffect(()=>{var D;const A=((D=a==null?void 0:a.typography)==null?void 0:D.direction)==="rtl"?"rtl":"ltr",R=yr({direction:A,typography:{...O.typography||{},fontFamily:w.length?w.join(","):"inherit"},components:{MuiCssBaseline:{styleOverrides:{html:{fontFamily:w.length?w.join(","):void 0},body:{fontFamily:w.length?w.join(","):void 0},"#root":{fontFamily:w.length?w.join(","):void 0},"*, *::before, *::after":{fontFamily:"inherit"}}},MuiFab:{styleOverrides:{root:{textTransform:"none"}}},MuiButton:{styleOverrides:{root:{textTransform:"none"}}},MuiTab:{styleOverrides:{root:{textTransform:"none"}}},MuiToggleButton:{styleOverrides:{root:{textTransform:"none"}}}}},O);B(R)},[O,w,(d=a==null?void 0:a.typography)==null?void 0:d.direction]),console.log(j);const z=v.useMemo(()=>j?j.direction==="rtl"?ri({key:"muirtl",stylisPlugins:[Wa,Ya]}):ri({key:"mui",stylisPlugins:[Wa]}):null,[j]);return v.useEffect(()=>{j!=null&&j.direction&&(document.documentElement.dir=j.direction)},[j==null?void 0:j.direction]),!j||!z?i.jsx(Ha,{}):i.jsx(Ue.CacheProvider,{value:z,children:i.jsxs(Kf,{theme:j,children:[i.jsx(l.CssBaseline,{}),i.jsx(jr.Provider,{value:m,children:i.jsx(Tr.Provider,{value:u,children:i.jsx(Oa.Provider,{value:p,children:i.jsx(ve.Provider,{value:o,children:i.jsx(Ra.Provider,{value:f,children:i.jsx(Ma.Provider,{value:g,children:i.jsx(_a.Provider,{value:a,children:i.jsx(ja.Provider,{value:s,children:i.jsx($a.Provider,{value:c,children:i.jsx(Ia.Provider,{value:r,children:i.jsx(Pa.Provider,{value:C,children:i.jsx(xt.Provider,{value:n,children:i.jsx(Er.Provider,{value:b,children:i.jsx(ut.Provider,{value:t,children:i.jsx(l.Box,{sx:{height:"100vh",overflow:"hidden"},children:!o||!o.i18n||Object.keys(o.i18n).length===0?i.jsx(Ha,{}):e})})})})})})})})})})})})})})})]})})}var Mr={exports:{}},ch=Mr.exports,Ka;function lh(){return Ka||(Ka=1,(function(e,t){(function(n,r,o){e.exports=o()})("dcopy",ch,function(){return function(r){if(/number|string|boolean/.test(typeof r))return r;if(r instanceof Date)return new Date(r.getTime());var o=r instanceof Array?[]:{};return s(r,o),o;function s(a,c){for(var u in a){var p=a[u];if(p instanceof Date){var f=new Date(p.getTime());n(c,u,f)}else if(p instanceof Function){var f=p;n(c,u,f)}else if(p instanceof Array){var f=[],g=n(c,u,f);s(p,g)}else if(p instanceof Object){var f={},g=n(c,u,f);s(p,g)}else{var f=p;n(c,u,f)}}}};function n(r,o,s){if(r instanceof Array)return r.push(s),r[r.length-1];if(r instanceof Object)return r[o]=s,r[o]}})})(Mr)),Mr.exports}var uh=lh();const dh=zr(uh);function Xa({children:e}){const[t,n]=v.useState(!1),r=v.useRef(t),o=H=>{r.current=H,n(H)},[s,a]=v.useState(!1),c=v.useRef(s),u=H=>{c.current=H,a(H)},[p,f]=v.useState(!1),g=v.useRef(p),b=H=>{g.current=H,f(H)},[m,x]=v.useState({}),h=v.useRef(m),C=H=>{h.current=H,x(H)},[E,w]=v.useState({bookCode:"TIT",chapterNum:1,verseNum:1,endVerseNum:1}),T=v.useRef(E),P=H=>{T.current=H,w(H)},[_,O]=v.useState({}),$=v.useRef(_),j=H=>{$.current=H,O(H)},[B,z]=v.useState({font_set:"Pankosmia-CardoPankosmia-EzraSILPankosmia-PadaukPankosmia-AwamiNastaliqPankosmia-NotoNastaliqUrduPankosmia-GentiumPlus",size:"medium",direction:"ltr"}),S=v.useRef(B),d=H=>{S.current=H,z(H)},[A,R]=v.useState(null),D=v.useRef(A),G=H=>{D.current=H,R(H)},[J,oe]=v.useState({}),ie=v.useRef(J),V=H=>{ie.current=H,oe(H)},k=async()=>{await Ee("/api/client-config").then(H=>H.json).then(H=>V(H)).catch(H=>console.error("Error :",H))},[q,K]=v.useState({}),M=v.useRef(q),Q=H=>{M.current=H,K(H)},[N,I]=v.useState(null),U=v.useRef(N),X=H=>{U.current=H,I(H)},[ne,te]=v.useState(null),Y=v.useRef(ne),ke=H=>{Y.current=H,te(H)},[Re,ot]=v.useState(null),$t=v.useRef(Re),yt=H=>{$t.current=H,ot(H)},bt=async()=>{await Ee("/api/client-interfaces").then(H=>H.json).then(H=>Q(H)).catch(H=>console.error("Error :",H))},Me=async()=>{const H=await Ee("/api/i18n/flat",c.current);H.ok?j(H.json):qe.enqueueSnackbar(`Could not load i18n: ${H.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})},lt=async()=>{const H=await Ee("/api/settings/typography",c.current);H.ok?d(H.json):qe.enqueueSnackbar(`Could not load typography: ${H.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})},et=async()=>{const H=await Ee("/api/version",c.current);H.ok?yt(H.json):qe.enqueueSnackbar(`Could not load version for product: ${H.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})},tt=async()=>{const H=await Ee("/api/app-state/alignment",c.current);if(H.ok){const re=H.json.snippet,ee=H.json.word;re!==U.current&&X(re),JSON.stringify(ee)!==JSON.stringify(Y.current)&&ke(ee)}else qe.enqueueSnackbar(`Could not load alignment: ${H.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})};v.useEffect(()=>{Me().then(),tt().then(),lt().then(),k().then(),bt().then(),et().then()},[]),v.useEffect(()=>{(async()=>{const re=await Ee("/api/navigation/bcv",c.current);if(re.ok){const ee=re.json;P({bookCode:ee.book_code,chapterNum:ee.chapter,verseNum:ee.verse})}else qe.enqueueSnackbar(`Could not load bcv: ${re.error.reason}`,{variant:"error",anchorOrigin:{vertical:"bottom",horizontal:"left"},persist:!0})})().then()},[]);const Ut=H=>{const re=H.data.split("--");if(re.length===6){const ee=re[1]==="enabled";ee!==r.current&&o(ee);const Ne=re[3]==="enabled";Ne!==c.current&&u(Ne);const Bt=re[5]==="enabled";Bt!==g.current&&b(Bt)}},It=H=>{const re=H.data.split("--");if(re.length===4){const ee={bookCode:re[0],chapterNum:parseInt(re[1]),verseNum:parseInt(re[2]),endVerseNum:parseInt(re[3])};(ee.bookCode!==T.current.bookCode||ee.chapterNum!==T.current.chapterNum||ee.verseNum!==T.current.verseNum||ee.endVerseNum!==T.current.endVerseNum)&&P(ee)}},Pt=H=>{const re=H.data.split("--");if(re.length===3){const ee={font_set:re[0],size:re[1],direction:re[2]};(ee.font_set!==S.current.font_set||ee.size!==S.current.size||ee.direction!==S.current.direction)&&d(ee)}},Ot=()=>{Me().then()},Rt=H=>{try{const re=dh(h.current),[ee,Ne,Bt]=H.data.split("--");if(["true","false"].includes(Bt)){const Vr=Bt==="true";(!(ee in re)||!("isActive"in re[ee])||Vr!==re[ee].isActive)&&(re[ee]={endpoint:Ne,isActive:Vr},C(re))}}catch(re){console.log(`Auth Error: ${re}, data: ${H.data}`)}},Mt=H=>{if(H.data===null)D.current!==null&&G(null);else{const re=H.data.split("--");if(re.length===3){let ee={source:re[0],organization:re[1],project:re[2]};(!D.current||ee.source!==D.current.source||ee.organization!==D.current.organization||ee.project!==D.current.project)&&G(ee)}else G(null)}},At=()=>{tt().then()};v.useEffect(()=>{const H=new AbortController;return(async()=>{await Fp("/api/notifications",{method:"GET",headers:{Accept:"text/event-stream"},onopen(ee){ee.ok&&ee.status===200||ee.status>=400&&ee.status<500&&ee.status!==429&&console.log("Error from SSE",ee.status)},onmessage(ee){ee.event==="misc"?miscHandler(ee):ee.event==="status"?Ut(ee):ee.event==="bcv"?It(ee):ee.event==="auth"?Rt(ee):ee.event==="languages"?Ot():ee.event==="typography"?Pt(ee):ee.event==="current_project"?Mt(ee):ee.event==="alignment"&&At()},onclose(){console.log("SSE connection closed by the server")},onerror(ee){console.log("There was an error from the SSE server",ee)}})})(),()=>H.abort()},[]);const Se={enableNet:t,setEnableNet:o,enabledRef:r},be={debug:s,setDebug:u,debugRef:c},We={beta:p,setBeta:b,betaRef:g},Fe={systemBcv:E,setSystemBcv:P,bcvRef:T},ce={auth:m,setAuth:C,authRef:h},On={i18n:_,setI18n:j,i18nRef:$},Nr={typography:B,setTypography:d,typographyRef:S},Rn={currentProject:A,setCurrentProject:G,currentProjectRef:D},as={clientInterfaces:q,setClientInterfaces:Q,clientInterfacesRef:M},Mn={snippet:N,setSnippet:X,snippetRef:U},Dr={word:ne,setWord:ke,wordRef:Y},Lr={clientConfig:J,setClientConfig:V,clientConfigRef:ie},Fr={product:Re,setProduct:yt,productRef:$t},se=Ge(qe.MaterialDesignContent)(()=>({"&.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 i.jsx(qe.SnackbarProvider,{Components:{error:se,info:se,warning:se,success:se},maxSnack:6,children:i.jsx(Ga,{netValue:Se,debugValue:be,i18nValue:On,bcvValue:Fe,authValue:ce,typographyValue:Nr,currentProjectValue:Rn,clientConfigValue:Lr,clientInterfacesValue:as,snippetValue:Mn,wordValue:Dr,productValue:Fr,betaValue:We,children:e})})}function Qa({children:e}){return i.jsx(qe.SnackbarProvider,{maxSnack:3,children:i.jsx(Xa,{children:e})})}function Ja({titleKey:e,widget:t,margin:n=0,children:r,requireNet:o=!1,currentId:s}){const{enableNet:a}=v.useContext(ut),{i18nRef:c}=v.useContext(ve);return o&&!a?i.jsx(l.Box,{sx:{m:0,height:"100%",overflowX:"hidden",overflowY:"auto"},children:i.jsx(l.Grid,{container:!0,sx:{alignItems:"center",justifyContent:"center",minHeight:"100vh"},children:i.jsxs(l.Grid,{rowSpacing:.5,sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[i.jsx(Cp,{sx:{fontSize:80},color:"warning"}),i.jsx("p",{children:W("components:framework:no_entry_if_offline",c.current)})]})})}):i.jsxs(i.Fragment,{children:[i.jsx(l.Box,{children:i.jsx(Ta,{titleKey:e||null,widget:t||null,currentId:s})}),i.jsx(l.Box,{sx:{m:n,overflowX:"hidden",overflowY:"auto"},children:r})]})}function fh({children:e,titleKey:t,requireNet:n,currentId:r,widget:o,margin:s}){return i.jsx(Qa,{children:i.jsx(Ja,{titleKey:t,requireNet:n,currentId:r,widget:o||null,margin:s||0,children:e})})}const ph=v.createContext({languages:!1,setLanguages:()=>{}}),Ar={select:{background:"white"},inputLabel:{}};function es(e){const{listItem:t}=e,n={menuItem:{display:"flex",justifyContent:"space-between",color:"Black"}};return i.jsx("div",{style:n.menuItem,children:i.jsx("div",{style:n.menuItem,children:i.jsx(l.Typography,{style:{width:"100%"},noWrap:!0,variant:"body2",component:"div",children:t})})})}es.propTypes={listItem:Fn.PropTypes.shape({index:Fn.PropTypes.objectOf(Fn.PropTypes.string)})};function hh({isOpen:e,versification:t,setVersification:n}){const{i18nRef:r}=v.useContext(ve),[o,s]=v.useState([]),[a,c]=v.useState(!1),u=()=>c(p=>!p);return v.useEffect(()=>{e&&Nn({url:"/api/content-utils/versifications",setter:s}).then()},[e]),i.jsxs(l.Stack,{spacing:1,children:[i.jsxs(l.Typography,{variant:"body1",children:[" ",W("library:pankosmia-rcl:choose_versification",r.current)," "]}),i.jsxs(l.Stack,{spacing:0,children:[i.jsx(l.Typography,{variant:"body2",sx:{display:"-webkit-box",WebkitLineClamp:a?"unset":1,WebkitBoxOrient:"vertical",overflow:"hidden"},children:W("library:pankosmia-rcl:text_versification",r.current)}),i.jsx(l.Button,{onClick:u,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:W(a?"library:pankosmia-rcl:show_less":"library:pankosmia-rcl:show_more",r.current)})]}),i.jsxs(l.FormControl,{sx:{width:"100%"},children:[i.jsx(l.InputLabel,{id:"booksVersification-label",required:!0,htmlFor:"booksVersification",sx:Ar.inputLabel,children:W("library:pankosmia-rcl:versification_scheme",r.current)}),i.jsx(l.Select,{variant:"outlined",required:!0,labelId:"booksVersification-label",name:"booksVersification",inputProps:{id:"bookVersification"},value:t,label:W("library:pankosmia-rcl:versification_scheme",r.current),onChange:p=>{n(p.target.value)},sx:Ar.select,children:o.map((p,f)=>i.jsx(l.MenuItem,{value:p,dense:!0,children:i.jsx(es,{listItem:`${p.toUpperCase()} - ${W(`scripture:versifications:${p}`,r.current)}`})},f))}),i.jsxs(l.FormHelperText,{children:[" ",W("library:pankosmia-rcl:helper_versification",r.current)]})]})]})}function mh({bookCode:e,setBookCode:t,bookAbbr:n,setBookAbbr:r,bookTitle:o,setBookTitle:s,bookCodes:a,showVersification:c,setShowVersification:u,bookProject:p,addVerses:f=!0}){var w,T,P,_,O,$,j,B;const{i18nRef:g}=v.useContext(ve),[b,m]=v.useState(!0),[x,h]=v.useState({});v.useEffect(()=>{Ee("/api/client-config").then(z=>z.json).then(z=>h(z)).catch(z=>console.error("Error :",z))},[]);const C=((_=(P=(T=(w=x==null?void 0:x["core-contenthandler_text_translation"])==null?void 0:w.find(z=>z.id==="config"))==null?void 0:T.fields)==null?void 0:P.find(z=>z.id==="protestantBooksOnlyCheckbox"))==null?void 0:_.value)!==!1,E=((B=(j=($=(O=x==null?void 0:x["core-contenthandler_text_translation"])==null?void 0:O.find(z=>z.id==="config"))==null?void 0:$.fields)==null?void 0:j.find(z=>z.id==="protestantBooksOnlyDefaultChecked"))==null?void 0:B.value)!==!1;return v.useEffect(()=>{m(E)},[E]),i.jsx(i.Fragment,{children:i.jsxs(l.Grid,{container:!0,spacing:1,sx:{justifyItems:"flex-end",alignItems:"stretch"},children:[i.jsx(l.Grid,{size:4,children:i.jsxs(l.FormControl,{sx:{width:"100%"},children:[i.jsx(l.InputLabel,{id:"bookCode-label",required:!0,htmlFor:"bookCode",sx:Ar.inputLabel,children:W("library:pankosmia-rcl:book_code",g.current)}),i.jsx(l.Select,{variant:"outlined",labelId:"bookCode-label",name:"bookCode",inputProps:{id:"bookCode"},value:e,label:W("library:pankosmia-rcl:book_code",g.current),onChange:z=>{t(z.target.value),r(["1","2","3"].includes(z.target.value[0])?z.target.value.slice(0,2)+z.target.value[2].toLowerCase():z.target.value[0]+z.target.value.slice(1).toLowerCase()),s(W(`scripture:books:${z.target.value}`,g.current))},sx:Ar.select,children:(b?a.slice(0,66):a).map((z,S)=>i.jsx(l.MenuItem,{value:z,dense:!0,disabled:p?p.includes(z):!1,children:i.jsx(es,{listItem:`${z} - ${W(`scripture:books:${z}`,g.current)}`})},S))})]})}),i.jsx(l.Grid,{size:4,children:i.jsx(l.TextField,{id:"bookAbbr",required:!0,sx:{width:"100%"},label:W("library:pankosmia-rcl:book_abbr",g.current),value:n,onChange:z=>{r(z.target.value)}})}),i.jsx(l.Grid,{size:4,children:i.jsx(l.TextField,{id:"bookTitle",required:!0,sx:{width:"100%"},label:W("library:pankosmia-rcl:book_title",g.current),value:o,onChange:z=>{s(z.target.value)}})}),C&&i.jsx(l.FormGroup,{children:i.jsx(l.FormControlLabel,{control:i.jsx(l.Checkbox,{color:"secondary",checked:b,onChange:()=>m(!b)}),label:W("library:pankosmia-rcl:protestant_books_only",g.current)})}),f&&i.jsx(l.FormGroup,{children:i.jsx(l.FormControlLabel,{control:i.jsx(l.Checkbox,{color:"secondary",checked:!0,disabled:!0,onChange:()=>u(!c)}),label:W("library:pankosmia-rcl:add_versification_checkbox",g.current)})})]})})}function gh({steps:e,initialStep:t=0,renderStepContent:n,isStepValid:r,handleCreate:o,handleClose:s,requiredFieldsLabel:a,primaryButtonVariant:c,primaryActionKey:u,secondaryButtonVariant:p,secondaryActionKey:f,primaryAction:g,secondaryAction:b,isLeftStepperButtonDisabled:m,CustomHeader:x,isInDialogue:h=!1}){const C=Math.min(Math.max(t-1,0),e.length-1),[E,w]=v.useState(C),[T,P]=v.useState(new Set),{i18nRef:_}=v.useContext(ve),O=v.useRef(null),[$,j]=v.useState(0);v.useEffect(()=>{const d=O.current;if(!d)return;const A=()=>{j(d.getBoundingClientRect().height)};A();const R=new ResizeObserver(A);return R.observe(d),()=>R.disconnect()},[]);const B=d=>T.has(d),z=async()=>{let d=T;if(B(E)&&(d=new Set(d.values()),d.delete(E)),E===e.length-1){try{await o()}catch(A){console.error("Error create project",A)}return}w(A=>A+1),P(d)},S=()=>{w(d=>d-1)};return i.jsxs(i.Fragment,{children:[i.jsx(l.Stepper,{sx:{position:"sticky"},activeStep:E,children:e.map((d,A)=>{const R={},D={};return B(A)&&(R.completed=!1),i.jsx(l.Step,{...R,children:i.jsx(l.StepLabel,{...D,children:d})},d)})}),i.jsxs(l.Box,{ref:O,children:[x&&i.jsx(x,{}),a&&i.jsx(l.DialogContentText,{variant:"subtitle2",sx:{padding:"16px 0px"},children:W("library:pankosmia-rcl:required_field",_.current)})]}),i.jsx(l.Box,{sx:{maxHeight:h?`calc(100% - 64px - ${$}px)`:"100vh",overflowY:"auto",overflowX:"hidden"},children:E!==e.length&&i.jsx(i.Fragment,{children:n(E)})}),i.jsxs(l.DialogActions,{sx:{justifyContent:"space-between",padding:"16px 0px 0px"},children:[i.jsx(l.Button,{sx:{padding:0},color:p||"inherit",onClick:E===0?s:b||S,disabled:m&&E===0,children:E===0?`${W(`${f||"library:pankosmia-rcl:cancel"}`,_.current)}`:`${W("library:pankosmia-rcl:back_button",_.current)}`}),i.jsx(l.Button,{sx:{padding:0},color:c||"inherit",onClick:g||z,disabled:!r(E),children:E===e.length-1?`${W(`${u||"library:pankosmia-rcl:create"}`,_.current)}`:`${W("library:pankosmia-rcl:next_button",_.current)}`})]})]})}const yh={palette:{primary:{main:"#666"},secondary:{main:"#888"}}};function bh({isAndroid:e,children:t}){return i.jsx(l.Box,{sx:{mb:2,position:"fixed",top:e?"78px":"48px",left:e?"30px":0,bottom:e?"30px":0,right:e?"30px":0,overflow:"auto",width:e?"calc(100% - 60px)":"100%"},children:t})}const xh=v.forwardRef(function({href:t,netEnabled:n,children:r,...o},s){return i.jsx("a",{ref:s,href:n?t:void 0,target:n?"_blank":void 0,rel:"noopener noreferrer",style:n?void 0:{color:"inherit",textDecoration:"none",cursor:"default"},...o,children:r})});function Za({titleSection:e,children:t}){return i.jsxs(l.Stack,{spacing:1,children:[i.jsx(l.Typography,{variant:"body1",sx:{fontWeight:"bold"},children:e}),i.jsx(l.Stack,{spacing:1,children:t})]})}const vh={unavailable:"download_unavailable",checking:"download_checking",idle:"download",downloading:"download_downloading",complete:"download_installed",error:"download_retry"},Ch={ffmpeg:{check:"checkFfmpegInstalled",onProgress:"onFfmpegDownloadProgress",onComplete:"onFfmpegDownloadComplete",download:"downloadFfmpeg"},firefox:{check:"checkFirefoxInstalled",onProgress:"onDownloadProgress",onComplete:"onDownloadComplete",download:"downloadFirefox"}};function ec({asset:e,actionButtonPlugin:t}){const{i18nRef:n}=v.useContext(ve),{enabledRef:r}=v.useContext(ut),[o,s]=v.useState("checking"),[a,c]=v.useState(null),[u,p]=v.useState(null),f=!!window.electronAPI,g=Ch[e];v.useEffect(()=>{if(!f||!g)return;let x=!1;return window.electronAPI[g.check]().then(h=>{x||s(h?"complete":"idle")}),()=>{x=!0}},[e]),v.useEffect(()=>{if(!f||!g)return;const x=window.electronAPI[g.onProgress](C=>{typeof C=="number"&&!Number.isNaN(C)&&c(Math.max(0,Math.min(100,C)))}),h=window.electronAPI[g.onComplete]((C,E)=>{s(C?"complete":"error"),p(C?null:E||null),C&&(c(100),t&&setTimeout(()=>{t==null||t()},1e3))});return()=>{x(),h()}},[e]);const b=()=>{!f||!g||(s("downloading"),c(null),p(null),window.electronAPI[g.download]())},m=typeof a=="number";return i.jsxs(i.Fragment,{children:[i.jsx(l.Tooltip,{title:!f||!r.current&&W("library:pankosmia-rcl:tooltip_offline_mode",n.current),children:i.jsx("span",{style:{alignSelf:"center"},children:i.jsx(l.Button,{size:"medium",variant:"contained",startIcon:o==="complete"?i.jsx(Sp,{}):o==="error"?i.jsx(Tp,{}):i.jsx(Ip,{}),onClick:b,disabled:o==="checking"||o==="downloading"||o==="complete"||!f||!r.current,title:W(f?"library:pankosmia-rcl:download":"library:pankosmia-rcl:download_unavailable_tip",n.current),children:W(`library:pankosmia-rcl:${vh[o==="checking"&&!f?"unavailable":o]}`,n.current)})})}),o==="downloading"&&i.jsxs(i.Fragment,{children:[i.jsx(l.LinearProgress,{variant:m?"determinate":"indeterminate",value:m?a:void 0}),i.jsx(l.Typography,{variant:"body2",children:m?`${Math.round(a)}% ${W("library:pankosmia-rcl:download_percent_complete",n.current)}`:W("library:pankosmia-rcl:download_downloading",n.current)})]}),o==="error"&&i.jsxs(l.Typography,{variant:"body2",color:"error",children:[W("library:pankosmia-rcl:download_failed",n.current),u?`: ${u}`:"","."]})]})}function tc({titleLabel:e,isOpen:t,closeFn:n,children:r,actionsButtonArray:o,requiredFieldsLabel:s=!1,dividers:a=!1}){const c=l.useTheme(),{i18nRef:u}=v.useContext(ve);return i.jsxs(l.Dialog,{onClose:()=>n(),open:t,sx:{overflow:"hidden"},slotProps:{sx:{overflow:"hidden !important",display:"flex",flexDirection:"column"},paper:{component:"form",sx:{width:"auto",minWidth:"280px"}}},onKeyDown:p=>{var g,b;if(p.key!=="Enter")return;const f=o==null?void 0:o[1];(g=f==null?void 0:f.props)!=null&&g.actionFn&&!((b=f.props)!=null&&b.isDisabled)&&(p.preventDefault(),f.props.actionFn())},maxWidth:"sm",fullWidth:!1,children:[i.jsx(l.DialogTitle,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:i.jsx(l.Typography,{variant:"h6",sx:{color:c.palette.primary},component:"div",children:e})}),a&&i.jsx(l.Divider,{}),s&&i.jsx(l.Box,{sx:{paddingTop:a?"16px":"0px",paddingBottom:"16px",px:3},children:i.jsx(l.Typography,{variant:"subtitle2",children:W("library:pankosmia-rcl:required_field",u.current)})}),i.jsx(l.DialogContent,{sx:{paddingTop:s?"0px":"16px",paddingBottom:2},children:r}),a&&i.jsx(l.Divider,{}),i.jsx(l.DialogActions,{children:o&&o.map(p=>p)})]})}function Br({actionFn:e,actionLabel:t,closeFn:n,closeLabel:r,isDisabled:o,closeOnAction:s=!0,onlyCloseButton:a=!1,actionVariant:c,closeVariant:u,isLoading:p,loadingLabel:f}){return[i.jsx(kr,{actionFn:n,isDisabled:!1,label:r,variant:u,isLoading:p,loadingLabel:f}),a?null:i.jsx(kr,{actionFn:()=>{e(),s&&n()},isDisabled:o,label:t,variant:c})]}function Sh({isOpen:e,closeFn:t,asset:n,actionButtonPlugin:r}){const{i18nRef:o}=v.useContext(ve);return i.jsx(tc,{titleLabel:W("library:pankosmia-rcl:Firefox_not_installed",o.current),isOpen:e,closeFn:()=>t(),actionsButtonArray:Br({closeFn:()=>t(),closeLabel:W("library:pankosmia-rcl:cancel",o.current),onlyCloseButton:!0}),children:i.jsxs(l.Stack,{spacing:2,justifyContent:"center",alignItems:"center",sx:{width:"100%"},children:[n==="firefox"&&i.jsx(l.Typography,{variant:"body1",children:W("library:pankosmia-rcl:need_pdf_engine",o.current)}),n==="ffmpeg"&&i.jsx(l.Typography,{variant:"body1",children:W("library:pankosmia-rcl:need_ffmpeg",o.current)}),i.jsx(ec,{asset:n,actionButtonPlugin:r})]})})}function ts({titleLabel:e,isOpen:t,closeFn:n,children:r,actionsButtonArray:o,requiredFieldsLabel:s=!1,header:a=null,fullHeight:c=!1}){const u=l.useTheme(),p=l.useMediaQuery(u.breakpoints.down("sm")),{i18nRef:f}=v.useContext(ve);return i.jsxs(l.Dialog,{fullScreen:p,open:t,sx:{overflow:"hidden"},onKeyDown:g=>{var m,x;if(g.key!=="Enter")return;const b=o==null?void 0:o[1];(m=b==null?void 0:b.props)!=null&&m.actionFn&&!((x=b.props)!=null&&x.isDisabled)&&(g.preventDefault(),b.props.actionFn())},slotProps:{paper:{component:"form",sx:{display:"flex",flexDirection:"column",overflow:"hidden",...c&&!p&&{height:"calc(100% - 64px)"}}}},maxWidth:"sm",fullWidth:!0,children:[i.jsxs(l.DialogTitle,{sx:{backgroundColor:u.palette.primary.main,display:"flex",flexDirection:"row",alignItems:"center"},children:[p&&i.jsx(l.IconButton,{sx:{color:u.palette.primary.contrastText},onClick:()=>{n()},children:i.jsx(ba,{})}),i.jsx(l.Typography,{variant:"h6",sx:{color:u.palette.primary.contrastText},component:"div",children:e}),o&&p&&o[1]&&v.cloneElement(o[1],{sx:{...o[1].props.sx,marginInlineStart:"auto",color:`${u.palette.primary.contrastText} !important`}})]}),(a||s)&&i.jsxs(l.Box,{sx:{py:2,px:3,flexShrink:0,display:"flex",flexDirection:"column",gap:2},children:[s&&i.jsx(l.Typography,{variant:"subtitle2",children:W("library:pankosmia-rcl:required_field",f.current)}),a]}),i.jsx(l.DialogContent,{sx:{pb:"16px !important",pt:a||s?"0px":"16px !important",flex:1,minHeight:0},children:r}),!p&&i.jsx(l.Divider,{}),!p&&i.jsx(l.DialogActions,{children:o&&o.map(g=>g)})]})}function wh({isOpen:e,setIsOpen:t,theme:n,children:r}){return i.jsx(l.SwipeableDrawer,{anchor:"bottom",open:e,onOpen:()=>{},onClose:()=>t(!1),swipeAreaWidth:40,PaperProps:{sx:{width:"100%",boxSizing:"border-box",overflow:"hidden"}},children:i.jsxs(l.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[i.jsx(l.Box,{sx:{width:"100%",paddingY:"22px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:i.jsx(l.Box,{sx:{width:32,height:4,borderRadius:2,backgroundColor:n.palette.action.active}})}),i.jsx(l.Box,{sx:{display:"flex",flexDirection:"column",overflow:"auto"},children:i.jsx(l.MenuList,{sx:{marginX:"16px",marginBottom:2},children:r})})]})})}function Th({isOpen:e,setIsOpen:t,children:n,anchorEl:r}){return i.jsx(l.Menu,{onClose:()=>t(!1),anchorEl:r,open:e,children:n})}function ns({isOpen:e,setIsOpen:t,anchorEl:n,children:r}){const o=l.useTheme();return l.useMediaQuery(o.breakpoints.down("sm"))?i.jsx(wh,{theme:o,isOpen:e,setIsOpen:t,children:r}):i.jsx(Th,{anchorEl:n,isOpen:e,setIsOpen:t,children:r})}function kh(e){return wt("MuiIconButton",e)}const nc=Tt("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge","loading","loadingIndicator","loadingWrapper"]),Eh=e=>{const{classes:t,disabled:n,color:r,edge:o,size:s,loading:a}=e,c={root:["root",a&&"loading",n&&"disabled",r!=="default"&&`color${De(r)}`,o&&`edge${De(o)}`,`size${De(s)}`],loadingIndicator:["loadingIndicator"],loadingWrapper:["loadingWrapper"]};return qt(c,kh,t)},jh=Ge(Oo,{name:"MuiIconButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.loading&&t.loading,n.color!=="default"&&t[`color${De(n.color)}`],n.edge&&t[`edge${De(n.edge)}`],t[`size${De(n.size)}`]]}})(Et(({theme:e})=>({textAlign:"center",flex:"0 0 auto",fontSize:e.typography.pxToRem(24),padding:8,borderRadius:"50%",color:(e.vars||e).palette.action.active,...Cr(e,"background-color",{duration:e.transitions.duration.shortest}),variants:[{props:t=>!t.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:"var(--IconButton-hoverBg)","@media (hover: none)":{backgroundColor:"transparent"}}}},{props:{edge:"start"},style:{marginLeft:-12}},{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:{edge:"end"},style:{marginRight:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}}]})),Et(({theme:e})=>({variants:[{props:{color:"inherit"},style:{color:"inherit"}},...Object.entries(e.palette).filter(Ro()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main,"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:"small"},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:"large"},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${nc.disabled}`]:{backgroundColor:"transparent",color:(e.vars||e).palette.action.disabled},[`&.${nc.loading}`]:{color:"transparent"}}))),_h=Ge("span",{name:"MuiIconButton",slot:"LoadingIndicator"})(({theme:e})=>({display:"none",position:"absolute",visibility:"visible",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:"flex"}}]})),rc=F.forwardRef(function(t,n){const r=Vt({props:t,name:"MuiIconButton"}),{edge:o=!1,children:s,className:a,color:c="default",disabled:u=!1,disableFocusRipple:p=!1,size:f="medium",id:g,loading:b=null,loadingIndicator:m,...x}=r,h=Ti(g),C=m??i.jsx(qo,{"aria-labelledby":h,color:"inherit",size:16}),E={...r,edge:o,color:c,disabled:u,disableFocusRipple:p,loading:b,loadingIndicator:C,size:f},w=Eh(E);return i.jsxs(jh,{id:b?h:g,className:Ae(w.root,a),centerRipple:!0,internalNativeButton:!0,focusRipple:!p,disabled:u||b,ref:n,...x,ownerState:E,children:[typeof b=="boolean"&&i.jsx("span",{className:w.loadingWrapper,style:{display:"contents"},children:i.jsx(_h,{className:w.loadingIndicator,ownerState:E,children:b&&C})}),s]})});process.env.NODE_ENV!=="production"&&(rc.propTypes={children:Qr(y.node,e=>F.Children.toArray(e.children).some(n=>F.isValidElement(n)&&n.props.onClick)?new Error(["MUI: You are providing an onClick event listener to a child of a button element.","Prefer applying it to the IconButton directly.","This guarantees that the whole <button> will be responsive to click events."].join(`
273
273
  `)):null),classes:y.object,className:y.string,color:y.oneOfType([y.oneOf(["inherit","default","primary","secondary","error","info","success","warning"]),y.string]),disabled:y.bool,disableFocusRipple:y.bool,disableRipple:y.bool,edge:y.oneOf(["end","start",!1]),id:y.string,loading:y.bool,loadingIndicator:y.node,size:y.oneOfType([y.oneOf(["small","medium","large"]),y.string]),sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object])});function rs({children:e}){const t=l.useTheme(),n=l.useMediaQuery(t.breakpoints.down("lg")),r=l.useMediaQuery(t.breakpoints.down("sm"));return i.jsx(l.AppBar,{position:"static",children:i.jsx(l.Toolbar,{sx:{px:r?2:3},variant:n?"dense":"regular",children:i.jsx(l.Box,{sx:{display:"flex",gap:"4px",alignItems:"center",width:"100%"},children:e})})})}function $h({titleKey:e}){return i.jsxs(rs,{children:[i.jsx(rc,{size:"medium",edge:"start",color:"inherit",onClick:()=>window.history.back(),children:i.jsx(vp,{sx:{transform:t=>t.direction==="rtl"?"scaleX(-1)":"none"}})}),i.jsx(l.Typography,{variant:"h6",children:e})]})}function Ih(){return i.jsx(l.SvgIcon,{children:i.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",stroke:"none",children:[i.jsx("path",{d:"M13.9392 4H4C2.892 4 2 4.892 2 6V18C2 19.108 2.892 20 4 20H20C21.108 20 22 19.108 22 18V6L20 8V18H4V6H11.9392",fill:"currentColor",stroke:"none"}),i.jsx("path",{d:"M20 12H4V14H20V12Z",fill:"currentColor",stroke:"none"}),i.jsx("path",{d:"M10 14H8V18H10V14Z",fill:"currentColor",stroke:"none"}),i.jsx("path",{d:"M16 14H14V18H16V14Z",fill:"currentColor",stroke:"none"}),i.jsx("path",{d:"M13 10V6.925L18.525 1.425C18.675 1.275 18.8417 1.16667 19.025 1.1C19.2083 1.03333 19.3917 1 19.575 1C19.775 1 19.9667 1.0375 20.15 1.1125C20.3333 1.1875 20.5 1.3 20.65 1.45L21.575 2.375C21.7083 2.525 21.8125 2.69167 21.8875 2.875C21.9625 3.05833 22 3.24167 22 3.425C22 3.60833 21.9667 3.79583 21.9 3.9875C21.8333 4.17917 21.725 4.35 21.575 4.5L16.075 10H13ZM14.5 8.5H15.45L18.475 5.45L18.025 4.975L17.55 4.525L14.5 7.55V8.5ZM18.025 4.975L17.55 4.525L18.475 5.45L18.025 4.975Z",fill:"currentColor",stroke:"none"})]})})}function oc(){return i.jsx(l.SvgIcon,{children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",height:"24px",width:"24px",fill:"currentColor",children:i.jsx("path",{d:"M9.25,22l-0.4-3.2q-0.32-0.13-0.61-0.3T7.68,18.13L4.7,19.38L1.95,14.63l2.58-1.95Q4.5,12.5 4.5,12.34q0-0.16 0-0.34t0-0.34t0.03-0.34L1.95,9.38L4.7,4.63L7.68,5.88Q7.95,5.68 8.25,5.5t0.6-0.3L9.25,2h5.5l0.4,3.2q0.33,0.13 0.61,0.3t0.56,0.38L19.3,4.63l2.75,4.75l-2.57,1.95q0.02,0.18 0.02,0.34t0,0.34t0,0.34t-0.05,0.34l2.57,1.95l-2.75,4.75l-2.95-1.25q-0.27,0.2-0.57,0.38t-0.6,0.3L14.75,22H9.25ZM11,20h1.98l0.35-2.65q0.78-0.2 1.44-0.59t1.21-0.94l2.47,1.03l0.98-1.7l-2.15-1.63q0.13-0.35 0.17-0.74T17.5,12t-0.05-0.79q-0.05-0.39-0.17-0.74l2.15-1.63l-0.98-1.7L15.98,8.2q-0.55-0.57-1.21-0.96T13.33,6.65L13,4H11.03L10.68,6.65Q9.9,6.85 9.24,7.24T8.03,8.17L5.55,7.15L4.58,8.85l2.15,1.6Q6.6,10.83 6.55,11.2T6.5,12q0,0.4 0.05,0.77t0.17,0.75L4.58,15.15l0.98,1.7L8.03,15.8q0.55,0.58 1.21,0.96t1.44,0.59L11,20Zm1.05-4.5q1.45,0 2.47-1.03T15.55,12T14.53,9.52T12.05,8.5q-1.47,0-2.49,1.02T8.55,12t1.01,2.47t2.49,1.03ZM12,12Z"})})})}function sc({listClients:e,debugRef:t,i18nRef:n}){const[r,o]=v.useState([]);return v.useEffect(()=>{t.current?o(e.filter(s=>!s.exclude_from_menu&&s.requires.debug)):o([])},[t.current]),i.jsxs(i.Fragment,{children:[r.length>0&&i.jsx(l.ListSubheader,{children:W("components:header:debug_mode",n.current)}),r.map((s,a)=>i.jsxs(l.MenuItem,{inset:!0,disabled:s.requires.net&&!netEnabled.current,onClick:()=>{window.location.href=s.url},children:[i.jsx(l.ListItemIcon,{}),i.jsx(l.ListItemText,{primary:W(`pages:${s.id}:title`,n.current)})]}))]})}const Ph=Tt("MuiBox",["root"]),Oh=yr(),os=bu({themeId:ht,defaultTheme:Oh,defaultClassName:Ph.root,generateClassName:li.generate});process.env.NODE_ENV!=="production"&&(os.propTypes={children:y.node,component:y.elementType,sx:y.oneOfType([y.arrayOf(y.oneOfType([y.func,y.object,y.bool])),y.func,y.object])});function ic({i18nRef:e,betaRef:t,debugRef:n}){const[r,o]=v.useState([]);v.useEffect(()=>{(async()=>{const c=await Ee("/api/list-clients",n.current);c.ok&&o(c.json.filter(u=>!u.exclude_from_menu&&u.requires.beta))})().then()},[t.current,n.current]);const s=a=>{dn(`/api/beta/${t.current?"disable":"enable"}`).then(()=>{a.stopPropagation(),a.preventDefault()})};return i.jsxs(i.Fragment,{children:[r.length>0&&i.jsxs(l.MenuItem,{onClick:s,children:[i.jsx(l.ListItemIcon,{children:" "}),i.jsx(l.ListItemText,{primary:W("components:header:beta_mode",e.current)}),i.jsx(l.Switch,{edge:"end",onChange:s,checked:t.current})]}),t.current&&r.length>0&&r.map((a,c)=>i.jsxs(l.MenuItem,{disablePadding:!0,onClick:()=>{window.location.href=a.url},children:[i.jsx(l.ListItemIcon,{}),i.jsx(l.ListItemText,{primary:i.jsxs(os,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"1em"},children:[i.jsx(l.Typography,{children:W(`pages:${a.id}:title`,e.current)}),i.jsx(os,{component:"span",sx:{fontSize:"1em",opacity:.7},children:"β"})]})})]},c))]})}function Rh({navigation:e}){const t=l.useTheme(),[n,r]=v.useState(null),[o,s]=v.useState(null),[a,c]=v.useState(!1),[u,p]=v.useState(!1),[f,g]=v.useState(""),[b,m]=v.useState([]),{enabledRef:x}=v.useContext(ut),{debugRef:h}=v.useContext(xt),{i18nRef:C}=v.useContext(ve),{betaRef:E}=v.useContext(jr),[w,T]=v.useState(!1),P=l.useMediaQuery(t.breakpoints.down("sm")),_=B=>{p(!0),s(B.currentTarget)},O=B=>{c(!0),r(B.currentTarget)},$=()=>{p(!1),x.current?dn("/api/net/disable",h.current):T(!0)};v.useEffect(()=>{Ee("/api/version").then(B=>B.json).then(B=>g(B.product_name)).catch(B=>console.error("Error :",B))},[]),v.useEffect(()=>{Ee("/api/list-clients").then(B=>B.json).then(B=>m(B)).catch(B=>console.error("Error :",B))},[]);const j=B=>{const z=b.find(S=>S.id===B);z&&(p(!1),window.location.href=z.url)};return i.jsxs(rs,{children:[e,i.jsxs(l.Box,{sx:{display:"flex",gap:1,alignItems:"center",marginInlineStart:"auto"},children:[i.jsx(l.IconButton,{color:"inherit",onClick:O,sx:{backgroundColor:t.palette.secondary.main,"&:hover":{backgroundColor:t.palette.secondary.main}},children:i.jsx(Ih,{})}),i.jsx(ns,{anchorEl:n,setIsOpen:c,isOpen:a,children:b.some(B=>B.id==="core-local-workspace")&&i.jsxs(l.MenuItem,{onClick:()=>j("core-local-workspace"),children:[i.jsx(l.ListItemIcon,{children:i.jsx(xp,{})}),i.jsx(l.ListItemText,{children:W("library:pankosmia-rcl:add_workspace",C.current)})]})}),!P&&i.jsx(l.IconButton,{onClick:()=>j("core-settings"),color:"inherit",children:i.jsx(oc,{})}),i.jsx(l.IconButton,{color:"inherit",onClick:_,children:i.jsx(jp,{})}),i.jsxs(ns,{anchorEl:o,setIsOpen:p,isOpen:u,children:[P&&i.jsxs(l.MenuItem,{onClick:()=>j("core-settings"),children:[i.jsx(l.ListItemIcon,{children:i.jsx(oc,{})}),i.jsx(l.ListItemText,{children:W("library:pankosmia-rcl:setting",C.current)})]}),i.jsxs(l.MenuItem,{onClick:$,selected:x.current,children:[i.jsx(l.ListItemIcon,{children:x.current?i.jsx(wa,{fontSize:"small"}):null}),i.jsx(l.ListItemText,{children:W("library:pankosmia-rcl:online_mode",C.current)}),i.jsx(l.ListItemIcon,{children:i.jsx(Vo,{color:"primary",title:W("components:header:tooltip_offline_mode",C.current).replace("{1}",f)})})]}),i.jsx(l.Divider,{}),b.some(B=>B.id==="core-dashboard")&&i.jsxs(l.MenuItem,{onClick:()=>j("core-dashboard"),children:[i.jsx(l.ListItemIcon,{children:i.jsx(wp,{})}),i.jsx(l.ListItemText,{children:W("library:pankosmia-rcl:my_project",C.current)})]}),b.some(B=>B.id==="core-client_pdf_publisher")&&i.jsxs(l.MenuItem,{onClick:()=>j("core-client_pdf_publisher"),children:[i.jsx(l.ListItemIcon,{children:i.jsx(_p,{})}),i.jsx(l.ListItemText,{children:W("library:pankosmia-rcl:pdf_publisher",C.current)})]}),b.some(B=>B.id==="content")&&i.jsxs(l.MenuItem,{onClick:()=>j("content"),children:[i.jsx(l.ListItemIcon,{children:i.jsx(Ep,{})}),i.jsx(l.ListItemText,{children:W("library:pankosmia-rcl:content_manager",C.current)})]}),i.jsx(ic,{i18nRef:C,betaRef:E,debugRef:h}),i.jsx(sc,{listClients:b,debugRef:h,i18nRef:C})]}),i.jsx(Wr,{internetDialogOpen:w,setInternetDialogOpen:T})]})]})}function In({text:e,icon:t=null,truncate:n=!1}){return i.jsxs(l.Typography,{variant:"caption",sx:{px:1,borderRadius:"4px",bgcolor:"grey.300",color:"text.primary",display:"flex",alignItems:"center",gap:"4px",minWidth:0,flexShrink:n?1:0,overflow:n?"hidden":"visible","& svg":{width:"20px",height:"20px",color:"action.active",flexShrink:0}},children:[t,i.jsx("span",{style:{minWidth:0,overflow:n?"hidden":"visible",textOverflow:n?"ellipsis":"clip",whiteSpace:"nowrap",flexShrink:n?1:0},children:e})]})}function Mh(){const e=l.useTheme(),t=l.useMediaQuery(e.breakpoints.down("sm"));return{panMarginHorizontal:t?"16px":"24px",panMarginVertical:t?"16px":"24px",panGapHorizontal:t?"16px":"24px",panGapContentSmall:t?"4px":"8px",panGapContentMedium:t?"4px":"8px"}}const ss=[{value:"CC BY",versioned:!0},{value:"CC BY-SA",versioned:!0},{value:"CC BY-NC",versioned:!0},{value:"CC BY-NC-SA",versioned:!0},{value:"CC BY-ND",versioned:!0},{value:"CC BY-NC-ND",versioned:!0},{value:"all_rights_reserved",versioned:!1,i18n:!0}],Ah=["4.0","3.0","2.5","2.0","1.0"],Bh={free_text:"",author_name:"",year:"",license:"",version:"4.0",order:"holder_first"},ac=/^\d{4}(-\d{4})?$/,Nh={unspecified:"Unspecified",public_domain:"Public Domain",all_rights_reserved:"All Rights Reserved"},is=(e,t)=>t?t(e):Nh[e];function Pn(e,t,n){var r;switch(e){case"unspecified":return is("unspecified",n);case"public-domain":return is("public_domain",n);case"free":{const o=(r=t==null?void 0:t.free_text)==null?void 0:r.trim();return o?`© ${o}`:""}case"builder":{const o=t.author_name.trim(),s=t.year.trim();if(!o||!ac.test(s))return"";const a=ss.find(p=>p.value===t.license);if(a!=null&&a.versioned&&!t.version)return"";a!=null&&a.i18nKey?n(a.value):a==null||a.value;const c=a?a.i18n?is(a.value,n):a.versioned?`${a.value} ${t.version}`:a.value:"";return`© ${t.order==="year_first"?`${s} ${o}`:`${o} ${s}`}${c?`, ${c}`:""}`}default:return""}}const Dh=(e,t)=>Pn(e,t)!=="";function Lh(e){const t=(e??"").trim(),n={...Bh};if(!t||t==="?"||/^unspecified$/i.test(t)||/^%%.*%%$/.test(t))return{optionCopyright:"unspecified",copyright:n};if(/public domain|cc0/i.test(t))return{optionCopyright:"public-domain",copyright:n};const r=t.replace(/^(copyright\s*)?©\s*/i,"").trim();return r?{optionCopyright:"free",copyright:{...n,free_text:r}}:{optionCopyright:"unspecified",copyright:n}}const Fh=!0;function cc({repoSummary:e,readOnly:t=!1,defaultEditMode:n=!1,onSaved:r,renderActions:o}){const{i18nRef:s}=v.useContext(ve),{debugRef:a}=v.useContext(xt),c=te=>W(te,s.current),[u,p]=v.useState(e),f=(u==null?void 0:u.local_path)??(u==null?void 0:u.path),[g,b]=v.useState("details"),[m,x]=v.useState(n),[h,C]=v.useState(!1),E=!t&&m,w=!E,[T,P]=v.useState({abbreviation:"",name:"",description:""}),[_,O]=v.useState({language_code:"",language_name:"",script_direction:""}),[$,j]=v.useState(!1),[B,z]=v.useState(),[S,d]=v.useState(),A=te=>te.trim()===""?"library:pankosmia-rcl:required_field":null,R=te=>te.trim()===""?"library:pankosmia-rcl:required_field":null,D=A(T.abbreviation),G=R(T.name),J=!D&&!G,oe=S!=="free"||((B==null?void 0:B.free_text)??"").trim()!=="",ie={details:J,language:$,copyright:oe},V=Object.values(ie).every(Boolean),k=E&&V&&!h,q=[{label:"library:pankosmia-rcl:abbreviation",value:T.abbreviation},{label:"library:pankosmia-rcl:repo_name",value:T.name},{label:"library:pankosmia-rcl:description",value:T.description}],K=v.useMemo(()=>{var te;return u?{...u,nBooks:((te=u.book_codes)==null?void 0:te.length)??0}:null},[u]),M=te=>{if(P({abbreviation:te.abbreviation??"",name:te.name??"",description:te.description??""}),O({language_code:te.language_code??"",language_name:te.language_name??"",script_direction:te.script_direction??""}),te.copyright!==void 0){const Y=Lh(te.copyright);z(Y.copyright),d(Y.optionCopyright)}};v.useEffect(()=>{p(e)},[e]),v.useEffect(()=>{u&&M(u)},[u]),v.useEffect(()=>{b("details"),x(n)},[f]);const Q=(te,Y)=>{E&&!ie[g]||b(Y)},N=()=>{M(u),x(!1)},I=()=>{E?N():x(!0)},U=()=>({abbreviation:T.abbreviation.trim(),name:T.name.trim(),description:T.description,language_code:_.language_code,language_name:_.language_name,script_direction:_.script_direction,copyright:B?Pn(S,B)??"":""}),X=async()=>{if(k){C(!0);try{const te=U(),Y=await xc(`/api/burrito/metadata/edit/${f}`,JSON.stringify(te),a.current);if(Y.ok){const ke={...u,...te};p(ke),x(!1),r==null||r(ke)}else console.error(c("library:pankosmia-rcl:error_data"),Y)}catch(te){console.error(te)}finally{C(!1)}}};if(!K)return i.jsx(l.CircularProgress,{});const ne=o?o({isEditMode:E,canSave:k,isSaving:h,save:X,cancel:N}):E?i.jsx(l.Box,{sx:{display:"flex",justifyContent:"flex-end",mt:2},children:i.jsx(l.Button,{variant:"contained",disabled:!k,onClick:X,children:c("library:pankosmia-rcl:edit")})}):null;return i.jsxs(l.Box,{children:[i.jsxs(l.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2,borderBottom:1,borderColor:"divider"},children:[i.jsxs(l.Tabs,{value:g,onChange:Q,children:[i.jsx(l.Tab,{value:"details",label:c("library:pankosmia-rcl:details")}),i.jsx(l.Tab,{value:"language",label:c("library:pankosmia-rcl:language")}),i.jsx(l.Tab,{value:"copyright",label:c("library:pankosmia-rcl:copyright")})]}),!t&&i.jsx(l.Button,{size:"small",variant:E?"contained":"outlined",onClick:I,children:c("library:pankosmia-rcl:edit_mode")})]}),g==="details"&&i.jsxs(l.Stack,{spacing:2,children:[i.jsxs(l.Stack,{direction:"row",spacing:1,children:[K.flavor&&i.jsx(In,{text:c(`flavors:names:${K.flavor_type}/${K.flavor}`)}),K.generated_date&&i.jsx(In,{text:`${c("library:pankosmia-rcl:dateUdapted")} ${K.generated_date}`})]}),w?i.jsx(l.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:q.map(({label:te,value:Y})=>i.jsxs(l.Box,{children:[i.jsx(l.Typography,{variant:"caption",sx:{display:"block",color:"text.secondary"},children:c(te)}),i.jsx(l.Typography,{variant:"body1",sx:{whiteSpace:"pre-wrap"},children:Y})]},te))}):i.jsxs(i.Fragment,{children:[i.jsx(l.TextField,{fullWidth:!0,required:!0,error:!!D,helperText:D?c(D):" ",label:c("library:pankosmia-rcl:abbreviation"),value:T.abbreviation,onChange:te=>P(Y=>({...Y,abbreviation:te.target.value}))}),i.jsx(l.TextField,{fullWidth:!0,required:!0,error:!!G,helperText:G?c(G):" ",label:c("library:pankosmia-rcl:repo_name"),value:T.name,onChange:te=>P(Y=>({...Y,name:te.target.value}))}),i.jsx(l.TextField,{fullWidth:!0,label:c("library:pankosmia-rcl:description"),value:T.description,onChange:te=>P(Y=>({...Y,description:te.target.value}))})]})]}),g==="language"&&i.jsx(pc,{currentLanguage:_,setCurrentLanguage:O,setIsValid:j,readOnly:w}),g==="copyright"&&i.jsx(dc,{optionCopyright:S,setOptionCopyright:d,copyright:B,setCopyright:z,readOnly:w,editMode:Fh}),ne]})}const Vh={onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onMouseUp:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onTouchEnd:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onKeyUp:e=>e.stopPropagation(),onFocus:e=>e.stopPropagation(),onBlur:e=>e.stopPropagation()};function zh({list:e,IconButtonSecondary:t=null,onItemClick:n,infoReadOnly:r=!0,onInfoSaved:o}){const{i18nRef:s}=v.useContext(ve),{panGapContentMedium:a,panGapContentSmall:c}=Mh(),u=l.useTheme(),p=l.useMediaQuery(u.breakpoints.down("sm")),[f,g]=v.useState(null),b=u.direction==="rtl",m=!!n,x=h=>W(h,s.current);return e?i.jsxs(i.Fragment,{children:[i.jsx(l.List,{sx:{width:"100%",minWidth:0},children:e.map(h=>{const C=h.abbreviation??"",E=h.language_code??"",w=m?l.ListItemButton:l.Box,T=m?{component:"div",onClick:()=>n(h)}:{};return i.jsx(l.ListItem,{disablePadding:!0,sx:{display:"block",width:"100%",minWidth:0},children:i.jsxs(w,{...T,sx:{display:"flex",alignItems:"flex-start",width:"100%",minWidth:0,gap:1,px:1,borderRadius:1},children:[i.jsxs(l.Box,{sx:{display:"flex",flexDirection:"column",flex:"1 1 0%",minWidth:0},children:[i.jsxs(l.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:a,minWidth:0,overflow:"hidden"},children:[i.jsx(l.Typography,{sx:{flexShrink:0,fontWeight:"bold"},children:C.toUpperCase()}),i.jsxs(l.Box,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:c,minWidth:0,overflow:"hidden"},children:[i.jsx(In,{text:p?E.toUpperCase():h.language_name?`${E.toUpperCase()} - ${h.language_name}`:E.toUpperCase(),truncate:!0}),i.jsx(In,{text:W(`flavors:names:${h.flavor_type}/${h.flavor}`,s.current),truncate:!0})]})]}),i.jsx(l.Typography,{sx:{width:"100%",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"text.secondary"},children:b?`${h.description?`${h.description} - `:""}${h.name}`:`${h.name}${h.description?` - ${h.description}`:""}`})]}),i.jsxs(l.Box,{...Vh,sx:{display:"flex",flexDirection:"row",alignItems:"center",flexShrink:0,flexGrow:0,cursor:"default"},children:[i.jsx(l.IconButton,{onClick:()=>g(h),children:i.jsx(kp,{})}),t]})]})},h.local_path??`${C}-${E}-${h.name}`)})}),i.jsx(ts,{titleLabel:`${x("pages:core-contenthandler-generic:about_document")} ${(f==null?void 0:f.name)??""}`,isOpen:!!f,closeFn:()=>g(null),actionsButtonArray:Br({onlyCloseButton:!0,closeLabel:x("pages:core-contenthandler-generic:close"),closeFn:()=>g(null)}),children:f&&i.jsx(cc,{repoSummary:f,readOnly:r,onSaved:h=>{g(h),o==null||o(h)}})})]}):i.jsx(l.CircularProgress,{})}function lc({optionCopyright:e,copyright:t}){const{i18nRef:n}=v.useContext(ve),r=s=>W(`library:pankosmia-rcl:${s}`,n.current),o=Pn(e,t,r);return i.jsxs(l.Box,{sx:{mb:2,px:2,py:1,borderRadius:"4px",backgroundColor:"grey.200"},children:[i.jsx(l.Typography,{variant:"caption",color:"text.secondary",display:"block",children:r("preview")}),i.jsx(l.Typography,{variant:"body1",sx:{fontStyle:o?"normal":"italic"},color:o?"text.primary":"text.disabled",children:o||r("preview_incomplete")})]})}const Wh={author_name:"",year:"",license:"",version:"",order:"year_first"};function Uh({isOpen:e,closeFn:t,onApply:n}){const{i18nRef:r}=v.useContext(ve),o=w=>W(`library:pankosmia-rcl:${w}`,r.current),[s,a]=v.useState(Wh),c=w=>a(T=>({...T,...w})),u=ss.find(w=>w.value===s.license),p=!!(u!=null&&u.versioned),[f,g]=v.useState(!1),b=f&&!s.author_name.trim(),m=f&&!ac.test(s.year.trim()),x=f&&p&&!s.version,h=()=>{if(g(!0),!Dh("builder",s))return;const w=Pn("builder",s,o).replace(/^©\s*/,"");n(w),t()},C=i.jsx(l.MenuItem,{value:"",children:i.jsx("em",{children:o("none")})}),E={select:{displayEmpty:!0},inputLabel:{shrink:!0}};return i.jsxs(ts,{titleLabel:o("copyright_builder"),isOpen:e,requiredFieldsLabel:!0,closeFn:t,actionsButtonArray:Br({actionLabel:o("OK"),actionFn:h,closeFn:t,closeOnAction:!1,closeLabel:o("cancel")}),children:[i.jsx(lc,{optionCopyright:"builder",copyright:s}),i.jsxs(l.Box,{sx:{display:"flex",flexDirection:"column",gap:3},children:[i.jsx(l.TextField,{required:!0,error:b,fullWidth:!0,label:o("name"),value:s.author_name,onChange:w=>c({author_name:w.target.value})}),i.jsx(l.TextField,{required:!0,fullWidth:!0,error:m,label:o("year"),helperText:o("year_helper"),value:s.year,onChange:w=>c({year:w.target.value.replace(/[^\d-]/g,"").slice(0,9)})}),i.jsxs(l.Box,{sx:{display:"flex",gap:2},children:[i.jsxs(l.TextField,{select:!0,sx:{flex:1},label:o("licence"),value:s.license,onChange:w=>c({license:w.target.value,version:""}),slotProps:E,children:[C,ss.map(w=>i.jsx(l.MenuItem,{value:w.value,children:w.i18n?o(w.value):w.value},w.value))]}),i.jsx(l.TextField,{select:!0,sx:{flex:1},required:p,disabled:!p,error:x,label:o("version"),value:s.version,onChange:w=>c({version:w.target.value}),children:Ah.map(w=>i.jsx(l.MenuItem,{value:w,children:w},w))})]}),i.jsxs(l.FormControl,{children:[i.jsx(l.FormLabel,{id:"copyright-order-label",sx:{color:"text.primary"},children:o("order")}),i.jsxs(l.RadioGroup,{"aria-labelledby":"copyright-order-label",value:s.order,onChange:w=>c({order:w.target.value}),sx:{pl:1,mt:1},children:[i.jsx(l.FormControlLabel,{value:"year_first",control:i.jsx(l.Radio,{}),label:o("order_year_first")}),i.jsx(l.FormControlLabel,{value:"holder_first",control:i.jsx(l.Radio,{}),label:o("order_holder_first")})]})]})]})]})}function uc({optionCopyright:e,setOptionCopyright:t,setCopyright:n,copyright:r}){const{i18nRef:o}=v.useContext(ve),s=f=>W(`library:pankosmia-rcl:${f}`,o.current),[a,c]=v.useState(!1),u=f=>n({...r,...f}),p=e==="free";return i.jsxs(Za,{titleSection:s("copyright"),children:[i.jsx(lc,{optionCopyright:e,copyright:r}),i.jsxs(l.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:[i.jsx(l.FormControl,{children:i.jsxs(l.RadioGroup,{value:e,onChange:f=>t(f.target.value),row:!0,name:"copyright-option",children:[i.jsx(l.FormControlLabel,{value:"unspecified",control:i.jsx(l.Radio,{}),label:s("unspecified")}),i.jsx(l.FormControlLabel,{value:"public-domain",control:i.jsx(l.Radio,{}),label:s("public_domain")}),i.jsx(l.FormControlLabel,{value:"free",control:i.jsx(l.Radio,{}),label:s("licenced")})]})}),i.jsx(l.TextField,{id:"copyright_free_text",fullWidth:!0,required:p,disabled:!p,label:s("copyright"),value:r.free_text,onChange:f=>u({free_text:f.target.value}),slotProps:{input:{startAdornment:i.jsx(l.InputAdornment,{position:"start",children:"©"})}}}),i.jsx(l.Box,{children:i.jsx(l.Button,{variant:"outlined",disabled:!p,onClick:()=>c(!0),children:s("copyright_builder")})})]}),a&&i.jsx(Uh,{isOpen:a,closeFn:()=>c(!1),onApply:f=>u({free_text:f})})]})}function dc({readOnly:e=!0,optionCopyright:t,setOptionCopyright:n,setCopyright:r,copyright:o}){const{i18nRef:s}=v.useContext(ve),a=[{label:"library:pankosmia-rcl:copyright",value:o?Pn(t,o)??"":""}];return e?i.jsx(l.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:a.map(({label:c,value:u})=>i.jsxs(l.Box,{children:[i.jsx(l.Typography,{variant:"caption",sx:{display:"block",color:"text.secondary"},children:W(c,s.current)}),i.jsx(l.Typography,{variant:"body1",sx:{whiteSpace:"pre-wrap"},children:u})]},c))}):i.jsx(uc,{optionCopyright:t,setOptionCopyright:n,setCopyright:r,copyright:o})}function fc({currentLanguage:e,setCurrentLanguage:t,setIsValid:n,open:r=!0}){const[o,s]=v.useState("BCP47List"),[a,c]=v.useState(!1),{i18nRef:u}=v.useContext(ve),[p,f]=v.useState(!0),[g,b]=v.useState(!1),[m,x]=v.useState(""),[h,C]=v.useState([]),[E,w]=v.useState(!1),[T,P]=v.useState({}),[_,O]=v.useState(!0),$=/^x-[a-z]{3}$/,j=S=>S.replace(/^x-/,"X ");v.useEffect(()=>{r&&Nn({url:"/api/git/list-local-repos",setter:C}).then()},[r]),v.useEffect(()=>{r&&Nn({url:"/api/app-resources/lookups/bcp47-language_codes.json",setter:P}).then()},[r]);const B=Object.entries(T).map(([S,d])=>({language_code:S,language_name:d.en}));v.useEffect(()=>{e.language_code&&n(!a)},[a]),v.useEffect(()=>{_&&Object.keys(T).length>0&&(e.language_code&&(T[e.language_code]?t({...e,language_code:e.language_code,language_name:T[e.language_code].en}):(t({...e,language_code:`${e.language_code}`,language_name:`${e.language_name}`}),s("customLanguage"))),O(!1))},[T,_,B]),v.useEffect(()=>{m&&Ee(`/api/burrito/metadata/summary/${m}`).then(S=>S.json).then(S=>t({...e,language_code:S.language_code,language_name:S.language_name,script_direction:["ltr","rtl"].includes(S.script_direction)?S.script_direction:e==null?void 0:e.script_direction})).catch(S=>console.error("Error :",S))},[r,m]);const z=h.filter(S=>p&&S.startsWith("_local_")||g&&S.startsWith("git"));return i.jsxs(l.Box,{sx:{width:"100%"},children:[i.jsxs(l.FormControl,{children:[i.jsx(l.FormLabel,{sx:{color:"text.secondary","&.Mui-focused":{color:"text.secondary"}},id:"demo-radio-buttons-group-label",children:W("library:pankosmia-rcl:choose_language",u.current)}),i.jsxs(l.RadioGroup,{row:!0,value:o,onChange:S=>{s(S.target.value),w(!1),t({language_code:"",language_name:"",script_direction:e==null?void 0:e.script_direction})},"aria-labelledby":"demo-radio-buttons-group-label",name:"radio-buttons-group",children:[i.jsx(l.FormControlLabel,{value:"BCP47List",control:i.jsx(l.Radio,{}),label:W("library:pankosmia-rcl:lang_code_bcp47_list",u.current)}),i.jsx(l.FormControlLabel,{value:"burrito",control:i.jsx(l.Radio,{}),label:W("library:pankosmia-rcl:lang_code_burrito",u.current)}),i.jsx(l.FormControlLabel,{value:"customLanguage",control:i.jsx(l.Radio,{}),label:W("library:pankosmia-rcl:lang_code_custom_language",u.current)})]})]}),o==="BCP47List"&&i.jsxs(l.Grid,{container:!0,spacing:2,children:[i.jsx(l.Grid,{size:12,children:i.jsx(l.Typography,{children:W("library:pankosmia-rcl:description_bcp47_list",u.current)})}),i.jsx(l.Grid,{size:6,children:T&&i.jsx(Yo,{value:e.language_code??null,setValue:S=>{var d;return t({...e,language_code:S,language_name:((d=T[S])==null?void 0:d.en)??""})},data:Object.keys(T),getOptionLabel:S=>{const{en:d,...A}=T[S]??{},R=Object.values(A);return R.length>0?`${S} - ${R} - ${d}`:d?`${S} - ${d}`:""},filterOptions:(S,{inputValue:d})=>{const A=d.toLowerCase();return S.filter(R=>{var G,J;const D=T[R];return((G=D==null?void 0:D.en)==null?void 0:G.toLowerCase().includes(A))||((J=D==null?void 0:D[R])==null?void 0:J.toLowerCase().includes(A))}).sort((R,D)=>{var G,J,oe,ie;return((J=(G=T[R])==null?void 0:G.en)==null?void 0:J.toLowerCase().indexOf(A))-((ie=(oe=T[D])==null?void 0:oe.en)==null?void 0:ie.toLowerCase().indexOf(A))})},titleLabel:`${W("library:pankosmia-rcl:language",u.current)} *`})}),i.jsx(l.Grid,{size:6,children:i.jsx(l.TextField,{disabled:!0,id:"language_code",sx:{width:"100%"},label:W("library:pankosmia-rcl:lang_code",u.current),value:e?e.language_code:null})})]}),o==="burrito"&&i.jsxs(l.Grid,{container:!0,spacing:1,sx:{justifyItems:"flex-end",alignItems:"stretch"},children:[i.jsx(l.Typography,{children:W("library:pankosmia-rcl:description_lang_code_burrito",u.current)}),i.jsxs(l.Grid,{size:12,children:[i.jsx(l.FormLabel,{children:W("library:pankosmia-rcl:title_section_burrito",u.current)}),i.jsxs(l.FormGroup,{row:!0,required:!0,children:[i.jsx(l.FormControlLabel,{control:i.jsx(l.Checkbox,{color:"secondary",checked:p,onChange:()=>f(!p),defaultChecked:!0}),label:W("library:pankosmia-rcl:local_project",u.current)}),i.jsx(l.FormControlLabel,{control:i.jsx(l.Checkbox,{color:"secondary",checked:g,onChange:()=>b(!g)}),label:W("library:pankosmia-rcl:burrito_resources",u.current)})]})]}),i.jsx(l.Grid,{size:12,children:i.jsx(Yo,{data:z,setValue:x,getOptionLabel:S=>`${S}`,titleLabel:`${W("library:pankosmia-rcl:document",u.current)} *`})}),i.jsx(l.Grid,{size:6,children:i.jsx(l.TextField,{disabled:!0,id:"language_name",sx:{width:"100%"},label:W("library:pankosmia-rcl:lang_name",u.current),value:e?e.language_name:null})}),i.jsx(l.Grid,{size:6,children:i.jsx(l.TextField,{disabled:!0,id:"language_code",sx:{width:"100%"},label:W("library:pankosmia-rcl:lang_code",u.current),value:e?e.language_code:null})})]}),o==="customLanguage"&&i.jsxs(l.Grid,{container:!0,spacing:1,sx:{justifyItems:"flex-end",alignItems:"stretch"},children:[i.jsx(l.Grid,{size:12,children:i.jsx(l.Typography,{children:W("library:pankosmia-rcl:description_custom_language",u.current)})}),i.jsx(l.Grid,{size:6,children:i.jsx(l.TextField,{id:"language_name",required:!0,sx:{width:"100%"},label:W("library:pankosmia-rcl:lang_name",u.current),value:(e==null?void 0:e.language_name)??"",onChange:S=>{const d=S.target.value;w(d!==""),t({...e,language_name:d})},onBlur:()=>{e!=null&&e.language_name||(w(!1),t({...e,language_name:j((e==null?void 0:e.language_code)??"")}))}})}),i.jsx(l.Grid,{size:6,children:i.jsx(l.TextField,{id:"language_code",placeholder:"x-abc",error:a,helperText:W("library:pankosmia-rcl:helper_language_code",u.current),required:!0,sx:{width:"100%"},label:W("library:pankosmia-rcl:lang_code",u.current),value:e?e.language_code:null,onChange:S=>{const d=S.target.value.toLocaleLowerCase();t({...e,language_code:d,...E?{}:{language_name:j(d)}}),c(d.length>0&&!$.test(d))}})})]}),i.jsxs(l.FormControl,{sx:{mb:2},children:[i.jsx(l.FormLabel,{sx:{color:"text.secondary","&.Mui-focused":{color:"text.secondary"}},id:"script-direction-label",children:W("library:pankosmia-rcl:script_direction",u.current)}),i.jsx(l.RadioGroup,{row:!0,"aria-labelledby":"script-direction-label",name:"script-direction-group",value:(e==null?void 0:e.script_direction)==="rtl"?"rtl":"ltr",onChange:S=>t({...e,script_direction:S.target.value}),children:i.jsxs(l.Box,{sx:{display:"flex",flexDirection:"column"},children:[i.jsx(l.FormControlLabel,{value:"ltr",control:i.jsx(l.Radio,{}),label:W("library:pankosmia-rcl:ltr",u.current)}),i.jsx(l.FormControlLabel,{value:"rtl",control:i.jsx(l.Radio,{}),label:W("library:pankosmia-rcl:rtl",u.current)})]})})]})]})}function pc({readOnly:e=!0,currentLanguage:t,setCurrentLanguage:n,setIsValid:r}){const{i18nRef:o}=v.useContext(ve),s=[{label:"library:pankosmia-rcl:language",value:t.language_name},{label:"library:pankosmia-rcl:lang_code",value:t.language_code},{label:"library:pankosmia-rcl:script_direction",value:W(t.script_direction==="rtl"?"library:pankosmia-rcl:rtl":"library:pankosmia-rcl:ltr",o.current)}];return e?i.jsx(l.Box,{sx:{display:"flex",flexDirection:"column",gap:2},children:s.map(({label:a,value:c})=>i.jsxs(l.Box,{children:[i.jsx(l.Typography,{variant:"caption",sx:{display:"block",color:"text.secondary"},children:W(a,o.current)}),i.jsx(l.Typography,{variant:"body1",children:c})]},a))}):i.jsx(fc,{setIsValid:r,currentLanguage:t,setCurrentLanguage:n})}Z.AdvancedAppBar=Rh,Z.AdvancedAppBarMenuBeta=ic,Z.AdvancedAppBarMenuDebug=sc,Z.AppWrapper=Ga,Z.AppbarHamburger=np,Z.AssetDownloadButton=ec,Z.AssetDownloadDialog=Sh,Z.BasiqueAppBar=$h,Z.ButtonInfo=Vo,Z.ExternalLink=xh,Z.Header=Ta,Z.InternetSwitch=zo,Z.InternetWarningDialog=Wr,Z.PanAdvancedDialog=ts,Z.PanBasicDialog=tc,Z.PanBookPicker=mh,Z.PanCopyright=uc,Z.PanCopyrightWrapper=dc,Z.PanDialog=rp,Z.PanDialogActions=fp,Z.PanDialogActionsArray=Br,Z.PanDownload=Op,Z.PanFilteredMenu=Yo,Z.PanLanguagePicker=fc,Z.PanLanguagePickerWrapper=pc,Z.PanListTable=zh,Z.PanMenuWrapper=ns,Z.PanPillTypography=In,Z.PanRepoInfo=cc,Z.PanStepperPicker=gh,Z.PanTable=Ca,Z.PanVersificationPicker=hh,Z.ScrollableBody=bh,Z.SectionDialogTitle=Za,Z.SpSpa=fh,Z.SpSpaPage=Ja,Z.Spa=Xa,Z.SpaContainer=Qa,Z.WrapperAppBar=rs,Z.authContext=ja,Z.bcvContext=Ia,Z.betaContext=jr,Z.clientConfigContext=Tr,Z.clientInterfacesContext=Oa,Z.currentProjectContext=$a,Z.debugContext=xt,Z.fallbackTheme=yh,Z.i18nContext=ve,Z.languagesContext=ph,Z.messagesContext=Pa,Z.netContext=ut,Z.productContext=Er,Z.snippetContext=Ra,Z.typographyContext=_a,Z.wordContext=Ma,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})}));
274
274
  //# sourceMappingURL=pankosmia-rcl.umd.js.map