{"version":3,"file":"AddToCalendar.dugkp5iO.mjs","names":["_jsx","__esmMin","init_ssg_sandbox_shims","window","navigator","init_jsx_runtime","c","withAddEventToCalendar","Component","props","style","rest","eventName","eventDescription","eventLocation","startDate","endDate","generateGoogleCalendarUrl","generateAppleCalendarUrl","now","addToIOSCalendar","icsFile","anchor","response","blob","blobUrl","handleClick","userAgent","isIOS","isMac","init_AddToCalendar"],"sources":["https:/framerusercontent.com/modules/NDwELLPhXaHji3OBGPyW/bGecM3r7IqCSU6xCi5Wh/AddToCalendar.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";export function withAddEventToCalendar(Component){return props=>{const{style,...rest}=props;const eventName=\"Taking Octoparty to 30,000 feet\";const eventDescription=\"Your flight to ICE Barcelona\";const eventLocation=\"Malta International Airport\";// Define dates in Malta time (UTC+2)\nconst startDate=\"20250119T130000\"// 13:00 PM Malta time\n;const endDate=\"20250119T150000\"// 15:00 PM Barcelona time next day\n;const timeZone=\"Europe/Malta\";const generateGoogleCalendarUrl=()=>{const baseUrl=\"https://calendar.google.com/calendar/r/eventedit\";const params=new URLSearchParams({text:eventName,details:eventDescription,location:eventLocation,dates:`${startDate}/${endDate}`,ctz:timeZone});return`${baseUrl}?${params.toString()}`;};const generateAppleCalendarUrl=()=>{// Get current timestamp in correct format\nconst now=new Date().toISOString().replace(/[-:]/g,\"\").split(\".\")[0]+\"Z\";// Create Apple Calendar URL with explicit time zone\nconst baseUrl=\"data:text/calendar;charset=utf8,\";const calendarContent=encodeURIComponent(`BEGIN:VCALENDAR\nPRODID:-//Your Company//Your App//EN\nVERSION:2.0\nCALSCALE:GREGORIAN\nMETHOD:PUBLISH\nBEGIN:VEVENT\nUID:${new Date().getTime()}@yourdomain.com\nDTSTAMP:${now}\nDTSTART;TZID=Europe/Malta:${startDate}\nDTEND;TZID=Europe/Malta:${endDate}\nSUMMARY:${eventName}\nDESCRIPTION:${eventDescription}\nLOCATION:${eventLocation}\nSTATUS:CONFIRMED\nSEQUENCE:0\nBEGIN:VTIMEZONE\nTZID:Europe/Malta\nBEGIN:STANDARD\nDTSTART:20241027T020000\nRRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10\nTZOFFSETFROM:+0200\nTZOFFSETTO:+0100\nEND:STANDARD\nBEGIN:DAYLIGHT\nDTSTART:20240331T020000\nRRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3\nTZOFFSETFROM:+0100\nTZOFFSETTO:+0200\nEND:DAYLIGHT\nEND:VTIMEZONE\nEND:VEVENT\nEND:VCALENDAR`);return baseUrl+calendarContent;};const addToIOSCalendar=()=>{const icsFile=generateAppleCalendarUrl();const anchor=document.createElement(\"a\");anchor.href=icsFile;anchor.style.display=\"none\";anchor.setAttribute(\"download\",\"event.ics\");fetch(icsFile).then(response=>response.blob()).then(blob=>{const blobUrl=URL.createObjectURL(blob);anchor.href=blobUrl;document.body.appendChild(anchor);anchor.click();document.body.removeChild(anchor);setTimeout(()=>URL.revokeObjectURL(blobUrl),100);});};const handleClick=()=>{const userAgent=navigator.userAgent.toLowerCase();const isIOS=/iphone|ipad|ipod/.test(userAgent);const isMac=/macintosh/.test(userAgent)&&navigator.maxTouchPoints>0;if(isIOS||isMac){addToIOSCalendar();}else{window.open(generateGoogleCalendarUrl(),\"_blank\");}};return /*#__PURE__*/_jsx(Component,{...rest,style:style,onClick:handleClick});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withAddEventToCalendar\":{\"type\":\"reactHoc\",\"name\":\"withAddEventToCalendar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AddToCalendar.map"],"mappings":"A,yHAA2C,SAAgBO,EAAuBC,EAAU,CAAC,MAAOC,IAAO,CAAC,GAAK,CAACC,QAAM,GAAGC,GAAMF,EAAYG,EAAU,kCAAwCC,EAAiB,+BAAqCC,EAAc,8BAC7PC,EAAU,kBACTC,EAAQ,kBACsBC,MAAsP,oDAAc,IA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