@kite-copilot/chat-panel 0.2.14 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto.cjs +20 -23
- package/dist/auto.js +1 -1
- package/dist/{chunk-3A6DAX65.js → chunk-US7B3XXI.js} +20 -23
- package/dist/embed.global.js +1 -1
- package/dist/index.cjs +20 -23
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/auto.cjs
CHANGED
|
@@ -2373,29 +2373,26 @@ ${userText}`
|
|
|
2373
2373
|
) })
|
|
2374
2374
|
] }),
|
|
2375
2375
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: isEmpty ? "grid flex-1 place-items-center transition-all duration-300" : "flex flex-1 flex-col transition-all duration-300 min-h-0 overflow-hidden", children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w-full overflow-y-auto px-4", children: [
|
|
2376
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "py-
|
|
2377
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pb-4", children: [
|
|
2378
|
-
panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime9.
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
);
|
|
2397
|
-
}) })
|
|
2398
|
-
] }),
|
|
2376
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "py-3 transition-all duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "How can I help?" }) }),
|
|
2377
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pb-4 px-4", children: [
|
|
2378
|
+
panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
|
|
2379
|
+
const iconColors = ["bg-blue-400", "bg-green-400", "bg-purple-400", "bg-orange-400", "bg-pink-400"];
|
|
2380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2381
|
+
Button,
|
|
2382
|
+
{
|
|
2383
|
+
type: "button",
|
|
2384
|
+
size: "sm",
|
|
2385
|
+
variant: "ghost",
|
|
2386
|
+
className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
|
|
2387
|
+
onClick: () => sendTopic(question.prompt),
|
|
2388
|
+
children: [
|
|
2389
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}` }),
|
|
2390
|
+
question.label
|
|
2391
|
+
]
|
|
2392
|
+
},
|
|
2393
|
+
question.id
|
|
2394
|
+
);
|
|
2395
|
+
}) }) }),
|
|
2399
2396
|
panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2400
2397
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
2401
2398
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
package/dist/auto.js
CHANGED
|
@@ -2372,29 +2372,26 @@ ${userText}`
|
|
|
2372
2372
|
) })
|
|
2373
2373
|
] }),
|
|
2374
2374
|
/* @__PURE__ */ jsx9("div", { className: isEmpty ? "grid flex-1 place-items-center transition-all duration-300" : "flex flex-1 flex-col transition-all duration-300 min-h-0 overflow-hidden", children: isEmpty ? /* @__PURE__ */ jsxs5("div", { className: "w-full overflow-y-auto px-4", children: [
|
|
2375
|
-
/* @__PURE__ */ jsx9("div", { className: "py-
|
|
2376
|
-
/* @__PURE__ */ jsxs5("div", { className: "pb-4", children: [
|
|
2377
|
-
panelView === "landing" && /* @__PURE__ */
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
);
|
|
2396
|
-
}) })
|
|
2397
|
-
] }),
|
|
2375
|
+
/* @__PURE__ */ jsx9("div", { className: "py-3 transition-all duration-300", children: /* @__PURE__ */ jsx9("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "How can I help?" }) }),
|
|
2376
|
+
/* @__PURE__ */ jsxs5("div", { className: "pb-4 px-4", children: [
|
|
2377
|
+
panelView === "landing" && /* @__PURE__ */ jsx9(Fragment2, { children: /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ jsx9("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx9(Loader22, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
|
|
2378
|
+
const iconColors = ["bg-blue-400", "bg-green-400", "bg-purple-400", "bg-orange-400", "bg-pink-400"];
|
|
2379
|
+
return /* @__PURE__ */ jsxs5(
|
|
2380
|
+
Button,
|
|
2381
|
+
{
|
|
2382
|
+
type: "button",
|
|
2383
|
+
size: "sm",
|
|
2384
|
+
variant: "ghost",
|
|
2385
|
+
className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
|
|
2386
|
+
onClick: () => sendTopic(question.prompt),
|
|
2387
|
+
children: [
|
|
2388
|
+
/* @__PURE__ */ jsx9("span", { className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}` }),
|
|
2389
|
+
question.label
|
|
2390
|
+
]
|
|
2391
|
+
},
|
|
2392
|
+
question.id
|
|
2393
|
+
);
|
|
2394
|
+
}) }) }),
|
|
2398
2395
|
panelView === "folder" && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2399
2396
|
/* @__PURE__ */ jsxs5("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
2400
2397
|
/* @__PURE__ */ jsx9(
|
package/dist/embed.global.js
CHANGED
|
@@ -26,7 +26,7 @@ ${v}`};d(_=>[..._,E]),m("thinking"),x([{message:"Analyzing CSV file...",complete
|
|
|
26
26
|
`),tt="",ea="";for(let W of Ra)W.startsWith("event: ")?tt=W.slice(7):W.startsWith("data: ")&&(ea=W.slice(6));if(!(!tt||!ea))try{let W=JSON.parse(ea);if(tt==="preview"){m("idle"),x([]),ie=W.bulk_session_id,rr(ie);let z={id:U+1,role:"assistant",kind:"bulkPreview",content:W.message||`I found ${W.csv_data.rowCount} rows in your CSV. Here's a preview:`,csvData:{rowCount:W.csv_data.rowCount,columns:W.csv_data.columns,sampleRows:W.csv_data.sampleRows,fileName:b.name},suggestedAction:W.suggested_action,bulkSessionId:ie||void 0};d(ae=>[...ae,z])}else if(tt==="progress")m("executing"),x([{message:`Processing row ${W.row} of ${W.total}...`,completed:!1}]),d(z=>z[z.length-1]?.kind==="bulkProgress"?z.map((fe,yt)=>yt===z.length-1?{...fe,bulkProgress:{processed:W.row,total:W.total,successes:W.successes||0,failures:W.failures||0}}:fe):[...z,{id:Date.now(),role:"assistant",kind:"bulkProgress",bulkProgress:{processed:W.row,total:W.total,successes:W.successes||0,failures:W.failures||0}}]);else if(tt==="summary")m("idle"),x([]),rr(null),d(z=>[...z.filter(fe=>fe.kind!=="bulkProgress"),{id:Date.now(),role:"assistant",kind:"bulkSummary",content:W.message,bulkSummary:{total:W.total,successes:W.successes,failures:W.failures||[],navigationPage:W.navigationPage}}]),setTimeout(()=>{window.dispatchEvent(new CustomEvent("agentActionComplete",{detail:{result:{bulk:!0,total:W.total,successes:W.successes}}}))},100);else if(tt==="error"){m("idle"),x([]),rr(null);let z={id:U+1,role:"assistant",kind:"text",content:W.message||"An error occurred processing your CSV file."};d(ae=>[...ae,z])}else tt==="done"&&(m("idle"),x([]))}catch(W){console.error("Failed to parse bulk SSE event:",W)}}}x([]),m("idle")}catch(_){console.error("Bulk upload failed:",_),x([]),m("idle");let oe={id:U+1,role:"assistant",kind:"text",content:"I'm having trouble processing your CSV file. Please make sure the agent server is running on port 5002 and try again."};d(te=>[...te,oe])}}async function ic(v){m("executing"),x([{message:"Starting bulk operation...",completed:!1}]);try{let b=await fetch(`${s}/chat/bulk/confirm`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bulk_session_id:v})});if(!b.ok)throw new Error(`Confirm failed: ${b.status}`);let U=b.body?.getReader();if(!U)throw new Error("No response body");let E=new TextDecoder,_="";for(;;){let{done:oe,value:te}=await U.read();if(oe)break;_+=E.decode(te,{stream:!0});let P=_.split(`
|
|
27
27
|
|
|
28
28
|
`);_=P.pop()||"";for(let N of P){if(!N.trim())continue;let w=N.split(`
|
|
29
|
-
`),K="",ie="";for(let $ of w)$.startsWith("event: ")?K=$.slice(7):$.startsWith("data: ")&&(ie=$.slice(6));if(!(!K||!ie))try{let $=JSON.parse(ie);if(K==="progress")x([{message:`Processing row ${$.row} of ${$.total}...`,completed:!1}]),d(ce=>ce[ce.length-1]?.kind==="bulkProgress"?ce.map((et,Ra)=>Ra===ce.length-1?{...et,bulkProgress:{processed:$.row,total:$.total,successes:$.successes||0,failures:$.failures||0}}:et):[...ce,{id:Date.now(),role:"assistant",kind:"bulkProgress",bulkProgress:{processed:$.row,total:$.total,successes:$.successes||0,failures:$.failures||0}}]);else if(K==="summary")console.log("[DEBUG] Received summary event - data:",$),console.log("[DEBUG] navigationPage from backend:",$.navigationPage),m("idle"),x([]),rr(null),d(ce=>{let qe=ce.filter(Ra=>Ra.kind!=="bulkProgress"&&Ra.kind!=="bulkPreview"),et={id:Date.now(),role:"assistant",kind:"bulkSummary",content:$.message,bulkSummary:{total:$.total,successes:$.successes,failures:$.failures||[],navigationPage:$.navigationPage}};return console.log("[DEBUG] Creating bulkSummary message:",et),[...qe,et]}),setTimeout(()=>{window.dispatchEvent(new CustomEvent("agentActionComplete",{detail:{result:{bulk:!0,total:$.total,successes:$.successes}}}))},100);else if(K==="error"){m("idle"),x([]),rr(null);let ce={id:Date.now(),role:"assistant",kind:"text",content:$.message||"An error occurred during bulk processing."};d(qe=>[...qe,ce])}}catch($){console.error("Failed to parse confirm SSE event:",$)}}}}catch(b){console.error("Bulk confirm failed:",b),m("idle"),x([]),rr(null);let U={id:Date.now(),role:"assistant",kind:"text",content:"Failed to start bulk operation. Please try again."};d(E=>[...E,U])}}function dS(){rr(null),d(v=>v.filter(b=>b.kind!=="bulkPreview"))}function Ym(v){sc(v)}function cS(v){let b=Date.now()+Math.floor(Math.random()*1e3);d(U=>[...U,{id:b,role:"assistant",kind:"text",content:v}])}function gT(v){let b=qm[v];if(!b)return;D("landing"),O(void 0);let U={id:v,stepIndex:0};Jt(U),he.current=U,cS(`I'll help you with ${b.title}.`);let E=b.steps[0],_=E.cursorTarget?.selector.includes("[data-page="),oe=E.cursorTarget?.selector.includes("[data-settings-tab=");if(E.cursorTarget&&(_||oe)){let P=E.cursorTarget;oe&&E.navigation&&r&&r(E.navigation.page,void 0),setTimeout(()=>{let w=()=>{let K=document.querySelector(P.selector);K&&K.offsetParent!==null?($r(P),P.onClick&&setTimeout(()=>{K.click()},1200)):setTimeout(w,200)};w()},oe?800:400)}else if(E.navigation&&r&&r(E.navigation.page,E.navigation.subtab),E.cursorTarget){let P=E.cursorTarget,N=P.selector.includes("data-settings-tab"),w=P.selector.includes("dialog")||P.selector.includes("api-key-name-input");setTimeout(()=>{let ie=()=>{let $=document.querySelector(P.selector);$&&$.offsetParent!==null?($r(P),P.onClick&&setTimeout(()=>{$.click()},1e3)):N||w?setTimeout(ie,200):($r(P),P.onClick&&setTimeout(()=>{let ce=document.querySelector(P.selector);ce&&ce.click()},1e3))};ie()},w?700:N?600:400)}let te={id:Date.now()+1,role:"assistant",kind:"guideStep",content:"",guideStepIndex:0};d(P=>[...P,te]),Aa(te.id,E.text)}function lc(){if(!Z)return;let v=qm[Z.id];if(!v)return;let b=he.current;(!b||b.id!==Z.id)&&(b=Z,he.current=Z);let E=b.stepIndex+1;if(E>=v.steps.length){Do();let w=Date.now()+1;d(K=>[...K,{id:w,role:"assistant",kind:"guideComplete",content:"Guide Complete"}]),Jt(void 0),gt(!0);return}let _=v.steps[E],oe={id:Z.id,stepIndex:E};Jt(oe),he.current=oe;let te={id:Date.now()+1,role:"assistant",kind:"guideStep",content:"",guideStepIndex:E};d(w=>[...w,te]);let P=_.cursorTarget?.selector.includes("[data-page="),N=_.cursorTarget?.selector.includes("[data-settings-tab=");if(_.cursorTarget&&(P||N)){let w=_.cursorTarget;N&&_.navigation&&r&&r(_.navigation.page,void 0),setTimeout(()=>{let ie=he.current;if(!ie||ie.id!==v.id||ie.stepIndex!==E)return;let $=()=>{let ce=he.current;if(!ce||ce.id!==v.id||ce.stepIndex!==E)return;let qe=document.querySelector(w.selector);qe&&qe.offsetParent!==null?($r(w),w.onClick&&setTimeout(()=>{let et=he.current;!et||et.id!==v.id||et.stepIndex!==E||qe.click()},1200)):setTimeout($,200)};$()},N?800:400)}else if(_.navigation&&r&&r(_.navigation.page,_.navigation.subtab),_.cursorTarget){let w=_.cursorTarget,K=w.selector.includes("dialog")||w.selector.includes("api-key-name-input"),ie=w.selector.includes("data-settings-tab"),$=_.navigation?.subtab&&ie&&w.selector.includes(`data-settings-tab="${_.navigation.subtab}"`),ce=w.onClick&&!$,qe=!!_.navigation,tt=(!!_.navigation?.subtab?700:qe?400:0)+(K?700:ie?600:400);setTimeout(()=>{let ea=he.current;if(!ea||ea.id!==v.id||ea.stepIndex!==E)return;let W=()=>{let z=he.current;if(!z||z.id!==v.id||z.stepIndex!==E)return;let ae=document.querySelector(w.selector);ae&&ae.offsetParent!==null?($r(w),ce&&setTimeout(()=>{let fe=he.current;!fe||fe.id!==v.id||fe.stepIndex!==E||ae.click()},1e3)):K||ie||w.selector.includes("data-testid")?setTimeout(W,200):($r(w),ce&&setTimeout(()=>{let fe=he.current;if(!fe||fe.id!==v.id||fe.stepIndex!==E)return;let yt=document.querySelector(w.selector);yt&&yt.click()},1e3))};W()},tt)}else Do();Aa(te.id,_.text)}function fS(){if(!Z)return;let v=qm[Z.id];if(!v)return;let b=Z.stepIndex-1;if(b>=0){Jt({id:Z.id,stepIndex:b});let U=v.steps[b];U.navigation&&r&&r(U.navigation.page,U.navigation.subtab),U.cursorTarget?setTimeout(()=>{$r(U.cursorTarget)},500):Do();let E=u.filter(_=>_.kind!=="guideStep"&&_.kind!=="guideComplete");d([...E,{id:Date.now(),role:"assistant",kind:"guideStep",content:U.text}])}}return(0,p.jsxs)("section",{className:`fixed top-0 right-0 z-40 flex flex-col bg-white border-l border-gray-200 h-full overflow-hidden transition-transform duration-300 ${e?"translate-x-0":"translate-x-full"}`,style:{width:`${Wm}px`},children:[(0,p.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,p.jsx)(Rr,{className:"h-3.5 w-3.5 text-black",fill:"currentColor"}),(0,p.jsx)("h3",{className:"text-sm font-semibold text-gray-800",children:"Copilot"})]}),(0,p.jsx)("div",{className:"flex items-center gap-1",children:(0,p.jsx)(Ot,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",onClick:()=>{d([]),D("landing"),O(void 0),Jt(void 0),he.current=void 0,gt(!1)},children:(0,p.jsx)(kt,{className:"h-3.5 w-3.5"})})})]}),(0,p.jsx)("div",{className:C?"grid flex-1 place-items-center transition-all duration-300":"flex flex-1 flex-col transition-all duration-300 min-h-0 overflow-hidden",children:C?(0,p.jsxs)("div",{className:"w-full overflow-y-auto px-4",children:[(0,p.jsx)("div",{className:"py-4 transition-all duration-300",children:(0,p.jsx)("h2",{className:"text-center text-2xl font-semibold text-gray-900",children:T==="folder"?aS.find(v=>v.id===A)?.title||"":"What can I help with?"})}),(0,p.jsxs)("div",{className:"pb-4",children:[T==="landing"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider text-gray-400",children:"Suggested Questions"}),(0,p.jsx)("div",{className:"flex flex-col gap-1",children:se?(0,p.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,p.jsx)(Vt,{className:"h-4 w-4 animate-spin text-gray-400"})}):V.map((v,b)=>{let U=["bg-blue-400","bg-green-400","bg-purple-400","bg-orange-400","bg-pink-400"];return(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"ghost",className:"w-full justify-start rounded-lg px-3 py-2 text-xs text-gray-700 hover:bg-gray-100 h-auto",onClick:()=>Ym(v.prompt),children:[(0,p.jsx)("span",{className:`mr-2 inline-block h-1.5 w-1.5 rounded-full ${U[b%U.length]}`}),v.label]},v.id)})})]}),T==="folder"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,p.jsx)(Ot,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 rounded-full hover:bg-gray-100",onClick:sS,"aria-label":"Back to suggestions",children:(0,p.jsx)(gn,{className:"h-4 w-4 text-gray-500"})}),(0,p.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-gray-400",children:"Topics"})]}),(0,p.jsx)("div",{className:"flex flex-col gap-1.5",children:aS.find(v=>v.id===A)?.topics.map(v=>(0,p.jsx)(Ot,{type:"button",size:"sm",variant:"secondary",className:"justify-start rounded-xl border border-gray-200 bg-gray-50 px-3 py-2.5 text-xs text-gray-700 shadow-none transition-all hover:bg-gray-100 hover:border-gray-300 h-auto",onClick:()=>Ym(v.prompt),children:v.label},v.id))})]})]})]}):(0,p.jsx)(p.Fragment,{children:(0,p.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,p.jsx)(Op,{ref:tc,className:"h-full",children:(0,p.jsxs)("div",{className:"flex flex-col gap-2 px-4 py-3",children:[u.map((v,b)=>{let U=v.role==="user",E=b>0?u[b-1].role:void 0,_=E!==void 0&&E!==v.role,oe=he.current||Z,te=!1;if(oe&&v.kind==="guideStep"?v.guideStepIndex!==void 0?te=v.guideStepIndex===oe.stepIndex:te=b===u.length-1:v.kind==="guideComplete"&&(te=b===u.length-1),v.kind==="guideStep"&&!te)return null;if(U)return(0,p.jsx)("div",{className:`flex justify-end ${_?"mt-3":""}`,children:(0,p.jsx)("div",{className:"max-w-[260px] rounded-2xl rounded-br-md bg-gray-900 px-3.5 py-2.5 text-sm text-white shadow-sm",children:v.content})},v.id);if(v.kind==="searchSummary")return(0,p.jsx)("div",{className:`${_?"mt-3":""}`,children:(0,p.jsx)(Rv,{title:v.title??"Search results",links:v.links??[]})},v.id);if(v.kind==="guideComplete")return(0,p.jsx)("div",{ref:te?Wi:null,className:`${_?"mt-3":""}`,children:(0,p.jsxs)("div",{className:"flex items-center gap-2 rounded-xl bg-green-50 border border-green-200 px-3 py-2.5 text-sm leading-6",children:[(0,p.jsx)(je,{className:"h-5 w-5 text-green-600 flex-shrink-0"}),(0,p.jsx)("span",{className:"font-medium text-green-800",children:v.content})]})},v.id);if(v.kind==="navigationAction")return(0,p.jsxs)("div",{className:`${_?"mt-3":""}`,children:[(0,p.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700",children:v.content||""}),v.navigationTarget&&(0,p.jsx)("div",{className:"mt-2",children:(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"secondary",className:"h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",onClick:()=>v.navigationTarget&&oc(v.navigationTarget),children:[(0,p.jsx)("span",{children:"Confirm"}),(0,p.jsxs)("span",{className:"flex items-center gap-0.5 text-gray-400",children:[(0,p.jsx)(Ga,{className:"h-3 w-3"}),(0,p.jsx)(ja,{className:"h-3 w-3"})]})]})})]},v.id);if(v.kind==="actionForm"){let P=v.actionType,N=Object.keys(J).length>0?J:v.actionData||{};if(v.isSubmitted){let w="";return P==="updateCompanyInfo"?w="Company information has been updated successfully.":P==="addApiKey"?w="API key has been added successfully.":P==="addCustomer"?w="Customer has been added successfully.":P==="enable2FA"?w="Two-factor authentication has been enabled successfully.":P==="disable2FA"?w="Two-factor authentication has been disabled successfully.":P==="changePassword"?w="Your password has been changed successfully.":P==="revokeSession"?w="Session has been revoked successfully.":P==="toggleNotification"?w="Notification preferences have been updated successfully.":P==="connectIntegration"?w="Integration has been connected successfully.":P==="disconnectIntegration"?w="Integration has been disconnected successfully.":P==="addPaymentMethod"?w="Payment method has been added successfully.":P==="removePaymentMethod"?w="Payment method has been removed successfully.":P==="deleteApiKey"?w="API key has been deleted successfully.":P==="addWebhook"?w="Webhook endpoint has been added successfully.":P==="updateCurrency"?w="Currency preference has been updated successfully.":P==="updateTimezone"?w="Timezone has been updated successfully.":P==="refundPayment"?w="Refund has been processed successfully.":P==="exportCertificate"?w="Certificate of Incorporation has been downloaded successfully.":P==="createSubscription"?w="Subscription has been created successfully.":P==="toggleBlockRule"||P==="enableBlockRule"||P==="disableBlockRule"?w="Block rule has been updated successfully.":w="Action completed successfully.",(0,p.jsx)("div",{className:`${_?"mt-3":""}`,children:(0,p.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-6 text-gray-700",children:w})},v.id)}return(0,p.jsxs)("div",{className:`min-w-0 ${_?"mt-3":""}`,children:[(0,p.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700",children:v.content||""}),P==="updateCompanyInfo"&&(0,p.jsxs)("div",{className:"space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden",children:[(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Company Name"}),(0,p.jsx)(Te,{placeholder:"Acme Corporation",value:N.companyName||"",onChange:w=>ee({...J,companyName:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Email"}),(0,p.jsx)(Te,{type:"email",placeholder:"contact@acme.com",value:N.email||"",onChange:w=>ee({...J,email:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Address"}),(0,p.jsx)(Te,{placeholder:"123 Main St, San Francisco, CA",value:N.address||"",onChange:w=>ee({...J,address:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Phone"}),(0,p.jsx)(Te,{type:"tel",placeholder:"+1 (555) 123-4567",value:N.phone||"",onChange:w=>ee({...J,phone:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Website"}),(0,p.jsx)(Te,{type:"url",placeholder:"https://acme.com",value:N.website||"",onChange:w=>ee({...J,website:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]})]}),P==="addApiKey"&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"API Key Name"}),(0,p.jsx)(Te,{placeholder:"Production Key",value:N.name||"",onChange:w=>ee({...J,name:w.target.value}),className:"h-8 text-xs border-gray-200"})]})}),P==="addCustomer"&&(0,p.jsxs)("div",{className:"space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden",children:[(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Company Name"}),(0,p.jsx)(Te,{placeholder:"Acme Corporation",value:N.name||"",onChange:w=>ee({...J,name:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Email"}),(0,p.jsx)(Te,{type:"email",placeholder:"contact@acme.com",value:N.email||"",onChange:w=>ee({...J,email:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Location"}),(0,p.jsx)(Te,{placeholder:"San Francisco, CA",value:N.location||"",onChange:w=>ee({...J,location:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Subscription Tier"}),(0,p.jsxs)("select",{value:N.subscription||"Starter",onChange:w=>ee({...J,subscription:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"Starter",children:"Starter"}),(0,p.jsx)("option",{value:"Professional",children:"Professional"}),(0,p.jsx)("option",{value:"Enterprise",children:"Enterprise"})]})]})]}),(P==="enable2FA"||P==="disable2FA")&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsx)("p",{className:"text-xs text-black",children:P==="enable2FA"?"This will enable two-factor authentication for your account. You'll need to set up an authenticator app.":"This will disable two-factor authentication for your account. Your account will be less secure."})}),P==="changePassword"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Current Password"}),(0,p.jsx)(Te,{type:"password",value:N.currentPassword||"",onChange:w=>ee({...J,currentPassword:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"New Password"}),(0,p.jsx)(Te,{type:"password",value:N.newPassword||"",onChange:w=>ee({...J,newPassword:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Confirm New Password"}),(0,p.jsx)(Te,{type:"password",value:N.confirmPassword||"",onChange:w=>ee({...J,confirmPassword:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),P==="toggleNotification"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Notification Type"}),(0,p.jsxs)("select",{value:N.notificationType||"paymentReceived",onChange:w=>ee({...J,notificationType:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"paymentReceived",children:"Payment Received"}),(0,p.jsx)("option",{value:"paymentFailed",children:"Payment Failed"}),(0,p.jsx)("option",{value:"invoicePaid",children:"Invoice Paid"}),(0,p.jsx)("option",{value:"monthlySummary",children:"Monthly Summary"}),(0,p.jsx)("option",{value:"productUpdates",children:"Product Updates"})]})]}),(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("input",{type:"checkbox",checked:N.enabled!==!1,onChange:w=>ee({...J,enabled:w.target.checked}),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),(0,p.jsx)("label",{className:"text-xs text-black",children:"Enable this notification"})]})]}),(P==="connectIntegration"||P==="disconnectIntegration")&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Integration"}),(0,p.jsxs)("select",{value:N.integrationName||"Slack",onChange:w=>ee({...J,integrationName:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"Slack",children:"Slack"}),(0,p.jsx)("option",{value:"Zapier",children:"Zapier"}),(0,p.jsx)("option",{value:"Webhook",children:"Webhook"})]})]})}),P==="addPaymentMethod"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Card Number"}),(0,p.jsx)(Te,{placeholder:"1234 5678 9012 3456",value:N.cardNumber||"",onChange:w=>ee({...J,cardNumber:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Expiry Date"}),(0,p.jsx)(Te,{placeholder:"MM/YY",value:N.expiryDate||"",onChange:w=>ee({...J,expiryDate:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),P==="removePaymentMethod"&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsx)("p",{className:"text-xs text-black",children:"This will remove the default payment method from your account."})}),P==="refundPayment"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Transaction ID or Customer Name"}),(0,p.jsx)(Te,{placeholder:"e.g., txn_1234 or Acme Corp",value:N.transactionId||N.customer||"",onChange:w=>{let K=w.target.value;K.startsWith("txn_")||/^\d+$/.test(K)?ee({...J,transactionId:K,customer:void 0}):ee({...J,customer:K,transactionId:void 0})},className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Amount (optional)"}),(0,p.jsx)(Te,{placeholder:"$0.00",value:N.amount||"",onChange:w=>ee({...J,amount:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Reason (optional)"}),(0,p.jsx)(Te,{placeholder:"e.g., Customer request",value:N.reason||"",onChange:w=>ee({...J,reason:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),P==="deleteApiKey"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"API Key Name or ID"}),(0,p.jsx)(Te,{placeholder:"Production Key",value:N.keyId||N.name||"",onChange:w=>ee({...J,keyId:w.target.value,name:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsx)("p",{className:"text-xs text-red-600",children:"Warning: This action cannot be undone. The API key will be permanently deleted."})]}),P==="addWebhook"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Webhook URL"}),(0,p.jsx)(Te,{type:"url",placeholder:"https://example.com/webhook",value:N.url||"",onChange:w=>ee({...J,url:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Name (optional)"}),(0,p.jsx)(Te,{placeholder:"Production Webhook",value:N.name||"",onChange:w=>ee({...J,name:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),P==="updateCurrency"&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Currency"}),(0,p.jsxs)("select",{value:N.currency||"USD",onChange:w=>ee({...J,currency:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"USD",children:"USD ($)"}),(0,p.jsx)("option",{value:"EUR",children:"EUR (\u20AC)"}),(0,p.jsx)("option",{value:"GBP",children:"GBP (\xA3)"}),(0,p.jsx)("option",{value:"JPY",children:"JPY (\xA5)"})]})]})}),P==="updateTimezone"&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Timezone"}),(0,p.jsxs)("select",{value:N.timezone||"America/Los_Angeles",onChange:w=>ee({...J,timezone:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"America/Los_Angeles",children:"Pacific Time (PT)"}),(0,p.jsx)("option",{value:"America/New_York",children:"Eastern Time (ET)"}),(0,p.jsx)("option",{value:"Europe/London",children:"GMT"}),(0,p.jsx)("option",{value:"Asia/Tokyo",children:"JST"})]})]})}),P==="revokeSession"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Device/Session"}),(0,p.jsx)(Te,{placeholder:"MacBook Pro",value:N.device||"",onChange:w=>ee({...J,device:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsx)("p",{className:"text-xs text-black",children:"This will sign out the device and invalidate its session."})]}),P==="createSubscription"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Customer Email"}),(0,p.jsx)(Te,{type:"email",placeholder:"customer@example.com",value:N.customerEmail||"",onChange:w=>ee({...J,customerEmail:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Plan"}),(0,p.jsxs)("select",{value:N.plan||"Starter",onChange:w=>ee({...J,plan:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"Starter",children:"Starter ($29/mo)"}),(0,p.jsx)("option",{value:"Professional",children:"Professional ($99/mo)"}),(0,p.jsx)("option",{value:"Enterprise",children:"Enterprise ($299/mo)"})]})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Billing Cycle"}),(0,p.jsxs)("select",{value:N.billingCycle||"monthly",onChange:w=>ee({...J,billingCycle:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"monthly",children:"Monthly"}),(0,p.jsx)("option",{value:"yearly",children:"Yearly (Save 15%)"})]})]})]}),P==="exportCertificate"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsx)("p",{className:"text-xs text-black",children:"This will export your certificate of incorporation document."}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Format"}),(0,p.jsxs)("select",{value:N.format||"pdf",onChange:w=>ee({...J,format:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"pdf",children:"PDF"}),(0,p.jsx)("option",{value:"json",children:"JSON"})]})]})]}),(P==="toggleBlockRule"||P==="enableBlockRule"||P==="disableBlockRule")&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Block Rule"}),(0,p.jsxs)("select",{value:N.ruleId||"rule_1",onChange:w=>ee({...J,ruleId:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"rule_1",children:"Block if risk level = 'highest'"}),(0,p.jsx)("option",{value:"rule_2",children:"Block if matches Stripe block lists"}),(0,p.jsx)("option",{value:"rule_3",children:"Block if CVC verification fails"}),(0,p.jsx)("option",{value:"rule_4",children:"Block if Postal code verification fails"})]})]}),(0,p.jsx)("p",{className:"text-xs text-black",children:P==="enableBlockRule"?"This will enable the selected block rule to actively block matching payments.":P==="disableBlockRule"?"This will disable the selected block rule. Matching payments will no longer be blocked.":"This will toggle the selected block rule's state."})]}),(0,p.jsx)("div",{className:"mt-3",children:(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"secondary",className:"h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",onClick:nc,children:[(0,p.jsx)("span",{children:"Confirm"}),(0,p.jsxs)("span",{className:"flex items-center gap-0.5 text-gray-400",children:[(0,p.jsx)(Ga,{className:"h-3 w-3"}),(0,p.jsx)(ja,{className:"h-3 w-3"})]})]})})]},v.id)}if(v.kind==="bulkPreview"&&v.csvData)return(0,p.jsxs)("div",{className:`${_?"mt-3":""}`,children:[(0,p.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700",children:v.content||""}),(0,p.jsxs)("div",{className:"bg-gray-50 rounded-lg border border-gray-200 overflow-hidden",children:[(0,p.jsxs)("div",{className:"bg-gray-100 px-3 py-2 border-b border-gray-200 flex items-center gap-2",children:[(0,p.jsx)(xn,{className:"h-4 w-4 text-gray-600"}),(0,p.jsx)("span",{className:"text-xs font-medium text-gray-700",children:v.csvData.fileName}),(0,p.jsxs)("span",{className:"text-xs text-gray-500",children:["\u2022 ",v.csvData.rowCount," rows"]})]}),(0,p.jsxs)("div",{className:"px-3 py-2 border-b border-gray-100",children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"Columns"}),(0,p.jsx)("div",{className:"flex flex-wrap gap-1",children:v.csvData.columns.map((P,N)=>(0,p.jsx)("span",{className:"text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",children:P},N))})]}),v.csvData.sampleRows.length>0&&(0,p.jsxs)("div",{className:"px-3 py-2",children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"Sample Data"}),(0,p.jsx)("div",{className:"space-y-1",children:v.csvData.sampleRows.slice(0,3).map((P,N)=>(0,p.jsxs)("div",{className:"text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",children:[Object.entries(P).slice(0,3).map(([w,K],ie)=>(0,p.jsxs)("span",{children:[ie>0&&" \u2022 ",(0,p.jsxs)("span",{className:"text-gray-400",children:[w,":"]})," ",K]},w)),Object.keys(P).length>3&&(0,p.jsx)("span",{className:"text-gray-400",children:" ..."})]},N))})]}),v.suggestedAction&&(0,p.jsx)("div",{className:"px-3 py-2 bg-blue-50 border-t border-blue-100",children:(0,p.jsxs)("span",{className:"text-xs text-blue-700",children:["Suggested action: ",(0,p.jsx)("strong",{children:v.suggestedAction.replace(/_/g," ")})]})})]}),v.bulkSessionId&&(0,p.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"secondary",className:"h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",onClick:()=>v.bulkSessionId&&ic(v.bulkSessionId),children:[(0,p.jsxs)("span",{children:["Process ",v.csvData.rowCount," rows"]}),(0,p.jsxs)("span",{className:"flex items-center gap-0.5 text-gray-400",children:[(0,p.jsx)(Ga,{className:"h-3 w-3"}),(0,p.jsx)(ja,{className:"h-3 w-3"})]})]}),(0,p.jsx)(Ot,{type:"button",size:"sm",variant:"ghost",className:"h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",onClick:dS,children:"Cancel"})]})]},v.id);if(v.kind==="bulkProgress"&&v.bulkProgress){let{processed:P,total:N,successes:w,failures:K}=v.bulkProgress,ie=Math.round(P/N*100);return(0,p.jsx)("div",{className:`${_?"mt-3":""}`,children:(0,p.jsxs)("div",{className:"bg-gray-50 rounded-lg border border-gray-200 p-3",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,p.jsx)(Vt,{className:"h-4 w-4 animate-spin text-blue-600"}),(0,p.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Processing... ",P," of ",N]})]}),(0,p.jsx)("div",{className:"h-2 bg-gray-200 rounded-full overflow-hidden mb-2",children:(0,p.jsx)("div",{className:"h-full bg-blue-600 transition-all duration-300",style:{width:`${ie}%`}})}),(0,p.jsxs)("div",{className:"flex items-center gap-3 text-xs text-gray-600",children:[(0,p.jsxs)("span",{className:"flex items-center gap-1",children:[(0,p.jsx)(je,{className:"h-3 w-3 text-green-600"}),w," successful"]}),K>0&&(0,p.jsxs)("span",{className:"flex items-center gap-1 text-red-600",children:[(0,p.jsx)(xo,{className:"h-3 w-3"}),K," failed"]})]})]})},v.id)}if(v.kind==="bulkSummary"&&v.bulkSummary){let{total:P,successes:N,failures:w,navigationPage:K}=v.bulkSummary,ie=w.length>0,$=K?.page==="customers"?"Customers":K?.page==="dashboard"?"Dashboard":K?.page==="settings"?"Settings":"Results";return(0,p.jsx)("div",{className:`${_?"mt-3":""}`,children:(0,p.jsxs)("div",{className:`rounded-lg border p-3 ${ie?"bg-amber-50 border-amber-200":"bg-green-50 border-green-200"}`,children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,p.jsx)(je,{className:`h-5 w-5 ${ie?"text-amber-600":"text-green-600"}`}),(0,p.jsx)("span",{className:"text-sm font-medium text-gray-800",children:"Bulk operation complete"})]}),(0,p.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:v.content||`Processed ${P} rows: ${N} successful${ie?`, ${w.length} failed`:""}.`}),(0,p.jsxs)("div",{className:"flex items-center gap-4 text-xs",children:[(0,p.jsxs)("span",{className:"flex items-center gap-1 text-green-700",children:[(0,p.jsx)(je,{className:"h-3 w-3"}),N," successful"]}),ie&&(0,p.jsxs)("span",{className:"flex items-center gap-1 text-red-600",children:[(0,p.jsx)(xo,{className:"h-3 w-3"}),w.length," failed"]})]}),ie&&(0,p.jsxs)("div",{className:"mt-3 pt-2 border-t border-amber-200",children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-amber-700 mb-1",children:"Failed Rows"}),(0,p.jsxs)("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:[w.slice(0,5).map((ce,qe)=>(0,p.jsxs)("div",{className:"text-xs text-red-700 bg-red-50 rounded px-2 py-1",children:["Row ",ce.row,": ",ce.error||"Unknown error"]},qe)),w.length>5&&(0,p.jsxs)("div",{className:"text-xs text-amber-600",children:["...and ",w.length-5," more"]})]})]}),K&&N>0&&(0,p.jsx)("div",{className:"mt-3 pt-2 border-t border-gray-200",children:(0,p.jsxs)("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),console.log("[DEBUG] Button clicked - navigationPage:",K,"onNavigate:",!!r),r&&K.page?(console.log("[DEBUG] Calling onNavigate with page:",K.page),r(K.page,K.subtab)):console.log("[DEBUG] Condition failed - onNavigate:",!!r,"navigationPage.page:",K.page)},className:"flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",children:[(0,p.jsxs)("span",{className:"flex items-center gap-1 px-1.5 py-0.5 bg-gray-100 rounded text-[10px] font-medium text-gray-600 group-hover:bg-gray-200",children:[(0,p.jsx)(Ga,{className:"h-2.5 w-2.5"}),(0,p.jsx)("span",{children:"+"}),(0,p.jsx)(ja,{className:"h-2.5 w-2.5"})]}),(0,p.jsxs)("span",{children:["View ",$]})]})})]})},v.id)}return(0,p.jsx)(j.Fragment,{children:(0,p.jsxs)("div",{ref:te?Wi:null,className:`${_?"mt-3":""}`,children:[(0,p.jsx)("div",{className:"text-sm leading-6 text-gray-700",children:(()=>{let P=v.content||"";if(v.kind==="guideStep"){let N=P.match(/^(Step\s+\d+:)([\s\S]*)/);if(N)return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("strong",{children:N[1]}),N[2]]})}return v.role==="assistant"&&P?sT(P):P||(0,p.jsx)("span",{className:"opacity-70",children:"Thinking\u2026"})})()}),v.role==="assistant"&&v.structuredData&&(0,p.jsx)("div",{className:"mt-3",children:(0,p.jsx)(tS,{type:v.structuredData.type,data:v.structuredData.data})}),v.role==="assistant"&&v.followups&&v.followups.length>0&&!v.followupSelected&&(0,p.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:v.followups.map(P=>(0,p.jsx)("button",{type:"button",onClick:()=>nS(v.id,P),className:`inline-flex items-center px-3 py-1.5 text-xs font-medium rounded-xl
|
|
29
|
+
`),K="",ie="";for(let $ of w)$.startsWith("event: ")?K=$.slice(7):$.startsWith("data: ")&&(ie=$.slice(6));if(!(!K||!ie))try{let $=JSON.parse(ie);if(K==="progress")x([{message:`Processing row ${$.row} of ${$.total}...`,completed:!1}]),d(ce=>ce[ce.length-1]?.kind==="bulkProgress"?ce.map((et,Ra)=>Ra===ce.length-1?{...et,bulkProgress:{processed:$.row,total:$.total,successes:$.successes||0,failures:$.failures||0}}:et):[...ce,{id:Date.now(),role:"assistant",kind:"bulkProgress",bulkProgress:{processed:$.row,total:$.total,successes:$.successes||0,failures:$.failures||0}}]);else if(K==="summary")console.log("[DEBUG] Received summary event - data:",$),console.log("[DEBUG] navigationPage from backend:",$.navigationPage),m("idle"),x([]),rr(null),d(ce=>{let qe=ce.filter(Ra=>Ra.kind!=="bulkProgress"&&Ra.kind!=="bulkPreview"),et={id:Date.now(),role:"assistant",kind:"bulkSummary",content:$.message,bulkSummary:{total:$.total,successes:$.successes,failures:$.failures||[],navigationPage:$.navigationPage}};return console.log("[DEBUG] Creating bulkSummary message:",et),[...qe,et]}),setTimeout(()=>{window.dispatchEvent(new CustomEvent("agentActionComplete",{detail:{result:{bulk:!0,total:$.total,successes:$.successes}}}))},100);else if(K==="error"){m("idle"),x([]),rr(null);let ce={id:Date.now(),role:"assistant",kind:"text",content:$.message||"An error occurred during bulk processing."};d(qe=>[...qe,ce])}}catch($){console.error("Failed to parse confirm SSE event:",$)}}}}catch(b){console.error("Bulk confirm failed:",b),m("idle"),x([]),rr(null);let U={id:Date.now(),role:"assistant",kind:"text",content:"Failed to start bulk operation. Please try again."};d(E=>[...E,U])}}function dS(){rr(null),d(v=>v.filter(b=>b.kind!=="bulkPreview"))}function Ym(v){sc(v)}function cS(v){let b=Date.now()+Math.floor(Math.random()*1e3);d(U=>[...U,{id:b,role:"assistant",kind:"text",content:v}])}function gT(v){let b=qm[v];if(!b)return;D("landing"),O(void 0);let U={id:v,stepIndex:0};Jt(U),he.current=U,cS(`I'll help you with ${b.title}.`);let E=b.steps[0],_=E.cursorTarget?.selector.includes("[data-page="),oe=E.cursorTarget?.selector.includes("[data-settings-tab=");if(E.cursorTarget&&(_||oe)){let P=E.cursorTarget;oe&&E.navigation&&r&&r(E.navigation.page,void 0),setTimeout(()=>{let w=()=>{let K=document.querySelector(P.selector);K&&K.offsetParent!==null?($r(P),P.onClick&&setTimeout(()=>{K.click()},1200)):setTimeout(w,200)};w()},oe?800:400)}else if(E.navigation&&r&&r(E.navigation.page,E.navigation.subtab),E.cursorTarget){let P=E.cursorTarget,N=P.selector.includes("data-settings-tab"),w=P.selector.includes("dialog")||P.selector.includes("api-key-name-input");setTimeout(()=>{let ie=()=>{let $=document.querySelector(P.selector);$&&$.offsetParent!==null?($r(P),P.onClick&&setTimeout(()=>{$.click()},1e3)):N||w?setTimeout(ie,200):($r(P),P.onClick&&setTimeout(()=>{let ce=document.querySelector(P.selector);ce&&ce.click()},1e3))};ie()},w?700:N?600:400)}let te={id:Date.now()+1,role:"assistant",kind:"guideStep",content:"",guideStepIndex:0};d(P=>[...P,te]),Aa(te.id,E.text)}function lc(){if(!Z)return;let v=qm[Z.id];if(!v)return;let b=he.current;(!b||b.id!==Z.id)&&(b=Z,he.current=Z);let E=b.stepIndex+1;if(E>=v.steps.length){Do();let w=Date.now()+1;d(K=>[...K,{id:w,role:"assistant",kind:"guideComplete",content:"Guide Complete"}]),Jt(void 0),gt(!0);return}let _=v.steps[E],oe={id:Z.id,stepIndex:E};Jt(oe),he.current=oe;let te={id:Date.now()+1,role:"assistant",kind:"guideStep",content:"",guideStepIndex:E};d(w=>[...w,te]);let P=_.cursorTarget?.selector.includes("[data-page="),N=_.cursorTarget?.selector.includes("[data-settings-tab=");if(_.cursorTarget&&(P||N)){let w=_.cursorTarget;N&&_.navigation&&r&&r(_.navigation.page,void 0),setTimeout(()=>{let ie=he.current;if(!ie||ie.id!==v.id||ie.stepIndex!==E)return;let $=()=>{let ce=he.current;if(!ce||ce.id!==v.id||ce.stepIndex!==E)return;let qe=document.querySelector(w.selector);qe&&qe.offsetParent!==null?($r(w),w.onClick&&setTimeout(()=>{let et=he.current;!et||et.id!==v.id||et.stepIndex!==E||qe.click()},1200)):setTimeout($,200)};$()},N?800:400)}else if(_.navigation&&r&&r(_.navigation.page,_.navigation.subtab),_.cursorTarget){let w=_.cursorTarget,K=w.selector.includes("dialog")||w.selector.includes("api-key-name-input"),ie=w.selector.includes("data-settings-tab"),$=_.navigation?.subtab&&ie&&w.selector.includes(`data-settings-tab="${_.navigation.subtab}"`),ce=w.onClick&&!$,qe=!!_.navigation,tt=(!!_.navigation?.subtab?700:qe?400:0)+(K?700:ie?600:400);setTimeout(()=>{let ea=he.current;if(!ea||ea.id!==v.id||ea.stepIndex!==E)return;let W=()=>{let z=he.current;if(!z||z.id!==v.id||z.stepIndex!==E)return;let ae=document.querySelector(w.selector);ae&&ae.offsetParent!==null?($r(w),ce&&setTimeout(()=>{let fe=he.current;!fe||fe.id!==v.id||fe.stepIndex!==E||ae.click()},1e3)):K||ie||w.selector.includes("data-testid")?setTimeout(W,200):($r(w),ce&&setTimeout(()=>{let fe=he.current;if(!fe||fe.id!==v.id||fe.stepIndex!==E)return;let yt=document.querySelector(w.selector);yt&&yt.click()},1e3))};W()},tt)}else Do();Aa(te.id,_.text)}function fS(){if(!Z)return;let v=qm[Z.id];if(!v)return;let b=Z.stepIndex-1;if(b>=0){Jt({id:Z.id,stepIndex:b});let U=v.steps[b];U.navigation&&r&&r(U.navigation.page,U.navigation.subtab),U.cursorTarget?setTimeout(()=>{$r(U.cursorTarget)},500):Do();let E=u.filter(_=>_.kind!=="guideStep"&&_.kind!=="guideComplete");d([...E,{id:Date.now(),role:"assistant",kind:"guideStep",content:U.text}])}}return(0,p.jsxs)("section",{className:`fixed top-0 right-0 z-40 flex flex-col bg-white border-l border-gray-200 h-full overflow-hidden transition-transform duration-300 ${e?"translate-x-0":"translate-x-full"}`,style:{width:`${Wm}px`},children:[(0,p.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 bg-gradient-to-r from-gray-50 to-white shrink-0",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,p.jsx)(Rr,{className:"h-3.5 w-3.5 text-black",fill:"currentColor"}),(0,p.jsx)("h3",{className:"text-sm font-semibold text-gray-800",children:"Copilot"})]}),(0,p.jsx)("div",{className:"flex items-center gap-1",children:(0,p.jsx)(Ot,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",onClick:()=>{d([]),D("landing"),O(void 0),Jt(void 0),he.current=void 0,gt(!1)},children:(0,p.jsx)(kt,{className:"h-3.5 w-3.5"})})})]}),(0,p.jsx)("div",{className:C?"grid flex-1 place-items-center transition-all duration-300":"flex flex-1 flex-col transition-all duration-300 min-h-0 overflow-hidden",children:C?(0,p.jsxs)("div",{className:"w-full overflow-y-auto px-4",children:[(0,p.jsx)("div",{className:"py-3 transition-all duration-300",children:(0,p.jsx)("h2",{className:"text-center text-2xl font-semibold text-gray-900",children:T==="folder"?aS.find(v=>v.id===A)?.title||"":"How can I help?"})}),(0,p.jsxs)("div",{className:"pb-4 px-4",children:[T==="landing"&&(0,p.jsx)(p.Fragment,{children:(0,p.jsx)("div",{className:"flex flex-col gap-1",children:se?(0,p.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,p.jsx)(Vt,{className:"h-4 w-4 animate-spin text-gray-400"})}):V.map((v,b)=>{let U=["bg-blue-400","bg-green-400","bg-purple-400","bg-orange-400","bg-pink-400"];return(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"ghost",className:"w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",onClick:()=>Ym(v.prompt),children:[(0,p.jsx)("span",{className:`mr-2 inline-block h-1.5 w-1.5 rounded-full ${U[b%U.length]}`}),v.label]},v.id)})})}),T==="folder"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,p.jsx)(Ot,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 rounded-full hover:bg-gray-100",onClick:sS,"aria-label":"Back to suggestions",children:(0,p.jsx)(gn,{className:"h-4 w-4 text-gray-500"})}),(0,p.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-gray-400",children:"Topics"})]}),(0,p.jsx)("div",{className:"flex flex-col gap-1.5",children:aS.find(v=>v.id===A)?.topics.map(v=>(0,p.jsx)(Ot,{type:"button",size:"sm",variant:"secondary",className:"justify-start rounded-xl border border-gray-200 bg-gray-50 px-3 py-2.5 text-xs text-gray-700 shadow-none transition-all hover:bg-gray-100 hover:border-gray-300 h-auto",onClick:()=>Ym(v.prompt),children:v.label},v.id))})]})]})]}):(0,p.jsx)(p.Fragment,{children:(0,p.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,p.jsx)(Op,{ref:tc,className:"h-full",children:(0,p.jsxs)("div",{className:"flex flex-col gap-2 px-4 py-3",children:[u.map((v,b)=>{let U=v.role==="user",E=b>0?u[b-1].role:void 0,_=E!==void 0&&E!==v.role,oe=he.current||Z,te=!1;if(oe&&v.kind==="guideStep"?v.guideStepIndex!==void 0?te=v.guideStepIndex===oe.stepIndex:te=b===u.length-1:v.kind==="guideComplete"&&(te=b===u.length-1),v.kind==="guideStep"&&!te)return null;if(U)return(0,p.jsx)("div",{className:`flex justify-end ${_?"mt-3":""}`,children:(0,p.jsx)("div",{className:"max-w-[260px] rounded-2xl rounded-br-md bg-gray-900 px-3.5 py-2.5 text-sm text-white shadow-sm",children:v.content})},v.id);if(v.kind==="searchSummary")return(0,p.jsx)("div",{className:`${_?"mt-3":""}`,children:(0,p.jsx)(Rv,{title:v.title??"Search results",links:v.links??[]})},v.id);if(v.kind==="guideComplete")return(0,p.jsx)("div",{ref:te?Wi:null,className:`${_?"mt-3":""}`,children:(0,p.jsxs)("div",{className:"flex items-center gap-2 rounded-xl bg-green-50 border border-green-200 px-3 py-2.5 text-sm leading-6",children:[(0,p.jsx)(je,{className:"h-5 w-5 text-green-600 flex-shrink-0"}),(0,p.jsx)("span",{className:"font-medium text-green-800",children:v.content})]})},v.id);if(v.kind==="navigationAction")return(0,p.jsxs)("div",{className:`${_?"mt-3":""}`,children:[(0,p.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-6 mb-2 text-gray-700",children:v.content||""}),v.navigationTarget&&(0,p.jsx)("div",{className:"mt-2",children:(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"secondary",className:"h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",onClick:()=>v.navigationTarget&&oc(v.navigationTarget),children:[(0,p.jsx)("span",{children:"Confirm"}),(0,p.jsxs)("span",{className:"flex items-center gap-0.5 text-gray-400",children:[(0,p.jsx)(Ga,{className:"h-3 w-3"}),(0,p.jsx)(ja,{className:"h-3 w-3"})]})]})})]},v.id);if(v.kind==="actionForm"){let P=v.actionType,N=Object.keys(J).length>0?J:v.actionData||{};if(v.isSubmitted){let w="";return P==="updateCompanyInfo"?w="Company information has been updated successfully.":P==="addApiKey"?w="API key has been added successfully.":P==="addCustomer"?w="Customer has been added successfully.":P==="enable2FA"?w="Two-factor authentication has been enabled successfully.":P==="disable2FA"?w="Two-factor authentication has been disabled successfully.":P==="changePassword"?w="Your password has been changed successfully.":P==="revokeSession"?w="Session has been revoked successfully.":P==="toggleNotification"?w="Notification preferences have been updated successfully.":P==="connectIntegration"?w="Integration has been connected successfully.":P==="disconnectIntegration"?w="Integration has been disconnected successfully.":P==="addPaymentMethod"?w="Payment method has been added successfully.":P==="removePaymentMethod"?w="Payment method has been removed successfully.":P==="deleteApiKey"?w="API key has been deleted successfully.":P==="addWebhook"?w="Webhook endpoint has been added successfully.":P==="updateCurrency"?w="Currency preference has been updated successfully.":P==="updateTimezone"?w="Timezone has been updated successfully.":P==="refundPayment"?w="Refund has been processed successfully.":P==="exportCertificate"?w="Certificate of Incorporation has been downloaded successfully.":P==="createSubscription"?w="Subscription has been created successfully.":P==="toggleBlockRule"||P==="enableBlockRule"||P==="disableBlockRule"?w="Block rule has been updated successfully.":w="Action completed successfully.",(0,p.jsx)("div",{className:`${_?"mt-3":""}`,children:(0,p.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-6 text-gray-700",children:w})},v.id)}return(0,p.jsxs)("div",{className:`min-w-0 ${_?"mt-3":""}`,children:[(0,p.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700",children:v.content||""}),P==="updateCompanyInfo"&&(0,p.jsxs)("div",{className:"space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden",children:[(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Company Name"}),(0,p.jsx)(Te,{placeholder:"Acme Corporation",value:N.companyName||"",onChange:w=>ee({...J,companyName:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Email"}),(0,p.jsx)(Te,{type:"email",placeholder:"contact@acme.com",value:N.email||"",onChange:w=>ee({...J,email:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Address"}),(0,p.jsx)(Te,{placeholder:"123 Main St, San Francisco, CA",value:N.address||"",onChange:w=>ee({...J,address:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Phone"}),(0,p.jsx)(Te,{type:"tel",placeholder:"+1 (555) 123-4567",value:N.phone||"",onChange:w=>ee({...J,phone:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Website"}),(0,p.jsx)(Te,{type:"url",placeholder:"https://acme.com",value:N.website||"",onChange:w=>ee({...J,website:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]})]}),P==="addApiKey"&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"API Key Name"}),(0,p.jsx)(Te,{placeholder:"Production Key",value:N.name||"",onChange:w=>ee({...J,name:w.target.value}),className:"h-8 text-xs border-gray-200"})]})}),P==="addCustomer"&&(0,p.jsxs)("div",{className:"space-y-2 bg-gray-50 rounded-lg p-2 border border-gray-200 overflow-hidden",children:[(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Company Name"}),(0,p.jsx)(Te,{placeholder:"Acme Corporation",value:N.name||"",onChange:w=>ee({...J,name:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Email"}),(0,p.jsx)(Te,{type:"email",placeholder:"contact@acme.com",value:N.email||"",onChange:w=>ee({...J,email:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Location"}),(0,p.jsx)(Te,{placeholder:"San Francisco, CA",value:N.location||"",onChange:w=>ee({...J,location:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Subscription Tier"}),(0,p.jsxs)("select",{value:N.subscription||"Starter",onChange:w=>ee({...J,subscription:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"Starter",children:"Starter"}),(0,p.jsx)("option",{value:"Professional",children:"Professional"}),(0,p.jsx)("option",{value:"Enterprise",children:"Enterprise"})]})]})]}),(P==="enable2FA"||P==="disable2FA")&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsx)("p",{className:"text-xs text-black",children:P==="enable2FA"?"This will enable two-factor authentication for your account. You'll need to set up an authenticator app.":"This will disable two-factor authentication for your account. Your account will be less secure."})}),P==="changePassword"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Current Password"}),(0,p.jsx)(Te,{type:"password",value:N.currentPassword||"",onChange:w=>ee({...J,currentPassword:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"New Password"}),(0,p.jsx)(Te,{type:"password",value:N.newPassword||"",onChange:w=>ee({...J,newPassword:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Confirm New Password"}),(0,p.jsx)(Te,{type:"password",value:N.confirmPassword||"",onChange:w=>ee({...J,confirmPassword:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),P==="toggleNotification"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Notification Type"}),(0,p.jsxs)("select",{value:N.notificationType||"paymentReceived",onChange:w=>ee({...J,notificationType:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"paymentReceived",children:"Payment Received"}),(0,p.jsx)("option",{value:"paymentFailed",children:"Payment Failed"}),(0,p.jsx)("option",{value:"invoicePaid",children:"Invoice Paid"}),(0,p.jsx)("option",{value:"monthlySummary",children:"Monthly Summary"}),(0,p.jsx)("option",{value:"productUpdates",children:"Product Updates"})]})]}),(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("input",{type:"checkbox",checked:N.enabled!==!1,onChange:w=>ee({...J,enabled:w.target.checked}),className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),(0,p.jsx)("label",{className:"text-xs text-black",children:"Enable this notification"})]})]}),(P==="connectIntegration"||P==="disconnectIntegration")&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Integration"}),(0,p.jsxs)("select",{value:N.integrationName||"Slack",onChange:w=>ee({...J,integrationName:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"Slack",children:"Slack"}),(0,p.jsx)("option",{value:"Zapier",children:"Zapier"}),(0,p.jsx)("option",{value:"Webhook",children:"Webhook"})]})]})}),P==="addPaymentMethod"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Card Number"}),(0,p.jsx)(Te,{placeholder:"1234 5678 9012 3456",value:N.cardNumber||"",onChange:w=>ee({...J,cardNumber:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Expiry Date"}),(0,p.jsx)(Te,{placeholder:"MM/YY",value:N.expiryDate||"",onChange:w=>ee({...J,expiryDate:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),P==="removePaymentMethod"&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsx)("p",{className:"text-xs text-black",children:"This will remove the default payment method from your account."})}),P==="refundPayment"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Transaction ID or Customer Name"}),(0,p.jsx)(Te,{placeholder:"e.g., txn_1234 or Acme Corp",value:N.transactionId||N.customer||"",onChange:w=>{let K=w.target.value;K.startsWith("txn_")||/^\d+$/.test(K)?ee({...J,transactionId:K,customer:void 0}):ee({...J,customer:K,transactionId:void 0})},className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Amount (optional)"}),(0,p.jsx)(Te,{placeholder:"$0.00",value:N.amount||"",onChange:w=>ee({...J,amount:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Reason (optional)"}),(0,p.jsx)(Te,{placeholder:"e.g., Customer request",value:N.reason||"",onChange:w=>ee({...J,reason:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),P==="deleteApiKey"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"API Key Name or ID"}),(0,p.jsx)(Te,{placeholder:"Production Key",value:N.keyId||N.name||"",onChange:w=>ee({...J,keyId:w.target.value,name:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsx)("p",{className:"text-xs text-red-600",children:"Warning: This action cannot be undone. The API key will be permanently deleted."})]}),P==="addWebhook"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Webhook URL"}),(0,p.jsx)(Te,{type:"url",placeholder:"https://example.com/webhook",value:N.url||"",onChange:w=>ee({...J,url:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Name (optional)"}),(0,p.jsx)(Te,{placeholder:"Production Webhook",value:N.name||"",onChange:w=>ee({...J,name:w.target.value}),className:"h-8 text-xs border-gray-200"})]})]}),P==="updateCurrency"&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Currency"}),(0,p.jsxs)("select",{value:N.currency||"USD",onChange:w=>ee({...J,currency:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"USD",children:"USD ($)"}),(0,p.jsx)("option",{value:"EUR",children:"EUR (\u20AC)"}),(0,p.jsx)("option",{value:"GBP",children:"GBP (\xA3)"}),(0,p.jsx)("option",{value:"JPY",children:"JPY (\xA5)"})]})]})}),P==="updateTimezone"&&(0,p.jsx)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Timezone"}),(0,p.jsxs)("select",{value:N.timezone||"America/Los_Angeles",onChange:w=>ee({...J,timezone:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"America/Los_Angeles",children:"Pacific Time (PT)"}),(0,p.jsx)("option",{value:"America/New_York",children:"Eastern Time (ET)"}),(0,p.jsx)("option",{value:"Europe/London",children:"GMT"}),(0,p.jsx)("option",{value:"Asia/Tokyo",children:"JST"})]})]})}),P==="revokeSession"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Device/Session"}),(0,p.jsx)(Te,{placeholder:"MacBook Pro",value:N.device||"",onChange:w=>ee({...J,device:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsx)("p",{className:"text-xs text-black",children:"This will sign out the device and invalidate its session."})]}),P==="createSubscription"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Customer Email"}),(0,p.jsx)(Te,{type:"email",placeholder:"customer@example.com",value:N.customerEmail||"",onChange:w=>ee({...J,customerEmail:w.target.value}),className:"h-8 text-xs border-gray-200"})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Plan"}),(0,p.jsxs)("select",{value:N.plan||"Starter",onChange:w=>ee({...J,plan:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"Starter",children:"Starter ($29/mo)"}),(0,p.jsx)("option",{value:"Professional",children:"Professional ($99/mo)"}),(0,p.jsx)("option",{value:"Enterprise",children:"Enterprise ($299/mo)"})]})]}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Billing Cycle"}),(0,p.jsxs)("select",{value:N.billingCycle||"monthly",onChange:w=>ee({...J,billingCycle:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"monthly",children:"Monthly"}),(0,p.jsx)("option",{value:"yearly",children:"Yearly (Save 15%)"})]})]})]}),P==="exportCertificate"&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsx)("p",{className:"text-xs text-black",children:"This will export your certificate of incorporation document."}),(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Format"}),(0,p.jsxs)("select",{value:N.format||"pdf",onChange:w=>ee({...J,format:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"pdf",children:"PDF"}),(0,p.jsx)("option",{value:"json",children:"JSON"})]})]})]}),(P==="toggleBlockRule"||P==="enableBlockRule"||P==="disableBlockRule")&&(0,p.jsxs)("div",{className:"space-y-3 bg-gray-50 rounded-lg p-3 border border-gray-200",children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("label",{className:"text-xs font-medium text-black mb-1.5 block",children:"Block Rule"}),(0,p.jsxs)("select",{value:N.ruleId||"rule_1",onChange:w=>ee({...J,ruleId:w.target.value}),className:"h-8 w-full rounded-md border border-gray-200 bg-transparent px-3 py-1 text-xs shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none",children:[(0,p.jsx)("option",{value:"rule_1",children:"Block if risk level = 'highest'"}),(0,p.jsx)("option",{value:"rule_2",children:"Block if matches Stripe block lists"}),(0,p.jsx)("option",{value:"rule_3",children:"Block if CVC verification fails"}),(0,p.jsx)("option",{value:"rule_4",children:"Block if Postal code verification fails"})]})]}),(0,p.jsx)("p",{className:"text-xs text-black",children:P==="enableBlockRule"?"This will enable the selected block rule to actively block matching payments.":P==="disableBlockRule"?"This will disable the selected block rule. Matching payments will no longer be blocked.":"This will toggle the selected block rule's state."})]}),(0,p.jsx)("div",{className:"mt-3",children:(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"secondary",className:"h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",onClick:nc,children:[(0,p.jsx)("span",{children:"Confirm"}),(0,p.jsxs)("span",{className:"flex items-center gap-0.5 text-gray-400",children:[(0,p.jsx)(Ga,{className:"h-3 w-3"}),(0,p.jsx)(ja,{className:"h-3 w-3"})]})]})})]},v.id)}if(v.kind==="bulkPreview"&&v.csvData)return(0,p.jsxs)("div",{className:`${_?"mt-3":""}`,children:[(0,p.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-6 mb-3 text-gray-700",children:v.content||""}),(0,p.jsxs)("div",{className:"bg-gray-50 rounded-lg border border-gray-200 overflow-hidden",children:[(0,p.jsxs)("div",{className:"bg-gray-100 px-3 py-2 border-b border-gray-200 flex items-center gap-2",children:[(0,p.jsx)(xn,{className:"h-4 w-4 text-gray-600"}),(0,p.jsx)("span",{className:"text-xs font-medium text-gray-700",children:v.csvData.fileName}),(0,p.jsxs)("span",{className:"text-xs text-gray-500",children:["\u2022 ",v.csvData.rowCount," rows"]})]}),(0,p.jsxs)("div",{className:"px-3 py-2 border-b border-gray-100",children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"Columns"}),(0,p.jsx)("div",{className:"flex flex-wrap gap-1",children:v.csvData.columns.map((P,N)=>(0,p.jsx)("span",{className:"text-xs bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded",children:P},N))})]}),v.csvData.sampleRows.length>0&&(0,p.jsxs)("div",{className:"px-3 py-2",children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-gray-500 mb-1",children:"Sample Data"}),(0,p.jsx)("div",{className:"space-y-1",children:v.csvData.sampleRows.slice(0,3).map((P,N)=>(0,p.jsxs)("div",{className:"text-xs text-gray-600 bg-white rounded px-2 py-1 border border-gray-100",children:[Object.entries(P).slice(0,3).map(([w,K],ie)=>(0,p.jsxs)("span",{children:[ie>0&&" \u2022 ",(0,p.jsxs)("span",{className:"text-gray-400",children:[w,":"]})," ",K]},w)),Object.keys(P).length>3&&(0,p.jsx)("span",{className:"text-gray-400",children:" ..."})]},N))})]}),v.suggestedAction&&(0,p.jsx)("div",{className:"px-3 py-2 bg-blue-50 border-t border-blue-100",children:(0,p.jsxs)("span",{className:"text-xs text-blue-700",children:["Suggested action: ",(0,p.jsx)("strong",{children:v.suggestedAction.replace(/_/g," ")})]})})]}),v.bulkSessionId&&(0,p.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"secondary",className:"h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",onClick:()=>v.bulkSessionId&&ic(v.bulkSessionId),children:[(0,p.jsxs)("span",{children:["Process ",v.csvData.rowCount," rows"]}),(0,p.jsxs)("span",{className:"flex items-center gap-0.5 text-gray-400",children:[(0,p.jsx)(Ga,{className:"h-3 w-3"}),(0,p.jsx)(ja,{className:"h-3 w-3"})]})]}),(0,p.jsx)(Ot,{type:"button",size:"sm",variant:"ghost",className:"h-8 rounded-xl px-3 text-xs text-gray-500 hover:text-gray-700 hover:bg-gray-100",onClick:dS,children:"Cancel"})]})]},v.id);if(v.kind==="bulkProgress"&&v.bulkProgress){let{processed:P,total:N,successes:w,failures:K}=v.bulkProgress,ie=Math.round(P/N*100);return(0,p.jsx)("div",{className:`${_?"mt-3":""}`,children:(0,p.jsxs)("div",{className:"bg-gray-50 rounded-lg border border-gray-200 p-3",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,p.jsx)(Vt,{className:"h-4 w-4 animate-spin text-blue-600"}),(0,p.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Processing... ",P," of ",N]})]}),(0,p.jsx)("div",{className:"h-2 bg-gray-200 rounded-full overflow-hidden mb-2",children:(0,p.jsx)("div",{className:"h-full bg-blue-600 transition-all duration-300",style:{width:`${ie}%`}})}),(0,p.jsxs)("div",{className:"flex items-center gap-3 text-xs text-gray-600",children:[(0,p.jsxs)("span",{className:"flex items-center gap-1",children:[(0,p.jsx)(je,{className:"h-3 w-3 text-green-600"}),w," successful"]}),K>0&&(0,p.jsxs)("span",{className:"flex items-center gap-1 text-red-600",children:[(0,p.jsx)(xo,{className:"h-3 w-3"}),K," failed"]})]})]})},v.id)}if(v.kind==="bulkSummary"&&v.bulkSummary){let{total:P,successes:N,failures:w,navigationPage:K}=v.bulkSummary,ie=w.length>0,$=K?.page==="customers"?"Customers":K?.page==="dashboard"?"Dashboard":K?.page==="settings"?"Settings":"Results";return(0,p.jsx)("div",{className:`${_?"mt-3":""}`,children:(0,p.jsxs)("div",{className:`rounded-lg border p-3 ${ie?"bg-amber-50 border-amber-200":"bg-green-50 border-green-200"}`,children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,p.jsx)(je,{className:`h-5 w-5 ${ie?"text-amber-600":"text-green-600"}`}),(0,p.jsx)("span",{className:"text-sm font-medium text-gray-800",children:"Bulk operation complete"})]}),(0,p.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:v.content||`Processed ${P} rows: ${N} successful${ie?`, ${w.length} failed`:""}.`}),(0,p.jsxs)("div",{className:"flex items-center gap-4 text-xs",children:[(0,p.jsxs)("span",{className:"flex items-center gap-1 text-green-700",children:[(0,p.jsx)(je,{className:"h-3 w-3"}),N," successful"]}),ie&&(0,p.jsxs)("span",{className:"flex items-center gap-1 text-red-600",children:[(0,p.jsx)(xo,{className:"h-3 w-3"}),w.length," failed"]})]}),ie&&(0,p.jsxs)("div",{className:"mt-3 pt-2 border-t border-amber-200",children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-amber-700 mb-1",children:"Failed Rows"}),(0,p.jsxs)("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:[w.slice(0,5).map((ce,qe)=>(0,p.jsxs)("div",{className:"text-xs text-red-700 bg-red-50 rounded px-2 py-1",children:["Row ",ce.row,": ",ce.error||"Unknown error"]},qe)),w.length>5&&(0,p.jsxs)("div",{className:"text-xs text-amber-600",children:["...and ",w.length-5," more"]})]})]}),K&&N>0&&(0,p.jsx)("div",{className:"mt-3 pt-2 border-t border-gray-200",children:(0,p.jsxs)("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),console.log("[DEBUG] Button clicked - navigationPage:",K,"onNavigate:",!!r),r&&K.page?(console.log("[DEBUG] Calling onNavigate with page:",K.page),r(K.page,K.subtab)):console.log("[DEBUG] Condition failed - onNavigate:",!!r,"navigationPage.page:",K.page)},className:"flex items-center gap-2 text-xs text-gray-500 hover:text-gray-700 transition-colors group cursor-pointer",children:[(0,p.jsxs)("span",{className:"flex items-center gap-1 px-1.5 py-0.5 bg-gray-100 rounded text-[10px] font-medium text-gray-600 group-hover:bg-gray-200",children:[(0,p.jsx)(Ga,{className:"h-2.5 w-2.5"}),(0,p.jsx)("span",{children:"+"}),(0,p.jsx)(ja,{className:"h-2.5 w-2.5"})]}),(0,p.jsxs)("span",{children:["View ",$]})]})})]})},v.id)}return(0,p.jsx)(j.Fragment,{children:(0,p.jsxs)("div",{ref:te?Wi:null,className:`${_?"mt-3":""}`,children:[(0,p.jsx)("div",{className:"text-sm leading-6 text-gray-700",children:(()=>{let P=v.content||"";if(v.kind==="guideStep"){let N=P.match(/^(Step\s+\d+:)([\s\S]*)/);if(N)return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("strong",{children:N[1]}),N[2]]})}return v.role==="assistant"&&P?sT(P):P||(0,p.jsx)("span",{className:"opacity-70",children:"Thinking\u2026"})})()}),v.role==="assistant"&&v.structuredData&&(0,p.jsx)("div",{className:"mt-3",children:(0,p.jsx)(tS,{type:v.structuredData.type,data:v.structuredData.data})}),v.role==="assistant"&&v.followups&&v.followups.length>0&&!v.followupSelected&&(0,p.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:v.followups.map(P=>(0,p.jsx)("button",{type:"button",onClick:()=>nS(v.id,P),className:`inline-flex items-center px-3 py-1.5 text-xs font-medium rounded-xl
|
|
30
30
|
bg-white hover:bg-gray-50 text-gray-600 hover:text-gray-800
|
|
31
31
|
border border-gray-200 hover:border-gray-300 shadow-sm
|
|
32
32
|
transition-all duration-150 ease-in-out`,children:P.label},P.id))})]})},v.id)}),(Z||Ve)&&(0,p.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[Z&&Z.stepIndex>0&&(0,p.jsx)(Ot,{type:"button",size:"sm",variant:"secondary",className:"h-7 w-7 rounded-full p-0 bg-gray-100 hover:bg-gray-200 border border-gray-200",onClick:fS,children:(0,p.jsx)(gn,{className:"h-3.5 w-3.5 text-gray-600"})}),(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"secondary",className:"h-8 rounded-xl px-3 text-xs gap-1.5 bg-gray-100 hover:bg-gray-200 border border-gray-200",onClick:Ve?Qm:lc,children:[(0,p.jsx)("span",{children:Ve?"Done":"Next"}),(0,p.jsxs)("span",{className:"flex items-center gap-0.5 text-gray-400",children:[(0,p.jsx)(Ga,{className:"h-3 w-3"}),(0,p.jsx)(ja,{className:"h-3 w-3"})]})]})]}),(I==="thinking"||I==="searching"||I==="executing"||I==="responding")&&(0,p.jsx)("div",{className:`${k==="user"?"mt-3":""}`,children:(0,p.jsx)(Tv,{phase:I,progressSteps:h})}),!Z&&(0,p.jsx)("div",{ref:Km})]})})})})}),(0,p.jsxs)("div",{className:"px-4 py-3 border-t border-gray-100 bg-gray-50/50 shrink-0",children:[Xr&&(0,p.jsxs)("div",{className:"mb-2 flex items-center gap-2 rounded-xl bg-blue-50 border border-blue-200 px-3 py-2",children:[(0,p.jsx)(xn,{className:"h-4 w-4 text-blue-600"}),(0,p.jsx)("span",{className:"text-xs text-blue-700 flex-1 truncate",children:Xr.name}),(0,p.jsx)("button",{type:"button",onClick:()=>{ac(null),Mo.current&&(Mo.current.value="")},className:"text-blue-600 hover:text-blue-800",children:(0,p.jsx)(xo,{className:"h-4 w-4"})})]}),(0,p.jsxs)("form",{onSubmit:iS,className:"w-full",children:[(0,p.jsx)("input",{ref:Mo,type:"file",accept:".csv",className:"hidden",onChange:v=>{let b=v.target.files?.[0];b&&ac(b)}}),(0,p.jsxs)("div",{className:"flex w-full items-center gap-2 rounded-2xl border border-gray-200 bg-white px-3 py-2 shadow-sm",children:[(0,p.jsx)(Ot,{type:"button",size:"icon",variant:"ghost",onClick:()=>Mo.current?.click(),className:"h-8 w-8 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100",title:"Upload CSV for bulk operations",children:(0,p.jsx)(xi,{className:"h-4 w-4"})}),(0,p.jsx)("textarea",{placeholder:Xr?"Describe what to do with this CSV...":"Ask anything...",value:c,onChange:v=>{f(v.target.value),v.target.style.height="24px",v.target.style.height=`${Math.min(120,v.target.scrollHeight)}px`},onKeyDown:v=>{if(v.key==="Enter"&&!v.shiftKey&&!v.metaKey&&!v.ctrlKey){if(v.preventDefault(),c.trim()||Xr){let b=v.currentTarget.closest("form");b&&b.requestSubmit()}return}if((v.metaKey||v.ctrlKey)&&v.key==="Enter"){let b=rc.current;if(b){v.preventDefault(),v.stopPropagation(),ic(b);return}if(He){v.preventDefault(),v.stopPropagation(),nc();return}if(Wt){v.preventDefault(),v.stopPropagation(),oc(Wt);return}if(he.current){v.preventDefault(),v.stopPropagation(),lc();return}}},rows:1,className:"flex-1 border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 text-sm placeholder:text-gray-400 resize-none overflow-y-auto min-h-[24px] max-h-[120px] py-0 leading-6"}),(0,p.jsx)(Ot,{type:"submit",size:"icon",disabled:!c.trim()&&!Xr,className:"h-8 w-8 rounded-full bg-gray-900 hover:bg-gray-800 disabled:bg-gray-300",children:(0,p.jsx)(ci,{className:"h-4 w-4"})})]})]})]}),(0,p.jsx)(ZC,{x:Gi.x,y:Gi.y,visible:Gi.visible,onClick:Gi.onClick})]})}function dT({isOpen:e,onClick:t,className:a=""}){return(0,p.jsx)("button",{type:"button",onClick:t,className:`fixed top-1/2 z-50 flex items-center justify-center w-6 h-16 bg-gray-100 hover:bg-gray-200 border border-gray-200 border-r-0 rounded-l-lg text-gray-600 hover:text-gray-800 shadow-md transition-all duration-300 ${a}`,"aria-label":e?"Close help panel":"Open help panel",style:{right:e?`${Wm}px`:"0px",transform:"translateY(-50%)"},children:e?(0,p.jsx)(mi,{className:"h-4 w-4"}):(0,p.jsx)(hi,{className:"h-4 w-4"})})}function rS({onNavigate:e,onActionComplete:t,currentPage:a,agentUrl:r,startingQuestions:o,startingQuestionsEndpoint:n,defaultOpen:s=!1,isOpen:i,onOpenChange:l}){let[u,d]=j.useState(s),c=i!==void 0?i:u,f=g=>{i===void 0&&d(g),l?.(g)};return j.useEffect(()=>{let g=document.body.style.paddingRight,L=document.body.style.transition;return document.body.style.transition="padding-right 0.3s ease",document.body.style.paddingRight=c?`${Wm}px`:"0px",()=>{document.body.style.paddingRight=g,document.body.style.transition=L}},[c]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(dT,{isOpen:c,onClick:()=>f(!c)}),(0,p.jsx)(uT,{isOpen:c,onClose:()=>f(!1),onNavigate:e,onActionComplete:t,currentPage:a,agentUrl:r,startingQuestions:o,startingQuestionsEndpoint:n})]})}var jm=M(le(),1),fs=null,At=null,qt={};function cT({initialConfig:e}){let[t,a]=(0,Ta.useState)(e),[r,o]=(0,Ta.useState)(e.currentPage||"dashboard"),[n,s]=(0,Ta.useState)(!1),i=(0,Ta.useRef)(!1);return(0,Ta.useEffect)(()=>{i.current=n},[n]),(0,Ta.useEffect)(()=>(qt.setCurrentPage=o,qt.setConfig=l=>a(u=>({...u,...l})),qt.setIsOpen=s,qt.getIsOpen=()=>i.current,()=>{qt={}}),[]),(0,Ta.useEffect)(()=>{t.theme==="dark"?At?.classList.add("dark"):At?.classList.remove("dark")},[t.theme]),(0,jm.jsx)(rS,{isOpen:n,onOpenChange:s,currentPage:r,agentUrl:t.agentUrl,onNavigate:(l,u)=>t.onNavigate?.(l,u),onActionComplete:t.onActionComplete,startingQuestions:t.startingQuestions,startingQuestionsEndpoint:t.startingQuestionsEndpoint})}function fT(){if(console.log("[KiteChat-Debug] injectStyles called",{existingStyle:!!document.getElementById("kite-chat-styles"),cssContentLength:45883}),document.getElementById("kite-chat-styles"))return;let e=document.createElement("style");e.id="kite-chat-styles",e.textContent=`/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */
|
package/dist/index.cjs
CHANGED
|
@@ -2427,29 +2427,26 @@ ${userText}`
|
|
|
2427
2427
|
) })
|
|
2428
2428
|
] }),
|
|
2429
2429
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: isEmpty ? "grid flex-1 place-items-center transition-all duration-300" : "flex flex-1 flex-col transition-all duration-300 min-h-0 overflow-hidden", children: isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "w-full overflow-y-auto px-4", children: [
|
|
2430
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "py-
|
|
2431
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pb-4", children: [
|
|
2432
|
-
panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime9.
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
);
|
|
2451
|
-
}) })
|
|
2452
|
-
] }),
|
|
2430
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "py-3 transition-all duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "text-center text-2xl font-semibold text-gray-900", children: panelView === "folder" ? folders.find((f) => f.id === currentFolderId)?.title || "" : "How can I help?" }) }),
|
|
2431
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pb-4 px-4", children: [
|
|
2432
|
+
panelView === "landing" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-col gap-1", children: loadingQuestions ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.Loader2, { className: "h-4 w-4 animate-spin text-gray-400" }) }) : startingQuestions.map((question, index) => {
|
|
2433
|
+
const iconColors = ["bg-blue-400", "bg-green-400", "bg-purple-400", "bg-orange-400", "bg-pink-400"];
|
|
2434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2435
|
+
Button,
|
|
2436
|
+
{
|
|
2437
|
+
type: "button",
|
|
2438
|
+
size: "sm",
|
|
2439
|
+
variant: "ghost",
|
|
2440
|
+
className: "w-full justify-start rounded-lg px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 h-auto",
|
|
2441
|
+
onClick: () => sendTopic(question.prompt),
|
|
2442
|
+
children: [
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `mr-2 inline-block h-1.5 w-1.5 rounded-full ${iconColors[index % iconColors.length]}` }),
|
|
2444
|
+
question.label
|
|
2445
|
+
]
|
|
2446
|
+
},
|
|
2447
|
+
question.id
|
|
2448
|
+
);
|
|
2449
|
+
}) }) }),
|
|
2453
2450
|
panelView === "folder" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2454
2451
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-3 flex items-center gap-2", children: [
|
|
2455
2452
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
package/dist/index.js
CHANGED