1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[807],{3207:(e,t,l)=>{l.r(t),l.d(t,{default:()=>S});var a=l(7876),r=l(4232),n=l(3193),o=l(87),s=l(367),c=l(5041),i=l(7281),u=l(4288),d=l(7167),h=l(3223),p=l(5504),x=l(1062),m=l(4015),f=l(6572);let b={withName:"Sent to [b]{name}[/b] \uD83E\uDEC2 A hug helps right now. Feeling secure lasts â your [hl]free[/hl] couples challenge â",withoutName:"Sent \uD83E\uDEC2 A hug helps right now. Feeling secure lasts â your [hl]free[/hl] couples challenge â"};function g(e){let{onResolve:t}=e,l=(0,m.rn)("hug-post-share-appcard");return(0,r.useEffect)(()=>{t("v1"===l)},[l,t]),null}function y(e){let{toName:t}=e,l=function(e){let t=(e||"").trim();return t?b.withName.replace("{name}",t.replace(/\[/g,"ï¼»").replace(/\]/g,"ï¼½")):b.withoutName}(t),n=f.b;return(0,a.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",onClick:()=>(0,x.rT)(n,{location:"hug_post_share_card",linkText:l}),className:"block w-full overflow-hidden rounded-[22px] bg-[#0B4F22] px-5 py-4 text-white no-underline shadow-[0_16px_36px_rgba(12,79,34,0.24)]",children:(0,a.jsx)("p",{className:"text-[17px] font-medium leading-snug",children:l.split(/(\[hl\].*?\[\/hl\]|\[b\].*?\[\/b\])/g).filter(Boolean).map((e,t)=>{let l=e.match(/^\[hl\](.*)\[\/hl\]$/);if(l)return(0,a.jsx)("span",{className:"font-semibold text-[#FAFF00]",children:l[1]},t);let n=e.match(/^\[b\](.*)\[\/b\]$/);return n?(0,a.jsx)("span",{className:"font-semibold",children:n[1]},t):(0,a.jsx)(r.Fragment,{children:e},t)})})})}let v="#B23A55",w="flex h-14 w-14 items-center justify-center rounded-full";function j(){for(var e=arguments.length,t=Array(e),l=0;l<e;l++)t[l]=arguments[l];return t.filter(Boolean).join(" ")}function N(e){let{step:t}=e,l=[c.Mbv,c.Mbp,i.mm2];return(0,a.jsxs)("div",{className:"w-full max-w-[420px] px-3",children:[(0,a.jsx)("div",{className:"relative mx-auto h-[12px] w-full rounded-full bg-white/70",children:(0,a.jsx)("div",{className:"h-[10px] rounded-full",style:{width:"".concat(1===t?33:2===t?66:100,"%"),backgroundColor:v}})}),(0,a.jsx)("div",{className:"relative z-10 mt-[-28px] flex items-center justify-between",children:l.map((e,l)=>(0,a.jsx)("div",{className:"grid h-11 w-11 place-items-center rounded-full",style:{backgroundColor:t>=l+1?v:"#FFFFFF"},children:(0,a.jsx)(e,{className:j("text-[18px]",t>=l+1?"text-white":"text-black"),"aria-hidden":"true"})},l))})]})}function k(e){let{label:t,selected:l,onSelect:r}=e;return(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)("p",{className:"mb-2 text-center text-[17px] font-semibold text-black",children:t}),(0,a.jsx)("div",{className:"grid grid-cols-5 gap-2",children:h.ih.map(e=>(0,a.jsx)("button",{type:"button","aria-label":"".concat(t,": ").concat(h.o3[e].name),"aria-pressed":l===e,onClick:()=>r(e),className:j("rounded-2xl border-2 bg-white/70 p-1 transition",l===e?"scale-105 shadow-md":"border-transparent opacity-80"),style:l===e?{borderColor:v}:void 0,children:(0,a.jsx)(d.r,{id:e,className:"h-auto w-full"})},e))})]})}function C(e){let{shareUrl:t,visibleShareUrl:l,toName:c,onBack:i,onReset:u,hasShared:d,onShare:h,showPostShareCard:p,onPostShareCardResolve:f}=e,[b,N]=(0,r.useState)(!1),k=(0,r.useRef)(null),C=(0,m.tL)(),S=e=>{C("hug_share_click",{method:e}),h()},F="undefined"!=typeof navigator&&"function"==typeof navigator.share;(0,r.useEffect)(()=>()=>{k.current&&clearTimeout(k.current)},[]);let O=async()=>{if(t){S("copy_link");try{await navigator.clipboard.writeText(t),N(!0),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>N(!1),2e3)}catch(e){}}},P=async()=>{if(t){S("web_share");try{await navigator.share({title:"A hug for you",url:t})}catch(e){}}};return(0,a.jsxs)("div",{className:"mt-6 flex w-full flex-col items-center gap-5",children:[(0,a.jsxs)("h1",{className:"text-center text-[24px] leading-tight text-black",children:["Send the hug to"," ",(0,a.jsx)("span",{className:"font-semibold",style:{color:v},children:c.trim()||"your person"})," ","by sharing the link"]}),d&&(0,a.jsx)(g,{onResolve:f}),d&&p&&(0,a.jsx)(y,{toName:c}),(0,a.jsxs)("div",{className:"flex items-center justify-center gap-5",children:[F&&(0,a.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:P,"aria-label":"Share via...",className:j(w,"bg-white shadow"),children:(0,a.jsx)(n.B88,{className:"text-[22px]",style:{color:v}})}),(0,a.jsx)("span",{className:"text-[13px] text-black/70",children:"Share"})]}),(0,a.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,a.jsx)("button",{type:"button",onClick:O,"aria-label":"Copy link",className:j(w,"bg-white shadow"),children:(0,a.jsx)(n.ayE,{className:"text-[22px]",style:{color:v}})}),(0,a.jsx)("span",{className:"text-[13px] text-black/70",children:b?"Copied!":"Copy link"})]}),(0,a.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,a.jsx)("a",{href:"sms:?&body=".concat(encodeURIComponent(t)),"aria-label":"Share via Messages",onClick:()=>S("sms"),className:j(w,"bg-white shadow"),children:(0,a.jsx)(o.efQ,{className:"text-[22px]",style:{color:v}})}),(0,a.jsx)("span",{className:"text-[13px] text-black/70",children:"Messages"})]}),(0,a.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,a.jsx)("a",{href:"mailto:?subject=".concat(encodeURIComponent("A hug for you"),"&body=").concat(encodeURIComponent(t)),"aria-label":"Share via Mail",onClick:()=>S("email"),className:j(w,"bg-white shadow"),children:(0,a.jsx)(s.mIG,{className:"text-[22px]",style:{color:v}})}),(0,a.jsx)("span",{className:"text-[13px] text-black/70",children:"Mail"})]})]}),l?(0,a.jsx)("p",{className:"min-h-12 w-full select-all break-all rounded-2xl border border-black/10 bg-white/75 px-4 py-3 text-center text-[13px] text-black/60",children:l}):(0,a.jsx)("p",{className:"flex min-h-12 items-center justify-center text-[14px] text-black/60",children:"Preparing your share link..."}),(0,a.jsxs)("div",{className:"flex w-full gap-3",children:[(0,a.jsx)("button",{type:"button",onClick:i,className:"rounded-full border border-black/15 bg-white/80 px-6 py-4 text-[17px] font-semibold text-black transition active:scale-[0.99]",children:"â"}),(0,a.jsx)("button",{type:"button",onClick:u,className:"flex-1 rounded-full border border-black/15 bg-white/80 px-6 py-4 text-[17px] font-semibold text-black transition active:scale-[0.99]",children:"Send another hug"})]}),(0,a.jsx)("a",{href:"https://go.attachedapp.com/web",target:"_blank",rel:"noopener noreferrer",onClick:()=>(0,x.rT)("https://go.attachedapp.com/web",{location:"virtual_hug_share_card",linkText:function(e){let t=e.trim();return t?"Why not begin your free 7-day psychology-backed couples challenge with ".concat(t,"?"):"Why not begin your free 7-day psychology-backed couples challenge?"}(c)}),className:"mt-2 block w-full overflow-hidden rounded-[26px] bg-[#0B4F22] px-6 py-6 text-white no-underline",children:(0,a.jsxs)("p",{className:"text-[18px] font-medium leading-tight min-[390px]:text-[19px]",children:["Why not begin your ",(0,a.jsx)("span",{className:"font-semibold text-[#FAFF00]",children:"free"})," 7-day"," ",(0,a.jsx)("span",{className:"font-semibold text-[#FAFF00]",children:"psychology"}),"-backed couples"," ",(0,a.jsx)("span",{className:"font-semibold text-[#FAFF00]",children:"challenge"}),c.trim()?(0,a.jsxs)(a.Fragment,{children:[" ","with ",(0,a.jsx)("span",{className:"font-semibold",children:c.trim()})]}):null,"?"]})})]})}function S(){let[e,t]=(0,r.useState)(1),[l,n]=(0,r.useState)(h.c_),[o,s]=(0,r.useState)(h.dW),[c,i]=(0,r.useState)(""),[x,f]=(0,r.useState)(""),[b,g]=(0,r.useState)(""),[y,w]=(0,r.useState)(""),[j,S]=(0,r.useState)(!1),F=(0,m.tL)(),[O,P]=(0,r.useState)(!1),[_,E]=(0,r.useState)(!1),A=(0,r.useCallback)(()=>P(!0),[]),T=(0,r.useRef)(!1);(0,r.useEffect)(()=>{O&&!T.current&&(T.current=!0,F("hug_post_share_state"))},[O,F]);let R=(0,r.useMemo)(()=>
1{if(3!==e)return"";let t=(0,p.Ve)({you:l,them:o,message:x,toName:c,fromName:b});return t?"".concat(window.location.origin,"/send-a-virtual-hug/receive/").concat(t):""},[b,x,e,o,c,l]),z=y||R,L=y||(j?R:"");return(0,r.useEffect)(()=>{if(3!==e){w(""),S(!1);return}let t=!1;return S(!1),fetch("/api/hugs/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({you:l,them:o,message:x,toName:c,fromName:b})}).then(async e=>{if(!e.ok)throw Error("Failed to save hug");return e.json()}).then(e=>{let{id:l}=e;!t&&"string"==typeof l&&l.trim()&&w("".concat(window.location.origin,"/send-a-virtual-hug/receive/").concat(l))}).catch(()=>{t||S(!0)}),()=>{t=!0}},[e]),(0,r.useEffect)(()=>{let t=3===e&&z?z:"".concat(window.location.origin,"/send-a-virtual-hug/edit");if(window.location.href!==t)try{window.history.replaceState(window.history.state,"",t)}catch(e){}},[e,z]),(0,a.jsxs)("div",{className:"relative flex min-h-[100svh] flex-col overflow-hidden bg-gradient-to-b from-[#FFE8DE] via-[#FFD9E0] to-[#FFC9D6]",children:[(0,a.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 opacity-50",children:[(0,a.jsx)("div",{className:"absolute -top-24 left-1/2 h-72 w-[520px] -translate-x-1/2 rounded-full bg-white blur-3xl"}),(0,a.jsx)("div",{className:"absolute top-56 -right-40 h-72 w-[520px] rounded-full bg-white blur-3xl"}),(0,a.jsx)("div",{className:"absolute bottom-36 left-1/2 h-80 w-[560px] -translate-x-1/2 rounded-full bg-white blur-3xl"})]}),(0,a.jsxs)("div",{className:"relative z-10 mx-auto flex w-full max-w-[430px] flex-col items-center px-6 pb-12 pt-[4svh]",children:[(0,a.jsx)(u.A,{size:"sm"}),(0,a.jsx)("div",{className:"mt-6 w-full",children:(0,a.jsx)(N,{step:e})}),(0,a.jsx)("div",{className:"mt-6 w-full max-w-[400px]",children:(0,a.jsx)(d.A,{you:l,them:o,className:"mx-auto w-full max-w-[360px]"})}),1===e&&(0,a.jsxs)("div",{className:"mt-6 flex w-full flex-col items-center gap-6",children:[(0,a.jsx)("h1",{className:"text-center text-[24px] leading-none text-black",children:"Who's hugging?"}),(0,a.jsx)(k,{label:"You",selected:l,onSelect:n}),(0,a.jsx)(k,{label:"Them",selected:o,onSelect:s}),(0,a.jsx)("button",{type:"button",onClick:()=>t(2),className:"mt-2 w-full rounded-full px-8 py-4 text-[18px] font-semibold text-white shadow-lg transition active:scale-[0.99]",style:{backgroundColor:v},children:"Next â"})]}),2===e&&(0,a.jsxs)("div",{className:"mt-6 flex w-full flex-col gap-4",children:[(0,a.jsx)("h1",{className:"text-center text-[24px] leading-none text-black",children:"Write your message"}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[15px] font-semibold text-black/80",children:"To:"}),(0,a.jsx)("input",{type:"text",value:c,maxLength:p.vc,onChange:e=>i(e.target.value),placeholder:"Their name",className:"w-full rounded-2xl border border-black/10 bg-white/85 px-4 py-3 text-[17px] outline-none focus:border-[#B23A55]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[15px] font-semibold text-black/80",children:"Message:"}),(0,a.jsx)("textarea",{value:x,maxLength:p.PI,onChange:e=>f(e.target.value),placeholder:"Sending you a big hug...",rows:4,className:"w-full resize-none rounded-2xl border border-black/10 bg-white/85 px-4 py-3 text-[17px] outline-none focus:border-[#B23A55]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[15px] font-semibold text-black/80",children:"From:"}),(0,a.jsx)("input",{type:"text",value:b,maxLength:p.vc,onChange:e=>g(e.target.value),placeholder:"Your name",className:"w-full rounded-2xl border border-black/10 bg-white/85 px-4 py-3 text-[17px] outline-none focus:border-[#B23A55]"})]}),(0,a.jsxs)("div",{className:"mt-2 flex gap-3",children:[(0,a.jsx)("button",{type:"button",onClick:()=>t(1),className:"rounded-full border border-black/15 bg-white/80 px-6 py-4 text-[17px] font-semibold text-black transition active:scale-[0.99]",children:"â"}),(0,a.jsx)("button",{type:"button",onClick:()=>t(3),className:"flex-1 rounded-full px-8 py-4 text-[18px] font-semibold text-white shadow-lg transition active:scale-[0.99]",style:{backgroundColor:v},children:"Next â"})]})]}),3===e&&(0,a.jsx)(C,{shareUrl:z,visibleShareUrl:L,toName:c,onBack:()=>t(2),onReset:()=>{t(1),i(""),f(""),g(""),P(!1),T.current=!1},hasShared:O,onShare:A,showPostShareCard:_,onPostShareCardResolve:E})]})]})}},4015:(e,t,l)=>{l.d(t,{rn:()=>n,tL:()=>o}),l(7876);var a=l(4232),r=l(1053);function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"control",l=(0,r.DG)(),[n,o]=(0,a.useState)(null);(0,a.useEffect)(()=>
1{if(!l)return void o(null);let t=()=>{var t;let a=l.getFeatureFlagResult(e);o({key:e,value:null!=(t=null==a?void 0:a.variant)?t:null==a?void 0:a.enabled})};return t(),l.onFeatureFlags(t)},[l,e]);let s=(null==n?void 0:n.key)===e?n.value:void 0;return"string"==typeof s?s:!0===s?"test":t}function o(){return(0,a.useCallback)((e,t)=>{(0,r.No)(e,t)},[])}},5504:(e,t,l)=>{l.d(t,{F:()=>s,PI:()=>n,Ve:()=>o,vc:()=>r});var a=l(3223);let r=120,n=2e3;function o(e){try{let t=JSON.stringify(e),l=encodeURIComponent(t);return btoa(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}catch(e){return console.error("Failed to encode hug data:",e),""}}function s(e){try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),l=t.length%4;l&&(t+="=".repeat(4-l));let o=atob(t),s=decodeURIComponent(o),c=JSON.parse(s);if(!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!e&&"object"==typeof e&&!!e.you&&!!e.them&&e.you in a.o3&&e.them in a.o3&&"string"==typeof e.message&&"string"==typeof e.toName&&"string"==typeof e.fromName&&(!t.enforceLengthLimits||!(e.message.length>n)&&!(e.toName.length>r)&&!(e.fromName.length>r))&&!0}(c))return null;return c}catch(e){return console.error("Failed to decode hug data:",e),null}}},6572:(e,t,l)=>{l.d(t,{JN:()=>s,Ru:()=>c,Ve:()=>h,Y7:()=>o,b:()=>r,mo:()=>i,oG:()=>n,oY:()=>d});var a=l(6647);let r="https://go.attachedapp.com/web",n="https://go.attachedapp.com/flowers",o="https://apps.apple.com/app/id6738164627",s="https://play.google.com/store/apps/details?id=co.edencares.eden";function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;return"zh"!==(0,a.QC)(e)?t:t.startsWith("https://go.attachedapp.com/")||t.startsWith("https://apps.apple.com/")?o:t}function i(e){return"zh"!==(0,a.QC)(e)}let u={quizResult:"2765ca93-6dfa-4a7b-9dc1-2a3ccc5d09be",anxiousLoop:"785f87c3-4e1a-4838-a218-4d899f5893eb",avoidantEx:"2a86f82d-83ce-4a61-b0d7-98ccb9a031de",bestSelf:"07390509-8165-4734-8511-3d4fa6f7f045"},d="anxiousLoop";function h(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r,n=u[t];return n&&function(e){try{let{hostname:t}=new URL(e);return"go.attachedapp.com"===t||t.endsWith(".go.attachedapp.com")||"apps.apple.com"===t||t.endsWith(".apps.apple.com")}catch(e){return!1}}(l)&&"zh"!==(0,a.QC)(e)&&function(){if("undefined"==typeof navigator)return!1;let e=navigator.userAgent||"",t="MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;return/iPhone|iPad|iPod/i.test(e)||t}()?"".concat(o,"?ppid=").concat(n):c(e,l)}},9369:(e,t,l)=>{l.d(t,{k5:()=>u});var a=l(4232),r={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},n=a.createContext&&a.createContext(r),o=["attr","size","title"];function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var l=arguments[t];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(e[a]=l[a])}return e}).apply(this,arguments)}function c(e,t){var l=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),l.push.apply(l,a)}return l}function i(e){for(var t=1;t<arguments.length;t++){var l=null!=arguments[t]?arguments[t]:{};t%2?c(Object(l),!0).forEach(function(t){var a,r,n;a=e,r=t,n=l[t],(r=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var l=e[Symbol.toPrimitive];if(void 0!==l){var a=l.call(e,t||"default");if("object"!=typeof a)return a;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(r))in a?Object.defineProperty(a,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):a[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(l)):c(Object(l)).forEac
1h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(l,t))})}return e}function u(e){return t=>a.createElement(d,s({attr:i({},e.attr)},t),function e(t){return t&&t.map((t,l)=>a.createElement(t.tag,i({key:l},t.attr),e(t.child)))}(e.child))}function d(e){var t=t=>{var l,{attr:r,size:n,title:c}=e,u=function(e,t){if(null==e)return{};var l,a,r=function(e,t){if(null==e)return{};var l={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;l[a]=e[a]}return l}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a<n.length;a++)l=n[a],!(t.indexOf(l)>=0)&&Object.prototype.propertyIsEnumerable.call(e,l)&&(r[l]=e[l])}return r}(e,o),d=n||t.size||"1em";return t.className&&(l=t.className),e.className&&(l=(l?l+" ":"")+e.className),a.createElement("svg",s({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,r,u,{className:l,style:i(i({color:e.color||t.color},t.style),e.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),c&&a.createElement("title",null,c),e.children)};return void 0!==n?a.createElement(n.Consumer,null,e=>t(e)):t(r)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.