{"version":3,"file":"SaveToSelection.CH_48MyX.mjs","names":["useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","p","ce","addPropertyControls","init_framer_D1IzEvwH","ControlType","saveRequestHandoff","readSelection","v","SEL_KEY","writeSelection","list","SEL_EVENT","useSelection","setList","sync","toggleSelection","i","item","addSelection","withPreviewBase","path","prefixPattern","directPrefix","linkPrefix","node","pathname","prefix","SaveToSelection","props","selection","id","itemId","title","saved","image","mode","message","kind","requestHref","requestLink","CSS","requestLabel","savedLabel","addLabel","INK","PAPER","ALPINE","init_SaveToSelection","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/3yhcNksf090DY5xeNJkj/2TNiazE5ZFxoaaKZSDuR/SaveToSelection.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// One-time prefill handoff to the Experience Request form: this tab's sessionStorage, never the URL.\nfunction saveRequestHandoff(fields){try{sessionStorage.setItem(\"betreat:request-handoff\",JSON.stringify({savedAt:Date.now(),fields}));}catch{// Storage blocked (e.g. some private modes): the link still opens an empty form.\n}}const SEL_KEY=\"betreat.selection.v1\";const SEL_EVENT=\"betreat-selection-change\";function readSelection(){if(typeof window===\"undefined\")return[];try{const v=JSON.parse(window.localStorage.getItem(SEL_KEY)||\"[]\");return Array.isArray(v)?v:[];}catch{return window.__betreatSelection??[];}}function writeSelection(list){if(typeof window===\"undefined\")return;window.__betreatSelection=list;try{window.localStorage.setItem(SEL_KEY,JSON.stringify(list));}catch{}window.dispatchEvent(new Event(SEL_EVENT));}function useSelection(){const[list,setList]=useState([]);useEffect(()=>{const sync=()=>setList(readSelection());sync();window.addEventListener(SEL_EVENT,sync);window.addEventListener(\"storage\",sync);return()=>{window.removeEventListener(SEL_EVENT,sync);window.removeEventListener(\"storage\",sync);};},[]);return list;}function toggleSelection(item){const list=readSelection();writeSelection(list.some(i=>i.id===item.id)?list.filter(i=>i.id!==item.id):[...list,item]);}function addSelection(item){const list=readSelection();if(!list.some(i=>i.id===item.id))writeSelection([...list,item]);}function withPreviewBase(path){if(typeof window===\"undefined\"||!path.startsWith(\"/\")||path.startsWith(\"//\"))return path;const prefixPattern=/^\\/s\\/app\\.[^/]+/;const directPrefix=window.location.pathname.match(prefixPattern)?.[0];if(directPrefix)return`${directPrefix}${path}`;const linkPrefix=Array.from(document.querySelectorAll(\"a[href]\")).map(node=>{try{return new URL(node.href,window.location.href).pathname;}catch{return\"\";}}).map(pathname=>pathname.match(prefixPattern)?.[0]).find(prefix=>Boolean(prefix));return linkPrefix?`${linkPrefix}${path}`:path;}const INK=\"#1B211D\";const PAPER=\"#F4F1EA\";const ALPINE=\"#5F6F63\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function SaveToSelection(props){const{itemId,title=\"Experience\",meta=\"\",image,href=\"\",kind=\"signature\",mode=\"toggle\",requestLink=\"/experiences#my-selection\",addLabel=\"+ Add to selection\",savedLabel=\"✓ In your selection\",requestLabel=\"Add to selection & request\",style}=props;const selection=useSelection();const id=itemId||title;const saved=selection.some(i=>i.id===id);const item={id,title,meta,image:image?.src,href,kind};if(mode===\"request\"){// Carry the experience into the request form once via sessionStorage (not the URL).\nconst message=`I'm interested in ${kind===\"signature\"?\"the Betreat Signature \":\"\"}\"${title}\".`;const requestHref=withPreviewBase(requestLink);return /*#__PURE__*/_jsxs(\"div\",{className:\"sts\",style:style,children:[/*#__PURE__*/_jsx(\"style\",{children:CSS}),/*#__PURE__*/_jsxs(\"a\",{className:\"sts-btn is-solid\",href:requestHref,onClick:()=>{addSelection(item);saveRequestHandoff({experience:title,message});},children:[requestLabel,/*#__PURE__*/_jsx(\"svg\",{width:\"12\",height:\"12\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2.2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M5 12h14M13 6l6 6-6 6\"})})]})]});}return /*#__PURE__*/_jsxs(\"div\",{className:\"sts\",style:style,children:[/*#__PURE__*/_jsx(\"style\",{children:CSS}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",className:`sts-btn${saved?\" is-solid\":\"\"}`,\"aria-pressed\":saved,onClick:()=>toggleSelection(item),children:saved?savedLabel:addLabel}),saved?/*#__PURE__*/_jsxs(\"a\",{className:\"sts-view\",href:requestLink,children:[\"View selection (\",selection.length,\")\"]}):null]});}const CSS=`\n.sts{display:flex;align-items:center;gap:16px;flex-wrap:wrap;font-family:Montserrat,-apple-system,sans-serif;width:max-content;max-width:100%}\n.sts-btn{display:inline-flex;align-items:center;gap:10px;min-height:44px;padding:0 18px;border:1px solid ${INK};background:transparent;color:${INK};font:inherit;font-size:11px;font-weight:600;letter-spacing:1px;text-transform:uppercase;text-decoration:none;cursor:pointer;transition:background .2s ease,color .2s ease;white-space:nowrap}\n.sts-btn:hover{background:rgba(27,33,29,.06)}\n.sts-btn.is-solid{background:${INK};color:${PAPER}}\n.sts-btn.is-solid:hover{background:#2c352f}\n.sts-view{font-size:11px;font-weight:600;letter-spacing:1px;text-transform:uppercase;color:${INK};text-decoration:none;border-bottom:1px solid rgba(27,33,29,.35);padding:12px 0 2px;white-space:nowrap}\n.sts a:focus-visible,.sts button:focus-visible{outline:2px solid ${ALPINE};outline-offset:3px}\n@media (prefers-reduced-motion:reduce){.sts-btn{transition:none}}\n`;addPropertyControls(SaveToSelection,{itemId:{type:ControlType.String,title:\"ID\",defaultValue:\"\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Experience\"},meta:{type:ControlType.String,title:\"Meta\",defaultValue:\"\"},image:{type:ControlType.ResponsiveImage,title:\"Image\"},href:{type:ControlType.Link,title:\"Experience Link\"},kind:{type:ControlType.Enum,title:\"Kind\",options:[\"signature\",\"catalog\"],optionTitles:[\"Signature\",\"Catalog\"],defaultValue:\"signature\"},mode:{type:ControlType.Enum,title:\"Mode\",options:[\"toggle\",\"request\"],optionTitles:[\"Save toggle\",\"Add & go to request\"],defaultValue:\"toggle\",displaySegmentedControl:true},requestLink:{type:ControlType.Link,title:\"Selection Link\",defaultValue:\"/experiences#my-selection\"},addLabel:{type:ControlType.String,title:\"Add Label\",defaultValue:\"+ Add to selection\",hidden:p=>p.mode===\"request\"},savedLabel:{type:ControlType.String,title:\"Saved Label\",defaultValue:\"✓ In your selection\",hidden:p=>p.mode===\"request\"},requestLabel:{type:ControlType.String,title:\"Button Label\",defaultValue:\"Add to selection & request\",hidden:p=>p.mode!==\"request\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SaveToSelection\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SaveToSelection.map"],"mappings":"A,4LACA,SAASW,EAAmB,EAAO,CAAC,GAAG,CAAC,eAAe,QAAQ,0BAA0B,KAAK,UAAU,CAAC,QAAQ,KAAK,IAAI,EAAE,QAAM,CAAC,CAAC,CAAE,MAAM,CAC5I,CAAC,CAAiF,SAASC,GAAe,CAAC,GAAUR,IAAS,OAAY,MAAM,CAAC,EAAE,GAAG,CAAC,IAAMS,EAAE,KAAK,MAAMT,EAAO,aAAa,QAAQU,CAAO,GAAG,IAAI,EAAE,OAAO,MAAM,QAAQD,CAAC,EAAEA,EAAE,CAAC,CAAE,MAAM,CAAC,OAAOT,EAAO,oBAAoB,CAAC,CAAE,CAAC,CAAC,SAASW,EAAe,EAAK,CAAC,GAAUX,IAAS,OAAmB,GAAO,mBAAmBY,EAAK,GAAG,CAACZ,EAAO,aAAa,QAAQU,EAAQ,KAAK,UAAUE,CAAI,CAAC,CAAE,MAAM,CAAC,CAACZ,EAAO,cAAc,IAAI,MAAMa,CAAS,CAAC,CAApH,CAAsH,CAA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