{"version":3,"file":"PreferredSourceButton.CmtsjA9B.mjs","names":[],"sources":["https:/framerusercontent.com/modules/oqHZK4y1nIkqvPFq0Cmz/eBgshnL0dJHD5ShQGJUq/PreferredSourceButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect}from\"react\";// Google's publisher script. It scans the page for elements tagged with\n// [google-add-preferred-source-btn] and renders the official button into a\n// shadow root on each one, marking it data-initialized=\"true\".\n// https://developers.google.com/search/docs/appearance/preferred-sources\nconst SCRIPT_SRC=\"https://news.google.com/swg/js/v1/publisher.js\";/**\n * Google Preferred Source\n *\n * Renders Google's official \"Add to Preferred Sources\" button, which lets\n * readers pick coclimbing.com as a preferred source in Google Search.\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 40\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function PreferredSourceButton(props){const{theme,lang,align,style}=props;const target=RenderTarget.current();const isStatic=target===RenderTarget.canvas||target===RenderTarget.thumbnail||target===RenderTarget.export;useEffect(()=>{if(isStatic)return;if(typeof window===\"undefined\"||typeof document===\"undefined\")return;// Load the script once per page load.\nif(!document.querySelector('script[src=\"'+SCRIPT_SRC+'\"]')){const script=document.createElement(\"script\");script.async=true;script.src=SCRIPT_SRC;document.head.appendChild(script);}// Google only scans for buttons when the script first runs, so a button\n// mounted later — after Framer's client-side navigation — would never\n// render. Pushing to the callback queue on every mount re-runs the scan.\n// Buttons already marked data-initialized are skipped, so this is safe\n// to call repeatedly.\nconst w=window;w.PREFERRED_SOURCE=w.PREFERRED_SOURCE||[];w.PREFERRED_SOURCE.push(preferredSource=>{preferredSource.init();});},[isStatic,theme,lang]);const wrapper={...style,position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:align,minWidth:\"max-content\",minHeight:40};// The canvas has no Google script, so stand in a same-sized pill to lay out against.\nif(isStatic){const isDark=theme===\"dark\";return /*#__PURE__*/_jsx(\"div\",{style:wrapper,children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"inline-flex\",alignItems:\"center\",gap:10,height:40,minWidth:140,padding:\"0 16px\",borderRadius:20,boxSizing:\"border-box\",background:isDark?\"#131314\":\"#ffffff\",border:\"1px solid \"+(isDark?\"#8e918f\":\"#747775\"),color:isDark?\"#e3e3e3\":\"#1f1f1f\",fontFamily:\"Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",fontSize:14,lineHeight:\"normal\",whiteSpace:\"nowrap\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{width:18,height:18,borderRadius:\"50%\",flexShrink:0,background:\"conic-gradient(#ea4335 0deg 90deg, #fbbc04 90deg 180deg, #34a853 180deg 270deg, #4285f4 270deg 360deg)\"}}),\"Add to Preferred Sources\"]})});}// Dashed attributes are passed through a spread so TypeScript stays happy.\nconst attrs={\"google-add-preferred-source-btn\":\"\",\"data-theme\":theme};if(lang)attrs[\"data-lang\"]=lang;return /*#__PURE__*/_jsx(\"div\",{style:wrapper,children:/*#__PURE__*/_jsx(\"div\",{...attrs})});}addPropertyControls(PreferredSourceButton,{theme:{type:ControlType.Enum,title:\"Theme\",defaultValue:\"light\",options:[\"light\",\"dark\"],optionTitles:[\"Light\",\"Dark\"],displaySegmentedControl:true},lang:{type:ControlType.String,title:\"Language\",defaultValue:\"\",placeholder:\"Auto\",description:\"Leave blank to match the reader's language.\"},align:{type:ControlType.Enum,title:\"Align\",defaultValue:\"flex-start\",options:[\"flex-start\",\"center\",\"flex-end\"],optionTitles:[\"Left\",\"Center\",\"Right\"],displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PreferredSourceButton\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"40\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicWidth\":\"200\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