@cube-dev/embed-sdk
Advanced tools
+15
-19
@@ -0,1 +1,2 @@ | ||
| /// <reference types="@/base-types" /> | ||
| /// <reference types="react" /> | ||
@@ -56,3 +57,3 @@ | ||
| title: string; | ||
| type: "ordinal" | "nominal" | "quantitative" | "temporal"; | ||
| type: "ordinal" | "quantitative" | "temporal" | "nominal"; | ||
| } | undefined; | ||
@@ -69,3 +70,3 @@ color: { | ||
| title: string; | ||
| type: "ordinal" | "nominal" | "quantitative" | "temporal"; | ||
| type: "ordinal" | "quantitative" | "temporal" | "nominal"; | ||
| } | undefined; | ||
@@ -82,3 +83,3 @@ tooltip: { | ||
| params?: TopLevelParameter[] | undefined; | ||
| title?: Text_2 | TitleParams<ExprRef | SignalRef> | undefined; | ||
| title?: Text_2 | TitleParams<SignalRef | ExprRef> | undefined; | ||
| name?: string | undefined; | ||
@@ -93,10 +94,10 @@ description?: string | undefined; | ||
| bounds?: "full" | "flush" | undefined; | ||
| view?: ViewBackground<ExprRef | SignalRef> | undefined; | ||
| view?: ViewBackground<SignalRef | ExprRef> | undefined; | ||
| width?: number | "container" | Step | undefined; | ||
| height?: number | "container" | Step | undefined; | ||
| background?: string | ExprRef | SignalRef | undefined; | ||
| padding?: ExprRef | SignalRef | Padding | undefined; | ||
| background?: string | SignalRef | ExprRef | undefined; | ||
| padding?: SignalRef | ExprRef | Padding | undefined; | ||
| autosize?: AutosizeType | AutoSizeParams | undefined; | ||
| $schema?: string | undefined; | ||
| config?: Config<ExprRef | SignalRef> | undefined; | ||
| config?: Config<SignalRef | ExprRef> | undefined; | ||
| datasets?: Datasets | undefined; | ||
@@ -119,3 +120,3 @@ usermeta?: Dict<unknown> | undefined; | ||
| title: string; | ||
| type: "ordinal" | "nominal" | "quantitative" | "temporal"; | ||
| type: "ordinal" | "quantitative" | "temporal" | "nominal"; | ||
| } | undefined; | ||
@@ -132,3 +133,3 @@ y: { | ||
| title: string; | ||
| type: "ordinal" | "nominal" | "quantitative" | "temporal"; | ||
| type: "ordinal" | "quantitative" | "temporal" | "nominal"; | ||
| } | undefined; | ||
@@ -145,3 +146,3 @@ tooltip: { | ||
| params?: TopLevelParameter[] | undefined; | ||
| title?: Text_2 | TitleParams<ExprRef | SignalRef> | undefined; | ||
| title?: Text_2 | TitleParams<SignalRef | ExprRef> | undefined; | ||
| name?: string | undefined; | ||
@@ -156,10 +157,10 @@ description?: string | undefined; | ||
| bounds?: "full" | "flush" | undefined; | ||
| view?: ViewBackground<ExprRef | SignalRef> | undefined; | ||
| view?: ViewBackground<SignalRef | ExprRef> | undefined; | ||
| width?: number | "container" | Step | undefined; | ||
| height?: number | "container" | Step | undefined; | ||
| background?: string | ExprRef | SignalRef | undefined; | ||
| padding?: ExprRef | SignalRef | Padding | undefined; | ||
| background?: string | SignalRef | ExprRef | undefined; | ||
| padding?: SignalRef | ExprRef | Padding | undefined; | ||
| autosize?: AutosizeType | AutoSizeParams | undefined; | ||
| $schema?: string | undefined; | ||
| config?: Config<ExprRef | SignalRef> | undefined; | ||
| config?: Config<SignalRef | ExprRef> | undefined; | ||
| datasets?: Datasets | undefined; | ||
@@ -523,7 +524,2 @@ usermeta?: Dict<unknown> | undefined; | ||
| /** | ||
| * @public | ||
| */ | ||
| export declare function greeting(): CertifiedQueryResponse | undefined; | ||
| declare interface HtmlChartSpec { | ||
@@ -530,0 +526,0 @@ htmlContent?: string; |
+2
-2
| { | ||
| "name": "@cube-dev/embed-sdk", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "author": "Cube Dev, Inc.", | ||
@@ -25,2 +25,2 @@ "license": "MIT", | ||
| "sideEffects": false | ||
| } | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { P as PropTypes, d as useConfig, j as jsxRuntimeExports } from "./index-Wg7C9suO.mjs"; | ||
| import React__default, { useState } from "react"; | ||
| import { tasty, Form, Spin, Input, SubmitButton, Alert } from "@cube-dev/ui-kit"; | ||
| function _typeof(obj) { | ||
| "@babel/helpers - typeof"; | ||
| if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
| _typeof = function(obj2) { | ||
| return typeof obj2; | ||
| }; | ||
| } else { | ||
| _typeof = function(obj2) { | ||
| return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; | ||
| }; | ||
| } | ||
| return _typeof(obj); | ||
| } | ||
| function _objectWithoutPropertiesLoose(source, excluded) { | ||
| if (source == null) return {}; | ||
| var target = {}; | ||
| var sourceKeys = Object.keys(source); | ||
| var key, i; | ||
| for (i = 0; i < sourceKeys.length; i++) { | ||
| key = sourceKeys[i]; | ||
| if (excluded.indexOf(key) >= 0) continue; | ||
| target[key] = source[key]; | ||
| } | ||
| return target; | ||
| } | ||
| function _objectWithoutProperties(source, excluded) { | ||
| if (source == null) return {}; | ||
| var target = _objectWithoutPropertiesLoose(source, excluded); | ||
| var key, i; | ||
| if (Object.getOwnPropertySymbols) { | ||
| var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
| for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
| key = sourceSymbolKeys[i]; | ||
| if (excluded.indexOf(key) >= 0) continue; | ||
| if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
| target[key] = source[key]; | ||
| } | ||
| } | ||
| return target; | ||
| } | ||
| function _slicedToArray(arr, i) { | ||
| return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
| } | ||
| function _arrayWithHoles(arr) { | ||
| if (Array.isArray(arr)) return arr; | ||
| } | ||
| function _iterableToArrayLimit(arr, i) { | ||
| if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
| var _arr = []; | ||
| var _n = true; | ||
| var _d = false; | ||
| var _e = void 0; | ||
| try { | ||
| for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
| _arr.push(_s.value); | ||
| if (i && _arr.length === i) break; | ||
| } | ||
| } catch (err) { | ||
| _d = true; | ||
| _e = err; | ||
| } finally { | ||
| try { | ||
| if (!_n && _i["return"] != null) _i["return"](); | ||
| } finally { | ||
| if (_d) throw _e; | ||
| } | ||
| } | ||
| return _arr; | ||
| } | ||
| function _unsupportedIterableToArray(o, minLen) { | ||
| if (!o) return; | ||
| if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
| var n = Object.prototype.toString.call(o).slice(8, -1); | ||
| if (n === "Object" && o.constructor) n = o.constructor.name; | ||
| if (n === "Map" || n === "Set") return Array.from(o); | ||
| if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
| } | ||
| function _arrayLikeToArray(arr, len) { | ||
| if (len == null || len > arr.length) len = arr.length; | ||
| for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
| return arr2; | ||
| } | ||
| function _nonIterableRest() { | ||
| throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
| } | ||
| var isUnknownObject = function isUnknownObject2(raw) { | ||
| return raw !== null && _typeof(raw) === "object"; | ||
| }; | ||
| var isPromise = function isPromise2(raw) { | ||
| return isUnknownObject(raw) && typeof raw.then === "function"; | ||
| }; | ||
| var isStripe = function isStripe2(raw) { | ||
| return isUnknownObject(raw) && typeof raw.elements === "function" && typeof raw.createToken === "function" && typeof raw.createPaymentMethod === "function" && typeof raw.confirmCardPayment === "function"; | ||
| }; | ||
| var PLAIN_OBJECT_STR = "[object Object]"; | ||
| var isEqual = function isEqual2(left, right) { | ||
| if (!isUnknownObject(left) || !isUnknownObject(right)) { | ||
| return left === right; | ||
| } | ||
| var leftArray = Array.isArray(left); | ||
| var rightArray = Array.isArray(right); | ||
| if (leftArray !== rightArray) return false; | ||
| var leftPlainObject = Object.prototype.toString.call(left) === PLAIN_OBJECT_STR; | ||
| var rightPlainObject = Object.prototype.toString.call(right) === PLAIN_OBJECT_STR; | ||
| if (leftPlainObject !== rightPlainObject) return false; | ||
| if (!leftPlainObject && !leftArray) return false; | ||
| var leftKeys = Object.keys(left); | ||
| var rightKeys = Object.keys(right); | ||
| if (leftKeys.length !== rightKeys.length) return false; | ||
| var keySet = {}; | ||
| for (var i = 0; i < leftKeys.length; i += 1) { | ||
| keySet[leftKeys[i]] = true; | ||
| } | ||
| for (var _i = 0; _i < rightKeys.length; _i += 1) { | ||
| keySet[rightKeys[_i]] = true; | ||
| } | ||
| var allKeys = Object.keys(keySet); | ||
| if (allKeys.length !== leftKeys.length) { | ||
| return false; | ||
| } | ||
| var l = left; | ||
| var r = right; | ||
| var pred = function pred2(key) { | ||
| return isEqual2(l[key], r[key]); | ||
| }; | ||
| return allKeys.every(pred); | ||
| }; | ||
| var usePrevious = function usePrevious2(value) { | ||
| var ref = React__default.useRef(value); | ||
| React__default.useEffect(function() { | ||
| ref.current = value; | ||
| }, [value]); | ||
| return ref.current; | ||
| }; | ||
| var INVALID_STRIPE_ERROR = "Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details."; | ||
| var validateStripe = function validateStripe2(maybeStripe) { | ||
| if (maybeStripe === null || isStripe(maybeStripe)) { | ||
| return maybeStripe; | ||
| } | ||
| throw new Error(INVALID_STRIPE_ERROR); | ||
| }; | ||
| var parseStripeProp = function parseStripeProp2(raw) { | ||
| if (isPromise(raw)) { | ||
| return { | ||
| tag: "async", | ||
| stripePromise: Promise.resolve(raw).then(validateStripe) | ||
| }; | ||
| } | ||
| var stripe = validateStripe(raw); | ||
| if (stripe === null) { | ||
| return { | ||
| tag: "empty" | ||
| }; | ||
| } | ||
| return { | ||
| tag: "sync", | ||
| stripe | ||
| }; | ||
| }; | ||
| var ElementsContext = /* @__PURE__ */ React__default.createContext(null); | ||
| ElementsContext.displayName = "ElementsContext"; | ||
| var parseElementsContext = function parseElementsContext2(ctx, useCase) { | ||
| if (!ctx) { | ||
| throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(useCase, " in an <Elements> provider.")); | ||
| } | ||
| return ctx; | ||
| }; | ||
| var Elements = function Elements2(_ref) { | ||
| var rawStripeProp = _ref.stripe, options = _ref.options, children = _ref.children; | ||
| var _final = React__default.useRef(false); | ||
| var isMounted = React__default.useRef(true); | ||
| var parsed = React__default.useMemo(function() { | ||
| return parseStripeProp(rawStripeProp); | ||
| }, [rawStripeProp]); | ||
| var _React$useState = React__default.useState(function() { | ||
| return { | ||
| stripe: null, | ||
| elements: null | ||
| }; | ||
| }), _React$useState2 = _slicedToArray(_React$useState, 2), ctx = _React$useState2[0], setContext = _React$useState2[1]; | ||
| var prevStripe = usePrevious(rawStripeProp); | ||
| var prevOptions = usePrevious(options); | ||
| if (prevStripe !== null) { | ||
| if (prevStripe !== rawStripeProp) { | ||
| console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."); | ||
| } | ||
| if (!isEqual(options, prevOptions)) { | ||
| console.warn("Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop."); | ||
| } | ||
| } | ||
| if (!_final.current) { | ||
| if (parsed.tag === "sync") { | ||
| _final.current = true; | ||
| setContext({ | ||
| stripe: parsed.stripe, | ||
| elements: parsed.stripe.elements(options) | ||
| }); | ||
| } | ||
| if (parsed.tag === "async") { | ||
| _final.current = true; | ||
| parsed.stripePromise.then(function(stripe) { | ||
| if (stripe && isMounted.current) { | ||
| setContext({ | ||
| stripe, | ||
| elements: stripe.elements(options) | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| React__default.useEffect(function() { | ||
| return function() { | ||
| isMounted.current = false; | ||
| }; | ||
| }, []); | ||
| React__default.useEffect(function() { | ||
| var anyStripe = ctx.stripe; | ||
| if (!anyStripe || !anyStripe._registerWrapper || !anyStripe.registerAppInfo) { | ||
| return; | ||
| } | ||
| anyStripe._registerWrapper({ | ||
| name: "react-stripe-js", | ||
| version: "1.4.1" | ||
| }); | ||
| anyStripe.registerAppInfo({ | ||
| name: "react-stripe-js", | ||
| version: "1.4.1", | ||
| url: "https://stripe.com/docs/stripe-js/react" | ||
| }); | ||
| }, [ctx.stripe]); | ||
| return /* @__PURE__ */ React__default.createElement(ElementsContext.Provider, { | ||
| value: ctx | ||
| }, children); | ||
| }; | ||
| Elements.propTypes = { | ||
| stripe: PropTypes.any, | ||
| options: PropTypes.object | ||
| }; | ||
| var useElementsContextWithUseCase = function useElementsContextWithUseCase2(useCaseMessage) { | ||
| var ctx = React__default.useContext(ElementsContext); | ||
| return parseElementsContext(ctx, useCaseMessage); | ||
| }; | ||
| var useElements = function useElements2() { | ||
| var _useElementsContextWi = useElementsContextWithUseCase("calls useElements()"), elements = _useElementsContextWi.elements; | ||
| return elements; | ||
| }; | ||
| var useStripe = function useStripe2() { | ||
| var _useElementsContextWi2 = useElementsContextWithUseCase("calls useStripe()"), stripe = _useElementsContextWi2.stripe; | ||
| return stripe; | ||
| }; | ||
| ({ | ||
| children: PropTypes.func.isRequired | ||
| }); | ||
| var useCallbackReference = function useCallbackReference2(cb) { | ||
| var ref = React__default.useRef(cb); | ||
| React__default.useEffect(function() { | ||
| ref.current = cb; | ||
| }, [cb]); | ||
| return function() { | ||
| if (ref.current) { | ||
| ref.current.apply(ref, arguments); | ||
| } | ||
| }; | ||
| }; | ||
| var extractUpdateableOptions = function extractUpdateableOptions2(options) { | ||
| if (!isUnknownObject(options)) { | ||
| return {}; | ||
| } | ||
| options.paymentRequest; | ||
| var rest = _objectWithoutProperties(options, ["paymentRequest"]); | ||
| return rest; | ||
| }; | ||
| var noop = function noop2() { | ||
| }; | ||
| var capitalized = function capitalized2(str) { | ||
| return str.charAt(0).toUpperCase() + str.slice(1); | ||
| }; | ||
| var createElementComponent = function createElementComponent2(type, isServer2) { | ||
| var displayName = "".concat(capitalized(type), "Element"); | ||
| var ClientElement = function ClientElement2(_ref) { | ||
| var id = _ref.id, className = _ref.className, _ref$options = _ref.options, options = _ref$options === void 0 ? {} : _ref$options, _ref$onBlur = _ref.onBlur, onBlur = _ref$onBlur === void 0 ? noop : _ref$onBlur, _ref$onFocus = _ref.onFocus, onFocus = _ref$onFocus === void 0 ? noop : _ref$onFocus, _ref$onReady = _ref.onReady, onReady = _ref$onReady === void 0 ? noop : _ref$onReady, _ref$onChange = _ref.onChange, onChange = _ref$onChange === void 0 ? noop : _ref$onChange, _ref$onEscape = _ref.onEscape, onEscape = _ref$onEscape === void 0 ? noop : _ref$onEscape, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? noop : _ref$onClick; | ||
| var _useElementsContextWi = useElementsContextWithUseCase("mounts <".concat(displayName, ">")), elements = _useElementsContextWi.elements; | ||
| var elementRef = React__default.useRef(null); | ||
| var domNode = React__default.useRef(null); | ||
| var callOnReady = useCallbackReference(onReady); | ||
| var callOnBlur = useCallbackReference(onBlur); | ||
| var callOnFocus = useCallbackReference(onFocus); | ||
| var callOnClick = useCallbackReference(onClick); | ||
| var callOnChange = useCallbackReference(onChange); | ||
| var callOnEscape = useCallbackReference(onEscape); | ||
| React__default.useLayoutEffect(function() { | ||
| if (elementRef.current == null && elements && domNode.current != null) { | ||
| var element = elements.create(type, options); | ||
| elementRef.current = element; | ||
| element.mount(domNode.current); | ||
| element.on("ready", function() { | ||
| return callOnReady(element); | ||
| }); | ||
| element.on("change", callOnChange); | ||
| element.on("blur", callOnBlur); | ||
| element.on("focus", callOnFocus); | ||
| element.on("escape", callOnEscape); | ||
| element.on("click", callOnClick); | ||
| } | ||
| }); | ||
| var prevOptions = React__default.useRef(options); | ||
| React__default.useEffect(function() { | ||
| if (prevOptions.current && prevOptions.current.paymentRequest !== options.paymentRequest) { | ||
| console.warn("Unsupported prop change: options.paymentRequest is not a customizable property."); | ||
| } | ||
| var updateableOptions = extractUpdateableOptions(options); | ||
| if (Object.keys(updateableOptions).length !== 0 && !isEqual(updateableOptions, extractUpdateableOptions(prevOptions.current))) { | ||
| if (elementRef.current) { | ||
| elementRef.current.update(updateableOptions); | ||
| prevOptions.current = options; | ||
| } | ||
| } | ||
| }, [options]); | ||
| React__default.useLayoutEffect(function() { | ||
| return function() { | ||
| if (elementRef.current) { | ||
| elementRef.current.destroy(); | ||
| } | ||
| }; | ||
| }, []); | ||
| return /* @__PURE__ */ React__default.createElement("div", { | ||
| id, | ||
| className, | ||
| ref: domNode | ||
| }); | ||
| }; | ||
| var ServerElement = function ServerElement2(props) { | ||
| useElementsContextWithUseCase("mounts <".concat(displayName, ">")); | ||
| var id = props.id, className = props.className; | ||
| return /* @__PURE__ */ React__default.createElement("div", { | ||
| id, | ||
| className | ||
| }); | ||
| }; | ||
| var Element = isServer2 ? ServerElement : ClientElement; | ||
| Element.propTypes = { | ||
| id: PropTypes.string, | ||
| className: PropTypes.string, | ||
| onChange: PropTypes.func, | ||
| onBlur: PropTypes.func, | ||
| onFocus: PropTypes.func, | ||
| onReady: PropTypes.func, | ||
| onClick: PropTypes.func, | ||
| options: PropTypes.object | ||
| }; | ||
| Element.displayName = displayName; | ||
| Element.__elementType = type; | ||
| return Element; | ||
| }; | ||
| var isServer = typeof window === "undefined"; | ||
| createElementComponent("auBankAccount", isServer); | ||
| var CardElement = createElementComponent("card", isServer); | ||
| createElementComponent("cardNumber", isServer); | ||
| createElementComponent("cardExpiry", isServer); | ||
| createElementComponent("cardCvc", isServer); | ||
| createElementComponent("fpxBank", isServer); | ||
| createElementComponent("iban", isServer); | ||
| createElementComponent("idealBank", isServer); | ||
| createElementComponent("p24Bank", isServer); | ||
| createElementComponent("epsBank", isServer); | ||
| createElementComponent("payment", isServer); | ||
| createElementComponent("paymentRequestButton", isServer); | ||
| createElementComponent("afterpayClearpayMessage", isServer); | ||
| var V3_URL = "https://js.stripe.com/v3"; | ||
| var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/; | ||
| var EXISTING_SCRIPT_MESSAGE = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"; | ||
| var findScript = function findScript2() { | ||
| var scripts = document.querySelectorAll('script[src^="'.concat(V3_URL, '"]')); | ||
| for (var i = 0; i < scripts.length; i++) { | ||
| var script = scripts[i]; | ||
| if (!V3_URL_REGEX.test(script.src)) { | ||
| continue; | ||
| } | ||
| return script; | ||
| } | ||
| return null; | ||
| }; | ||
| var injectScript = function injectScript2(params) { | ||
| var queryString = ""; | ||
| var script = document.createElement("script"); | ||
| script.src = "".concat(V3_URL).concat(queryString); | ||
| var headOrBody = document.head || document.body; | ||
| if (!headOrBody) { | ||
| throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element."); | ||
| } | ||
| headOrBody.appendChild(script); | ||
| return script; | ||
| }; | ||
| var registerWrapper = function registerWrapper2(stripe, startTime) { | ||
| if (!stripe || !stripe._registerWrapper) { | ||
| return; | ||
| } | ||
| stripe._registerWrapper({ | ||
| name: "stripe-js", | ||
| version: "1.17.1", | ||
| startTime | ||
| }); | ||
| }; | ||
| var stripePromise = null; | ||
| var loadScript = function loadScript2(params) { | ||
| if (stripePromise !== null) { | ||
| return stripePromise; | ||
| } | ||
| stripePromise = new Promise(function(resolve, reject) { | ||
| if (typeof window === "undefined") { | ||
| resolve(null); | ||
| return; | ||
| } | ||
| if (window.Stripe && params) { | ||
| console.warn(EXISTING_SCRIPT_MESSAGE); | ||
| } | ||
| if (window.Stripe) { | ||
| resolve(window.Stripe); | ||
| return; | ||
| } | ||
| try { | ||
| var script = findScript(); | ||
| if (script && params) { | ||
| console.warn(EXISTING_SCRIPT_MESSAGE); | ||
| } else if (!script) { | ||
| script = injectScript(params); | ||
| } | ||
| script.addEventListener("load", function() { | ||
| if (window.Stripe) { | ||
| resolve(window.Stripe); | ||
| } else { | ||
| reject(new Error("Stripe.js not available")); | ||
| } | ||
| }); | ||
| script.addEventListener("error", function() { | ||
| reject(new Error("Failed to load Stripe.js")); | ||
| }); | ||
| } catch (error) { | ||
| reject(error); | ||
| return; | ||
| } | ||
| }); | ||
| return stripePromise; | ||
| }; | ||
| var initStripe = function initStripe2(maybeStripe, args, startTime) { | ||
| if (maybeStripe === null) { | ||
| return null; | ||
| } | ||
| var stripe = maybeStripe.apply(void 0, args); | ||
| registerWrapper(stripe, startTime); | ||
| return stripe; | ||
| }; | ||
| var stripePromise$1 = Promise.resolve().then(function() { | ||
| return loadScript(null); | ||
| }); | ||
| var loadCalled = false; | ||
| stripePromise$1["catch"](function(err) { | ||
| if (!loadCalled) { | ||
| console.warn(err); | ||
| } | ||
| }); | ||
| var loadStripe = function loadStripe2() { | ||
| for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
| args[_key] = arguments[_key]; | ||
| } | ||
| loadCalled = true; | ||
| var startTime = Date.now(); | ||
| return stripePromise$1.then(function(maybeStripe) { | ||
| return initStripe(maybeStripe, args, startTime); | ||
| }); | ||
| }; | ||
| const FakeStripeCardInput = tasty({ | ||
| styles: { | ||
| color: "#danger-text", | ||
| ".StripeElement": { | ||
| color: "#dark.85", | ||
| fill: "#white", | ||
| border: true, | ||
| outline: "#purple-03.0", | ||
| transition: "theme", | ||
| radius: true, | ||
| padding: "(1.25x + 1bw) 1x 1.25x (1.5x + 1bw)" | ||
| }, | ||
| ".StripeElement--focus": { | ||
| outline: "#purple-03" | ||
| }, | ||
| ".StripeElement--invalid": { | ||
| border: "#danger-text.50", | ||
| outline: "#danger.50" | ||
| } | ||
| } | ||
| }); | ||
| function PaymentMethodForm(props) { | ||
| const { submitButtonLabel = "Save card", onSubmit, buttonSize = "block" } = props; | ||
| const [form] = Form.useForm(); | ||
| const [error, setError] = useState(); | ||
| const [formError, setFormError] = useState(); | ||
| const stripe = useStripe(); | ||
| const elements = useElements(); | ||
| const handleSubmit = async (billingDetails) => { | ||
| setError(null); | ||
| setFormError(null); | ||
| try { | ||
| const cardElement = elements.getElement(CardElement); | ||
| if (!cardElement) { | ||
| throw new Error("Unexpected error"); | ||
| } | ||
| const res = await stripe.createPaymentMethod({ | ||
| type: "card", | ||
| card: cardElement, | ||
| billing_details: billingDetails | ||
| }); | ||
| if (res.error) { | ||
| setFormError(res.error); | ||
| } else { | ||
| await (onSubmit == null ? void 0 : onSubmit(res.paymentMethod)); | ||
| cardElement.clear(); | ||
| form.resetFields(); | ||
| } | ||
| } catch (e) { | ||
| if (e.message.includes("requires-action") || e.message.includes("payment requires additional user action")) { | ||
| throw new Error( | ||
| "Your payment could not be processed because it requires additional verification. To complete this transaction, your bank requires additional authentication measures. Please contact your bank to authorize the transaction and complete your purchase or update the payment method and try again. If you have any questions or concerns, please contact support@cube.dev." | ||
| ); | ||
| } else { | ||
| throw new Error(e.message.replace("GraphQL error:", "").trim()); | ||
| } | ||
| } | ||
| }; | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, { spinning: !stripe || !elements, children: /* @__PURE__ */ jsxRuntimeExports.jsxs( | ||
| Form, | ||
| { | ||
| form, | ||
| requiredMark: false, | ||
| onSubmit: handleSubmit, | ||
| onSubmitFailed: (err) => setFormError(err), | ||
| children: [ | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| Form.Item, | ||
| { | ||
| label: "Name on Card", | ||
| name: "name", | ||
| "data-qa": "new-card-name", | ||
| rules: [{ required: true, message: "Please enter your name" }], | ||
| children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { autoFocus: true, size: "large" }) | ||
| } | ||
| ), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Item, { label: "Card", "data-qa": "new-card-body", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(FakeStripeCardInput, { children: [ | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| CardElement, | ||
| { | ||
| options: { classes: { focus: "StripeElement--focus" } }, | ||
| onChange: (e) => setError(e.error && e.error.message) | ||
| } | ||
| ), | ||
| error && (error.message ?? error) | ||
| ] }) }), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx(SubmitButton, { block: buttonSize === "block", "data-qa": "save-card", size: "large", children: submitButtonLabel }), | ||
| formError && /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Item, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { theme: "danger", children: formError.message ?? formError }) }) | ||
| ] | ||
| } | ||
| ) }); | ||
| } | ||
| function PaymentMethodFormContainer(props) { | ||
| const { stripeKey } = useConfig(); | ||
| const [stripePromise2] = useState(() => loadStripe(stripeKey)); | ||
| return ( | ||
| // @ts-expect-error Stripe Elements API changed but we still use children pattern | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx(Elements, { stripe: stripePromise2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PaymentMethodForm, { ...props }) }) | ||
| ); | ||
| } | ||
| export { | ||
| PaymentMethodFormContainer | ||
| }; |
| import { m as monaco_editor_core_star } from "./index-Wg7C9suO.mjs"; | ||
| /*!----------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1) | ||
| * Released under the MIT license | ||
| * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt | ||
| *-----------------------------------------------------------------------------*/ | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget); | ||
| var monaco_editor_core_exports = {}; | ||
| __reExport(monaco_editor_core_exports, monaco_editor_core_star); | ||
| var conf = { | ||
| comments: { | ||
| lineComment: "#", | ||
| blockComment: ["'''", "'''"] | ||
| }, | ||
| brackets: [ | ||
| ["{", "}"], | ||
| ["[", "]"], | ||
| ["(", ")"] | ||
| ], | ||
| autoClosingPairs: [ | ||
| { open: "{", close: "}" }, | ||
| { open: "[", close: "]" }, | ||
| { open: "(", close: ")" }, | ||
| { open: '"', close: '"', notIn: ["string"] }, | ||
| { open: "'", close: "'", notIn: ["string", "comment"] } | ||
| ], | ||
| surroundingPairs: [ | ||
| { open: "{", close: "}" }, | ||
| { open: "[", close: "]" }, | ||
| { open: "(", close: ")" }, | ||
| { open: '"', close: '"' }, | ||
| { open: "'", close: "'" } | ||
| ], | ||
| onEnterRules: [ | ||
| { | ||
| beforeText: new RegExp( | ||
| "^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async|match|case).*?:\\s*$" | ||
| ), | ||
| action: { indentAction: monaco_editor_core_exports.languages.IndentAction.Indent } | ||
| } | ||
| ], | ||
| folding: { | ||
| offSide: true, | ||
| markers: { | ||
| start: new RegExp("^\\s*#region\\b"), | ||
| end: new RegExp("^\\s*#endregion\\b") | ||
| } | ||
| } | ||
| }; | ||
| var language = { | ||
| defaultToken: "", | ||
| tokenPostfix: ".python", | ||
| keywords: [ | ||
| // This section is the result of running | ||
| // `import keyword; for k in sorted(keyword.kwlist + keyword.softkwlist): print(" '" + k + "',")` | ||
| // in a Python REPL, | ||
| // though note that the output from Python 3 is not a strict superset of the | ||
| // output from Python 2. | ||
| "False", | ||
| // promoted to keyword.kwlist in Python 3 | ||
| "None", | ||
| // promoted to keyword.kwlist in Python 3 | ||
| "True", | ||
| // promoted to keyword.kwlist in Python 3 | ||
| "_", | ||
| // new in Python 3.10 | ||
| "and", | ||
| "as", | ||
| "assert", | ||
| "async", | ||
| // new in Python 3 | ||
| "await", | ||
| // new in Python 3 | ||
| "break", | ||
| "case", | ||
| // new in Python 3.10 | ||
| "class", | ||
| "continue", | ||
| "def", | ||
| "del", | ||
| "elif", | ||
| "else", | ||
| "except", | ||
| "exec", | ||
| // Python 2, but not 3. | ||
| "finally", | ||
| "for", | ||
| "from", | ||
| "global", | ||
| "if", | ||
| "import", | ||
| "in", | ||
| "is", | ||
| "lambda", | ||
| "match", | ||
| // new in Python 3.10 | ||
| "nonlocal", | ||
| // new in Python 3 | ||
| "not", | ||
| "or", | ||
| "pass", | ||
| "print", | ||
| // Python 2, but not 3. | ||
| "raise", | ||
| "return", | ||
| "try", | ||
| "type", | ||
| // new in Python 3.12 | ||
| "while", | ||
| "with", | ||
| "yield", | ||
| "int", | ||
| "float", | ||
| "long", | ||
| "complex", | ||
| "hex", | ||
| "abs", | ||
| "all", | ||
| "any", | ||
| "apply", | ||
| "basestring", | ||
| "bin", | ||
| "bool", | ||
| "buffer", | ||
| "bytearray", | ||
| "callable", | ||
| "chr", | ||
| "classmethod", | ||
| "cmp", | ||
| "coerce", | ||
| "compile", | ||
| "complex", | ||
| "delattr", | ||
| "dict", | ||
| "dir", | ||
| "divmod", | ||
| "enumerate", | ||
| "eval", | ||
| "execfile", | ||
| "file", | ||
| "filter", | ||
| "format", | ||
| "frozenset", | ||
| "getattr", | ||
| "globals", | ||
| "hasattr", | ||
| "hash", | ||
| "help", | ||
| "id", | ||
| "input", | ||
| "intern", | ||
| "isinstance", | ||
| "issubclass", | ||
| "iter", | ||
| "len", | ||
| "locals", | ||
| "list", | ||
| "map", | ||
| "max", | ||
| "memoryview", | ||
| "min", | ||
| "next", | ||
| "object", | ||
| "oct", | ||
| "open", | ||
| "ord", | ||
| "pow", | ||
| "print", | ||
| "property", | ||
| "reversed", | ||
| "range", | ||
| "raw_input", | ||
| "reduce", | ||
| "reload", | ||
| "repr", | ||
| "reversed", | ||
| "round", | ||
| "self", | ||
| "set", | ||
| "setattr", | ||
| "slice", | ||
| "sorted", | ||
| "staticmethod", | ||
| "str", | ||
| "sum", | ||
| "super", | ||
| "tuple", | ||
| "type", | ||
| "unichr", | ||
| "unicode", | ||
| "vars", | ||
| "xrange", | ||
| "zip", | ||
| "__dict__", | ||
| "__methods__", | ||
| "__members__", | ||
| "__class__", | ||
| "__bases__", | ||
| "__name__", | ||
| "__mro__", | ||
| "__subclasses__", | ||
| "__init__", | ||
| "__import__" | ||
| ], | ||
| brackets: [ | ||
| { open: "{", close: "}", token: "delimiter.curly" }, | ||
| { open: "[", close: "]", token: "delimiter.bracket" }, | ||
| { open: "(", close: ")", token: "delimiter.parenthesis" } | ||
| ], | ||
| tokenizer: { | ||
| root: [ | ||
| { include: "@whitespace" }, | ||
| { include: "@numbers" }, | ||
| { include: "@strings" }, | ||
| [/[,:;]/, "delimiter"], | ||
| [/[{}\[\]()]/, "@brackets"], | ||
| [/@[a-zA-Z_]\w*/, "tag"], | ||
| [ | ||
| /[a-zA-Z_]\w*/, | ||
| { | ||
| cases: { | ||
| "@keywords": "keyword", | ||
| "@default": "identifier" | ||
| } | ||
| } | ||
| ] | ||
| ], | ||
| // Deal with white space, including single and multi-line comments | ||
| whitespace: [ | ||
| [/\s+/, "white"], | ||
| [/(^#.*$)/, "comment"], | ||
| [/'''/, "string", "@endDocString"], | ||
| [/"""/, "string", "@endDblDocString"] | ||
| ], | ||
| endDocString: [ | ||
| [/[^']+/, "string"], | ||
| [/\\'/, "string"], | ||
| [/'''/, "string", "@popall"], | ||
| [/'/, "string"] | ||
| ], | ||
| endDblDocString: [ | ||
| [/[^"]+/, "string"], | ||
| [/\\"/, "string"], | ||
| [/"""/, "string", "@popall"], | ||
| [/"/, "string"] | ||
| ], | ||
| // Recognize hex, negatives, decimals, imaginaries, longs, and scientific notation | ||
| numbers: [ | ||
| [/-?0x([abcdef]|[ABCDEF]|\d)+[lL]?/, "number.hex"], | ||
| [/-?(\d*\.)?\d+([eE][+\-]?\d+)?[jJ]?[lL]?/, "number"] | ||
| ], | ||
| // Recognize strings, including those broken across lines with \ (but not without) | ||
| strings: [ | ||
| [/'$/, "string.escape", "@popall"], | ||
| [/f'{1,3}/, "string.escape", "@fStringBody"], | ||
| [/'/, "string.escape", "@stringBody"], | ||
| [/"$/, "string.escape", "@popall"], | ||
| [/f"{1,3}/, "string.escape", "@fDblStringBody"], | ||
| [/"/, "string.escape", "@dblStringBody"] | ||
| ], | ||
| fStringBody: [ | ||
| [/[^\\'\{\}]+$/, "string", "@popall"], | ||
| [/[^\\'\{\}]+/, "string"], | ||
| [/\{[^\}':!=]+/, "identifier", "@fStringDetail"], | ||
| [/\\./, "string"], | ||
| [/'/, "string.escape", "@popall"], | ||
| [/\\$/, "string"] | ||
| ], | ||
| stringBody: [ | ||
| [/[^\\']+$/, "string", "@popall"], | ||
| [/[^\\']+/, "string"], | ||
| [/\\./, "string"], | ||
| [/'/, "string.escape", "@popall"], | ||
| [/\\$/, "string"] | ||
| ], | ||
| fDblStringBody: [ | ||
| [/[^\\"\{\}]+$/, "string", "@popall"], | ||
| [/[^\\"\{\}]+/, "string"], | ||
| [/\{[^\}':!=]+/, "identifier", "@fStringDetail"], | ||
| [/\\./, "string"], | ||
| [/"/, "string.escape", "@popall"], | ||
| [/\\$/, "string"] | ||
| ], | ||
| dblStringBody: [ | ||
| [/[^\\"]+$/, "string", "@popall"], | ||
| [/[^\\"]+/, "string"], | ||
| [/\\./, "string"], | ||
| [/"/, "string.escape", "@popall"], | ||
| [/\\$/, "string"] | ||
| ], | ||
| fStringDetail: [ | ||
| [/[:][^}]+/, "string"], | ||
| [/[!][ars]/, "string"], | ||
| // only !a, !r, !s are supported by f-strings: https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals | ||
| [/=/, "string"], | ||
| [/\}/, "identifier", "@pop"] | ||
| ] | ||
| } | ||
| }; | ||
| export { | ||
| conf, | ||
| language | ||
| }; |
| import { u as useDebounceState, c as createReactComponent, a as useLocale, b as useEvent, p as parseToken, j as jsxRuntimeExports, I as IconHistory, t as tryBestJsonParse, L as LiteEditorField } from "./index-Wg7C9suO.mjs"; | ||
| import { ComboBox, Space, SearchIcon, Form, DialogForm, Text, Alert, TextInput, FieldWrapper, Flex, CopyPasteBlock, SubmitButton, Button, TrashIcon } from "@cube-dev/ui-kit"; | ||
| import { useQuery } from "@tanstack/react-query"; | ||
| import { useState, useMemo, useEffect, useRef, useCallback } from "react"; | ||
| import "react-dom"; | ||
| import "@apollo/client"; | ||
| function useDebounceValue(value, delay, maxWait) { | ||
| const [debouncedValue, setDebouncedValue] = useDebounceState(value, delay, maxWait); | ||
| if (value !== debouncedValue) { | ||
| setDebouncedValue(value); | ||
| } | ||
| return debouncedValue; | ||
| } | ||
| /** | ||
| * @license @tabler/icons-react v3.31.0 - MIT | ||
| * | ||
| * This source code is licensed under the MIT license. | ||
| * See the LICENSE file in the root directory of this source tree. | ||
| */ | ||
| var IconApps = createReactComponent("outline", "apps", "IconApps", [["path", { "d": "M4 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z", "key": "svg-0" }], ["path", { "d": "M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z", "key": "svg-1" }], ["path", { "d": "M14 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z", "key": "svg-2" }], ["path", { "d": "M14 7l6 0", "key": "svg-3" }], ["path", { "d": "M17 4l0 6", "key": "svg-4" }]]); | ||
| function clearBraces(code) { | ||
| return code.replace(/(^{|}$)/g, "").trim(); | ||
| } | ||
| function stableStringify(value) { | ||
| return JSON.stringify(value, function(_key, val) { | ||
| if (val && typeof val === "object" && !Array.isArray(val) && !(val instanceof Date)) { | ||
| const sortedKeys = Object.keys(val).sort(); | ||
| const sortedObject = {}; | ||
| for (const key of sortedKeys) { | ||
| sortedObject[key] = val[key]; | ||
| } | ||
| return sortedObject; | ||
| } | ||
| return val; | ||
| }); | ||
| } | ||
| function prettifySecurityContext(securityContext) { | ||
| const scAsString = stableStringify(securityContext); | ||
| return clearBraces(scAsString).replaceAll(/(^|[^:])"(\w+)"/gi, (s1, s2, s3) => `${s2}${s3}`); | ||
| } | ||
| const notBase64 = /[^A-Z0-9+/=]/i; | ||
| const urlSafeBase64 = /^[A-Z0-9_-]*$/i; | ||
| function isBase64(str, options) { | ||
| const { urlSafe = false } = options; | ||
| const len = str.length; | ||
| if (urlSafe) { | ||
| return urlSafeBase64.test(str); | ||
| } | ||
| if (len % 4 !== 0 || notBase64.test(str)) { | ||
| return false; | ||
| } | ||
| const firstPaddingChar = str.indexOf("="); | ||
| return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === "="; | ||
| } | ||
| function isJWT(string) { | ||
| const dotSplit = string.split("."); | ||
| const len = dotSplit.length; | ||
| if (len > 3 || len < 2) { | ||
| return false; | ||
| } | ||
| return dotSplit.reduce((acc, currElem) => acc && isBase64(currElem, { urlSafe: true }), true); | ||
| } | ||
| const searchIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(SearchIcon, {}); | ||
| function SecurityContextCombobox(props) { | ||
| const { items, label, placeholder, onChange, selectedName } = props; | ||
| const [inputValue, setInputValue] = useState(""); | ||
| const { locale } = useLocale(); | ||
| const collator = useMemo( | ||
| () => new Intl.Collator(locale, { usage: "search", sensitivity: "base" }), | ||
| [locale] | ||
| ); | ||
| const filterFn = useEvent((textValue, currentInputValue) => { | ||
| if (!currentInputValue) { | ||
| return true; | ||
| } | ||
| if (contains(textValue, currentInputValue, collator.compare)) { | ||
| return true; | ||
| } | ||
| const maybeToken = isJWT(currentInputValue) ? parseToken(currentInputValue) : null; | ||
| if (maybeToken != null) { | ||
| const { payload } = maybeToken; | ||
| if (contains(textValue, prettifySecurityContext(payload), collator.compare)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| }); | ||
| useEffect(() => { | ||
| setInputValue(selectedName || ""); | ||
| }, [selectedName]); | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| ComboBox, | ||
| { | ||
| allowsCustomValue: true, | ||
| clearOnBlur: true, | ||
| isDisabled: items.length === 0, | ||
| label, | ||
| placeholder, | ||
| icon: searchIcon, | ||
| filter: filterFn, | ||
| inputValue, | ||
| items, | ||
| onFocus: () => { | ||
| setInputValue(""); | ||
| }, | ||
| onBlur: () => { | ||
| setInputValue(selectedName ?? ""); | ||
| }, | ||
| onInputChange: setInputValue, | ||
| onSelectionChange: (key) => { | ||
| if (key) { | ||
| onChange == null ? void 0 : onChange(items.find((item) => item.id === key) ?? null); | ||
| } | ||
| }, | ||
| children: (formattedSecurityContext) => { | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| ComboBox.Item, | ||
| { | ||
| textValue: formattedSecurityContext.name || formattedSecurityContext.value, | ||
| children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { children: [ | ||
| formattedSecurityContext.isCustom ? /* @__PURE__ */ jsxRuntimeExports.jsx(IconHistory, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(IconApps, {}), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: formattedSecurityContext.name || formattedSecurityContext.value }) | ||
| ] }) | ||
| }, | ||
| formattedSecurityContext.id | ||
| ); | ||
| } | ||
| } | ||
| ); | ||
| } | ||
| function contains(string, substring, compare) { | ||
| if (substring.length === 0) { | ||
| return true; | ||
| } | ||
| string = string.normalize("NFC"); | ||
| substring = substring.normalize("NFC"); | ||
| let scan = 0; | ||
| let sliceLength = substring.length; | ||
| for (; scan + sliceLength <= string.length; scan++) { | ||
| const sliced = string.slice(scan, scan + sliceLength); | ||
| if (compare(substring, sliced) === 0) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| const SECURITY_CONTEXT_EDITOR_NAME = "editor"; | ||
| const SECURITY_CONTEXT_NAME_FIELD_NAME = "name"; | ||
| function SecurityContextDialog(props) { | ||
| var _a, _b; | ||
| const { | ||
| docsLink, | ||
| securityContexts, | ||
| generateToken, | ||
| currentSecurityContext, | ||
| formName, | ||
| onSubmit, | ||
| hasPredefinedContext, | ||
| isSecurityContextApplicableOnThePage, | ||
| onDismiss | ||
| } = props; | ||
| const editorRef = useRef(null); | ||
| const [form] = Form.useForm(); | ||
| const defaultSelectedSecurityContext = useMemo(() => { | ||
| if (currentSecurityContext == null) { | ||
| return "{}"; | ||
| } | ||
| return JSON.stringify(currentSecurityContext.raw, null, 2); | ||
| }, [currentSecurityContext]); | ||
| const nameField = form.getFieldInstance(SECURITY_CONTEXT_NAME_FIELD_NAME) ?? null; | ||
| const nameFieldValue = ((_a = nameField == null ? void 0 : nameField.value) == null ? void 0 : _a.trim()) ?? ""; | ||
| const editorField = form.getFieldInstance(SECURITY_CONTEXT_EDITOR_NAME) ?? null; | ||
| const editorFieldRawValue = ((_b = editorField == null ? void 0 : editorField.value) == null ? void 0 : _b.trim()) ?? ""; | ||
| const parsedEditorFieldValue = editorFieldRawValue ? tryBestJsonParse(editorFieldRawValue, null) : null; | ||
| const editorFieldHasError = Boolean(editorFieldRawValue) && !parsedEditorFieldValue; | ||
| const selectedSecurityContext = editorFieldHasError ? void 0 : securityContexts.find( | ||
| (sc) => sc.name && sc.name === nameFieldValue || stableStringify(sc.raw) === stableStringify(parsedEditorFieldValue) && (!sc.name || !nameFieldValue || sc.name && sc.name === nameFieldValue) | ||
| ); | ||
| const selectedSecurityContextName = (selectedSecurityContext == null ? void 0 : selectedSecurityContext.name) || (selectedSecurityContext == null ? void 0 : selectedSecurityContext.value) || ""; | ||
| const debouncedEditorFieldValue = useDebounceValue(parsedEditorFieldValue, 500); | ||
| const { | ||
| data: token = null, | ||
| status, | ||
| error | ||
| } = useQuery({ | ||
| queryKey: [debouncedEditorFieldValue], | ||
| queryFn: async ({ queryKey }) => { | ||
| const value = queryKey[0]; | ||
| if (editorFieldHasError) { | ||
| return Promise.reject("Can't generate token from invalid JSON"); | ||
| } | ||
| return value === null ? null : generateToken(value); | ||
| } | ||
| }); | ||
| const onTokenPaste = useCallback(async (value) => { | ||
| var _a2; | ||
| if (isJWT(value)) { | ||
| const token2 = parseToken(value); | ||
| if (token2) { | ||
| const payload = token2.payload; | ||
| if (payload == null ? void 0 : payload.iss) { | ||
| delete payload.iss; | ||
| } | ||
| form.setFieldValue(SECURITY_CONTEXT_EDITOR_NAME, JSON.stringify(payload, null, 2)); | ||
| const stringifiedToken = JSON.stringify(payload); | ||
| const securityContext = securityContexts.find((sc) => sc.value.includes(stringifiedToken)); | ||
| form.setFieldValue( | ||
| SECURITY_CONTEXT_NAME_FIELD_NAME, | ||
| (securityContext == null ? void 0 : securityContext.name) === (securityContext == null ? void 0 : securityContext.value) ? "" : (securityContext == null ? void 0 : securityContext.name) || "" | ||
| ); | ||
| (_a2 = editorRef.current) == null ? void 0 : _a2.focus(); | ||
| return; | ||
| } | ||
| } | ||
| throw "Invalid token"; | ||
| }, []); | ||
| const onEditorBlur = useCallback(() => { | ||
| const value = form.getFieldValue(SECURITY_CONTEXT_EDITOR_NAME); | ||
| if (!value || !value.trim()) { | ||
| form.setFieldValue(SECURITY_CONTEXT_EDITOR_NAME, "{}"); | ||
| return; | ||
| } | ||
| if (!value.trim().startsWith("{")) { | ||
| return; | ||
| } | ||
| try { | ||
| const data = tryBestJsonParse(value); | ||
| form.setFieldValue(SECURITY_CONTEXT_EDITOR_NAME, JSON.stringify(data, null, 2)); | ||
| } catch (e) { | ||
| } | ||
| }, [form]); | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsxs( | ||
| DialogForm, | ||
| { | ||
| noActions: true, | ||
| title: "Security Context", | ||
| size: "L", | ||
| name: formName, | ||
| form, | ||
| defaultValues: { | ||
| [SECURITY_CONTEXT_EDITOR_NAME]: defaultSelectedSecurityContext, | ||
| [SECURITY_CONTEXT_NAME_FIELD_NAME]: currentSecurityContext == null ? void 0 : currentSecurityContext.name | ||
| }, | ||
| onSubmit: ({ name }) => { | ||
| const isEmptyContext = parsedEditorFieldValue === null || typeof parsedEditorFieldValue === "object" && Object.keys(parsedEditorFieldValue).length === 0; | ||
| onSubmit(isEmptyContext ? null : parsedEditorFieldValue, name); | ||
| }, | ||
| children: [ | ||
| /* @__PURE__ */ jsxRuntimeExports.jsxs( | ||
| Space, | ||
| { | ||
| scrollbar: "styled", | ||
| gap: "2x", | ||
| flow: "column", | ||
| overflow: "auto", | ||
| height: "max (100vh - 220px)", | ||
| margin: "-2x", | ||
| padding: "2x", | ||
| border: "bottom", | ||
| children: [ | ||
| /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { as: "p", preset: "t3", color: "#dark-03", children: [ | ||
| "Learn more about Security Context in", | ||
| " ", | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx("a", { target: "_blank", href: docsLink, rel: "noreferrer", children: "docs" }) | ||
| ] }), | ||
| !isSecurityContextApplicableOnThePage && /* @__PURE__ */ jsxRuntimeExports.jsxs(Alert, { children: [ | ||
| "Changing ", | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: "security context" }), | ||
| " has no effect on this page." | ||
| ] }), | ||
| hasPredefinedContext ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [ | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| SecurityContextCombobox, | ||
| { | ||
| label: "Lookup", | ||
| placeholder: securityContexts.length ? "Search by part or insert the token" : "No items to search", | ||
| selectedName: selectedSecurityContextName, | ||
| items: securityContexts, | ||
| onChange: (value) => { | ||
| if (value === null) { | ||
| return; | ||
| } | ||
| form.setFieldValue( | ||
| SECURITY_CONTEXT_EDITOR_NAME, | ||
| JSON.stringify(value == null ? void 0 : value.raw, null, 2) | ||
| ); | ||
| form.setFieldValue( | ||
| SECURITY_CONTEXT_NAME_FIELD_NAME, | ||
| (value == null ? void 0 : value.name) === (value == null ? void 0 : value.value) ? "" : (value == null ? void 0 : value.name) || "" | ||
| ); | ||
| requestAnimationFrame(() => { | ||
| requestAnimationFrame(() => { | ||
| var _a2; | ||
| (_a2 = editorRef.current) == null ? void 0 : _a2.focus(); | ||
| }); | ||
| }); | ||
| } | ||
| } | ||
| ), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| TextInput, | ||
| { | ||
| name: SECURITY_CONTEXT_NAME_FIELD_NAME, | ||
| label: "Name", | ||
| placeholder: "Optionally name your Security Context to find it later easily" | ||
| } | ||
| ) | ||
| ] }) : void 0, | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| LiteEditorField, | ||
| { | ||
| ref: editorRef, | ||
| height: "140px", | ||
| name: SECURITY_CONTEXT_EDITOR_NAME, | ||
| label: "JSON", | ||
| language: "json", | ||
| qa: "SecurityContextEditor", | ||
| tooltip: "Empty Security Context is also valid", | ||
| rules: [ | ||
| { | ||
| validator(_rule, val) { | ||
| if (val == null ? void 0 : val.trim()) { | ||
| try { | ||
| JSON.parse(val); | ||
| } catch { | ||
| return Promise.reject("Invalid JSON"); | ||
| } | ||
| } | ||
| return Promise.resolve(); | ||
| } | ||
| } | ||
| ], | ||
| onBlur: onEditorBlur | ||
| } | ||
| ), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| FieldWrapper, | ||
| { | ||
| label: "Token", | ||
| extra: token ? /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { color: "#dark-02", children: "Click on field to paste a token" }) : "", | ||
| Component: /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { styles: { height: "5x min" }, alignItems: "center", children: (() => { | ||
| switch (status) { | ||
| case "pending": | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { preset: "t3", children: "Creating..." }); | ||
| case "error": | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { preset: "t3", children: [ | ||
| "Error: ", | ||
| String(error).replace("Error: ", "") | ||
| ] }); | ||
| case "success": | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| CopyPasteBlock, | ||
| { | ||
| value: token || void 0, | ||
| placeholder: "Paste a token here", | ||
| width: "100%", | ||
| onPaste: onTokenPaste | ||
| } | ||
| ); | ||
| default: | ||
| return void 0; | ||
| } | ||
| })() }) | ||
| } | ||
| ) | ||
| ] | ||
| } | ||
| ), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx(Form.SubmitError, {}), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { children: [ | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx(SubmitButton, { children: "Apply" }), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onPress: onDismiss, children: "Cancel" }), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx( | ||
| Button, | ||
| { | ||
| type: "secondary", | ||
| icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TrashIcon, {}), | ||
| margin: "auto left", | ||
| onPress: () => { | ||
| onSubmit(null); | ||
| onDismiss(); | ||
| }, | ||
| children: "Clear" | ||
| } | ||
| ) | ||
| ] }) | ||
| ] | ||
| } | ||
| ); | ||
| } | ||
| export { | ||
| SecurityContextDialog | ||
| }; |
| const vitesseDark = Object.freeze(JSON.parse('{"colors":{"activityBar.activeBorder":"#4d9375","activityBar.background":"#121212","activityBar.border":"#191919","activityBar.foreground":"#dbd7caee","activityBar.inactiveForeground":"#dedcd550","activityBarBadge.background":"#bfbaaa","activityBarBadge.foreground":"#121212","badge.background":"#dedcd590","badge.foreground":"#121212","breadcrumb.activeSelectionForeground":"#eeeeee18","breadcrumb.background":"#181818","breadcrumb.focusForeground":"#dbd7caee","breadcrumb.foreground":"#959da5","breadcrumbPicker.background":"#121212","button.background":"#4d9375","button.foreground":"#121212","button.hoverBackground":"#4d9375","checkbox.background":"#181818","checkbox.border":"#2f363d","debugToolBar.background":"#121212","descriptionForeground":"#dedcd590","diffEditor.insertedTextBackground":"#4d937550","diffEditor.removedTextBackground":"#ab595950","dropdown.background":"#121212","dropdown.border":"#191919","dropdown.foreground":"#dbd7caee","dropdown.listBackground":"#181818","editor.background":"#121212","editor.findMatchBackground":"#e6cc7722","editor.findMatchHighlightBackground":"#e6cc7744","editor.focusedStackFrameHighlightBackground":"#b808","editor.foldBackground":"#eeeeee10","editor.foreground":"#dbd7caee","editor.inactiveSelectionBackground":"#eeeeee10","editor.lineHighlightBackground":"#181818","editor.selectionBackground":"#eeeeee18","editor.selectionHighlightBackground":"#eeeeee10","editor.stackFrameHighlightBackground":"#a707","editor.wordHighlightBackground":"#1c6b4805","editor.wordHighlightStrongBackground":"#1c6b4810","editorBracketHighlight.foreground1":"#5eaab5","editorBracketHighlight.foreground2":"#4d9375","editorBracketHighlight.foreground3":"#d4976c","editorBracketHighlight.foreground4":"#d9739f","editorBracketHighlight.foreground5":"#e6cc77","editorBracketHighlight.foreground6":"#6394bf","editorBracketMatch.background":"#4d937520","editorError.foreground":"#cb7676","editorGroup.border":"#191919","editorGroupHeader.tabsBackground":"#121212","editorGroupHeader.tabsBorder":"#191919","editorGutter.addedBackground":"#4d9375","editorGutter.commentRangeForeground":"#dedcd550","editorGutter.deletedBackground":"#cb7676","editorGutter.foldingControlForeground":"#dedcd590","editorGutter.modifiedBackground":"#6394bf","editorHint.foreground":"#4d9375","editorIndentGuide.activeBackground":"#ffffff30","editorIndentGuide.background":"#ffffff15","editorInfo.foreground":"#6394bf","editorInlayHint.background":"#181818","editorInlayHint.foreground":"#666666","editorLineNumber.activeForeground":"#bfbaaa","editorLineNumber.foreground":"#dedcd550","editorOverviewRuler.border":"#111","editorStickyScroll.background":"#181818","editorStickyScrollHover.background":"#181818","editorWarning.foreground":"#d4976c","editorWhitespace.foreground":"#ffffff15","editorWidget.background":"#121212","errorForeground":"#cb7676","focusBorder":"#00000000","foreground":"#dbd7caee","gitDecoration.addedResourceForeground":"#4d9375","gitDecoration.conflictingResourceForeground":"#d4976c","gitDecoration.deletedResourceForeground":"#cb7676","gitDecoration.ignoredResourceForeground":"#dedcd550","gitDecoration.modifiedResourceForeground":"#6394bf","gitDecoration.submoduleResourceForeground":"#dedcd590","gitDecoration.untrackedResourceForeground":"#5eaab5","input.background":"#181818","input.border":"#191919","input.foreground":"#dbd7caee","input.placeholderForeground":"#dedcd590","inputOption.activeBackground":"#dedcd550","list.activeSelectionBackground":"#181818","list.activeSelectionForeground":"#dbd7caee","list.focusBackground":"#181818","list.highlightForeground":"#4d9375","list.hoverBackground":"#181818","list.hoverForeground":"#dbd7caee","list.inactiveFocusBackground":"#121212","list.inactiveSelectionBackground":"#181818","list.inactiveSelectionForeground":"#dbd7caee","menu.separatorBackground":"#191919","notificationCenterHeader.background":"#121212","notificationCenterHeader.foreground":"#959da5","notifications.background":"#121212","notifications.border":"#191919","notifications.foreground":"#dbd7caee","notificationsErrorIcon.foreground":"#cb7676","notificationsInfoIcon.foreground":"#6394bf","notificationsWarningIcon.foreground":"#d4976c","panel.background":"#121212","panel.border":"#191919","panelInput.border":"#2f363d","panelTitle.activeBorder":"#4d9375","panelTitle.activeForeground":"#dbd7caee","panelTitle.inactiveForeground":"#959da5","peekViewEditor.background":"#121212","peekViewEditor.matchHighlightBackground":"#ffd33d33","peekViewResult.background":"#121212","peekViewResult.matchHighlightBackground":"#ffd33d33","pickerGroup.border":"#191919","pickerGroup.foreground":"#dbd7caee","problemsErrorIcon.foreground":"#cb7676","problemsInfoIcon.foreground":"#6394bf","problemsWarningIcon.foreground":"#d4976c","progressBar.background":"#4d9375","quickInput.background":"#121212","quickInput.foreground":"#dbd7caee","quickInputList.focusBackground":"#181818","scrollbar.shadow":"#0000","scrollbarSlider.activeBackground":"#dedcd550","scrollbarSlider.background":"#dedcd510","scrollbarSlider.hoverBackground":"#dedcd550","settings.headerForeground":"#dbd7caee","settings.modifiedItemIndicator":"#4d9375","sideBar.background":"#121212","sideBar.border":"#191919","sideBar.foreground":"#bfbaaa","sideBarSectionHeader.background":"#121212","sideBarSectionHeader.border":"#191919","sideBarSectionHeader.foreground":"#dbd7caee","sideBarTitle.foreground":"#dbd7caee","statusBar.background":"#121212","statusBar.border":"#191919","statusBar.debuggingBackground":"#181818","statusBar.debuggingForeground":"#bfbaaa","statusBar.foreground":"#bfbaaa","statusBar.noFolderBackground":"#121212","statusBarItem.prominentBackground":"#181818","tab.activeBackground":"#121212","tab.activeBorder":"#191919","tab.activeBorderTop":"#dedcd590","tab.activeForeground":"#dbd7caee","tab.border":"#191919","tab.hoverBackground":"#181818","tab.inactiveBackground":"#121212","tab.inactiveForeground":"#959da5","tab.unfocusedActiveBorder":"#191919","tab.unfocusedActiveBorderTop":"#191919","tab.unfocusedHoverBackground":"#121212","terminal.ansiBlack":"#393a34","terminal.ansiBlue":"#6394bf","terminal.ansiBrightBlack":"#777777","terminal.ansiBrightBlue":"#6394bf","terminal.ansiBrightCyan":"#5eaab5","terminal.ansiBrightGreen":"#4d9375","terminal.ansiBrightMagenta":"#d9739f","terminal.ansiBrightRed":"#cb7676","terminal.ansiBrightWhite":"#ffffff","terminal.ansiBrightYellow":"#e6cc77","terminal.ansiCyan":"#5eaab5","terminal.ansiGreen":"#4d9375","terminal.ansiMagenta":"#d9739f","terminal.ansiRed":"#cb7676","terminal.ansiWhite":"#dbd7ca","terminal.ansiYellow":"#e6cc77","terminal.foreground":"#dbd7caee","terminal.selectionBackground":"#eeeeee18","textBlockQuote.background":"#121212","textBlockQuote.border":"#191919","textCodeBlock.background":"#121212","textLink.activeForeground":"#4d9375","textLink.foreground":"#4d9375","textPreformat.foreground":"#d1d5da","textSeparator.foreground":"#586069","titleBar.activeBackground":"#121212","titleBar.activeForeground":"#bfbaaa","titleBar.border":"#181818","titleBar.inactiveBackground":"#121212","titleBar.inactiveForeground":"#959da5","tree.indentGuidesStroke":"#2f363d","welcomePage.buttonBackground":"#2f363d","welcomePage.buttonHoverBackground":"#444d56"},"displayName":"Vitesse Dark","name":"vitesse-dark","semanticHighlighting":true,"semanticTokenColors":{"class":"#6872ab","interface":"#5d99a9","namespace":"#db889a","property":"#b8a965","type":"#5d99a9"},"tokenColors":[{"scope":["comment","punctuation.definition.comment","string.comment"],"settings":{"foreground":"#758575dd"}},{"scope":["delimiter.bracket","delimiter","invalid.illegal.character-not-allowed-here.html","keyword.operator.rest","keyword.operator.spread","keyword.operator.type.annotation","keyword.operator.relational","keyword.operator.assignment","keyword.operator.type","meta.brace","meta.tag.block.any.html","meta.tag.inline.any.html","meta.tag.structure.input.void.html","meta.type.annotation","meta.embedded.block.github-actions-expression","storage.type.function.arrow","meta.objectliteral.ts","punctuation","punctuation.definition.string.begin.html.vue","punctuation.definition.string.end.html.vue"],"settings":{"foreground":"#666666"}},{"scope":["constant","entity.name.constant","variable.language","meta.definition.variable"],"settings":{"foreground":"#c99076"}},{"scope":["entity","entity.name"],"settings":{"foreground":"#80a665"}},{"scope":"variable.parameter.function","settings":{"foreground":"#dbd7caee"}},{"scope":["entity.name.tag","tag.html"],"settings":{"foreground":"#4d9375"}},{"scope":"entity.name.function","settings":{"foreground":"#80a665"}},{"scope":["keyword","storage.type.class.jsdoc","punctuation.definition.template-expression"],"settings":{"foreground":"#4d9375"}},{"scope":["storage","storage.type","support.type.builtin","constant.language.undefined","constant.language.null","constant.language.import-export-all.ts"],"settings":{"foreground":"#cb7676"}},{"scope":["text.html.derivative","storage.modifier.package","storage.modifier.import","storage.type.java"],"settings":{"foreground":"#dbd7caee"}},{"scope":["string","string punctuation.section.embedded source","attribute.value"],"settings":{"foreground":"#c98a7d"}},{"scope":["punctuation.definition.string"],"settings":{"foreground":"#c98a7d77"}},{"scope":["punctuation.support.type.property-name"],"settings":{"foreground":"#b8a96577"}},{"scope":"support","settings":{"foreground":"#b8a965"}},{"scope":["property","meta.property-name","meta.object-literal.key","entity.name.tag.yaml","attribute.name"],"settings":{"foreground":"#b8a965"}},{"scope":["entity.other.attribute-name","invalid.deprecated.entity.other.attribute-name.html"],"settings":{"foreground":"#bd976a"}},{"scope":["variable","identifier"],"settings":{"foreground":"#bd976a"}},{"scope":["support.type.primitive","entity.name.type"],"settings":{"foreground":"#5DA994"}},{"scope":"namespace","settings":{"foreground":"#db889a"}},{"scope":["keyword.operator","keyword.operator.assignment.compound","meta.var.expr.ts"],"settings":{"foreground":"#cb7676"}},{"scope":"invalid.broken","settings":{"fontStyle":"italic","foreground":"#fdaeb7"}},{"scope":"invalid.deprecated","settings":{"fontStyle":"italic","foreground":"#fdaeb7"}},{"scope":"invalid.illegal","settings":{"fontStyle":"italic","foreground":"#fdaeb7"}},{"scope":"invalid.unimplemented","settings":{"fontStyle":"italic","foreground":"#fdaeb7"}},{"scope":"carriage-return","settings":{"background":"#f97583","content":"^M","fontStyle":"italic underline","foreground":"#24292e"}},{"scope":"message.error","settings":{"foreground":"#fdaeb7"}},{"scope":"string variable","settings":{"foreground":"#c98a7d"}},{"scope":["source.regexp","string.regexp"],"settings":{"foreground":"#c4704f"}},{"scope":["string.regexp.character-class","string.regexp constant.character.escape","string.regexp source.ruby.embedded","string.regexp string.regexp.arbitrary-repitition"],"settings":{"foreground":"#c98a7d"}},{"scope":"string.regexp constant.character.escape","settings":{"foreground":"#e6cc77"}},{"scope":["support.constant"],"settings":{"foreground":"#c99076"}},{"scope":["keyword.operator.quantifier.regexp","constant.numeric","number"],"settings":{"foreground":"#4C9A91"}},{"scope":["keyword.other.unit"],"settings":{"foreground":"#cb7676"}},{"scope":["constant.language.boolean","constant.language"],"settings":{"foreground":"#4d9375"}},{"scope":"meta.module-reference","settings":{"foreground":"#4d9375"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#d4976c"}},{"scope":["markup.heading","markup.heading entity.name"],"settings":{"fontStyle":"bold","foreground":"#4d9375"}},{"scope":"markup.quote","settings":{"foreground":"#5d99a9"}},{"scope":"markup.italic","settings":{"fontStyle":"italic","foreground":"#dbd7caee"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#dbd7caee"}},{"scope":"markup.raw","settings":{"foreground":"#4d9375"}},{"scope":["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],"settings":{"background":"#86181d","foreground":"#fdaeb7"}},{"scope":["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],"settings":{"background":"#144620","foreground":"#85e89d"}},{"scope":["markup.changed","punctuation.definition.changed"],"settings":{"background":"#c24e00","foreground":"#ffab70"}},{"scope":["markup.ignored","markup.untracked"],"settings":{"background":"#79b8ff","foreground":"#2f363d"}},{"scope":"meta.diff.range","settings":{"fontStyle":"bold","foreground":"#b392f0"}},{"scope":"meta.diff.header","settings":{"foreground":"#79b8ff"}},{"scope":"meta.separator","settings":{"fontStyle":"bold","foreground":"#79b8ff"}},{"scope":"meta.output","settings":{"foreground":"#79b8ff"}},{"scope":["brackethighlighter.tag","brackethighlighter.curly","brackethighlighter.round","brackethighlighter.square","brackethighlighter.angle","brackethighlighter.quote"],"settings":{"foreground":"#d1d5da"}},{"scope":"brackethighlighter.unmatched","settings":{"foreground":"#fdaeb7"}},{"scope":["constant.other.reference.link","string.other.link","punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown"],"settings":{"foreground":"#c98a7d"}},{"scope":["markup.underline.link.markdown","markup.underline.link.image.markdown"],"settings":{"fontStyle":"underline","foreground":"#dedcd590"}},{"scope":["type.identifier","constant.other.character-class.regexp"],"settings":{"foreground":"#6872ab"}},{"scope":["entity.other.attribute-name.html.vue"],"settings":{"foreground":"#80a665"}},{"scope":["invalid.illegal.unrecognized-tag.html"],"settings":{"fontStyle":"normal"}}],"type":"dark"}')); | ||
| export { | ||
| vitesseDark as default | ||
| }; |
| const vitesseLight = Object.freeze(JSON.parse('{"colors":{"activityBar.activeBorder":"#1c6b48","activityBar.background":"#ffffff","activityBar.border":"#f0f0f0","activityBar.foreground":"#393a34","activityBar.inactiveForeground":"#393a3450","activityBarBadge.background":"#4e4f47","activityBarBadge.foreground":"#ffffff","badge.background":"#393a3490","badge.foreground":"#ffffff","breadcrumb.activeSelectionForeground":"#22222218","breadcrumb.background":"#f7f7f7","breadcrumb.focusForeground":"#393a34","breadcrumb.foreground":"#6a737d","breadcrumbPicker.background":"#ffffff","button.background":"#1c6b48","button.foreground":"#ffffff","button.hoverBackground":"#1c6b48","checkbox.background":"#f7f7f7","checkbox.border":"#d1d5da","debugToolBar.background":"#ffffff","descriptionForeground":"#393a3490","diffEditor.insertedTextBackground":"#1c6b4830","diffEditor.removedTextBackground":"#ab595940","dropdown.background":"#ffffff","dropdown.border":"#f0f0f0","dropdown.foreground":"#393a34","dropdown.listBackground":"#f7f7f7","editor.background":"#ffffff","editor.findMatchBackground":"#e6cc7744","editor.findMatchHighlightBackground":"#e6cc7766","editor.focusedStackFrameHighlightBackground":"#fff5b1","editor.foldBackground":"#22222210","editor.foreground":"#393a34","editor.inactiveSelectionBackground":"#22222210","editor.lineHighlightBackground":"#f7f7f7","editor.selectionBackground":"#22222218","editor.selectionHighlightBackground":"#22222210","editor.stackFrameHighlightBackground":"#fffbdd","editor.wordHighlightBackground":"#1c6b4805","editor.wordHighlightStrongBackground":"#1c6b4810","editorBracketHighlight.foreground1":"#2993a3","editorBracketHighlight.foreground2":"#1e754f","editorBracketHighlight.foreground3":"#a65e2b","editorBracketHighlight.foreground4":"#a13865","editorBracketHighlight.foreground5":"#bda437","editorBracketHighlight.foreground6":"#296aa3","editorBracketMatch.background":"#1c6b4820","editorError.foreground":"#ab5959","editorGroup.border":"#f0f0f0","editorGroupHeader.tabsBackground":"#ffffff","editorGroupHeader.tabsBorder":"#f0f0f0","editorGutter.addedBackground":"#1e754f","editorGutter.commentRangeForeground":"#393a3450","editorGutter.deletedBackground":"#ab5959","editorGutter.foldingControlForeground":"#393a3490","editorGutter.modifiedBackground":"#296aa3","editorHint.foreground":"#1e754f","editorIndentGuide.activeBackground":"#00000030","editorIndentGuide.background":"#00000015","editorInfo.foreground":"#296aa3","editorInlayHint.background":"#f7f7f7","editorInlayHint.foreground":"#999999","editorLineNumber.activeForeground":"#4e4f47","editorLineNumber.foreground":"#393a3450","editorOverviewRuler.border":"#fff","editorStickyScroll.background":"#f7f7f7","editorStickyScrollHover.background":"#f7f7f7","editorWarning.foreground":"#a65e2b","editorWhitespace.foreground":"#00000015","editorWidget.background":"#ffffff","errorForeground":"#ab5959","focusBorder":"#00000000","foreground":"#393a34","gitDecoration.addedResourceForeground":"#1e754f","gitDecoration.conflictingResourceForeground":"#a65e2b","gitDecoration.deletedResourceForeground":"#ab5959","gitDecoration.ignoredResourceForeground":"#393a3450","gitDecoration.modifiedResourceForeground":"#296aa3","gitDecoration.submoduleResourceForeground":"#393a3490","gitDecoration.untrackedResourceForeground":"#2993a3","input.background":"#f7f7f7","input.border":"#f0f0f0","input.foreground":"#393a34","input.placeholderForeground":"#393a3490","inputOption.activeBackground":"#393a3450","list.activeSelectionBackground":"#f7f7f7","list.activeSelectionForeground":"#393a34","list.focusBackground":"#f7f7f7","list.highlightForeground":"#1c6b48","list.hoverBackground":"#f7f7f7","list.hoverForeground":"#393a34","list.inactiveFocusBackground":"#ffffff","list.inactiveSelectionBackground":"#f7f7f7","list.inactiveSelectionForeground":"#393a34","menu.separatorBackground":"#f0f0f0","notificationCenterHeader.background":"#ffffff","notificationCenterHeader.foreground":"#6a737d","notifications.background":"#ffffff","notifications.border":"#f0f0f0","notifications.foreground":"#393a34","notificationsErrorIcon.foreground":"#ab5959","notificationsInfoIcon.foreground":"#296aa3","notificationsWarningIcon.foreground":"#a65e2b","panel.background":"#ffffff","panel.border":"#f0f0f0","panelInput.border":"#e1e4e8","panelTitle.activeBorder":"#1c6b48","panelTitle.activeForeground":"#393a34","panelTitle.inactiveForeground":"#6a737d","peekViewEditor.background":"#ffffff","peekViewResult.background":"#ffffff","pickerGroup.border":"#f0f0f0","pickerGroup.foreground":"#393a34","problemsErrorIcon.foreground":"#ab5959","problemsInfoIcon.foreground":"#296aa3","problemsWarningIcon.foreground":"#a65e2b","progressBar.background":"#1c6b48","quickInput.background":"#ffffff","quickInput.foreground":"#393a34","quickInputList.focusBackground":"#f7f7f7","scrollbar.shadow":"#6a737d33","scrollbarSlider.activeBackground":"#393a3450","scrollbarSlider.background":"#393a3410","scrollbarSlider.hoverBackground":"#393a3450","settings.headerForeground":"#393a34","settings.modifiedItemIndicator":"#1c6b48","sideBar.background":"#ffffff","sideBar.border":"#f0f0f0","sideBar.foreground":"#4e4f47","sideBarSectionHeader.background":"#ffffff","sideBarSectionHeader.border":"#f0f0f0","sideBarSectionHeader.foreground":"#393a34","sideBarTitle.foreground":"#393a34","statusBar.background":"#ffffff","statusBar.border":"#f0f0f0","statusBar.debuggingBackground":"#f7f7f7","statusBar.debuggingForeground":"#4e4f47","statusBar.foreground":"#4e4f47","statusBar.noFolderBackground":"#ffffff","statusBarItem.prominentBackground":"#f7f7f7","tab.activeBackground":"#ffffff","tab.activeBorder":"#f0f0f0","tab.activeBorderTop":"#393a3490","tab.activeForeground":"#393a34","tab.border":"#f0f0f0","tab.hoverBackground":"#f7f7f7","tab.inactiveBackground":"#ffffff","tab.inactiveForeground":"#6a737d","tab.unfocusedActiveBorder":"#f0f0f0","tab.unfocusedActiveBorderTop":"#f0f0f0","tab.unfocusedHoverBackground":"#ffffff","terminal.ansiBlack":"#121212","terminal.ansiBlue":"#296aa3","terminal.ansiBrightBlack":"#aaaaaa","terminal.ansiBrightBlue":"#296aa3","terminal.ansiBrightCyan":"#2993a3","terminal.ansiBrightGreen":"#1e754f","terminal.ansiBrightMagenta":"#a13865","terminal.ansiBrightRed":"#ab5959","terminal.ansiBrightWhite":"#dddddd","terminal.ansiBrightYellow":"#bda437","terminal.ansiCyan":"#2993a3","terminal.ansiGreen":"#1e754f","terminal.ansiMagenta":"#a13865","terminal.ansiRed":"#ab5959","terminal.ansiWhite":"#dbd7ca","terminal.ansiYellow":"#bda437","terminal.foreground":"#393a34","terminal.selectionBackground":"#22222218","textBlockQuote.background":"#ffffff","textBlockQuote.border":"#f0f0f0","textCodeBlock.background":"#ffffff","textLink.activeForeground":"#1c6b48","textLink.foreground":"#1c6b48","textPreformat.foreground":"#586069","textSeparator.foreground":"#d1d5da","titleBar.activeBackground":"#ffffff","titleBar.activeForeground":"#4e4f47","titleBar.border":"#f7f7f7","titleBar.inactiveBackground":"#ffffff","titleBar.inactiveForeground":"#6a737d","tree.indentGuidesStroke":"#e1e4e8","welcomePage.buttonBackground":"#f6f8fa","welcomePage.buttonHoverBackground":"#e1e4e8"},"displayName":"Vitesse Light","name":"vitesse-light","semanticHighlighting":true,"semanticTokenColors":{"class":"#5a6aa6","interface":"#2e808f","namespace":"#b05a78","property":"#998418","type":"#2e808f"},"tokenColors":[{"scope":["comment","punctuation.definition.comment","string.comment"],"settings":{"foreground":"#a0ada0"}},{"scope":["delimiter.bracket","delimiter","invalid.illegal.character-not-allowed-here.html","keyword.operator.rest","keyword.operator.spread","keyword.operator.type.annotation","keyword.operator.relational","keyword.operator.assignment","keyword.operator.type","meta.brace","meta.tag.block.any.html","meta.tag.inline.any.html","meta.tag.structure.input.void.html","meta.type.annotation","meta.embedded.block.github-actions-expression","storage.type.function.arrow","meta.objectliteral.ts","punctuation","punctuation.definition.string.begin.html.vue","punctuation.definition.string.end.html.vue"],"settings":{"foreground":"#999999"}},{"scope":["constant","entity.name.constant","variable.language","meta.definition.variable"],"settings":{"foreground":"#a65e2b"}},{"scope":["entity","entity.name"],"settings":{"foreground":"#59873a"}},{"scope":"variable.parameter.function","settings":{"foreground":"#393a34"}},{"scope":["entity.name.tag","tag.html"],"settings":{"foreground":"#1e754f"}},{"scope":"entity.name.function","settings":{"foreground":"#59873a"}},{"scope":["keyword","storage.type.class.jsdoc","punctuation.definition.template-expression"],"settings":{"foreground":"#1e754f"}},{"scope":["storage","storage.type","support.type.builtin","constant.language.undefined","constant.language.null","constant.language.import-export-all.ts"],"settings":{"foreground":"#ab5959"}},{"scope":["text.html.derivative","storage.modifier.package","storage.modifier.import","storage.type.java"],"settings":{"foreground":"#393a34"}},{"scope":["string","string punctuation.section.embedded source","attribute.value"],"settings":{"foreground":"#b56959"}},{"scope":["punctuation.definition.string"],"settings":{"foreground":"#b5695977"}},{"scope":["punctuation.support.type.property-name"],"settings":{"foreground":"#99841877"}},{"scope":"support","settings":{"foreground":"#998418"}},{"scope":["property","meta.property-name","meta.object-literal.key","entity.name.tag.yaml","attribute.name"],"settings":{"foreground":"#998418"}},{"scope":["entity.other.attribute-name","invalid.deprecated.entity.other.attribute-name.html"],"settings":{"foreground":"#b07d48"}},{"scope":["variable","identifier"],"settings":{"foreground":"#b07d48"}},{"scope":["support.type.primitive","entity.name.type"],"settings":{"foreground":"#2e8f82"}},{"scope":"namespace","settings":{"foreground":"#b05a78"}},{"scope":["keyword.operator","keyword.operator.assignment.compound","meta.var.expr.ts"],"settings":{"foreground":"#ab5959"}},{"scope":"invalid.broken","settings":{"fontStyle":"italic","foreground":"#b31d28"}},{"scope":"invalid.deprecated","settings":{"fontStyle":"italic","foreground":"#b31d28"}},{"scope":"invalid.illegal","settings":{"fontStyle":"italic","foreground":"#b31d28"}},{"scope":"invalid.unimplemented","settings":{"fontStyle":"italic","foreground":"#b31d28"}},{"scope":"carriage-return","settings":{"background":"#d73a49","content":"^M","fontStyle":"italic underline","foreground":"#fafbfc"}},{"scope":"message.error","settings":{"foreground":"#b31d28"}},{"scope":"string variable","settings":{"foreground":"#b56959"}},{"scope":["source.regexp","string.regexp"],"settings":{"foreground":"#ab5e3f"}},{"scope":["string.regexp.character-class","string.regexp constant.character.escape","string.regexp source.ruby.embedded","string.regexp string.regexp.arbitrary-repitition"],"settings":{"foreground":"#b56959"}},{"scope":"string.regexp constant.character.escape","settings":{"foreground":"#bda437"}},{"scope":["support.constant"],"settings":{"foreground":"#a65e2b"}},{"scope":["keyword.operator.quantifier.regexp","constant.numeric","number"],"settings":{"foreground":"#2f798a"}},{"scope":["keyword.other.unit"],"settings":{"foreground":"#ab5959"}},{"scope":["constant.language.boolean","constant.language"],"settings":{"foreground":"#1e754f"}},{"scope":"meta.module-reference","settings":{"foreground":"#1c6b48"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#a65e2b"}},{"scope":["markup.heading","markup.heading entity.name"],"settings":{"fontStyle":"bold","foreground":"#1c6b48"}},{"scope":"markup.quote","settings":{"foreground":"#2e808f"}},{"scope":"markup.italic","settings":{"fontStyle":"italic","foreground":"#393a34"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#393a34"}},{"scope":"markup.raw","settings":{"foreground":"#1c6b48"}},{"scope":["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],"settings":{"background":"#ffeef0","foreground":"#b31d28"}},{"scope":["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],"settings":{"background":"#f0fff4","foreground":"#22863a"}},{"scope":["markup.changed","punctuation.definition.changed"],"settings":{"background":"#ffebda","foreground":"#e36209"}},{"scope":["markup.ignored","markup.untracked"],"settings":{"background":"#005cc5","foreground":"#f6f8fa"}},{"scope":"meta.diff.range","settings":{"fontStyle":"bold","foreground":"#6f42c1"}},{"scope":"meta.diff.header","settings":{"foreground":"#005cc5"}},{"scope":"meta.separator","settings":{"fontStyle":"bold","foreground":"#005cc5"}},{"scope":"meta.output","settings":{"foreground":"#005cc5"}},{"scope":["brackethighlighter.tag","brackethighlighter.curly","brackethighlighter.round","brackethighlighter.square","brackethighlighter.angle","brackethighlighter.quote"],"settings":{"foreground":"#586069"}},{"scope":"brackethighlighter.unmatched","settings":{"foreground":"#b31d28"}},{"scope":["constant.other.reference.link","string.other.link","punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown"],"settings":{"foreground":"#b56959"}},{"scope":["markup.underline.link.markdown","markup.underline.link.image.markdown"],"settings":{"fontStyle":"underline","foreground":"#393a3490"}},{"scope":["type.identifier","constant.other.character-class.regexp"],"settings":{"foreground":"#5a6aa6"}},{"scope":["entity.other.attribute-name.html.vue"],"settings":{"foreground":"#59873a"}},{"scope":["invalid.illegal.unrecognized-tag.html"],"settings":{"fontStyle":"normal"}}],"type":"light"}')); | ||
| export { | ||
| vitesseLight as default | ||
| }; |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
2
-60%1
-97.06%1
-83.33%10636746
-58.47%3
-70%1891
-53.82%