@theoremjs/studio 0.3.4-next.767.gb6b8d79 → 0.3.4-next.779.g11cbf1e
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/package.json +6 -6
- package/page/assets/CheckboxInput-BIFNQqbA.js +2 -0
- package/page/assets/{CodeBlock-DzXH_9DF.js → CodeBlock-PkWvyBvu.js} +2 -2
- package/page/assets/CollapsibleGroup-Dfbkt6Hp.js +1 -0
- package/page/assets/ConsoleFrame-BL1z2eD0.js +3 -0
- package/page/assets/DateInput-D8vNhNrf.js +1 -0
- package/page/assets/FieldStatus-CSAKvGxp.js +1 -0
- package/page/assets/HStack-cOiUht-L.js +1 -0
- package/page/assets/Icon-BWzSKxTK.js +3 -0
- package/page/assets/IconButton-CerBBPke.js +1 -0
- package/page/assets/{ListItem-MWWVygeh.js → ListItem-DrfoLYVQ.js} +1 -1
- package/page/assets/{MenuBottomSheet-DHHFwrX2.js → MenuBottomSheet-Cj_m0FwL.js} +1 -1
- package/page/assets/{MenuBottomSheetActionList-CYZ56fty.js → MenuBottomSheetActionList-CG8160ZS.js} +1 -1
- package/page/assets/{OverflowList-CsAj89UP.js → OverflowList-BoqbSk8e.js} +1 -1
- package/page/assets/SchemaFields-ps09Azfn.js +1 -0
- package/page/assets/SidePanel-DLgOJwvB.js +2 -0
- package/page/assets/Spinner--TVdDovX.js +1 -0
- package/page/assets/Stack-DPSs1dBF.js +1 -0
- package/page/assets/StackItem-YZCLellt.js +1 -0
- package/page/assets/TextInput-6ChkOVD6.js +1 -0
- package/page/assets/{TimestampHoverCard-BNDnoAyp.js → TimestampHoverCard-G3Y6IWqf.js} +1 -1
- package/page/assets/ToolResultCharts-BXsovSPy.js +1 -0
- package/page/assets/{Toolbar-BDW6J7QA.js → Toolbar-DYcMnO62.js} +1 -1
- package/page/assets/TraceInspector-Bre-_OOJ.js +1 -0
- package/page/assets/{TraceOverview-3TC0yf85.js → TraceOverview-Cu11czzK.js} +4 -4
- package/page/assets/VStack-CEcm-qoM.js +1 -0
- package/page/assets/VisuallyHidden-BdRLF-8h.js +1 -0
- package/page/assets/{browser-engine-CMbqiA6o.js → browser-engine-Bem0sxvd.js} +3 -3
- package/page/assets/{browser-transport-D-kfBycp.js → browser-transport-EFTTaxlW.js} +3 -3
- package/page/assets/editor.api-BldS301e.js +908 -0
- package/page/assets/{export-agent-SKuzsCut.js → export-agent-Vr27IYjU.js} +3 -3
- package/page/assets/fieldParts-CNKpMZ7U.js +1 -0
- package/page/assets/{guardrail-tester-CaSlReMa.js → guardrail-tester-C751r3bt.js} +2 -2
- package/page/assets/{highlightRanges-yrVxbmkN.js → highlightRanges-DvvjZZAv.js} +1 -1
- package/page/assets/index-D-vL6Brp.js +150 -0
- package/page/assets/index-hzhWkDKG.css +1 -0
- package/page/assets/inputStyles.stylex-uYr8_KtT.js +1 -0
- package/page/assets/json-code-H5C9N1L2.js +3 -0
- package/page/assets/json.worker-DdeUAmHa.js +65 -0
- package/page/assets/json.worker-eZ5CgyQq.js +1 -0
- package/page/assets/jsonMode-DYGImCy6.js +29 -0
- package/page/assets/jsonMode-jMDxUeWM.css +1 -0
- package/page/assets/{labels-provider-Dc-AJqPH.js → labels-provider-BcEDhptf.js} +2 -2
- package/page/assets/prompt-row-Cvv0-wIe.js +71 -0
- package/page/assets/{register-CDgivxvX.js → register-BLInT6S0.js} +2 -2
- package/page/assets/studio-code-pane-DEwkKRs7.js +10 -0
- package/page/assets/{studio-console-DGGdlBUn.js → studio-console-DUEQORQA.js} +1 -1
- package/page/assets/{studio-decision-BwhZcZi3.js → studio-decision-1ZxlVBif.js} +1 -1
- package/page/assets/studio-embedding-jpaLvrIG.js +2 -0
- package/page/assets/studio-host-console-PexPeQ56.js +2 -0
- package/page/assets/studio-labels-BT3B-xe1.js +3 -0
- package/page/assets/studio-live-Oj8HFx3a.js +5 -0
- package/page/assets/{studio-map-D-CNsPgj.js → studio-map-BcCwfeFt.js} +1 -1
- package/page/assets/studio-monaco-BkNqudm7.css +1 -0
- package/page/assets/studio-monaco-C20o5PnA.js +34 -0
- package/page/assets/{studio-trace-replay-CLslqTKN.js → studio-trace-replay-B6GcmpuZ.js} +3 -3
- package/page/assets/trace-patterns-86-gKv3I.js +1 -0
- package/page/assets/{typescript-20GgZ8PJ.js → typescript-CF1Ntufd.js} +1 -1
- package/page/assets/use-one-call-CZI_M4Bi.js +1 -0
- package/page/assets/useAnnounce-DlZth-he.js +1 -0
- package/page/assets/useAnnounceRenderedText-BrbiKE4-.js +1 -0
- package/page/assets/{useClipboard-BC4cMFBa.js → useClipboard-DeMRGvqJ.js} +1 -1
- package/page/assets/{useKeyboardHint-BBkDGjRh.js → useKeyboardHint-BIqbBlHw.js} +1 -1
- package/page/assets/useLocale-DrfYfZTs.js +1 -0
- package/page/assets/useMenuDrillIn-DOLSnkWq.js +1 -0
- package/page/assets/usePressFeedback-CBSbXJuo.js +1 -0
- package/page/assets/useResolvedRequired-CAelf7J-.js +1 -0
- package/page/index.html +35 -28
- package/ui/built/theme.css +25 -0
- package/ui/built/theorem-studio.js +25 -0
- package/ui/code/json-code.d.ts +12 -0
- package/ui/code/json-code.js +130 -0
- package/ui/code/studio-code.js +2 -9
- package/ui/code/studio-monaco.d.ts +4 -0
- package/ui/code/studio-monaco.js +18 -0
- package/ui/inspector.d.ts +10 -2
- package/ui/inspector.js +12 -3
- package/ui/lib/tab-fills.d.ts +3 -2
- package/ui/profile-editor.js +12 -11
- package/ui/studio-theme.js +26 -0
- package/ui/studio.css +20 -4
- package/page/assets/CheckboxInput-MMjt4mDv.js +0 -2
- package/page/assets/CollapsibleGroup-C5fLYcux.js +0 -1
- package/page/assets/ConsoleFrame-1zBq8Aef.js +0 -3
- package/page/assets/DateInput-BfmlGmw1.js +0 -1
- package/page/assets/Icon-3c9WmPTH.js +0 -3
- package/page/assets/IconButton-BeI1pXEZ.js +0 -1
- package/page/assets/SchemaFields-D0W9vuLc.js +0 -1
- package/page/assets/SidePanel-D5woAYFH.js +0 -2
- package/page/assets/StackItem-CQviqAfM.js +0 -1
- package/page/assets/TextInput-Dq9voagQ.js +0 -1
- package/page/assets/ToolResultCharts-TPkKdyQt.js +0 -1
- package/page/assets/TraceInspector-DJLaxle-.js +0 -1
- package/page/assets/VStack-CkVMcNiK.js +0 -1
- package/page/assets/editor.api-Cd3ViPQa.js +0 -908
- package/page/assets/fieldParts-BnDYE6oM.js +0 -1
- package/page/assets/index-BcMQ291i.js +0 -149
- package/page/assets/index-DZ3ArAk6.css +0 -1
- package/page/assets/prompt-row-DhGOXTVR.js +0 -71
- package/page/assets/studio-code-pane-DucGib9w.js +0 -10
- package/page/assets/studio-embedding-C8BulZi2.js +0 -2
- package/page/assets/studio-host-console-C8zLZsl2.js +0 -2
- package/page/assets/studio-labels-DHrOBSMz.js +0 -3
- package/page/assets/studio-live-D0PISMYH.js +0 -5
- package/page/assets/studio-monaco-CbKf90i6.css +0 -1
- package/page/assets/studio-monaco-xfyfezQS.js +0 -34
- package/page/assets/trace-patterns-D5Rcl0G4.js +0 -1
- package/page/assets/use-one-call-x1Gm_JQc.js +0 -1
- package/page/assets/useAnnounce-DOkF3CS1.js +0 -1
- package/page/assets/useAnnounceRenderedText-BaMlDax-.js +0 -1
- package/page/assets/useLocale-D8GRz3lz.js +0 -1
- package/page/assets/useMenuDrillIn-CmUoRV2h.js +0 -1
- package/page/assets/useResolvedRequired-68GOSl0j.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,u as n}from"./themeProps-3IqahpCr.js";import{t as r}from"./
|
|
2
|
-
`),attachments:r.filter(e=>e.type===`blob`||e.type===`uri`).length}}function _e(e,t){let n=[];for(let r of t.events??[]){if(r.name!==`theorem.grounding`)continue;let i=r.attributes.sources;if(i===void 0)continue;let a=
|
|
3
|
-
`).map((e,t)=>({line:e,at:t+1})).filter(({line:e})=>e.trim());if(t.length<2)throw new
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,u as n}from"./themeProps-3IqahpCr.js";import{t as r}from"./StackItem-YZCLellt.js";import{a as i,h as a,m as o,o as s,s as c,v as l,y as u}from"./browser-transport-EFTTaxlW.js";import{c as d}from"./fieldParts-CNKpMZ7U.js";import{t as f}from"./Icon-BWzSKxTK.js";import{t as p}from"./Text-B74VhVA7.js";import{n as m,t as h}from"./labels-provider-BcEDhptf.js";import{n as g,t as _}from"./IconButton-CerBBPke.js";import{i as v,r as y}from"./row-keys-WByP9Hsh.js";import{g as b,t as x}from"./studio-labels-BT3B-xe1.js";import{t as S}from"./IconHistory-VvDVN7WG.js";import{c as C}from"./host-patterns-F-KZIzkF.js";import{T as w}from"./shaped-data-D15FDUcH.js";import{n as T}from"./trace-record-jocyYEPa.js";import{n as E}from"./trace-schema--4IGmLeE.js";import{v as D}from"./turn-client-eM8VIbMd.js";import{t as O}from"./HStack-cOiUht-L.js";import{t as k}from"./VStack-CEcm-qoM.js";import{a as A,i as j,o as M,t as N}from"./ConsoleFrame-BL1z2eD0.js";import{E as P,H as ee,L as te,M as ne,N as re,P as ie,T as ae,a as F,c as oe,gt as se,ht as ce,nn as le}from"./index-D-vL6Brp.js";var I=e=>typeof e==`object`&&!!e&&!Array.isArray(e),L=(e,t)=>e.attributes[t],R=(e,t)=>{let n=L(e,t);return typeof n==`string`?n:void 0};function z(e,t,n){let r=L(t,n);return r===void 0?void 0:T(e,r)}function B(e,t,n){let r=z(e,t,n);return r===void 0?``:typeof r==`string`?r:JSON.stringify(r)}function V(e,t,n){let r=z(e,t,n);return Array.isArray(r)?r.filter(I):[]}var H=e=>Array.isArray(e.parts)?e.parts.filter(I):[],U=e=>BigInt(String(e.startTimeUnixNano)),W=(e,t)=>{let n=U(e)-U(t);return n===0n?0:n<0n?-1:1};function G(e){let t=e.endTimeUnixNano;if(!t)return;let n=U(e),r=BigInt(String(t));if(r<=n)return;let i=Number(n/1000000n),a=Number(r/1000000n);if(!(!Number.isFinite(i)||!Number.isFinite(a)||a<=i))return{startedAt:i,endedAt:a}}function ue(e){let t=G(e);if(t)return{workedMs:t.endedAt-t.startedAt,endedAt:t.endedAt}}function de(e,t){let n=ue(t);if(!n)return e;let r=e.findLastIndex(e=>e.kind===`turn-done`);return r<0?e:e.map((e,t)=>t===r?{...e,...n}:e)}var fe=e=>`content_sha256`in e||`json_sha256`in e;function K(e){let t=e.arguments;if(I(t))return t;if(typeof t!=`string`)return{};try{let e=JSON.parse(t);return I(e)?e:{}}catch{return{}}}function q(e){if(typeof e.content==`string`){if(e.type===`reasoning`)return{type:`thought`,text:e.content};if(e.type===`text`)return{type:`text`,text:e.content}}}function pe(e){let t=[],n=[],r=!1;for(let i of e){let e=H(i),a=e.some(e=>e.type===`text`);for(let i of e){let e=q(i);fe(i)?r=!0:e?t.push(e):i.type===`structured`&&!a?t.push({type:`text`,text:JSON.stringify(i.content)}):i.type===`tool_call`&&typeof i.name==`string`?(n.push(i.name),t.push({type:`tool`,tool:{name:i.name,callId:typeof i.id==`string`?i.id:`replay-${String(n.length)}`,arguments:K(i)}})):(i.type===`blob`||i.type===`uri`)&&(r=!0)}}return{events:t,calls:n,missing:r}}function me(e,t){for(let n=e;n;n=t.get(n.parentSpanId??``)){let e=R(n,`gen_ai.agent.name`);if(R(n,`gen_ai.operation.name`)===`invoke_agent`&&e)return e}return``}var J=e=>R(e,`gen_ai.operation.name`);function he(e){let t=new Map(e.spans.map(e=>[e.spanId,e]));return e.spans.filter(e=>J(e)===`chat`).toSorted(W).map(n=>{let r=pe(V(e,n,`gen_ai.output.messages`)),i=R(n,`theorem.stop.kind`)??`completed`;return{agent:me(n,t),...r,events:[...r.events,{type:`done`,stop:{kind:i}}]}})}function ge(e){return e.spans.filter(e=>J(e)===`execute_tool`).toSorted(W).map(t=>({name:R(t,`gen_ai.tool.name`)??``,result:B(e,t,`gen_ai.tool.call.result`),failed:R(t,`theorem.tool.outcome`)===`error`}))}function Y(e,t){let n=V(e,t,`gen_ai.input.messages`).findLast(e=>e.role===`user`),r=n?H(n):[];return{text:r.flatMap(e=>e.type===`text`&&typeof e.content==`string`?[e.content]:[]).join(`
|
|
2
|
+
`),attachments:r.filter(e=>e.type===`blob`||e.type===`uri`).length}}function _e(e,t){let n=[];for(let r of t.events??[]){if(r.name!==`theorem.grounding`)continue;let i=r.attributes.sources;if(i===void 0)continue;let a=T(e,i);if(!Array.isArray(a))continue;let o=[];for(let e of a)I(e)&&typeof e.title==`string`&&typeof e.uri==`string`&&o.push({title:e.title,uri:e.uri,type:e.type===`maps`?`maps`:`web`,...typeof e.placeId==`string`?{placeId:e.placeId}:{}});if(o.length){let e=R(t,`gen_ai.tool.call.id`);n.push({type:`citation`,sources:o,...e?{callId:e}:{}})}}return n}function ve(e,t){let n=e.spans.filter(e=>J(e)===`execute_tool`).toSorted(W),r=new Set,i=(e,t)=>{let i=n.find(t=>R(t,`gen_ai.tool.call.id`)===e)??n.find(e=>!r.has(e)&&R(e,`gen_ai.tool.name`)===t);return i&&r.add(i),i},a=[];for(let n of V(e,t,`gen_ai.output.messages`))for(let t of H(n)){let n=q(t);if(n)a.push(n);else if(t.type===`structured`&&t.content!==void 0)a.push({type:`structured`,structured:t.content});else if(t.type===`tool_call`&&typeof t.name==`string`){let n=typeof t.id==`string`?t.id:`call-${String(a.length)}`;a.push(...ye(e,t.name,n,K(t),i))}}let o=B(e,t,`theorem.error.public`);t.status.code===`ERROR`&&a.push({type:`error`,errorKind:`internal`,error:o||t.status.message});let s=R(t,`theorem.stop.kind`)??`completed`;return a.push({type:`done`,stop:{kind:s}}),a}function ye(e,t,n,r,i){let a=i(n,t),o={type:`tool`,tool:{name:t,callId:n,arguments:r}};if(!a)return[o];let s=G(a),c=s?.startedAt??Number(U(a)/1000000n),l=s?.endedAt??c,u=B(e,a,`gen_ai.tool.call.result`),d=R(a,`theorem.tool.outcome`)===`error`?{phase:`error`,failure:{code:R(a,`theorem.tool.failure.code`)??`failed`,kind:`internal`,message:u},readBack:u}:{phase:`complete`,output:be(e,a,u),readBack:u};return[o,{type:`tool`,tool:{name:t,callId:n,phase:`running`,at:c}},{type:`tool`,tool:{name:t,callId:n,at:l,...d}},..._e(e,a)]}function be(e,t,n){return`theorem.tool.data`in t.attributes?z(e,t,`theorem.tool.data`):xe(n)}function xe(e){try{return JSON.parse(e)}catch{return e}}var Se=(e,t)=>`${e}:${t}`;function Ce(e,t){if(!t.events.some(e=>e.name===`theorem.compaction`))return!1;let n=Y(e,t);return!n.text&&n.attachments===0}function we(e){let t=new Map,n=new Map,r=(e,t)=>{for(let r of e.spans)n.set(Se(r.traceId,r.spanId),t);t.script.records.push(e)};return e.forEach((e,i)=>{let a=w(e);if(!a||J(a)!==`invoke_agent`||Ce(e,a))return;let o=he(e),s=ge(e),c=a.parentSpanId?n.get(Se(a.traceId,a.parentSpanId)):void 0;if(c){c.turn.calls.push(...o),c.turn.results.push(...s),r(e,c);return}let l=R(a,`gen_ai.agent.name`)??``,u=R(a,`gen_ai.conversation.id`),d=`${l}\u0000${u??``}`,f=t.get(d);f||(f={agent:l,...u===void 0?{}:{conversation:u},turns:[],records:[],recordedAt:Number(U(a)/1000000n)},t.set(d,f));let p=Y(e,a),m={...p,calls:o,results:s,blocks:de(D({text:p.text},ve(e,a),{idPrefix:`recorded-${String(i)}`}),a)};f.turns.push(m),r(e,{turn:m,script:f})}),[...t.values()]}function Te(e){if(e.failed)throw Error(e.result);let t=xe(e.result);return I(t)?t:{result:t}}var Ee=e=>{let t=e%100,n=t>=11&&t<=13?`th`:{1:`st`,2:`nd`,3:`rd`}[e%10]??`th`;return`${String(e)}${n}`};function De(e,t,n){if(!e)return`The profile asked the model a ${Ee(t+1)} time this turn; the recording answered ${String(t)}.`;if(e.missing)return`The recording does not hold all of this reply.`;let r=new Set((n.wireTools??[]).map(e=>e.name)),i=e.calls.find(e=>!r.has(e));return i&&`The recording calls ${i}, which the profile no longer offers.`}function Oe(e,t,n){let r=0,i=new Map,a=new Map,o=t=>{let n=a.get(t);if(!n){n=new Map;for(let r of e.turns[t]?.results??[])n.set(r.name,[...n.get(r.name)??[],r]);a.set(t,n)}return n},s=t=>({async*complete(a){let o=e.turns[r]?.calls.filter(e=>e.agent===t)??[],s=`${String(r)} ${t}`,c=i.get(s)??0;i.set(s,c+1);let l=De(o[c],o.length,a);if(l)throw n({turn:r,agent:t,call:c+1,reason:l}),new C(`request`,`Replay stopped: ${l}`);yield*o[c]?.events??[]}}),c=e=>()=>{let t=o(r).get(e)?.shift();if(!t){let t=`The recording has no further result for ${e}.`;throw n({turn:r,tool:e,reason:t}),new C(`request`,`Replay stopped: ${t}`)}return Te(t)},l=new Set(e.turns.flatMap(e=>e.results.map(e=>e.name)));return{provider:n=>s(n.id===t?e.agent:n.id),toolHandlers:Object.fromEntries([...l].map(e=>[e,c(e)])),startTurn:e=>{r=e}}}function ke(e){return e.map(e=>{if(e.type===`agent`)return e;let{name:t,description:n,category:r,access:i,permission:a,loadTier:o,paths:s}=e;return{type:`function`,name:t,description:n,category:r,access:i,permission:a,loadTier:o,paths:s,inputSchema:e.inputSchema,outputSchema:e.outputSchema,...e.labels?{labels:e.labels}:{},...e.background?{background:e.background}:{}}})}function Ae(e){return{...e,customTools:ke(e.customTools),...e.dependencies?{dependencies:e.dependencies.map(e=>({...e,customTools:ke(e.customTools)}))}:{}}}function je(e){return e.turns.flatMap(e=>e.blocks)}function Me(e,t){let n=E.safeParse(e);if(n.success)return n.data;let r=I(e)?e.v:void 0,i=typeof r==`number`&&r!==3?`This trace is version ${String(r)}${t}; the studio reads version 3.`:`This file is not a Theorem trace${t}.`;throw new C(`request`,i)}function Ne(e){let t=Array.isArray(e)?e:[e];return t.map((e,n)=>Me(e,t.length>1?` (record ${String(n+1)})`:``))}function Pe(e){try{return Ne(JSON.parse(e))}catch(e){if(e instanceof C)throw e}let t=e.split(`
|
|
3
|
+
`).map((e,t)=>({line:e,at:t+1})).filter(({line:e})=>e.trim());if(t.length<2)throw new C(`request`,`This file is not JSON.`);return t.map(({line:e,at:t})=>{let n;try{n=JSON.parse(e)}catch{throw new C(`request`,`Line ${String(t)} of this file is not JSON.`)}return Me(n,` (line ${String(t)})`)})}var X=e(n(),1),Z=t();function Fe(e,t,n){return t?s(e,t,{conversationKey:F(),blocks:n}):o(e,n)}var Q=e=>`turn ${String(e+1)}`;function $({iface:e,feed:t,trace:n,card:r,conversation:i}){let a=ne(e,t,n);return(0,Z.jsxs)(N,{inspector:a,maxWidth:`960px`,requestLabel:`Trace`,children:[r,i]})}function Ie({iface:e,blocks:t,banner:n,chat:r}){let i=m();return(0,Z.jsxs)(A,{label:`Conversation`,children:[n,(0,Z.jsx)(te,{blocks:t,handle:i(`@theorem.agent.handle`,{handle:e.identity.handle}),labels:e.labels,streaming:r?.streaming,delivery:r?.delivery,answering:r?.answering,onToolDecision:r&&((e,t)=>{r.handleToolDecision(e,t)}),onAuthenticated:r&&((e,t)=>{r.handleAuthenticated(e,t)})})]})}function Le({onImport:e}){let[t,n]=(0,X.useState)(),[r,i]=(0,X.useState)(!1);return(0,Z.jsxs)(k,{gap:2,children:[(0,Z.jsx)(ie,{label:`Trace file`,isLabelHidden:!0,mode:`dropzone`,accept:`application/json,.json,.jsonl`,isLoading:r,placeholder:`Drop a trace (.json or .jsonl) or choose a file`,value:null,changeAction:async t=>{let r=Array.isArray(t)?t[0]:t;if(r){i(!0);try{let t=Pe(await r.text());e({name:r.name,records:t}),n(void 0)}catch(e){n(e instanceof Error?e.message:String(e))}finally{i(!1)}}},onChange:()=>void 0}),t?(0,Z.jsx)(P,{status:`error`,title:t}):null]})}var Re=e=>e.recordedAt===void 0?void 0:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(e.recordedAt);function ze({shown:e,onShown:t}){return(0,Z.jsx)(ee,{label:`Replayed`,tooltip:e===`replayed`?`Recorded`:`Replayed`,size:`sm`,isIconOnly:!0,icon:(0,Z.jsx)(f,{icon:S,size:`sm`}),pressedIcon:(0,Z.jsx)(f,{icon:le,size:`sm`}),isPressed:e===`replayed`,onPressedChange:e=>{t(e?`replayed`:`recorded`)}})}function Be({controls:e}){let{script:t,payload:n}=e,i=t.turns.length,a=[t.agent||`No agent`,`${String(i)} ${i===1?`turn`:`turns`}`,Re(t)];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(O,{gap:2,vAlign:`center`,children:[(0,Z.jsx)(r,{size:`fill`,children:(0,Z.jsxs)(k,{gap:0,children:[(0,Z.jsx)(p,{type:`label`,maxLines:1,children:e.opened.name}),(0,Z.jsx)(p,{type:`supporting`,color:`secondary`,maxLines:1,children:a.filter(Boolean).join(` · `)})]})}),(0,Z.jsx)(_,{label:`Clear trace`,variant:`ghost`,size:`sm`,icon:(0,Z.jsx)(f,{icon:d,size:`sm`}),isDisabled:e.isRunning,onClick:e.onClear})]}),e.count>1?(0,Z.jsxs)(O,{gap:1,vAlign:`center`,children:[(0,Z.jsx)(_,{label:`Previous conversation`,variant:`ghost`,size:`sm`,icon:(0,Z.jsx)(f,{icon:v,size:`sm`}),isDisabled:e.isRunning||e.picked===0,onClick:()=>{e.onPick(e.picked-1)}}),(0,Z.jsxs)(p,{type:`supporting`,children:[`Conversation `,String(e.picked+1),` of `,String(e.count)]}),(0,Z.jsx)(_,{label:`Next conversation`,variant:`ghost`,size:`sm`,icon:(0,Z.jsx)(f,{icon:y,size:`sm`}),isDisabled:e.isRunning||e.picked===e.count-1,onClick:()=>{e.onPick(e.picked+1)}})]}):null,t.agent&&t.agent!==n.profile.id?(0,Z.jsx)(P,{status:`info`,title:`Recorded with ${t.agent}; a replay runs through ${n.profile.id}.`}):null,i===0?(0,Z.jsx)(P,{status:`info`,title:`This trace holds no conversation to replay.`}):null,(0,Z.jsx)(re,{label:`Live tools`,description:`Run the profile's tools instead of answering them from the recording.`,value:e.liveTools,onChange:e.onLiveTools})]})}var Ve=()=>void 0;function He({onImport:e,controls:t}){let n=t?.onReplay??Ve;return(0,Z.jsxs)(j,{title:`Trace`,onRun:n,actions:t?.shown?(0,Z.jsx)(ze,{shown:t.shown,onShown:t.onShown}):null,children:[(0,Z.jsx)(Le,{onImport:e}),t?(0,Z.jsx)(Be,{controls:t}):null,(0,Z.jsx)(M,{note:t?`Answers each model call from the recording, so it needs no keys.`:null,isReady:(t?.script.turns.length??0)>0,isRunning:t?.isRunning??!1,runLabel:t?.shown?`Replay again`:`Replay`,runningLabel:`Replaying`,stopLabel:`Stop`,onRun:n,onStop:t?.onStop??Ve})]})}function Ue({status:e,turns:t,onContinue:n,onLive:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(),c=e=>(0,Z.jsx)(g,{label:`Continue live`,variant:`secondary`,size:`sm`,isLoading:i,onClick:async()=>{a(!0),s(void 0);try{await r(e)}catch(e){s(e instanceof Error?e.message:String(e)),a(!1)}}}),l=(()=>{switch(e.kind){case`running`:return(0,Z.jsx)(P,{status:`info`,title:`Replaying ${Q(e.turn)} of ${String(t)}`});case`waiting`:return(0,Z.jsx)(P,{status:`info`,title:`${Q(e.turn-1)} waits on you`,description:`Answer it in the conversation, then continue the replay.`,endContent:(0,Z.jsx)(g,{label:`Continue replay`,variant:`secondary`,size:`sm`,onClick:()=>{n(e.turn)}})});case`missing`:return(0,Z.jsx)(P,{status:`warning`,title:`Replay stopped before ${Q(e.turn)}`,description:`It was sent with files, and a trace never holds a file's bytes. Continue live to send it again with yours.`,endContent:c(e.turn)});case`diverged`:{let t=e.divergence,n=`tool`in t?`the ${t.tool} tool`:`${t.agent}'s model call ${String(t.call)}`;return(0,Z.jsx)(P,{status:`warning`,title:`Replay stopped at ${Q(t.turn)}, ${n}`,description:t.reason,endContent:c(t.turn)})}case`stopped`:return(0,Z.jsx)(P,{status:`info`,title:`Replay stopped at ${Q(e.turn)}`,description:`You stopped it. Continue live to go on from here with the profile's model.`,endContent:c(e.turn)});case`failed`:return(0,Z.jsx)(P,{status:`error`,title:`Replay stopped at ${Q(e.turn)}`,description:e.message,endContent:c(e.turn)});case`done`:return(0,Z.jsx)(P,{status:`success`,title:`Replayed ${String(t)} ${t===1?`turn`:`turns`}`,description:`Every model call this profile made was one the recording answered.`})}})();return(0,Z.jsxs)(k,{gap:1,children:[l,o?(0,Z.jsx)(P,{status:`error`,title:o}):null]})}function We({payload:e,iface:t,trace:n,card:r,records:a,script:o,shown:s,liveTools:c,runtime:d,onLive:f}){let p=se(),{actingAs:m}=oe(),h=(0,X.useRef)(void 0),[g,_]=(0,X.useState)({kind:`running`,turn:0}),[v]=(0,X.useState)(l),y=(0,X.useMemo)(()=>u(a),[a]),x=(0,X.useMemo)(()=>Oe(o,e.profile.id,e=>{h.current??=e}),[o,e.profile.id]),S=(0,X.useMemo)(()=>i(c?e:Ae(e),{mode:`byok`,provider:x.provider,...c?{}:{toolHandlers:x.toolHandlers}},{conversationKey:F(),traces:v}),[e,x,c,v]),C=(0,X.useMemo)(()=>c?b(e):void 0,[c,e]),w=ae({transport:S,iface:t,pageTools:C}),{sendText:T,handleStop:E}=w,D=(0,X.useRef)(w.phase);D.current=w.phase;let[O,k]=(0,X.useState)(0),A=(0,X.useRef)(!1),j=(0,X.useRef)(E);j.current=E,(0,X.useEffect)(()=>()=>j.current(),[]),(0,X.useEffect)(()=>{let e=!1,t=async()=>{for(;!e&&D.current===`streaming`;)await new Promise(e=>requestAnimationFrame(e))};return(async()=>{for(let n=O;n<o.turns.length;n+=1){if(await t(),e||A.current)return;if(D.current===`gated`)return x.startTurn(n-1),_({kind:`waiting`,turn:n});let{text:r,attachments:i}=o.turns[n];if(i>0)return _({kind:`missing`,turn:n});x.startTurn(n),_({kind:`running`,turn:n});try{let t=await T(r);if(e||A.current)return;if(h.current)return _({kind:`diverged`,divergence:h.current});t||--n}catch(e){let t=e instanceof Error?e.message:String(e);return _({kind:`failed`,turn:n,message:t})}}_({kind:`done`})})(),()=>{e=!0}},[O,x,o,T]);let M=async t=>{let n=o.turns.slice(0,t).flatMap(e=>e.blocks);f({...p?await ce(p,e.agentId,n,m):await Fe(e,d,n),text:o.turns[t]?.text??``})},N=s===`replayed`;return(0,Z.jsx)($,{iface:t,feed:N?v:y,trace:n,card:r({isRunning:g.kind===`running`,onStop:()=>{A.current=!0,E(),_(e=>e.kind===`running`?{kind:`stopped`,turn:e.turn}:e)}}),conversation:(0,Z.jsx)(Ie,{iface:t,blocks:N?[...w.blocks,...w.streamBlocks]:je(o),chat:N?w:void 0,banner:N?(0,Z.jsx)(Ue,{status:g,turns:o.turns.length,onContinue:k,onLive:M}):void 0})})}function Ge(e){return(0,Z.jsx)(c,{children:(0,Z.jsx)(h,{labels:x,children:(0,Z.jsx)(Je,{...e})})})}var Ke={agent:``,turns:[],records:[]};function qe(e,t,n){if(t.length<=1||!n)return e;let r=new Set(t.flatMap(e=>e.records)),i=new Set(n.records);return e.filter(e=>i.has(e)||!r.has(e))}function Je({payload:e,trace:t,runtime:n,onLive:r,opened:i,onOpened:o,onClear:s}){let c=(0,X.useMemo)(()=>a(e),[e]),l=(0,X.useMemo)(()=>i?we(i.records):[],[i]),[d,f]=(0,X.useState)(),p=d&&d.of===i?d.index:0,m=i?l[p]??Ke:void 0,h=(0,X.useMemo)(()=>qe(i?.records??[],l,m),[i,l,m]),g=(0,X.useMemo)(()=>u(h),[h]),[_,v]=(0,X.useState)(),[y,b]=(0,X.useState)(!1),x=_&&_.of===m&&_.agent===e.profile.id?_:void 0,S=x?.attempt??0,C=x?.shown??`recorded`,w=e=>{x&&v({...x,shown:e})},T=()=>{m&&v({of:m,agent:e.profile.id,attempt:S+1,shown:`replayed`})};if(c.type===`live`)return null;if(!i||!m)return(0,Z.jsx)($,{iface:c,feed:g,trace:t,card:(0,Z.jsx)(He,{onImport:o}),conversation:null});let E=({isRunning:t,onStop:n})=>(0,Z.jsx)(He,{onImport:o,controls:{opened:i,script:m,picked:p,count:l.length,onPick:e=>{f({of:i,index:e})},payload:e,shown:S>0?C:null,onShown:w,liveTools:y,onLiveTools:e=>{b(e),S>0&&T()},isRunning:t,onReplay:T,onStop:n,onClear:s}});return S===0?(0,Z.jsx)($,{iface:c,feed:g,trace:t,card:E({isRunning:!1,onStop:()=>void 0}),conversation:(0,Z.jsx)(Ie,{iface:c,blocks:je(m)})}):(0,Z.jsx)(We,{payload:e,iface:c,trace:t,card:E,records:h,script:m,shown:C,liveTools:y,runtime:n,onLive:r},S)}export{Ge as TraceReplay};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./themeProps-3IqahpCr.js";import{t}from"./StackItem-YZCLellt.js";import{t as n}from"./Text-B74VhVA7.js";import{t as r}from"./HStack-cOiUht-L.js";import{t as i}from"./VStack-CEcm-qoM.js";import{t as a}from"./Card-D_40unTk.js";var o=e(),s={clear:`light-dark(#0d1e37, #b4c6e2)`,shade1:`light-dark(#3b5580, #6582ad)`,shade2:`light-dark(#7f95b7, #3b5078)`,shade3:`light-dark(#bcc8da, #22345a)`,failed:`light-dark(#8e2a28, #cd5f55)`},c=`light-dark(#e4e7ec, #2b2f36)`,l=`light-dark(#9aa3b1, #6b727d)`,u=s.clear,d=`var(--color-background-surface)`,f={model:`clear`,tool:`hatch`,host:`shade1`,theorem:`shade2`,user:`shade3`,error:`failed`};function p(e){return e===`hatch`?`url(#trace-fill-hatch)`:s[e]}function m(){return(0,o.jsx)(`svg`,{"aria-hidden":!0,width:0,height:0,style:{position:`absolute`},children:(0,o.jsx)(`defs`,{children:(0,o.jsxs)(`pattern`,{id:`trace-fill-hatch`,width:3,height:3,patternUnits:`userSpaceOnUse`,patternTransform:`rotate(45)`,children:[(0,o.jsx)(`rect`,{width:3,height:3,fill:c}),(0,o.jsx)(`line`,{x1:0,y1:0,x2:0,y2:3,stroke:l,strokeWidth:1.2})]})})})}function h({fill:e}){return(0,o.jsx)(`svg`,{"aria-hidden":!0,width:10,height:10,style:{display:`block`,flexShrink:0},children:(0,o.jsx)(`rect`,{width:10,height:10,rx:2,fill:p(e)})})}var g={background:`var(--theorem-console-card, var(--color-background-surface))`,borderRadius:`var(--radius-page)`};function _({title:e,value:a,note:s,aside:c,detail:l,children:d}){let f=(0,o.jsx)(n,{type:`supporting`,color:`secondary`,children:e}),p=l?(0,o.jsxs)(i,{gap:1,children:[f,(0,o.jsx)(n,{type:`supporting`,maxLines:2,children:l})]}):f;return(0,o.jsxs)(i,{gap:3,children:[c?(0,o.jsxs)(r,{gap:3,vAlign:`center`,children:[(0,o.jsx)(t,{size:`fill`,children:p}),c]}):p,(0,o.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,flexWrap:`wrap`,columnGap:8},children:[(0,o.jsx)(n,{size:`2xl`,weight:`medium`,hasTabularNumbers:!0,children:a}),s?(0,o.jsx)(n,{type:`supporting`,hasTabularNumbers:!0,children:(0,o.jsx)(`span`,{style:{color:u},children:s})}):null]}),d]})}function v(e){return(0,o.jsx)(a,{variant:`muted`,padding:4,style:g,children:(0,o.jsx)(_,{...e})})}export{d as a,p as c,v as i,g as n,m as o,_ as r,h as s,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{o as e}from"./editor.api-BldS301e.js";var t={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{lineComment:`//`,blockComment:[`/*`,`*/`]},brackets:[[`{`,`}`],[`[`,`]`],[`(`,`)`]],onEnterRules:[{beforeText:/^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,afterText:/^\s*\*\/$/,action:{indentAction:e.IndentAction.IndentOutdent,appendText:` * `}},{beforeText:/^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,action:{indentAction:e.IndentAction.None,appendText:` * `}},{beforeText:/^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,action:{indentAction:e.IndentAction.None,appendText:`* `}},{beforeText:/^(\t|(\ \ ))*\ \*\/\s*$/,action:{indentAction:e.IndentAction.None,removeText:1}}],autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`,notIn:[`string`]},{open:`'`,close:`'`,notIn:[`string`,`comment`]},{open:"`",close:"`",notIn:[`string`,`comment`]},{open:`/**`,close:` */`,notIn:[`string`]}],folding:{markers:{start:RegExp(`^\\s*//\\s*#?region\\b`),end:RegExp(`^\\s*//\\s*#?endregion\\b`)}}},n={defaultToken:`invalid`,tokenPostfix:`.ts`,keywords:`abstract.any.as.asserts.bigint.boolean.break.case.catch.class.continue.const.constructor.debugger.declare.default.delete.do.else.enum.export.extends.false.finally.for.from.function.get.if.implements.import.in.infer.instanceof.interface.is.keyof.let.module.namespace.never.new.null.number.object.out.package.private.protected.public.override.readonly.require.global.return.satisfies.set.static.string.super.switch.symbol.this.throw.true.try.type.typeof.undefined.unique.unknown.var.void.while.with.yield.async.await.of`.split(`.`),operators:`<=.>=.==.!=.===.!==.=>.+.-.**.*./.%.++.--.<<.</.>>.>>>.&.|.^.!.~.&&.||.??.?.:.=.+=.-=.*=.**=./=.%=.<<=.>>=.>>>=.&=.|=.^=.@`.split(`.`),symbols:/[=><!~?:&|+\-*\/\^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/[{}]/,`delimiter.bracket`],{include:`common`}],common:[[/#?[a-z_$][\w$]*/,{cases:{"@keywords":`keyword`,"@default":`identifier`}}],[/[A-Z][\w\$]*/,`type.identifier`],{include:`@whitespace`},[/\/(?=([^\\\/]|\\.)+\/([dgimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,{token:`regexp`,bracket:`@open`,next:`@regexp`}],[/[()\[\]]/,`@brackets`],[/[<>](?!@symbols)/,`@brackets`],[/!(?=([^=]|$))/,`delimiter`],[/@symbols/,{cases:{"@operators":`delimiter`,"@default":``}}],[/(@digits)[eE]([\-+]?(@digits))?/,`number.float`],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/,`number.float`],[/0[xX](@hexdigits)n?/,`number.hex`],[/0[oO]?(@octaldigits)n?/,`number.octal`],[/0[bB](@binarydigits)n?/,`number.binary`],[/(@digits)n?/,`number`],[/[;,.]/,`delimiter`],[/"([^"\\]|\\.)*$/,`string.invalid`],[/'([^'\\]|\\.)*$/,`string.invalid`],[/"/,`string`,`@string_double`],[/'/,`string`,`@string_single`],[/`/,`string`,`@string_backtick`]],whitespace:[[/[ \t\r\n]+/,``],[/\/\*\*(?!\/)/,`comment.doc`,`@jsdoc`],[/\/\*/,`comment`,`@comment`],[/\/\/.*$/,`comment`]],comment:[[/[^\/*]+/,`comment`],[/\*\//,`comment`,`@pop`],[/[\/*]/,`comment`]],jsdoc:[[/[^\/*]+/,`comment.doc`],[/\*\//,`comment.doc`,`@pop`],[/[\/*]/,`comment.doc`]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,[`regexp.escape.control`,`regexp.escape.control`,`regexp.escape.control`]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[`regexp.escape.control`,{token:`regexp.escape.control`,next:`@regexrange`}]],[/(\()(\?:|\?=|\?!)/,[`regexp.escape.control`,`regexp.escape.control`]],[/[()]/,`regexp.escape.control`],[/@regexpctl/,`regexp.escape.control`],[/[^\\\/]/,`regexp`],[/@regexpesc/,`regexp.escape`],[/\\\./,`regexp.invalid`],[/(\/)([dgimsuy]*)/,[{token:`regexp`,bracket:`@close`,next:`@pop`},`keyword.other`]]],regexrange:[[/-/,`regexp.escape.control`],[/\^/,`regexp.invalid`],[/@regexpesc/,`regexp.escape`],[/[^\]]/,`regexp`],[/\]/,{token:`regexp.escape.control`,next:`@pop`,bracket:`@close`}]],string_double:[[/[^\\"]+/,`string`],[/@escapes/,`string.escape`],[/\\./,`string.escape.invalid`],[/"/,`string`,`@pop`]],string_single:[[/[^\\']+/,`string`],[/@escapes/,`string.escape`],[/\\./,`string.escape.invalid`],[/'/,`string`,`@pop`]],string_backtick:[[/\$\{/,{token:`delimiter.bracket`,next:`@bracketCounting`}],[/[^\\`$]+/,`string`],[/@escapes/,`string.escape`],[/\\./,`string.escape.invalid`],[/`/,`string`,`@pop`]],bracketCounting:[[/\{/,`delimiter.bracket`,`@bracketCounting`],[/\}/,`delimiter.bracket`,`@pop`],{include:`common`}]}};export{t as conf,n as language};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,u as n}from"./themeProps-3IqahpCr.js";import{S as r,T as i}from"./browser-transport-EFTTaxlW.js";import{t as a}from"./Icon-BWzSKxTK.js";import{t as o}from"./Text-B74VhVA7.js";import{n as s,o as c}from"./labels-provider-BcEDhptf.js";import{t as l}from"./useLocale-DrfYfZTs.js";import{t as u}from"./IconButton-CerBBPke.js";import{t as d}from"./Tooltip-DrSpWxD8.js";import{d as f}from"./reader-SzTjS7rw.js";import{t as p}from"./HStack-cOiUht-L.js";import{t as m}from"./VStack-CEcm-qoM.js";import{_ as h,b as g,g as _,y as v}from"./ConsoleFrame-BL1z2eD0.js";import{c as y,i as b}from"./trace-patterns-86-gKv3I.js";import{n as x}from"./studio-console-DUEQORQA.js";import{B as S,it as C,st as w,z as T}from"./index-D-vL6Brp.js";var E=e(n(),1),D=t(),O=`var(--duration-medium) var(--ease-standard)`,k=12;function A(){let e=l();return(0,E.useMemo)(()=>({percent:new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),decimal:new Intl.NumberFormat(e,{maximumFractionDigits:2}),usd:new Intl.NumberFormat(e,{style:`currency`,currency:`USD`,maximumSignificantDigits:2})}),[e])}function j(e){return y(e?`clear`:`shade2`)}function M({value:e,isLead:t}){return(0,D.jsx)(`div`,{style:{height:k,width:`${String(Math.max(e,.01)*100)}%`,borderRadius:4,background:j(t),transition:`width ${O}`}})}function N({title:e,aside:t,detail:n,answer:r}){let i=s(),a=A(),c=Object.entries(r.probabilities).sort(([,e],[,t])=>t-e);return(0,D.jsx)(b,{title:e,aside:t,detail:n,value:r.choice,note:i(`@theorem.decision.confidence`,{percent:a.percent.format(r.confidence)}),children:(0,D.jsx)(m,{gap:2,role:`list`,children:c.map(([e,t])=>(0,D.jsxs)(m,{gap:1,role:`listitem`,"aria-label":i(`@theorem.decision.option`,{label:e,percent:a.percent.format(t)}),children:[(0,D.jsxs)(p,{gap:2,hAlign:`between`,"aria-hidden":!0,children:[(0,D.jsx)(o,{type:`supporting`,color:`secondary`,maxLines:1,children:e}),(0,D.jsx)(o,{type:`supporting`,hasTabularNumbers:!0,children:a.percent.format(t)})]}),(0,D.jsx)(M,{value:t,isLead:e===r.choice})]},e))})})}var P=56;function F(e){let t=e.split(/[:—–]\s/)[0]?.trim()??``;return t&&t.length<=32&&t!==e?t:e}function I({title:e,aside:t,detail:n,answer:r,labels:i}){let a=s(),c=A(),l=i.length,u=Math.min(l-1,Math.max(0,Math.round(r.score)));return(0,D.jsx)(b,{title:e,aside:t,detail:n,value:i[u]===void 0?c.decimal.format(r.score):F(i[u]),note:[a(`@theorem.decision.score_of`,{score:c.decimal.format(r.score),max:c.decimal.format(l-1)}),a(`@theorem.decision.confidence`,{percent:c.percent.format(r.confidence)})].join(` · `),children:(0,D.jsxs)(m,{gap:1,children:[(0,D.jsxs)(`div`,{"aria-hidden":!0,style:{position:`relative`,display:`flex`,alignItems:`flex-end`,gap:4,height:P},children:[i.map((e,t)=>(0,D.jsx)(`div`,{style:{flex:1,height:`${String(Math.max(.04,r.probabilities[String(t)]??0)*100)}%`,borderRadius:4,background:j(t===u),transition:`height ${O}`}},`${String(t)}:${e}`)),(0,D.jsx)(`div`,{style:{position:`absolute`,insetBlock:-4,left:`${String((r.score+.5)/l*100)}%`,width:0,borderInlineStart:`1.5px dashed var(--color-text-secondary)`,transition:`left ${O}`}})]}),(0,D.jsx)(`div`,{style:{display:`flex`,gap:4},children:i.map((e,t)=>(0,D.jsx)(`div`,{style:{flex:1,minWidth:0},title:e,children:(0,D.jsx)(o,{type:`supporting`,color:`secondary`,maxLines:1,children:F(e)})},`${String(t)}:${e}`))}),(0,D.jsx)(`span`,{style:{position:`absolute`,width:1,height:1,overflow:`hidden`,clipPath:`inset(50%)`},children:i.map((e,t)=>a(`@theorem.decision.option`,{label:e,percent:c.percent.format(r.probabilities[String(t)]??0)})).join(`; `)})]})})}function L({title:e,aside:t,detail:n,answer:r}){let i=A();return(0,D.jsx)(b,{title:e,aside:t,detail:n,value:i.decimal.format(r.noul)})}var R=72,z=168;function B(e){let[t,n]=(0,E.useState)(null);return(0,E.useEffect)(()=>{let t=new Image;t.onload=()=>{n({width:t.naturalWidth,height:t.naturalHeight})},t.src=e},[e]),t}function V(e,t){let n=e.style.color;e.style.color=`var(${t})`;let r=getComputedStyle(e).color;return e.style.color=n,r}function H({source:e,box:t,caption:n}){let r=s(),i=v(e),a=B(i),[o,c]=(0,E.useState)(null);if(!a)return null;let l=h(t),u=a.width*(t.right-t.left)/(a.height*(t.bottom-t.top)),f=r(`@theorem.decision.open_box`);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{content:f,children:(0,D.jsx)(w,{label:f,padding:0,onClick:e=>{let n={outline:V(e.currentTarget,`--color-accent`),shade:V(e.currentTarget,`--color-overlay`)};g(i,t,n).then(c)},children:(0,D.jsx)(`div`,{role:`img`,"aria-label":r(`@theorem.decision.box_in`),style:{position:`relative`,overflow:`hidden`,aspectRatio:String(u),height:z,maxWidth:`100%`,borderRadius:4},children:(0,D.jsx)(`img`,{src:i,alt:``,style:{position:`absolute`,width:`${String(l.width)}%`,height:`${String(l.height)}%`,left:`${String(l.left)}%`,top:`${String(l.top)}%`,maxWidth:`none`}})})})}),(0,D.jsx)(C,{isOpen:o!==null,onOpenChange:e=>{e||c(null)},media:{src:o??i,alt:r(`@theorem.decision.box_marked`),caption:n},hasZoom:!0})]})}function U({title:e,aside:t,detail:n,answer:r,image:i,asked:a}){let o=s(),c=a&&_(a.images,a.state,i),l=A(),{top:u,bottom:d,left:f,right:p}=r.box,m=o(`@theorem.decision.box_edges`,{left:l.percent.format(f),top:l.percent.format(u),right:l.percent.format(p),bottom:l.percent.format(d)});return(0,D.jsx)(b,{title:e,aside:t,detail:n,value:m,note:o(`@theorem.decision.confidence`,{percent:l.percent.format(r.confidence)}),children:c?(0,D.jsx)(H,{source:c,box:r.box,caption:`${e}: ${m}`}):(0,D.jsx)(`div`,{"aria-hidden":!0,style:{position:`relative`,height:R,borderRadius:4,border:`1px solid var(--color-border)`},children:(0,D.jsx)(`div`,{style:{position:`absolute`,insetInlineStart:`${String(f*100)}%`,insetBlockStart:`${String(u*100)}%`,width:`${String((p-f)*100)}%`,height:`${String((d-u)*100)}%`,borderRadius:2,background:j(!0),transition:`all ${O}`}})})})}function W({question:e,answer:t,asked:n,onQuestion:r,detail:o}){let c=s(),l=`${e.id} · ${c(`@theorem.decision.type.${e.type}`)}`;if(!t)return null;let d=c(`@theorem.decision.edit_question`,{question:e.id}),f={title:l,detail:o,aside:r?(0,D.jsx)(u,{label:d,tooltip:d,size:`sm`,variant:`ghost`,icon:(0,D.jsx)(a,{icon:i,size:`xsm`,color:`secondary`}),onClick:()=>{r(e.id)}}):void 0};return t.type===`choice`?(0,D.jsx)(N,{...f,answer:t}):t.type===`score`?(0,D.jsx)(I,{...f,answer:t,labels:e.labels}):t.type===`noul`?(0,D.jsx)(L,{...f,answer:t}):(0,D.jsx)(U,{...f,answer:t,image:e.image,asked:n})}function G({model:e,usage:t,elapsedMs:n,isStale:r,tokens:i,children:a}){let l=s(),u=A();return(0,D.jsx)(S,{children:(0,D.jsxs)(m,{gap:3,style:{opacity:r?.5:1,transition:`opacity ${O}`},"aria-busy":r,children:[a,(0,D.jsx)(T,{children:(0,D.jsx)(o,{type:`supporting`,color:`secondary`,hasTabularNumbers:!0,children:c(l,u.usd,{model:e,usage:t,elapsedMs:n,tokens:i})})})]},n??0)})}function K({iface:e,result:t,elapsedMs:n,isStale:r,asked:i,onQuestion:a,questionText:o}){let c=s();return(0,D.jsx)(G,{model:t.model,usage:t.usage,elapsedMs:n,isStale:r,tokens:e=>c(`@theorem.decision.tokens`,{count:e}),children:(0,D.jsx)(x,{minWidth:260,children:e.questions.map(e=>(0,D.jsx)(T,{children:(0,D.jsx)(W,{question:e,answer:t.answers[e.id],asked:i,onQuestion:a,detail:o?.[e.id]})},e.id))})})}var q={status:`idle`,result:null,elapsedMs:null,startedAt:null,failure:null};function J(e,t){for(let n of t??[])e.traces?.push(n)}function Y(e,t,n){let[i,a]=(0,E.useState)(q),o=(0,E.useRef)(null);(0,E.useEffect)(()=>()=>o.current?.abort(),[]);let s=(0,E.useCallback)(()=>{o.current?.abort(),o.current=null,a(e=>e.status===t?{...e,status:e.result?`done`:`idle`,startedAt:null}:e)},[t]),c=(0,E.useCallback)(async(...i)=>{o.current?.abort();let s=new AbortController;o.current=s,a(e=>({status:t,result:e.result,elapsedMs:e.elapsedMs,startedAt:Date.now(),failure:null}));let c=performance.now();try{let t=await n(e,s.signal,...i);if(s.signal.aborted)return;J(e,t.traces),a({status:`done`,result:t.result,elapsedMs:performance.now()-c,startedAt:null,failure:null})}catch(t){if(s.signal.aborted)return;J(e,f(t)),a(e=>({...e,status:`error`,startedAt:null,failure:r(t)}))}finally{o.current===s&&(o.current=null)}},[e,t,n]);return{...i,call:c,cancel:s}}export{A as a,K as i,G as n,M as r,Y as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./themeProps-3IqahpCr.js";function n(e){return e.replace(/[\x00-\x1f\x7f]/g,``).trim()}function r(e){return e.toLowerCase().replace(/^([a-z][a-z\d+.-]*:) +/,`$1`)}function i(e){let t=n(e),i=r(t);return i.startsWith(`javascript:`)||i.startsWith(`vbscript:`)||i.startsWith(`data:text/html`)?null:t}function a(e){return i(e)!==null}function o(e){if(e==null)return!0;if(typeof e==`string`)return a(e);if(typeof e!=`object`)return!1;let{pathname:t,href:r,protocol:i,host:o,hostname:s}=e;for(let e of[t,r,i,o,s])if(e!=null&&typeof e!=`string`)return!1;if(typeof t==`string`&&!a(t)||typeof r==`string`&&!a(r))return!1;if(typeof i==`string`&&i!==``){let e=n(i),r=e.endsWith(`:`)?e:`${e}:`;if(!a(r)||!a(`${r}${o||s||``}${typeof t==`string`?t:``}`))return!1}return!0}var s=e(t(),1),c=`data-astryx-live-region`,l=`position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;inset-block-start:0;inset-inline-start:0;pointer-events:none;user-select:none;`,u=2e3,d={polite:null,assertive:null};function f(e){let t=d[e];t!=null&&(clearTimeout(t),d[e]=null)}var p={polite:new Set,assertive:new Set};function m(e){for(let t of p[e])cancelAnimationFrame(t);p[e].clear()}function h(e,t){f(e),d[e]=setTimeout(()=>{d[e]=null,t.textContent=``},u)}var g=null;function _(e){let t=document.createElement(`div`);return t.setAttribute(c,e),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-atomic`,`true`),t.setAttribute(`role`,e===`assertive`?`alert`:`status`),t.style.cssText=l,document.body.appendChild(t),t}function v(){return typeof document>`u`?null:g?(g.polite.isConnected||document.body.appendChild(g.polite),g.assertive.isConnected||document.body.appendChild(g.assertive),g):(g={polite:_(`polite`),assertive:_(`assertive`)},g)}function y(e,t){let n=v();if(!n)return;let r=t===`assertive`?n.assertive:n.polite;r.textContent=``;let i=requestAnimationFrame(()=>{p[t].delete(i),r.textContent=e});p[t].add(i),h(t,r)}function b(e){if(m(e),f(e),!g)return;let t=e===`assertive`?g.assertive:g.polite;t.textContent=``}function x(){return(0,s.useCallback)((e,t=`polite`)=>{e?y(e,t):b(t)},[])}export{i,o as n,a as r,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,s as i,u as a}from"./themeProps-3IqahpCr.js";import{a as o,h as s,n as c,o as l,s as u,t as d,y as f}from"./padding.stylex-B76907Zf.js";import{n as p}from"./Stack-DPSs1dBF.js";import{n as m}from"./StackItem-YZCLellt.js";import{t as h}from"./mergeProps-ptS-gIMz.js";import{n as g}from"./useLayerDismissal-BAnTRYTt.js";import{p as _}from"./fieldParts-CNKpMZ7U.js";import{x as v}from"./Icon-BWzSKxTK.js";import{r as y}from"./useResolvedRequired-CAelf7J-.js";import{r as b}from"./focusOutline.stylex-B9nWSXsG.js";import{a as x}from"./useTooltip-BaCjTHk-.js";import{n as S}from"./IconButton-CerBBPke.js";import{t as C}from"./useAnnounce-DlZth-he.js";import{t as w}from"./focusableSelector-DXZeMU85.js";import{t as T}from"./useDevWarning-Z9SoixOP.js";var E=e(a(),1),D=(0,E.createContext)(null);D.displayName=`LayoutAreaContext`;var O=f({hasHeader:!1,hasFooter:!1,hasStart:!1,hasEnd:!1});O.displayName=`LayoutSlotsContext`;var k=f(null);k.displayName=`LayoutDividerContext`;function A(e,t){return e==null?`fallback:${typeof t==`function`?t():t}`:`id:${e}`}var j=typeof Intl.Segmenter==`function`?new Intl.Segmenter(void 0,{granularity:`grapheme`}):null;function M(e){return j?[...j.segment(e)].map(e=>e.segment):[...e]}function N(e){return e===``?0:M(e).length}function P(e){if(j){let t=j.segment(e)[Symbol.iterator]().next();return t.done?``:t.value.segment}let t=e.codePointAt(0);return t==null?``:String.fromCodePoint(t)}function F(e,t,n=`…`){let r=M(e);if(r.length<=t)return e;let i=Math.max(t-N(n),0);return r.slice(0,i).join(``)+n}function I(e){let t=e.auxiliaryData;return typeof t?.group==`string`?t.group:void 0}function L(e,{ungroupedFirst:t=!1}={}){if(!e.some(e=>I(e)!=null))return[{heading:null,items:e}];let n=[],r=new Map,i=[];for(let t of e){let e=I(t);e==null?i.push(t):(r.has(e)||(n.push(e),r.set(e,[])),r.get(e)?.push(t))}let a=n.map(e=>({heading:e,items:r.get(e)??[]})),o=i.length>0?[{heading:null,items:i}]:[];return t?[...o,...a]:[...a,...o]}var R=t();function z(e){if(e==null||typeof e==`number`)return!0;let t=e.trim().toLowerCase();return t.includes(`%`)?!1:t===`0`||/^-?(?:\d+(?:\.\d+)?|\.\d+)[a-z]+$/.test(t)||/^(?:calc|min|max|clamp)\(/.test(t)}var B={layoutOuter:{keTefX:`xojxgvx`,k71WvV:`x1fcf3bl`,keoZOQ:`x1sa9bsh`,k1K539:`x6h7pi7`,$$css:!0},layoutInner:{"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,"--layout-content-width":`x15lplax`,"--layout-alignment-width":`x19kr0ht`,"--layout-padding-own-outer-x":`x1vii845`,"--layout-padding-own-outer-y":`xojybgt`,$$css:!0},fill:{kZKoxP:`x12qplqi`,kskxy:`xenllk4`,$$css:!0},auto:{kAzted:`x1us19tq`,$$css:!0},middle:{kUk6DE:`x98rzlu`,kAzted:`x2lwn1j`,$$css:!0},middleQuery:{k9g6sI:`xsw3flo`,$$css:!0},singleColumnContent:{kzqmXN:`xh8yej3`,ks0D6T:`xjl2t3p xpgkkid`,kUOVxO:`xvueqy4`,$$css:!0},singlePanelMiddle:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,ks0D6T:`xjl2t3p xnpzo02`,kUOVxO:`xvueqy4 xb0m1lw`,$$css:!0},singleStartPanel:{kZCmMZ:`x1vvd0s7`,$$css:!0},singleEndPanel:{kwRFfy:`xxdn8bs`,$$css:!0},fullBleed:{"--layout-padding-own-outer-x":`xbjcssu`,"--layout-padding-own-outer-y":`x1bz2q72`,$$css:!0}},V={kzqmXN:`xh8yej3`,kUOVxO:`xvueqy4`,$$css:!0},H={contentWidthVar:e=>[{"--layout-content-width":(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`x4906uf`,$$css:!0},{"--x---layout-content-width":(typeof e==`number`?`${e}px`:e)==null?void 0:typeof e==`number`?`${e}px`:e}],contentAlignmentWidthVar:e=>[{"--layout-alignment-width":(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`x1b1nz06`,$$css:!0},{"--x---layout-alignment-width":(typeof e==`number`?`${e}px`:e)==null?void 0:typeof e==`number`?`${e}px`:e}],contentWidth:e=>[V,{ks0D6T:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xf68679`,$$css:!0},{"--x-maxWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}]};function U({area:e,children:t}){return t==null?null:(0,R.jsx)(D,{value:e,children:t})}var W={"x-default-marker":`x-default-marker`,$$css:!0};function G({children:e,content:t,contentWidth:i,defaultHasDividers:a,end:o,footer:s,header:c,height:d=`fill`,padding:f,ref:g,start:_,xstyle:v,className:y,style:b,...x}){let S=d===`fill`,C=t??e,w=(0,E.useMemo)(()=>a==null?null:{defaultHasDividers:a},[a]),T=c!=null,D=s!=null,A=_!=null,j=o!=null,M=A&&j,N=A!==j,P=i!=null&&z(i),F=(0,E.useMemo)(()=>({hasHeader:T,hasFooter:D,hasStart:A,hasEnd:j}),[T,D,A,j]),I=(0,R.jsx)(O,{value:F,children:(0,R.jsx)(`div`,{...x,ref:g,...h(r(`layout`,{height:d}),n(B.layoutOuter,S?B.fill:B.auto,v),y,b),children:(0,R.jsxs)(`div`,{...n(W,B.layoutInner,...p({direction:`vertical`}),S?B.fill:B.auto,f===0&&B.fullBleed,f!=null&&l[f],f!=null&&u[f],i!=null&&H.contentWidthVar(i),P&&H.contentAlignmentWidthVar(i)),children:[(0,R.jsx)(U,{area:`header`,children:c}),(0,R.jsxs)(`div`,{...n(...p({direction:`horizontal`}),B.middle,i!=null&&(!P||M)&&H.contentWidth(i),P&&!M&&B.middleQuery,P&&N&&B.singlePanelMiddle,P&&A&&!j&&B.singleStartPanel,P&&!A&&j&&B.singleEndPanel),children:[(0,R.jsx)(U,{area:`start`,children:_}),(0,R.jsx)(`div`,{...n(...m({size:`fill`}),P&&!A&&!j&&B.singleColumnContent),children:(0,R.jsx)(U,{area:`content`,children:C})}),(0,R.jsx)(U,{area:`end`,children:o})]}),(0,R.jsx)(U,{area:`footer`,children:s})]})})});return w==null?I:(0,R.jsx)(k,{value:w,children:I})}G.displayName=`Layout`;var K={content:{kB7OPa:`x9f619`,kZKoxP:`x5yr21d`,kUk6DE:`x98rzlu`,kAzted:`x2lwn1j`,kVQacm:`x7giv3`,kZCmMZ:`xwjyata`,kwRFfy:`x1peupej`,kLKAdn:`xqty4a x1ioh5az`,kGO01o:`xg476vw xsg11nj`,"--container-padding-inline-start":`x408pgh`,"--container-padding-inline-end":`xikqloz`,"--container-padding-block-start":`xjmgx01`,"--container-padding-block-end":`xi9ns85`,$$css:!0},noStart:{kZCmMZ:`xaku5ci`,"--container-padding-inline-start":`xt2a87w`,"--container-padding-inline-end":`xhq06x6`,$$css:!0},noEnd:{kwRFfy:`x19eyx77`,$$css:!0},noHeader:{kLKAdn:`xuqi0w`,"--container-padding-block-start":`x186o6qk`,$$css:!0},noFooter:{kGO01o:`x1363qu6`,"--container-padding-block-end":`xfsxxt8`,$$css:!0},scrollable:{kVQacm:`xysyzu8`,$$css:!0},constrainedNoPanelsStart:{kZCmMZ:`xhlv5e7`,$$css:!0},constrainedNoPanelsEnd:{kwRFfy:`x1ahicqp`,$$css:!0},constrainedSingleStartPanel:{kwRFfy:`xy07wb4`,$$css:!0},constrainedSingleEndPanel:{kZCmMZ:`xxjme2g`,$$css:!0},fullBleed:{kZCmMZ:`x1c1uobl`,kwRFfy:`xyri2b`,kLKAdn:`xexx8yu`,kGO01o:`x18d9i69`,"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,$$css:!0}};function q({children:e,isScrollable:t=!0,padding:i,label:a,role:l,xstyle:u,className:f,style:p,ref:m,...g}){let{hasHeader:_,hasFooter:v,hasStart:y,hasEnd:b}=(0,E.use)(O),x=i===0;return(0,R.jsx)(`div`,{ref:m,role:l,"aria-label":a,...h(r(`layout-content`),n(K.content,!y&&!x&&i==null&&K.noStart,!b&&!x&&i==null&&K.noEnd,!_&&!x&&i==null&&K.noHeader,!v&&!x&&i==null&&K.noFooter,t&&K.scrollable,x&&K.fullBleed,i!=null&&s[i],i!=null&&o[i],i!=null&&c[i],i!=null&&d[i],!y&&!b&&!x&&K.constrainedNoPanelsStart,!y&&!b&&!x&&K.constrainedNoPanelsEnd,y&&!b&&!x&&K.constrainedSingleStartPanel,!y&&b&&!x&&K.constrainedSingleEndPanel,u),f,p),...g,children:e})}q.displayName=`LayoutContent`;var J=`[data-astryx-popover-fallback-close]`;function Y(e){try{e.focus()}catch{}return document.activeElement===e}function X(e){let t=Array.from(e.querySelectorAll(w)).filter(e=>e.closest(J)==null);for(let e of t)if(Y(e))return!0;return!1}var Z={surface:{kWkggS:`x1prclbq`,"--_popover-radius":`xiki222`,kaIpWk:`x11m9jtl`,kGVxlE:`x1i5ehqx`,$$css:!0},contentWrapper:{kVAEAm:`x1n2onr6`,$$css:!0},closeButtonWrapper:{kVAEAm:`x10l6tqk`,krVfgx:`x1ey2m1c`,kY2c9j:`x1vjfegm`,kzqmXN:`x1i1rx1s x10okhzq`,kZKoxP:`xjm9jq1 x132qfvm`,kVQacm:`xb3r6kr x1dordxg`,kz4h6p:`x1hyvwdk x10wafsz`,kfzvcC:`x47corl xbt4iw`,kLKAdn:`xexx8yu x1kw28su`,$$css:!0}};function Q(e={}){let{onShow:t,onHide:a,xstyle:o,className:c,style:l,hasLightDismiss:u=!0,hasEscapeDismiss:d=!0,hasAutoFocus:f=!0,hasSurface:p=!0,padding:m,surfaceTarget:C,hasCloseButton:w=!0,closeButtonLabel:D,dialogLabel:O,role:k=`dialog`,isModal:A=!0}=e,j=v(),M=D??j(`@astryx.popover.close`),N=(0,E.useRef)(null),P=(0,E.useRef)(!1),F=x({mode:`context`,lightDismiss:u,onShow:t,onHide:a}),{containerRef:I,focusFirst:L}=_({isActive:F.isOpen,onEscape:d||u?F.hide:void 0}),z=(0,E.useCallback)(()=>{let e=I.current;e&&(X(e)||(k===`dialog`?Y(e):L()))},[I,L,k]);(0,E.useEffect)(()=>{F.isOpen&&f&&!P.current&&requestAnimationFrame(z),F.isOpen||(P.current=!1)},[F.isOpen,f,z]);let B=(0,E.useCallback)(e=>{N.current=e,F.ref(e)},[F]),V=(0,E.useCallback)(e=>{P.current=e?.skipAutoFocus??!1,F.show()},[F]),H=(0,E.useCallback)(()=>{F.isOpen?F.hide():V()},[F,V]),U={"aria-haspopup":k===`dialog`?`dialog`:`true`,"aria-expanded":F.isOpen,"aria-controls":F.id};T(`usePopover`,'role="dialog" without a `dialogLabel` renders an unnamed dialog. Pass `dialogLabel`, or use `role: "none"` for listbox/menu popups whose content already carries its own role.',k===`dialog`&&!O);let W=(0,E.useCallback)((e,t)=>{let a=r(`popover`),u=C!=null&&C!==`popover`?`${a.className} ${i(C)}`:a.className;return F.render((0,R.jsx)(g,{children:(0,R.jsxs)(`div`,{ref:I,role:k===`dialog`?`dialog`:void 0,"aria-modal":k===`dialog`&&A?!0:void 0,"aria-label":k===`dialog`?O:void 0,tabIndex:k===`dialog`?-1:void 0,...h({...a,className:u},b.focusVisible(Z.contentWrapper,p&&Z.surface,m!=null&&s[m],o),c,l),children:[e,w&&(0,R.jsx)(`div`,{"data-astryx-popover-fallback-close":``,...n(Z.closeButtonWrapper,y.centerInline(`100%`)),children:(0,R.jsx)(S,{variant:`secondary`,label:M,onClick:F.hide})})]})}),{...t,xstyle:t?.xstyle})},[F,w,p,m,C,c,l,M,I,O,k,A,o]);return{triggerRef:B,contentRef:I,anchorId:F.anchorId,show:V,hide:F.hide,toggle:H,isOpen:F.isOpen,id:F.id,render:W,triggerProps:U}}function $(e={}){return Q(e)}function ee({isOpen:e,highlightedIndex:t,setHighlightedIndex:n,getOptionId:r,itemCount:i}){let a=(0,E.useRef)(!1),o=(0,E.useCallback)(e=>{e!==t&&(a.current=!0),n(e)},[t,n]);return(0,E.useEffect)(()=>{a.current?a.current=!1:!e||t<0||document.getElementById(r(t))?.scrollIntoView?.({block:`nearest`})},[e,t,r,i]),o}function te(e){let t=e.cloneNode(!0);for(let e of t.querySelectorAll(`[aria-hidden="true"]`))e.remove();return(t.textContent??``).replace(/\s+/g,` `).trim()}function ne(e,t,n){let r=C(),i=(0,E.useRef)(null);(0,E.useEffect)(()=>{if(!t){i.current=null;return}let a=e.current;if(!a)return;let o=te(a);if(o===``)return;let s=`${n}\u0000${o}`;i.current!==s&&(i.current=s,r(o))})}export{G as a,P as c,k as d,O as f,q as i,F as l,ee as n,L as o,D as p,$ as r,N as s,ne as t,A as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./themeProps-3IqahpCr.js";import{t as n}from"./useAnnounce-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./themeProps-3IqahpCr.js";import{t as n}from"./useAnnounce-DlZth-he.js";var r=e(t(),1),i=2e3;function a(e={}){let{announce:t,resetAfterMs:a=i}=e,o=n(),[s,c]=(0,r.useState)(!1),l=(0,r.useRef)(null);return(0,r.useEffect)(()=>()=>{l.current!=null&&clearTimeout(l.current)},[]),{copy:(0,r.useCallback)(async e=>{try{return await navigator.clipboard.writeText(e),c(!0),t&&o(t),l.current!=null&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,c(!1)},a),!0}catch{return!1}},[o,t,a]),isCopied:s}}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,u as i}from"./themeProps-3IqahpCr.js";import{g as a}from"./tokens.stylex-BpCwr7Mf.js";import{t as o}from"./mergeProps-ptS-gIMz.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,u as i}from"./themeProps-3IqahpCr.js";import{g as a}from"./tokens.stylex-BpCwr7Mf.js";import{t as o}from"./mergeProps-ptS-gIMz.js";import{x as s}from"./Icon-BWzSKxTK.js";import{a as c}from"./useTooltip-BaCjTHk-.js";var l=e(i(),1);function u(){if(typeof navigator>`u`)return!1;let e=`userAgentData`in navigator?navigator.userAgentData:null;if(e&&typeof e==`object`&&`platform`in e){let t=e.platform,n=typeof t==`string`?t.trim():``;if(n!==``&&n.toLowerCase()!==`unknown`)return/mac/i.test(n)}return/Mac|iPhone|iPad|iPod/.test(navigator.platform??``)}var d=t(),f={wrapper:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kOIVth:`xzye2dw`,kmuXW:`x2lah0s`,$$css:!0}},p=new Map([[`ctrl`,`⌃`],[`alt`,`⌥`],[`shift`,`⇧`],[`enter`,`↵`],[`backspace`,`⌫`],[`escape`,`Esc`],[`tab`,`⇥`],[`up`,`↑`],[`down`,`↓`],[`left`,`←`],[`right`,`→`],[`plus`,`+`]]),m=new Map([[`esc`,`escape`],[`return`,`enter`]]);function h(e,t){return e===`mod`?t?`⌘`:`Ctrl`:p.get(e)??e.toUpperCase()}var g=new Map([[`ctrl`,`Control`],[`alt`,`Alt`],[`shift`,`Shift`],[`enter`,`Enter`],[`backspace`,`Backspace`],[`escape`,`Escape`],[`tab`,`Tab`],[`up`,`Up arrow`],[`down`,`Down arrow`],[`left`,`Left arrow`],[`right`,`Right arrow`],[`plus`,`Plus`]]);function _(e,t){return e===`mod`?t?`Command`:`Control`:g.get(e)??e.toUpperCase()}function v(){return()=>{}}function y(){return!1}function b({keys:e,ref:t,xstyle:i,className:a,style:s,...c}){let p=(0,l.useSyncExternalStore)(v,u,y),g=new Map,b=e.split(`+`).map(e=>e.trim().toLowerCase()).map(e=>{let t=g.get(e)??0;return g.set(e,t+1),{key:m.get(e)??e,reactKey:`${e}:${t}`}}),x=b.map(({key:e})=>_(e,p)).join(` + `);return(0,d.jsx)(`span`,{...c,ref:t,role:`img`,"aria-label":x,...o(r(`kbd`),n(f.wrapper,i),a,s),children:b.map(({key:e,reactKey:t})=>(0,d.jsx)(`kbd`,{"aria-hidden":`true`,className:`x3nfvp2 x6s0dn4 xl56j7k x16asifk x1grt7ep x7a5moj xx3sua9 x17x4s8c xlxy82 x1q0q8m5 xib2hle x1tgivj0 x9ynric x141an7d x1e4wzip x1ltkj2j x87ps6o`,children:h(e,p)},t))})}b.displayName=`Kbd`;var x=new Set([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`]),S={horizontal:[`left`,`right`],vertical:[`up`,`down`],both:[`left`,`right`,`up`,`down`]},C={hint:{kVAEAm:`xixxii4`,kpwlN0:`x1anvkwx`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`x1prclbq`,kaIpWk:`xh6dtrn`,kGVxlE:`x1i5ehqx`,kLKAdn:`xfsso4q`,kGO01o:`xy143xn`,kZCmMZ:`x12gdq22`,kwRFfy:`x1djylfy`,kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,kMwMTN:`xv1l7n4`,khDVqt:`xuxw1ft`,kSiTet:`xg01cxk xofkqq2`,k1ekBW:`xsm4mo9`,kIyJzY:`xx6bhzk`,kzIqYQ:`xd00j3c`,kfzvcC:`x47corl`,$$css:!0}};function w(e={}){let{orientation:t=`horizontal`,dismissAfterMs:n=3e3,isEnabled:r=!0}=e,i=s(),o=(0,l.useRef)(null),u=(0,l.useRef)(!1),f=(0,l.useRef)(!1),p=(0,l.useRef)(()=>{}),m=(0,l.useCallback)(()=>{o.current&&=(clearTimeout(o.current),null)},[]),h=(0,l.useCallback)(()=>{f.current=!0},[]),g=(0,l.useCallback)(()=>{f.current=!1,m(),p.current(null)},[m]),_=c({mode:`context`,onShow:h,onHide:g});p.current=_.ref;let v=(0,l.useCallback)(()=>{u.current=!0,m(),_.hide(),f.current=!1,p.current(null)},[m,_]),y=(0,l.useCallback)(e=>{!u.current&&r&&(p.current(e),_.show(),m(),o.current=setTimeout(()=>{v()},n))},[m,v,n,r,_]);(0,l.useEffect)(()=>()=>{m(),p.current(null)},[m]);let w=(0,l.useCallback)(e=>{if(u.current||!r)return;let t=e.target;if(!t.matches(`:focus-visible`))return;let n=e.currentTarget;e.relatedTarget instanceof Node&&n.contains(e.relatedTarget)||y(t)},[y,r]),T=(0,l.useCallback)(e=>{if(!f.current)return;let t=e.currentTarget;e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)?!u.current&&e.relatedTarget instanceof HTMLElement&&p.current(e.relatedTarget):v()},[v]),E=(0,l.useCallback)(e=>{f.current&&x.has(e.key)&&v()},[v]),D=(0,d.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 xzye2dw`,children:S[t].map(e=>(0,d.jsx)(b,{keys:e},e))});return{hintElement:_.render((0,d.jsxs)(`span`,{"aria-hidden":`true`,children:[D,(0,d.jsx)(`span`,{className:`x11g1kdw`,children:i(`@astryx.keyboardHint.toNavigate`)})]}),{placement:`below`,alignment:`start`,xstyle:C.hint,style:{marginBlockStart:a[`--spacing-2`]}}),onFocus:w,onBlur:T,onKeyDown:E}}export{b as n,w as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./themeProps-3IqahpCr.js";import{S as n}from"./Icon-BWzSKxTK.js";var r=e(t(),1);function i(){return(0,r.use)(n).locale}export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,u as i}from"./themeProps-3IqahpCr.js";import{g as a}from"./tokens.stylex-BpCwr7Mf.js";import{y as o}from"./padding.stylex-B76907Zf.js";import{t as s}from"./mergeProps-ptS-gIMz.js";import{o as c,r as l,s as u}from"./useLayerDismissal-BAnTRYTt.js";import{d,f,g as p,i as ee,u as m}from"./fieldParts-CNKpMZ7U.js";import{t as h}from"./isRenderable-DHkzpAoQ.js";import{n as te,t as g,x as _}from"./Icon-BWzSKxTK.js";import{n as v,r as y}from"./useResolvedRequired-CAelf7J-.js";import{i as b}from"./focusOutline.stylex-B9nWSXsG.js";import{n as x,t as S}from"./usePressFeedback-CBSbXJuo.js";import{a as C,d as w,l as T,n as E}from"./useTooltip-BaCjTHk-.js";import{r as D}from"./Text-B74VhVA7.js";import{t as O}from"./Spinner--TVdDovX.js";import{t as ne}from"./useMediaQuery-BCT0NUeZ.js";import{a as k,c as re}from"./CheckboxInput-BIFNQqbA.js";import{t as ie}from"./useDevWarning-Z9SoixOP.js";import{a as ae,i as oe,n as se,r as A,t as ce}from"./menuItemRoles-Bod0knkp.js";import{n as le,r as ue,t as de}from"./useMenuPress-DPpqa6F7.js";import{i as fe,r as pe}from"./useAdaptivePresentation-Bma4-u1a.js";var j=e(i(),1),me=o(null);me.displayName=`DropdownMenuSurfaceContext`;var he=o(null);he.displayName=`DropdownMenuRootOpenContext`;function ge(){return(0,j.use)(he)!==!1}var _e=o(null);_e.displayName=`DropdownMenuContext`;function ve(){return(0,j.use)(_e)}var ye=(0,j.createContext)(null);ye.displayName=`DropdownMenuRadioGroupContext`;function be(e,t){if(t||e.pointerType!==`mouse`)return;let n=e.currentTarget;n!==n.ownerDocument.activeElement&&n.focus({preventScroll:!0})}var M=t(),xe={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz xprvw0a`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},destructive:{kMwMTN:`xjt36v0`,"--_item-label-color":`xufyqxy`,"--_item-description-color":`xqlix59`,$$css:!0}},N={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}};function Se({icon:e,label:t,description:n,onClick:i,href:a,target:o,rel:c,isDisabled:l=!1,endContent:u,hasCloseOnSelect:d=!0,variant:f=`default`,xstyle:ee,className:m,style:h,ref:g,onPointerMove:_,onAuxClick:v,...y}){let b=ve(),C=b?.menuSize??`md`,w=S(),T=(0,j.useCallback)(e=>{l?e.preventDefault():(a!=null&&ae(e)||i?.(e),d&&b?.closeMenu())},[l,a,i,d,b]),E=(0,j.useCallback)(e=>{l?e.preventDefault():a!=null&&e.button===1&&d&&b?.closeMenu()},[l,a,d,b]),D=(0,j.useCallback)(e=>be(e,l),[l]),O=f===`destructive`,ne=x();return(0,M.jsx)(k,{...y,ref:g,as:a==null?void 0:ne,role:`menuitem`,tabIndex:l?void 0:-1,onPointerMove:p(D,_),...w,startContent:e?te(e,{size:`sm`,color:O?`error`:`secondary`}):void 0,label:t,description:n,endContent:u,onClick:T,onAuxClick:p(E,v),href:a,target:o,rel:c,draggable:a==null&&void 0,isDisabled:l,xstyle:[xe.root,N[C],O&&xe.destructive,l&&xe.disabled,ee],...s(r(`dropdown-menu-item`,{size:C,variant:O?`destructive`:null}),{className:m,style:h})})}Se.displayName=`DropdownMenuItem`;var Ce={divider:{kqGvvJ:`xsq74q5`,$$css:!0}},we=r(`dropdown-menu-divider`).className;function Te({xstyle:e,className:t,style:n,ref:r,...i}){return(0,M.jsx)(re,{...i,ref:r,xstyle:[Ce.divider,e],className:t?`${we} ${t}`:we,style:n})}Te.displayName=`DropdownMenuDivider`;var Ee=w(),De=(0,j.createContext)(!1);De.displayName=`MenuRegionsContext`;function Oe(e){return e==null?[]:f(e).filter(t=>t.tabIndex>=0&&!ke(t,e))}function ke(e,t){if(typeof window>`u`||!window.getComputedStyle)return!1;for(let n=e.parentElement;n!=null&&n!==t.parentElement;n=n.parentElement)if(window.getComputedStyle(n).display===`none`)return!0;return!1}function Ae(e,t,n){let r=new Map,i=e=>e instanceof HTMLInputElement&&e.getAttribute(`type`)===`radio`&&e.name!==``?`${e.form?.id??``}\u0000${e.name}`:null;for(let t of e){let e=i(t);if(e!=null){let n=r.get(e)??[];n.push(t),r.set(e,n)}}let a=new Set,o=[];for(let s of e){let e=i(s);if(e==null){o.push(s);continue}if(a.has(e))continue;a.add(e);let c=r.get(e)??[],l=c.find(e=>e===t)??c.find(e=>e.checked)??(n?c[c.length-1]:c[0]);o.push(l)}return o}function je(e){return e.focus(),e.ownerDocument.activeElement===e}function Me(e,t,n,r,i=!1){if(t==null)return;e.preventDefault(),e.stopPropagation();let a=document.activeElement,o=Ae([...Oe(n),t,...Oe(r)],a,e.shiftKey);if(o.length===1){i&&t.focus();return}let s=o.indexOf(t),c=t.contains(a)?s:o.findIndex(e=>e===a||e.contains(a));c<0&&(c=s);let l=e.shiftKey?-1:1,u=o[(c+l+o.length)%o.length];je(u)||t.focus()}var Ne=500,Pe=300,P=8;function F(e,t,n){return(e.x-n.x)*(t.y-n.y)-(t.x-n.x)*(e.y-n.y)}function Fe(e,t,n,r){let i=F(e,t,n),a=F(e,n,r),o=F(e,r,t);return!((i<0||a<0||o<0)&&(i>0||a>0||o>0))}function Ie(e,t,n){let r=P,i,a;if(t.x<=n.left)i={x:n.left,y:n.top-r},a={x:n.left,y:n.bottom+r};else if(t.x>=n.right)i={x:n.right,y:n.top-r},a={x:n.right,y:n.bottom+r};else if(t.y<=n.top)i={x:n.left-r,y:n.top},a={x:n.right+r,y:n.top};else if(t.y>=n.bottom)i={x:n.left-r,y:n.bottom},a={x:n.right+r,y:n.bottom};else return!1;return Fe(e,t,i,a)}function Le(e){let{show:t,hide:n,isOpen:r,isEnabled:i,showDelay:a=150,hideDelay:o=200,clickGuardMs:s=Ne,itemSelector:c,popoverId:u,ownsFocus:d=!0,flyoutRef:f}=e,p=ne(`(hover: hover)`),m=(0,j.useRef)(null),h=(0,j.useRef)(null),te=(0,j.useRef)(null),g=(0,j.useRef)(null),_=(0,j.useRef)(!1),v=(0,j.useRef)(0),y=(0,j.useRef)(0),b=(0,j.useRef)(r),x=(0,j.useCallback)(()=>{m.current&&=(clearTimeout(m.current),null),h.current&&=(clearTimeout(h.current),null),g.current?.(),g.current=null},[]);l(()=>{let e=b.current;b.current=r,e&&!r&&(x(),_.current=!1,y.current=0,v.current=Date.now())},[r,x]);let S=(0,j.useRef)(()=>{}),{listRef:C,handleKeyDown:w,focusFirst:T}=ee({itemSelector:c,onEscape:()=>S.current()}),E=(0,j.useCallback)(()=>{let e=C.current?.contains(document.activeElement)??!1;n(),e&&te.current?.focus()},[n,C]);(0,j.useEffect)(()=>{S.current=()=>{x(),E()}},[x,E]),(0,j.useEffect)(()=>()=>x(),[x]),(0,j.useEffect)(()=>{i||x()},[i,x]);let D=(0,j.useCallback)(()=>{T()||C.current?.focus()},[T,C]),O=(0,j.useCallback)(()=>{d?(t({skipAutoFocus:!0}),D()):t()},[d,t,D]),k=(0,j.useCallback)(()=>s>0&&y.current>0&&Date.now()-y.current<s&&(_.current=!1,y.current=0,!0),[s]),re=(0,j.useCallback)(e=>{u&&e?.preventDefault(),x(),e!=null&&e.detail===0?(v.current=0,_.current=!1,y.current=0,r?d&&D():O()):r?k()?d&&D():E():(v.current=0,_.current=!1,y.current=0,O())},[u,x,r,d,k,O,D,E]),ie=(0,j.useCallback)(()=>{if(!p||v.current>0&&Date.now()-v.current<Pe)return;if(r){x();return}_.current=!0,x();let e=()=>{y.current=Date.now(),t({skipAutoFocus:!0})};a>0?m.current=setTimeout(e,a):e()},[p,r,x,t,a]),ae=(0,j.useCallback)(e=>{if(v.current=0,!_.current)return;x();let t=null,i=!1,a=()=>!1,s=()=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{i&&t!=null&&a(t)?s():n()},o)};s();let c=f?.current??C.current,l=e==null?null:{x:e.clientX,y:e.clientY};if(c==null||l==null||!r)return;let u=c.getBoundingClientRect();if(u.width<=0||u.height<=0)return;let d=c.ownerDocument;a=e=>Ie(e,l,u),i=!0,t=l;let p=e=>{let n={x:e.clientX,y:e.clientY};t=n,a(n)?s():(i=!1,g.current?.(),g.current=null)};d.addEventListener(`pointermove`,p,!0),g.current=()=>{d.removeEventListener(`pointermove`,p,!0)}},[x,n,o,r,C,f]),oe=(0,j.useCallback)(()=>{x()},[x]),se=(0,j.useCallback)(e=>{te.current=e},[]),A=(0,j.useCallback)(()=>{},[]),ce=(0,j.useCallback)(e=>{},[]),le=(0,j.useCallback)(e=>{},[]);return i?{triggerProps:{onClick:re,onMouseEnter:ie,onMouseLeave:ae,...u?{popoverTarget:u}:null},contentProps:{onMouseEnter:oe,onMouseLeave:ae,onKeyDown:w},menuRef:C,focusFirst:T,focusMenu:D,confirmHoverOpen:k,close:E,setTriggerEl:se}:{triggerProps:{onClick:A,onMouseEnter:A,onMouseLeave:A},contentProps:{onMouseEnter:A,onMouseLeave:A,onKeyDown:le},menuRef:C,focusFirst:T,focusMenu:D,confirmHoverOpen:k,close:E,setTriggerEl:ce}}function Re(e,t){return typeof e==`string`&&d(e)?{property:`inlineSize`,value:e.trim()}:{property:`minWidth`,value:m(e,t)}}`${T.maxBlockSize}`,`${T.maxBlockSizeFallback}`;var ze={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},open:{kWkggS:`x1lmrjuc`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},Be={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},I={kzqmXN:`x1uyokj7`,$$css:!0},L={scrollable:{kORKVm:`x1odjw0f`,kXHlph:`x6ikm8r`,kZeWKH:`xish69e`,$$css:!0},touchPinchZoom:{kFalU9:`x1j4r261`,$$css:!0},touchPanYPinchZoom:{kFalU9:`xge0x1e`,kZeWKH:`xish69e`,$$css:!0},popoverViewport:{kB7OPa:`x9f619`,kskxy:`x1uh1i8a`,$$css:!0},popover:{k7Eaqz:`x1b27s9g`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:e==null?e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}],popoverCustomIntrinsicWidth:e=>[I,{"--x-inlineSize":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]},Ve={kskxy:`x1jols5v`,$$css:!0},He={viewMaxHeight:e=>[Ve,{"--x-maxHeight":(e=>typeof e==`number`?e+`px`:e??void 0)(`min(${e}, ${T.maxBlockSize})`)}]},Ue={frame:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kskxy:`x1uh1i8a`,"--_dropdown-menu-radius":`x1fcsqxe`,"--_dropdown-menu-padding":`xgory14`,kaIpWk:`x1n97fys`,$$css:!0},menu:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,kAzted:`x2lwn1j`,kmVPX3:`x9epnlk`,kI3sdo:`x1a2a7pz`,k7VYTy:`xpdipgo`,kfSwDN:`x87ps6o`,$$css:!0},hidden:{k1xSpc:`x1s85apg`,$$css:!0}};function We(e){if(e==null)return;let t=e.ownerDocument,n=e.querySelectorAll(`[aria-expanded="true"][aria-controls]`);for(let e of[...n].reverse()){let n=t.getElementById(e.getAttribute(`aria-controls`)??``);if(n?.getAttribute(`data-astryx-submenu-regions`)!==`flyout`)continue;let r=n.closest(`[popover]`);if(r!=null){if(typeof r.hidePopover==`function`)r.matches(`:popover-open`)&&r.hidePopover();else if(r.style.display===`block`){r.style.display=`none`;let e=new Event(`toggle`,{bubbles:!1});Object.defineProperty(e,"newState",{value:`closed`,configurable:!0}),r.dispatchEvent(e)}}}}function Ge(e){let{icon:t,label:i,description:o,isDisabled:l=!1,hasSpinner:d=!1,menuWidth:f,onOpenChange:m,presentation:x=`adaptive`,header:S,footer:w,children:ne,xstyle:re,className:ae,style:ye,"data-testid":xe,menuDataTestId:N,ref:Ce,id:we,onMouseEnter:Te,onMouseLeave:Oe,onPointerMove:ke,onClick:Ae,onKeyDown:je,...Ne}=e,Pe=_(),P=ve(),F=(0,j.use)(me),Fe=(0,j.use)(De),Ie=P?.menuSize??`md`,I=!l,Ve=h(S)||h(w),Ge=F!=null,R=Ve&&Ge,Ke=F?.host.getElement()??null;ie(`DropdownMenuSubMenu`,`header and footer show only inside a DropdownMenu; this menu has no place outside its rows for them, so they are not rendered.`,Ve&&!Ge);let qe=(0,j.useId)(),Je=(0,j.useRef)(null),Ye=(0,j.useRef)(null),Xe=(0,j.useRef)(null),[Ze,Qe]=(0,j.useState)(!1),z=(0,j.useId)(),$e=(0,j.useId)(),B=we??$e,V=(0,j.useRef)(null),H=P?.drillIn,U=H!=null&&(x===`drill-in`||x===`adaptive`&&H.isCompactTouch)?H:null,W=U!=null,et=(0,j.useId)(),G=U?.viewStack.includes(et)===!0,K=G&&U?.viewStack.at(-1)===et,q=typeof i==`string`?i:void 0,tt=P?.menuLabel,nt=tt==null?Pe(`@astryx.dropdownMenu.back`):Pe(`@astryx.dropdownMenu.backTo`,{parent:tt}),[rt,it]=(0,j.useState)(!1),J=W?G:rt,at=(0,j.useRef)(!1),Y=(0,j.useRef)(!1),X=C({mode:`context`,lightDismiss:!1,onShow:(0,j.useCallback)(()=>{Y.current=!1,it(!0),m?.(!0)},[m]),onHide:(0,j.useCallback)(()=>{Y.current=!1,We(V.current?.ownerDocument.getElementById(z)??null),it(!1),m?.(!1)},[m,z])}),ot=(0,j.useCallback)(()=>{I&&X.show()},[I,X]),st=(0,j.useCallback)(()=>{R&&at.current?Y.current=!0:X.hide()},[X,R]),ct=(0,j.useCallback)(()=>{at.current=!0},[]),lt=(0,j.useCallback)(e=>{if(at.current=!1,!Y.current)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||setTimeout(()=>{!at.current&&Y.current&&V.current?.isConnected===!0&&(Y.current=!1,X.hide())},0)},[X]),ut=(0,j.useCallback)(()=>{Y.current=!1},[]),{listRef:Z,handleKeyDown:dt,focusFirst:ft,focusItem:pt,ownsEvent:mt,getItems:ht}=ee({itemSelector:A,boundarySelector:ce,wrap:!0,hasPaging:!0,onEscape:()=>$({focusTrigger:!0})}),Q=pe(Z,ne,J&&(!W||R)),gt=fe({getItemLabels:()=>ht().map(e=>e.textContent),onMatch:pt,getCurrentIndex:()=>ht().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))}),_t=ge();v(d&&_t,Pe(`@astryx.spinner.loading`),V);let{triggerProps:vt,contentProps:yt,confirmHoverOpen:bt}=Le({show:ot,hide:st,isOpen:rt,isEnabled:I&&!W&&_t,flyoutRef:R?Je:Z}),xt=(0,j.useRef)(null),St=(0,j.useRef)(!1),Ct=(0,j.useCallback)(e=>{I&&(U==null?(X.show(),e?.focusFirst&&(ft()||Z.current?.focus())):(xt.current=e?.focusFirst?`first`:`container`,U.push(et),m?.(!0)))},[I,U,et,m,X,ft,Z]),$=(0,j.useCallback)(e=>{U==null?(X.hide(),e?.focusTrigger!==!1&&V.current?.focus()):G&&(St.current=e?.focusTrigger!==!1,U.pop(),m?.(!1))},[U,G,m,X]);(0,j.useEffect)(()=>{if(!K||U?.host==null)return;let e=xt.current;if(e==null)return;xt.current=null;let t=ht(),n=e===`first`?t[1]??t[0]:null;n==null?Z.current?.focus({preventScroll:!0}):n.focus({preventScroll:!0})},[K,U?.host,ht,Z]),(0,j.useEffect)(()=>{!G&&St.current&&(St.current=!1,V.current?.focus({preventScroll:!0}))},[G]);let wt=X.ref,Tt=(0,j.useCallback)(e=>{V.current=e,wt(e)},[wt]),Et=D(Tt,Ce),Dt=(0,j.useCallback)(e=>{if(l)e.preventDefault();else if(W){let t=e.detail>0||le();Ct({focusFirst:!t})}else if(rt){if(bt()){ft()||Z.current?.focus();return}$({focusTrigger:!0})}else Ct({focusFirst:!0})},[l,W,rt,Ct,$,bt,ft,Z]),Ot=(0,j.useCallback)(e=>{p(Dt,Ae)(e)},[Dt,Ae]),kt=(0,j.useCallback)(e=>{if(l)return;let t=typeof window<`u`&&V.current&&window.getComputedStyle(V.current).direction===`rtl`?`ArrowLeft`:`ArrowRight`;(e.key===t||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),Ct({focusFirst:!0}))},[l,Ct]),At=(0,j.useCallback)(e=>be(e,l),[l]),jt=(0,j.useCallback)(e=>{if(e.key===`Tab`){if(R){Me(e,Z.current,Ye.current,Xe.current,!mt(e));return}if(Fe){$({focusTrigger:!1});return}}if(!mt(e))return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),$({focusTrigger:!0});return}if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),e.repeat)return;let t=document.activeElement;t&&se.has(t.getAttribute(`role`)??``)&&oe(t,e);return}let t=typeof window<`u`&&Z.current&&window.getComputedStyle(Z.current).direction===`rtl`?`ArrowRight`:`ArrowLeft`;e.key===t?(e.preventDefault(),$({focusTrigger:!0})):gt.onKeyDown(e)?e.preventDefault():dt(e)},[mt,$,dt,gt,Z,Fe,R]),Mt=(0,j.useCallback)(e=>{e.key===`Tab`?Me(e,Z.current,Ye.current,Xe.current):e.key===`Escape`&&!e.defaultPrevented&&!c(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),$({focusTrigger:!0}))},[Z,$]),Nt=(0,j.useMemo)(()=>({menuSize:Ie,closeMenu:()=>{$({focusTrigger:!1}),P?.closeMenu()},drillIn:H,menuLabel:q}),[Ie,$,P,H,q]),Pt=ue({menuRef:Z,itemSelector:A,onDismiss:Nt.closeMenu}),Ft=d?(0,M.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,M.jsx)(O,{size:`sm`,"aria-hidden":`true`})}):(0,M.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,M.jsx)(g,{icon:`chevronRight`,size:`sm`,color:`secondary`,xstyle:y.mirror,...r(`dropdown-menu-indicator-icon`)})}),It=f?Re(f,T.maxInlineSizeFallback):null,Lt=It?It.property===`inlineSize`?L.popoverCustomIntrinsicWidth(It.value):L.popoverCustomWidth(It.value):L.popover,Rt=(0,M.jsx)(_e,{value:Nt,children:(0,M.jsxs)(me,{value:F,children:[W&&(0,M.jsx)(Se,{icon:(0,M.jsx)(g,{icon:`chevronLeft`,size:`sm`,color:`secondary`,xstyle:y.mirror}),label:nt,hasCloseOnSelect:!1,onClick:()=>$({focusTrigger:!0})}),ne]})}),zt=(0,M.jsx)(he,{value:_t&&J,children:R?(0,M.jsx)(De,{value:!0,children:Rt}):Rt}),Bt=R&&F!=null?{[de]:F.ownerId}:void 0,Vt=(e,t,i)=>(0,M.jsxs)(`div`,{ref:Je,id:qe,role:`dialog`,"aria-modal":`true`,"data-astryx-submenu-regions":i,...t,...i===`flyout`?{onFocus:ct,onBlur:lt,onPointerEnter:ut}:void 0,...i===`flyout`?s(r(`dropdown-menu`),{className:`x9f619 x78zum5 xdt5ytf x1uh1i8a x1fcsqxe xgory14 x1n97fys xc0b1yq x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92`}):n(Ue.frame,F?.menuMaxHeight!=null&&He.viewMaxHeight(F.menuMaxHeight),t.hidden===!0&&Ue.hidden),children:[h(S)&&(0,M.jsx)(`div`,{ref:Ye,onKeyDown:Mt,className:`x2lah0s x9epnlk`,children:S}),e,h(w)&&(0,M.jsx)(`div`,{ref:Xe,onKeyDown:Mt,className:`x2lah0s x9epnlk`,children:w})]}),Ht=e=>R&&Ke!=null?(0,Ee.createPortal)(e,Ke):e,Ut=e=>{R&&e.target===e.currentTarget&&Qe(u()===`keyboard`)},Wt=e=>{R&&e.target===e.currentTarget&&Qe(!1)};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(k,{...Ne,ref:Et,id:B,role:`menuitem`,tabIndex:l?void 0:-1,"aria-haspopup":R?`dialog`:`menu`,"aria-expanded":J,"aria-controls":J?R?qe:z:void 0,"aria-disabled":l||void 0,"data-testid":xe,onMouseEnter:p(vt.onMouseEnter,Te),onMouseLeave:p(vt.onMouseLeave,Oe),onPointerMove:p(At,ke),startContent:t?te(t,{size:`sm`,color:`secondary`}):void 0,label:i,description:o,endContent:Ft,onClick:Ot,onKeyDown:p(kt,je),isDisabled:l,xstyle:[ze.root,Be[Ie],J&&ze.open,l&&ze.disabled,re],...s(r(`dropdown-menu-item`,{size:Ie}),{className:ae,style:ye})}),U==null?Ht(X.render(R?Vt((0,M.jsx)(`div`,{ref:Z,id:z,role:`menu`,tabIndex:0,"aria-labelledby":B,onKeyDown:jt,onFocus:Ut,onBlur:Wt,"data-testid":N,...Pt.menuProps,...Bt,...n(Ue.menu,Q?L.touchPanYPinchZoom:L.touchPinchZoom,Q&&L.scrollable,Ze&&b.focusVisible),children:zt}),{"aria-labelledby":B,onMouseEnter:yt.onMouseEnter,onMouseLeave:yt.onMouseLeave},`flyout`):(0,M.jsx)(`div`,{ref:Z,id:z,role:`menu`,tabIndex:Q?0:-1,"aria-labelledby":B,onKeyDown:jt,onMouseEnter:yt.onMouseEnter,onMouseLeave:yt.onMouseLeave,"data-testid":N,...Pt.menuProps,...s(r(`dropdown-menu`),{0:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 xc0b1yq x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o x1j4r261`},2:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 xc0b1yq x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o xge0x1e xish69e`},1:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 xc0b1yq x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o x1j4r261 x1odjw0f x6ikm8r xish69e`},3:{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 xc0b1yq x1uh1i8a x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 xpdipgo x87ps6o xge0x1e x1odjw0f x6ikm8r xish69e`}}[!!Q<<1|!!Q]),children:zt}),{placement:`end`,alignment:`start`,offset:a[`--spacing-1`],xstyle:[L.popoverViewport,Lt,E.end]})):G&&U.host!=null&&(R?(0,Ee.createPortal)(Vt((0,M.jsx)(`div`,{ref:Z,id:z,role:`menu`,tabIndex:0,"aria-label":q,"aria-labelledby":q==null?B:void 0,onKeyDown:jt,onFocus:Ut,onBlur:Wt,"data-testid":N,...Pt.menuProps,...Bt,...n(Ue.menu,Q&&L.scrollable,Q?L.touchPanYPinchZoom:L.touchPinchZoom,Ze&&b.focusVisible),children:zt}),{"aria-label":q,"aria-labelledby":q==null?B:void 0,hidden:!K,inert:!K},`view`),Ke??U.host):(0,Ee.createPortal)((0,M.jsx)(`div`,{ref:Z,id:z,role:`menu`,tabIndex:-1,"aria-label":q,"aria-labelledby":q==null?B:void 0,hidden:!K,inert:!K,onKeyDown:jt,"data-testid":N,...Pt.menuProps,...{0:{className:`x78zum5 xdt5ytf x1lsbc85 x1a2a7pz xpdipgo x87ps6o`},1:{className:`xdt5ytf x1lsbc85 x1a2a7pz xpdipgo x87ps6o x1s85apg`}}[!K|0],children:zt}),U.host))]})}Ge.displayName=`DropdownMenuSubMenu`;function R(e,t){return`item-${e.id??t}`}function Ke(e,t){return`section-${e.id??t}`}function qe(e,t){let{items:n,id:r,...i}=e;return(0,M.jsx)(Se,{...i},R(e,t))}function Je(e){let t=[];for(let n=0;n<e.length;n++){let i=e[n];`type`in i&&i.type===`divider`?t.push((0,M.jsx)(Te,{},`divider-${n}`)):`type`in i&&i.type===`section`?t.push((0,M.jsxs)(`div`,{role:`group`,"aria-label":i.title,children:[i.title&&(0,M.jsx)(`div`,{"aria-hidden":`true`,...s(r(`dropdown-menu-section-heading`),{className:`xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o`}),children:i.title}),i.items.map(qe)]},Ke(i,n))):`type`in i||(i.items&&i.items.length>0?t.push((0,M.jsx)(Ge,{icon:i.icon,label:i.label,isDisabled:i.isDisabled,children:Je(i.items)},R(i,n))):t.push(qe(i,n)))}return t}function Ye(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 768px) and (pointer: coarse)`).matches}function Xe(e){let[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)([]),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(e);s!==e&&(c(e),e?n(Ye()):r.length>0&&i([]));let l=(0,j.useCallback)(e=>{i(t=>t.includes(e)?t:[...t,e])},[]),u=(0,j.useCallback)(()=>{i(e=>e.length===0?e:e.slice(0,-1))},[]),d=(0,j.useMemo)(()=>({isCompactTouch:t,viewStack:r,host:a,push:l,pop:u}),[t,r,a,l,u]),f=r.length>0;return{drillIn:d,isDrilled:f,wrapContent:(0,j.useCallback)(e=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{hidden:f,inert:f,...{0:{className:`xjp7ctv`},1:{className:`x1s85apg`}}[!!f|0],children:e}),(0,M.jsx)(`div`,{ref:o,className:`xjp7ctv`})]}),[f])}}export{Me as a,he as c,Le as i,me as l,Je as n,De as o,Re as r,_e as s,Xe as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./themeProps-3IqahpCr.js";import{r as n}from"./tokens.stylex-BpCwr7Mf.js";import{n as r}from"./useAnnounce-DlZth-he.js";var i=e(t(),1),a={"--astryx-press-alpha":`var(--astryx-press-alpha)`,__varGroupHash__:`x1qqxm5o`},o={releaseMs:200};`${o.releaseMs}`;var s=a[`--astryx-press-alpha`];`${n[`--color-overlay-hover`]}${n[`--color-overlay-hover`]}`,`${n[`--color-overlay-pressed`]}${n[`--color-overlay-pressed`]}`,`${n[`--color-neutral`]}${n[`--color-neutral`]}`,`${n[`--color-overlay-pressed`]}${s}`;var c={backgroundColor:{"--astryx-press-alpha":`x11z29ks xli5ek3`,kKVMdj:`x14e4jsf`,k44tkh:`x8s9nux`,kyAemX:`xwkbtvz`,kWV6AL:`xziyay6`,"--_press-paint":`xz2mauf`,"--_press-paint-image":`x1l7afqf`,kWkggS:`xjbqb8w x1anq1lc x1s5nr2v x13ugjdw xl8sb5e xoevpu5 xprvw0a`,kKwaWg:`x7ngsy6 xubczrd`,$$css:!0},backgroundImage:{"--astryx-press-alpha":`x11z29ks xli5ek3`,kKVMdj:`x14e4jsf`,k44tkh:`x8s9nux`,kyAemX:`xwkbtvz`,kWV6AL:`xziyay6`,"--_press-paint":`xz2mauf`,"--_press-paint-image":`x1l7afqf`,kKwaWg:`x7uyq82 x3f84ok x7ngsy6 xubczrd xmvprkv xetgvay`,$$css:!0},backgroundImageOnNeutral:{"--astryx-press-alpha":`x11z29ks xli5ek3`,kKVMdj:`x14e4jsf`,k44tkh:`x8s9nux`,kyAemX:`xwkbtvz`,kWV6AL:`xziyay6`,"--_press-paint":`xz2mauf`,"--_press-paint-image":`x1l7afqf`,kKwaWg:`x14bno8m xzmimnh xvbnuu x5rw36h x1qxwyo6 x1otsd3y xo3fi6e`,$$css:!0},pressedBackgroundColor:{"--astryx-press-alpha":`x11z29ks xli5ek3`,kKVMdj:`x14e4jsf`,k44tkh:`x8s9nux`,kyAemX:`xwkbtvz`,kWV6AL:`xziyay6`,"--_press-paint":`xz2mauf`,"--_press-paint-image":`x1l7afqf`,kWkggS:`x1anq1lc x1s5nr2v x13ugjdw xl8sb5e`,kKwaWg:`x7ngsy6 xubczrd`,$$css:!0},pressedAlpha:{"--astryx-press-alpha":`x11z29ks xli5ek3`,kKVMdj:`x14e4jsf`,k44tkh:`x8s9nux`,kyAemX:`xwkbtvz`,kWV6AL:`xziyay6`,"--_press-paint":`xz2mauf`,"--_press-paint-image":`x1l7afqf`,$$css:!0}},l=(0,i.createContext)(null);l.displayName=`LinkContext`;function u(e){function t({href:t,to:n,ref:a,...o}){return!r(t)||!r(n)?(0,i.createElement)(`a`,{ref:a,...o}):e===`a`?(0,i.createElement)(`a`,{ref:a,...o,href:t}):(0,i.createElement)(e,{ref:a,...o,href:t,to:n??t})}return t.displayName=`SafeLink(${typeof e==`string`?e:e.displayName||e.name||`Component`})`,t}function d(e){let t=(0,i.use)(l),n=e??t?.component??`a`;return(0,i.useMemo)(()=>u(n),[n])}var f=o.releaseMs,p={originX:0,originY:0,phase:`idle`};function m(e,t,n){return Math.hypot(t-e.originX,n-e.originY)>10}function h(e,t,n,r){return{gesture:{...e,phase:t},paint:n,timer:r}}function g(e,t){if(t.kind===`down`)return{gesture:{originX:t.x,originY:t.y,phase:`armed`},paint:`none`,timer:`onset`};switch(e.phase){case`armed`:return t.kind===`move`?m(e,t.x,t.y)?h(e,`dead`,`none`,null):{gesture:e,paint:`none`,timer:null}:t.kind===`cancel`?h(e,`dead`,`none`,null):t.kind===`onset`?h(e,`pressed`,`on`,null):t.kind===`up`?h(e,`flash`,`on`,`flash`):{gesture:e,paint:`none`,timer:null};case`pressed`:return t.kind===`move`&&!m(e,t.x,t.y)?{gesture:e,paint:`on`,timer:null}:t.kind===`move`||t.kind===`cancel`?h(e,`dead`,`none`,null):t.kind===`up`?h(e,`fading`,`fading`,`fade`):{gesture:e,paint:`on`,timer:null};case`flash`:return t.kind===`flashEnd`?h(e,`fading`,`fading`,`fade`):{gesture:e,paint:`on`,timer:null};case`fading`:return t.kind===`fadeEnd`?{gesture:p,paint:`none`,timer:null}:{gesture:e,paint:`fading`,timer:null};case`dead`:return t.kind===`up`?{gesture:p,paint:`none`,timer:null}:{gesture:e,paint:`none`,timer:null};case`idle`:return{gesture:p,paint:`none`,timer:null}}}function _(){return p}var v=`data-astryx-pressable`,y=`data-astryx-press`,b={[v]:``},x=`:disabled, [aria-disabled="true"]`,S=null,C=0,w=0,T=null,E=0,D=null,O={fade:f,flash:100,onset:150},k={fade:`fadeEnd`,flash:`flashEnd`,onset:`onset`};function A(e,t){t===`none`?e.removeAttribute(y):e.setAttribute(y,t)}function j(){S?.timer!=null&&(clearTimeout(S.timer),S.timer=null)}function M(e){if(S==null)return;let t=e.gesture.phase!==S.gesture.phase;if((e.timer!=null||t)&&j(),S.gesture=e.gesture,A(S.element,e.paint),e.gesture.phase===`idle`)S=null;else if(e.timer!=null){let t=e.timer;S.timer=setTimeout(()=>{S!=null&&(S.timer=null),M(g(S?.gesture??_(),{kind:k[t]}))},O[t])}}function N(e){if(!(e instanceof Element))return null;let t=e.closest(`[${v}]`);return!(t instanceof HTMLElement)||t.matches(x)?null:t}function P(e){return Date.now()-w>=150?!1:T instanceof Node&&T.contains(e)}function F(){S?.gesture.phase===`dead`&&(j(),S=null)}function I(){S!=null&&(j(),S.element.removeAttribute(y),S=null)}function L(e){if(e.pointerType===`mouse`)return;if(S!=null){if(S.gesture.phase!==`fading`&&S.gesture.phase!==`flash`){I();return}I()}let t=N(e.target),n=t!=null&&P(t);E=Date.now(),D=e.target instanceof Node?e.target:null,!(t==null||n)&&(S={element:t,gesture:_(),pointerId:e.pointerId,timer:null},M(g(S.gesture,{kind:`down`,x:e.clientX,y:e.clientY})))}function R(e){S==null||S.pointerId!=null&&e.pointerId!==S.pointerId||M(g(S.gesture,{kind:`move`,x:e.clientX,y:e.clientY}))}function z(e){e.pointerType!==`mouse`&&(E=Date.now(),e.target instanceof Node&&(D=e.target),!(S==null||S.pointerId!=null&&e.pointerId!==S.pointerId)&&(M(g(S.gesture,{kind:`up`})),F()))}function B(){S!=null&&(M(g(S.gesture,{kind:`cancel`})),F())}function V(e){let t=e.target instanceof Node?e.target:document;Date.now()-E<3e3&&D!=null&&t.contains(D)&&(w=Date.now(),T=t),S!=null&&(t===document||t.contains(S.element))&&B()}function H(){document.visibilityState===`hidden`&&I()}var U={capture:!0,passive:!0};function W(){window.addEventListener(`pointerdown`,L,U),window.addEventListener(`pointermove`,R,U),window.addEventListener(`pointerup`,z,U),window.addEventListener(`pointercancel`,B,U),window.addEventListener(`touchcancel`,B,U),window.addEventListener(`dragstart`,B,U),document.addEventListener(`scroll`,V,U),document.addEventListener(`visibilitychange`,H)}function G(){window.removeEventListener(`pointerdown`,L,U),window.removeEventListener(`pointermove`,R,U),window.removeEventListener(`pointerup`,z,U),window.removeEventListener(`pointercancel`,B,U),window.removeEventListener(`touchcancel`,B,U),window.removeEventListener(`dragstart`,B,U),document.removeEventListener(`scroll`,V,U),document.removeEventListener(`visibilitychange`,H)}function K(){if(typeof window>`u`)return()=>void 0;C===0&&W(),C+=1;let e=!1;return()=>{e||(e=!0,--C,!(C>0)&&(G(),I(),w=0,T=null,E=0,D=null))}}function q(){return(0,i.useEffect)(()=>K(),[]),b}export{d as n,c as r,q as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{u as t}from"./themeProps-3IqahpCr.js";import{t as n}from"./useAnnounce-DlZth-he.js";import{i as r}from"./FieldStatus-CSAKvGxp.js";var i={kbCHJM:`x1nrll8i`,k3aq6I:`xsqj5wx`,$$css:!0},a={mirror:{k3aq6I:`xgtlewx`,$$css:!0},centerInline:e=>[i,{"--x-transform":`translate(-50%, ${e})`==null?void 0:`translate(-50%, ${e})`}]},o=e(t(),1),s=`data-astryx-modal-busy-region`,c=`position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;`,l=2e3,u=new WeakMap;function d(e,t){let n=e.querySelector(`:scope > [${s}]`);n??(n=document.createElement(`div`),n.setAttribute(s,``),n.setAttribute(`role`,`status`),n.setAttribute(`aria-live`,`polite`),n.setAttribute(`aria-atomic`,`true`),n.style.cssText=c,e.appendChild(n));let r=n,i=u.get(r);i!=null&&(cancelAnimationFrame(i.frame),clearTimeout(i.timer)),r.textContent=``;let a={frame:0};a.frame=requestAnimationFrame(()=>{r.textContent=t,a.timer=setTimeout(()=>{r.textContent=``,u.delete(r)},l)}),u.set(r,a)}function f(e,t,r){let i=n(),a=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(!e){a.current=!1;return}if(a.current)return;let n=requestAnimationFrame(()=>{a.current=!0;let e=r.current?.closest(`dialog`);e?.open&&e.matches(`:modal`)?d(e,t):i(t,`polite`)});return()=>cancelAnimationFrame(n)},[i,r,e,t])}function p({isRequired:e=!1,isOptional:t=!1}){let{defaultOptionality:n}=(0,o.use)(r);return!t&&(e||n===`required`)}export{f as n,a as r,p as t};
|
package/page/index.html
CHANGED
|
@@ -10,40 +10,46 @@
|
|
|
10
10
|
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%23000'/%3E%3Cg transform='translate(4 4)' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4.5 18.5c2 0 3-1.2 4.2-3.4l2.6-5c1-1.9 2.1-3.1 4.2-3.1'/%3E%3Cpath d='M5.5 8.2c1.6-.9 3.2-.4 3.8 1.6l2.3 6.6c.6 1.7 2.1 2.4 3.9 1.7'/%3E%3Ccircle cx='19.5' cy='4.5' r='1.6' fill='%23fff' stroke='none'/%3E%3C/g%3E%3C/svg%3E"
|
|
11
11
|
/>
|
|
12
12
|
<title>theorem studio</title>
|
|
13
|
-
<script type="module" crossorigin src="/studio/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/studio/assets/index-D-vL6Brp.js"></script>
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/studio/assets/rolldown-runtime-hePW80VL.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/studio/assets/themeProps-3IqahpCr.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/studio/assets/tokens.stylex-BpCwr7Mf.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/studio/assets/padding.stylex-B76907Zf.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/studio/assets/mergeProps-ptS-gIMz.js">
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/StackItem-
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/Stack-DPSs1dBF.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/StackItem-YZCLellt.js">
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/studio/assets/useLayerDismissal-BAnTRYTt.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/studio/assets/devWarning-DxuplmRl.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/useMediaQuery-BCT0NUeZ.js">
|
|
24
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/Icon-BWzSKxTK.js">
|
|
25
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/focusOutline.stylex-B9nWSXsG.js">
|
|
26
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/useAnnounce-DlZth-he.js">
|
|
27
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/usePressFeedback-CBSbXJuo.js">
|
|
23
28
|
<link rel="modulepreload" crossorigin href="/studio/assets/sharedResizeObserver-4U9Xq5Oq.js">
|
|
24
29
|
<link rel="modulepreload" crossorigin href="/studio/assets/preload-helper-DpV6A1kQ.js">
|
|
25
30
|
<link rel="modulepreload" crossorigin href="/studio/assets/Text-B74VhVA7.js">
|
|
26
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/useMediaQuery-BCT0NUeZ.js">
|
|
27
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/Icon-3c9WmPTH.js">
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/useAnnounce-DOkF3CS1.js">
|
|
29
31
|
<link rel="modulepreload" crossorigin href="/studio/assets/useTooltip-BaCjTHk-.js">
|
|
32
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/Spinner--TVdDovX.js">
|
|
33
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/VisuallyHidden-BdRLF-8h.js">
|
|
34
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/IconButton-CerBBPke.js">
|
|
30
35
|
<link rel="modulepreload" crossorigin href="/studio/assets/Tooltip-DrSpWxD8.js">
|
|
31
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/
|
|
32
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/focusOutline.stylex-B9nWSXsG.js">
|
|
33
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/IconButton-BeI1pXEZ.js">
|
|
36
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/FieldStatus-CSAKvGxp.js">
|
|
34
37
|
<link rel="modulepreload" crossorigin href="/studio/assets/focusableSelector-DXZeMU85.js">
|
|
35
38
|
<link rel="modulepreload" crossorigin href="/studio/assets/useDevWarning-Z9SoixOP.js">
|
|
36
39
|
<link rel="modulepreload" crossorigin href="/studio/assets/createReactComponent-CZwsv6DD.js">
|
|
37
40
|
<link rel="modulepreload" crossorigin href="/studio/assets/isRtlElement-BG33-k_H.js">
|
|
38
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/fieldParts-
|
|
39
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/
|
|
41
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/fieldParts-CNKpMZ7U.js">
|
|
42
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/useResolvedRequired-CAelf7J-.js">
|
|
43
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/useAnnounceRenderedText-BrbiKE4-.js">
|
|
40
44
|
<link rel="modulepreload" crossorigin href="/studio/assets/plainDate-BHiJcj7o.js">
|
|
41
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/OverflowList-
|
|
45
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/OverflowList-BoqbSk8e.js">
|
|
42
46
|
<link rel="modulepreload" crossorigin href="/studio/assets/useScrollableArea-DuF_pz9m.js">
|
|
43
47
|
<link rel="modulepreload" crossorigin href="/studio/assets/ScrollableArea-CZpbLBeP.js">
|
|
48
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/HStack-cOiUht-L.js">
|
|
49
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/VStack-CEcm-qoM.js">
|
|
44
50
|
<link rel="modulepreload" crossorigin href="/studio/assets/container.stylex-C2nFBhUj.js">
|
|
45
51
|
<link rel="modulepreload" crossorigin href="/studio/assets/Card-D_40unTk.js">
|
|
46
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/SidePanel-
|
|
52
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/SidePanel-DLgOJwvB.js">
|
|
47
53
|
<link rel="modulepreload" crossorigin href="/studio/assets/IconAlertTriangle-BqAEqqdU.js">
|
|
48
54
|
<link rel="modulepreload" crossorigin href="/studio/assets/schemas-D7cgkv3L.js">
|
|
49
55
|
<link rel="modulepreload" crossorigin href="/studio/assets/host-patterns-F-KZIzkF.js">
|
|
@@ -63,25 +69,26 @@
|
|
|
63
69
|
<link rel="modulepreload" crossorigin href="/studio/assets/stub-CJG-5zBe.js">
|
|
64
70
|
<link rel="modulepreload" crossorigin href="/studio/assets/reader-SzTjS7rw.js">
|
|
65
71
|
<link rel="modulepreload" crossorigin href="/studio/assets/registry-BrmnEhgs.js">
|
|
66
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/browser-transport-
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/browser-transport-EFTTaxlW.js">
|
|
67
73
|
<link rel="modulepreload" crossorigin href="/studio/assets/focusReturn-CTppP2k0.js">
|
|
68
74
|
<link rel="modulepreload" crossorigin href="/studio/assets/isRenderable-DHkzpAoQ.js">
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/labels-provider-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/useLocale-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/CheckboxInput-
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/labels-provider-BcEDhptf.js">
|
|
76
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/useLocale-DrfYfZTs.js">
|
|
77
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/CheckboxInput-BIFNQqbA.js">
|
|
72
78
|
<link rel="modulepreload" crossorigin href="/studio/assets/useScrollLock-Dyf6PHJt.js">
|
|
73
79
|
<link rel="modulepreload" crossorigin href="/studio/assets/chainEventHandlers-C6ttXGfW.js">
|
|
74
80
|
<link rel="modulepreload" crossorigin href="/studio/assets/Dialog-DUNBjHOI.js">
|
|
75
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/useClipboard-
|
|
76
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/highlightRanges-
|
|
77
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/CodeBlock-
|
|
81
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/useClipboard-DeMRGvqJ.js">
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/highlightRanges-DvvjZZAv.js">
|
|
83
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/CodeBlock-PkWvyBvu.js">
|
|
78
84
|
<link rel="modulepreload" crossorigin href="/studio/assets/HoverCard-DMHc1Gh1.js">
|
|
79
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/
|
|
85
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/inputStyles.stylex-uYr8_KtT.js">
|
|
86
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/TextInput-6ChkOVD6.js">
|
|
80
87
|
<link rel="modulepreload" crossorigin href="/studio/assets/encode-files-CCet4LKE.js">
|
|
81
88
|
<link rel="modulepreload" crossorigin href="/studio/assets/turn-client-eM8VIbMd.js">
|
|
82
89
|
<link rel="modulepreload" crossorigin href="/studio/assets/Badge-D78MvW22.js">
|
|
83
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/CollapsibleGroup-
|
|
84
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/studio-labels-
|
|
90
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/CollapsibleGroup-Dfbkt6Hp.js">
|
|
91
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/studio-labels-BT3B-xe1.js">
|
|
85
92
|
<link rel="modulepreload" crossorigin href="/studio/assets/workspace-3igDw3Tv.js">
|
|
86
93
|
<link rel="modulepreload" crossorigin href="/studio/assets/lent-keys-C32ems-I.js">
|
|
87
94
|
<link rel="modulepreload" crossorigin href="/studio/assets/editors-BJX_S59A.js">
|
|
@@ -93,13 +100,13 @@
|
|
|
93
100
|
<link rel="modulepreload" crossorigin href="/studio/assets/menuItemRoles-Bod0knkp.js">
|
|
94
101
|
<link rel="modulepreload" crossorigin href="/studio/assets/useMenuPress-DPpqa6F7.js">
|
|
95
102
|
<link rel="modulepreload" crossorigin href="/studio/assets/useAdaptivePresentation-Bma4-u1a.js">
|
|
96
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/useMenuDrillIn-
|
|
103
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/useMenuDrillIn-DOLSnkWq.js">
|
|
97
104
|
<link rel="modulepreload" crossorigin href="/studio/assets/useFocusReturnVisibility-BHKv5Jwr.js">
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/useKeyboardHint-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/ListItem-
|
|
100
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/MenuBottomSheetActionList-
|
|
105
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/useKeyboardHint-BIqbBlHw.js">
|
|
106
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/ListItem-DrfoLYVQ.js">
|
|
107
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/MenuBottomSheetActionList-CG8160ZS.js">
|
|
101
108
|
<link rel="stylesheet" crossorigin href="/studio/assets/use-second-ticker-GWBt83pd.css">
|
|
102
|
-
<link rel="stylesheet" crossorigin href="/studio/assets/index-
|
|
109
|
+
<link rel="stylesheet" crossorigin href="/studio/assets/index-hzhWkDKG.css">
|
|
103
110
|
<style>html{color-scheme:dark}html,body{margin:0;background:#000}html[data-boot-pending],html[data-boot-pending] body{background:#262626}html[data-boot-pending] .astryx-app-shell{height:100dvh}html[data-boot-pending] .astryx-app-shell-sidenav{position:absolute;inset-block:0;inset-inline-start:0;z-index:0;width:3rem}html[data-boot-pending] #astryx-app-shell-main{position:relative;z-index:1;width:100%;height:100%;max-width:none;margin:0;border-radius:0;clip-path:none;background:#262626;color:#fff}html[data-boot-pending] #astryx-app-shell-main>:not([data-boot]){visibility:hidden}html[data-boot-pending] [data-boot]{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:#262626;color:#fff}</style>
|
|
104
111
|
<noscript> <style>html[data-boot-pending],html[data-boot-pending] body{background:#000}html[data-boot-pending] #astryx-app-shell-main>:not([data-boot]){visibility:visible !important}[data-boot]{display:none !important}</style>
|
|
105
112
|
</noscript>
|
package/ui/built/theme.css
CHANGED
|
@@ -654,6 +654,31 @@
|
|
|
654
654
|
transition: none;
|
|
655
655
|
}
|
|
656
656
|
|
|
657
|
+
.astryx-dialog {
|
|
658
|
+
--font-size-xs: 0.625rem;
|
|
659
|
+
--font-size-sm: 0.75rem;
|
|
660
|
+
--font-size-base: 0.875rem;
|
|
661
|
+
--font-size-lg: 1.0625rem;
|
|
662
|
+
--font-size-xl: 1.25rem;
|
|
663
|
+
--font-size-2xl: 1.5rem;
|
|
664
|
+
--text-body-size: var(--font-size-base);
|
|
665
|
+
--text-code-size: var(--font-size-base);
|
|
666
|
+
--text-label-size: var(--font-size-base);
|
|
667
|
+
--text-large-size: var(--font-size-lg);
|
|
668
|
+
--text-supporting-size: var(--font-size-sm);
|
|
669
|
+
--text-heading-1-size: var(--font-size-2xl);
|
|
670
|
+
--text-heading-2-size: var(--font-size-xl);
|
|
671
|
+
--text-heading-3-size: var(--font-size-lg);
|
|
672
|
+
--text-heading-4-size: var(--font-size-base);
|
|
673
|
+
--text-heading-5-size: var(--font-size-sm);
|
|
674
|
+
--text-heading-6-size: var(--font-size-xs);
|
|
675
|
+
box-shadow: 0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 70%));
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
.astryx-dialog::backdrop {
|
|
679
|
+
background-color: light-dark(#00000080, #000000BF);
|
|
680
|
+
}
|
|
681
|
+
|
|
657
682
|
.astryx-toast {
|
|
658
683
|
width: fit-content;
|
|
659
684
|
min-width: min(240px, 100%);
|
|
@@ -569,6 +569,31 @@ export const theoremStudioTheme = {
|
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
571
|
},
|
|
572
|
+
"dialog": {
|
|
573
|
+
"base": {
|
|
574
|
+
"--font-size-xs": "0.625rem",
|
|
575
|
+
"--font-size-sm": "0.75rem",
|
|
576
|
+
"--font-size-base": "0.875rem",
|
|
577
|
+
"--font-size-lg": "1.0625rem",
|
|
578
|
+
"--font-size-xl": "1.25rem",
|
|
579
|
+
"--font-size-2xl": "1.5rem",
|
|
580
|
+
"--text-body-size": "var(--font-size-base)",
|
|
581
|
+
"--text-code-size": "var(--font-size-base)",
|
|
582
|
+
"--text-label-size": "var(--font-size-base)",
|
|
583
|
+
"--text-large-size": "var(--font-size-lg)",
|
|
584
|
+
"--text-supporting-size": "var(--font-size-sm)",
|
|
585
|
+
"--text-heading-1-size": "var(--font-size-2xl)",
|
|
586
|
+
"--text-heading-2-size": "var(--font-size-xl)",
|
|
587
|
+
"--text-heading-3-size": "var(--font-size-lg)",
|
|
588
|
+
"--text-heading-4-size": "var(--font-size-base)",
|
|
589
|
+
"--text-heading-5-size": "var(--font-size-sm)",
|
|
590
|
+
"--text-heading-6-size": "var(--font-size-xs)",
|
|
591
|
+
"boxShadow": "0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 70%))",
|
|
592
|
+
"::backdrop": {
|
|
593
|
+
"backgroundColor": "light-dark(#00000080, #000000BF)"
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
},
|
|
572
597
|
"toast": {
|
|
573
598
|
"base": {
|
|
574
599
|
"width": "fit-content",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type InputStatus } from '@astryxdesign/core/Field';
|
|
2
|
+
export interface JsonCodeProps {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
placeholder: string | undefined;
|
|
6
|
+
/** A placeholder that is a value, for Tab to take up. */
|
|
7
|
+
fills: string | undefined;
|
|
8
|
+
status: InputStatus | undefined;
|
|
9
|
+
onChange: (next: string) => void;
|
|
10
|
+
}
|
|
11
|
+
/** JSON as code, in a field as tall as its text. */
|
|
12
|
+
export declare function JsonCode({ label, value, placeholder, fills, status, onChange }: JsonCodeProps): import("react").JSX.Element;
|