@pillar-ai/sdk 0.1.19 → 0.1.21
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/actions/index.d.ts +1 -1
- package/dist/actions/types.d.ts +89 -0
- package/dist/cli/sync.js +230 -170
- package/dist/components/Progress/ErrorRow.d.ts +12 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/core/Pillar.d.ts +38 -0
- package/dist/index.d.ts +1 -1
- package/dist/pillar.esm.js +1 -1
- package/dist/store/chat.d.ts +10 -0
- package/package.json +10 -2
- package/src/actions/types.ts +98 -0
package/dist/pillar.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
let e=!1;function n(n){e=n,console.log("[Pillar] Debug mode enabled - verbose logging active")}function t(){return e||r()}const r=()=>{if("undefined"!=typeof process&&process.env?.NODE_ENV)return"development"===process.env.NODE_ENV;if("undefined"!=typeof window){const e=window.location?.hostname||"";return"localhost"===e||"127.0.0.1"===e||e.includes(".local")}return!1},i=["[Pillar]","[MCPClient]","[PlanExecutor]"],l=["sdk","handler","network"];class a{constructor(e,n=5e3){this.buffer=[],this.flushTimer=null,this.maxBufferSize=100,this.handleBeforeUnload=()=>{this.flush()},this.mcpClient=e,this.flushIntervalMs=n,this.startFlushTimer(),this.setupUnloadListener()}shouldForward(e){return!!l.includes(e.source)||(!(!e.prefix||!i.some(n=>e.prefix?.startsWith(n)))||"error"===e.level)}bufferEntry(e){const n={level:"info"===e.level?"log":e.level,message:e.prefix?`${e.prefix} ${e.event}`:`[${e.source}] ${e.event}`,data:e.data,timestamp:new Date(e.timestamp).toISOString()};this.buffer.push(n),this.buffer.length>=this.maxBufferSize&&this.flush(),"error"===e.level&&this.flush()}flush(){if(0===this.buffer.length)return;const e=this.buffer.splice(0);this.mcpClient.sendLogBatch(e)}startFlushTimer(){this.flushTimer||(this.flushTimer=setInterval(()=>this.flush(),this.flushIntervalMs))}stopFlushTimer(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}setupUnloadListener(){"undefined"!=typeof window&&window.addEventListener("beforeunload",this.handleBeforeUnload)}removeUnloadListener(){"undefined"!=typeof window&&window.removeEventListener("beforeunload",this.handleBeforeUnload)}destroy(){this.stopFlushTimer(),this.removeUnloadListener(),this.flush(),this.buffer=[]}}const o=new class{constructor(){this.entries=[],this.maxEntries=500,this.listeners=new Set,this.serverForwarder=null,this.forwarderUnsubscribe=null}add(e){const n={...e,timestamp:Date.now()};this.entries.push(n),this.entries.length>this.maxEntries&&(this.entries=this.entries.slice(-this.maxEntries)),this.listeners.forEach(e=>e(this.entries)),t()&&!e.prefix&&this.logToConsole(n),this.serverForwarder?.shouldForward(n)&&this.serverForwarder.bufferEntry(n)}logToConsole(e){const n=`[${new Date(e.timestamp).toISOString().split("T")[1].slice(0,12)}] [${e.source}]`,t=void 0!==e.data?[n,e.event,e.data]:[n,e.event];"error"===e.level?console.error(...t):"warn"===e.level?console.warn(...t):console.log(...t)}enableServerForwarding(e,n){this.disableServerForwarding(),this.serverForwarder=new a(e,n?.flushIntervalMs)}disableServerForwarding(){this.serverForwarder&&(this.serverForwarder.destroy(),this.serverForwarder=null),this.forwarderUnsubscribe&&(this.forwarderUnsubscribe(),this.forwarderUnsubscribe=null)}flush(){this.serverForwarder?.flush()}getEntries(){return[...this.entries]}clear(){this.entries=[],this.listeners.forEach(e=>e(this.entries))}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.disableServerForwarding(),this.entries=[],this.listeners.clear()}};function s(e){if(0===e.length)return{event:""};const n=e[0];let t,r,i=[];"string"==typeof n&&n.startsWith("[")&&n.endsWith("]")&&(t=n,e=e.slice(1));for(const n of e)"string"==typeof n?i.push(n):"object"==typeof n&&null!==n&&(r=n);return{prefix:t,event:i.join(" "),data:r}}function c(e){return e?e.includes("MCPClient")?"network":(e.includes("PlanExecutor"),"sdk"):"sdk"}const p={configure:(e,n)=>{!1!==n?.forwardToServer&&o.enableServerForwarding(e,{flushIntervalMs:n?.flushIntervalMs})},flush:()=>{o.flush()},log:(...e)=>{if(!t())return;const{prefix:n,event:r,data:i}=s(e);console.log(...e),o.add({event:r,data:i,source:c(n),level:"info",prefix:n})},warn:(...e)=>{if(!t())return;const{prefix:n,event:r,data:i}=s(e);console.warn(...e),o.add({event:r,data:i,source:c(n),level:"warn",prefix:n})},error:(...e)=>{const{prefix:n,event:t,data:r}=s(e);console.error(...e),o.add({event:t,data:r,source:c(n),level:"error",prefix:n})},destroy:()=>{o.destroy()}};var d=Object.freeze({__proto__:null,debug:p,debugLog:o,isDebugEnabled:t,setDebugMode:n});class u{constructor(){this.listeners=new Map}on(e,n){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(n),()=>{this.off(e,n)}}off(e,n){const t=this.listeners.get(e);t&&t.delete(n)}emit(e,n){const t=this.listeners.get(e);t&&t.forEach(t=>{try{t(n)}catch(n){p.error(`[Pillar] Error in event handler for "${e}":`,n)}})}removeAllListeners(e){e?this.listeners.delete(e):this.listeners.clear()}}const h={actions:new Map,clientInfo:null};function g(e,n){h.clientInfo={platform:e,version:n}}function m(){return h.clientInfo}function f(e){const n=h.actions.get(e);return n?.handler}function v(e){return h.actions.get(e)}function b(e){return h.actions.has(e)}function _(){return Array.from(h.actions.keys())}function x(e,n,t){const r=[];for(const[e,n]of h.actions){const t={name:e,description:n.description,type:n.type};n.examples?.length&&(t.examples=n.examples),n.path&&(t.path=n.path),n.externalUrl&&(t.external_url=n.externalUrl),n.autoRun&&(t.auto_run=n.autoRun),n.autoComplete&&(t.auto_complete=n.autoComplete),n.returns&&(t.returns_data=n.returns),n.dataSchema&&(t.data_schema=n.dataSchema),n.defaultData&&(t.default_data=n.defaultData),n.requiredContext&&(t.required_context=n.requiredContext),r.push(t)}return{platform:e,version:n,gitSha:t,generatedAt:(new Date).toISOString(),actions:r}}function y(){h.actions.clear(),h.clientInfo=null}function w(){return h.actions.size}class k{constructor(e){this.requestId=0,this._externalUserId="",this.config=e}setExternalUserId(e){this._externalUserId=e}getVisitorId(){if("undefined"==typeof window)return"";const e="pillar_visitor_id";try{let n=localStorage.getItem(e);return n||(n=crypto.randomUUID(),localStorage.setItem(e,n)),n}catch{return""}}getSessionId(){if("undefined"==typeof window)return"";const e="pillar_mcp_session_id";try{let n=sessionStorage.getItem(e);return n||(n=crypto.randomUUID(),sessionStorage.setItem(e,n)),n}catch{return""}}getPageUrl(){return"undefined"==typeof window?"":window.location.href}get baseUrl(){return`${this.config.apiBaseUrl}/mcp/`}get headers(){const e={"Content-Type":"application/json","x-customer-id":this.config.productKey,"x-visitor-id":this.getVisitorId(),"x-page-url":this.getPageUrl()},n=this.getSessionId();return n&&(e["Mcp-Session-Id"]=n),this._externalUserId&&(e["x-external-user-id"]=this._externalUserId),"undefined"!=typeof navigator&&(e["Accept-Language"]=navigator.language||navigator.languages?.[0]||"en"),this.config.platform&&(e["X-Pillar-Platform"]=this.config.platform),this.config.version&&(e["X-Pillar-Action-Version"]=this.config.version),e}nextId(){return++this.requestId}async callTool(e,n){const t=performance.now(),r={jsonrpc:"2.0",id:this.nextId(),method:"tools/call",params:{name:e,arguments:n}};o.add({event:"network:request",data:{method:"tools/call",tool:e,url:this.baseUrl},source:"network",level:"info"});const i=await fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(r)}),l=Math.round(performance.now()-t);if(!i.ok){const e=await i.json().catch(()=>({}));throw o.add({event:"network:response",data:{status:i.status,duration:l,error:e.error?.message},source:"network",level:"error"}),new Error(e.error?.message||`MCP error: ${i.status}`)}const a=await i.json();if(o.add({event:"network:response",data:{status:i.status,duration:l,method:"tools/call",tool:e},source:"network",level:"info"}),a.error)throw new Error(a.error.message);return a.result}async callToolStream(e,n,t,r){const i=performance.now(),l=this.nextId();t.onRequestId?.(l);const a={jsonrpc:"2.0",id:l,method:"tools/call",params:{name:e,arguments:n,stream:!0}};o.add({event:"network:request",data:{method:"tools/call",tool:e,stream:!0,url:this.baseUrl},source:"network",level:"info"});const s=await fetch(this.baseUrl,{method:"POST",headers:{...this.headers,Accept:"text/event-stream"},body:JSON.stringify(a),signal:r}),c=Math.round(performance.now()-i);if(!s.ok){const e=await s.text();throw o.add({event:"network:response",data:{status:s.status,duration:c,error:e},source:"network",level:"error"}),new Error(`MCP streaming request failed: ${s.statusText} - ${e}`)}if(o.add({event:"network:stream:connected",data:{status:s.status,connectionTime:c,tool:e},source:"network",level:"info"}),!s.body)throw new Error("Response body is null");const d=s.body.getReader(),u=new TextDecoder;let h="",g=[],m=null;try{for(;;){const{done:e,value:n}=await d.read();if(e)break;h+=u.decode(n,{stream:!0});const r=h.split("\n");h=r.pop()||"";for(const e of r)if(e.trim()&&e.startsWith("data: "))try{const n=e.substring(6),r=JSON.parse(n);if("2.0"===r.jsonrpc){if(r.error)throw t.onError?.(r.error.message||"Unknown error"),new Error(r.error.message);if("notifications/progress"===r.method){const e=r.params?.progress;if(e){if("debug"===e.type){o.add({event:e.event||"server:event",data:e.data,source:"server",level:"info"});continue}if("progress"===e.type&&e.data){const n=e.data;p.log(`[MCPClient] Progress event (new schema): ${n.kind}`,n),t.onProgress?.({kind:n.kind,id:n.id,label:n.label,status:n.status,text:n.text,children:n.children,metadata:n.metadata});continue}if("token"!==e.kind&&"token"!==e.type&&(console.log(`[MCPClient] Progress event: kind=${e.kind} type=${e.type}`,e),p.log(`[MCPClient] Progress event: ${e.kind}`,e)),"token"===e.kind&&e.token)g.push(e.token),t.onToken?.(e.token);else if("conversation_started"===e.kind)t.onConversationStarted?.(e.conversation_id,e.assistant_message_id);else if("token_usage"===e.kind)t.onTokenUsage?.({prompt_tokens:e.prompt_tokens,completion_tokens:e.completion_tokens,total_prompt_tokens:e.total_prompt_tokens,total_completion_tokens:e.total_completion_tokens,total_used:e.total_used,context_window:e.context_window,occupancy_pct:e.occupancy_pct,model_name:e.model_name,iteration:e.iteration});else{if("cancelled"===e.kind)break;if("action_request"===e.kind||"action_request"===e.type){if(console.log("[MCPClient] *** RECEIVED action_request ***",e.action_name,e.parameters),p.log("[MCPClient] Received action_request:",e.action_name,e.parameters),!e.action_name||"string"!=typeof e.action_name||""===e.action_name.trim()){console.error("[MCPClient] action_request INVALID - missing action_name:",e),p.error("[MCPClient] Received action_request with missing or invalid action_name:",e);continue}if(t.onActionRequest){console.log("[MCPClient] *** CALLING onActionRequest handler ***"),e.tool_call_id||(console.warn("[MCPClient] action_request missing tool_call_id - result correlation may fail"),p.warn("[MCPClient] action_request missing tool_call_id for action:",e.action_name));const n={action_name:e.action_name,parameters:e.parameters||{},action:e.action,tool_call_id:e.tool_call_id};t.onActionRequest(n).catch(e=>{console.error("[MCPClient] Action request handler FAILED:",e),p.error("[MCPClient] Action request handler failed:",e)})}else console.warn("[MCPClient] action_request received but NO HANDLER registered"),p.warn("[MCPClient] Received action_request but no handler registered")}else t.onProgress?.({kind:e.kind,id:e.id,label:e.label,status:e.status,text:e.text||e.content,children:e.children,message:e.message,progress_id:e.progress_id,metadata:{sources:e.sources||e.metadata?.sources,result_count:e.result_count??e.metadata?.result_count,query:e.query||e.metadata?.query,action_name:e.action_name||e.metadata?.action_name,no_sources_used:e.no_sources_used??e.metadata?.no_sources_used}})}}}if(r.result&&r.id===l){m=r.result,m.structuredContent?.sources&&t.onSources?.(m.structuredContent.sources),m.structuredContent?.actions&&t.onActions?.(m.structuredContent.actions),m.structuredContent?.registered_actions&&t.onRegisteredActions?.(m.structuredContent.registered_actions);const e=m._meta?.conversation_id,n=m._meta?.query_log_id;t.onComplete?.(e,n)}}}catch(n){p.error("[MCPClient] Failed to parse event:",n,e)}}}catch(e){if("AbortError"===e.name)throw e;const n=e instanceof Error?e.message:"Stream reading failed";throw t.onProgress?.({kind:"error",id:"stream-error",label:"Connection interrupted",status:"error",text:n,metadata:{error:n}}),t.onError?.(n),e}finally{d.releaseLock();const n=Math.round(performance.now()-i);o.add({event:"network:stream:complete",data:{duration:n,tool:e},source:"network",level:"info"})}return m||(m={content:[{type:"text",text:g.join("")}],isError:!1}),m}async uploadImage(e){const n=`${this.config.apiBaseUrl}/mcp/upload-image/`,t=new FormData;t.append("image",e);const r=await fetch(n,{method:"POST",headers:{"x-customer-id":this.config.productKey},body:t});if(!r.ok){const e=await r.json().catch(()=>({error:"Upload failed"}));throw new Error(e.error||"Upload failed")}return r.json()}async ask(e,n,t){const r={query:e};return t?.conversationId&&(r.conversation_id=t.conversationId),t?.articleSlug&&(r.article_slug=t.articleSlug),t?.userContext&&t.userContext.length>0&&(r.user_context=t.userContext),t?.images&&t.images.length>0&&(r.images=t.images),t?.history&&t.history.length>0&&(r.history=t.history),t?.registeredActions&&t.registeredActions.length>0&&(r.registered_actions=t.registeredActions),t?.resume&&(r.resume=!0),this.callToolStream("ask",r,n,t?.signal)}async cancelStream(e){const n={jsonrpc:"2.0",id:this.nextId(),method:"notifications/cancel",params:{request_id:e}};p.log(`[MCPClient] Cancelling stream request_id=${e}`);try{await fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(n),keepalive:!0})}catch(e){p.warn("[MCPClient] Failed to send cancel request:",e)}}async sendActionResult(e,n,t){const r=performance.now();t||(console.warn(`[MCPClient] sendActionResult called without toolCallId for action "${e}" - server will not be able to correlate result`),p.warn("[MCPClient] Missing toolCallId in sendActionResult for:",e));const i={jsonrpc:"2.0",id:this.nextId(),method:"action/result",params:{action_name:e,result:n,tool_call_id:t}};o.add({event:"network:request",data:{method:"action/result",action:e,tool_call_id:t,url:this.baseUrl},source:"network",level:"info"});try{p.log(`[MCPClient] Sending action result for "${e}"...`),await new Promise(e=>setTimeout(e,0));const n=await fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(i),keepalive:!0}),t=Math.round(performance.now()-r);if(!n.ok){const r=await n.text().catch(()=>"");throw o.add({event:"network:response",data:{status:n.status,duration:t,action:e,error:r},source:"network",level:"error"}),p.error(`[MCPClient] Action result delivery failed: ${n.status} ${n.statusText}`,r),new Error(`Failed to send action result: ${n.status}`)}o.add({event:"network:response",data:{status:n.status,duration:t,action:e},source:"network",level:"info"}),p.log(`[MCPClient] Action result for "${e}" delivered in ${t}ms`)}catch(n){const t=Math.round(performance.now()-r);throw p.error(`[MCPClient] Failed to send action result for "${e}" after ${t}ms:`,n),n}}async sendLog(e,n,t){const r={jsonrpc:"2.0",id:this.nextId(),method:"client/log",params:{level:e,message:n,data:t,timestamp:(new Date).toISOString()}};try{fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(r),keepalive:!0}).catch(()=>{})}catch{}}sendLogBatch(e){if(0===e.length)return;const n={jsonrpc:"2.0",id:this.nextId(),method:"client/log-batch",params:{logs:e}};try{fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(n),keepalive:!0}).catch(()=>{})}catch{}}async getConversationStatus(e){try{const n=await fetch(`${this.baseUrl}conversations/${e}/status/`,{method:"GET",headers:this.headers});if(!n.ok)return p.warn(`[MCPClient] Failed to get conversation status: ${n.status}`),null;return await n.json()}catch(e){return p.warn("[MCPClient] Error getting conversation status:",e),null}}}function S(e){return{id:e.id,name:e.name,taskType:e.action_type,data:e.data,autoRun:e.auto_run,autoComplete:e.auto_complete}}class C{constructor(e){this.abortControllers=new Map,this._externalUserId=null,this.config=e,this.mcpClient=new k(e)}get mcp(){return this.mcpClient}get baseUrl(){return`${this.config.apiBaseUrl}/api/v1/help-center`}setExternalUserId(e){this._externalUserId=e,this.mcpClient.setExternalUserId(e)}clearExternalUserId(){this._externalUserId=null,this.mcpClient.setExternalUserId("")}getVisitorId(){if("undefined"==typeof window)return"";const e="pillar_visitor_id";try{let n=localStorage.getItem(e);return n||(n=crypto.randomUUID(),localStorage.setItem(e,n)),n}catch{return""}}getSessionId(){if("undefined"==typeof window)return"";const e="pillar_session_id";try{let n=sessionStorage.getItem(e);return n||(n=crypto.randomUUID(),sessionStorage.setItem(e,n)),n}catch{return""}}getPageUrl(){return"undefined"==typeof window?"":window.location.href}get headers(){const e={"Content-Type":"application/json","x-customer-id":this.config.productKey,"x-visitor-id":this.getVisitorId(),"x-session-id":this.getSessionId(),"x-page-url":this.getPageUrl()};return this._externalUserId&&(e["x-external-user-id"]=this._externalUserId),this.config.platform&&(e["X-Pillar-Platform"]=this.config.platform),this.config.version&&(e["X-Pillar-Action-Version"]=this.config.version),e}async fetch(e,n={},t){if(t){this.abortControllers.get(t)?.abort();const e=new AbortController;this.abortControllers.set(t,e),n.signal=e.signal}const r=`${this.baseUrl}${e}`;try{const e=await fetch(r,{...n,headers:{...this.headers,...n.headers}});if(!e.ok){const n=await e.json().catch(()=>({}));throw new Error(n.detail||n.message||`API error: ${e.status}`)}return e.json()}catch(n){if("AbortError"===n.name)throw n;throw p.error(`[Pillar API] Error fetching ${e}:`,n),n}finally{t&&this.abortControllers.delete(t)}}async fetchEmbedConfig(){try{const e=await fetch(`${this.config.apiBaseUrl}/api/public/products/${this.config.productKey}/embed-config/`,{method:"GET",headers:{"Content-Type":"application/json"}});return e.ok?await e.json():(p.warn("[Pillar] Failed to fetch embed config:",e.status),null)}catch(e){return p.warn("[Pillar] Failed to fetch embed config:",e),null}}async getSuggestedQuestions(){try{const e=await this.mcpClient.callTool("suggest_questions",{}),n=e.structuredContent?.questions;return Array.isArray(n)?n:[]}catch(e){return p.warn("[Pillar] Failed to get suggested questions:",e),[]}}async uploadImage(e){return this.mcpClient.uploadImage(e)}async chat(e){let n="",t=[],r=[];const{getRegisteredActions:i,setRegisteredActions:l,updateTokenUsage:a}=await Promise.resolve().then(function(){return hr});try{const o=await this.mcpClient.ask(e.message,{onToken:t=>{n+=t,e.onChunk?.(t)},onSources:e=>{t=e},onActions:n=>{r=n.map(S),e.onActions?.(r)},onProgress:n=>{e.onProgress?.(n)},onConversationStarted:(n,t)=>{e.onConversationStarted?.(n,t)},onActionRequest:async n=>{e.onActionRequest&&await e.onActionRequest(n)},onRegisteredActions:e=>{l(e),p.log("[Pillar API] Stored",e.length,"registered actions for dynamic tool calling")},onRequestId:n=>{e.onRequestId?.(n)},onTokenUsage:e=>{a({promptTokens:e.prompt_tokens,completionTokens:e.completion_tokens,totalPromptTokens:e.total_prompt_tokens,totalCompletionTokens:e.total_completion_tokens,totalUsed:e.total_used,contextWindow:e.context_window,occupancyPct:e.occupancy_pct,modelName:e.model_name,iteration:e.iteration})},onError:e=>{p.error("[Pillar API] MCP chat error:",e)}},{articleSlug:e.articleSlug,userContext:e.userContext,images:e.images,history:e.history,registeredActions:i(),conversationId:e.existingConversationId||void 0,signal:e.signal,resume:e.resume});n||"text"!==o.content[0]?.type||(n=o.content[0].text||"");const s=o._meta||{};return{message:n,sources:t,actions:r,conversationId:s.conversation_id,messageId:s.query_log_id}}catch(e){throw p.error("[Pillar API] Chat error:",e),e}}async submitFeedback(e,n,t){try{await this.fetch("/ai/feedback/",{method:"POST",body:JSON.stringify({message_id:e,feedback:n,...t&&{comment:t}})})}catch(e){p.warn("[Pillar] Feedback submission failed:",e)}}async confirmTaskExecution(e,n,t){try{const r={status:n,error:t?.error,duration_ms:t?.duration_ms,session_id:t?.session_id,conversation_id:t?.conversation_id,metadata:t};await this.fetch(`/tasks/${e}/confirm/`,{method:"POST",body:JSON.stringify(r)})}catch(e){p.warn("[Pillar] Failed to confirm task execution:",e)}}async getSuggestions(e,n){try{return(await this.fetch("/suggestions/",{method:"POST",body:JSON.stringify({context:e,user_profile:n})})).suggestions||[]}catch(e){return p.warn("[Pillar] Failed to get suggestions:",e),[]}}async identify(e,n){const t=`${this.config.apiBaseUrl}/mcp/identify/`,r=await fetch(t,{method:"POST",headers:this.headers,body:JSON.stringify({userId:e,name:n?.name,email:n?.email,metadata:n?.metadata})});if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.error||`Identify failed: ${r.status}`)}}async listConversations(e=20){const n=`${this.config.apiBaseUrl}/mcp/conversations/?limit=${Math.min(e,50)}`;try{const e=await fetch(n,{method:"GET",headers:this.headers});if(!e.ok){const n=await e.json().catch(()=>({}));throw new Error(n.error||`Failed to list conversations: ${e.status}`)}return(await e.json()).conversations||[]}catch(e){return p.warn("[Pillar] Failed to list conversations:",e),[]}}async getConversation(e){const n=`${this.config.apiBaseUrl}/mcp/conversations/${e}/`;try{const e=await fetch(n,{method:"GET",headers:this.headers});if(!e.ok){const n=await e.json().catch(()=>({}));throw new Error(n.error||`Failed to get conversation: ${e.status}`)}return await e.json()}catch(e){return p.warn("[Pillar] Failed to get conversation:",e),null}}cancelAllRequests(){this.abortControllers.forEach(e=>e.abort()),this.abortControllers.clear()}}var P,E,z,T,I,M,R,$,A,L,H,O,D,j={},U=[],q=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,B=Array.isArray;function N(e,n){for(var t in n)e[t]=n[t];return e}function F(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function W(e,n,t){var r,i,l,a={};for(l in n)"key"==l?r=n[l]:"ref"==l?i=n[l]:a[l]=n[l];if(arguments.length>2&&(a.children=arguments.length>3?P.call(arguments,2):t),"function"==typeof e&&null!=e.defaultProps)for(l in e.defaultProps)void 0===a[l]&&(a[l]=e.defaultProps[l]);return V(e,a,r,i,null)}function V(e,n,t,r,i){var l={type:e,props:n,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++z:i,__i:-1,__u:0};return null==i&&null!=E.vnode&&E.vnode(l),l}function K(e){return e.children}function X(e,n){this.props=e,this.context=n}function Y(e,n){if(null==n)return e.__?Y(e.__,e.__i+1):null;for(var t;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e)return t.__e;return"function"==typeof e.type?Y(e):null}function Z(e){var n,t;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e){e.__e=e.__c.base=t.__e;break}return Z(e)}}function G(e){(!e.__d&&(e.__d=!0)&&I.push(e)&&!Q.__r++||M!=E.debounceRendering)&&((M=E.debounceRendering)||R)(Q)}function Q(){for(var e,n,t,r,i,l,a,o=1;I.length;)I.length>o&&I.sort($),e=I.shift(),o=I.length,e.__d&&(t=void 0,r=void 0,i=(r=(n=e).__v).__e,l=[],a=[],n.__P&&((t=N({},r)).__v=r.__v+1,E.vnode&&E.vnode(t),le(n.__P,t,r,n.__n,n.__P.namespaceURI,32&r.__u?[i]:null,l,null==i?Y(r):i,!!(32&r.__u),a),t.__v=r.__v,t.__.__k[t.__i]=t,oe(l,t,a),r.__e=r.__=null,t.__e!=i&&Z(t)));Q.__r=0}function J(e,n,t,r,i,l,a,o,s,c,p){var d,u,h,g,m,f,v,b=r&&r.__k||U,_=n.length;for(s=function(e,n,t,r,i){var l,a,o,s,c,p=t.length,d=p,u=0;for(e.__k=new Array(i),l=0;l<i;l++)null!=(a=n[l])&&"boolean"!=typeof a&&"function"!=typeof a?("string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?a=e.__k[l]=V(null,a,null,null,null):B(a)?a=e.__k[l]=V(K,{children:a},null,null,null):void 0===a.constructor&&a.__b>0?a=e.__k[l]=V(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[l]=a,s=l+u,a.__=e,a.__b=e.__b+1,o=null,-1!=(c=a.__i=ne(a,t,s,d))&&(d--,(o=t[c])&&(o.__u|=2)),null==o||null==o.__v?(-1==c&&(i>p?u--:i<p&&u++),"function"!=typeof a.type&&(a.__u|=4)):c!=s&&(c==s-1?u--:c==s+1?u++:(c>s?u--:u++,a.__u|=4))):e.__k[l]=null;if(d)for(l=0;l<p;l++)null!=(o=t[l])&&!(2&o.__u)&&(o.__e==r&&(r=Y(o)),pe(o,o));return r}(t,n,b,s,_),d=0;d<_;d++)null!=(h=t.__k[d])&&(u=-1==h.__i?j:b[h.__i]||j,h.__i=d,f=le(e,h,u,i,l,a,o,s,c,p),g=h.__e,h.ref&&u.ref!=h.ref&&(u.ref&&ce(u.ref,null,h),p.push(h.ref,h.__c||g,h)),null==m&&null!=g&&(m=g),(v=!!(4&h.__u))||u.__k===h.__k?s=ee(h,s,e,v):"function"==typeof h.type&&void 0!==f?s=f:g&&(s=g.nextSibling),h.__u&=-7);return t.__e=m,s}function ee(e,n,t,r){var i,l;if("function"==typeof e.type){for(i=e.__k,l=0;i&&l<i.length;l++)i[l]&&(i[l].__=e,n=ee(i[l],n,t,r));return n}e.__e!=n&&(r&&(n&&e.type&&!n.parentNode&&(n=Y(e)),t.insertBefore(e.__e,n||null)),n=e.__e);do{n=n&&n.nextSibling}while(null!=n&&8==n.nodeType);return n}function ne(e,n,t,r){var i,l,a,o=e.key,s=e.type,c=n[t],p=null!=c&&!(2&c.__u);if(null===c&&null==o||p&&o==c.key&&s==c.type)return t;if(r>(p?1:0))for(i=t-1,l=t+1;i>=0||l<n.length;)if(null!=(c=n[a=i>=0?i--:l++])&&!(2&c.__u)&&o==c.key&&s==c.type)return a;return-1}function te(e,n,t){"-"==n[0]?e.setProperty(n,null==t?"":t):e[n]=null==t?"":"number"!=typeof t||q.test(n)?t:t+"px"}function re(e,n,t,r,i){var l,a;e:if("style"==n)if("string"==typeof t)e.style.cssText=t;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(n in r)t&&n in t||te(e.style,n,"");if(t)for(n in t)r&&t[n]==r[n]||te(e.style,n,t[n])}else if("o"==n[0]&&"n"==n[1])l=n!=(n=n.replace(A,"$1")),a=n.toLowerCase(),n=a in e||"onFocusOut"==n||"onFocusIn"==n?a.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+l]=t,t?r?t.u=r.u:(t.u=L,e.addEventListener(n,l?O:H,l)):e.removeEventListener(n,l?O:H,l);else{if("http://www.w3.org/2000/svg"==i)n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=n&&"height"!=n&&"href"!=n&&"list"!=n&&"form"!=n&&"tabIndex"!=n&&"download"!=n&&"rowSpan"!=n&&"colSpan"!=n&&"role"!=n&&"popover"!=n&&n in e)try{e[n]=null==t?"":t;break e}catch(e){}"function"==typeof t||(null==t||!1===t&&"-"!=n[4]?e.removeAttribute(n):e.setAttribute(n,"popover"==n&&1==t?"":t))}}function ie(e){return function(n){if(this.l){var t=this.l[n.type+e];if(null==n.t)n.t=L++;else if(n.t<t.u)return;return t(E.event?E.event(n):n)}}}function le(e,n,t,r,i,l,a,o,s,c){var p,d,u,h,g,m,f,v,b,_,x,y,w,k,S,C,z,T=n.type;if(void 0!==n.constructor)return null;128&t.__u&&(s=!!(32&t.__u),l=[o=n.__e=t.__e]),(p=E.__b)&&p(n);e:if("function"==typeof T)try{if(v=n.props,b="prototype"in T&&T.prototype.render,_=(p=T.contextType)&&r[p.__c],x=p?_?_.props.value:p.__:r,t.__c?f=(d=n.__c=t.__c).__=d.__E:(b?n.__c=d=new T(v,x):(n.__c=d=new X(v,x),d.constructor=T,d.render=de),_&&_.sub(d),d.state||(d.state={}),d.__n=r,u=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=T.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=N({},d.__s)),N(d.__s,T.getDerivedStateFromProps(v,d.__s))),h=d.props,g=d.state,d.__v=n,u)b&&null==T.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==T.getDerivedStateFromProps&&v!==h&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(v,x),n.__v==t.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(v,d.__s,x)){for(n.__v!=t.__v&&(d.props=v,d.state=d.__s,d.__d=!1),n.__e=t.__e,n.__k=t.__k,n.__k.some(function(e){e&&(e.__=n)}),y=0;y<d._sb.length;y++)d.__h.push(d._sb[y]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(v,d.__s,x),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(h,g,m)})}if(d.context=x,d.props=v,d.__P=e,d.__e=!1,w=E.__r,k=0,b){for(d.state=d.__s,d.__d=!1,w&&w(n),p=d.render(d.props,d.state,d.context),S=0;S<d._sb.length;S++)d.__h.push(d._sb[S]);d._sb=[]}else do{d.__d=!1,w&&w(n),p=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++k<25);d.state=d.__s,null!=d.getChildContext&&(r=N(N({},r),d.getChildContext())),b&&!u&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(h,g)),C=p,null!=p&&p.type===K&&null==p.key&&(C=se(p.props.children)),o=J(e,B(C)?C:[C],n,t,r,i,l,a,o,s,c),d.base=n.__e,n.__u&=-161,d.__h.length&&a.push(d),f&&(d.__E=d.__=null)}catch(e){if(n.__v=null,s||null!=l)if(e.then){for(n.__u|=s?160:128;o&&8==o.nodeType&&o.nextSibling;)o=o.nextSibling;l[l.indexOf(o)]=null,n.__e=o}else{for(z=l.length;z--;)F(l[z]);ae(n)}else n.__e=t.__e,n.__k=t.__k,e.then||ae(n);E.__e(e,n,t)}else null==l&&n.__v==t.__v?(n.__k=t.__k,n.__e=t.__e):o=n.__e=function(e,n,t,r,i,l,a,o,s){var c,p,d,u,h,g,m,f=t.props||j,v=n.props,b=n.type;if("svg"==b?i="http://www.w3.org/2000/svg":"math"==b?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=l)for(c=0;c<l.length;c++)if((h=l[c])&&"setAttribute"in h==!!b&&(b?h.localName==b:3==h.nodeType)){e=h,l[c]=null;break}if(null==e){if(null==b)return document.createTextNode(v);e=document.createElementNS(i,b,v.is&&v),o&&(E.__m&&E.__m(n,l),o=!1),l=null}if(null==b)f===v||o&&e.data==v||(e.data=v);else{if(l=l&&P.call(e.childNodes),!o&&null!=l)for(f={},c=0;c<e.attributes.length;c++)f[(h=e.attributes[c]).name]=h.value;for(c in f)if(h=f[c],"children"==c);else if("dangerouslySetInnerHTML"==c)d=h;else if(!(c in v)){if("value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v)continue;re(e,c,null,h,i)}for(c in v)h=v[c],"children"==c?u=h:"dangerouslySetInnerHTML"==c?p=h:"value"==c?g=h:"checked"==c?m=h:o&&"function"!=typeof h||f[c]===h||re(e,c,h,f[c],i);if(p)o||d&&(p.__html==d.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),n.__k=[];else if(d&&(e.innerHTML=""),J("template"==n.type?e.content:e,B(u)?u:[u],n,t,r,"foreignObject"==b?"http://www.w3.org/1999/xhtml":i,l,a,l?l[0]:t.__k&&Y(t,0),o,s),null!=l)for(c=l.length;c--;)F(l[c]);o||(c="value","progress"==b&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[c]||"progress"==b&&!g||"option"==b&&g!=f[c])&&re(e,c,g,f[c],i),c="checked",null!=m&&m!=e[c]&&re(e,c,m,f[c],i))}return e}(t.__e,n,t,r,i,l,a,s,c);return(p=E.diffed)&&p(n),128&n.__u?void 0:o}function ae(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(ae)}function oe(e,n,t){for(var r=0;r<t.length;r++)ce(t[r],t[++r],t[++r]);E.__c&&E.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){E.__e(e,n.__v)}})}function se(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:B(e)?e.map(se):N({},e)}function ce(e,n,t){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==n||(e.__u=e(n))}else e.current=n}catch(e){E.__e(e,t)}}function pe(e,n,t){var r,i;if(E.unmount&&E.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ce(r,null,n)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){E.__e(e,n)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&pe(r[i],n,t||"function"!=typeof e.type);t||F(e.__e),e.__c=e.__=e.__e=void 0}function de(e,n,t){return this.constructor(e,t)}function ue(e,n,t){var r,i,l;n==document&&(n=document.documentElement),E.__&&E.__(e,n),r=!1?null:n.__k,i=[],l=[],le(n,e=n.__k=W(K,null,[e]),r||j,j,n.namespaceURI,r?null:n.firstChild?P.call(n.childNodes):null,i,r?r.__e:n.firstChild,false,l),oe(i,e,l)}P=U.slice,E={__e:function(e,n,t,r){for(var i,l,a;n=n.__;)if((i=n.__c)&&!i.__)try{if((l=i.constructor)&&null!=l.getDerivedStateFromError&&(i.setState(l.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(n){e=n}throw e}},z=0,T=function(e){return null!=e&&void 0===e.constructor},X.prototype.setState=function(e,n){var t;t=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=N({},this.state),"function"==typeof e&&(e=e(N({},t),this.props)),e&&N(t,e),null!=e&&this.__v&&(n&&this._sb.push(n),G(this))},X.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),G(this))},X.prototype.render=K,I=[],R="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$=function(e,n){return e.__v.__b-n.__v.__b},Q.__r=0,A=/(PointerCapture)$|Capture$/i,L=0,H=ie(!1),O=ie(!0),D=0;var he=0;function ge(e,n,t,r,i,l){n||(n={});var a,o,s=n;if("ref"in s)for(o in s={},n)"ref"==o?a=n[o]:s[o]=n[o];var c={type:e,props:s,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--he,__i:-1,__u:0,__source:i,__self:l};if("function"==typeof e&&(a=e.defaultProps))for(o in a)void 0===s[o]&&(s[o]=a[o]);return E.vnode&&E.vnode(c),c}var me,fe,ve,be,_e=0,xe=[],ye=E,we=ye.__b,ke=ye.__r,Se=ye.diffed,Ce=ye.__c,Pe=ye.unmount,Ee=ye.__;function ze(e,n){ye.__h&&ye.__h(fe,e,_e||n),_e=0;var t=fe.__H||(fe.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function Te(e){return _e=1,function(e,n){var t=ze(me++,2);if(t.t=e,!t.__c&&(t.__=[Ue(void 0,n),function(e){var n=t.__N?t.__N[0]:t.__[0],r=t.t(n,e);n!==r&&(t.__N=[r,t.__[1]],t.__c.setState({}))}],t.__c=fe,!fe.__f)){var r=function(e,n,r){if(!t.__c.__H)return!0;var l=t.__c.__H.__.filter(function(e){return!!e.__c});if(l.every(function(e){return!e.__N}))return!i||i.call(this,e,n,r);var a=t.__c.props!==e;return l.forEach(function(e){if(e.__N){var n=e.__[0];e.__=e.__N,e.__N=void 0,n!==e.__[0]&&(a=!0)}}),i&&i.call(this,e,n,r)||a};fe.__f=!0;var i=fe.shouldComponentUpdate,l=fe.componentWillUpdate;fe.componentWillUpdate=function(e,n,t){if(this.__e){var a=i;i=void 0,r(e,n,t),i=a}l&&l.call(this,e,n,t)},fe.shouldComponentUpdate=r}return t.__N||t.__}(Ue,e)}function Ie(e,n){var t=ze(me++,3);!ye.__s&&je(t.__H,n)&&(t.__=e,t.u=n,fe.__H.__h.push(t))}function Me(e){return _e=5,Re(function(){return{current:e}},[])}function Re(e,n){var t=ze(me++,7);return je(t.__H,n)&&(t.__=e(),t.__H=n,t.__h=e),t.__}function $e(e,n){return _e=8,Re(function(){return e},n)}function Ae(){for(var e;e=xe.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Oe),e.__H.__h.forEach(De),e.__H.__h=[]}catch(n){e.__H.__h=[],ye.__e(n,e.__v)}}ye.__b=function(e){fe=null,we&&we(e)},ye.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Ee&&Ee(e,n)},ye.__r=function(e){ke&&ke(e),me=0;var n=(fe=e.__c).__H;n&&(ve===fe?(n.__h=[],fe.__h=[],n.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(n.__h.forEach(Oe),n.__h.forEach(De),n.__h=[],me=0)),ve=fe},ye.diffed=function(e){Se&&Se(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(1!==xe.push(n)&&be===ye.requestAnimationFrame||((be=ye.requestAnimationFrame)||He)(Ae)),n.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),ve=fe=null},ye.__c=function(e,n){n.some(function(e){try{e.__h.forEach(Oe),e.__h=e.__h.filter(function(e){return!e.__||De(e)})}catch(t){n.some(function(e){e.__h&&(e.__h=[])}),n=[],ye.__e(t,e.__v)}}),Ce&&Ce(e,n)},ye.unmount=function(e){Pe&&Pe(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(e){try{Oe(e)}catch(e){n=e}}),t.__H=void 0,n&&ye.__e(n,t.__v))};var Le="function"==typeof requestAnimationFrame;function He(e){var n,t=function(){clearTimeout(r),Le&&cancelAnimationFrame(n),setTimeout(e)},r=setTimeout(t,35);Le&&(n=requestAnimationFrame(t))}function Oe(e){var n=fe,t=e.__c;"function"==typeof t&&(e.__c=void 0,t()),fe=n}function De(e){var n=fe;e.__c=e.__(),fe=n}function je(e,n){return!e||e.length!==n.length||n.some(function(n,t){return n!==e[t]})}function Ue(e,n){return"function"==typeof n?n(e):n}var qe=Symbol.for("preact-signals");function Be(){if(Xe>1)Xe--;else{for(var e,n=!1;void 0!==Ke;){var t=Ke;for(Ke=void 0,Ye++;void 0!==t;){var r=t.o;if(t.o=void 0,t.f&=-3,!(8&t.f)&&en(t))try{t.c()}catch(t){n||(e=t,n=!0)}t=r}}if(Ye=0,Xe--,n)throw e}}var Ne=void 0;function Fe(e){var n=Ne;Ne=void 0;try{return e()}finally{Ne=n}}var We,Ve,Ke=void 0,Xe=0,Ye=0,Ze=0;function Ge(e){if(void 0!==Ne){var n=e.n;if(void 0===n||n.t!==Ne)return n={i:0,S:e,p:Ne.s,n:void 0,t:Ne,e:void 0,x:void 0,r:n},void 0!==Ne.s&&(Ne.s.n=n),Ne.s=n,e.n=n,32&Ne.f&&e.S(n),n;if(-1===n.i)return n.i=0,void 0!==n.n&&(n.n.p=n.p,void 0!==n.p&&(n.p.n=n.n),n.p=Ne.s,n.n=void 0,Ne.s.n=n,Ne.s=n),n}}function Qe(e,n){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==n?void 0:n.watched,this.Z=null==n?void 0:n.unwatched,this.name=null==n?void 0:n.name}function Je(e,n){return new Qe(e,n)}function en(e){for(var n=e.s;void 0!==n;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function nn(e){for(var n=e.s;void 0!==n;n=n.n){var t=n.S.n;if(void 0!==t&&(n.r=t),n.S.n=n,n.i=-1,void 0===n.n){e.s=n;break}}}function tn(e){for(var n=e.s,t=void 0;void 0!==n;){var r=n.p;-1===n.i?(n.S.U(n),void 0!==r&&(r.n=n.n),void 0!==n.n&&(n.n.p=r)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=r}e.s=t}function rn(e,n){Qe.call(this,void 0),this.x=e,this.s=void 0,this.g=Ze-1,this.f=4,this.W=null==n?void 0:n.watched,this.Z=null==n?void 0:n.unwatched,this.name=null==n?void 0:n.name}function ln(e,n){return new rn(e,n)}function an(e){var n=e.u;if(e.u=void 0,"function"==typeof n){Xe++;var t=Ne;Ne=void 0;try{n()}catch(n){throw e.f&=-2,e.f|=8,on(e),n}finally{Ne=t,Be()}}}function on(e){for(var n=e.s;void 0!==n;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,an(e)}function sn(e){if(Ne!==this)throw new Error("Out-of-order effect");tn(this),Ne=e,this.f&=-2,8&this.f&&on(this),Be()}function cn(e,n){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==n?void 0:n.name}function pn(e,n){var t=new cn(e,n);try{t.c()}catch(e){throw t.d(),e}var r=t.d.bind(t);return r[Symbol.dispose]=r,r}function dn(e,n){E[e]=n.bind(null,E[e]||function(){})}function un(e){Ve&&Ve(),Ve=e&&e.S()}function hn(e){var n=this,t=e.data,r=function(e){return Re(function(){return Je(e)},[])}(t);r.value=t;var i=Re(function(){for(var e=n.__v;e=e.__;)if(e.__c){e.__c.__$f|=4;break}return n.__$u.c=function(){var e,t=n.__$u.S(),r=i.value;t(),T(r)||3!==(null==(e=n.base)?void 0:e.nodeType)?(n.__$f|=1,n.setState({})):n.base.data=r},ln(function(){var e=r.value.value;return 0===e?0:!0===e?"":e||""})},[]);return i.value}function gn(e,n,t,r){var i=n in e&&void 0===e.ownerSVGElement,l=Je(t);return{o:function(e,n){l.value=e,r=n},d:pn(function(){var t=l.value.value;r[n]!==t&&(r[n]=t,i?e[n]=t:t?e.setAttribute(n,t):e.removeAttribute(n))})}}function mn(e){var n=Me(e);return n.current=e,We.__$f|=4,Re(function(){return ln(function(){return n.current()})},[])}Qe.prototype.brand=qe,Qe.prototype.h=function(){return!0},Qe.prototype.S=function(e){var n=this,t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:Fe(function(){var e;null==(e=n.W)||e.call(n)}))},Qe.prototype.U=function(e){var n=this;if(void 0!==this.t){var t=e.e,r=e.x;void 0!==t&&(t.x=r,e.e=void 0),void 0!==r&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&Fe(function(){var e;null==(e=n.Z)||e.call(n)}))}},Qe.prototype.subscribe=function(e){var n=this;return pn(function(){var t=n.value,r=Ne;Ne=void 0;try{e(t)}finally{Ne=r}},{name:"sub"})},Qe.prototype.valueOf=function(){return this.value},Qe.prototype.toString=function(){return this.value+""},Qe.prototype.toJSON=function(){return this.value},Qe.prototype.peek=function(){var e=Ne;Ne=void 0;try{return this.value}finally{Ne=e}},Object.defineProperty(Qe.prototype,"value",{get:function(){var e=Ge(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Ye>100)throw new Error("Cycle detected");this.v=e,this.i++,Ze++,Xe++;try{for(var n=this.t;void 0!==n;n=n.x)n.t.N()}finally{Be()}}}}),rn.prototype=new Qe,rn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Ze)return!0;if(this.g=Ze,this.f|=1,this.i>0&&!en(this))return this.f&=-2,!0;var e=Ne;try{nn(this),Ne=this;var n=this.x();(16&this.f||this.v!==n||0===this.i)&&(this.v=n,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Ne=e,tn(this),this.f&=-2,!0},rn.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var n=this.s;void 0!==n;n=n.n)n.S.S(n)}Qe.prototype.S.call(this,e)},rn.prototype.U=function(e){if(void 0!==this.t&&(Qe.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var n=this.s;void 0!==n;n=n.n)n.S.U(n)}},rn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(rn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ge(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),cn.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var n=this.x();"function"==typeof n&&(this.u=n)}finally{e()}},cn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,an(this),nn(this),Xe++;var e=Ne;return Ne=this,sn.bind(this,e)},cn.prototype.N=function(){2&this.f||(this.f|=2,this.o=Ke,Ke=this)},cn.prototype.d=function(){this.f|=8,1&this.f||on(this)},cn.prototype.dispose=function(){this.d()},hn.displayName="_st",Object.defineProperties(Qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:hn},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),dn("__b",function(e,n){if("string"==typeof n.type){var t,r=n.props;for(var i in r)if("children"!==i){var l=r[i];l instanceof Qe&&(t||(n.__np=t={}),t[i]=l,r[i]=l.peek())}}e(n)}),dn("__r",function(e,n){un();var t,r=n.__c;r&&(r.__$f&=-2,void 0===(t=r.__$u)&&(r.__$u=t=function(){var e;return pn(function(){e=this}),e.c=function(){r.__$f|=1,r.setState({})},e}())),We=r,un(t),e(n)}),dn("__e",function(e,n,t,r){un(),We=void 0,e(n,t,r)}),dn("diffed",function(e,n){var t;if(un(),We=void 0,"string"==typeof n.type&&(t=n.__e)){var r=n.__np,i=n.props;if(r){var l=t.U;if(l)for(var a in l){var o=l[a];void 0===o||a in r||(o.d(),l[a]=void 0)}else t.U=l={};for(var s in r){var c=l[s],p=r[s];void 0===c?(c=gn(t,s,p,i),l[s]=c):c.o(p,i)}}}e(n)}),dn("unmount",function(e,n){if("string"==typeof n.type){var t=n.__e;if(t){var r=t.U;if(r)for(var i in t.U=void 0,r){var l=r[i];l&&l.d()}}}else{var a=n.__c;if(a){var o=a.__$u;o&&(a.__$u=void 0,o.d())}}e(n)}),dn("__h",function(e,n,t,r){(r<3||9===r)&&(n.__$f|=2),e(n,t,r)}),X.prototype.shouldComponentUpdate=function(e,n){var t=this.__$u,r=t&&void 0!==t.s;for(var i in n)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){if(!(r||2&this.__$f||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(r||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var l in e)if("__source"!==l&&e[l]!==this.props[l])return!0;for(var a in this.props)if(!(a in e))return!0;return!1};const fn="pillar:panel_open",vn="pillar:panel_width";function bn(e){if("undefined"!=typeof window)try{localStorage.setItem(fn,String(e))}catch{}}function _n(){if("undefined"==typeof window)return null;try{const e=localStorage.getItem(vn);if(null===e)return null;const n=Number(e);return Number.isFinite(n)&&n>0?n:null}catch{return null}}function xn(e){if("undefined"!=typeof window)try{localStorage.setItem(vn,String(e))}catch{}}const yn=Je(function(){if("undefined"==typeof window)return!1;try{return"true"===localStorage.getItem(fn)}catch{return!1}}()),wn=Je("assistant"),kn=Je("right"),Sn=Je("overlay"),Cn=Je(380),Pn=Je(1200),En=Je(!0),zn=Je(700),Tn=Je(500),In=Je("undefined"!=typeof window?window.innerWidth:1920);let Mn=null;const Rn=ln(()=>{const e=Pn.value;return!1!==e&&In.value<e}),$n=ln(()=>In.value<zn.value),An=ln(()=>In.value<Tn.value),Ln=ln(()=>Rn.value?"overlay":Sn.value);ln(()=>{const e=["pillar-panel",`pillar-panel--${kn.value}`];return yn.value&&e.push("pillar-panel--open"),e.join(" ")});const Hn=()=>{yn.value=!1,bn(!1),"overlay"===Ln.value&&(document.body.style.overflow="")},On=e=>{Cn.value=e},Dn=()=>{yn.value=!1,bn(!1),wn.value="assistant",document.body.style.overflow=""};function jn(e,n,t){const r=document.createElement("style");return t&&(r.id=t),r.textContent=n,e instanceof Document?e.head.appendChild(r):e.appendChild(r),r}const Un={help:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',support:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 18v-6a9 9 0 0 1 18 0v6"></path><path d="M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"></path></svg>',settings:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg>',feedback:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>',chat:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path></svg>',calendar:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>',mail:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>'},qn={assistant:Un.help,support:Un.support};function Bn({position:e,tabs:n,currentActiveTab:t,onTabClick:r,panelOpen:i,panelWidthPx:l,theme:a,resizable:o,isResizing:s,onResizeStart:c}){const p=$e(e=>{r(e)},[r]),d=["pillar-edge-sidebar",`pillar-edge-sidebar--${e}`,"pillar-edge-sidebar--mounted",i&&"pillar-edge-sidebar--panel-open",s&&"pillar-edge-sidebar--resizing","light"===a&&"pillar-edge-sidebar--light","dark"===a&&"pillar-edge-sidebar--dark"].filter(Boolean).join(" "),u={"--pillar-panel-width":`${l}px`},h=n.filter(e=>e.enabled).sort((e,n)=>e.order-n.order);return ge("div",{class:d,style:u,children:[o&&i&&ge("div",{class:"pillar-edge-resize-handle",onMouseDown:c,onTouchStart:c}),h.map(e=>{return ge("button",{class:["pillar-edge-trigger",i&&t===e.id&&"pillar-edge-trigger--active"].filter(Boolean).join(" "),onClick:()=>p(e.id),"aria-label":e.label||"Help",type:"button",children:[ge("span",{class:"pillar-edge-trigger__icon",dangerouslySetInnerHTML:{__html:(n=e.id,r=e.icon,r&&r in Un?Un[r]:qn[n]||Un.help)}}),ge("span",{class:"pillar-edge-trigger__label",children:e.label})]},e.id);var n,r})]})}class Nn{constructor(e,n,t,r){this.container=null,this.stylesInjected=!1,this.themeStylesInjected=!1,this._isHidden=!1,this.unsubscribeOpen=null,this.unsubscribeWidth=null,this.unsubscribeHoverMode=null,this.unsubscribeMobileMode=null,this.unsubscribeActiveTab=null,this.themeObserver=null,this.currentTheme="light",this._isResizing=!1,this._resizeStartX=0,this._resizeStartWidth=0,this._resizeRafId=null,this._boundHandleResizeMove=null,this._boundHandleResizeEnd=null,this.handleTabClick=e=>{if("assistant"!==e){const n=this.config.sidebarTabs.find(n=>n.id===e);return this.events.emit("sidebar:click",{tabId:e,label:n?.label||e}),void("support"===e&&this.events.emit("support:request",{tabId:e}))}if(yn.value&&wn.value===e)return this.onClick(),void this.render();(e=>{wn.value=e})(e),yn.value||this.onClick(),this.render()},this.handleResizeStart=e=>{if(!yn.value||!this.config.panel.resizable||!this.config.edgeTrigger.resizable)return;e.preventDefault(),e.stopPropagation();const n="touches"in e?e.touches[0].clientX:e.clientX;this._isResizing=!0,this._resizeStartX=n,this._resizeStartWidth=Cn.value,this._boundHandleResizeMove=this.handleResizeMove.bind(this),this._boundHandleResizeEnd=this.handleResizeEnd.bind(this),document.addEventListener("mousemove",this._boundHandleResizeMove),document.addEventListener("mouseup",this._boundHandleResizeEnd),document.addEventListener("touchmove",this._boundHandleResizeMove,{passive:!1}),document.addEventListener("touchend",this._boundHandleResizeEnd),document.addEventListener("touchcancel",this._boundHandleResizeEnd),document.body.style.userSelect="none",document.body.style.webkitUserSelect="none",document.documentElement.style.cursor="col-resize",document.documentElement.style.transition="none",this.render()},this.handleResizeEnd=e=>{this._isResizing&&(null!==this._resizeRafId&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this._isResizing=!1,xn(Cn.value),this._boundHandleResizeMove&&(document.removeEventListener("mousemove",this._boundHandleResizeMove),document.removeEventListener("touchmove",this._boundHandleResizeMove)),this._boundHandleResizeEnd&&(document.removeEventListener("mouseup",this._boundHandleResizeEnd),document.removeEventListener("touchend",this._boundHandleResizeEnd),document.removeEventListener("touchcancel",this._boundHandleResizeEnd)),this._boundHandleResizeMove=null,this._boundHandleResizeEnd=null,document.body.style.userSelect="",document.body.style.webkitUserSelect="",document.documentElement.style.cursor="",document.documentElement.style.transition="padding 0.3s ease",this.render())},this.config=e,this.events=n,this.onClick=t,this.rootContainer=r||null}getEdgePosition(){return this.config.panel.position}detectThemeFromDOM(){const e=document.documentElement;if(e.classList.contains("dark"))return"dark";return"dark"===e.getAttribute("data-theme")||"dark"===e.style.colorScheme?"dark":"light"}applyThemeMode(){const e=this.config.theme.mode;this.currentTheme="light"===e||"dark"===e?e:this.detectThemeFromDOM()}init(){if(this.stylesInjected||(jn(document,"/* Sidebar container - always visible, shifts when panel opens */\n.pillar-edge-sidebar {\n /* Default light mode variables (match panel's variables.css) */\n --pillar-primary: #2563eb;\n --pillar-primary-hover: #1d4ed8;\n --pillar-bg: #ffffff;\n --pillar-bg-secondary: #f9fafb;\n --pillar-text: #1a1a1a;\n --pillar-text-muted: #6b7280;\n --pillar-border: #e5e7eb;\n --pillar-border-light: #f3f4f6;\n --pillar-outline-color: rgba(37, 99, 235, 0.15);\n\n position: fixed;\n top: 0;\n bottom: 0;\n width: 48px;\n z-index: 100000;\n display: flex;\n flex-direction: column;\n align-items: center;\n background: var(--pillar-bg);\n border-left: 1px solid var(--pillar-border);\n transition: right 0.3s ease, left 0.3s ease;\n}\n\n/* Default dark mode variables (match panel's variables.css) */\n.pillar-edge-sidebar--dark {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-text: #f5f5f5;\n --pillar-text-muted: #a3a3a3;\n --pillar-border: #404040;\n --pillar-border-light: #333333;\n --pillar-outline-color: rgba(96, 165, 250, 0.25);\n}\n\n.pillar-edge-sidebar--right {\n right: 0;\n border-left: 1px solid var(--pillar-border);\n border-right: none;\n}\n\n.pillar-edge-sidebar--left {\n left: 0;\n border-right: 1px solid var(--pillar-border);\n border-left: none;\n}\n\n/* When panel is open, shift the trigger to sit at the panel's outer edge */\n.pillar-edge-sidebar--right.pillar-edge-sidebar--panel-open {\n right: var(--pillar-panel-width, 380px);\n}\n\n.pillar-edge-sidebar--left.pillar-edge-sidebar--panel-open {\n left: var(--pillar-panel-width, 380px);\n}\n\n/* The trigger button - vertical sideways text */\n.pillar-edge-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px 8px;\n margin-top: 8px;\n font-family: var(--pillar-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);\n font-size: 12px;\n font-weight: 500;\n color: var(--pillar-text-muted);\n background: transparent;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: background 0.15s ease, color 0.15s ease;\n outline: none;\n gap: 8px;\n writing-mode: vertical-rl;\n text-orientation: mixed;\n}\n\n.pillar-edge-trigger:hover {\n background: var(--pillar-bg-secondary);\n color: var(--pillar-primary);\n}\n\n.pillar-edge-trigger--active {\n background: var(--pillar-bg-secondary);\n color: var(--pillar-primary);\n}\n\n.pillar-edge-trigger--active .pillar-edge-trigger__icon {\n opacity: 1;\n color: var(--pillar-primary);\n}\n\n.pillar-edge-trigger:focus-visible {\n background: var(--pillar-bg-secondary);\n box-shadow: 0 0 0 2px var(--pillar-primary);\n}\n\n.pillar-edge-trigger__icon {\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n opacity: 0.8;\n}\n\n.pillar-edge-trigger:hover .pillar-edge-trigger__icon {\n opacity: 1;\n color: var(--pillar-primary);\n}\n\n.pillar-edge-trigger__label {\n white-space: nowrap;\n letter-spacing: 0.5px;\n}\n\n/* Animation on mount */\n@keyframes pillar-sidebar-mount {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n.pillar-edge-sidebar--mounted {\n animation: pillar-sidebar-mount 0.2s ease forwards;\n}\n\n/* Resize handle - appears on the inner edge of the sidebar (content side) */\n.pillar-edge-resize-handle {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 6px;\n cursor: col-resize;\n z-index: 1;\n display: none;\n touch-action: none;\n}\n\n/* Position the handle on the correct edge based on panel position */\n.pillar-edge-sidebar--right .pillar-edge-resize-handle {\n left: -3px;\n}\n\n.pillar-edge-sidebar--left .pillar-edge-resize-handle {\n right: -3px;\n}\n\n/* Only show when panel is open */\n.pillar-edge-sidebar--panel-open .pillar-edge-resize-handle {\n display: block;\n}\n\n/* Visible indicator line on hover */\n.pillar-edge-resize-handle::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n width: 2px;\n left: 50%;\n transform: translateX(-50%);\n background: transparent;\n transition: background 0.15s ease;\n border-radius: 1px;\n}\n\n.pillar-edge-resize-handle:hover::after {\n background: var(--pillar-primary, #2563eb);\n opacity: 0.5;\n}\n\n.pillar-edge-sidebar--resizing .pillar-edge-resize-handle::after {\n background: var(--pillar-primary, #2563eb);\n opacity: 0.7;\n}\n\n/* Override cursor on the whole sidebar during resize */\n.pillar-edge-sidebar--resizing,\n.pillar-edge-sidebar--resizing * {\n cursor: col-resize !important;\n}\n\n/* Disable sidebar transition during resize for immediate feedback */\n.pillar-edge-sidebar--resizing {\n transition: none !important;\n}\n","pillar-edge-trigger-styles"),this.stylesInjected=!0),!this.themeStylesInjected){const e=function(e,n,t){const r=e=>{const n=[];return e.primary&&n.push(`--pillar-primary: ${e.primary};`),e.primaryHover&&n.push(`--pillar-primary-hover: ${e.primaryHover};`),e.background&&n.push(`--pillar-bg: ${e.background};`),e.backgroundSecondary&&n.push(`--pillar-bg-secondary: ${e.backgroundSecondary};`),e.text&&n.push(`--pillar-text: ${e.text};`),e.textMuted&&n.push(`--pillar-text-muted: ${e.textMuted};`),e.border&&n.push(`--pillar-border: ${e.border};`),e.borderLight&&n.push(`--pillar-border-light: ${e.borderLight};`),e.outlineColor&&n.push(`--pillar-outline-color: ${e.outlineColor};`),n.join("\n ")},i=r(e),l=r(n),a=t?`--pillar-font-family: ${t};`:"";let o="";return(i||a)&&(o+=`\n.pillar-edge-sidebar,\n.pillar-edge-sidebar--light {\n ${[i,a].filter(Boolean).join("\n ")}\n}\n`),l&&(o+=`\n.pillar-edge-sidebar--dark {\n ${l}\n}\n`),o}(this.config.theme.colors,this.config.theme.darkColors,this.config.theme.fontFamily);e&&jn(document,e,"pillar-edge-trigger-theme"),this.themeStylesInjected=!0}if(this.config.panel.resizable&&this.config.edgeTrigger.resizable){const e=_n();null!==e&&On(e)}this.container=document.createElement("div"),this.container.id="pillar-edge-trigger-container";(this.rootContainer||document.body).appendChild(this.container),this.applyThemeMode(),this.applyLayoutPadding(),this.render(),this.unsubscribeOpen=yn.subscribe(()=>{this.render(),queueMicrotask(()=>this.applyLayoutPadding())}),this.unsubscribeWidth=Cn.subscribe(()=>{this.render(),queueMicrotask(()=>this.applyLayoutPadding())}),this.unsubscribeHoverMode=Rn.subscribe(()=>{queueMicrotask(()=>this.applyLayoutPadding())}),this.unsubscribeMobileMode=$n.subscribe(e=>{e?this.hide():this.show()}),$n.value&&this.hide(),this.unsubscribeActiveTab=wn.subscribe(()=>{this.render()}),"auto"===this.config.theme.mode&&(this.themeObserver=new MutationObserver(()=>{const e=this.detectThemeFromDOM();e!==this.currentTheme&&(this.currentTheme=e,this.render())}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}))}applyLayoutPadding(){if(this._isHidden)return;const e=this.getEdgePosition(),n=Cn.value,t=Rn.value;let r=48;yn.value&&!t&&(r=n+48),document.documentElement.style.transition="padding 0.3s ease","right"===e?(document.documentElement.style.paddingRight=`${r}px`,document.documentElement.style.setProperty("--pillar-inset-right",`${r}px`),document.documentElement.style.setProperty("--pillar-inset-left","0px")):(document.documentElement.style.paddingLeft=`${r}px`,document.documentElement.style.setProperty("--pillar-inset-left",`${r}px`),document.documentElement.style.setProperty("--pillar-inset-right","0px"))}removeLayoutPadding(){"right"===this.getEdgePosition()?document.documentElement.style.paddingRight="":document.documentElement.style.paddingLeft="",document.documentElement.style.removeProperty("--pillar-inset-right"),document.documentElement.style.removeProperty("--pillar-inset-left")}setOpen(e){this.render()}show(){this._isHidden=!1,this.container&&(this.container.style.display=""),this.applyLayoutPadding(),this.render()}hide(){this._isHidden=!0,this.container&&(this.container.style.display="none"),this.removeLayoutPadding()}setPosition(e){this.removeLayoutPadding(),this.config.panel.position=e,this.applyLayoutPadding(),this.render()}destroy(){this._isResizing&&this.handleResizeEnd(new MouseEvent("mouseup")),null!==this._resizeRafId&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this.unsubscribeOpen?.(),this.unsubscribeOpen=null,this.unsubscribeWidth?.(),this.unsubscribeWidth=null,this.unsubscribeHoverMode?.(),this.unsubscribeHoverMode=null,this.unsubscribeMobileMode?.(),this.unsubscribeMobileMode=null,this.unsubscribeActiveTab?.(),this.unsubscribeActiveTab=null,this.themeObserver?.disconnect(),this.themeObserver=null,this.removeLayoutPadding(),this.container&&(ue(null,this.container),this.container.remove()),this.container=null,document.getElementById("pillar-edge-trigger-styles")?.remove(),document.getElementById("pillar-edge-trigger-theme")?.remove(),this.stylesInjected=!1,this.themeStylesInjected=!1}handleResizeMove(e){this._isResizing&&("touches"in e&&e.preventDefault(),null===this._resizeRafId&&(this._resizeRafId=requestAnimationFrame(()=>{if(this._resizeRafId=null,!this._isResizing)return;const n="touches"in e?e.touches[0].clientX:e.clientX,t=this._resizeStartX-n,r="right"===this.getEdgePosition()?t:-t,i=window.innerWidth-48-100,l=Math.max(200,Math.min(i,this._resizeStartWidth+r));On(l)})))}render(){if(!this.container||this._isHidden)return;ue(ge(Bn,{position:this.getEdgePosition(),tabs:this.config.sidebarTabs,currentActiveTab:wn.value,onTabClick:this.handleTabClick,panelOpen:yn.value,panelWidthPx:Cn.value,theme:this.currentTheme,resizable:this.config.panel.resizable&&this.config.edgeTrigger.resizable,isResizing:this._isResizing,onResizeStart:this.handleResizeStart}),this.container)}}const Fn={sparkle:'<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8.8 8.44L9.497 11l.697-2.56c.175-.643.263-.965.435-1.23a2 2 0 0 1 .583-.583c.263-.172.585-.259 1.23-.435l2.56-.697l-2.56-.697c-.643-.175-.964-.263-1.23-.435a2 2 0 0 1-.583-.583c-.172-.263-.259-.585-.435-1.23L9.497-.01L8.8 2.55c-.175.643-.263.965-.435 1.23a2 2 0 0 1-.583.583c-.263.172-.585.259-1.23.435l-2.56.697l2.56.697c.643.175.965.263 1.23.435a2 2 0 0 1 .583.583c.172.263.259.585.435 1.23M2.68 13.7c.169.244.264.542.456 1.14l.362 1.12l.362-1.12c.191-.595.287-.893.456-1.14c.149-.216.34-.4.561-.543c.249-.161.55-.247 1.15-.418l.971-.277l-.971-.277c-.601-.172-.902-.258-1.15-.418a2 2 0 0 1-.561-.543c-.169-.244-.264-.542-.456-1.14l-.362-1.12l-.362 1.12c-.191.595-.287.893-.456 1.14c-.149.216-.34.4-.561.543c-.249.161-.55.247-1.15.418l-.971.277l.971.277c.601.172.902.258 1.15.418a2 2 0 0 1 .561.543"/></svg>',question:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',help:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',chat:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path></svg>',support:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 18v-6a9 9 0 0 1 18 0v6"></path><path d="M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"></path></svg>'},Wn={small:44,medium:56,large:68};function Vn({position:e,icon:n,backgroundColor:t,iconColor:r,size:i,label:l,offset:a,panelOpen:o,onClick:s}){const c=$e(()=>{s()},[s]);return ge("button",{class:["pillar-mobile-trigger",`pillar-mobile-trigger--${e}`,"pillar-mobile-trigger--mounted",o&&"pillar-mobile-trigger--hidden"].filter(Boolean).join(" "),style:{"--pillar-mobile-offset":`${a}px`,"--pillar-mobile-bg":t,width:`${i}px`,height:`${i}px`,backgroundColor:t,color:r},onClick:c,"aria-label":l,title:l,type:"button",children:ge("span",{class:"pillar-mobile-trigger__icon",dangerouslySetInnerHTML:{__html:n}})})}class Kn{constructor(e,n,t,r){this.container=null,this.stylesInjected=!1,this._isEnabled=!0,this.unsubscribeMobileMode=null,this.unsubscribeOpen=null,this.config=e,this.events=n,this.onClick=t,this.rootContainer=r||null,this._isEnabled=e.mobileTrigger.enabled}getSize(){const e=this.config.mobileTrigger.size;return"number"==typeof e?e:Wn[e]}getIcon(){const{customIcon:e,icon:n}=this.config.mobileTrigger;return e||Fn[n]}getBackgroundColor(){const{backgroundColor:e}=this.config.mobileTrigger;return e||(this.config.theme.colors.primary||"#c2410c")}init(){if(!this._isEnabled)return;this.stylesInjected||(jn(document,"/* Mobile trigger floating button */\n.pillar-mobile-trigger {\n position: fixed;\n z-index: 100000;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.pillar-mobile-trigger:hover {\n transform: scale(1.05);\n box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.12);\n}\n\n.pillar-mobile-trigger:active {\n transform: scale(0.95);\n}\n\n.pillar-mobile-trigger:focus-visible {\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(255, 255, 255, 0.5), 0 0 0 5px var(--pillar-mobile-bg, #c2410c);\n}\n\n/* Position variants */\n.pillar-mobile-trigger--bottom-right {\n bottom: var(--pillar-mobile-offset, 24px);\n right: var(--pillar-mobile-offset, 24px);\n}\n\n.pillar-mobile-trigger--bottom-left {\n bottom: var(--pillar-mobile-offset, 24px);\n left: var(--pillar-mobile-offset, 24px);\n}\n\n/* Icon styling */\n.pillar-mobile-trigger__icon {\n width: 55%;\n height: 55%;\n flex-shrink: 0;\n transform: translateY(-1px);\n}\n\n/* Hidden state (when panel is open) */\n.pillar-mobile-trigger--hidden {\n opacity: 0 !important;\n pointer-events: none;\n transform: scale(0.8) !important;\n visibility: hidden;\n}\n\n/* Animation on mount */\n@keyframes pillar-mobile-trigger-mount {\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n.pillar-mobile-trigger--mounted {\n animation: pillar-mobile-trigger-mount 0.2s ease forwards;\n}\n","pillar-mobile-trigger-styles"),this.stylesInjected=!0),this.container=document.createElement("div"),this.container.id="pillar-mobile-trigger-container";(this.rootContainer||document.body).appendChild(this.container),this.unsubscribeMobileMode=$n.subscribe(()=>{this.render()}),this.unsubscribeOpen=yn.subscribe(()=>{this.render()}),this.render()}show(){this._isEnabled=!0,this.render()}hide(){this._isEnabled=!1,this.render()}get isVisible(){return this._isEnabled&&$n.value&&!yn.value}destroy(){this.unsubscribeMobileMode?.(),this.unsubscribeMobileMode=null,this.unsubscribeOpen?.(),this.unsubscribeOpen=null,this.container&&(ue(null,this.container),this.container.remove()),this.container=null,document.getElementById("pillar-mobile-trigger-styles")?.remove(),this.stylesInjected=!1}render(){if(!this.container)return;if(!this._isEnabled||!$n.value)return void ue(null,this.container);const{position:e,iconColor:n,label:t,offset:r}=this.config.mobileTrigger;ue(ge(Vn,{position:e,icon:this.getIcon(),backgroundColor:this.getBackgroundColor(),iconColor:n,size:this.getSize(),label:t,offset:r,panelOpen:yn.value,onClick:this.onClick}),this.container)}}function Xn(){return`ctx_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function Yn(e){return"highlighted_text"===e.type}function Zn(e){return"dom_snapshot"===e.type}function Gn(e){return Yn(e)?e.text_content.length>40?e.text_content.substring(0,40)+"...":e.text_content:Zn(e)?`Page scan: ${e.interactableCount} elements`:"Context"}const Qn=Je([]),Jn=Je(null),et=Je([]),nt=Je(0),tt=Je([]),rt="pillar:conversation_id";function it(e){if("undefined"!=typeof window)try{null===e?localStorage.removeItem(rt):localStorage.setItem(rt,e)}catch{}}const lt=Je(!1),at=Je(null),ot=e=>{at.value=e},st=Je(!1),ct=Je(null),pt=Je(null),dt=Je({kind:null}),ut=Je([]),ht=e=>{const n=Qn.value;if(n.length>0&&"assistant"===n[n.length-1].role){const t=n[n.length-1],r=t.progressEvents||[];let i;const l=e.id||e.progress_id;if(l){const n=r.findIndex(e=>(e.id||e.progress_id)===l);if(n>=0){const t=r[n],l="thinking"===t.kind||"step_start"===t.kind,a="active"===t.status,o="done"===e.status||"error"===e.status,s=t.metadata?._startTime,c=l&&a&&o&&s?{_durationSeconds:Math.round((Date.now()-s)/1e3)}:{},p={...t,...e,id:e.id||t.id,progress_id:e.progress_id||t.progress_id,text:t.text&&e.text?t.text+e.text:e.text??t.text,children:e.children||t.children,metadata:{...t.metadata,...e.metadata,...c}};i=[...r.slice(0,n),p,...r.slice(n+1)]}else{const n=Date.now(),t=r.map(e=>{if(!(("thinking"===e.kind||"step_start"===e.kind)&&"active"===e.status))return e;const t=e.metadata?._startTime,r=t?{_durationSeconds:Math.round((n-t)/1e3)}:{};return{...e,status:"done",metadata:{...e.metadata,...r}}});i=[...t,("thinking"===e.kind||"step_start"===e.kind)&&"active"===e.status?{...e,metadata:{...e.metadata,_startTime:n}}:e]}}else{const n=Date.now(),t=r.map(e=>{if(!(("thinking"===e.kind||"step_start"===e.kind)&&"active"===e.status))return e;const t=e.metadata?._startTime,r=t?{_durationSeconds:Math.round((n-t)/1e3)}:{};return{...e,status:"done",metadata:{...e.metadata,...r}}});i=[...t,("thinking"===e.kind||"step_start"===e.kind)&&"active"===e.status?{...e,metadata:{...e.metadata,_startTime:n}}:e]}const a=[...t.segments||[]],o=e.id&&r.some(n=>n.id===e.id);if(o)for(let n=a.length-1;n>=0;n--){const t=a[n];if("progress"!==t.type)continue;const r=t.events.findIndex(n=>n.id===e.id);if(r>=0){const l=i.find(n=>n.id===e.id);if(l){const e=[...t.events];e[r]=l,a[n]={type:"progress",events:e}}break}}else{const n=e.id?i.find(n=>n.id===e.id):i[i.length-1];if(n){const e=a[a.length-1];e&&"progress"===e.type?a[a.length-1]={type:"progress",events:[...e.events,n]}:a.push({type:"progress",events:[n]})}}Qn.value=[...n.slice(0,-1),{...t,progressEvents:i,segments:a}]}},gt=e=>{const n=Qn.value;if(0===n.length||"assistant"!==n[n.length-1].role)return;const t=n[n.length-1],r=[...t.segments||[]],i=r[r.length-1];i&&"text"===i.type?r[r.length-1]={type:"text",content:i.content+e}:r.push({type:"text",content:e}),Qn.value=[...n.slice(0,-1),{...t,segments:r,content:(t.content||"")+e}]},mt=Je(!1),ft=Je([]),vt=Je([]),bt=Je(""),_t=Je(null),xt=Je(0),yt=Je(0),wt=Je([]),kt=Je([]),St=Je([]),Ct=Je([]),Pt=ln(()=>Ct.value.some(e=>"uploading"===e.status)),Et=()=>Ct.value.filter(e=>"ready"===e.status&&e.url).map(e=>({url:e.url,detail:"low",path:e.path})),zt=e=>{Ct.value.length>=4||(Ct.value=[...Ct.value,e])},Tt=(e,n,t,r,i)=>{Ct.value=Ct.value.map(l=>l.id===e?{...l,status:n,url:t,error:r,path:i}:l)},It=e=>{const n=Ct.value.find(n=>n.id===e);n&&URL.revokeObjectURL(n.preview),Ct.value=Ct.value.filter(n=>n.id!==e)},Mt=()=>{Ct.value.forEach(e=>URL.revokeObjectURL(e.preview)),Ct.value=[]},Rt=ln(()=>Qn.value.length>0),$t=(e,n,t)=>{Qn.value=[...Qn.value,{role:"user",content:e,userContext:n&&n.length>0?n:void 0,images:t&&t.length>0?t:void 0}]},At=(e,n)=>{Qn.value=[...Qn.value,{role:"assistant",content:e,id:n,progressEvents:[]}]},Lt=(e,n,t,r)=>{const i=Qn.value;if(i.length>0&&"assistant"===i[i.length-1].role){const l=i[i.length-1];Qn.value=[...i.slice(0,-1),{role:"assistant",content:void 0!==e?e:l.content,id:n??l.id,actions:t??l.actions,sources:r??l.sources,actionStatus:l.actionStatus,progressEvents:l.progressEvents,segments:l.segments}]}},Ht=(e,n)=>{const t=Qn.value;if(e>=0&&e<t.length){const r=t[e],i={...r.actionStatus||{},[n]:{status:"pending"}};Qn.value=[...t.slice(0,e),{...r,actionStatus:i},...t.slice(e+1)]}},Ot=(e,n,t)=>{const r=Qn.value;for(let i=r.length-1;i>=0;i--){const l=r[i];if(l.actionStatus?.[e]){const a={...l.actionStatus,[e]:{status:n?"success":"failed",completedAt:Date.now(),errorMessage:t}};return void(Qn.value=[...r.slice(0,i),{...l,actionStatus:a},...r.slice(i+1)])}}},Dt=(e,n)=>{const t=Qn.value;for(let r=t.length-1;r>=0;r--){const i=t[r];if(i.actionStatus?.[e])return void(Qn.value=[...t.slice(0,r),{...i,content:n},...t.slice(r+1)])}},jt=e=>{Jn.value=e,it(e)},Ut=(e,n)=>{Qn.value=Qn.value.map(t=>t.id===e?{...t,feedback:n}:t)},qt=e=>{lt.value=e},Bt=()=>{dt.value={kind:null}},Nt=()=>{const e=Qn.value;if(0===e.length)return;const n=e[e.length-1];if("assistant"!==n.role||!n.progressEvents)return;const t=n.progressEvents.some(e=>"active"===e.status);if(!t)return;const r=Date.now(),i=n.progressEvents.map(e=>{if("active"!==e.status)return e;const n=e.metadata?._startTime,t=n?{_durationSeconds:Math.round((r-n)/1e3)}:{};return{...e,status:"done",metadata:{...e.metadata,...t}}});Qn.value=[...e.slice(0,-1),{...n,progressEvents:i}]},Ft=e=>{const n=e.id||e.progress_id;if(n){const t=ut.value.findIndex(e=>(e.id||e.progress_id)===n);if(t>=0){const n=ut.value[t],r={...n,...e,id:e.id||n.id,progress_id:e.progress_id||n.progress_id,text:"thinking"===e.kind&&n.text&&e.text?n.text+e.text:e.text??n.text};ut.value=[...ut.value.slice(0,t),r,...ut.value.slice(t+1)]}else ut.value=[...ut.value,e]}else ut.value=[...ut.value,e];ht(e)},Wt=e=>{ct.value=e},Vt=()=>{ct.value=null},Kt=()=>{const e=Qn.value;if(0===e.length)return;const n=e[e.length-1],t=n.progressEvents&&n.progressEvents.length>0;"assistant"!==n.role||n.content?.trim()||t||(Qn.value=e.slice(0,-1))},Xt=e=>{_t.value=e},Yt=()=>{_t.value=null},Zt=()=>{xt.value+=1},Gt=()=>{yt.value+=1},Qt=e=>{const n={...e,id:Xn()};wt.value=[...wt.value,n]},Jt=e=>{wt.value=wt.value.filter(n=>n.id!==e)},er=()=>{wt.value=[]},nr=e=>{kt.value=e},tr=()=>{kt.value=[]},rr=e=>{St.value=e},ir=()=>{St.value=[]},lr=()=>{Qn.value=[],Jn.value=null,it(null),et.value=[],lt.value=!1,dt.value={kind:null},ut.value=[],pt.value=null,mt.value=!1,ft.value=[],vt.value=[],bt.value="",_t.value=null,xt.value=0,wt.value=[],kt.value=[],St.value=[],Mt()},ar=()=>{lr(),st.value=!0};function or(e){return"token_summary"===e.step_type||"tool_decision"===e.step_type||"parallel_tool_decision"===e.step_type||"narration"===e.step_type?null:"thinking"===e.step_type?{kind:"thinking",status:"done",text:e.content||"",label:"Thought",metadata:{iteration:e.iteration,timestamp_ms:e.timestamp_ms}}:"tool_result"===e.step_type?{kind:e.kind||"tool_call",status:!1===e.success?"error":"done",label:e.label||e.tool||"Result",text:e.text,children:e.children,metadata:{tool_name:e.tool,tool:e.tool,arguments:e.arguments,success:e.success,iteration:e.iteration,timestamp_ms:e.timestamp_ms}}:"step_start"===e.step_type?{kind:"step_start",status:"done",label:e.label||"Step",metadata:{iteration:e.iteration,timestamp_ms:e.timestamp_ms}}:{kind:e.step_type,status:"done",label:e.label||e.step_type,text:e.content,metadata:e}}function sr(e){if(!e||0===e.length)return;const n=[];for(const t of e)if("narration"===t.step_type){const e=t.content||"",r=n[n.length-1];r&&"text"===r.type?r.content+=e:n.push({type:"text",content:e})}else{const e=or(t);if(!e)continue;const r=n[n.length-1];r&&"progress"===r.type?r.events.push(e):n.push({type:"progress",events:[e]})}return n.length>0?n:void 0}const cr=(e,n)=>{Jn.value=e,it(e),Qn.value=n.map(e=>({role:e.role,content:e.content,id:e.id,images:"user"===e.role&&e.images?.length?e.images:void 0,segments:"assistant"===e.role?sr(e.display_trace):void 0})),mt.value=!0,st.value=!1,nt.value+=1},pr=()=>{st.value=!1},dr=(e,n)=>{const t=(new Date).toISOString(),r={id:e,title:n,startedAt:t,lastMessageAt:t,messageCount:1};tt.value=[r,...tt.value.filter(n=>n.id!==e)],nt.value+=1},ur=async e=>{const{getApiClient:n}=await Promise.resolve().then(function(){return no}),{navigate:t}=await Promise.resolve().then(function(){return kr}),{debug:r}=await Promise.resolve().then(function(){return d}),i=n();if(i){ar(),t("chat");try{const n=await i.getConversation(e);n&&n.messages.length>0?cr(n.id,n.messages):pr()}catch(e){r.error("[Pillar] Failed to load conversation:",e),pr()}}};var hr=Object.freeze({__proto__:null,activeRequestId:at,addAssistantMessage:At,addOptimisticConversation:dr,addPendingImage:zt,addProgressEvent:Ft,addProgressEventToLastMessage:ht,addUserContext:Qt,addUserMessage:$t,appendTokenToSegments:gt,clearInterruptedSession:Vt,clearPendingImages:Mt,clearPendingImagesForNavigation:ir,clearPendingMessage:Yt,clearPendingUserContext:tr,clearProgressStatus:Bt,clearUserContext:er,conversationId:Jn,currentActions:vt,currentSources:ft,finalizeActiveProgressEvents:Nt,focusInputTrigger:yt,getReadyImages:Et,getRegisteredActions:()=>et.value,getStoredConversationId:function(){if("undefined"==typeof window)return null;try{return localStorage.getItem(rt)}catch{return null}},hasMessages:Rt,historyInvalidationCounter:nt,interruptedSession:ct,isExpanded:mt,isLoading:lt,isLoadingHistory:st,isUploadingImages:Pt,loadConversation:cr,messages:Qn,optimisticConversations:tt,pendingImages:Ct,pendingImagesForNavigation:St,pendingMessage:_t,pendingUserContext:kt,prefillText:bt,progressEvents:ut,progressStatus:dt,registeredActions:et,removeLastEmptyAssistantMessage:Kt,removePendingImage:It,removeUserContext:Jt,resetChat:lr,selectConversationById:ur,setActionComplete:Ot,setActionPending:Ht,setActiveRequestId:ot,setConversationId:jt,setInterruptedSession:Wt,setLoading:qt,setMessageFeedback:Ut,setPendingImagesForNavigation:rr,setPendingMessage:Xt,setPendingUserContext:nr,setRegisteredActions:e=>{et.value=e},startLoadingHistory:ar,stopLoadingHistory:pr,submitPendingTrigger:xt,tokenUsage:pt,triggerInputFocus:Gt,triggerSubmitPending:Zt,updateActionMessageContent:Dt,updateImageStatus:Tt,updateLastAssistantMessage:Lt,updateTokenUsage:e=>{pt.value=e},userContext:wt});const gr=Je([]),mr=Je({type:"home"}),fr=ln(()=>gr.value.length>0),vr=ln(()=>"home"===mr.value.type),br=(e,n)=>{gr.value=[...gr.value,{...mr.value}],mr.value={type:e,params:n}},_r=()=>{const e=gr.value;if(e.length>0){"chat"===mr.value.type&&lr();const n=e[e.length-1];mr.value=n,gr.value=e.slice(0,-1)}},xr=()=>{"chat"===mr.value.type&&lr(),gr.value=[],mr.value={type:"home"}},yr=()=>{gr.value=[],mr.value={type:"home"}},wr=()=>{br("chat"),Zt()};var kr=Object.freeze({__proto__:null,canGoBack:fr,currentView:mr,goBack:_r,goHome:xr,isAtHome:vr,navigate:br,navigateToChat:wr,resetRouter:yr,viewStack:gr});const Sr=["/* ============================================================================\n CSS Custom Properties (Variables)\n Users can override these to customize colors\n ============================================================================ */\n\n:host {\n /* Core colors - Light mode (default) */\n --pillar-primary: #2563eb;\n --pillar-primary-hover: #1d4ed8;\n --pillar-primary-light: #eff6ff;\n --pillar-primary-light-hover: #dbeafe;\n \n --pillar-bg: #ffffff;\n --pillar-bg-secondary: #f9fafb;\n --pillar-bg-tertiary: #f3f4f6;\n \n --pillar-text: #1a1a1a;\n --pillar-text-secondary: #374151;\n --pillar-text-muted: #6b7280;\n --pillar-text-placeholder: #9ca3af;\n \n --pillar-border: #e5e7eb;\n --pillar-border-light: #f3f4f6;\n \n /* Focus/outline */\n --pillar-outline-color: rgba(37, 99, 235, 0.15);\n \n /* Shadows */\n --pillar-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n \n /* Code blocks */\n --pillar-code-bg: #1f2937;\n --pillar-code-text: #e5e7eb;\n \n /* Scrollbar */\n --pillar-scrollbar-track: transparent;\n --pillar-scrollbar-thumb: #d1d5db;\n --pillar-scrollbar-thumb-hover: #9ca3af;\n \n /* Spacing (can be customized) */\n --pillar-panel-width: 380px;\n --pillar-spacing-xs: 4px;\n --pillar-spacing-sm: 8px;\n --pillar-spacing-md: 12px;\n --pillar-spacing-lg: 16px;\n --pillar-spacing-xl: 20px;\n --pillar-spacing-2xl: 24px;\n \n /* Border radius */\n --pillar-radius-sm: 4px;\n --pillar-radius-md: 6px;\n --pillar-radius-lg: 8px;\n --pillar-radius-xl: 10px;\n --pillar-radius-full: 9999px;\n \n /* Typography */\n --pillar-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n --pillar-font-mono: 'SF Mono', Consolas, monospace;\n --pillar-font-size-xs: 11px;\n --pillar-font-size-sm: 12px;\n --pillar-font-size-base: 14px;\n --pillar-font-size-md: 15px;\n --pillar-font-size-lg: 16px;\n --pillar-font-size-xl: 18px;\n --pillar-font-size-2xl: 20px;\n \n /* Animation */\n --pillar-transition-fast: 0.15s ease;\n --pillar-transition-normal: 0.3s ease;\n}\n\n/* Dark mode - Auto-detect from system preference */\n@media (prefers-color-scheme: dark) {\n :host:not([data-theme=\"light\"]) {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-primary-light: #1e3a5f;\n --pillar-primary-light-hover: #1e4976;\n \n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-bg-tertiary: #333333;\n \n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-text-muted: #a3a3a3;\n --pillar-text-placeholder: #737373;\n \n --pillar-border: #404040;\n --pillar-border-light: #333333;\n \n --pillar-outline-color: rgba(96, 165, 250, 0.25);\n \n --pillar-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n \n --pillar-code-bg: #0d0d0d;\n --pillar-code-text: #e5e7eb;\n \n --pillar-scrollbar-thumb: #525252;\n --pillar-scrollbar-thumb-hover: #737373;\n }\n}\n\n/* Dark mode - Manual override */\n:host([data-theme=\"dark\"]) {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-primary-light: #1e3a5f;\n --pillar-primary-light-hover: #1e4976;\n \n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-bg-tertiary: #333333;\n \n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-text-muted: #a3a3a3;\n --pillar-text-placeholder: #737373;\n \n --pillar-border: #404040;\n --pillar-border-light: #333333;\n \n --pillar-outline-color: rgba(96, 165, 250, 0.25);\n \n --pillar-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n \n --pillar-code-bg: #0d0d0d;\n --pillar-code-text: #e5e7eb;\n \n --pillar-scrollbar-thumb: #525252;\n --pillar-scrollbar-thumb-hover: #737373;\n}\n","/* ============================================================================\n Base Styles\n Note: No CSS reset - we rely on explicit styles for SDK components\n and allow custom cards to inherit host app styling (Tailwind, etc.)\n ============================================================================ */\n\n:host {\n font-family: var(--pillar-font-family);\n font-size: var(--pillar-font-size-base);\n line-height: 1.5;\n color: var(--pillar-text);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n","/* ============================================================================\n Scrollbar Styling\n ============================================================================ */\n\n._pillar-content::-webkit-scrollbar,\n._pillar-chat-input-messages::-webkit-scrollbar {\n width: 6px;\n}\n\n._pillar-content::-webkit-scrollbar-track,\n._pillar-chat-input-messages::-webkit-scrollbar-track {\n background: var(--pillar-scrollbar-track);\n}\n\n._pillar-content::-webkit-scrollbar-thumb,\n._pillar-chat-input-messages::-webkit-scrollbar-thumb {\n background: var(--pillar-scrollbar-thumb);\n border-radius: 3px;\n}\n\n._pillar-content::-webkit-scrollbar-thumb:hover,\n._pillar-chat-input-messages::-webkit-scrollbar-thumb:hover {\n background: var(--pillar-scrollbar-thumb-hover);\n}\n","/* ============================================================================\n Panel Container\n Internal: _pillar-panel | Public: pillar-panel\n ============================================================================ */\n\n._pillar-panel {\n position: fixed;\n top: 0;\n bottom: 0;\n width: var(--pillar-panel-width);\n max-width: 100vw;\n background: var(--pillar-bg);\n border-left: 1px solid var(--pillar-border);\n display: flex;\n flex-direction: column;\n z-index: 99999;\n transform: translateX(100%);\n transition: transform var(--pillar-transition-normal);\n}\n\n._pillar-panel--right {\n right: 0;\n}\n\n._pillar-panel--left {\n left: 0;\n border-left: none;\n border-right: 1px solid var(--pillar-border);\n transform: translateX(-100%);\n}\n\n._pillar-panel--open {\n transform: translateX(0);\n}\n\n._pillar-panel--manual {\n position: static;\n transform: none;\n height: 100%;\n}\n\n._pillar-panel--full-width {\n width: 100vw;\n max-width: 100vw;\n}\n\n/* ============================================================================\n Mobile Bottom Sheet\n When viewport < mobileBreakpoint, the panel slides up from the bottom\n like an iOS sheet instead of from the side.\n ============================================================================ */\n\n._pillar-panel--mobile {\n top: auto;\n bottom: 0;\n left: 0;\n right: 0;\n width: 100vw;\n max-width: 100vw;\n height: 90dvh;\n max-height: 90dvh;\n border-left: none;\n border-right: none;\n border-top: 1px solid var(--pillar-border);\n border-radius: 16px 16px 0 0;\n overflow: hidden;\n transform: translateY(100%);\n /* iOS-style spring curve: slow start, fast middle, gentle settle */\n transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);\n}\n\n._pillar-panel--mobile._pillar-panel--open {\n transform: translateY(0);\n}\n\n\n._pillar-panel-root {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n._pillar-panel-ui {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n}\n\n/* Public override classes - empty by default */\n.pillar-panel {\n}\n.pillar-panel-root {\n}\n.pillar-panel-ui {\n}\n\n/* ============================================================================\n Backdrop\n ============================================================================ */\n\n._pillar-backdrop {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.3);\n opacity: 0;\n visibility: hidden;\n transition:\n opacity var(--pillar-transition-normal),\n visibility var(--pillar-transition-normal);\n z-index: 99998;\n}\n\n._pillar-backdrop--visible {\n opacity: 1;\n visibility: visible;\n}\n\n.pillar-backdrop {\n}\n\n/* ============================================================================\n Content Area\n Internal: _pillar-content | Public: pillar-content\n ============================================================================ */\n\n._pillar-content {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n min-height: 0;\n}\n\n.pillar-content {\n}\n\n/* ============================================================================\n Resize Handle\n Appears on the content-facing edge of the panel for drag-to-resize.\n Internal: _pillar-resize-handle | Public: pillar-resize-handle\n ============================================================================ */\n\n._pillar-resize-handle {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 6px;\n cursor: col-resize;\n z-index: 1;\n touch-action: none;\n}\n\n/* Right panel: handle on left edge */\n._pillar-panel--right ._pillar-resize-handle {\n left: -3px;\n}\n\n/* Left panel: handle on right edge */\n._pillar-panel--left ._pillar-resize-handle {\n right: -3px;\n}\n\n/* Visible indicator line on hover */\n._pillar-resize-handle::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n width: 3px;\n left: 50%;\n transform: translateX(-50%);\n background: transparent;\n transition: background 0.15s ease;\n border-radius: 1.5px;\n}\n\n._pillar-resize-handle:hover::after {\n background: var(--pillar-primary, #2563eb);\n opacity: 0.5;\n}\n\n/* During active resize, keep indicator visible */\n._pillar-panel--resizing ._pillar-resize-handle::after {\n background: var(--pillar-primary, #2563eb);\n opacity: 0.7;\n}\n\n/* Override cursor on the whole panel during resize */\n._pillar-panel--resizing,\n._pillar-panel--resizing * {\n cursor: col-resize !important;\n}\n\n/* Disable panel slide transition during resize for immediate feedback */\n._pillar-panel--resizing {\n transition: none !important;\n}\n\n/* Hide resize handle in mobile/full-width modes */\n._pillar-panel--mobile ._pillar-resize-handle,\n._pillar-panel--full-width ._pillar-resize-handle {\n display: none;\n}\n\n.pillar-resize-handle {\n}\n\n/* ============================================================================\n Reduced Motion\n Disable all panel and backdrop transitions when the user prefers reduced motion.\n ============================================================================ */\n\n@media (prefers-reduced-motion: reduce) {\n ._pillar-panel,\n ._pillar-panel--mobile,\n ._pillar-backdrop {\n transition: none;\n }\n}\n","/* ============================================================================\n Header\n Internal: _pillar-header | Public: pillar-header\n ============================================================================ */\n\n._pillar-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 44px;\n padding: 0 var(--pillar-spacing-md);\n border-bottom: 1px solid var(--pillar-border);\n flex-shrink: 0;\n background: var(--pillar-bg);\n}\n\n._pillar-panel--mobile ._pillar-header {\n position: relative;\n height: auto;\n min-height: 48px;\n padding: 20px var(--pillar-spacing-md) 8px;\n cursor: grab;\n touch-action: none;\n user-select: none;\n -webkit-user-select: none;\n}\n\n/* ---- Drag indicator (iOS-style pill) ---- */\n\n._pillar-drag-indicator {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n display: flex;\n justify-content: center;\n padding: 8px 0 0;\n pointer-events: none;\n}\n\n._pillar-drag-indicator-pill {\n width: 36px;\n height: 5px;\n border-radius: 2.5px;\n background: var(--pillar-text-muted);\n opacity: 0.35;\n}\n\n._pillar-header-left {\n display: flex;\n align-items: center;\n gap: var(--pillar-spacing-sm);\n}\n\n._pillar-header-title {\n font-size: var(--pillar-font-size-lg);\n font-weight: 600;\n color: var(--pillar-text);\n}\n\n._pillar-header-right {\n display: flex;\n align-items: center;\n gap: var(--pillar-spacing-xs);\n}\n\n/* Public override classes */\n.pillar-header {\n}\n.pillar-header-left {\n}\n.pillar-header-right {\n}\n.pillar-header-title {\n}\n.pillar-new-chat-btn {\n}\n\n/* ============================================================================\n Icon Buttons (back, home, close)\n Internal: _pillar-icon-btn | Public: pillar-icon-btn\n ============================================================================ */\n\n._pillar-icon-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: none;\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition:\n color var(--pillar-transition-fast),\n background var(--pillar-transition-fast);\n}\n\n._pillar-icon-btn:hover {\n color: var(--pillar-text);\n}\n\n._pillar-icon-btn svg {\n width: 20px;\n height: 20px;\n}\n\n.pillar-icon-btn {\n}\n.pillar-back-btn {\n}\n.pillar-home-btn {\n}\n.pillar-history-btn {\n}\n\n/* ============================================================================\n History Dropdown\n Internal: _pillar-history-* | Public: pillar-history-*\n ============================================================================ */\n\n._pillar-history-dropdown {\n position: relative;\n}\n\n._pillar-history-menu {\n position: absolute;\n top: 100%;\n right: 0;\n margin-top: var(--pillar-spacing-xs);\n width: 280px;\n max-height: 400px;\n background: var(--pillar-bg);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);\n overflow: hidden;\n z-index: 100;\n}\n\n._pillar-history-loading {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: var(--pillar-spacing-sm);\n padding: var(--pillar-spacing-xl);\n color: var(--pillar-text-muted);\n font-size: 13px;\n}\n\n._pillar-history-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--pillar-border);\n border-top-color: var(--pillar-primary);\n border-radius: 50%;\n animation: pillar-spin 0.8s linear infinite;\n}\n\n@keyframes pillar-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n._pillar-history-empty {\n padding: var(--pillar-spacing-xl);\n text-align: center;\n color: var(--pillar-text-muted);\n font-size: 13px;\n}\n\n._pillar-history-list {\n max-height: 360px;\n overflow-y: auto;\n padding: var(--pillar-spacing-xs) 0;\n}\n\n._pillar-history-group-header {\n padding: var(--pillar-spacing-xs) var(--pillar-spacing-md);\n padding-top: var(--pillar-spacing-sm);\n font-size: 10px;\n font-weight: 500;\n color: var(--pillar-text-muted);\n letter-spacing: 0.02em;\n}\n\n._pillar-history-group-header:first-child {\n padding-top: var(--pillar-spacing-xs);\n}\n\n._pillar-history-item {\n display: flex;\n align-items: center;\n width: 100%;\n padding: var(--pillar-spacing-xs) var(--pillar-spacing-md);\n background: none;\n border: none;\n text-align: left;\n cursor: pointer;\n transition: background var(--pillar-transition-fast);\n border-radius: var(--pillar-radius-sm);\n margin: 0 var(--pillar-spacing-xs);\n width: calc(100% - var(--pillar-spacing-sm));\n}\n\n._pillar-history-item:hover {\n background: var(--pillar-bg-secondary);\n}\n\n._pillar-history-item-title {\n font-size: 13px;\n color: var(--pillar-text);\n line-height: 1.4;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 100%;\n}\n\n/* ============================================================================\n History Dropdown – Mobile Overlay\n When inside a mobile panel, the dropdown becomes a full-screen overlay\n within the panel instead of a small positioned menu.\n ============================================================================ */\n\n._pillar-history-menu--mobile {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n max-width: 100%;\n height: 100%;\n max-height: 100%;\n margin-top: 0;\n border: none;\n border-radius: 0;\n box-shadow: none;\n z-index: 200;\n display: flex;\n flex-direction: column;\n}\n\n._pillar-history-mobile-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 48px;\n padding: 0 var(--pillar-spacing-md);\n border-bottom: 1px solid var(--pillar-border);\n flex-shrink: 0;\n}\n\n._pillar-history-mobile-title {\n font-size: 16px;\n font-weight: 600;\n color: var(--pillar-text);\n}\n\n._pillar-history-mobile-close {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: none;\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition:\n color var(--pillar-transition-fast),\n background var(--pillar-transition-fast);\n}\n\n._pillar-history-mobile-close:hover,\n._pillar-history-mobile-close:active {\n color: var(--pillar-text);\n background: var(--pillar-bg-secondary);\n}\n\n._pillar-history-mobile-close svg {\n width: 20px;\n height: 20px;\n}\n\n/* Mobile: larger list area fills remaining space */\n._pillar-history-menu--mobile ._pillar-history-list {\n flex: 1;\n max-height: none;\n padding: var(--pillar-spacing-sm) 0;\n -webkit-overflow-scrolling: touch;\n}\n\n/* Mobile: larger group headers */\n._pillar-history-menu--mobile ._pillar-history-group-header {\n font-size: 12px;\n padding: var(--pillar-spacing-sm) var(--pillar-spacing-md);\n padding-top: var(--pillar-spacing-md);\n}\n\n._pillar-history-menu--mobile ._pillar-history-group-header:first-child {\n padding-top: var(--pillar-spacing-sm);\n}\n\n/* Mobile: larger touch targets (min 44px) */\n._pillar-history-menu--mobile ._pillar-history-item {\n min-height: 44px;\n padding: var(--pillar-spacing-sm) var(--pillar-spacing-md);\n margin: 0 var(--pillar-spacing-sm);\n width: calc(100% - var(--pillar-spacing-md));\n border-radius: var(--pillar-radius-md);\n}\n\n._pillar-history-menu--mobile ._pillar-history-item:active {\n background: var(--pillar-bg-secondary);\n}\n\n/* Mobile: slightly larger item text */\n._pillar-history-menu--mobile ._pillar-history-item-title {\n font-size: 15px;\n}\n\n/* Mobile: loading / empty states get more breathing room */\n._pillar-history-menu--mobile ._pillar-history-loading,\n._pillar-history-menu--mobile ._pillar-history-empty {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 15px;\n}\n\n/* Public override classes */\n.pillar-history-dropdown {\n}\n.pillar-history-menu {\n}\n.pillar-history-group-header {\n}\n.pillar-history-list {\n}\n.pillar-history-item {\n}\n.pillar-history-item-title {\n}\n.pillar-close-btn {\n}\n","/* ============================================================================\n Search Input\n Internal: _pillar-search | Public: pillar-search\n ============================================================================ */\n\n._pillar-search {\n position: relative;\n padding: var(--pillar-spacing-lg) var(--pillar-spacing-xl);\n}\n\n._pillar-search-input {\n width: 100%;\n padding: 10px 12px 10px 40px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n color: var(--pillar-text);\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n outline: none;\n transition: border-color var(--pillar-transition-fast), box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-search-input:focus {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-search-input::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-search-icon {\n position: absolute;\n left: 32px;\n top: 50%;\n transform: translateY(-50%);\n width: 18px;\n height: 18px;\n color: var(--pillar-text-placeholder);\n pointer-events: none;\n}\n\n._pillar-search-icon svg {\n width: 18px;\n height: 18px;\n}\n\n.pillar-search {}\n.pillar-search-input {}\n.pillar-search-icon {}\n\n/* ============================================================================\n Chat Input (Persistent Bottom)\n Internal: _pillar-chat-input | Public: pillar-chat-input\n ============================================================================ */\n\n._pillar-chat-input-container {\n flex-shrink: 0;\n border-top: 1px solid var(--pillar-border);\n background: var(--pillar-bg);\n display: flex;\n flex-direction: column;\n max-height: 50%;\n transition: max-height var(--pillar-transition-normal);\n}\n\n._pillar-chat-input-container--expanded {\n max-height: 60%;\n}\n\n._pillar-chat-input-messages {\n flex: 1;\n overflow-y: auto;\n padding: 0;\n max-height: 0;\n transition: max-height var(--pillar-transition-normal), padding var(--pillar-transition-normal);\n}\n\n._pillar-chat-input-container--expanded ._pillar-chat-input-messages {\n max-height: 300px;\n padding: var(--pillar-spacing-lg) var(--pillar-spacing-xl);\n}\n\n._pillar-chat-input-message {\n margin-bottom: var(--pillar-spacing-md);\n}\n\n._pillar-chat-input-message--user {\n text-align: right;\n}\n\n._pillar-chat-input-message-content {\n display: inline-block;\n max-width: 85%;\n padding: 10px 14px;\n border-radius: var(--pillar-spacing-lg);\n font-size: var(--pillar-font-size-base);\n line-height: 1.5;\n}\n\n._pillar-chat-input-message--user ._pillar-chat-input-message-content {\n background: var(--pillar-primary);\n color: #ffffff;\n border-bottom-right-radius: var(--pillar-radius-sm);\n}\n\n._pillar-chat-input-message--assistant ._pillar-chat-input-message-content {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text);\n border-bottom-left-radius: var(--pillar-radius-sm);\n}\n\n._pillar-chat-input-sources {\n margin-top: var(--pillar-spacing-sm);\n padding-top: var(--pillar-spacing-sm);\n border-top: 1px solid var(--pillar-border);\n}\n\n._pillar-chat-input-sources-title {\n font-size: var(--pillar-font-size-xs);\n font-weight: 500;\n color: var(--pillar-text-muted);\n margin-bottom: 6px;\n}\n\n._pillar-chat-input-source {\n display: block;\n padding: 6px 10px;\n margin-bottom: var(--pillar-spacing-xs);\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-primary);\n background: var(--pillar-primary-light);\n border-radius: var(--pillar-radius-md);\n text-decoration: none;\n cursor: pointer;\n}\n\n._pillar-chat-input-source:hover {\n background: var(--pillar-primary-light-hover);\n}\n\n._pillar-chat-input-area {\n padding: var(--pillar-spacing-md) var(--pillar-spacing-lg);\n}\n\n._pillar-chat-input-wrapper {\n display: flex;\n flex-direction: column;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-xl);\n transition: border-color var(--pillar-transition-fast), box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-chat-input-wrapper:focus-within {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-chat-input-textarea {\n display: block;\n width: 100%;\n padding: 12px 14px 8px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n line-height: 1.5;\n color: var(--pillar-text);\n background: transparent;\n border: none;\n outline: none;\n resize: none;\n overflow-y: hidden;\n box-sizing: border-box;\n}\n\n._pillar-chat-input-textarea::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-chat-input-container {}\n.pillar-chat-input-messages {}\n.pillar-chat-input-message {}\n.pillar-chat-input-message-content {}\n.pillar-chat-input-sources {}\n.pillar-chat-input-area {}\n.pillar-chat-input-wrapper {}\n.pillar-chat-input-textarea {}\n\n/* ============================================================================\n Chat Input Footer (contains send button)\n ============================================================================ */\n\n._pillar-chat-input-footer {\n display: flex;\n justify-content: flex-end;\n padding: 8px 10px;\n}\n\n/* ============================================================================\n Send Button - In footer row, right aligned\n Internal: _pillar-send-btn | Public: pillar-send-btn\n ============================================================================ */\n\n._pillar-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-tertiary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-send-btn:hover:not(:disabled) {\n color: #ffffff;\n background: var(--pillar-primary);\n}\n\n._pillar-send-btn:disabled {\n color: var(--pillar-text-placeholder);\n background: var(--pillar-bg-tertiary);\n cursor: not-allowed;\n}\n\n._pillar-send-btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-send-btn {}\n.pillar-chat-input-footer {}\n\n/* ============================================================================\n Chat Image Upload\n ============================================================================ */\n\n._pillar-chat-view-input-area--dragging {\n position: relative;\n background: var(--pillar-primary-light);\n}\n\n._pillar-chat-drop-overlay {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: var(--pillar-primary-light);\n border: 2px dashed var(--pillar-primary);\n border-radius: var(--pillar-radius-lg);\n color: var(--pillar-primary);\n font-size: var(--pillar-font-size-sm);\n font-weight: 500;\n z-index: 10;\n pointer-events: none;\n}\n\n._pillar-chat-drop-overlay svg {\n width: 24px;\n height: 24px;\n}\n\n._pillar-chat-images-preview {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n padding: 12px 12px 4px 12px;\n}\n\n._pillar-chat-image-thumb {\n position: relative;\n width: 56px;\n height: 56px;\n border-radius: var(--pillar-radius-md);\n overflow: hidden;\n border: 1px solid var(--pillar-border);\n}\n\n._pillar-chat-image-thumb img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n._pillar-chat-image-loading {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n._pillar-chat-image-error {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(239, 68, 68, 0.3);\n color: #dc2626;\n font-weight: bold;\n font-size: 14px;\n}\n\n._pillar-chat-image-remove {\n position: absolute;\n top: 2px;\n right: 2px;\n width: 18px;\n height: 18px;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.6);\n border: none;\n border-radius: 50%;\n color: white;\n cursor: pointer;\n opacity: 0;\n transition: opacity var(--pillar-transition-fast);\n}\n\n._pillar-chat-image-thumb:hover ._pillar-chat-image-remove {\n opacity: 1;\n}\n\n._pillar-chat-image-remove svg {\n width: 10px;\n height: 10px;\n}\n\n._pillar-chat-image-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: transparent;\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: color var(--pillar-transition-fast);\n}\n\n._pillar-chat-image-btn:hover:not(:disabled) {\n color: var(--pillar-text);\n}\n\n._pillar-chat-image-btn:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n._pillar-chat-image-btn svg {\n width: 18px;\n height: 18px;\n}\n\n.pillar-chat-images-preview {}\n.pillar-chat-image-thumb {}\n.pillar-chat-image-remove {}\n.pillar-chat-image-btn {}\n.pillar-chat-drop-overlay {}\n","/* ============================================================================\n Unified Chat Input\n Internal: _pillar-unified-input | Public: pillar-unified-input\n Reusable input component with context tag support\n ============================================================================ */\n\n._pillar-unified-input-wrapper {\n display: flex;\n flex-direction: column;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-xl);\n transition:\n border-color var(--pillar-transition-fast),\n box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-unified-input-wrapper:focus-within {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-unified-input {\n display: block;\n width: 100%;\n padding: 12px 14px 8px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n line-height: 1.5;\n color: var(--pillar-text);\n background: transparent;\n border: none;\n outline: none;\n resize: none;\n overflow-y: hidden;\n box-sizing: border-box;\n}\n\n._pillar-unified-input::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-unified-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n._pillar-unified-input-row {\n display: flex;\n justify-content: flex-end;\n align-items: flex-end;\n padding: 4px 8px 0px 8px;\n}\n\n._pillar-unified-input-actions {\n padding-bottom: 8px;\n}\n\n._pillar-unified-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: #ffffff;\n background: var(--pillar-primary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-unified-send-btn:hover:not(:disabled) {\n background: var(--pillar-primary-hover);\n}\n\n._pillar-unified-send-btn:disabled {\n color: var(--pillar-text-placeholder);\n background: var(--pillar-bg-tertiary);\n cursor: not-allowed;\n}\n\n._pillar-unified-send-btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-unified-input-wrapper {\n}\n.pillar-unified-input {\n}\n.pillar-unified-input-row {\n}\n.pillar-unified-send-btn {\n}\n\n._pillar-unified-stop-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-tertiary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-unified-stop-btn:hover {\n opacity: 0.9;\n}\n\n._pillar-unified-stop-btn svg {\n width: 18px;\n height: 18px;\n}\n\n.pillar-unified-stop-btn {\n}\n","/* ============================================================================\n Context Tags\n Internal: _pillar-context-tag | Public: pillar-context-tag\n Removable chips for user context items (highlighted text, etc.)\n ============================================================================ */\n\n._pillar-context-tag-list {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n padding: 8px 14px 0;\n}\n\n._pillar-context-tag {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n max-width: 200px;\n padding: 4px 6px 4px 8px;\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-secondary);\n background: var(--pillar-bg-tertiary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-md);\n cursor: default;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-context-tag:hover {\n background: var(--pillar-bg-secondary);\n border-color: var(--pillar-text-muted);\n}\n\n._pillar-context-tag-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n color: var(--pillar-primary);\n}\n\n._pillar-context-tag-icon svg {\n width: 12px;\n height: 12px;\n}\n\n._pillar-context-tag-label {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 1.3;\n}\n\n._pillar-context-tag-remove {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n padding: 0;\n margin-left: 2px;\n color: var(--pillar-text-placeholder);\n background: transparent;\n border: none;\n border-radius: var(--pillar-radius-sm);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-context-tag-remove:hover {\n color: var(--pillar-text);\n background: var(--pillar-border);\n}\n\n._pillar-context-tag-remove svg {\n width: 12px;\n height: 12px;\n}\n\n.pillar-context-tag-list {}\n.pillar-context-tag {}\n.pillar-context-tag-icon {}\n.pillar-context-tag-label {}\n.pillar-context-tag-remove {}\n\n/* Context tags inside user message bubbles need inverted colors */\n._pillar-message-user ._pillar-context-tag-list {\n padding: 0 0 8px 0;\n}\n\n._pillar-message-user ._pillar-context-tag {\n background: rgba(255, 255, 255, 0.2);\n border-color: rgba(255, 255, 255, 0.3);\n color: #ffffff;\n}\n\n._pillar-message-user ._pillar-context-tag:hover {\n background: rgba(255, 255, 255, 0.3);\n border-color: rgba(255, 255, 255, 0.4);\n}\n\n._pillar-message-user ._pillar-context-tag-icon {\n color: #ffffff;\n}\n\n._pillar-message-user ._pillar-context-tag-label {\n color: #ffffff;\n}\n","/* Task Button Component */\n.pillar-task-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 14px;\n font-size: 13px;\n font-weight: 500;\n font-family: inherit;\n border-radius: 8px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: 1px solid transparent;\n text-decoration: none;\n}\n\n.pillar-task-btn__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.pillar-task-btn__icon svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-task-btn__label {\n white-space: nowrap;\n}\n\n/* Primary variant (default) */\n.pillar-task-btn--primary {\n background: var(--pillar-primary);\n color: #ffffff;\n border-color: var(--pillar-primary);\n}\n\n.pillar-task-btn--primary:hover {\n background: var(--pillar-primary-hover);\n border-color: var(--pillar-primary-hover);\n}\n\n/* Default variant */\n.pillar-task-btn--default {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text);\n border-color: var(--pillar-border);\n}\n\n.pillar-task-btn--default:hover {\n background: var(--pillar-border);\n}\n\n/* Secondary variant */\n.pillar-task-btn--secondary {\n background: var(--pillar-primary-light);\n color: var(--pillar-primary);\n border-color: var(--pillar-primary-light-hover);\n}\n\n.pillar-task-btn--secondary:hover {\n background: var(--pillar-primary-light-hover);\n}\n\n/* Outline variant */\n.pillar-task-btn--outline {\n background: transparent;\n color: var(--pillar-primary);\n border-color: var(--pillar-primary);\n}\n\n.pillar-task-btn--outline:hover {\n background: var(--pillar-primary-light);\n}\n\n/* Ghost variant */\n.pillar-task-btn--ghost {\n background: transparent;\n color: var(--pillar-text-muted);\n border-color: transparent;\n}\n\n.pillar-task-btn--ghost:hover {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text);\n}\n\n/* Active state for inline_ui buttons with expanded card */\n.pillar-task-btn--active {\n background: var(--pillar-primary-hover);\n border-color: var(--pillar-primary-hover);\n}\n\n/* Task button group */\n.pillar-task-btn-group {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-top: 12px;\n}\n\n/* Inline card container for inline_ui actions */\n.pillar-task-btn-inline-card {\n margin-top: 12px;\n animation: pillar-slide-down 0.15s ease-out;\n}\n\n@keyframes pillar-slide-down {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Task suggestion card in chat */\n.pillar-task-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 12px;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: 12px;\n margin-top: 12px;\n}\n\n.pillar-task-suggestion__header {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: var(--pillar-text-muted);\n}\n\n.pillar-task-suggestion__header svg {\n width: 14px;\n height: 14px;\n}\n\n.pillar-task-suggestion__description {\n font-size: 13px;\n color: var(--pillar-text-secondary);\n}\n","/* Workflow Checklist Container */\n.pillar-workflow {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: 12px;\n margin: 12px 0;\n}\n\n/* Header */\n.pillar-workflow__header {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.pillar-workflow__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--pillar-text-muted);\n}\n\n.pillar-workflow__title {\n flex: 1;\n font-size: 14px;\n font-weight: 600;\n color: var(--pillar-text);\n}\n\n.pillar-workflow__progress {\n font-size: 12px;\n font-weight: 500;\n color: var(--pillar-text-muted);\n padding: 2px 8px;\n background: var(--pillar-border);\n border-radius: 10px;\n}\n\n.pillar-workflow__description {\n font-size: 13px;\n color: var(--pillar-text-muted);\n}\n\n/* Steps List */\n.pillar-workflow__steps {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n/* Individual Step */\n.pillar-workflow-step {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 10px 12px;\n background: var(--pillar-bg);\n border: 1px solid var(--pillar-border);\n border-radius: 8px;\n transition: all 0.15s ease;\n}\n\n.pillar-workflow-step__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 24px;\n height: 24px;\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-workflow-step__icon svg {\n width: 18px;\n height: 18px;\n}\n\n.pillar-workflow-step__content {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.pillar-workflow-step__label {\n font-size: 13px;\n font-weight: 500;\n color: var(--pillar-text-secondary);\n}\n\n.pillar-workflow-step__note {\n font-size: 12px;\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-workflow-step__status-text {\n font-size: 12px;\n color: var(--pillar-primary);\n font-style: italic;\n}\n\n.pillar-workflow-step__actions {\n display: flex;\n gap: 8px;\n margin-top: 4px;\n}\n\n/* Step States */\n.pillar-workflow-step--pending {\n opacity: 0.6;\n}\n\n.pillar-workflow-step--awaiting_initiation {\n background: #fef3c7;\n border-color: #fcd34d;\n}\n\n.pillar-workflow-step--awaiting_initiation .pillar-workflow-step__icon {\n color: #d97706;\n}\n\n.pillar-workflow-step--active {\n background: var(--pillar-primary-light);\n border-color: var(--pillar-primary);\n}\n\n.pillar-workflow-step--active .pillar-workflow-step__icon {\n color: var(--pillar-primary);\n}\n\n.pillar-workflow-step--completed .pillar-workflow-step__icon {\n color: #059669;\n}\n\n.pillar-workflow-step--completed .pillar-workflow-step__label {\n text-decoration: line-through;\n color: var(--pillar-text-muted);\n}\n\n.pillar-workflow-step--skipped {\n opacity: 0.5;\n}\n\n.pillar-workflow-step--skipped .pillar-workflow-step__icon {\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-workflow-step--skipped .pillar-workflow-step__label {\n text-decoration: line-through;\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-workflow-step--failed {\n background: #fef2f2;\n border-color: #fca5a5;\n}\n\n.pillar-workflow-step--failed .pillar-workflow-step__icon {\n color: #dc2626;\n}\n\n/* Start Button */\n.pillar-workflow-step__start-btn {\n display: inline-flex;\n align-items: center;\n padding: 6px 12px;\n font-size: 12px;\n font-weight: 600;\n font-family: inherit;\n background: var(--pillar-primary);\n color: #ffffff;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.pillar-workflow-step__start-btn:hover {\n background: var(--pillar-primary-hover);\n}\n\n/* Skip Button */\n.pillar-workflow-step__skip-btn {\n display: inline-flex;\n align-items: center;\n padding: 6px 12px;\n font-size: 12px;\n font-weight: 500;\n font-family: inherit;\n background: transparent;\n color: var(--pillar-text-muted);\n border: 1px solid var(--pillar-border);\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.pillar-workflow-step__skip-btn:hover {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text-secondary);\n}\n\n/* Spinner Animation for Active Step */\n@keyframes pillar-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n.pillar-workflow-step__spinner {\n animation: pillar-spin 1s linear infinite;\n}\n\n/* Footer */\n.pillar-workflow__footer {\n display: flex;\n justify-content: flex-end;\n padding-top: 8px;\n border-top: 1px solid var(--pillar-border);\n}\n\n.pillar-workflow__cancel-btn {\n padding: 6px 12px;\n font-size: 12px;\n font-weight: 500;\n font-family: inherit;\n background: transparent;\n color: var(--pillar-text-placeholder);\n border: none;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.pillar-workflow__cancel-btn:hover {\n color: #dc2626;\n}\n","/* ============================================================================\n Home View\n ============================================================================ */\n\n._pillar-home-view {\n display: flex;\n flex-direction: column;\n height: 100%;\n padding: var(--pillar-spacing-xl);\n}\n\n._pillar-home-view-header {\n text-align: center;\n padding: var(--pillar-spacing-2xl) 0;\n}\n\n._pillar-home-view-icon {\n font-size: 40px;\n margin-bottom: var(--pillar-spacing-md);\n}\n\n._pillar-home-view-title {\n font-size: var(--pillar-font-size-xl);\n font-weight: 600;\n color: var(--pillar-text);\n margin: 0;\n}\n\n._pillar-home-view-questions {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-sm);\n margin-bottom: var(--pillar-spacing-md);\n}\n\n._pillar-home-view-input-wrapper {\n margin-top: auto;\n display: flex;\n flex-direction: column;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-xl);\n transition: border-color var(--pillar-transition-fast), box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-home-view-input-wrapper:focus-within {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-home-view-input {\n display: block;\n width: 100%;\n padding: 12px 14px 8px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n line-height: 1.5;\n color: var(--pillar-text);\n background: transparent;\n border: none;\n outline: none;\n resize: none;\n overflow-y: hidden;\n box-sizing: border-box;\n}\n\n._pillar-home-view-input::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-home-view-input-row {\n display: flex;\n justify-content: flex-end;\n padding: 8px 10px;\n}\n\n._pillar-home-view-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-tertiary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-home-view-send-btn:hover:not(:disabled) {\n color: #ffffff;\n background: var(--pillar-primary);\n}\n\n._pillar-home-view-send-btn:disabled {\n color: var(--pillar-text-placeholder);\n background: var(--pillar-bg-tertiary);\n cursor: not-allowed;\n}\n\n._pillar-home-view-send-btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-home-view {}\n.pillar-home-view-header {}\n.pillar-home-view-title {}\n.pillar-home-view-questions {}\n.pillar-home-view-input-wrapper {}\n.pillar-home-view-input {}\n.pillar-home-view-send-btn {}\n","/* ============================================================================\n Standalone Chat View\n Internal: _pillar-chat-view | Public: pillar-chat-view\n ============================================================================ */\n\n._pillar-chat-view {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n}\n\n._pillar-chat-view-messages {\n flex: 1;\n overflow-y: auto;\n padding: var(--pillar-spacing-xl);\n display: flex;\n flex-direction: column;\n}\n\n._pillar-chat-view-welcome {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n padding: var(--pillar-spacing-xl);\n text-align: center;\n}\n\n._pillar-chat-view-welcome-icon {\n font-size: 48px;\n margin-bottom: var(--pillar-spacing-lg);\n}\n\n._pillar-chat-view-welcome-title {\n font-size: var(--pillar-font-size-xl);\n font-weight: 600;\n color: var(--pillar-text);\n margin-bottom: var(--pillar-spacing-sm);\n}\n\n._pillar-chat-view-welcome-text {\n font-size: var(--pillar-font-size-base);\n color: var(--pillar-text-muted);\n max-width: 280px;\n}\n\n/* History Loading Skeleton */\n._pillar-chat-history-loading {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-lg);\n padding: var(--pillar-spacing-md) 0;\n}\n\n._pillar-chat-history-loading-message {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-xs);\n}\n\n._pillar-chat-history-loading-message--user {\n align-items: flex-end;\n}\n\n._pillar-chat-history-loading-message--assistant {\n align-items: flex-start;\n}\n\n._pillar-chat-history-loading-bar {\n height: 16px;\n border-radius: var(--pillar-radius-md);\n background: linear-gradient(90deg, var(--pillar-bg-secondary) 25%, var(--pillar-border) 50%, var(--pillar-bg-secondary) 75%);\n background-size: 200% 100%;\n animation: pillar-shimmer 1.5s infinite;\n}\n\n._pillar-chat-history-loading-message--user ._pillar-chat-history-loading-bar {\n background: linear-gradient(90deg, var(--pillar-bg-secondary) 25%, var(--pillar-border) 50%, var(--pillar-bg-secondary) 75%);\n background-size: 200% 100%;\n animation: pillar-shimmer 1.5s infinite;\n}\n\n.pillar-chat-history-loading {}\n.pillar-chat-history-loading-message--user {}\n.pillar-chat-history-loading-message--assistant {}\n.pillar-chat-history-loading-bar {}\n\n._pillar-chat-view-message {\n margin-bottom: var(--pillar-spacing-lg);\n}\n\n._pillar-chat-view-message--user {\n text-align: right;\n}\n\n._pillar-chat-view-message--assistant {\n text-align: left;\n}\n\n.pillar-chat-view {}\n.pillar-chat-view-messages {}\n.pillar-chat-view-welcome {}\n.pillar-chat-view-message {}\n\n/* ============================================================================\n User Message Bubble\n Internal: _pillar-message-user | Public: pillar-message-user\n ============================================================================ */\n\n._pillar-message-user {\n display: inline-block;\n max-width: 85%;\n padding: 10px 14px;\n border-radius: var(--pillar-spacing-lg);\n border-bottom-right-radius: var(--pillar-radius-sm);\n font-size: var(--pillar-font-size-base);\n line-height: 1.5;\n background: var(--pillar-primary);\n color: #ffffff;\n white-space: pre-wrap;\n text-align: left;\n word-wrap: break-word;\n}\n\n._pillar-message-user-images {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-bottom: var(--pillar-spacing-sm);\n}\n\n._pillar-message-user-image {\n max-width: 120px;\n max-height: 120px;\n border-radius: var(--pillar-radius-md);\n object-fit: cover;\n}\n\n.pillar-message-user {}\n.pillar-message-user-images {}\n.pillar-message-user-image {}\n\n/* ============================================================================\n AI Response\n Internal: _pillar-message-assistant | Public: pillar-message-assistant\n ============================================================================ */\n\n._pillar-message-assistant {\n font-size: var(--pillar-font-size-base);\n line-height: 1.45;\n color: var(--pillar-text-secondary);\n}\n\n._pillar-message-assistant p {\n margin: 0 0 var(--pillar-spacing-sm);\n}\n\n._pillar-message-assistant p:last-child {\n margin-bottom: 0;\n}\n\n._pillar-message-assistant h2 {\n font-size: var(--pillar-font-size-lg);\n font-weight: 600;\n color: var(--pillar-text);\n margin: var(--pillar-spacing-md) 0 var(--pillar-spacing-xs);\n}\n\n._pillar-message-assistant h3 {\n font-size: var(--pillar-font-size-md);\n font-weight: 600;\n color: var(--pillar-text);\n margin: 10px 0 4px;\n}\n\n._pillar-message-assistant h4 {\n font-size: var(--pillar-font-size-base);\n font-weight: 600;\n color: var(--pillar-text);\n margin: var(--pillar-spacing-sm) 0 4px;\n}\n\n._pillar-message-assistant ul,\n._pillar-message-assistant ol {\n margin: 0 0 var(--pillar-spacing-sm);\n padding-left: var(--pillar-spacing-2xl);\n list-style-position: outside;\n}\n\n._pillar-message-assistant ul {\n list-style-type: disc;\n}\n\n._pillar-message-assistant ol {\n list-style-type: decimal;\n}\n\n._pillar-message-assistant li {\n margin-bottom: 2px;\n}\n\n._pillar-message-assistant code {\n padding: 2px 6px;\n font-size: var(--pillar-font-size-sm);\n background: var(--pillar-bg-tertiary);\n border-radius: var(--pillar-radius-sm);\n font-family: var(--pillar-font-mono);\n color: var(--pillar-text);\n}\n\n._pillar-message-assistant pre {\n margin: var(--pillar-spacing-md) 0;\n padding: var(--pillar-spacing-md) 14px;\n background: var(--pillar-code-bg);\n border-radius: var(--pillar-radius-lg);\n overflow-x: auto;\n}\n\n._pillar-message-assistant pre code {\n padding: 0;\n background: none;\n color: var(--pillar-code-text);\n font-size: var(--pillar-font-size-sm);\n line-height: 1.5;\n}\n\n._pillar-message-assistant a {\n color: var(--pillar-primary);\n text-decoration: none;\n}\n\n._pillar-message-assistant a:hover {\n text-decoration: underline;\n}\n\n._pillar-message-assistant strong {\n font-weight: 600;\n color: var(--pillar-text);\n}\n\n._pillar-message-assistant em {\n font-style: italic;\n}\n\n.pillar-message-assistant {}\n\n/* ============================================================================\n Chat Sources\n Internal: _pillar-chat-sources | Public: pillar-chat-sources\n ============================================================================ */\n\n._pillar-chat-sources {\n margin-top: var(--pillar-spacing-md);\n padding-top: var(--pillar-spacing-md);\n border-top: 1px solid var(--pillar-border);\n}\n\n._pillar-chat-sources-title {\n font-size: var(--pillar-font-size-xs);\n font-weight: 500;\n color: var(--pillar-text-muted);\n margin-bottom: var(--pillar-spacing-sm);\n}\n\n._pillar-chat-source {\n display: block;\n padding: var(--pillar-spacing-sm) var(--pillar-spacing-md);\n margin-bottom: 6px;\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-primary);\n background: var(--pillar-primary-light);\n border-radius: var(--pillar-radius-lg);\n text-decoration: none;\n cursor: pointer;\n transition: background var(--pillar-transition-fast);\n}\n\n._pillar-chat-source:hover {\n background: var(--pillar-primary-light-hover);\n}\n\n.pillar-chat-sources {}\n.pillar-chat-sources-title {}\n.pillar-chat-source {}\n\n/* ============================================================================\n Chat Actions (Suggested action buttons)\n Internal: _pillar-chat-actions | Public: pillar-chat-actions\n ============================================================================ */\n\n._pillar-chat-actions {\n margin-top: var(--pillar-spacing-md);\n padding-top: var(--pillar-spacing-md);\n border-top: 1px solid var(--pillar-border);\n}\n\n._pillar-chat-actions-title {\n font-size: var(--pillar-font-size-xs);\n font-weight: 500;\n color: var(--pillar-text-muted);\n margin-bottom: var(--pillar-spacing-sm);\n}\n\n._pillar-chat-actions-buttons {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-sm);\n}\n\n/* Task buttons should wrap horizontally */\n._pillar-chat-actions-buttons > ._pillar-task-button-group {\n display: flex;\n flex-wrap: wrap;\n gap: var(--pillar-spacing-sm);\n}\n\n/* Confirm cards take full width */\n._pillar-chat-actions-buttons > .pillar-confirm-card-wrapper {\n width: 100%;\n}\n\n.pillar-chat-actions {}\n.pillar-chat-actions-title {}\n.pillar-chat-actions-buttons {}\n\n/* ============================================================================\n Chat View Input Area - Cursor-style design\n ============================================================================ */\n\n._pillar-chat-view-input-area {\n flex-shrink: 0;\n padding: 0 var(--pillar-spacing-xl) var(--pillar-spacing-xl);\n background: var(--pillar-bg);\n}\n\n._pillar-chat-view-input-wrapper {\n display: flex;\n flex-direction: column;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-xl);\n transition: border-color var(--pillar-transition-fast), box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-chat-view-input-wrapper:focus-within {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-chat-view-input {\n display: block;\n width: 100%;\n padding: 12px 14px 8px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n line-height: 1.5;\n color: var(--pillar-text);\n background: transparent;\n border: none;\n outline: none;\n resize: none;\n overflow-y: hidden;\n box-sizing: border-box;\n}\n\n._pillar-chat-view-input::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-chat-view-input-row {\n display: flex;\n justify-content: flex-end;\n padding: 8px 10px;\n}\n\n._pillar-chat-view-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-tertiary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-chat-view-send-btn:hover:not(:disabled) {\n color: #ffffff;\n background: var(--pillar-primary);\n}\n\n._pillar-chat-view-send-btn:active:not(:disabled) {\n transform: scale(0.95);\n}\n\n._pillar-chat-view-send-btn:disabled {\n color: var(--pillar-text-placeholder);\n background: var(--pillar-bg-tertiary);\n cursor: not-allowed;\n}\n\n._pillar-chat-view-send-btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-chat-view-input-area {}\n.pillar-chat-view-input-wrapper {}\n.pillar-chat-view-input {}\n.pillar-chat-view-send-btn {}\n.pillar-chat-view-input-footer {}\n.pillar-chat-view-new-chat-btn {}\n\n/* New chat button styling */\n._pillar-chat-view-input-footer {\n display: flex;\n justify-content: center;\n margin-top: var(--pillar-spacing-sm);\n}\n\n._pillar-chat-view-new-chat-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 6px 12px;\n font-size: var(--pillar-font-size-sm);\n font-weight: 500;\n font-family: var(--pillar-font-family);\n color: var(--pillar-text-muted);\n background: transparent;\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-chat-view-new-chat-btn:hover {\n color: var(--pillar-text);\n background: var(--pillar-bg-secondary);\n border-color: var(--pillar-text-muted);\n}\n\n._pillar-chat-view-new-chat-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n._pillar-chat-view-new-chat-icon svg {\n width: 14px;\n height: 14px;\n}\n\n/* Scrollbar for chat view */\n._pillar-chat-view-messages::-webkit-scrollbar {\n width: 6px;\n}\n\n._pillar-chat-view-messages::-webkit-scrollbar-track {\n background: var(--pillar-scrollbar-track);\n}\n\n._pillar-chat-view-messages::-webkit-scrollbar-thumb {\n background: var(--pillar-scrollbar-thumb);\n border-radius: 3px;\n}\n\n._pillar-chat-view-messages::-webkit-scrollbar-thumb:hover {\n background: var(--pillar-scrollbar-thumb-hover);\n}\n\n/* ============================================================================\n Feedback Icons\n Internal: _pillar-feedback | Public: pillar-feedback\n ============================================================================ */\n\n._pillar-message-assistant-wrapper {\n position: relative;\n}\n\n._pillar-feedback-icons {\n display: flex;\n gap: 4px;\n margin-top: var(--pillar-spacing-sm);\n justify-content: flex-start;\n}\n\n._pillar-feedback-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n background: transparent;\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n color: var(--pillar-text-placeholder);\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-feedback-btn:hover {\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-secondary);\n border-color: var(--pillar-border);\n}\n\n._pillar-feedback-btn--active {\n color: var(--pillar-primary);\n background: var(--pillar-primary-light);\n border-color: var(--pillar-primary);\n}\n\n._pillar-feedback-btn--active:hover {\n color: var(--pillar-primary);\n background: var(--pillar-primary-light-hover);\n}\n\n._pillar-feedback-btn svg {\n width: 14px;\n height: 14px;\n}\n\n.pillar-feedback-icons {}\n.pillar-feedback-btn {}\n.pillar-message-assistant-wrapper {}\n\n/* ============================================================================\n Action Status Indicators\n Internal: _pillar-action-status | Public: pillar-action-status\n Shows completion status for auto-run actions (checkmark, X, or spinner)\n ============================================================================ */\n\n._pillar-message-assistant-content {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n}\n\n._pillar-action-status {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n margin-top: 2px;\n}\n\n._pillar-action-status-indicator {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n}\n\n._pillar-action-status-indicator svg {\n width: 16px;\n height: 16px;\n}\n\n._pillar-action-status-indicator--success {\n color: var(--pillar-success, #22c55e);\n}\n\n._pillar-action-status-indicator--failed {\n color: var(--pillar-error, #ef4444);\n}\n\n._pillar-action-status-indicator--pending {\n color: var(--pillar-text-muted);\n animation: pillar-spin 1s linear infinite;\n}\n\n@keyframes pillar-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n\n.pillar-action-status {}\n.pillar-action-status-indicator {}\n.pillar-message-assistant-content {}\n","/* ============================================================================\n Resume Prompt (Session Resumption)\n Internal: _pillar-resume-prompt | Public: pillar-resume-prompt\n Shows when user reconnects and has an interrupted session to resume\n ============================================================================ */\n\n._pillar-resume-prompt {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-md);\n padding: var(--pillar-spacing-lg);\n margin: var(--pillar-spacing-md) 0;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n}\n\n._pillar-resume-prompt--seamless {\n flex-direction: row;\n align-items: center;\n gap: var(--pillar-spacing-sm);\n padding: var(--pillar-spacing-md) var(--pillar-spacing-lg);\n background: transparent;\n border: none;\n justify-content: center;\n}\n\n._pillar-resume-prompt-spinner {\n width: 16px;\n height: 16px;\n border: 2px solid var(--pillar-border);\n border-top-color: var(--pillar-primary);\n border-radius: 50%;\n animation: pillar-spin 0.8s linear infinite;\n flex-shrink: 0;\n}\n\n._pillar-resume-prompt-text {\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-muted);\n font-style: italic;\n}\n\n._pillar-resume-prompt-content {\n display: flex;\n gap: var(--pillar-spacing-md);\n align-items: flex-start;\n}\n\n._pillar-resume-prompt-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n flex-shrink: 0;\n color: var(--pillar-primary);\n background: var(--pillar-primary-light);\n border-radius: var(--pillar-radius-md);\n}\n\n._pillar-resume-prompt-body {\n flex: 1;\n min-width: 0;\n}\n\n._pillar-resume-prompt-title {\n font-size: var(--pillar-font-size-base);\n font-weight: 600;\n color: var(--pillar-text);\n margin-bottom: var(--pillar-spacing-xs);\n}\n\n._pillar-resume-prompt-message {\n display: flex;\n flex-direction: column;\n gap: 2px;\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-muted);\n}\n\n._pillar-resume-prompt-user-msg {\n font-style: italic;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n._pillar-resume-prompt-summary {\n font-size: var(--pillar-font-size-xs);\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-resume-prompt-actions {\n display: flex;\n gap: var(--pillar-spacing-sm);\n justify-content: flex-end;\n}\n\n._pillar-resume-prompt-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 14px;\n font-size: var(--pillar-font-size-sm);\n font-weight: 500;\n font-family: var(--pillar-font-family);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n border: 1px solid transparent;\n}\n\n._pillar-resume-prompt-btn--primary {\n background: var(--pillar-primary);\n color: #ffffff;\n border-color: var(--pillar-primary);\n}\n\n._pillar-resume-prompt-btn--primary:hover {\n background: var(--pillar-primary-hover);\n border-color: var(--pillar-primary-hover);\n}\n\n._pillar-resume-prompt-btn--ghost {\n background: transparent;\n color: var(--pillar-text-muted);\n border-color: transparent;\n}\n\n._pillar-resume-prompt-btn--ghost:hover {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text);\n}\n\n._pillar-resume-prompt-btn svg {\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n.pillar-resume-prompt {}\n.pillar-resume-prompt-spinner {}\n.pillar-resume-prompt-text {}\n.pillar-resume-prompt-content {}\n.pillar-resume-prompt-icon {}\n.pillar-resume-prompt-body {}\n.pillar-resume-prompt-title {}\n.pillar-resume-prompt-message {}\n.pillar-resume-prompt-user-msg {}\n.pillar-resume-prompt-summary {}\n.pillar-resume-prompt-actions {}\n.pillar-resume-prompt-btn {}\n","/* ============================================================================\n Question Chip\n ============================================================================ */\n\n._pillar-question-chip {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n padding: var(--pillar-spacing-md) var(--pillar-spacing-lg);\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n text-align: left;\n color: var(--pillar-text);\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n cursor: pointer;\n transition: background var(--pillar-transition-fast), border-color var(--pillar-transition-fast);\n}\n\n._pillar-question-chip:hover {\n border-color: var(--pillar-primary);\n}\n\n._pillar-question-chip-text {\n flex: 1;\n}\n\n._pillar-question-chip-arrow {\n color: var(--pillar-text-muted);\n margin-left: var(--pillar-spacing-sm);\n transition: color var(--pillar-transition-fast), transform var(--pillar-transition-fast);\n}\n\n._pillar-question-chip:hover ._pillar-question-chip-arrow {\n color: var(--pillar-primary);\n transform: translateX(2px);\n}\n\n._pillar-question-chip-skeleton {\n height: 44px;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n overflow: hidden;\n}\n\n._pillar-question-chip-skeleton-bar {\n width: 60%;\n height: 14px;\n margin: 15px var(--pillar-spacing-lg);\n background: linear-gradient(90deg, var(--pillar-border) 25%, var(--pillar-bg-tertiary) 50%, var(--pillar-border) 75%);\n background-size: 200% 100%;\n animation: pillar-shimmer 1.5s infinite;\n border-radius: var(--pillar-radius-sm);\n}\n\n@keyframes pillar-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n\n.pillar-question-chip {}\n.pillar-question-chip-text {}\n.pillar-question-chip-arrow {}\n.pillar-question-chip-skeleton {}\n.pillar-question-chip-skeleton-bar {}\n","/* ============================================================================\n Loading States\n Internal: _pillar-loading | Public: pillar-loading\n ============================================================================ */\n\n._pillar-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 40px var(--pillar-spacing-xl);\n color: var(--pillar-text-muted);\n}\n\n._pillar-loading-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--pillar-border);\n border-top-color: var(--pillar-primary);\n border-radius: 50%;\n animation: pillar-spin 0.8s linear infinite;\n}\n\n@keyframes pillar-spin {\n to { transform: rotate(360deg); }\n}\n\n.pillar-loading {}\n.pillar-loading-spinner {}\n\n/* ============================================================================\n Progress Indicator (AI activity status)\n Internal: _pillar-progress | Public: pillar-progress\n ============================================================================ */\n\n._pillar-progress-indicator {\n display: flex;\n align-items: center;\n gap: var(--pillar-spacing-sm);\n padding: var(--pillar-spacing-sm) 0;\n}\n\n._pillar-progress-indicator ._pillar-loading-spinner {\n width: 16px;\n height: 16px;\n flex-shrink: 0;\n}\n\n._pillar-progress-message {\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-muted);\n font-style: italic;\n}\n\n.pillar-progress-indicator {}\n.pillar-progress-message {}\n\n._pillar-thinking-shimmer {\n display: inline-block;\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-muted);\n background: linear-gradient(\n 90deg,\n var(--pillar-text-muted) 0%,\n var(--pillar-text-primary, #e5e5e5) 40%,\n var(--pillar-text-muted) 60%\n );\n background-size: 200% 100%;\n -webkit-background-clip: text;\n background-clip: text;\n -webkit-text-fill-color: transparent;\n animation: pillar-shimmer 2s ease-in-out infinite;\n}\n\n.pillar-thinking-shimmer {}\n\n/* ============================================================================\n Empty States\n Internal: _pillar-empty | Public: pillar-empty\n ============================================================================ */\n\n._pillar-empty {\n padding: 40px var(--pillar-spacing-xl);\n text-align: center;\n color: var(--pillar-text-muted);\n}\n\n._pillar-empty-icon {\n width: 48px;\n height: 48px;\n margin: 0 auto var(--pillar-spacing-lg);\n color: var(--pillar-border);\n}\n\n._pillar-empty-title {\n font-size: var(--pillar-font-size-lg);\n font-weight: 500;\n color: var(--pillar-text);\n margin-bottom: var(--pillar-spacing-xs);\n}\n\n._pillar-empty-description {\n font-size: var(--pillar-font-size-base);\n}\n\n.pillar-empty {}\n.pillar-empty-icon {}\n.pillar-empty-title {}\n.pillar-empty-description {}\n\n/* ============================================================================\n Section Titles\n Internal: _pillar-section-title | Public: pillar-section-title\n ============================================================================ */\n\n._pillar-section-title {\n padding: var(--pillar-spacing-md) var(--pillar-spacing-xl) var(--pillar-spacing-sm);\n font-size: var(--pillar-font-size-xs);\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: var(--pillar-text-muted);\n}\n\n.pillar-section-title {}\n\n/* ============================================================================\n Related Articles\n ============================================================================ */\n\n._pillar-related-articles {\n border-top: 1px solid var(--pillar-border);\n margin-top: var(--pillar-spacing-2xl);\n padding-top: var(--pillar-spacing-sm);\n}\n\n.pillar-related-articles {}\n",'/* ============================================================================\n Progress Row (for search, query, generating events)\n Internal: _pillar-progress-row | Public: pillar-progress-row\n ============================================================================ */\n\n._pillar-progress-events {\n margin: 4px 0;\n}\n\n._pillar-progress-row {\n margin: 1px 0;\n padding: 1px 0;\n font-size: 12px;\n animation: pillar-progress-row-fade-in 0.3s ease-in-out;\n}\n\n._pillar-progress-row--error {\n color: #dc2626;\n}\n\n@keyframes pillar-progress-row-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n._pillar-progress-row-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 2px 0;\n}\n\n._pillar-progress-expand-icon {\n font-size: 10px;\n color: var(--pillar-text-muted);\n transition: transform 0.2s ease;\n flex-shrink: 0;\n}\n\n._pillar-progress-row-header[style*="cursor: pointer"]:hover ._pillar-progress-expand-icon {\n color: var(--pillar-text-secondary);\n}\n\n._pillar-progress-row-header[data-expanded="true"] ._pillar-progress-expand-icon {\n transform: rotate(90deg);\n}\n\n._pillar-progress-message {\n color: var(--pillar-text-muted);\n font-size: 12px;\n font-style: italic;\n}\n\n._pillar-progress-no-results {\n color: var(--pillar-text-muted);\n font-size: 11px;\n font-style: italic;\n margin-left: 4px;\n}\n\n._pillar-progress-sources {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n._pillar-progress-source-item {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 2px 0;\n font-size: 11px;\n}\n\n._pillar-progress-source-link {\n flex: 1;\n display: flex;\n flex-direction: column;\n text-decoration: none;\n overflow: hidden;\n color: inherit;\n}\n\n._pillar-progress-source-link:hover ._pillar-progress-source-title {\n text-decoration: underline;\n}\n\n._pillar-progress-source-title {\n font-weight: 400;\n color: var(--pillar-text-muted);\n font-size: 11px;\n}\n\n._pillar-progress-details {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n._pillar-progress-detail-item {\n font-size: 11px;\n color: var(--pillar-text-muted);\n padding: 1px 0;\n}\n\n._pillar-progress-detail-action {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n}\n\n._pillar-progress-detail-name {\n font-weight: 500;\n}\n\n._pillar-progress-detail-desc {\n color: var(--pillar-text-muted);\n opacity: 0.8;\n}\n\n._pillar-progress-content-wrapper {\n position: relative;\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 0.2s ease-out;\n}\n\n._pillar-progress-content-wrapper--expanded {\n grid-template-rows: 1fr;\n margin-top: 6px;\n}\n\n._pillar-progress-content-container {\n overflow: hidden;\n min-height: 0;\n scrollbar-width: thin;\n scrollbar-color: var(--pillar-scrollbar-thumb) transparent;\n}\n\n._pillar-progress-content-wrapper--expanded ._pillar-progress-content-container {\n max-height: 180px;\n overflow-y: auto;\n}\n\n._pillar-progress-content-container::-webkit-scrollbar {\n width: 4px;\n}\n\n._pillar-progress-content-container::-webkit-scrollbar-track {\n background: transparent;\n}\n\n._pillar-progress-content-container::-webkit-scrollbar-thumb {\n background-color: var(--pillar-scrollbar-thumb);\n border-radius: 2px;\n}\n\n._pillar-progress-content-gradient {\n position: absolute;\n bottom: 0;\n left: 16px;\n right: 0;\n height: 20px;\n background: linear-gradient(transparent, var(--pillar-bg));\n pointer-events: none;\n}\n\n._pillar-progress-text {\n font-size: 11px;\n color: var(--pillar-text-muted);\n line-height: 1.4;\n word-break: break-word;\n}\n\n._pillar-progress-text p {\n margin: 0 0 4px 0;\n}\n\n._pillar-progress-text p:last-child {\n margin-bottom: 0;\n}\n\n._pillar-progress-text ol,\n._pillar-progress-text ul {\n margin: 2px 0;\n padding-left: 16px;\n}\n\n._pillar-progress-text li {\n margin-bottom: 1px;\n}\n\n._pillar-progress-text br {\n display: block;\n content: "";\n margin-top: 2px;\n}\n\n/* Chevron indicator for progress rows - rotates based on expanded state */\n/* Positioned inline next to label, hidden by default, shown on hover */\n._pillar-progress-chevron {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n font-size: 10px;\n color: var(--pillar-text-muted);\n transition: transform 0.2s ease, opacity 0.15s ease;\n opacity: 0;\n}\n\n._pillar-progress-row:hover ._pillar-progress-chevron {\n opacity: 1;\n}\n\n._pillar-progress-error-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n font-size: 10px;\n color: var(--pillar-error, #dc2626);\n}\n\n/* Tool call arguments (inputs) */\n._pillar-progress-arguments {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 10px;\n margin-bottom: 6px;\n font-size: 11px;\n line-height: 1.4;\n}\n\n._pillar-progress-argument-key {\n color: var(--pillar-text-muted);\n}\n\n._pillar-progress-argument-value {\n color: var(--pillar-text-secondary);\n}\n\n/* Text preview for streaming content */\n._pillar-progress-text-preview-wrapper {\n position: relative;\n margin-top: 4px;\n}\n\n._pillar-progress-text-preview {\n max-height: 180px;\n overflow-y: auto;\n font-size: 11px;\n color: var(--pillar-text-muted);\n line-height: 1.4;\n scroll-behavior: smooth;\n white-space: pre-wrap;\n word-break: break-word;\n scrollbar-width: thin;\n scrollbar-color: var(--pillar-scrollbar-thumb) transparent;\n}\n\n/* All content inside progress text preview should stay muted and small.\n Markdown headers, paragraphs, etc. must not look like answer text. */\n._pillar-progress-text-preview * {\n color: inherit !important;\n font-size: inherit !important;\n font-weight: normal !important;\n line-height: inherit !important;\n margin: 0 !important;\n}\n\n/* Top gradient - fades out older text at the top */\n._pillar-progress-text-gradient {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 20px;\n background: linear-gradient(to bottom, var(--pillar-bg), transparent);\n pointer-events: none;\n z-index: 1;\n}\n\n._pillar-progress-text-preview::-webkit-scrollbar {\n width: 4px;\n}\n\n._pillar-progress-text-preview::-webkit-scrollbar-track {\n background: transparent;\n}\n\n._pillar-progress-text-preview::-webkit-scrollbar-thumb {\n background-color: var(--pillar-scrollbar-thumb);\n border-radius: 2px;\n}\n\n/* Active state indicator */\n._pillar-progress-row--active ._pillar-progress-message {\n font-weight: 500;\n}\n\n/* Long text truncation for labels */\n._pillar-progress-message {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 300px;\n}\n\n/* Children/sub-items styling */\n._pillar-progress-children {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n._pillar-progress-child-item {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 2px 0;\n font-size: 11px;\n}\n\n._pillar-progress-child-link {\n color: var(--pillar-text-muted);\n text-decoration: none;\n transition: color 0.15s ease;\n}\n\n._pillar-progress-child-link:hover {\n color: var(--pillar-text-secondary);\n text-decoration: underline;\n}\n\n._pillar-progress-child-label {\n color: var(--pillar-text-muted);\n font-size: 11px;\n}\n\n/* ============================================================================\n Progress Group (collapsible tool event groups)\n Internal: _pillar-progress-group | Public: pillar-progress-group\n ============================================================================ */\n\n._pillar-progress-group {\n margin: 1px 0;\n animation: pillar-progress-row-fade-in 0.3s ease-in-out;\n}\n\n._pillar-progress-group-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 3px 0;\n cursor: pointer;\n font-size: 12px;\n color: var(--pillar-text-secondary, #6b7280);\n user-select: none;\n border-radius: 4px;\n transition: color 0.15s ease;\n}\n\n._pillar-progress-group-chevron {\n flex-shrink: 0;\n font-size: 8px;\n line-height: 1;\n color: inherit;\n}\n\n._pillar-progress-group-summary {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n._pillar-progress-group-active-dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--pillar-primary, #3b82f6);\n flex-shrink: 0;\n animation: pillar-progress-group-pulse 1.5s ease-in-out infinite;\n}\n\n@keyframes pillar-progress-group-pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.4; }\n}\n\n._pillar-progress-group-children {\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 0.2s ease;\n overflow: hidden;\n}\n\n._pillar-progress-group-children--expanded {\n grid-template-rows: 1fr;\n}\n\n._pillar-progress-group-children-inner {\n min-height: 0;\n padding-left: 14px;\n}\n\n/* Nested rows inside groups have reduced spacing */\n._pillar-progress-row--nested {\n margin: 0;\n padding: 0;\n}\n\n._pillar-progress-row--nested ._pillar-progress-row-header {\n padding: 2px 0;\n}\n\n._pillar-progress-row--nested ._pillar-progress-message {\n font-size: 11px;\n}\n\n.pillar-progress-events {}\n.pillar-progress-chevron {}\n.pillar-progress-error-icon {}\n.pillar-progress-text-preview-wrapper {}\n.pillar-progress-text-preview {}\n.pillar-progress-text-gradient {}\n.pillar-progress-children {}\n.pillar-progress-child-item {}\n.pillar-progress-child-link {}\n.pillar-progress-child-label {}\n.pillar-progress-row {}\n.pillar-progress-row-header {}\n.pillar-progress-expand-icon {}\n.pillar-progress-message {}\n.pillar-progress-no-results {}\n.pillar-progress-sources {}\n.pillar-progress-source-item {}\n.pillar-progress-source-link {}\n.pillar-progress-source-title {}\n.pillar-progress-arguments {}\n.pillar-progress-argument {}\n.pillar-progress-argument-key {}\n.pillar-progress-argument-value {}\n.pillar-progress-content-wrapper {}\n.pillar-progress-content-container {}\n.pillar-progress-content-gradient {}\n.pillar-progress-text {}\n.pillar-progress-group {}\n.pillar-progress-group-header {}\n.pillar-progress-group-chevron {}\n.pillar-progress-group-summary {}\n.pillar-progress-group-active-dot {}\n.pillar-progress-group-children {}\n',"/* Confirm Action Card */\n.pillar-confirm-card-wrapper {\n margin-top: 12px;\n}\n\n.pillar-confirm-card {\n background: var(--pillar-bg-secondary, #f9fafb);\n border: 1px solid var(--pillar-border, #e5e7eb);\n border-radius: 12px;\n overflow: hidden;\n}\n\n.pillar-confirm-card__content {\n padding: 16px;\n}\n\n.pillar-confirm-card__header {\n margin-bottom: 12px;\n}\n\n.pillar-confirm-card__title {\n font-size: 14px;\n font-weight: 600;\n color: var(--pillar-text-primary, #111827);\n}\n\n.pillar-confirm-card__data {\n background: var(--pillar-bg-primary, #ffffff);\n border: 1px solid var(--pillar-border, #e5e7eb);\n border-radius: 8px;\n padding: 12px;\n margin-bottom: 12px;\n}\n\n.pillar-confirm-card__data-row {\n display: flex;\n gap: 8px;\n font-size: 13px;\n margin-bottom: 4px;\n}\n\n.pillar-confirm-card__data-row:last-child {\n margin-bottom: 0;\n}\n\n.pillar-confirm-card__data-key {\n color: var(--pillar-text-secondary, #6b7280);\n flex-shrink: 0;\n}\n\n.pillar-confirm-card__data-value {\n color: var(--pillar-text-primary, #111827);\n word-break: break-word;\n}\n\n.pillar-confirm-card__actions {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n}\n\n.pillar-confirm-card__btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 14px;\n font-size: 13px;\n font-weight: 500;\n font-family: inherit;\n border-radius: 8px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: 1px solid transparent;\n}\n\n.pillar-confirm-card__btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.pillar-confirm-card__btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-confirm-card__btn--primary {\n background: var(--pillar-primary, #2563eb);\n color: #ffffff;\n border-color: var(--pillar-primary, #2563eb);\n}\n\n.pillar-confirm-card__btn--primary:hover:not(:disabled) {\n background: var(--pillar-primary-hover, #1d4ed8);\n border-color: var(--pillar-primary-hover, #1d4ed8);\n}\n\n.pillar-confirm-card__btn--secondary {\n background: var(--pillar-bg-primary, #ffffff);\n color: var(--pillar-text-secondary, #6b7280);\n border-color: var(--pillar-border, #e5e7eb);\n}\n\n.pillar-confirm-card__btn--secondary:hover:not(:disabled) {\n background: var(--pillar-bg-secondary, #f9fafb);\n}\n\n.pillar-confirm-card__success {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 16px;\n color: var(--pillar-success, #059669);\n font-weight: 500;\n}\n\n.pillar-confirm-card__success-icon svg {\n width: 20px;\n height: 20px;\n}\n\n.pillar-confirm-card__error {\n background: var(--pillar-error-light, #fef2f2);\n border: 1px solid var(--pillar-error-border, #fecaca);\n border-radius: 8px;\n padding: 12px;\n margin-bottom: 12px;\n color: var(--pillar-error, #dc2626);\n font-size: 13px;\n}\n\n.pillar-confirm-card__spinner {\n display: inline-flex;\n animation: pillar-spin 1s linear infinite;\n}\n\n@keyframes pillar-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n","/* ============================================================================\n Markdown Component Styles\n Combined from markdown-components.tsx and preact-markdown.tsx\n ============================================================================ */\n\n/* Collapsible Section */\n._pillar-collapsible {\n margin: 2px 0;\n}\n\n._pillar-collapsible-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 0;\n background: transparent;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 13px;\n font-weight: 500;\n color: var(--pillar-text-secondary, #6b7280);\n font-family: inherit;\n width: 100%;\n text-align: left;\n transition: background-color 0.15s ease;\n}\n\n._pillar-collapsible-header:hover {\n background: var(--pillar-bg-hover, rgba(0, 0, 0, 0.05));\n}\n\n._pillar-collapsible-icon {\n font-size: 10px;\n color: var(--pillar-text-muted, #9ca3af);\n}\n\n._pillar-collapsible-title {\n flex: 1;\n}\n\n._pillar-collapsible-content-wrapper {\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 0.2s ease;\n}\n\n._pillar-collapsible-content-wrapper--expanded {\n grid-template-rows: 1fr;\n}\n\n._pillar-collapsible-content {\n overflow: hidden;\n padding-left: 18px;\n font-size: 13px;\n color: var(--pillar-text-secondary, #6b7280);\n line-height: 1.4;\n}\n\n._pillar-collapsible-content-wrapper--expanded ._pillar-collapsible-content {\n padding-top: 2px;\n padding-bottom: 4px;\n}\n\n/* Source List */\n._pillar-source-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n margin: 4px 0;\n}\n\n._pillar-source-item {\n display: block;\n padding: 4px 8px;\n font-size: 12px;\n color: var(--pillar-primary, #2563eb);\n text-decoration: none;\n border-radius: 4px;\n transition: background-color 0.15s ease;\n}\n\n._pillar-source-item:hover {\n background: var(--pillar-bg-hover, rgba(0, 0, 0, 0.05));\n text-decoration: underline;\n}\n\n/* Task List */\n._pillar-task-list {\n list-style: none;\n padding: 0;\n margin: 8px 0;\n}\n\n._pillar-task-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 0;\n font-size: 13px;\n}\n\n._pillar-task-item--completed ._pillar-task-text {\n text-decoration: line-through;\n color: var(--pillar-text-placeholder, #9ca3af);\n}\n\n._pillar-task-checkbox {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n\n/* Code Block */\n._pillar-code-block {\n margin: 8px 0;\n border-radius: 8px;\n overflow: hidden;\n background: var(--pillar-bg-code, #1e1e1e);\n}\n\n._pillar-code-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n background: var(--pillar-bg-code-header, #2d2d2d);\n border-bottom: 1px solid var(--pillar-border-code, #404040);\n}\n\n._pillar-code-language {\n font-size: 11px;\n font-weight: 500;\n color: var(--pillar-text-code-header, #a0a0a0);\n text-transform: uppercase;\n}\n\n._pillar-code-copy {\n padding: 4px 8px;\n font-size: 11px;\n font-family: inherit;\n background: transparent;\n border: 1px solid var(--pillar-border-code, #404040);\n border-radius: 4px;\n color: var(--pillar-text-code-header, #a0a0a0);\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n._pillar-code-copy:hover {\n background: var(--pillar-bg-code-hover, #404040);\n color: #fff;\n}\n\n._pillar-code-pre {\n margin: 0;\n padding: 12px;\n overflow-x: auto;\n font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;\n font-size: 13px;\n line-height: 1.5;\n}\n\n._pillar-code-content {\n color: var(--pillar-text-code, #e0e0e0);\n}\n\n/* Action Buttons */\n._pillar-action-buttons {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin: 8px 0;\n}\n\n._pillar-action-button {\n padding: 8px 16px;\n font-size: 13px;\n font-weight: 500;\n font-family: inherit;\n background: var(--pillar-primary, #2563eb);\n color: #fff;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n._pillar-action-button:hover {\n background: var(--pillar-primary-hover, #1d4ed8);\n}\n\n/* Progress Indicator */\n._pillar-progress-indicator {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 0;\n font-size: 13px;\n color: var(--pillar-text-secondary, #6b7280);\n}\n\n._pillar-progress-indicator--active ._pillar-loading-spinner {\n display: inline-block;\n}\n\n/* Streaming Thinking Content */\n._pillar-progress-row--streaming {\n margin: 2px 0;\n}\n\n._pillar-thinking-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 0;\n font-size: 13px;\n font-weight: 500;\n color: var(--pillar-text-secondary, #6b7280);\n}\n\n._pillar-thinking-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n}\n\n._pillar-spinner {\n width: 12px;\n height: 12px;\n border: 2px solid var(--pillar-border, #e5e7eb);\n border-top-color: var(--pillar-primary, #2563eb);\n border-radius: 50%;\n animation: pillar-spin 0.8s linear infinite;\n}\n\n@keyframes pillar-spin {\n to { transform: rotate(360deg); }\n}\n\n._pillar-thinking-label {\n flex: 1;\n}\n\n._pillar-thinking-content {\n padding: 6px 10px;\n font-size: 13px;\n line-height: 1.4;\n color: var(--pillar-text-secondary, #6b7280);\n background: var(--pillar-bg-tertiary, #f9fafb);\n border-radius: 4px;\n margin-top: 2px;\n max-height: 150px;\n overflow-y: auto;\n}\n\n/* ============================================================================\n Preact Markdown Styles\n ============================================================================ */\n\n/* Base markdown container */\n._pillar-markdown {\n font-size: 14px;\n line-height: 1.45;\n color: var(--pillar-text, #1a1a1a);\n}\n\n/* Headings */\n._pillar-md-heading {\n margin: 10px 0 4px 0;\n font-weight: 600;\n line-height: 1.3;\n}\n\n._pillar-md-h1 { font-size: 1.5em; }\n._pillar-md-h2 { font-size: 1.3em; }\n._pillar-md-h3 { font-size: 1.15em; }\n._pillar-md-h4 { font-size: 1em; }\n._pillar-md-h5 { font-size: 0.95em; }\n._pillar-md-h6 { font-size: 0.9em; }\n\n/* Paragraphs */\n._pillar-md-paragraph {\n margin: 4px 0;\n}\n\n/* Links */\n._pillar-md-link {\n color: var(--pillar-primary, #2563eb);\n text-decoration: none;\n}\n\n._pillar-md-link:hover {\n text-decoration: underline;\n}\n\n/* Inline code */\n._pillar-md-code-inline {\n padding: 2px 6px;\n font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;\n font-size: 0.9em;\n background: var(--pillar-bg-code-inline, #f3f4f6);\n border-radius: 4px;\n}\n\n/* Lists */\n._pillar-md-list {\n margin: 4px 0;\n padding-left: 24px;\n}\n\n._pillar-md-list-item {\n margin: 2px 0;\n}\n\n/* Task list items */\n._pillar-md-task-item {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n list-style: none;\n margin-left: -24px;\n}\n\n._pillar-md-task-checkbox {\n margin-top: 4px;\n}\n\n._pillar-md-task-text--checked {\n text-decoration: line-through;\n color: var(--pillar-text-placeholder, #9ca3af);\n}\n\n/* Blockquote */\n._pillar-md-blockquote {\n margin: 8px 0;\n padding: 8px 16px;\n border-left: 3px solid var(--pillar-border, #e5e7eb);\n color: var(--pillar-text-muted, #6b7280);\n background: var(--pillar-bg-secondary, #f9fafb);\n}\n\n/* Horizontal rule */\n._pillar-md-hr {\n margin: 16px 0;\n border: none;\n border-top: 1px solid var(--pillar-border, #e5e7eb);\n}\n\n/* Tables */\n._pillar-md-table-wrapper {\n overflow-x: auto;\n margin: 8px 0;\n}\n\n._pillar-md-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 13px;\n}\n\n._pillar-md-th,\n._pillar-md-td {\n padding: 8px 12px;\n border: 1px solid var(--pillar-border, #e5e7eb);\n text-align: left;\n}\n\n._pillar-md-th {\n background: var(--pillar-bg-secondary, #f9fafb);\n font-weight: 600;\n}\n\n/* Images */\n._pillar-md-image {\n max-width: 100%;\n height: auto;\n border-radius: 8px;\n margin: 8px 0;\n}\n"].join("\n");function Cr(e,n=""){const t=[];return e.primary&&t.push(`--pillar-primary${n}: ${e.primary};`),e.primaryHover&&t.push(`--pillar-primary-hover${n}: ${e.primaryHover};`),e.background&&t.push(`--pillar-bg${n}: ${e.background};`),e.backgroundSecondary&&t.push(`--pillar-bg-secondary${n}: ${e.backgroundSecondary};`),e.text&&t.push(`--pillar-text${n}: ${e.text};`),e.textMuted&&t.push(`--pillar-text-muted${n}: ${e.textMuted};`),e.border&&t.push(`--pillar-border${n}: ${e.border};`),e.borderLight&&t.push(`--pillar-border-light${n}: ${e.borderLight};`),e.outlineColor&&t.push(`--pillar-outline-color${n}: ${e.outlineColor};`),t.join("\n ")}function Pr(e){const n=Cr(e.colors),t=Cr(e.darkColors),r=e.fontFamily?`--pillar-font-family: ${e.fontFamily};`:"";let i="";return(n||r)&&(i+=`\n:host {\n ${[n,r].filter(Boolean).join("\n ")}\n}\n`),t&&(i+=`\n@media (prefers-color-scheme: dark) {\n :host:not([data-theme="light"]) {\n ${t}\n }\n}\n:host([data-theme="dark"]) {\n ${t}\n}\n`),i}const Er=function(e){function n(e){var t,r;return this.getChildContext||(t=new Set,(r={})[n.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){t=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&t.forEach(function(e){e.__e=!0,G(e)})},this.sub=function(e){t.add(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){t&&t.delete(e),n&&n.call(e)}}),e.children}return n.__c="__cC"+D++,n.__=e,n.Provider=n.__l=(n.Consumer=function(e,n){return e.children(n)}).contextType=n,n}(null);function zr({api:e,events:n,children:t}){return ge(Er.Provider,{value:{api:e,events:n},children:t})}function Tr(){const e=function(e){var n=fe.context[e.__c],t=ze(me++,9);return t.c=e,n?(null==t.__&&(t.__=!0,n.sub(fe)),n.props.value):e.__}(Er);if(!e)throw new Error("usePillar must be used within a PillarProvider");return e}function Ir(){return Tr().api}const Mr=Je([]),Rr=Je([]),$r=Je(!1),Ar=Je(null),Lr=Je(null);function Hr(e,n,t,r=3){if(0===e.length)return[];const i=function(e,n){const t=e.split("/").filter(Boolean).flatMap(e=>e.split(/[-_]/)),r=n.toLowerCase().split(/\s+/);return[...new Set([...t,...r])].map(e=>e.toLowerCase()).filter(e=>e.length>2)}(n,t),l=e.map(e=>({suggestion:e,score:Or(e,i)}));return l.sort((e,n)=>n.score-e.score),l.slice(0,r).map(e=>e.suggestion)}function Or(e,n){if(e.manual)return 1/0;const t=e.text.toLowerCase();let r=0;for(const e of n)t.includes(e)&&(r+=e.length);return r}function Dr(e){$r.value=e}ln(()=>Rr.value.length>0),ln(()=>Mr.value.length>0);const jr='<svg viewBox="0 0 24 24" fill="currentColor"><path d="M4.583 17.321C3.553 16.227 3 15 3 13.011c0-3.5 2.457-6.637 6.03-8.188l.893 1.378c-3.335 1.804-3.987 4.145-4.247 5.621.537-.278 1.24-.375 1.929-.311 1.804.167 3.226 1.648 3.226 3.489a3.5 3.5 0 01-3.5 3.5c-1.073 0-2.099-.49-2.748-1.179zm10 0C13.553 16.227 13 15 13 13.011c0-3.5 2.457-6.637 6.03-8.188l.893 1.378c-3.335 1.804-3.987 4.145-4.247 5.621.537-.278 1.24-.375 1.929-.311 1.804.167 3.226 1.648 3.226 3.489a3.5 3.5 0 01-3.5 3.5c-1.073 0-2.099-.49-2.748-1.179z"/></svg>';function Ur({context:e,onRemove:n,readOnly:t=!1}){const r=Gn(e),i=function(e){return Yn(e),jr}(e),l=function(e){if(Yn(e)){const n=e.url_origin?`\nFrom: ${e.url_origin}`:"";return`"${e.text_content}"${n}`}return""}(e);return ge("div",{class:"_pillar-context-tag pillar-context-tag",title:l,children:[ge("span",{class:"_pillar-context-tag-icon pillar-context-tag-icon",dangerouslySetInnerHTML:{__html:i}}),ge("span",{class:"_pillar-context-tag-label pillar-context-tag-label",children:r}),!t&&n&&ge("button",{class:"_pillar-context-tag-remove pillar-context-tag-remove",onClick:t=>{t.preventDefault(),t.stopPropagation(),n?.(e.id)},"aria-label":"Remove context",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>'}})]})}function qr({contexts:e,onRemove:n,readOnly:t=!1}){const r=e.filter(e=>!Zn(e));return 0===r.length?null:ge("div",{class:"_pillar-context-tag-list pillar-context-tag-list",children:r.map(e=>ge(Ur,{context:e,onRemove:n,readOnly:t},e.id))})}const Br='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>';function Nr({placeholder:e="Ask anything...",disabled:n=!1,onSubmit:t,showContextTags:r=!0,showImageUpload:i=!0,className:l="",isStreaming:a=!1,onStop:o}){const s=Ir(),c=Me(null),p=Me(null),[d,u]=Te(""),[h,g]=Te(!1),m=$e(()=>{const e=c.current;if(!e)return;e.style.height="41px";const n=e.scrollHeight;n>146?(e.style.height="146px",e.style.overflowY="auto"):(e.style.height=`${n}px`,e.style.overflowY="hidden")},[]),f=$e(async e=>{if(Ct.value.length>=4)return;const n=`img-${Date.now()}-${Math.random().toString(36).slice(2)}`,t=URL.createObjectURL(e);zt({id:n,file:e,preview:t,status:"uploading"});try{const t=await s.uploadImage(e);Tt(n,"ready",t.url,void 0,t.path)}catch(e){const t=e instanceof Error?e.message:"Upload failed";Tt(n,"error",void 0,t)}},[s]),v=$e(e=>{const n=Array.from(e).filter(e=>e.type.startsWith("image/")),t=4-Ct.value.length;n.slice(0,t).forEach(f)},[f]),b=$e(e=>{const n=e.clipboardData?.items;if(!n)return;const t=[];for(const e of n)if(e.type.startsWith("image/")){const n=e.getAsFile();n&&t.push(n)}t.length>0&&(e.preventDefault(),v(t))},[v]),_=$e(e=>{e.preventDefault(),e.stopPropagation(),g(!0)},[]),x=$e(e=>{e.preventDefault(),e.stopPropagation(),g(!1)},[]),y=$e(e=>{e.preventDefault(),e.stopPropagation(),g(!1);const n=e.dataTransfer?.files;n&&v(n)},[v]),w=$e(e=>{const n=e.target;n.files&&(v(n.files),n.value="")},[v]),k=$e(()=>{p.current?.click()},[]),S=$e(()=>{const e=d.trim(),n=[...wt.value],r=Et(),i=n.length>0,l=r.length>0;(e||i||l)&&(Pt.value||(i&&er(),Mt(),t?t(e,n,r):(i&&nr(n),l&&rr(r),Xt(e),wr()),u(""),c.current&&(c.current.style.height="41px",c.current.style.overflowY="hidden")))},[d,t]),C=Pt.value,P=d.trim()||wt.value.length>0||Ct.value.some(e=>"ready"===e.status);return ge("div",{class:`_pillar-unified-input-wrapper pillar-unified-input-wrapper ${h?"_pillar-unified-input-wrapper--dragging":""} ${l}`.trim(),onDragOver:_,onDragLeave:x,onDrop:y,children:[ge("input",{ref:p,type:"file",accept:"image/*",multiple:!0,onChange:w,style:{display:"none"}}),Ct.value.length>0&&ge("div",{class:"_pillar-chat-images-preview pillar-chat-images-preview",children:Ct.value.map(e=>ge("div",{class:"_pillar-chat-image-thumb pillar-chat-image-thumb",children:[ge("img",{src:e.preview,alt:"Upload preview"}),"uploading"===e.status&&ge("div",{class:"_pillar-chat-image-loading pillar-chat-image-loading",children:ge("div",{class:"_pillar-loading-spinner pillar-loading-spinner",style:{width:"16px",height:"16px"}})}),"error"===e.status&&ge("div",{class:"_pillar-chat-image-error pillar-chat-image-error",title:e.error,children:"!"}),ge("button",{type:"button",class:"_pillar-chat-image-remove pillar-chat-image-remove",onClick:()=>It(e.id),"aria-label":"Remove image",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>'}})]},e.id))}),r&&ge(qr,{contexts:wt.value,onRemove:Jt}),ge("textarea",{ref:c,class:"_pillar-unified-input pillar-unified-input",placeholder:h?"Drop image here...":e,value:d,onInput:e=>{const n=e.target;u(n.value),m()},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),S())},onPaste:b,disabled:n||a,maxLength:32e3,style:{height:"41px"}}),ge("div",{class:"_pillar-unified-input-row pillar-unified-input-row",children:[i&&!a&&ge("button",{type:"button",class:"_pillar-chat-image-btn pillar-chat-image-btn",onClick:k,disabled:n||C||Ct.value.length>=4,"aria-label":"Attach image",title:"Attach image (max 4)",dangerouslySetInnerHTML:{__html:Br}}),ge("div",{class:"_pillar-unified-input-actions pillar-unified-input-actions",children:ge("button",a?{type:"button",class:"_pillar-unified-stop-btn pillar-unified-stop-btn",onClick:o,"aria-label":"Stop generating",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>'}}:{type:"button",class:"_pillar-unified-send-btn pillar-unified-send-btn",onClick:S,disabled:n||C||!P,"aria-label":"Send message",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="19" x2="12" y2="5"/><polyline points="5 12 12 5 19 12"/></svg>'}})})]}),h&&ge("div",{class:"_pillar-chat-drop-overlay pillar-chat-drop-overlay",children:[ge("span",{dangerouslySetInnerHTML:{__html:Br}}),ge("span",{children:"Drop image here"})]})]})}function Fr({text:e,onClick:n}){return ge("button",{type:"button",class:"_pillar-question-chip pillar-question-chip",onClick:n,children:[ge("span",{class:"_pillar-question-chip-text pillar-question-chip-text",children:e}),ge("span",{class:"_pillar-question-chip-arrow pillar-question-chip-arrow",children:"→"})]})}function Wr(){return ge("div",{class:"_pillar-question-chip-skeleton pillar-question-chip-skeleton",children:ge("div",{class:"_pillar-question-chip-skeleton-bar pillar-question-chip-skeleton-bar"})})}function Vr(){const e=mn(()=>Rr.value),n=mn(()=>$r.value);return ge("div",{class:"_pillar-home-view pillar-home-view",children:[ge("div",{style:{flex:1}}),ge("div",{class:"_pillar-home-view-questions pillar-home-view-questions",children:n.value?ge(K,{children:[ge(Wr,{}),ge(Wr,{}),ge(Wr,{})]}):e.value&&e.value.length>0?e.value.map(e=>ge(Fr,{text:e.text,onClick:()=>(e=>{Xt(e.text),wr()})(e)},e.id)):null}),ge(Nr,{placeholder:"Ask anything..."})]})}let Kr=null;function Xr(e){Kr=e}function Yr(){return Kr}function Zr(){return Kr?._api??null}const Gr=Je(!1),Qr=Je(null),Jr=Je(!1),ei=Je(null);function ni(e,n){Gr.value=!0,Qr.value=e,Jr.value=!1,ei.value=n??null}function ti(){Gr.value=!1,Qr.value=null,ei.value=null}function ri(){Jr.value=!0}function ii(){Jr.value=!1}function li(){return Jr.value}const ai=Je(!1),oi=Je(null),si=Je(null);function ci(e){const n=si.value;ai.value=!1,oi.value=null,si.value=null,n?.(e)}var pi=Object.freeze({__proto__:null,cancelPiloting:ri,confirmationLabel:oi,confirmationResolver:si,currentToolCallId:ei,isCancelled:Jr,isPiloting:Gr,needsConfirmation:ai,pilotOperation:Qr,requestConfirmation:function(e){return new Promise(n=>{oi.value=e,si.value=n,ai.value=!0})},resetCancellation:ii,resolveConfirmation:ci,startPiloting:ni,stopPiloting:ti,wasCancelled:li});function di(e){if(e)try{const n=ui(e);localStorage.removeItem(n),p.log("[SessionPersistence] Cleared saved session")}catch(e){p.warn("[SessionPersistence] Failed to clear session:",e)}}function ui(e){return`pillar:active_session:${e}`}var hi=Object.freeze({__proto__:null,clearActiveSession:di,loadActiveSession:function(e){if(!e)return p.warn("[SessionPersistence] loadActiveSession called with empty siteId"),null;try{const n=ui(e),t=localStorage.getItem(n);if(!t)return p.log(`[SessionPersistence] No session found at key "${n}"`),null;const r=JSON.parse(t);return 1!==r.version?(p.warn("[SessionPersistence] Stored session has incompatible version, clearing"),di(e),null):r.siteId!==e?(p.warn("[SessionPersistence] Stored session is for different site, clearing"),di(e),null):(p.log(`[SessionPersistence] Loaded session ${r.conversationId.slice(0,8)}... from localStorage`),r)}catch(n){return p.warn("[SessionPersistence] Failed to load session:",n),di(e),null}},saveActiveSession:function(e,n){if(e&&n)try{const t={version:1,conversationId:e,siteId:n,streamingStartedAt:(new Date).toISOString()},r=ui(n);localStorage.setItem(r,JSON.stringify(t)),p.log(`[SessionPersistence] Saved session ${e.slice(0,8)}... to localStorage (key="${r}")`)}catch(e){p.warn("[SessionPersistence] Failed to save session:",e)}}});const gi={maxDepth:20,includeText:!0,visibleOnly:!0,minTextLength:1,maxTextLength:500,maxTotalLength:5e4,maxLabelLength:100,includePositions:!1},mi=new Set(["a","button","input","select","textarea","details","summary","dialog","menu","menuitem"]),fi=new Set(["button","link","checkbox","radio","switch","tab","tabpanel","menuitem","menuitemcheckbox","menuitemradio","option","slider","spinbutton","textbox","combobox","listbox","searchbox","tree","treeitem","grid","gridcell","row","rowheader","columnheader"]),vi=new Set(["script","style","noscript","template","svg","path","iframe","object","embed","head","meta","link","base"]);let bi=0;function _i(){document.querySelectorAll("[data-pillar-ref]").forEach(e=>e.removeAttribute("data-pillar-ref")),bi=0}let xi=new Set,yi=new Set;function wi(e){return e instanceof HTMLInputElement&&"password"===e.type.toLowerCase()||null!==e.closest("[data-pillar-redact]")}const ki=/\b(delete|remove|destroy|reset|revoke|archive|cancel subscription|deactivate|disable|erase|purge|terminate|unsubscribe|drop)\b/i;function Si(e){if(e.hasAttribute("data-pillar-destructive"))return!0;const n=e.getAttribute("aria-label");if(n&&ki.test(n))return!0;const t=e.textContent?.trim().slice(0,200);if(t&&ki.test(t))return!0;const r=e.getAttribute("title");if(r&&ki.test(r))return!0;if(e instanceof HTMLInputElement||e instanceof HTMLButtonElement){const n=e.type?.toLowerCase();if("reset"===n||"submit"===n){const n=e.closest("form");if(n){const e=n.getAttribute("action")||"";if(ki.test(e))return!0}}}return!1}function Ci(e){const n=e.tagName.toLowerCase();if(e.hasAttribute("data-pillar-interactable"))return!0;if(mi.has(n))return!0;const t=e.getAttribute("role");if(t&&fi.has(t))return!0;const r=e.getAttribute("tabindex");return null!==r&&"-1"!==r||("true"===e.getAttribute("contenteditable")||!!(e.hasAttribute("onclick")||e.hasAttribute("onkeydown")||e.hasAttribute("onkeyup")))}const Pi=/^pr-[a-z0-9]+$/;function Ei(e){return Pi.test(e)}function zi(e){if(!Ei(e))throw new Error(`Invalid pillar ref format: "${e}"`);return`[data-pillar-ref="${e}"]`}function Ti(e,n){return e.length<=n?e:e.slice(0,n)+"..."}function Ii(e,n){const t=function(e){const n=e.getAttribute("aria-label");if(n)return n;const t=e.getAttribute("aria-labelledby");if(t){const e=document.getElementById(t);if(e)return e.textContent?.trim()||void 0}if(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement){if(e.id){const n=document.querySelector(`label[for="${e.id}"]`);if(n)return n.textContent?.trim()||void 0}const n=e.closest("label");if(n){const e=n.cloneNode(!0);e.querySelectorAll("input, select, textarea").forEach(e=>e.remove());const t=e.textContent?.trim();if(t)return t}}const r=e.getAttribute("title");return r||void 0}(e);if(t)return Ti(t,n);if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.placeholder)return Ti(e.placeholder,n);const r=e.textContent?.trim();if(r&&r.length>0)return Ti(r,n);const i=e.getAttribute("name");return i?Ti(i,n):e.id?Ti(e.id,n):e.tagName.toLowerCase()}function Mi(e,n,t){if(t>n.maxDepth&&(n.maxDepth=t),t>n.options.maxDepth)return;if(e.nodeType===Node.TEXT_NODE){if(n.options.includeText&&!n.budgetExhausted){const t=e.textContent?.trim();if(t&&t.length>=n.options.minTextLength){const e=t.length>n.options.maxTextLength?t.slice(0,n.options.maxTextLength)+"...":t,r=e.length+1;if(n.totalLength+r>n.options.maxTotalLength)return void(n.budgetExhausted=!0);n.lines.push(e),n.totalLength+=r}}return}if(e.nodeType!==Node.ELEMENT_NODE)return;const r=e,i=r.tagName.toLowerCase();if(!vi.has(i)){if(n.options.excludeSelector)try{if(r.matches(n.options.excludeSelector))return}catch{}if((!n.options.visibleOnly||function(e){if(!e.isConnected)return!1;const n=window.getComputedStyle(e);if("none"===n.display)return!1;if("hidden"===n.visibility)return!1;if("0"===n.opacity)return!1;const t=e.getBoundingClientRect();return(0!==t.width||0!==t.height)&&!e.hasAttribute("hidden")&&"true"!==e.getAttribute("aria-hidden")}(r))&&!r.hasAttribute("data-pillar-redact")){if(Ci(r)){if(wi(r))return;const e=function(e){const n=e.tagName.toLowerCase(),t=e.getAttribute("data-pillar-interactable");if(t&&"true"!==t)return t;switch(n){case"input":switch(e.type.toLowerCase()){case"checkbox":case"radio":return"toggle";case"submit":case"button":case"reset":return"click";case"file":return"select";default:return"input"}case"textarea":return"input";case"select":return"select";case"button":return"submit"===e.getAttribute("type")?"submit":"click";case"a":return"click";case"details":case"summary":return"toggle"}const r=e.getAttribute("role");if(r)switch(r){case"button":case"link":case"menuitem":case"tab":default:return"click";case"checkbox":case"radio":case"switch":return"toggle";case"textbox":case"searchbox":case"combobox":case"slider":case"spinbutton":return"input";case"listbox":case"option":return"select"}return"true"===e.getAttribute("contenteditable")?"input":"click"}(r),t=Ii(r,n.options.maxLabelLength);let i=r.getAttribute("data-pillar-ref");i||(i=`pr-${(bi++).toString(36)}`,r.setAttribute("data-pillar-ref",i)),n.refs.add(i);const l=`${e.toUpperCase()}: ${t} [[${i}]]`;n.lines.push(l),n.totalLength+=l.length+1,n.interactableCount++}for(const e of r.childNodes)Mi(e,n,t+1)}}}function Ri(e){_i();const n=e?.root||document.body,t={lines:[],refs:new Set,interactableCount:0,totalLength:0,budgetExhausted:!1,maxDepth:0,options:{...gi,...e}};return t.lines.push(`=== PAGE: ${document.title} | ${window.location.pathname} ===`),t.lines.push(""),Mi(n,t,0),t.lines.push(""),t.lines.push(`=== ${t.interactableCount} interactable elements ===`),xi=new Set(t.lines),yi=new Set(t.refs),{content:t.lines.join("\n"),interactableCount:t.interactableCount,timestamp:Date.now(),url:window.location.href,title:document.title}}function $i(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ai={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Li(e){Ai=e}var Hi={exec:()=>null};function Oi(e,n=""){let t="string"==typeof e?e:e.source,r={replace:(e,n)=>{let i="string"==typeof n?n:n.source;return i=i.replace(ji.caret,"$1"),t=t.replace(e,i),r},getRegex:()=>new RegExp(t,n)};return r}var Di=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ji={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Ui=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,qi=/(?:[*+-]|\d{1,9}[.)])/,Bi=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ni=Oi(Bi).replace(/bull/g,qi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Fi=Oi(Bi).replace(/bull/g,qi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Wi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Vi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ki=Oi(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Vi).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xi=Oi(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,qi).getRegex(),Yi="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Zi=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Gi=Oi("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Zi).replace("tag",Yi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Qi=Oi(Wi).replace("hr",Ui).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Yi).getRegex(),Ji={blockquote:Oi(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Qi).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Ki,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Ui,html:Gi,lheading:Ni,list:Xi,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:Qi,table:Hi,text:/^[^\n]+/},el=Oi("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ui).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Yi).getRegex(),nl={...Ji,lheading:Fi,table:el,paragraph:Oi(Wi).replace("hr",Ui).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",el).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Yi).getRegex()},tl={...Ji,html:Oi("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Zi).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Hi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Oi(Wi).replace("hr",Ui).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Ni).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},rl=/^( {2,}|\\)\n(?!\s*$)/,il=/[\p{P}\p{S}]/u,ll=/[\s\p{P}\p{S}]/u,al=/[^\s\p{P}\p{S}]/u,ol=Oi(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ll).getRegex(),sl=/(?!~)[\p{P}\p{S}]/u,cl=Oi(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Di?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),pl=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,dl=Oi(pl,"u").replace(/punct/g,il).getRegex(),ul=Oi(pl,"u").replace(/punct/g,sl).getRegex(),hl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",gl=Oi(hl,"gu").replace(/notPunctSpace/g,al).replace(/punctSpace/g,ll).replace(/punct/g,il).getRegex(),ml=Oi(hl,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,sl).getRegex(),fl=Oi("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,al).replace(/punctSpace/g,ll).replace(/punct/g,il).getRegex(),vl=Oi(/\\(punct)/,"gu").replace(/punct/g,il).getRegex(),bl=Oi(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_l=Oi(Zi).replace("(?:--\x3e|$)","--\x3e").getRegex(),xl=Oi("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_l).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),yl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,wl=Oi(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",yl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kl=Oi(/^!?\[(label)\]\[(ref)\]/).replace("label",yl).replace("ref",Vi).getRegex(),Sl=Oi(/^!?\[(ref)\](?:\[\])?/).replace("ref",Vi).getRegex(),Cl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Pl={_backpedal:Hi,anyPunctuation:vl,autolink:bl,blockSkip:cl,br:rl,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Hi,emStrongLDelim:dl,emStrongRDelimAst:gl,emStrongRDelimUnd:fl,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:wl,nolink:Sl,punctuation:ol,reflink:kl,reflinkSearch:Oi("reflink|nolink(?!\\()","g").replace("reflink",kl).replace("nolink",Sl).getRegex(),tag:xl,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Hi},El={...Pl,link:Oi(/^!?\[(label)\]\((.*?)\)/).replace("label",yl).getRegex(),reflink:Oi(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",yl).getRegex()},zl={...Pl,emStrongRDelimAst:ml,emStrongLDelim:ul,url:Oi(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Cl).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Oi(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Cl).getRegex()},Tl={...zl,br:Oi(rl).replace("{2,}","*").getRegex(),text:Oi(zl.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Il={normal:Ji,gfm:nl,pedantic:tl},Ml={normal:Pl,gfm:zl,breaks:Tl,pedantic:El},Rl={"&":"&","<":"<",">":">",'"':""","'":"'"},$l=e=>Rl[e];function Al(e,n){if(n){if(ji.escapeTest.test(e))return e.replace(ji.escapeReplace,$l)}else if(ji.escapeTestNoEncode.test(e))return e.replace(ji.escapeReplaceNoEncode,$l);return e}function Ll(e){try{e=encodeURI(e).replace(ji.percentDecode,"%")}catch{return null}return e}function Hl(e,n){let t=e.replace(ji.findPipe,(e,n,t)=>{let r=!1,i=n;for(;--i>=0&&"\\"===t[i];)r=!r;return r?"|":" |"}),r=t.split(ji.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),n)if(r.length>n)r.splice(n);else for(;r.length<n;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(ji.slashPipe,"|");return r}function Ol(e,n,t){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){if(e.charAt(r-i-1)!==n)break;i++}return e.slice(0,r-i)}function Dl(e,n,t,r,i){let l=n.href,a=n.title||null,o=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let s={type:"!"===e[0].charAt(0)?"image":"link",raw:t,href:l,title:a,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,s}var jl=class{options;rules;lexer;constructor(e){this.options=e||Ai}space(e){let n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){let n=this.rules.block.code.exec(e);if(n){let e=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Ol(e,"\n")}}}fences(e){let n=this.rules.block.fences.exec(e);if(n){let e=n[0],t=function(e,n,t){let r=e.match(t.other.indentCodeCompensation);if(null===r)return n;let i=r[1];return n.split("\n").map(e=>{let n=e.match(t.other.beginningSpace);if(null===n)return e;let[r]=n;return r.length>=i.length?e.slice(i.length):e}).join("\n")}(e,n[3]||"",this.rules);return{type:"code",raw:e,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:t}}}heading(e){let n=this.rules.block.heading.exec(e);if(n){let e=n[2].trim();if(this.rules.other.endingHash.test(e)){let n=Ol(e,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(e=n.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:Ol(n[0],"\n")}}blockquote(e){let n=this.rules.block.blockquote.exec(e);if(n){let e=Ol(n[0],"\n").split("\n"),t="",r="",i=[];for(;e.length>0;){let n,l=!1,a=[];for(n=0;n<e.length;n++)if(this.rules.other.blockquoteStart.test(e[n]))a.push(e[n]),l=!0;else{if(l)break;a.push(e[n])}e=e.slice(n);let o=a.join("\n"),s=o.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");t=t?`${t}\n${o}`:o,r=r?`${r}\n${s}`:s;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(s,i,!0),this.lexer.state.top=c,0===e.length)break;let p=i.at(-1);if("code"===p?.type)break;if("blockquote"===p?.type){let n=p,l=n.raw+"\n"+e.join("\n"),a=this.blockquote(l);i[i.length-1]=a,t=t.substring(0,t.length-n.raw.length)+a.raw,r=r.substring(0,r.length-n.text.length)+a.text;break}if("list"===p?.type){let n=p,l=n.raw+"\n"+e.join("\n"),a=this.list(l);i[i.length-1]=a,t=t.substring(0,t.length-p.raw.length)+a.raw,r=r.substring(0,r.length-n.raw.length)+a.raw,e=l.substring(i.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:t,tokens:i,text:r}}}list(e){let n=this.rules.block.list.exec(e);if(n){let t=n[1].trim(),r=t.length>1,i={type:"list",raw:"",ordered:r,start:r?+t.slice(0,-1):"",loose:!1,items:[]};t=r?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=r?t:"[*+-]");let l=this.rules.other.listItemRegex(t),a=!1;for(;e;){let t=!1,r="",o="";if(!(n=l.exec(e))||this.rules.block.hr.test(e))break;r=n[0],e=e.substring(r.length);let s=n[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),c=e.split("\n",1)[0],p=!s.trim(),d=0;if(this.options.pedantic?(d=2,o=s.trimStart()):p?d=n[1].length+1:(d=n[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,o=s.slice(d),d+=n[1].length),p&&this.rules.other.blankLine.test(c)&&(r+=c+"\n",e=e.substring(c.length+1),t=!0),!t){let n=this.rules.other.nextBulletRegex(d),t=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),l=this.rules.other.headingBeginRegex(d),a=this.rules.other.htmlBeginRegex(d);for(;e;){let u,h=e.split("\n",1)[0];if(c=h,this.options.pedantic?(c=c.replace(this.rules.other.listReplaceNesting," "),u=c):u=c.replace(this.rules.other.tabCharGlobal," "),i.test(c)||l.test(c)||a.test(c)||n.test(c)||t.test(c))break;if(u.search(this.rules.other.nonSpaceChar)>=d||!c.trim())o+="\n"+u.slice(d);else{if(p||s.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(s)||l.test(s)||t.test(s))break;o+="\n"+c}!p&&!c.trim()&&(p=!0),r+=h+"\n",e=e.substring(h.length+1),s=u.slice(d)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(a=!0)),i.items.push({type:"list_item",raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(o),loose:!1,text:o,tokens:[]}),i.raw+=r}let o=i.items.at(-1);if(!o)return;o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,""),"text"===e.tokens[0]?.type||"paragraph"===e.tokens[0]?.type){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,"");break}}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:"checkbox",raw:n[0]+" ",checked:"[ ]"!==n[0]};e.checked=t.checked,i.loose?e.tokens[0]&&["paragraph","text"].includes(e.tokens[0].type)&&"tokens"in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:"paragraph",raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}if(!i.loose){let n=e.tokens.filter(e=>"space"===e.type),t=n.length>0&&n.some(e=>this.rules.other.anyLine.test(e.raw));i.loose=t}}if(i.loose)for(let e of i.items){e.loose=!0;for(let n of e.tokens)"text"===n.type&&(n.type="paragraph")}return i}}html(e){let n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:"pre"===n[1]||"script"===n[1]||"style"===n[1],text:n[0]}}def(e){let n=this.rules.block.def.exec(e);if(n){let e=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),t=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:e,raw:n[0],href:t,title:r}}}table(e){let n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let t=Hl(n[1]),r=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],l={type:"table",raw:n[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?l.align.push("right"):this.rules.other.tableAlignCenter.test(e)?l.align.push("center"):this.rules.other.tableAlignLeft.test(e)?l.align.push("left"):l.align.push(null);for(let e=0;e<t.length;e++)l.header.push({text:t[e],tokens:this.lexer.inline(t[e]),header:!0,align:l.align[e]});for(let e of i)l.rows.push(Hl(e,l.header.length).map((e,n)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:l.align[n]})));return l}}lheading(e){let n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:"="===n[2].charAt(0)?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){let n=this.rules.block.paragraph.exec(e);if(n){let e="\n"===n[1].charAt(n[1].length-1)?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){let n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){let n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){let n=this.rules.inline.link.exec(e);if(n){let e=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let n=Ol(e.slice(0,-1),"\\");if((e.length-n.length)%2==0)return}else{let e=function(e,n){if(-1===e.indexOf(n[1]))return-1;let t=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===n[0])t++;else if(e[r]===n[1]&&(t--,t<0))return r;return t>0?-2:-1}(n[2],"()");if(-2===e)return;if(e>-1){let t=(0===n[0].indexOf("!")?5:4)+n[1].length+e;n[2]=n[2].substring(0,e),n[0]=n[0].substring(0,t).trim(),n[3]=""}}let t=n[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(t);e&&(t=e[1],r=e[3])}else r=n[3]?n[3].slice(1,-1):"";return t=t.trim(),this.rules.other.startAngleBracket.test(t)&&(t=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?t.slice(1):t.slice(1,-1)),Dl(n,{href:t&&t.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let t;if((t=this.rules.inline.reflink.exec(e))||(t=this.rules.inline.nolink.exec(e))){let e=n[(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=t[0].charAt(0);return{type:"text",raw:e,text:e}}return Dl(t,e,t[0],this.lexer,this.rules)}}emStrong(e,n,t=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!t||this.rules.inline.punctuation.exec(t))){let t,i,l=[...r[0]].length-1,a=l,o=0,s="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(s.lastIndex=0,n=n.slice(-1*e.length+l);null!=(r=s.exec(n));){if(t=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!t)continue;if(i=[...t].length,r[3]||r[4]){a+=i;continue}if((r[5]||r[6])&&l%3&&!((l+i)%3)){o+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+o);let n=[...r[0]][0].length,s=e.slice(0,l+r.index+n+i);if(Math.min(l,i)%2){let e=s.slice(1,-1);return{type:"em",raw:s,text:e,tokens:this.lexer.inlineTokens(e)}}let c=s.slice(2,-2);return{type:"strong",raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let n=this.rules.inline.code.exec(e);if(n){let e=n[2].replace(this.rules.other.newLineCharGlobal," "),t=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return t&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:n[0],text:e}}}br(e){let n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){let n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){let n=this.rules.inline.autolink.exec(e);if(n){let e,t;return"@"===n[2]?(e=n[1],t="mailto:"+e):(e=n[1],t=e),{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let n;if(n=this.rules.inline.url.exec(e)){let e,t;if("@"===n[2])e=n[0],t="mailto:"+e;else{let r;do{r=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??""}while(r!==n[0]);e=n[0],t="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let n=this.rules.inline.text.exec(e);if(n){let e=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:e}}}},Ul=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ai,this.options.tokenizer=this.options.tokenizer||new jl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:ji,block:Il.normal,inline:Ml.normal};this.options.pedantic?(n.block=Il.pedantic,n.inline=Ml.pedantic):this.options.gfm&&(n.block=Il.gfm,this.options.breaks?n.inline=Ml.breaks:n.inline=Ml.gfm),this.tokenizer.rules=n}static get rules(){return{block:Il,inline:Ml}}static lex(n,t){return new e(t).lex(n)}static lexInline(n,t){return new e(t).inlineTokens(n)}lex(e){e=e.replace(ji.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let n=this.inlineQueue[e];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],t=!1){for(this.options.pedantic&&(e=e.replace(ji.tabCharGlobal," ").replace(ji.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(t=>!!(r=t.call({lexer:this},e,n))&&(e=e.substring(r.raw.length),n.push(r),!0)))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let t=n.at(-1);1===r.raw.length&&void 0!==t?t.raw+="\n":n.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let t=n.at(-1);"paragraph"===t?.type||"text"===t?.type?(t.raw+=(t.raw.endsWith("\n")?"":"\n")+r.raw,t.text+="\n"+r.text,this.inlineQueue.at(-1).src=t.text):n.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let t=n.at(-1);"paragraph"===t?.type||"text"===t?.type?(t.raw+=(t.raw.endsWith("\n")?"":"\n")+r.raw,t.text+="\n"+r.raw,this.inlineQueue.at(-1).src=t.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),n.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let n,t=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach(e=>{n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let l=n.at(-1);t&&"paragraph"===l?.type?(l.raw+=(l.raw.endsWith("\n")?"":"\n")+r.raw,l.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(r),t=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let t=n.at(-1);"text"===t?.type?(t.raw+=(t.raw.endsWith("\n")?"":"\n")+r.raw,t.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=t.text):n.push(r);continue}if(e){let n="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(n);break}throw new Error(n)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let t,r=e,i=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(r));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(r));)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(r));)t=i[2]?i[2].length:0,r=r.slice(0,i.index+t)+"["+"a".repeat(i[0].length-t-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let l=!1,a="";for(;e;){let t;if(l||(a=""),l=!1,this.options.extensions?.inline?.some(r=>!!(t=r.call({lexer:this},e,n))&&(e=e.substring(t.raw.length),n.push(t),!0)))continue;if(t=this.tokenizer.escape(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.tag(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.link(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(t.raw.length);let r=n.at(-1);"text"===t.type&&"text"===r?.type?(r.raw+=t.raw,r.text+=t.text):n.push(t);continue}if(t=this.tokenizer.emStrong(e,r,a)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.codespan(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.br(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.del(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.autolink(e)){e=e.substring(t.raw.length),n.push(t);continue}if(!this.state.inLink&&(t=this.tokenizer.url(e))){e=e.substring(t.raw.length),n.push(t);continue}let i=e;if(this.options.extensions?.startInline){let n,t=1/0,r=e.slice(1);this.options.extensions.startInline.forEach(e=>{n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(t=this.tokenizer.inlineText(i)){e=e.substring(t.raw.length),"_"!==t.raw.slice(-1)&&(a=t.raw.slice(-1)),l=!0;let r=n.at(-1);"text"===r?.type?(r.raw+=t.raw,r.text+=t.text):n.push(t);continue}if(e){let n="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(n);break}throw new Error(n)}}return n}},ql=class{options;parser;constructor(e){this.options=e||Ai}space(e){return""}code({text:e,lang:n,escaped:t}){let r=(n||"").match(ji.notSpaceStart)?.[0],i=e.replace(ji.endingNewline,"")+"\n";return r?'<pre><code class="language-'+Al(r)+'">'+(t?i:Al(i,!0))+"</code></pre>\n":"<pre><code>"+(t?i:Al(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:n}){return`<h${n}>${this.parser.parseInline(e)}</h${n}>\n`}hr(e){return"<hr>\n"}list(e){let n=e.ordered,t=e.start,r="";for(let n=0;n<e.items.length;n++){let t=e.items[n];r+=this.listitem(t)}let i=n?"ol":"ul";return"<"+i+(n&&1!==t?' start="'+t+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let n="",t="";for(let n=0;n<e.header.length;n++)t+=this.tablecell(e.header[n]);n+=this.tablerow({text:t});let r="";for(let n=0;n<e.rows.length;n++){let i=e.rows[n];t="";for(let e=0;e<i.length;e++)t+=this.tablecell(i[e]);r+=this.tablerow({text:t})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+n+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let n=this.parser.parseInline(e.tokens),t=e.header?"th":"td";return(e.align?`<${t} align="${e.align}">`:`<${t}>`)+n+`</${t}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Al(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:t}){let r=this.parser.parseInline(t),i=Ll(e);if(null===i)return r;let l='<a href="'+(e=i)+'"';return n&&(l+=' title="'+Al(n)+'"'),l+=">"+r+"</a>",l}image({href:e,title:n,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=Ll(e);if(null===i)return Al(t);let l=`<img src="${e=i}" alt="${t}"`;return n&&(l+=` title="${Al(n)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Al(e.text)}},Bl=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Nl=class e{options;renderer;textRenderer;constructor(e){this.options=e||Ai,this.options.renderer=this.options.renderer||new ql,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Bl}static parse(n,t){return new e(t).parse(n)}static parseInline(n,t){return new e(t).parseInline(n)}parse(e){let n="";for(let t=0;t<e.length;t++){let r=e[t];if(this.options.extensions?.renderers?.[r.type]){let e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){n+=t||"";continue}}let i=r;switch(i.type){case"space":n+=this.renderer.space(i);break;case"hr":n+=this.renderer.hr(i);break;case"heading":n+=this.renderer.heading(i);break;case"code":n+=this.renderer.code(i);break;case"table":n+=this.renderer.table(i);break;case"blockquote":n+=this.renderer.blockquote(i);break;case"list":n+=this.renderer.list(i);break;case"checkbox":n+=this.renderer.checkbox(i);break;case"html":n+=this.renderer.html(i);break;case"def":n+=this.renderer.def(i);break;case"paragraph":n+=this.renderer.paragraph(i);break;case"text":n+=this.renderer.text(i);break;default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,n=this.renderer){let t="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){t+=e||"";continue}}let l=i;switch(l.type){case"escape":case"text":t+=n.text(l);break;case"html":t+=n.html(l);break;case"link":t+=n.link(l);break;case"image":t+=n.image(l);break;case"checkbox":t+=n.checkbox(l);break;case"strong":t+=n.strong(l);break;case"em":t+=n.em(l);break;case"codespan":t+=n.codespan(l);break;case"br":t+=n.br(l);break;case"del":t+=n.del(l);break;default:{let e='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return t}},Fl=class{options;block;constructor(e){this.options=e||Ai}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Ul.lex:Ul.lexInline}provideParser(){return this.block?Nl.parse:Nl.parseInline}},Wl=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Nl;Renderer=ql;TextRenderer=Bl;Lexer=Ul;Tokenizer=jl;Hooks=Fl;constructor(...e){this.use(...e)}walkTokens(e,n){let t=[];for(let r of e)switch(t=t.concat(n.call(this,r)),r.type){case"table":{let e=r;for(let r of e.header)t=t.concat(this.walkTokens(r.tokens,n));for(let r of e.rows)for(let e of r)t=t.concat(this.walkTokens(e.tokens,n));break}case"list":{let e=r;t=t.concat(this.walkTokens(e.items,n));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);t=t.concat(this.walkTokens(i,n))}):e.tokens&&(t=t.concat(this.walkTokens(e.tokens,n)))}}return t}use(...e){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let t={...e};if(t.async=this.defaults.async||t.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let t=n.renderers[e.name];n.renderers[e.name]=t?function(...n){let r=e.renderer.apply(this,n);return!1===r&&(r=t.apply(this,n)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let t=n[e.level];t?t.unshift(e.tokenizer):n[e.level]=[e.tokenizer],e.start&&("block"===e.level?n.startBlock?n.startBlock.push(e.start):n.startBlock=[e.start]:"inline"===e.level&&(n.startInline?n.startInline.push(e.start):n.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(n.childTokens[e.name]=e.childTokens)}),t.extensions=n),e.renderer){let n=this.defaults.renderer||new ql(this.defaults);for(let t in e.renderer){if(!(t in n))throw new Error(`renderer '${t}' does not exist`);if(["options","parser"].includes(t))continue;let r=t,i=e.renderer[r],l=n[r];n[r]=(...e)=>{let t=i.apply(n,e);return!1===t&&(t=l.apply(n,e)),t||""}}t.renderer=n}if(e.tokenizer){let n=this.defaults.tokenizer||new jl(this.defaults);for(let t in e.tokenizer){if(!(t in n))throw new Error(`tokenizer '${t}' does not exist`);if(["options","rules","lexer"].includes(t))continue;let r=t,i=e.tokenizer[r],l=n[r];n[r]=(...e)=>{let t=i.apply(n,e);return!1===t&&(t=l.apply(n,e)),t}}t.tokenizer=n}if(e.hooks){let n=this.defaults.hooks||new Fl;for(let t in e.hooks){if(!(t in n))throw new Error(`hook '${t}' does not exist`);if(["options","block"].includes(t))continue;let r=t,i=e.hooks[r],l=n[r];Fl.passThroughHooks.has(t)?n[r]=e=>{if(this.defaults.async&&Fl.passThroughHooksRespectAsync.has(t))return(async()=>{let t=await i.call(n,e);return l.call(n,t)})();let r=i.call(n,e);return l.call(n,r)}:n[r]=(...e)=>{if(this.defaults.async)return(async()=>{let t=await i.apply(n,e);return!1===t&&(t=await l.apply(n,e)),t})();let t=i.apply(n,e);return!1===t&&(t=l.apply(n,e)),t}}t.hooks=n}if(e.walkTokens){let n=this.defaults.walkTokens,r=e.walkTokens;t.walkTokens=function(e){let t=[];return t.push(r.call(this,e)),n&&(t=t.concat(n.call(this,e))),t}}this.defaults={...this.defaults,...t}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Ul.lex(e,n??this.defaults)}parser(e,n){return Nl.parse(e,n??this.defaults)}parseMarkdown(e){return(n,t)=>{let r={...t},i={...this.defaults,...r},l=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||null===n)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let t=i.hooks?await i.hooks.preprocess(n):n,r=await(i.hooks?await i.hooks.provideLexer():e?Ul.lex:Ul.lexInline)(t,i),l=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let a=await(i.hooks?await i.hooks.provideParser():e?Nl.parse:Nl.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(a):a})().catch(l);try{i.hooks&&(n=i.hooks.preprocess(n));let t=(i.hooks?i.hooks.provideLexer():e?Ul.lex:Ul.lexInline)(n,i);i.hooks&&(t=i.hooks.processAllTokens(t)),i.walkTokens&&this.walkTokens(t,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?Nl.parse:Nl.parseInline)(t,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return l(e)}}}onError(e,n){return t=>{if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+Al(t.message+"",!0)+"</pre>";return n?Promise.resolve(e):e}if(n)return Promise.reject(t);throw t}}};function Vl(e,n){return Wl.parse(e,n)}function Kl({title:e,defaultOpen:n=!1,children:t}){const[r,i]=Te(n),l=Me(null);return ge("div",{class:"_pillar-collapsible pillar-collapsible",children:[ge("button",{type:"button",class:"_pillar-collapsible-header pillar-collapsible-header",onClick:()=>i(!r),children:[ge("span",{class:"_pillar-collapsible-icon pillar-collapsible-icon",style:{transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"},children:"▶"}),ge("span",{class:"_pillar-collapsible-title pillar-collapsible-title",children:e})]}),ge("div",{class:"_pillar-collapsible-content-wrapper pillar-collapsible-content-wrapper "+(r?"_pillar-collapsible-content-wrapper--expanded pillar-collapsible-content-wrapper--expanded":""),children:ge("div",{ref:l,class:"_pillar-collapsible-content pillar-collapsible-content",children:t})})]})}function Xl({sources:e}){return e&&0!==e.length?ge("div",{class:"_pillar-source-list pillar-source-list",children:e.map((e,n)=>ge("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",class:"_pillar-source-item pillar-source-item",children:ge("span",{class:"_pillar-source-title pillar-source-title",children:e.title})},n))}):ge("span",{})}function Yl({language:e,children:n}){const[t,r]=Te(!1);return ge("div",{class:"_pillar-code-block pillar-code-block",children:[e&&ge("div",{class:"_pillar-code-header pillar-code-header",children:[ge("span",{class:"_pillar-code-language pillar-code-language",children:e}),ge("button",{type:"button",class:"_pillar-code-copy pillar-code-copy",onClick:async()=>{try{await navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){p.error("[Pillar] Failed to copy code:",e)}},children:t?"Copied!":"Copy"})]}),ge("pre",{class:`_pillar-code-pre pillar-code-pre language-${e||"text"}`,children:ge("code",{class:"_pillar-code-content pillar-code-content",children:n})})]})}function Zl({message:e,isActive:n=!0}){return ge("div",{class:"_pillar-progress-indicator pillar-progress-indicator "+(n?"_pillar-progress-indicator--active pillar-progress-indicator--active":""),children:[n&&ge("div",{class:"_pillar-loading-spinner pillar-loading-spinner"}),ge("span",{class:"_pillar-progress-message pillar-progress-message",children:e})]})}function Gl({content:e,class:n}){if(!e||!e.trim())return ge("span",{});try{return ge("div",{class:`_pillar-markdown pillar-markdown ${n||""}`,children:Ql(Vl.lexer(e))})}catch(t){return p.error("[Pillar] Markdown parsing error:",t),ge("div",{class:`_pillar-markdown pillar-markdown ${n||""}`,children:e})}}function Ql(e){return e.map((e,n)=>function(e,n){switch(e.type){case"heading":return function(e,n){const t=`h${e.depth}`;return ge(t,{class:`_pillar-md-heading _pillar-md-h${e.depth} pillar-md-heading pillar-md-h${e.depth}`,children:ea(e.tokens)},n)}(e,n);case"paragraph":return function(e,n){return ge("p",{class:"_pillar-md-paragraph pillar-md-paragraph",children:ea(e.tokens)},n)}(e,n);case"text":return function(e,n){if(e.tokens&&e.tokens.length>0)return ge(K,{children:ea(e.tokens)},n);return ge(K,{children:e.text},n)}(e,n);case"code":return function(e,n){const t=e.lang||"",r=e.text;if(t.startsWith("collapsible:")){return ge(Kl,{title:t.substring(12),children:ge(Gl,{content:r})},n)}if(t.startsWith("collapsible-open:")){return ge(Kl,{title:t.substring(17),defaultOpen:!0,children:ge(Gl,{content:r})},n)}if("sources"===t)try{return ge(Xl,{sources:JSON.parse(r)},n)}catch{p.warn("[Pillar] Failed to parse sources JSON")}if(t.startsWith("progress:")){return ge(Zl,{message:t.substring(9),isActive:!0},n)}if(t.startsWith("progress-done:")){return ge(Zl,{message:t.substring(14),isActive:!1},n)}return ge(Yl,{language:t||void 0,children:r},n)}(e,n);case"blockquote":return function(e,n){return ge("blockquote",{class:"_pillar-md-blockquote pillar-md-blockquote",children:Ql(e.tokens)},n)}(e,n);case"list":return function(e,n){const t=e.items.map((e,n)=>Jl(e,n));if(e.ordered)return ge("ol",{start:e.start||1,class:"_pillar-md-list _pillar-md-list--ordered pillar-md-list pillar-md-list--ordered",children:t},n);return ge("ul",{class:"_pillar-md-list _pillar-md-list--unordered pillar-md-list pillar-md-list--unordered",children:t},n)}(e,n);case"list_item":return Jl(e,n);case"table":return function(e,n){return ge("div",{class:"_pillar-md-table-wrapper pillar-md-table-wrapper",children:ge("table",{class:"_pillar-md-table pillar-md-table",children:[ge("thead",{children:ge("tr",{children:e.header.map((n,t)=>ge("th",{style:e.align[t]?{textAlign:e.align[t]}:void 0,class:"_pillar-md-th pillar-md-th",children:ea(n.tokens)},t))})}),ge("tbody",{children:e.rows.map((n,t)=>ge("tr",{children:n.map((n,t)=>ge("td",{style:e.align[t]?{textAlign:e.align[t]}:void 0,class:"_pillar-md-td pillar-md-td",children:ea(n.tokens)},t))},t))})]})},n)}(e,n);case"hr":return ge("hr",{class:"_pillar-md-hr pillar-md-hr"},n);case"space":return null;case"html":return function(e,n){const t=e.raw.match(/<(\w+)\s*([^>]*)\/?\s*>/);if(t){const[,e,r]=t,i=function(e){const n={},t=/(\w+)=["']([^"']*)["']/g;let r;for(;null!==(r=t.exec(e));)n[r[1]]=r[2];return n}(r);switch(e){case"SourceList":if(i.sources)try{return ge(Xl,{sources:JSON.parse(i.sources)},n)}catch{p.warn("[Pillar] Failed to parse SourceList sources")}break;case"Progress":return ge(Zl,{message:i.message||"Processing...",isActive:"false"!==i.active},n);case"Collapsible":return ge(Kl,{title:i.title||"Details",defaultOpen:"true"===i.open,children:i.content?ge(Gl,{content:i.content}):null},n)}}return ge("span",{dangerouslySetInnerHTML:{__html:e.raw}},n)}(e,n);case"strong":return ge("strong",{children:ea(e.tokens)},n);case"em":return ge("em",{children:ea(e.tokens)},n);case"codespan":return ge("code",{class:"_pillar-md-code-inline pillar-md-code-inline",children:e.text},n);case"link":const t=e;return ge("a",{href:t.href,title:t.title||void 0,target:"_blank",rel:"noopener noreferrer",class:"_pillar-md-link pillar-md-link",children:ea(t.tokens)},n);case"image":const r=e;return ge("img",{src:r.href,alt:r.text,title:r.title||void 0,class:"_pillar-md-image pillar-md-image"},n);case"br":return ge("br",{},n);case"del":return ge("del",{children:ea(e.tokens)},n);default:return"raw"in e&&"string"==typeof e.raw?ge("span",{children:e.raw},n):null}}(e,n)).filter(Boolean)}function Jl(e,n){return e.task?ge("li",{class:"_pillar-md-list-item _pillar-md-task-item pillar-md-list-item pillar-md-task-item",children:[ge("input",{type:"checkbox",checked:e.checked,disabled:!0,class:"_pillar-md-task-checkbox pillar-md-task-checkbox"}),ge("span",{class:e.checked?"_pillar-md-task-text--checked pillar-md-task-text--checked":"",children:Ql(e.tokens)})]},n):ge("li",{class:"_pillar-md-list-item pillar-md-list-item",children:Ql(e.tokens)},n)}function ea(e){return e&&0!==e.length?e.map((e,n)=>{switch(e.type){case"text":case"escape":return e.text;case"strong":return ge("strong",{children:ea(e.tokens)},n);case"em":return ge("em",{children:ea(e.tokens)},n);case"codespan":return ge("code",{class:"_pillar-md-code-inline pillar-md-code-inline",children:e.text},n);case"link":const t=e;return ge("a",{href:t.href,title:t.title||void 0,target:"_blank",rel:"noopener noreferrer",class:"_pillar-md-link pillar-md-link",children:ea(t.tokens)},n);case"image":const r=e;return ge("img",{src:r.href,alt:r.text,title:r.title||void 0,class:"_pillar-md-image pillar-md-image"},n);case"br":return ge("br",{},n);case"del":return ge("del",{children:ea(e.tokens)},n);default:return"raw"in e&&"string"==typeof e.raw?e.raw:null}}):null}function na({progress:e,isActive:n=!1,isLast:t=!1,responseStarted:r=!1,nested:i=!1,groupActive:l=!1}){const a="active"===e.status||void 0===e.status&&n,o="error"===e.status||"query_failed"===e.kind,s="thinking"===e.kind||"step_start"===e.kind,c=function(e,n=50){const[t,r]=Te(e);return Ie(()=>{const t=setTimeout(()=>{r(e)},n);return()=>{clearTimeout(t)}},[e,n]),t}(e.text,50),[p,d]=Te(0);Ie(()=>{if(!s||!a)return;const n=e.metadata?._startTime||Date.now();d(Math.max(1,Math.round((Date.now()-n)/1e3)));const t=setInterval(()=>{d(Math.round((Date.now()-n)/1e3))},1e3);return()=>clearInterval(t)},[s,a,e.metadata]);const u=Boolean(e.text),h=e.children&&e.children.length>0,g=e.metadata?.sources,m="search_complete"===e.kind&&g&&g.length>0,f=!0===e.metadata?.no_sources_used,v=e.metadata?.arguments,b=v&&Object.keys(v).length>0,_=u||h||m&&!f||b,x=e.metadata?.result_count,y="search"===e.kind&&0===x,[w,k]=Te(!1),[S,C]=Te(!1),P=_&&(w?S:i?a||t&&l:a||t&&!r),E=Me(null),[z,T]=Te(!1),[I,M]=Te(!1);Ie(()=>{k(!1)},[a]),Ie(()=>{M(!1)},[e.id,e.progress_id]),Ie(()=>{E.current&&a&&e.text&&!I&&(E.current.scrollTop=E.current.scrollHeight)},[e.text,a,I]);const R=()=>{_&&(k(!0),C(!P))},$=P?"rotate(90deg)":"rotate(0deg)";if(!(e.label||e.message||e.text||h||m||s))return null;const A=(()=>{if(s){if(a)return p>0?`Thought for ${p}s`:"Thinking...";const n=e.metadata?._durationSeconds,t=n||p;return t>0?`Thought for ${t}s`:"Thought"}return e.label||e.message||function(e){switch(e){case"processing":return"Processing...";case"search":return"Searching...";case"search_complete":return"Search complete";case"query":return"Executing action...";case"query_complete":return"Action complete";case"query_failed":return"Action failed";case"generating":return"Generating answer...";case"thinking":case"step_start":return"Thinking...";case"step_complete":return"Done";case"tool_call":return"Running tool...";case"plan":return"Planning...";default:return"Working..."}}(e.kind)})();return ge("div",{class:`_pillar-progress-row pillar-progress-row${o?" _pillar-progress-row--error pillar-progress-row--error":""}${a?" _pillar-progress-row--active pillar-progress-row--active":""}${t?" _pillar-progress-row--last pillar-progress-row--last":""}${i?" _pillar-progress-row--nested pillar-progress-row--nested":""}`,role:"status","aria-live":a?"polite":"off","aria-label":`${A}: ${a?"in progress":o?"error":"complete"}`,children:[ge("div",{class:"_pillar-progress-row-header pillar-progress-row-header",onClick:R,style:{cursor:_?"pointer":"default"},"data-expanded":P,role:_?"button":void 0,"aria-expanded":_?P:void 0,tabIndex:_?0:void 0,onKeyDown:_?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R())}:void 0,children:[o&&ge("span",{class:"_pillar-progress-error-icon pillar-progress-error-icon","aria-label":"Error",children:"✗"}),ge("span",{class:"_pillar-progress-message pillar-progress-message",children:A}),y&&ge("span",{class:"_pillar-progress-no-results pillar-progress-no-results",children:"— no relevant results"}),_&&!o&&ge("span",{class:"_pillar-progress-chevron pillar-progress-chevron",style:{transform:$,transition:"transform 0.2s ease, opacity 0.15s ease"},"aria-hidden":"true",children:"▶"})]}),_&&ge("div",{class:"_pillar-progress-content-wrapper pillar-progress-content-wrapper "+(P?"_pillar-progress-content-wrapper--expanded pillar-progress-content-wrapper--expanded":""),children:ge("div",{class:"_pillar-progress-content-container pillar-progress-content-container",children:[b&&ge("div",{class:"_pillar-progress-arguments pillar-progress-arguments",children:Object.entries(v).map(([e,n])=>ge("span",{class:"_pillar-progress-argument pillar-progress-argument",children:[ge("span",{class:"_pillar-progress-argument-key pillar-progress-argument-key",children:[e,":"]})," ",ge("span",{class:"_pillar-progress-argument-value pillar-progress-argument-value",children:"string"==typeof n?n:JSON.stringify(n)})]},e))}),u&&ge("div",{class:"_pillar-progress-text-preview-wrapper pillar-progress-text-preview-wrapper",children:[z&&ge("div",{class:"_pillar-progress-text-gradient pillar-progress-text-gradient"}),ge("div",{ref:E,class:"_pillar-progress-text-preview pillar-progress-text-preview",onScroll:()=>{if(E.current){const{scrollTop:e,scrollHeight:n,clientHeight:t}=E.current;M(!(e>=n-t-5)),T(e>0)}},children:ge(Gl,{content:c||""})})]}),h?ge("div",{class:"_pillar-progress-children pillar-progress-children",children:e.children.map((e,n)=>ge("div",{class:"_pillar-progress-child-item pillar-progress-child-item",children:e.url?ge("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",class:"_pillar-progress-child-link pillar-progress-child-link",children:e.label}):ge("span",{class:"_pillar-progress-child-label pillar-progress-child-label",children:e.label})},e.id||n))}):m?ge("div",{class:"_pillar-progress-sources pillar-progress-sources",children:g.map((e,n)=>ge("div",{class:"_pillar-progress-source-item pillar-progress-source-item",children:ge("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",class:"_pillar-progress-source-link pillar-progress-source-link",children:ge("span",{class:"_pillar-progress-source-title pillar-progress-source-title",children:e.title})})},n))}):null]})})]})}function ta({events:e,summary:n,isLast:t=!1,responseStarted:r=!1}){const i=e.some(e=>"active"===e.status),[l,a]=Te(!1),[o,s]=Te(!1),c=l?o:i||t&&!r;Ie(()=>{i&&a(!1)},[i]);const p=()=>{a(!0),s(!c)};return ge("div",{class:`_pillar-progress-group pillar-progress-group${i?" _pillar-progress-group--active pillar-progress-group--active":""}${t?" _pillar-progress-group--last pillar-progress-group--last":""}`,children:[ge("div",{class:"_pillar-progress-group-header pillar-progress-group-header",onClick:p,role:"button","aria-expanded":c,tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),p())},children:[ge("span",{class:"_pillar-progress-group-chevron pillar-progress-group-chevron",style:{transform:c?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"},"aria-hidden":"true",children:"▶"}),ge("span",{class:"_pillar-progress-group-summary pillar-progress-group-summary",children:n}),i&&ge("span",{class:"_pillar-progress-group-active-dot pillar-progress-group-active-dot"})]}),ge("div",{class:"_pillar-progress-group-children pillar-progress-group-children "+(c?"_pillar-progress-group-children--expanded pillar-progress-group-children--expanded":""),children:ge("div",{class:"_pillar-progress-group-children-inner pillar-progress-group-children-inner",children:e.map((n,t)=>ge(na,{progress:n,isActive:"active"===n.status,isLast:t===e.length-1,responseStarted:r,nested:!0,groupActive:i},n.id||n.progress_id||t))})})]})}Vl.options=Vl.setOptions=function(e){return Wl.setOptions(e),Vl.defaults=Wl.defaults,Li(Vl.defaults),Vl},Vl.getDefaults=$i,Vl.defaults=Ai,Vl.use=function(...e){return Wl.use(...e),Vl.defaults=Wl.defaults,Li(Vl.defaults),Vl},Vl.walkTokens=function(e,n){return Wl.walkTokens(e,n)},Vl.parseInline=Wl.parseInline,Vl.Parser=Nl,Vl.parser=Nl.parse,Vl.Renderer=ql,Vl.TextRenderer=Bl,Vl.Lexer=Ul,Vl.lexer=Ul.lex,Vl.Tokenizer=jl,Vl.Hooks=Fl,Vl.parse=Vl,Vl.options,Vl.setOptions,Vl.use,Vl.walkTokens,Vl.parseInline,Nl.parse,Ul.lex;const ra=new Set(["search","search_complete","tool_call","plan","generating","query","query_complete","query_failed","step_complete","processing"]);const ia=new Set(["search_complete","query_complete","step_complete"]);function la(e){const n=e.filter(e=>!ia.has(e.kind));if(1===n.length&&n[0].label)return n[0].label;let t=0,r=0;for(const n of e)switch(n.kind){case"search":case"search_complete":break;case"query":case"query_complete":case"query_failed":case"tool_call":t++;break;default:r++}const i=e.filter(e=>"search_complete"===e.kind).length,l=e.filter(e=>"search"===e.kind).length,a=Math.max(i,l),o=[];return a>0&&o.push(`Searched ${a} ${1===a?"source":"sources"}`),t>0&&o.push(`Ran ${t} ${1===t?"action":"actions"}`),r>0&&0===o.length&&o.push(`${r} ${1===r?"step":"steps"}`),o.length>0?o.join(", "):`${e.length} steps`}function aa({events:e,responseStarted:n=!1}){if(!e||0===e.length)return null;const t=function(e){const n=[];let t=[];const r=()=>{t.length>0&&(n.push({type:"tool_group",events:[...t],summary:la(t)}),t=[])};for(const i of e)"thinking"===i.kind||"step_start"===i.kind?(r(),n.push({type:"thinking",event:i})):(ra.has(i.kind),t.push(i));return r(),n}(e);return ge("div",{class:"_pillar-progress-stack pillar-progress-stack",children:t.flatMap((e,r)=>{if("thinking"===e.type)return[ge(na,{progress:e.event,isActive:"active"===e.event.status,isLast:r===t.length-1,responseStarted:n},e.event.id||e.event.progress_id||`thinking-${r}`)];const i=e.events.filter(e=>!ia.has(e.kind));return i.length<=2?e.events.map((i,l)=>ge(na,{progress:i,isActive:"active"===i.status,isLast:r===t.length-1&&l===e.events.length-1,responseStarted:n},i.id||i.progress_id||`flat-${r}-${l}`)):[ge(ta,{events:e.events,summary:e.summary,isLast:r===t.length-1,responseStarted:n},`group-${r}`)]})})}function oa({session:e,onResume:n,onDiscard:t,isResuming:r=!1}){return ge("div",e.elapsedMs<15e3||r?{class:"_pillar-resume-prompt _pillar-resume-prompt--seamless pillar-resume-prompt",children:[ge("div",{class:"_pillar-resume-prompt-spinner pillar-resume-prompt-spinner"}),ge("span",{class:"_pillar-resume-prompt-text pillar-resume-prompt-text",children:"Resuming conversation..."})]}:{class:"_pillar-resume-prompt pillar-resume-prompt",children:[ge("div",{class:"_pillar-resume-prompt-content pillar-resume-prompt-content",children:[ge("div",{class:"_pillar-resume-prompt-icon pillar-resume-prompt-icon",children:ge("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[ge("circle",{cx:"12",cy:"12",r:"10"}),ge("polyline",{points:"12 6 12 12 16 14"})]})}),ge("div",{class:"_pillar-resume-prompt-body pillar-resume-prompt-body",children:[ge("div",{class:"_pillar-resume-prompt-title pillar-resume-prompt-title",children:"Session Interrupted"}),ge("div",{class:"_pillar-resume-prompt-message pillar-resume-prompt-message",children:[e.userMessage&&ge("span",{class:"_pillar-resume-prompt-user-msg pillar-resume-prompt-user-msg",children:['"',sa(e.userMessage,50),'"']}),e.partialResponse&&ge("span",{class:"_pillar-resume-prompt-summary pillar-resume-prompt-summary",children:sa(e.partialResponse,80)})]})]})]}),ge("div",{class:"_pillar-resume-prompt-actions pillar-resume-prompt-actions",children:[ge("button",{type:"button",class:"_pillar-resume-prompt-btn _pillar-resume-prompt-btn--primary pillar-resume-prompt-btn",onClick:n,children:[ge("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:ge("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Resume"]}),ge("button",{type:"button",class:"_pillar-resume-prompt-btn _pillar-resume-prompt-btn--ghost pillar-resume-prompt-btn",onClick:t,children:"Discard"})]})]})}function sa(e,n){return e.length<=n?e:e.slice(0,n)+"..."}function ca(){const e=Yr(),n=e?.config?.domScanning?.excludeSelector;return{excludeSelector:n?`#pillar-root, ${n}`:"#pillar-root"}}function pa(){const e=Ir(),n=Me(null),t=Me(null),[r,i]=Te(!1),l=$e(async n=>{const t=performance.now(),r=(new Date).toISOString();p.log("[Pillar] Received action_request:",n.action_name,n.parameters,`at ${r}`);const i=Yr();if(i)try{if("interact_with_page"===n.action_name){const r=n.parameters;ni(r.operation,n.tool_call_id);try{if(li())return await e.mcp.sendActionResult(n.action_name,{success:!1,error:"User cancelled action"},n.tool_call_id),void p.log("[Pillar] Page interaction cancelled by user before execution");const l=await i.handlePageInteraction(r);if(li())return await e.mcp.sendActionResult(n.action_name,{success:!1,error:"User cancelled action"},n.tool_call_id),void p.log("[Pillar] Page interaction cancelled by user after execution");let a=null;if(l.success&&i?.isDOMScanningEnabled){await new Promise(e=>setTimeout(e,150));const e=function(e){const n=e?.root||document.body,t={lines:[],refs:new Set,interactableCount:0,totalLength:0,budgetExhausted:!1,maxDepth:0,options:{...gi,...e}};Mi(n,t,0);const r=t.lines.filter(e=>!xi.has(e)),i=[...yi].filter(e=>!t.refs.has(e)),l=/\[\[pr-[a-z0-9]+\]\]$/,a=r.filter(e=>l.test(e)).length,o=r.length>0||i.length>0;xi=new Set(t.lines),yi=new Set(t.refs);let s=null;if(o){const e=[];r.length>0&&(e.push(...r),e.push(""));const n=i.length>0?`, ${i.length} removed: ${i.join(", ")}`:"";e.push(`=== ${a} new${n} ===`),s=e.join("\n")}return{content:s,removedRefs:i,newInteractableCount:a,totalInteractableCount:t.refs.size,hasChanges:o,timestamp:Date.now(),url:window.location.href,title:document.title}}(ca());a=e.content,p.log("[Pillar] DOM delta scanned after page interaction:",e.hasChanges?`${e.newInteractableCount} new, ${e.removedRefs.length} removed`:"no changes")}await e.mcp.sendActionResult(n.action_name,{...l,dom_snapshot:a},n.tool_call_id);const o=Math.round(performance.now()-t);p.log(`[Pillar] Page interaction "${r.operation}" completed in ${o}ms:`,l)}finally{ti(),ii()}return}const r=i.getHandler(n.action_name);let l;r?l=await Promise.resolve(r(n.parameters)):await i.executeTask({id:`action-${n.action_name}`,name:n.action_name,data:n.parameters}),await e.mcp.sendActionResult(n.action_name,{success:!0,result:l},n.tool_call_id);const a=Math.round(performance.now()-t);p.log(`[Pillar] Action "${n.action_name}" completed in ${a}ms`)}catch(r){const i=r instanceof Error?r.message:String(r);await e.mcp.sendActionResult(n.action_name,{success:!1,error:i},n.tool_call_id);const l=Math.round(performance.now()-t);p.error(`[Pillar] Action "${n.action_name}" failed after ${l}ms:`,r)}else p.error("[Pillar] SDK not initialized, cannot execute action"),await e.mcp.sendActionResult(n.action_name,{success:!1,error:"SDK not initialized"},n.tool_call_id)},[e]),a=$e(()=>{const e=Yr(),n=e?.config?.productKey??"";Vt(),di(n)},[]);Ie(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[Qn.value,ct.value]),Ie(()=>{const e=Yr();if(!e)return;return e.on("task:complete",({name:e,success:n})=>{Ot(e,n);const t=function(e,n){const t=e.replace(/_/g," ").toLowerCase();return n?t.startsWith("open ")?`Opened ${t.slice(5)}`:t.startsWith("go to ")?`Navigated to ${t.slice(6)}`:t.startsWith("navigate to ")?`Navigated to ${t.slice(12)}`:"Done!":`Failed to ${t}`}(e,n);Dt(e,t)})},[]);const o=$e(e=>{const n=Yr();p.log("[Pillar] handleActionsReceived called with",e.length,"actions"),p.log("[Pillar] Actions detail:",e.map(e=>({name:e.name,autoRun:e.autoRun})));const t=e.filter(e=>!0===e.autoRun),r=e.filter(e=>!e.autoRun);return p.log("[Pillar] Auto-run actions:",t.length,", Manual actions:",r.length),n&&t.length>0?(p.log("[Pillar] Executing auto-run actions..."),t.forEach(e=>{const t=e.data||{},r=t.path,i=t.url,l=Qn.value.length-1;l>=0&&Ht(l,e.name),p.log("[Pillar] Executing action:",e.name),n.executeTask({id:e.id,name:e.name,taskType:e.taskType,data:t,path:r,externalUrl:i})}),[]):n?r:(p.warn("[Pillar] No Pillar instance available for auto-run"),e)},[]),s=$e(async n=>{const r=new AbortController;t.current=r;let i=[];const a=await e.chat({message:n.message,history:n.history,existingConversationId:n.conversationId,userContext:n.userContext,images:n.images,resume:n.resume,signal:r.signal,onChunk:e=>{gt(e)},onActions:e=>{i=o(e)},onProgress:e=>{Ft(e)},onConversationStarted:()=>{const e=Yr(),n=e?.config?.productKey??"",t=Jn.value;n&&t&&Promise.resolve().then(function(){return hi}).then(({saveActiveSession:e})=>{e(t,n)})},onActionRequest:l,onRequestId:e=>ot(e)});return{response:a,receivedActions:i}},[e,o,l]),c=$e(async(e,n,r)=>{$t(e,n,r),qt(!0),At("");try{const t=Qn.value.slice(0,-1),i=!Jn.value;i&&jt(crypto.randomUUID());const{response:l,receivedActions:a}=await s({message:e,conversationId:Jn.value,userContext:n,images:r,history:t});let c=a;l.actions&&l.actions.length>0&&(c=o(l.actions)),Lt(l.message,l.messageId,c,l.sources),l.conversationId&&jt(l.conversationId),i&&Jn.value&&dr(Jn.value,e);{const e=Yr(),n=e?.config?.productKey??"";n&&di(n)}}catch(e){if("AbortError"===e.name)return Kt(),void p.log("[Pillar] Chat cancelled by user");p.error("[Pillar] Chat error:",e);const n=e instanceof Error?e.message:"";Lt(n?`Sorry, something went wrong: ${n}`:"Sorry, I encountered an error. Please try again.")}finally{qt(!1),Bt(),ot(null),t.current=null}},[e,s,o]),d=$e(async()=>{const e=ct.value;if(!e)return;const n=Yr(),r=n?.config?.productKey??"",l=n?.isDOMScanningEnabled??!1;let a=[...wt.value];if(l){const e=Ri(ca()),n={id:Xn(),type:"dom_snapshot",url:e.url,title:e.title,content:e.content,interactableCount:e.interactableCount,timestamp:e.timestamp};a=[...a,n]}i(!0),qt(!0),At("");try{const{response:n,receivedActions:t}=await s({message:"",conversationId:e.conversationId,userContext:a.length>0?a:void 0,resume:!0});let i=t;n.actions&&n.actions.length>0&&(i=o(n.actions)),Lt(n.message,n.messageId,i,n.sources),Vt(),di(r)}catch(e){if("AbortError"===e.name)return void Kt();p.error("[Pillar] Resume error:",e),Lt("Sorry, failed to resume the conversation. Please try again."),Vt(),di(r)}finally{i(!1),qt(!1),Bt(),ot(null),t.current=null}},[s,o]);Ie(()=>{const e=ct.value;e&&e.elapsedMs<15e3&&d()},[ct.value,d]);const u=$e(()=>{t.current?.abort(),t.current=null;const n=at.value;null!==n&&(e.mcp.cancelStream(n),ot(null)),qt(!1),Bt(),Kt(),Nt();const r=Qn.value,i=r.length>0?r[r.length-1]:null,l="assistant"===i?.role&&Boolean(i?.content?.trim()),a=Yr(),o=a?.config?.productKey??"";if(l&&Jn.value){const e=[...r].reverse().find(e=>"user"===e.role);Wt({conversationId:Jn.value,userMessage:e?.content??"",partialResponse:i.content??"",displayTrace:[],elapsedMs:99999})}else o&&di(o)},[e]),h=$e(async(n,t)=>{Ut(n,t),await e.submitFeedback(n,t)},[e]),g=$e((e,n,t)=>{if(lt.value)return;const r=Yr();if(r?.isDOMScanningEnabled??!1){const r=Ri(ca()),i={id:Xn(),type:"dom_snapshot",url:r.url,title:r.title,content:r.content,interactableCount:r.interactableCount,timestamp:r.timestamp},l=[...n,i];return void c(e,l.length>0?l:void 0,t.length>0?t:void 0)}c(e,n.length>0?n:void 0,t.length>0?t:void 0)},[c]);return Ie(()=>{const e=_t.value,n=kt.value,t=St.value;e&&(Yt(),tr(),ir(),g(e,n,t))},[xt.value,g]),ge("div",{class:"_pillar-chat-view pillar-chat-view",children:[ge("div",{class:"_pillar-chat-view-messages pillar-chat-view-messages",ref:n,children:[st.value&&ge("div",{class:"_pillar-chat-history-loading pillar-chat-history-loading",children:[ge("div",{class:"_pillar-chat-history-loading-message _pillar-chat-history-loading-message--user pillar-chat-history-loading-message--user",children:ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 70%"})}),ge("div",{class:"_pillar-chat-history-loading-message _pillar-chat-history-loading-message--assistant pillar-chat-history-loading-message--assistant",children:[ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 90%"}),ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 85%"}),ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 60%"})]}),ge("div",{class:"_pillar-chat-history-loading-message _pillar-chat-history-loading-message--user pillar-chat-history-loading-message--user",children:ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 55%"})}),ge("div",{class:"_pillar-chat-history-loading-message _pillar-chat-history-loading-message--assistant pillar-chat-history-loading-message--assistant",children:[ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 95%"}),ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 80%"})]})]}),0===Qn.value.length&&!ct.value&&!st.value&&ge("div",{class:"_pillar-chat-view-welcome pillar-chat-view-welcome",children:$r.value?ge("div",{class:"_pillar-home-view-questions pillar-home-view-questions",children:[ge(Wr,{}),ge(Wr,{}),ge(Wr,{})]}):Rr.value&&Rr.value.length>0?ge("div",{class:"_pillar-home-view-questions pillar-home-view-questions",children:Rr.value.map(e=>ge(Fr,{text:e.text,onClick:()=>g(e.text,[],[])},e.id))}):ge(K,{children:[ge("div",{class:"_pillar-chat-view-welcome-icon pillar-chat-view-welcome-icon",children:"💬"}),ge("div",{class:"_pillar-chat-view-welcome-title pillar-chat-view-welcome-title",children:"Ask a question"}),ge("div",{class:"_pillar-chat-view-welcome-text pillar-chat-view-welcome-text",children:"Ask me anything about how to use this product."})]})}),Qn.value.map((e,n)=>ge("div",{class:`_pillar-chat-view-message pillar-chat-view-message _pillar-chat-view-message--${e.role} pillar-chat-view-message--${e.role}`,children:"user"===e.role?ge("div",{class:"_pillar-message-user pillar-message-user",children:[e.userContext&&e.userContext.length>0&&ge(qr,{contexts:e.userContext,readOnly:!0}),e.images&&e.images.length>0&&ge("div",{class:"_pillar-message-user-images pillar-message-user-images",children:e.images.map((e,n)=>ge("img",{src:e.url,alt:`Attachment ${n+1}`,class:"_pillar-message-user-image pillar-message-user-image"},n))}),e.content]}):ge("div",{class:"_pillar-message-assistant-wrapper pillar-message-assistant-wrapper",children:[ge("div",{class:"_pillar-message-assistant-content pillar-message-assistant-content",children:[e.segments&&e.segments.length>0?e.segments.map((n,t)=>{if("progress"===n.type){const r=e.segments.slice(t+1).some(e=>"text"===e.type);return ge(aa,{events:n.events,responseStarted:r||Boolean(e.content)},`seg-${t}`)}return ge("div",{class:"_pillar-message-assistant pillar-message-assistant",children:ge(Gl,{content:n.content})},`seg-${t}`)}):lt.value&&n===Qn.value.length-1&&ge("span",{class:"_pillar-thinking-shimmer pillar-thinking-shimmer",children:"Thinking..."}),e.actionStatus&&Object.keys(e.actionStatus).length>0&&ge("span",{class:"_pillar-action-status pillar-action-status",children:Object.entries(e.actionStatus).map(([e,n])=>ge("span",{class:`_pillar-action-status-indicator pillar-action-status-indicator _pillar-action-status-indicator--${n.status} pillar-action-status-indicator--${n.status}`,title:"failed"===n.status?n.errorMessage:e,dangerouslySetInnerHTML:{__html:"success"===n.status?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>':"failed"===n.status?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" opacity="0.3"/><path d="M12 2v4"/></svg>'}},e))})]}),"assistant"===e.role&&e.id&&e.content&&ge("div",{class:"_pillar-feedback-icons pillar-feedback-icons",children:[ge("button",{class:"_pillar-feedback-btn pillar-feedback-btn "+("up"===e.feedback?"_pillar-feedback-btn--active pillar-feedback-btn--active":""),onClick:()=>h(e.id,"up"),"aria-label":"Helpful",title:"Helpful",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"/></svg>'}}),ge("button",{class:"_pillar-feedback-btn pillar-feedback-btn "+("down"===e.feedback?"_pillar-feedback-btn--active pillar-feedback-btn--active":""),onClick:()=>h(e.id,"down"),"aria-label":"Not helpful",title:"Not helpful",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"/></svg>'}})]}),e.sources&&e.sources.length>0&&ge("div",{class:"_pillar-chat-sources pillar-chat-sources",children:[ge("div",{class:"_pillar-chat-sources-title pillar-chat-sources-title",children:"Sources"}),e.sources.map(e=>ge("div",{class:"_pillar-chat-source pillar-chat-source",children:e.title},e.slug))]})]})},n)),ct.value&&ct.value.elapsedMs>=15e3&&ge(oa,{session:ct.value,onResume:d,onDiscard:a,isResuming:r}),r&&ct.value&&ct.value.elapsedMs<15e3&&ge(oa,{session:ct.value,onResume:d,onDiscard:a,isResuming:!0})]}),ge("div",{class:"_pillar-chat-view-input-area pillar-chat-view-input-area",children:ge(Nr,{placeholder:"Ask a question...",disabled:st.value,isStreaming:lt.value,onStop:u,onSubmit:g})})]})}function da(e){if(!e)return"Unknown";const n=function(e){let n=e;return e.endsWith("Z")&&e.includes("+")&&(n=e.slice(0,-1)),new Date(n)}(e),t=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-r.getTime(),l=Math.floor(i/864e5);if(0===l)return"Today";if(1===l)return"Yesterday";if(l<7)return`${l}d ago`;if(l<30){const e=Math.floor(l/7);return 1===e?"1 week ago":`${e} weeks ago`}return n.toLocaleDateString(void 0,{month:"short",year:"numeric"})}function ua({onSelectConversation:e}){const[n,t]=Te(!1),[r,i]=Te(!1),[l,a]=Te([]),[o,s]=Te(!1),[c,d]=Te(nt.value),u=Me(null),h=Re(()=>function(e){const n=new Map;for(const t of e){const e=da(t.lastMessageAt),r=n.get(e)||[];r.push(t),n.set(e,r)}return Array.from(n.entries()).map(([e,n])=>({label:e,conversations:n}))}(l),[l]);Ie(()=>nt.subscribe(e=>{e>c&&(s(!1),d(e))}),[c]),Ie(()=>{const e=e=>{u.current&&!u.current.contains(e.target)&&t(!1)};return n&&(document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[n]);const g=async()=>{if(!o){i(!0);try{const e=Zr();if(e){const n=await e.listConversations(20);a((e=>{const n=tt.value;if(0===n.length)return e;const t=new Set(e.map(e=>e.id)),r=n.filter(e=>!t.has(e.id));return[...r,...e]})(n))}}catch(e){p.error("[Pillar] Failed to fetch conversations:",e),tt.value.length>0&&a(tt.value)}finally{i(!1),s(!0)}}},m=$n.value,f=["_pillar-history-menu","pillar-history-menu",m?"_pillar-history-menu--mobile":""].filter(Boolean).join(" "),v=r?ge("div",{class:"_pillar-history-loading pillar-history-loading",children:[ge("div",{class:"_pillar-history-spinner pillar-history-spinner"}),ge("span",{children:"Loading..."})]}):0===l.length?ge("div",{class:"_pillar-history-empty pillar-history-empty",children:"No conversations yet"}):ge("div",{class:"_pillar-history-list pillar-history-list",children:h.map(n=>ge(K,{children:[ge("div",{class:"_pillar-history-group-header pillar-history-group-header",children:n.label}),n.conversations.map(n=>ge("button",{class:"_pillar-history-item pillar-history-item",onClick:()=>(n=>{t(!1),e(n)})(n.id),type:"button",children:ge("span",{class:"_pillar-history-item-title pillar-history-item-title",children:n.title})},n.id))]},n.label))});return ge("div",{class:"_pillar-history-dropdown pillar-history-dropdown",ref:u,children:[ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-history-btn",onClick:()=>{const e=!n;t(e),e&&!o&&g()},"aria-label":"Conversation history","aria-expanded":n,title:"Conversation history",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" clip-rule="evenodd"/></svg>'}}),n&&ge("div",{class:f,children:[m&&ge("div",{class:"_pillar-history-mobile-header",children:[ge("span",{class:"_pillar-history-mobile-title",children:"History"}),ge("button",{class:"_pillar-history-mobile-close",onClick:()=>t(!1),"aria-label":"Close history",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/></svg>'}})]}),v]})]})}const ha=120;function ga({currentView:e,hideNavigation:n=!1}){const t=Me(null),r=$n.value,i=!n&&fr.value,l=!n&&!vr.value,a="chat"===e&&Rt.value,o=ur;return Ie(()=>{if(!r)return;const e=t.current;if(!e)return;const n=e.closest("._pillar-panel");if(!n)return;let i=0,l=0,a=!1,o=!1,s=0;const c=e=>{e.target.closest("button")||(i=e.touches[0].clientY,l=i,s=Date.now(),a=!0,o=!1)},p=e=>{if(!a)return;l=e.touches[0].clientY;const t=l-i;if(t<0)return;if(!o){if(t<10)return;o=!0,n.style.transition="none"}const r=t<ha?t:ha+.3*(t-ha);n.style.transform=`translateY(${r}px)`,e.preventDefault()},d=()=>{if(!a||!o)return void(a=!1);a=!1,o=!1;const e=l-i,t=Date.now()-s,r=e/Math.max(t,1);if(n.style.transition="",n.offsetHeight,e>ha||r>.5){n.style.transform="translateY(100%)";const e=()=>{n.removeEventListener("transitionend",e),clearTimeout(t),n.style.transform="",Hn()},t=setTimeout(e,600);n.addEventListener("transitionend",e)}else n.style.transform=""};return e.addEventListener("touchstart",c,{passive:!0}),document.addEventListener("touchmove",p,{passive:!1}),document.addEventListener("touchend",d),()=>{e.removeEventListener("touchstart",c),document.removeEventListener("touchmove",p),document.removeEventListener("touchend",d),n.style.transition="",n.style.transform=""}},[r]),ge("header",{ref:t,class:"_pillar-header pillar-header",children:[r&&ge("div",{class:"_pillar-drag-indicator pillar-drag-indicator",children:ge("div",{class:"_pillar-drag-indicator-pill"})}),ge("div",{class:"_pillar-header-left pillar-header-left",children:[i&&ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-back-btn",onClick:()=>{_r()},"aria-label":"Go back",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z" clip-rule="evenodd"/></svg>'}}),l&&!a&&ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-home-btn",onClick:()=>{xr()},"aria-label":"Go to home",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"/></svg>'}})]}),ge("div",{class:"_pillar-header-right pillar-header-right",children:[a&&ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-new-chat-btn",onClick:()=>{xr()},"aria-label":"New chat",title:"New chat",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z"/></svg>'}}),ge(ua,{onSelectConversation:o}),ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-close-btn",onClick:()=>{Hn()},"aria-label":"Close assistant panel",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/></svg>'}})]})]})}function ma(){const e=mr.value,n=wn.value,t="chat"===e.type,r="home"===e.type;return ge("div","assistant"!==n?{class:"_pillar-panel-ui pillar-panel-ui",children:[ge(ga,{currentView:"home"}),ge("div",{class:"_pillar-content pillar-content",children:"support"===n?ge("div",{style:{padding:"24px",textAlign:"center"},children:[ge("h2",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:"Hello World"}),ge("p",{style:{color:"var(--pillar-text-muted)",fontSize:"14px"},children:"Support tab content goes here."})]}):null})]}:{class:"_pillar-panel-ui pillar-panel-ui",children:[ge(ga,{currentView:e.type,hideNavigation:t}),ge("div",{class:"_pillar-content pillar-content",children:(()=>{switch(e.type){case"home":default:return ge(Vr,{});case"chat":return ge(pa,{})}})()}),!t&&!r&&ge("div",{class:"_pillar-chat-input-area pillar-chat-input-area",children:ge(Nr,{placeholder:"Ask a question..."})})]})}class fa{constructor(e,n,t,r){this.host=null,this.shadow=null,this.backdrop=null,this.panelElement=null,this.renderRoot=null,this.resizeHandle=null,this.unsubscribe=null,this.isManualMount=!1,this.themeObserver=null,this._isResizing=!1,this._resizeStartX=0,this._resizeStartWidth=0,this._resizeRafId=null,this._boundHandleResizeMove=null,this._boundHandleResizeEnd=null,this.handleResizeStart=e=>{if(!yn.value||!this.config.panel.resizable)return;e.preventDefault(),e.stopPropagation();const n="touches"in e?e.touches[0].clientX:e.clientX;this._isResizing=!0,this._resizeStartX=n,this._resizeStartWidth=Cn.value,this._boundHandleResizeMove=this.handleResizeMove.bind(this),this._boundHandleResizeEnd=this.handleResizeEnd.bind(this),document.addEventListener("mousemove",this._boundHandleResizeMove),document.addEventListener("mouseup",this._boundHandleResizeEnd),document.addEventListener("touchmove",this._boundHandleResizeMove,{passive:!1}),document.addEventListener("touchend",this._boundHandleResizeEnd),document.addEventListener("touchcancel",this._boundHandleResizeEnd),document.body.style.userSelect="none",document.body.style.webkitUserSelect="none",document.documentElement.style.cursor="col-resize",document.documentElement.style.transition="none",this.panelElement?.classList.add("_pillar-panel--resizing","pillar-panel--resizing")},this.handleResizeEnd=e=>{this._isResizing&&(null!==this._resizeRafId&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this._isResizing=!1,xn(Cn.value),this._boundHandleResizeMove&&(document.removeEventListener("mousemove",this._boundHandleResizeMove),document.removeEventListener("touchmove",this._boundHandleResizeMove)),this._boundHandleResizeEnd&&(document.removeEventListener("mouseup",this._boundHandleResizeEnd),document.removeEventListener("touchend",this._boundHandleResizeEnd),document.removeEventListener("touchcancel",this._boundHandleResizeEnd)),this._boundHandleResizeMove=null,this._boundHandleResizeEnd=null,document.body.style.userSelect="",document.body.style.webkitUserSelect="",document.documentElement.style.cursor="",document.documentElement.style.transition="padding 0.3s ease",this.panelElement?.classList.remove("_pillar-panel--resizing","pillar-panel--resizing"))},this.handleKeyDown=e=>{"Escape"===e.key&&yn.value&&Hn()},this.config=e,this.api=n,this.events=t,this.rootContainer=r||null,this.isManualMount="manual"===e.panel.container}detectThemeFromDOM(){const e=document.documentElement;if(e.classList.contains("dark"))return"dark";return"dark"===e.getAttribute("data-theme")||"dark"===e.style.colorScheme?"dark":"light"}get isOpen(){return yn.value}async init(){var e,n,t;if(e=this.config.panel.position,kn.value=e,(e=>{Sn.value=e})(this.config.panel.mode),n=this.config.panel.hoverBreakpoint,Pn.value=n,t=this.config.panel.hoverBackdrop,En.value=t,this.config.panel.resizable){const e=_n();On(null!==e?e:this.config.panel.width)}else On(this.config.panel.width);(()=>{if("undefined"==typeof window)return;Mn?.();const e=()=>{In.value=window.innerWidth};In.value=window.innerWidth,window.addEventListener("resize",e),Mn=()=>{window.removeEventListener("resize",e)}})(),this.createHost(),this.isManualMount||this.createBackdrop(),this.createPanel(),this.renderPreact(),this.bindEvents(),this.subscribeToState()}open(e){if(e?.search&&(Xt(e.search),br("chat"),Zt()),yn.value)return e?.view&&br(e.view),void(e?.focusInput&&Gt());yn.value=!0,bn(!0),"overlay"===Ln.value&&(document.body.style.overflow="hidden"),e?.view&&!e?.search&&br(e.view),e?.focusInput?Gt():this.setupFocusTrap()}close(){yn.value&&Hn()}navigate(e,n){yn.value?br(e,n):this.open({view:e})}destroy(){this.close(),this._isResizing&&this.handleResizeEnd(new MouseEvent("mouseup")),null!==this._resizeRafId&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this.resizeHandle&&(this.resizeHandle.removeEventListener("mousedown",this.handleResizeStart),this.resizeHandle.removeEventListener("touchstart",this.handleResizeStart),this.resizeHandle=null),this.isManualMount||this.removePushModeStyles(),this.unsubscribe?.(),this.unsubscribe=null,Mn?.(),Mn=null,this.themeObserver?.disconnect(),this.themeObserver=null,this.renderRoot&&ue(null,this.renderRoot),this.backdrop?.remove(),this.host?.remove(),document.getElementById("pillar-sdk-styles")?.remove(),document.getElementById("pillar-sdk-theme")?.remove(),document.getElementById("pillar-sdk-custom")?.remove(),this.host=null,this.shadow=null,this.backdrop=null,this.panelElement=null,this.renderRoot=null,document.removeEventListener("keydown",this.handleKeyDown),Dn(),yr(),lr()}handleResizeMove(e){this._isResizing&&("touches"in e&&e.preventDefault(),null===this._resizeRafId&&(this._resizeRafId=requestAnimationFrame(()=>{if(this._resizeRafId=null,!this._isResizing)return;const n="touches"in e?e.touches[0].clientX:e.clientX,t=this._resizeStartX-n,r="right"===kn.value?t:-t,i=window.innerWidth-100,l=Math.max(fa.MIN_PANEL_WIDTH,Math.min(i,this._resizeStartWidth+r));On(l)})))}subscribeToState(){if(this.isManualMount)return void(this.unsubscribe=yn.subscribe(e=>{e||this.events.emit("panel:close")}));let e=yn.value,n=Ln.value;const t=()=>{const e=yn.value,n="push"===Ln.value,t=Cn.value,r=kn.value,i=Rn.value&&En.value||$n.value;e?(n?(this.applyPushModeStyles(t,r),this.setBackdropVisible(!1)):(this.removePushModeStyles(),document.body.style.overflow="hidden",this.setBackdropVisible(i)),this.panelElement?.classList.add("_pillar-panel--open","pillar-panel--open")):(this.removePushModeStyles(),document.body.style.overflow="",this.setBackdropVisible(!1),this.panelElement?.classList.remove("_pillar-panel--open","pillar-panel--open"))};t();const r=yn.subscribe(n=>{n!==e&&(e=n,t(),n||this.events.emit("panel:close"))}),i=Ln.subscribe(e=>{e!==n&&(n=e,t())}),l=An.subscribe(e=>{e?this.panelElement?.classList.add("_pillar-panel--full-width","pillar-panel--full-width"):this.panelElement?.classList.remove("_pillar-panel--full-width","pillar-panel--full-width")}),a=$n.subscribe(e=>{e?this.panelElement?.classList.add("_pillar-panel--mobile","pillar-panel--mobile"):this.panelElement?.classList.remove("_pillar-panel--mobile","pillar-panel--mobile"),t()});let o=Cn.value;const s=Cn.subscribe(e=>{e!==o&&(o=e,this.panelElement?.style.setProperty("--pillar-panel-width",`${e}px`),yn.value&&t())});this.unsubscribe=()=>{r(),i(),l(),a(),s()}}setBackdropVisible(e){this.backdrop&&(e?(this.backdrop.style.opacity="1",this.backdrop.style.visibility="visible",this.backdrop.classList.add("_pillar-backdrop--visible","pillar-backdrop--visible")):(this.backdrop.style.opacity="0",this.backdrop.style.visibility="hidden",this.backdrop.classList.remove("_pillar-backdrop--visible","pillar-backdrop--visible")))}applyPushModeStyles(e,n){document.documentElement.style.transition="padding 0.3s ease","right"===n?(document.documentElement.style.paddingRight=`${e}px`,document.documentElement.style.setProperty("--pillar-inset-right",`${e}px`),document.documentElement.style.setProperty("--pillar-inset-left","0px")):(document.documentElement.style.paddingLeft=`${e}px`,document.documentElement.style.setProperty("--pillar-inset-left",`${e}px`),document.documentElement.style.setProperty("--pillar-inset-right","0px"))}removePushModeStyles(){document.documentElement.style.paddingLeft="",document.documentElement.style.paddingRight="",document.documentElement.style.removeProperty("--pillar-inset-right"),document.documentElement.style.removeProperty("--pillar-inset-left"),setTimeout(()=>{yn.value||(document.documentElement.style.transition="")},300)}get renderContainer(){return this.shadow||this.host}transformStylesForRegularDOM(e){return e.replace(/:host\(([^)]+)\)/g,"[data-pillar-panel]$1").replace(/:host-context\(([^)]+)\)/g,"$1 [data-pillar-panel]").replace(/:host:not\(([^)]+)\)/g,"[data-pillar-panel]:not($1)").replace(/:host/g,"[data-pillar-panel]")}injectStylesIntoHead(){const e="pillar-sdk-styles";if(document.getElementById(e))return;const n=Sr,t=this.transformStylesForRegularDOM(n),r=document.createElement("style");r.id=e,r.textContent=t,document.head.appendChild(r);const i=Pr(this.config.theme);if(i){const e=document.createElement("style");e.id="pillar-sdk-theme",e.textContent=this.transformStylesForRegularDOM(i),document.head.appendChild(e)}if(this.config.customCSS){const e=document.createElement("style");e.id="pillar-sdk-custom",e.textContent=this.transformStylesForRegularDOM(this.config.customCSS),document.head.appendChild(e)}}injectStylesIntoShadow(){if(!this.shadow)return;const e=document.createElement("style");e.textContent=Sr,this.shadow.appendChild(e);const n=Pr(this.config.theme);if(n){const e=document.createElement("style");e.textContent=n,e.setAttribute("data-pillar-theme",""),this.shadow.appendChild(e)}if(this.config.customCSS){const e=document.createElement("style");e.textContent=this.config.customCSS,e.setAttribute("data-pillar-custom",""),this.shadow.appendChild(e)}}createHost(){this.host=document.createElement("div"),this.host.className="pillar-panel-host",this.host.setAttribute("data-pillar-panel",""),this.config.panel.useShadowDOM?(this.shadow=this.host.attachShadow({mode:"open"}),this.injectStylesIntoShadow()):(this.shadow=null,this.injectStylesIntoHead()),this.applyThemeMode(),this.setupThemeObserver();const e=this.config.panel.container;if("manual"===e)return;const n=this.rootContainer||document.body;let t=null;"string"==typeof e?(t=document.querySelector(e),t||(p.warn(`[Pillar] Container element not found: ${e}, falling back to root container`),t=n)):t=e instanceof HTMLElement?e:n,t.appendChild(this.host)}mountTo(e){this.host?(this.host.parentElement&&this.host.parentElement.removeChild(this.host),e.appendChild(this.host)):p.warn("[Pillar] Panel host not created yet")}getHostElement(){return this.host}createBackdrop(){this.backdrop=document.createElement("div"),this.backdrop.className="_pillar-backdrop pillar-backdrop",this.backdrop.style.cssText="\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.3);\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.4s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.4s cubic-bezier(0.32, 0.72, 0, 1);\n z-index: 99998;\n ",this.backdrop.addEventListener("click",()=>{Hn()});(this.rootContainer||document.body).appendChild(this.backdrop)}createPanel(){const e=this.renderContainer;if(!e)return;this.panelElement=document.createElement("div");const n=this.isManualMount?" _pillar-panel--manual pillar-panel--manual":"",t=`_pillar-panel--${kn.value} pillar-panel--${kn.value}`;this.panelElement.className=`_pillar-panel pillar-panel ${t}${n}`,this.panelElement.style.setProperty("--pillar-panel-width",`${Cn.value}px`),this.panelElement.setAttribute("role","dialog"),this.panelElement.setAttribute("aria-modal","true"),this.panelElement.setAttribute("aria-label","Assistant panel"),this.renderRoot=document.createElement("div"),this.renderRoot.className="_pillar-panel-root pillar-panel-root",this.panelElement.appendChild(this.renderRoot),this.config.panel.resizable&&!this.isManualMount&&(this.resizeHandle=document.createElement("div"),this.resizeHandle.className="_pillar-resize-handle pillar-resize-handle",this.resizeHandle.addEventListener("mousedown",this.handleResizeStart),this.resizeHandle.addEventListener("touchstart",this.handleResizeStart,{passive:!1}),this.panelElement.appendChild(this.resizeHandle)),e.appendChild(this.panelElement)}renderPreact(){this.renderRoot&&ue(ge(zr,{api:this.api,events:this.events,children:ge(ma,{})}),this.renderRoot)}bindEvents(){document.addEventListener("keydown",this.handleKeyDown)}setupFocusTrap(){setTimeout(()=>{const e=this.renderContainer,n=e?.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');n?.focus()},100)}applyThemeMode(){if(!this.host)return;const e=this.config.theme.mode;if("light"===e||"dark"===e)this.host.setAttribute("data-theme",e);else{const e=this.detectThemeFromDOM();this.host.setAttribute("data-theme",e)}}setupThemeObserver(){"auto"===this.config.theme.mode&&(this.themeObserver=new MutationObserver(()=>{this.applyThemeMode()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}))}setTheme(e){this.config={...this.config,theme:{...this.config.theme,...e,colors:{...this.config.theme.colors,...e.colors},darkColors:{...this.config.theme.darkColors,...e.darkColors}}},this.applyThemeMode();const n=Pr(this.config.theme);if(this.shadow){const e=this.shadow.querySelector("style[data-pillar-theme]");if(e&&n)e.textContent=n;else if(n&&!e){const e=document.createElement("style");e.textContent=n,e.setAttribute("data-pillar-theme","");const t=this.shadow.querySelector("style");t?.nextSibling?this.shadow.insertBefore(e,t.nextSibling):this.shadow.appendChild(e)}}else{const e=this.transformStylesForRegularDOM(n),t=document.getElementById("pillar-sdk-theme");if(t&&e)t.textContent=e;else if(e&&!t){const n=document.createElement("style");n.id="pillar-sdk-theme",n.textContent=e,document.head.appendChild(n)}}}}fa.MIN_PANEL_WIDTH=200;function va({label:e,x:n,y:t,isVisible:r,onClick:i}){const l=Me(null),[a,o]=Te({x:n,y:t}),[s,c]=Te(!1),p=$e(()=>{if(!l.current||!r)return;const e=l.current.getBoundingClientRect(),i=window.innerWidth;let a=n,s=t,p=!1;a=n-e.width/2,a<10?a=10:a+e.width>i-10&&(a=i-e.width-10),s=t-e.height-10,s<10&&(s=t+10,p=!0),o({x:a,y:s}),c(p)},[n,t,r]);Ie(()=>{r&&requestAnimationFrame(p)},[r,p,n,t]);return ge("div",{ref:l,class:`pillar-text-selection-popover${r?" pillar-text-selection-popover--visible":""}${s?" pillar-text-selection-popover--below":""}`,style:{left:`${a.x}px`,top:`${a.y}px`},onClick:e=>{e.preventDefault(),e.stopPropagation(),i()},role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i())},children:[ge("div",{class:"pillar-text-selection-popover__content",children:[ge("span",{class:"pillar-text-selection-popover__icon",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path d="M10 2a1 1 0 011 1v1.323l3.954 1.582 1.599-.8a1 1 0 01.894 1.79l-1.233.616 1.738 5.42a1 1 0 01-.285 1.05A3.989 3.989 0 0115 15a3.989 3.989 0 01-2.667-1.019 1 1 0 01-.285-1.05l1.715-5.349L10 6.477l-3.763 1.105 1.715 5.349a1 1 0 01-.285 1.05A3.989 3.989 0 015 15a3.989 3.989 0 01-2.667-1.019 1 1 0 01-.285-1.05l1.738-5.42-1.233-.617a1 1 0 01.894-1.788l1.599.799L9 4.323V3a1 1 0 011-1z"/></svg>'}}),ge("span",{children:e})]}),ge("div",{class:"pillar-text-selection-popover__arrow"})]})}const ba="pillar-text-selection-styles";class _a{constructor(e,n,t){this.container=null,this.isVisible=!1,this.currentSelection="",this.stylesInjected=!1,this.handleMouseUp=e=>{setTimeout(()=>{this.checkSelection(e)},10)},this.handleMouseDown=e=>{e.target.closest(".pillar-text-selection-popover")||this.hidePopover()},this.handleKeyDown=e=>{"Escape"===e.key&&this.hidePopover()},this.handleScroll=()=>{this.isVisible&&this.hidePopover()},this.handlePopoverClick=()=>{this.currentSelection&&(this.events.emit("textSelection:click",{text:this.currentSelection}),Qt({type:"highlighted_text",url_origin:window.location.href,text_content:this.currentSelection}),this.hidePopover(),window.getSelection()?.removeAllRanges(),this.openPanel())},this.config=e,this.events=n,this.openPanel=t}init(){this.stylesInjected||(jn(document,"/* Pillar Text Selection Popover Styles */\n.pillar-text-selection-popover {\n position: absolute;\n z-index: 99999;\n padding: 6px 12px;\n font-family: var(--pillar-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);\n font-size: 13px;\n font-weight: 500;\n line-height: 1;\n color: #ffffff;\n background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);\n border-radius: 6px;\n box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n opacity: 0;\n transform: translateY(4px) scale(0.95);\n transition: opacity 0.15s ease, transform 0.15s ease;\n cursor: pointer;\n user-select: none;\n}\n\n.pillar-text-selection-popover.pillar-text-selection-popover--visible {\n opacity: 1;\n transform: translateY(0) scale(1);\n}\n\n.pillar-text-selection-popover:hover {\n background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);\n box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.pillar-text-selection-popover:active {\n transform: translateY(0) scale(0.98);\n}\n\n.pillar-text-selection-popover__content {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.pillar-text-selection-popover__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n}\n\n.pillar-text-selection-popover__icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* Arrow pointing down to selection */\n.pillar-text-selection-popover__arrow {\n position: absolute;\n bottom: -5px;\n left: 50%;\n transform: translateX(-50%) rotate(45deg);\n width: 10px;\n height: 10px;\n background: linear-gradient(135deg, #8b5cf6 0%, #8b5cf6 100%);\n}\n\n.pillar-text-selection-popover--below .pillar-text-selection-popover__arrow {\n bottom: auto;\n top: -5px;\n background: linear-gradient(135deg, #6366f1 0%, #6366f1 100%);\n}\n",ba),this.stylesInjected=!0),this.container=document.createElement("div"),this.container.id="pillar-text-selection-container",document.body.appendChild(this.container),this.bindEvents()}destroy(){this.unbindEvents(),this.container&&(ue(null,this.container),this.container.remove(),this.container=null),document.getElementById(ba)?.remove(),this.stylesInjected=!1,this.isVisible=!1,this.currentSelection=""}bindEvents(){document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("scroll",this.handleScroll,!0)}unbindEvents(){document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("scroll",this.handleScroll,!0)}checkSelection(e){const n=window.getSelection();if(!n||n.isCollapsed)return;const t=n.toString().trim();if(t.length<3)return;const r=n.getRangeAt(0),i=r.commonAncestorContainer,l=i instanceof Element?i:i.parentElement;if(l?.closest("[data-pillar-panel]")||l?.closest(".pillar-panel-host"))return;const a=r.getBoundingClientRect(),o=a.left+a.width/2,s=a.top+window.scrollY;this.currentSelection=t,this.showPopover(o,s)}showPopover(e,n){this.container&&(this.isVisible=!0,ue(ge(va,{label:this.config.textSelection.label,x:e,y:n,isVisible:!0,onClick:this.handlePopoverClick}),this.container),this.events.emit("textSelection:shown",{text:this.currentSelection}))}hidePopover(){this.container&&this.isVisible&&(this.isVisible=!1,ue(ge(va,{label:this.config.textSelection.label,x:0,y:0,isVisible:!1,onClick:()=>{}}),this.container))}}function xa(){const e=Gr.value,n=ai.value;if(!e&&!n)return null;if(n){const e=oi.value||"Destructive action",n=e=>{e.preventDefault(),e.stopPropagation(),ci(!0)},t=e=>{e.preventDefault(),e.stopPropagation(),ci(!1)};return ge("div",{class:"_pillar-page-pilot-banner pillar-page-pilot-banner _pillar-page-pilot-banner--confirm pillar-page-pilot-banner--confirm",children:ge("div",{class:"_pillar-page-pilot-banner__content pillar-page-pilot-banner__content",children:[ge("span",{class:"_pillar-page-pilot-banner__warning-icon pillar-page-pilot-banner__warning-icon",dangerouslySetInnerHTML:{__html:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'}}),ge("span",{class:"_pillar-page-pilot-banner__text pillar-page-pilot-banner__text",children:e}),ge("button",{type:"button",class:"_pillar-page-pilot-banner__deny pillar-page-pilot-banner__deny",onClick:t,"aria-label":"Deny destructive action",children:"Deny"}),ge("button",{type:"button",class:"_pillar-page-pilot-banner__allow pillar-page-pilot-banner__allow",onClick:n,"aria-label":"Allow destructive action",children:"Allow"})]})})}return ge("div",{class:"_pillar-page-pilot-banner pillar-page-pilot-banner",children:ge("div",{class:"_pillar-page-pilot-banner__content pillar-page-pilot-banner__content",children:[ge("span",{class:"_pillar-page-pilot-banner__indicator pillar-page-pilot-banner__indicator"}),ge("span",{class:"_pillar-page-pilot-banner__text pillar-page-pilot-banner__text",children:"Page being piloted by Agent"}),ge("button",{type:"button",class:"_pillar-page-pilot-banner__stop pillar-page-pilot-banner__stop",onClick:e=>{e.preventDefault(),e.stopPropagation(),ri()},"aria-label":"Stop agent action",children:[ge("span",{class:"_pillar-page-pilot-banner__stop-icon pillar-page-pilot-banner__stop-icon",dangerouslySetInnerHTML:{__html:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/></svg>'}}),ge("span",{children:"Stop"})]})]})})}const ya="pillar-page-pilot-styles";class wa{constructor(){this.container=null,this.stylesInjected=!1,this.unsubscribe=null,this.themeObserver=null,this.themeMode="auto"}detectThemeFromDOM(){const e=document.documentElement;if(e.classList.contains("dark"))return"dark";const n=e.getAttribute("data-theme");return"dark"===n?"dark":"light"}applyThemeMode(){if(this.container)if("light"===this.themeMode||"dark"===this.themeMode)this.container.setAttribute("data-theme",this.themeMode);else{const e=this.detectThemeFromDOM();this.container.setAttribute("data-theme",e)}}setupThemeObserver(){"auto"===this.themeMode&&(this.themeObserver=new MutationObserver(()=>{this.applyThemeMode()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}))}init(e,n="auto"){this.primaryColor=e,this.themeMode=n,this.stylesInjected||(jn(document,"/* Pillar Page Pilot Banner Styles */\n\n/* Define CSS variables at the container level (same as panel) */\n#pillar-page-pilot-container {\n /* Core colors - Light mode (default) */\n --pillar-primary: #2563eb;\n --pillar-primary-hover: #1d4ed8;\n --pillar-bg: #ffffff;\n --pillar-bg-secondary: #f9fafb;\n --pillar-text: #1a1a1a;\n --pillar-text-secondary: #374151;\n --pillar-border: #e5e7eb;\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n --pillar-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n --pillar-radius-lg: 8px;\n --pillar-radius-md: 6px;\n --pillar-transition-fast: 0.15s ease;\n}\n\n/* Dark mode - Auto-detect from system preference */\n@media (prefers-color-scheme: dark) {\n #pillar-page-pilot-container:not([data-theme=\"light\"]) {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-border: #404040;\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n }\n}\n\n/* Dark mode - Manual override via html class or data attribute */\nhtml.dark #pillar-page-pilot-container,\n[data-theme=\"dark\"] #pillar-page-pilot-container,\n#pillar-page-pilot-container[data-theme=\"dark\"] {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-border: #404040;\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n}\n\n@keyframes pillar-pulse {\n 0%, 100% {\n opacity: 1;\n transform: scale(1);\n }\n 50% {\n opacity: 0.6;\n transform: scale(1.1);\n }\n}\n\n@keyframes pillar-banner-fade-in {\n from {\n opacity: 0;\n transform: translateY(-100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n._pillar-page-pilot-banner {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n z-index: 99999;\n font-family: var(--pillar-font-family);\n display: flex;\n justify-content: center;\n pointer-events: none;\n animation: pillar-banner-fade-in 0.2s ease-out;\n}\n\n/* Viewport outline — 3px border on left, right, bottom; top handled by tab shape */\n._pillar-page-pilot-banner::before {\n content: '';\n position: fixed;\n inset: 0;\n border: 3px solid var(--pillar-primary);\n border-top: none;\n pointer-events: none;\n z-index: 99998;\n}\n\n/* Top border segments on either side of the tab */\n._pillar-page-pilot-banner::after {\n content: '';\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: 3px;\n background: var(--pillar-primary);\n pointer-events: none;\n z-index: 99997;\n}\n\n._pillar-page-pilot-banner__content {\n position: relative;\n z-index: 99999;\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 6px 20px;\n background: var(--pillar-primary);\n color: #ffffff;\n border-bottom-left-radius: var(--pillar-radius-lg);\n border-bottom-right-radius: var(--pillar-radius-lg);\n pointer-events: auto;\n}\n\n._pillar-page-pilot-banner__indicator {\n width: 8px;\n height: 8px;\n background: #ffffff;\n border-radius: 50%;\n animation: pillar-pulse 1.5s ease-in-out infinite;\n flex-shrink: 0;\n}\n\n._pillar-page-pilot-banner__text {\n font-size: 13px;\n font-weight: 500;\n color: #ffffff;\n white-space: nowrap;\n}\n\n._pillar-page-pilot-banner__stop {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 5px 10px;\n margin-left: 4px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 500;\n color: #ffffff;\n background: rgba(255, 255, 255, 0.15);\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-page-pilot-banner__stop:hover {\n background: rgba(255, 255, 255, 0.25);\n border-color: rgba(255, 255, 255, 0.5);\n}\n\n._pillar-page-pilot-banner__stop:active {\n transform: scale(0.97);\n}\n\n._pillar-page-pilot-banner__stop-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n}\n\n._pillar-page-pilot-banner__stop-icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* Confirmation variant — amber/warning theme */\n._pillar-page-pilot-banner--confirm ._pillar-page-pilot-banner__content {\n background: #d97706;\n}\n\n._pillar-page-pilot-banner--confirm::before {\n border-color: #d97706;\n}\n\n._pillar-page-pilot-banner--confirm::after {\n background: #d97706;\n}\n\n._pillar-page-pilot-banner__warning-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n._pillar-page-pilot-banner__warning-icon svg {\n width: 100%;\n height: 100%;\n}\n\n._pillar-page-pilot-banner__deny {\n display: flex;\n align-items: center;\n padding: 5px 12px;\n margin-left: 4px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 500;\n color: #ffffff;\n background: rgba(255, 255, 255, 0.15);\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-page-pilot-banner__deny:hover {\n background: rgba(255, 255, 255, 0.25);\n border-color: rgba(255, 255, 255, 0.5);\n}\n\n._pillar-page-pilot-banner__deny:active {\n transform: scale(0.97);\n}\n\n._pillar-page-pilot-banner__allow {\n display: flex;\n align-items: center;\n padding: 5px 12px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 600;\n color: #d97706;\n background: #ffffff;\n border: 1px solid rgba(255, 255, 255, 0.8);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-page-pilot-banner__allow:hover {\n background: #fef3c7;\n}\n\n._pillar-page-pilot-banner__allow:active {\n transform: scale(0.97);\n}\n",ya),this.stylesInjected=!0),this.container=document.createElement("div"),this.container.id="pillar-page-pilot-container",document.body.appendChild(this.container),this.primaryColor&&this.container.style.setProperty("--pillar-primary",this.primaryColor),this.applyThemeMode(),this.setupThemeObserver(),this.unsubscribe=pn(()=>{Gr.value,this.render()}),this.render()}setPrimaryColor(e){this.primaryColor=e,this.container&&this.container.style.setProperty("--pillar-primary",e)}destroy(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null),this.themeObserver&&(this.themeObserver.disconnect(),this.themeObserver=null),this.container&&(ue(null,this.container),this.container.remove(),this.container=null),document.getElementById(ya)?.remove(),this.stylesInjected=!1}render(){this.container&&ue(ge(xa,{}),this.container)}}const ka={recentActions:[]},Sa={},Ca=Je({...ka}),Pa=Je({...Sa});ln(()=>{const e=Ca.value;return!!(e.currentPage||e.currentFeature||e.userRole||e.errorState||e.recentActions&&e.recentActions.length>0)}),ln(()=>!!Ca.value.errorState);const Ea=e=>{Pa.value={...e}},za=Je(null),Ta=Je([]);ln(()=>null!==za.value),ln(()=>za.value&&za.value.steps[za.value.current_step]||null);const Ia=ln(()=>za.value?za.value.steps.filter(e=>"completed"===e.status||"skipped"===e.status).length:0);function Ma(e,n){if(!za.value)return;const t=za.value.steps.map((t,r)=>r===e?{...t,status:n}:t);za.value={...za.value,steps:t}}function Ra(){if(!za.value)return null;const e=za.value.current_step+1;if(e>=za.value.steps.length)return null;const n=za.value.steps[e].auto_run?"active":"awaiting_initiation",t=za.value.steps.map((t,r)=>r===e?{...t,status:n}:t);return za.value={...za.value,steps:t,current_step:e},za.value.steps[e]}function $a(){if(!za.value)return null;const e=za.value;return Ta.value=[...Ta.value,e],za.value=null,e}ln(()=>za.value?Ia.value/za.value.total_steps:0);class Aa{constructor(e={}){this._callback=null,this._debounceTimer=null,this._lastRoute=null,this._running=!1,this._originalPushState=null,this._originalReplaceState=null,this._handleRouteChange=()=>{this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const e=this._getCurrentUrl();e!==this._lastRoute&&(this._lastRoute=e,this._callback&&this._callback(this.getCurrentRoute()))},this._debounceMs)},this._debounceMs=e.debounceMs??100}get running(){return this._running}onRouteChange(e){this._callback=e}start(){this._running||"undefined"!=typeof window&&(this._running=!0,this._lastRoute=this._getCurrentUrl(),this._patchHistory(),window.addEventListener("popstate",this._handleRouteChange),window.addEventListener("hashchange",this._handleRouteChange))}stop(){this._running&&(this._running=!1,this._restoreHistory(),window.removeEventListener("popstate",this._handleRouteChange),window.removeEventListener("hashchange",this._handleRouteChange),this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null))}getCurrentRoute(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,url:window.location.href,title:document.title}}_patchHistory(){this._originalPushState=history.pushState.bind(history),this._originalReplaceState=history.replaceState.bind(history),history.pushState=(...e)=>{this._originalPushState(...e),this._handleRouteChange()},history.replaceState=(...e)=>{this._originalReplaceState(...e),this._handleRouteChange()}}_restoreHistory(){this._originalPushState&&(history.pushState=this._originalPushState),this._originalReplaceState&&(history.replaceState=this._originalReplaceState),this._originalPushState=null,this._originalReplaceState=null}_getCurrentUrl(){return window.location.pathname+window.location.search+window.location.hash}}function La(e){const n=new Date(e);return`${n.getHours().toString().padStart(2,"0")}:${n.getMinutes().toString().padStart(2,"0")}:${n.getSeconds().toString().padStart(2,"0")}.${n.getMilliseconds().toString().padStart(3,"0")}`}function Ha(e){switch(e){case"error":return"#ef4444";case"warn":return"#f59e0b";default:return"#d4d4d4"}}function Oa(e){switch(e){case"sdk":return"⚡";case"handler":return"🔧";case"network":return"🌐";case"server":return"🧠";default:return"•"}}function Da(e){switch(e){case"sdk":return"SDK";case"handler":return"Handler";case"network":return"Network";case"server":return"Server";default:return e}}const ja=["sdk","handler","network","server"];function Ua({expanded:e=!1,onToggle:n}){const[t,r]=Te([]),[i,l]=Te(e),[a,o]=Te(""),[s,c]=Te(new Set(ja)),[p,d]=Te(200),[u,h]=Te(!1),[g,m]=Te(new Set),[f,v]=Te(null),b=Me(null),_=Me("");Ie(()=>{const e="pillar-debug-panel-styles";if(!document.getElementById(e)){const n=document.createElement("style");n.id=e,n.textContent=".pillar-debug-panel {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: #1e1e1e;\n color: #d4d4d4;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 12px;\n z-index: 999999;\n border-top: 1px solid #333;\n}\n.pillar-debug-resize-handle {\n height: 8px;\n background-color: #333;\n cursor: ns-resize;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.pillar-debug-resize-handle::after {\n content: '';\n width: 40px;\n height: 3px;\n background-color: #555;\n border-radius: 2px;\n}\n.pillar-debug-resize-handle:hover,\n.pillar-debug-resize-handle.active {\n background-color: #3b82f6;\n}\n.pillar-debug-resize-handle:hover::after,\n.pillar-debug-resize-handle.active::after {\n background-color: #fff;\n}\n.pillar-debug-header {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n background-color: #252526;\n cursor: pointer;\n user-select: none;\n}\n.pillar-debug-header-icon {\n margin-right: 8px;\n font-size: 10px;\n}\n.pillar-debug-header-title {\n font-weight: 600;\n margin-right: 8px;\n}\n.pillar-debug-header-count {\n background-color: #3c3c3c;\n padding: 2px 6px;\n border-radius: 4px;\n font-size: 11px;\n margin-right: auto;\n}\n.pillar-debug-header-actions {\n display: flex;\n gap: 8px;\n}\n.pillar-debug-btn {\n background-color: transparent;\n border: 1px solid #555;\n color: #d4d4d4;\n padding: 2px 8px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 11px;\n}\n.pillar-debug-btn:hover {\n background-color: #333;\n}\n.pillar-debug-btn.copied {\n border-color: #10b981;\n color: #10b981;\n}\n.pillar-debug-content {\n overflow: hidden;\n display: flex;\n flex-direction: column;\n}\n.pillar-debug-toolbar {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 12px;\n background-color: #2d2d2d;\n border-bottom: 1px solid #3c3c3c;\n flex-shrink: 0;\n}\n.pillar-debug-filter-input {\n background-color: #3c3c3c;\n border: none;\n color: #d4d4d4;\n padding: 4px 8px;\n font-size: 12px;\n outline: none;\n border-radius: 4px;\n flex: 1;\n max-width: 200px;\n}\n.pillar-debug-source-filters {\n display: flex;\n gap: 4px;\n}\n.pillar-debug-source-btn {\n background-color: transparent;\n border: 1px solid #444;\n color: #888;\n padding: 2px 8px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 11px;\n display: flex;\n align-items: center;\n gap: 4px;\n}\n.pillar-debug-source-btn.active {\n background-color: #3c3c3c;\n border-color: #666;\n color: #d4d4d4;\n}\n.pillar-debug-source-btn:hover {\n background-color: #333;\n}\n.pillar-debug-source-count {\n background-color: #444;\n padding: 0 4px;\n border-radius: 3px;\n font-size: 10px;\n}\n.pillar-debug-timeline {\n flex: 1;\n overflow-y: auto;\n padding: 4px 0;\n}\n.pillar-debug-empty {\n padding: 12px;\n color: #6b7280;\n text-align: center;\n}\n.pillar-debug-entry {\n padding: 4px 12px;\n border-bottom: 1px solid #2d2d2d;\n}\n.pillar-debug-entry:hover {\n background-color: #252526;\n}\n.pillar-debug-entry.server {\n background-color: rgba(139, 92, 246, 0.1);\n}\n.pillar-debug-entry.server:hover {\n background-color: rgba(139, 92, 246, 0.15);\n}\n.pillar-debug-entry-row {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.pillar-debug-entry-time {\n color: #6b7280;\n flex-shrink: 0;\n}\n.pillar-debug-entry-source {\n flex-shrink: 0;\n font-size: 10px;\n padding: 1px 4px;\n border-radius: 3px;\n background-color: #333;\n}\n.pillar-debug-entry-source.sdk { background-color: #3b82f6; color: white; }\n.pillar-debug-entry-source.handler { background-color: #10b981; color: white; }\n.pillar-debug-entry-source.network { background-color: #f59e0b; color: black; }\n.pillar-debug-entry-source.server { background-color: #8b5cf6; color: white; }\n.pillar-debug-entry-event {\n font-weight: 500;\n flex-shrink: 0;\n}\n.pillar-debug-entry-data {\n color: #9ca3af;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.pillar-debug-entry.expanded {\n flex-direction: column;\n align-items: stretch;\n}\n.pillar-debug-entry.expanded .pillar-debug-entry-row {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.pillar-debug-entry.expanded .pillar-debug-entry-data {\n white-space: pre-wrap;\n word-break: break-all;\n overflow: visible;\n margin-top: 8px;\n padding: 8px;\n background-color: #2d2d2d;\n border-radius: 4px;\n font-size: 11px;\n line-height: 1.4;\n}\n.pillar-debug-entry-expand {\n color: #6b7280;\n font-size: 10px;\n flex-shrink: 0;\n margin-left: auto;\n}\n",document.head.appendChild(n)}_.current=document.body.style.paddingBottom||"";const n=Yr();if(!n)return;r(n.getDebugLog());const t=n.onDebugLog(e=>{r([...e])});return()=>{t(),document.body.style.paddingBottom=_.current}},[]);const x=Me(null);Ie(()=>{const e=x.current;if(!e)return;const n=()=>{document.body.style.paddingBottom=`${e.offsetHeight}px`},t=new ResizeObserver(n);return t.observe(e),n(),()=>{t.disconnect()}},[]),Ie(()=>{b.current&&t.length>0&&requestAnimationFrame(()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight)})},[t]);const y=$e(e=>{e.preventDefault(),h(!0);const n=e.clientY,t=p,r=e=>{const r=n-e.clientY,i=Math.min(600,Math.max(100,t+r));d(i)},i=()=>{h(!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",i)},[p]),w=Re(()=>{const e={sdk:0,handler:0,network:0,server:0};for(const n of t)e[n.source]=(e[n.source]||0)+1;return e},[t]),k=Re(()=>t.filter(e=>{if(!s.has(e.source))return!1;if(a){const n=a.toLowerCase(),t=e.event.toLowerCase().includes(n),r=!!e.data&&JSON.stringify(e.data).toLowerCase().includes(n);if(!t&&!r)return!1}return!0}),[t,s,a]),S=(e,n)=>["=== Pillar SDK — Client Logs ===",`Output: ${n}`,`Exported: ${(new Date).toISOString()}`,`Entries: ${e.length}`,""].join("\n")+e.map(e=>{const n=La(e.timestamp),t=Da(e.source).toUpperCase().padEnd(8),r="error"===e.level?" [ERROR]":"warn"===e.level?" [WARN]":"",i=null!=e.data?` ${"object"==typeof e.data?JSON.stringify(e.data):String(e.data)}`:"";return`${n} [${t}]${r} ${e.event}${i}`}).join("\n");return ge("div",{class:"pillar-debug-panel",ref:x,children:[i&&ge("div",{class:"pillar-debug-resize-handle "+(u?"active":""),onMouseDown:y}),ge("div",{class:"pillar-debug-header",onClick:()=>{l(!i),n?.()},children:[ge("span",{class:"pillar-debug-header-icon",children:i?"▼":"▶"}),ge("span",{class:"pillar-debug-header-title",children:"Debug"}),ge("span",{class:"pillar-debug-header-count",children:t.length}),i&&ge("div",{class:"pillar-debug-header-actions",children:[ge("button",{class:"pillar-debug-btn "+("copy"===f?"copied":""),onClick:e=>{e.stopPropagation(),(()=>{const e=ja.filter(e=>s.has(e)).map(Da).join(", "),n=S(k,a?`${e} (filtered: "${a}")`:e);navigator.clipboard.writeText(n),v("copy"),setTimeout(()=>v(null),1500)})()},children:"copy"===f?"Copied!":"Copy"}),ge("button",{class:"pillar-debug-btn "+("copyAll"===f?"copied":""),onClick:e=>{e.stopPropagation(),(()=>{const e=S(t,"All Sources");navigator.clipboard.writeText(e),v("copyAll"),setTimeout(()=>v(null),1500)})()},children:"copyAll"===f?"Copied!":"Copy All"}),ge("button",{class:"pillar-debug-btn",onClick:e=>{e.stopPropagation(),(()=>{const e=JSON.stringify(t,null,2),n=new Blob([e],{type:"application/json"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=`pillar-debug-${(new Date).toISOString().slice(0,19).replace(/:/g,"-")}.json`,i.click(),URL.revokeObjectURL(r)})()},children:"Export"}),ge("button",{class:"pillar-debug-btn",onClick:e=>{e.stopPropagation(),(()=>{const e=Yr();e?.clearDebugLog()})()},children:"Clear"})]})]}),i&&ge("div",{class:"pillar-debug-content",style:{height:`${p}px`},children:[ge("div",{class:"pillar-debug-toolbar",children:[ge("input",{type:"text",class:"pillar-debug-filter-input",placeholder:"Filter...",value:a,onInput:e=>o(e.target.value),onClick:e=>e.stopPropagation()}),ge("div",{class:"pillar-debug-source-filters",children:ja.map(e=>ge("button",{class:"pillar-debug-source-btn "+(s.has(e)?"active":""),onClick:n=>{n.stopPropagation(),(e=>{c(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})})(e)},children:[Oa(e)," ",Da(e),ge("span",{class:"pillar-debug-source-count",children:w[e]})]},e))})]}),ge("div",{class:"pillar-debug-timeline",ref:b,children:0===k.length?ge("div",{class:"pillar-debug-empty",children:0===t.length?"No events captured yet":"No events match filters"}):k.map((e,n)=>{const t=g.has(n),r=null!==e.data&&void 0!==e.data;return ge("div",{class:`pillar-debug-entry ${e.source} ${t?"expanded":""}`,onClick:()=>r&&(e=>{m(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})})(n),style:{cursor:r?"pointer":"default"},children:[ge("div",{class:"pillar-debug-entry-row",children:[ge("span",{class:"pillar-debug-entry-time",children:La(e.timestamp)}),ge("span",{class:`pillar-debug-entry-source ${e.source}`,children:Oa(e.source)}),ge("span",{class:"pillar-debug-entry-event",style:{color:Ha(e.level)},children:e.event}),r&&!t&&ge("span",{class:"pillar-debug-entry-data",children:"object"==typeof e.data?JSON.stringify(e.data,null,0).slice(0,100):String(e.data)}),r&&ge("span",{class:"pillar-debug-entry-expand",children:t?"▼":"▶"})]}),r&&t&&ge("span",{class:"pillar-debug-entry-data",children:(i=e.data,null==i?"":"object"==typeof i?JSON.stringify(i,null,2):String(i))})]},n);var i})})]})]})}const qa="pillar-";const Ba=[{id:"assistant",label:"Assistant",enabled:!0,order:0}],Na="https://help-api.trypillar.com",Fa={enabled:!0,position:"right",mode:"push",width:380,useShadowDOM:!1,hoverBreakpoint:1200,hoverBackdrop:!0,fullWidthBreakpoint:500,initialOpen:!1,resizable:!0},Wa={enabled:!0,resizable:!0},Va={enabled:!0,breakpoint:700,position:"bottom-right",icon:"sparkle",iconColor:"white",size:"medium",label:"Get help",offset:24},Ka={enabled:!0,prefix:"pillar-",clearAfterOpen:!0},Xa={enabled:!0,label:"Ask AI"},Ya={enabled:!1,includeText:!0,maxDepth:20,visibleOnly:!0,maxTextLength:500,interactionHighlight:{enabled:!0,outlineColor:"#3b82f6",outlineWidth:2,outlineOffset:2,duration:2e3,scrollIntoView:!0,scrollBehavior:"smooth"}},Za={enabled:!0,debounceMs:100,displayLimit:3},Ga={mode:"auto"};function Qa(e){if(!e||0===e.length)return Ba;const n=new Map;for(const e of Ba)n.set(e.id,{...e});for(const t of e)n.set(t.id,{...t});const t=n.get("assistant");return t&&(t.enabled=!0),Array.from(n.values()).sort((e,n)=>e.order-n.order)}function Ja(e){if(!e.productKey)throw new Error("[Pillar] productKey is required");return{productKey:e.productKey,apiBaseUrl:e.apiBaseUrl||Na,platform:e.platform||"web",version:e.version,debug:e.debug??!1,panel:{...Fa,...e.panel},edgeTrigger:{...Wa,...e.edgeTrigger},mobileTrigger:{...Va,...e.mobileTrigger},urlParams:{...Ka,...e.urlParams},textSelection:{...Xa,...e.textSelection},domScanning:{...Ya,...e.domScanning,interactionHighlight:{...Ya.interactionHighlight,...e.domScanning?.interactionHighlight}},suggestions:{...Za,...e.suggestions},sidebarTabs:Qa(e.sidebarTabs),theme:{mode:e.theme?.mode??Ga.mode,colors:{...e.theme?.colors},darkColors:{...e.theme?.darkColors},fontFamily:e.theme?.fontFamily},customCSS:e.customCSS,onReady:e.onReady,onError:e.onError}}class eo{_persistExternalUserId(e){if("undefined"!=typeof window)try{null===e?localStorage.removeItem(eo.EXTERNAL_USER_ID_STORAGE_KEY):localStorage.setItem(eo.EXTERNAL_USER_ID_STORAGE_KEY,e)}catch{}}_getStoredExternalUserId(){if("undefined"==typeof window)return null;try{return localStorage.getItem(eo.EXTERNAL_USER_ID_STORAGE_KEY)}catch{return null}}constructor(){this._state="uninitialized",this._config=null,this._api=null,this._textSelectionManager=null,this._pagePilotManager=null,this._panel=null,this._edgeTrigger=null,this._mobileTrigger=null,this._initPromise=null,this._rootContainer=null,this._unsubscribeHoverMode=null,this._context={...ka},this._userProfile={...Sa},this._externalUserId=null,this._taskHandlers=new Map,this._anyTaskHandler=null,this._registeredActions=new Map,this._cardRenderers=new Map,this._debugPanelContainer=null,this._routeObserver=null,this._suggestionPool=[],this._highlightedElement=null,this._highlightTimeout=null,this._fadeOutTimeout=null,this._originalStyles=null,this._events=new u}_createRootContainer(){let e=document.getElementById("pillar-root");if(e)return this._subscribeToHoverModeForRoot(e),e;e=document.createElement("div"),e.id="pillar-root";const n=Rn.value?"9999":"1000";return e.style.cssText=`isolation: isolate; z-index: ${n}; position: relative;`,document.body.appendChild(e),this._subscribeToHoverModeForRoot(e),e}_subscribeToHoverModeForRoot(e){this._unsubscribeHoverMode?.(),this._unsubscribeHoverMode=Rn.subscribe(n=>{e.style.zIndex=n?"9999":"1000"})}static async init(e){if(!e.productKey)throw new Error("[Pillar] productKey is required");return eo.instance||(eo.instance=new eo,Xr(eo.instance)),await eo.instance._init(e),eo.instance}static getInstance(){return eo.instance}static destroy(){eo.instance&&(eo.instance._destroy(),eo.instance=null,Xr(null))}get state(){return this._state}get isReady(){return"ready"===this._state}get isPanelOpen(){return yn.value}get config(){return this._config}get isDebugEnabled(){return this._config?.debug??!1}getDebugLog(){return this._config?.debug?o.getEntries():[]}onDebugLog(e){return o.subscribe(e)}clearDebugLog(){o.clear()}on(e,n){return this._events.on(e,n)}open(e){this._panel&&(this._panel.open(e),this._events.emit("panel:open"))}close(){this._panel&&(this._panel.close(),this._events.emit("panel:close"))}toggle(){this.isPanelOpen?this.close():this.open()}navigate(e,n){this._panel?.navigate(e,n),this._events.emit("panel:navigate",{view:e,params:n})}setContext(e){this._context={...this._context,...e},(e=>{Ca.value={...Ca.value,...e}})(e),this._events.emit("context:change",{context:this._context})}getChatContext(){const e=Qn.value,n=Jn.value;return 0===e.length?null:{conversationId:n,messages:e.map(e=>({role:e.role,content:e.content}))}}setTheme(e){this._config&&(this._config.theme={...this._config.theme,...e,mode:e.mode??this._config.theme.mode,colors:{...this._config.theme.colors,...e.colors},darkColors:{...this._config.theme.darkColors,...e.darkColors}},this._panel?.setTheme(this._config.theme),this._config.theme.colors.primary&&this._pagePilotManager?.setPrimaryColor(this._config.theme.colors.primary),this._events.emit("theme:change",{theme:this._config.theme}))}setTextSelectionEnabled(e){if(!this._config)return;this._config.textSelection.enabled!==e&&(this._config.textSelection.enabled=e,e?this._config.panel.enabled&&!this._textSelectionManager&&(this._textSelectionManager=new _a(this._config,this._events,()=>this.open()),this._textSelectionManager.init()):this._textSelectionManager&&(this._textSelectionManager.destroy(),this._textSelectionManager=null),this._events.emit("textSelection:change",{enabled:e}))}setDOMScanningEnabled(e){this._config&&(this._config.domScanning.enabled=e,this._events.emit("domScanning:change",{enabled:e}))}get isDOMScanningEnabled(){return this._config?.domScanning.enabled??!1}highlightElement(e){const n=this._config?.domScanning.interactionHighlight;if(!n?.enabled)return;this.clearHighlight(!0),n.scrollIntoView&&e.scrollIntoView({behavior:n.scrollBehavior,block:"center",inline:"nearest"}),this._originalStyles={outline:e.style.outline,outlineOffset:e.style.outlineOffset,transition:e.style.transition},this._highlightedElement=e;const t=e.style.transition,r="outline-color 0.3s ease-in-out";e.style.transition=t?`${t}, ${r}`:r,e.style.outline=`${n.outlineWidth}px solid transparent`,e.style.outlineOffset=`${n.outlineOffset}px`,e.offsetHeight,e.style.outline=`${n.outlineWidth}px solid ${n.outlineColor}`,p.log("[Pillar] Element highlighted with fade-in:",e.tagName),n.duration>0&&(this._highlightTimeout=setTimeout(()=>{this.clearHighlight()},n.duration))}clearHighlight(e=!1){if(this._highlightTimeout&&(clearTimeout(this._highlightTimeout),this._highlightTimeout=null),this._fadeOutTimeout&&(clearTimeout(this._fadeOutTimeout),this._fadeOutTimeout=null),this._highlightedElement&&this._originalStyles){const n=this._highlightedElement,t=this._originalStyles;e?(n.style.outline=t.outline,n.style.outlineOffset=t.outlineOffset,n.style.transition=t.transition,p.log("[Pillar] Highlight cleared immediately")):(n.style.outline=n.style.outline.replace(/[^,\s]+$/,"transparent"),this._fadeOutTimeout=setTimeout(()=>{n.style.outline=t.outline,n.style.outlineOffset=t.outlineOffset,n.style.transition=t.transition,p.log("[Pillar] Highlight fade-out complete"),this._fadeOutTimeout=null},300)),this._highlightedElement=null,this._originalStyles=null}}getElement(e){return document.querySelector(e)}clickElement(e){p.log("[Pillar] clickElement called with selector:",e);const n=this.getElement(e);if(p.log("[Pillar] clickElement found element:",n),n instanceof HTMLElement){p.log("[Pillar] clickElement clicking element:",n.tagName,n.textContent?.slice(0,50)),this.highlightElement(n);const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:r,button:0,buttons:1};return n.dispatchEvent(new MouseEvent("mousedown",i)),n.dispatchEvent(new MouseEvent("mouseup",i)),n.dispatchEvent(new MouseEvent("click",i)),p.log("[Pillar] clickElement full mouse sequence executed"),!0}return p.warn("[Pillar] clickElement element not found or not HTMLElement"),!1}typeInElement(e,n){p.log("[Pillar] typeInElement called with selector:",e,"text:",n);const t=this.getElement(e);if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){p.log("[Pillar] typeInElement found input/textarea:",t.tagName,t.type),this.highlightElement(t),t.focus();const e=t instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,r=Object.getOwnPropertyDescriptor(e,"value")?.set;return r?(r.call(t,n),p.log("[Pillar] typeInElement set value via native setter")):(t.value=n,p.log("[Pillar] typeInElement set value directly (fallback)")),t.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),t.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),t.dispatchEvent(new Event("change",{bubbles:!0})),p.log("[Pillar] typeInElement complete - events fired"),!0}return t instanceof HTMLElement&&"true"===t.getAttribute("contenteditable")?(p.log("[Pillar] typeInElement found contenteditable element"),this.highlightElement(t),t.focus(),t.textContent=n,t.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),t.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),p.log("[Pillar] typeInElement contenteditable complete"),!0):(p.warn("[Pillar] typeInElement element not found or not an input:",t),!1)}selectOption(e,n){p.log("[Pillar] selectOption called with selector:",e,"value:",n);const t=this.getElement(e);if(t instanceof HTMLSelectElement){p.log("[Pillar] selectOption found select element"),this.highlightElement(t),t.focus();const e=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;return e?(e.call(t,n),p.log("[Pillar] selectOption set value via native setter")):(t.value=n,p.log("[Pillar] selectOption set value directly (fallback)")),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})),p.log("[Pillar] selectOption complete"),!0}return p.warn("[Pillar] selectOption element not found or not a select:",t),!1}focusElement(e){p.log("[Pillar] focusElement called with selector:",e);const n=this.getElement(e);return n instanceof HTMLElement?(p.log("[Pillar] focusElement found element:",n.tagName),this.highlightElement(n),n.focus(),n.dispatchEvent(new FocusEvent("focusin",{bubbles:!0})),p.log("[Pillar] focusElement complete"),!0):(p.warn("[Pillar] focusElement element not found:",n),!1)}toggleElement(e){p.log("[Pillar] toggleElement called with selector:",e);const n=this.getElement(e);if(n instanceof HTMLInputElement&&("checkbox"===n.type||"radio"===n.type)){p.log("[Pillar] toggleElement found checkbox/radio:",n.type,"current checked:",n.checked),this.highlightElement(n),n.focus();const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:r,button:0,buttons:1};return n.dispatchEvent(new MouseEvent("mousedown",i)),n.dispatchEvent(new MouseEvent("mouseup",i)),n.dispatchEvent(new MouseEvent("click",i)),n.dispatchEvent(new Event("input",{bubbles:!0})),p.log("[Pillar] toggleElement complete - new checked:",n.checked),!0}return p.warn("[Pillar] toggleElement element not found or not checkbox/radio:",n),!1}async handlePageInteraction(e){if(p.log("[Pillar] handlePageInteraction called with params:",e),!Ei(e.ref))return p.warn("[Pillar] handlePageInteraction rejected invalid ref format:",e.ref),{success:!1,error:"Invalid ref format"};const n=zi(e.ref);p.log("[Pillar] handlePageInteraction built selector:",n);const t=this.getElement(n);if(!t)return p.warn("[Pillar] handlePageInteraction element not found for ref:",e.ref),{success:!1,error:"Element not found"};if(t.getAttribute("data-pillar-ref")!==e.ref)return p.warn("[Pillar] handlePageInteraction ref attribute mismatch"),{success:!1,error:"Ref attribute mismatch"};if(Si(t)){const n=t.textContent?.trim().slice(0,50)||t.getAttribute("aria-label")||e.operation;p.log("[Pillar] handlePageInteraction detected destructive element:",n);const{requestConfirmation:r}=await Promise.resolve().then(function(){return pi});if(!await r(`Agent wants to ${e.operation} "${n}"`))return p.log("[Pillar] handlePageInteraction destructive action denied by user"),{success:!1,error:"User denied destructive action"};p.log("[Pillar] handlePageInteraction destructive action confirmed by user")}let r;switch(e.operation){case"click":r={success:this.clickElement(n)};break;case"type":if(!e.value){r={success:!1,error:"value required for type operation"};break}r={success:this.typeInElement(n,e.value)};break;case"select":if(!e.value){r={success:!1,error:"value required for select operation"};break}r={success:this.selectOption(n,e.value)};break;case"focus":r={success:this.focusElement(n)};break;case"toggle":r={success:this.toggleElement(n)};break;default:r={success:!1,error:`Unknown operation: ${e.operation}`}}return p.log("[Pillar] handlePageInteraction result:",r),r}mountPanelTo(e){this._panel?.mountTo(e)}getPanelHostElement(){return this._panel?.getHostElement()??null}get context(){return{...this._context}}get userProfile(){return{...this._userProfile}}setUserProfile(e){this._userProfile={...e},Ea(this._userProfile),this._events.emit("profile:change",{profile:this._userProfile})}async identify(e,n,t){if(this._api)if(e)if(null===this._externalUserId||String(this._externalUserId)!==String(e))try{await this._api.identify(e,n),this._externalUserId=e,this._persistExternalUserId(e),this._userProfile={...this._userProfile,userId:e,...n?.name&&{name:n.name}},Ea(this._userProfile),this._api.setExternalUserId(e),t?.preserveConversation||lr(),nt.value+=1,this._events.emit("user:identified",{userId:e,profile:n})}catch(e){throw p.error("[Pillar] Failed to identify user:",e),e}else p.log("[Pillar] Already identified as this user, skipping");else p.warn("[Pillar] userId is required for identify()");else p.warn("[Pillar] SDK not initialized, cannot identify user")}logout(e){this._externalUserId=null,this._persistExternalUserId(null),this._userProfile={...Sa},Ea(this._userProfile),this._api?.clearExternalUserId(),e?.preserveConversation||lr(),nt.value+=1,this._events.emit("user:logout",{})}get externalUserId(){return this._externalUserId}get isIdentified(){return null!==this._externalUserId}reportAction(e,n){const t=[...(this._context.recentActions||[]).slice(-9),e];this._context={...this._context,recentActions:t},(e=>{const n=Ca.value.recentActions||[];Ca.value={...Ca.value,recentActions:[...n.slice(-9),e]}})(e),this._events.emit("action:report",{action:e,metadata:n})}clearErrorState(){if(this._context.errorState){const{errorState:e,...n}=this._context;this._context=n,(()=>{const{errorState:e,...n}=Ca.value;Ca.value=n})(),this._events.emit("context:change",{context:this._context})}}setErrorState(e,n){this._context={...this._context,errorState:{code:e,message:n}},((e,n)=>{Ca.value={...Ca.value,errorState:{code:e,message:n}}})(e,n),this._events.emit("context:change",{context:this._context})}async getSuggestions(){if(!this._api)return p.warn("[Pillar] SDK not initialized, cannot get suggestions"),[];try{return await this._api.getSuggestions(this._context,this._userProfile)}catch(e){return p.error("[Pillar] Failed to get suggestions:",e),[]}}getAssistantContext(){return{product:this._context,user:this._userProfile}}onTask(e,n){return this._taskHandlers.set(e,n),()=>this._taskHandlers.delete(e)}registerAction(e){const{name:n,...t}=e;n?(this._registeredActions.set(n,{name:n,...t,returns:t.returnsData||t.returns||!1,autoRun:t.autoRun??t.auto_run??!1,autoComplete:t.autoComplete??t.auto_complete??!0}),p.log(`[Pillar] Registered action: ${n}`)):p.warn("[Pillar] registerAction called without a name")}getRegisteredAction(e){return this._registeredActions.get(e)}getHandler(e){const n=b(e)?v(e):void 0;if(n?.handler)return n.handler;const t=this._taskHandlers.get(e);return t||void 0}onAnyTask(e){return this._anyTaskHandler=e,()=>{this._anyTaskHandler=null}}offTask(e){this._taskHandlers.delete(e)}executeTask(e){const{name:n,data:t,taskType:r,path:i,externalUrl:l}=e;if(this._events.emit("task:execute",e),this._anyTaskHandler)try{this._anyTaskHandler(n,t)}catch(e){p.error("[Pillar] Error in onAnyTask handler:",e)}const a=b(n)?v(n):void 0,s=this._registeredActions.get(n),c=a?.handler,d=this._taskHandlers.get(n),u=r?this._taskHandlers.get(r):void 0,h=c||d||u,g=a?.returns||s?.returns;if(h){const e=performance.now();o.add({event:"handler:execute",data:{action:n,taskType:r,params:t},source:"handler",level:"info"});try{const l=h("navigate"===r&&i?{...t,path:i}:t);if(g&&void 0!==l)Promise.resolve(l).then(async r=>{const i=Math.round(performance.now()-e);if(void 0!==r){await this.sendActionResult(n,r);let e=!0;if(r&&"object"==typeof r&&!Array.isArray(r)){!1===r.success&&(e=!1)}o.add({event:"handler:complete",data:{action:n,duration:i,success:e,returnsData:!0},source:"handler",level:e?"info":"warn"}),this._events.emit("task:complete",{name:n,success:e,data:r})}else o.add({event:"handler:complete",data:{action:n,duration:i,success:!0},source:"handler",level:"info"}),this._events.emit("task:complete",{name:n,success:!0,data:t})}).catch(r=>{const i=Math.round(performance.now()-e);o.add({event:"handler:error",data:{action:n,duration:i,error:r instanceof Error?r.message:String(r)},source:"handler",level:"error"}),p.error(`[Pillar] Error in query action "${n}":`,r),this._events.emit("task:complete",{name:n,success:!1,data:t})});else{const r=Math.round(performance.now()-e);o.add({event:"handler:complete",data:{action:n,duration:r,success:!0},source:"handler",level:"info"}),this._events.emit("task:complete",{name:n,success:!0,data:t})}}catch(r){const i=Math.round(performance.now()-e);o.add({event:"handler:error",data:{action:n,duration:i,error:r instanceof Error?r.message:String(r)},source:"handler",level:"error"}),p.error(`[Pillar] Error executing task "${n}":`,r),this._events.emit("task:complete",{name:n,success:!1,data:t})}}else switch(r){case"navigate":i&&"undefined"!=typeof window&&(p.warn("[Pillar] No 'navigate' handler registered. Using window.location.href as fallback."),window.location.href=i,this._events.emit("task:complete",{name:n,success:!0,data:t}));break;case"external_link":l&&"undefined"!=typeof window&&(window.open(l,"_blank","noopener,noreferrer"),this._events.emit("task:complete",{name:n,success:!0,data:t}));break;case"copy_text":t.text&&"undefined"!=typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(String(t.text)).then(()=>{this._events.emit("task:complete",{name:n,success:!0,data:t})}).catch(()=>{this._events.emit("task:complete",{name:n,success:!1,data:t})});break;default:p.warn(`[Pillar] No handler registered for task "${n}". Register one with pillar.onTask('${n}', handler)`),this._events.emit("task:complete",{name:n,success:!1,data:{error:"No handler registered"}})}}completeTask(e,n=!0,t){this._events.emit("task:complete",{name:e,success:n,data:t})}async completeAction(e,n=!0,t){this._events.emit("task:complete",{name:e,success:n,data:t})}confirmTaskExecution(e,n,t){e?this._api?this._api.confirmTaskExecution(e,n,t):p.warn("[Pillar] SDK not initialized, cannot confirm task execution"):p.warn("[Pillar] confirmTaskExecution called without taskId")}registerCard(e,n){return this._cardRenderers.set(e,n),()=>this._cardRenderers.delete(e)}getCardRenderer(e){return this._cardRenderers.get(e)}hasCardRenderer(e){return this._cardRenderers.has(e)}get workflow(){return za.value}startWorkflow(e){!function(e){za.value&&(Ta.value=[...Ta.value,za.value]);const n=e.steps.map((e,n)=>0===n?{...e,status:e.auto_run?"active":"awaiting_initiation"}:{...e,status:"pending"});za.value={...e,steps:n,current_step:0}}(e),this._events.emit("workflow:start",za.value);const n=za.value.steps[0];n.auto_run&&this._executeWorkflowStep(n)}initiateWorkflowStep(e){const n=za.value;if(!n)return void p.warn("[Pillar] No active workflow");const t=e??n.current_step,r=n.steps[t];r?"awaiting_initiation"===r.status?this._executeWorkflowStep(r):p.warn(`[Pillar] Step ${t} is not awaiting initiation`):p.warn(`[Pillar] Invalid step index: ${t}`)}confirmWorkflowStep(e,n){const t=za.value;if(!t)return;const r=n??t.current_step;if(t.steps[r],Ma(r,e?"completed":"failed"),this._events.emit("workflow:step:complete",{workflow:za.value,step:za.value.steps[r],success:e}),!e)return;const i=Ra();if(!i)return this._events.emit("workflow:complete",za.value),void $a();this._events.emit("workflow:step:active",{workflow:za.value,step:i}),i.auto_run&&this._executeWorkflowStep(i)}skipWorkflowStep(e){const n=za.value;if(!n)return;const t=e??n.current_step;n.steps[t],Ma(t,"skipped"),this._events.emit("workflow:step:skip",{workflow:za.value,step:za.value.steps[t]});const r=Ra();if(!r)return this._events.emit("workflow:complete",za.value),void $a();this._events.emit("workflow:step:active",{workflow:za.value,step:r}),r.auto_run&&this._executeWorkflowStep(r)}cancelWorkflow(){const e=za.value;e&&(this._events.emit("workflow:cancel",e),function(){if(!za.value)return null;const e=za.value;za.value=null}())}_executeWorkflowStep(e){Ma(e.index,"active"),this.executeTask({id:e.task_id,name:e.task_name,taskType:e.task_type,data:e.data,path:e.data?.path,externalUrl:e.data?.url}),e.auto_complete&&setTimeout(()=>{this.confirmWorkflowStep(!0,e.index)},100)}async sendActionResult(e,n,t){this._api?(p.log(`[Pillar] Sending action result for "${e}" (tool_call_id: ${t}):`,n),await this._api.mcp.sendActionResult(e,n,t),this._events.emit("action:result",{actionName:e,result:n,toolCallId:t})):p.warn("[Pillar] SDK not initialized, cannot send action result")}async executeQueryAction(e,n={},t){const r=performance.now();if(!e||"string"!=typeof e||""===e.trim())return void p.error("[Pillar] executeQueryAction called with missing or invalid actionName:",e);if(p.log(`[Pillar] Starting query action "${e}"`,n),t?.properties){const r=this._validateQueryParams(n,t);if(r)return p.error(`[Pillar] Query param validation failed: ${r}`),void await this.sendActionResult(e,{success:!1,error:r})}const i=b(e)?v(e):void 0;this._registeredActions.get(e);const l=i?.handler,a=this._taskHandlers.get(e),s=this._taskHandlers.get("query"),c=l||a||s;if(!c)return p.error(`[Pillar] No handler registered for query action "${e}". Register one with: pillar.onTask('${e}', async (data) => { ... return result; })`),void await this.sendActionResult(e,{error:`No handler registered for action "${e}"`,success:!1});o.add({event:"handler:execute",data:{action:e,type:"query",params:n},source:"handler",level:"info"});try{const t=performance.now(),i=await Promise.resolve(c(n)),l=Math.round(performance.now()-t);if(p.log(`[Pillar] Query action "${e}" handler completed in ${l}ms`,i),void 0!==i){o.add({event:"handler:complete",data:{action:e,duration:l,success:!0,returnsData:!0},source:"handler",level:"info"}),await this.sendActionResult(e,i);const n=Math.round(performance.now()-r);p.log(`[Pillar] Query action "${e}" total time: ${n}ms`)}else o.add({event:"handler:complete",data:{action:e,duration:l,success:!1,error:"returned undefined"},source:"handler",level:"warn"}),p.warn(`[Pillar] Query action "${e}" returned undefined. Make sure your handler returns data for the agent.`),await this.sendActionResult(e,{error:"Handler returned undefined",success:!1})}catch(n){const t=Math.round(performance.now()-r);o.add({event:"handler:error",data:{action:e,duration:t,error:n instanceof Error?n.message:String(n)},source:"handler",level:"error"}),p.error(`[Pillar] Error executing query action "${e}" after ${t}ms:`,n),await this.sendActionResult(e,{error:n instanceof Error?n.message:String(n),success:!1})}}_validateQueryParams(e,n){const t=n.properties||{},r=n.required||[],i=Object.keys(t),l=r.filter(n=>!(n in e));if(l.length>0)return`Missing required parameters: ${l.join(", ")}. Expected: ${i.join(", ")}`;const a=Object.keys(e).filter(e=>!(e in t));return a.length>0?`Unknown parameters: ${a.join(", ")}. Expected: ${i.join(", ")}`:null}async _init(e){if("initializing"===this._state&&this._initPromise)return p.log("[Pillar] Already initializing, waiting for completion"),void await this._initPromise;"ready"!==this._state?(this._state="initializing",this._initPromise=this._doInit(e),await this._initPromise):p.log("[Pillar] Already initialized")}async _doInit(e){try{e.debug&&(n(!0),o.add({event:"sdk:init:start",data:{productKey:e.productKey,debug:!0},source:"sdk",level:"info"})),await new Promise(e=>{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>e(),{once:!0}):e()});const r=Ja(e),i=new C(r),l=function(e,n){if(!n)return e;const t={...e};return n.panel&&(t.panel={...n.panel,...e.panel}),n.theme?.colors?.primary&&(t.theme={...t.theme,colors:{primary:e.theme?.colors?.primary??n.theme.colors.primary,...e.theme?.colors}}),t}(e,await i.fetchEmbedConfig().catch(e=>(p.warn("[Pillar] Failed to fetch server config, using local config only:",e),null)));this._config=Ja(l),this._config.platform&&this._config.version&&g(this._config.platform,this._config.version),this._api=new C(this._config);const a=this._getStoredExternalUserId();a&&(this._externalUserId=a,this._api.setExternalUserId(a),p.log("[Pillar] Restored external user ID from localStorage")),p.configure(this._api.mcp,{forwardToServer:!0}),this._config.debug&&this._setupDebugEventCapture(),this._rootContainer=this._createRootContainer(),t=this._config.mobileTrigger.breakpoint,zn.value=t,(e=>{Tn.value=e})(this._config.panel.fullWidthBreakpoint),this._config.panel.enabled&&(this._panel=new fa(this._config,this._api,this._events,this._rootContainer),await this._panel.init()),this._config.edgeTrigger.enabled&&(this._edgeTrigger=new Nn(this._config,this._events,()=>this.toggle(),this._rootContainer),this._edgeTrigger.init()),this._config.mobileTrigger.enabled&&(this._mobileTrigger=new Kn(this._config,this._events,()=>this.toggle(),this._rootContainer),this._mobileTrigger.init()),this._config.textSelection.enabled&&this._config.panel.enabled&&(this._textSelectionManager=new _a(this._config,this._events,()=>this.open()),this._textSelectionManager.init()),this._pagePilotManager=new wa,this._pagePilotManager.init(this._config.theme.colors.primary,this._config.theme.mode),this._state="ready",this._events.emit("ready"),this._config.onReady?.(),p.log("[Pillar] SDK initialized successfully"),this._config.debug&&this._mountDebugPanel(),this._config.suggestions.enabled&&this._initSuggestions().catch(e=>{p.warn("[Pillar] Background suggestions init failed:",e)}),await this._recoverSession(),this._config.urlParams.enabled&&await this._handleUrlParams(),this._config.panel.initialOpen&&!yn.value&&(this.open(),p.log("[Pillar] Panel auto-opened via initialOpen config")),await this._restoreConversation()}catch(e){this._state="error";const n=e instanceof Error?e:new Error(String(e));throw this._events.emit("error",n),this._config?.onError?.(n),p.error("[Pillar] Failed to initialize:",e),e}var t}async _recoverSession(){if(!this._config||!this._api)return void p.warn("[Pillar] _recoverSession skipped: config or api not available");const e=this._config.productKey;p.log("[Pillar] Checking for saved session hint with siteId:",e);const{loadActiveSession:n,clearActiveSession:t}=await Promise.resolve().then(function(){return hi}),{setInterruptedSession:r,setConversationId:i}=await Promise.resolve().then(function(){return hr}),l=n(e);if(l){p.log("[Pillar] Found saved session hint, checking with server...");try{const n=await this._api.mcp.getConversationStatus(l.conversationId);if(!n||!n.resumable)return p.log("[Pillar] Session is no longer resumable, clearing hint"),void t(e);p.log("[Pillar] Session is resumable, setting up resume state"),i(l.conversationId),r({conversationId:l.conversationId,userMessage:n.user_message??"",partialResponse:n.partial_response??"",displayTrace:n.display_trace??[],elapsedMs:n.elapsed_ms??0}),p.log("[Pillar] Resume state set up successfully")}catch(n){p.warn("[Pillar] Failed to check session status:",n),t(e)}}else p.log("[Pillar] No saved session found for siteId:",e)}async _restoreConversation(){if(!this._api)return;const{getStoredConversationId:e,messages:n,loadConversation:t,isLoadingHistory:r,interruptedSession:i,setInterruptedSession:l}=await Promise.resolve().then(function(){return hr}),{navigate:a,currentView:o}=await Promise.resolve().then(function(){return kr}),s=e();if(s&&!(n.value.length>0)){p.log("[Pillar] Restoring conversation from localStorage:",s);try{r.value=!0,"chat"!==o.value.type&&a("chat");const e=await this._api.getConversation(s);if(e&&e.messages.length>0){let n=e.messages;const a=n[n.length-1],o="assistant"===a.role&&!a.content?.trim();if(o&&(p.log("[Pillar] Stripped trailing empty assistant message from restored conversation"),n=n.slice(0,-1)),n.length>0?t(e.id,n):r.value=!1,o&&!i.value&&this._api.mcp){p.log("[Pillar] Checking conversation status as fallback for resume...");try{const e=await this._api.mcp.getConversationStatus(s);e&&e.resumable&&(p.log("[Pillar] Fallback: session is resumable, setting up resume state"),l({conversationId:s,userMessage:e.user_message??"",partialResponse:e.partial_response??"",displayTrace:e.display_trace??[],elapsedMs:e.elapsed_ms??0}))}catch(e){p.warn("[Pillar] Fallback resume check failed:",e)}}}else r.value=!1}catch(e){p.warn("[Pillar] Failed to restore conversation:",e),r.value=!1}}}async _handleUrlParams(){if(!this._config)return;(function(e=qa){if("undefined"==typeof window||!window.location)return{};const n=new URLSearchParams(window.location.search),t={};n.has(`${e}open`)&&(t.open=!0);const r=n.get(`${e}article`);r&&(t.article=r);const i=n.get(`${e}article-id`);i&&!t.article&&(t.article=i);const l=n.get(`${e}category`);l&&(t.category=l);const a=n.get(`${e}search`);return a&&(t.search=a),t})(this._config.urlParams.prefix).open&&(this.open(),this._config.urlParams.clearAfterOpen&&function(e=qa){if("undefined"==typeof window||!window.location||!window.history)return;const n=new URL(window.location.href),t=[`${e}open`,`${e}article`,`${e}article-id`,`${e}category`,`${e}search`];let r=!1;for(const e of t)n.searchParams.has(e)&&(n.searchParams.delete(e),r=!0);r&&window.history.replaceState({},"",n.toString())}(this._config.urlParams.prefix))}_mountDebugPanel(){this._debugPanelContainer=document.createElement("div"),this._debugPanelContainer.id="pillar-debug-panel-root",document.body.appendChild(this._debugPanelContainer),ue(W(Ua,null),this._debugPanelContainer),o.add({event:"debug:panel:mounted",source:"sdk",level:"info"})}_setupDebugEventCapture(){this._events.on("task:execute",e=>{o.add({event:"task:execute",data:{name:e.name,taskType:e.taskType},source:"sdk",level:"info"})}),this._events.on("task:complete",e=>{o.add({event:"task:complete",data:{name:e.name,success:e.success},source:"sdk",level:e.success?"info":"error"})}),this._events.on("action:result",e=>{o.add({event:"action:result",data:{actionName:e.actionName,hasResult:!!e.result},source:"sdk",level:"info"})}),this._events.on("ready",()=>{o.add({event:"sdk:ready",source:"sdk",level:"info"})}),this._events.on("error",e=>{o.add({event:"sdk:error",data:{message:e.message},source:"sdk",level:"error"})}),p.log("[Pillar] Debug event capture enabled")}async _initSuggestions(){if(this._api&&this._config){p.log("[Pillar] Initializing page-aware suggestions"),Dr(!0);try{const e=await this._api.getSuggestedQuestions();p.log(`[Pillar] Fetched ${e.length} suggestions for pool`),this._suggestionPool=e,function(e){Mr.value=e}(e),this._routeObserver=new Aa({debounceMs:this._config.suggestions.debounceMs}),this._routeObserver.onRouteChange(e=>{this._handleRouteChange(e)}),this._routeObserver.start();const n=this._routeObserver.getCurrentRoute();this._handleRouteChange(n),Dr(!1)}catch(e){p.error("[Pillar] Failed to initialize suggestions:",e),function(e){Ar.value=e,$r.value=!1}(e instanceof Error?e.message:String(e)),Dr(!1)}}}_handleRouteChange(e){if(!this._config)return;const{pathname:n,title:t}=e,r=this._config.suggestions.displayLimit;p.log(`[Pillar] Route changed to: ${n}, sorting suggestions`);const i=Hr(this._suggestionPool,n,t,r);!function(e,n){Rr.value=e,Lr.value=n}(i,n),this._events.emit("suggestions:updated",{suggestions:i.map(e=>({id:e.id,text:e.text})),route:n}),p.log(`[Pillar] Sorted ${i.length} suggestions for page`)}_destroy(){this._routeObserver?.stop(),this._routeObserver=null,this._suggestionPool=[],Mr.value=[],Rr.value=[],$r.value=!1,Ar.value=null,Lr.value=null,this._textSelectionManager?.destroy(),this._pagePilotManager?.destroy(),this._panel?.destroy(),this._edgeTrigger?.destroy(),this._mobileTrigger?.destroy(),this._api?.cancelAllRequests(),this._events.removeAllListeners(),this._unsubscribeHoverMode?.(),this._unsubscribeHoverMode=null,this._rootContainer?.remove(),this._rootContainer=null,this._debugPanelContainer&&(ue(null,this._debugPanelContainer),this._debugPanelContainer.remove(),this._debugPanelContainer=null),Dn(),yr(),lr(),Ca.value={...ka},Pa.value={...Sa},za.value=null,Ta.value=[],this._context={...ka},this._userProfile={...Sa},this._taskHandlers.clear(),this._anyTaskHandler=null,this._textSelectionManager=null,this._pagePilotManager=null,this._panel=null,this._edgeTrigger=null,this._mobileTrigger=null,this._api=null,this._config=null,this._state="uninitialized",p.log("[Pillar] SDK destroyed")}}eo.instance=null,eo.EXTERNAL_USER_ID_STORAGE_KEY="pillar:external_user_id";var no=Object.freeze({__proto__:null,Pillar:eo,getApiClient:Zr});if("undefined"!=typeof window){window.Pillar=eo;const e=()=>{const e=document.currentScript;e?.dataset.productKey&&eo.init({productKey:e.dataset.productKey}).catch(p.error)};if("loading"===document.readyState)document.addEventListener("DOMContentLoaded",e);else{const e=document.querySelectorAll("script[data-product-key]");if(e.length>0){const n=e[e.length-1];n.dataset.productKey&&eo.init({productKey:n.dataset.productKey}).catch(p.error)}}}export{C as APIClient,gi as DEFAULT_SCAN_OPTIONS,Ba as DEFAULT_SIDEBAR_TABS,u as EventEmitter,fi as INTERACTABLE_ROLES,mi as INTERACTABLE_TAGS,eo as Pillar,vi as SKIP_TAGS,zi as buildSelectorFromRef,_i as clearPillarRefs,y as clearRegistry,eo as default,Xn as generateContextId,w as getActionCount,v as getActionDefinition,_ as getActionNames,m as getClientInfo,Gn as getContextDisplayLabel,f as getHandler,x as getManifest,b as hasAction,Zn as isDOMSnapshotContext,Si as isDestructiveElement,Yn as isHighlightedTextContext,Ci as isInteractable,wi as isRedacted,Ei as isValidPillarRef,Ri as scanPageDirect,g as setClientInfo};
|
|
1
|
+
let e=!1;function n(n){e=n,console.log("[Pillar] Debug mode enabled - verbose logging active")}function t(){return e||r()}const r=()=>{if("undefined"!=typeof process&&process.env?.NODE_ENV)return"development"===process.env.NODE_ENV;if("undefined"!=typeof window){const e=window.location?.hostname||"";return"localhost"===e||"127.0.0.1"===e||e.includes(".local")}return!1},i=["[Pillar]","[MCPClient]","[PlanExecutor]"],l=["sdk","handler","network"];class a{constructor(e,n=5e3){this.buffer=[],this.flushTimer=null,this.maxBufferSize=100,this.handleBeforeUnload=()=>{this.flush()},this.mcpClient=e,this.flushIntervalMs=n,this.startFlushTimer(),this.setupUnloadListener()}shouldForward(e){return!!l.includes(e.source)||(!(!e.prefix||!i.some(n=>e.prefix?.startsWith(n)))||"error"===e.level)}bufferEntry(e){const n={level:"info"===e.level?"log":e.level,message:e.prefix?`${e.prefix} ${e.event}`:`[${e.source}] ${e.event}`,data:e.data,timestamp:new Date(e.timestamp).toISOString()};this.buffer.push(n),this.buffer.length>=this.maxBufferSize&&this.flush(),"error"===e.level&&this.flush()}flush(){if(0===this.buffer.length)return;const e=this.buffer.splice(0);this.mcpClient.sendLogBatch(e)}startFlushTimer(){this.flushTimer||(this.flushTimer=setInterval(()=>this.flush(),this.flushIntervalMs))}stopFlushTimer(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}setupUnloadListener(){"undefined"!=typeof window&&window.addEventListener("beforeunload",this.handleBeforeUnload)}removeUnloadListener(){"undefined"!=typeof window&&window.removeEventListener("beforeunload",this.handleBeforeUnload)}destroy(){this.stopFlushTimer(),this.removeUnloadListener(),this.flush(),this.buffer=[]}}const o=new class{constructor(){this.entries=[],this.maxEntries=500,this.listeners=new Set,this.serverForwarder=null,this.forwarderUnsubscribe=null}add(e){const n={...e,timestamp:Date.now()};this.entries.push(n),this.entries.length>this.maxEntries&&(this.entries=this.entries.slice(-this.maxEntries)),this.listeners.forEach(e=>e(this.entries)),t()&&!e.prefix&&this.logToConsole(n),this.serverForwarder?.shouldForward(n)&&this.serverForwarder.bufferEntry(n)}logToConsole(e){const n=`[${new Date(e.timestamp).toISOString().split("T")[1].slice(0,12)}] [${e.source}]`,t=void 0!==e.data?[n,e.event,e.data]:[n,e.event];"error"===e.level?console.error(...t):"warn"===e.level?console.warn(...t):console.log(...t)}enableServerForwarding(e,n){this.disableServerForwarding(),this.serverForwarder=new a(e,n?.flushIntervalMs)}disableServerForwarding(){this.serverForwarder&&(this.serverForwarder.destroy(),this.serverForwarder=null),this.forwarderUnsubscribe&&(this.forwarderUnsubscribe(),this.forwarderUnsubscribe=null)}flush(){this.serverForwarder?.flush()}getEntries(){return[...this.entries]}clear(){this.entries=[],this.listeners.forEach(e=>e(this.entries))}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.disableServerForwarding(),this.entries=[],this.listeners.clear()}};function s(e){if(0===e.length)return{event:""};const n=e[0];let t,r,i=[];"string"==typeof n&&n.startsWith("[")&&n.endsWith("]")&&(t=n,e=e.slice(1));for(const n of e)"string"==typeof n?i.push(n):"object"==typeof n&&null!==n&&(r=n);return{prefix:t,event:i.join(" "),data:r}}function p(e){return e?e.includes("MCPClient")?"network":(e.includes("PlanExecutor"),"sdk"):"sdk"}const c={configure:(e,n)=>{!1!==n?.forwardToServer&&o.enableServerForwarding(e,{flushIntervalMs:n?.flushIntervalMs})},flush:()=>{o.flush()},log:(...e)=>{if(!t())return;const{prefix:n,event:r,data:i}=s(e);console.log(...e),o.add({event:r,data:i,source:p(n),level:"info",prefix:n})},warn:(...e)=>{if(!t())return;const{prefix:n,event:r,data:i}=s(e);console.warn(...e),o.add({event:r,data:i,source:p(n),level:"warn",prefix:n})},error:(...e)=>{const{prefix:n,event:t,data:r}=s(e);console.error(...e),o.add({event:t,data:r,source:p(n),level:"error",prefix:n})},destroy:()=>{o.destroy()}};var d=Object.freeze({__proto__:null,debug:c,debugLog:o,isDebugEnabled:t,setDebugMode:n});class u{constructor(){this.listeners=new Map}on(e,n){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(n),()=>{this.off(e,n)}}off(e,n){const t=this.listeners.get(e);t&&t.delete(n)}emit(e,n){const t=this.listeners.get(e);t&&t.forEach(t=>{try{t(n)}catch(n){c.error(`[Pillar] Error in event handler for "${e}":`,n)}})}removeAllListeners(e){e?this.listeners.delete(e):this.listeners.clear()}}const h={actions:new Map,clientInfo:null};function g(e,n){h.clientInfo={platform:e,version:n}}function m(){return h.clientInfo}function f(e){const n=h.actions.get(e);return n?.handler}function v(e){return h.actions.get(e)}function b(e){return h.actions.has(e)}function _(){return Array.from(h.actions.keys())}function x(e,n,t){const r=[];for(const[e,n]of h.actions){const t={name:e,description:n.description,type:n.type};n.examples?.length&&(t.examples=n.examples),n.path&&(t.path=n.path),n.externalUrl&&(t.external_url=n.externalUrl),n.autoRun&&(t.auto_run=n.autoRun),n.autoComplete&&(t.auto_complete=n.autoComplete),n.returns&&(t.returns_data=n.returns),n.dataSchema&&(t.data_schema=n.dataSchema),n.defaultData&&(t.default_data=n.defaultData),n.requiredContext&&(t.required_context=n.requiredContext),r.push(t)}return{platform:e,version:n,gitSha:t,generatedAt:(new Date).toISOString(),actions:r}}function y(){h.actions.clear(),h.clientInfo=null}function w(){return h.actions.size}class k{constructor(e){this.requestId=0,this._externalUserId="",this.config=e}setExternalUserId(e){this._externalUserId=e}getVisitorId(){if("undefined"==typeof window)return"";const e="pillar_visitor_id";try{let n=localStorage.getItem(e);return n||(n=crypto.randomUUID(),localStorage.setItem(e,n)),n}catch{return""}}getSessionId(){if("undefined"==typeof window)return"";const e="pillar_mcp_session_id";try{let n=sessionStorage.getItem(e);return n||(n=crypto.randomUUID(),sessionStorage.setItem(e,n)),n}catch{return""}}getPageUrl(){return"undefined"==typeof window?"":window.location.href}get baseUrl(){return`${this.config.apiBaseUrl}/mcp/`}get headers(){const e={"Content-Type":"application/json","x-customer-id":this.config.productKey,"x-visitor-id":this.getVisitorId(),"x-page-url":this.getPageUrl()},n=this.getSessionId();return n&&(e["Mcp-Session-Id"]=n),this._externalUserId&&(e["x-external-user-id"]=this._externalUserId),"undefined"!=typeof navigator&&(e["Accept-Language"]=navigator.language||navigator.languages?.[0]||"en"),this.config.platform&&(e["X-Pillar-Platform"]=this.config.platform),this.config.version&&(e["X-Pillar-Action-Version"]=this.config.version),e}nextId(){return++this.requestId}async callTool(e,n){const t=performance.now(),r={jsonrpc:"2.0",id:this.nextId(),method:"tools/call",params:{name:e,arguments:n}};o.add({event:"network:request",data:{method:"tools/call",tool:e,url:this.baseUrl},source:"network",level:"info"});const i=await fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(r)}),l=Math.round(performance.now()-t);if(!i.ok){const e=await i.json().catch(()=>({}));throw o.add({event:"network:response",data:{status:i.status,duration:l,error:e.error?.message},source:"network",level:"error"}),new Error(e.error?.message||`MCP error: ${i.status}`)}const a=await i.json();if(o.add({event:"network:response",data:{status:i.status,duration:l,method:"tools/call",tool:e},source:"network",level:"info"}),a.error)throw new Error(a.error.message);return a.result}async callToolStream(e,n,t,r){const i=performance.now(),l=this.nextId();t.onRequestId?.(l);const a={jsonrpc:"2.0",id:l,method:"tools/call",params:{name:e,arguments:n,stream:!0}};o.add({event:"network:request",data:{method:"tools/call",tool:e,stream:!0,url:this.baseUrl},source:"network",level:"info"});const s=await fetch(this.baseUrl,{method:"POST",headers:{...this.headers,Accept:"text/event-stream"},body:JSON.stringify(a),signal:r}),p=Math.round(performance.now()-i);if(!s.ok){const e=await s.text();throw o.add({event:"network:response",data:{status:s.status,duration:p,error:e},source:"network",level:"error"}),new Error(`MCP streaming request failed: ${s.statusText} - ${e}`)}if(o.add({event:"network:stream:connected",data:{status:s.status,connectionTime:p,tool:e},source:"network",level:"info"}),!s.body)throw new Error("Response body is null");const d=s.body.getReader(),u=new TextDecoder;let h="",g=[],m=null;try{for(;;){const{done:e,value:n}=await d.read();if(e)break;h+=u.decode(n,{stream:!0});const r=h.split("\n");h=r.pop()||"";for(const e of r)if(e.trim()&&e.startsWith("data: "))try{const n=e.substring(6),r=JSON.parse(n);if("2.0"===r.jsonrpc){if(r.error)throw t.onError?.(r.error.message||"Unknown error"),new Error(r.error.message);if("notifications/progress"===r.method){const e=r.params?.progress;if(e){if("debug"===e.type){o.add({event:e.event||"server:event",data:e.data,source:"server",level:"info"});continue}if("progress"===e.type&&e.data){const n=e.data;c.log(`[MCPClient] Progress event (new schema): ${n.kind}`,n),t.onProgress?.({kind:n.kind,id:n.id,label:n.label,status:n.status,text:n.text,children:n.children,metadata:n.metadata});continue}if("token"!==e.kind&&"token"!==e.type&&(console.log(`[MCPClient] Progress event: kind=${e.kind} type=${e.type}`,e),c.log(`[MCPClient] Progress event: ${e.kind}`,e)),"token"===e.kind&&e.token)g.push(e.token),t.onToken?.(e.token);else if("conversation_started"===e.kind)t.onConversationStarted?.(e.conversation_id,e.assistant_message_id);else if("token_usage"===e.kind)t.onTokenUsage?.({prompt_tokens:e.prompt_tokens,completion_tokens:e.completion_tokens,total_prompt_tokens:e.total_prompt_tokens,total_completion_tokens:e.total_completion_tokens,total_used:e.total_used,context_window:e.context_window,occupancy_pct:e.occupancy_pct,model_name:e.model_name,iteration:e.iteration});else{if("cancelled"===e.kind)break;if("action_request"===e.kind||"action_request"===e.type){if(console.log("[MCPClient] *** RECEIVED action_request ***",e.action_name,e.parameters),c.log("[MCPClient] Received action_request:",e.action_name,e.parameters),!e.action_name||"string"!=typeof e.action_name||""===e.action_name.trim()){console.error("[MCPClient] action_request INVALID - missing action_name:",e),c.error("[MCPClient] Received action_request with missing or invalid action_name:",e);continue}if(t.onActionRequest){console.log("[MCPClient] *** CALLING onActionRequest handler ***"),e.tool_call_id||(console.warn("[MCPClient] action_request missing tool_call_id - result correlation may fail"),c.warn("[MCPClient] action_request missing tool_call_id for action:",e.action_name));const n={action_name:e.action_name,parameters:e.parameters||{},action:e.action,tool_call_id:e.tool_call_id};t.onActionRequest(n).catch(e=>{console.error("[MCPClient] Action request handler FAILED:",e),c.error("[MCPClient] Action request handler failed:",e)})}else console.warn("[MCPClient] action_request received but NO HANDLER registered"),c.warn("[MCPClient] Received action_request but no handler registered")}else t.onProgress?.({kind:e.kind,id:e.id,label:e.label,status:e.status,text:e.text||e.content,children:e.children,message:e.message,progress_id:e.progress_id,metadata:{sources:e.sources||e.metadata?.sources,result_count:e.result_count??e.metadata?.result_count,query:e.query||e.metadata?.query,action_name:e.action_name||e.metadata?.action_name,no_sources_used:e.no_sources_used??e.metadata?.no_sources_used}})}}}if(r.result&&r.id===l){m=r.result,m.structuredContent?.sources&&t.onSources?.(m.structuredContent.sources),m.structuredContent?.actions&&t.onActions?.(m.structuredContent.actions),m.structuredContent?.registered_actions&&t.onRegisteredActions?.(m.structuredContent.registered_actions);const e=m._meta?.conversation_id,n=m._meta?.query_log_id;t.onComplete?.(e,n)}}}catch(n){c.error("[MCPClient] Failed to parse event:",n,e)}}}catch(e){if("AbortError"===e.name)throw e;const n=e instanceof Error?e.message:"Stream reading failed";throw t.onProgress?.({kind:"error",id:"stream-error",label:"Connection interrupted",status:"error",text:n,metadata:{error:n}}),t.onError?.(n),e}finally{d.releaseLock();const n=Math.round(performance.now()-i);o.add({event:"network:stream:complete",data:{duration:n,tool:e},source:"network",level:"info"})}return m||(m={content:[{type:"text",text:g.join("")}],isError:!1}),m}async uploadImage(e){const n=`${this.config.apiBaseUrl}/mcp/upload-image/`,t=new FormData;t.append("image",e);const r=await fetch(n,{method:"POST",headers:{"x-customer-id":this.config.productKey},body:t});if(!r.ok){const e=await r.json().catch(()=>({error:"Upload failed"}));throw new Error(e.error||"Upload failed")}return r.json()}async ask(e,n,t){const r={query:e};return t?.conversationId&&(r.conversation_id=t.conversationId),t?.articleSlug&&(r.article_slug=t.articleSlug),t?.userContext&&t.userContext.length>0&&(r.user_context=t.userContext),t?.images&&t.images.length>0&&(r.images=t.images),t?.history&&t.history.length>0&&(r.history=t.history),t?.registeredActions&&t.registeredActions.length>0&&(r.registered_actions=t.registeredActions),t?.resume&&(r.resume=!0),this.callToolStream("ask",r,n,t?.signal)}async cancelStream(e){const n={jsonrpc:"2.0",id:this.nextId(),method:"notifications/cancel",params:{request_id:e}};c.log(`[MCPClient] Cancelling stream request_id=${e}`);try{await fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(n),keepalive:!0})}catch(e){c.warn("[MCPClient] Failed to send cancel request:",e)}}async sendActionResult(e,n,t){const r=performance.now();t||(console.warn(`[MCPClient] sendActionResult called without toolCallId for action "${e}" - server will not be able to correlate result`),c.warn("[MCPClient] Missing toolCallId in sendActionResult for:",e));const i={jsonrpc:"2.0",id:this.nextId(),method:"action/result",params:{action_name:e,result:n,tool_call_id:t}};o.add({event:"network:request",data:{method:"action/result",action:e,tool_call_id:t,url:this.baseUrl},source:"network",level:"info"});try{c.log(`[MCPClient] Sending action result for "${e}"...`),await new Promise(e=>setTimeout(e,0));const n=await fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(i),keepalive:!0}),t=Math.round(performance.now()-r);if(!n.ok){const r=await n.text().catch(()=>"");throw o.add({event:"network:response",data:{status:n.status,duration:t,action:e,error:r},source:"network",level:"error"}),c.error(`[MCPClient] Action result delivery failed: ${n.status} ${n.statusText}`,r),new Error(`Failed to send action result: ${n.status}`)}o.add({event:"network:response",data:{status:n.status,duration:t,action:e},source:"network",level:"info"}),c.log(`[MCPClient] Action result for "${e}" delivered in ${t}ms`)}catch(n){const t=Math.round(performance.now()-r);throw c.error(`[MCPClient] Failed to send action result for "${e}" after ${t}ms:`,n),n}}async sendLog(e,n,t){const r={jsonrpc:"2.0",id:this.nextId(),method:"client/log",params:{level:e,message:n,data:t,timestamp:(new Date).toISOString()}};try{fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(r),keepalive:!0}).catch(()=>{})}catch{}}sendLogBatch(e){if(0===e.length)return;const n={jsonrpc:"2.0",id:this.nextId(),method:"client/log-batch",params:{logs:e}};try{fetch(this.baseUrl,{method:"POST",headers:this.headers,body:JSON.stringify(n),keepalive:!0}).catch(()=>{})}catch{}}async getConversationStatus(e){try{const n=await fetch(`${this.baseUrl}conversations/${e}/status/`,{method:"GET",headers:this.headers});if(!n.ok)return c.warn(`[MCPClient] Failed to get conversation status: ${n.status}`),null;return await n.json()}catch(e){return c.warn("[MCPClient] Error getting conversation status:",e),null}}}function S(e){return{id:e.id,name:e.name,taskType:e.action_type,data:e.data,autoRun:e.auto_run,autoComplete:e.auto_complete}}class C{constructor(e){this.abortControllers=new Map,this._externalUserId=null,this.config=e,this.mcpClient=new k(e)}get mcp(){return this.mcpClient}get baseUrl(){return`${this.config.apiBaseUrl}/api/v1/help-center`}setExternalUserId(e){this._externalUserId=e,this.mcpClient.setExternalUserId(e)}clearExternalUserId(){this._externalUserId=null,this.mcpClient.setExternalUserId("")}getVisitorId(){if("undefined"==typeof window)return"";const e="pillar_visitor_id";try{let n=localStorage.getItem(e);return n||(n=crypto.randomUUID(),localStorage.setItem(e,n)),n}catch{return""}}getSessionId(){if("undefined"==typeof window)return"";const e="pillar_session_id";try{let n=sessionStorage.getItem(e);return n||(n=crypto.randomUUID(),sessionStorage.setItem(e,n)),n}catch{return""}}getPageUrl(){return"undefined"==typeof window?"":window.location.href}get headers(){const e={"Content-Type":"application/json","x-customer-id":this.config.productKey,"x-visitor-id":this.getVisitorId(),"x-session-id":this.getSessionId(),"x-page-url":this.getPageUrl()};return this._externalUserId&&(e["x-external-user-id"]=this._externalUserId),this.config.platform&&(e["X-Pillar-Platform"]=this.config.platform),this.config.version&&(e["X-Pillar-Action-Version"]=this.config.version),e}async fetch(e,n={},t){if(t){this.abortControllers.get(t)?.abort();const e=new AbortController;this.abortControllers.set(t,e),n.signal=e.signal}const r=`${this.baseUrl}${e}`;try{const e=await fetch(r,{...n,headers:{...this.headers,...n.headers}});if(!e.ok){const n=await e.json().catch(()=>({}));throw new Error(n.detail||n.message||`API error: ${e.status}`)}return e.json()}catch(n){if("AbortError"===n.name)throw n;throw c.error(`[Pillar API] Error fetching ${e}:`,n),n}finally{t&&this.abortControllers.delete(t)}}async fetchEmbedConfig(){try{const e=await fetch(`${this.config.apiBaseUrl}/api/public/products/${this.config.productKey}/embed-config/`,{method:"GET",headers:{"Content-Type":"application/json"}});return e.ok?await e.json():(c.warn("[Pillar] Failed to fetch embed config:",e.status),null)}catch(e){return c.warn("[Pillar] Failed to fetch embed config:",e),null}}async getSuggestedQuestions(){try{const e=await this.mcpClient.callTool("suggest_questions",{}),n=e.structuredContent?.questions;return Array.isArray(n)?n:[]}catch(e){return c.warn("[Pillar] Failed to get suggested questions:",e),[]}}async uploadImage(e){return this.mcpClient.uploadImage(e)}async chat(e){let n="",t=[],r=[];const{getRegisteredActions:i,setRegisteredActions:l,updateTokenUsage:a}=await Promise.resolve().then(function(){return fr});try{const o=await this.mcpClient.ask(e.message,{onToken:t=>{n+=t,e.onChunk?.(t)},onSources:e=>{t=e},onActions:n=>{r=n.map(S),e.onActions?.(r)},onProgress:n=>{e.onProgress?.(n)},onConversationStarted:(n,t)=>{e.onConversationStarted?.(n,t)},onActionRequest:async n=>{e.onActionRequest&&await e.onActionRequest(n)},onRegisteredActions:e=>{l(e),c.log("[Pillar API] Stored",e.length,"registered actions for dynamic tool calling")},onRequestId:n=>{e.onRequestId?.(n)},onTokenUsage:e=>{a({promptTokens:e.prompt_tokens,completionTokens:e.completion_tokens,totalPromptTokens:e.total_prompt_tokens,totalCompletionTokens:e.total_completion_tokens,totalUsed:e.total_used,contextWindow:e.context_window,occupancyPct:e.occupancy_pct,modelName:e.model_name,iteration:e.iteration})},onError:e=>{c.error("[Pillar API] MCP chat error:",e)}},{articleSlug:e.articleSlug,userContext:e.userContext,images:e.images,history:e.history,registeredActions:i(),conversationId:e.existingConversationId||void 0,signal:e.signal,resume:e.resume});n||"text"!==o.content[0]?.type||(n=o.content[0].text||"");const s=o._meta||{};return{message:n,sources:t,actions:r,conversationId:s.conversation_id,messageId:s.query_log_id}}catch(e){throw c.error("[Pillar API] Chat error:",e),e}}async submitFeedback(e,n,t){try{await this.fetch("/ai/feedback/",{method:"POST",body:JSON.stringify({message_id:e,feedback:n,...t&&{comment:t}})})}catch(e){c.warn("[Pillar] Feedback submission failed:",e)}}async confirmTaskExecution(e,n,t){try{const r={status:n,error:t?.error,duration_ms:t?.duration_ms,session_id:t?.session_id,conversation_id:t?.conversation_id,metadata:t};await this.fetch(`/tasks/${e}/confirm/`,{method:"POST",body:JSON.stringify(r)})}catch(e){c.warn("[Pillar] Failed to confirm task execution:",e)}}async getSuggestions(e,n){try{return(await this.fetch("/suggestions/",{method:"POST",body:JSON.stringify({context:e,user_profile:n})})).suggestions||[]}catch(e){return c.warn("[Pillar] Failed to get suggestions:",e),[]}}async identify(e,n){const t=`${this.config.apiBaseUrl}/mcp/identify/`,r=await fetch(t,{method:"POST",headers:this.headers,body:JSON.stringify({userId:e,name:n?.name,email:n?.email,metadata:n?.metadata})});if(!r.ok){const e=await r.json().catch(()=>({}));throw new Error(e.error||`Identify failed: ${r.status}`)}}async listConversations(e=20){const n=`${this.config.apiBaseUrl}/mcp/conversations/?limit=${Math.min(e,50)}`;try{const e=await fetch(n,{method:"GET",headers:this.headers});if(!e.ok){const n=await e.json().catch(()=>({}));throw new Error(n.error||`Failed to list conversations: ${e.status}`)}return(await e.json()).conversations||[]}catch(e){return c.warn("[Pillar] Failed to list conversations:",e),[]}}async getConversation(e){const n=`${this.config.apiBaseUrl}/mcp/conversations/${e}/`;try{const e=await fetch(n,{method:"GET",headers:this.headers});if(!e.ok){const n=await e.json().catch(()=>({}));throw new Error(n.error||`Failed to get conversation: ${e.status}`)}return await e.json()}catch(e){return c.warn("[Pillar] Failed to get conversation:",e),null}}cancelAllRequests(){this.abortControllers.forEach(e=>e.abort()),this.abortControllers.clear()}}var P,E,z,T,I,M,R,$,A,L,H,O,D,j={},U=[],q=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,B=Array.isArray;function N(e,n){for(var t in n)e[t]=n[t];return e}function F(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function W(e,n,t){var r,i,l,a={};for(l in n)"key"==l?r=n[l]:"ref"==l?i=n[l]:a[l]=n[l];if(arguments.length>2&&(a.children=arguments.length>3?P.call(arguments,2):t),"function"==typeof e&&null!=e.defaultProps)for(l in e.defaultProps)void 0===a[l]&&(a[l]=e.defaultProps[l]);return V(e,a,r,i,null)}function V(e,n,t,r,i){var l={type:e,props:n,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++z:i,__i:-1,__u:0};return null==i&&null!=E.vnode&&E.vnode(l),l}function K(e){return e.children}function X(e,n){this.props=e,this.context=n}function Y(e,n){if(null==n)return e.__?Y(e.__,e.__i+1):null;for(var t;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e)return t.__e;return"function"==typeof e.type?Y(e):null}function Z(e){var n,t;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if(null!=(t=e.__k[n])&&null!=t.__e){e.__e=e.__c.base=t.__e;break}return Z(e)}}function G(e){(!e.__d&&(e.__d=!0)&&I.push(e)&&!Q.__r++||M!=E.debounceRendering)&&((M=E.debounceRendering)||R)(Q)}function Q(){for(var e,n,t,r,i,l,a,o=1;I.length;)I.length>o&&I.sort($),e=I.shift(),o=I.length,e.__d&&(t=void 0,r=void 0,i=(r=(n=e).__v).__e,l=[],a=[],n.__P&&((t=N({},r)).__v=r.__v+1,E.vnode&&E.vnode(t),le(n.__P,t,r,n.__n,n.__P.namespaceURI,32&r.__u?[i]:null,l,null==i?Y(r):i,!!(32&r.__u),a),t.__v=r.__v,t.__.__k[t.__i]=t,oe(l,t,a),r.__e=r.__=null,t.__e!=i&&Z(t)));Q.__r=0}function J(e,n,t,r,i,l,a,o,s,p,c){var d,u,h,g,m,f,v,b=r&&r.__k||U,_=n.length;for(s=function(e,n,t,r,i){var l,a,o,s,p,c=t.length,d=c,u=0;for(e.__k=new Array(i),l=0;l<i;l++)null!=(a=n[l])&&"boolean"!=typeof a&&"function"!=typeof a?("string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?a=e.__k[l]=V(null,a,null,null,null):B(a)?a=e.__k[l]=V(K,{children:a},null,null,null):void 0===a.constructor&&a.__b>0?a=e.__k[l]=V(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[l]=a,s=l+u,a.__=e,a.__b=e.__b+1,o=null,-1!=(p=a.__i=ne(a,t,s,d))&&(d--,(o=t[p])&&(o.__u|=2)),null==o||null==o.__v?(-1==p&&(i>c?u--:i<c&&u++),"function"!=typeof a.type&&(a.__u|=4)):p!=s&&(p==s-1?u--:p==s+1?u++:(p>s?u--:u++,a.__u|=4))):e.__k[l]=null;if(d)for(l=0;l<c;l++)null!=(o=t[l])&&!(2&o.__u)&&(o.__e==r&&(r=Y(o)),ce(o,o));return r}(t,n,b,s,_),d=0;d<_;d++)null!=(h=t.__k[d])&&(u=-1==h.__i?j:b[h.__i]||j,h.__i=d,f=le(e,h,u,i,l,a,o,s,p,c),g=h.__e,h.ref&&u.ref!=h.ref&&(u.ref&&pe(u.ref,null,h),c.push(h.ref,h.__c||g,h)),null==m&&null!=g&&(m=g),(v=!!(4&h.__u))||u.__k===h.__k?s=ee(h,s,e,v):"function"==typeof h.type&&void 0!==f?s=f:g&&(s=g.nextSibling),h.__u&=-7);return t.__e=m,s}function ee(e,n,t,r){var i,l;if("function"==typeof e.type){for(i=e.__k,l=0;i&&l<i.length;l++)i[l]&&(i[l].__=e,n=ee(i[l],n,t,r));return n}e.__e!=n&&(r&&(n&&e.type&&!n.parentNode&&(n=Y(e)),t.insertBefore(e.__e,n||null)),n=e.__e);do{n=n&&n.nextSibling}while(null!=n&&8==n.nodeType);return n}function ne(e,n,t,r){var i,l,a,o=e.key,s=e.type,p=n[t],c=null!=p&&!(2&p.__u);if(null===p&&null==o||c&&o==p.key&&s==p.type)return t;if(r>(c?1:0))for(i=t-1,l=t+1;i>=0||l<n.length;)if(null!=(p=n[a=i>=0?i--:l++])&&!(2&p.__u)&&o==p.key&&s==p.type)return a;return-1}function te(e,n,t){"-"==n[0]?e.setProperty(n,null==t?"":t):e[n]=null==t?"":"number"!=typeof t||q.test(n)?t:t+"px"}function re(e,n,t,r,i){var l,a;e:if("style"==n)if("string"==typeof t)e.style.cssText=t;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(n in r)t&&n in t||te(e.style,n,"");if(t)for(n in t)r&&t[n]==r[n]||te(e.style,n,t[n])}else if("o"==n[0]&&"n"==n[1])l=n!=(n=n.replace(A,"$1")),a=n.toLowerCase(),n=a in e||"onFocusOut"==n||"onFocusIn"==n?a.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+l]=t,t?r?t.u=r.u:(t.u=L,e.addEventListener(n,l?O:H,l)):e.removeEventListener(n,l?O:H,l);else{if("http://www.w3.org/2000/svg"==i)n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=n&&"height"!=n&&"href"!=n&&"list"!=n&&"form"!=n&&"tabIndex"!=n&&"download"!=n&&"rowSpan"!=n&&"colSpan"!=n&&"role"!=n&&"popover"!=n&&n in e)try{e[n]=null==t?"":t;break e}catch(e){}"function"==typeof t||(null==t||!1===t&&"-"!=n[4]?e.removeAttribute(n):e.setAttribute(n,"popover"==n&&1==t?"":t))}}function ie(e){return function(n){if(this.l){var t=this.l[n.type+e];if(null==n.t)n.t=L++;else if(n.t<t.u)return;return t(E.event?E.event(n):n)}}}function le(e,n,t,r,i,l,a,o,s,p){var c,d,u,h,g,m,f,v,b,_,x,y,w,k,S,C,z,T=n.type;if(void 0!==n.constructor)return null;128&t.__u&&(s=!!(32&t.__u),l=[o=n.__e=t.__e]),(c=E.__b)&&c(n);e:if("function"==typeof T)try{if(v=n.props,b="prototype"in T&&T.prototype.render,_=(c=T.contextType)&&r[c.__c],x=c?_?_.props.value:c.__:r,t.__c?f=(d=n.__c=t.__c).__=d.__E:(b?n.__c=d=new T(v,x):(n.__c=d=new X(v,x),d.constructor=T,d.render=de),_&&_.sub(d),d.state||(d.state={}),d.__n=r,u=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=T.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=N({},d.__s)),N(d.__s,T.getDerivedStateFromProps(v,d.__s))),h=d.props,g=d.state,d.__v=n,u)b&&null==T.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==T.getDerivedStateFromProps&&v!==h&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(v,x),n.__v==t.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(v,d.__s,x)){for(n.__v!=t.__v&&(d.props=v,d.state=d.__s,d.__d=!1),n.__e=t.__e,n.__k=t.__k,n.__k.some(function(e){e&&(e.__=n)}),y=0;y<d._sb.length;y++)d.__h.push(d._sb[y]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(v,d.__s,x),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(h,g,m)})}if(d.context=x,d.props=v,d.__P=e,d.__e=!1,w=E.__r,k=0,b){for(d.state=d.__s,d.__d=!1,w&&w(n),c=d.render(d.props,d.state,d.context),S=0;S<d._sb.length;S++)d.__h.push(d._sb[S]);d._sb=[]}else do{d.__d=!1,w&&w(n),c=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++k<25);d.state=d.__s,null!=d.getChildContext&&(r=N(N({},r),d.getChildContext())),b&&!u&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(h,g)),C=c,null!=c&&c.type===K&&null==c.key&&(C=se(c.props.children)),o=J(e,B(C)?C:[C],n,t,r,i,l,a,o,s,p),d.base=n.__e,n.__u&=-161,d.__h.length&&a.push(d),f&&(d.__E=d.__=null)}catch(e){if(n.__v=null,s||null!=l)if(e.then){for(n.__u|=s?160:128;o&&8==o.nodeType&&o.nextSibling;)o=o.nextSibling;l[l.indexOf(o)]=null,n.__e=o}else{for(z=l.length;z--;)F(l[z]);ae(n)}else n.__e=t.__e,n.__k=t.__k,e.then||ae(n);E.__e(e,n,t)}else null==l&&n.__v==t.__v?(n.__k=t.__k,n.__e=t.__e):o=n.__e=function(e,n,t,r,i,l,a,o,s){var p,c,d,u,h,g,m,f=t.props||j,v=n.props,b=n.type;if("svg"==b?i="http://www.w3.org/2000/svg":"math"==b?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=l)for(p=0;p<l.length;p++)if((h=l[p])&&"setAttribute"in h==!!b&&(b?h.localName==b:3==h.nodeType)){e=h,l[p]=null;break}if(null==e){if(null==b)return document.createTextNode(v);e=document.createElementNS(i,b,v.is&&v),o&&(E.__m&&E.__m(n,l),o=!1),l=null}if(null==b)f===v||o&&e.data==v||(e.data=v);else{if(l=l&&P.call(e.childNodes),!o&&null!=l)for(f={},p=0;p<e.attributes.length;p++)f[(h=e.attributes[p]).name]=h.value;for(p in f)if(h=f[p],"children"==p);else if("dangerouslySetInnerHTML"==p)d=h;else if(!(p in v)){if("value"==p&&"defaultValue"in v||"checked"==p&&"defaultChecked"in v)continue;re(e,p,null,h,i)}for(p in v)h=v[p],"children"==p?u=h:"dangerouslySetInnerHTML"==p?c=h:"value"==p?g=h:"checked"==p?m=h:o&&"function"!=typeof h||f[p]===h||re(e,p,h,f[p],i);if(c)o||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),n.__k=[];else if(d&&(e.innerHTML=""),J("template"==n.type?e.content:e,B(u)?u:[u],n,t,r,"foreignObject"==b?"http://www.w3.org/1999/xhtml":i,l,a,l?l[0]:t.__k&&Y(t,0),o,s),null!=l)for(p=l.length;p--;)F(l[p]);o||(p="value","progress"==b&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[p]||"progress"==b&&!g||"option"==b&&g!=f[p])&&re(e,p,g,f[p],i),p="checked",null!=m&&m!=e[p]&&re(e,p,m,f[p],i))}return e}(t.__e,n,t,r,i,l,a,s,p);return(c=E.diffed)&&c(n),128&n.__u?void 0:o}function ae(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(ae)}function oe(e,n,t){for(var r=0;r<t.length;r++)pe(t[r],t[++r],t[++r]);E.__c&&E.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){E.__e(e,n.__v)}})}function se(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:B(e)?e.map(se):N({},e)}function pe(e,n,t){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==n||(e.__u=e(n))}else e.current=n}catch(e){E.__e(e,t)}}function ce(e,n,t){var r,i;if(E.unmount&&E.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||pe(r,null,n)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){E.__e(e,n)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&ce(r[i],n,t||"function"!=typeof e.type);t||F(e.__e),e.__c=e.__=e.__e=void 0}function de(e,n,t){return this.constructor(e,t)}function ue(e,n,t){var r,i,l;n==document&&(n=document.documentElement),E.__&&E.__(e,n),r=!1?null:n.__k,i=[],l=[],le(n,e=n.__k=W(K,null,[e]),r||j,j,n.namespaceURI,r?null:n.firstChild?P.call(n.childNodes):null,i,r?r.__e:n.firstChild,false,l),oe(i,e,l)}P=U.slice,E={__e:function(e,n,t,r){for(var i,l,a;n=n.__;)if((i=n.__c)&&!i.__)try{if((l=i.constructor)&&null!=l.getDerivedStateFromError&&(i.setState(l.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(n){e=n}throw e}},z=0,T=function(e){return null!=e&&void 0===e.constructor},X.prototype.setState=function(e,n){var t;t=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=N({},this.state),"function"==typeof e&&(e=e(N({},t),this.props)),e&&N(t,e),null!=e&&this.__v&&(n&&this._sb.push(n),G(this))},X.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),G(this))},X.prototype.render=K,I=[],R="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$=function(e,n){return e.__v.__b-n.__v.__b},Q.__r=0,A=/(PointerCapture)$|Capture$/i,L=0,H=ie(!1),O=ie(!0),D=0;var he=0;function ge(e,n,t,r,i,l){n||(n={});var a,o,s=n;if("ref"in s)for(o in s={},n)"ref"==o?a=n[o]:s[o]=n[o];var p={type:e,props:s,key:t,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--he,__i:-1,__u:0,__source:i,__self:l};if("function"==typeof e&&(a=e.defaultProps))for(o in a)void 0===s[o]&&(s[o]=a[o]);return E.vnode&&E.vnode(p),p}var me,fe,ve,be,_e=0,xe=[],ye=E,we=ye.__b,ke=ye.__r,Se=ye.diffed,Ce=ye.__c,Pe=ye.unmount,Ee=ye.__;function ze(e,n){ye.__h&&ye.__h(fe,e,_e||n),_e=0;var t=fe.__H||(fe.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({}),t.__[e]}function Te(e){return _e=1,function(e,n){var t=ze(me++,2);if(t.t=e,!t.__c&&(t.__=[Ue(void 0,n),function(e){var n=t.__N?t.__N[0]:t.__[0],r=t.t(n,e);n!==r&&(t.__N=[r,t.__[1]],t.__c.setState({}))}],t.__c=fe,!fe.__f)){var r=function(e,n,r){if(!t.__c.__H)return!0;var l=t.__c.__H.__.filter(function(e){return!!e.__c});if(l.every(function(e){return!e.__N}))return!i||i.call(this,e,n,r);var a=t.__c.props!==e;return l.forEach(function(e){if(e.__N){var n=e.__[0];e.__=e.__N,e.__N=void 0,n!==e.__[0]&&(a=!0)}}),i&&i.call(this,e,n,r)||a};fe.__f=!0;var i=fe.shouldComponentUpdate,l=fe.componentWillUpdate;fe.componentWillUpdate=function(e,n,t){if(this.__e){var a=i;i=void 0,r(e,n,t),i=a}l&&l.call(this,e,n,t)},fe.shouldComponentUpdate=r}return t.__N||t.__}(Ue,e)}function Ie(e,n){var t=ze(me++,3);!ye.__s&&je(t.__H,n)&&(t.__=e,t.u=n,fe.__H.__h.push(t))}function Me(e){return _e=5,Re(function(){return{current:e}},[])}function Re(e,n){var t=ze(me++,7);return je(t.__H,n)&&(t.__=e(),t.__H=n,t.__h=e),t.__}function $e(e,n){return _e=8,Re(function(){return e},n)}function Ae(){for(var e;e=xe.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Oe),e.__H.__h.forEach(De),e.__H.__h=[]}catch(n){e.__H.__h=[],ye.__e(n,e.__v)}}ye.__b=function(e){fe=null,we&&we(e)},ye.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),Ee&&Ee(e,n)},ye.__r=function(e){ke&&ke(e),me=0;var n=(fe=e.__c).__H;n&&(ve===fe?(n.__h=[],fe.__h=[],n.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(n.__h.forEach(Oe),n.__h.forEach(De),n.__h=[],me=0)),ve=fe},ye.diffed=function(e){Se&&Se(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(1!==xe.push(n)&&be===ye.requestAnimationFrame||((be=ye.requestAnimationFrame)||He)(Ae)),n.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),ve=fe=null},ye.__c=function(e,n){n.some(function(e){try{e.__h.forEach(Oe),e.__h=e.__h.filter(function(e){return!e.__||De(e)})}catch(t){n.some(function(e){e.__h&&(e.__h=[])}),n=[],ye.__e(t,e.__v)}}),Ce&&Ce(e,n)},ye.unmount=function(e){Pe&&Pe(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(e){try{Oe(e)}catch(e){n=e}}),t.__H=void 0,n&&ye.__e(n,t.__v))};var Le="function"==typeof requestAnimationFrame;function He(e){var n,t=function(){clearTimeout(r),Le&&cancelAnimationFrame(n),setTimeout(e)},r=setTimeout(t,35);Le&&(n=requestAnimationFrame(t))}function Oe(e){var n=fe,t=e.__c;"function"==typeof t&&(e.__c=void 0,t()),fe=n}function De(e){var n=fe;e.__c=e.__(),fe=n}function je(e,n){return!e||e.length!==n.length||n.some(function(n,t){return n!==e[t]})}function Ue(e,n){return"function"==typeof n?n(e):n}var qe=Symbol.for("preact-signals");function Be(){if(Xe>1)Xe--;else{for(var e,n=!1;void 0!==Ke;){var t=Ke;for(Ke=void 0,Ye++;void 0!==t;){var r=t.o;if(t.o=void 0,t.f&=-3,!(8&t.f)&&en(t))try{t.c()}catch(t){n||(e=t,n=!0)}t=r}}if(Ye=0,Xe--,n)throw e}}var Ne=void 0;function Fe(e){var n=Ne;Ne=void 0;try{return e()}finally{Ne=n}}var We,Ve,Ke=void 0,Xe=0,Ye=0,Ze=0;function Ge(e){if(void 0!==Ne){var n=e.n;if(void 0===n||n.t!==Ne)return n={i:0,S:e,p:Ne.s,n:void 0,t:Ne,e:void 0,x:void 0,r:n},void 0!==Ne.s&&(Ne.s.n=n),Ne.s=n,e.n=n,32&Ne.f&&e.S(n),n;if(-1===n.i)return n.i=0,void 0!==n.n&&(n.n.p=n.p,void 0!==n.p&&(n.p.n=n.n),n.p=Ne.s,n.n=void 0,Ne.s.n=n,Ne.s=n),n}}function Qe(e,n){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==n?void 0:n.watched,this.Z=null==n?void 0:n.unwatched,this.name=null==n?void 0:n.name}function Je(e,n){return new Qe(e,n)}function en(e){for(var n=e.s;void 0!==n;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function nn(e){for(var n=e.s;void 0!==n;n=n.n){var t=n.S.n;if(void 0!==t&&(n.r=t),n.S.n=n,n.i=-1,void 0===n.n){e.s=n;break}}}function tn(e){for(var n=e.s,t=void 0;void 0!==n;){var r=n.p;-1===n.i?(n.S.U(n),void 0!==r&&(r.n=n.n),void 0!==n.n&&(n.n.p=r)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=r}e.s=t}function rn(e,n){Qe.call(this,void 0),this.x=e,this.s=void 0,this.g=Ze-1,this.f=4,this.W=null==n?void 0:n.watched,this.Z=null==n?void 0:n.unwatched,this.name=null==n?void 0:n.name}function ln(e,n){return new rn(e,n)}function an(e){var n=e.u;if(e.u=void 0,"function"==typeof n){Xe++;var t=Ne;Ne=void 0;try{n()}catch(n){throw e.f&=-2,e.f|=8,on(e),n}finally{Ne=t,Be()}}}function on(e){for(var n=e.s;void 0!==n;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,an(e)}function sn(e){if(Ne!==this)throw new Error("Out-of-order effect");tn(this),Ne=e,this.f&=-2,8&this.f&&on(this),Be()}function pn(e,n){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==n?void 0:n.name}function cn(e,n){var t=new pn(e,n);try{t.c()}catch(e){throw t.d(),e}var r=t.d.bind(t);return r[Symbol.dispose]=r,r}function dn(e,n){E[e]=n.bind(null,E[e]||function(){})}function un(e){Ve&&Ve(),Ve=e&&e.S()}function hn(e){var n=this,t=e.data,r=function(e){return Re(function(){return Je(e)},[])}(t);r.value=t;var i=Re(function(){for(var e=n.__v;e=e.__;)if(e.__c){e.__c.__$f|=4;break}return n.__$u.c=function(){var e,t=n.__$u.S(),r=i.value;t(),T(r)||3!==(null==(e=n.base)?void 0:e.nodeType)?(n.__$f|=1,n.setState({})):n.base.data=r},ln(function(){var e=r.value.value;return 0===e?0:!0===e?"":e||""})},[]);return i.value}function gn(e,n,t,r){var i=n in e&&void 0===e.ownerSVGElement,l=Je(t);return{o:function(e,n){l.value=e,r=n},d:cn(function(){var t=l.value.value;r[n]!==t&&(r[n]=t,i?e[n]=t:t?e.setAttribute(n,t):e.removeAttribute(n))})}}function mn(e){var n=Me(e);return n.current=e,We.__$f|=4,Re(function(){return ln(function(){return n.current()})},[])}Qe.prototype.brand=qe,Qe.prototype.h=function(){return!0},Qe.prototype.S=function(e){var n=this,t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:Fe(function(){var e;null==(e=n.W)||e.call(n)}))},Qe.prototype.U=function(e){var n=this;if(void 0!==this.t){var t=e.e,r=e.x;void 0!==t&&(t.x=r,e.e=void 0),void 0!==r&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&Fe(function(){var e;null==(e=n.Z)||e.call(n)}))}},Qe.prototype.subscribe=function(e){var n=this;return cn(function(){var t=n.value,r=Ne;Ne=void 0;try{e(t)}finally{Ne=r}},{name:"sub"})},Qe.prototype.valueOf=function(){return this.value},Qe.prototype.toString=function(){return this.value+""},Qe.prototype.toJSON=function(){return this.value},Qe.prototype.peek=function(){var e=Ne;Ne=void 0;try{return this.value}finally{Ne=e}},Object.defineProperty(Qe.prototype,"value",{get:function(){var e=Ge(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Ye>100)throw new Error("Cycle detected");this.v=e,this.i++,Ze++,Xe++;try{for(var n=this.t;void 0!==n;n=n.x)n.t.N()}finally{Be()}}}}),rn.prototype=new Qe,rn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Ze)return!0;if(this.g=Ze,this.f|=1,this.i>0&&!en(this))return this.f&=-2,!0;var e=Ne;try{nn(this),Ne=this;var n=this.x();(16&this.f||this.v!==n||0===this.i)&&(this.v=n,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Ne=e,tn(this),this.f&=-2,!0},rn.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var n=this.s;void 0!==n;n=n.n)n.S.S(n)}Qe.prototype.S.call(this,e)},rn.prototype.U=function(e){if(void 0!==this.t&&(Qe.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var n=this.s;void 0!==n;n=n.n)n.S.U(n)}},rn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(rn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ge(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),pn.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var n=this.x();"function"==typeof n&&(this.u=n)}finally{e()}},pn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,an(this),nn(this),Xe++;var e=Ne;return Ne=this,sn.bind(this,e)},pn.prototype.N=function(){2&this.f||(this.f|=2,this.o=Ke,Ke=this)},pn.prototype.d=function(){this.f|=8,1&this.f||on(this)},pn.prototype.dispose=function(){this.d()},hn.displayName="_st",Object.defineProperties(Qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:hn},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),dn("__b",function(e,n){if("string"==typeof n.type){var t,r=n.props;for(var i in r)if("children"!==i){var l=r[i];l instanceof Qe&&(t||(n.__np=t={}),t[i]=l,r[i]=l.peek())}}e(n)}),dn("__r",function(e,n){un();var t,r=n.__c;r&&(r.__$f&=-2,void 0===(t=r.__$u)&&(r.__$u=t=function(){var e;return cn(function(){e=this}),e.c=function(){r.__$f|=1,r.setState({})},e}())),We=r,un(t),e(n)}),dn("__e",function(e,n,t,r){un(),We=void 0,e(n,t,r)}),dn("diffed",function(e,n){var t;if(un(),We=void 0,"string"==typeof n.type&&(t=n.__e)){var r=n.__np,i=n.props;if(r){var l=t.U;if(l)for(var a in l){var o=l[a];void 0===o||a in r||(o.d(),l[a]=void 0)}else t.U=l={};for(var s in r){var p=l[s],c=r[s];void 0===p?(p=gn(t,s,c,i),l[s]=p):p.o(c,i)}}}e(n)}),dn("unmount",function(e,n){if("string"==typeof n.type){var t=n.__e;if(t){var r=t.U;if(r)for(var i in t.U=void 0,r){var l=r[i];l&&l.d()}}}else{var a=n.__c;if(a){var o=a.__$u;o&&(a.__$u=void 0,o.d())}}e(n)}),dn("__h",function(e,n,t,r){(r<3||9===r)&&(n.__$f|=2),e(n,t,r)}),X.prototype.shouldComponentUpdate=function(e,n){var t=this.__$u,r=t&&void 0!==t.s;for(var i in n)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){if(!(r||2&this.__$f||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(r||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var l in e)if("__source"!==l&&e[l]!==this.props[l])return!0;for(var a in this.props)if(!(a in e))return!0;return!1};const fn="pillar:panel_open",vn="pillar:panel_width";function bn(e){if("undefined"!=typeof window)try{localStorage.setItem(fn,String(e))}catch{}}function _n(){if("undefined"==typeof window)return null;try{const e=localStorage.getItem(vn);if(null===e)return null;const n=Number(e);return Number.isFinite(n)&&n>0?n:null}catch{return null}}function xn(e){if("undefined"!=typeof window)try{localStorage.setItem(vn,String(e))}catch{}}const yn=Je(function(){if("undefined"==typeof window)return!1;try{return"true"===localStorage.getItem(fn)}catch{return!1}}()),wn=Je("assistant"),kn=Je("right"),Sn=Je("overlay"),Cn=Je(380),Pn=Je(1200),En=Je(!0),zn=Je(700),Tn=Je(500),In=Je("undefined"!=typeof window?window.innerWidth:1920);let Mn=null;const Rn=ln(()=>{const e=Pn.value;return!1!==e&&In.value<e}),$n=ln(()=>In.value<zn.value),An=ln(()=>In.value<Tn.value),Ln=ln(()=>Rn.value?"overlay":Sn.value);ln(()=>{const e=["pillar-panel",`pillar-panel--${kn.value}`];return yn.value&&e.push("pillar-panel--open"),e.join(" ")});const Hn=()=>{yn.value=!1,bn(!1),"overlay"===Ln.value&&(document.body.style.overflow="")},On=e=>{Cn.value=e},Dn=()=>{yn.value=!1,bn(!1),wn.value="assistant",document.body.style.overflow=""};function jn(e,n,t){const r=document.createElement("style");return t&&(r.id=t),r.textContent=n,e instanceof Document?e.head.appendChild(r):e.appendChild(r),r}const Un={help:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',support:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 18v-6a9 9 0 0 1 18 0v6"></path><path d="M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"></path></svg>',settings:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg>',feedback:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>',chat:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path></svg>',calendar:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>',mail:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>'},qn={assistant:Un.help,support:Un.support};function Bn({position:e,tabs:n,currentActiveTab:t,onTabClick:r,panelOpen:i,panelWidthPx:l,theme:a,resizable:o,isResizing:s,onResizeStart:p}){const c=$e(e=>{r(e)},[r]),d=["pillar-edge-sidebar",`pillar-edge-sidebar--${e}`,"pillar-edge-sidebar--mounted",i&&"pillar-edge-sidebar--panel-open",s&&"pillar-edge-sidebar--resizing","light"===a&&"pillar-edge-sidebar--light","dark"===a&&"pillar-edge-sidebar--dark"].filter(Boolean).join(" "),u={"--pillar-panel-width":`${l}px`},h=n.filter(e=>e.enabled).sort((e,n)=>e.order-n.order);return ge("div",{class:d,style:u,children:[o&&i&&ge("div",{class:"pillar-edge-resize-handle",onMouseDown:p,onTouchStart:p}),h.map(e=>{return ge("button",{class:["pillar-edge-trigger",i&&t===e.id&&"pillar-edge-trigger--active"].filter(Boolean).join(" "),onClick:()=>c(e.id),"aria-label":e.label||"Help",type:"button",children:[ge("span",{class:"pillar-edge-trigger__icon",dangerouslySetInnerHTML:{__html:(n=e.id,r=e.icon,r&&r in Un?Un[r]:qn[n]||Un.help)}}),ge("span",{class:"pillar-edge-trigger__label",children:e.label})]},e.id);var n,r})]})}class Nn{constructor(e,n,t,r){this.container=null,this.stylesInjected=!1,this.themeStylesInjected=!1,this._isHidden=!1,this.unsubscribeOpen=null,this.unsubscribeWidth=null,this.unsubscribeHoverMode=null,this.unsubscribeMobileMode=null,this.unsubscribeActiveTab=null,this.themeObserver=null,this.currentTheme="light",this._isResizing=!1,this._resizeStartX=0,this._resizeStartWidth=0,this._resizeRafId=null,this._boundHandleResizeMove=null,this._boundHandleResizeEnd=null,this.handleTabClick=e=>{if("assistant"!==e){const n=this.config.sidebarTabs.find(n=>n.id===e);return this.events.emit("sidebar:click",{tabId:e,label:n?.label||e}),void("support"===e&&this.events.emit("support:request",{tabId:e}))}if(yn.value&&wn.value===e)return this.onClick(),void this.render();(e=>{wn.value=e})(e),yn.value||this.onClick(),this.render()},this.handleResizeStart=e=>{if(!yn.value||!this.config.panel.resizable||!this.config.edgeTrigger.resizable)return;e.preventDefault(),e.stopPropagation();const n="touches"in e?e.touches[0].clientX:e.clientX;this._isResizing=!0,this._resizeStartX=n,this._resizeStartWidth=Cn.value,this._boundHandleResizeMove=this.handleResizeMove.bind(this),this._boundHandleResizeEnd=this.handleResizeEnd.bind(this),document.addEventListener("mousemove",this._boundHandleResizeMove),document.addEventListener("mouseup",this._boundHandleResizeEnd),document.addEventListener("touchmove",this._boundHandleResizeMove,{passive:!1}),document.addEventListener("touchend",this._boundHandleResizeEnd),document.addEventListener("touchcancel",this._boundHandleResizeEnd),document.body.style.userSelect="none",document.body.style.webkitUserSelect="none",document.documentElement.style.cursor="col-resize",document.documentElement.style.transition="none",this.render()},this.handleResizeEnd=e=>{this._isResizing&&(null!==this._resizeRafId&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this._isResizing=!1,xn(Cn.value),this._boundHandleResizeMove&&(document.removeEventListener("mousemove",this._boundHandleResizeMove),document.removeEventListener("touchmove",this._boundHandleResizeMove)),this._boundHandleResizeEnd&&(document.removeEventListener("mouseup",this._boundHandleResizeEnd),document.removeEventListener("touchend",this._boundHandleResizeEnd),document.removeEventListener("touchcancel",this._boundHandleResizeEnd)),this._boundHandleResizeMove=null,this._boundHandleResizeEnd=null,document.body.style.userSelect="",document.body.style.webkitUserSelect="",document.documentElement.style.cursor="",document.documentElement.style.transition="padding 0.3s ease",this.render())},this.config=e,this.events=n,this.onClick=t,this.rootContainer=r||null}getEdgePosition(){return this.config.panel.position}detectThemeFromDOM(){const e=document.documentElement;if(e.classList.contains("dark"))return"dark";return"dark"===e.getAttribute("data-theme")||"dark"===e.style.colorScheme?"dark":"light"}applyThemeMode(){const e=this.config.theme.mode;this.currentTheme="light"===e||"dark"===e?e:this.detectThemeFromDOM()}init(){if(this.stylesInjected||(jn(document,"/* Sidebar container - always visible, shifts when panel opens */\n.pillar-edge-sidebar {\n /* Default light mode variables (match panel's variables.css) */\n --pillar-primary: #2563eb;\n --pillar-primary-hover: #1d4ed8;\n --pillar-bg: #ffffff;\n --pillar-bg-secondary: #f9fafb;\n --pillar-text: #1a1a1a;\n --pillar-text-muted: #6b7280;\n --pillar-border: #e5e7eb;\n --pillar-border-light: #f3f4f6;\n --pillar-outline-color: rgba(37, 99, 235, 0.15);\n\n position: fixed;\n top: 0;\n bottom: 0;\n width: 48px;\n z-index: 100000;\n display: flex;\n flex-direction: column;\n align-items: center;\n background: var(--pillar-bg);\n border-left: 1px solid var(--pillar-border);\n transition: right 0.3s ease, left 0.3s ease;\n}\n\n/* Default dark mode variables (match panel's variables.css) */\n.pillar-edge-sidebar--dark {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-text: #f5f5f5;\n --pillar-text-muted: #a3a3a3;\n --pillar-border: #404040;\n --pillar-border-light: #333333;\n --pillar-outline-color: rgba(96, 165, 250, 0.25);\n}\n\n.pillar-edge-sidebar--right {\n right: 0;\n border-left: 1px solid var(--pillar-border);\n border-right: none;\n}\n\n.pillar-edge-sidebar--left {\n left: 0;\n border-left: none;\n border-right: 1px solid var(--pillar-border);\n}\n\n/* When panel is open, shift the trigger to sit at the panel's outer edge */\n.pillar-edge-sidebar--right.pillar-edge-sidebar--panel-open {\n right: var(--pillar-panel-width, 380px);\n}\n\n.pillar-edge-sidebar--left.pillar-edge-sidebar--panel-open {\n left: var(--pillar-panel-width, 380px);\n}\n\n/* The trigger button - vertical sideways text */\n.pillar-edge-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px 8px;\n margin-top: 8px;\n font-family: var(--pillar-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);\n font-size: 12px;\n font-weight: 500;\n color: var(--pillar-text-muted);\n background: transparent;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: background 0.15s ease, color 0.15s ease;\n outline: none;\n gap: 8px;\n writing-mode: vertical-rl;\n text-orientation: mixed;\n}\n\n.pillar-edge-trigger:hover {\n background: var(--pillar-bg-secondary);\n color: var(--pillar-primary);\n}\n\n.pillar-edge-trigger--active {\n background: var(--pillar-bg-secondary);\n color: var(--pillar-primary);\n}\n\n.pillar-edge-trigger--active .pillar-edge-trigger__icon {\n opacity: 1;\n color: var(--pillar-primary);\n}\n\n.pillar-edge-trigger:focus-visible {\n background: var(--pillar-bg-secondary);\n box-shadow: 0 0 0 2px var(--pillar-primary);\n}\n\n.pillar-edge-trigger__icon {\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n opacity: 0.8;\n}\n\n.pillar-edge-trigger:hover .pillar-edge-trigger__icon {\n opacity: 1;\n color: var(--pillar-primary);\n}\n\n.pillar-edge-trigger__label {\n white-space: nowrap;\n letter-spacing: 0.5px;\n}\n\n/* Animation on mount */\n@keyframes pillar-sidebar-mount {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n.pillar-edge-sidebar--mounted {\n animation: pillar-sidebar-mount 0.2s ease forwards;\n}\n\n/* Resize handle - appears on the inner edge of the sidebar (content side) */\n.pillar-edge-resize-handle {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 6px;\n cursor: col-resize;\n z-index: 1;\n display: none;\n touch-action: none;\n}\n\n/* Position the handle on the correct edge based on panel position */\n.pillar-edge-sidebar--right .pillar-edge-resize-handle {\n left: -3px;\n}\n\n.pillar-edge-sidebar--left .pillar-edge-resize-handle {\n right: -3px;\n}\n\n/* Only show when panel is open */\n.pillar-edge-sidebar--panel-open .pillar-edge-resize-handle {\n display: block;\n}\n\n/* Visible indicator line on hover */\n.pillar-edge-resize-handle::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n width: 2px;\n left: 50%;\n transform: translateX(-50%);\n background: transparent;\n transition: background 0.15s ease;\n border-radius: 1px;\n}\n\n.pillar-edge-resize-handle:hover::after {\n background: var(--pillar-primary, #2563eb);\n opacity: 0.5;\n}\n\n.pillar-edge-sidebar--resizing .pillar-edge-resize-handle::after {\n background: var(--pillar-primary, #2563eb);\n opacity: 0.7;\n}\n\n/* Override cursor on the whole sidebar during resize */\n.pillar-edge-sidebar--resizing,\n.pillar-edge-sidebar--resizing * {\n cursor: col-resize !important;\n}\n\n/* Disable sidebar transition during resize for immediate feedback */\n.pillar-edge-sidebar--resizing {\n transition: none !important;\n}\n","pillar-edge-trigger-styles"),this.stylesInjected=!0),!this.themeStylesInjected){const e=function(e,n,t){const r=e=>{const n=[];return e.primary&&n.push(`--pillar-primary: ${e.primary};`),e.primaryHover&&n.push(`--pillar-primary-hover: ${e.primaryHover};`),e.background&&n.push(`--pillar-bg: ${e.background};`),e.backgroundSecondary&&n.push(`--pillar-bg-secondary: ${e.backgroundSecondary};`),e.text&&n.push(`--pillar-text: ${e.text};`),e.textMuted&&n.push(`--pillar-text-muted: ${e.textMuted};`),e.border&&n.push(`--pillar-border: ${e.border};`),e.borderLight&&n.push(`--pillar-border-light: ${e.borderLight};`),e.outlineColor&&n.push(`--pillar-outline-color: ${e.outlineColor};`),n.join("\n ")},i=r(e),l=r(n),a=t?`--pillar-font-family: ${t};`:"";let o="";return(i||a)&&(o+=`\n.pillar-edge-sidebar,\n.pillar-edge-sidebar--light {\n ${[i,a].filter(Boolean).join("\n ")}\n}\n`),l&&(o+=`\n.pillar-edge-sidebar--dark {\n ${l}\n}\n`),o}(this.config.theme.colors,this.config.theme.darkColors,this.config.theme.fontFamily);e&&jn(document,e,"pillar-edge-trigger-theme"),this.themeStylesInjected=!0}if(this.config.panel.resizable&&this.config.edgeTrigger.resizable){const e=_n();null!==e&&On(e)}this.container=document.createElement("div"),this.container.id="pillar-edge-trigger-container";(this.rootContainer||document.body).appendChild(this.container),this.applyThemeMode(),this.applyLayoutPadding(),this.render(),this.unsubscribeOpen=yn.subscribe(()=>{this.render(),queueMicrotask(()=>this.applyLayoutPadding())}),this.unsubscribeWidth=Cn.subscribe(()=>{this.render(),queueMicrotask(()=>this.applyLayoutPadding())}),this.unsubscribeHoverMode=Rn.subscribe(()=>{queueMicrotask(()=>this.applyLayoutPadding())}),this.unsubscribeMobileMode=$n.subscribe(e=>{e?this.hide():this.show()}),$n.value&&this.hide(),this.unsubscribeActiveTab=wn.subscribe(()=>{this.render()}),"auto"===this.config.theme.mode&&(this.themeObserver=new MutationObserver(()=>{const e=this.detectThemeFromDOM();e!==this.currentTheme&&(this.currentTheme=e,this.render())}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}))}applyLayoutPadding(){if(this._isHidden)return;const e=this.getEdgePosition(),n=Cn.value,t=Rn.value;let r=48;yn.value&&!t&&(r=n+48),document.documentElement.style.transition="padding 0.3s ease","right"===e?(document.documentElement.style.paddingRight=`${r}px`,document.documentElement.style.setProperty("--pillar-inset-right",`${r}px`),document.documentElement.style.setProperty("--pillar-inset-left","0px")):(document.documentElement.style.paddingLeft=`${r}px`,document.documentElement.style.setProperty("--pillar-inset-left",`${r}px`),document.documentElement.style.setProperty("--pillar-inset-right","0px"))}removeLayoutPadding(){"right"===this.getEdgePosition()?document.documentElement.style.paddingRight="":document.documentElement.style.paddingLeft="",document.documentElement.style.removeProperty("--pillar-inset-right"),document.documentElement.style.removeProperty("--pillar-inset-left")}setOpen(e){this.render()}show(){this._isHidden=!1,this.container&&(this.container.style.display=""),this.applyLayoutPadding(),this.render()}hide(){this._isHidden=!0,this.container&&(this.container.style.display="none"),this.removeLayoutPadding()}setPosition(e){this.removeLayoutPadding(),this.config.panel.position=e,this.applyLayoutPadding(),this.render()}destroy(){this._isResizing&&this.handleResizeEnd(new MouseEvent("mouseup")),null!==this._resizeRafId&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this.unsubscribeOpen?.(),this.unsubscribeOpen=null,this.unsubscribeWidth?.(),this.unsubscribeWidth=null,this.unsubscribeHoverMode?.(),this.unsubscribeHoverMode=null,this.unsubscribeMobileMode?.(),this.unsubscribeMobileMode=null,this.unsubscribeActiveTab?.(),this.unsubscribeActiveTab=null,this.themeObserver?.disconnect(),this.themeObserver=null,this.removeLayoutPadding(),this.container&&(ue(null,this.container),this.container.remove()),this.container=null,document.getElementById("pillar-edge-trigger-styles")?.remove(),document.getElementById("pillar-edge-trigger-theme")?.remove(),this.stylesInjected=!1,this.themeStylesInjected=!1}handleResizeMove(e){this._isResizing&&("touches"in e&&e.preventDefault(),null===this._resizeRafId&&(this._resizeRafId=requestAnimationFrame(()=>{if(this._resizeRafId=null,!this._isResizing)return;const n="touches"in e?e.touches[0].clientX:e.clientX,t=this._resizeStartX-n,r="right"===this.getEdgePosition()?t:-t,i=window.innerWidth-48-100,l=Math.max(200,Math.min(i,this._resizeStartWidth+r));On(l)})))}render(){if(!this.container||this._isHidden)return;ue(ge(Bn,{position:this.getEdgePosition(),tabs:this.config.sidebarTabs,currentActiveTab:wn.value,onTabClick:this.handleTabClick,panelOpen:yn.value,panelWidthPx:Cn.value,theme:this.currentTheme,resizable:this.config.panel.resizable&&this.config.edgeTrigger.resizable,isResizing:this._isResizing,onResizeStart:this.handleResizeStart}),this.container)}}const Fn={sparkle:'<svg viewBox="0 0 16 16" fill="currentColor"><path d="M8.8 8.44L9.497 11l.697-2.56c.175-.643.263-.965.435-1.23a2 2 0 0 1 .583-.583c.263-.172.585-.259 1.23-.435l2.56-.697l-2.56-.697c-.643-.175-.964-.263-1.23-.435a2 2 0 0 1-.583-.583c-.172-.263-.259-.585-.435-1.23L9.497-.01L8.8 2.55c-.175.643-.263.965-.435 1.23a2 2 0 0 1-.583.583c-.263.172-.585.259-1.23.435l-2.56.697l2.56.697c.643.175.965.263 1.23.435a2 2 0 0 1 .583.583c.172.263.259.585.435 1.23M2.68 13.7c.169.244.264.542.456 1.14l.362 1.12l.362-1.12c.191-.595.287-.893.456-1.14c.149-.216.34-.4.561-.543c.249-.161.55-.247 1.15-.418l.971-.277l-.971-.277c-.601-.172-.902-.258-1.15-.418a2 2 0 0 1-.561-.543c-.169-.244-.264-.542-.456-1.14l-.362-1.12l-.362 1.12c-.191.595-.287.893-.456 1.14c-.149.216-.34.4-.561.543c-.249.161-.55.247-1.15.418l-.971.277l.971.277c.601.172.902.258 1.15.418a2 2 0 0 1 .561.543"/></svg>',question:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',help:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',chat:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path></svg>',support:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 18v-6a9 9 0 0 1 18 0v6"></path><path d="M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"></path></svg>'},Wn={small:44,medium:56,large:68};function Vn({position:e,icon:n,backgroundColor:t,iconColor:r,size:i,label:l,offset:a,panelOpen:o,onClick:s}){const p=$e(()=>{s()},[s]);return ge("button",{class:["pillar-mobile-trigger",`pillar-mobile-trigger--${e}`,"pillar-mobile-trigger--mounted",o&&"pillar-mobile-trigger--hidden"].filter(Boolean).join(" "),style:{"--pillar-mobile-offset":`${a}px`,"--pillar-mobile-bg":t,width:`${i}px`,height:`${i}px`,backgroundColor:t,color:r},onClick:p,"aria-label":l,title:l,type:"button",children:ge("span",{class:"pillar-mobile-trigger__icon",dangerouslySetInnerHTML:{__html:n}})})}class Kn{constructor(e,n,t,r){this.container=null,this.stylesInjected=!1,this._isEnabled=!0,this.unsubscribeMobileMode=null,this.unsubscribeOpen=null,this.config=e,this.events=n,this.onClick=t,this.rootContainer=r||null,this._isEnabled=e.mobileTrigger.enabled}getSize(){const e=this.config.mobileTrigger.size;return"number"==typeof e?e:Wn[e]}getIcon(){const{customIcon:e,icon:n}=this.config.mobileTrigger;return e||Fn[n]}getBackgroundColor(){const{backgroundColor:e}=this.config.mobileTrigger;return e||(this.config.theme.colors.primary||"#c2410c")}init(){if(!this._isEnabled)return;this.stylesInjected||(jn(document,"/* Mobile trigger floating button */\n.pillar-mobile-trigger {\n position: fixed;\n z-index: 100000;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 50%;\n cursor: pointer;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.pillar-mobile-trigger:hover {\n transform: scale(1.05);\n box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.12);\n}\n\n.pillar-mobile-trigger:active {\n transform: scale(0.95);\n}\n\n.pillar-mobile-trigger:focus-visible {\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(255, 255, 255, 0.5), 0 0 0 5px var(--pillar-mobile-bg, #c2410c);\n}\n\n/* Position variants */\n.pillar-mobile-trigger--bottom-right {\n bottom: var(--pillar-mobile-offset, 24px);\n right: var(--pillar-mobile-offset, 24px);\n}\n\n.pillar-mobile-trigger--bottom-left {\n bottom: var(--pillar-mobile-offset, 24px);\n left: var(--pillar-mobile-offset, 24px);\n}\n\n/* Icon styling */\n.pillar-mobile-trigger__icon {\n width: 55%;\n height: 55%;\n flex-shrink: 0;\n transform: translateY(-1px);\n}\n\n/* Hidden state (when panel is open) */\n.pillar-mobile-trigger--hidden {\n opacity: 0 !important;\n pointer-events: none;\n transform: scale(0.8) !important;\n visibility: hidden;\n}\n\n/* Animation on mount */\n@keyframes pillar-mobile-trigger-mount {\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n.pillar-mobile-trigger--mounted {\n animation: pillar-mobile-trigger-mount 0.2s ease forwards;\n}\n","pillar-mobile-trigger-styles"),this.stylesInjected=!0),this.container=document.createElement("div"),this.container.id="pillar-mobile-trigger-container";(this.rootContainer||document.body).appendChild(this.container),this.unsubscribeMobileMode=$n.subscribe(()=>{this.render()}),this.unsubscribeOpen=yn.subscribe(()=>{this.render()}),this.render()}show(){this._isEnabled=!0,this.render()}hide(){this._isEnabled=!1,this.render()}get isVisible(){return this._isEnabled&&$n.value&&!yn.value}destroy(){this.unsubscribeMobileMode?.(),this.unsubscribeMobileMode=null,this.unsubscribeOpen?.(),this.unsubscribeOpen=null,this.container&&(ue(null,this.container),this.container.remove()),this.container=null,document.getElementById("pillar-mobile-trigger-styles")?.remove(),this.stylesInjected=!1}render(){if(!this.container)return;if(!this._isEnabled||!$n.value)return void ue(null,this.container);const{position:e,iconColor:n,label:t,offset:r}=this.config.mobileTrigger;ue(ge(Vn,{position:e,icon:this.getIcon(),backgroundColor:this.getBackgroundColor(),iconColor:n,size:this.getSize(),label:t,offset:r,panelOpen:yn.value,onClick:this.onClick}),this.container)}}function Xn(){return`ctx_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function Yn(e){return"highlighted_text"===e.type}function Zn(e){return"dom_snapshot"===e.type}function Gn(e){return Yn(e)?e.text_content.length>40?e.text_content.substring(0,40)+"...":e.text_content:Zn(e)?`Page scan: ${e.interactableCount} elements`:"Context"}const Qn=Je([]),Jn=Je(null),et=Je([]),nt=Je(0),tt=Je([]),rt="pillar:conversation_id";function it(e){if("undefined"!=typeof window)try{null===e?localStorage.removeItem(rt):localStorage.setItem(rt,e)}catch{}}const lt=Je(!1),at=Je(null),ot=e=>{at.value=e},st=Je(!1),pt=Je(null),ct=e=>{pt.value=e},dt=()=>{pt.value=null},ut=Je(null),ht=Je(null),gt=Je({kind:null}),mt=Je([]),ft=e=>{const n=Qn.value;if(n.length>0&&"assistant"===n[n.length-1].role){const t=n[n.length-1],r=t.progressEvents||[];let i;const l=e.id||e.progress_id;if(l){const n=r.findIndex(e=>(e.id||e.progress_id)===l);if(n>=0){const t=r[n],l="thinking"===t.kind||"step_start"===t.kind,a="active"===t.status,o="done"===e.status||"error"===e.status,s=t.metadata?._startTime,p=l&&a&&o&&s?{_durationSeconds:Math.round((Date.now()-s)/1e3)}:{},c={...t,...e,id:e.id||t.id,progress_id:e.progress_id||t.progress_id,text:t.text&&e.text?t.text+e.text:e.text??t.text,children:e.children||t.children,metadata:{...t.metadata,...e.metadata,...p}};i=[...r.slice(0,n),c,...r.slice(n+1)]}else{const n=Date.now(),t=r.map(e=>{if(!(("thinking"===e.kind||"step_start"===e.kind)&&"active"===e.status))return e;const t=e.metadata?._startTime,r=t?{_durationSeconds:Math.round((n-t)/1e3)}:{};return{...e,status:"done",metadata:{...e.metadata,...r}}});i=[...t,("thinking"===e.kind||"step_start"===e.kind)&&"active"===e.status?{...e,metadata:{...e.metadata,_startTime:n}}:e]}}else{const n=Date.now(),t=r.map(e=>{if(!(("thinking"===e.kind||"step_start"===e.kind)&&"active"===e.status))return e;const t=e.metadata?._startTime,r=t?{_durationSeconds:Math.round((n-t)/1e3)}:{};return{...e,status:"done",metadata:{...e.metadata,...r}}});i=[...t,("thinking"===e.kind||"step_start"===e.kind)&&"active"===e.status?{...e,metadata:{...e.metadata,_startTime:n}}:e]}const a=[...t.segments||[]],o=e.id&&r.some(n=>n.id===e.id);if(o)for(let n=a.length-1;n>=0;n--){const t=a[n];if("progress"!==t.type)continue;const r=t.events.findIndex(n=>n.id===e.id);if(r>=0){const l=i.find(n=>n.id===e.id);if(l){const e=[...t.events];e[r]=l,a[n]={type:"progress",events:e}}break}}else{const n=e.id?i.find(n=>n.id===e.id):i[i.length-1];if(n){const e=a[a.length-1];e&&"progress"===e.type?a[a.length-1]={type:"progress",events:[...e.events,n]}:a.push({type:"progress",events:[n]})}}Qn.value=[...n.slice(0,-1),{...t,progressEvents:i,segments:a}]}},vt=e=>{const n=Qn.value;if(0===n.length||"assistant"!==n[n.length-1].role)return;const t=n[n.length-1],r=[...t.segments||[]],i=r[r.length-1];i&&"text"===i.type?r[r.length-1]={type:"text",content:i.content+e}:r.push({type:"text",content:e}),Qn.value=[...n.slice(0,-1),{...t,segments:r,content:(t.content||"")+e}]},bt=Je(!1),_t=Je([]),xt=Je([]),yt=Je(""),wt=Je(null),kt=Je(0),St=Je(0),Ct=Je([]),Pt=Je([]),Et=Je([]),zt=Je([]),Tt=ln(()=>zt.value.some(e=>"uploading"===e.status)),It=()=>zt.value.filter(e=>"ready"===e.status&&e.url).map(e=>({url:e.url,detail:"low",path:e.path})),Mt=e=>{zt.value.length>=4||(zt.value=[...zt.value,e])},Rt=(e,n,t,r,i)=>{zt.value=zt.value.map(l=>l.id===e?{...l,status:n,url:t,error:r,path:i}:l)},$t=e=>{const n=zt.value.find(n=>n.id===e);n&&URL.revokeObjectURL(n.preview),zt.value=zt.value.filter(n=>n.id!==e)},At=()=>{zt.value.forEach(e=>URL.revokeObjectURL(e.preview)),zt.value=[]},Lt=ln(()=>Qn.value.length>0),Ht=(e,n,t)=>{Qn.value=[...Qn.value,{role:"user",content:e,userContext:n&&n.length>0?n:void 0,images:t&&t.length>0?t:void 0}]},Ot=(e,n)=>{Qn.value=[...Qn.value,{role:"assistant",content:e,id:n,progressEvents:[]}]},Dt=(e,n,t,r)=>{const i=Qn.value;if(i.length>0&&"assistant"===i[i.length-1].role){const l=i[i.length-1];Qn.value=[...i.slice(0,-1),{role:"assistant",content:void 0!==e?e:l.content,id:n??l.id,actions:t??l.actions,sources:r??l.sources,actionStatus:l.actionStatus,progressEvents:l.progressEvents,segments:l.segments}]}},jt=(e,n)=>{const t=Qn.value;if(e>=0&&e<t.length){const r=t[e],i={...r.actionStatus||{},[n]:{status:"pending"}};Qn.value=[...t.slice(0,e),{...r,actionStatus:i},...t.slice(e+1)]}},Ut=(e,n,t)=>{const r=Qn.value;for(let i=r.length-1;i>=0;i--){const l=r[i];if(l.actionStatus?.[e]){const a={...l.actionStatus,[e]:{status:n?"success":"failed",completedAt:Date.now(),errorMessage:t}};return void(Qn.value=[...r.slice(0,i),{...l,actionStatus:a},...r.slice(i+1)])}}},qt=(e,n)=>{const t=Qn.value;for(let r=t.length-1;r>=0;r--){const i=t[r];if(i.actionStatus?.[e])return void(Qn.value=[...t.slice(0,r),{...i,content:n},...t.slice(r+1)])}},Bt=e=>{Jn.value=e,it(e)},Nt=(e,n)=>{Qn.value=Qn.value.map(t=>t.id===e?{...t,feedback:n}:t)},Ft=e=>{lt.value=e},Wt=()=>{gt.value={kind:null}},Vt=()=>{const e=Qn.value;if(0===e.length)return;const n=e[e.length-1];if("assistant"!==n.role||!n.progressEvents)return;const t=n.progressEvents.some(e=>"active"===e.status);if(!t)return;const r=Date.now(),i=n.progressEvents.map(e=>{if("active"!==e.status)return e;const n=e.metadata?._startTime,t=n?{_durationSeconds:Math.round((r-n)/1e3)}:{};return{...e,status:"done",metadata:{...e.metadata,...t}}});Qn.value=[...e.slice(0,-1),{...n,progressEvents:i}]},Kt=e=>{const n=e.id||e.progress_id;if(n){const t=mt.value.findIndex(e=>(e.id||e.progress_id)===n);if(t>=0){const n=mt.value[t],r={...n,...e,id:e.id||n.id,progress_id:e.progress_id||n.progress_id,text:"thinking"===e.kind&&n.text&&e.text?n.text+e.text:e.text??n.text};mt.value=[...mt.value.slice(0,t),r,...mt.value.slice(t+1)]}else mt.value=[...mt.value,e]}else mt.value=[...mt.value,e];ft(e)},Xt=e=>{ut.value=e},Yt=()=>{ut.value=null},Zt=()=>{const e=Qn.value;if(0===e.length)return;const n=e[e.length-1],t=n.progressEvents&&n.progressEvents.length>0;"assistant"!==n.role||n.content?.trim()||t||(Qn.value=e.slice(0,-1))},Gt=e=>{wt.value=e},Qt=()=>{wt.value=null},Jt=()=>{kt.value+=1},er=()=>{St.value+=1},nr=e=>{const n={...e,id:Xn()};Ct.value=[...Ct.value,n]},tr=e=>{Ct.value=Ct.value.filter(n=>n.id!==e)},rr=()=>{Ct.value=[]},ir=e=>{Pt.value=e},lr=()=>{Pt.value=[]},ar=e=>{Et.value=e},or=()=>{Et.value=[]},sr=()=>{Qn.value=[],Jn.value=null,it(null),et.value=[],lt.value=!1,gt.value={kind:null},mt.value=[],ht.value=null,bt.value=!1,_t.value=[],xt.value=[],yt.value="",wt.value=null,kt.value=0,Ct.value=[],Pt.value=[],Et.value=[],At()},pr=()=>{sr(),st.value=!0};function cr(e){return"token_summary"===e.step_type||"tool_decision"===e.step_type||"parallel_tool_decision"===e.step_type||"narration"===e.step_type?null:"thinking"===e.step_type?{kind:"thinking",status:"done",text:e.content||"",label:"Thought",metadata:{iteration:e.iteration,timestamp_ms:e.timestamp_ms}}:"tool_result"===e.step_type?{kind:e.kind||"tool_call",status:!1===e.success?"error":"done",label:e.label||e.tool||"Result",text:e.text,children:e.children,metadata:{tool_name:e.tool,tool:e.tool,arguments:e.arguments,success:e.success,iteration:e.iteration,timestamp_ms:e.timestamp_ms}}:"step_start"===e.step_type?{kind:"step_start",status:"done",label:e.label||"Step",metadata:{iteration:e.iteration,timestamp_ms:e.timestamp_ms}}:{kind:e.step_type,status:"done",label:e.label||e.step_type,text:e.content,metadata:e}}function dr(e){if(!e||0===e.length)return;const n=[];for(const t of e)if("narration"===t.step_type){const e=t.content||"",r=n[n.length-1];r&&"text"===r.type?r.content+=e:n.push({type:"text",content:e})}else{const e=cr(t);if(!e)continue;const r=n[n.length-1];r&&"progress"===r.type?r.events.push(e):n.push({type:"progress",events:[e]})}return n.length>0?n:void 0}const ur=(e,n)=>{Jn.value=e,it(e),Qn.value=n.map(e=>({role:e.role,content:e.content,id:e.id,images:"user"===e.role&&e.images?.length?e.images:void 0,segments:"assistant"===e.role?dr(e.display_trace):void 0})),bt.value=!0,st.value=!1,nt.value+=1},hr=()=>{st.value=!1},gr=(e,n)=>{const t=(new Date).toISOString(),r={id:e,title:n,startedAt:t,lastMessageAt:t,messageCount:1};tt.value=[r,...tt.value.filter(n=>n.id!==e)],nt.value+=1},mr=async e=>{const{getApiClient:n}=await Promise.resolve().then(function(){return lo}),{navigate:t}=await Promise.resolve().then(function(){return Pr}),{debug:r}=await Promise.resolve().then(function(){return d}),i=n();if(i){pr(),t("chat");try{const n=await i.getConversation(e);n&&n.messages.length>0?ur(n.id,n.messages):hr()}catch(e){r.error("[Pillar] Failed to load conversation:",e),hr()}}};var fr=Object.freeze({__proto__:null,activeRequestId:at,addAssistantMessage:Ot,addOptimisticConversation:gr,addPendingImage:Mt,addProgressEvent:Kt,addProgressEventToLastMessage:ft,addUserContext:nr,addUserMessage:Ht,appendTokenToSegments:vt,chatError:pt,clearChatError:dt,clearInterruptedSession:Yt,clearPendingImages:At,clearPendingImagesForNavigation:or,clearPendingMessage:Qt,clearPendingUserContext:lr,clearProgressStatus:Wt,clearUserContext:rr,conversationId:Jn,currentActions:xt,currentSources:_t,finalizeActiveProgressEvents:Vt,focusInputTrigger:St,getReadyImages:It,getRegisteredActions:()=>et.value,getStoredConversationId:function(){if("undefined"==typeof window)return null;try{return localStorage.getItem(rt)}catch{return null}},hasMessages:Lt,historyInvalidationCounter:nt,interruptedSession:ut,isExpanded:bt,isLoading:lt,isLoadingHistory:st,isUploadingImages:Tt,loadConversation:ur,messages:Qn,optimisticConversations:tt,pendingImages:zt,pendingImagesForNavigation:Et,pendingMessage:wt,pendingUserContext:Pt,prefillText:yt,progressEvents:mt,progressStatus:gt,registeredActions:et,removeLastEmptyAssistantMessage:Zt,removePendingImage:$t,removeUserContext:tr,resetChat:sr,selectConversationById:mr,setActionComplete:Ut,setActionPending:jt,setActiveRequestId:ot,setChatError:ct,setConversationId:Bt,setInterruptedSession:Xt,setLoading:Ft,setMessageFeedback:Nt,setPendingImagesForNavigation:ar,setPendingMessage:Gt,setPendingUserContext:ir,setRegisteredActions:e=>{et.value=e},startLoadingHistory:pr,stopLoadingHistory:hr,submitPendingTrigger:kt,tokenUsage:ht,triggerInputFocus:er,triggerSubmitPending:Jt,updateActionMessageContent:qt,updateImageStatus:Rt,updateLastAssistantMessage:Dt,updateTokenUsage:e=>{ht.value=e},userContext:Ct});const vr=Je([]),br=Je({type:"home"}),_r=ln(()=>vr.value.length>0),xr=ln(()=>"home"===br.value.type),yr=(e,n)=>{vr.value=[...vr.value,{...br.value}],br.value={type:e,params:n}},wr=()=>{const e=vr.value;if(e.length>0){"chat"===br.value.type&&sr();const n=e[e.length-1];br.value=n,vr.value=e.slice(0,-1)}},kr=()=>{"chat"===br.value.type&&sr(),vr.value=[],br.value={type:"home"}},Sr=()=>{vr.value=[],br.value={type:"home"}},Cr=()=>{yr("chat"),Jt()};var Pr=Object.freeze({__proto__:null,canGoBack:_r,currentView:br,goBack:wr,goHome:kr,isAtHome:xr,navigate:yr,navigateToChat:Cr,resetRouter:Sr,viewStack:vr});const Er=["/* ============================================================================\n CSS Custom Properties (Variables)\n Users can override these to customize colors\n ============================================================================ */\n\n:host {\n /* Core colors - Light mode (default) */\n --pillar-primary: #2563eb;\n --pillar-primary-hover: #1d4ed8;\n --pillar-primary-light: #eff6ff;\n --pillar-primary-light-hover: #dbeafe;\n \n --pillar-bg: #ffffff;\n --pillar-bg-secondary: #f9fafb;\n --pillar-bg-tertiary: #f3f4f6;\n \n --pillar-text: #1a1a1a;\n --pillar-text-secondary: #374151;\n --pillar-text-muted: #6b7280;\n --pillar-text-placeholder: #9ca3af;\n \n --pillar-border: #e5e7eb;\n --pillar-border-light: #f3f4f6;\n \n /* Focus/outline */\n --pillar-outline-color: rgba(37, 99, 235, 0.15);\n \n /* Shadows */\n --pillar-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n \n /* Code blocks */\n --pillar-code-bg: #1f2937;\n --pillar-code-text: #e5e7eb;\n \n /* Status colors */\n --pillar-success: #059669;\n --pillar-error: #dc2626;\n --pillar-warning: #d97706;\n \n /* Status backgrounds (light tints) */\n --pillar-success-light: #ecfdf5;\n --pillar-success-border: #6ee7b7;\n --pillar-error-light: #fef2f2;\n --pillar-error-border: #fca5a5;\n --pillar-warning-light: #fef3c7;\n --pillar-warning-border: #fcd34d;\n \n /* Hover */\n --pillar-bg-hover: rgba(0, 0, 0, 0.05);\n \n /* Scrollbar */\n --pillar-scrollbar-track: transparent;\n --pillar-scrollbar-thumb: #d1d5db;\n --pillar-scrollbar-thumb-hover: #9ca3af;\n \n /* Spacing (can be customized) */\n --pillar-panel-width: 380px;\n --pillar-spacing-xs: 4px;\n --pillar-spacing-sm: 8px;\n --pillar-spacing-md: 12px;\n --pillar-spacing-lg: 16px;\n --pillar-spacing-xl: 20px;\n --pillar-spacing-2xl: 24px;\n \n /* Border radius */\n --pillar-radius-sm: 4px;\n --pillar-radius-md: 6px;\n --pillar-radius-lg: 8px;\n --pillar-radius-xl: 10px;\n --pillar-radius-full: 9999px;\n \n /* Typography */\n --pillar-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n --pillar-font-mono: 'SF Mono', Consolas, monospace;\n --pillar-font-size-xs: 11px;\n --pillar-font-size-sm: 12px;\n --pillar-font-size-base: 14px;\n --pillar-font-size-md: 15px;\n --pillar-font-size-lg: 16px;\n --pillar-font-size-xl: 18px;\n --pillar-font-size-2xl: 20px;\n \n /* Animation */\n --pillar-transition-fast: 0.15s ease;\n --pillar-transition-normal: 0.3s ease;\n}\n\n/* Dark mode - Auto-detect from system preference */\n@media (prefers-color-scheme: dark) {\n :host:not([data-theme=\"light\"]) {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-primary-light: #1e3a5f;\n --pillar-primary-light-hover: #1e4976;\n \n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-bg-tertiary: #333333;\n \n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-text-muted: #a3a3a3;\n --pillar-text-placeholder: #737373;\n \n --pillar-border: #404040;\n --pillar-border-light: #333333;\n \n --pillar-outline-color: rgba(96, 165, 250, 0.25);\n \n --pillar-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n \n --pillar-code-bg: #0d0d0d;\n --pillar-code-text: #e5e7eb;\n \n --pillar-success: #34d399;\n --pillar-error: #f87171;\n --pillar-warning: #fbbf24;\n \n --pillar-success-light: rgba(52, 211, 153, 0.1);\n --pillar-success-border: rgba(52, 211, 153, 0.3);\n --pillar-error-light: rgba(248, 113, 113, 0.1);\n --pillar-error-border: rgba(248, 113, 113, 0.3);\n --pillar-warning-light: rgba(251, 191, 36, 0.1);\n --pillar-warning-border: rgba(251, 191, 36, 0.3);\n \n --pillar-bg-hover: rgba(255, 255, 255, 0.05);\n \n --pillar-scrollbar-thumb: #525252;\n --pillar-scrollbar-thumb-hover: #737373;\n }\n}\n\n/* Dark mode - Manual override */\n:host([data-theme=\"dark\"]) {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-primary-light: #1e3a5f;\n --pillar-primary-light-hover: #1e4976;\n \n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-bg-tertiary: #333333;\n \n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-text-muted: #a3a3a3;\n --pillar-text-placeholder: #737373;\n \n --pillar-border: #404040;\n --pillar-border-light: #333333;\n \n --pillar-outline-color: rgba(96, 165, 250, 0.25);\n \n --pillar-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n \n --pillar-code-bg: #0d0d0d;\n --pillar-code-text: #e5e7eb;\n \n --pillar-success: #34d399;\n --pillar-error: #f87171;\n --pillar-warning: #fbbf24;\n \n --pillar-success-light: rgba(52, 211, 153, 0.1);\n --pillar-success-border: rgba(52, 211, 153, 0.3);\n --pillar-error-light: rgba(248, 113, 113, 0.1);\n --pillar-error-border: rgba(248, 113, 113, 0.3);\n --pillar-warning-light: rgba(251, 191, 36, 0.1);\n --pillar-warning-border: rgba(251, 191, 36, 0.3);\n \n --pillar-bg-hover: rgba(255, 255, 255, 0.05);\n \n --pillar-scrollbar-thumb: #525252;\n --pillar-scrollbar-thumb-hover: #737373;\n}\n","/* ============================================================================\n Base Styles\n Note: No CSS reset - we rely on explicit styles for SDK components\n and allow custom cards to inherit host app styling (Tailwind, etc.)\n ============================================================================ */\n\n:host {\n font-family: var(--pillar-font-family);\n font-size: var(--pillar-font-size-base);\n line-height: 1.5;\n color: var(--pillar-text);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n","/* ============================================================================\n Scrollbar Styling\n ============================================================================ */\n\n._pillar-content::-webkit-scrollbar,\n._pillar-chat-input-messages::-webkit-scrollbar {\n width: 6px;\n}\n\n._pillar-content::-webkit-scrollbar-track,\n._pillar-chat-input-messages::-webkit-scrollbar-track {\n background: var(--pillar-scrollbar-track);\n}\n\n._pillar-content::-webkit-scrollbar-thumb,\n._pillar-chat-input-messages::-webkit-scrollbar-thumb {\n background: var(--pillar-scrollbar-thumb);\n border-radius: 3px;\n}\n\n._pillar-content::-webkit-scrollbar-thumb:hover,\n._pillar-chat-input-messages::-webkit-scrollbar-thumb:hover {\n background: var(--pillar-scrollbar-thumb-hover);\n}\n","/* ============================================================================\n Panel Container\n Internal: _pillar-panel | Public: pillar-panel\n ============================================================================ */\n\n._pillar-panel {\n position: fixed;\n top: 0;\n bottom: 0;\n width: var(--pillar-panel-width);\n max-width: 100vw;\n background: var(--pillar-bg);\n border-left: 1px solid var(--pillar-border);\n display: flex;\n flex-direction: column;\n z-index: 99999;\n transform: translateX(100%);\n transition: transform var(--pillar-transition-normal);\n}\n\n._pillar-panel--right {\n right: 0;\n}\n\n._pillar-panel--left {\n left: 0;\n border-left: none;\n border-right: 1px solid var(--pillar-border);\n transform: translateX(-100%);\n}\n\n._pillar-panel--open {\n transform: translateX(0);\n}\n\n._pillar-panel--manual {\n position: static;\n transform: none;\n height: 100%;\n}\n\n._pillar-panel--full-width {\n width: 100vw;\n max-width: 100vw;\n}\n\n/* ============================================================================\n Mobile Bottom Sheet\n When viewport < mobileBreakpoint, the panel slides up from the bottom\n like an iOS sheet instead of from the side.\n ============================================================================ */\n\n._pillar-panel--mobile {\n top: auto;\n bottom: 0;\n left: 0;\n right: 0;\n width: 100vw;\n max-width: 100vw;\n height: 90dvh;\n max-height: 90dvh;\n border-left: none;\n border-right: none;\n border-top: 1px solid var(--pillar-border);\n border-radius: 16px 16px 0 0;\n overflow: hidden;\n transform: translateY(100%);\n /* iOS-style spring curve: slow start, fast middle, gentle settle */\n transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);\n}\n\n._pillar-panel--mobile._pillar-panel--open {\n transform: translateY(0);\n}\n\n\n._pillar-panel-root {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n._pillar-panel-ui {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n}\n\n/* Public override classes - empty by default */\n.pillar-panel {\n}\n.pillar-panel-root {\n}\n.pillar-panel-ui {\n}\n\n/* ============================================================================\n Backdrop\n ============================================================================ */\n\n._pillar-backdrop {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.3);\n opacity: 0;\n visibility: hidden;\n transition:\n opacity var(--pillar-transition-normal),\n visibility var(--pillar-transition-normal);\n z-index: 99998;\n}\n\n._pillar-backdrop--visible {\n opacity: 1;\n visibility: visible;\n}\n\n.pillar-backdrop {\n}\n\n/* ============================================================================\n Content Area\n Internal: _pillar-content | Public: pillar-content\n ============================================================================ */\n\n._pillar-content {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n min-height: 0;\n}\n\n.pillar-content {\n}\n\n/* ============================================================================\n Resize Handle\n Appears on the content-facing edge of the panel for drag-to-resize.\n Internal: _pillar-resize-handle | Public: pillar-resize-handle\n ============================================================================ */\n\n._pillar-resize-handle {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 6px;\n cursor: col-resize;\n z-index: 1;\n touch-action: none;\n}\n\n/* Right panel: handle on left edge */\n._pillar-panel--right ._pillar-resize-handle {\n left: -3px;\n}\n\n/* Left panel: handle on right edge */\n._pillar-panel--left ._pillar-resize-handle {\n right: -3px;\n}\n\n/* Visible indicator line on hover */\n._pillar-resize-handle::after {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n width: 3px;\n left: 50%;\n transform: translateX(-50%);\n background: transparent;\n transition: background 0.15s ease;\n border-radius: 1.5px;\n}\n\n._pillar-resize-handle:hover::after {\n background: var(--pillar-primary, #2563eb);\n opacity: 0.5;\n}\n\n/* During active resize, keep indicator visible */\n._pillar-panel--resizing ._pillar-resize-handle::after {\n background: var(--pillar-primary, #2563eb);\n opacity: 0.7;\n}\n\n/* Override cursor on the whole panel during resize */\n._pillar-panel--resizing,\n._pillar-panel--resizing * {\n cursor: col-resize !important;\n}\n\n/* Disable panel slide transition during resize for immediate feedback */\n._pillar-panel--resizing {\n transition: none !important;\n}\n\n/* Hide resize handle in mobile/full-width modes */\n._pillar-panel--mobile ._pillar-resize-handle,\n._pillar-panel--full-width ._pillar-resize-handle {\n display: none;\n}\n\n.pillar-resize-handle {\n}\n\n/* ============================================================================\n Reduced Motion\n Disable all panel and backdrop transitions when the user prefers reduced motion.\n ============================================================================ */\n\n@media (prefers-reduced-motion: reduce) {\n ._pillar-panel,\n ._pillar-panel--mobile,\n ._pillar-backdrop {\n transition: none;\n }\n}\n","/* ============================================================================\n Header\n Internal: _pillar-header | Public: pillar-header\n ============================================================================ */\n\n._pillar-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 44px;\n padding: 0 var(--pillar-spacing-md);\n flex-shrink: 0;\n background: var(--pillar-bg);\n}\n\n._pillar-panel--mobile ._pillar-header {\n position: relative;\n height: auto;\n min-height: 48px;\n padding: 20px var(--pillar-spacing-md) 8px;\n cursor: grab;\n touch-action: none;\n user-select: none;\n -webkit-user-select: none;\n}\n\n/* ---- Drag indicator (iOS-style pill) ---- */\n\n._pillar-drag-indicator {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n display: flex;\n justify-content: center;\n padding: 8px 0 0;\n pointer-events: none;\n}\n\n._pillar-drag-indicator-pill {\n width: 36px;\n height: 5px;\n border-radius: 2.5px;\n background: var(--pillar-text-muted);\n opacity: 0.35;\n}\n\n._pillar-header-left {\n display: flex;\n align-items: center;\n gap: var(--pillar-spacing-sm);\n}\n\n._pillar-header-title {\n font-size: var(--pillar-font-size-lg);\n font-weight: 600;\n color: var(--pillar-text);\n}\n\n._pillar-header-right {\n display: flex;\n align-items: center;\n gap: var(--pillar-spacing-xs);\n}\n\n/* Public override classes */\n.pillar-header {\n}\n.pillar-header-left {\n}\n.pillar-header-right {\n}\n.pillar-header-title {\n}\n.pillar-new-chat-btn {\n}\n\n/* ============================================================================\n Icon Buttons (back, home, close)\n Internal: _pillar-icon-btn | Public: pillar-icon-btn\n ============================================================================ */\n\n._pillar-icon-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: none;\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition:\n color var(--pillar-transition-fast),\n background var(--pillar-transition-fast);\n}\n\n._pillar-icon-btn:hover {\n color: var(--pillar-text);\n}\n\n._pillar-icon-btn svg {\n width: 20px;\n height: 20px;\n}\n\n.pillar-icon-btn {\n}\n.pillar-back-btn {\n}\n.pillar-home-btn {\n}\n.pillar-history-btn {\n}\n\n/* ============================================================================\n History Dropdown\n Internal: _pillar-history-* | Public: pillar-history-*\n ============================================================================ */\n\n._pillar-history-dropdown {\n position: relative;\n}\n\n._pillar-history-menu {\n position: absolute;\n top: 100%;\n right: 0;\n margin-top: var(--pillar-spacing-xs);\n width: 280px;\n max-height: 400px;\n background: var(--pillar-bg);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);\n overflow: hidden;\n z-index: 100;\n}\n\n._pillar-history-loading {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: var(--pillar-spacing-sm);\n padding: var(--pillar-spacing-xl);\n color: var(--pillar-text-muted);\n font-size: 13px;\n}\n\n._pillar-history-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--pillar-border);\n border-top-color: var(--pillar-primary);\n border-radius: 50%;\n animation: pillar-spin 0.8s linear infinite;\n}\n\n@keyframes pillar-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n._pillar-history-empty {\n padding: var(--pillar-spacing-xl);\n text-align: center;\n color: var(--pillar-text-muted);\n font-size: 13px;\n}\n\n._pillar-history-list {\n max-height: 360px;\n overflow-y: auto;\n padding: var(--pillar-spacing-xs) 0;\n}\n\n._pillar-history-group-header {\n padding: var(--pillar-spacing-xs) var(--pillar-spacing-md);\n padding-top: var(--pillar-spacing-sm);\n font-size: 10px;\n font-weight: 500;\n color: var(--pillar-text-muted);\n letter-spacing: 0.02em;\n}\n\n._pillar-history-group-header:first-child {\n padding-top: var(--pillar-spacing-xs);\n}\n\n._pillar-history-item {\n display: flex;\n align-items: center;\n width: 100%;\n padding: var(--pillar-spacing-xs) var(--pillar-spacing-md);\n background: none;\n border: none;\n text-align: left;\n cursor: pointer;\n transition: background var(--pillar-transition-fast);\n border-radius: var(--pillar-radius-sm);\n margin: 0 var(--pillar-spacing-xs);\n width: calc(100% - var(--pillar-spacing-sm));\n}\n\n._pillar-history-item:hover {\n background: var(--pillar-bg-secondary);\n}\n\n._pillar-history-item-title {\n font-size: 13px;\n color: var(--pillar-text);\n line-height: 1.4;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 100%;\n}\n\n/* ============================================================================\n History Dropdown – Mobile Overlay\n When inside a mobile panel, the dropdown becomes a full-screen overlay\n within the panel instead of a small positioned menu.\n ============================================================================ */\n\n._pillar-history-menu--mobile {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n max-width: 100%;\n height: 100%;\n max-height: 100%;\n margin-top: 0;\n border: none;\n border-radius: 0;\n box-shadow: none;\n z-index: 200;\n display: flex;\n flex-direction: column;\n}\n\n._pillar-history-mobile-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n height: 48px;\n padding: 0 var(--pillar-spacing-md);\n border-bottom: 1px solid var(--pillar-border);\n flex-shrink: 0;\n}\n\n._pillar-history-mobile-title {\n font-size: 16px;\n font-weight: 600;\n color: var(--pillar-text);\n}\n\n._pillar-history-mobile-close {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: none;\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition:\n color var(--pillar-transition-fast),\n background var(--pillar-transition-fast);\n}\n\n._pillar-history-mobile-close:hover,\n._pillar-history-mobile-close:active {\n color: var(--pillar-text);\n background: var(--pillar-bg-secondary);\n}\n\n._pillar-history-mobile-close svg {\n width: 20px;\n height: 20px;\n}\n\n/* Mobile: larger list area fills remaining space */\n._pillar-history-menu--mobile ._pillar-history-list {\n flex: 1;\n max-height: none;\n padding: var(--pillar-spacing-sm) 0;\n -webkit-overflow-scrolling: touch;\n}\n\n/* Mobile: larger group headers */\n._pillar-history-menu--mobile ._pillar-history-group-header {\n font-size: 12px;\n padding: var(--pillar-spacing-sm) var(--pillar-spacing-md);\n padding-top: var(--pillar-spacing-md);\n}\n\n._pillar-history-menu--mobile ._pillar-history-group-header:first-child {\n padding-top: var(--pillar-spacing-sm);\n}\n\n/* Mobile: larger touch targets (min 44px) */\n._pillar-history-menu--mobile ._pillar-history-item {\n min-height: 44px;\n padding: var(--pillar-spacing-sm) var(--pillar-spacing-md);\n margin: 0 var(--pillar-spacing-sm);\n width: calc(100% - var(--pillar-spacing-md));\n border-radius: var(--pillar-radius-md);\n}\n\n._pillar-history-menu--mobile ._pillar-history-item:active {\n background: var(--pillar-bg-secondary);\n}\n\n/* Mobile: slightly larger item text */\n._pillar-history-menu--mobile ._pillar-history-item-title {\n font-size: 15px;\n}\n\n/* Mobile: loading / empty states get more breathing room */\n._pillar-history-menu--mobile ._pillar-history-loading,\n._pillar-history-menu--mobile ._pillar-history-empty {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 15px;\n}\n\n/* Public override classes */\n.pillar-history-dropdown {\n}\n.pillar-history-menu {\n}\n.pillar-history-group-header {\n}\n.pillar-history-list {\n}\n.pillar-history-item {\n}\n.pillar-history-item-title {\n}\n.pillar-close-btn {\n}\n","/* ============================================================================\n Search Input\n Internal: _pillar-search | Public: pillar-search\n ============================================================================ */\n\n._pillar-search {\n position: relative;\n padding: var(--pillar-spacing-lg) var(--pillar-spacing-xl);\n}\n\n._pillar-search-input {\n width: 100%;\n padding: 10px 12px 10px 40px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n color: var(--pillar-text);\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n outline: none;\n transition: border-color var(--pillar-transition-fast), box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-search-input:focus {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-search-input::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-search-icon {\n position: absolute;\n left: 32px;\n top: 50%;\n transform: translateY(-50%);\n width: 18px;\n height: 18px;\n color: var(--pillar-text-placeholder);\n pointer-events: none;\n}\n\n._pillar-search-icon svg {\n width: 18px;\n height: 18px;\n}\n\n.pillar-search {}\n.pillar-search-input {}\n.pillar-search-icon {}\n\n/* ============================================================================\n Chat Input (Persistent Bottom)\n Internal: _pillar-chat-input | Public: pillar-chat-input\n ============================================================================ */\n\n._pillar-chat-input-container {\n flex-shrink: 0;\n border-top: 1px solid var(--pillar-border);\n background: var(--pillar-bg);\n display: flex;\n flex-direction: column;\n max-height: 50%;\n transition: max-height var(--pillar-transition-normal);\n}\n\n._pillar-chat-input-container--expanded {\n max-height: 60%;\n}\n\n._pillar-chat-input-messages {\n flex: 1;\n overflow-y: auto;\n padding: 0;\n max-height: 0;\n transition: max-height var(--pillar-transition-normal), padding var(--pillar-transition-normal);\n}\n\n._pillar-chat-input-container--expanded ._pillar-chat-input-messages {\n max-height: 300px;\n padding: var(--pillar-spacing-lg) var(--pillar-spacing-xl);\n}\n\n._pillar-chat-input-message {\n margin-bottom: var(--pillar-spacing-md);\n}\n\n._pillar-chat-input-message--user {\n text-align: right;\n}\n\n._pillar-chat-input-message-content {\n display: inline-block;\n max-width: 85%;\n padding: 10px 14px;\n border-radius: var(--pillar-spacing-lg);\n font-size: var(--pillar-font-size-base);\n line-height: 1.5;\n}\n\n._pillar-chat-input-message--user ._pillar-chat-input-message-content {\n background: var(--pillar-primary);\n color: #ffffff;\n border-bottom-right-radius: var(--pillar-radius-sm);\n}\n\n._pillar-chat-input-message--assistant ._pillar-chat-input-message-content {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text);\n border-bottom-left-radius: var(--pillar-radius-sm);\n}\n\n._pillar-chat-input-sources {\n margin-top: var(--pillar-spacing-sm);\n padding-top: var(--pillar-spacing-sm);\n border-top: 1px solid var(--pillar-border);\n}\n\n._pillar-chat-input-sources-title {\n font-size: var(--pillar-font-size-xs);\n font-weight: 500;\n color: var(--pillar-text-muted);\n margin-bottom: 6px;\n}\n\n._pillar-chat-input-source {\n display: block;\n padding: 6px 10px;\n margin-bottom: var(--pillar-spacing-xs);\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-primary);\n background: var(--pillar-primary-light);\n border-radius: var(--pillar-radius-md);\n text-decoration: none;\n cursor: pointer;\n}\n\n._pillar-chat-input-source:hover {\n background: var(--pillar-primary-light-hover);\n}\n\n._pillar-chat-input-area {\n padding: var(--pillar-spacing-md) var(--pillar-spacing-lg);\n}\n\n._pillar-chat-input-wrapper {\n display: flex;\n flex-direction: column;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-xl);\n transition: border-color var(--pillar-transition-fast), box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-chat-input-wrapper:focus-within {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-chat-input-textarea {\n display: block;\n width: 100%;\n padding: 12px 14px 8px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n line-height: 1.5;\n color: var(--pillar-text);\n background: transparent;\n border: none;\n outline: none;\n resize: none;\n overflow-y: hidden;\n box-sizing: border-box;\n}\n\n._pillar-chat-input-textarea::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-chat-input-container {}\n.pillar-chat-input-messages {}\n.pillar-chat-input-message {}\n.pillar-chat-input-message-content {}\n.pillar-chat-input-sources {}\n.pillar-chat-input-area {}\n.pillar-chat-input-wrapper {}\n.pillar-chat-input-textarea {}\n\n/* ============================================================================\n Chat Input Footer (contains send button)\n ============================================================================ */\n\n._pillar-chat-input-footer {\n display: flex;\n justify-content: flex-end;\n padding: 8px 10px;\n}\n\n/* ============================================================================\n Send Button - In footer row, right aligned\n Internal: _pillar-send-btn | Public: pillar-send-btn\n ============================================================================ */\n\n._pillar-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-tertiary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-send-btn:hover:not(:disabled) {\n color: #ffffff;\n background: var(--pillar-primary);\n}\n\n._pillar-send-btn:disabled {\n color: var(--pillar-text-placeholder);\n background: var(--pillar-bg-tertiary);\n cursor: not-allowed;\n}\n\n._pillar-send-btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-send-btn {}\n.pillar-chat-input-footer {}\n\n/* ============================================================================\n Chat Image Upload\n ============================================================================ */\n\n._pillar-chat-view-input-area--dragging {\n position: relative;\n background: var(--pillar-primary-light);\n}\n\n._pillar-chat-drop-overlay {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: var(--pillar-primary-light);\n border: 2px dashed var(--pillar-primary);\n border-radius: var(--pillar-radius-lg);\n color: var(--pillar-primary);\n font-size: var(--pillar-font-size-sm);\n font-weight: 500;\n z-index: 10;\n pointer-events: none;\n}\n\n._pillar-chat-drop-overlay svg {\n width: 24px;\n height: 24px;\n}\n\n._pillar-chat-images-preview {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n padding: 12px 12px 4px 12px;\n}\n\n._pillar-chat-image-thumb {\n position: relative;\n width: 56px;\n height: 56px;\n border-radius: var(--pillar-radius-md);\n overflow: hidden;\n border: 1px solid var(--pillar-border);\n}\n\n._pillar-chat-image-thumb img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n._pillar-chat-image-loading {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n._pillar-chat-image-error {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(239, 68, 68, 0.3);\n color: #dc2626;\n font-weight: bold;\n font-size: 14px;\n}\n\n._pillar-chat-image-remove {\n position: absolute;\n top: 2px;\n right: 2px;\n width: 18px;\n height: 18px;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.6);\n border: none;\n border-radius: 50%;\n color: white;\n cursor: pointer;\n opacity: 0;\n transition: opacity var(--pillar-transition-fast);\n}\n\n._pillar-chat-image-thumb:hover ._pillar-chat-image-remove {\n opacity: 1;\n}\n\n._pillar-chat-image-remove svg {\n width: 10px;\n height: 10px;\n}\n\n._pillar-chat-image-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: transparent;\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: color var(--pillar-transition-fast);\n}\n\n._pillar-chat-image-btn:hover:not(:disabled) {\n color: var(--pillar-text);\n}\n\n._pillar-chat-image-btn:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n._pillar-chat-image-btn svg {\n width: 18px;\n height: 18px;\n}\n\n.pillar-chat-images-preview {}\n.pillar-chat-image-thumb {}\n.pillar-chat-image-remove {}\n.pillar-chat-image-btn {}\n.pillar-chat-drop-overlay {}\n","/* ============================================================================\n Unified Chat Input\n Internal: _pillar-unified-input | Public: pillar-unified-input\n Reusable input component with context tag support\n ============================================================================ */\n\n._pillar-unified-input-wrapper {\n display: flex;\n flex-direction: column;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-xl);\n transition:\n border-color var(--pillar-transition-fast),\n box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-unified-input-wrapper:focus-within {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-unified-input {\n display: block;\n width: 100%;\n padding: 12px 14px 8px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n line-height: 1.5;\n color: var(--pillar-text);\n background: transparent;\n border: none;\n outline: none;\n resize: none;\n overflow-y: hidden;\n box-sizing: border-box;\n}\n\n._pillar-unified-input::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-unified-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n._pillar-unified-input-row {\n display: flex;\n justify-content: flex-end;\n align-items: flex-end;\n padding: 4px 8px 0px 8px;\n}\n\n._pillar-unified-input-actions {\n padding-bottom: 8px;\n}\n\n._pillar-unified-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: #ffffff;\n background: var(--pillar-primary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-unified-send-btn:hover:not(:disabled) {\n background: var(--pillar-primary-hover);\n}\n\n._pillar-unified-send-btn:disabled {\n color: var(--pillar-text-placeholder);\n background: var(--pillar-bg-tertiary);\n cursor: not-allowed;\n}\n\n._pillar-unified-send-btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-unified-input-wrapper {\n}\n.pillar-unified-input {\n}\n.pillar-unified-input-row {\n}\n.pillar-unified-send-btn {\n}\n\n._pillar-unified-stop-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-tertiary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-unified-stop-btn:hover {\n opacity: 0.9;\n}\n\n._pillar-unified-stop-btn svg {\n width: 18px;\n height: 18px;\n}\n\n.pillar-unified-stop-btn {\n}\n","/* ============================================================================\n Context Tags\n Internal: _pillar-context-tag | Public: pillar-context-tag\n Removable chips for user context items (highlighted text, etc.)\n ============================================================================ */\n\n._pillar-context-tag-list {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n padding: 8px 14px 0;\n}\n\n._pillar-context-tag {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n max-width: 200px;\n padding: 4px 6px 4px 8px;\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-secondary);\n background: var(--pillar-bg-tertiary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-md);\n cursor: default;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-context-tag:hover {\n background: var(--pillar-bg-secondary);\n border-color: var(--pillar-text-muted);\n}\n\n._pillar-context-tag-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n color: var(--pillar-primary);\n}\n\n._pillar-context-tag-icon svg {\n width: 12px;\n height: 12px;\n}\n\n._pillar-context-tag-label {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: 1.3;\n}\n\n._pillar-context-tag-remove {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n padding: 0;\n margin-left: 2px;\n color: var(--pillar-text-placeholder);\n background: transparent;\n border: none;\n border-radius: var(--pillar-radius-sm);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-context-tag-remove:hover {\n color: var(--pillar-text);\n background: var(--pillar-border);\n}\n\n._pillar-context-tag-remove svg {\n width: 12px;\n height: 12px;\n}\n\n.pillar-context-tag-list {}\n.pillar-context-tag {}\n.pillar-context-tag-icon {}\n.pillar-context-tag-label {}\n.pillar-context-tag-remove {}\n\n/* Context tags inside user message bubbles need inverted colors */\n._pillar-message-user ._pillar-context-tag-list {\n padding: 0 0 8px 0;\n}\n\n._pillar-message-user ._pillar-context-tag {\n background: rgba(255, 255, 255, 0.2);\n border-color: rgba(255, 255, 255, 0.3);\n color: #ffffff;\n}\n\n._pillar-message-user ._pillar-context-tag:hover {\n background: rgba(255, 255, 255, 0.3);\n border-color: rgba(255, 255, 255, 0.4);\n}\n\n._pillar-message-user ._pillar-context-tag-icon {\n color: #ffffff;\n}\n\n._pillar-message-user ._pillar-context-tag-label {\n color: #ffffff;\n}\n","/* Task Button Component */\n.pillar-task-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 14px;\n font-size: 13px;\n font-weight: 500;\n font-family: inherit;\n border-radius: 8px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: 1px solid transparent;\n text-decoration: none;\n}\n\n.pillar-task-btn__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.pillar-task-btn__icon svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-task-btn__label {\n white-space: nowrap;\n}\n\n/* Primary variant (default) */\n.pillar-task-btn--primary {\n background: var(--pillar-primary);\n color: #ffffff;\n border-color: var(--pillar-primary);\n}\n\n.pillar-task-btn--primary:hover {\n background: var(--pillar-primary-hover);\n border-color: var(--pillar-primary-hover);\n}\n\n/* Default variant */\n.pillar-task-btn--default {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text);\n border-color: var(--pillar-border);\n}\n\n.pillar-task-btn--default:hover {\n background: var(--pillar-border);\n}\n\n/* Secondary variant */\n.pillar-task-btn--secondary {\n background: var(--pillar-primary-light);\n color: var(--pillar-primary);\n border-color: var(--pillar-primary-light-hover);\n}\n\n.pillar-task-btn--secondary:hover {\n background: var(--pillar-primary-light-hover);\n}\n\n/* Outline variant */\n.pillar-task-btn--outline {\n background: transparent;\n color: var(--pillar-primary);\n border-color: var(--pillar-primary);\n}\n\n.pillar-task-btn--outline:hover {\n background: var(--pillar-primary-light);\n}\n\n/* Ghost variant */\n.pillar-task-btn--ghost {\n background: transparent;\n color: var(--pillar-text-muted);\n border-color: transparent;\n}\n\n.pillar-task-btn--ghost:hover {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text);\n}\n\n/* Active state for inline_ui buttons with expanded card */\n.pillar-task-btn--active {\n background: var(--pillar-primary-hover);\n border-color: var(--pillar-primary-hover);\n}\n\n/* Task button group */\n.pillar-task-btn-group {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-top: 12px;\n}\n\n/* Inline card container for inline_ui actions */\n.pillar-task-btn-inline-card {\n margin-top: 12px;\n animation: pillar-slide-down 0.15s ease-out;\n}\n\n@keyframes pillar-slide-down {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Task suggestion card in chat */\n.pillar-task-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 12px;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: 12px;\n margin-top: 12px;\n}\n\n.pillar-task-suggestion__header {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 11px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: var(--pillar-text-muted);\n}\n\n.pillar-task-suggestion__header svg {\n width: 14px;\n height: 14px;\n}\n\n.pillar-task-suggestion__description {\n font-size: 13px;\n color: var(--pillar-text-secondary);\n}\n","/* Workflow Checklist Container */\n.pillar-workflow {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: 12px;\n margin: 12px 0;\n}\n\n/* Header */\n.pillar-workflow__header {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.pillar-workflow__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--pillar-text-muted);\n}\n\n.pillar-workflow__title {\n flex: 1;\n font-size: 14px;\n font-weight: 600;\n color: var(--pillar-text);\n}\n\n.pillar-workflow__progress {\n font-size: 12px;\n font-weight: 500;\n color: var(--pillar-text-muted);\n padding: 2px 8px;\n background: var(--pillar-border);\n border-radius: 10px;\n}\n\n.pillar-workflow__description {\n font-size: 13px;\n color: var(--pillar-text-muted);\n}\n\n/* Steps List */\n.pillar-workflow__steps {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n/* Individual Step */\n.pillar-workflow-step {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 10px 12px;\n background: var(--pillar-bg);\n border: 1px solid var(--pillar-border);\n border-radius: 8px;\n transition: all 0.15s ease;\n}\n\n.pillar-workflow-step__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 24px;\n height: 24px;\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-workflow-step__icon svg {\n width: 18px;\n height: 18px;\n}\n\n.pillar-workflow-step__content {\n flex: 1;\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.pillar-workflow-step__label {\n font-size: 13px;\n font-weight: 500;\n color: var(--pillar-text-secondary);\n}\n\n.pillar-workflow-step__note {\n font-size: 12px;\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-workflow-step__status-text {\n font-size: 12px;\n color: var(--pillar-primary);\n font-style: italic;\n}\n\n.pillar-workflow-step__actions {\n display: flex;\n gap: 8px;\n margin-top: 4px;\n}\n\n/* Step States */\n.pillar-workflow-step--pending {\n opacity: 0.6;\n}\n\n.pillar-workflow-step--awaiting_initiation {\n background: var(--pillar-warning-light);\n border-color: var(--pillar-warning-border);\n}\n\n.pillar-workflow-step--awaiting_initiation .pillar-workflow-step__icon {\n color: var(--pillar-warning);\n}\n\n.pillar-workflow-step--active {\n background: var(--pillar-primary-light);\n border-color: var(--pillar-primary);\n}\n\n.pillar-workflow-step--active .pillar-workflow-step__icon {\n color: var(--pillar-primary);\n}\n\n.pillar-workflow-step--completed .pillar-workflow-step__icon {\n color: var(--pillar-success);\n}\n\n.pillar-workflow-step--completed .pillar-workflow-step__label {\n text-decoration: line-through;\n color: var(--pillar-text-muted);\n}\n\n.pillar-workflow-step--skipped {\n opacity: 0.5;\n}\n\n.pillar-workflow-step--skipped .pillar-workflow-step__icon {\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-workflow-step--skipped .pillar-workflow-step__label {\n text-decoration: line-through;\n color: var(--pillar-text-placeholder);\n}\n\n.pillar-workflow-step--failed {\n background: var(--pillar-error-light);\n border-color: var(--pillar-error-border);\n}\n\n.pillar-workflow-step--failed .pillar-workflow-step__icon {\n color: var(--pillar-error);\n}\n\n/* Start Button */\n.pillar-workflow-step__start-btn {\n display: inline-flex;\n align-items: center;\n padding: 6px 12px;\n font-size: 12px;\n font-weight: 600;\n font-family: inherit;\n background: var(--pillar-primary);\n color: #ffffff;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.pillar-workflow-step__start-btn:hover {\n background: var(--pillar-primary-hover);\n}\n\n/* Skip Button */\n.pillar-workflow-step__skip-btn {\n display: inline-flex;\n align-items: center;\n padding: 6px 12px;\n font-size: 12px;\n font-weight: 500;\n font-family: inherit;\n background: transparent;\n color: var(--pillar-text-muted);\n border: 1px solid var(--pillar-border);\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.pillar-workflow-step__skip-btn:hover {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text-secondary);\n}\n\n/* Spinner Animation for Active Step */\n@keyframes pillar-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n.pillar-workflow-step__spinner {\n animation: pillar-spin 1s linear infinite;\n}\n\n/* Footer */\n.pillar-workflow__footer {\n display: flex;\n justify-content: flex-end;\n padding-top: 8px;\n border-top: 1px solid var(--pillar-border);\n}\n\n.pillar-workflow__cancel-btn {\n padding: 6px 12px;\n font-size: 12px;\n font-weight: 500;\n font-family: inherit;\n background: transparent;\n color: var(--pillar-text-placeholder);\n border: none;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.pillar-workflow__cancel-btn:hover {\n color: var(--pillar-error);\n}\n","/* ============================================================================\n Home View\n ============================================================================ */\n\n._pillar-home-view {\n display: flex;\n flex-direction: column;\n height: 100%;\n padding: var(--pillar-spacing-xl);\n}\n\n._pillar-home-view-header {\n text-align: center;\n padding: var(--pillar-spacing-2xl) 0;\n}\n\n._pillar-home-view-icon {\n font-size: 40px;\n margin-bottom: var(--pillar-spacing-md);\n}\n\n._pillar-home-view-title {\n font-size: var(--pillar-font-size-xl);\n font-weight: 600;\n color: var(--pillar-text);\n margin: 0;\n}\n\n._pillar-home-view-questions {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-sm);\n margin-bottom: var(--pillar-spacing-md);\n}\n\n._pillar-home-view-input-wrapper {\n margin-top: auto;\n display: flex;\n flex-direction: column;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-xl);\n transition: border-color var(--pillar-transition-fast), box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-home-view-input-wrapper:focus-within {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-home-view-input {\n display: block;\n width: 100%;\n padding: 12px 14px 8px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n line-height: 1.5;\n color: var(--pillar-text);\n background: transparent;\n border: none;\n outline: none;\n resize: none;\n overflow-y: hidden;\n box-sizing: border-box;\n}\n\n._pillar-home-view-input::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-home-view-input-row {\n display: flex;\n justify-content: flex-end;\n padding: 8px 10px;\n}\n\n._pillar-home-view-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-tertiary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-home-view-send-btn:hover:not(:disabled) {\n color: #ffffff;\n background: var(--pillar-primary);\n}\n\n._pillar-home-view-send-btn:disabled {\n color: var(--pillar-text-placeholder);\n background: var(--pillar-bg-tertiary);\n cursor: not-allowed;\n}\n\n._pillar-home-view-send-btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-home-view {}\n.pillar-home-view-header {}\n.pillar-home-view-title {}\n.pillar-home-view-questions {}\n.pillar-home-view-input-wrapper {}\n.pillar-home-view-input {}\n.pillar-home-view-send-btn {}\n","/* ============================================================================\n Standalone Chat View\n Internal: _pillar-chat-view | Public: pillar-chat-view\n ============================================================================ */\n\n._pillar-chat-view {\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n}\n\n._pillar-chat-view-messages {\n flex: 1;\n overflow-y: auto;\n padding: var(--pillar-spacing-xl);\n display: flex;\n flex-direction: column;\n}\n\n._pillar-chat-view-welcome {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n padding: var(--pillar-spacing-xl);\n text-align: center;\n}\n\n._pillar-chat-view-welcome-icon {\n font-size: 48px;\n margin-bottom: var(--pillar-spacing-lg);\n}\n\n._pillar-chat-view-welcome-title {\n font-size: var(--pillar-font-size-xl);\n font-weight: 600;\n color: var(--pillar-text);\n margin-bottom: var(--pillar-spacing-sm);\n}\n\n._pillar-chat-view-welcome-text {\n font-size: var(--pillar-font-size-base);\n color: var(--pillar-text-muted);\n max-width: 280px;\n}\n\n/* History Loading Skeleton */\n._pillar-chat-history-loading {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-lg);\n padding: var(--pillar-spacing-md) 0;\n}\n\n._pillar-chat-history-loading-message {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-xs);\n}\n\n._pillar-chat-history-loading-message--user {\n align-items: flex-end;\n}\n\n._pillar-chat-history-loading-message--assistant {\n align-items: flex-start;\n}\n\n._pillar-chat-history-loading-bar {\n height: 16px;\n border-radius: var(--pillar-radius-md);\n background: linear-gradient(90deg, var(--pillar-bg-secondary) 25%, var(--pillar-border) 50%, var(--pillar-bg-secondary) 75%);\n background-size: 200% 100%;\n animation: pillar-shimmer 1.5s infinite;\n}\n\n._pillar-chat-history-loading-message--user ._pillar-chat-history-loading-bar {\n background: linear-gradient(90deg, var(--pillar-bg-secondary) 25%, var(--pillar-border) 50%, var(--pillar-bg-secondary) 75%);\n background-size: 200% 100%;\n animation: pillar-shimmer 1.5s infinite;\n}\n\n.pillar-chat-history-loading {}\n.pillar-chat-history-loading-message--user {}\n.pillar-chat-history-loading-message--assistant {}\n.pillar-chat-history-loading-bar {}\n\n._pillar-chat-view-message {\n margin-bottom: var(--pillar-spacing-lg);\n}\n\n._pillar-chat-view-message--user {\n text-align: right;\n}\n\n._pillar-chat-view-message--assistant {\n text-align: left;\n}\n\n.pillar-chat-view {}\n.pillar-chat-view-messages {}\n.pillar-chat-view-welcome {}\n.pillar-chat-view-message {}\n\n/* ============================================================================\n User Message Bubble\n Internal: _pillar-message-user | Public: pillar-message-user\n ============================================================================ */\n\n._pillar-message-user {\n display: inline-block;\n max-width: 85%;\n padding: 10px 14px;\n border-radius: var(--pillar-spacing-lg);\n border-bottom-right-radius: var(--pillar-radius-sm);\n font-size: var(--pillar-font-size-base);\n line-height: 1.5;\n background: var(--pillar-primary);\n color: #ffffff;\n white-space: pre-wrap;\n text-align: left;\n word-wrap: break-word;\n}\n\n._pillar-message-user-images {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-bottom: var(--pillar-spacing-sm);\n}\n\n._pillar-message-user-image {\n max-width: 120px;\n max-height: 120px;\n border-radius: var(--pillar-radius-md);\n object-fit: cover;\n}\n\n.pillar-message-user {}\n.pillar-message-user-images {}\n.pillar-message-user-image {}\n\n/* ============================================================================\n AI Response\n Internal: _pillar-message-assistant | Public: pillar-message-assistant\n ============================================================================ */\n\n._pillar-message-assistant {\n font-size: var(--pillar-font-size-base);\n line-height: 1.45;\n color: var(--pillar-text-secondary);\n}\n\n._pillar-message-assistant p {\n margin: 0 0 var(--pillar-spacing-sm);\n}\n\n._pillar-message-assistant p:last-child {\n margin-bottom: 0;\n}\n\n._pillar-message-assistant h2 {\n font-size: var(--pillar-font-size-lg);\n font-weight: 600;\n color: var(--pillar-text);\n margin: var(--pillar-spacing-md) 0 var(--pillar-spacing-xs);\n}\n\n._pillar-message-assistant h3 {\n font-size: var(--pillar-font-size-md);\n font-weight: 600;\n color: var(--pillar-text);\n margin: 10px 0 4px;\n}\n\n._pillar-message-assistant h4 {\n font-size: var(--pillar-font-size-base);\n font-weight: 600;\n color: var(--pillar-text);\n margin: var(--pillar-spacing-sm) 0 4px;\n}\n\n._pillar-message-assistant ul,\n._pillar-message-assistant ol {\n margin: 0 0 var(--pillar-spacing-sm);\n padding-left: var(--pillar-spacing-2xl);\n list-style-position: outside;\n}\n\n._pillar-message-assistant ul {\n list-style-type: disc;\n}\n\n._pillar-message-assistant ol {\n list-style-type: decimal;\n}\n\n._pillar-message-assistant li {\n margin-bottom: 2px;\n}\n\n._pillar-message-assistant code {\n padding: 2px 6px;\n font-size: var(--pillar-font-size-sm);\n background: var(--pillar-bg-tertiary);\n border-radius: var(--pillar-radius-sm);\n font-family: var(--pillar-font-mono);\n color: var(--pillar-text);\n}\n\n._pillar-message-assistant pre {\n margin: var(--pillar-spacing-md) 0;\n padding: var(--pillar-spacing-md) 14px;\n background: var(--pillar-code-bg);\n border-radius: var(--pillar-radius-lg);\n overflow-x: auto;\n}\n\n._pillar-message-assistant pre code {\n padding: 0;\n background: none;\n color: var(--pillar-code-text);\n font-size: var(--pillar-font-size-sm);\n line-height: 1.5;\n}\n\n._pillar-message-assistant a {\n color: var(--pillar-primary);\n text-decoration: none;\n}\n\n._pillar-message-assistant a:hover {\n text-decoration: underline;\n}\n\n._pillar-message-assistant strong {\n font-weight: 600;\n color: var(--pillar-text);\n}\n\n._pillar-message-assistant em {\n font-style: italic;\n}\n\n.pillar-message-assistant {}\n\n/* ============================================================================\n Chat Sources\n Internal: _pillar-chat-sources | Public: pillar-chat-sources\n ============================================================================ */\n\n._pillar-chat-sources {\n margin-top: var(--pillar-spacing-md);\n padding-top: var(--pillar-spacing-md);\n border-top: 1px solid var(--pillar-border);\n}\n\n._pillar-chat-sources-title {\n font-size: var(--pillar-font-size-xs);\n font-weight: 500;\n color: var(--pillar-text-muted);\n margin-bottom: var(--pillar-spacing-sm);\n}\n\n._pillar-chat-source {\n display: block;\n padding: var(--pillar-spacing-sm) var(--pillar-spacing-md);\n margin-bottom: 6px;\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-primary);\n background: var(--pillar-primary-light);\n border-radius: var(--pillar-radius-lg);\n text-decoration: none;\n cursor: pointer;\n transition: background var(--pillar-transition-fast);\n}\n\n._pillar-chat-source:hover {\n background: var(--pillar-primary-light-hover);\n}\n\n.pillar-chat-sources {}\n.pillar-chat-sources-title {}\n.pillar-chat-source {}\n\n/* ============================================================================\n Chat Actions (Suggested action buttons)\n Internal: _pillar-chat-actions | Public: pillar-chat-actions\n ============================================================================ */\n\n._pillar-chat-actions {\n margin-top: var(--pillar-spacing-md);\n padding-top: var(--pillar-spacing-md);\n border-top: 1px solid var(--pillar-border);\n}\n\n._pillar-chat-actions-title {\n font-size: var(--pillar-font-size-xs);\n font-weight: 500;\n color: var(--pillar-text-muted);\n margin-bottom: var(--pillar-spacing-sm);\n}\n\n._pillar-chat-actions-buttons {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-sm);\n}\n\n/* Task buttons should wrap horizontally */\n._pillar-chat-actions-buttons > ._pillar-task-button-group {\n display: flex;\n flex-wrap: wrap;\n gap: var(--pillar-spacing-sm);\n}\n\n/* Confirm cards take full width */\n._pillar-chat-actions-buttons > .pillar-confirm-card-wrapper {\n width: 100%;\n}\n\n.pillar-chat-actions {}\n.pillar-chat-actions-title {}\n.pillar-chat-actions-buttons {}\n\n/* ============================================================================\n Chat View Input Area - Cursor-style design\n ============================================================================ */\n\n._pillar-chat-view-input-area {\n flex-shrink: 0;\n padding: 0 var(--pillar-spacing-xl) var(--pillar-spacing-xl);\n background: var(--pillar-bg);\n}\n\n._pillar-chat-view-input-wrapper {\n display: flex;\n flex-direction: column;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-xl);\n transition: border-color var(--pillar-transition-fast), box-shadow var(--pillar-transition-fast);\n}\n\n._pillar-chat-view-input-wrapper:focus-within {\n border-color: var(--pillar-primary);\n box-shadow: 0 0 0 3px var(--pillar-outline-color);\n}\n\n._pillar-chat-view-input {\n display: block;\n width: 100%;\n padding: 12px 14px 8px;\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n line-height: 1.5;\n color: var(--pillar-text);\n background: transparent;\n border: none;\n outline: none;\n resize: none;\n overflow-y: hidden;\n box-sizing: border-box;\n}\n\n._pillar-chat-view-input::placeholder {\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-chat-view-input-row {\n display: flex;\n justify-content: flex-end;\n padding: 8px 10px;\n}\n\n._pillar-chat-view-send-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-tertiary);\n border: none;\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n flex-shrink: 0;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-chat-view-send-btn:hover:not(:disabled) {\n color: #ffffff;\n background: var(--pillar-primary);\n}\n\n._pillar-chat-view-send-btn:active:not(:disabled) {\n transform: scale(0.95);\n}\n\n._pillar-chat-view-send-btn:disabled {\n color: var(--pillar-text-placeholder);\n background: var(--pillar-bg-tertiary);\n cursor: not-allowed;\n}\n\n._pillar-chat-view-send-btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-chat-view-input-area {}\n.pillar-chat-view-input-wrapper {}\n.pillar-chat-view-input {}\n.pillar-chat-view-send-btn {}\n.pillar-chat-view-input-footer {}\n.pillar-chat-view-new-chat-btn {}\n\n/* New chat button styling */\n._pillar-chat-view-input-footer {\n display: flex;\n justify-content: center;\n margin-top: var(--pillar-spacing-sm);\n}\n\n._pillar-chat-view-new-chat-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 6px 12px;\n font-size: var(--pillar-font-size-sm);\n font-weight: 500;\n font-family: var(--pillar-font-family);\n color: var(--pillar-text-muted);\n background: transparent;\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-chat-view-new-chat-btn:hover {\n color: var(--pillar-text);\n background: var(--pillar-bg-secondary);\n border-color: var(--pillar-text-muted);\n}\n\n._pillar-chat-view-new-chat-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n._pillar-chat-view-new-chat-icon svg {\n width: 14px;\n height: 14px;\n}\n\n/* Scrollbar for chat view */\n._pillar-chat-view-messages::-webkit-scrollbar {\n width: 6px;\n}\n\n._pillar-chat-view-messages::-webkit-scrollbar-track {\n background: var(--pillar-scrollbar-track);\n}\n\n._pillar-chat-view-messages::-webkit-scrollbar-thumb {\n background: var(--pillar-scrollbar-thumb);\n border-radius: 3px;\n}\n\n._pillar-chat-view-messages::-webkit-scrollbar-thumb:hover {\n background: var(--pillar-scrollbar-thumb-hover);\n}\n\n/* ============================================================================\n Feedback Icons\n Internal: _pillar-feedback | Public: pillar-feedback\n ============================================================================ */\n\n._pillar-message-assistant-wrapper {\n position: relative;\n}\n\n._pillar-feedback-icons {\n display: flex;\n gap: 4px;\n margin-top: var(--pillar-spacing-sm);\n justify-content: flex-start;\n}\n\n._pillar-feedback-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n background: transparent;\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n color: var(--pillar-text-placeholder);\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-feedback-btn:hover {\n color: var(--pillar-text-muted);\n background: var(--pillar-bg-secondary);\n border-color: var(--pillar-border);\n}\n\n._pillar-feedback-btn--active {\n color: var(--pillar-primary);\n background: var(--pillar-primary-light);\n border-color: var(--pillar-primary);\n}\n\n._pillar-feedback-btn--active:hover {\n color: var(--pillar-primary);\n background: var(--pillar-primary-light-hover);\n}\n\n._pillar-feedback-btn svg {\n width: 14px;\n height: 14px;\n}\n\n.pillar-feedback-icons {}\n.pillar-feedback-btn {}\n.pillar-message-assistant-wrapper {}\n\n/* ============================================================================\n Action Status Indicators\n Internal: _pillar-action-status | Public: pillar-action-status\n Shows completion status for auto-run actions (checkmark, X, or spinner)\n ============================================================================ */\n\n._pillar-message-assistant-content {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n}\n\n._pillar-action-status {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n margin-top: 2px;\n}\n\n._pillar-action-status-indicator {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n}\n\n._pillar-action-status-indicator svg {\n width: 16px;\n height: 16px;\n}\n\n._pillar-action-status-indicator--success {\n color: var(--pillar-success);\n}\n\n._pillar-action-status-indicator--failed {\n color: var(--pillar-error);\n}\n\n._pillar-action-status-indicator--pending {\n color: var(--pillar-text-muted);\n animation: pillar-spin 1s linear infinite;\n}\n\n@keyframes pillar-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n\n.pillar-action-status {}\n.pillar-action-status-indicator {}\n.pillar-message-assistant-content {}\n","/* ============================================================================\n Resume Prompt (Session Resumption)\n Internal: _pillar-resume-prompt | Public: pillar-resume-prompt\n Shows when user reconnects and has an interrupted session to resume\n ============================================================================ */\n\n._pillar-resume-prompt {\n display: flex;\n flex-direction: column;\n gap: var(--pillar-spacing-md);\n padding: var(--pillar-spacing-lg);\n margin: var(--pillar-spacing-md) 0;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n}\n\n._pillar-resume-prompt--seamless {\n flex-direction: row;\n align-items: center;\n gap: var(--pillar-spacing-sm);\n padding: var(--pillar-spacing-md) var(--pillar-spacing-lg);\n background: transparent;\n border: none;\n justify-content: center;\n}\n\n._pillar-resume-prompt-spinner {\n width: 16px;\n height: 16px;\n border: 2px solid var(--pillar-border);\n border-top-color: var(--pillar-primary);\n border-radius: 50%;\n animation: pillar-spin 0.8s linear infinite;\n flex-shrink: 0;\n}\n\n._pillar-resume-prompt-text {\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-muted);\n font-style: italic;\n}\n\n._pillar-resume-prompt-content {\n display: flex;\n gap: var(--pillar-spacing-md);\n align-items: flex-start;\n}\n\n._pillar-resume-prompt-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n flex-shrink: 0;\n color: var(--pillar-primary);\n background: var(--pillar-primary-light);\n border-radius: var(--pillar-radius-md);\n}\n\n._pillar-resume-prompt-body {\n flex: 1;\n min-width: 0;\n}\n\n._pillar-resume-prompt-title {\n font-size: var(--pillar-font-size-base);\n font-weight: 600;\n color: var(--pillar-text);\n margin-bottom: var(--pillar-spacing-xs);\n}\n\n._pillar-resume-prompt-message {\n display: flex;\n flex-direction: column;\n gap: 2px;\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-muted);\n}\n\n._pillar-resume-prompt-user-msg {\n font-style: italic;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n._pillar-resume-prompt-summary {\n font-size: var(--pillar-font-size-xs);\n color: var(--pillar-text-placeholder);\n}\n\n._pillar-resume-prompt-actions {\n display: flex;\n gap: var(--pillar-spacing-sm);\n justify-content: flex-end;\n}\n\n._pillar-resume-prompt-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 14px;\n font-size: var(--pillar-font-size-sm);\n font-weight: 500;\n font-family: var(--pillar-font-family);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n border: 1px solid transparent;\n}\n\n._pillar-resume-prompt-btn--primary {\n background: var(--pillar-primary);\n color: #ffffff;\n border-color: var(--pillar-primary);\n}\n\n._pillar-resume-prompt-btn--primary:hover {\n background: var(--pillar-primary-hover);\n border-color: var(--pillar-primary-hover);\n}\n\n._pillar-resume-prompt-btn--ghost {\n background: transparent;\n color: var(--pillar-text-muted);\n border-color: transparent;\n}\n\n._pillar-resume-prompt-btn--ghost:hover {\n background: var(--pillar-bg-tertiary);\n color: var(--pillar-text);\n}\n\n._pillar-resume-prompt-btn svg {\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n.pillar-resume-prompt {}\n.pillar-resume-prompt-spinner {}\n.pillar-resume-prompt-text {}\n.pillar-resume-prompt-content {}\n.pillar-resume-prompt-icon {}\n.pillar-resume-prompt-body {}\n.pillar-resume-prompt-title {}\n.pillar-resume-prompt-message {}\n.pillar-resume-prompt-user-msg {}\n.pillar-resume-prompt-summary {}\n.pillar-resume-prompt-actions {}\n.pillar-resume-prompt-btn {}\n","/* ============================================================================\n Question Chip\n ============================================================================ */\n\n._pillar-question-chip {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n padding: var(--pillar-spacing-md) var(--pillar-spacing-lg);\n font-size: var(--pillar-font-size-base);\n font-family: var(--pillar-font-family);\n text-align: left;\n color: var(--pillar-text);\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n cursor: pointer;\n transition: background var(--pillar-transition-fast), border-color var(--pillar-transition-fast);\n}\n\n._pillar-question-chip:hover {\n border-color: var(--pillar-primary);\n}\n\n._pillar-question-chip-text {\n flex: 1;\n}\n\n._pillar-question-chip-arrow {\n color: var(--pillar-text-muted);\n margin-left: var(--pillar-spacing-sm);\n transition: color var(--pillar-transition-fast), transform var(--pillar-transition-fast);\n}\n\n._pillar-question-chip:hover ._pillar-question-chip-arrow {\n color: var(--pillar-primary);\n transform: translateX(2px);\n}\n\n._pillar-question-chip-skeleton {\n height: 44px;\n background: var(--pillar-bg-secondary);\n border: 1px solid var(--pillar-border);\n border-radius: var(--pillar-radius-lg);\n overflow: hidden;\n}\n\n._pillar-question-chip-skeleton-bar {\n width: 60%;\n height: 14px;\n margin: 15px var(--pillar-spacing-lg);\n background: linear-gradient(90deg, var(--pillar-border) 25%, var(--pillar-bg-tertiary) 50%, var(--pillar-border) 75%);\n background-size: 200% 100%;\n animation: pillar-shimmer 1.5s infinite;\n border-radius: var(--pillar-radius-sm);\n}\n\n@keyframes pillar-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n\n.pillar-question-chip {}\n.pillar-question-chip-text {}\n.pillar-question-chip-arrow {}\n.pillar-question-chip-skeleton {}\n.pillar-question-chip-skeleton-bar {}\n","/* ============================================================================\n Loading States\n Internal: _pillar-loading | Public: pillar-loading\n ============================================================================ */\n\n._pillar-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 40px var(--pillar-spacing-xl);\n color: var(--pillar-text-muted);\n}\n\n._pillar-loading-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--pillar-border);\n border-top-color: var(--pillar-primary);\n border-radius: 50%;\n animation: pillar-spin 0.8s linear infinite;\n}\n\n@keyframes pillar-spin {\n to { transform: rotate(360deg); }\n}\n\n.pillar-loading {}\n.pillar-loading-spinner {}\n\n/* ============================================================================\n Progress Indicator (AI activity status)\n Internal: _pillar-progress | Public: pillar-progress\n ============================================================================ */\n\n._pillar-progress-indicator {\n display: flex;\n align-items: center;\n gap: var(--pillar-spacing-sm);\n padding: var(--pillar-spacing-sm) 0;\n}\n\n._pillar-progress-indicator ._pillar-loading-spinner {\n width: 16px;\n height: 16px;\n flex-shrink: 0;\n}\n\n._pillar-progress-message {\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-muted);\n font-style: italic;\n}\n\n.pillar-progress-indicator {}\n.pillar-progress-message {}\n\n._pillar-thinking-shimmer {\n display: inline-block;\n font-size: var(--pillar-font-size-sm);\n color: var(--pillar-text-muted);\n background: linear-gradient(\n 90deg,\n var(--pillar-text-muted) 0%,\n var(--pillar-text-primary, #e5e5e5) 40%,\n var(--pillar-text-muted) 60%\n );\n background-size: 200% 100%;\n -webkit-background-clip: text;\n background-clip: text;\n -webkit-text-fill-color: transparent;\n animation: pillar-shimmer 2s ease-in-out infinite;\n}\n\n.pillar-thinking-shimmer {}\n\n/* ============================================================================\n Empty States\n Internal: _pillar-empty | Public: pillar-empty\n ============================================================================ */\n\n._pillar-empty {\n padding: 40px var(--pillar-spacing-xl);\n text-align: center;\n color: var(--pillar-text-muted);\n}\n\n._pillar-empty-icon {\n width: 48px;\n height: 48px;\n margin: 0 auto var(--pillar-spacing-lg);\n color: var(--pillar-border);\n}\n\n._pillar-empty-title {\n font-size: var(--pillar-font-size-lg);\n font-weight: 500;\n color: var(--pillar-text);\n margin-bottom: var(--pillar-spacing-xs);\n}\n\n._pillar-empty-description {\n font-size: var(--pillar-font-size-base);\n}\n\n.pillar-empty {}\n.pillar-empty-icon {}\n.pillar-empty-title {}\n.pillar-empty-description {}\n\n/* ============================================================================\n Section Titles\n Internal: _pillar-section-title | Public: pillar-section-title\n ============================================================================ */\n\n._pillar-section-title {\n padding: var(--pillar-spacing-md) var(--pillar-spacing-xl) var(--pillar-spacing-sm);\n font-size: var(--pillar-font-size-xs);\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: var(--pillar-text-muted);\n}\n\n.pillar-section-title {}\n\n/* ============================================================================\n Related Articles\n ============================================================================ */\n\n._pillar-related-articles {\n border-top: 1px solid var(--pillar-border);\n margin-top: var(--pillar-spacing-2xl);\n padding-top: var(--pillar-spacing-sm);\n}\n\n.pillar-related-articles {}\n",'/* ============================================================================\n Progress Row (for search, query, generating events)\n Internal: _pillar-progress-row | Public: pillar-progress-row\n ============================================================================ */\n\n._pillar-progress-events {\n margin: 4px 0;\n}\n\n._pillar-progress-row {\n margin: 1px 0;\n padding: 1px 0;\n font-size: 12px;\n animation: pillar-progress-row-fade-in 0.3s ease-in-out;\n}\n\n._pillar-progress-row--error {\n color: var(--pillar-error);\n}\n\n@keyframes pillar-progress-row-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n._pillar-progress-row-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 2px 0;\n}\n\n._pillar-progress-expand-icon {\n font-size: 10px;\n color: var(--pillar-text-muted);\n transition: transform 0.2s ease;\n flex-shrink: 0;\n}\n\n._pillar-progress-row-header[style*="cursor: pointer"]:hover ._pillar-progress-expand-icon {\n color: var(--pillar-text-secondary);\n}\n\n._pillar-progress-row-header[data-expanded="true"] ._pillar-progress-expand-icon {\n transform: rotate(90deg);\n}\n\n._pillar-progress-message {\n color: var(--pillar-text-muted);\n font-size: 12px;\n font-style: italic;\n}\n\n._pillar-progress-no-results {\n color: var(--pillar-text-muted);\n font-size: 11px;\n font-style: italic;\n margin-left: 4px;\n}\n\n._pillar-progress-sources {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n._pillar-progress-source-item {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 2px 0;\n font-size: 11px;\n}\n\n._pillar-progress-source-link {\n flex: 1;\n display: flex;\n flex-direction: column;\n text-decoration: none;\n overflow: hidden;\n color: inherit;\n}\n\n._pillar-progress-source-link:hover ._pillar-progress-source-title {\n text-decoration: underline;\n}\n\n._pillar-progress-source-title {\n font-weight: 400;\n color: var(--pillar-text-muted);\n font-size: 11px;\n}\n\n._pillar-progress-details {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n._pillar-progress-detail-item {\n font-size: 11px;\n color: var(--pillar-text-muted);\n padding: 1px 0;\n}\n\n._pillar-progress-detail-action {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n}\n\n._pillar-progress-detail-name {\n font-weight: 500;\n}\n\n._pillar-progress-detail-desc {\n color: var(--pillar-text-muted);\n opacity: 0.8;\n}\n\n._pillar-progress-content-wrapper {\n position: relative;\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 0.2s ease-out;\n}\n\n._pillar-progress-content-wrapper--expanded {\n grid-template-rows: 1fr;\n margin-top: 6px;\n}\n\n._pillar-progress-content-container {\n overflow: hidden;\n min-height: 0;\n scrollbar-width: thin;\n scrollbar-color: var(--pillar-scrollbar-thumb) transparent;\n}\n\n._pillar-progress-content-wrapper--expanded ._pillar-progress-content-container {\n max-height: 180px;\n overflow-y: auto;\n}\n\n._pillar-progress-content-container::-webkit-scrollbar {\n width: 4px;\n}\n\n._pillar-progress-content-container::-webkit-scrollbar-track {\n background: transparent;\n}\n\n._pillar-progress-content-container::-webkit-scrollbar-thumb {\n background-color: var(--pillar-scrollbar-thumb);\n border-radius: 2px;\n}\n\n._pillar-progress-content-gradient {\n position: absolute;\n bottom: 0;\n left: 16px;\n right: 0;\n height: 20px;\n background: linear-gradient(transparent, var(--pillar-bg));\n pointer-events: none;\n}\n\n._pillar-progress-text {\n font-size: 11px;\n color: var(--pillar-text-muted);\n line-height: 1.4;\n word-break: break-word;\n}\n\n._pillar-progress-text p {\n margin: 0 0 4px 0;\n}\n\n._pillar-progress-text p:last-child {\n margin-bottom: 0;\n}\n\n._pillar-progress-text ol,\n._pillar-progress-text ul {\n margin: 2px 0;\n padding-left: 16px;\n}\n\n._pillar-progress-text li {\n margin-bottom: 1px;\n}\n\n._pillar-progress-text br {\n display: block;\n content: "";\n margin-top: 2px;\n}\n\n/* Chevron indicator for progress rows - rotates based on expanded state */\n/* Positioned inline next to label, hidden by default, shown on hover */\n._pillar-progress-chevron {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n font-size: 10px;\n color: var(--pillar-text-muted);\n transition: transform 0.2s ease, opacity 0.15s ease;\n opacity: 0;\n}\n\n._pillar-progress-row:hover ._pillar-progress-chevron {\n opacity: 1;\n}\n\n._pillar-progress-error-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n font-size: 10px;\n color: var(--pillar-error);\n}\n\n/* Tool call arguments (inputs) */\n._pillar-progress-arguments {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 10px;\n margin-bottom: 6px;\n font-size: 11px;\n line-height: 1.4;\n}\n\n._pillar-progress-argument-key {\n color: var(--pillar-text-muted);\n}\n\n._pillar-progress-argument-value {\n color: var(--pillar-text-secondary);\n}\n\n/* Text preview for streaming content */\n._pillar-progress-text-preview-wrapper {\n position: relative;\n margin-top: 4px;\n}\n\n._pillar-progress-text-preview {\n max-height: 180px;\n overflow-y: auto;\n font-size: 11px;\n color: var(--pillar-text-muted);\n line-height: 1.4;\n scroll-behavior: smooth;\n white-space: pre-wrap;\n word-break: break-word;\n scrollbar-width: thin;\n scrollbar-color: var(--pillar-scrollbar-thumb) transparent;\n}\n\n/* All content inside progress text preview should stay muted and small.\n Markdown headers, paragraphs, etc. must not look like answer text. */\n._pillar-progress-text-preview * {\n color: inherit !important;\n font-size: inherit !important;\n font-weight: normal !important;\n line-height: inherit !important;\n margin: 0 !important;\n}\n\n/* Top gradient - fades out older text at the top */\n._pillar-progress-text-gradient {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 20px;\n background: linear-gradient(to bottom, var(--pillar-bg), transparent);\n pointer-events: none;\n z-index: 1;\n}\n\n._pillar-progress-text-preview::-webkit-scrollbar {\n width: 4px;\n}\n\n._pillar-progress-text-preview::-webkit-scrollbar-track {\n background: transparent;\n}\n\n._pillar-progress-text-preview::-webkit-scrollbar-thumb {\n background-color: var(--pillar-scrollbar-thumb);\n border-radius: 2px;\n}\n\n/* Active state indicator */\n._pillar-progress-row--active ._pillar-progress-message {\n font-weight: 500;\n}\n\n/* Long text truncation for labels */\n._pillar-progress-message {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 300px;\n}\n\n/* Children/sub-items styling */\n._pillar-progress-children {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n._pillar-progress-child-item {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 2px 0;\n font-size: 11px;\n}\n\n._pillar-progress-child-link {\n color: var(--pillar-text-muted);\n text-decoration: none;\n transition: color 0.15s ease;\n}\n\n._pillar-progress-child-link:hover {\n color: var(--pillar-text-secondary);\n text-decoration: underline;\n}\n\n._pillar-progress-child-label {\n color: var(--pillar-text-muted);\n font-size: 11px;\n}\n\n/* ============================================================================\n Progress Group (collapsible tool event groups)\n Internal: _pillar-progress-group | Public: pillar-progress-group\n ============================================================================ */\n\n._pillar-progress-group {\n margin: 1px 0;\n animation: pillar-progress-row-fade-in 0.3s ease-in-out;\n}\n\n._pillar-progress-group-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 3px 0;\n cursor: pointer;\n font-size: 12px;\n color: var(--pillar-text-secondary, #6b7280);\n user-select: none;\n border-radius: 4px;\n transition: color 0.15s ease;\n}\n\n._pillar-progress-group-chevron {\n flex-shrink: 0;\n font-size: 8px;\n line-height: 1;\n color: inherit;\n}\n\n._pillar-progress-group-summary {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n._pillar-progress-group-active-dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--pillar-primary, #3b82f6);\n flex-shrink: 0;\n animation: pillar-progress-group-pulse 1.5s ease-in-out infinite;\n}\n\n@keyframes pillar-progress-group-pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.4; }\n}\n\n._pillar-progress-group-children {\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 0.2s ease;\n overflow: hidden;\n}\n\n._pillar-progress-group-children--expanded {\n grid-template-rows: 1fr;\n}\n\n._pillar-progress-group-children-inner {\n min-height: 0;\n padding-left: 14px;\n}\n\n/* Nested rows inside groups have reduced spacing */\n._pillar-progress-row--nested {\n margin: 0;\n padding: 0;\n}\n\n._pillar-progress-row--nested ._pillar-progress-row-header {\n padding: 2px 0;\n}\n\n._pillar-progress-row--nested ._pillar-progress-message {\n font-size: 11px;\n}\n\n/* ============================================================================\n Error Row (shown when MCP request fails)\n Internal: _pillar-error-row | Public: pillar-error-row\n ============================================================================ */\n\n._pillar-error-row {\n display: flex;\n align-items: center;\n gap: 6px;\n margin: 4px 0;\n padding: 2px 0;\n font-size: 12px;\n color: var(--pillar-error);\n animation: pillar-progress-row-fade-in 0.3s ease-in-out;\n}\n\n._pillar-error-row-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n font-size: 10px;\n}\n\n._pillar-error-row-message {\n font-size: 12px;\n font-style: italic;\n}\n\n._pillar-error-row-retry {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n margin-left: 4px;\n padding: 1px 8px;\n font-size: 11px;\n color: var(--pillar-error);\n background: none;\n border: 1px solid color-mix(in srgb, var(--pillar-error) 30%, transparent);\n border-radius: 4px;\n cursor: pointer;\n transition: background 0.15s ease, border-color 0.15s ease;\n font-family: inherit;\n line-height: 1.4;\n}\n\n._pillar-error-row-retry:hover {\n background: color-mix(in srgb, var(--pillar-error) 8%, transparent);\n border-color: color-mix(in srgb, var(--pillar-error) 50%, transparent);\n}\n\n._pillar-error-row-retry svg {\n flex-shrink: 0;\n}\n\n.pillar-error-row {}\n.pillar-error-row-icon {}\n.pillar-error-row-message {}\n.pillar-error-row-retry {}\n\n.pillar-progress-events {}\n.pillar-progress-chevron {}\n.pillar-progress-error-icon {}\n.pillar-progress-text-preview-wrapper {}\n.pillar-progress-text-preview {}\n.pillar-progress-text-gradient {}\n.pillar-progress-children {}\n.pillar-progress-child-item {}\n.pillar-progress-child-link {}\n.pillar-progress-child-label {}\n.pillar-progress-row {}\n.pillar-progress-row-header {}\n.pillar-progress-expand-icon {}\n.pillar-progress-message {}\n.pillar-progress-no-results {}\n.pillar-progress-sources {}\n.pillar-progress-source-item {}\n.pillar-progress-source-link {}\n.pillar-progress-source-title {}\n.pillar-progress-arguments {}\n.pillar-progress-argument {}\n.pillar-progress-argument-key {}\n.pillar-progress-argument-value {}\n.pillar-progress-content-wrapper {}\n.pillar-progress-content-container {}\n.pillar-progress-content-gradient {}\n.pillar-progress-text {}\n.pillar-progress-group {}\n.pillar-progress-group-header {}\n.pillar-progress-group-chevron {}\n.pillar-progress-group-summary {}\n.pillar-progress-group-active-dot {}\n.pillar-progress-group-children {}\n',"/* Confirm Action Card */\n.pillar-confirm-card-wrapper {\n margin-top: 12px;\n}\n\n.pillar-confirm-card {\n background: var(--pillar-bg-secondary, #f9fafb);\n border: 1px solid var(--pillar-border, #e5e7eb);\n border-radius: 12px;\n overflow: hidden;\n}\n\n.pillar-confirm-card__content {\n padding: 16px;\n}\n\n.pillar-confirm-card__header {\n margin-bottom: 12px;\n}\n\n.pillar-confirm-card__title {\n font-size: 14px;\n font-weight: 600;\n color: var(--pillar-text-primary, #111827);\n}\n\n.pillar-confirm-card__data {\n background: var(--pillar-bg-primary, #ffffff);\n border: 1px solid var(--pillar-border, #e5e7eb);\n border-radius: 8px;\n padding: 12px;\n margin-bottom: 12px;\n}\n\n.pillar-confirm-card__data-row {\n display: flex;\n gap: 8px;\n font-size: 13px;\n margin-bottom: 4px;\n}\n\n.pillar-confirm-card__data-row:last-child {\n margin-bottom: 0;\n}\n\n.pillar-confirm-card__data-key {\n color: var(--pillar-text-secondary, #6b7280);\n flex-shrink: 0;\n}\n\n.pillar-confirm-card__data-value {\n color: var(--pillar-text-primary, #111827);\n word-break: break-word;\n}\n\n.pillar-confirm-card__actions {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n}\n\n.pillar-confirm-card__btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 8px 14px;\n font-size: 13px;\n font-weight: 500;\n font-family: inherit;\n border-radius: 8px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: 1px solid transparent;\n}\n\n.pillar-confirm-card__btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n}\n\n.pillar-confirm-card__btn svg {\n width: 16px;\n height: 16px;\n}\n\n.pillar-confirm-card__btn--primary {\n background: var(--pillar-primary, #2563eb);\n color: #ffffff;\n border-color: var(--pillar-primary, #2563eb);\n}\n\n.pillar-confirm-card__btn--primary:hover:not(:disabled) {\n background: var(--pillar-primary-hover, #1d4ed8);\n border-color: var(--pillar-primary-hover, #1d4ed8);\n}\n\n.pillar-confirm-card__btn--secondary {\n background: var(--pillar-bg-primary, #ffffff);\n color: var(--pillar-text-secondary, #6b7280);\n border-color: var(--pillar-border, #e5e7eb);\n}\n\n.pillar-confirm-card__btn--secondary:hover:not(:disabled) {\n background: var(--pillar-bg-secondary, #f9fafb);\n}\n\n.pillar-confirm-card__success {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 16px;\n color: var(--pillar-success);\n font-weight: 500;\n}\n\n.pillar-confirm-card__success-icon svg {\n width: 20px;\n height: 20px;\n}\n\n.pillar-confirm-card__error {\n background: var(--pillar-error-light);\n border: 1px solid var(--pillar-error-border);\n border-radius: 8px;\n padding: 12px;\n margin-bottom: 12px;\n color: var(--pillar-error);\n font-size: 13px;\n}\n\n.pillar-confirm-card__spinner {\n display: inline-flex;\n animation: pillar-spin 1s linear infinite;\n}\n\n@keyframes pillar-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n","/* ============================================================================\n Markdown Component Styles\n Combined from markdown-components.tsx and preact-markdown.tsx\n ============================================================================ */\n\n/* Collapsible Section */\n._pillar-collapsible {\n margin: 2px 0;\n}\n\n._pillar-collapsible-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 0;\n background: transparent;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 13px;\n font-weight: 500;\n color: var(--pillar-text-secondary, #6b7280);\n font-family: inherit;\n width: 100%;\n text-align: left;\n transition: background-color 0.15s ease;\n}\n\n._pillar-collapsible-header:hover {\n background: var(--pillar-bg-hover);\n}\n\n._pillar-collapsible-icon {\n font-size: 10px;\n color: var(--pillar-text-muted, #9ca3af);\n}\n\n._pillar-collapsible-title {\n flex: 1;\n}\n\n._pillar-collapsible-content-wrapper {\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 0.2s ease;\n}\n\n._pillar-collapsible-content-wrapper--expanded {\n grid-template-rows: 1fr;\n}\n\n._pillar-collapsible-content {\n overflow: hidden;\n padding-left: 18px;\n font-size: 13px;\n color: var(--pillar-text-secondary, #6b7280);\n line-height: 1.4;\n}\n\n._pillar-collapsible-content-wrapper--expanded ._pillar-collapsible-content {\n padding-top: 2px;\n padding-bottom: 4px;\n}\n\n/* Source List */\n._pillar-source-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n margin: 4px 0;\n}\n\n._pillar-source-item {\n display: block;\n padding: 4px 8px;\n font-size: 12px;\n color: var(--pillar-primary, #2563eb);\n text-decoration: none;\n border-radius: 4px;\n transition: background-color 0.15s ease;\n}\n\n._pillar-source-item:hover {\n background: var(--pillar-bg-hover);\n text-decoration: underline;\n}\n\n/* Task List */\n._pillar-task-list {\n list-style: none;\n padding: 0;\n margin: 8px 0;\n}\n\n._pillar-task-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 0;\n font-size: 13px;\n}\n\n._pillar-task-item--completed ._pillar-task-text {\n text-decoration: line-through;\n color: var(--pillar-text-placeholder, #9ca3af);\n}\n\n._pillar-task-checkbox {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n\n/* Code Block */\n._pillar-code-block {\n margin: 8px 0;\n border-radius: 8px;\n overflow: hidden;\n background: var(--pillar-bg-code, #1e1e1e);\n}\n\n._pillar-code-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 8px 12px;\n background: var(--pillar-bg-code-header, #2d2d2d);\n border-bottom: 1px solid var(--pillar-border-code, #404040);\n}\n\n._pillar-code-language {\n font-size: 11px;\n font-weight: 500;\n color: var(--pillar-text-code-header, #a0a0a0);\n text-transform: uppercase;\n}\n\n._pillar-code-copy {\n padding: 4px 8px;\n font-size: 11px;\n font-family: inherit;\n background: transparent;\n border: 1px solid var(--pillar-border-code, #404040);\n border-radius: 4px;\n color: var(--pillar-text-code-header, #a0a0a0);\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n._pillar-code-copy:hover {\n background: var(--pillar-bg-code-hover, #404040);\n color: #fff;\n}\n\n._pillar-code-pre {\n margin: 0;\n padding: 12px;\n overflow-x: auto;\n font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;\n font-size: 13px;\n line-height: 1.5;\n}\n\n._pillar-code-content {\n color: var(--pillar-text-code, #e0e0e0);\n}\n\n/* Action Buttons */\n._pillar-action-buttons {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin: 8px 0;\n}\n\n._pillar-action-button {\n padding: 8px 16px;\n font-size: 13px;\n font-weight: 500;\n font-family: inherit;\n background: var(--pillar-primary, #2563eb);\n color: #fff;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n._pillar-action-button:hover {\n background: var(--pillar-primary-hover, #1d4ed8);\n}\n\n/* Progress Indicator */\n._pillar-progress-indicator {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 0;\n font-size: 13px;\n color: var(--pillar-text-secondary, #6b7280);\n}\n\n._pillar-progress-indicator--active ._pillar-loading-spinner {\n display: inline-block;\n}\n\n/* Streaming Thinking Content */\n._pillar-progress-row--streaming {\n margin: 2px 0;\n}\n\n._pillar-thinking-header {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 0;\n font-size: 13px;\n font-weight: 500;\n color: var(--pillar-text-secondary, #6b7280);\n}\n\n._pillar-thinking-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n}\n\n._pillar-spinner {\n width: 12px;\n height: 12px;\n border: 2px solid var(--pillar-border, #e5e7eb);\n border-top-color: var(--pillar-primary, #2563eb);\n border-radius: 50%;\n animation: pillar-spin 0.8s linear infinite;\n}\n\n@keyframes pillar-spin {\n to { transform: rotate(360deg); }\n}\n\n._pillar-thinking-label {\n flex: 1;\n}\n\n._pillar-thinking-content {\n padding: 6px 10px;\n font-size: 13px;\n line-height: 1.4;\n color: var(--pillar-text-secondary, #6b7280);\n background: var(--pillar-bg-tertiary, #f9fafb);\n border-radius: 4px;\n margin-top: 2px;\n max-height: 150px;\n overflow-y: auto;\n}\n\n/* ============================================================================\n Preact Markdown Styles\n ============================================================================ */\n\n/* Base markdown container */\n._pillar-markdown {\n font-size: 14px;\n line-height: 1.45;\n color: var(--pillar-text, #1a1a1a);\n}\n\n/* Headings */\n._pillar-md-heading {\n margin: 10px 0 4px 0;\n font-weight: 600;\n line-height: 1.3;\n}\n\n._pillar-md-h1 { font-size: 1.5em; }\n._pillar-md-h2 { font-size: 1.3em; }\n._pillar-md-h3 { font-size: 1.15em; }\n._pillar-md-h4 { font-size: 1em; }\n._pillar-md-h5 { font-size: 0.95em; }\n._pillar-md-h6 { font-size: 0.9em; }\n\n/* Paragraphs */\n._pillar-md-paragraph {\n margin: 4px 0;\n}\n\n/* Links */\n._pillar-md-link {\n color: var(--pillar-primary, #2563eb);\n text-decoration: none;\n}\n\n._pillar-md-link:hover {\n text-decoration: underline;\n}\n\n/* Inline code */\n._pillar-md-code-inline {\n padding: 2px 6px;\n font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;\n font-size: 0.9em;\n background: var(--pillar-bg-tertiary);\n border-radius: 4px;\n}\n\n/* Lists */\n._pillar-md-list {\n margin: 4px 0;\n padding-left: 24px;\n}\n\n._pillar-md-list-item {\n margin: 2px 0;\n}\n\n/* Task list items */\n._pillar-md-task-item {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n list-style: none;\n margin-left: -24px;\n}\n\n._pillar-md-task-checkbox {\n margin-top: 4px;\n}\n\n._pillar-md-task-text--checked {\n text-decoration: line-through;\n color: var(--pillar-text-placeholder, #9ca3af);\n}\n\n/* Blockquote */\n._pillar-md-blockquote {\n margin: 8px 0;\n padding: 8px 16px;\n border-left: 3px solid var(--pillar-border, #e5e7eb);\n color: var(--pillar-text-muted, #6b7280);\n background: var(--pillar-bg-secondary, #f9fafb);\n}\n\n/* Horizontal rule */\n._pillar-md-hr {\n margin: 16px 0;\n border: none;\n border-top: 1px solid var(--pillar-border, #e5e7eb);\n}\n\n/* Tables */\n._pillar-md-table-wrapper {\n overflow-x: auto;\n margin: 8px 0;\n}\n\n._pillar-md-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 13px;\n}\n\n._pillar-md-th,\n._pillar-md-td {\n padding: 8px 12px;\n border: 1px solid var(--pillar-border, #e5e7eb);\n text-align: left;\n}\n\n._pillar-md-th {\n background: var(--pillar-bg-secondary, #f9fafb);\n font-weight: 600;\n}\n\n/* Images */\n._pillar-md-image {\n max-width: 100%;\n height: auto;\n border-radius: 8px;\n margin: 8px 0;\n}\n"].join("\n");function zr(e,n=""){const t=[];return e.primary&&t.push(`--pillar-primary${n}: ${e.primary};`),e.primaryHover&&t.push(`--pillar-primary-hover${n}: ${e.primaryHover};`),e.background&&t.push(`--pillar-bg${n}: ${e.background};`),e.backgroundSecondary&&t.push(`--pillar-bg-secondary${n}: ${e.backgroundSecondary};`),e.text&&t.push(`--pillar-text${n}: ${e.text};`),e.textMuted&&t.push(`--pillar-text-muted${n}: ${e.textMuted};`),e.border&&t.push(`--pillar-border${n}: ${e.border};`),e.borderLight&&t.push(`--pillar-border-light${n}: ${e.borderLight};`),e.outlineColor&&t.push(`--pillar-outline-color${n}: ${e.outlineColor};`),t.join("\n ")}function Tr(e){const n=zr(e.colors),t=zr(e.darkColors),r=e.fontFamily?`--pillar-font-family: ${e.fontFamily};`:"";let i="";return(n||r)&&(i+=`\n:host {\n ${[n,r].filter(Boolean).join("\n ")}\n}\n`),t&&(i+=`\n@media (prefers-color-scheme: dark) {\n :host:not([data-theme="light"]) {\n ${t}\n }\n}\n:host([data-theme="dark"]) {\n ${t}\n}\n`),i}const Ir=function(e){function n(e){var t,r;return this.getChildContext||(t=new Set,(r={})[n.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){t=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&t.forEach(function(e){e.__e=!0,G(e)})},this.sub=function(e){t.add(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){t&&t.delete(e),n&&n.call(e)}}),e.children}return n.__c="__cC"+D++,n.__=e,n.Provider=n.__l=(n.Consumer=function(e,n){return e.children(n)}).contextType=n,n}(null);function Mr({api:e,events:n,children:t}){return ge(Ir.Provider,{value:{api:e,events:n},children:t})}function Rr(){const e=function(e){var n=fe.context[e.__c],t=ze(me++,9);return t.c=e,n?(null==t.__&&(t.__=!0,n.sub(fe)),n.props.value):e.__}(Ir);if(!e)throw new Error("usePillar must be used within a PillarProvider");return e}function $r(){return Rr().api}const Ar=Je([]),Lr=Je([]),Hr=Je(!1),Or=Je(null),Dr=Je(null);function jr(e,n,t,r=3){if(0===e.length)return[];const i=function(e,n){const t=e.split("/").filter(Boolean).flatMap(e=>e.split(/[-_]/)),r=n.toLowerCase().split(/\s+/);return[...new Set([...t,...r])].map(e=>e.toLowerCase()).filter(e=>e.length>2)}(n,t),l=e.map(e=>({suggestion:e,score:Ur(e,i)}));return l.sort((e,n)=>n.score-e.score),l.slice(0,r).map(e=>e.suggestion)}function Ur(e,n){if(e.manual)return 1/0;const t=e.text.toLowerCase();let r=0;for(const e of n)t.includes(e)&&(r+=e.length);return r}function qr(e){Hr.value=e}ln(()=>Lr.value.length>0),ln(()=>Ar.value.length>0);const Br='<svg viewBox="0 0 24 24" fill="currentColor"><path d="M4.583 17.321C3.553 16.227 3 15 3 13.011c0-3.5 2.457-6.637 6.03-8.188l.893 1.378c-3.335 1.804-3.987 4.145-4.247 5.621.537-.278 1.24-.375 1.929-.311 1.804.167 3.226 1.648 3.226 3.489a3.5 3.5 0 01-3.5 3.5c-1.073 0-2.099-.49-2.748-1.179zm10 0C13.553 16.227 13 15 13 13.011c0-3.5 2.457-6.637 6.03-8.188l.893 1.378c-3.335 1.804-3.987 4.145-4.247 5.621.537-.278 1.24-.375 1.929-.311 1.804.167 3.226 1.648 3.226 3.489a3.5 3.5 0 01-3.5 3.5c-1.073 0-2.099-.49-2.748-1.179z"/></svg>';function Nr({context:e,onRemove:n,readOnly:t=!1}){const r=Gn(e),i=function(e){return Yn(e),Br}(e),l=function(e){if(Yn(e)){const n=e.url_origin?`\nFrom: ${e.url_origin}`:"";return`"${e.text_content}"${n}`}return""}(e);return ge("div",{class:"_pillar-context-tag pillar-context-tag",title:l,children:[ge("span",{class:"_pillar-context-tag-icon pillar-context-tag-icon",dangerouslySetInnerHTML:{__html:i}}),ge("span",{class:"_pillar-context-tag-label pillar-context-tag-label",children:r}),!t&&n&&ge("button",{class:"_pillar-context-tag-remove pillar-context-tag-remove",onClick:t=>{t.preventDefault(),t.stopPropagation(),n?.(e.id)},"aria-label":"Remove context",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>'}})]})}function Fr({contexts:e,onRemove:n,readOnly:t=!1}){const r=e.filter(e=>!Zn(e));return 0===r.length?null:ge("div",{class:"_pillar-context-tag-list pillar-context-tag-list",children:r.map(e=>ge(Nr,{context:e,onRemove:n,readOnly:t},e.id))})}const Wr='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>';function Vr({placeholder:e="Ask anything...",disabled:n=!1,onSubmit:t,showContextTags:r=!0,showImageUpload:i=!0,className:l="",isStreaming:a=!1,onStop:o}){const s=$r(),p=Me(null),c=Me(null),[d,u]=Te(""),[h,g]=Te(!1),m=$e(()=>{const e=p.current;if(!e)return;e.style.height="41px";const n=e.scrollHeight;n>146?(e.style.height="146px",e.style.overflowY="auto"):(e.style.height=`${n}px`,e.style.overflowY="hidden")},[]),f=$e(async e=>{if(zt.value.length>=4)return;const n=`img-${Date.now()}-${Math.random().toString(36).slice(2)}`,t=URL.createObjectURL(e);Mt({id:n,file:e,preview:t,status:"uploading"});try{const t=await s.uploadImage(e);Rt(n,"ready",t.url,void 0,t.path)}catch(e){const t=e instanceof Error?e.message:"Upload failed";Rt(n,"error",void 0,t)}},[s]),v=$e(e=>{const n=Array.from(e).filter(e=>e.type.startsWith("image/")),t=4-zt.value.length;n.slice(0,t).forEach(f)},[f]),b=$e(e=>{const n=e.clipboardData?.items;if(!n)return;const t=[];for(const e of n)if(e.type.startsWith("image/")){const n=e.getAsFile();n&&t.push(n)}t.length>0&&(e.preventDefault(),v(t))},[v]),_=$e(e=>{e.preventDefault(),e.stopPropagation(),g(!0)},[]),x=$e(e=>{e.preventDefault(),e.stopPropagation(),g(!1)},[]),y=$e(e=>{e.preventDefault(),e.stopPropagation(),g(!1);const n=e.dataTransfer?.files;n&&v(n)},[v]),w=$e(e=>{const n=e.target;n.files&&(v(n.files),n.value="")},[v]),k=$e(()=>{c.current?.click()},[]),S=$e(()=>{const e=d.trim(),n=[...Ct.value],r=It(),i=n.length>0,l=r.length>0;(e||i||l)&&(Tt.value||(i&&rr(),At(),t?t(e,n,r):(i&&ir(n),l&&ar(r),Gt(e),Cr()),u(""),p.current&&(p.current.style.height="41px",p.current.style.overflowY="hidden")))},[d,t]),C=Tt.value,P=d.trim()||Ct.value.length>0||zt.value.some(e=>"ready"===e.status);return ge("div",{class:`_pillar-unified-input-wrapper pillar-unified-input-wrapper ${h?"_pillar-unified-input-wrapper--dragging":""} ${l}`.trim(),onDragOver:_,onDragLeave:x,onDrop:y,children:[ge("input",{ref:c,type:"file",accept:"image/*",multiple:!0,onChange:w,style:{display:"none"}}),zt.value.length>0&&ge("div",{class:"_pillar-chat-images-preview pillar-chat-images-preview",children:zt.value.map(e=>ge("div",{class:"_pillar-chat-image-thumb pillar-chat-image-thumb",children:[ge("img",{src:e.preview,alt:"Upload preview"}),"uploading"===e.status&&ge("div",{class:"_pillar-chat-image-loading pillar-chat-image-loading",children:ge("div",{class:"_pillar-loading-spinner pillar-loading-spinner",style:{width:"16px",height:"16px"}})}),"error"===e.status&&ge("div",{class:"_pillar-chat-image-error pillar-chat-image-error",title:e.error,children:"!"}),ge("button",{type:"button",class:"_pillar-chat-image-remove pillar-chat-image-remove",onClick:()=>$t(e.id),"aria-label":"Remove image",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>'}})]},e.id))}),r&&ge(Fr,{contexts:Ct.value,onRemove:tr}),ge("textarea",{ref:p,class:"_pillar-unified-input pillar-unified-input",placeholder:h?"Drop image here...":e,value:d,onInput:e=>{const n=e.target;u(n.value),m()},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),S())},onPaste:b,disabled:n||a,maxLength:32e3,style:{height:"41px"}}),ge("div",{class:"_pillar-unified-input-row pillar-unified-input-row",children:[i&&!a&&ge("button",{type:"button",class:"_pillar-chat-image-btn pillar-chat-image-btn",onClick:k,disabled:n||C||zt.value.length>=4,"aria-label":"Attach image",title:"Attach image (max 4)",dangerouslySetInnerHTML:{__html:Wr}}),ge("div",{class:"_pillar-unified-input-actions pillar-unified-input-actions",children:ge("button",a?{type:"button",class:"_pillar-unified-stop-btn pillar-unified-stop-btn",onClick:o,"aria-label":"Stop generating",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="6" width="12" height="12" rx="2"/></svg>'}}:{type:"button",class:"_pillar-unified-send-btn pillar-unified-send-btn",onClick:S,disabled:n||C||!P,"aria-label":"Send message",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="19" x2="12" y2="5"/><polyline points="5 12 12 5 19 12"/></svg>'}})})]}),h&&ge("div",{class:"_pillar-chat-drop-overlay pillar-chat-drop-overlay",children:[ge("span",{dangerouslySetInnerHTML:{__html:Wr}}),ge("span",{children:"Drop image here"})]})]})}function Kr({text:e,onClick:n}){return ge("button",{type:"button",class:"_pillar-question-chip pillar-question-chip",onClick:n,children:[ge("span",{class:"_pillar-question-chip-text pillar-question-chip-text",children:e}),ge("span",{class:"_pillar-question-chip-arrow pillar-question-chip-arrow",children:"→"})]})}function Xr(){return ge("div",{class:"_pillar-question-chip-skeleton pillar-question-chip-skeleton",children:ge("div",{class:"_pillar-question-chip-skeleton-bar pillar-question-chip-skeleton-bar"})})}function Yr(){const e=mn(()=>Lr.value),n=mn(()=>Hr.value);return ge("div",{class:"_pillar-home-view pillar-home-view",children:[ge("div",{style:{flex:1}}),ge("div",{class:"_pillar-home-view-questions pillar-home-view-questions",children:n.value?ge(K,{children:[ge(Xr,{}),ge(Xr,{}),ge(Xr,{})]}):e.value&&e.value.length>0?e.value.map(e=>ge(Kr,{text:e.text,onClick:()=>(e=>{Gt(e.text),Cr()})(e)},e.id)):null}),ge(Vr,{placeholder:"Ask anything..."})]})}let Zr=null;function Gr(e){Zr=e}function Qr(){return Zr}function Jr(){return Zr?._api??null}const ei=Je(!1),ni=Je(null),ti=Je(!1),ri=Je(null);function ii(e,n){ei.value=!0,ni.value=e,ti.value=!1,ri.value=n??null}function li(){ei.value=!1,ni.value=null,ri.value=null}function ai(){ti.value=!0}function oi(){ti.value=!1}function si(){return ti.value}const pi=Je(!1),ci=Je(null),di=Je(null);function ui(e){const n=di.value;pi.value=!1,ci.value=null,di.value=null,n?.(e)}var hi=Object.freeze({__proto__:null,cancelPiloting:ai,confirmationLabel:ci,confirmationResolver:di,currentToolCallId:ri,isCancelled:ti,isPiloting:ei,needsConfirmation:pi,pilotOperation:ni,requestConfirmation:function(e){return new Promise(n=>{ci.value=e,di.value=n,pi.value=!0})},resetCancellation:oi,resolveConfirmation:ui,startPiloting:ii,stopPiloting:li,wasCancelled:si});function gi(e){if(e)try{const n=mi(e);localStorage.removeItem(n),c.log("[SessionPersistence] Cleared saved session")}catch(e){c.warn("[SessionPersistence] Failed to clear session:",e)}}function mi(e){return`pillar:active_session:${e}`}var fi=Object.freeze({__proto__:null,clearActiveSession:gi,loadActiveSession:function(e){if(!e)return c.warn("[SessionPersistence] loadActiveSession called with empty siteId"),null;try{const n=mi(e),t=localStorage.getItem(n);if(!t)return c.log(`[SessionPersistence] No session found at key "${n}"`),null;const r=JSON.parse(t);return 1!==r.version?(c.warn("[SessionPersistence] Stored session has incompatible version, clearing"),gi(e),null):r.siteId!==e?(c.warn("[SessionPersistence] Stored session is for different site, clearing"),gi(e),null):(c.log(`[SessionPersistence] Loaded session ${r.conversationId.slice(0,8)}... from localStorage`),r)}catch(n){return c.warn("[SessionPersistence] Failed to load session:",n),gi(e),null}},saveActiveSession:function(e,n){if(e&&n)try{const t={version:1,conversationId:e,siteId:n,streamingStartedAt:(new Date).toISOString()},r=mi(n);localStorage.setItem(r,JSON.stringify(t)),c.log(`[SessionPersistence] Saved session ${e.slice(0,8)}... to localStorage (key="${r}")`)}catch(e){c.warn("[SessionPersistence] Failed to save session:",e)}}});const vi={maxDepth:20,includeText:!0,visibleOnly:!0,minTextLength:1,maxTextLength:500,maxTotalLength:5e4,maxLabelLength:100,includePositions:!1},bi=new Set(["a","button","input","select","textarea","details","summary","dialog","menu","menuitem"]),_i=new Set(["button","link","checkbox","radio","switch","tab","tabpanel","menuitem","menuitemcheckbox","menuitemradio","option","slider","spinbutton","textbox","combobox","listbox","searchbox","tree","treeitem","grid","gridcell","row","rowheader","columnheader"]),xi=new Set(["script","style","noscript","template","svg","path","iframe","object","embed","head","meta","link","base"]);let yi=0;function wi(){document.querySelectorAll("[data-pillar-ref]").forEach(e=>e.removeAttribute("data-pillar-ref")),yi=0}let ki=new Set,Si=new Set;function Ci(e){return e instanceof HTMLInputElement&&"password"===e.type.toLowerCase()||null!==e.closest("[data-pillar-redact]")}const Pi=/\b(delete|remove|destroy|reset|revoke|archive|cancel subscription|deactivate|disable|erase|purge|terminate|unsubscribe|drop)\b/i;function Ei(e){if(e.hasAttribute("data-pillar-destructive"))return!0;const n=e.getAttribute("aria-label");if(n&&Pi.test(n))return!0;const t=e.textContent?.trim().slice(0,200);if(t&&Pi.test(t))return!0;const r=e.getAttribute("title");if(r&&Pi.test(r))return!0;if(e instanceof HTMLInputElement||e instanceof HTMLButtonElement){const n=e.type?.toLowerCase();if("reset"===n||"submit"===n){const n=e.closest("form");if(n){const e=n.getAttribute("action")||"";if(Pi.test(e))return!0}}}return!1}function zi(e){const n=e.tagName.toLowerCase();if(e.hasAttribute("data-pillar-interactable"))return!0;if(bi.has(n))return!0;const t=e.getAttribute("role");if(t&&_i.has(t))return!0;const r=e.getAttribute("tabindex");return null!==r&&"-1"!==r||("true"===e.getAttribute("contenteditable")||!!(e.hasAttribute("onclick")||e.hasAttribute("onkeydown")||e.hasAttribute("onkeyup")))}const Ti=/^pr-[a-z0-9]+$/;function Ii(e){return Ti.test(e)}function Mi(e){if(!Ii(e))throw new Error(`Invalid pillar ref format: "${e}"`);return`[data-pillar-ref="${e}"]`}function Ri(e,n){return e.length<=n?e:e.slice(0,n)+"..."}function $i(e,n){const t=function(e){const n=e.getAttribute("aria-label");if(n)return n;const t=e.getAttribute("aria-labelledby");if(t){const e=document.getElementById(t);if(e)return e.textContent?.trim()||void 0}if(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement){if(e.id){const n=document.querySelector(`label[for="${e.id}"]`);if(n)return n.textContent?.trim()||void 0}const n=e.closest("label");if(n){const e=n.cloneNode(!0);e.querySelectorAll("input, select, textarea").forEach(e=>e.remove());const t=e.textContent?.trim();if(t)return t}}const r=e.getAttribute("title");return r||void 0}(e);if(t)return Ri(t,n);if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.placeholder)return Ri(e.placeholder,n);const r=e.textContent?.trim();if(r&&r.length>0)return Ri(r,n);const i=e.getAttribute("name");return i?Ri(i,n):e.id?Ri(e.id,n):e.tagName.toLowerCase()}function Ai(e,n,t){if(t>n.maxDepth&&(n.maxDepth=t),t>n.options.maxDepth)return;if(e.nodeType===Node.TEXT_NODE){if(n.options.includeText&&!n.budgetExhausted){const t=e.textContent?.trim();if(t&&t.length>=n.options.minTextLength){const e=t.length>n.options.maxTextLength?t.slice(0,n.options.maxTextLength)+"...":t,r=e.length+1;if(n.totalLength+r>n.options.maxTotalLength)return void(n.budgetExhausted=!0);n.lines.push(e),n.totalLength+=r}}return}if(e.nodeType!==Node.ELEMENT_NODE)return;const r=e,i=r.tagName.toLowerCase();if(!xi.has(i)){if(n.options.excludeSelector)try{if(r.matches(n.options.excludeSelector))return}catch{}if((!n.options.visibleOnly||function(e){if(!e.isConnected)return!1;const n=window.getComputedStyle(e);if("none"===n.display)return!1;if("hidden"===n.visibility)return!1;if("0"===n.opacity)return!1;const t=e.getBoundingClientRect();return(0!==t.width||0!==t.height)&&!e.hasAttribute("hidden")&&"true"!==e.getAttribute("aria-hidden")}(r))&&!r.hasAttribute("data-pillar-redact")){if(zi(r)){if(Ci(r))return;const e=function(e){const n=e.tagName.toLowerCase(),t=e.getAttribute("data-pillar-interactable");if(t&&"true"!==t)return t;switch(n){case"input":switch(e.type.toLowerCase()){case"checkbox":case"radio":return"toggle";case"submit":case"button":case"reset":return"click";case"file":return"select";default:return"input"}case"textarea":return"input";case"select":return"select";case"button":return"submit"===e.getAttribute("type")?"submit":"click";case"a":return"click";case"details":case"summary":return"toggle"}const r=e.getAttribute("role");if(r)switch(r){case"button":case"link":case"menuitem":case"tab":default:return"click";case"checkbox":case"radio":case"switch":return"toggle";case"textbox":case"searchbox":case"combobox":case"slider":case"spinbutton":return"input";case"listbox":case"option":return"select"}return"true"===e.getAttribute("contenteditable")?"input":"click"}(r),t=$i(r,n.options.maxLabelLength);let i=r.getAttribute("data-pillar-ref");i||(i=`pr-${(yi++).toString(36)}`,r.setAttribute("data-pillar-ref",i)),n.refs.add(i);const l=`${e.toUpperCase()}: ${t} [[${i}]]`;n.lines.push(l),n.totalLength+=l.length+1,n.interactableCount++}for(const e of r.childNodes)Ai(e,n,t+1)}}}function Li(e){wi();const n=e?.root||document.body,t={lines:[],refs:new Set,interactableCount:0,totalLength:0,budgetExhausted:!1,maxDepth:0,options:{...vi,...e}};return t.lines.push(`=== PAGE: ${document.title} | ${window.location.pathname} ===`),t.lines.push(""),Ai(n,t,0),t.lines.push(""),t.lines.push(`=== ${t.interactableCount} interactable elements ===`),ki=new Set(t.lines),Si=new Set(t.refs),{content:t.lines.join("\n"),interactableCount:t.interactableCount,timestamp:Date.now(),url:window.location.href,title:document.title}}function Hi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oi={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Di(e){Oi=e}var ji={exec:()=>null};function Ui(e,n=""){let t="string"==typeof e?e:e.source,r={replace:(e,n)=>{let i="string"==typeof n?n:n.source;return i=i.replace(Bi.caret,"$1"),t=t.replace(e,i),r},getRegex:()=>new RegExp(t,n)};return r}var qi=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Bi={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[\t ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Ni=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Fi=/(?:[*+-]|\d{1,9}[.)])/,Wi=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Vi=Ui(Wi).replace(/bull/g,Fi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ki=Ui(Wi).replace(/bull/g,Fi).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Xi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Yi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Zi=Ui(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Yi).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gi=Ui(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Fi).getRegex(),Qi="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ji=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,el=Ui("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))","i").replace("comment",Ji).replace("tag",Qi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),nl=Ui(Xi).replace("hr",Ni).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qi).getRegex(),tl={blockquote:Ui(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",nl).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:Zi,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Ni,html:el,lheading:Vi,list:Gi,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:nl,table:ji,text:/^[^\n]+/},rl=Ui("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ni).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}\t)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qi).getRegex(),il={...tl,lheading:Ki,table:rl,paragraph:Ui(Xi).replace("hr",Ni).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",rl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qi).getRegex()},ll={...tl,html:Ui("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Ji).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ji,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ui(Xi).replace("hr",Ni).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Vi).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},al=/^( {2,}|\\)\n(?!\s*$)/,ol=/[\p{P}\p{S}]/u,sl=/[\s\p{P}\p{S}]/u,pl=/[^\s\p{P}\p{S}]/u,cl=Ui(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,sl).getRegex(),dl=/(?!~)[\p{P}\p{S}]/u,ul=Ui(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",qi?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),hl=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,gl=Ui(hl,"u").replace(/punct/g,ol).getRegex(),ml=Ui(hl,"u").replace(/punct/g,dl).getRegex(),fl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",vl=Ui(fl,"gu").replace(/notPunctSpace/g,pl).replace(/punctSpace/g,sl).replace(/punct/g,ol).getRegex(),bl=Ui(fl,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,dl).getRegex(),_l=Ui("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,pl).replace(/punctSpace/g,sl).replace(/punct/g,ol).getRegex(),xl=Ui(/\\(punct)/,"gu").replace(/punct/g,ol).getRegex(),yl=Ui(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),wl=Ui(Ji).replace("(?:--\x3e|$)","--\x3e").getRegex(),kl=Ui("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",wl).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Sl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Cl=Ui(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Sl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pl=Ui(/^!?\[(label)\]\[(ref)\]/).replace("label",Sl).replace("ref",Yi).getRegex(),El=Ui(/^!?\[(ref)\](?:\[\])?/).replace("ref",Yi).getRegex(),zl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Tl={_backpedal:ji,anyPunctuation:xl,autolink:yl,blockSkip:ul,br:al,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:ji,emStrongLDelim:gl,emStrongRDelimAst:vl,emStrongRDelimUnd:_l,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:Cl,nolink:El,punctuation:cl,reflink:Pl,reflinkSearch:Ui("reflink|nolink(?!\\()","g").replace("reflink",Pl).replace("nolink",El).getRegex(),tag:kl,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:ji},Il={...Tl,link:Ui(/^!?\[(label)\]\((.*?)\)/).replace("label",Sl).getRegex(),reflink:Ui(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Sl).getRegex()},Ml={...Tl,emStrongRDelimAst:bl,emStrongLDelim:ml,url:Ui(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",zl).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Ui(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",zl).getRegex()},Rl={...Ml,br:Ui(al).replace("{2,}","*").getRegex(),text:Ui(Ml.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},$l={normal:tl,gfm:il,pedantic:ll},Al={normal:Tl,gfm:Ml,breaks:Rl,pedantic:Il},Ll={"&":"&","<":"<",">":">",'"':""","'":"'"},Hl=e=>Ll[e];function Ol(e,n){if(n){if(Bi.escapeTest.test(e))return e.replace(Bi.escapeReplace,Hl)}else if(Bi.escapeTestNoEncode.test(e))return e.replace(Bi.escapeReplaceNoEncode,Hl);return e}function Dl(e){try{e=encodeURI(e).replace(Bi.percentDecode,"%")}catch{return null}return e}function jl(e,n){let t=e.replace(Bi.findPipe,(e,n,t)=>{let r=!1,i=n;for(;--i>=0&&"\\"===t[i];)r=!r;return r?"|":" |"}),r=t.split(Bi.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),n)if(r.length>n)r.splice(n);else for(;r.length<n;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Bi.slashPipe,"|");return r}function Ul(e,n,t){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){if(e.charAt(r-i-1)!==n)break;i++}return e.slice(0,r-i)}function ql(e,n,t,r,i){let l=n.href,a=n.title||null,o=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let s={type:"!"===e[0].charAt(0)?"image":"link",raw:t,href:l,title:a,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,s}var Bl=class{options;rules;lexer;constructor(e){this.options=e||Oi}space(e){let n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){let n=this.rules.block.code.exec(e);if(n){let e=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Ul(e,"\n")}}}fences(e){let n=this.rules.block.fences.exec(e);if(n){let e=n[0],t=function(e,n,t){let r=e.match(t.other.indentCodeCompensation);if(null===r)return n;let i=r[1];return n.split("\n").map(e=>{let n=e.match(t.other.beginningSpace);if(null===n)return e;let[r]=n;return r.length>=i.length?e.slice(i.length):e}).join("\n")}(e,n[3]||"",this.rules);return{type:"code",raw:e,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:t}}}heading(e){let n=this.rules.block.heading.exec(e);if(n){let e=n[2].trim();if(this.rules.other.endingHash.test(e)){let n=Ul(e,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(e=n.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:Ul(n[0],"\n")}}blockquote(e){let n=this.rules.block.blockquote.exec(e);if(n){let e=Ul(n[0],"\n").split("\n"),t="",r="",i=[];for(;e.length>0;){let n,l=!1,a=[];for(n=0;n<e.length;n++)if(this.rules.other.blockquoteStart.test(e[n]))a.push(e[n]),l=!0;else{if(l)break;a.push(e[n])}e=e.slice(n);let o=a.join("\n"),s=o.replace(this.rules.other.blockquoteSetextReplace,"\n $1").replace(this.rules.other.blockquoteSetextReplace2,"");t=t?`${t}\n${o}`:o,r=r?`${r}\n${s}`:s;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(s,i,!0),this.lexer.state.top=p,0===e.length)break;let c=i.at(-1);if("code"===c?.type)break;if("blockquote"===c?.type){let n=c,l=n.raw+"\n"+e.join("\n"),a=this.blockquote(l);i[i.length-1]=a,t=t.substring(0,t.length-n.raw.length)+a.raw,r=r.substring(0,r.length-n.text.length)+a.text;break}if("list"===c?.type){let n=c,l=n.raw+"\n"+e.join("\n"),a=this.list(l);i[i.length-1]=a,t=t.substring(0,t.length-c.raw.length)+a.raw,r=r.substring(0,r.length-n.raw.length)+a.raw,e=l.substring(i.at(-1).raw.length).split("\n");continue}}return{type:"blockquote",raw:t,tokens:i,text:r}}}list(e){let n=this.rules.block.list.exec(e);if(n){let t=n[1].trim(),r=t.length>1,i={type:"list",raw:"",ordered:r,start:r?+t.slice(0,-1):"",loose:!1,items:[]};t=r?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=r?t:"[*+-]");let l=this.rules.other.listItemRegex(t),a=!1;for(;e;){let t=!1,r="",o="";if(!(n=l.exec(e))||this.rules.block.hr.test(e))break;r=n[0],e=e.substring(r.length);let s=n[2].split("\n",1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),p=e.split("\n",1)[0],c=!s.trim(),d=0;if(this.options.pedantic?(d=2,o=s.trimStart()):c?d=n[1].length+1:(d=n[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,o=s.slice(d),d+=n[1].length),c&&this.rules.other.blankLine.test(p)&&(r+=p+"\n",e=e.substring(p.length+1),t=!0),!t){let n=this.rules.other.nextBulletRegex(d),t=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),l=this.rules.other.headingBeginRegex(d),a=this.rules.other.htmlBeginRegex(d);for(;e;){let u,h=e.split("\n",1)[0];if(p=h,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),u=p):u=p.replace(this.rules.other.tabCharGlobal," "),i.test(p)||l.test(p)||a.test(p)||n.test(p)||t.test(p))break;if(u.search(this.rules.other.nonSpaceChar)>=d||!p.trim())o+="\n"+u.slice(d);else{if(c||s.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(s)||l.test(s)||t.test(s))break;o+="\n"+p}!c&&!p.trim()&&(c=!0),r+=h+"\n",e=e.substring(h.length+1),s=u.slice(d)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(a=!0)),i.items.push({type:"list_item",raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(o),loose:!1,text:o,tokens:[]}),i.raw+=r}let o=i.items.at(-1);if(!o)return;o.raw=o.raw.trimEnd(),o.text=o.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,""),"text"===e.tokens[0]?.type||"paragraph"===e.tokens[0]?.type){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,"");break}}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:"checkbox",raw:n[0]+" ",checked:"[ ]"!==n[0]};e.checked=t.checked,i.loose?e.tokens[0]&&["paragraph","text"].includes(e.tokens[0].type)&&"tokens"in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:"paragraph",raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}if(!i.loose){let n=e.tokens.filter(e=>"space"===e.type),t=n.length>0&&n.some(e=>this.rules.other.anyLine.test(e.raw));i.loose=t}}if(i.loose)for(let e of i.items){e.loose=!0;for(let n of e.tokens)"text"===n.type&&(n.type="paragraph")}return i}}html(e){let n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:"pre"===n[1]||"script"===n[1]||"style"===n[1],text:n[0]}}def(e){let n=this.rules.block.def.exec(e);if(n){let e=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),t=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:e,raw:n[0],href:t,title:r}}}table(e){let n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let t=jl(n[1]),r=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split("\n"):[],l={type:"table",raw:n[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?l.align.push("right"):this.rules.other.tableAlignCenter.test(e)?l.align.push("center"):this.rules.other.tableAlignLeft.test(e)?l.align.push("left"):l.align.push(null);for(let e=0;e<t.length;e++)l.header.push({text:t[e],tokens:this.lexer.inline(t[e]),header:!0,align:l.align[e]});for(let e of i)l.rows.push(jl(e,l.header.length).map((e,n)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:l.align[n]})));return l}}lheading(e){let n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:"="===n[2].charAt(0)?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){let n=this.rules.block.paragraph.exec(e);if(n){let e="\n"===n[1].charAt(n[1].length-1)?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){let n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){let n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){let n=this.rules.inline.link.exec(e);if(n){let e=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let n=Ul(e.slice(0,-1),"\\");if((e.length-n.length)%2==0)return}else{let e=function(e,n){if(-1===e.indexOf(n[1]))return-1;let t=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===n[0])t++;else if(e[r]===n[1]&&(t--,t<0))return r;return t>0?-2:-1}(n[2],"()");if(-2===e)return;if(e>-1){let t=(0===n[0].indexOf("!")?5:4)+n[1].length+e;n[2]=n[2].substring(0,e),n[0]=n[0].substring(0,t).trim(),n[3]=""}}let t=n[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(t);e&&(t=e[1],r=e[3])}else r=n[3]?n[3].slice(1,-1):"";return t=t.trim(),this.rules.other.startAngleBracket.test(t)&&(t=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?t.slice(1):t.slice(1,-1)),ql(n,{href:t&&t.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let t;if((t=this.rules.inline.reflink.exec(e))||(t=this.rules.inline.nolink.exec(e))){let e=n[(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=t[0].charAt(0);return{type:"text",raw:e,text:e}}return ql(t,e,t[0],this.lexer,this.rules)}}emStrong(e,n,t=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!r[1]&&!r[2]||!t||this.rules.inline.punctuation.exec(t))){let t,i,l=[...r[0]].length-1,a=l,o=0,s="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(s.lastIndex=0,n=n.slice(-1*e.length+l);null!=(r=s.exec(n));){if(t=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!t)continue;if(i=[...t].length,r[3]||r[4]){a+=i;continue}if((r[5]||r[6])&&l%3&&!((l+i)%3)){o+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+o);let n=[...r[0]][0].length,s=e.slice(0,l+r.index+n+i);if(Math.min(l,i)%2){let e=s.slice(1,-1);return{type:"em",raw:s,text:e,tokens:this.lexer.inlineTokens(e)}}let p=s.slice(2,-2);return{type:"strong",raw:s,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){let n=this.rules.inline.code.exec(e);if(n){let e=n[2].replace(this.rules.other.newLineCharGlobal," "),t=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return t&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:n[0],text:e}}}br(e){let n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){let n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){let n=this.rules.inline.autolink.exec(e);if(n){let e,t;return"@"===n[2]?(e=n[1],t="mailto:"+e):(e=n[1],t=e),{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let n;if(n=this.rules.inline.url.exec(e)){let e,t;if("@"===n[2])e=n[0],t="mailto:"+e;else{let r;do{r=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??""}while(r!==n[0]);e=n[0],t="www."===n[1]?"http://"+n[0]:n[0]}return{type:"link",raw:n[0],text:e,href:t,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let n=this.rules.inline.text.exec(e);if(n){let e=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:e}}}},Nl=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Oi,this.options.tokenizer=this.options.tokenizer||new Bl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Bi,block:$l.normal,inline:Al.normal};this.options.pedantic?(n.block=$l.pedantic,n.inline=Al.pedantic):this.options.gfm&&(n.block=$l.gfm,this.options.breaks?n.inline=Al.breaks:n.inline=Al.gfm),this.tokenizer.rules=n}static get rules(){return{block:$l,inline:Al}}static lex(n,t){return new e(t).lex(n)}static lexInline(n,t){return new e(t).inlineTokens(n)}lex(e){e=e.replace(Bi.carriageReturn,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let n=this.inlineQueue[e];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],t=!1){for(this.options.pedantic&&(e=e.replace(Bi.tabCharGlobal," ").replace(Bi.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(t=>!!(r=t.call({lexer:this},e,n))&&(e=e.substring(r.raw.length),n.push(r),!0)))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let t=n.at(-1);1===r.raw.length&&void 0!==t?t.raw+="\n":n.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let t=n.at(-1);"paragraph"===t?.type||"text"===t?.type?(t.raw+=(t.raw.endsWith("\n")?"":"\n")+r.raw,t.text+="\n"+r.text,this.inlineQueue.at(-1).src=t.text):n.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let t=n.at(-1);"paragraph"===t?.type||"text"===t?.type?(t.raw+=(t.raw.endsWith("\n")?"":"\n")+r.raw,t.text+="\n"+r.raw,this.inlineQueue.at(-1).src=t.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},n.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),n.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let n,t=1/0,r=e.slice(1);this.options.extensions.startBlock.forEach(e=>{n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let l=n.at(-1);t&&"paragraph"===l?.type?(l.raw+=(l.raw.endsWith("\n")?"":"\n")+r.raw,l.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(r),t=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let t=n.at(-1);"text"===t?.type?(t.raw+=(t.raw.endsWith("\n")?"":"\n")+r.raw,t.text+="\n"+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=t.text):n.push(r);continue}if(e){let n="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(n);break}throw new Error(n)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let t,r=e,i=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(r));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(r));)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(r));)t=i[2]?i[2].length:0,r=r.slice(0,i.index+t)+"["+"a".repeat(i[0].length-t-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let l=!1,a="";for(;e;){let t;if(l||(a=""),l=!1,this.options.extensions?.inline?.some(r=>!!(t=r.call({lexer:this},e,n))&&(e=e.substring(t.raw.length),n.push(t),!0)))continue;if(t=this.tokenizer.escape(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.tag(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.link(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(t.raw.length);let r=n.at(-1);"text"===t.type&&"text"===r?.type?(r.raw+=t.raw,r.text+=t.text):n.push(t);continue}if(t=this.tokenizer.emStrong(e,r,a)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.codespan(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.br(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.del(e)){e=e.substring(t.raw.length),n.push(t);continue}if(t=this.tokenizer.autolink(e)){e=e.substring(t.raw.length),n.push(t);continue}if(!this.state.inLink&&(t=this.tokenizer.url(e))){e=e.substring(t.raw.length),n.push(t);continue}let i=e;if(this.options.extensions?.startInline){let n,t=1/0,r=e.slice(1);this.options.extensions.startInline.forEach(e=>{n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(t=this.tokenizer.inlineText(i)){e=e.substring(t.raw.length),"_"!==t.raw.slice(-1)&&(a=t.raw.slice(-1)),l=!0;let r=n.at(-1);"text"===r?.type?(r.raw+=t.raw,r.text+=t.text):n.push(t);continue}if(e){let n="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(n);break}throw new Error(n)}}return n}},Fl=class{options;parser;constructor(e){this.options=e||Oi}space(e){return""}code({text:e,lang:n,escaped:t}){let r=(n||"").match(Bi.notSpaceStart)?.[0],i=e.replace(Bi.endingNewline,"")+"\n";return r?'<pre><code class="language-'+Ol(r)+'">'+(t?i:Ol(i,!0))+"</code></pre>\n":"<pre><code>"+(t?i:Ol(i,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:n}){return`<h${n}>${this.parser.parseInline(e)}</h${n}>\n`}hr(e){return"<hr>\n"}list(e){let n=e.ordered,t=e.start,r="";for(let n=0;n<e.items.length;n++){let t=e.items[n];r+=this.listitem(t)}let i=n?"ol":"ul";return"<"+i+(n&&1!==t?' start="'+t+'"':"")+">\n"+r+"</"+i+">\n"}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let n="",t="";for(let n=0;n<e.header.length;n++)t+=this.tablecell(e.header[n]);n+=this.tablerow({text:t});let r="";for(let n=0;n<e.rows.length;n++){let i=e.rows[n];t="";for(let e=0;e<i.length;e++)t+=this.tablecell(i[e]);r+=this.tablerow({text:t})}return r&&(r=`<tbody>${r}</tbody>`),"<table>\n<thead>\n"+n+"</thead>\n"+r+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){let n=this.parser.parseInline(e.tokens),t=e.header?"th":"td";return(e.align?`<${t} align="${e.align}">`:`<${t}>`)+n+`</${t}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ol(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:t}){let r=this.parser.parseInline(t),i=Dl(e);if(null===i)return r;let l='<a href="'+(e=i)+'"';return n&&(l+=' title="'+Ol(n)+'"'),l+=">"+r+"</a>",l}image({href:e,title:n,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=Dl(e);if(null===i)return Ol(t);let l=`<img src="${e=i}" alt="${t}"`;return n&&(l+=` title="${Ol(n)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ol(e.text)}},Wl=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Vl=class e{options;renderer;textRenderer;constructor(e){this.options=e||Oi,this.options.renderer=this.options.renderer||new Fl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Wl}static parse(n,t){return new e(t).parse(n)}static parseInline(n,t){return new e(t).parseInline(n)}parse(e){let n="";for(let t=0;t<e.length;t++){let r=e[t];if(this.options.extensions?.renderers?.[r.type]){let e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(e.type)){n+=t||"";continue}}let i=r;switch(i.type){case"space":n+=this.renderer.space(i);break;case"hr":n+=this.renderer.hr(i);break;case"heading":n+=this.renderer.heading(i);break;case"code":n+=this.renderer.code(i);break;case"table":n+=this.renderer.table(i);break;case"blockquote":n+=this.renderer.blockquote(i);break;case"list":n+=this.renderer.list(i);break;case"checkbox":n+=this.renderer.checkbox(i);break;case"html":n+=this.renderer.html(i);break;case"def":n+=this.renderer.def(i);break;case"paragraph":n+=this.renderer.paragraph(i);break;case"text":n+=this.renderer.text(i);break;default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,n=this.renderer){let t="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){t+=e||"";continue}}let l=i;switch(l.type){case"escape":case"text":t+=n.text(l);break;case"html":t+=n.html(l);break;case"link":t+=n.link(l);break;case"image":t+=n.image(l);break;case"checkbox":t+=n.checkbox(l);break;case"strong":t+=n.strong(l);break;case"em":t+=n.em(l);break;case"codespan":t+=n.codespan(l);break;case"br":t+=n.br(l);break;case"del":t+=n.del(l);break;default:{let e='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return t}},Kl=class{options;block;constructor(e){this.options=e||Oi}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Nl.lex:Nl.lexInline}provideParser(){return this.block?Vl.parse:Vl.parseInline}},Xl=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Vl;Renderer=Fl;TextRenderer=Wl;Lexer=Nl;Tokenizer=Bl;Hooks=Kl;constructor(...e){this.use(...e)}walkTokens(e,n){let t=[];for(let r of e)switch(t=t.concat(n.call(this,r)),r.type){case"table":{let e=r;for(let r of e.header)t=t.concat(this.walkTokens(r.tokens,n));for(let r of e.rows)for(let e of r)t=t.concat(this.walkTokens(e.tokens,n));break}case"list":{let e=r;t=t.concat(this.walkTokens(e.items,n));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);t=t.concat(this.walkTokens(i,n))}):e.tokens&&(t=t.concat(this.walkTokens(e.tokens,n)))}}return t}use(...e){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let t={...e};if(t.async=this.defaults.async||t.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){let t=n.renderers[e.name];n.renderers[e.name]=t?function(...n){let r=e.renderer.apply(this,n);return!1===r&&(r=t.apply(this,n)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");let t=n[e.level];t?t.unshift(e.tokenizer):n[e.level]=[e.tokenizer],e.start&&("block"===e.level?n.startBlock?n.startBlock.push(e.start):n.startBlock=[e.start]:"inline"===e.level&&(n.startInline?n.startInline.push(e.start):n.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(n.childTokens[e.name]=e.childTokens)}),t.extensions=n),e.renderer){let n=this.defaults.renderer||new Fl(this.defaults);for(let t in e.renderer){if(!(t in n))throw new Error(`renderer '${t}' does not exist`);if(["options","parser"].includes(t))continue;let r=t,i=e.renderer[r],l=n[r];n[r]=(...e)=>{let t=i.apply(n,e);return!1===t&&(t=l.apply(n,e)),t||""}}t.renderer=n}if(e.tokenizer){let n=this.defaults.tokenizer||new Bl(this.defaults);for(let t in e.tokenizer){if(!(t in n))throw new Error(`tokenizer '${t}' does not exist`);if(["options","rules","lexer"].includes(t))continue;let r=t,i=e.tokenizer[r],l=n[r];n[r]=(...e)=>{let t=i.apply(n,e);return!1===t&&(t=l.apply(n,e)),t}}t.tokenizer=n}if(e.hooks){let n=this.defaults.hooks||new Kl;for(let t in e.hooks){if(!(t in n))throw new Error(`hook '${t}' does not exist`);if(["options","block"].includes(t))continue;let r=t,i=e.hooks[r],l=n[r];Kl.passThroughHooks.has(t)?n[r]=e=>{if(this.defaults.async&&Kl.passThroughHooksRespectAsync.has(t))return(async()=>{let t=await i.call(n,e);return l.call(n,t)})();let r=i.call(n,e);return l.call(n,r)}:n[r]=(...e)=>{if(this.defaults.async)return(async()=>{let t=await i.apply(n,e);return!1===t&&(t=await l.apply(n,e)),t})();let t=i.apply(n,e);return!1===t&&(t=l.apply(n,e)),t}}t.hooks=n}if(e.walkTokens){let n=this.defaults.walkTokens,r=e.walkTokens;t.walkTokens=function(e){let t=[];return t.push(r.call(this,e)),n&&(t=t.concat(n.call(this,e))),t}}this.defaults={...this.defaults,...t}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Nl.lex(e,n??this.defaults)}parser(e,n){return Vl.parse(e,n??this.defaults)}parseMarkdown(e){return(n,t)=>{let r={...t},i={...this.defaults,...r},l=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||null===n)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let t=i.hooks?await i.hooks.preprocess(n):n,r=await(i.hooks?await i.hooks.provideLexer():e?Nl.lex:Nl.lexInline)(t,i),l=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let a=await(i.hooks?await i.hooks.provideParser():e?Vl.parse:Vl.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(a):a})().catch(l);try{i.hooks&&(n=i.hooks.preprocess(n));let t=(i.hooks?i.hooks.provideLexer():e?Nl.lex:Nl.lexInline)(n,i);i.hooks&&(t=i.hooks.processAllTokens(t)),i.walkTokens&&this.walkTokens(t,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?Vl.parse:Vl.parseInline)(t,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return l(e)}}}onError(e,n){return t=>{if(t.message+="\nPlease report this to https://github.com/markedjs/marked.",e){let e="<p>An error occurred:</p><pre>"+Ol(t.message+"",!0)+"</pre>";return n?Promise.resolve(e):e}if(n)return Promise.reject(t);throw t}}};function Yl(e,n){return Xl.parse(e,n)}function Zl({title:e,defaultOpen:n=!1,children:t}){const[r,i]=Te(n),l=Me(null);return ge("div",{class:"_pillar-collapsible pillar-collapsible",children:[ge("button",{type:"button",class:"_pillar-collapsible-header pillar-collapsible-header",onClick:()=>i(!r),children:[ge("span",{class:"_pillar-collapsible-icon pillar-collapsible-icon",style:{transform:r?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"},children:"▶"}),ge("span",{class:"_pillar-collapsible-title pillar-collapsible-title",children:e})]}),ge("div",{class:"_pillar-collapsible-content-wrapper pillar-collapsible-content-wrapper "+(r?"_pillar-collapsible-content-wrapper--expanded pillar-collapsible-content-wrapper--expanded":""),children:ge("div",{ref:l,class:"_pillar-collapsible-content pillar-collapsible-content",children:t})})]})}function Gl({sources:e}){return e&&0!==e.length?ge("div",{class:"_pillar-source-list pillar-source-list",children:e.map((e,n)=>ge("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",class:"_pillar-source-item pillar-source-item",children:ge("span",{class:"_pillar-source-title pillar-source-title",children:e.title})},n))}):ge("span",{})}function Ql({language:e,children:n}){const[t,r]=Te(!1);return ge("div",{class:"_pillar-code-block pillar-code-block",children:[e&&ge("div",{class:"_pillar-code-header pillar-code-header",children:[ge("span",{class:"_pillar-code-language pillar-code-language",children:e}),ge("button",{type:"button",class:"_pillar-code-copy pillar-code-copy",onClick:async()=>{try{await navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){c.error("[Pillar] Failed to copy code:",e)}},children:t?"Copied!":"Copy"})]}),ge("pre",{class:`_pillar-code-pre pillar-code-pre language-${e||"text"}`,children:ge("code",{class:"_pillar-code-content pillar-code-content",children:n})})]})}function Jl({message:e,isActive:n=!0}){return ge("div",{class:"_pillar-progress-indicator pillar-progress-indicator "+(n?"_pillar-progress-indicator--active pillar-progress-indicator--active":""),children:[n&&ge("div",{class:"_pillar-loading-spinner pillar-loading-spinner"}),ge("span",{class:"_pillar-progress-message pillar-progress-message",children:e})]})}function ea({content:e,class:n}){if(!e||!e.trim())return ge("span",{});try{return ge("div",{class:`_pillar-markdown pillar-markdown ${n||""}`,children:na(Yl.lexer(e))})}catch(t){return c.error("[Pillar] Markdown parsing error:",t),ge("div",{class:`_pillar-markdown pillar-markdown ${n||""}`,children:e})}}function na(e){return e.map((e,n)=>function(e,n){switch(e.type){case"heading":return function(e,n){const t=`h${e.depth}`;return ge(t,{class:`_pillar-md-heading _pillar-md-h${e.depth} pillar-md-heading pillar-md-h${e.depth}`,children:ra(e.tokens)},n)}(e,n);case"paragraph":return function(e,n){return ge("p",{class:"_pillar-md-paragraph pillar-md-paragraph",children:ra(e.tokens)},n)}(e,n);case"text":return function(e,n){if(e.tokens&&e.tokens.length>0)return ge(K,{children:ra(e.tokens)},n);return ge(K,{children:e.text},n)}(e,n);case"code":return function(e,n){const t=e.lang||"",r=e.text;if(t.startsWith("collapsible:")){return ge(Zl,{title:t.substring(12),children:ge(ea,{content:r})},n)}if(t.startsWith("collapsible-open:")){return ge(Zl,{title:t.substring(17),defaultOpen:!0,children:ge(ea,{content:r})},n)}if("sources"===t)try{return ge(Gl,{sources:JSON.parse(r)},n)}catch{c.warn("[Pillar] Failed to parse sources JSON")}if(t.startsWith("progress:")){return ge(Jl,{message:t.substring(9),isActive:!0},n)}if(t.startsWith("progress-done:")){return ge(Jl,{message:t.substring(14),isActive:!1},n)}return ge(Ql,{language:t||void 0,children:r},n)}(e,n);case"blockquote":return function(e,n){return ge("blockquote",{class:"_pillar-md-blockquote pillar-md-blockquote",children:na(e.tokens)},n)}(e,n);case"list":return function(e,n){const t=e.items.map((e,n)=>ta(e,n));if(e.ordered)return ge("ol",{start:e.start||1,class:"_pillar-md-list _pillar-md-list--ordered pillar-md-list pillar-md-list--ordered",children:t},n);return ge("ul",{class:"_pillar-md-list _pillar-md-list--unordered pillar-md-list pillar-md-list--unordered",children:t},n)}(e,n);case"list_item":return ta(e,n);case"table":return function(e,n){return ge("div",{class:"_pillar-md-table-wrapper pillar-md-table-wrapper",children:ge("table",{class:"_pillar-md-table pillar-md-table",children:[ge("thead",{children:ge("tr",{children:e.header.map((n,t)=>ge("th",{style:e.align[t]?{textAlign:e.align[t]}:void 0,class:"_pillar-md-th pillar-md-th",children:ra(n.tokens)},t))})}),ge("tbody",{children:e.rows.map((n,t)=>ge("tr",{children:n.map((n,t)=>ge("td",{style:e.align[t]?{textAlign:e.align[t]}:void 0,class:"_pillar-md-td pillar-md-td",children:ra(n.tokens)},t))},t))})]})},n)}(e,n);case"hr":return ge("hr",{class:"_pillar-md-hr pillar-md-hr"},n);case"space":return null;case"html":return function(e,n){const t=e.raw.match(/<(\w+)\s*([^>]*)\/?\s*>/);if(t){const[,e,r]=t,i=function(e){const n={},t=/(\w+)=["']([^"']*)["']/g;let r;for(;null!==(r=t.exec(e));)n[r[1]]=r[2];return n}(r);switch(e){case"SourceList":if(i.sources)try{return ge(Gl,{sources:JSON.parse(i.sources)},n)}catch{c.warn("[Pillar] Failed to parse SourceList sources")}break;case"Progress":return ge(Jl,{message:i.message||"Processing...",isActive:"false"!==i.active},n);case"Collapsible":return ge(Zl,{title:i.title||"Details",defaultOpen:"true"===i.open,children:i.content?ge(ea,{content:i.content}):null},n)}}return ge("span",{dangerouslySetInnerHTML:{__html:e.raw}},n)}(e,n);case"strong":return ge("strong",{children:ra(e.tokens)},n);case"em":return ge("em",{children:ra(e.tokens)},n);case"codespan":return ge("code",{class:"_pillar-md-code-inline pillar-md-code-inline",children:e.text},n);case"link":const t=e;return ge("a",{href:t.href,title:t.title||void 0,target:"_blank",rel:"noopener noreferrer",class:"_pillar-md-link pillar-md-link",children:ra(t.tokens)},n);case"image":const r=e;return ge("img",{src:r.href,alt:r.text,title:r.title||void 0,class:"_pillar-md-image pillar-md-image"},n);case"br":return ge("br",{},n);case"del":return ge("del",{children:ra(e.tokens)},n);default:return"raw"in e&&"string"==typeof e.raw?ge("span",{children:e.raw},n):null}}(e,n)).filter(Boolean)}function ta(e,n){return e.task?ge("li",{class:"_pillar-md-list-item _pillar-md-task-item pillar-md-list-item pillar-md-task-item",children:[ge("input",{type:"checkbox",checked:e.checked,disabled:!0,class:"_pillar-md-task-checkbox pillar-md-task-checkbox"}),ge("span",{class:e.checked?"_pillar-md-task-text--checked pillar-md-task-text--checked":"",children:na(e.tokens)})]},n):ge("li",{class:"_pillar-md-list-item pillar-md-list-item",children:na(e.tokens)},n)}function ra(e){return e&&0!==e.length?e.map((e,n)=>{switch(e.type){case"text":case"escape":return e.text;case"strong":return ge("strong",{children:ra(e.tokens)},n);case"em":return ge("em",{children:ra(e.tokens)},n);case"codespan":return ge("code",{class:"_pillar-md-code-inline pillar-md-code-inline",children:e.text},n);case"link":const t=e;return ge("a",{href:t.href,title:t.title||void 0,target:"_blank",rel:"noopener noreferrer",class:"_pillar-md-link pillar-md-link",children:ra(t.tokens)},n);case"image":const r=e;return ge("img",{src:r.href,alt:r.text,title:r.title||void 0,class:"_pillar-md-image pillar-md-image"},n);case"br":return ge("br",{},n);case"del":return ge("del",{children:ra(e.tokens)},n);default:return"raw"in e&&"string"==typeof e.raw?e.raw:null}}):null}function ia({progress:e,isActive:n=!1,isLast:t=!1,responseStarted:r=!1,nested:i=!1,groupActive:l=!1}){const a="active"===e.status||void 0===e.status&&n,o="error"===e.status||"query_failed"===e.kind,s="thinking"===e.kind||"step_start"===e.kind,p=function(e,n=50){const[t,r]=Te(e);return Ie(()=>{const t=setTimeout(()=>{r(e)},n);return()=>{clearTimeout(t)}},[e,n]),t}(e.text,50),[c,d]=Te(0);Ie(()=>{if(!s||!a)return;const n=e.metadata?._startTime||Date.now();d(Math.max(1,Math.round((Date.now()-n)/1e3)));const t=setInterval(()=>{d(Math.round((Date.now()-n)/1e3))},1e3);return()=>clearInterval(t)},[s,a,e.metadata]);const u=Boolean(e.text),h=e.children&&e.children.length>0,g=e.metadata?.sources,m="search_complete"===e.kind&&g&&g.length>0,f=!0===e.metadata?.no_sources_used,v=e.metadata?.arguments,b=v&&Object.keys(v).length>0,_=u||h||m&&!f||b,x=e.metadata?.result_count,y="search"===e.kind&&0===x,[w,k]=Te(!1),[S,C]=Te(!1),P=_&&(w?S:i?a||t&&l:a||t&&!r),E=Me(null),[z,T]=Te(!1),[I,M]=Te(!1);Ie(()=>{k(!1)},[a]),Ie(()=>{M(!1)},[e.id,e.progress_id]),Ie(()=>{E.current&&a&&e.text&&!I&&(E.current.scrollTop=E.current.scrollHeight)},[e.text,a,I]);const R=()=>{_&&(k(!0),C(!P))},$=P?"rotate(90deg)":"rotate(0deg)";if(!(e.label||e.message||e.text||h||m||s))return null;const A=(()=>{if(s){if(a)return c>0?`Thought for ${c}s`:"Thinking...";const n=e.metadata?._durationSeconds,t=n||c;return t>0?`Thought for ${t}s`:"Thought"}return e.label||e.message||function(e){switch(e){case"processing":return"Processing...";case"search":return"Searching...";case"search_complete":return"Search complete";case"query":return"Executing action...";case"query_complete":return"Action complete";case"query_failed":return"Action failed";case"generating":return"Generating answer...";case"thinking":case"step_start":return"Thinking...";case"step_complete":return"Done";case"tool_call":return"Running tool...";case"plan":return"Planning...";default:return"Working..."}}(e.kind)})();return ge("div",{class:`_pillar-progress-row pillar-progress-row${o?" _pillar-progress-row--error pillar-progress-row--error":""}${a?" _pillar-progress-row--active pillar-progress-row--active":""}${t?" _pillar-progress-row--last pillar-progress-row--last":""}${i?" _pillar-progress-row--nested pillar-progress-row--nested":""}`,role:"status","aria-live":a?"polite":"off","aria-label":`${A}: ${a?"in progress":o?"error":"complete"}`,children:[ge("div",{class:"_pillar-progress-row-header pillar-progress-row-header",onClick:R,style:{cursor:_?"pointer":"default"},"data-expanded":P,role:_?"button":void 0,"aria-expanded":_?P:void 0,tabIndex:_?0:void 0,onKeyDown:_?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R())}:void 0,children:[o&&ge("span",{class:"_pillar-progress-error-icon pillar-progress-error-icon","aria-label":"Error",children:"✗"}),ge("span",{class:"_pillar-progress-message pillar-progress-message",children:A}),y&&ge("span",{class:"_pillar-progress-no-results pillar-progress-no-results",children:"— no relevant results"}),_&&!o&&ge("span",{class:"_pillar-progress-chevron pillar-progress-chevron",style:{transform:$,transition:"transform 0.2s ease, opacity 0.15s ease"},"aria-hidden":"true",children:"▶"})]}),_&&ge("div",{class:"_pillar-progress-content-wrapper pillar-progress-content-wrapper "+(P?"_pillar-progress-content-wrapper--expanded pillar-progress-content-wrapper--expanded":""),children:ge("div",{class:"_pillar-progress-content-container pillar-progress-content-container",children:[b&&ge("div",{class:"_pillar-progress-arguments pillar-progress-arguments",children:Object.entries(v).map(([e,n])=>ge("span",{class:"_pillar-progress-argument pillar-progress-argument",children:[ge("span",{class:"_pillar-progress-argument-key pillar-progress-argument-key",children:[e,":"]})," ",ge("span",{class:"_pillar-progress-argument-value pillar-progress-argument-value",children:"string"==typeof n?n:JSON.stringify(n)})]},e))}),u&&ge("div",{class:"_pillar-progress-text-preview-wrapper pillar-progress-text-preview-wrapper",children:[z&&ge("div",{class:"_pillar-progress-text-gradient pillar-progress-text-gradient"}),ge("div",{ref:E,class:"_pillar-progress-text-preview pillar-progress-text-preview",onScroll:()=>{if(E.current){const{scrollTop:e,scrollHeight:n,clientHeight:t}=E.current;M(!(e>=n-t-5)),T(e>0)}},children:ge(ea,{content:p||""})})]}),h?ge("div",{class:"_pillar-progress-children pillar-progress-children",children:e.children.map((e,n)=>ge("div",{class:"_pillar-progress-child-item pillar-progress-child-item",children:e.url?ge("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",class:"_pillar-progress-child-link pillar-progress-child-link",children:e.label}):ge("span",{class:"_pillar-progress-child-label pillar-progress-child-label",children:e.label})},e.id||n))}):m?ge("div",{class:"_pillar-progress-sources pillar-progress-sources",children:g.map((e,n)=>ge("div",{class:"_pillar-progress-source-item pillar-progress-source-item",children:ge("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",class:"_pillar-progress-source-link pillar-progress-source-link",children:ge("span",{class:"_pillar-progress-source-title pillar-progress-source-title",children:e.title})})},n))}):null]})})]})}function la({events:e,summary:n,isLast:t=!1,responseStarted:r=!1}){const i=e.some(e=>"active"===e.status),[l,a]=Te(!1),[o,s]=Te(!1),p=l?o:i||t&&!r;Ie(()=>{i&&a(!1)},[i]);const c=()=>{a(!0),s(!p)};return ge("div",{class:`_pillar-progress-group pillar-progress-group${i?" _pillar-progress-group--active pillar-progress-group--active":""}${t?" _pillar-progress-group--last pillar-progress-group--last":""}`,children:[ge("div",{class:"_pillar-progress-group-header pillar-progress-group-header",onClick:c,role:"button","aria-expanded":p,tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),c())},children:[ge("span",{class:"_pillar-progress-group-chevron pillar-progress-group-chevron",style:{transform:p?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"},"aria-hidden":"true",children:"▶"}),ge("span",{class:"_pillar-progress-group-summary pillar-progress-group-summary",children:n}),i&&ge("span",{class:"_pillar-progress-group-active-dot pillar-progress-group-active-dot"})]}),ge("div",{class:"_pillar-progress-group-children pillar-progress-group-children "+(p?"_pillar-progress-group-children--expanded pillar-progress-group-children--expanded":""),children:ge("div",{class:"_pillar-progress-group-children-inner pillar-progress-group-children-inner",children:e.map((n,t)=>ge(ia,{progress:n,isActive:"active"===n.status,isLast:t===e.length-1,responseStarted:r,nested:!0,groupActive:i},n.id||n.progress_id||t))})})]})}Yl.options=Yl.setOptions=function(e){return Xl.setOptions(e),Yl.defaults=Xl.defaults,Di(Yl.defaults),Yl},Yl.getDefaults=Hi,Yl.defaults=Oi,Yl.use=function(...e){return Xl.use(...e),Yl.defaults=Xl.defaults,Di(Yl.defaults),Yl},Yl.walkTokens=function(e,n){return Xl.walkTokens(e,n)},Yl.parseInline=Xl.parseInline,Yl.Parser=Vl,Yl.parser=Vl.parse,Yl.Renderer=Fl,Yl.TextRenderer=Wl,Yl.Lexer=Nl,Yl.lexer=Nl.lex,Yl.Tokenizer=Bl,Yl.Hooks=Kl,Yl.parse=Yl,Yl.options,Yl.setOptions,Yl.use,Yl.walkTokens,Yl.parseInline,Vl.parse,Nl.lex;const aa=new Set(["search","search_complete","tool_call","plan","generating","query","query_complete","query_failed","step_complete","processing"]);const oa=new Set(["search_complete","query_complete","step_complete"]);function sa(e){const n=e.filter(e=>!oa.has(e.kind));if(1===n.length&&n[0].label)return n[0].label;let t=0,r=0;for(const n of e)switch(n.kind){case"search":case"search_complete":break;case"query":case"query_complete":case"query_failed":case"tool_call":t++;break;default:r++}const i=e.filter(e=>"search_complete"===e.kind).length,l=e.filter(e=>"search"===e.kind).length,a=Math.max(i,l),o=[];return a>0&&o.push(`Searched ${a} ${1===a?"source":"sources"}`),t>0&&o.push(`Ran ${t} ${1===t?"action":"actions"}`),r>0&&0===o.length&&o.push(`${r} ${1===r?"step":"steps"}`),o.length>0?o.join(", "):`${e.length} steps`}function pa({events:e,responseStarted:n=!1}){if(!e||0===e.length)return null;const t=function(e){const n=[];let t=[];const r=()=>{t.length>0&&(n.push({type:"tool_group",events:[...t],summary:sa(t)}),t=[])};for(const i of e)"thinking"===i.kind||"step_start"===i.kind?(r(),n.push({type:"thinking",event:i})):(aa.has(i.kind),t.push(i));return r(),n}(e);return ge("div",{class:"_pillar-progress-stack pillar-progress-stack",children:t.flatMap((e,r)=>{if("thinking"===e.type)return[ge(ia,{progress:e.event,isActive:"active"===e.event.status,isLast:r===t.length-1,responseStarted:n},e.event.id||e.event.progress_id||`thinking-${r}`)];const i=e.events.filter(e=>!oa.has(e.kind));return i.length<=2?e.events.map((i,l)=>ge(ia,{progress:i,isActive:"active"===i.status,isLast:r===t.length-1&&l===e.events.length-1,responseStarted:n},i.id||i.progress_id||`flat-${r}-${l}`)):[ge(la,{events:e.events,summary:e.summary,isLast:r===t.length-1,responseStarted:n},`group-${r}`)]})})}function ca({error:e,onRetry:n}){return ge("div",{class:"_pillar-error-row pillar-error-row",role:"alert",children:[ge("span",{class:"_pillar-error-row-icon pillar-error-row-icon","aria-hidden":"true",children:"✗"}),ge("span",{class:"_pillar-error-row-message pillar-error-row-message",children:e.message}),ge("button",{class:"_pillar-error-row-retry pillar-error-row-retry",onClick:n,type:"button","aria-label":"Retry",children:[ge("span",{dangerouslySetInnerHTML:{__html:'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"></polyline><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"></path></svg>'}}),"Retry"]})]})}function da({session:e,onResume:n,onDiscard:t,isResuming:r=!1}){return ge("div",e.elapsedMs<15e3||r?{class:"_pillar-resume-prompt _pillar-resume-prompt--seamless pillar-resume-prompt",children:[ge("div",{class:"_pillar-resume-prompt-spinner pillar-resume-prompt-spinner"}),ge("span",{class:"_pillar-resume-prompt-text pillar-resume-prompt-text",children:"Resuming conversation..."})]}:{class:"_pillar-resume-prompt pillar-resume-prompt",children:[ge("div",{class:"_pillar-resume-prompt-content pillar-resume-prompt-content",children:[ge("div",{class:"_pillar-resume-prompt-icon pillar-resume-prompt-icon",children:ge("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[ge("circle",{cx:"12",cy:"12",r:"10"}),ge("polyline",{points:"12 6 12 12 16 14"})]})}),ge("div",{class:"_pillar-resume-prompt-body pillar-resume-prompt-body",children:[ge("div",{class:"_pillar-resume-prompt-title pillar-resume-prompt-title",children:"Session Interrupted"}),ge("div",{class:"_pillar-resume-prompt-message pillar-resume-prompt-message",children:[e.userMessage&&ge("span",{class:"_pillar-resume-prompt-user-msg pillar-resume-prompt-user-msg",children:['"',ua(e.userMessage,50),'"']}),e.partialResponse&&ge("span",{class:"_pillar-resume-prompt-summary pillar-resume-prompt-summary",children:ua(e.partialResponse,80)})]})]})]}),ge("div",{class:"_pillar-resume-prompt-actions pillar-resume-prompt-actions",children:[ge("button",{type:"button",class:"_pillar-resume-prompt-btn _pillar-resume-prompt-btn--primary pillar-resume-prompt-btn",onClick:n,children:[ge("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"none",children:ge("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Resume"]}),ge("button",{type:"button",class:"_pillar-resume-prompt-btn _pillar-resume-prompt-btn--ghost pillar-resume-prompt-btn",onClick:t,children:"Discard"})]})]})}function ua(e,n){return e.length<=n?e:e.slice(0,n)+"..."}function ha(){const e=Qr(),n=e?.config?.domScanning?.excludeSelector;return{excludeSelector:n?`#pillar-root, ${n}`:"#pillar-root"}}function ga(){const e=$r(),n=Me(null),t=Me(null),[r,i]=Te(!1),l=$e(async n=>{const t=performance.now(),r=(new Date).toISOString();c.log("[Pillar] Received action_request:",n.action_name,n.parameters,`at ${r}`);const i=Qr();if(i)try{if("interact_with_page"===n.action_name){const r=n.parameters;ii(r.operation,n.tool_call_id);try{if(si())return await e.mcp.sendActionResult(n.action_name,{success:!1,error:"User cancelled action"},n.tool_call_id),void c.log("[Pillar] Page interaction cancelled by user before execution");const l=await i.handlePageInteraction(r);if(si())return await e.mcp.sendActionResult(n.action_name,{success:!1,error:"User cancelled action"},n.tool_call_id),void c.log("[Pillar] Page interaction cancelled by user after execution");let a=null;if(l.success&&i?.isDOMScanningEnabled){await new Promise(e=>setTimeout(e,150));const e=function(e){const n=e?.root||document.body,t={lines:[],refs:new Set,interactableCount:0,totalLength:0,budgetExhausted:!1,maxDepth:0,options:{...vi,...e}};Ai(n,t,0);const r=t.lines.filter(e=>!ki.has(e)),i=[...Si].filter(e=>!t.refs.has(e)),l=/\[\[pr-[a-z0-9]+\]\]$/,a=r.filter(e=>l.test(e)).length,o=r.length>0||i.length>0;ki=new Set(t.lines),Si=new Set(t.refs);let s=null;if(o){const e=[];r.length>0&&(e.push(...r),e.push(""));const n=i.length>0?`, ${i.length} removed: ${i.join(", ")}`:"";e.push(`=== ${a} new${n} ===`),s=e.join("\n")}return{content:s,removedRefs:i,newInteractableCount:a,totalInteractableCount:t.refs.size,hasChanges:o,timestamp:Date.now(),url:window.location.href,title:document.title}}(ha());a=e.content,c.log("[Pillar] DOM delta scanned after page interaction:",e.hasChanges?`${e.newInteractableCount} new, ${e.removedRefs.length} removed`:"no changes")}await e.mcp.sendActionResult(n.action_name,{...l,dom_snapshot:a},n.tool_call_id);const o=Math.round(performance.now()-t);c.log(`[Pillar] Page interaction "${r.operation}" completed in ${o}ms:`,l)}finally{li(),oi()}return}const r=i.getHandler(n.action_name);let l;r?l=await Promise.resolve(r(n.parameters)):await i.executeTask({id:`action-${n.action_name}`,name:n.action_name,data:n.parameters}),await e.mcp.sendActionResult(n.action_name,{success:!0,result:l},n.tool_call_id);const a=Math.round(performance.now()-t);c.log(`[Pillar] Action "${n.action_name}" completed in ${a}ms`)}catch(r){const i=r instanceof Error?r.message:String(r);await e.mcp.sendActionResult(n.action_name,{success:!1,error:i},n.tool_call_id);const l=Math.round(performance.now()-t);c.error(`[Pillar] Action "${n.action_name}" failed after ${l}ms:`,r)}else c.error("[Pillar] SDK not initialized, cannot execute action"),await e.mcp.sendActionResult(n.action_name,{success:!1,error:"SDK not initialized"},n.tool_call_id)},[e]),a=$e(()=>{const e=Qr(),n=e?.config?.productKey??"";Yt(),gi(n)},[]);Ie(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[Qn.value,ut.value]),Ie(()=>{const e=Qr();if(!e)return;return e.on("task:complete",({name:e,success:n})=>{Ut(e,n);const t=function(e,n){const t=e.replace(/_/g," ").toLowerCase();return n?t.startsWith("open ")?`Opened ${t.slice(5)}`:t.startsWith("go to ")?`Navigated to ${t.slice(6)}`:t.startsWith("navigate to ")?`Navigated to ${t.slice(12)}`:"Done!":`Failed to ${t}`}(e,n);qt(e,t)})},[]);const o=$e(e=>{const n=Qr();c.log("[Pillar] handleActionsReceived called with",e.length,"actions"),c.log("[Pillar] Actions detail:",e.map(e=>({name:e.name,autoRun:e.autoRun})));const t=e.filter(e=>!0===e.autoRun),r=e.filter(e=>!e.autoRun);return c.log("[Pillar] Auto-run actions:",t.length,", Manual actions:",r.length),n&&t.length>0?(c.log("[Pillar] Executing auto-run actions..."),t.forEach(e=>{const t=e.data||{},r=t.path,i=t.url,l=Qn.value.length-1;l>=0&&jt(l,e.name),c.log("[Pillar] Executing action:",e.name),n.executeTask({id:e.id,name:e.name,taskType:e.taskType,data:t,path:r,externalUrl:i})}),[]):n?r:(c.warn("[Pillar] No Pillar instance available for auto-run"),e)},[]),s=$e(async n=>{const r=new AbortController;t.current=r;let i=[];const a=await e.chat({message:n.message,history:n.history,existingConversationId:n.conversationId,userContext:n.userContext,images:n.images,resume:n.resume,signal:r.signal,onChunk:e=>{vt(e)},onActions:e=>{i=o(e)},onProgress:e=>{Kt(e)},onConversationStarted:()=>{const e=Qr(),n=e?.config?.productKey??"",t=Jn.value;n&&t&&Promise.resolve().then(function(){return fi}).then(({saveActiveSession:e})=>{e(t,n)})},onActionRequest:l,onRequestId:e=>ot(e)});return{response:a,receivedActions:i}},[e,o,l]),p=$e(async(e,n,r)=>{dt(),Ht(e,n,r),Ft(!0),Ot("");try{const t=Qn.value.slice(0,-1),i=!Jn.value;i&&Bt(crypto.randomUUID());const{response:l,receivedActions:a}=await s({message:e,conversationId:Jn.value,userContext:n,images:r,history:t});let p=a;l.actions&&l.actions.length>0&&(p=o(l.actions)),Dt(l.message,l.messageId,p,l.sources),l.conversationId&&Bt(l.conversationId),i&&Jn.value&&gr(Jn.value,e);{const e=Qr(),n=e?.config?.productKey??"";n&&gi(n)}}catch(t){if("AbortError"===t.name)return Zt(),void c.log("[Pillar] Chat cancelled by user");c.error("[Pillar] Chat error:",t),Zt(),ct({message:"Something went wrong. Please try again.",retryMessage:e,retryContext:n,retryImages:r})}finally{Ft(!1),Wt(),ot(null),t.current=null}},[e,s,o]),d=$e(async()=>{const e=ut.value;if(!e)return;const n=Qr(),r=n?.config?.productKey??"",l=n?.isDOMScanningEnabled??!1;let a=[...Ct.value];if(l){const e=Li(ha()),n={id:Xn(),type:"dom_snapshot",url:e.url,title:e.title,content:e.content,interactableCount:e.interactableCount,timestamp:e.timestamp};a=[...a,n]}i(!0),Ft(!0),Ot("");try{const{response:n,receivedActions:t}=await s({message:"",conversationId:e.conversationId,userContext:a.length>0?a:void 0,resume:!0});let i=t;n.actions&&n.actions.length>0&&(i=o(n.actions)),Dt(n.message,n.messageId,i,n.sources),Yt(),gi(r)}catch(n){if("AbortError"===n.name)return void Zt();c.error("[Pillar] Resume error:",n),Zt(),ct({message:"Failed to resume. Please try again.",retryMessage:e.userMessage}),Yt(),gi(r)}finally{i(!1),Ft(!1),Wt(),ot(null),t.current=null}},[s,o]);Ie(()=>{const e=ut.value;e&&e.elapsedMs<15e3&&d()},[ut.value,d]);const u=$e(()=>{t.current?.abort(),t.current=null;const n=at.value;null!==n&&(e.mcp.cancelStream(n),ot(null)),Ft(!1),Wt(),Zt(),Vt();const r=Qn.value,i=r.length>0?r[r.length-1]:null,l="assistant"===i?.role&&Boolean(i?.content?.trim()),a=Qr(),o=a?.config?.productKey??"";if(l&&Jn.value){const e=[...r].reverse().find(e=>"user"===e.role);Xt({conversationId:Jn.value,userMessage:e?.content??"",partialResponse:i.content??"",displayTrace:[],elapsedMs:99999})}else o&&gi(o)},[e]),h=$e(()=>{const e=pt.value;if(!e)return;dt();const n=Qn.value;n.length>0&&"user"===n[n.length-1].role&&(Qn.value=n.slice(0,-1)),p(e.retryMessage,e.retryContext,e.retryImages)},[p]),g=$e(async(n,t)=>{Nt(n,t),await e.submitFeedback(n,t)},[e]),m=$e((e,n,t)=>{if(lt.value)return;const r=Qr();if(r?.isDOMScanningEnabled??!1){const r=Li(ha()),i={id:Xn(),type:"dom_snapshot",url:r.url,title:r.title,content:r.content,interactableCount:r.interactableCount,timestamp:r.timestamp},l=[...n,i];return void p(e,l.length>0?l:void 0,t.length>0?t:void 0)}p(e,n.length>0?n:void 0,t.length>0?t:void 0)},[p]);return Ie(()=>{const e=wt.value,n=Pt.value,t=Et.value;e&&(Qt(),lr(),or(),m(e,n,t))},[kt.value,m]),ge("div",{class:"_pillar-chat-view pillar-chat-view",children:[ge("div",{class:"_pillar-chat-view-messages pillar-chat-view-messages",ref:n,children:[st.value&&ge("div",{class:"_pillar-chat-history-loading pillar-chat-history-loading",children:[ge("div",{class:"_pillar-chat-history-loading-message _pillar-chat-history-loading-message--user pillar-chat-history-loading-message--user",children:ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 70%"})}),ge("div",{class:"_pillar-chat-history-loading-message _pillar-chat-history-loading-message--assistant pillar-chat-history-loading-message--assistant",children:[ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 90%"}),ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 85%"}),ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 60%"})]}),ge("div",{class:"_pillar-chat-history-loading-message _pillar-chat-history-loading-message--user pillar-chat-history-loading-message--user",children:ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 55%"})}),ge("div",{class:"_pillar-chat-history-loading-message _pillar-chat-history-loading-message--assistant pillar-chat-history-loading-message--assistant",children:[ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 95%"}),ge("div",{class:"_pillar-chat-history-loading-bar pillar-chat-history-loading-bar",style:"width: 80%"})]})]}),0===Qn.value.length&&!ut.value&&!st.value&&ge("div",{class:"_pillar-chat-view-welcome pillar-chat-view-welcome",children:Hr.value?ge("div",{class:"_pillar-home-view-questions pillar-home-view-questions",children:[ge(Xr,{}),ge(Xr,{}),ge(Xr,{})]}):Lr.value&&Lr.value.length>0?ge("div",{class:"_pillar-home-view-questions pillar-home-view-questions",children:Lr.value.map(e=>ge(Kr,{text:e.text,onClick:()=>m(e.text,[],[])},e.id))}):ge(K,{children:[ge("div",{class:"_pillar-chat-view-welcome-icon pillar-chat-view-welcome-icon",children:"💬"}),ge("div",{class:"_pillar-chat-view-welcome-title pillar-chat-view-welcome-title",children:"Ask a question"}),ge("div",{class:"_pillar-chat-view-welcome-text pillar-chat-view-welcome-text",children:"Ask me anything about how to use this product."})]})}),Qn.value.map((e,n)=>ge("div",{class:`_pillar-chat-view-message pillar-chat-view-message _pillar-chat-view-message--${e.role} pillar-chat-view-message--${e.role}`,children:"user"===e.role?ge("div",{class:"_pillar-message-user pillar-message-user",children:[e.userContext&&e.userContext.length>0&&ge(Fr,{contexts:e.userContext,readOnly:!0}),e.images&&e.images.length>0&&ge("div",{class:"_pillar-message-user-images pillar-message-user-images",children:e.images.map((e,n)=>ge("img",{src:e.url,alt:`Attachment ${n+1}`,class:"_pillar-message-user-image pillar-message-user-image"},n))}),e.content]}):ge("div",{class:"_pillar-message-assistant-wrapper pillar-message-assistant-wrapper",children:[ge("div",{class:"_pillar-message-assistant-content pillar-message-assistant-content",children:[e.segments&&e.segments.length>0?e.segments.map((n,t)=>{if("progress"===n.type){const r=e.segments.slice(t+1).some(e=>"text"===e.type);return ge(pa,{events:n.events,responseStarted:r||Boolean(e.content)},`seg-${t}`)}return ge("div",{class:"_pillar-message-assistant pillar-message-assistant",children:ge(ea,{content:n.content})},`seg-${t}`)}):lt.value&&n===Qn.value.length-1&&ge("span",{class:"_pillar-thinking-shimmer pillar-thinking-shimmer",children:"Thinking..."}),e.actionStatus&&Object.keys(e.actionStatus).length>0&&ge("span",{class:"_pillar-action-status pillar-action-status",children:Object.entries(e.actionStatus).map(([e,n])=>ge("span",{class:`_pillar-action-status-indicator pillar-action-status-indicator _pillar-action-status-indicator--${n.status} pillar-action-status-indicator--${n.status}`,title:"failed"===n.status?n.errorMessage:e,dangerouslySetInnerHTML:{__html:"success"===n.status?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>':"failed"===n.status?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" opacity="0.3"/><path d="M12 2v4"/></svg>'}},e))})]}),"assistant"===e.role&&e.id&&e.content&&ge("div",{class:"_pillar-feedback-icons pillar-feedback-icons",children:[ge("button",{class:"_pillar-feedback-btn pillar-feedback-btn "+("up"===e.feedback?"_pillar-feedback-btn--active pillar-feedback-btn--active":""),onClick:()=>g(e.id,"up"),"aria-label":"Helpful",title:"Helpful",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"/></svg>'}}),ge("button",{class:"_pillar-feedback-btn pillar-feedback-btn "+("down"===e.feedback?"_pillar-feedback-btn--active pillar-feedback-btn--active":""),onClick:()=>g(e.id,"down"),"aria-label":"Not helpful",title:"Not helpful",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"/></svg>'}})]}),e.sources&&e.sources.length>0&&ge("div",{class:"_pillar-chat-sources pillar-chat-sources",children:[ge("div",{class:"_pillar-chat-sources-title pillar-chat-sources-title",children:"Sources"}),e.sources.map(e=>ge("div",{class:"_pillar-chat-source pillar-chat-source",children:e.title},e.slug))]})]})},n)),pt.value&&ge(ca,{error:pt.value,onRetry:h}),ut.value&&ut.value.elapsedMs>=15e3&&ge(da,{session:ut.value,onResume:d,onDiscard:a,isResuming:r}),r&&ut.value&&ut.value.elapsedMs<15e3&&ge(da,{session:ut.value,onResume:d,onDiscard:a,isResuming:!0})]}),ge("div",{class:"_pillar-chat-view-input-area pillar-chat-view-input-area",children:ge(Vr,{placeholder:"Ask a question...",disabled:st.value,isStreaming:lt.value,onStop:u,onSubmit:m})})]})}function ma(e){if(!e)return"Unknown";const n=function(e){let n=e;return e.endsWith("Z")&&e.includes("+")&&(n=e.slice(0,-1)),new Date(n)}(e),t=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-r.getTime(),l=Math.floor(i/864e5);if(0===l)return"Today";if(1===l)return"Yesterday";if(l<7)return`${l}d ago`;if(l<30){const e=Math.floor(l/7);return 1===e?"1 week ago":`${e} weeks ago`}return n.toLocaleDateString(void 0,{month:"short",year:"numeric"})}function fa({onSelectConversation:e}){const[n,t]=Te(!1),[r,i]=Te(!1),[l,a]=Te([]),[o,s]=Te(!1),[p,d]=Te(nt.value),u=Me(null),h=Re(()=>function(e){const n=new Map;for(const t of e){const e=ma(t.lastMessageAt),r=n.get(e)||[];r.push(t),n.set(e,r)}return Array.from(n.entries()).map(([e,n])=>({label:e,conversations:n}))}(l),[l]);Ie(()=>nt.subscribe(e=>{e>p&&(s(!1),d(e))}),[p]),Ie(()=>{const e=e=>{u.current&&!u.current.contains(e.target)&&t(!1)};return n&&(document.addEventListener("mousedown",e),document.addEventListener("touchstart",e)),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[n]);const g=async()=>{if(!o){i(!0);try{const e=Jr();if(e){const n=await e.listConversations(20);a((e=>{const n=tt.value;if(0===n.length)return e;const t=new Set(e.map(e=>e.id)),r=n.filter(e=>!t.has(e.id));return[...r,...e]})(n))}}catch(e){c.error("[Pillar] Failed to fetch conversations:",e),tt.value.length>0&&a(tt.value)}finally{i(!1),s(!0)}}},m=$n.value,f=["_pillar-history-menu","pillar-history-menu",m?"_pillar-history-menu--mobile":""].filter(Boolean).join(" "),v=r?ge("div",{class:"_pillar-history-loading pillar-history-loading",children:[ge("div",{class:"_pillar-history-spinner pillar-history-spinner"}),ge("span",{children:"Loading..."})]}):0===l.length?ge("div",{class:"_pillar-history-empty pillar-history-empty",children:"No conversations yet"}):ge("div",{class:"_pillar-history-list pillar-history-list",children:h.map(n=>ge(K,{children:[ge("div",{class:"_pillar-history-group-header pillar-history-group-header",children:n.label}),n.conversations.map(n=>ge("button",{class:"_pillar-history-item pillar-history-item",onClick:()=>(n=>{t(!1),e(n)})(n.id),type:"button",children:ge("span",{class:"_pillar-history-item-title pillar-history-item-title",children:n.title})},n.id))]},n.label))});return ge("div",{class:"_pillar-history-dropdown pillar-history-dropdown",ref:u,children:[ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-history-btn",onClick:()=>{const e=!n;t(e),e&&!o&&g()},"aria-label":"Conversation history","aria-expanded":n,title:"Conversation history",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" clip-rule="evenodd"/></svg>'}}),n&&ge("div",{class:f,children:[m&&ge("div",{class:"_pillar-history-mobile-header",children:[ge("span",{class:"_pillar-history-mobile-title",children:"History"}),ge("button",{class:"_pillar-history-mobile-close",onClick:()=>t(!1),"aria-label":"Close history",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/></svg>'}})]}),v]})]})}const va=120;function ba({currentView:e,hideNavigation:n=!1}){const t=Me(null),r=$n.value,i=!n&&_r.value,l=!n&&!xr.value,a="chat"===e&&Lt.value,o=mr;return Ie(()=>{if(!r)return;const e=t.current;if(!e)return;const n=e.closest("._pillar-panel");if(!n)return;let i=0,l=0,a=!1,o=!1,s=0;const p=e=>{e.target.closest("button")||(i=e.touches[0].clientY,l=i,s=Date.now(),a=!0,o=!1)},c=e=>{if(!a)return;l=e.touches[0].clientY;const t=l-i;if(t<0)return;if(!o){if(t<10)return;o=!0,n.style.transition="none"}const r=t<va?t:va+.3*(t-va);n.style.transform=`translateY(${r}px)`,e.preventDefault()},d=()=>{if(!a||!o)return void(a=!1);a=!1,o=!1;const e=l-i,t=Date.now()-s,r=e/Math.max(t,1);if(n.style.transition="",n.offsetHeight,e>va||r>.5){n.style.transform="translateY(100%)";const e=()=>{n.removeEventListener("transitionend",e),clearTimeout(t),n.style.transform="",Hn()},t=setTimeout(e,600);n.addEventListener("transitionend",e)}else n.style.transform=""};return e.addEventListener("touchstart",p,{passive:!0}),document.addEventListener("touchmove",c,{passive:!1}),document.addEventListener("touchend",d),()=>{e.removeEventListener("touchstart",p),document.removeEventListener("touchmove",c),document.removeEventListener("touchend",d),n.style.transition="",n.style.transform=""}},[r]),ge("header",{ref:t,class:"_pillar-header pillar-header",children:[r&&ge("div",{class:"_pillar-drag-indicator pillar-drag-indicator",children:ge("div",{class:"_pillar-drag-indicator-pill"})}),ge("div",{class:"_pillar-header-left pillar-header-left",children:[i&&ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-back-btn",onClick:()=>{wr()},"aria-label":"Go back",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z" clip-rule="evenodd"/></svg>'}}),l&&!a&&ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-home-btn",onClick:()=>{kr()},"aria-label":"Go to home",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"/></svg>'}})]}),ge("div",{class:"_pillar-header-right pillar-header-right",children:[a&&ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-new-chat-btn",onClick:()=>{kr()},"aria-label":"New chat",title:"New chat",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z"/></svg>'}}),ge(fa,{onSelectConversation:o}),ge("button",{class:"_pillar-icon-btn pillar-icon-btn pillar-close-btn",onClick:()=>{Hn()},"aria-label":"Close assistant panel",type:"button",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/></svg>'}})]})]})}function _a(){const e=br.value,n=wn.value,t="chat"===e.type,r="home"===e.type;return ge("div","assistant"!==n?{class:"_pillar-panel-ui pillar-panel-ui",children:[ge(ba,{currentView:"home"}),ge("div",{class:"_pillar-content pillar-content",children:"support"===n?ge("div",{style:{padding:"24px",textAlign:"center"},children:[ge("h2",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"},children:"Hello World"}),ge("p",{style:{color:"var(--pillar-text-muted)",fontSize:"14px"},children:"Support tab content goes here."})]}):null})]}:{class:"_pillar-panel-ui pillar-panel-ui",children:[ge(ba,{currentView:e.type,hideNavigation:t}),ge("div",{class:"_pillar-content pillar-content",children:(()=>{switch(e.type){case"home":default:return ge(Yr,{});case"chat":return ge(ga,{})}})()}),!t&&!r&&ge("div",{class:"_pillar-chat-input-area pillar-chat-input-area",children:ge(Vr,{placeholder:"Ask a question..."})})]})}class xa{constructor(e,n,t,r){this.host=null,this.shadow=null,this.backdrop=null,this.panelElement=null,this.renderRoot=null,this.resizeHandle=null,this.unsubscribe=null,this.isManualMount=!1,this.themeObserver=null,this._isResizing=!1,this._resizeStartX=0,this._resizeStartWidth=0,this._resizeRafId=null,this._boundHandleResizeMove=null,this._boundHandleResizeEnd=null,this.handleResizeStart=e=>{if(!yn.value||!this.config.panel.resizable)return;e.preventDefault(),e.stopPropagation();const n="touches"in e?e.touches[0].clientX:e.clientX;this._isResizing=!0,this._resizeStartX=n,this._resizeStartWidth=Cn.value,this._boundHandleResizeMove=this.handleResizeMove.bind(this),this._boundHandleResizeEnd=this.handleResizeEnd.bind(this),document.addEventListener("mousemove",this._boundHandleResizeMove),document.addEventListener("mouseup",this._boundHandleResizeEnd),document.addEventListener("touchmove",this._boundHandleResizeMove,{passive:!1}),document.addEventListener("touchend",this._boundHandleResizeEnd),document.addEventListener("touchcancel",this._boundHandleResizeEnd),document.body.style.userSelect="none",document.body.style.webkitUserSelect="none",document.documentElement.style.cursor="col-resize",document.documentElement.style.transition="none",this.panelElement?.classList.add("_pillar-panel--resizing","pillar-panel--resizing")},this.handleResizeEnd=e=>{this._isResizing&&(null!==this._resizeRafId&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this._isResizing=!1,xn(Cn.value),this._boundHandleResizeMove&&(document.removeEventListener("mousemove",this._boundHandleResizeMove),document.removeEventListener("touchmove",this._boundHandleResizeMove)),this._boundHandleResizeEnd&&(document.removeEventListener("mouseup",this._boundHandleResizeEnd),document.removeEventListener("touchend",this._boundHandleResizeEnd),document.removeEventListener("touchcancel",this._boundHandleResizeEnd)),this._boundHandleResizeMove=null,this._boundHandleResizeEnd=null,document.body.style.userSelect="",document.body.style.webkitUserSelect="",document.documentElement.style.cursor="",document.documentElement.style.transition="padding 0.3s ease",this.panelElement?.classList.remove("_pillar-panel--resizing","pillar-panel--resizing"))},this.handleKeyDown=e=>{"Escape"===e.key&&yn.value&&Hn()},this.config=e,this.api=n,this.events=t,this.rootContainer=r||null,this.isManualMount="manual"===e.panel.container}detectThemeFromDOM(){const e=document.documentElement;if(e.classList.contains("dark"))return"dark";return"dark"===e.getAttribute("data-theme")||"dark"===e.style.colorScheme?"dark":"light"}get isOpen(){return yn.value}async init(){var e,n,t;if(e=this.config.panel.position,kn.value=e,(e=>{Sn.value=e})(this.config.panel.mode),n=this.config.panel.hoverBreakpoint,Pn.value=n,t=this.config.panel.hoverBackdrop,En.value=t,this.config.panel.resizable){const e=_n();On(null!==e?e:this.config.panel.width)}else On(this.config.panel.width);(()=>{if("undefined"==typeof window)return;Mn?.();const e=()=>{In.value=window.innerWidth};In.value=window.innerWidth,window.addEventListener("resize",e),Mn=()=>{window.removeEventListener("resize",e)}})(),this.createHost(),this.isManualMount||this.createBackdrop(),this.createPanel(),this.renderPreact(),this.bindEvents(),this.subscribeToState()}open(e){if(e?.search&&(Gt(e.search),yr("chat"),Jt()),yn.value)return e?.view&&yr(e.view),void(e?.focusInput&&er());yn.value=!0,bn(!0),"overlay"===Ln.value&&(document.body.style.overflow="hidden"),e?.view&&!e?.search&&yr(e.view),e?.focusInput?er():this.setupFocusTrap()}close(){yn.value&&Hn()}navigate(e,n){yn.value?yr(e,n):this.open({view:e})}destroy(){this.close(),this._isResizing&&this.handleResizeEnd(new MouseEvent("mouseup")),null!==this._resizeRafId&&(cancelAnimationFrame(this._resizeRafId),this._resizeRafId=null),this.resizeHandle&&(this.resizeHandle.removeEventListener("mousedown",this.handleResizeStart),this.resizeHandle.removeEventListener("touchstart",this.handleResizeStart),this.resizeHandle=null),this.isManualMount||this.removePushModeStyles(),this.unsubscribe?.(),this.unsubscribe=null,Mn?.(),Mn=null,this.themeObserver?.disconnect(),this.themeObserver=null,this.renderRoot&&ue(null,this.renderRoot),this.backdrop?.remove(),this.host?.remove(),document.getElementById("pillar-sdk-styles")?.remove(),document.getElementById("pillar-sdk-theme")?.remove(),document.getElementById("pillar-sdk-custom")?.remove(),this.host=null,this.shadow=null,this.backdrop=null,this.panelElement=null,this.renderRoot=null,document.removeEventListener("keydown",this.handleKeyDown),Dn(),Sr(),sr()}handleResizeMove(e){this._isResizing&&("touches"in e&&e.preventDefault(),null===this._resizeRafId&&(this._resizeRafId=requestAnimationFrame(()=>{if(this._resizeRafId=null,!this._isResizing)return;const n="touches"in e?e.touches[0].clientX:e.clientX,t=this._resizeStartX-n,r="right"===kn.value?t:-t,i=window.innerWidth-100,l=Math.max(xa.MIN_PANEL_WIDTH,Math.min(i,this._resizeStartWidth+r));On(l)})))}subscribeToState(){if(this.isManualMount)return void(this.unsubscribe=yn.subscribe(e=>{e||this.events.emit("panel:close")}));let e=yn.value,n=Ln.value;const t=()=>{const e=yn.value,n="push"===Ln.value,t=Cn.value,r=kn.value,i=Rn.value&&En.value||$n.value;e?(n?(this.applyPushModeStyles(t,r),this.setBackdropVisible(!1)):(this.removePushModeStyles(),document.body.style.overflow="hidden",this.setBackdropVisible(i)),this.panelElement?.classList.add("_pillar-panel--open","pillar-panel--open")):(this.removePushModeStyles(),document.body.style.overflow="",this.setBackdropVisible(!1),this.panelElement?.classList.remove("_pillar-panel--open","pillar-panel--open"))};t();const r=yn.subscribe(n=>{n!==e&&(e=n,t(),n||this.events.emit("panel:close"))}),i=Ln.subscribe(e=>{e!==n&&(n=e,t())}),l=An.subscribe(e=>{e?this.panelElement?.classList.add("_pillar-panel--full-width","pillar-panel--full-width"):this.panelElement?.classList.remove("_pillar-panel--full-width","pillar-panel--full-width")}),a=$n.subscribe(e=>{e?this.panelElement?.classList.add("_pillar-panel--mobile","pillar-panel--mobile"):this.panelElement?.classList.remove("_pillar-panel--mobile","pillar-panel--mobile"),t()});let o=Cn.value;const s=Cn.subscribe(e=>{e!==o&&(o=e,this.panelElement?.style.setProperty("--pillar-panel-width",`${e}px`),yn.value&&t())});this.unsubscribe=()=>{r(),i(),l(),a(),s()}}setBackdropVisible(e){this.backdrop&&(e?(this.backdrop.style.opacity="1",this.backdrop.style.visibility="visible",this.backdrop.classList.add("_pillar-backdrop--visible","pillar-backdrop--visible")):(this.backdrop.style.opacity="0",this.backdrop.style.visibility="hidden",this.backdrop.classList.remove("_pillar-backdrop--visible","pillar-backdrop--visible")))}applyPushModeStyles(e,n){document.documentElement.style.transition="padding 0.3s ease","right"===n?(document.documentElement.style.paddingRight=`${e}px`,document.documentElement.style.setProperty("--pillar-inset-right",`${e}px`),document.documentElement.style.setProperty("--pillar-inset-left","0px")):(document.documentElement.style.paddingLeft=`${e}px`,document.documentElement.style.setProperty("--pillar-inset-left",`${e}px`),document.documentElement.style.setProperty("--pillar-inset-right","0px"))}removePushModeStyles(){document.documentElement.style.paddingLeft="",document.documentElement.style.paddingRight="",document.documentElement.style.removeProperty("--pillar-inset-right"),document.documentElement.style.removeProperty("--pillar-inset-left"),setTimeout(()=>{yn.value||(document.documentElement.style.transition="")},300)}get renderContainer(){return this.shadow||this.host}transformStylesForRegularDOM(e){return e.replace(/:host\(([^)]+)\)/g,"[data-pillar-panel]$1").replace(/:host-context\(([^)]+)\)/g,"$1 [data-pillar-panel]").replace(/:host:not\(([^)]+)\)/g,"[data-pillar-panel]:not($1)").replace(/:host/g,"[data-pillar-panel]")}injectStylesIntoHead(){const e="pillar-sdk-styles";if(document.getElementById(e))return;const n=Er,t=this.transformStylesForRegularDOM(n),r=document.createElement("style");r.id=e,r.textContent=t,document.head.appendChild(r);const i=Tr(this.config.theme);if(i){const e=document.createElement("style");e.id="pillar-sdk-theme",e.textContent=this.transformStylesForRegularDOM(i),document.head.appendChild(e)}if(this.config.customCSS){const e=document.createElement("style");e.id="pillar-sdk-custom",e.textContent=this.transformStylesForRegularDOM(this.config.customCSS),document.head.appendChild(e)}}injectStylesIntoShadow(){if(!this.shadow)return;const e=document.createElement("style");e.textContent=Er,this.shadow.appendChild(e);const n=Tr(this.config.theme);if(n){const e=document.createElement("style");e.textContent=n,e.setAttribute("data-pillar-theme",""),this.shadow.appendChild(e)}if(this.config.customCSS){const e=document.createElement("style");e.textContent=this.config.customCSS,e.setAttribute("data-pillar-custom",""),this.shadow.appendChild(e)}}createHost(){this.host=document.createElement("div"),this.host.className="pillar-panel-host",this.host.setAttribute("data-pillar-panel",""),this.config.panel.useShadowDOM?(this.shadow=this.host.attachShadow({mode:"open"}),this.injectStylesIntoShadow()):(this.shadow=null,this.injectStylesIntoHead()),this.applyThemeMode(),this.setupThemeObserver();const e=this.config.panel.container;if("manual"===e)return;const n=this.rootContainer||document.body;let t=null;"string"==typeof e?(t=document.querySelector(e),t||(c.warn(`[Pillar] Container element not found: ${e}, falling back to root container`),t=n)):t=e instanceof HTMLElement?e:n,t.appendChild(this.host)}mountTo(e){this.host?(this.host.parentElement&&this.host.parentElement.removeChild(this.host),e.appendChild(this.host)):c.warn("[Pillar] Panel host not created yet")}getHostElement(){return this.host}createBackdrop(){this.backdrop=document.createElement("div"),this.backdrop.className="_pillar-backdrop pillar-backdrop",this.backdrop.style.cssText="\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.3);\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.4s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.4s cubic-bezier(0.32, 0.72, 0, 1);\n z-index: 99998;\n ",this.backdrop.addEventListener("click",()=>{Hn()});(this.rootContainer||document.body).appendChild(this.backdrop)}createPanel(){const e=this.renderContainer;if(!e)return;this.panelElement=document.createElement("div");const n=this.isManualMount?" _pillar-panel--manual pillar-panel--manual":"",t=`_pillar-panel--${kn.value} pillar-panel--${kn.value}`;this.panelElement.className=`_pillar-panel pillar-panel ${t}${n}`,this.panelElement.style.setProperty("--pillar-panel-width",`${Cn.value}px`),this.panelElement.setAttribute("role","dialog"),this.panelElement.setAttribute("aria-modal","true"),this.panelElement.setAttribute("aria-label","Assistant panel"),this.renderRoot=document.createElement("div"),this.renderRoot.className="_pillar-panel-root pillar-panel-root",this.panelElement.appendChild(this.renderRoot),this.config.panel.resizable&&!this.isManualMount&&(this.resizeHandle=document.createElement("div"),this.resizeHandle.className="_pillar-resize-handle pillar-resize-handle",this.resizeHandle.addEventListener("mousedown",this.handleResizeStart),this.resizeHandle.addEventListener("touchstart",this.handleResizeStart,{passive:!1}),this.panelElement.appendChild(this.resizeHandle)),e.appendChild(this.panelElement)}renderPreact(){this.renderRoot&&ue(ge(Mr,{api:this.api,events:this.events,children:ge(_a,{})}),this.renderRoot)}bindEvents(){document.addEventListener("keydown",this.handleKeyDown)}setupFocusTrap(){setTimeout(()=>{const e=this.renderContainer,n=e?.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');n?.focus()},100)}applyThemeMode(){if(!this.host)return;const e=this.config.theme.mode;if("light"===e||"dark"===e)this.host.setAttribute("data-theme",e);else{const e=this.detectThemeFromDOM();this.host.setAttribute("data-theme",e)}}setupThemeObserver(){"auto"===this.config.theme.mode&&(this.themeObserver=new MutationObserver(()=>{this.applyThemeMode()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}))}setTheme(e){this.config={...this.config,theme:{...this.config.theme,...e,colors:{...this.config.theme.colors,...e.colors},darkColors:{...this.config.theme.darkColors,...e.darkColors}}},this.applyThemeMode();const n=Tr(this.config.theme);if(this.shadow){const e=this.shadow.querySelector("style[data-pillar-theme]");if(e&&n)e.textContent=n;else if(n&&!e){const e=document.createElement("style");e.textContent=n,e.setAttribute("data-pillar-theme","");const t=this.shadow.querySelector("style");t?.nextSibling?this.shadow.insertBefore(e,t.nextSibling):this.shadow.appendChild(e)}}else{const e=this.transformStylesForRegularDOM(n),t=document.getElementById("pillar-sdk-theme");if(t&&e)t.textContent=e;else if(e&&!t){const n=document.createElement("style");n.id="pillar-sdk-theme",n.textContent=e,document.head.appendChild(n)}}}}xa.MIN_PANEL_WIDTH=200;function ya({label:e,x:n,y:t,isVisible:r,onClick:i}){const l=Me(null),[a,o]=Te({x:n,y:t}),[s,p]=Te(!1),c=$e(()=>{if(!l.current||!r)return;const e=l.current.getBoundingClientRect(),i=window.innerWidth;let a=n,s=t,c=!1;a=n-e.width/2,a<10?a=10:a+e.width>i-10&&(a=i-e.width-10),s=t-e.height-10,s<10&&(s=t+10,c=!0),o({x:a,y:s}),p(c)},[n,t,r]);Ie(()=>{r&&requestAnimationFrame(c)},[r,c,n,t]);return ge("div",{ref:l,class:`pillar-text-selection-popover${r?" pillar-text-selection-popover--visible":""}${s?" pillar-text-selection-popover--below":""}`,style:{left:`${a.x}px`,top:`${a.y}px`},onClick:e=>{e.preventDefault(),e.stopPropagation(),i()},role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i())},children:[ge("div",{class:"pillar-text-selection-popover__content",children:[ge("span",{class:"pillar-text-selection-popover__icon",dangerouslySetInnerHTML:{__html:'<svg viewBox="0 0 20 20" fill="currentColor"><path d="M10 2a1 1 0 011 1v1.323l3.954 1.582 1.599-.8a1 1 0 01.894 1.79l-1.233.616 1.738 5.42a1 1 0 01-.285 1.05A3.989 3.989 0 0115 15a3.989 3.989 0 01-2.667-1.019 1 1 0 01-.285-1.05l1.715-5.349L10 6.477l-3.763 1.105 1.715 5.349a1 1 0 01-.285 1.05A3.989 3.989 0 015 15a3.989 3.989 0 01-2.667-1.019 1 1 0 01-.285-1.05l1.738-5.42-1.233-.617a1 1 0 01.894-1.788l1.599.799L9 4.323V3a1 1 0 011-1z"/></svg>'}}),ge("span",{children:e})]}),ge("div",{class:"pillar-text-selection-popover__arrow"})]})}const wa="pillar-text-selection-styles";class ka{constructor(e,n,t){this.container=null,this.isVisible=!1,this.currentSelection="",this.stylesInjected=!1,this.handleMouseUp=e=>{setTimeout(()=>{this.checkSelection(e)},10)},this.handleMouseDown=e=>{e.target.closest(".pillar-text-selection-popover")||this.hidePopover()},this.handleKeyDown=e=>{"Escape"===e.key&&this.hidePopover()},this.handleScroll=()=>{this.isVisible&&this.hidePopover()},this.handlePopoverClick=()=>{this.currentSelection&&(this.events.emit("textSelection:click",{text:this.currentSelection}),nr({type:"highlighted_text",url_origin:window.location.href,text_content:this.currentSelection}),this.hidePopover(),window.getSelection()?.removeAllRanges(),this.openPanel())},this.config=e,this.events=n,this.openPanel=t}init(){this.stylesInjected||(jn(document,"/* Pillar Text Selection Popover Styles */\n.pillar-text-selection-popover {\n position: absolute;\n z-index: 99999;\n padding: 6px 12px;\n font-family: var(--pillar-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);\n font-size: 13px;\n font-weight: 500;\n line-height: 1;\n color: #ffffff;\n background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);\n border-radius: 6px;\n box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n opacity: 0;\n transform: translateY(4px) scale(0.95);\n transition: opacity 0.15s ease, transform 0.15s ease;\n cursor: pointer;\n user-select: none;\n}\n\n.pillar-text-selection-popover.pillar-text-selection-popover--visible {\n opacity: 1;\n transform: translateY(0) scale(1);\n}\n\n.pillar-text-selection-popover:hover {\n background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);\n box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.pillar-text-selection-popover:active {\n transform: translateY(0) scale(0.98);\n}\n\n.pillar-text-selection-popover__content {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n\n.pillar-text-selection-popover__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n}\n\n.pillar-text-selection-popover__icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* Arrow pointing down to selection */\n.pillar-text-selection-popover__arrow {\n position: absolute;\n bottom: -5px;\n left: 50%;\n transform: translateX(-50%) rotate(45deg);\n width: 10px;\n height: 10px;\n background: linear-gradient(135deg, #8b5cf6 0%, #8b5cf6 100%);\n}\n\n.pillar-text-selection-popover--below .pillar-text-selection-popover__arrow {\n bottom: auto;\n top: -5px;\n background: linear-gradient(135deg, #6366f1 0%, #6366f1 100%);\n}\n",wa),this.stylesInjected=!0),this.container=document.createElement("div"),this.container.id="pillar-text-selection-container",document.body.appendChild(this.container),this.bindEvents()}destroy(){this.unbindEvents(),this.container&&(ue(null,this.container),this.container.remove(),this.container=null),document.getElementById(wa)?.remove(),this.stylesInjected=!1,this.isVisible=!1,this.currentSelection=""}bindEvents(){document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("scroll",this.handleScroll,!0)}unbindEvents(){document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("scroll",this.handleScroll,!0)}checkSelection(e){const n=window.getSelection();if(!n||n.isCollapsed)return;const t=n.toString().trim();if(t.length<3)return;const r=n.getRangeAt(0),i=r.commonAncestorContainer,l=i instanceof Element?i:i.parentElement;if(l?.closest("[data-pillar-panel]")||l?.closest(".pillar-panel-host"))return;const a=r.getBoundingClientRect(),o=a.left+a.width/2,s=a.top+window.scrollY;this.currentSelection=t,this.showPopover(o,s)}showPopover(e,n){this.container&&(this.isVisible=!0,ue(ge(ya,{label:this.config.textSelection.label,x:e,y:n,isVisible:!0,onClick:this.handlePopoverClick}),this.container),this.events.emit("textSelection:shown",{text:this.currentSelection}))}hidePopover(){this.container&&this.isVisible&&(this.isVisible=!1,ue(ge(ya,{label:this.config.textSelection.label,x:0,y:0,isVisible:!1,onClick:()=>{}}),this.container))}}function Sa(){const e=ei.value,n=pi.value;if(!e&&!n)return null;if(n){const e=ci.value||"Destructive action",n=e=>{e.preventDefault(),e.stopPropagation(),ui(!0)},t=e=>{e.preventDefault(),e.stopPropagation(),ui(!1)};return ge("div",{class:"_pillar-page-pilot-banner pillar-page-pilot-banner _pillar-page-pilot-banner--confirm pillar-page-pilot-banner--confirm",children:ge("div",{class:"_pillar-page-pilot-banner__content pillar-page-pilot-banner__content",children:[ge("span",{class:"_pillar-page-pilot-banner__warning-icon pillar-page-pilot-banner__warning-icon",dangerouslySetInnerHTML:{__html:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>'}}),ge("span",{class:"_pillar-page-pilot-banner__text pillar-page-pilot-banner__text",children:e}),ge("button",{type:"button",class:"_pillar-page-pilot-banner__deny pillar-page-pilot-banner__deny",onClick:t,"aria-label":"Deny destructive action",children:"Deny"}),ge("button",{type:"button",class:"_pillar-page-pilot-banner__allow pillar-page-pilot-banner__allow",onClick:n,"aria-label":"Allow destructive action",children:"Allow"})]})})}return ge("div",{class:"_pillar-page-pilot-banner pillar-page-pilot-banner",children:ge("div",{class:"_pillar-page-pilot-banner__content pillar-page-pilot-banner__content",children:[ge("span",{class:"_pillar-page-pilot-banner__indicator pillar-page-pilot-banner__indicator"}),ge("span",{class:"_pillar-page-pilot-banner__text pillar-page-pilot-banner__text",children:"Page being piloted by Agent"}),ge("button",{type:"button",class:"_pillar-page-pilot-banner__stop pillar-page-pilot-banner__stop",onClick:e=>{e.preventDefault(),e.stopPropagation(),ai()},"aria-label":"Stop agent action",children:[ge("span",{class:"_pillar-page-pilot-banner__stop-icon pillar-page-pilot-banner__stop-icon",dangerouslySetInnerHTML:{__html:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/></svg>'}}),ge("span",{children:"Stop"})]})]})})}const Ca="pillar-page-pilot-styles";class Pa{constructor(){this.container=null,this.stylesInjected=!1,this.unsubscribe=null,this.themeObserver=null,this.themeMode="auto"}detectThemeFromDOM(){const e=document.documentElement;if(e.classList.contains("dark"))return"dark";const n=e.getAttribute("data-theme");return"dark"===n?"dark":"light"}applyThemeMode(){if(this.container)if("light"===this.themeMode||"dark"===this.themeMode)this.container.setAttribute("data-theme",this.themeMode);else{const e=this.detectThemeFromDOM();this.container.setAttribute("data-theme",e)}}setupThemeObserver(){"auto"===this.themeMode&&(this.themeObserver=new MutationObserver(()=>{this.applyThemeMode()}),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","style"]}))}init(e,n="auto"){this.primaryColor=e,this.themeMode=n,this.stylesInjected||(jn(document,"/* Pillar Page Pilot Banner Styles */\n\n/* Define CSS variables at the container level (same as panel) */\n#pillar-page-pilot-container {\n /* Core colors - Light mode (default) */\n --pillar-primary: #2563eb;\n --pillar-primary-hover: #1d4ed8;\n --pillar-bg: #ffffff;\n --pillar-bg-secondary: #f9fafb;\n --pillar-text: #1a1a1a;\n --pillar-text-secondary: #374151;\n --pillar-border: #e5e7eb;\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n --pillar-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n --pillar-radius-lg: 8px;\n --pillar-radius-md: 6px;\n --pillar-transition-fast: 0.15s ease;\n}\n\n/* Dark mode - Auto-detect from system preference */\n@media (prefers-color-scheme: dark) {\n #pillar-page-pilot-container:not([data-theme=\"light\"]) {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-border: #404040;\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n }\n}\n\n/* Dark mode - Manual override via html class or data attribute */\nhtml.dark #pillar-page-pilot-container,\n[data-theme=\"dark\"] #pillar-page-pilot-container,\n#pillar-page-pilot-container[data-theme=\"dark\"] {\n --pillar-primary: #3b82f6;\n --pillar-primary-hover: #60a5fa;\n --pillar-bg: #1a1a1a;\n --pillar-bg-secondary: #262626;\n --pillar-text: #f5f5f5;\n --pillar-text-secondary: #e5e5e5;\n --pillar-border: #404040;\n --pillar-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);\n}\n\n@keyframes pillar-pulse {\n 0%, 100% {\n opacity: 1;\n transform: scale(1);\n }\n 50% {\n opacity: 0.6;\n transform: scale(1.1);\n }\n}\n\n@keyframes pillar-banner-fade-in {\n from {\n opacity: 0;\n transform: translateY(-100%);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n._pillar-page-pilot-banner {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n z-index: 99999;\n font-family: var(--pillar-font-family);\n display: flex;\n justify-content: center;\n pointer-events: none;\n animation: pillar-banner-fade-in 0.2s ease-out;\n}\n\n/* Viewport outline — 3px border on left, right, bottom; top handled by tab shape */\n._pillar-page-pilot-banner::before {\n content: '';\n position: fixed;\n inset: 0;\n border: 3px solid var(--pillar-primary);\n border-top: none;\n pointer-events: none;\n z-index: 99998;\n}\n\n/* Top border segments on either side of the tab */\n._pillar-page-pilot-banner::after {\n content: '';\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n height: 3px;\n background: var(--pillar-primary);\n pointer-events: none;\n z-index: 99997;\n}\n\n._pillar-page-pilot-banner__content {\n position: relative;\n z-index: 99999;\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 6px 20px;\n background: var(--pillar-primary);\n color: #ffffff;\n border-bottom-left-radius: var(--pillar-radius-lg);\n border-bottom-right-radius: var(--pillar-radius-lg);\n pointer-events: auto;\n}\n\n._pillar-page-pilot-banner__indicator {\n width: 8px;\n height: 8px;\n background: #ffffff;\n border-radius: 50%;\n animation: pillar-pulse 1.5s ease-in-out infinite;\n flex-shrink: 0;\n}\n\n._pillar-page-pilot-banner__text {\n font-size: 13px;\n font-weight: 500;\n color: #ffffff;\n white-space: nowrap;\n}\n\n._pillar-page-pilot-banner__stop {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 5px 10px;\n margin-left: 4px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 500;\n color: #ffffff;\n background: rgba(255, 255, 255, 0.15);\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-page-pilot-banner__stop:hover {\n background: rgba(255, 255, 255, 0.25);\n border-color: rgba(255, 255, 255, 0.5);\n}\n\n._pillar-page-pilot-banner__stop:active {\n transform: scale(0.97);\n}\n\n._pillar-page-pilot-banner__stop-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n}\n\n._pillar-page-pilot-banner__stop-icon svg {\n width: 100%;\n height: 100%;\n}\n\n/* Confirmation variant — amber/warning theme */\n._pillar-page-pilot-banner--confirm ._pillar-page-pilot-banner__content {\n background: #d97706;\n}\n\n._pillar-page-pilot-banner--confirm::before {\n border-color: #d97706;\n}\n\n._pillar-page-pilot-banner--confirm::after {\n background: #d97706;\n}\n\n._pillar-page-pilot-banner__warning-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n._pillar-page-pilot-banner__warning-icon svg {\n width: 100%;\n height: 100%;\n}\n\n._pillar-page-pilot-banner__deny {\n display: flex;\n align-items: center;\n padding: 5px 12px;\n margin-left: 4px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 500;\n color: #ffffff;\n background: rgba(255, 255, 255, 0.15);\n border: 1px solid rgba(255, 255, 255, 0.3);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-page-pilot-banner__deny:hover {\n background: rgba(255, 255, 255, 0.25);\n border-color: rgba(255, 255, 255, 0.5);\n}\n\n._pillar-page-pilot-banner__deny:active {\n transform: scale(0.97);\n}\n\n._pillar-page-pilot-banner__allow {\n display: flex;\n align-items: center;\n padding: 5px 12px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 600;\n color: #d97706;\n background: #ffffff;\n border: 1px solid rgba(255, 255, 255, 0.8);\n border-radius: var(--pillar-radius-md);\n cursor: pointer;\n transition: all var(--pillar-transition-fast);\n}\n\n._pillar-page-pilot-banner__allow:hover {\n background: #fef3c7;\n}\n\n._pillar-page-pilot-banner__allow:active {\n transform: scale(0.97);\n}\n",Ca),this.stylesInjected=!0),this.container=document.createElement("div"),this.container.id="pillar-page-pilot-container",document.body.appendChild(this.container),this.primaryColor&&this.container.style.setProperty("--pillar-primary",this.primaryColor),this.applyThemeMode(),this.setupThemeObserver(),this.unsubscribe=cn(()=>{ei.value,this.render()}),this.render()}setPrimaryColor(e){this.primaryColor=e,this.container&&this.container.style.setProperty("--pillar-primary",e)}destroy(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null),this.themeObserver&&(this.themeObserver.disconnect(),this.themeObserver=null),this.container&&(ue(null,this.container),this.container.remove(),this.container=null),document.getElementById(Ca)?.remove(),this.stylesInjected=!1}render(){this.container&&ue(ge(Sa,{}),this.container)}}const Ea={recentActions:[]},za={},Ta=Je({...Ea}),Ia=Je({...za});ln(()=>{const e=Ta.value;return!!(e.currentPage||e.currentFeature||e.userRole||e.errorState||e.recentActions&&e.recentActions.length>0)}),ln(()=>!!Ta.value.errorState);const Ma=e=>{Ia.value={...e}},Ra=Je(null),$a=Je([]);ln(()=>null!==Ra.value),ln(()=>Ra.value&&Ra.value.steps[Ra.value.current_step]||null);const Aa=ln(()=>Ra.value?Ra.value.steps.filter(e=>"completed"===e.status||"skipped"===e.status).length:0);function La(e,n){if(!Ra.value)return;const t=Ra.value.steps.map((t,r)=>r===e?{...t,status:n}:t);Ra.value={...Ra.value,steps:t}}function Ha(){if(!Ra.value)return null;const e=Ra.value.current_step+1;if(e>=Ra.value.steps.length)return null;const n=Ra.value.steps[e].auto_run?"active":"awaiting_initiation",t=Ra.value.steps.map((t,r)=>r===e?{...t,status:n}:t);return Ra.value={...Ra.value,steps:t,current_step:e},Ra.value.steps[e]}function Oa(){if(!Ra.value)return null;const e=Ra.value;return $a.value=[...$a.value,e],Ra.value=null,e}ln(()=>Ra.value?Aa.value/Ra.value.total_steps:0);class Da{constructor(e={}){this._callback=null,this._debounceTimer=null,this._lastRoute=null,this._running=!1,this._originalPushState=null,this._originalReplaceState=null,this._handleRouteChange=()=>{this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const e=this._getCurrentUrl();e!==this._lastRoute&&(this._lastRoute=e,this._callback&&this._callback(this.getCurrentRoute()))},this._debounceMs)},this._debounceMs=e.debounceMs??100}get running(){return this._running}onRouteChange(e){this._callback=e}start(){this._running||"undefined"!=typeof window&&(this._running=!0,this._lastRoute=this._getCurrentUrl(),this._patchHistory(),window.addEventListener("popstate",this._handleRouteChange),window.addEventListener("hashchange",this._handleRouteChange))}stop(){this._running&&(this._running=!1,this._restoreHistory(),window.removeEventListener("popstate",this._handleRouteChange),window.removeEventListener("hashchange",this._handleRouteChange),this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null))}getCurrentRoute(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,url:window.location.href,title:document.title}}_patchHistory(){this._originalPushState=history.pushState.bind(history),this._originalReplaceState=history.replaceState.bind(history),history.pushState=(...e)=>{this._originalPushState(...e),this._handleRouteChange()},history.replaceState=(...e)=>{this._originalReplaceState(...e),this._handleRouteChange()}}_restoreHistory(){this._originalPushState&&(history.pushState=this._originalPushState),this._originalReplaceState&&(history.replaceState=this._originalReplaceState),this._originalPushState=null,this._originalReplaceState=null}_getCurrentUrl(){return window.location.pathname+window.location.search+window.location.hash}}function ja(e){const n=new Date(e);return`${n.getHours().toString().padStart(2,"0")}:${n.getMinutes().toString().padStart(2,"0")}:${n.getSeconds().toString().padStart(2,"0")}.${n.getMilliseconds().toString().padStart(3,"0")}`}function Ua(e){switch(e){case"error":return"#ef4444";case"warn":return"#f59e0b";default:return"#d4d4d4"}}function qa(e){switch(e){case"sdk":return"⚡";case"handler":return"🔧";case"network":return"🌐";case"server":return"🧠";default:return"•"}}function Ba(e){switch(e){case"sdk":return"SDK";case"handler":return"Handler";case"network":return"Network";case"server":return"Server";default:return e}}const Na=["sdk","handler","network","server"];function Fa({expanded:e=!1,onToggle:n}){const[t,r]=Te([]),[i,l]=Te(e),[a,o]=Te(""),[s,p]=Te(new Set(Na)),[c,d]=Te(200),[u,h]=Te(!1),[g,m]=Te(new Set),[f,v]=Te(null),b=Me(null),_=Me("");Ie(()=>{const e="pillar-debug-panel-styles";if(!document.getElementById(e)){const n=document.createElement("style");n.id=e,n.textContent=".pillar-debug-panel {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: #1e1e1e;\n color: #d4d4d4;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n font-size: 12px;\n z-index: 999999;\n border-top: 1px solid #333;\n}\n.pillar-debug-resize-handle {\n height: 8px;\n background-color: #333;\n cursor: ns-resize;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.pillar-debug-resize-handle::after {\n content: '';\n width: 40px;\n height: 3px;\n background-color: #555;\n border-radius: 2px;\n}\n.pillar-debug-resize-handle:hover,\n.pillar-debug-resize-handle.active {\n background-color: #3b82f6;\n}\n.pillar-debug-resize-handle:hover::after,\n.pillar-debug-resize-handle.active::after {\n background-color: #fff;\n}\n.pillar-debug-header {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n background-color: #252526;\n cursor: pointer;\n user-select: none;\n}\n.pillar-debug-header-icon {\n margin-right: 8px;\n font-size: 10px;\n}\n.pillar-debug-header-title {\n font-weight: 600;\n margin-right: 8px;\n}\n.pillar-debug-header-count {\n background-color: #3c3c3c;\n padding: 2px 6px;\n border-radius: 4px;\n font-size: 11px;\n margin-right: auto;\n}\n.pillar-debug-header-actions {\n display: flex;\n gap: 8px;\n}\n.pillar-debug-btn {\n background-color: transparent;\n border: 1px solid #555;\n color: #d4d4d4;\n padding: 2px 8px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 11px;\n}\n.pillar-debug-btn:hover {\n background-color: #333;\n}\n.pillar-debug-btn.copied {\n border-color: #10b981;\n color: #10b981;\n}\n.pillar-debug-content {\n overflow: hidden;\n display: flex;\n flex-direction: column;\n}\n.pillar-debug-toolbar {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 12px;\n background-color: #2d2d2d;\n border-bottom: 1px solid #3c3c3c;\n flex-shrink: 0;\n}\n.pillar-debug-filter-input {\n background-color: #3c3c3c;\n border: none;\n color: #d4d4d4;\n padding: 4px 8px;\n font-size: 12px;\n outline: none;\n border-radius: 4px;\n flex: 1;\n max-width: 200px;\n}\n.pillar-debug-source-filters {\n display: flex;\n gap: 4px;\n}\n.pillar-debug-source-btn {\n background-color: transparent;\n border: 1px solid #444;\n color: #888;\n padding: 2px 8px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 11px;\n display: flex;\n align-items: center;\n gap: 4px;\n}\n.pillar-debug-source-btn.active {\n background-color: #3c3c3c;\n border-color: #666;\n color: #d4d4d4;\n}\n.pillar-debug-source-btn:hover {\n background-color: #333;\n}\n.pillar-debug-source-count {\n background-color: #444;\n padding: 0 4px;\n border-radius: 3px;\n font-size: 10px;\n}\n.pillar-debug-timeline {\n flex: 1;\n overflow-y: auto;\n padding: 4px 0;\n}\n.pillar-debug-empty {\n padding: 12px;\n color: #6b7280;\n text-align: center;\n}\n.pillar-debug-entry {\n padding: 4px 12px;\n border-bottom: 1px solid #2d2d2d;\n}\n.pillar-debug-entry:hover {\n background-color: #252526;\n}\n.pillar-debug-entry.server {\n background-color: rgba(139, 92, 246, 0.1);\n}\n.pillar-debug-entry.server:hover {\n background-color: rgba(139, 92, 246, 0.15);\n}\n.pillar-debug-entry-row {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.pillar-debug-entry-time {\n color: #6b7280;\n flex-shrink: 0;\n}\n.pillar-debug-entry-source {\n flex-shrink: 0;\n font-size: 10px;\n padding: 1px 4px;\n border-radius: 3px;\n background-color: #333;\n}\n.pillar-debug-entry-source.sdk { background-color: #3b82f6; color: white; }\n.pillar-debug-entry-source.handler { background-color: #10b981; color: white; }\n.pillar-debug-entry-source.network { background-color: #f59e0b; color: black; }\n.pillar-debug-entry-source.server { background-color: #8b5cf6; color: white; }\n.pillar-debug-entry-event {\n font-weight: 500;\n flex-shrink: 0;\n}\n.pillar-debug-entry-data {\n color: #9ca3af;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.pillar-debug-entry.expanded {\n flex-direction: column;\n align-items: stretch;\n}\n.pillar-debug-entry.expanded .pillar-debug-entry-row {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.pillar-debug-entry.expanded .pillar-debug-entry-data {\n white-space: pre-wrap;\n word-break: break-all;\n overflow: visible;\n margin-top: 8px;\n padding: 8px;\n background-color: #2d2d2d;\n border-radius: 4px;\n font-size: 11px;\n line-height: 1.4;\n}\n.pillar-debug-entry-expand {\n color: #6b7280;\n font-size: 10px;\n flex-shrink: 0;\n margin-left: auto;\n}\n",document.head.appendChild(n)}_.current=document.body.style.paddingBottom||"";const n=Qr();if(!n)return;r(n.getDebugLog());const t=n.onDebugLog(e=>{r([...e])});return()=>{t(),document.body.style.paddingBottom=_.current}},[]);const x=Me(null);Ie(()=>{const e=x.current;if(!e)return;const n=()=>{document.body.style.paddingBottom=`${e.offsetHeight}px`},t=new ResizeObserver(n);return t.observe(e),n(),()=>{t.disconnect()}},[]),Ie(()=>{b.current&&t.length>0&&requestAnimationFrame(()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight)})},[t]);const y=$e(e=>{e.preventDefault(),h(!0);const n=e.clientY,t=c,r=e=>{const r=n-e.clientY,i=Math.min(600,Math.max(100,t+r));d(i)},i=()=>{h(!1),document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i)};document.addEventListener("mousemove",r),document.addEventListener("mouseup",i)},[c]),w=Re(()=>{const e={sdk:0,handler:0,network:0,server:0};for(const n of t)e[n.source]=(e[n.source]||0)+1;return e},[t]),k=Re(()=>t.filter(e=>{if(!s.has(e.source))return!1;if(a){const n=a.toLowerCase(),t=e.event.toLowerCase().includes(n),r=!!e.data&&JSON.stringify(e.data).toLowerCase().includes(n);if(!t&&!r)return!1}return!0}),[t,s,a]),S=(e,n)=>["=== Pillar SDK — Client Logs ===",`Output: ${n}`,`Exported: ${(new Date).toISOString()}`,`Entries: ${e.length}`,""].join("\n")+e.map(e=>{const n=ja(e.timestamp),t=Ba(e.source).toUpperCase().padEnd(8),r="error"===e.level?" [ERROR]":"warn"===e.level?" [WARN]":"",i=null!=e.data?` ${"object"==typeof e.data?JSON.stringify(e.data):String(e.data)}`:"";return`${n} [${t}]${r} ${e.event}${i}`}).join("\n");return ge("div",{class:"pillar-debug-panel",ref:x,children:[i&&ge("div",{class:"pillar-debug-resize-handle "+(u?"active":""),onMouseDown:y}),ge("div",{class:"pillar-debug-header",onClick:()=>{l(!i),n?.()},children:[ge("span",{class:"pillar-debug-header-icon",children:i?"▼":"▶"}),ge("span",{class:"pillar-debug-header-title",children:"Debug"}),ge("span",{class:"pillar-debug-header-count",children:t.length}),i&&ge("div",{class:"pillar-debug-header-actions",children:[ge("button",{class:"pillar-debug-btn "+("copy"===f?"copied":""),onClick:e=>{e.stopPropagation(),(()=>{const e=Na.filter(e=>s.has(e)).map(Ba).join(", "),n=S(k,a?`${e} (filtered: "${a}")`:e);navigator.clipboard.writeText(n),v("copy"),setTimeout(()=>v(null),1500)})()},children:"copy"===f?"Copied!":"Copy"}),ge("button",{class:"pillar-debug-btn "+("copyAll"===f?"copied":""),onClick:e=>{e.stopPropagation(),(()=>{const e=S(t,"All Sources");navigator.clipboard.writeText(e),v("copyAll"),setTimeout(()=>v(null),1500)})()},children:"copyAll"===f?"Copied!":"Copy All"}),ge("button",{class:"pillar-debug-btn",onClick:e=>{e.stopPropagation(),(()=>{const e=JSON.stringify(t,null,2),n=new Blob([e],{type:"application/json"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=`pillar-debug-${(new Date).toISOString().slice(0,19).replace(/:/g,"-")}.json`,i.click(),URL.revokeObjectURL(r)})()},children:"Export"}),ge("button",{class:"pillar-debug-btn",onClick:e=>{e.stopPropagation(),(()=>{const e=Qr();e?.clearDebugLog()})()},children:"Clear"})]})]}),i&&ge("div",{class:"pillar-debug-content",style:{height:`${c}px`},children:[ge("div",{class:"pillar-debug-toolbar",children:[ge("input",{type:"text",class:"pillar-debug-filter-input",placeholder:"Filter...",value:a,onInput:e=>o(e.target.value),onClick:e=>e.stopPropagation()}),ge("div",{class:"pillar-debug-source-filters",children:Na.map(e=>ge("button",{class:"pillar-debug-source-btn "+(s.has(e)?"active":""),onClick:n=>{n.stopPropagation(),(e=>{p(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})})(e)},children:[qa(e)," ",Ba(e),ge("span",{class:"pillar-debug-source-count",children:w[e]})]},e))})]}),ge("div",{class:"pillar-debug-timeline",ref:b,children:0===k.length?ge("div",{class:"pillar-debug-empty",children:0===t.length?"No events captured yet":"No events match filters"}):k.map((e,n)=>{const t=g.has(n),r=null!==e.data&&void 0!==e.data;return ge("div",{class:`pillar-debug-entry ${e.source} ${t?"expanded":""}`,onClick:()=>r&&(e=>{m(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t})})(n),style:{cursor:r?"pointer":"default"},children:[ge("div",{class:"pillar-debug-entry-row",children:[ge("span",{class:"pillar-debug-entry-time",children:ja(e.timestamp)}),ge("span",{class:`pillar-debug-entry-source ${e.source}`,children:qa(e.source)}),ge("span",{class:"pillar-debug-entry-event",style:{color:Ua(e.level)},children:e.event}),r&&!t&&ge("span",{class:"pillar-debug-entry-data",children:"object"==typeof e.data?JSON.stringify(e.data,null,0).slice(0,100):String(e.data)}),r&&ge("span",{class:"pillar-debug-entry-expand",children:t?"▼":"▶"})]}),r&&t&&ge("span",{class:"pillar-debug-entry-data",children:(i=e.data,null==i?"":"object"==typeof i?JSON.stringify(i,null,2):String(i))})]},n);var i})})]})]})}const Wa="pillar-";const Va=[{id:"assistant",label:"Assistant",enabled:!0,order:0}],Ka="https://help-api.trypillar.com",Xa={enabled:!0,position:"right",mode:"push",width:380,useShadowDOM:!1,hoverBreakpoint:1200,hoverBackdrop:!0,fullWidthBreakpoint:500,initialOpen:!1,resizable:!0},Ya={enabled:!0,resizable:!0},Za={enabled:!0,breakpoint:700,position:"bottom-right",icon:"sparkle",iconColor:"white",size:"medium",label:"Get help",offset:24},Ga={enabled:!0,prefix:"pillar-",clearAfterOpen:!0},Qa={enabled:!0,label:"Ask AI"},Ja={enabled:!1,includeText:!0,maxDepth:20,visibleOnly:!0,maxTextLength:500,interactionHighlight:{enabled:!0,outlineColor:"#3b82f6",outlineWidth:2,outlineOffset:2,duration:2e3,scrollIntoView:!0,scrollBehavior:"smooth"}},eo={enabled:!0,debounceMs:100,displayLimit:3},no={mode:"auto"};function to(e){if(!e||0===e.length)return Va;const n=new Map;for(const e of Va)n.set(e.id,{...e});for(const t of e)n.set(t.id,{...t});const t=n.get("assistant");return t&&(t.enabled=!0),Array.from(n.values()).sort((e,n)=>e.order-n.order)}function ro(e){if(!e.productKey)throw new Error("[Pillar] productKey is required");return{productKey:e.productKey,apiBaseUrl:e.apiBaseUrl||Ka,platform:e.platform||"web",version:e.version,debug:e.debug??!1,panel:{...Xa,...e.panel},edgeTrigger:{...Ya,...e.edgeTrigger},mobileTrigger:{...Za,...e.mobileTrigger},urlParams:{...Ga,...e.urlParams},textSelection:{...Qa,...e.textSelection},domScanning:{...Ja,...e.domScanning,interactionHighlight:{...Ja.interactionHighlight,...e.domScanning?.interactionHighlight}},suggestions:{...eo,...e.suggestions},sidebarTabs:to(e.sidebarTabs),theme:{mode:e.theme?.mode??no.mode,colors:{...e.theme?.colors},darkColors:{...e.theme?.darkColors},fontFamily:e.theme?.fontFamily},customCSS:e.customCSS,onReady:e.onReady,onError:e.onError}}class io{_persistExternalUserId(e){if("undefined"!=typeof window)try{null===e?localStorage.removeItem(io.EXTERNAL_USER_ID_STORAGE_KEY):localStorage.setItem(io.EXTERNAL_USER_ID_STORAGE_KEY,e)}catch{}}_getStoredExternalUserId(){if("undefined"==typeof window)return null;try{return localStorage.getItem(io.EXTERNAL_USER_ID_STORAGE_KEY)}catch{return null}}constructor(){this._state="uninitialized",this._config=null,this._api=null,this._textSelectionManager=null,this._pagePilotManager=null,this._panel=null,this._edgeTrigger=null,this._mobileTrigger=null,this._initPromise=null,this._rootContainer=null,this._unsubscribeHoverMode=null,this._context={...Ea},this._userProfile={...za},this._externalUserId=null,this._taskHandlers=new Map,this._anyTaskHandler=null,this._registeredActions=new Map,this._definedActions=new Map,this._cardRenderers=new Map,this._debugPanelContainer=null,this._routeObserver=null,this._suggestionPool=[],this._highlightedElement=null,this._highlightTimeout=null,this._fadeOutTimeout=null,this._originalStyles=null,this._events=new u}_createRootContainer(){let e=document.getElementById("pillar-root");if(e)return this._subscribeToHoverModeForRoot(e),e;e=document.createElement("div"),e.id="pillar-root";const n=Rn.value?"9999":"1000";return e.style.cssText=`isolation: isolate; z-index: ${n}; position: relative;`,document.body.appendChild(e),this._subscribeToHoverModeForRoot(e),e}_subscribeToHoverModeForRoot(e){this._unsubscribeHoverMode?.(),this._unsubscribeHoverMode=Rn.subscribe(n=>{e.style.zIndex=n?"9999":"1000"})}static async init(e){if(!e.productKey)throw new Error("[Pillar] productKey is required");return io.instance||(io.instance=new io,Gr(io.instance)),await io.instance._init(e),io.instance}static getInstance(){return io.instance}static destroy(){io.instance&&(io.instance._destroy(),io.instance=null,Gr(null))}get state(){return this._state}get isReady(){return"ready"===this._state}get isPanelOpen(){return yn.value}get config(){return this._config}get isDebugEnabled(){return this._config?.debug??!1}getDebugLog(){return this._config?.debug?o.getEntries():[]}onDebugLog(e){return o.subscribe(e)}clearDebugLog(){o.clear()}on(e,n){return this._events.on(e,n)}open(e){this._panel&&(this._panel.open(e),this._events.emit("panel:open"))}close(){this._panel&&(this._panel.close(),this._events.emit("panel:close"))}toggle(){this.isPanelOpen?this.close():this.open()}navigate(e,n){this._panel?.navigate(e,n),this._events.emit("panel:navigate",{view:e,params:n})}setContext(e){this._context={...this._context,...e},(e=>{Ta.value={...Ta.value,...e}})(e),this._events.emit("context:change",{context:this._context})}getChatContext(){const e=Qn.value,n=Jn.value;return 0===e.length?null:{conversationId:n,messages:e.map(e=>({role:e.role,content:e.content}))}}setTheme(e){this._config&&(this._config.theme={...this._config.theme,...e,mode:e.mode??this._config.theme.mode,colors:{...this._config.theme.colors,...e.colors},darkColors:{...this._config.theme.darkColors,...e.darkColors}},this._panel?.setTheme(this._config.theme),this._config.theme.colors.primary&&this._pagePilotManager?.setPrimaryColor(this._config.theme.colors.primary),this._events.emit("theme:change",{theme:this._config.theme}))}setTextSelectionEnabled(e){if(!this._config)return;this._config.textSelection.enabled!==e&&(this._config.textSelection.enabled=e,e?this._config.panel.enabled&&!this._textSelectionManager&&(this._textSelectionManager=new ka(this._config,this._events,()=>this.open()),this._textSelectionManager.init()):this._textSelectionManager&&(this._textSelectionManager.destroy(),this._textSelectionManager=null),this._events.emit("textSelection:change",{enabled:e}))}setDOMScanningEnabled(e){this._config&&(this._config.domScanning.enabled=e,this._events.emit("domScanning:change",{enabled:e}))}get isDOMScanningEnabled(){return this._config?.domScanning.enabled??!1}highlightElement(e){const n=this._config?.domScanning.interactionHighlight;if(!n?.enabled)return;this.clearHighlight(!0),n.scrollIntoView&&e.scrollIntoView({behavior:n.scrollBehavior,block:"center",inline:"nearest"}),this._originalStyles={outline:e.style.outline,outlineOffset:e.style.outlineOffset,transition:e.style.transition},this._highlightedElement=e;const t=e.style.transition,r="outline-color 0.3s ease-in-out";e.style.transition=t?`${t}, ${r}`:r,e.style.outline=`${n.outlineWidth}px solid transparent`,e.style.outlineOffset=`${n.outlineOffset}px`,e.offsetHeight,e.style.outline=`${n.outlineWidth}px solid ${n.outlineColor}`,c.log("[Pillar] Element highlighted with fade-in:",e.tagName),n.duration>0&&(this._highlightTimeout=setTimeout(()=>{this.clearHighlight()},n.duration))}clearHighlight(e=!1){if(this._highlightTimeout&&(clearTimeout(this._highlightTimeout),this._highlightTimeout=null),this._fadeOutTimeout&&(clearTimeout(this._fadeOutTimeout),this._fadeOutTimeout=null),this._highlightedElement&&this._originalStyles){const n=this._highlightedElement,t=this._originalStyles;e?(n.style.outline=t.outline,n.style.outlineOffset=t.outlineOffset,n.style.transition=t.transition,c.log("[Pillar] Highlight cleared immediately")):(n.style.outline=n.style.outline.replace(/[^,\s]+$/,"transparent"),this._fadeOutTimeout=setTimeout(()=>{n.style.outline=t.outline,n.style.outlineOffset=t.outlineOffset,n.style.transition=t.transition,c.log("[Pillar] Highlight fade-out complete"),this._fadeOutTimeout=null},300)),this._highlightedElement=null,this._originalStyles=null}}getElement(e){return document.querySelector(e)}clickElement(e){c.log("[Pillar] clickElement called with selector:",e);const n=this.getElement(e);if(c.log("[Pillar] clickElement found element:",n),n instanceof HTMLElement){c.log("[Pillar] clickElement clicking element:",n.tagName,n.textContent?.slice(0,50)),this.highlightElement(n);const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:r,button:0,buttons:1};return n.dispatchEvent(new MouseEvent("mousedown",i)),n.dispatchEvent(new MouseEvent("mouseup",i)),n.dispatchEvent(new MouseEvent("click",i)),c.log("[Pillar] clickElement full mouse sequence executed"),!0}return c.warn("[Pillar] clickElement element not found or not HTMLElement"),!1}typeInElement(e,n){c.log("[Pillar] typeInElement called with selector:",e,"text:",n);const t=this.getElement(e);if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){c.log("[Pillar] typeInElement found input/textarea:",t.tagName,t.type),this.highlightElement(t),t.focus();const e=t instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype,r=Object.getOwnPropertyDescriptor(e,"value")?.set;return r?(r.call(t,n),c.log("[Pillar] typeInElement set value via native setter")):(t.value=n,c.log("[Pillar] typeInElement set value directly (fallback)")),t.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),t.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),t.dispatchEvent(new Event("change",{bubbles:!0})),c.log("[Pillar] typeInElement complete - events fired"),!0}return t instanceof HTMLElement&&"true"===t.getAttribute("contenteditable")?(c.log("[Pillar] typeInElement found contenteditable element"),this.highlightElement(t),t.focus(),t.textContent=n,t.dispatchEvent(new InputEvent("beforeinput",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),t.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:n})),c.log("[Pillar] typeInElement contenteditable complete"),!0):(c.warn("[Pillar] typeInElement element not found or not an input:",t),!1)}selectOption(e,n){c.log("[Pillar] selectOption called with selector:",e,"value:",n);const t=this.getElement(e);if(t instanceof HTMLSelectElement){c.log("[Pillar] selectOption found select element"),this.highlightElement(t),t.focus();const e=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;return e?(e.call(t,n),c.log("[Pillar] selectOption set value via native setter")):(t.value=n,c.log("[Pillar] selectOption set value directly (fallback)")),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})),c.log("[Pillar] selectOption complete"),!0}return c.warn("[Pillar] selectOption element not found or not a select:",t),!1}focusElement(e){c.log("[Pillar] focusElement called with selector:",e);const n=this.getElement(e);return n instanceof HTMLElement?(c.log("[Pillar] focusElement found element:",n.tagName),this.highlightElement(n),n.focus(),n.dispatchEvent(new FocusEvent("focusin",{bubbles:!0})),c.log("[Pillar] focusElement complete"),!0):(c.warn("[Pillar] focusElement element not found:",n),!1)}toggleElement(e){c.log("[Pillar] toggleElement called with selector:",e);const n=this.getElement(e);if(n instanceof HTMLInputElement&&("checkbox"===n.type||"radio"===n.type)){c.log("[Pillar] toggleElement found checkbox/radio:",n.type,"current checked:",n.checked),this.highlightElement(n),n.focus();const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:r,button:0,buttons:1};return n.dispatchEvent(new MouseEvent("mousedown",i)),n.dispatchEvent(new MouseEvent("mouseup",i)),n.dispatchEvent(new MouseEvent("click",i)),n.dispatchEvent(new Event("input",{bubbles:!0})),c.log("[Pillar] toggleElement complete - new checked:",n.checked),!0}return c.warn("[Pillar] toggleElement element not found or not checkbox/radio:",n),!1}async handlePageInteraction(e){if(c.log("[Pillar] handlePageInteraction called with params:",e),!Ii(e.ref))return c.warn("[Pillar] handlePageInteraction rejected invalid ref format:",e.ref),{success:!1,error:"Invalid ref format"};const n=Mi(e.ref);c.log("[Pillar] handlePageInteraction built selector:",n);const t=this.getElement(n);if(!t)return c.warn("[Pillar] handlePageInteraction element not found for ref:",e.ref),{success:!1,error:"Element not found"};if(t.getAttribute("data-pillar-ref")!==e.ref)return c.warn("[Pillar] handlePageInteraction ref attribute mismatch"),{success:!1,error:"Ref attribute mismatch"};if(Ei(t)){const n=t.textContent?.trim().slice(0,50)||t.getAttribute("aria-label")||e.operation;c.log("[Pillar] handlePageInteraction detected destructive element:",n);const{requestConfirmation:r}=await Promise.resolve().then(function(){return hi});if(!await r(`Agent wants to ${e.operation} "${n}"`))return c.log("[Pillar] handlePageInteraction destructive action denied by user"),{success:!1,error:"User denied destructive action"};c.log("[Pillar] handlePageInteraction destructive action confirmed by user")}let r;switch(e.operation){case"click":r={success:this.clickElement(n)};break;case"type":if(!e.value){r={success:!1,error:"value required for type operation"};break}r={success:this.typeInElement(n,e.value)};break;case"select":if(!e.value){r={success:!1,error:"value required for select operation"};break}r={success:this.selectOption(n,e.value)};break;case"focus":r={success:this.focusElement(n)};break;case"toggle":r={success:this.toggleElement(n)};break;default:r={success:!1,error:`Unknown operation: ${e.operation}`}}return c.log("[Pillar] handlePageInteraction result:",r),r}mountPanelTo(e){this._panel?.mountTo(e)}getPanelHostElement(){return this._panel?.getHostElement()??null}get context(){return{...this._context}}get userProfile(){return{...this._userProfile}}setUserProfile(e){this._userProfile={...e},Ma(this._userProfile),this._events.emit("profile:change",{profile:this._userProfile})}async identify(e,n,t){if(this._api)if(e)if(null===this._externalUserId||String(this._externalUserId)!==String(e))try{await this._api.identify(e,n),this._externalUserId=e,this._persistExternalUserId(e),this._userProfile={...this._userProfile,userId:e,...n?.name&&{name:n.name}},Ma(this._userProfile),this._api.setExternalUserId(e),t?.preserveConversation||sr(),nt.value+=1,this._events.emit("user:identified",{userId:e,profile:n})}catch(e){throw c.error("[Pillar] Failed to identify user:",e),e}else c.log("[Pillar] Already identified as this user, skipping");else c.warn("[Pillar] userId is required for identify()");else c.warn("[Pillar] SDK not initialized, cannot identify user")}logout(e){this._externalUserId=null,this._persistExternalUserId(null),this._userProfile={...za},Ma(this._userProfile),this._api?.clearExternalUserId(),e?.preserveConversation||sr(),nt.value+=1,this._events.emit("user:logout",{})}get externalUserId(){return this._externalUserId}get isIdentified(){return null!==this._externalUserId}reportAction(e,n){const t=[...(this._context.recentActions||[]).slice(-9),e];this._context={...this._context,recentActions:t},(e=>{const n=Ta.value.recentActions||[];Ta.value={...Ta.value,recentActions:[...n.slice(-9),e]}})(e),this._events.emit("action:report",{action:e,metadata:n})}clearErrorState(){if(this._context.errorState){const{errorState:e,...n}=this._context;this._context=n,(()=>{const{errorState:e,...n}=Ta.value;Ta.value=n})(),this._events.emit("context:change",{context:this._context})}}setErrorState(e,n){this._context={...this._context,errorState:{code:e,message:n}},((e,n)=>{Ta.value={...Ta.value,errorState:{code:e,message:n}}})(e,n),this._events.emit("context:change",{context:this._context})}async getSuggestions(){if(!this._api)return c.warn("[Pillar] SDK not initialized, cannot get suggestions"),[];try{return await this._api.getSuggestions(this._context,this._userProfile)}catch(e){return c.error("[Pillar] Failed to get suggestions:",e),[]}}getAssistantContext(){return{product:this._context,user:this._userProfile}}onTask(e,n){return this._taskHandlers.set(e,n),()=>this._taskHandlers.delete(e)}defineAction(e){return e.name?(this._definedActions.set(e.name,e),c.log(`[Pillar] Defined action: ${e.name}`),()=>{this._definedActions.delete(e.name)}):(c.warn("[Pillar] defineAction called without a name"),()=>{})}registerAction(e){const{name:n,...t}=e;n?(this._registeredActions.set(n,{name:n,...t,returns:t.returnsData||t.returns||!1,autoRun:t.autoRun??t.auto_run??!1,autoComplete:t.autoComplete??t.auto_complete??!0}),c.log(`[Pillar] Registered action: ${n}`)):c.warn("[Pillar] registerAction called without a name")}getRegisteredAction(e){return this._registeredActions.get(e)}getHandler(e){const n=this._definedActions.get(e);if(n?.execute)return n.execute;const t=b(e)?v(e):void 0;if(t?.handler)return t.handler;const r=this._taskHandlers.get(e);return r||void 0}onAnyTask(e){return this._anyTaskHandler=e,()=>{this._anyTaskHandler=null}}offTask(e){this._taskHandlers.delete(e)}executeTask(e){const{name:n,data:t,taskType:r,path:i,externalUrl:l}=e;if(this._events.emit("task:execute",e),this._anyTaskHandler)try{this._anyTaskHandler(n,t)}catch(e){c.error("[Pillar] Error in onAnyTask handler:",e)}const a=this._definedActions.get(n),s=a?.execute,p=b(n)?v(n):void 0,d=this._registeredActions.get(n),u=p?.handler,h=this._taskHandlers.get(n),g=r?this._taskHandlers.get(r):void 0,m=s||u||h||g,f=!!a||p?.returns||d?.returns;if(m){const e=performance.now();o.add({event:"handler:execute",data:{action:n,taskType:r,params:t},source:"handler",level:"info"});try{const l=m("navigate"===r&&i?{...t,path:i}:t);if(f&&void 0!==l)Promise.resolve(l).then(async r=>{const i=Math.round(performance.now()-e);if(void 0!==r){await this.sendActionResult(n,r);let e=!0;if(r&&"object"==typeof r&&!Array.isArray(r)){!1===r.success&&(e=!1)}o.add({event:"handler:complete",data:{action:n,duration:i,success:e,returnsData:!0},source:"handler",level:e?"info":"warn"}),this._events.emit("task:complete",{name:n,success:e,data:r})}else o.add({event:"handler:complete",data:{action:n,duration:i,success:!0},source:"handler",level:"info"}),this._events.emit("task:complete",{name:n,success:!0,data:t})}).catch(r=>{const i=Math.round(performance.now()-e);o.add({event:"handler:error",data:{action:n,duration:i,error:r instanceof Error?r.message:String(r)},source:"handler",level:"error"}),c.error(`[Pillar] Error in query action "${n}":`,r),this._events.emit("task:complete",{name:n,success:!1,data:t})});else{const r=Math.round(performance.now()-e);o.add({event:"handler:complete",data:{action:n,duration:r,success:!0},source:"handler",level:"info"}),this._events.emit("task:complete",{name:n,success:!0,data:t})}}catch(r){const i=Math.round(performance.now()-e);o.add({event:"handler:error",data:{action:n,duration:i,error:r instanceof Error?r.message:String(r)},source:"handler",level:"error"}),c.error(`[Pillar] Error executing task "${n}":`,r),this._events.emit("task:complete",{name:n,success:!1,data:t})}}else switch(r){case"navigate":i&&"undefined"!=typeof window&&(c.warn("[Pillar] No 'navigate' handler registered. Using window.location.href as fallback."),window.location.href=i,this._events.emit("task:complete",{name:n,success:!0,data:t}));break;case"external_link":l&&"undefined"!=typeof window&&(window.open(l,"_blank","noopener,noreferrer"),this._events.emit("task:complete",{name:n,success:!0,data:t}));break;case"copy_text":t.text&&"undefined"!=typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(String(t.text)).then(()=>{this._events.emit("task:complete",{name:n,success:!0,data:t})}).catch(()=>{this._events.emit("task:complete",{name:n,success:!1,data:t})});break;default:c.warn(`[Pillar] No handler registered for task "${n}". Register one with pillar.onTask('${n}', handler)`),this._events.emit("task:complete",{name:n,success:!1,data:{error:"No handler registered"}})}}completeTask(e,n=!0,t){this._events.emit("task:complete",{name:e,success:n,data:t})}async completeAction(e,n=!0,t){this._events.emit("task:complete",{name:e,success:n,data:t})}confirmTaskExecution(e,n,t){e?this._api?this._api.confirmTaskExecution(e,n,t):c.warn("[Pillar] SDK not initialized, cannot confirm task execution"):c.warn("[Pillar] confirmTaskExecution called without taskId")}registerCard(e,n){return this._cardRenderers.set(e,n),()=>this._cardRenderers.delete(e)}getCardRenderer(e){return this._cardRenderers.get(e)}hasCardRenderer(e){return this._cardRenderers.has(e)}get workflow(){return Ra.value}startWorkflow(e){!function(e){Ra.value&&($a.value=[...$a.value,Ra.value]);const n=e.steps.map((e,n)=>0===n?{...e,status:e.auto_run?"active":"awaiting_initiation"}:{...e,status:"pending"});Ra.value={...e,steps:n,current_step:0}}(e),this._events.emit("workflow:start",Ra.value);const n=Ra.value.steps[0];n.auto_run&&this._executeWorkflowStep(n)}initiateWorkflowStep(e){const n=Ra.value;if(!n)return void c.warn("[Pillar] No active workflow");const t=e??n.current_step,r=n.steps[t];r?"awaiting_initiation"===r.status?this._executeWorkflowStep(r):c.warn(`[Pillar] Step ${t} is not awaiting initiation`):c.warn(`[Pillar] Invalid step index: ${t}`)}confirmWorkflowStep(e,n){const t=Ra.value;if(!t)return;const r=n??t.current_step;if(t.steps[r],La(r,e?"completed":"failed"),this._events.emit("workflow:step:complete",{workflow:Ra.value,step:Ra.value.steps[r],success:e}),!e)return;const i=Ha();if(!i)return this._events.emit("workflow:complete",Ra.value),void Oa();this._events.emit("workflow:step:active",{workflow:Ra.value,step:i}),i.auto_run&&this._executeWorkflowStep(i)}skipWorkflowStep(e){const n=Ra.value;if(!n)return;const t=e??n.current_step;n.steps[t],La(t,"skipped"),this._events.emit("workflow:step:skip",{workflow:Ra.value,step:Ra.value.steps[t]});const r=Ha();if(!r)return this._events.emit("workflow:complete",Ra.value),void Oa();this._events.emit("workflow:step:active",{workflow:Ra.value,step:r}),r.auto_run&&this._executeWorkflowStep(r)}cancelWorkflow(){const e=Ra.value;e&&(this._events.emit("workflow:cancel",e),function(){if(!Ra.value)return null;const e=Ra.value;Ra.value=null}())}_executeWorkflowStep(e){La(e.index,"active"),this.executeTask({id:e.task_id,name:e.task_name,taskType:e.task_type,data:e.data,path:e.data?.path,externalUrl:e.data?.url}),e.auto_complete&&setTimeout(()=>{this.confirmWorkflowStep(!0,e.index)},100)}async sendActionResult(e,n,t){this._api?(c.log(`[Pillar] Sending action result for "${e}" (tool_call_id: ${t}):`,n),await this._api.mcp.sendActionResult(e,n,t),this._events.emit("action:result",{actionName:e,result:n,toolCallId:t})):c.warn("[Pillar] SDK not initialized, cannot send action result")}async executeQueryAction(e,n={},t){const r=performance.now();if(!e||"string"!=typeof e||""===e.trim())return void c.error("[Pillar] executeQueryAction called with missing or invalid actionName:",e);if(c.log(`[Pillar] Starting query action "${e}"`,n),t?.properties){const r=this._validateQueryParams(n,t);if(r)return c.error(`[Pillar] Query param validation failed: ${r}`),void await this.sendActionResult(e,{success:!1,error:r})}const i=this._definedActions.get(e),l=i?.execute,a=b(e)?v(e):void 0;this._registeredActions.get(e);const s=a?.handler,p=this._taskHandlers.get(e),d=this._taskHandlers.get("query"),u=l||s||p||d;if(!u)return c.error(`[Pillar] No handler registered for query action "${e}". Register one with: pillar.onTask('${e}', async (data) => { ... return result; })`),void await this.sendActionResult(e,{error:`No handler registered for action "${e}"`,success:!1});o.add({event:"handler:execute",data:{action:e,type:"query",params:n},source:"handler",level:"info"});try{const t=performance.now(),i=await Promise.resolve(u(n)),l=Math.round(performance.now()-t);if(c.log(`[Pillar] Query action "${e}" handler completed in ${l}ms`,i),void 0!==i){o.add({event:"handler:complete",data:{action:e,duration:l,success:!0,returnsData:!0},source:"handler",level:"info"}),await this.sendActionResult(e,i);const n=Math.round(performance.now()-r);c.log(`[Pillar] Query action "${e}" total time: ${n}ms`)}else o.add({event:"handler:complete",data:{action:e,duration:l,success:!1,error:"returned undefined"},source:"handler",level:"warn"}),c.warn(`[Pillar] Query action "${e}" returned undefined. Make sure your handler returns data for the agent.`),await this.sendActionResult(e,{error:"Handler returned undefined",success:!1})}catch(n){const t=Math.round(performance.now()-r);o.add({event:"handler:error",data:{action:e,duration:t,error:n instanceof Error?n.message:String(n)},source:"handler",level:"error"}),c.error(`[Pillar] Error executing query action "${e}" after ${t}ms:`,n),await this.sendActionResult(e,{error:n instanceof Error?n.message:String(n),success:!1})}}_validateQueryParams(e,n){const t=n.properties||{},r=n.required||[],i=Object.keys(t),l=r.filter(n=>!(n in e));if(l.length>0)return`Missing required parameters: ${l.join(", ")}. Expected: ${i.join(", ")}`;const a=Object.keys(e).filter(e=>!(e in t));return a.length>0?`Unknown parameters: ${a.join(", ")}. Expected: ${i.join(", ")}`:null}async _init(e){if("initializing"===this._state&&this._initPromise)return c.log("[Pillar] Already initializing, waiting for completion"),void await this._initPromise;"ready"!==this._state?(this._state="initializing",this._initPromise=this._doInit(e),await this._initPromise):c.log("[Pillar] Already initialized")}async _doInit(e){try{e.debug&&(n(!0),o.add({event:"sdk:init:start",data:{productKey:e.productKey,debug:!0},source:"sdk",level:"info"})),await new Promise(e=>{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>e(),{once:!0}):e()});const r=ro(e),i=new C(r),l=function(e,n){if(!n)return e;const t={...e};return n.panel&&(t.panel={...n.panel,...e.panel}),n.theme?.colors?.primary&&(t.theme={...t.theme,colors:{primary:e.theme?.colors?.primary??n.theme.colors.primary,...e.theme?.colors}}),t}(e,await i.fetchEmbedConfig().catch(e=>(c.warn("[Pillar] Failed to fetch server config, using local config only:",e),null)));this._config=ro(l),this._config.platform&&this._config.version&&g(this._config.platform,this._config.version),this._api=new C(this._config);const a=this._getStoredExternalUserId();a&&(this._externalUserId=a,this._api.setExternalUserId(a),c.log("[Pillar] Restored external user ID from localStorage")),c.configure(this._api.mcp,{forwardToServer:!0}),this._config.debug&&this._setupDebugEventCapture(),this._rootContainer=this._createRootContainer(),t=this._config.mobileTrigger.breakpoint,zn.value=t,(e=>{Tn.value=e})(this._config.panel.fullWidthBreakpoint),this._config.panel.enabled&&(this._panel=new xa(this._config,this._api,this._events,this._rootContainer),await this._panel.init()),this._config.edgeTrigger.enabled&&(this._edgeTrigger=new Nn(this._config,this._events,()=>this.toggle(),this._rootContainer),this._edgeTrigger.init()),this._config.mobileTrigger.enabled&&(this._mobileTrigger=new Kn(this._config,this._events,()=>this.toggle(),this._rootContainer),this._mobileTrigger.init()),this._config.textSelection.enabled&&this._config.panel.enabled&&(this._textSelectionManager=new ka(this._config,this._events,()=>this.open()),this._textSelectionManager.init()),this._pagePilotManager=new Pa,this._pagePilotManager.init(this._config.theme.colors.primary,this._config.theme.mode),this._state="ready",this._events.emit("ready"),this._config.onReady?.(),c.log("[Pillar] SDK initialized successfully"),this._config.debug&&this._mountDebugPanel(),this._config.suggestions.enabled&&this._initSuggestions().catch(e=>{c.warn("[Pillar] Background suggestions init failed:",e)}),await this._recoverSession(),this._config.urlParams.enabled&&await this._handleUrlParams(),this._config.panel.initialOpen&&!yn.value&&(this.open(),c.log("[Pillar] Panel auto-opened via initialOpen config")),await this._restoreConversation()}catch(e){this._state="error";const n=e instanceof Error?e:new Error(String(e));throw this._events.emit("error",n),this._config?.onError?.(n),c.error("[Pillar] Failed to initialize:",e),e}var t}async _recoverSession(){if(!this._config||!this._api)return void c.warn("[Pillar] _recoverSession skipped: config or api not available");const e=this._config.productKey;c.log("[Pillar] Checking for saved session hint with siteId:",e);const{loadActiveSession:n,clearActiveSession:t}=await Promise.resolve().then(function(){return fi}),{setInterruptedSession:r,setConversationId:i}=await Promise.resolve().then(function(){return fr}),l=n(e);if(l){c.log("[Pillar] Found saved session hint, checking with server...");try{const n=await this._api.mcp.getConversationStatus(l.conversationId);if(!n||!n.resumable)return c.log("[Pillar] Session is no longer resumable, clearing hint"),void t(e);c.log("[Pillar] Session is resumable, setting up resume state"),i(l.conversationId),r({conversationId:l.conversationId,userMessage:n.user_message??"",partialResponse:n.partial_response??"",displayTrace:n.display_trace??[],elapsedMs:n.elapsed_ms??0}),c.log("[Pillar] Resume state set up successfully")}catch(n){c.warn("[Pillar] Failed to check session status:",n),t(e)}}else c.log("[Pillar] No saved session found for siteId:",e)}async _restoreConversation(){if(!this._api)return;const{getStoredConversationId:e,messages:n,loadConversation:t,isLoadingHistory:r,interruptedSession:i,setInterruptedSession:l}=await Promise.resolve().then(function(){return fr}),{navigate:a,currentView:o}=await Promise.resolve().then(function(){return Pr}),s=e();if(s&&!(n.value.length>0)){c.log("[Pillar] Restoring conversation from localStorage:",s);try{r.value=!0,"chat"!==o.value.type&&a("chat");const e=await this._api.getConversation(s);if(e&&e.messages.length>0){let n=e.messages;const a=n[n.length-1],o="assistant"===a.role&&!a.content?.trim();if(o&&(c.log("[Pillar] Stripped trailing empty assistant message from restored conversation"),n=n.slice(0,-1)),n.length>0?t(e.id,n):r.value=!1,o&&!i.value&&this._api.mcp){c.log("[Pillar] Checking conversation status as fallback for resume...");try{const e=await this._api.mcp.getConversationStatus(s);e&&e.resumable&&(c.log("[Pillar] Fallback: session is resumable, setting up resume state"),l({conversationId:s,userMessage:e.user_message??"",partialResponse:e.partial_response??"",displayTrace:e.display_trace??[],elapsedMs:e.elapsed_ms??0}))}catch(e){c.warn("[Pillar] Fallback resume check failed:",e)}}}else r.value=!1}catch(e){c.warn("[Pillar] Failed to restore conversation:",e),r.value=!1}}}async _handleUrlParams(){if(!this._config)return;(function(e=Wa){if("undefined"==typeof window||!window.location)return{};const n=new URLSearchParams(window.location.search),t={};n.has(`${e}open`)&&(t.open=!0);const r=n.get(`${e}article`);r&&(t.article=r);const i=n.get(`${e}article-id`);i&&!t.article&&(t.article=i);const l=n.get(`${e}category`);l&&(t.category=l);const a=n.get(`${e}search`);return a&&(t.search=a),t})(this._config.urlParams.prefix).open&&(this.open(),this._config.urlParams.clearAfterOpen&&function(e=Wa){if("undefined"==typeof window||!window.location||!window.history)return;const n=new URL(window.location.href),t=[`${e}open`,`${e}article`,`${e}article-id`,`${e}category`,`${e}search`];let r=!1;for(const e of t)n.searchParams.has(e)&&(n.searchParams.delete(e),r=!0);r&&window.history.replaceState({},"",n.toString())}(this._config.urlParams.prefix))}_mountDebugPanel(){this._debugPanelContainer=document.createElement("div"),this._debugPanelContainer.id="pillar-debug-panel-root",document.body.appendChild(this._debugPanelContainer),ue(W(Fa,null),this._debugPanelContainer),o.add({event:"debug:panel:mounted",source:"sdk",level:"info"})}_setupDebugEventCapture(){this._events.on("task:execute",e=>{o.add({event:"task:execute",data:{name:e.name,taskType:e.taskType},source:"sdk",level:"info"})}),this._events.on("task:complete",e=>{o.add({event:"task:complete",data:{name:e.name,success:e.success},source:"sdk",level:e.success?"info":"error"})}),this._events.on("action:result",e=>{o.add({event:"action:result",data:{actionName:e.actionName,hasResult:!!e.result},source:"sdk",level:"info"})}),this._events.on("ready",()=>{o.add({event:"sdk:ready",source:"sdk",level:"info"})}),this._events.on("error",e=>{o.add({event:"sdk:error",data:{message:e.message},source:"sdk",level:"error"})}),c.log("[Pillar] Debug event capture enabled")}async _initSuggestions(){if(this._api&&this._config){c.log("[Pillar] Initializing page-aware suggestions"),qr(!0);try{const e=await this._api.getSuggestedQuestions();c.log(`[Pillar] Fetched ${e.length} suggestions for pool`),this._suggestionPool=e,function(e){Ar.value=e}(e),this._routeObserver=new Da({debounceMs:this._config.suggestions.debounceMs}),this._routeObserver.onRouteChange(e=>{this._handleRouteChange(e)}),this._routeObserver.start();const n=this._routeObserver.getCurrentRoute();this._handleRouteChange(n),qr(!1)}catch(e){c.error("[Pillar] Failed to initialize suggestions:",e),function(e){Or.value=e,Hr.value=!1}(e instanceof Error?e.message:String(e)),qr(!1)}}}_handleRouteChange(e){if(!this._config)return;const{pathname:n,title:t}=e,r=this._config.suggestions.displayLimit;c.log(`[Pillar] Route changed to: ${n}, sorting suggestions`);const i=jr(this._suggestionPool,n,t,r);!function(e,n){Lr.value=e,Dr.value=n}(i,n),this._events.emit("suggestions:updated",{suggestions:i.map(e=>({id:e.id,text:e.text})),route:n}),c.log(`[Pillar] Sorted ${i.length} suggestions for page`)}_destroy(){this._routeObserver?.stop(),this._routeObserver=null,this._suggestionPool=[],Ar.value=[],Lr.value=[],Hr.value=!1,Or.value=null,Dr.value=null,this._textSelectionManager?.destroy(),this._pagePilotManager?.destroy(),this._panel?.destroy(),this._edgeTrigger?.destroy(),this._mobileTrigger?.destroy(),this._api?.cancelAllRequests(),this._events.removeAllListeners(),this._unsubscribeHoverMode?.(),this._unsubscribeHoverMode=null,this._rootContainer?.remove(),this._rootContainer=null,this._debugPanelContainer&&(ue(null,this._debugPanelContainer),this._debugPanelContainer.remove(),this._debugPanelContainer=null),Dn(),Sr(),sr(),Ta.value={...Ea},Ia.value={...za},Ra.value=null,$a.value=[],this._context={...Ea},this._userProfile={...za},this._taskHandlers.clear(),this._anyTaskHandler=null,this._textSelectionManager=null,this._pagePilotManager=null,this._panel=null,this._edgeTrigger=null,this._mobileTrigger=null,this._api=null,this._config=null,this._state="uninitialized",c.log("[Pillar] SDK destroyed")}}io.instance=null,io.EXTERNAL_USER_ID_STORAGE_KEY="pillar:external_user_id";var lo=Object.freeze({__proto__:null,Pillar:io,getApiClient:Jr});if("undefined"!=typeof window){window.Pillar=io;const e=()=>{const e=document.currentScript;e?.dataset.productKey&&io.init({productKey:e.dataset.productKey}).catch(c.error)};if("loading"===document.readyState)document.addEventListener("DOMContentLoaded",e);else{const e=document.querySelectorAll("script[data-product-key]");if(e.length>0){const n=e[e.length-1];n.dataset.productKey&&io.init({productKey:n.dataset.productKey}).catch(c.error)}}}export{C as APIClient,vi as DEFAULT_SCAN_OPTIONS,Va as DEFAULT_SIDEBAR_TABS,u as EventEmitter,_i as INTERACTABLE_ROLES,bi as INTERACTABLE_TAGS,io as Pillar,xi as SKIP_TAGS,Mi as buildSelectorFromRef,wi as clearPillarRefs,y as clearRegistry,io as default,Xn as generateContextId,w as getActionCount,v as getActionDefinition,_ as getActionNames,m as getClientInfo,Gn as getContextDisplayLabel,f as getHandler,x as getManifest,b as hasAction,Zn as isDOMSnapshotContext,Ei as isDestructiveElement,Yn as isHighlightedTextContext,zi as isInteractable,Ci as isRedacted,Ii as isValidPillarRef,Li as scanPageDirect,g as setClientInfo};
|
|
2
2
|
//# sourceMappingURL=pillar.esm.js.map
|