@heroui/agent 1.0.0-beta.8 → 1.0.0-beta.9
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/{chunk-YPHOJDYK.js → chunk-56CE4HMH.js} +1 -1
- package/dist/{chunk-MUJYIDA4.js → chunk-DLEBKF27.js} +1 -1
- package/dist/chunk-KE7HXMS3.js +1 -0
- package/dist/chunk-LZK3RRL5.js +1 -0
- package/dist/{chunk-KQ3FZPFS.js → chunk-XCWSE27G.js} +1 -1
- package/dist/{client-tools-manifest-BD7O7M3V.js → client-tools-manifest-4AUJCJMV.js} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/internal/host.d.ts +3 -3
- package/dist/internal/host.js +1 -1
- package/dist/internal/shared.d.ts +3 -3
- package/dist/internal/shared.js +1 -1
- package/dist/next.d.ts +2 -2
- package/dist/next.js +1 -1
- package/dist/{types-Cuqd4_1K.d.ts → types-BjpL8iWi.d.ts} +9 -8
- package/dist/{version-DDaVFBVG.d.ts → version-CResRC5Q.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-2W6CUSN3.js +0 -1
- package/dist/chunk-KMVOOEIK.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function m(){return function(e){return e}}function u(t){return!!(t&&typeof t=="object"&&typeof t.safeParse=="function")}function A(t,e){return u(t.parameters)?t.parameters.parse(e):e}function y(t,e){let n=t.get(e);return!n||n.needsApproval?null:n}var x="https://agent.heroui.pro",h="https://staging-agent.heroui.pro",
|
|
1
|
+
function m(){return function(e){return e}}function u(t){return!!(t&&typeof t=="object"&&typeof t.safeParse=="function")}function A(t,e){return u(t.parameters)?t.parameters.parse(e):e}function y(t,e){let n=t.get(e);return!n||n.needsApproval?null:n}var x="https://agent.heroui.pro",h="https://staging-agent.heroui.pro",b=262144,I=57671680;function S(t,e,n,s,i=crypto.randomUUID()){return{nonce:e,...s===void 0?{}:{payload:s},requestId:i,sessionId:t,type:n}}function E(t){if(!t||typeof t!="object")return null;let e=t;if(typeof e.sessionId!="string"||!a(e.sessionId)||typeof e.nonce!="string"||!a(e.nonce)||typeof e.requestId!="string"||!a(e.requestId)||typeof e.type!="string"||e.type.length===0||!l.has(e.type))return null;let n=e.type==="iframe.persistence"||e.type==="host.upload-data-source"||e.type==="host.rpc-result"?57671680:262144;return p(t)>n||!f(e.type,e.payload)?null:{nonce:e.nonce,...Object.hasOwn(e,"payload")?{payload:e.payload}:{},requestId:e.requestId,sessionId:e.sessionId,type:e.type}}function d(t,e=new Set){if(t===null||typeof t=="string"||typeof t=="boolean")return!0;if(typeof t=="number")return Number.isFinite(t);if(typeof t!="object"||e.has(t))return!1;e.add(t);let n=i=>i===void 0||d(i,e),s=Array.isArray(t)?t.every(n):Object.getPrototypeOf(t)===Object.prototype&&Object.values(t).every(n);return e.delete(t),s}function p(t){return g(t,new Set)}function g(t,e){if(t==null)return 4;if(typeof t=="string")return new TextEncoder().encode(t).byteLength+2;if(typeof t=="boolean"||typeof t=="number")return 8;if(typeof t!="object"||e.has(t))return Number.POSITIVE_INFINITY;if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))return t.byteLength;if(typeof Blob<"u"&&t instanceof Blob)return t.size;e.add(t);let n=2;for(let[s,i]of Object.entries(t))if(n+=g(s,e)+g(i,e),!Number.isFinite(n))break;return e.delete(t),n}function a(t){return t.length>0&&t.length<=128&&/^[A-Za-z0-9._:-]+$/.test(t)}var l=new Set(["host.command","host.init","host.update","host.rpc-result","host.rpc-error","host.upload-data-source","iframe.ready","iframe.reload","iframe.auth-request","iframe.context-request","iframe.feedback","iframe.persistence","iframe.state","iframe.storage","iframe.rpc-result","iframe.rpc-error","iframe.error","iframe.status","iframe.tool-cancel","iframe.tool-execute"]),c=["loading","authenticating","connecting","ready","generating","finishing","reconnecting","failed"],o=t=>!!(t&&typeof t=="object"&&!Array.isArray(t)),r=t=>typeof t=="string";function f(t,e){if(t==="iframe.ready"||t==="iframe.reload"||t==="iframe.auth-request"||t==="iframe.context-request")return e===void 0;if(t==="iframe.status")return c.includes(e);if(!o(e))return!1;switch(t){case"host.init":case"host.update":return o(e.props)&&o(e.localStorage)&&o(e.sessionStorage)&&Object.values(e.localStorage).every(r)&&Object.values(e.sessionStorage).every(r)&&(e.restoreSession===void 0||typeof e.restoreSession=="boolean")&&Array.isArray(e.tools)&&e.tools.every(n=>o(n)&&r(n.name)&&r(n.description)&&o(n.inputSchema));case"host.command":return["show","hide","toggle","preload","refreshAuth","shutdown","newConversation"].includes(e.name);case"host.rpc-error":case"iframe.rpc-error":return r(e.error);case"host.rpc-result":case"iframe.rpc-result":return!0;case"host.upload-data-source":return r(e.toolCallId)&&o(e.upload);case"iframe.tool-cancel":return r(e.idempotencyKey);case"iframe.tool-execute":return["name","conversationId","idempotencyKey","toolCallId"].every(n=>r(e[n]));case"iframe.error":return["authentication","connection","configuration","chunk","rate_limit","credits","deleted","approval","unknown"].includes(e.category)&&c.includes(e.phase)&&r(e.message)&&r(e.diagnosticId)&&typeof e.retryable=="boolean";case"iframe.state":return["open","ready","expanded","closing","dragging","mounted","overlayOpen","resizing"].every(n=>typeof e[n]=="boolean")&&["chat-bar","floating","sidebar"].includes(e.viewMode);case"iframe.storage":return["local","session"].includes(e.storage)&&(e.operation==="clear"||r(e.key)&&(e.operation==="remove"||e.operation==="set"&&r(e.value)));case"iframe.persistence":return["composer-image-drafts","message-outboxes"].includes(e.store)&&(e.operation==="deletePrefix"?r(e.prefix):["get","put","delete"].includes(e.operation)&&r(e.key));case"iframe.feedback":return r(e.conversationId)&&r(e.messageId)&&["positive","negative"].includes(e.rating)&&Array.isArray(e.reasons)}}export{m as a,u as b,A as c,y as d,x as e,h as f,b as g,I as h,S as i,E as j,d as k,p as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as S}from"./chunk-
|
|
1
|
+
import{e as S}from"./chunk-LZK3RRL5.js";import{b as d}from"./chunk-56CE4HMH.js";import{useEffect as k,useLayoutEffect as p,useMemo as x,useRef as m,useState as O,useSyncExternalStore as w}from"react";var i=new Map,h=new Set;function f(){for(let e of h)e()}function H(e){return h.add(e),()=>h.delete(e)}function a(e,n,r){let o=e?i.get(e):[...i.values()][i.size-1];if(!o){console.warn("HeroUI Agent is not mounted yet. Add <HeroUIAgent /> to your layout.");return}n==="newConversation"?o.newConversation(r):o[n]()}function R(e){let n=w(H,()=>(e?i.get(e):[...i.values()].at(-1))?.ready??!1,()=>!1);return x(()=>({hide:()=>a(e,"hide"),newConversation:r=>a(e,"newConversation",r),preload:()=>a(e,"preload"),ready:n,refreshAuth:()=>a(e,"refreshAuth"),show:()=>a(e,"show"),shutdown:()=>a(e,"shutdown"),toggle:()=>a(e,"toggle")}),[e,n])}async function E(e){let{serializeClientTools:n}=await import("./client-tools-manifest-4AUJCJMV.js");return n(e).map(o=>{let s=e.find(l=>l.name===o.name);return{...o,...s?.displayName?{displayName:s.displayName}:{},...s?.icon?{icon:s.icon}:{},...s?.iconColor?{iconColor:s.iconColor}:{}}})}function P(e){let n=m(e),r=m(null),o=m(null);p(()=>{n.current=e}),o.current||(o.current={getAuthToken:t=>n.current.getAuthToken(t),onError:t=>n.current.onError?.(t),onFeedback:t=>n.current.onFeedback?.(t),onReady:()=>n.current.onReady?.(),onStatusChange:t=>n.current.onStatusChange?.(t)},Object.defineProperties(o.current,{context:{enumerable:!0,get(){return n.current.context}},tools:{enumerable:!0,get(){return n.current.tools}}}));let s=T(e),l=o.current;for(let t of Object.keys(l))t!=="context"&&t!=="getAuthToken"&&t!=="onError"&&t!=="onStatusChange"&&t!=="onFeedback"&&t!=="onReady"&&t!=="tools"&&!(t in s)&&delete l[t];Object.assign(l,s,{agentId:e.agentId});let g=o.current;p(()=>{let t=S(g,E),u=t.subscribe(f);return r.current=t,i.set(e.agentId,t),f(),()=>{u(),t.destroy(),i.get(e.agentId)===t&&i.delete(e.agentId),r.current===t&&(r.current=null),f()}},[e.agentId]);let[C,c]=O("");k(()=>{let t=e.tools??[];if(!t.some(A=>d(A.parameters))){c("");return}let u=!1;return import("./client-tools-manifest-4AUJCJMV.js").then(({serializeClientTools:A})=>{u||c(JSON.stringify(A(t).map(y=>({inputSchema:y.inputSchema,name:y.name}))))}),()=>{u=!0}},[e.tools]);let b=JSON.stringify({props:T(e),tools:(e.tools??[]).map(t=>({description:t.description,displayName:t.displayName,icon:t.icon,iconColor:t.iconColor,name:t.name,needsApproval:t.needsApproval===!0,parameters:d(t.parameters)?null:t.parameters})),zodToolsSchemasKey:C});return p(()=>{r.current?.update(g)},[b]),null}function T(e){let{context:n,getAuthToken:r,onError:o,onFeedback:s,onReady:l,onStatusChange:g,tools:C,...c}=e;return JSON.parse(JSON.stringify(c))}export{R as a,P as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t="1.0.0-beta.9",o="https://api.heroui.pro";export{t as a,o as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as V}from"./chunk-KE7HXMS3.js";import{c as G,e as J,f as X,i as Y,j as Q,k as Z}from"./chunk-56CE4HMH.js";function ge(e,t){return e.throwIfAborted(),new Promise((n,r)=>{let l=()=>r(e.reason);e.addEventListener("abort",l,{once:!0});try{t().then(n,r).finally(()=>e.removeEventListener("abort",l))}catch(c){e.removeEventListener("abort",l),r(c)}})}async function U(e,t,n){let r=new AbortController,l=setTimeout(()=>r.abort(new DOMException("Request timed out","TimeoutError")),e),c=n?AbortSignal.any([n,r.signal]):r.signal;try{return await ge(c,()=>t(c))}finally{clearTimeout(l)}}var fe={approval:"This approval has expired. Ask the agent to request it again.",authentication:"Could not authenticate. Sign in if needed, then retry.",chunk:"Could not load the conversation. Retry, or reload the panel.",configuration:"Could not load the agent configuration. Try again.",connection:"Connection interrupted. Completed page changes remain applied. Reconnect to continue this chat.",credits:"This agent has reached its usage limit.",deleted:"This conversation was deleted. Start a new conversation.",rate_limit:"Too many requests. Wait a moment before retrying.",unknown:"The request could not be completed. Try again."},me="Too many conversations are active. Wait a few minutes, then retry this chat.";function ee(e,t="connecting"){let n=e&&typeof e=="object"?e:{},r=[e instanceof Error?e.message:"",n.code,n.status].filter(c=>typeof c=="string"||typeof c=="number").join(" ").toLowerCase(),l=t==="authenticating"||/auth|401|sign.in/.test(r)?"authentication":/429|rate.limit|concurrency_limit|too many conversations are active/.test(r)?"rate_limit":/credit|usage.limit|usage_limit|402/.test(r)?"credits":/deleted|conversation_not_found/.test(r)?"deleted":/approval.*expir/.test(r)?"approval":/dynamic.*import|chunk|module.*fetch/.test(r)?"chunk":/config/.test(r)?"configuration":/network|fetch|connect|timeout|timed out/.test(r)?"connection":"unknown";return{category:l,diagnosticId:crypto.randomUUID(),message:/concurrency_limit|too many conversations are active/.test(r)?me:fe[l],phase:t,retryable:!["credits","deleted","approval"].includes(l)}}var he=5e3;function te(e){return`heroui-agent:anonymous:${e}`}function ye(e){return e instanceof Error?e:new Error("Auth token request failed")}var P=class{constructor(t,n){this.agentId=t;this.getAuthToken=n}cached=null;failure=null;generation=0;pending=null;controller=new AbortController;clear(){this.controller.abort(),this.controller=new AbortController,this.generation+=1,this.cached=null,this.failure=null,this.pending=null}reset(){this.clear();try{localStorage.removeItem(te(this.agentId))}catch{}}async get(){if(this.cached&&this.expiresAt(this.cached)>Date.now()+6e4)return this.cached.token;if(!this.pending&&this.failure&&Date.now()<this.failure.retryAt)throw this.failure.error;let t=this.generation,n=this.pending??this.refresh();this.pending||(this.pending=n);try{let r=await n;return t!==this.generation?this.get():(this.cached=r,this.failure=null,r.token)}catch(r){throw t===this.generation&&(this.failure={error:ye(r),retryAt:Date.now()+he}),r}finally{this.pending===n&&(this.pending=null)}}async subjectHash(){let t=await this.get(),n=we(t),r=typeof n.sub=="string"?n.sub:"anonymous",l=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${this.agentId}:${r}`));return Array.from(new Uint8Array(l),c=>c.toString(16).padStart(2,"0")).join("").slice(0,24)}anonymousId(){let t=te(this.agentId);try{let n=localStorage.getItem(t);if(n)return n;let r=crypto.randomUUID();return localStorage.setItem(t,r),r}catch{return crypto.randomUUID()}}expiresAt(t){return t.expiresAt}async refresh(){let t=await U(15e3,n=>this.getAuthToken({agentId:this.agentId,anonymousId:this.anonymousId(),signal:n}),this.controller.signal);if(!t||typeof t.token!="string"||!t.token.trim()||typeof t.expiresAt!="number"||!Number.isFinite(t.expiresAt)||t.expiresAt<=0)throw new Error("Auth token callback returned invalid data");return{expiresAt:t.expiresAt,token:t.token}}};function we(e){try{let t=e.split(".")[1];if(!t)return{};let n=t.replace(/-/g,"+").replace(/_/g,"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return JSON.parse(atob(r))}catch{return{}}}function ne(e){return{bounds:null,closing:!1,dragging:!1,expanded:e.appearance?.panel?.expanded??!1,mounted:!1,open:!1,overlayOpen:!1,ready:!1,resizing:!1,sidebarWidth:null,viewMode:e.appearance?.viewMode??"floating"}}function v(e,t,n){return{background:"transparent",border:"0",clipPath:be(e,t,n),colorScheme:"normal",height:"100dvh",inset:"0",position:"fixed",width:"100vw",zIndex:t.appearance?.zIndex??40}}function oe(e){if(!e||typeof e!="object")return null;let t=e;return typeof t.open!="boolean"||typeof t.ready!="boolean"||typeof t.expanded!="boolean"||t.viewMode!=="chat-bar"&&t.viewMode!=="floating"&&t.viewMode!=="sidebar"?null:{bounds:ve(t.bounds),closing:t.closing===!0,dragging:t.dragging===!0,expanded:t.expanded,mounted:t.mounted!==!1,open:t.open,overlayOpen:t.overlayOpen===!0,ready:t.ready,resizing:t.resizing===!0,sidebarWidth:L(t.sidebarWidth)?t.sidebarWidth:null,viewMode:t.viewMode}}function re(){let e=document.documentElement,t=document.body;return{active:!1,body:t,original:{bodyLeft:t.style.left,bodyOverflow:t.style.overflow,bodyPosition:t.style.position,bodyRight:t.style.right,bodyTop:t.style.top,bodyWidth:t.style.width,rootMarginRight:e.style.marginRight,rootOverflow:e.style.overflow,rootTransition:e.style.transition},root:e,scrollLock:null}}function k(e,t,n,r){let l=t.open||t.closing;if(!l&&!e.active)return;l&&(e.active=!0);let c=l&&(t.viewMode==="chat-bar"?t.expanded:r||t.viewMode==="sidebar"&&t.expanded);ae(e,c);let s=l&&t.viewMode==="sidebar"&&!t.expanded&&!r?Ae(t,n):e.original.rootMarginRight;e.root.style.transition=e.original.rootTransition,e.root.style.marginRight=s,l||(e.active=!1)}function ie(e){ae(e,!1),e.root.style.marginRight=e.original.rootMarginRight,e.root.style.transition=e.original.rootTransition,e.active=!1}function be(e,t,n){let r=e.open||e.closing;if(r&&(e.overlayOpen||n&&e.viewMode!=="chat-bar"))return"inset(0px)";if(e.bounds)return`inset(${e.bounds.top}px calc(100% - ${e.bounds.right}px) calc(100% - ${e.bounds.bottom}px) ${e.bounds.left}px)`;if(e.viewMode==="chat-bar"){if(e.expanded&&r)return"inset(0px)";let w=r?"calc(100% - min(610px, calc(100dvh - 20px)))":"calc(100% - 114px)",b=r?"calc(50% - min(288px, 50%))":"calc(50% - min(228px, 50%))";return`inset(${w} ${b} 0px ${b})`}let l=t.appearance?.launcher,c=l?.position==="bottom-left",g=(l?.offset?.x??24)+60,s=(l?.offset?.y??24)+60;if(!r)return c?`inset(calc(100% - ${s}px) calc(100% - ${g}px) 0px 0px)`:`inset(calc(100% - ${s}px) 0px 0px calc(100% - ${g}px))`;if(e.viewMode==="sidebar")return`inset(0px 0px 0px calc(100% - (${F(t.appearance?.panel?.initialWidth??420)} + 16px)))`;let f=F(t.appearance?.panel?.initialWidth??440),T=`calc(100% - min(calc(${F(t.appearance?.panel?.initialHeight??"max(420px, 56dvh)")} + 32px), 100dvh))`;return c?`inset(${T} calc(100% - min(calc(${f} + 32px), 100vw)) 0px 0px)`:`inset(${T} 0px 0px calc(100% - min(calc(${f} + 32px), 100vw)))`}function ve(e){if(!e||typeof e!="object")return null;let t=e;return!L(t.top)||!L(t.right)||!L(t.bottom)||!L(t.left)||t.right<t.left||t.bottom<t.top?null:{bottom:t.bottom,left:t.left,right:t.right,top:t.top}}function L(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1e5}function Ae(e,t){return e.sidebarWidth===null?F(t.appearance?.panel?.initialWidth??420):`${Math.round(e.sidebarWidth)}px`}function F(e){return typeof e=="number"?`${Math.round(e)}px`:e}function ae(e,t){if(t&&!e.scrollLock){e.scrollLock={x:window.scrollX,y:window.scrollY},e.root.style.overflow="hidden",e.body.style.overflow="hidden",e.body.style.position="fixed",e.body.style.top=`${-e.scrollLock.y}px`,e.body.style.left=`${-e.scrollLock.x}px`,e.body.style.right="0",e.body.style.width="100%";return}if(!t&&e.scrollLock){let{x:n,y:r}=e.scrollLock;e.root.style.overflow=e.original.rootOverflow,e.body.style.overflow=e.original.bodyOverflow,e.body.style.position=e.original.bodyPosition,e.body.style.top=e.original.bodyTop,e.body.style.left=e.original.bodyLeft,e.body.style.right=e.original.bodyRight,e.body.style.width=e.original.bodyWidth,e.scrollLock=null;try{window.scrollTo(n,r)}catch{}}}var Te=16*1024,xe=64*1024;function qe(e,t){let n=e;if(!n?.agentId||typeof n.getAuthToken!="function")throw new Error("HeroUIAgent.mount requires agentId and getAuthToken");let r=crypto.randomUUID(),l=crypto.randomUUID(),c=(n._api?.baseUrl??V).replace(/\/$/,""),g=Le(c,n._api?.embedOrigin),s=document.createElement("iframe"),f=new Map,y=[],T=new Set,w=new Map,b=new Set,x=re(),M=new P(n.agentId,n.getAuthToken),a=ne(n),C=null,h=!1,A=!1,I=null,W=!1,$=!1,N=new URL("/embed",g);N.searchParams.set("agentId",n.agentId),N.hash=new URLSearchParams({nonce:l,parentOrigin:window.location.origin,sessionId:r}).toString(),s.allow="microphone; clipboard-write",s.referrerPolicy="origin",s.setAttribute("sandbox","allow-downloads allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"),s.src=N.toString(),s.title="HeroUI Agent",Object.assign(s.style,v(a,n,window.innerWidth<640)),document.body.append(s);let m=(o,i,d)=>{$||s.contentWindow?.postMessage(Y(r,l,o,i,d),g)},de=(o,i)=>{let d=crypto.randomUUID();return new Promise((p,u)=>{let H=window.setTimeout(()=>{f.delete(d),u(new Error(`HeroUI Agent iframe request timed out: ${o}`))},3e4);f.set(d,{reject:u,resolve:p,timer:H}),m(o,i,d)})},S=new Map,q=0,z="",B=async(o,i=!1)=>{let d=++q,p=await ke(n,t);if($||d!==q)return;let u=JSON.stringify({props:p.props,tools:p.tools});!i&&u===z||(z=u,m(o,{...p,restoreSession:o==="host.init"&&A}))},E=(o,i)=>{if(!a.mounted){y.push({name:o,payload:i}),y.length>32&&y.shift();return}m("host.command",{name:o,payload:i})},O=o=>{o&&!h&&document.activeElement!==s&&(C=document.activeElement),h=o,o||(A=!1),E(o?"show":"hide")},ce=()=>{if(a.mounted)for(let o of y.splice(0))m("host.command",o)},ue=()=>{A=a.mounted&&h&&!a.closing,a={...a,bounds:null,closing:!1,mounted:!1,open:A,ready:!1},W=!1;for(let o of b)o();Object.assign(s.style,v(a,n,window.innerWidth<640)),k(x,a,n,window.innerWidth<640)},j=o=>{if(o.origin!==g||o.source!==s.contentWindow)return;let i=Q(o.data);if(!(!i||i.sessionId!==r||i.nonce!==l)){if(i.type==="iframe.rpc-result"||i.type==="iframe.rpc-error"){Se(i,f);return}Pe(T,i.requestId)&&pe(i)}},pe=async o=>{try{if(o.type==="iframe.ready"){(a.mounted||a.ready)&&ue(),await B("host.init",!0);return}if(o.type==="iframe.reload"){let i=s.cloneNode(!1),d=new URL(s.src);d.pathname=`/reload/${crypto.randomUUID()}/embed`,i.src=d.href,s.replaceWith(i),s=i;return}if(o.type==="iframe.state"){let i=oe(o.payload);if(i){let d=a.mounted,p=a.open||a.closing,u=i;A?i.mounted?(A=!1,i.open||(m("host.command",{name:"show"}),u={...i,bounds:null,closing:!1,open:!0,sidebarWidth:i.sidebarWidth??a.sidebarWidth})):u={...i,bounds:null,closing:!1,open:!0,sidebarWidth:i.sidebarWidth??a.sidebarWidth}:i.open?h=!0:(i.closing||a.open||a.closing)&&(h=!1);let H=u.open||u.closing;if(H&&!p&&document.activeElement!==s&&(C=document.activeElement),!H&&p&&C?.isConnected){let D=C;window.requestAnimationFrame(()=>window.requestAnimationFrame(()=>D.focus({preventScroll:!0})))}a=u,a.mounted&&!d&&B("host.update"),H&&a.expanded?s.dataset.expanded="true":s.removeAttribute("data-expanded");for(let D of b)D();Object.assign(s.style,v(a,n,window.innerWidth<640)),k(x,a,n,window.innerWidth<640),ce(),a.ready&&!W&&(W=!0,n.onReady?.())}return}if(o.type==="iframe.error"){n.onError?.(o.payload);return}if(o.type==="iframe.status"){n.onStatusChange?.(o.payload);return}if(o.type==="iframe.tool-cancel"){let i=o.payload;i.idempotencyKey&&S.get(i.idempotencyKey)?.abort();return}if(o.type==="iframe.auth-request"){let i=await M.get(),d=await U(15e3,p=>fetch(`${c}/v1/agents/${encodeURIComponent(n.agentId)}/embed-sessions`,{body:JSON.stringify({iframeOrigin:g,sessionId:r}),cache:"no-store",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},method:"POST",signal:p}));if(!d.ok)throw new Error("Could not authenticate HeroUI Agent");m("host.rpc-result",{value:await d.json()},o.requestId);return}if(o.type==="iframe.context-request"){let i=le(await n.context?.page?.()??{},Te,"Agent page context");m("host.rpc-result",{value:i},o.requestId);return}if(o.type==="iframe.tool-execute"){let i=Ee(o.payload),d=n.tools?.find(u=>u.name===i.name);if(!d)throw new Error(`Unknown client tool: ${i.name}`);let p=w.get(i.idempotencyKey);if(!p){let u=new AbortController;S.set(i.idempotencyKey,u),p=Ie(d,i,n,de,u.signal).finally(()=>S.delete(i.idempotencyKey)),w.set(i.idempotencyKey,p),w.size>2048&&w.delete(w.keys().next().value)}m("host.rpc-result",{value:await p},o.requestId);return}if(o.type==="iframe.feedback"){await n.onFeedback?.(o.payload);return}if(o.type==="iframe.storage"){He(o.payload);return}if(o.type==="iframe.persistence"){let i=await import("./persistence-YI6JSYCT.js").then(({executeAgentHostPersistence:d})=>d(n.agentId,o.payload));m("host.rpc-result",{value:i},o.requestId)}}catch(i){let d=ee(i,o.type==="iframe.auth-request"?"authenticating":"failed");n.onError?.(d),m("host.rpc-error",{error:d.message},o.requestId)}},K=o=>{o.composedPath().includes(s)||a.open&&(a.viewMode==="floating"||a.viewMode==="chat-bar")&&(n.appearance?.shouldCloseOnInteractOutside??!0)&&O(!1)},R=()=>{a={...a,bounds:null},Object.assign(s.style,v(a,n,window.innerWidth<640)),k(x,a,n,window.innerWidth<640)},_=()=>{document.visibilityState==="visible"&&(a={...a,bounds:null},Object.assign(s.style,v(a,n,window.innerWidth<640)),k(x,a,n,window.innerWidth<640),h&&a.mounted&&m("host.command",{name:"show"}),I!==null&&window.cancelAnimationFrame(I),I=window.requestAnimationFrame(()=>{I=null,Object.assign(s.style,v(a,n,window.innerWidth<640))}))};return window.addEventListener("message",j),window.addEventListener("pointerdown",K,!0),window.addEventListener("resize",R),window.addEventListener("pageshow",_),window.visualViewport?.addEventListener("resize",R),document.addEventListener("visibilitychange",_),{destroy:()=>{$=!0;for(let o of S.values())o.abort();S.clear(),window.removeEventListener("message",j),window.removeEventListener("pointerdown",K,!0),window.removeEventListener("resize",R),window.removeEventListener("pageshow",_),window.visualViewport?.removeEventListener("resize",R),document.removeEventListener("visibilitychange",_),I!==null&&window.cancelAnimationFrame(I);for(let o of f.values())window.clearTimeout(o.timer),o.reject(new Error("HeroUI Agent iframe was removed"));f.clear(),y.length=0,b.clear(),ie(x),s.remove()},hide:()=>O(!1),newConversation:o=>{h=!0,E("newConversation",{prompt:o})},preload:()=>E("preload"),get ready(){return a.ready},refreshAuth:()=>{M.clear(),E("refreshAuth")},show:()=>O(!0),shutdown:()=>{h=!1,A=!1,M.reset(),E("shutdown")},subscribe:o=>(b.add(o),()=>b.delete(o)),toggle:()=>O(!h),update:o=>{if(o.agentId!==n.agentId)throw new Error("HeroUI Agent agentId cannot change without remounting");o.getAuthToken!==n.getAuthToken&&(M=new P(o.agentId,o.getAuthToken)),n=o,Object.assign(s.style,v(a,n,window.innerWidth<640)),k(x,a,n,window.innerWidth<640),a.mounted&&B("host.update")}}}async function Ie(e,t,n,r,l){let c={conversationId:t.conversationId,idempotencyKey:t.idempotencyKey,signal:l,toolCallId:t.toolCallId,uploadDataSource:async f=>await r("host.upload-data-source",{toolCallId:t.toolCallId,upload:f})},g;try{g=G(e,t.args)}catch{return{code:"CLIENT_TOOL_INVALID_INPUT",error:`The arguments for ${e.name} do not match its declared schema. Correct the input and try again. No action was performed.`,success:!1}}let s=await e.execute(g,n.context??{},c)??null;return le(s,xe,`Client tool ${e.name} result`)}async function ke(e,t){let{context:n,getAuthToken:r,onError:l,onFeedback:c,onReady:g,onStatusChange:s,tools:f,...y}=e,T=await t(f??[]);return{localStorage:se(window.localStorage),props:JSON.parse(JSON.stringify(y)),sessionStorage:se(window.sessionStorage),tools:T}}function Se(e,t){let n=t.get(e.requestId);if(n)if(t.delete(e.requestId),window.clearTimeout(n.timer),e.type==="iframe.rpc-error"){let r=e.payload;n.reject(new Error(typeof r?.error=="string"?r.error:"Iframe request failed"))}else{let r=e.payload;n.resolve(r?.value)}}function Ee(e){if(!e||typeof e!="object")throw new Error("Invalid client tool request");let t=e;if(typeof t.conversationId!="string"||typeof t.idempotencyKey!="string"||typeof t.name!="string"||typeof t.toolCallId!="string")throw new Error("Invalid client tool request");return t}function le(e,t,n){if(!Z(e))throw new Error(`${n} must be JSON-serializable`);let r=JSON.stringify(e);if(new TextEncoder().encode(r).byteLength>t)throw new Error(`${n} exceeds ${Math.round(t/1024)} KiB`);return JSON.parse(r)}function se(e){let t={};try{for(let n=0;n<e.length;n+=1){let r=e.key(n);r?.startsWith("heroui-agent:")&&(t[r]=e.getItem(r)??"")}}catch{}return t}function He(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.key=="string"&&!t.key.startsWith("heroui-agent:"))return;let n=t.storage==="session"?sessionStorage:localStorage;try{if(t.operation==="set"&&typeof t.key=="string"&&typeof t.value=="string")n.setItem(t.key,t.value);else if(t.operation==="remove"&&typeof t.key=="string")n.removeItem(t.key);else if(t.operation==="clear")for(let r=n.length-1;r>=0;r-=1){let l=n.key(r);l?.startsWith("heroui-agent:")&&n.removeItem(l)}}catch{}}function Pe(e,t){return e.has(t)?!1:(e.add(t),e.size>2048&&e.delete(e.values().next().value),!0)}function Le(e,t){if(t){let n=new URL(t);if(n.protocol!=="http:"&&n.protocol!=="https:")throw new Error("HeroUI Agent embed origin must use HTTP or HTTPS");return n.origin}return/^https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?$/i.test(e)?"http://localhost:8793":e.includes("staging")?X:J}export{ge as a,U as b,ee as c,P as d,qe as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as i,k as a}from"./chunk-
|
|
1
|
+
import{b as i,k as a}from"./chunk-56CE4HMH.js";import{z as t}from"zod";var c=["readConversationHistory","callMcpTool","composeUI","executeSandbox","generateFile","getUIComponents","readSkill","renderComponent","renderDocument","searchKnowledge","searchMcpTools","searchWeb"],m="mcp_",p=20,l=16*1024,d=t.object({description:t.string().trim().min(1).max(1e3),inputSchema:t.record(t.string(),t.unknown()),name:t.string().regex(/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/).refine(e=>!c.includes(e)&&!e.toLowerCase().startsWith(m),"Client tool name is reserved by the HeroUI Agent runtime"),needsApproval:t.boolean().optional()}),f=t.array(d).max(p).superRefine((e,n)=>{let o=new Set;for(let r of e)o.has(r.name)&&n.addIssue({code:"custom",message:`Duplicate client tool name: ${r.name}`}),o.add(r.name);new TextEncoder().encode(JSON.stringify(e)).byteLength>l&&n.addIssue({code:"custom",message:"Client tool manifest exceeds 16KB"})});function u(e){let n=i(e.parameters)?t.toJSONSchema(e.parameters):e.parameters;if(!a(n))throw new Error(`Client tool ${e.name} parameters must be a JSON-serializable schema`);return s(n)}function s(e){return Array.isArray(e)?e.map(s):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([n,o])=>[n,s(o)])):e}function E(e){return f.parse(e.map(n=>({description:n.description,inputSchema:u(n),name:n.name,...n.needsApproval?{needsApproval:!0}:{}})))}export{c as a,m as b,p as c,l as d,d as e,f,E as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g}from"./chunk-XCWSE27G.js";import"./chunk-56CE4HMH.js";export{c as MAX_CLIENT_TOOLS,d as MAX_CLIENT_TOOLS_BYTES,a as RESERVED_AGENT_TOOL_NAMES,b as RESERVED_AGENT_TOOL_PREFIX,e as clientToolManifestEntrySchema,f as clientToolsSchema,g as serializeClientTools};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as HeroUIAgentProps, i as AgentController } from './types-
|
|
2
|
-
export { A as AgentApiOverrides, a as AgentAppearance, b as AgentAttachmentContentType, c as AgentAuthToken, d as AgentCapabilities, e as AgentColorScheme, f as AgentComponentExportFormat, g as AgentComposerOptions, h as AgentContext, j as AgentDataSource, k as AgentDataSourceFormat, l as AgentDesignTheme, m as AgentError, n as AgentFeedbackReason, o as AgentLauncherOptions, p as AgentLauncherPosition, q as AgentMarkdownAnimation, r as AgentMarkdownAnimationOptions, s as AgentMarkdownCaret, t as AgentMarkdownOptions, u as AgentMessageAction, v as AgentModelId, w as AgentPanelOptions, x as AgentPermissionMode, y as AgentPermissionOptions, z as AgentRadius, B as AgentResponseFeedback, C as AgentSharedContext, D as AgentShouldCloseOnInteractOutside, E as AgentStartScreenOptions, F as AgentStatus, G as AgentSurfaceVariant, H as AgentThemeColor, I as AgentThemeColors, J as AgentThemeOptions, K as AgentTypography, L as AgentViewMode, M as ClientTool, N as ClientToolExecutionContext, O as ClientToolIcon, P as ClientToolStatus, Q as DEFAULT_MARKDOWN_ANIMATION, R as GetAuthToken, S as GetAuthTokenContext, U as UploadAgentDataSourceInput, V as createToolHelper } from './types-
|
|
3
|
-
export { H as HEROUI_AGENT_API_BASE_URL, a as HEROUI_AGENT_SDK_VERSION } from './version-
|
|
1
|
+
import { T as HeroUIAgentProps, i as AgentController } from './types-BjpL8iWi.js';
|
|
2
|
+
export { A as AgentApiOverrides, a as AgentAppearance, b as AgentAttachmentContentType, c as AgentAuthToken, d as AgentCapabilities, e as AgentColorScheme, f as AgentComponentExportFormat, g as AgentComposerOptions, h as AgentContext, j as AgentDataSource, k as AgentDataSourceFormat, l as AgentDesignTheme, m as AgentError, n as AgentFeedbackReason, o as AgentLauncherOptions, p as AgentLauncherPosition, q as AgentMarkdownAnimation, r as AgentMarkdownAnimationOptions, s as AgentMarkdownCaret, t as AgentMarkdownOptions, u as AgentMessageAction, v as AgentModelId, w as AgentPanelOptions, x as AgentPermissionMode, y as AgentPermissionOptions, z as AgentRadius, B as AgentResponseFeedback, C as AgentSharedContext, D as AgentShouldCloseOnInteractOutside, E as AgentStartScreenOptions, F as AgentStatus, G as AgentSurfaceVariant, H as AgentThemeColor, I as AgentThemeColors, J as AgentThemeOptions, K as AgentTypography, L as AgentViewMode, M as ClientTool, N as ClientToolExecutionContext, O as ClientToolIcon, P as ClientToolStatus, Q as DEFAULT_MARKDOWN_ANIMATION, R as GetAuthToken, S as GetAuthTokenContext, U as UploadAgentDataSourceInput, V as createToolHelper } from './types-BjpL8iWi.js';
|
|
3
|
+
export { H as HEROUI_AGENT_API_BASE_URL, a as HEROUI_AGENT_SDK_VERSION } from './version-CResRC5Q.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
/** Imperative controls for the hosted iframe Agent. */
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as e}from"./chunk-
|
|
1
|
+
import{a as d,b as e}from"./chunk-DLEBKF27.js";import"./chunk-LZK3RRL5.js";import{a as f}from"./chunk-AR424OVX.js";import{a as b,b as c}from"./chunk-KE7HXMS3.js";import{a}from"./chunk-56CE4HMH.js";export{f as DEFAULT_MARKDOWN_ANIMATION,c as HEROUI_AGENT_API_BASE_URL,b as HEROUI_AGENT_SDK_VERSION,e as HeroUIAgent,a as createToolHelper,d as useAgent};
|
package/dist/internal/host.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as ClientToolIcon, U as UploadAgentDataSourceInput, B as AgentResponseFeedback, m as AgentError, F as AgentStatus, i as AgentController, T as HeroUIAgentProps, M as ClientTool, R as GetAuthToken } from '../types-
|
|
2
|
-
export { W as parseClientToolArgs, X as resolveDirectToolAction } from '../types-
|
|
1
|
+
import { L as AgentViewMode, O as ClientToolIcon, U as UploadAgentDataSourceInput, B as AgentResponseFeedback, m as AgentError, F as AgentStatus, i as AgentController, T as HeroUIAgentProps, M as ClientTool, R as GetAuthToken } from '../types-BjpL8iWi.js';
|
|
2
|
+
export { W as parseClientToolArgs, X as resolveDirectToolAction } from '../types-BjpL8iWi.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
type HostedFrameBounds = {
|
|
@@ -19,7 +19,7 @@ type HostedFrameState = {
|
|
|
19
19
|
ready: boolean;
|
|
20
20
|
resizing: boolean;
|
|
21
21
|
sidebarWidth: number | null;
|
|
22
|
-
viewMode:
|
|
22
|
+
viewMode: AgentViewMode;
|
|
23
23
|
};
|
|
24
24
|
type HostPageLayout = {
|
|
25
25
|
active: boolean;
|
package/dist/internal/host.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,b as t,c as a,d as l,e as n}from"../chunk-
|
|
1
|
+
import{a as r,b as t,c as a,d as l,e as n}from"../chunk-LZK3RRL5.js";import"../chunk-KE7HXMS3.js";import{c as o,d as e,e as m,f as p,g as s,h as i,i as f,j as x,k as g,l as A}from"../chunk-56CE4HMH.js";export{l as EmbedSessionManager,s as HEROUI_AGENT_BRIDGE_MAX_MESSAGE_BYTES,i as HEROUI_AGENT_BRIDGE_MAX_PERSISTENCE_BYTES,m as HEROUI_AGENT_HOSTED_ORIGIN,p as HEROUI_AGENT_HOSTED_STAGING_ORIGIN,r as abortable,f as createAgentBridgeEnvelope,a as createAgentError,A as estimateAgentBridgeMessageBytes,g as isAgentBridgeJsonValue,n as mountAgent,x as parseAgentBridgeEnvelope,o as parseClientToolArgs,e as resolveDirectToolAction,t as withDeadline};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { H as HEROUI_AGENT_API_BASE_URL, a as HEROUI_AGENT_SDK_VERSION } from '../version-
|
|
1
|
+
export { H as HEROUI_AGENT_API_BASE_URL, a as HEROUI_AGENT_SDK_VERSION } from '../version-CResRC5Q.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { M as ClientTool } from '../types-
|
|
4
|
-
export { Q as DEFAULT_MARKDOWN_ANIMATION } from '../types-
|
|
3
|
+
import { M as ClientTool } from '../types-BjpL8iWi.js';
|
|
4
|
+
export { Q as DEFAULT_MARKDOWN_ANIMATION } from '../types-BjpL8iWi.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
7
7
|
declare const agentIdentityIdSchema: z.ZodString;
|
package/dist/internal/shared.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"../chunk-AR424OVX.js";import{a,b as r}from"../chunk-
|
|
1
|
+
import{a as l}from"../chunk-AR424OVX.js";import{a,b as r}from"../chunk-KE7HXMS3.js";import{a as m,b as A,c as p,d as s,e as c,f as h,g as u}from"../chunk-XCWSE27G.js";import"../chunk-56CE4HMH.js";import{z as e}from"zod";var g=new Set(["[object object]","0","anonymous","distinct_id","distinctid","email","false","guest","id","nan","none","not_authenticated","null","true","undefined"]),t=e.string().trim().min(1).max(200).refine(i=>!g.has(i.toLowerCase()),{message:"Identity id is reserved"}),n=e.discriminatedUnion("type",[e.object({id:t,type:e.literal("anonymous")}),e.object({id:t,type:e.literal("user")})]),o=e.object({avatarUrl:e.string().trim().pipe(e.url()).optional(),email:e.string().trim().max(320).pipe(e.email()).optional(),name:e.string().trim().max(120).optional()}),T=e.object({anonymousId:t.optional(),identity:n,profile:o.optional()}),S=e.object({expiresAt:e.number().int().positive(),token:e.string().trim().min(1)});export{l as DEFAULT_MARKDOWN_ANIMATION,r as HEROUI_AGENT_API_BASE_URL,a as HEROUI_AGENT_SDK_VERSION,p as MAX_CLIENT_TOOLS,s as MAX_CLIENT_TOOLS_BYTES,m as RESERVED_AGENT_TOOL_NAMES,A as RESERVED_AGENT_TOOL_PREFIX,n as agentAuthIdentitySchema,o as agentAuthProfileSchema,S as agentAuthTokenSchema,t as agentIdentityIdSchema,c as clientToolManifestEntrySchema,h as clientToolsSchema,T as createAgentAuthTokenRequestSchema,u as serializeClientTools};
|
package/dist/next.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AgentApiOverrides, a as AgentAppearance, b as AgentAttachmentContentType, c as AgentAuthToken, d as AgentCapabilities, e as AgentColorScheme, f as AgentComponentExportFormat, g as AgentComposerOptions, h as AgentContext, i as AgentController, j as AgentDataSource, k as AgentDataSourceFormat, l as AgentDesignTheme, m as AgentError, n as AgentFeedbackReason, o as AgentLauncherOptions, p as AgentLauncherPosition, q as AgentMarkdownAnimation, r as AgentMarkdownAnimationOptions, s as AgentMarkdownCaret, t as AgentMarkdownOptions, u as AgentMessageAction, v as AgentModelId, w as AgentPanelOptions, x as AgentPermissionMode, y as AgentPermissionOptions, z as AgentRadius, B as AgentResponseFeedback, C as AgentSharedContext, D as AgentShouldCloseOnInteractOutside, E as AgentStartScreenOptions, F as AgentStatus, G as AgentSurfaceVariant, H as AgentThemeColor, I as AgentThemeColors, J as AgentThemeOptions, K as AgentTypography, L as AgentViewMode, M as ClientTool, N as ClientToolExecutionContext, O as ClientToolIcon, P as ClientToolStatus, Q as DEFAULT_MARKDOWN_ANIMATION, R as GetAuthToken, S as GetAuthTokenContext, T as HeroUIAgentProps, U as UploadAgentDataSourceInput, V as createToolHelper } from './types-
|
|
1
|
+
export { A as AgentApiOverrides, a as AgentAppearance, b as AgentAttachmentContentType, c as AgentAuthToken, d as AgentCapabilities, e as AgentColorScheme, f as AgentComponentExportFormat, g as AgentComposerOptions, h as AgentContext, i as AgentController, j as AgentDataSource, k as AgentDataSourceFormat, l as AgentDesignTheme, m as AgentError, n as AgentFeedbackReason, o as AgentLauncherOptions, p as AgentLauncherPosition, q as AgentMarkdownAnimation, r as AgentMarkdownAnimationOptions, s as AgentMarkdownCaret, t as AgentMarkdownOptions, u as AgentMessageAction, v as AgentModelId, w as AgentPanelOptions, x as AgentPermissionMode, y as AgentPermissionOptions, z as AgentRadius, B as AgentResponseFeedback, C as AgentSharedContext, D as AgentShouldCloseOnInteractOutside, E as AgentStartScreenOptions, F as AgentStatus, G as AgentSurfaceVariant, H as AgentThemeColor, I as AgentThemeColors, J as AgentThemeOptions, K as AgentTypography, L as AgentViewMode, M as ClientTool, N as ClientToolExecutionContext, O as ClientToolIcon, P as ClientToolStatus, Q as DEFAULT_MARKDOWN_ANIMATION, R as GetAuthToken, S as GetAuthTokenContext, T as HeroUIAgentProps, U as UploadAgentDataSourceInput, V as createToolHelper } from './types-BjpL8iWi.js';
|
|
2
2
|
export { HeroUIAgent, useAgent } from './index.js';
|
|
3
|
-
export { H as HEROUI_AGENT_API_BASE_URL, a as HEROUI_AGENT_SDK_VERSION } from './version-
|
|
3
|
+
export { H as HEROUI_AGENT_API_BASE_URL, a as HEROUI_AGENT_SDK_VERSION } from './version-CResRC5Q.js';
|
|
4
4
|
import 'react';
|
package/dist/next.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f,b as m}from"./chunk-
|
|
1
|
+
import{a as f,b as m}from"./chunk-DLEBKF27.js";import"./chunk-LZK3RRL5.js";import{a as p}from"./chunk-AR424OVX.js";import{a as r,b as e}from"./chunk-KE7HXMS3.js";import{a as o}from"./chunk-56CE4HMH.js";export{p as DEFAULT_MARKDOWN_ANIMATION,e as HEROUI_AGENT_API_BASE_URL,r as HEROUI_AGENT_SDK_VERSION,m as HeroUIAgent,o as createToolHelper,f as useAgent};
|
|
@@ -196,7 +196,7 @@ type AgentContext = Record<string, unknown>;
|
|
|
196
196
|
type AgentSharedContext = {
|
|
197
197
|
page?: () => AgentContext | Promise<AgentContext>;
|
|
198
198
|
} & Record<string, unknown>;
|
|
199
|
-
type AgentViewMode = "floating" | "sidebar";
|
|
199
|
+
type AgentViewMode = "chat-bar" | "floating" | "sidebar";
|
|
200
200
|
type AgentSurfaceVariant = "outline" | "plain" | "surface" | "surface-secondary";
|
|
201
201
|
/**
|
|
202
202
|
* Controls whether an outside interaction closes the floating panel. Matches React
|
|
@@ -309,8 +309,9 @@ type AgentPermissionOptions = {
|
|
|
309
309
|
};
|
|
310
310
|
/**
|
|
311
311
|
* Size and expansion of the chat panel. In `floating` mode expansion grows the
|
|
312
|
-
* card; in `sidebar` mode it temporarily fills the viewport.
|
|
313
|
-
*
|
|
312
|
+
* card; in `sidebar` mode it temporarily fills the viewport. `chat-bar` owns a
|
|
313
|
+
* responsive bottom-centered size. Initial dimensions are ignored in
|
|
314
|
+
* `sidebar` and `chat-bar` modes and below the mobile breakpoint.
|
|
314
315
|
*/
|
|
315
316
|
type AgentPanelOptions = {
|
|
316
317
|
/**
|
|
@@ -347,10 +348,9 @@ type AgentAppearance = {
|
|
|
347
348
|
/** Size and expansion of the floating panel. */
|
|
348
349
|
panel?: AgentPanelOptions;
|
|
349
350
|
/**
|
|
350
|
-
* When the visitor interacts outside the floating panel
|
|
351
|
-
*
|
|
352
|
-
* `false`
|
|
353
|
-
* button are unchanged.
|
|
351
|
+
* When the visitor interacts outside the floating panel or expanded Chat
|
|
352
|
+
* Bar, whether to close or collapse it. `true` or omitted always closes;
|
|
353
|
+
* `false` keeps it open. Escape and the header action are unchanged.
|
|
354
354
|
*/
|
|
355
355
|
shouldCloseOnInteractOutside?: AgentShouldCloseOnInteractOutside;
|
|
356
356
|
/** Surface treatment for charts, tables, maps, and other primary data surfaces. */
|
|
@@ -358,7 +358,8 @@ type AgentAppearance = {
|
|
|
358
358
|
theme?: AgentThemeOptions;
|
|
359
359
|
/**
|
|
360
360
|
* How the chat opens: `"floating"` (default) is a floating rounded panel in
|
|
361
|
-
* the corner; `"sidebar"` docks full-height to the right edge
|
|
361
|
+
* the corner; `"sidebar"` docks full-height to the right edge; `"chat-bar"`
|
|
362
|
+
* keeps a compact composer centered near the bottom and expands it in place.
|
|
362
363
|
*/
|
|
363
364
|
viewMode?: AgentViewMode;
|
|
364
365
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const HEROUI_AGENT_SDK_VERSION: "1.0.0-beta.
|
|
1
|
+
declare const HEROUI_AGENT_SDK_VERSION: "1.0.0-beta.9";
|
|
2
2
|
/** Production Agent API origin used when hosts omit `_api.baseUrl` / `apiBaseUrl`. */
|
|
3
3
|
declare const HEROUI_AGENT_API_BASE_URL: "https://api.heroui.pro";
|
|
4
4
|
|
package/package.json
CHANGED
package/dist/chunk-2W6CUSN3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t="1.0.0-beta.8",o="https://api.heroui.pro";export{t as a,o as b};
|
package/dist/chunk-KMVOOEIK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as J}from"./chunk-2W6CUSN3.js";import{c as G,e as V,f as X,i as Y,j as Q,k as Z}from"./chunk-YPHOJDYK.js";function ge(e,t){return e.throwIfAborted(),new Promise((n,r)=>{let l=()=>r(e.reason);e.addEventListener("abort",l,{once:!0});try{t().then(n,r).finally(()=>e.removeEventListener("abort",l))}catch(c){e.removeEventListener("abort",l),r(c)}})}async function U(e,t,n){let r=new AbortController,l=setTimeout(()=>r.abort(new DOMException("Request timed out","TimeoutError")),e),c=n?AbortSignal.any([n,r.signal]):r.signal;try{return await ge(c,()=>t(c))}finally{clearTimeout(l)}}var fe={approval:"This approval has expired. Ask the agent to request it again.",authentication:"Could not authenticate. Sign in if needed, then retry.",chunk:"Could not load the conversation. Retry, or reload the panel.",configuration:"Could not load the agent configuration. Try again.",connection:"Connection interrupted. Completed page changes remain applied. Reconnect to continue this chat.",credits:"This agent has reached its usage limit.",deleted:"This conversation was deleted. Start a new conversation.",rate_limit:"Too many requests. Wait a moment before retrying.",unknown:"The request could not be completed. Try again."},me="Too many conversations are active. Wait a few minutes, then retry this chat.";function ee(e,t="connecting"){let n=e&&typeof e=="object"?e:{},r=[e instanceof Error?e.message:"",n.code,n.status].filter(c=>typeof c=="string"||typeof c=="number").join(" ").toLowerCase(),l=t==="authenticating"||/auth|401|sign.in/.test(r)?"authentication":/429|rate.limit|concurrency_limit|too many conversations are active/.test(r)?"rate_limit":/credit|usage.limit|usage_limit|402/.test(r)?"credits":/deleted|conversation_not_found/.test(r)?"deleted":/approval.*expir/.test(r)?"approval":/dynamic.*import|chunk|module.*fetch/.test(r)?"chunk":/config/.test(r)?"configuration":/network|fetch|connect|timeout|timed out/.test(r)?"connection":"unknown";return{category:l,diagnosticId:crypto.randomUUID(),message:/concurrency_limit|too many conversations are active/.test(r)?me:fe[l],phase:t,retryable:!["credits","deleted","approval"].includes(l)}}var he=5e3;function te(e){return`heroui-agent:anonymous:${e}`}function ye(e){return e instanceof Error?e:new Error("Auth token request failed")}var P=class{constructor(t,n){this.agentId=t;this.getAuthToken=n}cached=null;failure=null;generation=0;pending=null;controller=new AbortController;clear(){this.controller.abort(),this.controller=new AbortController,this.generation+=1,this.cached=null,this.failure=null,this.pending=null}reset(){this.clear();try{localStorage.removeItem(te(this.agentId))}catch{}}async get(){if(this.cached&&this.expiresAt(this.cached)>Date.now()+6e4)return this.cached.token;if(!this.pending&&this.failure&&Date.now()<this.failure.retryAt)throw this.failure.error;let t=this.generation,n=this.pending??this.refresh();this.pending||(this.pending=n);try{let r=await n;return t!==this.generation?this.get():(this.cached=r,this.failure=null,r.token)}catch(r){throw t===this.generation&&(this.failure={error:ye(r),retryAt:Date.now()+he}),r}finally{this.pending===n&&(this.pending=null)}}async subjectHash(){let t=await this.get(),n=we(t),r=typeof n.sub=="string"?n.sub:"anonymous",l=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`${this.agentId}:${r}`));return Array.from(new Uint8Array(l),c=>c.toString(16).padStart(2,"0")).join("").slice(0,24)}anonymousId(){let t=te(this.agentId);try{let n=localStorage.getItem(t);if(n)return n;let r=crypto.randomUUID();return localStorage.setItem(t,r),r}catch{return crypto.randomUUID()}}expiresAt(t){return t.expiresAt}async refresh(){let t=await U(15e3,n=>this.getAuthToken({agentId:this.agentId,anonymousId:this.anonymousId(),signal:n}),this.controller.signal);if(!t||typeof t.token!="string"||!t.token.trim()||typeof t.expiresAt!="number"||!Number.isFinite(t.expiresAt)||t.expiresAt<=0)throw new Error("Auth token callback returned invalid data");return{expiresAt:t.expiresAt,token:t.token}}};function we(e){try{let t=e.split(".")[1];if(!t)return{};let n=t.replace(/-/g,"+").replace(/_/g,"/"),r=n.padEnd(Math.ceil(n.length/4)*4,"=");return JSON.parse(atob(r))}catch{return{}}}function ne(e){return{bounds:null,closing:!1,dragging:!1,expanded:e.appearance?.panel?.expanded??!1,mounted:!1,open:!1,overlayOpen:!1,ready:!1,resizing:!1,sidebarWidth:null,viewMode:e.appearance?.viewMode??"floating"}}function w(e,t,n){return{background:"transparent",border:"0",clipPath:be(e,t,n),colorScheme:"normal",height:"100dvh",inset:"0",position:"fixed",width:"100vw",zIndex:t.appearance?.zIndex??40}}function oe(e){if(!e||typeof e!="object")return null;let t=e;return typeof t.open!="boolean"||typeof t.ready!="boolean"||typeof t.expanded!="boolean"||t.viewMode!=="floating"&&t.viewMode!=="sidebar"?null:{bounds:ve(t.bounds),closing:t.closing===!0,dragging:t.dragging===!0,expanded:t.expanded,mounted:t.mounted!==!1,open:t.open,overlayOpen:t.overlayOpen===!0,ready:t.ready,resizing:t.resizing===!0,sidebarWidth:L(t.sidebarWidth)?t.sidebarWidth:null,viewMode:t.viewMode}}function re(){let e=document.documentElement,t=document.body;return{active:!1,body:t,original:{bodyLeft:t.style.left,bodyOverflow:t.style.overflow,bodyPosition:t.style.position,bodyRight:t.style.right,bodyTop:t.style.top,bodyWidth:t.style.width,rootMarginRight:e.style.marginRight,rootOverflow:e.style.overflow,rootTransition:e.style.transition},root:e,scrollLock:null}}function x(e,t,n,r){let l=t.open||t.closing;if(!l&&!e.active)return;l&&(e.active=!0);let c=l&&(r||t.viewMode==="sidebar"&&t.expanded);se(e,c);let a=l&&t.viewMode==="sidebar"&&!t.expanded&&!r?Ae(t,n):e.original.rootMarginRight;e.root.style.transition=e.original.rootTransition,e.root.style.marginRight=a,l||(e.active=!1)}function ie(e){se(e,!1),e.root.style.marginRight=e.original.rootMarginRight,e.root.style.transition=e.original.rootTransition,e.active=!1}function be(e,t,n){let r=e.open||e.closing;if(r&&(n||e.overlayOpen))return"inset(0px)";if(e.bounds)return`inset(${e.bounds.top}px calc(100% - ${e.bounds.right}px) calc(100% - ${e.bounds.bottom}px) ${e.bounds.left}px)`;let l=t.appearance?.launcher,c=l?.position==="bottom-left",g=(l?.offset?.x??24)+60,a=(l?.offset?.y??24)+60;if(!r)return c?`inset(calc(100% - ${a}px) calc(100% - ${g}px) 0px 0px)`:`inset(calc(100% - ${a}px) 0px 0px calc(100% - ${g}px))`;if(e.viewMode==="sidebar")return`inset(0px 0px 0px calc(100% - (${F(t.appearance?.panel?.initialWidth??420)} + 16px)))`;let f=F(t.appearance?.panel?.initialWidth??440),v=`calc(100% - min(calc(${F(t.appearance?.panel?.initialHeight??"max(420px, 56dvh)")} + 32px), 100dvh))`;return c?`inset(${v} calc(100% - min(calc(${f} + 32px), 100vw)) 0px 0px)`:`inset(${v} 0px 0px calc(100% - min(calc(${f} + 32px), 100vw)))`}function ve(e){if(!e||typeof e!="object")return null;let t=e;return!L(t.top)||!L(t.right)||!L(t.bottom)||!L(t.left)||t.right<t.left||t.bottom<t.top?null:{bottom:t.bottom,left:t.left,right:t.right,top:t.top}}function L(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1e5}function Ae(e,t){return e.sidebarWidth===null?F(t.appearance?.panel?.initialWidth??420):`${Math.round(e.sidebarWidth)}px`}function F(e){return typeof e=="number"?`${Math.round(e)}px`:e}function se(e,t){if(t&&!e.scrollLock){e.scrollLock={x:window.scrollX,y:window.scrollY},e.root.style.overflow="hidden",e.body.style.overflow="hidden",e.body.style.position="fixed",e.body.style.top=`${-e.scrollLock.y}px`,e.body.style.left=`${-e.scrollLock.x}px`,e.body.style.right="0",e.body.style.width="100%";return}if(!t&&e.scrollLock){let{x:n,y:r}=e.scrollLock;e.root.style.overflow=e.original.rootOverflow,e.body.style.overflow=e.original.bodyOverflow,e.body.style.position=e.original.bodyPosition,e.body.style.top=e.original.bodyTop,e.body.style.left=e.original.bodyLeft,e.body.style.right=e.original.bodyRight,e.body.style.width=e.original.bodyWidth,e.scrollLock=null;try{window.scrollTo(n,r)}catch{}}}var Te=16*1024,Ie=64*1024;function qe(e,t){let n=e;if(!n?.agentId||typeof n.getAuthToken!="function")throw new Error("HeroUIAgent.mount requires agentId and getAuthToken");let r=crypto.randomUUID(),l=crypto.randomUUID(),c=(n._api?.baseUrl??J).replace(/\/$/,""),g=Le(c,n._api?.embedOrigin),a=document.createElement("iframe"),f=new Map,y=[],v=new Set,A=new Map,k=new Set,T=re(),C=new P(n.agentId,n.getAuthToken),s=ne(n),O=null,h=!1,b=!1,I=null,W=!1,$=!1,N=new URL("/embed",g);N.searchParams.set("agentId",n.agentId),N.hash=new URLSearchParams({nonce:l,parentOrigin:window.location.origin,sessionId:r}).toString(),a.allow="microphone; clipboard-write",a.referrerPolicy="origin",a.setAttribute("sandbox","allow-downloads allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"),a.src=N.toString(),a.title="HeroUI Agent",Object.assign(a.style,w(s,n,window.innerWidth<640)),document.body.append(a);let m=(o,i,d)=>{$||a.contentWindow?.postMessage(Y(r,l,o,i,d),g)},de=(o,i)=>{let d=crypto.randomUUID();return new Promise((p,u)=>{let H=window.setTimeout(()=>{f.delete(d),u(new Error(`HeroUI Agent iframe request timed out: ${o}`))},3e4);f.set(d,{reject:u,resolve:p,timer:H}),m(o,i,d)})},S=new Map,q=0,z="",B=async(o,i=!1)=>{let d=++q,p=await ke(n,t);if($||d!==q)return;let u=JSON.stringify({props:p.props,tools:p.tools});!i&&u===z||(z=u,m(o,{...p,restoreSession:o==="host.init"&&b}))},E=(o,i)=>{if(!s.mounted){y.push({name:o,payload:i}),y.length>32&&y.shift();return}m("host.command",{name:o,payload:i})},M=o=>{o&&!h&&document.activeElement!==a&&(O=document.activeElement),h=o,o||(b=!1),E(o?"show":"hide")},ce=()=>{if(s.mounted)for(let o of y.splice(0))m("host.command",o)},ue=()=>{b=s.mounted&&h&&!s.closing,s={...s,bounds:null,closing:!1,mounted:!1,open:b,ready:!1},W=!1;for(let o of k)o();Object.assign(a.style,w(s,n,window.innerWidth<640)),x(T,s,n,window.innerWidth<640)},j=o=>{if(o.origin!==g||o.source!==a.contentWindow)return;let i=Q(o.data);if(!(!i||i.sessionId!==r||i.nonce!==l)){if(i.type==="iframe.rpc-result"||i.type==="iframe.rpc-error"){Se(i,f);return}Pe(v,i.requestId)&&pe(i)}},pe=async o=>{try{if(o.type==="iframe.ready"){(s.mounted||s.ready)&&ue(),await B("host.init",!0);return}if(o.type==="iframe.reload"){let i=a.cloneNode(!1),d=new URL(a.src);d.pathname=`/reload/${crypto.randomUUID()}/embed`,i.src=d.href,a.replaceWith(i),a=i;return}if(o.type==="iframe.state"){let i=oe(o.payload);if(i){let d=s.mounted,p=s.open||s.closing,u=i;b?i.mounted?(b=!1,i.open||(m("host.command",{name:"show"}),u={...i,bounds:null,closing:!1,open:!0,sidebarWidth:i.sidebarWidth??s.sidebarWidth})):u={...i,bounds:null,closing:!1,open:!0,sidebarWidth:i.sidebarWidth??s.sidebarWidth}:i.open?h=!0:(i.closing||s.open||s.closing)&&(h=!1);let H=u.open||u.closing;if(H&&!p&&document.activeElement!==a&&(O=document.activeElement),!H&&p&&O?.isConnected){let D=O;window.requestAnimationFrame(()=>window.requestAnimationFrame(()=>D.focus({preventScroll:!0})))}s=u,s.mounted&&!d&&B("host.update"),H&&s.expanded?a.dataset.expanded="true":a.removeAttribute("data-expanded");for(let D of k)D();Object.assign(a.style,w(s,n,window.innerWidth<640)),x(T,s,n,window.innerWidth<640),ce(),s.ready&&!W&&(W=!0,n.onReady?.())}return}if(o.type==="iframe.error"){n.onError?.(o.payload);return}if(o.type==="iframe.status"){n.onStatusChange?.(o.payload);return}if(o.type==="iframe.tool-cancel"){let i=o.payload;i.idempotencyKey&&S.get(i.idempotencyKey)?.abort();return}if(o.type==="iframe.auth-request"){let i=await C.get(),d=await U(15e3,p=>fetch(`${c}/v1/agents/${encodeURIComponent(n.agentId)}/embed-sessions`,{body:JSON.stringify({iframeOrigin:g,sessionId:r}),cache:"no-store",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},method:"POST",signal:p}));if(!d.ok)throw new Error("Could not authenticate HeroUI Agent");m("host.rpc-result",{value:await d.json()},o.requestId);return}if(o.type==="iframe.context-request"){let i=le(await n.context?.page?.()??{},Te,"Agent page context");m("host.rpc-result",{value:i},o.requestId);return}if(o.type==="iframe.tool-execute"){let i=Ee(o.payload),d=n.tools?.find(u=>u.name===i.name);if(!d)throw new Error(`Unknown client tool: ${i.name}`);let p=A.get(i.idempotencyKey);if(!p){let u=new AbortController;S.set(i.idempotencyKey,u),p=xe(d,i,n,de,u.signal).finally(()=>S.delete(i.idempotencyKey)),A.set(i.idempotencyKey,p),A.size>2048&&A.delete(A.keys().next().value)}m("host.rpc-result",{value:await p},o.requestId);return}if(o.type==="iframe.feedback"){await n.onFeedback?.(o.payload);return}if(o.type==="iframe.storage"){He(o.payload);return}if(o.type==="iframe.persistence"){let i=await import("./persistence-YI6JSYCT.js").then(({executeAgentHostPersistence:d})=>d(n.agentId,o.payload));m("host.rpc-result",{value:i},o.requestId)}}catch(i){let d=ee(i,o.type==="iframe.auth-request"?"authenticating":"failed");n.onError?.(d),m("host.rpc-error",{error:d.message},o.requestId)}},K=o=>{o.composedPath().includes(a)||s.open&&s.viewMode==="floating"&&(n.appearance?.shouldCloseOnInteractOutside??!0)&&M(!1)},R=()=>{s={...s,bounds:null},Object.assign(a.style,w(s,n,window.innerWidth<640)),x(T,s,n,window.innerWidth<640)},_=()=>{document.visibilityState==="visible"&&(s={...s,bounds:null},Object.assign(a.style,w(s,n,window.innerWidth<640)),x(T,s,n,window.innerWidth<640),h&&s.mounted&&m("host.command",{name:"show"}),I!==null&&window.cancelAnimationFrame(I),I=window.requestAnimationFrame(()=>{I=null,Object.assign(a.style,w(s,n,window.innerWidth<640))}))};return window.addEventListener("message",j),window.addEventListener("pointerdown",K,!0),window.addEventListener("resize",R),window.addEventListener("pageshow",_),window.visualViewport?.addEventListener("resize",R),document.addEventListener("visibilitychange",_),{destroy:()=>{$=!0;for(let o of S.values())o.abort();S.clear(),window.removeEventListener("message",j),window.removeEventListener("pointerdown",K,!0),window.removeEventListener("resize",R),window.removeEventListener("pageshow",_),window.visualViewport?.removeEventListener("resize",R),document.removeEventListener("visibilitychange",_),I!==null&&window.cancelAnimationFrame(I);for(let o of f.values())window.clearTimeout(o.timer),o.reject(new Error("HeroUI Agent iframe was removed"));f.clear(),y.length=0,k.clear(),ie(T),a.remove()},hide:()=>M(!1),newConversation:o=>{h=!0,E("newConversation",{prompt:o})},preload:()=>E("preload"),get ready(){return s.ready},refreshAuth:()=>{C.clear(),E("refreshAuth")},show:()=>M(!0),shutdown:()=>{h=!1,b=!1,C.reset(),E("shutdown")},subscribe:o=>(k.add(o),()=>k.delete(o)),toggle:()=>M(!h),update:o=>{if(o.agentId!==n.agentId)throw new Error("HeroUI Agent agentId cannot change without remounting");o.getAuthToken!==n.getAuthToken&&(C=new P(o.agentId,o.getAuthToken)),n=o,Object.assign(a.style,w(s,n,window.innerWidth<640)),x(T,s,n,window.innerWidth<640),s.mounted&&B("host.update")}}}async function xe(e,t,n,r,l){let c={conversationId:t.conversationId,idempotencyKey:t.idempotencyKey,signal:l,toolCallId:t.toolCallId,uploadDataSource:async f=>await r("host.upload-data-source",{toolCallId:t.toolCallId,upload:f})},g;try{g=G(e,t.args)}catch{return{code:"CLIENT_TOOL_INVALID_INPUT",error:`The arguments for ${e.name} do not match its declared schema. Correct the input and try again. No action was performed.`,success:!1}}let a=await e.execute(g,n.context??{},c)??null;return le(a,Ie,`Client tool ${e.name} result`)}async function ke(e,t){let{context:n,getAuthToken:r,onError:l,onFeedback:c,onReady:g,onStatusChange:a,tools:f,...y}=e,v=await t(f??[]);return{localStorage:ae(window.localStorage),props:JSON.parse(JSON.stringify(y)),sessionStorage:ae(window.sessionStorage),tools:v}}function Se(e,t){let n=t.get(e.requestId);if(n)if(t.delete(e.requestId),window.clearTimeout(n.timer),e.type==="iframe.rpc-error"){let r=e.payload;n.reject(new Error(typeof r?.error=="string"?r.error:"Iframe request failed"))}else{let r=e.payload;n.resolve(r?.value)}}function Ee(e){if(!e||typeof e!="object")throw new Error("Invalid client tool request");let t=e;if(typeof t.conversationId!="string"||typeof t.idempotencyKey!="string"||typeof t.name!="string"||typeof t.toolCallId!="string")throw new Error("Invalid client tool request");return t}function le(e,t,n){if(!Z(e))throw new Error(`${n} must be JSON-serializable`);let r=JSON.stringify(e);if(new TextEncoder().encode(r).byteLength>t)throw new Error(`${n} exceeds ${Math.round(t/1024)} KiB`);return JSON.parse(r)}function ae(e){let t={};try{for(let n=0;n<e.length;n+=1){let r=e.key(n);r?.startsWith("heroui-agent:")&&(t[r]=e.getItem(r)??"")}}catch{}return t}function He(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.key=="string"&&!t.key.startsWith("heroui-agent:"))return;let n=t.storage==="session"?sessionStorage:localStorage;try{if(t.operation==="set"&&typeof t.key=="string"&&typeof t.value=="string")n.setItem(t.key,t.value);else if(t.operation==="remove"&&typeof t.key=="string")n.removeItem(t.key);else if(t.operation==="clear")for(let r=n.length-1;r>=0;r-=1){let l=n.key(r);l?.startsWith("heroui-agent:")&&n.removeItem(l)}}catch{}}function Pe(e,t){return e.has(t)?!1:(e.add(t),e.size>2048&&e.delete(e.values().next().value),!0)}function Le(e,t){if(t){let n=new URL(t);if(n.protocol!=="http:"&&n.protocol!=="https:")throw new Error("HeroUI Agent embed origin must use HTTP or HTTPS");return n.origin}return/^https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?$/i.test(e)?"http://localhost:8793":e.includes("staging")?X:V}export{ge as a,U as b,ee as c,P as d,qe as e};
|