{"version":3,"file":"NoSpaceInForm.fMuD18f0.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/qeMA0yaKc1TMS4Eiqjfy/UP0OqZ4S4fgTldRxpexN/NoSpaceInForm.js"],"sourcesContent":["// NoSpacesOverride.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";/**\n * Apply this to an <input> or a Framer text field that forwards\n * DOM input events (onKeyDown/onBeforeInput/onPaste/onChange).\n *\n * Blocks spaces from typing and pasting, including non-breaking spaces\n * and other Unicode whitespace.\n */export function NoSpaces(){const blockIfWhitespace=text=>!!text&&/\\s/.test(text);return{// Prevent pressing the spacebar\nonKeyDown:e=>{if(e.key===\" \"){e.preventDefault();}},// Blocks inline text insertions (incl. some IME inputs)\nonBeforeInput:e=>{if(blockIfWhitespace(e.data)){e.preventDefault();}},// Scrub whitespace from pasted text\nonPaste:e=>{const data=e.clipboardData?.getData(\"text\")??\"\";if(blockIfWhitespace(data)){e.preventDefault();const input=e.target;const start=input.selectionStart??input.value.length;const end=input.selectionEnd??input.value.length;const cleaned=data.replace(/\\s+/g,\"\");// Replace the selection with the cleaned text\nconst next=input.value.slice(0,start)+cleaned+input.value.slice(end);// Update the input's value and notify React/Framer\ninput.value=next;input.setSelectionRange(start+cleaned.length,start+cleaned.length);input.dispatchEvent(new Event(\"input\",{bubbles:true}));}},// Final guard: strip any whitespace that somehow made it in\nonChange:e=>{const input=e.target;if(blockIfWhitespace(input.value)){const caret=input.selectionStart??input.value.length;const beforeLen=input.value.length;input.value=input.value.replace(/\\s+/g,\"\");const delta=beforeLen-input.value.length;const newCaret=Math.max(0,caret-delta);input.setSelectionRange(newCaret,newCaret);// Ensure React/Framer sees the value change\ninput.dispatchEvent(new Event(\"input\",{bubbles:true}));}}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withNoSpaces(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...NoSpaces(props)});};}withNoSpaces.displayName=\"NoSpaces\";\nexport const __FramerMetadata__ = {\"exports\":{\"NoSpaces\":{\"type\":\"override\",\"name\":\"NoSpaces\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withNoSpaces\":{\"type\":\"reactHoc\",\"name\":\"withNoSpaces\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NoSpaceInForm.map"],"mappings":"iPAOG,SAAgB,GAAU,CAAC,IAAM,EAAkB,GAAM,CAAC,CAAC,GAAM,KAAK,KAAK,EAAK,CAAC,MAAM,CAC1F,UAAU,GAAG,CAAI,EAAE,MAAM,KAAK,EAAE,gBAAgB,EAChD,cAAc,GAAG,CAAI,EAAkB,EAAE,KAAK,EAAE,EAAE,gBAAgB,EAClE,QAAQ,GAAG,CAAC,IAAM,EAAK,EAAE,eAAe,QAAQ,OAAO,EAAE,GAAG,GAAG,EAAkB,EAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,IAAM,EAAM,EAAE,OAAa,EAAM,EAAM,gBAAgB,EAAM,MAAM,OAAa,EAAI,EAAM,cAAc,EAAM,MAAM,OAAa,EAAQ,EAAK,QAAQ,OAAO,GAAG,CAE3Q,EAAM,MADK,EAAM,MAAM,MAAM,EAAE,EAAM,CAAC,EAAQ,EAAM,MAAM,MAAM,EAAI,CACnD,EAAM,kBAAkB,EAAM,EAAQ,OAAO,EAAM,EAAQ,OAAO,CAAC,EAAM,cAAc,IAAI,MAAM,QAAQ,CAAC,QAAQ,GAAK,CAAC,CAAC,GAC1I,SAAS,GAAG,CAAC,IAAM,EAAM,EAAE,OAAO,GAAG,EAAkB,EAAM,MAAM,CAAC,CAAC,IAAM,EAAM,EAAM,gBAAgB,EAAM,MAAM,OAAa,EAAU,EAAM,MAAM,OAAO,EAAM,MAAM,EAAM,MAAM,QAAQ,OAAO,GAAG,CAAC,IAAM,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