@cartanova/qgrid-cli 2.7.9 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/dist/application/qgrid/oauth.js +5 -2
- package/bundle/dist/application/qgrid/qgrid.types.js +1 -1
- package/bundle/dist/utils/providers/anthropic/anthropic-dispatcher.js +12 -7
- package/bundle/dist/utils/providers/anthropic/anthropic-quota.js +7 -5
- package/bundle/src/application/qgrid/oauth.test.ts +28 -0
- package/bundle/src/application/qgrid/oauth.ts +5 -0
- package/bundle/src/application/qgrid/qgrid.types.ts +1 -1
- package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.test.ts +36 -0
- package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.ts +20 -7
- package/bundle/src/utils/providers/anthropic/anthropic-quota.test.ts +22 -0
- package/bundle/src/utils/providers/anthropic/anthropic-quota.ts +16 -2
- package/bundle/web-dist/client/assets/{index-D59Q_9Z4.js → index-D208L33c.js} +3 -3
- package/bundle/web-dist/client/assets/{logs-BHVfI8ut.js → logs-noN5Aka6.js} +1 -1
- package/bundle/web-dist/client/assets/{monit-EkLxH1oN.js → monit-Ber13xcA.js} +1 -1
- package/bundle/web-dist/client/assets/{routes-Kbvuclip.js → routes-3_xetpSK.js} +1 -1
- package/bundle/web-dist/client/assets/{settings-B4uTFP3J.js → settings-C5sHCg8X.js} +1 -1
- package/bundle/web-dist/client/assets/{show-BjIdSPTd.js → show-BhTgGnkc.js} +1 -1
- package/bundle/web-dist/client/assets/{tokens-BbCSxbFu.js → tokens-R7obwdAV.js} +1 -1
- package/bundle/web-dist/client/assets/{use-oauth-login-flow-4OltfVAd.js → use-oauth-login-flow-CRAqRZXX.js} +1 -1
- package/bundle/web-dist/client/index.html +1 -1
- package/bundle/web-dist/server/entry-server.generated.js +1 -1
- package/package.json +1 -1
- package/skills/qgrid/SKILL.md +7 -2
- package/skills/qgrid/references/ai-sdk-provider-contract.md +5 -0
- package/skills/qgrid/references/anthropic-claude-code-runtime.md +5 -1
- package/skills/qgrid/references/decision-rationale.md +3 -1
- package/skills/qgrid/references/docs-workflow.md +3 -3
- package/skills/qgrid/references/sonamu-api-web-flow.md +4 -2
- package/skills/qgrid/references/token-auth-quota-lifecycle.md +5 -2
- package/skills/qgrid/references/verification-and-debugging.md +19 -16
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t,l as n}from"./vendor-tanstack-DJRQAbrY.js";import{i as r,r as i}from"./vendor-react-DH4kUfK2.js";import{i as a,r as o}from"./services.generated-Da1Eq5_R.js";import{c as s,l as c,o as l,t as u}from"./index-D59Q_9Z4.js";import{n as d,t as f}from"./cost-CpjVoAqp.js";function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(null,arguments)}function m(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var h=e(r()),g=i(),_={},v=(0,h.createContext)(_),y=(e,t)=>p({},e,t),b=()=>(0,h.useContext)(v),x=(0,h.createContext)(()=>{});x.displayName=`JVR.DispatchShowTools`;function S(){return(0,h.useReducer)(y,_)}function C(){return(0,h.useContext)(x)}var w=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(v.Provider,{value:t,children:(0,g.jsx)(x.Provider,{value:n,children:r})})};w.displayName=`JVR.ShowTools`;var T={},E=(0,h.createContext)(T),D=(e,t)=>p({},e,t),O=()=>(0,h.useContext)(E),ee=(0,h.createContext)(()=>{});ee.displayName=`JVR.DispatchExpands`;function te(){return(0,h.useReducer)(D,T)}function ne(){return(0,h.useContext)(ee)}var re=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(E.Provider,{value:t,children:(0,g.jsx)(ee.Provider,{value:n,children:r})})};re.displayName=`JVR.Expands`;var ie={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},ae=(0,h.createContext)(ie),oe=(e,t)=>p({},e,t),k=()=>(0,h.useContext)(ae),A=(0,h.createContext)(()=>{});A.displayName=`JVR.DispatchTypes`;function se(){return(0,h.useReducer)(oe,ie)}function ce(){return(0,h.useContext)(A)}function le(e){var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(ae.Provider,{value:t,children:(0,g.jsx)(A.Provider,{value:n,children:r})})}le.displayName=`JVR.Types`;var ue=[`style`];function de(e){var{style:t}=e,n=m(e,ue);return(0,g.jsx)(`svg`,p({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:p({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,g.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}de.displayName=`JVR.TriangleArrow`;var fe={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,g.jsx)(de,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},pe=(0,h.createContext)(fe),me=(e,t)=>p({},e,t),j=()=>(0,h.useContext)(pe),M=(0,h.createContext)(()=>{});M.displayName=`JVR.DispatchSymbols`;function he(){return(0,h.useReducer)(me,fe)}function ge(){return(0,h.useContext)(M)}var _e=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(pe.Provider,{value:t,children:(0,g.jsx)(M.Provider,{value:n,children:r})})};_e.displayName=`JVR.Symbols`;var ve={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},ye=(0,h.createContext)(ve),be=(e,t)=>p({},e,t),N=()=>(0,h.useContext)(ye),P=(0,h.createContext)(()=>{});P.displayName=`JVR.DispatchSection`;function xe(){return(0,h.useReducer)(be,ve)}function Se(){return(0,h.useContext)(P)}var Ce=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(ye.Provider,{value:t,children:(0,g.jsx)(P.Provider,{value:n,children:r})})};Ce.displayName=`JVR.Section`;var we={objectSortKeys:!1,indentWidth:15},F=(0,h.createContext)(we);F.displayName=`JVR.Context`;var Te=(0,h.createContext)(()=>{});Te.displayName=`JVR.DispatchContext`;function Ee(e,t){return p({},e,t)}var I=()=>(0,h.useContext)(F),De=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,h.useReducer)(Ee,Object.assign({},we,n)),[o,s]=S(),[c,l]=te(),[u,d]=se(),[f,m]=he(),[_,v]=xe();return(0,h.useEffect)(()=>a(p({},n)),[n]),(0,g.jsx)(F.Provider,{value:i,children:(0,g.jsx)(Te.Provider,{value:a,children:(0,g.jsx)(w,{initial:o,dispatch:s,children:(0,g.jsx)(re,{initial:c,dispatch:l,children:(0,g.jsx)(le,{initial:p({},u,r),dispatch:d,children:(0,g.jsx)(_e,{initial:f,dispatch:m,children:(0,g.jsx)(Ce,{initial:_,dispatch:v,children:t})})})})})})})};De.displayName=`JVR.Provider`;function Oe(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var ke=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],Ae=[`as`,`render`],je=[`as`,`render`],Me=[`as`,`render`],Ne=[`as`,`style`,`render`],Pe=[`as`,`render`],Fe=[`as`,`render`],Ie=[`as`,`render`],Le=[`as`,`render`],Re=e=>{var{Quote:t={}}=j(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=m(e,ke);if(n)return null;var{as:c,render:l}=t,u=m(t,Ae),d=c||`span`,f=p({},s,u);return typeof f.children==`string`&&(f.children=f.children.trim()||void 0),l&&typeof l==`function`&&l(f,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,g.jsx)(d,p({},f))};Re.displayName=`JVR.Quote`;var L=e=>{var{ValueQuote:t={}}=j(),n=p({},(Oe(e),e)),{as:r,render:i}=t,a=m(t,je),o=r||`span`,s=p({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,g.jsx)(o,p({},s))};L.displayName=`JVR.ValueQuote`;var ze=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=j(),{as:o,render:s}=a,c=m(a,Me),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,g.jsx)(l,p({},c))};ze.displayName=`JVR.Colon`;var Be=e=>{var{Arrow:t={}}=j(),n=O(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,h=m(t,Ne),_=u||`span`,v=f&&typeof f==`function`,y=p({},h,{"data-expanded":l,style:p({},d,i)});return v&&f(y,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,g.jsx)(_,p({},h,{style:p({},d,i)}))};Be.displayName=`JVR.Arrow`;var Ve=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=j(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=m(o,Pe),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,g.jsx)(f,p({},d))}var{as:h,render:_}=s,v=m(s,Fe),y=h||`span`;return _&&typeof _==`function`&&_(v,c)||(0,g.jsx)(y,p({},v))};Ve.displayName=`JVR.BracketsOpen`;var He=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=j();if(t){var{as:u,render:d}=c,f=m(c,Ie),h=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,g.jsx)(h,p({},f))}var{as:_,render:v}=l,y=m(l,Le),b=_||`span`;return v&&typeof v==`function`&&v(y,s)||(0,g.jsx)(b,p({},y))};He.displayName=`JVR.BracketsClose`;var Ue=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=O(),{collapsed:c,shouldExpandNodeInitially:l}=I(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),f=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!f)return null}else if(s[r]===void 0&&f)return null;var m=Object.keys(n).length;if(d||m===0)return null;var h={paddingLeft:4},_={keyName:t,value:n,keys:o,parentValue:i},v=Array.isArray(n),y=n instanceof Set;return(0,g.jsx)(`div`,{style:h,children:(0,g.jsx)(He,p({isBrackets:v||y},_,{isVisiable:!0}))})};Ue.displayName=`JVR.NestedClose`;var We=[`as`,`render`],Ge=[`as`,`render`],Ke=[`as`,`render`],qe=[`as`,`render`],Je=[`as`,`render`],Ye=[`as`,`render`],Xe=[`as`,`render`],Ze=[`as`,`render`],Qe=[`as`,`render`],$e=[`as`,`render`],et=[`as`,`render`],tt=[`as`,`render`],nt=[`as`,`render`],R=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},rt=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=k();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=m(r,We);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,g.jsx)(a||`span`,p({},s))};rt.displayName=`JVR.SetComp`;var it=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=k();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=m(r,Ge);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,g.jsx)(a||`span`,p({},s))};it.displayName=`JVR.MapComp`;var z={opacity:.75,paddingRight:4},at=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=k(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=I(),{as:c,render:l}=i,u=m(i,Ke),d=t,[f,_]=(0,h.useState)(o&&d.length>o);(0,h.useEffect)(()=>_(o&&d.length>o),[o]);var v=c||`span`,y=p({},z,i.style||{});o>0&&(u.style=p({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{_(!f)}));var b=f?``+d.slice(0,o)+s:d,x=l&&typeof l==`function`,S=x&&l(p({},u,{style:y}),{type:`type`,value:t,keyName:n,keys:r}),C=f?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,w=x&&l(p({},u,{children:b,className:C}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(S||(0,g.jsx)(v,p({},u,{style:y}))),w||(0,g.jsxs)(h.Fragment,{children:[(0,g.jsx)(L,{}),(0,g.jsx)(v,p({},u,{className:C,children:b})),(0,g.jsx)(L,{})]})]})};at.displayName=`JVR.TypeString`;var ot=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,qe),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ot.displayName=`JVR.TypeTrue`;var st=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Je),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};st.displayName=`JVR.TypeFalse`;var ct=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Ye),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ct.displayName=`JVR.TypeFloat`;var lt=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Xe),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};lt.displayName=`JVR.TypeInt`;var ut=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Ze),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:R(t?.toString())}))]})};ut.displayName=`JVR.TypeFloat`;var dt=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Qe),l=o||`span`,u=p({},z,i.style),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsxs)(`a`,p({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,g.jsx)(L,{}),t?.href,(0,g.jsx)(L,{})]}))]})};dt.displayName=`JVR.TypeUrl`;var ft=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,$e),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=t instanceof Date?t.toLocaleString():t,v=d&&s(p({},c,{children:_,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),v||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:_}))]})};ft.displayName=`JVR.TypeDate`;var pt=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,et),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_]})};pt.displayName=`JVR.TypeUndefined`;var mt=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,tt),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_]})};mt.displayName=`JVR.TypeNull`;var ht=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,nt),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_]})};ht.displayName=`JVR.TypeNan`;var gt=e=>Number(e)===e&&e%1!=0||isNaN(e),_t=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,g.jsx)(dt,p({},i,{children:t})):typeof t==`string`?(0,g.jsx)(at,p({},i,{children:t})):t===!0?(0,g.jsx)(ot,p({},i,{children:t})):t===!1?(0,g.jsx)(st,p({},i,{children:t})):t===null?(0,g.jsx)(mt,p({},i,{children:t})):t===void 0?(0,g.jsx)(pt,p({},i,{children:t})):t instanceof Date?(0,g.jsx)(ft,p({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,g.jsx)(ht,p({},i,{children:t})):typeof t==`number`&>(t)?(0,g.jsx)(ct,p({},i,{children:t})):typeof t==`bigint`?(0,g.jsx)(ut,p({},i,{children:t})):typeof t==`number`?(0,g.jsx)(lt,p({},i,{children:t})):null};_t.displayName=`JVR.Value`;function B(e,t,n){var r=ge(),i=p({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:p({},e.style,t.style),children:t.children||e.children});(0,h.useEffect)(()=>r({[n]:i}),[t])}function V(e,t,n){var r=ce(),i=p({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:p({},e.style,t.style),children:t.children||e.children});(0,h.useEffect)(()=>r({[n]:i}),[t])}function H(e,t,n){var r=Se(),i=p({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:p({},e.style,t.style),children:t.children||e.children});(0,h.useEffect)(()=>r({[n]:i}),[t])}var vt=[`as`,`render`],yt=e=>{var{KeyName:t={}}=N();return H(t,e,`KeyName`),null};yt.displayName=`JVR.KeyName`;var bt=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=N(),{as:c,render:l}=s,u=m(s,vt);u.style=p({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(p({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,g.jsx)(d,p({},u,{children:t}))};bt.displayName=`JVR.KeyNameComp`;var xt=[`children`,`value`,`parentValue`,`keyName`,`keys`],St=[`as`,`render`,`children`],Ct=e=>{var{Row:t={}}=N();return H(t,e,`Row`),null};Ct.displayName=`JVR.Row`;var wt=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=m(e,xt),{Row:s={}}=N(),{as:c,render:l}=s,u=m(s,St),d=c||`div`;return l&&typeof l==`function`&&l(p({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,g.jsx)(d,p({},o,u,{children:t}))};wt.displayName=`JVR.RowComp`;function Tt(e){var t=(0,h.useRef)();return(0,h.useEffect)(()=>{t.current=e}),t.current}function Et(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=Tt(t),a=(0,h.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,h.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var Dt=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Ot=[`as`,`render`],U=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=m(e,Dt),{onCopied:c,enableClipboard:l,beforeCopy:u}=I(),d=b()[i],[f,_]=(0,h.useState)(!1),{Copied:v={}}=N(),y=v?.beforeCopy;if(l===!1||!d)return null;var x={style:{display:`inline-flex`},fill:f?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?R(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?R(t):t,2);var l=o||y||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),_(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{_(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:S}=v,C=m(v,Ot),w=p({},C,s,x,{style:p({},C.style,s.style,x.style)});return S&&typeof S==`function`&&S(p({},w,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,g.jsx)(`svg`,p({viewBox:`0 0 32 36`},w,{children:(0,g.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,g.jsx)(`svg`,p({viewBox:`0 0 32 36`},w,{children:(0,g.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};U.displayName=`JVR.Copied`;function kt(){var e=(0,h.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var At=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=O(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=I(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var h=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(h=c===!0?h.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):h.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,g.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:h.map((e,t)=>{var[r,o]=e;return(0,g.jsx)(jt,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};At.displayName=`JVR.KeyValues`;var W=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=I(),o=typeof t==`number`,s=(0,h.useRef)(null);Et({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,g.jsxs)(h.Fragment,{children:[(0,g.jsxs)(`span`,{ref:s,children:[(0,g.jsx)(Re,p({isNumber:o,"data-placement":`left`},c)),(0,g.jsx)(bt,p({},c,{children:t})),(0,g.jsx)(Re,p({isNumber:o,"data-placement":`right`},c))]}),(0,g.jsx)(ze,p({},c))]})};W.displayName=`JVR.KayName`;var jt=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=C(),s=kt(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,f=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!f||c||l||u?(0,g.jsx)(G,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,g.jsxs)(wt,p({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,g.jsx)(W,{keyName:t,value:n,keys:a,parentValue:r}),(0,g.jsx)(_t,{keyName:t,value:n,keys:a}),(0,g.jsx)(U,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};jt.displayName=`JVR.KeyValuesItem`;var Mt=[`value`,`keyName`],Nt=[`as`,`render`],Pt=e=>{var{CountInfoExtra:t={}}=N();return H(t,e,`CountInfoExtra`),null};Pt.displayName=`JVR.CountInfoExtra`;var Ft=e=>{var{value:t={},keyName:n}=e,r=m(e,Mt),{CountInfoExtra:i={}}=N(),{as:a,render:o}=i,s=m(i,Nt);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=p({},s,r);return l&&o(u,{value:t,keyName:n})||(0,g.jsx)(c,p({},u))};Ft.displayName=`JVR.CountInfoExtraComps`;var It=[`value`,`keyName`],Lt=[`as`,`render`],Rt=e=>{var{CountInfo:t={}}=N();return H(t,e,`CountInfo`),null};Rt.displayName=`JVR.CountInfo`;var zt=e=>{var{value:t={},keyName:n}=e,r=m(e,It),{displayObjectSize:i}=I(),{CountInfo:a={}}=N();if(!i)return null;var{as:o,render:s}=a,c=m(a,Lt),l=o||`span`;c.style=p({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=p({},c,r);return s&&typeof s==`function`&&s(p({},d,{"data-length":u}),{value:t,keyName:n})||(0,g.jsx)(l,p({},d))};zt.displayName=`JVR.CountInfoComp`;var Bt=[`as`,`render`],Vt=e=>{var{Ellipsis:t={}}=N();return H(t,e,`Ellipsis`),null};Vt.displayName=`JVR.Ellipsis`;var Ht=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=N(),{as:a,render:o}=i,s=m(i,Bt),c=a||`span`;return o&&typeof o==`function`&&o(p({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,g.jsx)(c,p({},s)))};Ht.displayName=`JVR.EllipsisComp`;var Ut=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=O(),l=ne(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=I(),m=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,h=c[n]??(f?!1:m),_=f&&f(!h,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&f&&(h=!_);var v=()=>{var e={expand:!h,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},y={display:`inline-flex`,alignItems:`center`},b={transform:`rotate(`+(h?`-90`:`0`)+`deg)`,transition:`all 0.3s`},x=Object.keys(a).length,S=typeof a==`object`,C=Array.isArray(a),w=a instanceof Set,T=x!==0&&(C||w||S),E={style:y};T&&(E.onClick=v);var D={keyName:t,value:a,keys:r,parentValue:o};return(0,g.jsxs)(`span`,p({},E,{children:[T&&(0,g.jsx)(Be,p({style:b,expandKey:n},D)),(t||typeof t==`number`)&&(0,g.jsx)(W,p({},D)),(0,g.jsx)(rt,{value:i,keyName:t}),(0,g.jsx)(it,{value:i,keyName:t}),(0,g.jsx)(Ve,p({isBrackets:C||w},D)),(0,g.jsx)(Ht,{keyName:t,value:a,isExpanded:h}),(0,g.jsx)(He,p({isVisiable:h||!T,isBrackets:C||w},D)),(0,g.jsx)(zt,{value:a,keyName:t}),(0,g.jsx)(Ft,{value:a,keyName:t}),(0,g.jsx)(U,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};Ut.displayName=`JVR.NestedOpen`;var Wt=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],G=(0,h.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=m(e,Wt),u=C(),d=kt();return(0,g.jsxs)(`div`,p({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,g.jsx)(Ut,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,g.jsx)(At,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,g.jsx)(Ue,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});G.displayName=`JVR.Container`;var Gt=e=>{var{BraceLeft:t={}}=j();return B(t,e,`BraceLeft`),null};Gt.displayName=`JVR.BraceLeft`;var Kt=e=>{var{BraceRight:t={}}=j();return B(t,e,`BraceRight`),null};Kt.displayName=`JVR.BraceRight`;var qt=e=>{var{BracketsLeft:t={}}=j();return B(t,e,`BracketsLeft`),null};qt.displayName=`JVR.BracketsLeft`;var Jt=e=>{var{BracketsRight:t={}}=j();return B(t,e,`BracketsRight`),null};Jt.displayName=`JVR.BracketsRight`;var Yt=e=>{var{Arrow:t={}}=j();return B(t,e,`Arrow`),null};Yt.displayName=`JVR.Arrow`;var Xt=e=>{var{Colon:t={}}=j();return B(t,e,`Colon`),null};Xt.displayName=`JVR.Colon`;var Zt=e=>{var{Quote:t={}}=j();return B(t,e,`Quote`),null};Zt.displayName=`JVR.Quote`;var Qt=e=>{var{ValueQuote:t={}}=j();return B(t,e,`ValueQuote`),null};Qt.displayName=`JVR.ValueQuote`;var $t=e=>{var{Bigint:t={}}=k();return V(t,e,`Bigint`),null};$t.displayName=`JVR.Bigint`;var en=e=>{var{Date:t={}}=k();return V(t,e,`Date`),null};en.displayName=`JVR.Date`;var tn=e=>{var{False:t={}}=k();return V(t,e,`False`),null};tn.displayName=`JVR.False`;var nn=e=>{var{Float:t={}}=k();return V(t,e,`Float`),null};nn.displayName=`JVR.Float`;var rn=e=>{var{Int:t={}}=k();return V(t,e,`Int`),null};rn.displayName=`JVR.Int`;var an=e=>{var{Map:t={}}=k();return V(t,e,`Map`),null};an.displayName=`JVR.Map`;var on=e=>{var{Nan:t={}}=k();return V(t,e,`Nan`),null};on.displayName=`JVR.Nan`;var sn=e=>{var{Null:t={}}=k();return V(t,e,`Null`),null};sn.displayName=`JVR.Null`;var cn=e=>{var{Set:t={}}=k();return V(t,e,`Set`),null};cn.displayName=`JVR.Set`;var ln=e=>{var{Str:t={}}=k();return V(t,e,`Str`),null};ln.displayName=`JVR.StringText`;var un=e=>{var{True:t={}}=k();return V(t,e,`True`),null};un.displayName=`JVR.True`;var dn=e=>{var{Undefined:t={}}=k();return V(t,e,`Undefined`),null};dn.displayName=`JVR.Undefined`;var fn=e=>{var{Url:t={}}=k();return V(t,e,`Url`),null};fn.displayName=`JVR.Url`;var pn=e=>{var{Copied:t={}}=N();return H(t,e,`Copied`),null};pn.displayName=`JVR.Copied`;var mn=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],K=(0,h.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:f=!0,enableClipboard:h=!0,displayDataTypes:_=!0,objectSortKeys:v=!1,onExpand:y,onCopied:b,beforeCopy:x}=e,S=m(e,mn),C=p({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),w=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,g.jsxs)(De,{initialState:{value:i,objectSortKeys:v,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:h,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:f,onCopied:b,onExpand:y,beforeCopy:x},initialTypes:{displayDataTypes:_},children:[(0,g.jsx)(G,p({value:i},S,{ref:t,className:w,style:C})),a]})});K.Bigint=$t,K.Date=en,K.False=tn,K.Float=nn,K.Int=rn,K.Map=an,K.Nan=on,K.Null=sn,K.Set=cn,K.String=ln,K.True=un,K.Undefined=dn,K.Url=fn,K.ValueQuote=Qt,K.Arrow=Yt,K.Colon=Xt,K.Quote=Zt,K.Ellipsis=Vt,K.BraceLeft=Gt,K.BraceRight=Kt,K.BracketsLeft=qt,K.BracketsRight=Jt,K.Copied=pn,K.CountInfo=Rt,K.CountInfoExtra=Pt,K.KeyName=yt,K.Row=Ct,K.displayName=`JVR.JsonView`;var hn={"--w-rjv-font-family":`monospace`,"--w-rjv-color":`#002b36`,"--w-rjv-key-string":`#002b36`,"--w-rjv-background-color":`#ffffff`,"--w-rjv-line-color":`#ebebeb`,"--w-rjv-arrow-color":`var(--w-rjv-color)`,"--w-rjv-edit-color":`var(--w-rjv-color)`,"--w-rjv-info-color":`#0000004d`,"--w-rjv-update-color":`#ebcb8b`,"--w-rjv-copied-color":`#002b36`,"--w-rjv-copied-success-color":`#28a745`,"--w-rjv-curlybraces-color":`#236a7c`,"--w-rjv-colon-color":`#002b36`,"--w-rjv-brackets-color":`#236a7c`,"--w-rjv-quotes-color":`var(--w-rjv-key-string)`,"--w-rjv-quotes-string-color":`var(--w-rjv-type-string-color)`,"--w-rjv-type-string-color":`#cb4b16`,"--w-rjv-type-int-color":`#268bd2`,"--w-rjv-type-float-color":`#859900`,"--w-rjv-type-bigint-color":`#268bd2`,"--w-rjv-type-boolean-color":`#2aa198`,"--w-rjv-type-date-color":`#586e75`,"--w-rjv-type-url-color":`#0969da`,"--w-rjv-type-null-color":`#d33682`,"--w-rjv-type-nan-color":`#859900`,"--w-rjv-type-undefined-color":`#586e75`},gn=e=>(0,g.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,g.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m12 19l-7-7l7-7m7 7H5`})}),_n=e=>(0,g.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,g.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20 6L9 17l-5-5`})}),q=e=>(0,g.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,g.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m6 9l6 6l6-6`})}),vn=e=>(0,g.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,g.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,g.jsx)(`rect`,{width:14,height:14,x:8,y:8,rx:2,ry:2}),(0,g.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})});function yn(){let{id:e}=u.useSearch();return(0,g.jsx)(sr,{id:e})}function J(e){return e.toLocaleString()}var bn=new Set;function xn(e){try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}}function Sn(e){if(!e)return{};try{return JSON.parse(e)}catch{return e}}function Y({text:e,dark:t}){let[n,r]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(!1),1500);return()=>clearTimeout(e)},[n]),(0,g.jsx)(`button`,{type:`button`,className:`absolute top-2 right-2 p-1 rounded transition-colors ${t?`text-sand-500 hover:text-sand-300`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>{navigator.clipboard.writeText(e),r(!0)},children:n?(0,g.jsx)(_n,{className:`size-3.5 text-sage-500`}):(0,g.jsx)(vn,{className:`size-3.5`})})}var Cn=/<img\s+[^>]*src=["'](data:image\/[^"']+;base64,[^"']+)["'][^>]*(?:alt=["']([^"']*)["'][^>]*)?\/?>/gi;function wn(e){let t=[],n=0;for(let r of e.matchAll(Cn)){let i=r.index??0;i>n&&t.push({type:`text`,text:e.slice(n,i)}),t.push({type:`image`,src:r[1],alt:r[2]??`generated image`}),n=i+r[0].length}return n<e.length&&t.push({type:`text`,text:e.slice(n)}),t.filter(e=>e.type===`image`||e.text.trim().length>0)}function Tn({text:e,markdown:t}){let[n,r]=(0,h.useState)(null),i=wn(e);return i.some(e=>e.type===`image`)?(0,g.jsxs)(`div`,{className:`space-y-3`,children:[i.map((e,n)=>e.type===`text`?t?(0,g.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,g.jsx)(c,{remarkPlugins:[s],children:e.text})},`text-${n}`):(0,g.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e.text},`text-${n}`):(0,g.jsx)(`button`,{type:`button`,className:`block max-w-full rounded-md border border-sand-200 overflow-hidden bg-white hover:border-sienna-300 transition-colors`,onClick:()=>r(e.src),title:`Open image`,children:(0,g.jsx)(`img`,{src:e.src,alt:e.alt,className:`max-h-[520px] max-w-full object-contain`,loading:`lazy`})},`image-${n}`)),n&&(0,g.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-black/70 p-4 flex items-center justify-center`,onClick:()=>r(null),children:[(0,g.jsx)(`button`,{type:`button`,className:`absolute top-4 right-4 p-2 rounded-full bg-white/90 text-sand-700 hover:bg-white`,onClick:()=>r(null),title:`Close image`,children:(0,g.jsx)(l,{className:`size-5`})}),(0,g.jsx)(`img`,{src:n,alt:`generated preview`,className:`max-h-full max-w-full object-contain rounded-md bg-white`,onClick:e=>e.stopPropagation()})]})]}):t?(0,g.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,g.jsx)(c,{remarkPlugins:[s],children:e})}):(0,g.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e})}function X({text:e,markdown:t}){let n=xn(e),[r,i]=(0,h.useState)(`pretty`),a=n.ok&&n.value!==null&&(Array.isArray(n.value)||typeof n.value==`object`);return!n.ok||!a?t?(0,g.jsx)(Tn,{text:e,markdown:!0}):(0,g.jsx)(Tn,{text:n.ok?JSON.stringify(n.value,null,2):e}):(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex gap-1 mb-2`,children:[(0,g.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`plain`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`plain`),children:`Plain`}),(0,g.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`pretty`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`pretty`),children:`Pretty`})]}),r===`pretty`?(0,g.jsx)(K,{value:n.value,style:hn,displayDataTypes:!1,enableClipboard:!0,collapsed:!1}):(0,g.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:JSON.stringify(n.value,null,2)})]})}function Z({title:e,defaultOpen:t=!0,headerMetadata:n,onOpenChange:r,children:i}){let[a,o]=(0,h.useState)(t);return(0,g.jsxs)(`details`,{open:a,className:`group panel overflow-hidden`,onToggle:e=>{let t=e.currentTarget.open;o(t),r?.(t)},children:[(0,g.jsxs)(`summary`,{className:`panel-header flex min-w-0 items-center gap-1.5 whitespace-nowrap cursor-pointer select-none list-none px-4 py-2.5`,children:[(0,g.jsx)(q,{className:`size-3.5 shrink-0 text-sand-400 transition-transform group-open:rotate-0 -rotate-90`}),(0,g.jsx)(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wider text-sand-500 font-medium`,children:e}),n&&(0,g.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden whitespace-nowrap text-[11px] normal-case text-sand-400`,children:n})]}),(0,g.jsx)(`div`,{className:`p-4`,children:i})]})}function Q({label:e,value:t}){return(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,g.jsx)(`dd`,{className:`text-[15px] font-semibold text-sand-800 tabular-nums mt-0.5 truncate`,children:t})]})}var En={running:`bg-blue-100 text-blue-600`,succeeded:`bg-sage-100 text-sage-600`,error:`bg-red-100 text-red-600`,aborted:`bg-caution-400/15 text-caution-500`};function Dn({message:e}){return(0,g.jsxs)(`div`,{className:`panel overflow-hidden border border-red-200 bg-red-50/60`,children:[(0,g.jsx)(`div`,{className:`px-4 py-2.5 border-b border-red-100 flex items-center gap-1.5`,children:(0,g.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-red-600 font-medium`,children:`Error`})}),(0,g.jsx)(`div`,{className:`p-4`,children:(0,g.jsx)(`pre`,{className:`text-[12px] text-red-700 whitespace-pre-wrap break-words font-mono leading-relaxed max-h-80 overflow-auto`,children:e})})]})}function On({data:e}){let t=e.status===`running`,n=!t&&e.requested_model_name!==null&&e.model_name!==null&&e.requested_model_name!==e.model_name,r=!t&&e.requested_model_name!==null&&e.model_name===null;return(0,g.jsxs)(`div`,{className:`panel overflow-hidden px-4 py-3 flex flex-wrap items-center gap-x-2 gap-y-1.5 sm:px-5`,children:[(0,g.jsx)(`span`,{className:`text-[15px] font-semibold text-sand-900 break-all`,children:t?`실행 중`:n?`${e.requested_model_name} → ${e.model_name}`:e.model_name??e.requested_model_name??`Unknown model`}),r&&(0,g.jsx)(`span`,{className:`text-[10px] text-sand-400`,children:`요청`}),!t&&(e.fallback_count??0)>0&&(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:[`fallback ×`,e.fallback_count]}),!t&&e.status!==`succeeded`&&(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium uppercase ${En[e.status]??`bg-sand-100 text-sand-500`}`,children:e.status}),e.response_json_ok===!1&&(0,g.jsx)(`span`,{title:`structured 요청의 응답이 JSON 파싱에 실패했습니다`,className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:`broken json`}),e.effort&&(0,g.jsxs)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded-md bg-sand-100 text-sand-500 font-mono`,children:[`effort=`,e.effort]}),e.project_name&&(0,g.jsxs)(`span`,{className:`text-[12px] text-sand-400`,children:[`· project=`,e.project_name]}),(0,g.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400`,children:e.token_name})]})}function kn({data:e,toolCallCount:t}){let n=Nn(e);return(0,g.jsxs)(`div`,{className:`panel overflow-hidden px-5 py-3 space-y-3`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,g.jsx)(Q,{label:`Duration`,value:`${(e.duration_ms/1e3).toFixed(1)}s`}),(0,g.jsx)(Q,{label:`TTFT`,value:jn(e.ttft_ms)}),(0,g.jsx)(Q,{label:`Tokens/sec`,value:Pn(e.output_tokens,e.duration_ms,e.ttft_ms,n)}),(0,g.jsx)(Q,{label:`Driver Cost`,value:e.cost_usd===null?`—`:d(e.cost_usd)}),(0,g.jsx)(Q,{label:`Cost Source`,value:e.cost_source??`legacy`}),(0,g.jsx)(Q,{label:`Image Cost`,value:e.image_cost_usd===null?`—`:d(e.image_cost_usd)}),(0,g.jsx)(Q,{label:`Tool Calls`,value:`${t}회`})]}),(0,g.jsxs)(`div`,{className:`border-t border-sand-100/60 pt-3 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,g.jsx)(Q,{label:`Input`,value:J(e.input_tokens)}),(0,g.jsx)(Q,{label:`Output`,value:J(e.output_tokens)}),(0,g.jsx)(Q,{label:`Cache Read`,value:J(e.cache_read_tokens)}),(0,g.jsx)(Q,{label:`Cache Write`,value:J(e.cache_creation_tokens)}),(0,g.jsx)(Q,{label:`Cache Write (5m)`,value:e.cache_creation_5m_tokens===null?`—`:J(e.cache_creation_5m_tokens)}),(0,g.jsx)(Q,{label:`Cache Write (1h)`,value:e.cache_creation_1h_tokens===null?`—`:J(e.cache_creation_1h_tokens)}),(0,g.jsx)(Q,{label:`Cache Hit`,value:f(e)})]})]})}function An(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function jn(e){return e==null||e<=0?`—`:An(e)}function Mn(e){let t=e.model_name?.trim().toLowerCase();if(t){let e=t.includes(`/`)?t.split(`/`).pop():t;if(e.startsWith(`claude-`))return`anthropic`;if(/^(gpt-|codex-|o\d)/.test(e))return`openai`}let n=e.token_name?.trim().toLowerCase();return n?.startsWith(`anthropic/`)?`anthropic`:n?.startsWith(`openai/`)?`openai`:null}function Nn(e){let t=Mn(e);return t!==null&&bn.has(t)}function Pn(e,t,n,r){if(!r||e==null||t==null||n==null||n<=0)return`—`;let i=t-n;return e<=0||i<=0?`—`:`${Math.round(e/(i/1e3)).toLocaleString()} tok/s`}function $({label:e,value:t}){return(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,g.jsx)(`div`,{className:`mt-0.5 text-[13px] font-semibold text-sand-800 tabular-nums truncate`,children:t})]})}function Fn(e){if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e.inputImages;return Array.isArray(t)?t:void 0}function In(e){return(Fn(e)??[]).filter(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.url==`string`&&t.url.length>0||typeof t.data==`string`&&t.data.length>0})}function Ln(e){if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=Fn(t);return n?{...t,inputImages:n.map(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=typeof t.url==`string`&&t.url.toLowerCase().startsWith(`data:`)?`[data-url ${t.url.length} chars]`:t.url;return{mediaType:t.mediaType,byteSize:t.byteSize,...n?{url:n}:{},...t.data?{data:`[base64 ${t.data.length} chars]`}:{}}})}:e}function Rn({images:e}){let t=e.map((e,t)=>{let n=e.url&&!e.url.startsWith(`[`)?e.url:void 0,r=e.data?`data:${e.mediaType??`image/png`};base64,${e.data}`:``,i=n??r;return i?{image:e,index:t,src:i}:null}).filter(e=>e!==null);return t.length===0?null:(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Input Images`}),(0,g.jsx)(`div`,{className:`mt-1 grid grid-cols-1 sm:grid-cols-2 gap-2`,children:t.map(({image:e,index:t,src:n})=>(0,g.jsxs)(`div`,{className:`rounded-md border border-sand-200 bg-white overflow-hidden`,children:[(0,g.jsx)(`img`,{src:n,alt:`reference ${t+1}`,className:`max-h-64 w-full object-contain bg-white`,loading:`lazy`}),(0,g.jsxs)(`div`,{className:`px-2 py-1 text-[10px] text-sand-500 font-mono border-t border-sand-100`,children:[e.mediaType??`image`,` ·`,` `,e.byteSize===void 0?`url`:`${e.byteSize.toLocaleString()} bytes`]})]},`${e.mediaType??`image`}-${t}`))})]})}function zn({stepId:e}){let{data:t}=a.useRequestLogStep(`I`,e??0,{enabled:e!==null});return(0,g.jsx)(Rn,{images:In(t?Sn(t.tool_args):null)})}function Bn({entry:e}){let t=!!e.error,[n,r]=(0,h.useState)(!1),{data:i}=a.useRequestLogStep(`A`,e.id,{enabled:n}),o=Ln(i?Sn(i.tool_args):null),s=i?Sn(i.tool_result):null,c=i?.error??e.error;return(0,g.jsxs)(`details`,{className:`group/tool`,onToggle:e=>r(e.currentTarget.open),children:[(0,g.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none list-none hover:bg-sand-50 transition-colors rounded-md`,children:[(0,g.jsx)(q,{className:`size-3 text-sand-400 transition-transform group-open/tool:rotate-0 -rotate-90 shrink-0`}),(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:[`call `,e.callIndex+1]}),(0,g.jsx)(`span`,{className:`text-[13px] font-medium text-sand-800 font-mono truncate`,children:e.toolName}),t&&(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:`error`}),(0,g.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:An(e.durationMs)})]}),n&&(0,g.jsxs)(`div`,{className:`mt-1 mx-1 mb-3 space-y-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Request`}),(0,g.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,g.jsx)(X,{text:i?JSON.stringify(o):`Loading...`})})]}),c&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-red-500 font-medium px-2`,children:`Error`}),(0,g.jsx)(`div`,{className:`mt-1 rounded-md bg-red-50 border border-red-100 p-3 overflow-auto`,children:(0,g.jsx)(X,{text:c})})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Response`}),(0,g.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,g.jsx)(X,{text:i?typeof s==`string`?s:JSON.stringify(s):`Loading...`,markdown:!0})})]})]})]})}function Vn({stepId:e}){let[t,n]=(0,h.useState)(!1),{data:r}=a.useRequestLogStep(`A`,e,{enabled:t}),i=r?.reasoning_text??null;return(0,g.jsxs)(`details`,{className:`group/reason mt-3`,onToggle:e=>n(e.currentTarget.open),children:[(0,g.jsxs)(`summary`,{className:`flex items-center gap-2 cursor-pointer select-none list-none`,children:[(0,g.jsx)(q,{className:`size-3 text-sand-400 transition-transform group-open/reason:rotate-0 -rotate-90 shrink-0`}),(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Reasoning`})]}),t&&(0,g.jsx)(`div`,{className:`mt-2 rounded-md bg-white/70 border border-sand-100 p-3 overflow-auto`,children:i?(0,g.jsx)(X,{text:i,markdown:!0}):r?(0,g.jsx)(`p`,{className:`text-sm text-sand-400`,children:`No reasoning text captured.`}):(0,g.jsx)(`p`,{className:`text-sm text-sand-400`,children:`Loading...`})})]})}function Hn({entry:e,tokensPerSecEnabled:t}){let n=e.generate,r=n!==null&&n.reasoningTokens!==null&&n.reasoningTokens!==void 0&&n.reasoningTokens>0,i=e.toolCalls.filter(e=>e.error).length;return(0,g.jsxs)(`details`,{open:!0,className:`group/step border-l border-sand-200 pl-3`,children:[(0,g.jsxs)(`summary`,{className:`flex items-center gap-2 py-2 cursor-pointer select-none list-none`,children:[(0,g.jsx)(q,{className:`size-3.5 text-sand-400 transition-transform group-open/step:rotate-0 -rotate-90 shrink-0`}),(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sienna-100 text-sienna-700 font-mono shrink-0`,children:[`step `,e.stepIndex+1]}),(0,g.jsx)(`span`,{className:`text-[13px] font-semibold text-sand-900`,children:`LLM call`}),n?.finishReason&&(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:n.finishReason}),n&&(n.fallbackCount??0)>0&&(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase shrink-0`,children:[n.requestedModelName,` → `,n.modelName]}),r&&(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 font-medium shrink-0`,children:`reasoning`}),i>0&&(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:[i,` error`]}),(0,g.jsxs)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:[e.toolCalls.length,` tools`]})]}),(0,g.jsxs)(`div`,{className:`ml-4 mb-4 space-y-3`,children:[n&&(0,g.jsxs)(`div`,{className:`rounded-md border border-sand-100 bg-sand-50/70 p-3`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-8 gap-x-4 gap-y-3`,children:[(0,g.jsx)($,{label:`Duration`,value:An(n.durationMs)}),(0,g.jsx)($,{label:`TTFT`,value:jn(n.ttftMs)}),(0,g.jsx)($,{label:`Tokens/sec`,value:Pn(n.outputTokens,n.durationMs,n.ttftMs,t)}),(0,g.jsx)($,{label:`Input`,value:J(n.inputTokens??0)}),(0,g.jsx)($,{label:`Output`,value:J(n.outputTokens??0)}),(0,g.jsx)($,{label:`Cache Read`,value:J(n.cacheReadTokens??0)}),(0,g.jsx)($,{label:`Cache Write`,value:J(n.cacheCreationTokens??0)}),(0,g.jsx)($,{label:`Cache 5m / 1h`,value:`${n.cacheCreation5mTokens===null?`—`:J(n.cacheCreation5mTokens)} / ${n.cacheCreation1hTokens===null?`—`:J(n.cacheCreation1hTokens)}`}),(0,g.jsx)($,{label:`Cost`,value:n.costUsd===null?`—`:d(n.costUsd)}),(0,g.jsx)($,{label:`Cost Source`,value:n.costSource??`legacy`}),(0,g.jsx)($,{label:`Reasoning`,value:n.reasoningTokens!==null&&n.reasoningTokens!==void 0?J(n.reasoningTokens):`—`})]}),r&&(0,g.jsx)(Vn,{stepId:n.id})]}),e.toolCalls.length>0&&(0,g.jsx)(`div`,{className:`space-y-0.5`,children:e.toolCalls.map(e=>(0,g.jsx)(Bn,{entry:e},`${e.stepIndex}-${e.callIndex}-${e.toolCallId}`))})]})]})}function Un({steps:e,tokensPerSecEnabled:t}){let n=e.reduce((e,t)=>e+t.toolCalls.length,0);return(0,g.jsx)(Z,{title:`Steps (${e.length} steps · ${n} tool calls)`,defaultOpen:!0,children:(0,g.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,g.jsx)(Hn,{entry:e,tokensPerSecEnabled:t},e.stepIndex))})})}function Wn(e){let t=new Map;function n(e){let n=t.get(e);if(n)return n;let r={stepIndex:e,generate:null,toolCalls:[]};return t.set(e,r),r}for(let t of e){let e=n(t.step_index);if(t.type===`generate`){e.generate={id:t.id,stepIndex:t.step_index,modelName:t.model_name,requestedModelName:t.requested_model_name,fallbackCount:t.fallback_count,inputTokens:t.input_tokens,outputTokens:t.output_tokens,cacheReadTokens:t.cache_read_tokens,cacheCreationTokens:t.cache_creation_tokens,cacheCreation5mTokens:t.cache_creation_5m_tokens,cacheCreation1hTokens:t.cache_creation_1h_tokens,costUsd:t.cost_usd,costSource:t.cost_source,durationMs:t.duration_ms,ttftMs:t.ttft_ms,finishReason:t.finish_reason,reasoningTokens:t.reasoning_tokens};continue}t.type===`tool_call`&&e.toolCalls.push({id:t.id,stepIndex:t.step_index,callIndex:t.tool_call_index??e.toolCalls.length,toolCallId:t.tool_call_id??``,toolName:t.tool_name??``,durationMs:t.tool_duration_ms??0,error:t.error})}return[...t.values()].map(e=>({...e,toolCalls:e.toolCalls.toSorted((e,t)=>e.callIndex-t.callIndex)})).toSorted((e,t)=>e.stepIndex-t.stepIndex)}function Gn(e){return e.type===`function_call`||e.type===`function_call_output`?`bg-caution-400/10`:e.role===`assistant`?`bg-sage-50`:`bg-sand-50`}function Kn(e){return e.type===`function_call`?`fn: ${e.name??`unknown`}`:e.type===`function_call_output`?`fn result`:e.role??e.type}function qn(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>typeof e==`object`&&e&&`text`in e?e.text:JSON.stringify(e)).join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t,l as n}from"./vendor-tanstack-DJRQAbrY.js";import{i as r,r as i}from"./vendor-react-DH4kUfK2.js";import{i as a,r as o}from"./services.generated-Da1Eq5_R.js";import{c as s,l as c,o as l,t as u}from"./index-D208L33c.js";import{n as d,t as f}from"./cost-CpjVoAqp.js";function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(null,arguments)}function m(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var h=e(r()),g=i(),_={},v=(0,h.createContext)(_),y=(e,t)=>p({},e,t),b=()=>(0,h.useContext)(v),x=(0,h.createContext)(()=>{});x.displayName=`JVR.DispatchShowTools`;function S(){return(0,h.useReducer)(y,_)}function C(){return(0,h.useContext)(x)}var w=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(v.Provider,{value:t,children:(0,g.jsx)(x.Provider,{value:n,children:r})})};w.displayName=`JVR.ShowTools`;var T={},E=(0,h.createContext)(T),D=(e,t)=>p({},e,t),O=()=>(0,h.useContext)(E),ee=(0,h.createContext)(()=>{});ee.displayName=`JVR.DispatchExpands`;function te(){return(0,h.useReducer)(D,T)}function ne(){return(0,h.useContext)(ee)}var re=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(E.Provider,{value:t,children:(0,g.jsx)(ee.Provider,{value:n,children:r})})};re.displayName=`JVR.Expands`;var ie={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},ae=(0,h.createContext)(ie),oe=(e,t)=>p({},e,t),k=()=>(0,h.useContext)(ae),A=(0,h.createContext)(()=>{});A.displayName=`JVR.DispatchTypes`;function se(){return(0,h.useReducer)(oe,ie)}function ce(){return(0,h.useContext)(A)}function le(e){var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(ae.Provider,{value:t,children:(0,g.jsx)(A.Provider,{value:n,children:r})})}le.displayName=`JVR.Types`;var ue=[`style`];function de(e){var{style:t}=e,n=m(e,ue);return(0,g.jsx)(`svg`,p({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:p({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,g.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}de.displayName=`JVR.TriangleArrow`;var fe={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,g.jsx)(de,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},pe=(0,h.createContext)(fe),me=(e,t)=>p({},e,t),j=()=>(0,h.useContext)(pe),M=(0,h.createContext)(()=>{});M.displayName=`JVR.DispatchSymbols`;function he(){return(0,h.useReducer)(me,fe)}function ge(){return(0,h.useContext)(M)}var _e=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(pe.Provider,{value:t,children:(0,g.jsx)(M.Provider,{value:n,children:r})})};_e.displayName=`JVR.Symbols`;var ve={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},ye=(0,h.createContext)(ve),be=(e,t)=>p({},e,t),N=()=>(0,h.useContext)(ye),P=(0,h.createContext)(()=>{});P.displayName=`JVR.DispatchSection`;function xe(){return(0,h.useReducer)(be,ve)}function Se(){return(0,h.useContext)(P)}var Ce=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,g.jsx)(ye.Provider,{value:t,children:(0,g.jsx)(P.Provider,{value:n,children:r})})};Ce.displayName=`JVR.Section`;var we={objectSortKeys:!1,indentWidth:15},F=(0,h.createContext)(we);F.displayName=`JVR.Context`;var Te=(0,h.createContext)(()=>{});Te.displayName=`JVR.DispatchContext`;function Ee(e,t){return p({},e,t)}var I=()=>(0,h.useContext)(F),De=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,h.useReducer)(Ee,Object.assign({},we,n)),[o,s]=S(),[c,l]=te(),[u,d]=se(),[f,m]=he(),[_,v]=xe();return(0,h.useEffect)(()=>a(p({},n)),[n]),(0,g.jsx)(F.Provider,{value:i,children:(0,g.jsx)(Te.Provider,{value:a,children:(0,g.jsx)(w,{initial:o,dispatch:s,children:(0,g.jsx)(re,{initial:c,dispatch:l,children:(0,g.jsx)(le,{initial:p({},u,r),dispatch:d,children:(0,g.jsx)(_e,{initial:f,dispatch:m,children:(0,g.jsx)(Ce,{initial:_,dispatch:v,children:t})})})})})})})};De.displayName=`JVR.Provider`;function Oe(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var ke=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],Ae=[`as`,`render`],je=[`as`,`render`],Me=[`as`,`render`],Ne=[`as`,`style`,`render`],Pe=[`as`,`render`],Fe=[`as`,`render`],Ie=[`as`,`render`],Le=[`as`,`render`],Re=e=>{var{Quote:t={}}=j(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=m(e,ke);if(n)return null;var{as:c,render:l}=t,u=m(t,Ae),d=c||`span`,f=p({},s,u);return typeof f.children==`string`&&(f.children=f.children.trim()||void 0),l&&typeof l==`function`&&l(f,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,g.jsx)(d,p({},f))};Re.displayName=`JVR.Quote`;var L=e=>{var{ValueQuote:t={}}=j(),n=p({},(Oe(e),e)),{as:r,render:i}=t,a=m(t,je),o=r||`span`,s=p({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,g.jsx)(o,p({},s))};L.displayName=`JVR.ValueQuote`;var ze=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=j(),{as:o,render:s}=a,c=m(a,Me),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,g.jsx)(l,p({},c))};ze.displayName=`JVR.Colon`;var Be=e=>{var{Arrow:t={}}=j(),n=O(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:f}=t,h=m(t,Ne),_=u||`span`,v=f&&typeof f==`function`,y=p({},h,{"data-expanded":l,style:p({},d,i)});return v&&f(y,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,g.jsx)(_,p({},h,{style:p({},d,i)}))};Be.displayName=`JVR.Arrow`;var Ve=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=j(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=m(o,Pe),f=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,g.jsx)(f,p({},d))}var{as:h,render:_}=s,v=m(s,Fe),y=h||`span`;return _&&typeof _==`function`&&_(v,c)||(0,g.jsx)(y,p({},v))};Ve.displayName=`JVR.BracketsOpen`;var He=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=j();if(t){var{as:u,render:d}=c,f=m(c,Ie),h=u||`span`;return d&&typeof d==`function`&&d(f,s)||(0,g.jsx)(h,p({},f))}var{as:_,render:v}=l,y=m(l,Le),b=_||`span`;return v&&typeof v==`function`&&v(y,s)||(0,g.jsx)(b,p({},y))};He.displayName=`JVR.BracketsClose`;var Ue=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=O(),{collapsed:c,shouldExpandNodeInitially:l}=I(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),f=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!f)return null}else if(s[r]===void 0&&f)return null;var m=Object.keys(n).length;if(d||m===0)return null;var h={paddingLeft:4},_={keyName:t,value:n,keys:o,parentValue:i},v=Array.isArray(n),y=n instanceof Set;return(0,g.jsx)(`div`,{style:h,children:(0,g.jsx)(He,p({isBrackets:v||y},_,{isVisiable:!0}))})};Ue.displayName=`JVR.NestedClose`;var We=[`as`,`render`],Ge=[`as`,`render`],Ke=[`as`,`render`],qe=[`as`,`render`],Je=[`as`,`render`],Ye=[`as`,`render`],Xe=[`as`,`render`],Ze=[`as`,`render`],Qe=[`as`,`render`],$e=[`as`,`render`],et=[`as`,`render`],tt=[`as`,`render`],nt=[`as`,`render`],R=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},rt=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=k();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=m(r,We);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,g.jsx)(a||`span`,p({},s))};rt.displayName=`JVR.SetComp`;var it=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=k();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=m(r,Ge);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,g.jsx)(a||`span`,p({},s))};it.displayName=`JVR.MapComp`;var z={opacity:.75,paddingRight:4},at=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=k(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=I(),{as:c,render:l}=i,u=m(i,Ke),d=t,[f,_]=(0,h.useState)(o&&d.length>o);(0,h.useEffect)(()=>_(o&&d.length>o),[o]);var v=c||`span`,y=p({},z,i.style||{});o>0&&(u.style=p({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{_(!f)}));var b=f?``+d.slice(0,o)+s:d,x=l&&typeof l==`function`,S=x&&l(p({},u,{style:y}),{type:`type`,value:t,keyName:n,keys:r}),C=f?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,w=x&&l(p({},u,{children:b,className:C}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(S||(0,g.jsx)(v,p({},u,{style:y}))),w||(0,g.jsxs)(h.Fragment,{children:[(0,g.jsx)(L,{}),(0,g.jsx)(v,p({},u,{className:C,children:b})),(0,g.jsx)(L,{})]})]})};at.displayName=`JVR.TypeString`;var ot=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,qe),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ot.displayName=`JVR.TypeTrue`;var st=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Je),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};st.displayName=`JVR.TypeFalse`;var ct=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Ye),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ct.displayName=`JVR.TypeFloat`;var lt=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Xe),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};lt.displayName=`JVR.TypeInt`;var ut=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Ze),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:R(t?.toString())}))]})};ut.displayName=`JVR.TypeFloat`;var dt=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,Qe),l=o||`span`,u=p({},z,i.style),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_||(0,g.jsxs)(`a`,p({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,g.jsx)(L,{}),t?.href,(0,g.jsx)(L,{})]}))]})};dt.displayName=`JVR.TypeUrl`;var ft=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,$e),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=t instanceof Date?t.toLocaleString():t,v=d&&s(p({},c,{children:_,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),v||(0,g.jsx)(l,p({},c,{className:`w-rjv-value`,children:_}))]})};ft.displayName=`JVR.TypeDate`;var pt=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,et),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_]})};pt.displayName=`JVR.TypeUndefined`;var mt=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,tt),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_]})};mt.displayName=`JVR.TypeNull`;var ht=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=m(i,nt),l=o||`span`,u=p({},z,i.style||{}),d=s&&typeof s==`function`,f=d&&s(p({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(p({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,g.jsxs)(h.Fragment,{children:[a&&(f||(0,g.jsx)(l,p({},c,{style:u}))),_]})};ht.displayName=`JVR.TypeNan`;var gt=e=>Number(e)===e&&e%1!=0||isNaN(e),_t=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,g.jsx)(dt,p({},i,{children:t})):typeof t==`string`?(0,g.jsx)(at,p({},i,{children:t})):t===!0?(0,g.jsx)(ot,p({},i,{children:t})):t===!1?(0,g.jsx)(st,p({},i,{children:t})):t===null?(0,g.jsx)(mt,p({},i,{children:t})):t===void 0?(0,g.jsx)(pt,p({},i,{children:t})):t instanceof Date?(0,g.jsx)(ft,p({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,g.jsx)(ht,p({},i,{children:t})):typeof t==`number`&>(t)?(0,g.jsx)(ct,p({},i,{children:t})):typeof t==`bigint`?(0,g.jsx)(ut,p({},i,{children:t})):typeof t==`number`?(0,g.jsx)(lt,p({},i,{children:t})):null};_t.displayName=`JVR.Value`;function B(e,t,n){var r=ge(),i=p({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:p({},e.style,t.style),children:t.children||e.children});(0,h.useEffect)(()=>r({[n]:i}),[t])}function V(e,t,n){var r=ce(),i=p({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:p({},e.style,t.style),children:t.children||e.children});(0,h.useEffect)(()=>r({[n]:i}),[t])}function H(e,t,n){var r=Se(),i=p({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:p({},e.style,t.style),children:t.children||e.children});(0,h.useEffect)(()=>r({[n]:i}),[t])}var vt=[`as`,`render`],yt=e=>{var{KeyName:t={}}=N();return H(t,e,`KeyName`),null};yt.displayName=`JVR.KeyName`;var bt=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=N(),{as:c,render:l}=s,u=m(s,vt);u.style=p({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(p({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,g.jsx)(d,p({},u,{children:t}))};bt.displayName=`JVR.KeyNameComp`;var xt=[`children`,`value`,`parentValue`,`keyName`,`keys`],St=[`as`,`render`,`children`],Ct=e=>{var{Row:t={}}=N();return H(t,e,`Row`),null};Ct.displayName=`JVR.Row`;var wt=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=m(e,xt),{Row:s={}}=N(),{as:c,render:l}=s,u=m(s,St),d=c||`div`;return l&&typeof l==`function`&&l(p({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,g.jsx)(d,p({},o,u,{children:t}))};wt.displayName=`JVR.RowComp`;function Tt(e){var t=(0,h.useRef)();return(0,h.useEffect)(()=>{t.current=e}),t.current}function Et(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=Tt(t),a=(0,h.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,h.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var Dt=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Ot=[`as`,`render`],U=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=m(e,Dt),{onCopied:c,enableClipboard:l,beforeCopy:u}=I(),d=b()[i],[f,_]=(0,h.useState)(!1),{Copied:v={}}=N(),y=v?.beforeCopy;if(l===!1||!d)return null;var x={style:{display:`inline-flex`},fill:f?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?R(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?R(t):t,2);var l=o||y||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),_(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{_(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:S}=v,C=m(v,Ot),w=p({},C,s,x,{style:p({},C.style,s.style,x.style)});return S&&typeof S==`function`&&S(p({},w,{"data-copied":f}),{value:n,keyName:t,keys:a,parentValue:r})||(f?(0,g.jsx)(`svg`,p({viewBox:`0 0 32 36`},w,{children:(0,g.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,g.jsx)(`svg`,p({viewBox:`0 0 32 36`},w,{children:(0,g.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};U.displayName=`JVR.Copied`;function kt(){var e=(0,h.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var At=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=O(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=I(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var h=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(h=c===!0?h.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):h.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,g.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:h.map((e,t)=>{var[r,o]=e;return(0,g.jsx)(jt,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};At.displayName=`JVR.KeyValues`;var W=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=I(),o=typeof t==`number`,s=(0,h.useRef)(null);Et({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,g.jsxs)(h.Fragment,{children:[(0,g.jsxs)(`span`,{ref:s,children:[(0,g.jsx)(Re,p({isNumber:o,"data-placement":`left`},c)),(0,g.jsx)(bt,p({},c,{children:t})),(0,g.jsx)(Re,p({isNumber:o,"data-placement":`right`},c))]}),(0,g.jsx)(ze,p({},c))]})};W.displayName=`JVR.KayName`;var jt=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=C(),s=kt(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,f=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!f||c||l||u?(0,g.jsx)(G,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,g.jsxs)(wt,p({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,g.jsx)(W,{keyName:t,value:n,keys:a,parentValue:r}),(0,g.jsx)(_t,{keyName:t,value:n,keys:a}),(0,g.jsx)(U,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};jt.displayName=`JVR.KeyValuesItem`;var Mt=[`value`,`keyName`],Nt=[`as`,`render`],Pt=e=>{var{CountInfoExtra:t={}}=N();return H(t,e,`CountInfoExtra`),null};Pt.displayName=`JVR.CountInfoExtra`;var Ft=e=>{var{value:t={},keyName:n}=e,r=m(e,Mt),{CountInfoExtra:i={}}=N(),{as:a,render:o}=i,s=m(i,Nt);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=p({},s,r);return l&&o(u,{value:t,keyName:n})||(0,g.jsx)(c,p({},u))};Ft.displayName=`JVR.CountInfoExtraComps`;var It=[`value`,`keyName`],Lt=[`as`,`render`],Rt=e=>{var{CountInfo:t={}}=N();return H(t,e,`CountInfo`),null};Rt.displayName=`JVR.CountInfo`;var zt=e=>{var{value:t={},keyName:n}=e,r=m(e,It),{displayObjectSize:i}=I(),{CountInfo:a={}}=N();if(!i)return null;var{as:o,render:s}=a,c=m(a,Lt),l=o||`span`;c.style=p({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=p({},c,r);return s&&typeof s==`function`&&s(p({},d,{"data-length":u}),{value:t,keyName:n})||(0,g.jsx)(l,p({},d))};zt.displayName=`JVR.CountInfoComp`;var Bt=[`as`,`render`],Vt=e=>{var{Ellipsis:t={}}=N();return H(t,e,`Ellipsis`),null};Vt.displayName=`JVR.Ellipsis`;var Ht=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=N(),{as:a,render:o}=i,s=m(i,Bt),c=a||`span`;return o&&typeof o==`function`&&o(p({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,g.jsx)(c,p({},s)))};Ht.displayName=`JVR.EllipsisComp`;var Ut=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=O(),l=ne(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:f}=I(),m=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,h=c[n]??(f?!1:m),_=f&&f(!h,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&f&&(h=!_);var v=()=>{var e={expand:!h,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},y={display:`inline-flex`,alignItems:`center`},b={transform:`rotate(`+(h?`-90`:`0`)+`deg)`,transition:`all 0.3s`},x=Object.keys(a).length,S=typeof a==`object`,C=Array.isArray(a),w=a instanceof Set,T=x!==0&&(C||w||S),E={style:y};T&&(E.onClick=v);var D={keyName:t,value:a,keys:r,parentValue:o};return(0,g.jsxs)(`span`,p({},E,{children:[T&&(0,g.jsx)(Be,p({style:b,expandKey:n},D)),(t||typeof t==`number`)&&(0,g.jsx)(W,p({},D)),(0,g.jsx)(rt,{value:i,keyName:t}),(0,g.jsx)(it,{value:i,keyName:t}),(0,g.jsx)(Ve,p({isBrackets:C||w},D)),(0,g.jsx)(Ht,{keyName:t,value:a,isExpanded:h}),(0,g.jsx)(He,p({isVisiable:h||!T,isBrackets:C||w},D)),(0,g.jsx)(zt,{value:a,keyName:t}),(0,g.jsx)(Ft,{value:a,keyName:t}),(0,g.jsx)(U,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};Ut.displayName=`JVR.NestedOpen`;var Wt=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],G=(0,h.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=m(e,Wt),u=C(),d=kt();return(0,g.jsxs)(`div`,p({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,g.jsx)(Ut,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,g.jsx)(At,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,g.jsx)(Ue,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});G.displayName=`JVR.Container`;var Gt=e=>{var{BraceLeft:t={}}=j();return B(t,e,`BraceLeft`),null};Gt.displayName=`JVR.BraceLeft`;var Kt=e=>{var{BraceRight:t={}}=j();return B(t,e,`BraceRight`),null};Kt.displayName=`JVR.BraceRight`;var qt=e=>{var{BracketsLeft:t={}}=j();return B(t,e,`BracketsLeft`),null};qt.displayName=`JVR.BracketsLeft`;var Jt=e=>{var{BracketsRight:t={}}=j();return B(t,e,`BracketsRight`),null};Jt.displayName=`JVR.BracketsRight`;var Yt=e=>{var{Arrow:t={}}=j();return B(t,e,`Arrow`),null};Yt.displayName=`JVR.Arrow`;var Xt=e=>{var{Colon:t={}}=j();return B(t,e,`Colon`),null};Xt.displayName=`JVR.Colon`;var Zt=e=>{var{Quote:t={}}=j();return B(t,e,`Quote`),null};Zt.displayName=`JVR.Quote`;var Qt=e=>{var{ValueQuote:t={}}=j();return B(t,e,`ValueQuote`),null};Qt.displayName=`JVR.ValueQuote`;var $t=e=>{var{Bigint:t={}}=k();return V(t,e,`Bigint`),null};$t.displayName=`JVR.Bigint`;var en=e=>{var{Date:t={}}=k();return V(t,e,`Date`),null};en.displayName=`JVR.Date`;var tn=e=>{var{False:t={}}=k();return V(t,e,`False`),null};tn.displayName=`JVR.False`;var nn=e=>{var{Float:t={}}=k();return V(t,e,`Float`),null};nn.displayName=`JVR.Float`;var rn=e=>{var{Int:t={}}=k();return V(t,e,`Int`),null};rn.displayName=`JVR.Int`;var an=e=>{var{Map:t={}}=k();return V(t,e,`Map`),null};an.displayName=`JVR.Map`;var on=e=>{var{Nan:t={}}=k();return V(t,e,`Nan`),null};on.displayName=`JVR.Nan`;var sn=e=>{var{Null:t={}}=k();return V(t,e,`Null`),null};sn.displayName=`JVR.Null`;var cn=e=>{var{Set:t={}}=k();return V(t,e,`Set`),null};cn.displayName=`JVR.Set`;var ln=e=>{var{Str:t={}}=k();return V(t,e,`Str`),null};ln.displayName=`JVR.StringText`;var un=e=>{var{True:t={}}=k();return V(t,e,`True`),null};un.displayName=`JVR.True`;var dn=e=>{var{Undefined:t={}}=k();return V(t,e,`Undefined`),null};dn.displayName=`JVR.Undefined`;var fn=e=>{var{Url:t={}}=k();return V(t,e,`Url`),null};fn.displayName=`JVR.Url`;var pn=e=>{var{Copied:t={}}=N();return H(t,e,`Copied`),null};pn.displayName=`JVR.Copied`;var mn=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],K=(0,h.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:f=!0,enableClipboard:h=!0,displayDataTypes:_=!0,objectSortKeys:v=!1,onExpand:y,onCopied:b,beforeCopy:x}=e,S=m(e,mn),C=p({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),w=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,g.jsxs)(De,{initialState:{value:i,objectSortKeys:v,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:h,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:f,onCopied:b,onExpand:y,beforeCopy:x},initialTypes:{displayDataTypes:_},children:[(0,g.jsx)(G,p({value:i},S,{ref:t,className:w,style:C})),a]})});K.Bigint=$t,K.Date=en,K.False=tn,K.Float=nn,K.Int=rn,K.Map=an,K.Nan=on,K.Null=sn,K.Set=cn,K.String=ln,K.True=un,K.Undefined=dn,K.Url=fn,K.ValueQuote=Qt,K.Arrow=Yt,K.Colon=Xt,K.Quote=Zt,K.Ellipsis=Vt,K.BraceLeft=Gt,K.BraceRight=Kt,K.BracketsLeft=qt,K.BracketsRight=Jt,K.Copied=pn,K.CountInfo=Rt,K.CountInfoExtra=Pt,K.KeyName=yt,K.Row=Ct,K.displayName=`JVR.JsonView`;var hn={"--w-rjv-font-family":`monospace`,"--w-rjv-color":`#002b36`,"--w-rjv-key-string":`#002b36`,"--w-rjv-background-color":`#ffffff`,"--w-rjv-line-color":`#ebebeb`,"--w-rjv-arrow-color":`var(--w-rjv-color)`,"--w-rjv-edit-color":`var(--w-rjv-color)`,"--w-rjv-info-color":`#0000004d`,"--w-rjv-update-color":`#ebcb8b`,"--w-rjv-copied-color":`#002b36`,"--w-rjv-copied-success-color":`#28a745`,"--w-rjv-curlybraces-color":`#236a7c`,"--w-rjv-colon-color":`#002b36`,"--w-rjv-brackets-color":`#236a7c`,"--w-rjv-quotes-color":`var(--w-rjv-key-string)`,"--w-rjv-quotes-string-color":`var(--w-rjv-type-string-color)`,"--w-rjv-type-string-color":`#cb4b16`,"--w-rjv-type-int-color":`#268bd2`,"--w-rjv-type-float-color":`#859900`,"--w-rjv-type-bigint-color":`#268bd2`,"--w-rjv-type-boolean-color":`#2aa198`,"--w-rjv-type-date-color":`#586e75`,"--w-rjv-type-url-color":`#0969da`,"--w-rjv-type-null-color":`#d33682`,"--w-rjv-type-nan-color":`#859900`,"--w-rjv-type-undefined-color":`#586e75`},gn=e=>(0,g.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,g.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m12 19l-7-7l7-7m7 7H5`})}),_n=e=>(0,g.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,g.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20 6L9 17l-5-5`})}),q=e=>(0,g.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,g.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m6 9l6 6l6-6`})}),vn=e=>(0,g.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,g.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,g.jsx)(`rect`,{width:14,height:14,x:8,y:8,rx:2,ry:2}),(0,g.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})});function yn(){let{id:e}=u.useSearch();return(0,g.jsx)(sr,{id:e})}function J(e){return e.toLocaleString()}var bn=new Set;function xn(e){try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}}function Sn(e){if(!e)return{};try{return JSON.parse(e)}catch{return e}}function Y({text:e,dark:t}){let[n,r]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(!1),1500);return()=>clearTimeout(e)},[n]),(0,g.jsx)(`button`,{type:`button`,className:`absolute top-2 right-2 p-1 rounded transition-colors ${t?`text-sand-500 hover:text-sand-300`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>{navigator.clipboard.writeText(e),r(!0)},children:n?(0,g.jsx)(_n,{className:`size-3.5 text-sage-500`}):(0,g.jsx)(vn,{className:`size-3.5`})})}var Cn=/<img\s+[^>]*src=["'](data:image\/[^"']+;base64,[^"']+)["'][^>]*(?:alt=["']([^"']*)["'][^>]*)?\/?>/gi;function wn(e){let t=[],n=0;for(let r of e.matchAll(Cn)){let i=r.index??0;i>n&&t.push({type:`text`,text:e.slice(n,i)}),t.push({type:`image`,src:r[1],alt:r[2]??`generated image`}),n=i+r[0].length}return n<e.length&&t.push({type:`text`,text:e.slice(n)}),t.filter(e=>e.type===`image`||e.text.trim().length>0)}function Tn({text:e,markdown:t}){let[n,r]=(0,h.useState)(null),i=wn(e);return i.some(e=>e.type===`image`)?(0,g.jsxs)(`div`,{className:`space-y-3`,children:[i.map((e,n)=>e.type===`text`?t?(0,g.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,g.jsx)(c,{remarkPlugins:[s],children:e.text})},`text-${n}`):(0,g.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e.text},`text-${n}`):(0,g.jsx)(`button`,{type:`button`,className:`block max-w-full rounded-md border border-sand-200 overflow-hidden bg-white hover:border-sienna-300 transition-colors`,onClick:()=>r(e.src),title:`Open image`,children:(0,g.jsx)(`img`,{src:e.src,alt:e.alt,className:`max-h-[520px] max-w-full object-contain`,loading:`lazy`})},`image-${n}`)),n&&(0,g.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-black/70 p-4 flex items-center justify-center`,onClick:()=>r(null),children:[(0,g.jsx)(`button`,{type:`button`,className:`absolute top-4 right-4 p-2 rounded-full bg-white/90 text-sand-700 hover:bg-white`,onClick:()=>r(null),title:`Close image`,children:(0,g.jsx)(l,{className:`size-5`})}),(0,g.jsx)(`img`,{src:n,alt:`generated preview`,className:`max-h-full max-w-full object-contain rounded-md bg-white`,onClick:e=>e.stopPropagation()})]})]}):t?(0,g.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,g.jsx)(c,{remarkPlugins:[s],children:e})}):(0,g.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e})}function X({text:e,markdown:t}){let n=xn(e),[r,i]=(0,h.useState)(`pretty`),a=n.ok&&n.value!==null&&(Array.isArray(n.value)||typeof n.value==`object`);return!n.ok||!a?t?(0,g.jsx)(Tn,{text:e,markdown:!0}):(0,g.jsx)(Tn,{text:n.ok?JSON.stringify(n.value,null,2):e}):(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`flex gap-1 mb-2`,children:[(0,g.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`plain`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`plain`),children:`Plain`}),(0,g.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`pretty`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`pretty`),children:`Pretty`})]}),r===`pretty`?(0,g.jsx)(K,{value:n.value,style:hn,displayDataTypes:!1,enableClipboard:!0,collapsed:!1}):(0,g.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:JSON.stringify(n.value,null,2)})]})}function Z({title:e,defaultOpen:t=!0,headerMetadata:n,onOpenChange:r,children:i}){let[a,o]=(0,h.useState)(t);return(0,g.jsxs)(`details`,{open:a,className:`group panel overflow-hidden`,onToggle:e=>{let t=e.currentTarget.open;o(t),r?.(t)},children:[(0,g.jsxs)(`summary`,{className:`panel-header flex min-w-0 items-center gap-1.5 whitespace-nowrap cursor-pointer select-none list-none px-4 py-2.5`,children:[(0,g.jsx)(q,{className:`size-3.5 shrink-0 text-sand-400 transition-transform group-open:rotate-0 -rotate-90`}),(0,g.jsx)(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wider text-sand-500 font-medium`,children:e}),n&&(0,g.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden whitespace-nowrap text-[11px] normal-case text-sand-400`,children:n})]}),(0,g.jsx)(`div`,{className:`p-4`,children:i})]})}function Q({label:e,value:t}){return(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,g.jsx)(`dd`,{className:`text-[15px] font-semibold text-sand-800 tabular-nums mt-0.5 truncate`,children:t})]})}var En={running:`bg-blue-100 text-blue-600`,succeeded:`bg-sage-100 text-sage-600`,error:`bg-red-100 text-red-600`,aborted:`bg-caution-400/15 text-caution-500`};function Dn({message:e}){return(0,g.jsxs)(`div`,{className:`panel overflow-hidden border border-red-200 bg-red-50/60`,children:[(0,g.jsx)(`div`,{className:`px-4 py-2.5 border-b border-red-100 flex items-center gap-1.5`,children:(0,g.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-red-600 font-medium`,children:`Error`})}),(0,g.jsx)(`div`,{className:`p-4`,children:(0,g.jsx)(`pre`,{className:`text-[12px] text-red-700 whitespace-pre-wrap break-words font-mono leading-relaxed max-h-80 overflow-auto`,children:e})})]})}function On({data:e}){let t=e.status===`running`,n=!t&&e.requested_model_name!==null&&e.model_name!==null&&e.requested_model_name!==e.model_name,r=!t&&e.requested_model_name!==null&&e.model_name===null;return(0,g.jsxs)(`div`,{className:`panel overflow-hidden px-4 py-3 flex flex-wrap items-center gap-x-2 gap-y-1.5 sm:px-5`,children:[(0,g.jsx)(`span`,{className:`text-[15px] font-semibold text-sand-900 break-all`,children:t?`실행 중`:n?`${e.requested_model_name} → ${e.model_name}`:e.model_name??e.requested_model_name??`Unknown model`}),r&&(0,g.jsx)(`span`,{className:`text-[10px] text-sand-400`,children:`요청`}),!t&&(e.fallback_count??0)>0&&(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:[`fallback ×`,e.fallback_count]}),!t&&e.status!==`succeeded`&&(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium uppercase ${En[e.status]??`bg-sand-100 text-sand-500`}`,children:e.status}),e.response_json_ok===!1&&(0,g.jsx)(`span`,{title:`structured 요청의 응답이 JSON 파싱에 실패했습니다`,className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:`broken json`}),e.effort&&(0,g.jsxs)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded-md bg-sand-100 text-sand-500 font-mono`,children:[`effort=`,e.effort]}),e.project_name&&(0,g.jsxs)(`span`,{className:`text-[12px] text-sand-400`,children:[`· project=`,e.project_name]}),(0,g.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400`,children:e.token_name})]})}function kn({data:e,toolCallCount:t}){let n=Nn(e);return(0,g.jsxs)(`div`,{className:`panel overflow-hidden px-5 py-3 space-y-3`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,g.jsx)(Q,{label:`Duration`,value:`${(e.duration_ms/1e3).toFixed(1)}s`}),(0,g.jsx)(Q,{label:`TTFT`,value:jn(e.ttft_ms)}),(0,g.jsx)(Q,{label:`Tokens/sec`,value:Pn(e.output_tokens,e.duration_ms,e.ttft_ms,n)}),(0,g.jsx)(Q,{label:`Driver Cost`,value:e.cost_usd===null?`—`:d(e.cost_usd)}),(0,g.jsx)(Q,{label:`Cost Source`,value:e.cost_source??`legacy`}),(0,g.jsx)(Q,{label:`Image Cost`,value:e.image_cost_usd===null?`—`:d(e.image_cost_usd)}),(0,g.jsx)(Q,{label:`Tool Calls`,value:`${t}회`})]}),(0,g.jsxs)(`div`,{className:`border-t border-sand-100/60 pt-3 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,g.jsx)(Q,{label:`Input`,value:J(e.input_tokens)}),(0,g.jsx)(Q,{label:`Output`,value:J(e.output_tokens)}),(0,g.jsx)(Q,{label:`Cache Read`,value:J(e.cache_read_tokens)}),(0,g.jsx)(Q,{label:`Cache Write`,value:J(e.cache_creation_tokens)}),(0,g.jsx)(Q,{label:`Cache Write (5m)`,value:e.cache_creation_5m_tokens===null?`—`:J(e.cache_creation_5m_tokens)}),(0,g.jsx)(Q,{label:`Cache Write (1h)`,value:e.cache_creation_1h_tokens===null?`—`:J(e.cache_creation_1h_tokens)}),(0,g.jsx)(Q,{label:`Cache Hit`,value:f(e)})]})]})}function An(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function jn(e){return e==null||e<=0?`—`:An(e)}function Mn(e){let t=e.model_name?.trim().toLowerCase();if(t){let e=t.includes(`/`)?t.split(`/`).pop():t;if(e.startsWith(`claude-`))return`anthropic`;if(/^(gpt-|codex-|o\d)/.test(e))return`openai`}let n=e.token_name?.trim().toLowerCase();return n?.startsWith(`anthropic/`)?`anthropic`:n?.startsWith(`openai/`)?`openai`:null}function Nn(e){let t=Mn(e);return t!==null&&bn.has(t)}function Pn(e,t,n,r){if(!r||e==null||t==null||n==null||n<=0)return`—`;let i=t-n;return e<=0||i<=0?`—`:`${Math.round(e/(i/1e3)).toLocaleString()} tok/s`}function $({label:e,value:t}){return(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,g.jsx)(`div`,{className:`mt-0.5 text-[13px] font-semibold text-sand-800 tabular-nums truncate`,children:t})]})}function Fn(e){if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e.inputImages;return Array.isArray(t)?t:void 0}function In(e){return(Fn(e)??[]).filter(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.url==`string`&&t.url.length>0||typeof t.data==`string`&&t.data.length>0})}function Ln(e){if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=Fn(t);return n?{...t,inputImages:n.map(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=typeof t.url==`string`&&t.url.toLowerCase().startsWith(`data:`)?`[data-url ${t.url.length} chars]`:t.url;return{mediaType:t.mediaType,byteSize:t.byteSize,...n?{url:n}:{},...t.data?{data:`[base64 ${t.data.length} chars]`}:{}}})}:e}function Rn({images:e}){let t=e.map((e,t)=>{let n=e.url&&!e.url.startsWith(`[`)?e.url:void 0,r=e.data?`data:${e.mediaType??`image/png`};base64,${e.data}`:``,i=n??r;return i?{image:e,index:t,src:i}:null}).filter(e=>e!==null);return t.length===0?null:(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Input Images`}),(0,g.jsx)(`div`,{className:`mt-1 grid grid-cols-1 sm:grid-cols-2 gap-2`,children:t.map(({image:e,index:t,src:n})=>(0,g.jsxs)(`div`,{className:`rounded-md border border-sand-200 bg-white overflow-hidden`,children:[(0,g.jsx)(`img`,{src:n,alt:`reference ${t+1}`,className:`max-h-64 w-full object-contain bg-white`,loading:`lazy`}),(0,g.jsxs)(`div`,{className:`px-2 py-1 text-[10px] text-sand-500 font-mono border-t border-sand-100`,children:[e.mediaType??`image`,` ·`,` `,e.byteSize===void 0?`url`:`${e.byteSize.toLocaleString()} bytes`]})]},`${e.mediaType??`image`}-${t}`))})]})}function zn({stepId:e}){let{data:t}=a.useRequestLogStep(`I`,e??0,{enabled:e!==null});return(0,g.jsx)(Rn,{images:In(t?Sn(t.tool_args):null)})}function Bn({entry:e}){let t=!!e.error,[n,r]=(0,h.useState)(!1),{data:i}=a.useRequestLogStep(`A`,e.id,{enabled:n}),o=Ln(i?Sn(i.tool_args):null),s=i?Sn(i.tool_result):null,c=i?.error??e.error;return(0,g.jsxs)(`details`,{className:`group/tool`,onToggle:e=>r(e.currentTarget.open),children:[(0,g.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none list-none hover:bg-sand-50 transition-colors rounded-md`,children:[(0,g.jsx)(q,{className:`size-3 text-sand-400 transition-transform group-open/tool:rotate-0 -rotate-90 shrink-0`}),(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:[`call `,e.callIndex+1]}),(0,g.jsx)(`span`,{className:`text-[13px] font-medium text-sand-800 font-mono truncate`,children:e.toolName}),t&&(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:`error`}),(0,g.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:An(e.durationMs)})]}),n&&(0,g.jsxs)(`div`,{className:`mt-1 mx-1 mb-3 space-y-2`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Request`}),(0,g.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,g.jsx)(X,{text:i?JSON.stringify(o):`Loading...`})})]}),c&&(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-red-500 font-medium px-2`,children:`Error`}),(0,g.jsx)(`div`,{className:`mt-1 rounded-md bg-red-50 border border-red-100 p-3 overflow-auto`,children:(0,g.jsx)(X,{text:c})})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Response`}),(0,g.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,g.jsx)(X,{text:i?typeof s==`string`?s:JSON.stringify(s):`Loading...`,markdown:!0})})]})]})]})}function Vn({stepId:e}){let[t,n]=(0,h.useState)(!1),{data:r}=a.useRequestLogStep(`A`,e,{enabled:t}),i=r?.reasoning_text??null;return(0,g.jsxs)(`details`,{className:`group/reason mt-3`,onToggle:e=>n(e.currentTarget.open),children:[(0,g.jsxs)(`summary`,{className:`flex items-center gap-2 cursor-pointer select-none list-none`,children:[(0,g.jsx)(q,{className:`size-3 text-sand-400 transition-transform group-open/reason:rotate-0 -rotate-90 shrink-0`}),(0,g.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Reasoning`})]}),t&&(0,g.jsx)(`div`,{className:`mt-2 rounded-md bg-white/70 border border-sand-100 p-3 overflow-auto`,children:i?(0,g.jsx)(X,{text:i,markdown:!0}):r?(0,g.jsx)(`p`,{className:`text-sm text-sand-400`,children:`No reasoning text captured.`}):(0,g.jsx)(`p`,{className:`text-sm text-sand-400`,children:`Loading...`})})]})}function Hn({entry:e,tokensPerSecEnabled:t}){let n=e.generate,r=n!==null&&n.reasoningTokens!==null&&n.reasoningTokens!==void 0&&n.reasoningTokens>0,i=e.toolCalls.filter(e=>e.error).length;return(0,g.jsxs)(`details`,{open:!0,className:`group/step border-l border-sand-200 pl-3`,children:[(0,g.jsxs)(`summary`,{className:`flex items-center gap-2 py-2 cursor-pointer select-none list-none`,children:[(0,g.jsx)(q,{className:`size-3.5 text-sand-400 transition-transform group-open/step:rotate-0 -rotate-90 shrink-0`}),(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sienna-100 text-sienna-700 font-mono shrink-0`,children:[`step `,e.stepIndex+1]}),(0,g.jsx)(`span`,{className:`text-[13px] font-semibold text-sand-900`,children:`LLM call`}),n?.finishReason&&(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:n.finishReason}),n&&(n.fallbackCount??0)>0&&(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase shrink-0`,children:[n.requestedModelName,` → `,n.modelName]}),r&&(0,g.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 font-medium shrink-0`,children:`reasoning`}),i>0&&(0,g.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:[i,` error`]}),(0,g.jsxs)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:[e.toolCalls.length,` tools`]})]}),(0,g.jsxs)(`div`,{className:`ml-4 mb-4 space-y-3`,children:[n&&(0,g.jsxs)(`div`,{className:`rounded-md border border-sand-100 bg-sand-50/70 p-3`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-8 gap-x-4 gap-y-3`,children:[(0,g.jsx)($,{label:`Duration`,value:An(n.durationMs)}),(0,g.jsx)($,{label:`TTFT`,value:jn(n.ttftMs)}),(0,g.jsx)($,{label:`Tokens/sec`,value:Pn(n.outputTokens,n.durationMs,n.ttftMs,t)}),(0,g.jsx)($,{label:`Input`,value:J(n.inputTokens??0)}),(0,g.jsx)($,{label:`Output`,value:J(n.outputTokens??0)}),(0,g.jsx)($,{label:`Cache Read`,value:J(n.cacheReadTokens??0)}),(0,g.jsx)($,{label:`Cache Write`,value:J(n.cacheCreationTokens??0)}),(0,g.jsx)($,{label:`Cache 5m / 1h`,value:`${n.cacheCreation5mTokens===null?`—`:J(n.cacheCreation5mTokens)} / ${n.cacheCreation1hTokens===null?`—`:J(n.cacheCreation1hTokens)}`}),(0,g.jsx)($,{label:`Cost`,value:n.costUsd===null?`—`:d(n.costUsd)}),(0,g.jsx)($,{label:`Cost Source`,value:n.costSource??`legacy`}),(0,g.jsx)($,{label:`Reasoning`,value:n.reasoningTokens!==null&&n.reasoningTokens!==void 0?J(n.reasoningTokens):`—`})]}),r&&(0,g.jsx)(Vn,{stepId:n.id})]}),e.toolCalls.length>0&&(0,g.jsx)(`div`,{className:`space-y-0.5`,children:e.toolCalls.map(e=>(0,g.jsx)(Bn,{entry:e},`${e.stepIndex}-${e.callIndex}-${e.toolCallId}`))})]})]})}function Un({steps:e,tokensPerSecEnabled:t}){let n=e.reduce((e,t)=>e+t.toolCalls.length,0);return(0,g.jsx)(Z,{title:`Steps (${e.length} steps · ${n} tool calls)`,defaultOpen:!0,children:(0,g.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,g.jsx)(Hn,{entry:e,tokensPerSecEnabled:t},e.stepIndex))})})}function Wn(e){let t=new Map;function n(e){let n=t.get(e);if(n)return n;let r={stepIndex:e,generate:null,toolCalls:[]};return t.set(e,r),r}for(let t of e){let e=n(t.step_index);if(t.type===`generate`){e.generate={id:t.id,stepIndex:t.step_index,modelName:t.model_name,requestedModelName:t.requested_model_name,fallbackCount:t.fallback_count,inputTokens:t.input_tokens,outputTokens:t.output_tokens,cacheReadTokens:t.cache_read_tokens,cacheCreationTokens:t.cache_creation_tokens,cacheCreation5mTokens:t.cache_creation_5m_tokens,cacheCreation1hTokens:t.cache_creation_1h_tokens,costUsd:t.cost_usd,costSource:t.cost_source,durationMs:t.duration_ms,ttftMs:t.ttft_ms,finishReason:t.finish_reason,reasoningTokens:t.reasoning_tokens};continue}t.type===`tool_call`&&e.toolCalls.push({id:t.id,stepIndex:t.step_index,callIndex:t.tool_call_index??e.toolCalls.length,toolCallId:t.tool_call_id??``,toolName:t.tool_name??``,durationMs:t.tool_duration_ms??0,error:t.error})}return[...t.values()].map(e=>({...e,toolCalls:e.toolCalls.toSorted((e,t)=>e.callIndex-t.callIndex)})).toSorted((e,t)=>e.stepIndex-t.stepIndex)}function Gn(e){return e.type===`function_call`||e.type===`function_call_output`?`bg-caution-400/10`:e.role===`assistant`?`bg-sage-50`:`bg-sand-50`}function Kn(e){return e.type===`function_call`?`fn: ${e.name??`unknown`}`:e.type===`function_call_output`?`fn result`:e.role??e.type}function qn(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>typeof e==`object`&&e&&`text`in e?e.text:JSON.stringify(e)).join(`
|
|
2
2
|
`):JSON.stringify(e)}function Jn({className:e,children:t}){return(0,g.jsx)(`pre`,{className:`text-[12px] text-sand-700 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed max-h-40 overflow-auto ${e??``}`,children:t})}function Yn({history:e}){return(0,g.jsx)(Z,{title:`History`,defaultOpen:!1,children:(0,g.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>(0,g.jsxs)(`div`,{className:`rounded-md px-3 py-2 ${Gn(e)}`,children:[(0,g.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium mb-1`,children:Kn(e)}),e.content!==null&&e.content!==void 0&&(0,g.jsx)(Jn,{children:qn(e.content)}),e.arguments&&(0,g.jsx)(Jn,{children:e.arguments}),e.output&&(0,g.jsx)(Jn,{children:e.output})]},`hist-${t}`))})})}var Xn=60,Zn=30,Qn=18;function $n(e,t=Xn){let n=[];for(let r of e){if([...n,r.name].join(`, `).length>t)break;n.push(r.name)}return{names:n,omittedCount:e.length-n.length}}function er({tools:e}){let t=$n(e),n=$n(e,Zn),r=$n(e,Qn);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{className:`shrink-0`,children:`·`}),t.names.length>0&&(0,g.jsx)(`span`,{className:`hidden shrink-0 xl:inline`,children:t.names.join(`, `)}),t.omittedCount>0&&(0,g.jsxs)(`span`,{className:`hidden shrink-0 xl:inline`,children:[`+`,t.omittedCount]}),n.names.length>0&&(0,g.jsx)(`span`,{className:`hidden shrink-0 sm:inline xl:hidden`,children:n.names.join(`, `)}),n.omittedCount>0&&(0,g.jsxs)(`span`,{className:`hidden shrink-0 sm:inline xl:hidden`,children:[`+`,n.omittedCount]}),r.names.length>0&&(0,g.jsx)(`span`,{className:`shrink-0 sm:hidden`,children:r.names.join(`, `)}),r.omittedCount>0&&(0,g.jsxs)(`span`,{className:`shrink-0 sm:hidden`,children:[`+`,r.omittedCount]})]})}function tr({code:e,fullCode:t}){let n=(0,h.useMemo)(()=>ar(e),[e]);return(0,g.jsx)(`pre`,{"data-zod-parameter-shape":!0,className:`max-h-64 overflow-auto rounded-md bg-sand-900 px-3 py-2.5 font-mono text-[11px] leading-relaxed whitespace-pre text-sand-200 ${t?`cursor-help outline-none focus-visible:ring-2 focus-visible:ring-sienna-300`:``}`,tabIndex:t?0:void 0,title:t,children:t?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{"aria-hidden":`true`,children:n}),(0,g.jsx)(`span`,{className:`sr-only`,children:t})]}):n})}function nr({tool:e}){return(0,g.jsxs)(`div`,{className:`min-w-0 rounded-md border border-sand-100 bg-sand-50/70 p-3`,children:[(0,g.jsx)(`div`,{className:`break-all font-mono text-[13px] font-semibold text-sand-900`,children:e.name}),e.description&&(0,g.jsx)(`p`,{className:`mt-2 text-[12px] leading-relaxed text-sand-700`,children:e.description}),(0,g.jsxs)(`div`,{className:`mt-3`,children:[(0,g.jsxs)(`div`,{className:`mb-1.5 text-[10px] font-medium uppercase tracking-wider text-sand-400`,children:[`Parameters (`,e.parameterCount,`)`]}),(0,g.jsx)(tr,{code:e.inputZod,fullCode:e.fullInputZod})]})]})}function rr({id:e,tools:n}){let[r,i]=(0,h.useState)(!1),a=t({...o.toolsViewQueryOptions(e),enabled:r,staleTime:e=>e.state.data&&e.state.data.length>0?1/0:0,refetchOnWindowFocus:!1,refetchOnReconnect:!1}),s=a.data!==void 0&&a.data.length>0;return(0,g.jsx)(Z,{title:`Tools (${n.length})`,defaultOpen:!1,headerMetadata:(0,g.jsx)(er,{tools:n}),onOpenChange:i,children:a.isFetching&&!s?(0,g.jsx)(`p`,{className:`text-[12px] text-sand-400`,children:`Loading tool contracts…`}):a.isError||!s?(0,g.jsx)(`p`,{className:`text-[12px] text-sand-400`,children:`Tool contracts could not be loaded.`}):(0,g.jsx)(`div`,{className:`space-y-2`,children:a.data.map((e,t)=>(0,g.jsx)(nr,{tool:e},`${e.name}-${t}`))})})}var ir=/("(?:[^"\\]|\\.)*")|(\b\d+(?:\.\d+)?\b)|(\btype\b|\bz\b(?=\.))|(\b(?:string|number|boolean|null|unknown|Record)\b)|([{}[\]()<>|?:,.=])|([A-Za-z_$][\w$]*)|(\s+|.)/g;function ar(e){let t=[],n=!1;for(let r of e.matchAll(ir)){let[e,i,a,o,s,c,l]=r,u=`${r.index}-${e}`;i||a?t.push((0,g.jsx)(`span`,{className:`text-sage-400`,children:e},u)):o?(n=e===`type`,t.push((0,g.jsx)(`span`,{className:`text-sienna-400`,children:e},u))):s?t.push((0,g.jsx)(`span`,{className:`text-blue-300`,children:e},u)):c?t.push((0,g.jsx)(`span`,{className:`text-sand-500`,children:e},u)):l&&n?(n=!1,t.push((0,g.jsx)(`span`,{className:`font-semibold text-sand-50`,children:e},u))):t.push(e)}return t}function or({id:e}){let{data:t}=o.useResponseTypeTs(e),[n,r]=(0,h.useState)(`zod`),{zod:i=null,typescript:a=null}=t??{},s=n===`zod`?i??a:a??i,c=(0,h.useMemo)(()=>s===null?null:ar(s),[s]);return!t||s===null||c===null?null:(0,g.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,g.jsxs)(`div`,{className:`panel-header flex items-center px-4 py-2`,children:[(0,g.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-sand-500 font-medium`,children:`Response Type`}),(0,g.jsx)(`div`,{className:`ml-auto flex gap-1`,children:[{value:`zod`,label:`zod`,available:i!==null},{value:`ts`,label:`ts`,available:a!==null}].map(e=>(0,g.jsx)(`button`,{type:`button`,disabled:!e.available,className:`px-3 py-1 text-[12px] font-mono rounded-md transition-colors ${n===e.value?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600 disabled:text-sand-300 disabled:cursor-not-allowed`}`,onClick:()=>r(e.value),children:e.label},e.value))})]}),(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(Y,{text:s,dark:!0}),(0,g.jsx)(`pre`,{className:`bg-sand-900 px-4 py-3 text-[12px] text-sand-200 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed max-h-64 overflow-auto`,children:c})]})]})}function sr({id:e}){let{data:t,isLoading:r}=o.useRequestLog(`A`,e),{data:i,isLoading:s}=a.useRequestLogSteps(`T`,{request_log_id:e,num:0,page:1,orderBy:`id-asc`}),c=Wn(i?.rows??[]);if(r||s)return(0,g.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-4`,children:[(0,g.jsx)(`div`,{className:`h-4 w-32 bg-sand-200 rounded animate-pulse`}),(0,g.jsx)(`div`,{className:`h-40 panel animate-pulse`}),(0,g.jsx)(`div`,{className:`h-32 panel animate-pulse`})]});if(!t)return(0,g.jsxs)(`div`,{className:`max-w-6xl mx-auto`,children:[(0,g.jsxs)(n,{to:`/logs`,className:`flex items-center gap-1 text-[13px] text-sand-500 hover:text-sienna-500 mb-4`,children:[(0,g.jsx)(gn,{className:`size-3.5`}),`Back to Logs`]}),(0,g.jsx)(`p`,{className:`text-sand-400 text-sm`,children:`Request not found.`})]});let l=c.flatMap(e=>e.toolCalls),u=l.find(e=>e.toolName===`image_generation`)?.id??null,d=c.length>0,f=Nn(t),p=t.history??null,m=p!==null&&p.length>0,h=t.tools??null,_=h!==null&&h.length>0,v=t.is_structured?(0,g.jsx)(or,{id:e}):null,y=(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsx)(Z,{title:`System`,children:(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(Y,{text:t.system_prompt??`null`}),(0,g.jsx)(X,{text:t.system_prompt??`null`,markdown:!0})]})}),(0,g.jsx)(Z,{title:`User`,children:(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(Y,{text:t.user_prompt??`null`}),(0,g.jsx)(X,{text:t.user_prompt??`null`,markdown:!0})]}),(0,g.jsx)(zn,{stepId:u})]})})]});return(0,g.jsxs)(`div`,{className:`mx-auto space-y-4 ${d?`max-w-[120rem]`:`max-w-6xl`}`,children:[(0,g.jsxs)(n,{to:`/logs`,className:`inline-flex items-center gap-1 text-[13px] text-sand-500 hover:text-sienna-500 transition-colors`,children:[(0,g.jsx)(gn,{className:`size-3.5`}),`Back to Logs`]}),(0,g.jsx)(On,{data:t}),t.error_message&&(0,g.jsx)(Dn,{message:t.error_message}),m&&(0,g.jsx)(Yn,{history:p}),d?(0,g.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 items-stretch lg:items-start`,children:[(0,g.jsxs)(`div`,{className:`order-1 lg:order-2 flex-1 min-w-0 space-y-4`,children:[v,_&&(0,g.jsx)(rr,{id:e,tools:h}),(0,g.jsx)(Un,{steps:c,tokensPerSecEnabled:f})]}),(0,g.jsx)(`div`,{className:`order-2 lg:order-1 flex-1 min-w-0`,children:y})]}):(0,g.jsxs)(g.Fragment,{children:[v,_&&(0,g.jsx)(rr,{id:e,tools:h}),y]}),(0,g.jsx)(Z,{title:`Response`,children:(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(Y,{text:t.response}),(0,g.jsx)(X,{text:t.response,markdown:!0})]})}),(0,g.jsx)(kn,{data:t,toolCallCount:l.length}),(0,g.jsx)(`div`,{className:`pb-8`})]})}export{yn as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{n as i,o as a}from"./services.generated-Da1Eq5_R.js";import{i as o,u as s}from"./index-D59Q_9Z4.js";import{t as c}from"./use-update-token-mutation-CZ57EKA1.js";import{n as l,t as u}from"./use-oauth-login-flow-4OltfVAd.js";import{t as d}from"./plus-p4vtg6LN.js";var f=e(n(),1),p=r();function m(){let[e,t]=(0,f.useState)(!1),[n,r]=(0,f.useState)(``),i=u(),a=()=>{t(!1),r(``),i.reset()},c=async e=>{await i.submitCode(e)&&a()};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,className:`px-3.5 py-1.5 text-[12px] font-medium rounded-lg bg-sienna-500 text-white hover:bg-sienna-600 disabled:opacity-50 transition-all duration-150 active:scale-[0.97] flex items-center gap-1.5 shadow-sm`,onClick:()=>t(!0),children:[(0,p.jsx)(d,{className:`size-3.5`}),`Add Token`]}),e&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:a,onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-md mx-4`,children:[(0,p.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/50`,children:(0,p.jsx)(`h2`,{className:`text-base font-medium text-sand-900`,children:`Add Token`})}),(0,p.jsxs)(`div`,{className:`px-5 py-4 space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name *`}),(0,p.jsx)(o,{value:n,onChange:e=>r(e.target.value),placeholder:`e.g. your-token-name`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]}),i.codeEntryProvider?(0,p.jsx)(l,{provider:i.codeEntryProvider,isPending:i.completeMutation.isPending,isError:i.completeMutation.isError,onSubmit:e=>void c(e),onRestart:i.reset}):(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md bg-sand-900 text-white hover:bg-sand-800 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||i.loadingProvider!==null,onClick:()=>void i.start(`openai`,n),children:i.loadingProvider===`openai`?(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,p.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{className:`size-4`}),`Login with OpenAI`]})}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`}),(0,p.jsx)(`span`,{className:`text-[10px] text-sand-400 uppercase`,children:`or`}),(0,p.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`})]}),(0,p.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md border border-sand-300 text-sand-700 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||i.loadingProvider!==null,onClick:()=>void i.start(`anthropic`,n),children:i.loadingProvider===`anthropic`?(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,p.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-sand-400 border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{className:`size-4`}),`Login with Claude`]})})]})]}),(0,p.jsx)(`div`,{className:`px-5 py-3 border-t border-sand-100/50 flex items-center justify-end gap-2`,children:(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:a,children:`Cancel`})})]})]})]})}var h=e=>(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,p.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4`})}),g=e=>(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,p.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})});function _(e){let t=e.credentials;return`expiresAt`in t&&typeof t.expiresAt==`number`?t.expiresAt:`accessTokenExpiresAt`in t&&typeof t.accessTokenExpiresAt==`number`?t.accessTokenExpiresAt:null}function v(e){if(!e)return{text:``,color:``};let t=e-Date.now();if(t<=0)return{text:`expired`,color:`text-red-500`};let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),i=n>0?`${n}h ${r}m`:`${r}m`;return t<36e5?{text:i,color:`text-amber-500`}:{text:i,color:`text-sand-400`}}function y(e){let t=e.credentials.accessToken;return t.length<=12?t:`${t.slice(0,8)}...${t.slice(-4)}`}function b({data:e,isLoading:n}){let[r,a]=(0,f.useState)(null),[s,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(``),m=t(),b=i.useRemoveTokenMutation(),x=c(),S=i.useToggleTokenMutation(),C=()=>Promise.all([m.invalidateQueries({queryKey:[`Token`]}),m.invalidateQueries({queryKey:[`Qgrid`]})]),w=async e=>{await S.mutateAsync({id:e.id}),await C()},T=async()=>{r&&(await b.mutateAsync({id:r.id}),await C(),a(null))},E=e=>{l(e),d(e.name??``)},D=async()=>{s&&(await x.mutateAsync({id:s.id,name:u.trim()}),await C(),l(null))};if(n)return(0,p.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:3}).map((e,t)=>(0,p.jsx)(`div`,{className:`h-12 bg-sand-100 rounded-md animate-pulse`},`skeleton-${t}`))});let O=e??[];return O.length===0?(0,p.jsxs)(`div`,{className:`text-sand-400 text-center py-16 text-sm`,children:[`No tokens registered. Click `,(0,p.jsx)(`strong`,{className:`text-sand-600`,children:`Add Token`}),` to get started.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`panel overflow-hidden`,children:(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`w-full min-w-[640px] text-[13px]`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{className:`panel-header`,children:[(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Provider`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Name`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Token`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Status`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Expires`}),(0,p.jsx)(`th`,{className:`w-20 px-3 py-2.5`})]})}),(0,p.jsx)(`tbody`,{className:`divide-y divide-sand-100/80`,children:O.map(e=>{let t=v(_(e));return(0,p.jsxs)(`tr`,{className:`transition-colors duration-150 hover:bg-sand-100/60 ${e.active?``:`opacity-50`}`,children:[(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`span`,{className:`text-xs font-medium text-sand-500 uppercase`,children:e.provider})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:e.name?(0,p.jsx)(`span`,{className:`text-sm text-sand-700`,children:e.name}):(0,p.jsx)(`span`,{className:`text-[11px] text-sand-400`,children:`—`})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:y(e)})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`button`,{type:`button`,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors duration-200 ${e.active?`bg-sage-400`:`bg-sand-300`}`,onClick:()=>w(e),disabled:S.isPending,children:(0,p.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${e.active?`translate-x-4.5`:`translate-x-0.5`}`})})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:t.text&&(0,p.jsx)(`span`,{className:`text-xs ${t.color}`,children:t.text})}),(0,p.jsx)(`td`,{className:`px-3 py-3`,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sienna-500 transition-colors duration-150`,onClick:()=>E(e),children:(0,p.jsx)(h,{className:`size-4`})}),(0,p.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-red-500 transition-colors duration-150`,onClick:()=>a(e),children:(0,p.jsx)(g,{className:`size-4`})})]})})]},e.id)})})]})})}),s&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>l(null),onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,p.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,p.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Edit Token`})}),(0,p.jsx)(`div`,{className:`px-5 py-4 space-y-3`,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name`}),(0,p.jsx)(o,{value:u,onChange:e=>d(e.target.value),placeholder:`e.g. prod, dev, team-a`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]})}),(0,p.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>l(null),children:`Cancel`}),(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,disabled:x.isPending,onClick:D,children:x.isPending?`Saving...`:`Save`})]})]})]}),r&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>a(null),onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,p.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,p.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Remove Token`}),(0,p.jsxs)(`p`,{className:`text-sm text-sand-700 mt-2`,children:[`Are you sure you want to remove`,` `,(0,p.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:y(r)}),r.name&&(0,p.jsxs)(`span`,{className:`text-sand-500`,children:[` (`,r.name,`)`]}),`?`]})]}),(0,p.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>a(null),children:`Cancel`}),(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 transition-colors duration-150`,disabled:b.isPending,onClick:T,children:b.isPending?`Removing...`:`Remove`})]})]})]})]})}function x(){let{data:e,isLoading:t}=a.useTokens(`A`);return(0,p.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-4`,children:[(0,p.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{data:e?.rows,isLoading:t})]})}export{x as component};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{n as i,o as a}from"./services.generated-Da1Eq5_R.js";import{i as o,u as s}from"./index-D208L33c.js";import{t as c}from"./use-update-token-mutation-CZ57EKA1.js";import{n as l,t as u}from"./use-oauth-login-flow-CRAqRZXX.js";import{t as d}from"./plus-p4vtg6LN.js";var f=e(n(),1),p=r();function m(){let[e,t]=(0,f.useState)(!1),[n,r]=(0,f.useState)(``),i=u(),a=()=>{t(!1),r(``),i.reset()},c=async e=>{await i.submitCode(e)&&a()};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,className:`px-3.5 py-1.5 text-[12px] font-medium rounded-lg bg-sienna-500 text-white hover:bg-sienna-600 disabled:opacity-50 transition-all duration-150 active:scale-[0.97] flex items-center gap-1.5 shadow-sm`,onClick:()=>t(!0),children:[(0,p.jsx)(d,{className:`size-3.5`}),`Add Token`]}),e&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:a,onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-md mx-4`,children:[(0,p.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/50`,children:(0,p.jsx)(`h2`,{className:`text-base font-medium text-sand-900`,children:`Add Token`})}),(0,p.jsxs)(`div`,{className:`px-5 py-4 space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name *`}),(0,p.jsx)(o,{value:n,onChange:e=>r(e.target.value),placeholder:`e.g. your-token-name`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]}),i.codeEntryProvider?(0,p.jsx)(l,{provider:i.codeEntryProvider,isPending:i.completeMutation.isPending,isError:i.completeMutation.isError,onSubmit:e=>void c(e),onRestart:i.reset}):(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md bg-sand-900 text-white hover:bg-sand-800 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||i.loadingProvider!==null,onClick:()=>void i.start(`openai`,n),children:i.loadingProvider===`openai`?(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,p.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{className:`size-4`}),`Login with OpenAI`]})}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`}),(0,p.jsx)(`span`,{className:`text-[10px] text-sand-400 uppercase`,children:`or`}),(0,p.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`})]}),(0,p.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md border border-sand-300 text-sand-700 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||i.loadingProvider!==null,onClick:()=>void i.start(`anthropic`,n),children:i.loadingProvider===`anthropic`?(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,p.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-sand-400 border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{className:`size-4`}),`Login with Claude`]})})]})]}),(0,p.jsx)(`div`,{className:`px-5 py-3 border-t border-sand-100/50 flex items-center justify-end gap-2`,children:(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:a,children:`Cancel`})})]})]})]})}var h=e=>(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,p.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4`})}),g=e=>(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,p.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})});function _(e){let t=e.credentials;return`expiresAt`in t&&typeof t.expiresAt==`number`?t.expiresAt:`accessTokenExpiresAt`in t&&typeof t.accessTokenExpiresAt==`number`?t.accessTokenExpiresAt:null}function v(e){if(!e)return{text:``,color:``};let t=e-Date.now();if(t<=0)return{text:`expired`,color:`text-red-500`};let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),i=n>0?`${n}h ${r}m`:`${r}m`;return t<36e5?{text:i,color:`text-amber-500`}:{text:i,color:`text-sand-400`}}function y(e){let t=e.credentials.accessToken;return t.length<=12?t:`${t.slice(0,8)}...${t.slice(-4)}`}function b({data:e,isLoading:n}){let[r,a]=(0,f.useState)(null),[s,l]=(0,f.useState)(null),[u,d]=(0,f.useState)(``),m=t(),b=i.useRemoveTokenMutation(),x=c(),S=i.useToggleTokenMutation(),C=()=>Promise.all([m.invalidateQueries({queryKey:[`Token`]}),m.invalidateQueries({queryKey:[`Qgrid`]})]),w=async e=>{await S.mutateAsync({id:e.id}),await C()},T=async()=>{r&&(await b.mutateAsync({id:r.id}),await C(),a(null))},E=e=>{l(e),d(e.name??``)},D=async()=>{s&&(await x.mutateAsync({id:s.id,name:u.trim()}),await C(),l(null))};if(n)return(0,p.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:3}).map((e,t)=>(0,p.jsx)(`div`,{className:`h-12 bg-sand-100 rounded-md animate-pulse`},`skeleton-${t}`))});let O=e??[];return O.length===0?(0,p.jsxs)(`div`,{className:`text-sand-400 text-center py-16 text-sm`,children:[`No tokens registered. Click `,(0,p.jsx)(`strong`,{className:`text-sand-600`,children:`Add Token`}),` to get started.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`panel overflow-hidden`,children:(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`w-full min-w-[640px] text-[13px]`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{className:`panel-header`,children:[(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Provider`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Name`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Token`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Status`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Expires`}),(0,p.jsx)(`th`,{className:`w-20 px-3 py-2.5`})]})}),(0,p.jsx)(`tbody`,{className:`divide-y divide-sand-100/80`,children:O.map(e=>{let t=v(_(e));return(0,p.jsxs)(`tr`,{className:`transition-colors duration-150 hover:bg-sand-100/60 ${e.active?``:`opacity-50`}`,children:[(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`span`,{className:`text-xs font-medium text-sand-500 uppercase`,children:e.provider})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:e.name?(0,p.jsx)(`span`,{className:`text-sm text-sand-700`,children:e.name}):(0,p.jsx)(`span`,{className:`text-[11px] text-sand-400`,children:`—`})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:y(e)})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`button`,{type:`button`,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors duration-200 ${e.active?`bg-sage-400`:`bg-sand-300`}`,onClick:()=>w(e),disabled:S.isPending,children:(0,p.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${e.active?`translate-x-4.5`:`translate-x-0.5`}`})})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:t.text&&(0,p.jsx)(`span`,{className:`text-xs ${t.color}`,children:t.text})}),(0,p.jsx)(`td`,{className:`px-3 py-3`,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sienna-500 transition-colors duration-150`,onClick:()=>E(e),children:(0,p.jsx)(h,{className:`size-4`})}),(0,p.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-red-500 transition-colors duration-150`,onClick:()=>a(e),children:(0,p.jsx)(g,{className:`size-4`})})]})})]},e.id)})})]})})}),s&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>l(null),onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,p.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,p.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Edit Token`})}),(0,p.jsx)(`div`,{className:`px-5 py-4 space-y-3`,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name`}),(0,p.jsx)(o,{value:u,onChange:e=>d(e.target.value),placeholder:`e.g. prod, dev, team-a`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]})}),(0,p.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>l(null),children:`Cancel`}),(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,disabled:x.isPending,onClick:D,children:x.isPending?`Saving...`:`Save`})]})]})]}),r&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>a(null),onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,p.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,p.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Remove Token`}),(0,p.jsxs)(`p`,{className:`text-sm text-sand-700 mt-2`,children:[`Are you sure you want to remove`,` `,(0,p.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:y(r)}),r.name&&(0,p.jsxs)(`span`,{className:`text-sand-500`,children:[` (`,r.name,`)`]}),`?`]})]}),(0,p.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>a(null),children:`Cancel`}),(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 transition-colors duration-150`,disabled:b.isPending,onClick:T,children:b.isPending?`Removing...`:`Remove`})]})]})]})]})}function x(){let{data:e,isLoading:t}=a.useTokens(`A`);return(0,p.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-4`,children:[(0,p.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{data:e?.rows,isLoading:t})]})}export{x as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{n as i}from"./services.generated-Da1Eq5_R.js";import{i as a}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{n as i}from"./services.generated-Da1Eq5_R.js";import{i as a}from"./index-D208L33c.js";var o=e(n(),1),s=r();function c({provider:e,isPending:t,isError:n,onSubmit:r,onRestart:i}){let[c,l]=(0,o.useState)(``),u=e===`openai`;return(0,s.jsxs)(`div`,{className:`space-y-2`,children:[(0,s.jsx)(`p`,{className:`text-[12px] text-sand-600 leading-relaxed`,children:u?`새 탭에서 OpenAI 로그인을 완료한 뒤 연결 실패 화면이 나타나면, 주소창의 전체 URL을 아래에 붙여넣으세요.`:`새 탭에서 Claude 로그인을 완료하면 코드가 표시됩니다. 코드 전체를 아래에 붙여넣으세요.`}),(0,s.jsx)(a,{value:c,onChange:e=>l(e.target.value),placeholder:u?`http://localhost:1455/auth/callback?code=...&state=...`:`code#state`,className:`w-full border border-sand-200 rounded-md px-3 py-2 text-sm font-mono text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`}),n&&(0,s.jsx)(`p`,{className:`text-[11px] text-red-500`,children:`인증 결과 확인에 실패했습니다 — 전체 값을 다시 붙여넣거나 로그인을 다시 시작하세요.`}),(0,s.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md bg-sand-900 text-white hover:bg-sand-800 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!c.trim()||t,onClick:()=>r(c),children:t?(0,s.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,s.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin`}),`Verifying...`]}):`Complete login`}),(0,s.jsx)(`button`,{type:`button`,className:`w-full py-1.5 text-[12px] text-sand-500 hover:text-sand-700 transition-colors duration-150`,onClick:()=>{l(``),i()},children:`처음부터 다시 시작`})]})}var l=3e3,u=3e5;function d(e){let t=0;for(let n of e.getQueryCache().findAll({queryKey:[`Token`]})){let e=n.state.data?.rows;Array.isArray(e)&&(t=Math.max(t,e.length))}return t}function f(){let[e,n]=(0,o.useState)(null),[r,a]=(0,o.useState)(null),s=t(),c=i.useOauthStartMutation(),f=i.useOauthStartOpenAIMutation(),p=i.useOauthCompleteMutation(),m=(0,o.useRef)({}),h=()=>{m.current.interval!==void 0&&clearInterval(m.current.interval),m.current.timeout!==void 0&&clearTimeout(m.current.timeout),m.current={}};(0,o.useEffect)(()=>h,[]);let g=()=>Promise.all([s.invalidateQueries({queryKey:[`Token`]}),s.invalidateQueries({queryKey:[`Qgrid`]})]);return{loadingProvider:e,codeEntryProvider:r,start:async(e,t)=>{let r=t.trim();if(!r)return;let i=window.open(`about:blank`,`_blank`);n(e);try{if(e===`openai`){let{authUrl:t,mode:o}=await f.mutateAsync({name:r});if(i?i.location.href=t:window.open(t,`_blank`),o===`code`){a(e),n(null);return}let c=d(s);h(),m.current.interval=window.setInterval(()=>{g().then(()=>{d(s)>c&&(h(),n(null))})},l),m.current.timeout=window.setTimeout(()=>{h(),n(null)},u);return}let{authUrl:t,mode:o}=await c.mutateAsync({name:r});o===`code`?(i?i.location.href=t:window.open(t,`_blank`),a(e),n(null)):(i?.close(),window.location.href=t)}catch(e){i?.close(),console.error(`OAuth start failed:`,e),n(null)}},submitCode:async e=>{let t=e.trim();if(!t)return!1;try{await p.mutateAsync({pastedCode:t})}catch(e){return console.error(`OAuth complete failed:`,e),!1}return await g(),!0},reset:()=>{h(),n(null),a(null),p.reset()},completeMutation:p}}export{c as n,f as t};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/sonamu.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Qgrid</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-D208L33c.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dw2cE7zH.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-ca-nBW7U.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-DH4kUfK2.js">
|
|
@@ -46625,7 +46625,7 @@ function ChatWidget() {
|
|
|
46625
46625
|
}
|
|
46626
46626
|
//#endregion
|
|
46627
46627
|
//#region src/components/Sidebar.tsx
|
|
46628
|
-
var qgridVersion = "2.
|
|
46628
|
+
var qgridVersion = "2.8.0";
|
|
46629
46629
|
function Sidebar({ className }) {
|
|
46630
46630
|
const pathname = useRouterState({ select: (s) => s.location.pathname });
|
|
46631
46631
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", {
|
package/package.json
CHANGED
package/skills/qgrid/SKILL.md
CHANGED
|
@@ -5,6 +5,11 @@ description: Work on the qgrid repository, an LLM subscription-token proxy with
|
|
|
5
5
|
|
|
6
6
|
# Qgrid
|
|
7
7
|
|
|
8
|
+
## Command Scope
|
|
9
|
+
|
|
10
|
+
Run the repository-specific `mise` commands in this skill only from the qgrid source
|
|
11
|
+
repository. In a downstream project, use that project's configured task and tool runner.
|
|
12
|
+
|
|
8
13
|
## Start Here
|
|
9
14
|
|
|
10
15
|
Use this skill for qgrid repository work. Treat qgrid as a runtime-contract-heavy system: model input travels through the active AI SDK provider, Sonamu API, provider dispatcher, provider-specific runtime, response mapping, request logging, and dashboard display.
|
|
@@ -45,7 +50,7 @@ Request logging is enabled by default. Use `providerOptions.qgrid.logger: false`
|
|
|
45
50
|
- Treat Fable 5 safety fallback as upstream Claude Code behavior, not qgrid routing: a classifier refusal can retry on Opus 4.8. Do not add a second qgrid retry. Preserve requested Fable versus actual serving Opus, fallback history, and provider-reported cost; a fresh Claude Code process means the fallback is not sticky across qgrid requests.
|
|
46
51
|
- Treat dashboard work as Sonamu API/model/generated-client/web work, not isolated frontend work.
|
|
47
52
|
- Prefer `getPuri()` for Sonamu model queries. Treat `getDB()` as a legacy escape hatch only when Puri cannot express the required query. Inside `@transactional` methods, all participating queries must use `getPuri()`; `getDB()` does not reuse Sonamu's ambient transaction connection.
|
|
48
|
-
- Never hand-author migration files for Sonamu-managed schema.
|
|
53
|
+
- Never hand-author migration files for Sonamu-managed schema. In the qgrid source repository, change the entity definition, inspect `sonamu migrate status`, and create migration files with `mise exec -- pnpm --dir packages/api sonamu migrate generate`. Inspect the generated files before applying them. If Sonamu cannot express a required schema change, stop and ask rather than silently replacing its workflow with a custom migration.
|
|
49
54
|
- Keep OpenAI Codex built-in tools, apps, plugins, skills, web search, shell, and environment instruction blocks disabled unless the user explicitly asks for agentic Codex behavior.
|
|
50
55
|
- Treat OpenAI image generation as an opt-in Codex `image_generation` tool path. Inspect current code before modifying it; it is not a direct Images API call and its image cost is an estimate.
|
|
51
56
|
|
|
@@ -53,7 +58,7 @@ Request logging is enabled by default. Use `providerOptions.qgrid.logger: false`
|
|
|
53
58
|
|
|
54
59
|
Choose verification by blast radius:
|
|
55
60
|
|
|
56
|
-
-
|
|
61
|
+
- In the qgrid source repository, run type/lint/format with `mise run check`.
|
|
57
62
|
- Package tests: use the relevant package test command or targeted Vitest files.
|
|
58
63
|
- Provider runtime changes: run targeted tests for `packages/api/src/utils/providers/**` and, when practical, the relevant smoke script in `scripts/` or `packages/api/scripts/`.
|
|
59
64
|
- AI SDK changes: run `packages/ai-sdk` tests and inspect generated request payload behavior.
|
|
@@ -57,6 +57,10 @@ Do not write `providerOptions: { ... } satisfies QgridProviderOptions`: the expo
|
|
|
57
57
|
|
|
58
58
|
`providerOptions.qgrid` supports:
|
|
59
59
|
|
|
60
|
+
- `tokenName`: strict active-token targeting for both providers. Include the provider prefix and
|
|
61
|
+
match it to the model (`anthropic/yds` with `anthropic/*`, for example). Missing, inactive, or
|
|
62
|
+
over-threshold targets fail without falling back to another token. An explicitly empty value is
|
|
63
|
+
rejected by the SDK before transport; omission keeps weighted round-robin routing.
|
|
60
64
|
- `logger`: request-log switch. Omitted or `true` is the default and enables qgrid logging; `false` guarantees that generation creates zero qgrid request-log rows.
|
|
61
65
|
- `sessionKey`: source for model-scoped opaque OpenAI prompt-cache affinity. Disabled for Anthropic models.
|
|
62
66
|
- `effort`
|
|
@@ -143,6 +147,7 @@ Payload responsibilities:
|
|
|
143
147
|
- Send `jsonSchema` whenever the response format top-level schema is `object`, including requests that also contain tools.
|
|
144
148
|
- Send `history` as JSON string when prior messages exist.
|
|
145
149
|
- Send `projectName` when configured.
|
|
150
|
+
- Send `tokenName` when configured so generate and stream use the same strict target.
|
|
146
151
|
- Send `logger: false` when the per-call option disables request logging; otherwise rely on the server default.
|
|
147
152
|
- Preserve and resend `runContext` for tool-call follow-ups.
|
|
148
153
|
- Let the server infer single-turn completion versus an open tool-call run. Logging-disabled tool calls still use the SDK's local pending-call correlation and continue without a request-log id.
|
|
@@ -44,7 +44,11 @@ Anthropic tokens live in an in-memory `Map<tokenId, PooledToken>`.
|
|
|
44
44
|
|
|
45
45
|
Quota threshold:
|
|
46
46
|
|
|
47
|
-
- `quota_threshold`
|
|
47
|
+
- `quota_threshold` checks `five_hour.utilization` for every model and also checks
|
|
48
|
+
`seven_day_overage_included.utilization` for Fable 5, using the higher utilization.
|
|
49
|
+
- A runtime quota-exhausted result invalidates every 60-second usage-cache key used before and
|
|
50
|
+
after a possible OAuth refresh, so the next untargeted request rechecks usage and can select
|
|
51
|
+
another token.
|
|
48
52
|
- Lookup failure is fail-open.
|
|
49
53
|
- If all eligible tokens exceed threshold, throw `QuotaThresholdExceededError`.
|
|
50
54
|
|
|
@@ -140,7 +140,9 @@ Key decisions:
|
|
|
140
140
|
- The token subscriber disables statement/idle timeouts for `LISTEN` and uses reconnect backoff.
|
|
141
141
|
- `quota_threshold` is a routing guardrail, not a load balancer. It prevents an individual token from crossing a configured utilization percentage; it does not equalize traffic.
|
|
142
142
|
- Threshold values are nullable integers from 1 to 100. `0` is not valid; `100` means exclude only at full utilization.
|
|
143
|
-
- Provider criteria differ by primary window: Anthropic uses `five_hour.utilization
|
|
143
|
+
- Provider criteria differ by primary window: Anthropic uses `five_hour.utilization` plus the
|
|
144
|
+
Fable-only `seven_day_overage_included.utilization` when applicable; OpenAI uses
|
|
145
|
+
`primary.usedPercent`.
|
|
144
146
|
- Threshold gates are by token id, not token name. Names are display/logging labels and can change.
|
|
145
147
|
- Lookup failure is fail-open with logs/metrics. Hard failure happens only when usage was read successfully and the token is over threshold.
|
|
146
148
|
- OpenAI applies the gate during token selection. An affinity-preferred token over threshold must fall back to another eligible token when possible.
|
|
@@ -35,15 +35,15 @@ When a repo doc establishes or changes durable rationale for a qgrid feature, re
|
|
|
35
35
|
|
|
36
36
|
`packages/cli/skills/qgrid` is the canonical qgrid skill. The CLI package ships this directory to consuming projects. The repository-local `.agents/skills/qgrid` directory is a checked mirror for agents working in this repository; do not edit the mirror as a separate source.
|
|
37
37
|
|
|
38
|
-
-
|
|
39
|
-
-
|
|
38
|
+
- In the qgrid source repository, run `mise run qgrid-docs:sync` after changing the canonical skill.
|
|
39
|
+
- In the qgrid source repository, run `mise run qgrid-docs:check` before finishing documentation or runtime-contract work.
|
|
40
40
|
- `docs/qgrid-doc-map.json` maps each durable topic to code, canonical skill references, and the matching Notion page.
|
|
41
41
|
- Code and tests remain the source of truth. Update the skill and Notion together when a code change alters a documented contract.
|
|
42
42
|
- Keep dated operational snapshots, internal server addresses, and other environment-specific facts in Notion. Keep reusable runtime contracts in the skill.
|
|
43
43
|
|
|
44
44
|
## Retract pre-release caveats after shipping
|
|
45
45
|
|
|
46
|
-
Documenting a contract before it ships is fine, but the caveat must be retracted once it does. Wording like "not deployed yet", "based on the working tree", "migration is still untracked", or "package version is still X" becomes a false statement the moment the release lands, and `
|
|
46
|
+
Documenting a contract before it ships is fine, but the caveat must be retracted once it does. Wording like "not deployed yet", "based on the working tree", "migration is still untracked", or "package version is still X" becomes a false statement the moment the release lands, and `mise run qgrid-docs:check` will not catch it — that task validates the skill mirror and `docs/qgrid-doc-map.json` paths only, never Notion body text.
|
|
47
47
|
|
|
48
48
|
- When you add a pre-release caveat, record the retraction in the release page at the same time. Do not rely on memory.
|
|
49
49
|
- After a release, search the wiki for `미배포`, `배포되지 않았`, `working tree`, `untracked`, `아직`, and the previous version number.
|
|
@@ -26,10 +26,12 @@ qgrid dashboard work is usually a Sonamu API/model/generated-client/web change,
|
|
|
26
26
|
## Migration workflow
|
|
27
27
|
|
|
28
28
|
Sonamu entity definitions are the source of truth for managed database schema.
|
|
29
|
+
These commands apply only inside the qgrid source repository. Downstream projects must use
|
|
30
|
+
their own configured task and tool runner.
|
|
29
31
|
|
|
30
32
|
1. Change the relevant `*.entity.json` files.
|
|
31
|
-
2. Run `pnpm --dir packages/api sonamu migrate status` and inspect `preparedCodes`.
|
|
32
|
-
3. Run `pnpm --dir packages/api sonamu migrate generate`.
|
|
33
|
+
2. Run `mise exec -- pnpm --dir packages/api sonamu migrate status` and inspect `preparedCodes`.
|
|
34
|
+
3. Run `mise exec -- pnpm --dir packages/api sonamu migrate generate`.
|
|
33
35
|
4. Inspect the generated, table-scoped migration files without rewriting them by hand.
|
|
34
36
|
5. Apply them through Sonamu's migration target flow or qgrid's startup migration runner.
|
|
35
37
|
6. Re-run migration status and require `pending: []` and `preparedCodes: []`.
|
|
@@ -113,7 +113,8 @@ Usage/quota:
|
|
|
113
113
|
|
|
114
114
|
- Usage API is `https://api.anthropic.com/api/oauth/usage`.
|
|
115
115
|
- qgrid caches Anthropic usage by access-token suffix for 60 seconds.
|
|
116
|
-
- Quota threshold uses `five_hour.utilization
|
|
116
|
+
- Quota threshold uses `five_hour.utilization`; Fable 5 additionally uses the model-specific
|
|
117
|
+
`seven_day_overage_included.utilization`, and either window can exclude the token.
|
|
117
118
|
- Usage lookup failure is fail-open for routing.
|
|
118
119
|
|
|
119
120
|
## OpenAI OAuth And Refresh Flow
|
|
@@ -234,7 +235,9 @@ When a refresh fails in a way that only re-login can fix, qgrid removes the toke
|
|
|
234
235
|
- A targeted request never falls back. Missing, inactive, or over-threshold targets fail rather than silently serving from another account — the whole point of addressing a token is that the answer comes from that account.
|
|
235
236
|
- Targeted selection does not consume weighted round-robin state. Without that guarantee, background targeting such as keepalive would skew the token distribution of ordinary traffic.
|
|
236
237
|
- Targeting is distinct from cache affinity. Affinity sets `preferredTokenId` as a preference and still falls back when the token is ineligible; explicit targeting adds `requirePreferredToken` so the same field becomes strict. The Anthropic path only ever receives explicit targeting — affinity coordinates are not forwarded there, so making it strict cannot break affinity behavior.
|
|
237
|
-
- Exposure boundary:
|
|
238
|
+
- Exposure boundary: raw qgrid callers and AI SDK consumers can pass `tokenName`; the AI SDK sends
|
|
239
|
+
it from `providerOptions.qgrid.tokenName` on both generate and stream. Callers that omit it keep
|
|
240
|
+
weighted round-robin routing, while an explicitly empty SDK value fails before transport.
|
|
238
241
|
|
|
239
242
|
## Token Window Keepalive
|
|
240
243
|
|
|
@@ -12,36 +12,39 @@ Use this reference to choose tests, smoke scripts, and first debugging targets f
|
|
|
12
12
|
|
|
13
13
|
## Package Scripts
|
|
14
14
|
|
|
15
|
+
The commands in this section apply only inside the qgrid source repository. In a downstream
|
|
16
|
+
project, use that project's configured task and tool runner.
|
|
17
|
+
|
|
15
18
|
Root:
|
|
16
19
|
|
|
17
|
-
- `
|
|
18
|
-
- `
|
|
19
|
-
- `
|
|
20
|
+
- `mise run check`: qgrid docs consistency, oxlint, and oxfmt check for the repo.
|
|
21
|
+
- `mise run build`: recursive package build.
|
|
22
|
+
- `mise run dev`: parallel package dev servers.
|
|
20
23
|
|
|
21
24
|
API package `qgrid-api`:
|
|
22
25
|
|
|
23
|
-
- `pnpm --filter qgrid-api test`: Vitest run.
|
|
24
|
-
- `pnpm --filter qgrid-api test:watch`: standalone watch mode.
|
|
25
|
-
- `pnpm --filter qgrid-api build`: Sonamu build.
|
|
26
|
-
- `pnpm --filter qgrid-api sonamu`: run Sonamu CLI.
|
|
26
|
+
- `mise exec -- pnpm --filter qgrid-api test`: Vitest run.
|
|
27
|
+
- `mise exec -- pnpm --filter qgrid-api test:watch`: standalone watch mode.
|
|
28
|
+
- `mise exec -- pnpm --filter qgrid-api build`: Sonamu build.
|
|
29
|
+
- `mise exec -- pnpm --filter qgrid-api sonamu`: run Sonamu CLI.
|
|
27
30
|
|
|
28
31
|
AI SDK package `@cartanova/qgrid-ai-sdk`:
|
|
29
32
|
|
|
30
|
-
- `pnpm --filter @cartanova/qgrid-ai-sdk test`.
|
|
31
|
-
- `pnpm --filter @cartanova/qgrid-ai-sdk build`.
|
|
32
|
-
- `pnpm --filter @cartanova/qgrid-ai-sdk e2e`.
|
|
33
|
-
- `pnpm --filter @cartanova/qgrid-ai-sdk e2e:tools-output`.
|
|
34
|
-
- `pnpm --filter @cartanova/qgrid-ai-sdk e2e:logger`.
|
|
33
|
+
- `mise exec -- pnpm --filter @cartanova/qgrid-ai-sdk test`.
|
|
34
|
+
- `mise exec -- pnpm --filter @cartanova/qgrid-ai-sdk build`.
|
|
35
|
+
- `mise exec -- pnpm --filter @cartanova/qgrid-ai-sdk e2e`.
|
|
36
|
+
- `mise exec -- pnpm --filter @cartanova/qgrid-ai-sdk e2e:tools-output`.
|
|
37
|
+
- `mise exec -- pnpm --filter @cartanova/qgrid-ai-sdk e2e:logger`.
|
|
35
38
|
|
|
36
39
|
CLI package `@cartanova/qgrid-cli`:
|
|
37
40
|
|
|
38
|
-
- `pnpm --filter @cartanova/qgrid-cli build`.
|
|
39
|
-
- `pnpm --filter @cartanova/qgrid-cli bundle` builds the API first and copies the server bundle.
|
|
41
|
+
- `mise exec -- pnpm --filter @cartanova/qgrid-cli build`.
|
|
42
|
+
- `mise exec -- pnpm --filter @cartanova/qgrid-cli bundle` builds the API first and copies the server bundle.
|
|
40
43
|
|
|
41
44
|
Web package `qgrid-web`:
|
|
42
45
|
|
|
43
|
-
- `pnpm --filter qgrid-web dev`.
|
|
44
|
-
- `pnpm --filter qgrid-web preview`.
|
|
46
|
+
- `mise exec -- pnpm --filter qgrid-web dev`.
|
|
47
|
+
- `mise exec -- pnpm --filter qgrid-web preview`.
|
|
45
48
|
|
|
46
49
|
The old v1 SDK package (`packages/sdk`) has been removed from the repository; all public-SDK verification goes through `packages/ai-sdk`.
|
|
47
50
|
|