{"version":3,"file":"ToolsTableScrollHint.mMrX8JCo.mjs","names":["useRef","useMemo","useCallback","__esmMin","init_npm_react_18_3_1","pe","window","init_ssg_sandbox_shims","ce","init_jsx_runtime","ne","de","init_framer_B6PCHH0A","addPropertyControls","ControlType","ToolsTableScrollHint","props","rootRef","safeTargetName","trimmedName","targetName","targetSelector","injectedCSS","enabled","breakpoint","fadeWidth","updateScrollEnd","isAtEnd","element","scopeElement","elements","cleanupCallbacks","resizeObserver","entries","entry","onScroll","onWindowResize","cleanup","style","init_ToolsTableScrollHint"],"sources":["https:/framerusercontent.com/modules/1MMq3bqmxIuUtDcHgrZ1/dNzeXp901drjRq2Ipnay/ToolsTableScrollHint.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useCallback,useEffect,useMemo,useRef}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ToolsTableScrollHint(props){const{enabled=true,breakpoint=809.98,fadeWidth=32,targetName=\"ToolsComparisonScroll\",style}=props;const rootRef=useRef(null);const safeTargetName=useMemo(()=>{const fallback=\"ToolsComparisonScroll\";const trimmedName=targetName.trim();const isAllowed=/^[A-Za-z0-9 _-]+$/.test(trimmedName);return isAllowed&&trimmedName.length>0?trimmedName:fallback;},[targetName]);const targetSelector=useMemo(()=>{return`[data-framer-name=\"${safeTargetName}\"]`;},[safeTargetName]);const injectedCSS=useMemo(()=>{if(!enabled)return\"\";return`\n@media (max-width: ${breakpoint}px) {\n  ${targetSelector} {\n    overflow-x: auto !important;\n    overflow-y: hidden !important;\n    touch-action: auto;\n    min-width: 0;\n  }\n\n  ${targetSelector}:not([data-scroll-end=true]) {\n    mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - ${fadeWidth}px), transparent 100%);\n    -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - ${fadeWidth}px), transparent 100%);\n  }\n\n  ${targetSelector}[data-scroll-end=true] {\n    mask-image: none;\n    -webkit-mask-image: none;\n  }\n}\n`;},[enabled,breakpoint,fadeWidth,targetSelector]);const updateScrollEnd=useCallback(element=>{const remaining=element.scrollWidth-element.clientWidth-element.scrollLeft;const isAtEnd=remaining<=2;element.setAttribute(\"data-scroll-end\",isAtEnd?\"true\":\"false\");},[]);useEffect(()=>{if(!enabled)return;if(typeof window===\"undefined\"||typeof document===\"undefined\")return;const scopeElement=rootRef.current?.closest(\"[data-framer-page]\")??document;const elements=Array.from(scopeElement.querySelectorAll(targetSelector));const cleanupCallbacks=[];const resizeObserver=new ResizeObserver(entries=>{entries.forEach(entry=>{if(entry.target instanceof HTMLElement){updateScrollEnd(entry.target);}});});elements.forEach(element=>{updateScrollEnd(element);const onScroll=()=>{updateScrollEnd(element);};element.addEventListener(\"scroll\",onScroll,{passive:true});resizeObserver.observe(element);cleanupCallbacks.push(()=>{element.removeEventListener(\"scroll\",onScroll);resizeObserver.unobserve(element);element.removeAttribute(\"data-scroll-end\");});});const onWindowResize=()=>{elements.forEach(element=>updateScrollEnd(element));};window.addEventListener(\"resize\",onWindowResize,{passive:true});return()=>{window.removeEventListener(\"resize\",onWindowResize);cleanupCallbacks.forEach(cleanup=>cleanup());resizeObserver.disconnect();};},[enabled,targetSelector,updateScrollEnd]);return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,\"aria-hidden\":\"true\",style:{position:\"relative\",width:0,height:0,overflow:\"hidden\",pointerEvents:\"none\",...style},children:enabled?/*#__PURE__*/_jsx(\"style\",{children:injectedCSS}):null});}addPropertyControls(ToolsTableScrollHint,{enabled:{type:ControlType.Boolean,title:\"Enabled\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},breakpoint:{type:ControlType.Number,title:\"Max Width\",defaultValue:809.98,min:320,max:1440,step:.01,unit:\"px\"},fadeWidth:{type:ControlType.Number,title:\"Fade\",defaultValue:32,min:0,max:160,step:1,unit:\"px\"},targetName:{type:ControlType.String,title:\"Target Name\",defaultValue:\"ToolsComparisonScroll\",placeholder:\"ToolsComparisonScroll\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ToolsTableScrollHint\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ToolsTableScrollHint.map"],"mappings":"A,6MAGG,SAAwBe,EAAqB,EAAM,CAAC,GAAK,CAAC,UAAQ,GAAK,aAAW,OAAO,YAAU,GAAG,aAAW,wBAAwB,SAAOC,EAAYC,EAAQjB,EAAO,IAAI,EAAQkB,EAAejB,MAAY,CAAC,IAA6CkB,EAAYC,EAAW,KAAK,EAAwD,MAAtC,oBAAoB,KAAKD,CAA4B,GAAGA,EAAY,OAAO,EAAEA,EAAY,uBAAS,EAAE,CAACC,CAAU,CAAC,EAAQC,EAAepB,MAAmB,sBAAsBiB,EAAe,IAAM,CAACA,CAAc,CAAC,EAAQI,EAAYrB,MAAiBsB,EAAuB;qBAC7iBC,EAAW;IAC5BH,EAAe;;;;;;;IAOfA,EAAe;sEACmDI,EAAU;8EACFA,EAAU;;;IAGpFJ,EAAe;;;;;EAdsiB,GAmBrjB,CAACE,EAAQC,EAAWC,EAAUJ,CAAc,CAAC,EAAQK,EAAgBxB,EAAY,GAAS,CAA4E,IAAMyB,EAAjEC,EAAQ,YAAYA,EAAQ,YAAYA,EAAQ,YAAoC,EAAEA,EAAQ,aAAa,kBAAkBD,EAAQ,OAAO,OAAO,CAAE,EAAE,CAAC,CAAC,EAAglC,OAA9kCnB,MAAc,CAAoB,GAAhB,CAACe,GAAyBjB,IAAS,QAAa,OAAO,SAAW,IAAY,OAAO,IAAMuB,EAAaZ,EAAQ,SAAS,QAAQ,oBAAoB,GAAG,SAAea,EAAS,MAAM,KAAKD,EAAa,iBAAiBR,CAAc,CAAC,EAAQU,EAAiB,CAAC,EAAQC,EAAe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