{"version":3,"file":"MultiPopup.COU9ogQg.mjs","names":["React.useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/IklkFHIsSv3p5cPOxnui/NmmqZXaFcNTKRTmyZBCU/MultiPopup.js"],"sourcesContent":["// [전체 통합 MultiPopup.jsx]\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";function getLocalStorageKey(idx){return`popup_hide_until_${idx}`;}export default function MultiPopup(props){const{popups,showHideToday,style,popupWidth,triggerCondition,delaySeconds,scrollPixelsThreshold,scrollPercentThreshold,showTrigger,triggerText,triggerLink,triggerFontFamily,triggerFontSize,triggerFontWeight,triggerColor,triggerTextAlign,triggerLineHeight,triggerHeight,popupAnimation,popupDuration}=props;const[visible,setVisible]=React.useState(()=>popups.map(()=>false));const[conditionMet,setConditionMet]=React.useState(false);const[animationStates,setAnimationStates]=React.useState(()=>popups.map(()=>false));const[resetTrigger,setResetTrigger]=React.useState(false);React.useEffect(()=>{if(triggerCondition===\"delay\"){const timer=setTimeout(()=>setConditionMet(true),delaySeconds*1e3);return()=>clearTimeout(timer);}const handleScroll=()=>{const top=window.scrollY;const scrollable=document.documentElement.scrollHeight-window.innerHeight;if(triggerCondition===\"scrollPixels\"&&top>=scrollPixelsThreshold||triggerCondition===\"scrollPercent\"&&scrollable>0&&top/scrollable*100>=scrollPercentThreshold){setConditionMet(true);}};window.addEventListener(\"scroll\",handleScroll);return()=>window.removeEventListener(\"scroll\",handleScroll);},[triggerCondition,delaySeconds,scrollPixelsThreshold,scrollPercentThreshold]);React.useEffect(()=>{if(!conditionMet&&!resetTrigger)return;const now=Date.now();const newVisible=popups.map((_,i)=>{const hideUntil=localStorage.getItem(getLocalStorageKey(i));return!(hideUntil&&now<parseInt(hideUntil));});setVisible(newVisible);setTimeout(()=>{setAnimationStates(newVisible.map(()=>true));},50);if(resetTrigger)setResetTrigger(false);},[conditionMet,resetTrigger,popups.length]);const handleHideToday=idx=>{const tomorrow=new Date;tomorrow.setDate(tomorrow.getDate()+1);localStorage.setItem(getLocalStorageKey(idx),tomorrow.getTime().toString());setVisible(v=>v.map((val,i)=>i===idx?false:val));};const handleClose=idx=>{setVisible(v=>v.map((val,i)=>i===idx?false:val));};const handleClick=idx=>{const url=popups[idx]?.link;if(url&&typeof window!==\"undefined\"){const params=window.location.search;window.location.href=url+params;}};const resetAll=()=>{popups.forEach((_,i)=>localStorage.removeItem(getLocalStorageKey(i)));setVisible(popups.map(()=>true));setAnimationStates(popups.map(()=>false));setConditionMet(true)// 조건 충족으로 간주\n;setResetTrigger(true);};const isAnyVisible=visible.some(Boolean);const duration=`${popupDuration}s`;const getAnimationStyle=active=>{if(!active){switch(popupAnimation){case\"fade\":return{opacity:0};case\"zoomIn\":case\"pop\":return{transform:\"scale(0.8)\",opacity:0};default:return{};}}switch(popupAnimation){case\"fade\":return{opacity:1,transition:`opacity ${duration} ease-out`};case\"zoomIn\":return{transform:\"scale(1)\",opacity:1,transition:`transform ${duration} ease-out, opacity ${duration} ease-out`};case\"pop\":return{transform:\"scale(1)\",opacity:1,transition:`transform ${duration} cubic-bezier(0.34,1.56,0.64,1), opacity ${duration} ease-out`};default:return{};}};return /*#__PURE__*/_jsxs(_Fragment,{children:[showTrigger&&/*#__PURE__*/_jsx(\"div\",{onClick:()=>{resetAll();if(triggerLink){const params=window.location.search;window.location.href=triggerLink+params;}},style:{width:\"100%\",height:triggerHeight,display:\"flex\",alignItems:\"center\",justifyContent:triggerTextAlign===\"left\"?\"flex-start\":triggerTextAlign===\"right\"?\"flex-end\":\"center\",fontFamily:triggerFontFamily,fontSize:triggerFontSize,fontWeight:triggerFontWeight,color:triggerColor,lineHeight:triggerLineHeight,textAlign:triggerTextAlign,cursor:\"pointer\",userSelect:\"none\",padding:\"0 12px\"},children:triggerText}),(conditionMet||resetTrigger)&&isAnyVisible&&RenderTarget.current()!==RenderTarget.thumbnail&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",background:\"rgba(0,0,0,0.7)\",zIndex:9999}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",flexWrap:\"wrap\",gap:16,padding:16,zIndex:1e4,...style},children:popups.map((popup,i)=>visible[i]&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",maxWidth:popupWidth,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",background:\"transparent\",...getAnimationStyle(animationStates[i])},children:[/*#__PURE__*/_jsx(\"button\",{onClick:()=>handleClose(i),\"aria-label\":\"닫기\",style:{position:\"absolute\",top:12,right:12,width:28,height:28,background:\"transparent\",color:\"#fff\",border:\"none\",fontSize:18,cursor:\"pointer\",lineHeight:\"28px\",textAlign:\"center\"},children:\"\\xd7\"}),/*#__PURE__*/_jsx(\"img\",{src:popup.image?.src||popup.image,alt:popup.image?.alt||`Popup ${i+1}`,style:{width:\"100%\",borderRadius:8,objectFit:\"cover\",cursor:popup.link?\"pointer\":\"default\"},onClick:()=>handleClick(i)}),showHideToday&&/*#__PURE__*/_jsxs(\"div\",{onClick:()=>handleHideToday(i),style:{marginTop:12,display:\"flex\",alignItems:\"center\",fontSize:12,color:\"#aaa\",cursor:\"pointer\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:10,height:10,background:\"#ccc\",marginRight:6}}),\"오늘 하루 보지 않기\"]})]},i))}),(RenderTarget.current()===RenderTarget.preview||RenderTarget.current()===RenderTarget.canvas)&&/*#__PURE__*/_jsx(\"button\",{onClick:resetAll,style:{position:\"fixed\",bottom:16,right:16,background:\"#eee\",border:\"1px solid #ccc\",borderRadius:6,padding:\"6px 12px\",fontSize:12,color:\"#333\",cursor:\"pointer\",zIndex:11e3},children:\"🧹\"})]})]});}addPropertyControls(MultiPopup,{popups:{type:ControlType.Array,title:\"팝업들\",control:{type:ControlType.Object,controls:{image:{type:ControlType.ResponsiveImage,title:\"이미지\"},link:{type:ControlType.String,title:\"이동 링크\",placeholder:\"https://...\"}}},defaultValue:[],maxCount:5},showHideToday:{type:ControlType.Boolean,title:\"오늘 하루 숨김 버튼\",defaultValue:true},popupWidth:{type:ControlType.Number,title:\"팝업 최대 너비\",defaultValue:300,min:200,max:600,step:10},triggerCondition:{type:ControlType.Enum,title:\"노출 조건\",options:[\"delay\",\"scrollPercent\",\"scrollPixels\"],optionTitles:[\"딜레이 후\",\"스크롤 %\",\"스크롤 px\"],defaultValue:\"delay\"},delaySeconds:{type:ControlType.Number,title:\"딜레이 (초)\",defaultValue:0,min:0,max:10,step:1,hidden:props=>props.triggerCondition!==\"delay\"},scrollPercentThreshold:{type:ControlType.Number,title:\"스크롤 비율 (%)\",defaultValue:50,min:0,max:100,step:1,hidden:props=>props.triggerCondition!==\"scrollPercent\"},scrollPixelsThreshold:{type:ControlType.Number,title:\"스크롤 거리 (px)\",defaultValue:300,min:0,max:3e3,step:10,hidden:props=>props.triggerCondition!==\"scrollPixels\"},showTrigger:{type:ControlType.Boolean,title:\"트리거 버튼 표시\",defaultValue:true},triggerText:{type:ControlType.String,title:\"트리거 텍스트\",defaultValue:\"팝업 열기\"},triggerLink:{type:ControlType.String,title:\"트리거 링크\",defaultValue:\"\",placeholder:\"https://...\"},triggerHeight:{type:ControlType.Number,title:\"트리거 높이\",defaultValue:60,min:40,max:120},triggerFontFamily:{type:ControlType.String,title:\"폰트 패밀리\",defaultValue:\"system-ui\",group:\"트리거 폰트 설정\"},triggerFontSize:{type:ControlType.Number,title:\"폰트 크기\",defaultValue:16,min:10,max:60,group:\"트리거 폰트 설정\"},triggerFontWeight:{type:ControlType.String,title:\"폰트 두께\",defaultValue:\"normal\",group:\"트리거 폰트 설정\"},triggerColor:{type:ControlType.Color,title:\"폰트 색상\",defaultValue:\"#000000\",group:\"트리거 폰트 설정\"},triggerTextAlign:{type:ControlType.Enum,title:\"정렬\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"왼쪽\",\"가운데\",\"오른쪽\"],defaultValue:\"center\",group:\"트리거 폰트 설정\"},triggerLineHeight:{type:ControlType.String,title:\"줄간격\",defaultValue:\"1.5\",group:\"트리거 폰트 설정\"},popupAnimation:{type:ControlType.Enum,title:\"팝업 애니메이션\",options:[\"instant\",\"fade\",\"zoomIn\",\"pop\"],optionTitles:[\"즉시\",\"페이드\",\"줌인\",\"팝\"],defaultValue:\"instant\"},popupDuration:{type:ControlType.Number,title:\"애니메이션 시간(초)\",defaultValue:.3,min:0,max:3,step:.1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MultiPopup\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MultiPopup.map"],"mappings":"oNAC4K,SAAS,EAAmB,EAAI,CAAC,MAAM,oBAAoB,IAAO,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,SAAO,gBAAc,QAAM,aAAW,mBAAiB,eAAa,wBAAsB,yBAAuB,cAAY,cAAY,cAAY,oBAAkB,kBAAgB,oBAAkB,eAAa,mBAAiB,oBAAkB,gBAAc,iBAAe,iBAAe,EAAW,CAAC,EAAQ,GAAYA,MAAmB,EAAO,QAAQ,GAAM,CAAC,CAAM,CAAC,EAAa,GAAiBA,EAAe,GAAM,CAAM,CAAC,EAAgB,GAAoBA,MAAmB,EAAO,QAAQ,GAAM,CAAC,CAAM,CAAC,EAAa,GAAiBA,EAAe,GAAM,CAAC,MAAoB,CAAC,GAAG,IAAmB,QAAQ,CAAC,IAAM,EAAM,eAAe,EAAgB,GAAK,CAAC,EAAa,IAAI,CAAC,UAAU,aAAa,EAAM,CAAE,IAAM,MAAiB,CAAC,IAAM,EAAI,EAAO,QAAc,EAAW,SAAS,gBAAgB,aAAa,EAAO,aAAe,IAAmB,gB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