dara-core 1.16.22__py3-none-any.whl → 1.17.0__py3-none-any.whl

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.
@@ -17386,6 +17386,62 @@ var __privateWrapper = (obj, member, setter, getter) => ({
17386
17386
  var _baseIteratee = baseIteratee$3;
17387
17387
  var e$2 = "object" == typeof navigator ? navigator.platform : "";
17388
17388
  /Mac|iPod|iPhone|iPad/.test(e$2);
17389
+ function useIMEEnter({ onKeyDown: userKeyDown, onKeyUp: userKeyUp, onCompositionStart: userCompStart, onCompositionEnd: userCompEnd }) {
17390
+ const isComposingRef = React.useRef(false);
17391
+ const justEndedRef = React.useRef(false);
17392
+ const handleCompositionStart = React.useCallback((e2) => {
17393
+ isComposingRef.current = true;
17394
+ userCompStart === null || userCompStart === void 0 ? void 0 : userCompStart(e2);
17395
+ }, [userCompStart]);
17396
+ const handleCompositionEnd = React.useCallback((e2) => {
17397
+ isComposingRef.current = false;
17398
+ justEndedRef.current = true;
17399
+ userCompEnd === null || userCompEnd === void 0 ? void 0 : userCompEnd(e2);
17400
+ }, [userCompEnd]);
17401
+ const handleKeyDownCapture = React.useCallback((e2) => {
17402
+ if (isComposingRef.current) {
17403
+ e2.preventDefault();
17404
+ e2.stopPropagation();
17405
+ return;
17406
+ }
17407
+ if (justEndedRef.current) {
17408
+ if (e2.which === 229) {
17409
+ e2.preventDefault();
17410
+ e2.stopPropagation();
17411
+ return;
17412
+ }
17413
+ justEndedRef.current = false;
17414
+ }
17415
+ }, []);
17416
+ const handleKeyDown = React.useCallback((e2) => {
17417
+ if (isComposingRef.current) {
17418
+ return;
17419
+ }
17420
+ userKeyDown === null || userKeyDown === void 0 ? void 0 : userKeyDown(e2);
17421
+ }, [userKeyDown]);
17422
+ const handleKeyUpCapture = React.useCallback((e2) => {
17423
+ if (isComposingRef.current || justEndedRef.current) {
17424
+ justEndedRef.current = false;
17425
+ e2.preventDefault();
17426
+ e2.stopPropagation();
17427
+ }
17428
+ }, []);
17429
+ const handleKeyUp = React.useCallback((e2) => {
17430
+ if (isComposingRef.current || justEndedRef.current) {
17431
+ justEndedRef.current = false;
17432
+ return;
17433
+ }
17434
+ userKeyUp === null || userKeyUp === void 0 ? void 0 : userKeyUp(e2);
17435
+ }, [userKeyUp]);
17436
+ return {
17437
+ onCompositionStart: handleCompositionStart,
17438
+ onCompositionEnd: handleCompositionEnd,
17439
+ onKeyDownCapture: handleKeyDownCapture,
17440
+ onKeyDown: handleKeyDown,
17441
+ onKeyUpCapture: handleKeyUpCapture,
17442
+ onKeyUp: handleKeyUp
17443
+ };
17444
+ }
17389
17445
  globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
17390
17446
  function adopt(value) {
17391
17447
  return value instanceof P ? value : new P(function(resolve) {
@@ -26380,7 +26436,14 @@ var __privateWrapper = (obj, member, setter, getter) => ({
26380
26436
  onComplete();
26381
26437
  }
26382
26438
  };
26383
- return jsxRuntime.exports.jsxs(InputWrapper$3, { className, style, children: [jsxRuntime.exports.jsx(PrimaryInput, Object.assign({}, rest, { defaultValue: initialValue, isErrored: !!errorMsg, onChange: handleChange, onKeyDown: handleKeyDown, ref, type, min: minValue, max: maxValue })), errorMsg && jsxRuntime.exports.jsx(ErrorMessage$1, { children: errorMsg })] });
26439
+ const handlers = useIMEEnter({
26440
+ onKeyDown: handleKeyDown,
26441
+ onKeyUp: rest.onKeyUp,
26442
+ onCompositionStart: rest.onCompositionStart,
26443
+ onCompositionEnd: rest.onCompositionEnd
26444
+ });
26445
+ const spreadProps = Object.assign(Object.assign({}, rest), handlers);
26446
+ return jsxRuntime.exports.jsxs(InputWrapper$3, { className, style, children: [jsxRuntime.exports.jsx(PrimaryInput, Object.assign({}, spreadProps, { defaultValue: initialValue, isErrored: !!errorMsg, onChange: handleChange, ref, type, min: minValue, max: maxValue })), errorMsg && jsxRuntime.exports.jsx(ErrorMessage$1, { children: errorMsg })] });
26384
26447
  });
26385
26448
  Input$1.displayName = "Input";
26386
26449
  const Wrapper$7 = styled__default.default.div`
@@ -50095,6 +50158,9 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
50095
50158
  function isLoopVariable(variable) {
50096
50159
  return variable && typeof variable == "object" && variable.hasOwnProperty("uid") && variable.hasOwnProperty("__typename") && variable.__typename === "LoopVariable";
50097
50160
  }
50161
+ function isSwitchVariable(variable) {
50162
+ return isVariable(variable) && variable.__typename === "SwitchVariable";
50163
+ }
50098
50164
  function isResolvedDerivedVariable(value) {
50099
50165
  return value && typeof value === "object" && "values" in value && "type" in value && value.type === "derived" && "uid" in value;
50100
50166
  }
@@ -50104,6 +50170,9 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
50104
50170
  function isResolvedDerivedDataVariable(value) {
50105
50171
  return value && typeof value === "object" && "filters" in value && "values" in value && "type" in value && value.type === "derived-data" && "uid" in value;
50106
50172
  }
50173
+ function isResolvedSwitchVariable(value) {
50174
+ return value && typeof value === "object" && "type" in value && value.type === "switch" && "uid" in value && "value_map" in value;
50175
+ }
50107
50176
  function isActionImpl(action) {
50108
50177
  return action && typeof action === "object" && action.__typename === "ActionImpl";
50109
50178
  }
@@ -50111,6 +50180,9 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
50111
50180
  return action && "uid" in action && "definition_uid" in action && "dynamic_kwargs" in action;
50112
50181
  }
50113
50182
  const isPyComponent = (value) => isObject_1(value) && "props" in value && isObject_1(value.props) && "func_name" in value.props && "dynamic_kwargs" in value.props;
50183
+ function isCondition(value) {
50184
+ return value && typeof value === "object" && value.__typename === "Condition";
50185
+ }
50114
50186
  function commonjsRequire(path) {
50115
50187
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
50116
50188
  }
@@ -51040,11 +51112,16 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
51040
51112
  ...lookup,
51041
51113
  ...nestedLookup
51042
51114
  };
51043
- } else {
51115
+ } else if (isResolvedSwitchVariable(val)) {
51044
51116
  const varDef = def.variables[key];
51045
51117
  const identifier = getIdentifier(varDef);
51046
51118
  lookup[identifier] = val;
51047
51119
  normalizedValues.push({ __ref: identifier });
51120
+ } else {
51121
+ const varDef = def.variables[key];
51122
+ const identifier = getIdentifier(varDef);
51123
+ lookup[identifier] = val === void 0 ? null : val;
51124
+ normalizedValues.push({ __ref: identifier });
51048
51125
  }
51049
51126
  }
51050
51127
  return {
@@ -51842,244 +51919,6 @@ Inferred class string: "${iconClasses}."`
51842
51919
  return /* @__PURE__ */ React__default.default.createElement(Icon, { ...props, className: `${String((_a = props.className) != null ? _a : "")} ${iconClasses}` });
51843
51920
  };
51844
51921
  }
51845
- function flexStyles(props, displayCtx2, useDisplayContext) {
51846
- let flexBasis = props.basis;
51847
- let flexShrink = props.shrink;
51848
- let flexGrow = props.grow;
51849
- if (useDisplayContext) {
51850
- if (props.width && displayCtx2.direction === "horizontal") {
51851
- flexBasis != null ? flexBasis : flexBasis = props.width;
51852
- flexShrink != null ? flexShrink : flexShrink = "0";
51853
- flexGrow != null ? flexGrow : flexGrow = "0";
51854
- }
51855
- if (props.height && displayCtx2.direction === "vertical") {
51856
- flexBasis != null ? flexBasis : flexBasis = props.height;
51857
- flexShrink != null ? flexShrink : flexShrink = "0";
51858
- flexGrow != null ? flexGrow : flexGrow = "0";
51859
- }
51860
- }
51861
- if (props.hug || props.hug !== false && displayCtx2.hug) {
51862
- flexBasis != null ? flexBasis : flexBasis = "content";
51863
- flexShrink != null ? flexShrink : flexShrink = "1";
51864
- flexGrow != null ? flexGrow : flexGrow = "0";
51865
- }
51866
- return { flexBasis, flexGrow, flexShrink };
51867
- }
51868
- function parseRawCss(rawCss) {
51869
- const isRawObject = typeof rawCss === "object" && rawCss !== null && rawCss !== void 0;
51870
- const componentCss = !isRawObject && typeof rawCss === "string" ? rawCss : "";
51871
- const styles2 = isRawObject ? rawCss : {};
51872
- return [styles2, componentCss];
51873
- }
51874
- function useComponentStyles(props, useDisplayContext = true) {
51875
- const [rawStyles, rawCss] = parseRawCss(props.raw_css);
51876
- const displayCtx$1 = React.useContext(displayCtx);
51877
- const flexProps = flexStyles(props, displayCtx$1, useDisplayContext);
51878
- const styles2 = React.useMemo(() => {
51879
- var _a;
51880
- const stylesObj = {
51881
- backgroundColor: props.background,
51882
- border: props.border,
51883
- borderRadius: props.border_radius,
51884
- color: props.color,
51885
- fontFamily: props.font,
51886
- fontSize: props.font_size,
51887
- fontStyle: props.italic ? "italic" : "normal",
51888
- fontWeight: props.bold ? "bold" : "normal",
51889
- gap: props.gap,
51890
- height: props.height,
51891
- margin: props.margin,
51892
- maxHeight: props.max_height,
51893
- maxWidth: props.max_width,
51894
- minHeight: props.min_height,
51895
- minWidth: props.min_width,
51896
- overflow: props.overflow,
51897
- padding: props.padding,
51898
- position: props.position,
51899
- textDecoration: props.underline ? "underline" : "none",
51900
- width: props.width,
51901
- ...flexProps,
51902
- ...rawStyles,
51903
- ...(_a = props.style) != null ? _a : {}
51904
- };
51905
- return Object.fromEntries(Object.entries(stylesObj).filter(([, v2]) => v2 !== null && v2 !== void 0));
51906
- }, [useDeepCompare(props)]);
51907
- return [styles2, rawCss];
51908
- }
51909
- function useUrlSync(options) {
51910
- const urlSerializer = React.useCallback((val) => {
51911
- if (val === void 0 || val === null) {
51912
- return "";
51913
- }
51914
- if (["string", "number", "boolean"].includes(typeof val)) {
51915
- return String(val);
51916
- }
51917
- return JSON.stringify(val);
51918
- }, []);
51919
- const urlDeserializer = React.useCallback((val) => {
51920
- if (val === "") {
51921
- return void 0;
51922
- }
51923
- try {
51924
- return JSON.parse(val);
51925
- } catch {
51926
- return val;
51927
- }
51928
- }, []);
51929
- const listenChangeURL = React.useCallback((handler) => {
51930
- const unregister = options.history.listen(() => {
51931
- handler();
51932
- });
51933
- return () => unregister();
51934
- }, []);
51935
- const memoryOptions = {
51936
- getURL: () => {
51937
- return window.location.origin + options.history.location.pathname + options.history.location.search;
51938
- },
51939
- pushURL: (url) => {
51940
- options.history.push(url.replace(window.location.origin, ""));
51941
- },
51942
- replaceURL: (url) => {
51943
- options.history.replace(url.replace(window.location.origin, ""));
51944
- }
51945
- };
51946
- return {
51947
- browserInterface: {
51948
- listenChangeURL,
51949
- ...options.memory_TEST ? memoryOptions : {}
51950
- },
51951
- deserialize: urlDeserializer,
51952
- location: { part: "queryParams" },
51953
- serialize: urlSerializer
51954
- };
51955
- }
51956
- const Wrapper$2 = styled__default.default.div`
51957
- display: flex;
51958
- align-items: center;
51959
- justify-content: center;
51960
-
51961
- width: 100%;
51962
- height: 100%;
51963
- `;
51964
- const FlashingDots = styled__default.default.div`
51965
- position: relative;
51966
-
51967
- width: 10px;
51968
- height: 10px;
51969
-
51970
- color: ${(props) => props.theme.colors.grey4};
51971
-
51972
- background-color: ${(props) => props.theme.colors.grey4};
51973
- border-radius: 5px;
51974
-
51975
- animation: dot-flashing 1s infinite linear alternate;
51976
- animation-delay: 0.5s;
51977
-
51978
- &::before,
51979
- &::after {
51980
- content: '';
51981
- position: absolute;
51982
- top: 0;
51983
- display: inline-block;
51984
- }
51985
-
51986
- &::before {
51987
- left: -15px;
51988
-
51989
- width: 10px;
51990
- height: 10px;
51991
-
51992
- color: ${(props) => props.theme.colors.grey4};
51993
-
51994
- background-color: ${(props) => props.theme.colors.grey4};
51995
- border-radius: 5px;
51996
-
51997
- animation: dot-flashing 1s infinite alternate;
51998
- animation-delay: 0s;
51999
- }
52000
-
52001
- &::after {
52002
- left: 15px;
52003
-
52004
- width: 10px;
52005
- height: 10px;
52006
-
52007
- color: ${(props) => props.theme.colors.grey4};
52008
-
52009
- background-color: ${(props) => props.theme.colors.grey4};
52010
- border-radius: 5px;
52011
-
52012
- animation: dot-flashing 1s infinite alternate;
52013
- animation-delay: 1s;
52014
- }
52015
-
52016
- @keyframes dot-flashing {
52017
- 0% {
52018
- background-color: ${(props) => props.theme.colors.grey4};
52019
- }
52020
-
52021
- 50%,
52022
- 100% {
52023
- background-color: ${(props) => props.theme.colors.grey3};
52024
- }
52025
- }
52026
- `;
52027
- function Dots(props) {
52028
- return /* @__PURE__ */ React__default.default.createElement(Wrapper$2, { className: props.className, style: props.style }, /* @__PURE__ */ React__default.default.createElement(FlashingDots, { "data-testid": "LOADING" }));
52029
- }
52030
- const StyledDots$1 = injectCss(Dots);
52031
- function DefaultFallback(props) {
52032
- const [style, css2] = useComponentStyles(props);
52033
- return /* @__PURE__ */ React__default.default.createElement(StyledDots$1, { $rawCss: css2, style });
52034
- }
52035
- const Center = styled__default.default.div`
52036
- overflow: hidden;
52037
- display: flex;
52038
- flex-direction: column;
52039
- align-items: center;
52040
- justify-content: center;
52041
-
52042
- width: 100%;
52043
- height: 100%;
52044
-
52045
- background: ${(props) => props.colored ? props.theme.colors.blue1 : ""};
52046
- `;
52047
- const CenteredDivWithGap = styled__default.default(Center)`
52048
- gap: 0.6rem;
52049
- margin: 10px;
52050
- text-align: center;
52051
- `;
52052
- const errorMessages = {
52053
- "403": {
52054
- description: "You are not authorised to access this application. Please contact the application owner to enable access.",
52055
- styling: "error",
52056
- title: "We were not able to authenticate you"
52057
- },
52058
- default: {
52059
- description: "Your login session may have expired. Try again.",
52060
- styling: "primary",
52061
- title: "We were not able to authenticate you"
52062
- }
52063
- };
52064
- function ErrorPage() {
52065
- const { search } = useLocation();
52066
- const query = React.useMemo(() => new URLSearchParams(search), [search]);
52067
- const code = query.get("code");
52068
- const errorConfig = code && errorMessages[code] || errorMessages.default;
52069
- return /* @__PURE__ */ React__default.default.createElement(CenteredDivWithGap, null, /* @__PURE__ */ React__default.default.createElement("h1", null, errorConfig.title), /* @__PURE__ */ React__default.default.createElement("p", null, errorConfig.description), /* @__PURE__ */ React__default.default.createElement(Button$1, { href: "/login", styling: errorConfig.styling }, "Retry"));
52070
- }
52071
- function onTokenChange(cb) {
52072
- return store.subscribe(getTokenKey(), cb);
52073
- }
52074
- function getSessionToken() {
52075
- return store.getValueSync(getTokenKey());
52076
- }
52077
- function setSessionToken(token) {
52078
- store.setValue(getTokenKey(), token);
52079
- }
52080
- function useSessionToken() {
52081
- return React__namespace.useSyncExternalStore(onTokenChange, getSessionToken);
52082
- }
52083
51922
  class EventBus {
52084
51923
  constructor(parentBus) {
52085
51924
  __privateAdd(this, _events$, new Subject());
@@ -52112,19 +51951,6 @@ Inferred class string: "${iconClasses}."`
52112
51951
  }, [bus, onEvent]);
52113
51952
  return /* @__PURE__ */ React__namespace.createElement(EventBusContext.Provider, { value: bus }, children);
52114
51953
  }
52115
- function useActionRegistry() {
52116
- const { actionRegistry: actions } = React.useContext(registriesCtx);
52117
- const get2 = React.useCallback(
52118
- (impl) => {
52119
- if (actions && actions[impl.name]) {
52120
- return actions[impl.name];
52121
- }
52122
- throw new Error(`Attempted to load an action (${impl.name}) that is not in the registry`);
52123
- },
52124
- [actions]
52125
- );
52126
- return React.useMemo(() => ({ get: get2 }), [get2]);
52127
- }
52128
51954
  const _StateSynchronizer = class {
52129
51955
  constructor() {
52130
51956
  __privateAdd(this, _observers, /* @__PURE__ */ new Map());
@@ -53123,6 +52949,14 @@ Inferred class string: "${iconClasses}."`
53123
52949
  values: formatDerivedVariableRequest(nestedValues)
53124
52950
  };
53125
52951
  }
52952
+ if (isResolvedSwitchVariable(val)) {
52953
+ return {
52954
+ ...val,
52955
+ value: formatDerivedVariableRequest([val.value])[0],
52956
+ value_map: formatDerivedVariableRequest([val.value_map])[0],
52957
+ default: formatDerivedVariableRequest([val.default])[0]
52958
+ };
52959
+ }
53126
52960
  return val;
53127
52961
  });
53128
52962
  }
@@ -53195,9 +53029,23 @@ Inferred class string: "${iconClasses}."`
53195
53029
  values: resolvedValues
53196
53030
  };
53197
53031
  }
53032
+ if (isResolvedSwitchVariable(value)) {
53033
+ return {
53034
+ ...value,
53035
+ value: resolveValue(value.value, getter),
53036
+ value_map: resolveValue(value.value_map, getter),
53037
+ default: resolveValue(value.default, getter)
53038
+ };
53039
+ }
53198
53040
  if (isResolvedDataVariable(value)) {
53199
53041
  return value;
53200
53042
  }
53043
+ if (isCondition(value)) {
53044
+ return {
53045
+ ...value,
53046
+ variable: resolveValue(value.variable, getter)
53047
+ };
53048
+ }
53201
53049
  if (Recoil_index_2(value)) {
53202
53050
  return getter(value);
53203
53051
  }
@@ -53208,7 +53056,13 @@ Inferred class string: "${iconClasses}."`
53208
53056
  if (deps && !deps.includes(idx)) {
53209
53057
  return [];
53210
53058
  }
53211
- return isResolvedDerivedVariable(val) || isResolvedDerivedDataVariable(val) ? getDeps(val.values, val.deps).flat() : val;
53059
+ if (isResolvedDerivedVariable(val) || isResolvedDerivedDataVariable(val)) {
53060
+ return getDeps(val.values, val.deps).flat();
53061
+ }
53062
+ if (isResolvedSwitchVariable(val)) {
53063
+ return getDeps([val.value, val.value_map, val.default], [0, 1, 2]).flat();
53064
+ }
53065
+ return val;
53212
53066
  });
53213
53067
  }
53214
53068
  function useTriggerIndex(variable) {
@@ -53553,6 +53407,24 @@ Inferred class string: "${iconClasses}."`
53553
53407
  if (isUrlVariable(variable)) {
53554
53408
  return resolver(getOrRegisterUrlVariable(variable));
53555
53409
  }
53410
+ if (isSwitchVariable(variable)) {
53411
+ let resolvedValue = isVariable(variable.value) ? resolveVariable(variable.value, client, taskContext, extras, resolver) : variable.value;
53412
+ if (isCondition(resolvedValue)) {
53413
+ resolvedValue = {
53414
+ ...resolvedValue,
53415
+ variable: resolveVariable(resolvedValue.variable, client, taskContext, extras, resolver)
53416
+ };
53417
+ }
53418
+ const resolvedValueMap = isVariable(variable.value_map) ? resolveVariable(variable.value_map, client, taskContext, extras, resolver) : variable.value_map;
53419
+ const resolvedDefault = isVariable(variable.default) ? resolveVariable(variable.default, client, taskContext, extras, resolver) : variable.default;
53420
+ return {
53421
+ type: "switch",
53422
+ uid: variable.uid,
53423
+ value: resolvedValue,
53424
+ value_map: resolvedValueMap,
53425
+ default: resolvedDefault
53426
+ };
53427
+ }
53556
53428
  return resolver(getOrRegisterPlainVariable(variable, client, taskContext, extras));
53557
53429
  }
53558
53430
  /*!
@@ -54182,6 +54054,18 @@ Inferred class string: "${iconClasses}."`
54182
54054
  escapePathComponent,
54183
54055
  unescapePathComponent
54184
54056
  });
54057
+ function onTokenChange(cb) {
54058
+ return store.subscribe(getTokenKey(), cb);
54059
+ }
54060
+ function getSessionToken() {
54061
+ return store.getValueSync(getTokenKey());
54062
+ }
54063
+ function setSessionToken(token) {
54064
+ store.setValue(getTokenKey(), token);
54065
+ }
54066
+ function useSessionToken() {
54067
+ return React__namespace.useSyncExternalStore(onTokenChange, getSessionToken);
54068
+ }
54185
54069
  const STORE_EXTRAS_MAP = /* @__PURE__ */ new Map();
54186
54070
  const STORE_VARIABLE_MAP = /* @__PURE__ */ new Map();
54187
54071
  const STORE_SEQUENCE_MAP = /* @__PURE__ */ new Map();
@@ -54433,6 +54317,46 @@ Inferred class string: "${iconClasses}."`
54433
54317
  function StoreProviders({ children }) {
54434
54318
  return /* @__PURE__ */ React__namespace.createElement(BackendStoreSync, null, /* @__PURE__ */ React__namespace.createElement(BrowserStoreSync, null, children));
54435
54319
  }
54320
+ function isConditionTrue(operator, value, other) {
54321
+ if (operator === ConditionOperator.EQUAL) {
54322
+ return value === other;
54323
+ }
54324
+ if (operator === ConditionOperator.NOT_EQUAL) {
54325
+ return value !== other;
54326
+ }
54327
+ if (operator === ConditionOperator.GREATER_EQUAL) {
54328
+ return value >= other;
54329
+ }
54330
+ if (operator === ConditionOperator.GREATER_THAN) {
54331
+ return value > other;
54332
+ }
54333
+ if (operator === ConditionOperator.LESS_EQUAL) {
54334
+ return value <= other;
54335
+ }
54336
+ if (operator === ConditionOperator.LESS_THAN) {
54337
+ return value < other;
54338
+ }
54339
+ if (operator === ConditionOperator.TRUTHY) {
54340
+ return !!value;
54341
+ }
54342
+ throw new Error(`Unexpected operator ${String(operator)} passed to conditional (If) component`);
54343
+ }
54344
+ function useConditionOrVariable(arg) {
54345
+ if (isCondition(arg)) {
54346
+ const value = useVariable(arg.variable)[0];
54347
+ const other = useVariable(arg.other)[0];
54348
+ return isConditionTrue(arg.operator, value, other);
54349
+ }
54350
+ return useVariable(arg)[0];
54351
+ }
54352
+ function useSwitchVariable(variable) {
54353
+ var _a;
54354
+ const value = useConditionOrVariable(variable.value);
54355
+ const [valueMap] = useVariable(variable.value_map);
54356
+ const [defaultValue] = useVariable(variable.default);
54357
+ const lookupKey = String(value);
54358
+ return (_a = valueMap[lookupKey]) != null ? _a : defaultValue;
54359
+ }
54436
54360
  function warnUpdateOnDerivedState() {
54437
54361
  console.warn("You tried to call update on variable with derived state, this is a noop and will be ignored.");
54438
54362
  }
@@ -54478,6 +54402,9 @@ Inferred class string: "${iconClasses}."`
54478
54402
  }, [urlValue]);
54479
54403
  return [urlValue, setUrlValue];
54480
54404
  }
54405
+ if (isSwitchVariable(variable)) {
54406
+ return [useSwitchVariable(variable), warnUpdateOnDerivedState];
54407
+ }
54481
54408
  const recoilState = getOrRegisterPlainVariable(variable, wsClient, taskContext, extras);
54482
54409
  if (!isDerivedVariable(variable.default)) {
54483
54410
  const [value, setValue] = Recoil_index_22(recoilState);
@@ -54495,6 +54422,246 @@ Inferred class string: "${iconClasses}."`
54495
54422
  const deferred = useDeferLoadable(loadable);
54496
54423
  return [deferred, setLoadable];
54497
54424
  }
54425
+ function flexStyles(props, displayCtx2, useDisplayContext) {
54426
+ let flexBasis = props.basis;
54427
+ let flexShrink = props.shrink;
54428
+ let flexGrow = props.grow;
54429
+ if (useDisplayContext) {
54430
+ if (props.width && displayCtx2.direction === "horizontal") {
54431
+ flexBasis != null ? flexBasis : flexBasis = props.width;
54432
+ flexShrink != null ? flexShrink : flexShrink = "0";
54433
+ flexGrow != null ? flexGrow : flexGrow = "0";
54434
+ }
54435
+ if (props.height && displayCtx2.direction === "vertical") {
54436
+ flexBasis != null ? flexBasis : flexBasis = props.height;
54437
+ flexShrink != null ? flexShrink : flexShrink = "0";
54438
+ flexGrow != null ? flexGrow : flexGrow = "0";
54439
+ }
54440
+ }
54441
+ if (props.hug || props.hug !== false && displayCtx2.hug) {
54442
+ flexBasis != null ? flexBasis : flexBasis = "content";
54443
+ flexShrink != null ? flexShrink : flexShrink = "1";
54444
+ flexGrow != null ? flexGrow : flexGrow = "0";
54445
+ }
54446
+ return { flexBasis, flexGrow, flexShrink };
54447
+ }
54448
+ function parseRawCss(rawCss) {
54449
+ const isRawObject = typeof rawCss === "object" && rawCss !== null && rawCss !== void 0;
54450
+ const componentCss = !isRawObject && typeof rawCss === "string" ? rawCss : "";
54451
+ const styles2 = isRawObject ? rawCss : {};
54452
+ return [styles2, componentCss];
54453
+ }
54454
+ function useComponentStyles(props, useDisplayContext = true) {
54455
+ const [rawCssValue] = useVariable(props.raw_css);
54456
+ const [rawStyles, rawCss] = parseRawCss(rawCssValue);
54457
+ const displayCtx$1 = React.useContext(displayCtx);
54458
+ const flexProps = flexStyles(props, displayCtx$1, useDisplayContext);
54459
+ const styles2 = React.useMemo(() => {
54460
+ var _a;
54461
+ const stylesObj = {
54462
+ backgroundColor: props.background,
54463
+ border: props.border,
54464
+ borderRadius: props.border_radius,
54465
+ color: props.color,
54466
+ fontFamily: props.font,
54467
+ fontSize: props.font_size,
54468
+ fontStyle: props.italic ? "italic" : "normal",
54469
+ fontWeight: props.bold ? "bold" : "normal",
54470
+ gap: props.gap,
54471
+ height: props.height,
54472
+ margin: props.margin,
54473
+ maxHeight: props.max_height,
54474
+ maxWidth: props.max_width,
54475
+ minHeight: props.min_height,
54476
+ minWidth: props.min_width,
54477
+ overflow: props.overflow,
54478
+ padding: props.padding,
54479
+ position: props.position,
54480
+ textDecoration: props.underline ? "underline" : "none",
54481
+ width: props.width,
54482
+ ...flexProps,
54483
+ ...rawStyles,
54484
+ ...(_a = props.style) != null ? _a : {}
54485
+ };
54486
+ return Object.fromEntries(Object.entries(stylesObj).filter(([, v2]) => v2 !== null && v2 !== void 0));
54487
+ }, [useDeepCompare(props)]);
54488
+ return [styles2, rawCss];
54489
+ }
54490
+ function useUrlSync(options) {
54491
+ const urlSerializer = React.useCallback((val) => {
54492
+ if (val === void 0 || val === null) {
54493
+ return "";
54494
+ }
54495
+ if (["string", "number", "boolean"].includes(typeof val)) {
54496
+ return String(val);
54497
+ }
54498
+ return JSON.stringify(val);
54499
+ }, []);
54500
+ const urlDeserializer = React.useCallback((val) => {
54501
+ if (val === "") {
54502
+ return void 0;
54503
+ }
54504
+ try {
54505
+ return JSON.parse(val);
54506
+ } catch {
54507
+ return val;
54508
+ }
54509
+ }, []);
54510
+ const listenChangeURL = React.useCallback((handler) => {
54511
+ const unregister = options.history.listen(() => {
54512
+ handler();
54513
+ });
54514
+ return () => unregister();
54515
+ }, []);
54516
+ const memoryOptions = {
54517
+ getURL: () => {
54518
+ return window.location.origin + options.history.location.pathname + options.history.location.search;
54519
+ },
54520
+ pushURL: (url) => {
54521
+ options.history.push(url.replace(window.location.origin, ""));
54522
+ },
54523
+ replaceURL: (url) => {
54524
+ options.history.replace(url.replace(window.location.origin, ""));
54525
+ }
54526
+ };
54527
+ return {
54528
+ browserInterface: {
54529
+ listenChangeURL,
54530
+ ...options.memory_TEST ? memoryOptions : {}
54531
+ },
54532
+ deserialize: urlDeserializer,
54533
+ location: { part: "queryParams" },
54534
+ serialize: urlSerializer
54535
+ };
54536
+ }
54537
+ const Wrapper$2 = styled__default.default.div`
54538
+ display: flex;
54539
+ align-items: center;
54540
+ justify-content: center;
54541
+
54542
+ width: 100%;
54543
+ height: 100%;
54544
+ `;
54545
+ const FlashingDots = styled__default.default.div`
54546
+ position: relative;
54547
+
54548
+ width: 10px;
54549
+ height: 10px;
54550
+
54551
+ color: ${(props) => props.theme.colors.grey4};
54552
+
54553
+ background-color: ${(props) => props.theme.colors.grey4};
54554
+ border-radius: 5px;
54555
+
54556
+ animation: dot-flashing 1s infinite linear alternate;
54557
+ animation-delay: 0.5s;
54558
+
54559
+ &::before,
54560
+ &::after {
54561
+ content: '';
54562
+ position: absolute;
54563
+ top: 0;
54564
+ display: inline-block;
54565
+ }
54566
+
54567
+ &::before {
54568
+ left: -15px;
54569
+
54570
+ width: 10px;
54571
+ height: 10px;
54572
+
54573
+ color: ${(props) => props.theme.colors.grey4};
54574
+
54575
+ background-color: ${(props) => props.theme.colors.grey4};
54576
+ border-radius: 5px;
54577
+
54578
+ animation: dot-flashing 1s infinite alternate;
54579
+ animation-delay: 0s;
54580
+ }
54581
+
54582
+ &::after {
54583
+ left: 15px;
54584
+
54585
+ width: 10px;
54586
+ height: 10px;
54587
+
54588
+ color: ${(props) => props.theme.colors.grey4};
54589
+
54590
+ background-color: ${(props) => props.theme.colors.grey4};
54591
+ border-radius: 5px;
54592
+
54593
+ animation: dot-flashing 1s infinite alternate;
54594
+ animation-delay: 1s;
54595
+ }
54596
+
54597
+ @keyframes dot-flashing {
54598
+ 0% {
54599
+ background-color: ${(props) => props.theme.colors.grey4};
54600
+ }
54601
+
54602
+ 50%,
54603
+ 100% {
54604
+ background-color: ${(props) => props.theme.colors.grey3};
54605
+ }
54606
+ }
54607
+ `;
54608
+ function Dots(props) {
54609
+ return /* @__PURE__ */ React__default.default.createElement(Wrapper$2, { className: props.className, style: props.style }, /* @__PURE__ */ React__default.default.createElement(FlashingDots, { "data-testid": "LOADING" }));
54610
+ }
54611
+ const StyledDots$1 = injectCss(Dots);
54612
+ function DefaultFallback(props) {
54613
+ const [style, css2] = useComponentStyles(props);
54614
+ return /* @__PURE__ */ React__default.default.createElement(StyledDots$1, { $rawCss: css2, style });
54615
+ }
54616
+ const Center = styled__default.default.div`
54617
+ overflow: hidden;
54618
+ display: flex;
54619
+ flex-direction: column;
54620
+ align-items: center;
54621
+ justify-content: center;
54622
+
54623
+ width: 100%;
54624
+ height: 100%;
54625
+
54626
+ background: ${(props) => props.colored ? props.theme.colors.blue1 : ""};
54627
+ `;
54628
+ const CenteredDivWithGap = styled__default.default(Center)`
54629
+ gap: 0.6rem;
54630
+ margin: 10px;
54631
+ text-align: center;
54632
+ `;
54633
+ const errorMessages = {
54634
+ "403": {
54635
+ description: "You are not authorised to access this application. Please contact the application owner to enable access.",
54636
+ styling: "error",
54637
+ title: "We were not able to authenticate you"
54638
+ },
54639
+ default: {
54640
+ description: "Your login session may have expired. Try again.",
54641
+ styling: "primary",
54642
+ title: "We were not able to authenticate you"
54643
+ }
54644
+ };
54645
+ function ErrorPage() {
54646
+ const { search } = useLocation();
54647
+ const query = React.useMemo(() => new URLSearchParams(search), [search]);
54648
+ const code = query.get("code");
54649
+ const errorConfig = code && errorMessages[code] || errorMessages.default;
54650
+ return /* @__PURE__ */ React__default.default.createElement(CenteredDivWithGap, null, /* @__PURE__ */ React__default.default.createElement("h1", null, errorConfig.title), /* @__PURE__ */ React__default.default.createElement("p", null, errorConfig.description), /* @__PURE__ */ React__default.default.createElement(Button$1, { href: "/login", styling: errorConfig.styling }, "Retry"));
54651
+ }
54652
+ function useActionRegistry() {
54653
+ const { actionRegistry: actions } = React.useContext(registriesCtx);
54654
+ const get2 = React.useCallback(
54655
+ (impl) => {
54656
+ if (actions && actions[impl.name]) {
54657
+ return actions[impl.name];
54658
+ }
54659
+ throw new Error(`Attempted to load an action (${impl.name}) that is not in the registry`);
54660
+ },
54661
+ [actions]
54662
+ );
54663
+ return React.useMemo(() => ({ get: get2 }), [get2]);
54664
+ }
54498
54665
  async function invokeAction(input, executionId, annotatedAction, actionCtx) {
54499
54666
  const resolvedKwargs = Object.keys(annotatedAction.dynamic_kwargs).reduce(
54500
54667
  (acc, k2) => {
@@ -54843,6 +55010,9 @@ Inferred class string: "${iconClasses}."`
54843
55010
  ctx.extras,
54844
55011
  (v2) => ctx.snapshot.getLoadable(v2).getValue()
54845
55012
  );
55013
+ if (isResolvedSwitchVariable(resolved)) {
55014
+ throw new UserError("Switch variables are not supported in this context");
55015
+ }
54846
55016
  if (!shouldFetchVariable || !isDerivedVariable(variable) && !isDataVariable(variable) && !isDerivedDataVariable(variable)) {
54847
55017
  return resolved;
54848
55018
  }
@@ -55193,6 +55363,14 @@ Inferred class string: "${iconClasses}."`
55193
55363
  values: cleanedValues
55194
55364
  };
55195
55365
  }
55366
+ if (isResolvedSwitchVariable(value)) {
55367
+ return {
55368
+ ...value,
55369
+ value: cleanValue(value.value, force),
55370
+ value_map: cleanValue(value.value_map, force),
55371
+ default: cleanValue(value.default, force)
55372
+ };
55373
+ }
55196
55374
  return value;
55197
55375
  }
55198
55376
  function cleanKwargs(kwargs, force) {
@@ -55811,7 +55989,8 @@ Inferred class string: "${iconClasses}."`
55811
55989
  `;
55812
55990
  function ErrorDisplay$1(props) {
55813
55991
  var _a, _b, _c, _d, _e2;
55814
- const [styles2, css2] = parseRawCss((_a = props.config) == null ? void 0 : _a.raw_css);
55992
+ const [cssValue] = useVariable((_a = props.config) == null ? void 0 : _a.raw_css);
55993
+ const [styles2, css2] = parseRawCss(cssValue);
55815
55994
  const defaultMessage = props.error instanceof UserError ? props.error.message : "Try again or contact the application owner.";
55816
55995
  return /* @__PURE__ */ React__default.default.createElement(ErrorDisplayWrapper, { $rawCss: css2, style: styles2 }, /* @__PURE__ */ React__default.default.createElement(ContentWrapper, null, /* @__PURE__ */ React__default.default.createElement(ErrorContent, null, /* @__PURE__ */ React__default.default.createElement(ErrorTitle$1, null, /* @__PURE__ */ React__default.default.createElement(IconWrapper, null, /* @__PURE__ */ React__default.default.createElement(ErrorIcon, { "aria-hidden": true, className: "fa-solid fa-circle-xmark fa-lg" })), (_c = (_b = props == null ? void 0 : props.config) == null ? void 0 : _b.title) != null ? _c : "Error"), /* @__PURE__ */ React__default.default.createElement(ErrorText, null, (_e2 = (_d = props == null ? void 0 : props.config) == null ? void 0 : _d.description) != null ? _e2 : defaultMessage))), props.resetErrorBoundary && /* @__PURE__ */ React__default.default.createElement(RetryButton, { onClick: () => props.resetErrorBoundary(props.error), type: "button" }, /* @__PURE__ */ React__default.default.createElement("i", { "aria-hidden": true, className: "fa-solid fa-rotate fa-xl" })));
55817
55996
  }
@@ -56725,6 +56904,8 @@ Inferred class string: "${iconClasses}."`
56725
56904
  ctx.eventBus.publish("URL_VARIABLE_LOADED", { variable, value: variable.default });
56726
56905
  } else if (isDataVariable(variable))
56727
56906
  ;
56907
+ else if (isSwitchVariable(variable))
56908
+ ;
56728
56909
  else {
56729
56910
  const plainAtom = getOrRegisterPlainVariable(variable, ctx.wsClient, ctx.taskCtx, ctx.extras);
56730
56911
  ctx.reset(plainAtom);
@@ -82515,6 +82696,8 @@ Inferred class string: "${iconClasses}."`
82515
82696
  exports.injectCss = injectCss;
82516
82697
  exports.isActionImpl = isActionImpl;
82517
82698
  exports.isAnnotatedAction = isAnnotatedAction;
82699
+ exports.isCondition = isCondition;
82700
+ exports.isConditionTrue = isConditionTrue;
82518
82701
  exports.isDataVariable = isDataVariable;
82519
82702
  exports.isDerivedDataVariable = isDerivedDataVariable;
82520
82703
  exports.isDerivedVariable = isDerivedVariable;
@@ -82527,6 +82710,8 @@ Inferred class string: "${iconClasses}."`
82527
82710
  exports.isResolvedDataVariable = isResolvedDataVariable;
82528
82711
  exports.isResolvedDerivedDataVariable = isResolvedDerivedDataVariable;
82529
82712
  exports.isResolvedDerivedVariable = isResolvedDerivedVariable;
82713
+ exports.isResolvedSwitchVariable = isResolvedSwitchVariable;
82714
+ exports.isSwitchVariable = isSwitchVariable;
82530
82715
  exports.isTaskResponse = isTaskResponse$1;
82531
82716
  exports.isUrlVariable = isUrlVariable;
82532
82717
  exports.isVariable = isVariable;
@@ -82555,6 +82740,7 @@ Inferred class string: "${iconClasses}."`
82555
82740
  exports.useComponentRegistry = useComponentRegistry;
82556
82741
  exports.useComponentStyles = useComponentStyles;
82557
82742
  exports.useComponents = useComponents;
82743
+ exports.useConditionOrVariable = useConditionOrVariable;
82558
82744
  exports.useConfig = useConfig;
82559
82745
  exports.useDataVariable = useDataVariable;
82560
82746
  exports.useDeferLoadable = useDeferLoadable;
@@ -82567,6 +82753,7 @@ Inferred class string: "${iconClasses}."`
82567
82753
  exports.useRequestExtras = useRequestExtras;
82568
82754
  exports.useSession = useSession;
82569
82755
  exports.useSessionToken = useSessionToken;
82756
+ exports.useSwitchVariable = useSwitchVariable;
82570
82757
  exports.useTaskContext = useTaskContext;
82571
82758
  exports.useTemplate = useTemplate;
82572
82759
  exports.useTriggerIndex = useTriggerIndex;