1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[710],{5032:function(e,t,a){a.d(t,{w:function(){return i}});var r=a(7437),s=a(2265),l=a(4357),n=a(5805);function i(e){let{page:t="home",className:a=""}=e,[i,c]=(0,s.useState)(null),[o,u]=(0,s.useState)(!1);return((0,s.useEffect)(()=>{let e="visited_".concat(t),a=sessionStorage.getItem(e);(async()=>{try{let r=new AbortController,s=setTimeout(()=>r.abort(),5e3);if(a){let e=await fetch("/api/visitors?page=".concat(t),{signal:r.signal});if(clearTimeout(s),!e.ok)throw Error("API error");let a=await e.json();if(a.error){u(!0);return}c(a.count)}else{let a=await fetch("/api/visitors",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({page:t}),signal:r.signal});if(clearTimeout(s),!a.ok)throw Error("API error");let l=await a.json();if(l.error){u(!0);return}c(l.count),sessionStorage.setItem(e,"true")}}catch(e){console.error("Visitor counter error:",e),u(!0)}})()},[t]),o||null===i)?null:(0,r.jsxs)(l.E.div,{className:"flex items-center gap-1.5 ".concat(a),initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},transition:{duration:.3},children:[(0,r.jsx)(n.Z,{className:"w-3.5 h-3.5"}),(0,r.jsxs)("span",{className:"text-xs font-medium",children:[i.toLocaleString()," ",1===i?"visitor":"visitors"]})]})}t.Z=i},4449:function(e,t,a){a.d(t,{z:function(){return o}});var r=a(7437),s=a(2265),l=a(7495),n=a(535),i=a(6474);let c=(0,n.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),o=s.forwardRef((e,t)=>{let{className:a,variant:s,size:n,asChild:o=!1,...u}=e,m=o?l.g7:"button";return(0,r.jsx)(m,{className:(0,i.cn)(c({variant:s,size:n,className:a})),ref:t,...u})});o.displayName="Button"},710:function(e,t,a){a.r(t),a.d(t,{MagicEditor:function(){return T},default:function(){return A}});var r=a(7437),s=a(2265),l=a(8614),n=a(4357);a(4449);var i=a(9882),c=a(6474);let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsxs)(i.fC,{ref:t,className:(0,c.cn)("relative flex w-full touch-none select-none items-center",a),...s,children:[(0,r.jsx)(i.fQ,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-amber-200",children:(0,r.jsx)(i.e6,{className:"absolute h-full bg-amber-700"})}),(0,r.jsx)(i.bU,{className:"block h-4 w-4 rounded-full border border-amber-700/50 bg-amber-50 shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-700 disabled:pointer-events-none disabled:opacity-50 hover:bg-amber-100"})]})});o.displayName=i.fC.displayName;var u=a(2489),m=a(2023),d=a(2106),x=a(8728),h=a(3276),g=a(1817),p=a(8919),f=a(9076),b=a(1414),y=a(4423);a(3145);var w=a(5032);let v="/assets/magical-quill/quill.png",j="/assets/magical-quill/wand.png",N={hedwig:{label:"Hedwig's Theme",src:"/assets/magical-quill/hedwig-theme.mp3"},hogwarts:{label:"Sound of Hogwarts",src:"/assets/magical-quill/sound_of_hogwarts.mp3"},suzume:{label:"Suzume",src:"/assets/magical-quill/suzume.mp3"},goldenBrown:{label:"Golden Brown",src:"/assets/magical-quill/golden_brown.mp3"}},k="#2c1810",F={sm:{label:"S",classes:"text-sm sm:text-base md:text-lg"},md:{label:"M",classes:"text-lg sm:text-2xl md:text-3xl"},lg:{label:"L",classes:"text-xl sm:text-3xl md:text-4xl"},xl:{label:"XL",classes:"text-2xl sm:text-4xl md:text-5xl"}},C={x:0,y:-85,transformOrigin:"5px 95px"},E={x:-30,y:-100,transformOrigin:"50px 95px"},S=e=>{try{return btoa(encodeURIComponent(JSON.stringify(e)))}catch(e){return null}};function T(e){let{shareData:t=null}
1=e,[a,i]=(0,s.useState)(""),[c,T]=(0,s.useState)(""),[A,O]=(0,s.useState)("quill"),[R,q]=(0,s.useState)(8),[z,I]=(0,s.useState)("md"),[B,H]=(0,s.useState)("hedwig"),[M,Z]=(0,s.useState)(!1),[D,P]=(0,s.useState)(500),[U,W]=(0,s.useState)(!1),[_,L]=(0,s.useState)({x:60,y:60}),[Q,V]=(0,s.useState)(-40),[G,J]=(0,s.useState)(!1),K=null!==t,[X,Y]=(0,s.useState)("waiting"),[$,ee]=(0,s.useState)(!1),[et,ea]=(0,s.useState)(!1),[er,es]=(0,s.useState)(!1),[el,en]=(0,s.useState)(null),ei=(0,s.useRef)(""),ec=(0,s.useRef)(null),eo=(0,s.useRef)(null),eu=(0,s.useRef)(null),em=(0,s.useRef)([]),ed=(0,s.useRef)(null),ex=(0,s.useRef)({x:60,y:60}),eh=(0,s.useRef)({}),eg=e=>{O(e),setTimeout(()=>{var e;null===(e=eu.current)||void 0===e||e.focus()},50)};(0,s.useEffect)(()=>{W(!0)},[]),(0,s.useEffect)(()=>{t&&(O(t.w||"quill"),q(t.s||8),I(t.f||"md"),H(t.m||"hedwig"))},[t]);let ep=(0,s.useCallback)(e=>{if(!eo.current||!ec.current)return{x:32,y:40};let t=eo.current.querySelectorAll(".magic-char"),a=ec.current.getBoundingClientRect();if(0===t.length||e<0)return{x:32,y:40};let r=Math.min(e,t.length-1),s=t[r];if("BR"===s.tagName){let e=null;for(let a=r-1;a>=0;a--)if("BR"!==t[a].tagName){e=t[a];break}if(e){let t=e.getBoundingClientRect(),r=1*t.height;return{x:32,y:t.bottom-a.top+r-5}}return{x:32,y:40}}let l=s.getBoundingClientRect();return{x:l.right-a.left,y:l.bottom-a.top-5}},[]),ef=(0,s.useCallback)(e=>{if(!eu.current||K||el)return;let t=e+1;eu.current.focus(),eu.current.setSelectionRange(t,t),requestAnimationFrame(()=>{let t=ep(e);L(t),ex.current=t})},[K,el,ep]),eb=(0,s.useCallback)(()=>{if(!eo.current||!ec.current)return{x:32,y:40};let e=eo.current.querySelectorAll(".magic-char"),t=ec.current.getBoundingClientRect();if(0===e.length)return{x:32,y:40};let a=e[e.length-1];if("BR"===a.tagName){let a=null;for(let t=e.length-2;t>=0;t--)if("BR"!==e[t].tagName){a=e[t];break}if(!a)return{x:32,y:eo.current.getBoundingClientRect().top-t.top+60};{let e=a.getBoundingClientRect(),r=1*e.height;return{x:32,y:e.bottom-t.top+r-5}}}let r=a.getBoundingClientRect();return{x:r.right-t.left,y:r.bottom-t.top-5}},[]),ey=(0,s.useCallback)((e,t)=>{e-ex.current.x<-50?(J(!1),V(-10),setTimeout(()=>{L({x:e,y:t})},80),setTimeout(()=>{V(-40+(10*Math.random()-5)),J(!0),setTimeout(()=>J(!1),150)},180)):(L({x:e,y:t}),V(-20+(20*Math.random()-10)),J(!0),setTimeout(()=>{J(!1)},300)),ex.current={x:e,y:t}},[A]),ew=(0,s.useCallback)(()=>{ed.current||(ed.current=setInterval(()=>{if(em.current.length>0){let e=em.current.shift();Z(!0),T(t=>(requestAnimationFrame(()=>{requestAnimationFrame(()=>{let e=eb();ey(e.x,e.y)})}),t+e))}else clearInterval(ed.current),ed.current=null,Z(!1)},1e3/R))},[R,eb,ey]);(0,s.useEffect)(()=>{em.current.length>0&&ed.current&&(clearInterval(ed.current),ed.current=null,ew())},[R,ew]),(0,s.useEffect)(()=>{if(eo.current&&ec.current){let e=eo.current.getBoundingClientRect(),t=ec.current.getBoundingClientRect(),a=e.bottom-t.top;a>D-100&&P(e=>Math.max(e,a+150))}},[c,D]),(0,s.useEffect)(()=>{0===c.length&&(L({x:60,y:60}),ex.current={x:60,y:60})},[c]),(0,s.useEffect)(()=>{let e=eh.current[B];e&&(M?(Object.entries(eh.current).forEach(e=>{let[t,a]=e;t!==B&&a&&a.pause()}),e.play().catch(()=>{})):e.pause())},[M,B]),(0,s.useEffect)(()=>{if(Object.values(eh.current).forEach(e=>{e&&e.pause()}),M){let e=eh.current[B];e&&e.play().catch(()=>{})}},[B]),(0,s.useEffect)(()=>()=>{ed.current&&clearInterval(ed.current),Object.values(eh.current).forEach(e=>{e&&e.pause()})},[]);let ev=async()=>{if(!a.trim()||er)return;es(!0);let e=S({t:a,m:B,s:R,f:z,w:A});if(!e){es(!1);return}let t="".concat(window.location.origin,"/magical-quill?share=").concat(e),r=t;try{let e=await fetch("/api/shorten",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:t})});if(e.ok){let t=await e.json();t.shortUrl&&(r=t.shortUrl)}}catch(e){console.log("URL shortening failed, using original URL")}try{await navigator.clipboard.writeText(r),ee(!0),setTimeout(()=>ee(!1),2e3)}catch(t){let e=document.createElement("textarea");e.value=r,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),ee(!0),setTimeout(()=>ee(!1),2e3)}es(!1)};return(0,s.useEffect)(()=>{K&&"playing"===X&&!M&&c.length>0&&0===em.current.length&&Y("finished")},[K,X,M,c]),(0,s.useEffect)(()=>{"playing"===el&&!M&&c.length>0&&0===em.current.length&&en("finished")},[el,M,c]),(0,r.jsxs)("div",{className:"fixed inset-0 w-full h-full bg-cover bg-center bg-no-repeat overflow-auto",style:{backgroundImage:"url(".concat("/assets/magical-quill/background.png",")")},children:[Object.entries(N).map(e=>{let[t,{src:a}]=e;return(0,r.jsx)("audio",{ref:e=>{eh.current[t]=e},src:a,loop:!0,preload:"auto"},t)}),(0,r.jsx)(l.M,{children:$&&(0,r.jsx)(n.E.div,{initial:{opacity:0,y:-20}
1,animate:{opacity:1,y:0},exit:{opacity:0,y:-20},className:"fixed top-4 left-1/2 -translate-x-1/2 z-50 px-4 py-2 rounded-lg shadow-lg",style:{background:"linear-gradient(135deg, #8F5D06 0%, #6B4A0A 100%)",border:"1px solid #C4972A"},children:(0,r.jsx)("span",{className:"font-harry text-amber-100 text-sm sm:text-base",children:"⨠Link copied! Share the magic!"})})}),(0,r.jsx)(l.M,{children:et&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-40 sm:hidden",onClick:()=>ea(!1)}),(0,r.jsxs)(n.E.div,{initial:{y:"-100%"},animate:{y:0},exit:{y:"-100%"},transition:{type:"spring",damping:25,stiffness:300},className:"fixed top-0 left-0 right-0 z-50 sm:hidden rounded-b-2xl p-4 pt-6 pb-4",style:{background:"linear-gradient(135deg, #2d1810 0%, #1a0f0a 100%)",border:"1px solid #8b6914",borderTop:"none"},children:[(0,r.jsx)(n.E.button,{onClick:()=>ea(!1),className:"absolute top-4 right-4 p-1 rounded-full bg-amber-900/40",whileTap:{scale:.9},children:(0,r.jsx)(u.Z,{className:"w-5 h-5 text-amber-200"})}),(0,r.jsx)("h3",{className:"font-harry text-amber-200 text-xl mb-4 text-center",children:"Settings"}),(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsx)("p",{className:"font-crimson text-amber-200/70 text-sm mb-2",children:"Writing Tool"}),(0,r.jsxs)("div",{className:"flex gap-3 justify-center",children:[(0,r.jsxs)(n.E.button,{onClick:()=>eg("quill"),className:"p-2 rounded-xl transition-all ".concat("quill"===A?"bg-amber-900/60 ring-2 ring-amber-400":"bg-black/30"),whileTap:{scale:.95},children:[(0,r.jsx)("img",{src:v,alt:"Quill",className:"w-12 h-12 object-contain",style:{filter:"drop-shadow(0 2px 4px rgba(0,0,0,0.5))"}}),(0,r.jsx)("p",{className:"font-crimson text-amber-200/80 text-xs mt-1",children:"Quill"})]}),(0,r.jsxs)(n.E.button,{onClick:()=>eg("wand"),className:"p-2 rounded-xl transition-all ".concat("wand"===A?"bg-yellow-900/60 ring-2 ring-yellow-400":"bg-black/30"),whileTap:{scale:.95},children:[(0,r.jsx)("img",{src:j,alt:"Wand",className:"w-12 h-12 object-contain",style:{filter:"drop-shadow(0 2px 4px rgba(0,0,0,0.5))"}}),(0,r.jsx)("p",{className:"font-crimson text-amber-200/80 text-xs mt-1",children:"Wand"})]})]})]}),(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsxs)("p",{className:"font-crimson text-amber-200/70 text-sm flex items-center gap-2",children:[(0,r.jsx)(m.Z,{className:"w-4 h-4",style:{color:"#C4972A"}}),"Writing Speed"]}),(0,r.jsxs)("span",{className:"font-crimson text-amber-200 text-sm",children:[Math.round(7*R)," WPM"]})]}),(0,r.jsx)(o,{value:[R],onValueChange:e=>{let[t]=e;return q(t)},min:2,max:12,step:1,className:"cursor-pointer"})]}),(0,r.jsxs)("div",{className:"mb-5",children:[(0,r.jsx)("p",{className:"font-crimson text-amber-200/70 text-sm mb-2",children:"Text Size"}),(0,r.jsx)("div",{className:"flex gap-2 justify-center",children:Object.entries(F).map(e=>{let[t,{label:a}]=e;return(0,r.jsx)("button",{onClick:()=>I(t),className:"px-4 py-2 text-sm font-crimson rounded-lg transition-all ".concat(z===t?"bg-amber-900/60 ring-2 ring-amber-400 text-amber-100":"bg-black/30 text-amber-200/70"),children:a},t)})})]}),(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsxs)("p",{className:"font-crimson text-amber-200/70 text-sm mb-2 flex items-center gap-2",children:[(0,r.jsx)(d.Z,{className:"w-4 h-4",style:{color:"#C4972A"}}),"Background Music"]}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(N).map(e=>{let[t,{label:a}]=e;return(0,r.jsx)("button",{onClick:()=>H(t),className:"px-3 py-2 text-sm font-crimson rounded-lg transition-all ".concat(B===t?"bg-amber-900/60 ring-2 ring-amber-400 text-amber-100":"bg-black/30 text-amber-200/70"),children:a},t)})})]}),(0,r.jsx)("div",{className:"flex justify-center mt-2",children:(0,r.jsx)("div",{className:"w-12 h-1 bg-amber-700/50 rounded-full"})})]})]})}),(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 sm:gap-3 w-full max-w-5xl mx-auto p-2 sm:p-4 pt-2 sm:pt-4 min-h-full",children:[(0,r.jsxs)(n.E.div,{className:"flex flex-wrap items-center justify-between gap-2 w-full px-2 sm:px-4",initial:{opacity:0,y:-20}
1,animate:{opacity:1,y:0},transition:{duration:.5},children:[(0,r.jsx)(w.Z,{page:"magical-quill",className:"text-black-700 font-crimson"}),(0,r.jsx)(n.E.button,{onClick:()=>ea(!0),className:"sm:hidden p-2 rounded-lg bg-black/30 hover:bg-amber-900/40",whileTap:{scale:.95},children:(0,r.jsx)(x.Z,{className:"w-5 h-5",style:{color:"#8F5D06FF"}})}),(0,r.jsxs)("div",{className:"hidden sm:flex items-center gap-2",children:[(0,r.jsx)(n.E.button,{onClick:()=>eg("quill"),className:"relative p-1 rounded-lg transition-all ".concat("quill"===A?"bg-amber-900/60 ring-2 ring-amber-400":"bg-black/30 hover:bg-amber-900/40"),whileHover:{scale:1.05},whileTap:{scale:.95},children:(0,r.jsx)("img",{src:v,alt:"Quill",className:"w-10 h-10 object-contain",style:{filter:"drop-shadow(0 2px 4px rgba(0,0,0,0.5))"}})}),(0,r.jsx)(n.E.button,{onClick:()=>eg("wand"),className:"relative p-1 rounded-lg transition-all ".concat("wand"===A?"bg-yellow-900/60 ring-2 ring-yellow-400":"bg-black/30 hover:bg-yellow-900/40"),whileHover:{scale:1.05},whileTap:{scale:.95},children:(0,r.jsx)("img",{src:j,alt:"Wand",className:"w-10 h-10 object-contain",style:{filter:"drop-shadow(0 2px 4px rgba(0,0,0,0.5))"}})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-2",children:[(0,r.jsx)(m.Z,{className:"w-4 h-4",style:{color:"#8F5D06FF"}}),(0,r.jsx)("span",{className:"font-crimson text-xs",style:{color:"#8F5D06FF"},children:"Speed"}),(0,r.jsx)("div",{className:"w-20",children:(0,r.jsx)(o,{value:[R],onValueChange:e=>{let[t]=e;return q(t)},min:2,max:12,step:1,className:"cursor-pointer"})}),(0,r.jsxs)("span",{className:"font-crimson text-xs",style:{color:"#8F5D06FF"},children:[Math.round(7*R)," WPM"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,r.jsx)("span",{className:"font-crimson text-xs",style:{color:"#8F5D06FF"},children:"Size"}),(0,r.jsx)("div",{className:"flex gap-0.5",children:Object.entries(F).map(e=>{let[t,{label:a}]=e;return(0,r.jsx)("button",{onClick:()=>{I(t),setTimeout(()=>{var e;return null===(e=eu.current)||void 0===e?void 0:e.focus()},50)},className:"px-1.5 py-0.5 text-xs font-crimson rounded transition-all ".concat(z===t?"bg-amber-900/60 ring-1 ring-amber-400":"bg-black/20 hover:bg-amber-900/40"),style:{color:"#151615E3"},children:a},t)})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,r.jsx)(d.Z,{className:"w-4 h-4",style:{color:"#8F5D06FF"}}),(0,r.jsx)("select",{value:B,onChange:e=>{H(e.target.value),setTimeout(()=>{var e;return null===(e=eu.current)||void 0===e?void 0:e.focus()},50)},className:"bg-black/20 hover:bg-amber-900/40 text-xs font-crimson rounded px-1.5 py-0.5 cursor-pointer border-none outline-none focus:ring-1 focus:ring-amber-400",style:{color:"#151615E3"},children:Object.entries(N).map(e=>{let[t,{label:a}]=e;return(0,r.jsx)("option",{value:t,className:"bg-amber-100 text-amber-900",children:a},t)})})]})]}),(0,r.jsxs)(n.E.a,{href:"/support",className:"flex items-center gap-1.5 px-2 sm:px-3 py-1.5 rounded-full font-harry text-xs sm:text-sm",style:{background:"linear-gradient(135deg, #5c3d2e 0%, #3d2516 100%)",border:"1px solid #8b6914",color:"#fff"},whileHover:{scale:1.05,background:"linear-gradient(135deg, #6b4a3a 0%, #4a2e1c 100%)"},whileTap:{scale:.95},children:[(0,r.jsxs)("svg",{className:"w-3 h-3 sm:w-4 sm:h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,r.jsx)("path",{d:"M2 7h20v10H2V7zm2 2v6h16V9H4zm3 1h2v4H7v-4zm3 0h2v4h-2v-4zm3 0h2v4h-2v-4zm3 0h2v4h-2v-4z"}),(0,r.jsx)("path",{d:"M6 5h12v2H6V5zm0 12h12v2H6v-2z"})]}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"GPU Patronus Fund"}),(0,r.jsx)("span",{className:"sm:hidden",children:"GPU Patronus Fund"}),(0,r.jsx)(m.Z,{className:"w-3 h-3"})]})]}),(0,r.jsxs)(n.E.div,{className:"text-center",initial:{opacity:0,y:-10},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1},children:[(0,r.jsx)("h1",{className:"font-harry text-2xl sm:text-4xl md:text-5xl tracking-wider",style:{color:"#8F5D06FF"},children:"The Musical Quill"}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 sm:gap-3 mt-1 flex-wrap",children:[(0,r.jsx)("p",{className:"font-crimson italic text-xs sm:text-sm md:text-base",style:{color:"#8F5D06FF"},children:"Write your magical letter..."}),!K&&!el&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(n.E.button,{onClick:()=>{a.trim()&&(ei.current=a,en("playing"),T(""),L({x:60,y:60}),ex.current={x:60,y:60},em.current=a.split(""),ew())},disabled:!a.trim(),className:"flex items-center gap-1.5 font-harry text-sm sm:text-base md:text-lg disabled:opacity-40 disabled:cursor-not-allowed ml-1",style:{color:"#8F5D06FF"},whileHover:a.trim()?{scale:1.05}:{},whileTap:a.trim()?{scale:.95}:{},children:["Play",(0,r.jsx)(h.Z,{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"currentColor"})]}),(0,r.jsxs)(n.E.button,{onClick:ev,disabled:!a.trim()||er,className:"flex items-center gap-1.5 font-harry text-sm sm:text-base md:text-lg disabled:opacity-40 disabled:cursor-not-allowed ml-3",style:{color:"#8F5D06FF"},whileHover:a.trim()&&!er?{scale:1.05}:{},whileTap:a.trim()&&!er?{scale:.95}:{},children:[er?"Shortening...":"Save & Share",er?(0,r.jsx)(g.Z,{className:"w-4 h-4 sm:w-5 sm:h-5 animate-spin"}):(0,r.jsx)(p.Z,{className:"w-4 h-4 sm:w-5 sm:h-5"})]}),(0,r.jsxs)(n.E.button,{onClick:()=>{var e;em.current=[],ed.current&&(clearInterval(ed.current),ed.current=null),i(""),T(""),Z(!1),P(500),L({x:60,y:60}),V(-40),ex.current={x:60,y:60},null===(e=eu.current)||void 0===e||e.focus()},className:"flex items-center gap-1.5 font-harry text-sm sm:text-base md:text-lg hover:text-red-400 ml-3",style:{color:"#8F5D06FF"},whileHover:{scale:1.05},whileTap:{scale:.95},children:["Clear",(0,r.jsx)(f.Z,{className:"w-4 h-4 sm:w-5 sm:h-5"})]})]}),!K&&el&&(0,r.jsxs)(n.E.button,{onClick:()=>{em.current=[],ed.current&&(clearInterval(ed.current),ed.current=null),T(ei.current),Z(!1),en(null),requestAnimationFrame(()=>{requestAnimationFrame(()=>{let e=eb();L(e),ex.current=e})})},className:"flex items-center gap-1.5 font-harry text-sm sm:text-base md:text-lg ml-1",style:{color:"#8F5D06FF"},whileHover:{scale:1.05},whileTap:{scale:.95},children:["playing"===el?"Stop":"Back to Edit",(0,r.jsx)(f.Z,{className:"w-4 h-4 sm:w-5 sm:h-5"})]})]}),!K&&(0,r.jsxs)("p",{className:"font-crimson text-xs mt-1",style:{color:a.length>1500?"#ef4444":a.length>1200?"#f59e0b":"#8F5D06AA"},children:[a.length," / 1500",a.length>1500&&" (URL may be too long to share)"]})]}),(0,r.jsxs)(n.E.div,{className:"relative w-full rounded-lg shadow-2xl overflow-visible",style:{minHeight:D,backgroundImage:"url(".concat("/assets/magical-quill/parchment.jpg",")"),backgroundSize:"cover",backgroundPosition:"center"},initial:{opacity:0,scale:.95}
1,animate:{opacity:1,scale:1},transition:{duration:.6,delay:.3},children:[(0,r.jsxs)("div",{ref:ec,className:"relative w-full p-4 sm:p-8 md:p-12 cursor-text overflow-visible",style:{minHeight:D},onClick:()=>{var e;return null===(e=eu.current)||void 0===e?void 0:e.focus()},children:[(0,r.jsxs)("div",{ref:eo,className:"font-harry ".concat(F[z].classes," whitespace-pre-wrap break-words min-h-[3em]"),style:{color:k,lineHeight:"1",letterSpacing:"0.05em"},children:[c.split("").map((e,t)=>"\n"===e?(0,r.jsx)("br",{className:"magic-char"},"char-".concat(t)):(0,r.jsx)(n.E.span,{initial:{opacity:0,scale:.3},animate:{opacity:1,scale:1},transition:{duration:.1,ease:"easeOut"},className:"magic-char inline-block cursor-text",style:{textShadow:"0 1px 2px rgba(0,0,0,0.1)"},onClick:e=>{e.stopPropagation(),ef(t)},children:" "===e?"\xa0":e},"char-".concat(t))),0===c.length&&!M&&(0,r.jsx)("span",{className:"font-harry ".concat(F[z].classes," italic opacity-40"),style:{color:k},children:"Begin your magical letter..."})]}),"quill"===A&&U&&(0,r.jsx)(n.E.img,{src:v,alt:"Quill",className:"w-16 h-16 sm:w-20 sm:h-20 md:w-[100px] md:h-[100px]",initial:{left:_.x+C.x,top:_.y+C.y,rotate:Q},animate:{left:_.x+C.x,top:_.y+C.y,rotate:G?[Q,Q-8,Q]:[Q-2,Q+2],y:G?[0,6,0]:[0,-12,0],x:G?[0,2,0]:0},transition:{left:{type:"tween",duration:.08,ease:"easeOut"},top:{type:"tween",duration:.08,ease:"easeOut"},rotate:{duration:G?.15:1.5,ease:"easeInOut",repeat:G?0:1/0,repeatType:"reverse"},y:{duration:G?.15:1.8,ease:"easeInOut",repeat:G?0:1/0,repeatType:"reverse"},x:{duration:.15,ease:"easeInOut"}},style:{position:"absolute",transformOrigin:C.transformOrigin,filter:"drop-shadow(2px 3px 4px rgba(0,0,0,0.3))",zIndex:9998,pointerEvents:"none"}}),"wand"===A&&U&&(0,r.jsx)(n.E.img,{src:j,alt:"Wand",className:"w-16 h-16 sm:w-20 sm:h-20 md:w-[100px] md:h-[100px]",initial:{left:_.x+E.x,top:_.y+E.y,rotate:Q+20},animate:{left:_.x+E.x,top:_.y+E.y,rotate:G?[Q+10,Q+30,Q+20]:[Q+18,Q+22],y:G?[0,4,0]:[0,-10,0],x:G?[0,1,0]:0},transition:{left:{type:"tween",duration:.08,ease:"easeOut"},top:{type:"tween",duration:.08,ease:"easeOut"},rotate:{duration:G?.12:1.5,ease:"easeInOut",repeat:G?0:1/0,repeatType:"reverse"},y:{duration:G?.12:2,ease:"easeInOut",repeat:G?0:1/0,repeatType:"reverse"},x:{duration:.12,ease:"easeInOut"}},style:{position:"absolute",transformOrigin:E.transformOrigin,filter:"drop-shadow(2px 3px 4px rgba(0,0,0,0.3))",zIndex:9998,pointerEvents:"none"}}),G&&(0,r.jsx)(n.E.div,{initial:{scale:0,opacity:.8},animate:{scale:[0,1.5,0],opacity:[.8,.4,0]},transition:{duration:.15},style:{position:"absolute",left:_.x-3,top:_.y-3,width:6,height:6,backgroundColor:k,borderRadius:"50%",zIndex:9997,pointerEvents:"none"}})]}),!K&&!el&&(0,r.jsx)("textarea",{ref:eu,className:"absolute inset-0 opacity-0 cursor-text resize-none z-20",value:a,onChange:e=>{let t=e.target.value;i(t);let a=c.length+em.current.length;if(t.length>a){let e=t.slice(a);em.current.push(...e.split("")),ew()}else if(t.length<c.length)em.current=[],ed.current&&(clearInterval(ed.current),ed.current=null),T(t),Z(!1),requestAnimationFrame(()=>{L(eb())});else if(t.length<a){let e=a-t.length;em.current.splice(-e,e)}},onKeyUp:e=>{if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=e.target.selectionStart;t>0&&t<=c.length?requestAnimationFrame(()=>{let e=ep(t-1);L(e),ex.current=e}):0===t&&(L({x:32,y:40}),ex.current={x:32,y:40})}},onSelect:e=>{if(!M){let t=e.target.selectionStart;t>0&&t<=c.length?requestAnimationFrame(()=>{let e=ep(t-1);L(e),ex.current=e}):0===t&&(L({x:32,y:40}),ex.current={x:32,y:40})}},autoFocus:!0,placeholder:"Start typing..."}),(0,r.jsx)(l.M,{children:K&&"waiting"===X&&(0,r.jsx)(n.E.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 z-30 flex flex-col items-center justify-center",style:{background:"rgba(26, 15, 10, 0.85)",backdropFilter:"blur(4px)"},children:(0,r.jsxs)(n.E.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{delay:.2,type:"spring"},className:"text-center",children:[(0,r.jsx)("p",{className:"font-harry text-amber-200/80 text-lg sm:text-xl mb-2",children:"Someone sent you a magical letter"}),(0,r.jsxs)(n.E.button,{onClick:()=>{(null==t?void 0:t.t)&&(Y("playing"),T(""),L({x:60,y:60}),ex.current={x:60,y:60},em.current=t.t.split(""),ew())},className:"flex items-center gap-3 mx-auto px-6 py-3 rounded-full font-harry text-xl sm:text-2xl",style:{background:"linear-gradient(135deg, #8F5D06 0%, #6B4A0A 100%)",border:"2px solid #C4972A",color:"#FEF3C7",boxShadow:"0 0 30px rgba(143, 93, 6, 0.5)"},whileHover:{scale:1.05,boxShadow:"0 0 40px rgba(143, 93, 6, 0.7)"},whileTap:{scale:.95},children:[(0,r.jsx)(h.Z,{className:"w-6 h-6",fill:"currentColor"}),"Watch the Magic"]})]})})}),(0,r.jsx)(l.M,{children:K&&"finished"===X&&(0,r.jsx)(n.E.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"absolute bottom-0 left-0 right-0 z-30 flex flex-col items-center gap-3 p-4 sm:p-6",style:{background:"linear-gradient(to top, rgba(26, 15, 10, 0.95), transparent)"},children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[(0,r.jsxs)(n.E.button,{onClick:()=>{em.current=[],ed.current&&(clearInterval(ed.current),ed.current=null),T(""),Z(!1),P(500),L({x:60,y:60}),V(-40),ex.current={x:60,y:60},Y("waiting")},className:"flex items-center gap-2 px-4 py-2 rounded-full font-harry text-sm sm:text-base",style:{background:"linear-gradient(135deg, #8F5D06 0%, #6B4A0A 100%)",border:"1px solid #C4972A",color:"#FEF3C7"},whileHover:{scale:1.05},whileTap:{scale:.95},children:[(0,r.jsx)(b.Z,{className:"w-4 h-4"}),"Replay"]}),(0,r.jsxs)(n.E.a,{href:"/magical-quill",className:"flex items-center gap-2 px-4 py-2 rounded-full font-harry text-sm sm:text-base",style:{background:"rgba(255, 255, 255, 0.1)",border:"1px solid #C4972A",color:"#FEF3C7"},whileHover:{scale:1.05},whileTap:{scale:.95},children:[(0,r.jsx)(y.Z,{className:"w-4 h-4"}),"Create Your Own"]})]})})})]}),(0,r.jsxs)(n.E.div,{className:"flex flex-col items-center gap-3 pb-6 sm:pb-8",initial:{opacity:0}
1,animate:{opacity:1},transition:{delay:.6,duration:.5},children:[(0,r.jsx)("p",{className:"font-harry text-base sm:text-lg md:text-xl tracking-wider",style:{color:"#875117FF"},children:"The Magic Quill of Hogwarts"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-10 sm:w-16 h-0.5 rounded-full",style:{background:"linear-gradient(to right, transparent, #875117FF)"}}),(0,r.jsx)(m.Z,{className:"w-3 h-3 sm:w-4 sm:h-4",style:{color:"#875117FF"}}),(0,r.jsx)("div",{className:"w-10 sm:w-16 h-0.5 rounded-full",style:{background:"linear-gradient(to left, transparent, #875117FF)"}})]})]})]})]})}var A=T},6474:function(e,t,a){a.d(t,{cn:function(){return l}});var r=a(1994),s=a(3335);function l(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,s.m6)((0,r.W)(t))}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.