@motiadev/plugin-logs 0.13.0-beta.162-632691 → 0.13.0-beta.162-125657

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/LICENSE CHANGED
@@ -1,21 +1,93 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Motia
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject
14
+ to the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
27
+ of the licensor in the software. Any use of the licensor's trademarks is subject
28
+ to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately. If your company makes
40
+ such a claim, your patent license ends immediately for work on behalf of your
41
+ company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from you
46
+ also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not licensed,
59
+ and your licenses will automatically terminate. If the licensor provides you
60
+ with a notice of your violation, and you cease all violation of this license no
61
+ later than 30 days after you receive that notice, your licenses will be
62
+ reinstated retroactively. However, if you violate these terms after such
63
+ reinstatement, any additional violation of these terms will cause your licenses
64
+ to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ *As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising
70
+ out of these terms or the use or nature of the software, under any kind of
71
+ legal claim.*
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is the
76
+ software the licensor makes available under these terms, including any portion
77
+ of it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over,
83
+ are under the control of, or are under common control with that organization.
84
+ **control** means ownership of substantially all the assets of an entity, or the
85
+ power to direct its management and policies by vote, contract, or otherwise.
86
+ Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under
89
+ these terms.
90
+
91
+ **use** means anything you do with the software requiring one of your licenses.
92
+
93
+ **trademark** means trademarks, service marks, and similar rights.
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ import { Log } from '../types/log';
3
+ type Props = {
4
+ log?: Log;
5
+ onClose: () => void;
6
+ };
7
+ export declare const LogDetail: React.FC<Props>;
8
+ export {};
9
+ //# sourceMappingURL=log-detail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-detail.d.ts","sourceRoot":"","sources":["../../src/components/log-detail.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,gCAAgC,CAAA;AACvC,OAAO,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAGvC,KAAK,KAAK,GAAG;IACX,GAAG,CAAC,EAAE,GAAG,CAAA;IACT,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAID,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAiDrC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export declare const LogLevelBadge: React.FC<{
3
+ level: string;
4
+ className?: string;
5
+ }>;
6
+ //# sourceMappingURL=log-level-badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-level-badge.d.ts","sourceRoot":"","sources":["../../src/components/log-level-badge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAMzE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const LogsPage: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=logs-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs-page.d.ts","sourceRoot":"","sources":["../../src/components/logs-page.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,QAAQ,+CAuFpB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const LogsTabLabel: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ //# sourceMappingURL=logs-tab-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs-tab-label.d.ts","sourceRoot":"","sources":["../../src/components/logs-tab-label.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,oFAKvB,CAAA"}
package/dist/index.cjs ADDED
@@ -0,0 +1,57 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const st=require("@motiadev/stream-client-browser"),p=require("react"),Y=require("@motiadev/ui");function ot(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const T=ot(p),Ee=e=>{let t;const n=new Set,r=(d,m)=>{const v=typeof d=="function"?d(t):d;if(!Object.is(v,t)){const w=t;t=m??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(E=>E(t,w))}},l=()=>t,c={setState:r,getState:l,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d))},u=t=e(r,l,c);return c},it=e=>e?Ee(e):Ee,lt=e=>e;function ct(e,t=lt){const n=p.useSyncExternalStore(e.subscribe,p.useCallback(()=>t(e.getState()),[e,t]),p.useCallback(()=>t(e.getInitialState()),[e,t]));return p.useDebugValue(n),n}const ut=e=>{const t=it(e),n=r=>ct(t,r);return Object.assign(n,t),n},ft=e=>ut,Q=ft()(e=>({logs:[],selectedLogId:void 0,addLog:t=>e(n=>n.logs.find(r=>r.id===t.id)?n:{logs:[t,...n.logs]}),setLogs:t=>e({logs:[...t].reverse()}),resetLogs:()=>{e({logs:[]})},selectLogId:t=>e({selectedLogId:t})})),dt="__motia.logs",pt="default",gt="log",mt=()=>{const t=new st.Stream(window.location.origin.replace("http","ws")).subscribeGroup(dt,pt),n=Q.getState();t.addChangeListener(r=>{r&&n.setLogs(r)}),t.onEvent(gt,n.addLog)};var te={exports:{}},G={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Ae;function vt(){if(Ae)return G;Ae=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,l,i){var o=null;if(i!==void 0&&(o=""+i),l.key!==void 0&&(o=""+l.key),"key"in l){i={};for(var c in l)c!=="key"&&(i[c]=l[c])}else i=l;return l=i.ref,{$$typeof:e,type:r,key:o,ref:l!==void 0?l:null,props:i}}return G.Fragment=t,G.jsx=n,G.jsxs=n,G}var X={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var ke;function ht(){return ke||(ke=1,process.env.NODE_ENV!=="production"&&function(){function e(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===B?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case S:return"Fragment";case A:return"Profiler";case N:return"StrictMode";case b:return"Suspense";case k:return"SuspenseList";case R:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case x:return"Portal";case $:return(s.displayName||"Context")+".Provider";case P:return(s._context.displayName||"Context")+".Consumer";case h:var g=s.render;return s=s.displayName,s||(s=g.displayName||g.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case C:return g=s.displayName||null,g!==null?g:e(s.type)||"Memo";case H:g=s._payload,s=s._init;try{return e(s(g))}catch{}}return null}function t(s){return""+s}function n(s){try{t(s);var g=!1}catch{g=!0}if(g){g=console;var y=g.error,f=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return y.call(g,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",f),t(s)}}function r(s){if(s===S)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===H)return"<...>";try{var g=e(s);return g?"<"+g+">":"<...>"}catch{return"<...>"}}function l(){var s=L.A;return s===null?null:s.getOwner()}function i(){return Error("react-stack-top-frame")}function o(s){if(D.call(s,"key")){var g=Object.getOwnPropertyDescriptor(s,"key").get;if(g&&g.isReactWarning)return!1}return s.key!==void 0}function c(s,g){function y(){O||(O=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",g))}y.isReactWarning=!0,Object.defineProperty(s,"key",{get:y,configurable:!0})}function u(){var s=e(this.type);return M[s]||(M[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function d(s,g,y,f,j,V,ae,se){return y=V.ref,s={$$typeof:E,type:s,key:g,props:V,_owner:j},(y!==void 0?y:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:u}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ae}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:se}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function m(s,g,y,f,j,V,ae,se){var I=g.children;if(I!==void 0)if(f)if(U(I)){for(f=0;f<I.length;f++)v(I[f]);Object.freeze&&Object.freeze(I)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(I);if(D.call(g,"key")){I=e(s);var q=Object.keys(g).filter(function(at){return at!=="key"});f=0<q.length?"{key: someKey, "+q.join(": ..., ")+": ...}":"{key: someKey}",F[I+f]||(q=0<q.length?"{"+q.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,f,I,q,I),F[I+f]=!0)}if(I=null,y!==void 0&&(n(y),I=""+y),o(g)&&(n(g.key),I=""+g.key),"key"in g){y={};for(var oe in g)oe!=="key"&&(y[oe]=g[oe])}else y=g;return I&&c(y,typeof s=="function"?s.displayName||s.name||"Unknown":s),d(s,I,V,j,l(),y,ae,se)}function v(s){typeof s=="object"&&s!==null&&s.$$typeof===E&&s._store&&(s._store.validated=1)}var w=p,E=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),$=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),B=Symbol.for("react.client.reference"),L=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,U=Array.isArray,Z=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(s){return s()}};var O,M={},_=w.react_stack_bottom_frame.bind(w,i)(),z=Z(r(i)),F={};X.Fragment=S,X.jsx=function(s,g,y,f,j){var V=1e4>L.recentlyCreatedOwnerStacks++;return m(s,g,y,!1,f,j,V?Error("react-stack-top-frame"):_,V?Z(r(s)):z)},X.jsxs=function(s,g,y,f,j){var V=1e4>L.recentlyCreatedOwnerStacks++;return m(s,g,y,!0,f,j,V?Error("react-stack-top-frame"):_,V?Z(r(s)):z)}}()),X}var _e;function bt(){return _e||(_e=1,process.env.NODE_ENV==="production"?te.exports=vt():te.exports=ht()),te.exports}var a=bt();/**
23
+ * @license lucide-react v0.545.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const jt=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Te=e=>{const t=yt(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ke=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),wt=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
28
+ * @license lucide-react v0.545.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */var xt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
33
+ * @license lucide-react v0.545.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const Ct=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:l="",children:i,iconNode:o,...c},u)=>p.createElement("svg",{ref:u,...xt,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ke("lucide",l),...!i&&!wt(c)&&{"aria-hidden":"true"},...c},[...o.map(([d,m])=>p.createElement(d,m)),...Array.isArray(i)?i:[i]]));/**
38
+ * @license lucide-react v0.545.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const he=(e,t)=>{const n=p.forwardRef(({className:r,...l},i)=>p.createElement(Ct,{ref:i,iconNode:t,className:Ke(`lucide-${jt(Te(e))}`,`lucide-${e}`,r),...l}));return n.displayName=Te(e),n};/**
43
+ * @license lucide-react v0.545.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const St=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Et=he("search",St);/**
48
+ * @license lucide-react v0.545.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */const At=[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],kt=he("trash",At);/**
53
+ * @license lucide-react v0.545.0 - ISC
54
+ *
55
+ * This source code is licensed under the ISC license.
56
+ * See the LICENSE file in the root directory of this source tree.
57
+ */const _t=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ge=he("x",_t),Xe=e=>{const t=new Date(Number(e));return`${t.toLocaleDateString("en-US",{year:void 0,month:"short",day:"2-digit"})}, ${t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h24"})}.${t.getMilliseconds().toString().padStart(3,"0")}`};function Tt(e,t,n,r){function l(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function c(m){try{d(r.next(m))}catch(v){o(v)}}function u(m){try{d(r.throw(m))}catch(v){o(v)}}function d(m){m.done?i(m.value):l(m.value).then(c,u)}d((r=r.apply(e,[])).next())})}var Ot=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||n.forEach(function(l){e.addRange(l)}),t&&t.focus()}},Nt=Ot,Oe={"text/plain":"Text","text/html":"Url",default:"Text"},Rt="Copy to clipboard: #{key}, Enter";function Lt(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function Dt(e,t){var n,r,l,i,o,c,u=!1;t||(t={}),n=t.debug||!1;try{l=Nt(),i=document.createRange(),o=document.getSelection(),c=document.createElement("span"),c.textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",function(m){if(m.stopPropagation(),t.format)if(m.preventDefault(),typeof m.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var v=Oe[t.format]||Oe.default;window.clipboardData.setData(v,e)}else m.clipboardData.clearData(),m.clipboardData.setData(t.format,e);t.onCopy&&(m.preventDefault(),t.onCopy(m.clipboardData))}),document.body.appendChild(c),i.selectNodeContents(c),o.addRange(i);var d=document.execCommand("copy");if(!d)throw new Error("copy command was unsuccessful");u=!0}catch(m){n&&console.error("unable to copy using execCommand: ",m),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(v){n&&console.error("unable to copy using clipboardData: ",v),n&&console.error("falling back to prompt"),r=Lt("message"in t?t.message:Rt),window.prompt(r,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(i):o.removeAllRanges()),c&&document.body.removeChild(c),l()}return u}var Pt=Dt;function W(e){return Object.prototype.toString.call(e)==="[object Object]"}function ee(e){return Array.isArray(e)?e.length:W(e)?Object.keys(e).length:0}function It(e,t){if(typeof e=="string")return e;try{return JSON.stringify(e,(n,r)=>{switch(typeof r){case"bigint":return String(r)+"n";case"number":case"boolean":case"object":case"string":return r;default:return String(r)}},t)}catch(n){return`${n.name}: ${n.message}`||"JSON.stringify failed"}}function $t(e){return Tt(this,void 0,void 0,function*(){try{yield navigator.clipboard.writeText(e)}catch{Pt(e)}})}function Ne(e,t,n,r,l,i){if(i&&i.collapsed!==void 0)return!!i.collapsed;if(typeof r=="boolean")return r;if(typeof r=="number"&&t>r)return!0;const o=ee(e);if(typeof r=="function"){const c=be(r,[{node:e,depth:t,indexOrName:n,size:o}]);if(typeof c=="boolean")return c}return!!(Array.isArray(e)&&o>l||W(e)&&o>l)}function Re(e,t,n,r,l,i){if(i&&i.collapsed!==void 0)return!!i.collapsed;if(typeof r=="boolean")return r;if(typeof r=="number"&&t>r)return!0;const o=Math.ceil(e.length/100);if(typeof r=="function"){const c=be(r,[{node:e,depth:t,indexOrName:n,size:o}]);if(typeof c=="boolean")return c}return!!(Array.isArray(e)&&o>l||W(e)&&o>l)}function K(e,t,n){return typeof e=="boolean"?e:!!(typeof e=="number"&&t>e||e==="collapsed"&&n||e==="expanded"&&!n)}function be(e,t){try{return e(...t)}catch(n){reportError(n)}}function Qe(e){if(e===!0||W(e)&&e.add===!0)return!0}function Le(e){if(e===!0||W(e)&&e.edit===!0)return!0}function je(e){if(e===!0||W(e)&&e.delete===!0)return!0}function Mt(e){return typeof e=="function"}function et(e){return!e||e.add===void 0||!!e.add}function De(e){return!e||e.edit===void 0||!!e.edit}function ye(e){return!e||e.delete===void 0||!!e.delete}function ne(e){return!e||e.enableClipboard===void 0||!!e.enableClipboard}function Ft(e){return!e||e.matchesURL===void 0||!!e.matchesURL}function Ht(e,t){return e==="string"?t.trim().replace(/^\"([\s\S]+?)\"$/,"$1"):t}var Pe;function ie(){return ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ie.apply(this,arguments)}var we=function(t){return T.createElement("svg",ie({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},t),Pe||(Pe=T.createElement("path",{fill:"currentColor",d:"M12.473 5.806a.666.666 0 0 0-.946 0L8.473 8.86a.667.667 0 0 1-.946 0L4.473 5.806a.667.667 0 1 0-.946.94l3.06 3.06a2 2 0 0 0 2.826 0l3.06-3.06a.667.667 0 0 0 0-.94Z"})))},Ie;function le(){return le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},le.apply(this,arguments)}var Ut=function(t){return T.createElement("svg",le({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),Ie||(Ie=T.createElement("path",{fill:"currentColor",d:"M17.542 2.5h-4.75a3.963 3.963 0 0 0-3.959 3.958v4.75a3.963 3.963 0 0 0 3.959 3.959h4.75a3.963 3.963 0 0 0 3.958-3.959v-4.75A3.963 3.963 0 0 0 17.542 2.5Zm2.375 8.708a2.378 2.378 0 0 1-2.375 2.375h-4.75a2.378 2.378 0 0 1-2.375-2.375v-4.75a2.378 2.378 0 0 1 2.375-2.375h4.75a2.378 2.378 0 0 1 2.375 2.375v4.75Zm-4.75 6.334a3.963 3.963 0 0 1-3.959 3.958h-4.75A3.963 3.963 0 0 1 2.5 17.542v-4.75a3.963 3.963 0 0 1 3.958-3.959.791.791 0 1 1 0 1.584 2.378 2.378 0 0 0-2.375 2.375v4.75a2.378 2.378 0 0 0 2.375 2.375h4.75a2.378 2.378 0 0 0 2.375-2.375.792.792 0 1 1 1.584 0Z"})))},$e,Me;function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ce.apply(this,arguments)}var Zt=function(t){return T.createElement("svg",ce({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),$e||($e=T.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.755 3.755 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.755 3.755 0 0 0 17.25 3Zm2.25 14.25a2.25 2.25 0 0 1-2.25 2.25H6.75a2.25 2.25 0 0 1-2.25-2.25V6.75A2.25 2.25 0 0 1 6.75 4.5h10.5a2.25 2.25 0 0 1 2.25 2.25v10.5Z"})),Me||(Me=T.createElement("path",{fill:"#14C786",d:"M10.312 14.45 7.83 11.906a.625.625 0 0 0-.896 0 .659.659 0 0 0 0 .918l2.481 2.546a1.264 1.264 0 0 0 .896.381 1.237 1.237 0 0 0 .895-.38l5.858-6.011a.658.658 0 0 0 0-.919.625.625 0 0 0-.896 0l-5.857 6.01Z"})))};function re({node:e,nodeMeta:t}){const{customizeCopy:n,CopyComponent:r,CopiedComponent:l}=p.useContext(J),[i,o]=p.useState(!1),c=u=>{u.stopPropagation();const d=n(e,t);typeof d=="string"&&d&&$t(d),o(!0),setTimeout(()=>o(!1),3e3)};return i?typeof l=="function"?a.jsx(l,{className:"json-view--copy",style:{display:"inline-block"}}):a.jsx(Zt,{className:"json-view--copy",style:{display:"inline-block"}}):typeof r=="function"?a.jsx(r,{onClick:c,className:"json-view--copy"}):a.jsx(Ut,{onClick:c,className:"json-view--copy"})}function ue({indexOrName:e,value:t,depth:n,deleteHandle:r,editHandle:l,parent:i,parentPath:o}){const{displayArrayIndex:c}=p.useContext(J),u=Array.isArray(i);return a.jsxs("div",Object.assign({className:"json-view--pair"},{children:[!u||u&&c?a.jsxs(a.Fragment,{children:[a.jsx("span",Object.assign({className:typeof e=="number"?"json-view--index":"json-view--property"},{children:e})),":"," "]}):a.jsx(a.Fragment,{}),a.jsx(nt,{node:t,depth:n+1,deleteHandle:(d,m)=>r(d,m),editHandle:(d,m,v,w)=>l(d,m,v,w),parent:i,indexOrName:e,parentPath:o})]}))}var Fe,He;function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fe.apply(this,arguments)}var xe=function(t){return T.createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),Fe||(Fe=T.createElement("path",{fill:"currentColor",d:"M18.75 6h-2.325a3.757 3.757 0 0 0-3.675-3h-1.5a3.757 3.757 0 0 0-3.675 3H5.25a.75.75 0 0 0 0 1.5H6v9.75A3.754 3.754 0 0 0 9.75 21h4.5A3.754 3.754 0 0 0 18 17.25V7.5h.75a.75.75 0 1 0 0-1.5Zm-7.5-1.5h1.5A2.255 2.255 0 0 1 14.872 6H9.128a2.255 2.255 0 0 1 2.122-1.5Zm5.25 12.75a2.25 2.25 0 0 1-2.25 2.25h-4.5a2.25 2.25 0 0 1-2.25-2.25V7.5h9v9.75Z"})),He||(He=T.createElement("path",{fill:"#DA0000",d:"M10.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75ZM13.5 16.5a.75.75 0 0 0 .75-.75v-4.5a.75.75 0 1 0-1.5 0v4.5a.75.75 0 0 0 .75.75Z"})))},Ue,Ze;function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},de.apply(this,arguments)}var tt=function(t){return T.createElement("svg",de({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),Ue||(Ue=T.createElement("path",{fill:"currentColor",d:"M21 6.75v10.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3h10.5A3.754 3.754 0 0 1 21 6.75Zm-1.5 0c0-1.24-1.01-2.25-2.25-2.25H6.75C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25V6.75Z"})),Ze||(Ze=T.createElement("path",{fill:"#14C786",d:"M15 12.75a.75.75 0 1 0 0-1.5h-2.25V9a.75.75 0 1 0-1.5 0v2.25H9a.75.75 0 1 0 0 1.5h2.25V15a.75.75 0 1 0 1.5 0v-2.25H15Z"})))},ze,Ve;function pe(){return pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pe.apply(this,arguments)}var Ce=function(t){return T.createElement("svg",pe({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),ze||(ze=T.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})),Ve||(Ve=T.createElement("path",{fill:"#14C786",d:"m10.85 13.96-1.986-2.036a.5.5 0 0 0-.716 0 .527.527 0 0 0 0 .735l1.985 2.036a1.01 1.01 0 0 0 .717.305.99.99 0 0 0 .716-.305l4.686-4.808a.526.526 0 0 0 0-.735.5.5 0 0 0-.716 0l-4.687 4.809Z"})))},Ye,Be;function ge(){return ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ge.apply(this,arguments)}var Se=function(t){return T.createElement("svg",ge({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),Ye||(Ye=T.createElement("path",{fill:"#DA0000",d:"M15 9a.75.75 0 0 0-1.06 0L12 10.94 10.06 9A.75.75 0 0 0 9 10.06L10.94 12 9 13.94A.75.75 0 0 0 10.06 15L12 13.06 13.94 15A.75.75 0 0 0 15 13.94L13.06 12 15 10.06A.75.75 0 0 0 15 9Z"})),Be||(Be=T.createElement("path",{fill:"currentColor",d:"M12 3a9 9 0 1 0 9 9 9.01 9.01 0 0 0-9-9Zm0 16.5a7.5 7.5 0 1 1 7.5-7.5 7.509 7.509 0 0 1-7.5 7.5Z"})))};function zt({originNode:e,node:t,depth:n,index:r,deleteHandle:l,customOptions:i,startIndex:o,parent:c,parentPath:u}){const{enableClipboard:d,src:m,onEdit:v,onChange:w,forceUpdate:E,displaySize:x,CustomOperation:S}=p.useContext(J),N=[...u,String(r)],[A,P]=p.useState(!0),$=p.useCallback((k,C,H)=>{e[k]=C,v&&v({newValue:C,oldValue:H,depth:n,src:m,indexOrName:k,parentType:"array",parentPath:u}),w&&w({type:"edit",depth:n,src:m,indexOrName:k,parentType:"array",parentPath:u}),E()},[t,v,w,E]),h=k=>{e.splice(k,1),l&&l(k,u),E()},b=a.jsxs(a.Fragment,{children:[!A&&a.jsxs("span",Object.assign({onClick:()=>P(!0),className:"jv-size-chevron"},{children:[K(x,n,A)&&a.jsxs("span",Object.assign({className:"jv-size"},{children:[ee(t)," Items"]})),a.jsx(we,{className:"jv-chevron"})]})),!A&&d&&ne(i)&&a.jsx(re,{node:t,nodeMeta:{depth:n,indexOrName:r,parent:c,parentPath:u,currentPath:N}}),typeof S=="function"?a.jsx(S,{node:t}):null]});return a.jsxs("div",{children:[a.jsx("span",{children:"["}),b,A?a.jsxs("button",Object.assign({onClick:()=>P(!1),className:"jv-button"},{children:[o," ... ",o+t.length-1]})):a.jsx("div",Object.assign({className:"jv-indent"},{children:t.map((k,C)=>a.jsx(ue,{indexOrName:C+o,value:k,depth:n,parent:t,deleteHandle:h,editHandle:$,parentPath:u},String(r)+String(C)))})),a.jsx("span",{children:"]"})]})}function Vt({node:e,depth:t,deleteHandle:n,indexOrName:r,customOptions:l,parent:i,parentPath:o}){const c=typeof r<"u"?[...o,String(r)]:o,u=[];for(let O=0;O<e.length;O+=100)u.push(e.slice(O,O+100));const{collapsed:d,enableClipboard:m,collapseObjectsAfterLength:v,editable:w,onDelete:E,src:x,onAdd:S,CustomOperation:N,onChange:A,forceUpdate:P,displaySize:$}=p.useContext(J),[h,b]=p.useState(Re(e,t,r,d,v,l));p.useEffect(()=>{b(Re(e,t,r,d,v,l))},[d,v]);const[k,C]=p.useState(!1),H=()=>{C(!1),n&&n(r,o),E&&E({value:e,depth:t,src:x,indexOrName:r,parentType:"array",parentPath:o}),A&&A({type:"delete",depth:t,src:x,indexOrName:r,parentType:"array",parentPath:o})},[R,B]=p.useState(!1),L=()=>{const O=e;O.push(null),S&&S({indexOrName:O.length-1,depth:t,src:x,parentType:"array",parentPath:o}),A&&A({type:"add",indexOrName:O.length-1,depth:t,src:x,parentType:"array",parentPath:o}),P()},D=k||R,U=()=>{C(!1),B(!1)},Z=a.jsxs(a.Fragment,{children:[!h&&!D&&a.jsxs("span",Object.assign({onClick:()=>b(!0),className:"jv-size-chevron"},{children:[K($,t,h)&&a.jsxs("span",Object.assign({className:"jv-size"},{children:[e.length," Items"]})),a.jsx(we,{className:"jv-chevron"})]})),D&&a.jsx(Ce,{className:"json-view--edit",style:{display:"inline-block"},onClick:R?L:H}),D&&a.jsx(Se,{className:"json-view--edit",style:{display:"inline-block"},onClick:U}),!h&&!D&&m&&ne(l)&&a.jsx(re,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:i,parentPath:o,currentPath:c}}),!h&&!D&&Qe(w)&&et(l)&&a.jsx(tt,{className:"json-view--edit",onClick:()=>{L()}}),!h&&!D&&je(w)&&ye(l)&&n&&a.jsx(xe,{className:"json-view--edit",onClick:()=>C(!0)}),typeof N=="function"?a.jsx(N,{node:e}):null]});return a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"["}),Z,h?a.jsx("button",Object.assign({onClick:()=>b(!1),className:"jv-button"},{children:"..."})):a.jsx("div",Object.assign({className:"jv-indent"},{children:u.map((O,M)=>a.jsx(zt,{originNode:e,node:O,depth:t,index:M,startIndex:M*100,deleteHandle:n,customOptions:l,parentPath:o},String(r)+String(M)))})),a.jsx("span",{children:"]"}),h&&K($,t,h)&&a.jsxs("span",Object.assign({onClick:()=>b(!1),className:"jv-size"},{children:[e.length," Items"]}))]})}function Yt({node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:l,parent:i,parentPath:o}){const{collapsed:c,onCollapse:u,enableClipboard:d,ignoreLargeArray:m,collapseObjectsAfterLength:v,editable:w,onDelete:E,src:x,onAdd:S,onEdit:N,onChange:A,forceUpdate:P,displaySize:$,CustomOperation:h}=p.useContext(J),b=typeof n<"u"?[...o,String(n)]:o;if(!m&&Array.isArray(e)&&e.length>100)return a.jsx(Vt,{node:e,depth:t,indexOrName:n,deleteHandle:r,customOptions:l,parentPath:b});const k=W(e),[C,H]=p.useState(Ne(e,t,n,c,v,l)),R=f=>{u?.({isCollapsing:!f,node:e,depth:t,indexOrName:n}),H(f)};p.useEffect(()=>{R(Ne(e,t,n,c,v,l))},[c,v]);const B=p.useCallback((f,j,V)=>{Array.isArray(e)?e[+f]=j:e&&(e[f]=j),N&&N({newValue:j,oldValue:V,depth:t,src:x,indexOrName:f,parentType:k?"object":"array",parentPath:b}),A&&A({type:"edit",depth:t,src:x,indexOrName:f,parentType:k?"object":"array",parentPath:b}),P()},[e,N,A,P]),L=f=>{Array.isArray(e)?e.splice(+f,1):e&&delete e[f],P()},[D,U]=p.useState(!1),Z=()=>{U(!1),r&&r(n,b),E&&E({value:e,depth:t,src:x,indexOrName:n,parentType:k?"object":"array",parentPath:b}),A&&A({type:"delete",depth:t,src:x,indexOrName:n,parentType:k?"object":"array",parentPath:b})},[O,M]=p.useState(!1),_=p.useRef(null),z=()=>{var f;if(k){const j=(f=_.current)===null||f===void 0?void 0:f.value;j&&(e[j]=null,_.current&&(_.current.value=""),M(!1),S&&S({indexOrName:j,depth:t,src:x,parentType:"object",parentPath:b}),A&&A({type:"add",indexOrName:j,depth:t,src:x,parentType:"object",parentPath:b}))}else if(Array.isArray(e)){const j=e;j.push(null),S&&S({indexOrName:j.length-1,depth:t,src:x,parentType:"array",parentPath:b}),A&&A({type:"add",indexOrName:j.length-1,depth:t,src:x,parentType:"array",parentPath:b})}P()},F=f=>{f.key==="Enter"?(f.preventDefault(),z()):f.key==="Escape"&&g()},s=D||O,g=()=>{U(!1),M(!1)},y=a.jsxs(a.Fragment,{children:[!C&&!s&&a.jsxs("span",Object.assign({onClick:()=>R(!0),className:"jv-size-chevron"},{children:[K($,t,C)&&a.jsxs("span",Object.assign({className:"jv-size"},{children:[ee(e)," Items"]})),a.jsx(we,{className:"jv-chevron"})]})),O&&k&&a.jsx("input",{className:"json-view--input",placeholder:"property",ref:_,onKeyDown:F}),s&&a.jsx(Ce,{className:"json-view--edit",style:{display:"inline-block"},onClick:O?z:Z}),s&&a.jsx(Se,{className:"json-view--edit",style:{display:"inline-block"},onClick:g}),!C&&!s&&d&&ne(l)&&a.jsx(re,{node:e,nodeMeta:{depth:t,indexOrName:n,parent:i,parentPath:o,currentPath:b}}),!C&&!s&&Qe(w)&&et(l)&&a.jsx(tt,{className:"json-view--edit",onClick:()=>{k?(M(!0),setTimeout(()=>{var f;return(f=_.current)===null||f===void 0?void 0:f.focus()})):z()}}),!C&&!s&&je(w)&&ye(l)&&r&&a.jsx(xe,{className:"json-view--edit",onClick:()=>U(!0)}),typeof h=="function"?a.jsx(h,{node:e}):null]});return Array.isArray(e)?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"["}),y,C?a.jsx("button",Object.assign({onClick:()=>R(!1),className:"jv-button"},{children:"..."})):a.jsx("div",Object.assign({className:"jv-indent"},{children:e.map((f,j)=>a.jsx(ue,{indexOrName:j,value:f,depth:t,parent:e,deleteHandle:L,editHandle:B,parentPath:b},String(n)+String(j)))})),a.jsx("span",{children:"]"}),C&&K($,t,C)&&a.jsxs("span",Object.assign({onClick:()=>R(!1),className:"jv-size"},{children:[ee(e)," Items"]}))]}):k?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"{"}),y,C?a.jsx("button",Object.assign({onClick:()=>R(!1),className:"jv-button"},{children:"..."})):a.jsx("div",Object.assign({className:"jv-indent"},{children:Object.entries(e).map(([f,j])=>a.jsx(ue,{indexOrName:f,value:j,depth:t,parent:e,deleteHandle:L,editHandle:B,parentPath:b},String(n)+String(f)))})),a.jsx("span",{children:"}"}),C&&K($,t,C)&&a.jsxs("span",Object.assign({onClick:()=>R(!1),className:"jv-size"},{children:[ee(e)," Items"]}))]}):a.jsx("span",{children:String(e)})}const Bt=p.forwardRef(({str:e,className:t,ctrlClick:n},r)=>{let{collapseStringMode:l,collapseStringsAfterLength:i,customizeCollapseStringUI:o}=p.useContext(J);const[c,u]=p.useState(!0),d=p.useRef(null);i=i>0?i:0;const m=e.replace(/\s+/g," "),v=typeof o=="function"?o(m,c):typeof o=="string"?o:"...",w=E=>{var x;if((E.ctrlKey||E.metaKey)&&n)n(E);else{const S=window.getSelection();if(S&&S.anchorOffset!==S.focusOffset&&((x=S.anchorNode)===null||x===void 0?void 0:x.parentElement)===d.current)return;u(!c)}};if(e.length<=i)return a.jsxs("span",Object.assign({ref:d,className:t,onClick:n},{children:['"',e,'"']}));if(l==="address")return e.length<=10?a.jsxs("span",Object.assign({ref:d,className:t,onClick:n},{children:['"',e,'"']})):a.jsxs("span",Object.assign({ref:d,onClick:w,className:t+" cursor-pointer"},{children:['"',c?[m.slice(0,6),v,m.slice(-4)]:e,'"']}));if(l==="directly")return a.jsxs("span",Object.assign({ref:d,onClick:w,className:t+" cursor-pointer"},{children:['"',c?[m.slice(0,i),v]:e,'"']}));if(l==="word"){let E=i,x=i+1,S=m,N=1;for(;;){if(/\W/.test(e[E])){S=e.slice(0,E);break}if(/\W/.test(e[x])){S=e.slice(0,x);break}if(N===6){S=e.slice(0,i);break}N++,E--,x++}return a.jsxs("span",Object.assign({ref:d,onClick:w,className:t+" cursor-pointer"},{children:['"',c?[S,v]:e,'"']}))}return a.jsxs("span",Object.assign({ref:d,className:t},{children:['"',e,'"']}))});var We;function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},me.apply(this,arguments)}var Wt=function(t){return T.createElement("svg",me({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),We||(We=T.createElement("path",{fill:"currentColor",d:"M17.25 3H6.75A3.754 3.754 0 0 0 3 6.75v10.5A3.754 3.754 0 0 0 6.75 21h10.5A3.754 3.754 0 0 0 21 17.25V6.75A3.754 3.754 0 0 0 17.25 3Zm2.25 14.25c0 1.24-1.01 2.25-2.25 2.25H6.75c-1.24 0-2.25-1.01-2.25-2.25V6.75c0-1.24 1.01-2.25 2.25-2.25h10.5c1.24 0 2.25 1.01 2.25 2.25v10.5Zm-6.09-9.466-5.031 5.03a2.981 2.981 0 0 0-.879 2.121v1.19c0 .415.336.75.75.75h1.19c.8 0 1.554-.312 2.12-.879l5.03-5.03a2.252 2.252 0 0 0 0-3.182c-.85-.85-2.331-.85-3.18 0Zm-2.91 7.151c-.28.28-.666.44-1.06.44H9v-.44c0-.4.156-.777.44-1.06l3.187-3.188 1.06 1.061-3.187 3.188Zm5.03-5.03-.782.783-1.06-1.061.782-.782a.766.766 0 0 1 1.06 0 .75.75 0 0 1 0 1.06Z"})))},Je,qe;function ve(){return ve=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ve.apply(this,arguments)}var Jt=function(t){return T.createElement("svg",ve({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24"},t),Je||(Je=T.createElement("path",{fill:"currentColor",d:"M6.75 3h5.5v1.5h-5.5C5.51 4.5 4.5 5.51 4.5 6.75v10.5c0 1.24 1.01 2.25 2.25 2.25h10.5c1.24 0 2.25-1.01 2.25-2.25v-5.5H21v5.5A3.754 3.754 0 0 1 17.25 21H6.75A3.754 3.754 0 0 1 3 17.25V6.75A3.754 3.754 0 0 1 6.75 3Z"})),qe||(qe=T.createElement("path",{fill:"currentColor",d:"M20.013 3h-3.946a.987.987 0 0 0 0 1.973h1.564l-6.342 6.342a1.004 1.004 0 0 0 0 1.396 1.004 1.004 0 0 0 1.396 0l6.342-6.342v1.564a.987.987 0 0 0 1.973 0V3.987A.987.987 0 0 0 20.013 3Z"})))};function nt({node:e,depth:t,deleteHandle:n,indexOrName:r,parent:l,editHandle:i,parentPath:o}){const{collapseStringsAfterLength:c,enableClipboard:u,editable:d,src:m,onDelete:v,onChange:w,customizeNode:E,matchesURL:x,urlRegExp:S,EditComponent:N,DoneComponent:A,CancelComponent:P,CustomOperation:$}=p.useContext(J);let h;if(typeof E=="function"&&(h=be(E,[{node:e,depth:t,indexOrName:r}])),h){if(p.isValidElement(h))return h;if(Mt(h)){const b=h;return a.jsx(b,{node:e,depth:t,indexOrName:r})}}if(Array.isArray(e)||W(e))return a.jsx(Yt,{parent:l,node:e,depth:t,indexOrName:r,deleteHandle:n,parentPath:o,customOptions:typeof h=="object"?h:void 0});{const b=typeof e,k=typeof r<"u"?[...o,String(r)]:o,[C,H]=p.useState(!1),[R,B]=p.useState(!1),L=p.useRef(null),D=()=>{H(!0),setTimeout(()=>{var f,j;(f=window.getSelection())===null||f===void 0||f.selectAllChildren(L.current),(j=L.current)===null||j===void 0||j.focus()})},U=p.useCallback(()=>{let f=L.current.innerText;try{const j=JSON.parse(f);i&&i(r,j,e,o)}catch{const V=Ht(b,f);i&&i(r,V,e,o)}H(!1)},[i,r,e,o,b]),Z=()=>{H(!1),B(!1)},O=()=>{B(!1),n&&n(r,o),v&&v({value:e,depth:t,src:m,indexOrName:r,parentType:Array.isArray(l)?"array":"object",parentPath:o}),w&&w({depth:t,src:m,indexOrName:r,parentType:Array.isArray(l)?"array":"object",type:"delete",parentPath:o})},M=p.useCallback(f=>{f.key==="Enter"?(f.preventDefault(),U()):f.key==="Escape"&&Z()},[U]),_=C||R,z=!_&&Le(d)&&De(h)&&i?f=>{(f.ctrlKey||f.metaKey)&&D()}:void 0,F=a.jsxs(a.Fragment,{children:[_&&(typeof A=="function"?a.jsx(A,{className:"json-view--edit",style:{display:"inline-block"},onClick:R?O:U}):a.jsx(Ce,{className:"json-view--edit",style:{display:"inline-block"},onClick:R?O:U})),_&&(typeof P=="function"?a.jsx(P,{className:"json-view--edit",style:{display:"inline-block"},onClick:Z}):a.jsx(Se,{className:"json-view--edit",style:{display:"inline-block"},onClick:Z})),!_&&u&&ne(h)&&a.jsx(re,{node:e,nodeMeta:{depth:t,indexOrName:r,parent:l,parentPath:o,currentPath:k}}),!_&&x&&b==="string"&&S.test(e)&&Ft(h)&&a.jsx("a",Object.assign({href:e,target:"_blank",className:"json-view--link"},{children:a.jsx(Jt,{})})),!_&&Le(d)&&De(h)&&i&&(typeof N=="function"?a.jsx(N,{className:"json-view--edit",onClick:D}):a.jsx(Wt,{className:"json-view--edit",onClick:D})),!_&&je(d)&&ye(h)&&n&&a.jsx(xe,{className:"json-view--edit",onClick:()=>B(!0)}),typeof $=="function"?a.jsx($,{node:e}):null]});let s="json-view--string";switch(b){case"number":case"bigint":s="json-view--number";break;case"boolean":s="json-view--boolean";break;case"object":s="json-view--null";break}typeof h?.className=="string"&&(s+=" "+h.className),R&&(s+=" json-view--deleting");let g=String(e);b==="bigint"&&(g+="n");const y=p.useMemo(()=>a.jsx("span",{contentEditable:!0,className:s,dangerouslySetInnerHTML:{__html:b==="string"?`"${g}"`:g},ref:L,onKeyDown:M}),[g,b,M]);return b==="string"?a.jsxs(a.Fragment,{children:[C?y:e.length>c?a.jsx(Bt,{str:e,ref:L,className:s,ctrlClick:z}):a.jsxs("span",Object.assign({className:s,onClick:z},{children:['"',g,'"']})),F]}):a.jsxs(a.Fragment,{children:[C?y:a.jsx("span",Object.assign({className:s,onClick:z},{children:g})),F]})}}const rt=/^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/,J=p.createContext({src:void 0,collapseStringsAfterLength:99,collapseStringMode:"directly",customizeCollapseStringUI:void 0,collapseObjectsAfterLength:20,collapsed:!1,onCollapse:void 0,enableClipboard:!0,editable:!1,onEdit:void 0,onDelete:void 0,onAdd:void 0,onChange:void 0,forceUpdate:()=>{},customizeNode:void 0,customizeCopy:()=>{},displaySize:void 0,displayArrayIndex:!0,matchesURL:!1,urlRegExp:rt,ignoreLargeArray:!1,CopyComponent:void 0,CopiedComponent:void 0,EditComponent:void 0,CancelComponent:void 0,DoneComponent:void 0,CustomOperation:void 0});function qt({src:e,collapseStringsAfterLength:t=99,collapseStringMode:n="directly",customizeCollapseStringUI:r,collapseObjectsAfterLength:l=99,collapsed:i,onCollapse:o,enableClipboard:c=!0,editable:u=!1,onEdit:d,onDelete:m,onAdd:v,onChange:w,dark:E=!1,theme:x="default",customizeNode:S,customizeCopy:N=Z=>It(Z),displaySize:A,displayArrayIndex:P=!0,style:$,className:h,matchesURL:b=!1,urlRegExp:k=rt,ignoreLargeArray:C=!1,CopyComponent:H,CopiedComponent:R,EditComponent:B,CancelComponent:L,DoneComponent:D,CustomOperation:U}){const[Z,O]=p.useState(0),M=p.useCallback(()=>O(F=>++F),[]),[_,z]=p.useState(e);return p.useEffect(()=>z(e),[e]),a.jsx(J.Provider,Object.assign({value:{src:_,collapseStringsAfterLength:t,collapseStringMode:n,customizeCollapseStringUI:r,collapseObjectsAfterLength:l,collapsed:i,onCollapse:o,enableClipboard:c,editable:u,onEdit:d,onDelete:m,onAdd:v,onChange:w,forceUpdate:M,customizeNode:S,customizeCopy:N,displaySize:A,displayArrayIndex:P,matchesURL:b,urlRegExp:k,ignoreLargeArray:C,CopyComponent:H,CopiedComponent:R,EditComponent:B,CancelComponent:L,DoneComponent:D,CustomOperation:U}},{children:a.jsx("code",Object.assign({className:"json-view"+(E?" dark":"")+(x&&x!=="default"?" json-view_"+x:"")+(h?" "+h:""),style:$},{children:a.jsx(nt,{node:_,depth:1,editHandle:(F,s,g,y)=>{z(s),d&&d({newValue:s,oldValue:g,depth:1,src:_,indexOrName:F,parentType:null,parentPath:y}),w&&w({type:"edit",depth:1,src:_,indexOrName:F,parentType:null,parentPath:y})},deleteHandle:(F,s)=>{z(void 0),m&&m({value:_,depth:1,src:_,indexOrName:F,parentType:null,parentPath:s}),w&&w({depth:1,src:_,indexOrName:F,parentType:null,type:"delete",parentPath:s})},parentPath:[]})}))}))}const Kt=["id","msg","time","level","step","flows","traceId"],Gt=({log:e,onClose:t})=>{const[n,r]=p.useState(!1),l=p.useMemo(()=>{if(!e)return null;const i=Object.keys(e??{}).filter(o=>!Kt.includes(o));return r(i.length>0),i.reduce((o,c)=>(o[c]=e[c],o),{})},[e]);return e?a.jsx(Y.Sidebar,{onClose:t,title:"Logs Details",subtitle:"Details including custom properties",actions:[{icon:a.jsx(Ge,{}),onClick:t,label:"Close"}],details:[{label:"Level",value:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Y.LevelDot,{level:e.level}),a.jsx("div",{className:"capitalize",children:e.level})]})},{label:"Time",value:Xe(e.time)},{label:"Step",value:e.step},{label:"Flows",value:e.flows.join(", ")},{label:"Trace ID",value:e.traceId}],children:n&&a.jsx(qt,{src:l,theme:"default",enableClipboard:!0})}):null},Xt=()=>{const e=Q(u=>u.logs),t=Q(u=>u.resetLogs),n=Q(u=>u.selectedLogId),r=Q(u=>u.selectLogId),l=p.useMemo(()=>n?e.find(u=>u.id===n):void 0,[e,n]),[i,o]=p.useState(""),c=p.useMemo(()=>e.filter(u=>u.msg.toLowerCase().includes(i.toLowerCase())||u.traceId.toLowerCase().includes(i.toLowerCase())||u.step.toLowerCase().includes(i.toLowerCase())),[e,i]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-full","data-testid":"logs-container",children:[a.jsxs("div",{className:"flex p-2 border-b gap-2","data-testid":"logs-search-container",children:[a.jsxs("div",{className:"flex-1 relative",children:[a.jsx(Y.Input,{variant:"shade",value:i,onChange:u=>o(u.target.value),className:"px-9! font-medium",placeholder:"Search by Trace ID or Message"}),a.jsx(Et,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50"}),a.jsx(Ge,{className:"cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground",onClick:()=>o("")})]}),a.jsxs(Y.Button,{variant:"default",onClick:t,className:"h-[34px]",children:[a.jsx(kt,{})," Clear"]})]}),a.jsx(Y.Table,{children:a.jsx(Y.TableBody,{className:"font-mono font-medium",children:c.map((u,d)=>a.jsxs(Y.TableRow,{"data-testid":"log-row",className:Y.cn("font-mono font-semibold cursor-pointer border-0",{"bg-muted-foreground/10 hover:bg-muted-foreground/20":n===u.id,"hover:bg-muted-foreground/10":n!==u.id}),onClick:()=>r(u.id),children:[a.jsxs(Y.TableCell,{"data-testid":`time-${d}`,className:"whitespace-nowrap flex items-center gap-2 text-muted-foreground",children:[a.jsx(Y.LevelDot,{level:u.level}),Xe(u.time)]}),a.jsx(Y.TableCell,{"data-testid":`trace-${u.traceId}`,className:"whitespace-nowrap cursor-pointer hover:text-primary text-muted-foreground",onClick:()=>o(u.traceId),children:u.traceId}),a.jsx(Y.TableCell,{"data-testid":`step-${d}`,"aria-label":u.step,className:"whitespace-nowrap",children:u.step}),a.jsx(Y.TableCell,{"data-testid":`msg-${d}`,"aria-label":u.msg,className:"whitespace-nowrap max-w-[500px] truncate w-full",children:u.msg})]},d))})})]}),a.jsx(Gt,{log:l,onClose:()=>r(void 0)})]})};mt();exports.LogsPage=Xt;
package/dist/index.d.ts CHANGED
@@ -1,19 +1,3 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
-
3
- //#region src/components/logs-page.d.ts
4
- declare const LogsPage: () => react_jsx_runtime0.JSX.Element;
5
- //#endregion
6
- //#region src/types/log.d.ts
7
- type Log = {
8
- id: string;
9
- level: string;
10
- time: number;
11
- msg: string;
12
- step: string;
13
- traceId: string;
14
- flows: string[];
15
- [key: string]: any;
16
- };
17
- //#endregion
18
- export { type Log, LogsPage };
1
+ export { LogsPage } from './components/logs-page';
2
+ export type { Log } from './types/log';
19
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/logs-page.tsx","../src/types/log.ts"],"sourcesContent":[],"mappings":";;;cAOa,gBAAQ,kBAAA,CAAA,GAAA,CAAA;;;KCPT,GAAA;;;EDOC,IAAA,EAAA,MAuFZ;;;;EC9FW,KAAA,EAAG,MAAA,EAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AAGrB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,YAAY,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA"}