📄 705.fc9a8e2a.chunk.js
/home/palash/git/site/build/static/js/705.fc9a8e2a.chunk.js
Language: js • Lines: 2
"use strict";(self.webpackChunknew_site=self.webpackChunknew_site||[]).push([[705],{8705(e,n,t){t.r(n),t.d(n,{default:()=>R});var s=t(9379),a=t(5544),r=t(5043),o=t(6322),c=t(3604),i=t(791),l=t(5016),d=t(2729),u=t(4451),p=t(1719),h=t(4282),m=t(8602),g=t(3519),f=t(3083),x=t(1072),y=t(7417),b=t(184),w=t(5809),S=t(3859),A=t(9082),j=t(1800),v=t(579);function C(){const e=(0,r.useState)(!1),n=(0,a.A)(e,2),t=n[0],s=n[1];return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(b.__w,{style:{cursor:"pointer",fontSize:"0.85rem",verticalAlign:"middle"},onClick:()=>s(!0),title:"Shorthand notation guide"}),(0,v.jsxs)(f.A,{show:t,onHide:()=>s(!1),size:"xl","aria-labelledby":"shorthand-manual-modal",centered:!0,children:[(0,v.jsx)(f.A.Header,{closeButton:!0,children:(0,v.jsx)(f.A.Title,{id:"shorthand-manual-modal",children:"Shorthand Tab Notation Guide"})}),(0,v.jsx)(f.A.Body,{style:{maxHeight:"calc(100vh - 210px)",overflowY:"auto"},children:(0,v.jsx)(w.oz,{remarkPlugins:[S.A],children:"\n## Writing Notes\n\nThe basic format: **Fret:String@Duration**\n\n```\n3:1@q      Fret 3, string 1, quarter note\n0:6@w      Open string 6, whole note\n5:3@h.     Fret 5, string 3, dotted half note\n```\n\n**Strings:** 1 = thinnest (highest pitch), 6 = thickest (lowest pitch).\n\n### Duration Letters\n\n| Letter | Duration | Beats (in 4/4) |\n| --- | --- | --- |\n| `s` | 1/16 note | 1/4 beat |\n| `e` | 1/8 note | 1/2 beat |\n| `q` | 1/4 note | 1 beat |\n| `h` | 1/2 note | 2 beats |\n| `w` | whole note | 4 beats |\n\nAdd `.` for dotted notes (e.g., `h.` = dotted half = 3 beats).\n\n### Compact Notation\n\nShorter form: **fret** + `f` + **string** + `s` + **duration**\n\n```\n3f1sq      Same as 3:1@q\n0f6sw      Same as 0:6@w\n```\n\n---\n\n## Open Strings and Muted Strings\n\n| Symbol | Meaning |\n| --- | --- |\n| `O` or `0` | Open string |\n| `X` or `x` | Muted / dead string |\n\n---\n\n## Rests\n\nUse `-` for silence: `-@q` (quarter rest), `-@h` (half rest), etc.\nYou can also write `-q`, `-h` (without the `@`).\n\n---\n\n## Chords\n\nWrap simultaneous notes in square brackets:\n\n```\n[0:6 | 2:5 | 2:4 | 1:3 | 0:2 | 0:1]@q   G major chord, quarter note\n[3:1 | 5:2]@h                              Two-note chord, half note\n[0f6s | 2f5s | 2f4s]@q                    Compact form inside chords\n[0:6 | 2:5]w                               Trailing duration (no @ needed)\n```\n\n---\n\n## Two Voices (Polyphony)\n\nFor melody + bass playing simultaneously, use `v1` (upper/melody) and `v2` (lower/bass). Each voice fills the bar independently.\n\n```\nM1: 3f3sqv1 | 3f3sqv1 | 4f3sqv1 | 5f3sqv1\nM1: 0f6hwv2 | 0f6hwv2\n```\n\n---\n\n## Ties\n\nAdd `t` after duration to hold a note into the next beat without re-plucking:\n\n```\n3:2@ht       Half note, tied\n[0:6 | 2:5]@wt   Whole chord, tied\n```\n\n---\n\n## Annotations\n\nAdd `d:text` for notes to the readers (doesn't affect sound):\n\n```\n3:1@qd:Melody_starts_here\n[0:6 | 2:5]@qd:C_major_chord\n```\n\nThe parser stops at spaces, so use `_` as a stand-in:\n```\n3:1@qd:slide_to_fret_7\n```\nrenders as \"slide to fret 7\"\n\n---\n\n## Measure Numbers\n\n- **Explicit:** `Measure 1: ...` or `M 1: ...` or `M1: ...`\n- **Implicit:** Just write a line of notes \u2014 the system counts them in order.\n\n---\n\n## Quick Reference\n\n| What You Write | What It Means |\n| --- | --- |\n| `3:1@q` | Fret 3, string 1, quarter note |\n| `3f1sq` | Same thing, compact form |\n| `-@q` | Quarter rest |\n| `[0:6 \\| 2:5]@q` | Two-note chord, quarter note |\n| `t` (after duration) | Tie \u2014 hold through next beat |\n| `v1`, `v2` | Voice 1 (melody) or Voice 2 (bass) |\n| `d:text` | Annotation (doesn't affect sound) |\n| `O:3@q` | Open string 3 |\n| `X:6@h` | Muted string 6 |\n| `M1:` or `Measure 1:` | Measure number label |\n\n---\n\n## Tips\n\n- Each measure must total exactly one bar (e.g., 4 beats in 4/4).\n- Use `v1`/`v2` when two independent lines happen at the same time.\n- Inside chords `[...]`, separate notes with ` | `. Inside measures, also separate with ` | `.\n- Strings: **1** (highest) to **6** (lowest).\n- Descriptions are just for your own reference.\n"})}),(0,v.jsx)(f.A.Footer,{children:(0,v.jsx)(h.A,{variant:"secondary",onClick:()=>s(!1),children:"Close"})})]})]})}const k="#334155",N="#67e8f9",q="#e2e8f0",I="#c084fc",M="#475569",H="#fbbf24",T="#4ade80",F="#22d3ee",D="#f87171",O="#fb923c",_="#22d3ee",W="#f87171",E="#6b7280",z="#e2e8f0",L="#94a3b8",G="#64748b",P="#fbbf24",$="#22d3ee";function B(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").split("\n").map(e=>{if(/^={2,}|^---+/.test(e))return'<span style="color:'.concat(k,'">').concat(e,"</span>");if(/^(Score|Time Signature|Instrument|Capo|Description|ID):/.test(e))return e.replace(/^(Score|Time Signature|Instrument|Capo|Description|ID):(.*)$/,(e,n,t)=>'<span style="color:'.concat(N,'">').concat(n,'</span><span style="color:').concat(q,'">:').concat(t,"</span>"));if(/^(M(?:easure)?\s*\d+):/i.test(e)){let n=e.replace(/^(M(?:easure)?\s*\d+):/i,""),t=e.match(/^(M(?:easure)?\s*\d+:)/i)[0];return n=X(n),'<span style="color:'.concat(I,'">').concat(t,"</span>").concat(n)}return X(e)}).join("\n")}function X(e){return e.replace(/(\|)/g,'<span style="color:'.concat(M,'">$1</span>')).replace(/(\[)([^\]]*)(\])/g,(e,n,t,s)=>{const a=t.replace(/(\d+|[OXox])f(\d+)s?/gi,(e,n,t)=>'<span style="color:'.concat(P,'">').concat(n,'</span><span style="color:').concat($,'">f</span><span style="color:').concat(L,'">').concat(t,'</span><span style="color:').concat($,'">s</span>')).replace(/([OXox])(:)/g,(e,n,t)=>"O"===n||"o"===n?'<span style="color:'.concat(_,'">').concat(n,'</span><span style="color:').concat(G,'">').concat(t,"</span>"):'<span style="color:'.concat(W,'">').concat(n,'</span><span style="color:').concat(G,'">').concat(t,"</span>")).replace(/(\d+)(:)(\d+)/g,(e,n,t,s)=>'<span style="color:'.concat(z,'">').concat(n,'</span><span style="color:').concat(G,'">').concat(t,'</span><span style="color:').concat(L,'">').concat(s,"</span>"));return'<span style="color:'.concat(H,'">').concat(n,"</span>").concat(a,'<span style="color:').concat(H,'">').concat(s,"</span>")}).replace(/(-)(@?(?:w|h|q|e|s)\.?)/g,(e,n,t)=>'<span style="color:'.concat(E,'">').concat(n,'</span><span style="color:').concat(T,'">').concat(t,"</span>")).replace(/(\d+|[OXox])f(\d+)s([whqes]\.?)/gi,(e,n,t,s)=>{const a="O"===n||"o"===n?'<span style="color:'.concat(_,'">').concat(n,"</span>"):"X"===n||"x"===n?'<span style="color:'.concat(W,'">').concat(n,"</span>"):'<span style="color:'.concat(P,'">').concat(n,"</span>");return"".concat(a,'<span style="color:').concat($,'">f</span><span style="color:').concat(L,'">').concat(t,'</span><span style="color:').concat($,'">s</span><span style="color:').concat(T,'">').concat(s,"</span>")}).replace(/(\d+|[OXox])(:)(\d+)/g,(e,n,t,s)=>{const a="O"===n||"o"===n?'<span style="color:'.concat(_,'">').concat(n,"</span>"):"X"===n||"x"===n?'<span style="color:'.concat(W,'">').concat(n,"</span>"):'<span style="color:'.concat(z,'">').concat(n,"</span>");return"".concat(a,'<span style="color:').concat(G,'">').concat(t,'</span><span style="color:').concat(L,'">').concat(s,"</span>")}).replace(/(@(?:w|h|q|e|s)\.?)/g,(e,n)=>'<span style="color:'.concat(T,'">').concat(n,"</span>")).replace(/\b(v[12])\b/g,(e,n)=>'<span style="color:'.concat(F,'">').concat(n,"</span>")).replace(/\b(t)\b(?!\w)/g,(e,n)=>'<span style="color:'.concat(D,'">').concat(n,"</span>")).replace(/(d:[^\s|]+)/g,(e,n)=>'<span style="color:'.concat(O,'">').concat(n,"</span>"))}function R(){const e=(0,l.A)().user,n=(0,o.Zp)(),t=(0,o.ok)(),f=(0,a.A)(t,1)[0],b=(0,r.useState)([]),w=(0,a.A)(b,2),S=w[0],k=w[1],N=(0,r.useState)(""),q=(0,a.A)(N,2),I=q[0],M=q[1],H=(0,r.useState)(!0),T=(0,a.A)(H,2),F=T[0],D=T[1],O=(0,r.useState)(""),_=(0,a.A)(O,2),W=_[0],E=_[1],z=(0,r.useState)(""),L=(0,a.A)(z,2),G=L[0],P=L[1],$=(0,r.useState)(null),X=(0,a.A)($,2),R=X[0],U=X[1],J=(0,r.useState)(null),V=(0,a.A)(J,2),Y=V[0],Q=V[1],Z=(0,r.useState)([]),K=(0,a.A)(Z,2),ee=K[0],ne=K[1],te=(0,r.useState)(!1),se=(0,a.A)(te,2),ae=se[0],re=se[1],oe=(0,r.useState)(!1),ce=(0,a.A)(oe,2),ie=ce[0],le=ce[1],de=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=de.current;e&&(e.style.height="auto",e.style.height=e.scrollHeight+"px")},[G]);const ue=(0,r.useState)(""),pe=(0,a.A)(ue,2),he=pe[0],me=pe[1],ge=(0,r.useState)("4/4"),fe=(0,a.A)(ge,2),xe=fe[0],ye=fe[1],be=(0,r.useState)("Guitalele"),we=(0,a.A)(be,2),Se=we[0],Ae=we[1],je=(0,r.useState)(0),ve=(0,a.A)(je,2),Ce=ve[0],ke=ve[1],Ne=(0,r.useState)(""),qe=(0,a.A)(Ne,2),Ie=qe[0],Me=qe[1],He=(0,r.useState)(!1),Te=(0,a.A)(He,2),Fe=Te[0],De=Te[1],Oe=(0,r.useState)(!1),_e=(0,a.A)(Oe,2),We=_e[0],Ee=_e[1],ze=(0,r.useState)(""),Le=(0,a.A)(ze,2),Ge=Le[0],Pe=Le[1],$e=(0,r.useState)(""),Be=(0,a.A)($e,2),Xe=Be[0],Re=Be[1],Ue=(0,c.rJ)(i.db,(0,j.n)("scores")),Je=(0,r.useCallback)(async()=>{if(e){D(!0),E("");try{const n=(0,c.P)(Ue,(0,c._M)("userId","==",e.uid)),t=await(0,c.GG)(n),a=[],r=(0,c.wP)(i.db);let o=!1;t.forEach(e=>{const n=e.data();a.push((0,s.A)({id:e.id},n)),!n.nameLower&&n.name&&(r.update((0,c.H9)(i.db,(0,j.n)("scores"),e.id),{nameLower:n.name.toLowerCase()}),o=!0)}),o&&await r.commit(),a.sort((e,n)=>(n.createdAt||0)-(e.createdAt||0)),k(a)}catch(n){E("Firestore error: ".concat(n.code||n.message)),console.error("Failed to load scores",n)}finally{D(!1)}}},[e]);(0,r.useEffect)(()=>{Je()},[Je]);const Ve=(0,r.useCallback)(async()=>{if(!e)return"";try{const n=await(0,c.x7)((0,c.H9)(i.db,(0,j.n)("profiles"),e.uid));if(n.exists())return n.data().username||""}catch(n){console.error("Failed to get username",n)}return""},[e]);(0,r.useEffect)(()=>{if(F||0===S.length)return;const e=f.get("edit");if(!e)return;const t=S.find(n=>n.id===e);if(t){M(t.id),me(t.name||""),ye(t.timeSignature||"4/4"),Ae(t.instrument||"Guitalele"),ke(t.capo||0),Me(t.desc||""),De(t.published||!1),P(t.rawShorthand||""),Re(t.username||""),n("/tab-parser",{replace:!0});const e="=".repeat(80)+"\nScore: "+(t.name||"")+"\nTime Signature: "+(t.timeSignature||"4/4")+"\nInstrument: "+(t.instrument||"Guitalele")+"\nCapo: "+(t.capo||0)+"\nDescription: "+(t.desc||"")+"\n"+"=".repeat(80)+"\n"+(t.rawShorthand||"");Pe(e);const s=(0,d.S)(e),a=s.scores,r=s.errors;U(a),ne(r)}},[F,S,f]);return F?(0,v.jsx)(g.A,{className:"text-center mt-5",children:(0,v.jsx)(y.A,{animation:"border",variant:"light"})}):(0,v.jsx)("div",{style:{padding:"20px",fontFamily:"sans-serif"},children:(0,v.jsxs)(g.A,{children:[W&&(0,v.jsx)(p.A,{variant:"warning",className:"py-2",children:W}),(0,v.jsxs)(x.A,{className:"align-items-center",children:[(0,v.jsx)(m.A,{children:(0,v.jsx)("h2",{className:"mb-0",children:"Tab Shorthand Parser"})}),(0,v.jsx)(m.A,{xs:"auto",children:(0,v.jsx)(C,{})})]}),(0,v.jsxs)(x.A,{xs:1,sm:2,md:3,lg:5,className:"g-2",children:[(0,v.jsxs)(m.A,{children:[(0,v.jsx)("label",{children:"Existing Scores"}),(0,v.jsxs)("select",{className:"form-select",value:I,onChange:e=>{const n=e.target.value;if(M(n),Q(null),!n)return me(""),ye("4/4"),Ae("Guitalele"),ke(0),Me(""),De(!1),ke(0),U(null),ne([]),void Re("");const t=S.find(e=>e.id===n);if(t){me(t.name||""),ye(t.timeSignature||"4/4"),Ae(t.instrument||"Guitalele"),ke(t.capo||0),Me(t.desc||""),De(t.published||!1),P(t.rawShorthand||""),Re(t.username||"");const e="=".repeat(80)+"\nScore: "+(t.name||"")+"\nTime Signature: "+(t.timeSignature||"4/4")+"\nInstrument: "+(t.instrument||"Guitalele")+"\nCapo: "+(t.capo||0)+"\nDescription: "+(t.desc||"")+"\n"+"=".repeat(80)+"\n"+(t.rawShorthand||"");Pe(e);const n=(0,d.S)(e),s=n.scores,a=n.errors;U(s),ne(a)}},children:[(0,v.jsx)("option",{value:"",children:"-- New Score --"}),S.map(e=>(0,v.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,v.jsxs)(m.A,{children:[(0,v.jsx)("label",{children:"Name:"}),(0,v.jsx)("input",{className:"form-control",type:"text",value:he,required:!0,onChange:e=>me(e.target.value)})]}),(0,v.jsxs)(m.A,{children:[(0,v.jsx)("label",{children:"Time Signature"}),(0,v.jsx)("select",{className:"form-select",value:xe,onChange:e=>ye(e.target.value),children:["4/4","3/4","6/8","2/4","2/2"].map(e=>(0,v.jsx)("option",{value:e,children:e},e))})]}),(0,v.jsxs)(m.A,{children:[(0,v.jsx)("label",{children:"Instrument"}),(0,v.jsx)("select",{className:"form-select",value:Se,onChange:e=>Ae(e.target.value),children:["Guitalele"].map(e=>(0,v.jsx)("option",{value:e,children:e},e))})]}),(0,v.jsxs)(m.A,{children:[(0,v.jsx)("label",{children:"Capo:"}),(0,v.jsx)("input",{className:"form-control",type:"number",min:0,max:12,value:Ce,onChange:e=>ke(e.target.value)})]})]}),(0,v.jsx)(x.A,{children:(0,v.jsx)(m.A,{children:(0,v.jsxs)("div",{style:{display:"flex",minHeight:"300px",maxHeight:"600px",overflow:"auto",background:"#0a0e17",borderRadius:"4px",fontFamily:"'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace",fontSize:"12px",lineHeight:1.5},children:[(0,v.jsx)("div",{style:{flex:"0 0 auto",width:"48px",borderRight:"1px solid #1e293b",userSelect:"none",pointerEvents:"none",padding:"6px 0",alignSelf:"stretch"},children:(0,v.jsx)("pre",{style:{margin:0,padding:"0 8px",textAlign:"right",fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",color:"#475569",whiteSpace:"pre",tabSize:2,minHeight:"100%"},children:(G||"").split("\n").map((e,n)=>"".concat(n+1,"\n")).join("").replace(/\n$/,"")})}),(0,v.jsxs)("div",{style:{flex:1,minWidth:0,display:"grid",alignSelf:"stretch"},children:[(0,v.jsx)("pre",{"aria-hidden":"true",style:{gridArea:"1 / 1",margin:0,padding:"6px 12px",fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",whiteSpace:"pre-wrap",wordBreak:"break-all",color:"#94a3b8",pointerEvents:"none",tabSize:2},dangerouslySetInnerHTML:{__html:G?B(G):""}}),(0,v.jsx)("textarea",{ref:de,className:"form-control border-0",style:{gridArea:"1 / 1",width:"100%",fontFamily:"inherit",fontSize:"inherit",lineHeight:"inherit",background:"transparent",color:"transparent",caretColor:"#f1f5f9",resize:"vertical",tabSize:2,overflow:"hidden",WebkitTextFillColor:"transparent",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"break-word"},placeholder:"Paste your scores_shorthand.txt content here...",value:G,onChange:e=>{P(e.target.value);const n=de.current;n&&(n.style.height="auto",n.style.height=n.scrollHeight+"px")}})]})]})})}),(0,v.jsxs)(x.A,{className:"mt-2 g-1",children:[(0,v.jsx)(m.A,{xs:"auto",children:(0,v.jsx)(h.A,{variant:"primary",onClick:async()=>{try{if(Q(null),ne([]),!he.trim())throw new Error("Score name is required.");let n="=".repeat(80);n+="\nScore: "+he,n+="\nTime Signature: "+xe,n+="\nInstrument: "+Se,n+="\nCapo: "+Ce,n+="\nDescription: "+Ie,n+="\n"+"=".repeat(80),n+="\n"+G,Pe(n);const t=(0,d.S)(n),s=t.scores,a=t.errors;if(console.log("Parsed Scores:",s),U(s),ne(a),!s||0===s.length||!s[0].measures||0===s[0].measures.length)throw new Error("Score must contain at least one measure with notes.");if(a.length>0)return;re(!0);const r=he.trim(),o=Xe||await Ve();if(!o)throw new Error("You must set a username before saving scores. Go to your profile to set one.");Re(o);const l=Se.trim(),u=(0,A.A)(r),p=((e,n,t)=>{const s=(0,A.A)(t);return"".concat(e,":").concat((0,A.A)(n),":").concat(s)})(o,l,r),h=await(0,c.x7)((0,c.H9)(i.db,(0,j.n)("scores"),p));if(h.exists()&&(h.data().userId!==e.uid||I&&I!==p))throw new Error('A score named "'.concat(r,'" for ').concat(Se," already exists."));I&&I!==p&&await(0,c.kd)((0,c.H9)(i.db,(0,j.n)("scores"),I)),await(0,c.BN)((0,c.H9)(i.db,(0,j.n)("scores"),p),{userId:e.uid,name:r,nameLower:r.toLowerCase(),timeSignature:xe,instrument:l,capo:Number(Ce),desc:Ie,published:Fe,rawShorthand:G,username:o,slug:u,createdAt:h.exists()&&h.data().createdAt||Date.now(),updatedAt:Date.now()}),await Je(),M(p)}catch(n){console.error("Failed to save score",n.code,n.message),"permission-denied"===n.code?Q("Please verify your email before creating or editing scores. Check your inbox for a verification link."):Q(n.message||"An error occurred during parsing."),U(null)}finally{re(!1)}},disabled:!he||ae,children:ae?"Saving...":I?"Update":"Save & Parse"})}),I&&Xe&&(0,v.jsx)(m.A,{xs:"auto",children:(0,v.jsx)(h.A,{variant:"outline-info",onClick:()=>n("/content/".concat(Xe,"/").concat((0,A.A)(Se),"/").concat((0,A.A)(he))),children:"Preview"})}),(0,v.jsx)(m.A,{xs:"auto",children:(0,v.jsx)(h.A,{variant:Fe?"outline-warning":"outline-success",onClick:async()=>{if(!I)return void De(e=>!e);le(!0);const e=Fe;try{const e=!Fe;De(e),await(0,c.mZ)((0,c.H9)(i.db,(0,j.n)("scores"),I),{published:e,updatedAt:Date.now()})}catch(n){De(e),Q("Failed to update published state: ".concat(n.message))}finally{le(!1)}},disabled:ie,children:ie?"Updating...":Fe?"Mark as Draft":"Publish"})}),(0,v.jsx)(m.A,{xs:"auto",children:(0,v.jsx)(h.A,{variant:"outline-secondary",disabled:ae||ie,onClick:()=>{P(""),U(null),ne([]),Q(null),ne([]),me(""),Me(""),De(!1),ke(0),M(""),Re("")},children:"Clear"})}),I&&(0,v.jsx)(m.A,{xs:"auto",children:(0,v.jsx)(h.A,{variant:"outline-danger",onClick:async()=>{if(I&&window.confirm("Delete this score?"))try{await(0,c.kd)((0,c.H9)(i.db,"scores",I)),M(""),me(""),ye("4/4"),Ae("Guitalele"),ke(0),Me(""),De(!1),P(""),U(null),await Je()}catch(e){console.error("Failed to delete score",e.code,e.message),Q(e.message)}},disabled:ae||ie,children:"Delete"})})]}),Y&&(0,v.jsx)(x.A,{className:"mt-2",children:(0,v.jsx)(m.A,{children:(0,v.jsx)(p.A,{variant:"danger",className:"py-2",children:Y})})}),ee.length>0&&(0,v.jsx)(x.A,{className:"mt-2",children:(0,v.jsx)(m.A,{children:(0,v.jsx)(p.A,{variant:"warning",className:"py-2",children:(0,v.jsx)("pre",{style:{margin:0,whiteSpace:"pre-wrap",fontFamily:"inherit"},children:ee.join("\n")})})})}),(0,v.jsxs)(x.A,{className:"mt-3",children:[(0,v.jsx)(m.A,{xs:"auto",children:(0,v.jsx)("label",{children:"Show Fully Constructed Score:"})}),(0,v.jsx)(m.A,{xs:"auto",children:(0,v.jsx)("input",{type:"checkbox",checked:We,onChange:e=>Ee(e.target.checked)})}),(0,v.jsx)(m.A,{children:We?"Showing":"Hidden"})]}),We&&R&&(0,v.jsxs)(x.A,{className:"mt-2",children:[(0,v.jsx)(m.A,{md:6,children:(0,v.jsxs)("div",{className:"rounded border",style:{background:"#0f172a",borderColor:"#334155"},children:[(0,v.jsx)("div",{className:"d-flex align-items-center px-2 py-1 border-bottom",style:{borderColor:"#334155"},children:(0,v.jsx)("span",{style:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",letterSpacing:"1px"},children:"ASCII Preview"})}),(0,v.jsx)("pre",{style:{margin:0,padding:"8px",fontSize:"10px",lineHeight:1.4,color:"#94a3b8",maxHeight:"400px",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all"},dangerouslySetInnerHTML:{__html:B(Ge)}})]})}),(0,v.jsx)(m.A,{md:6,children:(0,v.jsxs)("div",{className:"rounded border",style:{background:"#0a0e17",borderColor:"#334155"},children:[(0,v.jsx)("div",{className:"d-flex align-items-center px-2 py-1 border-bottom",style:{borderColor:"#334155"},children:(0,v.jsx)("span",{style:{fontSize:"9px",color:"#64748b",textTransform:"uppercase",letterSpacing:"1px"},children:"JSON Output"})}),(0,v.jsx)("pre",{style:{margin:0,padding:"8px",fontSize:"10px",lineHeight:1.4,maxHeight:"400px",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all"},dangerouslySetInnerHTML:{__html:JSON.stringify(R,null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"([^"]+)":/g,'<span style="color:#7dd3fc">"$1"</span>:').replace(/: "([^"]+)"/g,': <span style="color:#a5d6a7">"$1"</span>').replace(/: (\d+\.?\d*)/g,': <span style="color:#f9a825">$1</span>').replace(/: (true|false)/g,': <span style="color:#ce93d8">$1</span>').replace(/: (null)/g,': <span style="color:#ef9a9a">$1</span>')}})]})})]}),(0,v.jsx)(x.A,{className:"mt-3",children:(0,v.jsx)(m.A,{children:(0,v.jsx)(u.A,{scoreData:R&&R.length>0?R[0]:Array.isArray(R)?null:R})})})]})})}},2729(e,n,t){t.d(n,{S:()=>c});const s=e=>{if(!e)return null;const n=e.trim().toUpperCase();return"O"===n?0:"X"===n?null:parseInt(n,10)},a={s:.25,e:.5,"e.":.75,q:1,"q.":1.5,h:2,"h.":3,w:4,"w.":6},r=e=>{if(!e)return 4;const n=e.split("/"),t=parseInt(n[0],10),s=parseInt(n[1],10);return isNaN(t)||isNaN(s)?4:t*(4/s)},o=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const t={duration:1};let r=e.trim();const o=r.indexOf("d:");-1!==o&&(t.description=r.substring(o+2),r=r.substring(0,o)),r.includes("t")&&(t.tie=!0,r=r.replace("t",""));const c=r.match(/v(\d+)/);c&&(t.voice=parseInt(c[1],10),r=r.replace(/v\d+/,""));const i=r.match(/^(\d+|[OXox])f(\d+)s([whqes]\.?)$/i);if(i){const e=s(i[1]);t.fret=null!==e?e+n:null,t.string=parseInt(i[2],10);const r=i[3].toLowerCase();return t.duration=a[r]||1,t}const l=r.match(/@([whqes]\.?)/);if(l){const e=l[1];t.duration=a[e]||parseFloat(e),r=r.split("@")[0]}if(r.startsWith("-")){const e=r.match(/^-([whqes]\.?)/i);if(e){const n=e[1].toLowerCase();t.duration=a[n]||t.duration}return t.isRest=!0,t}if(r.startsWith("[")){const e=r.lastIndexOf("]"),n=r.substring(e+1).toLowerCase();n&&a[n]&&(t.duration=a[n]);const o=r.slice(1,e).split(/[\s|]+/).filter(Boolean);return t.pitches=o.map(e=>{const n=e.match(/^(\d+|[OXox])f(\d+)s?$/i);if(n)return{fret:s(n[1]),string:parseInt(n[2],10)};const t=e.split(":");return{fret:s(t[0]),string:parseInt(t[1],10)}}),t}if(r.includes(":")){const e=r.split(":");t.string=parseInt(e[1],10);const a=s(e[0].trim());return t.fret=null!==a?a+n:null,t}return t},c=e=>{const n=e.split("\n"),t=[],s=[];let a=null;for(let c=0;c<n.length;c++){const e=n[c].trim();if(e&&!e.startsWith("==")&&!e.startsWith("GUITALELE TAB"))if(e.startsWith("Score:"))a&&t.push(a),a={id:"",title:e.replace("Score:","").trim(),instrument:"",timeSignature:"4/4",measures:[],capo:0};else if(a){if(e.startsWith("ID:")){a.id=e.replace("ID:","").trim();continue}if(e.startsWith("Instrument:")){a.instrument=e.replace("Instrument:","").trim();continue}if(e.startsWith("Time Signature:")){a.timeSignature=e.replace("Time Signature:","").trim();continue}if(e.startsWith("Description:")){a.description=e.replace("Description:","").trim();continue}if(e.startsWith("Capo:")){const n=e.replace("Capo:","").trim();a.capo=parseInt(n,10)||0;continue}let n,t;const c=e.match(/^(?:Measure|M)\s*(\d+):\s*(.*)$/i);if(c)n=parseInt(c[1],10),t=c[2];else{n=(a.measures.length>0?a.measures[a.measures.length-1].measureNumber:0)+1,t=e}const i=t.match(/\[[^\]]+\][^\s]*|[^\s|]+/g)||[],l=[];let d=0;for(const e of i){e.startsWith("[")&&!e.includes("]")&&s.push("Measure ".concat(n,': missing closing bracket in "').concat(e,'".'));const t=o(e,a.capo);if(void 0!==t.fret||t.isRest||t.pitches||s.push("Measure ".concat(n,': unrecognized token "').concat(e,'".')),void 0!==t.string&&(isNaN(t.string)||t.string<1||t.string>6)&&s.push("Measure ".concat(n,": string ").concat(t.string,' in "').concat(e,'" is out of range (1-6).')),t.pitches)for(const a of t.pitches)void 0!==a.string&&(isNaN(a.string)||a.string<1||a.string>6)&&s.push("Measure ".concat(n,": string ").concat(a.string,' in chord "').concat(e,'" is out of range (1-6).'));l.push(t),d+=t.duration}if(l.length>0){const e=r(a.timeSignature);Math.abs(d-e)>.01&&s.push("Measure ".concat(n,": expected ").concat(e," beat(s) but got ").concat(d,". Check your durations."))}a.measures.push({measureNumber:n,notes:l})}}if(a&&t.push(a),0===t.length)throw new Error("No valid scores could be processed. Verify format headers.");return{scores:t,errors:s}}},9082(e,n,t){function s(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"")}t.d(n,{A:()=>s})}}]);
//# sourceMappingURL=705.fc9a8e2a.chunk.js.map