{"version":3,"file":"AI_agent.CSCbb-PU.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/RIFM9vumHXWHP7fllDL0/G9nMSsj0OZmKiTCB3TBl/AI_agent.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef}from\"react\";export default function AgentChat({accentColor,fontFamily,autoLoop,loopDelay}){const bodyRef=useRef(null);const played=useRef(false);const timerRefs=useRef([]);function clearTimers(){timerRefs.current.forEach(clearTimeout);timerRefs.current=[];}function t(fn,ms){timerRefs.current.push(setTimeout(fn,ms));}function runAgent(){const body=bodyRef.current;if(!body)return;// Reset\nbody.innerHTML=`\n            <div style=\"display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1;text-align:center;padding:20px 0 8px;\">\n                <div style=\"font-size:18px;color:#9299b0;margin-bottom:4px;\">Hi there 👋</div>\n                <div style=\"font-size:16px;font-weight:700;color:#1a1d2e;line-height:1.2;\">AI Agent is here to help you!</div>\n            </div>`;function addMsg(html,delay){t(()=>{const d=document.createElement(\"div\");d.innerHTML=html;const node=d.firstElementChild;body.querySelector(\".vpa-welcome-wrap\")?.remove();body.appendChild(node);body.scrollTop=body.scrollHeight;},delay);}const T={user:1200,think:2e3,tool:2900,classify:4400,optset:5800};// User message\naddMsg(`\n            <div style=\"display:flex;justify-content:flex-end;\">\n                <div style=\"background:${accentColor};color:#fff;padding:9px 14px;border-radius:18px 18px 4px 18px;font-size:13px;max-width:78%;line-height:1.4;box-shadow:0 4px 12px rgba(59,66,249,.25);animation:vpaFade .2s ease forwards;\">\n                    Optimize my Q2 budget allocation\n                </div>\n            </div>`,T.user);// Thinking\naddMsg(`\n            <div id=\"vpa-thinking\" style=\"display:flex;gap:10px;align-items:center;animation:vpaFade .2s ease forwards;\">\n                <div style=\"width:30px;height:30px;border-radius:50%;flex:none;background:linear-gradient(135deg,${accentColor} 0%,#00c8d4 100%);display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;color:#fff;letter-spacing:-.02em;\">oH</div>\n                <div style=\"font-size:12px;color:#9299b0;display:flex;align-items:center;gap:8px;padding:8px 0;\">\n                    <span class=\"vpa-think-dots\" style=\"display:inline-flex;gap:4px;\">\n                        <span></span><span></span><span></span>\n                    </span>\n                    Thinking...\n                </div>\n            </div>`,T.think);// Tool executed + context\nt(()=>{document.getElementById(\"vpa-thinking\")?.remove();const d=document.createElement(\"div\");d.style.cssText=\"display:flex;gap:10px;align-items:flex-start;animation:vpaFade .25s ease forwards;\";d.innerHTML=`\n                <div style=\"width:30px;height:30px;border-radius:50%;flex:none;background:linear-gradient(135deg,${accentColor} 0%,#00c8d4 100%);display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;color:#fff;letter-spacing:-.02em;flex-shrink:0;\">oH</div>\n                <div style=\"flex:1;min-width:0;\">\n                    <div style=\"display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;background:#f0f1f8;border:1px solid #e0e3f0;font-size:11px;color:#8890b0;margin-bottom:8px;\">\n                        <span style=\"width:6px;height:6px;border-radius:50%;background:${accentColor};opacity:.6;display:inline-block;\"></span> Thought for 4s ▾\n                    </div>\n                    <div style=\"font-size:13px;color:#2a2d3e;line-height:1.55;margin-bottom:8px;\">I'll optimize your Q2 budget allocation across the catalog.</div>\n                    <div style=\"display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:6px;background:#eef0ff;border:1px solid #d4d8ff;font-size:11px;color:${accentColor};font-weight:600;margin-bottom:8px;\">\n                        ✓ Tool executed <span style=\"background:${accentColor};color:#fff;font-size:10px;padding:1px 6px;border-radius:4px;font-weight:700;\">TASK</span>\n                    </div>\n                    <div style=\"background:#fff;border:1px solid #e4e6f0;border-radius:10px;padding:11px 14px;font-size:12px;color:#555;box-shadow:0 2px 8px rgba(0,0,0,.04);\">\n                        <span style=\"font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:${accentColor};margin-bottom:7px;display:block;\">Context</span>\n                        <div style=\"color:#666;line-height:1.7;\">• User request: Q2 budget optimization</div>\n                        <div style=\"color:#666;line-height:1.7;\">• Current date: March 18, 2026</div>\n                        <div style=\"color:#666;line-height:1.7;\">• Account: MEDIPICKME (seller account)</div>\n                        <span style=\"font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:${accentColor};margin:9px 0 7px;display:block;\">Task:</span>\n                        <div style=\"color:#555;line-height:1.7;padding-left:4px;\">1. Retrieve ASIN performance data for Q2</div>\n                        <div style=\"color:#555;line-height:1.7;padding-left:4px;\">2. Classify products by growth potential</div>\n                        <div style=\"color:#555;line-height:1.7;padding-left:4px;\">3. Allocate budget to highest-ROI ASINs</div>\n                        <div style=\"color:#555;line-height:1.7;padding-left:4px;\">4. Propose ready-to-run Optimization SET</div>\n                    </div>\n                </div>`;body.appendChild(d);body.scrollTop=body.scrollHeight;},T.tool);// Product classification\naddMsg(`\n            <div style=\"display:flex;gap:10px;align-items:flex-start;animation:vpaFade .25s ease forwards;\">\n                <div style=\"width:30px;height:30px;border-radius:50%;flex:none;background:linear-gradient(135deg,${accentColor} 0%,#00c8d4 100%);display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;color:#fff;letter-spacing:-.02em;flex-shrink:0;\">oH</div>\n                <div style=\"flex:1;\">\n                    <div style=\"background:#fff;border:1px solid #e4e6f0;border-radius:10px;padding:11px 14px;font-size:12px;color:#555;box-shadow:0 2px 8px rgba(0,0,0,.04);\">\n                        <span style=\"font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:${accentColor};margin-bottom:7px;display:block;\">Product Classification</span>\n                        <div style=\"display:flex;align-items:center;gap:8px;padding:4px 0;border-bottom:1px solid #f0f1f8;font-size:12px;color:#444;\">\n                            <span style=\"font-size:10px;font-weight:700;padding:2px 8px;border-radius:4px;background:#e6fef5;color:#00a870;min-width:58px;text-align:center;\">▲ Growth</span>Moisturizing Serum \\xb7 Eye Cream Pro\n                        </div>\n                        <div style=\"display:flex;align-items:center;gap:8px;padding:4px 0;border-bottom:1px solid #f0f1f8;font-size:12px;color:#444;\">\n                            <span style=\"font-size:10px;font-weight:700;padding:2px 8px;border-radius:4px;background:#eef0ff;color:${accentColor};min-width:58px;text-align:center;\">■ Defend</span>Foundation Set \\xb7 BB Cream\n                        </div>\n                        <div style=\"display:flex;align-items:center;gap:8px;padding:4px 0;font-size:12px;color:#444;\">\n                            <span style=\"font-size:10px;font-weight:700;padding:2px 8px;border-radius:4px;background:#fff0f0;color:#e05050;min-width:58px;text-align:center;\">▼ Exit</span>2 discontinued SKUs\n                        </div>\n                    </div>\n                </div>\n            </div>`,T.classify);// Optimization SET + confirm\naddMsg(`\n            <div style=\"display:flex;gap:10px;align-items:flex-start;animation:vpaFade .25s ease forwards;\">\n                <div style=\"width:30px;height:30px;border-radius:50%;flex:none;background:linear-gradient(135deg,${accentColor} 0%,#00c8d4 100%);display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;color:#fff;letter-spacing:-.02em;flex-shrink:0;\">oH</div>\n                <div style=\"flex:1;\">\n                    <div style=\"background:#fff;border:1px solid #e4e6f0;border-radius:10px;padding:11px 14px;font-size:12px;color:#555;box-shadow:0 2px 8px rgba(0,0,0,.04);margin-bottom:8px;\">\n                        <span style=\"font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:${accentColor};margin-bottom:7px;display:block;\">Optimization SET Ready</span>\n                        <div style=\"padding:3px 0;line-height:1.5;color:#444;\">› Moisturizing Serum +38% budget allocation</div>\n                        <div style=\"padding:3px 0;line-height:1.5;color:#444;\">› Eye Cream Pro +22% budget allocation</div>\n                        <div style=\"padding:3px 0;line-height:1.5;color:#444;\">› Foundation Set –8% (margin protection)</div>\n                        <div style=\"padding:3px 0;line-height:1.5;color:#444;\">› Exit campaigns → pause keyword structure</div>\n                    </div>\n                    <div style=\"display:flex;gap:8px;\">\n                        <button style=\"padding:7px 18px;border-radius:8px;font-size:12px;font-weight:700;background:${accentColor};color:#fff;border:none;cursor:pointer;font-family:inherit;box-shadow:0 4px 12px rgba(59,66,249,.28);\">Confirm SET →</button>\n                        <button style=\"padding:7px 18px;border-radius:8px;font-size:12px;font-weight:600;background:#fff;color:#555;border:1px solid #d8dae8;cursor:pointer;font-family:inherit;\">Adjust</button>\n                    </div>\n                </div>\n            </div>`,T.optset);// Loop\nif(autoLoop){t(()=>runAgent(),T.optset+loopDelay);}}useEffect(()=>{clearTimers();played.current=false;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(!entry.isIntersecting||played.current)return;played.current=true;runAgent();});},{threshold:.35});if(bodyRef.current)observer.observe(bodyRef.current);return()=>{observer.disconnect();clearTimers();};},[accentColor,autoLoop,loopDelay]);return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",borderRadius:16,overflow:\"hidden\",border:\"1px solid rgba(0,0,0,.10)\",background:\"#f5f6fa\",boxShadow:\"0 28px 64px rgba(0,0,0,.18)\",fontFamily,fontSize:13,display:\"flex\",flexDirection:\"column\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes vpaFade {\n                    from { opacity:0; transform:translateY(4px); }\n                    to   { opacity:1; transform:translateY(0); }\n                }\n                .vpa-think-dots span {\n                    display:inline-block; width:5px; height:5px; border-radius:50%;\n                    background:${accentColor}; opacity:.5; margin:0 2px;\n                    animation:vpaDot 1.2s ease-in-out infinite;\n                }\n                .vpa-think-dots span:nth-child(2) { animation-delay:.2s; }\n                .vpa-think-dots span:nth-child(3) { animation-delay:.4s; }\n                @keyframes vpaDot {\n                    0%,80%,100% { transform:scale(.6); opacity:.3; }\n                    40%         { transform:scale(1);  opacity:.9; }\n                }\n            `}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"stretch\",background:\"#fff\",borderBottom:\"1px solid #e8eaf0\",padding:\"0 14px\",gap:0,flexShrink:0},children:[\"Home\",\"AI Agent\",\"FAQs\",\"Tickets\"].map(tab=>/*#__PURE__*/_jsxs(\"div\",{style:{padding:\"11px 14px\",fontSize:12.5,fontWeight:tab===\"AI Agent\"?600:500,color:tab===\"AI Agent\"?accentColor:\"#9299b0\",borderBottom:tab===\"AI Agent\"?`2px solid ${accentColor}`:\"2px solid transparent\",whiteSpace:\"nowrap\",cursor:\"default\",userSelect:\"none\"},children:[tab===\"AI Agent\"?\"✦ \":\"\",tab]},tab))}),/*#__PURE__*/_jsx(\"div\",{style:{padding:\"7px 16px\",background:\"#fff\",borderBottom:\"1px solid #eef0f6\",flexShrink:0},children:/*#__PURE__*/_jsx(\"span\",{style:{fontSize:12,color:accentColor,fontWeight:500},children:\"‹ Clear Chat\"})}),/*#__PURE__*/_jsx(\"div\",{ref:bodyRef,style:{flex:1,minHeight:280,maxHeight:300,overflowY:\"auto\",padding:\"14px 16px\",display:\"flex\",flexDirection:\"column\",gap:10,background:\"#f5f6fa\",scrollbarWidth:\"none\"}}),/*#__PURE__*/_jsxs(\"div\",{style:{background:\"#fff\",borderTop:\"1px solid #e8eaf0\",padding:\"10px 14px\",flexShrink:0},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:8,alignItems:\"center\",background:\"#f5f6fa\",border:`1.5px solid ${accentColor}`,borderRadius:10,padding:\"8px 14px\",marginBottom:10},children:[/*#__PURE__*/_jsx(\"span\",{style:{flex:1,fontSize:13,color:\"#bbb\"},children:\"How can I help you today?\"}),/*#__PURE__*/_jsx(\"button\",{style:{background:accentColor,color:\"#fff\",border:\"none\",borderRadius:7,padding:\"6px 14px\",fontSize:12,fontWeight:700,cursor:\"pointer\",fontFamily,whiteSpace:\"nowrap\"},children:\"▶ Send\"})]}),/*#__PURE__*/_jsx(\"span\",{style:{fontSize:11,color:\"#aaa\",marginBottom:6,display:\"block\"},children:\"Quick Menus\"}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:6,flexWrap:\"wrap\"},children:[\"Sales/Ads Analysis\",\"Product Classification\",\"Optimization Set\"].map(label=>/*#__PURE__*/_jsx(\"button\",{style:{padding:\"5px 12px\",borderRadius:999,border:\"1px solid #d4d8ee\",background:\"#fff\",fontSize:11,color:\"#555\",cursor:\"pointer\",fontFamily},children:label},label))})]})]});}AgentChat.defaultProps={accentColor:\"#3B42F9\",fontFamily:\"'Poppins', sans-serif\",autoLoop:true,loopDelay:3e3};addPropertyControls(AgentChat,{accentColor:{type:ControlType.Color,title:\"Accent Color\"},fontFamily:{type:ControlType.String,title:\"Font Family\"},autoLoop:{type:ControlType.Boolean,title:\"Auto Loop\"},loopDelay:{type:ControlType.Number,title:\"Loop Delay (ms)\",min:0,max:1e4,step:500,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AgentChat\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AI_agent.map"],"mappings":"wLAAiJ,SAAwB,EAAU,CAAC,cAAY,aAAW,WAAS,aAAW,CAAC,IAAM,EAAQA,EAAO,KAAK,CAAO,EAAOA,EAAO,GAAM,CAAO,EAAUA,EAAO,EAAE,CAAC,CAAC,SAAS,GAAa,CAAC,EAAU,QAAQ,QAAQ,aAAa,CAAC,EAAU,QAAQ,EAAE,CAAE,SAAS,EAAE,EAAG,EAAG,CAAC,EAAU,QAAQ,KAAK,WAAW,EAAG,EAAG,CAAC,CAAE,SAAS,GAAU,CAAC,IAAM,EAAK,EAAQ,QAAQ,GAAG,CAAC,EAAK,OAC3f,EAAK,UAAU;;;;oBAIK,SAAS,EAAO,EAAK,EAAM,CAAC,MAAM,CAAC,IAAM,EAAE,SAAS,cAAc,MAAM,CAAC,EAAE,UAAU,EAAK,IAAM,EAAK,EAAE,kBAAkB,EAAK,cAAc,oBAAoB,EAAE,QAAQ,CAAC,EAAK,YAAY,EAAK,CAAC,EAAK,UAAU,EAAK,cAAe,EAAM,CAAE,IAAM,EAAE,CAAC,KAAK,KAAK,MAAM,IAAI,KAA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