{"version":3,"file":"Calcom.BLGhWSYK.mjs","names":["useRef","useState","getCalApi","useMemo","Cal"],"sources":["https:/framerusercontent.com/modules/3kSszCA7P49KbVg8UUZO/nufPLKXR3garclcgKNR1/Calcom.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import Cal,{getCalApi}from\"@calcom/embed-react\";import{useEffect,useMemo,useRef,useState}from\"react\";var BookerLayouts;var EmbedTheme;/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n *\n * @framerDisableUnlink\n *\n * @framerIntrinsicHeight 575\n * @framerIntrinsicWidth 1000\n */export default function Calcom(props){const{layout,eventLink,darkTheme,lightTheme,theme,showEventTypeDetails,namespace=\"\"}=props;const apiRef=useRef(null);let search=null;try{search=window.parent.location.search;}catch(err){console.debug(\"error in search: \",err);}const queryParams=new URLSearchParams(search??\"\");const allQueryParams=Object.fromEntries(queryParams.entries());console.log(\"allQueryParams: \",allQueryParams);const isOnCanvas=RenderTarget.current()===RenderTarget.canvas;// Stable namespace (never changes across renders)\nconst namespaceRef=useRef(namespace||`cal-${Math.random().toString(36).slice(2)}`);const resolvedNamespace=namespaceRef.current;const[embedInfo,setEmbedInfo]=useState({origin:\"\",username:\"\",eventTypeSlug:\"\",teamEventTypeSlug:\"\"});const[embedLoaded,setEmbedLoaded]=useState(false);/**\n     * 1) Parse URL & derive embed info\n     */useEffect(()=>{let url;try{let normalized=eventLink?.trim()||\"\";if(!/^https?:\\/\\//i.test(normalized)){normalized=\"https://\"+normalized;}url=new URL(normalized);}catch(err){console.error(`Incorrect URL: ${eventLink}`,err);return;}const[username,eventTypeSlug=\"\",teamEventTypeSlug=\"\"]=url.pathname.slice(1).split(\"/\");if(!username){console.error(\"URL must include at least a username.\");return;}setEmbedInfo({origin:url.origin,username,eventTypeSlug,teamEventTypeSlug});},[eventLink]);useEffect(()=>{const handleLinkReady=e=>{setEmbedLoaded(true);};(async()=>{if(embedLoaded)return;apiRef.current=await getCalApi({namespace:resolvedNamespace});apiRef.current(\"on\",{action:\"linkReady\",callback:handleLinkReady});})();return()=>{if(!apiRef.current)return;apiRef.current(\"off\",{action:\"linkReady\",callback:handleLinkReady});};},[resolvedNamespace,embedLoaded]);useEffect(()=>{(async()=>{if(!embedLoaded||!apiRef.current)return;apiRef.current(\"ui\",{cssVarsPerTheme:{light:{\"cal-brand\":lightTheme},dark:{\"cal-brand\":darkTheme}},hideEventTypeDetails:!showEventTypeDetails,layout,theme});})();},[embedLoaded,lightTheme,darkTheme,showEventTypeDetails,layout,theme,resolvedNamespace]);/**\n     * Build calLink safely\n     */const calLink=useMemo(()=>{if(!embedInfo.username)return\"\";let link=`${embedInfo.username}/${embedInfo.eventTypeSlug}`;if(embedInfo.teamEventTypeSlug){link+=`/${embedInfo.teamEventTypeSlug}`;}return link;},[embedInfo]);if(!calLink)return null;return /*#__PURE__*/_jsx(Cal,{namespace:resolvedNamespace,calLink:calLink,calOrigin:embedInfo.origin,style:isOnCanvas?{height:\"100%\",overflow:\"clip\"}:{width:\"100%\",height:\"100%\",overflow:\"scroll\"},config:{layout,theme,...allQueryParams}},`${eventLink}-${resolvedNamespace}`);}addPropertyControls(Calcom,{eventLink:{title:\"Event Link\",type:ControlType.String,defaultValue:\"https://cal.com/framer-placeholder/default\"},theme:{type:ControlType.Enum,options:[\"auto\",\"light\",\"dark\"],optionTitles:[\"Auto\",\"Light\",\"Dark\"],defaultValue:\"auto\"},lightTheme:{type:ControlType.Color,defaultValue:\"#292929\",title:\"Light Color\"},darkTheme:{type:ControlType.Color,defaultValue:\"#fafafa\",title:\"Dark Color\"},showEventTypeDetails:{type:ControlType.Enum,title:\"Event Info\",defaultValue:true,displaySegmentedControl:true,segmentedControlDirection:\"horizontal\",options:[true,false],optionTitles:[\"Show\",\"Hide\"]},layout:{type:ControlType.Enum,options:[\"month_view\",\"column_view\",\"week_view\"],optionTitles:[\"Month View\",\"Column View\",\"Week View\"],defaultValue:\"month_view\"}});Calcom.displayName=\"Cal.com\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Calcom\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"575\",\"framerIntrinsicWidth\":\"1000\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Calcom.map"],"mappings":"6QAQG,SAAwB,EAAO,EAAM,CAAC,GAAK,CAAC,SAAO,YAAU,YAAU,aAAW,QAAM,uBAAqB,YAAU,IAAI,EAAY,EAAOA,EAAO,IAAI,EAAM,EAAO,KAAK,GAAG,CAAC,EAAO,EAAO,OAAO,SAAS,MAAO,OAAO,EAAI,CAAC,QAAQ,MAAM,oBAAoB,CAAG,CAAE,CAAC,IAAM,EAAY,IAAI,gBAAgB,GAAQ,EAAE,EAAQ,EAAe,OAAO,YAAY,EAAY,QAAQ,CAAC,EAAE,QAAQ,IAAI,mBAAmB,CAAc,EAAE,IAAM,EAAW,EAAa,QAAQ,IAAI,EAAa,OACzY,EAAtEA,EAAO,GAAW,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,GAAwC,CAAC,CAAC,QAAa,CAAC,EAAU,GAAcC,EAAS,CAAC,OAAO,GAAG,SAAS,GAAG,cAAc,GAAG,kBAAkB,EAAE,CAAC,EAAO,CAAC,EAAY,GAAgBA,EAAS,EAAK,EAE/Q,MAAc,CAAC,IAAI,EAAI,GAAG,CAAC,IAAI,EAAW,GAAW,KAAK,GAAG,GAAO,gBAAgB,KAAK,CAAU,IAAG,EAAW,WAAW,GAAY,EAAI,IAAI,IAAI,CAAU,CAAE,OAAO,EAAI,CAAC,QAAQ,MAAM,kBAAkB,IAAY,CAAG,EAAE,MAAO,CAAC,GAAK,CAAC,EAAS,EAAc,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