easy_ml 0.2.0.pre.rc23 → 0.2.0.pre.rc24
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.
- checksums.yaml +4 -4
- data/app/controllers/easy_ml/application_controller.rb +1 -2
- data/app/frontend/pages/DatasourcesPage.tsx +5 -1
- data/app/views/layouts/easy_ml/application.html.erb +2 -2
- data/lib/easy_ml/engine.rb +17 -5
- data/lib/easy_ml/version.rb +1 -1
- data/public/easy_ml/assets/.vite/manifest.json +2 -2
- data/public/easy_ml/assets/assets/Application-Cu7lNJmG.css +1 -0
- data/public/easy_ml/assets/assets/entrypoints/{Application.tsx-GDgZ4vVt.js → Application.tsx-BRRjHz4-.js} +2 -1
- data/public/easy_ml/assets/assets/entrypoints/Application.tsx-BRRjHz4-.js.map +1 -0
- metadata +7 -6
- data/public/easy_ml/assets/assets/Application-tsa3Id3n.css +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aafd321534a466c3949661c88defb35c09e2f50e64ecbe5d2e98dc22c1b2eda
|
4
|
+
data.tar.gz: be664f72d3076272aca2341152efafc04b0d50251a975491e7095179bbf64599
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a7dc15ffaa8e9b6bbe09e56ac4024db97803b9af3e67b92088bb8aad1da7c17dec23d10912b27ee0ae0e228c858421cfabecfc46c733db18b0a295cec9842c8
|
7
|
+
data.tar.gz: c1bf5ab4fc4e12a5b2efd04b70ec5598e99eff69e2f5a2a3c758193cccc26dbb2b37d9e62da0f51f9fa3cf86c559da7e24decd750c8a7f162ea902bf07855406
|
@@ -44,8 +44,7 @@ module EasyML
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def easy_ml_root
|
47
|
-
|
48
|
-
URI.join("#{request.scheme}://#{request.host_with_port}", path).to_s
|
47
|
+
Rails.application.routes.routes.find { |r| r.app.app == EasyML::Engine }&.path&.spec&.to_s
|
49
48
|
end
|
50
49
|
|
51
50
|
inertia_share do
|
@@ -11,6 +11,7 @@ const ITEMS_PER_PAGE = 6;
|
|
11
11
|
|
12
12
|
export default function DatasourcesPage({ datasources }: { datasources: Datasource[] }) {
|
13
13
|
const { rootPath } = usePage().props;
|
14
|
+
console.log(`rootPath: ${rootPath}`);
|
14
15
|
const [searchQuery, setSearchQuery] = useState('');
|
15
16
|
const [currentPage, setCurrentPage] = useState(1);
|
16
17
|
const [expandedErrors, setExpandedErrors] = useState<number[]>([]);
|
@@ -47,10 +48,13 @@ export default function DatasourcesPage({ datasources }: { datasources: Datasour
|
|
47
48
|
router.post(`${rootPath}/datasources/${id}/sync`, {}, {
|
48
49
|
preserveScroll: true, // Keeps the scroll position
|
49
50
|
preserveState: true, // Keeps the form state
|
50
|
-
onSuccess: () => {
|
51
|
+
onSuccess: (e) => {
|
52
|
+
debugger;
|
53
|
+
console.log("SUCCESS")
|
51
54
|
// The page will automatically refresh with new data
|
52
55
|
},
|
53
56
|
onError: () => {
|
57
|
+
debugger;
|
54
58
|
// Handle error case if needed
|
55
59
|
console.error('Failed to sync datasource');
|
56
60
|
}
|
@@ -5,13 +5,13 @@
|
|
5
5
|
<%= csrf_meta_tags %>
|
6
6
|
<%= csp_meta_tag %>
|
7
7
|
|
8
|
-
<% if ENV["EASY_ML_DEV"]
|
8
|
+
<% if ENV["EASY_ML_DEV"] %>
|
9
9
|
<%= vite_client_tag %>
|
10
10
|
<%= vite_react_refresh_tag %>
|
11
11
|
<%= vite_typescript_tag 'Application.tsx' %>
|
12
12
|
<% else %>
|
13
13
|
<%= prod_script_tags %>
|
14
|
-
<% end%>
|
14
|
+
<% end %>
|
15
15
|
</head>
|
16
16
|
<body>
|
17
17
|
<%= yield %>
|
data/lib/easy_ml/engine.rb
CHANGED
@@ -85,11 +85,23 @@ module EasyML
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
if ENV["EASY_ML_DEMO_APP"]
|
89
|
+
require "vite_ruby"
|
90
|
+
require "vite_rails"
|
91
|
+
|
92
|
+
def vite_ruby
|
93
|
+
@vite_ruby ||= ViteRuby.new(root: root)
|
94
|
+
end
|
95
|
+
|
96
|
+
puts "Running dev proxy"
|
97
|
+
config.app_middleware.insert_before 0, ViteRuby::DevServerProxy, ssl_verify_none: true, vite_ruby: vite_ruby
|
98
|
+
else
|
99
|
+
config.app_middleware.use(
|
100
|
+
Rack::Static,
|
101
|
+
urls: ["/easy_ml/assets"],
|
102
|
+
root: EasyML::Engine.root.join("public"),
|
103
|
+
)
|
104
|
+
end
|
93
105
|
|
94
106
|
def list_routes
|
95
107
|
EasyML::Engine.routes.routes.map { |r| "#{r.name} #{r.path.spec}" }
|
data/lib/easy_ml/version.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"entrypoints/Application.tsx": {
|
3
|
-
"file": "assets/entrypoints/Application.tsx-
|
3
|
+
"file": "assets/entrypoints/Application.tsx-BRRjHz4-.js",
|
4
4
|
"name": "entrypoints/Application.tsx",
|
5
5
|
"src": "entrypoints/Application.tsx",
|
6
6
|
"isEntry": true,
|
7
7
|
"css": [
|
8
|
-
"assets/Application-
|
8
|
+
"assets/Application-Cu7lNJmG.css"
|
9
9
|
]
|
10
10
|
}
|
11
11
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 0 0% 3.9%;--card: 0 0% 100%;--card-foreground: 0 0% 3.9%;--popover: 0 0% 100%;--popover-foreground: 0 0% 3.9%;--primary: 0 0% 9%;--primary-foreground: 0 0% 98%;--secondary: 0 0% 96.1%;--secondary-foreground: 0 0% 9%;--muted: 0 0% 96.1%;--muted-foreground: 0 0% 45.1%;--accent: 0 0% 96.1%;--accent-foreground: 0 0% 9%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 0 0% 89.8%;--input: 0 0% 89.8%;--ring: 0 0% 3.9%;--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%;--radius: .5rem}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.left-0{left:0}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-4{top:1rem}.z-0{z-index:0}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.col-span-3{grid-column:span 3 / span 3}.col-span-4{grid-column:span 4 / span 4}.m-1{margin:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-16{margin-left:4rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-64{margin-left:16rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-4{margin-right:1rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-\[1px\]{height:1px}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[calc\(90vh-8rem\)\]{height:calc(90vh - 8rem)}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-60{max-height:15rem}.max-h-96{max-height:24rem}.max-h-\[400px\]{max-height:400px}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.min-h-0{min-height:0px}.min-h-\[calc\(100vh-4rem\)\]{min-height:calc(100vh - 4rem)}.min-h-screen{min-height:100vh}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-96{width:24rem}.w-\[1px\]{width:1px}.w-full{width:100%}.min-w-0,.min-w-\[0px\]{min-width:0px}.min-w-\[120px\]{min-width:120px}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-6xl{max-width:72rem}.max-w-\[70\%\]{max-width:70%}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-2{--tw-translate-y: -.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.-space-x-px>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(-1px * var(--tw-space-x-reverse));margin-left:calc(-1px * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-x>:not([hidden])~:not([hidden]){--tw-divide-x-reverse: 0;border-right-width:calc(1px * var(--tw-divide-x-reverse));border-left-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(229 231 235 / var(--tw-divide-opacity, 1))}.divide-gray-300>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(209 213 219 / var(--tw-divide-opacity, 1))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-0{border-left-width:0px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-primary{background-color:hsl(var(--primary))}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-50{--tw-bg-opacity: 1;background-color:rgb(250 245 255 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-opacity-50{--tw-bg-opacity: .5}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-600{--tw-gradient-from: #2563eb var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-indigo-600{--tw-gradient-to: #4f46e5 var(--tw-gradient-to-position)}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-10{padding-right:2.5rem}.pr-2{padding-right:.5rem}.pr-24{padding-right:6rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-wider{letter-spacing:.05em}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-gray-100{--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}.text-orange-700{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-red-900{--tw-text-opacity: 1;color:rgb(127 29 29 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-black{--tw-ring-opacity: 1;--tw-ring-color: rgb(0 0 0 / var(--tw-ring-opacity, 1))}.ring-opacity-5{--tw-ring-opacity: .05}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-150{animation-duration:.15s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-feature-settings:"rlig" 1,"calt" 1}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-900:hover{--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.hover\:bg-green-900:hover{--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-900:hover{--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-yellow-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:bg-opacity-10:hover{--tw-bg-opacity: .1}.hover\:from-blue-700:hover{--tw-gradient-from: #1d4ed8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(29 78 216 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-indigo-700:hover{--tw-gradient-to: #4338ca var(--tw-gradient-to-position)}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-blue-700:hover{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-gray-500:hover{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.hover\:text-gray-600:hover{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.hover\:text-purple-600:hover{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-red-800:hover{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-indigo-500:focus{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-indigo-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity, 1))}.focus\:ring-red-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-gray-100:disabled{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.disabled\:bg-gray-300:disabled{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.disabled\:text-gray-400:disabled{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:flex-1{flex:1 1 0%}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}
|
@@ -430,7 +430,7 @@ module Features
|
|
430
430
|
name: "Did Convert",
|
431
431
|
description: "Boolean true/false..."
|
432
432
|
end
|
433
|
-
end`})})]})})}function _R({options:e,initialFeatures:t=[],onFeaturesChange:n}){const[r,i]=A.useState(t),[l,u]=A.useState(null);console.log(r);const d=e.filter(E=>!r.find(w=>w.name===E.name)),f=E=>{const w=E.map((S,C)=>({...S,feature_position:C}));i(w),n(w)},m=E=>{const w=e.find(S=>S.name===E);if(w){const S={...w,feature_position:r.length};f([...r,S])}},h=E=>{const w=[...r];w.splice(E,1),f(w)},g=E=>{if(E===0)return;const w=[...r];[w[E-1],w[E]]=[w[E],w[E-1]],f(w)},y=E=>{if(E===r.length-1)return;const w=[...r];[w[E],w[E+1]]=[w[E+1],w[E]],f(w)},N=(E,w)=>{u(w)},x=(E,w)=>{if(E.preventDefault(),l===null||l===w)return;const S=[...r],[C]=S.splice(l,1);S.splice(w,0,C),f(S),u(w)},b=()=>{u(null)};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx(ot,{options:d.map(E=>({value:E.name,label:E.name,description:E.description})),value:"",onChange:E=>m(E),placeholder:"Add a transform..."})}),a.jsx(wR,{})]}),a.jsxs("div",{className:"space-y-2",children:[r.map((E,w)=>a.jsxs("div",{draggable:!0,onDragStart:S=>N(S,w),onDragOver:S=>x(S,w),onDragEnd:b,className:`flex items-center gap-3 p-3 bg-white border rounded-lg ${l===w?"border-blue-500 shadow-lg":"border-gray-200"} ${l!==null?"cursor-grabbing":""}`,children:[a.jsx("button",{type:"button",className:"p-1 text-gray-400 hover:text-gray-600 cursor-grab active:cursor-grabbing",children:a.jsx(_T,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium text-gray-900",children:E.name}),a.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${E.feature_type==="calculation"?"bg-blue-100 text-blue-800":E.feature_type==="lookup"?"bg-purple-100 text-purple-800":"bg-green-100 text-green-800"}`,children:"feature"})]}),a.jsx("p",{className:"text-sm text-gray-500 truncate",children:E.description})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>g(w),disabled:w===0,className:"p-1 text-gray-400 hover:text-gray-600 disabled:opacity-50",title:"Move up",children:a.jsx(fT,{className:"w-4 h-4"})}),a.jsx("button",{type:"button",onClick:()=>y(w),disabled:w===r.length-1,className:"p-1 text-gray-400 hover:text-gray-600 disabled:opacity-50",title:"Move down",children:a.jsx(cT,{className:"w-4 h-4"})}),a.jsx("button",{type:"button",onClick:()=>h(w),className:"p-1 text-gray-400 hover:text-red-600",title:"Remove transform",children:a.jsx(Wl,{className:"w-4 h-4"})})]})]},E.name)),r.length===0&&a.jsxs("div",{className:"text-center py-8 bg-gray-50 border-2 border-dashed border-gray-200 rounded-lg",children:[a.jsx(Js,{className:"w-8 h-8 text-gray-400 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Add features to enrich your dataset"})]})]})]})}function SR({isOpen:e,onClose:t,initialDataset:n,onSave:r,constants:i}){const[l,u]=A.useState(n),[d,f]=A.useState("columns"),[m,h]=A.useState(!1),[g,y]=A.useState({targetColumn:l.target}),[N,x]=A.useState(null),[b,E]=A.useState(""),[w,S]=A.useState({view:"all",types:[]}),[C,O]=A.useState(n.needs_refresh||!1),R=A.useCallback(async G=>{await r(G)},[r]),{saving:F,saved:D,error:z}=vR(l,R,2e3),B=G=>{var ge,_e,De;return((ge=G.preprocessing_steps)==null?void 0:ge.training)!=null&&((De=(_e=G.preprocessing_steps)==null?void 0:_e.training)==null?void 0:De.method)!=="none"},H=A.useMemo(()=>l.columns.filter(G=>{const ge=G.name.toLowerCase().includes(b.toLowerCase()),_e=w.types.length===0||w.types.includes(G.datatype),De=(()=>{var me,Y;switch(w.view){case"training":return!G.hidden&&!G.drop_if_null;case"hidden":return G.hidden;case"preprocessed":return B(G);case"nulls":return(((Y=(me=G.statistics)==null?void 0:me.processed)==null?void 0:Y.null_count)||0)>0;default:return!0}})();return ge&&_e&&De}),[l.columns,b,w]),ce=A.useMemo(()=>({total:l.columns.length,filtered:H.length,training:l.columns.filter(G=>!G.hidden&&!G.drop_if_null).length,hidden:l.columns.filter(G=>G.hidden).length,withPreprocessing:l.columns.filter(B).length,withNulls:l.columns.filter(G=>{var ge,_e;return(((_e=(ge=G.statistics)==null?void 0:ge.processed)==null?void 0:_e.null_count)||0)>0}).length}),[l.columns,H]),ue=A.useMemo(()=>Array.from(new Set(l.columns.map(G=>G.datatype))),[l.columns]),we=G=>{x(G)},ne=G=>{const ge=l.columns.map(_e=>({..._e,hidden:_e.name===G?!_e.hidden:_e.hidden}));u({...l,columns:ge}),O(!0)},Z=G=>{const ge=String(G);y({targetColumn:G});const _e=l.columns.map(De=>({...De,is_target:De.name===ge}));u({...l,columns:_e}),O(!0)},de=(G,ge)=>{const _e=l.columns.map(De=>({...De,datatype:De.name===G?ge:De.datatype}));u({...l,columns:_e}),O(!0)},se=(G,ge,_e,De)=>{if(!l.columns.find(pe=>pe.name===G))return;const Y=l.columns.map(pe=>pe.name!==G?pe:{...pe,preprocessing_steps:{training:ge,...De&&_e?{inference:_e}:{}}});u({...l,columns:Y}),O(!0)},Q=G=>{const _e=(l.features||[]).filter(me=>!G.find(Y=>Y.name===me.name)).map(me=>({...me,_destroy:!0})),De=[...G,..._e].map((me,Y)=>({...me,dataset_id:l.id,feature_position:Y}));u(me=>({...me,features:De})),O(!0)},re=async()=>{h(!0);try{await r(l),rt.post(`/easy_ml/datasets/${l.id}/refresh`,{},{onSuccess:()=>{h(!1)},onError:()=>{console.error("Error refreshing dataset"),h(!1)}})}catch(G){console.error("Error refreshing dataset:",G),h(!1)}};if(!e)return null;const ee=N?l.columns.find(G=>G.name===N):null;return a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white rounded-lg w-full max-w-6xl max-h-[90vh] overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"flex justify-between items-center p-4 border-b shrink-0",children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Column Configuration"}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"min-w-[0px]",children:a.jsx(xO,{saving:F,saved:D,error:z})}),a.jsxs("div",{className:"relative",children:[a.jsx(Zh,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",placeholder:"Search columns...",value:b,onChange:G=>E(G.target.value),className:"pl-9 pr-4 py-2 w-64 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"})]}),a.jsx("button",{onClick:t,className:"text-gray-500 hover:text-gray-700",children:a.jsx(Wl,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"flex border-b shrink-0",children:[a.jsx("button",{onClick:()=>f("columns"),className:`px-4 py-2 text-sm font-medium border-b-2 ${d==="columns"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ui,{className:"w-4 h-4"}),"Column Configuration"]})}),a.jsx("button",{onClick:()=>f("features"),className:`px-4 py-2 text-sm font-medium border-b-2 ${d==="features"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(TT,{className:"w-4 h-4"}),"Features",a.jsx("span",{className:"px-1.5 py-0.5 text-xs font-medium bg-blue-100 text-blue-600 rounded-full",children:i.feature_options.length})]})}),C&&a.jsx("div",{className:"ml-auto px-4 flex items-center",children:a.jsxs("button",{onClick:re,disabled:m,className:"group relative inline-flex items-center gap-2 px-6 py-2.5 bg-gradient-to-r from-blue-600 to-indigo-600 text-white text-sm font-medium rounded-md hover:from-blue-700 hover:to-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-all duration-200 shadow-md hover:shadow-lg",children:[a.jsx("div",{className:"absolute inset-0 bg-white/10 rounded-md opacity-0 group-hover:opacity-100 transition-opacity duration-200"}),m?a.jsxs(a.Fragment,{children:[a.jsx(Li,{className:"w-4 h-4 animate-spin"}),"Applying Preprocessing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(kT,{className:"w-4 h-4"}),"Apply Preprocessing"]})]})})]}),d==="columns"?a.jsxs(tr.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-7 flex-1 min-h-0",children:[a.jsxs("div",{className:"col-span-3 border-r overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"p-4 border-b shrink-0",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Target Column"}),a.jsx(ot,{options:l.columns.map(G=>({value:G.name,label:G.name})),value:g.targetColumn||"",onChange:G=>G&&Z(String(G))})]}),a.jsx("div",{className:"shrink-0",children:a.jsx(yO,{types:ue,activeFilters:w,onFilterChange:S,columnStats:ce,columns:l.columns,colHasPreprocessingSteps:B})}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4 min-h-0",children:a.jsx(gO,{columns:H,selectedColumn:N,onColumnSelect:we,onToggleHidden:ne})})]}),a.jsx("div",{className:"col-span-4 overflow-y-auto p-4",children:ee?a.jsx(hO,{column:ee,dataset:l,setColumnType:de,setDataset:u,constants:i,onUpdate:(G,ge,_e)=>se(ee.name,G,ge,_e)}):a.jsx("div",{className:"h-full flex items-center justify-center text-gray-500",children:"Select a column to configure preprocessing"})})]}),a.jsxs("div",{className:"border-t p-4 flex justify-between items-center shrink-0",children:[a.jsxs("div",{className:"text-sm text-gray-600",children:[l.columns.filter(G=>!G.hidden).length," columns selected for training"]}),a.jsx("div",{className:"flex gap-3",children:a.jsx("button",{onClick:t,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700",children:"Close"})})]})]}):a.jsx("div",{className:"p-6 h-[calc(90vh-8rem)] overflow-y-auto",children:a.jsx(_R,{options:i.feature_options,initialFeatures:l.features,onFeaturesChange:Q})})]})})}function jR({dataset:e,constants:t}){const[n,r]=A.useState(!1),[i,l]=A.useState(e),{rootPath:u}=_r().props,d=A.useCallback(f=>{var y;const m=Object.entries(f).reduce((N,[x,b])=>(x!=="columns"&&x!=="features"&&!Ot.isEqual(i[x],b)&&(N[x]=b),N),{}),h=f.columns.reduce((N,x)=>{const b=i.columns.find(E=>E.id===x.id);if(!b||!Ot.isEqual(b,x)){const E=Object.entries(x).reduce((w,[S,C])=>((!b||!Ot.isEqual(b[S],C))&&(w[S]=C),w),{});Object.keys(E).length>0&&(N[x.id]={...E,id:x.id})}return N},{}),g=(y=f.features)==null?void 0:y.map((N,x)=>({id:N.id,name:N.name,feature_class:N.feature_class,feature_position:x,_destroy:N._destroy}));(Object.keys(m).length>0||Object.keys(h).length>0||!Ot.isEqual(i.features,f.features))&&rt.patch(`${u}/datasets/${e.id}`,{dataset:{...m,columns_attributes:h,features_attributes:g}},{preserveState:!0,preserveScroll:!0}),l(f)},[i,e.id,u]);return a.jsxs("div",{className:"p-8 space-y-6",children:[a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{onClick:()=>r(!0),className:"flex items-center gap-2 px-4 py-2 bg-white border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50",children:[a.jsx(Bl,{className:"w-4 h-4"}),"Configure Columns"]})}),a.jsx(OT,{dataset:i}),a.jsx(SR,{isOpen:n,onClose:()=>r(!1),initialDataset:i,constants:t,onSave:d})]})}const NR=Object.freeze(Object.defineProperty({__proto__:null,default:jR},Symbol.toStringTag,{value:"Module"}));function Pd({icon:e,title:t,description:n,actionLabel:r,onAction:i}){return a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:a.jsx(e,{className:"w-8 h-8 text-gray-400"})}),a.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:t}),a.jsx("p",{className:"text-gray-500 mb-6 max-w-sm mx-auto",children:n}),a.jsx("button",{onClick:i,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:r})]})}function tg({value:e,onChange:t,placeholder:n="Search..."}){return a.jsxs("div",{className:"relative",children:[a.jsx(Zh,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",value:e,onChange:r=>t(r.target.value),placeholder:n,className:"pl-9 pr-4 py-2 w-64 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"})]})}function ng({currentPage:e,totalPages:t,onPageChange:n}){return a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-200",children:[a.jsxs("div",{className:"flex-1 flex justify-between sm:hidden",children:[a.jsx("button",{onClick:()=>n(e-1),disabled:e===1,className:"relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400",children:"Previous"}),a.jsx("button",{onClick:()=>n(e+1),disabled:e===t,className:"relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400",children:"Next"})]}),a.jsxs("div",{className:"hidden sm:flex-1 sm:flex sm:items-center sm:justify-between",children:[a.jsx("div",{children:a.jsxs("p",{className:"text-sm text-gray-700",children:["Page ",a.jsx("span",{className:"font-medium",children:e})," of"," ",a.jsx("span",{className:"font-medium",children:t})]})}),a.jsx("div",{children:a.jsxs("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px","aria-label":"Pagination",children:[a.jsxs("button",{onClick:()=>n(e-1),disabled:e===1,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400",children:[a.jsx("span",{className:"sr-only",children:"Previous"}),a.jsx(Ad,{className:"h-5 w-5"})]}),Array.from({length:t},(r,i)=>i+1).map(r=>a.jsx("button",{onClick:()=>n(r),className:`relative inline-flex items-center px-4 py-2 border text-sm font-medium ${r===e?"z-10 bg-blue-50 border-blue-500 text-blue-600":"bg-white border-gray-300 text-gray-500 hover:bg-gray-50"}`,children:r},r)),a.jsxs("button",{onClick:()=>n(e+1),disabled:e===t,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400",children:[a.jsx("span",{className:"sr-only",children:"Next"}),a.jsx(qo,{className:"h-5 w-5"})]})]})})]})]})}const qp=6,Gp={analyzing:{bg:"bg-blue-100",text:"text-blue-800",icon:a.jsx(Li,{className:"w-4 h-4 animate-spin"})},ready:{bg:"bg-green-100",text:"text-green-800",icon:null},failed:{bg:"bg-red-100",text:"text-red-800",icon:a.jsx(on,{className:"w-4 h-4"})}};function CR({datasets:e,constants:t}){console.log(e);const{rootPath:n}=_r().props,[r,i]=A.useState(""),[l,u]=A.useState(1),[d,f]=A.useState([]),m=A.useMemo(()=>e.filter(x=>x.name.toLowerCase().includes(r.toLowerCase())||x.description.toLowerCase().includes(r.toLowerCase())),[e,r]),h=Math.ceil(m.length/qp),g=m.slice((l-1)*qp,l*qp),y=x=>{confirm("Are you sure you want to delete this dataset?")&&rt.delete(`${n}/datasets/${x}`)};A.useEffect(()=>{let x;return e.some(E=>E.workflow_status==="analyzing")&&(x=window.setInterval(()=>{rt.get(window.location.href,{},{preserveScroll:!0,preserveState:!0,only:["datasets"]})},2e3)),()=>{x&&window.clearInterval(x)}},[e]);const N=x=>{f(b=>b.includes(x)?b.filter(E=>E!==x):[...b,x])};return e.length===0?a.jsx("div",{className:"p-8",children:a.jsx(Pd,{icon:Ln,title:"Create your first dataset",description:"Create a dataset to start training your machine learning models",actionLabel:"Create Dataset",onAction:()=>{rt.visit(`${n}/datasets/new`)}})}):a.jsx("div",{className:"p-8",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Datasets"}),a.jsx(tg,{value:r,onChange:i,placeholder:"Search datasets..."})]}),a.jsxs(yr,{href:`${n}/datasets/new`,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4"}),"New Dataset"]})]}),g.length===0?a.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow",children:[a.jsx(Ln,{className:"mx-auto h-12 w-12 text-gray-400"}),a.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900",children:"No datasets found"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"No datasets match your search criteria. Try adjusting your search or create a new dataset."}),a.jsx("div",{className:"mt-6",children:a.jsxs(yr,{href:`${n}/datasets/new`,className:"inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4 mr-2"}),"New Dataset"]})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:g.map(x=>a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-blue-600 mt-1"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:x.name}),a.jsxs("div",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${Gp[x.workflow_status].bg} ${Gp[x.workflow_status].text}`,children:[Gp[x.workflow_status].icon,a.jsx("span",{children:x.workflow_status.charAt(0).toUpperCase()+x.workflow_status.slice(1)})]})]}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:x.description})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(yr,{href:`${n}/datasets/${x.id}`,className:`transition-colors ${x.workflow_status==="analyzing"?"text-gray-300 cursor-not-allowed pointer-events-none":"text-gray-400 hover:text-blue-600"}`,title:x.workflow_status==="analyzing"?"Dataset is being analyzed":"View details",children:a.jsx(Jh,{className:"w-5 h-5"})}),a.jsx("button",{className:"text-gray-400 hover:text-red-600 transition-colors",title:"Delete dataset",onClick:()=>y(x.id),children:a.jsx(aa,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Columns"}),a.jsxs("p",{className:"text-sm font-medium text-gray-900",children:[x.columns.length," columns"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Rows"}),a.jsx("p",{className:"text-sm font-medium text-gray-900",children:x.num_rows.toLocaleString()})]})]}),a.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[x.columns.slice(0,3).map(b=>a.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:b.name},b.name)),x.columns.length>3&&a.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800",children:["+",x.columns.length-3," more"]})]})}),x.workflow_status==="failed"&&x.stacktrace&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100",children:[a.jsxs("button",{onClick:()=>N(x.id),className:"flex items-center gap-2 text-sm text-red-600 hover:text-red-700",children:[a.jsx(on,{className:"w-4 h-4"}),a.jsx("span",{children:"View Error Details"}),d.includes(x.id)?a.jsx(Ul,{className:"w-4 h-4"}):a.jsx(oa,{className:"w-4 h-4"})]}),d.includes(x.id)&&a.jsx("div",{className:"mt-2 p-3 bg-red-50 rounded-md",children:a.jsx("pre",{className:"text-xs text-red-700 whitespace-pre-wrap font-mono",children:x.stacktrace})})]})]},x.id))}),h>1&&a.jsx(ng,{currentPage:l,totalPages:h,onPageChange:u})]})]})})}const ER=Object.freeze(Object.defineProperty({__proto__:null,default:CR},Symbol.toStringTag,{value:"Module"})),Yb=()=>{const e=tr.createContext(null);return[()=>{const t=tr.useContext(e);if(t===null)throw new Error("useContext must be inside a Provider with a value");return t},e.Provider]},zm=e=>{const t=structuredClone(e??{});for(const n in t)Ot.isPlainObject(t[n])?t[n]=zm(t[n]):Array.isArray(t[n])?t[n]=t[n].map(r=>zm(r)):t[n]!==void 0&&t[n]!==null||(t[n]="");return t},Jb=(e,t)=>{Object.entries(e).forEach(([n,r])=>{Ot.isPlainObject(r)?(iv(e,n,`${n}${t}`),Jb(r,t)):Array.isArray(r)&&iv(e,n,`${n}${t}`)})},iv=(e,t,n)=>{t!==n&&(e[n]=e[t],delete e[t])},Zb=(e,t)=>{var r;const n=t.replace(/\[\]$/,"");if(n.includes("[]")){const i=n.indexOf("[]"),l=n.slice(0,i),u=n.slice(i+2),d=Ot.get(e,l);if(Array.isArray(d))for(let f=0;f<d.length;f++)Zb(e,`${l}[${f}]${u}`)}if(n.charAt(n.length-1)==="]"){const i=n.match(/(?<index>\d*)\]$/),l=Ot.get(e,n.slice(0,n.lastIndexOf("[")));Array.isArray(l)&&((r=i==null?void 0:i.groups)==null?void 0:r.index)!==void 0&&l.splice(Number(i.groups.index),1)}else Ot.unset(e,n)},ov=e=>Array.isArray(e)?e:[e],[kR,NM]=Yb();function Td(e,t){const n=A.useCallback(()=>{let Z=null,de=e;return typeof e=="string"&&(Z=e,de=t),[Z,zm(de)]},[e,t]),[r,i]=n(),[l,u]=A.useState(i||{}),[d,f]=r?Vx(i,`${r}:data`):A.useState(i),m=A.useMemo(()=>{const Z=d?Object.keys(d):[];if(Z.length===1)return Z[0]},[d]),[h,g]=r?Vx({},`${r}:errors`):A.useState({}),[y,N]=A.useState(!1),[x,b]=A.useState(!1),[E,w]=A.useState(),[S,C]=A.useState(!1),[O,R]=A.useState(!1),F=A.useRef(null),D=A.useRef();let z=A.useRef(Z=>Z);const B=A.useRef();A.useEffect(()=>(B.current=!0,()=>{B.current=!1}),[]);let H=A.useRef(),ce=A.useRef();A.useEffect(()=>{H.current&&ce.current&&H.current(...ce.current)},[d]);let ue=!1;try{ue=kR().railsAttributes}catch{}const we=(Z,de,se={})=>{const Q={...se,onCancelToken:ee=>{if(F.current=ee,se.onCancelToken)return se.onCancelToken(ee)},onBefore:ee=>{if(C(!1),R(!1),clearTimeout(D.current),se.onBefore)return se.onBefore(ee)},onStart:ee=>{if(b(!0),se.onStart)return se.onStart(ee)},onProgress:ee=>{if(w(ee),se.onProgress)return se.onProgress(ee)},onSuccess:ee=>{if(B.current&&(b(!1),w(null),g({}),N(!1),C(!0),R(!0),D.current=setTimeout(()=>{B.current&&R(!1)},2e3)),se.onSuccess)return se.onSuccess(ee)},onError:ee=>{if(B.current&&(b(!1),w(null),g((G=>{if(!G||!m)return G;const ge={};return Object.keys(G).forEach(_e=>{ge[`${m}.${_e}`]=G[_e]}),ge})(ee)),N(!0)),se.onError)return se.onError(ee)},onCancel:()=>{if(B.current&&(b(!1),w(null)),se.onCancel)return se.onCancel()},onFinish:ee=>{if(B.current&&(b(!1),w(null)),F.current=null,se.onFinish)return se.onFinish(ee)}};let re=z.current(structuredClone(d));ue&&(re=((ee,G="_attributes")=>{const ge=structuredClone(ee);return Object.values(ge).forEach(_e=>{Ot.isPlainObject(_e)&&Jb(_e,G)}),ge})(re)),Z==="delete"?rt.delete(de,{...Q,data:re}):rt[Z](de,re,Q)},ne=Z=>{if(!Z)return void g({});const de=ov(Z);g(se=>{const Q=Object.keys(se).reduce((re,ee)=>({...re,...de.length>0&&!de.includes(String(ee))?{[ee]:se[ee]}:{}}),{});return N(Object.keys(Q).length>0),Q})};return{data:d,isDirty:!Ot.isEqual(d,l),errors:h,hasErrors:y,processing:x,progress:E,wasSuccessful:S,recentlySuccessful:O,transform:Z=>{z.current=Z},onChange:Z=>{H.current=Z},setData:(Z,de)=>{if(typeof Z=="string")return f(se=>{const Q=structuredClone(se);return H.current&&(ce.current=[Z,de,Ot.get(se,Z)]),Ot.set(Q,Z,de),Q});Z instanceof Function?f(se=>{const Q=Z(structuredClone(se));return H.current&&(ce.current=[void 0,Q,se]),Q}):(H.current&&(ce.current=[void 0,d,Z]),f(Z))},getData:Z=>Ot.get(d,Z),unsetData:Z=>{f(de=>{const se=structuredClone(de);return H.current&&(ce.current=[Z,Ot.get(de,Z),void 0]),Zb(se,Z),se})},setDefaults:(Z,de)=>{u(Z!==void 0?se=>({...se,...typeof Z=="string"?{[Z]:de}:Z}):()=>d)},reset:Z=>{if(!Z)return H.current&&(ce.current=[void 0,l,d]),f(l),void g({});const de=ov(Z),se=structuredClone(d);de.forEach(Q=>{Ot.set(se,Q,Ot.get(l,Q))}),ne(Z),H.current&&(ce.current=[void 0,se,d]),f(se)},setError:(Z,de)=>{g(se=>{const Q={...se,...typeof Z=="string"?{[Z]:de}:Z};return N(Object.keys(Q).length>0),Q})},getError:Z=>Ot.get(h,Z),clearErrors:ne,submit:we,get:(Z,de)=>{we("get",Z,de)},post:(Z,de)=>{we("post",Z,de)},put:(Z,de)=>{we("put",Z,de)},patch:(Z,de)=>{we("patch",Z,de)},delete:(Z,de)=>{we("delete",Z,de)},cancel:()=>{F.current&&F.current.cancel()}}}const[AR,CM]=(()=>{const e=tr.createContext(null);return[()=>{const t=tr.useContext(e);if(t===null)throw new Error("useContext must be inside a Provider with a value");return t},e.Provider]})();Yb();const PR=tr.forwardRef(({children:e,type:t="submit",disabled:n=!1,component:r="button",requiredFields:i,...l},u)=>{const{data:d,getData:f,processing:m}=AR(),h=A.useCallback(()=>!(!i||i.length===0)&&i.some(g=>{return typeof(y=f(g))=="string"?y==="":typeof y=="number"?y!==0&&!y:Ot.isEmpty(y);var y}),[d]);return tr.createElement(r,{children:e,type:t,disabled:n||m||i&&h(),ref:u,...l})});tr.memo(PR);function TR({datasource:e,constants:t}){var m,h,g,y;const{rootPath:n}=_r().props,r=!!e,{data:i,setData:l,processing:u,errors:d}=Td({datasource:{name:(e==null?void 0:e.name)??"",datasource_type:(e==null?void 0:e.datasource_type)??"s3",s3_bucket:(e==null?void 0:e.s3_bucket)??"",s3_prefix:(e==null?void 0:e.s3_prefix)??"",s3_region:(e==null?void 0:e.s3_region)??"us-east-1"}}),f=N=>{N.preventDefault(),r?rt.patch(`${n}/datasources/${e.id}`,i):rt.post(`${n}/datasources`,i)};return a.jsx("div",{className:"max-w-2xl mx-auto py-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-6",children:r?"Edit Datasource":"New Datasource"}),a.jsxs("form",{onSubmit:f,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700",children:"Name"}),a.jsx("input",{type:"text",id:"name",value:i.datasource.name,onChange:N=>l("datasource.name",N.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border",required:!0}),((m=d.datasource)==null?void 0:m.name)&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:d.datasource.name})]}),!r&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Type"}),a.jsx(ot,{options:t.DATASOURCE_TYPES,value:i.datasource.datasource_type,onChange:N=>l("datasource.datasource_type",N),placeholder:"Select datasource type"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"s3_bucket",className:"block text-sm font-medium text-gray-700",children:"S3 Bucket"}),a.jsx("input",{type:"text",id:"s3_bucket",value:i.datasource.s3_bucket,onChange:N=>l("datasource.s3_bucket",N.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border",required:!0}),((h=d.datasource)==null?void 0:h.s3_bucket)&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:d.datasource.s3_bucket})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"s3_prefix",className:"block text-sm font-medium text-gray-700",children:"S3 Prefix"}),a.jsx("input",{type:"text",id:"s3_prefix",value:i.datasource.s3_prefix,onChange:N=>l("datasource.s3_prefix",N.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border",placeholder:"data/raw/"}),((g=d.datasource)==null?void 0:g.s3_prefix)&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:d.datasource.s3_prefix})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"S3 Region"}),a.jsx(ot,{options:t.s3.S3_REGIONS,value:i.datasource.s3_region,onChange:N=>l("datasource.s3_region",N),placeholder:"Select s3 region"}),((y=d.datasource)==null?void 0:y.s3_region)&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:d.datasource.s3_region})]}),a.jsxs("div",{className:"flex justify-end gap-3",children:[a.jsx("button",{type:"button",onClick:()=>rt.visit(`${n}/datasources`),className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:u,className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:u?"Saving...":r?"Save Changes":"Create Datasource"})]})]})]})})}const OR=Object.freeze(Object.defineProperty({__proto__:null,default:TR},Symbol.toStringTag,{value:"Module"})),Kp=6;function RR({datasources:e}){const{rootPath:t}=_r().props,[n,r]=A.useState(""),[i,l]=A.useState(1),[u,d]=A.useState([]),f=A.useMemo(()=>e.filter(b=>b.name.toLowerCase().includes(n.toLowerCase())||b.s3_bucket.toLowerCase().includes(n.toLowerCase())),[n,e]),m=Math.ceil(f.length/Kp),h=f.slice((i-1)*Kp,i*Kp),g=b=>{confirm("Are you sure you want to delete this datasource? This action cannot be undone.")&&rt.delete(`${t}/datasources/${b}`)},y=b=>{d(E=>E.includes(b)?E.filter(w=>w!==b):[...E,b])},N=async b=>{try{rt.post(`${t}/datasources/${b}/sync`,{},{preserveScroll:!0,preserveState:!0,onSuccess:()=>{},onError:()=>{console.error("Failed to sync datasource")}})}catch(E){console.error("Failed to sync datasource:",E)}},x=b=>{if(b==="Not Synced")return b;const E=new Date(b);return isNaN(E.getTime())?b:E.toLocaleString()};return A.useEffect(()=>{let b;return e.some(w=>w.is_syncing)&&(b=window.setInterval(()=>{rt.get(window.location.href,{},{preserveScroll:!0,preserveState:!0,only:["datasources"]})},2e3)),()=>{b&&window.clearInterval(b)}},[e]),e.length===0?a.jsx("div",{className:"p-8",children:a.jsx(Pd,{icon:Ro,title:"Connect your first data source",description:"Connect to your data sources to start creating datasets and training models",actionLabel:"Add Datasource",onAction:()=>{rt.visit(`${t}/datasources/new`)}})}):a.jsx("div",{className:"p-8",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Datasources"}),a.jsx(tg,{value:n,onChange:r,placeholder:"Search datasources..."})]}),a.jsxs(yr,{href:`${t}/datasources/new`,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4"}),"New Datasource"]})]}),h.length===0?a.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow",children:[a.jsx(Ro,{className:"mx-auto h-12 w-12 text-gray-400"}),a.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900",children:"No datasources found"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"No datasources match your search criteria. Try adjusting your search or add a new datasource."}),a.jsx("div",{className:"mt-6",children:a.jsxs(yr,{href:`${t}/datasources/new`,className:"inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4 mr-2"}),"New Datasource"]})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:h.map(b=>a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ro,{className:"w-5 h-5 text-blue-600 mt-1"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:b.name}),b.is_syncing?a.jsx(Za,{variant:"warning",children:"syncing"}):b.sync_error?a.jsx(Za,{variant:"important",children:"sync error"}):b.last_synced_at!=="Not Synced"?a.jsx(Za,{variant:"success",children:"synced"}):a.jsx(Za,{variant:"warning",children:"not synced"})]}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["s3://",b.s3_bucket,"/",b.s3_prefix]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>N(b.id),disabled:b.is_syncing,className:`text-gray-400 hover:text-blue-600 transition-colors ${b.is_syncing?"animate-spin":""}`,title:"Sync datasource",children:a.jsx(ET,{className:"w-5 h-5"})}),a.jsx(yr,{href:`${t}/datasources/${b.id}/edit`,className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Edit datasource",children:a.jsx(Bl,{className:"w-5 h-5"})}),a.jsx("button",{onClick:()=>g(b.id),className:"text-gray-400 hover:text-red-600 transition-colors",title:"Delete datasource",children:a.jsx(aa,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Region"}),a.jsx("p",{className:"text-sm font-medium text-gray-900",children:b.s3_region})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Last Sync"}),a.jsx("p",{className:"text-sm font-medium text-gray-900",children:x(b.last_synced_at)})]})]}),b.sync_error&&b.stacktrace&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100",children:[a.jsxs("button",{onClick:()=>y(b.id),className:"flex items-center gap-2 text-sm text-red-600 hover:text-red-700",children:[a.jsx(on,{className:"w-4 h-4"}),a.jsx("span",{children:"View Error Details"}),u.includes(b.id)?a.jsx(Ul,{className:"w-4 h-4"}):a.jsx(oa,{className:"w-4 h-4"})]}),u.includes(b.id)&&a.jsx("div",{className:"mt-2 p-3 bg-red-50 rounded-md",children:a.jsx("pre",{className:"text-xs text-red-700 whitespace-pre-wrap font-mono",children:b.stacktrace})})]})]},b.id))}),m>1&&a.jsx(ng,{currentPage:i,totalPages:m,onPageChange:l})]})]})})}const IR=Object.freeze(Object.defineProperty({__proto__:null,default:RR},Symbol.toStringTag,{value:"Module"})),av={classification:[{value:"accuracy_score",label:"Accuracy",description:"Overall prediction accuracy"},{value:"precision_score",label:"Precision",description:"Ratio of true positives to predicted positives"},{value:"recall_score",label:"Recall",description:"Ratio of true positives to actual positives"},{value:"f1_score",label:"F1 Score",description:"Harmonic mean of precision and recall"}],regression:[{value:"mean_absolute_error",label:"Mean Absolute Error",description:"Average absolute differences between predicted and actual values"},{value:"mean_squared_error",label:"Mean Squared Error",description:"Average squared differences between predicted and actual values"},{value:"root_mean_squared_error",label:"Root Mean Squared Error",description:"Square root of mean squared error"},{value:"r2_score",label:"R² Score",description:"Proportion of variance in the target that is predictable"}]};function LR({isOpen:e,onClose:t,onSave:n,initialData:r,tunerJobConstants:i,timezone:l,retrainingJobConstants:u}){var O,R,F,D,z,B,H,ce,ue,we,ne,Z,de,se,Q,re,ee,G,ge,_e,De,me;const[d,f]=A.useState(!1);A.useState(null);const m=Object.entries(i).filter(([Y,pe])=>Array.isArray(pe.options)).reduce((Y,[pe,ye])=>({...Y,[pe]:ye.options[0].value}),{}),h=m.booster,g=Object.entries(i.hyperparameters[h]||{}).filter(([Y,pe])=>!Array.isArray(pe.options)).reduce((Y,[pe,ye])=>({...Y,[pe]:{min:ye.min,max:ye.max}}),{}),[y,N]=A.useState({retraining_job_attributes:{id:((O=r.retraining_job)==null?void 0:O.id)||null,active:((R=r.retraining_job)==null?void 0:R.active)??!1,frequency:((F=r.retraining_job)==null?void 0:F.frequency)||u.frequency[0].value,tuning_frequency:((D=r.retraining_job)==null?void 0:D.tuning_frequency)||"month",direction:((z=r.retraining_job)==null?void 0:z.direction)||"maximize",batch_mode:((B=r.retraining_job)==null?void 0:B.batch_mode)||!1,batch_size:((H=r.retraining_job)==null?void 0:H.batch_size)||100,batch_overlap:((ce=r.retraining_job)==null?void 0:ce.batch_overlap)||1,batch_key:((ue=r.retraining_job)==null?void 0:ue.batch_key)||"",at:{hour:((ne=(we=r.retraining_job)==null?void 0:we.at)==null?void 0:ne.hour)??2,day_of_week:((de=(Z=r.retraining_job)==null?void 0:Z.at)==null?void 0:de.day_of_week)??1,day_of_month:((Q=(se=r.retraining_job)==null?void 0:se.at)==null?void 0:Q.day_of_month)??1},metric:((re=r.retraining_job)==null?void 0:re.metric)||av[r.task==="classification"?"classification":"regression"][0].value,threshold:((ee=r.retraining_job)==null?void 0:ee.threshold)||(r.task==="classification"?.85:.1),tuner_config:(G=r.retraining_job)!=null&&G.tuner_config?{n_trials:r.retraining_job.tuner_config.n_trials||10,config:{...m,...g,...r.retraining_job.tuner_config.config}}:void 0,tuning_enabled:((ge=r.retraining_job)==null?void 0:ge.tuning_enabled)??!1}});if(A.useEffect(()=>{y.retraining_job_attributes.tuner_config&&Object.keys(y.retraining_job_attributes.tuner_config.config).length===0&&N(Y=>({...Y,retraining_job_attributes:{...Y.retraining_job_attributes,tuner_config:{...Y.retraining_job_attributes.tuner_config,config:{...m,...g}}}}))},[y.retraining_job_attributes.tuner_config]),!e)return null;const x=(Y,pe)=>{N(ye=>({...ye,retraining_job_attributes:{...ye.retraining_job_attributes,tuner_config:{...ye.retraining_job_attributes.tuner_config,config:{...ye.retraining_job_attributes.tuner_config.config,[Y]:pe}}}}))},b=()=>{const Y=Object.entries(i).filter(([ye,Je])=>Array.isArray(Je.options)),pe=Y.map(([ye])=>ye);return a.jsxs("div",{className:"space-y-4",children:[Y.map(([ye,Je])=>{var zn;return a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:Je.label}),a.jsx(ot,{options:Je.options.map(Et=>({value:Et.value,label:Et.label,description:Et.description})),value:((zn=y.retraining_job_attributes.tuner_config)==null?void 0:zn.config[ye])||Je.options[0].value,onChange:Et=>x(ye,Et)})]},ye)}),pe.map(ye=>{var Et;const Je=Object.entries(i).filter(([_n,Un])=>Un.depends_on===ye),zn=((Et=y.retraining_job_attributes.tuner_config)==null?void 0:Et.config[ye])||i[ye].options[0].value;return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Parameter Ranges"}),a.jsx("div",{className:"space-y-4 max-h-[400px] overflow-y-auto pr-2",children:Je.map(([_n,Un])=>{const _t=Un[zn];return _t?Object.entries(_t).map(([Vt,kt])=>{var zt,Sr,Ur,Sn;return kt.min!==void 0&&kt.max!==void 0?a.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("label",{className:"text-sm font-medium text-gray-900",children:kt.label}),a.jsx("span",{className:"text-xs text-gray-500",children:kt.description})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Minimum"}),a.jsx("input",{type:"number",min:kt.min,max:kt.max,step:kt.step,value:((Sr=(zt=y.retraining_job_attributes.tuner_config)==null?void 0:zt.config[Vt])==null?void 0:Sr.min)??kt.min,onChange:St=>E(Vt,"min",parseFloat(St.target.value)),className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Maximum"}),a.jsx("input",{type:"number",min:kt.min,max:kt.max,step:kt.step,value:((Sn=(Ur=y.retraining_job_attributes.tuner_config)==null?void 0:Ur.config[Vt])==null?void 0:Sn.max)??kt.max,onChange:St=>E(Vt,"max",parseFloat(St.target.value)),className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]})]})]},Vt):null}):null})})]},ye)})]})},E=(Y,pe,ye)=>{N(Je=>({...Je,retraining_job_attributes:{...Je.retraining_job_attributes,tuner_config:{...Je.retraining_job_attributes.tuner_config,config:{...Je.retraining_job_attributes.tuner_config.config,[Y]:{...Je.retraining_job_attributes.tuner_config.config[Y],[pe]:ye}}}}}))},w=(Y,pe)=>{N(ye=>Y==="hour"||Y==="day_of_week"||Y==="day_of_month"?{...ye,retraining_job_attributes:{...ye.retraining_job_attributes,at:{...ye.retraining_job_attributes.at,[Y]:pe}}}:{...ye,retraining_job_attributes:{...ye.retraining_job_attributes,[Y]:pe}})},S=(Y,pe)=>{N(ye=>({...ye,retraining_job_attributes:{...ye.retraining_job_attributes,[Y]:pe}}))},C=()=>{const{retraining_job_attributes:Y}=y,pe={hour:Y.at.hour};switch(Y.frequency){case"day":break;case"week":pe.day_of_week=Y.at.day_of_week;break;case"month":pe.day_of_month=Y.at.day_of_month;break}const ye={retraining_job_attributes:{...Y,at:pe}};n(ye),t()};return a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white rounded-lg w-full max-w-6xl max-h-[90vh] overflow-hidden",children:[a.jsxs("div",{className:"flex justify-between items-center p-4 border-b",children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Training Configuration"}),a.jsx("button",{onClick:t,className:"text-gray-500 hover:text-gray-700",children:a.jsx(Wl,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 grid grid-cols-2 gap-8 max-h-[calc(90vh-8rem)] overflow-y-auto",children:[a.jsx("div",{className:"space-y-8",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Xh,{className:"w-5 h-5 text-blue-600"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Training Schedule"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:"scheduleEnabled",checked:y.retraining_job_attributes.active,onChange:Y=>N(pe=>({...pe,retraining_job_attributes:{...pe.retraining_job_attributes,active:Y.target.checked}})),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),a.jsx("label",{htmlFor:"scheduleEnabled",className:"ml-2 text-sm text-gray-700",children:"Enable scheduled training"})]})]}),!y.retraining_job_attributes.active&&a.jsx("div",{className:"bg-gray-50 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(on,{className:"w-5 h-5 text-gray-400 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Manual Training Mode"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"The model will only be trained when you manually trigger training. You can do this from the model details page at any time."})]})]})}),y.retraining_job_attributes.active&&a.jsx(a.Fragment,{children:a.jsx("div",{className:"space-y-6",children:a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Frequency"}),a.jsx(ot,{options:u.frequency.map(Y=>({value:Y.value,label:Y.label,description:Y.description})),value:y.retraining_job_attributes.frequency,onChange:Y=>w("frequency",Y)})]}),y.retraining_job_attributes.frequency==="week"&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Day of Week"}),a.jsx(ot,{options:[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"}],value:y.retraining_job_attributes.at.day_of_week,onChange:Y=>w("day_of_week",Y)})]}),y.retraining_job_attributes.frequency==="month"&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Day of Month"}),a.jsx(ot,{options:Array.from({length:31},(Y,pe)=>({value:pe+1,label:`Day ${pe+1}`})),value:y.retraining_job_attributes.at.day_of_month,onChange:Y=>w("day_of_month",Y)})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:["Hour (",l,")"]}),a.jsx(ot,{options:Array.from({length:24},(Y,pe)=>({value:pe,label:`${pe}:00`})),value:y.retraining_job_attributes.at.hour,onChange:Y=>w("hour",Y)})]})]})})}),a.jsxs("div",{className:"space-y-4 pt-4 border-t",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("label",{htmlFor:"batchTrainingEnabled",className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:["Enable Batch Training",a.jsx("button",{type:"button",onClick:()=>f(!d),className:"text-gray-400 hover:text-gray-600",children:a.jsx(Mb,{className:"w-4 h-4"})})]})}),a.jsx("input",{type:"checkbox",id:"batchMode",checked:y.retraining_job_attributes.batch_mode,onChange:Y=>N({...y,retraining_job_attributes:{...y.retraining_job_attributes,batch_mode:Y.target.checked}}),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"})]}),d&&a.jsx("div",{className:"bg-blue-50 rounded-lg p-4 text-sm text-blue-700",children:a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:"• When disabled, the model will train on the entire dataset in a single pass."}),a.jsx("li",{children:"• When enabled, the model will learn from small batches of data iteratively, improving training speed"})]})}),y.retraining_job_attributes.batch_mode&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Batch Size"}),a.jsx("input",{type:"number",value:y.retraining_job_attributes.batch_size,onChange:Y=>N({...y,retraining_job_attributes:{...y.retraining_job_attributes,batch_size:parseInt(Y.target.value)}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Batch Overlap"}),a.jsx("input",{type:"number",value:y.retraining_job_attributes.batch_overlap,onChange:Y=>N({...y,retraining_job_attributes:{...y.retraining_job_attributes,batch_overlap:parseInt(Y.target.value)}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"})]})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Batch Key"}),a.jsx(ot,{value:y.retraining_job_attributes.batch_key,onChange:Y=>N({...y,retraining_job_attributes:{...y.retraining_job_attributes,batch_key:Y}}),options:((De=(_e=r.dataset)==null?void 0:_e.columns)==null?void 0:De.map(Y=>({value:Y.name,label:Y.name})))||[],placeholder:"Select a column for batch key"})]})]})]}),a.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(on,{className:"w-5 h-5 text-blue-600"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Evaluator Configuration"})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Metric"}),a.jsx(ot,{options:av[r.task==="classification"?"classification":"regression"].map(Y=>({value:Y.value,label:Y.label,description:Y.description})),value:y.retraining_job_attributes.metric,onChange:Y=>S("metric",Y)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Threshold"}),a.jsx("input",{type:"number",value:y.retraining_job_attributes.threshold,onChange:Y=>S("threshold",parseFloat(Y.target.value)),step:.01,min:0,max:1,className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border"})]})]}),a.jsx("div",{className:"bg-blue-50 rounded-md p-4",children:a.jsxs("div",{className:"flex items-start",children:[a.jsx(on,{className:"w-5 h-5 text-blue-400 mt-0.5"}),a.jsxs("div",{className:"ml-3",children:[a.jsx("h3",{className:"text-sm font-medium text-blue-800",children:"Deployment Criteria"}),a.jsxs("p",{className:"mt-2 text-sm text-blue-700",children:["The model will be automatically deployed when the ",y.retraining_job_attributes.metric," is"," ",y.retraining_job_attributes.direction==="minimize"?"below":"above"," ",y.retraining_job_attributes.threshold,"."]})]})]})})]})]})]})}),a.jsx("div",{className:"space-y-8",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ui,{className:"w-5 h-5 text-blue-600"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Hyperparameter Tuning"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:"tuningEnabled",checked:y.retraining_job_attributes.tuning_enabled||!1,onChange:Y=>N(pe=>({...pe,retraining_job_attributes:{...pe.retraining_job_attributes,tuning_enabled:Y.target.checked,tuner_config:Y.target.checked?{n_trials:10,config:g}:void 0}})),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),a.jsx("label",{htmlFor:"tuningEnabled",className:"ml-2 text-sm text-gray-700",children:"Enable tuning"})]})]}),y.retraining_job_attributes.tuning_enabled&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Frequency"}),a.jsx(ot,{options:[{value:"always",label:"Always",description:"Tune hyperparameters every time"},{value:"week",label:"Weekly",description:"Tune hyperparameters once every week"},{value:"month",label:"Monthly",description:"Tune hyperparameters once every month"}],value:y.retraining_job_attributes.tuning_frequency||"week",onChange:Y=>N(pe=>({...pe,retraining_job_attributes:{...pe.retraining_job_attributes,tuning_frequency:Y}}))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Number of Trials"}),a.jsx("input",{type:"number",min:"1",max:"1000",value:((me=y.retraining_job_attributes.tuner_config)==null?void 0:me.n_trials)||10,onChange:Y=>N(pe=>({...pe,retraining_job_attributes:{...pe.retraining_job_attributes,tuner_config:{...pe.retraining_job_attributes.tuner_config,n_trials:parseInt(Y.target.value)}}})),className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border"})]})]}),b()]})]})})]}),a.jsxs("div",{className:"flex justify-end gap-4 p-4 border-t",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-500",children:"Cancel"}),a.jsx("button",{onClick:C,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md",children:"Save Changes"})]})]})})}const yo=({error:e})=>e?a.jsxs("div",{className:"mt-1 flex items-center gap-1 text-sm text-red-600",children:[a.jsx(on,{className:"w-4 h-4"}),e]}):null;function ew({initialData:e,datasets:t,constants:n,isEditing:r,errors:i}){var z,B,H,ce,ue,we;const{rootPath:l}=_r().props,[u,d]=A.useState(!1),[f,m]=A.useState(!1),h=Td({model:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",model_type:(e==null?void 0:e.model_type)||"xgboost",dataset_id:(e==null?void 0:e.dataset_id)||"",task:(e==null?void 0:e.task)||"classification",objective:(e==null?void 0:e.objective)||"binary:logistic",metrics:(e==null?void 0:e.metrics)||["accuracy"],retraining_job_attributes:e!=null&&e.retraining_job?{id:e.retraining_job.id,frequency:e.retraining_job.frequency,tuning_frequency:e.retraining_job.tuning_frequency||"month",batch_mode:e.retraining_job.batch_mode,batch_size:e.retraining_job.batch_size,batch_overlap:e.retraining_job.batch_overlap,batch_key:e.retraining_job.batch_key,at:{hour:((z=e.retraining_job.at)==null?void 0:z.hour)??2,day_of_week:((B=e.retraining_job.at)==null?void 0:B.day_of_week)??1,day_of_month:((H=e.retraining_job.at)==null?void 0:H.day_of_month)??1},active:e.retraining_job.active,metric:e.retraining_job.metric,threshold:e.retraining_job.threshold,tuner_config:e.retraining_job.tuner_config,tuning_enabled:e.retraining_job.tuning_enabled||!1}:void 0}}),{data:g,setData:y,post:N,patch:x,processing:b,errors:E}=h,w={...i,...E},S=((ce=n.objectives[g.model.model_type])==null?void 0:ce[g.model.task])||[];A.useEffect(()=>{var ne;if(e!=null&&e.metrics)y({...g,model:{...g.model,objective:g.model.task==="classification"?"binary:logistic":"reg:squarederror"}});else{const Z=((ne=n.metrics[g.model.task])==null?void 0:ne.map(de=>de.value))||[];y({...g,model:{...g.model,objective:g.model.task==="classification"?"binary:logistic":"reg:squarederror",metrics:Z}})}},[g.model.task]),A.useEffect(()=>{f&&(O(),m(!1))},[f]);const C=ne=>{y({...g,model:{...g.model,retraining_job_attributes:ne.retraining_job_attributes}}),m(!0)},O=()=>{if(g.model.retraining_job_attributes){const ne={hour:g.model.retraining_job_attributes.at.hour};switch(g.model.retraining_job_attributes.frequency){case"day":break;case"week":ne.day_of_week=g.model.retraining_job_attributes.at.day_of_week;break;case"month":ne.day_of_month=g.model.retraining_job_attributes.at.day_of_month;break}y("model.retraining_job_attributes.at",ne)}g.model.id?x(`${l}/models/${g.model.id}`,{onSuccess:()=>{rt.visit(`${l}/models`)}}):N(`${l}/models`,{onSuccess:()=>{rt.visit(`${l}/models`)}})},R=ne=>{ne.preventDefault(),O()};console.log(g.model);const F=t.find(ne=>ne.id===g.model.dataset_id),D=n.tuner_job_constants[g.model.model_type]||{};return a.jsxs("form",{onSubmit:R,className:"space-y-8",children:[a.jsxs("div",{className:"flex justify-between items-center border-b pb-4",children:[a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Model Configuration"}),a.jsxs("button",{type:"button",onClick:()=>d(!0),className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(PT,{className:"w-4 h-4"}),"Configure Training"]})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:"Model Name"}),a.jsx("input",{type:"text",id:"name",value:g.model.name,onChange:ne=>y("model.name",ne.target.value),className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border"}),a.jsx(yo,{error:w.name})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Model Type"}),a.jsx(ot,{options:[{value:"xgboost",label:"XGBoost",description:"Gradient boosting framework"}],value:g.model.model_type,onChange:ne=>y("model.model_type",ne),placeholder:"Select model type"}),a.jsx(yo,{error:w.model_type})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Dataset"}),r?a.jsxs("div",{className:"flex items-center gap-2 p-2 bg-gray-50 rounded-md border border-gray-200",children:[a.jsx(ST,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-gray-700",children:F==null?void 0:F.name})]}):a.jsx(ot,{options:t.map(ne=>({value:ne.id,label:ne.name,description:`${ne.num_rows.toLocaleString()} rows`})),value:g.model.dataset_id,onChange:ne=>y("model.dataset_id",ne),placeholder:"Select dataset"}),a.jsx(yo,{error:w.dataset_id})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Task"}),a.jsx(ot,{options:n.tasks,value:g.model.task,onChange:ne=>y("model.task",ne),placeholder:"Select task"}),a.jsx(yo,{error:w.task})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Objective"}),a.jsx(ot,{options:S||[],value:g.model.objective,onChange:ne=>y("model.objective",ne),placeholder:"Select objective"}),a.jsx(yo,{error:w.objective})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Metrics"}),a.jsx("div",{className:"grid grid-cols-2 gap-4",children:(ue=n.metrics[g.model.task])==null?void 0:ue.map(ne=>a.jsxs("label",{className:"relative flex items-center px-4 py-3 bg-white border rounded-lg hover:bg-gray-50 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:g.model.metrics.includes(ne.value),onChange:Z=>{const de=Z.target.checked?[...g.model.metrics,ne.value]:g.model.metrics.filter(se=>se!==ne.value);y("model.metrics",de)},className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),a.jsxs("div",{className:"ml-3",children:[a.jsx("span",{className:"block text-sm font-medium text-gray-900",children:ne.label}),a.jsx("span",{className:"block text-xs text-gray-500",children:ne.direction==="maximize"?"Higher is better":"Lower is better"})]})]},ne.value))})]})]}),g.model.retraining_job_attributes&&g.model.retraining_job_attributes.batch_mode&&a.jsx(a.Fragment,{children:a.jsxs("div",{className:"mt-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Batch Key"}),a.jsx(ot,{value:g.model.retraining_job_attributes.batch_key||"",onChange:ne=>y("model",{...g.model,retraining_job_attributes:{...g.model.retraining_job_attributes,batch_key:ne}}),options:((we=F==null?void 0:F.columns)==null?void 0:we.map(ne=>({value:ne.name,label:ne.name})))||[],placeholder:"Select a column for batch key"}),a.jsx(yo,{error:w["model.retraining_job_attributes.batch_key"]})]})}),a.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[a.jsx("button",{type:"button",onClick:()=>rt.visit(`${l}/models`),className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900",children:"Cancel"}),a.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:r?"Save Changes":"Create Model"})]}),a.jsx(LR,{isOpen:u,onClose:()=>d(!1),onSave:C,initialData:{task:g.model.task,metrics:g.model.metrics,modelType:g.model.model_type,dataset:F,retraining_job:g.model.retraining_job_attributes},tunerJobConstants:D,timezone:n.timezone,retrainingJobConstants:n.retraining_job_constants})]})}function MR({model:e,datasets:t,constants:n}){return a.jsx("div",{className:"max-w-3xl mx-auto py-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg",children:[a.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Bs,{className:"w-6 h-6 text-blue-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Edit Model"})]})}),a.jsx("div",{className:"p-6",children:a.jsx(ew,{initialData:e,datasets:t,constants:n,isEditing:!0})})]})})}const FR=Object.freeze(Object.defineProperty({__proto__:null,default:MR},Symbol.toStringTag,{value:"Module"})),Xe=e=>{const t=new Date;return t.setDate(t.getDate()-e),t.toISOString()},tw=[{id:1,name:"Customer Churn Dataset",description:"Historical customer data for churn prediction",columns:[{name:"usage_days",type:"numeric",description:"Number of days customer has used the product",statistics:{mean:145.7,median:130,min:1,max:365,nullCount:0}},{name:"total_spend",type:"numeric",description:"Total customer spend in USD",statistics:{mean:487.32,median:425.5,min:0,max:2500,nullCount:1250}},{name:"support_tickets",type:"numeric",description:"Number of support tickets opened",statistics:{mean:2.3,median:1,min:0,max:15,nullCount:3750}},{name:"subscription_tier",type:"categorical",description:"Customer subscription level",statistics:{uniqueCount:3,nullCount:125}},{name:"last_login",type:"datetime",description:"Last time the customer logged in",statistics:{nullCount:5e3}}],sampleData:[{usage_days:234,total_spend:567.89,support_tickets:1,subscription_tier:"premium",last_login:"2024-03-01"},{usage_days:45,total_spend:null,support_tickets:null,subscription_tier:"basic",last_login:null}],rowCount:25e3,updatedAt:"2024-03-10T12:00:00Z"}];Xe(30),Xe(0);Xe(7),Xe(1),Xe(30),Xe(0);Xe(1),Xe(1),Xe(1),Xe(1),Xe(2),Xe(2),Xe(2),Xe(2),Xe(3),Xe(3),Xe(3),Xe(3),Xe(4),Xe(4),Xe(4),Xe(4);const $R=[{id:1,name:"Normalize state",description:"Turn state names into 2 letter state abbreviations",groupId:1,testDatasetId:1,inputColumns:["state"],outputColumns:["state"],code:"",createdAt:Xe(30),updatedAt:Xe(0)}],Ni=[{id:1,name:"Customer Churn",description:"Features for customer churn dataset",features:$R,createdAt:Xe(30),updatedAt:Xe(0)}];function DR({value:e,onChange:t,language:n}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"bg-gray-900 rounded-lg overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-800",children:[a.jsx("span",{className:"text-sm text-gray-400",children:"Ruby Feature"}),a.jsx("span",{className:"text-xs px-2 py-1 bg-gray-700 rounded text-gray-300",children:n})]}),a.jsx("textarea",{value:e,onChange:r=>t(r.target.value),className:"w-full h-64 p-4 bg-gray-900 text-gray-100 font-mono text-sm focus:outline-none",placeholder:`def transform(df)
|
433
|
+
end`})})]})})}function _R({options:e,initialFeatures:t=[],onFeaturesChange:n}){const[r,i]=A.useState(t),[l,u]=A.useState(null);console.log(r);const d=e.filter(E=>!r.find(w=>w.name===E.name)),f=E=>{const w=E.map((S,C)=>({...S,feature_position:C}));i(w),n(w)},m=E=>{const w=e.find(S=>S.name===E);if(w){const S={...w,feature_position:r.length};f([...r,S])}},h=E=>{const w=[...r];w.splice(E,1),f(w)},g=E=>{if(E===0)return;const w=[...r];[w[E-1],w[E]]=[w[E],w[E-1]],f(w)},y=E=>{if(E===r.length-1)return;const w=[...r];[w[E],w[E+1]]=[w[E+1],w[E]],f(w)},N=(E,w)=>{u(w)},x=(E,w)=>{if(E.preventDefault(),l===null||l===w)return;const S=[...r],[C]=S.splice(l,1);S.splice(w,0,C),f(S),u(w)},b=()=>{u(null)};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"flex-1",children:a.jsx(ot,{options:d.map(E=>({value:E.name,label:E.name,description:E.description})),value:"",onChange:E=>m(E),placeholder:"Add a transform..."})}),a.jsx(wR,{})]}),a.jsxs("div",{className:"space-y-2",children:[r.map((E,w)=>a.jsxs("div",{draggable:!0,onDragStart:S=>N(S,w),onDragOver:S=>x(S,w),onDragEnd:b,className:`flex items-center gap-3 p-3 bg-white border rounded-lg ${l===w?"border-blue-500 shadow-lg":"border-gray-200"} ${l!==null?"cursor-grabbing":""}`,children:[a.jsx("button",{type:"button",className:"p-1 text-gray-400 hover:text-gray-600 cursor-grab active:cursor-grabbing",children:a.jsx(_T,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium text-gray-900",children:E.name}),a.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${E.feature_type==="calculation"?"bg-blue-100 text-blue-800":E.feature_type==="lookup"?"bg-purple-100 text-purple-800":"bg-green-100 text-green-800"}`,children:"feature"})]}),a.jsx("p",{className:"text-sm text-gray-500 truncate",children:E.description})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>g(w),disabled:w===0,className:"p-1 text-gray-400 hover:text-gray-600 disabled:opacity-50",title:"Move up",children:a.jsx(fT,{className:"w-4 h-4"})}),a.jsx("button",{type:"button",onClick:()=>y(w),disabled:w===r.length-1,className:"p-1 text-gray-400 hover:text-gray-600 disabled:opacity-50",title:"Move down",children:a.jsx(cT,{className:"w-4 h-4"})}),a.jsx("button",{type:"button",onClick:()=>h(w),className:"p-1 text-gray-400 hover:text-red-600",title:"Remove transform",children:a.jsx(Wl,{className:"w-4 h-4"})})]})]},E.name)),r.length===0&&a.jsxs("div",{className:"text-center py-8 bg-gray-50 border-2 border-dashed border-gray-200 rounded-lg",children:[a.jsx(Js,{className:"w-8 h-8 text-gray-400 mx-auto mb-2"}),a.jsx("p",{className:"text-sm text-gray-500",children:"Add features to enrich your dataset"})]})]})]})}function SR({isOpen:e,onClose:t,initialDataset:n,onSave:r,constants:i}){const[l,u]=A.useState(n),[d,f]=A.useState("columns"),[m,h]=A.useState(!1),[g,y]=A.useState({targetColumn:l.target}),[N,x]=A.useState(null),[b,E]=A.useState(""),[w,S]=A.useState({view:"all",types:[]}),[C,O]=A.useState(n.needs_refresh||!1),R=A.useCallback(async G=>{await r(G)},[r]),{saving:F,saved:D,error:z}=vR(l,R,2e3),B=G=>{var ge,_e,De;return((ge=G.preprocessing_steps)==null?void 0:ge.training)!=null&&((De=(_e=G.preprocessing_steps)==null?void 0:_e.training)==null?void 0:De.method)!=="none"},H=A.useMemo(()=>l.columns.filter(G=>{const ge=G.name.toLowerCase().includes(b.toLowerCase()),_e=w.types.length===0||w.types.includes(G.datatype),De=(()=>{var me,Y;switch(w.view){case"training":return!G.hidden&&!G.drop_if_null;case"hidden":return G.hidden;case"preprocessed":return B(G);case"nulls":return(((Y=(me=G.statistics)==null?void 0:me.processed)==null?void 0:Y.null_count)||0)>0;default:return!0}})();return ge&&_e&&De}),[l.columns,b,w]),ce=A.useMemo(()=>({total:l.columns.length,filtered:H.length,training:l.columns.filter(G=>!G.hidden&&!G.drop_if_null).length,hidden:l.columns.filter(G=>G.hidden).length,withPreprocessing:l.columns.filter(B).length,withNulls:l.columns.filter(G=>{var ge,_e;return(((_e=(ge=G.statistics)==null?void 0:ge.processed)==null?void 0:_e.null_count)||0)>0}).length}),[l.columns,H]),ue=A.useMemo(()=>Array.from(new Set(l.columns.map(G=>G.datatype))),[l.columns]),we=G=>{x(G)},ne=G=>{const ge=l.columns.map(_e=>({..._e,hidden:_e.name===G?!_e.hidden:_e.hidden}));u({...l,columns:ge}),O(!0)},Z=G=>{const ge=String(G);y({targetColumn:G});const _e=l.columns.map(De=>({...De,is_target:De.name===ge}));u({...l,columns:_e}),O(!0)},de=(G,ge)=>{const _e=l.columns.map(De=>({...De,datatype:De.name===G?ge:De.datatype}));u({...l,columns:_e}),O(!0)},se=(G,ge,_e,De)=>{if(!l.columns.find(pe=>pe.name===G))return;const Y=l.columns.map(pe=>pe.name!==G?pe:{...pe,preprocessing_steps:{training:ge,...De&&_e?{inference:_e}:{}}});u({...l,columns:Y}),O(!0)},Q=G=>{const _e=(l.features||[]).filter(me=>!G.find(Y=>Y.name===me.name)).map(me=>({...me,_destroy:!0})),De=[...G,..._e].map((me,Y)=>({...me,dataset_id:l.id,feature_position:Y}));u(me=>({...me,features:De})),O(!0)},re=async()=>{h(!0);try{await r(l),rt.post(`/easy_ml/datasets/${l.id}/refresh`,{},{onSuccess:()=>{h(!1)},onError:()=>{console.error("Error refreshing dataset"),h(!1)}})}catch(G){console.error("Error refreshing dataset:",G),h(!1)}};if(!e)return null;const ee=N?l.columns.find(G=>G.name===N):null;return a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white rounded-lg w-full max-w-6xl max-h-[90vh] overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"flex justify-between items-center p-4 border-b shrink-0",children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Column Configuration"}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("div",{className:"min-w-[0px]",children:a.jsx(xO,{saving:F,saved:D,error:z})}),a.jsxs("div",{className:"relative",children:[a.jsx(Zh,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",placeholder:"Search columns...",value:b,onChange:G=>E(G.target.value),className:"pl-9 pr-4 py-2 w-64 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"})]}),a.jsx("button",{onClick:t,className:"text-gray-500 hover:text-gray-700",children:a.jsx(Wl,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"flex border-b shrink-0",children:[a.jsx("button",{onClick:()=>f("columns"),className:`px-4 py-2 text-sm font-medium border-b-2 ${d==="columns"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ui,{className:"w-4 h-4"}),"Column Configuration"]})}),a.jsx("button",{onClick:()=>f("features"),className:`px-4 py-2 text-sm font-medium border-b-2 ${d==="features"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(TT,{className:"w-4 h-4"}),"Features",a.jsx("span",{className:"px-1.5 py-0.5 text-xs font-medium bg-blue-100 text-blue-600 rounded-full",children:i.feature_options.length})]})}),C&&a.jsx("div",{className:"ml-auto px-4 flex items-center",children:a.jsxs("button",{onClick:re,disabled:m,className:"group relative inline-flex items-center gap-2 px-6 py-2.5 bg-gradient-to-r from-blue-600 to-indigo-600 text-white text-sm font-medium rounded-md hover:from-blue-700 hover:to-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 transition-all duration-200 shadow-md hover:shadow-lg",children:[a.jsx("div",{className:"absolute inset-0 bg-white/10 rounded-md opacity-0 group-hover:opacity-100 transition-opacity duration-200"}),m?a.jsxs(a.Fragment,{children:[a.jsx(Li,{className:"w-4 h-4 animate-spin"}),"Applying Preprocessing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(kT,{className:"w-4 h-4"}),"Apply Preprocessing"]})]})})]}),d==="columns"?a.jsxs(tr.Fragment,{children:[a.jsxs("div",{className:"grid grid-cols-7 flex-1 min-h-0",children:[a.jsxs("div",{className:"col-span-3 border-r overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"p-4 border-b shrink-0",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Target Column"}),a.jsx(ot,{options:l.columns.map(G=>({value:G.name,label:G.name})),value:g.targetColumn||"",onChange:G=>G&&Z(String(G))})]}),a.jsx("div",{className:"shrink-0",children:a.jsx(yO,{types:ue,activeFilters:w,onFilterChange:S,columnStats:ce,columns:l.columns,colHasPreprocessingSteps:B})}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4 min-h-0",children:a.jsx(gO,{columns:H,selectedColumn:N,onColumnSelect:we,onToggleHidden:ne})})]}),a.jsx("div",{className:"col-span-4 overflow-y-auto p-4",children:ee?a.jsx(hO,{column:ee,dataset:l,setColumnType:de,setDataset:u,constants:i,onUpdate:(G,ge,_e)=>se(ee.name,G,ge,_e)}):a.jsx("div",{className:"h-full flex items-center justify-center text-gray-500",children:"Select a column to configure preprocessing"})})]}),a.jsxs("div",{className:"border-t p-4 flex justify-between items-center shrink-0",children:[a.jsxs("div",{className:"text-sm text-gray-600",children:[l.columns.filter(G=>!G.hidden).length," columns selected for training"]}),a.jsx("div",{className:"flex gap-3",children:a.jsx("button",{onClick:t,className:"px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700",children:"Close"})})]})]}):a.jsx("div",{className:"p-6 h-[calc(90vh-8rem)] overflow-y-auto",children:a.jsx(_R,{options:i.feature_options,initialFeatures:l.features,onFeaturesChange:Q})})]})})}function jR({dataset:e,constants:t}){const[n,r]=A.useState(!1),[i,l]=A.useState(e),{rootPath:u}=_r().props,d=A.useCallback(f=>{var y;const m=Object.entries(f).reduce((N,[x,b])=>(x!=="columns"&&x!=="features"&&!Ot.isEqual(i[x],b)&&(N[x]=b),N),{}),h=f.columns.reduce((N,x)=>{const b=i.columns.find(E=>E.id===x.id);if(!b||!Ot.isEqual(b,x)){const E=Object.entries(x).reduce((w,[S,C])=>((!b||!Ot.isEqual(b[S],C))&&(w[S]=C),w),{});Object.keys(E).length>0&&(N[x.id]={...E,id:x.id})}return N},{}),g=(y=f.features)==null?void 0:y.map((N,x)=>({id:N.id,name:N.name,feature_class:N.feature_class,feature_position:x,_destroy:N._destroy}));(Object.keys(m).length>0||Object.keys(h).length>0||!Ot.isEqual(i.features,f.features))&&rt.patch(`${u}/datasets/${e.id}`,{dataset:{...m,columns_attributes:h,features_attributes:g}},{preserveState:!0,preserveScroll:!0}),l(f)},[i,e.id,u]);return a.jsxs("div",{className:"p-8 space-y-6",children:[a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{onClick:()=>r(!0),className:"flex items-center gap-2 px-4 py-2 bg-white border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50",children:[a.jsx(Bl,{className:"w-4 h-4"}),"Configure Columns"]})}),a.jsx(OT,{dataset:i}),a.jsx(SR,{isOpen:n,onClose:()=>r(!1),initialDataset:i,constants:t,onSave:d})]})}const NR=Object.freeze(Object.defineProperty({__proto__:null,default:jR},Symbol.toStringTag,{value:"Module"}));function Pd({icon:e,title:t,description:n,actionLabel:r,onAction:i}){return a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4",children:a.jsx(e,{className:"w-8 h-8 text-gray-400"})}),a.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:t}),a.jsx("p",{className:"text-gray-500 mb-6 max-w-sm mx-auto",children:n}),a.jsx("button",{onClick:i,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:r})]})}function tg({value:e,onChange:t,placeholder:n="Search..."}){return a.jsxs("div",{className:"relative",children:[a.jsx(Zh,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",value:e,onChange:r=>t(r.target.value),placeholder:n,className:"pl-9 pr-4 py-2 w-64 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"})]})}function ng({currentPage:e,totalPages:t,onPageChange:n}){return a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-200",children:[a.jsxs("div",{className:"flex-1 flex justify-between sm:hidden",children:[a.jsx("button",{onClick:()=>n(e-1),disabled:e===1,className:"relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400",children:"Previous"}),a.jsx("button",{onClick:()=>n(e+1),disabled:e===t,className:"relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400",children:"Next"})]}),a.jsxs("div",{className:"hidden sm:flex-1 sm:flex sm:items-center sm:justify-between",children:[a.jsx("div",{children:a.jsxs("p",{className:"text-sm text-gray-700",children:["Page ",a.jsx("span",{className:"font-medium",children:e})," of"," ",a.jsx("span",{className:"font-medium",children:t})]})}),a.jsx("div",{children:a.jsxs("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px","aria-label":"Pagination",children:[a.jsxs("button",{onClick:()=>n(e-1),disabled:e===1,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400",children:[a.jsx("span",{className:"sr-only",children:"Previous"}),a.jsx(Ad,{className:"h-5 w-5"})]}),Array.from({length:t},(r,i)=>i+1).map(r=>a.jsx("button",{onClick:()=>n(r),className:`relative inline-flex items-center px-4 py-2 border text-sm font-medium ${r===e?"z-10 bg-blue-50 border-blue-500 text-blue-600":"bg-white border-gray-300 text-gray-500 hover:bg-gray-50"}`,children:r},r)),a.jsxs("button",{onClick:()=>n(e+1),disabled:e===t,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:bg-gray-100 disabled:text-gray-400",children:[a.jsx("span",{className:"sr-only",children:"Next"}),a.jsx(qo,{className:"h-5 w-5"})]})]})})]})]})}const qp=6,Gp={analyzing:{bg:"bg-blue-100",text:"text-blue-800",icon:a.jsx(Li,{className:"w-4 h-4 animate-spin"})},ready:{bg:"bg-green-100",text:"text-green-800",icon:null},failed:{bg:"bg-red-100",text:"text-red-800",icon:a.jsx(on,{className:"w-4 h-4"})}};function CR({datasets:e,constants:t}){console.log(e);const{rootPath:n}=_r().props,[r,i]=A.useState(""),[l,u]=A.useState(1),[d,f]=A.useState([]),m=A.useMemo(()=>e.filter(x=>x.name.toLowerCase().includes(r.toLowerCase())||x.description.toLowerCase().includes(r.toLowerCase())),[e,r]),h=Math.ceil(m.length/qp),g=m.slice((l-1)*qp,l*qp),y=x=>{confirm("Are you sure you want to delete this dataset?")&&rt.delete(`${n}/datasets/${x}`)};A.useEffect(()=>{let x;return e.some(E=>E.workflow_status==="analyzing")&&(x=window.setInterval(()=>{rt.get(window.location.href,{},{preserveScroll:!0,preserveState:!0,only:["datasets"]})},2e3)),()=>{x&&window.clearInterval(x)}},[e]);const N=x=>{f(b=>b.includes(x)?b.filter(E=>E!==x):[...b,x])};return e.length===0?a.jsx("div",{className:"p-8",children:a.jsx(Pd,{icon:Ln,title:"Create your first dataset",description:"Create a dataset to start training your machine learning models",actionLabel:"Create Dataset",onAction:()=>{rt.visit(`${n}/datasets/new`)}})}):a.jsx("div",{className:"p-8",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Datasets"}),a.jsx(tg,{value:r,onChange:i,placeholder:"Search datasets..."})]}),a.jsxs(yr,{href:`${n}/datasets/new`,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4"}),"New Dataset"]})]}),g.length===0?a.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow",children:[a.jsx(Ln,{className:"mx-auto h-12 w-12 text-gray-400"}),a.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900",children:"No datasets found"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"No datasets match your search criteria. Try adjusting your search or create a new dataset."}),a.jsx("div",{className:"mt-6",children:a.jsxs(yr,{href:`${n}/datasets/new`,className:"inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4 mr-2"}),"New Dataset"]})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:g.map(x=>a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ln,{className:"w-5 h-5 text-blue-600 mt-1"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:x.name}),a.jsxs("div",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${Gp[x.workflow_status].bg} ${Gp[x.workflow_status].text}`,children:[Gp[x.workflow_status].icon,a.jsx("span",{children:x.workflow_status.charAt(0).toUpperCase()+x.workflow_status.slice(1)})]})]}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:x.description})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(yr,{href:`${n}/datasets/${x.id}`,className:`transition-colors ${x.workflow_status==="analyzing"?"text-gray-300 cursor-not-allowed pointer-events-none":"text-gray-400 hover:text-blue-600"}`,title:x.workflow_status==="analyzing"?"Dataset is being analyzed":"View details",children:a.jsx(Jh,{className:"w-5 h-5"})}),a.jsx("button",{className:"text-gray-400 hover:text-red-600 transition-colors",title:"Delete dataset",onClick:()=>y(x.id),children:a.jsx(aa,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Columns"}),a.jsxs("p",{className:"text-sm font-medium text-gray-900",children:[x.columns.length," columns"]})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Rows"}),a.jsx("p",{className:"text-sm font-medium text-gray-900",children:x.num_rows.toLocaleString()})]})]}),a.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:a.jsxs("div",{className:"flex flex-wrap gap-2",children:[x.columns.slice(0,3).map(b=>a.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:b.name},b.name)),x.columns.length>3&&a.jsxs("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800",children:["+",x.columns.length-3," more"]})]})}),x.workflow_status==="failed"&&x.stacktrace&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100",children:[a.jsxs("button",{onClick:()=>N(x.id),className:"flex items-center gap-2 text-sm text-red-600 hover:text-red-700",children:[a.jsx(on,{className:"w-4 h-4"}),a.jsx("span",{children:"View Error Details"}),d.includes(x.id)?a.jsx(Ul,{className:"w-4 h-4"}):a.jsx(oa,{className:"w-4 h-4"})]}),d.includes(x.id)&&a.jsx("div",{className:"mt-2 p-3 bg-red-50 rounded-md",children:a.jsx("pre",{className:"text-xs text-red-700 whitespace-pre-wrap font-mono",children:x.stacktrace})})]})]},x.id))}),h>1&&a.jsx(ng,{currentPage:l,totalPages:h,onPageChange:u})]})]})})}const ER=Object.freeze(Object.defineProperty({__proto__:null,default:CR},Symbol.toStringTag,{value:"Module"})),Yb=()=>{const e=tr.createContext(null);return[()=>{const t=tr.useContext(e);if(t===null)throw new Error("useContext must be inside a Provider with a value");return t},e.Provider]},zm=e=>{const t=structuredClone(e??{});for(const n in t)Ot.isPlainObject(t[n])?t[n]=zm(t[n]):Array.isArray(t[n])?t[n]=t[n].map(r=>zm(r)):t[n]!==void 0&&t[n]!==null||(t[n]="");return t},Jb=(e,t)=>{Object.entries(e).forEach(([n,r])=>{Ot.isPlainObject(r)?(iv(e,n,`${n}${t}`),Jb(r,t)):Array.isArray(r)&&iv(e,n,`${n}${t}`)})},iv=(e,t,n)=>{t!==n&&(e[n]=e[t],delete e[t])},Zb=(e,t)=>{var r;const n=t.replace(/\[\]$/,"");if(n.includes("[]")){const i=n.indexOf("[]"),l=n.slice(0,i),u=n.slice(i+2),d=Ot.get(e,l);if(Array.isArray(d))for(let f=0;f<d.length;f++)Zb(e,`${l}[${f}]${u}`)}if(n.charAt(n.length-1)==="]"){const i=n.match(/(?<index>\d*)\]$/),l=Ot.get(e,n.slice(0,n.lastIndexOf("[")));Array.isArray(l)&&((r=i==null?void 0:i.groups)==null?void 0:r.index)!==void 0&&l.splice(Number(i.groups.index),1)}else Ot.unset(e,n)},ov=e=>Array.isArray(e)?e:[e],[kR,NM]=Yb();function Td(e,t){const n=A.useCallback(()=>{let Z=null,de=e;return typeof e=="string"&&(Z=e,de=t),[Z,zm(de)]},[e,t]),[r,i]=n(),[l,u]=A.useState(i||{}),[d,f]=r?Vx(i,`${r}:data`):A.useState(i),m=A.useMemo(()=>{const Z=d?Object.keys(d):[];if(Z.length===1)return Z[0]},[d]),[h,g]=r?Vx({},`${r}:errors`):A.useState({}),[y,N]=A.useState(!1),[x,b]=A.useState(!1),[E,w]=A.useState(),[S,C]=A.useState(!1),[O,R]=A.useState(!1),F=A.useRef(null),D=A.useRef();let z=A.useRef(Z=>Z);const B=A.useRef();A.useEffect(()=>(B.current=!0,()=>{B.current=!1}),[]);let H=A.useRef(),ce=A.useRef();A.useEffect(()=>{H.current&&ce.current&&H.current(...ce.current)},[d]);let ue=!1;try{ue=kR().railsAttributes}catch{}const we=(Z,de,se={})=>{const Q={...se,onCancelToken:ee=>{if(F.current=ee,se.onCancelToken)return se.onCancelToken(ee)},onBefore:ee=>{if(C(!1),R(!1),clearTimeout(D.current),se.onBefore)return se.onBefore(ee)},onStart:ee=>{if(b(!0),se.onStart)return se.onStart(ee)},onProgress:ee=>{if(w(ee),se.onProgress)return se.onProgress(ee)},onSuccess:ee=>{if(B.current&&(b(!1),w(null),g({}),N(!1),C(!0),R(!0),D.current=setTimeout(()=>{B.current&&R(!1)},2e3)),se.onSuccess)return se.onSuccess(ee)},onError:ee=>{if(B.current&&(b(!1),w(null),g((G=>{if(!G||!m)return G;const ge={};return Object.keys(G).forEach(_e=>{ge[`${m}.${_e}`]=G[_e]}),ge})(ee)),N(!0)),se.onError)return se.onError(ee)},onCancel:()=>{if(B.current&&(b(!1),w(null)),se.onCancel)return se.onCancel()},onFinish:ee=>{if(B.current&&(b(!1),w(null)),F.current=null,se.onFinish)return se.onFinish(ee)}};let re=z.current(structuredClone(d));ue&&(re=((ee,G="_attributes")=>{const ge=structuredClone(ee);return Object.values(ge).forEach(_e=>{Ot.isPlainObject(_e)&&Jb(_e,G)}),ge})(re)),Z==="delete"?rt.delete(de,{...Q,data:re}):rt[Z](de,re,Q)},ne=Z=>{if(!Z)return void g({});const de=ov(Z);g(se=>{const Q=Object.keys(se).reduce((re,ee)=>({...re,...de.length>0&&!de.includes(String(ee))?{[ee]:se[ee]}:{}}),{});return N(Object.keys(Q).length>0),Q})};return{data:d,isDirty:!Ot.isEqual(d,l),errors:h,hasErrors:y,processing:x,progress:E,wasSuccessful:S,recentlySuccessful:O,transform:Z=>{z.current=Z},onChange:Z=>{H.current=Z},setData:(Z,de)=>{if(typeof Z=="string")return f(se=>{const Q=structuredClone(se);return H.current&&(ce.current=[Z,de,Ot.get(se,Z)]),Ot.set(Q,Z,de),Q});Z instanceof Function?f(se=>{const Q=Z(structuredClone(se));return H.current&&(ce.current=[void 0,Q,se]),Q}):(H.current&&(ce.current=[void 0,d,Z]),f(Z))},getData:Z=>Ot.get(d,Z),unsetData:Z=>{f(de=>{const se=structuredClone(de);return H.current&&(ce.current=[Z,Ot.get(de,Z),void 0]),Zb(se,Z),se})},setDefaults:(Z,de)=>{u(Z!==void 0?se=>({...se,...typeof Z=="string"?{[Z]:de}:Z}):()=>d)},reset:Z=>{if(!Z)return H.current&&(ce.current=[void 0,l,d]),f(l),void g({});const de=ov(Z),se=structuredClone(d);de.forEach(Q=>{Ot.set(se,Q,Ot.get(l,Q))}),ne(Z),H.current&&(ce.current=[void 0,se,d]),f(se)},setError:(Z,de)=>{g(se=>{const Q={...se,...typeof Z=="string"?{[Z]:de}:Z};return N(Object.keys(Q).length>0),Q})},getError:Z=>Ot.get(h,Z),clearErrors:ne,submit:we,get:(Z,de)=>{we("get",Z,de)},post:(Z,de)=>{we("post",Z,de)},put:(Z,de)=>{we("put",Z,de)},patch:(Z,de)=>{we("patch",Z,de)},delete:(Z,de)=>{we("delete",Z,de)},cancel:()=>{F.current&&F.current.cancel()}}}const[AR,CM]=(()=>{const e=tr.createContext(null);return[()=>{const t=tr.useContext(e);if(t===null)throw new Error("useContext must be inside a Provider with a value");return t},e.Provider]})();Yb();const PR=tr.forwardRef(({children:e,type:t="submit",disabled:n=!1,component:r="button",requiredFields:i,...l},u)=>{const{data:d,getData:f,processing:m}=AR(),h=A.useCallback(()=>!(!i||i.length===0)&&i.some(g=>{return typeof(y=f(g))=="string"?y==="":typeof y=="number"?y!==0&&!y:Ot.isEmpty(y);var y}),[d]);return tr.createElement(r,{children:e,type:t,disabled:n||m||i&&h(),ref:u,...l})});tr.memo(PR);function TR({datasource:e,constants:t}){var m,h,g,y;const{rootPath:n}=_r().props,r=!!e,{data:i,setData:l,processing:u,errors:d}=Td({datasource:{name:(e==null?void 0:e.name)??"",datasource_type:(e==null?void 0:e.datasource_type)??"s3",s3_bucket:(e==null?void 0:e.s3_bucket)??"",s3_prefix:(e==null?void 0:e.s3_prefix)??"",s3_region:(e==null?void 0:e.s3_region)??"us-east-1"}}),f=N=>{N.preventDefault(),r?rt.patch(`${n}/datasources/${e.id}`,i):rt.post(`${n}/datasources`,i)};return a.jsx("div",{className:"max-w-2xl mx-auto py-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-6",children:r?"Edit Datasource":"New Datasource"}),a.jsxs("form",{onSubmit:f,className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700",children:"Name"}),a.jsx("input",{type:"text",id:"name",value:i.datasource.name,onChange:N=>l("datasource.name",N.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border",required:!0}),((m=d.datasource)==null?void 0:m.name)&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:d.datasource.name})]}),!r&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Type"}),a.jsx(ot,{options:t.DATASOURCE_TYPES,value:i.datasource.datasource_type,onChange:N=>l("datasource.datasource_type",N),placeholder:"Select datasource type"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"s3_bucket",className:"block text-sm font-medium text-gray-700",children:"S3 Bucket"}),a.jsx("input",{type:"text",id:"s3_bucket",value:i.datasource.s3_bucket,onChange:N=>l("datasource.s3_bucket",N.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border",required:!0}),((h=d.datasource)==null?void 0:h.s3_bucket)&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:d.datasource.s3_bucket})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"s3_prefix",className:"block text-sm font-medium text-gray-700",children:"S3 Prefix"}),a.jsx("input",{type:"text",id:"s3_prefix",value:i.datasource.s3_prefix,onChange:N=>l("datasource.s3_prefix",N.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border",placeholder:"data/raw/"}),((g=d.datasource)==null?void 0:g.s3_prefix)&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:d.datasource.s3_prefix})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"S3 Region"}),a.jsx(ot,{options:t.s3.S3_REGIONS,value:i.datasource.s3_region,onChange:N=>l("datasource.s3_region",N),placeholder:"Select s3 region"}),((y=d.datasource)==null?void 0:y.s3_region)&&a.jsx("p",{className:"mt-1 text-sm text-red-600",children:d.datasource.s3_region})]}),a.jsxs("div",{className:"flex justify-end gap-3",children:[a.jsx("button",{type:"button",onClick:()=>rt.visit(`${n}/datasources`),className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:u,className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:u?"Saving...":r?"Save Changes":"Create Datasource"})]})]})]})})}const OR=Object.freeze(Object.defineProperty({__proto__:null,default:TR},Symbol.toStringTag,{value:"Module"})),Kp=6;function RR({datasources:e}){const{rootPath:t}=_r().props;console.log(`rootPath: ${t}`);const[n,r]=A.useState(""),[i,l]=A.useState(1),[u,d]=A.useState([]),f=A.useMemo(()=>e.filter(b=>b.name.toLowerCase().includes(n.toLowerCase())||b.s3_bucket.toLowerCase().includes(n.toLowerCase())),[n,e]),m=Math.ceil(f.length/Kp),h=f.slice((i-1)*Kp,i*Kp),g=b=>{confirm("Are you sure you want to delete this datasource? This action cannot be undone.")&&rt.delete(`${t}/datasources/${b}`)},y=b=>{d(E=>E.includes(b)?E.filter(w=>w!==b):[...E,b])},N=async b=>{try{rt.post(`${t}/datasources/${b}/sync`,{},{preserveScroll:!0,preserveState:!0,onSuccess:E=>{debugger;console.log("SUCCESS")},onError:()=>{debugger;console.error("Failed to sync datasource")}})}catch(E){console.error("Failed to sync datasource:",E)}},x=b=>{if(b==="Not Synced")return b;const E=new Date(b);return isNaN(E.getTime())?b:E.toLocaleString()};return A.useEffect(()=>{let b;return e.some(w=>w.is_syncing)&&(b=window.setInterval(()=>{rt.get(window.location.href,{},{preserveScroll:!0,preserveState:!0,only:["datasources"]})},2e3)),()=>{b&&window.clearInterval(b)}},[e]),e.length===0?a.jsx("div",{className:"p-8",children:a.jsx(Pd,{icon:Ro,title:"Connect your first data source",description:"Connect to your data sources to start creating datasets and training models",actionLabel:"Add Datasource",onAction:()=>{rt.visit(`${t}/datasources/new`)}})}):a.jsx("div",{className:"p-8",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Datasources"}),a.jsx(tg,{value:n,onChange:r,placeholder:"Search datasources..."})]}),a.jsxs(yr,{href:`${t}/datasources/new`,className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4"}),"New Datasource"]})]}),h.length===0?a.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow",children:[a.jsx(Ro,{className:"mx-auto h-12 w-12 text-gray-400"}),a.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900",children:"No datasources found"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"No datasources match your search criteria. Try adjusting your search or add a new datasource."}),a.jsx("div",{className:"mt-6",children:a.jsxs(yr,{href:`${t}/datasources/new`,className:"inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4 mr-2"}),"New Datasource"]})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:h.map(b=>a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ro,{className:"w-5 h-5 text-blue-600 mt-1"}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:b.name}),b.is_syncing?a.jsx(Za,{variant:"warning",children:"syncing"}):b.sync_error?a.jsx(Za,{variant:"important",children:"sync error"}):b.last_synced_at!=="Not Synced"?a.jsx(Za,{variant:"success",children:"synced"}):a.jsx(Za,{variant:"warning",children:"not synced"})]}),a.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["s3://",b.s3_bucket,"/",b.s3_prefix]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>N(b.id),disabled:b.is_syncing,className:`text-gray-400 hover:text-blue-600 transition-colors ${b.is_syncing?"animate-spin":""}`,title:"Sync datasource",children:a.jsx(ET,{className:"w-5 h-5"})}),a.jsx(yr,{href:`${t}/datasources/${b.id}/edit`,className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Edit datasource",children:a.jsx(Bl,{className:"w-5 h-5"})}),a.jsx("button",{onClick:()=>g(b.id),className:"text-gray-400 hover:text-red-600 transition-colors",title:"Delete datasource",children:a.jsx(aa,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Region"}),a.jsx("p",{className:"text-sm font-medium text-gray-900",children:b.s3_region})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Last Sync"}),a.jsx("p",{className:"text-sm font-medium text-gray-900",children:x(b.last_synced_at)})]})]}),b.sync_error&&b.stacktrace&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100",children:[a.jsxs("button",{onClick:()=>y(b.id),className:"flex items-center gap-2 text-sm text-red-600 hover:text-red-700",children:[a.jsx(on,{className:"w-4 h-4"}),a.jsx("span",{children:"View Error Details"}),u.includes(b.id)?a.jsx(Ul,{className:"w-4 h-4"}):a.jsx(oa,{className:"w-4 h-4"})]}),u.includes(b.id)&&a.jsx("div",{className:"mt-2 p-3 bg-red-50 rounded-md",children:a.jsx("pre",{className:"text-xs text-red-700 whitespace-pre-wrap font-mono",children:b.stacktrace})})]})]},b.id))}),m>1&&a.jsx(ng,{currentPage:i,totalPages:m,onPageChange:l})]})]})})}const IR=Object.freeze(Object.defineProperty({__proto__:null,default:RR},Symbol.toStringTag,{value:"Module"})),av={classification:[{value:"accuracy_score",label:"Accuracy",description:"Overall prediction accuracy"},{value:"precision_score",label:"Precision",description:"Ratio of true positives to predicted positives"},{value:"recall_score",label:"Recall",description:"Ratio of true positives to actual positives"},{value:"f1_score",label:"F1 Score",description:"Harmonic mean of precision and recall"}],regression:[{value:"mean_absolute_error",label:"Mean Absolute Error",description:"Average absolute differences between predicted and actual values"},{value:"mean_squared_error",label:"Mean Squared Error",description:"Average squared differences between predicted and actual values"},{value:"root_mean_squared_error",label:"Root Mean Squared Error",description:"Square root of mean squared error"},{value:"r2_score",label:"R² Score",description:"Proportion of variance in the target that is predictable"}]};function LR({isOpen:e,onClose:t,onSave:n,initialData:r,tunerJobConstants:i,timezone:l,retrainingJobConstants:u}){var O,R,F,D,z,B,H,ce,ue,we,ne,Z,de,se,Q,re,ee,G,ge,_e,De,me;const[d,f]=A.useState(!1);A.useState(null);const m=Object.entries(i).filter(([Y,pe])=>Array.isArray(pe.options)).reduce((Y,[pe,ye])=>({...Y,[pe]:ye.options[0].value}),{}),h=m.booster,g=Object.entries(i.hyperparameters[h]||{}).filter(([Y,pe])=>!Array.isArray(pe.options)).reduce((Y,[pe,ye])=>({...Y,[pe]:{min:ye.min,max:ye.max}}),{}),[y,N]=A.useState({retraining_job_attributes:{id:((O=r.retraining_job)==null?void 0:O.id)||null,active:((R=r.retraining_job)==null?void 0:R.active)??!1,frequency:((F=r.retraining_job)==null?void 0:F.frequency)||u.frequency[0].value,tuning_frequency:((D=r.retraining_job)==null?void 0:D.tuning_frequency)||"month",direction:((z=r.retraining_job)==null?void 0:z.direction)||"maximize",batch_mode:((B=r.retraining_job)==null?void 0:B.batch_mode)||!1,batch_size:((H=r.retraining_job)==null?void 0:H.batch_size)||100,batch_overlap:((ce=r.retraining_job)==null?void 0:ce.batch_overlap)||1,batch_key:((ue=r.retraining_job)==null?void 0:ue.batch_key)||"",at:{hour:((ne=(we=r.retraining_job)==null?void 0:we.at)==null?void 0:ne.hour)??2,day_of_week:((de=(Z=r.retraining_job)==null?void 0:Z.at)==null?void 0:de.day_of_week)??1,day_of_month:((Q=(se=r.retraining_job)==null?void 0:se.at)==null?void 0:Q.day_of_month)??1},metric:((re=r.retraining_job)==null?void 0:re.metric)||av[r.task==="classification"?"classification":"regression"][0].value,threshold:((ee=r.retraining_job)==null?void 0:ee.threshold)||(r.task==="classification"?.85:.1),tuner_config:(G=r.retraining_job)!=null&&G.tuner_config?{n_trials:r.retraining_job.tuner_config.n_trials||10,config:{...m,...g,...r.retraining_job.tuner_config.config}}:void 0,tuning_enabled:((ge=r.retraining_job)==null?void 0:ge.tuning_enabled)??!1}});if(A.useEffect(()=>{y.retraining_job_attributes.tuner_config&&Object.keys(y.retraining_job_attributes.tuner_config.config).length===0&&N(Y=>({...Y,retraining_job_attributes:{...Y.retraining_job_attributes,tuner_config:{...Y.retraining_job_attributes.tuner_config,config:{...m,...g}}}}))},[y.retraining_job_attributes.tuner_config]),!e)return null;const x=(Y,pe)=>{N(ye=>({...ye,retraining_job_attributes:{...ye.retraining_job_attributes,tuner_config:{...ye.retraining_job_attributes.tuner_config,config:{...ye.retraining_job_attributes.tuner_config.config,[Y]:pe}}}}))},b=()=>{const Y=Object.entries(i).filter(([ye,Je])=>Array.isArray(Je.options)),pe=Y.map(([ye])=>ye);return a.jsxs("div",{className:"space-y-4",children:[Y.map(([ye,Je])=>{var zn;return a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:Je.label}),a.jsx(ot,{options:Je.options.map(Et=>({value:Et.value,label:Et.label,description:Et.description})),value:((zn=y.retraining_job_attributes.tuner_config)==null?void 0:zn.config[ye])||Je.options[0].value,onChange:Et=>x(ye,Et)})]},ye)}),pe.map(ye=>{var Et;const Je=Object.entries(i).filter(([_n,Un])=>Un.depends_on===ye),zn=((Et=y.retraining_job_attributes.tuner_config)==null?void 0:Et.config[ye])||i[ye].options[0].value;return a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Parameter Ranges"}),a.jsx("div",{className:"space-y-4 max-h-[400px] overflow-y-auto pr-2",children:Je.map(([_n,Un])=>{const _t=Un[zn];return _t?Object.entries(_t).map(([Vt,kt])=>{var zt,Sr,Ur,Sn;return kt.min!==void 0&&kt.max!==void 0?a.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("label",{className:"text-sm font-medium text-gray-900",children:kt.label}),a.jsx("span",{className:"text-xs text-gray-500",children:kt.description})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Minimum"}),a.jsx("input",{type:"number",min:kt.min,max:kt.max,step:kt.step,value:((Sr=(zt=y.retraining_job_attributes.tuner_config)==null?void 0:zt.config[Vt])==null?void 0:Sr.min)??kt.min,onChange:St=>E(Vt,"min",parseFloat(St.target.value)),className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"Maximum"}),a.jsx("input",{type:"number",min:kt.min,max:kt.max,step:kt.step,value:((Sn=(Ur=y.retraining_job_attributes.tuner_config)==null?void 0:Ur.config[Vt])==null?void 0:Sn.max)??kt.max,onChange:St=>E(Vt,"max",parseFloat(St.target.value)),className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]})]})]},Vt):null}):null})})]},ye)})]})},E=(Y,pe,ye)=>{N(Je=>({...Je,retraining_job_attributes:{...Je.retraining_job_attributes,tuner_config:{...Je.retraining_job_attributes.tuner_config,config:{...Je.retraining_job_attributes.tuner_config.config,[Y]:{...Je.retraining_job_attributes.tuner_config.config[Y],[pe]:ye}}}}}))},w=(Y,pe)=>{N(ye=>Y==="hour"||Y==="day_of_week"||Y==="day_of_month"?{...ye,retraining_job_attributes:{...ye.retraining_job_attributes,at:{...ye.retraining_job_attributes.at,[Y]:pe}}}:{...ye,retraining_job_attributes:{...ye.retraining_job_attributes,[Y]:pe}})},S=(Y,pe)=>{N(ye=>({...ye,retraining_job_attributes:{...ye.retraining_job_attributes,[Y]:pe}}))},C=()=>{const{retraining_job_attributes:Y}=y,pe={hour:Y.at.hour};switch(Y.frequency){case"day":break;case"week":pe.day_of_week=Y.at.day_of_week;break;case"month":pe.day_of_month=Y.at.day_of_month;break}const ye={retraining_job_attributes:{...Y,at:pe}};n(ye),t()};return a.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:a.jsxs("div",{className:"bg-white rounded-lg w-full max-w-6xl max-h-[90vh] overflow-hidden",children:[a.jsxs("div",{className:"flex justify-between items-center p-4 border-b",children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Training Configuration"}),a.jsx("button",{onClick:t,className:"text-gray-500 hover:text-gray-700",children:a.jsx(Wl,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 grid grid-cols-2 gap-8 max-h-[calc(90vh-8rem)] overflow-y-auto",children:[a.jsx("div",{className:"space-y-8",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Xh,{className:"w-5 h-5 text-blue-600"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Training Schedule"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:"scheduleEnabled",checked:y.retraining_job_attributes.active,onChange:Y=>N(pe=>({...pe,retraining_job_attributes:{...pe.retraining_job_attributes,active:Y.target.checked}})),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),a.jsx("label",{htmlFor:"scheduleEnabled",className:"ml-2 text-sm text-gray-700",children:"Enable scheduled training"})]})]}),!y.retraining_job_attributes.active&&a.jsx("div",{className:"bg-gray-50 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(on,{className:"w-5 h-5 text-gray-400 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Manual Training Mode"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"The model will only be trained when you manually trigger training. You can do this from the model details page at any time."})]})]})}),y.retraining_job_attributes.active&&a.jsx(a.Fragment,{children:a.jsx("div",{className:"space-y-6",children:a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Frequency"}),a.jsx(ot,{options:u.frequency.map(Y=>({value:Y.value,label:Y.label,description:Y.description})),value:y.retraining_job_attributes.frequency,onChange:Y=>w("frequency",Y)})]}),y.retraining_job_attributes.frequency==="week"&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Day of Week"}),a.jsx(ot,{options:[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:2,label:"Tuesday"},{value:3,label:"Wednesday"},{value:4,label:"Thursday"},{value:5,label:"Friday"},{value:6,label:"Saturday"}],value:y.retraining_job_attributes.at.day_of_week,onChange:Y=>w("day_of_week",Y)})]}),y.retraining_job_attributes.frequency==="month"&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Day of Month"}),a.jsx(ot,{options:Array.from({length:31},(Y,pe)=>({value:pe+1,label:`Day ${pe+1}`})),value:y.retraining_job_attributes.at.day_of_month,onChange:Y=>w("day_of_month",Y)})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:["Hour (",l,")"]}),a.jsx(ot,{options:Array.from({length:24},(Y,pe)=>({value:pe,label:`${pe}:00`})),value:y.retraining_job_attributes.at.hour,onChange:Y=>w("hour",Y)})]})]})})}),a.jsxs("div",{className:"space-y-4 pt-4 border-t",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("label",{htmlFor:"batchTrainingEnabled",className:"text-sm font-medium text-gray-700 flex items-center gap-2",children:["Enable Batch Training",a.jsx("button",{type:"button",onClick:()=>f(!d),className:"text-gray-400 hover:text-gray-600",children:a.jsx(Mb,{className:"w-4 h-4"})})]})}),a.jsx("input",{type:"checkbox",id:"batchMode",checked:y.retraining_job_attributes.batch_mode,onChange:Y=>N({...y,retraining_job_attributes:{...y.retraining_job_attributes,batch_mode:Y.target.checked}}),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"})]}),d&&a.jsx("div",{className:"bg-blue-50 rounded-lg p-4 text-sm text-blue-700",children:a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:"• When disabled, the model will train on the entire dataset in a single pass."}),a.jsx("li",{children:"• When enabled, the model will learn from small batches of data iteratively, improving training speed"})]})}),y.retraining_job_attributes.batch_mode&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Batch Size"}),a.jsx("input",{type:"number",value:y.retraining_job_attributes.batch_size,onChange:Y=>N({...y,retraining_job_attributes:{...y.retraining_job_attributes,batch_size:parseInt(Y.target.value)}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Batch Overlap"}),a.jsx("input",{type:"number",value:y.retraining_job_attributes.batch_overlap,onChange:Y=>N({...y,retraining_job_attributes:{...y.retraining_job_attributes,batch_overlap:parseInt(Y.target.value)}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"})]})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Batch Key"}),a.jsx(ot,{value:y.retraining_job_attributes.batch_key,onChange:Y=>N({...y,retraining_job_attributes:{...y.retraining_job_attributes,batch_key:Y}}),options:((De=(_e=r.dataset)==null?void 0:_e.columns)==null?void 0:De.map(Y=>({value:Y.name,label:Y.name})))||[],placeholder:"Select a column for batch key"})]})]})]}),a.jsxs("div",{className:"border-t border-gray-200 pt-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(on,{className:"w-5 h-5 text-blue-600"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Evaluator Configuration"})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Metric"}),a.jsx(ot,{options:av[r.task==="classification"?"classification":"regression"].map(Y=>({value:Y.value,label:Y.label,description:Y.description})),value:y.retraining_job_attributes.metric,onChange:Y=>S("metric",Y)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Threshold"}),a.jsx("input",{type:"number",value:y.retraining_job_attributes.threshold,onChange:Y=>S("threshold",parseFloat(Y.target.value)),step:.01,min:0,max:1,className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border"})]})]}),a.jsx("div",{className:"bg-blue-50 rounded-md p-4",children:a.jsxs("div",{className:"flex items-start",children:[a.jsx(on,{className:"w-5 h-5 text-blue-400 mt-0.5"}),a.jsxs("div",{className:"ml-3",children:[a.jsx("h3",{className:"text-sm font-medium text-blue-800",children:"Deployment Criteria"}),a.jsxs("p",{className:"mt-2 text-sm text-blue-700",children:["The model will be automatically deployed when the ",y.retraining_job_attributes.metric," is"," ",y.retraining_job_attributes.direction==="minimize"?"below":"above"," ",y.retraining_job_attributes.threshold,"."]})]})]})})]})]})]})}),a.jsx("div",{className:"space-y-8",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ui,{className:"w-5 h-5 text-blue-600"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Hyperparameter Tuning"})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:"tuningEnabled",checked:y.retraining_job_attributes.tuning_enabled||!1,onChange:Y=>N(pe=>({...pe,retraining_job_attributes:{...pe.retraining_job_attributes,tuning_enabled:Y.target.checked,tuner_config:Y.target.checked?{n_trials:10,config:g}:void 0}})),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),a.jsx("label",{htmlFor:"tuningEnabled",className:"ml-2 text-sm text-gray-700",children:"Enable tuning"})]})]}),y.retraining_job_attributes.tuning_enabled&&a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Frequency"}),a.jsx(ot,{options:[{value:"always",label:"Always",description:"Tune hyperparameters every time"},{value:"week",label:"Weekly",description:"Tune hyperparameters once every week"},{value:"month",label:"Monthly",description:"Tune hyperparameters once every month"}],value:y.retraining_job_attributes.tuning_frequency||"week",onChange:Y=>N(pe=>({...pe,retraining_job_attributes:{...pe.retraining_job_attributes,tuning_frequency:Y}}))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Number of Trials"}),a.jsx("input",{type:"number",min:"1",max:"1000",value:((me=y.retraining_job_attributes.tuner_config)==null?void 0:me.n_trials)||10,onChange:Y=>N(pe=>({...pe,retraining_job_attributes:{...pe.retraining_job_attributes,tuner_config:{...pe.retraining_job_attributes.tuner_config,n_trials:parseInt(Y.target.value)}}})),className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border"})]})]}),b()]})]})})]}),a.jsxs("div",{className:"flex justify-end gap-4 p-4 border-t",children:[a.jsx("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-500",children:"Cancel"}),a.jsx("button",{onClick:C,className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md",children:"Save Changes"})]})]})})}const yo=({error:e})=>e?a.jsxs("div",{className:"mt-1 flex items-center gap-1 text-sm text-red-600",children:[a.jsx(on,{className:"w-4 h-4"}),e]}):null;function ew({initialData:e,datasets:t,constants:n,isEditing:r,errors:i}){var z,B,H,ce,ue,we;const{rootPath:l}=_r().props,[u,d]=A.useState(!1),[f,m]=A.useState(!1),h=Td({model:{id:e==null?void 0:e.id,name:(e==null?void 0:e.name)||"",model_type:(e==null?void 0:e.model_type)||"xgboost",dataset_id:(e==null?void 0:e.dataset_id)||"",task:(e==null?void 0:e.task)||"classification",objective:(e==null?void 0:e.objective)||"binary:logistic",metrics:(e==null?void 0:e.metrics)||["accuracy"],retraining_job_attributes:e!=null&&e.retraining_job?{id:e.retraining_job.id,frequency:e.retraining_job.frequency,tuning_frequency:e.retraining_job.tuning_frequency||"month",batch_mode:e.retraining_job.batch_mode,batch_size:e.retraining_job.batch_size,batch_overlap:e.retraining_job.batch_overlap,batch_key:e.retraining_job.batch_key,at:{hour:((z=e.retraining_job.at)==null?void 0:z.hour)??2,day_of_week:((B=e.retraining_job.at)==null?void 0:B.day_of_week)??1,day_of_month:((H=e.retraining_job.at)==null?void 0:H.day_of_month)??1},active:e.retraining_job.active,metric:e.retraining_job.metric,threshold:e.retraining_job.threshold,tuner_config:e.retraining_job.tuner_config,tuning_enabled:e.retraining_job.tuning_enabled||!1}:void 0}}),{data:g,setData:y,post:N,patch:x,processing:b,errors:E}=h,w={...i,...E},S=((ce=n.objectives[g.model.model_type])==null?void 0:ce[g.model.task])||[];A.useEffect(()=>{var ne;if(e!=null&&e.metrics)y({...g,model:{...g.model,objective:g.model.task==="classification"?"binary:logistic":"reg:squarederror"}});else{const Z=((ne=n.metrics[g.model.task])==null?void 0:ne.map(de=>de.value))||[];y({...g,model:{...g.model,objective:g.model.task==="classification"?"binary:logistic":"reg:squarederror",metrics:Z}})}},[g.model.task]),A.useEffect(()=>{f&&(O(),m(!1))},[f]);const C=ne=>{y({...g,model:{...g.model,retraining_job_attributes:ne.retraining_job_attributes}}),m(!0)},O=()=>{if(g.model.retraining_job_attributes){const ne={hour:g.model.retraining_job_attributes.at.hour};switch(g.model.retraining_job_attributes.frequency){case"day":break;case"week":ne.day_of_week=g.model.retraining_job_attributes.at.day_of_week;break;case"month":ne.day_of_month=g.model.retraining_job_attributes.at.day_of_month;break}y("model.retraining_job_attributes.at",ne)}g.model.id?x(`${l}/models/${g.model.id}`,{onSuccess:()=>{rt.visit(`${l}/models`)}}):N(`${l}/models`,{onSuccess:()=>{rt.visit(`${l}/models`)}})},R=ne=>{ne.preventDefault(),O()};console.log(g.model);const F=t.find(ne=>ne.id===g.model.dataset_id),D=n.tuner_job_constants[g.model.model_type]||{};return a.jsxs("form",{onSubmit:R,className:"space-y-8",children:[a.jsxs("div",{className:"flex justify-between items-center border-b pb-4",children:[a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Model Configuration"}),a.jsxs("button",{type:"button",onClick:()=>d(!0),className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(PT,{className:"w-4 h-4"}),"Configure Training"]})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:"Model Name"}),a.jsx("input",{type:"text",id:"name",value:g.model.name,onChange:ne=>y("model.name",ne.target.value),className:"block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border"}),a.jsx(yo,{error:w.name})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Model Type"}),a.jsx(ot,{options:[{value:"xgboost",label:"XGBoost",description:"Gradient boosting framework"}],value:g.model.model_type,onChange:ne=>y("model.model_type",ne),placeholder:"Select model type"}),a.jsx(yo,{error:w.model_type})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Dataset"}),r?a.jsxs("div",{className:"flex items-center gap-2 p-2 bg-gray-50 rounded-md border border-gray-200",children:[a.jsx(ST,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-gray-700",children:F==null?void 0:F.name})]}):a.jsx(ot,{options:t.map(ne=>({value:ne.id,label:ne.name,description:`${ne.num_rows.toLocaleString()} rows`})),value:g.model.dataset_id,onChange:ne=>y("model.dataset_id",ne),placeholder:"Select dataset"}),a.jsx(yo,{error:w.dataset_id})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Task"}),a.jsx(ot,{options:n.tasks,value:g.model.task,onChange:ne=>y("model.task",ne),placeholder:"Select task"}),a.jsx(yo,{error:w.task})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Objective"}),a.jsx(ot,{options:S||[],value:g.model.objective,onChange:ne=>y("model.objective",ne),placeholder:"Select objective"}),a.jsx(yo,{error:w.objective})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Metrics"}),a.jsx("div",{className:"grid grid-cols-2 gap-4",children:(ue=n.metrics[g.model.task])==null?void 0:ue.map(ne=>a.jsxs("label",{className:"relative flex items-center px-4 py-3 bg-white border rounded-lg hover:bg-gray-50 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:g.model.metrics.includes(ne.value),onChange:Z=>{const de=Z.target.checked?[...g.model.metrics,ne.value]:g.model.metrics.filter(se=>se!==ne.value);y("model.metrics",de)},className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),a.jsxs("div",{className:"ml-3",children:[a.jsx("span",{className:"block text-sm font-medium text-gray-900",children:ne.label}),a.jsx("span",{className:"block text-xs text-gray-500",children:ne.direction==="maximize"?"Higher is better":"Lower is better"})]})]},ne.value))})]})]}),g.model.retraining_job_attributes&&g.model.retraining_job_attributes.batch_mode&&a.jsx(a.Fragment,{children:a.jsxs("div",{className:"mt-4",children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Batch Key"}),a.jsx(ot,{value:g.model.retraining_job_attributes.batch_key||"",onChange:ne=>y("model",{...g.model,retraining_job_attributes:{...g.model.retraining_job_attributes,batch_key:ne}}),options:((we=F==null?void 0:F.columns)==null?void 0:we.map(ne=>({value:ne.name,label:ne.name})))||[],placeholder:"Select a column for batch key"}),a.jsx(yo,{error:w["model.retraining_job_attributes.batch_key"]})]})}),a.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[a.jsx("button",{type:"button",onClick:()=>rt.visit(`${l}/models`),className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900",children:"Cancel"}),a.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:r?"Save Changes":"Create Model"})]}),a.jsx(LR,{isOpen:u,onClose:()=>d(!1),onSave:C,initialData:{task:g.model.task,metrics:g.model.metrics,modelType:g.model.model_type,dataset:F,retraining_job:g.model.retraining_job_attributes},tunerJobConstants:D,timezone:n.timezone,retrainingJobConstants:n.retraining_job_constants})]})}function MR({model:e,datasets:t,constants:n}){return a.jsx("div",{className:"max-w-3xl mx-auto py-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg",children:[a.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Bs,{className:"w-6 h-6 text-blue-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Edit Model"})]})}),a.jsx("div",{className:"p-6",children:a.jsx(ew,{initialData:e,datasets:t,constants:n,isEditing:!0})})]})})}const FR=Object.freeze(Object.defineProperty({__proto__:null,default:MR},Symbol.toStringTag,{value:"Module"})),Xe=e=>{const t=new Date;return t.setDate(t.getDate()-e),t.toISOString()},tw=[{id:1,name:"Customer Churn Dataset",description:"Historical customer data for churn prediction",columns:[{name:"usage_days",type:"numeric",description:"Number of days customer has used the product",statistics:{mean:145.7,median:130,min:1,max:365,nullCount:0}},{name:"total_spend",type:"numeric",description:"Total customer spend in USD",statistics:{mean:487.32,median:425.5,min:0,max:2500,nullCount:1250}},{name:"support_tickets",type:"numeric",description:"Number of support tickets opened",statistics:{mean:2.3,median:1,min:0,max:15,nullCount:3750}},{name:"subscription_tier",type:"categorical",description:"Customer subscription level",statistics:{uniqueCount:3,nullCount:125}},{name:"last_login",type:"datetime",description:"Last time the customer logged in",statistics:{nullCount:5e3}}],sampleData:[{usage_days:234,total_spend:567.89,support_tickets:1,subscription_tier:"premium",last_login:"2024-03-01"},{usage_days:45,total_spend:null,support_tickets:null,subscription_tier:"basic",last_login:null}],rowCount:25e3,updatedAt:"2024-03-10T12:00:00Z"}];Xe(30),Xe(0);Xe(7),Xe(1),Xe(30),Xe(0);Xe(1),Xe(1),Xe(1),Xe(1),Xe(2),Xe(2),Xe(2),Xe(2),Xe(3),Xe(3),Xe(3),Xe(3),Xe(4),Xe(4),Xe(4),Xe(4);const $R=[{id:1,name:"Normalize state",description:"Turn state names into 2 letter state abbreviations",groupId:1,testDatasetId:1,inputColumns:["state"],outputColumns:["state"],code:"",createdAt:Xe(30),updatedAt:Xe(0)}],Ni=[{id:1,name:"Customer Churn",description:"Features for customer churn dataset",features:$R,createdAt:Xe(30),updatedAt:Xe(0)}];function DR({value:e,onChange:t,language:n}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"bg-gray-900 rounded-lg overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-800",children:[a.jsx("span",{className:"text-sm text-gray-400",children:"Ruby Feature"}),a.jsx("span",{className:"text-xs px-2 py-1 bg-gray-700 rounded text-gray-300",children:n})]}),a.jsx("textarea",{value:e,onChange:r=>t(r.target.value),className:"w-full h-64 p-4 bg-gray-900 text-gray-100 font-mono text-sm focus:outline-none",placeholder:`def transform(df)
|
434
434
|
# Your feature code here
|
435
435
|
# Example:
|
436
436
|
# df["column"] = df["column"].map { |value| value.upcase }
|
@@ -481,3 +481,4 @@ Error generating stack: `+l.message+`
|
|
481
481
|
flex-grow: 1;
|
482
482
|
}
|
483
483
|
`},nonce:l}),a.jsx(vs.div,{"data-radix-scroll-area-viewport":"",...u,asChild:i,ref:m,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...e.style},children:tM({asChild:i,children:r},h=>a.jsx("div",{"data-radix-scroll-area-content":"",ref:d.onContentChange,style:{minWidth:d.scrollbarXEnabled?"fit-content":void 0},children:h}))})]})});pS.displayName=fS;var zr="ScrollAreaScrollbar",Kg=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=sr(zr,e.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:u}=i,d=e.orientation==="horizontal";return A.useEffect(()=>(d?l(!0):u(!0),()=>{d?l(!1):u(!1)}),[d,l,u]),i.type==="hover"?a.jsx(qL,{...r,ref:t,forceMount:n}):i.type==="scroll"?a.jsx(GL,{...r,ref:t,forceMount:n}):i.type==="auto"?a.jsx(mS,{...r,ref:t,forceMount:n}):i.type==="always"?a.jsx(Qg,{...r,ref:t}):null});Kg.displayName=zr;var qL=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=sr(zr,e.__scopeScrollArea),[l,u]=A.useState(!1);return A.useEffect(()=>{const d=i.scrollArea;let f=0;if(d){const m=()=>{window.clearTimeout(f),u(!0)},h=()=>{f=window.setTimeout(()=>u(!1),i.scrollHideDelay)};return d.addEventListener("pointerenter",m),d.addEventListener("pointerleave",h),()=>{window.clearTimeout(f),d.removeEventListener("pointerenter",m),d.removeEventListener("pointerleave",h)}}},[i.scrollArea,i.scrollHideDelay]),a.jsx(da,{present:n||l,children:a.jsx(mS,{"data-state":l?"visible":"hidden",...r,ref:t})})}),GL=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=sr(zr,e.__scopeScrollArea),l=e.orientation==="horizontal",u=Kd(()=>f("SCROLL_END"),100),[d,f]=HL("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return A.useEffect(()=>{if(d==="idle"){const m=window.setTimeout(()=>f("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(m)}},[d,i.scrollHideDelay,f]),A.useEffect(()=>{const m=i.viewport,h=l?"scrollLeft":"scrollTop";if(m){let g=m[h];const y=()=>{const N=m[h];g!==N&&(f("SCROLL"),u()),g=N};return m.addEventListener("scroll",y),()=>m.removeEventListener("scroll",y)}},[i.viewport,l,f,u]),a.jsx(da,{present:n||d!=="hidden",children:a.jsx(Qg,{"data-state":d==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Ys(e.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:Ys(e.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),mS=A.forwardRef((e,t)=>{const n=sr(zr,e.__scopeScrollArea),{forceMount:r,...i}=e,[l,u]=A.useState(!1),d=e.orientation==="horizontal",f=Kd(()=>{if(n.viewport){const m=n.viewport.offsetWidth<n.viewport.scrollWidth,h=n.viewport.offsetHeight<n.viewport.scrollHeight;u(d?m:h)}},10);return ea(n.viewport,f),ea(n.content,f),a.jsx(da,{present:r||l,children:a.jsx(Qg,{"data-state":l?"visible":"hidden",...i,ref:t})})}),Qg=A.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,i=sr(zr,e.__scopeScrollArea),l=A.useRef(null),u=A.useRef(0),[d,f]=A.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=vS(d.viewport,d.content),h={...r,sizes:d,onSizesChange:f,hasThumb:m>0&&m<1,onThumbChange:y=>l.current=y,onThumbPointerUp:()=>u.current=0,onThumbPointerDown:y=>u.current=y};function g(y,N){return ZL(y,u.current,d,N)}return n==="horizontal"?a.jsx(KL,{...h,ref:t,onThumbPositionChange:()=>{if(i.viewport&&l.current){const y=i.viewport.scrollLeft,N=h1(y,d,i.dir);l.current.style.transform=`translate3d(${N}px, 0, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollLeft=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollLeft=g(y,i.dir))}}):n==="vertical"?a.jsx(QL,{...h,ref:t,onThumbPositionChange:()=>{if(i.viewport&&l.current){const y=i.viewport.scrollTop,N=h1(y,d);l.current.style.transform=`translate3d(0, ${N}px, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollTop=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollTop=g(y))}}):null}),KL=A.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,l=sr(zr,e.__scopeScrollArea),[u,d]=A.useState(),f=A.useRef(null),m=ii(t,f,l.onScrollbarXChange);return A.useEffect(()=>{f.current&&d(getComputedStyle(f.current))},[f]),a.jsx(gS,{"data-orientation":"horizontal",...i,ref:m,sizes:n,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Gd(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,g)=>{if(l.viewport){const y=l.viewport.scrollLeft+h.deltaX;e.onWheelScroll(y),wS(y,g)&&h.preventDefault()}},onResize:()=>{f.current&&l.viewport&&u&&r({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:wd(u.paddingLeft),paddingEnd:wd(u.paddingRight)}})}})}),QL=A.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,l=sr(zr,e.__scopeScrollArea),[u,d]=A.useState(),f=A.useRef(null),m=ii(t,f,l.onScrollbarYChange);return A.useEffect(()=>{f.current&&d(getComputedStyle(f.current))},[f]),a.jsx(gS,{"data-orientation":"vertical",...i,ref:m,sizes:n,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Gd(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,g)=>{if(l.viewport){const y=l.viewport.scrollTop+h.deltaY;e.onWheelScroll(y),wS(y,g)&&h.preventDefault()}},onResize:()=>{f.current&&l.viewport&&u&&r({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:wd(u.paddingTop),paddingEnd:wd(u.paddingBottom)}})}})}),[XL,hS]=cS(zr),gS=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:l,onThumbPointerUp:u,onThumbPointerDown:d,onThumbPositionChange:f,onDragScroll:m,onWheelScroll:h,onResize:g,...y}=e,N=sr(zr,n),[x,b]=A.useState(null),E=ii(t,B=>b(B)),w=A.useRef(null),S=A.useRef(""),C=N.viewport,O=r.content-r.viewport,R=us(h),F=us(f),D=Kd(g,10);function z(B){if(w.current){const H=B.clientX-w.current.left,ce=B.clientY-w.current.top;m({x:H,y:ce})}}return A.useEffect(()=>{const B=H=>{const ce=H.target;(x==null?void 0:x.contains(ce))&&R(H,O)};return document.addEventListener("wheel",B,{passive:!1}),()=>document.removeEventListener("wheel",B,{passive:!1})},[C,x,O,R]),A.useEffect(F,[r,F]),ea(x,D),ea(N.content,D),a.jsx(XL,{scope:n,scrollbar:x,hasThumb:i,onThumbChange:us(l),onThumbPointerUp:us(u),onThumbPositionChange:F,onThumbPointerDown:us(d),children:a.jsx(vs.div,{...y,ref:E,style:{position:"absolute",...y.style},onPointerDown:Ys(e.onPointerDown,B=>{B.button===0&&(B.target.setPointerCapture(B.pointerId),w.current=x.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",N.viewport&&(N.viewport.style.scrollBehavior="auto"),z(B))}),onPointerMove:Ys(e.onPointerMove,z),onPointerUp:Ys(e.onPointerUp,B=>{const H=B.target;H.hasPointerCapture(B.pointerId)&&H.releasePointerCapture(B.pointerId),document.body.style.webkitUserSelect=S.current,N.viewport&&(N.viewport.style.scrollBehavior=""),w.current=null})})})}),bd="ScrollAreaThumb",yS=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=hS(bd,e.__scopeScrollArea);return a.jsx(da,{present:n||i.hasThumb,children:a.jsx(YL,{ref:t,...r})})}),YL=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...i}=e,l=sr(bd,n),u=hS(bd,n),{onThumbPositionChange:d}=u,f=ii(t,g=>u.onThumbChange(g)),m=A.useRef(),h=Kd(()=>{m.current&&(m.current(),m.current=void 0)},100);return A.useEffect(()=>{const g=l.viewport;if(g){const y=()=>{if(h(),!m.current){const N=eM(g,d);m.current=N,d()}};return d(),g.addEventListener("scroll",y),()=>g.removeEventListener("scroll",y)}},[l.viewport,h,d]),a.jsx(vs.div,{"data-state":u.hasThumb?"visible":"hidden",...i,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ys(e.onPointerDownCapture,g=>{const N=g.target.getBoundingClientRect(),x=g.clientX-N.left,b=g.clientY-N.top;u.onThumbPointerDown({x,y:b})}),onPointerUp:Ys(e.onPointerUp,u.onThumbPointerUp)})});yS.displayName=bd;var Xg="ScrollAreaCorner",xS=A.forwardRef((e,t)=>{const n=sr(Xg,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(JL,{...e,ref:t}):null});xS.displayName=Xg;var JL=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,i=sr(Xg,n),[l,u]=A.useState(0),[d,f]=A.useState(0),m=!!(l&&d);return ea(i.scrollbarX,()=>{var g;const h=((g=i.scrollbarX)==null?void 0:g.offsetHeight)||0;i.onCornerHeightChange(h),f(h)}),ea(i.scrollbarY,()=>{var g;const h=((g=i.scrollbarY)==null?void 0:g.offsetWidth)||0;i.onCornerWidthChange(h),u(h)}),m?a.jsx(vs.div,{...r,ref:t,style:{width:l,height:d,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function wd(e){return e?parseInt(e,10):0}function vS(e,t){const n=e/t;return isNaN(n)?0:n}function Gd(e){const t=vS(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function ZL(e,t,n,r="ltr"){const i=Gd(n),l=i/2,u=t||l,d=i-u,f=n.scrollbar.paddingStart+u,m=n.scrollbar.size-n.scrollbar.paddingEnd-d,h=n.content-n.viewport,g=r==="ltr"?[0,h]:[h*-1,0];return bS([f,m],g)(e)}function h1(e,t,n="ltr"){const r=Gd(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-i,u=t.content-t.viewport,d=l-r,f=n==="ltr"?[0,u]:[u*-1,0],m=WL(e,f);return bS([0,u],[0,d])(m)}function bS(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function wS(e,t){return e>0&&e<t}var eM=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function i(){const l={left:e.scrollLeft,top:e.scrollTop},u=n.left!==l.left,d=n.top!==l.top;(u||d)&&t(),n=l,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function Kd(e,t){const n=us(e),r=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(r.current),[]),A.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ea(e,t){const n=us(t);Ll(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}function tM(e,t){const{asChild:n,children:r}=e;if(!n)return typeof t=="function"?t(r):t;const i=A.Children.only(r);return A.cloneElement(i,{children:typeof t=="function"?t(i.props.children):t})}var _S=dS,nM=pS,rM=xS;const SS=A.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(_S,{ref:r,className:gr("relative overflow-hidden",e),...n,children:[a.jsx(nM,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(jS,{}),a.jsx(rM,{})]}));SS.displayName=_S.displayName;const jS=A.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(Kg,{ref:r,orientation:t,className:gr("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(yS,{className:"relative flex-1 rounded-full bg-border"})}));jS.displayName=Kg.displayName;var sM="Separator",g1="horizontal",iM=["horizontal","vertical"],NS=A.forwardRef((e,t)=>{const{decorative:n,orientation:r=g1,...i}=e,l=oM(r)?r:g1,d=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return a.jsx(vs.div,{"data-orientation":l,...d,...i,ref:t})});NS.displayName=sM;function oM(e){return iM.includes(e)}var CS=NS;const ES=A.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},i)=>a.jsx(CS,{ref:i,decorative:n,orientation:t,className:gr("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));ES.displayName=CS.displayName;function aM({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=lM({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:r,d=us(n),f=A.useCallback(m=>{if(l){const g=typeof m=="function"?m(e):m;g!==e&&d(g)}else i(m)},[l,e,i,d]);return[u,f]}function lM({defaultProp:e,onChange:t}){const n=A.useState(e),[r]=n,i=A.useRef(r),l=us(t);return A.useEffect(()=>{i.current!==r&&(l(r),i.current=r)},[r,i,l]),n}var uM=Ck.useId||(()=>{}),cM=0;function dM(e){const[t,n]=A.useState(uM());return Ll(()=>{e||n(r=>r??String(cM++))},[e]),e||(t?`radix-${t}`:"")}var Yg="Collapsible",[fM,kM]=uS(Yg),[pM,Jg]=fM(Yg),kS=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:l,onOpenChange:u,...d}=e,[f=!1,m]=aM({prop:r,defaultProp:i,onChange:u});return a.jsx(pM,{scope:n,disabled:l,contentId:dM(),open:f,onOpenToggle:A.useCallback(()=>m(h=>!h),[m]),children:a.jsx(vs.div,{"data-state":e0(f),"data-disabled":l?"":void 0,...d,ref:t})})});kS.displayName=Yg;var AS="CollapsibleTrigger",PS=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=Jg(AS,n);return a.jsx(vs.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":e0(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:Ys(e.onClick,i.onOpenToggle)})});PS.displayName=AS;var Zg="CollapsibleContent",TS=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Jg(Zg,e.__scopeCollapsible);return a.jsx(da,{present:n||i.open,children:({present:l})=>a.jsx(mM,{...r,ref:t,present:l})})});TS.displayName=Zg;var mM=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...l}=e,u=Jg(Zg,n),[d,f]=A.useState(r),m=A.useRef(null),h=ii(t,m),g=A.useRef(0),y=g.current,N=A.useRef(0),x=N.current,b=u.open||d,E=A.useRef(b),w=A.useRef();return A.useEffect(()=>{const S=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(S)},[]),Ll(()=>{const S=m.current;if(S){w.current=w.current||{transitionDuration:S.style.transitionDuration,animationName:S.style.animationName},S.style.transitionDuration="0s",S.style.animationName="none";const C=S.getBoundingClientRect();g.current=C.height,N.current=C.width,E.current||(S.style.transitionDuration=w.current.transitionDuration,S.style.animationName=w.current.animationName),f(r)}},[u.open,r]),a.jsx(vs.div,{"data-state":e0(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!b,...l,ref:h,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:b&&i})});function e0(e){return e?"open":"closed"}var hM=kS;const gM=hM,yM=PS,xM=TS;function y1({href:e,className:t=l=>"",activeClassName:n="active",children:r,...i}){const{rootPath:l,url:u}=_r().props,d=u===e;let f=t(d);return a.jsx(yr,{href:`${l}${e}`,className:gr(f,d&&n),...i,children:r})}const vM=[{title:"Models",icon:Bs,href:"/",children:[{title:"All Models",icon:Bs,href:"/models"},{title:"New Model",icon:Bs,href:"/models/new"}]},{title:"Datasources",icon:Ro,href:"/datasources",children:[{title:"All Datasources",icon:Ro,href:"/datasources"},{title:"New Datasource",icon:Ro,href:"/datasources/new"}]},{title:"Datasets",icon:Ln,href:"/datasets",children:[{title:"All Datasets",icon:Ln,href:"/datasets"},{title:"New Dataset",icon:Ln,href:"/datasets/new"}]}];function bM(e){const{rootPath:t}=_r().props,n=e.split("/").filter(Boolean),r=[];let i=t;if(n.length===0)return[];let l,u;switch(["datasources","datasets","models","settings"].includes(n[0])?(l=n[0],u=0):(l=n[1],u=1),l){case"models":r.push({title:"Models",href:`${t}/models`});break;case"datasources":r.push({title:"Datasources",href:`${t}/datasources`});break;case"datasets":r.push({title:"Datasets",href:`${t}/datasets`});break;case"settings":r.push({title:"Settings",href:`${t}/settings`});break;default:r.push({title:"Models",href:`${t}/models`})}for(let d=u+1;d<n.length;d++){const f=n[d];if(i+=`/${n[d]}`,n[d-1]==="datasets"&&f!=="new")r.push({title:"Details",href:i});else if(n[d-1]==="models"&&f!=="new")r.push({title:"Details",href:i});else{const m=f==="new"?"New":f==="edit"?"Edit":f.charAt(0).toUpperCase()+f.slice(1);r.push({title:m,href:i})}}return r}function wM({children:e}){const[t,n]=A.useState(!0),[r,i]=A.useState(["Models"]),l=bM(location.pathname),u=d=>{i(f=>f.includes(d)?f.filter(m=>m!==d):[...f,d])};return a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsxs("div",{className:gr("fixed left-0 top-0 z-40 h-screen bg-white border-r transition-all duration-300",t?"w-64":"w-16"),children:[a.jsxs("div",{className:"flex h-16 items-center border-b px-4",children:[t?a.jsxs(a.Fragment,{children:[a.jsx(Bs,{className:"w-8 h-8 text-blue-600"}),a.jsx("h1",{className:"text-xl font-bold text-gray-900 ml-2",children:"EasyML"})]}):a.jsx(Bs,{className:"w-8 h-8 text-blue-600"}),a.jsx("button",{onClick:()=>n(!t),className:"ml-auto p-2 hover:bg-gray-100 rounded-md",children:a.jsx(jT,{className:"w-4 h-4"})})]}),a.jsx(SS,{className:"h-[calc(100vh-4rem)] px-3",children:a.jsxs("div",{className:"space-y-2 py-4",children:[vM.map(d=>{var f;return a.jsxs(gM,{open:r.includes(d.title),onOpenChange:()=>u(d.title),children:[a.jsxs(yM,{className:"flex items-center w-full p-2 hover:bg-gray-100 rounded-md",children:[a.jsx(d.icon,{className:"w-4 h-4"}),t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"ml-2 text-sm font-medium flex-1 text-left",children:d.title}),r.includes(d.title)?a.jsx(oa,{className:"w-4 h-4"}):a.jsx(qo,{className:"w-4 h-4"})]})]}),a.jsx(xM,{children:t&&((f=d.children)==null?void 0:f.map(m=>a.jsxs(y1,{href:m.href,className:({isActive:h})=>gr("flex items-center pl-8 pr-2 py-2 text-sm rounded-md",h?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-50"),children:[a.jsx(m.icon,{className:"w-4 h-4"}),a.jsx("span",{className:"ml-2",children:m.title})]},m.href)))})]},d.title)}),a.jsx(ES,{className:"my-4"}),a.jsxs(y1,{href:"/settings",className:({isActive:d})=>gr("flex items-center w-full p-2 rounded-md",d?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-50"),children:[a.jsx(Ui,{className:"w-4 h-4"}),t&&a.jsx("span",{className:"ml-2 text-sm font-medium",children:"Settings"})]})]})})]}),a.jsxs("div",{className:gr("transition-all duration-300",t?"ml-64":"ml-16"),children:[a.jsx(PL,{}),a.jsx("div",{className:"h-16 border-b bg-white flex items-center px-4",children:a.jsx("nav",{className:"flex","aria-label":"Breadcrumb",children:a.jsx("ol",{className:"flex items-center space-x-2",children:l.map((d,f)=>a.jsxs(tr.Fragment,{children:[f>0&&a.jsx(qo,{className:"w-4 h-4 text-gray-400"}),a.jsx("li",{children:a.jsx(yr,{href:d.href,className:gr("text-sm",f===l.length-1?"text-blue-600 font-medium":"text-gray-500 hover:text-gray-700"),children:d.title})})]},d.href))})})}),a.jsx("main",{className:"min-h-[calc(100vh-4rem)]",children:e})]})]})}function _M({children:e}){const{showAlert:t}=oS(),{flash:n}=_r().props;return A.useEffect(()=>{n&&n.forEach(({type:r,message:i})=>{t(r,i)})},[n,t]),a.jsx(a.Fragment,{children:e})}function SM({children:e}){return a.jsx(AL,{children:a.jsx(_M,{children:a.jsx(wM,{children:e})})})}document.addEventListener("DOMContentLoaded",()=>{iT({resolve:e=>{let n=Object.assign({"../pages/DatasetDetailsPage.tsx":NR,"../pages/DatasetsPage.tsx":ER,"../pages/DatasourceFormPage.tsx":OR,"../pages/DatasourcesPage.tsx":IR,"../pages/EditModelPage.tsx":FR,"../pages/EditTransformationPage.tsx":BR,"../pages/ModelsPage.tsx":VR,"../pages/NewDatasetPage.tsx":l6,"../pages/NewModelPage.tsx":c6,"../pages/NewTransformationPage.tsx":f6,"../pages/SettingsPage.tsx":g6,"../pages/ShowModelPage.tsx":v6,"../pages/TransformationsPage.tsx":S6})[`../${e}.tsx`];if(!n.default){alert(`The page ${e} could not be found, you probably forgot to export default.`);return}return n.default.layout=n.default.layout||(r=>a.jsx(SM,{children:r})),n},setup({el:e,App:t,props:n}){sS(e).render(a.jsx(t,{...n}))}})});
|
484
|
+
//# sourceMappingURL=Application.tsx-BRRjHz4-.js.map
|