pankosmia-bcv-muncher 0.2.7 → 0.2.8

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.
@@ -273,7 +273,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
273
273
  * @license MIT
274
274
  */var Hs,_m;function yR(){if(_m)return Hs;_m=1,Hs=function(n){return n!=null&&(e(n)||t(n)||!!n._isBuffer)};function e(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function t(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&e(n.slice(0,0))}return Hs}var Bm;function SR(){return Bm||(Bm=1,(function(){var e=vR(),t=Lm().utf8,n=yR(),a=Lm().bin,o=function(i,l){i.constructor==String?l&&l.encoding==="binary"?i=a.stringToBytes(i):i=t.stringToBytes(i):n(i)?i=Array.prototype.slice.call(i,0):!Array.isArray(i)&&i.constructor!==Uint8Array&&(i=i.toString());for(var s=e.bytesToWords(i),u=i.length*8,d=1732584193,c=-271733879,f=-1732584194,m=271733878,p=0;p<s.length;p++)s[p]=(s[p]<<8|s[p]>>>24)&16711935|(s[p]<<24|s[p]>>>8)&4278255360;s[u>>>5]|=128<<u%32,s[(u+64>>>9<<4)+14]=u;for(var g=o._ff,h=o._gg,v=o._hh,y=o._ii,p=0;p<s.length;p+=16){var E=d,T=c,O=f,C=m;d=g(d,c,f,m,s[p+0],7,-680876936),m=g(m,d,c,f,s[p+1],12,-389564586),f=g(f,m,d,c,s[p+2],17,606105819),c=g(c,f,m,d,s[p+3],22,-1044525330),d=g(d,c,f,m,s[p+4],7,-176418897),m=g(m,d,c,f,s[p+5],12,1200080426),f=g(f,m,d,c,s[p+6],17,-1473231341),c=g(c,f,m,d,s[p+7],22,-45705983),d=g(d,c,f,m,s[p+8],7,1770035416),m=g(m,d,c,f,s[p+9],12,-1958414417),f=g(f,m,d,c,s[p+10],17,-42063),c=g(c,f,m,d,s[p+11],22,-1990404162),d=g(d,c,f,m,s[p+12],7,1804603682),m=g(m,d,c,f,s[p+13],12,-40341101),f=g(f,m,d,c,s[p+14],17,-1502002290),c=g(c,f,m,d,s[p+15],22,1236535329),d=h(d,c,f,m,s[p+1],5,-165796510),m=h(m,d,c,f,s[p+6],9,-1069501632),f=h(f,m,d,c,s[p+11],14,643717713),c=h(c,f,m,d,s[p+0],20,-373897302),d=h(d,c,f,m,s[p+5],5,-701558691),m=h(m,d,c,f,s[p+10],9,38016083),f=h(f,m,d,c,s[p+15],14,-660478335),c=h(c,f,m,d,s[p+4],20,-405537848),d=h(d,c,f,m,s[p+9],5,568446438),m=h(m,d,c,f,s[p+14],9,-1019803690),f=h(f,m,d,c,s[p+3],14,-187363961),c=h(c,f,m,d,s[p+8],20,1163531501),d=h(d,c,f,m,s[p+13],5,-1444681467),m=h(m,d,c,f,s[p+2],9,-51403784),f=h(f,m,d,c,s[p+7],14,1735328473),c=h(c,f,m,d,s[p+12],20,-1926607734),d=v(d,c,f,m,s[p+5],4,-378558),m=v(m,d,c,f,s[p+8],11,-2022574463),f=v(f,m,d,c,s[p+11],16,1839030562),c=v(c,f,m,d,s[p+14],23,-35309556),d=v(d,c,f,m,s[p+1],4,-1530992060),m=v(m,d,c,f,s[p+4],11,1272893353),f=v(f,m,d,c,s[p+7],16,-155497632),c=v(c,f,m,d,s[p+10],23,-1094730640),d=v(d,c,f,m,s[p+13],4,681279174),m=v(m,d,c,f,s[p+0],11,-358537222),f=v(f,m,d,c,s[p+3],16,-722521979),c=v(c,f,m,d,s[p+6],23,76029189),d=v(d,c,f,m,s[p+9],4,-640364487),m=v(m,d,c,f,s[p+12],11,-421815835),f=v(f,m,d,c,s[p+15],16,530742520),c=v(c,f,m,d,s[p+2],23,-995338651),d=y(d,c,f,m,s[p+0],6,-198630844),m=y(m,d,c,f,s[p+7],10,1126891415),f=y(f,m,d,c,s[p+14],15,-1416354905),c=y(c,f,m,d,s[p+5],21,-57434055),d=y(d,c,f,m,s[p+12],6,1700485571),m=y(m,d,c,f,s[p+3],10,-1894986606),f=y(f,m,d,c,s[p+10],15,-1051523),c=y(c,f,m,d,s[p+1],21,-2054922799),d=y(d,c,f,m,s[p+8],6,1873313359),m=y(m,d,c,f,s[p+15],10,-30611744),f=y(f,m,d,c,s[p+6],15,-1560198380),c=y(c,f,m,d,s[p+13],21,1309151649),d=y(d,c,f,m,s[p+4],6,-145523070),m=y(m,d,c,f,s[p+11],10,-1120210379),f=y(f,m,d,c,s[p+2],15,718787259),c=y(c,f,m,d,s[p+9],21,-343485551),d=d+E>>>0,c=c+T>>>0,f=f+O>>>0,m=m+C>>>0}return e.endian([d,c,f,m])};o._ff=function(i,l,s,u,d,c,f){var m=i+(l&s|~l&u)+(d>>>0)+f;return(m<<c|m>>>32-c)+l},o._gg=function(i,l,s,u,d,c,f){var m=i+(l&u|s&~u)+(d>>>0)+f;return(m<<c|m>>>32-c)+l},o._hh=function(i,l,s,u,d,c,f){var m=i+(l^s^u)+(d>>>0)+f;return(m<<c|m>>>32-c)+l},o._ii=function(i,l,s,u,d,c,f){var m=i+(s^(l|~u))+(d>>>0)+f;return(m<<c|m>>>32-c)+l},o._blocksize=16,o._digestsize=16,Vs.exports=function(i,l){if(i==null)throw new Error("Illegal argument "+i);var s=e.wordsToBytes(o(i,l));return l&&l.asBytes?s:l&&l.asString?a.bytesToString(s):e.bytesToHex(s)}})()),Vs.exports}var xR=SR();const Na=Fr(xR);function wR({ingredient:e,metadata:t,md5Ingredient:n,setMd5Ingredient:a,i18nRef:o,systemBcv:i}){const[l,s]=le.useState(!1),u=async(f,m)=>{const p=f.map(v=>v.map(y=>y.replace(/\n/g,"\\n"))).map(v=>v.join(" ")).filter(v=>v.trim().length>0).join(`
275
275
  `),g=JSON.stringify({payload:p}),h=await OO(`/api/burrito/ingredient/raw/${t.local_path}?ipath=${i.bookCode}.tsv`,g,m);if(h.ok)Js.enqueueSnackbar(`${Oe("pages:core-contenthandler_bcv:saved",o.current)}`,{variant:"success"}),d(!1);else throw Js.enqueueSnackbar(`${Oe("pages:core-contenthandler_bcv:save_error",o.current)}: ${h.status}`,{variant:"error"}),new Error(`Failed to save: ${h.status}, ${h.error}`)},d=f=>{s(f)},c=()=>{a(Na(JSON.stringify(e))),u([...e])};return k.jsx(kt,{disabled:Na(JSON.stringify(e))===n,sx:{"&.Mui-disabled":{color:"#bebbbbff"}},variant:"contained",onClick:()=>{c()},children:k.jsx(hR,{size:"large",color:Na(JSON.stringify(e))===n?"#eaeaea":"primary"})})}function kR({bcvRef:e,debugRef:t,i18nRef:n,currentProjectRef:a,setFirstChapter:o,disable:i=!1}){const[l,s]=le.useState([]),[u,d]=le.useState(e.current.bookCode);return le.useEffect(()=>{(async()=>{if(a.current){const f=`${a.current.source}/${a.current.organization}/${a.current.project}`,m=await EO(`/api/burrito/metadata/summary/${f}`,t.current);m.ok&&s(m.json.book_codes)}})().then()},[a]),le.useEffect(()=>{u&&e.current.bookCode!==u&&o(a.current,t.current,u)},[u]),k.jsx(et,{sx:{justifyContent:"space-between"},children:k.jsx("div",{children:k.jsx(xn,{disabled:i,label:`${Oe("pages:core-contenthandler_bcv:book",n.current)}`,fullWidth:!0,id:"book-button",size:"small",select:!0,value:e.current.bookCode,children:l.map((c,f)=>k.jsx(ql,{sx:{maxHeight:"3rem",height:"2rem"},value:c,onClick:()=>d(c),children:Oe(`scripture:books:${c}`,n.current)},f))})})})}function TR({ingredient:e,currentChapter:t,setCurrentChapter:n}){const o=[...new Set(e.map(u=>u[0].split(":")[0]))].slice(1).filter(u=>u&&u.trim()!=="").sort((u,d)=>parseInt(u)-parseInt(d)),i=o.indexOf(t),l=()=>{i>0&&n(o[i-1])},s=()=>{i<o.length-1&&n(o[i+1])};return k.jsx(et,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.5},children:k.jsxs(et,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"},children:[k.jsx(kt,{size:"small",onClick:l,disabled:i<=0,sx:{p:.5},children:k.jsx(fR,{})}),k.jsx(xn,{select:!0,label:"Ch",size:"small",fullWidth:!0,value:t,onChange:u=>n(u.target.value),children:o.map(u=>k.jsx(ql,{value:u,sx:{maxHeight:"3rem",height:"2rem"},children:u},u))}),k.jsx(kt,{size:"small",onClick:s,disabled:i>=o.length-1,children:k.jsx(mR,{})})]})})}async function CR(e,t,n){const a=`${e.source}/${e.organization}/${e.project}`,o=await hi(`/api/burrito/ingredient/raw/${a}?ipath=${n}.tsv`,t);if(o.ok){const i=o.text.split(`
276
- `).map(l=>l.split(" ")[0].trim()).filter(l=>/^\d+:\d+$/.test(l)).map(l=>{const[s,u]=l.split(":").map(Number);return{raw:l,chapter:s,verse:u}});if(i.length>0){const{chapter:l,verse:s}=i[0];bm(`/api/navigation/bcv/${n}/${l}/${s}`,t)}}}function ER(){return k.jsx(or,{children:k.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",stroke:"none",children:[k.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"}),k.jsx("path",{d:"M20 12H4V14H20V12Z",fill:"currentColor",stroke:"none"}),k.jsx("path",{d:"M10 14H8V18H10V14Z",fill:"currentColor",stroke:"none"}),k.jsx("path",{d:"M16 14H14V18H16V14Z",fill:"currentColor",stroke:"none"}),k.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 OR({metadata:e,debugRef:t,systemBcv:n,i18nRef:a,bcvRef:o,currentProjectRef:i}){if(!(n!=null&&n.bookCode))return null;const[l,s]=le.useState([]),[u,d]=le.useState(1),[c,f]=le.useState([]),[m,p]=le.useState(!1),[g,h]=le.useState("1"),[v,y]=le.useState(!1),[E,T]=le.useState("new_bcv_note"),[O,C]=le.useState(!1),S=Ym.useNavigate(),j=async()=>{const N=`/api/burrito/ingredient/raw/${e.local_path}?ipath=${n.bookCode}.tsv`;let b=await hi(N,t.current);if(b.ok){const P=b.text.split(`
276
+ `).map(l=>l.split(" ")[0].trim()).filter(l=>/^\d+:\d+$/.test(l)).map(l=>{const[s,u]=l.split(":").map(Number);return{raw:l,chapter:s,verse:u}});if(i.length>0){const{chapter:l,verse:s}=i[0];bm(`/api/navigation/bcv/${n}/${l}/${s}`,t)}}}function ER(){return k.jsx(or,{children:k.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",stroke:"none",children:[k.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"}),k.jsx("path",{d:"M20 12H4V14H20V12Z",fill:"currentColor",stroke:"none"}),k.jsx("path",{d:"M10 14H8V18H10V14Z",fill:"currentColor",stroke:"none"}),k.jsx("path",{d:"M16 14H14V18H16V14Z",fill:"currentColor",stroke:"none"}),k.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 OR({metadata:e,debugRef:t,systemBcv:n,i18nRef:a,bcvRef:o,currentProjectRef:i}){const[l,s]=le.useState([]),[u,d]=le.useState(1),[c,f]=le.useState([]),[m,p]=le.useState(!1),[g,h]=le.useState("1"),[v,y]=le.useState(!1),[E,T]=le.useState("new_bcv_note"),[O,C]=le.useState(!1),S=Ym.useNavigate(),j=async()=>{const N=`/api/burrito/ingredient/raw/${e.local_path}?ipath=${n.bookCode}.tsv`;let b=await hi(N,t.current);if(b.ok){const P=b.text.split(`
277
277
  `).map(A=>A.split(" ").map(D=>D.replace(/(\\n){2,}/g,`
278
278
 
279
279
  `)));s(P);const I=Na(JSON.stringify(P));f(I)}};le.useEffect(()=>{j().then()},[n==null?void 0:n.bookCode]);const $=N=>{const b=l[N][0],P=b.split(":"),I=P[0],A=P[1],D=A.split("-")[0],L=A.includes("-")?A.split("-")[1]:D;b[0]&&P.length===2&&bm(`/api/navigation/bcv/${n.bookCode}/${I}/${D}/${L}`,t.current)},F=le.useCallback(()=>{const N=c;if(!N)return!1;const b=Na(JSON.stringify(l));return N!==b},[l,c]);le.useEffect(()=>{!!window.electronAPI&&(F()?window.electronAPI.setCanClose(!1):window.electronAPI.setCanClose(!0))},[F]);const _=g?l.filter(N=>N[0].startsWith(`${g}:`)):[];return le.useEffect(()=>{if(!l||l.length<2)return;const N=l[0].join(" ").toLowerCase(),b=l[1].join(" ").toLowerCase();if(N.includes("note")){T("new_bcv_note");return}if(b.includes("front:intro")){b.includes("study")?T("new_bcv_study_question"):T("new_bcv_question");return}N.includes("response")?T("new_bcv_question"):N.includes("question")?T("new_bcv_study_question"):T("new_bcv_note")},[l]),k.jsxs(An,{sx:{padding:2},children:[k.jsx(et,{sx:{position:"fixed",top:"48px",left:0,right:0,display:"flex",padding:2},children:k.jsxs(Yt,{container:!0,sx:{alignItems:"flex-start",justifyContent:"space-between",width:"100%"},children:[k.jsx(Yt,{sx:{display:"flex"},gap:1,children:k.jsx(wR,{metadata:e,ingredient:l,setIngredient:s,md5Ingredient:c,setMd5Ingredient:f,i18nRef:a,systemBcv:n})}),k.jsxs(Yt,{sx:{display:"flex"},gap:1,children:[k.jsx(kR,{bcvRef:o,debugRef:t,i18nRef:a,currentProjectRef:i,setFirstChapter:CR}),k.jsx(TR,{ingredient:l,currentChapter:g,setCurrentChapter:h})]}),k.jsx(Yt,{sx:{display:"flex"},gap:1,children:k.jsx(qp,{title:Oe("pages:core-contenthandler_bcv:button_edit_layout",a.current,t.current),children:k.jsx(kt,{disabled:Na(JSON.stringify(l))!==c,onClick:()=>S({pathname:"/",search:"return-page=workspace"}),children:k.jsx(ER,{})})})})]})}),_.length>0?k.jsxs(et,{sx:{display:"flex",gap:2,flexGrow:1,padding:2},children:[k.jsx(gR,{ingredient:l,setIngredient:s,currentRowN:u,setCurrentRowN:d,cellValueChanged:m,setCellValueChanged:p,updateBcv:$,currentChapter:g,refDisabled:v,setRefDisabled:y,resourceType:E,i18nRef:a}),k.jsx(bR,{currentRowN:u,setCurrentRowN:d,ingredient:l,setIngredient:s,updateBcv:$,cellValueChanged:m,setCellValueChanged:p,refDisabled:v,setRefDisabled:y,resourceType:E,showAllFields:O,setShowAllFields:C,i18nRef:a})]}):k.jsx(et,{sx:{display:"flex",gap:2,flexGrow:1,padding:2},children:k.jsxs(An,{spacing:2,children:[k.jsx(Dm,{currentRowN:u,setCurrentRowN:d,ingredient:l,setIngredient:s,cellValueChanged:m,setCellValueChanged:p,refDisabled:v,setRefDisabled:y,resourceType:E,i18nRef:a}),k.jsx(it,{children:Oe("pages:core-contenthandler_bcv:no_notes",a.current)})]})})]})}st.BcvNotesEditorMuncher=OR,st.BcvNotesViewerMuncher=GO,st.BcvQuestionsViewerMuncher=KO,Object.defineProperty(st,Symbol.toStringTag,{value:"Module"})}));