📄 91.2ba986da.chunk.js
/home/palash/git/site/node_modules/new_site/build/static/js/91.2ba986da.chunk.js
Language: js • Lines: 2
"use strict";(self.webpackChunknew_site=self.webpackChunknew_site||[]).push([[91],{3091(e,t,s){s.r(t),s.d(t,{default:()=>y});var n=s(9379),r=s(5544),o=s(5043),a=s(8602),c=s(3519),i=s(8770),l=s(1072),d=s(1746),p=s(6322),u=s(7236),m=s(3604),h=s(791),f=s(5016),x=s(184),g=s(9082),w=s(1800),b=s(579);function y(){const e=(0,p.g)().type,t=(0,f.A)().user,s=(0,o.useState)(""),y=(0,r.A)(s,2),j=y[0],A=y[1],N=(0,o.useState)([]),v=(0,r.A)(N,2),S=v[0],P=v[1],k=(0,o.useState)([]),C=(0,r.A)(k,2),_=C[0],M=C[1],z=(0,o.useState)(""),B=(0,r.A)(z,2),D=B[0],T=B[1],L=(0,o.useState)([]),H=(0,r.A)(L,2),E=H[0],G=H[1],$=(0,o.useState)(null),J=(0,r.A)($,2),R=J[0],F=J[1],I=(0,o.useState)(!0),O=(0,r.A)(I,2),U=O[0],Y=O[1],W=(0,o.useState)(!1),K=(0,r.A)(W,2),V=K[0],q=K[1];var Q,X,Z;const ee="scores"===e,te=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];q(!0);try{let t;t=e&&R?(0,m.P)((0,m.rJ)(h.db,(0,w.n)("scores")),(0,m._M)("published","==",!0),(0,m.My)("createdAt","desc"),(0,m.HM)(R),(0,m.AB)(11)):(0,m.P)((0,m.rJ)(h.db,(0,w.n)("scores")),(0,m._M)("published","==",!0),(0,m.My)("createdAt","desc"),(0,m.AB)(11));const s=await(0,m.GG)(t),n=[];let r=null;s.forEach(e=>{const t=e.data(),s=t.username&&t.slug&&t.instrument?"".concat(t.username,"/").concat((0,g.A)(t.instrument),"/").concat(t.slug):"u-"+e.id;n.push({id:s,title:t.name,username:t.username,publishDate:t.createdAt?new Date(t.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):null,rawTime:t.createdAt}),r=e}),n.length>10?(n.pop(),Y(!0),F(r)):(Y(!1),F(null)),G(e?e=>[...e,...n]:n)}catch(t){console.error("Failed to load latest scores",t),G([])}finally{q(!1)}};(0,o.useEffect)(()=>{ee&&!j.trim()&&te(!1)},[e,j]);const se=(0,o.useCallback)(async e=>{if(e.trim())try{const t=e.toLowerCase().trim(),s=await Promise.all([(0,m.GG)((0,m.P)((0,m.rJ)(h.db,(0,w.n)("profiles")),(0,m._M)("displayName",">=",e),(0,m._M)("displayName","<=",e+"\uf8ff"),(0,m.AB)(5))),(0,m.GG)((0,m.P)((0,m.rJ)(h.db,(0,w.n)("profiles")),(0,m._M)("email",">=",e),(0,m._M)("email","<=",e+"\uf8ff"),(0,m.AB)(5))),(0,m.GG)((0,m.P)((0,m.rJ)(h.db,(0,w.n)("profiles")),(0,m._M)("username",">=",t),(0,m._M)("username","<=",t+"\uf8ff"),(0,m.AB)(5)))]),o=(0,r.A)(s,3),a=o[0],c=o[1],i=o[2],l=new Map;a.forEach(e=>l.set(e.id,(0,n.A)({id:e.id},e.data()))),c.forEach(e=>{l.has(e.id)||l.set(e.id,(0,n.A)({id:e.id},e.data()))}),i.forEach(e=>{l.has(e.id)||l.set(e.id,(0,n.A)({id:e.id},e.data()))}),P(Array.from(l.values()).slice(0,5))}catch(t){console.error("Profile search error",t)}else P([])},[]),ne=(0,o.useCallback)(async e=>{if(!e.trim())return M([]),void T("");T("");const t=e.toLowerCase().trim(),s=new Map,n=e=>{const t=e.data();if(!t.published)return;const n=t.username&&t.slug&&t.instrument?"".concat(t.username,"/").concat((0,g.A)(t.instrument),"/").concat(t.slug):"u-"+e.id;s.has(n)||s.set(n,{id:n,name:t.name,username:t.username})};try{(await(0,m.GG)((0,m.P)((0,m.rJ)(h.db,(0,w.n)("scores")),(0,m._M)("name",">=",e),(0,m._M)("name","<=",e+"\uf8ff"),(0,m.AB)(10)))).forEach(n)}catch(r){console.error("Score name search error",r)}try{(await(0,m.GG)((0,m.P)((0,m.rJ)(h.db,(0,w.n)("scores")),(0,m._M)("nameLower",">=",t),(0,m._M)("nameLower","<=",t+"\uf8ff"),(0,m.AB)(10)))).forEach(n)}catch(r){console.error("Score lowercase search error",r)}M(Array.from(s.values()).slice(0,5))},[]);switch((0,o.useEffect)(()=>{const e=setTimeout(()=>{se(j),ne(j)},300);return()=>clearTimeout(e)},[j,se,ne]),e){case"tech":X=window.findProp("pages.contents.techHeader"),Q=window.findProp("pages.contents.techIntro"),Z=window.findProp("pages.contents.sweHeadColor");break;case"music":X=window.findProp("pages.contents.musicHeader"),Q=window.findProp("pages.contents.musicIntro"),Z=window.findProp("pages.contents.musicHeadColor");break;case"scores":X=window.findProp("pages.contents.scoresHeader")||"Scores",Q=window.findProp("pages.contents.scoresIntro")||"Browse and manage your tablature scores",Z=window.findProp("pages.contents.scoresHeadColor")||window.findProp("pages.contents.musicHeadColor");break;default:X=window.findProp("pages.contents.header"),Q=window.findProp("pages.contents.intro"),Z=window.findProp("pages.contents.h1Color")}window.findProp("name");const re=!e,oe="music"===e,ae=ee||oe,ce=j.trim()||void 0,ie=(0,b.jsxs)("div",{className:"position-relative mb-3",style:{maxWidth:400},children:[(0,b.jsx)(x.KSO,{className:"position-absolute text-secondary",style:{left:12,top:10,fontSize:13}}),(0,b.jsx)(i.A.Control,{type:"text",placeholder:"Search users & scores...",value:j,onChange:e=>A(e.target.value),className:"bg-dark text-light border-secondary ps-5"}),(S.length>0||_.length>0)&&j.trim()&&(0,b.jsxs)("div",{className:"position-absolute w-100 mt-1 rounded shadow-lg",style:{background:"#1e1e1e",zIndex:9999,border:"1px solid #333",maxHeight:"calc(100vh - 250px)",overflowY:"auto"},children:[S.map(e=>(0,b.jsxs)(p.N_,{to:"/profile/".concat(e.username?"@".concat(e.username):e.id),className:"d-flex align-items-center gap-2 p-2 text-decoration-none text-light",style:{borderBottom:"1px solid #333"},children:[e.photoURL?(0,b.jsx)("img",{src:e.photoURL,alt:"",width:28,height:28,className:"rounded-circle"}):(0,b.jsx)(x.NBi,{size:28,className:"text-secondary"}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"small",children:e.displayName}),e.username&&(0,b.jsxs)("span",{className:"text-secondary",style:{fontSize:"11px"},children:["@",e.username]}),e.email&&(0,b.jsx)("span",{className:"text-secondary ms-2",style:{fontSize:"11px"},children:e.email})]})]},e.id)),_.map(e=>(0,b.jsxs)(p.N_,{to:"/content/".concat(e.id),className:"d-flex align-items-center gap-2 p-2 text-decoration-none text-light",style:{borderBottom:"1px solid #333"},children:[(0,b.jsx)(x.BHn,{size:20,className:"text-info"}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"small",children:e.name}),(0,b.jsxs)("span",{className:"text-secondary",style:{fontSize:"11px"},children:["Score",e.username?" by @".concat(e.username):""]})]})]},"score-"+e.id))]})]}),le=(0,b.jsxs)(b.Fragment,{children:[j.trim()&&0===S.length&&0===_.length&&ae&&!D&&(0,b.jsxs)("p",{className:"text-secondary small mb-3",children:["No users or scores found for \u201c",j,"\u201d"]}),D&&(0,b.jsxs)("p",{className:"text-warning small mb-3",children:["Search error: ",D]})]});return(0,b.jsx)(b.Fragment,{children:(0,b.jsxs)(c.A,{fluid:!0,className:"contents-page",children:[(0,b.jsx)(d.A,{h1:X,p:Q,h1Color:Z,pColor:window.findProp("pages.contents.pColor")}),ee&&ie,ee&&le,(0,b.jsxs)(l.A,{children:[e?(0,b.jsx)(b.Fragment,{}):(0,b.jsx)(a.A,{children:(0,b.jsx)("h2",{style:{color:window.findProp("pages.contents.sweHeadColor")},children:window.findProp("labels.swe")})}),e?(0,b.jsx)(b.Fragment,{}):(0,b.jsx)(a.A,{children:(0,b.jsx)("h2",{style:{color:window.findProp("pages.contents.musicHeadColor")},children:window.findProp("labels.music")})})]}),(0,b.jsxs)(l.A,{children:[re||"tech"===e?(0,b.jsx)(a.A,{children:(0,b.jsx)(u.A,{showDate:!0,type:"contents.swe",filter:ce})}):(0,b.jsx)(b.Fragment,{}),re||oe?(0,b.jsx)(a.A,{children:(0,b.jsx)(u.A,{showDate:!0,type:"contents.music",filter:ce})}):(0,b.jsx)(b.Fragment,{}),oe&&(0,b.jsxs)(a.A,{xs:12,className:"mt-4",children:[(0,b.jsx)("hr",{className:"text-secondary"}),(0,b.jsx)("p",{className:"mb-0",children:(0,b.jsx)(p.N_,{to:"/contents/scores",className:"btn btn-outline-info",children:"Browse Scores"})})]}),ee?(0,b.jsxs)(a.A,{xs:12,md:9,lg:8,children:[(0,b.jsxs)("div",{className:"d-flex align-items-center gap-3 mb-3",children:[(0,b.jsx)("h4",{style:{color:window.findProp("pages.contents.musicHeadColor")},className:"mb-0",children:"Latest Scores"}),t&&(0,b.jsx)("a",{href:"/tab-parser",className:"btn btn-sm btn-outline-info",children:"+ New"})]}),E.length>0&&!j.trim()&&(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"d-flex flex-column",style:{gap:"6px"},children:E.map(e=>(0,b.jsxs)(p.N_,{to:"/content/".concat(e.id),className:"d-flex align-items-center rounded border p-2 text-decoration-none",style:{gap:"10px",background:"#1e293b",borderColor:"#334155",transition:"background 0.15s, border-color 0.15s",cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.background="#243150",e.currentTarget.style.borderColor="#22d3ee"},onMouseLeave:e=>{e.currentTarget.style.background="#1e293b",e.currentTarget.style.borderColor="#334155"},children:[e.publishDate&&(0,b.jsx)("span",{style:{fontSize:"10px",color:"#64748b",whiteSpace:"nowrap",width:"85px",flexShrink:0},children:e.publishDate}),(0,b.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"13px",color:"#e2e8f0"},children:e.title}),e.username&&(0,b.jsxs)("span",{style:{fontSize:"10px",color:"#64748b",whiteSpace:"nowrap"},children:["@",e.username]})]},e.id))}),U&&(0,b.jsx)("div",{className:"text-center mt-3",children:(0,b.jsx)("button",{className:"btn btn-sm btn-outline-secondary",onClick:()=>te(!0),disabled:V,children:V?"Loading...":"Load More"})})]}),0===E.length&&!j.trim()&&!V&&(0,b.jsxs)("div",{className:"text-center text-secondary py-4 rounded border",style:{background:"#1e293b",borderColor:"#334155"},children:[(0,b.jsx)(x.BHn,{size:32,className:"mb-2 opacity-50"}),(0,b.jsx)("p",{className:"small mb-0",children:"No scores available yet. Be the first to create one!"})]}),!t&&(0,b.jsx)("div",{className:"text-center mt-3",children:(0,b.jsx)("a",{href:"/login?redirect="+encodeURIComponent("/contents/scores"),className:"btn btn-sm btn-outline-secondary",children:"Sign In to Create Scores"})})]}):(0,b.jsx)(b.Fragment,{})]})]})})}},1746(e,t,s){s.d(t,{A:()=>r});var n=s(579);function r(e){return(0,n.jsxs)("div",{className:window.findProp("pages.home.mainStyle")+" page-intro",children:[(0,n.jsx)("h2",{style:{color:e.h1Color},children:e.h1}),(0,n.jsx)("p",{style:{color:e.pColor},children:e.p})]})}},7236(e,t,s){s.d(t,{A:()=>d});var n=s(5544),r=s(6322),o=s(5754),a=s(266),c=s(579);function i(e){return e.sortBy?new Date(e.sortBy).getTime():e.publishDate?new Date(e.publishDate).getTime():0}const l={display:"block",color:"#8892b0",textDecoration:"none",padding:"5px 8px 5px 24px",fontSize:"14px",lineHeight:1.5,borderRadius:"4px",transition:"background 0.15s"};function d(e){let t=e.type,s=e.filter,d=e.showDate,p=e.limit,u=e.truncateAt,m=e.flat;const h="contents.swe"===t?(0,o.aY)():(0,o.az)(),f=s?h.filter(e=>(e.title||"").toLowerCase().includes(s.toLowerCase())):h,x={},g=[];for(const n of f)n.series?(x[n.series]||(x[n.series]=[]),x[n.series].push(n)):g.push(n);const w=Object.entries(x).map(e=>{let t=(0,n.A)(e,2),s=t[0],r=t[1];return{name:s,count:r.length,articles:r.sort((e,t)=>e.seriesOrder-t.seriesOrder),latestDate:Math.max(...r.map(i))}}).sort((e,t)=>t.latestDate-e.latestDate),b=g.sort((e,t)=>i(t)-i(e));let y=0,j=0;const A=[];if(m){for(const e of w){if(p&&y+j>=p)break;y++,A.push({kind:"series-link",data:e})}for(const e of b){if(p&&y+j>=p)break;j++,A.push({kind:"article",data:e})}}else{for(const e of w){if(p&&y+j>=p)break;y++,A.push({kind:"series",data:e});for(const t of e.articles)A.push({kind:"part",data:t,series:e.name})}for(const e of b){if(p&&y+j>=p)break;j++,A.push({kind:"article",data:e})}}if(0===A.length){const e=(0,a.P$)();if(h.length>0)return(0,c.jsx)("p",{className:"text-secondary small",children:"No content matches your active filters."});const t=e?function(e){if(!e)return"Content data failed to load.";const t=e.toLowerCase();return t.includes("cors")?"The site is not allowed to fetch content.":t.includes("failed to fetch")||t.includes("networkerror")?"Content blocked by browser.":t.includes("http 404")||t.includes("not found")?"Content not found (404).":t.includes("http 403")||t.includes("forbidden")?"Access forbidden (403).":t.includes("http 500")||t.includes("internal server")?"Server error (500).":"Content data failed to load: ".concat(e)}(e):"No content found.";return(0,c.jsx)("p",{className:"text-secondary small",children:t})}return(0,c.jsx)("ul",{style:{listStyle:"none",padding:0,margin:0},children:A.map((e,t)=>{if("series-link"===e.kind){const t=e.data;return(0,c.jsx)("li",{style:{padding:"10px 8px",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:(0,c.jsxs)(r.N_,{to:"/content/".concat(t.articles[0].id),style:{textDecoration:"none",display:"block"},children:[(0,c.jsx)("div",{style:{color:"#38bdf8",fontWeight:700,fontSize:"14px"},children:t.name}),(0,c.jsxs)("div",{style:{color:"#6c757d",fontSize:"11px",marginTop:"2px"},children:[t.count," ",1===t.count?"part":"parts"]})]})},t.name)}if("series"===e.kind){const s=e.data;return(0,c.jsxs)("li",{style:{padding:"10px 8px 4px 8px",marginTop:t>0?"12px":0},children:[(0,c.jsx)("div",{style:{color:"#38bdf8",fontWeight:700,fontSize:"15px",textTransform:"uppercase",letterSpacing:"0.5px"},children:s.name}),(0,c.jsxs)("div",{style:{color:"#6c757d",fontSize:"11px",marginBottom:"4px"},children:[s.count," ",1===s.count?"part":"parts"]})]},"series-".concat(s.name))}if("part"===e.kind){const t=e.data,s=u&&t.title.length>u?t.title.slice(0,t.title.lastIndexOf(" ",u))+"\u2026":t.title;return(0,c.jsx)("li",{style:{listStyle:"none"},children:(0,c.jsxs)(r.N_,{to:"/content/".concat(t.id),style:l,onMouseEnter:e=>e.currentTarget.style.background="rgba(255,255,255,0.03)",onMouseLeave:e=>e.currentTarget.style.background="transparent",children:[(0,c.jsxs)("span",{style:{color:"#6c757d",marginRight:"6px",fontSize:"13px"},children:["#",t.seriesOrder]}),s]})},t.id)}const s=e.data,n=u&&s.title.length>u?s.title.slice(0,s.title.lastIndexOf(" ",u))+"\u2026":s.title;return(0,c.jsxs)("li",{style:{listStyle:"none",padding:"8px 8px",borderBottom:"1px solid rgba(255,255,255,0.04)"},children:[d&&s.publishDate?(0,c.jsx)("span",{style:{color:"#6c757d",fontSize:"12px",marginRight:"8px"},children:s.publishDate}):null,(0,c.jsx)(r.N_,{to:"/content/".concat(s.id),style:{color:"#e2e8f0",textDecoration:"none",fontSize:"14px"},children:n})]},s.id)})})}},5754(e,t,s){s.d(t,{HV:()=>c,Yv:()=>i,aY:()=>r,az:()=>o,y9:()=>a});var n=s(9379);function r(){return(window.findProp("contents.swe")||[]).map(e=>(0,n.A)((0,n.A)({},e),{},{contentType:"swe"}))}function o(){return(window.findProp("contents.music")||[]).map(e=>(0,n.A)((0,n.A)({},e),{},{contentType:"music"}))}function a(){return[...r(),...o(),...(window.findProp("contents.drafts")||[]).map(e=>(0,n.A)((0,n.A)({},e),{},{contentType:e.contentType||"swe"}))]}function c(e){if(!e)return[];const t=e.split("\n"),s=[];for(const n of t){const e=n.match(/^(#{1,6})\s+(.+)$/);if(e){const t=e[2].trim().replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/_([^_]+)_/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1");s.push({level:e[1].length,text:t})}}return s}function i(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}},9082(e,t,s){function n(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"")}s.d(t,{A:()=>n})},8602(e,t,s){s.d(t,{A:()=>h});var n=s(5544),r=s(9379),o=s(45),a=s(8139),c=s.n(a),i=s(5043),l=s(7852),d=s(579);const p=["as","bsPrefix","className"],u=["className"];const m=i.forwardRef((e,t)=>{const s=function(e){let t=e.as,s=e.bsPrefix,n=e.className,a=(0,o.A)(e,p);s=(0,l.oU)(s,"col");const i=(0,l.gy)(),d=(0,l.Jm)(),u=[],m=[];return i.forEach(e=>{const t=a[e];let n,r,o;delete a[e],"object"===typeof t&&null!=t?(n=t.span,r=t.offset,o=t.order):n=t;const c=e!==d?"-".concat(e):"";n&&u.push(!0===n?"".concat(s).concat(c):"".concat(s).concat(c,"-").concat(n)),null!=o&&m.push("order".concat(c,"-").concat(o)),null!=r&&m.push("offset".concat(c,"-").concat(r))}),[(0,r.A)((0,r.A)({},a),{},{className:c()(n,...u,...m)}),{as:t,bsPrefix:s,spans:u}]}(e),a=(0,n.A)(s,2),i=a[0],m=i.className,h=(0,o.A)(i,u),f=a[1],x=f.as,g=void 0===x?"div":x,w=f.bsPrefix,b=f.spans;return(0,d.jsx)(g,(0,r.A)((0,r.A)({},h),{},{ref:t,className:c()(m,!b.length&&w)}))});m.displayName="Col";const h=m},1072(e,t,s){s.d(t,{A:()=>u});var n=s(9379),r=s(45),o=s(8139),a=s.n(o),c=s(5043),i=s(7852),l=s(579);const d=["bsPrefix","className","as"],p=c.forwardRef((e,t)=>{let s=e.bsPrefix,o=e.className,c=e.as,p=void 0===c?"div":c,u=(0,r.A)(e,d);const m=(0,i.oU)(s,"row"),h=(0,i.gy)(),f=(0,i.Jm)(),x="".concat(m,"-cols"),g=[];return h.forEach(e=>{const t=u[e];let s;delete u[e],s=null!=t&&"object"===typeof t?t.cols:t;const n=e!==f?"-".concat(e):"";null!=s&&g.push("".concat(x).concat(n,"-").concat(s))}),(0,l.jsx)(p,(0,n.A)((0,n.A)({ref:t},u),{},{className:a()(o,m,...g)}))});p.displayName="Row";const u=p}}]);
//# sourceMappingURL=91.2ba986da.chunk.js.map