import { r as registerInstance, h, c as createEvent, H as Host, d as getElement } from './index-67f7ec52.js';
import { O as Option, c as createCommonjsModule, _ as _function } from './Option-53ef163a.js';
import { e as editBenefitQuery, a as editBenefitService, B as BenefitCategories, m as manageBenefitsService, c as matchPath, n as matchesAreEqual } from './manage-benefits.service-aca7df4c.js';
import { a as Subscription } from './scheduleArray-b9669898.js';
import { n as none, e as chain, h as toUndefined, b as fromNullable, i as isNone, m as map, g as getOrElse, c as isSome } from './index-6869168f.js';
import { f as fn } from './api-client-a68152b8.js';
import { a as getOrError } from './index-8f0ba0c8.js';
import { b as benefitsAppQuery } from './benefits-app.query-bfee691f.js';
import { r as roleManagementStore, a as roleManagementService, b as roleManagementQuery } from './role-management.service-a7592363.js';
import { A as ActiveRouter } from './active-router-2beca2cb.js';
import './datorama-akita-d2413fd0.js';
import './delay-d08c267f.js';
import './filter-aeb65cac.js';
import './promise-b835604e.js';
import './benefits.api-806ca0bc.js';

const benefitUrlCss = "ap-ben-benefit-url .blur-backdrop{opacity:0;position:fixed;top:0;left:0;width:100%;height:100%}";

var InputState;
(function (InputState) {
  InputState[InputState["Pristine"] = 0] = "Pristine";
  InputState[InputState["Validated"] = 1] = "Validated";
})(InputState || (InputState = {}));
var UiState;
(function (UiState) {
  UiState[UiState["Collapsed"] = 0] = "Collapsed";
  UiState[UiState["Editing"] = 1] = "Editing";
})(UiState || (UiState = {}));
const BenefitUrl = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.benefitUrl = Option.none;
    this.uiState = UiState.Collapsed;
    this.inputState = InputState.Pristine;
    this.storeSubscription = new Subscription();
    this.absoluteUrlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
    this.relativeUrlRegex = /^\/\S+/;
    this.httpSchemeRegex = /^https?:\/\//i;
  }
  componentWillLoad() {
    this.storeSubscription.add(editBenefitQuery.draftBenefitUrl$.subscribe((url) => {
      this.benefitUrl = url;
    }));
  }
  disconnectedCallback() {
    this.storeSubscription.unsubscribe();
  }
  render() {
    return this.uiState === UiState.Editing ? this.renderInProgress() : this.renderEmptyState();
  }
  renderEmptyState() {
    return (h("div", { class: "row mb-2" }, h("div", { class: "col-12 d-flex" }, h("button", { type: "button", class: "uiid-benefit-urllink btn btn-light border flex-fill d-flex align-items-center rounded p-0 w-100", onClick: (_) => {
        this.uiState = UiState.Editing;
      } }, Option.isSome(this.benefitUrl) ? (h("ap-ben-icon", { class: "weblink-icon m-4", iconPrefix: "fas", iconId: "globe" })) : (h("ap-ben-icon", { class: "text-muted m-4", iconPrefix: "fal", iconId: "link" })), h("div", { class: "d-flex flex-column text-left overflow-hidden" }, h("span", null, Option.isSome(this.benefitUrl) ? 'Weblink' : 'Add weblink'), h("small", { class: "text-muted text-truncate w-100" }, Option.isSome(this.benefitUrl)
      ? Option.toUndefined(this.benefitUrl)
      : 'Add a web URL to supporting material')), h("button", { class: "btn ml-auto px-3", type: "button", hidden: Option.isNone(this.benefitUrl), onClick: (event) => this.clear(event) }, h("ap-ben-icon", { iconPrefix: "fal", iconId: "trash" }))))));
  }
  renderInProgress() {
    return (h("div", { class: "row mb-2 no-gutters border rounded" }, h("div", { class: "blur-backdrop", onClick: (_) => {
        this.uiState = UiState.Collapsed;
      } }), h("div", { class: `col-12 p-3 ${this.inputState === InputState.Validated ? 'was-validated' : ''}` }, h("div", { class: "row" }, h("div", { class: "col-12 d-flex" }, h("div", { class: "d-flex flex-column flex-fill" }, h("input", { type: "text", class: "uiid-enter-benefit-urllink form-control d-inline", name: "benefitUrl", value: Option.toUndefined(this.benefitUrl), required: true, onInput: (_) => this.onBenefitUrlInput(), ref: (element) => (this.inputElement = element), placeholder: "https://www.example.com" }), h("div", { class: "invalid-feedback" }, "Please provide a valid URL for your benefit.")), h("button", { type: "button", class: "uiid-verify-benefit-urllink btn btn-primary ml-2 d-inline align-self-start", onClick: (_) => {
        this.submit();
      } }, h("ap-ben-icon", { iconPrefix: "fal", iconId: "check" })))))));
  }
  getUrlRegex(url) {
    if (this.relativeUrlRegex.test(url)) {
      return this.relativeUrlRegex;
    }
    return this.absoluteUrlRegex;
  }
  formatUrl(unformattedUrl) {
    if (unformattedUrl === '') {
      return '';
    }
    if (unformattedUrl[0] === '/') {
      return unformattedUrl;
    }
    if (this.httpSchemeRegex.test(unformattedUrl)) {
      return unformattedUrl;
    }
    try {
      return new URL(`https://${unformattedUrl}`).href;
    }
    catch (_a) {
      return unformattedUrl;
    }
  }
  onBenefitUrlInput() {
    const currentValue = this.inputElement.value.trim();
    this.inputElement.pattern = this.getUrlRegex(currentValue).source;
  }
  submit() {
    const benefitUrl = this.inputElement.value.trim();
    const formattedUrl = this.formatUrl(benefitUrl);
    this.inputElement.value = formattedUrl;
    this.inputElement.pattern = this.getUrlRegex(formattedUrl).source;
    this.inputState = InputState.Validated;
    if (this.inputElement.checkValidity() && formattedUrl !== '') {
      this.uiState = UiState.Collapsed;
      editBenefitService.updateDraftUrl(formattedUrl);
    }
    else {
      this.inputElement.focus();
    }
  }
  clear(event) {
    event.stopPropagation();
    this.inputState = InputState.Pristine;
    editBenefitService.clearDraftUrl();
  }
};
BenefitUrl.style = benefitUrlCss;

var pipeable_1 = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.pipe = exports.pipeable = void 0;

var isFunctor = function (I) { return typeof I.map === 'function'; };
var isContravariant = function (I) { return typeof I.contramap === 'function'; };
var isFunctorWithIndex = function (I) { return typeof I.mapWithIndex === 'function'; };
var isApply = function (I) { return typeof I.ap === 'function'; };
var isChain = function (I) { return typeof I.chain === 'function'; };
var isBifunctor = function (I) { return typeof I.bimap === 'function'; };
var isExtend = function (I) { return typeof I.extend === 'function'; };
var isFoldable = function (I) { return typeof I.reduce === 'function'; };
var isFoldableWithIndex = function (I) { return typeof I.reduceWithIndex === 'function'; };
var isAlt = function (I) { return typeof I.alt === 'function'; };
var isCompactable = function (I) { return typeof I.compact === 'function'; };
var isFilterable = function (I) { return typeof I.filter === 'function'; };
var isFilterableWithIndex = function (I) {
    return typeof I.filterWithIndex === 'function';
};
var isProfunctor = function (I) { return typeof I.promap === 'function'; };
var isSemigroupoid = function (I) { return typeof I.compose === 'function'; };
var isMonadThrow = function (I) { return typeof I.throwError === 'function'; };
/** @deprecated */
function pipeable(I) {
    var r = {};
    if (isFunctor(I)) {
        var map = function (f) { return function (fa) { return I.map(fa, f); }; };
        r.map = map;
    }
    if (isContravariant(I)) {
        var contramap = function (f) { return function (fa) { return I.contramap(fa, f); }; };
        r.contramap = contramap;
    }
    if (isFunctorWithIndex(I)) {
        var mapWithIndex = function (f) { return function (fa) { return I.mapWithIndex(fa, f); }; };
        r.mapWithIndex = mapWithIndex;
    }
    if (isApply(I)) {
        var ap = function (fa) { return function (fab) { return I.ap(fab, fa); }; };
        var apFirst = function (fb) { return function (fa) {
            return I.ap(I.map(fa, function (a) { return function () { return a; }; }), fb);
        }; };
        r.ap = ap;
        r.apFirst = apFirst;
        r.apSecond = function (fb) { return function (fa) {
            return I.ap(I.map(fa, function () { return function (b) { return b; }; }), fb);
        }; };
    }
    if (isChain(I)) {
        var chain = function (f) { return function (ma) { return I.chain(ma, f); }; };
        var chainFirst = function (f) { return function (ma) { return I.chain(ma, function (a) { return I.map(f(a), function () { return a; }); }); }; };
        var flatten = function (mma) { return I.chain(mma, _function.identity); };
        r.chain = chain;
        r.chainFirst = chainFirst;
        r.flatten = flatten;
    }
    if (isBifunctor(I)) {
        var bimap = function (f, g) { return function (fa) { return I.bimap(fa, f, g); }; };
        var mapLeft = function (f) { return function (fa) { return I.mapLeft(fa, f); }; };
        r.bimap = bimap;
        r.mapLeft = mapLeft;
    }
    if (isExtend(I)) {
        var extend = function (f) { return function (wa) { return I.extend(wa, f); }; };
        var duplicate = function (wa) { return I.extend(wa, _function.identity); };
        r.extend = extend;
        r.duplicate = duplicate;
    }
    if (isFoldable(I)) {
        var reduce = function (b, f) { return function (fa) { return I.reduce(fa, b, f); }; };
        var foldMap = function (M) {
            var foldMapM = I.foldMap(M);
            return function (f) { return function (fa) { return foldMapM(fa, f); }; };
        };
        var reduceRight = function (b, f) { return function (fa) { return I.reduceRight(fa, b, f); }; };
        r.reduce = reduce;
        r.foldMap = foldMap;
        r.reduceRight = reduceRight;
    }
    if (isFoldableWithIndex(I)) {
        var reduceWithIndex = function (b, f) { return function (fa) {
            return I.reduceWithIndex(fa, b, f);
        }; };
        var foldMapWithIndex = function (M) {
            var foldMapM = I.foldMapWithIndex(M);
            return function (f) { return function (fa) { return foldMapM(fa, f); }; };
        };
        var reduceRightWithIndex = function (b, f) { return function (fa) {
            return I.reduceRightWithIndex(fa, b, f);
        }; };
        r.reduceWithIndex = reduceWithIndex;
        r.foldMapWithIndex = foldMapWithIndex;
        r.reduceRightWithIndex = reduceRightWithIndex;
    }
    if (isAlt(I)) {
        var alt = function (that) { return function (fa) { return I.alt(fa, that); }; };
        r.alt = alt;
    }
    if (isCompactable(I)) {
        r.compact = I.compact;
        r.separate = I.separate;
    }
    if (isFilterable(I)) {
        var filter = function (predicate) { return function (fa) {
            return I.filter(fa, predicate);
        }; };
        var filterMap = function (f) { return function (fa) { return I.filterMap(fa, f); }; };
        var partition = function (predicate) { return function (fa) {
            return I.partition(fa, predicate);
        }; };
        var partitionMap = function (f) { return function (fa) { return I.partitionMap(fa, f); }; };
        r.filter = filter;
        r.filterMap = filterMap;
        r.partition = partition;
        r.partitionMap = partitionMap;
    }
    if (isFilterableWithIndex(I)) {
        var filterWithIndex = function (predicateWithIndex) { return function (fa) { return I.filterWithIndex(fa, predicateWithIndex); }; };
        var filterMapWithIndex = function (f) { return function (fa) {
            return I.filterMapWithIndex(fa, f);
        }; };
        var partitionWithIndex = function (predicateWithIndex) { return function (fa) { return I.partitionWithIndex(fa, predicateWithIndex); }; };
        var partitionMapWithIndex = function (f) { return function (fa) {
            return I.partitionMapWithIndex(fa, f);
        }; };
        r.filterWithIndex = filterWithIndex;
        r.filterMapWithIndex = filterMapWithIndex;
        r.partitionWithIndex = partitionWithIndex;
        r.partitionMapWithIndex = partitionMapWithIndex;
    }
    if (isProfunctor(I)) {
        var promap = function (f, g) { return function (fa) { return I.promap(fa, f, g); }; };
        r.promap = promap;
    }
    if (isSemigroupoid(I)) {
        var compose = function (that) { return function (fa) { return I.compose(fa, that); }; };
        r.compose = compose;
    }
    if (isMonadThrow(I)) {
        var fromOption = function (onNone) { return function (ma) {
            return ma._tag === 'None' ? I.throwError(onNone()) : I.of(ma.value);
        }; };
        var fromEither = function (ma) {
            return ma._tag === 'Left' ? I.throwError(ma.left) : I.of(ma.right);
        };
        var fromPredicate = function (predicate, onFalse) { return function (a) { return (predicate(a) ? I.of(a) : I.throwError(onFalse(a))); }; };
        var filterOrElse = function (predicate, onFalse) { return function (ma) { return I.chain(ma, function (a) { return (predicate(a) ? I.of(a) : I.throwError(onFalse(a))); }); }; };
        r.fromOption = fromOption;
        r.fromEither = fromEither;
        r.fromPredicate = fromPredicate;
        r.filterOrElse = filterOrElse;
    }
    return r;
}
exports.pipeable = pipeable;
/**
 * Use [`pipe`](https://gcanti.github.io/fp-ts/modules/function.ts.html#flow) from `function` module instead.
 *
 * @since 2.0.0
 * @deprecated
 */
exports.pipe = _function.pipe;
});

const EditBenefitForm = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.isValidationDisplayed = false;
    this.disabled = false;
    this.draftBenefit = none;
    this.stateSubscription = new Subscription();
    this.nonWhitespaceRegex = /.*\S+.*/;
  }
  componentWillLoad() {
    this.stateSubscription.add(editBenefitQuery.draftBenefit$.subscribe((draftBenefit) => (this.draftBenefit = draftBenefit)));
  }
  disconnectedCallback() {
    this.stateSubscription.unsubscribe();
  }
  render() {
    return (h("form", { class: "needs-validation", novalidate: "true", ref: (element) => (this.benefitForm = element) }, h("fieldset", { disabled: this.disabled }, h("div", { class: "row" }, h("div", { class: "col-12 col-sm-4 mb-1" }, h("span", { class: "d-block" }, "Icon")), h("div", { class: "col-12 col-sm-8" }, h("ap-ben-upload-benefit-icon", null))), h("div", { class: "row my-4" }, h("div", { class: "col-12 col-sm-4 mb-1" }, h("span", null, "Title", h("abbr", { title: "Required", class: "text-danger text-decoration-none" }, "*"))), h("div", { class: `col-12 col-sm-8 ${this.isValidationDisplayed ? 'was-validated' : ''}` }, h("input", { type: "text", name: "benefitTitle", value: pipeable_1.pipe(this.draftBenefit, chain((b) => b.title), toUndefined), required: true, class: "uiid-benefit-title form-control fl-hide-valid-style", maxLength: 40, onInput: (event) => {
        const newValue = event.target.value;
        this.updateDraftBenefit((draft) => {
          draft.title = fromNullable(newValue);
        });
      }, pattern: this.nonWhitespaceRegex.source }), h("span", { class: "invalid-feedback" }, "Please provide a name for your benefit."))), h("div", { class: "row my-4" }, h("div", { class: "col-12 col-sm-4 mb-1" }, h("span", null, "Subtitle")), h("div", { class: "col-12 col-sm-8" }, h("input", { type: "text", name: "benefitValue", value: pipeable_1.pipe(this.draftBenefit, chain((b) => b.subtitle), toUndefined), class: "uiid-benefit-highlight form-control fl-hide-valid-style", maxLength: 40, onInput: (event) => {
        const newValue = event.target.value;
        this.updateDraftBenefit((draft) => {
          draft.subtitle = fromNullable(newValue);
        });
      } }), h("small", { class: "text-muted" }, "Highlight phone numbers, dates or potential savings"))), h("div", { class: "row my-4" }, h("div", { class: "col-12 col-sm-4 mb-1" }, h("span", null, "Description")), h("div", { class: "col-12 col-sm-8" }, h("textarea", { name: "benefitDescription", value: pipeable_1.pipe(this.draftBenefit, chain((b) => b.description), toUndefined), class: "uiid-benefit-description form-control fl-hide-valid-style", placeholder: "Join the team in the park for 30 minutes", maxLength: 400, rows: 4, onInput: (event) => {
        const newValue = event.target.value;
        this.updateDraftBenefit((draft) => {
          draft.description = fromNullable(newValue);
        });
      } }))), h("div", { class: "row my-4" }, h("div", { class: "col-12 col-sm-4 mb-1" }, h("span", null, "Category", h("abbr", { title: "Required", class: "text-danger text-decoration-none" }, "*"))), h("div", { class: `col-12 col-sm-4 ${this.isValidationDisplayed ? 'was-validated' : ''}` }, h("select", { name: "benefitCategory", class: "uiid-benefit-category form-control fl-hide-valid-style", required: true, onInput: (event) => {
        const newValue = event.target.value;
        this.updateDraftBenefit((draft) => {
          draft.category = fromNullable(newValue);
        });
      } }, h("option", { value: "", label: "Select...", selected: pipeable_1.pipe(this.draftBenefit, chain((b) => b.category), isNone), disabled: true, hidden: true }), BenefitCategories.map((category) => (h("option", { value: category, selected: pipeable_1.pipe(this.draftBenefit, chain((b) => b.category), toUndefined) === category }, category)))), h("span", { class: "invalid-feedback" }, "Please choose a category for your benefit."))), h("div", { class: "row mt-4" }, h("div", { class: "col-12 col-sm-4 mb-1" }, "Additional information"), h("div", { class: "col-12 col-sm-8 mb-3" }, h("ap-ben-benefit-url", null), h("ap-ben-upload-file", null))))));
  }
  updateDraftBenefit(producer) {
    if (isNone(this.draftBenefit))
      return;
    let updatedDraft = fn(this.draftBenefit.value, producer);
    updatedDraft = fn(updatedDraft, (draft) => {
      draft.isValid = this.benefitForm.checkValidity();
      draft.isDirty = true;
    });
    editBenefitService.updateDraftBenefit(updatedDraft);
  }
};

const EmptyBenefits = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.newBenefitButtonClicked = createEvent(this, "newBenefitButtonClicked", 7);
  }
  render() {
    return (h(Host, { class: "d-flex flex-column justify-content-center benefits-zero-state p-4 border-top" }, h("div", { class: "text-center my-5" }, h("ap-ben-icon", { class: "text-success fa-4x", iconPrefix: "fad", iconId: "handshake-alt" }), h("ap-ben-icon", { class: "text-success fa-4x px-3", iconPrefix: "fad", iconId: "heartbeat" }), h("ap-ben-icon", { class: "text-success fa-4x", iconPrefix: "fad", iconId: "car" })), h("div", { class: "text-center mb-3" }, h("h5", null, "Attract and retain a healthy, productive workforce."), h("p", { class: "uiid-noactive-benefit-item text-muted my-1" }, "Begin by building out your employee benefits offering.")), h("fl-button", { class: "mb-5 align-self-center", onClick: (_) => {
        var _a;
        (_a = this.newBenefitButtonClicked) === null || _a === void 0 ? void 0 : _a.emit();
      } }, h("ap-ben-icon", { class: "mr-2", iconPrefix: "far", iconId: "plus" }), "New benefit")));
  }
};

const fileIconCss = ".file-icon-red-dark{color:#db424d}.file-icon-blue{color:#2985d2}.file-icon-green{color:#12aa7c}.file-icon-purple{color:purple}";

const FileIcon = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.defaultIconStyle = 'text-muted';
    this.fileTypeToIconStyleMapping = [
      { fileType: 'pdf', iconStyle: 'file-icon-red-dark' },
      { fileType: 'word', iconStyle: 'file-icon-blue' },
      { fileType: 'powerpoint', iconStyle: 'file-icon-purple' }
    ];
    this.fileTypeToFontawesomeMapping = [
      { fileType: 'pdf', iconName: 'file-pdf' },
      { fileType: 'word', iconName: 'file-word' },
      { fileType: 'powerpoint', iconName: 'file-powerpoint' }
    ];
    this.getFontawesomeStyleFromFileType = (fileType) => {
      const result = this.fileTypeToFontawesomeMapping.find((mapping) => mapping.fileType === fileType);
      return result ? result.iconName : 'file-alt';
    };
  }
  render() {
    const weight = this.isEmpty ? 'fal' : 'fas';
    const colour = this.isEmpty
      ? this.defaultIconStyle
      : this.getIconStyleFromFileType(this.fileType);
    return (h("ap-ben-icon", { iconPrefix: weight, iconId: this.getFontawesomeStyleFromFileType(this.fileType), class: colour }));
  }
  getIconStyleFromFileType(fileType) {
    const result = this.fileTypeToIconStyleMapping.find((mapping) => mapping.fileType === fileType);
    if (result) {
      return result.iconStyle;
    }
    else {
      return this.defaultIconStyle;
    }
  }
};
FileIcon.style = fileIconCss;

const ManageBenefitsHeaderRow = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  render() {
    return (h(Host, null, h("div", { class: "row border-top bg-light font-weight-bold p-3 no-gutters" }, h("small", { class: "text-muted col-5 col-lg-6" }, h("strong", null, "Title")), h("small", { class: "text-muted col-2 d-none d-md-block" }, "Category"), h("small", { class: "text-muted col-2 d-none d-md-block" }, "Last modified"), h("small", { class: "text-muted col-3 col-lg-2 d-none d-md-block" }, "Status"))));
  }
};

const managedBenefitItemCss = "ap-ben-managed-benefit-item>div:first-child:hover{cursor:pointer;background-color:rgba(173, 173, 173, 0.05)}ap-ben-managed-benefit-item .flb-opacity-onhover{opacity:0.75}ap-ben-managed-benefit-item .flb-opacity-onhover:hover{opacity:1}";

const ManagedBenefitItem = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.editBenefitButtonClicked = createEvent(this, "editBenefitButtonClicked", 7);
  }
  render() {
    return (h("div", { class: "border-top py-3 px-3 row d-flex align-items-center no-gutters", onClick: () => this.onBenefitClick() }, h("div", { class: "col-12 col-md-5 col-lg-6" }, h("span", { class: {
        'm-0 text-truncate': true,
        'text-muted': !this.benefit.visibility.isEnabled
      } }, this.benefit.title)), h("div", { class: "col-12 col-md-2 text-muted text-truncate" }, this.benefit.category), h("div", { class: "col-12 col-md-2 text-muted text-truncate" }, this.formatDate(this.benefit.lastModifiedDate)), h("div", { class: "col-12 col-md-3 col-lg-2 mt-4 mt-md-0 text-right" }, this.benefit.visibility.isEnabled ? (h("fl-promise-button", { class: "uiid-deactivate-benefit-item", isBlockElement: true, variant: "secondary", onClick: (event) => {
        event.stopPropagation();
      }, promiseFn: () => this.onSetInactive() }, h("h6", { class: "my-0" }, "Deactivate"))) : (h("fl-promise-button", { class: "uiid-activate-benefit-item", isBlockElement: true, variant: "secondary", onClick: (event) => {
        event.stopPropagation();
      }, promiseFn: () => this.onSetActive() }, h("h6", { class: "my-0" }, "Activate"))))));
  }
  onBenefitClick() {
    this.editBenefitButtonClicked.emit(this.benefit);
  }
  async onSetActive() {
    await manageBenefitsService.enableBenefitAsync(this.benefit.id);
  }
  async onSetInactive() {
    await manageBenefitsService.disableBenefitAsync(this.benefit.id);
  }
  formatDate(dateString) {
    return pipeable_1.pipe(dateString, map((dateStringOption) => new Date(dateStringOption).toLocaleDateString('en-AU', {
      day: 'numeric',
      month: 'short',
      year: 'numeric'
    })), getOrElse(() => ''));
  }
};
ManagedBenefitItem.style = managedBenefitItemCss;

const RoleManagementPage = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.showRemoveConfirmDialog = false;
    this.storeSubscription = new Subscription();
  }
  async componentWillLoad() {
    roleManagementStore.reset();
    this.storeSubscription.add(benefitsAppQuery.signedInUser$.subscribe((user) => {
      this.user = getOrError(user);
    }));
    await roleManagementService.getEditorProfiles();
    this.storeSubscription.add(roleManagementQuery.showRemoveEditorDialog$.subscribe((state) => (this.showRemoveConfirmDialog = state)));
  }
  disconnectedCallback() {
    this.storeSubscription.unsubscribe();
  }
  render() {
    return (h(Host, { class: "w-100" }, h("ap-ben-ui-container", { class: "w-100 d-none py-5" }, h("div", { class: "d-flex align-items-start flex-column" }, h("h3", null, "Access Management"), h("div", { class: "mt-3" }, h("h4", null, "Permissions")), h("div", null, "Manage which staff has permission to edit and manage benefits.")), h("div", { class: "mt-4" }, h("ap-ben-role-owner-section", { owner: this.user })), h("div", { class: "mt-4" }, h("ap-ben-role-editors-section", null))), this.renderRemoveConfirmDialog()));
  }
  renderRemoveConfirmDialog() {
    return (h("ap-ben-modal-section", { show: this.showRemoveConfirmDialog, showHeader: true, modalTitle: "Remove editor", onModalClosed: (_) => roleManagementStore.showRemoveEditorDialog(false) }, h("ap-ben-confirm-dialog", { acceptText: "Remove", declineText: "Cancel", dialogStyle: "danger", onAccepted: (_) => roleManagementService.removeSelectedEditor(), onDeclined: (_) => roleManagementStore.showRemoveEditorDialog(false) }, h("p", null, h("b", null, "Are you sure you want to remove this person?")), h("p", null, "If you proceed, this person will not be able to edit or manage benefits anymore."))));
  }
};

const uploadBenefitIconCss = "ap-ben-upload-benefit-icon .flb-icon-container{height:4rem;width:4rem;color:#1865bf;background:#c0e1fd;border:1px dashed #2985d2}ap-ben-upload-benefit-icon .flb-icon-container.error-state{color:#db424d;background:#f8d3d6;border:1px dashed #e2505c}ap-ben-upload-benefit-icon .flb-icon-container .flb-icon{max-width:100%;max-height:100%}ap-ben-upload-benefit-icon .flb-icon-container .btn-icon-delete{position:absolute;opacity:0.7;display:none}ap-ben-upload-benefit-icon .flb-icon-container:hover .btn-icon-delete{display:-ms-flexbox;display:flex}";

var UploadIconState;
(function (UploadIconState) {
  UploadIconState[UploadIconState["Empty"] = 0] = "Empty";
  UploadIconState[UploadIconState["UploadPending"] = 1] = "UploadPending";
  UploadIconState[UploadIconState["Uploaded"] = 2] = "Uploaded";
  UploadIconState[UploadIconState["Error"] = 3] = "Error";
})(UploadIconState || (UploadIconState = {}));
const UploadBenefitIcon = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.customIcon = none;
    this.uploadIconState = UploadIconState.Empty;
    this.storeSubscription = new Subscription();
    this.allowedMimetypes = ['image/png', 'image/jpeg', 'image/gif'];
  }
  componentWillLoad() {
    this.storeSubscription.add(editBenefitQuery.draftBenefitIcon$.subscribe((icon) => {
      this.customIcon = icon;
      this.uploadIconState = isSome(icon) ? UploadIconState.Uploaded : UploadIconState.Empty;
    }));
  }
  disconnectedCallback() {
    this.storeSubscription.unsubscribe();
  }
  render() {
    switch (this.uploadIconState) {
      case UploadIconState.Empty:
      case UploadIconState.Error:
        return this.renderEmptyOrErrorState();
      case UploadIconState.UploadPending:
        return this.renderUploadPending();
      case UploadIconState.Uploaded:
        return this.renderIconUploaded();
    }
  }
  mapState() {
    return editBenefitQuery.draftBenefitIcon$.subscribe((icon) => {
      this.customIcon = icon;
    });
  }
  renderEmptyOrErrorState() {
    return (h("div", { class: "d-flex align-items-center" }, h("button", { type: "button", class: `flb-icon-container flb-btn-file rounded mr-4 ` +
        (this.uploadIconState === UploadIconState.Error ? 'error-state' : '') }, this.uploadIconState === UploadIconState.Empty && (h("ap-ben-icon", { iconPrefix: "fal", iconId: "upload" })), this.uploadIconState === UploadIconState.Error && (h("ap-ben-icon", { iconPrefix: "fal", iconId: "exclamation-triangle" })), h("input", { class: "uiid-benefit-image", type: "file", accept: this.allowedMimetypes.join(', '), onChange: (fileInputEvent) => this.onIconUpload(fileInputEvent) })), h("div", null, h("h6", { class: "m-0" }, "Upload image"), this.uploadIconState === UploadIconState.Empty && (h("small", { class: "text-muted" }, "Max file size 1 MB")), this.uploadIconState === UploadIconState.Error && (h("small", { class: "text-danger" }, "Invalid file format or 1 MB size limit exceeded. Try again.")))));
  }
  renderUploadPending() {
    return (h("div", { class: "flb-icon-container rounded p-3 d-flex justify-content-center align-items-center" }, h("ap-ben-icon", { iconPrefix: "fal", iconId: "spinner-third", spin: true, class: "fa-2x" })));
  }
  renderIconUploaded() {
    return (h("div", { class: "flb-icon-container bg-white position-relative d-flex justify-content-center align-items-center border rounded" }, h("img", { src: getOrError(this.customIcon).downloadUrl, class: "flb-icon" }), h("button", { class: "btn btn-dark btn-icon-delete flex-column justify-content-center align-items-center h-100", type: "button", onClick: (_) => this.clearIcon() }, h("i", { class: "fal fa-trash" }), h("small", null, "Delete"))));
  }
  async onIconUpload(fileInputEvent) {
    fileInputEvent.preventDefault();
    const files = fileInputEvent.target.files;
    if (!files) {
      return;
    }
    const file = files.item(0);
    if (!file) {
      return;
    }
    this.uploadIconState = UploadIconState.UploadPending;
    try {
      await editBenefitService.uploadIconAsync(file);
      this.uploadIconState = UploadIconState.Uploaded;
    }
    catch (_a) {
      this.uploadIconState = UploadIconState.Error;
    }
  }
  clearIcon() {
    editBenefitService.clearIcon();
  }
};
UploadBenefitIcon.style = uploadBenefitIconCss;

/**
 * @param typeMap [Object] Map of MIME type -> Array[extensions]
 * @param ...
 */
function Mime() {
  this._types = Object.create(null);
  this._extensions = Object.create(null);

  for (let i = 0; i < arguments.length; i++) {
    this.define(arguments[i]);
  }

  this.define = this.define.bind(this);
  this.getType = this.getType.bind(this);
  this.getExtension = this.getExtension.bind(this);
}

/**
 * Define mimetype -> extension mappings.  Each key is a mime-type that maps
 * to an array of extensions associated with the type.  The first extension is
 * used as the default extension for the type.
 *
 * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
 *
 * If a type declares an extension that has already been defined, an error will
 * be thrown.  To suppress this error and force the extension to be associated
 * with the new type, pass `force`=true.  Alternatively, you may prefix the
 * extension with "*" to map the type to extension, without mapping the
 * extension to the type.
 *
 * e.g. mime.define({'audio/wav', ['wav']}, {'audio/x-wav', ['*wav']});
 *
 *
 * @param map (Object) type definitions
 * @param force (Boolean) if true, force overriding of existing definitions
 */
Mime.prototype.define = function(typeMap, force) {
  for (let type in typeMap) {
    let extensions = typeMap[type].map(function(t) {
      return t.toLowerCase();
    });
    type = type.toLowerCase();

    for (let i = 0; i < extensions.length; i++) {
      const ext = extensions[i];

      // '*' prefix = not the preferred type for this extension.  So fixup the
      // extension, and skip it.
      if (ext[0] === '*') {
        continue;
      }

      if (!force && (ext in this._types)) {
        throw new Error(
          'Attempt to change mapping for "' + ext +
          '" extension from "' + this._types[ext] + '" to "' + type +
          '". Pass `force=true` to allow this, otherwise remove "' + ext +
          '" from the list of extensions for "' + type + '".'
        );
      }

      this._types[ext] = type;
    }

    // Use first extension as default
    if (force || !this._extensions[type]) {
      const ext = extensions[0];
      this._extensions[type] = (ext[0] !== '*') ? ext : ext.substr(1);
    }
  }
};

/**
 * Lookup a mime type based on extension
 */
Mime.prototype.getType = function(path) {
  path = String(path);
  let last = path.replace(/^.*[/\\]/, '').toLowerCase();
  let ext = last.replace(/^.*\./, '').toLowerCase();

  let hasPath = last.length < path.length;
  let hasDot = ext.length < last.length - 1;

  return (hasDot || !hasPath) && this._types[ext] || null;
};

/**
 * Return file extension associated with a mime type
 */
Mime.prototype.getExtension = function(type) {
  type = /^\s*([^;\s]*)/.test(type) && RegExp.$1;
  return type && this._extensions[type.toLowerCase()] || null;
};

var Mime_1 = Mime;

var standard = {"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma","es"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/mrb-consumer+xml":["*xdf"],"application/mrb-publish+xml":["*xdf"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["*xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-error+xml":["xer"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};

var other = {"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};

var mime = new Mime_1(standard, other);

const uploadFileCss = ".flb-btn-file{position:relative;overflow:hidden !important}.flb-btn-file input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;font-size:100px;text-align:right;filter:alpha(opacity=0);opacity:0;outline:none;cursor:inherit;display:block}";

var UploadFileState;
(function (UploadFileState) {
  UploadFileState[UploadFileState["Empty"] = 0] = "Empty";
  UploadFileState[UploadFileState["UploadPending"] = 1] = "UploadPending";
  UploadFileState[UploadFileState["Attached"] = 2] = "Attached";
})(UploadFileState || (UploadFileState = {}));
const UploadFile = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.uploadedFile = Option.none;
    this.uploadFileState = UploadFileState.Empty;
    this.isUploadError = false;
    this.stateSubscription = new Subscription();
    this.allowedMimetypes = [
      'application/pdf',
      'application/msword',
      'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
      'application/vnd.ms-powerpoint',
      'application/vnd.openxmlformats-officedocument.presentationml.presentation'
    ];
  }
  componentWillLoad() {
    this.stateSubscription.add(editBenefitQuery.draftBenefitAttachment$.subscribe((attachment) => {
      this.uploadedFile = attachment;
      this.uploadFileState = Option.isSome(attachment)
        ? UploadFileState.Attached
        : UploadFileState.Empty;
    }));
  }
  disconnectedCallback() {
    this.stateSubscription.unsubscribe();
  }
  render() {
    return (h(Host, null, h("div", { class: "row border rounded bg-light no-gutters" }, h("div", { class: "col-12 d-flex" }, this.renderUploadState())), this.isUploadError && (h("div", null, h("small", { class: "text-danger" }, "File format is invalid, or the file is larger than 10 MB. Try again.")))));
  }
  renderUploadState() {
    switch (this.uploadFileState) {
      case UploadFileState.Empty:
        return this.renderEmptyOrErrorState();
      case UploadFileState.UploadPending:
        return this.renderUploadPending();
      case UploadFileState.Attached:
        return this.renderAttachedDocument();
    }
  }
  renderEmptyOrErrorState() {
    return (h("button", { type: "button", class: "uiid-new-benefit-document btn btn-light flb-btn-file p-0 flex-fill d-flex align-items-center" }, h("span", { class: "m-4" }, h("ap-ben-file-icon", { fileType: 'pdf', isEmpty: true })), h("div", { class: "d-flex flex-column align-items-start text-left" }, h("span", null, "Add document"), h("small", { class: "text-muted text-wrap" }, "Word, Powerpoint and PDF (Max file size 10MB)")), h("input", { class: "uiid-benefit-document", type: "file", accept: this.allowedMimetypes.join(', '), onChange: (uploadEvent) => this.onDocumentUpload(uploadEvent) })));
  }
  renderUploadPending() {
    return (h("div", { class: "rounded bg-light d-flex justify-content-center align-items-center" }, h("span", { class: "m-4" }, h("ap-ben-icon", { iconPrefix: "fal", iconId: "spinner-third", spin: true })), h("div", { class: "d-flex flex-column align-items-start" }, h("span", null, "Document"), h("small", { class: "text-muted" }, "Please wait while your document is uploading"))));
  }
  renderAttachedDocument() {
    return (h("div", { class: "rounded bg-light d-flex align-items-center flex-fill" }, h("span", { class: "m-4" }, h("ap-ben-file-icon", { fileType: getOrError(this.uploadedFile).documentFormat })), h("div", { class: "d-flex flex-column align-items-start" }, h("span", null, "Document"), h("small", { class: "text-muted" }, getOrError(this.uploadedFile).title)), h("button", { class: "btn ml-auto px-3", type: "button", onClick: (_) => this.onClearDocument() }, h("ap-ben-icon", { iconPrefix: "fal", iconId: "trash" }))));
  }
  async onDocumentUpload(uploadEvent) {
    uploadEvent.preventDefault();
    this.isUploadError = false;
    const files = uploadEvent.target.files;
    if (!files) {
      return;
    }
    const file = files.item(0);
    if (!file) {
      return;
    }
    if (!this.isFileValid(file)) {
      this.isUploadError = true;
      return;
    }
    this.uploadFileState = UploadFileState.UploadPending;
    await editBenefitService.uploadAttachmentAsync(file);
  }
  isFileValid(file) {
    return (this.allowedMimetypes.some((mimeType) => mimeType === mime.getType(file.name)) &&
      file.size <= 10485760);
  }
  onClearDocument() {
    editBenefitService.clearAttachment();
  }
};
UploadFile.style = uploadFileCss;

const routeCss = "stencil-route.inactive{display:none}";

const Route = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.group = null;
    this.match = null;
    this.componentProps = {};
    this.exact = false;
    this.scrollOnNextRender = false;
    this.previousMatch = null;
  }
  // Identify if the current route is a match.
  computeMatch(newLocation) {
    const isGrouped = this.group != null || (this.el.parentElement != null && this.el.parentElement.tagName.toLowerCase() === 'stencil-route-switch');
    if (!newLocation || isGrouped) {
      return;
    }
    this.previousMatch = this.match;
    return this.match = matchPath(newLocation.pathname, {
      path: this.url,
      exact: this.exact,
      strict: true
    });
  }
  async loadCompleted() {
    let routeViewOptions = {};
    if (this.history && this.history.location.hash) {
      routeViewOptions = {
        scrollToId: this.history.location.hash.substr(1)
      };
    }
    else if (this.scrollTopOffset) {
      routeViewOptions = {
        scrollTopOffset: this.scrollTopOffset
      };
    }
    // After all children have completed then tell switch
    // the provided callback will get executed after this route is in view
    if (typeof this.componentUpdated === 'function') {
      this.componentUpdated(routeViewOptions);
      // If this is an independent route and it matches then routes have updated.
      // If the only change to location is a hash change then do not scroll.
    }
    else if (this.match && !matchesAreEqual(this.match, this.previousMatch) && this.routeViewsUpdated) {
      this.routeViewsUpdated(routeViewOptions);
    }
  }
  async componentDidUpdate() {
    await this.loadCompleted();
  }
  async componentDidLoad() {
    await this.loadCompleted();
  }
  render() {
    // If there is no activeRouter then do not render
    // Check if this route is in the matching URL (for example, a parent route)
    if (!this.match || !this.history) {
      return null;
    }
    // component props defined in route
    // the history api
    // current match data including params
    const childProps = Object.assign({}, this.componentProps, { history: this.history, match: this.match });
    // If there is a routerRender defined then use
    // that and pass the component and component props with it.
    if (this.routeRender) {
      return this.routeRender(Object.assign({}, childProps, { component: this.component }));
    }
    if (this.component) {
      const ChildComponent = this.component;
      return (h(ChildComponent, Object.assign({}, childProps)));
    }
  }
  get el() { return getElement(this); }
  static get watchers() { return {
    "location": ["computeMatch"]
  }; }
};
ActiveRouter.injectProps(Route, [
  'location',
  'history',
  'historyType',
  'routeViewsUpdated'
]);
Route.style = routeCss;

export { BenefitUrl as ap_ben_benefit_url, EditBenefitForm as ap_ben_edit_benefit_form, EmptyBenefits as ap_ben_empty_benefits, FileIcon as ap_ben_file_icon, ManageBenefitsHeaderRow as ap_ben_manage_benefits_header_row, ManagedBenefitItem as ap_ben_managed_benefit_item, RoleManagementPage as ap_ben_role_management_page, UploadBenefitIcon as ap_ben_upload_benefit_icon, UploadFile as ap_ben_upload_file, Route as stencil_route };
