@chaibuilder/sdk 3.1.4 → 3.1.5

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.
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),oe=require("./tooltip-C2BCZ8Al.cjs"),a=require("react"),ee=require("@radix-ui/react-icons");function ie(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function we(e){if(Array.isArray(e))return e}function je(e,t,r){return(t=Ie(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,l,f=[],g=!0,h=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(g=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);g=!0);}catch(S){h=!0,o=S}finally{try{if(!g&&r.return!=null&&(l=r.return(),Object(l)!==l))return}finally{if(h)throw o}}return f}}function Me(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(r),!0).forEach(function(n){je(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Se(e,t){if(e==null)return{};var r,n,o=Pe(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function Pe(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Ee(e,t){return we(e)||Oe(e,t)||xe(e,t)||Me()}function Ce(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ie(e){var t=Ce(e,"string");return typeof t=="symbol"?t:t+""}function xe(e,t){{if(typeof e=="string")return ie(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ie(e,t):void 0}}function Re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function le(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ce(Object(r),!0).forEach(function(n){Re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Le(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function q(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var l=arguments.length,f=new Array(l),g=0;g<l;g++)f[g]=arguments[g];return t.apply(r,[].concat(o,f))}}}function K(e){return{}.toString.call(e).includes("Object")}function Te(e){return!Object.keys(e).length}function U(e){return typeof e=="function"}function Ae(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function De(e,t){return K(t)||C("changeType"),Object.keys(t).some(function(r){return!Ae(e,r)})&&C("changeField"),t}function $e(e){U(e)||C("selectorType")}function Ne(e){U(e)||K(e)||C("handlerType"),K(e)&&Object.values(e).some(function(t){return!U(t)})&&C("handlersType")}function Ve(e){e||C("initialIsRequired"),K(e)||C("initialType"),Te(e)&&C("initialContent")}function qe(e,t){throw new Error(e[t]||e.default)}var ze={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},C=q(qe)(ze),W={changes:De,selector:$e,handler:Ne,initial:Ve};function Ue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};W.initial(e),W.handler(t);var r={current:e},n=q(He)(r,t),o=q(Be)(r),i=q(W.changes)(e),l=q(Fe)(r);function f(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(S){return S};return W.selector(h),h(r.current)}function g(h){Le(n,o,i,l)(h)}return[f,g]}function Fe(e,t){return U(t)?t(e.current):t}function Be(e,t){return e.current=le(le({},e.current),t),t}function He(e,t,r){return U(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var We={create:Ue},ke={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}};function Ke(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var l=arguments.length,f=new Array(l),g=0;g<l;g++)f[g]=arguments[g];return t.apply(r,[].concat(o,f))}}}function Ge(e){return{}.toString.call(e).includes("Object")}function Ye(e){return e||se("configIsRequired"),Ge(e)||se("configType"),e.urls?(_e(),{paths:{vs:e.urls.monacoBase}}):e}function _e(){console.warn(fe.deprecation)}function Je(e,t){throw new Error(e[t]||e.default)}var fe={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
+ You are using deprecated way of configuration.
4
+
5
+ Instead of using
6
+ monaco.config({ urls: { monacoBase: '...' } })
7
+ use
8
+ monaco.config({ paths: { vs: '...' } })
9
+
10
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
11
+ `},se=Ke(Je)(fe),Qe={config:Ye},Xe=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(o){return r.reduceRight(function(i,l){return l(i)},o)}};function de(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],de(e[r],t[r]))}),ue(ue({},e),t)}var Ze={type:"cancelation",msg:"operation is manually canceled"};function te(e){var t=!1,r=new Promise(function(n,o){e.then(function(i){return t?o(Ze):n(i)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var et=["monaco"],tt=We.create({config:ke,isInitialized:!1,resolve:null,reject:null,monaco:null}),pe=Ee(tt,2),F=pe[0],G=pe[1];function rt(e){var t=Qe.config(e),r=t.monaco,n=Se(t,et);G(function(o){return{config:de(o.config,n),monaco:r}})}function nt(){var e=F(function(t){var r=t.monaco,n=t.isInitialized,o=t.resolve;return{monaco:r,isInitialized:n,resolve:o}});if(!e.isInitialized){if(G({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),te(re);if(window.monaco&&window.monaco.editor)return ge(window.monaco),e.resolve(window.monaco),te(re);Xe(ot,at)(ut)}return te(re)}function ot(e){return document.body.appendChild(e)}function it(e){var t=document.createElement("script");return e&&(t.src=e),t}function at(e){var t=F(function(n){var o=n.config,i=n.reject;return{config:o,reject:i}}),r=it("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function ut(){var e=F(function(r){var n=r.config,o=r.resolve,i=r.reject;return{config:n,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var n=r.m;ge(n),e.resolve(n)},function(r){e.reject(r)})}function ge(e){F().monaco||G({monaco:e})}function ct(){return F(function(e){var t=e.monaco;return t})}var re=new Promise(function(e,t){return G({resolve:e,reject:t})}),he={config:rt,init:nt,__getMonacoInstance:ct},lt={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ne=lt,st={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},ft=st;function dt({children:e}){return a.createElement("div",{style:ft.container},e)}var pt=dt,gt=pt;function ht({width:e,height:t,isEditorReady:r,loading:n,_ref:o,className:i,wrapperProps:l}){return a.createElement("section",{style:{...ne.wrapper,width:e,height:t},...l},!r&&a.createElement(gt,null,n),a.createElement("div",{ref:o,style:{...ne.fullWidth,...!r&&ne.hide},className:i}))}var vt=ht,ve=a.memo(vt);function mt(e){a.useEffect(e,[])}var me=mt;function bt(e,t,r=!0){let n=a.useRef(!0);a.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var O=bt;function z(){}function T(e,t,r,n){return yt(e,n)||wt(e,t,r,n)}function yt(e,t){return e.editor.getModel(be(e,t))}function wt(e,t,r,n){return e.editor.createModel(t,r,n?be(e,n):void 0)}function be(e,t){return e.Uri.parse(t)}function jt({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:l,keepCurrentOriginalModel:f=!1,keepCurrentModifiedModel:g=!1,theme:h="light",loading:S="Loading...",options:M={},height:Y="100%",width:_="100%",className:J,wrapperProps:Q={},beforeMount:X=z,onMount:Z=z}){let[w,A]=a.useState(!1),[I,m]=a.useState(!0),b=a.useRef(null),v=a.useRef(null),D=a.useRef(null),y=a.useRef(Z),s=a.useRef(X),x=a.useRef(!1);me(()=>{let u=he.init();return u.then(d=>(v.current=d)&&m(!1)).catch(d=>(d==null?void 0:d.type)!=="cancelation"&&console.error("Monaco initialization: error:",d)),()=>b.current?$():u.cancel()}),O(()=>{if(b.current&&v.current){let u=b.current.getOriginalEditor(),d=T(v.current,e||"",n||r||"text",i||"");d!==u.getModel()&&u.setModel(d)}},[i],w),O(()=>{if(b.current&&v.current){let u=b.current.getModifiedEditor(),d=T(v.current,t||"",o||r||"text",l||"");d!==u.getModel()&&u.setModel(d)}},[l],w),O(()=>{let u=b.current.getModifiedEditor();u.getOption(v.current.editor.EditorOption.readOnly)?u.setValue(t||""):t!==u.getValue()&&(u.executeEdits("",[{range:u.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),u.pushUndoStop())},[t],w),O(()=>{var u,d;(d=(u=b.current)==null?void 0:u.getModel())==null||d.original.setValue(e||"")},[e],w),O(()=>{let{original:u,modified:d}=b.current.getModel();v.current.editor.setModelLanguage(u,n||r||"text"),v.current.editor.setModelLanguage(d,o||r||"text")},[r,n,o],w),O(()=>{var u;(u=v.current)==null||u.editor.setTheme(h)},[h],w),O(()=>{var u;(u=b.current)==null||u.updateOptions(M)},[M],w);let B=a.useCallback(()=>{var E;if(!v.current)return;s.current(v.current);let u=T(v.current,e||"",n||r||"text",i||""),d=T(v.current,t||"",o||r||"text",l||"");(E=b.current)==null||E.setModel({original:u,modified:d})},[r,t,o,e,n,i,l]),H=a.useCallback(()=>{var u;!x.current&&D.current&&(b.current=v.current.editor.createDiffEditor(D.current,{automaticLayout:!0,...M}),B(),(u=v.current)==null||u.editor.setTheme(h),A(!0),x.current=!0)},[M,h,B]);a.useEffect(()=>{w&&y.current(b.current,v.current)},[w]),a.useEffect(()=>{!I&&!w&&H()},[I,w,H]);function $(){var d,E,R,N;let u=(d=b.current)==null?void 0:d.getModel();f||((E=u==null?void 0:u.original)==null||E.dispose()),g||((R=u==null?void 0:u.modified)==null||R.dispose()),(N=b.current)==null||N.dispose()}return a.createElement(ve,{width:_,height:Y,isEditorReady:w,loading:S,_ref:D,className:J,wrapperProps:Q})}var Ot=jt;a.memo(Ot);function Mt(e){let t=a.useRef();return a.useEffect(()=>{t.current=e},[e]),t.current}var St=Mt,k=new Map;function Pt({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:o,path:i,theme:l="light",line:f,loading:g="Loading...",options:h={},overrideServices:S={},saveViewState:M=!0,keepCurrentModel:Y=!1,width:_="100%",height:J="100%",className:Q,wrapperProps:X={},beforeMount:Z=z,onMount:w=z,onChange:A,onValidate:I=z}){let[m,b]=a.useState(!1),[v,D]=a.useState(!0),y=a.useRef(null),s=a.useRef(null),x=a.useRef(null),B=a.useRef(w),H=a.useRef(Z),$=a.useRef(),u=a.useRef(n),d=St(i),E=a.useRef(!1),R=a.useRef(!1);me(()=>{let c=he.init();return c.then(p=>(y.current=p)&&D(!1)).catch(p=>(p==null?void 0:p.type)!=="cancelation"&&console.error("Monaco initialization: error:",p)),()=>s.current?ye():c.cancel()}),O(()=>{var p,j,V,L;let c=T(y.current,e||n||"",t||o||"",i||r||"");c!==((p=s.current)==null?void 0:p.getModel())&&(M&&k.set(d,(j=s.current)==null?void 0:j.saveViewState()),(V=s.current)==null||V.setModel(c),M&&((L=s.current)==null||L.restoreViewState(k.get(i))))},[i],m),O(()=>{var c;(c=s.current)==null||c.updateOptions(h)},[h],m),O(()=>{!s.current||n===void 0||(s.current.getOption(y.current.editor.EditorOption.readOnly)?s.current.setValue(n):n!==s.current.getValue()&&(R.current=!0,s.current.executeEdits("",[{range:s.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),s.current.pushUndoStop(),R.current=!1))},[n],m),O(()=>{var p,j;let c=(p=s.current)==null?void 0:p.getModel();c&&o&&((j=y.current)==null||j.editor.setModelLanguage(c,o))},[o],m),O(()=>{var c;f!==void 0&&((c=s.current)==null||c.revealLine(f))},[f],m),O(()=>{var c;(c=y.current)==null||c.editor.setTheme(l)},[l],m);let N=a.useCallback(()=>{var c;if(!(!x.current||!y.current)&&!E.current){H.current(y.current);let p=i||r,j=T(y.current,n||e||"",t||o||"",p||"");s.current=(c=y.current)==null?void 0:c.editor.create(x.current,{model:j,automaticLayout:!0,...h},S),M&&s.current.restoreViewState(k.get(p)),y.current.editor.setTheme(l),f!==void 0&&s.current.revealLine(f),b(!0),E.current=!0}},[e,t,r,n,o,i,h,S,M,l,f]);a.useEffect(()=>{m&&B.current(s.current,y.current)},[m]),a.useEffect(()=>{!v&&!m&&N()},[v,m,N]),u.current=n,a.useEffect(()=>{var c,p;m&&A&&((c=$.current)==null||c.dispose(),$.current=(p=s.current)==null?void 0:p.onDidChangeModelContent(j=>{R.current||A(s.current.getValue(),j)}))},[m,A]),a.useEffect(()=>{if(m){let c=y.current.editor.onDidChangeMarkers(p=>{var V;let j=(V=s.current.getModel())==null?void 0:V.uri;if(j&&p.find(L=>L.path===j.path)){let L=y.current.editor.getModelMarkers({resource:j});I==null||I(L)}});return()=>{c==null||c.dispose()}}return()=>{}},[m,I]);function ye(){var c,p;(c=$.current)==null||c.dispose(),Y?M&&k.set(i,s.current.saveViewState()):(p=s.current.getModel())==null||p.dispose(),s.current.dispose()}return a.createElement(ve,{width:_,height:J,isEditorReady:m,loading:g,_ref:x,className:Q,wrapperProps:X})}var Et=Pt,Ct=a.memo(Et),It=Ct;function xt({code:e,onCopy:t,language:r="javascript",onDownload:n,downloadText:o="Download"}){const[i,l]=a.useState(!1),[f,g]=a.useState(e),h=()=>{t(f),l(!0),setTimeout(()=>{l(!1)},2e3)},S=()=>{n(f)};return P.jsxs("div",{className:"flex flex-col gap-4",children:[P.jsx("div",{className:"h-[500px] max-h-full overflow-hidden rounded-md border py-2",children:P.jsx(It,{height:"100%",defaultLanguage:r,language:r,value:f,onChange:M=>g(M||""),theme:"vs-light",options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"off",roundedSelection:!1,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,insertSpaces:!0,wordWrap:"on",bracketPairColorization:{enabled:!0},suggest:{showKeywords:!1,showSnippets:!1}}})}),P.jsxs("div",{className:"flex justify-end gap-2",children:[P.jsxs(oe.Button,{type:"button",variant:"outline",onClick:h,children:[i?P.jsx(ee.CheckIcon,{className:"text-green-500"}):P.jsx(ee.CopyIcon,{})," ",i?"Copied":"Copy"]}),P.jsxs(oe.Button,{type:"button",onClick:S,children:[P.jsx(ee.DownloadIcon,{})," ",o]})]})]})}exports.default=xt;
@@ -0,0 +1,620 @@
1
+ import { jsxs as k, jsx as U } from "react/jsx-runtime";
2
+ import { v as le } from "./tooltip-4-b9QGDK.js";
3
+ import A, { memo as ue, useState as $, useRef as m, useCallback as ce, useEffect as P } from "react";
4
+ import { CheckIcon as Pe, CopyIcon as Ce, DownloadIcon as Ee } from "@radix-ui/react-icons";
5
+ function se(e, t) {
6
+ (t == null || t > e.length) && (t = e.length);
7
+ for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r];
8
+ return n;
9
+ }
10
+ function Ie(e) {
11
+ if (Array.isArray(e)) return e;
12
+ }
13
+ function Le(e, t, r) {
14
+ return (t = Ve(t)) in e ? Object.defineProperty(e, t, {
15
+ value: r,
16
+ enumerable: !0,
17
+ configurable: !0,
18
+ writable: !0
19
+ }) : e[t] = r, e;
20
+ }
21
+ function xe(e, t) {
22
+ var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
23
+ if (r != null) {
24
+ var n, o, i, u, s = [], p = !0, h = !1;
25
+ try {
26
+ if (i = (r = r.call(e)).next, t !== 0) for (; !(p = (n = i.call(r)).done) && (s.push(n.value), s.length !== t); p = !0) ;
27
+ } catch (S) {
28
+ h = !0, o = S;
29
+ } finally {
30
+ try {
31
+ if (!p && r.return != null && (u = r.return(), Object(u) !== u)) return;
32
+ } finally {
33
+ if (h) throw o;
34
+ }
35
+ }
36
+ return s;
37
+ }
38
+ }
39
+ function De() {
40
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
41
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
42
+ }
43
+ function de(e, t) {
44
+ var r = Object.keys(e);
45
+ if (Object.getOwnPropertySymbols) {
46
+ var n = Object.getOwnPropertySymbols(e);
47
+ t && (n = n.filter(function(o) {
48
+ return Object.getOwnPropertyDescriptor(e, o).enumerable;
49
+ })), r.push.apply(r, n);
50
+ }
51
+ return r;
52
+ }
53
+ function fe(e) {
54
+ for (var t = 1; t < arguments.length; t++) {
55
+ var r = arguments[t] != null ? arguments[t] : {};
56
+ t % 2 ? de(Object(r), !0).forEach(function(n) {
57
+ Le(e, n, r[n]);
58
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : de(Object(r)).forEach(function(n) {
59
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
60
+ });
61
+ }
62
+ return e;
63
+ }
64
+ function Te(e, t) {
65
+ if (e == null) return {};
66
+ var r, n, o = Ae(e, t);
67
+ if (Object.getOwnPropertySymbols) {
68
+ var i = Object.getOwnPropertySymbols(e);
69
+ for (n = 0; n < i.length; n++) r = i[n], t.indexOf(r) === -1 && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
70
+ }
71
+ return o;
72
+ }
73
+ function Ae(e, t) {
74
+ if (e == null) return {};
75
+ var r = {};
76
+ for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
77
+ if (t.indexOf(n) !== -1) continue;
78
+ r[n] = e[n];
79
+ }
80
+ return r;
81
+ }
82
+ function $e(e, t) {
83
+ return Ie(e) || xe(e, t) || ze(e, t) || De();
84
+ }
85
+ function Ne(e, t) {
86
+ if (typeof e != "object" || !e) return e;
87
+ var r = e[Symbol.toPrimitive];
88
+ if (r !== void 0) {
89
+ var n = r.call(e, t);
90
+ if (typeof n != "object") return n;
91
+ throw new TypeError("@@toPrimitive must return a primitive value.");
92
+ }
93
+ return (t === "string" ? String : Number)(e);
94
+ }
95
+ function Ve(e) {
96
+ var t = Ne(e, "string");
97
+ return typeof t == "symbol" ? t : t + "";
98
+ }
99
+ function ze(e, t) {
100
+ {
101
+ if (typeof e == "string") return se(e, t);
102
+ var r = {}.toString.call(e).slice(8, -1);
103
+ return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? se(e, t) : void 0;
104
+ }
105
+ }
106
+ function Re(e, t, r) {
107
+ return t in e ? Object.defineProperty(e, t, {
108
+ value: r,
109
+ enumerable: !0,
110
+ configurable: !0,
111
+ writable: !0
112
+ }) : e[t] = r, e;
113
+ }
114
+ function pe(e, t) {
115
+ var r = Object.keys(e);
116
+ if (Object.getOwnPropertySymbols) {
117
+ var n = Object.getOwnPropertySymbols(e);
118
+ t && (n = n.filter(function(o) {
119
+ return Object.getOwnPropertyDescriptor(e, o).enumerable;
120
+ })), r.push.apply(r, n);
121
+ }
122
+ return r;
123
+ }
124
+ function ge(e) {
125
+ for (var t = 1; t < arguments.length; t++) {
126
+ var r = arguments[t] != null ? arguments[t] : {};
127
+ t % 2 ? pe(Object(r), !0).forEach(function(n) {
128
+ Re(e, n, r[n]);
129
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : pe(Object(r)).forEach(function(n) {
130
+ Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
131
+ });
132
+ }
133
+ return e;
134
+ }
135
+ function qe() {
136
+ for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
137
+ t[r] = arguments[r];
138
+ return function(n) {
139
+ return t.reduceRight(function(o, i) {
140
+ return i(o);
141
+ }, n);
142
+ };
143
+ }
144
+ function F(e) {
145
+ return function t() {
146
+ for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
147
+ o[i] = arguments[i];
148
+ return o.length >= e.length ? e.apply(this, o) : function() {
149
+ for (var u = arguments.length, s = new Array(u), p = 0; p < u; p++)
150
+ s[p] = arguments[p];
151
+ return t.apply(r, [].concat(o, s));
152
+ };
153
+ };
154
+ }
155
+ function J(e) {
156
+ return {}.toString.call(e).includes("Object");
157
+ }
158
+ function Ue(e) {
159
+ return !Object.keys(e).length;
160
+ }
161
+ function W(e) {
162
+ return typeof e == "function";
163
+ }
164
+ function Fe(e, t) {
165
+ return Object.prototype.hasOwnProperty.call(e, t);
166
+ }
167
+ function He(e, t) {
168
+ return J(t) || E("changeType"), Object.keys(t).some(function(r) {
169
+ return !Fe(e, r);
170
+ }) && E("changeField"), t;
171
+ }
172
+ function We(e) {
173
+ W(e) || E("selectorType");
174
+ }
175
+ function Be(e) {
176
+ W(e) || J(e) || E("handlerType"), J(e) && Object.values(e).some(function(t) {
177
+ return !W(t);
178
+ }) && E("handlersType");
179
+ }
180
+ function Ke(e) {
181
+ e || E("initialIsRequired"), J(e) || E("initialType"), Ue(e) && E("initialContent");
182
+ }
183
+ function _e(e, t) {
184
+ throw new Error(e[t] || e.default);
185
+ }
186
+ var ke = {
187
+ initialIsRequired: "initial state is required",
188
+ initialType: "initial state should be an object",
189
+ initialContent: "initial state shouldn't be an empty object",
190
+ handlerType: "handler should be an object or a function",
191
+ handlersType: "all handlers should be a functions",
192
+ selectorType: "selector should be a function",
193
+ changeType: "provided value of changes should be an object",
194
+ changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
195
+ default: "an unknown error accured in `state-local` package"
196
+ }, E = F(_e)(ke), G = {
197
+ changes: He,
198
+ selector: We,
199
+ handler: Be,
200
+ initial: Ke
201
+ };
202
+ function Ge(e) {
203
+ var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
204
+ G.initial(e), G.handler(t);
205
+ var r = {
206
+ current: e
207
+ }, n = F(Qe)(r, t), o = F(Je)(r), i = F(G.changes)(e), u = F(Ye)(r);
208
+ function s() {
209
+ var h = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(S) {
210
+ return S;
211
+ };
212
+ return G.selector(h), h(r.current);
213
+ }
214
+ function p(h) {
215
+ qe(n, o, i, u)(h);
216
+ }
217
+ return [s, p];
218
+ }
219
+ function Ye(e, t) {
220
+ return W(t) ? t(e.current) : t;
221
+ }
222
+ function Je(e, t) {
223
+ return e.current = ge(ge({}, e.current), t), t;
224
+ }
225
+ function Qe(e, t, r) {
226
+ return W(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
227
+ var o;
228
+ return (o = t[n]) === null || o === void 0 ? void 0 : o.call(t, e.current[n]);
229
+ }), r;
230
+ }
231
+ var Xe = {
232
+ create: Ge
233
+ }, Ze = {
234
+ paths: {
235
+ vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"
236
+ }
237
+ };
238
+ function et(e) {
239
+ return function t() {
240
+ for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
241
+ o[i] = arguments[i];
242
+ return o.length >= e.length ? e.apply(this, o) : function() {
243
+ for (var u = arguments.length, s = new Array(u), p = 0; p < u; p++)
244
+ s[p] = arguments[p];
245
+ return t.apply(r, [].concat(o, s));
246
+ };
247
+ };
248
+ }
249
+ function tt(e) {
250
+ return {}.toString.call(e).includes("Object");
251
+ }
252
+ function rt(e) {
253
+ return e || he("configIsRequired"), tt(e) || he("configType"), e.urls ? (nt(), {
254
+ paths: {
255
+ vs: e.urls.monacoBase
256
+ }
257
+ }) : e;
258
+ }
259
+ function nt() {
260
+ console.warn(ve.deprecation);
261
+ }
262
+ function ot(e, t) {
263
+ throw new Error(e[t] || e.default);
264
+ }
265
+ var ve = {
266
+ configIsRequired: "the configuration object is required",
267
+ configType: "the configuration object should be an object",
268
+ default: "an unknown error accured in `@monaco-editor/loader` package",
269
+ deprecation: `Deprecation warning!
270
+ You are using deprecated way of configuration.
271
+
272
+ Instead of using
273
+ monaco.config({ urls: { monacoBase: '...' } })
274
+ use
275
+ monaco.config({ paths: { vs: '...' } })
276
+
277
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
278
+ `
279
+ }, he = et(ot)(ve), it = {
280
+ config: rt
281
+ }, at = function() {
282
+ for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
283
+ r[n] = arguments[n];
284
+ return function(o) {
285
+ return r.reduceRight(function(i, u) {
286
+ return u(i);
287
+ }, o);
288
+ };
289
+ };
290
+ function me(e, t) {
291
+ return Object.keys(t).forEach(function(r) {
292
+ t[r] instanceof Object && e[r] && Object.assign(t[r], me(e[r], t[r]));
293
+ }), fe(fe({}, e), t);
294
+ }
295
+ var ct = {
296
+ type: "cancelation",
297
+ msg: "operation is manually canceled"
298
+ };
299
+ function oe(e) {
300
+ var t = !1, r = new Promise(function(n, o) {
301
+ e.then(function(i) {
302
+ return t ? o(ct) : n(i);
303
+ }), e.catch(o);
304
+ });
305
+ return r.cancel = function() {
306
+ return t = !0;
307
+ }, r;
308
+ }
309
+ var ut = ["monaco"], lt = Xe.create({
310
+ config: Ze,
311
+ isInitialized: !1,
312
+ resolve: null,
313
+ reject: null,
314
+ monaco: null
315
+ }), be = $e(lt, 2), B = be[0], Q = be[1];
316
+ function st(e) {
317
+ var t = it.config(e), r = t.monaco, n = Te(t, ut);
318
+ Q(function(o) {
319
+ return {
320
+ config: me(o.config, n),
321
+ monaco: r
322
+ };
323
+ });
324
+ }
325
+ function dt() {
326
+ var e = B(function(t) {
327
+ var r = t.monaco, n = t.isInitialized, o = t.resolve;
328
+ return {
329
+ monaco: r,
330
+ isInitialized: n,
331
+ resolve: o
332
+ };
333
+ });
334
+ if (!e.isInitialized) {
335
+ if (Q({
336
+ isInitialized: !0
337
+ }), e.monaco)
338
+ return e.resolve(e.monaco), oe(ie);
339
+ if (window.monaco && window.monaco.editor)
340
+ return ye(window.monaco), e.resolve(window.monaco), oe(ie);
341
+ at(ft, gt)(ht);
342
+ }
343
+ return oe(ie);
344
+ }
345
+ function ft(e) {
346
+ return document.body.appendChild(e);
347
+ }
348
+ function pt(e) {
349
+ var t = document.createElement("script");
350
+ return e && (t.src = e), t;
351
+ }
352
+ function gt(e) {
353
+ var t = B(function(n) {
354
+ var o = n.config, i = n.reject;
355
+ return {
356
+ config: o,
357
+ reject: i
358
+ };
359
+ }), r = pt("".concat(t.config.paths.vs, "/loader.js"));
360
+ return r.onload = function() {
361
+ return e();
362
+ }, r.onerror = t.reject, r;
363
+ }
364
+ function ht() {
365
+ var e = B(function(r) {
366
+ var n = r.config, o = r.resolve, i = r.reject;
367
+ return {
368
+ config: n,
369
+ resolve: o,
370
+ reject: i
371
+ };
372
+ }), t = window.require;
373
+ t.config(e.config), t(["vs/editor/editor.main"], function(r) {
374
+ var n = r.m;
375
+ ye(n), e.resolve(n);
376
+ }, function(r) {
377
+ e.reject(r);
378
+ });
379
+ }
380
+ function ye(e) {
381
+ B().monaco || Q({
382
+ monaco: e
383
+ });
384
+ }
385
+ function vt() {
386
+ return B(function(e) {
387
+ var t = e.monaco;
388
+ return t;
389
+ });
390
+ }
391
+ var ie = new Promise(function(e, t) {
392
+ return Q({
393
+ resolve: e,
394
+ reject: t
395
+ });
396
+ }), we = {
397
+ config: st,
398
+ init: dt,
399
+ __getMonacoInstance: vt
400
+ }, mt = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, ae = mt, bt = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, yt = bt;
401
+ function wt({ children: e }) {
402
+ return A.createElement("div", { style: yt.container }, e);
403
+ }
404
+ var Ot = wt, jt = Ot;
405
+ function Mt({ width: e, height: t, isEditorReady: r, loading: n, _ref: o, className: i, wrapperProps: u }) {
406
+ return A.createElement("section", { style: { ...ae.wrapper, width: e, height: t }, ...u }, !r && A.createElement(jt, null, n), A.createElement("div", { ref: o, style: { ...ae.fullWidth, ...!r && ae.hide }, className: i }));
407
+ }
408
+ var St = Mt, Oe = ue(St);
409
+ function Pt(e) {
410
+ P(e, []);
411
+ }
412
+ var je = Pt;
413
+ function Ct(e, t, r = !0) {
414
+ let n = m(!0);
415
+ P(n.current || !r ? () => {
416
+ n.current = !1;
417
+ } : e, t);
418
+ }
419
+ var j = Ct;
420
+ function H() {
421
+ }
422
+ function T(e, t, r, n) {
423
+ return Et(e, n) || It(e, t, r, n);
424
+ }
425
+ function Et(e, t) {
426
+ return e.editor.getModel(Me(e, t));
427
+ }
428
+ function It(e, t, r, n) {
429
+ return e.editor.createModel(t, r, n ? Me(e, n) : void 0);
430
+ }
431
+ function Me(e, t) {
432
+ return e.Uri.parse(t);
433
+ }
434
+ function Lt({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: o, originalModelPath: i, modifiedModelPath: u, keepCurrentOriginalModel: s = !1, keepCurrentModifiedModel: p = !1, theme: h = "light", loading: S = "Loading...", options: M = {}, height: X = "100%", width: Z = "100%", className: ee, wrapperProps: te = {}, beforeMount: re = H, onMount: ne = H }) {
435
+ let [w, N] = $(!1), [I, v] = $(!0), b = m(null), g = m(null), V = m(null), y = m(ne), l = m(re), L = m(!1);
436
+ je(() => {
437
+ let a = we.init();
438
+ return a.then((d) => (g.current = d) && v(!1)).catch((d) => (d == null ? void 0 : d.type) !== "cancelation" && console.error("Monaco initialization: error:", d)), () => b.current ? z() : a.cancel();
439
+ }), j(() => {
440
+ if (b.current && g.current) {
441
+ let a = b.current.getOriginalEditor(), d = T(g.current, e || "", n || r || "text", i || "");
442
+ d !== a.getModel() && a.setModel(d);
443
+ }
444
+ }, [i], w), j(() => {
445
+ if (b.current && g.current) {
446
+ let a = b.current.getModifiedEditor(), d = T(g.current, t || "", o || r || "text", u || "");
447
+ d !== a.getModel() && a.setModel(d);
448
+ }
449
+ }, [u], w), j(() => {
450
+ let a = b.current.getModifiedEditor();
451
+ a.getOption(g.current.editor.EditorOption.readOnly) ? a.setValue(t || "") : t !== a.getValue() && (a.executeEdits("", [{ range: a.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), a.pushUndoStop());
452
+ }, [t], w), j(() => {
453
+ var a, d;
454
+ (d = (a = b.current) == null ? void 0 : a.getModel()) == null || d.original.setValue(e || "");
455
+ }, [e], w), j(() => {
456
+ let { original: a, modified: d } = b.current.getModel();
457
+ g.current.editor.setModelLanguage(a, n || r || "text"), g.current.editor.setModelLanguage(d, o || r || "text");
458
+ }, [r, n, o], w), j(() => {
459
+ var a;
460
+ (a = g.current) == null || a.editor.setTheme(h);
461
+ }, [h], w), j(() => {
462
+ var a;
463
+ (a = b.current) == null || a.updateOptions(M);
464
+ }, [M], w);
465
+ let K = ce(() => {
466
+ var C;
467
+ if (!g.current) return;
468
+ l.current(g.current);
469
+ let a = T(g.current, e || "", n || r || "text", i || ""), d = T(g.current, t || "", o || r || "text", u || "");
470
+ (C = b.current) == null || C.setModel({ original: a, modified: d });
471
+ }, [r, t, o, e, n, i, u]), _ = ce(() => {
472
+ var a;
473
+ !L.current && V.current && (b.current = g.current.editor.createDiffEditor(V.current, { automaticLayout: !0, ...M }), K(), (a = g.current) == null || a.editor.setTheme(h), N(!0), L.current = !0);
474
+ }, [M, h, K]);
475
+ P(() => {
476
+ w && y.current(b.current, g.current);
477
+ }, [w]), P(() => {
478
+ !I && !w && _();
479
+ }, [I, w, _]);
480
+ function z() {
481
+ var d, C, x, R;
482
+ let a = (d = b.current) == null ? void 0 : d.getModel();
483
+ s || ((C = a == null ? void 0 : a.original) == null || C.dispose()), p || ((x = a == null ? void 0 : a.modified) == null || x.dispose()), (R = b.current) == null || R.dispose();
484
+ }
485
+ return A.createElement(Oe, { width: Z, height: X, isEditorReady: w, loading: S, _ref: V, className: ee, wrapperProps: te });
486
+ }
487
+ var xt = Lt;
488
+ ue(xt);
489
+ function Dt(e) {
490
+ let t = m();
491
+ return P(() => {
492
+ t.current = e;
493
+ }, [e]), t.current;
494
+ }
495
+ var Tt = Dt, Y = /* @__PURE__ */ new Map();
496
+ function At({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: o, path: i, theme: u = "light", line: s, loading: p = "Loading...", options: h = {}, overrideServices: S = {}, saveViewState: M = !0, keepCurrentModel: X = !1, width: Z = "100%", height: ee = "100%", className: te, wrapperProps: re = {}, beforeMount: ne = H, onMount: w = H, onChange: N, onValidate: I = H }) {
497
+ let [v, b] = $(!1), [g, V] = $(!0), y = m(null), l = m(null), L = m(null), K = m(w), _ = m(ne), z = m(), a = m(n), d = Tt(i), C = m(!1), x = m(!1);
498
+ je(() => {
499
+ let c = we.init();
500
+ return c.then((f) => (y.current = f) && V(!1)).catch((f) => (f == null ? void 0 : f.type) !== "cancelation" && console.error("Monaco initialization: error:", f)), () => l.current ? Se() : c.cancel();
501
+ }), j(() => {
502
+ var f, O, q, D;
503
+ let c = T(y.current, e || n || "", t || o || "", i || r || "");
504
+ c !== ((f = l.current) == null ? void 0 : f.getModel()) && (M && Y.set(d, (O = l.current) == null ? void 0 : O.saveViewState()), (q = l.current) == null || q.setModel(c), M && ((D = l.current) == null || D.restoreViewState(Y.get(i))));
505
+ }, [i], v), j(() => {
506
+ var c;
507
+ (c = l.current) == null || c.updateOptions(h);
508
+ }, [h], v), j(() => {
509
+ !l.current || n === void 0 || (l.current.getOption(y.current.editor.EditorOption.readOnly) ? l.current.setValue(n) : n !== l.current.getValue() && (x.current = !0, l.current.executeEdits("", [{ range: l.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), l.current.pushUndoStop(), x.current = !1));
510
+ }, [n], v), j(() => {
511
+ var f, O;
512
+ let c = (f = l.current) == null ? void 0 : f.getModel();
513
+ c && o && ((O = y.current) == null || O.editor.setModelLanguage(c, o));
514
+ }, [o], v), j(() => {
515
+ var c;
516
+ s !== void 0 && ((c = l.current) == null || c.revealLine(s));
517
+ }, [s], v), j(() => {
518
+ var c;
519
+ (c = y.current) == null || c.editor.setTheme(u);
520
+ }, [u], v);
521
+ let R = ce(() => {
522
+ var c;
523
+ if (!(!L.current || !y.current) && !C.current) {
524
+ _.current(y.current);
525
+ let f = i || r, O = T(y.current, n || e || "", t || o || "", f || "");
526
+ l.current = (c = y.current) == null ? void 0 : c.editor.create(L.current, { model: O, automaticLayout: !0, ...h }, S), M && l.current.restoreViewState(Y.get(f)), y.current.editor.setTheme(u), s !== void 0 && l.current.revealLine(s), b(!0), C.current = !0;
527
+ }
528
+ }, [e, t, r, n, o, i, h, S, M, u, s]);
529
+ P(() => {
530
+ v && K.current(l.current, y.current);
531
+ }, [v]), P(() => {
532
+ !g && !v && R();
533
+ }, [g, v, R]), a.current = n, P(() => {
534
+ var c, f;
535
+ v && N && ((c = z.current) == null || c.dispose(), z.current = (f = l.current) == null ? void 0 : f.onDidChangeModelContent((O) => {
536
+ x.current || N(l.current.getValue(), O);
537
+ }));
538
+ }, [v, N]), P(() => {
539
+ if (v) {
540
+ let c = y.current.editor.onDidChangeMarkers((f) => {
541
+ var q;
542
+ let O = (q = l.current.getModel()) == null ? void 0 : q.uri;
543
+ if (O && f.find((D) => D.path === O.path)) {
544
+ let D = y.current.editor.getModelMarkers({ resource: O });
545
+ I == null || I(D);
546
+ }
547
+ });
548
+ return () => {
549
+ c == null || c.dispose();
550
+ };
551
+ }
552
+ return () => {
553
+ };
554
+ }, [v, I]);
555
+ function Se() {
556
+ var c, f;
557
+ (c = z.current) == null || c.dispose(), X ? M && Y.set(i, l.current.saveViewState()) : (f = l.current.getModel()) == null || f.dispose(), l.current.dispose();
558
+ }
559
+ return A.createElement(Oe, { width: Z, height: ee, isEditorReady: v, loading: p, _ref: L, className: te, wrapperProps: re });
560
+ }
561
+ var $t = At, Nt = ue($t), Vt = Nt;
562
+ function Ft({
563
+ code: e,
564
+ onCopy: t,
565
+ language: r = "javascript",
566
+ onDownload: n,
567
+ downloadText: o = "Download"
568
+ }) {
569
+ const [i, u] = $(!1), [s, p] = $(e);
570
+ return /* @__PURE__ */ k("div", { className: "flex flex-col gap-4", children: [
571
+ /* @__PURE__ */ U("div", { className: "h-[500px] max-h-full overflow-hidden rounded-md border py-2", children: /* @__PURE__ */ U(
572
+ Vt,
573
+ {
574
+ height: "100%",
575
+ defaultLanguage: r,
576
+ language: r,
577
+ value: s,
578
+ onChange: (M) => p(M || ""),
579
+ theme: "vs-light",
580
+ options: {
581
+ minimap: { enabled: !1 },
582
+ fontSize: 12,
583
+ lineNumbers: "off",
584
+ roundedSelection: !1,
585
+ scrollBeyondLastLine: !1,
586
+ automaticLayout: !0,
587
+ tabSize: 2,
588
+ insertSpaces: !0,
589
+ wordWrap: "on",
590
+ bracketPairColorization: { enabled: !0 },
591
+ suggest: {
592
+ showKeywords: !1,
593
+ showSnippets: !1
594
+ }
595
+ }
596
+ }
597
+ ) }),
598
+ /* @__PURE__ */ k("div", { className: "flex justify-end gap-2", children: [
599
+ /* @__PURE__ */ k(le, { type: "button", variant: "outline", onClick: () => {
600
+ t(s), u(!0), setTimeout(() => {
601
+ u(!1);
602
+ }, 2e3);
603
+ }, children: [
604
+ i ? /* @__PURE__ */ U(Pe, { className: "text-green-500" }) : /* @__PURE__ */ U(Ce, {}),
605
+ " ",
606
+ i ? "Copied" : "Copy"
607
+ ] }),
608
+ /* @__PURE__ */ k(le, { type: "button", onClick: () => {
609
+ n(s);
610
+ }, children: [
611
+ /* @__PURE__ */ U(Ee, {}),
612
+ " ",
613
+ o
614
+ ] })
615
+ ] })
616
+ ] });
617
+ }
618
+ export {
619
+ Ft as default
620
+ };
@@ -1,5 +1,5 @@
1
1
  import { jsx as o, jsxs as d } from "react/jsx-runtime";
2
- import { u as C, a as k, b as v, c as g } from "./index-lrl587-2.js";
2
+ import { u as C, a as k, b as v, c as g } from "./index-DHTitEQZ.js";
3
3
  import "lodash-es";
4
4
  import "clsx";
5
5
  import "tailwind-merge";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-H7tjcODf.cjs");require("lodash-es");require("clsx");require("tailwind-merge");require("tree-model");const i=require("react");require("jotai");require("@chaibuilder/runtime");require("sonner");const q=require("react-i18next"),r=require("./tooltip-C2BCZ8Al.cjs"),g=require("@react-hookz/web"),m=n=>{const s=document.createElement("div");return s.innerHTML=n,s.innerHTML};function j(){const{t:n}=q.useTranslation(),[s,h]=i.useState(!1),[a,p]=i.useState(""),[t,d]=c.useCodeEditor(),[u]=c.useSelectedBlockIds(),b=c.useUpdateBlocksProps(),f=c.useUpdateBlocksPropsRealtime(),C=g.useThrottledCallback(o=>{const l=m(o);f([t.blockId],{[t.blockProp]:l})},[],300),x=i.useCallback(()=>{if(s){const o=m(a);b([t.blockId],{[t.blockProp]:o})}},[s,a]);i.useEffect(()=>{u.includes(t==null?void 0:t.blockId)||(x(),d(null))},[u]);const k=()=>{x(),d(null)};return e.jsx(r.Dialog,{open:!0,onOpenChange:k,children:e.jsxs(r.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[e.jsx(r.DialogHeader,{className:"shrink-0 border-b border-gray-700 pb-3",children:e.jsx(r.DialogTitle,{className:"flex items-center justify-between text-black",children:e.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:n("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:n("Scripts will be only executed in preview and live mode.")})]})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Textarea,{className:"h-full w-full resize-none font-mono text-xs",value:a||t.initialCode,onChange:o=>{const l=o.target.value;h(!0),p(l),C(l)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-ENH8SVib.cjs");require("lodash-es");require("clsx");require("tailwind-merge");require("tree-model");const i=require("react");require("jotai");require("@chaibuilder/runtime");require("sonner");const q=require("react-i18next"),r=require("./tooltip-C2BCZ8Al.cjs"),g=require("@react-hookz/web"),m=n=>{const s=document.createElement("div");return s.innerHTML=n,s.innerHTML};function j(){const{t:n}=q.useTranslation(),[s,h]=i.useState(!1),[a,p]=i.useState(""),[t,d]=c.useCodeEditor(),[u]=c.useSelectedBlockIds(),b=c.useUpdateBlocksProps(),f=c.useUpdateBlocksPropsRealtime(),C=g.useThrottledCallback(o=>{const l=m(o);f([t.blockId],{[t.blockProp]:l})},[],300),x=i.useCallback(()=>{if(s){const o=m(a);b([t.blockId],{[t.blockProp]:o})}},[s,a]);i.useEffect(()=>{u.includes(t==null?void 0:t.blockId)||(x(),d(null))},[u]);const k=()=>{x(),d(null)};return e.jsx(r.Dialog,{open:!0,onOpenChange:k,children:e.jsxs(r.DialogContent,{className:"flex max-h-[400px] min-h-[200px] max-w-4xl flex-col border-gray-700 text-black",children:[e.jsx(r.DialogHeader,{className:"shrink-0 border-b border-gray-700 pb-3",children:e.jsx(r.DialogTitle,{className:"flex items-center justify-between text-black",children:e.jsxs("div",{className:"space-x-3 text-sm font-semibold",children:[e.jsx("span",{children:n("HTML Code Editor |")}),e.jsx("span",{className:"text-xs text-gray-400",children:n("Scripts will be only executed in preview and live mode.")})]})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Textarea,{className:"h-full w-full resize-none font-mono text-xs",value:a||t.initialCode,onChange:o=>{const l=o.target.value;h(!0),p(l),C(l)},rows:10,placeholder:"Enter your code here..."})})]})})}exports.default=j;