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

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