"use strict";
exports.id = 3201;
exports.ids = [3201];
exports.modules = {

/***/ 185126:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
var jsx_runtime_1 = __webpack_require__(920997);
var react_1 = __webpack_require__(616689);
var antd_1 = __webpack_require__(533734);
var react_copy_to_clipboard_1 = __webpack_require__(132213);
var icon_1 = __webpack_require__(807772);
var INPUT_STYLE = { display: "inline-block", flex: 1 };
var LABEL_STYLE = {
    marginRight: "15px",
    display: "flex",
    flex: "0 0 auto",
    justifyContent: "center",
    alignContent: "center",
    flexDirection: "column",
};
function CopyToClipBoard(props) {
    var value = props.value, style = props.style, size = props.size, label = props.label, labelStyle = props.labelStyle, inputStyle = props.inputStyle;
    var _a = __read((0, react_1.useState)(false), 2), copied = _a[0], setCopied = _a[1];
    (0, react_1.useEffect)(function () {
        setCopied(false);
    }, [value]);
    var copy = (0, react_1.useMemo)(function () {
        var btn = ((0, jsx_runtime_1.jsx)(react_copy_to_clipboard_1.CopyToClipboard, __assign({ text: value, onCopy: function () { return setCopied(true); } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Button, __assign({ size: size, style: {
                    margin: "-2px -12px" /* hack so doesn't conflict w/ style of Input below*/,
                } }, { children: (0, jsx_runtime_1.jsx)(icon_1.Icon, { name: copied ? "clipboard-check" : "clipboard" }) })) })));
        if (!copied)
            return btn;
        return ((0, jsx_runtime_1.jsx)(antd_1.Tooltip, __assign({ title: "Copied!", defaultVisible: true }, { children: btn })));
    }, [value, copied, size]);
    var input = ((0, jsx_runtime_1.jsx)(antd_1.Input, { size: size, readOnly: true, onFocus: function (e) { return e.target.select(); }, value: value, addonAfter: copy }));
    if (!label)
        return (0, jsx_runtime_1.jsx)("div", __assign({ style: style }, { children: input }));
    return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: __assign({ display: "flex" }, style) }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ style: __assign(__assign({}, LABEL_STYLE), labelStyle) }, { children: label })), " ", (0, jsx_runtime_1.jsx)("div", __assign({ style: __assign(__assign({}, INPUT_STYLE), inputStyle) }, { children: input }))] })));
}
exports["default"] = CopyToClipBoard;
//# sourceMappingURL=copy-to-clipboard.js.map

/***/ }),

/***/ 383668:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ PaymentMethods)
/* harmony export */ });
/* unused harmony export CreditCard */
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(616689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(566405);
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var lib_hooks_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(375698);
/* harmony import */ var components_share_loading__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(976087);
/* harmony import */ var components_misc_help_email__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(500590);
/* harmony import */ var components_misc_A__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(940981);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(807772);
/* harmony import */ var _cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var lib_api_post__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(194184);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(477389);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var lib_use_customize__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(117682);
/* harmony import */ var next_script__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(304298);
/* harmony import */ var next_script__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(next_script__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var lib_hooks_mounted__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(900686);
/* harmony import */ var components_share_site_name__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(535358);
/* harmony import */ var _cocalc_util_stripe_sales_tax__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(289238);
/*
 *  This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ /* Show payment methods.

TODO: we are only showing the credit card payment sources at present.
There are other types of sources, e.g., "ACH credit transfer".

In the *near* future we will support more payment methods!
*/ 















const STRIPE_CLIENT_LIBRARY = "https://js.stripe.com/v3/";
function Brand({ brand  }) {
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
        children: [
            brand?.includes(" ") ? "" : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_8__.Icon, {
                name: `cc-${brand?.toLowerCase()}`
            }),
            " ",
            brand
        ]
    });
}
function Number({ last4  }) {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
        children: `**** **** **** ${last4}`
    });
}
function ExpirationDate({ exp_month , exp_year  }) {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
        children: `${exp_month}/${exp_year}`
    });
}
function PaymentSourceActions({ onChange , default_source , brand , last4 , id  }) {
    const isMounted = (0,lib_hooks_mounted__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z)();
    const { 0: error , 1: setError  } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)("");
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        children: [
            error && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Alert, {
                type: "error",
                message: error,
                style: {
                    marginBottom: "5px"
                }
            }),
            default_source ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Popconfirm, {
                placement: "topLeft",
                showCancel: false,
                title: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    style: {
                        width: "400px"
                    },
                    children: [
                        "The default payment method is the",
                        " ",
                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("b", {
                            children: [
                                brand,
                                " card ending in ...",
                                last4
                            ]
                        }),
                        ". It will be used by default for subscriptions and new purchases."
                    ]
                }),
                okText: "OK",
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Button, {
                    type: "primary",
                    style: {
                        marginRight: "5px",
                        marginBottom: "5px"
                    },
                    children: "Default"
                })
            }) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Popconfirm, {
                placement: "topLeft",
                title: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    style: {
                        width: "400px"
                    },
                    children: [
                        "Do you want to set the",
                        " ",
                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("b", {
                            children: [
                                brand,
                                " card ending in ...",
                                last4
                            ]
                        }),
                        " ",
                        "to be the default for subscriptions and new purchases?"
                    ]
                }),
                onConfirm: async ()=>{
                    try {
                        setError("");
                        await (0,lib_api_post__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)("/billing/set-default-source", {
                            default_source: id
                        });
                        if (!isMounted.current) return;
                        onChange?.();
                    } catch (err) {
                        if (!isMounted.current) return;
                        setError(err.message);
                    }
                },
                okText: "Yes",
                cancelText: "No",
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Button, {
                    type: "dashed",
                    style: {
                        marginRight: "5px",
                        marginBottom: "5px"
                    },
                    children: "Default"
                })
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Popconfirm, {
                placement: "topLeft",
                title: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    style: {
                        width: "400px"
                    },
                    children: [
                        "Do you want to delete the",
                        " ",
                        /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("b", {
                            children: [
                                brand,
                                " card ending in ...",
                                last4
                            ]
                        }),
                        "? It will no longer be used for subscriptions and you will have to enter it again to use it to make a purchase."
                    ]
                }),
                onConfirm: async ()=>{
                    try {
                        setError("");
                        await (0,lib_api_post__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)("/billing/delete-payment-method", {
                            id
                        });
                        onChange?.();
                    } catch (err) {
                        setError(err.message);
                    }
                },
                okText: "Yes, delete this card",
                cancelText: "Cancel",
                children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_7__.Button, {
                    type: "dashed",
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_8__.Icon, {
                            name: "trash"
                        }),
                        " Delete"
                    ]
                })
            })
        ]
    });
}
const columns = (onChange)=>[
        {
            responsive: [
                "xs"
            ],
            title: "Card",
            render: (_, card)=>/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(CreditCard, {
                            ...card
                        }),
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(PaymentSourceActions, {
                            ...card,
                            onChange: onChange
                        })
                    ]
                })
        },
        {
            responsive: [
                "sm"
            ],
            title: "Type",
            dataIndex: "brand",
            render: (_, card)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Brand, {
                    ...card
                })
        },
        {
            responsive: [
                "sm"
            ],
            title: "Number",
            dataIndex: "last4",
            render: (_, card)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Number, {
                    ...card
                })
        },
        {
            responsive: [
                "sm"
            ],
            title: "Expiration Date",
            align: "center",
            render: (_, card)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(ExpirationDate, {
                    ...card
                })
        },
        {
            responsive: [
                "sm"
            ],
            title: "Country",
            dataIndex: "country",
            align: "center"
        },
        {
            responsive: [
                "sm"
            ],
            title: "Postal Code",
            dataIndex: "address_zip",
            align: "center"
        },
        {
            responsive: [
                "sm"
            ],
            title: "",
            render: (_, card)=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(PaymentSourceActions, {
                    ...card,
                    onChange: onChange
                })
        }, 
    ];
function PaymentMethods({ startMinimized , setTaxRate  }) {
    const { 0: minimized , 1: setMinimized  } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(!!startMinimized);
    const { result , error , call  } = (0,lib_hooks_api__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)("billing/get-customer");
    if (error) {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Alert, {
            type: "error",
            message: error
        });
    }
    if (!result) {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_share_loading__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
            center: true
        });
    }
    // set default so can use in table
    const { default_source  } = result;
    const cards = [];
    if (result.sources != null) {
        for (const row of result.sources.data){
            if (row.id == default_source) {
                row.default_source = true;
                if (setTaxRate != null) {
                    // TODO: setTimeout as a quick fix. You can't change the state while the parent is rendering
                    // Cannot update a component (`Checkout`) while rendering a different component `PaymentMethods`).
                    setTimeout(()=>setTaxRate((0,_cocalc_util_stripe_sales_tax__WEBPACK_IMPORTED_MODULE_15__["default"])(row.address_zip)), 0);
                }
            }
            if (row.id.startsWith("card_")) {
                cards.push(row);
            }
        }
    }
    // sort by data rather than what comes back, so changing
    // default stays stable (since moving is confusing).
    cards.sort((x, y)=>(0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_10__.cmp)(x.id, y.id));
    if (minimized) {
        let defaultCard = undefined;
        for (const card of cards){
            if (card.default_source) {
                defaultCard = card;
                break;
            }
        }
        if (defaultCard) {
            return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_A__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
                        onClick: ()=>setMinimized(false),
                        children: "Change"
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(CreditCard, {
                        ...defaultCard
                    })
                ]
            });
        }
    }
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        children: [
            startMinimized && cards.length > 0 && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                style: {
                    float: "right",
                    marginRight: "15px"
                },
                children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(components_misc_A__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
                    onClick: ()=>setMinimized(true),
                    children: [
                        "Close ",
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_8__.Icon, {
                            name: "times"
                        })
                    ]
                })
            }),
            !startMinimized && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
                children: [
                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("h3", {
                        children: [
                            "Credit Cards (",
                            cards.length,
                            ")"
                        ]
                    }),
                    cards.length > 0 ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
                        children: "These are the credit cards that you have currently setup."
                    }) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
                        children: "Please enter your credit card below."
                    }),
                    " "
                ]
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(AddPaymentMethod, {
                defaultAdding: cards.length == 0,
                onChange: call,
                style: {
                    marginTop: "15px",
                    marginBottom: "5px"
                }
            }),
            cards.length > 0 && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Table, {
                columns: columns(call),
                dataSource: cards,
                rowKey: "id",
                style: {
                    marginTop: "15px",
                    overflowX: "auto"
                },
                pagination: {
                    hideOnSinglePage: true,
                    pageSize: 100
                }
            }),
            result.sources?.has_more && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Alert, {
                type: "warning",
                showIcon: true,
                message: "WARNING: Some of your cards may not be displayed above, since there are so many."
            })
        ]
    });
};
function AddPaymentMethod({ onChange , style , defaultAdding  }) {
    const { 0: error , 1: setError  } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)("");
    const { 0: adding , 1: setAdding  } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(!!defaultAdding);
    const { 0: creating , 1: setCreating  } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false);
    const { 0: stripe , 1: setStripe  } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(null);
    const cardRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)();
    const { stripePublishableKey  } = (0,lib_use_customize__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z)();
    const isMounted = (0,lib_hooks_mounted__WEBPACK_IMPORTED_MODULE_13__/* ["default"] */ .Z)();
    (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{
        if (!adding || !cardRef.current) return;
        if (stripe != null) {
            stripe.card.mount(react_dom__WEBPACK_IMPORTED_MODULE_2___default().findDOMNode(cardRef.current));
        } else {
            if (window.Stripe == null) return;
            const stripe1 = window.Stripe(stripePublishableKey);
            const card = stripe1.elements().create("card");
            if (card == null) throw Error("bug -- card cannot be null");
            setStripe({
                stripe: stripe1,
                card
            });
            card.mount(react_dom__WEBPACK_IMPORTED_MODULE_2___default().findDOMNode(cardRef.current));
        }
    }, [
        adding,
        stripe
    ]);
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        style: style,
        children: [
            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_7__.Button, {
                disabled: adding,
                onClick: ()=>setAdding(true),
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_8__.Icon, {
                        name: "plus-circle"
                    }),
                    " Add Credit Card"
                ]
            }),
            adding && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                style: {
                    border: "1px solid #ddd",
                    padding: "15px",
                    borderRadius: "5px",
                    maxWidth: "600px",
                    margin: "15px auto"
                },
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((next_script__WEBPACK_IMPORTED_MODULE_12___default()), {
                        src: STRIPE_CLIENT_LIBRARY,
                        onLoad: ()=>{
                            const stripe = window.Stripe(stripePublishableKey);
                            const card = stripe.elements().create("card");
                            if (card == null) throw Error("bug -- card cannot be null");
                            setStripe({
                                stripe,
                                card
                            });
                        },
                        onError: ()=>{
                            setError(`Stripe script failed to load. Make sure your browser is not blocking ${STRIPE_CLIENT_LIBRARY}, then refresh this page.`);
                        }
                    }),
                    error && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Alert, {
                        type: "error",
                        showIcon: true,
                        message: error,
                        style: {
                            margin: "15px 0"
                        }
                    }),
                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                        style: {
                            textAlign: "center"
                        },
                        children: [
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                ref: cardRef,
                                style: {
                                    border: "1px solid lightgray",
                                    borderRadius: "5px",
                                    margin: "5px auto 20px auto",
                                    maxWidth: "400px",
                                    padding: "15px 10px",
                                    boxShadow: "5px 5px 5px lightgray"
                                }
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Button, {
                                style: {
                                    marginRight: "5px"
                                },
                                onClick: ()=>setAdding(false),
                                disabled: creating,
                                children: "Cancel"
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_7__.Button, {
                                disabled: creating,
                                type: "primary",
                                onClick: async ()=>{
                                    setCreating(true);
                                    try {
                                        let token;
                                        try {
                                            const result = await stripe?.stripe.createToken(stripe.card);
                                            if (!isMounted.current) return;
                                            if (result.error) {
                                                throw Error(result.error.message);
                                            }
                                            ({ token  } = result);
                                        } catch (err) {
                                            if (!isMounted.current) return;
                                            setError(err.message);
                                            return;
                                        }
                                        try {
                                            await (0,lib_api_post__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .Z)("/billing/create-payment-method", {
                                                id: token.id
                                            });
                                            if (!isMounted.current) return;
                                            onChange?.();
                                            setAdding(false);
                                        } catch (err1) {
                                            setError(err1.message);
                                        }
                                    } finally{
                                        if (!isMounted.current) return;
                                        setCreating(false);
                                    }
                                },
                                children: creating ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_share_loading__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
                                    center: true,
                                    delay: 0,
                                    children: "Adding Card..."
                                }) : "Add Card"
                            })
                        ]
                    }),
                    /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                        style: {
                            color: "#666",
                            marginTop: "15px"
                        },
                        children: [
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_share_site_name__WEBPACK_IMPORTED_MODULE_14__/* ["default"] */ .Z, {}),
                            " does not directly store any credit card numbers; instead they are stored securely by",
                            " ",
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_A__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
                                href: "https://stripe.com/",
                                external: true,
                                children: "Stripe"
                            }),
                            ". PayPal or wire transfers for non-recurring purchases above $100 are also possible. ",
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_help_email__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {}),
                            "."
                        ]
                    })
                ]
            })
        ]
    });
}
function CreditCard(props) {
    const { brand , last4 , exp_month , exp_year , country , address_zip  } = props;
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        style: {
            backgroundColor: "#f0f0ff",
            border: "1px solid lightgrey",
            margin: "15px 0",
            padding: "10px",
            borderRadius: "5px",
            maxWidth: "300px"
        },
        children: [
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Brand, {
                brand: brand
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("br", {}),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Number, {
                last4: last4
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("br", {}),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(ExpirationDate, {
                exp_month: exp_month,
                exp_year: exp_year
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("br", {}),
            country,
            " ",
            address_zip,
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("br", {})
        ]
    });
}


/***/ }),

/***/ 34873:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "M": () => (/* binding */ EditableTitle),
/* harmony export */   "q": () => (/* binding */ EditableDescription)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(616689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var lib_api_post__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(194184);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(477389);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_4__);





function EditableTitle({ license_id , title , onChange  }) {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(EditableTextField, {
        license_id: license_id,
        field: "title",
        value: title,
        onChange: onChange
    });
}
function EditableDescription({ license_id , description , onChange  }) {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(EditableTextField, {
        license_id: license_id,
        field: "description",
        value: description,
        rows: 3,
        onChange: onChange
    });
}
function EditableTextField({ license_id , field , value , rows , onChange  }) {
    const { 0: edit , 1: setEdit  } = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(false);
    const { 0: value2 , 1: setValue  } = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(value ?? "");
    const { 0: error , 1: setError  } = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)("");
    (0,react__WEBPACK_IMPORTED_MODULE_2__.useEffect)(()=>{
        setValue(value ?? "");
        setEdit(false);
        setError("");
    }, [
        value
    ]);
    async function save(value) {
        setEdit(false);
        setError("");
        const query = {
            manager_site_licenses: {
                id: license_id,
                [field]: value
            }
        };
        try {
            await (0,lib_api_post__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)("/user-query", {
                query
            });
            onChange?.();
        } catch (err) {
            setError(err.message);
        }
    }
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        style: {
            cursor: "pointer"
        },
        onClick: ()=>setEdit(true),
        children: [
            error && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Alert, {
                type: "error",
                message: `Error saving ${field} - ${error}`
            }),
            (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_4__.capitalize)(field),
            ":",
            " ",
            edit && (rows ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Input.TextArea, {
                autoFocus: true,
                value: value2,
                onChange: (e)=>setValue(e.target.value),
                onBlur: ()=>save(value2),
                rows: rows
            }) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Input, {
                autoFocus: true,
                value: value2,
                onChange: (e)=>setValue(e.target.value),
                onBlur: ()=>save(value2),
                onPressEnter: ()=>save(value2)
            })),
            !edit && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
                children: value2.trim() ? value2 : `(set ${field}...)`
            })
        ]
    });
}


/***/ }),

/***/ 776527:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "C0": () => (/* binding */ DateRange),
/* harmony export */   "PO": () => (/* binding */ Details),
/* harmony export */   "ZP": () => (/* binding */ License),
/* harmony export */   "cF": () => (/* binding */ Quota)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _cocalc_util_licenses_describe_quota__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21969);
/* harmony import */ var _cocalc_util_licenses_describe_quota__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cocalc_util_licenses_describe_quota__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(477389);
/* harmony import */ var _cocalc_util_misc__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var components_misc_A__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(940981);
/* harmony import */ var components_misc_copyable__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(393884);
/* harmony import */ var components_misc_timestamp__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(749414);
/* harmony import */ var components_share_loading__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(976087);
/* harmony import */ var lib_hooks_api__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(375698);
/* harmony import */ var _editable_license__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(34873);










function License({ license_id , style  }) {
    // TODO: do something with contrib
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_3__.Popover, {
        content: ()=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Details, {
                license_id: license_id
            }),
        title: license_id,
        mouseEnterDelay: 0.5,
        children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_A__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
            style: {
                cursor: "pointer",
                fontFamily: "monospace",
                ...style
            },
            href: `/licenses/how-used?license_id=${license_id}`,
            children: license_id
        })
    });
};
/*
{
  "id": "cad2fe88-29d7-4f4e-987c-a3ae6143a25b",
  "title": "different business license for specific time",
  "description": "",
  "expires": 1642799517638,
  "activates": 1640121117638,
  "last_used": null,
  "managers": [
    "93620c6e-324a-4217-a60e-2ac436953174"
  ],
  "upgrades": null,
  "quota": {
    "cpu": 1,
    "ram": 1,
    "disk": 1,
    "user": "business",
    "member": true,
    "dedicated_cpu": 0,
    "dedicated_ram": 0,
    "always_running": true
  },
  "run_limit": 3,
  is_manager:true,
  number_running:2
}
*/ function Details({ license_id  }) {
    const { result , error  } = (0,lib_hooks_api__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z)("licenses/get-license", {
        license_id
    }, 3); // 3s cache
    if (error) {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_3__.Alert, {
            type: "error",
            message: error
        });
    }
    if (!result) {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_share_loading__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {});
    }
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
        children: [
            (result.title || result.is_manager) && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                style: {
                    fontWeight: "bold",
                    fontSize: "13pt"
                },
                children: result.is_manager ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_editable_license__WEBPACK_IMPORTED_MODULE_9__/* .EditableTitle */ .M, {
                    license_id: license_id,
                    title: result.title
                }) : "Title: " + result.title
            }),
            (result.description || result.is_manager) && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                children: result.is_manager ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_editable_license__WEBPACK_IMPORTED_MODULE_9__/* .EditableDescription */ .q, {
                    license_id: license_id,
                    description: result.description
                }) : "Description: " + result.description
            }),
            result.managers != null && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                children: "You are a manager of this license."
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(DateRange, {
                    ...result
                })
            }),
            result.last_used != null && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                children: [
                    "Last used: ",
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_timestamp__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
                        epoch: result.last_used
                    })
                ]
            }),
            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                children: [
                    "Quota: ",
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Quota, {
                        quota: result.quota,
                        upgrades: result.upgrades
                    })
                ]
            }),
            result.run_limit != null && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                style: {
                    width: "100%",
                    display: "flex"
                },
                children: [
                    "Run limit: ",
                    result.run_limit,
                    result.number_running != null ? `; Currently running: ${result.number_running}` : "",
                    result.run_limit && result.number_running != null && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_3__.Progress, {
                        style: {
                            marginLeft: "15px",
                            flex: 1
                        },
                        percent: Math.round(result.number_running / result.run_limit * 100)
                    })
                ]
            }),
            result.is_manager && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_copyable__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
                label: "ID:",
                value: license_id,
                style: {
                    marginTop: "5px"
                }
            })
        ]
    });
}
function Quota({ quota , upgrades  }) {
    if (quota == null) {
        if (upgrades == null) {
            return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {});
        } else {
            // These are very old, and we just do a little bit to display
            // something valid.
            quota = {
                cpu: upgrades.cores,
                ram: upgrades.memory / 1000
            };
        }
    }
    const info = (0,_cocalc_util_licenses_describe_quota__WEBPACK_IMPORTED_MODULE_1__.describe_quota)(quota, true);
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
        children: info
    });
}
function DateRange({ activates , expires , info  }) {
    const isExpired = expires && expires < new Date().valueOf();
    const sub = info?.purchased?.subscription;
    if (sub && sub != "no") {
        return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("span", {
            children: [
                (0,_cocalc_util_misc__WEBPACK_IMPORTED_MODULE_2__.capitalize)(sub),
                " subscription",
                isExpired && /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
                    children: [
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("b", {
                            children: " Expired "
                        }),
                        " ",
                        /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_timestamp__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
                            epoch: expires,
                            absolute: true,
                            dateOnly: true
                        })
                    ]
                })
            ]
        });
    }
    const dates = /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
        children: [
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_timestamp__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
                epoch: activates,
                absolute: true,
                dateOnly: true
            }),
            " –",
            " ",
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_timestamp__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
                epoch: expires,
                absolute: true,
                dateOnly: true
            })
        ]
    });
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
        children: isExpired ? /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("b", {
                    children: "Expired "
                }),
                "(was valid ",
                dates,
                ")"
            ]
        }) : /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
            children: [
                "Valid: ",
                dates
            ]
        })
    });
}


/***/ }),

/***/ 688642:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ Anonymous)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var components_misc_A__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(940981);


function Anonymous() {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
        style: {
            margin: "30px auto",
            fontSize: "14pt"
        },
        children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(components_misc_A__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, {
            href: "/config",
            children: "You need to sign up for a non-anonymous account..."
        })
    });
};


/***/ }),

/***/ 393884:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _cocalc_frontend_components_copy_to_clipboard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(185126);
/* harmony import */ var _cocalc_frontend_components_copy_to_clipboard__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_cocalc_frontend_components_copy_to_clipboard__WEBPACK_IMPORTED_MODULE_0__);

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((_cocalc_frontend_components_copy_to_clipboard__WEBPACK_IMPORTED_MODULE_0___default()));


/***/ }),

/***/ 500590:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ HelpEmail)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lib_customize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(400054);
/* harmony import */ var components_misc_A__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(940981);



function HelpEmail({ lower  }) {
    const { helpEmail  } = (0,lib_customize__WEBPACK_IMPORTED_MODULE_1__/* .useCustomize */ .i)();
    if (!helpEmail) return null;
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(components_misc_A__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
        href: "mailto:" + helpEmail,
        external: true,
        children: [
            lower ? "e" : "E",
            "mail ",
            helpEmail
        ]
    });
};


/***/ }),

/***/ 749414:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ Timestamp),
/* harmony export */   "j": () => (/* binding */ processTimestamp)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var timeago_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(754788);
/* harmony import */ var timeago_react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(timeago_react__WEBPACK_IMPORTED_MODULE_2__);
/*
 *  This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ 


function processTimestamp(props) {
    const { epoch , dateOnly  } = props;
    let datetime = props.datetime;
    if (epoch && datetime == null) {
        datetime = new Date(epoch);
    }
    if (!datetime) {
        return "-";
    }
    if (typeof datetime == "string") {
        datetime = new Date(datetime);
        if (typeof datetime == "string") throw Error("bug");
    }
    const absoluteTimeDateOnly = datetime.toLocaleDateString(undefined, {
        year: "numeric",
        month: "short",
        day: "numeric"
    });
    const absoluteTimeFull = datetime.toLocaleString(undefined, {
        year: "numeric",
        month: "short",
        day: "numeric",
        hour: "numeric",
        minute: "numeric"
    });
    const timeShown = dateOnly ? absoluteTimeDateOnly : absoluteTimeFull;
    return {
        datetime,
        timeShown,
        absoluteTimeDateOnly,
        absoluteTimeFull
    };
}
function Timestamp(props) {
    const { style , absolute  } = props;
    const data = processTimestamp(props);
    if (data === "-") {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
            style: style,
            children: "-"
        });
    }
    const { datetime , timeShown , absoluteTimeFull  } = data;
    if (absolute) {
        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Tooltip, {
            trigger: [
                "hover",
                "click"
            ],
            title: absoluteTimeFull,
            children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
                style: style,
                children: timeShown
            })
        });
    }
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_1__.Tooltip, {
        trigger: [
            "hover",
            "click"
        ],
        title: timeShown,
        children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx((timeago_react__WEBPACK_IMPORTED_MODULE_2___default()), {
            style: style,
            datetime: datetime
        })
    });
};


/***/ }),

/***/ 535358:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ SiteName)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lib_use_customize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(117682);


function SiteName({ full  }) {
    const { siteName , siteDescription  } = (0,lib_use_customize__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)();
    if (full) {
        return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
            children: [
                siteName,
                ": ",
                siteDescription
            ]
        });
    }
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
        children: siteName
    });
};


/***/ }),

/***/ 774872:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "d": () => (/* binding */ MAX_WIDTH),
/* harmony export */   "r": () => (/* binding */ SHARE_MAX_WIDTH)
/* harmony export */ });
/*
Constants and other configuration that impact the overall
look of all of the pages.
*/ const MAX_WIDTH = "900px";
const SHARE_MAX_WIDTH = "1100px";


/***/ }),

/***/ 136811:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "P_": () => (/* binding */ OVERVIEW_LARGE_ICON),
/* harmony export */   "dP": () => (/* binding */ OVERVIEW_STYLE),
/* harmony export */   "m2": () => (/* binding */ OverviewRow),
/* harmony export */   "uF": () => (/* binding */ OVERVIEW_LARGE_ICON_MARGIN),
/* harmony export */   "xs": () => (/* binding */ Product)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(920997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(807772);
/* harmony import */ var _cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _cocalc_util_theme__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(990821);
/* harmony import */ var _cocalc_util_theme__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_cocalc_util_theme__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(545725);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(antd__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var components_misc_A__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(940981);
/*
 *  This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */ 




const gridProps = {
    sm: 24,
    md: 12
};
const OVERVIEW_STYLE = {
    textAlign: "center",
    width: "75%",
    margin: "0px auto 0px auto"
};
const OVERVIEW_LARGE_ICON = {
    fontSize: "100px",
    color: _cocalc_util_theme__WEBPACK_IMPORTED_MODULE_2__.COLORS.COCALC_BLUE,
    borderRadius: "50%",
    backgroundColor: _cocalc_util_theme__WEBPACK_IMPORTED_MODULE_2__.COLORS.COCALC_ORANGE,
    border: `15px solid ${_cocalc_util_theme__WEBPACK_IMPORTED_MODULE_2__.COLORS.COCALC_BLUE}`,
    padding: "20px 20px 15px 15px",
    display: "inline-block",
    margin: "30px 0px 40px 0px",
    boxShadow: "0px 2px 10px 2px"
};
// variation of the above, since some icons need more margin
const OVERVIEW_LARGE_ICON_MARGIN = {
    ...OVERVIEW_LARGE_ICON,
    padding: "23px 20px 20px 20px",
    fontSize: "80px"
};
function Product({ icon , title , href , children  }) {
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(antd__WEBPACK_IMPORTED_MODULE_3__.Col, {
        ...gridProps,
        children: [
            /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(components_misc_A__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
                href: href,
                children: [
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_cocalc_frontend_components_icon__WEBPACK_IMPORTED_MODULE_1__.Icon, {
                        style: {
                            fontSize: "50px",
                            fontWeight: "bold",
                            display: "block"
                        },
                        name: icon
                    }),
                    /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
                        style: {
                            fontSize: "25px",
                            marginBottom: "15px"
                        },
                        children: title
                    })
                ]
            }),
            children
        ]
    });
}
function OverviewRow({ children  }) {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(antd__WEBPACK_IMPORTED_MODULE_3__.Row, {
        gutter: [
            25,
            50
        ],
        style: {
            marginTop: "30px",
            marginBottom: "60px"
        },
        children: children
    });
}


/***/ }),

/***/ 856343:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


/*
 *  This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.displaySiteLicense = exports.untangleUptime = exports.requiresMemberhosting = exports.LicenseIdleTimeoutsKeysOrdered = exports.LicenseIdleTimeouts = void 0;
var lodash_1 = __webpack_require__(988593);
// Site Licenses related constants
// the license timeouts combined with the default quota (either hardcoded or the one from the site_settings)
// hence 30 minutes + 30 minutes default result in 30 minutes, and the same for "medium" and "day"
// @see DEFAULT_QUOTAS.mintime in src/packages/util/upgrade-spec.js
// medium and day imply member hosting
exports.LicenseIdleTimeouts = {
    short: {
        mins: 30,
        label: "30 minutes",
        labelShort: "30min",
        priceFactor: 1,
    },
    medium: { mins: 2 * 60, label: "2 hours", labelShort: "2h", priceFactor: 2 },
    day: {
        mins: 24 * 60,
        label: "1 day",
        labelShort: "1d",
        priceFactor: 4,
        requireMemberhosting: true,
    },
};
exports.LicenseIdleTimeoutsKeysOrdered = (0, lodash_1.sortBy)(Object.keys(exports.LicenseIdleTimeouts), function (v) { return exports.LicenseIdleTimeouts[v].mins; });
function requiresMemberhosting(key) {
    var _a, _b;
    if (key == null)
        return false;
    if (key == "always_running")
        return true;
    return (_b = (_a = exports.LicenseIdleTimeouts[key]) === null || _a === void 0 ? void 0 : _a.requireMemberhosting) !== null && _b !== void 0 ? _b : false;
}
exports.requiresMemberhosting = requiresMemberhosting;
function untangleUptime(uptime) {
    if (uptime == null) {
        throw new Error("uptime must be defined");
    }
    if (uptime == "always_running") {
        return { always_running: true, idle_timeout: "day" };
    }
    return { always_running: false, idle_timeout: uptime };
}
exports.untangleUptime = untangleUptime;
function displaySiteLicense(uptime) {
    if (uptime == "always_running") {
        return "Always Running";
    }
    else {
        return exports.LicenseIdleTimeouts[uptime].label;
    }
}
exports.displaySiteLicense = displaySiteLicense;
//# sourceMappingURL=site-license.js.map

/***/ }),

/***/ 21969:
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {


/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.describeQuotaOnLine = exports.describe_quota = exports.describeQuotaFromInfo = void 0;
var site_license_1 = __webpack_require__(856343);
var misc_1 = __webpack_require__(477389);
var utils_1 = __webpack_require__(389896);
function describeQuotaFromInfo(info, withName) {
    if (withName === void 0) { withName = true; }
    var type = info.type;
    switch (type) {
        case "quota":
            var _a = (0, site_license_1.untangleUptime)(info.custom_uptime), idle_timeout = _a.idle_timeout, always_running = _a.always_running;
            return describe_quota({
                ram: info.custom_ram,
                cpu: info.custom_cpu,
                disk: info.custom_disk,
                always_running: always_running,
                idle_timeout: idle_timeout,
                member: info.custom_member,
                user: info.user,
                boost: info.boost,
            });
        case "vm":
            if (info.dedicated_vm == null) {
                throw new Error("dedicated_vm must be defined");
            }
            // we make a copy, because we eventually delete a field
            var dedicated_vm = __assign({}, info.dedicated_vm);
            if (!withName)
                dedicated_vm === null || dedicated_vm === void 0 ? true : delete dedicated_vm.name;
            return describe_quota({ dedicated_vm: dedicated_vm });
        case "disk":
            if (info.dedicated_disk == null ||
                typeof info.dedicated_disk === "boolean") {
                throw new Error("dedicated_disk must be defined and not a boolean");
            }
            // we make a copy, because we eventually delete a field
            var dedicated_disk = __assign({}, info.dedicated_disk);
            if (!withName)
                dedicated_disk === null || dedicated_disk === void 0 ? true : delete dedicated_disk.name;
            return describe_quota({ dedicated_disk: dedicated_disk });
        default:
            throw new Error("unkonwn type ".concat(type));
    }
}
exports.describeQuotaFromInfo = describeQuotaFromInfo;
function fixUptime(quota) {
    // regarding quota.uptime: it is assumed that all calls already query using the schema defined
    // in SiteLicenseQuota, but if not, we untangle the uptime field.
    if (quota.uptime != null) {
        var _a = (0, site_license_1.untangleUptime)(quota.uptime), always_running = _a.always_running, idle_timeout = _a.idle_timeout;
        quota.always_running = always_running;
        quota.idle_timeout = idle_timeout;
        delete quota.uptime;
    }
}
function describe_quota(quota, short) {
    //console.log(`describe_quota (short=${short})`, quota);
    var _a;
    fixUptime(quota);
    var v = [];
    var intro = "";
    var hideNetwork = false;
    var isBoost = quota.boost === true;
    var booster = isBoost ? " booster" : "";
    if (quota.user) {
        if (short) {
            intro = "".concat((0, misc_1.capitalize)(quota.user)).concat(booster, ",");
        }
        else {
            intro = "".concat((0, misc_1.capitalize)(quota.user), " license").concat(booster, " providing");
        }
    }
    else {
        // dedicated resources do not have a specific user
        intro = short ? "License" : "License providing";
    }
    if (quota.ram) {
        v.push("".concat(quota.ram, "G RAM"));
    }
    if (quota.cpu) {
        v.push("".concat(quota.cpu, " shared ").concat((0, misc_1.plural)(quota.cpu, "CPU")));
    }
    if (quota.disk) {
        v.push("".concat(quota.disk, "G disk"));
    }
    if (quota.dedicated_ram) {
        v.push("".concat(quota.dedicated_ram, "G dedicated RAM"));
    }
    if (quota.dedicated_cpu) {
        v.push("".concat(quota.dedicated_cpu, " dedicated ").concat((0, misc_1.plural)(quota.dedicated_cpu, "CPU")));
    }
    if (typeof quota.dedicated_vm !== "boolean" &&
        typeof ((_a = quota.dedicated_vm) === null || _a === void 0 ? void 0 : _a.machine) === "string") {
        hideNetwork = true;
        v.push("hosting on a Dedicated VM providing ".concat((0, utils_1.dedicatedVmDisplay)(quota.dedicated_vm)));
    }
    else {
        if (quota.member) {
            v.push("member" + (short ? "" : " hosting"));
        }
    }
    if (quota.dedicated_disk != null &&
        typeof quota.dedicated_disk !== "boolean") {
        hideNetwork = true;
        v.push("a Dedicated Disk (".concat((0, utils_1.dedicatedDiskDisplay)(quota.dedicated_disk), ")"));
    }
    if (quota.always_running) {
        v.push("always running");
    }
    else {
        if (quota.idle_timeout != null) {
            var it_1 = site_license_1.LicenseIdleTimeouts[quota.idle_timeout];
            if (it_1 != null) {
                v.push("".concat(it_1.label, " timeout"));
            }
        }
    }
    if (!hideNetwork && !isBoost) {
        v.push("network"); // always provided, because we trust customers.
    }
    return "".concat(intro, " ").concat(v.join(", "));
}
exports.describe_quota = describe_quota;
// similar to the above, but very short for the info bar on those store purchase pages.
// instead of overloading the above with even more special cases, this brings it quickly to the point
function describeQuotaOnLine(quota) {
    var _a;
    fixUptime(quota);
    var v = [];
    if (quota.ram) {
        v.push("".concat(quota.ram, "G RAM"));
    }
    if (quota.cpu) {
        v.push("".concat(quota.cpu, " ").concat((0, misc_1.plural)(quota.cpu, "CPU")));
    }
    if (quota.disk) {
        v.push("".concat(quota.disk, "G disk"));
    }
    if (quota.dedicated_ram) {
        v.push("".concat(quota.dedicated_ram, "G dedicated RAM"));
    }
    if (quota.dedicated_cpu) {
        v.push("".concat(quota.dedicated_cpu, " dedicated ").concat((0, misc_1.plural)(quota.dedicated_cpu, "CPU")));
    }
    if (typeof quota.dedicated_vm !== "boolean" &&
        typeof ((_a = quota.dedicated_vm) === null || _a === void 0 ? void 0 : _a.machine) === "string") {
        v.push("Dedicated VM ".concat((0, utils_1.dedicatedVmDisplay)(quota.dedicated_vm)));
    }
    else {
        if (quota.member) {
            v.push("member");
        }
    }
    if (quota.dedicated_disk != null &&
        typeof quota.dedicated_disk !== "boolean") {
        v.push("Dedicated Disk (".concat((0, utils_1.dedicatedDiskDisplay)(quota.dedicated_disk, "short"), ")"));
    }
    if (quota.always_running) {
        v.push("always running");
    }
    else {
        if (quota.idle_timeout != null) {
            var it_2 = site_license_1.LicenseIdleTimeouts[quota.idle_timeout];
            if (it_2 != null) {
                v.push("".concat(it_2.labelShort, " timeout"));
            }
        }
    }
    if (quota.user) {
        var isBoost = quota.boost === true;
        var booster = isBoost ? " booster" : "";
        v.push("".concat((0, misc_1.capitalize)(quota.user)).concat(booster));
    }
    return "".concat(v.join(", "));
}
exports.describeQuotaOnLine = describeQuotaOnLine;
//# sourceMappingURL=describe-quota.js.map

/***/ }),

/***/ 289238:
/***/ ((__unused_webpack_module, exports) => {

var __webpack_unused_export__;

/*
Sales tax for WA state.

Of course, this shouldn't exist much longer, since it's the sort of thing
that stripe automates.
*/
__webpack_unused_export__ = ({ value: true });
// WA state sales tax rates, as of July 11 2017.
// Generated via scripts/sales_tax.py
function salesTax(zip) {
    var _a;
    return (_a = WA_sales_tax[zip]) !== null && _a !== void 0 ? _a : 0;
}
exports["default"] = salesTax;
var WA_sales_tax = {
    98001: 0.099,
    98002: 0.086,
    98003: 0.1,
    98004: 0.1,
    98005: 0.1,
    98006: 0.086,
    98007: 0.1,
    98008: 0.1,
    98009: 0.1,
    98010: 0.086,
    98011: 0.1,
    98012: 0.077,
    98013: 0.086,
    98014: 0.086,
    98015: 0.1,
    98019: 0.077,
    98020: 0.1,
    98021: 0.077,
    98022: 0.079,
    98023: 0.1,
    98024: 0.086,
    98025: 0.086,
    98026: 0.1,
    98027: 0.086,
    98028: 0.1,
    98029: 0.086,
    98030: 0.1,
    98031: 0.1,
    98032: 0.1,
    98033: 0.1,
    98034: 0.1,
    98035: 0.1,
    98036: 0.103,
    98037: 0.103,
    98038: 0.086,
    98039: 0.1,
    98040: 0.1,
    98041: 0.1,
    98042: 0.086,
    98043: 0.1,
    98045: 0.086,
    98046: 0.104,
    98047: 0.093,
    98050: 0.086,
    98051: 0.086,
    98052: 0.086,
    98053: 0.086,
    98054: 0.086,
    98055: 0.1,
    98056: 0.1,
    98057: 0.1,
    98058: 0.086,
    98059: 0.086,
    98061: 0.09,
    98062: 0.1,
    98063: 0.1,
    98064: 0.1,
    98065: 0.086,
    98068: 0.08,
    98070: 0.086,
    98071: 0.1,
    98072: 0.077,
    98073: 0.1,
    98074: 0.086,
    98075: 0.086,
    98077: 0.077,
    98082: 0.104,
    98083: 0.1,
    98087: 0.103,
    98089: 0.1,
    98092: 0.086,
    98093: 0.1,
    98101: 0.101,
    98102: 0.101,
    98103: 0.101,
    98104: 0.101,
    98105: 0.101,
    98106: 0.1,
    98107: 0.101,
    98108: 0.1,
    98109: 0.101,
    98110: 0.09,
    98111: 0.101,
    98112: 0.101,
    98113: 0.101,
    98114: 0.101,
    98115: 0.101,
    98116: 0.101,
    98117: 0.101,
    98118: 0.101,
    98119: 0.101,
    98121: 0.101,
    98122: 0.101,
    98124: 0.101,
    98125: 0.1,
    98126: 0.1,
    98127: 0.101,
    98129: 0.101,
    98131: 0.1,
    98132: 0.1,
    98133: 0.1,
    98134: 0.101,
    98136: 0.101,
    98138: 0.1,
    98139: 0.101,
    98141: 0.101,
    98144: 0.1,
    98145: 0.101,
    98146: 0.1,
    98148: 0.1,
    98151: 0.1,
    98154: 0.101,
    98155: 0.1,
    98158: 0.1,
    98160: 0.1,
    98161: 0.101,
    98164: 0.101,
    98165: 0.101,
    98166: 0.1,
    98168: 0.1,
    98170: 0.1,
    98171: 0.1,
    98174: 0.101,
    98175: 0.101,
    98177: 0.1,
    98178: 0.1,
    98181: 0.101,
    98184: 0.101,
    98185: 0.101,
    98188: 0.1,
    98189: 0.1,
    98190: 0.1,
    98191: 0.101,
    98194: 0.101,
    98195: 0.101,
    98198: 0.1,
    98199: 0.101,
    98201: 0.089,
    98203: 0.077,
    98204: 0.097,
    98205: 0.097,
    98206: 0.097,
    98207: 0.097,
    98208: 0.077,
    98213: 0.097,
    98220: 0.085,
    98221: 0.081,
    98222: 0.081,
    98223: 0.077,
    98224: 0.086,
    98225: 0.079,
    98226: 0.079,
    98227: 0.087,
    98228: 0.087,
    98229: 0.079,
    98230: 0.079,
    98231: 0.085,
    98232: 0.085,
    98233: 0.081,
    98235: 0.085,
    98236: 0.087,
    98237: 0.079,
    98238: 0.081,
    98239: 0.087,
    98240: 0.085,
    98241: 0.081,
    98243: 0.081,
    98244: 0.079,
    98245: 0.081,
    98247: 0.085,
    98248: 0.079,
    98249: 0.087,
    98250: 0.081,
    98251: 0.086,
    98252: 0.077,
    98253: 0.087,
    98255: 0.085,
    98256: 0.089,
    98257: 0.081,
    98258: 0.077,
    98259: 0.091,
    98260: 0.087,
    98261: 0.081,
    98262: 0.079,
    98263: 0.085,
    98264: 0.085,
    98266: 0.085,
    98267: 0.085,
    98270: 0.077,
    98271: 0.077,
    98272: 0.077,
    98273: 0.081,
    98274: 0.081,
    98275: 0.097,
    98276: 0.085,
    98277: 0.087,
    98278: 0.087,
    98279: 0.081,
    98280: 0.081,
    98281: 0.079,
    98282: 0.077,
    98283: 0.079,
    98284: 0.077,
    98286: 0.081,
    98287: 0.089,
    98288: 0.086,
    98290: 0.077,
    98291: 0.091,
    98292: 0.077,
    98293: 0.089,
    98294: 0.077,
    98295: 0.085,
    98296: 0.077,
    98297: 0.081,
    98303: 0.079,
    98304: 0.078,
    98305: 0.084,
    98310: 0.085,
    98311: 0.09,
    98312: 0.085,
    98314: 0.09,
    98315: 0.09,
    98320: 0.085,
    98321: 0.079,
    98322: 0.09,
    98323: 0.079,
    98324: 0.084,
    98325: 0.09,
    98326: 0.084,
    98327: 0.079,
    98328: 0.079,
    98329: 0.079,
    98330: 0.078,
    98331: 0.084,
    98332: 0.079,
    98333: 0.079,
    98335: 0.079,
    98336: 0.078,
    98337: 0.09,
    98338: 0.079,
    98339: 0.09,
    98340: 0.09,
    98342: 0.09,
    98343: 0.084,
    98344: 0.079,
    98345: 0.09,
    98346: 0.09,
    98348: 0.079,
    98349: 0.079,
    98350: 0.084,
    98351: 0.079,
    98352: 0.093,
    98353: 0.09,
    98354: 0.099,
    98355: 0.078,
    98356: 0.078,
    98357: 0.084,
    98358: 0.09,
    98359: 0.079,
    98360: 0.079,
    98361: 0.078,
    98362: 0.084,
    98363: 0.084,
    98364: 0.09,
    98365: 0.09,
    98366: 0.09,
    98367: 0.09,
    98368: 0.09,
    98370: 0.09,
    98371: 0.099,
    98372: 0.093,
    98373: 0.093,
    98374: 0.093,
    98375: 0.093,
    98376: 0.09,
    98377: 0.078,
    98378: 0.09,
    98380: 0.085,
    98381: 0.084,
    98382: 0.084,
    98383: 0.09,
    98384: 0.09,
    98385: 0.079,
    98386: 0.09,
    98387: 0.079,
    98388: 0.079,
    98390: 0.093,
    98391: 0.079,
    98392: 0.09,
    98393: 0.09,
    98394: 0.079,
    98395: 0.079,
    98396: 0.079,
    98397: 0.079,
    98398: 0.079,
    98401: 0.101,
    98402: 0.099,
    98403: 0.101,
    98404: 0.099,
    98405: 0.093,
    98406: 0.093,
    98407: 0.099,
    98408: 0.099,
    98409: 0.099,
    98411: 0.101,
    98412: 0.101,
    98413: 0.101,
    98415: 0.101,
    98416: 0.101,
    98417: 0.101,
    98418: 0.101,
    98419: 0.101,
    98421: 0.099,
    98422: 0.099,
    98424: 0.099,
    98430: 0.093,
    98431: 0.093,
    98433: 0.093,
    98438: 0.093,
    98439: 0.093,
    98442: 0.093,
    98443: 0.099,
    98444: 0.093,
    98445: 0.093,
    98446: 0.079,
    98447: 0.099,
    98448: 0.099,
    98450: 0.099,
    98455: 0.099,
    98460: 0.099,
    98464: 0.099,
    98465: 0.099,
    98466: 0.099,
    98467: 0.099,
    98471: 0.101,
    98477: 0.101,
    98481: 0.101,
    98490: 0.101,
    98492: 0.101,
    98493: 0.099,
    98496: 0.099,
    98497: 0.099,
    98498: 0.093,
    98499: 0.093,
    98501: 0.079,
    98502: 0.079,
    98503: 0.087,
    98504: 0.088,
    98505: 0.087,
    98506: 0.079,
    98507: 0.088,
    98508: 0.088,
    98509: 0.089,
    98511: 0.089,
    98512: 0.079,
    98513: 0.079,
    98516: 0.079,
    98520: 0.088,
    98522: 0.078,
    98524: 0.085,
    98526: 0.088,
    98527: 0.08,
    98528: 0.079,
    98530: 0.079,
    98531: 0.078,
    98532: 0.078,
    98533: 0.078,
    98535: 0.088,
    98536: 0.088,
    98537: 0.08,
    98538: 0.078,
    98539: 0.078,
    98540: 0.079,
    98541: 0.085,
    98542: 0.078,
    98544: 0.078,
    98546: 0.085,
    98547: 0.08,
    98548: 0.085,
    98550: 0.088,
    98552: 0.088,
    98554: 0.08,
    98555: 0.085,
    98556: 0.079,
    98557: 0.085,
    98558: 0.079,
    98559: 0.088,
    98560: 0.085,
    98561: 0.08,
    98562: 0.088,
    98563: 0.085,
    98564: 0.078,
    98565: 0.078,
    98566: 0.088,
    98568: 0.078,
    98569: 0.088,
    98570: 0.078,
    98571: 0.088,
    98572: 0.078,
    98575: 0.088,
    98576: 0.079,
    98577: 0.08,
    98579: 0.078,
    98580: 0.079,
    98581: 0.078,
    98582: 0.078,
    98583: 0.088,
    98584: 0.085,
    98585: 0.078,
    98586: 0.08,
    98587: 0.088,
    98588: 0.085,
    98589: 0.079,
    98590: 0.08,
    98591: 0.078,
    98592: 0.085,
    98593: 0.078,
    98595: 0.088,
    98596: 0.078,
    98597: 0.079,
    98599: 0.088,
    98601: 0.077,
    98602: 0.07,
    98603: 0.078,
    98604: 0.077,
    98605: 0.07,
    98606: 0.077,
    98607: 0.077,
    98609: 0.078,
    98610: 0.077,
    98611: 0.078,
    98612: 0.076,
    98613: 0.07,
    98614: 0.08,
    98616: 0.078,
    98617: 0.07,
    98619: 0.07,
    98620: 0.07,
    98621: 0.076,
    98622: 0.077,
    98623: 0.07,
    98624: 0.08,
    98625: 0.078,
    98626: 0.078,
    98628: 0.07,
    98629: 0.077,
    98631: 0.08,
    98632: 0.076,
    98635: 0.07,
    98637: 0.08,
    98638: 0.076,
    98639: 0.077,
    98640: 0.08,
    98641: 0.08,
    98642: 0.077,
    98643: 0.076,
    98644: 0.08,
    98645: 0.078,
    98647: 0.076,
    98648: 0.077,
    98649: 0.078,
    98650: 0.07,
    98651: 0.077,
    98660: 0.077,
    98661: 0.084,
    98662: 0.077,
    98663: 0.084,
    98664: 0.084,
    98665: 0.084,
    98666: 0.084,
    98667: 0.084,
    98668: 0.084,
    98670: 0.07,
    98671: 0.077,
    98672: 0.07,
    98673: 0.07,
    98674: 0.077,
    98675: 0.077,
    98682: 0.077,
    98683: 0.084,
    98684: 0.084,
    98685: 0.077,
    98686: 0.077,
    98687: 0.084,
    98801: 0.082,
    98802: 0.082,
    98807: 0.084,
    98811: 0.082,
    98812: 0.078,
    98813: 0.077,
    98814: 0.081,
    98815: 0.082,
    98816: 0.081,
    98817: 0.082,
    98819: 0.081,
    98821: 0.082,
    98822: 0.082,
    98823: 0.078,
    98824: 0.079,
    98826: 0.082,
    98827: 0.081,
    98828: 0.082,
    98829: 0.081,
    98830: 0.077,
    98831: 0.082,
    98832: 0.079,
    98833: 0.081,
    98834: 0.081,
    98836: 0.082,
    98837: 0.079,
    98840: 0.077,
    98841: 0.077,
    98843: 0.078,
    98844: 0.081,
    98845: 0.078,
    98846: 0.081,
    98847: 0.082,
    98848: 0.078,
    98849: 0.081,
    98850: 0.078,
    98851: 0.079,
    98852: 0.082,
    98853: 0.079,
    98855: 0.081,
    98856: 0.081,
    98857: 0.077,
    98858: 0.078,
    98859: 0.081,
    98860: 0.079,
    98862: 0.081,
    98901: 0.079,
    98902: 0.081,
    98903: 0.079,
    98904: 0.079,
    98907: 0.082,
    98908: 0.079,
    98909: 0.081,
    98920: 0.079,
    98921: 0.079,
    98922: 0.08,
    98923: 0.079,
    98925: 0.08,
    98926: 0.08,
    98929: 0.08,
    98930: 0.079,
    98932: 0.079,
    98933: 0.079,
    98934: 0.08,
    98935: 0.07,
    98936: 0.079,
    98937: 0.078,
    98938: 0.079,
    98939: 0.079,
    98940: 0.08,
    98941: 0.08,
    98942: 0.079,
    98943: 0.08,
    98944: 0.079,
    98946: 0.08,
    98947: 0.079,
    98948: 0.079,
    98950: 0.08,
    98951: 0.079,
    98952: 0.079,
    98953: 0.079,
    99001: 0.088,
    99003: 0.081,
    99004: 0.081,
    99005: 0.081,
    99006: 0.076,
    99008: 0.08,
    99009: 0.076,
    99011: 0.088,
    99012: 0.081,
    99013: 0.076,
    99014: 0.088,
    99016: 0.081,
    99017: 0.078,
    99018: 0.081,
    99019: 0.081,
    99020: 0.081,
    99021: 0.081,
    99022: 0.081,
    99023: 0.081,
    99025: 0.081,
    99026: 0.076,
    99027: 0.081,
    99029: 0.08,
    99030: 0.081,
    99031: 0.081,
    99032: 0.077,
    99033: 0.078,
    99034: 0.076,
    99036: 0.081,
    99037: 0.081,
    99039: 0.081,
    99040: 0.076,
    99101: 0.076,
    99102: 0.078,
    99103: 0.079,
    99104: 0.078,
    99105: 0.077,
    99107: 0.077,
    99109: 0.076,
    99110: 0.076,
    99111: 0.078,
    99113: 0.078,
    99114: 0.076,
    99115: 0.078,
    99116: 0.077,
    99117: 0.08,
    99118: 0.077,
    99119: 0.076,
    99121: 0.077,
    99122: 0.076,
    99123: 0.079,
    99124: 0.077,
    99125: 0.077,
    99126: 0.076,
    99128: 0.078,
    99129: 0.076,
    99130: 0.078,
    99131: 0.076,
    99133: 0.078,
    99134: 0.08,
    99135: 0.079,
    99136: 0.078,
    99137: 0.076,
    99138: 0.077,
    99139: 0.076,
    99140: 0.077,
    99141: 0.076,
    99143: 0.078,
    99144: 0.08,
    99146: 0.077,
    99147: 0.08,
    99148: 0.076,
    99149: 0.078,
    99150: 0.077,
    99151: 0.076,
    99152: 0.076,
    99153: 0.076,
    99154: 0.08,
    99155: 0.077,
    99156: 0.076,
    99157: 0.076,
    99158: 0.078,
    99159: 0.077,
    99160: 0.077,
    99161: 0.078,
    99163: 0.078,
    99164: 0.078,
    99165: 0.078,
    99166: 0.077,
    99167: 0.076,
    99169: 0.077,
    99170: 0.078,
    99171: 0.078,
    99173: 0.076,
    99174: 0.078,
    99176: 0.078,
    99179: 0.078,
    99180: 0.076,
    99181: 0.076,
    99185: 0.08,
    99201: 0.088,
    99202: 0.088,
    99203: 0.081,
    99204: 0.088,
    99205: 0.081,
    99206: 0.081,
    99207: 0.088,
    99208: 0.081,
    99209: 0.088,
    99210: 0.088,
    99211: 0.088,
    99212: 0.081,
    99213: 0.088,
    99214: 0.088,
    99215: 0.088,
    99216: 0.081,
    99217: 0.081,
    99218: 0.081,
    99219: 0.088,
    99220: 0.088,
    99223: 0.081,
    99224: 0.081,
    99228: 0.088,
    99251: 0.088,
    99252: 0.088,
    99256: 0.088,
    99258: 0.088,
    99260: 0.088,
    99299: 0.088,
    99301: 0.08,
    99302: 0.086,
    99320: 0.08,
    99321: 0.079,
    99322: 0.07,
    99323: 0.081,
    99324: 0.087,
    99326: 0.077,
    99328: 0.081,
    99329: 0.081,
    99330: 0.08,
    99333: 0.078,
    99335: 0.08,
    99336: 0.08,
    99337: 0.08,
    99338: 0.08,
    99341: 0.077,
    99343: 0.08,
    99344: 0.077,
    99345: 0.08,
    99346: 0.08,
    99347: 0.079,
    99348: 0.081,
    99349: 0.079,
    99350: 0.07,
    99352: 0.08,
    99353: 0.08,
    99354: 0.086,
    99356: 0.07,
    99357: 0.079,
    99359: 0.081,
    99360: 0.081,
    99361: 0.081,
    99362: 0.081,
    99363: 0.081,
    99371: 0.077,
    99401: 0.077,
    99402: 0.077,
    99403: 0.079,
};
//# sourceMappingURL=sales-tax.js.map

/***/ }),

/***/ 451349:
/***/ ((__unused_webpack_module, exports) => {


/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isDedicatedDisk = exports.DISK_NAMES = exports.DedicatedDiskSpeedNames = void 0;
exports.DedicatedDiskSpeedNames = ["standard", "balanced", "ssd"];
exports.DISK_NAMES = {
    standard: "slow",
    balanced: "medium",
    ssd: "fast",
};
function isDedicatedDisk(d) {
    return (d != null &&
        typeof d.size_gb === "number" &&
        ["ssd", "standard", "balanced"].includes(d.type));
}
exports.isDedicatedDisk = isDedicatedDisk;
//# sourceMappingURL=dedicated.js.map

/***/ }),

/***/ 389896:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {


/*
 *  This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.dedicatedVmDisplay = exports.dedicatedDiskDisplay = void 0;
var misc_1 = __webpack_require__(477389);
var dedicated_1 = __webpack_require__(451349);
var dedicated_2 = __webpack_require__(473009);
function dedicatedDiskDisplay(disk, variant) {
    var _a, _b;
    if (variant === void 0) { variant = "long"; }
    if (disk == null)
        throw new Error("dedicated_disk must be defined");
    if (typeof disk === "boolean")
        return "";
    if (variant === "short") {
        return (0, misc_1.to_human_list)([
            "".concat(disk.size_gb, "G"),
            "".concat((_a = dedicated_1.DISK_NAMES[disk.speed]) !== null && _a !== void 0 ? _a : disk.speed),
        ]);
    }
    else {
        var tokens = [
            "".concat(disk.size_gb, "G size"),
            "".concat((_b = dedicated_1.DISK_NAMES[disk.speed]) !== null && _b !== void 0 ? _b : disk.speed, " speed"),
        ];
        if (disk.name != null) {
            tokens.push("named \"".concat(disk.name, "\""));
        }
        return (0, misc_1.to_human_list)(tokens);
    }
}
exports.dedicatedDiskDisplay = dedicatedDiskDisplay;
function dedicatedVmDisplay(v) {
    if (v == null)
        throw Error("dedicated_vm must be defined");
    var vm = dedicated_2.PRICES.vms[v.machine];
    if (vm == null) {
        return "machine '".concat(v.machine, "'");
    }
    return vm.title;
}
exports.dedicatedVmDisplay = dedicatedVmDisplay;
//# sourceMappingURL=utils.js.map

/***/ })

};
;