{"version":3,"file":"drag_preventer.CS-Ib_Hw.mjs","names":["useId"],"sources":["https:/framerusercontent.com/modules/mn6XTfhwVtXcd89J069m/eeY4llrkFk2zCUCxTwWW/drag_preventer.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useId}from\"react\";/**\n * @framerDisableUnlink\n */export default function DragPreventer(props){const{preventImages=true,preventLinks=true,preventTextDrag=false,preventTextSelect=false,preventAll=false}=props;// Generate a unique ID per instance so multiple components\n// on the same page don't conflict with each other\nconst uid=useId().replace(/:/g,\"\");const styleId=`drag-preventer-${uid}`;useEffect(()=>{// Remove any previously injected style for this instance\ndocument.getElementById(styleId)?.remove();const rules=[];// Scope all rules to :root so they act page-wide,\n// but are tied to this specific injected <style> tag\n// (removed on unmount), not a global unmanaged block.\n// ── Drag Prevention ───────────────────────────────────\nif(preventAll){rules.push(`\n                :root * {\n                    -webkit-user-drag: none !important;\n                    user-drag: none !important;\n                }\n            `);}else{if(preventImages){rules.push(`\n                    :root img {\n                        -webkit-user-drag: none !important;\n                        user-drag: none !important;\n                    }\n                `);}if(preventLinks){rules.push(`\n                    :root a,\n                    :root button,\n                    :root [role=\"link\"],\n                    :root [role=\"button\"],\n                    :root div[data-framer-link] {\n                        -webkit-user-drag: none !important;\n                        user-drag: none !important;\n                    }\n                `);}if(preventTextDrag){rules.push(`\n                    :root * {\n                        -webkit-user-drag: none !important;\n                        user-drag: none !important;\n                    }\n                `);}}// ── Text Selection Prevention ─────────────────────────\nif(preventTextSelect){rules.push(`\n                :root * {\n                    user-select: none !important;\n                    -webkit-user-select: none !important;\n                }\n                :root input,\n                :root textarea,\n                :root [contenteditable] {\n                    user-select: text !important;\n                    -webkit-user-select: text !important;\n                }\n            `);}if(rules.length===0)return;// Inject a uniquely-identified <style> tag into <head>\n// so it can be precisely removed on unmount or prop change\nconst styleEl=document.createElement(\"style\");styleEl.id=styleId;styleEl.textContent=rules.join(\"\\n\");document.head.appendChild(styleEl);// ── Cleanup on unmount or prop change ─────────────────\nreturn()=>{document.getElementById(styleId)?.remove();};},[preventAll,preventImages,preventLinks,preventTextDrag,preventTextSelect]);// Render nothing visible — this is a behavior-only component\nreturn /*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",width:0,height:0,overflow:\"hidden\",pointerEvents:\"none\"}});}DragPreventer.displayName=\"Drag Preventer\";addPropertyControls(DragPreventer,{preventAll:{title:\"Block All Dragging\",type:ControlType.Boolean,defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\",description:\"Prevents dragging on every element on the page at once.\"},preventImages:{title:\"Block Image Drag\",type:ControlType.Boolean,defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:props=>props.preventAll,description:\"Stops visitors from dragging images off your site into another tab or folder.\"},preventLinks:{title:\"Block Link Drag\",type:ControlType.Boolean,defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:props=>props.preventAll,description:\"Stops visitors from dragging links and buttons into the browser bookmark bar or new tab.\"},preventTextDrag:{title:\"Block Text Drag\",type:ControlType.Boolean,defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:props=>props.preventAll,description:\"Stops visitors from dragging highlighted text. They can still select and copy text normally.\"},preventTextSelect:{title:\"Block Text Select\",type:ControlType.Boolean,defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\",description:\"Stops visitors from highlighting or selecting any text on your site. Works independently from all drag settings above.\\n\\nMade with ❤️ by [Soyeb](https://framer.link/project)\\n*Version:* 1.0.0\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DragPreventer\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./drag_preventer.map"],"mappings":"iLAEG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,gBAAc,GAAK,eAAa,GAAK,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