{"version":3,"file":"ScrawlLine.CgJFpFoe.mjs","names":["useState","useMemo","__esmMin","pe","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","p","c","init_jsx_runtime","ce","init_framer_DcGZRLrs","ControlType","addPropertyControls","seeded","x","n","scrawl","last","s","seed","words","word","flush","key","text","ch","i","lower","pool","HAND","f","font","ScrawlLine","props","name","setName","saved","storeAs","withName","withoutName","letters","fontSize","fontImport","init_ScrawlLine"],"sources":["https:/framerusercontent.com/modules/7OUy0Fi8m4gf6xNo5Xjj/m0XXu5UoaqTy8ElJTw96/ScrawlLine.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useMemo,useState}from\"react\";const fontImport=`\n@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400..700&family=Indie+Flower&family=Nothing+You+Could+Do&family=Reenie+Beanie&family=Shadows+Into+Light&display=swap');\n`;const HAND=[\"Caveat\",\"Indie Flower\",\"Nothing You Could Do\",\"Reenie Beanie\",\"Shadows Into Light\"];function seeded(n){const x=Math.sin(n)*1e4;return x-Math.floor(x);}// Every letter picks a different hand, same as the scrawl on the other pages.\n// Letters are grouped into words, so a long line wraps between words on a\n// narrow screen and never runs off the side or splits a word in two.\nfunction scrawl(text,seed){const last={};let s=seed;const words=[];let word=[];const flush=key=>{if(!word.length)return;words.push(/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",whiteSpace:\"nowrap\"},children:word},key));word=[];};Array.from(text).forEach((ch,i)=>{if(ch===\" \"){s++;flush(`w${i}`);words.push(/*#__PURE__*/_jsx(\"span\",{children:\" \"},`s${i}`));return;}const lower=ch.toLowerCase();let pool=HAND;if(lower===\"l\"||lower===\"o\")pool=pool.filter(f=>f!==\"Nothing You Could Do\");if(last[lower])pool=pool.filter(f=>f!==last[lower]);const font=pool[Math.floor(seeded(s)*pool.length)]||HAND[0];last[lower]=font;s++;word.push(/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:`\"${font}\", cursive`},children:ch},i));});flush(\"end\");return words;}/**\n * Scrawl Line\n * A handwritten line that uses the name the visitor wrote on the sticker\n * page. Put {name} where the name goes. If there is no name, it shows the\n * second line.\n *\n * @framerIntrinsicWidth 620\n * @framerIntrinsicHeight 80\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function ScrawlLine(props){const{withName,withoutName,storeAs,fontSize,color,seed}=props;const[name,setName]=useState(\"\");useEffect(()=>{try{const saved=window.sessionStorage.getItem(storeAs||\"irli_name\");if(saved)setName(saved);}catch(e){// Storage can be blocked. The plain line shows.\n}},[storeAs]);const text=name.trim()?withName.replace(/\\{name\\}/g,name.trim()):withoutName;const letters=useMemo(()=>scrawl(text,seed),[text,seed]);return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,width:\"100%\",color,fontSize:`clamp(${Math.round(fontSize*.6)}px, 7vw, ${fontSize}px)`,lineHeight:1.15,textAlign:\"center\"},children:[/*#__PURE__*/_jsx(\"style\",{children:fontImport}),letters]});}addPropertyControls(ScrawlLine,{withName:{type:ControlType.String,title:\"With a name\",defaultValue:\"Put it in writing, {name}.\"},withoutName:{type:ControlType.String,title:\"No name\",defaultValue:\"Put it in writing.\"},storeAs:{type:ControlType.String,title:\"Read name from\",defaultValue:\"irli_name\"},fontSize:{type:ControlType.Number,title:\"Size\",defaultValue:60,min:20,max:120,step:1},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"rgb(23, 20, 15)\"},seed:{type:ControlType.Number,title:\"Pattern\",defaultValue:23,min:1,max:1e3,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrawlLine\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicWidth\":\"620\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"80\"}},\"__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