@useago/sdk 1.12.0 → 1.13.0
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/CHANGELOG.md +71 -4
- package/README.md +73 -0
- package/dist/angular.cjs +1 -1
- package/dist/angular.d.cts +97 -28
- package/dist/angular.d.ts +97 -28
- package/dist/angular.js +4 -1
- package/dist/{createConversationSession-B1Qn-y0I.js → createConversationSession-BfJg0WyA.js} +1 -1
- package/dist/{createConversationSession-B3v_xOU7.cjs → createConversationSession-CiOXKWl0.cjs} +1 -1
- package/dist/{createFormCollector-m79zk_NA.js → createFormCollector-DN1xjAv5.js} +1 -1
- package/dist/{createFormCollector-FvwDOqnV.cjs → createFormCollector-DnQl77Ko.cjs} +1 -1
- package/dist/createMockClient-BPt1gSve.cjs +1 -0
- package/dist/{createMockClient-Beao82tu.js → createMockClient-YoYr3pQr.js} +1 -0
- package/dist/devtools.cjs +4 -4
- package/dist/devtools.d.cts +95 -28
- package/dist/devtools.d.ts +95 -28
- package/dist/devtools.js +87 -84
- package/dist/helpers.d.cts +42 -12
- package/dist/helpers.d.ts +42 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +101 -35
- package/dist/index.d.ts +101 -35
- package/dist/index.js +44 -43
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +147 -28
- package/dist/react.d.ts +147 -28
- package/dist/react.js +814 -727
- package/dist/speechToText-BV7qxqPF.js +704 -0
- package/dist/speechToText-ZciRyyJE.cjs +1 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.cts +95 -28
- package/dist/testing.d.ts +95 -28
- package/dist/testing.js +1 -1
- package/dist/{types-Ct1hlKwg.js → types-Q7t1peH-.js} +595 -419
- package/dist/types-a7teDBnC.cjs +10 -0
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +105 -28
- package/dist/vue.d.ts +105 -28
- package/dist/vue.js +103 -101
- package/dist/widget.cjs +6 -6
- package/dist/widget.d.cts +127 -28
- package/dist/widget.d.ts +127 -28
- package/dist/widget.js +1717 -1772
- package/llms-full.txt +129 -1
- package/package.json +1 -1
- package/dist/createMockClient-BEOXI8yW.cjs +0 -1
- package/dist/sheetController-BThJRtOu.cjs +0 -1
- package/dist/sheetController-aEKXIvjk.js +0 -343
- package/dist/types-mcW8vB1U.cjs +0 -10
package/llms-full.txt
CHANGED
|
@@ -1767,6 +1767,74 @@ user declined, then lets the turn resume. This is a no-op in placeholder mode
|
|
|
1767
1767
|
In React, `useAgoActivity` surfaces awaiting items with ready-made `approve` /
|
|
1768
1768
|
`reject` controls (see the [React guide](../frameworks/react.md)).
|
|
1769
1769
|
|
|
1770
|
+
### WebMCP bridge (share your functions with browser agents)
|
|
1771
|
+
|
|
1772
|
+
[WebMCP](https://github.com/webmachinelearning/webmcp) is a browser API that lets
|
|
1773
|
+
a page hand tools to whatever agent the user brings, such as an agentic browser
|
|
1774
|
+
or an extension. Set `webmcp` and every function you register becomes a WebMCP
|
|
1775
|
+
tool as well.
|
|
1776
|
+
|
|
1777
|
+
```ts
|
|
1778
|
+
const client = new AgoClient({
|
|
1779
|
+
baseUrl: "https://playground.api.useago.com",
|
|
1780
|
+
agent: "your-agent",
|
|
1781
|
+
webmcp: true,
|
|
1782
|
+
});
|
|
1783
|
+
|
|
1784
|
+
client.registerFunction({
|
|
1785
|
+
name: "listFlights",
|
|
1786
|
+
description: "The flights currently on screen, after filtering.",
|
|
1787
|
+
parameters: { type: "object", properties: {} },
|
|
1788
|
+
handler: () => visibleFlights(),
|
|
1789
|
+
// Optional, WebMCP only: MCP behavior hints.
|
|
1790
|
+
webmcp: { annotations: { readOnlyHint: true } },
|
|
1791
|
+
});
|
|
1792
|
+
```
|
|
1793
|
+
|
|
1794
|
+
In React it is a prop:
|
|
1795
|
+
|
|
1796
|
+
```tsx
|
|
1797
|
+
<AgoProvider baseUrl="https://playground.api.useago.com" agent="your-agent" webmcp>
|
|
1798
|
+
<App />
|
|
1799
|
+
</AgoProvider>
|
|
1800
|
+
```
|
|
1801
|
+
|
|
1802
|
+
A function a page registers on mount disappears from the browser's tool list
|
|
1803
|
+
when that page unmounts. That is a problem for navigation: the handler returns
|
|
1804
|
+
before the destination page has mounted, so the caller would read the tools of
|
|
1805
|
+
the page it just left. Mark the function and the SDK holds the call open until
|
|
1806
|
+
the destination has registered:
|
|
1807
|
+
|
|
1808
|
+
```ts
|
|
1809
|
+
client.registerFunction({
|
|
1810
|
+
name: "openOrder",
|
|
1811
|
+
description: "Open one order's detail page.",
|
|
1812
|
+
parameters: { type: "object", properties: { id: { type: "string" } } },
|
|
1813
|
+
handler: (args) => navigate(`/orders/${args.id}`),
|
|
1814
|
+
webmcp: { navigates: true },
|
|
1815
|
+
});
|
|
1816
|
+
```
|
|
1817
|
+
|
|
1818
|
+
The built-in `navigateToPage` already carries it, so
|
|
1819
|
+
[`registerNavigationFunction`](#navigation-shortcut) and `useAgoNavigation` need
|
|
1820
|
+
no change. The call resolves 150 ms after the last registration, 600 ms if the
|
|
1821
|
+
destination registers nothing, and gives up after 4 seconds.
|
|
1822
|
+
|
|
1823
|
+
Check what is exposed from the console:
|
|
1824
|
+
|
|
1825
|
+
```js
|
|
1826
|
+
(await document.modelContext.getTools()).map((t) => t.name);
|
|
1827
|
+
```
|
|
1828
|
+
|
|
1829
|
+
Off by default, and a no-op in browsers without WebMCP. Calls arrive as
|
|
1830
|
+
`function:invoke` and `function:result` like any other, so your logging and the
|
|
1831
|
+
dev panel already cover them.
|
|
1832
|
+
|
|
1833
|
+
**There is no approval gate on a WebMCP call**, and cancelling one does not stop
|
|
1834
|
+
your handler. `requiresApproval` and `approvalPolicy` hold a call in the agent
|
|
1835
|
+
loop, which a WebMCP call never enters. Set `webmcp: false` on a definition to
|
|
1836
|
+
keep that function private to your own agent.
|
|
1837
|
+
|
|
1770
1838
|
---
|
|
1771
1839
|
|
|
1772
1840
|
## Pre-built helpers
|
|
@@ -2235,6 +2303,7 @@ interface AgoConfig {
|
|
|
2235
2303
|
agent?: string; // default agent (id or slug) for new conversations
|
|
2236
2304
|
defaultAgentId?: string; // same as `agent`; `agent` is preferred
|
|
2237
2305
|
permission?: string; // X-Widget-Permission header
|
|
2306
|
+
language?: string | null; // Host interface locale, sent as Accept-Language
|
|
2238
2307
|
userEmail?: string; // X-User-Email header, identify the end user
|
|
2239
2308
|
userJwt?: string; // Authorization: Bearer <jwt>, authenticated users
|
|
2240
2309
|
metadata?: Record<string, unknown> | null; // Message body, for user/ticket enrichment
|
|
@@ -2252,6 +2321,7 @@ interface AgoConfig {
|
|
|
2252
2321
|
| `widgetId` | — | `X-User-Anon-Id` | Per-visitor anonymous id. If omitted, a UUID is generated and cached in `localStorage` (`ago_widget_id`) so a returning visitor keeps the same id. |
|
|
2253
2322
|
| `agent` / `defaultAgentId` | — | `agent_id` in the body | Per-message `agentId` overrides it. `agent` wins if both are set. |
|
|
2254
2323
|
| `permission` | — | `X-Widget-Permission` | Mirrors the widget's `window.AGO.permission`. |
|
|
2324
|
+
| `language` | No | `Accept-Language` | Pass your interface locale, such as `fr` or `pt-BR`. `null` clears the override. |
|
|
2255
2325
|
| `userEmail` | — | `X-User-Email` | Identifies the user to AGO. |
|
|
2256
2326
|
| `userJwt` | — | `Authorization: Bearer …` | For authenticated sessions. |
|
|
2257
2327
|
| `metadata` | — | `metadata` in the body | JSON-serializable user/ticket context. Per-message overrides replace defaults; `null` omits the field. |
|
|
@@ -2354,7 +2424,7 @@ client.updateConfig({ userJwt: token, userEmail: "jane@acme.com" });
|
|
|
2354
2424
|
```
|
|
2355
2425
|
|
|
2356
2426
|
Changing `permission` to a falsy value removes the header. In React, the
|
|
2357
|
-
`useAgo` hook re-applies `agent`, `permission`, `userEmail`, `userJwt`,
|
|
2427
|
+
`useAgo` hook re-applies `agent`, `permission`, `language`, `userEmail`, `userJwt`,
|
|
2358
2428
|
`metadata`, `debug` and `warnOnEmptyReply` automatically when those props
|
|
2359
2429
|
change (changing `baseUrl`/`widgetId` recreates the client).
|
|
2360
2430
|
|
|
@@ -2362,6 +2432,63 @@ change (changing `baseUrl`/`widgetId` recreates the client).
|
|
|
2362
2432
|
`undefined`) keeps the current value; an explicit empty or non-string `baseUrl`
|
|
2363
2433
|
throws `config_missing_base_url` and leaves the client unchanged.
|
|
2364
2434
|
|
|
2435
|
+
### Language
|
|
2436
|
+
|
|
2437
|
+
```ts
|
|
2438
|
+
const client = new AgoClient({
|
|
2439
|
+
baseUrl: "https://playground.api.useago.com",
|
|
2440
|
+
agent: "generic-guide",
|
|
2441
|
+
language: "fr",
|
|
2442
|
+
});
|
|
2443
|
+
const answer = await client.sendMessage("What can you help me with?");
|
|
2444
|
+
|
|
2445
|
+
// Run this when your application's language picker changes.
|
|
2446
|
+
client.updateConfig({ language: "de" });
|
|
2447
|
+
await client.sendMessage("And now?", { conversationId: answer.conversationId });
|
|
2448
|
+
```
|
|
2449
|
+
|
|
2450
|
+
Pass your application's current locale to `language`. The SDK sends it in the
|
|
2451
|
+
`Accept-Language` header on its requests. AGO uses the resolved language to select
|
|
2452
|
+
existing knowledge translations and source titles, falling back to the original
|
|
2453
|
+
content when a translation is unavailable. Region tags are preserved in the header
|
|
2454
|
+
(`pt-BR`); underscores are accepted (`fr_FR` becomes `fr-FR`). The backend may resolve
|
|
2455
|
+
a regional tag to its base language. If translations are stored under a base
|
|
2456
|
+
language such as `pt`, pass that code when the backend does not fall back from
|
|
2457
|
+
`pt-BR`. Source URLs remain the document's configured URLs.
|
|
2458
|
+
If a Django language cookie is sent with the
|
|
2459
|
+
request, it takes precedence over this header.
|
|
2460
|
+
|
|
2461
|
+
In React, bind the same locale your interface uses:
|
|
2462
|
+
|
|
2463
|
+
```tsx
|
|
2464
|
+
<AgoProvider baseUrl="https://playground.api.useago.com" language={i18n.language}>
|
|
2465
|
+
<App />
|
|
2466
|
+
</AgoProvider>
|
|
2467
|
+
```
|
|
2468
|
+
|
|
2469
|
+
Changing the prop updates subsequent requests without recreating the client or
|
|
2470
|
+
losing the conversation. Omit the React prop or call
|
|
2471
|
+
`client.updateConfig({ language: null })` to clear the override. With no override,
|
|
2472
|
+
the browser supplies its own language header. Each client has its own setting;
|
|
2473
|
+
the SDK does not read or change your
|
|
2474
|
+
page's language, global variables, or saved language preferences.
|
|
2475
|
+
|
|
2476
|
+
To refresh knowledge source titles already on screen, reload the conversation
|
|
2477
|
+
after changing the language. Existing answer text stays unchanged:
|
|
2478
|
+
|
|
2479
|
+
```ts
|
|
2480
|
+
client.updateConfig({ language: "fr" });
|
|
2481
|
+
const conversation = await client.getConversation(answer.conversationId);
|
|
2482
|
+
const sources = conversation.messages?.flatMap((message) => message.sources ?? []);
|
|
2483
|
+
```
|
|
2484
|
+
|
|
2485
|
+
`createAgo({ language: "fr" })` also accepts an explicit locale when your API
|
|
2486
|
+
configuration is detected from the page.
|
|
2487
|
+
|
|
2488
|
+
This header does not force the agent's reply language or translate your UI text.
|
|
2489
|
+
Continue passing translated labels, placeholders and welcome text from your
|
|
2490
|
+
application's translations.
|
|
2491
|
+
|
|
2365
2492
|
### User and ticket metadata
|
|
2366
2493
|
|
|
2367
2494
|
Pass JSON-serializable data in `config.metadata` to include it in every new
|
|
@@ -2420,6 +2547,7 @@ may be reworded in any release.
|
|
|
2420
2547
|
| Code | Thrown by | Meaning | Fix |
|
|
2421
2548
|
| --- | --- | --- | --- |
|
|
2422
2549
|
| `config_missing_base_url` | `AgoError` | `baseUrl` missing, empty, or not a string (also from `createAgo()` and `mountChatWidget`) | Pass `baseUrl`, e.g. `https://YOUR-DOMAIN.api.useago.com` (the public demo account `https://playground.api.useago.com` works without a tenant) |
|
|
2550
|
+
| `config_invalid_language` | `AgoError` | `language` is not a valid language tag | Use a tag such as `fr` or `pt-BR`, or `null` to clear the override. Invalid updates leave the client unchanged. |
|
|
2423
2551
|
| `config_suspect_base_url` | console warning only | `baseUrl` has no protocol and is not a `/path` | Add `https://`, or use a `/path` for a same-origin proxy |
|
|
2424
2552
|
| `network_error` | `AgoNetworkError` | fetch failed (offline, DNS, unreachable host) | Check `baseUrl` is reachable and includes the protocol |
|
|
2425
2553
|
| `http_error` | `AgoApiError` | non-2xx without a structured error body | 401/403: check `userJwt`. 404: check `baseUrl` points at the API root |
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function y(u={}){const{overrides:g={}}=u,a={id:"mock-msg-1",conversationId:"mock-conv-1",content:"Mock response",role:"assistant",status:"DONE",createdAt:new Date},l={id:"mock-conv-1",title:"Mock Conversation",lastMessageDate:new Date},n=new Map,c=[],m={sendMessage:async()=>a,continueMessage:async()=>a,stop:async()=>null,stopMessage:async()=>({status:"not_running"}),isGenerating:()=>!1,resumePendingClientFunctions:async()=>null,registerResumeGate:()=>()=>{},getConversations:async()=>[l],getConversation:async()=>l,getMessages:async()=>[a],submitToolCallForm:async()=>({status:"completed"}),confirmToolCall:async()=>{},rejectToolCall:async()=>{},getConfig:async()=>({permissions:[],proactive:{enabled:!1}}),createTicket:async()=>({id:"mock-ticket-1",url:"https://example.test/tickets/mock-ticket-1"}),submitFeedback:async()=>{},submitConversationFeedback:async()=>a.id,registerFunction:()=>{},unregisterFunction:()=>!0,getRegisteredFunctions:()=>[],executeClientFunction:async()=>{},getContextSnapshot:()=>null,notifyContextChanged:()=>{},setContext:()=>{},removeContext:()=>!0,addDynamicContext:()=>{},removeDynamicContext:()=>!0,registerNavigationFunction:()=>{},unregisterNavigationFunction:()=>{},getConfiguredAgent:()=>{},getUserIdentity:()=>({email:void 0,hasJwt:!1}),getHttp:()=>({get:async()=>({}),post:async()=>({})}),emitProactiveEvent:(e,t)=>{const o=n.get(e);o&&[...o].forEach(s=>s(t))},on:(e,t)=>{n.has(e)||n.set(e,new Set),n.get(e).add(t)},off:(e,t)=>{n.get(e)?.delete(t)},once:(e,t)=>{const o=(...s)=>{n.get(e)?.delete(o),t(...s)};n.has(e)||n.set(e,new Set),n.get(e).add(o)},waitFor:(e,t)=>new Promise((o,s)=>{let r;const d=f=>{r&&clearTimeout(r),n.get(e)?.delete(d),o(f)};n.has(e)||n.set(e,new Set),n.get(e).add(d),t?.timeout&&(r=setTimeout(()=>{n.get(e)?.delete(d),s(new Error(`waitFor("${e}") timed out after ${t.timeout}ms`))},t.timeout))}),updateConfig:()=>{},destroy:()=>{n.clear()},...g},i={};for(const[e,t]of Object.entries(m))i[e]=(...o)=>(c.push({method:e,args:o}),t(...o));return i.proactive=null,i.__calls=c,i.__callsFor=e=>c.filter(t=>t.method===e),i.__emitEvent=(e,t)=>{const o=n.get(e);o&&[...o].forEach(s=>s(t))},i}Object.defineProperty(exports,"createMockClient",{enumerable:!0,get:function(){return y}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var p=new WeakMap,M=["position","top","left","right","width"];function B(e,t){return t.map(r=>({style:e,prop:r,value:e.getPropertyValue(r),priority:e.getPropertyPriority(r)}))}function U(e){for(const{style:t,prop:r,value:n,priority:o}of e)n?t.setProperty(r,n,o):t.removeProperty(r)}function j(e,t=document){const r=p.get(t);if(r){r.owners.add(e);return}const n=t.body,o=t.documentElement,u=t.defaultView?.scrollY??0;p.set(t,{owners:new Set([e]),saved:[...B(n.style,M),...B(o.style,["overflow"])],scrollY:u}),n.style.position="fixed",n.style.top=`-${u}px`,n.style.left="0",n.style.right="0",n.style.width="100%",o.style.overflow="hidden"}function k(e,t=document){const r=p.get(t);!r||!r.owners.delete(e)||r.owners.size>0||(p.delete(t),U(r.saved),t.defaultView?.scrollTo(0,r.scrollY))}function L(e,t){const r=e.replace("#",""),n=Number.parseInt(r.substring(0,2),16),o=Number.parseInt(r.substring(2,4),16),u=Number.parseInt(r.substring(4,6),16),a=s=>Math.min(255,Math.round(s+(255-s)*(t/100))),c=s=>s.toString(16).padStart(2,"0");return`#${c(a(n))}${c(a(o))}${c(a(u))}`}function G(e){return/^#?[0-9A-F]{6}$/i.test(e)}function H(e,t,r){const n=(1-Math.abs(2*r-1))*t,o=(e%360+360)%360/60,u=o|0,a=n*(1-Math.abs(o%2-1)),[c,s,f]=[[n,a,0],[a,n,0],[0,n,a],[0,a,n],[a,0,n],[n,0,a]][u],b=r-n/2;return[Math.round((c+b)*255),Math.round((s+b)*255),Math.round((f+b)*255)]}function F(e){const t=e.trim(),r=/^hsla?\(\s*([\d.-]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/i.exec(t);if(r){const[a,c,s]=r.slice(1,4).map(Number);return[a,c,s].some(Number.isNaN)?null:H(a,Math.min(c,100)/100,Math.min(s,100)/100)}const n=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(t);if(n){const a=n.slice(1,4).map(Number);return a.some(c=>Number.isNaN(c)||c<0||c>255)?null:a}const o=t.replace("#",""),u=o.length===3?o.split("").map(a=>a+a).join(""):o;return/^[0-9a-f]{6}$/i.test(u)?[Number.parseInt(u.substring(0,2),16),Number.parseInt(u.substring(2,4),16),Number.parseInt(u.substring(4,6),16)]:null}function A(e){const t=F(e);if(!t)return null;const[r,n,o]=t.map(u=>{const a=u/255;return a<=.03928?a/12.92:((a+.055)/1.055)**2.4});return .2126*r+.7152*n+.0722*o}function I(e,t){const r=A(e),n=A(t);return r===null||n===null?null:(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}var w=/(?:repeating-)?(?:linear|radial|conic)-gradient\(/i;function K(e){return!!e&&w.test(e)}function X(e){return e.match(/#[0-9a-f]{3,8}|(?:rgba?|hsla?)\([^()]*\)|\btransparent\b/gi)??[]}function $(e){const t=e.trim().toLowerCase();if(t==="transparent")return!0;const r=/\/\s*([\d.]+)%?\s*\)$/.exec(t);if(r)return Number.parseFloat(r[1])===0;const n=/^(?:rgba|hsla)\([^)]*,\s*([\d.]+)%?\s*\)$/.exec(t);if(n)return Number.parseFloat(n[1])===0;if(!t.startsWith("#"))return!1;const o=t.slice(1);return/^[0-9a-f]+$/.test(o)?o.length===8?o.slice(6)==="00":o.length===4?o[3]==="0":!1:!1}var d="#FFFFFF",W="#000000",Y="#FFFFFF";function D(e){if(!e)return d;const t=K(e)?X(e):[e],r=(t.some($)?[...t,Y]:t).map(n=>I(n,d)).filter(n=>n!==null);return r.length&&Math.min(...r)<3?W:d}var V='"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',z=`var(--ago-font, ${V})`,x={font:"--ago-font",radius:"--ago-radius",messageRadius:"--ago-message-radius",brand:"--ago-brand-color",brandText:"--ago-brand-text-color",headerBg:"--ago-header-background",headerText:"--ago-header-text-color",panelBg:"--ago-panel-background",messagesBg:"--ago-messages-background",text:"--ago-text-color",mutedText:"--ago-muted-text-color",border:"--ago-border-color",accent:"--ago-accent-color",agentBubbleBg:"--ago-agent-bubble-background",agentBubbleText:"--ago-agent-bubble-text-color",userBubbleBg:"--ago-user-bubble-background",userBubbleText:"--ago-user-bubble-text-color",launcherBg:"--ago-launcher-background",launcherText:"--ago-launcher-text-color",sendBg:"--ago-send-button-background",panelWidth:"--ago-panel-width"},Q="var(--ago-brand-color, #03182f)",q="var(--ago-brand-text-color, #fff)",Z="var(--ago-header-background, var(--ago-brand-color, #03182f))",J="var(--ago-header-text-color, #e8f0fe)",ee="var(--ago-panel-background, #fff)",te="var(--ago-messages-background, #fbfbfb)",re="var(--ago-text-color, #30373e)",ne="var(--ago-muted-text-color, #6b6d6f)",ae="var(--ago-border-color, #dee3e8)",oe="var(--ago-accent-color, #1b5fc4)",ue="var(--ago-agent-bubble-background, #f1f3f5)",h="var(--ago-radius, 16px)",ie="var(--ago-message-radius, 16px)",ce="var(--ago-message-radius, 20px)",se="var(--ago-launcher-background, #007bff)",le="var(--ago-launcher-text-color, #fff)",fe="var(--ago-send-button-background, var(--ago-brand-color, #03182f))",be="var(--ago-user-bubble-background, #fff)",ge="var(--ago-user-bubble-text-color, #0a0a0a)",de="var(--ago-agent-bubble-text-color, var(--ago-text-color, #30373e))",pe="var(--ago-panel-background, #f8faff)",me="var(--ago-accent-color, #003edf)",Ee="#e3edff",Oe="#e5e5e5",he="var(--ago-border-color, #e4e4e7)",ye="var(--ago-muted-text-color, #71717a)",Re="var(--ago-panel-width, 550px)",_e="0 1px 2px 0 rgba(0,0,0,0.05)",ve="0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",Be="0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",Ae="rgba(15, 15, 15, 0.16) 0px 5px 40px 0px";function xe(e,t){if(t)for(const r of Object.keys(x)){const n=t[r];n!=null&&e.style.setProperty(x[r],n)}}function Te(e){if(!e)return{};const t={};return e.button&&(t.launcherBg=e.button,t.sendBg=e.button),e.header&&(t.headerBg=e.header,t.headerText=D(e.header)),e.agentMessage&&(t.agentBubbleBg=e.agentMessage),e.agentMessageFont&&(t.agentBubbleText=e.agentMessageFont),e.background&&(t.panelBg=e.background,t.messagesBg=e.background),e.font&&(t.text=e.font),e.userMessage&&(t.userBubbleBg=e.userMessage),e.userMessageFont&&(t.userBubbleText=e.userMessageFont),t}function S(e,t){Object.assign(e.style,t)}function De(e={}){const t=document.createElement("div");return S(t,e),t}var T="ago-chat-widget-keyframes";function Se(){if(typeof document>"u"||document.getElementById(T))return;const e=document.createElement("style");e.id=T,e.textContent="@keyframes ago-pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }@keyframes ago-spin { to { transform: rotate(360deg); } }@keyframes ago-scale-in { 50% { transform: translateX(-10px) translateY(-5px) scale(1.1); } }@keyframes ago-appear { 0%, 98% { opacity: 0; } 100% { opacity: 1; } }@keyframes ago-skeleton-pulse { 50% { opacity: 0.5; } }.ago-chat-input--embed textarea::placeholder { font-style: italic; color: #9ca3af; opacity: 1; }",document.head.appendChild(e)}var Ne="2147483000";function Pe(e,t="0px"){return e===void 0?t:typeof e=="number"?`${e}px`:e}function N(e){return`(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`}function Ce(e={}){const t=e.breakpoint??768,r=e.peekHeight??152,n=Pe(e.bottomOffset),o=e.initialState??"peek",u=new Set;let a=o,c=!1;const s=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(N(t)):void 0;let f=m();const b=y(!1,o);function P(i,l){if(!i)return{style:{},attrs:{role:null,"aria-modal":null,"aria-label":null}};const v={position:"fixed",left:"0",right:"0",bottom:n,zIndex:Ne,display:"flex",flexDirection:"column",borderRadius:l==="full"?"0":`${h} ${h} 0 0`,paddingBottom:"env(safe-area-inset-bottom)"};return l==="full"?{style:{...v,top:"0",height:"auto",paddingTop:"env(safe-area-inset-top)"},attrs:{role:"dialog","aria-modal":"true",tabindex:"-1"}}:{style:{...v,top:"auto",minHeight:`calc(${r}px + env(safe-area-inset-bottom))`,height:"auto"},attrs:{role:null,"aria-modal":null,tabindex:"-1"}}}function y(i,l){return{compact:i,state:l,isModal:i&&l==="full",surface:P(i,l)}}function m(){return y(!!s?.matches,a)}function E(){f=m();for(const i of u)i()}function O(i,l){c||a===i||(a=i,E(),e.onStateChange?.(i,l))}function R(){if(!c){if(!s?.matches&&a!==o){a=o,E(),e.onStateChange?.(o,"breakpoint");return}E()}}let g=!1;function C(){g||!s||(s.addEventListener("change",R),g=!0,f=m())}function _(){!g||!s||(s.removeEventListener("change",R),g=!1)}return{subscribe(i){return u.add(i),u.size===1&&C(),()=>{u.delete(i),u.size===0&&_()}},getSnapshot:()=>f,getServerSnapshot:()=>b,expand:(i="api")=>O("full",i),collapse:(i="api")=>O("peek",i),toggle:(i="api")=>O(a==="full"?"peek":"full",i),destroy(){c||(c=!0,_(),u.clear())}}}Object.defineProperty(exports,"ACCENT_COLOR",{enumerable:!0,get:function(){return oe}});Object.defineProperty(exports,"AGENT_BUBBLE_BACKGROUND",{enumerable:!0,get:function(){return ue}});Object.defineProperty(exports,"AGENT_BUBBLE_TEXT",{enumerable:!0,get:function(){return de}});Object.defineProperty(exports,"BORDER_COLOR",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"BRAND_COLOR",{enumerable:!0,get:function(){return Q}});Object.defineProperty(exports,"BRAND_TEXT_COLOR",{enumerable:!0,get:function(){return q}});Object.defineProperty(exports,"EMBED_BACKGROUND",{enumerable:!0,get:function(){return pe}});Object.defineProperty(exports,"EMBED_BORDER",{enumerable:!0,get:function(){return he}});Object.defineProperty(exports,"EMBED_MUTED_TEXT",{enumerable:!0,get:function(){return ye}});Object.defineProperty(exports,"FONT_VAR",{enumerable:!0,get:function(){return z}});Object.defineProperty(exports,"HEADER_BACKGROUND",{enumerable:!0,get:function(){return Z}});Object.defineProperty(exports,"HEADER_TEXT_COLOR",{enumerable:!0,get:function(){return J}});Object.defineProperty(exports,"LAUNCHER_BACKGROUND",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"LAUNCHER_TEXT_COLOR",{enumerable:!0,get:function(){return le}});Object.defineProperty(exports,"MESSAGES_BACKGROUND",{enumerable:!0,get:function(){return te}});Object.defineProperty(exports,"MESSAGE_RADIUS",{enumerable:!0,get:function(){return ie}});Object.defineProperty(exports,"MESSAGE_RADIUS_IMESSAGE",{enumerable:!0,get:function(){return ce}});Object.defineProperty(exports,"MUTED_TEXT_COLOR",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"NEUTRAL_BORDER",{enumerable:!0,get:function(){return Oe}});Object.defineProperty(exports,"PANEL_BACKGROUND",{enumerable:!0,get:function(){return ee}});Object.defineProperty(exports,"PANEL_SHADOW",{enumerable:!0,get:function(){return Ae}});Object.defineProperty(exports,"PANEL_WIDTH",{enumerable:!0,get:function(){return Re}});Object.defineProperty(exports,"PRIMARY_ACCENT",{enumerable:!0,get:function(){return me}});Object.defineProperty(exports,"PRIMARY_FOREGROUND",{enumerable:!0,get:function(){return Ee}});Object.defineProperty(exports,"RADIUS",{enumerable:!0,get:function(){return h}});Object.defineProperty(exports,"SEND_BACKGROUND",{enumerable:!0,get:function(){return fe}});Object.defineProperty(exports,"SHADOW",{enumerable:!0,get:function(){return ve}});Object.defineProperty(exports,"SHADOW_MD",{enumerable:!0,get:function(){return Be}});Object.defineProperty(exports,"SHADOW_SM",{enumerable:!0,get:function(){return _e}});Object.defineProperty(exports,"TEXT_COLOR",{enumerable:!0,get:function(){return re}});Object.defineProperty(exports,"USER_BUBBLE_BACKGROUND_EMBED",{enumerable:!0,get:function(){return be}});Object.defineProperty(exports,"USER_BUBBLE_TEXT_EMBED",{enumerable:!0,get:function(){return ge}});Object.defineProperty(exports,"applyTheme",{enumerable:!0,get:function(){return xe}});Object.defineProperty(exports,"colorsToTheme",{enumerable:!0,get:function(){return Te}});Object.defineProperty(exports,"compactMediaQuery",{enumerable:!0,get:function(){return N}});Object.defineProperty(exports,"createSheetController",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"css",{enumerable:!0,get:function(){return S}});Object.defineProperty(exports,"div",{enumerable:!0,get:function(){return De}});Object.defineProperty(exports,"ensureKeyframes",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"isValidHexColor",{enumerable:!0,get:function(){return G}});Object.defineProperty(exports,"lightenColor",{enumerable:!0,get:function(){return L}});Object.defineProperty(exports,"lockBackgroundScroll",{enumerable:!0,get:function(){return j}});Object.defineProperty(exports,"readableTextColor",{enumerable:!0,get:function(){return D}});Object.defineProperty(exports,"unlockBackgroundScroll",{enumerable:!0,get:function(){return k}});
|
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
var p = /* @__PURE__ */ new WeakMap(), N = [
|
|
2
|
-
"position",
|
|
3
|
-
"top",
|
|
4
|
-
"left",
|
|
5
|
-
"right",
|
|
6
|
-
"width"
|
|
7
|
-
];
|
|
8
|
-
function T(e, a) {
|
|
9
|
-
return a.map((t) => ({
|
|
10
|
-
style: e,
|
|
11
|
-
prop: t,
|
|
12
|
-
value: e.getPropertyValue(t),
|
|
13
|
-
priority: e.getPropertyPriority(t)
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
function k(e) {
|
|
17
|
-
for (const { style: a, prop: t, value: r, priority: o } of e) r ? a.setProperty(t, r, o) : a.removeProperty(t);
|
|
18
|
-
}
|
|
19
|
-
function V(e, a = document) {
|
|
20
|
-
const t = p.get(a);
|
|
21
|
-
if (t) {
|
|
22
|
-
t.owners.add(e);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const r = a.body, o = a.documentElement, s = a.defaultView?.scrollY ?? 0;
|
|
26
|
-
p.set(a, {
|
|
27
|
-
owners: /* @__PURE__ */ new Set([e]),
|
|
28
|
-
saved: [...T(r.style, N), ...T(o.style, ["overflow"])],
|
|
29
|
-
scrollY: s
|
|
30
|
-
}), r.style.position = "fixed", r.style.top = `-${s}px`, r.style.left = "0", r.style.right = "0", r.style.width = "100%", o.style.overflow = "hidden";
|
|
31
|
-
}
|
|
32
|
-
function z(e, a = document) {
|
|
33
|
-
const t = p.get(a);
|
|
34
|
-
!t || !t.owners.delete(e) || t.owners.size > 0 || (p.delete(a), k(t.saved), a.defaultView?.scrollTo(0, t.scrollY));
|
|
35
|
-
}
|
|
36
|
-
function j(e, a) {
|
|
37
|
-
const t = e.replace("#", ""), r = Number.parseInt(t.substring(0, 2), 16), o = Number.parseInt(t.substring(2, 4), 16), s = Number.parseInt(t.substring(4, 6), 16), n = (u) => Math.min(255, Math.round(u + (255 - u) * (a / 100))), l = (u) => u.toString(16).padStart(2, "0");
|
|
38
|
-
return `#${l(n(r))}${l(n(o))}${l(n(s))}`;
|
|
39
|
-
}
|
|
40
|
-
function q(e) {
|
|
41
|
-
return /^#?[0-9A-F]{6}$/i.test(e);
|
|
42
|
-
}
|
|
43
|
-
function O(e, a, t) {
|
|
44
|
-
const r = (1 - Math.abs(2 * t - 1)) * a, o = (e % 360 + 360) % 360 / 60, s = o | 0, n = r * (1 - Math.abs(o % 2 - 1)), [l, u, g] = [
|
|
45
|
-
[
|
|
46
|
-
r,
|
|
47
|
-
n,
|
|
48
|
-
0
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
n,
|
|
52
|
-
r,
|
|
53
|
-
0
|
|
54
|
-
],
|
|
55
|
-
[
|
|
56
|
-
0,
|
|
57
|
-
r,
|
|
58
|
-
n
|
|
59
|
-
],
|
|
60
|
-
[
|
|
61
|
-
0,
|
|
62
|
-
n,
|
|
63
|
-
r
|
|
64
|
-
],
|
|
65
|
-
[
|
|
66
|
-
n,
|
|
67
|
-
0,
|
|
68
|
-
r
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
r,
|
|
72
|
-
0,
|
|
73
|
-
n
|
|
74
|
-
]
|
|
75
|
-
][s], f = t - r / 2;
|
|
76
|
-
return [
|
|
77
|
-
Math.round((l + f) * 255),
|
|
78
|
-
Math.round((u + f) * 255),
|
|
79
|
-
Math.round((g + f) * 255)
|
|
80
|
-
];
|
|
81
|
-
}
|
|
82
|
-
function C(e) {
|
|
83
|
-
const a = e.trim(), t = /^hsla?\(\s*([\d.-]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/i.exec(a);
|
|
84
|
-
if (t) {
|
|
85
|
-
const [n, l, u] = t.slice(1, 4).map(Number);
|
|
86
|
-
return [
|
|
87
|
-
n,
|
|
88
|
-
l,
|
|
89
|
-
u
|
|
90
|
-
].some(Number.isNaN) ? null : O(n, Math.min(l, 100) / 100, Math.min(u, 100) / 100);
|
|
91
|
-
}
|
|
92
|
-
const r = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(a);
|
|
93
|
-
if (r) {
|
|
94
|
-
const n = r.slice(1, 4).map(Number);
|
|
95
|
-
return n.some((l) => Number.isNaN(l) || l < 0 || l > 255) ? null : n;
|
|
96
|
-
}
|
|
97
|
-
const o = a.replace("#", ""), s = o.length === 3 ? o.split("").map((n) => n + n).join("") : o;
|
|
98
|
-
return /^[0-9a-f]{6}$/i.test(s) ? [
|
|
99
|
-
Number.parseInt(s.substring(0, 2), 16),
|
|
100
|
-
Number.parseInt(s.substring(2, 4), 16),
|
|
101
|
-
Number.parseInt(s.substring(4, 6), 16)
|
|
102
|
-
] : null;
|
|
103
|
-
}
|
|
104
|
-
function _(e) {
|
|
105
|
-
const a = C(e);
|
|
106
|
-
if (!a) return null;
|
|
107
|
-
const [t, r, o] = a.map((s) => {
|
|
108
|
-
const n = s / 255;
|
|
109
|
-
return n <= 0.03928 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4;
|
|
110
|
-
});
|
|
111
|
-
return 0.2126 * t + 0.7152 * r + 0.0722 * o;
|
|
112
|
-
}
|
|
113
|
-
function F(e, a) {
|
|
114
|
-
const t = _(e), r = _(a);
|
|
115
|
-
return t === null || r === null ? null : (Math.max(t, r) + 0.05) / (Math.min(t, r) + 0.05);
|
|
116
|
-
}
|
|
117
|
-
var L = /(?:repeating-)?(?:linear|radial|conic)-gradient\(/i;
|
|
118
|
-
function U(e) {
|
|
119
|
-
return !!e && L.test(e);
|
|
120
|
-
}
|
|
121
|
-
function w(e) {
|
|
122
|
-
return e.match(/#[0-9a-f]{3,8}|(?:rgba?|hsla?)\([^()]*\)|\btransparent\b/gi) ?? [];
|
|
123
|
-
}
|
|
124
|
-
function I(e) {
|
|
125
|
-
const a = e.trim().toLowerCase();
|
|
126
|
-
if (a === "transparent") return !0;
|
|
127
|
-
const t = /\/\s*([\d.]+)%?\s*\)$/.exec(a);
|
|
128
|
-
if (t) return Number.parseFloat(t[1]) === 0;
|
|
129
|
-
const r = /^(?:rgba|hsla)\([^)]*,\s*([\d.]+)%?\s*\)$/.exec(a);
|
|
130
|
-
if (r) return Number.parseFloat(r[1]) === 0;
|
|
131
|
-
if (!a.startsWith("#")) return !1;
|
|
132
|
-
const o = a.slice(1);
|
|
133
|
-
return /^[0-9a-f]+$/.test(o) ? o.length === 8 ? o.slice(6) === "00" : o.length === 4 ? o[3] === "0" : !1 : !1;
|
|
134
|
-
}
|
|
135
|
-
var b = "#FFFFFF", H = "#000000", G = "#FFFFFF";
|
|
136
|
-
function P(e) {
|
|
137
|
-
if (!e) return b;
|
|
138
|
-
const a = U(e) ? w(e) : [e], t = (a.some(I) ? [...a, G] : a).map((r) => F(r, b)).filter((r) => r !== null);
|
|
139
|
-
return t.length && Math.min(...t) < 3 ? H : b;
|
|
140
|
-
}
|
|
141
|
-
var $ = '"IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', Q = `var(--ago-font, ${$})`, y = {
|
|
142
|
-
font: "--ago-font",
|
|
143
|
-
radius: "--ago-radius",
|
|
144
|
-
messageRadius: "--ago-message-radius",
|
|
145
|
-
brand: "--ago-brand-color",
|
|
146
|
-
brandText: "--ago-brand-text-color",
|
|
147
|
-
headerBg: "--ago-header-background",
|
|
148
|
-
headerText: "--ago-header-text-color",
|
|
149
|
-
panelBg: "--ago-panel-background",
|
|
150
|
-
messagesBg: "--ago-messages-background",
|
|
151
|
-
text: "--ago-text-color",
|
|
152
|
-
mutedText: "--ago-muted-text-color",
|
|
153
|
-
border: "--ago-border-color",
|
|
154
|
-
accent: "--ago-accent-color",
|
|
155
|
-
agentBubbleBg: "--ago-agent-bubble-background",
|
|
156
|
-
agentBubbleText: "--ago-agent-bubble-text-color",
|
|
157
|
-
userBubbleBg: "--ago-user-bubble-background",
|
|
158
|
-
userBubbleText: "--ago-user-bubble-text-color",
|
|
159
|
-
launcherBg: "--ago-launcher-background",
|
|
160
|
-
launcherText: "--ago-launcher-text-color",
|
|
161
|
-
sendBg: "--ago-send-button-background",
|
|
162
|
-
panelWidth: "--ago-panel-width"
|
|
163
|
-
}, Z = "var(--ago-brand-color, #03182f)", J = "var(--ago-brand-text-color, #fff)", ee = "var(--ago-header-background, var(--ago-brand-color, #03182f))", ae = "var(--ago-header-text-color, #e8f0fe)", te = "var(--ago-panel-background, #fff)", re = "var(--ago-messages-background, #fbfbfb)", ne = "var(--ago-text-color, #30373e)", oe = "var(--ago-muted-text-color, #6b6d6f)", se = "var(--ago-border-color, #dee3e8)", ie = "var(--ago-accent-color, #1b5fc4)", le = "var(--ago-agent-bubble-background, #f1f3f5)", A = "var(--ago-radius, 16px)", ue = "var(--ago-message-radius, 16px)", ce = "var(--ago-message-radius, 20px)", ge = "var(--ago-launcher-background, #007bff)", fe = "var(--ago-launcher-text-color, #fff)", de = "var(--ago-send-button-background, var(--ago-brand-color, #03182f))", be = "var(--ago-user-bubble-background, #fff)", pe = "var(--ago-user-bubble-text-color, #0a0a0a)", he = "var(--ago-agent-bubble-text-color, var(--ago-text-color, #30373e))", me = "var(--ago-panel-background, #f8faff)", ve = "var(--ago-accent-color, #003edf)", xe = "#e3edff", Ee = "#e5e5e5", Be = "var(--ago-border-color, #e4e4e7)", Re = "var(--ago-muted-text-color, #71717a)", Te = "var(--ago-panel-width, 550px)", _e = "0 1px 2px 0 rgba(0,0,0,0.05)", ye = "0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)", Ae = "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)", Me = "rgba(15, 15, 15, 0.16) 0px 5px 40px 0px";
|
|
164
|
-
function De(e, a) {
|
|
165
|
-
if (a)
|
|
166
|
-
for (const t of Object.keys(y)) {
|
|
167
|
-
const r = a[t];
|
|
168
|
-
r != null && e.style.setProperty(y[t], r);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function Se(e) {
|
|
172
|
-
if (!e) return {};
|
|
173
|
-
const a = {};
|
|
174
|
-
return e.button && (a.launcherBg = e.button, a.sendBg = e.button), e.header && (a.headerBg = e.header, a.headerText = P(e.header)), e.agentMessage && (a.agentBubbleBg = e.agentMessage), e.agentMessageFont && (a.agentBubbleText = e.agentMessageFont), e.background && (a.panelBg = e.background, a.messagesBg = e.background), e.font && (a.text = e.font), e.userMessage && (a.userBubbleBg = e.userMessage), e.userMessageFont && (a.userBubbleText = e.userMessageFont), a;
|
|
175
|
-
}
|
|
176
|
-
function K(e, a) {
|
|
177
|
-
Object.assign(e.style, a);
|
|
178
|
-
}
|
|
179
|
-
function Ne(e = {}) {
|
|
180
|
-
const a = document.createElement("div");
|
|
181
|
-
return K(a, e), a;
|
|
182
|
-
}
|
|
183
|
-
var M = "ago-chat-widget-keyframes";
|
|
184
|
-
function ke() {
|
|
185
|
-
if (typeof document > "u" || document.getElementById(M)) return;
|
|
186
|
-
const e = document.createElement("style");
|
|
187
|
-
e.id = M, e.textContent = "@keyframes ago-pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }@keyframes ago-spin { to { transform: rotate(360deg); } }@keyframes ago-scale-in { 50% { transform: translateX(-10px) translateY(-5px) scale(1.1); } }@keyframes ago-appear { 0%, 98% { opacity: 0; } 100% { opacity: 1; } }@keyframes ago-skeleton-pulse { 50% { opacity: 0.5; } }.ago-chat-input--embed textarea::placeholder { font-style: italic; color: #9ca3af; opacity: 1; }", document.head.appendChild(e);
|
|
188
|
-
}
|
|
189
|
-
var X = "2147483000";
|
|
190
|
-
function W(e, a = "0px") {
|
|
191
|
-
return e === void 0 ? a : typeof e == "number" ? `${e}px` : e;
|
|
192
|
-
}
|
|
193
|
-
function Y(e) {
|
|
194
|
-
return `(max-width: ${e}px), (max-height: 500px) and (orientation: landscape)`;
|
|
195
|
-
}
|
|
196
|
-
function Oe(e = {}) {
|
|
197
|
-
const a = e.breakpoint ?? 768, t = e.peekHeight ?? 152, r = W(e.bottomOffset), o = e.initialState ?? "peek", s = /* @__PURE__ */ new Set();
|
|
198
|
-
let n = o, l = !1;
|
|
199
|
-
const u = typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia(Y(a)) : void 0;
|
|
200
|
-
let g = h();
|
|
201
|
-
const f = x(!1, o);
|
|
202
|
-
function D(i, c) {
|
|
203
|
-
if (!i) return {
|
|
204
|
-
style: {},
|
|
205
|
-
attrs: {
|
|
206
|
-
role: null,
|
|
207
|
-
"aria-modal": null,
|
|
208
|
-
"aria-label": null
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
const R = {
|
|
212
|
-
position: "fixed",
|
|
213
|
-
left: "0",
|
|
214
|
-
right: "0",
|
|
215
|
-
bottom: r,
|
|
216
|
-
zIndex: X,
|
|
217
|
-
display: "flex",
|
|
218
|
-
flexDirection: "column",
|
|
219
|
-
borderRadius: c === "full" ? "0" : `${A} ${A} 0 0`,
|
|
220
|
-
paddingBottom: "env(safe-area-inset-bottom)"
|
|
221
|
-
};
|
|
222
|
-
return c === "full" ? {
|
|
223
|
-
style: {
|
|
224
|
-
...R,
|
|
225
|
-
top: "0",
|
|
226
|
-
height: "auto",
|
|
227
|
-
paddingTop: "env(safe-area-inset-top)"
|
|
228
|
-
},
|
|
229
|
-
attrs: {
|
|
230
|
-
role: "dialog",
|
|
231
|
-
"aria-modal": "true",
|
|
232
|
-
tabindex: "-1"
|
|
233
|
-
}
|
|
234
|
-
} : {
|
|
235
|
-
style: {
|
|
236
|
-
...R,
|
|
237
|
-
top: "auto",
|
|
238
|
-
minHeight: `calc(${t}px + env(safe-area-inset-bottom))`,
|
|
239
|
-
height: "auto"
|
|
240
|
-
},
|
|
241
|
-
attrs: {
|
|
242
|
-
role: null,
|
|
243
|
-
"aria-modal": null,
|
|
244
|
-
tabindex: "-1"
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
function x(i, c) {
|
|
249
|
-
return {
|
|
250
|
-
compact: i,
|
|
251
|
-
state: c,
|
|
252
|
-
isModal: i && c === "full",
|
|
253
|
-
surface: D(i, c)
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
function h() {
|
|
257
|
-
return x(!!u?.matches, n);
|
|
258
|
-
}
|
|
259
|
-
function m() {
|
|
260
|
-
g = h();
|
|
261
|
-
for (const i of s) i();
|
|
262
|
-
}
|
|
263
|
-
function v(i, c) {
|
|
264
|
-
l || n === i || (n = i, m(), e.onStateChange?.(i, c));
|
|
265
|
-
}
|
|
266
|
-
function E() {
|
|
267
|
-
if (!l) {
|
|
268
|
-
if (!u?.matches && n !== o) {
|
|
269
|
-
n = o, m(), e.onStateChange?.(o, "breakpoint");
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
m();
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
let d = !1;
|
|
276
|
-
function S() {
|
|
277
|
-
d || !u || (u.addEventListener("change", E), d = !0, g = h());
|
|
278
|
-
}
|
|
279
|
-
function B() {
|
|
280
|
-
!d || !u || (u.removeEventListener("change", E), d = !1);
|
|
281
|
-
}
|
|
282
|
-
return {
|
|
283
|
-
subscribe(i) {
|
|
284
|
-
return s.add(i), s.size === 1 && S(), () => {
|
|
285
|
-
s.delete(i), s.size === 0 && B();
|
|
286
|
-
};
|
|
287
|
-
},
|
|
288
|
-
getSnapshot: () => g,
|
|
289
|
-
getServerSnapshot: () => f,
|
|
290
|
-
expand: (i = "api") => v("full", i),
|
|
291
|
-
collapse: (i = "api") => v("peek", i),
|
|
292
|
-
toggle: (i = "api") => v(n === "full" ? "peek" : "full", i),
|
|
293
|
-
destroy() {
|
|
294
|
-
l || (l = !0, B(), s.clear());
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
export {
|
|
299
|
-
Ae as A,
|
|
300
|
-
q as B,
|
|
301
|
-
Me as C,
|
|
302
|
-
A as D,
|
|
303
|
-
xe as E,
|
|
304
|
-
De as F,
|
|
305
|
-
P as H,
|
|
306
|
-
Se as I,
|
|
307
|
-
K as L,
|
|
308
|
-
ne as M,
|
|
309
|
-
be as N,
|
|
310
|
-
de as O,
|
|
311
|
-
pe as P,
|
|
312
|
-
Ne as R,
|
|
313
|
-
te as S,
|
|
314
|
-
ve as T,
|
|
315
|
-
V as U,
|
|
316
|
-
j as V,
|
|
317
|
-
z as W,
|
|
318
|
-
re as _,
|
|
319
|
-
he as a,
|
|
320
|
-
oe as b,
|
|
321
|
-
J as c,
|
|
322
|
-
Re as d,
|
|
323
|
-
Q as f,
|
|
324
|
-
fe as g,
|
|
325
|
-
ge as h,
|
|
326
|
-
le as i,
|
|
327
|
-
_e as j,
|
|
328
|
-
ye as k,
|
|
329
|
-
me as l,
|
|
330
|
-
ae as m,
|
|
331
|
-
Oe as n,
|
|
332
|
-
se as o,
|
|
333
|
-
ee as p,
|
|
334
|
-
ie as r,
|
|
335
|
-
Z as s,
|
|
336
|
-
Y as t,
|
|
337
|
-
Be as u,
|
|
338
|
-
ue as v,
|
|
339
|
-
Te as w,
|
|
340
|
-
Ee as x,
|
|
341
|
-
ce as y,
|
|
342
|
-
ke as z
|
|
343
|
-
};
|