@morscherlab/mint-sdk 1.0.63 → 1.1.0-beta.2

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.
Files changed (165) hide show
  1. package/README.md +101 -2
  2. package/dist/EmptyState-D1c4RdC7.js +638 -0
  3. package/dist/EmptyState-D1c4RdC7.js.map +1 -0
  4. package/dist/{ExperimentPopover-BbPkIFsI.js → ExperimentPopover-BFw3QX8L.js} +10 -9
  5. package/dist/{ExperimentPopover-BbPkIFsI.js.map → ExperimentPopover-BFw3QX8L.js.map} +1 -1
  6. package/dist/{ExperimentSelectorModal-DZeSd-yr.js → ExperimentSelectorModal-B7w6k3Y8.js} +12 -216
  7. package/dist/ExperimentSelectorModal-B7w6k3Y8.js.map +1 -0
  8. package/dist/{SettingsModal-CJgLadsN.js → SettingsModal-DPDwCbXK.js} +12 -9
  9. package/dist/{SettingsModal-CJgLadsN.js.map → SettingsModal-DPDwCbXK.js.map} +1 -1
  10. package/dist/__tests__/components/GeneratedPlotlyResult.test.d.ts +1 -0
  11. package/dist/__tests__/components/GeneratedPluginView.test.d.ts +1 -0
  12. package/dist/__tests__/components/GeneratedResultRenderer.test.d.ts +1 -0
  13. package/dist/__tests__/components/InstrumentAlertLog.test.d.ts +1 -0
  14. package/dist/__tests__/composables/useGeneratedAnalysis.test.d.ts +1 -0
  15. package/dist/__tests__/generatedUi.test.d.ts +1 -0
  16. package/dist/{analysisArtifactTypes-Cu40dzSG.js → analysisArtifactTypes-ejqR8MX3.js} +1 -1
  17. package/dist/analysisArtifactTypes-ejqR8MX3.js.map +1 -0
  18. package/dist/{auth-DZAwEeis.js → auth-B87xM--s.js} +1 -1
  19. package/dist/{auth-DZAwEeis.js.map → auth-B87xM--s.js.map} +1 -1
  20. package/dist/chunk-BoAXSpZd.js +33 -0
  21. package/dist/components/AppSidebar.vue.d.ts +1 -1
  22. package/dist/components/AutoGroupModal.vue.d.ts +2 -2
  23. package/dist/components/BioTemplateExperimentWorkspaceView.vue.d.ts +2 -2
  24. package/dist/components/CollapsibleCard.vue.d.ts +1 -1
  25. package/dist/components/ComponentBindingRenderer.vue.d.ts +1 -1
  26. package/dist/components/ConfirmDialog.vue.d.ts +1 -1
  27. package/dist/components/ExperimentDataViewer.vue.d.ts +1 -1
  28. package/dist/components/ExperimentTimeline.vue.d.ts +1 -1
  29. package/dist/components/FileUploader.vue.d.ts +4 -2
  30. package/dist/components/FitPanel.vue.d.ts +1 -1
  31. package/dist/components/FormActions.vue.d.ts +1 -1
  32. package/dist/components/FormBuilder.vue.d.ts +1 -1
  33. package/dist/components/GeneratedPathInput.vue.d.ts +12 -0
  34. package/dist/components/GeneratedPlotlyResult.vue.d.ts +11 -0
  35. package/dist/components/GeneratedPluginView.vue.d.ts +10 -0
  36. package/dist/components/GeneratedResultRenderer.vue.d.ts +6 -0
  37. package/dist/components/JobsStatusTray.vue.d.ts +5 -1
  38. package/dist/components/LcmsSequenceTable.vue.d.ts +1 -1
  39. package/dist/components/SampleLegend.vue.d.ts +1 -1
  40. package/dist/components/SampleSelector.vue.d.ts +2 -2
  41. package/dist/components/SettingsModal.vue.d.ts +1 -1
  42. package/dist/components/SmartGroupFieldRecipe.vue.d.ts +2 -2
  43. package/dist/components/index.d.ts +4 -0
  44. package/dist/components/index.js +8 -9
  45. package/dist/components/internal/PlateMapEditorToolbarInternal.vue.d.ts +2 -2
  46. package/dist/{components-DdzHh3a_.js → components-UfkPN1bK.js} +2255 -2303
  47. package/dist/components-UfkPN1bK.js.map +1 -0
  48. package/dist/composables/index.d.ts +2 -3
  49. package/dist/composables/index.js +10 -11
  50. package/dist/composables/platformContextHelpers.d.ts +0 -2
  51. package/dist/composables/useAnalysisArtifacts.d.ts +1 -3
  52. package/dist/composables/useGeneratedAnalysis.d.ts +62 -0
  53. package/dist/composables/useJobsStatusTray.d.ts +48 -4
  54. package/dist/composables/usePlatformContext.d.ts +3 -0
  55. package/dist/composables/usePluginClient.d.ts +6 -3
  56. package/dist/{composables-BUUphBqg.js → composables-B512bWJP.js} +155 -74
  57. package/dist/composables-B512bWJP.js.map +1 -0
  58. package/dist/experiment-utils-CxkruZ3G.js +392 -0
  59. package/dist/experiment-utils-CxkruZ3G.js.map +1 -0
  60. package/dist/generated/schema.d.ts +7 -0
  61. package/dist/generated-ui/main.d.ts +0 -0
  62. package/dist/index.d.ts +1 -0
  63. package/dist/index.js +15 -18
  64. package/dist/index.js.map +1 -1
  65. package/dist/install.js +7 -8
  66. package/dist/install.js.map +1 -1
  67. package/dist/plotly.min-BR53hja4.js +180634 -0
  68. package/dist/plotly.min-BR53hja4.js.map +1 -0
  69. package/dist/stores/auth.d.ts +2 -2
  70. package/dist/stores/index.js +1 -1
  71. package/dist/styles.css +10543 -10404
  72. package/dist/templates/index.js +4 -3
  73. package/dist/templates/packs.d.ts +0 -1
  74. package/dist/{templates-CNbPQNID.js → templates-Cttbjbyc.js} +2 -4
  75. package/dist/templates-Cttbjbyc.js.map +1 -0
  76. package/dist/types/analysisArtifactTypes.d.ts +0 -8
  77. package/dist/types/form-builder.d.ts +1 -1
  78. package/dist/types/generated-ui.d.ts +170 -0
  79. package/dist/types/index.d.ts +2 -1
  80. package/dist/types/index.js +1 -1
  81. package/dist/types/instrument.d.ts +1 -0
  82. package/dist/types/jobs.d.ts +7 -1
  83. package/dist/types/platform.d.ts +2 -0
  84. package/dist/{useControlSchema-BZNdalmL.js → useControlSchema-Dallso-L.js} +1852 -171
  85. package/dist/useControlSchema-Dallso-L.js.map +1 -0
  86. package/dist/{useDropdownState-Bb-c_PeE.js → useDropdownState-gVaMXtwW.js} +2 -2
  87. package/dist/{useDropdownState-Bb-c_PeE.js.map → useDropdownState-gVaMXtwW.js.map} +1 -1
  88. package/dist/{useExperimentSelector-DRbj6vse.js → useExperimentSelector-BMjzNcf2.js} +4 -255
  89. package/dist/useExperimentSelector-BMjzNcf2.js.map +1 -0
  90. package/dist/{useFormBuilder-DKekvXRs.js → useFormBuilder-BXaaDI41.js} +2 -2
  91. package/dist/{useFormBuilder-DKekvXRs.js.map → useFormBuilder-BXaaDI41.js.map} +1 -1
  92. package/dist/{useAnalysisArtifacts-C3l0a0vu.js → useProtocolTemplates-BP7_4RGQ.js} +307 -475
  93. package/dist/useProtocolTemplates-BP7_4RGQ.js.map +1 -0
  94. package/package.json +7 -3
  95. package/src/__tests__/components/GeneratedPathInput.test.ts +132 -0
  96. package/src/__tests__/components/GeneratedPlotlyResult.test.ts +117 -0
  97. package/src/__tests__/components/GeneratedPluginView.test.ts +230 -0
  98. package/src/__tests__/components/GeneratedResultRenderer.test.ts +93 -0
  99. package/src/__tests__/components/InstrumentAlertLog.test.ts +59 -0
  100. package/src/__tests__/composables/formBuilderRegistry.test.ts +5 -1
  101. package/src/__tests__/composables/useAnalysisArtifacts.test.ts +1 -74
  102. package/src/__tests__/composables/useApi.test.ts +8 -0
  103. package/src/__tests__/composables/useGeneratedAnalysis.test.ts +1740 -0
  104. package/src/__tests__/composables/useJobsStatusTray.test.ts +179 -1
  105. package/src/__tests__/composables/usePlatformContext.test.ts +28 -0
  106. package/src/__tests__/composables/usePluginClient.test.ts +366 -20
  107. package/src/__tests__/composables/usePluginConfig.test.ts +323 -7
  108. package/src/__tests__/docs/extractDocsTemplates.test.ts +0 -1
  109. package/src/__tests__/generatedUi.test.ts +119 -0
  110. package/src/__tests__/templates/templates.test.ts +1 -1
  111. package/src/components/FileUploader.vue +49 -11
  112. package/src/components/GeneratedPathInput.vue +218 -0
  113. package/src/components/GeneratedPlotlyResult.vue +87 -0
  114. package/src/components/GeneratedPluginView.vue +279 -0
  115. package/src/components/GeneratedResultRenderer.vue +137 -0
  116. package/src/components/InstrumentAlertLog.vue +2 -2
  117. package/src/components/JobsStatusTray.vue +14 -8
  118. package/src/components/index.ts +4 -0
  119. package/src/composables/formBuilderRegistry.ts +2 -0
  120. package/src/composables/index.ts +18 -5
  121. package/src/composables/platformContextHelpers.ts +3 -10
  122. package/src/composables/useAnalysisArtifacts.ts +0 -48
  123. package/src/composables/useApi.ts +1 -0
  124. package/src/composables/useGeneratedAnalysis.ts +1252 -0
  125. package/src/composables/useJobsStatusTray.ts +234 -45
  126. package/src/composables/usePluginClient.ts +152 -25
  127. package/src/composables/usePluginConfig.ts +156 -20
  128. package/src/generated/schema.ts +130 -0
  129. package/src/generated-ui/main.ts +21 -0
  130. package/src/index.ts +3 -0
  131. package/src/jobs.ts +5 -0
  132. package/src/plotly-dist.d.ts +3 -0
  133. package/src/templates/packs.ts +0 -3
  134. package/src/types/analysisArtifactTypes.ts +0 -9
  135. package/src/types/form-builder.ts +1 -0
  136. package/src/types/generated-ui.ts +176 -0
  137. package/src/types/index.ts +2 -1
  138. package/src/types/instrument.ts +1 -0
  139. package/src/types/jobs.ts +10 -1
  140. package/src/types/platform.ts +2 -0
  141. package/dist/BaseButton-Dgqrze41.js +0 -74
  142. package/dist/BaseButton-Dgqrze41.js.map +0 -1
  143. package/dist/BaseModal-B9UA8Y_I.js +0 -165
  144. package/dist/BaseModal-B9UA8Y_I.js.map +0 -1
  145. package/dist/BaseSelect-ekgr9fDo.js +0 -179
  146. package/dist/BaseSelect-ekgr9fDo.js.map +0 -1
  147. package/dist/ExperimentPopover-Ryusjrhv.js +0 -4
  148. package/dist/ExperimentSelectorModal-Cg4-LXBD.js +0 -5
  149. package/dist/ExperimentSelectorModal-DZeSd-yr.js.map +0 -1
  150. package/dist/SettingsModal-Bl_9w2Y3.js +0 -5
  151. package/dist/analysisArtifactTypes-Cu40dzSG.js.map +0 -1
  152. package/dist/components-DdzHh3a_.js.map +0 -1
  153. package/dist/composables/analysisArtifactTarget.d.ts +0 -5
  154. package/dist/composables-BUUphBqg.js.map +0 -1
  155. package/dist/experiment-utils-Bfa7CwPU.js +0 -108
  156. package/dist/experiment-utils-Bfa7CwPU.js.map +0 -1
  157. package/dist/templates-CNbPQNID.js.map +0 -1
  158. package/dist/useAnalysisArtifacts-C3l0a0vu.js.map +0 -1
  159. package/dist/useControlSchema-BZNdalmL.js.map +0 -1
  160. package/dist/useEventListener-CfVkP9Xz.js +0 -57
  161. package/dist/useEventListener-CfVkP9Xz.js.map +0 -1
  162. package/dist/useExperimentSelector-DRbj6vse.js.map +0 -1
  163. package/src/__tests__/composables/analysisArtifactTarget.test.ts +0 -77
  164. package/src/composables/analysisArtifactTarget.ts +0 -53
  165. /package/dist/__tests__/{composables/analysisArtifactTarget.test.d.ts → components/GeneratedPathInput.test.d.ts} +0 -0
@@ -0,0 +1,638 @@
1
+ import { p as BaseButton_default } from "./experiment-utils-CxkruZ3G.js";
2
+ import { r as useSettingsStore, t as useAuthStore } from "./auth-B87xM--s.js";
3
+ import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, renderList, renderSlot, toDisplayString, withCtx } from "vue";
4
+ import axios from "axios";
5
+ //#region src/components/BaseInput.vue?vue&type=script&setup=true&lang.ts
6
+ var _hoisted_1$3 = [
7
+ "type",
8
+ "value",
9
+ "placeholder",
10
+ "disabled",
11
+ "readonly",
12
+ "autocomplete",
13
+ "autofocus",
14
+ "min",
15
+ "max",
16
+ "step",
17
+ "list",
18
+ "aria-invalid",
19
+ "aria-describedby"
20
+ ];
21
+ //#endregion
22
+ //#region src/components/BaseInput.vue
23
+ var BaseInput_default = /* @__PURE__ */ defineComponent({
24
+ __name: "BaseInput",
25
+ props: {
26
+ modelValue: {},
27
+ type: { default: "text" },
28
+ placeholder: {},
29
+ disabled: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ readonly: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ error: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ size: { default: "md" },
42
+ autocomplete: {},
43
+ autofocus: { type: Boolean },
44
+ min: {},
45
+ max: {},
46
+ step: {},
47
+ list: {},
48
+ ariaDescribedby: {}
49
+ },
50
+ emits: [
51
+ "update:modelValue",
52
+ "focus",
53
+ "blur",
54
+ "keydown"
55
+ ],
56
+ setup(__props, { emit: __emit }) {
57
+ /** Renders a styled `<input>` supporting text/number/email types, size, error, and readonly states. */
58
+ const props = __props;
59
+ const emit = __emit;
60
+ function handleInput(event) {
61
+ const target = event.target;
62
+ emit("update:modelValue", props.type === "number" ? target.value === "" ? null : Number(target.value) : target.value);
63
+ }
64
+ return (_ctx, _cache) => {
65
+ return openBlock(), createElementBlock("input", {
66
+ type: __props.type,
67
+ value: __props.modelValue,
68
+ placeholder: __props.placeholder,
69
+ disabled: __props.disabled,
70
+ readonly: __props.readonly,
71
+ autocomplete: __props.autocomplete,
72
+ autofocus: __props.autofocus,
73
+ min: __props.min,
74
+ max: __props.max,
75
+ step: __props.step,
76
+ list: __props.list,
77
+ "aria-invalid": __props.error || void 0,
78
+ "aria-describedby": __props.ariaDescribedby || void 0,
79
+ class: normalizeClass([
80
+ "mint-input",
81
+ `mint-input--${__props.size}`,
82
+ __props.error ? "mint-input--error" : "",
83
+ __props.disabled ? "mint-input--disabled" : ""
84
+ ]),
85
+ onInput: handleInput,
86
+ onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
87
+ onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event)),
88
+ onKeydown: _cache[2] || (_cache[2] = ($event) => emit("keydown", $event))
89
+ }, null, 42, _hoisted_1$3);
90
+ };
91
+ }
92
+ });
93
+ //#endregion
94
+ //#region src/utils/options.ts
95
+ function normalizeOptionInput(option) {
96
+ if (typeof option === "object") return option;
97
+ return {
98
+ value: option,
99
+ label: String(option)
100
+ };
101
+ }
102
+ function findOptionByDomValue(options, value) {
103
+ return options.find((option) => String(option.value) === value);
104
+ }
105
+ //#endregion
106
+ //#region src/components/BaseSelect.vue?vue&type=script&setup=true&lang.ts
107
+ var _hoisted_1$2 = { class: "mint-select" };
108
+ var _hoisted_2$2 = [
109
+ "value",
110
+ "disabled",
111
+ "aria-invalid",
112
+ "aria-describedby"
113
+ ];
114
+ var _hoisted_3$1 = {
115
+ key: 0,
116
+ value: "",
117
+ disabled: ""
118
+ };
119
+ var _hoisted_4$1 = ["value", "disabled"];
120
+ //#endregion
121
+ //#region src/components/BaseSelect.vue
122
+ var BaseSelect_default = /* @__PURE__ */ defineComponent({
123
+ __name: "BaseSelect",
124
+ props: {
125
+ modelValue: {},
126
+ options: {},
127
+ placeholder: {},
128
+ disabled: {
129
+ type: Boolean,
130
+ default: false
131
+ },
132
+ error: {
133
+ type: Boolean,
134
+ default: false
135
+ },
136
+ size: { default: "md" },
137
+ ariaDescribedby: {}
138
+ },
139
+ emits: ["update:modelValue"],
140
+ setup(__props, { emit: __emit }) {
141
+ /** Renders a native `<select>` element with size, error, and disabled states. */
142
+ const props = __props;
143
+ const emit = __emit;
144
+ const normalizedOptions = computed(() => props.options.map(normalizeOptionInput));
145
+ function handleChange(event) {
146
+ const target = event.target;
147
+ emit("update:modelValue", findOptionByDomValue(normalizedOptions.value, target.value)?.value ?? target.value);
148
+ }
149
+ return (_ctx, _cache) => {
150
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [createElementVNode("select", {
151
+ value: __props.modelValue,
152
+ disabled: __props.disabled,
153
+ "aria-invalid": __props.error || void 0,
154
+ "aria-describedby": __props.ariaDescribedby || void 0,
155
+ class: normalizeClass([
156
+ "mint-select__control",
157
+ `mint-select__control--${__props.size}`,
158
+ __props.error ? "mint-select__control--error" : "",
159
+ __props.disabled ? "mint-select__control--disabled" : ""
160
+ ]),
161
+ onChange: handleChange
162
+ }, [__props.placeholder ? (openBlock(), createElementBlock("option", _hoisted_3$1, toDisplayString(__props.placeholder), 1)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(normalizedOptions.value, (option) => {
163
+ return openBlock(), createElementBlock("option", {
164
+ key: String(option.value),
165
+ value: option.value,
166
+ disabled: option.disabled
167
+ }, toDisplayString(option.label), 9, _hoisted_4$1);
168
+ }), 128))], 42, _hoisted_2$2), _cache[0] || (_cache[0] = createElementVNode("div", { class: "mint-select__icon" }, [createElementVNode("svg", {
169
+ fill: "none",
170
+ stroke: "currentColor",
171
+ "stroke-width": "2",
172
+ "stroke-linecap": "round",
173
+ "stroke-linejoin": "round",
174
+ viewBox: "0 0 24 24"
175
+ }, [createElementVNode("path", { d: "m6 9 6 6 6-6" })])], -1))]);
176
+ };
177
+ }
178
+ });
179
+ //#endregion
180
+ //#region src/components/BasePill.vue?vue&type=script&setup=true&lang.ts
181
+ var _hoisted_1$1 = {
182
+ key: 0,
183
+ class: "mint-pill__icon"
184
+ };
185
+ var _hoisted_2$1 = { class: "mint-pill__label" };
186
+ //#endregion
187
+ //#region src/components/BasePill.vue
188
+ var BasePill_default = /* @__PURE__ */ defineComponent({
189
+ __name: "BasePill",
190
+ props: {
191
+ variant: { default: "default" },
192
+ color: { default: void 0 },
193
+ size: { default: "md" },
194
+ removable: {
195
+ type: Boolean,
196
+ default: false
197
+ },
198
+ disabled: {
199
+ type: Boolean,
200
+ default: false
201
+ },
202
+ icon: {
203
+ type: Boolean,
204
+ default: false
205
+ }
206
+ },
207
+ emits: ["remove"],
208
+ setup(__props, { emit: __emit }) {
209
+ /** Compact label for tags, status indicators, and badges; supports removable and icon slots. */
210
+ const props = __props;
211
+ /**
212
+ * @event remove - Emitted when the remove button is clicked
213
+ */
214
+ const emit = __emit;
215
+ function handleRemove(event) {
216
+ event.stopPropagation();
217
+ if (!props.disabled) emit("remove");
218
+ }
219
+ return (_ctx, _cache) => {
220
+ return openBlock(), createElementBlock("span", { class: normalizeClass([
221
+ "mint-pill",
222
+ `mint-pill--${__props.variant}`,
223
+ __props.color && `mint-pill--${__props.color}`,
224
+ `mint-pill--${__props.size}`,
225
+ {
226
+ "mint-pill--disabled": __props.disabled,
227
+ "mint-pill--with-icon": __props.icon
228
+ }
229
+ ]) }, [
230
+ __props.icon ? (openBlock(), createElementBlock("span", _hoisted_1$1, [renderSlot(_ctx.$slots, "icon")])) : createCommentVNode("", true),
231
+ createElementVNode("span", _hoisted_2$1, [renderSlot(_ctx.$slots, "default")]),
232
+ __props.removable && !__props.disabled ? (openBlock(), createElementBlock("button", {
233
+ key: 1,
234
+ type: "button",
235
+ class: "mint-pill__remove",
236
+ "aria-label": "Remove",
237
+ onClick: handleRemove
238
+ }, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
239
+ class: "mint-pill__remove-icon",
240
+ fill: "none",
241
+ stroke: "currentColor",
242
+ "stroke-width": "2",
243
+ "stroke-linecap": "round",
244
+ "stroke-linejoin": "round",
245
+ viewBox: "0 0 24 24"
246
+ }, [createElementVNode("path", { d: "M18 6 6 18" }), createElementVNode("path", { d: "m6 6 12 12" })], -1)])])) : createCommentVNode("", true)
247
+ ], 2);
248
+ };
249
+ }
250
+ });
251
+ //#endregion
252
+ //#region src/composables/useApi.ts
253
+ var apiClientInstance = null;
254
+ var interceptorAttached = false;
255
+ function joinUrlPath(baseUrl, path) {
256
+ if (/^https?:\/\//i.test(path)) return path;
257
+ if (!path) return baseUrl;
258
+ if (path.startsWith("?") || path.startsWith("#")) return `${baseUrl.replace(/\/+$/, "")}${path}`;
259
+ const normalizedBase = baseUrl.replace(/\/+$/, "");
260
+ const normalizedPath = path.replace(/^\/+/, "/");
261
+ return `${normalizedBase}${normalizedPath.startsWith("/") ? normalizedPath : `/${normalizedPath}`}`;
262
+ }
263
+ function getBasePath(baseUrl) {
264
+ if (!baseUrl) return "/";
265
+ try {
266
+ const origin = typeof window !== "undefined" ? window.location.origin : "http://localhost";
267
+ return new URL(baseUrl, origin).pathname.replace(/\/+$/, "") || "/";
268
+ } catch {
269
+ return baseUrl.replace(/^https?:\/\/[^/]+/i, "").replace(/\/+$/, "") || "/";
270
+ }
271
+ }
272
+ function normalizeRequestUrl(baseUrl, url) {
273
+ if (!url || /^https?:\/\//.test(url)) return url;
274
+ const basePath = getBasePath(baseUrl);
275
+ if (basePath === "/") return url;
276
+ const normalizedUrl = url.startsWith("/") ? url : `/${url}`;
277
+ if (normalizedUrl === basePath || normalizedUrl.startsWith(`${basePath}?`) || normalizedUrl.startsWith(`${basePath}#`)) return normalizedUrl.slice(basePath.length);
278
+ if (normalizedUrl.startsWith(`${basePath}/`)) return normalizedUrl.slice(basePath.length) || "";
279
+ return url;
280
+ }
281
+ function asMutableHeaders(headers) {
282
+ return headers ? headers : null;
283
+ }
284
+ function hasAuthorizationHeader(headers) {
285
+ const bag = asMutableHeaders(headers);
286
+ if (!bag) return false;
287
+ if (typeof bag.has === "function") return bag.has("Authorization");
288
+ return Object.keys(bag).some((key) => key.toLowerCase() === "authorization");
289
+ }
290
+ function setAuthorizationHeader(headers, value) {
291
+ const bag = asMutableHeaders(headers);
292
+ if (!bag) return;
293
+ if (typeof bag.set === "function") {
294
+ bag.set("Authorization", value);
295
+ return;
296
+ }
297
+ bag.Authorization = value;
298
+ }
299
+ function deleteAuthorizationHeader(headers) {
300
+ const bag = asMutableHeaders(headers);
301
+ if (!bag) return;
302
+ if (typeof bag.delete === "function") {
303
+ bag.delete("Authorization");
304
+ return;
305
+ }
306
+ for (const key of Object.keys(bag)) if (key.toLowerCase() === "authorization") delete bag[key];
307
+ }
308
+ function getAuthorizationHeader(headers) {
309
+ const bag = asMutableHeaders(headers);
310
+ if (!bag) return void 0;
311
+ if (typeof bag.get === "function") return bag.get("Authorization");
312
+ const key = Object.keys(bag).find((candidate) => candidate.toLowerCase() === "authorization");
313
+ return key ? bag[key] : void 0;
314
+ }
315
+ /** Raised when an authenticated SDK request is rejected because the login is no longer valid. */
316
+ var AuthenticationRequiredError = class extends Error {
317
+ code = "AUTHENTICATION_REQUIRED";
318
+ status = 401;
319
+ constructor(cause) {
320
+ super("Authentication required. Please sign in again.");
321
+ this.cause = cause;
322
+ this.name = "AuthenticationRequiredError";
323
+ }
324
+ };
325
+ /** @internal Convert a rejected authenticated request into the SDK's public auth error. */
326
+ function authenticationRequiredError(cause, rejectedToken) {
327
+ const currentAuthStore = useAuthStore();
328
+ if (rejectedToken && currentAuthStore.token === rejectedToken) currentAuthStore.clearToken();
329
+ return new AuthenticationRequiredError(cause);
330
+ }
331
+ function getApiClient() {
332
+ if (!apiClientInstance) apiClientInstance = axios.create({ headers: { "Content-Type": "application/json" } });
333
+ return apiClientInstance;
334
+ }
335
+ /** Axios-based API client that injects the plugin base URL and JWT auth header on every request. */
336
+ function useApi(options = {}) {
337
+ const settingsStore = useSettingsStore();
338
+ const authStore = useAuthStore();
339
+ const apiClient = getApiClient();
340
+ if (!authStore.isInitialized) authStore.initialize();
341
+ if (!interceptorAttached) {
342
+ apiClient.interceptors.request.use((config) => {
343
+ const request = config;
344
+ if (request._mintSkipAuth) {
345
+ deleteAuthorizationHeader(request.headers);
346
+ return request;
347
+ }
348
+ const currentAuthStore = useAuthStore();
349
+ if (currentAuthStore.token && config.headers && !hasAuthorizationHeader(config.headers)) setAuthorizationHeader(config.headers, `Bearer ${currentAuthStore.token}`);
350
+ if (getAuthorizationHeader(config.headers) === `Bearer ${currentAuthStore.token}`) request._mintAuthToken = currentAuthStore.token ?? void 0;
351
+ return config;
352
+ });
353
+ apiClient.interceptors.response.use((response) => response, (error) => {
354
+ if (axios.isAxiosError(error) && error.response?.status === 401) {
355
+ const request = error.config;
356
+ if (request?._mintSkipAuth !== true) return Promise.reject(authenticationRequiredError(error, request?._mintAuthToken));
357
+ }
358
+ return Promise.reject(error);
359
+ });
360
+ interceptorAttached = true;
361
+ }
362
+ function getBaseUrl() {
363
+ return options.baseUrl ?? settingsStore.getApiBaseUrl();
364
+ }
365
+ function normalizeUrl(url) {
366
+ return normalizeRequestUrl(getBaseUrl(), url);
367
+ }
368
+ function requestConfig(config) {
369
+ const base = {
370
+ baseURL: getBaseUrl(),
371
+ timeout: options.timeout ?? settingsStore.requestTimeout,
372
+ ...config
373
+ };
374
+ if (options.withAuth === false) {
375
+ base._mintSkipAuth = true;
376
+ deleteAuthorizationHeader(base.headers);
377
+ }
378
+ return base;
379
+ }
380
+ async function get(url, config) {
381
+ return (await apiClient.get(normalizeUrl(url), requestConfig(config))).data;
382
+ }
383
+ async function post(url, data, config) {
384
+ return (await apiClient.post(normalizeUrl(url), data, requestConfig(config))).data;
385
+ }
386
+ async function put(url, data, config) {
387
+ return (await apiClient.put(normalizeUrl(url), data, requestConfig(config))).data;
388
+ }
389
+ async function patch(url, data, config) {
390
+ return (await apiClient.patch(normalizeUrl(url), data, requestConfig(config))).data;
391
+ }
392
+ async function del(url, config) {
393
+ return (await apiClient.delete(normalizeUrl(url), requestConfig(config))).data;
394
+ }
395
+ async function upload(url, file, fieldName = "file", additionalData) {
396
+ const formData = new FormData();
397
+ formData.append(fieldName, file);
398
+ if (additionalData) Object.entries(additionalData).forEach(([key, value]) => {
399
+ if (value !== void 0 && value !== null) formData.append(key, typeof value === "object" ? JSON.stringify(value) : String(value));
400
+ });
401
+ return (await apiClient.post(normalizeUrl(url), formData, requestConfig({ headers: { "Content-Type": void 0 } }))).data;
402
+ }
403
+ async function download(url, filename) {
404
+ const response = await apiClient.get(normalizeUrl(url), requestConfig({ responseType: "blob" }));
405
+ const blob = new Blob([response.data]);
406
+ const blobUrl = URL.createObjectURL(blob);
407
+ if (filename) {
408
+ const link = document.createElement("a");
409
+ link.href = blobUrl;
410
+ link.download = filename;
411
+ document.body.appendChild(link);
412
+ link.click();
413
+ document.body.removeChild(link);
414
+ setTimeout(() => URL.revokeObjectURL(blobUrl), 100);
415
+ return "";
416
+ }
417
+ return blobUrl;
418
+ }
419
+ function buildUrl(path) {
420
+ const baseUrl = getBaseUrl();
421
+ return joinUrlPath(baseUrl, normalizeRequestUrl(baseUrl, path));
422
+ }
423
+ function buildWsUrl(path) {
424
+ return joinUrlPath(settingsStore.getWsBaseUrl(), path);
425
+ }
426
+ return {
427
+ client: apiClient,
428
+ get,
429
+ post,
430
+ put,
431
+ patch,
432
+ delete: del,
433
+ upload,
434
+ download,
435
+ buildUrl,
436
+ buildWsUrl
437
+ };
438
+ }
439
+ //#endregion
440
+ //#region src/composables/useRequestSyncState.ts
441
+ /** Shared loading/error/timestamp state for generated plugin request helpers. */
442
+ function useRequestSyncState(defaultErrorMessage = "Request failed.") {
443
+ const loading = ref(false);
444
+ const error = ref(null);
445
+ const lastLoadedAt = ref(null);
446
+ const lastSavedAt = ref(null);
447
+ const lastRunAt = ref(null);
448
+ function clearError() {
449
+ error.value = null;
450
+ }
451
+ function readErrorMessage(value, fallback = defaultErrorMessage) {
452
+ if (value instanceof Error && value.message) return value.message;
453
+ if (typeof value === "string" && value.trim()) return value;
454
+ if (typeof value === "object" && value !== null && "message" in value && typeof value.message === "string" && value.message) return value.message;
455
+ return fallback;
456
+ }
457
+ function setError(value, fallback) {
458
+ const message = readErrorMessage(value, fallback);
459
+ error.value = message;
460
+ return message;
461
+ }
462
+ function markLoaded(date = /* @__PURE__ */ new Date()) {
463
+ lastLoadedAt.value = date;
464
+ }
465
+ function markSaved(date = /* @__PURE__ */ new Date()) {
466
+ lastSavedAt.value = date;
467
+ }
468
+ function markRun(date = /* @__PURE__ */ new Date()) {
469
+ lastRunAt.value = date;
470
+ }
471
+ async function run(operation, options = {}) {
472
+ loading.value = true;
473
+ clearError();
474
+ try {
475
+ const response = await operation();
476
+ if (options.success === "load") markLoaded();
477
+ else if (options.success === "save") markSaved();
478
+ else if (options.success === "run") markRun();
479
+ return response;
480
+ } catch (err) {
481
+ setError(err, options.errorMessage);
482
+ throw err;
483
+ } finally {
484
+ loading.value = false;
485
+ }
486
+ }
487
+ return {
488
+ loading,
489
+ error,
490
+ lastLoadedAt,
491
+ lastSavedAt,
492
+ lastRunAt,
493
+ clearError,
494
+ readErrorMessage,
495
+ setError,
496
+ markLoaded,
497
+ markSaved,
498
+ markRun,
499
+ run
500
+ };
501
+ }
502
+ //#endregion
503
+ //#region src/components/Skeleton.vue
504
+ var Skeleton_default = /* @__PURE__ */ defineComponent({
505
+ __name: "Skeleton",
506
+ props: {
507
+ variant: { default: "text" },
508
+ width: {},
509
+ height: {},
510
+ animation: { default: "wave" }
511
+ },
512
+ setup(__props) {
513
+ /** Animated loading placeholder in text, circular, rectangular, or rounded variants with pulse or wave animation. */
514
+ const props = __props;
515
+ const style = computed(() => {
516
+ const s = {};
517
+ if (props.width) s.width = typeof props.width === "number" ? `${props.width}px` : props.width;
518
+ if (props.height) s.height = typeof props.height === "number" ? `${props.height}px` : props.height;
519
+ return s;
520
+ });
521
+ const classes = computed(() => {
522
+ const base = ["bg-bg-hover"];
523
+ switch (props.variant) {
524
+ case "circular":
525
+ base.push("rounded-full");
526
+ if (!props.width && !props.height) base.push("w-10 h-10");
527
+ break;
528
+ case "rectangular":
529
+ base.push("rounded-none");
530
+ if (!props.height) base.push("h-24");
531
+ break;
532
+ case "rounded":
533
+ base.push("rounded-mint");
534
+ if (!props.height) base.push("h-24");
535
+ break;
536
+ default:
537
+ base.push("rounded");
538
+ if (!props.height) base.push("h-4");
539
+ if (!props.width) base.push("w-full");
540
+ }
541
+ switch (props.animation) {
542
+ case "pulse":
543
+ base.push("animate-pulse");
544
+ break;
545
+ case "wave":
546
+ base.push("skeleton-wave");
547
+ break;
548
+ }
549
+ return base;
550
+ });
551
+ return (_ctx, _cache) => {
552
+ return openBlock(), createElementBlock("div", {
553
+ class: normalizeClass(classes.value),
554
+ style: normalizeStyle(style.value)
555
+ }, null, 6);
556
+ };
557
+ }
558
+ });
559
+ //#endregion
560
+ //#region src/components/EmptyState.vue?vue&type=script&setup=true&lang.ts
561
+ var _hoisted_1 = ["d"];
562
+ var _hoisted_2 = ["d"];
563
+ var _hoisted_3 = { class: "mint-empty-state__body" };
564
+ var _hoisted_4 = {
565
+ key: 0,
566
+ class: "mint-empty-state__title"
567
+ };
568
+ var _hoisted_5 = {
569
+ key: 1,
570
+ class: "mint-empty-state__description"
571
+ };
572
+ var _hoisted_6 = {
573
+ key: 0,
574
+ class: "mint-empty-state__action"
575
+ };
576
+ //#endregion
577
+ //#region src/components/EmptyState.vue
578
+ var EmptyState_default = /* @__PURE__ */ defineComponent({
579
+ __name: "EmptyState",
580
+ props: {
581
+ title: {},
582
+ description: {},
583
+ iconPath: {},
584
+ color: { default: "primary" },
585
+ size: { default: "md" },
586
+ variant: { default: "illustrated" },
587
+ actionLabel: {}
588
+ },
589
+ emits: ["action"],
590
+ setup(__props, { emit: __emit }) {
591
+ /** Empty-state placeholder with icon badge, headline, description, default slot, and optional CTA button. */
592
+ const emit = __emit;
593
+ const defaultIconPaths = [
594
+ "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
595
+ "M7 11h10",
596
+ "M7 15h6",
597
+ "M7 7h8"
598
+ ];
599
+ return (_ctx, _cache) => {
600
+ return openBlock(), createElementBlock("div", { class: normalizeClass([
601
+ "mint-empty-state",
602
+ `mint-empty-state--${__props.variant}`,
603
+ `mint-empty-state--${__props.size}`
604
+ ]) }, [
605
+ createElementVNode("div", { class: normalizeClass(["mint-empty-state__icon-wrapper", `mint-empty-state__icon-wrapper--${__props.color}`]) }, [renderSlot(_ctx.$slots, "icon", {}, () => [(openBlock(), createElementBlock("svg", {
606
+ class: normalizeClass(["mint-empty-state__icon", `mint-empty-state__icon--${__props.color}`]),
607
+ viewBox: "0 0 24 24",
608
+ fill: "none",
609
+ stroke: "currentColor",
610
+ "stroke-width": "2",
611
+ "stroke-linecap": "round",
612
+ "stroke-linejoin": "round"
613
+ }, [__props.iconPath ? (openBlock(), createElementBlock("path", {
614
+ key: 0,
615
+ d: __props.iconPath
616
+ }, null, 8, _hoisted_1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, renderList(defaultIconPaths, (d, i) => {
617
+ return createElementVNode("path", {
618
+ key: i,
619
+ d
620
+ }, null, 8, _hoisted_2);
621
+ }), 64))], 2))])], 2),
622
+ createElementVNode("div", _hoisted_3, [
623
+ __props.title ? (openBlock(), createElementBlock("h3", _hoisted_4, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
624
+ __props.description ? (openBlock(), createElementBlock("p", _hoisted_5, toDisplayString(__props.description), 1)) : createCommentVNode("", true),
625
+ renderSlot(_ctx.$slots, "default")
626
+ ]),
627
+ __props.actionLabel ? (openBlock(), createElementBlock("div", _hoisted_6, [createVNode(BaseButton_default, { onClick: _cache[0] || (_cache[0] = ($event) => emit("action")) }, {
628
+ default: withCtx(() => [createTextVNode(toDisplayString(__props.actionLabel), 1)]),
629
+ _: 1
630
+ })])) : createCommentVNode("", true)
631
+ ], 2);
632
+ };
633
+ }
634
+ });
635
+ //#endregion
636
+ export { authenticationRequiredError as a, BaseSelect_default as c, AuthenticationRequiredError as i, normalizeOptionInput as l, Skeleton_default as n, useApi as o, useRequestSyncState as r, BasePill_default as s, EmptyState_default as t, BaseInput_default as u };
637
+
638
+ //# sourceMappingURL=EmptyState-D1c4RdC7.js.map